astropy-0.3/0000755000175000017500000000000012243263747011207 5ustar oleoleastropy-0.3/setuptools_bootstrap.py0000644000175000017500000000266712243255342016102 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Pre-ez_setup bootstrap module to ensure that either distribute or setuptools >= 0.7 is used (over pre-distribute setuptools) if it is available on the path; otherwise the latest setuptools will be downloaded and bootstrapped with ``ez_setup.py``. """ import sys import imp try: import pkg_resources _setuptools_req = pkg_resources.Requirement.parse('setuptools>=0.7') # This may raise a DistributionNotFound in which case no version of # setuptools or distribute is properly instlaled _setuptools = pkg_resources.get_distribution('setuptools') if _setuptools not in _setuptools_req: # Older version of setuptools; check if we have distribute; again if # this results in DistributionNotFound we want to give up _distribute = pkg_resources.get_distribution('distribute') if _setuptools != _distribute: # It's possible on some pathological systems to have an old version # of setuptools and distribute on sys.path simultaneously; make # sure distribute is the one that's used sys.path.insert(1, _distribute.location) _distribute.activate() imp.reload(pkg_resources) except: # There are several types of exceptions that can occur here; if all else # fails bootstrap and use the bootstrapped version from ez_setup import use_setuptools use_setuptools() astropy-0.3/README.rst0000644000175000017500000000236612243255342012675 0ustar oleole======= Astropy ======= .. image:: https://pypip.in/v/astropy/badge.png :target: https://pypi.python.org/pypi/astropy .. image:: https://pypip.in/d/astropy/badge.png :target: https://pypi.python.org/pypi/astropy Astropy (http://astropy.org/) is a package intended to contain much of the core functionality and some common tools needed for performing astronomy and astrophysics with Python. Releases are `registered on PyPI `_, and development is occuring at the `project's github page `_. For installation instructions, see the `online documentation `_ or ``docs/install.rst`` in this source distribution. Jenkins Build Status -------------------- .. image:: https://jenkins.shiningpanda-ci.com/astropy/job/astropy-master-debian-multiconfig/badge/icon :target: https://jenkins.shiningpanda-ci.com/astropy/job/astropy-master-debian-multiconfig/ Travis Build Status ------------------- .. image:: https://travis-ci.org/astropy/astropy.png :target: https://travis-ci.org/astropy/astropy Test Coverage Status -------------------- .. image:: https://coveralls.io/repos/astropy/astropy/badge.png :target: https://coveralls.io/r/astropy/astropy astropy-0.3/cextern/0000755000175000017500000000000012243263747012657 5ustar oleoleastropy-0.3/cextern/README.rst0000644000175000017500000000047112243255342014340 0ustar oleoleExternal Packages/Libraries =========================== This directory contains C libraries included with Astropy. Note that only C libraries without python-specific code should be included in this directory. Cython or C code intended for use with Astropy or wrapper code should be in the Astropy source tree. astropy-0.3/cextern/expat/0000755000175000017500000000000012243263747014000 5ustar oleoleastropy-0.3/cextern/expat/lib/0000755000175000017500000000000012243263747014546 5ustar oleoleastropy-0.3/cextern/expat/lib/iasciitab.h0000755000175000017500000000344612243255342016651 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, astropy-0.3/cextern/expat/lib/xmlparse.c0000755000175000017500000060175512243255342016556 0ustar oleole/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #include /* memset(), memcpy() */ #include #include /* UINT_MAX */ #include /* time() */ #define XML_BUILDING_EXPAT 1 #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" #elif defined(__amigaos__) #include "amigaconfig.h" #elif defined(__WATCOMC__) #include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include #endif /* ndef COMPILED_FROM_DSP */ #include "ascii.h" #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 /* Using pointer subtraction to convert to integer type. */ #define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 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, const char *start, const char *end, const char **endPtr); static Processor prologProcessor; static Processor prologInitProcessor; static Processor contentProcessor; static Processor cdataSectionProcessor; #ifdef XML_DTD static Processor ignoreSectionProcessor; static Processor externalParEntProcessor; static Processor externalParEntInitProcessor; static Processor entityValueProcessor; static Processor entityValueInitProcessor; #endif /* XML_DTD */ static Processor epilogProcessor; static Processor errorProcessor; static Processor externalEntityInitProcessor; static Processor externalEntityInitProcessor2; static Processor externalEntityInitProcessor3; static Processor externalEntityContentProcessor; static Processor internalEntityProcessor; static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next); static enum XML_Error initializeEncoding(XML_Parser parser); static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr, XML_Bool haveMore); static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl); static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *start, const char *end, const char **endPtr, XML_Bool haveMore); static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore); #ifdef XML_DTD static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore); #endif /* XML_DTD */ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr); static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *); static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, const char *, const char *, STRING_POOL *); static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); static const XML_Char * getContext(XML_Parser parser); static XML_Bool setContext(XML_Parser parser, const XML_Char *context); static void FASTCALL normalizePublicId(XML_Char *s); static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms); /* do not call if parentParser != NULL */ static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms); static void dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms); static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms); static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); static NAMED * lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize); static void FASTCALL hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms); static void FASTCALL hashTableClear(HASH_TABLE *); static void FASTCALL hashTableDestroy(HASH_TABLE *); static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); static void FASTCALL poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms); static void FASTCALL poolClear(STRING_POOL *); static void FASTCALL poolDestroy(STRING_POOL *); static XML_Char * poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end); static XML_Char * poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end); static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); static const XML_Char * FASTCALL poolCopyString(STRING_POOL *pool, const XML_Char *s); static const XML_Char * poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); static const XML_Char * FASTCALL poolAppendString(STRING_POOL *pool, const XML_Char *s); static int FASTCALL nextScaffoldPart(XML_Parser parser); static XML_Content * build_model(XML_Parser parser); static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end); static unsigned long generate_hash_secret_salt(void); static XML_Bool startParsing(XML_Parser parser); static XML_Parser parserCreate(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd); static void parserInit(XML_Parser parser, const XML_Char *encodingName); #define poolStart(pool) ((pool)->start) #define poolEnd(pool) ((pool)->ptr) #define poolLength(pool) ((pool)->ptr - (pool)->start) #define poolChop(pool) ((void)--(pool->ptr)) #define poolLastChar(pool) (((pool)->ptr)[-1]) #define poolDiscard(pool) ((pool)->ptr = (pool)->start) #define poolFinish(pool) ((pool)->start = (pool)->ptr) #define poolAppendChar(pool, c) \ (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ ? 0 \ : ((*((pool)->ptr)++ = c), 1)) struct XML_ParserStruct { /* The first member must be userData so that the XML_GetUserData macro works. */ void *m_userData; void *m_handlerArg; char *m_buffer; const XML_Memory_Handling_Suite m_mem; /* first character to be parsed */ const char *m_bufferPtr; /* past last character to be parsed */ char *m_bufferEnd; /* allocated end of buffer */ const char *m_bufferLim; XML_Index m_parseEndByteIndex; const char *m_parseEndPtr; XML_Char *m_dataBuf; XML_Char *m_dataBufEnd; XML_StartElementHandler m_startElementHandler; XML_EndElementHandler m_endElementHandler; XML_CharacterDataHandler m_characterDataHandler; XML_ProcessingInstructionHandler m_processingInstructionHandler; XML_CommentHandler m_commentHandler; XML_StartCdataSectionHandler m_startCdataSectionHandler; XML_EndCdataSectionHandler m_endCdataSectionHandler; XML_DefaultHandler m_defaultHandler; XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; XML_NotationDeclHandler m_notationDeclHandler; XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; XML_NotStandaloneHandler m_notStandaloneHandler; XML_ExternalEntityRefHandler m_externalEntityRefHandler; XML_Parser m_externalEntityRefHandlerArg; XML_SkippedEntityHandler m_skippedEntityHandler; XML_UnknownEncodingHandler m_unknownEncodingHandler; XML_ElementDeclHandler m_elementDeclHandler; XML_AttlistDeclHandler m_attlistDeclHandler; XML_EntityDeclHandler m_entityDeclHandler; XML_XmlDeclHandler m_xmlDeclHandler; const ENCODING *m_encoding; INIT_ENCODING m_initEncoding; const ENCODING *m_internalEncoding; const XML_Char *m_protocolEncodingName; XML_Bool m_ns; XML_Bool m_ns_triplets; void *m_unknownEncodingMem; void *m_unknownEncodingData; void *m_unknownEncodingHandlerData; void (XMLCALL *m_unknownEncodingRelease)(void *); PROLOG_STATE m_prologState; Processor *m_processor; enum XML_Error m_errorCode; const char *m_eventPtr; const char *m_eventEndPtr; const char *m_positionPtr; OPEN_INTERNAL_ENTITY *m_openInternalEntities; OPEN_INTERNAL_ENTITY *m_freeInternalEntities; XML_Bool m_defaultExpandInternalEntities; int m_tagLevel; ENTITY *m_declEntity; const XML_Char *m_doctypeName; const XML_Char *m_doctypeSysid; const XML_Char *m_doctypePubid; const XML_Char *m_declAttributeType; const XML_Char *m_declNotationName; const XML_Char *m_declNotationPublicId; ELEMENT_TYPE *m_declElementType; ATTRIBUTE_ID *m_declAttributeId; XML_Bool m_declAttributeIsCdata; XML_Bool m_declAttributeIsId; DTD *m_dtd; const XML_Char *m_curBase; TAG *m_tagStack; TAG *m_freeTagList; BINDING *m_inheritedBindings; BINDING *m_freeBindingList; int m_attsSize; int m_nSpecifiedAtts; int m_idAttIndex; ATTRIBUTE *m_atts; NS_ATT *m_nsAtts; unsigned long m_nsAttsVersion; unsigned char m_nsAttsPower; #ifdef XML_ATTR_INFO XML_AttrInfo *m_attInfo; #endif POSITION m_position; STRING_POOL m_tempPool; STRING_POOL m_temp2Pool; char *m_groupConnector; unsigned int m_groupSize; XML_Char m_namespaceSeparator; XML_Parser m_parentParser; XML_ParsingStatus m_parsingStatus; #ifdef XML_DTD XML_Bool m_isParamEntity; XML_Bool m_useForeignDTD; enum XML_ParamEntityParsing m_paramEntityParsing; #endif unsigned long m_hash_secret_salt; }; #define MALLOC(s) (parser->m_mem.malloc_fcn((s))) #define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s))) #define FREE(p) (parser->m_mem.free_fcn((p))) #define userData (parser->m_userData) #define handlerArg (parser->m_handlerArg) #define startElementHandler (parser->m_startElementHandler) #define endElementHandler (parser->m_endElementHandler) #define characterDataHandler (parser->m_characterDataHandler) #define processingInstructionHandler \ (parser->m_processingInstructionHandler) #define commentHandler (parser->m_commentHandler) #define startCdataSectionHandler \ (parser->m_startCdataSectionHandler) #define endCdataSectionHandler (parser->m_endCdataSectionHandler) #define defaultHandler (parser->m_defaultHandler) #define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) #define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) #define unparsedEntityDeclHandler \ (parser->m_unparsedEntityDeclHandler) #define notationDeclHandler (parser->m_notationDeclHandler) #define startNamespaceDeclHandler \ (parser->m_startNamespaceDeclHandler) #define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) #define notStandaloneHandler (parser->m_notStandaloneHandler) #define externalEntityRefHandler \ (parser->m_externalEntityRefHandler) #define externalEntityRefHandlerArg \ (parser->m_externalEntityRefHandlerArg) #define internalEntityRefHandler \ (parser->m_internalEntityRefHandler) #define skippedEntityHandler (parser->m_skippedEntityHandler) #define unknownEncodingHandler (parser->m_unknownEncodingHandler) #define elementDeclHandler (parser->m_elementDeclHandler) #define attlistDeclHandler (parser->m_attlistDeclHandler) #define entityDeclHandler (parser->m_entityDeclHandler) #define xmlDeclHandler (parser->m_xmlDeclHandler) #define encoding (parser->m_encoding) #define initEncoding (parser->m_initEncoding) #define internalEncoding (parser->m_internalEncoding) #define unknownEncodingMem (parser->m_unknownEncodingMem) #define unknownEncodingData (parser->m_unknownEncodingData) #define unknownEncodingHandlerData \ (parser->m_unknownEncodingHandlerData) #define unknownEncodingRelease (parser->m_unknownEncodingRelease) #define protocolEncodingName (parser->m_protocolEncodingName) #define ns (parser->m_ns) #define ns_triplets (parser->m_ns_triplets) #define prologState (parser->m_prologState) #define processor (parser->m_processor) #define errorCode (parser->m_errorCode) #define eventPtr (parser->m_eventPtr) #define eventEndPtr (parser->m_eventEndPtr) #define positionPtr (parser->m_positionPtr) #define position (parser->m_position) #define openInternalEntities (parser->m_openInternalEntities) #define freeInternalEntities (parser->m_freeInternalEntities) #define defaultExpandInternalEntities \ (parser->m_defaultExpandInternalEntities) #define tagLevel (parser->m_tagLevel) #define buffer (parser->m_buffer) #define bufferPtr (parser->m_bufferPtr) #define bufferEnd (parser->m_bufferEnd) #define parseEndByteIndex (parser->m_parseEndByteIndex) #define parseEndPtr (parser->m_parseEndPtr) #define bufferLim (parser->m_bufferLim) #define dataBuf (parser->m_dataBuf) #define dataBufEnd (parser->m_dataBufEnd) #define _dtd (parser->m_dtd) #define curBase (parser->m_curBase) #define declEntity (parser->m_declEntity) #define doctypeName (parser->m_doctypeName) #define doctypeSysid (parser->m_doctypeSysid) #define doctypePubid (parser->m_doctypePubid) #define declAttributeType (parser->m_declAttributeType) #define declNotationName (parser->m_declNotationName) #define declNotationPublicId (parser->m_declNotationPublicId) #define declElementType (parser->m_declElementType) #define declAttributeId (parser->m_declAttributeId) #define declAttributeIsCdata (parser->m_declAttributeIsCdata) #define declAttributeIsId (parser->m_declAttributeIsId) #define freeTagList (parser->m_freeTagList) #define freeBindingList (parser->m_freeBindingList) #define inheritedBindings (parser->m_inheritedBindings) #define tagStack (parser->m_tagStack) #define atts (parser->m_atts) #define attsSize (parser->m_attsSize) #define nSpecifiedAtts (parser->m_nSpecifiedAtts) #define idAttIndex (parser->m_idAttIndex) #define nsAtts (parser->m_nsAtts) #define nsAttsVersion (parser->m_nsAttsVersion) #define nsAttsPower (parser->m_nsAttsPower) #define attInfo (parser->m_attInfo) #define tempPool (parser->m_tempPool) #define temp2Pool (parser->m_temp2Pool) #define groupConnector (parser->m_groupConnector) #define groupSize (parser->m_groupSize) #define namespaceSeparator (parser->m_namespaceSeparator) #define parentParser (parser->m_parentParser) #define ps_parsing (parser->m_parsingStatus.parsing) #define ps_finalBuffer (parser->m_parsingStatus.finalBuffer) #ifdef XML_DTD #define isParamEntity (parser->m_isParamEntity) #define useForeignDTD (parser->m_useForeignDTD) #define paramEntityParsing (parser->m_paramEntityParsing) #endif /* XML_DTD */ #define hash_secret_salt (parser->m_hash_secret_salt) XML_Parser XMLCALL XML_ParserCreate(const XML_Char *encodingName) { return XML_ParserCreate_MM(encodingName, NULL, NULL); } XML_Parser XMLCALL XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) { XML_Char tmp[2]; *tmp = nsSep; return XML_ParserCreate_MM(encodingName, NULL, tmp); } static const XML_Char implicitContext[] = { ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' }; static unsigned long generate_hash_secret_salt(void) { unsigned int seed = time(NULL) % UINT_MAX; srand(seed); return rand(); } static XML_Bool /* only valid for root parser */ startParsing(XML_Parser parser) { /* hash functions must be initialized before setContext() is called */ if (hash_secret_salt == 0) hash_secret_salt = generate_hash_secret_salt(); if (ns) { /* implicit context only set for root parser, since child parsers (i.e. external entity parsers) will inherit it */ return setContext(parser, implicitContext); } return XML_TRUE; } XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep) { return parserCreate(encodingName, memsuite, nameSep, NULL); } static XML_Parser parserCreate(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, DTD *dtd) { XML_Parser parser; if (memsuite) { XML_Memory_Handling_Suite *mtemp; parser = (XML_Parser) memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); if (parser != NULL) { mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); mtemp->malloc_fcn = memsuite->malloc_fcn; mtemp->realloc_fcn = memsuite->realloc_fcn; mtemp->free_fcn = memsuite->free_fcn; } } else { XML_Memory_Handling_Suite *mtemp; parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct)); if (parser != NULL) { mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); mtemp->malloc_fcn = malloc; mtemp->realloc_fcn = realloc; mtemp->free_fcn = free; } } if (!parser) return parser; buffer = NULL; bufferLim = NULL; attsSize = INIT_ATTS_SIZE; atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); if (atts == NULL) { FREE(parser); return NULL; } #ifdef XML_ATTR_INFO attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo)); if (attInfo == NULL) { FREE(atts); FREE(parser); return NULL; } #endif dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); if (dataBuf == NULL) { FREE(atts); #ifdef XML_ATTR_INFO FREE(attInfo); #endif FREE(parser); return NULL; } dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; if (dtd) _dtd = dtd; else { _dtd = dtdCreate(&parser->m_mem); if (_dtd == NULL) { FREE(dataBuf); FREE(atts); #ifdef XML_ATTR_INFO FREE(attInfo); #endif FREE(parser); return NULL; } } freeBindingList = NULL; freeTagList = NULL; freeInternalEntities = NULL; groupSize = 0; groupConnector = NULL; unknownEncodingHandler = NULL; unknownEncodingHandlerData = NULL; namespaceSeparator = ASCII_EXCL; ns = XML_FALSE; ns_triplets = XML_FALSE; nsAtts = NULL; nsAttsVersion = 0; nsAttsPower = 0; poolInit(&tempPool, &(parser->m_mem)); poolInit(&temp2Pool, &(parser->m_mem)); parserInit(parser, encodingName); if (encodingName && !protocolEncodingName) { XML_ParserFree(parser); return NULL; } if (nameSep) { ns = XML_TRUE; internalEncoding = XmlGetInternalEncodingNS(); namespaceSeparator = *nameSep; } else { internalEncoding = XmlGetInternalEncoding(); } return parser; } static void parserInit(XML_Parser parser, const XML_Char *encodingName) { processor = prologInitProcessor; XmlPrologStateInit(&prologState); protocolEncodingName = (encodingName != NULL ? poolCopyString(&tempPool, encodingName) : NULL); curBase = NULL; XmlInitEncoding(&initEncoding, &encoding, 0); userData = NULL; handlerArg = NULL; startElementHandler = NULL; endElementHandler = NULL; characterDataHandler = NULL; processingInstructionHandler = NULL; commentHandler = NULL; startCdataSectionHandler = NULL; endCdataSectionHandler = NULL; defaultHandler = NULL; startDoctypeDeclHandler = NULL; endDoctypeDeclHandler = NULL; unparsedEntityDeclHandler = NULL; notationDeclHandler = NULL; startNamespaceDeclHandler = NULL; endNamespaceDeclHandler = NULL; notStandaloneHandler = NULL; externalEntityRefHandler = NULL; externalEntityRefHandlerArg = parser; skippedEntityHandler = NULL; elementDeclHandler = NULL; attlistDeclHandler = NULL; entityDeclHandler = NULL; xmlDeclHandler = NULL; bufferPtr = buffer; bufferEnd = buffer; parseEndByteIndex = 0; parseEndPtr = NULL; declElementType = NULL; declAttributeId = NULL; declEntity = NULL; doctypeName = NULL; doctypeSysid = NULL; doctypePubid = NULL; declAttributeType = NULL; declNotationName = NULL; declNotationPublicId = NULL; declAttributeIsCdata = XML_FALSE; declAttributeIsId = XML_FALSE; memset(&position, 0, sizeof(POSITION)); errorCode = XML_ERROR_NONE; eventPtr = NULL; eventEndPtr = NULL; positionPtr = NULL; openInternalEntities = NULL; defaultExpandInternalEntities = XML_TRUE; tagLevel = 0; tagStack = NULL; inheritedBindings = NULL; nSpecifiedAtts = 0; unknownEncodingMem = NULL; unknownEncodingRelease = NULL; unknownEncodingData = NULL; parentParser = NULL; ps_parsing = XML_INITIALIZED; #ifdef XML_DTD isParamEntity = XML_FALSE; useForeignDTD = XML_FALSE; paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif hash_secret_salt = 0; } /* moves list of bindings to freeBindingList */ static void FASTCALL moveToFreeBindingList(XML_Parser parser, BINDING *bindings) { while (bindings) { BINDING *b = bindings; bindings = bindings->nextTagBinding; b->nextTagBinding = freeBindingList; freeBindingList = b; } } XML_Bool XMLCALL XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) { TAG *tStk; OPEN_INTERNAL_ENTITY *openEntityList; if (parentParser) return XML_FALSE; /* move tagStack to freeTagList */ tStk = tagStack; while (tStk) { TAG *tag = tStk; tStk = tStk->parent; tag->parent = freeTagList; moveToFreeBindingList(parser, tag->bindings); tag->bindings = NULL; freeTagList = tag; } /* move openInternalEntities to freeInternalEntities */ openEntityList = openInternalEntities; while (openEntityList) { OPEN_INTERNAL_ENTITY *openEntity = openEntityList; openEntityList = openEntity->next; openEntity->next = freeInternalEntities; freeInternalEntities = openEntity; } moveToFreeBindingList(parser, inheritedBindings); FREE(unknownEncodingMem); if (unknownEncodingRelease) unknownEncodingRelease(unknownEncodingData); poolClear(&tempPool); poolClear(&temp2Pool); parserInit(parser, encodingName); dtdReset(_dtd, &parser->m_mem); return XML_TRUE; } enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { /* Block after XML_Parse()/XML_ParseBuffer() has been called. XXX There's no way for the caller to determine which of the XXX possible error cases caused the XML_STATUS_ERROR return. */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return XML_STATUS_ERROR; if (encodingName == NULL) protocolEncodingName = NULL; else { protocolEncodingName = poolCopyString(&tempPool, encodingName); if (!protocolEncodingName) return XML_STATUS_ERROR; } return XML_STATUS_OK; } XML_Parser XMLCALL XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, const XML_Char *encodingName) { XML_Parser parser = oldParser; DTD *newDtd = NULL; DTD *oldDtd = _dtd; XML_StartElementHandler oldStartElementHandler = startElementHandler; XML_EndElementHandler oldEndElementHandler = endElementHandler; XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler; XML_CommentHandler oldCommentHandler = commentHandler; XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler; XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler; XML_DefaultHandler oldDefaultHandler = defaultHandler; XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler; XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler; XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler; XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler; XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler; XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; ELEMENT_TYPE * oldDeclElementType = declElementType; void *oldUserData = userData; void *oldHandlerArg = handlerArg; XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; #ifdef XML_DTD enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; int oldInEntityValue = prologState.inEntityValue; #endif XML_Bool oldns_triplets = ns_triplets; /* Note that the new parser shares the same hash secret as the old parser, so that dtdCopy and copyEntityTable can lookup values from hash tables associated with either parser without us having to worry which hash secrets each table has. */ unsigned long oldhash_secret_salt = hash_secret_salt; #ifdef XML_DTD if (!context) newDtd = oldDtd; #endif /* XML_DTD */ /* Note that the magical uses of the pre-processor to make field access look more like C++ require that `parser' be overwritten here. This makes this function more painful to follow than it would be otherwise. */ if (ns) { XML_Char tmp[2]; *tmp = namespaceSeparator; parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd); } else { parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd); } if (!parser) return NULL; startElementHandler = oldStartElementHandler; endElementHandler = oldEndElementHandler; characterDataHandler = oldCharacterDataHandler; processingInstructionHandler = oldProcessingInstructionHandler; commentHandler = oldCommentHandler; startCdataSectionHandler = oldStartCdataSectionHandler; endCdataSectionHandler = oldEndCdataSectionHandler; defaultHandler = oldDefaultHandler; unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; notationDeclHandler = oldNotationDeclHandler; startNamespaceDeclHandler = oldStartNamespaceDeclHandler; endNamespaceDeclHandler = oldEndNamespaceDeclHandler; notStandaloneHandler = oldNotStandaloneHandler; externalEntityRefHandler = oldExternalEntityRefHandler; skippedEntityHandler = oldSkippedEntityHandler; unknownEncodingHandler = oldUnknownEncodingHandler; elementDeclHandler = oldElementDeclHandler; attlistDeclHandler = oldAttlistDeclHandler; entityDeclHandler = oldEntityDeclHandler; xmlDeclHandler = oldXmlDeclHandler; declElementType = oldDeclElementType; userData = oldUserData; if (oldUserData == oldHandlerArg) handlerArg = userData; else handlerArg = parser; if (oldExternalEntityRefHandlerArg != oldParser) externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; defaultExpandInternalEntities = oldDefaultExpandInternalEntities; ns_triplets = oldns_triplets; hash_secret_salt = oldhash_secret_salt; parentParser = oldParser; #ifdef XML_DTD paramEntityParsing = oldParamEntityParsing; prologState.inEntityValue = oldInEntityValue; if (context) { #endif /* XML_DTD */ if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem) || !setContext(parser, context)) { XML_ParserFree(parser); return NULL; } processor = externalEntityInitProcessor; #ifdef XML_DTD } else { /* The DTD instance referenced by _dtd is shared between the document's root parser and external PE parsers, therefore one does not need to call setContext. In addition, one also *must* not call setContext, because this would overwrite existing prefix->binding pointers in _dtd with ones that get destroyed with the external PE parser. This would leave those prefixes with dangling pointers. */ isParamEntity = XML_TRUE; XmlPrologStateInitExternalEntity(&prologState); processor = externalParEntInitProcessor; } #endif /* XML_DTD */ return parser; } static void FASTCALL destroyBindings(BINDING *bindings, XML_Parser parser) { for (;;) { BINDING *b = bindings; if (!b) break; bindings = b->nextTagBinding; FREE(b->uri); FREE(b); } } void XMLCALL XML_ParserFree(XML_Parser parser) { TAG *tagList; OPEN_INTERNAL_ENTITY *entityList; if (parser == NULL) return; /* free tagStack and freeTagList */ tagList = tagStack; for (;;) { TAG *p; if (tagList == NULL) { if (freeTagList == NULL) break; tagList = freeTagList; freeTagList = NULL; } p = tagList; tagList = tagList->parent; FREE(p->buf); destroyBindings(p->bindings, parser); FREE(p); } /* free openInternalEntities and freeInternalEntities */ entityList = openInternalEntities; for (;;) { OPEN_INTERNAL_ENTITY *openEntity; if (entityList == NULL) { if (freeInternalEntities == NULL) break; entityList = freeInternalEntities; freeInternalEntities = NULL; } openEntity = entityList; entityList = entityList->next; FREE(openEntity); } destroyBindings(freeBindingList, parser); destroyBindings(inheritedBindings, parser); poolDestroy(&tempPool); poolDestroy(&temp2Pool); #ifdef XML_DTD /* external parameter entity parsers share the DTD structure parser->m_dtd with the root parser, so we must not destroy it */ if (!isParamEntity && _dtd) #else if (_dtd) #endif /* XML_DTD */ dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); FREE((void *)atts); #ifdef XML_ATTR_INFO FREE((void *)attInfo); #endif FREE(groupConnector); FREE(buffer); FREE(dataBuf); FREE(nsAtts); FREE(unknownEncodingMem); if (unknownEncodingRelease) unknownEncodingRelease(unknownEncodingData); FREE(parser); } void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser) { handlerArg = parser; } enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) { #ifdef XML_DTD /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; useForeignDTD = useDTD; return XML_ERROR_NONE; #else return XML_ERROR_FEATURE_REQUIRES_XML_DTD; #endif } void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) { /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return; ns_triplets = do_nst ? XML_TRUE : XML_FALSE; } void XMLCALL XML_SetUserData(XML_Parser parser, void *p) { if (handlerArg == userData) handlerArg = userData = p; else userData = p; } enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p) { if (p) { p = poolCopyString(&_dtd->pool, p); if (!p) return XML_STATUS_ERROR; curBase = p; } else curBase = NULL; return XML_STATUS_OK; } const XML_Char * XMLCALL XML_GetBase(XML_Parser parser) { return curBase; } int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser) { return nSpecifiedAtts; } int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser) { return idAttIndex; } #ifdef XML_ATTR_INFO const XML_AttrInfo * XMLCALL XML_GetAttributeInfo(XML_Parser parser) { return attInfo; } #endif void XMLCALL XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { startElementHandler = start; endElementHandler = end; } void XMLCALL XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) { startElementHandler = start; } void XMLCALL XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end) { endElementHandler = end; } void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler) { characterDataHandler = handler; } void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler) { processingInstructionHandler = handler; } void XMLCALL XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { commentHandler = handler; } void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) { startCdataSectionHandler = start; endCdataSectionHandler = end; } void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start) { startCdataSectionHandler = start; } void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end) { endCdataSectionHandler = end; } void XMLCALL XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { defaultHandler = handler; defaultExpandInternalEntities = XML_FALSE; } void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { defaultHandler = handler; defaultExpandInternalEntities = XML_TRUE; } void XMLCALL XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) { startDoctypeDeclHandler = start; endDoctypeDeclHandler = end; } void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start) { startDoctypeDeclHandler = start; } void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end) { endDoctypeDeclHandler = end; } void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { unparsedEntityDeclHandler = handler; } void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) { notationDeclHandler = handler; } void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) { startNamespaceDeclHandler = start; endNamespaceDeclHandler = end; } void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start) { startNamespaceDeclHandler = start; } void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end) { endNamespaceDeclHandler = end; } void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler) { notStandaloneHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler) { externalEntityRefHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) { if (arg) externalEntityRefHandlerArg = (XML_Parser)arg; else externalEntityRefHandlerArg = parser; } void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler) { skippedEntityHandler = handler; } void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data) { unknownEncodingHandler = handler; unknownEncodingHandlerData = data; } void XMLCALL XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl) { elementDeclHandler = eldecl; } void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl) { attlistDeclHandler = attdecl; } void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) { entityDeclHandler = handler; } void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) { xmlDeclHandler = handler; } int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing peParsing) { /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; #ifdef XML_DTD paramEntityParsing = peParsing; return 1; #else return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; #endif } int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) { /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; hash_secret_salt = hash_salt; return 1; } enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: if (parentParser == NULL && !startParsing(parser)) { errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } default: ps_parsing = XML_PARSING; } if (len == 0) { ps_finalBuffer = (XML_Bool)isFinal; if (!isFinal) return XML_STATUS_OK; positionPtr = bufferPtr; parseEndPtr = bufferEnd; /* If data are left over from last buffer, and we now know that these data are the final chunk of input, then we have to check them again to detect errors based on that fact. */ errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); if (errorCode == XML_ERROR_NONE) { switch (ps_parsing) { case XML_SUSPENDED: XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return XML_STATUS_SUSPENDED; case XML_INITIALIZED: case XML_PARSING: ps_parsing = XML_FINISHED; /* fall through */ default: return XML_STATUS_OK; } } eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } #ifndef XML_CONTEXT_BYTES else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; enum XML_Error result; parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; errorCode = processor(parser, s, parseEndPtr = s + len, &end); if (errorCode != XML_ERROR_NONE) { eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } else { switch (ps_parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { ps_parsing = XML_FINISHED; return XML_STATUS_OK; } /* fall through */ default: result = XML_STATUS_OK; } } XmlUpdatePosition(encoding, positionPtr, end, &position); nLeftOver = s + len - end; if (nLeftOver) { if (buffer == NULL || nLeftOver > bufferLim - buffer) { /* FIXME avoid integer overflow */ char *temp; temp = (buffer == NULL ? (char *)MALLOC(len * 2) : (char *)REALLOC(buffer, len * 2)); if (temp == NULL) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = NULL; processor = errorProcessor; return XML_STATUS_ERROR; } buffer = temp; bufferLim = buffer + len * 2; } memcpy(buffer, end, nLeftOver); } bufferPtr = buffer; bufferEnd = buffer + nLeftOver; positionPtr = bufferPtr; parseEndPtr = bufferEnd; eventPtr = bufferPtr; eventEndPtr = bufferPtr; return result; } #endif /* not defined XML_CONTEXT_BYTES */ else { void *buff = XML_GetBuffer(parser, len); if (buff == NULL) return XML_STATUS_ERROR; else { memcpy(buff, s, len); return XML_ParseBuffer(parser, len, isFinal); } } } enum XML_Status XMLCALL XML_ParseBuffer(XML_Parser parser, int len, int isFinal) { const char *start; enum XML_Status result = XML_STATUS_OK; switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: if (parentParser == NULL && !startParsing(parser)) { errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } default: ps_parsing = XML_PARSING; } start = bufferPtr; positionPtr = start; bufferEnd += len; parseEndPtr = bufferEnd; parseEndByteIndex += len; ps_finalBuffer = (XML_Bool)isFinal; errorCode = processor(parser, start, parseEndPtr, &bufferPtr); if (errorCode != XML_ERROR_NONE) { eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } else { switch (ps_parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { ps_parsing = XML_FINISHED; return result; } default: ; /* should not happen */ } } XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return result; } void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return NULL; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return NULL; default: ; } if (len > bufferLim - bufferEnd) { /* FIXME avoid integer overflow */ int neededSize = len + (int)(bufferEnd - bufferPtr); #ifdef XML_CONTEXT_BYTES int keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; neededSize += keep; #endif /* defined XML_CONTEXT_BYTES */ if (neededSize <= bufferLim - buffer) { #ifdef XML_CONTEXT_BYTES if (keep < bufferPtr - buffer) { int offset = (int)(bufferPtr - buffer) - keep; memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); bufferEnd -= offset; bufferPtr -= offset; } #else memmove(buffer, bufferPtr, bufferEnd - bufferPtr); bufferEnd = buffer + (bufferEnd - bufferPtr); bufferPtr = buffer; #endif /* not defined XML_CONTEXT_BYTES */ } else { char *newBuf; int bufferSize = (int)(bufferLim - bufferPtr); if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; } while (bufferSize < neededSize); newBuf = (char *)MALLOC(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; return NULL; } bufferLim = newBuf + bufferSize; #ifdef XML_CONTEXT_BYTES if (bufferPtr) { int keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); FREE(buffer); buffer = newBuf; bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; bufferPtr = buffer + keep; } else { bufferEnd = newBuf + (bufferEnd - bufferPtr); bufferPtr = buffer = newBuf; } #else if (bufferPtr) { memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); FREE(buffer); } bufferEnd = newBuf + (bufferEnd - bufferPtr); bufferPtr = buffer = newBuf; #endif /* not defined XML_CONTEXT_BYTES */ } eventPtr = eventEndPtr = NULL; positionPtr = NULL; } return bufferEnd; } enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable) { switch (ps_parsing) { case XML_SUSPENDED: if (resumable) { errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; } ps_parsing = XML_FINISHED; break; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; default: if (resumable) { #ifdef XML_DTD if (isParamEntity) { errorCode = XML_ERROR_SUSPEND_PE; return XML_STATUS_ERROR; } #endif ps_parsing = XML_SUSPENDED; } else ps_parsing = XML_FINISHED; } return XML_STATUS_OK; } enum XML_Status XMLCALL XML_ResumeParser(XML_Parser parser) { enum XML_Status result = XML_STATUS_OK; if (ps_parsing != XML_SUSPENDED) { errorCode = XML_ERROR_NOT_SUSPENDED; return XML_STATUS_ERROR; } ps_parsing = XML_PARSING; errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); if (errorCode != XML_ERROR_NONE) { eventEndPtr = eventPtr; processor = errorProcessor; return XML_STATUS_ERROR; } else { switch (ps_parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (ps_finalBuffer) { ps_parsing = XML_FINISHED; return result; } default: ; } } XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); positionPtr = bufferPtr; return result; } void XMLCALL XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) { assert(status != NULL); *status = parser->m_parsingStatus; } enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser) { return errorCode; } XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser) { if (eventPtr) return parseEndByteIndex - (parseEndPtr - eventPtr); return -1; } int XMLCALL XML_GetCurrentByteCount(XML_Parser parser) { if (eventEndPtr && eventPtr) return (int)(eventEndPtr - eventPtr); return 0; } const char * XMLCALL XML_GetInputContext(XML_Parser parser, int *offset, int *size) { #ifdef XML_CONTEXT_BYTES if (eventPtr && buffer) { *offset = (int)(eventPtr - buffer); *size = (int)(bufferEnd - buffer); return buffer; } #endif /* defined XML_CONTEXT_BYTES */ return (char *) 0; } XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser) { if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; } return position.lineNumber + 1; } XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) { if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; } return position.columnNumber; } void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model) { FREE(model); } void * XMLCALL XML_MemMalloc(XML_Parser parser, size_t size) { return MALLOC(size); } void * XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) { return REALLOC(ptr, size); } void XMLCALL XML_MemFree(XML_Parser parser, void *ptr) { FREE(ptr); } void XMLCALL XML_DefaultCurrent(XML_Parser parser) { if (defaultHandler) { if (openInternalEntities) reportDefault(parser, internalEncoding, openInternalEntities->internalEventPtr, openInternalEntities->internalEventEndPtr); else reportDefault(parser, encoding, eventPtr, eventEndPtr); } } const XML_LChar * XMLCALL XML_ErrorString(enum XML_Error code) { static const XML_LChar* const message[] = { 0, XML_L("out of memory"), XML_L("syntax error"), XML_L("no element found"), XML_L("not well-formed (invalid token)"), XML_L("unclosed token"), XML_L("partial character"), XML_L("mismatched tag"), XML_L("duplicate attribute"), XML_L("junk after document element"), XML_L("illegal parameter entity reference"), XML_L("undefined entity"), XML_L("recursive entity reference"), XML_L("asynchronous entity"), XML_L("reference to invalid character number"), XML_L("reference to binary entity"), XML_L("reference to external entity in attribute"), XML_L("XML or text declaration not at start of entity"), XML_L("unknown encoding"), XML_L("encoding specified in XML declaration is incorrect"), XML_L("unclosed CDATA section"), XML_L("error in processing external entity reference"), XML_L("document is not standalone"), XML_L("unexpected parser state - please send a bug report"), XML_L("entity declared in parameter entity"), XML_L("requested feature requires XML_DTD support in Expat"), XML_L("cannot change setting once parsing has begun"), XML_L("unbound prefix"), XML_L("must not undeclare prefix"), XML_L("incomplete markup in parameter entity"), XML_L("XML declaration not well-formed"), XML_L("text declaration not well-formed"), XML_L("illegal character(s) in public id"), XML_L("parser suspended"), XML_L("parser not suspended"), XML_L("parsing aborted"), XML_L("parsing finished"), XML_L("cannot suspend in external parameter entity"), XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"), XML_L("reserved prefix (xmlns) must not be declared or undeclared"), XML_L("prefix must not be bound to one of the reserved namespace names") }; if (code > 0 && code < sizeof(message)/sizeof(message[0])) return message[code]; return NULL; } const XML_LChar * XMLCALL XML_ExpatVersion(void) { /* V1 is used to string-ize the version number. However, it would string-ize the actual version macro *names* unless we get them substituted before being passed to V1. CPP is defined to expand a macro, then rescan for more expansions. Thus, we use V2 to expand the version macros, then CPP will expand the resulting V1() macro with the correct numerals. */ /* ### I'm assuming cpp is portable in this respect... */ #define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) #define V2(a,b,c) XML_L("expat_")V1(a,b,c) return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); #undef V1 #undef V2 } XML_Expat_Version XMLCALL XML_ExpatVersionInfo(void) { XML_Expat_Version version; version.major = XML_MAJOR_VERSION; version.minor = XML_MINOR_VERSION; version.micro = XML_MICRO_VERSION; return version; } const XML_Feature * XMLCALL XML_GetFeatureList(void) { static const XML_Feature features[] = { {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), sizeof(XML_Char)}, {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), sizeof(XML_LChar)}, #ifdef XML_UNICODE {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, #endif #ifdef XML_UNICODE_WCHAR_T {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, #endif #ifdef XML_DTD {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, #endif #ifdef XML_CONTEXT_BYTES {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), XML_CONTEXT_BYTES}, #endif #ifdef XML_MIN_SIZE {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, #endif #ifdef XML_NS {XML_FEATURE_NS, XML_L("XML_NS"), 0}, #endif #ifdef XML_LARGE_SIZE {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, #endif #ifdef XML_ATTR_INFO {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, #endif {XML_FEATURE_END, NULL, 0} }; return features; } /* Initially tag->rawName always points into the parse buffer; for those TAG instances opened while the current parse buffer was processed, and not yet closed, we need to store tag->rawName in a more permanent location, since the parse buffer is about to be discarded. */ static XML_Bool storeRawNames(XML_Parser parser) { TAG *tag = tagStack; while (tag) { int bufSize; int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); char *rawNameBuf = tag->buf + nameLen; /* Stop if already stored. Since tagStack is a stack, we can stop at the first entry that has already been copied; everything below it in the stack is already been accounted for in a previous call to this function. */ if (tag->rawName == rawNameBuf) break; /* For re-use purposes we need to ensure that the size of tag->buf is a multiple of sizeof(XML_Char). */ bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); if (bufSize > tag->bufEnd - tag->buf) { char *temp = (char *)REALLOC(tag->buf, bufSize); if (temp == NULL) return XML_FALSE; /* if tag->name.str points to tag->buf (only when namespace processing is off) then we have to update it */ if (tag->name.str == (XML_Char *)tag->buf) tag->name.str = (XML_Char *)temp; /* if tag->name.localPart is set (when namespace processing is on) then update it as well, since it will always point into tag->buf */ if (tag->name.localPart) tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - (XML_Char *)tag->buf); tag->buf = temp; tag->bufEnd = temp + bufSize; rawNameBuf = temp + nameLen; } memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); tag->rawName = rawNameBuf; tag = tag->parent; } return XML_TRUE; } static enum XML_Error PTRCALL contentProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doContent(parser, 0, encoding, start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result == XML_ERROR_NONE) { if (!storeRawNames(parser)) return XML_ERROR_NO_MEMORY; } return result; } static enum XML_Error PTRCALL externalEntityInitProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; processor = externalEntityInitProcessor2; return externalEntityInitProcessor2(parser, start, end, endPtr); } static enum XML_Error PTRCALL externalEntityInitProcessor2(XML_Parser parser, const char *start, const char *end, const char **endPtr) { const char *next = start; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(encoding, start, end, &next); switch (tok) { case XML_TOK_BOM: /* If we are at the end of the buffer, this would cause the next stage, i.e. externalEntityInitProcessor3, to pass control directly to doContent (by detecting XML_TOK_NONE) without processing any xml text declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. */ if (next == end && !ps_finalBuffer) { *endPtr = next; return XML_ERROR_NONE; } start = next; break; case XML_TOK_PARTIAL: if (!ps_finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (!ps_finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } processor = externalEntityInitProcessor3; return externalEntityInitProcessor3(parser, start, end, endPtr); } static enum XML_Error PTRCALL externalEntityInitProcessor3(XML_Parser parser, const char *start, const char *end, const char **endPtr) { int tok; const char *next = start; /* XmlContentTok doesn't always set the last arg */ eventPtr = start; tok = XmlContentTok(encoding, start, end, &next); eventEndPtr = next; switch (tok) { case XML_TOK_XML_DECL: { enum XML_Error result; result = processXmlDecl(parser, 1, start, next); if (result != XML_ERROR_NONE) return result; switch (ps_parsing) { case XML_SUSPENDED: *endPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: start = next; } } break; case XML_TOK_PARTIAL: if (!ps_finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (!ps_finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; } processor = externalEntityContentProcessor; tagLevel = 1; return externalEntityContentProcessor(parser, start, end, endPtr); } static enum XML_Error PTRCALL externalEntityContentProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doContent(parser, 1, encoding, start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result == XML_ERROR_NONE) { if (!storeRawNames(parser)) return XML_ERROR_NO_MEMORY; } return result; } static enum XML_Error doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, const char *s, const char *end, const char **nextPtr, XML_Bool haveMore) { /* save one level of indirection */ DTD * const dtd = _dtd; const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; for (;;) { const char *next = s; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_TRAILING_CR: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } *eventEndPP = end; if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, end); /* We are at the end of the final buffer, should we check for XML_SUSPENDED, XML_FINISHED? */ if (startTagLevel == 0) return XML_ERROR_NO_ELEMENTS; if (tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; *nextPtr = end; return XML_ERROR_NONE; case XML_TOK_NONE: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } if (startTagLevel > 0) { if (tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_NO_ELEMENTS; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_ENTITY_REF: { const XML_Char *name; ENTITY *entity; XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (ch) { if (characterDataHandler) characterDataHandler(handlerArg, &ch, 1); else if (defaultHandler) reportDefault(parser, enc, s, next); break; } name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); poolDiscard(&dtd->pool); /* First, determine if a check for an existing declaration is needed; if yes, check that the entity exists, and that it is internal, otherwise call the skipped entity or default handler. */ if (!dtd->hasParamEntityRefs || dtd->standalone) { if (!entity) return XML_ERROR_UNDEFINED_ENTITY; else if (!entity->is_internal) return XML_ERROR_ENTITY_DECLARED_IN_PE; } else if (!entity) { if (skippedEntityHandler) skippedEntityHandler(handlerArg, name, 0); else if (defaultHandler) reportDefault(parser, enc, s, next); break; } if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->notation) return XML_ERROR_BINARY_ENTITY_REF; if (entity->textPtr) { enum XML_Error result; if (!defaultExpandInternalEntities) { if (skippedEntityHandler) skippedEntityHandler(handlerArg, entity->name, 0); else if (defaultHandler) reportDefault(parser, enc, s, next); break; } result = processInternalEntity(parser, entity, XML_FALSE); if (result != XML_ERROR_NONE) return result; } else if (externalEntityRefHandler) { const XML_Char *context; entity->open = XML_TRUE; context = getContext(parser); entity->open = XML_FALSE; if (!context) return XML_ERROR_NO_MEMORY; if (!externalEntityRefHandler(externalEntityRefHandlerArg, context, entity->base, entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; poolDiscard(&tempPool); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; } case XML_TOK_START_TAG_NO_ATTS: /* fall through */ case XML_TOK_START_TAG_WITH_ATTS: { TAG *tag; enum XML_Error result; XML_Char *toPtr; if (freeTagList) { tag = freeTagList; freeTagList = freeTagList->parent; } else { tag = (TAG *)MALLOC(sizeof(TAG)); if (!tag) return XML_ERROR_NO_MEMORY; tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); if (!tag->buf) { FREE(tag); return XML_ERROR_NO_MEMORY; } tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; } tag->bindings = NULL; tag->parent = tagStack; tagStack = tag; tag->name.localPart = NULL; tag->name.prefix = NULL; tag->rawName = s + enc->minBytesPerChar; tag->rawNameLength = XmlNameLength(enc, tag->rawName); ++tagLevel; { const char *rawNameEnd = tag->rawName + tag->rawNameLength; const char *fromPtr = tag->rawName; toPtr = (XML_Char *)tag->buf; for (;;) { int bufSize; int convLen; XmlConvert(enc, &fromPtr, rawNameEnd, (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); convLen = (int)(toPtr - (XML_Char *)tag->buf); if (fromPtr == rawNameEnd) { tag->name.strLen = convLen; break; } bufSize = (int)(tag->bufEnd - tag->buf) << 1; { char *temp = (char *)REALLOC(tag->buf, bufSize); if (temp == NULL) return XML_ERROR_NO_MEMORY; tag->buf = temp; tag->bufEnd = temp + bufSize; toPtr = (XML_Char *)temp + convLen; } } } tag->name.str = (XML_Char *)tag->buf; *toPtr = XML_T('\0'); result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); if (result) return result; if (startElementHandler) startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts); else if (defaultHandler) reportDefault(parser, enc, s, next); poolClear(&tempPool); break; } case XML_TOK_EMPTY_ELEMENT_NO_ATTS: /* fall through */ case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: { const char *rawName = s + enc->minBytesPerChar; enum XML_Error result; BINDING *bindings = NULL; XML_Bool noElmHandlers = XML_TRUE; TAG_NAME name; name.str = poolStoreString(&tempPool, enc, rawName, rawName + XmlNameLength(enc, rawName)); if (!name.str) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); result = storeAtts(parser, enc, s, &name, &bindings); if (result) return result; poolFinish(&tempPool); if (startElementHandler) { startElementHandler(handlerArg, name.str, (const XML_Char **)atts); noElmHandlers = XML_FALSE; } if (endElementHandler) { if (startElementHandler) *eventPP = *eventEndPP; endElementHandler(handlerArg, name.str); noElmHandlers = XML_FALSE; } if (noElmHandlers && defaultHandler) reportDefault(parser, enc, s, next); poolClear(&tempPool); while (bindings) { BINDING *b = bindings; if (endNamespaceDeclHandler) endNamespaceDeclHandler(handlerArg, b->prefix->name); bindings = bindings->nextTagBinding; b->nextTagBinding = freeBindingList; freeBindingList = b; b->prefix->binding = b->prevPrefixBinding; } } if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); break; case XML_TOK_END_TAG: if (tagLevel == startTagLevel) return XML_ERROR_ASYNC_ENTITY; else { int len; const char *rawName; TAG *tag = tagStack; tagStack = tag->parent; tag->parent = freeTagList; freeTagList = tag; rawName = s + enc->minBytesPerChar*2; len = XmlNameLength(enc, rawName); if (len != tag->rawNameLength || memcmp(tag->rawName, rawName, len) != 0) { *eventPP = rawName; return XML_ERROR_TAG_MISMATCH; } --tagLevel; if (endElementHandler) { const XML_Char *localPart; const XML_Char *prefix; XML_Char *uri; localPart = tag->name.localPart; if (ns && localPart) { /* localPart and prefix may have been overwritten in tag->name.str, since this points to the binding->uri buffer which gets re-used; so we have to add them again */ uri = (XML_Char *)tag->name.str + tag->name.uriLen; /* don't need to check for space - already done in storeAtts() */ while (*localPart) *uri++ = *localPart++; prefix = (XML_Char *)tag->name.prefix; if (ns_triplets && prefix) { *uri++ = namespaceSeparator; while (*prefix) *uri++ = *prefix++; } *uri = XML_T('\0'); } endElementHandler(handlerArg, tag->name.str); } else if (defaultHandler) reportDefault(parser, enc, s, next); while (tag->bindings) { BINDING *b = tag->bindings; if (endNamespaceDeclHandler) endNamespaceDeclHandler(handlerArg, b->prefix->name); tag->bindings = tag->bindings->nextTagBinding; b->nextTagBinding = freeBindingList; freeBindingList = b; b->prefix->binding = b->prevPrefixBinding; } if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); } break; case XML_TOK_CHAR_REF: { int n = XmlCharRefNumber(enc, s); if (n < 0) return XML_ERROR_BAD_CHAR_REF; if (characterDataHandler) { XML_Char buf[XML_ENCODE_MAX]; characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); } else if (defaultHandler) reportDefault(parser, enc, s, next); } break; case XML_TOK_XML_DECL: return XML_ERROR_MISPLACED_XML_PI; case XML_TOK_DATA_NEWLINE: if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_CDATA_SECT_OPEN: { enum XML_Error result; if (startCdataSectionHandler) startCdataSectionHandler(handlerArg); #if 0 /* Suppose you doing a transformation on a document that involves changing only the character data. You set up a defaultHandler and a characterDataHandler. The defaultHandler simply copies characters through. The characterDataHandler does the transformation and writes the characters out escaping them as necessary. This case will fail to work if we leave out the following two lines (because & and < inside CDATA sections will be incorrectly escaped). However, now we have a start/endCdataSectionHandler, so it seems easier to let the user deal with this. */ else if (characterDataHandler) characterDataHandler(handlerArg, dataBuf, 0); #endif else if (defaultHandler) reportDefault(parser, enc, s, next); result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); if (result != XML_ERROR_NONE) return result; else if (!next) { processor = cdataSectionProcessor; return result; } } break; case XML_TOK_TRAILING_RSQB: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } if (characterDataHandler) { if (MUST_CONVERT(enc, s)) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); characterDataHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); } else characterDataHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, end); /* We are at the end of the final buffer, should we check for XML_SUSPENDED, XML_FINISHED? */ if (startTagLevel == 0) { *eventPP = end; return XML_ERROR_NO_ELEMENTS; } if (tagLevel != startTagLevel) { *eventPP = end; return XML_ERROR_ASYNC_ENTITY; } *nextPtr = end; return XML_ERROR_NONE; case XML_TOK_DATA_CHARS: { XML_CharacterDataHandler charDataHandler = characterDataHandler; if (charDataHandler) { if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; charDataHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; } } else charDataHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); } break; case XML_TOK_PI: if (!reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: if (!reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; default: if (defaultHandler) reportDefault(parser, enc, s, next); break; } *eventPP = s = next; switch (ps_parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: ; } } /* not reached */ } /* Precondition: all arguments must be non-NULL; Purpose: - normalize attributes - check attributes for well-formedness - generate namespace aware attribute names (URI, prefix) - build list of attributes for startElementHandler - default attributes - process namespace declarations (check and report them) - generate namespace aware element name (URI, prefix) */ static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr, TAG_NAME *tagNamePtr, BINDING **bindingsPtr) { DTD * const dtd = _dtd; /* save one level of indirection */ ELEMENT_TYPE *elementType; int nDefaultAtts; const XML_Char **appAtts; /* the attribute list for the application */ int attIndex = 0; int prefixLen; int i; int n; XML_Char *uri; int nPrefixes = 0; BINDING *binding; const XML_Char *localPart; /* lookup the element type name */ elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0); if (!elementType) { const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str); if (!name) return XML_ERROR_NO_MEMORY; elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); if (!elementType) return XML_ERROR_NO_MEMORY; if (ns && !setElementTypePrefix(parser, elementType)) return XML_ERROR_NO_MEMORY; } nDefaultAtts = elementType->nDefaultAtts; /* get the attributes from the tokenizer */ n = XmlGetAttributes(enc, attStr, attsSize, atts); if (n + nDefaultAtts > attsSize) { int oldAttsSize = attsSize; ATTRIBUTE *temp; #ifdef XML_ATTR_INFO XML_AttrInfo *temp2; #endif attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); if (temp == NULL) return XML_ERROR_NO_MEMORY; atts = temp; #ifdef XML_ATTR_INFO temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); if (temp2 == NULL) return XML_ERROR_NO_MEMORY; attInfo = temp2; #endif if (n > oldAttsSize) XmlGetAttributes(enc, attStr, n, atts); } appAtts = (const XML_Char **)atts; for (i = 0; i < n; i++) { ATTRIBUTE *currAtt = &atts[i]; #ifdef XML_ATTR_INFO XML_AttrInfo *currAttInfo = &attInfo[i]; #endif /* add the name and value to the attribute list */ ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name, currAtt->name + XmlNameLength(enc, currAtt->name)); if (!attId) return XML_ERROR_NO_MEMORY; #ifdef XML_ATTR_INFO currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name); currAttInfo->nameEnd = currAttInfo->nameStart + XmlNameLength(enc, currAtt->name); currAttInfo->valueStart = parseEndByteIndex - (parseEndPtr - currAtt->valuePtr); currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd); #endif /* Detect duplicate attributes by their QNames. This does not work when namespace processing is turned on and different prefixes for the same namespace are used. For this case we have a check further down. */ if ((attId->name)[-1]) { if (enc == encoding) eventPtr = atts[i].name; return XML_ERROR_DUPLICATE_ATTRIBUTE; } (attId->name)[-1] = 1; appAtts[attIndex++] = attId->name; if (!atts[i].normalized) { enum XML_Error result; XML_Bool isCdata = XML_TRUE; /* figure out whether declared as other than CDATA */ if (attId->maybeTokenized) { int j; for (j = 0; j < nDefaultAtts; j++) { if (attId == elementType->defaultAtts[j].id) { isCdata = elementType->defaultAtts[j].isCdata; break; } } } /* normalize the attribute value */ result = storeAttributeValue(parser, enc, isCdata, atts[i].valuePtr, atts[i].valueEnd, &tempPool); if (result) return result; appAtts[attIndex] = poolStart(&tempPool); poolFinish(&tempPool); } else { /* the value did not need normalizing */ appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd); if (appAtts[attIndex] == 0) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); } /* handle prefixed attribute names */ if (attId->prefix) { if (attId->xmlns) { /* deal with namespace declarations here */ enum XML_Error result = addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr); if (result) return result; --attIndex; } else { /* deal with other prefixed names later */ attIndex++; nPrefixes++; (attId->name)[-1] = 2; } } else attIndex++; } /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */ nSpecifiedAtts = attIndex; if (elementType->idAtt && (elementType->idAtt->name)[-1]) { for (i = 0; i < attIndex; i += 2) if (appAtts[i] == elementType->idAtt->name) { idAttIndex = i; break; } } else idAttIndex = -1; /* do attribute defaulting */ for (i = 0; i < nDefaultAtts; i++) { const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i; if (!(da->id->name)[-1] && da->value) { if (da->id->prefix) { if (da->id->xmlns) { enum XML_Error result = addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr); if (result) return result; } else { (da->id->name)[-1] = 2; nPrefixes++; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; } } else { (da->id->name)[-1] = 1; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; } } } appAtts[attIndex] = 0; /* expand prefixed attribute names, check for duplicates, and clear flags that say whether attributes were specified */ i = 0; if (nPrefixes) { int j; /* hash table index */ unsigned long version = nsAttsVersion; int nsAttsSize = (int)1 << nsAttsPower; /* size of hash table must be at least 2 * (# of prefixed attributes) */ if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ NS_ATT *temp; /* hash table size must also be a power of 2 and >= 8 */ while (nPrefixes >> nsAttsPower++); if (nsAttsPower < 3) nsAttsPower = 3; nsAttsSize = (int)1 << nsAttsPower; temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); if (!temp) return XML_ERROR_NO_MEMORY; nsAtts = temp; version = 0; /* force re-initialization of nsAtts hash table */ } /* using a version flag saves us from initializing nsAtts every time */ if (!version) { /* initialize version flags when version wraps around */ version = INIT_ATTS_VERSION; for (j = nsAttsSize; j != 0; ) nsAtts[--j].version = version; } nsAttsVersion = --version; /* expand prefixed names and check for duplicates */ for (; i < attIndex; i += 2) { const XML_Char *s = appAtts[i]; if (s[-1] == 2) { /* prefixed */ ATTRIBUTE_ID *id; const BINDING *b; unsigned long uriHash = hash_secret_salt; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; /* as we expand the name we also calculate its hash value */ for (j = 0; j < b->uriLen; j++) { const XML_Char c = b->uri[j]; if (!poolAppendChar(&tempPool, c)) return XML_ERROR_NO_MEMORY; uriHash = CHAR_HASH(uriHash, c); } while (*s++ != XML_T(ASCII_COLON)) ; do { /* copies null terminator */ const XML_Char c = *s; if (!poolAppendChar(&tempPool, *s)) return XML_ERROR_NO_MEMORY; uriHash = CHAR_HASH(uriHash, c); } while (*s++); { /* Check hash table for duplicate of expanded name (uriName). Derived from code in lookup(parser, HASH_TABLE *table, ...). */ unsigned char step = 0; unsigned long mask = nsAttsSize - 1; j = uriHash & mask; /* index into hash table */ while (nsAtts[j].version == version) { /* for speed we compare stored hash values first */ if (uriHash == nsAtts[j].hash) { const XML_Char *s1 = poolStart(&tempPool); const XML_Char *s2 = nsAtts[j].uriName; /* s1 is null terminated, but not s2 */ for (; *s1 == *s2 && *s1 != 0; s1++, s2++); if (*s1 == 0) return XML_ERROR_DUPLICATE_ATTRIBUTE; } if (!step) step = PROBE_STEP(uriHash, mask, nsAttsPower); j < step ? (j += nsAttsSize - step) : (j -= step); } } if (ns_triplets) { /* append namespace separator and prefix */ tempPool.ptr[-1] = namespaceSeparator; s = b->prefix->name; do { if (!poolAppendChar(&tempPool, *s)) return XML_ERROR_NO_MEMORY; } while (*s++); } /* store expanded name in attribute list */ s = poolStart(&tempPool); poolFinish(&tempPool); appAtts[i] = s; /* fill empty slot with new version, uriName and hash value */ nsAtts[j].version = version; nsAtts[j].hash = uriHash; nsAtts[j].uriName = s; if (!--nPrefixes) { i += 2; break; } } else /* not prefixed */ ((XML_Char *)s)[-1] = 0; /* clear flag */ } } /* clear flags for the remaining attributes */ for (; i < attIndex; i += 2) ((XML_Char *)(appAtts[i]))[-1] = 0; for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) binding->attId->name[-1] = 0; if (!ns) return XML_ERROR_NONE; /* expand the element type name */ if (elementType->prefix) { binding = elementType->prefix->binding; if (!binding) return XML_ERROR_UNBOUND_PREFIX; localPart = tagNamePtr->str; while (*localPart++ != XML_T(ASCII_COLON)) ; } else if (dtd->defaultPrefix.binding) { binding = dtd->defaultPrefix.binding; localPart = tagNamePtr->str; } else return XML_ERROR_NONE; prefixLen = 0; if (ns_triplets && binding->prefix->name) { for (; binding->prefix->name[prefixLen++];) ; /* prefixLen includes null terminator */ } tagNamePtr->localPart = localPart; tagNamePtr->uriLen = binding->uriLen; tagNamePtr->prefix = binding->prefix->name; tagNamePtr->prefixLen = prefixLen; for (i = 0; localPart[i++];) ; /* i includes null terminator */ n = i + binding->uriLen + prefixLen; if (n > binding->uriAlloc) { TAG *p; uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); if (!uri) return XML_ERROR_NO_MEMORY; binding->uriAlloc = n + EXPAND_SPARE; memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); for (p = tagStack; p; p = p->parent) if (p->name.str == binding->uri) p->name.str = uri; FREE(binding->uri); binding->uri = uri; } /* if namespaceSeparator != '\0' then uri includes it already */ uri = binding->uri + binding->uriLen; memcpy(uri, localPart, i * sizeof(XML_Char)); /* we always have a namespace separator between localPart and prefix */ if (prefixLen) { uri += i - 1; *uri = namespaceSeparator; /* replace null terminator */ memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); } tagNamePtr->str = binding->uri; return XML_ERROR_NONE; } /* addBinding() overwrites the value of prefix->binding without checking. Therefore one must keep track of the old value outside of addBinding(). */ static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr) { static const XML_Char xmlNamespace[] = { ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' }; static const int xmlLen = (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; static const XML_Char xmlnsNamespace[] = { ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0, ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s, ASCII_SLASH, '\0' }; static const int xmlnsLen = (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; XML_Bool mustBeXML = XML_FALSE; XML_Bool isXML = XML_TRUE; XML_Bool isXMLNS = XML_TRUE; BINDING *b; int len; /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ if (*uri == XML_T('\0') && prefix->name) return XML_ERROR_UNDECLARING_PREFIX; if (prefix->name && prefix->name[0] == XML_T(ASCII_x) && prefix->name[1] == XML_T(ASCII_m) && prefix->name[2] == XML_T(ASCII_l)) { /* Not allowed to bind xmlns */ if (prefix->name[3] == XML_T(ASCII_n) && prefix->name[4] == XML_T(ASCII_s) && prefix->name[5] == XML_T('\0')) return XML_ERROR_RESERVED_PREFIX_XMLNS; if (prefix->name[3] == XML_T('\0')) mustBeXML = XML_TRUE; } for (len = 0; uri[len]; len++) { if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) isXML = XML_FALSE; if (!mustBeXML && isXMLNS && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) isXMLNS = XML_FALSE; } isXML = isXML && len == xmlLen; isXMLNS = isXMLNS && len == xmlnsLen; if (mustBeXML != isXML) return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML : XML_ERROR_RESERVED_NAMESPACE_URI; if (isXMLNS) return XML_ERROR_RESERVED_NAMESPACE_URI; if (namespaceSeparator) len++; if (freeBindingList) { b = freeBindingList; if (len > b->uriAlloc) { XML_Char *temp = (XML_Char *)REALLOC(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE)); if (temp == NULL) return XML_ERROR_NO_MEMORY; b->uri = temp; b->uriAlloc = len + EXPAND_SPARE; } freeBindingList = b->nextTagBinding; } else { b = (BINDING *)MALLOC(sizeof(BINDING)); if (!b) return XML_ERROR_NO_MEMORY; b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); if (!b->uri) { FREE(b); return XML_ERROR_NO_MEMORY; } b->uriAlloc = len + EXPAND_SPARE; } b->uriLen = len; memcpy(b->uri, uri, len * sizeof(XML_Char)); if (namespaceSeparator) b->uri[len - 1] = namespaceSeparator; b->prefix = prefix; b->attId = attId; b->prevPrefixBinding = prefix->binding; /* NULL binding when default namespace undeclared */ if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix) prefix->binding = NULL; else prefix->binding = b; b->nextTagBinding = *bindingsPtr; *bindingsPtr = b; /* if attId == NULL then we are not starting a namespace scope */ if (attId && startNamespaceDeclHandler) startNamespaceDeclHandler(handlerArg, prefix->name, prefix->binding ? uri : 0); return XML_ERROR_NONE; } /* The idea here is to avoid using stack for each CDATA section when the whole file is parsed with one call. */ static enum XML_Error PTRCALL cdataSectionProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result != XML_ERROR_NONE) return result; if (start) { if (parentParser) { /* we are parsing an external entity */ processor = externalEntityContentProcessor; return externalEntityContentProcessor(parser, start, end, endPtr); } else { processor = contentProcessor; return contentProcessor(parser, start, end, endPtr); } } return result; } /* startPtr gets set to non-null if the section is closed, and to null if the section is not yet closed. */ static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore) { const char *s = *startPtr; const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; *eventPP = s; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; *startPtr = NULL; for (;;) { const char *next; int tok = XmlCdataSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_CDATA_SECT_CLOSE: if (endCdataSectionHandler) endCdataSectionHandler(handlerArg); #if 0 /* see comment under XML_TOK_CDATA_SECT_OPEN */ else if (characterDataHandler) characterDataHandler(handlerArg, dataBuf, 0); #endif else if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; *nextPtr = next; if (ps_parsing == XML_FINISHED) return XML_ERROR_ABORTED; else return XML_ERROR_NONE; case XML_TOK_DATA_NEWLINE: if (characterDataHandler) { XML_Char c = 0xA; characterDataHandler(handlerArg, &c, 1); } else if (defaultHandler) reportDefault(parser, enc, s, next); break; case XML_TOK_DATA_CHARS: { XML_CharacterDataHandler charDataHandler = characterDataHandler; if (charDataHandler) { if (MUST_CONVERT(enc, s)) { for (;;) { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = next; charDataHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); if (s == next) break; *eventPP = s; } } else charDataHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)next - (XML_Char *)s)); } else if (defaultHandler) reportDefault(parser, enc, s, next); } break; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL_CHAR: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_PARTIAL: case XML_TOK_NONE: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_CDATA_SECTION; default: *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; } *eventPP = s = next; switch (ps_parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: ; } } /* not reached */ } #ifdef XML_DTD /* The idea here is to avoid using stack for each IGNORE section when the whole file is parsed with one call. */ static enum XML_Error PTRCALL ignoreSectionProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr, (XML_Bool)!ps_finalBuffer); if (result != XML_ERROR_NONE) return result; if (start) { processor = prologProcessor; return prologProcessor(parser, start, end, endPtr); } return result; } /* startPtr gets set to non-null is the section is closed, and to null if the section is not yet closed. */ static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore) { const char *next; int tok; const char *s = *startPtr; const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; *eventPP = s; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } *eventPP = s; *startPtr = NULL; tok = XmlIgnoreSectionTok(enc, s, end, &next); *eventEndPP = next; switch (tok) { case XML_TOK_IGNORE_SECT: if (defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; *nextPtr = next; if (ps_parsing == XML_FINISHED) return XML_ERROR_ABORTED; else return XML_ERROR_NONE; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL_CHAR: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; case XML_TOK_PARTIAL: case XML_TOK_NONE: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ default: *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; } /* not reached */ } #endif /* XML_DTD */ static enum XML_Error initializeEncoding(XML_Parser parser) { const char *s; #ifdef XML_UNICODE char encodingBuf[128]; if (!protocolEncodingName) s = NULL; else { int i; for (i = 0; protocolEncodingName[i]; i++) { if (i == sizeof(encodingBuf) - 1 || (protocolEncodingName[i] & ~0x7f) != 0) { encodingBuf[0] = '\0'; break; } encodingBuf[i] = (char)protocolEncodingName[i]; } encodingBuf[i] = '\0'; s = encodingBuf; } #else s = protocolEncodingName; #endif if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) return XML_ERROR_NONE; return handleUnknownEncoding(parser, protocolEncodingName); } static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, const char *next) { const char *encodingName = NULL; const XML_Char *storedEncName = NULL; const ENCODING *newEncoding = NULL; const char *version = NULL; const char *versionend; const XML_Char *storedversion = NULL; int standalone = -1; if (!(ns ? XmlParseXmlDeclNS : XmlParseXmlDecl)(isGeneralTextEntity, encoding, s, next, &eventPtr, &version, &versionend, &encodingName, &newEncoding, &standalone)) { if (isGeneralTextEntity) return XML_ERROR_TEXT_DECL; else return XML_ERROR_XML_DECL; } if (!isGeneralTextEntity && standalone == 1) { _dtd->standalone = XML_TRUE; #ifdef XML_DTD if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif /* XML_DTD */ } if (xmlDeclHandler) { if (encodingName != NULL) { storedEncName = poolStoreString(&temp2Pool, encoding, encodingName, encodingName + XmlNameLength(encoding, encodingName)); if (!storedEncName) return XML_ERROR_NO_MEMORY; poolFinish(&temp2Pool); } if (version) { storedversion = poolStoreString(&temp2Pool, encoding, version, versionend - encoding->minBytesPerChar); if (!storedversion) return XML_ERROR_NO_MEMORY; } xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); } else if (defaultHandler) reportDefault(parser, encoding, s, next); if (protocolEncodingName == NULL) { if (newEncoding) { if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { eventPtr = encodingName; return XML_ERROR_INCORRECT_ENCODING; } encoding = newEncoding; } else if (encodingName) { enum XML_Error result; if (!storedEncName) { storedEncName = poolStoreString( &temp2Pool, encoding, encodingName, encodingName + XmlNameLength(encoding, encodingName)); if (!storedEncName) return XML_ERROR_NO_MEMORY; } result = handleUnknownEncoding(parser, storedEncName); poolClear(&temp2Pool); if (result == XML_ERROR_UNKNOWN_ENCODING) eventPtr = encodingName; return result; } } if (storedEncName || storedversion) poolClear(&temp2Pool); return XML_ERROR_NONE; } static enum XML_Error handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) { if (unknownEncodingHandler) { XML_Encoding info; int i; for (i = 0; i < 256; i++) info.map[i] = -1; info.convert = NULL; info.data = NULL; info.release = NULL; if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) { ENCODING *enc; unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); if (!unknownEncodingMem) { if (info.release) info.release(info.data); return XML_ERROR_NO_MEMORY; } enc = (ns ? XmlInitUnknownEncodingNS : XmlInitUnknownEncoding)(unknownEncodingMem, info.map, info.convert, info.data); if (enc) { unknownEncodingData = info.data; unknownEncodingRelease = info.release; encoding = enc; return XML_ERROR_NONE; } } if (info.release != NULL) info.release(info.data); } return XML_ERROR_UNKNOWN_ENCODING; } static enum XML_Error PTRCALL prologInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; processor = prologProcessor; return prologProcessor(parser, s, end, nextPtr); } #ifdef XML_DTD static enum XML_Error PTRCALL externalParEntInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; /* we know now that XML_Parse(Buffer) has been called, so we consider the external parameter entity read */ _dtd->paramEntityRead = XML_TRUE; if (prologState.inEntityValue) { processor = entityValueInitProcessor; return entityValueInitProcessor(parser, s, end, nextPtr); } else { processor = externalParEntProcessor; return externalParEntProcessor(parser, s, end, nextPtr); } } static enum XML_Error PTRCALL entityValueInitProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { int tok; const char *start = s; const char *next = start; eventPtr = start; for (;;) { tok = XmlPrologTok(encoding, start, end, &next); eventEndPtr = next; if (tok <= 0) { if (!ps_finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } switch (tok) { case XML_TOK_INVALID: return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; case XML_TOK_NONE: /* start == end */ default: break; } /* found end of entity value - can store it now */ return storeEntityValue(parser, encoding, s, end); } else if (tok == XML_TOK_XML_DECL) { enum XML_Error result; result = processXmlDecl(parser, 0, start, next); if (result != XML_ERROR_NONE) return result; switch (ps_parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: *nextPtr = next; } /* stop scanning for text declaration - we found one */ processor = entityValueProcessor; return entityValueProcessor(parser, next, end, nextPtr); } /* If we are at the end of the buffer, this would cause XmlPrologTok to return XML_TOK_NONE on the next call, which would then cause the function to exit with *nextPtr set to s - that is what we want for other tokens, but not for the BOM - we would rather like to skip it; then, when this routine is entered the next time, XmlPrologTok will return XML_TOK_INVALID, since the BOM is still in the buffer */ else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) { *nextPtr = next; return XML_ERROR_NONE; } start = next; eventPtr = start; } } static enum XML_Error PTRCALL externalParEntProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *next = s; int tok; tok = XmlPrologTok(encoding, s, end, &next); if (tok <= 0) { if (!ps_finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } switch (tok) { case XML_TOK_INVALID: return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; case XML_TOK_NONE: /* start == end */ default: break; } } /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. However, when parsing an external subset, doProlog will not accept a BOM as valid, and report a syntax error, so we have to skip the BOM */ else if (tok == XML_TOK_BOM) { s = next; tok = XmlPrologTok(encoding, s, end, &next); } processor = prologProcessor; return doProlog(parser, encoding, s, end, tok, next, nextPtr, (XML_Bool)!ps_finalBuffer); } static enum XML_Error PTRCALL entityValueProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *start = s; const char *next = s; const ENCODING *enc = encoding; int tok; for (;;) { tok = XmlPrologTok(enc, start, end, &next); if (tok <= 0) { if (!ps_finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } switch (tok) { case XML_TOK_INVALID: return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; case XML_TOK_NONE: /* start == end */ default: break; } /* found end of entity value - can store it now */ return storeEntityValue(parser, enc, s, end); } start = next; } } #endif /* XML_DTD */ static enum XML_Error PTRCALL prologProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *next = s; int tok = XmlPrologTok(encoding, s, end, &next); return doProlog(parser, encoding, s, end, tok, next, nextPtr, (XML_Bool)!ps_finalBuffer); } static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, int tok, const char *next, const char **nextPtr, XML_Bool haveMore) { #ifdef XML_DTD static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' }; #endif /* XML_DTD */ static const XML_Char atypeCDATA[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' }; static const XML_Char atypeIDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; static const XML_Char atypeIDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; static const XML_Char atypeENTITY[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; static const XML_Char atypeNMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' }; static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' }; static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; /* save one level of indirection */ DTD * const dtd = _dtd; const char **eventPP; const char **eventEndPP; enum XML_Content_Quant quant; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } for (;;) { int role; XML_Bool handleDefault = XML_TRUE; *eventPP = s; *eventEndPP = next; if (tok <= 0) { if (haveMore && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } switch (tok) { case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; case -XML_TOK_PROLOG_S: tok = -tok; break; case XML_TOK_NONE: #ifdef XML_DTD /* for internal PE NOT referenced between declarations */ if (enc != encoding && !openInternalEntities->betweenDecl) { *nextPtr = s; return XML_ERROR_NONE; } /* WFC: PE Between Declarations - must check that PE contains complete markup, not only for external PEs, but also for internal PEs if the reference occurs between declarations. */ if (isParamEntity || enc != encoding) { if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) == XML_ROLE_ERROR) return XML_ERROR_INCOMPLETE_PE; *nextPtr = s; return XML_ERROR_NONE; } #endif /* XML_DTD */ return XML_ERROR_NO_ELEMENTS; default: tok = -tok; next = end; break; } } role = XmlTokenRole(&prologState, tok, s, next, enc); switch (role) { case XML_ROLE_XML_DECL: { enum XML_Error result = processXmlDecl(parser, 0, s, next); if (result != XML_ERROR_NONE) return result; enc = encoding; handleDefault = XML_FALSE; } break; case XML_ROLE_DOCTYPE_NAME: if (startDoctypeDeclHandler) { doctypeName = poolStoreString(&tempPool, enc, s, next); if (!doctypeName) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); doctypePubid = NULL; handleDefault = XML_FALSE; } doctypeSysid = NULL; /* always initialize to NULL */ break; case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: if (startDoctypeDeclHandler) { startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, doctypePubid, 1); doctypeName = NULL; poolClear(&tempPool); handleDefault = XML_FALSE; } break; #ifdef XML_DTD case XML_ROLE_TEXT_DECL: { enum XML_Error result = processXmlDecl(parser, 1, s, next); if (result != XML_ERROR_NONE) return result; enc = encoding; handleDefault = XML_FALSE; } break; #endif /* XML_DTD */ case XML_ROLE_DOCTYPE_PUBLIC_ID: #ifdef XML_DTD useForeignDTD = XML_FALSE; declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; #endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) { XML_Char *pubId; if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; pubId = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!pubId) return XML_ERROR_NO_MEMORY; normalizePublicId(pubId); poolFinish(&tempPool); doctypePubid = pubId; handleDefault = XML_FALSE; goto alreadyChecked; } /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; alreadyChecked: if (dtd->keepProcessing && declEntity) { XML_Char *tem = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); declEntity->publicId = tem; poolFinish(&dtd->pool); if (entityDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_DOCTYPE_CLOSE: if (doctypeName) { startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, doctypePubid, 0); poolClear(&tempPool); handleDefault = XML_FALSE; } /* doctypeSysid will be non-NULL in the case of a previous XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler was not set, indicating an external subset */ #ifdef XML_DTD if (doctypeSysid || useForeignDTD) { XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; dtd->hasParamEntityRefs = XML_TRUE; if (paramEntityParsing && externalEntityRefHandler) { ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); if (!entity) return XML_ERROR_NO_MEMORY; if (useForeignDTD) entity->base = curBase; dtd->paramEntityRead = XML_FALSE; if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; if (dtd->paramEntityRead) { if (!dtd->standalone && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; } /* if we didn't read the foreign DTD then this means that there is no external subset and we must reset dtd->hasParamEntityRefs */ else if (!doctypeSysid) dtd->hasParamEntityRefs = hadParamEntityRefs; /* end of DTD - no need to update dtd->keepProcessing */ } useForeignDTD = XML_FALSE; } #endif /* XML_DTD */ if (endDoctypeDeclHandler) { endDoctypeDeclHandler(handlerArg); handleDefault = XML_FALSE; } break; case XML_ROLE_INSTANCE_START: #ifdef XML_DTD /* if there is no DOCTYPE declaration then now is the last chance to read the foreign DTD */ if (useForeignDTD) { XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; dtd->hasParamEntityRefs = XML_TRUE; if (paramEntityParsing && externalEntityRefHandler) { ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); if (!entity) return XML_ERROR_NO_MEMORY; entity->base = curBase; dtd->paramEntityRead = XML_FALSE; if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; if (dtd->paramEntityRead) { if (!dtd->standalone && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; } /* if we didn't read the foreign DTD then this means that there is no external subset and we must reset dtd->hasParamEntityRefs */ else dtd->hasParamEntityRefs = hadParamEntityRefs; /* end of DTD - no need to update dtd->keepProcessing */ } } #endif /* XML_DTD */ processor = contentProcessor; return contentProcessor(parser, s, end, nextPtr); case XML_ROLE_ATTLIST_ELEMENT_NAME: declElementType = getElementType(parser, enc, s, next); if (!declElementType) return XML_ERROR_NO_MEMORY; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_NAME: declAttributeId = getAttributeId(parser, enc, s, next); if (!declAttributeId) return XML_ERROR_NO_MEMORY; declAttributeIsCdata = XML_FALSE; declAttributeType = NULL; declAttributeIsId = XML_FALSE; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_CDATA: declAttributeIsCdata = XML_TRUE; declAttributeType = atypeCDATA; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ID: declAttributeIsId = XML_TRUE; declAttributeType = atypeID; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_IDREF: declAttributeType = atypeIDREF; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: declAttributeType = atypeIDREFS; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: declAttributeType = atypeENTITY; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: declAttributeType = atypeENTITIES; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: declAttributeType = atypeNMTOKEN; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: declAttributeType = atypeNMTOKENS; checkAttListDeclHandler: if (dtd->keepProcessing && attlistDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ATTRIBUTE_ENUM_VALUE: case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: if (dtd->keepProcessing && attlistDeclHandler) { const XML_Char *prefix; if (declAttributeType) { prefix = enumValueSep; } else { prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE ? notationPrefix : enumValueStart); } if (!poolAppendString(&tempPool, prefix)) return XML_ERROR_NO_MEMORY; if (!poolAppend(&tempPool, enc, s, next)) return XML_ERROR_NO_MEMORY; declAttributeType = tempPool.start; handleDefault = XML_FALSE; } break; case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: if (dtd->keepProcessing) { if (!defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, declAttributeIsId, 0, parser)) return XML_ERROR_NO_MEMORY; if (attlistDeclHandler && declAttributeType) { if (*declAttributeType == XML_T(ASCII_LPAREN) || (*declAttributeType == XML_T(ASCII_N) && declAttributeType[1] == XML_T(ASCII_O))) { /* Enumerated or Notation type */ if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) || !poolAppendChar(&tempPool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; declAttributeType = tempPool.start; poolFinish(&tempPool); } *eventEndPP = s; attlistDeclHandler(handlerArg, declElementType->name, declAttributeId->name, declAttributeType, 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); poolClear(&tempPool); handleDefault = XML_FALSE; } } break; case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: case XML_ROLE_FIXED_ATTRIBUTE_VALUE: if (dtd->keepProcessing) { const XML_Char *attVal; enum XML_Error result = storeAttributeValue(parser, enc, declAttributeIsCdata, s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd->pool); if (result) return result; attVal = poolStart(&dtd->pool); poolFinish(&dtd->pool); /* ID attributes aren't allowed to have a default */ if (!defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, XML_FALSE, attVal, parser)) return XML_ERROR_NO_MEMORY; if (attlistDeclHandler && declAttributeType) { if (*declAttributeType == XML_T(ASCII_LPAREN) || (*declAttributeType == XML_T(ASCII_N) && declAttributeType[1] == XML_T(ASCII_O))) { /* Enumerated or Notation type */ if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) || !poolAppendChar(&tempPool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; declAttributeType = tempPool.start; poolFinish(&tempPool); } *eventEndPP = s; attlistDeclHandler(handlerArg, declElementType->name, declAttributeId->name, declAttributeType, attVal, role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); poolClear(&tempPool); handleDefault = XML_FALSE; } } break; case XML_ROLE_ENTITY_VALUE: if (dtd->keepProcessing) { enum XML_Error result = storeEntityValue(parser, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (declEntity) { declEntity->textPtr = poolStart(&dtd->entityValuePool); declEntity->textLen = (int)(poolLength(&dtd->entityValuePool)); poolFinish(&dtd->entityValuePool); if (entityDeclHandler) { *eventEndPP = s; entityDeclHandler(handlerArg, declEntity->name, declEntity->is_param, declEntity->textPtr, declEntity->textLen, curBase, 0, 0, 0); handleDefault = XML_FALSE; } } else poolDiscard(&dtd->entityValuePool); if (result != XML_ERROR_NONE) return result; } break; case XML_ROLE_DOCTYPE_SYSTEM_ID: #ifdef XML_DTD useForeignDTD = XML_FALSE; #endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; if (startDoctypeDeclHandler) { doctypeSysid = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (doctypeSysid == NULL) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); handleDefault = XML_FALSE; } #ifdef XML_DTD else /* use externalSubsetName to make doctypeSysid non-NULL for the case where no startDoctypeDeclHandler is set */ doctypeSysid = externalSubsetName; #endif /* XML_DTD */ if (!dtd->standalone #ifdef XML_DTD && !paramEntityParsing #endif /* XML_DTD */ && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; #ifndef XML_DTD break; #else /* XML_DTD */ if (!declEntity) { declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; declEntity->publicId = NULL; } /* fall through */ #endif /* XML_DTD */ case XML_ROLE_ENTITY_SYSTEM_ID: if (dtd->keepProcessing && declEntity) { declEntity->systemId = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!declEntity->systemId) return XML_ERROR_NO_MEMORY; declEntity->base = curBase; poolFinish(&dtd->pool); if (entityDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_ENTITY_COMPLETE: if (dtd->keepProcessing && declEntity && entityDeclHandler) { *eventEndPP = s; entityDeclHandler(handlerArg, declEntity->name, declEntity->is_param, 0,0, declEntity->base, declEntity->systemId, declEntity->publicId, 0); handleDefault = XML_FALSE; } break; case XML_ROLE_ENTITY_NOTATION_NAME: if (dtd->keepProcessing && declEntity) { declEntity->notation = poolStoreString(&dtd->pool, enc, s, next); if (!declEntity->notation) return XML_ERROR_NO_MEMORY; poolFinish(&dtd->pool); if (unparsedEntityDeclHandler) { *eventEndPP = s; unparsedEntityDeclHandler(handlerArg, declEntity->name, declEntity->base, declEntity->systemId, declEntity->publicId, declEntity->notation); handleDefault = XML_FALSE; } else if (entityDeclHandler) { *eventEndPP = s; entityDeclHandler(handlerArg, declEntity->name, 0,0,0, declEntity->base, declEntity->systemId, declEntity->publicId, declEntity->notation); handleDefault = XML_FALSE; } } break; case XML_ROLE_GENERAL_ENTITY_NAME: { if (XmlPredefinedEntityName(enc, s, next)) { declEntity = NULL; break; } if (dtd->keepProcessing) { const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); if (!name) return XML_ERROR_NO_MEMORY; declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; if (declEntity->name != name) { poolDiscard(&dtd->pool); declEntity = NULL; } else { poolFinish(&dtd->pool); declEntity->publicId = NULL; declEntity->is_param = XML_FALSE; /* if we have a parent parser or are reading an internal parameter entity, then the entity declaration is not considered "internal" */ declEntity->is_internal = !(parentParser || openInternalEntities); if (entityDeclHandler) handleDefault = XML_FALSE; } } else { poolDiscard(&dtd->pool); declEntity = NULL; } } break; case XML_ROLE_PARAM_ENTITY_NAME: #ifdef XML_DTD if (dtd->keepProcessing) { const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); if (!name) return XML_ERROR_NO_MEMORY; declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, sizeof(ENTITY)); if (!declEntity) return XML_ERROR_NO_MEMORY; if (declEntity->name != name) { poolDiscard(&dtd->pool); declEntity = NULL; } else { poolFinish(&dtd->pool); declEntity->publicId = NULL; declEntity->is_param = XML_TRUE; /* if we have a parent parser or are reading an internal parameter entity, then the entity declaration is not considered "internal" */ declEntity->is_internal = !(parentParser || openInternalEntities); if (entityDeclHandler) handleDefault = XML_FALSE; } } else { poolDiscard(&dtd->pool); declEntity = NULL; } #else /* not XML_DTD */ declEntity = NULL; #endif /* XML_DTD */ break; case XML_ROLE_NOTATION_NAME: declNotationPublicId = NULL; declNotationName = NULL; if (notationDeclHandler) { declNotationName = poolStoreString(&tempPool, enc, s, next); if (!declNotationName) return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); handleDefault = XML_FALSE; } break; case XML_ROLE_NOTATION_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; if (declNotationName) { /* means notationDeclHandler != NULL */ XML_Char *tem = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); declNotationPublicId = tem; poolFinish(&tempPool); handleDefault = XML_FALSE; } break; case XML_ROLE_NOTATION_SYSTEM_ID: if (declNotationName && notationDeclHandler) { const XML_Char *systemId = poolStoreString(&tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!systemId) return XML_ERROR_NO_MEMORY; *eventEndPP = s; notationDeclHandler(handlerArg, declNotationName, curBase, systemId, declNotationPublicId); handleDefault = XML_FALSE; } poolClear(&tempPool); break; case XML_ROLE_NOTATION_NO_SYSTEM_ID: if (declNotationPublicId && notationDeclHandler) { *eventEndPP = s; notationDeclHandler(handlerArg, declNotationName, curBase, 0, declNotationPublicId); handleDefault = XML_FALSE; } poolClear(&tempPool); break; case XML_ROLE_ERROR: switch (tok) { case XML_TOK_PARAM_ENTITY_REF: /* PE references in internal subset are not allowed within declarations. */ return XML_ERROR_PARAM_ENTITY_REF; case XML_TOK_XML_DECL: return XML_ERROR_MISPLACED_XML_PI; default: return XML_ERROR_SYNTAX; } #ifdef XML_DTD case XML_ROLE_IGNORE_SECT: { enum XML_Error result; if (defaultHandler) reportDefault(parser, enc, s, next); handleDefault = XML_FALSE; result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); if (result != XML_ERROR_NONE) return result; else if (!next) { processor = ignoreSectionProcessor; return result; } } break; #endif /* XML_DTD */ case XML_ROLE_GROUP_OPEN: if (prologState.level >= groupSize) { if (groupSize) { char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); if (temp == NULL) return XML_ERROR_NO_MEMORY; groupConnector = temp; if (dtd->scaffIndex) { int *temp = (int *)REALLOC(dtd->scaffIndex, groupSize * sizeof(int)); if (temp == NULL) return XML_ERROR_NO_MEMORY; dtd->scaffIndex = temp; } } else { groupConnector = (char *)MALLOC(groupSize = 32); if (!groupConnector) return XML_ERROR_NO_MEMORY; } } groupConnector[prologState.level] = 0; if (dtd->in_eldecl) { int myindex = nextScaffoldPart(parser); if (myindex < 0) return XML_ERROR_NO_MEMORY; dtd->scaffIndex[dtd->scaffLevel] = myindex; dtd->scaffLevel++; dtd->scaffold[myindex].type = XML_CTYPE_SEQ; if (elementDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_GROUP_SEQUENCE: if (groupConnector[prologState.level] == ASCII_PIPE) return XML_ERROR_SYNTAX; groupConnector[prologState.level] = ASCII_COMMA; if (dtd->in_eldecl && elementDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_GROUP_CHOICE: if (groupConnector[prologState.level] == ASCII_COMMA) return XML_ERROR_SYNTAX; if (dtd->in_eldecl && !groupConnector[prologState.level] && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type != XML_CTYPE_MIXED) ) { dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type = XML_CTYPE_CHOICE; if (elementDeclHandler) handleDefault = XML_FALSE; } groupConnector[prologState.level] = ASCII_PIPE; break; case XML_ROLE_PARAM_ENTITY_REF: #ifdef XML_DTD case XML_ROLE_INNER_PARAM_ENTITY_REF: dtd->hasParamEntityRefs = XML_TRUE; if (!paramEntityParsing) dtd->keepProcessing = dtd->standalone; else { const XML_Char *name; ENTITY *entity; name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); poolDiscard(&dtd->pool); /* first, determine if a check for an existing declaration is needed; if yes, check that the entity exists, and that it is internal, otherwise call the skipped entity handler */ if (prologState.documentEntity && (dtd->standalone ? !openInternalEntities : !dtd->hasParamEntityRefs)) { if (!entity) return XML_ERROR_UNDEFINED_ENTITY; else if (!entity->is_internal) return XML_ERROR_ENTITY_DECLARED_IN_PE; } else if (!entity) { dtd->keepProcessing = dtd->standalone; /* cannot report skipped entities in declarations */ if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { skippedEntityHandler(handlerArg, name, 1); handleDefault = XML_FALSE; } break; } if (entity->open) return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->textPtr) { enum XML_Error result; XML_Bool betweenDecl = (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); result = processInternalEntity(parser, entity, betweenDecl); if (result != XML_ERROR_NONE) return result; handleDefault = XML_FALSE; break; } if (externalEntityRefHandler) { dtd->paramEntityRead = XML_FALSE; entity->open = XML_TRUE; if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) { entity->open = XML_FALSE; return XML_ERROR_EXTERNAL_ENTITY_HANDLING; } entity->open = XML_FALSE; handleDefault = XML_FALSE; if (!dtd->paramEntityRead) { dtd->keepProcessing = dtd->standalone; break; } } else { dtd->keepProcessing = dtd->standalone; break; } } #endif /* XML_DTD */ if (!dtd->standalone && notStandaloneHandler && !notStandaloneHandler(handlerArg)) return XML_ERROR_NOT_STANDALONE; break; /* Element declaration stuff */ case XML_ROLE_ELEMENT_NAME: if (elementDeclHandler) { declElementType = getElementType(parser, enc, s, next); if (!declElementType) return XML_ERROR_NO_MEMORY; dtd->scaffLevel = 0; dtd->scaffCount = 0; dtd->in_eldecl = XML_TRUE; handleDefault = XML_FALSE; } break; case XML_ROLE_CONTENT_ANY: case XML_ROLE_CONTENT_EMPTY: if (dtd->in_eldecl) { if (elementDeclHandler) { XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); if (!content) return XML_ERROR_NO_MEMORY; content->quant = XML_CQUANT_NONE; content->name = NULL; content->numchildren = 0; content->children = NULL; content->type = ((role == XML_ROLE_CONTENT_ANY) ? XML_CTYPE_ANY : XML_CTYPE_EMPTY); *eventEndPP = s; elementDeclHandler(handlerArg, declElementType->name, content); handleDefault = XML_FALSE; } dtd->in_eldecl = XML_FALSE; } break; case XML_ROLE_CONTENT_PCDATA: if (dtd->in_eldecl) { dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type = XML_CTYPE_MIXED; if (elementDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_CONTENT_ELEMENT: quant = XML_CQUANT_NONE; goto elementContent; case XML_ROLE_CONTENT_ELEMENT_OPT: quant = XML_CQUANT_OPT; goto elementContent; case XML_ROLE_CONTENT_ELEMENT_REP: quant = XML_CQUANT_REP; goto elementContent; case XML_ROLE_CONTENT_ELEMENT_PLUS: quant = XML_CQUANT_PLUS; elementContent: if (dtd->in_eldecl) { ELEMENT_TYPE *el; const XML_Char *name; int nameLen; const char *nxt = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar); int myindex = nextScaffoldPart(parser); if (myindex < 0) return XML_ERROR_NO_MEMORY; dtd->scaffold[myindex].type = XML_CTYPE_NAME; dtd->scaffold[myindex].quant = quant; el = getElementType(parser, enc, s, nxt); if (!el) return XML_ERROR_NO_MEMORY; name = el->name; dtd->scaffold[myindex].name = name; nameLen = 0; for (; name[nameLen++]; ); dtd->contentStringLen += nameLen; if (elementDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_GROUP_CLOSE: quant = XML_CQUANT_NONE; goto closeGroup; case XML_ROLE_GROUP_CLOSE_OPT: quant = XML_CQUANT_OPT; goto closeGroup; case XML_ROLE_GROUP_CLOSE_REP: quant = XML_CQUANT_REP; goto closeGroup; case XML_ROLE_GROUP_CLOSE_PLUS: quant = XML_CQUANT_PLUS; closeGroup: if (dtd->in_eldecl) { if (elementDeclHandler) handleDefault = XML_FALSE; dtd->scaffLevel--; dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant; if (dtd->scaffLevel == 0) { if (!handleDefault) { XML_Content *model = build_model(parser); if (!model) return XML_ERROR_NO_MEMORY; *eventEndPP = s; elementDeclHandler(handlerArg, declElementType->name, model); } dtd->in_eldecl = XML_FALSE; dtd->contentStringLen = 0; } } break; /* End element declaration stuff */ case XML_ROLE_PI: if (!reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; handleDefault = XML_FALSE; break; case XML_ROLE_COMMENT: if (!reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; handleDefault = XML_FALSE; break; case XML_ROLE_NONE: switch (tok) { case XML_TOK_BOM: handleDefault = XML_FALSE; break; } break; case XML_ROLE_DOCTYPE_NONE: if (startDoctypeDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ENTITY_NONE: if (dtd->keepProcessing && entityDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_NOTATION_NONE: if (notationDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ATTLIST_NONE: if (dtd->keepProcessing && attlistDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ELEMENT_NONE: if (elementDeclHandler) handleDefault = XML_FALSE; break; } /* end of big switch */ if (handleDefault && defaultHandler) reportDefault(parser, enc, s, next); switch (ps_parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: s = next; tok = XmlPrologTok(enc, s, end, &next); } } /* not reached */ } static enum XML_Error PTRCALL epilogProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { processor = epilogProcessor; eventPtr = s; for (;;) { const char *next = NULL; int tok = XmlPrologTok(encoding, s, end, &next); eventEndPtr = next; switch (tok) { /* report partial linebreak - it might be the last token */ case -XML_TOK_PROLOG_S: if (defaultHandler) { reportDefault(parser, encoding, s, next); if (ps_parsing == XML_FINISHED) return XML_ERROR_ABORTED; } *nextPtr = next; return XML_ERROR_NONE; case XML_TOK_NONE: *nextPtr = s; return XML_ERROR_NONE; case XML_TOK_PROLOG_S: if (defaultHandler) reportDefault(parser, encoding, s, next); break; case XML_TOK_PI: if (!reportProcessingInstruction(parser, encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: if (!reportComment(parser, encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_INVALID: eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (!ps_finalBuffer) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (!ps_finalBuffer) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; default: return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; } eventPtr = s = next; switch (ps_parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; default: ; } } } static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl) { const char *textStart, *textEnd; const char *next; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity; if (freeInternalEntities) { openEntity = freeInternalEntities; freeInternalEntities = openEntity->next; } else { openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); if (!openEntity) return XML_ERROR_NO_MEMORY; } entity->open = XML_TRUE; entity->processed = 0; openEntity->next = openInternalEntities; openInternalEntities = openEntity; openEntity->entity = entity; openEntity->startTagLevel = tagLevel; openEntity->betweenDecl = betweenDecl; openEntity->internalEventPtr = NULL; openEntity->internalEventEndPtr = NULL; textStart = (char *)entity->textPtr; textEnd = (char *)(entity->textPtr + entity->textLen); #ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); result = doProlog(parser, internalEncoding, textStart, textEnd, tok, next, &next, XML_FALSE); } else #endif /* XML_DTD */ result = doContent(parser, tagLevel, internalEncoding, textStart, textEnd, &next, XML_FALSE); if (result == XML_ERROR_NONE) { if (textEnd != next && ps_parsing == XML_SUSPENDED) { entity->processed = (int)(next - textStart); processor = internalEntityProcessor; } else { entity->open = XML_FALSE; openInternalEntities = openEntity->next; /* put openEntity back in list of free instances */ openEntity->next = freeInternalEntities; freeInternalEntities = openEntity; } } return result; } static enum XML_Error PTRCALL internalEntityProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { ENTITY *entity; const char *textStart, *textEnd; const char *next; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; if (!openEntity) return XML_ERROR_UNEXPECTED_STATE; entity = openEntity->entity; textStart = ((char *)entity->textPtr) + entity->processed; textEnd = (char *)(entity->textPtr + entity->textLen); #ifdef XML_DTD if (entity->is_param) { int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); result = doProlog(parser, internalEncoding, textStart, textEnd, tok, next, &next, XML_FALSE); } else #endif /* XML_DTD */ result = doContent(parser, openEntity->startTagLevel, internalEncoding, textStart, textEnd, &next, XML_FALSE); if (result != XML_ERROR_NONE) return result; else if (textEnd != next && ps_parsing == XML_SUSPENDED) { entity->processed = (int)(next - (char *)entity->textPtr); return result; } else { entity->open = XML_FALSE; openInternalEntities = openEntity->next; /* put openEntity back in list of free instances */ openEntity->next = freeInternalEntities; freeInternalEntities = openEntity; } #ifdef XML_DTD if (entity->is_param) { int tok; processor = prologProcessor; tok = XmlPrologTok(encoding, s, end, &next); return doProlog(parser, encoding, s, end, tok, next, nextPtr, (XML_Bool)!ps_finalBuffer); } else #endif /* XML_DTD */ { processor = contentProcessor; /* see externalEntityContentProcessor vs contentProcessor */ return doContent(parser, parentParser ? 1 : 0, encoding, s, end, nextPtr, (XML_Bool)!ps_finalBuffer); } } static enum XML_Error PTRCALL errorProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { return errorCode; } static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, const char *ptr, const char *end, STRING_POOL *pool) { enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool); if (result) return result; if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) poolChop(pool); if (!poolAppendChar(pool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; return XML_ERROR_NONE; } static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, const char *ptr, const char *end, STRING_POOL *pool) { DTD * const dtd = _dtd; /* save one level of indirection */ for (;;) { const char *next; int tok = XmlAttributeValueTok(enc, ptr, end, &next); switch (tok) { case XML_TOK_NONE: return XML_ERROR_NONE; case XML_TOK_INVALID: if (enc == encoding) eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: if (enc == encoding) eventPtr = ptr; return XML_ERROR_INVALID_TOKEN; case XML_TOK_CHAR_REF: { XML_Char buf[XML_ENCODE_MAX]; int i; int n = XmlCharRefNumber(enc, ptr); if (n < 0) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BAD_CHAR_REF; } if (!isCdata && n == 0x20 /* space */ && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; n = XmlEncode(n, (ICHAR *)buf); if (!n) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BAD_CHAR_REF; } for (i = 0; i < n; i++) { if (!poolAppendChar(pool, buf[i])) return XML_ERROR_NO_MEMORY; } } break; case XML_TOK_DATA_CHARS: if (!poolAppend(pool, enc, ptr, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_TRAILING_CR: next = ptr + enc->minBytesPerChar; /* fall through */ case XML_TOK_ATTRIBUTE_VALUE_S: case XML_TOK_DATA_NEWLINE: if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; if (!poolAppendChar(pool, 0x20)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_ENTITY_REF: { const XML_Char *name; ENTITY *entity; char checkEntityDecl; XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (ch) { if (!poolAppendChar(pool, ch)) return XML_ERROR_NO_MEMORY; break; } name = poolStoreString(&temp2Pool, enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); poolDiscard(&temp2Pool); /* First, determine if a check for an existing declaration is needed; if yes, check that the entity exists, and that it is internal. */ if (pool == &dtd->pool) /* are we called from prolog? */ checkEntityDecl = #ifdef XML_DTD prologState.documentEntity && #endif /* XML_DTD */ (dtd->standalone ? !openInternalEntities : !dtd->hasParamEntityRefs); else /* if (pool == &tempPool): we are called from content */ checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone; if (checkEntityDecl) { if (!entity) return XML_ERROR_UNDEFINED_ENTITY; else if (!entity->is_internal) return XML_ERROR_ENTITY_DECLARED_IN_PE; } else if (!entity) { /* Cannot report skipped entity here - see comments on skippedEntityHandler. if (skippedEntityHandler) skippedEntityHandler(handlerArg, name, 0); */ /* Cannot call the default handler because this would be out of sync with the call to the startElementHandler. if ((pool == &tempPool) && defaultHandler) reportDefault(parser, enc, ptr, next); */ break; } if (entity->open) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_RECURSIVE_ENTITY_REF; } if (entity->notation) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_BINARY_ENTITY_REF; } if (!entity->textPtr) { if (enc == encoding) eventPtr = ptr; return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; } else { enum XML_Error result; const XML_Char *textEnd = entity->textPtr + entity->textLen; entity->open = XML_TRUE; result = appendAttributeValue(parser, internalEncoding, isCdata, (char *)entity->textPtr, (char *)textEnd, pool); entity->open = XML_FALSE; if (result) return result; } } break; default: if (enc == encoding) eventPtr = ptr; return XML_ERROR_UNEXPECTED_STATE; } ptr = next; } /* not reached */ } static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *entityTextPtr, const char *entityTextEnd) { DTD * const dtd = _dtd; /* save one level of indirection */ STRING_POOL *pool = &(dtd->entityValuePool); enum XML_Error result = XML_ERROR_NONE; #ifdef XML_DTD int oldInEntityValue = prologState.inEntityValue; prologState.inEntityValue = 1; #endif /* XML_DTD */ /* never return Null for the value argument in EntityDeclHandler, since this would indicate an external entity; therefore we have to make sure that entityValuePool.start is not null */ if (!pool->blocks) { if (!poolGrow(pool)) return XML_ERROR_NO_MEMORY; } for (;;) { const char *next; int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); switch (tok) { case XML_TOK_PARAM_ENTITY_REF: #ifdef XML_DTD if (isParamEntity || enc != encoding) { const XML_Char *name; ENTITY *entity; name = poolStoreString(&tempPool, enc, entityTextPtr + enc->minBytesPerChar, next - enc->minBytesPerChar); if (!name) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); poolDiscard(&tempPool); if (!entity) { /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ /* cannot report skipped entity here - see comments on skippedEntityHandler if (skippedEntityHandler) skippedEntityHandler(handlerArg, name, 0); */ dtd->keepProcessing = dtd->standalone; goto endEntityValue; } if (entity->open) { if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_RECURSIVE_ENTITY_REF; goto endEntityValue; } if (entity->systemId) { if (externalEntityRefHandler) { dtd->paramEntityRead = XML_FALSE; entity->open = XML_TRUE; if (!externalEntityRefHandler(externalEntityRefHandlerArg, 0, entity->base, entity->systemId, entity->publicId)) { entity->open = XML_FALSE; result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; goto endEntityValue; } entity->open = XML_FALSE; if (!dtd->paramEntityRead) dtd->keepProcessing = dtd->standalone; } else dtd->keepProcessing = dtd->standalone; } else { entity->open = XML_TRUE; result = storeEntityValue(parser, internalEncoding, (char *)entity->textPtr, (char *)(entity->textPtr + entity->textLen)); entity->open = XML_FALSE; if (result) goto endEntityValue; } break; } #endif /* XML_DTD */ /* In the internal subset, PE references are not legal within markup declarations, e.g entity values in this case. */ eventPtr = entityTextPtr; result = XML_ERROR_PARAM_ENTITY_REF; goto endEntityValue; case XML_TOK_NONE: result = XML_ERROR_NONE; goto endEntityValue; case XML_TOK_ENTITY_REF: case XML_TOK_DATA_CHARS: if (!poolAppend(pool, enc, entityTextPtr, next)) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } break; case XML_TOK_TRAILING_CR: next = entityTextPtr + enc->minBytesPerChar; /* fall through */ case XML_TOK_DATA_NEWLINE: if (pool->end == pool->ptr && !poolGrow(pool)) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } *(pool->ptr)++ = 0xA; break; case XML_TOK_CHAR_REF: { XML_Char buf[XML_ENCODE_MAX]; int i; int n = XmlCharRefNumber(enc, entityTextPtr); if (n < 0) { if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_BAD_CHAR_REF; goto endEntityValue; } n = XmlEncode(n, (ICHAR *)buf); if (!n) { if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_BAD_CHAR_REF; goto endEntityValue; } for (i = 0; i < n; i++) { if (pool->end == pool->ptr && !poolGrow(pool)) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } *(pool->ptr)++ = buf[i]; } } break; case XML_TOK_PARTIAL: if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_INVALID_TOKEN; goto endEntityValue; case XML_TOK_INVALID: if (enc == encoding) eventPtr = next; result = XML_ERROR_INVALID_TOKEN; goto endEntityValue; default: if (enc == encoding) eventPtr = entityTextPtr; result = XML_ERROR_UNEXPECTED_STATE; goto endEntityValue; } entityTextPtr = next; } endEntityValue: #ifdef XML_DTD prologState.inEntityValue = oldInEntityValue; #endif /* XML_DTD */ return result; } static void FASTCALL normalizeLines(XML_Char *s) { XML_Char *p; for (;; s++) { if (*s == XML_T('\0')) return; if (*s == 0xD) break; } p = s; do { if (*s == 0xD) { *p++ = 0xA; if (*++s == 0xA) s++; } else *p++ = *s++; } while (*s); *p = XML_T('\0'); } static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { const XML_Char *target; XML_Char *data; const char *tem; if (!processingInstructionHandler) { if (defaultHandler) reportDefault(parser, enc, start, end); return 1; } start += enc->minBytesPerChar * 2; tem = start + XmlNameLength(enc, start); target = poolStoreString(&tempPool, enc, start, tem); if (!target) return 0; poolFinish(&tempPool); data = poolStoreString(&tempPool, enc, XmlSkipS(enc, tem), end - enc->minBytesPerChar*2); if (!data) return 0; normalizeLines(data); processingInstructionHandler(handlerArg, target, data); poolClear(&tempPool); return 1; } static int reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { XML_Char *data; if (!commentHandler) { if (defaultHandler) reportDefault(parser, enc, start, end); return 1; } data = poolStoreString(&tempPool, enc, start + enc->minBytesPerChar * 4, end - enc->minBytesPerChar * 3); if (!data) return 0; normalizeLines(data); commentHandler(handlerArg, data); poolClear(&tempPool); return 1; } static void reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) { if (MUST_CONVERT(enc, s)) { const char **eventPP; const char **eventEndPP; if (enc == encoding) { eventPP = &eventPtr; eventEndPP = &eventEndPtr; } else { eventPP = &(openInternalEntities->internalEventPtr); eventEndPP = &(openInternalEntities->internalEventEndPtr); } do { ICHAR *dataPtr = (ICHAR *)dataBuf; XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); *eventEndPP = s; defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); *eventPP = s; } while (s != end); } else defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); } static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, XML_Bool isId, const XML_Char *value, XML_Parser parser) { DEFAULT_ATTRIBUTE *att; if (value || isId) { /* The handling of default attributes gets messed up if we have a default which duplicates a non-default. */ int i; for (i = 0; i < type->nDefaultAtts; i++) if (attId == type->defaultAtts[i].id) return 1; if (isId && !type->idAtt && !attId->xmlns) type->idAtt = attId; } if (type->nDefaultAtts == type->allocDefaultAtts) { if (type->allocDefaultAtts == 0) { type->allocDefaultAtts = 8; type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); if (!type->defaultAtts) return 0; } else { DEFAULT_ATTRIBUTE *temp; int count = type->allocDefaultAtts * 2; temp = (DEFAULT_ATTRIBUTE *) REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); if (temp == NULL) return 0; type->allocDefaultAtts = count; type->defaultAtts = temp; } } att = type->defaultAtts + type->nDefaultAtts; att->id = attId; att->value = value; att->isCdata = isCdata; if (!isCdata) attId->maybeTokenized = XML_TRUE; type->nDefaultAtts += 1; return 1; } static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) { DTD * const dtd = _dtd; /* save one level of indirection */ const XML_Char *name; for (name = elementType->name; *name; name++) { if (*name == XML_T(ASCII_COLON)) { PREFIX *prefix; const XML_Char *s; for (s = elementType->name; s != name; s++) { if (!poolAppendChar(&dtd->pool, *s)) return 0; } if (!poolAppendChar(&dtd->pool, XML_T('\0'))) return 0; prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); if (!prefix) return 0; if (prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else poolDiscard(&dtd->pool); elementType->prefix = prefix; } } return 1; } static ATTRIBUTE_ID * getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { DTD * const dtd = _dtd; /* save one level of indirection */ ATTRIBUTE_ID *id; const XML_Char *name; if (!poolAppendChar(&dtd->pool, XML_T('\0'))) return NULL; name = poolStoreString(&dtd->pool, enc, start, end); if (!name) return NULL; /* skip quotation mark - its storage will be re-used (like in name[-1]) */ ++name; id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID)); if (!id) return NULL; if (id->name != name) poolDiscard(&dtd->pool); else { poolFinish(&dtd->pool); if (!ns) ; else if (name[0] == XML_T(ASCII_x) && name[1] == XML_T(ASCII_m) && name[2] == XML_T(ASCII_l) && name[3] == XML_T(ASCII_n) && name[4] == XML_T(ASCII_s) && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { if (name[5] == XML_T('\0')) id->prefix = &dtd->defaultPrefix; else id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX)); id->xmlns = XML_TRUE; } else { int i; for (i = 0; name[i]; i++) { /* attributes without prefix are *not* in the default namespace */ if (name[i] == XML_T(ASCII_COLON)) { int j; for (j = 0; j < i; j++) { if (!poolAppendChar(&dtd->pool, name[j])) return NULL; } if (!poolAppendChar(&dtd->pool, XML_T('\0'))) return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else poolDiscard(&dtd->pool); break; } } } } return id; } #define CONTEXT_SEP XML_T(ASCII_FF) static const XML_Char * getContext(XML_Parser parser) { DTD * const dtd = _dtd; /* save one level of indirection */ HASH_TABLE_ITER iter; XML_Bool needSep = XML_FALSE; if (dtd->defaultPrefix.binding) { int i; int len; if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) return NULL; len = dtd->defaultPrefix.binding->uriLen; if (namespaceSeparator) len--; for (i = 0; i < len; i++) if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) return NULL; needSep = XML_TRUE; } hashTableIterInit(&iter, &(dtd->prefixes)); for (;;) { int i; int len; const XML_Char *s; PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); if (!prefix) break; if (!prefix->binding) continue; if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) return NULL; for (s = prefix->name; *s; s++) if (!poolAppendChar(&tempPool, *s)) return NULL; if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) return NULL; len = prefix->binding->uriLen; if (namespaceSeparator) len--; for (i = 0; i < len; i++) if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) return NULL; needSep = XML_TRUE; } hashTableIterInit(&iter, &(dtd->generalEntities)); for (;;) { const XML_Char *s; ENTITY *e = (ENTITY *)hashTableIterNext(&iter); if (!e) break; if (!e->open) continue; if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) return NULL; for (s = e->name; *s; s++) if (!poolAppendChar(&tempPool, *s)) return 0; needSep = XML_TRUE; } if (!poolAppendChar(&tempPool, XML_T('\0'))) return NULL; return tempPool.start; } static XML_Bool setContext(XML_Parser parser, const XML_Char *context) { DTD * const dtd = _dtd; /* save one level of indirection */ const XML_Char *s = context; while (*context != XML_T('\0')) { if (*s == CONTEXT_SEP || *s == XML_T('\0')) { ENTITY *e; if (!poolAppendChar(&tempPool, XML_T('\0'))) return XML_FALSE; e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0); if (e) e->open = XML_TRUE; if (*s != XML_T('\0')) s++; context = s; poolDiscard(&tempPool); } else if (*s == XML_T(ASCII_EQUALS)) { PREFIX *prefix; if (poolLength(&tempPool) == 0) prefix = &dtd->defaultPrefix; else { if (!poolAppendChar(&tempPool, XML_T('\0'))) return XML_FALSE; prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool), sizeof(PREFIX)); if (!prefix) return XML_FALSE; if (prefix->name == poolStart(&tempPool)) { prefix->name = poolCopyString(&dtd->pool, prefix->name); if (!prefix->name) return XML_FALSE; } poolDiscard(&tempPool); } for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++) if (!poolAppendChar(&tempPool, *context)) return XML_FALSE; if (!poolAppendChar(&tempPool, XML_T('\0'))) return XML_FALSE; if (addBinding(parser, prefix, NULL, poolStart(&tempPool), &inheritedBindings) != XML_ERROR_NONE) return XML_FALSE; poolDiscard(&tempPool); if (*context != XML_T('\0')) ++context; s = context; } else { if (!poolAppendChar(&tempPool, *s)) return XML_FALSE; s++; } } return XML_TRUE; } static void FASTCALL normalizePublicId(XML_Char *publicId) { XML_Char *p = publicId; XML_Char *s; for (s = publicId; *s; s++) { switch (*s) { case 0x20: case 0xD: case 0xA: if (p != publicId && p[-1] != 0x20) *p++ = 0x20; break; default: *p++ = *s; } } if (p != publicId && p[-1] == 0x20) --p; *p = XML_T('\0'); } static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms) { DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD)); if (p == NULL) return p; poolInit(&(p->pool), ms); poolInit(&(p->entityValuePool), ms); hashTableInit(&(p->generalEntities), ms); hashTableInit(&(p->elementTypes), ms); hashTableInit(&(p->attributeIds), ms); hashTableInit(&(p->prefixes), ms); #ifdef XML_DTD p->paramEntityRead = XML_FALSE; hashTableInit(&(p->paramEntities), ms); #endif /* XML_DTD */ p->defaultPrefix.name = NULL; p->defaultPrefix.binding = NULL; p->in_eldecl = XML_FALSE; p->scaffIndex = NULL; p->scaffold = NULL; p->scaffLevel = 0; p->scaffSize = 0; p->scaffCount = 0; p->contentStringLen = 0; p->keepProcessing = XML_TRUE; p->hasParamEntityRefs = XML_FALSE; p->standalone = XML_FALSE; return p; } static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; hashTableIterInit(&iter, &(p->elementTypes)); for (;;) { ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); if (!e) break; if (e->allocDefaultAtts != 0) ms->free_fcn(e->defaultAtts); } hashTableClear(&(p->generalEntities)); #ifdef XML_DTD p->paramEntityRead = XML_FALSE; hashTableClear(&(p->paramEntities)); #endif /* XML_DTD */ hashTableClear(&(p->elementTypes)); hashTableClear(&(p->attributeIds)); hashTableClear(&(p->prefixes)); poolClear(&(p->pool)); poolClear(&(p->entityValuePool)); p->defaultPrefix.name = NULL; p->defaultPrefix.binding = NULL; p->in_eldecl = XML_FALSE; ms->free_fcn(p->scaffIndex); p->scaffIndex = NULL; ms->free_fcn(p->scaffold); p->scaffold = NULL; p->scaffLevel = 0; p->scaffSize = 0; p->scaffCount = 0; p->contentStringLen = 0; p->keepProcessing = XML_TRUE; p->hasParamEntityRefs = XML_FALSE; p->standalone = XML_FALSE; } static void dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; hashTableIterInit(&iter, &(p->elementTypes)); for (;;) { ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); if (!e) break; if (e->allocDefaultAtts != 0) ms->free_fcn(e->defaultAtts); } hashTableDestroy(&(p->generalEntities)); #ifdef XML_DTD hashTableDestroy(&(p->paramEntities)); #endif /* XML_DTD */ hashTableDestroy(&(p->elementTypes)); hashTableDestroy(&(p->attributeIds)); hashTableDestroy(&(p->prefixes)); poolDestroy(&(p->pool)); poolDestroy(&(p->entityValuePool)); if (isDocEntity) { ms->free_fcn(p->scaffIndex); ms->free_fcn(p->scaffold); } ms->free_fcn(p); } /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise. The new DTD has already been initialized. */ static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; /* Copy the prefix table. */ hashTableIterInit(&iter, &(oldDtd->prefixes)); for (;;) { const XML_Char *name; const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); if (!oldP) break; name = poolCopyString(&(newDtd->pool), oldP->name); if (!name) return 0; if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) return 0; } hashTableIterInit(&iter, &(oldDtd->attributeIds)); /* Copy the attribute id table. */ for (;;) { ATTRIBUTE_ID *newA; const XML_Char *name; const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); if (!oldA) break; /* Remember to allocate the scratch byte before the name. */ if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) return 0; name = poolCopyString(&(newDtd->pool), oldA->name); if (!name) return 0; ++name; newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID)); if (!newA) return 0; newA->maybeTokenized = oldA->maybeTokenized; if (oldA->prefix) { newA->xmlns = oldA->xmlns; if (oldA->prefix == &oldDtd->defaultPrefix) newA->prefix = &newDtd->defaultPrefix; else newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), oldA->prefix->name, 0); } } /* Copy the element type table. */ hashTableIterInit(&iter, &(oldDtd->elementTypes)); for (;;) { int i; ELEMENT_TYPE *newE; const XML_Char *name; const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); if (!oldE) break; name = poolCopyString(&(newDtd->pool), oldE->name); if (!name) return 0; newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE)); if (!newE) return 0; if (oldE->nDefaultAtts) { newE->defaultAtts = (DEFAULT_ATTRIBUTE *) ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); if (!newE->defaultAtts) { ms->free_fcn(newE); return 0; } } if (oldE->idAtt) newE->idAtt = (ATTRIBUTE_ID *) lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0); newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; if (oldE->prefix) newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), oldE->prefix->name, 0); for (i = 0; i < newE->nDefaultAtts; i++) { newE->defaultAtts[i].id = (ATTRIBUTE_ID *) lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; if (oldE->defaultAtts[i].value) { newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); if (!newE->defaultAtts[i].value) return 0; } else newE->defaultAtts[i].value = NULL; } } /* Copy the entity tables. */ if (!copyEntityTable(oldParser, &(newDtd->generalEntities), &(newDtd->pool), &(oldDtd->generalEntities))) return 0; #ifdef XML_DTD if (!copyEntityTable(oldParser, &(newDtd->paramEntities), &(newDtd->pool), &(oldDtd->paramEntities))) return 0; newDtd->paramEntityRead = oldDtd->paramEntityRead; #endif /* XML_DTD */ newDtd->keepProcessing = oldDtd->keepProcessing; newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; newDtd->standalone = oldDtd->standalone; /* Don't want deep copying for scaffolding */ newDtd->in_eldecl = oldDtd->in_eldecl; newDtd->scaffold = oldDtd->scaffold; newDtd->contentStringLen = oldDtd->contentStringLen; newDtd->scaffSize = oldDtd->scaffSize; newDtd->scaffLevel = oldDtd->scaffLevel; newDtd->scaffIndex = oldDtd->scaffIndex; return 1; } /* End dtdCopy */ static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable, STRING_POOL *newPool, const HASH_TABLE *oldTable) { HASH_TABLE_ITER iter; const XML_Char *cachedOldBase = NULL; const XML_Char *cachedNewBase = NULL; hashTableIterInit(&iter, oldTable); for (;;) { ENTITY *newE; const XML_Char *name; const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); if (!oldE) break; name = poolCopyString(newPool, oldE->name); if (!name) return 0; newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); if (!newE) return 0; if (oldE->systemId) { const XML_Char *tem = poolCopyString(newPool, oldE->systemId); if (!tem) return 0; newE->systemId = tem; if (oldE->base) { if (oldE->base == cachedOldBase) newE->base = cachedNewBase; else { cachedOldBase = oldE->base; tem = poolCopyString(newPool, cachedOldBase); if (!tem) return 0; cachedNewBase = newE->base = tem; } } if (oldE->publicId) { tem = poolCopyString(newPool, oldE->publicId); if (!tem) return 0; newE->publicId = tem; } } else { const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen); if (!tem) return 0; newE->textPtr = tem; newE->textLen = oldE->textLen; } if (oldE->notation) { const XML_Char *tem = poolCopyString(newPool, oldE->notation); if (!tem) return 0; newE->notation = tem; } newE->is_param = oldE->is_param; newE->is_internal = oldE->is_internal; } return 1; } #define INIT_POWER 6 static XML_Bool FASTCALL keyeq(KEY s1, KEY s2) { for (; *s1 == *s2; s1++, s2++) if (*s1 == 0) return XML_TRUE; return XML_FALSE; } static unsigned long FASTCALL hash(XML_Parser parser, KEY s) { unsigned long h = hash_secret_salt; while (*s) h = CHAR_HASH(h, *s++); return h; } static NAMED * lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) { size_t i; if (table->size == 0) { size_t tsize; if (!createSize) return NULL; table->power = INIT_POWER; /* table->size is a power of 2 */ table->size = (size_t)1 << INIT_POWER; tsize = table->size * sizeof(NAMED *); table->v = (NAMED **)table->mem->malloc_fcn(tsize); if (!table->v) { table->size = 0; return NULL; } memset(table->v, 0, tsize); i = hash(parser, name) & ((unsigned long)table->size - 1); } else { unsigned long h = hash(parser, name); unsigned long mask = (unsigned long)table->size - 1; unsigned char step = 0; i = h & mask; while (table->v[i]) { if (keyeq(name, table->v[i]->name)) return table->v[i]; if (!step) step = PROBE_STEP(h, mask, table->power); i < step ? (i += table->size - step) : (i -= step); } if (!createSize) return NULL; /* check for overflow (table is half full) */ if (table->used >> (table->power - 1)) { unsigned char newPower = table->power + 1; size_t newSize = (size_t)1 << newPower; unsigned long newMask = (unsigned long)newSize - 1; size_t tsize = newSize * sizeof(NAMED *); NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize); if (!newV) return NULL; memset(newV, 0, tsize); for (i = 0; i < table->size; i++) if (table->v[i]) { unsigned long newHash = hash(parser, table->v[i]->name); size_t j = newHash & newMask; step = 0; while (newV[j]) { if (!step) step = PROBE_STEP(newHash, newMask, newPower); j < step ? (j += newSize - step) : (j -= step); } newV[j] = table->v[i]; } table->mem->free_fcn(table->v); table->v = newV; table->power = newPower; table->size = newSize; i = h & newMask; step = 0; while (table->v[i]) { if (!step) step = PROBE_STEP(h, newMask, newPower); i < step ? (i += newSize - step) : (i -= step); } } } table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize); if (!table->v[i]) return NULL; memset(table->v[i], 0, createSize); table->v[i]->name = name; (table->used)++; return table->v[i]; } static void FASTCALL hashTableClear(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) { table->mem->free_fcn(table->v[i]); table->v[i] = NULL; } table->used = 0; } static void FASTCALL hashTableDestroy(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) table->mem->free_fcn(table->v[i]); table->mem->free_fcn(table->v); } static void FASTCALL hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) { p->power = 0; p->size = 0; p->used = 0; p->v = NULL; p->mem = ms; } static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) { iter->p = table->v; iter->end = iter->p + table->size; } static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *iter) { while (iter->p != iter->end) { NAMED *tem = *(iter->p)++; if (tem) return tem; } return NULL; } static void FASTCALL poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) { pool->blocks = NULL; pool->freeBlocks = NULL; pool->start = NULL; pool->ptr = NULL; pool->end = NULL; pool->mem = ms; } static void FASTCALL poolClear(STRING_POOL *pool) { if (!pool->freeBlocks) pool->freeBlocks = pool->blocks; else { BLOCK *p = pool->blocks; while (p) { BLOCK *tem = p->next; p->next = pool->freeBlocks; pool->freeBlocks = p; p = tem; } } pool->blocks = NULL; pool->start = NULL; pool->ptr = NULL; pool->end = NULL; } static void FASTCALL poolDestroy(STRING_POOL *pool) { BLOCK *p = pool->blocks; while (p) { BLOCK *tem = p->next; pool->mem->free_fcn(p); p = tem; } p = pool->freeBlocks; while (p) { BLOCK *tem = p->next; pool->mem->free_fcn(p); p = tem; } } static XML_Char * poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end) { if (!pool->ptr && !poolGrow(pool)) return NULL; for (;;) { XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); if (ptr == end) break; if (!poolGrow(pool)) return NULL; } return pool->start; } static const XML_Char * FASTCALL poolCopyString(STRING_POOL *pool, const XML_Char *s) { do { if (!poolAppendChar(pool, *s)) return NULL; } while (*s++); s = pool->start; poolFinish(pool); return s; } static const XML_Char * poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { if (!pool->ptr && !poolGrow(pool)) return NULL; for (; n > 0; --n, s++) { if (!poolAppendChar(pool, *s)) return NULL; } s = pool->start; poolFinish(pool); return s; } static const XML_Char * FASTCALL poolAppendString(STRING_POOL *pool, const XML_Char *s) { while (*s) { if (!poolAppendChar(pool, *s)) return NULL; s++; } return pool->start; } static XML_Char * poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, const char *end) { if (!poolAppend(pool, enc, ptr, end)) return NULL; if (pool->ptr == pool->end && !poolGrow(pool)) return NULL; *(pool->ptr)++ = 0; return pool->start; } static XML_Bool FASTCALL poolGrow(STRING_POOL *pool) { if (pool->freeBlocks) { if (pool->start == 0) { pool->blocks = pool->freeBlocks; pool->freeBlocks = pool->freeBlocks->next; pool->blocks->next = NULL; pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; pool->ptr = pool->start; return XML_TRUE; } if (pool->end - pool->start < pool->freeBlocks->size) { BLOCK *tem = pool->freeBlocks->next; pool->freeBlocks->next = pool->blocks; pool->blocks = pool->freeBlocks; pool->freeBlocks = tem; memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char)); pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + pool->blocks->size; return XML_TRUE; } } if (pool->blocks && pool->start == pool->blocks->s) { int blockSize = (int)(pool->end - pool->start)*2; BLOCK *temp = (BLOCK *) pool->mem->realloc_fcn(pool->blocks, (offsetof(BLOCK, s) + blockSize * sizeof(XML_Char))); if (temp == NULL) return XML_FALSE; pool->blocks = temp; pool->blocks->size = blockSize; pool->ptr = pool->blocks->s + (pool->ptr - pool->start); pool->start = pool->blocks->s; pool->end = pool->start + blockSize; } else { BLOCK *tem; int blockSize = (int)(pool->end - pool->start); if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; else blockSize *= 2; tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); if (!tem) return XML_FALSE; tem->size = blockSize; tem->next = pool->blocks; pool->blocks = tem; if (pool->ptr != pool->start) memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); pool->ptr = tem->s + (pool->ptr - pool->start); pool->start = tem->s; pool->end = tem->s + blockSize; } return XML_TRUE; } static int FASTCALL nextScaffoldPart(XML_Parser parser) { DTD * const dtd = _dtd; /* save one level of indirection */ CONTENT_SCAFFOLD * me; int next; if (!dtd->scaffIndex) { dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); if (!dtd->scaffIndex) return -1; dtd->scaffIndex[0] = 0; } if (dtd->scaffCount >= dtd->scaffSize) { CONTENT_SCAFFOLD *temp; if (dtd->scaffold) { temp = (CONTENT_SCAFFOLD *) REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); if (temp == NULL) return -1; dtd->scaffSize *= 2; } else { temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS * sizeof(CONTENT_SCAFFOLD)); if (temp == NULL) return -1; dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS; } dtd->scaffold = temp; } next = dtd->scaffCount++; me = &dtd->scaffold[next]; if (dtd->scaffLevel) { CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]]; if (parent->lastchild) { dtd->scaffold[parent->lastchild].nextsib = next; } if (!parent->childcnt) parent->firstchild = next; parent->lastchild = next; parent->childcnt++; } me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; return next; } static void build_node(XML_Parser parser, int src_node, XML_Content *dest, XML_Content **contpos, XML_Char **strpos) { DTD * const dtd = _dtd; /* save one level of indirection */ dest->type = dtd->scaffold[src_node].type; dest->quant = dtd->scaffold[src_node].quant; if (dest->type == XML_CTYPE_NAME) { const XML_Char *src; dest->name = *strpos; src = dtd->scaffold[src_node].name; for (;;) { *(*strpos)++ = *src; if (!*src) break; src++; } dest->numchildren = 0; dest->children = NULL; } else { unsigned int i; int cn; dest->numchildren = dtd->scaffold[src_node].childcnt; dest->children = *contpos; *contpos += dest->numchildren; for (i = 0, cn = dtd->scaffold[src_node].firstchild; i < dest->numchildren; i++, cn = dtd->scaffold[cn].nextsib) { build_node(parser, cn, &(dest->children[i]), contpos, strpos); } dest->name = NULL; } } static XML_Content * build_model (XML_Parser parser) { DTD * const dtd = _dtd; /* save one level of indirection */ XML_Content *ret; XML_Content *cpos; XML_Char * str; int allocsize = (dtd->scaffCount * sizeof(XML_Content) + (dtd->contentStringLen * sizeof(XML_Char))); ret = (XML_Content *)MALLOC(allocsize); if (!ret) return NULL; str = (XML_Char *) (&ret[dtd->scaffCount]); cpos = &ret[1]; build_node(parser, 0, ret, &cpos, &str); return ret; } static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end) { DTD * const dtd = _dtd; /* save one level of indirection */ const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end); ELEMENT_TYPE *ret; if (!name) return NULL; ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); if (!ret) return NULL; if (ret->name != name) poolDiscard(&dtd->pool); else { poolFinish(&dtd->pool); if (!setElementTypePrefix(parser, ret)) return NULL; } return ret; } astropy-0.3/cextern/expat/lib/xmlrole.h0000755000175000017500000000571712243255342016406 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef XmlRole_INCLUDED #define XmlRole_INCLUDED 1 #ifdef __VMS /* 0 1 2 3 0 1 2 3 1234567890123456789012345678901 1234567890123456789012345678901 */ #define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt #endif #include "xmltok.h" #ifdef __cplusplus extern "C" { #endif enum { XML_ROLE_ERROR = -1, XML_ROLE_NONE = 0, XML_ROLE_XML_DECL, XML_ROLE_INSTANCE_START, XML_ROLE_DOCTYPE_NONE, XML_ROLE_DOCTYPE_NAME, XML_ROLE_DOCTYPE_SYSTEM_ID, XML_ROLE_DOCTYPE_PUBLIC_ID, XML_ROLE_DOCTYPE_INTERNAL_SUBSET, XML_ROLE_DOCTYPE_CLOSE, XML_ROLE_GENERAL_ENTITY_NAME, XML_ROLE_PARAM_ENTITY_NAME, XML_ROLE_ENTITY_NONE, XML_ROLE_ENTITY_VALUE, XML_ROLE_ENTITY_SYSTEM_ID, XML_ROLE_ENTITY_PUBLIC_ID, XML_ROLE_ENTITY_COMPLETE, XML_ROLE_ENTITY_NOTATION_NAME, XML_ROLE_NOTATION_NONE, XML_ROLE_NOTATION_NAME, XML_ROLE_NOTATION_SYSTEM_ID, XML_ROLE_NOTATION_NO_SYSTEM_ID, XML_ROLE_NOTATION_PUBLIC_ID, XML_ROLE_ATTRIBUTE_NAME, XML_ROLE_ATTRIBUTE_TYPE_CDATA, XML_ROLE_ATTRIBUTE_TYPE_ID, XML_ROLE_ATTRIBUTE_TYPE_IDREF, XML_ROLE_ATTRIBUTE_TYPE_IDREFS, XML_ROLE_ATTRIBUTE_TYPE_ENTITY, XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, XML_ROLE_ATTRIBUTE_ENUM_VALUE, XML_ROLE_ATTRIBUTE_NOTATION_VALUE, XML_ROLE_ATTLIST_NONE, XML_ROLE_ATTLIST_ELEMENT_NAME, XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, XML_ROLE_FIXED_ATTRIBUTE_VALUE, XML_ROLE_ELEMENT_NONE, XML_ROLE_ELEMENT_NAME, XML_ROLE_CONTENT_ANY, XML_ROLE_CONTENT_EMPTY, XML_ROLE_CONTENT_PCDATA, XML_ROLE_GROUP_OPEN, XML_ROLE_GROUP_CLOSE, XML_ROLE_GROUP_CLOSE_REP, XML_ROLE_GROUP_CLOSE_OPT, XML_ROLE_GROUP_CLOSE_PLUS, XML_ROLE_GROUP_CHOICE, XML_ROLE_GROUP_SEQUENCE, XML_ROLE_CONTENT_ELEMENT, XML_ROLE_CONTENT_ELEMENT_REP, XML_ROLE_CONTENT_ELEMENT_OPT, XML_ROLE_CONTENT_ELEMENT_PLUS, XML_ROLE_PI, XML_ROLE_COMMENT, #ifdef XML_DTD XML_ROLE_TEXT_DECL, XML_ROLE_IGNORE_SECT, XML_ROLE_INNER_PARAM_ENTITY_REF, #endif /* XML_DTD */ XML_ROLE_PARAM_ENTITY_REF }; typedef struct prolog_state { int (PTRCALL *handler) (struct prolog_state *state, int tok, const char *ptr, const char *end, const ENCODING *enc); unsigned level; int role_none; #ifdef XML_DTD unsigned includeLevel; int documentEntity; int inEntityValue; #endif /* XML_DTD */ } PROLOG_STATE; void XmlPrologStateInit(PROLOG_STATE *); #ifdef XML_DTD void XmlPrologStateInitExternalEntity(PROLOG_STATE *); #endif /* XML_DTD */ #define XmlTokenRole(state, tok, ptr, end, enc) \ (((state)->handler)(state, tok, ptr, end, enc)) #ifdef __cplusplus } #endif #endif /* not XmlRole_INCLUDED */ astropy-0.3/cextern/expat/lib/ascii.h0000755000175000017500000000370112243255342016003 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #define ASCII_A 0x41 #define ASCII_B 0x42 #define ASCII_C 0x43 #define ASCII_D 0x44 #define ASCII_E 0x45 #define ASCII_F 0x46 #define ASCII_G 0x47 #define ASCII_H 0x48 #define ASCII_I 0x49 #define ASCII_J 0x4A #define ASCII_K 0x4B #define ASCII_L 0x4C #define ASCII_M 0x4D #define ASCII_N 0x4E #define ASCII_O 0x4F #define ASCII_P 0x50 #define ASCII_Q 0x51 #define ASCII_R 0x52 #define ASCII_S 0x53 #define ASCII_T 0x54 #define ASCII_U 0x55 #define ASCII_V 0x56 #define ASCII_W 0x57 #define ASCII_X 0x58 #define ASCII_Y 0x59 #define ASCII_Z 0x5A #define ASCII_a 0x61 #define ASCII_b 0x62 #define ASCII_c 0x63 #define ASCII_d 0x64 #define ASCII_e 0x65 #define ASCII_f 0x66 #define ASCII_g 0x67 #define ASCII_h 0x68 #define ASCII_i 0x69 #define ASCII_j 0x6A #define ASCII_k 0x6B #define ASCII_l 0x6C #define ASCII_m 0x6D #define ASCII_n 0x6E #define ASCII_o 0x6F #define ASCII_p 0x70 #define ASCII_q 0x71 #define ASCII_r 0x72 #define ASCII_s 0x73 #define ASCII_t 0x74 #define ASCII_u 0x75 #define ASCII_v 0x76 #define ASCII_w 0x77 #define ASCII_x 0x78 #define ASCII_y 0x79 #define ASCII_z 0x7A #define ASCII_0 0x30 #define ASCII_1 0x31 #define ASCII_2 0x32 #define ASCII_3 0x33 #define ASCII_4 0x34 #define ASCII_5 0x35 #define ASCII_6 0x36 #define ASCII_7 0x37 #define ASCII_8 0x38 #define ASCII_9 0x39 #define ASCII_TAB 0x09 #define ASCII_SPACE 0x20 #define ASCII_EXCL 0x21 #define ASCII_QUOT 0x22 #define ASCII_AMP 0x26 #define ASCII_APOS 0x27 #define ASCII_MINUS 0x2D #define ASCII_PERIOD 0x2E #define ASCII_COLON 0x3A #define ASCII_SEMI 0x3B #define ASCII_LT 0x3C #define ASCII_EQUALS 0x3D #define ASCII_GT 0x3E #define ASCII_LSQB 0x5B #define ASCII_RSQB 0x5D #define ASCII_UNDERSCORE 0x5F #define ASCII_LPAREN 0x28 #define ASCII_RPAREN 0x29 #define ASCII_FF 0x0C #define ASCII_SLASH 0x2F #define ASCII_HASH 0x23 #define ASCII_PIPE 0x7C #define ASCII_COMMA 0x2C astropy-0.3/cextern/expat/lib/expatw.dsp0000755000175000017500000001155312243255342016566 0ustar oleole# Microsoft Developer Studio Project File - Name="expatw" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=expatw - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "expatw.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "expatw.mak" CFG="expatw - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "expatw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "expatw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "expatw - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release-w" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 # ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpatw.dll" !ELSEIF "$(CFG)" == "expatw - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug-w" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpatw.dll" !ENDIF # Begin Target # Name "expatw - Win32 Release" # Name "expatw - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\libexpatw.def # End Source File # Begin Source File SOURCE=.\xmlparse.c !IF "$(CFG)" == "expatw - Win32 Release" !ELSEIF "$(CFG)" == "expatw - Win32 Debug" # ADD CPP /GX- /Od !ENDIF # End Source File # Begin Source File SOURCE=.\xmlrole.c # End Source File # Begin Source File SOURCE=.\xmltok.c # End Source File # Begin Source File SOURCE=.\xmltok_impl.c # End Source File # Begin Source File SOURCE=.\xmltok_ns.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\ascii.h # End Source File # Begin Source File SOURCE=.\asciitab.h # End Source File # Begin Source File SOURCE=.\expat.h # End Source File # Begin Source File SOURCE=.\expat_external.h # End Source File # Begin Source File SOURCE=.\iasciitab.h # End Source File # Begin Source File SOURCE=.\internal.h # End Source File # Begin Source File SOURCE=.\latin1tab.h # End Source File # Begin Source File SOURCE=.\nametab.h # End Source File # Begin Source File SOURCE=.\utf8tab.h # End Source File # Begin Source File SOURCE=.\xmlrole.h # End Source File # Begin Source File SOURCE=.\xmltok.h # End Source File # Begin Source File SOURCE=.\xmltok_impl.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project astropy-0.3/cextern/expat/lib/xmltok_ns.c0000755000175000017500000000611012243255342016721 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * NS(XmlGetUtf8InternalEncoding)(void) { return &ns(internal_utf8_encoding).enc; } const ENCODING * NS(XmlGetUtf16InternalEncoding)(void) { #if BYTEORDER == 1234 return &ns(internal_little2_encoding).enc; #elif BYTEORDER == 4321 return &ns(internal_big2_encoding).enc; #else const short n = 1; return (*(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc); #endif } static const ENCODING * const NS(encodings)[] = { &ns(latin1_encoding).enc, &ns(ascii_encoding).enc, &ns(utf8_encoding).enc, &ns(big2_encoding).enc, &ns(big2_encoding).enc, &ns(little2_encoding).enc, &ns(utf8_encoding).enc /* NO_ENC */ }; static int PTRCALL NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr); } static int PTRCALL NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr); } int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name) { int i = getEncodingIndex(name); if (i == UNKNOWN_ENC) return 0; SET_INIT_ENC_INDEX(p, i); p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); p->initEnc.updatePosition = initUpdatePosition; p->encPtr = encPtr; *encPtr = &(p->initEnc); return 1; } static const ENCODING * NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) { #define ENCODING_MAX 128 char buf[ENCODING_MAX]; char *p = buf; int i; XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); if (ptr != end) return 0; *p = 0; if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) return enc; i = getEncodingIndex(buf); if (i == UNKNOWN_ENC) return 0; return NS(encodings)[i]; } int NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingName, const ENCODING **encoding, int *standalone) { return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone); } #endif /* XML_TOK_NS_C */ astropy-0.3/cextern/expat/lib/internal.h0000755000175000017500000000375412243255342016537 0ustar oleole/* internal.h Internal definitions used by Expat. This is not needed to compile client code. The following calling convention macros are defined for frequently called functions: FASTCALL - Used for those internal functions that have a simple body and a low number of arguments and local variables. PTRCALL - Used for functions called though function pointers. PTRFASTCALL - Like PTRCALL, but for low number of arguments. inline - Used for selected internal functions for which inlining may improve performance on some platforms. Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. */ #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) /* We'll use this version by default only where we know it helps. regparm() generates warnings on Solaris boxes. See SF bug #692878. Instability reported with egcs on a RedHat Linux 7.3. Let's comment out: #define FASTCALL __attribute__((stdcall, regparm(3))) and let's try this: */ #define FASTCALL __attribute__((regparm(3))) #define PTRFASTCALL __attribute__((regparm(3))) #endif /* Using __fastcall seems to have an unexpected negative effect under MS VC++, especially for function pointers, so we won't use it for now on that platform. It may be reconsidered for a future release if it can be made more effective. Likely reason: __fastcall on Windows is like stdcall, therefore the compiler cannot perform stack optimizations for call clusters. */ /* Make sure all of these are defined if they aren't already. */ #ifndef FASTCALL #define FASTCALL #endif #ifndef PTRCALL #define PTRCALL #endif #ifndef PTRFASTCALL #define PTRFASTCALL #endif #ifndef XML_MIN_SIZE #if !defined(__cplusplus) && !defined(inline) #ifdef __GNUC__ #define inline __inline #endif /* __GNUC__ */ #endif #endif /* XML_MIN_SIZE */ #ifdef __cplusplus #define inline inline #else #ifndef inline #define inline #endif #endif astropy-0.3/cextern/expat/lib/utf8tab.h0000755000175000017500000000334312243255342016272 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, astropy-0.3/cextern/expat/lib/xmlrole.c0000755000175000017500000007733312243255342016404 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" #elif defined(__amigaos__) #include "amigaconfig.h" #elif defined(__WATCOMC__) #include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif #endif /* ndef COMPILED_FROM_DSP */ #include "expat_external.h" #include "internal.h" #include "xmlrole.h" #include "ascii.h" /* Doesn't check: that ,| are not mixed in a model group content of literals */ static const char KW_ANY[] = { ASCII_A, ASCII_N, ASCII_Y, '\0' }; static const char KW_ATTLIST[] = { ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; static const char KW_CDATA[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; static const char KW_DOCTYPE[] = { ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; static const char KW_ELEMENT[] = { ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; static const char KW_EMPTY[] = { ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; static const char KW_ENTITIES[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; static const char KW_ENTITY[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; static const char KW_FIXED[] = { ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; static const char KW_ID[] = { ASCII_I, ASCII_D, '\0' }; static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; #ifdef XML_DTD static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; #endif static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; #ifdef XML_DTD static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; #endif static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; static const char KW_NMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; static const char KW_NOTATION[] = { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, '\0' }; static const char KW_PCDATA[] = { ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; static const char KW_PUBLIC[] = { ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; static const char KW_REQUIRED[] = { ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, '\0' }; static const char KW_SYSTEM[] = { ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; #ifndef MIN_BYTES_PER_CHAR #define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) #endif #ifdef XML_DTD #define setTopLevel(state) \ ((state)->handler = ((state)->documentEntity \ ? internalSubset \ : externalSubset1)) #else /* not XML_DTD */ #define setTopLevel(state) ((state)->handler = internalSubset) #endif /* not XML_DTD */ typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc); static PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, internalSubset, entity0, entity1, entity2, entity3, entity4, entity5, entity6, entity7, entity8, entity9, entity10, notation0, notation1, notation2, notation3, notation4, attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, attlist7, attlist8, attlist9, element0, element1, element2, element3, element4, element5, element6, element7, #ifdef XML_DTD externalSubset0, externalSubset1, condSect0, condSect1, condSect2, #endif /* XML_DTD */ declClose, error; static int FASTCALL common(PROLOG_STATE *state, int tok); static int PTRCALL prolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: state->handler = prolog1; return XML_ROLE_NONE; case XML_TOK_XML_DECL: state->handler = prolog1; return XML_ROLE_XML_DECL; case XML_TOK_PI: state->handler = prolog1; return XML_ROLE_PI; case XML_TOK_COMMENT: state->handler = prolog1; return XML_ROLE_COMMENT; case XML_TOK_BOM: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_DOCTYPE)) break; state->handler = doctype0; return XML_ROLE_DOCTYPE_NONE; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int PTRCALL prolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_PI: return XML_ROLE_PI; case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_BOM: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_DOCTYPE)) break; state->handler = doctype0; return XML_ROLE_DOCTYPE_NONE; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int PTRCALL prolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_PI: return XML_ROLE_PI; case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_INSTANCE_START: state->handler = error; return XML_ROLE_INSTANCE_START; } return common(state, tok); } static int PTRCALL doctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = doctype1; return XML_ROLE_DOCTYPE_NAME; } return common(state, tok); } static int PTRCALL doctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = internalSubset; return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { state->handler = doctype3; return XML_ROLE_DOCTYPE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { state->handler = doctype2; return XML_ROLE_DOCTYPE_NONE; } break; } return common(state, tok); } static int PTRCALL doctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_LITERAL: state->handler = doctype3; return XML_ROLE_DOCTYPE_PUBLIC_ID; } return common(state, tok); } static int PTRCALL doctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_LITERAL: state->handler = doctype4; return XML_ROLE_DOCTYPE_SYSTEM_ID; } return common(state, tok); } static int PTRCALL doctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = internalSubset; return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; } return common(state, tok); } static int PTRCALL doctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; case XML_TOK_DECL_CLOSE: state->handler = prolog2; return XML_ROLE_DOCTYPE_CLOSE; } return common(state, tok); } static int PTRCALL internalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ENTITY)) { state->handler = entity0; return XML_ROLE_ENTITY_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ATTLIST)) { state->handler = attlist0; return XML_ROLE_ATTLIST_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ELEMENT)) { state->handler = element0; return XML_ROLE_ELEMENT_NONE; } if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_NOTATION)) { state->handler = notation0; return XML_ROLE_NOTATION_NONE; } break; case XML_TOK_PI: return XML_ROLE_PI; case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_PARAM_ENTITY_REF: return XML_ROLE_PARAM_ENTITY_REF; case XML_TOK_CLOSE_BRACKET: state->handler = doctype5; return XML_ROLE_DOCTYPE_NONE; case XML_TOK_NONE: return XML_ROLE_NONE; } return common(state, tok); } #ifdef XML_DTD static int PTRCALL externalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { state->handler = externalSubset1; if (tok == XML_TOK_XML_DECL) return XML_ROLE_TEXT_DECL; return externalSubset1(state, tok, ptr, end, enc); } static int PTRCALL externalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_COND_SECT_OPEN: state->handler = condSect0; return XML_ROLE_NONE; case XML_TOK_COND_SECT_CLOSE: if (state->includeLevel == 0) break; state->includeLevel -= 1; return XML_ROLE_NONE; case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_CLOSE_BRACKET: break; case XML_TOK_NONE: if (state->includeLevel) break; return XML_ROLE_NONE; default: return internalSubset(state, tok, ptr, end, enc); } return common(state, tok); } #endif /* XML_DTD */ static int PTRCALL entity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_PERCENT: state->handler = entity1; return XML_ROLE_ENTITY_NONE; case XML_TOK_NAME: state->handler = entity2; return XML_ROLE_GENERAL_ENTITY_NAME; } return common(state, tok); } static int PTRCALL entity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_NAME: state->handler = entity7; return XML_ROLE_PARAM_ENTITY_NAME; } return common(state, tok); } static int PTRCALL entity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { state->handler = entity4; return XML_ROLE_ENTITY_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { state->handler = entity3; return XML_ROLE_ENTITY_NONE; } break; case XML_TOK_LITERAL: state->handler = declClose; state->role_none = XML_ROLE_ENTITY_NONE; return XML_ROLE_ENTITY_VALUE; } return common(state, tok); } static int PTRCALL entity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_LITERAL: state->handler = entity4; return XML_ROLE_ENTITY_PUBLIC_ID; } return common(state, tok); } static int PTRCALL entity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_LITERAL: state->handler = entity5; return XML_ROLE_ENTITY_SYSTEM_ID; } return common(state, tok); } static int PTRCALL entity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_ENTITY_COMPLETE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { state->handler = entity6; return XML_ROLE_ENTITY_NONE; } break; } return common(state, tok); } static int PTRCALL entity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_NAME: state->handler = declClose; state->role_none = XML_ROLE_ENTITY_NONE; return XML_ROLE_ENTITY_NOTATION_NAME; } return common(state, tok); } static int PTRCALL entity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { state->handler = entity9; return XML_ROLE_ENTITY_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { state->handler = entity8; return XML_ROLE_ENTITY_NONE; } break; case XML_TOK_LITERAL: state->handler = declClose; state->role_none = XML_ROLE_ENTITY_NONE; return XML_ROLE_ENTITY_VALUE; } return common(state, tok); } static int PTRCALL entity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_LITERAL: state->handler = entity9; return XML_ROLE_ENTITY_PUBLIC_ID; } return common(state, tok); } static int PTRCALL entity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_LITERAL: state->handler = entity10; return XML_ROLE_ENTITY_SYSTEM_ID; } return common(state, tok); } static int PTRCALL entity10(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_ENTITY_COMPLETE; } return common(state, tok); } static int PTRCALL notation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; case XML_TOK_NAME: state->handler = notation1; return XML_ROLE_NOTATION_NAME; } return common(state, tok); } static int PTRCALL notation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { state->handler = notation3; return XML_ROLE_NOTATION_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { state->handler = notation2; return XML_ROLE_NOTATION_NONE; } break; } return common(state, tok); } static int PTRCALL notation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; case XML_TOK_LITERAL: state->handler = notation4; return XML_ROLE_NOTATION_PUBLIC_ID; } return common(state, tok); } static int PTRCALL notation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; case XML_TOK_LITERAL: state->handler = declClose; state->role_none = XML_ROLE_NOTATION_NONE; return XML_ROLE_NOTATION_SYSTEM_ID; } return common(state, tok); } static int PTRCALL notation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; case XML_TOK_LITERAL: state->handler = declClose; state->role_none = XML_ROLE_NOTATION_NONE; return XML_ROLE_NOTATION_SYSTEM_ID; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_NOTATION_NO_SYSTEM_ID; } return common(state, tok); } static int PTRCALL attlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist1; return XML_ROLE_ATTLIST_ELEMENT_NAME; } return common(state, tok); } static int PTRCALL attlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_DECL_CLOSE: setTopLevel(state); return XML_ROLE_ATTLIST_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist2; return XML_ROLE_ATTRIBUTE_NAME; } return common(state, tok); } static int PTRCALL attlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_NAME: { static const char * const types[] = { KW_CDATA, KW_ID, KW_IDREF, KW_IDREFS, KW_ENTITY, KW_ENTITIES, KW_NMTOKEN, KW_NMTOKENS, }; int i; for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { state->handler = attlist8; return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; } } if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { state->handler = attlist5; return XML_ROLE_ATTLIST_NONE; } break; case XML_TOK_OPEN_PAREN: state->handler = attlist3; return XML_ROLE_ATTLIST_NONE; } return common(state, tok); } static int PTRCALL attlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_NMTOKEN: case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = attlist4; return XML_ROLE_ATTRIBUTE_ENUM_VALUE; } return common(state, tok); } static int PTRCALL attlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_CLOSE_PAREN: state->handler = attlist8; return XML_ROLE_ATTLIST_NONE; case XML_TOK_OR: state->handler = attlist3; return XML_ROLE_ATTLIST_NONE; } return common(state, tok); } static int PTRCALL attlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_OPEN_PAREN: state->handler = attlist6; return XML_ROLE_ATTLIST_NONE; } return common(state, tok); } static int PTRCALL attlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_NAME: state->handler = attlist7; return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; } return common(state, tok); } static int PTRCALL attlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_CLOSE_PAREN: state->handler = attlist8; return XML_ROLE_ATTLIST_NONE; case XML_TOK_OR: state->handler = attlist6; return XML_ROLE_ATTLIST_NONE; } return common(state, tok); } /* default value */ static int PTRCALL attlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_POUND_NAME: if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_IMPLIED)) { state->handler = attlist1; return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; } if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_REQUIRED)) { state->handler = attlist1; return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; } if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_FIXED)) { state->handler = attlist9; return XML_ROLE_ATTLIST_NONE; } break; case XML_TOK_LITERAL: state->handler = attlist1; return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; } return common(state, tok); } static int PTRCALL attlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_LITERAL: state->handler = attlist1; return XML_ROLE_FIXED_ATTRIBUTE_VALUE; } return common(state, tok); } static int PTRCALL element0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element1; return XML_ROLE_ELEMENT_NAME; } return common(state, tok); } static int PTRCALL element1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; return XML_ROLE_CONTENT_EMPTY; } if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; return XML_ROLE_CONTENT_ANY; } break; case XML_TOK_OPEN_PAREN: state->handler = element2; state->level = 1; return XML_ROLE_GROUP_OPEN; } return common(state, tok); } static int PTRCALL element2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_POUND_NAME: if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_PCDATA)) { state->handler = element3; return XML_ROLE_CONTENT_PCDATA; } break; case XML_TOK_OPEN_PAREN: state->level = 2; state->handler = element6; return XML_ROLE_GROUP_OPEN; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT; case XML_TOK_NAME_QUESTION: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_OPT; case XML_TOK_NAME_ASTERISK: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_REP; case XML_TOK_NAME_PLUS: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_PLUS; } return common(state, tok); } static int PTRCALL element3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_CLOSE_PAREN: state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; return XML_ROLE_GROUP_CLOSE; case XML_TOK_CLOSE_PAREN_ASTERISK: state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_OR: state->handler = element4; return XML_ROLE_ELEMENT_NONE; } return common(state, tok); } static int PTRCALL element4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element5; return XML_ROLE_CONTENT_ELEMENT; } return common(state, tok); } static int PTRCALL element5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_CLOSE_PAREN_ASTERISK: state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_OR: state->handler = element4; return XML_ROLE_ELEMENT_NONE; } return common(state, tok); } static int PTRCALL element6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_OPEN_PAREN: state->level += 1; return XML_ROLE_GROUP_OPEN; case XML_TOK_NAME: case XML_TOK_PREFIXED_NAME: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT; case XML_TOK_NAME_QUESTION: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_OPT; case XML_TOK_NAME_ASTERISK: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_REP; case XML_TOK_NAME_PLUS: state->handler = element7; return XML_ROLE_CONTENT_ELEMENT_PLUS; } return common(state, tok); } static int PTRCALL element7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_CLOSE_PAREN: state->level -= 1; if (state->level == 0) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; } return XML_ROLE_GROUP_CLOSE; case XML_TOK_CLOSE_PAREN_ASTERISK: state->level -= 1; if (state->level == 0) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; } return XML_ROLE_GROUP_CLOSE_REP; case XML_TOK_CLOSE_PAREN_QUESTION: state->level -= 1; if (state->level == 0) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; } return XML_ROLE_GROUP_CLOSE_OPT; case XML_TOK_CLOSE_PAREN_PLUS: state->level -= 1; if (state->level == 0) { state->handler = declClose; state->role_none = XML_ROLE_ELEMENT_NONE; } return XML_ROLE_GROUP_CLOSE_PLUS; case XML_TOK_COMMA: state->handler = element6; return XML_ROLE_GROUP_SEQUENCE; case XML_TOK_OR: state->handler = element6; return XML_ROLE_GROUP_CHOICE; } return common(state, tok); } #ifdef XML_DTD static int PTRCALL condSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_NAME: if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { state->handler = condSect1; return XML_ROLE_NONE; } if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { state->handler = condSect2; return XML_ROLE_NONE; } break; } return common(state, tok); } static int PTRCALL condSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = externalSubset1; state->includeLevel += 1; return XML_ROLE_NONE; } return common(state, tok); } static int PTRCALL condSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_OPEN_BRACKET: state->handler = externalSubset1; return XML_ROLE_IGNORE_SECT; } return common(state, tok); } #endif /* XML_DTD */ static int PTRCALL declClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return state->role_none; case XML_TOK_DECL_CLOSE: setTopLevel(state); return state->role_none; } return common(state, tok); } static int PTRCALL error(PROLOG_STATE *state, int tok, const char *ptr, const char *end, const ENCODING *enc) { return XML_ROLE_NONE; } static int FASTCALL common(PROLOG_STATE *state, int tok) { #ifdef XML_DTD if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) return XML_ROLE_INNER_PARAM_ENTITY_REF; #endif state->handler = error; return XML_ROLE_ERROR; } void XmlPrologStateInit(PROLOG_STATE *state) { state->handler = prolog0; #ifdef XML_DTD state->documentEntity = 1; state->includeLevel = 0; state->inEntityValue = 0; #endif /* XML_DTD */ } #ifdef XML_DTD void XmlPrologStateInitExternalEntity(PROLOG_STATE *state) { state->handler = externalSubset0; state->documentEntity = 0; state->includeLevel = 0; } #endif /* XML_DTD */ astropy-0.3/cextern/expat/lib/xmltok.h0000755000175000017500000002566012243255342016241 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef XmlTok_INCLUDED #define XmlTok_INCLUDED 1 #ifdef __cplusplus extern "C" { #endif /* The following token may be returned by XmlContentTok */ #define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of illegal ]]> sequence */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok. */ #define XML_TOK_NONE -4 /* The string to be scanned is empty */ #define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; might be part of CRLF sequence */ #define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ #define XML_TOK_PARTIAL -1 /* only part of a token */ #define XML_TOK_INVALID 0 /* The following tokens are returned by XmlContentTok; some are also returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. */ #define XML_TOK_START_TAG_WITH_ATTS 1 #define XML_TOK_START_TAG_NO_ATTS 2 #define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ #define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 #define XML_TOK_END_TAG 5 #define XML_TOK_DATA_CHARS 6 #define XML_TOK_DATA_NEWLINE 7 #define XML_TOK_CDATA_SECT_OPEN 8 #define XML_TOK_ENTITY_REF 9 #define XML_TOK_CHAR_REF 10 /* numeric character reference */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok. */ #define XML_TOK_PI 11 /* processing instruction */ #define XML_TOK_XML_DECL 12 /* XML decl or text decl */ #define XML_TOK_COMMENT 13 #define XML_TOK_BOM 14 /* Byte order mark */ /* The following tokens are returned only by XmlPrologTok */ #define XML_TOK_PROLOG_S 15 #define XML_TOK_DECL_OPEN 16 /* */ #define XML_TOK_NAME 18 #define XML_TOK_NMTOKEN 19 #define XML_TOK_POUND_NAME 20 /* #name */ #define XML_TOK_OR 21 /* | */ #define XML_TOK_PERCENT 22 #define XML_TOK_OPEN_PAREN 23 #define XML_TOK_CLOSE_PAREN 24 #define XML_TOK_OPEN_BRACKET 25 #define XML_TOK_CLOSE_BRACKET 26 #define XML_TOK_LITERAL 27 #define XML_TOK_PARAM_ENTITY_REF 28 #define XML_TOK_INSTANCE_START 29 /* The following occur only in element type declarations */ #define XML_TOK_NAME_QUESTION 30 /* name? */ #define XML_TOK_NAME_ASTERISK 31 /* name* */ #define XML_TOK_NAME_PLUS 32 /* name+ */ #define XML_TOK_COND_SECT_OPEN 33 /* */ #define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ #define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ #define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ #define XML_TOK_COMMA 38 /* The following token is returned only by XmlAttributeValueTok */ #define XML_TOK_ATTRIBUTE_VALUE_S 39 /* The following token is returned only by XmlCdataSectionTok */ #define XML_TOK_CDATA_SECT_CLOSE 40 /* With namespace processing this is returned by XmlPrologTok for a name with a colon. */ #define XML_TOK_PREFIXED_NAME 41 #ifdef XML_DTD #define XML_TOK_IGNORE_SECT 42 #endif /* XML_DTD */ #ifdef XML_DTD #define XML_N_STATES 4 #else /* not XML_DTD */ #define XML_N_STATES 3 #endif /* not XML_DTD */ #define XML_PROLOG_STATE 0 #define XML_CONTENT_STATE 1 #define XML_CDATA_SECTION_STATE 2 #ifdef XML_DTD #define XML_IGNORE_SECTION_STATE 3 #endif /* XML_DTD */ #define XML_N_LITERAL_TYPES 2 #define XML_ATTRIBUTE_VALUE_LITERAL 0 #define XML_ENTITY_VALUE_LITERAL 1 /* The size of the buffer passed to XmlUtf8Encode must be at least this. */ #define XML_UTF8_ENCODE_MAX 4 /* The size of the buffer passed to XmlUtf16Encode must be at least this. */ #define XML_UTF16_ENCODE_MAX 2 typedef struct position { /* first line and first column are 0 not 1 */ XML_Size lineNumber; XML_Size columnNumber; } POSITION; typedef struct { const char *name; const char *valuePtr; const char *valueEnd; char normalized; } ATTRIBUTE; struct encoding; typedef struct encoding ENCODING; typedef int (PTRCALL *SCANNER)(const ENCODING *, const char *, const char *, const char **); struct encoding { SCANNER scanners[XML_N_STATES]; SCANNER literalScanners[XML_N_LITERAL_TYPES]; int (PTRCALL *sameName)(const ENCODING *, const char *, const char *); int (PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *, const char *); int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); int (PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax, ATTRIBUTE *atts); int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); int (PTRCALL *predefinedEntityName)(const ENCODING *, const char *, const char *); void (PTRCALL *updatePosition)(const ENCODING *, const char *ptr, const char *end, POSITION *); int (PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr, const char *end, const char **badPtr); void (PTRCALL *utf8Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim); void (PTRCALL *utf16Convert)(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim); int minBytesPerChar; char isUtf8; char isUtf16; }; /* Scan the string starting at ptr until the end of the next complete token, but do not scan past eptr. Return an integer giving the type of token. Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. Return XML_TOK_PARTIAL when the string does not contain a complete token; nextTokPtr will not be set. Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr will be set to point to the character which made the token invalid. Otherwise the string starts with a valid token; nextTokPtr will be set to point to the character following the end of that token. Each data character counts as a single token, but adjacent data characters may be returned together. Similarly for characters in the prolog outside literals, comments and processing instructions. */ #define XmlTok(enc, state, ptr, end, nextTokPtr) \ (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) #define XmlPrologTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) #define XmlContentTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) #define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) #ifdef XML_DTD #define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) #endif /* XML_DTD */ /* This is used for performing a 2nd-level tokenization on the content of a literal that has already been returned by XmlTok. */ #define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) #define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) #define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) #define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) #define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) #define XmlNameLength(enc, ptr) \ (((enc)->nameLength)(enc, ptr)) #define XmlSkipS(enc, ptr) \ (((enc)->skipS)(enc, ptr)) #define XmlGetAttributes(enc, ptr, attsMax, atts) \ (((enc)->getAtts)(enc, ptr, attsMax, atts)) #define XmlCharRefNumber(enc, ptr) \ (((enc)->charRefNumber)(enc, ptr)) #define XmlPredefinedEntityName(enc, ptr, end) \ (((enc)->predefinedEntityName)(enc, ptr, end)) #define XmlUpdatePosition(enc, ptr, end, pos) \ (((enc)->updatePosition)(enc, ptr, end, pos)) #define XmlIsPublicId(enc, ptr, end, badPtr) \ (((enc)->isPublicId)(enc, ptr, end, badPtr)) #define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) #define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) typedef struct { ENCODING initEnc; const ENCODING **encPtr; } INIT_ENCODING; int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr); int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING *XmlGetUtf8InternalEncoding(void); const ENCODING *XmlGetUtf16InternalEncoding(void); int FASTCALL XmlUtf8Encode(int charNumber, char *buf); int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); int XmlSizeOfUnknownEncoding(void); typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData); int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, const ENCODING **namedEncodingPtr, int *standalonePtr); int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING *XmlGetUtf8InternalEncodingNS(void); const ENCODING *XmlGetUtf16InternalEncodingNS(void); ENCODING * XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, void *userData); #ifdef __cplusplus } #endif #endif /* not XmlTok_INCLUDED */ astropy-0.3/cextern/expat/lib/macconfig.h0000755000175000017500000000245512243255342016646 0ustar oleole/*================================================================ ** Copyright 2000, Clark Cooper ** All rights reserved. ** ** This is free software. You are permitted to copy, distribute, or modify ** it under the terms of the MIT/X license (contained in the COPYING file ** with this distribution.) ** */ #ifndef MACCONFIG_H #define MACCONFIG_H /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #define BYTEORDER 4321 /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* whether byteorder is bigendian */ #define WORDS_BIGENDIAN /* Define to specify how much context to retain around the current parse point. */ #undef XML_CONTEXT_BYTES /* Define to make parameter entity parsing functionality available. */ #define XML_DTD /* Define to make XML Namespaces functionality available. */ #define XML_NS /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long' if does not define. */ #define off_t long /* Define to `unsigned' if does not define. */ #undef size_t #endif /* ifndef MACCONFIG_H */ astropy-0.3/cextern/expat/lib/Makefile.MPW0000755000175000017500000001076712243255342016656 0ustar oleole# File: Makefile.MPW # Targets: All, Dynamic, Static (and Clean, Clean-All) # Created: Tuesday, July 02, 2002 # # MPW Makefile for building expat under the "classic" (i.e. pre-X) Mac OS # Copyright © 2002 Daryle Walker # Portions Copyright © 2002 Thomas Wegner # See the COPYING file for distribution information # # Description: # This Makefile lets you build static, dynamic (i.e. shared) and stub # versions of the expat library as well as the elements.c and outline.c # examples (built as tools for MPW). This is for PPC only; it should be # no problem to build a 68K version of the expat library, though. # # Usage: # Buildprogram All # or Buildprogram Dynamic # or Buildprogram Static # # Note: You first have to rename this file to "Makefile", or the Buildprogram # commando will not recognize it. # MAKEFILE = Makefile ¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified ObjDir = : SrcDir = : HdrDir = : ToolDir = ::examples: Includes = -i {HdrDir} Sym-PPC = -sym off Defines = -d MACOS_CLASSIC PPCCOptions = {Includes} {Sym-PPC} -w 35 {Defines} FragName = libexpat ### Source Files ### SrcFiles = ¶ "{SrcDir}xmlparse.c" ¶ "{SrcDir}xmlrole.c" ¶ "{SrcDir}xmltok.c" ToolSrcFiles = ¶ "{ToolDir}elements.c" ¶ "{ToolDir}outline.c" ### Object Files ### ObjFiles-PPC = ¶ "{ObjDir}xmlparse.c.o" ¶ "{ObjDir}xmlrole.c.o" ¶ "{ObjDir}xmltok.c.o" ElementToolObjFile = "{ObjDir}elements.c.o" OutlineToolObjFile = "{ObjDir}outline.c.o" ### Libraries ### StLibFiles-PPC = ¶ "{PPCLibraries}StdCRuntime.o" ¶ "{PPCLibraries}PPCCRuntime.o" ¶ "{PPCLibraries}PPCToolLibs.o" ShLibFiles-PPC = ¶ "{SharedLibraries}InterfaceLib" ¶ "{SharedLibraries}StdCLib" ¶ "{SharedLibraries}MathLib" LibFiles-PPC = ¶ {StLibFiles-PPC} ¶ {ShLibFiles-PPC} ### Special Files ### ExportFile = "{ObjDir}{FragName}.exp" StLibFile = "{ObjDir}{FragName}.MrC.o" ShLibFile = "{ObjDir}{FragName}" StubFile = "{ObjDir}{FragName}.stub" ElementsTool = "{ToolDir}elements" OutlineTool = "{ToolDir}outline" ### Default Rules ### .c.o Ä .c {¥MondoBuild¥} {PPCC} {depDir}{default}.c -o {targDir}{default}.c.o {PPCCOptions} ### Build Rules ### All Ä Dynamic {ElementsTool} {OutlineTool} Static Ä {StLibFile} Dynamic Ä Static {ShLibFile} {StubFile} {StLibFile} ÄÄ {ObjFiles-PPC} {StLibFiles-PPC} {¥MondoBuild¥} PPCLink ¶ -o {Targ} ¶ {ObjFiles-PPC} ¶ {StLibFiles-PPC} ¶ {Sym-PPC} ¶ -mf -d ¶ -t 'XCOF' ¶ -c 'MPS ' ¶ -xm l {ShLibFile} ÄÄ {StLibFile} {ShLibFiles-PPC} {ExportFile} {¥MondoBuild¥} PPCLink ¶ -o {Targ} ¶ {StLibFile} ¶ {ShLibFiles-PPC} ¶ {Sym-PPC} ¶ -@export {ExportFile} ¶ -fragname {FragName} ¶ -mf -d ¶ -t 'shlb' ¶ -c '????' ¶ -xm s {StubFile} ÄÄ {ShLibFile} {¥MondoBuild¥} shlb2stub -o {Targ} {ShLibFile} {ElementsTool} ÄÄ {ElementToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} PPCLink ¶ -o {Targ} ¶ {ElementToolObjFile} ¶ {StLibFile} ¶ {LibFiles-PPC} ¶ {Sym-PPC} ¶ -mf -d ¶ -t 'MPST' ¶ -c 'MPS ' {OutlineTool} ÄÄ {OutlineToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} PPCLink ¶ -o {Targ} ¶ {OutlineToolObjFile} ¶ {StLibFile} ¶ {LibFiles-PPC} ¶ {Sym-PPC} ¶ -mf -d ¶ -t 'MPST' ¶ -c 'MPS ' ### Special Rules ### {ExportFile} ÄÄ "{HdrDir}expat.h" {¥MondoBuild¥} StreamEdit -d ¶ -e "/¥('XMLPARSEAPI('Å') ')Ç0,1È'XML_'([A-Za-z0-9_]+)¨1'('/ Print 'XML_' ¨1" ¶ "{HdrDir}expat.h" > {Targ} ### Required Dependencies ### "{ObjDir}xmlparse.c.o" Ä "{SrcDir}xmlparse.c" "{ObjDir}xmlrole.c.o" Ä "{SrcDir}xmlrole.c" "{ObjDir}xmltok.c.o" Ä "{SrcDir}xmltok.c" "{ObjDir}elements.c.o" Ä "{ToolDir}elements.c" "{ObjDir}outline.c.o" Ä "{ToolDir}outline.c" ### Optional Dependencies ### ### Build this target to clean out generated intermediate files. ### Clean Ä Delete {ObjFiles-PPC} {ExportFile} {ElementToolObjFile} {OutlineToolObjFile} ### Build this target to clean out all generated files. ### Clean-All Ä Clean Delete {StLibFile} {ShLibFile} {StubFile} {ElementsTool} {OutlineTool} ### Build this target to generate "include file" dependencies. ### Dependencies Ä $OutOfDate MakeDepend ¶ -append {MAKEFILE} ¶ -ignore "{CIncludes}" ¶ -objdir "{ObjDir}" ¶ -objext .o ¶ {Defines} ¶ {Includes} ¶ {SrcFiles} astropy-0.3/cextern/expat/lib/expat.h0000755000175000017500000012143012243255342016034 0ustar oleole/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef Expat_INCLUDED #define Expat_INCLUDED 1 #ifdef __VMS /* 0 1 2 3 0 1 2 3 1234567890123456789012345678901 1234567890123456789012345678901 */ #define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler #define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler #define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler #define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg #endif #include #include "expat_external.h" #ifdef __cplusplus extern "C" { #endif struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; /* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; #define XML_TRUE ((XML_Bool) 1) #define XML_FALSE ((XML_Bool) 0) /* The XML_Status enum gives the possible return values for several API functions. The preprocessor #defines are included so this stanza can be added to code that still needs to support older versions of Expat 1.95.x: #ifndef XML_STATUS_OK #define XML_STATUS_OK 1 #define XML_STATUS_ERROR 0 #endif Otherwise, the #define hackery is quite ugly and would have been dropped. */ enum XML_Status { XML_STATUS_ERROR = 0, #define XML_STATUS_ERROR XML_STATUS_ERROR XML_STATUS_OK = 1, #define XML_STATUS_OK XML_STATUS_OK XML_STATUS_SUSPENDED = 2 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED }; enum XML_Error { XML_ERROR_NONE, XML_ERROR_NO_MEMORY, XML_ERROR_SYNTAX, XML_ERROR_NO_ELEMENTS, XML_ERROR_INVALID_TOKEN, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_PARTIAL_CHAR, XML_ERROR_TAG_MISMATCH, XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_ASYNC_ENTITY, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_INCORRECT_ENCODING, XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_NOT_STANDALONE, XML_ERROR_UNEXPECTED_STATE, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_FEATURE_REQUIRES_XML_DTD, XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, /* Added in 1.95.7. */ XML_ERROR_UNBOUND_PREFIX, /* Added in 1.95.8. */ XML_ERROR_UNDECLARING_PREFIX, XML_ERROR_INCOMPLETE_PE, XML_ERROR_XML_DECL, XML_ERROR_TEXT_DECL, XML_ERROR_PUBLICID, XML_ERROR_SUSPENDED, XML_ERROR_NOT_SUSPENDED, XML_ERROR_ABORTED, XML_ERROR_FINISHED, XML_ERROR_SUSPEND_PE, /* Added in 2.0. */ XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, XML_ERROR_RESERVED_NAMESPACE_URI }; enum XML_Content_Type { XML_CTYPE_EMPTY = 1, XML_CTYPE_ANY, XML_CTYPE_MIXED, XML_CTYPE_NAME, XML_CTYPE_CHOICE, XML_CTYPE_SEQ }; enum XML_Content_Quant { XML_CQUANT_NONE, XML_CQUANT_OPT, XML_CQUANT_REP, XML_CQUANT_PLUS }; /* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be XML_CQUANT_NONE, and the other fields will be zero or NULL. If type == XML_CTYPE_MIXED, then quant will be NONE or REP and numchildren will contain number of elements that may be mixed in and children point to an array of XML_Content cells that will be all of XML_CTYPE_NAME type with no quantification. If type == XML_CTYPE_NAME, then the name points to the name, and the numchildren field will be zero and children will be NULL. The quant fields indicates any quantifiers placed on the name. CHOICE and SEQ will have name NULL, the number of children in numchildren and children will point, recursively, to an array of XML_Content cells. The EMPTY, ANY, and MIXED types will only occur at top level. */ typedef struct XML_cp XML_Content; struct XML_cp { enum XML_Content_Type type; enum XML_Content_Quant quant; XML_Char * name; unsigned int numchildren; XML_Content * children; }; /* This is called for an element declaration. See above for description of the model argument. It's the caller's responsibility to free model when finished with it. */ typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, const XML_Char *name, XML_Content *model); XMLPARSEAPI(void) XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl); /* The Attlist declaration handler is called for *each* attribute. So a single Attlist declaration with multiple attributes declared will generate multiple calls to this handler. The "default" parameter may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword. The "isrequired" parameter will be true and the default value will be NULL in the case of "#REQUIRED". If "isrequired" is true and default is non-NULL, then this is a "#FIXED" default. */ typedef void (XMLCALL *XML_AttlistDeclHandler) ( void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired); XMLPARSEAPI(void) XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl); /* The XML declaration handler is called for *both* XML declarations and text declarations. The way to distinguish is that the version parameter will be NULL for text declarations. The encoding parameter may be NULL for XML declarations. The standalone parameter will be -1, 0, or 1 indicating respectively that there was no standalone parameter in the declaration, that it was given as no, or that it was given as yes. */ typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, const XML_Char *version, const XML_Char *encoding, int standalone); XMLPARSEAPI(void) XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl); typedef struct { void *(*malloc_fcn)(size_t size); void *(*realloc_fcn)(void *ptr, size_t size); void (*free_fcn)(void *ptr); } XML_Memory_Handling_Suite; /* Constructs a new parser; encoding is the encoding specified by the external protocol or NULL if there is none specified. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate(const XML_Char *encoding); /* Constructs a new parser and namespace processor. Element type names and attribute names that belong to a namespace will be expanded; unprefixed attribute names are never expanded; unprefixed element type names are expanded only if there is a default namespace. The expanded name is the concatenation of the namespace URI, the namespace separator character, and the local part of the name. If the namespace separator is '\0' then the namespace URI and the local part will be concatenated without any separator. It is a programming error to use the separator '\0' with namespace triplets (see XML_SetReturnNSTriplet). */ XMLPARSEAPI(XML_Parser) XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); /* Constructs a new parser using the memory management suite referred to by memsuite. If memsuite is NULL, then use the standard library memory suite. If namespaceSeparator is non-NULL it creates a parser with namespace processing as described above. The character pointed at will serve as the namespace separator. All further memory operations used for the created parser will come from the given suite. */ XMLPARSEAPI(XML_Parser) XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); /* Prepare a parser object to be re-used. This is particularly valuable when memory allocation overhead is disproportionatly high, such as when a large number of small documnents need to be parsed. All handlers are cleared from the parser, except for the unknownEncodingHandler. The parser's external state is re-initialized except for the values of ns and ns_triplets. Added in Expat 1.95.3. */ XMLPARSEAPI(XML_Bool) XML_ParserReset(XML_Parser parser, const XML_Char *encoding); /* atts is array of name/value pairs, terminated by 0; names and values are 0 terminated. */ typedef void (XMLCALL *XML_StartElementHandler) (void *userData, const XML_Char *name, const XML_Char **atts); typedef void (XMLCALL *XML_EndElementHandler) (void *userData, const XML_Char *name); /* s is not 0 terminated. */ typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, const XML_Char *s, int len); /* target and data are 0 terminated */ typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( void *userData, const XML_Char *target, const XML_Char *data); /* data is 0 terminated */ typedef void (XMLCALL *XML_CommentHandler) (void *userData, const XML_Char *data); typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); /* This is called for any characters in the XML document for which there is no applicable handler. This includes both characters that are part of markup which is of a kind that is not reported (comments, markup declarations), or characters that are part of a construct which could be reported but for which no handler has been supplied. The characters are passed exactly as they were in the XML document except that they will be encoded in UTF-8 or UTF-16. Line boundaries are not normalized. Note that a byte order mark character is not passed to the default handler. There are no guarantees about how characters are divided between calls to the default handler: for example, a comment might be split between multiple calls. */ typedef void (XMLCALL *XML_DefaultHandler) (void *userData, const XML_Char *s, int len); /* This is called for the start of the DOCTYPE declaration, before any DTD or internal subset is parsed. */ typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset); /* This is called for the start of the DOCTYPE declaration when the closing > is encountered, but after processing any external subset. */ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); /* This is called for entity declarations. The is_parameter_entity argument will be non-zero if the entity is a parameter entity, zero otherwise. For internal entities (), value will be non-NULL and systemId, publicID, and notationName will be NULL. The value string is NOT nul-terminated; the length is provided in the value_length argument. Since it is legal to have zero-length values, do not use this argument to test for internal entities. For external entities, value will be NULL and systemId will be non-NULL. The publicId argument will be NULL unless a public identifier was provided. The notationName argument will have a non-NULL value only for unparsed entity declarations. Note that is_parameter_entity can't be changed to XML_Bool, since that would break binary compatibility. */ typedef void (XMLCALL *XML_EntityDeclHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); XMLPARSEAPI(void) XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler); /* OBSOLETE -- OBSOLETE -- OBSOLETE This handler has been superceded by the EntityDeclHandler above. It is provided here for backward compatibility. This is called for a declaration of an unparsed (NDATA) entity. The base argument is whatever was set by XML_SetBase. The entityName, systemId and notationName arguments will never be NULL. The other arguments may be. */ typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); /* This is called for a declaration of notation. The base argument is whatever was set by XML_SetBase. The notationName will never be NULL. The other arguments can be. */ typedef void (XMLCALL *XML_NotationDeclHandler) ( void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* When namespace processing is enabled, these are called once for each namespace declaration. The call to the start and end element handlers occur between the calls to the start and end namespace declaration handlers. For an xmlns attribute, prefix will be NULL. For an xmlns="" attribute, uri will be NULL. */ typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( void *userData, const XML_Char *prefix, const XML_Char *uri); typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( void *userData, const XML_Char *prefix); /* This is called if the document is not standalone, that is, it has an external subset or a reference to a parameter entity, but does not have standalone="yes". If this handler returns XML_STATUS_ERROR, then processing will not continue, and the parser will return a XML_ERROR_NOT_STANDALONE error. If parameter entity parsing is enabled, then in addition to the conditions above this handler will only be called if the referenced entity was actually read. */ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); /* This is called for a reference to an external parsed general entity. The referenced entity is not automatically parsed. The application can parse it immediately or later using XML_ExternalEntityParserCreate. The parser argument is the parser parsing the entity containing the reference; it can be passed as the parser argument to XML_ExternalEntityParserCreate. The systemId argument is the system identifier as specified in the entity declaration; it will not be NULL. The base argument is the system identifier that should be used as the base for resolving systemId if systemId was relative; this is set by XML_SetBase; it may be NULL. The publicId argument is the public identifier as specified in the entity declaration, or NULL if none was specified; the whitespace in the public identifier will have been normalized as required by the XML spec. The context argument specifies the parsing context in the format expected by the context argument to XML_ExternalEntityParserCreate; context is valid only until the handler returns, so if the referenced entity is to be parsed later, it must be copied. context is NULL only when the entity is a parameter entity. The handler should return XML_STATUS_ERROR if processing should not continue because of a fatal error in the handling of the external entity. In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING error. Note that unlike other handlers the first argument is the parser, not userData. */ typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); /* This is called in two situations: 1) An entity reference is encountered for which no declaration has been read *and* this is not an error. 2) An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called. Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values */ typedef void (XMLCALL *XML_SkippedEntityHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity); /* This structure is filled in by the XML_UnknownEncodingHandler to provide information to the parser about encodings that are unknown to the parser. The map[b] member gives information about byte sequences whose first byte is b. If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c. If map[b] is -1, then the byte sequence is malformed. If map[b] is -n, where n >= 2, then b is the first byte of an n-byte sequence that encodes a single Unicode scalar value. The data member will be passed as the first argument to the convert function. The convert function is used to convert multibyte sequences; s will point to a n-byte sequence where map[(unsigned char)*s] == -n. The convert function must return the Unicode scalar value represented by this byte sequence or -1 if the byte sequence is malformed. The convert function may be NULL if the encoding is a single-byte encoding, that is if map[b] >= -1 for all bytes b. When the parser is finished with the encoding, then if release is not NULL, it will call release passing it the data member; once release has been called, the convert function will not be called again. Expat places certain restrictions on the encodings that are supported using this mechanism. 1. Every ASCII character that can appear in a well-formed XML document, other than the characters $@\^`{}~ must be represented by a single byte, and that byte must be the same byte that represents that character in ASCII. 2. No character may require more than 4 bytes to encode. 3. All characters encoded must have Unicode scalar values <= 0xFFFF, (i.e., characters that would be encoded by surrogates in UTF-16 are not allowed). Note that this restriction doesn't apply to the built-in support for UTF-8 and UTF-16. 4. No Unicode character may be encoded by more than one distinct sequence of bytes. */ typedef struct { int map[256]; void *data; int (XMLCALL *convert)(void *data, const char *s); void (XMLCALL *release)(void *data); } XML_Encoding; /* This is called for an encoding that is unknown to the parser. The encodingHandlerData argument is that which was passed as the second argument to XML_SetUnknownEncodingHandler. The name argument gives the name of the encoding as specified in the encoding declaration. If the callback can provide information about the encoding, it must fill in the XML_Encoding structure, and return XML_STATUS_OK. Otherwise it must return XML_STATUS_ERROR. If info does not describe a suitable encoding, then the parser will return an XML_UNKNOWN_ENCODING error. */ typedef int (XMLCALL *XML_UnknownEncodingHandler) ( void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); XMLPARSEAPI(void) XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); XMLPARSEAPI(void) XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler); XMLPARSEAPI(void) XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler); XMLPARSEAPI(void) XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler); XMLPARSEAPI(void) XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler); XMLPARSEAPI(void) XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler); XMLPARSEAPI(void) XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); XMLPARSEAPI(void) XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start); XMLPARSEAPI(void) XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end); /* This sets the default handler and also inhibits expansion of internal entities. These entity references will be passed to the default handler, or to the skipped entity handler, if one is set. */ XMLPARSEAPI(void) XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler); /* This sets the default handler but does not inhibit expansion of internal entities. The entity reference will not be passed to the default handler. */ XMLPARSEAPI(void) XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); XMLPARSEAPI(void) XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start); XMLPARSEAPI(void) XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); XMLPARSEAPI(void) XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler); XMLPARSEAPI(void) XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start); XMLPARSEAPI(void) XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end); XMLPARSEAPI(void) XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler); XMLPARSEAPI(void) XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler); /* If a non-NULL value for arg is specified here, then it will be passed as the first argument to the external entity ref handler instead of the parser object. */ XMLPARSEAPI(void) XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg); XMLPARSEAPI(void) XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler); XMLPARSEAPI(void) XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); /* This can be called within a handler for a start element, end element, processing instruction or character data. It causes the corresponding markup to be passed to the default handler. */ XMLPARSEAPI(void) XML_DefaultCurrent(XML_Parser parser); /* If do_nst is non-zero, and namespace processing is in effect, and a name has a prefix (i.e. an explicit namespace qualifier) then that name is returned as a triplet in a single string separated by the separator character specified when the parser was created: URI + sep + local_name + sep + prefix. If do_nst is zero, then namespace information is returned in the default manner (URI + sep + local_name) whether or not the name has a prefix. Note: Calling XML_SetReturnNSTriplet after XML_Parse or XML_ParseBuffer has no effect. */ XMLPARSEAPI(void) XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); /* This value is passed as the userData argument to callbacks. */ XMLPARSEAPI(void) XML_SetUserData(XML_Parser parser, void *userData); /* Returns the last value set by XML_SetUserData or NULL. */ #define XML_GetUserData(parser) (*(void **)(parser)) /* This is equivalent to supplying an encoding argument to XML_ParserCreate. On success XML_SetEncoding returns non-zero, zero otherwise. Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer has no effect and returns XML_STATUS_ERROR. */ XMLPARSEAPI(enum XML_Status) XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); /* If this function is called, then the parser will be passed as the first argument to callbacks instead of userData. The userData will still be accessible using XML_GetUserData. */ XMLPARSEAPI(void) XML_UseParserAsHandlerArg(XML_Parser parser); /* If useDTD == XML_TRUE is passed to this function, then the parser will assume that there is an external subset, even if none is specified in the document. In such a case the parser will call the externalEntityRefHandler with a value of NULL for the systemId argument (the publicId and context arguments will be NULL as well). Note: For the purpose of checking WFC: Entity Declared, passing useDTD == XML_TRUE will make the parser behave as if the document had a DTD with an external subset. Note: If this function is called, then this must be done before the first call to XML_Parse or XML_ParseBuffer, since it will have no effect after that. Returns XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. Note: If the document does not have a DOCTYPE declaration at all, then startDoctypeDeclHandler and endDoctypeDeclHandler will not be called, despite an external subset being parsed. Note: If XML_DTD is not defined when Expat is compiled, returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); /* Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the base argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base argument will be copied. Returns XML_STATUS_ERROR if out of memory, XML_STATUS_OK otherwise. */ XMLPARSEAPI(enum XML_Status) XML_SetBase(XML_Parser parser, const XML_Char *base); XMLPARSEAPI(const XML_Char *) XML_GetBase(XML_Parser parser); /* Returns the number of the attribute/value pairs passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to XML_StartElementHandler, or -1 if there is no ID attribute. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); #ifdef XML_ATTR_INFO /* Source file byte offsets for the start and end of attribute names and values. The value indices are exclusive of surrounding quotes; thus in a UTF-8 source file an attribute value of "blah" will yield: info->valueEnd - info->valueStart = 4 bytes. */ typedef struct { XML_Index nameStart; /* Offset to beginning of the attribute name. */ XML_Index nameEnd; /* Offset after the attribute name's last byte. */ XML_Index valueStart; /* Offset to beginning of the attribute value. */ XML_Index valueEnd; /* Offset after the attribute value's last byte. */ } XML_AttrInfo; /* Returns an array of XML_AttrInfo structures for the attribute/value pairs passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 1; thus the number of entries in the array is XML_GetSpecifiedAttributeCount(parser) / 2. */ XMLPARSEAPI(const XML_AttrInfo *) XML_GetAttributeInfo(XML_Parser parser); #endif /* Parses some input. Returns XML_STATUS_ERROR if a fatal error is detected. The last call to XML_Parse must have isFinal true; len may be zero for this call (or any other). Though the return values for these functions has always been described as a Boolean value, the implementation, at least for the 1.95.x series, has always returned exactly one of the XML_Status values. */ XMLPARSEAPI(enum XML_Status) XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); XMLPARSEAPI(void *) XML_GetBuffer(XML_Parser parser, int len); XMLPARSEAPI(enum XML_Status) XML_ParseBuffer(XML_Parser parser, int len, int isFinal); /* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. Must be called from within a call-back handler, except when aborting (resumable = 0) an already suspended parser. Some call-backs may still follow because they would otherwise get lost. Examples: - endElementHandler() for empty elements when stopped in startElementHandler(), - endNameSpaceDeclHandler() when stopped in endElementHandler(), and possibly others. Can be called from most handlers, including DTD related call-backs, except when parsing an external parameter entity and resumable != 0. Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. Possible error codes: - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - XML_ERROR_FINISHED: when the parser has already finished. - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. When resumable != 0 (true) then parsing is suspended, that is, XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. *Note*: This will be applied to the current parser instance only, that is, if there is a parent parser then it will continue parsing when the externalEntityRefHandler() returns. It is up to the implementation of the externalEntityRefHandler() to call XML_StopParser() on the parent parser (recursively), if one wants to stop parsing altogether. When suspended, parsing can be resumed by calling XML_ResumeParser(). */ XMLPARSEAPI(enum XML_Status) XML_StopParser(XML_Parser parser, XML_Bool resumable); /* Resumes parsing after it has been suspended with XML_StopParser(). Must not be called from within a handler call-back. Returns same status codes as XML_Parse() or XML_ParseBuffer(). Additional error code XML_ERROR_NOT_SUSPENDED possible. *Note*: This must be called on the most deeply nested child parser instance first, and on its parent parser only after the child parser has finished, to be applied recursively until the document entity's parser is restarted. That is, the parent parser will not resume by itself and it is up to the application to call XML_ResumeParser() on it at the appropriate moment. */ XMLPARSEAPI(enum XML_Status) XML_ResumeParser(XML_Parser parser); enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED }; typedef struct { enum XML_Parsing parsing; XML_Bool finalBuffer; } XML_ParsingStatus; /* Returns status of parser with respect to being initialized, parsing, finished, or suspended and processing the final buffer. XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED */ XMLPARSEAPI(void) XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); /* Creates an XML_Parser object that can parse an external general entity; context is a '\0'-terminated string specifying the parse context; encoding is a '\0'-terminated string giving the name of the externally specified encoding, or NULL if there is no externally specified encoding. The context string consists of a sequence of tokens separated by formfeeds (\f); a token consisting of a name specifies that the general entity of the name is open; a token of the form prefix=uri specifies the namespace for a particular prefix; a token of the form =uri specifies the default namespace. This can be called at any point after the first call to an ExternalEntityRefHandler so longer as the parser has not yet been freed. The new parser is completely independent and may safely be used in a separate thread. The handlers and userData are initialized from the parser argument. Returns NULL if out of memory. Otherwise returns a new XML_Parser object. */ XMLPARSEAPI(XML_Parser) XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding); enum XML_ParamEntityParsing { XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, XML_PARAM_ENTITY_PARSING_ALWAYS }; /* Controls parsing of parameter entities (including the external DTD subset). If parsing of parameter entities is enabled, then references to external parameter entities (including the external DTD subset) will be passed to the handler set with XML_SetExternalEntityRefHandler. The context passed will be 0. Unlike external general entities, external parameter entities can only be parsed synchronously. If the external parameter entity is to be parsed, it must be parsed during the call to the external entity ref handler: the complete sequence of XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during this call. After XML_ExternalEntityParserCreate has been called to create the parser for the external parameter entity (context must be 0 for this call), it is illegal to make any calls on the old parser until XML_ParserFree has been called on the newly created parser. If the library has been compiled without support for parameter entity parsing (ie without XML_DTD being defined), then XML_SetParamEntityParsing will return 0 if parsing of parameter entities is requested; otherwise it will return non-zero. Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing); /* Sets the hash salt to use for internal hash calculations. Helps in preventing DoS attacks based on predicting hash function behavior. This must be called before parsing is started. Returns 1 if successful, 0 when called after parsing has started. */ XMLPARSEAPI(int) XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt); /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then XML_GetErrorCode returns information about the error. */ XMLPARSEAPI(enum XML_Error) XML_GetErrorCode(XML_Parser parser); /* These functions return information about the current parse location. They may be called from any callback called to report some parse event; in this case the location is the location of the first of the sequence of characters that generated the event. When called from callbacks generated by declarations in the document prologue, the location identified isn't as neatly defined, but will be within the relevant markup. When called outside of the callback functions, the position indicated will be just past the last parse event (regardless of whether there was an associated callback). They may also be called after returning from a call to XML_Parse or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then the location is the location of the character at which the error was detected; otherwise the location is the location of the last parse event, as described above. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); /* Return the number of bytes in the current event. Returns 0 if the event is in an internal entity. */ XMLPARSEAPI(int) XML_GetCurrentByteCount(XML_Parser parser); /* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets the integer pointed to by offset to the offset within this buffer of the current parse position, and sets the integer pointed to by size to the size of this buffer (the number of input bytes). Otherwise returns a NULL pointer. Also returns a NULL pointer if a parse isn't active. NOTE: The character pointer returned should not be used outside the handler that makes the call. */ XMLPARSEAPI(const char *) XML_GetInputContext(XML_Parser parser, int *offset, int *size); /* For backwards compatibility with previous versions. */ #define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber #define XML_GetErrorByteIndex XML_GetCurrentByteIndex /* Frees the content model passed to the element declaration handler */ XMLPARSEAPI(void) XML_FreeContentModel(XML_Parser parser, XML_Content *model); /* Exposing the memory handling functions used in Expat */ XMLPARSEAPI(void *) XML_MemMalloc(XML_Parser parser, size_t size); XMLPARSEAPI(void *) XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); XMLPARSEAPI(void) XML_MemFree(XML_Parser parser, void *ptr); /* Frees memory used by the parser. */ XMLPARSEAPI(void) XML_ParserFree(XML_Parser parser); /* Returns a string describing the error. */ XMLPARSEAPI(const XML_LChar *) XML_ErrorString(enum XML_Error code); /* Return a string containing the version number of this expat */ XMLPARSEAPI(const XML_LChar *) XML_ExpatVersion(void); typedef struct { int major; int minor; int micro; } XML_Expat_Version; /* Return an XML_Expat_Version structure containing numeric version number information for this version of expat. */ XMLPARSEAPI(XML_Expat_Version) XML_ExpatVersionInfo(void); /* Added in Expat 1.95.5. */ enum XML_FeatureEnum { XML_FEATURE_END = 0, XML_FEATURE_UNICODE, XML_FEATURE_UNICODE_WCHAR_T, XML_FEATURE_DTD, XML_FEATURE_CONTEXT_BYTES, XML_FEATURE_MIN_SIZE, XML_FEATURE_SIZEOF_XML_CHAR, XML_FEATURE_SIZEOF_XML_LCHAR, XML_FEATURE_NS, XML_FEATURE_LARGE_SIZE, XML_FEATURE_ATTR_INFO /* Additional features must be added to the end of this enum. */ }; typedef struct { enum XML_FeatureEnum feature; const XML_LChar *name; long int value; } XML_Feature; XMLPARSEAPI(const XML_Feature *) XML_GetFeatureList(void); /* Expat follows the GNU/Linux convention of odd number minor version for beta/development releases and even number minor version for stable releases. Micro is bumped with each release, and set to 0 with each change to major or minor version. */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 #define XML_MICRO_VERSION 0 #ifdef __cplusplus } #endif #endif /* not Expat_INCLUDED */ astropy-0.3/cextern/expat/lib/expatw_static.dsp0000755000175000017500000001034512243255342020133 0ustar oleole# Microsoft Developer Studio Project File - Name="expatw_static" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=expatw_static - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "expatw_static.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "expatw_static.mak" CFG="expatw_static - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "expatw_static - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "expatw_static - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "expatw_static - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "expatw_static___Win32_Release" # PROP BASE Intermediate_Dir "expatw_static___Win32_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release-w_static" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x1009 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatwMT.lib" !ELSEIF "$(CFG)" == "expatw_static - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "expatw_static___Win32_Debug" # PROP BASE Intermediate_Dir "expatw_static___Win32_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug-w_static" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x1009 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatwMT.lib" !ENDIF # Begin Target # Name "expatw_static - Win32 Release" # Name "expatw_static - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\xmlparse.c # End Source File # Begin Source File SOURCE=.\xmlrole.c # End Source File # Begin Source File SOURCE=.\xmltok.c # End Source File # Begin Source File SOURCE=.\xmltok_impl.c # End Source File # Begin Source File SOURCE=.\xmltok_ns.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\ascii.h # End Source File # Begin Source File SOURCE=.\asciitab.h # End Source File # Begin Source File SOURCE=.\expat.h # End Source File # Begin Source File SOURCE=.\expat_external.h # End Source File # Begin Source File SOURCE=.\iasciitab.h # End Source File # Begin Source File SOURCE=.\internal.h # End Source File # Begin Source File SOURCE=.\latin1tab.h # End Source File # Begin Source File SOURCE=.\nametab.h # End Source File # Begin Source File SOURCE=.\utf8tab.h # End Source File # Begin Source File SOURCE=.\xmlrole.h # End Source File # Begin Source File SOURCE=.\xmltok.h # End Source File # Begin Source File SOURCE=.\xmltok_impl.h # End Source File # End Group # End Target # End Project astropy-0.3/cextern/expat/lib/xmltok.c0000755000175000017500000012067512243255342016236 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" #elif defined(__amigaos__) #include "amigaconfig.h" #elif defined(__WATCOMC__) #include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif #endif /* ndef COMPILED_FROM_DSP */ #include "expat_external.h" #include "internal.h" #include "xmltok.h" #include "nametab.h" #ifdef XML_DTD #define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) #else #define IGNORE_SECTION_TOK_VTABLE /* as nothing */ #endif #define VTABLE1 \ { PREFIX(prologTok), PREFIX(contentTok), \ PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ PREFIX(sameName), \ PREFIX(nameMatchesAscii), \ PREFIX(nameLength), \ PREFIX(skipS), \ PREFIX(getAtts), \ PREFIX(charRefNumber), \ PREFIX(predefinedEntityName), \ PREFIX(updatePosition), \ PREFIX(isPublicId) #define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) #define UCS2_GET_NAMING(pages, hi, lo) \ (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) /* A 2 byte UTF-8 representation splits the characters 11 bits between the bottom 5 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ #define UTF8_GET_NAMING2(pages, byte) \ (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + ((((byte)[0]) & 3) << 1) \ + ((((byte)[1]) >> 5) & 1)] \ & (1 << (((byte)[1]) & 0x1F))) /* A 3 byte UTF-8 representation splits the characters 16 bits between the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ #define UTF8_GET_NAMING3(pages, byte) \ (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ + ((((byte)[1]) >> 2) & 0xF)] \ << 3) \ + ((((byte)[1]) & 3) << 1) \ + ((((byte)[2]) >> 5) & 1)] \ & (1 << (((byte)[2]) & 0x1F))) #define UTF8_GET_NAMING(pages, p, n) \ ((n) == 2 \ ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ : ((n) == 3 \ ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ : 0)) /* Detection of invalid UTF-8 sequences is based on Table 3.1B of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ with the additional restriction of not allowing the Unicode code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). Implementation details: (A & 0x80) == 0 means A < 0x80 and (A & 0xC0) == 0xC0 means A > 0xBF */ #define UTF8_INVALID2(p) \ ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) #define UTF8_INVALID3(p) \ (((p)[2] & 0x80) == 0 \ || \ ((*p) == 0xEF && (p)[1] == 0xBF \ ? \ (p)[2] > 0xBD \ : \ ((p)[2] & 0xC0) == 0xC0) \ || \ ((*p) == 0xE0 \ ? \ (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ : \ ((p)[1] & 0x80) == 0 \ || \ ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) #define UTF8_INVALID4(p) \ (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ || \ ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ || \ ((*p) == 0xF0 \ ? \ (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ : \ ((p)[1] & 0x80) == 0 \ || \ ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) static int PTRFASTCALL isNever(const ENCODING *enc, const char *p) { return 0; } static int PTRFASTCALL utf8_isName2(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); } static int PTRFASTCALL utf8_isName3(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); } #define utf8_isName4 isNever static int PTRFASTCALL utf8_isNmstrt2(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); } static int PTRFASTCALL utf8_isNmstrt3(const ENCODING *enc, const char *p) { return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); } #define utf8_isNmstrt4 isNever static int PTRFASTCALL utf8_isInvalid2(const ENCODING *enc, const char *p) { return UTF8_INVALID2((const unsigned char *)p); } static int PTRFASTCALL utf8_isInvalid3(const ENCODING *enc, const char *p) { return UTF8_INVALID3((const unsigned char *)p); } static int PTRFASTCALL utf8_isInvalid4(const ENCODING *enc, const char *p) { return UTF8_INVALID4((const unsigned char *)p); } struct normal_encoding { ENCODING enc; unsigned char type[256]; #ifdef XML_MIN_SIZE int (PTRFASTCALL *byteType)(const ENCODING *, const char *); int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *); int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); int (PTRCALL *charMatches)(const ENCODING *, const char *, int); #endif /* XML_MIN_SIZE */ int (PTRFASTCALL *isName2)(const ENCODING *, const char *); int (PTRFASTCALL *isName3)(const ENCODING *, const char *); int (PTRFASTCALL *isName4)(const ENCODING *, const char *); int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); }; #define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) #ifdef XML_MIN_SIZE #define STANDARD_VTABLE(E) \ E ## byteType, \ E ## isNameMin, \ E ## isNmstrtMin, \ E ## byteToAscii, \ E ## charMatches, #else #define STANDARD_VTABLE(E) /* as nothing */ #endif #define NORMAL_VTABLE(E) \ E ## isName2, \ E ## isName3, \ E ## isName4, \ E ## isNmstrt2, \ E ## isNmstrt3, \ E ## isNmstrt4, \ E ## isInvalid2, \ E ## isInvalid3, \ E ## isInvalid4 static int FASTCALL checkCharRefNumber(int); #include "xmltok_impl.h" #include "ascii.h" #ifdef XML_MIN_SIZE #define sb_isNameMin isNever #define sb_isNmstrtMin isNever #endif #ifdef XML_MIN_SIZE #define MINBPC(enc) ((enc)->minBytesPerChar) #else /* minimum bytes per character */ #define MINBPC(enc) 1 #endif #define SB_BYTE_TYPE(enc, p) \ (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) #ifdef XML_MIN_SIZE static int PTRFASTCALL sb_byteType(const ENCODING *enc, const char *p) { return SB_BYTE_TYPE(enc, p); } #define BYTE_TYPE(enc, p) \ (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) #else #define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) #endif #ifdef XML_MIN_SIZE #define BYTE_TO_ASCII(enc, p) \ (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) static int PTRFASTCALL sb_byteToAscii(const ENCODING *enc, const char *p) { return *p; } #else #define BYTE_TO_ASCII(enc, p) (*(p)) #endif #define IS_NAME_CHAR(enc, p, n) \ (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) #define IS_NMSTRT_CHAR(enc, p, n) \ (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) #define IS_INVALID_CHAR(enc, p, n) \ (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) #ifdef XML_MIN_SIZE #define IS_NAME_CHAR_MINBPC(enc, p) \ (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) #define IS_NMSTRT_CHAR_MINBPC(enc, p) \ (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) #else #define IS_NAME_CHAR_MINBPC(enc, p) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) #endif #ifdef XML_MIN_SIZE #define CHAR_MATCHES(enc, p, c) \ (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) static int PTRCALL sb_charMatches(const ENCODING *enc, const char *p, int c) { return *p == c; } #else /* c is an ASCII character */ #define CHAR_MATCHES(enc, p, c) (*(p) == c) #endif #define PREFIX(ident) normal_ ## ident #define XML_TOK_IMPL_C #include "xmltok_impl.c" #undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ UTF8_cval1 = 0x00, UTF8_cval2 = 0xc0, UTF8_cval3 = 0xe0, UTF8_cval4 = 0xf0 }; static void PTRCALL utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { char *to; const char *from; if (fromLim - *fromP > toLim - *toP) { /* Avoid copying partial characters. */ for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) break; } for (to = *toP, from = *fromP; from != fromLim; from++, to++) *to = *from; *fromP = from; *toP = to; } static void PTRCALL utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { unsigned short *to = *toP; const char *from = *fromP; while (from != fromLim && to != toLim) { switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { case BT_LEAD2: *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); from += 2; break; case BT_LEAD3: *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); from += 3; break; case BT_LEAD4: { unsigned long n; if (to + 1 == toLim) goto after; n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); n -= 0x10000; to[0] = (unsigned short)((n >> 10) | 0xD800); to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); to += 2; from += 4; } break; default: *to++ = *from++; break; } } after: *fromP = from; *toP = to; } #ifdef XML_NS static const struct normal_encoding utf8_encoding_ns = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #include "asciitab.h" #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #endif static const struct normal_encoding utf8_encoding = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #ifdef XML_NS static const struct normal_encoding internal_utf8_encoding_ns = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #include "iasciitab.h" #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; #endif static const struct normal_encoding internal_utf8_encoding = { { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "utf8tab.h" }, STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) }; static void PTRCALL latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { for (;;) { unsigned char c; if (*fromP == fromLim) break; c = (unsigned char)**fromP; if (c & 0x80) { if (toLim - *toP < 2) break; *(*toP)++ = (char)((c >> 6) | UTF8_cval2); *(*toP)++ = (char)((c & 0x3f) | 0x80); (*fromP)++; } else { if (*toP == toLim) break; *(*toP)++ = *(*fromP)++; } } } static void PTRCALL latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { while (*fromP != fromLim && *toP != toLim) *(*toP)++ = (unsigned char)*(*fromP)++; } #ifdef XML_NS static const struct normal_encoding latin1_encoding_ns = { { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(sb_) }; #endif static const struct normal_encoding latin1_encoding = { { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(sb_) }; static void PTRCALL ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { while (*fromP != fromLim && *toP != toLim) *(*toP)++ = *(*fromP)++; } #ifdef XML_NS static const struct normal_encoding ascii_encoding_ns = { { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, { #include "asciitab.h" /* BT_NONXML == 0 */ }, STANDARD_VTABLE(sb_) }; #endif static const struct normal_encoding ascii_encoding = { { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON /* BT_NONXML == 0 */ }, STANDARD_VTABLE(sb_) }; static int PTRFASTCALL unicode_byte_type(char hi, char lo) { switch ((unsigned char)hi) { case 0xD8: case 0xD9: case 0xDA: case 0xDB: return BT_LEAD4; case 0xDC: case 0xDD: case 0xDE: case 0xDF: return BT_TRAIL; case 0xFF: switch ((unsigned char)lo) { case 0xFF: case 0xFE: return BT_NONXML; } break; } return BT_NONASCII; } #define DEFINE_UTF16_TO_UTF8(E) \ static void PTRCALL \ E ## toUtf8(const ENCODING *enc, \ const char **fromP, const char *fromLim, \ char **toP, const char *toLim) \ { \ const char *from; \ for (from = *fromP; from != fromLim; from += 2) { \ int plane; \ unsigned char lo2; \ unsigned char lo = GET_LO(from); \ unsigned char hi = GET_HI(from); \ switch (hi) { \ case 0: \ if (lo < 0x80) { \ if (*toP == toLim) { \ *fromP = from; \ return; \ } \ *(*toP)++ = lo; \ break; \ } \ /* fall through */ \ case 0x1: case 0x2: case 0x3: \ case 0x4: case 0x5: case 0x6: case 0x7: \ if (toLim - *toP < 2) { \ *fromP = from; \ return; \ } \ *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ *(*toP)++ = ((lo & 0x3f) | 0x80); \ break; \ default: \ if (toLim - *toP < 3) { \ *fromP = from; \ return; \ } \ /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ *(*toP)++ = ((lo & 0x3f) | 0x80); \ break; \ case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ if (toLim - *toP < 4) { \ *fromP = from; \ return; \ } \ plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ from += 2; \ lo2 = GET_LO(from); \ *(*toP)++ = (((lo & 0x3) << 4) \ | ((GET_HI(from) & 0x3) << 2) \ | (lo2 >> 6) \ | 0x80); \ *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ break; \ } \ } \ *fromP = from; \ } #define DEFINE_UTF16_TO_UTF16(E) \ static void PTRCALL \ E ## toUtf16(const ENCODING *enc, \ const char **fromP, const char *fromLim, \ unsigned short **toP, const unsigned short *toLim) \ { \ /* Avoid copying first half only of surrogate */ \ if (fromLim - *fromP > ((toLim - *toP) << 1) \ && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ fromLim -= 2; \ for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ } #define SET2(ptr, ch) \ (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) #define GET_LO(ptr) ((unsigned char)(ptr)[0]) #define GET_HI(ptr) ((unsigned char)(ptr)[1]) DEFINE_UTF16_TO_UTF8(little2_) DEFINE_UTF16_TO_UTF16(little2_) #undef SET2 #undef GET_LO #undef GET_HI #define SET2(ptr, ch) \ (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) #define GET_LO(ptr) ((unsigned char)(ptr)[1]) #define GET_HI(ptr) ((unsigned char)(ptr)[0]) DEFINE_UTF16_TO_UTF8(big2_) DEFINE_UTF16_TO_UTF16(big2_) #undef SET2 #undef GET_LO #undef GET_HI #define LITTLE2_BYTE_TYPE(enc, p) \ ((p)[1] == 0 \ ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ : unicode_byte_type((p)[1], (p)[0])) #define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) #define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) #define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) #define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) #ifdef XML_MIN_SIZE static int PTRFASTCALL little2_byteType(const ENCODING *enc, const char *p) { return LITTLE2_BYTE_TYPE(enc, p); } static int PTRFASTCALL little2_byteToAscii(const ENCODING *enc, const char *p) { return LITTLE2_BYTE_TO_ASCII(enc, p); } static int PTRCALL little2_charMatches(const ENCODING *enc, const char *p, int c) { return LITTLE2_CHAR_MATCHES(enc, p, c); } static int PTRFASTCALL little2_isNameMin(const ENCODING *enc, const char *p) { return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); } static int PTRFASTCALL little2_isNmstrtMin(const ENCODING *enc, const char *p) { return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); } #undef VTABLE #define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 #else /* not XML_MIN_SIZE */ #undef PREFIX #define PREFIX(ident) little2_ ## ident #define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ #define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) #define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) #define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) #define IS_NAME_CHAR(enc, p, n) 0 #define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) #define XML_TOK_IMPL_C #include "xmltok_impl.c" #undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS static const struct normal_encoding little2_encoding_ns = { { VTABLE, 2, 0, #if BYTEORDER == 1234 1 #else 0 #endif }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif static const struct normal_encoding little2_encoding = { { VTABLE, 2, 0, #if BYTEORDER == 1234 1 #else 0 #endif }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #if BYTEORDER != 4321 #ifdef XML_NS static const struct normal_encoding internal_little2_encoding_ns = { { VTABLE, 2, 0, 1 }, { #include "iasciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif static const struct normal_encoding internal_little2_encoding = { { VTABLE, 2, 0, 1 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(little2_) }; #endif #define BIG2_BYTE_TYPE(enc, p) \ ((p)[0] == 0 \ ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ : unicode_byte_type((p)[0], (p)[1])) #define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) #define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) #define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) #define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) #ifdef XML_MIN_SIZE static int PTRFASTCALL big2_byteType(const ENCODING *enc, const char *p) { return BIG2_BYTE_TYPE(enc, p); } static int PTRFASTCALL big2_byteToAscii(const ENCODING *enc, const char *p) { return BIG2_BYTE_TO_ASCII(enc, p); } static int PTRCALL big2_charMatches(const ENCODING *enc, const char *p, int c) { return BIG2_CHAR_MATCHES(enc, p, c); } static int PTRFASTCALL big2_isNameMin(const ENCODING *enc, const char *p) { return BIG2_IS_NAME_CHAR_MINBPC(enc, p); } static int PTRFASTCALL big2_isNmstrtMin(const ENCODING *enc, const char *p) { return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); } #undef VTABLE #define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 #else /* not XML_MIN_SIZE */ #undef PREFIX #define PREFIX(ident) big2_ ## ident #define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ #define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) #define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) #define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) #define IS_NAME_CHAR(enc, p, n) 0 #define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) #define IS_NMSTRT_CHAR(enc, p, n) (0) #define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) #define XML_TOK_IMPL_C #include "xmltok_impl.c" #undef XML_TOK_IMPL_C #undef MINBPC #undef BYTE_TYPE #undef BYTE_TO_ASCII #undef CHAR_MATCHES #undef IS_NAME_CHAR #undef IS_NAME_CHAR_MINBPC #undef IS_NMSTRT_CHAR #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS static const struct normal_encoding big2_encoding_ns = { { VTABLE, 2, 0, #if BYTEORDER == 4321 1 #else 0 #endif }, { #include "asciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif static const struct normal_encoding big2_encoding = { { VTABLE, 2, 0, #if BYTEORDER == 4321 1 #else 0 #endif }, { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #if BYTEORDER != 1234 #ifdef XML_NS static const struct normal_encoding internal_big2_encoding_ns = { { VTABLE, 2, 0, 1 }, { #include "iasciitab.h" #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif static const struct normal_encoding internal_big2_encoding = { { VTABLE, 2, 0, 1 }, { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "latin1tab.h" }, STANDARD_VTABLE(big2_) }; #endif #undef PREFIX static int FASTCALL streqci(const char *s1, const char *s2) { for (;;) { char c1 = *s1++; char c2 = *s2++; if (ASCII_a <= c1 && c1 <= ASCII_z) c1 += ASCII_A - ASCII_a; if (ASCII_a <= c2 && c2 <= ASCII_z) c2 += ASCII_A - ASCII_a; if (c1 != c2) return 0; if (!c1) break; } return 1; } static void PTRCALL initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end, POSITION *pos) { normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); } static int toAscii(const ENCODING *enc, const char *ptr, const char *end) { char buf[1]; char *p = buf; XmlUtf8Convert(enc, &ptr, end, &p, p + 1); if (p == buf) return -1; else return buf[0]; } static int FASTCALL isSpace(int c) { switch (c) { case 0x20: case 0xD: case 0xA: case 0x9: return 1; } return 0; } /* Return 1 if there's just optional white space or there's an S followed by name=val. */ static int parsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end, const char **namePtr, const char **nameEndPtr, const char **valPtr, const char **nextTokPtr) { int c; char open; if (ptr == end) { *namePtr = NULL; return 1; } if (!isSpace(toAscii(enc, ptr, end))) { *nextTokPtr = ptr; return 0; } do { ptr += enc->minBytesPerChar; } while (isSpace(toAscii(enc, ptr, end))); if (ptr == end) { *namePtr = NULL; return 1; } *namePtr = ptr; for (;;) { c = toAscii(enc, ptr, end); if (c == -1) { *nextTokPtr = ptr; return 0; } if (c == ASCII_EQUALS) { *nameEndPtr = ptr; break; } if (isSpace(c)) { *nameEndPtr = ptr; do { ptr += enc->minBytesPerChar; } while (isSpace(c = toAscii(enc, ptr, end))); if (c != ASCII_EQUALS) { *nextTokPtr = ptr; return 0; } break; } ptr += enc->minBytesPerChar; } if (ptr == *namePtr) { *nextTokPtr = ptr; return 0; } ptr += enc->minBytesPerChar; c = toAscii(enc, ptr, end); while (isSpace(c)) { ptr += enc->minBytesPerChar; c = toAscii(enc, ptr, end); } if (c != ASCII_QUOT && c != ASCII_APOS) { *nextTokPtr = ptr; return 0; } open = (char)c; ptr += enc->minBytesPerChar; *valPtr = ptr; for (;; ptr += enc->minBytesPerChar) { c = toAscii(enc, ptr, end); if (c == open) break; if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z) && !(ASCII_0 <= c && c <= ASCII_9) && c != ASCII_PERIOD && c != ASCII_MINUS && c != ASCII_UNDERSCORE) { *nextTokPtr = ptr; return 0; } } *nextTokPtr = ptr + enc->minBytesPerChar; return 1; } static const char KW_version[] = { ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' }; static const char KW_encoding[] = { ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' }; static const char KW_standalone[] = { ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\0' }; static const char KW_yes[] = { ASCII_y, ASCII_e, ASCII_s, '\0' }; static const char KW_no[] = { ASCII_n, ASCII_o, '\0' }; static int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *, const char *), int isGeneralTextEntity, const ENCODING *enc, const char *ptr, const char *end, const char **badPtr, const char **versionPtr, const char **versionEndPtr, const char **encodingName, const ENCODING **encoding, int *standalone) { const char *val = NULL; const char *name = NULL; const char *nameEnd = NULL; ptr += 5 * enc->minBytesPerChar; end -= 2 * enc->minBytesPerChar; if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) || !name) { *badPtr = ptr; return 0; } if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { if (!isGeneralTextEntity) { *badPtr = name; return 0; } } else { if (versionPtr) *versionPtr = val; if (versionEndPtr) *versionEndPtr = ptr; if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } if (!name) { if (isGeneralTextEntity) { /* a TextDecl must have an EncodingDecl */ *badPtr = ptr; return 0; } return 1; } } if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { int c = toAscii(enc, val, end); if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { *badPtr = val; return 0; } if (encodingName) *encodingName = val; if (encoding) *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } if (!name) return 1; } if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) || isGeneralTextEntity) { *badPtr = name; return 0; } if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { if (standalone) *standalone = 1; } else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { if (standalone) *standalone = 0; } else { *badPtr = val; return 0; } while (isSpace(toAscii(enc, ptr, end))) ptr += enc->minBytesPerChar; if (ptr != end) { *badPtr = ptr; return 0; } return 1; } static int FASTCALL checkCharRefNumber(int result) { switch (result >> 8) { case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDD: case 0xDE: case 0xDF: return -1; case 0: if (latin1_encoding.type[result] == BT_NONXML) return -1; break; case 0xFF: if (result == 0xFFFE || result == 0xFFFF) return -1; break; } return result; } int FASTCALL XmlUtf8Encode(int c, char *buf) { enum { /* minN is minimum legal resulting value for N byte sequence */ min2 = 0x80, min3 = 0x800, min4 = 0x10000 }; if (c < 0) return 0; if (c < min2) { buf[0] = (char)(c | UTF8_cval1); return 1; } if (c < min3) { buf[0] = (char)((c >> 6) | UTF8_cval2); buf[1] = (char)((c & 0x3f) | 0x80); return 2; } if (c < min4) { buf[0] = (char)((c >> 12) | UTF8_cval3); buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); buf[2] = (char)((c & 0x3f) | 0x80); return 3; } if (c < 0x110000) { buf[0] = (char)((c >> 18) | UTF8_cval4); buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); buf[3] = (char)((c & 0x3f) | 0x80); return 4; } return 0; } int FASTCALL XmlUtf16Encode(int charNum, unsigned short *buf) { if (charNum < 0) return 0; if (charNum < 0x10000) { buf[0] = (unsigned short)charNum; return 1; } if (charNum < 0x110000) { charNum -= 0x10000; buf[0] = (unsigned short)((charNum >> 10) + 0xD800); buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); return 2; } return 0; } struct unknown_encoding { struct normal_encoding normal; CONVERTER convert; void *userData; unsigned short utf16[256]; char utf8[256][4]; }; #define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) int XmlSizeOfUnknownEncoding(void) { return sizeof(struct unknown_encoding); } static int PTRFASTCALL unknown_isName(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); if (c & ~0xFFFF) return 0; return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); } static int PTRFASTCALL unknown_isNmstrt(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); if (c & ~0xFFFF) return 0; return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); } static int PTRFASTCALL unknown_isInvalid(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; } static void PTRCALL unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, char **toP, const char *toLim) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); char buf[XML_UTF8_ENCODE_MAX]; for (;;) { const char *utf8; int n; if (*fromP == fromLim) break; utf8 = uenc->utf8[(unsigned char)**fromP]; n = *utf8++; if (n == 0) { int c = uenc->convert(uenc->userData, *fromP); n = XmlUtf8Encode(c, buf); if (n > toLim - *toP) break; utf8 = buf; *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2)); } else { if (n > toLim - *toP) break; (*fromP)++; } do { *(*toP)++ = *utf8++; } while (--n != 0); } } static void PTRCALL unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, unsigned short **toP, const unsigned short *toLim) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); while (*fromP != fromLim && *toP != toLim) { unsigned short c = uenc->utf16[(unsigned char)**fromP]; if (c == 0) { c = (unsigned short) uenc->convert(uenc->userData, *fromP); *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2)); } else (*fromP)++; *(*toP)++ = c; } } ENCODING * XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, void *userData) { int i; struct unknown_encoding *e = (struct unknown_encoding *)mem; for (i = 0; i < (int)sizeof(struct normal_encoding); i++) ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; for (i = 0; i < 128; i++) if (latin1_encoding.type[i] != BT_OTHER && latin1_encoding.type[i] != BT_NONXML && table[i] != i) return 0; for (i = 0; i < 256; i++) { int c = table[i]; if (c == -1) { e->normal.type[i] = BT_MALFORM; /* This shouldn't really get used. */ e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; } else if (c < 0) { if (c < -4) return 0; e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); e->utf8[i][0] = 0; e->utf16[i] = 0; } else if (c < 0x80) { if (latin1_encoding.type[c] != BT_OTHER && latin1_encoding.type[c] != BT_NONXML && c != i) return 0; e->normal.type[i] = latin1_encoding.type[c]; e->utf8[i][0] = 1; e->utf8[i][1] = (char)c; e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); } else if (checkCharRefNumber(c) < 0) { e->normal.type[i] = BT_NONXML; /* This shouldn't really get used. */ e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; } else { if (c > 0xFFFF) return 0; if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) e->normal.type[i] = BT_NMSTRT; else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) e->normal.type[i] = BT_NAME; else e->normal.type[i] = BT_OTHER; e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); e->utf16[i] = (unsigned short)c; } } e->userData = userData; e->convert = convert; if (convert) { e->normal.isName2 = unknown_isName; e->normal.isName3 = unknown_isName; e->normal.isName4 = unknown_isName; e->normal.isNmstrt2 = unknown_isNmstrt; e->normal.isNmstrt3 = unknown_isNmstrt; e->normal.isNmstrt4 = unknown_isNmstrt; e->normal.isInvalid2 = unknown_isInvalid; e->normal.isInvalid3 = unknown_isInvalid; e->normal.isInvalid4 = unknown_isInvalid; } e->normal.enc.utf8Convert = unknown_toUtf8; e->normal.enc.utf16Convert = unknown_toUtf16; return &(e->normal.enc); } /* If this enumeration is changed, getEncodingIndex and encodings must also be changed. */ enum { UNKNOWN_ENC = -1, ISO_8859_1_ENC = 0, US_ASCII_ENC, UTF_8_ENC, UTF_16_ENC, UTF_16BE_ENC, UTF_16LE_ENC, /* must match encodingNames up to here */ NO_ENC }; static const char KW_ISO_8859_1[] = { ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1, '\0' }; static const char KW_US_ASCII[] = { ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, '\0' }; static const char KW_UTF_8[] = { ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' }; static const char KW_UTF_16[] = { ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' }; static const char KW_UTF_16BE[] = { ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, '\0' }; static const char KW_UTF_16LE[] = { ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, '\0' }; static int FASTCALL getEncodingIndex(const char *name) { static const char * const encodingNames[] = { KW_ISO_8859_1, KW_US_ASCII, KW_UTF_8, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE, }; int i; if (name == NULL) return NO_ENC; for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) if (streqci(name, encodingNames[i])) return i; return UNKNOWN_ENC; } /* For binary compatibility, we store the index of the encoding specified at initialization in the isUtf16 member. */ #define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) #define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) /* This is what detects the encoding. encodingTable maps from encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding; state is XML_CONTENT_STATE if we're parsing an external text entity, and XML_PROLOG_STATE otherwise. */ static int initScan(const ENCODING * const *encodingTable, const INIT_ENCODING *enc, int state, const char *ptr, const char *end, const char **nextTokPtr) { const ENCODING **encPtr; if (ptr == end) return XML_TOK_NONE; encPtr = enc->encPtr; if (ptr + 1 == end) { /* only a single byte available for auto-detection */ #ifndef XML_DTD /* FIXME */ /* a well-formed document entity must have more than one byte */ if (state != XML_CONTENT_STATE) return XML_TOK_PARTIAL; #endif /* so we're parsing an external text entity... */ /* if UTF-16 was externally specified, then we need at least 2 bytes */ switch (INIT_ENC_INDEX(enc)) { case UTF_16_ENC: case UTF_16LE_ENC: case UTF_16BE_ENC: return XML_TOK_PARTIAL; } switch ((unsigned char)*ptr) { case 0xFE: case 0xFF: case 0xEF: /* possibly first byte of UTF-8 BOM */ if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; /* fall through */ case 0x00: case 0x3C: return XML_TOK_PARTIAL; } } else { switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { case 0xFEFF: if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16BE_ENC]; return XML_TOK_BOM; /* 00 3C is handled in the default case */ case 0x3C00: if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC || INIT_ENC_INDEX(enc) == UTF_16_ENC) && state == XML_CONTENT_STATE) break; *encPtr = encodingTable[UTF_16LE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); case 0xFFFE: if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16LE_ENC]; return XML_TOK_BOM; case 0xEFBB: /* Maybe a UTF-8 BOM (EF BB BF) */ /* If there's an explicitly specified (external) encoding of ISO-8859-1 or some flavour of UTF-16 and this is an external text entity, don't look for the BOM, because it might be a legal data. */ if (state == XML_CONTENT_STATE) { int e = INIT_ENC_INDEX(enc); if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC || e == UTF_16_ENC) break; } if (ptr + 2 == end) return XML_TOK_PARTIAL; if ((unsigned char)ptr[2] == 0xBF) { *nextTokPtr = ptr + 3; *encPtr = encodingTable[UTF_8_ENC]; return XML_TOK_BOM; } break; default: if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) break; *encPtr = encodingTable[UTF_16BE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } else if (ptr[1] == '\0') { /* We could recover here in the case: - parsing an external entity - second byte is 0 - no externally specified encoding - no encoding declaration by assuming UTF-16LE. But we don't, because this would mean when presented just with a single byte, we couldn't reliably determine whether we needed further bytes. */ if (state == XML_CONTENT_STATE) break; *encPtr = encodingTable[UTF_16LE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } break; } } *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } #define NS(x) x #define ns(x) x #define XML_TOK_NS_C #include "xmltok_ns.c" #undef XML_TOK_NS_C #undef NS #undef ns #ifdef XML_NS #define NS(x) x ## NS #define ns(x) x ## _ns #define XML_TOK_NS_C #include "xmltok_ns.c" #undef XML_TOK_NS_C #undef NS #undef ns ENCODING * XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, void *userData) { ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); if (enc) ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; return enc; } #endif /* XML_NS */ astropy-0.3/cextern/expat/lib/libexpatw.def0000755000175000017500000000375412243255342017231 0ustar oleole; DEF file for MS VC++ LIBRARY EXPORTS XML_DefaultCurrent @1 XML_ErrorString @2 XML_ExpatVersion @3 XML_ExpatVersionInfo @4 XML_ExternalEntityParserCreate @5 XML_GetBase @6 XML_GetBuffer @7 XML_GetCurrentByteCount @8 XML_GetCurrentByteIndex @9 XML_GetCurrentColumnNumber @10 XML_GetCurrentLineNumber @11 XML_GetErrorCode @12 XML_GetIdAttributeIndex @13 XML_GetInputContext @14 XML_GetSpecifiedAttributeCount @15 XML_Parse @16 XML_ParseBuffer @17 XML_ParserCreate @18 XML_ParserCreateNS @19 XML_ParserCreate_MM @20 XML_ParserFree @21 XML_SetAttlistDeclHandler @22 XML_SetBase @23 XML_SetCdataSectionHandler @24 XML_SetCharacterDataHandler @25 XML_SetCommentHandler @26 XML_SetDefaultHandler @27 XML_SetDefaultHandlerExpand @28 XML_SetDoctypeDeclHandler @29 XML_SetElementDeclHandler @30 XML_SetElementHandler @31 XML_SetEncoding @32 XML_SetEndCdataSectionHandler @33 XML_SetEndDoctypeDeclHandler @34 XML_SetEndElementHandler @35 XML_SetEndNamespaceDeclHandler @36 XML_SetEntityDeclHandler @37 XML_SetExternalEntityRefHandler @38 XML_SetExternalEntityRefHandlerArg @39 XML_SetNamespaceDeclHandler @40 XML_SetNotStandaloneHandler @41 XML_SetNotationDeclHandler @42 XML_SetParamEntityParsing @43 XML_SetProcessingInstructionHandler @44 XML_SetReturnNSTriplet @45 XML_SetStartCdataSectionHandler @46 XML_SetStartDoctypeDeclHandler @47 XML_SetStartElementHandler @48 XML_SetStartNamespaceDeclHandler @49 XML_SetUnknownEncodingHandler @50 XML_SetUnparsedEntityDeclHandler @51 XML_SetUserData @52 XML_SetXmlDeclHandler @53 XML_UseParserAsHandlerArg @54 ; added with version 1.95.3 XML_ParserReset @55 XML_SetSkippedEntityHandler @56 ; added with version 1.95.5 XML_GetFeatureList @57 XML_UseForeignDTD @58 ; added with version 1.95.6 XML_FreeContentModel @59 XML_MemMalloc @60 XML_MemRealloc @61 XML_MemFree @62 ; added with version 1.95.8 XML_StopParser @63 XML_ResumeParser @64 XML_GetParsingStatus @65 astropy-0.3/cextern/expat/lib/expat.dsp0000755000175000017500000001144512243255342016377 0ustar oleole# Microsoft Developer Studio Project File - Name="expat" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=expat - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "expat.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "expat.mak" CFG="expat - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "expat - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "expat - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "expat - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILED_FROM_DSP" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /machine:I386 # ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpat.dll" !ELSEIF "$(CFG)" == "expat - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpat.dll" !ENDIF # Begin Target # Name "expat - Win32 Release" # Name "expat - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\libexpat.def # End Source File # Begin Source File SOURCE=.\xmlparse.c !IF "$(CFG)" == "expat - Win32 Release" !ELSEIF "$(CFG)" == "expat - Win32 Debug" # ADD CPP /GX- /Od !ENDIF # End Source File # Begin Source File SOURCE=.\xmlrole.c # End Source File # Begin Source File SOURCE=.\xmltok.c # End Source File # Begin Source File SOURCE=.\xmltok_impl.c # End Source File # Begin Source File SOURCE=.\xmltok_ns.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\ascii.h # End Source File # Begin Source File SOURCE=.\asciitab.h # End Source File # Begin Source File SOURCE=.\expat.h # End Source File # Begin Source File SOURCE=.\expat_external.h # End Source File # Begin Source File SOURCE=.\iasciitab.h # End Source File # Begin Source File SOURCE=.\internal.h # End Source File # Begin Source File SOURCE=.\latin1tab.h # End Source File # Begin Source File SOURCE=.\nametab.h # End Source File # Begin Source File SOURCE=.\utf8tab.h # End Source File # Begin Source File SOURCE=.\xmlrole.h # End Source File # Begin Source File SOURCE=.\xmltok.h # End Source File # Begin Source File SOURCE=.\xmltok_impl.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project astropy-0.3/cextern/expat/lib/libexpat.def0000755000175000017500000000375412243255342017042 0ustar oleole; DEF file for MS VC++ LIBRARY EXPORTS XML_DefaultCurrent @1 XML_ErrorString @2 XML_ExpatVersion @3 XML_ExpatVersionInfo @4 XML_ExternalEntityParserCreate @5 XML_GetBase @6 XML_GetBuffer @7 XML_GetCurrentByteCount @8 XML_GetCurrentByteIndex @9 XML_GetCurrentColumnNumber @10 XML_GetCurrentLineNumber @11 XML_GetErrorCode @12 XML_GetIdAttributeIndex @13 XML_GetInputContext @14 XML_GetSpecifiedAttributeCount @15 XML_Parse @16 XML_ParseBuffer @17 XML_ParserCreate @18 XML_ParserCreateNS @19 XML_ParserCreate_MM @20 XML_ParserFree @21 XML_SetAttlistDeclHandler @22 XML_SetBase @23 XML_SetCdataSectionHandler @24 XML_SetCharacterDataHandler @25 XML_SetCommentHandler @26 XML_SetDefaultHandler @27 XML_SetDefaultHandlerExpand @28 XML_SetDoctypeDeclHandler @29 XML_SetElementDeclHandler @30 XML_SetElementHandler @31 XML_SetEncoding @32 XML_SetEndCdataSectionHandler @33 XML_SetEndDoctypeDeclHandler @34 XML_SetEndElementHandler @35 XML_SetEndNamespaceDeclHandler @36 XML_SetEntityDeclHandler @37 XML_SetExternalEntityRefHandler @38 XML_SetExternalEntityRefHandlerArg @39 XML_SetNamespaceDeclHandler @40 XML_SetNotStandaloneHandler @41 XML_SetNotationDeclHandler @42 XML_SetParamEntityParsing @43 XML_SetProcessingInstructionHandler @44 XML_SetReturnNSTriplet @45 XML_SetStartCdataSectionHandler @46 XML_SetStartDoctypeDeclHandler @47 XML_SetStartElementHandler @48 XML_SetStartNamespaceDeclHandler @49 XML_SetUnknownEncodingHandler @50 XML_SetUnparsedEntityDeclHandler @51 XML_SetUserData @52 XML_SetXmlDeclHandler @53 XML_UseParserAsHandlerArg @54 ; added with version 1.95.3 XML_ParserReset @55 XML_SetSkippedEntityHandler @56 ; added with version 1.95.5 XML_GetFeatureList @57 XML_UseForeignDTD @58 ; added with version 1.95.6 XML_FreeContentModel @59 XML_MemMalloc @60 XML_MemRealloc @61 XML_MemFree @62 ; added with version 1.95.8 XML_StopParser @63 XML_ResumeParser @64 XML_GetParsingStatus @65 astropy-0.3/cextern/expat/lib/expat_external.h0000755000175000017500000000644412243255342017745 0ustar oleole/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #ifndef Expat_External_INCLUDED #define Expat_External_INCLUDED 1 /* External API definitions */ #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) #define XML_USE_MSC_EXTENSIONS 1 #endif /* Expat tries very hard to make the API boundary very specifically defined. There are two macros defined to control this boundary; each of these can be defined before including this header to achieve some different behavior, but doing so it not recommended or tested frequently. XMLCALL - The calling convention to use for all calls across the "library boundary." This will default to cdecl, and try really hard to tell the compiler that's what we want. XMLIMPORT - Whatever magic is needed to note that a function is to be imported from a dynamically loaded library (.dll, .so, or .sl, depending on your platform). The XMLCALL macro was added in Expat 1.95.7. The only one which is expected to be directly useful in client code is XMLCALL. Note that on at least some Unix versions, the Expat library must be compiled with the cdecl calling convention as the default since system headers may assume the cdecl convention. */ #ifndef XMLCALL #if defined(_MSC_VER) #define XMLCALL __cdecl #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) #define XMLCALL __attribute__((cdecl)) #else /* For any platform which uses this definition and supports more than one calling convention, we need to extend this definition to declare the convention used on that platform, if it's possible to do so. If this is the case for your platform, please file a bug report with information on how to identify your platform via the C pre-processor and how to specify the same calling convention as the platform's malloc() implementation. */ #define XMLCALL #endif #endif /* not defined XMLCALL */ #if !defined(XML_STATIC) && !defined(XMLIMPORT) #ifndef XML_BUILDING_EXPAT /* using Expat from an application */ #ifdef XML_USE_MSC_EXTENSIONS #define XMLIMPORT __declspec(dllimport) #endif #endif #endif /* not defined XML_STATIC */ /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT #define XMLIMPORT #endif #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL #ifdef __cplusplus extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T #define XML_UNICODE #endif #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ #ifdef XML_UNICODE_WCHAR_T typedef wchar_t XML_Char; typedef wchar_t XML_LChar; #else typedef unsigned short XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE_WCHAR_T */ #else /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; #endif /* XML_UNICODE */ #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 typedef __int64 XML_Index; typedef unsigned __int64 XML_Size; #else typedef long long XML_Index; typedef unsigned long long XML_Size; #endif #else typedef long XML_Index; typedef unsigned long XML_Size; #endif /* XML_LARGE_SIZE */ #ifdef __cplusplus } #endif #endif /* not Expat_External_INCLUDED */ astropy-0.3/cextern/expat/lib/winconfig.h0000755000175000017500000000130512243255342016674 0ustar oleole/*================================================================ ** Copyright 2000, Clark Cooper ** All rights reserved. ** ** This is free software. You are permitted to copy, distribute, or modify ** it under the terms of the MIT/X license (contained in the COPYING file ** with this distribution.) */ #ifndef WINCONFIG_H #define WINCONFIG_H #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN #include #include #define XML_NS 1 #define XML_DTD 1 #define XML_CONTEXT_BYTES 1024 /* we will assume all Windows platforms are little endian */ #define BYTEORDER 1234 /* Windows has memmove() available. */ #define HAVE_MEMMOVE #endif /* ndef WINCONFIG_H */ astropy-0.3/cextern/expat/lib/nametab.h0000755000175000017500000001561212243255342016326 0ustar oleolestatic const unsigned namingBitmap[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, }; static const unsigned char nmstrtPages[] = { 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; static const unsigned char namePages[] = { 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; astropy-0.3/cextern/expat/lib/asciitab.h0000755000175000017500000000334012243255342016471 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, astropy-0.3/cextern/expat/lib/latin1tab.h0000755000175000017500000000342512243255342016575 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, astropy-0.3/cextern/expat/lib/expat_static.dsp0000755000175000017500000001023612243255342017743 0ustar oleole# Microsoft Developer Studio Project File - Name="expat_static" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=expat_static - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "expat_static.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "expat_static.mak" CFG="expat_static - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "expat_static - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "expat_static - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "expat_static - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "expat_static___Win32_Release" # PROP BASE Intermediate_Dir "expat_static___Win32_Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release_static" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x1009 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatMT.lib" !ELSEIF "$(CFG)" == "expat_static - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "expat_static___Win32_Debug" # PROP BASE Intermediate_Dir "expat_static___Win32_Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug_static" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "COMPILED_FROM_DSP" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x1009 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatMT.lib" !ENDIF # Begin Target # Name "expat_static - Win32 Release" # Name "expat_static - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\xmlparse.c # End Source File # Begin Source File SOURCE=.\xmlrole.c # End Source File # Begin Source File SOURCE=.\xmltok.c # End Source File # Begin Source File SOURCE=.\xmltok_impl.c # End Source File # Begin Source File SOURCE=.\xmltok_ns.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\ascii.h # End Source File # Begin Source File SOURCE=.\asciitab.h # End Source File # Begin Source File SOURCE=.\expat.h # End Source File # Begin Source File SOURCE=.\expat_external.h # End Source File # Begin Source File SOURCE=.\iasciitab.h # End Source File # Begin Source File SOURCE=.\internal.h # End Source File # Begin Source File SOURCE=.\latin1tab.h # End Source File # Begin Source File SOURCE=.\nametab.h # End Source File # Begin Source File SOURCE=.\utf8tab.h # End Source File # Begin Source File SOURCE=.\xmlrole.h # End Source File # Begin Source File SOURCE=.\xmltok.h # End Source File # Begin Source File SOURCE=.\xmltok_impl.h # End Source File # End Group # End Target # End Project astropy-0.3/cextern/expat/lib/xmltok_impl.c0000755000175000017500000012701212243255342017247 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ /* This file is included! */ #ifdef XML_TOK_IMPL_C #ifndef IS_INVALID_CHAR #define IS_INVALID_CHAR(enc, ptr, n) (0) #endif #define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (IS_INVALID_CHAR(enc, ptr, n)) { \ *(nextTokPtr) = (ptr); \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define INVALID_CASES(ptr, nextTokPtr) \ INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ case BT_NONXML: \ case BT_MALFORM: \ case BT_TRAIL: \ *(nextTokPtr) = (ptr); \ return XML_TOK_INVALID; #define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (!IS_NAME_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ case BT_NONASCII: \ if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ case BT_NMSTRT: \ case BT_HEX: \ case BT_DIGIT: \ case BT_NAME: \ case BT_MINUS: \ ptr += MINBPC(enc); \ break; \ CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) #define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ ptr += n; \ break; #define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ case BT_NONASCII: \ if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ case BT_NMSTRT: \ case BT_HEX: \ ptr += MINBPC(enc); \ break; \ CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) #ifndef PREFIX #define PREFIX(ident) ident #endif /* ptr points to character following " */ switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_INVALID; } /* fall through */ case BT_S: case BT_CR: case BT_LF: *nextTokPtr = ptr; return XML_TOK_DECL_OPEN; case BT_NMSTRT: case BT_HEX: ptr += MINBPC(enc); break; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PTRCALL PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr) { int upper = 0; *tokPtr = XML_TOK_PI; if (end - ptr != MINBPC(enc)*3) return 1; switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_x: break; case ASCII_X: upper = 1; break; default: return 1; } ptr += MINBPC(enc); switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_m: break; case ASCII_M: upper = 1; break; default: return 1; } ptr += MINBPC(enc); switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_l: break; case ASCII_L: upper = 1; break; default: return 1; } if (upper) return 0; *tokPtr = XML_TOK_XML_DECL; return 1; } /* ptr points to character following " 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); break; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CDATA_SECT_CLOSE; case BT_CR: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; case BT_LF: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_DATA_CHARS; \ } \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONXML: case BT_MALFORM: case BT_TRAIL: case BT_CR: case BT_LF: case BT_RSQB: *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } /* ptr points to character following " 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_LT: return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_AMP: return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_CR: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; case BT_LF: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_RSQB; if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); break; } *nextTokPtr = ptr; return XML_TOK_INVALID; INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ *nextTokPtr = ptr; \ return XML_TOK_DATA_CHARS; \ } \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_RSQB: if (ptr + MINBPC(enc) != end) { if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { ptr += MINBPC(enc); break; } if (ptr + 2*MINBPC(enc) != end) { if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { ptr += MINBPC(enc); break; } *nextTokPtr = ptr + 2*MINBPC(enc); return XML_TOK_INVALID; } } /* fall through */ case BT_AMP: case BT_LT: case BT_NONXML: case BT_MALFORM: case BT_TRAIL: case BT_CR: case BT_LF: *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } /* ptr points to character following "%" */ static int PTRCALL PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_PERCENT; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_SEMI: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_PARAM_ENTITY_REF; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return XML_TOK_PARTIAL; } static int PTRCALL PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_CR: case BT_LF: case BT_S: case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: *nextTokPtr = ptr; return XML_TOK_POUND_NAME; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return -XML_TOK_POUND_NAME; } static int PTRCALL PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { while (ptr != end) { int t = BYTE_TYPE(enc, ptr); switch (t) { INVALID_CASES(ptr, nextTokPtr) case BT_QUOT: case BT_APOS: ptr += MINBPC(enc); if (t != open) break; if (ptr == end) return -XML_TOK_LITERAL; *nextTokPtr = ptr; switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_CR: case BT_LF: case BT_GT: case BT_PERCNT: case BT_LSQB: return XML_TOK_LITERAL; default: return XML_TOK_INVALID; } default: ptr += MINBPC(enc); break; } } return XML_TOK_PARTIAL; } static int PTRCALL PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int tok; if (ptr == end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); if (n == 0) return XML_TOK_PARTIAL; end = ptr + n; } } switch (BYTE_TYPE(enc, ptr)) { case BT_QUOT: return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_APOS: return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_LT: { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_PARTIAL; switch (BYTE_TYPE(enc, ptr)) { case BT_EXCL: return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_QUEST: return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_NMSTRT: case BT_HEX: case BT_NONASCII: case BT_LEAD2: case BT_LEAD3: case BT_LEAD4: *nextTokPtr = ptr - MINBPC(enc); return XML_TOK_INSTANCE_START; } *nextTokPtr = ptr; return XML_TOK_INVALID; } case BT_CR: if (ptr + MINBPC(enc) == end) { *nextTokPtr = end; /* indicate that this might be part of a CR/LF pair */ return -XML_TOK_PROLOG_S; } /* fall through */ case BT_S: case BT_LF: for (;;) { ptr += MINBPC(enc); if (ptr == end) break; switch (BYTE_TYPE(enc, ptr)) { case BT_S: case BT_LF: break; case BT_CR: /* don't split CR/LF pair */ if (ptr + MINBPC(enc) != end) break; /* fall through */ default: *nextTokPtr = ptr; return XML_TOK_PROLOG_S; } } *nextTokPtr = ptr; return XML_TOK_PROLOG_S; case BT_PERCNT: return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_COMMA: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_COMMA; case BT_LSQB: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OPEN_BRACKET; case BT_RSQB: ptr += MINBPC(enc); if (ptr == end) return -XML_TOK_CLOSE_BRACKET; if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { if (ptr + MINBPC(enc) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { *nextTokPtr = ptr + 2*MINBPC(enc); return XML_TOK_COND_SECT_CLOSE; } } *nextTokPtr = ptr; return XML_TOK_CLOSE_BRACKET; case BT_LPAR: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OPEN_PAREN; case BT_RPAR: ptr += MINBPC(enc); if (ptr == end) return -XML_TOK_CLOSE_PAREN; switch (BYTE_TYPE(enc, ptr)) { case BT_AST: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_ASTERISK; case BT_QUEST: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_QUESTION; case BT_PLUS: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_PLUS; case BT_CR: case BT_LF: case BT_S: case BT_GT: case BT_COMMA: case BT_VERBAR: case BT_RPAR: *nextTokPtr = ptr; return XML_TOK_CLOSE_PAREN; } *nextTokPtr = ptr; return XML_TOK_INVALID; case BT_VERBAR: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_OR; case BT_GT: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DECL_CLOSE; case BT_NUM: return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (end - ptr < n) \ return XML_TOK_PARTIAL_CHAR; \ if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ ptr += n; \ tok = XML_TOK_NAME; \ break; \ } \ if (IS_NAME_CHAR(enc, ptr, n)) { \ ptr += n; \ tok = XML_TOK_NMTOKEN; \ break; \ } \ *nextTokPtr = ptr; \ return XML_TOK_INVALID; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NMSTRT: case BT_HEX: tok = XML_TOK_NAME; ptr += MINBPC(enc); break; case BT_DIGIT: case BT_NAME: case BT_MINUS: #ifdef XML_NS case BT_COLON: #endif tok = XML_TOK_NMTOKEN; ptr += MINBPC(enc); break; case BT_NONASCII: if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { ptr += MINBPC(enc); tok = XML_TOK_NAME; break; } if (IS_NAME_CHAR_MINBPC(enc, ptr)) { ptr += MINBPC(enc); tok = XML_TOK_NMTOKEN; break; } /* fall through */ default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_GT: case BT_RPAR: case BT_COMMA: case BT_VERBAR: case BT_LSQB: case BT_PERCNT: case BT_S: case BT_CR: case BT_LF: *nextTokPtr = ptr; return tok; #ifdef XML_NS case BT_COLON: ptr += MINBPC(enc); switch (tok) { case XML_TOK_NAME: if (ptr == end) return XML_TOK_PARTIAL; tok = XML_TOK_PREFIXED_NAME; switch (BYTE_TYPE(enc, ptr)) { CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) default: tok = XML_TOK_NMTOKEN; break; } break; case XML_TOK_PREFIXED_NAME: tok = XML_TOK_NMTOKEN; break; } break; #endif case BT_PLUS: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_PLUS; case BT_AST: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_ASTERISK; case BT_QUEST: if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_QUESTION; default: *nextTokPtr = ptr; return XML_TOK_INVALID; } } return -tok; } static int PTRCALL PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; if (ptr == end) return XML_TOK_NONE; start = ptr; while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_LT: /* this is for inside entity references */ *nextTokPtr = ptr; return XML_TOK_INVALID; case BT_LF: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_CR: if (ptr == start) { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_S: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_ATTRIBUTE_VALUE_S; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } static int PTRCALL PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { const char *start; if (ptr == end) return XML_TOK_NONE; start = ptr; while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_PERCNT: if (ptr == start) { int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_LF: if (ptr == start) { *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; case BT_CR: if (ptr == start) { ptr += MINBPC(enc); if (ptr == end) return XML_TOK_TRAILING_CR; if (BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); *nextTokPtr = ptr; return XML_TOK_DATA_NEWLINE; } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; default: ptr += MINBPC(enc); break; } } *nextTokPtr = ptr; return XML_TOK_DATA_CHARS; } #ifdef XML_DTD static int PTRCALL PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end, const char **nextTokPtr) { int level = 0; if (MINBPC(enc) > 1) { size_t n = end - ptr; if (n & (MINBPC(enc) - 1)) { n &= ~(MINBPC(enc) - 1); end = ptr + n; } } while (ptr != end) { switch (BYTE_TYPE(enc, ptr)) { INVALID_CASES(ptr, nextTokPtr) case BT_LT: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { ++level; ptr += MINBPC(enc); } } break; case BT_RSQB: if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { if ((ptr += MINBPC(enc)) == end) return XML_TOK_PARTIAL; if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr += MINBPC(enc); if (level == 0) { *nextTokPtr = ptr; return XML_TOK_IGNORE_SECT; } --level; } } break; default: ptr += MINBPC(enc); break; } } return XML_TOK_PARTIAL; } #endif /* XML_DTD */ static int PTRCALL PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, const char **badPtr) { ptr += MINBPC(enc); end -= MINBPC(enc); for (; ptr != end; ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { case BT_DIGIT: case BT_HEX: case BT_MINUS: case BT_APOS: case BT_LPAR: case BT_RPAR: case BT_PLUS: case BT_COMMA: case BT_SOL: case BT_EQUALS: case BT_QUEST: case BT_CR: case BT_LF: case BT_SEMI: case BT_EXCL: case BT_AST: case BT_PERCNT: case BT_NUM: #ifdef XML_NS case BT_COLON: #endif break; case BT_S: if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { *badPtr = ptr; return 0; } break; case BT_NAME: case BT_NMSTRT: if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) break; default: switch (BYTE_TO_ASCII(enc, ptr)) { case 0x24: /* $ */ case 0x40: /* @ */ break; default: *badPtr = ptr; return 0; } break; } } return 1; } /* This must only be called for a well-formed start-tag or empty element tag. Returns the number of attributes. Pointers to the first attsMax attributes are stored in atts. */ static int PTRCALL PREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax, ATTRIBUTE *atts) { enum { other, inName, inValue } state = inName; int nAtts = 0; int open = 0; /* defined when state == inValue; initialization just to shut up compilers */ for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { #define START_NAME \ if (state == other) { \ if (nAtts < attsMax) { \ atts[nAtts].name = ptr; \ atts[nAtts].normalized = 1; \ } \ state = inName; \ } #define LEAD_CASE(n) \ case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: case BT_HEX: START_NAME break; #undef START_NAME case BT_QUOT: if (state != inValue) { if (nAtts < attsMax) atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_QUOT; } else if (open == BT_QUOT) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; nAtts++; } break; case BT_APOS: if (state != inValue) { if (nAtts < attsMax) atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_APOS; } else if (open == BT_APOS) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; nAtts++; } break; case BT_AMP: if (nAtts < attsMax) atts[nAtts].normalized = 0; break; case BT_S: if (state == inName) state = other; else if (state == inValue && nAtts < attsMax && atts[nAtts].normalized && (ptr == atts[nAtts].valuePtr || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) atts[nAtts].normalized = 0; break; case BT_CR: case BT_LF: /* This case ensures that the first attribute name is counted Apart from that we could just change state on the quote. */ if (state == inName) state = other; else if (state == inValue && nAtts < attsMax) atts[nAtts].normalized = 0; break; case BT_GT: case BT_SOL: if (state != inValue) return nAtts; break; default: break; } } /* not reached */ } static int PTRFASTCALL PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) { int result = 0; /* skip &# */ ptr += 2*MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_x)) { for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); switch (c) { case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: result <<= 4; result |= (c - ASCII_0); break; case ASCII_A: case ASCII_B: case ASCII_C: case ASCII_D: case ASCII_E: case ASCII_F: result <<= 4; result += 10 + (c - ASCII_A); break; case ASCII_a: case ASCII_b: case ASCII_c: case ASCII_d: case ASCII_e: case ASCII_f: result <<= 4; result += 10 + (c - ASCII_a); break; } if (result >= 0x110000) return -1; } } else { for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); result *= 10; result += (c - ASCII_0); if (result >= 0x110000) return -1; } } return checkCharRefNumber(result); } static int PTRCALL PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end) { switch ((end - ptr)/MINBPC(enc)) { case 2: if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_l: return ASCII_LT; case ASCII_g: return ASCII_GT; } } break; case 3: if (CHAR_MATCHES(enc, ptr, ASCII_a)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_m)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_p)) return ASCII_AMP; } } break; case 4: switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_q: ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_u)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_o)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_t)) return ASCII_QUOT; } } break; case ASCII_a: ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_p)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_o)) { ptr += MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_s)) return ASCII_APOS; } } break; } } return 0; } static int PTRCALL PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) { for (;;) { switch (BYTE_TYPE(enc, ptr1)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ if (*ptr1++ != *ptr2++) \ return 0; LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) #undef LEAD_CASE /* fall through */ if (*ptr1++ != *ptr2++) return 0; break; case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 1) { if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 2) { if (*ptr2++ != *ptr1++) return 0; if (MINBPC(enc) > 3) { if (*ptr2++ != *ptr1++) return 0; } } } break; default: if (MINBPC(enc) == 1 && *ptr1 == *ptr2) return 1; switch (BYTE_TYPE(enc, ptr2)) { case BT_LEAD2: case BT_LEAD3: case BT_LEAD4: case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: return 0; default: return 1; } } } /* not reached */ } static int PTRCALL PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, const char *end1, const char *ptr2) { for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { if (ptr1 == end1) return 0; if (!CHAR_MATCHES(enc, ptr1, *ptr2)) return 0; } return ptr1 == end1; } static int PTRFASTCALL PREFIX(nameLength)(const ENCODING *enc, const char *ptr) { const char *start = ptr; for (;;) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: ptr += n; break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: #ifdef XML_NS case BT_COLON: #endif case BT_HEX: case BT_DIGIT: case BT_NAME: case BT_MINUS: ptr += MINBPC(enc); break; default: return (int)(ptr - start); } } } static const char * PTRFASTCALL PREFIX(skipS)(const ENCODING *enc, const char *ptr) { for (;;) { switch (BYTE_TYPE(enc, ptr)) { case BT_LF: case BT_CR: case BT_S: ptr += MINBPC(enc); break; default: return ptr; } } } static void PTRCALL PREFIX(updatePosition)(const ENCODING *enc, const char *ptr, const char *end, POSITION *pos) { while (ptr < end) { switch (BYTE_TYPE(enc, ptr)) { #define LEAD_CASE(n) \ case BT_LEAD ## n: \ ptr += n; \ break; LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) #undef LEAD_CASE case BT_LF: pos->columnNumber = (XML_Size)-1; pos->lineNumber++; ptr += MINBPC(enc); break; case BT_CR: pos->lineNumber++; ptr += MINBPC(enc); if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); pos->columnNumber = (XML_Size)-1; break; default: ptr += MINBPC(enc); break; } pos->columnNumber++; } } #undef DO_LEAD_CASE #undef MULTIBYTE_CASES #undef INVALID_CASES #undef CHECK_NAME_CASE #undef CHECK_NAME_CASES #undef CHECK_NMSTRT_CASE #undef CHECK_NMSTRT_CASES #endif /* XML_TOK_IMPL_C */ astropy-0.3/cextern/expat/lib/amigaconfig.h0000755000175000017500000000143512243255342017161 0ustar oleole#ifndef AMIGACONFIG_H #define AMIGACONFIG_H /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #define BYTEORDER 4321 /* Define to 1 if you have the `bcopy' function. */ #define HAVE_BCOPY 1 /* Define to 1 if you have the header file. */ #undef HAVE_CHECK_H /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 /* whether byteorder is bigendian */ #define WORDS_BIGENDIAN /* Define to specify how much context to retain around the current parse point. */ #define XML_CONTEXT_BYTES 1024 /* Define to make parameter entity parsing functionality available. */ #define XML_DTD /* Define to make XML Namespaces functionality available. */ #define XML_NS #endif /* AMIGACONFIG_H */ astropy-0.3/cextern/expat/lib/xmltok_impl.h0000755000175000017500000000122512243255342017251 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ enum { BT_NONXML, BT_MALFORM, BT_LT, BT_AMP, BT_RSQB, BT_LEAD2, BT_LEAD3, BT_LEAD4, BT_TRAIL, BT_CR, BT_LF, BT_GT, BT_QUOT, BT_APOS, BT_EQUALS, BT_QUEST, BT_EXCL, BT_SOL, BT_SEMI, BT_NUM, BT_LSQB, BT_S, BT_NMSTRT, BT_COLON, BT_HEX, BT_DIGIT, BT_NAME, BT_MINUS, BT_OTHER, /* known not to be a name or name start character */ BT_NONASCII, /* might be a name or name start character */ BT_PERCNT, BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, BT_COMMA, BT_VERBAR }; #include astropy-0.3/cextern/expat/tests/0000755000175000017500000000000012243263747015142 5ustar oleoleastropy-0.3/cextern/expat/tests/chardata.c0000755000175000017500000000573612243255342017063 0ustar oleole/* Copyright (c) 1998-2003 Thai Open Source Software Center Ltd See the file COPYING for copying permission. chardata.c */ #ifdef HAVE_EXPAT_CONFIG_H #include #endif #ifdef HAVE_CHECK_H #include #else #include "minicheck.h" #endif #include #include #include #include "chardata.h" static int xmlstrlen(const XML_Char *s) { int len = 0; assert(s != NULL); while (s[len] != 0) ++len; return len; } void CharData_Init(CharData *storage) { assert(storage != NULL); storage->count = -1; } void CharData_AppendString(CharData *storage, const char *s) { int maxchars = sizeof(storage->data) / sizeof(storage->data[0]); int len; assert(s != NULL); len = strlen(s); if (storage->count < 0) storage->count = 0; if ((len + storage->count) > maxchars) { len = (maxchars - storage->count); } if (len + storage->count < sizeof(storage->data)) { memcpy(storage->data + storage->count, s, len); storage->count += len; } } void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) { int maxchars; assert(storage != NULL); assert(s != NULL); maxchars = sizeof(storage->data) / sizeof(storage->data[0]); if (storage->count < 0) storage->count = 0; if (len < 0) len = xmlstrlen(s); if ((len + storage->count) > maxchars) { len = (maxchars - storage->count); } if (len + storage->count < sizeof(storage->data)) { memcpy(storage->data + storage->count, s, len * sizeof(storage->data[0])); storage->count += len; } } int CharData_CheckString(CharData *storage, const char *expected) { char buffer[1280]; int len; int count; assert(storage != NULL); assert(expected != NULL); count = (storage->count < 0) ? 0 : storage->count; len = strlen(expected); if (len != count) { if (sizeof(XML_Char) == 1) sprintf(buffer, "wrong number of data characters:" " got %d, expected %d:\n%s", count, len, storage->data); else sprintf(buffer, "wrong number of data characters: got %d, expected %d", count, len); fail(buffer); return 0; } if (memcmp(expected, storage->data, len) != 0) { fail("got bad data bytes"); return 0; } return 1; } int CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) { char buffer[1024]; int len = xmlstrlen(expected); int count; assert(storage != NULL); count = (storage->count < 0) ? 0 : storage->count; if (len != count) { sprintf(buffer, "wrong number of data characters: got %d, expected %d", count, len); fail(buffer); return 0; } if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) { fail("got bad data bytes"); return 0; } return 1; } astropy-0.3/cextern/expat/tests/xmltest.sh0000755000175000017500000000674512243255342017205 0ustar oleole#! /bin/sh # EXPAT TEST SCRIPT FOR W3C XML TEST SUITE # This script can be used to exercise Expat against the # w3c.org xml test suite, available from # http://www.w3.org/XML/Test/xmlts20020606.zip. # To run this script, first set XMLWF below so that xmlwf can be # found, then set the output directory with OUTPUT. # The script lists all test cases where Expat shows a discrepancy # from the expected result. Test cases where only the canonical # output differs are prefixed with "Output differs:", and a diff file # is generated in the appropriate subdirectory under $OUTPUT. # If there are output files provided, the script will use # output from xmlwf and compare the desired output against it. # However, one has to take into account that the canonical output # produced by xmlwf conforms to an older definition of canonical XML # and does not generate notation declarations. MYDIR="`dirname \"$0\"`" cd "$MYDIR" MYDIR="`pwd`" XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" # XMLWF=/usr/local/bin/xmlwf TS="$MYDIR/XML-Test-Suite" # OUTPUT must terminate with the directory separator. OUTPUT="$TS/out/" # OUTPUT=/home/tmp/xml-testsuite-out/ # RunXmlwfNotWF file reldir # reldir includes trailing slash RunXmlwfNotWF() { file="$1" reldir="$2" $XMLWF -p "$file" > outfile || return $? read outdata < outfile if test "$outdata" = "" ; then echo "Expected not well-formed: $reldir$file" return 1 else return 0 fi } # RunXmlwfWF file reldir # reldir includes trailing slash RunXmlwfWF() { file="$1" reldir="$2" $XMLWF -p -d "$OUTPUT$reldir" "$file" > outfile || return $? read outdata < outfile if test "$outdata" = "" ; then if [ -f "out/$file" ] ; then diff -u "$OUTPUT$reldir$file" "out/$file" > outfile if [ -s outfile ] ; then cp outfile "$OUTPUT$reldir$file.diff" echo "Output differs: $reldir$file" return 1 fi fi return 0 else echo "In $reldir: $outdata" return 1 fi } SUCCESS=0 ERROR=0 UpdateStatus() { if [ "$1" -eq 0 ] ; then SUCCESS=`expr $SUCCESS + 1` else ERROR=`expr $ERROR + 1` fi } ########################## # well-formed test cases # ########################## cd "$TS/xmlconf" for xmldir in ibm/valid/P* \ ibm/invalid/P* \ xmltest/valid/ext-sa \ xmltest/valid/not-sa \ xmltest/invalid \ xmltest/invalid/not-sa \ xmltest/valid/sa \ sun/valid \ sun/invalid ; do cd "$TS/xmlconf/$xmldir" mkdir -p "$OUTPUT$xmldir" for xmlfile in *.xml ; do RunXmlwfWF "$xmlfile" "$xmldir/" UpdateStatus $? done rm outfile done cd "$TS/xmlconf/oasis" mkdir -p "$OUTPUT"oasis for xmlfile in *pass*.xml ; do RunXmlwfWF "$xmlfile" "oasis/" UpdateStatus $? done rm outfile ############################## # not well-formed test cases # ############################## cd "$TS/xmlconf" for xmldir in ibm/not-wf/P* \ ibm/not-wf/p28a \ ibm/not-wf/misc \ xmltest/not-wf/ext-sa \ xmltest/not-wf/not-sa \ xmltest/not-wf/sa \ sun/not-wf ; do cd "$TS/xmlconf/$xmldir" for xmlfile in *.xml ; do RunXmlwfNotWF "$xmlfile" "$xmldir/" UpdateStatus $? done rm outfile done cd "$TS/xmlconf/oasis" for xmlfile in *fail*.xml ; do RunXmlwfNotWF "$xmlfile" "oasis/" UpdateStatus $? done rm outfile echo "Passed: $SUCCESS" echo "Failed: $ERROR" astropy-0.3/cextern/expat/tests/minicheck.h0000755000175000017500000000444012243255342017242 0ustar oleole/* Miniature re-implementation of the "check" library. * * This is intended to support just enough of check to run the Expat * tests. This interface is based entirely on the portion of the * check library being used. * * This is *source* compatible, but not necessary *link* compatible. */ #ifdef __cplusplus extern "C" { #endif #define CK_NOFORK 0 #define CK_FORK 1 #define CK_SILENT 0 #define CK_NORMAL 1 #define CK_VERBOSE 2 /* Workaround for Microsoft's compiler and Tru64 Unix systems where the C compiler has a working __func__, but the C++ compiler only has a working __FUNCTION__. This could be fixed in configure.in, but it's not worth it right now. */ #if defined (_MSC_VER) || (defined(__osf__) && defined(__cplusplus)) #define __func__ __FUNCTION__ #endif #define START_TEST(testname) static void testname(void) { \ _check_set_test_info(__func__, __FILE__, __LINE__); \ { #define END_TEST } } #define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg) typedef void (*tcase_setup_function)(void); typedef void (*tcase_teardown_function)(void); typedef void (*tcase_test_function)(void); typedef struct SRunner SRunner; typedef struct Suite Suite; typedef struct TCase TCase; struct SRunner { Suite *suite; int nchecks; int nfailures; }; struct Suite { char *name; TCase *tests; }; struct TCase { char *name; tcase_setup_function setup; tcase_teardown_function teardown; tcase_test_function *tests; int ntests; int allocated; TCase *next_tcase; }; /* Internal helper. */ void _check_set_test_info(char const *function, char const *filename, int lineno); /* * Prototypes for the actual implementation. */ void _fail_unless(int condition, const char *file, int line, char *msg); Suite *suite_create(char *name); TCase *tcase_create(char *name); void suite_add_tcase(Suite *suite, TCase *tc); void tcase_add_checked_fixture(TCase *, tcase_setup_function, tcase_teardown_function); void tcase_add_test(TCase *tc, tcase_test_function test); SRunner *srunner_create(Suite *suite); void srunner_run_all(SRunner *runner, int verbosity); int srunner_ntests_failed(SRunner *runner); void srunner_free(SRunner *runner); #ifdef __cplusplus } #endif astropy-0.3/cextern/expat/tests/minicheck.c0000755000175000017500000001017312243255342017235 0ustar oleole/* Miniature re-implementation of the "check" library. * * This is intended to support just enough of check to run the Expat * tests. This interface is based entirely on the portion of the * check library being used. */ #include #include #include #include #include "minicheck.h" Suite * suite_create(char *name) { Suite *suite = (Suite *) calloc(1, sizeof(Suite)); if (suite != NULL) { suite->name = name; } return suite; } TCase * tcase_create(char *name) { TCase *tc = (TCase *) calloc(1, sizeof(TCase)); if (tc != NULL) { tc->name = name; } return tc; } void suite_add_tcase(Suite *suite, TCase *tc) { assert(suite != NULL); assert(tc != NULL); assert(tc->next_tcase == NULL); tc->next_tcase = suite->tests; suite->tests = tc; } void tcase_add_checked_fixture(TCase *tc, tcase_setup_function setup, tcase_teardown_function teardown) { assert(tc != NULL); tc->setup = setup; tc->teardown = teardown; } void tcase_add_test(TCase *tc, tcase_test_function test) { assert(tc != NULL); if (tc->allocated == tc->ntests) { int nalloc = tc->allocated + 100; size_t new_size = sizeof(tcase_test_function) * nalloc; tcase_test_function *new_tests = realloc(tc->tests, new_size); assert(new_tests != NULL); if (new_tests != tc->tests) { free(tc->tests); tc->tests = new_tests; } tc->allocated = nalloc; } tc->tests[tc->ntests] = test; tc->ntests++; } SRunner * srunner_create(Suite *suite) { SRunner *runner = calloc(1, sizeof(SRunner)); if (runner != NULL) { runner->suite = suite; } return runner; } static jmp_buf env; static char const *_check_current_function = NULL; static int _check_current_lineno = -1; static char const *_check_current_filename = NULL; void _check_set_test_info(char const *function, char const *filename, int lineno) { _check_current_function = function; _check_current_lineno = lineno; _check_current_filename = filename; } static void add_failure(SRunner *runner, int verbosity) { runner->nfailures++; if (verbosity >= CK_VERBOSE) { printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno, _check_current_function); } } void srunner_run_all(SRunner *runner, int verbosity) { Suite *suite; TCase *tc; assert(runner != NULL); suite = runner->suite; tc = suite->tests; while (tc != NULL) { int i; for (i = 0; i < tc->ntests; ++i) { runner->nchecks++; if (tc->setup != NULL) { /* setup */ if (setjmp(env)) { add_failure(runner, verbosity); continue; } tc->setup(); } /* test */ if (setjmp(env)) { add_failure(runner, verbosity); continue; } (tc->tests[i])(); /* teardown */ if (tc->teardown != NULL) { if (setjmp(env)) { add_failure(runner, verbosity); continue; } tc->teardown(); } } tc = tc->next_tcase; } if (verbosity) { int passed = runner->nchecks - runner->nfailures; double percentage = ((double) passed) / runner->nchecks; int display = (int) (percentage * 100); printf("%d%%: Checks: %d, Failed: %d\n", display, runner->nchecks, runner->nfailures); } } void _fail_unless(int condition, const char *file, int line, char *msg) { /* Always print the error message so it isn't lost. In this case, we have a failure, so there's no reason to be quiet about what it is. */ if (msg != NULL) printf("%s", msg); longjmp(env, 1); } int srunner_ntests_failed(SRunner *runner) { assert(runner != NULL); return runner->nfailures; } void srunner_free(SRunner *runner) { free(runner->suite); free(runner); } astropy-0.3/cextern/expat/tests/README.txt0000755000175000017500000000107212243255342016633 0ustar oleoleThis directory contains the (fledgling) test suite for Expat. The tests provide general unit testing and regression coverage. The tests are not expected to be useful examples of Expat usage; see the examples/ directory for that. The Expat tests use a partial internal implementation of the "Check" unit testing framework for C. More information on Check can be found at: http://check.sourceforge.net/ Expat must be built and, depending on platform, must be installed, before "make check" can be executed. This test suite can all change in a later version. astropy-0.3/cextern/expat/tests/runtests.c0000755000175000017500000014001412243255342017170 0ustar oleole/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. runtest.c : run the Expat test suite */ #ifdef HAVE_EXPAT_CONFIG_H #include #endif #include #include #include #include #include #include "expat.h" #include "chardata.h" #include "minicheck.h" #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif #ifdef XML_LARGE_SIZE #define XML_FMT_INT_MOD "ll" #else #define XML_FMT_INT_MOD "l" #endif static XML_Parser parser; static void basic_setup(void) { parser = XML_ParserCreate(NULL); if (parser == NULL) fail("Parser not created."); } static void basic_teardown(void) { if (parser != NULL) XML_ParserFree(parser); } /* Generate a failure using the parser state to create an error message; this should be used when the parser reports an error we weren't expecting. */ static void _xml_failure(XML_Parser parser, const char *file, int line) { char buffer[1024]; enum XML_Error err = XML_GetErrorCode(parser); sprintf(buffer, " %d: %s (line %" XML_FMT_INT_MOD "u, offset %"\ XML_FMT_INT_MOD "u)\n reported from %s, line %d\n", err, XML_ErrorString(err), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser), file, line); _fail_unless(0, file, line, buffer); } #define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__) static void _expect_failure(char *text, enum XML_Error errorCode, char *errorMessage, char *file, int lineno) { if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) /* Hackish use of _fail_unless() macro, but let's us report the right filename and line number. */ _fail_unless(0, file, lineno, errorMessage); if (XML_GetErrorCode(parser) != errorCode) _xml_failure(parser, file, lineno); } #define expect_failure(text, errorCode, errorMessage) \ _expect_failure((text), (errorCode), (errorMessage), \ __FILE__, __LINE__) /* Dummy handlers for when we need to set a handler to tickle a bug, but it doesn't need to do anything. */ static void XMLCALL dummy_start_doctype_handler(void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset) {} static void XMLCALL dummy_end_doctype_handler(void *userData) {} static void XMLCALL dummy_entity_decl_handler(void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName) {} static void XMLCALL dummy_notation_decl_handler(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) {} static void XMLCALL dummy_element_decl_handler(void *userData, const XML_Char *name, XML_Content *model) {} static void XMLCALL dummy_attlist_decl_handler(void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired) {} static void XMLCALL dummy_comment_handler(void *userData, const XML_Char *data) {} static void XMLCALL dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data) {} static void XMLCALL dummy_start_element(void *userData, const XML_Char *name, const XML_Char **atts) {} /* * Character & encoding tests. */ START_TEST(test_nul_byte) { char text[] = "\0"; /* test that a NUL byte (in US-ASCII data) is an error */ if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK) fail("Parser did not report error on NUL-byte."); if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) xml_failure(parser); } END_TEST START_TEST(test_u0000_char) { /* test that a NUL byte (in US-ASCII data) is an error */ expect_failure("", XML_ERROR_BAD_CHAR_REF, "Parser did not report error on NUL-byte."); } END_TEST START_TEST(test_bom_utf8) { /* This test is really just making sure we don't core on a UTF-8 BOM. */ char *text = "\357\273\277"; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST START_TEST(test_bom_utf16_be) { char text[] = "\376\377\0<\0e\0/\0>"; if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST START_TEST(test_bom_utf16_le) { char text[] = "\377\376<\0e\0/\0>\0"; if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST static void XMLCALL accumulate_characters(void *userData, const XML_Char *s, int len) { CharData_AppendXMLChars((CharData *)userData, s, len); } static void XMLCALL accumulate_attribute(void *userData, const XML_Char *name, const XML_Char **atts) { CharData *storage = (CharData *)userData; if (storage->count < 0 && atts != NULL && atts[0] != NULL) { /* "accumulate" the value of the first attribute we see */ CharData_AppendXMLChars(storage, atts[1], -1); } } static void _run_character_check(XML_Char *text, XML_Char *expected, const char *file, int line) { CharData storage; CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetCharacterDataHandler(parser, accumulate_characters); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) _xml_failure(parser, file, line); CharData_CheckXMLChars(&storage, expected); } #define run_character_check(text, expected) \ _run_character_check(text, expected, __FILE__, __LINE__) static void _run_attribute_check(XML_Char *text, XML_Char *expected, const char *file, int line) { CharData storage; CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetStartElementHandler(parser, accumulate_attribute); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) _xml_failure(parser, file, line); CharData_CheckXMLChars(&storage, expected); } #define run_attribute_check(text, expected) \ _run_attribute_check(text, expected, __FILE__, __LINE__) /* Regression test for SF bug #491986. */ START_TEST(test_danish_latin1) { char *text = "\n" "J\xF8rgen \xE6\xF8\xE5\xC6\xD8\xC5"; run_character_check(text, "J\xC3\xB8rgen \xC3\xA6\xC3\xB8\xC3\xA5\xC3\x86\xC3\x98\xC3\x85"); } END_TEST /* Regression test for SF bug #514281. */ START_TEST(test_french_charref_hexidecimal) { char *text = "\n" "éèàçêÈ"; run_character_check(text, "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); } END_TEST START_TEST(test_french_charref_decimal) { char *text = "\n" "éèàçêÈ"; run_character_check(text, "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); } END_TEST START_TEST(test_french_latin1) { char *text = "\n" "\xE9\xE8\xE0\xE7\xEa\xC8"; run_character_check(text, "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); } END_TEST START_TEST(test_french_utf8) { char *text = "\n" "\xC3\xA9"; run_character_check(text, "\xC3\xA9"); } END_TEST /* Regression test for SF bug #600479. XXX There should be a test that exercises all legal XML Unicode characters as PCDATA and attribute value content, and XML Name characters as part of element and attribute names. */ START_TEST(test_utf8_false_rejection) { char *text = "\xEF\xBA\xBF"; run_character_check(text, "\xEF\xBA\xBF"); } END_TEST /* Regression test for SF bug #477667. This test assures that any 8-bit character followed by a 7-bit character will not be mistakenly interpreted as a valid UTF-8 sequence. */ START_TEST(test_illegal_utf8) { char text[100]; int i; for (i = 128; i <= 255; ++i) { sprintf(text, "%ccd", i); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) { sprintf(text, "expected token error for '%c' (ordinal %d) in UTF-8 text", i, i); fail(text); } else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) xml_failure(parser); /* Reset the parser since we use the same parser repeatedly. */ XML_ParserReset(parser, NULL); } } END_TEST START_TEST(test_utf16) { /* some text */ char text[] = "\000<\000?\000x\000m\000\154\000 \000v\000e\000r\000s\000i\000o" "\000n\000=\000'\0001\000.\000\060\000'\000 \000e\000n\000c\000o" "\000d\000i\000n\000g\000=\000'\000U\000T\000F\000-\0001\000\066" "\000'\000?\000>\000\n" "\000<\000d\000o\000c\000 \000a\000=\000'\0001\0002\0003\000'" "\000>\000s\000o\000m\000e\000 \000t\000e\000x\000t\000<\000/" "\000d\000o\000c\000>"; if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST START_TEST(test_utf16_le_epilog_newline) { unsigned int first_chunk_bytes = 17; char text[] = "\xFF\xFE" /* BOM */ "<\000e\000/\000>\000" /* document element */ "\r\000\n\000\r\000\n\000"; /* epilog */ if (first_chunk_bytes >= sizeof(text) - 1) fail("bad value of first_chunk_bytes"); if ( XML_Parse(parser, text, first_chunk_bytes, XML_FALSE) == XML_STATUS_ERROR) xml_failure(parser); else { enum XML_Status rc; rc = XML_Parse(parser, text + first_chunk_bytes, sizeof(text) - first_chunk_bytes - 1, XML_TRUE); if (rc == XML_STATUS_ERROR) xml_failure(parser); } } END_TEST /* Regression test for SF bug #481609, #774028. */ START_TEST(test_latin1_umlauts) { char *text = "\n" "\xE4 \xF6 \xFC ä ö ü ä ö ü >"; char *utf8 = "\xC3\xA4 \xC3\xB6 \xC3\xBC " "\xC3\xA4 \xC3\xB6 \xC3\xBC " "\xC3\xA4 \xC3\xB6 \xC3\xBC >"; run_character_check(text, utf8); XML_ParserReset(parser, NULL); run_attribute_check(text, utf8); } END_TEST /* Regression test #1 for SF bug #653180. */ START_TEST(test_line_number_after_parse) { char *text = "\n" "\n" "\n"; XML_Size lineno; if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) xml_failure(parser); lineno = XML_GetCurrentLineNumber(parser); if (lineno != 4) { char buffer[100]; sprintf(buffer, "expected 4 lines, saw %" XML_FMT_INT_MOD "u", lineno); fail(buffer); } } END_TEST /* Regression test #2 for SF bug #653180. */ START_TEST(test_column_number_after_parse) { char *text = ""; XML_Size colno; if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) xml_failure(parser); colno = XML_GetCurrentColumnNumber(parser); if (colno != 11) { char buffer[100]; sprintf(buffer, "expected 11 columns, saw %" XML_FMT_INT_MOD "u", colno); fail(buffer); } } END_TEST static void XMLCALL start_element_event_handler2(void *userData, const XML_Char *name, const XML_Char **attr) { CharData *storage = (CharData *) userData; char buffer[100]; sprintf(buffer, "<%s> at col:%" XML_FMT_INT_MOD "u line:%"\ XML_FMT_INT_MOD "u\n", name, XML_GetCurrentColumnNumber(parser), XML_GetCurrentLineNumber(parser)); CharData_AppendString(storage, buffer); } static void XMLCALL end_element_event_handler2(void *userData, const XML_Char *name) { CharData *storage = (CharData *) userData; char buffer[100]; sprintf(buffer, " at col:%" XML_FMT_INT_MOD "u line:%"\ XML_FMT_INT_MOD "u\n", name, XML_GetCurrentColumnNumber(parser), XML_GetCurrentLineNumber(parser)); CharData_AppendString(storage, buffer); } /* Regression test #3 for SF bug #653180. */ START_TEST(test_line_and_column_numbers_inside_handlers) { char *text = "\n" /* Unix end-of-line */ " \r\n" /* Windows end-of-line */ " \r" /* Mac OS end-of-line */ " \n" " \n" " \n" " \n" ""; char *expected = " at col:0 line:1\n" " at col:2 line:2\n" " at col:4 line:3\n" " at col:8 line:3\n" " at col:2 line:4\n" " at col:2 line:5\n" " at col:4 line:6\n" " at col:8 line:6\n" " at col:2 line:7\n" " at col:0 line:8\n"; CharData storage; CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetStartElementHandler(parser, start_element_event_handler2); XML_SetEndElementHandler(parser, end_element_event_handler2); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); CharData_CheckString(&storage, expected); } END_TEST /* Regression test #4 for SF bug #653180. */ START_TEST(test_line_number_after_error) { char *text = "\n" " \n" " "; /* missing */ XML_Size lineno; if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) fail("Expected a parse error"); lineno = XML_GetCurrentLineNumber(parser); if (lineno != 3) { char buffer[100]; sprintf(buffer, "expected 3 lines, saw %" XML_FMT_INT_MOD "u", lineno); fail(buffer); } } END_TEST /* Regression test #5 for SF bug #653180. */ START_TEST(test_column_number_after_error) { char *text = "\n" " \n" " "; /* missing */ XML_Size colno; if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) fail("Expected a parse error"); colno = XML_GetCurrentColumnNumber(parser); if (colno != 4) { char buffer[100]; sprintf(buffer, "expected 4 columns, saw %" XML_FMT_INT_MOD "u", colno); fail(buffer); } } END_TEST /* Regression test for SF bug #478332. */ START_TEST(test_really_long_lines) { /* This parses an input line longer than INIT_DATA_BUF_SIZE characters long (defined to be 1024 in xmlparse.c). We take a really cheesy approach to building the input buffer, because this avoids writing bugs in buffer-filling code. */ char *text = "" /* 64 chars */ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" /* until we have at least 1024 characters on the line: */ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" ""; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* * Element event tests. */ static void XMLCALL end_element_event_handler(void *userData, const XML_Char *name) { CharData *storage = (CharData *) userData; CharData_AppendString(storage, "/"); CharData_AppendXMLChars(storage, name, -1); } START_TEST(test_end_element_events) { char *text = ""; char *expected = "/c/b/f/d/a"; CharData storage; CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetEndElementHandler(parser, end_element_event_handler); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); CharData_CheckString(&storage, expected); } END_TEST /* * Attribute tests. */ /* Helpers used by the following test; this checks any "attr" and "refs" attributes to make sure whitespace has been normalized. Return true if whitespace has been normalized in a string, using the rules for attribute value normalization. The 'is_cdata' flag is needed since CDATA attributes don't need to have multiple whitespace characters collapsed to a single space, while other attribute data types do. (Section 3.3.3 of the recommendation.) */ static int is_whitespace_normalized(const XML_Char *s, int is_cdata) { int blanks = 0; int at_start = 1; while (*s) { if (*s == ' ') ++blanks; else if (*s == '\t' || *s == '\n' || *s == '\r') return 0; else { if (at_start) { at_start = 0; if (blanks && !is_cdata) /* illegal leading blanks */ return 0; } else if (blanks > 1 && !is_cdata) return 0; blanks = 0; } ++s; } if (blanks && !is_cdata) return 0; return 1; } /* Check the attribute whitespace checker: */ static void testhelper_is_whitespace_normalized(void) { assert(is_whitespace_normalized("abc", 0)); assert(is_whitespace_normalized("abc", 1)); assert(is_whitespace_normalized("abc def ghi", 0)); assert(is_whitespace_normalized("abc def ghi", 1)); assert(!is_whitespace_normalized(" abc def ghi", 0)); assert(is_whitespace_normalized(" abc def ghi", 1)); assert(!is_whitespace_normalized("abc def ghi", 0)); assert(is_whitespace_normalized("abc def ghi", 1)); assert(!is_whitespace_normalized("abc def ghi ", 0)); assert(is_whitespace_normalized("abc def ghi ", 1)); assert(!is_whitespace_normalized(" ", 0)); assert(is_whitespace_normalized(" ", 1)); assert(!is_whitespace_normalized("\t", 0)); assert(!is_whitespace_normalized("\t", 1)); assert(!is_whitespace_normalized("\n", 0)); assert(!is_whitespace_normalized("\n", 1)); assert(!is_whitespace_normalized("\r", 0)); assert(!is_whitespace_normalized("\r", 1)); assert(!is_whitespace_normalized("abc\t def", 1)); } static void XMLCALL check_attr_contains_normalized_whitespace(void *userData, const XML_Char *name, const XML_Char **atts) { int i; for (i = 0; atts[i] != NULL; i += 2) { const XML_Char *attrname = atts[i]; const XML_Char *value = atts[i + 1]; if (strcmp("attr", attrname) == 0 || strcmp("ents", attrname) == 0 || strcmp("refs", attrname) == 0) { if (!is_whitespace_normalized(value, 0)) { char buffer[256]; sprintf(buffer, "attribute value not normalized: %s='%s'", attrname, value); fail(buffer); } } } } START_TEST(test_attr_whitespace_normalization) { char *text = "\n" "]>\n" "\n" " \n" " \n" ""; XML_SetStartElementHandler(parser, check_attr_contains_normalized_whitespace); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* * XML declaration tests. */ START_TEST(test_xmldecl_misplaced) { expect_failure("\n" "\n" "", XML_ERROR_MISPLACED_XML_PI, "failed to report misplaced XML declaration"); } END_TEST /* Regression test for SF bug #584832. */ static int XMLCALL UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info) { if (strcmp(encoding,"unsupported-encoding") == 0) { int i; for (i = 0; i < 256; ++i) info->map[i] = i; info->data = NULL; info->convert = NULL; info->release = NULL; return XML_STATUS_OK; } return XML_STATUS_ERROR; } START_TEST(test_unknown_encoding_internal_entity) { char *text = "\n" "]>\n" ""; XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Regression test for SF bug #620106. */ static int XMLCALL external_entity_loader_set_encoding(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { /* This text says it's an unsupported encoding, but it's really UTF-8, which we tell Expat using XML_SetEncoding(). */ char *text = "" "\xC3\xA9"; XML_Parser extparser; extparser = XML_ExternalEntityParserCreate(parser, context, NULL); if (extparser == NULL) fail("Could not create external entity parser."); if (!XML_SetEncoding(extparser, "utf-8")) fail("XML_SetEncoding() ignored for external entity"); if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { xml_failure(parser); return 0; } return 1; } START_TEST(test_ext_entity_set_encoding) { char *text = "\n" "]>\n" "&en;"; XML_SetExternalEntityRefHandler(parser, external_entity_loader_set_encoding); run_character_check(text, "\xC3\xA9"); } END_TEST /* Test that no error is reported for unknown entities if we don't read an external subset. This was fixed in Expat 1.95.5. */ START_TEST(test_wfc_undeclared_entity_unread_external_subset) { char *text = "\n" "&entity;"; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Test that an error is reported for unknown entities if we don't have an external subset. */ START_TEST(test_wfc_undeclared_entity_no_external_subset) { expect_failure("&entity;", XML_ERROR_UNDEFINED_ENTITY, "Parser did not report undefined entity w/out a DTD."); } END_TEST /* Test that an error is reported for unknown entities if we don't read an external subset, but have been declared standalone. */ START_TEST(test_wfc_undeclared_entity_standalone) { char *text = "\n" "\n" "&entity;"; expect_failure(text, XML_ERROR_UNDEFINED_ENTITY, "Parser did not report undefined entity (standalone)."); } END_TEST static int XMLCALL external_entity_loader(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { char *text = (char *)XML_GetUserData(parser); XML_Parser extparser; extparser = XML_ExternalEntityParserCreate(parser, context, NULL); if (extparser == NULL) fail("Could not create external entity parser."); if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { xml_failure(parser); return XML_STATUS_ERROR; } return XML_STATUS_OK; } /* Test that an error is reported for unknown entities if we have read an external subset, and standalone is true. */ START_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) { char *text = "\n" "\n" "&entity;"; char *foo_text = ""; XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); XML_SetUserData(parser, foo_text); XML_SetExternalEntityRefHandler(parser, external_entity_loader); expect_failure(text, XML_ERROR_UNDEFINED_ENTITY, "Parser did not report undefined entity (external DTD)."); } END_TEST /* Test that no error is reported for unknown entities if we have read an external subset, and standalone is false. */ START_TEST(test_wfc_undeclared_entity_with_external_subset) { char *text = "\n" "\n" "&entity;"; char *foo_text = ""; XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); XML_SetUserData(parser, foo_text); XML_SetExternalEntityRefHandler(parser, external_entity_loader); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST START_TEST(test_wfc_no_recursive_entity_refs) { char *text = "\n" "]>\n" "&entity;"; expect_failure(text, XML_ERROR_RECURSIVE_ENTITY_REF, "Parser did not report recursive entity reference."); } END_TEST /* Regression test for SF bug #483514. */ START_TEST(test_dtd_default_handling) { char *text = "\n" "\n" "\n" "\n" "\n" "\n" "]>"; XML_SetDefaultHandler(parser, accumulate_characters); XML_SetDoctypeDeclHandler(parser, dummy_start_doctype_handler, dummy_end_doctype_handler); XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler); XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler); XML_SetElementDeclHandler(parser, dummy_element_decl_handler); XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler); XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); XML_SetCommentHandler(parser, dummy_comment_handler); run_character_check(text, "\n\n\n\n\n\n\n"); } END_TEST /* See related SF bug #673791. When namespace processing is enabled, setting the namespace URI for a prefix is not allowed; this test ensures that it *is* allowed when namespace processing is not enabled. (See Namespaces in XML, section 2.) */ START_TEST(test_empty_ns_without_namespaces) { char *text = "\n" " \n" ""; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Regression test for SF bug #824420. Checks that an xmlns:prefix attribute set in an attribute's default value isn't misinterpreted. */ START_TEST(test_ns_in_attribute_default_without_namespaces) { char *text = "\n" " ]>\n" ""; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST static char *long_character_data_text = "" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" ""; static XML_Bool resumable = XML_FALSE; static void clearing_aborting_character_handler(void *userData, const XML_Char *s, int len) { XML_StopParser(parser, resumable); XML_SetCharacterDataHandler(parser, NULL); } /* Regression test for SF bug #1515266: missing check of stopped parser in doContext() 'for' loop. */ START_TEST(test_stop_parser_between_char_data_calls) { /* The sample data must be big enough that there are two calls to the character data handler from within the inner "for" loop of the XML_TOK_DATA_CHARS case in doContent(), and the character handler must stop the parser and clear the character data handler. */ char *text = long_character_data_text; XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); resumable = XML_FALSE; if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) xml_failure(parser); if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED) xml_failure(parser); } END_TEST /* Regression test for SF bug #1515266: missing check of stopped parser in doContext() 'for' loop. */ START_TEST(test_suspend_parser_between_char_data_calls) { /* The sample data must be big enough that there are two calls to the character data handler from within the inner "for" loop of the XML_TOK_DATA_CHARS case in doContent(), and the character handler must stop the parser and clear the character data handler. */ char *text = long_character_data_text; XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); resumable = XML_TRUE; if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED) xml_failure(parser); if (XML_GetErrorCode(parser) != XML_ERROR_NONE) xml_failure(parser); } END_TEST /* * Namespaces tests. */ static void namespace_setup(void) { parser = XML_ParserCreateNS(NULL, ' '); if (parser == NULL) fail("Parser not created."); } static void namespace_teardown(void) { basic_teardown(); } /* Check that an element name and attribute name match the expected values. The expected values are passed as an array reference of string pointers provided as the userData argument; the first is the expected element name, and the second is the expected attribute name. */ static void XMLCALL triplet_start_checker(void *userData, const XML_Char *name, const XML_Char **atts) { char **elemstr = (char **)userData; char buffer[1024]; if (strcmp(elemstr[0], name) != 0) { sprintf(buffer, "unexpected start string: '%s'", name); fail(buffer); } if (strcmp(elemstr[1], atts[0]) != 0) { sprintf(buffer, "unexpected attribute string: '%s'", atts[0]); fail(buffer); } } /* Check that the element name passed to the end-element handler matches the expected value. The expected value is passed as the first element in an array of strings passed as the userData argument. */ static void XMLCALL triplet_end_checker(void *userData, const XML_Char *name) { char **elemstr = (char **)userData; if (strcmp(elemstr[0], name) != 0) { char buffer[1024]; sprintf(buffer, "unexpected end string: '%s'", name); fail(buffer); } } START_TEST(test_return_ns_triplet) { char *text = ""; char *elemstr[] = { "http://expat.sf.net/ e foo", "http://expat.sf.net/ a bar" }; XML_SetReturnNSTriplet(parser, XML_TRUE); XML_SetUserData(parser, elemstr); XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST static void XMLCALL overwrite_start_checker(void *userData, const XML_Char *name, const XML_Char **atts) { CharData *storage = (CharData *) userData; CharData_AppendString(storage, "start "); CharData_AppendXMLChars(storage, name, -1); while (*atts != NULL) { CharData_AppendString(storage, "\nattribute "); CharData_AppendXMLChars(storage, *atts, -1); atts += 2; } CharData_AppendString(storage, "\n"); } static void XMLCALL overwrite_end_checker(void *userData, const XML_Char *name) { CharData *storage = (CharData *) userData; CharData_AppendString(storage, "end "); CharData_AppendXMLChars(storage, name, -1); CharData_AppendString(storage, "\n"); } static void run_ns_tagname_overwrite_test(char *text, char *result) { CharData storage; CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetElementHandler(parser, overwrite_start_checker, overwrite_end_checker); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); CharData_CheckString(&storage, result); } /* Regression test for SF bug #566334. */ START_TEST(test_ns_tagname_overwrite) { char *text = "\n" " \n" " \n" ""; char *result = "start http://xml.libexpat.org/ e\n" "start http://xml.libexpat.org/ f\n" "attribute http://xml.libexpat.org/ attr\n" "end http://xml.libexpat.org/ f\n" "start http://xml.libexpat.org/ g\n" "attribute http://xml.libexpat.org/ attr2\n" "end http://xml.libexpat.org/ g\n" "end http://xml.libexpat.org/ e\n"; run_ns_tagname_overwrite_test(text, result); } END_TEST /* Regression test for SF bug #566334. */ START_TEST(test_ns_tagname_overwrite_triplet) { char *text = "\n" " \n" " \n" ""; char *result = "start http://xml.libexpat.org/ e n\n" "start http://xml.libexpat.org/ f n\n" "attribute http://xml.libexpat.org/ attr n\n" "end http://xml.libexpat.org/ f n\n" "start http://xml.libexpat.org/ g n\n" "attribute http://xml.libexpat.org/ attr2 n\n" "end http://xml.libexpat.org/ g n\n" "end http://xml.libexpat.org/ e n\n"; XML_SetReturnNSTriplet(parser, XML_TRUE); run_ns_tagname_overwrite_test(text, result); } END_TEST /* Regression test for SF bug #620343. */ static void XMLCALL start_element_fail(void *userData, const XML_Char *name, const XML_Char **atts) { /* We should never get here. */ fail("should never reach start_element_fail()"); } static void XMLCALL start_ns_clearing_start_element(void *userData, const XML_Char *prefix, const XML_Char *uri) { XML_SetStartElementHandler((XML_Parser) userData, NULL); } START_TEST(test_start_ns_clears_start_element) { /* This needs to use separate start/end tags; using the empty tag syntax doesn't cause the problematic path through Expat to be taken. */ char *text = ""; XML_SetStartElementHandler(parser, start_element_fail); XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element); XML_UseParserAsHandlerArg(parser); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Regression test for SF bug #616863. */ static int XMLCALL external_entity_handler(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser); char *text; XML_Parser p2; if (callno == 1) text = ("\n" "\n" "\n"); else text = ("" ""); XML_SetUserData(parser, (void *) callno); p2 = XML_ExternalEntityParserCreate(parser, context, NULL); if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { xml_failure(p2); return 0; } XML_ParserFree(p2); return 1; } START_TEST(test_default_ns_from_ext_subset_and_ext_ge) { char *text = "\n" "\n" "]>\n" "\n" "&en;\n" ""; XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); XML_SetExternalEntityRefHandler(parser, external_entity_handler); /* We actually need to set this handler to tickle this bug. */ XML_SetStartElementHandler(parser, dummy_start_element); XML_SetUserData(parser, NULL); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Regression test #1 for SF bug #673791. */ START_TEST(test_ns_prefix_with_empty_uri_1) { char *text = "\n" " \n" ""; expect_failure(text, XML_ERROR_UNDECLARING_PREFIX, "Did not report re-setting namespace" " URI with prefix to ''."); } END_TEST /* Regression test #2 for SF bug #673791. */ START_TEST(test_ns_prefix_with_empty_uri_2) { char *text = "\n" ""; expect_failure(text, XML_ERROR_UNDECLARING_PREFIX, "Did not report setting namespace URI with prefix to ''."); } END_TEST /* Regression test #3 for SF bug #673791. */ START_TEST(test_ns_prefix_with_empty_uri_3) { char *text = "\n" " \n" "]>\n" ""; expect_failure(text, XML_ERROR_UNDECLARING_PREFIX, "Didn't report attr default setting NS w/ prefix to ''."); } END_TEST /* Regression test #4 for SF bug #673791. */ START_TEST(test_ns_prefix_with_empty_uri_4) { char *text = "\n" " \n" "]>\n" ""; /* Packaged info expected by the end element handler; the weird structuring lets us re-use the triplet_end_checker() function also used for another test. */ char *elemstr[] = { "http://xml.libexpat.org/ doc prefix" }; XML_SetReturnNSTriplet(parser, XML_TRUE); XML_SetUserData(parser, elemstr); XML_SetEndElementHandler(parser, triplet_end_checker); if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST START_TEST(test_ns_default_with_empty_uri) { char *text = "\n" " \n" ""; if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } END_TEST /* Regression test for SF bug #692964: two prefixes for one namespace. */ START_TEST(test_ns_duplicate_attrs_diff_prefixes) { char *text = ""; expect_failure(text, XML_ERROR_DUPLICATE_ATTRIBUTE, "did not report multiple attributes with same URI+name"); } END_TEST /* Regression test for SF bug #695401: unbound prefix. */ START_TEST(test_ns_unbound_prefix_on_attribute) { char *text = ""; expect_failure(text, XML_ERROR_UNBOUND_PREFIX, "did not report unbound prefix on attribute"); } END_TEST /* Regression test for SF bug #695401: unbound prefix. */ START_TEST(test_ns_unbound_prefix_on_element) { char *text = ""; expect_failure(text, XML_ERROR_UNBOUND_PREFIX, "did not report unbound prefix on element"); } END_TEST static Suite * make_suite(void) { Suite *s = suite_create("basic"); TCase *tc_basic = tcase_create("basic tests"); TCase *tc_namespace = tcase_create("XML namespaces"); suite_add_tcase(s, tc_basic); tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown); tcase_add_test(tc_basic, test_nul_byte); tcase_add_test(tc_basic, test_u0000_char); tcase_add_test(tc_basic, test_bom_utf8); tcase_add_test(tc_basic, test_bom_utf16_be); tcase_add_test(tc_basic, test_bom_utf16_le); tcase_add_test(tc_basic, test_illegal_utf8); tcase_add_test(tc_basic, test_utf16); tcase_add_test(tc_basic, test_utf16_le_epilog_newline); tcase_add_test(tc_basic, test_latin1_umlauts); /* Regression test for SF bug #491986. */ tcase_add_test(tc_basic, test_danish_latin1); /* Regression test for SF bug #514281. */ tcase_add_test(tc_basic, test_french_charref_hexidecimal); tcase_add_test(tc_basic, test_french_charref_decimal); tcase_add_test(tc_basic, test_french_latin1); tcase_add_test(tc_basic, test_french_utf8); tcase_add_test(tc_basic, test_utf8_false_rejection); tcase_add_test(tc_basic, test_line_number_after_parse); tcase_add_test(tc_basic, test_column_number_after_parse); tcase_add_test(tc_basic, test_line_and_column_numbers_inside_handlers); tcase_add_test(tc_basic, test_line_number_after_error); tcase_add_test(tc_basic, test_column_number_after_error); tcase_add_test(tc_basic, test_really_long_lines); tcase_add_test(tc_basic, test_end_element_events); tcase_add_test(tc_basic, test_attr_whitespace_normalization); tcase_add_test(tc_basic, test_xmldecl_misplaced); tcase_add_test(tc_basic, test_unknown_encoding_internal_entity); tcase_add_test(tc_basic, test_wfc_undeclared_entity_unread_external_subset); tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset); tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone); tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset); tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset_standalone); tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs); tcase_add_test(tc_basic, test_ext_entity_set_encoding); tcase_add_test(tc_basic, test_dtd_default_handling); tcase_add_test(tc_basic, test_empty_ns_without_namespaces); tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces); tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls); tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, namespace_setup, namespace_teardown); tcase_add_test(tc_namespace, test_return_ns_triplet); tcase_add_test(tc_namespace, test_ns_tagname_overwrite); tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet); tcase_add_test(tc_namespace, test_start_ns_clears_start_element); tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_1); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4); tcase_add_test(tc_namespace, test_ns_default_with_empty_uri); tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes); tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute); tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_element); return s; } int main(int argc, char *argv[]) { int i, nf; int verbosity = CK_NORMAL; Suite *s = make_suite(); SRunner *sr = srunner_create(s); /* run the tests for internal helper functions */ testhelper_is_whitespace_normalized(); for (i = 1; i < argc; ++i) { char *opt = argv[i]; if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) verbosity = CK_VERBOSE; else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) verbosity = CK_SILENT; else { fprintf(stderr, "runtests: unknown option '%s'\n", opt); return 2; } } if (verbosity != CK_SILENT) printf("Expat version: %s\n", XML_ExpatVersion()); srunner_run_all(sr, verbosity); nf = srunner_ntests_failed(sr); srunner_free(sr); return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } astropy-0.3/cextern/expat/tests/benchmark/0000755000175000017500000000000012243263747017074 5ustar oleoleastropy-0.3/cextern/expat/tests/benchmark/benchmark.dsp0000755000175000017500000000566712243255342021547 0ustar oleole# Microsoft Developer Studio Project File - Name="benchmark" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=benchmark - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "benchmark.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "benchmark.mak" CFG="benchmark - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "benchmark - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "benchmark - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "benchmark - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "..\..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x1009 /d "NDEBUG" # ADD RSC /l 0x1009 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 # ADD LINK32 libexpat.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\win32\bin\Release" !ELSEIF "$(CFG)" == "benchmark - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x1009 /d "_DEBUG" # ADD RSC /l 0x1009 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 libexpat.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\win32\bin\Debug" !ENDIF # Begin Target # Name "benchmark - Win32 Release" # Name "benchmark - Win32 Debug" # Begin Source File SOURCE=.\benchmark.c # End Source File # End Target # End Project astropy-0.3/cextern/expat/tests/benchmark/README.txt0000755000175000017500000000104212243255342020562 0ustar oleoleUse this benchmark command line utility as follows: benchmark [-n] <# iterations> The command line arguments are: -n ... optional; if supplied, namespace processing is turned on ... name/path of test xml file ... size of processing buffer; the file is parsed in chunks of this size <# iterations> ... how often will the file be parsed Returns: The time (in seconds) it takes to parse the test file, averaged over the number of iterations.astropy-0.3/cextern/expat/tests/benchmark/benchmark.dsw0000755000175000017500000000146412243255342021545 0ustar oleoleMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "benchmark"=.\benchmark.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name expat End Project Dependency }}} ############################################################################### Project: "expat"=..\..\lib\expat.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### astropy-0.3/cextern/expat/tests/benchmark/benchmark.c0000755000175000017500000000535612243255342021176 0ustar oleole#include #include #include #include #include "expat.h" #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif #ifdef XML_LARGE_SIZE #define XML_FMT_INT_MOD "ll" #else #define XML_FMT_INT_MOD "l" #endif static void usage(const char *prog, int rc) { fprintf(stderr, "usage: %s [-n] filename bufferSize nr_of_loops\n", prog); exit(rc); } int main (int argc, char *argv[]) { XML_Parser parser; char *XMLBuf, *XMLBufEnd, *XMLBufPtr; FILE *fd; struct stat fileAttr; int nrOfLoops, bufferSize, fileSize, i, isFinal; int j = 0, ns = 0; clock_t tstart, tend; double cpuTime = 0.0; if (argc > 1) { if (argv[1][0] == '-') { if (argv[1][1] == 'n' && argv[1][2] == '\0') { ns = 1; j = 1; } else usage(argv[0], 1); } } if (argc != j + 4) usage(argv[0], 1); if (stat (argv[j + 1], &fileAttr) != 0) { fprintf (stderr, "could not access file '%s'\n", argv[j + 1]); return 2; } fd = fopen (argv[j + 1], "r"); if (!fd) { fprintf (stderr, "could not open file '%s'\n", argv[j + 1]); exit(2); } bufferSize = atoi (argv[j + 2]); nrOfLoops = atoi (argv[j + 3]); if (bufferSize <= 0 || nrOfLoops <= 0) { fprintf (stderr, "buffer size and nr of loops must be greater than zero.\n"); exit(3); } XMLBuf = malloc (fileAttr.st_size); fileSize = fread (XMLBuf, sizeof (char), fileAttr.st_size, fd); fclose (fd); if (ns) parser = XML_ParserCreateNS(NULL, '!'); else parser = XML_ParserCreate(NULL); i = 0; XMLBufEnd = XMLBuf + fileSize; while (i < nrOfLoops) { XMLBufPtr = XMLBuf; isFinal = 0; tstart = clock(); do { int parseBufferSize = XMLBufEnd - XMLBufPtr; if (parseBufferSize <= bufferSize) isFinal = 1; else parseBufferSize = bufferSize; if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) { fprintf (stderr, "error '%s' at line %" XML_FMT_INT_MOD \ "u character %" XML_FMT_INT_MOD "u\n", XML_ErrorString (XML_GetErrorCode (parser)), XML_GetCurrentLineNumber (parser), XML_GetCurrentColumnNumber (parser)); free (XMLBuf); XML_ParserFree (parser); exit (4); } XMLBufPtr += bufferSize; } while (!isFinal); tend = clock(); cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC; XML_ParserReset(parser, NULL); i++; } XML_ParserFree (parser); free (XMLBuf); printf ("%d loops, with buffer size %d. Average time per loop: %f\n", nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops); return 0; } astropy-0.3/cextern/expat/tests/runtestspp.cpp0000755000175000017500000000027112243255342020070 0ustar oleole// C++ compilation harness for the test suite. // // This is used to ensure the Expat headers can be included from C++ // and have everything work as expected. // #include "runtests.c" astropy-0.3/cextern/expat/tests/chardata.h0000755000175000017500000000142712243255342017061 0ustar oleole/* chardata.h Interface to some helper routines used to accumulate and check text and attribute content. */ #ifdef __cplusplus extern "C" { #endif #ifndef XML_CHARDATA_H #define XML_CHARDATA_H 1 #ifndef XML_VERSION #include "expat.h" /* need XML_Char */ #endif typedef struct { int count; /* # of chars, < 0 if not set */ XML_Char data[1024]; } CharData; void CharData_Init(CharData *storage); void CharData_AppendString(CharData *storage, const char *s); void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); int CharData_CheckString(CharData *storage, const char *s); int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); #endif /* XML_CHARDATA_H */ #ifdef __cplusplus } #endif astropy-0.3/cextern/expat/amiga/0000755000175000017500000000000012243263747015056 5ustar oleoleastropy-0.3/cextern/expat/amiga/expat_vectors.c0000755000175000017500000005273312243255342020115 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #include #include #include #include extern uint32 _Expat_Obtain(struct ExpatIFace *); extern uint32 _Expat_Release(struct ExpatIFace *); extern XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace *, const XML_Char * encodingName); extern XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace *, const XML_Char * encodingName, XML_Char nsSep); extern XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace *, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); extern XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace *, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); extern void _Expat_XML_ParserFree(struct ExpatIFace *, XML_Parser parser); extern enum XML_Status _Expat_XML_Parse(struct ExpatIFace *, XML_Parser parser, const char * s, int len, int isFinal); extern enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace *, XML_Parser parser, int len, int isFinal); extern void * _Expat_XML_GetBuffer(struct ExpatIFace *, XML_Parser parser, int len); extern void _Expat_XML_SetStartElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start); extern void _Expat_XML_SetEndElementHandler(struct ExpatIFace *, XML_Parser parser, XML_EndElementHandler end); extern void _Expat_XML_SetElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); extern void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace *, XML_Parser parser, XML_CharacterDataHandler handler); extern void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace *, XML_Parser parser, XML_ProcessingInstructionHandler handler); extern void _Expat_XML_SetCommentHandler(struct ExpatIFace *, XML_Parser parser, XML_CommentHandler handler); extern void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start); extern void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_EndCdataSectionHandler end); extern void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); extern void _Expat_XML_SetDefaultHandler(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); extern void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); extern void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace *, XML_Parser parser, XML_ExternalEntityRefHandler handler); extern void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace *, XML_Parser parser, void * arg); extern void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace *, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); extern void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start); extern void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndNamespaceDeclHandler end); extern void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); extern void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_XmlDeclHandler handler); extern void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start); extern void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndDoctypeDeclHandler end); extern void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); extern void _Expat_XML_SetElementDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_ElementDeclHandler eldecl); extern void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_AttlistDeclHandler attdecl); extern void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EntityDeclHandler handler); extern void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); extern void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_NotationDeclHandler handler); extern void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace *, XML_Parser parser, XML_NotStandaloneHandler handler); extern enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace *, XML_Parser parser); extern const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace *, enum XML_Error code); extern long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace *, XML_Parser parser); extern int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace *, XML_Parser parser); extern int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace *, XML_Parser parser); extern int _Expat_XML_GetCurrentByteCount(struct ExpatIFace *, XML_Parser parser); extern const char * _Expat_XML_GetInputContext(struct ExpatIFace *, XML_Parser parser, int * offset, int * size); extern void _Expat_XML_SetUserData(struct ExpatIFace *, XML_Parser parser, void * userData); extern void _Expat_XML_DefaultCurrent(struct ExpatIFace *, XML_Parser parser); extern void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace *, XML_Parser parser); extern enum XML_Status _Expat_XML_SetBase(struct ExpatIFace *, XML_Parser parser, const XML_Char * base); extern const XML_Char * _Expat_XML_GetBase(struct ExpatIFace *, XML_Parser parser); extern int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace *, XML_Parser parser); extern int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace *, XML_Parser parser); extern enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); extern int _Expat_XML_SetParamEntityParsing(struct ExpatIFace *, XML_Parser parser, enum XML_ParamEntityParsing parsing); extern void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace *, XML_Parser parser, int do_nst); extern const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace *); extern XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace *); extern XML_Bool _Expat_XML_ParserReset(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); extern void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace *, XML_Parser parser, XML_SkippedEntityHandler handler); extern enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace *, XML_Parser parser, XML_Bool useDTD); extern const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace *); extern enum XML_Status _Expat_XML_StopParser(struct ExpatIFace *, XML_Parser parser, XML_Bool resumable); extern enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace *, XML_Parser parser); extern void _Expat_XML_GetParsingStatus(struct ExpatIFace *, XML_Parser parser, XML_ParsingStatus * status); extern void _Expat_XML_FreeContentModel(struct ExpatIFace *, XML_Parser parser, XML_Content * model); extern void * _Expat_XML_MemMalloc(struct ExpatIFace *, XML_Parser parser, size_t size); extern void * _Expat_XML_MemRealloc(struct ExpatIFace *, XML_Parser parser, void * ptr, size_t size); extern void _Expat_XML_MemFree(struct ExpatIFace *, XML_Parser parser, void * ptr); CONST APTR main_vectors[] = { _Expat_Obtain, _Expat_Release, NULL, NULL, _Expat_XML_ParserCreate, _Expat_XML_ParserCreateNS, _Expat_XML_ParserCreate_MM, _Expat_XML_ExternalEntityParserCreate, _Expat_XML_ParserFree, _Expat_XML_Parse, _Expat_XML_ParseBuffer, _Expat_XML_GetBuffer, _Expat_XML_SetStartElementHandler, _Expat_XML_SetEndElementHandler, _Expat_XML_SetElementHandler, _Expat_XML_SetCharacterDataHandler, _Expat_XML_SetProcessingInstructionHandler, _Expat_XML_SetCommentHandler, _Expat_XML_SetStartCdataSectionHandler, _Expat_XML_SetEndCdataSectionHandler, _Expat_XML_SetCdataSectionHandler, _Expat_XML_SetDefaultHandler, _Expat_XML_SetDefaultHandlerExpand, _Expat_XML_SetExternalEntityRefHandler, _Expat_XML_SetExternalEntityRefHandlerArg, _Expat_XML_SetUnknownEncodingHandler, _Expat_XML_SetStartNamespaceDeclHandler, _Expat_XML_SetEndNamespaceDeclHandler, _Expat_XML_SetNamespaceDeclHandler, _Expat_XML_SetXmlDeclHandler, _Expat_XML_SetStartDoctypeDeclHandler, _Expat_XML_SetEndDoctypeDeclHandler, _Expat_XML_SetDoctypeDeclHandler, _Expat_XML_SetElementDeclHandler, _Expat_XML_SetAttlistDeclHandler, _Expat_XML_SetEntityDeclHandler, _Expat_XML_SetUnparsedEntityDeclHandler, _Expat_XML_SetNotationDeclHandler, _Expat_XML_SetNotStandaloneHandler, _Expat_XML_GetErrorCode, _Expat_XML_ErrorString, _Expat_XML_GetCurrentByteIndex, _Expat_XML_GetCurrentLineNumber, _Expat_XML_GetCurrentColumnNumber, _Expat_XML_GetCurrentByteCount, _Expat_XML_GetInputContext, _Expat_XML_SetUserData, _Expat_XML_DefaultCurrent, _Expat_XML_UseParserAsHandlerArg, _Expat_XML_SetBase, _Expat_XML_GetBase, _Expat_XML_GetSpecifiedAttributeCount, _Expat_XML_GetIdAttributeIndex, _Expat_XML_SetEncoding, _Expat_XML_SetParamEntityParsing, _Expat_XML_SetReturnNSTriplet, _Expat_XML_ExpatVersion, _Expat_XML_ExpatVersionInfo, _Expat_XML_ParserReset, _Expat_XML_SetSkippedEntityHandler, _Expat_XML_UseForeignDTD, _Expat_XML_GetFeatureList, _Expat_XML_StopParser, _Expat_XML_ResumeParser, _Expat_XML_GetParsingStatus, _Expat_XML_FreeContentModel, _Expat_XML_MemMalloc, _Expat_XML_MemRealloc, _Expat_XML_MemFree, (APTR)-1 }; uint32 _Expat_Obtain(struct ExpatIFace *Self) { return ++Self->Data.RefCount; } uint32 _Expat_Release(struct ExpatIFace *Self) { return --Self->Data.RefCount; } XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace * Self, const XML_Char *encoding) { return XML_ParserCreate(encoding); } XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace * Self, const XML_Char *encoding, XML_Char nsSep) { return XML_ParserCreateNS(encoding, nsSep); } XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace * Self, const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator) { return XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator); } XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *context, const XML_Char *encoding) { return XML_ExternalEntityParserCreate(parser, context, encoding); } void _Expat_XML_ParserFree(struct ExpatIFace *Self, XML_Parser parser) { XML_ParserFree(parser); } enum XML_Status _Expat_XML_Parse(struct ExpatIFace * Self, XML_Parser parser, const char * s, int len, int isFinal) { return XML_Parse(parser, s, len, isFinal); } enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace * Self, XML_Parser parser, int len, int isFinal) { return XML_ParseBuffer(parser, len, isFinal); } void * _Expat_XML_GetBuffer(struct ExpatIFace * Self, XML_Parser parser, int len) { return XML_GetBuffer(parser, len); } void _Expat_XML_SetStartElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start) { XML_SetStartElementHandler(parser, start); } void _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end) { XML_SetEndElementHandler(parser, end); } void _Expat_XML_SetElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { XML_SetElementHandler(parser, start, end); } void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CharacterDataHandler handler) { XML_SetCharacterDataHandler(parser, handler); } void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ProcessingInstructionHandler handler) { XML_SetProcessingInstructionHandler(parser, handler); } void _Expat_XML_SetCommentHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CommentHandler handler) { XML_SetCommentHandler(parser, handler); } void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start) { XML_SetStartCdataSectionHandler(parser, start); } void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndCdataSectionHandler end) { XML_SetEndCdataSectionHandler(parser, end); } void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) { XML_SetCdataSectionHandler(parser, start, end); } void _Expat_XML_SetDefaultHandler(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) { XML_SetDefaultHandler(parser, handler); } void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) { XML_SetDefaultHandlerExpand(parser, handler); } void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ExternalEntityRefHandler handler) { XML_SetExternalEntityRefHandler(parser, handler); } void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace * Self, XML_Parser parser, void * arg) { XML_SetExternalEntityRefHandlerArg(parser, arg); } void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data) { XML_SetUnknownEncodingHandler(parser, handler, data); } void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start) { XML_SetStartNamespaceDeclHandler(parser, start); } void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndNamespaceDeclHandler end) { XML_SetEndNamespaceDeclHandler(parser, end); } void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) { XML_SetNamespaceDeclHandler(parser, start, end); } void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_XmlDeclHandler handler) { XML_SetXmlDeclHandler(parser, handler); } void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start) { XML_SetStartDoctypeDeclHandler(parser, start); } void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndDoctypeDeclHandler end) { XML_SetEndDoctypeDeclHandler(parser, end); } void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) { XML_SetDoctypeDeclHandler(parser, start, end); } void _Expat_XML_SetElementDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ElementDeclHandler eldecl) { XML_SetElementDeclHandler(parser, eldecl); } void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_AttlistDeclHandler attdecl) { XML_SetAttlistDeclHandler(parser, attdecl); } void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EntityDeclHandler handler) { XML_SetEntityDeclHandler(parser, handler); } void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { XML_SetUnparsedEntityDeclHandler(parser, handler); } void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotationDeclHandler handler) { XML_SetNotationDeclHandler(parser, handler); } void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotStandaloneHandler handler) { XML_SetNotStandaloneHandler(parser, handler); } enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetErrorCode(parser); } const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace * Self, enum XML_Error code) { return XML_ErrorString(code); } long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetCurrentByteIndex(parser); } int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetCurrentLineNumber(parser); } int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetCurrentColumnNumber(parser); } int _Expat_XML_GetCurrentByteCount(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetCurrentByteCount(parser); } const char * _Expat_XML_GetInputContext(struct ExpatIFace * Self, XML_Parser parser, int * offset, int * size) { return XML_GetInputContext(parser, offset, size); } void _Expat_XML_SetUserData(struct ExpatIFace * Self, XML_Parser parser, void * userData) { XML_SetUserData(parser, userData); } void _Expat_XML_DefaultCurrent(struct ExpatIFace * Self, XML_Parser parser) { XML_DefaultCurrent(parser); } void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace * Self, XML_Parser parser) { XML_UseParserAsHandlerArg(parser); } enum XML_Status _Expat_XML_SetBase(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *p) { return XML_SetBase(parser, p); } const XML_Char * _Expat_XML_GetBase(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetBase(parser); } int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetSpecifiedAttributeCount(parser); } int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace * Self, XML_Parser parser) { return XML_GetIdAttributeIndex(parser); } enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) { return XML_SetEncoding(parser, encoding); } int _Expat_XML_SetParamEntityParsing(struct ExpatIFace * Self, XML_Parser parser, enum XML_ParamEntityParsing parsing) { return XML_SetParamEntityParsing(parser, parsing); } void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace * Self, XML_Parser parser, int do_nst) { XML_SetReturnNSTriplet(parser, do_nst); } const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace * Self) { return XML_ExpatVersion(); } XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace * Self) { return XML_ExpatVersionInfo(); } XML_Bool _Expat_XML_ParserReset(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) { return XML_ParserReset(parser, encoding); } void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace * Self, XML_Parser parser, XML_SkippedEntityHandler handler) { XML_SetSkippedEntityHandler(parser, handler); } enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace * Self, XML_Parser parser, XML_Bool useDTD) { return XML_UseForeignDTD(parser, useDTD); } const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace * Self) { return XML_GetFeatureList(); } enum XML_Status _Expat_XML_StopParser(struct ExpatIFace * Self, XML_Parser parser, XML_Bool resumable) { return XML_StopParser(parser, resumable); } enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace * Self, XML_Parser parser) { return XML_ResumeParser(parser); } void _Expat_XML_GetParsingStatus(struct ExpatIFace * Self, XML_Parser parser, XML_ParsingStatus * status) { XML_GetParsingStatus(parser, status); } void _Expat_XML_FreeContentModel(struct ExpatIFace * Self, XML_Parser parser, XML_Content * model) { XML_FreeContentModel(parser, model); } void * _Expat_XML_MemMalloc(struct ExpatIFace * Self, XML_Parser parser, size_t size) { return XML_MemMalloc(parser, size); } void * _Expat_XML_MemRealloc(struct ExpatIFace * Self, XML_Parser parser, void * ptr, size_t size) { XML_MemRealloc(parser, ptr, size); } void _Expat_XML_MemFree(struct ExpatIFace * Self, XML_Parser parser, void * ptr) { XML_MemFree(parser, ptr); } astropy-0.3/cextern/expat/amiga/expat_68k.c0000644000175000017500000012202012243255342017020 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ /* ** Note: This file was originally automatically generated by fdtrans. */ #ifdef __USE_INLINE__ #undef __USE_INLINE__ #endif #include #include #include #include #include #include "expat_68k.h" #include "expat_base.h" STATIC ULONG stub_OpenPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; return (ULONG) Self->Open(0); } struct EmuTrap stub_Open = { TRAPINST, TRAPTYPE, stub_OpenPPC }; STATIC ULONG stub_ClosePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; return (ULONG) Self->Close(); } struct EmuTrap stub_Close = { TRAPINST, TRAPTYPE, stub_ClosePPC }; STATIC ULONG stub_ExpungePPC(ULONG *regarray) { return 0UL; } struct EmuTrap stub_Expunge = { TRAPINST, TRAPTYPE, stub_ExpungePPC }; STATIC ULONG stub_ReservedPPC(ULONG *regarray) { return 0UL; } struct EmuTrap stub_Reserved = { TRAPINST, TRAPTYPE, stub_ReservedPPC }; static M68kXML_Parser stub_XML_ParserCreatePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; M68kXML_Parser p; p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); if (p) { p->p = Self->XML_ParserCreate((const XML_Char *)regarray[8]); if (p->p) { p->IExec = IExec; Self->XML_SetUserData(p->p, p); return p; } IExec->FreeVec(p); } return NULL; } struct EmuTrap stub_XML_ParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreatePPC }; static M68kXML_Parser stub_XML_ParserCreateNSPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; M68kXML_Parser p; p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); if (p) { p->p = Self->XML_ParserCreateNS((const XML_Char *)regarray[8], (XML_Char)regarray[0]); if (p->p) { p->IExec = IExec; Self->XML_SetUserData(p->p, p); return p; } IExec->FreeVec(p); } return NULL; } struct EmuTrap stub_XML_ParserCreateNS = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreateNSPPC }; static M68kXML_Parser stub_XML_ParserCreate_MMPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; M68kXML_Parser p; p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); if (p) { p->p = Self->XML_ParserCreate_MM((const XML_Char *)regarray[8], (const XML_Memory_Handling_Suite *)regarray[9], (const XML_Char *)regarray[10]); if (p->p) { p->IExec = IExec; Self->XML_SetUserData(p->p, p); return p; } IExec->FreeVec(p); } return NULL; } struct EmuTrap stub_XML_ParserCreate_MM = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreate_MMPPC }; static M68kXML_Parser stub_XML_ExternalEntityParserCreatePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; M68kXML_Parser p; p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); if (p) { p->p = Self->XML_ExternalEntityParserCreate((XML_Parser)regarray[8], (const XML_Char *)regarray[9], (const XML_Char *)regarray[10]); if (p->p) { p->IExec = IExec; Self->XML_SetUserData(p->p, p); return p; } IExec->FreeVec(p); } return NULL; } struct EmuTrap stub_XML_ExternalEntityParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExternalEntityParserCreatePPC }; static void stub_XML_ParserFreePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; if (p) { Self->XML_ParserFree(p->p); IExec->FreeVec(p); } } struct EmuTrap stub_XML_ParserFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserFreePPC }; static int stub_XML_ParsePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_SetUserData(p->p, p); return Self->XML_Parse(p->p, (const char *)regarray[9], (int)regarray[0], (int)regarray[1]); } struct EmuTrap stub_XML_Parse = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParsePPC }; static int stub_XML_ParseBufferPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_ParseBuffer(p->p, (int)regarray[0], (int)regarray[1]); } struct EmuTrap stub_XML_ParseBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParseBufferPPC }; static void * stub_XML_GetBufferPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetBuffer(p->p, (int)regarray[0]); } struct EmuTrap stub_XML_GetBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBufferPPC }; static void stub_XML_SetStartElementHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startelementhandler = (void *)regarray[9]; Self->XML_SetStartElementHandler(p->p, _68k_startelementhandler); } struct EmuTrap stub_XML_SetStartElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartElementHandlerPPC }; static void stub_XML_SetEndElementHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->endelementhandler = (void *)regarray[9]; Self->XML_SetEndElementHandler(p->p, _68k_endelementhandler); } struct EmuTrap stub_XML_SetEndElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndElementHandlerPPC }; static void stub_XML_SetElementHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startelementhandler = (void *)regarray[9]; p->endelementhandler = (void *)regarray[10]; Self->XML_SetElementHandler(p->p, _68k_startelementhandler, _68k_endelementhandler); } struct EmuTrap stub_XML_SetElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementHandlerPPC }; static void stub_XML_SetCharacterDataHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->chardatahandler = (void *)regarray[9]; Self->XML_SetCharacterDataHandler(p->p, _68k_chardatahandler); } struct EmuTrap stub_XML_SetCharacterDataHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCharacterDataHandlerPPC }; static void stub_XML_SetProcessingInstructionHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->procinsthandler = (void *)regarray[9]; Self->XML_SetProcessingInstructionHandler(p->p, _68k_procinsthandler); } struct EmuTrap stub_XML_SetProcessingInstructionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetProcessingInstructionHandlerPPC }; static void stub_XML_SetCommentHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->commenthandler = (void *)regarray[9]; Self->XML_SetCommentHandler(p->p, _68k_commenthandler); } struct EmuTrap stub_XML_SetCommentHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCommentHandlerPPC }; static void stub_XML_SetStartCdataSectionHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startcdatahandler = (void *)regarray[9]; Self->XML_SetStartCdataSectionHandler(p->p, _68k_startcdatahandler); } struct EmuTrap stub_XML_SetStartCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartCdataSectionHandlerPPC }; static void stub_XML_SetEndCdataSectionHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->endcdatahandler = (void *)regarray[9]; Self->XML_SetEndCdataSectionHandler(p->p, _68k_endcdatahandler); } struct EmuTrap stub_XML_SetEndCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndCdataSectionHandlerPPC }; static void stub_XML_SetCdataSectionHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startcdatahandler = (void *)regarray[9]; p->endcdatahandler = (void *)regarray[10]; Self->XML_SetCdataSectionHandler(p->p, _68k_startcdatahandler, _68k_endcdatahandler); } struct EmuTrap stub_XML_SetCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCdataSectionHandlerPPC }; static void stub_XML_SetDefaultHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->defaulthandler = (void *)regarray[9]; Self->XML_SetDefaultHandler(p->p, _68k_defaulthandler); } struct EmuTrap stub_XML_SetDefaultHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerPPC }; static void stub_XML_SetDefaultHandlerExpandPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->defaulthandlerexp = (void *)regarray[9]; Self->XML_SetDefaultHandlerExpand(p->p, _68k_defaulthandlerexp); } struct EmuTrap stub_XML_SetDefaultHandlerExpand = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerExpandPPC }; static void stub_XML_SetExternalEntityRefHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->extentrefhandler = (void *)regarray[9]; Self->XML_SetExternalEntityRefHandler(p->p, _68k_extentrefhandler); } struct EmuTrap stub_XML_SetExternalEntityRefHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerPPC }; static void stub_XML_SetExternalEntityRefHandlerArgPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->extenthandlerarg = (void *)regarray[9]; } struct EmuTrap stub_XML_SetExternalEntityRefHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerArgPPC }; static void stub_XML_SetUnknownEncodingHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->unknownenchandler = (void *)regarray[9]; p->enchandlerarg = (void *)regarray[10]; Self->XML_SetUnknownEncodingHandler(p->p, _68k_unknownenchandler, p); } struct EmuTrap stub_XML_SetUnknownEncodingHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnknownEncodingHandlerPPC }; static void stub_XML_SetStartNamespaceDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startnamespacehandler = (void *)regarray[9]; Self->XML_SetStartNamespaceDeclHandler(p->p, _68k_startnamespacehandler); } struct EmuTrap stub_XML_SetStartNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartNamespaceDeclHandlerPPC }; static void stub_XML_SetEndNamespaceDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->endnamespacehandler = (void *)regarray[9]; Self->XML_SetEndNamespaceDeclHandler(p->p, _68k_endnamespacehandler); } struct EmuTrap stub_XML_SetEndNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndNamespaceDeclHandlerPPC }; static void stub_XML_SetNamespaceDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startnamespacehandler = (void *)regarray[9]; p->endnamespacehandler = (void *)regarray[10]; Self->XML_SetNamespaceDeclHandler(p->p, _68k_startnamespacehandler, _68k_endnamespacehandler); } struct EmuTrap stub_XML_SetNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNamespaceDeclHandlerPPC }; static void stub_XML_SetXmlDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->xmldeclhandler = (void *)regarray[9]; Self->XML_SetXmlDeclHandler(p->p, _68k_xmldeclhandler); } struct EmuTrap stub_XML_SetXmlDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetXmlDeclHandlerPPC }; static void stub_XML_SetStartDoctypeDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startdoctypehandler = (void *)regarray[9]; Self->XML_SetStartDoctypeDeclHandler(p->p, _68k_startdoctypehandler); } struct EmuTrap stub_XML_SetStartDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartDoctypeDeclHandlerPPC }; static void stub_XML_SetEndDoctypeDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->enddoctypehandler = (void *)regarray[9]; Self->XML_SetEndDoctypeDeclHandler(p->p, _68k_enddoctypehandler); } struct EmuTrap stub_XML_SetEndDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndDoctypeDeclHandlerPPC }; static void stub_XML_SetDoctypeDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->startdoctypehandler = (void *)regarray[9]; p->enddoctypehandler = (void *)regarray[10]; Self->XML_SetDoctypeDeclHandler(p->p, _68k_startdoctypehandler, _68k_enddoctypehandler); } struct EmuTrap stub_XML_SetDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDoctypeDeclHandlerPPC }; static void stub_XML_SetElementDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->elementdeclhandler = (void *)regarray[9]; Self->XML_SetElementDeclHandler(p->p, _68k_elementdeclhandler); } struct EmuTrap stub_XML_SetElementDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementDeclHandlerPPC }; static void stub_XML_SetAttlistDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->attlistdeclhandler = (void *)regarray[9]; Self->XML_SetAttlistDeclHandler(p->p, _68k_attlistdeclhandler); } struct EmuTrap stub_XML_SetAttlistDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetAttlistDeclHandlerPPC }; static void stub_XML_SetEntityDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->entitydeclhandler = (void *)regarray[9]; Self->XML_SetEntityDeclHandler(p->p, _68k_entitydeclhandler); } struct EmuTrap stub_XML_SetEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEntityDeclHandlerPPC }; static void stub_XML_SetUnparsedEntityDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->unparseddeclhandler = (void *)regarray[9]; Self->XML_SetUnparsedEntityDeclHandler(p->p, _68k_unparseddeclhandler); } struct EmuTrap stub_XML_SetUnparsedEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnparsedEntityDeclHandlerPPC }; static void stub_XML_SetNotationDeclHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->notationdeclhandler = (void *)regarray[9]; Self->XML_SetNotationDeclHandler(p->p, _68k_notationdeclhandler); } struct EmuTrap stub_XML_SetNotationDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotationDeclHandlerPPC }; static void stub_XML_SetNotStandaloneHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->notstandalonehandler = (void *)regarray[9]; Self->XML_SetNotStandaloneHandler(p->p, _68k_notstandalonehandler); } struct EmuTrap stub_XML_SetNotStandaloneHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotStandaloneHandlerPPC }; static int stub_XML_GetErrorCodePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetErrorCode(p->p); } struct EmuTrap stub_XML_GetErrorCode = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetErrorCodePPC }; static const XML_LChar * stub_XML_ErrorStringPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; return Self->XML_ErrorString((int)regarray[0]); } struct EmuTrap stub_XML_ErrorString = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ErrorStringPPC }; static long stub_XML_GetCurrentByteIndexPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetCurrentByteIndex(p->p); } struct EmuTrap stub_XML_GetCurrentByteIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteIndexPPC }; static int stub_XML_GetCurrentLineNumberPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetCurrentLineNumber(p->p); } struct EmuTrap stub_XML_GetCurrentLineNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentLineNumberPPC }; static int stub_XML_GetCurrentColumnNumberPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetCurrentColumnNumber(p->p); } struct EmuTrap stub_XML_GetCurrentColumnNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentColumnNumberPPC }; static int stub_XML_GetCurrentByteCountPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetCurrentByteCount(p->p); } struct EmuTrap stub_XML_GetCurrentByteCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteCountPPC }; static const char * stub_XML_GetInputContextPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetInputContext(p->p, (int *)regarray[9], (int *)regarray[10]); } struct EmuTrap stub_XML_GetInputContext = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetInputContextPPC }; static void stub_XML_SetUserDataPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->handlerarg = (void *)regarray[9]; } struct EmuTrap stub_XML_SetUserData = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUserDataPPC }; static void stub_XML_DefaultCurrentPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_DefaultCurrent(p->p); } struct EmuTrap stub_XML_DefaultCurrent = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_DefaultCurrentPPC }; static void stub_XML_UseParserAsHandlerArgPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->handlerarg = p; } struct EmuTrap stub_XML_UseParserAsHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseParserAsHandlerArgPPC }; static int stub_XML_SetBasePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_SetBase(p->p, (const XML_Char *)regarray[9]); } struct EmuTrap stub_XML_SetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetBasePPC }; static const XML_Char * stub_XML_GetBasePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetBase(p->p); } struct EmuTrap stub_XML_GetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBasePPC }; static int stub_XML_GetSpecifiedAttributeCountPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetSpecifiedAttributeCount(p->p); } struct EmuTrap stub_XML_GetSpecifiedAttributeCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetSpecifiedAttributeCountPPC }; static int stub_XML_GetIdAttributeIndexPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_GetIdAttributeIndex(p->p); } struct EmuTrap stub_XML_GetIdAttributeIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetIdAttributeIndexPPC }; static int stub_XML_SetEncodingPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_SetEncoding(p->p, (const XML_Char *)regarray[9]); } struct EmuTrap stub_XML_SetEncoding = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEncodingPPC }; static int stub_XML_SetParamEntityParsingPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_SetParamEntityParsing(p->p, (enum XML_ParamEntityParsing)regarray[9]); } struct EmuTrap stub_XML_SetParamEntityParsing = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetParamEntityParsingPPC }; static void stub_XML_SetReturnNSTripletPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_SetReturnNSTriplet(p->p, (int)regarray[0]); } struct EmuTrap stub_XML_SetReturnNSTriplet = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetReturnNSTripletPPC }; static const XML_LChar * stub_XML_ExpatVersionPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; return Self->XML_ExpatVersion(); } struct EmuTrap stub_XML_ExpatVersion = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionPPC }; static XML_Expat_Version stub_XML_ExpatVersionInfoPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; return Self->XML_ExpatVersionInfo(); } struct EmuTrap stub_XML_ExpatVersionInfo = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionInfoPPC }; static int stub_XML_ParserResetPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_ParserReset(p->p, (const XML_Char *)regarray[9]); } struct EmuTrap stub_XML_ParserReset = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserResetPPC }; static void stub_XML_SetSkippedEntityHandlerPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; p->skippedentityhandler = (void *)regarray[9]; Self->XML_SetSkippedEntityHandler(p->p, _68k_skippedentityhandler); } struct EmuTrap stub_XML_SetSkippedEntityHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetSkippedEntityHandlerPPC }; static int stub_XML_UseForeignDTDPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_UseForeignDTD(p->p, (XML_Bool)regarray[0]); } struct EmuTrap stub_XML_UseForeignDTD = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseForeignDTDPPC }; static const XML_Feature * stub_XML_GetFeatureListPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; return Self->XML_GetFeatureList(); } struct EmuTrap stub_XML_GetFeatureList = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetFeatureListPPC }; static int stub_XML_StopParserPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_StopParser(p->p, (XML_Bool)regarray[0]); } struct EmuTrap stub_XML_StopParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_StopParserPPC }; static int stub_XML_ResumeParserPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_ResumeParser(p->p); } struct EmuTrap stub_XML_ResumeParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ResumeParserPPC }; static void stub_XML_GetParsingStatusPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_GetParsingStatus(p->p, (XML_ParsingStatus *)regarray[9]); } struct EmuTrap stub_XML_GetParsingStatus = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetParsingStatusPPC }; static void stub_XML_FreeContentModelPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_FreeContentModel(p->p, (XML_Content *)regarray[9]); } struct EmuTrap stub_XML_FreeContentModel = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_FreeContentModelPPC }; static void *stub_XML_MemMallocPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_MemMalloc(p->p, (size_t)regarray[0]); } struct EmuTrap stub_XML_MemMalloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemMallocPPC }; static void *stub_XML_MemReallocPPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; return Self->XML_MemRealloc(p->p, (void *)regarray[9], (size_t)regarray[0]); } struct EmuTrap stub_XML_MemRealloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemReallocPPC }; static void stub_XML_MemFreePPC(ULONG *regarray) { struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; M68kXML_Parser p = (M68kXML_Parser)regarray[8]; Self->XML_MemFree(p->p, (void *)regarray[9]); } struct EmuTrap stub_XML_MemFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemFreePPC }; ULONG VecTable68K[] = { (ULONG)&stub_Open, (ULONG)&stub_Close, (ULONG)&stub_Expunge, (ULONG)&stub_Reserved, (ULONG)&stub_XML_ParserCreate, (ULONG)&stub_XML_ParserCreateNS, (ULONG)&stub_XML_ParserCreate_MM, (ULONG)&stub_XML_ExternalEntityParserCreate, (ULONG)&stub_XML_ParserFree, (ULONG)&stub_XML_Parse, (ULONG)&stub_XML_ParseBuffer, (ULONG)&stub_XML_GetBuffer, (ULONG)&stub_XML_SetStartElementHandler, (ULONG)&stub_XML_SetEndElementHandler, (ULONG)&stub_XML_SetElementHandler, (ULONG)&stub_XML_SetCharacterDataHandler, (ULONG)&stub_XML_SetProcessingInstructionHandler, (ULONG)&stub_XML_SetCommentHandler, (ULONG)&stub_XML_SetStartCdataSectionHandler, (ULONG)&stub_XML_SetEndCdataSectionHandler, (ULONG)&stub_XML_SetCdataSectionHandler, (ULONG)&stub_XML_SetDefaultHandler, (ULONG)&stub_XML_SetDefaultHandlerExpand, (ULONG)&stub_XML_SetExternalEntityRefHandler, (ULONG)&stub_XML_SetExternalEntityRefHandlerArg, (ULONG)&stub_XML_SetUnknownEncodingHandler, (ULONG)&stub_XML_SetStartNamespaceDeclHandler, (ULONG)&stub_XML_SetEndNamespaceDeclHandler, (ULONG)&stub_XML_SetNamespaceDeclHandler, (ULONG)&stub_XML_SetXmlDeclHandler, (ULONG)&stub_XML_SetStartDoctypeDeclHandler, (ULONG)&stub_XML_SetEndDoctypeDeclHandler, (ULONG)&stub_XML_SetDoctypeDeclHandler, (ULONG)&stub_XML_SetElementDeclHandler, (ULONG)&stub_XML_SetAttlistDeclHandler, (ULONG)&stub_XML_SetEntityDeclHandler, (ULONG)&stub_XML_SetUnparsedEntityDeclHandler, (ULONG)&stub_XML_SetNotationDeclHandler, (ULONG)&stub_XML_SetNotStandaloneHandler, (ULONG)&stub_XML_GetErrorCode, (ULONG)&stub_XML_ErrorString, (ULONG)&stub_XML_GetCurrentByteIndex, (ULONG)&stub_XML_GetCurrentLineNumber, (ULONG)&stub_XML_GetCurrentColumnNumber, (ULONG)&stub_XML_GetCurrentByteCount, (ULONG)&stub_XML_GetInputContext, (ULONG)&stub_XML_SetUserData, (ULONG)&stub_XML_DefaultCurrent, (ULONG)&stub_XML_UseParserAsHandlerArg, (ULONG)&stub_XML_SetBase, (ULONG)&stub_XML_GetBase, (ULONG)&stub_XML_GetSpecifiedAttributeCount, (ULONG)&stub_XML_GetIdAttributeIndex, (ULONG)&stub_XML_SetEncoding, (ULONG)&stub_XML_SetParamEntityParsing, (ULONG)&stub_XML_SetReturnNSTriplet, (ULONG)&stub_XML_ExpatVersion, (ULONG)&stub_XML_ExpatVersionInfo, (ULONG)&stub_XML_ParserReset, (ULONG)&stub_XML_SetSkippedEntityHandler, (ULONG)&stub_XML_UseForeignDTD, (ULONG)&stub_XML_GetFeatureList, (ULONG)&stub_XML_StopParser, (ULONG)&stub_XML_ResumeParser, (ULONG)&stub_XML_GetParsingStatus, (ULONG)&stub_XML_FreeContentModel, (ULONG)&stub_XML_MemMalloc, (ULONG)&stub_XML_MemRealloc, (ULONG)&stub_XML_MemFree, (ULONG)-1 }; astropy-0.3/cextern/expat/amiga/expat_base.h0000644000175000017500000000256312243255342017340 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #ifndef EXPAT_BASE_H #define EXPAT_BASE_H #include #include #include #include struct ExpatBase { struct Library libNode; uint16 pad; BPTR SegList; struct ExecIFace *IExec; }; #endif astropy-0.3/cextern/expat/amiga/include/0000755000175000017500000000000012243263747016501 5ustar oleoleastropy-0.3/cextern/expat/amiga/include/interfaces/0000755000175000017500000000000012243263747020624 5ustar oleoleastropy-0.3/cextern/expat/amiga/include/interfaces/expat.h0000755000175000017500000001737212243255342022123 0ustar oleole#ifndef EXPAT_INTERFACE_DEF_H #define EXPAT_INTERFACE_DEF_H /* ** This file was machine generated by idltool 51.6. ** Do not edit */ #ifndef EXEC_TYPES_H #include #endif #ifndef EXEC_EXEC_H #include #endif #ifndef EXEC_INTERFACES_H #include #endif #ifndef LIBRARIES_EXPAT_H #include #endif struct ExpatIFace { struct InterfaceData Data; uint32 APICALL (*Obtain)(struct ExpatIFace *Self); uint32 APICALL (*Release)(struct ExpatIFace *Self); void APICALL (*Expunge)(struct ExpatIFace *Self); struct Interface * APICALL (*Clone)(struct ExpatIFace *Self); XML_Parser APICALL (*XML_ParserCreate)(struct ExpatIFace *Self, const XML_Char * encodingName); XML_Parser APICALL (*XML_ParserCreateNS)(struct ExpatIFace *Self, const XML_Char * encodingName, XML_Char nsSep); XML_Parser APICALL (*XML_ParserCreate_MM)(struct ExpatIFace *Self, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); XML_Parser APICALL (*XML_ExternalEntityParserCreate)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); void APICALL (*XML_ParserFree)(struct ExpatIFace *Self, XML_Parser parser); enum XML_Status APICALL (*XML_Parse)(struct ExpatIFace *Self, XML_Parser parser, const char * s, int len, int isFinal); enum XML_Status APICALL (*XML_ParseBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len, int isFinal); void * APICALL (*XML_GetBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len); void APICALL (*XML_SetStartElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start); void APICALL (*XML_SetEndElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndElementHandler end); void APICALL (*XML_SetElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void APICALL (*XML_SetCharacterDataHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CharacterDataHandler handler); void APICALL (*XML_SetProcessingInstructionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ProcessingInstructionHandler handler); void APICALL (*XML_SetCommentHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CommentHandler handler); void APICALL (*XML_SetStartCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start); void APICALL (*XML_SetEndCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndCdataSectionHandler end); void APICALL (*XML_SetCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); void APICALL (*XML_SetDefaultHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); void APICALL (*XML_SetDefaultHandlerExpand)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); void APICALL (*XML_SetExternalEntityRefHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ExternalEntityRefHandler handler); void APICALL (*XML_SetExternalEntityRefHandlerArg)(struct ExpatIFace *Self, XML_Parser parser, void * arg); void APICALL (*XML_SetUnknownEncodingHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); void APICALL (*XML_SetStartNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start); void APICALL (*XML_SetEndNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndNamespaceDeclHandler end); void APICALL (*XML_SetNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void APICALL (*XML_SetXmlDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_XmlDeclHandler handler); void APICALL (*XML_SetStartDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start); void APICALL (*XML_SetEndDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndDoctypeDeclHandler end); void APICALL (*XML_SetDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); void APICALL (*XML_SetElementDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ElementDeclHandler eldecl); void APICALL (*XML_SetAttlistDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_AttlistDeclHandler attdecl); void APICALL (*XML_SetEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EntityDeclHandler handler); void APICALL (*XML_SetUnparsedEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); void APICALL (*XML_SetNotationDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotationDeclHandler handler); void APICALL (*XML_SetNotStandaloneHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotStandaloneHandler handler); enum XML_Error APICALL (*XML_GetErrorCode)(struct ExpatIFace *Self, XML_Parser parser); const XML_LChar * APICALL (*XML_ErrorString)(struct ExpatIFace *Self, enum XML_Error code); long APICALL (*XML_GetCurrentByteIndex)(struct ExpatIFace *Self, XML_Parser parser); int APICALL (*XML_GetCurrentLineNumber)(struct ExpatIFace *Self, XML_Parser parser); int APICALL (*XML_GetCurrentColumnNumber)(struct ExpatIFace *Self, XML_Parser parser); int APICALL (*XML_GetCurrentByteCount)(struct ExpatIFace *Self, XML_Parser parser); const char * APICALL (*XML_GetInputContext)(struct ExpatIFace *Self, XML_Parser parser, int * offset, int * size); void APICALL (*XML_SetUserData)(struct ExpatIFace *Self, XML_Parser parser, void * userData); void APICALL (*XML_DefaultCurrent)(struct ExpatIFace *Self, XML_Parser parser); void APICALL (*XML_UseParserAsHandlerArg)(struct ExpatIFace *Self, XML_Parser parser); enum XML_Status APICALL (*XML_SetBase)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * base); const XML_Char * APICALL (*XML_GetBase)(struct ExpatIFace *Self, XML_Parser parser); int APICALL (*XML_GetSpecifiedAttributeCount)(struct ExpatIFace *Self, XML_Parser parser); int APICALL (*XML_GetIdAttributeIndex)(struct ExpatIFace *Self, XML_Parser parser); enum XML_Status APICALL (*XML_SetEncoding)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); int APICALL (*XML_SetParamEntityParsing)(struct ExpatIFace *Self, XML_Parser parser, enum XML_ParamEntityParsing parsing); void APICALL (*XML_SetReturnNSTriplet)(struct ExpatIFace *Self, XML_Parser parser, int do_nst); const XML_LChar * APICALL (*XML_ExpatVersion)(struct ExpatIFace *Self); XML_Expat_Version APICALL (*XML_ExpatVersionInfo)(struct ExpatIFace *Self); XML_Bool APICALL (*XML_ParserReset)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); void APICALL (*XML_SetSkippedEntityHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_SkippedEntityHandler handler); enum XML_Error APICALL (*XML_UseForeignDTD)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool useDTD); const XML_Feature * APICALL (*XML_GetFeatureList)(struct ExpatIFace *Self); enum XML_Status APICALL (*XML_StopParser)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool resumable); enum XML_Status APICALL (*XML_ResumeParser)(struct ExpatIFace *Self, XML_Parser parser); void APICALL (*XML_GetParsingStatus)(struct ExpatIFace *Self, XML_Parser parser, XML_ParsingStatus * status); void APICALL (*XML_FreeContentModel)(struct ExpatIFace *Self, XML_Parser parser, XML_Content * model); void * APICALL (*XML_MemMalloc)(struct ExpatIFace *Self, XML_Parser parser, size_t size); void * APICALL (*XML_MemRealloc)(struct ExpatIFace *Self, XML_Parser parser, void * ptr, size_t size); void APICALL (*XML_MemFree)(struct ExpatIFace *Self, XML_Parser parser, void * ptr); }; #endif /* EXPAT_INTERFACE_DEF_H */ astropy-0.3/cextern/expat/amiga/include/inline4/0000755000175000017500000000000012243263747020043 5ustar oleoleastropy-0.3/cextern/expat/amiga/include/inline4/expat.h0000755000175000017500000001463512243255342021341 0ustar oleole#ifndef INLINE4_EXPAT_H #define INLINE4_EXPAT_H /* ** This file was auto generated by idltool 51.6. ** ** It provides compatibility to OS3 style library ** calls by substituting functions. ** ** Do not edit manually. */ #ifndef EXEC_TYPES_H #include #endif #ifndef EXEC_EXEC_H #include #endif #ifndef EXEC_INTERFACES_H #include #endif #ifndef LIBRARIES_EXPAT_H #include #endif /* Inline macros for Interface "main" */ #define XML_ParserCreate(encodingName) IExpat->XML_ParserCreate(encodingName) #define XML_ParserCreateNS(encodingName, nsSep) IExpat->XML_ParserCreateNS(encodingName, nsSep) #define XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) IExpat->XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) #define XML_ExternalEntityParserCreate(parser, context, encoding) IExpat->XML_ExternalEntityParserCreate(parser, context, encoding) #define XML_ParserFree(parser) IExpat->XML_ParserFree(parser) #define XML_Parse(parser, s, len, isFinal) IExpat->XML_Parse(parser, s, len, isFinal) #define XML_ParseBuffer(parser, len, isFinal) IExpat->XML_ParseBuffer(parser, len, isFinal) #define XML_GetBuffer(parser, len) IExpat->XML_GetBuffer(parser, len) #define XML_SetStartElementHandler(parser, start) IExpat->XML_SetStartElementHandler(parser, start) #define XML_SetEndElementHandler(parser, end) IExpat->XML_SetEndElementHandler(parser, end) #define XML_SetElementHandler(parser, start, end) IExpat->XML_SetElementHandler(parser, start, end) #define XML_SetCharacterDataHandler(parser, handler) IExpat->XML_SetCharacterDataHandler(parser, handler) #define XML_SetProcessingInstructionHandler(parser, handler) IExpat->XML_SetProcessingInstructionHandler(parser, handler) #define XML_SetCommentHandler(parser, handler) IExpat->XML_SetCommentHandler(parser, handler) #define XML_SetStartCdataSectionHandler(parser, start) IExpat->XML_SetStartCdataSectionHandler(parser, start) #define XML_SetEndCdataSectionHandler(parser, end) IExpat->XML_SetEndCdataSectionHandler(parser, end) #define XML_SetCdataSectionHandler(parser, start, end) IExpat->XML_SetCdataSectionHandler(parser, start, end) #define XML_SetDefaultHandler(parser, handler) IExpat->XML_SetDefaultHandler(parser, handler) #define XML_SetDefaultHandlerExpand(parser, handler) IExpat->XML_SetDefaultHandlerExpand(parser, handler) #define XML_SetExternalEntityRefHandler(parser, handler) IExpat->XML_SetExternalEntityRefHandler(parser, handler) #define XML_SetExternalEntityRefHandlerArg(parser, arg) IExpat->XML_SetExternalEntityRefHandlerArg(parser, arg) #define XML_SetUnknownEncodingHandler(parser, handler, data) IExpat->XML_SetUnknownEncodingHandler(parser, handler, data) #define XML_SetStartNamespaceDeclHandler(parser, start) IExpat->XML_SetStartNamespaceDeclHandler(parser, start) #define XML_SetEndNamespaceDeclHandler(parser, end) IExpat->XML_SetEndNamespaceDeclHandler(parser, end) #define XML_SetNamespaceDeclHandler(parser, start, end) IExpat->XML_SetNamespaceDeclHandler(parser, start, end) #define XML_SetXmlDeclHandler(parser, handler) IExpat->XML_SetXmlDeclHandler(parser, handler) #define XML_SetStartDoctypeDeclHandler(parser, start) IExpat->XML_SetStartDoctypeDeclHandler(parser, start) #define XML_SetEndDoctypeDeclHandler(parser, end) IExpat->XML_SetEndDoctypeDeclHandler(parser, end) #define XML_SetDoctypeDeclHandler(parser, start, end) IExpat->XML_SetDoctypeDeclHandler(parser, start, end) #define XML_SetElementDeclHandler(parser, eldecl) IExpat->XML_SetElementDeclHandler(parser, eldecl) #define XML_SetAttlistDeclHandler(parser, attdecl) IExpat->XML_SetAttlistDeclHandler(parser, attdecl) #define XML_SetEntityDeclHandler(parser, handler) IExpat->XML_SetEntityDeclHandler(parser, handler) #define XML_SetUnparsedEntityDeclHandler(parser, handler) IExpat->XML_SetUnparsedEntityDeclHandler(parser, handler) #define XML_SetNotationDeclHandler(parser, handler) IExpat->XML_SetNotationDeclHandler(parser, handler) #define XML_SetNotStandaloneHandler(parser, handler) IExpat->XML_SetNotStandaloneHandler(parser, handler) #define XML_GetErrorCode(parser) IExpat->XML_GetErrorCode(parser) #define XML_ErrorString(code) IExpat->XML_ErrorString(code) #define XML_GetCurrentByteIndex(parser) IExpat->XML_GetCurrentByteIndex(parser) #define XML_GetCurrentLineNumber(parser) IExpat->XML_GetCurrentLineNumber(parser) #define XML_GetCurrentColumnNumber(parser) IExpat->XML_GetCurrentColumnNumber(parser) #define XML_GetCurrentByteCount(parser) IExpat->XML_GetCurrentByteCount(parser) #define XML_GetInputContext(parser, offset, size) IExpat->XML_GetInputContext(parser, offset, size) #define XML_SetUserData(parser, userData) IExpat->XML_SetUserData(parser, userData) #define XML_DefaultCurrent(parser) IExpat->XML_DefaultCurrent(parser) #define XML_UseParserAsHandlerArg(parser) IExpat->XML_UseParserAsHandlerArg(parser) #define XML_SetBase(parser, base) IExpat->XML_SetBase(parser, base) #define XML_GetBase(parser) IExpat->XML_GetBase(parser) #define XML_GetSpecifiedAttributeCount(parser) IExpat->XML_GetSpecifiedAttributeCount(parser) #define XML_GetIdAttributeIndex(parser) IExpat->XML_GetIdAttributeIndex(parser) #define XML_SetEncoding(parser, encoding) IExpat->XML_SetEncoding(parser, encoding) #define XML_SetParamEntityParsing(parser, parsing) IExpat->XML_SetParamEntityParsing(parser, parsing) #define XML_SetReturnNSTriplet(parser, do_nst) IExpat->XML_SetReturnNSTriplet(parser, do_nst) #define XML_ExpatVersion() IExpat->XML_ExpatVersion() #define XML_ExpatVersionInfo() IExpat->XML_ExpatVersionInfo() #define XML_ParserReset(parser, encoding) IExpat->XML_ParserReset(parser, encoding) #define XML_SetSkippedEntityHandler(parser, handler) IExpat->XML_SetSkippedEntityHandler(parser, handler) #define XML_UseForeignDTD(parser, useDTD) IExpat->XML_UseForeignDTD(parser, useDTD) #define XML_GetFeatureList() IExpat->XML_GetFeatureList() #define XML_StopParser(parser, resumable) IExpat->XML_StopParser(parser, resumable) #define XML_ResumeParser(parser) IExpat->XML_ResumeParser(parser) #define XML_GetParsingStatus(parser, status) IExpat->XML_GetParsingStatus(parser, status) #define XML_FreeContentModel(parser, model) IExpat->XML_FreeContentModel(parser, model) #define XML_MemMalloc(parser, size) IExpat->XML_MemMalloc(parser, size) #define XML_MemRealloc(parser, ptr, size) IExpat->XML_MemRealloc(parser, ptr, size) #define XML_MemFree(parser, ptr) IExpat->XML_MemFree(parser, ptr) #endif /* INLINE4_EXPAT_H */ astropy-0.3/cextern/expat/amiga/include/libraries/0000755000175000017500000000000012243263747020455 5ustar oleoleastropy-0.3/cextern/expat/amiga/include/libraries/expat.h0000755000175000017500000004020412243255342021742 0ustar oleole#ifndef LIBRARIES_EXPAT_H #define LIBRARIES_EXPAT_H /* ** Copyright (c) 2001-2007 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ /****************************************************************************/ #ifdef __cplusplus extern "C" { #endif #ifdef __GNUC__ #ifdef __PPC__ #pragma pack(2) #endif #elif defined(__VBCC__) #pragma amiga-align #endif /****************************************************************************/ #include #ifndef XMLCALL #define XMLCALL #endif typedef char XML_Char; typedef char XML_LChar; typedef long XML_Index; typedef unsigned long XML_Size; struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; typedef unsigned char XML_Bool; #define XML_TRUE ((XML_Bool) 1) #define XML_FALSE ((XML_Bool) 0) enum XML_Status { XML_STATUS_ERROR = 0, #define XML_STATUS_ERROR XML_STATUS_ERROR XML_STATUS_OK = 1, #define XML_STATUS_OK XML_STATUS_OK XML_STATUS_SUSPENDED = 2, #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED }; enum XML_Error { XML_ERROR_NONE, XML_ERROR_NO_MEMORY, XML_ERROR_SYNTAX, XML_ERROR_NO_ELEMENTS, XML_ERROR_INVALID_TOKEN, XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_PARTIAL_CHAR, XML_ERROR_TAG_MISMATCH, XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_ASYNC_ENTITY, XML_ERROR_BAD_CHAR_REF, XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_MISPLACED_XML_PI, XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_INCORRECT_ENCODING, XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_NOT_STANDALONE, XML_ERROR_UNEXPECTED_STATE, XML_ERROR_ENTITY_DECLARED_IN_PE, XML_ERROR_FEATURE_REQUIRES_XML_DTD, XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, XML_ERROR_UNBOUND_PREFIX, XML_ERROR_UNDECLARING_PREFIX, XML_ERROR_INCOMPLETE_PE, XML_ERROR_XML_DECL, XML_ERROR_TEXT_DECL, XML_ERROR_PUBLICID, XML_ERROR_SUSPENDED, XML_ERROR_NOT_SUSPENDED, XML_ERROR_ABORTED, XML_ERROR_FINISHED, XML_ERROR_SUSPEND_PE, XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, XML_ERROR_RESERVED_NAMESPACE_URI }; enum XML_Content_Type { XML_CTYPE_EMPTY = 1, XML_CTYPE_ANY, XML_CTYPE_MIXED, XML_CTYPE_NAME, XML_CTYPE_CHOICE, XML_CTYPE_SEQ }; enum XML_Content_Quant { XML_CQUANT_NONE, XML_CQUANT_OPT, XML_CQUANT_REP, XML_CQUANT_PLUS }; typedef struct XML_cp XML_Content; struct XML_cp { enum XML_Content_Type type; enum XML_Content_Quant quant; XML_Char * name; unsigned int numchildren; XML_Content * children; }; typedef void (*XML_ElementDeclHandler) (void *userData, const XML_Char *name, XML_Content *model); void XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl); typedef void (*XML_AttlistDeclHandler) ( void *userData, const XML_Char *elname, const XML_Char *attname, const XML_Char *att_type, const XML_Char *dflt, int isrequired); void XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl); typedef void (*XML_XmlDeclHandler) (void *userData, const XML_Char *version, const XML_Char *encoding, int standalone); void XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl); typedef struct { void *(*malloc_fcn)(size_t size); void *(*realloc_fcn)(void *ptr, size_t size); void (*free_fcn)(void *ptr); } XML_Memory_Handling_Suite; XML_Parser XML_ParserCreate(const XML_Char *encoding); XML_Parser XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); XML_Parser XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator); XML_Bool XML_ParserReset(XML_Parser parser, const XML_Char *encoding); typedef void (*XML_StartElementHandler) (void *userData, const XML_Char *name, const XML_Char **atts); typedef void (*XML_EndElementHandler) (void *userData, const XML_Char *name); typedef void (*XML_CharacterDataHandler) (void *userData, const XML_Char *s, int len); typedef void (*XML_ProcessingInstructionHandler) ( void *userData, const XML_Char *target, const XML_Char *data); typedef void (*XML_CommentHandler) (void *userData, const XML_Char *data); typedef void (*XML_StartCdataSectionHandler) (void *userData); typedef void (*XML_EndCdataSectionHandler) (void *userData); typedef void (*XML_DefaultHandler) (void *userData, const XML_Char *s, int len); typedef void (*XML_StartDoctypeDeclHandler) ( void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset); typedef void (*XML_EndDoctypeDeclHandler)(void *userData); typedef void (*XML_EntityDeclHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); void XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler); typedef void (*XML_UnparsedEntityDeclHandler) ( void *userData, const XML_Char *entityName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName); typedef void (*XML_NotationDeclHandler) ( void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); typedef void (*XML_StartNamespaceDeclHandler) ( void *userData, const XML_Char *prefix, const XML_Char *uri); typedef void (*XML_EndNamespaceDeclHandler) ( void *userData, const XML_Char *prefix); typedef int (*XML_NotStandaloneHandler) (void *userData); typedef int (*XML_ExternalEntityRefHandler) ( XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); typedef void (*XML_SkippedEntityHandler) ( void *userData, const XML_Char *entityName, int is_parameter_entity); typedef struct { int map[256]; void *data; int (*convert)(void *data, const char *s); void (*release)(void *data); } XML_Encoding; typedef int (*XML_UnknownEncodingHandler) ( void *encodingHandlerData, const XML_Char *name, XML_Encoding *info); void XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); void XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler); void XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler); void XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler); void XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler); void XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler); void XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); void XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start); void XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end); void XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler); void XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); void XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); void XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start); void XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end); void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); void XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler); void XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); void XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start); void XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end); void XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler); void XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler); void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg); void XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler); void XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *encodingHandlerData); void XML_DefaultCurrent(XML_Parser parser); void XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); void XML_SetUserData(XML_Parser parser, void *userData); #define XML_GetUserData(parser) (*(void **)(parser)) enum XML_Status XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); void XML_UseParserAsHandlerArg(XML_Parser parser); enum XML_Error XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); enum XML_Status XML_SetBase(XML_Parser parser, const XML_Char *base); const XML_Char * XML_GetBase(XML_Parser parser); int XML_GetSpecifiedAttributeCount(XML_Parser parser); int XML_GetIdAttributeIndex(XML_Parser parser); enum XML_Status XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); void * XML_GetBuffer(XML_Parser parser, int len); enum XML_Status XML_ParseBuffer(XML_Parser parser, int len, int isFinal); enum XML_Status XML_StopParser(XML_Parser parser, XML_Bool resumable); enum XML_Status XML_ResumeParser(XML_Parser parser); enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED }; typedef struct { enum XML_Parsing parsing; XML_Bool finalBuffer; } XML_ParsingStatus; void XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); XML_Parser XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding); enum XML_ParamEntityParsing { XML_PARAM_ENTITY_PARSING_NEVER, XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, XML_PARAM_ENTITY_PARSING_ALWAYS }; int XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing parsing); enum XML_Error XML_GetErrorCode(XML_Parser parser); int XML_GetCurrentLineNumber(XML_Parser parser); int XML_GetCurrentColumnNumber(XML_Parser parser); long XML_GetCurrentByteIndex(XML_Parser parser); int XML_GetCurrentByteCount(XML_Parser parser); const char * XML_GetInputContext(XML_Parser parser, int *offset, int *size); #define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber #define XML_GetErrorByteIndex XML_GetCurrentByteIndex void XML_FreeContentModel(XML_Parser parser, XML_Content *model); void * XML_MemMalloc(XML_Parser parser, size_t size); void * XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); void XML_MemFree(XML_Parser parser, void *ptr); void XML_ParserFree(XML_Parser parser); const XML_LChar * XML_ErrorString(enum XML_Error code); const XML_LChar * XML_ExpatVersion(void); typedef struct { int major; int minor; int micro; } XML_Expat_Version; XML_Expat_Version XML_ExpatVersionInfo(void); enum XML_FeatureEnum { XML_FEATURE_END = 0, XML_FEATURE_UNICODE, XML_FEATURE_UNICODE_WCHAR_T, XML_FEATURE_DTD, XML_FEATURE_CONTEXT_BYTES, XML_FEATURE_MIN_SIZE, XML_FEATURE_SIZEOF_XML_CHAR, XML_FEATURE_SIZEOF_XML_LCHAR, XML_FEATURE_NS, XML_FEATURE_LARGE_SIZE }; typedef struct { enum XML_FeatureEnum feature; const XML_LChar *name; long int value; } XML_Feature; const XML_Feature * XML_GetFeatureList(void); #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 0 #define XML_MICRO_VERSION 1 /****************************************************************************/ #ifdef __GNUC__ #ifdef __PPC__ #pragma pack() #endif #elif defined(__VBCC__) #pragma default-align #endif #ifdef __cplusplus } #endif /****************************************************************************/ #endif /* EXPAT_EXPAT_H */ astropy-0.3/cextern/expat/amiga/include/proto/0000755000175000017500000000000012243263747017644 5ustar oleoleastropy-0.3/cextern/expat/amiga/include/proto/expat.h0000755000175000017500000000246712243255342021142 0ustar oleole#ifndef PROTO_EXPAT_H #define PROTO_EXPAT_H #ifndef LIBRARIES_EXPAT_H #include #endif /****************************************************************************/ #ifndef __NOLIBBASE__ #ifndef __USE_BASETYPE__ extern struct Library * ExpatBase; #else extern struct Library * ExpatBase; #endif /* __USE_BASETYPE__ */ #endif /* __NOLIBBASE__ */ /****************************************************************************/ #ifdef __amigaos4__ #include #ifdef __USE_INLINE__ #include #endif /* __USE_INLINE__ */ #ifndef CLIB_EXPAT_PROTOS_H #define CLIB_EXPAT_PROTOS_H 1 #endif /* CLIB_EXPAT_PROTOS_H */ #ifndef __NOGLOBALIFACE__ extern struct ExpatIFace *IExpat; #endif /* __NOGLOBALIFACE__ */ #else /* __amigaos4__ */ #ifndef CLIB_EXPAT_PROTOS_H #include #endif /* CLIB_EXPAT_PROTOS_H */ #if defined(__GNUC__) #ifndef __PPC__ #include #else #include #endif /* __PPC__ */ #elif defined(__VBCC__) #ifndef __PPC__ #include #endif /* __PPC__ */ #else #include #endif /* __GNUC__ */ #endif /* __amigaos4__ */ /****************************************************************************/ #endif /* PROTO_EXPAT_H */ astropy-0.3/cextern/expat/amiga/expat_68k.h0000755000175000017500000001004512243255342017033 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #ifndef EXPAT_68K_H #define EXPAT_68K_H #ifndef LIBRARIES_EXPAT_H #include #endif typedef struct M68kXML_ParserStruct { XML_Parser p; struct ExecIFace *IExec; void *handlerarg; void *extenthandlerarg; void *enchandlerarg; void *startelementhandler; void *endelementhandler; void *chardatahandler; void *procinsthandler; void *commenthandler; void *startcdatahandler; void *endcdatahandler; void *defaulthandler; void *defaulthandlerexp; void *extentrefhandler; void *unknownenchandler; void *startnamespacehandler; void *endnamespacehandler; void *xmldeclhandler; void *startdoctypehandler; void *enddoctypehandler; void *elementdeclhandler; void *attlistdeclhandler; void *entitydeclhandler; void *unparseddeclhandler; void *notationdeclhandler; void *notstandalonehandler; void *skippedentityhandler; } *M68kXML_Parser; /* expat_68k_handler_stubs.c */ void _68k_startelementhandler(void *userdata, const char *name, const char **attrs); void _68k_endelementhandler(void *userdata, const char *name); void _68k_chardatahandler(void *userdata, const char *s, int len); void _68k_procinsthandler(void *userdata, const char *target, const char *data); void _68k_commenthandler(void *userdata, const char *data); void _68k_startcdatahandler(void *userdata); void _68k_endcdatahandler(void *userdata); void _68k_defaulthandler(void *userdata, const char *s, int len); void _68k_defaulthandlerexp(void *userdata, const char *s, int len); int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, const char *sysid, const char *pubid); int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info); void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri); void _68k_endnamespacehandler(void *userdata, const char *prefix); void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone); void _68k_startdoctypehandler(void *userdata, const char *doctypename, const char *sysid, const char *pubid, int has_internal_subset); void _68k_enddoctypehandler(void *userdata); void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model); void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, const char *att_type, const char *dflt, int isrequired); void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, const char *value, int value_length, const char *base, const char *sysid, const char *pubid, const char *notationname); void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, const char *sysid, const char *pubid, const char *notationname); void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, const char *sysid, const char *pubid); int _68k_notstandalonehandler(void *userdata); void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity); #endif astropy-0.3/cextern/expat/amiga/expat_68k_handler_stubs.c0000755000175000017500000001512112243255342021743 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #ifdef __USE_INLINE__ #undef __USE_INLINE__ #endif #include "expat_68k.h" #include #include #include static uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) { uint32 res = 0; va_list vargs; va_startlinear(vargs, num_args); uint32 *args = va_getlinearva(vargs, uint32 *); uint8 *stack = IExec->AllocVec(4096, MEMF_SHARED); if (stack) { uint32 *sp = (uint32 *)(stack + 4096); args += num_args; while (num_args--) { *--sp = *--args; } res = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END); IExec->FreeVec(stack); } va_end(vargs); return res; } void _68k_startelementhandler(void *userdata, const char *name, const char **attrs) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs); } void _68k_endelementhandler(void *userdata, const char *name) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name); } void _68k_chardatahandler(void *userdata, const char *s, int len) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len); } void _68k_procinsthandler(void *userdata, const char *target, const char *data) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data); } void _68k_commenthandler(void *userdata, const char *data) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data); } void _68k_startcdatahandler(void *userdata) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg); } void _68k_endcdatahandler(void *userdata) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg); } void _68k_defaulthandler(void *userdata, const char *s, int len) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len); } void _68k_defaulthandlerexp(void *userdata, const char *s, int len) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len); } int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, const char *sysid, const char *pubid) { M68kXML_Parser p = XML_GetUserData(parser); void *arg = p->extenthandlerarg; return (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid); } int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) { M68kXML_Parser p = enchandlerdata; return (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info); } void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri); } void _68k_endnamespacehandler(void *userdata, const char *prefix) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix); } void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone); } void _68k_startdoctypehandler(void *userdata, const char *doctypename, const char *sysid, const char *pubid, int has_internal_subset) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset); } void _68k_enddoctypehandler(void *userdata) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg); } void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model); } void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, const char *att_type, const char *dflt, int isrequired) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired); } void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, const char *value, int value_length, const char *base, const char *sysid, const char *pubid, const char *notationname) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity, value, value_length, base, sysid, pubid, notationname); } void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, const char *sysid, const char *pubid, const char *notationname) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname); } void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, const char *sysid, const char *pubid) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid); } int _68k_notstandalonehandler(void *userdata) { M68kXML_Parser p = userdata; return (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg); } void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) { M68kXML_Parser p = userdata; call_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity); } astropy-0.3/cextern/expat/amiga/Makefile0000755000175000017500000002427312243255342016521 0ustar oleole# # Makefile for AmigaOS # .PHONY: help all check clean package .PHONY: clib2 newlib library so vpath %.c ../lib ../examples ../xmlwf ../tests ../tests/benchmark vpath %.h ../lib ../tests ############################################################################# help: @echo "Requires:" @echo " AmigaOS 4.x" @echo " SDK 53.13" @echo "" @echo "Targets:" @echo " all - make libraries, xmlwf, examples and runs tests" @echo " install - install expat libraries and tools into SDK" @echo " clean - clean object files" @echo " check - run all the tests" @echo " package - prepare distribution archive" all: clib2 newlib library so check clib2: clib2/libexpat.a clib2/xmlwf clib2/elements clib2/outline clib2/runtests clib2/benchmark newlib: newlib/libexpat.a newlib/xmlwf newlib/elements newlib/outline newlib/runtests newlib/benchmark library: libs/expat.library libs/xmlwf libs/elements libs/outline libs/runtests libs/benchmark so: so/libexpat.so so/xmlwf so/elements so/outline so/runtests so/benchmark check: clib2/runtests newlib/runtests libs/runtests so/runtests clib2/runtests newlib/runtests libs/runtests so/runtests clean: -delete clib2/#?.o quiet -delete newlib/#?.o quiet -delete libs/#?.o quiet -delete so/#?.o quiet package: $(MAKE) all -delete T:expat all force quiet makedir all T:expat/Workbench/Libs copy clone libs/expat.library T:expat/Workbench/Libs makedir all T:expat/Workbench/SObjs copy clone so/libexpat.so T:expat/Workbench/SObjs makedir all T:expat/SDK/Local/C copy clone libs/xmlwf T:expat/SDK/Local/C makedir all T:expat/SDK/Local/clib2/lib copy clone clib2/libexpat.a T:expat/SDK/Local/clib2/lib makedir all T:expat/SDK/Local/newlib/lib copy clone newlib/libexpat.a T:expat/SDK/Local/newlib/lib makedir all T:expat/SDK/Local/common/include copy clone /lib/expat.h /lib/expat_external.h T:expat/SDK/Local/common/include makedir all T:expat/SDK/Include/include_h/inline4 copy clone include/inline4/expat.h T:expat/SDK/Include/include_h/inline4 makedir all T:expat/SDK/Include/include_h/interfaces copy clone include/interfaces/expat.h T:expat/SDK/Include/include_h/interfaces makedir all T:expat/SDK/Include/include_h/libraries copy clone include/libraries/expat.h T:expat/SDK/Include/include_h/libraries makedir all T:expat/SDK/Include/include_h/proto copy clone include/proto/expat.h T:expat/SDK/Include/include_h/proto makedir all T:expat/SDK/Documentation/Libs/Expat copy clone /COPYING T:expat/SDK/Documentation/Libs/Expat copy clone /README T:expat/SDK/Documentation/Libs/Expat copy clone README.txt T:expat/SDK/Documentation/Libs/Expat/README.AmigaOS -delete expat.lha lha -r a expat.lha T:expat ############################################################################# CC := gcc LIBTOOL := ar STRIP := strip CFLAGS := -DNDEBUG -O3 LTFLAGS := -crs STRIPFLAGS := -R.comment ############################################################################# clib2/libexpat.a: clib2/xmlparse.o clib2/xmltok.o clib2/xmlrole.o $(LIBTOOL) $(LTFLAGS) $@ $^ protect $@ -e clib2/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ expat_external.h internal.h amigaconfig.h clib2/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ internal.h amigaconfig.h clib2/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ expat_external.h internal.h amigaconfig.h ############################################################################# clib2/xmlwf: clib2/xmlwf.o clib2/xmlfile.o clib2/codepage.o clib2/readfilemap.o $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a $(STRIP) $(STRIPFLAGS) $@ clib2/xmlwf.o: xmlwf.c clib2/xmlfile.o: xmlfile.c clib2/codepage.o: codepage.c clib2/readfilemap.o: readfilemap.c ############################################################################# clib2/elements: clib2/elements.o $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a $(STRIP) $(STRIPFLAGS) $@ clib2/elements.o: elements.c ############################################################################# clib2/outline: clib2/outline.o $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a $(STRIP) $(STRIPFLAGS) $@ clib2/outline.o: outline.c ############################################################################# clib2/runtests: clib2/runtests.o clib2/chardata.o clib2/minicheck.o $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a clib2/chardata.o: chardata.c chardata.h clib2/minicheck.o: minicheck.c minicheck.h clib2/runtests.o: runtests.c chardata.h ############################################################################# clib2/benchmark: clib2/benchmark.o $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a -lm clib2/benchmark.o: benchmark.c ############################################################################# newlib/libexpat.a: newlib/xmlparse.o newlib/xmltok.o newlib/xmlrole.o $(LIBTOOL) $(LTFLAGS) $@ $^ protect $@ -e newlib/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ expat_external.h internal.h amigaconfig.h newlib/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ internal.h amigaconfig.h newlib/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ expat_external.h internal.h amigaconfig.h ############################################################################# newlib/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a $(STRIP) $(STRIPFLAGS) $@ newlib/xmlwf.o: xmlwf.c newlib/xmlfile.o: xmlfile.c newlib/codepage.o: codepage.c newlib/readfilemap.o: readfilemap.c ############################################################################# newlib/elements: newlib/elements.o $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a $(STRIP) $(STRIPFLAGS) $@ newlib/elements.o: elements.c ############################################################################# newlib/outline: newlib/outline.o $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a $(STRIP) $(STRIPFLAGS) $@ newlib/outline.o: outline.c ############################################################################# newlib/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a newlib/chardata.o: chardata.c chardata.h newlib/minicheck.o: minicheck.c minicheck.h newlib/runtests.o: runtests.c chardata.h ############################################################################# newlib/benchmark: newlib/benchmark.o $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a newlib/benchmark.o: benchmark.c ############################################################################# libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o newlib/libexpat.a $(CC) -mcrt=newlib -nostartfiles $^ -o $@ newlib/libexpat.a -Wl,--cref,-M,-Map=$@.map protect $@ -e $(STRIP) $(STRIPFLAGS) $@ libs/expat_lib.o: expat_lib.c expat_base.h libs/expat_68k.o: expat_68k.c expat_68k.h expat_base.h libs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h libs/expat_vectors.o: expat_vectors.c libs/launch.o: launch.c ############################################################################# libs/xmlwf: libs/xmlwf.o libs/xmlfile.o libs/codepage.o libs/readfilemap.o libs/launch.o $(CC) -mcrt=newlib $^ -o $@ $(STRIP) $(STRIPFLAGS) $@ libs/xmlwf.o: xmlwf.c libs/xmlfile.o: xmlfile.c libs/codepage.o: codepage.c libs/readfilemap.o: readfilemap.c ############################################################################# libs/elements: libs/elements.o libs/launch.o $(CC) -mcrt=newlib $^ -o $@ $(STRIP) $(STRIPFLAGS) $@ libs/elements.o: elements.c ############################################################################# libs/outline: libs/outline.o libs/launch.o $(CC) -mcrt=newlib $^ -o $@ $(STRIP) $(STRIPFLAGS) $@ libs/outline.o: outline.c ############################################################################# libs/runtests: libs/runtests.o libs/chardata.o libs/minicheck.o libs/launch.o $(CC) -mcrt=newlib $^ -o $@ libs/chardata.o: chardata.c chardata.h libs/minicheck.o: minicheck.c minicheck.h libs/runtests.o: runtests.c chardata.h ############################################################################# libs/benchmark: libs/benchmark.o libs/launch.o $(CC) -mcrt=newlib $^ -o $@ libs/benchmark.o: benchmark.c ############################################################################# so/libexpat.so: so/xmlparse.o so/xmltok.o so/xmlrole.o $(CC) -mcrt=newlib -shared -o $@ $^ protect $@ -e so/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ expat_external.h internal.h amigaconfig.h so/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ internal.h amigaconfig.h so/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ expat_external.h internal.h amigaconfig.h ############################################################################# so/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat $(STRIP) $(STRIPFLAGS) $@ ############################################################################# so/elements: newlib/elements.o $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat $(STRIP) $(STRIPFLAGS) $@ ############################################################################# so/outline: newlib/outline.o $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat $(STRIP) $(STRIPFLAGS) $@ ############################################################################# so/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat ############################################################################# so/benchmark: newlib/benchmark.o $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat ############################################################################# clib2/%.o: %.c $(CC) -mcrt=clib2 $(CFLAGS) -I../lib -c $< -o $@ newlib/%.o: %.c $(CC) -mcrt=newlib $(CFLAGS) -I../lib -c $< -o $@ libs/%.o: %.c $(CC) -mcrt=newlib $(CFLAGS) -D__USE_INLINE__ -I. -Iinclude -Iinclude/libraries -I../lib -c $< -o $@ so/%.o: %.c $(CC) -mcrt=newlib $(CFLAGS) -fPIC -I../lib -c $< -o $@ astropy-0.3/cextern/expat/amiga/launch.c0000755000175000017500000000332012243255342016465 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #ifdef __USE_INLINE__ #undef __USE_INLINE__ #endif #include #include struct Library* ExpatBase = 0; struct ExpatIFace* IExpat = 0; void setup() __attribute__((constructor)); void cleanup() __attribute__((destructor)); void setup() { ExpatBase = IExec->OpenLibrary("expat.library", 53); IExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, "main", 1, NULL); if ( IExpat == 0 ) { IExec->DebugPrintF("Can't open expat.library\n"); } } void cleanup() { IExec->DropInterface((struct Interface*)IExpat); IExpat = 0; IExec->CloseLibrary(ExpatBase); ExpatBase = 0; } astropy-0.3/cextern/expat/amiga/README.txt0000755000175000017500000000610012243255342016544 0ustar oleoleSUMMARY ======= This is a port of expat for AmigaOS 4.x which includes the SDK, some XML tools and the libraries. Four library flavours are supported: 1. static clib2 (libexpat.a) 2. static newlib (libexpat.a) 3. AmigaOS library (expat.library) 4. AmigaOS shared object library (libexpat.so) The AmigaOS library version is based on the work of Fredrik Wikstrom. BUILDING ======== To build all the library flavours, all the tools, examples and run the test suite, simply type 'make all' in the amiga subdirectory. INSTALLATION ============ To install expat into the standard AmigaOS SDK type 'make install' in the amiga subdirectory. CONFIGURATION ============= You may want to edit the lib/amigaconfig.h file to remove DTD and/or XML namespace support if they are not required by your specific application for a smaller and faster implementation. SOURCE CODE =========== The source code is actively maintained and merged with the official Expat repository available at http://expat.sourceforge.net/ HISTORY ======= 53.1 - bumped version to match AmigaOS streaming - modified to remove all global variables (except INewLib) - removed replacements for malloc(), etc. which are now handled by the respective C library - compiled with the latest binutils which bumps the AMIGAOS_DYNVERSION to 2 for the libexpat.so target - now strips the expat.library binary 5.2 - fixed XML_Parse 68k stub which enables xmlviewer to work without crashing - added some new functions to the 68k jump table available in the latest expat.library for AmigaOS 3.x - patches provided by Fredrik Wikstrom 5.1 - fixed package archive which was missing libexpat.so - fixed library protection bits - fixed up copyright notices 5.0 - integrated 68k patches from Fredrik Wikstrom which means expat.library is now callable from 68k code - bumped version for the addition of the 68k interface so executables can explicitly ask for version 5 and know it includes the 68k interface - refactored Makefile to avoid recursive make calls and build all the library flavours - added static newlib version - added shared objects version - added package target to Makefile - compiled with SDK 53.13 (GCC 4.2.4) at -O3 4.2 - updated to correspond to Expat 2.0.1 release - bumped copyright banners and versions - simplified amigaconfig.h - updated include/libraries/expat.h file - modified launch.c to use contructor/deconstructor - removed need for amiga_main() from expat utilities 4.1 - fixed memory freeing bug in shared library version - now allocates shared memory 4.0 - updated for corresponding Expat 2.0 release - some minor CVS related changes 3.1 - removed obsolete sfd file - added library description xml file - refactored Makefile - removed extraneous VARARGS68K keywords - reworked default memory handling functions in shared lib - updated amigaconfig.h 3.0 - initial release - based on expat 1.95.8 TO DO ===== - wide character support (UTF-16) astropy-0.3/cextern/expat/amiga/stdlib.c0000755000175000017500000000444612243255342016506 0ustar oleole/* ** Copyright (c) 2001-2007 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #include #include #include #include void * malloc (size_t len) { uint32 size = sizeof(uint32) + len; uint32 *mem = AllocMem(size, MEMF_SHARED); if ( mem != 0 ) { *mem = size; ++mem; } return mem; } void * realloc (void * mem, size_t len2) { if ( mem == 0 ) { return malloc(len2); } if ( len2 == 0 ) { free(mem); return 0; } void * new_mem = malloc(len2); if ( new_mem == 0 ) { return 0; } uint32 mem_size = *(((uint32*)mem) - 1); CopyMem(mem, new_mem, mem_size); free(mem); return new_mem; } void free (void * mem) { if ( mem != 0 ) { uint32 * size_ptr = ((uint32*)mem) - 1; FreeMem(size_ptr, *size_ptr); } } int memcmp (const void * a, const void * b, size_t len) { size_t i; int diff; for ( i = 0; i < len; ++i ) { diff = *((uint8 *)a++) - *((uint8 *)b++); if ( diff ) { return diff; } } return 0; } void * memcpy (void * t, const void * a, size_t len) { CopyMem((APTR)a, t, len); return t; } void * memmove (void * t1, const void * t2, size_t len) { MoveMem((APTR)t2, t1, len); return t1; } void * memset (void * t, int c, size_t len) { return SetMem(t, c, len); } astropy-0.3/cextern/expat/amiga/expat_lib.c0000755000175000017500000001331712243255342017171 0ustar oleole/* ** Copyright (c) 2001-2009 Expat maintainers. ** ** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. */ #ifdef __USE_INLINE__ #undef __USE_INLINE__ #endif #define __NOLIBBASE__ #define __NOGLOBALIFACE__ #include #include #include "expat_base.h" #define LIBNAME "expat.library" #define LIBPRI 0 #define VERSION 53 #define REVISION 1 #define VSTRING "expat.library 53.1 (7.8.2009)" /* dd.mm.yyyy */ static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING; struct Interface *INewlib = 0; struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys); uint32 libObtain (struct LibraryManagerInterface *Self); uint32 libRelease (struct LibraryManagerInterface *Self); struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version); BPTR libClose (struct LibraryManagerInterface *Self); BPTR libExpunge (struct LibraryManagerInterface *Self); struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer); void closeInterface(struct ExecIFace *IExec, struct Interface *iface); static APTR lib_manager_vectors[] = { libObtain, libRelease, NULL, NULL, libOpen, libClose, libExpunge, NULL, (APTR)-1, }; static struct TagItem lib_managerTags[] = { { MIT_Name, (uint32)"__library" }, { MIT_VectorTable, (uint32)lib_manager_vectors }, { MIT_Version, 1 }, { TAG_END, 0 } }; extern void *main_vectors[]; static struct TagItem lib_mainTags[] = { { MIT_Name, (uint32)"main" }, { MIT_VectorTable, (uint32)main_vectors }, { MIT_Version, 1 }, { TAG_END, 0 } }; static APTR libInterfaces[] = { lib_managerTags, lib_mainTags, NULL }; extern void *VecTable68K[]; static struct TagItem libCreateTags[] = { { CLT_DataSize, sizeof(struct ExpatBase) }, { CLT_InitFunc, (uint32)libInit }, { CLT_Interfaces, (uint32)libInterfaces }, { CLT_Vector68K, (uint32)VecTable68K }, { TAG_END, 0 } }; static struct Resident __attribute__((used)) lib_res = { RTC_MATCHWORD, // rt_MatchWord &lib_res, // rt_MatchTag &lib_res+1, // rt_EndSkip RTF_NATIVE | RTF_AUTOINIT, // rt_Flags VERSION, // rt_Version NT_LIBRARY, // rt_Type LIBPRI, // rt_Pri LIBNAME, // rt_Name VSTRING, // rt_IdString libCreateTags // rt_Init }; int32 _start() { return RETURN_FAIL; } struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *iexec) { libBase->libNode.lib_Node.ln_Type = NT_LIBRARY; libBase->libNode.lib_Node.ln_Pri = LIBPRI; libBase->libNode.lib_Node.ln_Name = LIBNAME; libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED; libBase->libNode.lib_Version = VERSION; libBase->libNode.lib_Revision = REVISION; libBase->libNode.lib_IdString = VSTRING; libBase->SegList = seglist; libBase->IExec = iexec; INewlib = openInterface(iexec, "newlib.library", 0); if ( INewlib != 0 ) { return libBase; } closeInterface(iexec, INewlib); INewlib = 0; iexec->DeleteLibrary(&libBase->libNode); return NULL; } uint32 libObtain( struct LibraryManagerInterface *Self ) { ++Self->Data.RefCount; return Self->Data.RefCount; } uint32 libRelease( struct LibraryManagerInterface *Self ) { --Self->Data.RefCount; return Self->Data.RefCount; } struct ExpatBase *libOpen( struct LibraryManagerInterface *Self, uint32 version ) { struct ExpatBase *libBase; libBase = (struct ExpatBase *)Self->Data.LibBase; ++libBase->libNode.lib_OpenCnt; libBase->libNode.lib_Flags &= ~LIBF_DELEXP; return libBase; } BPTR libClose( struct LibraryManagerInterface *Self ) { struct ExpatBase *libBase; libBase = (struct ExpatBase *)Self->Data.LibBase; --libBase->libNode.lib_OpenCnt; if ( libBase->libNode.lib_OpenCnt ) { return 0; } if ( libBase->libNode.lib_Flags & LIBF_DELEXP ) { return (BPTR)Self->LibExpunge(); } else { return ZERO; } } BPTR libExpunge( struct LibraryManagerInterface *Self ) { struct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase; BPTR result = ZERO; if (libBase->libNode.lib_OpenCnt == 0) { libBase->IExec->Remove(&libBase->libNode.lib_Node); result = libBase->SegList; closeInterface(libBase->IExec, INewlib); INewlib = 0; libBase->IExec->DeleteLibrary(&libBase->libNode); } else { libBase->libNode.lib_Flags |= LIBF_DELEXP; } return result; } struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer) { struct Library *base = IExec->OpenLibrary(libName, libVer); struct Interface *iface = IExec->GetInterface(base, "main", 1, 0); if (iface == 0) { IExec->CloseLibrary(base); } return iface; } void closeInterface(struct ExecIFace *IExec, struct Interface *iface) { if (iface != 0) { struct Library *base = iface->Data.LibBase; IExec->DropInterface(iface); IExec->CloseLibrary(base); } } astropy-0.3/cextern/expat/amiga/expat.xml0000755000175000017500000002476612243255342016733 0ustar oleole libraries/expat.h astropy-0.3/cextern/expat/expat.dsw0000755000175000017500000000370612243255342015641 0ustar oleoleMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "elements"=.\examples\elements.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name expat_static End Project Dependency }}} ############################################################################### Project: "expat"=.\lib\expat.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "expat_static"=.\lib\expat_static.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "expatw"=.\lib\expatw.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "expatw_static"=.\lib\expatw_static.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "outline"=.\examples\outline.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name expat End Project Dependency }}} ############################################################################### Project: "xmlwf"=.\xmlwf\xmlwf.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ Begin Project Dependency Project_Dep_Name expat End Project Dependency }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### astropy-0.3/cextern/expat/xmlwf/0000755000175000017500000000000012243263747015135 5ustar oleoleastropy-0.3/cextern/expat/xmlwf/ct.c0000755000175000017500000000554012243255342015706 0ustar oleole#define CHARSET_MAX 41 static const char * getTok(const char **pp) { enum { inAtom, inString, init, inComment }; int state = init; const char *tokStart = 0; for (;;) { switch (**pp) { case '\0': return 0; case ' ': case '\r': case '\t': case '\n': if (state == inAtom) return tokStart; break; case '(': if (state == inAtom) return tokStart; if (state != inString) state++; break; case ')': if (state > init) --state; else if (state != inString) return 0; break; case ';': case '/': case '=': if (state == inAtom) return tokStart; if (state == init) return (*pp)++; break; case '\\': ++*pp; if (**pp == '\0') return 0; break; case '"': switch (state) { case inString: ++*pp; return tokStart; case inAtom: return tokStart; case init: tokStart = *pp; state = inString; break; } break; default: if (state == init) { tokStart = *pp; state = inAtom; } break; } ++*pp; } /* not reached */ } /* key must be lowercase ASCII */ static int matchkey(const char *start, const char *end, const char *key) { if (!start) return 0; for (; start != end; start++, key++) if (*start != *key && *start != 'A' + (*key - 'a')) return 0; return *key == '\0'; } void getXMLCharset(const char *buf, char *charset) { const char *next, *p; charset[0] = '\0'; next = buf; p = getTok(&next); if (matchkey(p, next, "text")) strcpy(charset, "us-ascii"); else if (!matchkey(p, next, "application")) return; p = getTok(&next); if (!p || *p != '/') return; p = getTok(&next); if (matchkey(p, next, "xml")) isXml = 1; p = getTok(&next); while (p) { if (*p == ';') { p = getTok(&next); if (matchkey(p, next, "charset")) { p = getTok(&next); if (p && *p == '=') { p = getTok(&next); if (p) { char *s = charset; if (*p == '"') { while (++p != next - 1) { if (*p == '\\') ++p; if (s == charset + CHARSET_MAX - 1) { charset[0] = '\0'; break; } *s++ = *p; } *s++ = '\0'; } else { if (next - p > CHARSET_MAX - 1) break; while (p != next) *s++ = *p++; *s = 0; break; } } } } } else p = getTok(&next); } } int main(int argc, char **argv) { char buf[CHARSET_MAX]; getXMLCharset(argv[1], buf); printf("charset = \"%s\"\n", buf); return 0; } astropy-0.3/cextern/expat/xmlwf/win32filemap.c0000755000175000017500000000413712243255342017601 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #define STRICT 1 #define WIN32_LEAN_AND_MEAN 1 #ifdef XML_UNICODE_WCHAR_T #ifndef XML_UNICODE #define XML_UNICODE #endif #endif #ifdef XML_UNICODE #define UNICODE #define _UNICODE #endif /* XML_UNICODE */ #include #include #include #include "filemap.h" static void win32perror(const TCHAR *); int filemap(const TCHAR *name, void (*processor)(const void *, size_t, const TCHAR *, void *arg), void *arg) { HANDLE f; HANDLE m; DWORD size; DWORD sizeHi; void *p; f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); if (f == INVALID_HANDLE_VALUE) { win32perror(name); return 0; } size = GetFileSize(f, &sizeHi); if (size == (DWORD)-1) { win32perror(name); return 0; } if (sizeHi) { _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name); return 0; } /* CreateFileMapping barfs on zero length files */ if (size == 0) { static const char c = '\0'; processor(&c, 0, name, arg); CloseHandle(f); return 1; } m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL); if (m == NULL) { win32perror(name); CloseHandle(f); return 0; } p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0); if (p == NULL) { win32perror(name); CloseHandle(m); CloseHandle(f); return 0; } processor(p, size, name, arg); UnmapViewOfFile(p); CloseHandle(m); CloseHandle(f); return 1; } static void win32perror(const TCHAR *s) { LPVOID buf; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL)) { _ftprintf(stderr, _T("%s: %s"), s, buf); fflush(stderr); LocalFree(buf); } else _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); } astropy-0.3/cextern/expat/xmlwf/xmlfile.h0000755000175000017500000000077512243255342016752 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #define XML_MAP_FILE 01 #define XML_EXTERNAL_ENTITIES 02 #ifdef XML_LARGE_SIZE #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 #define XML_FMT_INT_MOD "I64" #else #define XML_FMT_INT_MOD "ll" #endif #else #define XML_FMT_INT_MOD "l" #endif extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags); astropy-0.3/cextern/expat/xmlwf/xmlwin32url.cxx0000755000175000017500000002115512243255342020066 0ustar oleole#include "expat.h" #ifdef XML_UNICODE #define UNICODE #endif #include #include #include #include #include #include "xmlurl.h" #include "xmlmime.h" static int processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url); typedef void (*StopHandler)(void *, HRESULT); class Callback : public IBindStatusCallback { public: // IUnknown methods STDMETHODIMP QueryInterface(REFIID,void **); STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) Release(); // IBindStatusCallback methods STDMETHODIMP OnStartBinding(DWORD, IBinding *); STDMETHODIMP GetPriority(LONG *); STDMETHODIMP OnLowResource(DWORD); STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR); STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR); STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *); STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *); STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *); Callback(XML_Parser, IMoniker *, StopHandler, void *); ~Callback(); int externalEntityRef(const XML_Char *context, const XML_Char *systemId, const XML_Char *publicId); private: XML_Parser parser_; IMoniker *baseMoniker_; DWORD totalRead_; ULONG ref_; IBinding *pBinding_; StopHandler stopHandler_; void *stopArg_; }; STDMETHODIMP_(ULONG) Callback::AddRef() { return ref_++; } STDMETHODIMP_(ULONG) Callback::Release() { if (--ref_ == 0) { delete this; return 0; } return ref_; } STDMETHODIMP Callback::QueryInterface(REFIID riid, void** ppv) { if (IsEqualGUID(riid, IID_IUnknown)) *ppv = (IUnknown *)this; else if (IsEqualGUID(riid, IID_IBindStatusCallback)) *ppv = (IBindStatusCallback *)this; else return E_NOINTERFACE; ((LPUNKNOWN)*ppv)->AddRef(); return S_OK; } STDMETHODIMP Callback::OnStartBinding(DWORD, IBinding* pBinding) { pBinding_ = pBinding; pBinding->AddRef(); return S_OK; } STDMETHODIMP Callback::GetPriority(LONG *) { return E_NOTIMPL; } STDMETHODIMP Callback::OnLowResource(DWORD) { return E_NOTIMPL; } STDMETHODIMP Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR) { return S_OK; } STDMETHODIMP Callback::OnStopBinding(HRESULT hr, LPCWSTR szError) { if (pBinding_) { pBinding_->Release(); pBinding_ = 0; } if (baseMoniker_) { baseMoniker_->Release(); baseMoniker_ = 0; } stopHandler_(stopArg_, hr); return S_OK; } STDMETHODIMP Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo) { *pgrfBINDF = BINDF_ASYNCHRONOUS; return S_OK; } static void reportError(XML_Parser parser) { int code = XML_GetErrorCode(parser); const XML_Char *message = XML_ErrorString(code); if (message) _ftprintf(stderr, _T("%s:%d:%ld: %s\n"), XML_GetBase(parser), XML_GetErrorLineNumber(parser), XML_GetErrorColumnNumber(parser), message); else _ftprintf(stderr, _T("%s: (unknown message %d)\n"), XML_GetBase(parser), code); } STDMETHODIMP Callback::OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pfmtetc, STGMEDIUM* pstgmed) { if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) { IWinInetHttpInfo *hp; HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo, (void **)&hp); if (SUCCEEDED(hr)) { char contentType[1024]; DWORD bufSize = sizeof(contentType); DWORD flags = 0; contentType[0] = 0; hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType, &bufSize, 0, NULL); if (SUCCEEDED(hr)) { char charset[CHARSET_MAX]; getXMLCharset(contentType, charset); if (charset[0]) { #ifdef XML_UNICODE XML_Char wcharset[CHARSET_MAX]; XML_Char *p1 = wcharset; const char *p2 = charset; while ((*p1++ = (unsigned char)*p2++) != 0) ; XML_SetEncoding(parser_, wcharset); #else XML_SetEncoding(parser_, charset); #endif } } hp->Release(); } } if (!parser_) return E_ABORT; if (pstgmed->tymed == TYMED_ISTREAM) { while (totalRead_ < dwSize) { #define READ_MAX (64*1024) DWORD nToRead = dwSize - totalRead_; if (nToRead > READ_MAX) nToRead = READ_MAX; void *buf = XML_GetBuffer(parser_, nToRead); if (!buf) { _ftprintf(stderr, _T("out of memory\n")); return E_ABORT; } DWORD nRead; HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead); if (SUCCEEDED(hr)) { totalRead_ += nRead; if (!XML_ParseBuffer(parser_, nRead, (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0 && totalRead_ == dwSize)) { reportError(parser_); return E_ABORT; } } } } return S_OK; } STDMETHODIMP Callback::OnObjectAvailable(REFIID, IUnknown *) { return S_OK; } int Callback::externalEntityRef(const XML_Char *context, const XML_Char *systemId, const XML_Char *publicId) { XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0); XML_SetBase(entParser, systemId); int ret = processURL(entParser, baseMoniker_, systemId); XML_ParserFree(entParser); return ret; } Callback::Callback(XML_Parser parser, IMoniker *baseMoniker, StopHandler stopHandler, void *stopArg) : parser_(parser), baseMoniker_(baseMoniker), ref_(0), pBinding_(0), totalRead_(0), stopHandler_(stopHandler), stopArg_(stopArg) { if (baseMoniker_) baseMoniker_->AddRef(); } Callback::~Callback() { if (pBinding_) pBinding_->Release(); if (baseMoniker_) baseMoniker_->Release(); } static int externalEntityRef(void *arg, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { return ((Callback *)arg)->externalEntityRef(context, systemId, publicId); } static HRESULT openStream(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *uri, StopHandler stopHandler, void *stopArg) { if (!XML_SetBase(parser, uri)) return E_OUTOFMEMORY; HRESULT hr; IMoniker *m; #ifdef XML_UNICODE hr = CreateURLMoniker(0, uri, &m); #else LPWSTR uriw = new wchar_t[strlen(uri) + 1]; for (int i = 0;; i++) { uriw[i] = uri[i]; if (uriw[i] == 0) break; } hr = CreateURLMoniker(baseMoniker, uriw, &m); delete [] uriw; #endif if (FAILED(hr)) return hr; IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg); XML_SetExternalEntityRefHandler(parser, externalEntityRef); XML_SetExternalEntityRefHandlerArg(parser, cb); cb->AddRef(); IBindCtx *b; if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) { cb->Release(); m->Release(); return hr; } cb->Release(); IStream *pStream; hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream); if (SUCCEEDED(hr)) { if (pStream) pStream->Release(); } if (hr == MK_S_ASYNCHRONOUS) hr = S_OK; m->Release(); b->Release(); return hr; } struct QuitInfo { const XML_Char *url; HRESULT hr; int stop; }; static void winPerror(const XML_Char *url, HRESULT hr) { LPVOID buf; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE, GetModuleHandleA("urlmon.dll"), hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL) || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &buf, 0, NULL)) { /* The system error messages seem to end with a newline. */ _ftprintf(stderr, _T("%s: %s"), url, buf); fflush(stderr); LocalFree(buf); } else _ftprintf(stderr, _T("%s: error %x\n"), url, hr); } static void threadQuit(void *p, HRESULT hr) { QuitInfo *qi = (QuitInfo *)p; qi->hr = hr; qi->stop = 1; } extern "C" int XML_URLInit(void) { return SUCCEEDED(CoInitialize(0)); } extern "C" void XML_URLUninit(void) { CoUninitialize(); } static int processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url) { QuitInfo qi; qi.stop = 0; qi.url = url; XML_SetBase(parser, url); HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi); if (FAILED(hr)) { winPerror(url, hr); return 0; } else if (FAILED(qi.hr)) { winPerror(url, qi.hr); return 0; } MSG msg; while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); } return 1; } extern "C" int XML_ProcessURL(XML_Parser parser, const XML_Char *url, unsigned flags) { return processURL(parser, 0, url); } astropy-0.3/cextern/expat/xmlwf/xmlmime.c0000755000175000017500000000622212243255342016746 0ustar oleole#include #include "xmlmime.h" static const char * getTok(const char **pp) { /* inComment means one level of nesting; inComment+1 means two levels etc */ enum { inAtom, inString, init, inComment }; int state = init; const char *tokStart = 0; for (;;) { switch (**pp) { case '\0': if (state == inAtom) return tokStart; return 0; case ' ': case '\r': case '\t': case '\n': if (state == inAtom) return tokStart; break; case '(': if (state == inAtom) return tokStart; if (state != inString) state++; break; case ')': if (state > init) --state; else if (state != inString) return 0; break; case ';': case '/': case '=': if (state == inAtom) return tokStart; if (state == init) return (*pp)++; break; case '\\': ++*pp; if (**pp == '\0') return 0; break; case '"': switch (state) { case inString: ++*pp; return tokStart; case inAtom: return tokStart; case init: tokStart = *pp; state = inString; break; } break; default: if (state == init) { tokStart = *pp; state = inAtom; } break; } ++*pp; } /* not reached */ } /* key must be lowercase ASCII */ static int matchkey(const char *start, const char *end, const char *key) { if (!start) return 0; for (; start != end; start++, key++) if (*start != *key && *start != 'A' + (*key - 'a')) return 0; return *key == '\0'; } void getXMLCharset(const char *buf, char *charset) { const char *next, *p; charset[0] = '\0'; next = buf; p = getTok(&next); if (matchkey(p, next, "text")) strcpy(charset, "us-ascii"); else if (!matchkey(p, next, "application")) return; p = getTok(&next); if (!p || *p != '/') return; p = getTok(&next); #if 0 if (!matchkey(p, next, "xml") && charset[0] == '\0') return; #endif p = getTok(&next); while (p) { if (*p == ';') { p = getTok(&next); if (matchkey(p, next, "charset")) { p = getTok(&next); if (p && *p == '=') { p = getTok(&next); if (p) { char *s = charset; if (*p == '"') { while (++p != next - 1) { if (*p == '\\') ++p; if (s == charset + CHARSET_MAX - 1) { charset[0] = '\0'; break; } *s++ = *p; } *s++ = '\0'; } else { if (next - p > CHARSET_MAX - 1) break; while (p != next) *s++ = *p++; *s = 0; break; } } } break; } } else p = getTok(&next); } } #ifdef TEST #include int main(int argc, char *argv[]) { char buf[CHARSET_MAX]; if (argc <= 1) return 1; printf("%s\n", argv[1]); getXMLCharset(argv[1], buf); printf("charset=\"%s\"\n", buf); return 0; } #endif /* TEST */ astropy-0.3/cextern/expat/xmlwf/xmltchar.h0000755000175000017500000000147112243255342017126 0ustar oleole#ifdef XML_UNICODE #ifndef XML_UNICODE_WCHAR_T #error xmlwf requires a 16-bit Unicode-compatible wchar_t #endif #define T(x) L ## x #define ftprintf fwprintf #define tfopen _wfopen #define fputts fputws #define puttc putwc #define tcscmp wcscmp #define tcscpy wcscpy #define tcscat wcscat #define tcschr wcschr #define tcsrchr wcsrchr #define tcslen wcslen #define tperror _wperror #define topen _wopen #define tmain wmain #define tremove _wremove #else /* not XML_UNICODE */ #define T(x) x #define ftprintf fprintf #define tfopen fopen #define fputts fputs #define puttc putc #define tcscmp strcmp #define tcscpy strcpy #define tcscat strcat #define tcschr strchr #define tcsrchr strrchr #define tcslen strlen #define tperror perror #define topen open #define tmain main #define tremove remove #endif /* not XML_UNICODE */ astropy-0.3/cextern/expat/xmlwf/xmlwf.dsp0000755000175000017500000001004212243255342016772 0ustar oleole# Microsoft Developer Studio Project File - Name="xmlwf" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=xmlwf - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "xmlwf.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "xmlwf.mak" CFG="xmlwf - Win32 Release" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "xmlwf - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "xmlwf - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "xmlwf - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir ".\Release" # PROP BASE Intermediate_Dir ".\Release" # PROP BASE Target_Dir "." # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release-xmlwf" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "." # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 # ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\xmlwf.exe" # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "xmlwf - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir ".\Debug" # PROP BASE Intermediate_Dir ".\Debug" # PROP BASE Target_Dir "." # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug-xmlwf" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "." # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 # ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\xmlwf.exe" !ENDIF # Begin Target # Name "xmlwf - Win32 Release" # Name "xmlwf - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" # Begin Source File SOURCE=.\codepage.c # End Source File # Begin Source File SOURCE=.\readfilemap.c # PROP Exclude_From_Build 1 # End Source File # Begin Source File SOURCE=.\unixfilemap.c # PROP Exclude_From_Build 1 # End Source File # Begin Source File SOURCE=.\win32filemap.c # End Source File # Begin Source File SOURCE=.\xmlfile.c # End Source File # Begin Source File SOURCE=.\xmlwf.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" # Begin Source File SOURCE=.\codepage.h # End Source File # Begin Source File SOURCE=.\xmlfile.h # End Source File # Begin Source File SOURCE=.\xmltchar.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" # End Group # End Target # End Project astropy-0.3/cextern/expat/xmlwf/xmlurl.h0000755000175000017500000000034012243255342016621 0ustar oleole#ifdef __cplusplus extern "C" { #endif int XML_URLInit(); void XML_URLUninit(); int XML_ProcessURL(XML_Parser parser, const XML_Char *url, unsigned flags); #ifdef __cplusplus } #endif astropy-0.3/cextern/expat/xmlwf/readfilemap.c0000755000175000017500000000337612243255342017556 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #include #include #include #include #ifdef __WATCOMC__ #ifndef __LINUX__ #include #else #include #endif #endif #ifdef __BEOS__ #include #endif #ifndef S_ISREG #ifndef S_IFREG #define S_IFREG _S_IFREG #endif #ifndef S_IFMT #define S_IFMT _S_IFMT #endif #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif /* not S_ISREG */ #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #else #define O_BINARY 0 #endif #endif #include "filemap.h" int filemap(const char *name, void (*processor)(const void *, size_t, const char *, void *arg), void *arg) { size_t nbytes; int fd; int n; struct stat sb; void *p; fd = open(name, O_RDONLY|O_BINARY); if (fd < 0) { perror(name); return 0; } if (fstat(fd, &sb) < 0) { perror(name); close(fd); return 0; } if (!S_ISREG(sb.st_mode)) { fprintf(stderr, "%s: not a regular file\n", name); close(fd); return 0; } nbytes = sb.st_size; /* malloc will return NULL with nbytes == 0, handle files with size 0 */ if (nbytes == 0) { static const char c = '\0'; processor(&c, 0, name, arg); close(fd); return 1; } p = malloc(nbytes); if (!p) { fprintf(stderr, "%s: out of memory\n", name); close(fd); return 0; } n = read(fd, p, nbytes); if (n < 0) { perror(name); free(p); close(fd); return 0; } if (n != nbytes) { fprintf(stderr, "%s: read unexpected number of bytes\n", name); free(p); close(fd); return 0; } processor(p, nbytes, name, arg); free(p); close(fd); return 1; } astropy-0.3/cextern/expat/xmlwf/xmlwf.c0000755000175000017500000005133412243255342016437 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #include #include #include #include "expat.h" #include "codepage.h" #include "xmlfile.h" #include "xmltchar.h" #ifdef _MSC_VER #include #endif #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif /* This ensures proper sorting. */ #define NSSEP T('\001') static void XMLCALL characterData(void *userData, const XML_Char *s, int len) { FILE *fp = (FILE *)userData; for (; len > 0; --len, ++s) { switch (*s) { case T('&'): fputts(T("&"), fp); break; case T('<'): fputts(T("<"), fp); break; case T('>'): fputts(T(">"), fp); break; #ifdef W3C14N case 13: fputts(T(" "), fp); break; #else case T('"'): fputts(T("""), fp); break; case 9: case 10: case 13: ftprintf(fp, T("&#%d;"), *s); break; #endif default: puttc(*s, fp); break; } } } static void attributeValue(FILE *fp, const XML_Char *s) { puttc(T('='), fp); puttc(T('"'), fp); for (;;) { switch (*s) { case 0: case NSSEP: puttc(T('"'), fp); return; case T('&'): fputts(T("&"), fp); break; case T('<'): fputts(T("<"), fp); break; case T('"'): fputts(T("""), fp); break; #ifdef W3C14N case 9: fputts(T(" "), fp); break; case 10: fputts(T(" "), fp); break; case 13: fputts(T(" "), fp); break; #else case T('>'): fputts(T(">"), fp); break; case 9: case 10: case 13: ftprintf(fp, T("&#%d;"), *s); break; #endif default: puttc(*s, fp); break; } s++; } } /* Lexicographically comparing UTF-8 encoded attribute values, is equivalent to lexicographically comparing based on the character number. */ static int attcmp(const void *att1, const void *att2) { return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); } static void XMLCALL startElement(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; const XML_Char **p; FILE *fp = (FILE *)userData; puttc(T('<'), fp); fputts(name, fp); p = atts; while (*p) ++p; nAtts = (int)((p - atts) >> 1); if (nAtts > 1) qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); while (*atts) { puttc(T(' '), fp); fputts(*atts++, fp); attributeValue(fp, *atts); atts++; } puttc(T('>'), fp); } static void XMLCALL endElement(void *userData, const XML_Char *name) { FILE *fp = (FILE *)userData; puttc(T('<'), fp); puttc(T('/'), fp); fputts(name, fp); puttc(T('>'), fp); } static int nsattcmp(const void *p1, const void *p2) { const XML_Char *att1 = *(const XML_Char **)p1; const XML_Char *att2 = *(const XML_Char **)p2; int sep1 = (tcsrchr(att1, NSSEP) != 0); int sep2 = (tcsrchr(att1, NSSEP) != 0); if (sep1 != sep2) return sep1 - sep2; return tcscmp(att1, att2); } static void XMLCALL startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) { int nAtts; int nsi; const XML_Char **p; FILE *fp = (FILE *)userData; const XML_Char *sep; puttc(T('<'), fp); sep = tcsrchr(name, NSSEP); if (sep) { fputts(T("n1:"), fp); fputts(sep + 1, fp); fputts(T(" xmlns:n1"), fp); attributeValue(fp, name); nsi = 2; } else { fputts(name, fp); nsi = 1; } p = atts; while (*p) ++p; nAtts = (int)((p - atts) >> 1); if (nAtts > 1) qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); while (*atts) { name = *atts++; sep = tcsrchr(name, NSSEP); puttc(T(' '), fp); if (sep) { ftprintf(fp, T("n%d:"), nsi); fputts(sep + 1, fp); } else fputts(name, fp); attributeValue(fp, *atts); if (sep) { ftprintf(fp, T(" xmlns:n%d"), nsi++); attributeValue(fp, name); } atts++; } puttc(T('>'), fp); } static void XMLCALL endElementNS(void *userData, const XML_Char *name) { FILE *fp = (FILE *)userData; const XML_Char *sep; puttc(T('<'), fp); puttc(T('/'), fp); sep = tcsrchr(name, NSSEP); if (sep) { fputts(T("n1:"), fp); fputts(sep + 1, fp); } else fputts(name, fp); puttc(T('>'), fp); } #ifndef W3C14N static void XMLCALL processingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { FILE *fp = (FILE *)userData; puttc(T('<'), fp); puttc(T('?'), fp); fputts(target, fp); puttc(T(' '), fp); fputts(data, fp); puttc(T('?'), fp); puttc(T('>'), fp); } #endif /* not W3C14N */ static void XMLCALL defaultCharacterData(void *userData, const XML_Char *s, int len) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL defaultStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL defaultEndElement(void *userData, const XML_Char *name) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL defaultProcessingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { XML_DefaultCurrent((XML_Parser) userData); } static void XMLCALL nopCharacterData(void *userData, const XML_Char *s, int len) { } static void XMLCALL nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { } static void XMLCALL nopEndElement(void *userData, const XML_Char *name) { } static void XMLCALL nopProcessingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { } static void XMLCALL markup(void *userData, const XML_Char *s, int len) { FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData); for (; len > 0; --len, ++s) puttc(*s, fp); } static void metaLocation(XML_Parser parser) { const XML_Char *uri = XML_GetBase(parser); if (uri) ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri); ftprintf((FILE *)XML_GetUserData(parser), T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \ line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD "u\""), XML_GetCurrentByteIndex(parser), XML_GetCurrentByteCount(parser), XML_GetCurrentLineNumber(parser), XML_GetCurrentColumnNumber(parser)); } static void metaStartDocument(void *userData) { fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); } static void metaEndDocument(void *userData) { fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); } static void XMLCALL metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); const XML_Char **specifiedAttsEnd = atts + XML_GetSpecifiedAttributeCount(parser); const XML_Char **idAttPtr; int idAttIndex = XML_GetIdAttributeIndex(parser); if (idAttIndex < 0) idAttPtr = 0; else idAttPtr = atts + idAttIndex; ftprintf(fp, T("\n"), fp); do { ftprintf(fp, T("= specifiedAttsEnd) fputts(T("\" defaulted=\"yes\"/>\n"), fp); else if (atts == idAttPtr) fputts(T("\" id=\"yes\"/>\n"), fp); else fputts(T("\"/>\n"), fp); } while (*(atts += 2)); fputts(T("\n"), fp); } else fputts(T("/>\n"), fp); } static void XMLCALL metaEndElement(void *userData, const XML_Char *name) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); ftprintf(fp, T("\n"), fp); } static void XMLCALL metaProcessingInstruction(void *userData, const XML_Char *target, const XML_Char *data) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); ftprintf(fp, T("\n"), fp); } static void XMLCALL metaComment(void *userData, const XML_Char *data) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } static void XMLCALL metaStartCdataSection(void *userData) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } static void XMLCALL metaEndCdataSection(void *userData) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } static void XMLCALL metaCharacterData(void *userData, const XML_Char *s, int len) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } static void XMLCALL metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); ftprintf(fp, T("\n"), fp); } static void XMLCALL metaEndDoctypeDecl(void *userData) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } static void XMLCALL metaNotationDecl(void *userData, const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); ftprintf(fp, T("\n"), fp); } static void XMLCALL metaEntityDecl(void *userData, const XML_Char *entityName, int is_param, const XML_Char *value, int value_length, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId, const XML_Char *notationName) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); if (value) { ftprintf(fp, T("'), fp); characterData(fp, value, value_length); fputts(T("\n"), fp); } else if (notationName) { ftprintf(fp, T("\n"), fp); } else { ftprintf(fp, T("\n"), fp); } } static void XMLCALL metaStartNamespaceDecl(void *userData, const XML_Char *prefix, const XML_Char *uri) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); fputts(T("\n"), fp); } else fputts(T("/>\n"), fp); } static void XMLCALL metaEndNamespaceDecl(void *userData, const XML_Char *prefix) { XML_Parser parser = (XML_Parser) userData; FILE *fp = (FILE *)XML_GetUserData(parser); if (!prefix) fputts(T("\n"), fp); else ftprintf(fp, T("\n"), prefix); } static int XMLCALL unknownEncodingConvert(void *data, const char *p) { return codepageConvert(*(int *)data, p); } static int XMLCALL unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) { int cp; static const XML_Char prefixL[] = T("windows-"); static const XML_Char prefixU[] = T("WINDOWS-"); int i; for (i = 0; prefixU[i]; i++) if (name[i] != prefixU[i] && name[i] != prefixL[i]) return 0; cp = 0; for (; name[i]; i++) { static const XML_Char digits[] = T("0123456789"); const XML_Char *s = tcschr(digits, name[i]); if (!s) return 0; cp *= 10; cp += (int)(s - digits); if (cp >= 0x10000) return 0; } if (!codepageMap(cp, info->map)) return 0; info->convert = unknownEncodingConvert; /* We could just cast the code page integer to a void *, and avoid the use of release. */ info->release = free; info->data = malloc(sizeof(int)); if (!info->data) return 0; *(int *)info->data = cp; return 1; } static int XMLCALL notStandalone(void *userData) { return 0; } static void showVersion(XML_Char *prog) { XML_Char *s = prog; XML_Char ch; const XML_Feature *features = XML_GetFeatureList(); while ((ch = *s) != 0) { if (ch == '/' #if (defined(WIN32) || defined(__WATCOMC__)) || ch == '\\' #endif ) prog = s + 1; ++s; } ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion()); if (features != NULL && features[0].feature != XML_FEATURE_END) { int i = 1; ftprintf(stdout, T("%s"), features[0].name); if (features[0].value) ftprintf(stdout, T("=%ld"), features[0].value); while (features[i].feature != XML_FEATURE_END) { ftprintf(stdout, T(", %s"), features[i].name); if (features[i].value) ftprintf(stdout, T("=%ld"), features[i].value); ++i; } ftprintf(stdout, T("\n")); } } static void usage(const XML_Char *prog, int rc) { ftprintf(stderr, T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] " "[-e encoding] file ...\n"), prog); exit(rc); } int tmain(int argc, XML_Char **argv) { int i, j; const XML_Char *outputDir = NULL; const XML_Char *encoding = NULL; unsigned processFlags = XML_MAP_FILE; int windowsCodePages = 0; int outputType = 0; int useNamespaces = 0; int requireStandalone = 0; enum XML_ParamEntityParsing paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; int useStdin = 0; #ifdef _MSC_VER _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); #endif i = 1; j = 0; while (i < argc) { if (j == 0) { if (argv[i][0] != T('-')) break; if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { i++; break; } j++; } switch (argv[i][j]) { case T('r'): processFlags &= ~XML_MAP_FILE; j++; break; case T('s'): requireStandalone = 1; j++; break; case T('n'): useNamespaces = 1; j++; break; case T('p'): paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS; /* fall through */ case T('x'): processFlags |= XML_EXTERNAL_ENTITIES; j++; break; case T('w'): windowsCodePages = 1; j++; break; case T('m'): outputType = 'm'; j++; break; case T('c'): outputType = 'c'; useNamespaces = 0; j++; break; case T('t'): outputType = 't'; j++; break; case T('d'): if (argv[i][j + 1] == T('\0')) { if (++i == argc) usage(argv[0], 2); outputDir = argv[i]; } else outputDir = argv[i] + j + 1; i++; j = 0; break; case T('e'): if (argv[i][j + 1] == T('\0')) { if (++i == argc) usage(argv[0], 2); encoding = argv[i]; } else encoding = argv[i] + j + 1; i++; j = 0; break; case T('h'): usage(argv[0], 0); return 0; case T('v'): showVersion(argv[0]); return 0; case T('\0'): if (j > 1) { i++; j = 0; break; } /* fall through */ default: usage(argv[0], 2); } } if (i == argc) { useStdin = 1; processFlags &= ~XML_MAP_FILE; i--; } for (; i < argc; i++) { FILE *fp = 0; XML_Char *outName = 0; int result; XML_Parser parser; if (useNamespaces) parser = XML_ParserCreateNS(encoding, NSSEP); else parser = XML_ParserCreate(encoding); if (requireStandalone) XML_SetNotStandaloneHandler(parser, notStandalone); XML_SetParamEntityParsing(parser, paramEntityParsing); if (outputType == 't') { /* This is for doing timings; this gives a more realistic estimate of the parsing time. */ outputDir = 0; XML_SetElementHandler(parser, nopStartElement, nopEndElement); XML_SetCharacterDataHandler(parser, nopCharacterData); XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); } else if (outputDir) { const XML_Char * delim = T("/"); const XML_Char *file = useStdin ? T("STDIN") : argv[i]; if (!useStdin) { /* Jump after last (back)slash */ const XML_Char * lastDelim = tcsrchr(file, delim[0]); if (lastDelim) file = lastDelim + 1; #if (defined(WIN32) || defined(__WATCOMC__)) else { const XML_Char * winDelim = T("\\"); lastDelim = tcsrchr(file, winDelim[0]); if (lastDelim) { file = lastDelim + 1; delim = winDelim; } } #endif } outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2) * sizeof(XML_Char)); tcscpy(outName, outputDir); tcscat(outName, delim); tcscat(outName, file); fp = tfopen(outName, T("wb")); if (!fp) { tperror(outName); exit(1); } setvbuf(fp, NULL, _IOFBF, 16384); #ifdef XML_UNICODE puttc(0xFEFF, fp); #endif XML_SetUserData(parser, fp); switch (outputType) { case 'm': XML_UseParserAsHandlerArg(parser); XML_SetElementHandler(parser, metaStartElement, metaEndElement); XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction); XML_SetCommentHandler(parser, metaComment); XML_SetCdataSectionHandler(parser, metaStartCdataSection, metaEndCdataSection); XML_SetCharacterDataHandler(parser, metaCharacterData); XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, metaEndDoctypeDecl); XML_SetEntityDeclHandler(parser, metaEntityDecl); XML_SetNotationDeclHandler(parser, metaNotationDecl); XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, metaEndNamespaceDecl); metaStartDocument(parser); break; case 'c': XML_UseParserAsHandlerArg(parser); XML_SetDefaultHandler(parser, markup); XML_SetElementHandler(parser, defaultStartElement, defaultEndElement); XML_SetCharacterDataHandler(parser, defaultCharacterData); XML_SetProcessingInstructionHandler(parser, defaultProcessingInstruction); break; default: if (useNamespaces) XML_SetElementHandler(parser, startElementNS, endElementNS); else XML_SetElementHandler(parser, startElement, endElement); XML_SetCharacterDataHandler(parser, characterData); #ifndef W3C14N XML_SetProcessingInstructionHandler(parser, processingInstruction); #endif /* not W3C14N */ break; } } if (windowsCodePages) XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0); result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags); if (outputDir) { if (outputType == 'm') metaEndDocument(parser); fclose(fp); if (!result) { tremove(outName); exit(2); } free(outName); } XML_ParserFree(parser); } return 0; } astropy-0.3/cextern/expat/xmlwf/codepage.h0000755000175000017500000000030412243255342017045 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ int codepageMap(int cp, int *map); int codepageConvert(int cp, const char *p); astropy-0.3/cextern/expat/xmlwf/codepage.c0000755000175000017500000000251312243255342017044 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include "codepage.h" #if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) #define STRICT 1 #define WIN32_LEAN_AND_MEAN 1 #include int codepageMap(int cp, int *map) { int i; CPINFO info; if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) return 0; for (i = 0; i < 256; i++) map[i] = -1; if (info.MaxCharSize > 1) { for (i = 0; i < MAX_LEADBYTES; i+=2) { int j, lim; if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) break; lim = info.LeadByte[i + 1]; for (j = info.LeadByte[i]; j <= lim; j++) map[j] = -2; } } for (i = 0; i < 256; i++) { if (map[i] == -1) { char c = (char)i; unsigned short n; if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, &c, 1, &n, 1) == 1) map[i] = n; } } return 1; } int codepageConvert(int cp, const char *p) { unsigned short c; if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, p, 2, &c, 1) == 1) return c; return -1; } #else /* not WIN32 */ int codepageMap(int cp, int *map) { return 0; } int codepageConvert(int cp, const char *p) { return -1; } #endif /* not WIN32 */ astropy-0.3/cextern/expat/xmlwf/unixfilemap.c0000755000175000017500000000237212243255342017621 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #include #include #include #include #include #include #include #ifndef MAP_FILE #define MAP_FILE 0 #endif #include "filemap.h" int filemap(const char *name, void (*processor)(const void *, size_t, const char *, void *arg), void *arg) { int fd; size_t nbytes; struct stat sb; void *p; fd = open(name, O_RDONLY); if (fd < 0) { perror(name); return 0; } if (fstat(fd, &sb) < 0) { perror(name); close(fd); return 0; } if (!S_ISREG(sb.st_mode)) { close(fd); fprintf(stderr, "%s: not a regular file\n", name); return 0; } nbytes = sb.st_size; /* mmap fails for zero length files */ if (nbytes == 0) { static const char c = '\0'; processor(&c, 0, name, arg); close(fd); return 1; } p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, (off_t)0); if (p == (void *)-1) { perror(name); close(fd); return 0; } processor(p, nbytes, name, arg); munmap((caddr_t)p, nbytes); close(fd); return 1; } astropy-0.3/cextern/expat/xmlwf/xmlmime.h0000755000175000017500000000075512243255342016760 0ustar oleole#ifdef __cplusplus extern "C" { #endif /* Registered charset names are at most 40 characters long. */ #define CHARSET_MAX 41 /* Figure out the charset to use from the ContentType. buf contains the body of the header field (the part after "Content-Type:"). charset gets the charset to use. It must be at least CHARSET_MAX chars long. charset will be empty if the default charset should be used. */ void getXMLCharset(const char *buf, char *charset); #ifdef __cplusplus } #endif astropy-0.3/cextern/expat/xmlwf/filemap.h0000755000175000017500000000076412243255342016725 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #ifdef XML_UNICODE int filemap(const wchar_t *name, void (*processor)(const void *, size_t, const wchar_t *, void *arg), void *arg); #else int filemap(const char *name, void (*processor)(const void *, size_t, const char *, void *arg), void *arg); #endif astropy-0.3/cextern/expat/xmlwf/xmlfile.c0000755000175000017500000001370212243255342016737 0ustar oleole/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd See the file COPYING for copying permission. */ #include #include #include #include #include #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) #include "macconfig.h" #elif defined(__amigaos__) #include "amigaconfig.h" #elif defined(__WATCOMC__) #include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include #endif /* ndef COMPILED_FROM_DSP */ #include "expat.h" #include "xmlfile.h" #include "xmltchar.h" #include "filemap.h" #if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__))) #include #endif #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifndef O_BINARY #ifdef _O_BINARY #define O_BINARY _O_BINARY #else #define O_BINARY 0 #endif #endif #ifdef _DEBUG #define READ_SIZE 16 #else #define READ_SIZE (1024*8) #endif typedef struct { XML_Parser parser; int *retPtr; } PROCESS_ARGS; static void reportError(XML_Parser parser, const XML_Char *filename) { enum XML_Error code = XML_GetErrorCode(parser); const XML_Char *message = XML_ErrorString(code); if (message) ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u: %s\n"), filename, XML_GetErrorLineNumber(parser), XML_GetErrorColumnNumber(parser), message); else ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); } /* This implementation will give problems on files larger than INT_MAX. */ static void processFile(const void *data, size_t size, const XML_Char *filename, void *args) { XML_Parser parser = ((PROCESS_ARGS *)args)->parser; int *retPtr = ((PROCESS_ARGS *)args)->retPtr; if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) { reportError(parser, filename); *retPtr = 0; } else *retPtr = 1; } #if (defined(WIN32) || defined(__WATCOMC__)) static int isAsciiLetter(XML_Char c) { return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); } #endif /* WIN32 */ static const XML_Char * resolveSystemId(const XML_Char *base, const XML_Char *systemId, XML_Char **toFree) { XML_Char *s; *toFree = 0; if (!base || *systemId == T('/') #if (defined(WIN32) || defined(__WATCOMC__)) || *systemId == T('\\') || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) #endif ) return systemId; *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) * sizeof(XML_Char)); if (!*toFree) return systemId; tcscpy(*toFree, base); s = *toFree; if (tcsrchr(s, T('/'))) s = tcsrchr(s, T('/')) + 1; #if (defined(WIN32) || defined(__WATCOMC__)) if (tcsrchr(s, T('\\'))) s = tcsrchr(s, T('\\')) + 1; #endif tcscpy(s, systemId); return *toFree; } static int externalEntityRefFilemap(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { int result; XML_Char *s; const XML_Char *filename; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); PROCESS_ARGS args; args.retPtr = &result; args.parser = entParser; filename = resolveSystemId(base, systemId, &s); XML_SetBase(entParser, filename); if (!filemap(filename, processFile, &args)) result = 0; free(s); XML_ParserFree(entParser); return result; } static int processStream(const XML_Char *filename, XML_Parser parser) { /* passing NULL for filename means read intput from stdin */ int fd = 0; /* 0 is the fileno for stdin */ if (filename != NULL) { fd = topen(filename, O_BINARY|O_RDONLY); if (fd < 0) { tperror(filename); return 0; } } for (;;) { int nread; char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); if (!buf) { if (filename != NULL) close(fd); ftprintf(stderr, T("%s: out of memory\n"), filename != NULL ? filename : "xmlwf"); return 0; } nread = read(fd, buf, READ_SIZE); if (nread < 0) { tperror(filename != NULL ? filename : "STDIN"); if (filename != NULL) close(fd); return 0; } if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { reportError(parser, filename != NULL ? filename : "STDIN"); if (filename != NULL) close(fd); return 0; } if (nread == 0) { if (filename != NULL) close(fd); break;; } } return 1; } static int externalEntityRefStream(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId) { XML_Char *s; const XML_Char *filename; int ret; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); filename = resolveSystemId(base, systemId, &s); XML_SetBase(entParser, filename); ret = processStream(filename, entParser); free(s); XML_ParserFree(entParser); return ret; } int XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags) { int result; if (!XML_SetBase(parser, filename)) { ftprintf(stderr, T("%s: out of memory"), filename); exit(1); } if (flags & XML_EXTERNAL_ENTITIES) XML_SetExternalEntityRefHandler(parser, (flags & XML_MAP_FILE) ? externalEntityRefFilemap : externalEntityRefStream); if (flags & XML_MAP_FILE) { PROCESS_ARGS args; args.retPtr = &result; args.parser = parser; if (!filemap(filename, processFile, &args)) result = 0; } else result = processStream(filename, parser); return result; } astropy-0.3/cextern/expat/Makefile.in0000755000175000017500000001557412243255342016054 0ustar oleole################################################################ # Process this file with top-level configure script to produce Makefile # # Copyright 2000 Clark Cooper # # This file is part of EXPAT. # # EXPAT is free software; you can redistribute it and/or modify it # under the terms of the License (based on the MIT/X license) contained # in the file COPYING that comes with this distribution. # # EXPAT 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 EXPAT. # SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ man1dir = @mandir@/man1 pkgconfigdir = $(libdir)/pkgconfig top_builddir = . INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs MANFILE = $(srcdir)/doc/xmlwf.1 APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h LIBRARY = libexpat.la DESTDIR = $(INSTALL_ROOT) default: buildlib xmlwf/xmlwf@EXEEXT@ buildlib: $(LIBRARY) expat.pc all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline clean: cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ rm -rf .libs libexpat.la rm -f examples/core tests/core xmlwf/core clobber: clean distclean: clean rm -f expat_config.h config.status config.log config.cache libtool rm -f Makefile expat.pc extraclean: distclean rm -f expat_config.h.in configure rm -f aclocal.m4 m4/* rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub check: tests/runtests tests/runtestspp tests/runtests tests/runtestspp install: xmlwf/xmlwf@EXEEXT@ installlib $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir) installlib: $(LIBRARY) $(APIHEADER) expat.pc $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir) $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done $(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc uninstall: uninstalllib $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@ rm -f $(DESTDIR)$(man1dir)/xmlwf.1 uninstalllib: $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY) rm -f $(DESTDIR)$(includedir)/expat.h rm -f $(DESTDIR)$(includedir)/expat_external.h rm -f $(DESTDIR)$(pkgconfigdir)/expat.pc # for VPATH builds (invoked by configure) mkdir-init: @for d in lib xmlwf examples tests ; do \ (mkdir $$d 2> /dev/null || test 1) ; \ done CC = @CC@ CXX = @CXX@ LIBTOOL = @LIBTOOL@ INCLUDES = -I$(srcdir)/lib -I. LDFLAGS = @LDFLAGS@ CPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ ### autoconf this? LTFLAGS = --silent COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS) CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS) LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@ LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo $(LIBRARY): $(LIB_OBJS) $(LINK_LIB) $(LIB_OBJS) expat.pc: $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@ xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) examples/elements.@OBJEXT@: examples/elements.c examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) examples/outline.@OBJEXT@: examples/outline.c examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) $(LINK_EXE) $< $(LIBRARY) tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) $(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) run-benchmark: tests/benchmark/benchmark tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 tests/xmlts.zip: wget --output-document=tests/xmlts.zip \ http://www.w3.org/XML/Test/xmlts20080827.zip tests/XML-Test-Suite: tests/xmlts.zip cd tests && unzip -q xmlts.zip run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite tests/xmltest.sh .SUFFIXES: .c .cpp .lo .@OBJEXT@ .cpp.@OBJEXT@: $(CXXCOMPILE) -o $@ -c $< .c.@OBJEXT@: $(COMPILE) -o $@ -c $< .c.lo: $(LTCOMPILE) -o $@ -c $< .PHONY: buildlib all \ clean distclean extraclean maintainer-clean \ dist distdir \ install uninstall astropy-0.3/cextern/expat/examples/0000755000175000017500000000000012243263747015616 5ustar oleoleastropy-0.3/cextern/expat/examples/outline.dsp0000755000175000017500000000666012243255342020010 0ustar oleole# Microsoft Developer Studio Project File - Name="outline" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=outline - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "outline.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "outline.mak" CFG="outline - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "outline - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "outline - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "outline - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release-outline" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c # SUBTRACT CPP /X /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 # ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\outline.exe" !ELSEIF "$(CFG)" == "outline - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug-outline" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\outline.exe" !ENDIF # Begin Target # Name "outline - Win32 Release" # Name "outline - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\outline.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project astropy-0.3/cextern/expat/examples/elements.dsp0000755000175000017500000000674412243255342020150 0ustar oleole# Microsoft Developer Studio Project File - Name="elements" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=elements - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "elements.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "elements.mak" CFG="elements - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "elements - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "elements - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "elements - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\win32\bin\Release" # PROP Intermediate_Dir "..\win32\tmp\Release-elements" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "XML_STATIC" /FD /c # SUBTRACT CPP /X /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /machine:I386 # ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\elements.exe" !ELSEIF "$(CFG)" == "elements - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\win32\bin\Debug" # PROP Intermediate_Dir "..\win32\tmp\Debug-elements" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "XML_STATIC" /FR /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\elements.exe" !ENDIF # Begin Target # Name "elements - Win32 Release" # Name "elements - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=.\elements.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project astropy-0.3/cextern/expat/examples/elements.c0000755000175000017500000000312112243255342017566 0ustar oleole/* This is simple demonstration of how to use expat. This program reads an XML document from standard input and writes a line with the name of each element to standard output indenting child elements by one tab stop more than their parent element. It must be used with Expat compiled for UTF-8 output. */ #include #include "expat.h" #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif #ifdef XML_LARGE_SIZE #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 #define XML_FMT_INT_MOD "I64" #else #define XML_FMT_INT_MOD "ll" #endif #else #define XML_FMT_INT_MOD "l" #endif static void XMLCALL startElement(void *userData, const char *name, const char **atts) { int i; int *depthPtr = (int *)userData; for (i = 0; i < *depthPtr; i++) putchar('\t'); puts(name); *depthPtr += 1; } static void XMLCALL endElement(void *userData, const char *name) { int *depthPtr = (int *)userData; *depthPtr -= 1; } int main(int argc, char *argv[]) { char buf[BUFSIZ]; XML_Parser parser = XML_ParserCreate(NULL); int done; int depth = 0; XML_SetUserData(parser, &depth); XML_SetElementHandler(parser, startElement, endElement); do { int len = (int)fread(buf, 1, sizeof(buf), stdin); done = len < sizeof(buf); if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { fprintf(stderr, "%s at line %" XML_FMT_INT_MOD "u\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); return 1; } } while (!done); XML_ParserFree(parser); return 0; } astropy-0.3/cextern/expat/examples/outline.c0000755000175000017500000000455712243255342017447 0ustar oleole/***************************************************************** * outline.c * * Copyright 1999, Clark Cooper * All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the license contained in the * COPYING file that comes with the expat distribution. * * 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. * * Read an XML document from standard input and print an element * outline on standard output. * Must be used with Expat compiled for UTF-8 output. */ #include #include #if defined(__amigaos__) && defined(__USE_INLINE__) #include #endif #ifdef XML_LARGE_SIZE #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 #define XML_FMT_INT_MOD "I64" #else #define XML_FMT_INT_MOD "ll" #endif #else #define XML_FMT_INT_MOD "l" #endif #define BUFFSIZE 8192 char Buff[BUFFSIZE]; int Depth; static void XMLCALL start(void *data, const char *el, const char **attr) { int i; for (i = 0; i < Depth; i++) printf(" "); printf("%s", el); for (i = 0; attr[i]; i += 2) { printf(" %s='%s'", attr[i], attr[i + 1]); } printf("\n"); Depth++; } static void XMLCALL end(void *data, const char *el) { Depth--; } int main(int argc, char *argv[]) { XML_Parser p = XML_ParserCreate(NULL); if (! p) { fprintf(stderr, "Couldn't allocate memory for parser\n"); exit(-1); } XML_SetElementHandler(p, start, end); for (;;) { int done; int len; len = (int)fread(Buff, 1, BUFFSIZE, stdin); if (ferror(stdin)) { fprintf(stderr, "Read error\n"); exit(-1); } done = feof(stdin); if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) { fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n", XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p))); exit(-1); } if (done) break; } XML_ParserFree(p); return 0; } astropy-0.3/cextern/expat/expat_config.h.cmake0000755000175000017500000000525712243255342017702 0ustar oleole/* expat_config.h.in. Generated from configure.in by autoheader. */ /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #cmakedefine BYTEORDER @BYTEORDER@ /* Define to 1 if you have the `bcopy' function. */ #cmakedefine HAVE_BCOPY /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_FCNTL_H /* Define to 1 if you have the `getpagesize' function. */ #cmakedefine HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #cmakedefine HAVE_INTTYPES_H /* Define to 1 if you have the `memmove' function. */ #cmakedefine HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #cmakedefine HAVE_MMAP /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDINT_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_STRING_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UNISTD_H /* Define to the address where bug reports for this package should be sent. */ #cmakedefine PACKAGE_BUGREPORT /* Define to the full name of this package. */ #cmakedefine PACKAGE_NAME /* Define to the full name and version of this package. */ #cmakedefine PACKAGE_STRING /* Define to the one symbol short name of this package. */ #cmakedefine PACKAGE_TARNAME /* Define to the version of this package. */ #cmakedefine PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #cmakedefine STDC_HEADERS /* whether byteorder is bigendian */ #cmakedefine WORDS_BIGENDIAN /* Define to specify how much context to retain around the current parse point. */ #cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@ /* Define to make parameter entity parsing functionality available. */ #cmakedefine XML_DTD /* Define to make XML Namespaces functionality available. */ #cmakedefine XML_NS /* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ #ifdef _MSC_VER # define __func__ __FUNCTION__ #endif /* Define to `long' if does not define. */ #cmakedefine off_t @OFF_T@ /* Define to `unsigned' if does not define. */ #cmakedefine size_t @SIZE_T@ astropy-0.3/cextern/expat/bcb5/0000755000175000017500000000000012243263747014613 5ustar oleoleastropy-0.3/cextern/expat/bcb5/expat_static.mak0000755000175000017500000001132612243255342017773 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\libexpats_mtd.lib OBJFILES = Release\obj\libexpat_static\xmlparse.obj \ Release\obj\libexpat_static\xmlrole.obj \ Release\obj\libexpat_static\xmltok.obj RESFILES = MAINSOURCE = expat_static.bpf RESDEPEN = $(RESFILES) LIBFILES = IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = SPARELIBS = DEFFILE = # --------------------------------------------------------------------------- PATHCPP = .;..\lib PATHASM = .; PATHPAS = .; PATHRC = .; LINKER = TLib DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\lib;$(BCB)\include LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc LISTFILE = # --------------------------------------------------------------------------- CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\libexpat_static -N0Release\obj\libexpat_static -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = # --------------------------------------------------------------------------- ALLOBJ = $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = TLib !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- !if "$(LISTFILE)" == "" COMMA = !else COMMA = , !endif $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) /u $@ @&&! $(LFLAGS) $? $(COMMA) $(LISTFILE) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/expatw_static.bpf0000755000175000017500000000026512243255342020161 0ustar oleoleUSEUNIT("..\lib\xmlparse.c"); USEUNIT("..\lib\xmlrole.c"); USEUNIT("..\lib\xmltok.c"); //--------------------------------------------------------------------------- #define Library astropy-0.3/cextern/expat/bcb5/expat_static.bpr0000755000175000017500000000702112243255342020003 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\lib;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=5 Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=7 Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC Item3=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP Item5=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_MBCS Item6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP [HistoryLists\hlIntOutputDir] Count=6 Item0=Release\obj\libexpat_static Item1=Release\obj\mts Item2=Release\obj\mt Item3=Release Item4=..\lib\Release_static Item5=Release_static [HistoryLists\hlFinalOutputDir] Count=3 Item0=Release\ Item1=Release Item2=Release_static\ [HistoryLists\hlTlibPageSize] Count=1 Item0=0x0010 [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/xmlwf.mak0000755000175000017500000001203112243255342016432 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\xmlwf.exe OBJFILES = Release\obj\xmlwf\codepage.obj Release\obj\xmlwf\win32filemap.obj \ Release\obj\xmlwf\xmlfile.obj Release\obj\xmlwf\xmlwf.obj RESFILES = MAINSOURCE = xmlwf.bpf RESDEPEN = $(RESFILES) LIBFILES = Release\libexpat_mtd.lib IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi SPARELIBS = DEFFILE = # --------------------------------------------------------------------------- PATHCPP = .;..\xmlwf PATHASM = .; PATHPAS = .; PATHRC = .; DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\xmlwf;$(BCB)\include LIBPATH = ..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS= -w-8065 -w-par -w-8027 -w-8026 # --------------------------------------------------------------------------- CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\xmlwf -N0Release\obj\xmlwf -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = -IRelease\obj\xmlwf -D"" -ap -Tpe -x -Gn -q # --------------------------------------------------------------------------- ALLOBJ = c0x32.obj $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = ilink32 !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) @&&! $(LFLAGS) -L$(LIBPATH) + $(ALLOBJ), + $(PROJECT),, + $(ALLLIB), + $(DEFFILE), + $(ALLRES) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/expat_static.bpf0000755000175000017500000000026512243255342017772 0ustar oleoleUSEUNIT("..\lib\xmlparse.c"); USEUNIT("..\lib\xmlrole.c"); USEUNIT("..\lib\xmltok.c"); //--------------------------------------------------------------------------- #define Library astropy-0.3/cextern/expat/bcb5/outline.bpr0000755000175000017500000000660712243255342017003 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=3 Item0=..\examples;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=4 Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=6 Item0=WIN32;NDEBUG;_CONSOLE Item1=WIN32;NDEBUG;_CONSOLE;XML_STATIC Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE Item5=WIN32;NDEBUG;_CONSOLE;_DEBUG [HistoryLists\hlIntOutputDir] Count=4 Item0=Release\obj\examples Item1=Release\obj\outline Item2=..\examples\Release Item3=Release [HistoryLists\hlFinalOutputDir] Count=1 Item0=Release\ [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/elements.bpf0000755000175000017500000000023312243255342017111 0ustar oleoleUSEUNIT("..\examples\elements.c"); USELIB("Release\libexpats_mtd.lib"); //--------------------------------------------------------------------------- main astropy-0.3/cextern/expat/bcb5/expatw.mak0000755000175000017500000001206512243255342016614 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\libexpatw_mtd.dll OBJFILES = Release\obj\libexpatw\xmlparse.obj Release\obj\libexpatw\xmlrole.obj \ Release\obj\libexpatw\xmltok.obj RESFILES = MAINSOURCE = expatw.bpf RESDEPEN = $(RESFILES) LIBFILES = IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi SPARELIBS = DEFFILE = libexpatw_mtd.def # --------------------------------------------------------------------------- PATHCPP = .;..\lib PATHASM = .; PATHPAS = .; PATHRC = .; DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\lib;$(BCB)\include LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc # --------------------------------------------------------------------------- CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\libexpatw -N0Release\obj\libexpatw -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = -IRelease\obj\libexpatw -D"" -aa -Tpd -x -Gn -Gi -w -q # --------------------------------------------------------------------------- ALLOBJ = c0d32w.obj $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = ilink32 !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) @&&! $(LFLAGS) -L$(LIBPATH) + $(ALLOBJ), + $(PROJECT),, + $(ALLLIB), + $(DEFFILE), + $(ALLRES) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/all_projects.bpg0000755000175000017500000000310612243255342017761 0ustar oleole#------------------------------------------------------------------------------ VERSION = BWS.01 #------------------------------------------------------------------------------ !ifndef ROOT ROOT = $(MAKEDIR)\.. !endif #------------------------------------------------------------------------------ MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** DCC = $(ROOT)\bin\dcc32.exe $** BRCC = $(ROOT)\bin\brcc32.exe $** #------------------------------------------------------------------------------ PROJECTS = setup libexpat_mtd.dll libexpats_mtd.lib libexpatw_mtd.dll \ libexpatws_mtd.lib elements.exe outline.exe xmlwf.exe #------------------------------------------------------------------------------ default: $(PROJECTS) #------------------------------------------------------------------------------ libexpat_mtd.dll: expat.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak libexpats_mtd.lib: expat_static.bpr $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak libexpatw_mtd.dll: expatw.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak libexpatws_mtd.lib: expatw_static.bpr $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak elements.exe: elements.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak outline.exe: outline.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak xmlwf.exe: xmlwf.bpr $(ROOT)\bin\bpr2mak $** $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak setup: setup.bat call $** astropy-0.3/cextern/expat/bcb5/elements.bpr0000755000175000017500000001074012243255342017131 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\examples;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=8 Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release-w_static Item4=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release_static Item5=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat\lib\Release_static Item6=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item7=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=17 Item0=WIN32;NDEBUG;_CONSOLE;XML_STATIC Item1=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG Item5=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG Item6=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;_UNICODE Item7=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T Item8=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T Item9=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T Item10=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE Item11=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;__WCHAR_T Item12=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE Item13=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE;_UNICODE Item14=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE Item15=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG Item16=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC [HistoryLists\hlIntOutputDir] Count=5 Item0=Release\obj\examples Item1=Release\obj\elements Item2=Release\obj\mts Item3=..\examples\Release Item4=Release [HistoryLists\hlFinalOutputDir] Count=1 Item0=Release\ [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/README.txt0000755000175000017500000001031512243255342016304 0ustar oleole Using a Borland compiler product The files in this directory support using both the free Borland command-line compiler tools and the Borland C++ Builder IDE. The project files have been tested with both versions 5 and 6 of the C++ Builder product. Using the free BCC32 command line compiler After downloading and installing the free C++ Builder commandline version, perform the following steps (assuming it was installed under C:\Borland\BCC55): 1) Add "C:\Borland\BCC55\BIN" to your path 2) Set the environment variable BCB to "C:\Borland\BCC55". 3) edit makefile.mak: enable or comment out the appropriate commands under clean & distclean, depending on whether your OS can use deltree /y or del /s/f/q. After that, you should simply cd to the bcb5 directory in your Expat directory tree (same structure as CVS) and run "make all" or just "make". Naming The libraries have the base name "libexpat" followed optionally by an "s" (static) or a "w" (unicode version), then an underscore and optionally "mt" (multi-threaded) and "d" (dynamic RTL). To change the name of the library a project file produces, edit the project option source (see step 1 under Unicode below) and change the name contained in the PROJECT tag. In a make file, change the value assigned to the PROJECT variable. Also, the LIBRARY entry in the .def file has to be changed to correspond to the new executable name. Unicode Considerations There are no facilities in the BCB 5 GUI to create a unicode-enabled application. Fortunately, it is not hard to do by hand. 1. The startup .obj system file must be changed to the unicode version. Go to Project|Edit Option Source, and scroll down to the ALLOBJ tag. Change c0x32.obj to c0x32w.obj. Editing this file can be quirky, but usually the following kludge will make the change stick. Close and save the file (CTRL-F4) then open the options dialog (CTRL-Shift-F11), then click OK on the dialog immediately without changing anything in it. If this doesn't work, you will have to close the project completely and edit the .bpr file by hand. If you are using a make file, just change the startup .obj file assigned to the ALLOBJ variable. 2. Add the macro define XML_UNICODE_WCHAR_T. In the GUI that goes in the options dialog, Directories/Conditionals tab, in the Conditional define box. In a make file, put it in the USERDEFINES variable. 3. Of course, your code has to be written for unicode. As a start, the "main" function is called "wmain". The tchar macros are an interesting way to write code that can easily switch between unicode and utf-8. If these macros are used, then simply adding the conditional define _UNICODE as well as XML_UNICODE_WCHAR_T will bring in the unicode versions of the tchar macros. Otherwise the utf-8 versions are used. xmlwf uses its own versions of the tchar macros which are switched on and off by the XML_UNICODE macro, which itself is set by the XML_UNICODE_WCHAR_T define. Threading The libexpat libraries are all built to link with the multi-threaded dynamic RTL's. That means they require CC32xxMT.DLL present on the installation target. To create single-threaded libs, do the following: 1. The compiler option for multi-threading must be turned off. Following the instructions above to edit the option source, remove the -tWM option from the CFLAG1 tag. In a make file, remove it from the CFLAG1 variable. 2. The single threaded RTL must be called. change the RTL in the ALLLIB tag or variable (GUI or makefile repectively) to the version without the "mt" in the name. For example, change cw32mti.lib to cw32i.lib. Static RTL's To build the libs with static RTL's do the following, 1. For the static expatlibs, in the Tlib tab on the options dialog, uncheck the "Use dynamic RTL" box. For the dynamic expatlibs, in the Linker tab on the options dialog, uncheck "Use dynamic RTL". If you are using a make file, remove the _RTLDLL assignment to the SYSDEFINES variable, and change the RTL to the version without an "i" in the ALLLIB variable. For example, cw32mti.lib would become cw32mt.lib. astropy-0.3/cextern/expat/bcb5/setup.bat0000755000175000017500000000105112243255342016433 0ustar oleoleREM CommandInterpreter: $(COMSPEC) if not exist .\release\nul mkdir release if not exist .\release\obj\nul mkdir release\obj if not exist .\release\obj\libexpat\nul mkdir release\obj\libexpat if not exist .\release\obj\libexpatw\nul mkdir release\obj\libexpatw if not exist .\release\obj\libexpat_static\nul mkdir release\obj\libexpat_static if not exist .\release\obj\libexpatw_static\nul mkdir release\obj\libexpatw_static if not exist .\release\obj\examples\nul mkdir release\obj\examples if not exist .\release\obj\xmlwf\nul mkdir release\obj\xmlwf astropy-0.3/cextern/expat/bcb5/expat.bpf0000755000175000017500000000032712243255342016422 0ustar oleoleUSEUNIT("..\lib\xmlparse.c"); USEUNIT("..\lib\xmlrole.c"); USEUNIT("..\lib\xmltok.c"); USEDEF("libexpat_mtd.def"); //--------------------------------------------------------------------------- #define DllEntryPoint astropy-0.3/cextern/expat/bcb5/expatw.bpf0000755000175000017500000000033012243255342016603 0ustar oleoleUSEUNIT("..\lib\xmlparse.c"); USEUNIT("..\lib\xmlrole.c"); USEUNIT("..\lib\xmltok.c"); USEDEF("libexpatw_mtd.def"); //--------------------------------------------------------------------------- #define DllEntryPoint astropy-0.3/cextern/expat/bcb5/xmlwf.bpr0000755000175000017500000000730712243255342016457 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\xmlwf;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=5 Item0=..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\xmlwf;$(BCB)\lib;..\xmlwf\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=6 Item0=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP Item1=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE Item2=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T Item3=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG Item4=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T Item5=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE [HistoryLists\hlIntOutputDir] Count=3 Item0=Release\obj\xmlwf Item1=..\xmlwf\Release Item2=Release [HistoryLists\hlFinalOutputDir] Count=3 Item0=Release\ Item1=Release Item2=.\Release\ [Debugging] DebugSourceDirs= [Parameters] RunParams=sample.xml HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/makefile.mak0000755000175000017500000000102612243255342017054 0ustar oleoleall: setup expat expatw expat_static expatw_static elements outline xmlwf setup: setup expat: make -l -fexpat.mak expatw: make -l -fexpatw.mak expat_static: make -l -fexpat_static.mak expatw_static: make -l -fexpatw_static.mak elements: make -l -felements.mak outline: make -l -foutline.mak xmlwf: make -l -fxmlwf.mak clean: # works on Win98/ME # deltree /y release\obj # works on WinNT/2000 del /s/f/q release\obj distclean: # works on Win98/ME # deltree /y release\*.* # works on WinNT/2000 del /s/f/q release\* astropy-0.3/cextern/expat/bcb5/expat.mak0000755000175000017500000001202412243255342016420 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\libexpat_mtd.dll OBJFILES = Release\obj\libexpat\xmlparse.obj Release\obj\libexpat\xmlrole.obj \ Release\obj\libexpat\xmltok.obj RESFILES = MAINSOURCE = expat.bpf RESDEPEN = $(RESFILES) LIBFILES = IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi SPARELIBS = DEFFILE = libexpat_mtd.def # --------------------------------------------------------------------------- PATHCPP = .;..\lib PATHASM = .; PATHPAS = .; PATHRC = .; DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\lib;$(BCB)\include LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc # --------------------------------------------------------------------------- CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\libexpat -N0Release\obj\libexpat -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = -IRelease\obj\libexpat -D"" -aa -Tpd -x -Gn -Gi -q # --------------------------------------------------------------------------- ALLOBJ = c0d32.obj $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = ilink32 !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) @&&! $(LFLAGS) -L$(LIBPATH) + $(ALLOBJ), + $(PROJECT),, + $(ALLLIB), + $(DEFFILE), + $(ALLRES) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/libexpat_mtd.def0000755000175000017500000001256712243255342017755 0ustar oleole; DEF file for BCB5 LIBRARY LIBEXPAT_MTD DESCRIPTION "Implements an XML parser." EXPORTS _XML_DefaultCurrent @1 _XML_ErrorString @2 _XML_ExpatVersion @3 _XML_ExpatVersionInfo @4 _XML_ExternalEntityParserCreate @5 _XML_GetBase @6 _XML_GetBuffer @7 _XML_GetCurrentByteCount @8 _XML_GetCurrentByteIndex @9 _XML_GetCurrentColumnNumber @10 _XML_GetCurrentLineNumber @11 _XML_GetErrorCode @12 _XML_GetIdAttributeIndex @13 _XML_GetInputContext @14 _XML_GetSpecifiedAttributeCount @15 _XML_Parse @16 _XML_ParseBuffer @17 _XML_ParserCreate @18 _XML_ParserCreateNS @19 _XML_ParserCreate_MM @20 _XML_ParserFree @21 _XML_SetAttlistDeclHandler @22 _XML_SetBase @23 _XML_SetCdataSectionHandler @24 _XML_SetCharacterDataHandler @25 _XML_SetCommentHandler @26 _XML_SetDefaultHandler @27 _XML_SetDefaultHandlerExpand @28 _XML_SetDoctypeDeclHandler @29 _XML_SetElementDeclHandler @30 _XML_SetElementHandler @31 _XML_SetEncoding @32 _XML_SetEndCdataSectionHandler @33 _XML_SetEndDoctypeDeclHandler @34 _XML_SetEndElementHandler @35 _XML_SetEndNamespaceDeclHandler @36 _XML_SetEntityDeclHandler @37 _XML_SetExternalEntityRefHandler @38 _XML_SetExternalEntityRefHandlerArg @39 _XML_SetNamespaceDeclHandler @40 _XML_SetNotStandaloneHandler @41 _XML_SetNotationDeclHandler @42 _XML_SetParamEntityParsing @43 _XML_SetProcessingInstructionHandler @44 _XML_SetReturnNSTriplet @45 _XML_SetStartCdataSectionHandler @46 _XML_SetStartDoctypeDeclHandler @47 _XML_SetStartElementHandler @48 _XML_SetStartNamespaceDeclHandler @49 _XML_SetUnknownEncodingHandler @50 _XML_SetUnparsedEntityDeclHandler @51 _XML_SetUserData @52 _XML_SetXmlDeclHandler @53 _XML_UseParserAsHandlerArg @54 ; added with version 1.95.3 _XML_ParserReset @55 _XML_SetSkippedEntityHandler @56 ; added with version 1.95.5 _XML_GetFeatureList @57 _XML_UseForeignDTD @58 ; added with version 1.95.6 _XML_FreeContentModel @59 _XML_MemMalloc @60 _XML_MemRealloc @61 _XML_MemFree @62 ; added with version 1.95.8 _XML_StopParser @63 _XML_ResumeParser @64 _XML_GetParsingStatus @65 ; Aliases for MS compatible names XML_DefaultCurrent = _XML_DefaultCurrent XML_ErrorString = _XML_ErrorString XML_ExpatVersion = _XML_ExpatVersion XML_ExpatVersionInfo = _XML_ExpatVersionInfo XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate XML_GetBase = _XML_GetBase XML_GetBuffer = _XML_GetBuffer XML_GetCurrentByteCount = _XML_GetCurrentByteCount XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber XML_GetErrorCode = _XML_GetErrorCode XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex XML_GetInputContext = _XML_GetInputContext XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount XML_Parse = _XML_Parse XML_ParseBuffer = _XML_ParseBuffer XML_ParserCreate = _XML_ParserCreate XML_ParserCreateNS = _XML_ParserCreateNS XML_ParserCreate_MM = _XML_ParserCreate_MM XML_ParserFree = _XML_ParserFree XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler XML_SetBase = _XML_SetBase XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler XML_SetCommentHandler = _XML_SetCommentHandler XML_SetDefaultHandler = _XML_SetDefaultHandler XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler XML_SetElementDeclHandler = _XML_SetElementDeclHandler XML_SetElementHandler = _XML_SetElementHandler XML_SetEncoding = _XML_SetEncoding XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler XML_SetEndElementHandler = _XML_SetEndElementHandler XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler XML_SetParamEntityParsing = _XML_SetParamEntityParsing XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler XML_SetStartElementHandler = _XML_SetStartElementHandler XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler XML_SetUserData = _XML_SetUserData XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg XML_ParserReset = _XML_ParserReset XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler XML_GetFeatureList = _XML_GetFeatureList XML_UseForeignDTD = _XML_UseForeignDTD XML_FreeContentModel = _XML_FreeContentModel XML_MemMalloc = _XML_MemMalloc XML_MemRealloc = _XML_MemRealloc XML_MemFree = _XML_MemFree XML_StopParser = _XML_StopParser XML_ResumeParser = _XML_ResumeParser XML_GetParsingStatus = _XML_GetParsingStatus astropy-0.3/cextern/expat/bcb5/libexpatw_mtd.def0000755000175000017500000001256712243255342020144 0ustar oleole; DEF file for BCB5 LIBRARY LIBEXPATW_MTD DESCRIPTION "Implements an XML parser." EXPORTS _XML_DefaultCurrent @1 _XML_ErrorString @2 _XML_ExpatVersion @3 _XML_ExpatVersionInfo @4 _XML_ExternalEntityParserCreate @5 _XML_GetBase @6 _XML_GetBuffer @7 _XML_GetCurrentByteCount @8 _XML_GetCurrentByteIndex @9 _XML_GetCurrentColumnNumber @10 _XML_GetCurrentLineNumber @11 _XML_GetErrorCode @12 _XML_GetIdAttributeIndex @13 _XML_GetInputContext @14 _XML_GetSpecifiedAttributeCount @15 _XML_Parse @16 _XML_ParseBuffer @17 _XML_ParserCreate @18 _XML_ParserCreateNS @19 _XML_ParserCreate_MM @20 _XML_ParserFree @21 _XML_SetAttlistDeclHandler @22 _XML_SetBase @23 _XML_SetCdataSectionHandler @24 _XML_SetCharacterDataHandler @25 _XML_SetCommentHandler @26 _XML_SetDefaultHandler @27 _XML_SetDefaultHandlerExpand @28 _XML_SetDoctypeDeclHandler @29 _XML_SetElementDeclHandler @30 _XML_SetElementHandler @31 _XML_SetEncoding @32 _XML_SetEndCdataSectionHandler @33 _XML_SetEndDoctypeDeclHandler @34 _XML_SetEndElementHandler @35 _XML_SetEndNamespaceDeclHandler @36 _XML_SetEntityDeclHandler @37 _XML_SetExternalEntityRefHandler @38 _XML_SetExternalEntityRefHandlerArg @39 _XML_SetNamespaceDeclHandler @40 _XML_SetNotStandaloneHandler @41 _XML_SetNotationDeclHandler @42 _XML_SetParamEntityParsing @43 _XML_SetProcessingInstructionHandler @44 _XML_SetReturnNSTriplet @45 _XML_SetStartCdataSectionHandler @46 _XML_SetStartDoctypeDeclHandler @47 _XML_SetStartElementHandler @48 _XML_SetStartNamespaceDeclHandler @49 _XML_SetUnknownEncodingHandler @50 _XML_SetUnparsedEntityDeclHandler @51 _XML_SetUserData @52 _XML_SetXmlDeclHandler @53 _XML_UseParserAsHandlerArg @54 ; added with version 1.95.3 _XML_ParserReset @55 _XML_SetSkippedEntityHandler @56 ; added with version 1.95.5 _XML_GetFeatureList @57 _XML_UseForeignDTD @58 ; added with version 1.95.6 _XML_FreeContentModel @59 _XML_MemMalloc @60 _XML_MemRealloc @61 _XML_MemFree @62 ; added with version 1.95.8 _XML_StopParser @63 _XML_ResumeParser @64 _XML_GetParsingStatus @65 ; Aliases for MS compatible names XML_DefaultCurrent = _XML_DefaultCurrent XML_ErrorString = _XML_ErrorString XML_ExpatVersion = _XML_ExpatVersion XML_ExpatVersionInfo = _XML_ExpatVersionInfo XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate XML_GetBase = _XML_GetBase XML_GetBuffer = _XML_GetBuffer XML_GetCurrentByteCount = _XML_GetCurrentByteCount XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber XML_GetErrorCode = _XML_GetErrorCode XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex XML_GetInputContext = _XML_GetInputContext XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount XML_Parse = _XML_Parse XML_ParseBuffer = _XML_ParseBuffer XML_ParserCreate = _XML_ParserCreate XML_ParserCreateNS = _XML_ParserCreateNS XML_ParserCreate_MM = _XML_ParserCreate_MM XML_ParserFree = _XML_ParserFree XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler XML_SetBase = _XML_SetBase XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler XML_SetCommentHandler = _XML_SetCommentHandler XML_SetDefaultHandler = _XML_SetDefaultHandler XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler XML_SetElementDeclHandler = _XML_SetElementDeclHandler XML_SetElementHandler = _XML_SetElementHandler XML_SetEncoding = _XML_SetEncoding XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler XML_SetEndElementHandler = _XML_SetEndElementHandler XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler XML_SetParamEntityParsing = _XML_SetParamEntityParsing XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler XML_SetStartElementHandler = _XML_SetStartElementHandler XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler XML_SetUserData = _XML_SetUserData XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg XML_ParserReset = _XML_ParserReset XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler XML_GetFeatureList = _XML_GetFeatureList XML_UseForeignDTD = _XML_UseForeignDTD XML_FreeContentModel = _XML_FreeContentModel XML_MemMalloc = _XML_MemMalloc XML_MemRealloc = _XML_MemRealloc XML_MemFree = _XML_MemFree XML_StopParser = _XML_StopParser XML_ResumeParser = _XML_ResumeParser XML_GetParsingStatus = _XML_GetParsingStatus astropy-0.3/cextern/expat/bcb5/expatw_static.mak0000755000175000017500000001136712243255342020167 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\libexpatws_mtd.lib OBJFILES = Release\obj\libexpatw_static\xmlparse.obj \ Release\obj\libexpatw_static\xmlrole.obj \ Release\obj\libexpatw_static\xmltok.obj RESFILES = MAINSOURCE = expatw_static.bpf RESDEPEN = $(RESFILES) LIBFILES = IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = SPARELIBS = DEFFILE = # --------------------------------------------------------------------------- PATHCPP = .;..\lib PATHASM = .; PATHPAS = .; PATHRC = .; LINKER = TLib DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\lib;$(BCB)\include LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc LISTFILE = # --------------------------------------------------------------------------- CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\libexpatw_static -N0Release\obj\libexpatw_static -$Y- -$L- \ -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = # --------------------------------------------------------------------------- ALLOBJ = $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = TLib !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- !if "$(LISTFILE)" == "" COMMA = !else COMMA = , !endif $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) /u $@ @&&! $(LFLAGS) $? $(COMMA) $(LISTFILE) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/outline.mak0000755000175000017500000001166412243255342016767 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\outline.exe OBJFILES = Release\obj\examples\outline.obj RESFILES = MAINSOURCE = outline.bpf RESDEPEN = $(RESFILES) LIBFILES = Release\libexpat_mtd.lib IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi SPARELIBS = DEFFILE = # --------------------------------------------------------------------------- PATHCPP = .;..\examples PATHASM = .; PATHPAS = .; PATHRC = .; DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = WIN32;NDEBUG;_CONSOLE SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\examples;$(BCB)\include LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS= -w-par -w-8027 -w-8026 # --------------------------------------------------------------------------- CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q # --------------------------------------------------------------------------- ALLOBJ = c0x32.obj $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = ilink32 !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) @&&! $(LFLAGS) -L$(LIBPATH) + $(ALLOBJ), + $(PROJECT),, + $(ALLLIB), + $(DEFFILE), + $(ALLRES) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/bcb5/expatw_static.bpr0000755000175000017500000001066712243255342020204 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\lib;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=5 Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=15 Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T Item5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG Item6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus Item7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG Item8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG Item9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T Item10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE Item11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG;_UNICODE Item12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG Item13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T Item14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;XML_UNICODE [HistoryLists\hlIntOutputDir] Count=6 Item0=Release\obj\libexpatw_static Item1=Release\obj\libexpat_static Item2=Release\obj\mts Item3=Release\obj\mt Item4=..\lib\Release-w_static Item5=Release-w_static [HistoryLists\hlFinalOutputDir] Count=3 Item0=Release\ Item1=Release Item2=Release-w_static\ [HistoryLists\hlTlibPageSize] Count=1 Item0=0x0010 [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/expat.bpr0000755000175000017500000000770712243255342016447 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\lib;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=5 Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=8 Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS;COMPILED_FROM_DSP Item5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG Item6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP [HistoryLists\hlIntOutputDir] Count=7 Item0=Release\obj\libexpat Item1=Release\obj\libexpat_static Item2=Release\obj\mtd Item3=Release\obj\mt Item4=Release\obj Item5=Release Item6=..\lib\Release [HistoryLists\hlFinalOutputDir] Count=1 Item0=Release\ [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/expatw.bpr0000755000175000017500000001051312243255342016623 0ustar oleole [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=1033 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [HistoryLists\hlIncludePath] Count=4 Item0=..\lib;$(BCB)\include Item1=$(BCB)\include Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; [HistoryLists\hlLibraryPath] Count=5 Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) Item2=$(BCB)\lib;$(RELEASELIBPATH) Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; [HistoryLists\hlDebugSourcePath] Count=1 Item0=$(BCB)\source\vcl [HistoryLists\hlConditionals] Count=9 Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T Item2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T Item3=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T Item4=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG Item5=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG Item6=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T Item7=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE Item8=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T [HistoryLists\hlIntOutputDir] Count=8 Item0=Release\obj\libexpatw Item1=Release\obj\libexpat Item2=Release\obj\mtd Item3=Release\obj\mt Item4=Release_w\obj Item5=Release-w\obj Item6=Release-w Item7=..\lib\Release-w [HistoryLists\hlFinalOutputDir] Count=5 Item0=Release\ Item1=Release Item2=Release_w\ Item3=Release-w\ Item4=Release-w [Debugging] DebugSourceDirs= [Parameters] RunParams= HostApplication= RemoteHost= RemotePath= RemoteDebug=0 [Compiler] ShowInfoMsgs=0 LinkDebugVcl=0 LinkCGLIB=0 [Language] ActiveLang= ProjectLang= RootDir= astropy-0.3/cextern/expat/bcb5/outline.bpf0000755000175000017500000000023112243255342016752 0ustar oleoleUSEUNIT("..\examples\outline.c"); USELIB("Release\libexpat_mtd.lib"); //--------------------------------------------------------------------------- main astropy-0.3/cextern/expat/bcb5/xmlwf.bpf0000755000175000017500000000036712243255342016442 0ustar oleoleUSEUNIT("..\xmlwf\codepage.c"); USEUNIT("..\xmlwf\win32filemap.c"); USEUNIT("..\xmlwf\xmlfile.c"); USEUNIT("..\xmlwf\xmlwf.c"); USELIB("Release\libexpat_mtd.lib"); //--------------------------------------------------------------------------- main astropy-0.3/cextern/expat/bcb5/elements.mak0000755000175000017500000001172612243255342017123 0ustar oleole# --------------------------------------------------------------------------- !if !$d(BCB) BCB = $(MAKEDIR)\.. !endif # --------------------------------------------------------------------------- # IDE SECTION # --------------------------------------------------------------------------- # The following section of the project makefile is managed by the BCB IDE. # It is recommended to use the IDE to change any of the values in this # section. # --------------------------------------------------------------------------- VERSION = BCB.05.03 # --------------------------------------------------------------------------- PROJECT = Release\elements.exe OBJFILES = Release\obj\examples\elements.obj RESFILES = MAINSOURCE = elements.bpf RESDEPEN = $(RESFILES) LIBFILES = Release\libexpats_mtd.lib IDLFILES = IDLGENFILES = LIBRARIES = PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi SPARELIBS = DEFFILE = # --------------------------------------------------------------------------- PATHCPP = .;..\examples PATHASM = .; PATHPAS = .; PATHRC = .; DEBUGLIBPATH = $(BCB)\lib\debug RELEASELIBPATH = $(BCB)\lib\release USERDEFINES = WIN32;NDEBUG;_CONSOLE;XML_STATIC SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL INCLUDEPATH = ..\examples;$(BCB)\include LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) WARNINGS= -w-par -w-8027 -w-8026 # --------------------------------------------------------------------------- CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -I..\lib -c IDLCFLAGS = -I$(BCB)\include PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include AFLAGS = /mx /w2 /zn LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q -L..\LIB\RELEASE_STATIC # --------------------------------------------------------------------------- ALLOBJ = c0x32.obj $(OBJFILES) ALLRES = $(RESFILES) ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib # --------------------------------------------------------------------------- !ifdef IDEOPTIONS [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Debugging] DebugSourceDirs=$(BCB)\source\vcl !endif # --------------------------------------------------------------------------- # MAKE SECTION # --------------------------------------------------------------------------- # This section of the project file is not used by the BCB IDE. It is for # the benefit of building from the command-line using the MAKE utility. # --------------------------------------------------------------------------- .autodepend # --------------------------------------------------------------------------- !if "$(USERDEFINES)" != "" AUSERDEFINES = -d$(USERDEFINES:;= -d) !else AUSERDEFINES = !endif !if !$d(BCC32) BCC32 = bcc32 !endif !if !$d(CPP32) CPP32 = cpp32 !endif !if !$d(DCC32) DCC32 = dcc32 !endif !if !$d(TASM32) TASM32 = tasm32 !endif !if !$d(LINKER) LINKER = ilink32 !endif !if !$d(BRCC32) BRCC32 = brcc32 !endif # --------------------------------------------------------------------------- !if $d(PATHCPP) .PATH.CPP = $(PATHCPP) .PATH.C = $(PATHCPP) !endif !if $d(PATHPAS) .PATH.PAS = $(PATHPAS) !endif !if $d(PATHASM) .PATH.ASM = $(PATHASM) !endif !if $d(PATHRC) .PATH.RC = $(PATHRC) !endif # --------------------------------------------------------------------------- $(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) $(BCB)\BIN\$(LINKER) @&&! $(LFLAGS) -L$(LIBPATH) + $(ALLOBJ), + $(PROJECT),, + $(ALLLIB), + $(DEFFILE), + $(ALLRES) ! # --------------------------------------------------------------------------- .pas.hpp: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .pas.obj: $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } .cpp.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.obj: $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } .c.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .cpp.i: $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } .asm.obj: $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ .rc.res: $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< # --------------------------------------------------------------------------- astropy-0.3/cextern/expat/configure0000755000175000017500000212051412243255342015704 0ustar oleole#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for expat 2.1.0. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: expat-bugs@libexpat.org about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='expat' PACKAGE_TARNAME='expat' PACKAGE_VERSION='2.1.0' PACKAGE_STRING='expat 2.1.0' PACKAGE_BUGREPORT='expat-bugs@libexpat.org' PACKAGE_URL='' ac_unique_file="Makefile.in" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='LTLIBOBJS LIBOBJS FILEMAP INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CXXCPP ac_ct_CXX CXXFLAGS CXX LIBAGE LIBREVISION LIBCURRENT CPP OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL AWK RANLIB STRIP ac_ct_AR AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LIBTOOL OBJDUMP DLLTOOL AS host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS CCC CXXCPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures expat 2.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/expat] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of expat 2.1.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF expat configure 2.1.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_link # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------- ## ## Report this to expat-bugs@libexpat.org ## ## -------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by expat $as_me 2.1.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in conftools "$srcdir"/conftools; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in conftools \"$srcdir\"/conftools" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. LIBCURRENT=7 LIBREVISION=0 LIBAGE=6 ac_config_headers="$ac_config_headers expat_config.h" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4' macro_revision='1.3293' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; pic_mode="$withval" else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' lt_prog_compiler_pic='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec= hardcode_libdir_flag_spec_ld='-rpath $libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_flag_spec_ld='+b $libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu else _lt_caught_CXX_error=yes fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu archive_cmds_need_lc_CXX=no allow_undefined_flag_CXX= always_export_symbols_CXX=no archive_expsym_cmds_CXX= compiler_needs_object_CXX=no export_dynamic_flag_spec_CXX= hardcode_direct_CXX=no hardcode_direct_absolute_CXX=no hardcode_libdir_flag_spec_CXX= hardcode_libdir_flag_spec_ld_CXX= hardcode_libdir_separator_CXX= hardcode_minus_L_CXX=no hardcode_shlibpath_var_CXX=unsupported hardcode_automatic_CXX=no inherit_rpath_CXX=no module_cmds_CXX= module_expsym_cmds_CXX= link_all_deplibs_CXX=unknown old_archive_cmds_CXX=$old_archive_cmds reload_flag_CXX=$reload_flag reload_cmds_CXX=$reload_cmds no_undefined_flag_CXX= whole_archive_flag_spec_CXX= enable_shared_with_static_runtimes_CXX=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o objext_CXX=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } ld_shlibs_CXX=yes case $host_os in aix3*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds_CXX='' hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes file_list_spec_CXX='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct_CXX=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L_CXX=yes hardcode_libdir_flag_spec_CXX='-L$libdir' hardcode_libdir_separator_CXX= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath__CXX fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes # This is similar to how AIX traditionally builds its shared # libraries. archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=yes file_list_spec_CXX='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc_CXX=no hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" if test "$lt_cv_apple_cc_single_mod" != "yes"; then archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else ld_shlibs_CXX=no fi ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; freebsd[12]*) # C++ shared libraries reported to be fairly broken before # switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes ;; gnu*) ;; haiku*) archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; *) hardcode_direct_CXX=yes hardcode_direct_absolute_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; aCC*) case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; m88k*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) ld_shlibs_CXX=yes ;; openbsd2*) # C++ shared libraries are fairly broken ld_shlibs_CXX=no ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' export_dynamic_flag_spec_CXX='${wl}-E' whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else ld_shlibs_CXX=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; cxx*) case $host in osf3*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs_CXX=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag_CXX='${wl}-z,text' allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ '"$reload_cmds_CXX" ;; *) archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; *) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no GCC_CXX="$GXX" LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... # Dependencies to place before and after the object being linked: predep_objects_CXX= postdep_objects_CXX= predeps_CXX= postdeps_CXX= compiler_lib_search_path_CXX= cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then compiler_lib_search_path_CXX="${prev}${p}" else compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$postdeps_CXX"; then postdeps_CXX="${prev}${p}" else postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling CXX test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken case $host_os in interix[3-9]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. predep_objects_CXX= postdep_objects_CXX= postdeps_CXX= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then postdeps_CXX='-library=Cstd -library=Crun' fi ;; esac ;; esac case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi lt_prog_compiler_wl_CXX= lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic_CXX='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic_CXX='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static_CXX= ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic_CXX=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; *) lt_prog_compiler_pic_CXX='-fPIC' ;; esac else case $host_os in aix[4-9]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' ;; dgux*) case $cc_basename in ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic_CXX='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fPIC' lt_prog_compiler_static_CXX='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) # IBM XL 8.0, 9.0 on PPC and BlueGene lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-qpic' lt_prog_compiler_static_CXX='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic_CXX='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. lt_prog_compiler_pic_CXX= lt_prog_compiler_static_CXX='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) lt_prog_compiler_can_build_shared_CXX=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; *) lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works_CXX=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; esac else lt_prog_compiler_pic_CXX= lt_prog_compiler_can_build_shared_CXX=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works_CXX=yes fi else lt_cv_prog_compiler_static_works_CXX=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o_CXX=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' ;; esac ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs_CXX=no ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc_CXX" in x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl_CXX pic_flag=$lt_prog_compiler_pic_CXX compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag_CXX allow_undefined_flag_CXX= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc_CXX=no else lt_cv_archive_cmds_need_lc_CXX=yes fi allow_undefined_flag_CXX=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 $as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[123]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action_CXX=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action_CXX=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } if test "$hardcode_action_CXX" = relink || test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "$GCC" = yes ; then OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" CFLAGS="$OLDCFLAGS -fexceptions" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fexceptions" >&5 $as_echo_n "checking whether $CC accepts -fexceptions... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; CFLAGS="$OLDCFLAGS" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then if test "$cross_compiling" = yes; then : echo $ac_n "cross-compiling... " 2>&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } if test $ac_cv_c_bigendian = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking to probe for byte ordering" >&5 $as_echo_n "checking to probe for byte ordering... " >&6; } cat >conftest.c <&6 ac_cv_c_bigendian=yes fi if test `grep -l LiTTleEnDian conftest.o` ; then echo $ac_n ' little endian probe OK, ' 1>&6 if test $ac_cv_c_bigendian = yes ; then ac_cv_c_bigendian=unknown; else ac_cv_c_bigendian=no fi fi echo $ac_n 'guessing bigendian ... ' >&6 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } fi if test $ac_cv_c_bigendian = yes; then $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h BYTEORDER=4321 else BYTEORDER=1234 fi cat >>confdefs.h <<_ACEOF #define BYTEORDER $BYTEORDER _ACEOF if test $ac_cv_c_bigendian = unknown; then as_fn_error please pre-set ac_cv_c_bigendian "unknown endianess - sorry" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi for ac_func in memmove bcopy do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then FILEMAP=unixfilemap else FILEMAP=readfilemap fi # AC_CPP_FUNC # ------------------ # # Checks to see if ANSI C99 CPP variable __func__ works. # If not, perhaps __FUNCTION__ works instead. # If not, we'll just define __func__ to "". # AC_CPP_FUNC case $ac_cv_prog_cc_stdc in #( no) : ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 $as_echo_n "checking for $CC option to accept ISO C99... " >&6; } if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 $as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 $as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } if ${ac_cv_prog_cc_stdc+:} false; then : $as_echo_n "(cached) " >&6 fi case $ac_cv_prog_cc_stdc in #( no) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; #( '') : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; #( *) : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 $as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C99-conforming __func__" >&5 $as_echo_n "checking for an ANSI C99-conforming __func__... " >&6; } if ${ac_cv_cpp_func+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { char *foo = __func__; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cpp_func=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { char *foo = __FUNCTION__; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cpp_func=__FUNCTION__ else ac_cv_cpp_func=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_func" >&5 $as_echo "$ac_cv_cpp_func" >&6; } if test $ac_cv_cpp_func = __FUNCTION__; then $as_echo "#define __func__ __FUNCTION__" >>confdefs.h elif test $ac_cv_cpp_func = no; then $as_echo "#define __func__ \"\"" >>confdefs.h fi $as_echo "#define XML_NS 1" >>confdefs.h $as_echo "#define XML_DTD 1" >>confdefs.h $as_echo "#define XML_CONTEXT_BYTES 1024" >>confdefs.h ac_config_files="$ac_config_files Makefile expat.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by expat $as_me 2.1.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ expat config.status 2.1.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_flag_spec_ld \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib \ compiler_lib_search_dirs \ predep_objects \ postdep_objects \ predeps \ postdeps \ compiler_lib_search_path \ LD_CXX \ reload_flag_CXX \ compiler_CXX \ lt_prog_compiler_no_builtin_flag_CXX \ lt_prog_compiler_pic_CXX \ lt_prog_compiler_wl_CXX \ lt_prog_compiler_static_CXX \ lt_cv_prog_compiler_c_o_CXX \ export_dynamic_flag_spec_CXX \ whole_archive_flag_spec_CXX \ compiler_needs_object_CXX \ with_gnu_ld_CXX \ allow_undefined_flag_CXX \ no_undefined_flag_CXX \ hardcode_libdir_flag_spec_CXX \ hardcode_libdir_flag_spec_ld_CXX \ hardcode_libdir_separator_CXX \ exclude_expsyms_CXX \ include_expsyms_CXX \ file_list_spec_CXX \ compiler_lib_search_dirs_CXX \ predep_objects_CXX \ postdep_objects_CXX \ predeps_CXX \ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ old_archive_from_expsyms_cmds_CXX \ archive_cmds_CXX \ archive_expsym_cmds_CXX \ module_cmds_CXX \ module_expsym_cmds_CXX \ export_symbols_cmds_CXX \ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "expat_config.h") CONFIG_HEADERS="$CONFIG_HEADERS expat_config.h" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "expat.pc") CONFIG_FILES="$CONFIG_FILES expat.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="CXX " # ### BEGIN LIBTOOL CONFIG # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects postdep_objects=$lt_postdep_objects predeps=$lt_predeps postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" cat <<_LT_EOF >> "$ofile" # ### BEGIN LIBTOOL TAG CONFIG: CXX # The linker used to build libraries. LD=$lt_LD_CXX # How to create reloadable object files. reload_flag=$lt_reload_flag_CXX reload_cmds=$lt_reload_cmds_CXX # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds_CXX # A language specific compiler. CC=$lt_compiler_CXX # Is the compiler the GNU compiler? with_gcc=$GCC_CXX # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic_CXX # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl_CXX # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static_CXX # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc_CXX # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object_CXX # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds_CXX archive_expsym_cmds=$lt_archive_expsym_cmds_CXX # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds_CXX module_expsym_cmds=$lt_module_expsym_cmds_CXX # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld_CXX # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag_CXX # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag_CXX # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # If ld is used when linking, flag to hardcode \$libdir into a binary # during linking. This must work even if \$libdir does not exist. hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L_CXX # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic_CXX # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath_CXX # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs_CXX # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols_CXX # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds_CXX # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms_CXX # Symbols that must always be exported. include_expsyms=$lt_include_expsyms_CXX # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds_CXX # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds_CXX # Specify filename containing input files. file_list_spec=$lt_file_list_spec_CXX # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action_CXX # The directories searched by this compiler when creating a shared library. compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX # Dependencies to place before and after the objects being linked to # create a shared library. predep_objects=$lt_predep_objects_CXX postdep_objects=$lt_postdep_objects_CXX predeps=$lt_predeps_CXX postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. compiler_lib_search_path=$lt_compiler_lib_search_path_CXX # ### END LIBTOOL TAG CONFIG: CXX _LT_EOF ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi abs_srcdir="`cd $srcdir && pwd`" abs_builddir="`pwd`" if test "$abs_srcdir" != "$abs_builddir"; then make mkdir-init fi astropy-0.3/cextern/expat/expat_config.h.in0000755000175000017500000000525012243255342017221 0ustar oleole/* expat_config.h.in. Generated from configure.in by autoheader. */ /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #undef BYTEORDER /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* whether byteorder is bigendian */ #undef WORDS_BIGENDIAN /* Define to specify how much context to retain around the current parse point. */ #undef XML_CONTEXT_BYTES /* Define to make parameter entity parsing functionality available. */ #undef XML_DTD /* Define to make XML Namespaces functionality available. */ #undef XML_NS /* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ #undef __func__ /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t astropy-0.3/cextern/expat/m4/0000755000175000017500000000000012243263747014320 5ustar oleoleastropy-0.3/cextern/expat/m4/libtool.m40000644000175000017500000104622012243255342016223 0ustar oleole# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS astropy-0.3/cextern/expat/m4/ltversion.m40000644000175000017500000000125612243255342016603 0ustar oleole# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3293 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4]) m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) astropy-0.3/cextern/expat/m4/ltsugar.m40000644000175000017500000001042412243255342016234 0ustar oleole# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) astropy-0.3/cextern/expat/m4/lt~obsolete.m40000644000175000017500000001375612243255342017140 0ustar oleole# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) astropy-0.3/cextern/expat/m4/ltoptions.m40000644000175000017500000002725612243255342016621 0ustar oleole# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) astropy-0.3/cextern/expat/Changes0000755000175000017500000002616312243255342015276 0ustar oleoleRelease 2.1.0 Sat March 24 2012 - Bug Fixes: #1742315: Harmful XML_ParserCreateNS suggestion. #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. #1983953, 2517952, 2517962, 2649838: Build modifications using autoreconf instead of buildconf.sh. #2815947, #2884086: OBJEXT and EXEEXT support while building. #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. #2517938: xmlwf should return non-zero exit status if not well-formed. #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. #2855609: Dangling positionPtr after error. #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). #2958794: CVE-2012-1148 - Memory leak in poolGrow. #2990652: CMake support. #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. #3206497: Unitialized memory returned from XML_Parse. #3287849: make check fails on mingw-w64. #3496608: CVE-2012-0876 - Hash DOS attack. - Patches: #1749198: pkg-config support. #3010222: Fix for bug #3010819. #3312568: CMake support. #3446384: Report byte offsets for attr names and values. - New Features / API changes: Added new API member XML_SetHashSalt() that allows setting an intial value (salt) for hash calculations. This is part of the fix for bug #3496608 to randomize hash parameters. When compiled with XML_ATTR_INFO defined, adds new API member XML_GetAttributeInfo() that allows retrieving the byte offsets for attribute names and values (patch #3446384). Added CMake build system. See bug #2990652 and patch #3312568. Added run-benchmark target to Makefile.in - relies on testdata module present in the same relative location as in the repository. Release 2.0.1 Tue June 5 2007 - Fixed bugs #1515266, #1515600: The character data handler's calling of XML_StopParser() was not handled properly; if the parser was stopped and the handler set to NULL, the parser would segfault. - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed some character constants to be ASCII encoded. - Minor cleanups of the test harness. - Fixed xmlwf bug #1513566: "out of memory" error on file size zero. - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call. - Fixes and improvements for Windows platform: bugs #1409451, #1476160, #1548182, #1602769, #1717322. - Build fixes for various platforms: HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180. All Unix: #1554618 (refreshed config.sub/config.guess). #1490371, #1613457: support both, DESTDIR and INSTALL_ROOT, without relying on GNU-Make specific features. #1647805: Patched configure.in to work better with Intel compiler. - Fixes to Makefile.in to have make check work correctly: bugs #1408143, #1535603, #1536684. - Added Open Watcom support: patch #1523242. Release 2.0.0 Wed Jan 11 2006 - We no longer use the "check" library for C unit testing; we always use the (partial) internal implementation of the API. - Report XML_NS setting via XML_GetFeatureList(). - Fixed headers for use from C++. - XML_GetCurrentLineNumber() and XML_GetCurrentColumnNumber() now return unsigned integers. - Added XML_LARGE_SIZE switch to enable 64-bit integers for byte indexes and line/column numbers. - Updated to use libtool 1.5.22 (the most recent). - Added support for AmigaOS. - Some mostly minor bug fixes. SF issues include: #1006708, #1021776, #1023646, #1114960, #1156398, #1221160, #1271642. Release 1.95.8 Fri Jul 23 2004 - Major new feature: suspend/resume. Handlers can now request that a parse be suspended for later resumption or aborted altogether. See "Temporarily Stopping Parsing" in the documentation for more details. - Some mostly minor bug fixes, but compilation should no longer generate warnings on most platforms. SF issues include: #827319, #840173, #846309, #888329, #896188, #923913, #928113, #961698, #985192. Release 1.95.7 Mon Oct 20 2003 - Fixed enum XML_Status issue (reported on SourceForge many times), so compilers that are properly picky will be happy. - Introduced an XMLCALL macro to control the calling convention used by the Expat API; this macro should be used to annotate prototypes and definitions of callback implementations in code compiled with a calling convention other than the default convention for the host platform. - Improved ability to build without the configure-generated expat_config.h header. This is useful for applications which embed Expat rather than linking in the library. - Fixed a variety of bugs: see SF issues #458907, #609603, #676844, #679754, #692878, #692964, #695401, #699323, #699487, #820946. - Improved hash table lookups. - Added more regression tests and improved documentation. Release 1.95.6 Tue Jan 28 2003 - Added XML_FreeContentModel(). - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). - Fixed a variety of bugs: see SF issues #615606, #616863, #618199, #653180, #673791. - Enhanced the regression test suite. - Man page improvements: includes SF issue #632146. Release 1.95.5 Fri Sep 6 2002 - Added XML_UseForeignDTD() for improved SAX2 support. - Added XML_GetFeatureList(). - Defined XML_Bool type and the values XML_TRUE and XML_FALSE. - Use an incomplete struct instead of a void* for the parser (may not retain). - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. - Finally fixed bug where default handler would report DTD events that were already handled by another handler. Initial patch contributed by Darryl Miles. - Removed unnecessary DllMain() function that caused static linking into a DLL to be difficult. - Added VC++ projects for building static libraries. - Reduced line-length for all source code and headers to be no longer than 80 characters, to help with AS/400 support. - Reduced memory copying during parsing (SF patch #600964). - Fixed a variety of bugs: see SF issues #580793, #434664, #483514, #580503, #581069, #584041, #584183, #584832, #585537, #596555, #596678, #598352, #598944, #599715, #600479, #600971. Release 1.95.4 Fri Jul 12 2002 - Added support for VMS, contributed by Craig Berry. See vms/README.vms for more information. - Added Mac OS (classic) support, with a makefile for MPW, contributed by Thomas Wegner and Daryle Walker. - Added Borland C++ Builder 5 / BCC 5.5 support, contributed by Patrick McConnell (SF patch #538032). - Fixed a variety of bugs: see SF issues #441449, #563184, #564342, #566334, #566901, #569461, #570263, #575168, #579196. - Made skippedEntityHandler conform to SAX2 (see source comment) - Re-implemented WFC: Entity Declared from XML 1.0 spec and added a new error "entity declared in parameter entity": see SF bug report #569461 and SF patch #578161 - Re-implemented section 5.1 from XML 1.0 spec: see SF bug report #570263 and SF patch #578161 Release 1.95.3 Mon Jun 3 2002 - Added a project to the MSVC workspace to create a wchar_t version of the library; the DLLs are named libexpatw.dll. - Changed the name of the Windows DLLs from expat.dll to libexpat.dll; this fixes SF bug #432456. - Added the XML_ParserReset() API function. - Fixed XML_SetReturnNSTriplet() to work for element names. - Made the XML_UNICODE builds usable (thanks, Karl!). - Allow xmlwf to read from standard input. - Install a man page for xmlwf on Unix systems. - Fixed many bugs; see SF bug reports #231864, #461380, #464837, #466885, #469226, #477667, #484419, #487840, #494749, #496505, #547350. Other bugs which we can't test as easily may also have been fixed, especially in the area of build support. Release 1.95.2 Fri Jul 27 2001 - More changes to make MSVC happy with the build; add a single workspace to support both the library and xmlwf application. - Added a Windows installer for Windows users; includes xmlwf.exe. - Added compile-time constants that can be used to determine the Expat version - Removed a lot of GNU-specific dependencies to aide portability among the various Unix flavors. - Fix the UTF-8 BOM bug. - Cleaned up warning messages for several compilers. - Added the -Wall, -Wstrict-prototypes options for GCC. Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 - Changes to get expat to build under Microsoft compiler - Removed all aborts and instead return an UNEXPECTED_STATE error. - Fixed a bug where a stray '%' in an entity value would cause an abort. - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for finding this oversight. - Changed default patterns in lib/Makefile.in to fit non-GNU makes Thanks to robin@unrated.net for reporting and providing an account to test on. - The reference had the wrong label for XML_SetStartNamespaceDecl. Reported by an anonymous user. Release 1.95.0 Fri Sep 29 2000 - XML_ParserCreate_MM Allows you to set a memory management suite to replace the standard malloc,realloc, and free. - XML_SetReturnNSTriplet If you turn this feature on when namespace processing is in effect, then qualified, prefixed element and attribute names are returned as "uri|name|prefix" where '|' is whatever separator character is used in namespace processing. - Merged in features from perl-expat o XML_SetElementDeclHandler o XML_SetAttlistDeclHandler o XML_SetXmlDeclHandler o XML_SetEntityDeclHandler o StartDoctypeDeclHandler takes 3 additional parameters: sysid, pubid, has_internal_subset o Many paired handler setters (like XML_SetElementHandler) now have corresponding individual handler setters o XML_GetInputContext for getting the input context of the current parse position. - Added reference material - Packaged into a distribution that builds a sharable library astropy-0.3/cextern/expat/expat.pc.in0000644000175000017500000000034712243255342016046 0ustar oleoleprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: expat Version: @PACKAGE_VERSION@ Description: expat XML parser URL: http://www.libexpat.org Libs: -L${libdir} -lexpat Cflags: -I${includedir} astropy-0.3/cextern/expat/win32/0000755000175000017500000000000012243263747014742 5ustar oleoleastropy-0.3/cextern/expat/win32/MANIFEST.txt0000755000175000017500000000225312243255342016706 0ustar oleole Overview of the Expat distribution The Expat distribution creates several subdirectories on your system. Some of these directories contain components of interest to all Expat users, and some contain material of interest to developers who wish to use Expat in their applications. In the list below, is the directory you specified to the installer. Directory Contents --------------------------------------------------------------------- \ Some general information files. \Doc\ API documentation for developers. \Bin\ Pre-compiled dynamic libraries for developers. Pre-compiled static libraries for developers (*MT.lib). The XML well-formedness checker xmlwf. \Source\ Source code, which may interest some developers, including a workspace for Microsft Visual C++. The source code includes the parser, the well- formedness checker, and a couple of small sample applications. \Source\bcb5\ Project files for Borland C++ Builder 5 and BCC 5.5. astropy-0.3/cextern/expat/win32/README.txt0000755000175000017500000000536412243255342016443 0ustar oleole Expat can be built on Windows in three ways: using MS Visual C++ (6.0 or .NET), Borland C++ Builder 5 or Cygwin. * Cygwin: This follows the Unix build procedures. * C++ Builder 5: Possible with make files in the BCB5 subdirectory. Details can be found in the ReadMe file located there. * MS Visual C++ 6: Based on the workspace file expat.dsw. The related project files (.dsp) are located in the lib subdirectory. * MS Visual Studio .NET 2002, 2003, 2005, 2008, 2010: The VC++ 6 workspace file (expat.dsw) and project files (.dsp) can be opened and imported in VS.NET without problems. * All MS C/C++ compilers: The output for all projects will be generated in the win32\bin directory, intermediate files will be located in project-specific subdirectories of win32\tmp. * Creating MinGW dynamic libraries from MS VC++ DLLs: On the command line, execute these steps: pexports libexpat.dll > expat.def pexports libexpatw.dll > expatw.def dlltool -d expat.def -l libexpat.a dlltool -d expatw.def -l libexpatw.a The *.a files are mingw libraries. * Special note about MS VC++ and runtime libraries: There are three possible configurations: using the single threaded or multithreaded run-time library, or using the multi-threaded run-time Dll. That is, one can build three different Expat libraries depending on the needs of the application. Dynamic Linking: By default the Expat Dlls are built to link statically with the multi-threaded run-time library. The libraries are named - libexpat(w).dll - libexpat(w).lib (import library) The "w" indicates the UTF-16 version of the library. One rarely uses other versions of the Dll, but they can be built easily by specifying a different RTL linkage in the IDE on the C/C++ tab under the category Code Generation. Static Linking: The libraries should be named like this: Single-theaded: libexpat(w)ML.lib Multi-threaded: libexpat(w)MT.lib Multi-threaded Dll: libexpat(w)MD.lib The suffixes conform to the compiler switch settings /ML, /MT and /MD for MS VC++. Note: In Visual Studio 2005 (Visual C++ 8.0) and later, the single-threaded runtime library is not supported anymore. By default, the expat-static and expatw-static projects are set up to link statically against the multithreaded run-time library, so they will build libexpatMT.lib or libexpatwMT.lib files. To build the other versions of the static library, go to Project - Settings: - specify a different RTL linkage on the C/C++ tab under the category Code Generation. - then, on the Library tab, change the output file name accordingly, as described above An application linking to the static libraries must have the global macro XML_STATIC defined. astropy-0.3/cextern/expat/win32/expat.iss0000755000175000017500000001036112243255342016577 0ustar oleole; Basic setup script for the Inno Setup installer builder. For more ; information on the free installer builder, see www.jrsoftware.org. ; ; This script was contributed by Tim Peters. ; It was designed for Inno Setup 2.0.19 but works with later versions as well. [Setup] AppName=Expat AppId=expat AppVersion=2.1.0 AppVerName=Expat 2.1.0 AppCopyright=Copyright © 1998-2012 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers AppPublisher=The Expat Developers AppPublisherURL=http://www.libexpat.org/ AppSupportURL=http://www.libexpat.org/ AppUpdatesURL=http://www.libexpat.org/ UninstallDisplayName=Expat XML Parser 2.1.0 VersionInfoVersion=2.1.0 DefaultDirName={pf}\Expat 2.1.0 UninstallFilesDir={app}\Uninstall Compression=lzma SolidCompression=yes SourceDir=.. OutputDir=win32 DisableStartupPrompt=yes AllowNoIcons=yes DisableProgramGroupPage=yes DisableReadyPage=yes [Files] Flags: ignoreversion; Source: win32\bin\Release\xmlwf.exe; DestDir: "{app}\Bin" Flags: ignoreversion; Source: win32\MANIFEST.txt; DestDir: "{app}" Flags: ignoreversion; Source: Changes; DestDir: "{app}"; DestName: Changes.txt Flags: ignoreversion; Source: COPYING; DestDir: "{app}"; DestName: COPYING.txt Flags: ignoreversion; Source: README; DestDir: "{app}"; DestName: README.txt Flags: ignoreversion; Source: doc\*.html; DestDir: "{app}\Doc" Flags: ignoreversion; Source: doc\*.css; DestDir: "{app}\Doc" Flags: ignoreversion; Source: doc\*.png; DestDir: "{app}\Doc" Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin" Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin" Flags: ignoreversion; Source: expat.dsw; DestDir: "{app}\Source" Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source" Flags: ignoreversion; Source: bcb5\*.bp*; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: bcb5\*.mak; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: bcb5\*.def; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: bcb5\*.txt; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: bcb5\*.bat; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.dsp; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: examples\*.dsp; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.h; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\README.txt; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\benchmark\*.c; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: tests\benchmark\*.ds*; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: tests\benchmark\README.txt; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf" Flags: ignoreversion; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf" Flags: ignoreversion; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf" [Messages] WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process. astropy-0.3/cextern/expat/CMakeLists.txt0000755000175000017500000000634312243255342016541 0ustar oleole# This file is copyrighted under the BSD-license for buildsystem files of KDE # copyright 2010, Patrick Spendrin project(expat) cmake_minimum_required(VERSION 2.6) set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") set(PACKAGE_NAME "expat") set(PACKAGE_VERSION "2.1.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}") option(BUILD_tools "build the xmlwf tool for expat library" ON) option(BUILD_examples "build the examples for expat library" ON) option(BUILD_tests "build the tests for expat library" ON) option(BUILD_shared "build a shared expat library" ON) # configuration options set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point") option(XML_DTD "Define to make parameter entity parsing functionality available" ON) option(XML_NS "Define to make XML Namespaces functionality available" ON) if(XML_DTD) set(XML_DTD 1) else(XML_DTD) set(XML_DTD 0) endif(XML_DTD) if(XML_NS) set(XML_NS 1) else(XML_NS) set(XML_NS 0) endif(XML_NS) if(BUILD_tests) enable_testing() endif(BUILD_tests) include(ConfigureChecks.cmake) include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) endif(MSVC) set(expat_SRCS lib/xmlparse.c lib/xmlrole.c lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c ) if(WIN32 AND BUILD_shared) set(expat_SRCS ${expat_SRCS} lib/libexpat.def) endif(WIN32 AND BUILD_shared) if(BUILD_shared) set(_SHARED SHARED) else(BUILD_shared) set(_SHARED STATIC) endif(BUILD_shared) add_library(expat ${_SHARED} ${expat_SRCS}) install(TARGETS expat RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}/bin") set(libdir "\${prefix}/lib") set(includedir "\${prefix}/include") configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc) install(FILES lib/expat.h lib/expat_external.h DESTINATION include) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) if(BUILD_tools AND NOT WINCE) set(xmlwf_SRCS xmlwf/xmlwf.c xmlwf/xmlfile.c xmlwf/codepage.c xmlwf/readfilemap.c ) add_executable(xmlwf ${xmlwf_SRCS}) target_link_libraries(xmlwf expat) install(TARGETS xmlwf DESTINATION bin) install(FILES doc/xmlwf.1 DESTINATION share/man/man1) endif(BUILD_tools AND NOT WINCE) if(BUILD_examples) add_executable(elements examples/elements.c) target_link_libraries(elements expat) add_executable(outline examples/outline.c) target_link_libraries(outline expat) endif(BUILD_examples) if(BUILD_tests) ## these are unittests that can be run on any platform add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) target_link_libraries(runtests expat) add_test(runtests runtests) add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) target_link_libraries(runtestspp expat) add_test(runtestspp runtestspp) endif(BUILD_tests) astropy-0.3/cextern/expat/aclocal.m40000644000175000017500000112267112243255342015642 0ustar oleole# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, # Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2010 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; haiku*) version_type=linux need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 3293 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4]) m4_define([LT_PACKAGE_REVISION], [1.3293]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4' macro_revision='1.3293' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) astropy-0.3/cextern/expat/README0000755000175000017500000001323612243255342014660 0ustar oleole Expat, Release 2.1.0 This is Expat, a C library for parsing XML, written by James Clark. Expat is a stream-oriented XML parser. This means that you register handlers with the parser before starting the parse. These handlers are called when the parser discovers the associated structures in the document being parsed. A start tag is an example of the kind of structures for which you may register handlers. Windows users should use the expat_win32bin package, which includes both precompiled libraries and executables, and source code for developers. Expat is free software. You may copy, distribute, and modify it under the terms of the License contained in the file COPYING distributed with this package. This license is the same as the MIT/X Consortium license. Versions of Expat that have an odd minor version (the middle number in the release above), are development releases and should be considered as beta software. Releases with even minor version numbers are intended to be production grade software. If you are building Expat from a check-out from the CVS repository, you need to run a script that generates the configure script using the GNU autoconf and libtool tools. To do this, you need to have autoconf 2.58 or newer. Run the script like this: ./buildconf.sh Once this has been done, follow the same instructions as for building from a source distribution. To build Expat from a source distribution, you first run the configuration shell script in the top level distribution directory: ./configure There are many options which you may provide to configure (which you can discover by running configure with the --help option). But the one of most interest is the one that sets the installation directory. By default, the configure script will set things up to install libexpat into /usr/local/lib, expat.h into /usr/local/include, and xmlwf into /usr/local/bin. If, for example, you'd prefer to install into /home/me/mystuff/lib, /home/me/mystuff/include, and /home/me/mystuff/bin, you can tell configure about that with: ./configure --prefix=/home/me/mystuff Another interesting option is to enable 64-bit integer support for line and column numbers and the over-all byte index: ./configure CPPFLAGS=-DXML_LARGE_SIZE However, such a modification would be a breaking change to the ABI and is therefore not recommended for general use - e.g. as part of a Linux distribution - but rather for builds with special requirements. After running the configure script, the "make" command will build things and "make install" will install things into their proper location. Have a look at the "Makefile" to learn about additional "make" options. Note that you need to have write permission into the directories into which things will be installed. If you are interested in building Expat to provide document information in UTF-16 encoding rather than the default UTF-8, follow these instructions (after having run "make distclean"): 1. For UTF-16 output as unsigned short (and version/error strings as char), run: ./configure CPPFLAGS=-DXML_UNICODE For UTF-16 output as wchar_t (incl. version/error strings), run: ./configure CFLAGS="-g -O2 -fshort-wchar" \ CPPFLAGS=-DXML_UNICODE_WCHAR_T 2. Edit the MakeFile, changing: LIBRARY = libexpat.la to: LIBRARY = libexpatw.la (Note the additional "w" in the library name.) 3. Run "make buildlib" (which builds the library only). Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la". 4. Run "make installlib" (which installs the library only). Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la". Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default value for DESTDIR, and the rest of the make file using only DESTDIR. It works as follows: $ make install DESTDIR=/path/to/image overrides the in-makefile set DESTDIR, while both $ INSTALL_ROOT=/path/to/image make install $ make install INSTALL_ROOT=/path/to/image use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the environment, because variable-setting priority is 1) commandline 2) in-makefile 3) environment Note: This only applies to the Expat library itself, building UTF-16 versions of xmlwf and the tests is currently not supported. Note for Solaris users: The "ar" command is usually located in "/usr/ccs/bin", which is not in the default PATH. You will need to add this to your path for the "make" command, and probably also switch to GNU make (the "make" found in /usr/ccs/bin does not seem to work properly -- appearantly it does not understand .PHONY directives). If you're using ksh or bash, use this command to build: PATH=/usr/ccs/bin:$PATH make When using Expat with a project using autoconf for configuration, you can use the probing macro in conftools/expat.m4 to determine how to include Expat. See the comments at the top of that file for more information. A reference manual is available in the file doc/reference.html in this distribution. The homepage for this project is http://www.libexpat.org/. There are links there to connect you to the bug reports page. If you need to report a bug when you don't have access to a browser, you may also send a bug report by email to expat-bugs@mail.libexpat.org. Discussion related to the direction of future expat development takes place on expat-discuss@mail.libexpat.org. Archives of this list and other Expat-related lists may be found at: http://mail.libexpat.org/mailman/listinfo/ astropy-0.3/cextern/expat/COPYING0000755000175000017500000000227012243255342015027 0ustar oleoleCopyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. astropy-0.3/cextern/expat/vms/0000755000175000017500000000000012243263747014605 5ustar oleoleastropy-0.3/cextern/expat/vms/descrip.mms0000755000175000017500000000404012243255342016745 0ustar oleole# Bare bones description file (Makefile) for OpenVMS PACKAGE = expat VERSION = 1.95.8 EXPAT_MAJOR_VERSION=1 EXPAT_MINOR_VERSION=95 EXPAT_EDIT=8 O = .obj OLB = .olb LIBRARY = expat$(OLB) LIBDIR = [.lib] SOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c OBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O) TEMPLATES = xmltok_impl.c xmltok_ns.c APIHEADER = $(LIBDIR)expat.h HEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \ $(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \ $(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h CONFIG_HEADER = expat_config.h INCLUDES = /INCLUDE=([],[.lib]) DEFS = /DEFINE=(PACKAGE="""$(PACKAGE)""",VERSION="""$(PACKAGE)_$(VERSION)""",HAVE_EXPAT_CONFIG_H) LIBREVISION = 0 LIBCURRENT = 1 LIBAGE = 0 # COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) # # DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) # # TAR = gtar # GZIP_ENV = --best # .FIRST : IF F$SEARCH("$(LIBRARY)") .EQS. "" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY) all : $(LIBRARY) @ write sys$output "All made." .SUFFIXES : .SUFFIXES : $(OLB) $(O) .C .H .c$(O) : $(COMPILE) $(MMS$SOURCE) $(O)$(OLB) : @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" - THEN LIBRARY/CREATE/LOG $(MMS$TARGET) @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE) clean : DELETE $(LIBRARY);*,*$(O);* $(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) $(LIBR) /COMPRESS $(MMS$TARGET) $(CONFIG_HEADER) : [.vms]expat_config.h COPY/LOG $(MMS$SOURCE) $(MMS$TARGET) xmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER) xmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER) xmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \ $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \ $(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER) astropy-0.3/cextern/expat/vms/expat_config.h0000755000175000017500000000225712243255342017425 0ustar oleole/* Copyright 2000, Clark Cooper All rights reserved. This is free software. You are permitted to copy, distribute, or modify it under the terms of the MIT/X license (contained in the COPYING file with this distribution.) */ /* Define to empty if the keyword does not work. */ #undef const /* Define if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to `long' if doesn't define. */ #undef off_t /* Define to `unsigned' if doesn't define. */ #undef size_t /* Define if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN /* Define if you have the bcopy function. */ #undef HAVE_BCOPY /* Define if you have the memmove function. */ #define HAVE_MEMMOVE 1 /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 #define XML_NS #define XML_DTD #ifdef WORDS_BIGENDIAN #define XML_BYTE_ORDER 21 #else #define XML_BYTE_ORDER 12 #endif #define XML_CONTEXT_BYTES 1024 #ifndef HAVE_MEMMOVE #ifdef HAVE_BCOPY #define memmove(d,s,l) bcopy((s),(d),(l)) #else #define memmove(d,s,l) ;punting on memmove; #endif #endif astropy-0.3/cextern/expat/vms/README.vms0000755000175000017500000000110012243255342016254 0ustar oleole4-jun-2002 Craig A. Berry Added rudimentary build procedures for OpenVMS based on work by Martin Vorlaender. You'll need MMS or its freeware equivalent MMK. Just go to the top-level directory and type $ MMS/DESCRIPTION=[.vms] or $ MMK/DESCRIPTION=[.vms] You'll end up with the object library expat.olb. For now, installation consists merely of copying the object library, include files, and documentation to a suitable location. To-do list: -- create a shareable image -- build and run the tests and build the xmlwf utility -- create an install target astropy-0.3/cextern/expat/ConfigureChecks.cmake0000755000175000017500000000275012243255342020043 0ustar oleoleinclude(CheckIncludeFile) include(CheckIncludeFiles) include(CheckFunctionExists) include(CheckSymbolExists) include(TestBigEndian) check_include_file("dlfcn.h" HAVE_DLFCN_H) check_include_file("fcntl.h" HAVE_FCNTL_H) check_include_file("inttypes.h" HAVE_INTTYPES_H) check_include_file("memory.h" HAVE_MEMORY_H) check_include_file("stdint.h" HAVE_STDINT_H) check_include_file("stdlib.h" HAVE_STDLIB_H) check_include_file("strings.h" HAVE_STRINGS_H) check_include_file("string.h" HAVE_STRING_H) check_include_file("sys/stat.h" HAVE_SYS_STAT_H) check_include_file("sys/types.h" HAVE_SYS_TYPES_H) check_include_file("unistd.h" HAVE_UNISTD_H) check_function_exists("getpagesize" HAVE_GETPAGESIZE) check_function_exists("bcopy" HAVE_BCOPY) check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE) check_function_exists("mmap" HAVE_MMAP) #/* Define to 1 if you have the ANSI C header files. */ check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) test_big_endian(WORDS_BIGENDIAN) #/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ if(WORDS_BIGENDIAN) set(BYTEORDER 4321) else(WORDS_BIGENDIAN) set(BYTEORDER 1234) endif(WORDS_BIGENDIAN) if(HAVE_SYS_TYPES_H) check_symbol_exists("off_t" "sys/types.h" OFF_T) check_symbol_exists("size_t" "sys/types.h" SIZE_T) else(HAVE_SYS_TYPES_H) set(OFF_T "long") set(SIZE_T "unsigned") endif(HAVE_SYS_TYPES_H) configure_file(expat_config.h.cmake expat_config.h) add_definitions(-DHAVE_EXPAT_CONFIG_H) astropy-0.3/cextern/expat/MANIFEST0000755000175000017500000000472612243255342015135 0ustar oleoleamiga/launch.c amiga/expat_68k.c amiga/expat_68k.h amiga/expat_68k_handler_stubs.c amiga/expat_base.h amiga/expat_vectors.c amiga/expat_lib.c amiga/expat.xml amiga/README.txt amiga/Makefile amiga/include/proto/expat.h amiga/include/libraries/expat.h amiga/include/interfaces/expat.h amiga/include/inline4/expat.h bcb5/README.txt bcb5/all_projects.bpg bcb5/elements.bpf bcb5/elements.bpr bcb5/elements.mak bcb5/expat.bpf bcb5/expat.bpr bcb5/expat.mak bcb5/expat_static.bpf bcb5/expat_static.bpr bcb5/expat_static.mak bcb5/expatw.bpf bcb5/expatw.bpr bcb5/expatw.mak bcb5/expatw_static.bpf bcb5/expatw_static.bpr bcb5/expatw_static.mak bcb5/libexpat_mtd.def bcb5/libexpatw_mtd.def bcb5/makefile.mak bcb5/outline.bpf bcb5/outline.bpr bcb5/outline.mak bcb5/setup.bat bcb5/xmlwf.bpf bcb5/xmlwf.bpr bcb5/xmlwf.mak doc/expat.png doc/reference.html doc/style.css doc/valid-xhtml10.png doc/xmlwf.1 doc/xmlwf.sgml CMakeLists.txt CMake.README COPYING Changes ConfigureChecks.cmake MANIFEST Makefile.in README configure configure.in expat_config.h.in expat_config.h.cmake expat.pc.in expat.dsw aclocal.m4 conftools/PrintPath conftools/ac_c_bigendian_cross.m4 conftools/expat.m4 conftools/get-version.sh conftools/mkinstalldirs conftools/config.guess conftools/config.sub conftools/install-sh conftools/ltmain.sh m4/libtool.m4 m4/ltversion.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/lt~obsolete.m4 examples/elements.c examples/elements.dsp examples/outline.c examples/outline.dsp lib/Makefile.MPW lib/amigaconfig.h lib/ascii.h lib/asciitab.h lib/expat.dsp lib/expat.h lib/expat_external.h lib/expat_static.dsp lib/expatw.dsp lib/expatw_static.dsp lib/iasciitab.h lib/internal.h lib/latin1tab.h lib/libexpat.def lib/libexpatw.def lib/macconfig.h lib/nametab.h lib/utf8tab.h lib/winconfig.h lib/xmlparse.c lib/xmlrole.c lib/xmlrole.h lib/xmltok.c lib/xmltok.h lib/xmltok_impl.c lib/xmltok_impl.h lib/xmltok_ns.c tests/benchmark/README.txt tests/benchmark/benchmark.c tests/benchmark/benchmark.dsp tests/benchmark/benchmark.dsw tests/README.txt tests/chardata.c tests/chardata.h tests/minicheck.c tests/minicheck.h tests/runtests.c tests/runtestspp.cpp tests/xmltest.sh vms/README.vms vms/descrip.mms vms/expat_config.h win32/MANIFEST.txt win32/README.txt win32/expat.iss xmlwf/codepage.c xmlwf/codepage.h xmlwf/ct.c xmlwf/filemap.h xmlwf/readfilemap.c xmlwf/unixfilemap.c xmlwf/win32filemap.c xmlwf/xmlfile.c xmlwf/xmlfile.h xmlwf/xmlmime.c xmlwf/xmlmime.h xmlwf/xmltchar.h xmlwf/xmlurl.h xmlwf/xmlwf.c xmlwf/xmlwf.dsp xmlwf/xmlwin32url.cxx astropy-0.3/cextern/expat/conftools/0000755000175000017500000000000012243263747016006 5ustar oleoleastropy-0.3/cextern/expat/conftools/expat.m40000755000175000017500000000264212243255342017370 0ustar oleolednl Check if --with-expat[=PREFIX] is specified and dnl Expat >= 1.95.0 is installed in the system. dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined. dnl If --with-expat has not been specified, set with_expat to 'no'. dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly. dnl This is necessary to adapt a whole lot of packages that have expat dnl bundled as a static library. AC_DEFUN([AM_WITH_EXPAT], [ AC_ARG_WITH(expat, [ --with-expat=PREFIX Use system Expat library], , with_expat=no) AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no) EXPAT_CFLAGS= EXPAT_LIBS= if test $with_expat != no; then if test $with_expat != yes; then EXPAT_CFLAGS="-I$with_expat/include" EXPAT_LIBS="-L$with_expat/lib" fi AC_CHECK_LIB(expat, XML_ParserCreate, [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" expat_found=yes ], [ expat_found=no ], "$EXPAT_LIBS") if test $expat_found = no; then AC_MSG_ERROR([Could not find the Expat library]) fi expat_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $EXPAT_CFLAGS" AC_CHECK_HEADERS(expat.h, , expat_found=no) if test $expat_found = no; then AC_MSG_ERROR([Could not find expat.h]) fi CFLAGS="$expat_save_CFLAGS" fi AC_SUBST(EXPAT_CFLAGS) AC_SUBST(EXPAT_LIBS) ]) astropy-0.3/cextern/expat/conftools/ac_c_bigendian_cross.m40000755000175000017500000000562412243255342022350 0ustar oleolednl @synopsis AC_C_BIGENDIAN_CROSS dnl dnl Check endianess even when crosscompiling dnl (partially based on the original AC_C_BIGENDIAN). dnl dnl The implementation will create a binary, and instead of running dnl the binary it will be grep'ed for some symbols that will look dnl different for different endianess of the binary. dnl dnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp $ dnl @author Guido Draheim dnl AC_DEFUN([AC_C_BIGENDIAN_CROSS], [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, [ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. AC_TRY_COMPILE([#include #include ], [ #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN bogus endian macros #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. AC_TRY_COMPILE([#include #include ], [ #if BYTE_ORDER != BIG_ENDIAN not big endian #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) if test $ac_cv_c_bigendian = unknown; then AC_TRY_RUN([main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1); }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, [ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) fi]) if test $ac_cv_c_bigendian = unknown; then AC_MSG_CHECKING(to probe for byte ordering) [ cat >conftest.c <&AC_FD_MSG ac_cv_c_bigendian=yes fi if test `grep -l LiTTleEnDian conftest.o` ; then echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG if test $ac_cv_c_bigendian = yes ; then ac_cv_c_bigendian=unknown; else ac_cv_c_bigendian=no fi fi echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG fi fi AC_MSG_RESULT($ac_cv_c_bigendian) fi if test $ac_cv_c_bigendian = yes; then AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) BYTEORDER=4321 else BYTEORDER=1234 fi AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) if test $ac_cv_c_bigendian = unknown; then AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) fi ]) astropy-0.3/cextern/expat/conftools/PrintPath0000755000175000017500000000466012243255342017643 0ustar oleole#!/bin/sh # Look for program[s] somewhere in $PATH. # # Options: # -s # Do not print out full pathname. (silent) # -pPATHNAME # Look in PATHNAME instead of $PATH # # Usage: # PrintPath [-s] [-pPATHNAME] program [program ...] # # Initially written by Jim Jagielski for the Apache configuration mechanism # (with kudos to Kernighan/Pike) # # This script falls under the Apache License. # See http://www.apache.org/licenses/LICENSE ## # Some "constants" ## pathname=$PATH echo="yes" ## # Find out what OS we are running for later on ## os=`(uname) 2>/dev/null` ## # Parse command line ## for args in $* do case $args in -s ) echo="no" ;; -p* ) pathname="`echo $args | sed 's/^..//'`" ;; * ) programs="$programs $args" ;; esac done ## # Now we make the adjustments required for OS/2 and everyone # else :) # # First of all, all OS/2 programs have the '.exe' extension. # Next, we adjust PATH (or what was given to us as PATH) to # be whitespace separated directories. # Finally, we try to determine the best flag to use for # test/[] to look for an executable file. OS/2 just has '-r' # but with other OSs, we do some funny stuff to check to see # if test/[] knows about -x, which is the preferred flag. ## if [ "x$os" = "xOS/2" ] then ext=".exe" pathname=`echo -E $pathname | sed 's/^;/.;/ s/;;/;.;/g s/;$/;./ s/;/ /g s/\\\\/\\//g' ` test_exec_flag="-r" else ext="" # No default extensions pathname=`echo $pathname | sed 's/^:/.:/ s/::/:.:/g s/:$/:./ s/:/ /g' ` # Here is how we test to see if test/[] can handle -x testfile="pp.t.$$" cat > $testfile </dev/null`; then test_exec_flag="-x" else test_exec_flag="-r" fi rm -f $testfile fi for program in $programs do for path in $pathname do if [ $test_exec_flag $path/${program}${ext} ] && \ [ ! -d $path/${program}${ext} ]; then if [ "x$echo" = "xyes" ]; then echo $path/${program}${ext} fi exit 0 fi # Next try without extension (if one was used above) if [ "x$ext" != "x" ]; then if [ $test_exec_flag $path/${program} ] && \ [ ! -d $path/${program} ]; then if [ "x$echo" = "xyes" ]; then echo $path/${program} fi exit 0 fi fi done done exit 1 astropy-0.3/cextern/expat/conftools/install-sh0000755000175000017500000003253712243255342020014 0ustar oleole#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # 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 THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: astropy-0.3/cextern/expat/conftools/ltmain.sh0000755000175000017500000105052712243255342017633 0ustar oleole # libtool (GNU libtool) 2.4 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # MODE must be one of the following: # # clean remove files from the build directory # compile compile a source file into a libtool object # execute automatically set library path, then run a program # finish complete the installation of libtool libraries # install install libraries or executables # link create a library or an executable # uninstall remove libraries from an installed directory # # MODE-ARGS vary depending on the MODE. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4 Debian-2.4-2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4 Debian-2.4-2ubuntu1" TIMESTAMP="" package_revision=1.3293 # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${EGREP="/bin/grep -E"} : ${FGREP="/bin/grep -F"} : ${GREP="/bin/grep"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SED="/bin/sed"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=: for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_features () { echo "host: $host" if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -e 's/\([\\"]\)/\\\1/g' \ -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_apped perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 astropy-0.3/cextern/expat/conftools/get-version.sh0000755000175000017500000000236212243255342020602 0ustar oleole#!/bin/sh # # USAGE: get-version.sh path/to/expat.h # # This script will print Expat's version number on stdout. For example: # # $ ./conftools/get-version.sh ./lib/expat.h # 1.95.3 # $ # if test $# = 0; then echo "ERROR: pathname for expat.h was not provided." echo "" echo "USAGE: $0 path/to/expat.h" exit 1 fi if test $# != 1; then echo "ERROR: too many arguments were provided." echo "" echo "USAGE: $0 path/to/expat.h" exit 1 fi hdr="$1" if test ! -r "$hdr"; then echo "ERROR: '$hdr' does not exist, or is not readable." exit 1 fi MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`" MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`" MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`" # Determine how to tell echo not to print the trailing \n. This is # similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't # generate this file via autoconf (in fact, get-version.sh is used # to *create* ./configure), so we just do something similar inline. case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ;; *) ECHO_N= ECHO_C='\c' ;; esac echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C" astropy-0.3/cextern/expat/CMake.README0000755000175000017500000000335012243255342015633 0ustar oleole== How to build expat with cmake (experimental) == The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual Studio) and should work on all other platform cmake supports. Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory build and change into that directory: ~/expat-2.1.0$ mkdir build && cd build ~/expat-2.1.0/build$ From that directory, call cmake first, then call make, make test and make install in the usual way: ~/expat-2.1.0/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU .... -- Configuring done -- Generating done -- Build files have been written to: /home/patrick/expat-2.1.0/build If you want to specify the install location for your files, append -DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call. ~/expat-2.1.0/build$ make && make test && make install Scanning dependencies of target expat [ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o [ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o .... -- Installing: /usr/local/lib/pkgconfig/expat.pc -- Installing: /usr/local/bin/xmlwf -- Installing: /usr/local/share/man/man1/xmlwf.1 For Windows builds, you must make sure to call cmake from an environment where your compiler is reachable, that means either you call it from the Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and make sure that gcc can be called. On Windows, you also might want to specify a special Generator for CMake: for Visual Studio builds do: cmake .. -G "Visual Studio 10" && vcexpress expat.sln for mingw builds do: cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install && gmake && gmake install astropy-0.3/cextern/expat/doc/0000755000175000017500000000000012243263747014545 5ustar oleoleastropy-0.3/cextern/expat/doc/expat.png0000755000175000017500000000200312243255342016362 0ustar oleole‰PNG  IHDR¾FWÞq5gAMA± üa pHYs  ÒÝ~ütIMEÒ 2 é_5bKGDÿ‡Ì¿„IDAThÞí˜Û•ë EÕ…Pˆ¡ Q#*D…p?xXâa;Î̬d]ü3N&Æ[âp$€ôÕlü¿ñ7þÆßøãoü¿ñ7þŸ^À1¾ˆß‹Ï ¿‚Iš“ÀÇ»Úy_2þ‘§ô` Ø³Â]í¼%žhÓÏv*nâ ƒ ÛÚyOûΤ߸‡)xª÷ðMúãýœYÔÿ¾vîàŸ0ù#ýòÂKÏñ_ÐÎ5>{%K|pRÌ3žâËQðÖø+íD?Oì+O}ʦ׶üTTU7Yºl XWŠü…vV wêû3Ÿò“¶¼Jg0OãMPžd5˲5ÓÎÜÉO«în0ê[s¯k—.[\]I-^âÚ9-Zëž§kĨ# 7cíÒMC‹›w+|1åãºe8ë8í£Ãq™ê7¥ºv›E ƒ]Ãe¦Ì^7ÚõuÙ°]ôûAéµ6ºˆmKN*Y¬jWkôQUîÁ)%¶%!ù'a(õñùnK±Û¾h‰étiÆ]=“¶Û)F•­¡‹£v.7+7öºÑaÛ‚Q¢3}¦Jqž2ymov4úù® š¯tÚI—[ÅWO„ˆ¸Ý'ÖÃS¾ŒqæÏæñ¬þGý¶ÓNºqÜðG´COzÿ`–_|æƒðÃSºÂwŽH?ÿ‰v>Ÿ_?¦û ñ<¹6þÆÿ(ü?¼6þÆßøãoü¿ñÿü®Ýåv—LCIEND®B`‚astropy-0.3/cextern/expat/doc/style.css0000755000175000017500000000247412243255342016421 0ustar oleolebody { background-color: white; border: 0px; margin: 0px; padding: 0px; } .corner { width: 200px; height: 80px; text-align: center; } .banner { background-color: rgb(110,139,61); color: rgb(255,236,176); padding-left: 2em; } .banner h1 { font-size: 200%; } .content { padding: 0em 2em 1em 2em; } .releaseno { background-color: rgb(110,139,61); color: rgb(255,236,176); padding-bottom: 0.3em; padding-top: 0.5em; text-align: center; font-weight: bold; } .noborder { border-width: 0px; } .eg { padding-left: 1em; padding-top: .5em; padding-bottom: .5em; border: solid thin; margin: 1em 0; background-color: tan; margin-left: 2em; margin-right: 10%; } .pseudocode { padding-left: 1em; padding-top: .5em; padding-bottom: .5em; border: solid thin; margin: 1em 0; background-color: rgb(250,220,180); margin-left: 2em; margin-right: 10%; } .handler { width: 100%; border-top-width: thin; margin-bottom: 1em; } .handler p { margin-left: 2em; } .setter { font-weight: bold; } .signature { color: navy; } .fcndec { width: 100%; border-top-width: thin; font-weight: bold; } .fcndef { margin-left: 2em; margin-bottom: 2em; } dd { margin-bottom: 2em; } .cpp-symbols dt { font-family: monospace; } .cpp-symbols dd { margin-bottom: 1em; } astropy-0.3/cextern/expat/doc/valid-xhtml10.png0000755000175000017500000000450012243255342017637 0ustar oleole‰PNG  IHDRX#ÊDˆPLTEÞççÎ{9­­­ÞŒB¥„Bï½c½ZZÞ„BÎ{{Þ¥¥œ”{ÞµRÆssÞ­Rœ÷½Z”Œs”{Rc”½19JcŒ½”½Ö猭Îï­R¥½ÖÖÞï„¥ÆÎÞçÎÖçZ”Œ)½J!{{{ZZJŒs9JŒZRJsssµ”J„k1!„c1kkk­ŒBÖs9ÆœJÿïïcccÎk1Îc1­kcR„µk”½99JœµÖœÆkkœÆ¥Z”µÎµ9999¥R)”{9{c1”s9111½œJ­!ÞÞÞ1{½”JŒk1){)))¥ŒZÖÖÖµŒBÎÎÎçï÷ÆÆÆ½¥Z„9))cœsœ½½µœZ„µÎ¥Zÿ÷ÖkcRÿïÖcR)cJ)9„ïÆc1„œ{9œ„Z”s1­”Z{sk­ŒZ”””­ÆÞ÷ÿÿ÷÷ÿB{­BJJ½ÆÆsœÆÖçïBs­ŒŒŒBBJï÷÷ïï÷ÎÎÆç”JÖŒŒÿÞkB9skR)!sZ1ÿÖkB1scRÿÎkç½ZRB!Î¥RkR)çµZ÷Îc„sR÷ÆcZZZµœZ9BJÆZ)µ”ZJ”RRRµÎÞ!ZœJŒÿÿÿÿÿÿ1k¥”k)BŒJ{­JJJ{œÆÖµcÞçïcZR÷÷÷÷÷÷Ö­cBBBÞ­­ç½cïïï91çµcÞµZ{sR1)””{J9{kR1!”Œ{ZJ!Ö­R)!sZ)ï½ZZB!ÿÖcÖ¥RŒ{RÿÎcÿÆckR!„­ÎÿïsÆÖçZ”ÿçs½œZR”µJ!½ÎÞ½½½9s¥JŒRRJ9k¥RJJ!R”µµµÞµcB„”€?¤ªtRNSÿÿÿÿÿÿÿˆÿlIÿÿtÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿyÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ]ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿDdýè½IDATHÇ•V‹_EË»ìaFÚŠ QYˆ DT§rDiPP"ÞÉÃ|¡‡Òê94Bé"ñ:$½4Àó•G):[F‡‰œùèþ~3»w·öÑïÍÎîÎ~÷»¿ù=fsì@Å´{"ñÕ”€5àCÅY±e”°F$°›Wˆã¾õPªð¥ÈVìFt'¥Œ1|N¯cÄâÖÞDc>1ÜYÕ Ã•-{ý~B†I`è[þ%¥[vÐ[•ë³ã#˜I³$£H%aD|D cO«Ü(L¦Œ³µoÆðau„(¢ )y*ÊÉa‡Òº÷)}*`&l¯éÜÞfÿ§0üwví÷‚Ó¿ÉfX„¶mMÙ>Dز›n9küäZ2ps!aé’cfª&ƒIŒa:T²©à‹qsr=åÖ4OnÌ XþL†|ÖÔ¤j¹˜ÈÅarÜ|ºc9í‹Gî¤+@yuÒÇJÒÁ\#’—1tÐØwAÁ#G4H_¶5A =¿xÄb9°ÀÑ*¡t<¨Ûl>Ýî5·o{–»xé˜5IÒ,M™öóÖ*£ô:äÛ AºNŒä—¼(Y$IÒmžÂÀ9H˜bÖmi’ô –f¶eNBÛK~¿Ýn÷‹f‡k~²û[¾pòcªD1 Ôí6ÄÊ´)@¾¿™hi)²M?R&‹È…HY‹)m³¢4§Z­¹Ãd¨ÚTÍtòî#4~"ãñTÑ%¨ô.eøVvíÿÕ%_òÉÈ¥Xó«“Ãd^.Ъhùlz•fRJd„d×s*»tYFç\ÃÉÕù8LžhX:ÖUï Þ"Í _ë7e[íÃÍʆi…ÍgÈJË;œÜ½³¬®¯¬q¶g§7:AQOzrð‚øŸ`ƒ7žPa×aáÍü†aˆøLáž¼gÏ4è¼@>‘à ûn;¹‡±4¸Ëãšëúëhì[ÙÇl`óÝ`Æ'N ší¸æ !Ò¨ ÒóÝÏ WOËæ*oÊÑ…•›G`¸£ý¼fï3ï ;yƒß_+'H½6sáÖÝsGµAoѪhåáµ9‡AØ q>g­ manpage.1'. You may view the manual page with: `docbook-to-man manpage.sgml | nroff -man | less'. A typical entry in a Makefile or Makefile.am is: manpage.1: manpage.sgml docbook-to-man $< > $@ --> Scott"> Bronson"> December 5, 2001"> 1"> bronson@rinspin.com"> XMLWF"> Debian GNU/Linux"> GNU"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2001 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; Determines if an XML document is well-formed &dhpackage; file ... DESCRIPTION &dhpackage; uses the Expat library to determine if an XML document is well-formed. It is non-validating. If you do not specify any files on the command-line, and you have a recent version of &dhpackage;, the input file will be read from standard input. WELL-FORMED DOCUMENTS A well-formed document must adhere to the following rules: The file begins with an XML declaration. For instance, <?xml version="1.0" standalone="yes"?>. NOTE: &dhpackage; does not currently check for a valid XML declaration. Every start tag is either empty (<tag/>) or has a corresponding end tag. There is exactly one root element. This element must contain all other elements in the document. Only comments, white space, and processing instructions may come after the close of the root element. All elements nest properly. All attribute values are enclosed in quotes (either single or double). If the document has a DTD, and it strictly complies with that DTD, then the document is also considered valid. &dhpackage; is a non-validating parser -- it does not check the DTD. However, it does support external entities (see the option). OPTIONS When an option includes an argument, you may specify the argument either separately (" output") or concatenated with the option ("output"). &dhpackage; supports both. If the input file is well-formed and &dhpackage; doesn't encounter any errors, the input file is simply copied to the output directory unchanged. This implies no namespaces (turns off ) and requires to specify an output file. Specifies a directory to contain transformed representations of the input files. By default, outputs a canonical representation (described below). You can select different output formats using and . The output filenames will be exactly the same as the input filenames or "STDIN" if the input is coming from standard input. Therefore, you must be careful that the output file does not go into the same directory as the input file. Otherwise, &dhpackage; will delete the input file before it generates the output file (just like running cat < file > file in most shells). Two structurally equivalent XML documents have a byte-for-byte identical canonical XML representation. Note that ignorable white space is considered significant and is treated equivalently to data. More on canonical XML can be found at http://www.jclark.com/xml/canonxml.html . Specifies the character encoding for the document, overriding any document encoding declaration. &dhpackage; supports four built-in encodings: US-ASCII, UTF-8, UTF-16, and ISO-8859-1. Also see the option. Outputs some strange sort of XML file that completely describes the the input file, including character postitions. Requires to specify an output file. Turns on namespace processing. (describe namespaces) disables namespaces. Tells xmlwf to process external DTDs and parameter entities. Normally &dhpackage; never parses parameter entities. tells it to always parse them. implies . Normally &dhpackage; memory-maps the XML file before parsing; this can result in faster parsing on many platforms. turns off memory-mapping and uses normal file IO calls instead. Of course, memory-mapping is automatically turned off when reading from standard input. Use of memory-mapping can cause some platforms to report substantially higher memory usage for &dhpackage;, but this appears to be a matter of the operating system reporting memory in a strange way; there is not a leak in &dhpackage;. Prints an error if the document is not standalone. A document is standalone if it has no external subset and no references to parameter entities. Turns on timings. This tells Expat to parse the entire file, but not perform any processing. This gives a fairly accurate idea of the raw speed of Expat itself without client overhead. turns off most of the output options (, , , ...). Prints the version of the Expat library being used, including some information on the compile-time configuration of the library, and then exits. Enables support for Windows code pages. Normally, &dhpackage; will throw an error if it runs across an encoding that it is not equipped to handle itself. With , &dhpackage; will try to use a Windows code page. See also . Turns on parsing external entities. Non-validating parsers are not required to resolve external entities, or even expand entities at all. Expat always expands internal entities (?), but external entity parsing must be enabled explicitly. External entities are simply entities that obtain their data from outside the XML file currently being parsed. This is an example of an internal entity: <!ENTITY vers '1.0.2'> And here are some examples of external entities: <!ENTITY header SYSTEM "header-&vers;.xml"> (parsed) <!ENTITY logo SYSTEM "logo.png" PNG> (unparsed) (Two hyphens.) Terminates the list of options. This is only needed if a filename starts with a hyphen. For example: &dhpackage; -- -myfile.xml will run &dhpackage; on the file -myfile.xml. Older versions of &dhpackage; do not support reading from standard input. OUTPUT If an input file is not well-formed, &dhpackage; prints a single line describing the problem to standard output. If a file is well formed, &dhpackage; outputs nothing. Note that the result code is not set. BUGS &dhpackage; returns a 0 - noerr result, even if the file is not well-formed. There is no good way for a program to use &dhpackage; to quickly check a file -- it must parse &dhpackage;'s standard output. The errors should go to standard error, not standard output. There should be a way to get to send its output to standard output rather than forcing the user to send it to a file. I have no idea why anyone would want to use the , , and options. If someone could explain it to me, I'd like to add this information to this manpage. ALTERNATIVES Here are some XML validators on the web: http://www.hcrc.ed.ac.uk/~richard/xml-check.html http://www.stg.brown.edu/service/xmlvalid/ http://www.scripting.com/frontier5/xml/code/xmlValidator.html http://www.xml.com/pub/a/tools/ruwf/check.html SEE ALSO The Expat home page: http://www.libexpat.org/ The W3 XML specification: http://www.w3.org/TR/REC-xml AUTHOR This manual page was written by &dhusername; &dhemail; for the &debian; system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1.
astropy-0.3/cextern/expat/doc/reference.html0000755000175000017500000027134312243255342017376 0ustar oleole Expat XML Parser
(Expat logo)
Release 2.0.1

Expat is a library, written in C, for parsing XML documents. It's the underlying XML parser for the open source Mozilla project, Perl's XML::Parser, Python's xml.parsers.expat, and other open-source XML parsers.

This library is the creation of James Clark, who's also given us groff (an nroff look-alike), Jade (an implemention of ISO's DSSSL stylesheet language for SGML), XP (a Java XML parser package), XT (a Java XSL engine). James was also the technical lead on the XML Working Group at W3C that produced the XML specification.

This is free software, licensed under the MIT/X Consortium license. You may download it from the Expat home page.

The bulk of this document was originally commissioned as an article by XML.com. They graciously allowed Clark Cooper to retain copyright and to distribute it with Expat. This version has been substantially extended to include documentation on features which have been added since the original article was published, and additional information on using the original interface.


Table of Contents


Overview

Expat is a stream-oriented parser. You register callback (or handler) functions with the parser and then start feeding it the document. As the parser recognizes parts of the document, it will call the appropriate handler for that part (if you've registered one.) The document is fed to the parser in pieces, so you can start parsing before you have all the document. This also allows you to parse really huge documents that won't fit into memory.

Expat can be intimidating due to the many kinds of handlers and options you can set. But you only need to learn four functions in order to do 90% of what you'll want to do with it:

XML_ParserCreate
Create a new parser object.
XML_SetElementHandler
Set handlers for start and end tags.
XML_SetCharacterDataHandler
Set handler for text.
XML_Parse
Pass a buffer full of document to the parser

These functions and others are described in the reference part of this document. The reference section also describes in detail the parameters passed to the different types of handlers.

Let's look at a very simple example program that only uses 3 of the above functions (it doesn't need to set a character handler.) The program outline.c prints an element outline, indenting child elements to distinguish them from the parent element that contains them. The start handler does all the work. It prints two indenting spaces for every level of ancestor elements, then it prints the element and attribute information. Finally it increments the global Depth variable.

int Depth;

void XMLCALL
start(void *data, const char *el, const char **attr) {
  int i;

  for (i = 0; i < Depth; i++)
    printf("  ");

  printf("%s", el);

  for (i = 0; attr[i]; i += 2) {
    printf(" %s='%s'", attr[i], attr[i + 1]);
  }

  printf("\n");
  Depth++;
}  /* End of start handler */

The end tag simply does the bookkeeping work of decrementing Depth.

void XMLCALL
end(void *data, const char *el) {
  Depth--;
}  /* End of end handler */

Note the XMLCALL annotation used for the callbacks. This is used to ensure that the Expat and the callbacks are using the same calling convention in case the compiler options used for Expat itself and the client code are different. Expat tries not to care what the default calling convention is, though it may require that it be compiled with a default convention of "cdecl" on some platforms. For code which uses Expat, however, the calling convention is specified by the XMLCALL annotation on most platforms; callbacks should be defined using this annotation.

The XMLCALL annotation was added in Expat 1.95.7, but existing working Expat applications don't need to add it (since they are already using the "cdecl" calling convention, or they wouldn't be working). The annotation is only needed if the default calling convention may be something other than "cdecl". To use the annotation safely with older versions of Expat, you can conditionally define it after including Expat's header file:

#include <expat.h>

#ifndef XMLCALL
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#define XMLCALL __cdecl
#elif defined(__GNUC__)
#define XMLCALL __attribute__((cdecl))
#else
#define XMLCALL
#endif
#endif

After creating the parser, the main program just has the job of shoveling the document to the parser so that it can do its work.


Building and Installing Expat

The Expat distribution comes as a compressed (with GNU gzip) tar file. You may download the latest version from Source Forge. After unpacking this, cd into the directory. Then follow either the Win32 directions or Unix directions below.

Building under Win32

If you're using the GNU compiler under cygwin, follow the Unix directions in the next section. Otherwise if you have Microsoft's Developer Studio installed, then from Windows Explorer double-click on "expat.dsp" in the lib directory and build and install in the usual manner.

Alternatively, you may download the Win32 binary package that contains the "expat.h" include file and a pre-built DLL.

Building under Unix (or GNU)

First you'll need to run the configure shell script in order to configure the Makefiles and headers for your system.

If you're happy with all the defaults that configure picks for you, and you have permission on your system to install into /usr/local, you can install Expat with this sequence of commands:

./configure
make
make install

There are some options that you can provide to this script, but the only one we'll mention here is the --prefix option. You can find out all the options available by running configure with just the --help option.

By default, the configure script sets things up so that the library gets installed in /usr/local/lib and the associated header file in /usr/local/include. But if you were to give the option, --prefix=/home/me/mystuff, then the library and header would get installed in /home/me/mystuff/lib and /home/me/mystuff/include respectively.

Configuring Expat Using the Pre-Processor

Expat's feature set can be configured using a small number of pre-processor definitions. The definition of this symbols does not affect the set of entry points for Expat, only the behavior of the API and the definition of character types in the case of XML_UNICODE_WCHAR_T. The symbols are:

XML_DTD
Include support for using and reporting DTD-based content. If this is defined, default attribute values from an external DTD subset are reported and attribute value normalization occurs based on the type of attributes defined in the external subset. Without this, Expat has a smaller memory footprint and can be faster, but will not load external entities or process conditional sections. This does not affect the set of functions available in the API.
XML_NS
When defined, support for the Namespaces in XML specification is included.
XML_UNICODE
When defined, character data reported to the application is encoded in UTF-16 using wide characters of the type XML_Char. This is implied if XML_UNICODE_WCHAR_T is defined.
XML_UNICODE_WCHAR_T
If defined, causes the XML_Char character type to be defined using the wchar_t type; otherwise, unsigned short is used. Defining this implies XML_UNICODE.
XML_LARGE_SIZE
If defined, causes the XML_Size and XML_Index integer types to be at least 64 bits in size. This is intended to support processing of very large input streams, where the return values of XML_GetCurrentByteIndex, XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber could overflow. It may not be supported by all compilers, and is turned off by default.
XML_CONTEXT_BYTES
The number of input bytes of markup context which the parser will ensure are available for reporting via XML_GetInputContext. This is normally set to 1024, and must be set to a positive interger. If this is not defined, the input context will not be available and XML_GetInputContext will always report NULL. Without this, Expat has a smaller memory footprint and can be faster.
XML_STATIC
On Windows, this should be set if Expat is going to be linked statically with the code that calls it; this is required to get all the right MSVC magic annotations correct. This is ignored on other platforms.
XML_ATTR_INFO
If defined, makes the the additional function XML_GetAttributeInfo available for reporting attribute byte offsets.

Using Expat

Compiling and Linking Against Expat

Unless you installed Expat in a location not expected by your compiler and linker, all you have to do to use Expat in your programs is to include the Expat header (#include <expat.h>) in your files that make calls to it and to tell the linker that it needs to link against the Expat library. On Unix systems, this would usually be done with the -lexpat argument. Otherwise, you'll need to tell the compiler where to look for the Expat header and the linker where to find the Expat library. You may also need to take steps to tell the operating system where to find this library at run time.

On a Unix-based system, here's what a Makefile might look like when Expat is installed in a standard location:

CC=cc
LDFLAGS=
LIBS= -lexpat
xmlapp: xmlapp.o
        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)

If you installed Expat in, say, /home/me/mystuff, then the Makefile would look like this:

CC=cc
CFLAGS= -I/home/me/mystuff/include
LDFLAGS=
LIBS= -L/home/me/mystuff/lib -lexpat
xmlapp: xmlapp.o
        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)

You'd also have to set the environment variable LD_LIBRARY_PATH to /home/me/mystuff/lib (or to ${LD_LIBRARY_PATH}:/home/me/mystuff/lib if LD_LIBRARY_PATH already has some directories in it) in order to run your application.

Expat Basics

As we saw in the example in the overview, the first step in parsing an XML document with Expat is to create a parser object. There are three functions in the Expat API for creating a parser object. However, only two of these (XML_ParserCreate and XML_ParserCreateNS) can be used for constructing a parser for a top-level document. The object returned by these functions is an opaque pointer (i.e. "expat.h" declares it as void *) to data with further internal structure. In order to free the memory associated with this object you must call XML_ParserFree. Note that if you have provided any user data that gets stored in the parser, then your application is responsible for freeing it prior to calling XML_ParserFree.

The objects returned by the parser creation functions are good for parsing only one XML document or external parsed entity. If your application needs to parse many XML documents, then it needs to create a parser object for each one. The best way to deal with this is to create a higher level object that contains all the default initialization you want for your parser objects.

Walking through a document hierarchy with a stream oriented parser will require a good stack mechanism in order to keep track of current context. For instance, to answer the simple question, "What element does this text belong to?" requires a stack, since the parser may have descended into other elements that are children of the current one and has encountered this text on the way out.

The things you're likely to want to keep on a stack are the currently opened element and it's attributes. You push this information onto the stack in the start handler and you pop it off in the end handler.

For some tasks, it is sufficient to just keep information on what the depth of the stack is (or would be if you had one.) The outline program shown above presents one example. Another such task would be skipping over a complete element. When you see the start tag for the element you want to skip, you set a skip flag and record the depth at which the element started. When the end tag handler encounters the same depth, the skipped element has ended and the flag may be cleared. If you follow the convention that the root element starts at 1, then you can use the same variable for skip flag and skip depth.

void
init_info(Parseinfo *info) {
  info->skip = 0;
  info->depth = 1;
  /* Other initializations here */
}  /* End of init_info */

void XMLCALL
rawstart(void *data, const char *el, const char **attr) {
  Parseinfo *inf = (Parseinfo *) data;

  if (! inf->skip) {
    if (should_skip(inf, el, attr)) {
      inf->skip = inf->depth;
    }
    else
      start(inf, el, attr);     /* This does rest of start handling */
  }

  inf->depth++;
}  /* End of rawstart */

void XMLCALL
rawend(void *data, const char *el) {
  Parseinfo *inf = (Parseinfo *) data;

  inf->depth--;

  if (! inf->skip)
    end(inf, el);              /* This does rest of end handling */

  if (inf->skip == inf->depth)
    inf->skip = 0;
}  /* End rawend */

Notice in the above example the difference in how depth is manipulated in the start and end handlers. The end tag handler should be the mirror image of the start tag handler. This is necessary to properly model containment. Since, in the start tag handler, we incremented depth after the main body of start tag code, then in the end handler, we need to manipulate it before the main body. If we'd decided to increment it first thing in the start handler, then we'd have had to decrement it last thing in the end handler.

Communicating between handlers

In order to be able to pass information between different handlers without using globals, you'll need to define a data structure to hold the shared variables. You can then tell Expat (with the XML_SetUserData function) to pass a pointer to this structure to the handlers. This is the first argument received by most handlers. In the reference section, an argument to a callback function is named userData and have type void * if the user data is passed; it will have the type XML_Parser if the parser itself is passed. When the parser is passed, the user data may be retrieved using XML_GetUserData.

One common case where multiple calls to a single handler may need to communicate using an application data structure is the case when content passed to the character data handler (set by XML_SetCharacterDataHandler) needs to be accumulated. A common first-time mistake with any of the event-oriented interfaces to an XML parser is to expect all the text contained in an element to be reported by a single call to the character data handler. Expat, like many other XML parsers, reports such data as a sequence of calls; there's no way to know when the end of the sequence is reached until a different callback is made. A buffer referenced by the user data structure proves both an effective and convenient place to accumulate character data.

XML Version

Expat is an XML 1.0 parser, and as such never complains based on the value of the version pseudo-attribute in the XML declaration, if present.

If an application needs to check the version number (to support alternate processing), it should use the XML_SetXmlDeclHandler function to set a handler that uses the information in the XML declaration to determine what to do. This example shows how to check that only a version number of "1.0" is accepted:

static int wrong_version;
static XML_Parser parser;

static void XMLCALL
xmldecl_handler(void            *userData,
                const XML_Char  *version,
                const XML_Char  *encoding,
                int              standalone)
{
  static const XML_Char Version_1_0[] = {'1', '.', '0', 0};

  int i;

  for (i = 0; i < (sizeof(Version_1_0) / sizeof(Version_1_0[0])); ++i) {
    if (version[i] != Version_1_0[i]) {
      wrong_version = 1;
      /* also clear all other handlers: */
      XML_SetCharacterDataHandler(parser, NULL);
      ...
      return;
    }
  }
  ...
}

Namespace Processing

When the parser is created using the XML_ParserCreateNS, function, Expat performs namespace processing. Under namespace processing, Expat consumes xmlns and xmlns:... attributes, which declare namespaces for the scope of the element in which they occur. This means that your start handler will not see these attributes. Your application can still be informed of these declarations by setting namespace declaration handlers with XML_SetNamespaceDeclHandler.

Element type and attribute names that belong to a given namespace are passed to the appropriate handler in expanded form. By default this expanded form is a concatenation of the namespace URI, the separator character (which is the 2nd argument to XML_ParserCreateNS), and the local name (i.e. the part after the colon). Names with undeclared prefixes are not well-formed when namespace processing is enabled, and will trigger an error. Unprefixed attribute names are never expanded, and unprefixed element names are only expanded when they are in the scope of a default namespace.

However if XML_SetReturnNSTriplet has been called with a non-zero do_nst parameter, then the expanded form for names with an explicit prefix is a concatenation of: URI, separator, local name, separator, prefix.

You can set handlers for the start of a namespace declaration and for the end of a scope of a declaration with the XML_SetNamespaceDeclHandler function. The StartNamespaceDeclHandler is called prior to the start tag handler and the EndNamespaceDeclHandler is called after the corresponding end tag that ends the namespace's scope. The namespace start handler gets passed the prefix and URI for the namespace. For a default namespace declaration (xmlns='...'), the prefix will be null. The URI will be null for the case where the default namespace is being unset. The namespace end handler just gets the prefix for the closing scope.

These handlers are called for each declaration. So if, for instance, a start tag had three namespace declarations, then the StartNamespaceDeclHandler would be called three times before the start tag handler is called, once for each declaration.

Character Encodings

While XML is based on Unicode, and every XML processor is required to recognized UTF-8 and UTF-16 (1 and 2 byte encodings of Unicode), other encodings may be declared in XML documents or entities. For the main document, an XML declaration may contain an encoding declaration:

<?xml version="1.0" encoding="ISO-8859-2"?>

External parsed entities may begin with a text declaration, which looks like an XML declaration with just an encoding declaration:

<?xml encoding="Big5"?>

With Expat, you may also specify an encoding at the time of creating a parser. This is useful when the encoding information may come from a source outside the document itself (like a higher level protocol.)

There are four built-in encodings in Expat:

  • UTF-8
  • UTF-16
  • ISO-8859-1
  • US-ASCII

Anything else discovered in an encoding declaration or in the protocol encoding specified in the parser constructor, triggers a call to the UnknownEncodingHandler. This handler gets passed the encoding name and a pointer to an XML_Encoding data structure. Your handler must fill in this structure and return XML_STATUS_OK if it knows how to deal with the encoding. Otherwise the handler should return XML_STATUS_ERROR. The handler also gets passed a pointer to an optional application data structure that you may indicate when you set the handler.

Expat places restrictions on character encodings that it can support by filling in the XML_Encoding structure. include file:

  1. Every ASCII character that can appear in a well-formed XML document must be represented by a single byte, and that byte must correspond to it's ASCII encoding (except for the characters $@\^'{}~)
  2. Characters must be encoded in 4 bytes or less.
  3. All characters encoded must have Unicode scalar values less than or equal to 65535 (0xFFFF)This does not apply to the built-in support for UTF-16 and UTF-8
  4. No character may be encoded by more that one distinct sequence of bytes

XML_Encoding contains an array of integers that correspond to the 1st byte of an encoding sequence. If the value in the array for a byte is zero or positive, then the byte is a single byte encoding that encodes the Unicode scalar value contained in the array. A -1 in this array indicates a malformed byte. If the value is -2, -3, or -4, then the byte is the beginning of a 2, 3, or 4 byte sequence respectively. Multi-byte sequences are sent to the convert function pointed at in the XML_Encoding structure. This function should return the Unicode scalar value for the sequence or -1 if the sequence is malformed.

One pitfall that novice Expat users are likely to fall into is that although Expat may accept input in various encodings, the strings that it passes to the handlers are always encoded in UTF-8 or UTF-16 (depending on how Expat was compiled). Your application is responsible for any translation of these strings into other encodings.

Handling External Entity References

Expat does not read or parse external entities directly. Note that any external DTD is a special case of an external entity. If you've set no ExternalEntityRefHandler, then external entity references are silently ignored. Otherwise, it calls your handler with the information needed to read and parse the external entity.

Your handler isn't actually responsible for parsing the entity, but it is responsible for creating a subsidiary parser with XML_ExternalEntityParserCreate that will do the job. This returns an instance of XML_Parser that has handlers and other data structures initialized from the parent parser. You may then use XML_Parse or XML_ParseBuffer calls against this parser. Since external entities my refer to other external entities, your handler should be prepared to be called recursively.

Parsing DTDs

In order to parse parameter entities, before starting the parse, you must call XML_SetParamEntityParsing with one of the following arguments:

XML_PARAM_ENTITY_PARSING_NEVER
Don't parse parameter entities or the external subset
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
Parse parameter entites and the external subset unless standalone was set to "yes" in the XML declaration.
XML_PARAM_ENTITY_PARSING_ALWAYS
Always parse parameter entities and the external subset

In order to read an external DTD, you also have to set an external entity reference handler as described above.

Temporarily Stopping Parsing

Expat 1.95.8 introduces a new feature: its now possible to stop parsing temporarily from within a handler function, even if more data has already been passed into the parser. Applications for this include

  • Supporting the XInclude specification.
  • Delaying further processing until additional information is available from some other source.
  • Adjusting processor load as task priorities shift within an application.
  • Stopping parsing completely (simply free or reset the parser instead of resuming in the outer parsing loop). This can be useful if a application-domain error is found in the XML being parsed or if the result of the parse is determined not to be useful after all.

To take advantage of this feature, the main parsing loop of an application needs to support this specifically. It cannot be supported with a parsing loop compatible with Expat 1.95.7 or earlier (though existing loops will continue to work without supporting the stop/resume feature).

An application that uses this feature for a single parser will have the rough structure (in pseudo-code):

fd = open_input()
p = create_parser()

if parse_xml(p, fd) {
  /* suspended */

  int suspended = 1;

  while (suspended) {
    do_something_else()
    if ready_to_resume() {
      suspended = continue_parsing(p, fd);
    }
  }
}

An application that may resume any of several parsers based on input (either from the XML being parsed or some other source) will certainly have more interesting control structures.

This C function could be used for the parse_xml function mentioned in the pseudo-code above:

#define BUFF_SIZE 10240

/* Parse a document from the open file descriptor 'fd' until the parse
   is complete (the document has been completely parsed, or there's
   been an error), or the parse is stopped.  Return non-zero when
   the parse is merely suspended.
*/
int
parse_xml(XML_Parser p, int fd)
{
  for (;;) {
    int last_chunk;
    int bytes_read;
    enum XML_Status status;

    void *buff = XML_GetBuffer(p, BUFF_SIZE);
    if (buff == NULL) {
      /* handle error... */
      return 0;
    }
    bytes_read = read(fd, buff, BUFF_SIZE);
    if (bytes_read < 0) {
      /* handle error... */
      return 0;
    }
    status = XML_ParseBuffer(p, bytes_read, bytes_read == 0);
    switch (status) {
      case XML_STATUS_ERROR:
        /* handle error... */
        return 0;
      case XML_STATUS_SUSPENDED:
        return 1;
    }
    if (bytes_read == 0)
      return 0;
  }
}

The corresponding continue_parsing function is somewhat simpler, since it only need deal with the return code from XML_ResumeParser; it can delegate the input handling to the parse_xml function:

/* Continue parsing a document which had been suspended.  The 'p' and
   'fd' arguments are the same as passed to parse_xml().  Return
   non-zero when the parse is suspended.
*/
int
continue_parsing(XML_Parser p, int fd)
{
  enum XML_Status status = XML_ResumeParser(p);
  switch (status) {
    case XML_STATUS_ERROR:
      /* handle error... */
      return 0;
    case XML_ERROR_NOT_SUSPENDED:
      /* handle error... */
      return 0;.
    case XML_STATUS_SUSPENDED:
      return 1;
  }
  return parse_xml(p, fd);
}

Now that we've seen what a mess the top-level parsing loop can become, what have we gained? Very simply, we can now use the XML_StopParser function to stop parsing, without having to go to great lengths to avoid additional processing that we're expecting to ignore. As a bonus, we get to stop parsing temporarily, and come back to it when we're ready.

To stop parsing from a handler function, use the XML_StopParser function. This function takes two arguments; the parser being stopped and a flag indicating whether the parse can be resumed in the future.


Expat Reference

Parser Creation

XML_Parser XMLCALL
XML_ParserCreate(const XML_Char *encoding);
Construct a new parser. If encoding is non-null, it specifies a character encoding to use for the document. This overrides the document encoding declaration. There are four built-in encodings:
  • US-ASCII
  • UTF-8
  • UTF-16
  • ISO-8859-1
Any other value will invoke a call to the UnknownEncodingHandler.
XML_Parser XMLCALL
XML_ParserCreateNS(const XML_Char *encoding,
                   XML_Char sep);
Constructs a new parser that has namespace processing in effect. Namespace expanded element names and attribute names are returned as a concatenation of the namespace URI, sep, and the local part of the name. This means that you should pick a character for sep that can't be part of an URI. Since Expat does not check namespace URIs for conformance, the only safe choice for a namespace separator is a character that is illegal in XML. For instance, '\xFF' is not legal in UTF-8, and '\xFFFF' is not legal in UTF-16. There is a special case when sep is the null character '\0': the namespace URI and the local part will be concatenated without any separator - this is intended to support RDF processors. It is a programming error to use the null separator with namespace triplets.
XML_Parser XMLCALL
XML_ParserCreate_MM(const XML_Char *encoding,
                    const XML_Memory_Handling_Suite *ms,
		    const XML_Char *sep);
typedef struct {
  void *(XMLCALL *malloc_fcn)(size_t size);
  void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);
  void (XMLCALL *free_fcn)(void *ptr);
} XML_Memory_Handling_Suite;

Construct a new parser using the suite of memory handling functions specified in ms. If ms is NULL, then use the standard set of memory management functions. If sep is non NULL, then namespace processing is enabled in the created parser and the character pointed at by sep is used as the separator between the namespace URI and the local part of the name.

XML_Parser XMLCALL
XML_ExternalEntityParserCreate(XML_Parser p,
                               const XML_Char *context,
                               const XML_Char *encoding);
Construct a new XML_Parser object for parsing an external general entity. Context is the context argument passed in a call to a ExternalEntityRefHandler. Other state information such as handlers, user data, namespace processing is inherited from the parser passed as the 1st argument. So you shouldn't need to call any of the behavior changing functions on this parser (unless you want it to act differently than the parent parser).
void XMLCALL
XML_ParserFree(XML_Parser p);
Free memory used by the parser. Your application is responsible for freeing any memory associated with user data.
XML_Bool XMLCALL
XML_ParserReset(XML_Parser p,
                const XML_Char *encoding);
Clean up the memory structures maintained by the parser so that it may be used again. After this has been called, parser is ready to start parsing a new document. All handlers are cleared from the parser, except for the unknownEncodingHandler. The parser's external state is re-initialized except for the values of ns and ns_triplets. This function may not be used on a parser created using XML_ExternalEntityParserCreate; it will return XML_FALSE in that case. Returns XML_TRUE on success. Your application is responsible for dealing with any memory associated with user data.

Parsing

To state the obvious: the three parsing functions XML_Parse, XML_ParseBuffer and XML_GetBuffer must not be called from within a handler unless they operate on a separate parser instance, that is, one that did not call the handler. For example, it is OK to call the parsing functions from within an XML_ExternalEntityRefHandler, if they apply to the parser created by XML_ExternalEntityParserCreate.

Note: the len argument passed to these functions should be considerably less than the maximum value for an integer, as it could create an integer overflow situation if the added lengths of a buffer and the unprocessed portion of the previous buffer exceed the maximum integer value. Input data at the end of a buffer will remain unprocessed if it is part of an XML token for which the end is not part of that buffer.

enum XML_Status XMLCALL
XML_Parse(XML_Parser p,
          const char *s,
          int len,
          int isFinal);
enum XML_Status {
  XML_STATUS_ERROR = 0,
  XML_STATUS_OK = 1
};
Parse some more of the document. The string s is a buffer containing part (or perhaps all) of the document. The number of bytes of s that are part of the document is indicated by len. This means that s doesn't have to be null terminated. It also means that if len is larger than the number of bytes in the block of memory that s points at, then a memory fault is likely. The isFinal parameter informs the parser that this is the last piece of the document. Frequently, the last piece is empty (i.e. len is zero.) If a parse error occurred, it returns XML_STATUS_ERROR. Otherwise it returns XML_STATUS_OK value.
enum XML_Status XMLCALL
XML_ParseBuffer(XML_Parser p,
                int len,
                int isFinal);
This is just like XML_Parse, except in this case Expat provides the buffer. By obtaining the buffer from Expat with the XML_GetBuffer function, the application can avoid double copying of the input.
void * XMLCALL
XML_GetBuffer(XML_Parser p,
              int len);
Obtain a buffer of size len to read a piece of the document into. A NULL value is returned if Expat can't allocate enough memory for this buffer. This has to be called prior to every call to XML_ParseBuffer. A typical use would look like this:
for (;;) {
  int bytes_read;
  void *buff = XML_GetBuffer(p, BUFF_SIZE);
  if (buff == NULL) {
    /* handle error */
  }

  bytes_read = read(docfd, buff, BUFF_SIZE);
  if (bytes_read < 0) {
    /* handle error */
  }

  if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) {
    /* handle parse error */
  }

  if (bytes_read == 0)
    break;
}
enum XML_Status XMLCALL
XML_StopParser(XML_Parser p,
               XML_Bool resumable);

Stops parsing, causing XML_Parse or XML_ParseBuffer to return. Must be called from within a call-back handler, except when aborting (when resumable is XML_FALSE) an already suspended parser. Some call-backs may still follow because they would otherwise get lost, including

  • the end element handler for empty elements when stopped in the start element handler,
  • the end namespace declaration handler when stopped in the end element handler,
  • the character data handler when stopped in the character data handler while making multiple call-backs on a contiguous chunk of characters,
and possibly others.

This can be called from most handlers, including DTD related call-backs, except when parsing an external parameter entity and resumable is XML_TRUE. Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. The possible error codes are:

XML_ERROR_SUSPENDED
when suspending an already suspended parser.
XML_ERROR_FINISHED
when the parser has already finished.
XML_ERROR_SUSPEND_PE
when suspending while parsing an external PE.

Since the stop/resume feature requires application support in the outer parsing loop, it is an error to call this function for a parser not being handled appropriately; see Temporarily Stopping Parsing for more information.

When resumable is XML_TRUE then parsing is suspended, that is, XML_Parse and XML_ParseBuffer return XML_STATUS_SUSPENDED. Otherwise, parsing is aborted, that is, XML_Parse and XML_ParseBuffer return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.

Note: This will be applied to the current parser instance only, that is, if there is a parent parser then it will continue parsing when the external entity reference handler returns. It is up to the implementation of that handler to call XML_StopParser on the parent parser (recursively), if one wants to stop parsing altogether.

When suspended, parsing can be resumed by calling XML_ResumeParser.

New in Expat 1.95.8.

enum XML_Status XMLCALL
XML_ResumeParser(XML_Parser p);

Resumes parsing after it has been suspended with XML_StopParser. Must not be called from within a handler call-back. Returns same status codes as XML_Parse or XML_ParseBuffer. An additional error code, XML_ERROR_NOT_SUSPENDED, will be returned if the parser was not currently suspended.

Note: This must be called on the most deeply nested child parser instance first, and on its parent parser only after the child parser has finished, to be applied recursively until the document entity's parser is restarted. That is, the parent parser will not resume by itself and it is up to the application to call XML_ResumeParser on it at the appropriate moment.

New in Expat 1.95.8.

void XMLCALL
XML_GetParsingStatus(XML_Parser p,
                     XML_ParsingStatus *status);
enum XML_Parsing {
  XML_INITIALIZED,
  XML_PARSING,
  XML_FINISHED,
  XML_SUSPENDED
};

typedef struct {
  enum XML_Parsing parsing;
  XML_Bool finalBuffer;
} XML_ParsingStatus;

Returns status of parser with respect to being initialized, parsing, finished, or suspended, and whether the final buffer is being processed. The status parameter must not be NULL.

New in Expat 1.95.8.

Handler Setting

Although handlers are typically set prior to parsing and left alone, an application may choose to set or change the handler for a parsing event while the parse is in progress. For instance, your application may choose to ignore all text not descended from a para element. One way it could do this is to set the character handler when a para start tag is seen, and unset it for the corresponding end tag.

A handler may be unset by providing a NULL pointer to the appropriate handler setter. None of the handler setting functions have a return value.

Your handlers will be receiving strings in arrays of type XML_Char. This type is conditionally defined in expat.h as either char, wchar_t or unsigned short. The former implies UTF-8 encoding, the latter two imply UTF-16 encoding. Note that you'll receive them in this form independent of the original encoding of the document.

void XMLCALL
XML_SetStartElementHandler(XML_Parser p,
                           XML_StartElementHandler start);
typedef void
(XMLCALL *XML_StartElementHandler)(void *userData,
                                   const XML_Char *name,
                                   const XML_Char **atts);

Set handler for start (and empty) tags. Attributes are passed to the start handler as a pointer to a vector of char pointers. Each attribute seen in a start (or empty) tag occupies 2 consecutive places in this vector: the attribute name followed by the attribute value. These pairs are terminated by a null pointer.

Note that an empty tag generates a call to both start and end handlers (in that order).

void XMLCALL
XML_SetEndElementHandler(XML_Parser p,
                         XML_EndElementHandler);
typedef void
(XMLCALL *XML_EndElementHandler)(void *userData,
                                 const XML_Char *name);

Set handler for end (and empty) tags. As noted above, an empty tag generates a call to both start and end handlers.

void XMLCALL
XML_SetElementHandler(XML_Parser p,
                      XML_StartElementHandler start,
                      XML_EndElementHandler end);

Set handlers for start and end tags with one call.

void XMLCALL
XML_SetCharacterDataHandler(XML_Parser p,
                            XML_CharacterDataHandler charhndl)
typedef void
(XMLCALL *XML_CharacterDataHandler)(void *userData,
                                    const XML_Char *s,
                                    int len);

Set a text handler. The string your handler receives is NOT nul-terminated. You have to use the length argument to deal with the end of the string. A single block of contiguous text free of markup may still result in a sequence of calls to this handler. In other words, if you're searching for a pattern in the text, it may be split across calls to this handler. Note: Setting this handler to NULL may NOT immediately terminate call-backs if the parser is currently processing such a single block of contiguous markup-free text, as the parser will continue calling back until the end of the block is reached.

void XMLCALL
XML_SetProcessingInstructionHandler(XML_Parser p,
                                    XML_ProcessingInstructionHandler proc)
typedef void
(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
                                            const XML_Char *target,
                                            const XML_Char *data);

Set a handler for processing instructions. The target is the first word in the processing instruction. The data is the rest of the characters in it after skipping all whitespace after the initial word.

void XMLCALL
XML_SetCommentHandler(XML_Parser p,
                      XML_CommentHandler cmnt)
typedef void
(XMLCALL *XML_CommentHandler)(void *userData,
                              const XML_Char *data);

Set a handler for comments. The data is all text inside the comment delimiters.

void XMLCALL
XML_SetStartCdataSectionHandler(XML_Parser p,
                                XML_StartCdataSectionHandler start);
typedef void
(XMLCALL *XML_StartCdataSectionHandler)(void *userData);

Set a handler that gets called at the beginning of a CDATA section.

void XMLCALL
XML_SetEndCdataSectionHandler(XML_Parser p,
                              XML_EndCdataSectionHandler end);
typedef void
(XMLCALL *XML_EndCdataSectionHandler)(void *userData);

Set a handler that gets called at the end of a CDATA section.

void XMLCALL
XML_SetCdataSectionHandler(XML_Parser p,
                           XML_StartCdataSectionHandler start,
                           XML_EndCdataSectionHandler end)

Sets both CDATA section handlers with one call.

void XMLCALL
XML_SetDefaultHandler(XML_Parser p,
                      XML_DefaultHandler hndl)
typedef void
(XMLCALL *XML_DefaultHandler)(void *userData,
                              const XML_Char *s,
                              int len);

Sets a handler for any characters in the document which wouldn't otherwise be handled. This includes both data for which no handlers can be set (like some kinds of DTD declarations) and data which could be reported but which currently has no handler set. The characters are passed exactly as they were present in the XML document except that they will be encoded in UTF-8 or UTF-16. Line boundaries are not normalized. Note that a byte order mark character is not passed to the default handler. There are no guarantees about how characters are divided between calls to the default handler: for example, a comment might be split between multiple calls. Setting the handler with this call has the side effect of turning off expansion of references to internally defined general entities. Instead these references are passed to the default handler.

See also XML_DefaultCurrent.

void XMLCALL
XML_SetDefaultHandlerExpand(XML_Parser p,
                            XML_DefaultHandler hndl)
typedef void
(XMLCALL *XML_DefaultHandler)(void *userData,
                              const XML_Char *s,
                              int len);

This sets a default handler, but doesn't inhibit the expansion of internal entity references. The entity reference will not be passed to the default handler.

See also XML_DefaultCurrent.

void XMLCALL
XML_SetExternalEntityRefHandler(XML_Parser p,
                                XML_ExternalEntityRefHandler hndl)
typedef int
(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser p,
                                        const XML_Char *context,
                                        const XML_Char *base,
                                        const XML_Char *systemId,
                                        const XML_Char *publicId);

Set an external entity reference handler. This handler is also called for processing an external DTD subset if parameter entity parsing is in effect. (See XML_SetParamEntityParsing.)

The context parameter specifies the parsing context in the format expected by the context argument to XML_ExternalEntityParserCreate. code is valid only until the handler returns, so if the referenced entity is to be parsed later, it must be copied. context is NULL only when the entity is a parameter entity, which is how one can differentiate between general and parameter entities.

The base parameter is the base to use for relative system identifiers. It is set by XML_SetBase and may be NULL. The publicId parameter is the public id given in the entity declaration and may be NULL. systemId is the system identifier specified in the entity declaration and is never NULL.

There are a couple of ways in which this handler differs from others. First, this handler returns a status indicator (an integer). XML_STATUS_OK should be returned for successful handling of the external entity reference. Returning XML_STATUS_ERROR indicates failure, and causes the calling parser to return an XML_ERROR_EXTERNAL_ENTITY_HANDLING error.

Second, instead of having the user data as its first argument, it receives the parser that encountered the entity reference. This, along with the context parameter, may be used as arguments to a call to XML_ExternalEntityParserCreate. Using the returned parser, the body of the external entity can be recursively parsed.

Since this handler may be called recursively, it should not be saving information into global or static variables.

void XMLCALL
XML_SetExternalEntityRefHandlerArg(XML_Parser p,
                                   void *arg)

Set the argument passed to the ExternalEntityRefHandler. If arg is not NULL, it is the new value passed to the handler set using XML_SetExternalEntityRefHandler; if arg is NULL, the argument passed to the handler function will be the parser object itself.

Note: The type of arg and the type of the first argument to the ExternalEntityRefHandler do not match. This function takes a void * to be passed to the handler, while the handler accepts an XML_Parser. This is a historical accident, but will not be corrected before Expat 2.0 (at the earliest) to avoid causing compiler warnings for code that's known to work with this API. It is the responsibility of the application code to know the actual type of the argument passed to the handler and to manage it properly.

void XMLCALL
XML_SetSkippedEntityHandler(XML_Parser p,
                            XML_SkippedEntityHandler handler)
typedef void
(XMLCALL *XML_SkippedEntityHandler)(void *userData,
                                    const XML_Char *entityName,
                                    int is_parameter_entity);

Set a skipped entity handler. This is called in two situations:

  1. An entity reference is encountered for which no declaration has been read and this is not an error.
  2. An internal entity reference is read, but not expanded, because XML_SetDefaultHandler has been called.

The is_parameter_entity argument will be non-zero for a parameter entity and zero for a general entity.

Note: skipped parameter entities in declarations and skipped general entities in attribute values cannot be reported, because the event would be out of sync with the reporting of the declarations or attribute values

void XMLCALL
XML_SetUnknownEncodingHandler(XML_Parser p,
                              XML_UnknownEncodingHandler enchandler,
			      void *encodingHandlerData)
typedef int
(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
                                      const XML_Char *name,
                                      XML_Encoding *info);

typedef struct {
  int map[256];
  void *data;
  int (XMLCALL *convert)(void *data, const char *s);
  void (XMLCALL *release)(void *data);
} XML_Encoding;

Set a handler to deal with encodings other than the built in set. This should be done before XML_Parse or XML_ParseBuffer have been called on the given parser.

If the handler knows how to deal with an encoding with the given name, it should fill in the info data structure and return XML_STATUS_OK. Otherwise it should return XML_STATUS_ERROR. The handler will be called at most once per parsed (external) entity. The optional application data pointer encodingHandlerData will be passed back to the handler.

The map array contains information for every possible possible leading byte in a byte sequence. If the corresponding value is >= 0, then it's a single byte sequence and the byte encodes that Unicode value. If the value is -1, then that byte is invalid as the initial byte in a sequence. If the value is -n, where n is an integer > 1, then n is the number of bytes in the sequence and the actual conversion is accomplished by a call to the function pointed at by convert. This function may return -1 if the sequence itself is invalid. The convert pointer may be null if there are only single byte codes. The data parameter passed to the convert function is the data pointer from XML_Encoding. The string s is NOT nul-terminated and points at the sequence of bytes to be converted.

The function pointed at by release is called by the parser when it is finished with the encoding. It may be NULL.

void XMLCALL
XML_SetStartNamespaceDeclHandler(XML_Parser p,
			         XML_StartNamespaceDeclHandler start);
typedef void
(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
                                         const XML_Char *prefix,
                                         const XML_Char *uri);

Set a handler to be called when a namespace is declared. Namespace declarations occur inside start tags. But the namespace declaration start handler is called before the start tag handler for each namespace declared in that start tag.

void XMLCALL
XML_SetEndNamespaceDeclHandler(XML_Parser p,
			       XML_EndNamespaceDeclHandler end);
typedef void
(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
                                       const XML_Char *prefix);

Set a handler to be called when leaving the scope of a namespace declaration. This will be called, for each namespace declaration, after the handler for the end tag of the element in which the namespace was declared.

void XMLCALL
XML_SetNamespaceDeclHandler(XML_Parser p,
                            XML_StartNamespaceDeclHandler start,
                            XML_EndNamespaceDeclHandler end)

Sets both namespace declaration handlers with a single call.

void XMLCALL
XML_SetXmlDeclHandler(XML_Parser p,
		      XML_XmlDeclHandler xmldecl);
typedef void
(XMLCALL *XML_XmlDeclHandler)(void            *userData,
                              const XML_Char  *version,
                              const XML_Char  *encoding,
                              int             standalone);

Sets a handler that is called for XML declarations and also for text declarations discovered in external entities. The way to distinguish is that the version parameter will be NULL for text declarations. The encoding parameter may be NULL for an XML declaration. The standalone argument will contain -1, 0, or 1 indicating respectively that there was no standalone parameter in the declaration, that it was given as no, or that it was given as yes.

void XMLCALL
XML_SetStartDoctypeDeclHandler(XML_Parser p,
			       XML_StartDoctypeDeclHandler start);
typedef void
(XMLCALL *XML_StartDoctypeDeclHandler)(void           *userData,
                                       const XML_Char *doctypeName,
                                       const XML_Char *sysid,
                                       const XML_Char *pubid,
                                       int            has_internal_subset);

Set a handler that is called at the start of a DOCTYPE declaration, before any external or internal subset is parsed. Both sysid and pubid may be NULL. The has_internal_subset will be non-zero if the DOCTYPE declaration has an internal subset.

void XMLCALL
XML_SetEndDoctypeDeclHandler(XML_Parser p,
			     XML_EndDoctypeDeclHandler end);
typedef void
(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);

Set a handler that is called at the end of a DOCTYPE declaration, after parsing any external subset.

void XMLCALL
XML_SetDoctypeDeclHandler(XML_Parser p,
			  XML_StartDoctypeDeclHandler start,
			  XML_EndDoctypeDeclHandler end);

Set both doctype handlers with one call.

void XMLCALL
XML_SetElementDeclHandler(XML_Parser p,
			  XML_ElementDeclHandler eldecl);
typedef void
(XMLCALL *XML_ElementDeclHandler)(void *userData,
                                  const XML_Char *name,
                                  XML_Content *model);
enum XML_Content_Type {
  XML_CTYPE_EMPTY = 1,
  XML_CTYPE_ANY,
  XML_CTYPE_MIXED,
  XML_CTYPE_NAME,
  XML_CTYPE_CHOICE,
  XML_CTYPE_SEQ
};

enum XML_Content_Quant {
  XML_CQUANT_NONE,
  XML_CQUANT_OPT,
  XML_CQUANT_REP,
  XML_CQUANT_PLUS
};

typedef struct XML_cp XML_Content;

struct XML_cp {
  enum XML_Content_Type		type;
  enum XML_Content_Quant	quant;
  const XML_Char *		name;
  unsigned int			numchildren;
  XML_Content *			children;
};

Sets a handler for element declarations in a DTD. The handler gets called with the name of the element in the declaration and a pointer to a structure that contains the element model. It is the application's responsibility to free this data structure using XML_FreeContentModel.

The model argument is the root of a tree of XML_Content nodes. If type equals XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be XML_CQUANT_NONE, and the other fields will be zero or NULL. If type is XML_CTYPE_MIXED, then quant will be XML_CQUANT_NONE or XML_CQUANT_REP and numchildren will contain the number of elements that are allowed to be mixed in and children points to an array of XML_Content structures that will all have type XML_CTYPE_NAME with no quantification. Only the root node can be type XML_CTYPE_EMPTY, XML_CTYPE_ANY, or XML_CTYPE_MIXED.

For type XML_CTYPE_NAME, the name field points to the name and the numchildren and children fields will be zero and NULL. The quant field will indicate any quantifiers placed on the name.

Types XML_CTYPE_CHOICE and XML_CTYPE_SEQ indicate a choice or sequence respectively. The numchildren field indicates how many nodes in the choice or sequence and children points to the nodes.

void XMLCALL
XML_SetAttlistDeclHandler(XML_Parser p,
                          XML_AttlistDeclHandler attdecl);
typedef void
(XMLCALL *XML_AttlistDeclHandler)(void           *userData,
                                  const XML_Char *elname,
                                  const XML_Char *attname,
                                  const XML_Char *att_type,
                                  const XML_Char *dflt,
                                  int            isrequired);

Set a handler for attlist declarations in the DTD. This handler is called for each attribute. So a single attlist declaration with multiple attributes declared will generate multiple calls to this handler. The elname parameter returns the name of the element for which the attribute is being declared. The attribute name is in the attname parameter. The attribute type is in the att_type parameter. It is the string representing the type in the declaration with whitespace removed.

The dflt parameter holds the default value. It will be NULL in the case of "#IMPLIED" or "#REQUIRED" attributes. You can distinguish these two cases by checking the isrequired parameter, which will be true in the case of "#REQUIRED" attributes. Attributes which are "#FIXED" will have also have a true isrequired, but they will have the non-NULL fixed value in the dflt parameter.

void XMLCALL
XML_SetEntityDeclHandler(XML_Parser p,
			 XML_EntityDeclHandler handler);
typedef void
(XMLCALL *XML_EntityDeclHandler)(void           *userData,
                                 const XML_Char *entityName,
                                 int            is_parameter_entity,
                                 const XML_Char *value,
                                 int            value_length, 
                                 const XML_Char *base,
                                 const XML_Char *systemId,
                                 const XML_Char *publicId,
                                 const XML_Char *notationName);

Sets a handler that will be called for all entity declarations. The is_parameter_entity argument will be non-zero in the case of parameter entities and zero otherwise.

For internal entities (<!ENTITY foo "bar">), value will be non-NULL and systemId, publicId, and notationName will all be NULL. The value string is not NULL terminated; the length is provided in the value_length parameter. Do not use value_length to test for internal entities, since it is legal to have zero-length values. Instead check for whether or not value is NULL.

The notationName argument will have a non-NULL value only for unparsed entity declarations.

void XMLCALL
XML_SetUnparsedEntityDeclHandler(XML_Parser p,
                                 XML_UnparsedEntityDeclHandler h)
typedef void
(XMLCALL *XML_UnparsedEntityDeclHandler)(void *userData,
                                         const XML_Char *entityName, 
                                         const XML_Char *base,
                                         const XML_Char *systemId,
                                         const XML_Char *publicId,
                                         const XML_Char *notationName);

Set a handler that receives declarations of unparsed entities. These are entity declarations that have a notation (NDATA) field:

<!ENTITY logo SYSTEM "images/logo.gif" NDATA gif>

This handler is obsolete and is provided for backwards compatibility. Use instead XML_SetEntityDeclHandler.

void XMLCALL
XML_SetNotationDeclHandler(XML_Parser p,
                           XML_NotationDeclHandler h)
typedef void
(XMLCALL *XML_NotationDeclHandler)(void *userData, 
                                   const XML_Char *notationName,
                                   const XML_Char *base,
                                   const XML_Char *systemId,
                                   const XML_Char *publicId);

Set a handler that receives notation declarations.

void XMLCALL
XML_SetNotStandaloneHandler(XML_Parser p,
                            XML_NotStandaloneHandler h)
typedef int 
(XMLCALL *XML_NotStandaloneHandler)(void *userData);

Set a handler that is called if the document is not "standalone". This happens when there is an external subset or a reference to a parameter entity, but does not have standalone set to "yes" in an XML declaration. If this handler returns XML_STATUS_ERROR, then the parser will throw an XML_ERROR_NOT_STANDALONE error.

Parse position and error reporting functions

These are the functions you'll want to call when the parse functions return XML_STATUS_ERROR (a parse error has occurred), although the position reporting functions are useful outside of errors. The position reported is the byte position (in the original document or entity encoding) of the first of the sequence of characters that generated the current event (or the error that caused the parse functions to return XML_STATUS_ERROR.) The exceptions are callbacks trigged by declarations in the document prologue, in which case they exact position reported is somewhere in the relevant markup, but not necessarily as meaningful as for other events.

The position reporting functions are accurate only outside of the DTD. In other words, they usually return bogus information when called from within a DTD declaration handler.

enum XML_Error XMLCALL
XML_GetErrorCode(XML_Parser p);
Return what type of error has occurred.
const XML_LChar * XMLCALL
XML_ErrorString(enum XML_Error code);
Return a string describing the error corresponding to code. The code should be one of the enums that can be returned from XML_GetErrorCode.
XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser p);
Return the byte offset of the position. This always corresponds to the values returned by XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber.
XML_Size XMLCALL
XML_GetCurrentLineNumber(XML_Parser p);
Return the line number of the position. The first line is reported as 1.
XML_Size XMLCALL
XML_GetCurrentColumnNumber(XML_Parser p);
Return the offset, from the beginning of the current line, of the position.
int XMLCALL
XML_GetCurrentByteCount(XML_Parser p);
Return the number of bytes in the current event. Returns 0 if the event is inside a reference to an internal entity and for the end-tag event for empty element tags (the later can be used to distinguish empty-element tags from empty elements using separate start and end tags).
const char * XMLCALL
XML_GetInputContext(XML_Parser p,
                    int *offset,
                    int *size);

Returns the parser's input buffer, sets the integer pointed at by offset to the offset within this buffer of the current parse position, and set the integer pointed at by size to the size of the returned buffer.

This should only be called from within a handler during an active parse and the returned buffer should only be referred to from within the handler that made the call. This input buffer contains the untranslated bytes of the input.

Only a limited amount of context is kept, so if the event triggering a call spans over a very large amount of input, the actual parse position may be before the beginning of the buffer.

If XML_CONTEXT_BYTES is not defined, this will always return NULL.

Miscellaneous functions

The functions in this section either obtain state information from the parser or can be used to dynamicly set parser options.

void XMLCALL
XML_SetUserData(XML_Parser p,
                void *userData);
This sets the user data pointer that gets passed to handlers. It overwrites any previous value for this pointer. Note that the application is responsible for freeing the memory associated with userData when it is finished with the parser. So if you call this when there's already a pointer there, and you haven't freed the memory associated with it, then you've probably just leaked memory.
void * XMLCALL
XML_GetUserData(XML_Parser p);
This returns the user data pointer that gets passed to handlers. It is actually implemented as a macro.
void XMLCALL
XML_UseParserAsHandlerArg(XML_Parser p);
After this is called, handlers receive the parser in their userData arguments. The user data can still be obtained using the XML_GetUserData function.
enum XML_Status XMLCALL
XML_SetBase(XML_Parser p,
            const XML_Char *base);
Set the base to be used for resolving relative URIs in system identifiers. The return value is XML_STATUS_ERROR if there's no memory to store base, otherwise it's XML_STATUS_OK.
const XML_Char * XMLCALL
XML_GetBase(XML_Parser p);
Return the base for resolving relative URIs.
int XMLCALL
XML_GetSpecifiedAttributeCount(XML_Parser p);
When attributes are reported to the start handler in the atts vector, attributes that were explicitly set in the element occur before any attributes that receive their value from default information in an ATTLIST declaration. This function returns the number of attributes that were explicitly set times two, thus giving the offset in the atts array passed to the start tag handler of the first attribute set due to defaults. It supplies information for the last call to a start handler. If called inside a start handler, then that means the current call.
int XMLCALL
XML_GetIdAttributeIndex(XML_Parser p);
Returns the index of the ID attribute passed in the atts array in the last call to XML_StartElementHandler, or -1 if there is no ID attribute. If called inside a start handler, then that means the current call.
const XML_AttrInfo * XMLCALL
XML_GetAttributeInfo(XML_Parser parser);
typedef struct {
  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
} XML_AttrInfo;
Returns an array of XML_AttrInfo structures for the attribute/value pairs passed in the last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 1; thus the number of entries in the array is XML_GetSpecifiedAttributeCount(parser) / 2.
enum XML_Status XMLCALL
XML_SetEncoding(XML_Parser p,
                const XML_Char *encoding);
Set the encoding to be used by the parser. It is equivalent to passing a non-null encoding argument to the parser creation functions. It must not be called after XML_Parse or XML_ParseBuffer have been called on the given parser. Returns XML_STATUS_OK on success or XML_STATUS_ERROR on error.
int XMLCALL
XML_SetParamEntityParsing(XML_Parser p,
                          enum XML_ParamEntityParsing code);
This enables parsing of parameter entities, including the external parameter entity that is the external DTD subset, according to code. The choices for code are:
  • XML_PARAM_ENTITY_PARSING_NEVER
  • XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
  • XML_PARAM_ENTITY_PARSING_ALWAYS
Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0.
int XMLCALL
XML_SetHashSalt(XML_Parser p,
                unsigned long hash_salt);
Sets the hash salt to use for internal hash calculations. Helps in preventing DoS attacks based on predicting hash function behavior. In order to have an effect this must be called before parsing has started. Returns 1 if successful, 0 when called after XML_Parse or XML_ParseBuffer.

Note: This call is optional, as the parser will auto-generate a new random salt value if no value has been set at the start of parsing.

enum XML_Error XMLCALL
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);

This function allows an application to provide an external subset for the document type declaration for documents which do not specify an external subset of their own. For documents which specify an external subset in their DOCTYPE declaration, the application-provided subset will be ignored. If the document does not contain a DOCTYPE declaration at all and useDTD is true, the application-provided subset will be parsed, but the startDoctypeDeclHandler and endDoctypeDeclHandler functions, if set, will not be called. The setting of parameter entity parsing, controlled using XML_SetParamEntityParsing, will be honored.

The application-provided external subset is read by calling the external entity reference handler set via XML_SetExternalEntityRefHandler with both publicId and systemId set to NULL.

If this function is called after parsing has begun, it returns XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING and ignores useDTD. If called when Expat has been compiled without DTD support, it returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. Otherwise, it returns XML_ERROR_NONE.

Note: For the purpose of checking WFC: Entity Declared, passing useDTD == XML_TRUE will make the parser behave as if the document had a DTD with an external subset. This holds true even if the external entity reference handler returns without action.

void XMLCALL
XML_SetReturnNSTriplet(XML_Parser parser,
                       int        do_nst);

This function only has an effect when using a parser created with XML_ParserCreateNS, i.e. when namespace processing is in effect. The do_nst sets whether or not prefixes are returned with names qualified with a namespace prefix. If this function is called with do_nst non-zero, then afterwards namespace qualified names (that is qualified with a prefix as opposed to belonging to a default namespace) are returned as a triplet with the three parts separated by the namespace separator specified when the parser was created. The order of returned parts is URI, local name, and prefix.

If do_nst is zero, then namespaces are reported in the default manner, URI then local_name separated by the namespace separator.

void XMLCALL
XML_DefaultCurrent(XML_Parser parser);
This can be called within a handler for a start element, end element, processing instruction or character data. It causes the corresponding markup to be passed to the default handler set by XML_SetDefaultHandler or XML_SetDefaultHandlerExpand. It does nothing if there is not a default handler.
XML_LChar * XMLCALL
XML_ExpatVersion();
Return the library version as a string (e.g. "expat_1.95.1").
struct XML_Expat_Version XMLCALL
XML_ExpatVersionInfo();
typedef struct {
  int major;
  int minor;
  int micro;
} XML_Expat_Version;
Return the library version information as a structure. Some macros are also defined that support compile-time tests of the library version:
  • XML_MAJOR_VERSION
  • XML_MINOR_VERSION
  • XML_MICRO_VERSION
Testing these constants is currently the best way to determine if particular parts of the Expat API are available.
const XML_Feature * XMLCALL
XML_GetFeatureList();
enum XML_FeatureEnum {
  XML_FEATURE_END = 0,
  XML_FEATURE_UNICODE,
  XML_FEATURE_UNICODE_WCHAR_T,
  XML_FEATURE_DTD,
  XML_FEATURE_CONTEXT_BYTES,
  XML_FEATURE_MIN_SIZE,
  XML_FEATURE_SIZEOF_XML_CHAR,
  XML_FEATURE_SIZEOF_XML_LCHAR,
  XML_FEATURE_NS,
  XML_FEATURE_LARGE_SIZE
};

typedef struct {
  enum XML_FeatureEnum  feature;
  XML_LChar            *name;
  long int              value;
} XML_Feature;

Returns a list of "feature" records, providing details on how Expat was configured at compile time. Most applications should not need to worry about this, but this information is otherwise not available from Expat. This function allows code that does need to check these features to do so at runtime.

The return value is an array of XML_Feature, terminated by a record with a feature of XML_FEATURE_END and name of NULL, identifying the feature-test macros Expat was compiled with. Since an application that requires this kind of information needs to determine the type of character the name points to, records for the XML_FEATURE_SIZEOF_XML_CHAR and XML_FEATURE_SIZEOF_XML_LCHAR will be located at the beginning of the list, followed by XML_FEATURE_UNICODE and XML_FEATURE_UNICODE_WCHAR_T, if they are present at all.

Some features have an associated value. If there isn't an associated value, the value field is set to 0. At this time, the following features have been defined to have values:

XML_FEATURE_SIZEOF_XML_CHAR
The number of bytes occupied by one XML_Char character.
XML_FEATURE_SIZEOF_XML_LCHAR
The number of bytes occupied by one XML_LChar character.
XML_FEATURE_CONTEXT_BYTES
The maximum number of characters of context which can be reported by XML_GetInputContext.
void XMLCALL
XML_FreeContentModel(XML_Parser parser, XML_Content *model);
Function to deallocate the model argument passed to the XML_ElementDeclHandler callback set using XML_ElementDeclHandler. This function should not be used for any other purpose.

The following functions allow external code to share the memory allocator an XML_Parser has been configured to use. This is especially useful for third-party libraries that interact with a parser object created by application code, or heavily layered applications. This can be essential when using dynamically loaded libraries which use different C standard libraries (this can happen on Windows, at least).

void * XMLCALL
XML_MemMalloc(XML_Parser parser, size_t size);
Allocate size bytes of memory using the allocator the parser object has been configured to use. Returns a pointer to the memory or NULL on failure. Memory allocated in this way must be freed using XML_MemFree.
void * XMLCALL
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
Allocate size bytes of memory using the allocator the parser object has been configured to use. ptr must point to a block of memory allocated by XML_MemMalloc or XML_MemRealloc, or be NULL. This function tries to expand the block pointed to by ptr if possible. Returns a pointer to the memory or NULL on failure. On success, the original block has either been expanded or freed. On failure, the original block has not been freed; the caller is responsible for freeing the original block. Memory allocated in this way must be freed using XML_MemFree.
void XMLCALL
XML_MemFree(XML_Parser parser, void *ptr);
Free a block of memory pointed to by ptr. The block must have been allocated by XML_MemMalloc or XML_MemRealloc, or be NULL.

Valid XHTML 1.0!

astropy-0.3/cextern/expat/doc/xmlwf.10000755000175000017500000001732712243255342015771 0ustar oleole.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "XMLWF" "1" "24 January 2003" "" "" .SH NAME xmlwf \- Determines if an XML document is well-formed .SH SYNOPSIS \fBxmlwf\fR [ \fB-s\fR] [ \fB-n\fR] [ \fB-p\fR] [ \fB-x\fR] [ \fB-e \fIencoding\fB\fR] [ \fB-w\fR] [ \fB-d \fIoutput-dir\fB\fR] [ \fB-c\fR] [ \fB-m\fR] [ \fB-r\fR] [ \fB-t\fR] [ \fB-v\fR] [ \fBfile ...\fR] .SH "DESCRIPTION" .PP \fBxmlwf\fR uses the Expat library to determine if an XML document is well-formed. It is non-validating. .PP If you do not specify any files on the command-line, and you have a recent version of \fBxmlwf\fR, the input file will be read from standard input. .SH "WELL-FORMED DOCUMENTS" .PP A well-formed document must adhere to the following rules: .TP 0.2i \(bu The file begins with an XML declaration. For instance, . \fBNOTE:\fR \fBxmlwf\fR does not currently check for a valid XML declaration. .TP 0.2i \(bu Every start tag is either empty () or has a corresponding end tag. .TP 0.2i \(bu There is exactly one root element. This element must contain all other elements in the document. Only comments, white space, and processing instructions may come after the close of the root element. .TP 0.2i \(bu All elements nest properly. .TP 0.2i \(bu All attribute values are enclosed in quotes (either single or double). .PP If the document has a DTD, and it strictly complies with that DTD, then the document is also considered \fBvalid\fR. \fBxmlwf\fR is a non-validating parser -- it does not check the DTD. However, it does support external entities (see the \fB-x\fR option). .SH "OPTIONS" .PP When an option includes an argument, you may specify the argument either separately ("\fB-d\fR output") or concatenated with the option ("\fB-d\fRoutput"). \fBxmlwf\fR supports both. .TP \fB-c\fR If the input file is well-formed and \fBxmlwf\fR doesn't encounter any errors, the input file is simply copied to the output directory unchanged. This implies no namespaces (turns off \fB-n\fR) and requires \fB-d\fR to specify an output file. .TP \fB-d output-dir\fR Specifies a directory to contain transformed representations of the input files. By default, \fB-d\fR outputs a canonical representation (described below). You can select different output formats using \fB-c\fR and \fB-m\fR. The output filenames will be exactly the same as the input filenames or "STDIN" if the input is coming from standard input. Therefore, you must be careful that the output file does not go into the same directory as the input file. Otherwise, \fBxmlwf\fR will delete the input file before it generates the output file (just like running cat < file > file in most shells). Two structurally equivalent XML documents have a byte-for-byte identical canonical XML representation. Note that ignorable white space is considered significant and is treated equivalently to data. More on canonical XML can be found at http://www.jclark.com/xml/canonxml.html . .TP \fB-e encoding\fR Specifies the character encoding for the document, overriding any document encoding declaration. \fBxmlwf\fR supports four built-in encodings: US-ASCII, UTF-8, UTF-16, and ISO-8859-1. Also see the \fB-w\fR option. .TP \fB-m\fR Outputs some strange sort of XML file that completely describes the input file, including character positions. Requires \fB-d\fR to specify an output file. .TP \fB-n\fR Turns on namespace processing. (describe namespaces) \fB-c\fR disables namespaces. .TP \fB-p\fR Tells xmlwf to process external DTDs and parameter entities. Normally \fBxmlwf\fR never parses parameter entities. \fB-p\fR tells it to always parse them. \fB-p\fR implies \fB-x\fR. .TP \fB-r\fR Normally \fBxmlwf\fR memory-maps the XML file before parsing; this can result in faster parsing on many platforms. \fB-r\fR turns off memory-mapping and uses normal file IO calls instead. Of course, memory-mapping is automatically turned off when reading from standard input. Use of memory-mapping can cause some platforms to report substantially higher memory usage for \fBxmlwf\fR, but this appears to be a matter of the operating system reporting memory in a strange way; there is not a leak in \fBxmlwf\fR. .TP \fB-s\fR Prints an error if the document is not standalone. A document is standalone if it has no external subset and no references to parameter entities. .TP \fB-t\fR Turns on timings. This tells Expat to parse the entire file, but not perform any processing. This gives a fairly accurate idea of the raw speed of Expat itself without client overhead. \fB-t\fR turns off most of the output options (\fB-d\fR, \fB-m\fR, \fB-c\fR, \&...). .TP \fB-v\fR Prints the version of the Expat library being used, including some information on the compile-time configuration of the library, and then exits. .TP \fB-w\fR Enables support for Windows code pages. Normally, \fBxmlwf\fR will throw an error if it runs across an encoding that it is not equipped to handle itself. With \fB-w\fR, xmlwf will try to use a Windows code page. See also \fB-e\fR. .TP \fB-x\fR Turns on parsing external entities. Non-validating parsers are not required to resolve external entities, or even expand entities at all. Expat always expands internal entities (?), but external entity parsing must be enabled explicitly. External entities are simply entities that obtain their data from outside the XML file currently being parsed. This is an example of an internal entity: .nf .fi And here are some examples of external entities: .nf (parsed) (unparsed) .fi .TP \fB--\fR (Two hyphens.) Terminates the list of options. This is only needed if a filename starts with a hyphen. For example: .nf xmlwf -- -myfile.xml .fi will run \fBxmlwf\fR on the file \fI-myfile.xml\fR. .PP Older versions of \fBxmlwf\fR do not support reading from standard input. .SH "OUTPUT" .PP If an input file is not well-formed, \fBxmlwf\fR prints a single line describing the problem to standard output. If a file is well formed, \fBxmlwf\fR outputs nothing. Note that the result code is \fBnot\fR set. .SH "BUGS" .PP According to the W3C standard, an XML file without a declaration at the beginning is not considered well-formed. However, \fBxmlwf\fR allows this to pass. .PP \fBxmlwf\fR returns a 0 - noerr result, even if the file is not well-formed. There is no good way for a program to use \fBxmlwf\fR to quickly check a file -- it must parse \fBxmlwf\fR's standard output. .PP The errors should go to standard error, not standard output. .PP There should be a way to get \fB-d\fR to send its output to standard output rather than forcing the user to send it to a file. .PP I have no idea why anyone would want to use the \fB-d\fR, \fB-c\fR, and \fB-m\fR options. If someone could explain it to me, I'd like to add this information to this manpage. .SH "ALTERNATIVES" .PP Here are some XML validators on the web: .nf http://www.hcrc.ed.ac.uk/~richard/xml-check.html http://www.stg.brown.edu/service/xmlvalid/ http://www.scripting.com/frontier5/xml/code/xmlValidator.html http://www.xml.com/pub/a/tools/ruwf/check.html .fi .SH "SEE ALSO" .PP .nf The Expat home page: http://www.libexpat.org/ The W3 XML specification: http://www.w3.org/TR/REC-xml .fi .SH "AUTHOR" .PP This manual page was written by Scott Bronson for the Debian GNU/Linux system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1. astropy-0.3/cextern/expat/configure.in0000755000175000017500000001105412243255342016305 0ustar oleolednl configuration script for expat dnl Process this file with autoconf to produce a configure script. dnl dnl Copyright 2000 Clark Cooper dnl dnl This file is part of EXPAT. dnl dnl EXPAT is free software; you can redistribute it and/or modify it dnl under the terms of the License (based on the MIT/X license) contained dnl in the file COPYING that comes with this distribution. dnl dnl Ensure that Expat is configured with autoconf 2.58 or newer AC_PREREQ(2.58) dnl Get the version number of Expat, using m4's esyscmd() command to run dnl the command at m4-generation time. This allows us to create an m4 dnl symbol holding the correct version number. AC_INIT() requires the dnl version number at m4-time, rather than when ./configure is run, so dnl all this must happen as part of m4, not as part of the shell code dnl contained in ./configure. dnl dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate dnl test. I believe this test will work, but I don't have a place with non- dnl GNU M4 to test it right now. define([expat_version], ifdef([__gnu__], [esyscmd(conftools/get-version.sh lib/expat.h)], [2.1.x])) AC_INIT(expat, expat_version, expat-bugs@libexpat.org) undefine([expat_version]) AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_AUX_DIR(conftools) AC_CONFIG_MACRO_DIR([m4]) dnl dnl Increment LIBREVISION if source code has changed at all dnl dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0 dnl dnl If the API changes compatibly (i.e. simply adding a new function dnl without changing or removing earlier interfaces), then increment LIBAGE. dnl dnl If the API changes incompatibly set LIBAGE back to 0 dnl LIBCURRENT=7 LIBREVISION=0 LIBAGE=6 AC_CONFIG_HEADER(expat_config.h) sinclude(conftools/ac_c_bigendian_cross.m4) AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_SUBST(LIBCURRENT) AC_SUBST(LIBREVISION) AC_SUBST(LIBAGE) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL if test "$GCC" = yes ; then dnl dnl Be careful about adding the -fexceptions option; some versions of dnl GCC don't support it and it causes extra warnings that are only dnl distracting; avoid. dnl OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" CFLAGS="$OLDCFLAGS -fexceptions" AC_MSG_CHECKING(whether $CC accepts -fexceptions) AC_TRY_LINK( , , AC_MSG_RESULT(yes), AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS") CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` fi dnl Checks for header files. AC_HEADER_STDC dnl Checks for typedefs, structures, and compiler characteristics. dnl Note: Avoid using AC_C_BIGENDIAN because it does not dnl work in a cross compile. AC_C_BIGENDIAN_CROSS AC_C_CONST AC_TYPE_SIZE_T AC_CHECK_FUNCS(memmove bcopy) dnl Only needed for xmlwf: AC_CHECK_HEADERS(fcntl.h unistd.h) AC_TYPE_OFF_T AC_FUNC_MMAP if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then FILEMAP=unixfilemap else FILEMAP=readfilemap fi AC_SUBST(FILEMAP) dnl Needed for the test support code; this was found at dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html # AC_CPP_FUNC # ------------------ # # Checks to see if ANSI C99 CPP variable __func__ works. # If not, perhaps __FUNCTION__ works instead. # If not, we'll just define __func__ to "". AC_DEFUN([AC_CPP_FUNC], [AC_REQUIRE([AC_PROG_CC_STDC])dnl AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[char *foo = __func__;]])], [ac_cv_cpp_func=yes], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[char *foo = __FUNCTION__;]])], [ac_cv_cpp_func=__FUNCTION__], [ac_cv_cpp_func=no])])]) if test $ac_cv_cpp_func = __FUNCTION__; then AC_DEFINE(__func__,__FUNCTION__, [Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C.]) elif test $ac_cv_cpp_func = no; then AC_DEFINE(__func__,"", [Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C.]) fi ])# AC_CPP_FUNC AC_CPP_FUNC dnl Some basic configuration: AC_DEFINE([XML_NS], 1, [Define to make XML Namespaces functionality available.]) AC_DEFINE([XML_DTD], 1, [Define to make parameter entity parsing functionality available.]) AC_DEFINE([XML_CONTEXT_BYTES], 1024, [Define to specify how much context to retain around the current parse point.]) AC_CONFIG_FILES([Makefile expat.pc]) AC_OUTPUT abs_srcdir="`cd $srcdir && pwd`" abs_builddir="`pwd`" if test "$abs_srcdir" != "$abs_builddir"; then make mkdir-init fi astropy-0.3/cextern/wcslib/0000755000175000017500000000000012243263747014142 5ustar oleoleastropy-0.3/cextern/wcslib/C/0000755000175000017500000000000012243263747014324 5ustar oleoleastropy-0.3/cextern/wcslib/C/wcsutrn.l0000644000175000017500000001455712243255342016212 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsutrn.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical * scanner that translates non-standard FITS units specifications. * * It requires Flex v2.5.4 or later. * * Refer to wcsunits.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ %option full %option never-interactive %option noyywrap %option outfile="wcsutrn.c" %option prefix="wcsutrn" /* Exclusive start states. */ %x NEXT FLUSH %{ /* To get the prototype for fileno() from stdio.h when gcc is invoked with * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */ #define _POSIX_SOURCE 1 #include #include #include #include #include "wcserr.h" #include "wcsunits.h" #define YY_DECL int wcsutrne(int ctrl, char unitstr[], struct wcserr **err) /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsutrn_abort_jmp_env; #define exit(status) longjmp(wcsutrn_abort_jmp_env, status) %} %% static const char *function = "wcsutrne"; char orig[80], subs[80]; int bracket = 0; int unsafe = 0; int status = -1; YY_BUFFER_STATE inbuff; int yylex_destroy(void); if (err) *err = 0x0; *orig = '\0'; *subs = '\0'; inbuff = yy_scan_string(unitstr); *unitstr = '\0'; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsutrn_abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units translator error parsing '%s'", unitstr); } BEGIN(INITIAL); #ifdef DEBUG fprintf(stderr, "\n%s ->\n", unitstr); #endif ^" "*"[" { /* Looks like a keycomment. */ strcat(unitstr, "["); bracket = 1; } " "+ /* Discard leading whitespace. */ [^A-Za-z] { /* Non-alphabetic character. */ strcat(unitstr, yytext); if (bracket && *yytext == ']') { BEGIN(FLUSH); } } angstrom { strcpy(orig, yytext); strcpy(subs, "Angstrom"); BEGIN(NEXT); } arcmins|ARCMINS? { strcpy(orig, yytext); strcpy(subs, "arcmin"); BEGIN(NEXT); } arcsecs|ARCSECS? { strcpy(orig, yytext); strcpy(subs, "arcsec"); BEGIN(NEXT); } BEAM { strcpy(orig, yytext); strcpy(subs, "beam"); BEGIN(NEXT); } Byte { strcpy(orig, yytext); strcpy(subs, "byte"); BEGIN(NEXT); } days?|DAYS? { strcpy(orig, yytext); strcpy(subs, "d"); BEGIN(NEXT); } D { unsafe = 1; strcpy(orig, yytext); strcpy(subs, (ctrl & 4) ? "d" : "D"); BEGIN(NEXT); } degrees?|DEG|DEGREES? { strcpy(orig, yytext); strcpy(subs, "deg"); BEGIN(NEXT); } GHZ { strcpy(orig, yytext); strcpy(subs, "GHz"); BEGIN(NEXT); } hr|HR { strcpy(orig, yytext); strcpy(subs, "h"); BEGIN(NEXT); } H { unsafe = 1; strcpy(orig, yytext); strcpy(subs, (ctrl & 2) ? "h" : "H"); BEGIN(NEXT); } hz|HZ { strcpy(orig, yytext); strcpy(subs, "Hz"); BEGIN(NEXT); } KHZ { strcpy(orig, yytext); strcpy(subs, "kHz"); BEGIN(NEXT); } JY { strcpy(orig, yytext); strcpy(subs, "Jy"); BEGIN(NEXT); } [kK]elvins?|KELVINS? { strcpy(orig, yytext); strcpy(subs, "K"); BEGIN(NEXT); } KM { strcpy(orig, yytext); strcpy(subs, "km"); BEGIN(NEXT); } metres?|meters?|M|METRES?|METERS? { strcpy(orig, yytext); strcpy(subs, "m"); BEGIN(NEXT); } MIN { strcpy(orig, yytext); strcpy(subs, "min"); BEGIN(NEXT); } MHZ { strcpy(orig, yytext); strcpy(subs, "MHz"); BEGIN(NEXT); } Ohm { strcpy(orig, yytext); strcpy(subs, "ohm"); BEGIN(NEXT); } [pP]ascals?|PASCALS? { strcpy(orig, yytext); strcpy(subs, "Pa"); BEGIN(NEXT); } pixels|PIXELS? { strcpy(orig, yytext); strcpy(subs, "pixel"); BEGIN(NEXT); } radians?|RAD|RADIANS? { strcpy(orig, yytext); strcpy(subs, "rad"); BEGIN(NEXT); } sec|seconds?|SEC|SECONDS? { strcpy(orig, yytext); strcpy(subs, "s"); BEGIN(NEXT); } S { unsafe = 1; strcpy(orig, yytext); strcpy(subs, (ctrl & 1) ? "s" : "S"); BEGIN(NEXT); } [vV]olts?|VOLTS? { strcpy(orig, yytext); strcpy(subs, "V"); BEGIN(NEXT); } years?|YR|YEARS? { strcpy(orig, yytext); strcpy(subs, "yr"); BEGIN(NEXT); } [A-Za-z]+ { /* Not a recognized alias. */ strcpy(orig, yytext); strcpy(subs, orig); BEGIN(NEXT); } [A-Za-z]+ { /* Reject the alias match. */ strcat(orig, yytext); strcpy(subs, orig); } " "+[^A-Za-z] { /* Discard separating whitespace. */ unput(yytext[yyleng-1]); } " "+[A-Za-z] { /* Compress separating whitespace. */ strcat(unitstr, subs); strcat(unitstr, " "); if (strcmp(orig, subs)) status = 0; unput(yytext[yyleng-1]); *subs = '\0'; BEGIN(INITIAL); } . { /* Copy anything else unchanged. */ strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; unput(*yytext); *subs = '\0'; BEGIN(INITIAL); } .* { /* Copy out remaining input. */ strcat(unitstr, yytext); } <> { /* End-of-string. */ if (*subs) { strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; } yylex_destroy(); if (unsafe) { return wcserr_set(WCSERR_SET(UNITSERR_UNSAFE_TRANS), "Unsafe unit translation in '%s'", unitstr); } return status; } %% astropy-0.3/cextern/wcslib/C/wcshdr.c0000644000175000017500000007401512243255342015761 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcshdr.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcsutil.h" #include "wcsmath.h" #include "wcshdr.h" #include "tab.h" #include "wcs.h" extern const int WCSSET; /* Map status return value to message. */ const char *wcshdr_errmsg[] = { "Success", "Null wcsprm pointer passed", "Memory allocation failed", "Invalid column selection", "Fatal error returned by Flex parser", "Invalid tabular parameters"}; /* Convenience macro for invoking wcserr_set(). */ #define WCSHDR_ERRMSG(status) WCSERR_SET(status), wcshdr_errmsg[status] static void wcshdo_util(int, const char [], const char [], int, const char [], int, int, int, char, int, int [], char [], const char [], int *, char **, int *); /*--------------------------------------------------------------------------*/ int wcstab(struct wcsprm *wcs) { static const char *function = "wcstab"; char (*PSi_0a)[72] = 0x0, (*PSi_1a)[72] = 0x0, (*PSi_2a)[72] = 0x0; int *PVi_1a = 0x0, *PVi_2a = 0x0, *PVi_3a = 0x0, *tabax, *tabidx = 0x0; int getcrd, i, ip, itab, itabax, j, jtabax, m, naxis, ntabax, status; struct wtbarr *wtbp; struct tabprm *tabp; struct wcserr **err; if (wcs == 0x0) return WCSHDRERR_NULL_POINTER; err = &(wcs->err); /* Free memory previously allocated by wcstab(). */ if (wcs->flag != -1 && wcs->m_flag == WCSSET) { if (wcs->wtb == wcs->m_wtb) wcs->wtb = 0x0; if (wcs->tab == wcs->m_tab) wcs->tab = 0x0; if (wcs->m_wtb) free(wcs->m_wtb); if (wcs->m_tab) { for (j = 0; j < wcs->ntab; j++) { tabfree(wcs->m_tab + j); } free(wcs->m_tab); } } wcs->ntab = 0; wcs->nwtb = 0; wcs->wtb = 0x0; wcs->tab = 0x0; /* Determine the number of -TAB axes. */ naxis = wcs->naxis; if (!(tabax = calloc(naxis, sizeof(int)))) { return wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY)); } ntabax = 0; for (i = 0; i < naxis; i++) { /* Null fill. */ wcsutil_null_fill(72, wcs->ctype[i]); if (!strcmp(wcs->ctype[i]+4, "-TAB")) { tabax[i] = ntabax++; } else { tabax[i] = -1; } } if (ntabax == 0) { /* No lookup tables. */ status = 0; goto cleanup; } /* Collect information from the PSi_ma and PVi_ma keyvalues. */ if (!((PSi_0a = calloc(ntabax, sizeof(char[72]))) && (PVi_1a = calloc(ntabax, sizeof(int))) && (PVi_2a = calloc(ntabax, sizeof(int))) && (PSi_1a = calloc(ntabax, sizeof(char[72]))) && (PSi_2a = calloc(ntabax, sizeof(char[72]))) && (PVi_3a = calloc(ntabax, sizeof(int))) && (tabidx = calloc(ntabax, sizeof(int))))) { status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY)); goto cleanup; } for (itabax = 0; itabax < ntabax; itabax++) { /* Remember that calloc() zeroes allocated memory. */ PVi_1a[itabax] = 1; PVi_2a[itabax] = 1; PVi_3a[itabax] = 1; } for (ip = 0; ip < wcs->nps; ip++) { itabax = tabax[wcs->ps[ip].i - 1]; if (itabax >= 0) { switch (wcs->ps[ip].m) { case 0: /* EXTNAME. */ strcpy(PSi_0a[itabax], wcs->ps[ip].value); wcsutil_null_fill(72, PSi_0a[itabax]); break; case 1: /* TTYPEn for coordinate array. */ strcpy(PSi_1a[itabax], wcs->ps[ip].value); wcsutil_null_fill(72, PSi_1a[itabax]); break; case 2: /* TTYPEn for index vector. */ strcpy(PSi_2a[itabax], wcs->ps[ip].value); wcsutil_null_fill(72, PSi_2a[itabax]); break; } } } for (ip = 0; ip < wcs->npv; ip++) { itabax = tabax[wcs->pv[ip].i - 1]; if (itabax >= 0) { switch (wcs->pv[ip].m) { case 1: /* EXTVER. */ PVi_1a[itabax] = (int)(wcs->pv[ip].value + 0.5); break; case 2: /* EXTLEVEL. */ PVi_2a[itabax] = (int)(wcs->pv[ip].value + 0.5); break; case 3: /* Table axis number. */ PVi_3a[itabax] = (int)(wcs->pv[ip].value + 0.5); break; } } } /* Determine the number of independent tables. */ for (itabax = 0; itabax < ntabax; itabax++) { /* These have no defaults. */ if (!PSi_0a[itabax][0] || !PSi_1a[itabax][0]) { status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS), "Invalid tabular parameters: PSi_0a and PSi_1a must be specified"); goto cleanup; } tabidx[itabax] = -1; for (jtabax = 0; jtabax < i; jtabax++) { /* EXTNAME, EXTVER, EXTLEVEL, and TTYPEn for the coordinate array */ /* must match for each axis of a multi-dimensional lookup table. */ if (strcmp(PSi_0a[itabax], PSi_0a[jtabax]) == 0 && strcmp(PSi_1a[itabax], PSi_1a[jtabax]) == 0 && PVi_1a[itabax] == PVi_1a[jtabax] && PVi_2a[itabax] == PVi_2a[jtabax]) { tabidx[itabax] = tabidx[jtabax]; break; } } if (jtabax == itabax) { tabidx[itabax] = wcs->ntab; wcs->ntab++; } } if (!(wcs->tab = calloc(wcs->ntab, sizeof(struct tabprm)))) { status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY)); goto cleanup; } wcs->m_tab = wcs->tab; /* Table dimensionality; find the largest axis number. */ for (itabax = 0; itabax < ntabax; itabax++) { tabp = wcs->tab + tabidx[itabax]; /* PVi_3a records the 1-relative table axis number. */ if (PVi_3a[itabax] > tabp->M) { tabp->M = PVi_3a[itabax]; } } for (itab = 0; itab < wcs->ntab; itab++) { if ((status = tabini(1, wcs->tab[itab].M, 0, wcs->tab + itab))) { if (status == 3) status = 5; wcserr_set(WCSHDR_ERRMSG(status)); goto cleanup; } } /* Copy parameters into the tabprm structs. */ for (i = 0; i < naxis; i++) { if ((itabax = tabax[i]) < 0) { /* Not a -TAB axis. */ continue; } /* PVi_3a records the 1-relative table axis number. */ m = PVi_3a[itabax] - 1; tabp = wcs->tab + tabidx[itabax]; tabp->map[m] = i; tabp->crval[m] = wcs->crval[i]; } /* Check for completeness. */ for (itab = 0; itab < wcs->ntab; itab++) { for (m = 0; m < wcs->tab[itab].M; m++) { if (wcs->tab[itab].map[m] < 0) { status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS), "Invalid tabular parameters: the axis mapping is undefined"); goto cleanup; } } } /* Set up for reading the arrays; how many arrays are there? */ for (itabax = 0; itabax < ntabax; itabax++) { /* Does this -TAB axis have a non-degenerate index array? */ if (PSi_2a[itabax][0]) { wcs->nwtb++; } } /* Add one coordinate array for each table. */ wcs->nwtb += wcs->ntab; /* Allocate memory for structs to be returned. */ if (!(wcs->wtb = calloc(wcs->nwtb, sizeof(struct wtbarr)))) { wcs->nwtb = 0; status = wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY)); goto cleanup; } wcs->m_wtb = wcs->wtb; /* Set pointers for the index and coordinate arrays. */ wtbp = wcs->wtb; for (itab = 0; itab < wcs->ntab; itab++) { getcrd = 1; for (itabax = 0; itabax < ntabax; itabax++) { if (tabidx[itabax] != itab) continue; if (getcrd) { /* Coordinate array. */ wtbp->i = itabax + 1; wtbp->m = PVi_3a[itabax]; wtbp->kind = 'c'; strcpy(wtbp->extnam, PSi_0a[itabax]); wtbp->extver = PVi_1a[itabax]; wtbp->extlev = PVi_2a[itabax]; strcpy(wtbp->ttype, PSi_1a[itabax]); wtbp->row = 1L; wtbp->ndim = wcs->tab[itab].M + 1; wtbp->dimlen = wcs->tab[itab].K; wtbp->arrayp = &(wcs->tab[itab].coord); /* Signal for tabset() to take this memory. */ wcs->tab[itab].m_coord = (double *)0x1; wtbp++; getcrd = 0; } if (PSi_2a[itabax][0]) { /* Index array. */ wtbp->i = itabax + 1; wtbp->m = PVi_3a[itabax]; wtbp->kind = 'i'; m = wtbp->m - 1; strcpy(wtbp->extnam, PSi_0a[itabax]); wtbp->extver = PVi_1a[itabax]; wtbp->extlev = PVi_2a[itabax]; strcpy(wtbp->ttype, PSi_2a[itabax]); wtbp->row = 1L; wtbp->ndim = 1; wtbp->dimlen = wcs->tab[itab].K + m; wtbp->arrayp = wcs->tab[itab].index + m; /* Signal for tabset() to take this memory. */ wcs->tab[itab].m_indxs[m] = (double *)0x1; wtbp++; } } } status = 0; cleanup: if (tabax) free(tabax); if (tabidx) free(tabidx); if (PSi_0a) free(PSi_0a); if (PVi_1a) free(PVi_1a); if (PVi_2a) free(PVi_2a); if (PSi_1a) free(PSi_1a); if (PSi_2a) free(PSi_2a); if (PVi_3a) free(PVi_3a); if (status) { if (wcs->tab) free(wcs->tab); if (wcs->wtb) free(wcs->wtb); } return status; } /*--------------------------------------------------------------------------*/ int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]) { int a, iwcs; struct wcsprm *wcsp; for (a = 0; a < 27; a++) { alts[a] = -1; } if (wcs == 0x0) { return WCSHDRERR_NULL_POINTER; } wcsp = *wcs; for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { if (wcsp->colnum || wcsp->colax[0]) continue; if (wcsp->alt[0] == ' ') { a = 0; } else { a = wcsp->alt[0] - 'A' + 1; } alts[a] = iwcs; } return 0; } /*--------------------------------------------------------------------------*/ int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]) { short *ip; int a, i, icol, iwcs; struct wcsprm *wcsp; for (ip = alts[0]; ip < alts[0] + 28*1000; ip++) { *ip = -1; } for (icol = 0; icol < 1000; icol++) { alts[icol][27] = 0; } if (wcs == 0x0) { return WCSHDRERR_NULL_POINTER; } wcsp = *wcs; for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { if (wcsp->alt[0] == ' ') { a = 0; } else { a = wcsp->alt[0] - 'A' + 1; } if (type) { /* Pixel list. */ if (wcsp->colax[0]) { for (i = 0; i < wcsp->naxis; i++) { alts[wcsp->colax[i]][a] = iwcs; alts[wcsp->colax[i]][27]++; } } else if (!wcsp->colnum) { alts[0][a] = iwcs; alts[0][27]++; } } else { /* Binary table image array. */ if (wcsp->colnum) { alts[wcsp->colnum][a] = iwcs; alts[wcsp->colnum][27]++; } else if (!wcsp->colax[0]) { alts[0][a] = iwcs; alts[0][27]++; } } } return 0; } /*--------------------------------------------------------------------------*/ int wcsvfree(int *nwcs, struct wcsprm **wcs) { int a, status = 0; struct wcsprm *wcsp; if (wcs == 0x0) { return WCSHDRERR_NULL_POINTER; } wcsp = *wcs; for (a = 0; a < *nwcs; a++, wcsp++) { status |= wcsfree(wcsp); } free(*wcs); *nwcs = 0; *wcs = 0x0; return status; } /*--------------------------------------------------------------------------*/ int wcshdo(int relax, struct wcsprm *wcs, int *nkeyrec, char **header) /* ::: CUBEFACE and STOKES handling? */ { static const char *function = "wcshdo"; char alt, comment[72], keyvalue[72], keyword[16], obsg[8] = "OBSG?", obsgeo[8] = "OBSGEO-?", ptype, xtype, xyz[] = "XYZ"; int bintab, col0, *colax, colnum, i, j, k, naxis, pixlist, primage, status = 0; struct wcserr **err; *nkeyrec = 0; *header = 0x0; if (wcs == 0x0) return WCSHDRERR_NULL_POINTER; err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } if ((naxis = wcs->naxis) == 0) { return 0; } /* These are mainly for convenience. */ alt = wcs->alt[0]; if (alt == ' ') alt = '\0'; colnum = wcs->colnum; colax = wcs->colax; primage = 0; bintab = 0; pixlist = 0; if (colnum) { bintab = 1; col0 = colnum; } else if (colax[0]) { pixlist = 1; col0 = colax[0]; } else { primage = 1; } /* WCS dimension. */ if (!pixlist) { sprintf(keyvalue, "%20d", naxis); wcshdo_util(relax, "WCSAXES", "WCAX", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Number of coordinate axes", nkeyrec, header, &status); } /* Reference pixel coordinates. */ for (j = 0; j < naxis; j++) { wcsutil_double2str(keyvalue, "%20.12G", wcs->crpix[j]); wcshdo_util(relax, "CRPIX", "CRP", WCSHDO_CRPXna, "CRPX", 0, j+1, 0, alt, colnum, colax, keyvalue, "Pixel coordinate of reference point", nkeyrec, header, &status); } /* Linear transformation matrix. */ k = 0; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++, k++) { if (i == j) { if (wcs->pc[k] == 1.0) continue; } else { if (wcs->pc[k] == 0.0) continue; } wcsutil_double2str(keyvalue, "%20.12G", wcs->pc[k]); wcshdo_util(relax, "PC", bintab ? "PC" : "P", WCSHDO_TPCn_ka, bintab ? 0x0 : "PC", i+1, j+1, 0, alt, colnum, colax, keyvalue, "Coordinate transformation matrix element", nkeyrec, header, &status); } } /* Coordinate increment at reference point. */ for (i = 0; i < naxis; i++) { wcsutil_double2str(keyvalue, "%20.12G", wcs->cdelt[i]); comment[0] = '\0'; if (wcs->cunit[i][0]) sprintf(comment, "[%s] ", wcs->cunit[i]); strcat(comment, "Coordinate increment at reference point"); wcshdo_util(relax, "CDELT", "CDE", WCSHDO_CRPXna, "CDLT", i+1, 0, 0, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* Units of coordinate increment and reference value. */ for (i = 0; i < naxis; i++) { if (wcs->cunit[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->cunit[i]); wcshdo_util(relax, "CUNIT", "CUN", WCSHDO_CRPXna, "CUNI", i+1, 0, 0, alt, colnum, colax, keyvalue, "Units of coordinate increment and value", nkeyrec, header, &status); } /* Coordinate type. */ for (i = 0; i < naxis; i++) { if (wcs->ctype[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->ctype[i]); strcpy(comment, "Coordinate type code"); if (i == wcs->lng || i == wcs->lat) { if (strncmp(wcs->ctype[i], "RA--", 4) == 0) { strcpy(comment, "Right ascension, "); } else if (strncmp(wcs->ctype[i], "DEC-", 4) == 0) { strcpy(comment, "Declination, "); } else if (strncmp(wcs->ctype[i]+1, "LON", 3) == 0 || strncmp(wcs->ctype[i]+1, "LAT", 3) == 0) { switch (wcs->ctype[i][0]) { case 'G': strcpy(comment, "galactic "); break; case 'E': strcpy(comment, "ecliptic "); break; case 'H': strcpy(comment, "helioecliptic "); break; case 'S': strcpy(comment, "supergalactic "); break; } if (i == wcs->lng) { strcat(comment, "longitude, "); } else { strcat(comment, "latitude, "); } wcs->ctype[i][0] = toupper(wcs->ctype[i][0]); } strcat(comment, wcs->cel.prj.name); strcat(comment, " projection"); } else if (i == wcs->spec) { spctyp(wcs->ctype[i], 0x0, 0x0, comment, 0x0, &ptype, &xtype, 0x0); if (ptype == xtype) { strcat(comment, " (linear)"); } else { switch (xtype) { case 'F': strcat(comment, " (linear in frequency)"); break; case 'V': strcat(comment, " (linear in velocity)"); break; case 'W': strcat(comment, " (linear in wavelength)"); break; } } } wcshdo_util(relax, "CTYPE", "CTY", WCSHDO_CRPXna, "CTYP", i+1, 0, 0, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* Coordinate value at reference point. */ for (i = 0; i < naxis; i++) { wcsutil_double2str(keyvalue, "%20.12G", wcs->crval[i]); comment[0] = '\0'; if (wcs->cunit[i][0]) sprintf(comment, "[%s] ", wcs->cunit[i]); strcat(comment, "Coordinate value at reference point"); wcshdo_util(relax, "CRVAL", "CRV", WCSHDO_CRPXna, "CRVL", i+1, 0, 0, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* Parameter values. */ for (k = 0; k < wcs->npv; k++) { wcsutil_double2str(keyvalue, "%20.12G", (wcs->pv[k]).value); if ((wcs->pv[k]).i == (wcs->lng + 1)) { switch ((wcs->pv[k]).m) { case 1: strcpy(comment, "[deg] Native longitude of the reference point"); break; case 2: strcpy(comment, "[deg] Native latitude of the reference point"); break; case 3: if (primage) { sprintf(keyword, "LONPOLE%c", alt); } else if (bintab) { sprintf(keyword, "LONP%d%c", colnum, alt); } else { sprintf(keyword, "LONP%d%c", colax[(wcs->pv[k]).i - 1], alt); } sprintf(comment, "[deg] alias for %s (has precedence)", keyword); break; case 4: if (primage) { sprintf(keyword, "LATPOLE%c", alt); } else if (bintab) { sprintf(keyword, "LATP%d%c", colnum, alt); } else { sprintf(keyword, "LATP%d%c", colax[(wcs->pv[k]).i - 1], alt); } sprintf(comment, "[deg] alias for %s (has precedence)", keyword); break; } } else if ((wcs->pv[k]).i == (wcs->lat + 1)) { sprintf(comment, "%s projection parameter", wcs->cel.prj.code); } else { strcpy(comment, "Coordinate transformation parameter"); } wcshdo_util(relax, "PV", "V", WCSHDO_PVn_ma, "PV", wcs->pv[k].i, -1, wcs->pv[k].m, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } for (k = 0; k < wcs->nps; k++) { sprintf(keyvalue, "'%s'", (wcs->ps[k]).value); wcshdo_util(relax, "PS", "S", WCSHDO_PVn_ma, "PS", wcs->ps[k].i, -1, wcs->ps[k].m, alt, colnum, colax, keyvalue, "Coordinate transformation parameter", nkeyrec, header, &status); } /* Celestial and spectral transformation parameters. */ if (!undefined(wcs->lonpole)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->lonpole); wcshdo_util(relax, "LONPOLE", "LONP", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[deg] Native longitude of celestial pole", nkeyrec, header, &status); } if (!undefined(wcs->latpole)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->latpole); wcshdo_util(relax, "LATPOLE", "LATP", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[deg] Native latitude of celestial pole", nkeyrec, header, &status); } if (!undefined(wcs->restfrq)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->restfrq); wcshdo_util(relax, "RESTFRQ", "RFRQ", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[Hz] Line rest frequency", nkeyrec, header, &status); } if (!undefined(wcs->restwav)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->restwav); wcshdo_util(relax, "RESTWAV", "RWAV", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[Hz] Line rest wavelength", nkeyrec, header, &status); } /* Coordinate system title. */ if (wcs->wcsname[0]) { sprintf(keyvalue, "'%s'", wcs->wcsname); if (bintab) { wcshdo_util(relax, "WCSNAME", "WCSN", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Coordinate system title", nkeyrec, header, &status); } else { /* TWCS was a mistake. */ wcshdo_util(relax, "WCSNAME", "TWCS", WCSHDO_WCSNna, "WCSN", 0, 0, 0, alt, colnum, colax, keyvalue, "Coordinate system title", nkeyrec, header, &status); } } /* Coordinate axis title. */ if (wcs->cname) { for (i = 0; i < naxis; i++) { if (wcs->cname[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->cname[i]); wcshdo_util(relax, "CNAME", "CNA", WCSHDO_CNAMna, "CNAM", i+1, 0, 0, alt, colnum, colax, keyvalue, "Axis name for labelling purposes", nkeyrec, header, &status); } } /* Random error in coordinate. */ if (wcs->crder) { for (i = 0; i < naxis; i++) { if (undefined(wcs->crder[i])) continue; wcsutil_double2str(keyvalue, "%20.12G", wcs->crder[i]); comment[0] = '\0'; if (wcs->cunit[i][0]) sprintf(comment, "[%s] ", wcs->cunit[i]); strcat(comment, "Random error in coordinate"); wcshdo_util(relax, "CRDER", "CRD", WCSHDO_CNAMna, "CRDE", i+1, 0, 0, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } } /* Systematic error in coordinate. */ if (wcs->csyer) { for (i = 0; i < naxis; i++) { if (undefined(wcs->csyer[i])) continue; wcsutil_double2str(keyvalue, "%20.12G", wcs->csyer[i]); comment[0] = '\0'; if (wcs->cunit[i][0]) sprintf(comment, "[%s] ", wcs->cunit[i]); strcat(comment, "Systematic error in coordinate"); wcshdo_util(relax, "CSYER", "CSY", WCSHDO_CNAMna, "CSYE", i+1, 0, 0, alt, colnum, colax, keyvalue, comment, nkeyrec, header, &status); } } /* Equatorial coordinate system type. */ if (wcs->radesys[0]) { sprintf(keyvalue, "'%s'", wcs->radesys); wcshdo_util(relax, "RADESYS", "RADE", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Equatorial coordinate system", nkeyrec, header, &status); } /* Equinox of equatorial coordinate system. */ if (!undefined(wcs->equinox)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->equinox); wcshdo_util(relax, "EQUINOX", "EQUI", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[yr] Equinox of equatorial coordinates", nkeyrec, header, &status); } /* Reference frame of spectral coordinates. */ if (wcs->specsys[0]) { sprintf(keyvalue, "'%s'", wcs->specsys); wcshdo_util(relax, "SPECSYS", "SPEC", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Reference frame of spectral coordinates", nkeyrec, header, &status); } /* Reference frame of spectral observation. */ if (wcs->ssysobs[0]) { sprintf(keyvalue, "'%s'", wcs->ssysobs); wcshdo_util(relax, "SSYSOBS", "SOBS", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Reference frame of spectral observation", nkeyrec, header, &status); } /* Observer's velocity towards source. */ if (!undefined(wcs->velosys)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->velosys); wcshdo_util(relax, "VELOSYS", "VSYS", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "[m/s] Velocity towards source", nkeyrec, header, &status); } /* Reference frame of source redshift. */ if (wcs->ssyssrc[0]) { sprintf(keyvalue, "'%s'", wcs->ssyssrc); wcshdo_util(relax, "SSYSSRC", "SSRC", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Reference frame of source redshift", nkeyrec, header, &status); } /* Redshift of the source. */ if (!undefined(wcs->zsource)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->zsource); wcshdo_util(relax, "ZSOURCE", "ZSOU", 0, 0x0, 0, 0, 0, alt, colnum, colax, keyvalue, "Redshift of the source", nkeyrec, header, &status); } /* Observatory coordinates. */ for (k = 0; k < 3; k++) { if (undefined(wcs->obsgeo[k])) continue; wcsutil_double2str(keyvalue, "%20.12G", wcs->obsgeo[k]); sprintf(comment, "[m] ITRF observatory %c-coordinate", xyz[k]); obsgeo[7] = xyz[k]; obsg[4] = xyz[k]; wcshdo_util(relax, obsgeo, obsg, 0, 0x0, 0, 0, 0, ' ', colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* MJD of observation. */ if (!undefined(wcs->mjdobs)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->mjdobs); strcpy(comment, "[d] MJD of observation"); if (wcs->dateobs[0]) { if (primage || (relax & 1) == 0) { sprintf(comment+22, " matching DATE-OBS"); } else { sprintf(comment+22, " matching DOBS%d", col0); } } wcshdo_util(relax, "MJD-OBS", "MJDOB", 0, 0x0, 0, 0, 0, ' ', colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* MJD mid-observation time. */ if (!undefined(wcs->mjdavg)) { wcsutil_double2str(keyvalue, "%20.12G", wcs->mjdavg); strcpy(comment, "[d] MJD mid-observation"); if (wcs->dateavg[0]) { if (primage) { sprintf(comment+23, " matching DATE-AVG"); } else { sprintf(comment+23, " matching DAVG%d", col0); } } wcshdo_util(relax, "MJD-AVG", "MJDA", 0, 0x0, 0, 0, 0, ' ', colnum, colax, keyvalue, comment, nkeyrec, header, &status); } /* ISO-8601 date corresponding to MJD-OBS. */ if (wcs->dateobs[0]) { sprintf(keyvalue, "'%s'", wcs->dateobs); strcpy(comment, "ISO-8601 observation date"); if (!undefined(wcs->mjdobs)) { if (primage) { sprintf(comment+25, " matching MJD-OBS"); } else { sprintf(comment+25, " matching MJDOB%d", col0); } } if (relax & 1) { /* Allow DOBSn. */ wcshdo_util(relax, "DATE-OBS", "DOBS", WCSHDO_DOBSn, 0x0, 0, 0, 0, ' ', colnum, colax, keyvalue, comment, nkeyrec, header, &status); } else { /* Force DATE-OBS. */ wcshdo_util(relax, "DATE-OBS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } } /* ISO-8601 date corresponding to MJD-OBS. */ if (wcs->dateavg[0]) { sprintf(keyvalue, "'%s'", wcs->dateavg); strcpy(comment, "ISO-8601 mid-observation date"); if (!undefined(wcs->mjdavg)) { if (primage) { sprintf(comment+29, " matching MJD-AVG"); } else { sprintf(comment+29, " matching MJDA%d", col0); } } wcshdo_util(relax, "DATE-AVG", "DAVG", 0, 0x0, 0, 0, 0, ' ', colnum, colax, keyvalue, comment, nkeyrec, header, &status); } if (status == WCSHDRERR_MEMORY) { wcserr_set(WCSHDR_ERRMSG(status)); } return status; } /*--------------------------------------------------------------------------*/ void wcshdo_util( int relax, const char pikey[], const char tbkey[], int level, const char tlkey[], int i, int j, int m, char alt, int btcol, int plcol[], char keyvalue[], const char keycomment[], int *nkeyrec, char **header, int *status) { char ch0, ch1, *hptr, keyword[16], *kptr; int nbyte, nc = 47, nv; if (*status) return; /* Reallocate memory in blocks of 2880 bytes. */ if ((*nkeyrec)%32 == 0) { nbyte = ((*nkeyrec)/32 + 1) * 2880; if (!(hptr = realloc(*header, nbyte))) { *status = WCSHDRERR_MEMORY; return; } *header = hptr; } /* Construct the keyword. */ if (alt == ' ') alt = '\0'; if (btcol) { /* Binary table image array. */ if (i > 0 && j) { if (j > 0) { sprintf(keyword, "%d%d%s%d%c", i, j, tbkey, btcol, alt); } else { sprintf(keyword, "%d%s%d_%d%c", i, tbkey, btcol, m, alt); } } else if (i > 0) { sprintf(keyword, "%d%s%d%c", i, tbkey, btcol, alt); } else if (j > 0) { sprintf(keyword, "%d%s%d%c", j, tbkey, btcol, alt); } else { sprintf(keyword, "%s%d%c", tbkey, btcol, alt); } if ((strlen(keyword) < 8) && tlkey && (relax & level)) { /* Use the long form. */ if (i > 0 && j) { if (j > 0) { sprintf(keyword, "%d%d%s%d%c", i, j, tlkey, btcol, alt); } else { sprintf(keyword, "%d%s%d_%d%c", i, tlkey, btcol, m, alt); } } else if (i > 0) { sprintf(keyword, "%d%s%d%c", i, tlkey, btcol, alt); } else if (j > 0) { sprintf(keyword, "%d%s%d%c", j, tlkey, btcol, alt); } else { sprintf(keyword, "%s%d%c", tlkey, btcol, alt); } } } else if (plcol && plcol[0]) { /* Pixel list. */ if (i > 0 && j) { if (j > 0) { sprintf(keyword, "T%s%d_%d%c", tbkey, plcol[i-1], plcol[j-1], alt); } else { sprintf(keyword, "T%s%d_%d%c", tbkey, plcol[i-1], m, alt); } } else if (i > 0) { sprintf(keyword, "T%s%d%c", tbkey, plcol[i-1], alt); } else if (j > 0) { sprintf(keyword, "T%s%d%c", tbkey, plcol[j-1], alt); } else { sprintf(keyword, "%s%d%c", tbkey, plcol[0], alt); } if ((strlen(keyword) < 8) && tlkey && (relax & level)) { /* Use the long form. */ if (i > 0 && j) { if (j > 0) { sprintf(keyword, "T%s%d_%d%c", tlkey, plcol[i-1], plcol[j-1], alt); } else { sprintf(keyword, "T%s%d_%d%c", tlkey, plcol[i-1], m, alt); } } else if (i > 0) { sprintf(keyword, "T%s%d%c", tlkey, plcol[i-1], alt); } else if (j > 0) { sprintf(keyword, "T%s%d%c", tlkey, plcol[j-1], alt); } else { sprintf(keyword, "%s%d%c", tlkey, plcol[0], alt); } } } else { if (i > 0 && j) { if (j > 0) { sprintf(keyword, "%s%d_%d%c", pikey, i, j, alt); } else { sprintf(keyword, "%s%d_%d%c", pikey, i, m, alt); } } else if (i > 0) { sprintf(keyword, "%s%d%c", pikey, i, alt); } else if (j > 0) { sprintf(keyword, "%s%d%c", pikey, j, alt); } else { sprintf(keyword, "%s%c", pikey, alt); } } /* Double-up single-quotes in the keyvalue. */ hptr = keyvalue + 1; while (*hptr) { if (*hptr == '\'') { kptr = hptr++; if (*hptr) { ch0 = *kptr; while (*kptr) { ch1 = *(++kptr); *kptr = ch0; ch0 = ch1; } } } hptr++; } if ((nv = strlen(keyvalue) > 20)) { /* Rob the keycomment to make space for the keyvalue. */ nc -= (nv - 20); } hptr = *header + (80 * ((*nkeyrec)++)); sprintf(hptr, "%-8.8s= %-20s / %-*.*s", keyword, keyvalue, nc, nc, keycomment); } astropy-0.3/cextern/wcslib/C/wcsunits.h0000644000175000017500000004141612243255342016352 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsunits.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * The Flexible Image Transport System (FITS), a data format widely used in * astronomy for data interchange and archive, is described in * * "Definition of The Flexible Image Transport System (FITS)", * Hanisch, R.J., Farris, A., Greisen, E.W., et al. 2001, A&A, 376, 359 * * which formalizes NOST 100-2.0, a document produced by the NASA/Science * Office of Standards and Technology, see http://fits.gsfc.nasa.gov. * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the wcsunits routines * -------------------------------- * Routines in this suite deal with units specifications and conversions: * * - wcsunitse(): given two unit specifications, derive the conversion from * one to the other. * * - wcsutrne(): translates certain commonly used but non-standard unit * strings. It is intended to be called before wcsulexe() which only * handles standard FITS units specifications. * * - wcsulexe(): parses a standard FITS units specification of arbitrary * complexity, deriving the conversion to canonical units. * * * wcsunitse() - FITS units specification conversion * ------------------------------------------------- * wcsunitse() derives the conversion from one system of units to another. * * A deprecated form of this function, wcsunits(), lacks the wcserr** * parameter. * * Given: * have const char [] * FITS units specification to convert from (null- * terminated), with or without surrounding square * brackets (for inline specifications); text following * the closing bracket is ignored. * * want const char [] * FITS units specification to convert to (null- * terminated), with or without surrounding square * brackets (for inline specifications); text following * the closing bracket is ignored. * * Returned: * scale, * offset, * power double* Convert units using * = pow(scale*value + offset, power); * * Normally offset is zero except for log() or ln() * conversions, e.g. "log(MHz)" to "ln(Hz)". Likewise, * power is normally unity except for exp() conversions, * e.g. "exp(ms)" to "exp(/Hz)". Thus conversions * ordinarily consist of * = value *= scale; * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 1-9: Status return from wcsulexe(). * 10: Non-conformant unit specifications. * 11: Non-conformant functions. * * scale is zeroed on return if an error occurs. * * * wcsutrne() - Translation of non-standard unit specifications * ------------------------------------------------------------ * wcsutrne() translates certain commonly used but non-standard unit strings, * e.g. "DEG", "MHZ", "KELVIN", that are not recognized by wcsulexe(), refer to * the notes below for a full list. Compounds are also recognized, e.g. * "JY/BEAM" and "KM/SEC/SEC". Extraneous embedded blanks are removed. * * A deprecated form of this function, wcsutrn(), lacks the wcserr** parameter. * * Given: * ctrl int Although "S" is commonly used to represent seconds, * its translation to "s" is potentially unsafe since the * standard recognizes "S" formally as Siemens, however * rarely that may be used. The same applies to "H" for * hours (Henry), and "D" for days (Debye). This * bit-flag controls what to do in such cases: * 1: Translate "S" to "s". * 2: Translate "H" to "h". * 4: Translate "D" to "d". * Thus ctrl == 0 doesn't do any unsafe translations, * whereas ctrl == 7 does all of them. * * Given and returned: * unitstr char [] Null-terminated character array containing the units * specification to be translated. * * Inline units specifications in the a FITS header * keycomment are also handled. If the first non-blank * character in unitstr is '[' then the unit string is * delimited by its matching ']'. Blanks preceding '[' * will be stripped off, but text following the closing * bracket will be preserved without modification. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * -1: No change was made, other than stripping blanks * (not an error). * 0: Success. * 9: Internal parser error. * 12: Potentially unsafe translation, whether applied * or not (see notes). * * Notes: * Translation of non-standard unit specifications: apart from leading and * trailing blanks, a case-sensitive match is required for the aliases listed * below, in particular the only recognized aliases with metric prefixes are * "KM", "KHZ", "MHZ", and "GHZ". Potentially unsafe translations of "D", * "H", and "S", shown in parentheses, are optional. * = Unit Recognized aliases = ---- ------------------------------------------------------------- = Angstrom angstrom = arcmin arcmins, ARCMIN, ARCMINS = arcsec arcsecs, ARCSEC, ARCSECS = beam BEAM = byte Byte = d day, days, (D), DAY, DAYS = deg degree, degrees, DEG, DEGREE, DEGREES = GHz GHZ = h hr, (H), HR = Hz hz, HZ = kHz KHZ = Jy JY = K kelvin, kelvins, Kelvin, Kelvins, KELVIN, KELVINS = km KM = m metre, meter, metres, meters, M, METRE, METER, METRES, METERS = min MIN = MHz MHZ = Ohm ohm = Pa pascal, pascals, Pascal, Pascals, PASCAL, PASCALS = pixel pixels, PIXEL, PIXELS = rad radian, radians, RAD, RADIAN, RADIANS = s sec, second, seconds, (S), SEC, SECOND, SECONDS = V volt, volts, Volt, Volts, VOLT, VOLTS = yr year, years, YR, YEAR, YEARS * * The aliases "angstrom", "ohm", and "Byte" for (Angstrom, Ohm, and byte) * are recognized by wcsulexe() itself as an unofficial extension of the * standard, but they are converted to the standard form here. * * * wcsulexe() - FITS units specification parser * -------------------------------------------- * wcsulexe() parses a standard FITS units specification of arbitrary * complexity, deriving the scale factor required to convert to canonical * units - basically SI with degrees and "dimensionless" additions such as * byte, pixel and count. * * A deprecated form of this function, wcsulex(), lacks the wcserr** parameter. * * Given: * unitstr const char [] * Null-terminated character array containing the units * specification, with or without surrounding square * brackets (for inline specifications); text following * the closing bracket is ignored. * * Returned: * func int* Special function type, see note 4: * 0: None * 1: log() ...base 10 * 2: ln() ...base e * 3: exp() * * scale double* Scale factor for the unit specification; multiply a * value expressed in the given units by this factor to * convert it to canonical units. * * units double[WCSUNITS_NTYPE] * A units specification is decomposed into powers of 16 * fundamental unit types: angle, mass, length, time, * count, pixel, etc. Preprocessor macro WCSUNITS_NTYPE * is defined to dimension this vector, and others such * WCSUNITS_PLANE_ANGLE, WCSUNITS_LENGTH, etc. to access * its elements. * * Corresponding character strings, wcsunits_types[] and * wcsunits_units[], are predefined to describe each * quantity and its canonical units. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 1: Invalid numeric multiplier. * 2: Dangling binary operator. * 3: Invalid symbol in INITIAL context. * 4: Function in invalid context. * 5: Invalid symbol in EXPON context. * 6: Unbalanced bracket. * 7: Unbalanced parenthesis. * 8: Consecutive binary operators. * 9: Internal parser error. * * scale and units[] are zeroed on return if an error * occurs. * * Notes: * 1: wcsulexe() is permissive in accepting whitespace in all contexts in a * units specification where it does not create ambiguity (e.g. not * between a metric prefix and a basic unit string), including in strings * like "log (m ** 2)" which is formally disallowed. * * 2: Supported extensions: * - "angstrom" (OGIP usage) is allowed in addition to "Angstrom". * - "ohm" (OGIP usage) is allowed in addition to "Ohm". * - "Byte" (common usage) is allowed in addition to "byte". * * 3: Table 6 of WCS Paper I lists eleven units for which metric prefixes are * allowed. However, in this implementation only prefixes greater than * unity are allowed for "a" (annum), "yr" (year), "pc" (parsec), "bit", * and "byte", and only prefixes less than unity are allowed for "mag" * (stellar magnitude). * * Metric prefix "P" (peta) is specifically forbidden for "a" (annum) to * avoid confusion with "Pa" (Pascal, not peta-annum). Note that metric * prefixes are specifically disallowed for "h" (hour) and "d" (day) so * that "ph" (photons) cannot be interpreted as pico-hours, nor "cd" * (candela) as centi-days. * * 4: Function types log(), ln() and exp() may only occur at the start of the * units specification. The scale and units[] returned for these refers * to the string inside the function "argument", e.g. to "MHz" in log(MHz) * for which a scale of 1e6 will be returned. * * * Global variable: const char *wcsunits_errmsg[] - Status return messages * ----------------------------------------------------------------------- * Error messages to match the status value returned from each function. * * * Global variable: const char *wcsunits_types[] - Names of physical quantities * ---------------------------------------------------------------------------- * Names for physical quantities to match the units vector returned by * wcsulexe(): * - 0: plane angle * - 1: solid angle * - 2: charge * - 3: mole * - 4: temperature * - 5: luminous intensity * - 6: mass * - 7: length * - 8: time * - 9: beam * - 10: bin * - 11: bit * - 12: count * - 13: stellar magnitude * - 14: pixel * - 15: solar ratio * - 16: voxel * * * Global variable: const char *wcsunits_units[] - Names of units * -------------------------------------------------------------- * Names for the units (SI) to match the units vector returned by wcsulexe(): * - 0: degree * - 1: steradian * - 2: Coulomb * - 3: mole * - 4: Kelvin * - 5: candela * - 6: kilogram * - 7: metre * - 8: second * * The remainder are dimensionless. *===========================================================================*/ #ifndef WCSLIB_WCSUNITS #define WCSLIB_WCSUNITS #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif extern const char *wcsunits_errmsg[]; enum wcsunits_errmsg_enum { UNITSERR_SUCCESS = 0, /* Success. */ UNITSERR_BAD_NUM_MULTIPLIER = 1, /* Invalid numeric multiplier. */ UNITSERR_DANGLING_BINOP = 2, /* Dangling binary operator. */ UNITSERR_BAD_INITIAL_SYMBOL = 3, /* Invalid symbol in INITIAL context. */ UNITSERR_FUNCTION_CONTEXT = 4, /* Function in invalid context. */ UNITSERR_BAD_EXPON_SYMBOL = 5, /* Invalid symbol in EXPON context. */ UNITSERR_UNBAL_BRACKET = 6, /* Unbalanced bracket. */ UNITSERR_UNBAL_PAREN = 7, /* Unbalanced parenthesis. */ UNITSERR_CONSEC_BINOPS = 8, /* Consecutive binary operators. */ UNITSERR_PARSER_ERROR = 9, /* Internal parser error. */ UNITSERR_BAD_UNIT_SPEC = 10, /* Non-conformant unit specifications. */ UNITSERR_BAD_FUNCS = 11, /* Non-conformant functions. */ UNITSERR_UNSAFE_TRANS = 12 /* Potentially unsafe translation. */ }; extern const char *wcsunits_types[]; extern const char *wcsunits_units[]; #define WCSUNITS_PLANE_ANGLE 0 #define WCSUNITS_SOLID_ANGLE 1 #define WCSUNITS_CHARGE 2 #define WCSUNITS_MOLE 3 #define WCSUNITS_TEMPERATURE 4 #define WCSUNITS_LUMINTEN 5 #define WCSUNITS_MASS 6 #define WCSUNITS_LENGTH 7 #define WCSUNITS_TIME 8 #define WCSUNITS_BEAM 9 #define WCSUNITS_BIN 10 #define WCSUNITS_BIT 11 #define WCSUNITS_COUNT 12 #define WCSUNITS_MAGNITUDE 13 #define WCSUNITS_PIXEL 14 #define WCSUNITS_SOLRATIO 15 #define WCSUNITS_VOXEL 16 #define WCSUNITS_NTYPE 17 int wcsunitse(const char have[], const char want[], double *scale, double *offset, double *power, struct wcserr **err); int wcsutrne(int ctrl, char unitstr[], struct wcserr **err); int wcsulexe(const char unitstr[], int *func, double *scale, double units[WCSUNITS_NTYPE], struct wcserr **err); /* Deprecated. */ int wcsunits(const char have[], const char want[], double *scale, double *offset, double *power); int wcsutrn(int ctrl, char unitstr[]); int wcsulex(const char unitstr[], int *func, double *scale, double units[WCSUNITS_NTYPE]); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSUNITS */ astropy-0.3/cextern/wcslib/C/wcsconfig_tests.h.in0000644000175000017500000000127112243255342020277 0ustar oleole/*============================================================================ * * wcsconfig_test.h is generated from wcsconfig_test.h.in by 'configure'. It * contains C preprocessor definitions for compiling the WCSLIB 4.17 test/demo * programs. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig_tests.h.in,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp $ *===========================================================================*/ #include /* Define to 1 if the CFITSIO library is available. */ #undef HAVE_CFITSIO /* Define to the printf format modifier for size_t type. */ #undef MODZ astropy-0.3/cextern/wcslib/C/getwcstab.c0000644000175000017500000001002412243255342016440 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: getwcstab.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include "getwcstab.h" /*--------------------------------------------------------------------------*/ int fits_read_wcstab( fitsfile *fptr, int nwtb, wtbarr *wtb, int *status) { int anynul, colnum, hdunum, iwtb, m, naxis, nostat; long *naxes = 0, nelem; wtbarr *wtbp; if (*status) return *status; if (fptr == 0) { return (*status = NULL_INPUT_PTR); } if (nwtb == 0) return 0; /* Zero the array pointers. */ wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { *wtbp->arrayp = 0x0; } /* Save HDU number so that we can move back to it later. */ fits_get_hdu_num(fptr, &hdunum); wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { /* Move to the required binary table extension. */ if (fits_movnam_hdu(fptr, BINARY_TBL, (char *)(wtbp->extnam), wtbp->extver, status)) { goto cleanup; } /* Locate the table column. */ if (fits_get_colnum(fptr, CASEINSEN, (char *)(wtbp->ttype), &colnum, status)) { goto cleanup; } /* Get the array dimensions and check for consistency. */ if (wtbp->ndim < 1) { *status = NEG_AXIS; goto cleanup; } if (!(naxes = calloc(wtbp->ndim, sizeof(long)))) { *status = MEMORY_ALLOCATION; goto cleanup; } if (fits_read_tdim(fptr, colnum, wtbp->ndim, &naxis, naxes, status)) { goto cleanup; } if (naxis != wtbp->ndim) { if (wtbp->kind == 'c' && wtbp->ndim == 2) { /* Allow TDIMn to be omitted for degenerate coordinate arrays. */ naxis = 2; naxes[1] = naxes[0]; naxes[0] = 1; } else { *status = BAD_TDIM; goto cleanup; } } if (wtbp->kind == 'c') { /* Coordinate array; calculate the array size. */ nelem = naxes[0]; for (m = 0; m < naxis-1; m++) { *(wtbp->dimlen + m) = naxes[m+1]; nelem *= naxes[m+1]; } } else { /* Index vector; check length. */ if ((nelem = naxes[0]) != *(wtbp->dimlen)) { /* N.B. coordinate array precedes the index vectors. */ *status = BAD_TDIM; goto cleanup; } } free(naxes); naxes = 0; /* Allocate memory for the array. */ if (!(*wtbp->arrayp = calloc((size_t)nelem, sizeof(double)))) { *status = MEMORY_ALLOCATION; goto cleanup; } /* Read the array from the table. */ if (fits_read_col_dbl(fptr, colnum, wtbp->row, 1L, nelem, 0.0, *wtbp->arrayp, &anynul, status)) { goto cleanup; } } cleanup: /* Move back to the starting HDU. */ nostat = 0; fits_movabs_hdu(fptr, hdunum, 0, &nostat); /* Release allocated memory. */ if (naxes) free(naxes); if (*status) { wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { if (*wtbp->arrayp) free(*wtbp->arrayp); } } return *status; } astropy-0.3/cextern/wcslib/C/wcsutil.h0000644000175000017500000002163712243255342016170 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsutil.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * Summary of the wcsutil routines * ------------------------------- * Simple utility functions for internal use only by WCSLIB. They are * documented here solely as an aid to understanding the code. They are not * intended for external use - the API may change without notice! * * * wcsutil_blank_fill() - Fill a character string with blanks * ---------------------------------------------------------- * INTERNAL USE ONLY. * * wcsutil_blank_fill() pads a character string with blanks starting with the * terminating NULL character. * * Used by the Fortran wrapper functions in translating C character strings * into Fortran CHARACTER variables. * * Given: * n int Length of the character array, c[]. * * Given and returned: * c char[] The character string. It will not be null-terminated * on return. * * Function return value: * void * * * wcsutil_null_fill() - Fill a character string with NULLs * -------------------------------------------------------- * INTERNAL USE ONLY. * * wcsutil_null_fill() strips off trailing blanks and pads the character array * holding the string with NULL characters. * * Used mainly to make character strings intelligible in the GNU debugger which * prints the rubbish following the terminating NULL, obscuring the valid part * of the string. * * Given: * n int Number of characters. * * Given and returned: * c char[] The character string. * * Function return value: * void * * * wcsutil_allEq() - Test for equality of a particular vector element * ------------------------------------------------------------------ * INTERNAL USE ONLY. * * wcsutil_allEq() tests for equality of a particular element in a set of * vectors. * * Given: * nvec int The number of vectors. * * nelem int The length of each vector. * * first const double* * Pointer to the first element to test in the array. * The elements tested for equality are * = *first == *(first + nelem) = == *(first + nelem*2) = : = == *(first + nelem*(nvec-1)); * * The array might be dimensioned as * = double v[nvec][nelem]; * * Function return value: * int Status return value: * 0: Not all equal. * 1: All equal. * * * wcsutil_setAll() - Set a particular vector element * -------------------------------------------------- * INTERNAL USE ONLY. * * wcsutil_setAll() sets the value of a particular element in a set of vectors. * * Given: * nvec int The number of vectors. * * nelem int The length of each vector. * * Given and returned: * first double* Pointer to the first element in the array, the value * of which is used to set the others * = *(first + nelem) = *first; = *(first + nelem*2) = *first; = : = *(first + nelem*(nvec-1)) = *first; * * The array might be dimensioned as * = double v[nvec][nelem]; * * Function return value: * void * * * wcsutil_setAli() - Set a particular vector element * -------------------------------------------------- * INTERNAL USE ONLY. * * wcsutil_setAli() sets the value of a particular element in a set of vectors. * * Given: * nvec int The number of vectors. * * nelem int The length of each vector. * * Given and returned: * first int* Pointer to the first element in the array, the value * of which is used to set the others * = *(first + nelem) = *first; = *(first + nelem*2) = *first; = : = *(first + nelem*(nvec-1)) = *first; * * The array might be dimensioned as * = int v[nvec][nelem]; * * Function return value: * void * * * wcsutil_setBit() - Set bits in selected elements of an array * ------------------------------------------------------------ * INTERNAL USE ONLY. * * wcsutil_setBit() sets bits in selected elements of an array. * * Given: * nelem int Number of elements in the array. * * sel const int* * Address of a selection array of length nelem. May * be specified as the null pointer in which case all * elements are selected. * * bits int Bit mask. * * Given and returned: * array int* Address of the array of length nelem. * * Function return value: * void * * * wcsutil_fptr2str() - Translate pointer-to-function to string * ------------------------------------------------------------ * INTERNAL USE ONLY. * * wcsutil_fptr2str() translates a pointer-to-function to hexadecimal string * representation for output. It is used by the various routines that print * the contents of WCSLIB structs, noting that it is not strictly legal to * type-pun a function pointer to void*. See * http://stackoverflow.com/questions/2741683/how-to-format-a-function-pointer * * Given: * fptr int(*)() Pointer to function. * * Returned: * hext char[19] Null-terminated string. Should be at least 19 bytes * in size to accomodate a 64-bit address (16 bytes in * hex), plus the leading "0x" and trailing '\0'. * * Function return value: * char * The address of hext. * * * wcsutil_double2str() - Translate double to string ignoring the locale * --------------------------------------------------------------------- * INTERNAL USE ONLY. * * wcsutil_double2str() converts a double to a string, but unlike sprintf() it * ignores the locale and always uses a '.' as the decimal separator. * * Returned: * buf char * The buffer to write the string into. * * Given: * format char * The formatting directive, such as "%f". This * may be any of the forms accepted by sprintf(), but * should only include a formatting directive and * nothing else. * * value double The value to convert to a string. * * * wcsutil_str2double() - Translate string to a double, ignoring the locale * ------------------------------------------------------------------------ * INTERNAL USE ONLY. * * wcsutil_str2double() converts a string to a double, but unlike sscanf() it * ignores the locale and always expects a '.' as the decimal separator. * * Given: * buf char * The string containing the value * * format char * The formatting directive, such as "%lf". This * may be any of the forms accepted by sscanf(), but * should only include a single formatting directive. * * Returned: * value double * The double value parsed from the string. * *===========================================================================*/ #ifndef WCSLIB_WCSUTIL #define WCSLIB_WCSUTIL #ifdef __cplusplus extern "C" { #endif void wcsutil_blank_fill(int n, char c[]); void wcsutil_null_fill (int n, char c[]); int wcsutil_allEq (int nvec, int nelem, const double *first); void wcsutil_setAll(int nvec, int nelem, double *first); void wcsutil_setAli(int nvec, int nelem, int *first); void wcsutil_setBit(int nelem, const int *sel, int bits, int *array); char *wcsutil_fptr2str(int (*func)(void), char hext[19]); int wcsutil_str2double(const char *buf, const char *format, double *value); void wcsutil_double2str(char *buf, const char *format, double value); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSUTIL */ astropy-0.3/cextern/wcslib/C/wcsunits.c0000644000175000017500000001252412243255342016343 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsunits.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include "wcsunits.h" /* Map status return value to message. */ const char *wcsunits_errmsg[] = { "Success", "Invalid numeric multiplier", "Dangling binary operator", "Invalid symbol in INITIAL context", "Function in invalid context", "Invalid symbol in EXPON context", "Unbalanced bracket", "Unbalanced parenthesis", "Consecutive binary operators", "Internal parser error", "Non-conformant unit specifications", "Non-conformant functions", "Potentially unsafe translation"}; /* Unit types. */ const char *wcsunits_types[] = { "plane angle", "solid angle", "charge", "mole", "temperature", "luminous intensity", "mass", "length", "time", "beam", "bin", "bit", "count", "stellar magnitude", "pixel", "solar ratio", "voxel"}; const char *wcsunits_units[] = { "degree", "steradian", "Coulomb", "mole", "Kelvin", "candela", "kilogram", "metre", "second", "", "", "", "", "", "", "", ""}; const char *wcsunits_funcs[] = { "none", "log", "ln", "exp"}; /*--------------------------------------------------------------------------*/ int wcsunits( const char have[], const char want[], double *scale, double *offset, double *power) { return wcsunitse( have, want, scale, offset, power, 0x0); } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int wcsunitse( const char have[], const char want[], double *scale, double *offset, double *power, struct wcserr **err) { static const char *function = "wcsunitse"; int func1, func2, i, status; double scale1, scale2, units1[WCSUNITS_NTYPE], units2[WCSUNITS_NTYPE]; if ((status = wcsulexe(have, &func1, &scale1, units1, err))) { return status; } if ((status = wcsulexe(want, &func2, &scale2, units2, err))) { return status; } /* Check conformance. */ for (i = 0; i < WCSUNITS_NTYPE; i++) { if (units1[i] != units2[i]) { return wcserr_set(WCSERR_SET(UNITSERR_BAD_UNIT_SPEC), "Mismatched units type '%s': have '%s', want '%s'", wcsunits_types[i], have, want); } } *scale = 0.0; *offset = 0.0; *power = 1.0; switch (func1) { case 0: /* No function. */ if (func2) { return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS), "Mismatched unit functions: have '%s' (%s), want '%s' (%s)", have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]); } *scale = scale1 / scale2; break; case 1: /* log(). */ if (func2 == 1) { /* log(). */ *scale = 1.0; *offset = log10(scale1 / scale2); } else if (func2 == 2) { /* ln(). */ *scale = log(10.0); *offset = log(scale1 / scale2); } else { return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS), "Mismatched unit functions: have '%s' (%s), want '%s' (%s)", have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]); } break; case 2: /* ln(). */ if (func2 == 1) { /* log(). */ *scale = 1.0 / log(10.0); *offset = log(scale1 / scale2); } else if (func2 == 2) { /* ln(). */ *scale = 1.0; *offset = log(scale1 / scale2); } else { return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS), "Mismatched unit functions: have '%s' (%s), want '%s' (%s)", have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]); } break; case 3: /* exp(). */ if (func2 != 3) { return wcserr_set(WCSERR_SET(UNITSERR_BAD_FUNCS), "Mismatched unit functions: have '%s' (%s), want '%s' (%s)", have, wcsunits_funcs[func1], want, wcsunits_funcs[func2]); } *scale = 1.0; *power = scale1 / scale2; break; default: /* Internal parser error. */ return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error"); } return 0; } /*--------------------------------------------------------------------------*/ int wcsutrn(int ctrl, char unitstr[]) { return wcsutrne(ctrl, unitstr, 0x0); } /*--------------------------------------------------------------------------*/ int wcsulex(const char unitstr[], int *func, double *scale, double units[]) { return wcsulexe(unitstr, func, scale, units, 0x0); } astropy-0.3/cextern/wcslib/C/wcstrig.h0000644000175000017500000001371412243255342016155 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcstrig.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * Summary of the wcstrig routines * ------------------------------- * When dealing with celestial coordinate systems and spherical projections * (some moreso than others) it is often desirable to use an angular measure * that provides an exact representation of the latitude of the north or south * pole. The WCSLIB routines use the following trigonometric functions that * take or return angles in degrees: * * - cosd() * - sind() * - tand() * - acosd() * - asind() * - atand() * - atan2d() * - sincosd() * * These "trigd" routines are expected to handle angles that are a multiple of * 90 degrees returning an exact result. Some C implementations provide these * as part of a system library and in such cases it may (or may not!) be * preferable to use them. WCSLIB provides wrappers on the standard trig * functions based on radian measure, adding tests for multiples of 90 degrees. * * However, wcstrig.h also provides the choice of using preprocessor macro * implementations of the trigd functions that don't test for multiples of * 90 degrees (compile with -DWCSTRIG_MACRO). These are typically 20% faster * but may lead to problems near the poles. * * * cosd() - Cosine of an angle in degrees * -------------------------------------- * cosd() returns the cosine of an angle given in degrees. * * Given: * angle double [deg]. * * Function return value: * double Cosine of the angle. * * * sind() - Sine of an angle in degrees * ------------------------------------ * sind() returns the sine of an angle given in degrees. * * Given: * angle double [deg]. * * Function return value: * double Sine of the angle. * * * sincosd() - Sine and cosine of an angle in degrees * -------------------------------------------------- * sincosd() returns the sine and cosine of an angle given in degrees. * * Given: * angle double [deg]. * * Returned: * sin *double Sine of the angle. * * cos *double Cosine of the angle. * * Function return value: * void * * * tand() - Tangent of an angle in degrees * --------------------------------------- * tand() returns the tangent of an angle given in degrees. * * Given: * angle double [deg]. * * Function return value: * double Tangent of the angle. * * * acosd() - Inverse cosine, returning angle in degrees * ---------------------------------------------------- * acosd() returns the inverse cosine in degrees. * * Given: * x double in the range [-1,1]. * * Function return value: * double Inverse cosine of x [deg]. * * * asind() - Inverse sine, returning angle in degrees * -------------------------------------------------- * asind() returns the inverse sine in degrees. * * Given: * y double in the range [-1,1]. * * Function return value: * double Inverse sine of y [deg]. * * * atand() - Inverse tangent, returning angle in degrees * ----------------------------------------------------- * atand() returns the inverse tangent in degrees. * * Given: * s double * * Function return value: * double Inverse tangent of s [deg]. * * * atan2d() - Polar angle of (x,y), in degrees * ------------------------------------------- * atan2d() returns the polar angle, beta, in degrees, of polar coordinates * (rho,beta) corresponding Cartesian coordinates (x,y). It is equivalent to * the arg(x,y) function of WCS Paper II, though with transposed arguments. * * Given: * y double Cartesian y-coordinate. * * x double Cartesian x-coordinate. * * Function return value: * double Polar angle of (x,y) [deg]. * *===========================================================================*/ #ifndef WCSLIB_WCSTRIG #define WCSLIB_WCSTRIG #include #include "wcsconfig.h" #ifdef HAVE_SINCOS void sincos(double angle, double *sin, double *cos); #endif #ifdef __cplusplus extern "C" { #endif #ifdef WCSTRIG_MACRO /* Macro implementation of the trigd functions. */ #include "wcsmath.h" #define cosd(X) cos((X)*D2R) #define sind(X) sin((X)*D2R) #define tand(X) tan((X)*D2R) #define acosd(X) acos(X)*R2D #define asind(X) asin(X)*R2D #define atand(X) atan(X)*R2D #define atan2d(Y,X) atan2(Y,X)*R2D #ifdef HAVE_SINCOS #define sincosd(X,S,C) sincos((X)*D2R,(S),(C)) #else #define sincosd(X,S,C) *(S) = sin((X)*D2R); *(C) = cos((X)*D2R); #endif #else /* Use WCSLIB wrappers or native trigd functions. */ double cosd(double angle); double sind(double angle); void sincosd(double angle, double *sin, double *cos); double tand(double angle); double acosd(double x); double asind(double y); double atand(double s); double atan2d(double y, double x); /* Domain tolerance for asin() and acos() functions. */ #define WCSTRIG_TOL 1e-10 #endif /* WCSTRIG_MACRO */ #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSTRIG */ astropy-0.3/cextern/wcslib/C/wcspih.l0000644000175000017500000006274112243255342016000 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcspih.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical * scanner for parsing the WCS keyrecords from a FITS primary image or image * extension header. * * wcspih.l requires Flex v2.5.4 or later. Refer to wcshdr.h for a description * of the user interface and operating notes. * * Implementation notes * -------------------- * Use of the WCSAXESa keyword is not mandatory. Its default value is "the * larger of NAXIS and the largest index of these keywords [i.e. CRPIXj, PCi_j * or CDi_j, CDELTi, CTYPEi, CRVALi, and CUNITi] found in the FITS header". * Consequently the definition of WCSAXESa effectively invalidates the use of * NAXIS for determining the number of coordinate axes and forces a preliminary * pass through the header to determine the "largest index" in headers where * WCSAXESa was omitted. * * Furthermore, since the use of WCSAXESa is optional, there is no way to * determine the number of coordinate representations (the "a" value) other * than by parsing all of the WCS keywords in the header; even if WCSAXESa was * specified for some representations it cannot be known in advance whether it * was specified for all of those present in the header. * * Hence the definition of WCSAXESa forces the scanner to be implemented in two * passes. The first pass is used to determine the number of coordinate * representations (up to 27) and the number of coordinate axes in each. * Effectively WCSAXESa is ignored unless it exceeds the "largest index" in * which case the keywords for the extra axes assume their default values. The * number of PVi_ma and PSi_ma keywords in each representation is also counted * in the first pass. * * On completion of the first pass, memory is allocated for an array of the * required number of wcsprm structs and each of these is initialized * appropriately. These structs are filled in the second pass. * * The parser does not check for duplicated keywords, it accepts the last * encountered. * *===========================================================================*/ /* Options. */ %option full %option never-interactive %option noyywrap %option outfile="wcspih.c" %option prefix="wcspih" /* Indices for parameterized keywords. */ I0 [0-9] I1 [1-9] I2 [1-9][0-9] I3 [1-9][0-9]{2} I4 [1-9][0-9]{3} /* Alternate coordinate system identifier. */ ALT [ A-Z] /* Keyvalue data types. */ INTEGER [+-]?[0-9]+ FLOAT [+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)? STRING '([^']|'')*' /* Exclusive start states. */ %x CROTAi PROJPn %x CCCCCia CCi_ja CCi_ma CCCCCCCa CCCCCCCC %x VALUE %x INTEGER_VAL FLOAT_VAL STRING_VAL %x COMMENT %x DISCARD ERROR FLUSH %{ #include #include #include #include #include #include "wcs.h" #include "wcshdr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcsutil.h" #define INTEGER 0 #define FLOAT 1 #define STRING 2 #define YY_DECL int wcspih(char *header, int nkeyrec, int relax, int ctrl, \ int *nreject, int *nwcs, struct wcsprm **wcs) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (wcspih_nkeyrec) { \ strncpy(inbuff, wcspih_hdr, 80); \ inbuff[80] = '\n'; \ wcspih_hdr += 80; \ wcspih_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* These global variables are required by YY_INPUT. */ char *wcspih_hdr; int wcspih_nkeyrec; int wcspih_final(int alts[], double epoch[], double vsource[], int *nwcs, struct wcsprm **wcs); int wcspih_inits(int naxis, int alts[], int npv[], int nps[], int *nwcs, struct wcsprm **wcs); void wcspih_naxes(int naxis, int i, int j, char a, int alts[], int *npptr); /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcspih_abort_jmp_env; #define exit(status) longjmp(wcspih_abort_jmp_env, status) %} %% /* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */ char a; int i, j, m; char *cptr, *errmsg, errtxt[80], *hptr, *keep; int altlin, alts[27], ialt, idx, ipx, ix, jx, naxis, *npptr, nps[27], npv[27], pass, status, valtype, voff; double epoch[27], vsource[27]; void *vptr, *wptr; struct wcsprm *wcsp; int yylex_destroy(void); naxis = 0; for (ialt = 0; ialt < 27; ialt++) { alts[ialt] = 0; npv[ialt] = 0; nps[ialt] = 0; epoch[ialt] = UNDEFINED; vsource[ialt] = UNDEFINED; } /* Parameters used to implement YY_INPUT. */ wcspih_hdr = header; wcspih_nkeyrec = nkeyrec; /* Our handle on the input stream. */ hptr = header; keep = 0x0; *nreject = 0; /* Keyword parameters. */ i = j = m = 0; a = ' '; /* For decoding the keyvalue. */ valtype = -1; idx = -1; vptr = 0x0; /* For keywords that require special handling. */ altlin = 0; npptr = 0x0; /* The data structures produced. */ *nwcs = 0; *wcs = 0x0; pass = 1; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcspih_abort_jmp_env)) { return 3; } BEGIN(INITIAL); ^NAXIS" = "" "*{INTEGER} { if (pass == 1) { sscanf(yytext, "NAXIS = %d", &naxis); } if (naxis < 0) { errmsg = errtxt; sprintf(errmsg, "Negative value of NAXIS ignored: %d", naxis); naxis = 0; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^WCSAXES{ALT}=" "" "*{INTEGER} { if (pass == 1) { sscanf(yytext, "WCSAXES%c= %d", &a, &i); wcspih_naxes(naxis, i, 0, a, alts, 0); } BEGIN(FLUSH); } ^CRPIX { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crpix); BEGIN(CCCCCia); } ^PC { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pc); altlin = 1; BEGIN(CCi_ja); } ^CD { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->cd); altlin = 2; BEGIN(CCi_ja); } ^CDELT { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->cdelt); BEGIN(CCCCCia); } ^CROTA { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crota); altlin = 4; BEGIN(CROTAi); } ^CUNIT { valtype = STRING; if (pass == 2) vptr = &((*wcs)->cunit); BEGIN(CCCCCia); } ^CTYPE { valtype = STRING; if (pass == 2) vptr = &((*wcs)->ctype); BEGIN(CCCCCia); } ^CRVAL { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crval); BEGIN(CCCCCia); } ^LONPOLE { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->lonpole); BEGIN(CCCCCCCa); } ^LATPOLE { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->latpole); BEGIN(CCCCCCCa); } ^RESTFRQ { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restfrq); BEGIN(CCCCCCCa); } ^RESTFREQ { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restfrq); unput(' '); BEGIN(CCCCCCCa); } ^RESTWAV { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restwav); BEGIN(CCCCCCCa); } ^PV { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pv); npptr = npv; BEGIN(CCi_ma); } ^PROJP { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pv); npptr = npv; BEGIN(PROJPn); } ^PS { valtype = STRING; if (pass == 2) vptr = &((*wcs)->ps); npptr = nps; BEGIN(CCi_ma); } ^CNAME { valtype = STRING; if (pass == 2) vptr = &((*wcs)->cname); BEGIN(CCCCCia); } ^CRDER { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crder); BEGIN(CCCCCia); } ^CSYER { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->csyer); BEGIN(CCCCCia); } ^DATE-AVG { valtype = STRING; if (pass == 2) vptr = (*wcs)->dateavg; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^DATE-OBS { valtype = STRING; if (pass == 2) vptr = (*wcs)->dateobs; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^EPOCH{ALT}" " { sscanf(yytext, "EPOCH%c", &a); if (a == ' ' || relax & WCSHDR_EPOCHa) { valtype = FLOAT; if (pass == 2) { vptr = epoch; if (a >= 'A') { vptr = (void *)((double *)vptr + alts[a-'A'+1]); } } unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "EPOCH keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^EQUINOX { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->equinox); BEGIN(CCCCCCCa); } ^MJD-AVG" " { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->mjdavg); if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^MJD-OBS" " { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->mjdobs); if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^OBSGEO-X { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^OBSGEO-Y { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo + 1; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^OBSGEO-Z { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo + 2; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } ^RADESYS { valtype = STRING; if (pass == 2) vptr = (*wcs)->radesys; BEGIN(CCCCCCCa); } ^RADECSYS { if (relax & WCSHDR_RADECSYS) { valtype = STRING; if (pass == 2) vptr = (*wcs)->radesys; unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "RADECSYS is non-standard, use RADESYSa"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^SPECSYS { valtype = STRING; if (pass == 2) vptr = (*wcs)->specsys; BEGIN(CCCCCCCa); } ^SSYSOBS { valtype = STRING; if (pass == 2) vptr = (*wcs)->ssysobs; BEGIN(CCCCCCCa); } ^SSYSSRC { valtype = STRING; if (pass == 2) vptr = (*wcs)->ssyssrc; BEGIN(CCCCCCCa); } ^VELANGL { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->velangl); BEGIN(CCCCCCCa); } ^VELOSYS { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->velosys); BEGIN(CCCCCCCa); } ^VELREF{ALT}" " { sscanf(yytext, "VELREF%c", &a); if (a == ' ' || relax & WCSHDR_VELREFa) { valtype = INTEGER; if (pass == 2) vptr = &((*wcs)->velref); unput(a); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "VELREF keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^VSOURCE{ALT} { sscanf(yytext, "VSOURCE%c", &a); if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; if (pass == 2) { vptr = vsource; if (a >= 'A') { vptr = (void *)((double *)vptr + alts[a-'A'+1]); } } unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "Deprecated VSOURCEa keyword rejected"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^WCSNAME { valtype = STRING; if (pass == 2) vptr = (*wcs)->wcsname; BEGIN(CCCCCCCa); } ^ZSOURCE { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->zsource); BEGIN(CCCCCCCa); } ^END" "{77} { yyless(0); if (wcspih_nkeyrec) { wcspih_nkeyrec = 0; errmsg = "Keyrecords following the END keyrecord were ignored"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^. { BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT} { sscanf(yytext, "%d%c", &i, &a); idx = i - 1; BEGIN(VALUE); } {I3} { /* Invalid axis number will be caught by . */ sscanf(yytext, "%3d", &i); BEGIN(VALUE); } . { BEGIN(DISCARD); } {I1}_{I1}{ALT}" " | {I1}_{I2}{ALT}" " | {I2}_{I1}{ALT}" " | {I2}_{I2}{ALT} { sscanf(yytext, "%d_%d%c", &i, &j, &a); if (pass == 2) { wcsp = *wcs; if (a != ' ') { wcsp += alts[a-'A'+1]; } idx = (i-1)*(wcsp->naxis) + j - 1; } BEGIN(VALUE); } {I1}_{I3}{ALT} | {I3}_{I1}{ALT} | {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I1} { /* Invalid axis numbers will be caught by . */ sscanf(yytext, "%d_%d", &i, &j); BEGIN(VALUE); } {I0}{6} { /* This covers the defunct forms CD00i00j and PC00i00j. */ if (((relax & WCSHDR_PC00i00j) && (altlin == 1)) || ((relax & WCSHDR_CD00i00j) && (altlin == 2))) { sscanf(yytext, "%3d%3d", &i, &j); a = ' '; if (pass == 2) { idx = (i-1)*((*wcs)->naxis) + j - 1; } BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Defunct form of %si_ja keyword", (altlin==1) ? "PC" : "CD"); BEGIN(ERROR); } else { BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT} { sscanf(yytext, "%d%c", &i, &a); if (a == ' ' || relax & WCSHDR_CROTAia) { idx = i - 1; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "CROTAn keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } {I3} { sscanf(yytext, "%d", &i); a = ' '; idx = i - 1; BEGIN(VALUE); } . { BEGIN(DISCARD); } {ALT} | . { idx = -1; if (YY_START == CCCCCCCa) { sscanf(yytext, "%c", &a); } else { unput(yytext[0]); a = 0; } BEGIN(VALUE); } . { BEGIN(DISCARD); } {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT}" " | {I2}_{I0}{ALT}" " | {I2}_{I2}{ALT} { sscanf(yytext, "%d_%d%c", &i, &m, &a); idx = -1; BEGIN(VALUE); } {I1}_{I3}{ALT} | {I3}_{I0}{ALT} | {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I0} { /* Invalid parameters will be caught by . */ sscanf(yytext, "%d_%d", &i, &m); BEGIN(VALUE); } . { BEGIN(DISCARD); } {I0}" " { if (relax & WCSHDR_PROJPn) { sscanf(yytext, "%d", &m); i = 0; a = ' '; idx = -1; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "Defunct PROJPn keyword rejected"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } . { BEGIN(DISCARD); } =" "+ { /* Do checks on i, j & m. */ if (i > 99 || j > 99 || m > 99) { if (relax & WCSHDR_reject) { errmsg = errtxt; if (i > 99 || j > 99) { sprintf(errmsg, "Axis number exceeds 99"); } else if (m > 99) { sprintf(errmsg, "Parameter number exceeds 99"); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } else { if (valtype == INTEGER) { BEGIN(INTEGER_VAL); } else if (valtype == FLOAT) { BEGIN(FLOAT_VAL); } else if (valtype == STRING) { BEGIN(STRING_VAL); } else { errmsg = errtxt; sprintf(errmsg, "Internal parser ERROR, bad data type: %d", valtype); BEGIN(ERROR); } } } . { errmsg = "Invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); } {INTEGER} { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords that apply */ /* to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((int **)wptr) + idx; } /* Read the keyvalue. */ sscanf(yytext, "%d", (int *)wptr); if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null int pointer"; BEGIN(ERROR); } } } . { errmsg = "An integer value was expected"; BEGIN(ERROR); } {FLOAT} { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords like MJD-OBS that */ /* apply to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((double **)wptr) + idx; } else if (npptr == npv) { ipx = (*wcs+ialt)->npv++; (*wcs+ialt)->pv[ipx].i = i; (*wcs+ialt)->pv[ipx].m = m; wptr = &((*wcs+ialt)->pv[ipx].value); } /* Read the keyvalue. */ wcsutil_str2double(yytext, "%lf", (double *)wptr); /* Flag the presence of PCi_ja, or CDi_ja and/or CROTAia. */ if (altlin) { (*wcs+ialt)->altlin |= altlin; altlin = 0; } if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null float pointer"; BEGIN(ERROR); } } } . { errmsg = "A floating-point value was expected"; BEGIN(ERROR); } {STRING} { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords like DATE-OBS that */ /* apply to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((char (**)[72])wptr) + idx; } else if (npptr == nps) { ipx = (*wcs+ialt)->nps++; (*wcs+ialt)->ps[ipx].i = i; (*wcs+ialt)->ps[ipx].m = m; wptr = (*wcs+ialt)->ps[ipx].value; } /* Read the keyvalue. */ cptr = (char *)wptr; strcpy(cptr, yytext+1); /* Squeeze out repeated quotes. */ ix = 0; for (jx = 0; jx < 72; jx++) { if (ix < jx) { cptr[ix] = cptr[jx]; } if (cptr[jx] == '\0') { if (ix) cptr[ix-1] = '\0'; break; } else if (cptr[jx] == '\'' && cptr[jx+1] == '\'') { jx++; } ix++; } if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null string pointer"; BEGIN(ERROR); } } } . { errmsg = "A string value was expected"; BEGIN(ERROR); } " "*\/.* | " "* { BEGIN(FLUSH); } . { errmsg = "Malformed keycomment"; BEGIN(ERROR); } .* { if (pass == 2) { if (ctrl < 0) { /* Preserve discards. */ keep = wcspih_hdr - 80; } else if (ctrl > 2) { wcsfprintf(stderr, "%.80s\n Discarded.\n", wcspih_hdr-80); } } BEGIN(FLUSH); } .* { (*nreject)++; if (pass == 2) { if (ctrl%10 == -1) { /* Preserve rejects. */ keep = wcspih_hdr - 80; } if (abs(ctrl%10) > 1) { wcsfprintf(stderr, "%.80s\n%4d: %s.\n", wcspih_hdr-80, *nreject, errmsg); } } BEGIN(FLUSH); } .*\n { if (pass == 2 && keep) { if (hptr < keep) { strncpy(hptr, keep, 80); } hptr += 80; } i = j = m = 0; a = ' '; valtype = -1; keep = 0x0; altlin = 0; npptr = 0x0; BEGIN(INITIAL); } <> { /* End-of-input. */ if (pass == 1) { if ((status = wcspih_inits(naxis, alts, npv, nps, nwcs, wcs)) || *nwcs == 0) { yylex_destroy(); return status; } if (abs(ctrl%10) > 2) { if (*nwcs == 1) { if (strcmp(wcs[0]->wcsname, "DEFAULTS") != 0) { wcsfprintf(stderr, "Found one coordinate representation.\n"); } } else { wcsfprintf(stderr, "Found %d coordinate representations.\n", *nwcs); } } wcspih_hdr = header; wcspih_nkeyrec = nkeyrec; *nreject = 0; pass = 2; i = j = m = 0; a = ' '; valtype = -1; yyrestart(yyin); } else { yylex_destroy(); if (ctrl < 0) { *hptr = '\0'; } else if (ctrl == 1) { wcsfprintf(stderr, "%d WCS keyrecords were rejected.\n", *nreject); } return wcspih_final(alts, epoch, vsource, nwcs, wcs); } } %% /*---------------------------------------------------------------------------- * Determine the number of coordinate representations (up to 27) and the * number of coordinate axes in each, and count the number of PVi_ma and * PSi_ma keywords in each representation. *---------------------------------------------------------------------------*/ void wcspih_naxes(int naxis, int i, int j, char a, int alts[], int *npptr) { /* On the first pass alts[] is used to determine the number of axes */ /* for each of the 27 possible alternate coordinate descriptions. */ int ialt, *ip; if (a == 0) { return; } ialt = 0; if (a != ' ') { ialt = a - 'A' + 1; } ip = alts + ialt; if (*ip < naxis) { *ip = naxis; } /* i or j can be greater than naxis. */ if (*ip < i) { *ip = i; } if (*ip < j) { *ip = j; } if (npptr) { npptr[ialt]++; } } /*---------------------------------------------------------------------------- * Allocate memory for an array of the required number of wcsprm structs and * initialize each of them. *---------------------------------------------------------------------------*/ int wcspih_inits( int naxis, int alts[], int npv[], int nps[], int *nwcs, struct wcsprm **wcs) { int ialt, defaults, npsmax, npvmax, status = 0; struct wcsprm *wcsp; /* Find the number of coordinate descriptions. */ *nwcs = 0; for (ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) (*nwcs)++; } if ((defaults = !(*nwcs) && naxis)) { /* NAXIS is non-zero but there were no WCS keywords with an alternate version code; create a default WCS with blank alternate version. */ wcspih_naxes(naxis, 0, 0, ' ', alts, 0x0); *nwcs = 1; } if (*nwcs) { /* Allocate memory for the required number of wcsprm structs. */ if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { return 2; } /* Record the current values of NPVMAX and NPSMAX. */ npvmax = wcsnpv(-1); npsmax = wcsnps(-1); /* Initialize each wcsprm struct. */ wcsp = *wcs; *nwcs = 0; for (ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) { wcsp->flag = -1; wcsnpv(npv[ialt]); wcsnps(nps[ialt]); if ((status = wcsini(1, alts[ialt], wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record in wcsname whether this is a default description. */ if (defaults) { strcpy(wcsp->wcsname, "DEFAULTS"); } /* On the second pass alts[] indexes the array of wcsprm structs. */ alts[ialt] = (*nwcs)++; wcsp++; } } /* Restore the original values of NPVMAX and NPSMAX. */ wcsnpv(npvmax); wcsnps(npsmax); } return status; } /*---------------------------------------------------------------------------- * Interpret special keywords encountered for each coordinate representation. *---------------------------------------------------------------------------*/ int wcspih_final( int alts[], double epoch[], double vsource[], int *nwcs, struct wcsprm **wcs) { int ialt, status; double beta, c = 299792458.0; for (ialt = 0; ialt < *nwcs; ialt++) { /* Check for EPOCH overriding EQUINOXa. */ if (undefined((*wcs+ialt)->equinox) && !undefined(epoch[ialt])) { /* Set EQUINOXa. */ (*wcs+ialt)->equinox = epoch[ialt]; } /* Check for VSOURCEa overriding ZSOURCEa. */ if (undefined((*wcs+ialt)->zsource) && !undefined(vsource[ialt])) { /* Convert relativistic Doppler velocity to redshift. */ beta = vsource[ialt]/c; (*wcs+ialt)->zsource = (1.0+beta)/sqrt(1.0 - beta*beta) - 1.0; } /* Interpret -TAB header keywords. */ if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; } } return 0; } astropy-0.3/cextern/wcslib/C/wcserr.c0000644000175000017500000000722712243255342015775 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcserr.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsprintf.h" static int wcserr_enabled = 0; /*--------------------------------------------------------------------------*/ int wcserr_enable(int enable) { return wcserr_enabled = (enable ? 1 : 0); } /*--------------------------------------------------------------------------*/ int wcserr_prt( const struct wcserr *err, const char *prefix) { if (!wcserr_enabled) { wcsprintf("Error messaging is not enabled, use wcserr_enable().\n"); return 2; } if (err == 0x0) { return 0; } if (err->status) { if (prefix == 0x0) prefix = ""; if (err->status > 0) { wcsprintf("%sERROR %d in %s() at line %d of file %s:\n%s%s.\n", prefix, err->status, err->function, err->line_no, err->file, prefix, err->msg); } else { /* An informative message only. */ wcsprintf("%sINFORMATIVE message from %s() at line %d of file " "%s:\n%s%s.\n", prefix, err->function, err->line_no, err->file, prefix, err->msg); } } return 0; } /*--------------------------------------------------------------------------*/ int wcserr_clear( struct wcserr **errp) { if (*errp) free(*errp); *errp = 0x0; return 0; } /*--------------------------------------------------------------------------*/ int wcserr_set( struct wcserr **errp, int status, const char *function, const char *file, int line_no, const char *format, ...) { char fmt[128]; struct wcserr *err; va_list argp; if (!wcserr_enabled) return status; if (errp == 0x0) { return status; } err = *errp; if (status) { if (err == 0x0) { *errp = err = calloc(1, sizeof(struct wcserr)); } err->status = status; err->function = function; err->file = file; err->line_no = line_no; /* Workaround for a compiler segv from gcc 4.2.1 in MacOSX 10.7. */ strncpy(fmt, format, 128); va_start(argp, format); vsnprintf(err->msg, WCSERR_MSG_LENGTH, fmt, argp); va_end(argp); } else if (err) { free(err); *errp = 0x0; } return status; } /*--------------------------------------------------------------------------*/ int wcserr_copy( const struct wcserr *src, struct wcserr *dst) { if (src == 0x0) { if (dst) { memset(dst, 0, sizeof(struct wcserr)); } return 0; } if (dst) { memcpy(dst, src, sizeof(struct wcserr)); } return src->status; } astropy-0.3/cextern/wcslib/C/sph.c0000644000175000017500000002553112243255342015260 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: sph.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include "wcstrig.h" #include "sph.h" #define copysign(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X)) #define tol 1.0e-5 /*--------------------------------------------------------------------------*/ int sphx2s( const double eul[5], int nphi, int ntheta, int spt, int sll, const double phi[], const double theta[], double lng[], double lat[]) { int mphi, mtheta, rowlen, rowoff; double cosphi, costhe, costhe3, costhe4, dlng, dphi, sinphi, sinthe, sinthe3, sinthe4, x, y, z; register int iphi, itheta; register const double *phip, *thetap; register double *latp, *lngp; if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Check for a simple change in origin of longitude. */ if (eul[4] == 0.0) { if (eul[1] == 0.0) { dlng = fmod(eul[0] + 180.0 - eul[2], 360.0); lngp = lng; latp = lat; phip = phi; thetap = theta; for (itheta = 0; itheta < ntheta; itheta++) { for (iphi = 0; iphi < mphi; iphi++) { *lngp = *phip + dlng; *latp = *thetap; /* Normalize the celestial longitude. */ if (eul[0] >= 0.0) { if (*lngp < 0.0) *lngp += 360.0; } else { if (*lngp > 0.0) *lngp -= 360.0; } if (*lngp > 360.0) { *lngp -= 360.0; } else if (*lngp < -360.0) { *lngp += 360.0; } lngp += sll; latp += sll; phip += spt; thetap += spt; } } } else { dlng = fmod(eul[0] + eul[2], 360.0); lngp = lng; latp = lat; phip = phi; thetap = theta; for (itheta = 0; itheta < ntheta; itheta++) { for (iphi = 0; iphi < mphi; iphi++) { *lngp = dlng - *phip; *latp = -(*thetap); /* Normalize the celestial longitude. */ if (eul[0] >= 0.0) { if (*lngp < 0.0) *lngp += 360.0; } else { if (*lngp > 0.0) *lngp -= 360.0; } if (*lngp > 360.0) { *lngp -= 360.0; } else if (*lngp < -360.0) { *lngp += 360.0; } lngp += sll; latp += sll; phip += spt; thetap += spt; } } } return 0; } /* Do phi dependency. */ phip = phi; rowoff = 0; rowlen = nphi*sll; for (iphi = 0; iphi < nphi; iphi++, rowoff += sll, phip += spt) { dphi = *phip - eul[2]; lngp = lng + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *lngp = dphi; lngp += rowlen; } } /* Do theta dependency. */ thetap = theta; lngp = lng; latp = lat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); costhe3 = costhe*eul[3]; costhe4 = costhe*eul[4]; sinthe3 = sinthe*eul[3]; sinthe4 = sinthe*eul[4]; for (iphi = 0; iphi < mphi; iphi++, lngp += sll, latp += sll) { dphi = *lngp; sincosd(dphi, &sinphi, &cosphi); /* Compute the celestial longitude. */ x = sinthe4 - costhe3*cosphi; if (fabs(x) < tol) { /* Rearrange formula to reduce roundoff errors. */ x = -cosd(*thetap + eul[1]) + costhe3*(1.0 - cosphi); } y = -costhe*sinphi; if (x != 0.0 || y != 0.0) { dlng = atan2d(y, x); } else { /* Change of origin of longitude. */ if (eul[1] < 90.0) { dlng = dphi + 180.0; } else { dlng = -dphi; } } *lngp = eul[0] + dlng; /* Normalize the celestial longitude. */ if (eul[0] >= 0.0) { if (*lngp < 0.0) *lngp += 360.0; } else { if (*lngp > 0.0) *lngp -= 360.0; } if (*lngp > 360.0) { *lngp -= 360.0; } else if (*lngp < -360.0) { *lngp += 360.0; } /* Compute the celestial latitude. */ if (fmod(dphi,180.0) == 0.0) { *latp = *thetap + cosphi*eul[1]; if (*latp > 90.0) *latp = 180.0 - *latp; if (*latp < -90.0) *latp = -180.0 - *latp; } else { z = sinthe3 + costhe4*cosphi; if (fabs(z) > 0.99) { /* Use an alternative formula for greater accuracy. */ *latp = copysign(acosd(sqrt(x*x+y*y)), z); } else { *latp = asind(z); } } } } return 0; } /*--------------------------------------------------------------------------*/ int sphs2x( const double eul[5], int nlng, int nlat, int sll, int spt, const double lng[], const double lat[], double phi[], double theta[]) { int mlat, mlng, rowlen, rowoff; double coslat, coslat3, coslat4, coslng, dlng, dphi, sinlat, sinlat3, sinlat4, sinlng, x, y, z; register int ilat, ilng; register const double *latp, *lngp; register double *phip, *thetap; if (nlat > 0) { mlng = nlng; mlat = nlat; } else { mlng = 1; mlat = 1; nlat = nlng; } /* Check for a simple change in origin of longitude. */ if (eul[4] == 0.0) { if (eul[1] == 0.0) { dphi = fmod(eul[2] - 180.0 - eul[0], 360.0); lngp = lng; latp = lat; phip = phi; thetap = theta; for (ilat = 0; ilat < nlat; ilat++) { for (ilng = 0; ilng < mlng; ilng++) { *phip = fmod(*lngp + dphi, 360.0); *thetap = *latp; /* Normalize the native longitude. */ if (*phip > 180.0) { *phip -= 360.0; } else if (*phip < -180.0) { *phip += 360.0; } phip += spt; thetap += spt; lngp += sll; latp += sll; } } } else { dphi = fmod(eul[2] + eul[0], 360.0); lngp = lng; latp = lat; phip = phi; thetap = theta; for (ilat = 0; ilat < nlat; ilat++) { for (ilng = 0; ilng < mlng; ilng++) { *phip = fmod(dphi - *lngp, 360.0); *thetap = -(*latp); /* Normalize the native longitude. */ if (*phip > 180.0) { *phip -= 360.0; } else if (*phip < -180.0) { *phip += 360.0; } phip += spt; thetap += spt; lngp += sll; latp += sll; } } } return 0; } /* Do lng dependency. */ lngp = lng; rowoff = 0; rowlen = nlng*spt; for (ilng = 0; ilng < nlng; ilng++, rowoff += spt, lngp += sll) { dlng = *lngp - eul[0]; phip = phi + rowoff; thetap = theta; for (ilat = 0; ilat < mlat; ilat++) { *phip = dlng; phip += rowlen; } } /* Do lat dependency. */ latp = lat; phip = phi; thetap = theta; for (ilat = 0; ilat < nlat; ilat++, latp += sll) { sincosd(*latp, &sinlat, &coslat); coslat3 = coslat*eul[3]; coslat4 = coslat*eul[4]; sinlat3 = sinlat*eul[3]; sinlat4 = sinlat*eul[4]; for (ilng = 0; ilng < mlng; ilng++, phip += spt, thetap += spt) { dlng = *phip; sincosd(dlng, &sinlng, &coslng); /* Compute the native longitude. */ x = sinlat4 - coslat3*coslng; if (fabs(x) < tol) { /* Rearrange formula to reduce roundoff errors. */ x = -cosd(*latp+eul[1]) + coslat3*(1.0 - coslng); } y = -coslat*sinlng; if (x != 0.0 || y != 0.0) { dphi = atan2d(y, x); } else { /* Change of origin of longitude. */ if (eul[1] < 90.0) { dphi = dlng - 180.0; } else { dphi = -dlng; } } *phip = fmod(eul[2] + dphi, 360.0); /* Normalize the native longitude. */ if (*phip > 180.0) { *phip -= 360.0; } else if (*phip < -180.0) { *phip += 360.0; } /* Compute the native latitude. */ if (fmod(dlng,180.0) == 0.0) { *thetap = *latp + coslng*eul[1]; if (*thetap > 90.0) *thetap = 180.0 - *thetap; if (*thetap < -90.0) *thetap = -180.0 - *thetap; } else { z = sinlat3 + coslat4*coslng; if (fabs(z) > 0.99) { /* Use an alternative formula for greater accuracy. */ *thetap = copysign(acosd(sqrt(x*x+y*y)), z); } else { *thetap = asind(z); } } } } return 0; } /*--------------------------------------------------------------------------*/ int sphdpa( int nfield, double lng0, double lat0, const double lng[], const double lat[], double dist[], double pa[]) { int i; double eul[5]; /* Set the Euler angles for the coordinate transformation. */ eul[0] = lng0; eul[1] = 90.0 - lat0; eul[2] = 0.0; eul[3] = cosd(eul[1]); eul[4] = sind(eul[1]); /* Transform field points to the new system. */ sphs2x(eul, nfield, 0, 1, 1, lng, lat, pa, dist); for (i = 0; i < nfield; i++) { /* Angular distance is obtained from latitude in the new frame. */ dist[i] = 90.0 - dist[i]; /* Position angle is obtained from longitude in the new frame. */ pa[i] = -pa[i]; if (pa[i] < -180.0) pa[i] += 360.0; } return 0; } /*--------------------------------------------------------------------------*/ int sphpad( int nfield, double lng0, double lat0, const double dist[], const double pa[], double lng[], double lat[]) { int i; double eul[5]; /* Set the Euler angles for the coordinate transformation. */ eul[0] = lng0; eul[1] = 90.0 - lat0; eul[2] = 0.0; eul[3] = cosd(eul[1]); eul[4] = sind(eul[1]); for (i = 0; i < nfield; i++) { /* Latitude in the new frame is obtained from angular distance. */ lat[i] = 90.0 - dist[i]; /* Longitude in the new frame is obtained from position angle. */ lng[i] = -pa[i]; } /* Transform field points to the old system. */ sphx2s(eul, nfield, 0, 1, 1, lng, lat, lng, lat); return 0; } astropy-0.3/cextern/wcslib/C/fitshdr.h0000644000175000017500000004267312243255342016144 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: fitshdr.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * The Flexible Image Transport System (FITS), a data format widely used in * astronomy for data interchange and archive, is described in * * "Definition of The Flexible Image Transport System (FITS)", * Hanisch, R.J., Farris, A., Greisen, E.W., et al. 2001, A&A, 376, 359 * * which formalizes NOST 100-2.0, a document produced by the NASA/Science * Office of Standards and Technology, see http://fits.gsfc.nasa.gov. * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the fitshdr routines * ------------------------------- * fitshdr() is a generic FITS header parser provided to handle keyrecords that * are ignored by the WCS header parsers, wcspih() and wcsbth(). Typically the * latter may be set to remove WCS keyrecords from a header leaving fitshdr() * to handle the remainder. * * * fitshdr() - FITS header parser routine * -------------------------------------- * fitshdr() parses a character array containing a FITS header, extracting * all keywords and their values into an array of fitskey structs. * * Given: * header const char [] * Character array containing the (entire) FITS header, * for example, as might be obtained conveniently via the * CFITSIO routine fits_hdr2str(). * * Each header "keyrecord" (formerly "card image") * consists of exactly 80 7-bit ASCII printing characters * in the range 0x20 to 0x7e (which excludes NUL, BS, * TAB, LF, FF and CR) especially noting that the * keyrecords are NOT null-terminated. * * nkeyrec int Number of keyrecords in header[]. * * nkeyids int Number of entries in keyids[]. * * Given and returned: * keyids struct fitskeyid [] * While all keywords are extracted from the header, * keyids[] provides a convienient way of indexing them. * The fitskeyid struct contains three members; * fitskeyid::name must be set by the user while * fitskeyid::count and fitskeyid::name are returned by * fitshdr(). All matched keywords will have their * fitskey::keyno member negated. * * Returned: * nreject int* Number of header keyrecords rejected for syntax * errors. * * keys struct fitskey** * Pointer to an array of nkeyrec fitskey structs * containing all keywords and keyvalues extracted from * the header. * * Memory for the array is allocated by fitshdr() and * this must be freed by the user by invoking free() on * the array. * * Function return value: * int Status return value: * 0: Success. * 1: Null fitskey pointer passed. * 2: Memory allocation failed. * 3: Fatal error returned by Flex parser. * * Notes: * 1: Keyword parsing is done in accordance with the syntax defined by * NOST 100-2.0, noting the following points in particular: * * a: Sect. 5.1.2.1 specifies that keywords be left-justified in columns * 1-8, blank-filled with no embedded spaces, composed only of the * ASCII characters ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789-_ * * fitshdr() accepts any characters in columns 1-8 but flags keywords * that do not conform to standard syntax. * * b: Sect. 5.1.2.2 defines the "value indicator" as the characters "= " * occurring in columns 9 and 10. If these are absent then the * keyword has no value and columns 9-80 may contain any ASCII text * (but see note 2 for CONTINUE keyrecords). This is copied to the * comment member of the fitskey struct. * * c: Sect. 5.1.2.3 states that a keyword may have a null (undefined) * value if the value/comment field, columns 11-80, consists entirely * of spaces, possibly followed by a comment. * * d: Sect. 5.1.1 states that trailing blanks in a string keyvalue are * not significant and the parser always removes them. A string * containing nothing but blanks will be replaced with a single * blank. * * Sect. 5.2.1 also states that a quote character (') in a string * value is to be represented by two successive quote characters and * the parser removes the repeated quote. * * e: The parser recognizes free-format character (NOST 100-2.0, * Sect. 5.2.1), integer (Sect. 5.2.3), and floating-point values * (Sect. 5.2.4) for all keywords. * * f: Sect. 5.2.3 offers no comment on the size of an integer keyvalue * except indirectly in limiting it to 70 digits. The parser will * translates an integer keyvalue to a 32-bit signed integer if it * lies in the range -2147483648 to +2147483647, otherwise it * interprets it as a 64-bit signed integer if possible, or else a * "very long" integer (see fitskey::type). * * g: END not followed by 77 blanks is not considered to be a legitimate * end keyrecord. * * 2: The parser supports a generalization of the OGIP Long String Keyvalue * Convention (v1.0) whereby strings may be continued onto successive * header keyrecords. A keyrecord contains a segment of a continued * string if and only if * * a: it contains the pseudo-keyword CONTINUE, * * b: columns 9 and 10 are both blank, * * c: columns 11 to 80 contain what would be considered a valid string * keyvalue, including optional keycomment, if column 9 had contained * '=', * * d: the previous keyrecord contained either a valid string keyvalue or * a valid CONTINUE keyrecord. * * If any of these conditions is violated, the keyrecord is considered in * isolation. * * Syntax errors in keycomments in a continued string are treated more * permissively than usual; the '/' delimiter may be omitted provided that * parsing of the string keyvalue is not compromised. However, the * FITSHDR_COMMENT status bit will be set for the keyrecord (see * fitskey::status). * * As for normal strings, trailing blanks in a continued string are not * significant. * * In the OGIP convention "the '&' character is used as the last non-blank * character of the string to indicate that the string is (probably) * continued on the following keyword". This additional syntax is not * required by fitshdr(), but if '&' does occur as the last non-blank * character of a continued string keyvalue then it will be removed, along * with any trailing blanks. However, blanks that occur before the '&' * will be preserved. * * * fitskeyid struct - Keyword indexing * ----------------------------------- * fitshdr() uses the fitskeyid struct to return indexing information for * specified keywords. The struct contains three members, the first of which, * fitskeyid::name, must be set by the user with the remainder returned by * fitshdr(). * * char name[12]: * (Given) Name of the required keyword. This is to be set by the user; * the '.' character may be used for wildcarding. Trailing blanks will be * replaced with nulls. * * int count: * (Returned) The number of matches found for the keyword. * * int idx[2]: * (Returned) Indices into keys[], the array of fitskey structs returned by * fitshdr(). Note that these are 0-relative array indices, not keyrecord * numbers. * * If the keyword is found in the header the first index will be set to the * array index of its first occurrence, otherwise it will be set to -1. * * If multiples of the keyword are found, the second index will be set to * the array index of its last occurrence, otherwise it will be set to -1. * * * fitskey struct - Keyword/value information * ------------------------------------------ * fitshdr() returns an array of fitskey structs, each of which contains the * result of parsing one FITS header keyrecord. All members of the fitskey * struct are returned by fitshdr(), none are given by the user. * * int keyno * (Returned) Keyrecord number (1-relative) in the array passed as input to * fitshdr(). This will be negated if the keyword matched any specified in * the keyids[] index. * * int keyid * (Returned) Index into the first entry in keyids[] with which the * keyrecord matches, else -1. * * int status * (Returned) Status flag bit-vector for the header keyrecord employing the * following bit masks defined as preprocessor macros: * * - FITSHDR_KEYWORD: Illegal keyword syntax. * - FITSHDR_KEYVALUE: Illegal keyvalue syntax. * - FITSHDR_COMMENT: Illegal keycomment syntax. * - FITSHDR_KEYREC: Illegal keyrecord, e.g. an END keyrecord with * trailing text. * - FITSHDR_TRAILER: Keyrecord following a valid END keyrecord. * * The header keyrecord is syntactically correct if no bits are set. * * char keyword[12] * (Returned) Keyword name, null-filled for keywords of less than eight * characters (trailing blanks replaced by nulls). * * Use * = sprintf(dst, "%.8s", keyword) * * to copy it to a character array with null-termination, or * = sprintf(dst, "%8.8s", keyword) * * to blank-fill to eight characters followed by null-termination. * * int type * (Returned) Keyvalue data type: * - 0: No keyvalue. * - 1: Logical, represented as int. * - 2: 32-bit signed integer. * - 3: 64-bit signed integer (see below). * - 4: Very long integer (see below). * - 5: Floating point (stored as double). * - 6: Integer complex (stored as double[2]). * - 7: Floating point complex (stored as double[2]). * - 8: String. * - 8+10*n: Continued string (described below and in fitshdr() note 2). * * A negative type indicates that a syntax error was encountered when * attempting to parse a keyvalue of the particular type. * * Comments on particular data types: * - 64-bit signed integers lie in the range * = (-9223372036854775808 <= int64 < -2147483648) || = (+2147483647 < int64 <= +9223372036854775807) * * A native 64-bit data type may be defined via preprocessor macro * WCSLIB_INT64 defined in wcsconfig.h, e.g. as 'long long int'; this * will be typedef'd to 'int64' here. If WCSLIB_INT64 is not set, then * int64 is typedef'd to int[3] instead and fitskey::keyvalue is to be * computed as * = ((keyvalue.k[2]) * 1000000000 + = keyvalue.k[1]) * 1000000000 + = keyvalue.k[0] * * and may reported via * = if (keyvalue.k[2]) { = printf("%d%09d%09d", keyvalue.k[2], abs(keyvalue.k[1]), = abs(keyvalue.k[0])); = } else { = printf("%d%09d", keyvalue.k[1], abs(keyvalue.k[0])); = } * * where keyvalue.k[0] and keyvalue.k[1] range from -999999999 to * +999999999. * * - Very long integers, up to 70 decimal digits in length, are encoded * in keyvalue.l as an array of int[8], each of which stores 9 decimal * digits. fitskey::keyvalue is to be computed as * = (((((((keyvalue.l[7]) * 1000000000 + = keyvalue.l[6]) * 1000000000 + = keyvalue.l[5]) * 1000000000 + = keyvalue.l[4]) * 1000000000 + = keyvalue.l[3]) * 1000000000 + = keyvalue.l[2]) * 1000000000 + = keyvalue.l[1]) * 1000000000 + = keyvalue.l[0] * * - Continued strings are not reconstructed, they remain split over * successive fitskey structs in the keys[] array returned by * fitshdr(). fitskey::keyvalue data type, 8 + 10n, indicates the * segment number, n, in the continuation. * * int padding * (An unused variable inserted for alignment purposes only.) * * union keyvalue * (Returned) A union comprised of * * - fitskey::i, * - fitskey::k, * - fitskey::l, * - fitskey::f, * - fitskey::c, * - fitskey::s, * * used by the fitskey struct to contain the value associated with a * keyword. * * int i * (Returned) Logical (fitskey::type == 1) and 32-bit signed integer * (fitskey::type == 2) data types in the fitskey::keyvalue union. * * int64 k * (Returned) 64-bit signed integer (fitskey::type == 3) data type in the * fitskey::keyvalue union. * * int l[8] * (Returned) Very long integer (fitskey::type == 4) data type in the * fitskey::keyvalue union. * * double f * (Returned) Floating point (fitskey::type == 5) data type in the * fitskey::keyvalue union. * * double c[2] * (Returned) Integer and floating point complex (fitskey::type == 6 || 7) * data types in the fitskey::keyvalue union. * * char s[72] * (Returned) Null-terminated string (fitskey::type == 8) data type in the * fitskey::keyvalue union. * * int ulen * (Returned) Where a keycomment contains a units string in the standard * form, e.g. [m/s], the ulen member indicates its length, inclusive of * square brackets. Otherwise ulen is zero. * * char comment[84] * (Returned) Keycomment, i.e. comment associated with the keyword or, for * keyrecords rejected because of syntax errors, the compete keyrecord * itself with null-termination. * * Comments are null-terminated with trailing spaces removed. Leading * spaces are also removed from keycomments (i.e. those immediately * following the '/' character), but not from COMMENT or HISTORY keyrecords * or keyrecords without a value indicator ("= " in columns 9-80). * * * Global variable: const char *fitshdr_errmsg[] - Status return messages * ---------------------------------------------------------------------- * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_FITSHDR #define WCSLIB_FITSHDR #include "wcsconfig.h" #ifdef __cplusplus extern "C" { #endif #define FITSHDR_KEYWORD 0x01 #define FITSHDR_KEYVALUE 0x02 #define FITSHDR_COMMENT 0x04 #define FITSHDR_KEYREC 0x08 #define FITSHDR_CARD 0x08 /* Alias for backwards compatibility. */ #define FITSHDR_TRAILER 0x10 extern const char *fitshdr_errmsg[]; #ifdef WCSLIB_INT64 typedef WCSLIB_INT64 int64; #else typedef int int64[3]; #endif /* Struct used for indexing the keywords. */ struct fitskeyid { char name[12]; /* Keyword name, null-terminated. */ int count; /* Number of occurrences of keyword. */ int idx[2]; /* Indices into fitskey array. */ }; /* Size of the fitskeyid struct in int units, used by the Fortran wrappers. */ #define KEYIDLEN (sizeof(struct fitskeyid)/sizeof(int)) /* Struct used for storing FITS keywords. */ struct fitskey { int keyno; /* Header keyrecord sequence number (1-rel).*/ int keyid; /* Index into fitskeyid[]. */ int status; /* Header keyrecord status bit flags. */ char keyword[12]; /* Keyword name, null-filled. */ int type; /* Keyvalue type (see above). */ int padding; /* (Dummy inserted for alignment purposes.) */ union { int i; /* 32-bit integer and logical values. */ int64 k; /* 64-bit integer values. */ int l[8]; /* Very long signed integer values. */ double f; /* Floating point values. */ double c[2]; /* Complex values. */ char s[72]; /* String values, null-terminated. */ } keyvalue; /* Keyvalue. */ int ulen; /* Length of units string. */ char comment[84]; /* Comment (or keyrecord), null-terminated. */ }; /* Size of the fitskey struct in int units, used by the Fortran wrappers. */ #define KEYLEN (sizeof(struct fitskey)/sizeof(int)) int fitshdr(const char header[], int nkeyrec, int nkeyids, struct fitskeyid keyids[], int *nreject, struct fitskey **keys); #ifdef __cplusplus } #endif #endif /* WCSLIB_FITSHDR */ astropy-0.3/cextern/wcslib/C/wcstrig.c0000644000175000017500000001021712243255342016143 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcstrig.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include "wcsmath.h" #include "wcstrig.h" double cosd(angle) double angle; { int i; if (fmod(angle,90.0) == 0.0) { i = abs((int)floor(angle/90.0 + 0.5))%4; switch (i) { case 0: return 1.0; case 1: return 0.0; case 2: return -1.0; case 3: return 0.0; } } return cos(angle*D2R); } /*--------------------------------------------------------------------------*/ double sind(angle) double angle; { int i; if (fmod(angle,90.0) == 0.0) { i = abs((int)floor(angle/90.0 - 0.5))%4; switch (i) { case 0: return 1.0; case 1: return 0.0; case 2: return -1.0; case 3: return 0.0; } } return sin(angle*D2R); } /*--------------------------------------------------------------------------*/ void sincosd(double angle, double *s, double *c) { int i; if (fmod(angle,90.0) == 0.0) { i = abs((int)floor(angle/90.0 + 0.5))%4; switch (i) { case 0: *s = 0.0; *c = 1.0; return; case 1: *s = (angle > 0.0) ? 1.0 : -1.0; *c = 0.0; return; case 2: *s = 0.0; *c = -1.0; return; case 3: *s = (angle > 0.0) ? -1.0 : 1.0; *c = 0.0; return; } } #ifdef HAVE_SINCOS sincos(angle*D2R, s, c); #else *s = sin(angle*D2R); *c = cos(angle*D2R); #endif return; } /*--------------------------------------------------------------------------*/ double tand(angle) double angle; { double resid; resid = fmod(angle,360.0); if (resid == 0.0 || fabs(resid) == 180.0) { return 0.0; } else if (resid == 45.0 || resid == 225.0) { return 1.0; } else if (resid == -135.0 || resid == -315.0) { return -1.0; } return tan(angle*D2R); } /*--------------------------------------------------------------------------*/ double acosd(v) double v; { if (v >= 1.0) { if (v-1.0 < WCSTRIG_TOL) return 0.0; } else if (v == 0.0) { return 90.0; } else if (v <= -1.0) { if (v+1.0 > -WCSTRIG_TOL) return 180.0; } return acos(v)*R2D; } /*--------------------------------------------------------------------------*/ double asind(v) double v; { if (v <= -1.0) { if (v+1.0 > -WCSTRIG_TOL) return -90.0; } else if (v == 0.0) { return 0.0; } else if (v >= 1.0) { if (v-1.0 < WCSTRIG_TOL) return 90.0; } return asin(v)*R2D; } /*--------------------------------------------------------------------------*/ double atand(v) double v; { if (v == -1.0) { return -45.0; } else if (v == 0.0) { return 0.0; } else if (v == 1.0) { return 45.0; } return atan(v)*R2D; } /*--------------------------------------------------------------------------*/ double atan2d(y, x) double x, y; { if (y == 0.0) { if (x >= 0.0) { return 0.0; } else if (x < 0.0) { return 180.0; } } else if (x == 0.0) { if (y > 0.0) { return 90.0; } else if (y < 0.0) { return -90.0; } } return atan2(y,x)*R2D; } astropy-0.3/cextern/wcslib/C/wcsmath.h0000644000175000017500000000351212243255342016134 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsmath.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * Summary of wcsmath.h * -------------------- * Definition of mathematical constants used by WCSLIB. * *===========================================================================*/ #ifndef WCSLIB_WCSMATH #define WCSLIB_WCSMATH #ifdef PI #undef PI #endif #ifdef D2R #undef D2R #endif #ifdef R2D #undef R2D #endif #ifdef SQRT2 #undef SQRT2 #endif #ifdef SQRT2INV #undef SQRT2INV #endif #define PI 3.141592653589793238462643 #define D2R PI/180.0 #define R2D 180.0/PI #define SQRT2 1.4142135623730950488 #define SQRT2INV 1.0/SQRT2 #ifdef UNDEFINED #undef UNDEFINED #endif #define UNDEFINED 987654321.0e99 #define undefined(value) (value == UNDEFINED) #endif /* WCSLIB_WCSMATH */ astropy-0.3/cextern/wcslib/C/prj.h0000644000175000017500000006620712243255342015273 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: prj.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the spherical map projections * recognized by the FITS World Coordinate System (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the prj routines * --------------------------- * These routines implement the spherical map projections defined by the FITS * WCS standard. They are based on the prjprm struct which contains all * information needed for the computations. The struct contains some members * that must be set by the user, and others that are maintained by these * routines, somewhat like a C++ class but with no encapsulation. * * Routine prjini() is provided to initialize the prjprm struct with default * values, prjfree() reclaims any memory that may have been allocated to store * an error message, and prjprt() prints its contents. * * Setup routines for each projection with names of the form ???set(), where * "???" is the down-cased three-letter projection code, compute intermediate * values in the prjprm struct from parameters in it that were supplied by the * user. The struct always needs to be set by the projection's setup routine * but that need not be called explicitly - refer to the explanation of * prjprm::flag. * * Each map projection is implemented via separate functions for the spherical * projection, ???s2x(), and deprojection, ???x2s(). * * A set of driver routines, prjset(), prjx2s(), and prjs2x(), provides a * generic interface to the specific projection routines which they invoke * via pointers-to-functions stored in the prjprm struct. * * In summary, the routines are: * - prjini() Initialization routine for the prjprm struct. * - prjprt() Routine to print the prjprm struct. * * - prjset(), prjx2s(), prjs2x(): Generic driver routines * * - azpset(), azpx2s(), azps2x(): AZP (zenithal/azimuthal perspective) * - szpset(), szpx2s(), szps2x(): SZP (slant zenithal perspective) * - tanset(), tanx2s(), tans2x(): TAN (gnomonic) * - stgset(), stgx2s(), stgs2x(): STG (stereographic) * - sinset(), sinx2s(), sins2x(): SIN (orthographic/synthesis) * - arcset(), arcx2s(), arcs2x(): ARC (zenithal/azimuthal equidistant) * - zpnset(), zpnx2s(), zpns2x(): ZPN (zenithal/azimuthal polynomial) * - zeaset(), zeax2s(), zeas2x(): ZEA (zenithal/azimuthal equal area) * - airset(), airx2s(), airs2x(): AIR (Airy) * - cypset(), cypx2s(), cyps2x(): CYP (cylindrical perspective) * - ceaset(), ceax2s(), ceas2x(): CEA (cylindrical equal area) * - carset(), carx2s(), cars2x(): CAR (Plate carree) * - merset(), merx2s(), mers2x(): MER (Mercator) * - sflset(), sflx2s(), sfls2x(): SFL (Sanson-Flamsteed) * - parset(), parx2s(), pars2x(): PAR (parabolic) * - molset(), molx2s(), mols2x(): MOL (Mollweide) * - aitset(), aitx2s(), aits2x(): AIT (Hammer-Aitoff) * - copset(), copx2s(), cops2x(): COP (conic perspective) * - coeset(), coex2s(), coes2x(): COE (conic equal area) * - codset(), codx2s(), cods2x(): COD (conic equidistant) * - cooset(), coox2s(), coos2x(): COO (conic orthomorphic) * - bonset(), bonx2s(), bons2x(): BON (Bonne) * - pcoset(), pcox2s(), pcos2x(): PCO (polyconic) * - tscset(), tscx2s(), tscs2x(): TSC (tangential spherical cube) * - cscset(), cscx2s(), cscs2x(): CSC (COBE spherical cube) * - qscset(), qscx2s(), qscs2x(): QSC (quadrilateralized spherical cube) * - hpxset(), hpxx2s(), hpxs2x(): HPX (HEALPix) * - xphset(), xphx2s(), xphs2x(): XPH (HEALPix polar, aka "butterfly") * * Argument checking (projection routines): * ---------------------------------------- * The values of phi and theta (the native longitude and latitude) normally lie * in the range [-180,180] for phi, and [-90,90] for theta. However, all * projection routines will accept any value of phi and will not normalize it. * * The projection routines do not explicitly check that theta lies within the * range [-90,90]. They do check for any value of theta that produces an * invalid argument to the projection equations (e.g. leading to division by * zero). The projection routines for AZP, SZP, TAN, SIN, ZPN, and COP also * return error 2 if (phi,theta) corresponds to the overlapped (far) side of * the projection but also return the corresponding value of (x,y). This * strict bounds checking may be relaxed at any time by setting prjprm::bounds * to 0 (rather than 1); the projections need not be reinitialized. * * Argument checking (deprojection routines): * ------------------------------------------ * Error checking on the projected coordinates (x,y) is limited to that * required to ascertain whether a solution exists. Where a solution does * exist no check is made that the value of phi and theta obtained lie within * the ranges [-180,180] for phi, and [-90,90] for theta. * * Accuracy: * --------- * No warranty is given for the accuracy of these routines (refer to the * copyright notice); intending users must satisfy for themselves their * adequacy for the intended purpose. However, closure to a precision of at * least 1E-10 degree of longitude and latitude has been verified for typical * projection parameters on the 1 degree graticule of native longitude and * latitude (to within 5 degrees of any latitude where the projection may * diverge). Refer to the tprj1.c and tprj2.c test routines that accompany * this software. * * * prjini() - Default constructor for the prjprm struct * ---------------------------------------------------- * prjini() sets all members of a prjprm struct to default values. It should * be used to initialize every prjprm struct. * * Returned: * prj struct prjprm* * Projection parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * * * prjfree() - Destructor for the prjprm struct * -------------------------------------------- * prjfree() frees any memory that may have been allocated to store an error * message in the prjprm struct. * * Given: * prj struct prjprm* * Projection parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * * * prjprt() - Print routine for the prjprm struct * ---------------------------------------------- * prjprt() prints the contents of a prjprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * prj const struct prjprm* * Projection parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * * * prjset() - Generic setup routine for the prjprm struct * ------------------------------------------------------ * prjset() sets up a prjprm struct according to information supplied within * it. * * Note that this routine need not be called directly; it will be invoked by * prjx2s() and prjs2x() if prj.flag is anything other than a predefined magic * value. * * The one important distinction between prjset() and the setup routines for * the specific projections is that the projection code must be defined in the * prjprm struct in order for prjset() to identify the required projection. * Once prjset() has initialized the prjprm struct, prjx2s() and prjs2x() use * the pointers to the specific projection and deprojection routines contained * therein. * * Given and returned: * prj struct prjprm* * Projection parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * prjx2s() - Generic Cartesian-to-spherical deprojection * ------------------------------------------------------ * Deproject Cartesian (x,y) coordinates in the plane of projection to native * spherical coordinates (phi,theta). * * The projection is that specified by prjprm::code. * * Given and returned: * prj struct prjprm* * Projection parameters. * * Given: * nx,ny int Vector lengths. * * sxy,spt int Vector strides. * * x,y const double[] * Projected coordinates. * * Returned: * phi,theta double[] Longitude and latitude (phi,theta) of the projected * point in native spherical coordinates [deg]. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (x,y). * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * 3: One or more of the (x,y) coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * prjs2x() - Generic spherical-to-Cartesian projection * ---------------------------------------------------- * Project native spherical coordinates (phi,theta) to Cartesian (x,y) * coordinates in the plane of projection. * * The projection is that specified by prjprm::code. * * Given and returned: * prj struct prjprm* * Projection parameters. * * Given: * nphi, * ntheta int Vector lengths. * * spt,sxy int Vector strides. * * phi,theta const double[] * Longitude and latitude (phi,theta) of the projected * point in native spherical coordinates [deg]. * * Returned: * x,y double[] Projected coordinates. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (phi,theta). * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * 4: One or more of the (phi,theta) coordinates * were, invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * ???set() - Specific setup routines for the prjprm struct * -------------------------------------------------------- * Set up a prjprm struct for a particular projection according to information * supplied within it. * * Given and returned: * prj struct prjprm* * Projection parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * ???x2s() - Specific Cartesian-to-spherical deprojection routines * ---------------------------------------------------------------- * Transform (x,y) coordinates in the plane of projection to native spherical * coordinates (phi,theta). * * Given and returned: * prj struct prjprm* * Projection parameters. * * Given: * nx,ny int Vector lengths. * * sxy,spt int Vector strides. * * x,y const double[] * Projected coordinates. * * Returned: * phi,theta double[] Longitude and latitude of the projected point in * native spherical coordinates [deg]. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (x,y). * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * 3: One or more of the (x,y) coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * ???s2x() - Specific spherical-to-Cartesian projection routines *--------------------------------------------------------------- * Transform native spherical coordinates (phi,theta) to (x,y) coordinates in * the plane of projection. * * Given and returned: * prj struct prjprm* * Projection parameters. * * Given: * nphi, * ntheta int Vector lengths. * * spt,sxy int Vector strides. * * phi,theta const double[] * Longitude and latitude of the projected point in * native spherical coordinates [deg]. * * Returned: * x,y double[] Projected coordinates. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (phi,theta). * * Function return value: * int Status return value: * 0: Success. * 1: Null prjprm pointer passed. * 2: Invalid projection parameters. * 4: One or more of the (phi,theta) coordinates * were, invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * prjprm::err if enabled, see wcserr_enable(). * * * prjprm struct - Projection parameters * ------------------------------------- * The prjprm struct contains all information needed to project or deproject * native spherical coordinates. It consists of certain members that must be * set by the user ("given") and others that are set by the WCSLIB routines * ("returned"). Some of the latter are supplied for informational purposes * while others are for internal use only. * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following prjprm struct members are set or changed: * * - prjprm::code, * - prjprm::r0, * - prjprm::pv[], * - prjprm::phi0, * - prjprm::theta0. * * This signals the initialization routine (prjset() or ???set()) to * recompute the returned members of the prjprm struct. flag will then be * reset to indicate that this has been done. * * Note that flag need not be reset when prjprm::bounds is changed. * * char code[4] * (Given) Three-letter projection code defined by the FITS standard. * * double r0 * (Given) The radius of the generating sphere for the projection, a linear * scaling parameter. If this is zero, it will be reset to its default * value of 180/pi (the value for FITS WCS). * * double pv[30] * (Given) Projection parameters. These correspond to the PVi_ma keywords * in FITS, so pv[0] is PVi_0a, pv[1] is PVi_1a, etc., where i denotes the * latitude-like axis. Many projections use pv[1] (PVi_1a), some also use * pv[2] (PVi_2a) and SZP uses pv[3] (PVi_3a). ZPN is currently the only * projection that uses any of the others. * * Usage of the pv[] array as it applies to each projection is described in * the prologue to each trio of projection routines in prj.c. * * double phi0 * (Given) The native longitude, phi_0 [deg], and ... * double theta0 * (Given) ... the native latitude, theta_0 [deg], of the reference point, * i.e. the point (x,y) = (0,0). If undefined (set to a magic value by * prjini()) the initialization routine will set this to a * projection-specific default. * * int bounds * (Given) Controls strict bounds checking for the AZP, SZP, TAN, SIN, ZPN, * and COP projections; set to zero to disable checking. * * The remaining members of the prjprm struct are maintained by the setup * routines and must not be modified elsewhere: * * char name[40] * (Returned) Long name of the projection. * * Provided for information only, not used by the projection routines. * * int category * (Returned) Projection category matching the value of the relevant global * variable: * * - ZENITHAL, * - CYLINDRICAL, * - PSEUDOCYLINDRICAL, * - CONVENTIONAL, * - CONIC, * - POLYCONIC, * - QUADCUBE, and * - HEALPIX. * * The category name may be identified via the prj_categories character * array, e.g. * = struct prjprm prj; = ... = printf("%s\n", prj_categories[prj.category]); * * Provided for information only, not used by the projection routines. * * int pvrange * (Returned) Range of projection parameter indices: 100 times the first * allowed index plus the number of parameters, e.g. TAN is 0 (no * parameters), SZP is 103 (1 to 3), and ZPN is 30 (0 to 29). * * Provided for information only, not used by the projection routines. * * int simplezen * (Returned) True if the projection is a radially-symmetric zenithal * projection. * * Provided for information only, not used by the projection routines. * * int equiareal * (Returned) True if the projection is equal area. * * Provided for information only, not used by the projection routines. * * int conformal * (Returned) True if the projection is conformal. * * Provided for information only, not used by the projection routines. * * int global * (Returned) True if the projection can represent the whole sphere in a * finite, non-overlapped mapping. * * Provided for information only, not used by the projection routines. * * int divergent * (Returned) True if the projection diverges in latitude. * * Provided for information only, not used by the projection routines. * * double x0 * (Returned) The offset in x, and ... * double y0 * (Returned) ... the offset in y used to force (x,y) = (0,0) at * (phi_0,theta_0). * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * void *padding * (An unused variable inserted for alignment purposes only.) * * double w[10] * (Returned) Intermediate floating-point values derived from the * projection parameters, cached here to save recomputation. * * Usage of the w[] array as it applies to each projection is described in * the prologue to each trio of projection routines in prj.c. * * int n * (Returned) Intermediate integer value (used only for the ZPN and HPX * projections). * * int (*prjx2s)(PRJX2S_ARGS) * (Returned) Pointer to the projection ... * int (*prjs2x)(PRJ_ARGS) * (Returned) ... and deprojection routines. * * * Global variable: const char *prj_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_PROJ #define WCSLIB_PROJ #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif /* Total number of projection parameters; 0 to PVN-1. */ #define PVN 30 extern const char *prj_errmsg[]; enum prj_errmsg_enum { PRJERR_SUCCESS = 0, /* Success. */ PRJERR_NULL_POINTER = 1, /* Null prjprm pointer passed. */ PRJERR_BAD_PARAM = 2, /* Invalid projection parameters. */ PRJERR_BAD_PIX = 3, /* One or more of the (x, y) coordinates were invalid. */ PRJERR_BAD_WORLD = 4 /* One or more of the (phi, theta) coordinates were invalid. */ }; extern const int CONIC, CONVENTIONAL, CYLINDRICAL, POLYCONIC, PSEUDOCYLINDRICAL, QUADCUBE, ZENITHAL, HEALPIX; extern const char prj_categories[9][32]; extern const int prj_ncode; extern const char prj_codes[28][4]; #ifdef PRJX2S_ARGS #undef PRJX2S_ARGS #endif #ifdef PRJS2X_ARGS #undef PRJS2X_ARGS #endif /* For use in declaring deprojection function prototypes. */ #define PRJX2S_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \ const double x[], const double y[], double phi[], double theta[], int stat[] /* For use in declaring projection function prototypes. */ #define PRJS2X_ARGS struct prjprm *prj, int nx, int ny, int sxy, int spt, \ const double phi[], const double theta[], double x[], double y[], int stat[] struct prjprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* Parameters to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ char code[4]; /* Three-letter projection code. */ double r0; /* Radius of the generating sphere. */ double pv[PVN]; /* Projection parameters. */ double phi0, theta0; /* Fiducial native coordinates. */ int bounds; /* Enable strict bounds checking. */ /* Information derived from the parameters supplied. */ /*------------------------------------------------------------------------*/ char name[40]; /* Projection name. */ int category; /* Projection category. */ int pvrange; /* Range of projection parameter indices. */ int simplezen; /* Is it a simple zenithal projection? */ int equiareal; /* Is it an equal area projection? */ int conformal; /* Is it a conformal projection? */ int global; /* Can it map the whole sphere? */ int divergent; /* Does the projection diverge in latitude? */ double x0, y0; /* Fiducial offsets. */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private */ /*------------------------------------------------------------------------*/ void *padding; /* (Dummy inserted for alignment purposes.) */ double w[10]; /* Intermediate values. */ int m, n; /* Intermediate values. */ int (*prjx2s)(PRJX2S_ARGS); /* Pointers to the spherical projection and */ int (*prjs2x)(PRJS2X_ARGS); /* deprojection functions. */ }; /* Size of the prjprm struct in int units, used by the Fortran wrappers. */ #define PRJLEN (sizeof(struct prjprm)/sizeof(int)) /* Use the preprocessor to help declare function prototypes (see above). */ int prjini(struct prjprm *prj); int prjfree(struct prjprm *prj); int prjprt(const struct prjprm *prj); int prjset(struct prjprm *prj); int prjx2s(PRJX2S_ARGS); int prjs2x(PRJS2X_ARGS); int azpset(struct prjprm *prj); int azpx2s(PRJX2S_ARGS); int azps2x(PRJS2X_ARGS); int szpset(struct prjprm *prj); int szpx2s(PRJX2S_ARGS); int szps2x(PRJS2X_ARGS); int tanset(struct prjprm *prj); int tanx2s(PRJX2S_ARGS); int tans2x(PRJS2X_ARGS); int stgset(struct prjprm *prj); int stgx2s(PRJX2S_ARGS); int stgs2x(PRJS2X_ARGS); int sinset(struct prjprm *prj); int sinx2s(PRJX2S_ARGS); int sins2x(PRJS2X_ARGS); int arcset(struct prjprm *prj); int arcx2s(PRJX2S_ARGS); int arcs2x(PRJS2X_ARGS); int zpnset(struct prjprm *prj); int zpnx2s(PRJX2S_ARGS); int zpns2x(PRJS2X_ARGS); int zeaset(struct prjprm *prj); int zeax2s(PRJX2S_ARGS); int zeas2x(PRJS2X_ARGS); int airset(struct prjprm *prj); int airx2s(PRJX2S_ARGS); int airs2x(PRJS2X_ARGS); int cypset(struct prjprm *prj); int cypx2s(PRJX2S_ARGS); int cyps2x(PRJS2X_ARGS); int ceaset(struct prjprm *prj); int ceax2s(PRJX2S_ARGS); int ceas2x(PRJS2X_ARGS); int carset(struct prjprm *prj); int carx2s(PRJX2S_ARGS); int cars2x(PRJS2X_ARGS); int merset(struct prjprm *prj); int merx2s(PRJX2S_ARGS); int mers2x(PRJS2X_ARGS); int sflset(struct prjprm *prj); int sflx2s(PRJX2S_ARGS); int sfls2x(PRJS2X_ARGS); int parset(struct prjprm *prj); int parx2s(PRJX2S_ARGS); int pars2x(PRJS2X_ARGS); int molset(struct prjprm *prj); int molx2s(PRJX2S_ARGS); int mols2x(PRJS2X_ARGS); int aitset(struct prjprm *prj); int aitx2s(PRJX2S_ARGS); int aits2x(PRJS2X_ARGS); int copset(struct prjprm *prj); int copx2s(PRJX2S_ARGS); int cops2x(PRJS2X_ARGS); int coeset(struct prjprm *prj); int coex2s(PRJX2S_ARGS); int coes2x(PRJS2X_ARGS); int codset(struct prjprm *prj); int codx2s(PRJX2S_ARGS); int cods2x(PRJS2X_ARGS); int cooset(struct prjprm *prj); int coox2s(PRJX2S_ARGS); int coos2x(PRJS2X_ARGS); int bonset(struct prjprm *prj); int bonx2s(PRJX2S_ARGS); int bons2x(PRJS2X_ARGS); int pcoset(struct prjprm *prj); int pcox2s(PRJX2S_ARGS); int pcos2x(PRJS2X_ARGS); int tscset(struct prjprm *prj); int tscx2s(PRJX2S_ARGS); int tscs2x(PRJS2X_ARGS); int cscset(struct prjprm *prj); int cscx2s(PRJX2S_ARGS); int cscs2x(PRJS2X_ARGS); int qscset(struct prjprm *prj); int qscx2s(PRJX2S_ARGS); int qscs2x(PRJS2X_ARGS); int hpxset(struct prjprm *prj); int hpxx2s(PRJX2S_ARGS); int hpxs2x(PRJS2X_ARGS); int xphset(struct prjprm *prj); int xphx2s(PRJX2S_ARGS); int xphs2x(PRJS2X_ARGS); /* Deprecated. */ #define prjini_errmsg prj_errmsg #define prjprt_errmsg prj_errmsg #define prjset_errmsg prj_errmsg #define prjx2s_errmsg prj_errmsg #define prjs2x_errmsg prj_errmsg #ifdef __cplusplus } #endif #endif /* WCSLIB_PROJ */ astropy-0.3/cextern/wcslib/C/log.h0000644000175000017500000001315212243255342015250 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: log.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement logarithmic coordinate systems as * defined by the FITS World Coordinate System (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the log routines * --------------------------- * These routines implement the part of the FITS WCS standard that deals with * logarithmic coordinates. They define methods to be used for computing * logarithmic world coordinates from intermediate world coordinates (a linear * transformation of image pixel coordinates), and vice versa. * * logx2s() and logs2x() implement the WCS logarithmic coordinate * transformations. * * Argument checking: * ------------------ * The input log-coordinate values are only checked for values that would * result in floating point exceptions and the same is true for the * log-coordinate reference value. * * Accuracy: * --------- * No warranty is given for the accuracy of these routines (refer to the * copyright notice); intending users must satisfy for themselves their * adequacy for the intended purpose. However, closure effectively to within * double precision rounding error was demonstrated by test routine tlog.c * which accompanies this software. * * * logx2s() - Transform to logarithmic coordinates * ----------------------------------------------- * logx2s() transforms intermediate world coordinates to logarithmic * coordinates. * * Given and returned: * crval double Log-coordinate reference value (CRVALia). * * Given: * nx int Vector length. * * sx int Vector stride. * * slogc int Vector stride. * * x const double[] * Intermediate world coordinates, in SI units. * * Returned: * logc double[] Logarithmic coordinates, in SI units. * * stat int[] Status return value status for each vector element: * 0: Success. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid log-coordinate reference value. * * * logs2x() - Transform logarithmic coordinates * -------------------------------------------- * logs2x() transforms logarithmic world coordinates to intermediate world * coordinates. * * Given and returned: * crval double Log-coordinate reference value (CRVALia). * * Given: * nlogc int Vector length. * * slogc int Vector stride. * * sx int Vector stride. * * logc const double[] * Logarithmic coordinates, in SI units. * * Returned: * x double[] Intermediate world coordinates, in SI units. * * stat int[] Status return value status for each vector element: * 0: Success. * 1: Invalid value of logc. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid log-coordinate reference value. * 4: One or more of the world-coordinate values * are incorrect, as indicated by the stat vector. * * * Global variable: const char *log_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_LOG #define WCSLIB_LOG #ifdef __cplusplus extern "C" { #endif extern const char *log_errmsg[]; enum log_errmsg_enum { LOGERR_SUCCESS = 0, /* Success. */ LOGERR_NULL_POINTER = 1, /* Null pointer passed. */ LOGERR_BAD_LOG_REF_VAL = 2, /* Invalid log-coordinate reference value. */ LOGERR_BAD_X = 3, /* One or more of the x coordinates were invalid. */ LOGERR_BAD_WORLD = 4 /* One or more of the world coordinates were invalid. */ }; int logx2s(double crval, int nx, int sx, int slogc, const double x[], double logc[], int stat[]); int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[], double x[], int stat[]); #ifdef __cplusplus } #endif #endif /* WCSLIB_LOG */ astropy-0.3/cextern/wcslib/C/log.c0000644000175000017500000000516712243255342015252 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: log.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include "log.h" /* Map status return value to message. */ const char *log_errmsg[] = { "Success", "", "Invalid log-coordinate reference value", "One or more of the x coordinates were invalid", "One or more of the world coordinates were invalid"}; /*--------------------------------------------------------------------------*/ int logx2s( double crval, int nx, int sx, int slogc, const double x[], double logc[], int stat[]) { register int ix; register int *statp; register const double *xp; register double *logcp; if (crval <= 0.0) { return LOGERR_BAD_LOG_REF_VAL; } xp = x; logcp = logc; statp = stat; for (ix = 0; ix < nx; ix++, xp += sx, logcp += slogc) { *logcp = crval * exp((*xp) / crval); *(statp++) = 0; } return 0; } /*--------------------------------------------------------------------------*/ int logs2x( double crval, int nlogc, int slogc, int sx, const double logc[], double x[], int stat[]) { int status; register int ilogc; register int *statp; register const double *logcp; register double *xp; if (crval <= 0.0) { return LOGERR_BAD_LOG_REF_VAL; } xp = x; logcp = logc; statp = stat; status = 0; for (ilogc = 0; ilogc < nlogc; ilogc++, logcp += slogc, xp += sx) { if (*logcp > 0.0) { *xp = crval * log(*logcp / crval); *(statp++) = 0; } else { *(statp++) = 1; status = LOGERR_BAD_WORLD; } } return status; } astropy-0.3/cextern/wcslib/C/wcsfix.c0000644000175000017500000005142512243255342015772 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsfix.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsutil.h" #include "sph.h" #include "wcs.h" #include "wcsunits.h" #include "wcsfix.h" extern const int WCSSET; /* Maximum number of coordinate axes that can be handled. */ #define NMAX 16 /* Map status return value to message. */ const char *wcsfix_errmsg[] = { "Success", "Null wcsprm pointer passed", "Memory allocation failed", "Linear transformation matrix is singular", "Inconsistent or unrecognized coordinate axis types", "Invalid parameter value", "Invalid coordinate transformation parameters", "Ill-conditioned coordinate transformation parameters", "All of the corner pixel coordinates are invalid", "Could not determine reference pixel coordinate", "Could not determine reference pixel value"}; /* Convenience macro for invoking wcserr_set(). */ #define WCSFIX_ERRMSG(status) WCSERR_SET(status), wcsfix_errmsg[status] /*--------------------------------------------------------------------------*/ int wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]) { int status = 0; if ((stat[CDFIX] = cdfix(wcs)) > 0) { status = 1; } if ((stat[DATFIX] = datfix(wcs)) > 0) { status = 1; } if ((stat[UNITFIX] = unitfix(ctrl, wcs)) > 0) { status = 1; } if ((stat[SPCFIX] = spcfix(wcs)) > 0) { status = 1; } if ((stat[CELFIX] = celfix(wcs)) > 0) { status = 1; } if ((stat[CYLFIX] = cylfix(naxis, wcs)) > 0) { status = 1; } return status; } /*--------------------------------------------------------------------------*/ int wcsfixi(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[], struct wcserr info[]) { int ifix, status = 0; struct wcserr err; /* Handling the status values returned from the sub-fixers is trickier than it might seem, especially considering that wcs->err may contain an error status on input which should be preserved if no translation errors occur. The simplest way seems to be to save a copy of wcs->err and clear it before each sub-fixer. The last real error to occur, excluding informative messages, is the one returned. To get informative messages from spcfix() it must precede celfix() and cylfix(). The latter call wcsset() which also translates AIPS-convention spectral axes. */ wcserr_copy(wcs->err, &err); for (ifix = CDFIX; ifix < NWCSFIX; ifix++) { /* Clear (delete) wcs->err. */ wcserr_clear(&(wcs->err)); switch (ifix) { case CDFIX: stat[ifix] = cdfix(wcs); break; case DATFIX: stat[ifix] = datfix(wcs); break; case UNITFIX: stat[ifix] = unitfix(ctrl, wcs); break; case SPCFIX: stat[ifix] = spcfix(wcs); break; case CELFIX: stat[ifix] = celfix(wcs); break; case CYLFIX: stat[ifix] = cylfix(naxis, wcs); break; default: continue; } if (stat[ifix] == FIXERR_NO_CHANGE) { /* No change => no message. */ wcserr_copy(0x0, info+ifix); } else if (stat[ifix] == FIXERR_SUCCESS) { /* Successful translation, but there may be an informative message. */ if (wcs->err && wcs->err->status < 0) { wcserr_copy(wcs->err, info+ifix); } else { wcserr_copy(0x0, info+ifix); } } else { /* An informative message or error message. */ wcserr_copy(wcs->err, info+ifix); if ((status = (stat[ifix] > 0))) { /* It was an error, replace the previous one. */ wcserr_copy(wcs->err, &err); } } } /* Restore the last error to occur. */ if (err.status) { wcserr_copy(&err, wcs->err); } else { wcserr_clear(&(wcs->err)); } return status; } /*--------------------------------------------------------------------------*/ int cdfix(struct wcsprm *wcs) { int i, k, naxis, status = FIXERR_NO_CHANGE; double *cd; if (wcs == 0x0) return FIXERR_NULL_POINTER; if ((wcs->altlin & 1) || !(wcs->altlin & 2)) { /* Either we have PCi_ja or there are no CDi_ja. */ return FIXERR_NO_CHANGE; } naxis = wcs->naxis; status = FIXERR_NO_CHANGE; for (i = 0; i < naxis; i++) { /* Row of zeros? */ cd = wcs->cd + i * naxis; for (k = 0; k < naxis; k++, cd++) { if (*cd != 0.0) goto next; } /* Column of zeros? */ cd = wcs->cd + i; for (k = 0; k < naxis; k++, cd += naxis) { if (*cd != 0.0) goto next; } cd = wcs->cd + i * (naxis + 1); *cd = 1.0; status = FIXERR_SUCCESS; next: ; } return status; } /*--------------------------------------------------------------------------*/ static int parse_date(const char *buf, int *hour, int *minute, double *sec) { char ctmp[72]; if (sscanf(buf, "%2d:%2d:%s", hour, minute, ctmp) < 3 || wcsutil_str2double(ctmp, "%lf", sec)) { return 1; } return 0; } static void write_date(char *buf, int hour, int minute, double sec) { char ctmp[72]; wcsutil_double2str(ctmp, "%04.1f", sec); sprintf(buf, "T%.2d:%.2d:%s", hour, minute, ctmp); } int datfix(struct wcsprm *wcs) { static const char *function = "datfix"; char orig_dateobs[72]; char *dateobs; int day, dd, hour = 0, jd, minute = 0, month, msec, n4, year; double mjdobs, sec = 0.0, t; struct wcserr **err; if (wcs == 0x0) return FIXERR_NULL_POINTER; err = &(wcs->err); dateobs = wcs->dateobs; strncpy(orig_dateobs, dateobs, 72); if (dateobs[0] == '\0') { if (undefined(wcs->mjdobs)) { /* No date information was provided. */ return FIXERR_NO_CHANGE; } else { /* Calendar date from MJD. */ jd = 2400001 + (int)wcs->mjdobs; n4 = 4*(jd + ((2*((4*jd - 17918)/146097)*3)/4 + 1)/2 - 37); dd = 10*(((n4-237)%1461)/4) + 5; year = n4/1461 - 4712; month = (2 + dd/306)%12 + 1; day = (dd%306)/10 + 1; sprintf(dateobs, "%.4d-%.2d-%.2d", year, month, day); /* Write time part only if non-zero. */ if ((t = wcs->mjdobs - (int)wcs->mjdobs) > 0.0) { t *= 24.0; hour = (int)t; t = 60.0 * (t - hour); minute = (int)t; sec = 60.0 * (t - minute); /* Round to 1ms. */ dd = 60000*(60*hour + minute) + (int)(1000*(sec+0.0005)); hour = dd / 3600000; dd -= 3600000 * hour; minute = dd / 60000; msec = dd - 60000 * minute; sprintf(dateobs+10, "T%.2d:%.2d:%.2d", hour, minute, msec/1000); /* Write fractions of a second only if non-zero. */ if (msec%1000) { sprintf(dateobs+19, ".%.3d", msec%1000); } } } } else { if (strlen(dateobs) < 8) { /* Can't be a valid date. */ return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: date string too short '%s'", dateobs); } /* Identify the date format. */ if (dateobs[4] == '-' && dateobs[7] == '-') { /* Standard year-2000 form: CCYY-MM-DD[Thh:mm:ss[.sss...]] */ if (sscanf(dateobs, "%4d-%2d-%2d", &year, &month, &day) < 3) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid date '%s'", dateobs); } if (dateobs[10] == 'T') { if (parse_date(dateobs+11, &hour, &minute, &sec)) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid time '%s'", dateobs+11); } } else if (dateobs[10] == ' ') { hour = 0; minute = 0; sec = 0.0; if (parse_date(dateobs+11, &hour, &minute, &sec)) { write_date(dateobs+10, hour, minute, sec); } else { dateobs[10] = 'T'; } } } else if (dateobs[4] == '/' && dateobs[7] == '/') { /* Also allow CCYY/MM/DD[Thh:mm:ss[.sss...]] */ if (sscanf(dateobs, "%4d/%2d/%2d", &year, &month, &day) < 3) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid date '%s'", dateobs); } if (dateobs[10] == 'T') { if (parse_date(dateobs+11, &hour, &minute, &sec)) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid time '%s'", dateobs+11); } } else if (dateobs[10] == ' ') { hour = 0; minute = 0; sec = 0.0; if (parse_date(dateobs+11, &hour, &minute, &sec)) { write_date(dateobs+10, hour, minute, sec); } else { dateobs[10] = 'T'; } } /* Looks ok, fix it up. */ dateobs[4] = '-'; dateobs[7] = '-'; } else { if (dateobs[2] == '/' && dateobs[5] == '/') { /* Old format date: DD/MM/YY, also allowing DD/MM/CCYY. */ if (sscanf(dateobs, "%2d/%2d/%4d", &day, &month, &year) < 3) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid date '%s'", dateobs); } } else if (dateobs[2] == '-' && dateobs[5] == '-') { /* Also recognize DD-MM-YY and DD-MM-CCYY */ if (sscanf(dateobs, "%2d-%2d-%4d", &day, &month, &year) < 3) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid date '%s'", dateobs); } } else { /* Not a valid date format. */ return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: invalid date '%s'", dateobs); } if (year < 100) year += 1900; /* Doesn't have a time. */ sprintf(dateobs, "%.4d-%.2d-%.2d", year, month, day); } /* Compute MJD. */ mjdobs = (double)((1461*(year - (12-month)/10 + 4712))/4 + (306*((month+9)%12) + 5)/10 - (3*((year - (12-month)/10 + 4900)/100))/4 + day - 2399904) + (hour + (minute + sec/60.0)/60.0)/24.0; if (undefined(wcs->mjdobs)) { wcs->mjdobs = mjdobs; } else { /* Check for consistency. */ if (fabs(mjdobs - wcs->mjdobs) > 0.5) { return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: inconsistent date '%s'", dateobs); } } } if (strncmp(orig_dateobs, dateobs, 72)) { wcserr_set(WCSERR_SET(FIXERR_DATE_FIX), "Changed '%s' to '%s'", orig_dateobs, dateobs); return FIXERR_SUCCESS; } return FIXERR_NO_CHANGE; } /*--------------------------------------------------------------------------*/ int unitfix(int ctrl, struct wcsprm *wcs) { int i, k, status = FIXERR_NO_CHANGE; char orig_unit[80], msg[WCSERR_MSG_LENGTH]; const char *function = "unitfix"; struct wcserr **err; if (wcs == 0x0) return FIXERR_NULL_POINTER; err = &(wcs->err); strcpy(msg, "Changed units: "); for (i = 0; i < wcs->naxis; i++) { strncpy(orig_unit, wcs->cunit[i], 80); if (wcsutrne(ctrl, wcs->cunit[i], &(wcs->err)) == 0) { k = strlen(msg); sprintf(msg+k, "'%s' -> '%s', ", orig_unit, wcs->cunit[i]); status = FIXERR_UNITS_ALIAS; } } if (status == FIXERR_UNITS_ALIAS) { k = strlen(msg) - 2; msg[k] = '\0'; wcserr_set(WCSERR_SET(FIXERR_UNITS_ALIAS), msg); status = FIXERR_SUCCESS; } return status; } /*--------------------------------------------------------------------------*/ int spcfix(struct wcsprm *wcs) { static const char *function = "spcfix"; char ctype[9], specsys[9]; int i, status; struct wcserr **err; if (wcs == 0x0) return FIXERR_NULL_POINTER; err = &(wcs->err); for (i = 0; i < wcs->naxis; i++) { /* Translate an AIPS-convention spectral type if present. */ status = spcaips(wcs->ctype[i], wcs->velref, ctype, specsys); if (status == 0) { /* An AIPS type was found but it may match what we already have. */ status = FIXERR_NO_CHANGE; /* Was specsys translated? */ if (wcs->specsys[0] == '\0' && *specsys) { strncpy(wcs->specsys, specsys, 9); wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE), "Changed SPECSYS to '%s'", specsys); status = FIXERR_SUCCESS; } /* Was ctype translated? Have to null-fill for comparing them. */ wcsutil_null_fill(9, wcs->ctype[i]); if (strncmp(wcs->ctype[i], ctype, 9)) { /* ctype was translated... */ if (status == FIXERR_SUCCESS) { /* ...and specsys was also. */ wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE), "Changed CTYPE%d from '%s' to '%s', and SPECSYS to '%s'", i+1, wcs->ctype[i], ctype, wcs->specsys); } else { wcserr_set(WCSERR_SET(FIXERR_SPC_UPDATE), "Changed CTYPE%d from '%s' to '%s'", i+1, wcs->ctype[i], ctype); status = FIXERR_SUCCESS; } strncpy(wcs->ctype[i], ctype, 9); } /* Tidy up. */ if (status == FIXERR_SUCCESS) { wcsutil_null_fill(72, wcs->ctype[i]); wcsutil_null_fill(72, wcs->specsys); } /* No need to check for others, wcsset() will fail if so. */ return status; } else if (status == SPCERR_BAD_SPEC_PARAMS) { /* An AIPS spectral type was found but with invalid velref. */ return wcserr_set(WCSERR_SET(FIXERR_BAD_PARAM), "Invalid parameter value: velref = %d", wcs->velref); } } return FIXERR_NO_CHANGE; } /*--------------------------------------------------------------------------*/ int celfix(struct wcsprm *wcs) { static const char *function = "celfix"; int k, status; struct celprm *wcscel = &(wcs->cel); struct prjprm *wcsprj = &(wcscel->prj); struct wcserr **err; if (wcs == 0x0) return FIXERR_NULL_POINTER; err = &(wcs->err); /* Initialize if required. */ if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } /* Was an NCP or GLS projection code translated? */ if (wcs->lat >= 0) { /* Check ctype. */ if (strcmp(wcs->ctype[wcs->lat]+5, "NCP") == 0) { strcpy(wcs->ctype[wcs->lng]+5, "SIN"); strcpy(wcs->ctype[wcs->lat]+5, "SIN"); if (wcs->npvmax < wcs->npv + 2) { /* Allocate space for two more PVi_ja keyvalues. */ if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) { if (!(wcs->pv = calloc(wcs->npv+2, sizeof(struct pvcard)))) { wcs->pv = wcs->m_pv; return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); } wcs->npvmax = wcs->npv + 2; wcs->m_flag = WCSSET; for (k = 0; k < wcs->npv; k++) { wcs->pv[k] = wcs->m_pv[k]; } if (wcs->m_pv) free(wcs->m_pv); wcs->m_pv = wcs->pv; } else { return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); } } wcs->pv[wcs->npv].i = wcs->lat + 1; wcs->pv[wcs->npv].m = 1; wcs->pv[wcs->npv].value = wcsprj->pv[1]; (wcs->npv)++; wcs->pv[wcs->npv].i = wcs->lat + 1; wcs->pv[wcs->npv].m = 2; wcs->pv[wcs->npv].value = wcsprj->pv[2]; (wcs->npv)++; return FIXERR_SUCCESS; } else if (strcmp(wcs->ctype[wcs->lat]+5, "GLS") == 0) { strcpy(wcs->ctype[wcs->lng]+5, "SFL"); strcpy(wcs->ctype[wcs->lat]+5, "SFL"); if (wcs->crval[wcs->lng] != 0.0 || wcs->crval[wcs->lat] != 0.0) { /* In the AIPS convention, setting the reference longitude and * latitude for GLS does not create an oblique graticule. A non-zero * reference longitude introduces an offset in longitude in the normal * way, whereas a non-zero reference latitude simply translates the * reference point (i.e. the map as a whole) to that latitude. This * might be effected by adjusting CRPIXja but that is complicated by * the linear transformation and instead is accomplished here by * setting theta_0. */ if (wcs->npvmax < wcs->npv + 3) { /* Allocate space for three more PVi_ja keyvalues. */ if (wcs->m_flag == WCSSET && wcs->pv == wcs->m_pv) { if (!(wcs->pv = calloc(wcs->npv+3, sizeof(struct pvcard)))) { wcs->pv = wcs->m_pv; return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); } wcs->npvmax = wcs->npv + 3; wcs->m_flag = WCSSET; for (k = 0; k < wcs->npv; k++) { wcs->pv[k] = wcs->m_pv[k]; } if (wcs->m_pv) free(wcs->m_pv); wcs->m_pv = wcs->pv; } else { return wcserr_set(WCSFIX_ERRMSG(FIXERR_MEMORY)); } } wcs->pv[wcs->npv].i = wcs->lng + 1; wcs->pv[wcs->npv].m = 0; wcs->pv[wcs->npv].value = 1.0; (wcs->npv)++; /* Note that the reference longitude is still zero. */ wcs->pv[wcs->npv].i = wcs->lng + 1; wcs->pv[wcs->npv].m = 1; wcs->pv[wcs->npv].value = 0.0; (wcs->npv)++; wcs->pv[wcs->npv].i = wcs->lng + 1; wcs->pv[wcs->npv].m = 2; wcs->pv[wcs->npv].value = wcs->crval[wcs->lat]; (wcs->npv)++; } return FIXERR_SUCCESS; } } return FIXERR_NO_CHANGE; } /*--------------------------------------------------------------------------*/ int cylfix(const int naxis[], struct wcsprm *wcs) { static const char *function = "cylfix"; unsigned short icnr, indx[NMAX], ncnr; int j, k, stat[4], status; double img[4][NMAX], lat, lng, phi[4], phi0, phimax, phimin, pix[4][NMAX], *pixj, theta[4], theta0, world[4][NMAX], x, y; struct wcserr **err; if (naxis == 0x0) return FIXERR_NO_CHANGE; if (wcs == 0x0) return FIXERR_NULL_POINTER; err = &(wcs->err); /* Initialize if required. */ if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } /* Check that we have a cylindrical projection. */ if (wcs->cel.prj.category != CYLINDRICAL) return FIXERR_NO_CHANGE; if (wcs->naxis < 2) return FIXERR_NO_CHANGE; /* Compute the native longitude in each corner of the image. */ ncnr = 1 << wcs->naxis; for (k = 0; k < NMAX; k++) { indx[k] = 1 << k; } phimin = 1.0e99; phimax = -1.0e99; for (icnr = 0; icnr < ncnr;) { /* Do four corners at a time. */ for (j = 0; j < 4; j++, icnr++) { pixj = pix[j]; for (k = 0; k < wcs->naxis; k++) { if (icnr & indx[k]) { *(pixj++) = naxis[k] + 0.5; } else { *(pixj++) = 0.5; } } } if (!(status = wcsp2s(wcs, 4, NMAX, pix[0], img[0], phi, theta, world[0], stat))) { for (j = 0; j < 4; j++) { if (phi[j] < phimin) phimin = phi[j]; if (phi[j] > phimax) phimax = phi[j]; } } } if (phimin > phimax) return status; /* Any changes needed? */ if (phimin >= -180.0 && phimax <= 180.0) return FIXERR_NO_CHANGE; /* Compute the new reference pixel coordinates. */ phi0 = (phimin + phimax) / 2.0; theta0 = 0.0; if ((status = prjs2x(&(wcs->cel.prj), 1, 1, 1, 1, &phi0, &theta0, &x, &y, stat))) { if (status == PRJERR_BAD_PARAM) { return wcserr_set(WCSFIX_ERRMSG(FIXERR_BAD_PARAM)); } return wcserr_set(WCSFIX_ERRMSG(FIXERR_NO_REF_PIX_COORD)); } for (k = 0; k < wcs->naxis; k++) { img[0][k] = 0.0; } img[0][wcs->lng] = x; img[0][wcs->lat] = y; if ((status = linx2p(&(wcs->lin), 1, 0, img[0], pix[0]))) { return wcserr_set(WCSFIX_ERRMSG(status)); } /* Compute celestial coordinates at the new reference pixel. */ if ((status = wcsp2s(wcs, 1, 0, pix[0], img[0], phi, theta, world[0], stat))) { if (wcs->err->status == WCSERR_BAD_PIX) { wcs->err->status = FIXERR_NO_REF_PIX_COORD; } return wcs->err->status; } /* Compute native coordinates of the celestial pole. */ lng = 0.0; lat = 90.0; (void)sphs2x(wcs->cel.euler, 1, 1, 1, 1, &lng, &lat, phi, theta); wcs->crpix[wcs->lng] = pix[0][wcs->lng]; wcs->crpix[wcs->lat] = pix[0][wcs->lat]; wcs->crval[wcs->lng] = world[0][wcs->lng]; wcs->crval[wcs->lat] = world[0][wcs->lat]; wcs->lonpole = phi[0] - phi0; return wcsset(wcs); } astropy-0.3/cextern/wcslib/C/wcsconfig.h.in0000644000175000017500000000123112243255342017051 0ustar oleole/*============================================================================ * * wcsconfig.h is generated from wcsconfig.h.in by 'configure'. It contains * C preprocessor macro definitions for compiling WCSLIB 4.17 * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig.h.in,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp $ *===========================================================================*/ /* WCSLIB library version number. */ #undef WCSLIB_VERSION /* Define to 1 if sincos() is available. */ #undef HAVE_SINCOS /* 64-bit integer data type. */ #undef WCSLIB_INT64 astropy-0.3/cextern/wcslib/C/wcsprintf.c0000644000175000017500000001051212243255342016476 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsprintf.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include "wcsprintf.h" static FILE *wcsprintf_file = 0x0; static char *wcsprintf_buff = 0x0; static char *wcsprintf_bufp = 0x0; static size_t wcsprintf_size = 0; /*--------------------------------------------------------------------------*/ int wcsprintf_set(FILE *wcsout) { if (wcsout != 0x0) { /* Output to file. */ wcsprintf_file = wcsout; if (wcsprintf_buff != 0x0) { /* Release the buffer. */ free(wcsprintf_buff); wcsprintf_buff = 0x0; } } else { /* Output to buffer. */ if (wcsprintf_buff == 0x0) { /* Allocate a buffer. */ wcsprintf_buff = malloc(1024); if (wcsprintf_buff == NULL) { return 1; } wcsprintf_size = 1024; } /* Reset pointer to the start of the buffer. */ wcsprintf_bufp = wcsprintf_buff; *wcsprintf_bufp = '\0'; } return 0; } /*--------------------------------------------------------------------------*/ const char *wcsprintf_buf(void) { return wcsprintf_buff; } /*--------------------------------------------------------------------------*/ int wcsprintf(const char *format, ...) { char *realloc_buff; int nbytes; size_t used; va_list arg_list; if (wcsprintf_buff == 0x0 && wcsprintf_file == 0x0) { /* Send output to stdout if wcsprintf_set() hasn't been called. */ wcsprintf_file = stdout; } va_start(arg_list, format); if (wcsprintf_file) { /* Output to file. */ nbytes = vfprintf(wcsprintf_file, format, arg_list); } else { /* Output to buffer. */ used = wcsprintf_bufp - wcsprintf_buff; if (wcsprintf_size - used < 128) { /* Expand the buffer. */ wcsprintf_size += 1024; realloc_buff = realloc(wcsprintf_buff, wcsprintf_size); if (realloc_buff == NULL) { free(wcsprintf_buff); wcsprintf_buff = 0x0; return 1; } wcsprintf_buff = realloc_buff; wcsprintf_bufp = wcsprintf_buff + used; } nbytes = vsprintf(wcsprintf_bufp, format, arg_list); wcsprintf_bufp += nbytes; } va_end(arg_list); return nbytes; } /*--------------------------------------------------------------------------*/ int wcsfprintf(FILE *stream, const char *format, ...) { char *realloc_buff; int nbytes; size_t used; va_list arg_list; if (wcsprintf_buff == 0x0 && wcsprintf_file == 0x0) { /* Send output to stream if wcsprintf_set() hasn't been called. */ wcsprintf_file = stream; } va_start(arg_list, format); if (wcsprintf_file) { /* Output to file. */ nbytes = vfprintf(wcsprintf_file, format, arg_list); } else { /* Output to buffer. */ used = wcsprintf_bufp - wcsprintf_buff; if (wcsprintf_size - used < 128) { /* Expand the buffer. */ wcsprintf_size += 1024; realloc_buff = realloc(wcsprintf_buff, wcsprintf_size); if (realloc_buff == NULL) { free(wcsprintf_buff); wcsprintf_buff = 0x0; return 1; } wcsprintf_buff = realloc_buff; wcsprintf_bufp = wcsprintf_buff + used; } nbytes = vsprintf(wcsprintf_bufp, format, arg_list); wcsprintf_bufp += nbytes; } va_end(arg_list); return nbytes; } astropy-0.3/cextern/wcslib/C/cel.c0000644000175000017500000002777612243255342015246 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: cel.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcstrig.h" #include "sph.h" #include "cel.h" const int CELSET = 137; /* Map status return value to message. */ const char *cel_errmsg[] = { "Success", "Null celprm pointer passed", "Invalid projection parameters", "Invalid coordinate transformation parameters", "Ill-conditioned coordinate transformation parameters", "One or more of the (x,y) coordinates were invalid", "One or more of the (lng,lat) coordinates were invalid"}; /* Convenience macro for invoking wcserr_set(). */ #define CEL_ERRMSG(status) WCSERR_SET(status), cel_errmsg[status] /*--------------------------------------------------------------------------*/ int celini(cel) struct celprm *cel; { register int k; if (cel == 0x0) return CELERR_NULL_POINTER; cel->flag = 0; cel->offset = 0; cel->phi0 = UNDEFINED; cel->theta0 = UNDEFINED; cel->ref[0] = 0.0; cel->ref[1] = 0.0; cel->ref[2] = UNDEFINED; cel->ref[3] = +90.0; for (k = 0; k < 5; cel->euler[k++] = 0.0); cel->latpreq = -1; cel->err = 0x0; return prjini(&(cel->prj)); } /*--------------------------------------------------------------------------*/ int celfree(cel) struct celprm *cel; { if (cel == 0x0) return CELERR_NULL_POINTER; if (cel->err) { free(cel->err); cel->err = 0x0; } prjfree(&(cel->prj)); return 0; } /*--------------------------------------------------------------------------*/ int celprt(cel) const struct celprm *cel; { int i; if (cel == 0x0) return CELERR_NULL_POINTER; wcsprintf(" flag: %d\n", cel->flag); wcsprintf(" offset: %d\n", cel->offset); if (undefined(cel->phi0)) { wcsprintf(" phi0: UNDEFINED\n"); } else { wcsprintf(" phi0: %9f\n", cel->phi0); } if (undefined(cel->theta0)) { wcsprintf(" theta0: UNDEFINED\n"); } else { wcsprintf(" theta0: %9f\n", cel->theta0); } wcsprintf(" ref:"); for (i = 0; i < 4; i++) { wcsprintf(" %- 11.5g", cel->ref[i]); } wcsprintf("\n"); wcsprintf(" prj: (see below)\n"); wcsprintf(" euler:"); for (i = 0; i < 5; i++) { wcsprintf(" %- 11.5g", cel->euler[i]); } wcsprintf("\n"); wcsprintf(" latpreq: %d", cel->latpreq); if (cel->latpreq == 0) { wcsprintf(" (not required)\n"); } else if (cel->latpreq == 1) { wcsprintf(" (disambiguation)\n"); } else if (cel->latpreq == 2) { wcsprintf(" (specification)\n"); } else { wcsprintf(" (UNDEFINED)\n"); } wcsprintf(" isolat: %d\n", cel->isolat); WCSPRINTF_PTR(" err: ", cel->err, "\n"); if (cel->err) { wcserr_prt(cel->err, " "); } wcsprintf("\n"); wcsprintf(" prj.*\n"); prjprt(&(cel->prj)); return 0; } /*--------------------------------------------------------------------------*/ int celset(cel) struct celprm *cel; { static const char *function = "celset"; const double tol = 1.0e-10; double clat0, cphip, cthe0, lat0, lng0, phip, slat0, slz, sphip, sthe0; double latp, latp1, latp2, lngp; double u, v, x, y, z; struct prjprm *celprj; struct wcserr **err; if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); /* Initialize the projection driver routines. */ celprj = &(cel->prj); if (cel->offset) { celprj->phi0 = cel->phi0; celprj->theta0 = cel->theta0; } else { /* Ensure that these are undefined - no fiducial offset. */ celprj->phi0 = UNDEFINED; celprj->theta0 = UNDEFINED; } if (prjset(celprj)) { return wcserr_set(CEL_ERRMSG(CELERR_BAD_PARAM)); } /* Defaults set by the projection routines. */ if (undefined(cel->phi0)) { cel->phi0 = celprj->phi0; } if (undefined(cel->theta0)) { cel->theta0 = celprj->theta0; } else if (fabs(cel->theta0) > 90.0) { if (fabs(cel->theta0) > 90.0 + tol) { return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS), "Invalid coordinate transformation parameters: theta0 > 90"); } if (cel->theta0 > 90.0) { cel->theta0 = 90.0; } else { cel->theta0 = -90.0; } } lng0 = cel->ref[0]; lat0 = cel->ref[1]; phip = cel->ref[2]; latp = cel->ref[3]; /* Set default for native longitude of the celestial pole? */ if (undefined(phip) || phip == 999.0) { phip = (lat0 < cel->theta0) ? 180.0 : 0.0; phip += cel->phi0; if (phip < -180.0) { phip += 360.0; } else if (phip > 180.0) { phip -= 360.0; } cel->ref[2] = phip; } /* Compute celestial coordinates of the native pole. */ cel->latpreq = 0; if (cel->theta0 == 90.0) { /* Fiducial point at the native pole. */ lngp = lng0; latp = lat0; } else { /* Fiducial point away from the native pole. */ sincosd(lat0, &slat0, &clat0); sincosd(cel->theta0, &sthe0, &cthe0); if (phip == cel->phi0) { sphip = 0.0; cphip = 1.0; u = cel->theta0; v = 90.0 - lat0; } else { sincosd(phip - cel->phi0, &sphip, &cphip); x = cthe0*cphip; y = sthe0; z = sqrt(x*x + y*y); if (z == 0.0) { if (slat0 != 0.0) { return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS), "Invalid coordinate description:\n" "lat0 == 0 is required for |phip - phi0| = 90 and theta0 == 0"); } /* latp determined solely by LATPOLEa in this case. */ cel->latpreq = 2; if (latp > 90.0) { latp = 90.0; } else if (latp < -90.0) { latp = -90.0; } } else { slz = slat0/z; if (fabs(slz) > 1.0) { if ((fabs(slz) - 1.0) < tol) { if (slz > 0.0) { slz = 1.0; } else { slz = -1.0; } } else { return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS), "Invalid coordinate description:\n|lat0| <= %.3f is required " "for these values of phip, phi0, and theta0", asind(z)); } } u = atan2d(y,x); v = acosd(slz); } } if (cel->latpreq == 0) { latp1 = u + v; if (latp1 > 180.0) { latp1 -= 360.0; } else if (latp1 < -180.0) { latp1 += 360.0; } latp2 = u - v; if (latp2 > 180.0) { latp2 -= 360.0; } else if (latp2 < -180.0) { latp2 += 360.0; } if (fabs(latp1) < 90.0+tol && fabs(latp2) < 90.0+tol) { /* There are two valid solutions for latp. */ cel->latpreq = 1; } if (fabs(latp-latp1) < fabs(latp-latp2)) { if (fabs(latp1) < 90.0+tol) { latp = latp1; } else { latp = latp2; } } else { if (fabs(latp2) < 90.0+tol) { latp = latp2; } else { latp = latp1; } } /* Account for rounding error. */ if (fabs(latp) < 90.0+tol) { if (latp > 90.0) { latp = 90.0; } else if (latp < -90.0) { latp = -90.0; } } } z = cosd(latp)*clat0; if (fabs(z) < tol) { if (fabs(clat0) < tol) { /* Celestial pole at the fiducial point. */ lngp = lng0; } else if (latp > 0.0) { /* Celestial north pole at the native pole.*/ lngp = lng0 + phip - cel->phi0 - 180.0; } else { /* Celestial south pole at the native pole. */ lngp = lng0 - phip + cel->phi0; } } else { x = (sthe0 - sind(latp)*slat0)/z; y = sphip*cthe0/clat0; if (x == 0.0 && y == 0.0) { /* Sanity check (shouldn't be possible). */ return wcserr_set(WCSERR_SET(CELERR_BAD_COORD_TRANS), "Invalid coordinate transformation parameters, internal error"); } lngp = lng0 - atan2d(y,x); } /* Make celestial longitude of the native pole the same sign as at the fiducial point. */ if (lng0 >= 0.0) { if (lngp < 0.0) { lngp += 360.0; } else if (lngp > 360.0) { lngp -= 360.0; } } else { if (lngp > 0.0) { lngp -= 360.0; } else if (lngp < -360.0) { lngp += 360.0; } } } /* Reset LATPOLEa. */ cel->ref[3] = latp; /* Set the Euler angles. */ cel->euler[0] = lngp; cel->euler[1] = 90.0 - latp; cel->euler[2] = phip; sincosd(cel->euler[1], &cel->euler[4], &cel->euler[3]); cel->isolat = (cel->euler[4] == 0.0); cel->flag = CELSET; /* Check for ill-conditioned parameters. */ if (fabs(latp) > 90.0+tol) { return wcserr_set(WCSERR_SET(CELERR_ILL_COORD_TRANS), "Ill-conditioned coordinate transformation parameters\nNo valid " "solution for latp for these values of phip, phi0, and theta0"); } return 0; } /*--------------------------------------------------------------------------*/ int celx2s(cel, nx, ny, sxy, sll, x, y, phi, theta, lng, lat, stat) struct celprm *cel; int nx, ny, sxy, sll; const double x[], y[]; double phi[], theta[]; double lng[], lat[]; int stat[]; { static const char *function = "celx2s"; int nphi, status; struct prjprm *celprj; struct wcserr **err; /* Initialize. */ if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); if (cel->flag != CELSET) { if ((status = celset(cel))) return status; } /* Apply spherical deprojection. */ celprj = &(cel->prj); if ((status = celprj->prjx2s(celprj, nx, ny, sxy, 1, x, y, phi, theta, stat))) { if (status == PRJERR_BAD_PIX) { status = CELERR_BAD_PIX; } wcserr_set(CEL_ERRMSG(status)); if (status != CELERR_BAD_PIX) return status; } nphi = (ny > 0) ? (nx*ny) : nx; /* Compute celestial coordinates. */ sphx2s(cel->euler, nphi, 0, 1, sll, phi, theta, lng, lat); return status; } /*--------------------------------------------------------------------------*/ int cels2x(cel, nlng, nlat, sll, sxy, lng, lat, phi, theta, x, y, stat) struct celprm *cel; int nlng, nlat, sll, sxy; const double lng[], lat[]; double phi[], theta[]; double x[], y[]; int stat[]; { static const char *function = "cels2x"; int nphi, ntheta, status; struct prjprm *celprj; struct wcserr **err; /* Initialize. */ if (cel == 0x0) return CELERR_NULL_POINTER; err = &(cel->err); if (cel->flag != CELSET) { if ((status = celset(cel))) return status; } /* Compute native coordinates. */ sphs2x(cel->euler, nlng, nlat, sll, 1, lng, lat, phi, theta); if (cel->isolat) { /* Constant celestial latitude -> constant native latitude. */ nphi = nlng; ntheta = nlat; } else { nphi = (nlat > 0) ? (nlng*nlat) : nlng; ntheta = 0; } /* Apply the spherical projection. */ celprj = &(cel->prj); if ((status = celprj->prjs2x(celprj, nphi, ntheta, 1, sxy, phi, theta, x, y, stat))) { if (status != PRJERR_BAD_PARAM) { status = CELERR_BAD_WORLD; } return wcserr_set(CEL_ERRMSG(status)); } return 0; } astropy-0.3/cextern/wcslib/C/getwcstab.h0000644000175000017500000001604612243255342016457 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: getwcstab.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * Summary of the getwcstab routines * --------------------------------- * fits_read_wcstab(), an implementation of a FITS table reading routine for * 'TAB' coordinates, is provided for CFITSIO programmers. It has been * incorporated into CFITSIO as of v3.006 with the definitions in this file, * getwcstab.h, moved into fitsio.h. * * fits_read_wcstab() is not included in the WCSLIB object library but the * source code is presented here as it may be useful for programmers using an * older version of CFITSIO than 3.006, or as a programming template for * non-CFITSIO programmers. * * * fits_read_wcstab() - FITS 'TAB' table reading routine * ---------------------------------------------------- * fits_read_wcstab() extracts arrays from a binary table required in * constructing 'TAB' coordinates. * * Given: * fptr fitsfile * * Pointer to the file handle returned, for example, by * the fits_open_file() routine in CFITSIO. * * nwtb int Number of arrays to be read from the binary table(s). * * Given and returned: * wtb wtbarr * Address of the first element of an array of wtbarr * typedefs. This wtbarr typedef is defined to match the * wtbarr struct defined in WCSLIB. An array of such * structs returned by the WCSLIB function wcstab() as * discussed in the notes below. * * Returned: * status int * CFITSIO status value. * * Function return value: * int CFITSIO status value. * * Notes: * In order to maintain WCSLIB and CFITSIO as independent libraries it is not * permissible for any CFITSIO library code to include WCSLIB header files, * or vice versa. However, the CFITSIO function fits_read_wcstab() accepts * an array of wtbarr structs defined in wcs.h within WCSLIB. * * The problem therefore is to define the wtbarr struct within fitsio.h * without including wcs.h, especially noting that wcs.h will often (but not * always) be included together with fitsio.h in an applications program that * uses fits_read_wcstab(). * * The solution adopted is for WCSLIB to define "struct wtbarr" while * fitsio.h defines "typedef wtbarr" as an untagged struct with identical * members. This allows both wcs.h and fitsio.h to define a wtbarr data type * without conflict by virtue of the fact that structure tags and typedef * names share different name spaces in C; Appendix A, Sect. A11.1 (p227) of * the K&R ANSI edition states that: * * Identifiers fall into several name spaces that do not interfere with one * another; the same identifier may be used for different purposes, even in * the same scope, if the uses are in different name spaces. These classes * are: objects, functions, typedef names, and enum constants; labels; tags * of structures, unions, and enumerations; and members of each structure * or union individually. * * Therefore, declarations within WCSLIB look like * = struct wtbarr *w; * * while within CFITSIO they are simply * = wtbarr *w; * * As suggested by the commonality of the names, these are really the same * aggregate data type. However, in passing a (struct wtbarr *) to * fits_read_wcstab() a cast to (wtbarr *) is formally required. * * When using WCSLIB and CFITSIO together in C++ the situation is complicated * by the fact that typedefs and structs share the same namespace; C++ * Annotated Reference Manual, Sect. 7.1.3 (p105). In that case the wtbarr * struct in wcs.h is renamed by preprocessor macro substitution to wtbarr_s * to distinguish it from the typedef defined in fitsio.h. However, the * scope of this macro substitution is limited to wcs.h itself and CFITSIO * programmer code, whether in C++ or C, should always use the wtbarr * typedef. * * * wtbarr typedef * -------------- * The wtbarr typedef is defined as a struct containing the following members: * * int i * Image axis number. * * int m * Array axis number for index vectors. * * int kind * Character identifying the array type: * - c: coordinate array, * - i: index vector. * * char extnam[72] * EXTNAME identifying the binary table extension. * * int extver * EXTVER identifying the binary table extension. * * int extlev * EXTLEV identifying the binary table extension. * * char ttype[72] * TTYPEn identifying the column of the binary table that contains the * array. * * long row * Table row number. * * int ndim * Expected dimensionality of the array. * * int *dimlen * Address of the first element of an array of int of length ndim into * which the array axis lengths are to be written. * * double **arrayp * Pointer to an array of double which is to be allocated by the user * and into which the array is to be written. * *===========================================================================*/ #ifndef WCSLIB_GETWCSTAB #define WCSLIB_GETWCSTAB #ifdef __cplusplus extern "C" { #endif #include typedef struct { int i; /* Image axis number. */ int m; /* Array axis number for index vectors. */ int kind; /* Array type, 'c' (coord) or 'i' (index). */ char extnam[72]; /* EXTNAME of binary table extension. */ int extver; /* EXTVER of binary table extension. */ int extlev; /* EXTLEV of binary table extension. */ char ttype[72]; /* TTYPEn of column containing the array. */ long row; /* Table row number. */ int ndim; /* Expected array dimensionality. */ int *dimlen; /* Where to write the array axis lengths. */ double **arrayp; /* Where to write the address of the array */ /* allocated to store the array. */ } wtbarr; int fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status); #ifdef __cplusplus } #endif #endif /* WCSLIB_GETWCSTAB */ astropy-0.3/cextern/wcslib/C/prj.c0000644000175000017500000054416112243255342015266 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: prj.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcstrig.h" #include "wcsutil.h" #include "prj.h" /* Projection categories. */ const int ZENITHAL = 1; const int CYLINDRICAL = 2; const int PSEUDOCYLINDRICAL = 3; const int CONVENTIONAL = 4; const int CONIC = 5; const int POLYCONIC = 6; const int QUADCUBE = 7; const int HEALPIX = 8; const char prj_categories[9][32] = {"undefined", "zenithal", "cylindrical", "pseudocylindrical", "conventional", "conic", "polyconic", "quadcube", "HEALPix"}; /* Projection codes. */ const int prj_ncode = 28; const char prj_codes[28][4] = {"AZP", "SZP", "TAN", "STG", "SIN", "ARC", "ZPN", "ZEA", "AIR", "CYP", "CEA", "CAR", "MER", "COP", "COE", "COD", "COO", "SFL", "PAR", "MOL", "AIT", "BON", "PCO", "TSC", "CSC", "QSC", "HPX", "XPH"}; const int AZP = 101; const int SZP = 102; const int TAN = 103; const int STG = 104; const int SIN = 105; const int ARC = 106; const int ZPN = 107; const int ZEA = 108; const int AIR = 109; const int CYP = 201; const int CEA = 202; const int CAR = 203; const int MER = 204; const int SFL = 301; const int PAR = 302; const int MOL = 303; const int AIT = 401; const int COP = 501; const int COE = 502; const int COD = 503; const int COO = 504; const int BON = 601; const int PCO = 602; const int TSC = 701; const int CSC = 702; const int QSC = 703; const int HPX = 801; const int XPH = 802; /* Map status return value to message. */ const char *prj_errmsg[] = { "Success", "Null prjprm pointer passed", "Invalid projection parameters", "One or more of the (x,y) coordinates were invalid", "One or more of the (phi,theta) coordinates were invalid"}; /* Convenience macros for generating common error messages. */ #define PRJERR_BAD_PARAM_SET(function) \ wcserr_set(&(prj->err), PRJERR_BAD_PARAM, function, __FILE__, __LINE__, \ "Invalid parameters for %s projection", prj->name); #define PRJERR_BAD_PIX_SET(function) \ wcserr_set(&(prj->err), PRJERR_BAD_PIX, function, __FILE__, __LINE__, \ "One or more of the (x, y) coordinates were invalid for %s projection", \ prj->name); #define PRJERR_BAD_WORLD_SET(function) \ wcserr_set(&(prj->err), PRJERR_BAD_WORLD, function, __FILE__, __LINE__, \ "One or more of the (lat, lng) coordinates were invalid for " \ "%s projection", prj->name); #define copysign(X, Y) ((Y) < 0.0 ? -fabs(X) : fabs(X)) /*============================================================================ * Generic routines. * * prjini initializes a prjprm struct to default values. * * prjprt prints the contents of a prjprm struct. * * prjset invokes the specific initialization routine based on the projection * code in the prjprm struct. * * prjx2s invokes the specific deprojection routine based on the pointer-to- * function stored in the prjprm struct. * * prjs2x invokes the specific projection routine based on the pointer-to- * function stored in the prjprm struct. * *---------------------------------------------------------------------------*/ int prjini(prj) struct prjprm *prj; { register int k; if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = 0; strcpy(prj->code, " "); prj->pv[0] = 0.0; prj->pv[1] = UNDEFINED; prj->pv[2] = UNDEFINED; prj->pv[3] = UNDEFINED; for (k = 4; k < PVN; prj->pv[k++] = 0.0); prj->r0 = 0.0; prj->phi0 = UNDEFINED; prj->theta0 = UNDEFINED; prj->bounds = 1; strcpy(prj->name, "undefined"); for (k = 9; k < 40; prj->name[k++] = '\0'); prj->category = 0; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 0; prj->x0 = 0.0; prj->y0 = 0.0; prj->err = 0x0; prj->padding = 0x0; for (k = 0; k < 10; prj->w[k++] = 0.0); prj->m = 0; prj->n = 0; prj->prjx2s = 0x0; prj->prjs2x = 0x0; return 0; } /*--------------------------------------------------------------------------*/ int prjfree(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->err) { free(prj->err); prj->err = 0x0; } return 0; } /*--------------------------------------------------------------------------*/ int prjprt(prj) const struct prjprm *prj; { char hext[32]; int i, n; if (prj == 0x0) return PRJERR_NULL_POINTER; wcsprintf(" flag: %d\n", prj->flag); wcsprintf(" code: \"%s\"\n", prj->code); wcsprintf(" r0: %9f\n", prj->r0); wcsprintf(" pv:"); if (prj->pvrange) { n = (prj->pvrange)%100; if (prj->pvrange/100) { wcsprintf(" (0)"); } else { wcsprintf(" %- 11.5g", prj->pv[0]); n--; } for (i = 1; i <= n; i++) { if (i%5 == 1) { wcsprintf("\n "); } if (undefined(prj->pv[i])) { wcsprintf(" UNDEFINED "); } else { wcsprintf(" %- 11.5g", prj->pv[i]); } } wcsprintf("\n"); } else { wcsprintf(" (not used)\n"); } if (undefined(prj->phi0)) { wcsprintf(" phi0: UNDEFINED\n"); } else { wcsprintf(" phi0: %9f\n", prj->phi0); } if (undefined(prj->theta0)) { wcsprintf(" theta0: UNDEFINED\n"); } else { wcsprintf(" theta0: %9f\n", prj->theta0); } wcsprintf(" bounds: %d\n", prj->bounds); wcsprintf("\n"); wcsprintf(" name: \"%s\"\n", prj->name); wcsprintf(" category: %d (%s)\n", prj->category, prj_categories[prj->category]); wcsprintf(" pvrange: %d\n", prj->pvrange); wcsprintf(" simplezen: %d\n", prj->simplezen); wcsprintf(" equiareal: %d\n", prj->equiareal); wcsprintf(" conformal: %d\n", prj->conformal); wcsprintf(" global: %d\n", prj->global); wcsprintf(" divergent: %d\n", prj->divergent); wcsprintf(" x0: %f\n", prj->x0); wcsprintf(" y0: %f\n", prj->y0); WCSPRINTF_PTR(" err: ", prj->err, "\n"); if (prj->err) { wcserr_prt(prj->err, " "); } wcsprintf(" w[]:"); for (i = 0; i < 5; i++) { wcsprintf(" %- 11.5g", prj->w[i]); } wcsprintf("\n "); for (i = 5; i < 10; i++) { wcsprintf(" %- 11.5g", prj->w[i]); } wcsprintf("\n"); wcsprintf(" m: %d\n", prj->m); wcsprintf(" n: %d\n", prj->n); wcsprintf(" prjx2s: %s\n", wcsutil_fptr2str((int (*)(void))prj->prjx2s, hext)); wcsprintf(" prjs2x: %s\n", wcsutil_fptr2str((int (*)(void))prj->prjs2x, hext)); return 0; } /*--------------------------------------------------------------------------*/ int prjset(prj) struct prjprm *prj; { static const char *function = "prjset"; int status; struct wcserr **err; if (prj == 0x0) return PRJERR_NULL_POINTER; err = &(prj->err); /* Invoke the relevant initialization routine. */ prj->code[3] = '\0'; if (strcmp(prj->code, "AZP") == 0) { status = azpset(prj); } else if (strcmp(prj->code, "SZP") == 0) { status = szpset(prj); } else if (strcmp(prj->code, "TAN") == 0) { status = tanset(prj); } else if (strcmp(prj->code, "STG") == 0) { status = stgset(prj); } else if (strcmp(prj->code, "SIN") == 0) { status = sinset(prj); } else if (strcmp(prj->code, "ARC") == 0) { status = arcset(prj); } else if (strcmp(prj->code, "ZPN") == 0) { status = zpnset(prj); } else if (strcmp(prj->code, "ZEA") == 0) { status = zeaset(prj); } else if (strcmp(prj->code, "AIR") == 0) { status = airset(prj); } else if (strcmp(prj->code, "CYP") == 0) { status = cypset(prj); } else if (strcmp(prj->code, "CEA") == 0) { status = ceaset(prj); } else if (strcmp(prj->code, "CAR") == 0) { status = carset(prj); } else if (strcmp(prj->code, "MER") == 0) { status = merset(prj); } else if (strcmp(prj->code, "SFL") == 0) { status = sflset(prj); } else if (strcmp(prj->code, "PAR") == 0) { status = parset(prj); } else if (strcmp(prj->code, "MOL") == 0) { status = molset(prj); } else if (strcmp(prj->code, "AIT") == 0) { status = aitset(prj); } else if (strcmp(prj->code, "COP") == 0) { status = copset(prj); } else if (strcmp(prj->code, "COE") == 0) { status = coeset(prj); } else if (strcmp(prj->code, "COD") == 0) { status = codset(prj); } else if (strcmp(prj->code, "COO") == 0) { status = cooset(prj); } else if (strcmp(prj->code, "BON") == 0) { status = bonset(prj); } else if (strcmp(prj->code, "PCO") == 0) { status = pcoset(prj); } else if (strcmp(prj->code, "TSC") == 0) { status = tscset(prj); } else if (strcmp(prj->code, "CSC") == 0) { status = cscset(prj); } else if (strcmp(prj->code, "QSC") == 0) { status = qscset(prj); } else if (strcmp(prj->code, "HPX") == 0) { status = hpxset(prj); } else if (strcmp(prj->code, "XPH") == 0) { status = xphset(prj); } else { /* Unrecognized projection code. */ status = wcserr_set(WCSERR_SET(PRJERR_BAD_PARAM), "Unrecognized projection code '%s'", prj->code); } return status; } /*--------------------------------------------------------------------------*/ int prjx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int status; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag == 0) { if ((status = prjset(prj))) return status; } return prj->prjx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat); } /*--------------------------------------------------------------------------*/ int prjs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int status; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag == 0) { if ((status = prjset(prj))) return status; } return prj->prjs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat); } /*============================================================================ * Internal helper routine used by the *set() routines that forces * (x,y) = (0,0) at (phi0,theta0). *---------------------------------------------------------------------------*/ int prjoff(prj, phi0, theta0) struct prjprm *prj; const double phi0, theta0; { int stat; double x0, y0; if (prj == 0x0) return PRJERR_NULL_POINTER; prj->x0 = 0.0; prj->y0 = 0.0; if (undefined(prj->phi0) || undefined(prj->theta0)) { /* Set both to the projection-specific default if either undefined. */ prj->phi0 = phi0; prj->theta0 = theta0; } else { if (prj->prjs2x(prj, 1, 1, 1, 1, &(prj->phi0), &(prj->theta0), &x0, &y0, &stat)) { return PRJERR_BAD_PARAM_SET("prjoff"); } prj->x0 = x0; prj->y0 = y0; } return 0; } /*============================================================================ * AZP: zenithal/azimuthal perspective projection. * * Given: * prj->pv[1] Distance parameter, mu in units of r0. * prj->pv[2] Tilt angle, gamma in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag AZP * prj->code "AZP" * prj->x0 Offset in x. * prj->y0 Offset in y. * prj->w[0] r0*(mu+1) * prj->w[1] tan(gamma) * prj->w[2] sec(gamma) * prj->w[3] cos(gamma) * prj->w[4] sin(gamma) * prj->w[5] asin(-1/mu) for |mu| >= 1, -90 otherwise * prj->w[6] mu*cos(gamma) * prj->w[7] 1 if |mu*cos(gamma)| < 1, 0 otherwise * prj->prjx2s Pointer to azpx2s(). * prj->prjs2x Pointer to azps2x(). *===========================================================================*/ int azpset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = AZP; strcpy(prj->code, "AZP"); if (undefined(prj->pv[1])) prj->pv[1] = 0.0; if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "zenithal/azimuthal perspective"); prj->category = ZENITHAL; prj->pvrange = 102; prj->simplezen = prj->pv[2] == 0.0; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = prj->pv[1] <= 1.0; prj->w[0] = prj->r0*(prj->pv[1] + 1.0); if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("azpset"); } prj->w[3] = cosd(prj->pv[2]); if (prj->w[3] == 0.0) { return PRJERR_BAD_PARAM_SET("azpset"); } prj->w[2] = 1.0/prj->w[3]; prj->w[4] = sind(prj->pv[2]); prj->w[1] = prj->w[4] / prj->w[3]; if (fabs(prj->pv[1]) > 1.0) { prj->w[5] = asind(-1.0/prj->pv[1]); } else { prj->w[5] = -90.0; } prj->w[6] = prj->pv[1] * prj->w[3]; prj->w[7] = (fabs(prj->w[6]) < 1.0) ? 1.0 : 0.0; prj->prjx2s = azpx2s; prj->prjs2x = azps2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int azpx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double a, b, q, r, s, t, xj, yj, yc, yc2; const double tol = 1.0e-13; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AZP) { if ((status = azpset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yc = yj*prj->w[3]; yc2 = yc*yc; q = prj->w[0] + yj*prj->w[4]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yc2); if (r == 0.0) { *phip = 0.0; *thetap = 90.0; *(statp++) = 0; } else { *phip = atan2d(xj, -yc); s = r / q; t = s*prj->pv[1]/sqrt(s*s + 1.0); s = atan2d(1.0, s); if (fabs(t) > 1.0) { if (fabs(t) > 1.0+tol) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("azpx2s"); continue; } t = copysign(90.0, t); } else { t = asind(t); } a = s - t; b = s + t + 180.0; if (a > 90.0) a -= 360.0; if (b > 90.0) b -= 360.0; *thetap = (a > b) ? a : b; *(statp++) = 0; } } } return status; } /*--------------------------------------------------------------------------*/ int azps2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double a, b, cosphi, costhe, r, s, sinphi, sinthe, t; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AZP) { if ((status = azpset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { s = prj->w[1]*(*yp); t = (prj->pv[1] + sinthe) + costhe*s; if (t == 0.0) { *xp = 0.0; *yp = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_WORLD_SET("azps2x"); } else { r = prj->w[0]*costhe/t; /* Bounds checking. */ istat = 0; if (prj->bounds) { if (*thetap < prj->w[5]) { /* Overlap. */ istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("azps2x"); } else if (prj->w[7] > 0.0) { /* Divergence. */ t = prj->pv[1] / sqrt(1.0 + s*s); if (fabs(t) <= 1.0) { s = atand(-s); t = asind(t); a = s - t; b = s + t + 180.0; if (a > 90.0) a -= 360.0; if (b > 90.0) b -= 360.0; if (*thetap < ((a > b) ? a : b)) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("azps2x"); } } } } *xp = r*(*xp) - prj->x0; *yp = -r*(*yp)*prj->w[2] - prj->y0; *(statp++) = istat; } } } return status; } /*============================================================================ * SZP: slant zenithal perspective projection. * * Given: * prj->pv[1] Distance of the point of projection from the centre of the * generating sphere, mu in units of r0. * prj->pv[2] Native longitude, phi_c, and ... * prj->pv[3] Native latitude, theta_c, on the planewards side of the * intersection of the line through the point of projection * and the centre of the generating sphere, phi_c in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag SZP * prj->code "SZP" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 1/r0 * prj->w[1] xp = -mu*cos(theta_c)*sin(phi_c) * prj->w[2] yp = mu*cos(theta_c)*cos(phi_c) * prj->w[3] zp = mu*sin(theta_c) + 1 * prj->w[4] r0*xp * prj->w[5] r0*yp * prj->w[6] r0*zp * prj->w[7] (zp - 1)^2 * prj->w[8] asin(1-zp) if |1 - zp| < 1, -90 otherwise * prj->prjx2s Pointer to szpx2s(). * prj->prjs2x Pointer to szps2x(). *===========================================================================*/ int szpset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = SZP; strcpy(prj->code, "SZP"); if (undefined(prj->pv[1])) prj->pv[1] = 0.0; if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (undefined(prj->pv[3])) prj->pv[3] = 90.0; if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "slant zenithal perspective"); prj->category = ZENITHAL; prj->pvrange = 103; prj->simplezen = prj->pv[3] == 90.0; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = prj->pv[1] <= 1.0; prj->w[0] = 1.0/prj->r0; prj->w[3] = prj->pv[1] * sind(prj->pv[3]) + 1.0; if (prj->w[3] == 0.0) { return PRJERR_BAD_PARAM_SET("szpset"); } prj->w[1] = -prj->pv[1] * cosd(prj->pv[3]) * sind(prj->pv[2]); prj->w[2] = prj->pv[1] * cosd(prj->pv[3]) * cosd(prj->pv[2]); prj->w[4] = prj->r0 * prj->w[1]; prj->w[5] = prj->r0 * prj->w[2]; prj->w[6] = prj->r0 * prj->w[3]; prj->w[7] = (prj->w[3] - 1.0) * prj->w[3] - 1.0; if (fabs(prj->w[3] - 1.0) < 1.0) { prj->w[8] = asind(1.0 - prj->w[3]); } else { prj->w[8] = -90.0; } prj->prjx2s = szpx2s; prj->prjs2x = szps2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int szpx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double a, b, c, d, r2, sinth1, sinth2, sinthe, t, x1, xr, xy, y1, yr, z; const double tol = 1.0e-13; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SZP) { if ((status = szpset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xr = (*xp + prj->x0)*prj->w[0]; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xr; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yr = (*yp + prj->y0)*prj->w[0]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xr = *phip; r2 = xr*xr + yr*yr; x1 = (xr - prj->w[1])/prj->w[3]; y1 = (yr - prj->w[2])/prj->w[3]; xy = xr*x1 + yr*y1; if (r2 < 1.0e-10) { /* Use small angle formula. */ z = r2/2.0; *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy)); } else { t = x1*x1 + y1*y1; a = t + 1.0; b = xy - t; c = r2 - xy - xy + t - 1.0; d = b*b - a*c; /* Check for a solution. */ if (d < 0.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("szpx2s"); continue; } d = sqrt(d); /* Choose solution closest to pole. */ sinth1 = (-b + d)/a; sinth2 = (-b - d)/a; sinthe = (sinth1 > sinth2) ? sinth1 : sinth2; if (sinthe > 1.0) { if (sinthe-1.0 < tol) { sinthe = 1.0; } else { sinthe = (sinth1 < sinth2) ? sinth1 : sinth2; } } if (sinthe < -1.0) { if (sinthe+1.0 > -tol) { sinthe = -1.0; } } if (sinthe > 1.0 || sinthe < -1.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("szpx2s"); continue; } *thetap = asind(sinthe); z = 1.0 - sinthe; } *phip = atan2d(xr - x1*z, -(yr - y1*z)); *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int szps2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double a, b, cosphi, r, s, sinphi, t, u, v; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SZP) { if ((status = szpset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { s = 1.0 - sind(*thetap); t = prj->w[3] - s; if (t == 0.0) { for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = 0.0; *yp = 0.0; *(statp++) = 1; } if (!status) status = PRJERR_BAD_WORLD_SET("szps2x"); } else { r = prj->w[6]*cosd(*thetap)/t; u = prj->w[4]*s/t + prj->x0; v = prj->w[5]*s/t + prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { /* Bounds checking. */ istat = 0; if (prj->bounds) { if (*thetap < prj->w[8]) { /* Divergence. */ istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("szps2x"); } else if (fabs(prj->pv[1]) > 1.0) { /* Overlap. */ s = prj->w[1]*(*xp) - prj->w[2]*(*yp); t = 1.0/sqrt(prj->w[7] + s*s); if (fabs(t) <= 1.0) { s = atan2d(s, prj->w[3] - 1.0); t = asind(t); a = s - t; b = s + t + 180.0; if (a > 90.0) a -= 360.0; if (b > 90.0) b -= 360.0; if (*thetap < ((a > b) ? a : b)) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("szps2x"); } } } } *xp = r*(*xp) - u; *yp = -r*(*yp) - v; *(statp++) = istat; } } } return status; } /*============================================================================ * TAN: gnomonic projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag TAN * prj->code "TAN" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->prjx2s Pointer to tanx2s(). * prj->prjs2x Pointer to tans2x(). *===========================================================================*/ int tanset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = TAN; strcpy(prj->code, "TAN"); if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "gnomonic"); prj->category = ZENITHAL; prj->pvrange = 0; prj->simplezen = 1; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 1; prj->prjx2s = tanx2s; prj->prjs2x = tans2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int tanx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, xj, yj, yj2; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TAN) { if ((status = tanset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2); if (r == 0.0) { *phip = 0.0; } else { *phip = atan2d(xj, -yj); } *thetap = atan2d(prj->r0, r); *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int tans2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, r, s, sinphi; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TAN) { if ((status = tanset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { s = sind(*thetap); if (s == 0.0) { for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = 0.0; *yp = 0.0; *(statp++) = 1; } if (!status) status = PRJERR_BAD_WORLD_SET("tans2x"); } else { r = prj->r0*cosd(*thetap)/s; istat = 0; if (prj->bounds && s < 0.0) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("tans2x"); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = istat; } } } return status; } /*============================================================================ * STG: stereographic projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag STG * prj->code "STG" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 2*r0 * prj->w[1] 1/(2*r0) * prj->prjx2s Pointer to stgx2s(). * prj->prjs2x Pointer to stgs2x(). *===========================================================================*/ int stgset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = STG; strcpy(prj->code, "STG"); strcpy(prj->name, "stereographic"); prj->category = ZENITHAL; prj->pvrange = 0; prj->simplezen = 1; prj->equiareal = 0; prj->conformal = 1; prj->global = 0; prj->divergent = 1; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 360.0/PI; prj->w[1] = PI/360.0; } else { prj->w[0] = 2.0*prj->r0; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = stgx2s; prj->prjs2x = stgs2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int stgx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, xj, yj, yj2; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != STG) { if ((status = stgset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2); if (r == 0.0) { *phip = 0.0; } else { *phip = atan2d(xj, -yj); } *thetap = 90.0 - 2.0*atand(r*prj->w[1]); *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int stgs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, r, s, sinphi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != STG) { if ((status = stgset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { s = 1.0 + sind(*thetap); if (s == 0.0) { for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = 0.0; *yp = 0.0; *(statp++) = 1; } if (!status) status = PRJERR_BAD_WORLD_SET("stgs2x"); } else { r = prj->w[0]*cosd(*thetap)/s; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = 0; } } } return status; } /*============================================================================ * SIN: orthographic/synthesis projection. * * Given: * prj->pv[1:2] Obliqueness parameters, xi and eta. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag SIN * prj->code "SIN" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 1/r0 * prj->w[1] xi**2 + eta**2 * prj->w[2] xi**2 + eta**2 + 1 * prj->w[3] xi**2 + eta**2 - 1 * prj->prjx2s Pointer to sinx2s(). * prj->prjs2x Pointer to sins2x(). *===========================================================================*/ int sinset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = SIN; strcpy(prj->code, "SIN"); if (undefined(prj->pv[1])) prj->pv[1] = 0.0; if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "orthographic/synthesis"); prj->category = ZENITHAL; prj->pvrange = 102; prj->simplezen = (prj->pv[1] == 0.0 && prj->pv[2] == 0.0); prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 0; prj->w[0] = 1.0/prj->r0; prj->w[1] = prj->pv[1]*prj->pv[1] + prj->pv[2]*prj->pv[2]; prj->w[2] = prj->w[1] + 1.0; prj->w[3] = prj->w[1] - 1.0; prj->prjx2s = sinx2s; prj->prjs2x = sins2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int sinx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; const double tol = 1.0e-13; double a, b, c, d, eta, r2, sinth1, sinth2, sinthe, x0, xi, x1, xy, y0, y02, y1, z; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SIN) { if ((status = sinset(prj))) return status; } xi = prj->pv[1]; eta = prj->pv[2]; if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { x0 = (*xp + prj->x0)*prj->w[0]; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = x0; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { y0 = (*yp + prj->y0)*prj->w[0]; y02 = y0*y0; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { /* Compute intermediaries. */ x0 = *phip; r2 = x0*x0 + y02; if (prj->w[1] == 0.0) { /* Orthographic projection. */ if (r2 != 0.0) { *phip = atan2d(x0, -y0); } else { *phip = 0.0; } if (r2 < 0.5) { *thetap = acosd(sqrt(r2)); } else if (r2 <= 1.0) { *thetap = asind(sqrt(1.0 - r2)); } else { *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("sinx2s") continue; } } else { /* "Synthesis" projection. */ xy = x0*xi + y0*eta; if (r2 < 1.0e-10) { /* Use small angle formula. */ z = r2/2.0; *thetap = 90.0 - R2D*sqrt(r2/(1.0 + xy)); } else { a = prj->w[2]; b = xy - prj->w[1]; c = r2 - xy - xy + prj->w[3]; d = b*b - a*c; /* Check for a solution. */ if (d < 0.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("sinx2s") continue; } d = sqrt(d); /* Choose solution closest to pole. */ sinth1 = (-b + d)/a; sinth2 = (-b - d)/a; sinthe = (sinth1 > sinth2) ? sinth1 : sinth2; if (sinthe > 1.0) { if (sinthe-1.0 < tol) { sinthe = 1.0; } else { sinthe = (sinth1 < sinth2) ? sinth1 : sinth2; } } if (sinthe < -1.0) { if (sinthe+1.0 > -tol) { sinthe = -1.0; } } if (sinthe > 1.0 || sinthe < -1.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("sinx2s") continue; } *thetap = asind(sinthe); z = 1.0 - sinthe; } x1 = -y0 + eta*z; y1 = x0 - xi*z; if (x1 == 0.0 && y1 == 0.0) { *phip = 0.0; } else { *phip = atan2d(y1,x1); } } *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int sins2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, costhe, sinphi, r, t, z, z1, z2; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SIN) { if ((status = sinset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { t = (90.0 - fabs(*thetap))*D2R; if (t < 1.0e-5) { if (*thetap > 0.0) { z = t*t/2.0; } else { z = 2.0 - t*t/2.0; } costhe = t; } else { z = 1.0 - sind(*thetap); costhe = cosd(*thetap); } r = prj->r0*costhe; if (prj->w[1] == 0.0) { /* Orthographic projection. */ istat = 0; if (prj->bounds && *thetap < 0.0) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("sins2x"); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = istat; } } else { /* "Synthesis" projection. */ z *= prj->r0; z1 = prj->pv[1]*z - prj->x0; z2 = prj->pv[2]*z - prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { istat = 0; if (prj->bounds) { t = -atand(prj->pv[1]*(*xp) - prj->pv[2]*(*yp)); if (*thetap < t) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("sins2x"); } } *xp = r*(*xp) + z1; *yp = -r*(*yp) + z2; *(statp++) = istat; } } } return status; } /*============================================================================ * ARC: zenithal/azimuthal equidistant projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag ARC * prj->code "ARC" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->prjx2s Pointer to arcx2s(). * prj->prjs2x Pointer to arcs2x(). *===========================================================================*/ int arcset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = ARC; strcpy(prj->code, "ARC"); strcpy(prj->name, "zenithal/azimuthal equidistant"); prj->category = ZENITHAL; prj->pvrange = 0; prj->simplezen = 1; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = arcx2s; prj->prjs2x = arcs2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int arcx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, xj, yj, yj2; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ARC) { if ((status = arcset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2); if (r == 0.0) { *phip = 0.0; *thetap = 90.0; } else { *phip = atan2d(xj, -yj); *thetap = 90.0 - r*prj->w[1]; } *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int arcs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, r, sinphi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ARC) { if ((status = arcset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { r = prj->w[0]*(90.0 - *thetap); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = 0; } } return 0; } /*============================================================================ * ZPN: zenithal/azimuthal polynomial projection. * * Given: * prj->pv[] Polynomial coefficients. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag ZPN * prj->code "ZPN" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->n Degree of the polynomial, N. * prj->w[0] Co-latitude of the first point of inflection, radian. * prj->w[1] Radius of the first point of inflection (N > 1), radian. * prj->prjx2s Pointer to zpnx2s(). * prj->prjs2x Pointer to zpns2x(). *===========================================================================*/ int zpnset(prj) struct prjprm *prj; { int j, k, m; double d, d1, d2, r, zd, zd1, zd2; const double tol = 1.0e-13; if (prj == 0x0) return PRJERR_NULL_POINTER; strcpy(prj->code, "ZPN"); prj->flag = ZPN; if (undefined(prj->pv[1])) prj->pv[1] = 0.0; if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (undefined(prj->pv[3])) prj->pv[3] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "zenithal/azimuthal polynomial"); prj->category = ZENITHAL; prj->pvrange = 30; prj->simplezen = 1; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 0; /* Find the highest non-zero coefficient. */ for (k = PVN-1; k >= 0 && prj->pv[k] == 0.0; k--); if (k < 0) { return PRJERR_BAD_PARAM_SET("zpnset"); } prj->n = k; if (k < 2) { /* No point of inflection. */ prj->w[0] = PI; } else { /* Find the point of inflection closest to the pole. */ zd1 = 0.0; d1 = prj->pv[1]; if (d1 <= 0.0) { return PRJERR_BAD_PARAM_SET("zpnset"); } /* Find the point where the derivative first goes negative. */ for (j = 0; j < 180; j++) { zd2 = j*D2R; d2 = 0.0; for (m = k; m > 0; m--) { d2 = d2*zd2 + m*prj->pv[m]; } if (d2 <= 0.0) break; zd1 = zd2; d1 = d2; } if (j == 180) { /* No negative derivative -> no point of inflection. */ zd = PI; prj->global = 1; } else { /* Find where the derivative is zero. */ for (j = 1; j <= 10; j++) { zd = zd1 - d1*(zd2-zd1)/(d2-d1); d = 0.0; for (m = k; m > 0; m--) { d = d*zd + m*prj->pv[m]; } if (fabs(d) < tol) break; if (d < 0.0) { zd2 = zd; d2 = d; } else { zd1 = zd; d1 = d; } } } r = 0.0; for (m = k; m >= 0; m--) { r = r*zd + prj->pv[m]; } prj->w[0] = zd; prj->w[1] = r; } prj->prjx2s = zpnx2s; prj->prjs2x = zpns2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int zpnx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int j, k, m, mx, my, rowlen, rowoff, status; double a, b, c, d, lambda, r, r1, r2, rt, xj, yj, yj2, zd, zd1, zd2; const double tol = 1.0e-13; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZPN) { if ((status = zpnset(prj))) return status; } k = prj->n; if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2)/prj->r0; if (r == 0.0) { *phip = 0.0; } else { *phip = atan2d(xj, -yj); } if (k < 1) { /* Constant - no solution. */ return PRJERR_BAD_PARAM_SET("zpnx2s"); } else if (k == 1) { /* Linear. */ zd = (r - prj->pv[0])/prj->pv[1]; } else if (k == 2) { /* Quadratic. */ a = prj->pv[2]; b = prj->pv[1]; c = prj->pv[0] - r; d = b*b - 4.0*a*c; if (d < 0.0) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); continue; } d = sqrt(d); /* Choose solution closest to pole. */ zd1 = (-b + d)/(2.0*a); zd2 = (-b - d)/(2.0*a); zd = (zd1zd2) ? zd1 : zd2; if (zd < 0.0) { if (zd < -tol) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); continue; } zd = 0.0; } else if (zd > PI) { if (zd > PI+tol) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); continue; } zd = PI; } } else { /* Higher order - solve iteratively. */ zd1 = 0.0; r1 = prj->pv[0]; zd2 = prj->w[0]; r2 = prj->w[1]; if (r < r1) { if (r < r1-tol) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); continue; } zd = zd1; } else if (r > r2) { if (r > r2+tol) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zpnx2s"); continue; } zd = zd2; } else { /* Disect the interval. */ for (j = 0; j < 100; j++) { lambda = (r2 - r)/(r2 - r1); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } zd = zd2 - lambda*(zd2 - zd1); rt = 0.0; for (m = k; m >= 0; m--) { rt = (rt * zd) + prj->pv[m]; } if (rt < r) { if (r-rt < tol) break; r1 = rt; zd1 = zd; } else { if (rt-r < tol) break; r2 = rt; zd2 = zd; } if (fabs(zd2-zd1) < tol) break; } } } *thetap = 90.0 - zd*R2D; *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int zpns2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int m, mphi, mtheta, rowlen, rowoff, status; double cosphi, r, s, sinphi; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZPN) { if ((status = zpnset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { s = (90.0 - *thetap)*D2R; r = 0.0; for (m = prj->n; m >= 0; m--) { r = r*s + prj->pv[m]; } r *= prj->r0; istat = 0; if (prj->bounds && s > prj->w[0]) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("zpns2x"); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = istat; } } return status; } /*============================================================================ * ZEA: zenithal/azimuthal equal area projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag ZEA * prj->code "ZEA" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 2*r0 * prj->w[1] 1/(2*r0) * prj->prjx2s Pointer to zeax2s(). * prj->prjs2x Pointer to zeas2x(). *===========================================================================*/ int zeaset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = ZEA; strcpy(prj->code, "ZEA"); strcpy(prj->name, "zenithal/azimuthal equal area"); prj->category = ZENITHAL; prj->pvrange = 0; prj->simplezen = 1; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 360.0/PI; prj->w[1] = PI/360.0; } else { prj->w[0] = 2.0*prj->r0; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = zeax2s; prj->prjs2x = zeas2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int zeax2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, s, xj, yj, yj2; const double tol = 1.0e-12; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZEA) { if ((status = zeaset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2); if (r == 0.0) { *phip = 0.0; } else { *phip = atan2d(xj, -yj); } s = r*prj->w[1]; if (fabs(s) > 1.0) { if (fabs(r - prj->w[0]) < tol) { *thetap = -90.0; } else { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("zeax2s"); continue; } } else { *thetap = 90.0 - 2.0*asind(s); } *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int zeas2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, r, sinphi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != ZEA) { if ((status = zeaset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { r = prj->w[0]*sind((90.0 - *thetap)/2.0); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = 0; } } return 0; } /*============================================================================ * AIR: Airy's projection. * * Given: * prj->pv[1] Latitude theta_b within which the error is minimized, in * degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 90.0 if undefined. * * Returned: * prj->flag AIR * prj->code "AIR" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 2*r0 * prj->w[1] ln(cos(xi_b))/tan(xi_b)**2, where xi_b = (90-theta_b)/2 * prj->w[2] 1/2 - prj->w[1] * prj->w[3] 2*r0*prj->w[2] * prj->w[4] tol, cutoff for using small angle approximation, in * radians. * prj->w[5] prj->w[2]*tol * prj->w[6] (180/pi)/prj->w[2] * prj->prjx2s Pointer to airx2s(). * prj->prjs2x Pointer to airs2x(). *===========================================================================*/ int airset(prj) struct prjprm *prj; { const double tol = 1.0e-4; double cosxi; if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = AIR; strcpy(prj->code, "AIR"); if (undefined(prj->pv[1])) prj->pv[1] = 90.0; if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "Airy's zenithal"); prj->category = ZENITHAL; prj->pvrange = 101; prj->simplezen = 1; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 1; prj->w[0] = 2.0*prj->r0; if (prj->pv[1] == 90.0) { prj->w[1] = -0.5; prj->w[2] = 1.0; } else if (prj->pv[1] > -90.0) { cosxi = cosd((90.0 - prj->pv[1])/2.0); prj->w[1] = log(cosxi)*(cosxi*cosxi)/(1.0-cosxi*cosxi); prj->w[2] = 0.5 - prj->w[1]; } else { return PRJERR_BAD_PARAM_SET("airset"); } prj->w[3] = prj->w[0] * prj->w[2]; prj->w[4] = tol; prj->w[5] = prj->w[2]*tol; prj->w[6] = R2D/prj->w[2]; prj->prjx2s = airx2s; prj->prjs2x = airs2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int airx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int k, mx, my, rowlen, rowoff, status; double cosxi, lambda, r, r1, r2, rt, tanxi, x1, x2, xi, xj, yj, yj2; const double tol = 1.0e-12; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIR) { if ((status = airset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + yj2)/prj->w[0]; if (r == 0.0) { *phip = 0.0; } else { *phip = atan2d(xj, -yj); } if (r == 0.0) { xi = 0.0; } else if (r < prj->w[5]) { xi = r*prj->w[6]; } else { /* Find a solution interval. */ x1 = x2 = 1.0; r1 = r2 = 0.0; for (k = 0; k < 30; k++) { x2 = x1/2.0; tanxi = sqrt(1.0-x2*x2)/x2; r2 = -(log(x2)/tanxi + prj->w[1]*tanxi); if (r2 >= r) break; x1 = x2; r1 = r2; } if (k == 30) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("airx2s"); continue; } for (k = 0; k < 100; k++) { /* Weighted division of the interval. */ lambda = (r2-r)/(r2-r1); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } cosxi = x2 - lambda*(x2-x1); tanxi = sqrt(1.0-cosxi*cosxi)/cosxi; rt = -(log(cosxi)/tanxi + prj->w[1]*tanxi); if (rt < r) { if (r-rt < tol) break; r1 = rt; x1 = cosxi; } else { if (rt-r < tol) break; r2 = rt; x2 = cosxi; } } if (k == 100) { *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("airx2s"); continue; } xi = acosd(cosxi); } *thetap = 90.0 - 2.0*xi; *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int airs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, cosxi, r, tanxi, xi, sinphi; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIR) { if ((status = airset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { istat = 0; if (*thetap == 90.0) { r = 0.0; } else if (*thetap > -90.0) { xi = D2R*(90.0 - *thetap)/2.0; if (xi < prj->w[4]) { r = xi*prj->w[3]; } else { cosxi = cosd((90.0 - *thetap)/2.0); tanxi = sqrt(1.0-cosxi*cosxi)/cosxi; r = -prj->w[0]*(log(cosxi)/tanxi + prj->w[1]*tanxi); } } else { r = 0.0; istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("airs2x"); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - prj->y0; *(statp++) = istat; } } return status; } /*============================================================================ * CYP: cylindrical perspective projection. * * Given: * prj->pv[1] Distance of point of projection from the centre of the * generating sphere, mu, in units of r0. * prj->pv[2] Radius of the cylinder of projection, lambda, in units of * r0. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag CYP * prj->code "CYP" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*lambda*(pi/180) * prj->w[1] (180/pi)/(r0*lambda) * prj->w[2] r0*(mu + lambda) * prj->w[3] 1/(r0*(mu + lambda)) * prj->prjx2s Pointer to cypx2s(). * prj->prjs2x Pointer to cyps2x(). *===========================================================================*/ int cypset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = CYP; strcpy(prj->code, "CYP"); if (undefined(prj->pv[1])) prj->pv[1] = 1.0; if (undefined(prj->pv[2])) prj->pv[2] = 1.0; strcpy(prj->name, "cylindrical perspective"); prj->category = CYLINDRICAL; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = prj->pv[1] < -1.0 || 0.0 < prj->pv[1]; prj->divergent = !prj->global; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = prj->pv[2]; if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("cypset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[2] = R2D*(prj->pv[1] + prj->pv[2]); if (prj->w[2] == 0.0) { return PRJERR_BAD_PARAM_SET("cypset"); } prj->w[3] = 1.0/prj->w[2]; } else { prj->w[0] = prj->r0*prj->pv[2]*D2R; if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("cypset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[2] = prj->r0*(prj->pv[1] + prj->pv[2]); if (prj->w[2] == 0.0) { return PRJERR_BAD_PARAM_SET("cypset"); } prj->w[3] = 1.0/prj->w[2]; } prj->prjx2s = cypx2s; prj->prjs2x = cyps2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int cypx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double eta, s, t; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CYP) { if ((status = cypset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1]*(*xp + prj->x0); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; phip += rowlen; } } /* Do y dependence. */ yp = y; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { eta = prj->w[3]*(*yp + prj->y0); t = atan2d(eta,1.0) + asind(eta*prj->pv[1]/sqrt(eta*eta+1.0)); for (ix = 0; ix < mx; ix++, thetap += spt) { *thetap = t; *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int cyps2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, xi; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CYP) { if ((status = cypset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip) - prj->x0; xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { eta = prj->pv[1] + cosd(*thetap); istat = 0; if (eta == 0.0) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("cyps2x"); } else { eta = prj->w[2]*sind(*thetap)/eta; } eta -= prj->y0; for (iphi = 0; iphi < mphi; iphi++, yp += sxy) { *yp = eta; *(statp++) = istat; } } return status; } /*============================================================================ * CEA: cylindrical equal area projection. * * Given: * prj->pv[1] Square of the cosine of the latitude at which the * projection is conformal, lambda. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag CEA * prj->code "CEA" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->w[2] r0/lambda * prj->w[3] lambda/r0 * prj->prjx2s Pointer to ceax2s(). * prj->prjs2x Pointer to ceas2x(). *===========================================================================*/ int ceaset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = CEA; strcpy(prj->code, "CEA"); if (undefined(prj->pv[1])) prj->pv[1] = 1.0; strcpy(prj->name, "cylindrical equal area"); prj->category = CYLINDRICAL; prj->pvrange = 101; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; if (prj->pv[1] <= 0.0 || prj->pv[1] > 1.0) { return PRJERR_BAD_PARAM_SET("ceaset"); } prj->w[2] = prj->r0/prj->pv[1]; prj->w[3] = prj->pv[1]/prj->r0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = R2D/prj->r0; if (prj->pv[1] <= 0.0 || prj->pv[1] > 1.0) { return PRJERR_BAD_PARAM_SET("ceaset"); } prj->w[2] = prj->r0/prj->pv[1]; prj->w[3] = prj->pv[1]/prj->r0; } prj->prjx2s = ceax2s; prj->prjs2x = ceas2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int ceax2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double s; const double tol = 1.0e-13; register int istat, ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CEA) { if ((status = ceaset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1]*(*xp + prj->x0); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; phip += rowlen; } } /* Do y dependence. */ yp = y; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { s = prj->w[3]*(*yp + prj->y0); istat = 0; if (fabs(s) > 1.0) { if (fabs(s) > 1.0+tol) { s = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("ceax2s"); } else { s = copysign(90.0, s); } } else { s = asind(s); } for (ix = 0; ix < mx; ix++, thetap += spt) { *thetap = s; *(statp++) = istat; } } return status; } /*--------------------------------------------------------------------------*/ int ceas2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CEA) { if ((status = ceaset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip) - prj->x0; xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { eta = prj->w[2]*sind(*thetap) - prj->y0; for (iphi = 0; iphi < mphi; iphi++, yp += sxy) { *yp = eta; *(statp++) = 0; } } return 0; } /*============================================================================ * CAR: Plate carree projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag CAR * prj->code "CAR" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->prjx2s Pointer to carx2s(). * prj->prjs2x Pointer to cars2x(). *===========================================================================*/ int carset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = CAR; strcpy(prj->code, "CAR"); strcpy(prj->name, "plate caree"); prj->category = CYLINDRICAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = carx2s; prj->prjs2x = cars2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int carx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double s, t; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CAR) { if ((status = carset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1]*(*xp + prj->x0); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; phip += rowlen; } } /* Do y dependence. */ yp = y; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { t = prj->w[1]*(*yp + prj->y0); for (ix = 0; ix < mx; ix++, thetap += spt) { *thetap = t; *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int cars2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CAR) { if ((status = carset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip) - prj->x0; xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { eta = prj->w[0]*(*thetap) - prj->y0; for (iphi = 0; iphi < mphi; iphi++, yp += sxy) { *yp = eta; *(statp++) = 0; } } return 0; } /*============================================================================ * MER: Mercator's projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag MER * prj->code "MER" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->prjx2s Pointer to merx2s(). * prj->prjs2x Pointer to mers2x(). *===========================================================================*/ int merset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = MER; strcpy(prj->code, "MER"); strcpy(prj->name, "Mercator's"); prj->category = CYLINDRICAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 1; prj->global = 0; prj->divergent = 1; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = merx2s; prj->prjs2x = mers2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int merx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double s, t; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MER) { if ((status = merset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1]*(*xp + prj->x0); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; phip += rowlen; } } /* Do y dependence. */ yp = y; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { t = 2.0*atand(exp((*yp + prj->y0)/prj->r0)) - 90.0; for (ix = 0; ix < mx; ix++, thetap += spt) { *thetap = t; *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int mers2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, xi; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MER) { if ((status = merset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip) - prj->x0; xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { istat = 0; if (*thetap <= -90.0 || *thetap >= 90.0) { eta = 0.0; istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("mers2x"); } else { eta = prj->r0*log(tand((*thetap+90.0)/2.0)) - prj->y0; } for (iphi = 0; iphi < mphi; iphi++, yp += sxy) { *yp = eta; *(statp++) = istat; } } return status; } /*============================================================================ * SFL: Sanson-Flamsteed ("global sinusoid") projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag SFL * prj->code "SFL" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->prjx2s Pointer to sflx2s(). * prj->prjs2x Pointer to sfls2x(). *===========================================================================*/ int sflset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = SFL; strcpy(prj->code, "SFL"); strcpy(prj->name, "Sanson-Flamsteed"); prj->category = PSEUDOCYLINDRICAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = sflx2s; prj->prjs2x = sfls2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int sflx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double s, t, yj; register int istat, ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SFL) { if ((status = sflset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1]*(*xp + prj->x0); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; s = cos(yj/prj->r0); istat = 0; if (s == 0.0) { istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("sflx2s"); } else { s = 1.0/s; } t = prj->w[1]*yj; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { *phip *= s; *thetap = t; *(statp++) = istat; } } return status; } /*--------------------------------------------------------------------------*/ int sfls2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != SFL) { if ((status = sflset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip); xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { xi = cosd(*thetap); eta = prj->w[0]*(*thetap) - prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = xi*(*xp) - prj->x0; *yp = eta; *(statp++) = 0; } } return 0; } /*============================================================================ * PAR: parabolic projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag PAR * prj->code "PAR" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->w[2] pi*r0 * prj->w[3] 1/(pi*r0) * prj->prjx2s Pointer to parx2s(). * prj->prjs2x Pointer to pars2x(). *===========================================================================*/ int parset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = PAR; strcpy(prj->code, "PAR"); strcpy(prj->name, "parabolic"); prj->category = PSEUDOCYLINDRICAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; prj->w[2] = 180.0; prj->w[3] = 1.0/prj->w[2]; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; prj->w[2] = PI*prj->r0; prj->w[3] = 1.0/prj->w[2]; } prj->prjx2s = parx2s; prj->prjs2x = pars2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int parx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, s, t, xj; const double tol = 1.0e-13; register int istat, ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PAR) { if ((status = parset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; s = prj->w[1]*xj; t = fabs(xj) - tol; phip = phi + rowoff; thetap = theta + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; *thetap = t; phip += rowlen; thetap += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { r = prj->w[3]*(*yp + prj->y0); istat = 0; if (r > 1.0 || r < -1.0) { s = 0.0; t = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("parx2s"); } else { s = 1.0 - 4.0*r*r; if (s == 0.0) { /* Deferred test. */ istat = -1; } else { s = 1.0/s; } t = 3.0*asind(r); } for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { if (istat < 0) { if (*thetap < 0.0) { *(statp++) = 0; } else { *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("parx2s"); } } *phip *= s; *thetap = t; } } return status; } /*--------------------------------------------------------------------------*/ int pars2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double eta, s, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PAR) { if ((status = parset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0]*(*phip); xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { s = sind((*thetap)/3.0); xi = (1.0 - 4.0*s*s); eta = prj->w[2]*s - prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = xi*(*xp) - prj->x0; *yp = eta; *(statp++) = 0; } } return 0; } /*============================================================================ * MOL: Mollweide's projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag MOL * prj->code "MOL" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] sqrt(2)*r0 * prj->w[1] sqrt(2)*r0/90 * prj->w[2] 1/(sqrt(2)*r0) * prj->w[3] 90/r0 * prj->prjx2s Pointer to molx2s(). * prj->prjs2x Pointer to mols2x(). *===========================================================================*/ int molset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = MOL; strcpy(prj->code, "MOL"); if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "Mollweide's"); prj->category = PSEUDOCYLINDRICAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; prj->w[0] = SQRT2*prj->r0; prj->w[1] = prj->w[0]/90.0; prj->w[2] = 1.0/prj->w[0]; prj->w[3] = 90.0/prj->r0; prj->w[4] = 2.0/PI; prj->prjx2s = molx2s; prj->prjs2x = mols2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int molx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double r, s, t, xj, y0, yj, z; const double tol = 1.0e-12; register int istat, ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MOL) { if ((status = molset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; s = prj->w[3]*xj; t = fabs(xj) - tol; phip = phi + rowoff; thetap = theta + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; *thetap = t; phip += rowlen; thetap += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; y0 = yj/prj->r0; r = 2.0 - y0*y0; istat = 0; if (r <= tol) { if (r < -tol) { istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } else { /* OK if fabs(x) < tol whence phi = 0.0. */ istat = -1; } r = 0.0; s = 0.0; } else { r = sqrt(r); s = 1.0/r; } z = yj*prj->w[2]; if (fabs(z) > 1.0) { if (fabs(z) > 1.0+tol) { z = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } else { z = copysign(1.0, z) + y0*r/PI; } } else { z = asin(z)*prj->w[4] + y0*r/PI; } if (fabs(z) > 1.0) { if (fabs(z) > 1.0+tol) { z = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } else { z = copysign(1.0, z); } } t = asind(z); for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { if (istat < 0) { if (*thetap < 0.0) { *(statp++) = 0; } else { *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("molx2s"); } } *phip *= s; *thetap = t; } } return status; } /*--------------------------------------------------------------------------*/ int mols2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int k, mphi, mtheta, rowlen, rowoff, status; double eta, gamma, resid, u, v, v0, v1, xi; const double tol = 1.0e-13; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != MOL) { if ((status = molset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[1]*(*phip); xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = xi; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { if (fabs(*thetap) == 90.0) { xi = 0.0; eta = copysign(prj->w[0], *thetap); } else if (*thetap == 0.0) { xi = 1.0; eta = 0.0; } else { u = PI*sind(*thetap); v0 = -PI; v1 = PI; v = u; for (k = 0; k < 100; k++) { resid = (v - u) + sin(v); if (resid < 0.0) { if (resid > -tol) break; v0 = v; } else { if (resid < tol) break; v1 = v; } v = (v0 + v1)/2.0; } gamma = v/2.0; xi = cos(gamma); eta = prj->w[0]*sin(gamma); } eta -= prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = xi*(*xp) - prj->x0; *yp = eta; *(statp++) = 0; } } return 0; } /*============================================================================ * AIT: Hammer-Aitoff projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag AIT * prj->code "AIT" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] 2*r0**2 * prj->w[1] 1/(2*r0)**2 * prj->w[2] 1/(4*r0)**2 * prj->w[3] 1/(2*r0) * prj->prjx2s Pointer to aitx2s(). * prj->prjs2x Pointer to aits2x(). *===========================================================================*/ int aitset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = AIT; strcpy(prj->code, "AIT"); if (prj->r0 == 0.0) prj->r0 = R2D; strcpy(prj->name, "Hammer-Aitoff"); prj->category = CONVENTIONAL; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; prj->w[0] = 2.0*prj->r0*prj->r0; prj->w[1] = 1.0/(2.0*prj->w[0]); prj->w[2] = prj->w[1]/4.0; prj->w[3] = 1.0/(2.0*prj->r0); prj->prjx2s = aitx2s; prj->prjs2x = aits2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int aitx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double s, t, x0, xj, y0, yj, yj2, z; const double tol = 1.0e-13; register int ix, iy, istat, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIT) { if ((status = aitset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; s = 1.0 - xj*xj*prj->w[2]; t = xj*prj->w[3]; phip = phi + rowoff; thetap = theta + rowoff; for (iy = 0; iy < my; iy++) { *phip = s; *thetap = t; phip += rowlen; thetap += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; yj2 = yj*yj*prj->w[1]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { s = *phip - yj2; istat = 0; if (s < 0.5) { if (s < 0.5-tol) { istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("aitx2s"); } s = 0.5; } z = sqrt(s); x0 = 2.0*z*z - 1.0; y0 = z*(*thetap); if (x0 == 0.0 && y0 == 0.0) { *phip = 0.0; } else { *phip = 2.0*atan2d(y0, x0); } t = z*yj/prj->r0; if (fabs(t) > 1.0) { if (fabs(t) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("aitx2s"); } t = copysign(90.0, t); } else { t = asind(t); } *thetap = t; *(statp++) = istat; } } return status; } /*--------------------------------------------------------------------------*/ int aits2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double cosphi, costhe, sinphi, sinthe, w; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != AIT) { if ((status = aitset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { w = (*phip)/2.0; sincosd(w, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinphi; *yp = cosphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { w = sqrt(prj->w[0]/(1.0 + costhe*(*yp))); *xp = 2.0*w*costhe*(*xp) - prj->x0; *yp = w*sinthe - prj->y0; *(statp++) = 0; } } return 0; } /*============================================================================ * COP: conic perspective projection. * * Given: * prj->pv[1] sigma = (theta2+theta1)/2 * prj->pv[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the * latitudes of the standard parallels, in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to sigma if undefined. * prj->theta0 Reset to sigma if undefined. * * Returned: * prj->flag COP * prj->code "COP" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] C = sin(sigma) * prj->w[1] 1/C * prj->w[2] Y0 = r0*cos(delta)*cot(sigma) * prj->w[3] r0*cos(delta) * prj->w[4] 1/(r0*cos(delta) * prj->w[5] cot(sigma) * prj->prjx2s Pointer to copx2s(). * prj->prjs2x Pointer to cops2x(). *===========================================================================*/ int copset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = COP; strcpy(prj->code, "COP"); strcpy(prj->name, "conic perspective"); if (undefined(prj->pv[1])) { return PRJERR_BAD_PARAM_SET("copset"); } if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; prj->category = CONIC; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 0; prj->divergent = 1; prj->w[0] = sind(prj->pv[1]); if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("copset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[3] = prj->r0*cosd(prj->pv[2]); if (prj->w[3] == 0.0) { return PRJERR_BAD_PARAM_SET("copset"); } prj->w[4] = 1.0/prj->w[3]; prj->w[5] = 1.0/tand(prj->pv[1]); prj->w[2] = prj->w[3]*prj->w[5]; prj->prjx2s = copx2s; prj->prjs2x = cops2x; return prjoff(prj, 0.0, prj->pv[1]); } /*--------------------------------------------------------------------------*/ int copx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double alpha, dy, dy2, r, xj; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COP) { if ((status = copset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { dy = prj->w[2] - (*yp + prj->y0); dy2 = dy*dy; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + dy2); if (prj->pv[1] < 0.0) r = -r; if (r == 0.0) { alpha = 0.0; } else { alpha = atan2d(xj/r, dy/r); } *phip = alpha*prj->w[1]; *thetap = prj->pv[1] + atand(prj->w[5] - r*prj->w[4]); *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int cops2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, cosalpha, r, s, t, sinalpha, y0; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COP) { if ((status = copset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { alpha = prj->w[0]*(*phip); sincosd(alpha, &sinalpha, &cosalpha); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinalpha; *yp = cosalpha; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; y0 = prj->y0 - prj->w[2]; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { t = *thetap - prj->pv[1]; s = cosd(t); istat = 0; if (s == 0.0) { r = 0.0; istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("cops2x"); } else { r = prj->w[2] - prj->w[3]*sind(t)/s; if (prj->bounds && r*prj->w[0] < 0.0) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("cops2x"); } } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - y0; *(statp++) = istat; } } return status; } /*============================================================================ * COE: conic equal area projection. * * Given: * prj->pv[1] sigma = (theta2+theta1)/2 * prj->pv[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the * latitudes of the standard parallels, in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to sigma if undefined. * prj->theta0 Reset to sigma if undefined. * * Returned: * prj->flag COE * prj->code "COE" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] C = (sin(theta1) + sin(theta2))/2 * prj->w[1] 1/C * prj->w[2] Y0 = chi*sqrt(psi - 2C*sind(sigma)) * prj->w[3] chi = r0/C * prj->w[4] psi = 1 + sin(theta1)*sin(theta2) * prj->w[5] 2C * prj->w[6] (1 + sin(theta1)*sin(theta2))*(r0/C)**2 * prj->w[7] C/(2*r0**2) * prj->w[8] chi*sqrt(psi + 2C) * prj->prjx2s Pointer to coex2s(). * prj->prjs2x Pointer to coes2x(). *===========================================================================*/ int coeset(prj) struct prjprm *prj; { double theta1, theta2; if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = COE; strcpy(prj->code, "COE"); strcpy(prj->name, "conic equal area"); if (undefined(prj->pv[1])) { return PRJERR_BAD_PARAM_SET("coeset"); } if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; prj->category = CONIC; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; theta1 = prj->pv[1] - prj->pv[2]; theta2 = prj->pv[1] + prj->pv[2]; prj->w[0] = (sind(theta1) + sind(theta2))/2.0; if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("coeset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[3] = prj->r0/prj->w[0]; prj->w[4] = 1.0 + sind(theta1)*sind(theta2); prj->w[5] = 2.0*prj->w[0]; prj->w[6] = prj->w[3]*prj->w[3]*prj->w[4]; prj->w[7] = 1.0/(2.0*prj->r0*prj->w[3]); prj->w[8] = prj->w[3]*sqrt(prj->w[4] + prj->w[5]); prj->w[2] = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sind(prj->pv[1])); prj->prjx2s = coex2s; prj->prjs2x = coes2x; return prjoff(prj, 0.0, prj->pv[1]); } /*--------------------------------------------------------------------------*/ int coex2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double alpha, dy, dy2, r, t, w, xj; const double tol = 1.0e-12; register int ix, iy, istat, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COE) { if ((status = coeset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { dy = prj->w[2] - (*yp + prj->y0); dy2 = dy*dy; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + dy2); if (prj->pv[1] < 0.0) r = -r; if (r == 0.0) { alpha = 0.0; } else { alpha = atan2d(xj/r, dy/r); } istat = 0; if (fabs(r - prj->w[8]) < tol) { t = -90.0; } else { w = (prj->w[6] - r*r)*prj->w[7]; if (fabs(w) > 1.0) { if (fabs(w-1.0) < tol) { t = 90.0; } else if (fabs(w+1.0) < tol) { t = -90.0; } else { t = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("coex2s"); } } else { t = asind(w); } } *phip = alpha*prj->w[1]; *thetap = t; *(statp++) = istat; } } return status; } /*--------------------------------------------------------------------------*/ int coes2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, cosalpha, r, sinalpha, y0; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COE) { if ((status = coeset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { alpha = prj->w[0]*(*phip); sincosd(alpha, &sinalpha, &cosalpha); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinalpha; *yp = cosalpha; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; y0 = prj->y0 - prj->w[2]; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { if (*thetap == -90.0) { r = prj->w[8]; } else { r = prj->w[3]*sqrt(prj->w[4] - prj->w[5]*sind(*thetap)); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - y0; *(statp++) = 0; } } return 0; } /*============================================================================ * COD: conic equidistant projection. * * Given: * prj->pv[1] sigma = (theta2+theta1)/2 * prj->pv[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the * latitudes of the standard parallels, in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to sigma if undefined. * prj->theta0 Reset to sigma if undefined. * * Returned: * prj->flag COD * prj->code "COD" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] C = r0*sin(sigma)*sin(delta)/delta * prj->w[1] 1/C * prj->w[2] Y0 = delta*cot(delta)*cot(sigma) * prj->w[3] Y0 + sigma * prj->prjx2s Pointer to codx2s(). * prj->prjs2x Pointer to cods2x(). *===========================================================================*/ int codset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = COD; strcpy(prj->code, "COD"); strcpy(prj->name, "conic equidistant"); if (undefined(prj->pv[1])) { return PRJERR_BAD_PARAM_SET("codset"); } if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; prj->category = CONIC; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->pv[2] == 0.0) { prj->w[0] = prj->r0*sind(prj->pv[1])*D2R; } else { prj->w[0] = prj->r0*sind(prj->pv[1])*sind(prj->pv[2])/prj->pv[2]; } if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("codset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[2] = prj->r0*cosd(prj->pv[2])*cosd(prj->pv[1])/prj->w[0]; prj->w[3] = prj->w[2] + prj->pv[1]; prj->prjx2s = codx2s; prj->prjs2x = cods2x; return prjoff(prj, 0.0, prj->pv[1]); } /*--------------------------------------------------------------------------*/ int codx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double alpha, dy, dy2, r, xj; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COD) { if ((status = codset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { dy = prj->w[2] - (*yp + prj->y0); dy2 = dy*dy; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + dy2); if (prj->pv[1] < 0.0) r = -r; if (r == 0.0) { alpha = 0.0; } else { alpha = atan2d(xj/r, dy/r); } *phip = alpha*prj->w[1]; *thetap = prj->w[3] - r; *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int cods2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, cosalpha, r, sinalpha, y0; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COD) { if ((status = codset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { alpha = prj->w[0]*(*phip); sincosd(alpha, &sinalpha, &cosalpha); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinalpha; *yp = cosalpha; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; y0 = prj->y0 - prj->w[2]; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { r = prj->w[3] - *thetap; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - y0; *(statp++) = 0; } } return 0; } /*============================================================================ * COO: conic orthomorphic projection. * * Given: * prj->pv[1] sigma = (theta2+theta1)/2 * prj->pv[2] delta = (theta2-theta1)/2, where theta1 and theta2 are the * latitudes of the standard parallels, in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to sigma if undefined. * prj->theta0 Reset to sigma if undefined. * * Returned: * prj->flag COO * prj->code "COO" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] C = ln(cos(theta2)/cos(theta1))/ln(tan(tau2)/tan(tau1)) * where tau1 = (90 - theta1)/2 * tau2 = (90 - theta2)/2 * prj->w[1] 1/C * prj->w[2] Y0 = psi*tan((90-sigma)/2)**C * prj->w[3] psi = (r0*cos(theta1)/C)/tan(tau1)**C * prj->w[4] 1/psi * prj->prjx2s Pointer to coox2s(). * prj->prjs2x Pointer to coos2x(). *===========================================================================*/ int cooset(prj) struct prjprm *prj; { double cos1, cos2, tan1, tan2, theta1, theta2; if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = COO; strcpy(prj->code, "COO"); strcpy(prj->name, "conic orthomorphic"); if (undefined(prj->pv[1])) { return PRJERR_BAD_PARAM_SET("cooset"); } if (undefined(prj->pv[2])) prj->pv[2] = 0.0; if (prj->r0 == 0.0) prj->r0 = R2D; prj->category = CONIC; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 1; prj->global = 0; prj->divergent = 1; theta1 = prj->pv[1] - prj->pv[2]; theta2 = prj->pv[1] + prj->pv[2]; tan1 = tand((90.0 - theta1)/2.0); cos1 = cosd(theta1); if (theta1 == theta2) { prj->w[0] = sind(theta1); } else { tan2 = tand((90.0 - theta2)/2.0); cos2 = cosd(theta2); prj->w[0] = log(cos2/cos1)/log(tan2/tan1); } if (prj->w[0] == 0.0) { return PRJERR_BAD_PARAM_SET("cooset"); } prj->w[1] = 1.0/prj->w[0]; prj->w[3] = prj->r0*(cos1/prj->w[0])/pow(tan1,prj->w[0]); if (prj->w[3] == 0.0) { return PRJERR_BAD_PARAM_SET("cooset"); } prj->w[2] = prj->w[3]*pow(tand((90.0 - prj->pv[1])/2.0),prj->w[0]); prj->w[4] = 1.0/prj->w[3]; prj->prjx2s = coox2s; prj->prjs2x = coos2x; return prjoff(prj, 0.0, prj->pv[1]); } /*--------------------------------------------------------------------------*/ int coox2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double alpha, dy, dy2, r, t, xj; register int ix, iy, istat, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COO) { if ((status = cooset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { dy = prj->w[2] - (*yp + prj->y0); dy2 = dy*dy; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + dy2); if (prj->pv[1] < 0.0) r = -r; if (r == 0.0) { alpha = 0.0; } else { alpha = atan2d(xj/r, dy/r); } istat = 0; if (r == 0.0) { if (prj->w[0] < 0.0) { t = -90.0; } else { t = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("coox2s"); } } else { t = 90.0 - 2.0*atand(pow(r*prj->w[4],prj->w[1])); } *phip = alpha*prj->w[1]; *thetap = t; *(statp++) = istat; } } return status; } /*--------------------------------------------------------------------------*/ int coos2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, cosalpha, r, sinalpha, y0; register int iphi, itheta, istat, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != COO) { if ((status = cooset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { alpha = prj->w[0]*(*phip); sincosd(alpha, &sinalpha, &cosalpha); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = sinalpha; *yp = cosalpha; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; y0 = prj->y0 - prj->w[2]; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { istat = 0; if (*thetap == -90.0) { r = 0.0; if (prj->w[0] >= 0.0) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("coos2x"); } } else { r = prj->w[3]*pow(tand((90.0 - *thetap)/2.0),prj->w[0]); } for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *xp = r*(*xp) - prj->x0; *yp = -r*(*yp) - y0; *(statp++) = istat; } } return status; } /*============================================================================ * BON: Bonne's projection. * * Given: * prj->pv[1] Bonne conformal latitude, theta1, in degrees. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag BON * prj->code "BON" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[1] r0*pi/180 * prj->w[2] Y0 = r0*(cot(theta1) + theta1*pi/180) * prj->prjx2s Pointer to bonx2s(). * prj->prjs2x Pointer to bons2x(). *===========================================================================*/ int bonset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = BON; strcpy(prj->code, "BON"); strcpy(prj->name, "Bonne's"); if (undefined(prj->pv[1])) { return PRJERR_BAD_PARAM_SET("bonset"); } if (prj->pv[1] == 0.0) { /* Sanson-Flamsteed. */ return sflset(prj); } prj->category = POLYCONIC; prj->pvrange = 101; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[1] = 1.0; prj->w[2] = prj->r0*cosd(prj->pv[1])/sind(prj->pv[1]) + prj->pv[1]; } else { prj->w[1] = prj->r0*D2R; prj->w[2] = prj->r0*(cosd(prj->pv[1])/sind(prj->pv[1]) + prj->pv[1]*D2R); } prj->prjx2s = bonx2s; prj->prjs2x = bons2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int bonx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double alpha, dy, dy2, costhe, r, s, t, xj; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->pv[1] == 0.0) { /* Sanson-Flamsteed. */ return sflx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat); } if (prj->flag != BON) { if ((status = bonset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { dy = prj->w[2] - (*yp + prj->y0); dy2 = dy*dy; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; r = sqrt(xj*xj + dy2); if (prj->pv[1] < 0.0) r = -r; if (r == 0.0) { alpha = 0.0; } else { alpha = atan2d(xj/r, dy/r); } t = (prj->w[2] - r)/prj->w[1]; costhe = cosd(t); if (costhe == 0.0) { s = 0.0; } else { s = alpha*(r/prj->r0)/costhe; } *phip = s; *thetap = t; *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int bons2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, cosalpha, r, s, sinalpha, y0; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->pv[1] == 0.0) { /* Sanson-Flamsteed. */ return sfls2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat); } if (prj->flag != BON) { if ((status = bonset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } y0 = prj->y0 - prj->w[2]; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { s = prj->r0*(*phip); xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = s; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { r = prj->w[2] - prj->w[1]*(*thetap); s = cosd(*thetap)/r; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { alpha = s*(*xp); sincosd(alpha, &sinalpha, &cosalpha); *xp = r*sinalpha - prj->x0; *yp = -r*cosalpha - y0; *(statp++) = 0; } } return 0; } /*============================================================================ * PCO: polyconic projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag PCO * prj->code "PCO" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180) * prj->w[1] 1/r0 * prj->w[2] 2*r0 * prj->prjx2s Pointer to pcox2s(). * prj->prjs2x Pointer to pcos2x(). *===========================================================================*/ int pcoset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = PCO; strcpy(prj->code, "PCO"); strcpy(prj->name, "polyconic"); prj->category = POLYCONIC; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; prj->w[2] = 360.0/PI; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = 1.0/prj->w[0]; prj->w[2] = 2.0*prj->r0; } prj->prjx2s = pcox2s; prj->prjs2x = pcos2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int pcox2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double f, fneg, fpos, lambda, tanthe, the, theneg, thepos, w, x1, xj, xx, yj, ymthe, y1; const double tol = 1.0e-12; register int ix, iy, k, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PCO) { if ((status = pcoset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xj = *xp + prj->x0; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xj; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yj = *yp + prj->y0; w = fabs(yj*prj->w[1]); for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xj = *phip; if (w < tol) { *phip = xj*prj->w[1]; *thetap = 0.0; } else if (fabs(w-90.0) < tol) { *phip = 0.0; *thetap = copysign(90.0, yj); } else { /* Iterative solution using weighted division of the interval. */ if (yj > 0.0) { thepos = 90.0; } else { thepos = -90.0; } theneg = 0.0; xx = xj*xj; ymthe = yj - prj->w[0]*thepos; fpos = xx + ymthe*ymthe; fneg = -999.0; for (k = 0; k < 64; k++) { if (fneg < -100.0) { /* Equal division of the interval. */ the = (thepos+theneg)/2.0; } else { /* Weighted division of the interval. */ lambda = fpos/(fpos-fneg); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } the = thepos - lambda*(thepos-theneg); } /* Compute the residue. */ ymthe = yj - prj->w[0]*(the); tanthe = tand(the); f = xx + ymthe*(ymthe - prj->w[2]/tanthe); /* Check for convergence. */ if (fabs(f) < tol) break; if (fabs(thepos-theneg) < tol) break; /* Redefine the interval. */ if (f > 0.0) { thepos = the; fpos = f; } else { theneg = the; fneg = f; } } x1 = prj->r0 - ymthe*tanthe; y1 = xj*tanthe; if (x1 == 0.0 && y1 == 0.0) { *phip = 0.0; } else { *phip = atan2d(y1, x1)/sind(the); } *thetap = the; } *(statp++) = 0; } } return 0; } /*--------------------------------------------------------------------------*/ int pcos2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double alpha, costhe, cotthe, sinthe, therad; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != PCO) { if ((status = pcoset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xp = x + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = *phip; xp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { therad = (*thetap)*D2R; sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (sinthe == 0.0) { *xp = prj->w[0]*(*xp) - prj->x0; *yp = -prj->y0; } else { alpha = (*xp)*sinthe; cotthe = costhe/sinthe; *xp = prj->r0*cotthe*sind(alpha) - prj->x0; *yp = prj->r0*(cotthe*(1.0 - cosd(alpha)) + therad) - prj->y0; } *(statp++) = 0; } } return 0; } /*============================================================================ * TSC: tangential spherical cube projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag TSC * prj->code "TSC" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/4) * prj->w[1] (4/pi)/r0 * prj->prjx2s Pointer to tscx2s(). * prj->prjs2x Pointer to tscs2x(). *===========================================================================*/ int tscset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = TSC; strcpy(prj->code, "TSC"); strcpy(prj->name, "tangential spherical cube"); prj->category = QUADCUBE; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 45.0; prj->w[1] = 1.0/45.0; } else { prj->w[0] = prj->r0*PI/4.0; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = tscx2s; prj->prjs2x = tscs2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int tscx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double l, m, n, xf, yf; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TSC) { if ((status = tscset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xf = (*xp + prj->x0)*prj->w[1]; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xf; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yf = (*yp + prj->y0)*prj->w[1]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = *phip; /* Check bounds. */ if (fabs(xf) <= 1.0) { if (fabs(yf) > 3.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("tscx2s"); continue; } } else { if (fabs(xf) > 7.0 || fabs(yf) > 1.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("tscx2s"); continue; } } /* Map negative faces to the other side. */ if (xf < -1.0) xf += 8.0; /* Determine the face. */ if (xf > 5.0) { /* face = 4 */ xf = xf - 6.0; m = -1.0/sqrt(1.0 + xf*xf + yf*yf); l = -m*xf; n = -m*yf; } else if (xf > 3.0) { /* face = 3 */ xf = xf - 4.0; l = -1.0/sqrt(1.0 + xf*xf + yf*yf); m = l*xf; n = -l*yf; } else if (xf > 1.0) { /* face = 2 */ xf = xf - 2.0; m = 1.0/sqrt(1.0 + xf*xf + yf*yf); l = -m*xf; n = m*yf; } else if (yf > 1.0) { /* face = 0 */ yf = yf - 2.0; n = 1.0/sqrt(1.0 + xf*xf + yf*yf); l = -n*yf; m = n*xf; } else if (yf < -1.0) { /* face = 5 */ yf = yf + 2.0; n = -1.0/sqrt(1.0 + xf*xf + yf*yf); l = -n*yf; m = -n*xf; } else { /* face = 1 */ l = 1.0/sqrt(1.0 + xf*xf + yf*yf); m = l*xf; n = l*yf; } if (l == 0.0 && m == 0.0) { *phip = 0.0; } else { *phip = atan2d(m, l); } *thetap = asind(n); *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int tscs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int face, mphi, mtheta, rowlen, rowoff, status; double cosphi, costhe, l, m, n, sinphi, sinthe, x0, xf, y0, yf, zeta; const double tol = 1.0e-12; register int iphi, istat, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != TSC) { if ((status = tscset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = cosphi; *yp = sinphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { l = costhe*(*xp); m = costhe*(*yp); n = sinthe; face = 0; zeta = n; if (l > zeta) { face = 1; zeta = l; } if (m > zeta) { face = 2; zeta = m; } if (-l > zeta) { face = 3; zeta = -l; } if (-m > zeta) { face = 4; zeta = -m; } if (-n > zeta) { face = 5; zeta = -n; } switch (face) { case 1: xf = m/zeta; yf = n/zeta; x0 = 0.0; y0 = 0.0; break; case 2: xf = -l/zeta; yf = n/zeta; x0 = 2.0; y0 = 0.0; break; case 3: xf = -m/zeta; yf = n/zeta; x0 = 4.0; y0 = 0.0; break; case 4: xf = l/zeta; yf = n/zeta; x0 = 6.0; y0 = 0.0; break; case 5: xf = m/zeta; yf = l/zeta; x0 = 0.0; y0 = -2.0; break; default: /* face == 0 */ xf = m/zeta; yf = -l/zeta; x0 = 0.0; y0 = 2.0; break; } istat = 0; if (fabs(xf) > 1.0) { if (fabs(xf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("tscs2x"); } xf = copysign(1.0, xf); } if (fabs(yf) > 1.0) { if (fabs(yf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("tscs2x"); } yf = copysign(1.0, yf); } *xp = prj->w[0]*(xf + x0) - prj->x0; *yp = prj->w[0]*(yf + y0) - prj->y0; *(statp++) = istat; } } return status; } /*============================================================================ * CSC: COBE quadrilateralized spherical cube projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag CSC * prj->code "CSC" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/4) * prj->w[1] (4/pi)/r0 * prj->prjx2s Pointer to cscx2s(). * prj->prjs2x Pointer to cscs2x(). *===========================================================================*/ int cscset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = CSC; strcpy(prj->code, "CSC"); strcpy(prj->name, "COBE quadrilateralized spherical cube"); prj->category = QUADCUBE; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 0; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 45.0; prj->w[1] = 1.0/45.0; } else { prj->w[0] = prj->r0*PI/4.0; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = cscx2s; prj->prjs2x = cscs2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int cscx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int face, mx, my, rowlen, rowoff, status; double l, m, n, t; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; float chi, psi, xf, xx, yf, yy, z0, z1, z2, z3, z4, z5, z6; const float p00 = -0.27292696f; const float p10 = -0.07629969f; const float p20 = -0.22797056f; const float p30 = 0.54852384f; const float p40 = -0.62930065f; const float p50 = 0.25795794f; const float p60 = 0.02584375f; const float p01 = -0.02819452f; const float p11 = -0.01471565f; const float p21 = 0.48051509f; const float p31 = -1.74114454f; const float p41 = 1.71547508f; const float p51 = -0.53022337f; const float p02 = 0.27058160f; const float p12 = -0.56800938f; const float p22 = 0.30803317f; const float p32 = 0.98938102f; const float p42 = -0.83180469f; const float p03 = -0.60441560f; const float p13 = 1.50880086f; const float p23 = -0.93678576f; const float p33 = 0.08693841f; const float p04 = 0.93412077f; const float p14 = -1.41601920f; const float p24 = 0.33887446f; const float p05 = -0.63915306f; const float p15 = 0.52032238f; const float p06 = 0.14381585f; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CSC) { if ((status = cscset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xf = (float)((*xp + prj->x0)*prj->w[1]); phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xf; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yf = (float)((*yp + prj->y0)*prj->w[1]); for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = (float)(*phip); /* Check bounds. */ if (fabs((double)xf) <= 1.0) { if (fabs((double)yf) > 3.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("cscx2s"); continue; } } else { if (fabs((double)xf) > 7.0 || fabs((double)yf) > 1.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("cscx2s"); continue; } } /* Map negative faces to the other side. */ if (xf < -1.0f) xf += 8.0f; /* Determine the face. */ if (xf > 5.0f) { face = 4; xf = xf - 6.0f; } else if (xf > 3.0f) { face = 3; xf = xf - 4.0f; } else if (xf > 1.0f) { face = 2; xf = xf - 2.0f; } else if (yf > 1.0f) { face = 0; yf = yf - 2.0f; } else if (yf < -1.0f) { face = 5; yf = yf + 2.0f; } else { face = 1; } xx = xf*xf; yy = yf*yf; z0 = p00 + xx*(p10 + xx*(p20 + xx*(p30 + xx*(p40 + xx*(p50 + xx*(p60)))))); z1 = p01 + xx*(p11 + xx*(p21 + xx*(p31 + xx*(p41 + xx*(p51))))); z2 = p02 + xx*(p12 + xx*(p22 + xx*(p32 + xx*(p42)))); z3 = p03 + xx*(p13 + xx*(p23 + xx*(p33))); z4 = p04 + xx*(p14 + xx*(p24)); z5 = p05 + xx*(p15); z6 = p06; chi = z0 + yy*(z1 + yy*(z2 + yy*(z3 + yy*(z4 + yy*(z5 + yy*z6))))); chi = xf + xf*(1.0f - xx)*chi; z0 = p00 + yy*(p10 + yy*(p20 + yy*(p30 + yy*(p40 + yy*(p50 + yy*(p60)))))); z1 = p01 + yy*(p11 + yy*(p21 + yy*(p31 + yy*(p41 + yy*(p51))))); z2 = p02 + yy*(p12 + yy*(p22 + yy*(p32 + yy*(p42)))); z3 = p03 + yy*(p13 + yy*(p23 + yy*(p33))); z4 = p04 + yy*(p14 + yy*(p24)); z5 = p05 + yy*(p15); z6 = p06; psi = z0 + xx*(z1 + xx*(z2 + xx*(z3 + xx*(z4 + xx*(z5 + xx*z6))))); psi = yf + yf*(1.0f - yy)*psi; t = 1.0/sqrt((double)(chi*chi + psi*psi) + 1.0); switch (face) { case 1: l = t; m = chi*l; n = psi*l; break; case 2: m = t; l = -chi*m; n = psi*m; break; case 3: l = -t; m = chi*l; n = -psi*l; break; case 4: m = -t; l = -chi*m; n = -psi*m; break; case 5: n = -t; l = -psi*n; m = -chi*n; break; default: /* face == 0 */ n = t; l = -psi*n; m = chi*n; break; } if (l == 0.0 && m == 0.0) { *phip = 0.0; } else { *phip = atan2d(m, l); } *thetap = asind(n); *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int cscs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int face, mphi, mtheta, rowlen, rowoff, status; double cosphi, costhe, eta, l, m, n, sinphi, sinthe, xi, zeta; const float tol = 1.0e-7; register int iphi, istat, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; float chi, chi2, chi2psi2, chi4, chipsi, psi, psi2, psi4, chi2co, psi2co, x0, xf, y0, yf; const float gstar = 1.37484847732f; const float mm = 0.004869491981f; const float gamma = -0.13161671474f; const float omega1 = -0.159596235474f; const float d0 = 0.0759196200467f; const float d1 = -0.0217762490699f; const float c00 = 0.141189631152f; const float c10 = 0.0809701286525f; const float c01 = -0.281528535557f; const float c11 = 0.15384112876f; const float c20 = -0.178251207466f; const float c02 = 0.106959469314f; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != CSC) { if ((status = cscset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = cosphi; *yp = sinphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { l = costhe*(*xp); m = costhe*(*yp); n = sinthe; face = 0; zeta = n; if (l > zeta) { face = 1; zeta = l; } if (m > zeta) { face = 2; zeta = m; } if (-l > zeta) { face = 3; zeta = -l; } if (-m > zeta) { face = 4; zeta = -m; } if (-n > zeta) { face = 5; zeta = -n; } switch (face) { case 1: xi = m; eta = n; x0 = 0.0; y0 = 0.0; break; case 2: xi = -l; eta = n; x0 = 2.0; y0 = 0.0; break; case 3: xi = -m; eta = n; x0 = 4.0; y0 = 0.0; break; case 4: xi = l; eta = n; x0 = 6.0; y0 = 0.0; break; case 5: xi = m; eta = l; x0 = 0.0; y0 = -2.0; break; default: /* face == 0 */ xi = m; eta = -l; x0 = 0.0; y0 = 2.0; break; } chi = (float)( xi/zeta); psi = (float)(eta/zeta); chi2 = chi*chi; psi2 = psi*psi; chi2co = 1.0f - chi2; psi2co = 1.0f - psi2; /* Avoid floating underflows. */ chipsi = (float)fabs((double)(chi*psi)); chi4 = (chi2 > 1.0e-16f) ? chi2*chi2 : 0.0f; psi4 = (psi2 > 1.0e-16f) ? psi2*psi2 : 0.0f; chi2psi2 = (chipsi > 1.0e-16f) ? chi2*psi2 : 0.0f; xf = chi*(chi2 + chi2co*(gstar + psi2*(gamma*chi2co + mm*chi2 + psi2co*(c00 + c10*chi2 + c01*psi2 + c11*chi2psi2 + c20*chi4 + c02*psi4)) + chi2*(omega1 - chi2co*(d0 + d1*chi2)))); yf = psi*(psi2 + psi2co*(gstar + chi2*(gamma*psi2co + mm*psi2 + chi2co*(c00 + c10*psi2 + c01*chi2 + c11*chi2psi2 + c20*psi4 + c02*chi4)) + psi2*(omega1 - psi2co*(d0 + d1*psi2)))); istat = 0; if (fabs((double)xf) > 1.0) { if (fabs((double)xf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("cscs2x"); } xf = (float)copysign(1.0, (double)xf); } if (fabs((double)yf) > 1.0) { if (fabs((double)yf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("cscs2x"); } yf = (float)copysign(1.0, (double)yf); } *xp = prj->w[0]*(xf + x0) - prj->x0; *yp = prj->w[0]*(yf + y0) - prj->y0; *(statp++) = istat; } } return status; } /*============================================================================ * QSC: quadrilaterilized spherical cube projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag QSC * prj->code "QSC" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/4) * prj->w[1] (4/pi)/r0 * prj->prjx2s Pointer to qscx2s(). * prj->prjs2x Pointer to qscs2x(). *===========================================================================*/ int qscset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = QSC; strcpy(prj->code, "QSC"); strcpy(prj->name, "quadrilateralized spherical cube"); prj->category = QUADCUBE; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 45.0; prj->w[1] = 1.0/45.0; } else { prj->w[0] = prj->r0*PI/4.0; prj->w[1] = 1.0/prj->w[0]; } prj->prjx2s = qscx2s; prj->prjs2x = qscs2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int qscx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int direct, face, mx, my, rowlen, rowoff, status; double cosw, l, m, n, omega, sinw, tau, xf, yf, w, zeco, zeta; const double tol = 1.0e-12; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != QSC) { if ((status = qscset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xf = (*xp + prj->x0)*prj->w[1]; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xf; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yf = (*yp + prj->y0)*prj->w[1]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xf = *phip; /* Check bounds. */ if (fabs(xf) <= 1.0) { if (fabs(yf) > 3.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("qscx2s"); continue; } } else { if (fabs(xf) > 7.0 || fabs(yf) > 1.0) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("qscx2s"); continue; } } /* Map negative faces to the other side. */ if (xf < -1.0) xf += 8.0; /* Determine the face. */ if (xf > 5.0) { face = 4; xf -= 6.0; } else if (xf > 3.0) { face = 3; xf -= 4.0; } else if (xf > 1.0) { face = 2; xf -= 2.0; } else if (yf > 1.0) { face = 0; yf -= 2.0; } else if (yf < -1.0) { face = 5; yf += 2.0; } else { face = 1; } direct = (fabs(xf) > fabs(yf)); if (direct) { if (xf == 0.0) { omega = 0.0; tau = 1.0; zeta = 1.0; zeco = 0.0; } else { w = 15.0*yf/xf; omega = sind(w)/(cosd(w) - SQRT2INV); tau = 1.0 + omega*omega; zeco = xf*xf*(1.0 - 1.0/sqrt(1.0 + tau)); zeta = 1.0 - zeco; } } else { if (yf == 0.0) { omega = 0.0; tau = 1.0; zeta = 1.0; zeco = 0.0; } else { w = 15.0*xf/yf; sincosd(w, &sinw, &cosw); omega = sinw/(cosw - SQRT2INV); tau = 1.0 + omega*omega; zeco = yf*yf*(1.0 - 1.0/sqrt(1.0 + tau)); zeta = 1.0 - zeco; } } if (zeta < -1.0) { if (zeta < -1.0-tol) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("qscx2s"); continue; } zeta = -1.0; zeco = 2.0; w = 0.0; } else { w = sqrt(zeco*(2.0-zeco)/tau); } switch (face) { case 1: l = zeta; if (direct) { m = w; if (xf < 0.0) m = -m; n = m*omega; } else { n = w; if (yf < 0.0) n = -n; m = n*omega; } break; case 2: m = zeta; if (direct) { l = w; if (xf > 0.0) l = -l; n = -l*omega; } else { n = w; if (yf < 0.0) n = -n; l = -n*omega; } break; case 3: l = -zeta; if (direct) { m = w; if (xf > 0.0) m = -m; n = -m*omega; } else { n = w; if (yf < 0.0) n = -n; m = -n*omega; } break; case 4: m = -zeta; if (direct) { l = w; if (xf < 0.0) l = -l; n = l*omega; } else { n = w; if (yf < 0.0) n = -n; l = n*omega; } break; case 5: n = -zeta; if (direct) { m = w; if (xf < 0.0) m = -m; l = m*omega; } else { l = w; if (yf < 0.0) l = -l; m = l*omega; } break; default: /* face == 0 */ n = zeta; if (direct) { m = w; if (xf < 0.0) m = -m; l = -m*omega; } else { l = w; if (yf > 0.0) l = -l; m = -l*omega; } break; } if (l == 0.0 && m == 0.0) { *phip = 0.0; } else { *phip = atan2d(m, l); } *thetap = asind(n); *(statp++) = 0; } } return status; } /*--------------------------------------------------------------------------*/ int qscs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int face, mphi, mtheta, rowlen, rowoff, status; double cosphi, costhe, eta, l, m, n, omega, p, sinphi, sinthe, t, tau, x0, xf, xi, y0, yf, zeco, zeta; const double tol = 1.0e-12; register int iphi, istat, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != QSC) { if ((status = qscset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } status = 0; /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { sincosd(*phip, &sinphi, &cosphi); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { *xp = cosphi; *yp = sinphi; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sincosd(*thetap, &sinthe, &costhe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (fabs(*thetap) == 90.0) { *xp = -prj->x0; *yp = copysign(2.0*prj->w[0], *thetap) - prj->y0; *(statp++) = 0; continue; } l = costhe*(*xp); m = costhe*(*yp); n = sinthe; face = 0; zeta = n; if (l > zeta) { face = 1; zeta = l; } if (m > zeta) { face = 2; zeta = m; } if (-l > zeta) { face = 3; zeta = -l; } if (-m > zeta) { face = 4; zeta = -m; } if (-n > zeta) { face = 5; zeta = -n; } zeco = 1.0 - zeta; switch (face) { case 1: xi = m; eta = n; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (*thetap)*D2R; p = atan2(*yp, *xp); zeco = (p*p + t*t)/2.0; } x0 = 0.0; y0 = 0.0; break; case 2: xi = -l; eta = n; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (*thetap)*D2R; p = atan2(*yp, *xp) - PI/2.0; zeco = (p*p + t*t)/2.0; } x0 = 2.0; y0 = 0.0; break; case 3: xi = -m; eta = n; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (*thetap)*D2R; p = atan2(*yp, *xp); p -= copysign(PI, p); zeco = (p*p + t*t)/2.0; } x0 = 4.0; y0 = 0.0; break; case 4: xi = l; eta = n; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (*thetap)*D2R; p = atan2(*yp, *xp) + PI/2.0; zeco = (p*p + t*t)/2.0; } x0 = 6; y0 = 0.0; break; case 5: xi = m; eta = l; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (*thetap + 90.0)*D2R; zeco = t*t/2.0; } x0 = 0.0; y0 = -2; break; default: /* face == 0 */ xi = m; eta = -l; if (zeco < 1.0e-8) { /* Small angle formula. */ t = (90.0 - *thetap)*D2R; zeco = t*t/2.0; } x0 = 0.0; y0 = 2.0; break; } xf = 0.0; yf = 0.0; if (xi != 0.0 || eta != 0.0) { if (-xi > fabs(eta)) { omega = eta/xi; tau = 1.0 + omega*omega; xf = -sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau))); yf = (xf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau))); } else if (xi > fabs(eta)) { omega = eta/xi; tau = 1.0 + omega*omega; xf = sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau))); yf = (xf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau))); } else if (-eta >= fabs(xi)) { omega = xi/eta; tau = 1.0 + omega*omega; yf = -sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau))); xf = (yf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau))); } else if (eta >= fabs(xi)) { omega = xi/eta; tau = 1.0 + omega*omega; yf = sqrt(zeco/(1.0 - 1.0/sqrt(1.0+tau))); xf = (yf/15.0)*(atand(omega) - asind(omega/sqrt(tau+tau))); } } istat = 0; if (fabs(xf) > 1.0) { if (fabs(xf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("qscs2x"); } xf = copysign(1.0, xf); } if (fabs(yf) > 1.0) { if (fabs(yf) > 1.0+tol) { istat = 1; if (!status) status = PRJERR_BAD_WORLD_SET("qscs2x"); } yf = copysign(1.0, yf); } *xp = prj->w[0]*(xf + x0) - prj->x0; *yp = prj->w[0]*(yf + y0) - prj->y0; *(statp++) = istat; } } return status; } /*============================================================================ * HPX: HEALPix projection. * * Given: * prj->pv[1] H - the number of facets in longitude. * prj->pv[2] K - the number of facets in latitude * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag HPX * prj->code "HPX" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->m True if H is odd. * prj->n True if K is odd. * prj->w[0] r0*(pi/180) * prj->w[1] (180/pi)/r0 * prj->w[2] (K-1)/K * prj->w[3] 90*K/H * prj->w[4] (K+1)/2 * prj->w[5] 90*(K-1)/H * prj->w[6] 180/H * prj->w[7] H/360 * prj->w[8] r0*(pi/180)*(90*K/H) * prj->w[9] r0*(pi/180)*(180/H) * prj->prjx2s Pointer to hpxx2s(). * prj->prjs2x Pointer to hpxs2x(). *===========================================================================*/ int hpxset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = HPX; strcpy(prj->code, "HPX"); if (undefined(prj->pv[1])) prj->pv[1] = 4.0; if (undefined(prj->pv[2])) prj->pv[2] = 3.0; strcpy(prj->name, "HEALPix"); prj->category = HEALPIX; prj->pvrange = 102; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->pv[1] <= 0.0 || prj->pv[2] <= 0.0) { return PRJERR_BAD_PARAM_SET("hpxset"); } prj->m = ((int)(prj->pv[1]+0.5))%2; prj->n = ((int)(prj->pv[2]+0.5))%2; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = R2D/prj->r0; } prj->w[2] = (prj->pv[2] - 1.0) / prj->pv[2]; prj->w[3] = 90.0 * prj->pv[2] / prj->pv[1]; prj->w[4] = (prj->pv[2] + 1.0) / 2.0; prj->w[5] = 90.0 * (prj->pv[2] - 1.0) / prj->pv[1]; prj->w[6] = 180.0 / prj->pv[1]; prj->w[7] = prj->pv[1] / 360.0; prj->w[8] = prj->w[3] * prj->w[0]; prj->w[9] = prj->w[6] * prj->w[0]; prj->prjx2s = hpxx2s; prj->prjs2x = hpxs2x; return prjoff(prj, 0.0, 0.0); } /*--------------------------------------------------------------------------*/ int hpxx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int h, mx, my, offset, rowlen, rowoff, status; double absy, s, sigma, slim, t, ylim, yr; register int istat, ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != HPX) { if ((status = hpxset(prj))) return status; } slim = prj->w[6] + 1e-12; ylim = prj->w[9] * prj->w[4]; if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { s = prj->w[1] * (*xp + prj->x0); /* x_c for K odd or theta > 0. */ t = -180.0 + (2.0 * floor((*xp + 180.0) * prj->w[7]) + 1.0) * prj->w[6]; t = prj->w[1] * (*xp - t); phip = phi + rowoff; thetap = theta + rowoff; for (iy = 0; iy < my; iy++) { /* theta[] is used to hold (x - x_c). */ *phip = s; *thetap = t; phip += rowlen; thetap += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yr = prj->w[1]*(*yp + prj->y0); absy = fabs(yr); istat = 0; if (absy <= prj->w[5]) { /* Equatorial regime. */ t = asind(yr/prj->w[3]); for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { *thetap = t; *(statp++) = 0; } } else if (absy <= ylim) { /* Polar regime. */ offset = (prj->n || *yp > 0.0) ? 0 : 1; sigma = prj->w[4] - absy / prj->w[6]; if (sigma == 0.0) { s = 1e9; t = 90.0; } else { t = 1.0 - sigma*sigma/prj->pv[2]; if (t < -1.0) { s = 0.0; t = 0.0; istat = 1; if (!status) status = PRJERR_BAD_PIX_SET("hpxx2s"); } else { s = 1.0/sigma; t = asind(t); } } if (*yp < 0.0) t = -t; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { if (offset) { /* Offset the southern polar half-facets for even K. */ h = (int)floor(*phip / prj->w[6]) + prj->m; if (h%2) { *thetap -= prj->w[6]; } else { *thetap += prj->w[6]; } } /* Recall that theta[] holds (x - x_c). */ s *= *thetap; if (fabs(s) < slim) { if (s != 0.0) s -= *thetap; *phip += s; *thetap = t; *(statp++) = istat; } else { /* Out-of-bounds. */ *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("hpxx2s"); } } } else { /* Beyond latitude range. */ for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { *phip = 0.0; *thetap = 0.0; *(statp++) = 1; } if (!status) status = PRJERR_BAD_PIX_SET("hpxx2s"); } } return status; } /*--------------------------------------------------------------------------*/ int hpxs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int h, mphi, mtheta, offset, rowlen, rowoff, status; double abssin, eta, sigma, sinthe, t, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != HPX) { if ((status = hpxset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { xi = prj->w[0] * (*phip) - prj->x0; /* phi_c for K odd or theta > 0. */ t = -180.0 + (2.0*floor((*phip+180.0) * prj->w[7]) + 1.0) * prj->w[6]; t = prj->w[0] * (*phip - t); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { /* y[] is used to hold (phi - phi_c). */ *xp = xi; *yp = t; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sinthe = sind(*thetap); abssin = fabs(sinthe); if (abssin <= prj->w[2]) { /* Equatorial regime. */ eta = prj->w[8] * sinthe - prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { *yp = eta; *(statp++) = 0; } } else { /* Polar regime. */ offset = (prj->n || *thetap > 0.0) ? 0 : 1; sigma = sqrt(prj->pv[2]*(1.0 - abssin)); xi = sigma - 1.0; eta = prj->w[9] * (prj->w[4] - sigma); if (*thetap < 0) eta = -eta; eta -= prj->y0; for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (offset) { /* Offset the southern polar half-facets for even K. */ h = (int)floor((*xp + prj->x0) / prj->w[9]) + prj->m; if (h%2) { *yp -= prj->w[9]; } else { *yp += prj->w[9]; } } /* Recall that y[] holds (phi - phi_c). */ *xp += *yp * xi; *yp = eta; *(statp++) = 0; /* Put the phi = 180 meridian in the expected place. */ if (180.0 < *xp) *xp = 360.0 - *xp; } } } return 0; } /*============================================================================ * XPH: HEALPix polar, aka "butterfly" projection. * * Given and/or returned: * prj->r0 Reset to 180/pi if 0. * prj->phi0 Reset to 0.0 if undefined. * prj->theta0 Reset to 0.0 if undefined. * * Returned: * prj->flag XPH * prj->code "XPH" * prj->x0 Fiducial offset in x. * prj->y0 Fiducial offset in y. * prj->w[0] r0*(pi/180)/sqrt(2) * prj->w[1] (180/pi)/r0/sqrt(2) * prj->w[2] 2/3 * prj->w[3] tol (= 1e-4) * prj->w[4] sqrt(2/3)*(180/pi) * prj->w[5] 90 - tol*sqrt(2/3)*(180/pi) * prj->w[6] sqrt(3/2)*(pi/180) * prj->prjx2s Pointer to xphx2s(). * prj->prjs2x Pointer to xphs2x(). *===========================================================================*/ int xphset(prj) struct prjprm *prj; { if (prj == 0x0) return PRJERR_NULL_POINTER; prj->flag = XPH; strcpy(prj->code, "XPH"); strcpy(prj->name, "butterfly"); prj->category = HEALPIX; prj->pvrange = 0; prj->simplezen = 0; prj->equiareal = 1; prj->conformal = 0; prj->global = 1; prj->divergent = 0; if (prj->r0 == 0.0) { prj->r0 = R2D; prj->w[0] = 1.0; prj->w[1] = 1.0; } else { prj->w[0] = prj->r0*D2R; prj->w[1] = R2D/prj->r0; } prj->w[0] /= sqrt(2.0); prj->w[1] /= sqrt(2.0); prj->w[2] = 2.0/3.0; prj->w[3] = 1e-4; prj->w[4] = sqrt(prj->w[2])*R2D; prj->w[5] = 90.0 - prj->w[3]*prj->w[4]; prj->w[6] = sqrt(1.5)*D2R; prj->prjx2s = xphx2s; prj->prjs2x = xphs2x; return prjoff(prj, 0.0, 90.0); } /*--------------------------------------------------------------------------*/ int xphx2s(prj, nx, ny, sxy, spt, x, y, phi, theta, stat) struct prjprm *prj; int nx, ny, sxy, spt; const double x[], y[]; double phi[], theta[]; int stat[]; { int mx, my, rowlen, rowoff, status; double abseta, eta, sigma, xi, xr, yr; register int ix, iy, *statp; register const double *xp, *yp; register double *phip, *thetap; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != XPH) { if ((status = xphset(prj))) return status; } if (ny > 0) { mx = nx; my = ny; } else { mx = 1; my = 1; ny = nx; } status = 0; /* Do x dependence. */ xp = x; rowoff = 0; rowlen = nx*spt; for (ix = 0; ix < nx; ix++, rowoff += spt, xp += sxy) { xr = (*xp + prj->x0)*prj->w[1]; phip = phi + rowoff; for (iy = 0; iy < my; iy++) { *phip = xr; phip += rowlen; } } /* Do y dependence. */ yp = y; phip = phi; thetap = theta; statp = stat; for (iy = 0; iy < ny; iy++, yp += sxy) { yr = (*yp + prj->y0)*prj->w[1]; for (ix = 0; ix < mx; ix++, phip += spt, thetap += spt) { xr = *phip; if (xr <= 0.0 && 0.0 < yr) { xi = -xr - yr; eta = xr - yr; *phip = -180.0; } else if (xr < 0.0 && yr <= 0.0) { xi = xr - yr; eta = xr + yr; *phip = -90.0; } else if (0.0 <= xr && yr < 0.0) { xi = xr + yr; eta = -xr + yr; *phip = 0.0; } else { xi = -xr + yr; eta = -xr - yr; *phip = 90.0; } xi += 45.0; eta += 90.0; abseta = fabs(eta); if (abseta <= 90.0) { if (abseta <= 45.0) { /* Equatorial regime. */ *phip += xi; *thetap = asind(eta/67.5); *(statp++) = 0; } else { /* Polar regime. */ sigma = (90.0 - abseta) / 45.0; /* Ensure an exact result for points on the boundary. */ if (xr == 0.0) { if (yr <= 0.0) { *phip = 0.0; } else { *phip = 180.0; } } else if (yr == 0.0) { if (xr < 0.0) { *phip = 270.0; } else { *phip = 90.0; } } else { *phip += 45.0 + (xi - 45.0)/sigma; } if (sigma < prj->w[3]) { *thetap = 90.0 - sigma*prj->w[4]; } else { *thetap = asind(1.0 - sigma*sigma/3.0); } if (eta < 0.0) *thetap = -(*thetap); *(statp++) = 0; } } else { /* Beyond latitude range. */ *phip = 0.0; *thetap = 0.0; *(statp++) = 1; if (!status) status = PRJERR_BAD_PIX_SET("xphx2s"); } } } return status; } /*--------------------------------------------------------------------------*/ int xphs2x(prj, nphi, ntheta, spt, sxy, phi, theta, x, y, stat) struct prjprm *prj; int nphi, ntheta, spt, sxy; const double phi[], theta[]; double x[], y[]; int stat[]; { int mphi, mtheta, rowlen, rowoff, status; double abssin, chi, eta, psi, sigma, sinthe, xi; register int iphi, itheta, *statp; register const double *phip, *thetap; register double *xp, *yp; /* Initialize. */ if (prj == 0x0) return PRJERR_NULL_POINTER; if (prj->flag != XPH) { if ((status = xphset(prj))) return status; } if (ntheta > 0) { mphi = nphi; mtheta = ntheta; } else { mphi = 1; mtheta = 1; ntheta = nphi; } /* Do phi dependence. */ phip = phi; rowoff = 0; rowlen = nphi*sxy; for (iphi = 0; iphi < nphi; iphi++, rowoff += sxy, phip += spt) { chi = *phip; if (180.0 <= fabs(chi)) { chi = fmod(chi, 360.0); if (chi < -180.0) { chi += 360.0; } else if (180.0 <= chi) { chi -= 360.0; } } /* phi is also recomputed from chi to avoid rounding problems. */ chi += 180.0; psi = fmod(chi, 90.0); xp = x + rowoff; yp = y + rowoff; for (itheta = 0; itheta < mtheta; itheta++) { /* y[] is used to hold phi (rounded). */ *xp = psi; *yp = chi - 180.0; xp += rowlen; yp += rowlen; } } /* Do theta dependence. */ thetap = theta; xp = x; yp = y; statp = stat; for (itheta = 0; itheta < ntheta; itheta++, thetap += spt) { sinthe = sind(*thetap); abssin = fabs(sinthe); for (iphi = 0; iphi < mphi; iphi++, xp += sxy, yp += sxy) { if (abssin <= prj->w[2]) { /* Equatorial regime. */ xi = *xp; eta = 67.5 * sinthe; } else { /* Polar regime. */ if (*thetap < prj->w[5]) { sigma = sqrt(3.0*(1.0 - abssin)); } else { sigma = (90.0 - *thetap)*prj->w[6]; } xi = 45.0 + (*xp - 45.0)*sigma; eta = 45.0 * (2.0 - sigma); if (*thetap < 0.0) eta = -eta; } xi -= 45.0; eta -= 90.0; /* Recall that y[] holds phi. */ if (*yp < -90.0) { *xp = prj->w[0]*(-xi + eta) - prj->x0; *yp = prj->w[0]*(-xi - eta) - prj->y0; } else if (*yp < 0.0) { *xp = prj->w[0]*(+xi + eta) - prj->x0; *yp = prj->w[0]*(-xi + eta) - prj->y0; } else if (*yp < 90.0) { *xp = prj->w[0]*( xi - eta) - prj->x0; *yp = prj->w[0]*( xi + eta) - prj->y0; } else { *xp = prj->w[0]*(-xi - eta) - prj->x0; *yp = prj->w[0]*( xi - eta) - prj->y0; } *(statp++) = 0; } } return 0; } astropy-0.3/cextern/wcslib/C/spx.c0000644000175000017500000006067712243255342015312 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: spx.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "spx.h" /* Map status return value to message. */ const char *spx_errmsg[] = { "Success", "Null spxprm pointer passed", "Invalid spectral parameters", "Invalid spectral variable", "One or more of the inspec coordinates were invalid"}; /* Convenience macro for invoking wcserr_set(). */ #define SPX_ERRMSG(status) WCSERR_SET(status), spx_errmsg[status] #define C 2.99792458e8 #define h 6.6260755e-34 /*============================================================================ * Spectral cross conversions; given one spectral coordinate it computes all * the others, plus the required derivatives of each with respect to the * others. *===========================================================================*/ int specx(type, spec, restfrq, restwav, spx) const char *type; double spec, restfrq, restwav; struct spxprm *spx; { static const char *function = "specx"; register int k; int haverest; double beta, dwaveawav, gamma, n, s, t, u; struct wcserr **err; if (spx == 0x0) return SPXERR_NULL_POINTER; err = &(spx->err); haverest = 1; if (restfrq == 0.0) { if (restwav == 0.0) { /* No line rest frequency supplied. */ haverest = 0; /* Temporarily set a dummy value for conversions. */ spx->restwav = 1.0; } else { spx->restwav = restwav; } spx->restfrq = C/spx->restwav; } else { spx->restfrq = restfrq; spx->restwav = C/restfrq; } spx->err = 0x0; /* Convert to frequency. */ spx->wavetype = 0; spx->velotype = 0; if (strcmp(type, "FREQ") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable: frequency == 0"); } spx->freq = spec; spx->wavetype = 1; } else if (strcmp(type, "AFRQ") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable: frequency == 0"); } spx->freq = spec/(2.0*PI); spx->wavetype = 1; } else if (strcmp(type, "ENER") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable: frequency == 0"); } spx->freq = spec/h; spx->wavetype = 1; } else if (strcmp(type, "WAVN") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable: frequency == 0"); } spx->freq = spec*C; spx->wavetype = 1; } else if (strcmp(type, "VRAD") == 0) { spx->freq = spx->restfrq*(1.0 - spec/C); spx->velotype = 1; } else if (strcmp(type, "WAVE") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable: frequency == 0"); } spx->freq = C/spec; spx->wavetype = 1; } else if (strcmp(type, "VOPT") == 0) { s = 1.0 + spec/C; if (s == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable"); } spx->freq = spx->restfrq/s; spx->velotype = 1; } else if (strcmp(type, "ZOPT") == 0) { s = 1.0 + spec; if (s == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable"); } spx->freq = spx->restfrq/s; spx->velotype = 1; } else if (strcmp(type, "AWAV") == 0) { if (spec == 0.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable"); } s = 1.0/spec; s *= s; n = 2.554e8 / (0.41e14 - s); n += 294.981e8 / (1.46e14 - s); n += 1.000064328; spx->freq = C/(spec*n); spx->wavetype = 1; } else if (strcmp(type, "VELO") == 0) { beta = spec/C; if (fabs(beta) == 1.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable"); } spx->freq = spx->restfrq*(1.0 - beta)/sqrt(1.0 - beta*beta); spx->velotype = 1; } else if (strcmp(type, "BETA") == 0) { if (fabs(spec) == 1.0) { return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_VAR), "Invalid spectral variable"); } spx->freq = spx->restfrq*(1.0 - spec)/sqrt(1.0 - spec*spec); spx->velotype = 1; } else { /* Unrecognized type. */ return wcserr_set(WCSERR_SET(SPXERR_BAD_SPEC_PARAMS), "Unrecognized spectral type '%s'", type); } /* Convert frequency to the other spectral types. */ n = 1.0; for (k = 0; k < 4; k++) { s = n*spx->freq/C; s *= s; t = 0.41e14 - s; u = 1.46e14 - s; n = 1.000064328 + (2.554e8/t + 294.981e8/u); } dwaveawav = n - 2.0*s*(2.554e8/(t*t) + 294.981e8/(u*u)); s = spx->freq/spx->restfrq; spx->ener = spx->freq*h; spx->afrq = spx->freq*(2.0*PI); spx->wavn = spx->freq/C; spx->vrad = C*(1.0 - s); spx->wave = C/spx->freq; spx->awav = spx->wave/n; spx->vopt = C*(1.0/s - 1.0); spx->zopt = spx->vopt/C; spx->velo = C*(1.0 - s*s)/(1.0 + s*s); spx->beta = spx->velo/C; /* Compute the required derivatives. */ gamma = 1.0/sqrt(1.0 - spx->beta*spx->beta); spx->dfreqafrq = 1.0/(2.0*PI); spx->dafrqfreq = 1.0/spx->dfreqafrq; spx->dfreqener = 1.0/h; spx->denerfreq = 1.0/spx->dfreqener; spx->dfreqwavn = C; spx->dwavnfreq = 1.0/spx->dfreqwavn; spx->dfreqvrad = -spx->restfrq/C; spx->dvradfreq = 1.0/spx->dfreqvrad; spx->dfreqwave = -spx->freq/spx->wave; spx->dwavefreq = 1.0/spx->dfreqwave; spx->dfreqawav = spx->dfreqwave * dwaveawav; spx->dawavfreq = 1.0/spx->dfreqawav; spx->dfreqvelo = -gamma*spx->restfrq/(C + spx->velo); spx->dvelofreq = 1.0/spx->dfreqvelo; spx->dwavevopt = spx->restwav/C; spx->dvoptwave = 1.0/spx->dwavevopt; spx->dwavezopt = spx->restwav; spx->dzoptwave = 1.0/spx->dwavezopt; spx->dwaveawav = dwaveawav; spx->dawavwave = 1.0/spx->dwaveawav; spx->dwavevelo = gamma*spx->restwav/(C - spx->velo); spx->dvelowave = 1.0/spx->dwavevelo; spx->dawavvelo = spx->dwavevelo/dwaveawav; spx->dveloawav = 1.0/spx->dawavvelo; spx->dvelobeta = C; spx->dbetavelo = 1.0/spx->dvelobeta; /* Reset values if no line rest frequency was supplied. */ if (haverest) { spx->wavetype = 1; spx->velotype = 1; } else { spx->restfrq = 0.0; spx->restwav = 0.0; if (!spx->wavetype) { /* Don't have wave characteristic types. */ spx->freq = 0.0; spx->afrq = 0.0; spx->ener = 0.0; spx->wavn = 0.0; spx->wave = 0.0; spx->awav = 0.0; spx->dfreqwave = 0.0; spx->dwavefreq = 0.0; spx->dfreqawav = 0.0; spx->dawavfreq = 0.0; spx->dwaveawav = 0.0; spx->dawavwave = 0.0; } else { /* Don't have velocity types. */ spx->vrad = 0.0; spx->vopt = 0.0; spx->zopt = 0.0; spx->velo = 0.0; spx->beta = 0.0; } spx->dfreqvrad = 0.0; spx->dvradfreq = 0.0; spx->dfreqvelo = 0.0; spx->dvelofreq = 0.0; spx->dwavevopt = 0.0; spx->dvoptwave = 0.0; spx->dwavezopt = 0.0; spx->dzoptwave = 0.0; spx->dwavevelo = 0.0; spx->dvelowave = 0.0; spx->dawavvelo = 0.0; spx->dveloawav = 0.0; } return 0; } /*============================================================================ * Conversions between frequency and vacuum wavelength. *===========================================================================*/ int freqwave(dummy, nfreq, sfreq, swave, freq, wave, stat) double dummy; int nfreq, sfreq, swave; const double freq[]; double wave[]; int stat[]; { int status = 0; register int ifreq, *statp; register const double *freqp; register double *wavep; freqp = freq; wavep = wave; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { if (*freqp != 0.0) { *wavep = C/(*freqp); *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } freqp += sfreq; wavep += swave; } return status; } /*--------------------------------------------------------------------------*/ int wavefreq(dummy, nwave, swave, sfreq, wave, freq, stat) double dummy; int nwave, swave, sfreq; const double wave[]; double freq[]; int stat[]; { int status = 0; register int iwave, *statp; register const double *wavep; register double *freqp; wavep = wave; freqp = freq; statp = stat; for (iwave = 0; iwave < nwave; iwave++) { if (*wavep != 0.0) { *freqp = C/(*wavep); *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } wavep += swave; freqp += sfreq; } return status; } /*============================================================================ * Conversions between frequency and air wavelength. *===========================================================================*/ int freqawav(dummy, nfreq, sfreq, sawav, freq, awav, stat) double dummy; int nfreq, sfreq, sawav; const double freq[]; double awav[]; int stat[]; { int status; if ((status = freqwave(dummy, nfreq, sfreq, sawav, freq, awav, stat))) { return status; } return waveawav(dummy, nfreq, sawav, sawav, awav, awav, stat); } /*--------------------------------------------------------------------------*/ int awavfreq(dummy, nawav, sawav, sfreq, awav, freq, stat) double dummy; int nawav, sawav, sfreq; const double awav[]; double freq[]; int stat[]; { int status; if ((status = awavwave(dummy, nawav, sawav, sfreq, awav, freq, stat))) { return status; } return wavefreq(dummy, nawav, sfreq, sfreq, freq, freq, stat); } /*============================================================================ * Conversions between frequency and relativistic velocity. *===========================================================================*/ int freqvelo(restfrq, nfreq, sfreq, svelo, freq, velo, stat) double restfrq; int nfreq, sfreq, svelo; const double freq[]; double velo[]; int stat[]; { double r, s; register int ifreq, *statp; register const double *freqp; register double *velop; r = restfrq*restfrq; freqp = freq; velop = velo; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { s = *freqp * *freqp; *velop = C*(r - s)/(r + s); *(statp++) = 0; freqp += sfreq; velop += svelo; } return 0; } /*--------------------------------------------------------------------------*/ int velofreq(restfrq, nvelo, svelo, sfreq, velo, freq, stat) double restfrq; int nvelo, svelo, sfreq; const double velo[]; double freq[]; int stat[]; { int status = 0; double s; register int ivelo, *statp; register const double *velop; register double *freqp; velop = velo; freqp = freq; statp = stat; for (ivelo = 0; ivelo < nvelo; ivelo++) { s = C + *velop; if (s != 0.0) { *freqp = restfrq*sqrt((C - *velop)/s); *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } velop += svelo; freqp += sfreq; } return status; } /*============================================================================ * Conversions between vacuum wavelength and air wavelength. *===========================================================================*/ int waveawav(dummy, nwave, swave, sawav, wave, awav, stat) double dummy; int nwave, swave, sawav; const double wave[]; double awav[]; int stat[]; { int status = 0; double n, s; register int iwave, k, *statp; register const double *wavep; register double *awavp; wavep = wave; awavp = awav; statp = stat; for (iwave = 0; iwave < nwave; iwave++) { if (*wavep != 0.0) { n = 1.0; for (k = 0; k < 4; k++) { s = n/(*wavep); s *= s; n = 2.554e8 / (0.41e14 - s); n += 294.981e8 / (1.46e14 - s); n += 1.000064328; } *awavp = (*wavep)/n; *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } wavep += swave; awavp += sawav; } return status; } /*--------------------------------------------------------------------------*/ int awavwave(dummy, nawav, sawav, swave, awav, wave, stat) double dummy; int nawav, sawav, swave; const double awav[]; double wave[]; int stat[]; { int status = 0; double n, s; register int iawav, *statp; register const double *awavp; register double *wavep; awavp = awav; wavep = wave; statp = stat; for (iawav = 0; iawav < nawav; iawav++) { if (*awavp != 0.0) { s = 1.0/(*awavp); s *= s; n = 2.554e8 / (0.41e14 - s); n += 294.981e8 / (1.46e14 - s); n += 1.000064328; *wavep = (*awavp)*n; *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } awavp += sawav; wavep += swave; } return status; } /*============================================================================ * Conversions between vacuum wavelength and relativistic velocity. *===========================================================================*/ int wavevelo(restwav, nwave, swave, svelo, wave, velo, stat) double restwav; int nwave, swave, svelo; const double wave[]; double velo[]; int stat[]; { double r, s; register int iwave, *statp; register const double *wavep; register double *velop; r = restwav*restwav; wavep = wave; velop = velo; statp = stat; for (iwave = 0; iwave < nwave; iwave++) { s = *wavep * *wavep; *velop = C*(s - r)/(s + r); *(statp++) = 0; wavep += swave; velop += svelo; } return 0; } /*--------------------------------------------------------------------------*/ int velowave(restwav, nvelo, svelo, swave, velo, wave, stat) double restwav; int nvelo, svelo, swave; const double velo[]; double wave[]; int stat[]; { int status = 0; double s; register int ivelo, *statp; register const double *velop; register double *wavep; velop = velo; wavep = wave; statp = stat; for (ivelo = 0; ivelo < nvelo; ivelo++) { s = C - *velop; if (s != 0.0) { *wavep = restwav*sqrt((C + *velop)/s); *(statp++) = 0; } else { *(statp++) = 1; status = SPXERR_BAD_INSPEC_COORD; } velop += svelo; wavep += swave; } return status; } /*============================================================================ * Conversions between air wavelength and relativistic velocity. *===========================================================================*/ int awavvelo(dummy, nawav, sawav, svelo, awav, velo, stat) double dummy; int nawav, sawav, svelo; const double awav[]; double velo[]; int stat[]; { int status; if ((status = awavwave(dummy, nawav, sawav, svelo, awav, velo, stat))) { return status; } return wavevelo(dummy, nawav, svelo, svelo, velo, velo, stat); } /*--------------------------------------------------------------------------*/ int veloawav(dummy, nvelo, svelo, sawav, velo, awav, stat) double dummy; int nvelo, svelo, sawav; const double velo[]; double awav[]; int stat[]; { int status; if ((status = velowave(dummy, nvelo, svelo, sawav, velo, awav, stat))) { return status; } return waveawav(dummy, nvelo, sawav, sawav, awav, awav, stat); } /*============================================================================ * Conversions between frequency and angular frequency. *===========================================================================*/ int freqafrq(dummy, nfreq, sfreq, safrq, freq, afrq, stat) double dummy; int nfreq, sfreq, safrq; const double freq[]; double afrq[]; int stat[]; { register int ifreq, *statp; register const double *freqp; register double *afrqp; freqp = freq; afrqp = afrq; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { *afrqp = (*freqp)*(2.0*PI); *(statp++) = 0; freqp += sfreq; afrqp += safrq; } return 0; } /*--------------------------------------------------------------------------*/ int afrqfreq(dummy, nafrq, safrq, sfreq, afrq, freq, stat) double dummy; int nafrq, safrq, sfreq; const double afrq[]; double freq[]; int stat[]; { register int iafrq, *statp; register const double *afrqp; register double *freqp; afrqp = afrq; freqp = freq; statp = stat; for (iafrq = 0; iafrq < nafrq; iafrq++) { *freqp = (*afrqp)/(2.0*PI); *(statp++) = 0; afrqp += safrq; freqp += sfreq; } return 0; } /*============================================================================ * Conversions between frequency and energy. *===========================================================================*/ int freqener(dummy, nfreq, sfreq, sener, freq, ener, stat) double dummy; int nfreq, sfreq, sener; const double freq[]; double ener[]; int stat[]; { register int ifreq, *statp; register const double *freqp; register double *enerp; freqp = freq; enerp = ener; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { *enerp = (*freqp)*h; *(statp++) = 0; freqp += sfreq; enerp += sener; } return 0; } /*--------------------------------------------------------------------------*/ int enerfreq(dummy, nener, sener, sfreq, ener, freq, stat) double dummy; int nener, sener, sfreq; const double ener[]; double freq[]; int stat[]; { register int iener, *statp; register const double *enerp; register double *freqp; enerp = ener; freqp = freq; statp = stat; for (iener = 0; iener < nener; iener++) { *freqp = (*enerp)/h; *(statp++) = 0; enerp += sener; freqp += sfreq; } return 0; } /*============================================================================ * Conversions between frequency and wave number. *===========================================================================*/ int freqwavn(dummy, nfreq, sfreq, swavn, freq, wavn, stat) double dummy; int nfreq, sfreq, swavn; const double freq[]; double wavn[]; int stat[]; { register int ifreq, *statp; register const double *freqp; register double *wavnp; freqp = freq; wavnp = wavn; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { *wavnp = (*freqp)/C; *(statp++) = 0; freqp += sfreq; wavnp += swavn; } return 0; } /*--------------------------------------------------------------------------*/ int wavnfreq(dummy, nwavn, swavn, sfreq, wavn, freq, stat) double dummy; int nwavn, swavn, sfreq; const double wavn[]; double freq[]; int stat[]; { register int iwavn, *statp; register const double *wavnp; register double *freqp; wavnp = wavn; freqp = freq; statp = stat; for (iwavn = 0; iwavn < nwavn; iwavn++) { *freqp = (*wavnp)*C; *(statp++) = 0; wavnp += swavn; freqp += sfreq; } return 0; } /*============================================================================ * Conversions between frequency and radio velocity. *===========================================================================*/ int freqvrad(restfrq, nfreq, sfreq, svrad, freq, vrad, stat) double restfrq; int nfreq, sfreq, svrad; const double freq[]; double vrad[]; int stat[]; { double r; register int ifreq, *statp; register const double *freqp; register double *vradp; if (restfrq == 0.0) { return SPXERR_BAD_SPEC_PARAMS; } r = C/restfrq; freqp = freq; vradp = vrad; statp = stat; for (ifreq = 0; ifreq < nfreq; ifreq++) { *vradp = r*(restfrq - *freqp); *(statp++) = 0; freqp += sfreq; vradp += svrad; } return 0; } /*--------------------------------------------------------------------------*/ int vradfreq(restfrq, nvrad, svrad, sfreq, vrad, freq, stat) double restfrq; int nvrad, svrad, sfreq; const double vrad[]; double freq[]; int stat[]; { double r; register int ivrad, *statp; register const double *vradp; register double *freqp; r = restfrq/C; vradp = vrad; freqp = freq; statp = stat; for (ivrad = 0; ivrad < nvrad; ivrad++) { *freqp = r*(C - *vradp); *(statp++) = 0; vradp += svrad; freqp += sfreq; } return 0; } /*============================================================================ * Conversions between vacuum wavelength and optical velocity. *===========================================================================*/ int wavevopt(restwav, nwave, swave, svopt, wave, vopt, stat) double restwav; int nwave, swave, svopt; const double wave[]; double vopt[]; int stat[]; { double r; register int iwave, *statp; register const double *wavep; register double *voptp; if (restwav == 0.0) { return SPXERR_BAD_SPEC_PARAMS; } r = C/restwav; wavep = wave; voptp = vopt; statp = stat; for (iwave = 0; iwave < nwave; iwave++) { *voptp = r*(*wavep) - C; *(statp++) = 0; wavep += swave; voptp += svopt; } return 0; } /*--------------------------------------------------------------------------*/ int voptwave(restwav, nvopt, svopt, swave, vopt, wave, stat) double restwav; int nvopt, svopt, swave; const double vopt[]; double wave[]; int stat[]; { double r; register int ivopt, *statp; register const double *voptp; register double *wavep; r = restwav/C; voptp = vopt; wavep = wave; statp = stat; for (ivopt = 0; ivopt < nvopt; ivopt++) { *wavep = r*(C + *voptp); *(statp++) = 0; voptp += svopt; wavep += swave; } return 0; } /*============================================================================ * Conversions between vacuum wavelength and redshift. *===========================================================================*/ int wavezopt(restwav, nwave, swave, szopt, wave, zopt, stat) double restwav; int nwave, swave, szopt; const double wave[]; double zopt[]; int stat[]; { double r; register int iwave, *statp; register const double *wavep; register double *zoptp; if (restwav == 0.0) { return SPXERR_BAD_SPEC_PARAMS; } r = 1.0/restwav; wavep = wave; zoptp = zopt; statp = stat; for (iwave = 0; iwave < nwave; iwave++) { *zoptp = r*(*wavep) - 1.0; *(statp++) = 0; wavep += swave; zoptp += szopt; } return 0; } /*--------------------------------------------------------------------------*/ int zoptwave(restwav, nzopt, szopt, swave, zopt, wave, stat) double restwav; int nzopt, szopt, swave; const double zopt[]; double wave[]; int stat[]; { register int izopt, *statp; register const double *zoptp; register double *wavep; zoptp = zopt; wavep = wave; statp = stat; for (izopt = 0; izopt < nzopt; izopt++) { *wavep = restwav*(1.0 + *zoptp); *(statp++) = 0; zoptp += szopt; wavep += swave; } return 0; } /*============================================================================ * Conversions between relativistic velocity and beta (= v/c). *===========================================================================*/ int velobeta(dummy, nvelo, svelo, sbeta, velo, beta, stat) double dummy; int nvelo, svelo, sbeta; const double velo[]; double beta[]; int stat[]; { register int ivelo, *statp; register const double *velop; register double *betap; velop = velo; betap = beta; statp = stat; for (ivelo = 0; ivelo < nvelo; ivelo++) { *betap = (*velop)/C; *(statp++) = 0; velop += svelo; betap += sbeta; } return 0; } /*--------------------------------------------------------------------------*/ int betavelo(dummy, nbeta, sbeta, svelo, beta, velo, stat) double dummy; int nbeta, sbeta, svelo; const double beta[]; double velo[]; int stat[]; { register int ibeta, *statp; register const double *betap; register double *velop; betap = beta; velop = velo; statp = stat; for (ibeta = 0; ibeta < nbeta; ibeta++) { *velop = (*betap)*C; *(statp++) = 0; betap += sbeta; velop += svelo; } return 0; } astropy-0.3/cextern/wcslib/C/spx.h0000644000175000017500000004656112243255342015313 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: spx.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the spectral coordinate systems * recognized by the FITS World Coordinate System (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the spx routines * --------------------------- * specx() is a scalar routine that, given one spectral variable (e.g. * frequency), computes all the others (e.g. wavelength, velocity, etc.) plus * the required derivatives of each with respect to the others. The results * are returned in the spxprm struct. * * The remaining routines are all vector conversions from one spectral * variable to another. The API of these functions only differ in whether the * rest frequency or wavelength need be supplied. * * Non-linear: * - freqwave() frequency -> vacuum wavelength * - wavefreq() vacuum wavelength -> frequency * * - freqawav() frequency -> air wavelength * - awavfreq() air wavelength -> frequency * * - freqvelo() frequency -> relativistic velocity * - velofreq() relativistic velocity -> frequency * * - waveawav() vacuum wavelength -> air wavelength * - awavwave() air wavelength -> vacuum wavelength * * - wavevelo() vacuum wavelength -> relativistic velocity * - velowave() relativistic velocity -> vacuum wavelength * * - awavvelo() air wavelength -> relativistic velocity * - veloawav() relativistic velocity -> air wavelength * * Linear: * - freqafrq() frequency -> angular frequency * - afrqfreq() angular frequency -> frequency * * - freqener() frequency -> energy * - enerfreq() energy -> frequency * * - freqwavn() frequency -> wave number * - wavnfreq() wave number -> frequency * * - freqvrad() frequency -> radio velocity * - vradfreq() radio velocity -> frequency * * - wavevopt() vacuum wavelength -> optical velocity * - voptwave() optical velocity -> vacuum wavelength * * - wavezopt() vacuum wavelength -> redshift * - zoptwave() redshift -> vacuum wavelength * * - velobeta() relativistic velocity -> beta (= v/c) * - betavelo() beta (= v/c) -> relativistic velocity * * These are the workhorse routines, to be used for fast transformations. * Conversions may be done "in place" by calling the routine with the output * vector set to the input. * * Argument checking: * ------------------ * The input spectral values are only checked for values that would result * in floating point exceptions. In particular, negative frequencies and * wavelengths are allowed, as are velocities greater than the speed of * light. The same is true for the spectral parameters - rest frequency and * wavelength. * * Accuracy: * --------- * No warranty is given for the accuracy of these routines (refer to the * copyright notice); intending users must satisfy for themselves their * adequacy for the intended purpose. However, closure effectively to within * double precision rounding error was demonstrated by test routine tspec.c * which accompanies this software. * * * specx() - Spectral cross conversions (scalar) * --------------------------------------------- * Given one spectral variable specx() computes all the others, plus the * required derivatives of each with respect to the others. * * Given: * type const char* * The type of spectral variable given by spec, FREQ, * AFRQ, ENER, WAVN, VRAD, WAVE, VOPT, ZOPT, AWAV, VELO, * or BETA (case sensitive). * * spec double The spectral variable given, in SI units. * * restfrq, * restwav double Rest frequency [Hz] or rest wavelength in vacuo [m], * only one of which need be given. The other should be * set to zero. If both are zero, only a subset of the * spectral variables can be computed, the remainder are * set to zero. Specifically, given one of FREQ, AFRQ, * ENER, WAVN, WAVE, or AWAV the others can be computed * without knowledge of the rest frequency. Likewise, * VRAD, VOPT, ZOPT, VELO, and BETA. * * Given and returned: * specs struct spxprm* * Data structure containing all spectral variables and * their derivatives, in SI units. * * Function return value: * int Status return value: * 0: Success. * 1: Null spxprm pointer passed. * 2: Invalid spectral parameters. * 3: Invalid spectral variable. * * For returns > 1, a detailed error message is set in * spxprm::err if enabled, see wcserr_enable(). * * freqafrq(), afrqfreq(), freqener(), enerfreq(), freqwavn(), wavnfreq(), * freqwave(), wavefreq(), freqawav(), awavfreq(), waveawav(), awavwave(), * velobeta(), and betavelo() implement vector conversions between wave-like * or velocity-like spectral types (i.e. conversions that do not need the rest * frequency or wavelength). They all have the same API. * * * freqafrq() - Convert frequency to angular frequency (vector) * ------------------------------------------------------------ * freqafrq() converts frequency to angular frequency. * * Given: * param double Ignored. * * nspec int Vector length. * * instep, * outstep int Vector strides. * * inspec const double[] * Input spectral variables, in SI units. * * Returned: * outspec double[] Output spectral variables, in SI units. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of inspec. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * 4: One or more of the inspec coordinates were * invalid, as indicated by the stat vector. * * * freqvelo(), velofreq(), freqvrad(), and vradfreq() implement vector * conversions between frequency and velocity spectral types. They all have * the same API. * * * freqvelo() - Convert frequency to relativistic velocity (vector) * ---------------------------------------------------------------- * freqvelo() converts frequency to relativistic velocity. * * Given: * param double Rest frequency [Hz]. * * nspec int Vector length. * * instep, * outstep int Vector strides. * * inspec const double[] * Input spectral variables, in SI units. * * Returned: * outspec double[] Output spectral variables, in SI units. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of inspec. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * 4: One or more of the inspec coordinates were * invalid, as indicated by the stat vector. * * * wavevelo(), velowave(), awavvelo(), veloawav(), wavevopt(), voptwave(), * wavezopt(), and zoptwave() implement vector conversions between wavelength * and velocity spectral types. They all have the same API. * * * wavevelo() - Conversions between wavelength and velocity types (vector) * ----------------------------------------------------------------------- * wavevelo() converts vacuum wavelength to relativistic velocity. * * Given: * param double Rest wavelength in vacuo [m]. * * nspec int Vector length. * * instep, * outstep int Vector strides. * * inspec const double[] * Input spectral variables, in SI units. * * Returned: * outspec double[] Output spectral variables, in SI units. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of inspec. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * 4: One or more of the inspec coordinates were * invalid, as indicated by the stat vector. * * * spxprm struct - Spectral variables and their derivatives * -------------------------------------------------------- * The spxprm struct contains the value of all spectral variables and their * derivatives. It is used solely by specx() which constructs it from * information provided via its function arguments. * * This struct should be considered read-only, no members need ever be set nor * should ever be modified by the user. * * double restfrq * (Returned) Rest frequency [Hz]. * * double restwav * (Returned) Rest wavelength [m]. * * int wavetype * (Returned) True if wave types have been computed, and ... * * int velotype * (Returned) ... true if velocity types have been computed; types are * defined below. * * If one or other of spxprm::restfrq and spxprm::restwav is given * (non-zero) then all spectral variables may be computed. If both are * given, restfrq is used. If restfrq and restwav are both zero, only wave * characteristic xor velocity type spectral variables may be computed * depending on the variable given. These flags indicate what is * available. * * double freq * (Returned) Frequency [Hz] (wavetype). * * double afrq * (Returned) Angular frequency [rad/s] (wavetype). * * double ener * (Returned) Photon energy [J] (wavetype). * * double wavn * (Returned) Wave number [/m] (wavetype). * * double vrad * (Returned) Radio velocity [m/s] (velotype). * * double wave * (Returned) Vacuum wavelength [m] (wavetype). * * double vopt * (Returned) Optical velocity [m/s] (velotype). * * double zopt * (Returned) Redshift [dimensionless] (velotype). * * double awav * (Returned) Air wavelength [m] (wavetype). * * double velo * (Returned) Relativistic velocity [m/s] (velotype). * * double beta * (Returned) Relativistic beta [dimensionless] (velotype). * * double dfreqafrq * (Returned) Derivative of frequency with respect to angular frequency * [/rad] (constant, = 1 / 2*pi), and ... * double dafrqfreq * (Returned) ... vice versa [rad] (constant, = 2*pi, always available). * * double dfreqener * (Returned) Derivative of frequency with respect to photon energy * [/J/s] (constant, = 1/h), and ... * double denerfreq * (Returned) ... vice versa [Js] (constant, = h, Planck's constant, * always available). * * double dfreqwavn * (Returned) Derivative of frequency with respect to wave number [m/s] * (constant, = c, the speed of light in vacuo), and ... * double dwavnfreq * (Returned) ... vice versa [s/m] (constant, = 1/c, always available). * * double dfreqvrad * (Returned) Derivative of frequency with respect to radio velocity [/m], * and ... * double dvradfreq * (Returned) ... vice versa [m] (wavetype && velotype). * * double dfreqwave * (Returned) Derivative of frequency with respect to vacuum wavelength * [/m/s], and ... * double dwavefreq * (Returned) ... vice versa [m s] (wavetype). * * double dfreqawav * (Returned) Derivative of frequency with respect to air wavelength, * [/m/s], and ... * double dawavfreq * (Returned) ... vice versa [m s] (wavetype). * * double dfreqvelo * (Returned) Derivative of frequency with respect to relativistic * velocity [/m], and ... * double dvelofreq * (Returned) ... vice versa [m] (wavetype && velotype). * * double dwavevopt * (Returned) Derivative of vacuum wavelength with respect to optical * velocity [s], and ... * double dvoptwave * (Returned) ... vice versa [/s] (wavetype && velotype). * * double dwavezopt * (Returned) Derivative of vacuum wavelength with respect to redshift [m], * and ... * double dzoptwave * (Returned) ... vice versa [/m] (wavetype && velotype). * * double dwaveawav * (Returned) Derivative of vacuum wavelength with respect to air * wavelength [dimensionless], and ... * double dawavwave * (Returned) ... vice versa [dimensionless] (wavetype). * * double dwavevelo * (Returned) Derivative of vacuum wavelength with respect to relativistic * velocity [s], and ... * double dvelowave * (Returned) ... vice versa [/s] (wavetype && velotype). * * double dawavvelo * (Returned) Derivative of air wavelength with respect to relativistic * velocity [s], and ... * double dveloawav * (Returned) ... vice versa [/s] (wavetype && velotype). * * double dvelobeta * (Returned) Derivative of relativistic velocity with respect to * relativistic beta [m/s] (constant, = c, the speed of light in vacuo), * and ... * double dbetavelo * (Returned) ... vice versa [s/m] (constant, = 1/c, always available). * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * void *padding * (An unused variable inserted for alignment purposes only.) * * Global variable: const char *spx_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_SPEC #define WCSLIB_SPEC #ifdef __cplusplus extern "C" { #endif #include "wcserr.h" extern const char *spx_errmsg[]; enum spx_errmsg { SPXERR_SUCCESS = 0, /* Success. */ SPXERR_NULL_POINTER = 1, /* Null spxprm pointer passed. */ SPXERR_BAD_SPEC_PARAMS = 2, /* Invalid spectral parameters. */ SPXERR_BAD_SPEC_VAR = 3, /* Invalid spectral variable. */ SPXERR_BAD_INSPEC_COORD = 4 /* One or more of the inspec coordinates were invalid. */ }; struct spxprm { double restfrq, restwav; /* Rest frequency [Hz] and wavelength [m]. */ int wavetype, velotype; /* True if wave/velocity types have been */ /* computed; types are defined below. */ /* Spectral variables computed by specx(). */ /*------------------------------------------------------------------------*/ double freq, /* wavetype: Frequency [Hz]. */ afrq, /* wavetype: Angular frequency [rad/s]. */ ener, /* wavetype: Photon energy [J]. */ wavn, /* wavetype: Wave number [/m]. */ vrad, /* velotype: Radio velocity [m/s]. */ wave, /* wavetype: Vacuum wavelength [m]. */ vopt, /* velotype: Optical velocity [m/s]. */ zopt, /* velotype: Redshift. */ awav, /* wavetype: Air wavelength [m]. */ velo, /* velotype: Relativistic velocity [m/s]. */ beta; /* velotype: Relativistic beta. */ /* Derivatives of spectral variables computed by specx(). */ /*------------------------------------------------------------------------*/ double dfreqafrq, dafrqfreq, /* Constant, always available. */ dfreqener, denerfreq, /* Constant, always available. */ dfreqwavn, dwavnfreq, /* Constant, always available. */ dfreqvrad, dvradfreq, /* wavetype && velotype. */ dfreqwave, dwavefreq, /* wavetype. */ dfreqawav, dawavfreq, /* wavetype. */ dfreqvelo, dvelofreq, /* wavetype && velotype. */ dwavevopt, dvoptwave, /* wavetype && velotype. */ dwavezopt, dzoptwave, /* wavetype && velotype. */ dwaveawav, dawavwave, /* wavetype. */ dwavevelo, dvelowave, /* wavetype && velotype. */ dawavvelo, dveloawav, /* wavetype && velotype. */ dvelobeta, dbetavelo; /* Constant, always available. */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private */ /*------------------------------------------------------------------------*/ void *padding; /* (Dummy inserted for alignment purposes.) */ }; /* Size of the spxprm struct in int units, used by the Fortran wrappers. */ #define SPXLEN (sizeof(struct spxprm)/sizeof(int)) int specx(const char *type, double spec, double restfrq, double restwav, struct spxprm *specs); /* For use in declaring function prototypes, e.g. in spcprm. */ #define SPX_ARGS double param, int nspec, int instep, int outstep, \ const double inspec[], double outspec[], int stat[] int freqafrq(SPX_ARGS); int afrqfreq(SPX_ARGS); int freqener(SPX_ARGS); int enerfreq(SPX_ARGS); int freqwavn(SPX_ARGS); int wavnfreq(SPX_ARGS); int freqwave(SPX_ARGS); int wavefreq(SPX_ARGS); int freqawav(SPX_ARGS); int awavfreq(SPX_ARGS); int waveawav(SPX_ARGS); int awavwave(SPX_ARGS); int velobeta(SPX_ARGS); int betavelo(SPX_ARGS); int freqvelo(SPX_ARGS); int velofreq(SPX_ARGS); int freqvrad(SPX_ARGS); int vradfreq(SPX_ARGS); int wavevelo(SPX_ARGS); int velowave(SPX_ARGS); int awavvelo(SPX_ARGS); int veloawav(SPX_ARGS); int wavevopt(SPX_ARGS); int voptwave(SPX_ARGS); int wavezopt(SPX_ARGS); int zoptwave(SPX_ARGS); #ifdef __cplusplus } #endif #endif /* WCSLIB_SPEC */ astropy-0.3/cextern/wcslib/C/wcsbth.l0000644000175000017500000015327312243255342015776 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsbth.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical * scanner for parsing the WCS keyrecords for one or more image arrays and/or * pixel lists in a FITS binary table header. It can also handle primary image * and image extension headers. * * wcsbth.l requires Flex v2.5.4 or later. Refer to wcshdr.h for a description * of the user interface and operating notes. * * Implementation notes * -------------------- * wcsbth() may be invoked with an option that causes it to recognise the * image-header form of WCS keywords as defaults for each alternate coordinate * representation (up to 27). By design, with this option enabled wcsbth() can * also handle primary image and image extension headers, effectively treating * them as a single-column binary table though with WCS keywords of a different * form. * * NAXIS is always 2 for binary tables, it refers to the two-dimensional nature * of the table. Thus NAXIS does not count the number of image axes in either * image arrays or pixels lists and for the latter there is not even a formal * equivalent of WCSAXESa. Hence NAXIS is always ignored and a first pass * through the header is required to determine the number of images, the number * of alternate coordinate representations for each image (up to 27), and the * number of coordinate axes in each representation; this pass also counts the * number of iPVn_ma and iPSn_ma or TVk_ma and TSk_ma keywords in each * representation. * * On completion of the first pass, the association between column number and * axis number is defined for each representation of a pixel list. Memory is * allocated for an array of the required number of wcsprm structs and each of * these is initialized appropriately. These structs are filled in the second * pass. * * It is permissible for a scalar table column to contain degenerate (single- * point) image arrays and simultaneously form one axis of a pixel list. * * The parser does not check for duplicated keywords, for most keywords it * accepts the last encountered. * * wcsbth() does not currently handle the Green Bank convention. * *===========================================================================*/ /* Options. */ %option full %option never-interactive %option noyywrap %option outfile="wcsbth.c" %option prefix="wcsbth" /* Indices for parameterized keywords. */ I0 [0-9] I1 [1-9] I2 [1-9][0-9] I3 [1-9][0-9]{2} I4 [1-9][0-9]{3} /* Alternate coordinate system identifier. */ ALT [ A-Z] /* Keyvalue data types. */ INTEGER [+-]?[0-9]+ FLOAT [+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)? STRING '([^']|'')*' /* Exclusive start states. */ %x CCCCCia iCCCna iCCCCn TCCCna TCCCCn %x CCi_ja ijCCna TCn_ka TCCn_ka %x CROTAi iCROTn TCROTn %x CCi_ma iCn_ma iCCn_ma TCn_ma TCCn_ma %x PROJPm %x CCCCCCCC CCCCCCCa %x CCCCna CCCCCna %x CCCCn CCCCCn %x VALUE INTEGER_VAL FLOAT_VAL STRING_VAL %x COMMENT DISCARD ERROR FLUSH %{ #include #include #include #include #include #include "wcs.h" #include "wcshdr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcsutil.h" /* Codes used for keyvalue data types. */ #define INTEGER 0 #define FLOAT 1 #define STRING 2 /* Bit masks used for keyword types: */ #define IMGAUX 0x1 /* Auxiliary image header, e.g. LONPOLEa or */ /* DATE-OBS. */ #define IMGAXIS 0x2 /* Image header with axis number, e.g. */ /* CTYPEia. */ #define IMGHEAD 0x3 /* Image header of either type. */ #define BIMGARR 0x4 /* Binary table image array with axis */ /* number, e.g. iCTYna. */ #define PIXLIST 0x8 /* Pixel list, e.g. TCTYna. */ #define BINTAB 0xC /* Shared binary table image array (without */ /* axis number) or pixel list, e.g. LONPna */ /* or OBSGXn. */ #define YY_DECL int wcsbth(char *header, int nkeyrec, int relax, int ctrl, \ int keysel, int *colsel, int *nreject, int *nwcs, \ struct wcsprm **wcs) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (wcsbth_nkeyrec) { \ strncpy(inbuff, wcsbth_hdr, 80); \ inbuff[80] = '\n'; \ wcsbth_hdr += 80; \ wcsbth_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* A convenience macro to get around incompatibilities between unput() and yyless(): put yytext followed by a blank back onto the input stream. */ #define WCSBTH_PUTBACK \ sprintf(stmp, "%s ", yytext); \ itmp = strlen(stmp); \ while (itmp) unput(stmp[--itmp]); /* These global variables are required by YY_INPUT. */ char *wcsbth_hdr; int wcsbth_nkeyrec; /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsbth_abort_jmp_env; #define exit(status) longjmp(wcsbth_abort_jmp_env, status) /* Struct used internally for header bookkeeping. */ struct wcsbth_alts { int ncol, ialt, icol, imgherit; short int (*arridx)[27]; short int pixidx[27]; short int pad1; unsigned int *pixlist; unsigned char (*npv)[27]; unsigned char (*nps)[27]; unsigned char pixnpv[27]; unsigned char pixnps[27]; unsigned char pad2[2]; }; int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts); int wcsbth_init1(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs); struct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts, int keytype, int n, char a); int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a); int wcsbth_epoch(void *wptr); int wcsbth_vsource(void *wptr); int wcsbth_final(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs); %} %% /* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */ char a; int i, j, k, m, n; char *cptr, *errmsg, errtxt[80], exclude[1000], *extkey, *hptr, ptype, stmp[16]; int altlin, ialt, icol, incl, ipass, ipx, itmp, ix, jx, keytype, nsel, npass, status, valtype, voff; void *vptr, *wptr; struct wcsbth_alts alts; struct wcsprm *wcsp, wcstem; int (*special)(void *); int yylex_destroy(void); /* The data structures produced. */ *nwcs = 0; *wcs = 0x0; /* Parameters used to implement YY_INPUT. */ wcsbth_hdr = header; wcsbth_nkeyrec = nkeyrec; /* Our handle on the input stream. */ hptr = header; *nreject = 0; /* Keyword parameters. */ i = j = 0; n = k = 0; m = 0; a = ' '; /* Header bookkeeping. */ alts.ncol = 0; alts.arridx = 0x0; alts.pixlist = 0x0; alts.npv = 0x0; alts.nps = 0x0; for (ialt = 0; ialt < 27; ialt++) { alts.pixidx[ialt] = 0; alts.pixnpv[ialt] = 0; alts.pixnps[ialt] = 0; } /* For decoding the keyvalue. */ keytype = 0; valtype = -1; vptr = 0x0; /* For keywords that require special handling. */ altlin = 0; ptype = ' '; special = 0x0; /* Selection by column number. */ nsel = colsel ? colsel[0] : 0; incl = (nsel > 0); for (icol = 0; icol < 1000; icol++) { exclude[icol] = incl; } for (icol = 1; icol <= abs(nsel); icol++) { itmp = colsel[icol]; if (0 < itmp && itmp < 1000) { exclude[itmp] = !incl; } } exclude[0] = 0; /* Selection by keyword type. */ itmp = keysel; keysel = 0; if (itmp) { if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD; if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR; if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST; } if (keysel == 0) { keysel = IMGHEAD | BINTAB; } /* Control variables. */ ipass = 1; npass = 2; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsbth_abort_jmp_env)) { return 4; } BEGIN(INITIAL); ^TFIELDS" = "" "*{INTEGER} { if (ipass == 1) { if (alts.ncol == 0) { sscanf(yytext, "TFIELDS = %d", &(alts.ncol)); BEGIN(FLUSH); } else { errmsg = "Duplicate or out-of-sequence TFIELDS keyword"; BEGIN(ERROR); } } else { BEGIN(FLUSH); } } ^WCSAXES{ALT}=" "" "*{INTEGER} { keytype = IMGAXIS; if (!(keytype & keysel)) { /* Ignore this key type. */ BEGIN(DISCARD); } else { if (relax & WCSHDR_ALLIMG) { if (ipass == 1) { sscanf(yytext, "WCSAXES%c= %d", &a, &i); wcsbth_pass1(IMGAXIS, i, 0, 0, 0, a, ' ', &alts); } BEGIN(FLUSH); } else if (relax & WCSHDR_reject) { errmsg = "Image-header keyword WCSAXESa in binary table"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } ^WCAX{I1}{ALT}" = "" "*{INTEGER} | ^WCAX{I2}{ALT}" = "" "*{INTEGER} | ^WCAX{I3}{ALT}"= "" "*{INTEGER} { keytype = BIMGARR; /* Note that a blank in the sscanf() format string matches zero or more of them in the input. */ sscanf(yytext, "WCAX%d%c = %d", &n, &a, &i); if (!(keytype & keysel) || exclude[n]) { /* Ignore this key type or column. */ BEGIN(DISCARD); } else { if (ipass == 1) { wcsbth_pass1(BIMGARR, i, 0, n, 0, a, ' ', &alts); } BEGIN(FLUSH); } } ^WCST{I1}{ALT}" = "" "*{STRING} | ^WCST{I2}{ALT}" = "" "*{STRING} | ^WCST{I3}{ALT}"= "" "*{STRING} { /* Cross-reference supplier. */ keytype = BIMGARR; errmsg = "Cross-references are not currently implemented"; BEGIN(ERROR); } ^WCSX{I1}{ALT}" = "" "*{STRING} | ^WCSX{I2}{ALT}" = "" "*{STRING} | ^WCSX{I3}{ALT}"= "" "*{STRING} { /* Cross-reference consumer. */ keytype = BIMGARR; errmsg = "Cross-references are not currently implemented"; BEGIN(ERROR); } ^CRPIX { valtype = FLOAT; vptr = &(wcstem.crpix); extkey = "CRPIXja"; BEGIN(CCCCCia); } ^{I1}CRP | ^{I1}CRPX { valtype = FLOAT; vptr = &(wcstem.crpix); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { extkey = "jCRPXn"; BEGIN(iCCCCn); } } ^TCRP | ^TCRPX { valtype = FLOAT; vptr = &(wcstem.crpix); if (yyleng == 4) { BEGIN(TCCCna); } else { extkey = "TCRPXn"; BEGIN(TCCCCn); } } ^PC { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; extkey = "PCi_ja"; BEGIN(CCi_ja); } ^{I2}PC { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; sscanf(yytext, "%1d%1d", &i, &j); BEGIN(ijCCna); } ^TP | ^TPC { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; if (yyleng == 2) { BEGIN(TCn_ka); } else { extkey = "TPCn_ka"; BEGIN(TCCn_ka); } } ^CD { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; extkey = "CDi_ja"; BEGIN(CCi_ja); } ^{I2}CD { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; sscanf(yytext, "%1d%1d", &i, &j); BEGIN(ijCCna); } ^TC | ^TCD { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; if (yyleng == 2) { BEGIN(TCn_ka); } else { extkey = "TCDn_ka"; BEGIN(TCCn_ka); } } ^CDELT { valtype = FLOAT; vptr = &(wcstem.cdelt); extkey = "CDELTia"; BEGIN(CCCCCia); } ^{I1}CDE | ^{I1}CDLT { valtype = FLOAT; vptr = &(wcstem.cdelt); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { extkey = "iCDLTn"; BEGIN(iCCCCn); } } ^TCDE | ^TCDLT { valtype = FLOAT; vptr = &(wcstem.cdelt); if (yyleng == 4) { BEGIN(TCCCna); } else { extkey = "TCDLTn"; BEGIN(TCCCCn); } } ^CROTA { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; extkey = "CROTAi"; BEGIN(CROTAi); } ^{I1}CROT { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; sscanf(yytext, "%d", &i); extkey = "iCROTn"; BEGIN(iCROTn); } ^TCROT { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; extkey = "TCROTn"; BEGIN(TCROTn); } ^CUNIT { valtype = STRING; vptr = &(wcstem.cunit); extkey = "CUNITia"; BEGIN(CCCCCia); } ^{I1}CUN | ^{I1}CUNI { valtype = STRING; vptr = &(wcstem.cunit); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { extkey = "iCUNIn"; BEGIN(iCCCCn); } } ^TCUN | ^TCUNI { valtype = STRING; vptr = &(wcstem.cunit); if (yyleng == 4) { BEGIN(TCCCna); } else { extkey = "TCUNIn"; BEGIN(TCCCCn); } } ^CTYPE { valtype = STRING; vptr = &(wcstem.ctype); extkey = "CTYPEia"; BEGIN(CCCCCia); } ^{I1}CTY | ^{I1}CTYP { valtype = STRING; vptr = &(wcstem.ctype); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { extkey = "iCTYPn"; BEGIN(iCCCCn); } } ^TCTY | ^TCTYP { valtype = STRING; vptr = &(wcstem.ctype); if (yyleng == 4) { BEGIN(TCCCna); } else { extkey = "TCTYPn"; BEGIN(TCCCCn); } } ^CRVAL { valtype = FLOAT; vptr = &(wcstem.crval); extkey = "CRVALia"; BEGIN(CCCCCia); } ^{I1}CRV | ^{I1}CRVL { valtype = FLOAT; vptr = &(wcstem.crval); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { extkey = "iCRVLn"; BEGIN(iCCCCn); } } ^TCRV | ^TCRVL { valtype = FLOAT; vptr = &(wcstem.crval); if (yyleng == 4) { BEGIN(TCCCna); } else { extkey = "TCRVLn"; BEGIN(TCCCCn); } } ^LONPOLE | ^LONP { valtype = FLOAT; vptr = &(wcstem.lonpole); if (yyleng == 7) { extkey = "LONPOLEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^LATPOLE | ^LATP { valtype = FLOAT; vptr = &(wcstem.latpole); if (yyleng == 7) { extkey = "LATPOLEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^RESTFRQ | ^RESTFREQ | ^RFRQ { valtype = FLOAT; vptr = &(wcstem.restfrq); if (yyleng == 8) { unput(' '); extkey = "RESTFREQ"; BEGIN(CCCCCCCa); } else if (yyleng == 7) { extkey = "RESTFRQa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^RESTWAV | ^RWAV { valtype = FLOAT; vptr = &(wcstem.restwav); if (yyleng == 7) { extkey = "RESTWAVa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^PV { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; extkey = "PVi_ma"; BEGIN(CCi_ma); } ^{I1}V | ^{I1}PV { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; sscanf(yytext, "%d", &i); if (yyleng == 2) { BEGIN(iCn_ma); } else { extkey = "iPVn_ma"; BEGIN(iCCn_ma); } } ^TV | ^TPV { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; if (yyleng == 2) { BEGIN(TCn_ma); } else { extkey = "TPVn_ma"; BEGIN(TCCn_ma); } } ^PROJP { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; BEGIN(PROJPm); } ^PS { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; extkey = "PSi_ma"; BEGIN(CCi_ma); } ^{I1}S | ^{I1}PS { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; sscanf(yytext, "%d", &i); if (yyleng == 2) { BEGIN(iCn_ma); } else { extkey = "iPSn_ma"; BEGIN(iCCn_ma); } } ^TS | ^TPS { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; if (yyleng == 2) { BEGIN(TCn_ma); } else { extkey = "TPSn_ma"; BEGIN(TCCn_ma); } } ^CNAME { valtype = STRING; vptr = &(wcstem.cname); extkey = "CNAMEia"; BEGIN(CCCCCia); } ^{I1}CNA | ^{I1}CNAM { valtype = STRING; vptr = &(wcstem.cname); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCNAMn"; BEGIN(iCCCCn); } } ^TCNA | ^TCNAM { valtype = STRING; vptr = &(wcstem.cname); if (yyleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCNAMn"; BEGIN(TCCCCn); } } ^CRDER { valtype = FLOAT; vptr = &(wcstem.crder); extkey = "CRDERia"; BEGIN(CCCCCia); } ^{I1}CRD | ^{I1}CRDE { valtype = FLOAT; vptr = &(wcstem.crder); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCRDEn"; BEGIN(iCCCCn); } } ^TCRD | ^TCRDE { valtype = FLOAT; vptr = &(wcstem.crder); if (yyleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCRDEn"; BEGIN(TCCCCn); } } ^CSYER { valtype = FLOAT; vptr = &(wcstem.csyer); extkey = "CSYERia"; BEGIN(CCCCCia); } ^{I1}CSY | ^{I1}CSYE { valtype = FLOAT; vptr = &(wcstem.csyer); sscanf(yytext, "%d", &i); if (yyleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCSYEn"; BEGIN(iCCCCn); } } ^TCSY | ^TCSYE { valtype = FLOAT; vptr = &(wcstem.csyer); if (yyleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCSYEn"; BEGIN(TCCCCn); } } ^DATE-AVG | ^DAVG { valtype = STRING; vptr = wcstem.dateavg; if (yyleng == 8) { extkey = "DATE-AVG"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCn); } } ^DATE-OBS { valtype = STRING; vptr = wcstem.dateobs; extkey = "DATE-OBS"; BEGIN(CCCCCCCC); } ^DOBS{I1}" " | ^DOBS{I2}" " | ^DOBS{I3}" " { if (relax & WCSHDR_DOBSn) { valtype = STRING; vptr = wcstem.dateobs; yyless(4); BEGIN(CCCCn); } else { keytype = BINTAB; if (relax & WCSHDR_reject) { errmsg = "DOBSna keyword is non-standard"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } ^EPOCH{ALT}" " { sscanf(yytext, "EPOCH%c", &a); if (a == ' ' || (relax & WCSHDR_EPOCHa)) { valtype = FLOAT; vptr = &(wcstem.equinox); special = wcsbth_epoch; unput(a); extkey = "EPOCH"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "EPOCH keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } ^EQUINOX | ^EQUI { valtype = FLOAT; vptr = &(wcstem.equinox); if (yyleng == 7) { extkey = "EQUINOXa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^MJD-AVG" " | ^MJDA { valtype = FLOAT; vptr = &(wcstem.mjdavg); if (yyleng == 8) { extkey = "MJD-AVG"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCn); } } ^MJD-OBS" " | ^MJDOB { valtype = FLOAT; vptr = &(wcstem.mjdobs); if (yyleng == 8) { extkey = "MJD-OBS"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } ^OBSGEO-X | ^OBSGX { valtype = FLOAT; vptr = wcstem.obsgeo; if (yyleng == 8) { extkey = "OBSGEO-X"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } ^OBSGEO-Y | ^OBSGY { valtype = FLOAT; vptr = wcstem.obsgeo + 1; if (yyleng == 8) { extkey = "OBSGEO-Y"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } ^OBSGEO-Z | ^OBSGZ { valtype = FLOAT; vptr = wcstem.obsgeo + 2; if (yyleng == 8) { extkey = "OBSGEO-Z"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } ^RADESYS | ^RADE { valtype = STRING; vptr = wcstem.radesys; if (yyleng == 7) { extkey = "RADESYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^RADECSYS { if (relax & WCSHDR_RADECSYS) { valtype = STRING; vptr = wcstem.radesys; unput(' '); extkey = "RADECSYS"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "RADECSYS keyword is non-standard"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } ^SPECSYS | ^SPEC { valtype = STRING; vptr = wcstem.specsys; if (yyleng == 7) { extkey = "SPECSYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^SSYSOBS | ^SOBS { valtype = STRING; vptr = wcstem.ssysobs; if (yyleng == 7) { extkey = "SSYSOBSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^SSYSSRC | ^SSRC { valtype = STRING; vptr = wcstem.ssyssrc; if (yyleng == 7) { extkey = "SSYSSRCa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^VELOSYS | ^VSYS { valtype = FLOAT; vptr = &(wcstem.velosys); if (yyleng == 7) { extkey = "VELOSYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^VELANGL | ^VANG { valtype = FLOAT; vptr = &(wcstem.velangl); if (yyleng == 7) { extkey = "VELANGLa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^VELREF{ALT}" " { sscanf(yytext, "VELREF%c", &a); if (a == ' ' || (relax & WCSHDR_VELREFa)) { valtype = INTEGER; vptr = &(wcstem.velref); unput(a); extkey = "VELREF"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "VELREF keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } ^VSOURCE{ALT} { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; vptr = &(wcstem.zsource); special = wcsbth_vsource; yyless(7); extkey = "VSOURCEa"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "VSOURCEa keyword is deprecated"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } ^VSOU{I1}{ALT}" " | ^VSOU{I2}{ALT}" " | ^VSOU{I3}{ALT} { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; vptr = &(wcstem.zsource); special = wcsbth_vsource; yyless(4); BEGIN(CCCCna); } else { keytype = BINTAB; if (relax & WCSHDR_reject) { errmsg = "VSOUna keyword is deprecated"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } ^WCSNAME | ^WCSN | ^TWCS { valtype = STRING; vptr = wcstem.wcsname; if (yyleng == 7) { extkey = "WCSNAMEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^ZSOURCE | ^ZSOU { valtype = FLOAT; vptr = &(wcstem.zsource); if (yyleng == 7) { extkey = "ZSOURCEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } ^END" "{77} { yyless(0); if (wcsbth_nkeyrec) { wcsbth_nkeyrec = 0; errmsg = "Keyrecords following the END keyrecord were ignored"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } ^. { yyless(0); BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT} { /* Image-header keyword. */ keytype = IMGAXIS; if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d%c", &i, &a); BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } {I3} { /* Invalid axis number in image-header keyword. */ keytype = IMGAXIS; if (relax & WCSHDR_ALLIMG) { /* Will also be flagged by as invalid. */ sscanf(yytext, "%3d", &i); BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } {I1}" " | {I2}" " | {I3} | {I1}" " | {I2}" " | {I3} { if (vptr) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna); } else { keytype = (YY_START == iCCCCn) ? BIMGARR : PIXLIST; if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { BEGIN(DISCARD); } } } {I1}[A-Z]" " | {I2}[A-Z] | {I1}[A-Z]" " | {I2}[A-Z] { if (vptr && (relax & WCSHDR_LONGKEY)) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna); } else { keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST; if (relax & WCSHDR_reject) { errmsg = errtxt; if (!vptr) { sprintf(errmsg, "%s keyword is non-standard", extkey); } else { sprintf(errmsg, "%s keyword may not have an alternate version code", extkey); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } . | . { BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT}" " | {I3}{ALT} | {I1}{ALT}" " | {I2}{ALT}" " | {I3}{ALT} { sscanf(yytext, "%d%c", &n, &a); if (YY_START == TCCCna) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST; BEGIN(VALUE); } . | . { BEGIN(DISCARD); } {I1}_{I1}{ALT}" " | {I1}_{I2}{ALT}" " | {I2}_{I1}{ALT}" " | {I2}_{I2}{ALT} { /* Image-header keyword. */ if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d_%d%c", &i, &j, &a); keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } {I1}_{I3}{ALT} | {I3}_{I1}{ALT} | {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I1} { /* Invalid axis number in image-header keyword. */ if (relax & WCSHDR_ALLIMG) { /* Will be flagged by as invalid. */ sscanf(yytext, "%d_%d", &i, &j); keytype = IMGAXIS; BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } {I0}{6} { /* This covers the defunct forms CD00i00j and PC00i00j. */ if (((relax & WCSHDR_PC00i00j) && (altlin == 1)) || ((relax & WCSHDR_CD00i00j) && (altlin == 2))) { sscanf(yytext, "%3d%3d", &i, &j); a = ' '; keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Defunct form of %si_ja keyword", (altlin==1) ? "PC" : "CD"); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT}" " | {I3}{ALT} { sscanf(yytext, "%d%c", &n, &a); keytype = BIMGARR; BEGIN(VALUE); } {I1}_{I1}{ALT}" " | {I1}_{I2}{ALT} | {I2}_{I1}{ALT} | {I1}_{I3} | {I2}_{I2} | {I3}_{I1} { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; BEGIN(TCn_ka); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}_{I1}{ALT}" " | {I1}_{I2}{ALT}" " | {I2}_{I1}{ALT}" " | {I1}_{I3}{ALT} | {I2}_{I2}{ALT} | {I3}_{I1}{ALT} { sscanf(yytext, "%d_%d%c", &n, &k, &a); i = wcsbth_colax(*wcs, &alts, n, a); j = wcsbth_colax(*wcs, &alts, k, a); keytype = PIXLIST; BEGIN(VALUE); } {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I1} { sscanf(yytext, "%d_%d", &n, &k); a = ' '; i = wcsbth_colax(*wcs, &alts, n, a); j = wcsbth_colax(*wcs, &alts, k, a); keytype = PIXLIST; BEGIN(VALUE); } . { BEGIN(DISCARD); } {I1}" " | {I2}" " { yyless(0); BEGIN(CCCCCia); } {I1}[A-Z]" " | {I2}[A-Z] { if (relax & WCSHDR_CROTAia) { yyless(0); BEGIN(CCCCCia); } else if (relax & WCSHDR_reject) { errmsg = "CROTAn keyword may not have an alternate version code"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}" " | {I2}" " | {I3} | {I1}" " | {I2}" " | {I3} { WCSBTH_PUTBACK; BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna); } {I1}[A-Z]" " | {I2}[A-Z] | {I1}[A-Z]" " | {I2}[A-Z] { if (relax & WCSHDR_CROTAia) { WCSBTH_PUTBACK; BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword may not have an alternate version code", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . | . { BEGIN(DISCARD); } {ALT} | . { /* Image-header keyword. */ if (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG)) { if (YY_START == CCCCCCCa) { sscanf(yytext, "%c", &a); } else { a = 0; unput(yytext[0]); } keytype = IMGAUX; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}{ALT}" " | {I2}{ALT}" " | {I3}{ALT} | {I1}{ALT}" " | {I2}{ALT} { sscanf(yytext, "%d%c", &n, &a); keytype = BINTAB; BEGIN(VALUE); } {I3} { sscanf(yytext, "%d", &n); a = ' '; keytype = BINTAB; BEGIN(VALUE); } . | . { BEGIN(DISCARD); } {I1}" " | {I2}" " | {I3}" " | {I4} | {I1}" " | {I2}" " | {I3} { sscanf(yytext, "%d", &n); a = 0; keytype = BINTAB; BEGIN(VALUE); } . | . { BEGIN(DISCARD); } {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT}" " | {I2}_{I0}{ALT}" " | {I2}_{I2}{ALT} { /* Image-header keyword. */ if (relax & WCSHDR_ALLIMG) { sscanf(yytext, "%d_%d%c", &i, &m, &a); keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } {I1}_{I3}{ALT} | {I3}_{I0}{ALT} | {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I0} { /* Invalid parameter in image-header keyword. */ if (relax & WCSHDR_ALLIMG) { /* Will be flagged by as invalid. */ sscanf(yytext, "%d_%d", &i, &m); keytype = IMGAXIS; BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT} | {I1}_{I3} | {I2}_{I0}{ALT} | {I2}_{I2} | {I3}_{I0} | {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT} | {I1}_{I3} | {I2}_{I0}{ALT} | {I2}_{I2} | {I3}_{I0} { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCn_ma) ? iCn_ma : TCn_ma); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . | . { BEGIN(DISCARD); } {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT}" " | {I1}_{I3}{ALT} | {I2}_{I0}{ALT}" " | {I2}_{I2}{ALT} | {I3}_{I0}{ALT} | {I1}_{I0}{ALT}" " | {I1}_{I2}{ALT}" " | {I1}_{I3}{ALT} | {I2}_{I0}{ALT}" " | {I2}_{I2}{ALT} | {I3}_{I0}{ALT} { sscanf(yytext, "%d_%d%c", &n, &m, &a); if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST; BEGIN(VALUE); } {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I0} | {I1}_{I4} | {I2}_{I3} | {I3}_{I2} | {I4}_{I0} { /* Invalid combinations will be flagged by . */ sscanf(yytext, "%d_%d", &n, &m); a = ' '; if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST; BEGIN(VALUE); } . | . { BEGIN(DISCARD); } {I0}" " { if (relax & WCSHDR_PROJPn) { sscanf(yytext, "%d", &m); i = 0; a = ' '; keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "PROJPn keyword is defunct"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } . { BEGIN(DISCARD); } =" "+ { /* Do checks on i, j, m, n, k. */ if (!(keytype & keysel)) { /* Selection by keyword type. */ BEGIN(DISCARD); } else if (exclude[n] || exclude[k]) { /* One or other column is not selected. */ if (k && (exclude[n] != exclude[k])) { /* For keywords such as TCn_ka, both columns must be excluded. User error, so return immediately. */ yylex_destroy(); return 3; } else { BEGIN(DISCARD); } } else if (i > 99 || j > 99 || m > 99 || n > 999 || k > 999) { if (relax & WCSHDR_reject) { errmsg = errtxt; if (i > 99 || j > 99) { sprintf(errmsg, "Axis number exceeds 99"); } else if (m > 99) { sprintf(errmsg, "Parameter number exceeds 99"); } else if (n > 999 || k > 999) { sprintf(errmsg, "Column number exceeds 999"); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } else if (ipass == 2 && npass == 3 && (keytype & BINTAB)) { /* Skip keyvalues that won't be inherited. */ BEGIN(FLUSH); } else if (ipass == 3 && (keytype & IMGHEAD)) { /* IMGHEAD keytypes are always dealt with on the second pass. */ BEGIN(FLUSH); } else if (vptr) { alts.icol = 0; alts.ialt = 0; voff = (char *)vptr - (char *)(&wcstem); if (valtype == INTEGER) { BEGIN(INTEGER_VAL); } else if (valtype == FLOAT) { BEGIN(FLOAT_VAL); } else if (valtype == STRING) { BEGIN(STRING_VAL); } else { errmsg = errtxt; sprintf(errmsg, "Internal parser ERROR, bad data type: %d", valtype); BEGIN(ERROR); } } else { errmsg = "Internal parser ERROR, null pointer"; BEGIN(ERROR); } } . { errmsg = "Invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); } {INTEGER} { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Read the keyvalue. */ if (special) { special(wptr); } else { sscanf(yytext, "%d", (int *)wptr); } } BEGIN(COMMENT); } } . { errmsg = "An integer value was expected"; BEGIN(ERROR); } {FLOAT} { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Apply keyword parameterization. */ if (ptype == 'v') { ipx = wcsp->npv++; wcsp->pv[ipx].i = i; wcsp->pv[ipx].m = m; wptr = &(wcsp->pv[ipx].value); } else if (j) { /* Is the de-reference necessary? */ wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis) + (j - 1); } else if (i) { wptr = *((double **)wptr) + (i - 1); } /* Read the keyvalue. */ if (special) { special(wptr); } else { wcsutil_str2double(yytext, "%lf", (double *)wptr); } /* Flag the presence of PC, or CD and/or CROTA. */ if (altlin) { wcsp->altlin |= altlin; altlin = 0; } } BEGIN(COMMENT); } } . { errmsg = "A floating-point value was expected"; BEGIN(ERROR); } {STRING} { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Apply keyword parameterization. */ if (ptype == 's') { ipx = wcsp->nps++; wcsp->ps[ipx].i = i; wcsp->ps[ipx].m = m; wptr = wcsp->ps[ipx].value; } else if (j) { wptr = *((char (**)[72])wptr) + (i - 1)*(wcsp->naxis) + (j - 1); } else if (i) { wptr = *((char (**)[72])wptr) + (i - 1); } /* Read the keyvalue. */ cptr = (char *)wptr; strcpy(cptr, yytext+1); /* Squeeze out repeated quotes. */ ix = 0; for (jx = 0; jx < 72; jx++) { if (ix < jx) { cptr[ix] = cptr[jx]; } if (cptr[jx] == '\0') { if (ix) cptr[ix-1] = '\0'; break; } else if (cptr[jx] == '\'' && cptr[jx+1] == '\'') { jx++; } ix++; } } BEGIN(COMMENT); } } . { errmsg = "A string value was expected"; BEGIN(ERROR); } " "*\/.* | " "* { BEGIN(FLUSH); } . { errmsg = "Malformed keycomment"; BEGIN(ERROR); } .* { if (ipass == npass) { if (ctrl < 0) { /* Preserve discards. */ if (hptr < wcsbth_hdr-80) { strncpy(hptr, wcsbth_hdr-80, 80); } hptr += 80; } else if (ctrl > 2) { wcsfprintf(stderr, "%.80s\n Discarded.\n", wcsbth_hdr-80); } } BEGIN(FLUSH); } .* { (*nreject)++; if (ipass == npass) { if (ctrl == -1) { if (hptr < wcsbth_hdr-80) { /* Preserve rejects. */ strncpy(hptr, wcsbth_hdr-80, 80); } hptr += 80; } if (abs(ctrl) > 1) { wcsfprintf(stderr, "%.80s\n%4d: %s.\n", wcsbth_hdr-80, *nreject, errmsg); } } BEGIN(FLUSH); } .*\n { /* Throw away the rest of the line and reset for the next one. */ i = j = 0; n = k = 0; m = 0; a = ' '; keytype = 0; valtype = -1; vptr = 0x0; altlin = 0; ptype = ' '; special = 0x0; BEGIN(INITIAL); } <> { /* End-of-input. */ if (ipass == 1) { if ((status = wcsbth_init1(&alts, nwcs, wcs)) || *nwcs == 0) { yylex_destroy(); return status; } if (alts.imgherit) npass = 3; if (abs(ctrl) > 2) { if (*nwcs == 1) { wcsfprintf(stderr, "Found one coordinate representation.\n"); } else { wcsfprintf(stderr, "Found %d coordinate representations.\n", *nwcs); } } } if (ipass++ < npass) { wcsbth_hdr = header; wcsbth_nkeyrec = nkeyrec; *nreject = 0; i = j = 0; k = n = 0; m = 0; a = ' '; keytype = 0; valtype = -1; vptr = 0x0; altlin = 0; ptype = ' '; special = 0x0; yyrestart(yyin); } else { yylex_destroy(); if (ctrl < 0) { *hptr = '\0'; } else if (ctrl == 1) { wcsfprintf(stderr, "%d WCS keyrecords were rejected.\n", *nreject); } return wcsbth_final(&alts, nwcs, wcs); } } %% /*---------------------------------------------------------------------------- * Perform first-pass tasks: * * 1) Count the number of coordinate axes in each of the 27 possible alternate * image-header coordinate representations. Also count the number of PVi_ma * and PSi_ma keywords in each representation. * * 2) Determine the number of binary table columns that have an image array * with a coordinate representation (up to 999), and count the number of * coordinate axes in each of the 27 possible alternates. Also count the * number of iVn_ma and iSn_ma keywords in each representation. * * 3) Determine the number of alternate pixel list coordinate representations * (up to 27) and the table columns associated with each. Also count the * number of TVn_ma and TSn_ma keywords in each representation. * * In the first pass alts->arridx[icol][27] is used to determine the number of * axes in each of 27 possible image-header coordinate descriptions (icol == 0) * and each of the 27 possible coordinate representations for an image array in * each column. * * The elements of alts->pixlist[icol] are used as bit arrays to flag which of * the 27 possible pixel list coordinate representations are associated with * each table column. *---------------------------------------------------------------------------*/ int wcsbth_pass1( int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts) { int ialt, icol, mask, ncol; if (a == 0) { /* Keywords such as DATE-OBS go along for the ride. */ return 0; } ncol = alts->ncol; /* Do we need to allocate memory for alts? */ if (alts->arridx == 0x0) { if (ncol == 0) { /* Can only happen if TFIELDS is missing or out-of-sequence. If n and k are both zero then we may be processing an image header so leave ncol alone - the array will be realloc'd later if required. */ if (n || k) { /* The header is mangled, assume the worst. */ ncol = 999; } } if (!(alts->arridx = calloc((1 + ncol)*27, sizeof(short int))) || !(alts->npv = calloc((1 + ncol)*27, sizeof(unsigned char))) || !(alts->nps = calloc((1 + ncol)*27, sizeof(unsigned char))) || !(alts->pixlist = calloc((1 + ncol), sizeof(unsigned int)))) { if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); return 2; } alts->ncol = ncol; } else if (n > ncol || k > ncol) { /* Can only happen if TFIELDS or the WCS keyword is wrong; carry on. */ ncol = 999; if (!(alts->arridx = realloc(alts->arridx, 27*(1 + ncol)*sizeof(short int))) || !(alts->npv = realloc(alts->npv, 27*(1 + ncol)*sizeof(unsigned char))) || !(alts->nps = realloc(alts->nps, 27*(1 + ncol)*sizeof(unsigned char))) || !(alts->pixlist = realloc(alts->pixlist, (1 + ncol)*sizeof(unsigned int)))) { if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); return 2; } /* Since realloc() doesn't initialize the extra memory. */ for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { for (ialt = 0; ialt < 27; ialt++) { alts->arridx[icol][ialt] = 0; alts->npv[icol][ialt] = 0; alts->nps[icol][ialt] = 0; alts->pixlist[icol] = 0; } } alts->ncol = ncol; } ialt = 0; if (a != ' ') { ialt = a - 'A' + 1; } /* A BINTAB keytype such as LONPna, in conjunction with an IMGAXIS keytype causes a table column to be recognized as an image array. */ if (keytype & IMGHEAD || keytype & BIMGARR) { /* n == 0 is expected for IMGHEAD keywords. */ if (i == 0 && j == 0) { if (alts->arridx[n][ialt] == 0) { /* Flag that an auxiliary keyword was seen. */ alts->arridx[n][ialt] = -1; } } else { /* Record the maximum axis number found. */ if (alts->arridx[n][ialt] < i) { alts->arridx[n][ialt] = i; } if (alts->arridx[n][ialt] < j) { alts->arridx[n][ialt] = j; } } if (ptype == 'v') { alts->npv[n][ialt]++; } else if (ptype == 's') { alts->nps[n][ialt]++; } } /* BINTAB keytypes, which apply both to pixel lists as well as binary table image arrays, never contribute to recognizing a table column as a pixel list axis. A PIXLIST keytype is required for that. */ if (keytype == PIXLIST) { mask = 1 << ialt; /* n > 0 for PIXLIST keytypes. */ alts->pixlist[n] |= mask; if (k) alts->pixlist[k] |= mask; /* Used as a flag over all columns. */ alts->pixlist[0] |= mask; if (ptype == 'v') { alts->pixnpv[ialt]++; } else if (ptype == 's') { alts->pixnps[ialt]++; } } return 0; } /*---------------------------------------------------------------------------- * Perform initializations at the end of the first pass: * * 1) Determine the required number of wcsprm structs, allocate memory for * an array of them and initialize each one. *---------------------------------------------------------------------------*/ int wcsbth_init1( struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs) { int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0; struct wcsprm *wcsp; if (alts->arridx == 0x0) { *nwcs = 0; return 0; } /* Determine the number of axes in each pixel list representation. */ ncol = alts->ncol; for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) { alts->pixidx[ialt] = 0; if (alts->pixlist[0] | mask) { for (icol = 1; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { alts->pixidx[ialt]++; } } } } /* Find the total number of coordinate representations. */ *nwcs = 0; alts->imgherit = 0; for (ialt = 0; ialt < 27; ialt++) { inherit[ialt] = 0; for (icol = 1; icol <= ncol; icol++) { if (alts->arridx[icol][ialt] < 0) { /* No BIMGARR keytype but there's at least one BINTAB. */ if (alts->arridx[0][ialt] > 0) { /* There is an IMGAXIS keytype that we will inherit, so count this representation. */ alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } else { alts->arridx[icol][ialt] = 0; } } if (alts->arridx[icol][ialt]) { if (alts->arridx[0][ialt]) { /* All IMGHEAD keywords are inherited for this ialt. */ inherit[ialt] = 1; if (alts->arridx[icol][ialt] < alts->arridx[0][ialt]) { /* The extra axes are also inherited. */ alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } } (*nwcs)++; } } /* Count every "a" found in any IMGHEAD keyword... */ if (alts->arridx[0][ialt]) { if (inherit[ialt]) { /* ...but not if the IMGHEAD keywords will be inherited. */ alts->arridx[0][ialt] = 0; alts->imgherit = 1; } else { (*nwcs)++; } } /* We need a struct for every "a" found in a PIXLIST keyword. */ if (alts->pixidx[ialt]) { (*nwcs)++; } } if (*nwcs) { /* Allocate memory for the required number of wcsprm structs. */ if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { return 2; } /* Record the current values of NPVMAX and NPSMAX. */ npvmax = wcsnpv(-1); npsmax = wcsnps(-1); /* Initialize each wcsprm struct. */ wcsp = *wcs; *nwcs = 0; for (icol = 0; icol <= ncol; icol++) { for (ialt = 0; ialt < 27; ialt++) { if (alts->arridx[icol][ialt]) { /* Image-header representations that are not for inheritance (icol == 0) or binary table image array representations. */ wcsp->flag = -1; wcsnpv(alts->npv[icol][ialt]); wcsnps(alts->nps[icol][ialt]); if ((status = wcsini(1, (int)(alts->arridx[icol][ialt]), wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record the table column number. */ wcsp->colnum = icol; /* On the second pass alts->arridx[icol][27] indexes the array of wcsprm structs. */ alts->arridx[icol][ialt] = (*nwcs)++; wcsp++; } else { /* Signal that this column has no WCS for this "a". */ alts->arridx[icol][ialt] = -1; } } } for (ialt = 0; ialt < 27; ialt++) { if (alts->pixidx[ialt]) { /* Pixel lists representations. */ wcsp->flag = -1; wcsnpv(alts->pixnpv[ialt]); wcsnps(alts->pixnps[ialt]); if ((status = wcsini(1, (int)(alts->pixidx[ialt]), wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record the pixel list column numbers. */ mask = (1 << ialt); for (icol = 1, ix = 0; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { wcsp->colax[ix++] = icol; } } /* alts->pixidx[] indexes the array of wcsprm structs. */ alts->pixidx[ialt] = (*nwcs)++; wcsp++; } else { /* Signal that this column is not a pixel list axis for this "a". */ alts->pixidx[ialt] = -1; } } /* Restore the original values of NPVMAX and NPSMAX. */ wcsnpv(npvmax); wcsnps(npsmax); } return status; } /*---------------------------------------------------------------------------- * Return a pointer to the next wcsprm struct for a particular column number * and alternate. *---------------------------------------------------------------------------*/ struct wcsprm *wcsbth_idx( struct wcsprm *wcs, struct wcsbth_alts *alts, int keytype, int n, char a) { const char as[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int iwcs; if (!wcs) return 0x0; iwcs = -1; for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) { /* Note that a == 0 applies to every alternate, otherwise this loop simply determines the appropriate value of alts->ialt. */ if (a && a != as[alts->ialt]) continue; if (keytype & (IMGHEAD | BIMGARR)) { for (; iwcs < 0 && alts->icol <= alts->ncol; alts->icol++) { /* Image header keywords, n == 0, apply to all columns, otherwise this loop simply determines the appropriate value of alts->icol. */ if (n && n != alts->icol) continue; iwcs = alts->arridx[alts->icol][alts->ialt]; } /* Break out of the loop to stop alts->ialt from being incremented. */ if (iwcs >= 0) break; /* Start from scratch for the next alts->ialt. */ alts->icol = 0; } if (keytype & (IMGAUX | PIXLIST)) { iwcs = alts->pixidx[alts->ialt]; } } return (iwcs >= 0) ? (wcs + iwcs) : 0x0; } /*---------------------------------------------------------------------------- * Return the axis number associated with the specified column number in a * particular pixel list coordinate representation. *---------------------------------------------------------------------------*/ int wcsbth_colax( struct wcsprm *wcs, struct wcsbth_alts *alts, int n, char a) { int ix; struct wcsprm *wcsp; if (!wcs) return 0; wcsp = wcs; if (a != ' ') { wcsp += alts->pixidx[a-'A'+1]; } for (ix = 0; ix < wcsp->naxis; ix++) { if (wcsp->colax[ix] == n) { return ++ix; } } return 0; } /*---------------------------------------------------------------------------- * Interpret EPOCH keywords. *---------------------------------------------------------------------------*/ int wcsbth_epoch(void *wptr) { double *equinox; /* If EQUINOXa is currently undefined then set it from EPOCHa. */ equinox = (double *)wptr; if (undefined(*equinox)) { wcsutil_str2double(yytext, "%lf", equinox); } return 0; } /*---------------------------------------------------------------------------- * Interpret VSOURCE keywords. *---------------------------------------------------------------------------*/ int wcsbth_vsource(void *wptr) { double beta, c = 299792458.0, vsource, *zsource; /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ zsource = (double *)wptr; if (undefined(*zsource)) { wcsutil_str2double(yytext, "%lf", &vsource); /* Convert relativistic Doppler velocity to redshift. */ beta = vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } return 0; } /*---------------------------------------------------------------------------- * Tie up loose ends. *---------------------------------------------------------------------------*/ int wcsbth_final( struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs) { int ialt, status; if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); for (ialt = 0; ialt < *nwcs; ialt++) { /* Interpret -TAB header keywords. */ if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; } } return 0; } astropy-0.3/cextern/wcslib/C/GNUmakefile0000644000175000017500000003371012243255342016372 0ustar oleole#----------------------------------------------------------------------------- # GNU makefile for building WCSLIB 4.19 and its test suite. # # Summary of the main targets # --------------------------- # build: Build the library. # # clean: Delete intermediate object files. # # cleaner: clean, and also delete the test executables. # # cleanest (distclean or realclean): cleaner, and also delete the object # library the C source files generated by 'flex'. # # check (or test): Compile and run the test programs. By default they are # executed in batch mode, and non-graphical tests only report # "PASS" on success. Use # # make MODE=interactive check # # to run them interactively with full diagnostic output. To skip # graphical tests even if PGPLOT is available, use # # make CHECK=nopgplot check # # tests: Compile the test programs (but don't run them). # # Notes: # 1) If you need to make changes then preferably modify ../makedefs.in # instead and re-run configure. # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta # $Id: GNUmakefile,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ #----------------------------------------------------------------------------- # Get configure settings. include ../makedefs FLEXMODS := $(patsubst %.l,%.c,$(wildcard *.l)) MODULES := $(sort \ $(patsubst %.c,%.o, \ $(filter-out getwcstab.c,$(wildcard *.c)) $(FLEXMODS))) ifeq "$(WCSTRIG)" "MACRO" CPPFLAGS += -DWCSTRIG_MACRO MODULES := $(filter-out wcstrig.o, $(MODULES)) else ifeq "$(WCSTRIG)" "NATIVE" MODULES := $(filter-out wcstrig.o, $(MODULES)) endif endif # For building the sharable library. PICLIB := libwcs-PIC.a CPPFLAGS += -I. -I.. vpath %.c test vpath %.h .. vpath %.in .. # For building and exercising the test suite # ------------------------------------------ # Signals tfitshdr to use wcshdr(). ifneq "$(DO_WCSHDR)" "" CPPFLAGS += -DDO_WCSHDR endif # Test programs that don't require CFITSIO or PGPLOT... TEST_N := tlin tlog tprj1 tsph tsphdpa tspx ttab1 twcs twcssub tpih1 tbth1 \ tfitshdr tunits twcsfix # ...and unofficial test programs. TEST_n := tspcaips tspcspxe tspctrne twcs_locale # Test programs that require CFITSIO (they don't need PGPLOT). TEST_C := twcstab twcshdr # Test programs that require PGPLOT but not PGSBOX. TEST_P := tspc tprj2 tcel1 tcel2 ttab2 ttab3 twcsmix # Test programs that require PGPLOT and PGSBOX. TEST_B := tpih2 # Test programs that aren't automatically exercised. TEST_X := tsphdpa twcshdr TESTS := $(TEST_N) # Add test programs that require CFITSIO if we have it. ifneq "$(CFITSIOINC)" "" ifneq "$(CFITSIOLIB)" "" TESTS += $(TEST_C) endif endif # Add test programs that require PGPLOT if we have it. ifneq "$(CHECK)" "nopgplot" ifneq "$(PGPLOTINC)" "" ifneq "$(PGPLOTLIB)" "" TESTS += $(TEST_P) $(TEST_B) endif endif endif # Remove tests that aren't automatically exercised. TESTS := $(filter-out $(TEST_X), $(TESTS)) PGSBOXLIB := ../pgsbox/libpgsbox-$(LIBVER).a # Pattern rules #-------------- ifeq "$(FLEX)" "flex" %.c : %.l -@ echo '' -@ $(RM) $@ $(FLEX) $(FLFLAGS) -t $< | sed -e 's/^[ ]*#/#/' > $@ else %.c : %.l -@ echo '' -@ $(RM) $@ cp flexed/$@ . endif $(WCSLIB)(%.o) : %.c -@ echo '' $(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(AR) r $(WCSLIB) $% -@ $(RM) $% $(PICLIB)(%.o) : %.c -@ echo '' $(CC) $(CPPFLAGS) $(CFLAGS) $(SHRFLAGS) -c $< $(AR) r $(PICLIB) $% -@ $(RM) $% %.i : %.c -@ echo '' -@ $(RM) $@ $(CPP) $(CPPFLAGS) $(CFLAGS) $< > $@ # Print out include file dependencies. %.d : %.c -@ echo '' -@ $(CPP) $(CPPFLAGS) $(CFLAGS) $< | \ sed -n -e 's|^# 1 "\([^/].*\.h\)".*|\1|p' | \ sort -u # Use 'make FLAVOUR=Linux run_%' to have VALGRIND defined (from flavours). run_% : % -@ echo '' -@ $(TIMER) @ if [ '$(MODE)' = interactive -o '$(VALGRIND)' ] ; then \ printf 'Press to run $<: ' ; \ read DUMMY ; \ fi ; \ if [ '$(VALGRIND)' ] ; then \ if [ '$<' = tunits ] ; then \ $(VALGRIND) ./$< < test/units_test ; \ else \ $(VALGRIND) ./$< ; \ fi ; \ else \ if [ '$(filter $<, $(TEST_N) $(TEST_C))' ] ; then \ if [ '$<' = tunits ] ; then \ if [ '$(MODE)' = interactive ] ; then \ ./$< < test/units_test 2>&1 | tee $<.out ; \ else \ ./$< < test/units_test > $<.out 2>&1 ; \ fi ; \ else \ if [ '$(MODE)' = interactive ] ; then \ ./$< < /dev/null 2>&1 | tee $<.out ; \ else \ ./$< < /dev/null > $<.out 2>&1 ; \ fi ; \ fi ; \ if grep 'PASS:' $<.out > /dev/null ; then \ if [ '$(MODE)' != interactive ] ; then \ head -2 $<.out ; \ grep 'PASS:' $<.out ; \ fi ; \ echo 'PASS: C/$<' >> test_results ; \ elif [ -f 'test/$<.out' ] ; then \ trap 'rm -f run_test.tmp' 0 1 2 3 15 ; \ sed -e 's/0x[0-9a-f][0-9a-f][0-9a-f]*/0x
/g' $<.out > \ run_test.tmp ; \ mv -f run_test.tmp $<.out ; \ if cmp -s $<.out test/$<.out ; then \ if [ '$(MODE)' != interactive ] ; then \ head -1 $<.out ; \ fi ; \ echo '' ; \ echo 'PASS: Output agrees with C/test/$<.out' ; \ echo 'PASS: C/$<' >> test_results ; \ else \ if [ '$(MODE)' != interactive ] ; then \ cat $<.out ; \ fi ; \ echo '' ; \ echo 'FAIL: Output disagrees with C/test/$<.out' ; \ echo 'FAIL: C/$<' >> test_results ; \ fi ; \ elif [ '$(MODE)' != interactive ] ; then \ cat $<.out ; \ echo 'FAIL: C/$<' >> test_results ; \ fi ; \ elif [ '$(MODE)' = interactive ] ; then \ ./$< ; \ else \ if [ '$<' = tcel2 ] ; then \ echo N | ./$< ; \ else \ ./$< < /dev/null 2>&1 ; \ fi ; \ fi ; \ fi -@ echo '' # Static and static pattern rules #-------------------------------- .PHONY : build check clean cleaner cleanest distclean install lib realclean \ run_% test tests build : lib lib : $(FLEXMODS) $(WCSLIB) $(SHRLIB) $(WCSLIB) : $(MODULES:%=$(WCSLIB)(%)) -@ echo '' $(RANLIB) $@ $(SHRLIB) : $(PICLIB) -@ echo '' -@ $(RM) -r tmp mkdir tmp && \ cd tmp && \ trap 'cd .. ; $(RM) -r tmp' 0 1 2 3 15 ; \ $(AR) x ../$(PICLIB) && \ $(SHRLD) -o $@ *.o $(LDFLAGS) $(LIBS) && \ mv $@ .. $(PICLIB) : $(MODULES:%.o=$(PICLIB)(%.o)) ; install : build - if [ ! -d "$(LIBDIR)" ] ; then \ $(INSTALL) -d -m 2775 $(LIBDIR) ; \ fi $(INSTALL) -m 644 $(WCSLIB) $(LIBDIR) $(RANLIB) $(LIBDIR)/$(WCSLIB) - if [ -h "$(LIBDIR)/libwcs.a" ] ; then \ $(RM) $(LIBDIR)/libwcs.a ; \ fi - $(LN_S) $(WCSLIB) $(LIBDIR)/libwcs.a - if [ "$(SHRLIB)" != "" ] ; then \ $(INSTALL) -m 755 $(SHRLIB) $(LIBDIR) ; \ if [ -h "$(LIBDIR)/$(SONAME)" ] ; then \ $(RM) $(LIBDIR)/$(SONAME) ; \ fi ; \ $(LN_S) $(SHRLIB) $(LIBDIR)/$(SONAME) ; \ if [ "$(SHRLN)" != "" ] ; then \ if [ -h "$(LIBDIR)/$(SHRLN)" ] ; then \ $(RM) $(LIBDIR)/$(SHRLN) ; \ fi ; \ $(LN_S) $(SONAME) $(LIBDIR)/$(SHRLN) ; \ fi ; \ fi - if [ ! -d "$(INCDIR)" ] ; then \ $(INSTALL) -d -m 2775 $(INCDIR) ; \ fi $(INSTALL) -m 444 *.h $(INCDIR) $(RM) $(INCLINK) $(LN_S) $(notdir $(INCDIR)) $(INCLINK) clean : - $(RM) -r *.o *.i a.out t*.out core *.dSYM $(EXTRA_CLEAN) cleaner : clean - $(RM) .gdb_history - $(RM) $(TEST_N) $(TEST_n) $(TEST_X) - $(RM) $(TEST_P) tpih2 twcstab twcshdr - $(RM) tofits bth.fits pih.fits wcstab.fits - $(RM) t*_cfitsio test_results cleanest distclean realclean : cleaner - $(RM) ../wcsconfig.h ../wcsconfig_tests.h - $(RM) fitshdr.c wcsbth.c wcspih.c wcsulex.c wcsutrn.c - $(RM) $(PICLIB) libwcs-*.a libwcs.so.* libwcs.*.dylib check test : tests $(TESTS:%=run_%) tests : $(TESTS) $(TEST_X) $(TEST_N) $(TEST_n) : % : test/%.c $(WCSLIB) -@ echo '' $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) $(WCSLIB) $(LIBS) -@ $(RM) $@.o $(TEST_P) : % : test/%.c $(WCSLIB) -@ echo '' $(CC) $(CPPFLAGS) $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< $(LD) -o $@ $@.o $(LDFLAGS) $(PGPLOTLIB) $(WCSLIB) $(FLIBS) $(LIBS) -@ $(RM) $@.o tpih2 : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) -@ echo '' $(CC) $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) $(CFLAGS) -c -o $@.o $< $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) $(WCSLIB) \ $(FLIBS) $(LIBS) -@ $(RM) $@.o tfitshdr_cfitsio tpih1_cfitsio tbth1_cfitsio : %_cfitsio : test/%.c $(WCSLIB) -@ echo '' $(CC) -DDO_CFITSIO $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) \ -o $@ $< $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS) -@ $(RM) $@.o tpih2_cfitsio : test/tpih2.c $(PGSBOXLIB) $(WCSLIB) -@ echo '' $(CC) -DDO_CFITSIO $(CPPFLAGS) -I../pgsbox $(PGPLOTINC) \ $(CFITSIOINC) $(CFLAGS) -c -o $@.o $< $(LD) -o $@ $@.o $(LDFLAGS) $(PGSBOXLIB) $(PGPLOTLIB) \ $(CFITSIOLIB) $(WCSLIB) $(FLIBS) $(LIBS) -@ $(RM) $@.o twcstab : test/twcstab.c $(GETWCSTAB) $(WCSLIB) -@ echo '' $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) -o $@ $< $(GETWCSTAB) \ $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS) -@ $(RM) $@.o twcshdr : test/twcshdr.c $(GETWCSTAB) $(WCSLIB) -@ echo '' $(CC) $(CPPFLAGS) $(CFITSIOINC) $(CFLAGS) -o $@ $< $(GETWCSTAB) \ $(LDFLAGS) $(CFITSIOLIB) $(WCSLIB) $(LIBS) -@ $(RM) $@.o getwcstab.o : getwcstab.c getwcstab.h -@ echo '' $(CC) $(CPPFLAGS) $(CFLAGS) $(CFITSIOINC) -c $< $(PGSBOXLIB) : -@ echo '' $(MAKE) -C ../pgsbox $(notdir $@) tofits : test/tofits.c $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< pih.fits : test/pih.keyrec tofits ./tofits < $< > $@ bth.fits : test/bth.keyrec tofits ./tofits < $< > $@ GNUmakefile : ../makedefs ; ../makedefs ../wcsconfig.h ../wcsconfig_tests.h : makedefs.in wcsconfig.h.in \ wcsconfig_tests.h.in ../config.status -@ $(RM) ../wcsconfig.h ../wcsconfig_tests.h cd .. && ./config.status show :: -@ -@ echo ' FLEXMODS := $(FLEXMODS)' -@ -@ echo ' MODULES := $(MODULES)' # Dependencies (use the %.d pattern rule to list them) #----------------------------------------------------- $(WCSLIB)(cel.o) : cel.h prj.h sph.h wcsconfig.h wcserr.h wcsmath.h \ wcsprintf.h wcstrig.h $(WCSLIB)(fitshdr.o) : wcsconfig.h fitshdr.h wcsutil.h $(WCSLIB)(lin.o) : lin.h wcserr.h wcsprintf.h $(WCSLIB)(log.o) : log.h $(WCSLIB)(prj.o) : prj.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \ wcstrig.h wcsutil.h $(WCSLIB)(spc.o) : spc.h spx.h wcserr.h wcsmath.h wcsprintf.h wcstrig.h \ wcsutil.h $(WCSLIB)(sph.o) : sph.h wcsconfig.h wcstrig.h $(WCSLIB)(spx.o) : spx.h wcserr.h wcsmath.h $(WCSLIB)(tab.o) : tab.h wcserr.h wcsmath.h wcsprintf.h $(WCSLIB)(wcs.o) : cel.h lin.h log.h prj.h spc.h sph.h spx.h tab.h \ wcs.h wcsconfig.h wcserr.h wcsmath.h wcsprintf.h \ wcstrig.h wcsunits.h wcsutil.h $(WCSLIB)(wcsbth.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \ wcshdr.h wcsmath.h wcsutil.h $(WCSLIB)(wcserr.o) : wcserr.h wcsprintf.h $(WCSLIB)(wcsfix.o) : cel.h lin.h prj.h spc.h sph.h spx.h tab.h wcs.h \ wcserr.h wcsfix.h wcsmath.h wcsunits.h wcsutil.h $(WCSLIB)(wcshdr.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \ wcshdr.h wcsmath.h wcsutil.h $(WCSLIB)(wcspih.o) : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h \ wcshdr.h wcsmath.h wcsutil.h $(WCSLIB)(wcsprintf.o): wcsprintf.h $(WCSLIB)(wcstrig.o) : wcsconfig.h wcsmath.h wcstrig.h $(WCSLIB)(wcsulex.o) : wcserr.h wcsmath.h wcsunits.h wcsutil.h $(WCSLIB)(wcsunits.o) : wcserr.h wcsunits.h $(WCSLIB)(wcsutil.o) : wcsutil.h $(WCSLIB)(wcsutrn.o) : wcserr.h wcsunits.h tbth1 tbth1_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \ wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h tcel1 : cel.h prj.h wcserr.h tcel2 : cel.h prj.h wcserr.h tfitshdr tfitshdr_cfitsio : fitshdr.h wcsconfig.h wcsconfig_tests.h tlin : lin.h wcserr.h tlog : log.h tpih1 tpih1_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \ wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcsprintf.h tpih2 tpih2_cfitsio : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcsconfig.h \ wcsconfig_tests.h wcserr.h wcshdr.h tprj1 : prj.h wcsconfig.h wcserr.h wcstrig.h tprj2 : prj.h wcserr.h tspc : spc.h spx.h wcsconfig.h wcserr.h wcstrig.h tspcaips: spc.h tspctrne: spc.h wcserr.h tsph : sph.h wcsconfig.h wcstrig.h tsphdpa : sph.h tspx : spx.h wcserr.h ttab1 : tab.h wcserr.h ttab2 : tab.h wcserr.h ttab3 : prj.h tab.h wcserr.h tunits : wcserr.h wcsunits.h twcs : cel.h lin.h log.h prj.h spc.h sph.h spx.h tab.h wcs.h wcsconfig.h \ wcsconfig_tests.h wcserr.h wcsfix.h wcshdr.h wcslib.h wcsmath.h \ wcsprintf.h wcstrig.h wcsunits.h wcsutil.h twcs_locale : wcs.h wcserr.h wcshdr.h wcsprintf.h twcsfix : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h wcsfix.h \ wcsunits.h twcshdr : cel.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \ tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \ wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h twcsmix : cel.h lin.h prj.h spc.h sph.h spx.h tab.h wcs.h wcserr.h twcssub : cel.h lin.h prj.h spc.h spx.h tab.h wcs.h wcserr.h twcstab : cel.h fitshdr.h getwcstab.h lin.h log.h prj.h spc.h sph.h spx.h \ tab.h wcs.h wcsconfig.h wcserr.h wcsfix.h wcshdr.h wcslib.h \ wcsmath.h wcsprintf.h wcstrig.h wcsunits.h wcsutil.h run_tbth1 run_tbth1_cfitsio : bth.fits run_tfitshdr run_tfitshdr_cfitsio : pih.fits run_tpih1 run_tpih1_cfitsio : pih.fits run_tpih2 run_tpih2_cfitsio : pih.fits astropy-0.3/cextern/wcslib/C/makedefs.in0000644000175000017500000002034612243255342016430 0ustar oleole#----------------------------------------------------------------------------- # GNU makefile definitions for building WCSLIB 4.17 # # makedefs is generated from makedefs.in by configure. It contains variable # definitions and some general-purpose rules for building WCSLIB. # # Targets defined here # -------------------- # printenv: Print the environment as seen within makefile rules. # show: Print the values of all makefile variables used. # # Notes: # 1) If you need to make changes then it may be preferable to modify # makedefs.in (not makedefs). The makefile will detect this and # automatically re-run config.status to regenerate makedefs. # # 2) There are three choices for trigd functions - cosd(), sind(), tand(), # acosd(), asind(), atand(), and atan2d(), made by setting WCSTRIG: # # 1: Use the wrapper functions supplied with WCSLIB (default): # WCSTRIG := WRAPPER # # 2: Use native trigd functions supplied in a mathematics library such # as libsunmath (you will also need to add the library to the LIBS # variable below): # WCSTRIG := NATIVE # # 3: Use C preprocessor macro implementations of the trigd functions # (this method is typically 20% faster but may lead to rounding # errors near the poles): # WCSTRIG := MACRO # # 3) Variables for creating the shared (dynamic) library are currently # only set by 'configure' if the GNU C compiler is used. However, # you can set these variables by hand, preferably in makedefs.in. # # Shared libraries require position-independent code (PIC) which imposes # a performance overhead. Consequently the static libraries are # compiled separately without this option. # # The shared library will be installed with version number, e.g. as # libwcs.so.4.17 or libwcs.4.17.dylib with or without the symlink # required to make it visible to the linker (controlled by the SHRLN # variable). On Macs it is deliberately not created because its very # existence precludes static linking with the cctools linker. You can # still link dynamically by using -lwcs.4.17. # # 4) PGPLOT is Tim Pearson's Fortran graphics library with separate C # interface available from astro.caltech.edu. It is only required by # one utility, wcsgrid, and the test programs that plot test grids # (tprj2, tcel1, tcel2, tspc, ttab2, ttab3, twcsmix, and tpih2). You can # skip these by setting PGPLOTLIB to blank. # # It is difficult for configure to deduce what auxiliary graphics # libraries may be needed for PGPLOT since it depends on which of many # possible graphics drivers were selected when PGPLOT was installed. # Therefore it is quite likely that you will need to add additional # libraries to PGPLOTLIB. # # 5) CFITSIO is Bill Pence's FITS I/O library written in C with Fortran # wrappers, available from http://heasarc.gsfc.nasa.gov/fitsio. # # CFITSIO is required by three utilities, HPXcvt, wcsgrid, and wcsware, # and also by the test programs twcstab and twcshdr. wcsware and the # test programs use fits_read_wcstab() which is implemented by # getwcstab.c. However, this implementation is included in CFITSIO post # 3.004beta, so getwcstab.c is required here only for older releases # (controlled by variable GETWCSTAB). getwcstab.o itself is not inserted # into the WCSLIB object library. # # If available, CFITSIO is also optionally used for test programs # tfitshdr, tbth1, tpih1 and tpih2 by setting preprocessor macro # -DDO_CFITSIO. # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta # $Id: makedefs.in,v 4.17.1.1 2013/01/29 05:32:33 cal103 Exp $ #----------------------------------------------------------------------------- # Version. LIBVER := @LIBVER@ WCSLIBPKG := wcslib-@PACKAGE_VERSION@ # System architecture. ARCH := @ARCH@ # Flex and options. FLEX := @FLEX@ FLFLAGS := # C preprocessor and options. CPP := @CPP@ CPPFLAGS := @DEFS@ WCSTRIG := WRAPPER # C compiler and options. CC := @CC@ CFLAGS := @CFLAGS@ # Fortran compiler and options. FC := @F77@ FFLAGS := @FFLAGS@ # Static object library. WCSLIB := libwcs-$(LIBVER).a RANLIB := @RANLIB@ # Shared (dynamic) library (see note 3 above). SHRLIB := @SHRLIB@ SONAME := @SONAME@ SHRFLAGS := @SHRFLAGS@ SHRLD := @SHRLD@ SHRLN := @SHRLN@ # What subdirectories to build. SUBDIRS := @SUBDIRS@ TSTDIRS := @TSTDIRS@ # Top of the 'make install' hierarchy: pgsbox -> Fortran -> C. INSTDIR := @INSTDIR@ # Installation utilities and locations. LN_S := @LN_S@ INSTALL := @INSTALL@ # Needed for the definitions provided by autoconf. prefix := @prefix@ exec_prefix := @exec_prefix@ datarootdir := @datarootdir@ PACKAGE_TARNAME := @PACKAGE_TARNAME@ docdir := @docdir@ LIBDIR := $(DESTDIR)@libdir@ BINDIR := $(DESTDIR)@bindir@ INCDIR := $(DESTDIR)@includedir@/wcslib-$(LIBVER) INCLINK := $(DESTDIR)@includedir@/wcslib DOCDIR := $(DESTDIR)@docdir@ DOCLINK := $(dir $(DESTDIR)@docdir@)wcslib HTMLDIR := $(DESTDIR)@htmldir@ PDFDIR := $(DESTDIR)@pdfdir@ MANDIR := $(DESTDIR)@mandir@ # For putting timestamps in the build log. TIMER := date +"%a %Y/%m/%d %X %z, executing on $$HOST" # The remaining options are for building utilities and test programs. # ------------------------------------------------------------------- # Linker options (use CC for linking). LD = $(CC) LDFLAGS := @LDFLAGS@ # PGPLOT (see note 4 above). PGPLOTINC := @PGPLOTINC@ PGPLOTLIB := @PGPLOTLIB@ # CFITSIO (see note 5 above). CFITSIOINC := @CFITSIOINC@ CFITSIOLIB := @CFITSIOLIB@ GETWCSTAB := @GETWCSTAB@ # Libraries required by the above Fortran compiler. FLIBS := @FLIBS@ # Libraries required by WCSLIB itself. LIBS := @LIBS@ #----------------------------------------------------------------------------- # You shouldn't need to change anything below here. #----------------------------------------------------------------------------- SHELL := /bin/sh VPATH := .. # Common targets. .PHONY : all build printenv show all : show build # Print the environment as seen by makefile rules. printenv : -@ printenv | sort # Print variable definitions. show :: wcsconfig.h -@ echo '' -@ uname -a -@ echo '' -@ $(MAKE) --version | head -1 -@ echo ' MAKEFLAGS := $(MAKEFLAGS)' -@ echo '' -@ echo 'For building and installing $(WCSLIBPKG)...' -@ echo ' ARCH := $(ARCH)' -@ echo ' FLEX := $(FLEX)' -@ echo ' FLFLAGS := $(FLFLAGS)' -@ echo ' CPP := $(CPP)' -@ echo ' CPPFLAGS := $(CPPFLAGS)' -@ echo ' WCSTRIG := $(WCSTRIG)' -@ echo ' CC := $(CC)' -@ echo ' CFLAGS := $(CFLAGS)' -@ echo ' FC := $(FC)' -@ echo ' FFLAGS := $(FFLAGS)' -@ echo ' WCSLIB := $(WCSLIB)' -@ echo ' RANLIB := $(RANLIB)' -@ echo ' SHRLIB := $(SHRLIB)' -@ echo ' SONAME := $(SONAME)' -@ echo ' SHRFLAGS := $(SHRFLAGS)' -@ echo ' SHRLD := $(SHRLD)' -@ echo ' SHRLN := $(SHRLN)' -@ echo ' LN_S := $(LN_S)' -@ echo ' INSTALL := $(INSTALL)' -@ echo ' LIBDIR := $(LIBDIR)' -@ echo ' BINDIR := $(BINDIR)' -@ echo ' INCDIR := $(INCDIR)' -@ echo ' INCLINK := $(INCLINK)' -@ echo ' DOCDIR := $(DOCDIR)' -@ echo ' DOCLINK := $(DOCLINK)' -@ echo ' HTMLDIR := $(HTMLDIR)' -@ echo ' PDFDIR := $(PDFDIR)' -@ echo ' MANDIR := $(MANDIR)' -@ echo ' TIMER := $(TIMER)' -@ echo '' -@ echo 'Important wcsconfig.h defines...' -@ echo " `grep HAVE_SINCOS $<`" -@ echo " `grep WCSLIB_INT64 $<`" -@ echo '' -@ echo 'To build utilities and test programs...' -@ echo ' LD := $(LD)' -@ echo ' LDFLAGS := $(LDFLAGS)' -@ echo ' PGPLOTINC := $(PGPLOTINC)' -@ echo ' PGPLOTLIB := $(PGPLOTLIB)' -@ echo ' CFITSIOINC := $(CFITSIOINC)' -@ echo ' CFITSIOLIB := $(CFITSIOLIB)' -@ echo ' GETWCSTAB := $(GETWCSTAB)' -@ echo ' FLIBS := $(FLIBS)' -@ echo ' LIBS := $(LIBS)' -@ echo '' # Code development overrides, for use in the code subdirectories. -include ../flavours astropy-0.3/cextern/wcslib/C/lin.h0000644000175000017500000004055212243255342015255 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: lin.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the lin routines * --------------------------- * These routines apply the linear transformation defined by the FITS WCS * standard. They are based on the linprm struct which contains all * information needed for the computations. The struct contains some members * that must be set by the user, and others that are maintained by these * routines, somewhat like a C++ class but with no encapsulation. * * Three routines, linini(), lincpy(), and linfree() are provided to manage the * linprm struct, and another, linprt(), prints its contents. * * A setup routine, linset(), computes intermediate values in the linprm struct * from parameters in it that were supplied by the user. The struct always * needs to be set up by linset() but need not be called explicitly - refer to * the explanation of linprm::flag. * * linp2x() and linx2p() implement the WCS linear transformations. * * An auxiliary matrix inversion routine, matinv(), is included. It uses * LU-triangular factorization with scaled partial pivoting. * * * linini() - Default constructor for the linprm struct * ---------------------------------------------------- * linini() allocates memory for arrays in a linprm struct and sets all members * of the struct to default values. * * PLEASE NOTE: every linprm struct should be initialized by linini(), possibly * repeatedly. On the first invokation, and only the first invokation, * linprm::flag must be set to -1 to initialize memory management, regardless * of whether linini() will actually be used to allocate memory. * * Given: * alloc int If true, allocate memory unconditionally for arrays in * the linprm struct. * * If false, it is assumed that pointers to these arrays * have been set by the user except if they are null * pointers in which case memory will be allocated for * them regardless. (In other words, setting alloc true * saves having to initalize these pointers to zero.) * * naxis int The number of world coordinate axes, used to determine * array sizes. * * Given and returned: * lin struct linprm* * Linear transformation parameters. Note that, in order * to initialize memory management linprm::flag should be * set to -1 when lin is initialized for the first time * (memory leaks may result if it had already been * initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * 2: Memory allocation failed. * * For returns > 1, a detailed error message is set in * linprm::err if enabled, see wcserr_enable(). * * * lincpy() - Copy routine for the linprm struct * --------------------------------------------- * lincpy() does a deep copy of one linprm struct to another, using linini() to * allocate memory for its arrays if required. Only the "information to be * provided" part of the struct is copied; a call to linset() is required to * initialize the remainder. * * Given: * alloc int If true, allocate memory for the crpix, pc, and cdelt * arrays in the destination. Otherwise, it is assumed * that pointers to these arrays have been set by the * user except if they are null pointers in which case * memory will be allocated for them regardless. * * linsrc const struct linprm* * Struct to copy from. * * Given and returned: * lindst struct linprm* * Struct to copy to. linprm::flag should be set to -1 * if lindst was not previously initialized (memory leaks * may result if it was previously initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * 2: Memory allocation failed. * * For returns > 1, a detailed error message is set in * linprm::err if enabled, see wcserr_enable(). * * * linfree() - Destructor for the linprm struct * -------------------------------------------- * linfree() frees memory allocated for the linprm arrays by linini() and/or * linset(). linini() keeps a record of the memory it allocates and linfree() * will only attempt to free this. * * PLEASE NOTE: linfree() must not be invoked on a linprm struct that was not * initialized by linini(). * * Given: * lin struct linprm* * Linear transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * * * linprt() - Print routine for the linprm struct * ---------------------------------------------- * linprt() prints the contents of a linprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * lin const struct linprm* * Linear transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * * * linset() - Setup routine for the linprm struct * ---------------------------------------------- * linset(), if necessary, allocates memory for the linprm::piximg and * linprm::imgpix arrays and sets up the linprm struct according to information * supplied within it - refer to the explanation of linprm::flag. * * Note that this routine need not be called directly; it will be invoked by * linp2x() and linx2p() if the linprm::flag is anything other than a * predefined magic value. * * Given and returned: * lin struct linprm* * Linear transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * 2: Memory allocation failed. * 3: PCi_ja matrix is singular. * * For returns > 1, a detailed error message is set in * linprm::err if enabled, see wcserr_enable(). * * * linp2x() - Pixel-to-world linear transformation * ----------------------------------------------- * linp2x() transforms pixel coordinates to intermediate world coordinates. * * Given and returned: * lin struct linprm* * Linear transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length nelem * but containing lin.naxis coordinate elements. * * pixcrd const double[ncoord][nelem] * Array of pixel coordinates. * * Returned: * imgcrd double[ncoord][nelem] * Array of intermediate world coordinates. * * Function return value: * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * 2: Memory allocation failed. * 3: PCi_ja matrix is singular. * * For returns > 1, a detailed error message is set in * linprm::err if enabled, see wcserr_enable(). * * * linx2p() - World-to-pixel linear transformation * ----------------------------------------------- * linx2p() transforms intermediate world coordinates to pixel coordinates. * * Given and returned: * lin struct linprm* * Linear transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length nelem * but containing lin.naxis coordinate elements. * * imgcrd const double[ncoord][nelem] * Array of intermediate world coordinates. * * Returned: * pixcrd double[ncoord][nelem] * Array of pixel coordinates. * * int Status return value: * 0: Success. * 1: Null linprm pointer passed. * 2: Memory allocation failed. * 3: PCi_ja matrix is singular. * * For returns > 1, a detailed error message is set in * linprm::err if enabled, see wcserr_enable(). * * * linprm struct - Linear transformation parameters * ------------------------------------------------ * The linprm struct contains all of the information required to perform a * linear transformation. It consists of certain members that must be set by * the user ("given") and others that are set by the WCSLIB routines * ("returned"). * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following members of the linprm struct are set or modified: * * - linprm::naxis (q.v., not normally set by the user), * - linprm::pc, * - linprm::cdelt. * * This signals the initialization routine, linset(), to recompute the * returned members of the linprm struct. linset() will reset flag to * indicate that this has been done. * * PLEASE NOTE: flag should be set to -1 when linini() is called for the * first time for a particular linprm struct in order to initialize memory * management. It must ONLY be used on the first initialization otherwise * memory leaks may result. * * int naxis * (Given or returned) Number of pixel and world coordinate elements. * * If linini() is used to initialize the linprm struct (as would normally * be the case) then it will set naxis from the value passed to it as a * function argument. The user should not subsequently modify it. * * double *crpix * (Given) Pointer to the first element of an array of double containing * the coordinate reference pixel, CRPIXja. * * double *pc * (Given) Pointer to the first element of the PCi_ja (pixel coordinate) * transformation matrix. The expected order is * = struct linprm lin; = lin.pc = {PC1_1, PC1_2, PC2_1, PC2_2}; * * This may be constructed conveniently from a 2-D array via * = double m[2][2] = {{PC1_1, PC1_2}, = {PC2_1, PC2_2}}; * * which is equivalent to * = double m[2][2]; = m[0][0] = PC1_1; = m[0][1] = PC1_2; = m[1][0] = PC2_1; = m[1][1] = PC2_2; * * The storage order for this 2-D array is the same as for the 1-D array, * whence * = lin.pc = *m; * * would be legitimate. * * double *cdelt * (Given) Pointer to the first element of an array of double containing * the coordinate increments, CDELTia. * * int unity * (Returned) True if the linear transformation matrix is unity. * * int padding * (An unused variable inserted for alignment purposes only.) * * double *piximg * (Returned) Pointer to the first element of the matrix containing the * product of the CDELTia diagonal matrix and the PCi_ja matrix. * * double *imgpix * (Returned) Pointer to the first element of the inverse of the * linprm::piximg matrix. * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * int i_naxis * (For internal use only.) * int m_flag * (For internal use only.) * int m_naxis * (For internal use only.) * int m_padding * (For internal use only.) * double *m_crpix * (For internal use only.) * double *m_pc * (For internal use only.) * double *m_cdelt * (For internal use only.) * void *padding2 * (For internal use only.) * * * Global variable: const char *lin_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_LIN #define WCSLIB_LIN #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif extern const char *lin_errmsg[]; enum lin_errmsg_enum { LINERR_SUCCESS = 0, /* Success. */ LINERR_NULL_POINTER = 1, /* Null linprm pointer passed. */ LINERR_MEMORY = 2, /* Memory allocation failed. */ LINERR_SINGULAR_MTX = 3 /* PCi_ja matrix is singular. */ }; struct linprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* Parameters to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ int naxis; /* The number of axes, given by NAXIS. */ double *crpix; /* CRPIXja keywords for each pixel axis. */ double *pc; /* PCi_ja linear transformation matrix. */ double *cdelt; /* CDELTia keywords for each coord axis. */ /* Information derived from the parameters supplied. */ /*------------------------------------------------------------------------*/ double *piximg; /* Product of CDELTia and PCi_ja matrices. */ double *imgpix; /* Inverse of the piximg matrix. */ int unity; /* True if the PCi_ja matrix is unity. */ /* Error handling */ /*------------------------------------------------------------------------*/ int padding; /* (Dummy inserted for alignment purposes.) */ struct wcserr *err; /* Private - the remainder are for memory management. */ /*------------------------------------------------------------------------*/ int i_naxis; int m_flag, m_naxis, m_padding; double *m_crpix, *m_pc, *m_cdelt; void *padding2; }; /* Size of the linprm struct in int units, used by the Fortran wrappers. */ #define LINLEN (sizeof(struct linprm)/sizeof(int)) int linini(int alloc, int naxis, struct linprm *lin); int lincpy(int alloc, const struct linprm *linsrc, struct linprm *lindst); int linfree(struct linprm *lin); int linprt(const struct linprm *lin); int linset(struct linprm *lin); int linp2x(struct linprm *lin, int ncoord, int nelem, const double pixcrd[], double imgcrd[]); int linx2p(struct linprm *lin, int ncoord, int nelem, const double imgcrd[], double pixcrd[]); int matinv(int n, const double mat[], double inv[]); /* Deprecated. */ #define linini_errmsg lin_errmsg #define lincpy_errmsg lin_errmsg #define linfree_errmsg lin_errmsg #define linprt_errmsg lin_errmsg #define linset_errmsg lin_errmsg #define linp2x_errmsg lin_errmsg #define linx2p_errmsg lin_errmsg #ifdef __cplusplus } #endif #endif /* WCSLIB_LIN */ astropy-0.3/cextern/wcslib/C/fitshdr.l0000644000175000017500000003072612243255342016144 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: fitshdr.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner * definition for extracting keywords and keyvalues from a FITS header. * * It requires Flex v2.5.4 or later. * * Refer to fitshdr.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ %option full %option never-interactive %option nounput %option noyywrap %option outfile="fitshdr.c" %option prefix="fitshdr" /* Keywords. */ KEYCHR [-_A-Z0-9] KW1 {KEYCHR}{1}" "{7} KW2 {KEYCHR}{2}" "{6} KW3 {KEYCHR}{3}" "{5} KW4 {KEYCHR}{4}" "{4} KW5 {KEYCHR}{5}" "{3} KW6 {KEYCHR}{6}" "{2} KW7 {KEYCHR}{7}" "{1} KW8 {KEYCHR}{8} KEYWORD ({KW1}|{KW2}|{KW3}|{KW4}|{KW5}|{KW6}|{KW7}|{KW8}) /* Keyvalue data types. */ LOGICAL [TF] INT32 [+-]?0*[0-9]{1,9} INT64 [+-]?0*[0-9]{10,18} INTVL [+-]?0*[0-9]{19,} INTEGER [+-]?[0-9]+ FLOAT [+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)? ICOMPLX \(" "*{INTEGER}" "*," "*{INTEGER}" "*\) FCOMPLX \(" "*{FLOAT}" "*," "*{FLOAT}" "*\) STRING '([^']|'')*' /* Characters forming standard unit strings (jwBIQX are not used). */ UNITSTR \[[-+*/^(). 0-9a-zA-Z]+\] /* Exclusive start states. */ %x VALUE INLINE UNITS COMMENT ERROR FLUSH %{ #include #include #include #include #include #include "fitshdr.h" #include "wcsutil.h" #define YY_DECL int fitshdr(const char header[], int nkeyrec, int nkeyids, \ struct fitskeyid keyids[], int *nreject, \ struct fitskey **keys) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (fitshdr_nkeyrec) { \ strncpy(inbuff, fitshdr_hdr, 80); \ inbuff[80] = '\n'; \ fitshdr_hdr += 80; \ fitshdr_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* These global variables are required by YY_INPUT. */ const char *fitshdr_hdr; int fitshdr_nkeyrec; /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf fitshdr_abort_jmp_env; #define exit(status) longjmp(fitshdr_abort_jmp_env, status) /* Map status return value to message. */ const char *fitshdr_errmsg[] = { "Success", "Null fitskey pointer-pointer passed", "Memory allocation failed", "Fatal error returned by Flex parser"}; %} %% char *cptr, ctmp[72]; int blank, continuation, end, j, k, keyno; double dtmp; struct fitskey *kptr; struct fitskeyid *iptr; void nullfill(char cptr[], int len); int yylex_destroy(void); fitshdr_hdr = header; fitshdr_nkeyrec = nkeyrec; *nreject = 0; keyno = 0; if (keys == 0x0) { return 1; } /* Allocate memory for the required number of fitskey structs. */ /* Recall that calloc() initializes allocated memory to zero. */ if (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) { return 2; } /* Initialize keyids[]. */ iptr = keyids; for (j = 0; j < nkeyids; j++, iptr++) { iptr->count = 0; iptr->idx[0] = -1; iptr->idx[1] = -1; } blank = 0; continuation = 0; end = 0; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(fitshdr_abort_jmp_env)) { return 3; } BEGIN(INITIAL); ^" "{80} { /* A completely blank keyrecord. */ strncpy(kptr->keyword, yytext, 8); yyless(0); blank = 1; BEGIN(COMMENT); } ^(COMMENT|HISTORY|" "{8}) { strncpy(kptr->keyword, yytext, 8); BEGIN(COMMENT); } ^END" "{77} { strncpy(kptr->keyword, yytext, 8); end = 1; BEGIN(FLUSH); } ^END" "{5}=" "+ { /* Illegal END keyrecord. */ strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(VALUE); } ^END" "{5} { /* Illegal END keyrecord. */ strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(COMMENT); } ^{KEYWORD}=" "+ { strncpy(kptr->keyword, yytext, 8); BEGIN(VALUE); } ^CONTINUE" "+{STRING} { /* Continued string keyvalue. */ strncpy(kptr->keyword, yytext, 8); if (keyno > 0 && (kptr-1)->type%10 == 8) { /* Put back the string keyvalue. */ for (k = 10; yytext[k] != '\''; k++); yyless(k); continuation = 1; BEGIN(VALUE); } else { /* Not a valid continuation. */ yyless(8); BEGIN(COMMENT); } } ^{KEYWORD} { /* Keyword without value. */ strncpy(kptr->keyword, yytext, 8); BEGIN(COMMENT); } ^.{8}=" "+ { /* Illegal keyword, carry on regardless. */ strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(VALUE); } ^.{8} { /* Illegal keyword, carry on regardless. */ strncpy(kptr->keyword, yytext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(COMMENT); } " "*/\/ { /* Null keyvalue. */ BEGIN(INLINE); } {LOGICAL} { /* Logical keyvalue. */ kptr->type = 1; kptr->keyvalue.i = (*yytext == 'T'); BEGIN(INLINE); } {INT32} { /* 32-bit signed integer keyvalue. */ kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } {INT64} { /* 64-bit signed integer keyvalue (up to 18 digits). */ if (wcsutil_str2double(yytext, "%lf", &dtmp)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } else if (INT_MIN <= dtmp && dtmp <= INT_MAX) { /* Can be accomodated as a 32-bit signed integer. */ kptr->type = 2; if (sscanf(yytext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } } else { /* 64-bit signed integer. */ kptr->type = 3; #ifdef WCSLIB_INT64 /* Native 64-bit integer is available. */ if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } #else /* 64-bit integer (up to 18 digits) implemented as int[3]. */ kptr->keyvalue.k[2] = 0; sprintf(ctmp, "%%%dd%%9d", yyleng-9); if (sscanf(yytext, ctmp, kptr->keyvalue.k+1, kptr->keyvalue.k) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } else if (*yytext == '-') { kptr->keyvalue.k[0] *= -1; } #endif } BEGIN(INLINE); } {INTVL} { /* Very long integer keyvalue (and 19-digit int64). */ kptr->type = 4; strcpy(ctmp, yytext); k = yyleng; for (j = 0; j < 8; j++) { /* Read it backwards. */ k -= 9; if (k < 0) k = 0; if (sscanf(ctmp+k, "%d", kptr->keyvalue.l+j) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } if (*yytext == '-') { kptr->keyvalue.l[j] = -abs(kptr->keyvalue.l[j]); } if (k == 0) break; ctmp[k] = '\0'; } /* Can it be accomodated as a 64-bit signed integer? */ if (j == 2 && abs(kptr->keyvalue.l[2]) <= 9 && abs(kptr->keyvalue.l[1]) <= 223372036 && kptr->keyvalue.l[0] <= 854775807 && kptr->keyvalue.l[0] >= -854775808) { kptr->type = 3; #ifdef WCSLIB_INT64 /* Native 64-bit integer is available. */ kptr->keyvalue.l[2] = 0; if (sscanf(yytext, "%lld", &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } #endif } BEGIN(INLINE); } {FLOAT} { /* Float keyvalue. */ kptr->type = 5; if (wcsutil_str2double(yytext, "%lf", &(kptr->keyvalue.f))) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } {ICOMPLX} { /* Integer complex keyvalue. */ kptr->type = 6; if (sscanf(yytext, "(%lf,%lf)", kptr->keyvalue.c, kptr->keyvalue.c+1) < 2) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } {FCOMPLX} { /* Floating point complex keyvalue. */ kptr->type = 7; for (cptr = ctmp, k = 1; yytext[k] != ','; cptr++, k++) { *cptr = yytext[k]; } *cptr = '\0'; if (wcsutil_str2double(ctmp, "%lf", kptr->keyvalue.c)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } for (cptr = ctmp, k++; yytext[k] != ')'; cptr++, k++) { *cptr = yytext[k]; } *cptr = '\0'; if (wcsutil_str2double(ctmp, "%lf", kptr->keyvalue.c+1)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } {STRING} { /* String keyvalue. */ kptr->type = 8; cptr = kptr->keyvalue.s; strcpy(cptr, yytext+1); /* Squeeze out repeated quotes. */ k = 0; for (j = 0; j < 72; j++) { if (k < j) { cptr[k] = cptr[j]; } if (cptr[j] == '\0') { if (k) cptr[k-1] = '\0'; break; } else if (cptr[j] == '\'' && cptr[j+1] == '\'') { j++; } k++; } if (*cptr) { /* Retain the initial blank in all-blank strings. */ nullfill(cptr+1, 71); } else { nullfill(cptr, 72); } BEGIN(INLINE); } . { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } " "*$ { BEGIN(FLUSH); } " "*\/" "*$ { BEGIN(FLUSH); } " "*\/" "* { BEGIN(UNITS); } " " { kptr->status |= FITSHDR_COMMENT; BEGIN(ERROR); } . { /* Keyvalue parsing must now also be suspect. */ kptr->status |= FITSHDR_COMMENT; kptr->type = 0; BEGIN(ERROR); } {UNITSTR} { kptr->ulen = yyleng; yymore(); BEGIN(COMMENT); } . { yymore(); BEGIN(COMMENT); } .* { strcpy(kptr->comment, yytext); nullfill(kptr->comment, 84); BEGIN(FLUSH); } .* { if (!continuation) kptr->type = -abs(kptr->type); sprintf(kptr->comment, "%.80s", fitshdr_hdr-80); kptr->comment[80] = '\0'; nullfill(kptr->comment+80, 4); BEGIN(FLUSH); } .*\n { /* Discard the rest of the input line. */ kptr->keyno = ++keyno; /* Null-fill the keyword. */ kptr->keyword[8] = '\0'; nullfill(kptr->keyword, 12); /* Do indexing. */ iptr = keyids; kptr->keyid = -1; for (j = 0; j < nkeyids; j++, iptr++) { cptr = iptr->name; cptr[8] = '\0'; nullfill(cptr, 12); for (k = 0; k < 8; k++, cptr++) { if (*cptr != '.' && *cptr != kptr->keyword[k]) break; } if (k == 8) { /* Found a match. */ iptr->count++; if (iptr->idx[0] == -1) { iptr->idx[0] = keyno-1; } else { iptr->idx[1] = keyno-1; } kptr->keyno = -abs(kptr->keyno); if (kptr->keyid < 0) kptr->keyid = j; } } /* Deal with continued strings. */ if (continuation) { /* Tidy up the previous string keyvalue. */ if ((kptr-1)->type == 8) (kptr-1)->type += 10; cptr = (kptr-1)->keyvalue.s; if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\0'; kptr->type = (kptr-1)->type + 10; } /* Check for keyrecords following the END keyrecord. */ if (end && (end++ > 1) && !blank) { kptr->status |= FITSHDR_TRAILER; } if (kptr->status) (*nreject)++; kptr++; blank = 0; continuation = 0; BEGIN(INITIAL); } <> { /* End-of-input. */ yylex_destroy(); return 0; } %% /*--------------------------------------------------------------------------*/ void nullfill(char cptr[], int len) { int j, k; /* Null-fill the string. */ for (j = 0; j < len; j++) { if (cptr[j] == '\0') { for (k = j+1; k < len; k++) { cptr[k] = '\0'; } break; } } for (k = j-1; k >= 0; k--) { if (cptr[k] != ' ') break; cptr[k] = '\0'; } return; } astropy-0.3/cextern/wcslib/C/wcs.h0000644000175000017500000017524512243255342015277 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcs.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the wcs routines * --------------------------- * These routines implement the FITS World Coordinate System (WCS) standard * which defines methods to be used for computing world coordinates from image * pixel coordinates, and vice versa. They are based on the wcsprm struct * which contains all information needed for the computations. The struct * contains some members that must be set by the user, and others that are * maintained by these routines, somewhat like a C++ class but with no * encapsulation. * * Three routines, wcsini(), wcssub(), and wcsfree() are provided to manage the * wcsprm struct and another, wcsprt(), to prints its contents. Refer to the * description of the wcsprm struct for an explanation of the anticipated usage * of these routines. wcscopy(), which does a deep copy of one wcsprm struct * to another, is defined as a preprocessor macro function that invokes * wcssub(). * * wcsperr() prints the error message(s) (if any) stored in a wcsprm struct, * and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains. * * A setup routine, wcsset(), computes intermediate values in the wcsprm struct * from parameters in it that were supplied by the user. The struct always * needs to be set up by wcsset() but this need not be called explicitly - * refer to the explanation of wcsprm::flag. * * wcsp2s() and wcss2p() implement the WCS world coordinate transformations. * In fact, they are high level driver routines for the WCS linear, * logarithmic, celestial, spectral and tabular transformation routines * described in lin.h, log.h, cel.h, spc.h and tab.h. * * Given either the celestial longitude or latitude plus an element of the * pixel coordinate a hybrid routine, wcsmix(), iteratively solves for the * unknown elements. * * wcssptr() translates the spectral axis in a wcsprm struct. For example, a * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa. * * Quadcube projections: * --------------------- * The quadcube projections (TSC, CSC, QSC) may be represented in FITS in * either of two ways: * * a: The six faces may be laid out in one plane and numbered as follows: * = 0 = = 4 3 2 1 4 3 2 = = 5 * * Faces 2, 3 and 4 may appear on one side or the other (or both). The * world-to-pixel routines map faces 2, 3 and 4 to the left but the * pixel-to-world routines accept them on either side. * * b: The "COBE" convention in which the six faces are stored in a * three-dimensional structure using a CUBEFACE axis indexed from * 0 to 5 as above. * * These routines support both methods; wcsset() determines which is being * used by the presence or absence of a CUBEFACE axis in ctype[]. wcsp2s() * and wcss2p() translate the CUBEFACE axis representation to the single * plane representation understood by the lower-level WCSLIB projection * routines. * * * wcsini() - Default constructor for the wcsprm struct * ---------------------------------------------------- * wcsini() optionally allocates memory for arrays in a wcsprm struct and sets * all members of the struct to default values. Memory is allocated for up to * NPVMAX PVi_ma keywords or NPSMAX PSi_ma keywords per WCS representation. * These may be changed via wcsnpv() and wcsnps() before wcsini() is called. * * PLEASE NOTE: every wcsprm struct should be initialized by wcsini(), possibly * repeatedly. On the first invokation, and only the first invokation, * wcsprm::flag must be set to -1 to initialize memory management, regardless * of whether wcsini() will actually be used to allocate memory. * * Given: * alloc int If true, allocate memory unconditionally for the * crpix, etc. arrays. * * If false, it is assumed that pointers to these arrays * have been set by the user except if they are null * pointers in which case memory will be allocated for * them regardless. (In other words, setting alloc true * saves having to initalize these pointers to zero.) * * naxis int The number of world coordinate axes. This is used to * determine the length of the various wcsprm vectors and * matrices and therefore the amount of memory to * allocate for them. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Note that, in order to initialize memory management, * wcsprm::flag should be set to -1 when wcs is * initialized for the first time (memory leaks may * result if it had already been initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcsnpv() - Memory allocation for PVi_ma * --------------------------------------- * wcsnpv() changes the value of NPVMAX (default 64). This global variable * controls the number of PVi_ma keywords that wcsini() should allocate space * for. * * PLEASE NOTE: This function is not thread-safe. * * Given: * n int Value of NPVMAX; ignored if < 0. * * Function return value: * int Current value of NPVMAX. * * * wcsnps() - Memory allocation for PSi_ma * --------------------------------------- * wcsnps() changes the values of NPSMAX (default 8). This global variable * controls the number of PSi_ma keywords that wcsini() should allocate space * for. * * PLEASE NOTE: This function is not thread-safe. * * Given: * n int Value of NPSMAX; ignored if < 0. * * Function return value: * int Current value of NPSMAX. * * * wcssub() - Subimage extraction routine for the wcsprm struct * ------------------------------------------------------------ * wcssub() extracts the coordinate description for a subimage from a wcsprm * struct. It does a deep copy, using wcsini() to allocate memory for its * arrays if required. Only the "information to be provided" part of the * struct is extracted; a call to wcsset() is required to set up the remainder. * * The world coordinate system of the subimage must be separable in the sense * that the world coordinates at any point in the subimage must depend only on * the pixel coordinates of the axes extracted. In practice, this means that * the PCi_ja matrix of the original image must not contain non-zero * off-diagonal terms that associate any of the subimage axes with any of the * non-subimage axes. * * Note that while the required elements of the tabprm array are extracted, the * wtbarr array is not. (Thus it is not appropriate to call wcssub() after * wcstab() but before filling the tabprm structs - refer to wcshdr.h.) * * wcssub() can also add axes to a wcsprm struct. The new axes will be created * using the defaults set by wcsini() which produce a simple, unnamed, linear * axis with world coordinate equal to the pixel coordinate. These default * values can be changed afterwards, before invoking wcsset(). * * Given: * alloc int If true, allocate memory for the crpix, etc. arrays in * the destination. Otherwise, it is assumed that * pointers to these arrays have been set by the user * except if they are null pointers in which case memory * will be allocated for them regardless. * * wcssrc const struct wcsprm* * Struct to extract from. * * Given and returned: * nsub int* * axes int[] Vector of length *nsub containing the image axis * numbers (1-relative) to extract. Order is * significant; axes[0] is the axis number of the input * image that corresponds to the first axis in the * subimage, etc. * * Use an axis number of 0 to create a new axis using * the defaults set by wcsini(). They can be changed * later. * * nsub (the pointer) may be set to zero, and so also may * *nsub, which is interpreted to mean all axes in the * input image; the number of axes will be returned if * nsub != 0x0. axes itself (the pointer) may be set to * zero to indicate the first *nsub axes in their * original order. * * Set both nsub (or *nsub) and axes to zero to do a deep * copy of one wcsprm struct to another. * * Subimage extraction by coordinate axis type may be * done by setting the elements of axes[] to the * following special preprocessor macro values: * * WCSSUB_LONGITUDE: Celestial longitude. * WCSSUB_LATITUDE: Celestial latitude. * WCSSUB_CUBEFACE: Quadcube CUBEFACE axis. * WCSSUB_SPECTRAL: Spectral axis. * WCSSUB_STOKES: Stokes axis. * * Refer to the notes (below) for further usage examples. * * On return, *nsub will be set to the number of axes in * the subimage; this may be zero if there were no axes * of the required type(s) (in which case no memory will * be allocated). axes[] will contain the axis numbers * that were extracted, or 0 for newly created axes. The * vector length must be sufficient to contain all axis * numbers. No checks are performed to verify that the * coordinate axes are consistent, this is done by * wcsset(). * * wcsdst struct wcsprm* * Struct describing the subimage. wcsprm::flag should * be set to -1 if wcsdst was not previously initialized * (memory leaks may result if it was previously * initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 12: Invalid subimage specification. * 13: Non-separable subimage coordinate system. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * Notes: * Combinations of subimage axes of particular types may be extracted in the * same order as they occur in the input image by combining preprocessor * codes, for example * = *nsub = 1; = axes[0] = WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_SPECTRAL; * * would extract the longitude, latitude, and spectral axes in the same order * as the input image. If one of each were present, *nsub = 3 would be * returned. * * For convenience, WCSSUB_CELESTIAL is defined as the combination * WCSSUB_LONGITUDE | WCSSUB_LATITUDE | WCSSUB_CUBEFACE. * * The codes may also be negated to extract all but the types specified, for * example * = *nsub = 4; = axes[0] = WCSSUB_LONGITUDE; = axes[1] = WCSSUB_LATITUDE; = axes[2] = WCSSUB_CUBEFACE; = axes[3] = -(WCSSUB_SPECTRAL | WCSSUB_STOKES); * * The last of these specifies all axis types other than spectral or Stokes. * Extraction is done in the order specified by axes[] a longitude axis (if * present) would be extracted first (via axes[0]) and not subsequently (via * axes[3]). Likewise for the latitude and cubeface axes in this example. * * From the foregoing, it is apparent that the value of *nsub returned may be * less than or greater than that given. However, it will never exceed the * number of axes in the input image (plus the number of newly-created axes * if any were specified on input). * * * wcscopy() macro - Copy routine for the wcsprm struct * ---------------------------------------------------- * wcscopy() does a deep copy of one wcsprm struct to another. As of * WCSLIB 3.6, it is implemented as a preprocessor macro that invokes * wcssub() with the nsub and axes pointers both set to zero. * * * wcsfree() - Destructor for the wcsprm struct * -------------------------------------------- * wcsfree() frees memory allocated for the wcsprm arrays by wcsini() and/or * wcsset(). wcsini() records the memory it allocates and wcsfree() will only * attempt to free this. * * PLEASE NOTE: wcsfree() must not be invoked on a wcsprm struct that was not * initialized by wcsini(). * * Returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcsprt() - Print routine for the wcsprm struct * ---------------------------------------------- * wcsprt() prints the contents of a wcsprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * wcs const struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcsperr() - Print error messages from a wcsprm struct * ----------------------------------------------------- * wcsperr() prints the error message(s), if any, stored in a wcsprm struct, * and the linprm, celprm, prjprm, spcprm, and tabprm structs that it contains. * If there are no errors then nothing is printed. It uses wcserr_prt(), q.v. * * Given: * wcs const struct wcsprm* * Coordinate transformation parameters. * * prefix const char * * If non-NULL, each output line will be prefixed with * this string. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcsset() - Setup routine for the wcsprm struct * ---------------------------------------------- * wcsset() sets up a wcsprm struct according to information supplied within * it (refer to the description of the wcsprm struct). * * wcsset() recognizes the NCP projection and converts it to the equivalent SIN * projection and likewise translates GLS into SFL. It also translates the * AIPS spectral types ('FREQ-LSR', 'FELO-HEL', etc.), possibly changing the * input header keywords wcsprm::ctype and/or wcsprm::specsys if necessary. * * Note that this routine need not be called directly; it will be invoked by * wcsp2s() and wcss2p() if the wcsprm::flag is anything other than a * predefined magic value. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcsp2s() - Pixel-to-world transformation * ---------------------------------------- * wcsp2s() transforms pixel coordinates to world coordinates. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length * nelem but containing wcs.naxis coordinate elements. * Thus nelem must equal or exceed the value of the * NAXIS keyword unless ncoord == 1, in which case nelem * is not used. * * pixcrd const double[ncoord][nelem] * Array of pixel coordinates. * * Returned: * imgcrd double[ncoord][nelem] * Array of intermediate world coordinates. For * celestial axes, imgcrd[][wcs.lng] and * imgcrd[][wcs.lat] are the projected x-, and * y-coordinates in pseudo "degrees". For spectral * axes, imgcrd[][wcs.spec] is the intermediate spectral * coordinate, in SI units. * * phi,theta double[ncoord] * Longitude and latitude in the native coordinate system * of the projection [deg]. * * world double[ncoord][nelem] * Array of world coordinates. For celestial axes, * world[][wcs.lng] and world[][wcs.lat] are the * celestial longitude and latitude [deg]. For * spectral axes, imgcrd[][wcs.spec] is the intermediate * spectral coordinate, in SI units. * * stat int[ncoord] * Status return value for each coordinate: * 0: Success. * 1+: A bit mask indicating invalid pixel coordinate * element(s). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * 8: One or more of the pixel coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcss2p() - World-to-pixel transformation * ---------------------------------------- * wcss2p() transforms world coordinates to pixel coordinates. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length nelem * but containing wcs.naxis coordinate elements. Thus * nelem must equal or exceed the value of the NAXIS * keyword unless ncoord == 1, in which case nelem is not * used. * * world const double[ncoord][nelem] * Array of world coordinates. For celestial axes, * world[][wcs.lng] and world[][wcs.lat] are the * celestial longitude and latitude [deg]. For spectral * axes, world[][wcs.spec] is the spectral coordinate, in * SI units. * * Returned: * phi,theta double[ncoord] * Longitude and latitude in the native coordinate * system of the projection [deg]. * * imgcrd double[ncoord][nelem] * Array of intermediate world coordinates. For * celestial axes, imgcrd[][wcs.lng] and * imgcrd[][wcs.lat] are the projected x-, and * y-coordinates in pseudo "degrees". For quadcube * projections with a CUBEFACE axis the face number is * also returned in imgcrd[][wcs.cubeface]. For * spectral axes, imgcrd[][wcs.spec] is the intermediate * spectral coordinate, in SI units. * * pixcrd double[ncoord][nelem] * Array of pixel coordinates. * * stat int[ncoord] * Status return value for each coordinate: * 0: Success. * 1+: A bit mask indicating invalid world coordinate * element(s). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * 9: One or more of the world coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcsmix() - Hybrid coordinate transformation * ------------------------------------------- * wcsmix(), given either the celestial longitude or latitude plus an element * of the pixel coordinate, solves for the remaining elements by iterating on * the unknown celestial coordinate element using wcss2p(). Refer also to the * notes below. * * Given and returned: * wcs struct wcsprm* * Indices for the celestial coordinates obtained * by parsing the wcsprm::ctype[]. * * Given: * mixpix int Which element of the pixel coordinate is given. * * mixcel int Which element of the celestial coordinate is given: * 1: Celestial longitude is given in * world[wcs.lng], latitude returned in * world[wcs.lat]. * 2: Celestial latitude is given in * world[wcs.lat], longitude returned in * world[wcs.lng]. * * vspan const double[2] * Solution interval for the celestial coordinate [deg]. * The ordering of the two limits is irrelevant. * Longitude ranges may be specified with any convenient * normalization, for example [-120,+120] is the same as * [240,480], except that the solution will be returned * with the same normalization, i.e. lie within the * interval specified. * * vstep const double * Step size for solution search [deg]. If zero, a * sensible, although perhaps non-optimal default will be * used. * * viter int If a solution is not found then the step size will be * halved and the search recommenced. viter controls how * many times the step size is halved. The allowed range * is 5 - 10. * * Given and returned: * world double[naxis] * World coordinate elements. world[wcs.lng] and * world[wcs.lat] are the celestial longitude and * latitude [deg]. Which is given and which returned * depends on the value of mixcel. All other elements * are given. * * Returned: * phi,theta double[naxis] * Longitude and latitude in the native coordinate * system of the projection [deg]. * * imgcrd double[naxis] * Image coordinate elements. imgcrd[wcs.lng] and * imgcrd[wcs.lat] are the projected x-, and * y-coordinates in pseudo "degrees". * * Given and returned: * pixcrd double[naxis] * Pixel coordinate. The element indicated by mixpix is * given and the remaining elements are returned. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * 10: Invalid world coordinate. * 11: No solution found in the specified interval. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * Notes: * Initially the specified solution interval is checked to see if it's a * "crossing" interval. If it isn't, a search is made for a crossing * solution by iterating on the unknown celestial coordinate starting at the * upper limit of the solution interval and decrementing by the specified * step size. A crossing is indicated if the trial value of the pixel * coordinate steps through the value specified. If a crossing interval is * found then the solution is determined by a modified form of "regula falsi" * division of the crossing interval. If no crossing interval was found * within the specified solution interval then a search is made for a * "non-crossing" solution as may arise from a point of tangency. The * process is complicated by having to make allowance for the discontinuities * that occur in all map projections. * * Once one solution has been determined others may be found by subsequent * invokations of wcsmix() with suitably restricted solution intervals. * * Note the circumstance that arises when the solution point lies at a native * pole of a projection in which the pole is represented as a finite curve, * for example the zenithals and conics. In such cases two or more valid * solutions may exist but wcsmix() only ever returns one. * * Because of its generality wcsmix() is very compute-intensive. For * compute-limited applications more efficient special-case solvers could be * written for simple projections, for example non-oblique cylindrical * projections. * * * wcssptr() - Spectral axis translation * ------------------------------------- * wcssptr() translates the spectral axis in a wcsprm struct. For example, a * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * i int* Index of the spectral axis (0-relative). If given < 0 * it will be set to the first spectral axis identified * from the ctype[] keyvalues in the wcsprm struct. * * ctype char[9] Desired spectral CTYPEia. Wildcarding may be used as * for the ctypeS2 argument to spctrn() as described in * the prologue of spc.h, i.e. if the final three * characters are specified as "???", or if just the * eighth character is specified as '?', the correct * algorithm code will be substituted and returned. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * 12: Invalid subimage specification (no spectral * axis). * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcsprm struct - Coordinate transformation parameters * ---------------------------------------------------- * The wcsprm struct contains information required to transform world * coordinates. It consists of certain members that must be set by the user * ("given") and others that are set by the WCSLIB routines ("returned"). * Some of the former are not actually required for transforming coordinates. * These are described as "auxiliary"; the struct simply provides a place to * store them, though they may be used by wcshdo() in constructing a FITS * header from a wcsprm struct. Some of the returned values are supplied for * informational purposes and others are for internal use only as indicated. * * In practice, it is expected that a WCS parser would scan the FITS header to * determine the number of coordinate axes. It would then use wcsini() to * allocate memory for arrays in the wcsprm struct and set default values. * Then as it reread the header and identified each WCS keyrecord it would load * the value into the relevant wcsprm array element. This is essentially what * wcspih() does - refer to the prologue of wcshdr.h. As the final step, * wcsset() is invoked, either directly or indirectly, to set the derived * members of the wcsprm struct. wcsset() strips off trailing blanks in all * string members and null-fills the character array. * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following wcsprm struct members are set or changed: * * - wcsprm::naxis (q.v., not normally set by the user), * - wcsprm::crpix, * - wcsprm::pc, * - wcsprm::cdelt, * - wcsprm::crval, * - wcsprm::cunit, * - wcsprm::ctype, * - wcsprm::lonpole, * - wcsprm::latpole, * - wcsprm::restfrq, * - wcsprm::restwav, * - wcsprm::npv, * - wcsprm::pv, * - wcsprm::nps, * - wcsprm::ps, * - wcsprm::cd, * - wcsprm::crota, * - wcsprm::altlin. * * This signals the initialization routine, wcsset(), to recompute the * returned members of the celprm struct. celset() will reset flag to * indicate that this has been done. * * PLEASE NOTE: flag should be set to -1 when wcsini() is called for the * first time for a particular wcsprm struct in order to initialize memory * management. It must ONLY be used on the first initialization otherwise * memory leaks may result. * * int naxis * (Given or returned) Number of pixel and world coordinate elements. * * If wcsini() is used to initialize the linprm struct (as would normally * be the case) then it will set naxis from the value passed to it as a * function argument. The user should not subsequently modify it. * * double *crpix * (Given) Address of the first element of an array of double containing * the coordinate reference pixel, CRPIXja. * * double *pc * (Given) Address of the first element of the PCi_ja (pixel coordinate) * transformation matrix. The expected order is * = struct wcsprm wcs; = wcs.pc = {PC1_1, PC1_2, PC2_1, PC2_2}; * * This may be constructed conveniently from a 2-D array via * = double m[2][2] = {{PC1_1, PC1_2}, = {PC2_1, PC2_2}}; * * which is equivalent to * = double m[2][2]; = m[0][0] = PC1_1; = m[0][1] = PC1_2; = m[1][0] = PC2_1; = m[1][1] = PC2_2; * * The storage order for this 2-D array is the same as for the 1-D array, * whence * = wcs.pc = *m; * * would be legitimate. * * double *cdelt * (Given) Address of the first element of an array of double containing * the coordinate increments, CDELTia. * * double *crval * (Given) Address of the first element of an array of double containing * the coordinate reference values, CRVALia. * * char (*cunit)[72] * (Given) Address of the first element of an array of char[72] containing * the CUNITia keyvalues which define the units of measurement of the * CRVALia, CDELTia, and CDi_ja keywords. * * As CUNITia is an optional header keyword, cunit[][72] may be left blank * but otherwise is expected to contain a standard units specification as * defined by WCS Paper I. Utility function wcsutrn(), described in * wcsunits.h, is available to translate commonly used non-standard units * specifications but this must be done as a separate step before invoking * wcsset(). * * For celestial axes, if cunit[][72] is not blank, wcsset() uses * wcsunits() to parse it and scale cdelt[], crval[], and cd[][*] to * degrees. It then resets cunit[][72] to "deg". * * For spectral axes, if cunit[][72] is not blank, wcsset() uses wcsunits() * to parse it and scale cdelt[], crval[], and cd[][*] to SI units. It * then resets cunit[][72] accordingly. * * wcsset() ignores cunit[][72] for other coordinate types; cunit[][72] may * be used to label coordinate values. * * These variables accomodate the longest allowed string-valued FITS * keyword, being limited to 68 characters, plus the null-terminating * character. * * char (*ctype)[72] * (Given) Address of the first element of an array of char[72] containing * the coordinate axis types, CTYPEia. * * The ctype[][72] keyword values must be in upper case and there must be * zero or one pair of matched celestial axis types, and zero or one * spectral axis. The ctype[][72] strings should be padded with blanks on * the right and null-terminated so that they are at least eight characters * in length. * * These variables accomodate the longest allowed string-valued FITS * keyword, being limited to 68 characters, plus the null-terminating * character. * * double lonpole * (Given and returned) The native longitude of the celestial pole, phi_p, * given by LONPOLEa [deg] or by PVi_2a [deg] attached to the longitude * axis which takes precedence if defined, and ... * double latpole * (Given and returned) ... the native latitude of the celestial pole, * theta_p, given by LATPOLEa [deg] or by PVi_3a [deg] attached to the * longitude axis which takes precedence if defined. * * lonpole and latpole may be left to default to values set by wcsini() * (see celprm::ref), but in any case they will be reset by wcsset() to * the values actually used. Note therefore that if the wcsprm struct is * reused without resetting them, whether directly or via wcsini(), they * will no longer have their default values. * * double restfrq * (Given) The rest frequency [Hz], and/or ... * double restwav * (Given) ... the rest wavelength in vacuo [m], only one of which need be * given, the other should be set to zero. * * int npv * (Given) The number of entries in the wcsprm::pv[] array. * * int npvmax * (Given or returned) The length of the wcsprm::pv[] array. * * npvmax will be set by wcsini() if it allocates memory for wcsprm::pv[], * otherwise it must be set by the user. See also wcsnpv(). * * struct pvcard *pv * (Given or returned) Address of the first element of an array of length * npvmax of pvcard structs. Set by wcsini() if it allocates memory for * pv[], otherwise it must be set by the user. See also wcsnpv(). * * As a FITS header parser encounters each PVi_ma keyword it should load it * into a pvcard struct in the array and increment npv. wcsset() * interprets these as required. * * Note that, if they were not given, wcsset() resets the entries for * PVi_1a, PVi_2a, PVi_3a, and PVi_4a for longitude axis i to match * phi_0 and theta_0 (the native longitude and latitude of the reference * point), LONPOLEa and LATPOLEa respectively. * * int nps * (Given) The number of entries in the wcsprm::ps[] array. * * int npsmax * (Given or returned) The length of the wcsprm::ps[] array. * * npsmax will be set by wcsini() if it allocates memory for wcsprm::ps[], * otherwise it must be set by the user. See also wcsnps(). * * struct pscard *ps * (Given or returned) Address of the first element of an array of length * npsmax of pscard structs. Set by wcsini() if it allocates memory for * ps[], otherwise it must be set by the user. See also wcsnps(). * * As a FITS header parser encounters each PSi_ma keyword it should load it * into a pscard struct in the array and increment nps. wcsset() * interprets these as required (currently no PSi_ma keyvalues are * recognized). * * double *cd * (Given) For historical compatibility, the wcsprm struct supports two * alternate specifications of the linear transformation matrix, those * associated with the CDi_ja keywords, and ... * double *crota * (Given) ... those associated with the CROTAia keywords. Although these * may not formally co-exist with PCi_ja, the approach taken here is simply * to ignore them if given in conjunction with PCi_ja. * * int altlin * (Given) altlin is a bit flag that denotes which of the PCi_ja, CDi_ja * and CROTAia keywords are present in the header: * * - Bit 0: PCi_ja is present. * * - Bit 1: CDi_ja is present. * * Matrix elements in the IRAF convention are * equivalent to the product CDi_ja = CDELTia * PCi_ja, but the * defaults differ from that of the PCi_ja matrix. If one or more * CDi_ja keywords are present then all unspecified CDi_ja default to * zero. If no CDi_ja (or CROTAia) keywords are present, then the * header is assumed to be in PCi_ja form whether or not any PCi_ja * keywords are present since this results in an interpretation of * CDELTia consistent with the original FITS specification. * * While CDi_ja may not formally co-exist with PCi_ja, it may co-exist * with CDELTia and CROTAia which are to be ignored. * * - Bit 2: CROTAia is present. * * In the AIPS convention, CROTAia may only be * associated with the latitude axis of a celestial axis pair. It * specifies a rotation in the image plane that is applied AFTER the * CDELTia; any other CROTAia keywords are ignored. * * CROTAia may not formally co-exist with PCi_ja. * * CROTAia and CDELTia may formally co-exist with CDi_ja but if so are to * be ignored. * * CDi_ja and CROTAia keywords, if found, are to be stored in the * wcsprm::cd and wcsprm::crota arrays which are dimensioned similarly to * wcsprm::pc and wcsprm::cdelt. FITS * header parsers should use the following procedure: * * - Whenever a PCi_ja keyword is encountered: altlin |= 1; * * - Whenever a CDi_ja keyword is encountered: altlin |= 2; * * - Whenever a CROTAia keyword is encountered: altlin |= 4; * * If none of these bits are set the PCi_ja representation results, i.e. * wcsprm::pc and wcsprm::cdelt will be used as given. * * These alternate specifications of the linear transformation matrix are * translated immediately to PCi_ja by wcsset() and are invisible to the * lower-level WCSLIB routines. In particular, wcsset() resets * wcsprm::cdelt to unity if CDi_ja is present (and no PCi_ja). * * If CROTAia are present but none is associated with the latitude axis * (and no PCi_ja or CDi_ja), then wcsset() reverts to a unity PCi_ja * matrix. * * int velref * (Given) AIPS velocity code VELREF, refer to spcaips(). * * char alt[4] * (Given, auxiliary) Character code for alternate coordinate descriptions * (i.e. the 'a' in keyword names such as CTYPEia). This is blank for the * primary coordinate description, or one of the 26 upper-case letters, * A-Z. * * An array of four characters is provided for alignment purposes, only the * first is used. * * int colnum * (Given, auxiliary) Where the coordinate representation is associated * with an image-array column in a FITS binary table, this variable may be * used to record the relevant column number. * * It should be set to zero for an image header or pixel list. * * int *colax * (Given, auxiliary) Address of the first element of an array of int * recording the column numbers for each axis in a pixel list. * * The array elements should be set to zero for an image header or image * array in a binary table. * * char (*cname)[72] * (Given, auxiliary) The address of the first element of an array of * char[72] containing the coordinate axis names, CNAMEia. * * These variables accomodate the longest allowed string-valued FITS * keyword, being limited to 68 characters, plus the null-terminating * character. * * double *crder * (Given, auxiliary) Address of the first element of an array of double * recording the random error in the coordinate value, CRDERia. * double *csyer * (Given, auxiliary) Address of the first element of an array of double * recording the systematic error in the coordinate value, CSYERia. * * char dateavg[72] * (Given, auxiliary) The date of a representative mid-point of the * observation in ISO format, yyyy-mm-ddThh:mm:ss. * char dateobs[72] * (Given, auxiliary) The date of the start of the observation unless * otherwise explained in the comment field of the DATE-OBS keyword, in * ISO format, yyyy-mm-ddThh:mm:ss. * * double equinox * (Given, auxiliary) The equinox associated with dynamical equatorial or * ecliptic coordinate systems, EQUINOXa (or EPOCH in older headers). Not * applicable to ICRS equatorial or ecliptic coordinates. * * double mjdavg * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-AVG, * corresponding to DATE-AVG. * double mjdobs * (Given, auxiliary) Modified Julian Date (MJD = JD - 2400000.5), MJD-OBS, * corresponding to DATE-OBS. * * double obsgeo[3] * (Given, auxiliary) Location of the observer in a standard terrestrial * reference frame, OBSGEO-X, OBSGEO-Y, OBSGEO-Z [m]. * * char radesys[72] * (Given, auxiliary) The equatorial or ecliptic coordinate system type, * RADESYSa. * * char specsys[72] * (Given, auxiliary) Spectral reference frame (standard of rest), * SPECSYSa, and ... * char ssysobs[72] * (Given, auxiliary) ... the actual frame in which there is no * differential variation in the spectral coordinate across the * field-of-view, SSYSOBSa. * double velosys * (Given, auxiliary) The relative radial velocity [m/s] between the * observer and the selected standard of rest in the direction of the * celestial reference coordinate, VELOSYSa. * * double zsource * (Given, auxiliary) The redshift, ZSOURCEa, of the source, and ... * char ssyssrc[72] * (Given, auxiliary) ... the spectral reference frame (standard of rest) * in which this was measured, SSYSSRCa. * * double velangl * (Given, auxiliary) The angle [deg] that should be used to decompose an * observed velocity into radial and transverse components. * * char wcsname[72] * (Given, auxiliary) The name given to the coordinate representation, * WCSNAMEa. This variable accomodates the longest allowed string-valued * FITS keyword, being limited to 68 characters, plus the null-terminating * character. * * int ntab * (Given) See wcsprm::tab. * * int nwtb * (Given) See wcsprm::wtb. * * struct tabprm *tab * (Given) Address of the first element of an array of ntab tabprm structs * for which memory has been allocated. These are used to store tabular * transformation parameters. * * Although technically wcsprm::ntab and tab are "given", they will * normally be set by invoking wcstab(), whether directly or indirectly. * * The tabprm structs contain some members that must be supplied and others * that are derived. The information to be supplied comes primarily from * arrays stored in one or more FITS binary table extensions. These * arrays, referred to here as "wcstab arrays", are themselves located by * parameters stored in the FITS image header. * * struct wtbarr *wtb * (Given) Address of the first element of an array of nwtb wtbarr structs * for which memory has been allocated. These are used in extracting * wcstab arrays from a FITS binary table. * * Although technically wcsprm::nwtb and wtb are "given", they will * normally be set by invoking wcstab(), whether directly or indirectly. * * char lngtyp[8] * (Returned) Four-character WCS celestial longitude and ... * char lattyp[8] * (Returned) ... latitude axis types. e.g. "RA", "DEC", "GLON", "GLAT", * etc. extracted from 'RA--', 'DEC-', 'GLON', 'GLAT', etc. in the first * four characters of CTYPEia but with trailing dashes removed. (Declared * as char[8] for alignment reasons.) * * int lng * (Returned) Index for the longitude coordinate, and ... * int lat * (Returned) ... index for the latitude coordinate, and ... * int spec * (Returned) ... index for the spectral coordinate in the imgcrd[][] and * world[][] arrays in the API of wcsp2s(), wcss2p() and wcsmix(). * * These may also serve as indices into the pixcrd[][] array provided that * the PCi_ja matrix does not transpose axes. * * int cubeface * (Returned) Index into the pixcrd[][] array for the CUBEFACE axis. This * is used for quadcube projections where the cube faces are stored on a * separate axis (see wcs.h). * * int *types * (Returned) Address of the first element of an array of int containing a * four-digit type code for each axis. * * - First digit (i.e. 1000s): * - 0: Non-specific coordinate type. * - 1: Stokes coordinate. * - 2: Celestial coordinate (including CUBEFACE). * - 3: Spectral coordinate. * * - Second digit (i.e. 100s): * - 0: Linear axis. * - 1: Quantized axis (STOKES, CUBEFACE). * - 2: Non-linear celestial axis. * - 3: Non-linear spectral axis. * - 4: Logarithmic axis. * - 5: Tabular axis. * * - Third digit (i.e. 10s): * - 0: Group number, e.g. lookup table number, being an index into the * tabprm array (see above). * * - The fourth digit is used as a qualifier depending on the axis type. * * - For celestial axes: * - 0: Longitude coordinate. * - 1: Latitude coordinate. * - 2: CUBEFACE number. * * - For lookup tables: the axis number in a multidimensional table. * * CTYPEia in "4-3" form with unrecognized algorithm code will have its * type set to -1 and generate an error. * * void *padding * (An unused variable inserted for alignment purposes only.) * * struct linprm lin * (Returned) Linear transformation parameters (usage is described in the * prologue to lin.h). * * struct celprm cel * (Returned) Celestial transformation parameters (usage is described in * the prologue to cel.h). * * struct spcprm spc * (Returned) Spectral transformation parameters (usage is described in the * prologue to spc.h). * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * void *m_padding * (For internal use only.) * int m_flag * (For internal use only.) * int m_naxis * (For internal use only.) * double *m_crpix * (For internal use only.) * double *m_pc * (For internal use only.) * double *m_cdelt * (For internal use only.) * double *m_crval * (For internal use only.) * char (*m_cunit)[72] * (For internal use only.) * char (*m_ctype)[72] * (For internal use only.) * struct pvcard *m_pv * (For internal use only.) * struct pscard *m_ps * (For internal use only.) * double *m_cd * (For internal use only.) * double *m_crota * (For internal use only.) * int *m_colax * (For internal use only.) * char (*m_cname)[72] * (For internal use only.) * double *m_crder * (For internal use only.) * double *m_csyer * (For internal use only.) * struct tabprm *m_tab * (For internal use only.) * struct wtbarr *m_wtb * (For internal use only.) * * * pscard struct - Store for PSi_ma keyrecords * ------------------------------------------- * The pscard struct is used to pass the parsed contents of PSi_ma keyrecords * to wcsset() via the wcsprm struct. * * All members of this struct are to be set by the user. * * int i * (Given) Axis number (1-relative), as in the FITS PSi_ma keyword. * * int m * (Given) Parameter number (non-negative), as in the FITS PSi_ma keyword. * * char value[72] * (Given) Parameter value. * * * pvcard struct - Store for PVi_ma keyrecords * ------------------------------------------- * The pvcard struct is used to pass the parsed contents of PVi_ma keyrecords * to wcsset() via the wcsprm struct. * * All members of this struct are to be set by the user. * * int i * (Given) Axis number (1-relative), as in the FITS PVi_ma keyword. If * i == 0, wcsset() will replace it with the latitude axis number. * * int m * (Given) Parameter number (non-negative), as in the FITS PVi_ma keyword. * * double value * (Given) Parameter value. * * * wtbarr struct - Extraction of coordinate lookup tables from BINTABLE * -------------------------------------------------------------------- * Function wcstab(), which is invoked automatically by wcspih(), sets up an * array of wtbarr structs to assist in extracting coordinate lookup tables * from a binary table extension (BINTABLE) and copying them into the tabprm * structs stored in wcsprm. Refer to the usage notes for wcspih() and * wcstab() in wcshdr.h, and also the prologue to tab.h. * * For C++ usage, because of a name space conflict with the wtbarr typedef * defined in CFITSIO header fitsio.h, the wtbarr struct is renamed to wtbarr_s * by preprocessor macro substitution with scope limited to wcs.h itself. * * int i * (Given) Image axis number. * * int m * (Given) wcstab array axis number for index vectors. * * int kind * (Given) Character identifying the wcstab array type: * - c: coordinate array, * - i: index vector. * * char extnam[72] * (Given) EXTNAME identifying the binary table extension. * * int extver * (Given) EXTVER identifying the binary table extension. * * int extlev * (Given) EXTLEV identifying the binary table extension. * * char ttype[72] * (Given) TTYPEn identifying the column of the binary table that contains * the wcstab array. * * long row * (Given) Table row number. * * int ndim * (Given) Expected dimensionality of the wcstab array. * * int *dimlen * (Given) Address of the first element of an array of int of length ndim * into which the wcstab array axis lengths are to be written. * * double **arrayp * (Given) Pointer to an array of double which is to be allocated by the * user and into which the wcstab array is to be written. * * * Global variable: const char *wcs_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_WCS #define WCSLIB_WCS #include "lin.h" #include "cel.h" #include "spc.h" #include "tab.h" #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif #define WCSSUB_LONGITUDE 0x1001 #define WCSSUB_LATITUDE 0x1002 #define WCSSUB_CUBEFACE 0x1004 #define WCSSUB_CELESTIAL 0x1007 #define WCSSUB_SPECTRAL 0x1008 #define WCSSUB_STOKES 0x1010 extern const char *wcs_errmsg[]; enum wcs_errmsg_enum { WCSERR_SUCCESS = 0, /* Success. */ WCSERR_NULL_POINTER = 1, /* Null wcsprm pointer passed. */ WCSERR_MEMORY = 2, /* Memory allocation failed. */ WCSERR_SINGULAR_MTX = 3, /* Linear transformation matrix is singular. */ WCSERR_BAD_CTYPE = 4, /* Inconsistent or unrecognized coordinate axis types. */ WCSERR_BAD_PARAM = 5, /* Invalid parameter value. */ WCSERR_BAD_COORD_TRANS = 6, /* Invalid coordinate transformation parameters. */ WCSERR_ILL_COORD_TRANS = 7, /* Ill-conditioned coordinate transformation parameters. */ WCSERR_BAD_PIX = 8, /* One or more of the pixel coordinates were invalid. */ WCSERR_BAD_WORLD = 9, /* One or more of the world coordinates were invalid. */ WCSERR_BAD_WORLD_COORD = 10, /* Invalid world coordinate. */ WCSERR_NO_SOLUTION = 11, /* No solution found in the specified interval. */ WCSERR_BAD_SUBIMAGE = 12, /* Invalid subimage specification. */ WCSERR_NON_SEPARABLE = 13 /* Non-separable subimage coordinate system. */ }; /* Struct used for storing PVi_ma keywords. */ struct pvcard { int i; /* Axis number, as in PVi_ma (1-relative). */ int m; /* Parameter number, ditto (0-relative). */ double value; /* Parameter value. */ }; /* Struct used for storing PSi_ma keywords. */ struct pscard { int i; /* Axis number, as in PSi_ma (1-relative). */ int m; /* Parameter number, ditto (0-relative). */ char value[72]; /* Parameter value. */ }; /* For extracting wcstab arrays. Matches */ /* the wtbarr typedef defined in CFITSIO */ /* header fitsio.h. */ #ifdef __cplusplus #define wtbarr wtbarr_s /* See prologue above. */ #endif struct wtbarr { int i; /* Image axis number. */ int m; /* Array axis number for index vectors. */ int kind; /* wcstab array type. */ char extnam[72]; /* EXTNAME of binary table extension. */ int extver; /* EXTVER of binary table extension. */ int extlev; /* EXTLEV of binary table extension. */ char ttype[72]; /* TTYPEn of column containing the array. */ long row; /* Table row number. */ int ndim; /* Expected wcstab array dimensionality. */ int *dimlen; /* Where to write the array axis lengths. */ double **arrayp; /* Where to write the address of the array */ /* allocated to store the wcstab array. */ }; struct wcsprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* FITS header keyvalues to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ int naxis; /* Number of axes (pixel and coordinate). */ double *crpix; /* CRPIXja keyvalues for each pixel axis. */ double *pc; /* PCi_ja linear transformation matrix. */ double *cdelt; /* CDELTia keyvalues for each coord axis. */ double *crval; /* CRVALia keyvalues for each coord axis. */ char (*cunit)[72]; /* CUNITia keyvalues for each coord axis. */ char (*ctype)[72]; /* CTYPEia keyvalues for each coord axis. */ double lonpole; /* LONPOLEa keyvalue. */ double latpole; /* LATPOLEa keyvalue. */ double restfrq; /* RESTFRQa keyvalue. */ double restwav; /* RESTWAVa keyvalue. */ int npv; /* Number of PVi_ma keywords, and the */ int npvmax; /* number for which space was allocated. */ struct pvcard *pv; /* PVi_ma keywords for each i and m. */ int nps; /* Number of PSi_ma keywords, and the */ int npsmax; /* number for which space was allocated. */ struct pscard *ps; /* PSi_ma keywords for each i and m. */ /* Alternative header keyvalues (see the prologue above). */ /*------------------------------------------------------------------------*/ double *cd; /* CDi_ja linear transformation matrix. */ double *crota; /* CROTAia keyvalues for each coord axis. */ int altlin; /* Alternative representations */ /* Bit 0: PCi_ja is present, */ /* Bit 1: CDi_ja is present, */ /* Bit 2: CROTAia is present. */ int velref; /* AIPS velocity code, VELREF. */ /* Auxiliary coordinate system information, not used by WCSLIB. */ char alt[4]; int colnum; int *colax; char (*cname)[72]; double *crder; double *csyer; char dateavg[72]; char dateobs[72]; double equinox; double mjdavg; double mjdobs; double obsgeo[3]; char radesys[72]; char specsys[72]; char ssysobs[72]; double velosys; double zsource; char ssyssrc[72]; double velangl; char wcsname[72]; /* Coordinate lookup tables (see the prologue above). */ /*------------------------------------------------------------------------*/ int ntab; /* Number of separate tables. */ int nwtb; /* Number of wtbarr structs. */ struct tabprm *tab; /* Tabular transformation parameters. */ struct wtbarr *wtb; /* Array of wtbarr structs. */ /* Information derived from the FITS header keyvalues by wcsset(). */ /*------------------------------------------------------------------------*/ char lngtyp[8], lattyp[8]; /* Celestial axis types, e.g. RA, DEC. */ int lng, lat, spec; /* Longitude, latitude and spectral axis */ /* indices (0-relative). */ int cubeface; /* True if there is a CUBEFACE axis. */ int *types; /* Coordinate type codes for each axis. */ void *padding; /* (Dummy inserted for alignment purposes.) */ struct linprm lin; /* Linear transformation parameters. */ struct celprm cel; /* Celestial transformation parameters. */ struct spcprm spc; /* Spectral transformation parameters. */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private - the remainder are for memory management. */ /*------------------------------------------------------------------------*/ void *m_padding; int m_flag, m_naxis; double *m_crpix, *m_pc, *m_cdelt, *m_crval; char (*m_cunit)[72], (*m_ctype)[72]; struct pvcard *m_pv; struct pscard *m_ps; double *m_cd, *m_crota; int *m_colax; char (*m_cname)[72]; double *m_crder, *m_csyer; struct tabprm *m_tab; struct wtbarr *m_wtb; }; /* Size of the wcsprm struct in int units, used by the Fortran wrappers. */ #define WCSLEN (sizeof(struct wcsprm)/sizeof(int)) int wcsnpv(int n); int wcsnps(int n); int wcsini(int alloc, int naxis, struct wcsprm *wcs); int wcssub(int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[], struct wcsprm *wcsdst); int wcsfree(struct wcsprm *wcs); int wcsprt(const struct wcsprm *wcs); int wcsperr(const struct wcsprm *wcs, const char *prefix); int wcsset(struct wcsprm *wcs); int wcsp2s(struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[], double imgcrd[], double phi[], double theta[], double world[], int stat[]); int wcss2p(struct wcsprm *wcs, int ncoord, int nelem, const double world[], double phi[], double theta[], double imgcrd[], double pixcrd[], int stat[]); int wcsmix(struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[], double vstep, int viter, double world[], double phi[], double theta[], double imgcrd[], double pixcrd[]); int wcssptr(struct wcsprm *wcs, int *i, char ctype[9]); /* Defined mainly for backwards compatibility, use wcssub() instead. */ #define wcscopy(alloc, wcssrc, wcsdst) wcssub(alloc, wcssrc, 0x0, 0x0, wcsdst) /* Deprecated. */ #define wcsini_errmsg wcs_errmsg #define wcssub_errmsg wcs_errmsg #define wcscopy_errmsg wcs_errmsg #define wcsfree_errmsg wcs_errmsg #define wcsprt_errmsg wcs_errmsg #define wcsset_errmsg wcs_errmsg #define wcsp2s_errmsg wcs_errmsg #define wcss2p_errmsg wcs_errmsg #define wcsmix_errmsg wcs_errmsg #ifdef __cplusplus #undef wtbarr } #endif #endif /* WCSLIB_WCS */ astropy-0.3/cextern/wcslib/C/wcslib.h0000644000175000017500000000360712243255342015756 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcslib.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. * * Summary of wcslib.h * ------------------- * This header file is provided purely for convenience. Use it to include all * of the separate WCSLIB headers. * *===========================================================================*/ #ifndef WCSLIB_WCSLIB #define WCSLIB_WCSLIB #include "cel.h" #include "fitshdr.h" #include "lin.h" #include "log.h" #include "prj.h" #include "spc.h" #include "sph.h" #include "spx.h" #include "tab.h" #include "wcs.h" #include "wcserr.h" #include "wcsfix.h" #include "wcshdr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcstrig.h" #include "wcsunits.h" #include "wcsutil.h" #endif /* WCSLIB_WCSLIB */ astropy-0.3/cextern/wcslib/C/wcserr.h0000644000175000017500000002151012243255342015771 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcserr.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * Summary of the wcserr routines * ------------------------------ * Most of the structs in WCSLIB contain a pointer to a wcserr struct as a * member. Functions in WCSLIB that return an error status code can also * allocate and set a detailed error message in this struct which also * identifies the function, source file, and line number where the error * occurred. * * For example: * = struct prjprm prj; = wcserr_enable(1); = if (prjini(&prj)) { = // Print the error message to stderr. = wcsprintf_set(stderr); = wcserr_prt(prj.err, 0x0); = } * * A number of utility functions used in managing the wcserr struct are for * internal use only. They are documented here solely as an aid to * understanding the code. They are not intended for external use - the API * may change without notice! * * * wcserr struct - Error message handling * -------------------------------------- * The wcserr struct contains the numeric error code, a textual description of * the error, and information about the function, source file, and line number * where the error was generated. * * int status * Numeric status code associated with the error, the meaning of which * depends on the function that generated it. See the documentation for * the particular function. * * int line_no * Line number where the error occurred as given by the __LINE__ * preprocessor macro. * * const char *function * Name of the function where the error occurred. * * const char *file * Name of the source file where the error occurred as given by the * __FILE__ preprocessor macro. * * char msg[WCSERR_MSG_LENGTH] * Informative error message. * * * wcserr_enable() - Enable/disable error messaging * ------------------------------------------------ * wcserr_enable() enables or disables wcserr error messaging. By default it * is disabled. * * PLEASE NOTE: This function is not thread-safe. * * Given: * enable int If true (non-zero), enable error messaging, else * disable it. * * Function return value: * int Status return value: * 0: Error messaging is disabled. * 1: Error messaging is enabled. * * * wcserr_prt() - Print a wcserr struct * ------------------------------------ * wcserr_prt() prints the error message (if any) contained in a wcserr struct. * It uses the wcsprintf() functions. * * Given: * err const struct wcserr* * The error object. If NULL, nothing is printed. * * prefix const char * * If non-NULL, each output line will be prefixed with * this string. * * Function return value: * int Status return value: * 0: Success. * 2: Error messaging is not enabled. * * * wcserr_clear() - Clear a wcserr struct * -------------------------------------- * wcserr_clear() clears the error (if any) contained in a wcserr struct. * * Given and returned: * err struct wcserr** * The error object. If NULL, nothing is done. Set to * NULL on return. * * Function return value: * int Status return value: * 0: Success. * * * wcserr_set() - Fill in the contents of an error object * ------------------------------------------------------ * INTERNAL USE ONLY. * * wcserr_set() fills a wcserr struct with information about an error. * * A convenience macro, WCSERR_SET, provides the source file and line number * information automatically. * * Given and returned: * err struct wcserr** * Error object. * * If err is NULL, returns the status code given without * setting an error message. * * If *err is NULL, allocates memory for a wcserr struct * (provided that status is non-zero). * * Given: * status int Numeric status code to set. If 0, then *err will be * deleted and *err will be returned as NULL. * * function const char * * Name of the function generating the error. This * must point to a constant string, i.e. in the * initialized read-only data section ("data") of the * executable. * * file const char * * Name of the source file generating the error. This * must point to a constant string, i.e. in the * initialized read-only data section ("data") of the * executable such as given by the __FILE__ preprocessor * macro. * * line_no int Line number in the source file generating the error * such as given by the __LINE__ preprocessor macro. * * format const char * * Format string of the error message. May contain * printf-style %-formatting codes. * * ... mixed The remaining variable arguments are applied (like * printf) to the format string to generate the error * message. * * Function return value: * int The status return code passed in. * * * wcserr_copy() - Copy an error object * ------------------------------------ * INTERNAL USE ONLY. * * wcserr_copy() copies one error object to another. Use of this function * should be avoided in general since the function, source file, and line * number information copied to the destination may lose its context. * * Given: * src const struct wcserr* * Source error object. If src is NULL, dst is cleared. * * Returned: * dst struct wcserr* * Destination error object. If NULL, no copy is made. * * Function return value: * int Numeric status code of the source error object. * * * WCSERR_SET() macro - Fill in the contents of an error object * ------------------------------------------------------------ * INTERNAL USE ONLY. * * WCSERR_SET() is a preprocessor macro that helps to fill in the argument list * of wcserr_set(). It takes status as an argument of its own and provides the * name of the source file and the line number at the point where invoked. It * assumes that the err and function arguments of wcserr_set() will be provided * by variables of the same names. * *===========================================================================*/ #ifndef WCSLIB_WCSERR #define WCSLIB_WCSERR #ifdef __cplusplus extern "C" { #endif #define WCSERR_MSG_LENGTH 160 struct wcserr { int status; /* Status code for the error. */ int line_no; /* Line number where the error occurred. */ const char *function; /* Function name. */ const char *file; /* Source file name. */ char msg[WCSERR_MSG_LENGTH]; /* Informative error message. */ }; /* Size of the wcserr struct in int units, used by the Fortran wrappers. */ #define ERRLEN (sizeof(struct wcserr)/sizeof(int)) int wcserr_enable(int enable); int wcserr_prt(const struct wcserr *err, const char *prefix); int wcserr_clear(struct wcserr **err); /* INTERNAL USE ONLY -------------------------------------------------------*/ int wcserr_set(struct wcserr **err, int status, const char *function, const char *file, int line_no, const char *format, ...); int wcserr_copy(const struct wcserr *src, struct wcserr *dst); /* Convenience macro for invoking wcserr_set(). */ #define WCSERR_SET(status) err, status, function, __FILE__, __LINE__ #ifdef __cplusplus } #endif #endif /* WSCLIB_WCSERR */ astropy-0.3/cextern/wcslib/C/spc.h0000644000175000017500000011257012243255342015260 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: spc.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the spectral coordinate systems * recognized by the FITS World Coordinate System (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the spc routines * --------------------------- * These routines implement the part of the FITS WCS standard that deals with * spectral coordinates. They define methods to be used for computing spectral * world coordinates from intermediate world coordinates (a linear * transformation of image pixel coordinates), and vice versa. They are based * on the spcprm struct which contains all information needed for the * computations. The struct contains some members that must be set by the * user, and others that are maintained by these routines, somewhat like a * C++ class but with no encapsulation. * * Routine spcini() is provided to initialize the spcprm struct with default * values, spcfree() reclaims any memory that may have been allocated to store * an error message, and spcprt() prints its contents. * * A setup routine, spcset(), computes intermediate values in the spcprm struct * from parameters in it that were supplied by the user. The struct always * needs to be set up by spcset() but it need not be called explicitly - refer * to the explanation of spcprm::flag. * * spcx2s() and spcs2x() implement the WCS spectral coordinate transformations. * In fact, they are high level driver routines for the lower level spectral * coordinate transformation routines described in spx.h. * * A number of routines are provided to aid in analysing or synthesising sets * of FITS spectral axis keywords: * * - spctype() checks a spectral CTYPEia keyword for validity and returns * information derived from it. * * - Spectral keyword analysis routine spcspxe() computes the values of the * X-type spectral variables for the S-type variables supplied. * * - Spectral keyword synthesis routine, spcxpse(), computes the S-type * variables for the X-types supplied. * * - Given a set of spectral keywords, a translation routine, spctrne(), * produces the corresponding set for the specified spectral CTYPEia. * * - spcaips() translates AIPS-convention spectral CTYPEia and VELREF * keyvalues. * * Spectral variable types - S, P, and X: * -------------------------------------- * A few words of explanation are necessary regarding spectral variable types * in FITS. * * Every FITS spectral axis has three associated spectral variables: * * S-type: the spectral variable in which coordinates are to be * expressed. Each S-type is encoded as four characters and is * linearly related to one of four basic types as follows: * * F: frequency * 'FREQ': frequency * 'AFRQ': angular frequency * 'ENER': photon energy * 'WAVN': wave number * 'VRAD': radio velocity * * W: wavelength in vacuo * 'WAVE': wavelength * 'VOPT': optical velocity * 'ZOPT': redshift * * A: wavelength in air * 'AWAV': wavelength in air * * V: velocity * 'VELO': relativistic velocity * 'BETA': relativistic beta factor * * The S-type forms the first four characters of the CTYPEia keyvalue, * and CRVALia and CDELTia are expressed as S-type quantities so that * they provide a first-order approximation to the S-type variable at * the reference point. * * Note that 'AFRQ', angular frequency, is additional to the variables * defined in WCS Paper III. * * P-type: the basic spectral variable (F, W, A, or V) with which the * S-type variable is associated (see list above). * * For non-grism axes, the P-type is encoded as the eighth character of * CTYPEia. * * X-type: the basic spectral variable (F, W, A, or V) for which the * spectral axis is linear, grisms excluded (see below). * * For non-grism axes, the X-type is encoded as the sixth character of * CTYPEia. * * Grisms: Grism axes have normal S-, and P-types but the axis is linear, * not in any spectral variable, but in a special "grism parameter". * The X-type spectral variable is either W or A for grisms in vacuo or * air respectively, but is encoded as 'w' or 'a' to indicate that an * additional transformation is required to convert to or from the * grism parameter. The spectral algorithm code for grisms also has a * special encoding in CTYPEia, either 'GRI' (in vacuo) or 'GRA' (in air). * * In the algorithm chain, the non-linear transformation occurs between the * X-type and the P-type variables; the transformation between P-type and * S-type variables is always linear. * * When the P-type and X-type variables are the same, the spectral axis is * linear in the S-type variable and the second four characters of CTYPEia * are blank. This can never happen for grism axes. * * As an example, correlating radio spectrometers always produce spectra that * are regularly gridded in frequency; a redshift scale on such a spectrum is * non-linear. The required value of CTYPEia would be 'ZOPT-F2W', where the * desired S-type is 'ZOPT' (redshift), the P-type is necessarily 'W' * (wavelength), and the X-type is 'F' (frequency) by the nature of the * instrument. * * Argument checking: * ------------------ * The input spectral values are only checked for values that would result in * floating point exceptions. In particular, negative frequencies and * wavelengths are allowed, as are velocities greater than the speed of * light. The same is true for the spectral parameters - rest frequency and * wavelength. * * Accuracy: * --------- * No warranty is given for the accuracy of these routines (refer to the * copyright notice); intending users must satisfy for themselves their * adequacy for the intended purpose. However, closure effectively to within * double precision rounding error was demonstrated by test routine tspc.c * which accompanies this software. * * * spcini() - Default constructor for the spcprm struct * ---------------------------------------------------- * spcini() sets all members of a spcprm struct to default values. It should * be used to initialize every spcprm struct. * * Given and returned: * spc struct spcprm* * Spectral transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * * * spcfree() - Destructor for the spcprm struct * -------------------------------------------- * spcfree() frees any memory that may have been allocated to store an error * message in the spcprm struct. * * Given: * spc struct spcprm* * Spectral transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * * * spcprt() - Print routine for the spcprm struct * ---------------------------------------------- * spcprt() prints the contents of a spcprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * spc const struct spcprm* * Spectral transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * * * spcset() - Setup routine for the spcprm struct * ---------------------------------------------- * spcset() sets up a spcprm struct according to information supplied within * it. * * Note that this routine need not be called directly; it will be invoked by * spcx2s() and spcs2x() if spcprm::flag is anything other than a predefined * magic value. * * Given and returned: * spc struct spcprm* * Spectral transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * 2: Invalid spectral parameters. * * For returns > 1, a detailed error message is set in * spcprm::err if enabled, see wcserr_enable(). * * * spcx2s() - Transform to spectral coordinates * -------------------------------------------- * spcx2s() transforms intermediate world coordinates to spectral coordinates. * * Given and returned: * spc struct spcprm* * Spectral transformation parameters. * * Given: * nx int Vector length. * * sx int Vector stride. * * sspec int Vector stride. * * x const double[] * Intermediate world coordinates, in SI units. * * Returned: * spec double[] Spectral coordinates, in SI units. * * stat int[] Status return value status for each vector element: * 0: Success. * 1: Invalid value of x. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * 2: Invalid spectral parameters. * 3: One or more of the x coordinates were invalid, * as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * spcprm::err if enabled, see wcserr_enable(). * * * spcs2x() - Transform spectral coordinates * ----------------------------------------- * spcs2x() transforms spectral world coordinates to intermediate world * coordinates. * * Given and returned: * spc struct spcprm* * Spectral transformation parameters. * * Given: * nspec int Vector length. * * sspec int Vector stride. * * sx int Vector stride. * * spec const double[] * Spectral coordinates, in SI units. * * Returned: * x double[] Intermediate world coordinates, in SI units. * * stat int[] Status return value status for each vector element: * 0: Success. * 1: Invalid value of spec. * * Function return value: * int Status return value: * 0: Success. * 1: Null spcprm pointer passed. * 2: Invalid spectral parameters. * 4: One or more of the spec coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * spcprm::err if enabled, see wcserr_enable(). * * * spctype() - Spectral CTYPEia keyword analysis * --------------------------------------------- * spctype() checks whether a CTYPEia keyvalue is a valid spectral axis type * and if so returns information derived from it relating to the associated S-, * P-, and X-type spectral variables (see explanation above). * * The return arguments are guaranteed not be modified if CTYPEia is not a * valid spectral type; zero-pointers may be specified for any that are not of * interest. * * A deprecated form of this function, spctyp(), lacks the wcserr** parameter. * * Given: * ctype const char[9] * The CTYPEia keyvalue, (eight characters with null * termination). * * Returned: * stype char[] The four-letter name of the S-type spectral variable * copied or translated from ctype. If a non-zero * pointer is given, the array must accomodate a null- * terminated string of length 5. * * scode char[] The three-letter spectral algorithm code copied or * translated from ctype. Logarithmic ('LOG') and * tabular ('TAB') codes are also recognized. If a * non-zero pointer is given, the array must accomodate a * null-terminated string of length 4. * * sname char[] Descriptive name of the S-type spectral variable. * If a non-zero pointer is given, the array must * accomodate a null-terminated string of length 22. * * units char[] SI units of the S-type spectral variable. If a * non-zero pointer is given, the array must accomodate a * null-terminated string of length 8. * * ptype char* Character code for the P-type spectral variable * derived from ctype, one of 'F', 'W', 'A', or 'V'. * * xtype char* Character code for the X-type spectral variable * derived from ctype, one of 'F', 'W', 'A', or 'V'. * Also, 'w' and 'a' are synonymous to 'W' and 'A' for * grisms in vacuo and air respectively. Set to 'L' or * 'T' for logarithmic ('LOG') and tabular ('TAB') axes. * * restreq int* Multivalued flag that indicates whether rest * frequency or wavelength is required to compute * spectral variables for this CTYPEia: * 0: Not required. * 1: Required for the conversion between S- and * P-types (e.g. 'ZOPT-F2W'). * 2: Required for the conversion between P- and * X-types (e.g. 'BETA-W2V'). * 3: Required for the conversion between S- and * P-types, and between P- and X-types, but not * between S- and X-types (this applies only for * 'VRAD-V2F', 'VOPT-V2W', and 'ZOPT-V2W'). * Thus the rest frequency or wavelength is required for * spectral coordinate computations (i.e. between S- and * X-types) only if restreq%3 != 0. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters (not a spectral * CTYPEia). * * * spcspxe() - Spectral keyword analysis * ------------------------------------ * spcspxe() analyses the CTYPEia and CRVALia FITS spectral axis keyword values * and returns information about the associated X-type spectral variable. * * A deprecated form of this function, spcspx(), lacks the wcserr** parameter. * * Given: * ctypeS const char[9] * Spectral axis type, i.e. the CTYPEia keyvalue, (eight * characters with null termination). For non-grism * axes, the character code for the P-type spectral * variable in the algorithm code (i.e. the eighth * character of CTYPEia) may be set to '?' (it will not * be reset). * * crvalS double Value of the S-type spectral variable at the reference * point, i.e. the CRVALia keyvalue, SI units. * * restfrq, * restwav double Rest frequency [Hz] and rest wavelength in vacuo [m], * only one of which need be given, the other should be * set to zero. * * Returned: * ptype char* Character code for the P-type spectral variable * derived from ctypeS, one of 'F', 'W', 'A', or 'V'. * * xtype char* Character code for the X-type spectral variable * derived from ctypeS, one of 'F', 'W', 'A', or 'V'. * Also, 'w' and 'a' are synonymous to 'W' and 'A' for * grisms in vacuo and air respectively; crvalX and dXdS * (see below) will conform to these. * * restreq int* Multivalued flag that indicates whether rest frequency * or wavelength is required to compute spectral * variables for this CTYPEia, as for spctype(). * * crvalX double* Value of the X-type spectral variable at the reference * point, SI units. * * dXdS double* The derivative, dX/dS, evaluated at the reference * point, SI units. Multiply the CDELTia keyvalue by * this to get the pixel spacing in the X-type spectral * coordinate. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * * * spcxpse() - Spectral keyword synthesis * ------------------------------------- * spcxpse(), for the spectral axis type specified and the value provided for * the X-type spectral variable at the reference point, deduces the value of * the FITS spectral axis keyword CRVALia and also the derivative dS/dX which * may be used to compute CDELTia. See above for an explanation of the S-, * P-, and X-type spectral variables. * * A deprecated form of this function, spcxps(), lacks the wcserr** parameter. * * Given: * ctypeS const char[9] * The required spectral axis type, i.e. the CTYPEia * keyvalue, (eight characters with null termination). * For non-grism axes, the character code for the P-type * spectral variable in the algorithm code (i.e. the * eighth character of CTYPEia) may be set to '?' (it * will not be reset). * * crvalX double Value of the X-type spectral variable at the reference * point (N.B. NOT the CRVALia keyvalue), SI units. * * restfrq, * restwav double Rest frequency [Hz] and rest wavelength in vacuo [m], * only one of which need be given, the other should be * set to zero. * * Returned: * ptype char* Character code for the P-type spectral variable * derived from ctypeS, one of 'F', 'W', 'A', or 'V'. * * xtype char* Character code for the X-type spectral variable * derived from ctypeS, one of 'F', 'W', 'A', or 'V'. * Also, 'w' and 'a' are synonymous to 'W' and 'A' for * grisms; crvalX and cdeltX must conform to these. * * restreq int* Multivalued flag that indicates whether rest frequency * or wavelength is required to compute spectral * variables for this CTYPEia, as for spctype(). * * crvalS double* Value of the S-type spectral variable at the reference * point (i.e. the appropriate CRVALia keyvalue), SI * units. * * dSdX double* The derivative, dS/dX, evaluated at the reference * point, SI units. Multiply this by the pixel spacing * in the X-type spectral coordinate to get the CDELTia * keyvalue. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * * * spctrne() - Spectral keyword translation * --------------------------------------- * spctrne() translates a set of FITS spectral axis keywords into the * corresponding set for the specified spectral axis type. For example, a * 'FREQ' axis may be translated into 'ZOPT-F2W' and vice versa. * * A deprecated form of this function, spctrn(), lacks the wcserr** parameter. * * Given: * ctypeS1 const char[9] * Spectral axis type, i.e. the CTYPEia keyvalue, (eight * characters with null termination). For non-grism * axes, the character code for the P-type spectral * variable in the algorithm code (i.e. the eighth * character of CTYPEia) may be set to '?' (it will not * be reset). * * crvalS1 double Value of the S-type spectral variable at the reference * point, i.e. the CRVALia keyvalue, SI units. * * cdeltS1 double Increment of the S-type spectral variable at the * reference point, SI units. * * restfrq, * restwav double Rest frequency [Hz] and rest wavelength in vacuo [m], * only one of which need be given, the other should be * set to zero. Neither are required if the translation * is between wave-characteristic types, or between * velocity-characteristic types. E.g., required for * 'FREQ' -> 'ZOPT-F2W', but not required for * 'VELO-F2V' -> 'ZOPT-F2W'. * * Given and returned: * ctypeS2 char[9] Required spectral axis type (eight characters with * null termination). The first four characters are * required to be given and are never modified. The * remaining four, the algorithm code, are completely * determined by, and must be consistent with, ctypeS1 * and the first four characters of ctypeS2. A non-zero * status value will be returned if they are inconsistent * (see below). However, if the final three characters * are specified as "???", or if just the eighth * character is specified as '?', the correct algorithm * code will be substituted (applies for grism axes as * well as non-grism). * * Returned: * crvalS2 double* Value of the new S-type spectral variable at the * reference point, i.e. the new CRVALia keyvalue, SI * units. * * cdeltS2 double* Increment of the new S-type spectral variable at the * reference point, i.e. the new CDELTia keyvalue, SI * units. * * err struct wcserr ** * If enabled, for function return values > 1, this * struct will contain a detailed error message, see * wcserr_enable(). May be NULL if an error message is * not desired. Otherwise, the user is responsible for * deleting the memory allocated for the wcserr struct. * * Function return value: * int Status return value: * 0: Success. * 2: Invalid spectral parameters. * * A status value of 2 will be returned if restfrq or * restwav are not specified when required, or if ctypeS1 * or ctypeS2 are self-inconsistent, or have different * spectral X-type variables. * * * spcaips() - Translate AIPS-convention spectral keywords * ------------------------------------------------------- * spcaips() translates AIPS-convention spectral CTYPEia and VELREF keyvalues. * * Given: * ctypeA const char[9] * CTYPEia keyvalue possibly containing an * AIPS-convention spectral code (eight characters, need * not be null-terminated). * * velref int AIPS-convention VELREF code. It has the following * integer values: * 1: LSR kinematic, originally described simply as * "LSR" without distinction between the kinematic * and dynamic definitions. * 2: Barycentric, originally described as "HEL" * meaning heliocentric. * 3: Topocentric, originally described as "OBS" * meaning geocentric but widely interpreted as * topocentric. * AIPS++ extensions to VELREF are also recognized: * 4: LSR dynamic. * 5: Geocentric. * 6: Source rest frame. * 7: Galactocentric. * * For an AIPS 'VELO' axis, a radio convention velocity * (VRAD) is denoted by adding 256 to VELREF, otherwise * an optical velocity (VOPT) is indicated (this is not * applicable to 'FREQ' or 'FELO' axes). Setting velref * to 0 or 256 chooses between optical and radio velocity * without specifying a Doppler frame, provided that a * frame is encoded in ctypeA. If not, i.e. for * ctypeA = 'VELO', ctype will be returned as 'VELO'. * * VELREF takes precedence over CTYPEia in defining the * Doppler frame, e.g. * = ctypeA = 'VELO-HEL' = velref = 1 * * returns ctype = 'VOPT' with specsys set to 'LSRK'. * * Returned: * ctype char[9] Translated CTYPEia keyvalue, or a copy of ctypeA if no * translation was performed (in which case any trailing * blanks in ctypeA will be replaced with nulls). * * specsys char[9] Doppler reference frame indicated by VELREF or else * by CTYPEia with value corresponding to the SPECSYS * keyvalue in the FITS WCS standard. May be returned * blank if neither specifies a Doppler frame, e.g. * ctypeA = 'FELO' and velref%256 == 0. * * Function return value: * int Status return value: * -1: No translation required (not an error). * 0: Success. * 2: Invalid value of VELREF. * * * spcprm struct - Spectral transformation parameters * -------------------------------------------------- * The spcprm struct contains information required to transform spectral * coordinates. It consists of certain members that must be set by the user * ("given") and others that are set by the WCSLIB routines ("returned"). Some * of the latter are supplied for informational purposes while others are for * internal use only. * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following spcprm structure members are set or changed: * * - spcprm::type, * - spcprm::code, * - spcprm::crval, * - spcprm::restfrq, * - spcprm::restwav, * - spcprm::pv[]. * * This signals the initialization routine, spcset(), to recompute the * returned members of the spcprm struct. spcset() will reset flag to * indicate that this has been done. * * char type[8] * (Given) Four-letter spectral variable type, e.g "ZOPT" for * CTYPEia = 'ZOPT-F2W'. (Declared as char[8] for alignment reasons.) * * char code[4] * (Given) Three-letter spectral algorithm code, e.g "F2W" for * CTYPEia = 'ZOPT-F2W'. * * double crval * (Given) Reference value (CRVALia), SI units. * * double restfrq * (Given) The rest frequency [Hz], and ... * * double restwav * (Given) ... the rest wavelength in vacuo [m], only one of which need be * given, the other should be set to zero. Neither are required if the * X and S spectral variables are both wave-characteristic, or both * velocity-characteristic, types. * * double pv[7] * (Given) Grism parameters for 'GRI' and 'GRA' algorithm codes: * - 0: G, grating ruling density. * - 1: m, interference order. * - 2: alpha, angle of incidence [deg]. * - 3: n_r, refractive index at the reference wavelength, lambda_r. * - 4: n'_r, dn/dlambda at the reference wavelength, lambda_r (/m). * - 5: epsilon, grating tilt angle [deg]. * - 6: theta, detector tilt angle [deg]. * * The remaining members of the spcprm struct are maintained by spcset() and * must not be modified elsewhere: * * double w[6] * (Returned) Intermediate values: * - 0: Rest frequency or wavelength (SI). * - 1: The value of the X-type spectral variable at the reference point * (SI units). * - 2: dX/dS at the reference point (SI units). * The remainder are grism intermediates. * * int isGrism * (Returned) Grism coordinates? * - 0: no, * - 1: in vacuum, * - 2: in air. * * int padding1 * (An unused variable inserted for alignment purposes only.) * * struct wcserr *err * (Returned) If enabled, when an error status is returned this structure * contains detailed information about the error, see wcserr_enable(). * * void *padding2 * (An unused variable inserted for alignment purposes only.) * int (*spxX2P)(SPX_ARGS) * (Returned) The first and ... * int (*spxP2S)(SPX_ARGS) * (Returned) ... the second of the pointers to the transformation * functions in the two-step algorithm chain X -> P -> S in the * pixel-to-spectral direction where the non-linear transformation is from * X to P. The argument list, SPX_ARGS, is defined in spx.h. * * int (*spxS2P)(SPX_ARGS) * (Returned) The first and ... * int (*spxP2X)(SPX_ARGS) * (Returned) ... the second of the pointers to the transformation * functions in the two-step algorithm chain S -> P -> X in the * spectral-to-pixel direction where the non-linear transformation is from * P to X. The argument list, SPX_ARGS, is defined in spx.h. * * * Global variable: const char *spc_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_SPC #define WCSLIB_SPC #include "spx.h" #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif extern const char *spc_errmsg[]; enum spc_errmsg_enum { SPCERR_NO_CHANGE = -1, /* No change. */ SPCERR_SUCCESS = 0, /* Success. */ SPCERR_NULL_POINTER = 1, /* Null spcprm pointer passed. */ SPCERR_BAD_SPEC_PARAMS = 2, /* Invalid spectral parameters. */ SPCERR_BAD_X = 3, /* One or more of x coordinates were invalid. */ SPCERR_BAD_SPEC = 4 /* One or more of the spec coordinates were invalid. */ }; struct spcprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* Parameters to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ char type[8]; /* Four-letter spectral variable type. */ char code[4]; /* Three-letter spectral algorithm code. */ double crval; /* Reference value (CRVALia), SI units. */ double restfrq; /* Rest frequency, Hz. */ double restwav; /* Rest wavelength, m. */ double pv[7]; /* Grism parameters: */ /* 0: G, grating ruling density. */ /* 1: m, interference order. */ /* 2: alpha, angle of incidence. */ /* 3: n_r, refractive index at lambda_r. */ /* 4: n'_r, dn/dlambda at lambda_r. */ /* 5: epsilon, grating tilt angle. */ /* 6: theta, detector tilt angle. */ /* Information derived from the parameters supplied. */ /*------------------------------------------------------------------------*/ double w[6]; /* Intermediate values. */ /* 0: Rest frequency or wavelength (SI). */ /* 1: CRVALX (SI units). */ /* 2: CDELTX/CDELTia = dX/dS (SI units). */ /* The remainder are grism intermediates. */ int isGrism; /* Grism coordinates? 1: vacuum, 2: air. */ int padding1; /* (Dummy inserted for alignment purposes.) */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private */ /*------------------------------------------------------------------------*/ void *padding2; /* (Dummy inserted for alignment purposes.) */ int (*spxX2P)(SPX_ARGS); /* Pointers to the transformation functions */ int (*spxP2S)(SPX_ARGS); /* in the two-step algorithm chain in the */ /* pixel-to-spectral direction. */ int (*spxS2P)(SPX_ARGS); /* Pointers to the transformation functions */ int (*spxP2X)(SPX_ARGS); /* in the two-step algorithm chain in the */ /* spectral-to-pixel direction. */ }; /* Size of the spcprm struct in int units, used by the Fortran wrappers. */ #define SPCLEN (sizeof(struct spcprm)/sizeof(int)) int spcini(struct spcprm *spc); int spcfree(struct spcprm *spc); int spcprt(const struct spcprm *spc); int spcset(struct spcprm *spc); int spcx2s(struct spcprm *spc, int nx, int sx, int sspec, const double x[], double spec[], int stat[]); int spcs2x(struct spcprm *spc, int nspec, int sspec, int sx, const double spec[], double x[], int stat[]); int spctype(const char ctype[9], char stype[], char scode[], char sname[], char units[], char *ptype, char *xtype, int *restreq, struct wcserr **err); int spcspxe(const char ctypeS[9], double crvalS, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalX, double *dXdS, struct wcserr **err); int spcxpse(const char ctypeS[9], double crvalX, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalS, double *dSdX, struct wcserr **err); int spctrne(const char ctypeS1[9], double crvalS1, double cdeltS1, double restfrq, double restwav, char ctypeS2[9], double *crvalS2, double *cdeltS2, struct wcserr **err); int spcaips(const char ctypeA[9], int velref, char ctype[9], char specsys[9]); /* Deprecated. */ #define spcini_errmsg spc_errmsg #define spcprt_errmsg spc_errmsg #define spcset_errmsg spc_errmsg #define spcx2s_errmsg spc_errmsg #define spcs2x_errmsg spc_errmsg int spctyp(const char ctype[9], char stype[], char scode[], char sname[], char units[], char *ptype, char *xtype, int *restreq); int spcspx(const char ctypeS[9], double crvalS, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalX, double *dXdS); int spcxps(const char ctypeS[9], double crvalX, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalS, double *dSdX); int spctrn(const char ctypeS1[9], double crvalS1, double cdeltS1, double restfrq, double restwav, char ctypeS2[9], double *crvalS2, double *cdeltS2); #ifdef __cplusplus } #endif #endif /* WCSLIB_SPC */ astropy-0.3/cextern/wcslib/C/wcsulex.l0000644000175000017500000004426312243255342016174 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsulex.l,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a * recursive, multi-buffered lexical scanner that parses FITS units * specifications. * * It requires Flex v2.5.4 or later. * * Refer to wcsunits.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ %option full %option never-interactive %option noyywrap %option outfile="wcsulex.c" %option prefix="wcsulex" /* Exponents. */ INTEGER [+-]?[1-9][0-9]* FRAC {INTEGER}"/"[1-9][0-9]* FLOAT [+-]?([0-9]+\.?[0-9]*|\.[0-9]+) /* Metric prefixes. */ SUB3 [munpfazy] SUBPREFIX [dc]|{SUB3} SUP3 [kMGTPEZY] SUPPREFIX da|h|{SUP3} PREFIX {SUBPREFIX}|{SUPPREFIX} /* Basic and derived SI units. */ BASIC m|s|g|rad|sr|K|A|mol|cd DERIVED Hz|J|W|V|N|Pa|C|[Oo]hm|S|F|Wb|T|H|lm|lx SI_UNIT {BASIC}|{DERIVED} /* Additional recognized units: all metric prefixes allowed. */ ADD_ALL eV|Jy|R|G|barn /* Additional recognized units: only super-metric prefixes allowed. */ ADD_SUP a|yr|pc|bit|[bB]yte /* Additional recognized units: only sub-metric prefixes allowed. */ ADD_SUB mag /* Additional recognized units for which NO metric prefixes are allowed. */ GENERAL deg|arcmin|arcsec|mas|d|h|min|erg|Ry|u|D ASTRO [Aa]ngstrom|AU|lyr|beam|solRad|solMass|solLum|Sun DEVICE adu|bin|chan|count|ct|photon|ph|pixel|pix|voxel ADD_NONE {GENERAL}|{ASTRO}|{DEVICE} /* All additional recognized units. */ ADD_UNIT {ADD_ALL}|{ADD_SUP}|{ADD_SUB}|{ADD_NONE} /* Exclusive start states. */ %x PAREN PREFIX UNITS EXPON FLUSH %{ /* To get the prototype for fileno() from stdio.h when gcc is invoked with * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */ #define _POSIX_SOURCE 1 #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsunits.h" #include "wcsutil.h" #define YY_DECL int wcsulexe(const char unitstr[], int *func, double *scale, \ double units[WCSUNITS_NTYPE], struct wcserr **err) /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsulex_abort_jmp_env; #define exit(status) longjmp(wcsulex_abort_jmp_env, status) %} %% static const char *function = "wcsulexe"; char ctmp[72]; int bracket = 0; int operator = 0; int paren = 0; int status = 0; int func_r, i, j; double dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE]; YY_BUFFER_STATE buf; void add(double *factor, double types[], double *expon, double *scale, double units[]); int yylex_destroy(void); if (err) *err = 0x0; *func = 0; for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] = 0.0; types[i] = 0.0; } expon = 1.0; factor = 1.0; *scale = 1.0; yy_scan_string(unitstr); /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsulex_abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); } BEGIN(INITIAL); #ifdef DEBUG fprintf(stderr, "\n%s ->\n", unitstr); #endif ^" "+ { /* Pretend initial whitespace doesn't exist. */ yy_set_bol(1); } ^"[" { if (bracket++) { BEGIN(FLUSH); } else { yy_set_bol(1); } } ^10[0-9] { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_NUM_MULTIPLIER), "Invalid exponent in '%s'", unitstr); BEGIN(FLUSH); } ^10 { factor = 10.0; BEGIN(EXPON); } ^log" "*"(" { *func = 1; unput('('); BEGIN(PAREN); } ^ln" "*"(" { *func = 2; unput('('); BEGIN(PAREN); } ^exp" "*"(" { *func = 3; unput('('); BEGIN(PAREN); } ^[*.] { /* Leading binary multiply. */ status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP), "Dangling binary operator in '%s'", unitstr); BEGIN(FLUSH); } " "+ /* Discard whitespace in INITIAL context. */ sqrt" "*"(" { expon /= 2.0; unput('('); BEGIN(PAREN); } "(" { /* Gather terms in parentheses. */ yyless(0); BEGIN(PAREN); } [*.] { if (operator++) { BEGIN(FLUSH); } } ^1"/" | "/" { if (operator++) { BEGIN(FLUSH); } else { expon *= -1.0; } } {SI_UNIT}|{ADD_UNIT} { operator = 0; yyless(0); BEGIN(UNITS); } {PREFIX}({SI_UNIT}|{ADD_ALL}) | {SUPPREFIX}{ADD_SUP} | {SUBPREFIX}{ADD_SUB} { operator = 0; yyless(0); BEGIN(PREFIX); } "]" { bracket = !bracket; BEGIN(FLUSH); } . { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_INITIAL_SYMBOL), "Invalid symbol in INITIAL context in '%s'", unitstr); BEGIN(FLUSH); } "(" { paren++; operator = 0; yymore(); } ")" { paren--; if (paren) { /* Not balanced yet. */ yymore(); } else { /* Balanced; strip off the outer parentheses and recurse. */ yytext[yyleng-1] = '\0'; buf = YY_CURRENT_BUFFER; status = wcsulexe(yytext+1, &func_r, &factor_r, types, err); yy_switch_to_buffer(buf); if (func_r) { status = wcserr_set(WCSERR_SET(UNITSERR_FUNCTION_CONTEXT), "Function in invalid context in '%s'", unitstr); } if (status) { BEGIN(FLUSH); } else { factor *= factor_r; BEGIN(EXPON); } } } [^()]+ { yymore(); } d { factor = 1e-1; BEGIN(UNITS); } c { factor = 1e-2; BEGIN(UNITS); } m { factor = 1e-3; BEGIN(UNITS); } u { factor = 1e-6; BEGIN(UNITS); } n { factor = 1e-9; BEGIN(UNITS); } p { factor = 1e-12; BEGIN(UNITS); } f { factor = 1e-15; BEGIN(UNITS); } a { factor = 1e-18; BEGIN(UNITS); } z { factor = 1e-21; BEGIN(UNITS); } y { factor = 1e-24; BEGIN(UNITS); } da { factor = 1e+1; BEGIN(UNITS); } h { factor = 1e+2; BEGIN(UNITS); } k { factor = 1e+3; BEGIN(UNITS); } M { factor = 1e+6; BEGIN(UNITS); } G { factor = 1e+9; BEGIN(UNITS); } T { factor = 1e+12; BEGIN(UNITS); } P { factor = 1e+15; BEGIN(UNITS); } E { factor = 1e+18; BEGIN(UNITS); } Z { factor = 1e+21; BEGIN(UNITS); } Y { factor = 1e+24; BEGIN(UNITS); } . { /* Internal parser error. */ status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); } A { /* Ampere. */ types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_TIME] -= 1.0; BEGIN(EXPON); } a|yr { /* Year (annum). */ factor *= 31557600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } adu { /* Analogue-to-digital converter units. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } [Aa]ngstrom { /* Angstrom. */ factor *= 1e-10; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } arcmin { /* Minute of arc. */ factor /= 60.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } arcsec { /* Second of arc. */ factor /= 3600.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } AU { /* Astronomical unit. */ factor *= 1.49598e+11; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } barn { /* Barn. */ factor *= 1e-28; types[WCSUNITS_LENGTH] += 2.0; BEGIN(EXPON); } beam { /* Beam, as in Jy/beam. */ types[WCSUNITS_BEAM] += 1.0; BEGIN(EXPON); } bin { /* Bin (e.g. histogram). */ types[WCSUNITS_BIN] += 1.0; BEGIN(EXPON); } bit { /* Bit. */ types[WCSUNITS_BIT] += 1.0; BEGIN(EXPON); } [bB]yte { /* Byte. */ factor *= 8.0; types[WCSUNITS_BIT] += 1.0; BEGIN(EXPON); } C { /* Coulomb. */ types[WCSUNITS_CHARGE] += 1.0; BEGIN(EXPON); } cd { /* Candela. */ types[WCSUNITS_LUMINTEN] += 1.0; BEGIN(EXPON); } chan { /* Channel. */ types[WCSUNITS_BIN] += 1.0; BEGIN(EXPON); } count|ct { /* Count. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } D { /* Debye. */ factor *= 1e-29 / 3.0; types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } d { /* Day. */ factor *= 86400.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } deg { /* Degree. */ types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } erg { /* Erg. */ factor *= 1e-7; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } eV { /* Electron volt. */ factor *= 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } F { /* Farad. */ types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 3.0; types[WCSUNITS_CHARGE] += 2.0; BEGIN(EXPON); } G { /* Gauss. */ factor *= 1e-4; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } g { /* Gram. */ factor *= 1e-3; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } H { /* Henry. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 2.0; types[WCSUNITS_CHARGE] -= 2.0; BEGIN(EXPON); } h { /* Hour. */ factor *= 3600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } Hz { /* Hertz. */ types[WCSUNITS_TIME] -= 1.0; BEGIN(EXPON); } J { /* Joule. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } Jy { /* Jansky. */ factor *= 1e-26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } K { /* Kelvin. */ types[WCSUNITS_TEMPERATURE] += 1.0; BEGIN(EXPON); } lm { /* Lumen. */ types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; BEGIN(EXPON); } lx { /* Lux. */ types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; types[WCSUNITS_LENGTH] -= 2.0; BEGIN(EXPON); } lyr { /* Light year. */ factor *= 2.99792458e8 * 31557600.0; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } m { /* Metre. */ types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } mag { /* Stellar magnitude. */ types[WCSUNITS_MAGNITUDE] += 1.0; BEGIN(EXPON); } mas { /* Milli-arcsec. */ factor /= 3600e+3; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } min { /* Minute. */ factor *= 60.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } mol { /* Mole. */ types[WCSUNITS_MOLE] += 1.0; BEGIN(EXPON); } N { /* Newton. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } [Oo]hm { /* Ohm. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 1.0; types[WCSUNITS_CHARGE] -= 2.0; BEGIN(EXPON); } Pa { /* Pascal. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] -= 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } pc { /* Parsec. */ factor *= 3.0857e16; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } photon|ph { /* Photon. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } pixel|pix { /* Pixel. */ types[WCSUNITS_PIXEL] += 1.0; BEGIN(EXPON); } R { /* Rayleigh. */ factor *= 1e10 / (4.0 * PI); types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] -= 1.0; types[WCSUNITS_SOLID_ANGLE] -= 1.0; BEGIN(EXPON); } rad { /* Radian. */ factor *= 180.0 / PI; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } Ry { /* Rydberg. */ factor *= 13.605692 * 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } S { /* Siemen. */ types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] += 2.0; BEGIN(EXPON); } s { /* Second. */ types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } solLum { /* Solar luminosity. */ factor *= 3.8268e26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; BEGIN(EXPON); } solMass { /* Solar mass. */ factor *= 1.9891e30; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } solRad { /* Solar radius. */ factor *= 6.9599e8; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } sr { /* Steradian. */ types[WCSUNITS_SOLID_ANGLE] += 1.0; BEGIN(EXPON); } Sun { /* Sun (with respect to). */ types[WCSUNITS_SOLRATIO] += 1.0; BEGIN(EXPON); } T { /* Tesla. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } u { /* Unified atomic mass unit. */ factor *= 1.6605387e-27; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } V { /* Volt. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } voxel { /* Voxel. */ types[WCSUNITS_VOXEL] += 1.0; BEGIN(EXPON); } W { /* Watt. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; BEGIN(EXPON); } Wb { /* Weber. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } . { /* Internal parser error. */ status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); } " "*("**"|^) { /* Exponentiation. */ if (operator++) { BEGIN(FLUSH); } } " "*{INTEGER} { sscanf(yytext, " %d", &i); expon *= (double)i; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } " "*"("" "*{INTEGER}" "*")" { sscanf(yytext, " (%d)", &i); expon *= (double)i; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } " "*"("" "*{FRAC}" "*")" { sscanf(yytext, " (%d/%d)", &i, &j); expon *= (double)i / (double)j; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } " "*"("" "*{FLOAT}" "*")" { sscanf(yytext, " (%s)", ctmp); wcsutil_str2double(ctmp, "%lf", &dexp); expon *= dexp; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } " "*[.*]" "* { /* Multiply. */ if (operator++) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); BEGIN(INITIAL); } } " "*"(" { /* Multiply. */ if (operator) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); unput('('); BEGIN(INITIAL); } } " "+ { /* Multiply. */ if (operator) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); BEGIN(INITIAL); } } " "*"/"" "* { /* Divide. */ if (operator++) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); expon = -1.0; BEGIN(INITIAL); } } " "*"]" { add(&factor, types, &expon, scale, units); bracket = !bracket; BEGIN(FLUSH); } . { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_EXPON_SYMBOL), "Invalid symbol in EXPON context in '%s'", unitstr); BEGIN(FLUSH); } .* { /* Discard any remaining input. */ } <> { /* End-of-string. */ if (YY_START == EXPON) { add(&factor, types, &expon, scale, units); } yylex_destroy(); if (bracket) { status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_BRACKET), "Unbalanced bracket in '%s'", unitstr); } else if (paren) { status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_PAREN), "Unbalanced parenthesis in '%s'", unitstr); } else if (operator == 1) { status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP), "Dangling binary operator in '%s'", unitstr); } else if (operator) { status = wcserr_set(WCSERR_SET(UNITSERR_CONSEC_BINOPS), "Consecutive binary operators in '%s'", unitstr); #ifdef DEBUG } else { fprintf(stderr, "EOS\n"); #endif } if (status) { for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] = 0.0; *scale = 0.0; } } return status; } %% /*---------------------------------------------------------------------------- * Accumulate a term in a units specification and reset work variables. *---------------------------------------------------------------------------*/ void add( double *factor, double types[], double *expon, double *scale, double units[]) { int i; *scale *= pow(*factor, *expon); for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] += *expon * types[i]; types[i] = 0.0; } *expon = 1.0; *factor = 1.0; return; } astropy-0.3/cextern/wcslib/C/lin.c0000644000175000017500000004031112243255342015241 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: lin.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include "wcserr.h" #include "wcsprintf.h" #include "lin.h" const int LINSET = 137; /* Map status return value to message. */ const char *lin_errmsg[] = { "Success", "Null linprm pointer passed", "Memory allocation failed", "PCi_ja matrix is singular"}; /* Convenience macro for invoking wcserr_set(). */ #define LIN_ERRMSG(status) WCSERR_SET(status), lin_errmsg[status] /*--------------------------------------------------------------------------*/ int linini(alloc, naxis, lin) int alloc, naxis; struct linprm *lin; { static const char *function = "linini"; int i, j; double *pc; struct wcserr **err; if (lin == 0x0) return LINERR_NULL_POINTER; /* Initialize error message handling. */ err = &(lin->err); if (lin->flag != -1) { if (lin->err) free(lin->err); } lin->err = 0x0; /* Initialize memory management. */ if (lin->flag == -1 || lin->m_flag != LINSET) { lin->m_flag = 0; lin->m_naxis = 0x0; lin->m_crpix = 0x0; lin->m_pc = 0x0; lin->m_cdelt = 0x0; } if (naxis < 0) { return wcserr_set(WCSERR_SET(LINERR_MEMORY), "naxis must not be negative (got %d)", naxis); } /* Allocate memory for arrays if required. */ if (alloc || lin->crpix == 0x0 || lin->pc == 0x0 || lin->cdelt == 0x0) { /* Was sufficient allocated previously? */ if (lin->m_flag == LINSET && lin->m_naxis < naxis) { /* No, free it. */ linfree(lin); } if (alloc || lin->crpix == 0x0) { if (lin->m_crpix) { /* In case the caller fiddled with it. */ lin->crpix = lin->m_crpix; } else { if (!(lin->crpix = calloc(naxis, sizeof(double)))) { return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_crpix = lin->crpix; } } if (alloc || lin->pc == 0x0) { if (lin->m_pc) { /* In case the caller fiddled with it. */ lin->pc = lin->m_pc; } else { if (!(lin->pc = calloc(naxis*naxis, sizeof(double)))) { linfree(lin); return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_pc = lin->pc; } } if (alloc || lin->cdelt == 0x0) { if (lin->m_cdelt) { /* In case the caller fiddled with it. */ lin->cdelt = lin->m_cdelt; } else { if (!(lin->cdelt = calloc(naxis, sizeof(double)))) { linfree(lin); return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->m_flag = LINSET; lin->m_naxis = naxis; lin->m_cdelt = lin->cdelt; } } } /* Free memory allocated by linset(). */ if (lin->flag == LINSET) { if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); } lin->piximg = 0x0; lin->imgpix = 0x0; lin->i_naxis = 0x0; lin->flag = 0; lin->naxis = naxis; /* CRPIXja defaults to 0.0. */ for (j = 0; j < naxis; j++) { lin->crpix[j] = 0.0; } /* PCi_ja defaults to the unit matrix. */ pc = lin->pc; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { if (j == i) { *pc = 1.0; } else { *pc = 0.0; } pc++; } } /* CDELTia defaults to 1.0. */ for (i = 0; i < naxis; i++) { lin->cdelt[i] = 1.0; } return 0; } /*--------------------------------------------------------------------------*/ int lincpy(alloc, linsrc, lindst) int alloc; const struct linprm *linsrc; struct linprm *lindst; { static const char *function = "lincpy"; int i, j, naxis, status; const double *srcp; double *dstp; struct wcserr **err; if (linsrc == 0x0) return LINERR_NULL_POINTER; if (lindst == 0x0) return LINERR_NULL_POINTER; err = &(lindst->err); naxis = linsrc->naxis; if (naxis < 1) { return wcserr_set(WCSERR_SET(LINERR_MEMORY), "naxis must be positive (got %d)", naxis); } if ((status = linini(alloc, naxis, lindst))) { return status; } srcp = linsrc->crpix; dstp = lindst->crpix; for (j = 0; j < naxis; j++) { *(dstp++) = *(srcp++); } srcp = linsrc->pc; dstp = lindst->pc; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { *(dstp++) = *(srcp++); } } srcp = linsrc->cdelt; dstp = lindst->cdelt; for (i = 0; i < naxis; i++) { *(dstp++) = *(srcp++); } return 0; } /*--------------------------------------------------------------------------*/ int linfree(lin) struct linprm *lin; { if (lin == 0x0) return LINERR_NULL_POINTER; if (lin->flag != -1) { /* Free memory allocated by linini(). */ if (lin->m_flag == LINSET) { if (lin->crpix == lin->m_crpix) lin->crpix = 0x0; if (lin->pc == lin->m_pc) lin->pc = 0x0; if (lin->cdelt == lin->m_cdelt) lin->cdelt = 0x0; if (lin->m_crpix) free(lin->m_crpix); if (lin->m_pc) free(lin->m_pc); if (lin->m_cdelt) free(lin->m_cdelt); } } lin->m_flag = 0; lin->m_naxis = 0; lin->m_crpix = 0x0; lin->m_pc = 0x0; lin->m_cdelt = 0x0; /* Free memory allocated by linset(). */ if (lin->flag == LINSET) { if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); } lin->piximg = 0x0; lin->imgpix = 0x0; lin->i_naxis = 0; if (lin->err) { free(lin->err); lin->err = 0x0; } lin->flag = 0; return 0; } /*--------------------------------------------------------------------------*/ int linprt(lin) const struct linprm *lin; { int i, j, k; if (lin == 0x0) return LINERR_NULL_POINTER; if (lin->flag != LINSET) { wcsprintf("The linprm struct is UNINITIALIZED.\n"); return 0; } wcsprintf(" flag: %d\n", lin->flag); wcsprintf(" naxis: %d\n", lin->naxis); WCSPRINTF_PTR(" crpix: ", lin->crpix, "\n"); wcsprintf(" "); for (i = 0; i < lin->naxis; i++) { wcsprintf(" %- 11.5g", lin->crpix[i]); } wcsprintf("\n"); k = 0; WCSPRINTF_PTR(" pc: ", lin->pc, "\n"); for (i = 0; i < lin->naxis; i++) { wcsprintf(" pc[%d][]:", i); for (j = 0; j < lin->naxis; j++) { wcsprintf(" %- 11.5g", lin->pc[k++]); } wcsprintf("\n"); } WCSPRINTF_PTR(" cdelt: ", lin->cdelt, "\n"); wcsprintf(" "); for (i = 0; i < lin->naxis; i++) { wcsprintf(" %- 11.5g", lin->cdelt[i]); } wcsprintf("\n"); wcsprintf(" unity: %d\n", lin->unity); WCSPRINTF_PTR(" err: ", lin->err, "\n"); if (lin->err) { wcserr_prt(lin->err, " "); } if (lin->piximg == 0x0) { wcsprintf(" piximg: (nil)\n"); } else { k = 0; for (i = 0; i < lin->naxis; i++) { wcsprintf("piximg[%d][]:", i); for (j = 0; j < lin->naxis; j++) { wcsprintf(" %- 11.5g", lin->piximg[k++]); } wcsprintf("\n"); } } if (lin->imgpix == 0x0) { wcsprintf(" imgpix: (nil)\n"); } else { k = 0; for (i = 0; i < lin->naxis; i++) { wcsprintf("imgpix[%d][]:", i); for (j = 0; j < lin->naxis; j++) { wcsprintf(" %- 11.5g", lin->imgpix[k++]); } wcsprintf("\n"); } } wcsprintf(" m_flag: %d\n", lin->m_flag); wcsprintf(" m_naxis: %d\n", lin->m_naxis); WCSPRINTF_PTR(" m_crpix: ", lin->m_crpix, ""); if (lin->m_crpix == lin->crpix) wcsprintf(" (= crpix)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_pc: ", lin->m_pc, ""); if (lin->m_pc == lin->pc) wcsprintf(" (= pc)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_cdelt: ", lin->m_cdelt, ""); if (lin->m_cdelt == lin->cdelt) wcsprintf(" (= cdelt)"); wcsprintf("\n"); return 0; } /*--------------------------------------------------------------------------*/ int linset(lin) struct linprm *lin; { static const char *function = "linset"; int i, j, n, status; double *pc, *piximg; struct wcserr **err; if (lin == 0x0) return LINERR_NULL_POINTER; err = &(lin->err); n = lin->naxis; /* Check for a unit matrix. */ lin->unity = 1; pc = lin->pc; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (j == i) { if (*(pc++) != 1.0) { lin->unity = 0; break; } } else { if (*(pc++) != 0.0) { lin->unity = 0; break; } } } } if (lin->unity) { if (lin->flag == LINSET) { /* Free memory that may have been allocated previously. */ if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); } lin->piximg = 0x0; lin->imgpix = 0x0; lin->i_naxis = 0; } else { if (lin->flag != LINSET || lin->i_naxis < n) { if (lin->flag == LINSET) { /* Free memory that may have been allocated previously. */ if (lin->piximg) free(lin->piximg); if (lin->imgpix) free(lin->imgpix); } /* Allocate memory for internal arrays. */ if (!(lin->piximg = calloc(n*n, sizeof(double)))) { return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } if (!(lin->imgpix = calloc(n*n, sizeof(double)))) { free(lin->piximg); return wcserr_set(LIN_ERRMSG(LINERR_MEMORY)); } lin->i_naxis = n; } /* Compute the pixel-to-image transformation matrix. */ pc = lin->pc; piximg = lin->piximg; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { *(piximg++) = lin->cdelt[i] * (*(pc++)); } } /* Compute the image-to-pixel transformation matrix. */ if ((status = matinv(n, lin->piximg, lin->imgpix))) { return wcserr_set(LIN_ERRMSG(status)); } } lin->flag = LINSET; return 0; } /*--------------------------------------------------------------------------*/ int linp2x(lin, ncoord, nelem, pixcrd, imgcrd) struct linprm *lin; int ncoord, nelem; const double pixcrd[]; double imgcrd[]; { int i, j, k, n, status; double temp; register const double *pix; register double *img, *piximg; /* Initialize. */ if (lin == 0x0) return LINERR_NULL_POINTER; if (lin->flag != LINSET) { if ((status = linset(lin))) return status; } n = lin->naxis; /* Convert pixel coordinates to intermediate world coordinates. */ pix = pixcrd; img = imgcrd; if (lin->unity) { for (k = 0; k < ncoord; k++) { for (i = 0; i < n; i++) { *(img++) = lin->cdelt[i] * (*(pix++) - lin->crpix[i]); } pix += (nelem - n); img += (nelem - n); } } else { for (k = 0; k < ncoord; k++) { for (i = 0; i < n; i++) { img[i] = 0.0; } for (j = 0; j < n; j++) { /* Column-wise multiplication allows this to be cached. */ temp = *(pix++) - lin->crpix[j]; piximg = lin->piximg + j; for (i = 0; i < n; i++, piximg += n) { img[i] += *piximg * temp; } } pix += (nelem - n); img += nelem; } } return 0; } /*--------------------------------------------------------------------------*/ int linx2p(lin, ncoord, nelem, imgcrd, pixcrd) struct linprm *lin; int ncoord, nelem; const double imgcrd[]; double pixcrd[]; { int i, j, k, n, status; register const double *img; register double *imgpix, *pix; /* Initialize. */ if (lin == 0x0) return LINERR_NULL_POINTER; if (lin->flag != LINSET) { if ((status = linset(lin))) return status; } n = lin->naxis; /* Convert intermediate world coordinates to pixel coordinates. */ img = imgcrd; pix = pixcrd; if (lin->unity) { for (k = 0; k < ncoord; k++) { for (j = 0; j < n; j++) { *(pix++) = (*(img++) / lin->cdelt[j]) + lin->crpix[j]; } pix += (nelem - n); img += (nelem - n); } } else { for (k = 0; k < ncoord; k++) { imgpix = lin->imgpix; for (j = 0; j < n; j++) { *pix = 0.0; for (i = 0; i < n; i++) { *pix += *imgpix * img[i]; imgpix++; } *(pix++) += lin->crpix[j]; } pix += (nelem - n); img += nelem; } } return 0; } /*--------------------------------------------------------------------------*/ int matinv(int n, const double mat[], double inv[]) { register int i, ij, ik, j, k, kj, pj; int itemp, *mxl, *lxm, pivot; double colmax, *lu, *rowmax, dtemp; /* Allocate memory for internal arrays. */ if (!(mxl = calloc(n, sizeof(int)))) { return LINERR_MEMORY; } if (!(lxm = calloc(n, sizeof(int)))) { free(mxl); return LINERR_MEMORY; } if (!(rowmax = calloc(n, sizeof(double)))) { free(mxl); free(lxm); return LINERR_MEMORY; } if (!(lu = calloc(n*n, sizeof(double)))) { free(mxl); free(lxm); free(rowmax); return LINERR_MEMORY; } /* Initialize arrays. */ for (i = 0, ij = 0; i < n; i++) { /* Vector that records row interchanges. */ mxl[i] = i; rowmax[i] = 0.0; for (j = 0; j < n; j++, ij++) { dtemp = fabs(mat[ij]); if (dtemp > rowmax[i]) rowmax[i] = dtemp; lu[ij] = mat[ij]; } /* A row of zeroes indicates a singular matrix. */ if (rowmax[i] == 0.0) { free(mxl); free(lxm); free(rowmax); free(lu); return LINERR_SINGULAR_MTX; } } /* Form the LU triangular factorization using scaled partial pivoting. */ for (k = 0; k < n; k++) { /* Decide whether to pivot. */ colmax = fabs(lu[k*n+k]) / rowmax[k]; pivot = k; for (i = k+1; i < n; i++) { ik = i*n + k; dtemp = fabs(lu[ik]) / rowmax[i]; if (dtemp > colmax) { colmax = dtemp; pivot = i; } } if (pivot > k) { /* We must pivot, interchange the rows of the design matrix. */ for (j = 0, pj = pivot*n, kj = k*n; j < n; j++, pj++, kj++) { dtemp = lu[pj]; lu[pj] = lu[kj]; lu[kj] = dtemp; } /* Amend the vector of row maxima. */ dtemp = rowmax[pivot]; rowmax[pivot] = rowmax[k]; rowmax[k] = dtemp; /* Record the interchange for later use. */ itemp = mxl[pivot]; mxl[pivot] = mxl[k]; mxl[k] = itemp; } /* Gaussian elimination. */ for (i = k+1; i < n; i++) { ik = i*n + k; /* Nothing to do if lu[ik] is zero. */ if (lu[ik] != 0.0) { /* Save the scaling factor. */ lu[ik] /= lu[k*n+k]; /* Subtract rows. */ for (j = k+1; j < n; j++) { lu[i*n+j] -= lu[ik]*lu[k*n+j]; } } } } /* mxl[i] records which row of mat corresponds to row i of lu. */ /* lxm[i] records which row of lu corresponds to row i of mat. */ for (i = 0; i < n; i++) { lxm[mxl[i]] = i; } /* Determine the inverse matrix. */ for (i = 0, ij = 0; i < n; i++) { for (j = 0; j < n; j++, ij++) { inv[ij] = 0.0; } } for (k = 0; k < n; k++) { inv[lxm[k]*n+k] = 1.0; /* Forward substitution. */ for (i = lxm[k]+1; i < n; i++) { for (j = lxm[k]; j < i; j++) { inv[i*n+k] -= lu[i*n+j]*inv[j*n+k]; } } /* Backward substitution. */ for (i = n-1; i >= 0; i--) { for (j = i+1; j < n; j++) { inv[i*n+k] -= lu[i*n+j]*inv[j*n+k]; } inv[i*n+k] /= lu[i*n+i]; } } free(mxl); free(lxm); free(rowmax); free(lu); return 0; } astropy-0.3/cextern/wcslib/C/wcsprintf.h0000644000175000017500000001357212243255342016514 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsprintf.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. * * Summary of the wcsprintf routines * --------------------------------- * These routines allow diagnostic output from celprt(), linprt(), prjprt(), * spcprt(), tabprt(), wcsprt(), and wcserr_prt() to be redirected to a file or * captured in a string buffer. Those routines all use wcsprintf() for output. * Likewise wcsfprintf() is used by wcsbth() and wcspih(). Both functions may * be used by application programmers to have other output go to the same * place. * * * wcsprintf() - Print function used by WCSLIB diagnostic routines * --------------------------------------------------------------- * wcsprintf() is used by celprt(), linprt(), prjprt(), spcprt(), tabprt(), * wcsprt(), and wcserr_prt() for diagnostic output which by default goes to * stdout. However, it may be redirected to a file or string buffer via * wcsprintf_set(). * * Given: * format char* Format string, passed to one of the printf(3) family * of stdio library functions. * * ... mixed Argument list matching format, as per printf(3). * * Function return value: * int Number of bytes written. * * * wcsfprintf() - Print function used by WCSLIB diagnostic routines * ---------------------------------------------------------------- * wcsfprintf() is used by wcsbth(), and wcspih() for diagnostic output which * they send to stderr. However, it may be redirected to a file or string * buffer via wcsprintf_set(). * * Given: * stream FILE* The output stream if not overridden by a call to * wcsprintf_set(). * * format char* Format string, passed to one of the printf(3) family * of stdio library functions. * * ... mixed Argument list matching format, as per printf(3). * * Function return value: * int Number of bytes written. * * * wcsprintf_set() - Set output disposition for wcsprintf() and wcsfprintf() * ------------------------------------------------------------------------- * wcsprintf_set() sets the output disposition for wcsprintf() which is used by * the celprt(), linprt(), prjprt(), spcprt(), tabprt(), wcsprt(), and * wcserr_prt() routines, and for wcsfprintf() which is used by wcsbth() and * wcspih(). * * Given: * wcsout FILE* Pointer to an output stream that has been opened for * writing, e.g. by the fopen() stdio library function, * or one of the predefined stdio output streams - stdout * and stderr. If zero (NULL), output is written to an * internally-allocated string buffer, the address of * which may be obtained by wcsprintf_buf(). * * Function return value: * int Status return value: * 0: Success. * * * wcsprintf_buf() - Get the address of the internal string buffer * --------------------------------------------------------------- * wcsprintf_buf() returns the address of the internal string buffer created * when wcsprintf_set() is invoked with its FILE* argument set to zero. * * Function return value: * const char * * Address of the internal string buffer. The user may * free this buffer by calling wcsprintf_set() with a * valid FILE*, e.g. stdout. The free() stdlib library * function must NOT be invoked on this const pointer. * * * WCSPRINTF_PTR() macro - Print addresses in a consistent way * ----------------------------------------------------------- * WCSPRINTF_PTR() is a preprocessor macro used to print addresses in a * consistent way. * * On some systems the "%p" format descriptor renders a NULL pointer as the * string "0x0". On others, however, it produces "0" or even "(nil)". On * some systems a non-zero address is prefixed with "0x", on others, not. * * The WCSPRINTF_PTR() macro ensures that a NULL pointer is always rendered as * "0x0" and that non-zero addresses are prefixed with "0x" thus providing * consistency, for example, for comparing the output of test programs. * *===========================================================================*/ #ifndef WCSLIB_WCSPRINTF #define WCSLIB_WCSPRINTF #include #ifdef __cplusplus extern "C" { #endif #define WCSPRINTF_PTR(str1, ptr, str2) \ if (ptr) { \ wcsprintf("%s%#lx%s", (str1), (unsigned long)(ptr), (str2)); \ } else { \ wcsprintf("%s0x0%s", (str1), (str2)); \ } int wcsprintf_set(FILE *wcsout); int wcsprintf(const char *format, ...); int wcsfprintf(FILE *stream, const char *format, ...); const char *wcsprintf_buf(void); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSPRINTF */ astropy-0.3/cextern/wcslib/C/sph.h0000644000175000017500000002277112243255342015270 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: sph.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the spherical coordinate * transformations used by the FITS World Coordinate System (WCS) standard. * Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the sph routines * --------------------------- * The WCS spherical coordinate transformations are implemented via separate * functions, sphx2s() and sphs2x(), for the transformation in each direction. * * A utility function, sphdpa(), computes the angular distances and position * angles from a given point on the sky to a number of other points. sphpad() * does the complementary operation - computes the coordinates of points offset * by the given angular distances and position angles from a given point on the * sky. * * * sphx2s() - Rotation in the pixel-to-world direction * --------------------------------------------------- * sphx2s() transforms native coordinates of a projection to celestial * coordinates. * * Given: * eul const double[5] * Euler angles for the transformation: * 0: Celestial longitude of the native pole [deg]. * 1: Celestial colatitude of the native pole, or * native colatitude of the celestial pole [deg]. * 2: Native longitude of the celestial pole [deg]. * 3: cos(eul[1]) * 4: sin(eul[1]) * * nphi, * ntheta int Vector lengths. * * spt,sxy int Vector strides. * * phi,theta const double[] * Longitude and latitude in the native coordinate * system of the projection [deg]. * * Returned: * lng,lat double[] Celestial longitude and latitude [deg]. These may * refer to the same storage as phi and theta * respectively. * * Function return value: * int Status return value: * 0: Success. * * * sphs2x() - Rotation in the world-to-pixel direction * --------------------------------------------------- * sphs2x() transforms celestial coordinates to the native coordinates of a * projection. * * Given: * eul const double[5] * Euler angles for the transformation: * 0: Celestial longitude of the native pole [deg]. * 1: Celestial colatitude of the native pole, or * native colatitude of the celestial pole [deg]. * 2: Native longitude of the celestial pole [deg]. * 3: cos(eul[1]) * 4: sin(eul[1]) * * nlng,nlat int Vector lengths. * * sll,spt int Vector strides. * * lng,lat const double[] * Celestial longitude and latitude [deg]. * * Returned: * phi,theta double[] Longitude and latitude in the native coordinate system * of the projection [deg]. These may refer to the same * storage as lng and lat respectively. * * Function return value: * int Status return value: * 0: Success. * * * sphdpa() - Compute angular distance and position angle * ------------------------------------------------------ * sphdpa() computes the angular distance and generalized position angle (see * notes) from a "reference" point to a number of "field" points on the sphere. * The points must be specified consistently in any spherical coordinate * system. * * sphdpa() is complementary to sphpad(). * * Given: * nfield int The number of field points. * * lng0,lat0 double Spherical coordinates of the reference point [deg]. * * lng,lat const double[] * Spherical coordinates of the field points [deg]. * * Returned: * dist,pa double[] Angular distances and position angles [deg]. These * may refer to the same storage as lng and lat * respectively. * * Function return value: * int Status return value: * 0: Success. * * Notes: * sphdpa() uses sphs2x() to rotate coordinates so that the reference point * is at the north pole of the new system with the north pole of the old * system at zero longitude in the new. The Euler angles required by * sphs2x() for this rotation are * = eul[0] = lng0; = eul[1] = 90.0 - lat0; = eul[2] = 0.0; * * The angular distance and generalized position angle are readily obtained * from the longitude and latitude of the field point in the new system. * This applies even if the reference point is at one of the poles, in which * case the "position angle" returned is as would be computed for a reference * point at (lng0,+90-epsilon) or (lng0,-90+epsilon), in the limit as epsilon * goes to zero. * * It is evident that the coordinate system in which the two points are * expressed is irrelevant to the determination of the angular separation * between the points. However, this is not true of the generalized position * angle. * * The generalized position angle is here defined as the angle of * intersection of the great circle containing the reference and field points * with that containing the reference point and the pole. It has its normal * meaning when the the reference and field points are specified in * equatorial coordinates (right ascension and declination). * * Interchanging the reference and field points changes the position angle in * a non-intuitive way (because the sum of the angles of a spherical triangle * normally exceeds 180 degrees). * * The position angle is undefined if the reference and field points are * coincident or antipodal. This may be detected by checking for a distance * of 0 or 180 degrees (within rounding tolerance). sphdpa() will return an * arbitrary position angle in such circumstances. * * * sphpad() - Compute field points offset from a given point * --------------------------------------------------------- * sphpad() computes the coordinates of a set of points that are offset by the * specified angular distances and position angles from a given "reference" * point on the sky. The distances and position angles must be specified * consistently in any spherical coordinate system. * * sphpad() is complementary to sphdpa(). * * Given: * nfield int The number of field points. * * lng0,lat0 double Spherical coordinates of the reference point [deg]. * * dist,pa const double[] * Angular distances and position angles [deg]. * * Returned: * lng,lat double[] Spherical coordinates of the field points [deg]. * These may refer to the same storage as dist and pa * respectively. * * Function return value: * int Status return value: * 0: Success. * * Notes: * sphpad() is implemented analogously to sphdpa() although using sphx2s() * for the inverse transformation. In particular, when the reference point * is at one of the poles, "position angle" is interpreted as though the * reference point was at (lng0,+90-epsilon) or (lng0,-90+epsilon), in the * limit as epsilon goes to zero. * * Applying sphpad() with the distances and position angles computed by * sphdpa() should return the original field points. * *===========================================================================*/ #ifndef WCSLIB_SPH #define WCSLIB_SPH #ifdef __cplusplus extern "C" { #endif int sphx2s(const double eul[5], int nphi, int ntheta, int spt, int sxy, const double phi[], const double theta[], double lng[], double lat[]); int sphs2x(const double eul[5], int nlng, int nlat, int sll , int spt, const double lng[], const double lat[], double phi[], double theta[]); int sphdpa(int nfield, double lng0, double lat0, const double lng[], const double lat[], double dist[], double pa[]); int sphpad(int nfield, double lng0, double lat0, const double dist[], const double pa[], double lng[], double lat[]); #ifdef __cplusplus } #endif #endif /* WCSLIB_SPH */ astropy-0.3/cextern/wcslib/C/wcsutil.c0000644000175000017500000001304112243255342016151 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsutil.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcsutil.h" /*--------------------------------------------------------------------------*/ void wcsutil_blank_fill(int n, char c[]) { int k; for (k = strlen(c); k < n; k++) { c[k] = ' '; } return; } /*--------------------------------------------------------------------------*/ void wcsutil_null_fill(int n, char c[]) { int j, k; if (n <= 0) return; /* Null-fill the string. */ *(c+n-1) = '\0'; for (j = 0; j < n; j++) { if (c[j] == '\0') { for (k = j+1; k < n; k++) { c[k] = '\0'; } break; } } for (k = j-1; k > 0; k--) { if (c[k] != ' ') break; c[k] = '\0'; } return; } /*--------------------------------------------------------------------------*/ int wcsutil_allEq(int nvec, int nelem, const double *first) { double v0; const double *vp; if (nvec <= 0 || nelem <= 0) return 0; v0 = *first; for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { if (*vp != v0) return 0; } return 1; } /*--------------------------------------------------------------------------*/ void wcsutil_setAll(int nvec, int nelem, double *first) { double v0, *vp; if (nvec <= 0 || nelem <= 0) return; v0 = *first; for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { *vp = v0; } } /*--------------------------------------------------------------------------*/ void wcsutil_setAli(int nvec, int nelem, int *first) { int v0, *vp; if (nvec <= 0 || nelem <= 0) return; v0 = *first; for (vp = first+nelem; vp < first + nvec*nelem; vp += nelem) { *vp = v0; } } /*--------------------------------------------------------------------------*/ void wcsutil_setBit(int nelem, const int *sel, int bits, int *array) { int *arrp; if (bits == 0 || nelem <= 0) return; if (sel == 0x0) { /* All elements selected. */ for (arrp = array; arrp < array + nelem; arrp++) { *arrp |= bits; } } else { /* Some elements selected. */ for (arrp = array; arrp < array + nelem; arrp++) { if (*(sel++)) *arrp |= bits; } } } /*--------------------------------------------------------------------------*/ char *wcsutil_fptr2str(int (*func)(void), char hext[19]) { unsigned char *p = (unsigned char *)(&func); char *t = hext; int i, *(ip[2]), j[2], le = 1, gotone = 0; /* Test for little-endian addresses. */ ip[0] = j; ip[1] = j + 1; if ((unsigned char *)ip[0] < (unsigned char *)ip[1]) { /* Little-endian, reverse it. */ p += sizeof(func) - 1; le = -1; } sprintf(t, "0x0"); t += 2; for (i = 0; i < sizeof(func); i++) { /* Skip leading zeroes. */ if (*p) gotone = 1; if (gotone) { sprintf(t, "%02x", *p); t += 2; } p += le; } return hext; } /*--------------------------------------------------------------------------*/ static const char *wcsutil_dot_to_locale(const char *inbuf, char *outbuf) { struct lconv *locale_data = localeconv(); const char *decimal_point = locale_data->decimal_point; if (decimal_point[0] != '.' || decimal_point[1] != 0) { char *out = outbuf; size_t decimal_point_len = strlen(decimal_point); for ( ; *inbuf; ++inbuf) { if (*inbuf == '.') { strncpy(out, decimal_point, decimal_point_len); out += decimal_point_len; } else { *out++ = *inbuf; } } *out = '\0'; return outbuf; } else { return inbuf; } } int wcsutil_str2double(const char *buf, const char *format, double *value) { char ctmp[72]; return sscanf(wcsutil_dot_to_locale(buf, ctmp), "%lf", value) < 1; } /*--------------------------------------------------------------------------*/ static void wcsutil_locale_to_dot(char *buf) { struct lconv *locale_data = localeconv(); const char *decimal_point = locale_data->decimal_point; if (decimal_point[0] != '.' || decimal_point[1] != 0) { size_t decimal_point_len = strlen(decimal_point); char *inbuf = buf; char *outbuf = buf; for ( ; *inbuf; ++inbuf) { if (strncmp(inbuf, decimal_point, decimal_point_len) == 0) { *outbuf++ = '.'; inbuf += decimal_point_len - 1; } else { *outbuf++ = *inbuf; } } *outbuf = '\0'; } } void wcsutil_double2str(char *buf, const char *format, double value) { sprintf(buf, format, value); wcsutil_locale_to_dot(buf); } astropy-0.3/cextern/wcslib/C/wcsfix.h0000644000175000017500000004064312243255342015777 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsfix.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the wcsfix routines * ------------------------------ * Routines in this suite identify and translate various forms of non-standard * construct that are known to occur in FITS WCS headers. These range from the * translation of non-standard values for standard WCS keywords, to the repair * of malformed coordinate representations. * * Non-standard keyvalues: * ----------------------- * AIPS-convention celestial projection types, NCP and GLS, and spectral * types, 'FREQ-LSR', 'FELO-HEL', etc., set in CTYPEia are translated * on-the-fly by wcsset() but without modifying the relevant ctype[], pv[] or * specsys members of the wcsprm struct. That is, only the information * extracted from ctype[] is translated when wcsset() fills in wcsprm::cel * (celprm struct) or wcsprm::spc (spcprm struct). * * On the other hand, these routines do change the values of wcsprm::ctype[], * wcsprm::pv[], wcsprm::specsys and other wcsprm struct members as * appropriate to produce the same result as if the FITS header itself had * been translated. * * Auxiliary WCS header information not used directly by WCSLIB may also be * translated. For example, the older DATE-OBS date format (wcsprm::dateobs) * is recast to year-2000 standard form, and MJD-OBS (wcsprm::mjdobs) will be * deduced from it if not already set. * * Certain combinations of keyvalues that result in malformed coordinate * systems, as described in Sect. 7.3.4 of Paper I, may also be repaired. * These are handled by cylfix(). * * Non-standard keywords: * ---------------------- * The AIPS-convention CROTAn keywords are recognized as quasi-standard and * as such are accomodated by the wcsprm::crota[] and translated to * wcsprm::pc[][] by wcsset(). These are not dealt with here, nor are any * other non-standard keywords since these routines work only on the contents * of a wcsprm struct and do not deal with FITS headers per se. In * particular, they do not identify or translate CD00i00j, PC00i00j, PROJPn, * EPOCH, VELREF or VSOURCEa keywords; this may be done by the FITS WCS * header parser supplied with WCSLIB, refer to wcshdr.h. * * wcsfix() and wcsfixi() apply all of the corrections handled by the following * specific functions which may also be invoked separately: * * - cdfix(): Sets the diagonal element of the CDi_ja matrix to 1.0 if all * CDi_ja keywords associated with a particular axis are omitted. * * - datfix(): recast an older DATE-OBS date format in dateobs to year-2000 * standard form and derive mjdobs from it if not already set. * Alternatively, if mjdobs is set and dateobs isn't, then derive dateobs * from it. * * - unitfix(): translate some commonly used but non-standard unit strings in * the CUNITia keyvalues, e.g. 'DEG' -> 'deg'. * * - spcfix(): translate AIPS-convention spectral types, 'FREQ-LSR', * 'FELO-HEL', etc., in ctype[] as set from CTYPEia. * * - celfix(): translate AIPS-convention celestial projection types, NCP and * GLS, in ctype[] as set from CTYPEia. * * - cylfix(): fixes WCS keyvalues for malformed cylindrical projections that * suffer from the problem described in Sect. 7.3.4 of Paper I. * * * wcsfix() - Translate a non-standard WCS struct * ---------------------------------------------- * wcsfix() is identical to wcsfixi(), but lacks the info argument. * * * wcsfixi() - Translate a non-standard WCS struct * ----------------------------------------------- * wcsfix() applies all of the corrections handled separately by cdfix(), * datfix(), unitfix(), spcfix(), celfix(), and cylfix(). * * Given: * ctrl int Do potentially unsafe translations of non-standard * unit strings as described in the usage notes to * wcsutrn(). * * naxis const int [] * Image axis lengths. If this array pointer is set to * zero then cylfix() will not be invoked. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Returned: * stat int [NWCSFIX] * Status returns from each of the functions. Use the * preprocessor macros NWCSFIX to dimension this vector * and CDFIX, DATFIX, UNITFIX, SPCFIX, CELFIX, and CYLFIX * to access its elements. A status value of -2 is set * for functions that were not invoked. * * info struct wcserr [NWCSFIX] * Status messages from each of the functions. Use the * preprocessor macros NWCSFIX to dimension this vector * and CDFIX, DATFIX, UNITFIX, SPCFIX, CELFIX, and CYLFIX * to access its elements. * * Function return value: * int Status return value: * 0: Success. * 1: One or more of the translation functions * returned an error. * * * cdfix() - Fix erroneously omitted CDi_ja keywords * ------------------------------------------------- * cdfix() sets the diagonal element of the CDi_ja matrix to unity if all * CDi_ja keywords associated with a given axis were omitted. According to * Paper I, if any CDi_ja keywords at all are given in a FITS header then those * not given default to zero. This results in a singular matrix with an * intersecting row and column of zeros. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success. * 1: Null wcsprm pointer passed. * * * datfix() - Translate DATE-OBS and derive MJD-OBS or vice versa * -------------------------------------------------------------- * datfix() translates the old DATE-OBS date format set in wcsprm::dateobs to * year-2000 standard form (yyyy-mm-ddThh:mm:ss) and derives MJD-OBS from it if * not already set. Alternatively, if wcsprm::mjdobs is set and * wcsprm::dateobs isn't, then datfix() derives wcsprm::dateobs from it. If * both are set but disagree by more than half a day then status 5 is returned. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. wcsprm::dateobs * and/or wcsprm::mjdobs may be changed. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success. * 1: Null wcsprm pointer passed. * 5: Invalid parameter value. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * Notes: * The MJD algorithms used by datfix() are from D.A. Hatcher, 1984, QJRAS, * 25, 53-55, as modified by P.T. Wallace for use in SLALIB subroutines CLDJ * and DJCL. * * * unitfix() - Correct aberrant CUNITia keyvalues * ---------------------------------------------- * unitfix() applies wcsutrn() to translate non-standard CUNITia keyvalues, * e.g. 'DEG' -> 'deg', also stripping off unnecessary whitespace. * * Given: * ctrl int Do potentially unsafe translations described in the * usage notes to wcsutrn(). * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success (an alias was applied). * 1: Null wcsprm pointer passed. * * When units are translated (i.e. status 0), status -2 * is set in the wcserr struct to allow an informative * message to be returned. * * * spcfix() - Translate AIPS-convention spectral types * --------------------------------------------------- * spcfix() translates AIPS-convention spectral coordinate types, * '{FREQ,FELO,VELO}-{LSR,HEL,OBS}' (e.g. 'FREQ-OBS', 'FELO-HEL', 'VELO-LSR') * set in wcsprm::ctype[], subject to VELREF set in wcsprm::velref. * * Note that if wcs::specsys is already set then it will not be overridden. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. wcsprm::ctype[] * and/or wcsprm::specsys may be changed. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * celfix() - Translate AIPS-convention celestial projection types * --------------------------------------------------------------- * celfix() translates AIPS-convention celestial projection types, NCP and * GLS, set in the ctype[] member of the wcsprm struct. * * Two additional pv[] keyvalues are created when translating NCP, and three * are created when translating GLS with non-zero reference point. If the pv[] * array was initially allocated by wcsini() then the array will be expanded if * necessary. Otherwise, error 2 will be returned if sufficient empty slots * are not already available for use. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. wcsprm::ctype[] * and/or wcsprm::pv[] may be changed. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * cylfix() - Fix malformed cylindrical projections * ------------------------------------------------ * cylfix() fixes WCS keyvalues for malformed cylindrical projections that * suffer from the problem described in Sect. 7.3.4 of Paper I. * * Given: * naxis const int [] * Image axis lengths. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * -1: No change required (not an error). * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * 8: All of the corner pixel coordinates are invalid. * 9: Could not determine reference pixel coordinate. * 10: Could not determine reference pixel value. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * Global variable: const char *wcsfix_errmsg[] - Status return messages * --------------------------------------------------------------------- * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_WCSFIX #define WCSLIB_WCSFIX #include "wcs.h" #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif #define CDFIX 0 #define DATFIX 1 #define UNITFIX 2 #define SPCFIX 3 #define CELFIX 4 #define CYLFIX 5 #define NWCSFIX 6 extern const char *wcsfix_errmsg[]; #define cylfix_errmsg wcsfix_errmsg enum wcsfix_errmsg_enum { FIXERR_DATE_FIX = -4, /* The date formatting has been fixed up. */ FIXERR_SPC_UPDATE = -3, /* Spectral axis type modified. */ FIXERR_UNITS_ALIAS = -2, /* Units alias translation. */ FIXERR_NO_CHANGE = -1, /* No change. */ FIXERR_SUCCESS = 0, /* Success. */ FIXERR_NULL_POINTER = 1, /* Null wcsprm pointer passed. */ FIXERR_MEMORY = 2, /* Memory allocation failed. */ FIXERR_SINGULAR_MTX = 3, /* Linear transformation matrix is singular. */ FIXERR_BAD_CTYPE = 4, /* Inconsistent or unrecognized coordinate axis types. */ FIXERR_BAD_PARAM = 5, /* Invalid parameter value. */ FIXERR_BAD_COORD_TRANS = 6, /* Invalid coordinate transformation parameters. */ FIXERR_ILL_COORD_TRANS = 7, /* Ill-conditioned coordinate transformation parameters. */ FIXERR_BAD_CORNER_PIX = 8, /* All of the corner pixel coordinates are invalid. */ FIXERR_NO_REF_PIX_COORD = 9, /* Could not determine reference pixel coordinate. */ FIXERR_NO_REF_PIX_VAL = 10 /* Could not determine reference pixel value. */ }; int wcsfix(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[]); int wcsfixi(int ctrl, const int naxis[], struct wcsprm *wcs, int stat[], struct wcserr info[]); int cdfix(struct wcsprm *wcs); int datfix(struct wcsprm *wcs); int unitfix(int ctrl, struct wcsprm *wcs); int spcfix(struct wcsprm *wcs); int celfix(struct wcsprm *wcs); int cylfix(const int naxis[], struct wcsprm *wcs); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSFIX */ astropy-0.3/cextern/wcslib/C/wcshdr.h0000644000175000017500000015016212243255342015764 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcshdr.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the wcshdr routines * ------------------------------ * Routines in this suite are aimed at extracting WCS information from a FITS * file. They provide the high-level interface between the FITS file and the * WCS coordinate transformation routines. * * Additionally, function wcshdo() is provided to write out the contents of a * wcsprm struct as a FITS header. * * Briefly, the anticipated sequence of operations is as follows: * * - 1: Open the FITS file and read the image or binary table header, e.g. * using CFITSIO routine fits_hdr2str(). * * - 2: Parse the header using wcspih() or wcsbth(); they will automatically * interpret 'TAB' header keywords using wcstab(). * * - 3: Allocate memory for, and read 'TAB' arrays from the binary table * extension, e.g. using CFITSIO routine fits_read_wcstab() - refer to * the prologue of getwcstab.h. wcsset() will automatically take * control of this allocated memory, in particular causing it to be * free'd by wcsfree(). * * - 4: Translate non-standard WCS usage using wcsfix(), see wcsfix.h. * * - 5: Initialize wcsprm struct(s) using wcsset() and calculate coordinates * using wcsp2s() and/or wcss2p(). Refer to the prologue of wcs.h for a * description of these and other high-level WCS coordinate * transformation routines. * * - 6: Clean up by freeing memory with wcsvfree(). * * In detail: * * - wcspih() is a high-level FITS WCS routine that parses an image header. It * returns an array of up to 27 wcsprm structs on each of which it invokes * wcstab(). * * - wcsbth() is the analogue of wcspih() for use with binary tables; it * handles image array and pixel list keywords. As an extension of the FITS * WCS standard, it also recognizes image header keywords which may be used * to provide default values via an inheritance mechanism. * * - wcstab() assists in filling in members of the wcsprm struct associated * with coordinate lookup tables ('TAB'). These are based on arrays stored * in a FITS binary table extension (BINTABLE) that are located by PVi_ma * keywords in the image header. * * - wcsidx() and wcsbdx() are utility routines that return the index for a * specified alternate coordinate descriptor in the array of wcsprm structs * returned by wcspih() or wcsbth(). * * - wcsvfree() deallocates memory for an array of wcsprm structs, such as * returned by wcspih() or wcsbth(). * * - wcshdo() writes out a wcsprm struct as a FITS header. * * * wcspih() - FITS WCS parser routine for image headers * ---------------------------------------------------- * wcspih() is a high-level FITS WCS routine that parses an image header, * either that of a primary HDU or of an image extension. All WCS keywords * defined in Papers I, II, and III are recognized, and also those used by the * AIPS convention and certain other keywords that existed in early drafts of * the WCS papers as explained in wcsbth() note 5. * * Given a character array containing a FITS image header, wcspih() identifies * and reads all WCS keywords for the primary coordinate representation and up * to 26 alternate representations. It returns this information as an array of * wcsprm structs. * * wcspih() invokes wcstab() on each of the wcsprm structs that it returns. * * Use wcsbth() in preference to wcspih() for FITS headers of unknown type; * wcsbth() can parse image headers as well as binary table and pixel list * headers. * * Given and returned: * header char[] Character array containing the (entire) FITS image * header from which to identify and construct the * coordinate representations, for example, as might be * obtained conveniently via the CFITSIO routine * fits_hdr2str(). * * Each header "keyrecord" (formerly "card image") * consists of exactly 80 7-bit ASCII printing characters * in the range 0x20 to 0x7e (which excludes NUL, BS, * TAB, LF, FF and CR) especially noting that the * keyrecords are NOT null-terminated. * * For negative values of ctrl (see below), header[] is * modified so that WCS keyrecords processed by wcspih() * are removed from it. * * Given: * nkeyrec int Number of keyrecords in header[]. * * relax int Degree of permissiveness: * 0: Recognize only FITS keywords defined by the * published WCS standard. * WCSHDR_all: Admit all recognized informal * extensions of the WCS standard. * Fine-grained control of the degree of permissiveness * is also possible as explained in wcsbth() note 5. * * ctrl int Error reporting and other control options for invalid * WCS and other header keyrecords: * 0: Do not report any rejected header keyrecords. * 1: Produce a one-line message stating the number * of WCS keyrecords rejected (nreject). * 2: Report each rejected keyrecord and the reason * why it was rejected. * 3: As above, but also report all non-WCS * keyrecords that were discarded, and the number * of coordinate representations (nwcs) found. * The report is written to stderr by default, or the * stream set by wcsprintf_set(). * * For ctrl < 0, WCS keyrecords processed by wcspih() * are removed from header[]: * -1: Remove only valid WCS keyrecords whose values * were successfully extracted, nothing is * reported. * -2: Also remove WCS keyrecords that were rejected, * reporting each one and the reason that it was * rejected. * -3: As above, and also report the number of * coordinate representations (nwcs) found. * -11: Same as -1 but preserving the basic keywords * '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'. * If any keyrecords are removed from header[] it will * be null-terminated (NUL not being a legal FITS header * character), otherwise it will contain its original * complement of nkeyrec keyrecords and possibly not be * null-terminated. * * Returned: * nreject int* Number of WCS keywords rejected for syntax errors, * illegal values, etc. Keywords not recognized as WCS * keywords are simply ignored. Refer also to wcsbth() * note 5. * * nwcs int* Number of coordinate representations found. * * wcs struct wcsprm** * Pointer to an array of wcsprm structs containing up to * 27 coordinate representations. * * Memory for the array is allocated by wcspih() which * also invokes wcsini() for each struct to allocate * memory for internal arrays and initialize their * members to default values. Refer also to wcsbth() * note 8. Note that wcsset() is not invoked on these * structs. * * This allocated memory must be freed by the user, first * by invoking wcsfree() for each struct, and then by * freeing the array itself. A routine, wcsvfree(), is * provided to do this (see below). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 4: Fatal error returned by Flex parser. * * Notes: * Refer to wcsbth() notes 1, 2, 3, 5, 7, and 8. * * * wcsbth() - FITS WCS parser routine for binary table and image headers * --------------------------------------------------------------------- * wcsbth() is a high-level FITS WCS routine that parses a binary table header. * It handles image array and pixel list WCS keywords which may be present * together in one header. * * As an extension of the FITS WCS standard, wcsbth() also recognizes image * header keywords in a binary table header. These may be used to provide * default values via an inheritance mechanism discussed in note 5 (c.f. * WCSHDR_AUXIMG and WCSHDR_ALLIMG), or may instead result in wcsprm structs * that are not associated with any particular column. Thus wcsbth() can * handle primary image and image extension headers in addition to binary table * headers (it ignores NAXIS and does not rely on the presence of the TFIELDS * keyword). * * All WCS keywords defined in Papers I, II, and III are recognized, and also * those used by the AIPS convention and certain other keywords that existed in * early drafts of the WCS papers as explained in note 5 below. * * wcsbth() sets the colnum or colax[] members of the wcsprm structs that it * returns with the column number of an image array or the column numbers * associated with each pixel coordinate element in a pixel list. wcsprm * structs that are not associated with any particular column, as may be * derived from image header keywords, have colnum == 0. * * Note 6 below discusses the number of wcsprm structs returned by wcsbth(), * and the circumstances in which image header keywords cause a struct to be * created. See also note 9 concerning the number of separate images that may * be stored in a pixel list. * * The API to wcsbth() is similar to that of wcspih() except for the addition * of extra arguments that may be used to restrict its operation. Like * wcspih(), wcsbth() invokes wcstab() on each of the wcsprm structs that it * returns. * * Given and returned: * header char[] Character array containing the (entire) FITS binary * table, primary image, or image extension header from * which to identify and construct the coordinate * representations, for example, as might be obtained * conveniently via the CFITSIO routine fits_hdr2str(). * * Each header "keyrecord" (formerly "card image") * consists of exactly 80 7-bit ASCII printing * characters in the range 0x20 to 0x7e (which excludes * NUL, BS, TAB, LF, FF and CR) especially noting that * the keyrecords are NOT null-terminated. * * For negative values of ctrl (see below), header[] is * modified so that WCS keyrecords processed by wcsbth() * are removed from it. * * Given: * nkeyrec int Number of keyrecords in header[]. * * relax int Degree of permissiveness: * 0: Recognize only FITS keywords defined by the * published WCS standard. * WCSHDR_all: Admit all recognized informal * extensions of the WCS standard. * Fine-grained control of the degree of permissiveness * is also possible, as explained in note 5 below. * * ctrl int Error reporting and other control options for invalid * WCS and other header keyrecords: * 0: Do not report any rejected header keyrecords. * 1: Produce a one-line message stating the number * of WCS keyrecords rejected (nreject). * 2: Report each rejected keyrecord and the reason * why it was rejected. * 3: As above, but also report all non-WCS * keyrecords that were discarded, and the number * of coordinate representations (nwcs) found. * The report is written to stderr by default, or the * stream set by wcsprintf_set(). * * For ctrl < 0, WCS keyrecords processed by wcsbth() * are removed from header[]: * -1: Remove only valid WCS keyrecords whose values * were successfully extracted, nothing is * reported. * -2: Also remove WCS keyrecords that were rejected, * reporting each one and the reason that it was * rejected. * -3: As above, and also report the number of * coordinate representations (nwcs) found. * -11: Same as -1 but preserving the basic keywords * '{DATE,MJD}-{OBS,AVG}' and 'OBSGEO-{X,Y,Z}'. * If any keyrecords are removed from header[] it will * be null-terminated (NUL not being a legal FITS header * character), otherwise it will contain its original * complement of nkeyrec keyrecords and possibly not be * null-terminated. * * keysel int Vector of flag bits that may be used to restrict the * keyword types considered: * WCSHDR_IMGHEAD: Image header keywords. * WCSHDR_BIMGARR: Binary table image array. * WCSHDR_PIXLIST: Pixel list keywords. * If zero, there is no restriction. * * Keywords such as EQUIna or RFRQna that are common to * binary table image arrays and pixel lists (including * WCSNna and TWCSna, as explained in note 4 below) are * selected by both WCSHDR_BIMGARR and WCSHDR_PIXLIST. * Thus if inheritance via WCSHDR_ALLIMG is enabled as * discussed in note 5 and one of these shared keywords * is present, then WCSHDR_IMGHEAD and WCSHDR_PIXLIST * alone may be sufficient to cause the construction of * coordinate descriptions for binary table image arrays. * * colsel int* Pointer to an array of table column numbers used to * restrict the keywords considered by wcsbth(). * * A null pointer may be specified to indicate that there * is no restriction. Otherwise, the magnitude of * cols[0] specifies the length of the array: * cols[0] > 0: the columns are included, * cols[0] < 0: the columns are excluded. * * For the pixel list keywords TPn_ka and TCn_ka (and * TPCn_ka and TCDn_ka if WCSHDR_LONGKEY is enabled), it * is an error for one column to be selected but not the * other. This is unlike the situation with invalid * keyrecords, which are simply rejected, because the * error is not intrinsic to the header itself but * arises in the way that it is processed. * * Returned: * nreject int* Number of WCS keywords rejected for syntax errors, * illegal values, etc. Keywords not recognized as WCS * keywords are simply ignored, refer also to note 5 * below. * * nwcs int* Number of coordinate representations found. * * wcs struct wcsprm** * Pointer to an array of wcsprm structs containing up * to 27027 coordinate representations, refer to note 6 * below. * * Memory for the array is allocated by wcsbth() which * also invokes wcsini() for each struct to allocate * memory for internal arrays and initialize their * members to default values. Refer also to note 8 * below. Note that wcsset() is not invoked on these * structs. * * This allocated memory must be freed by the user, first * by invoking wcsfree() for each struct, and then by * freeing the array itself. A routine, wcsvfree(), is * provided to do this (see below). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Invalid column selection. * 4: Fatal error returned by Flex parser. * * Notes: * 1: wcspih() determines the number of coordinate axes independently for * each alternate coordinate representation (denoted by the "a" value in * keywords like CTYPEia) from the higher of * * a: NAXIS, * b: WCSAXESa, * c: The highest axis number in any parameterized WCS keyword. The * keyvalue, as well as the keyword, must be syntactically valid * otherwise it will not be considered. * * If none of these keyword types is present, i.e. if the header only * contains auxiliary WCS keywords for a particular coordinate * representation, then no coordinate description is constructed for it. * * wcsbth() is similar except that it ignores the NAXIS keyword if given * an image header to process. * * The number of axes, which is returned as a member of the wcsprm * struct, may differ for different coordinate representations of the * same image. * * 2: wcspih() and wcsbth() enforce correct FITS "keyword = value" syntax * with regard to "= " occurring in columns 9 and 10. * * However, they do recognize free-format character (NOST 100-2.0, * Sect. 5.2.1), integer (Sect. 5.2.3), and floating-point values * (Sect. 5.2.4) for all keywords. * * 3: Where CROTAn, CDi_ja, and PCi_ja occur together in one header wcspih() * and wcsbth() treat them as described in the prologue to wcs.h. * * 4: WCS Paper I mistakenly defined the pixel list form of WCSNAMEa as * TWCSna instead of WCSNna; the 'T' is meant to substitute for the axis * number in the binary table form of the keyword - note that keywords * defined in WCS Papers II and III that are not parameterised by axis * number have identical forms for binary tables and pixel lists. * Consequently wcsbth() always treats WCSNna and TWCSna as equivalent. * * 5: wcspih() and wcsbth() interpret the "relax" argument as a vector of * flag bits to provide fine-grained control over what non-standard WCS * keywords to accept. The flag bits are subject to change in future and * should be set by using the preprocessor macros (see below) for the * purpose. * * - WCSHDR_none: Don't accept any extensions (not even those in the * errata). Treat non-conformant keywords in the same way as * non-WCS keywords in the header, i.e. simply ignore them. * * - WCSHDR_all: Accept all extensions recognized by the parser. * * - WCSHDR_reject: Reject non-standard keywords (that are not otherwise * accepted). A message will optionally be printed on stderr by * default, or the stream set by wcsprintf_set(), as determined by * the ctrl argument, and nreject will be incremented. * * This flag may be used to signal the presence of non-standard * keywords, otherwise they are simply passed over as though they * did not exist in the header. * * Useful for testing conformance of a FITS header to the WCS * standard. * * - WCSHDR_CROTAia: Accept CROTAia (wcspih()), * iCROTna (wcsbth()), * TCROTna (wcsbth()). * - WCSHDR_EPOCHa: Accept EPOCHa. * - WCSHDR_VELREFa: Accept VELREFa. * wcspih() always recognizes the AIPS-convention keywords, * CROTAn, EPOCH, and VELREF for the primary representation * (a = ' ') but alternates are non-standard. * * wcsbth() accepts EPOCHa and VELREFa only if WCSHDR_AUXIMG is * also enabled. * * - WCSHDR_CD00i00j: Accept CD00i00j (wcspih()). * - WCSHDR_PC00i00j: Accept PC00i00j (wcspih()). * - WCSHDR_PROJPn: Accept PROJPn (wcspih()). * These appeared in early drafts of WCS Paper I+II (before they * were split) and are equivalent to CDi_ja, PCi_ja, and PVi_ma * for the primary representation (a = ' '). PROJPn is * equivalent to PVi_ma with m = n <= 9, and is associated * exclusively with the latitude axis. * * - WCSHDR_RADECSYS: Accept RADECSYS. This appeared in early drafts of * WCS Paper I+II and was subsequently replaced by RADESYSa. * * wcsbth() accepts RADECSYS only if WCSHDR_AUXIMG is also * enabled. * * - WCSHDR_VSOURCE: Accept VSOURCEa or VSOUna (wcsbth()). This appeared * in early drafts of WCS Paper III and was subsequently dropped * in favour of ZSOURCEa and ZSOUna. * * wcsbth() accepts VSOURCEa only if WCSHDR_AUXIMG is also * enabled. * * - WCSHDR_DOBSn (wcsbth() only): Allow DOBSn, the column-specific analogue * of DATE-OBS. By an oversight this was never formally defined * in the standard. * * - WCSHDR_LONGKEY (wcsbth() only): Accept long forms of the alternate * binary table and pixel list WCS keywords, i.e. with "a" non- * blank. Specifically * # jCRPXna TCRPXna : jCRPXn jCRPna TCRPXn TCRPna CRPIXja # - TPCn_ka : - ijPCna - TPn_ka PCi_ja # - TCDn_ka : - ijCDna - TCn_ka CDi_ja # iCDLTna TCDLTna : iCDLTn iCDEna TCDLTn TCDEna CDELTia # iCUNIna TCUNIna : iCUNIn iCUNna TCUNIn TCUNna CUNITia # iCTYPna TCTYPna : iCTYPn iCTYna TCTYPn TCTYna CTYPEia # iCRVLna TCRVLna : iCRVLn iCRVna TCRVLn TCRVna CRVALia # iPVn_ma TPVn_ma : - iVn_ma - TVn_ma PVi_ma # iPSn_ma TPSn_ma : - iSn_ma - TSn_ma PSi_ma * * where the primary and standard alternate forms together with * the image-header equivalent are shown rightwards of the colon. * * The long form of these keywords could be described as quasi- * standard. TPCn_ka, iPVn_ma, and TPVn_ma appeared by mistake * in the examples in WCS Paper II and subsequently these and * also TCDn_ka, iPSn_ma and TPSn_ma were legitimized by the * errata to the WCS papers. * * Strictly speaking, the other long forms are non-standard and * in fact have never appeared in any draft of the WCS papers nor * in the errata. However, as natural extensions of the primary * form they are unlikely to be written with any other intention. * Thus it should be safe to accept them provided, of course, * that the resulting keyword does not exceed the 8-character * limit. * * If WCSHDR_CNAMn is enabled then also accept * # iCNAMna TCNAMna : --- iCNAna --- TCNAna CNAMEia # iCRDEna TCRDEna : --- iCRDna --- TCRDna CRDERia # iCSYEna TCSYEna : --- iCSYna --- TCSYna CSYERia * * Note that CNAMEia, CRDERia, CSYERia, and their variants are * not used by WCSLIB but are stored in the wcsprm struct as * auxiliary information. * * - WCSHDR_CNAMn (wcsbth() only): Accept iCNAMn, iCRDEn, iCSYEn, TCNAMn, * TCRDEn, and TCSYEn, i.e. with "a" blank. While non-standard, * these are the obvious analogues of iCTYPn, TCTYPn, etc. * * - WCSHDR_AUXIMG (wcsbth() only): Allow the image-header form of an * auxiliary WCS keyword with representation-wide scope to * provide a default value for all images. This default may be * overridden by the column-specific form of the keyword. * * For example, a keyword like EQUINOXa would apply to all image * arrays in a binary table, or all pixel list columns with * alternate representation "a" unless overridden by EQUIna. * * Specifically the keywords are: * # LATPOLEa for LATPna # LONPOLEa for LONPna # RESTFREQ for RFRQna # RESTFRQa for RFRQna # RESTWAVa for RWAVna * * whose keyvalues are actually used by WCSLIB, and also keywords * that provide auxiliary information that is simply stored in * the wcsprm struct: * # EPOCH - ... (No column-specific form.) # EPOCHa - ... Only if WCSHDR_EPOCHa is set. # EQUINOXa for EQUIna # RADESYSa for RADEna # RADECSYS for RADEna ... Only if WCSHDR_RADECSYS is set. # SPECSYSa for SPECna # SSYSOBSa for SOBSna # SSYSSRCa for SSRCna # VELOSYSa for VSYSna # VELANGLa for VANGna # VELREF - ... (No column-specific form.) # VELREFa - ... Only if WCSHDR_VELREFa is set. # VSOURCEa for VSOUna ... Only if WCSHDR_VSOURCE is set. # WCSNAMEa for WCSNna ... Or TWCSna (see below). # ZSOURCEa for ZSOUna * # DATE-AVG for DAVGn # DATE-OBS for DOBSn # MJD-AVG for MJDAn # MJD-OBS for MJDOBn # OBSGEO-X for OBSGXn # OBSGEO-Y for OBSGYn # OBSGEO-Z for OBSGZn * * where the image-header keywords on the left provide default * values for the column specific keywords on the right. * * Keywords in the last group, such as MJD-OBS, apply to all * alternate representations, so MJD-OBS would provide a default * value for all images in the header. * * This auxiliary inheritance mechanism applies to binary table * image arrays and pixel lists alike. Most of these keywords * have no default value, the exceptions being LONPOLEa and * LATPOLEa, and also RADESYSa and EQUINOXa which provide * defaults for each other. Thus the only potential difficulty * in using WCSHDR_AUXIMG is that of erroneously inheriting one * of these four keywords. * * Unlike WCSHDR_ALLIMG, the existence of one (or all) of these * auxiliary WCS image header keywords will not by itself cause a * wcsprm struct to be created for alternate representation "a". * This is because they do not provide sufficient information to * create a non-trivial coordinate representation when used in * conjunction with the default values of those keywords, such as * CTYPEia, that are parameterized by axis number. * * - WCSHDR_ALLIMG (wcsbth() only): Allow the image-header form of *all* * image header WCS keywords to provide a default value for all * image arrays in a binary table (n.b. not pixel list). This * default may be overridden by the column-specific form of the * keyword. * * For example, a keyword like CRPIXja would apply to all image * arrays in a binary table with alternate representation "a" * unless overridden by jCRPna. * * Specifically the keywords are those listed above for * WCSHDR_AUXIMG plus * # WCSAXESa for WCAXna * * which defines the coordinate dimensionality, and the following * keywords which are parameterized by axis number: * # CRPIXja for jCRPna # PCi_ja for ijPCna # CDi_ja for ijCDna # CDELTia for iCDEna # CROTAi for iCROTn # CROTAia - ... Only if WCSHDR_CROTAia is set. # CUNITia for iCUNna # CTYPEia for iCTYna # CRVALia for iCRVna # PVi_ma for iVn_ma # PSi_ma for iSn_ma * # CNAMEia for iCNAna # CRDERia for iCRDna # CSYERia for iCSYna * * where the image-header keywords on the left provide default * values for the column specific keywords on the right. * * This full inheritance mechanism only applies to binary table * image arrays, not pixel lists, because in the latter case * there is no well-defined association between coordinate axis * number and column number. * * Note that CNAMEia, CRDERia, CSYERia, and their variants are * not used by WCSLIB but are stored in the wcsprm struct as * auxiliary information. * * Note especially that at least one wcsprm struct will be * returned for each "a" found in one of the image header * keywords listed above: * * - If the image header keywords for "a" ARE NOT inherited by a * binary table, then the struct will not be associated with * any particular table column number and it is up to the user * to provide an association. * * - If the image header keywords for "a" ARE inherited by a * binary table image array, then those keywords are considered * to be "exhausted" and do not result in a separate wcsprm * struct. * * For example, to accept CD00i00j and PC00i00j and reject all other * extensions, use * = relax = WCSHDR_reject | WCSHDR_CD00i00j | WCSHDR_PC00i00j; * * The parser always treats EPOCH as subordinate to EQUINOXa if both are * present, and VSOURCEa is always subordinate to ZSOURCEa. * * Likewise, VELREF is subordinate to the formalism of WCS Paper III, see * spcaips(). * * Neither wcspih() nor wcsbth() currently recognize the AIPS-convention * keywords ALTRPIX or ALTRVAL which effectively define an alternative * representation for a spectral axis. * * 6: Depending on what flags have been set in its "relax" argument, * wcsbth() could return as many as 27027 wcsprm structs: * * - Up to 27 unattached representations derived from image header * keywords. * * - Up to 27 structs for each of up to 999 columns containing an image * arrays. * * - Up to 27 structs for a pixel list. * * Note that it is considered legitimate for a column to contain an image * array and also form part of a pixel list, and in particular that * wcsbth() does not check the TFORM keyword for a pixel list column to * check that it is scalar. * * In practice, of course, a realistic binary table header is unlikely to * contain more than a handful of images. * * In order for wcsbth() to create a wcsprm struct for a particular * coordinate representation, at least one WCS keyword that defines an * axis number must be present, either directly or by inheritance if * WCSHDR_ALLIMG is set. * * When the image header keywords for an alternate representation are * inherited by a binary table image array via WCSHDR_ALLIMG, those * keywords are considered to be "exhausted" and do not result in a * separate wcsprm struct. Otherwise they do. * * 7: Neither wcspih() nor wcsbth() check for duplicated keywords, in most * cases they accept the last encountered. * * 8: wcspih() and wcsbth() use wcsnpv() and wcsnps() (refer to the prologue * of wcs.h) to match the size of the pv[] and ps[] arrays in the wcsprm * structs to the number in the header. Consequently there are no unused * elements in the pv[] and ps[] arrays, indeed they will often be of * zero length. * * 9: The FITS WCS standard for pixel lists assumes that a pixel list * defines one and only one image, i.e. that each row of the binary table * refers to just one event, e.g. the detection of a single photon or * neutrino. * * In the absence of a formal mechanism for identifying the columns * containing pixel coordinates (as opposed to pixel values or ancillary * data recorded at the time the photon or neutrino was detected), * Paper I discusses how the WCS keywords themselves may be used to * identify them. * * In practice, however, pixel lists have been used to store multiple * images. Besides not specifying how to identify columns, the pixel * list convention is also silent on the method to be used to associate * table columns with image axes. * * wcsbth() simply collects all WCS keywords for a particular coordinate * representation (i.e. the "a" value in TCTYna) into one wcsprm struct. * However, these alternates need not be associated with the same table * columns and this allows a pixel list to contain up to 27 separate * images. As usual, if one of these representations happened to contain * more than two celestial axes, for example, then an error would result * when wcsset() is invoked on it. In this case the "colsel" argument * could be used to restrict the columns used to construct the * representation so that it only contained one pair of celestial axes. * * * wcstab() - Tabular construction routine * --------------------------------------- * wcstab() assists in filling in the information in the wcsprm struct relating * to coordinate lookup tables. * * Tabular coordinates ('TAB') present certain difficulties in that the main * components of the lookup table - the multidimensional coordinate array plus * an index vector for each dimension - are stored in a FITS binary table * extension (BINTABLE). Information required to locate these arrays is stored * in PVi_ma and PSi_ma keywords in the image header. * * wcstab() parses the PVi_ma and PSi_ma keywords associated with each 'TAB' * axis and allocates memory in the wcsprm struct for the required number of * tabprm structs. It sets as much of the tabprm struct as can be gleaned from * the image header, and also sets up an array of wtbarr structs (described in * the prologue of wcs.h) to assist in extracting the required arrays from the * BINTABLE extension(s). * * It is then up to the user to allocate memory for, and copy arrays from the * BINTABLE extension(s) into the tabprm structs. A CFITSIO routine, * fits_read_wcstab(), has been provided for this purpose, see getwcstab.h. * wcsset() will automatically take control of this allocated memory, in * particular causing it to be free'd by wcsfree(); the user must not attempt * to free it after wcsset() has been called. * * Note that wcspih() and wcsbth() automatically invoke wcstab() on each of the * wcsprm structs that they return. * * Given and returned: * wcs struct wcsprm* * Coordinate transformation parameters (see below). * * wcstab() sets ntab, tab, nwtb and wtb, allocating * memory for the tab and wtb arrays. This allocated * memory will be free'd automatically by wcsfree(). * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Invalid tabular parameters. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * * wcsidx() - Index alternate coordinate representations * ----------------------------------------------------- * wcsidx() returns an array of 27 indices for the alternate coordinate * representations in the array of wcsprm structs returned by wcspih(). For * the array returned by wcsbth() it returns indices for the unattached * (colnum == 0) representations derived from image header keywords - use * wcsbdx() for those derived from binary table image arrays or pixel lists * keywords. * * Given: * nwcs int Number of coordinate representations in the array. * * wcs const struct wcsprm** * Pointer to an array of wcsprm structs returned by * wcspih() or wcsbth(). * * Returned: * alts int[27] Index of each alternate coordinate representation in * the array: alts[0] for the primary, alts[1] for 'A', * etc., set to -1 if not present. * * For example, if there was no 'P' representation then * = alts['P'-'A'+1] == -1; * * Otherwise, the address of its wcsprm struct would be * = wcs + alts['P'-'A'+1]; * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcsbdx() - Index alternate coordinate representions * --------------------------------------------------- * wcsbdx() returns an array of 999 x 27 indices for the alternate coordinate * representions for binary table image arrays xor pixel lists in the array of * wcsprm structs returned by wcsbth(). Use wcsidx() for the unattached * representations derived from image header keywords. * * Given: * nwcs int Number of coordinate representations in the array. * * wcs const struct wcsprm** * Pointer to an array of wcsprm structs returned by * wcsbth(). * * type int Select the type of coordinate representation: * 0: binary table image arrays, * 1: pixel lists. * * Returned: * alts short[1000][28] * Index of each alternate coordinate represention in the * array: alts[col][0] for the primary, alts[col][1] for * 'A', to alts[col][26] for 'Z', where col is the * 1-relative column number, and col == 0 is used for * unattached image headers. Set to -1 if not present. * * alts[col][27] counts the number of coordinate * representations of the chosen type for each column. * * For example, if there was no 'P' represention for * column 13 then * = alts[13]['P'-'A'+1] == -1; * * Otherwise, the address of its wcsprm struct would be * = wcs + alts[13]['P'-'A'+1]; * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcsvfree() - Free the array of wcsprm structs * --------------------------------------------- * wcsvfree() frees the memory allocated by wcspih() or wcsbth() for the array * of wcsprm structs, first invoking wcsfree() on each of the array members. * * Given and returned: * nwcs int* Number of coordinate representations found; set to 0 * on return. * * wcs struct wcsprm** * Pointer to the array of wcsprm structs; set to 0 on * return. * * Function return value: * int Status return value: * 0: Success. * 1: Null wcsprm pointer passed. * * * wcshdo() - Write out a wcsprm struct as a FITS header * ----------------------------------------------------- * wcshdo() translates a wcsprm struct into a FITS header. If the colnum * member of the struct is non-zero then a binary table image array header will * be produced. Otherwise, if the colax[] member of the struct is set non-zero * then a pixel list header will be produced. Otherwise, a primary image or * image extension header will be produced. * * If the struct was originally constructed from a header, e.g. by wcspih(), * the output header will almost certainly differ in a number of respects: * * - The output header only contains WCS-related keywords. In particular, it * does not contain syntactically-required keywords such as SIMPLE, NAXIS, * BITPIX, or END. * * - Deprecated (e.g. CROTAn) or non-standard usage will be translated to * standard (this is partially dependent on whether wcsfix() was applied). * * - Quantities will be converted to the units used internally, basically SI * with the addition of degrees. * * - Floating-point quantities may be given to a different decimal precision. * * - Elements of the PCi_ja matrix will be written if and only if they differ * from the unit matrix. Thus, if the matrix is unity then no elements * will be written. * * - Additional keywords such as WCSAXESa, CUNITia, LONPOLEa and LATPOLEa may * appear. * * - The original keycomments will be lost, although wcshdo() tries hard to * write meaningful comments. * * - Keyword order may be changed. * * Keywords can be translated between the image array, binary table, and pixel * lists forms by manipulating the colnum or colax[] members of the wcsprm * struct. * * Given: * relax int Degree of permissiveness: * 0: Recognize only FITS keywords defined by the * published WCS standard. * -1: Admit all informal extensions of the WCS * standard. * Fine-grained control of the degree of permissiveness * is also possible as explained in the notes below. * * Given and returned: * wcs struct wcsprm* * Pointer to a wcsprm struct containing coordinate * transformation parameters. Will be initialized if * necessary. * * Returned: * nkeyrec int* Number of FITS header keyrecords returned in the * "header" array. * * header char** Pointer to an array of char holding the header. * Storage for the array is allocated by wcshdo() in * blocks of 2880 bytes (32 x 80-character keyrecords) * and must be free'd by the user to avoid memory leaks. * * Each keyrecord is 80 characters long and is *NOT* * null-terminated, so the first keyrecord starts at * (*header)[0], the second at (*header)[80], etc. * * Function return value: * int Status return value (associated with wcs_errmsg[]): * 0: Success. * 1: Null wcsprm pointer passed. * 2: Memory allocation failed. * 3: Linear transformation matrix is singular. * 4: Inconsistent or unrecognized coordinate axis * types. * 5: Invalid parameter value. * 6: Invalid coordinate transformation parameters. * 7: Ill-conditioned coordinate transformation * parameters. * * For returns > 1, a detailed error message is set in * wcsprm::err if enabled, see wcserr_enable(). * * Notes: * wcshdo() interprets the "relax" argument as a vector of flag bits to * provide fine-grained control over what non-standard WCS keywords to write. * The flag bits are subject to change in future and should be set by using * the preprocessor macros (see below) for the purpose. * * - WCSHDO_none: Don't use any extensions. * * - WCSHDO_all: Write all recognized extensions, equivalent to setting each * flag bit. * * - WCSHDO_safe: Write all extensions that are considered to be safe and * recommended. * * - WCSHDO_DOBSn: Write DOBSn, the column-specific analogue of DATE-OBS for * use in binary tables and pixel lists. WCS Paper III introduced * DATE-AVG and DAVGn but by an oversight DOBSn (the obvious analogy) * was never formally defined by the standard. The alternative to * using DOBSn is to write DATE-OBS which applies to the whole table. * This usage is considered to be safe and is recommended. * * - WCSHDO_TPCn_ka: WCS Paper I defined * * - TPn_ka and TCn_ka for pixel lists * * but WCS Paper II uses TPCn_ka in one example and subsequently the * errata for the WCS papers legitimized the use of * * - TPCn_ka and TCDn_ka for pixel lists * * provided that the keyword does not exceed eight characters. This * usage is considered to be safe and is recommended because of the * non-mnemonic terseness of the shorter forms. * * - WCSHDO_PVn_ma: WCS Paper I defined * * - iVn_ma and iSn_ma for bintables and * - TVn_ma and TSn_ma for pixel lists * * but WCS Paper II uses iPVn_ma and TPVn_ma in the examples and * subsequently the errata for the WCS papers legitimized the use of * * - iPVn_ma and iPSn_ma for bintables and * - TPVn_ma and TPSn_ma for pixel lists * * provided that the keyword does not exceed eight characters. This * usage is considered to be safe and is recommended because of the * non-mnemonic terseness of the shorter forms. * * - WCSHDO_CRPXna: For historical reasons WCS Paper I defined * * - jCRPXn, iCDLTn, iCUNIn, iCTYPn, and iCRVLn for bintables and * - TCRPXn, TCDLTn, TCUNIn, TCTYPn, and TCRVLn for pixel lists * * for use without an alternate version specifier. However, because * of the eight-character keyword constraint, in order to accommodate * column numbers greater than 99 WCS Paper I also defined * * - jCRPna, iCDEna, iCUNna, iCTYna and iCRVna for bintables and * - TCRPna, TCDEna, TCUNna, TCTYna and TCRVna for pixel lists * * for use with an alternate version specifier (the "a"). Like the * PC, CD, PV, and PS keywords there is an obvious tendency to * confuse these two forms for column numbers up to 99. It is very * unlikely that any parser would reject keywords in the first set * with a non-blank alternate version specifier so this usage is * considered to be safe and is recommended. * * - WCSHDO_CNAMna: WCS Papers I and III defined * * - iCNAna, iCRDna, and iCSYna for bintables and * - TCNAna, TCRDna, and TCSYna for pixel lists * * By analogy with the above, the long forms would be * * - iCNAMna, iCRDEna, and iCSYEna for bintables and * - TCNAMna, TCRDEna, and TCSYEna for pixel lists * * Note that these keywords provide auxiliary information only, none * of them are needed to compute world coordinates. This usage is * potentially unsafe and is not recommended at this time. * * - WCSHDO_WCSNna: In light of wcsbth() note 4, write WCSNna instead of * TWCSna for pixel lists. While wcsbth() treats WCSNna and TWCSna * as equivalent, other parsers may not. Consequently, this usage * is potentially unsafe and is not recommended at this time. * * * Global variable: const char *wcshdr_errmsg[] - Status return messages * --------------------------------------------------------------------- * Error messages to match the status value returned from each function. * Use wcs_errmsg[] for status returns from wcshdo(). * *===========================================================================*/ #ifndef WCSLIB_WCSHDR #define WCSLIB_WCSHDR #include "wcs.h" #ifdef __cplusplus extern "C" { #endif #define WCSHDR_none 0x00000000 #define WCSHDR_all 0x000FFFFF #define WCSHDR_reject 0x10000000 #define WCSHDR_CROTAia 0x00000001 #define WCSHDR_EPOCHa 0x00000002 #define WCSHDR_VELREFa 0x00000004 #define WCSHDR_CD00i00j 0x00000008 #define WCSHDR_PC00i00j 0x00000010 #define WCSHDR_PROJPn 0x00000020 #define WCSHDR_RADECSYS 0x00000040 #define WCSHDR_VSOURCE 0x00000080 #define WCSHDR_DOBSn 0x00000100 #define WCSHDR_LONGKEY 0x00000200 #define WCSHDR_CNAMn 0x00000400 #define WCSHDR_AUXIMG 0x00000800 #define WCSHDR_ALLIMG 0x00001000 #define WCSHDR_IMGHEAD 0x00010000 #define WCSHDR_BIMGARR 0x00020000 #define WCSHDR_PIXLIST 0x00040000 #define WCSHDO_none 0x00 #define WCSHDO_all 0xFF #define WCSHDO_safe 0x0F #define WCSHDO_DOBSn 0x01 #define WCSHDO_TPCn_ka 0x02 #define WCSHDO_PVn_ma 0x04 #define WCSHDO_CRPXna 0x08 #define WCSHDO_CNAMna 0x10 #define WCSHDO_WCSNna 0x20 extern const char *wcshdr_errmsg[]; enum wcshdr_errmsg_enum { WCSHDRERR_SUCCESS = 0, /* Success. */ WCSHDRERR_NULL_POINTER = 1, /* Null wcsprm pointer passed. */ WCSHDRERR_MEMORY = 2, /* Memory allocation failed. */ WCSHDRERR_BAD_COLUMN = 3, /* Invalid column selection. */ WCSHDRERR_PARSER = 4, /* Fatal error returned by Flex parser. */ WCSHDRERR_BAD_TABULAR_PARAMS = 5 /* Invalid tabular parameters. */ }; int wcspih(char *header, int nkeyrec, int relax, int ctrl, int *nreject, int *nwcs, struct wcsprm **wcs); int wcsbth(char *header, int nkeyrec, int relax, int ctrl, int keysel, int *colsel, int *nreject, int *nwcs, struct wcsprm **wcs); int wcstab(struct wcsprm *wcs); int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]); int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]); int wcsvfree(int *nwcs, struct wcsprm **wcs); int wcshdo(int relax, struct wcsprm *wcs, int *nkeyrec, char **header); #ifdef __cplusplus } #endif #endif /* WCSLIB_WCSHDR */ astropy-0.3/cextern/wcslib/C/spc.c0000644000175000017500000010646712243255342015263 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: spc.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcstrig.h" #include "wcsutil.h" #include "spc.h" #include "spx.h" /* Spectral algorithm codes. */ #define F2S 100; /* Axis linear in frequency. */ #define W2S 200; /* Axis linear in vacuum wavelengths. */ #define A2S 300; /* Axis linear in air wavelengths. */ #define V2S 400; /* Axis linear in velocity. */ #define GRI 500; /* Grism in vacuum. */ #define GRA 600; /* Grism in air. */ /* S-type spectral variables. */ #define FREQ 0; /* Frequency-like. */ #define AFRQ 1; /* Frequency-like. */ #define ENER 2; /* Frequency-like. */ #define WAVN 3; /* Frequency-like. */ #define VRAD 4; /* Frequency-like. */ #define WAVE 10; /* Vacuum wavelength-like. */ #define VOPT 11; /* Vacuum wavelength-like. */ #define ZOPT 12; /* Vacuum wavelength-like. */ #define AWAV 20; /* Air wavelength-like. */ #define VELO 30; /* Velocity-like. */ #define BETA 31; /* Velocity-like. */ /* Map status return value to message. */ const char *spc_errmsg[] = { "Success", "Null spcprm pointer passed", "Invalid spectral parameters", "One or more of x coordinates were invalid", "One or more of the spec coordinates were invalid"}; /* Convenience macro for invoking wcserr_set(). */ #define SPC_ERRMSG(status) WCSERR_SET(status), spc_errmsg[status] #define C 2.99792458e8 /*--------------------------------------------------------------------------*/ int spcini(struct spcprm *spc) { register int k; if (spc == 0x0) return SPCERR_NULL_POINTER; spc->flag = 0; memset(spc->type, 0, 8); strcpy(spc->type, " "); strcpy(spc->code, " "); spc->crval = UNDEFINED; spc->restfrq = 0.0; spc->restwav = 0.0; for (k = 0; k < 7; k++) { spc->pv[k] = UNDEFINED; } for (k = 0; k < 6; k++) { spc->w[k] = 0.0; } spc->isGrism = 0; spc->padding1 = 0; spc->err = 0x0; spc->padding2 = 0x0; spc->spxX2P = 0x0; spc->spxP2S = 0x0; spc->spxS2P = 0x0; spc->spxP2X = 0x0; return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcfree(struct spcprm *spc) { if (spc == 0x0) return SPCERR_NULL_POINTER; if (spc->err) { free(spc->err); spc->err = 0x0; } return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcprt(const struct spcprm *spc) { char hext[32]; int i; if (spc == 0x0) return SPCERR_NULL_POINTER; wcsprintf(" flag: %d\n", spc->flag); wcsprintf(" type: \"%s\"\n", spc->type); wcsprintf(" code: \"%s\"\n", spc->code); if (undefined(spc->crval)) { wcsprintf(" crval: UNDEFINED\n"); } else { wcsprintf(" crval: %- 11.4g\n", spc->crval); } wcsprintf(" restfrq: %f\n", spc->restfrq); wcsprintf(" restwav: %f\n", spc->restwav); wcsprintf(" pv:"); if (spc->isGrism) { for (i = 0; i < 5; i++) { if (undefined(spc->pv[i])) { wcsprintf(" UNDEFINED "); } else { wcsprintf(" %- 11.4g", spc->pv[i]); } } wcsprintf("\n "); for (i = 5; i < 7; i++) { if (undefined(spc->pv[i])) { wcsprintf(" UNDEFINED "); } else { wcsprintf(" %- 11.4g", spc->pv[i]); } } wcsprintf("\n"); } else { wcsprintf(" (not used)\n"); } wcsprintf(" w:"); for (i = 0; i < 3; i++) { wcsprintf(" %- 11.4g", spc->w[i]); } if (spc->isGrism) { wcsprintf("\n "); for (i = 3; i < 6; i++) { wcsprintf(" %- 11.4g", spc->w[i]); } wcsprintf("\n"); } else { wcsprintf(" (remainder unused)\n"); } wcsprintf(" isGrism: %d\n", spc->isGrism); WCSPRINTF_PTR(" err: ", spc->err, "\n"); if (spc->err) { wcserr_prt(spc->err, " "); } wcsprintf(" spxX2P: %s\n", wcsutil_fptr2str((int (*)(void))spc->spxX2P, hext)); wcsprintf(" spxP2S: %s\n", wcsutil_fptr2str((int (*)(void))spc->spxP2S, hext)); wcsprintf(" spxS2P: %s\n", wcsutil_fptr2str((int (*)(void))spc->spxS2P, hext)); wcsprintf(" spxP2X: %s\n", wcsutil_fptr2str((int (*)(void))spc->spxP2X, hext)); return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcset(struct spcprm *spc) { static const char *function = "spcset"; char ctype[9], ptype, xtype; int restreq, status; double alpha, beta_r, crvalX, dn_r, dXdS, epsilon, G, m, lambda_r, n_r, t, restfrq, restwav, theta; struct wcserr **err; if (spc == 0x0) return SPCERR_NULL_POINTER; err = &(spc->err); if (undefined(spc->crval)) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Spectral crval is undefined"); } memset((spc->type)+4, 0, 4); spc->code[3] = '\0'; wcsutil_blank_fill(4, spc->type); wcsutil_blank_fill(3, spc->code); spc->w[0] = 0.0; /* Analyse the spectral axis type. */ memset(ctype, 0, 9); strncpy(ctype, spc->type, 4); if (*(spc->code) != ' ') { sprintf(ctype+4, "-%s", spc->code); } restfrq = spc->restfrq; restwav = spc->restwav; if ((status = spcspxe(ctype, spc->crval, restfrq, restwav, &ptype, &xtype, &restreq, &crvalX, &dXdS, &(spc->err)))) { return status; } /* Satisfy rest frequency/wavelength requirements. */ if (restreq) { if (restreq == 3 && restfrq == 0.0 && restwav == 0.0) { /* VRAD-V2F, VOPT-V2W, and ZOPT-V2W require the rest frequency or */ /* wavelength for the S-P and P-X transformations but not for S-X */ /* so supply a phoney value. */ restwav = 1.0; } if (restfrq == 0.0) { restfrq = C/restwav; } else { restwav = C/restfrq; } if (ptype == 'F') { spc->w[0] = restfrq; } else if (ptype != 'V') { spc->w[0] = restwav; } else { if (xtype == 'F') { spc->w[0] = restfrq; } else { spc->w[0] = restwav; } } } spc->w[1] = crvalX; spc->w[2] = dXdS; /* Set pointers-to-functions for the linear part of the transformation. */ if (ptype == 'F') { if (strcmp(spc->type, "FREQ") == 0) { /* Frequency. */ spc->flag = FREQ; spc->spxP2S = 0x0; spc->spxS2P = 0x0; } else if (strcmp(spc->type, "AFRQ") == 0) { /* Angular frequency. */ spc->flag = AFRQ; spc->spxP2S = freqafrq; spc->spxS2P = afrqfreq; } else if (strcmp(spc->type, "ENER") == 0) { /* Photon energy. */ spc->flag = ENER; spc->spxP2S = freqener; spc->spxS2P = enerfreq; } else if (strcmp(spc->type, "WAVN") == 0) { /* Wave number. */ spc->flag = WAVN; spc->spxP2S = freqwavn; spc->spxS2P = wavnfreq; } else if (strcmp(spc->type, "VRAD") == 0) { /* Radio velocity. */ spc->flag = VRAD; spc->spxP2S = freqvrad; spc->spxS2P = vradfreq; } } else if (ptype == 'W') { if (strcmp(spc->type, "WAVE") == 0) { /* Vacuum wavelengths. */ spc->flag = WAVE; spc->spxP2S = 0x0; spc->spxS2P = 0x0; } else if (strcmp(spc->type, "VOPT") == 0) { /* Optical velocity. */ spc->flag = VOPT; spc->spxP2S = wavevopt; spc->spxS2P = voptwave; } else if (strcmp(spc->type, "ZOPT") == 0) { /* Redshift. */ spc->flag = ZOPT; spc->spxP2S = wavezopt; spc->spxS2P = zoptwave; } } else if (ptype == 'A') { if (strcmp(spc->type, "AWAV") == 0) { /* Air wavelengths. */ spc->flag = AWAV; spc->spxP2S = 0x0; spc->spxS2P = 0x0; } } else if (ptype == 'V') { if (strcmp(spc->type, "VELO") == 0) { /* Relativistic velocity. */ spc->flag = VELO; spc->spxP2S = 0x0; spc->spxS2P = 0x0; } else if (strcmp(spc->type, "BETA") == 0) { /* Velocity ratio (v/c). */ spc->flag = BETA; spc->spxP2S = velobeta; spc->spxS2P = betavelo; } } /* Set pointers-to-functions for the non-linear part of the spectral */ /* transformation. */ spc->isGrism = 0; if (xtype == 'F') { /* Axis is linear in frequency. */ if (ptype == 'F') { spc->spxX2P = 0x0; spc->spxP2X = 0x0; } else if (ptype == 'W') { spc->spxX2P = freqwave; spc->spxP2X = wavefreq; } else if (ptype == 'A') { spc->spxX2P = freqawav; spc->spxP2X = awavfreq; } else if (ptype == 'V') { spc->spxX2P = freqvelo; spc->spxP2X = velofreq; } spc->flag += F2S; } else if (xtype == 'W' || xtype == 'w') { /* Axis is linear in vacuum wavelengths. */ if (ptype == 'F') { spc->spxX2P = wavefreq; spc->spxP2X = freqwave; } else if (ptype == 'W') { spc->spxX2P = 0x0; spc->spxP2X = 0x0; } else if (ptype == 'A') { spc->spxX2P = waveawav; spc->spxP2X = awavwave; } else if (ptype == 'V') { spc->spxX2P = wavevelo; spc->spxP2X = velowave; } if (xtype == 'W') { spc->flag += W2S; } else { /* Grism in vacuum. */ spc->isGrism = 1; spc->flag += GRI; } } else if (xtype == 'A' || xtype == 'a') { /* Axis is linear in air wavelengths. */ if (ptype == 'F') { spc->spxX2P = awavfreq; spc->spxP2X = freqawav; } else if (ptype == 'W') { spc->spxX2P = awavwave; spc->spxP2X = waveawav; } else if (ptype == 'A') { spc->spxX2P = 0x0; spc->spxP2X = 0x0; } else if (ptype == 'V') { spc->spxX2P = awavvelo; spc->spxP2X = veloawav; } if (xtype == 'A') { spc->flag += A2S; } else { /* Grism in air. */ spc->isGrism = 2; spc->flag += GRA; } } else if (xtype == 'V') { /* Axis is linear in relativistic velocity. */ if (ptype == 'F') { spc->spxX2P = velofreq; spc->spxP2X = freqvelo; } else if (ptype == 'W') { spc->spxX2P = velowave; spc->spxP2X = wavevelo; } else if (ptype == 'A') { spc->spxX2P = veloawav; spc->spxP2X = awavvelo; } else if (ptype == 'V') { spc->spxX2P = 0x0; spc->spxP2X = 0x0; } spc->flag += V2S; } /* Check for grism axes. */ if (spc->isGrism) { /* Axis is linear in "grism parameter"; work in wavelength. */ lambda_r = crvalX; /* Set defaults. */ if (undefined(spc->pv[0])) spc->pv[0] = 0.0; if (undefined(spc->pv[1])) spc->pv[1] = 0.0; if (undefined(spc->pv[2])) spc->pv[2] = 0.0; if (undefined(spc->pv[3])) spc->pv[3] = 1.0; if (undefined(spc->pv[4])) spc->pv[4] = 0.0; if (undefined(spc->pv[5])) spc->pv[5] = 0.0; if (undefined(spc->pv[6])) spc->pv[6] = 0.0; /* Compute intermediaries. */ G = spc->pv[0]; m = spc->pv[1]; alpha = spc->pv[2]; n_r = spc->pv[3]; dn_r = spc->pv[4]; epsilon = spc->pv[5]; theta = spc->pv[6]; t = G*m/cosd(epsilon); beta_r = asind(t*lambda_r - n_r*sind(alpha)); t -= dn_r*sind(alpha); spc->w[1] = -tand(theta); spc->w[2] *= t / (cosd(beta_r)*cosd(theta)*cosd(theta)); spc->w[3] = beta_r + theta; spc->w[4] = (n_r - dn_r*lambda_r)*sind(alpha); spc->w[5] = 1.0 / t; } return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcx2s( struct spcprm *spc, int nx, int sx, int sspec, const double x[], double spec[], int stat[]) { static const char *function = "spcx2s"; int statP2S, status = SPCERR_SUCCESS, statX2P; double beta; register int ix; register int *statp; register const double *xp; register double *specp; struct wcserr **err; /* Initialize. */ if (spc == 0x0) return SPCERR_NULL_POINTER; err = &(spc->err); if (spc->flag == 0) { if ((status = spcset(spc))) return status; } /* Convert intermediate world coordinate x to X. */ xp = x; specp = spec; statp = stat; for (ix = 0; ix < nx; ix++, xp += sx, specp += sspec) { *specp = spc->w[1] + (*xp)*spc->w[2]; *(statp++) = 0; } /* If X is the grism parameter then convert it to wavelength. */ if (spc->isGrism) { specp = spec; for (ix = 0; ix < nx; ix++, specp += sspec) { beta = atand(*specp) + spc->w[3]; *specp = (sind(beta) + spc->w[4]) * spc->w[5]; } } /* Apply the non-linear step of the algorithm chain to convert the */ /* X-type spectral variable to P-type intermediate spectral variable. */ if (spc->spxX2P) { if ((statX2P = spc->spxX2P(spc->w[0], nx, sspec, sspec, spec, spec, stat))) { if (statX2P == SPXERR_BAD_INSPEC_COORD) { status = SPCERR_BAD_X; } else if (statX2P == SPXERR_BAD_SPEC_PARAMS) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral parameters: Frequency or wavelength is 0"); } else { return wcserr_set(SPC_ERRMSG(statX2P)); } } } /* Apply the linear step of the algorithm chain to convert P-type */ /* intermediate spectral variable to the required S-type variable. */ if (spc->spxP2S) { if ((statP2S = spc->spxP2S(spc->w[0], nx, sspec, sspec, spec, spec, stat))) { if (statP2S == SPXERR_BAD_INSPEC_COORD) { status = SPCERR_BAD_X; } else if (statP2S == SPXERR_BAD_SPEC_PARAMS) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral parameters: Frequency or wavelength is 0"); } else { return wcserr_set(SPC_ERRMSG(statP2S)); } } } if (status) { wcserr_set(SPC_ERRMSG(status)); } return status; } /*--------------------------------------------------------------------------*/ int spcs2x( struct spcprm *spc, int nspec, int sspec, int sx, const double spec[], double x[], int stat[]) { static const char *function = "spcs2x"; int statP2X, status = SPCERR_SUCCESS, statS2P; double beta, s; register int ispec; register int *statp; register const double *specp; register double *xp; struct wcserr **err; /* Initialize. */ if (spc == 0x0) return SPCERR_NULL_POINTER; err = &(spc->err); if (spc->flag == 0) { if ((status = spcset(spc))) return status; } /* Apply the linear step of the algorithm chain to convert the S-type */ /* spectral variable to P-type intermediate spectral variable. */ if (spc->spxS2P) { if ((statS2P = spc->spxS2P(spc->w[0], nspec, sspec, sx, spec, x, stat))) { if (statS2P == SPXERR_BAD_INSPEC_COORD) { status = SPCERR_BAD_SPEC; } else if (statS2P == SPXERR_BAD_SPEC_PARAMS) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral parameters: Frequency or wavelength is 0"); } else { return wcserr_set(SPC_ERRMSG(statS2P)); } } } else { /* Just a copy. */ xp = x; specp = spec; statp = stat; for (ispec = 0; ispec < nspec; ispec++, specp += sspec, xp += sx) { *xp = *specp; *(statp++) = 0; } } /* Apply the non-linear step of the algorithm chain to convert P-type */ /* intermediate spectral variable to X-type spectral variable. */ if (spc->spxP2X) { if ((statP2X = spc->spxP2X(spc->w[0], nspec, sx, sx, x, x, stat))) { if (statP2X == SPCERR_BAD_SPEC) { status = SPCERR_BAD_SPEC; } else if (statP2X == SPXERR_BAD_SPEC_PARAMS) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral parameters: Frequency or wavelength is 0"); } else { return wcserr_set(SPC_ERRMSG(statP2X)); } } } if (spc->isGrism) { /* Convert X-type spectral variable (wavelength) to grism parameter. */ xp = x; statp = stat; for (ispec = 0; ispec < nspec; ispec++, xp += sx, statp++) { if (*statp) continue; s = *xp/spc->w[5] - spc->w[4]; if (fabs(s) <= 1.0) { beta = asind(s); *xp = tand(beta - spc->w[3]); } else { *statp = 1; } } } /* Convert X-type spectral variable to intermediate world coordinate x. */ xp = x; statp = stat; for (ispec = 0; ispec < nspec; ispec++, xp += sx) { if (*(statp++)) continue; *xp -= spc->w[1]; *xp /= spc->w[2]; } if (status) { wcserr_set(SPC_ERRMSG(status)); } return status; } /*--------------------------------------------------------------------------*/ int spctyp( const char ctypei[9], char stype[], char scode[], char sname[], char units[], char *ptype, char *xtype, int *restreq) { return spctype( ctypei, stype, scode, sname, units, ptype, xtype, restreq, NULL); } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int spctype( const char ctypei[9], char stype[], char scode[], char sname[], char units[], char *ptype, char *xtype, int *restreq, struct wcserr **err) { static const char *function = "spctype"; char ctype[9], ptype_t, sname_t[32], units_t[8], xtype_t; int restreq_t = 0; if (err) *err = 0x0; /* Copy with blank padding. */ sprintf(ctype, "%-8.8s", ctypei); ctype[8] = '\0'; /* Validate the S-type spectral variable. */ if (strncmp(ctype, "FREQ", 4) == 0) { strcpy(sname_t, "Frequency"); strcpy(units_t, "Hz"); ptype_t = 'F'; } else if (strncmp(ctype, "AFRQ", 4) == 0) { strcpy(sname_t, "Angular frequency"); strcpy(units_t, "rad/s"); ptype_t = 'F'; } else if (strncmp(ctype, "ENER", 4) == 0) { strcpy(sname_t, "Photon energy"); strcpy(units_t, "J"); ptype_t = 'F'; } else if (strncmp(ctype, "WAVN", 4) == 0) { strcpy(sname_t, "Wavenumber"); strcpy(units_t, "/m"); ptype_t = 'F'; } else if (strncmp(ctype, "VRAD", 4) == 0) { strcpy(sname_t, "Radio velocity"); strcpy(units_t, "m/s"); ptype_t = 'F'; restreq_t = 1; } else if (strncmp(ctype, "WAVE", 4) == 0) { strcpy(sname_t, "Vacuum wavelength"); strcpy(units_t, "m"); ptype_t = 'W'; } else if (strncmp(ctype, "VOPT", 4) == 0) { strcpy(sname_t, "Optical velocity"); strcpy(units_t, "m/s"); ptype_t = 'W'; restreq_t = 1; } else if (strncmp(ctype, "ZOPT", 4) == 0) { strcpy(sname_t, "Redshift"); strcpy(units_t, ""); ptype_t = 'W'; restreq_t = 1; } else if (strncmp(ctype, "AWAV", 4) == 0) { strcpy(sname_t, "Air wavelength"); strcpy(units_t, "m"); ptype_t = 'A'; } else if (strncmp(ctype, "VELO", 4) == 0) { strcpy(sname_t, "Relativistic velocity"); strcpy(units_t, "m/s"); ptype_t = 'V'; } else if (strncmp(ctype, "BETA", 4) == 0) { strcpy(sname_t, "Velocity ratio (v/c)"); strcpy(units_t, ""); ptype_t = 'V'; } else { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Unknown spectral type '%s'", ctype); } /* Determine X-type and validate the spectral algorithm code. */ if ((xtype_t = ctype[5]) == ' ') { /* The algorithm code must be completely blank. */ if (strcmp(ctype+4, " ") != 0) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral algorithm '%s'", ctype+4); } xtype_t = ptype_t; } else if (ctype[4] != '-') { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral type '%s'", ctype); } else if (strcmp(ctype+5, "LOG") == 0 || strcmp(ctype+5, "TAB") == 0) { /* Logarithmic or tabular axis, not linear in any spectral type. */ } else if (xtype_t == 'G') { /* Validate the algorithm code. */ if (ctype[6] != 'R') { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral algorithm '%s'", xtype_t); } /* Grism coordinates... */ if (ctype[7] == 'I') { /* ...in vacuum. */ xtype_t = 'w'; } else if (ctype[7] == 'A') { /* ...in air. */ xtype_t = 'a'; } else { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral algorithm '%s'", xtype_t); } } else if (ctype[6] != '2') { /* Algorithm code has invalid syntax. */ return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Invalid spectral algorithm syntax '%s'", xtype_t); } else if (ctype[7] != ptype_t && ctype[7] != '?') { /* The P-, and S-type variables are inconsistent. */ return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "In spectral type '%s', P- and S-type variables are inconsistent", ctype); } else if (ctype[7] == ctype[5]) { /* Degenerate algorithm code. */ sprintf(ctype+4, " "); } /* Rest freq/wavelength required for transformation between P and X? */ if (strchr("FWAwa", (int)xtype_t)) { if (ptype_t == 'V') { restreq_t += 2; } } else if (xtype_t == 'V') { if (strchr("FWAwa", (int)ptype_t)) { restreq_t += 2; } } else if (strchr("LT", (int)xtype_t) == 0) { /* Invalid X-type variable code. */ return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "In spectral type '%s', invalid X-type variable code", ctype); } /* Copy results. */ if (stype) { strncpy(stype, ctype, 4); stype[4] = '\0'; } if (scode) strcpy(scode, ctype+5); if (sname) strcpy(sname, sname_t); if (units) strcpy(units, units_t); if (ptype) *ptype = ptype_t; if (xtype) *xtype = xtype_t; if (restreq) *restreq = restreq_t; return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcspx( const char ctypeS[9], double crvalS, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalX, double *dXdS) { return spcspxe(ctypeS, crvalS, restfrq, restwav, ptype, xtype, restreq, crvalX, dXdS, 0x0); } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int spcspxe( const char ctypeS[9], double crvalS, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalX, double *dXdS, struct wcserr **err) { static const char *function = "spcspxe"; char scode[4], stype[5], type[8]; int status; double dPdS, dXdP; struct spxprm spx; /* Analyse the spectral axis code. */ if ((status = spctype(ctypeS, stype, scode, 0x0, 0x0, ptype, xtype, restreq, err))) { return status; } if (strstr("LT", xtype)) { /* Can't handle logarithmic or tabular coordinates. */ return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Can't handle logarithmic or tabular coordinates"); } /* Do we have rest frequency and/or wavelength as required? */ if ((*restreq)%3 && restfrq == 0.0 && restwav == 0.0) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Missing required rest frequency or wavelength"); } /* Compute all spectral parameters and their derivatives. */ strcpy(type, stype); spx.err = (err ? *err : 0x0); if ((status = specx(type, crvalS, restfrq, restwav, &spx))) { status = SPCERR_BAD_SPEC_PARAMS; if (err) { *err = spx.err; (*err)->status = status; } else { free(spx.err); } return status; } /* Transform S-P (linear) and P-X (non-linear). */ dPdS = 0.0; dXdP = 0.0; if (*ptype == 'F') { if (strcmp(stype, "FREQ") == 0) { dPdS = 1.0; } else if (strcmp(stype, "AFRQ") == 0) { dPdS = spx.dfreqafrq; } else if (strcmp(stype, "ENER") == 0) { dPdS = spx.dfreqener; } else if (strcmp(stype, "WAVN") == 0) { dPdS = spx.dfreqwavn; } else if (strcmp(stype, "VRAD") == 0) { dPdS = spx.dfreqvrad; } if (*xtype == 'F') { *crvalX = spx.freq; dXdP = 1.0; } else if (*xtype == 'W' || *xtype == 'w') { *crvalX = spx.wave; dXdP = spx.dwavefreq; } else if (*xtype == 'A' || *xtype == 'a') { *crvalX = spx.awav; dXdP = spx.dawavfreq; } else if (*xtype == 'V') { *crvalX = spx.velo; dXdP = spx.dvelofreq; } } else if (*ptype == 'W' || *ptype == 'w') { if (strcmp(stype, "WAVE") == 0) { dPdS = 1.0; } else if (strcmp(stype, "VOPT") == 0) { dPdS = spx.dwavevopt; } else if (strcmp(stype, "ZOPT") == 0) { dPdS = spx.dwavezopt; } if (*xtype == 'F') { *crvalX = spx.freq; dXdP = spx.dfreqwave; } else if (*xtype == 'W' || *xtype == 'w') { *crvalX = spx.wave; dXdP = 1.0; } else if (*xtype == 'A' || *xtype == 'a') { *crvalX = spx.awav; dXdP = spx.dawavwave; } else if (*xtype == 'V') { *crvalX = spx.velo; dXdP = spx.dvelowave; } } else if (*ptype == 'A' || *ptype == 'a') { if (strcmp(stype, "AWAV") == 0) { dPdS = 1.0; } if (*xtype == 'F') { *crvalX = spx.freq; dXdP = spx.dfreqawav; } else if (*xtype == 'W' || *xtype == 'w') { *crvalX = spx.wave; dXdP = spx.dwaveawav; } else if (*xtype == 'A' || *xtype == 'a') { *crvalX = spx.awav; dXdP = 1.0; } else if (*xtype == 'V') { *crvalX = spx.velo; dXdP = spx.dveloawav; } } else if (*ptype == 'V') { if (strcmp(stype, "VELO") == 0) { dPdS = 1.0; } else if (strcmp(stype, "BETA") == 0) { dPdS = spx.dvelobeta; } if (*xtype == 'F') { *crvalX = spx.freq; dXdP = spx.dfreqvelo; } else if (*xtype == 'W' || *xtype == 'w') { *crvalX = spx.wave; dXdP = spx.dwavevelo; } else if (*xtype == 'A' || *xtype == 'a') { *crvalX = spx.awav; dXdP = spx.dawavvelo; } else if (*xtype == 'V') { *crvalX = spx.velo; dXdP = 1.0; } } *dXdS = dXdP * dPdS; return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcxps( const char ctypeS[9], double crvalX, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalS, double *dSdX) { return spcxpse(ctypeS, crvalX, restfrq, restwav, ptype, xtype, restreq, crvalS, dSdX, NULL); } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int spcxpse( const char ctypeS[9], double crvalX, double restfrq, double restwav, char *ptype, char *xtype, int *restreq, double *crvalS, double *dSdX, struct wcserr **err) { static const char *function = "spcxpse"; char scode[4], stype[5], type[8]; int status; double dPdX, dSdP; struct spxprm spx; /* Analyse the spectral axis type. */ if ((status = spctype(ctypeS, stype, scode, 0x0, 0x0, ptype, xtype, restreq, err))) { return status; } if (strstr("LT", xtype)) { /* Can't handle logarithmic or tabular coordinates. */ return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Can't handle logarithmic or tabular coordinates"); } /* Do we have rest frequency and/or wavelength as required? */ if ((*restreq)%3 && restfrq == 0.0 && restwav == 0.0) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Missing required rest frequency or wavelength"); } /* Compute all spectral parameters and their derivatives. */ if (*xtype == 'F') { strcpy(type, "FREQ"); } else if (*xtype == 'W' || *xtype == 'w') { strcpy(type, "WAVE"); } else if (*xtype == 'A' || *xtype == 'a') { strcpy(type, "AWAV"); } else if (*xtype == 'V') { strcpy(type, "VELO"); } spx.err = (err ? *err : 0x0); if (specx(type, crvalX, restfrq, restwav, &spx)) { status = SPCERR_BAD_SPEC_PARAMS; if (err) { *err = spx.err; (*err)->status = status; } else { free(spx.err); } return status; } /* Transform X-P (non-linear) and P-S (linear). */ dPdX = 0.0; dSdP = 0.0; if (*ptype == 'F') { if (*xtype == 'F') { dPdX = 1.0; } else if (*xtype == 'W' || *xtype == 'w') { dPdX = spx.dfreqwave; } else if (*xtype == 'A' || *xtype == 'a') { dPdX = spx.dfreqawav; } else if (*xtype == 'V') { dPdX = spx.dfreqvelo; } if (strcmp(stype, "FREQ") == 0) { *crvalS = spx.freq; dSdP = 1.0; } else if (strcmp(stype, "AFRQ") == 0) { *crvalS = spx.afrq; dSdP = spx.dafrqfreq; } else if (strcmp(stype, "ENER") == 0) { *crvalS = spx.ener; dSdP = spx.denerfreq; } else if (strcmp(stype, "WAVN") == 0) { *crvalS = spx.wavn; dSdP = spx.dwavnfreq; } else if (strcmp(stype, "VRAD") == 0) { *crvalS = spx.vrad; dSdP = spx.dvradfreq; } } else if (*ptype == 'W') { if (*xtype == 'F') { dPdX = spx.dwavefreq; } else if (*xtype == 'W' || *xtype == 'w') { dPdX = 1.0; } else if (*xtype == 'A' || *xtype == 'a') { dPdX = spx.dwaveawav; } else if (*xtype == 'V') { dPdX = spx.dwavevelo; } if (strcmp(stype, "WAVE") == 0) { *crvalS = spx.wave; dSdP = 1.0; } else if (strcmp(stype, "VOPT") == 0) { *crvalS = spx.vopt; dSdP = spx.dvoptwave; } else if (strcmp(stype, "ZOPT") == 0) { *crvalS = spx.zopt; dSdP = spx.dzoptwave; } } else if (*ptype == 'A') { if (*xtype == 'F') { dPdX = spx.dawavfreq; } else if (*xtype == 'W' || *xtype == 'w') { dPdX = spx.dawavwave; } else if (*xtype == 'A' || *xtype == 'a') { dPdX = 1.0; } else if (*xtype == 'V') { dPdX = spx.dawavvelo; } if (strcmp(stype, "AWAV") == 0) { *crvalS = spx.awav; dSdP = 1.0; } } else if (*ptype == 'V') { if (*xtype == 'F') { dPdX = spx.dvelofreq; } else if (*xtype == 'W' || *xtype == 'w') { dPdX = spx.dvelowave; } else if (*xtype == 'A' || *xtype == 'a') { dPdX = spx.dveloawav; } else if (*xtype == 'V') { dPdX = 1.0; } if (strcmp(stype, "VELO") == 0) { *crvalS = spx.velo; dSdP = 1.0; } else if (strcmp(stype, "BETA") == 0) { *crvalS = spx.beta; dSdP = spx.dbetavelo; } } *dSdX = dSdP * dPdX; return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spctrn( const char ctypeS1[9], double crvalS1, double cdeltS1, double restfrq, double restwav, char ctypeS2[9], double *crvalS2, double *cdeltS2) { return spctrne(ctypeS1, crvalS1, cdeltS1, restfrq, restwav, ctypeS2, crvalS2, cdeltS2, NULL); } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int spctrne( const char ctypeS1[9], double crvalS1, double cdeltS1, double restfrq, double restwav, char ctypeS2[9], double *crvalS2, double *cdeltS2, struct wcserr **err) { static const char *function = "spctrne"; char *cp, ptype1, ptype2, stype1[5], stype2[5], xtype1, xtype2; int restreq, status; double crvalX, dS2dX, dXdS1; if (restfrq == 0.0 && restwav == 0.0) { /* If translating between two velocity-characteristic types, or between two wave-characteristic types, then we may need to set a dummy rest frequency or wavelength to perform the calculations. */ strncpy(stype1, ctypeS1, 4); strncpy(stype2, ctypeS2, 4); stype1[4] = stype2[4] = '\0'; if ((strstr("VRAD VOPT ZOPT VELO BETA", stype1) != 0x0) == (strstr("VRAD VOPT ZOPT VELO BETA", stype2) != 0x0)) { restwav = 1.0; } } if ((status = spcspxe(ctypeS1, crvalS1, restfrq, restwav, &ptype1, &xtype1, &restreq, &crvalX, &dXdS1, err))) { return status; } /* Pad with blanks. */ ctypeS2[8] = '\0'; for (cp = ctypeS2; *cp; cp++); while (cp < ctypeS2+8) *(cp++) = ' '; if (strncmp(ctypeS2+5, "???", 3) == 0) { /* Set the algorithm code if required. */ if (xtype1 == 'w') { strcpy(ctypeS2+5, "GRI"); } else if (xtype1 == 'a') { strcpy(ctypeS2+5, "GRA"); } else { ctypeS2[5] = xtype1; ctypeS2[6] = '2'; } } if ((status = spcxpse(ctypeS2, crvalX, restfrq, restwav, &ptype2, &xtype2, &restreq, crvalS2, &dS2dX, err))) { return status; } /* Are the X-types compatible? */ if (xtype2 != xtype1) { return wcserr_set(WCSERR_SET(SPCERR_BAD_SPEC_PARAMS), "Incompatible X-types '%c' and '%c'", xtype1, xtype2); } if (ctypeS2[7] == '?') { if (ptype2 == xtype2) { strcpy(ctypeS2+4, " "); } else { ctypeS2[7] = ptype2; } } *cdeltS2 = dS2dX * dXdS1 * cdeltS1; return SPCERR_SUCCESS; } /*--------------------------------------------------------------------------*/ int spcaips( const char ctypeA[9], int velref, char ctype[9], char specsys[9]) { const char *frames[] = {"LSRK", "BARYCENT", "TOPOCENT", "LSRD", "GEOCENTR", "SOURCE", "GALACTOC"}; char *fcode; int ivf, status; /* Make a null-filled copy of ctypeA. */ if (ctype != ctypeA) strncpy(ctype, ctypeA, 8); ctype[8] = '\0'; wcsutil_null_fill(9, ctype); *specsys = '\0'; /* Is it a recognized AIPS-convention type? */ status = SPCERR_NO_CHANGE; if (strncmp(ctype, "FREQ", 4) == 0 || strncmp(ctype, "VELO", 4) == 0 || strncmp(ctype, "FELO", 4) == 0) { /* Look for the Doppler frame. */ if (*(fcode = ctype+4)) { if (strcmp(fcode, "-LSR") == 0) { strcpy(specsys, "LSRK"); } else if (strcmp(fcode, "-HEL") == 0) { strcpy(specsys, "BARYCENT"); } else if (strcmp(fcode, "-OBS") == 0) { strcpy(specsys, "TOPOCENT"); } else { /* Not a recognized AIPS spectral type. */ return SPCERR_NO_CHANGE; } *fcode = '\0'; status = SPCERR_SUCCESS; } /* VELREF takes precedence if present. */ ivf = velref%256; if (0 < ivf && ivf <= 7) { strcpy(specsys, frames[ivf-1]); status = SPCERR_SUCCESS; } else if (ivf) { status = SPCERR_BAD_SPEC_PARAMS; } if (strcmp(ctype, "VELO") == 0) { /* Check that we found an AIPS-convention Doppler frame. */ if (*specsys) { /* 'VELO' in AIPS means radio or optical depending on VELREF. */ ivf = velref/256; if (ivf == 0) { strcpy(ctype, "VOPT"); } else if (ivf == 1) { strcpy(ctype, "VRAD"); } else { status = SPCERR_BAD_SPEC_PARAMS; } } } else if (strcmp(ctype, "FELO") == 0) { /* Uniform in frequency but expressed as an optical velocity (strictly we should also have found an AIPS-convention Doppler frame). */ strcpy(ctype, "VOPT-F2W"); if (status < 0) status = SPCERR_SUCCESS; } } return status; } astropy-0.3/cextern/wcslib/C/tab.h0000644000175000017500000005565212243255342015250 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: tab.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement tabular coordinate systems as * defined by the FITS World Coordinate System (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (paper I) * * "Representations of spectral coordinates in FITS", * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. * 2006, A&A, 446, 747 (Paper III) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the tab routines * --------------------------- * These routines implement the part of the FITS WCS standard that deals with * tabular coordinates, i.e. coordinates that are defined via a lookup table. * They define methods to be used for computing tabular world coordinates from * intermediate world coordinates (a linear transformation of image pixel * coordinates), and vice versa. They are based on the tabprm struct which * contains all information needed for the computations. The struct contains * some members that must be set by the user, and others that are maintained * by these routines, somewhat like a C++ class but with no encapsulation. * * tabini(), tabmem(), tabcpy(), and tabfree() are provided to manage the * tabprm struct, and another, tabprt(), to print its contents. * * A setup routine, tabset(), computes intermediate values in the tabprm struct * from parameters in it that were supplied by the user. The struct always * needs to be set up by tabset() but it need not be called explicitly - refer * to the explanation of tabprm::flag. * * tabx2s() and tabs2x() implement the WCS tabular coordinate transformations. * * Accuracy: * --------- * No warranty is given for the accuracy of these routines (refer to the * copyright notice); intending users must satisfy for themselves their * adequacy for the intended purpose. However, closure effectively to within * double precision rounding error was demonstrated by test routine ttab.c * which accompanies this software. * * * tabini() - Default constructor for the tabprm struct * ---------------------------------------------------- * tabini() allocates memory for arrays in a tabprm struct and sets all members * of the struct to default values. * * PLEASE NOTE: every tabprm struct should be initialized by tabini(), possibly * repeatedly. On the first invokation, and only the first invokation, the * flag member of the tabprm struct must be set to -1 to initialize memory * management, regardless of whether tabini() will actually be used to allocate * memory. * * Given: * alloc int If true, allocate memory unconditionally for arrays in * the tabprm struct. * * If false, it is assumed that pointers to these arrays * have been set by the user except if they are null * pointers in which case memory will be allocated for * them regardless. (In other words, setting alloc true * saves having to initalize these pointers to zero.) * * M int The number of tabular coordinate axes. * * K const int[] * Vector of length M whose elements (K_1, K_2,... K_M) * record the lengths of the axes of the coordinate array * and of each indexing vector. M and K[] are used to * determine the length of the various tabprm arrays and * therefore the amount of memory to allocate for them. * Their values are copied into the tabprm struct. * * It is permissible to set K (i.e. the address of the * array) to zero which has the same effect as setting * each element of K[] to zero. In this case no memory * will be allocated for the index vectors or coordinate * array in the tabprm struct. These together with the * K vector must be set separately before calling * tabset(). * * Given and returned: * tab struct tabprm* * Tabular transformation parameters. Note that, in * order to initialize memory management tabprm::flag * should be set to -1 when tab is initialized for the * first time (memory leaks may result if it had already * been initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 2: Memory allocation failed. * 3: Invalid tabular parameters. * * For returns > 1, a detailed error message is set in * tabprm::err if enabled, see wcserr_enable(). * * * tabmem() - Acquire tabular memory * --------------------------------- * tabmem() takes control of memory allocated by the user for arrays in the * tabprm struct. * * Given and returned: * tab struct tabprm* * Tabular transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 2: Memory allocation failed. * * For returns > 1, a detailed error message is set in * tabprm::err if enabled, see wcserr_enable(). * * * tabcpy() - Copy routine for the tabprm struct * --------------------------------------------- * tabcpy() does a deep copy of one tabprm struct to another, using tabini() to * allocate memory for its arrays if required. Only the "information to be * provided" part of the struct is copied; a call to tabset() is required to * set up the remainder. * * Given: * alloc int If true, allocate memory unconditionally for arrays in * the tabprm struct. * * If false, it is assumed that pointers to these arrays * have been set by the user except if they are null * pointers in which case memory will be allocated for * them regardless. (In other words, setting alloc true * saves having to initalize these pointers to zero.) * * tabsrc const struct tabprm* * Struct to copy from. * * Given and returned: * tabdst struct tabprm* * Struct to copy to. tabprm::flag should be set to -1 * if tabdst was not previously initialized (memory leaks * may result if it was previously initialized). * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 2: Memory allocation failed. * * For returns > 1, a detailed error message is set in * tabprm::err (associated with tabdst) if enabled, see * wcserr_enable(). * * * tabfree() - Destructor for the tabprm struct * -------------------------------------------- * tabfree() frees memory allocated for the tabprm arrays by tabini(). * tabini() records the memory it allocates and tabfree() will only attempt to * free this. * * PLEASE NOTE: tabfree() must not be invoked on a tabprm struct that was not * initialized by tabini(). * * Returned: * tab struct tabprm* * Coordinate transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * * * tabprt() - Print routine for the tabprm struct * ---------------------------------------------- * tabprt() prints the contents of a tabprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * tab const struct tabprm* * Tabular transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * * * tabset() - Setup routine for the tabprm struct * ----------------------------------------------- * tabset() allocates memory for work arrays in the tabprm struct and sets up * the struct according to information supplied within it. * * Note that this routine need not be called directly; it will be invoked by * tabx2s() and tabs2x() if tabprm::flag is anything other than a predefined * magic value. * * Given and returned: * tab struct tabprm* * Tabular transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 3: Invalid tabular parameters. * * For returns > 1, a detailed error message is set in * tabprm::err if enabled, see wcserr_enable(). * * * tabx2s() - Pixel-to-world transformation * ---------------------------------------- * tabx2s() transforms intermediate world coordinates to world coordinates * using coordinate lookup. * * Given and returned: * tab struct tabprm* * Tabular transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length * nelem. * * x const double[ncoord][nelem] * Array of intermediate world coordinates, SI units. * * Returned: * world double[ncoord][nelem] * Array of world coordinates, in SI units. * * stat int[ncoord] * Status return value status for each coordinate: * 0: Success. * 1: Invalid intermediate world coordinate. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 3: Invalid tabular parameters. * 4: One or more of the x coordinates were invalid, * as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * tabprm::err if enabled, see wcserr_enable(). * * * tabs2x() - World-to-pixel transformation * ---------------------------------------- * tabs2x() transforms world coordinates to intermediate world coordinates. * * Given and returned: * tab struct tabprm* * Tabular transformation parameters. * * Given: * ncoord, * nelem int The number of coordinates, each of vector length * nelem. * world const double[ncoord][nelem] * Array of world coordinates, in SI units. * * Returned: * x double[ncoord][nelem] * Array of intermediate world coordinates, SI units. * stat int[ncoord] * Status return value status for each vector element: * 0: Success. * 1: Invalid world coordinate. * * Function return value: * int Status return value: * 0: Success. * 1: Null tabprm pointer passed. * 3: Invalid tabular parameters. * 5: One or more of the world coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * tabprm::err if enabled, see wcserr_enable(). * * * tabprm struct - Tabular transformation parameters * ------------------------------------------------- * The tabprm struct contains information required to transform tabular * coordinates. It consists of certain members that must be set by the user * ("given") and others that are set by the WCSLIB routines ("returned"). Some * of the latter are supplied for informational purposes while others are for * internal use only. * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following tabprm structure members are set or changed: * * - tabprm::M (q.v., not normally set by the user), * - tabprm::K (q.v., not normally set by the user), * - tabprm::map, * - tabprm::crval, * - tabprm::index, * - tabprm::coord. * * This signals the initialization routine, tabset(), to recompute the * returned members of the tabprm struct. tabset() will reset flag to * indicate that this has been done. * * PLEASE NOTE: flag should be set to -1 when tabini() is called for the * first time for a particular tabprm struct in order to initialize memory * management. It must ONLY be used on the first initialization otherwise * memory leaks may result. * * int M * (Given or returned) Number of tabular coordinate axes. * * If tabini() is used to initialize the linprm struct (as would normally * be the case) then it will set M from the value passed to it as a * function argument. The user should not subsequently modify it. * * int *K * (Given or returned) Pointer to the first element of a vector of length * tabprm::M whose elements (K_1, K_2,... K_M) record the lengths of the * axes of the coordinate array and of each indexing vector. * * If tabini() is used to initialize the linprm struct (as would normally * be the case) then it will set K from the array passed to it as a * function argument. The user should not subsequently modify it. * * int *map * (Given) Pointer to the first element of a vector of length tabprm::M * that defines the association between axis m in the M-dimensional * coordinate array (1 <= m <= M) and the indices of the intermediate world * coordinate and world coordinate arrays, x[] and world[], in the argument * lists for tabx2s() and tabs2x(). * * When x[] and world[] contain the full complement of coordinate elements * in image-order, as will usually be the case, then map[m-1] == i-1 for * axis i in the N-dimensional image (1 <= i <= N). In terms of the FITS * keywords * * map[PVi_3a - 1] == i - 1. * * However, a different association may result if x[], for example, only * contains a (relevant) subset of intermediate world coordinate elements. * For example, if M == 1 for an image with N > 1, it is possible to fill * x[] with the relevant coordinate element with nelem set to 1. In this * case map[0] = 0 regardless of the value of i. * * double *crval * (Given) Pointer to the first element of a vector of length tabprm::M * whose elements contain the index value for the reference pixel for each * of the tabular coordinate axes. * * double **index * (Given) Pointer to the first element of a vector of length tabprm::M of * pointers to vectors of lengths (K_1, K_2,... K_M) of 0-relative indexes * (see tabprm::K). * * The address of any or all of these index vectors may be set to zero, * i.e. * = index[m] == 0; * * this is interpreted as default indexing, i.e. * = index[m][k] = k; * * double *coord * (Given) Pointer to the first element of the tabular coordinate array, * treated as though it were defined as * = double coord[K_M]...[K_2][K_1][M]; * * (see tabprm::K) i.e. with the M dimension varying fastest so that the * M elements of a coordinate vector are stored contiguously in memory. * * int nc * (Returned) Total number of coordinate vectors in the coordinate array * being the product K_1 * K_2 * ... * K_M (see tabprm::K). * * int padding * (An unused variable inserted for alignment purposes only.) * * int *sense * (Returned) Pointer to the first element of a vector of length tabprm::M * whose elements indicate whether the corresponding indexing vector is * monotonic increasing (+1), or decreasing (-1). * * int *p0 * (Returned) Pointer to the first element of a vector of length tabprm::M * of interpolated indices into the coordinate array such that Upsilon_m, * as defined in Paper III, is equal to (p0[m] + 1) + tabprm::delta[m]. * * double *delta * (Returned) Pointer to the first element of a vector of length tabprm::M * of interpolated indices into the coordinate array such that Upsilon_m, * as defined in Paper III, is equal to (tabprm::p0[m] + 1) + delta[m]. * * double *extrema * (Returned) Pointer to the first element of an array that records the * minimum and maximum value of each element of the coordinate vector in * each row of the coordinate array, treated as though it were defined as * = double extrema[K_M]...[K_2][2][M] * * (see tabprm::K). The minimum is recorded in the first element of the * compressed K_1 dimension, then the maximum. This array is used by the * inverse table lookup function, tabs2x(), to speed up table searches. * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * int m_flag * (For internal use only.) * int m_M * (For internal use only.) * int m_N * (For internal use only.) * int set_M * (For internal use only.) * int m_K * (For internal use only.) * int m_map * (For internal use only.) * int m_crval * (For internal use only.) * int m_index * (For internal use only.) * int m_indxs * (For internal use only.) * int m_coord * (For internal use only.) * * * Global variable: const char *tab_errmsg[] - Status return messages * ------------------------------------------------------------------ * Error messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_TAB #define WCSLIB_TAB #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif extern const char *tab_errmsg[]; enum tab_errmsg_enum { TABERR_SUCCESS = 0, /* Success. */ TABERR_NULL_POINTER = 1, /* Null tabprm pointer passed. */ TABERR_MEMORY = 2, /* Memory allocation failed. */ TABERR_BAD_PARAMS = 3, /* Invalid tabular parameters. */ TABERR_BAD_X = 4, /* One or more of the x coordinates were invalid. */ TABERR_BAD_WORLD = 5 /* One or more of the world coordinates were invalid. */ }; struct tabprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* Parameters to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ int M; /* Number of tabular coordinate axes. */ int *K; /* Vector of length M whose elements */ /* (K_1, K_2,... K_M) record the lengths of */ /* the axes of the coordinate array and of */ /* each indexing vector. */ int *map; /* Vector of length M usually such that */ /* map[m-1] == i-1 for coordinate array */ /* axis m and image axis i (see above). */ double *crval; /* Vector of length M containing the index */ /* value for the reference pixel for each */ /* of the tabular coordinate axes. */ double **index; /* Vector of pointers to M indexing vectors */ /* of lengths (K_1, K_2,... K_M). */ double *coord; /* (1+M)-dimensional tabular coordinate */ /* array (see above). */ /* Information derived from the parameters supplied. */ /*------------------------------------------------------------------------*/ int nc; /* Number of coordinate vectors (of length */ /* M) in the coordinate array. */ int padding; /* (Dummy inserted for alignment purposes.) */ int *sense; /* Vector of M flags that indicate whether */ /* the Mth indexing vector is monotonic */ /* increasing, or else decreasing. */ int *p0; /* Vector of M indices. */ double *delta; /* Vector of M increments. */ double *extrema; /* (1+M)-dimensional array of coordinate */ /* extrema. */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private - the remainder are for memory management. */ /*------------------------------------------------------------------------*/ int m_flag, m_M, m_N; int set_M; int *m_K, *m_map; double *m_crval, **m_index, **m_indxs, *m_coord; }; /* Size of the tabprm struct in int units, used by the Fortran wrappers. */ #define TABLEN (sizeof(struct tabprm)/sizeof(int)) int tabini(int alloc, int M, const int K[], struct tabprm *tab); int tabmem(struct tabprm *tab); int tabcpy(int alloc, const struct tabprm *tabsrc, struct tabprm *tabdst); int tabfree(struct tabprm *tab); int tabprt(const struct tabprm *tab); int tabset(struct tabprm *tab); int tabx2s(struct tabprm *tab, int ncoord, int nelem, const double x[], double world[], int stat[]); int tabs2x(struct tabprm *tab, int ncoord, int nelem, const double world[], double x[], int stat[]); /* Deprecated. */ #define tabini_errmsg tab_errmsg #define tabcpy_errmsg tab_errmsg #define tabfree_errmsg tab_errmsg #define tabprt_errmsg tab_errmsg #define tabset_errmsg tab_errmsg #define tabx2s_errmsg tab_errmsg #define tabs2x_errmsg tab_errmsg #ifdef __cplusplus } #endif #endif /* WCSLIB_TAB */ astropy-0.3/cextern/wcslib/C/flexed/0000755000175000017500000000000012243263747015573 5ustar oleoleastropy-0.3/cextern/wcslib/C/flexed/wcsbth.c0000644000175000017500000334403412243255342017234 0ustar oleole#line 2 "wcsbth.c" #line 4 "wcsbth.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer wcsbth_create_buffer #define yy_delete_buffer wcsbth_delete_buffer #define yy_flex_debug wcsbth_flex_debug #define yy_init_buffer wcsbth_init_buffer #define yy_flush_buffer wcsbth_flush_buffer #define yy_load_buffer_state wcsbth_load_buffer_state #define yy_switch_to_buffer wcsbth_switch_to_buffer #define yyin wcsbthin #define yyleng wcsbthleng #define yylex wcsbthlex #define yylineno wcsbthlineno #define yyout wcsbthout #define yyrestart wcsbthrestart #define yytext wcsbthtext #define yywrap wcsbthwrap #define yyalloc wcsbthalloc #define yyrealloc wcsbthrealloc #define yyfree wcsbthfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE wcsbthrestart(wcsbthin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int wcsbthleng; extern FILE *wcsbthin, *wcsbthout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsbthtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up wcsbthtext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via wcsbthrestart()), so that the user can continue scanning by * just pointing wcsbthin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when wcsbthtext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int wcsbthleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow wcsbthwrap()'s to do buffer switches * instead of setting up a fresh wcsbthin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void wcsbthrestart (FILE *input_file ); void wcsbth_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE wcsbth_create_buffer (FILE *file,int size ); void wcsbth_delete_buffer (YY_BUFFER_STATE b ); void wcsbth_flush_buffer (YY_BUFFER_STATE b ); void wcsbthpush_buffer_state (YY_BUFFER_STATE new_buffer ); void wcsbthpop_buffer_state (void ); static void wcsbthensure_buffer_stack (void ); static void wcsbth_load_buffer_state (void ); static void wcsbth_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER wcsbth_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE wcsbth_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE wcsbth_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE wcsbth_scan_bytes (yyconst char *bytes,int len ); void *wcsbthalloc (yy_size_t ); void *wcsbthrealloc (void *,yy_size_t ); void wcsbthfree (void * ); #define yy_new_buffer wcsbth_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ wcsbthensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ wcsbthensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define wcsbthwrap(n) 1 #define YY_SKIP_YYWRAP typedef char YY_CHAR; FILE *wcsbthin = (FILE *) 0, *wcsbthout = (FILE *) 0; typedef int yy_state_type; extern int wcsbthlineno; int wcsbthlineno = 1; extern char *wcsbthtext; #define yytext_ptr wcsbthtext static yyconst flex_int16_t yy_nxt[][128] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 67, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 70, 70, 70, 69, 69, 69, 69, 69, 69, 69, 69, 69, 71, 72, 73, 69, 69, 69, 69, 69, 69, 74, 75, 69, 76, 77, 69, 78, 79, 80, 69, 81, 82, 69, 69, 83, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69 }, { 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 84, 84, 84, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 84, 84, 84, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 67, 85, 85, 85, 85, 85, 85, 85, 85, 85, 68, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85 }, { 67, 85, 85, 85, 85, 85, 85, 85, 85, 85, 68, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 86, 86, 86, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85 }, { 67, 87, 87, 87, 87, 87, 87, 87, 87, 87, 68, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87 }, { 67, 87, 87, 87, 87, 87, 87, 87, 87, 87, 68, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87 }, { 67, 89, 89, 89, 89, 89, 89, 89, 89, 89, 68, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89 }, { 67, 89, 89, 89, 89, 89, 89, 89, 89, 89, 68, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, 89 }, { 67, 91, 91, 91, 91, 91, 91, 91, 91, 91, 68, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91 }, { 67, 91, 91, 91, 91, 91, 91, 91, 91, 91, 68, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91 }, { 67, 93, 93, 93, 93, 93, 93, 93, 93, 93, 68, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 }, { 67, 93, 93, 93, 93, 93, 93, 93, 93, 93, 68, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93 }, { 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 96, 96, 96, 96, 96, 96, 96, 96, 96, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 96, 96, 96, 96, 96, 96, 96, 96, 96, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 68, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97 }, { 67, 97, 97, 97, 97, 97, 97, 97, 97, 97, 68, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97 }, { 67, 99, 99, 99, 99, 99, 99, 99, 99, 99, 68, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 67, 99, 99, 99, 99, 99, 99, 99, 99, 99, 68, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 }, { 67, 101, 101, 101, 101, 101, 101, 101, 101, 101, 68, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101 }, { 67, 101, 101, 101, 101, 101, 101, 101, 101, 101, 68, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101 }, { 67, 103, 103, 103, 103, 103, 103, 103, 103, 103, 68, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103 }, { 67, 103, 103, 103, 103, 103, 103, 103, 103, 103, 68, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103 }, { 67, 105, 105, 105, 105, 105, 105, 105, 105, 105, 68, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105 }, { 67, 105, 105, 105, 105, 105, 105, 105, 105, 105, 68, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105 }, { 67, 107, 107, 107, 107, 107, 107, 107, 107, 107, 68, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 }, { 67, 107, 107, 107, 107, 107, 107, 107, 107, 107, 68, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107 }, { 67, 109, 109, 109, 109, 109, 109, 109, 109, 109, 68, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109 }, { 67, 109, 109, 109, 109, 109, 109, 109, 109, 109, 68, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109 }, { 67, 111, 111, 111, 111, 111, 111, 111, 111, 111, 68, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111 }, { 67, 111, 111, 111, 111, 111, 111, 111, 111, 111, 68, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111 }, { 67, 113, 113, 113, 113, 113, 113, 113, 113, 113, 68, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 }, { 67, 113, 113, 113, 113, 113, 113, 113, 113, 113, 68, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 }, { 67, 115, 115, 115, 115, 115, 115, 115, 115, 115, 68, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 67, 115, 115, 115, 115, 115, 115, 115, 115, 115, 68, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115 }, { 67, 117, 117, 117, 117, 117, 117, 117, 117, 117, 68, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117 }, { 67, 117, 117, 117, 117, 117, 117, 117, 117, 117, 68, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117 }, { 67, 119, 119, 119, 119, 119, 119, 119, 119, 119, 68, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119 }, { 67, 119, 119, 119, 119, 119, 119, 119, 119, 119, 68, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119 }, { 67, 120, 120, 120, 120, 120, 120, 120, 120, 120, 68, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120 }, { 67, 120, 120, 120, 120, 120, 120, 120, 120, 120, 68, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120 }, { 67, 122, 122, 122, 122, 122, 122, 122, 122, 122, 68, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122 }, { 67, 122, 122, 122, 122, 122, 122, 122, 122, 122, 68, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122 }, { 67, 124, 124, 124, 124, 124, 124, 124, 124, 124, 68, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 67, 124, 124, 124, 124, 124, 124, 124, 124, 124, 68, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 67, 126, 126, 126, 126, 126, 126, 126, 126, 126, 68, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126 }, { 67, 126, 126, 126, 126, 126, 126, 126, 126, 126, 68, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126 }, { 67, 128, 128, 128, 128, 128, 128, 128, 128, 128, 68, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, { 67, 128, 128, 128, 128, 128, 128, 128, 128, 128, 68, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }, { 67, 130, 130, 130, 130, 130, 130, 130, 130, 130, 68, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 }, { 67, 130, 130, 130, 130, 130, 130, 130, 130, 130, 68, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 }, { 67, 132, 132, 132, 132, 132, 132, 132, 132, 132, 68, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 133, 132, 133, 132, 132, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132 }, { 67, 132, 132, 132, 132, 132, 132, 132, 132, 132, 68, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 133, 132, 133, 132, 132, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132 }, { 67, 135, 135, 135, 135, 135, 135, 135, 135, 135, 68, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, 135, 136, 137, 135, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135 }, { 67, 135, 135, 135, 135, 135, 135, 135, 135, 135, 68, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 136, 135, 136, 137, 135, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, 135 }, { 67, 139, 139, 139, 139, 139, 139, 139, 139, 139, 68, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139 }, { 67, 139, 139, 139, 139, 139, 139, 139, 139, 139, 68, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 139 }, { 67, 141, 141, 141, 141, 141, 141, 141, 141, 141, 68, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 143, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141 }, { 67, 141, 141, 141, 141, 141, 141, 141, 141, 141, 68, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 143, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141 }, { 67, 144, 144, 144, 144, 144, 144, 144, 144, 144, 68, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144 }, { 67, 144, 144, 144, 144, 144, 144, 144, 144, 144, 68, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144, 144 }, { 67, 145, 145, 145, 145, 145, 145, 145, 145, 145, 68, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145 }, { 67, 145, 145, 145, 145, 145, 145, 145, 145, 145, 68, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145 }, { 67, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146 }, { 67, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146 }, { -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 }, { 67, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68 }, { 67, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69 }, { 67, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -70, -70, -70, -70, -70, -70, -70, -70, -70, 149, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, 150, -70, -70, 151, -70, -70, 152, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 }, { 67, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 153, -71, -71, -71, -71, -71, -71, -71, -71, -71, 154, -71, -71, -71, 155, 156, 157, 158, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71 }, { 67, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, 159, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, 160, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72 }, { 67, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, 161, -73, 162, 163, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73 }, { 67, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, 164, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, 165, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74 }, { 67, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, 166, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75 }, { 67, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, 167, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76 }, { 67, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, 168, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, 169, 170, -77, -77, 171, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77 }, { 67, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 172, -78, -78, -78, 173, 174, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 175, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78 }, { 67, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, 176, 177, -79, -79, 178, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79 }, { 67, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 179, -80, -80, 180, -80, -80, -80, -80, -80, -80, -80, -80, -80, 181, -80, -80, 182, -80, -80, 183, 184, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80 }, { 67, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 185, -81, -81, -81, 186, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 187, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81 }, { 67, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, 188, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82 }, { 67, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, 189, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83 }, { 67, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, 190, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, -84, -84, -84, -84, -84, -84, -84, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84 }, { 67, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85 }, { 67, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 192, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, -86, -86, -86, -86, -86, -86, -86, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86 }, { 67, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87 }, { 67, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 194, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, -88, -88, -88, -88, -88, -88, -88, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88 }, { 67, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89 }, { 67, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 197, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, -90, -90, -90, -90, -90, -90, -90, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90 }, { 67, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91 }, { 67, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 199, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, -92, -92, -92, -92, -92, -92, -92, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92 }, { 67, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93 }, { 67, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 }, { 67, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 204, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 }, { 67, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, 205, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, -96, -96, -96, -96, -96, -96, -96, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96 }, { 67, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97 }, { 67, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 208, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98 }, { 67, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99 }, { 67, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 210, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 }, { 67, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101 }, { 67, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 211, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, -102, -102, -102, -102, -102, -102, -102, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102 }, { 67, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103 }, { 67, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, 214, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, -104, -104, -104, -104, -104, -104, -104, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104 }, { 67, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105 }, { 67, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 217, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, -106, -106, -106, -106, -106, -106, -106, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106 }, { 67, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107 }, { 67, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 221, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108 }, { 67, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109 }, { 67, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 223, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110 }, { 67, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111 }, { 67, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 225, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 }, { 67, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113 }, { 67, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 227, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114 }, { 67, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115 }, { 67, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 229, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116 }, { 67, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117 }, { 67, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 230, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 }, { 67, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119 }, { 67, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120 }, { 67, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 }, { 67, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122 }, { 67, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 231, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, -123, -123, -123, -123, -123, -123, -123, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123 }, { 67, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124 }, { 67, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, 233, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -125, -125, -125, -125, -125, -125, -125, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125 }, { 67, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126 }, { 67, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, 235, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127 }, { 67, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128 }, { 67, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, 237, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129 }, { 67, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130 }, { 67, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, 239, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131 }, { 67, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132 }, { 67, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133 }, { 67, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134 }, { 67, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135 }, { 67, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, 241, -136, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136 }, { 67, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137 }, { 67, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 244, -138, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 246, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 246, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138 }, { 67, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139 }, { 67, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 248, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 }, { 67, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141 }, { 67, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 249, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 250, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142 }, { 67, 251, 251, 251, 251, 251, 251, 251, 251, 251, -143, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251 }, { 67, 252, 252, 252, 252, 252, 252, 252, 252, 252, -144, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 }, { 67, 253, 253, 253, 253, 253, 253, 253, 253, 253, -145, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 }, { 67, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 67, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147 }, { 67, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 256, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 257, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148 }, { 67, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 258, -149, -149, -149, -149, -149, -149, -149, -149, -149, 259, -149, -149, -149, 260, 261, 262, 263, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149 }, { 67, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, 264, -150, -150, 265, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150 }, { 67, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151 }, { 67, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152 }, { 67, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, 266, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153 }, { 67, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, 267, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154 }, { 67, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 268, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 269, 270, -155, -155, -155, -155, -155, 271, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155 }, { 67, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, 272, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156 }, { 67, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, 273, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157 }, { 67, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, 274, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158 }, { 67, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, 275, -159, 276, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159 }, { 67, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, 277, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160 }, { 67, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, 278, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161 }, { 67, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, 279, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162 }, { 67, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, 280, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163 }, { 67, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 281, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164 }, { 67, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 282, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165 }, { 67, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, 283, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166 }, { 67, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, 284, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167 }, { 67, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168 }, { 67, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 285, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169 }, { 67, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170 }, { 67, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171 }, { 67, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 286, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172 }, { 67, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 287, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173 }, { 67, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 288, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174 }, { 67, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, 289, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175 }, { 67, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 290, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176 }, { 67, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 291, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177 }, { 67, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, 292, -178, -178, -178, -178, -178, -178, 293, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178 }, { 67, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, 294, -179, -179, -179, -179, -179, -179, -179, -179, -179, 295, -179, -179, -179, 296, 297, 298, 299, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179 }, { 67, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, 300, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180 }, { 67, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, 301, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, 302, -181, -181, 303, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181 }, { 67, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182 }, { 67, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183 }, { 67, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, 304, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184 }, { 67, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, 305, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185 }, { 67, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, 306, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186 }, { 67, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 307, -187, -187, -187, -187, -187, -187, -187, -187, -187, 308, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187 }, { 67, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 309, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 310, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188 }, { 67, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 311, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189 }, { 67, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 312, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190 }, { 67, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 313, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, -191, -191, -191, -191, -191, -191, -191, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191 }, { 67, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 315, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192 }, { 67, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 316, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, -193, -193, -193, -193, -193, -193, -193, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193 }, { 67, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 318, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194 }, { 67, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 319, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, -195, -195, -195, -195, -195, -195, -195, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195 }, { 67, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, 322, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196 }, { 67, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, 323, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197 }, { 67, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 324, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, -198, -198, -198, -198, -198, -198, -198, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198 }, { 67, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 326, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199 }, { 67, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 327, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, -200, -200, -200, -200, -200, -200, -200, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200 }, { 67, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 330, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201 }, { 67, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202 }, { 67, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 333, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203 }, { 67, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 334, 334, 334, 334, 334, 334, 334, 334, 334, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204 }, { 67, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, 335, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205 }, { 67, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 336, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, -206, -206, -206, -206, -206, -206, -206, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206 }, { 67, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 339, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207 }, { 67, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 340, 340, 340, 340, 340, 340, 340, 340, 340, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208 }, { 67, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 342, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209 }, { 67, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, 343, 343, 343, 343, 343, 343, 343, 343, 343, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210 }, { 67, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 344, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211 }, { 67, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 345, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, 346, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212 }, { 67, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, 347, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213 }, { 67, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, 348, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214 }, { 67, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, 349, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, -215, -215, -215, -215, -215, -215, -215, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215 }, { 67, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 352, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216 }, { 67, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 353, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217 }, { 67, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 354, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, -218, -218, -218, -218, -218, -218, -218, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218 }, { 67, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 357, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219 }, { 67, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 359, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220 }, { 67, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 360, 361, 361, 361, 361, 361, 361, 361, 361, 361, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221 }, { 67, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, 363, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222 }, { 67, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 364, 365, 365, 365, 365, 365, 365, 365, 365, 365, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223 }, { 67, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 367, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224 }, { 67, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, 368, 369, 369, 369, 369, 369, 369, 369, 369, 369, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225 }, { 67, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, 371, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226 }, { 67, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, 372, 373, 373, 373, 373, 373, 373, 373, 373, 373, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227 }, { 67, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, 375, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228 }, { 67, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, 376, 377, 377, 377, 377, 377, 377, 377, 377, 377, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229 }, { 67, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, 378, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230 }, { 67, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, 379, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231 }, { 67, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 380, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, -232, -232, -232, -232, -232, -232, -232, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232 }, { 67, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 382, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233 }, { 67, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 383, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, -234, -234, -234, -234, -234, -234, -234, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234 }, { 67, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 385, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235 }, { 67, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 386, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236 }, { 67, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 388, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237 }, { 67, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 389, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238 }, { 67, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239 }, { 67, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240 }, { 67, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241 }, { 67, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 244, -242, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 246, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 246, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242 }, { 67, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 246, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 246, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243 }, { 67, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, 246, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, 246, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244 }, { 67, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 244, -245, 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 246, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 246, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245 }, { 67, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 392, -246, 392, -246, -246, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246 }, { 67, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 248, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 }, { 67, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 247, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248 }, { 67, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 250, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249 }, { 67, 251, 251, 251, 251, 251, 251, 251, 251, 251, -250, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251 }, { 67, 251, 251, 251, 251, 251, 251, 251, 251, 251, -251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251 }, { 67, 252, 252, 252, 252, 252, 252, 252, 252, 252, -252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252 }, { 67, 253, 253, 253, 253, 253, 253, 253, 253, 253, -253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 }, { 67, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 67, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255 }, { 67, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 394, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256 }, { 67, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 395, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257 }, { 67, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, 396, -258, -258, -258, -258, -258, -258, 397, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258 }, { 67, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, 398, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259 }, { 67, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 399, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 400, 401, -260, -260, -260, -260, -260, 402, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260 }, { 67, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 403, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261 }, { 67, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 404, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262 }, { 67, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 405, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263 }, { 67, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264 }, { 67, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265 }, { 67, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 406, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266 }, { 67, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 407, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267 }, { 67, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 408, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268 }, { 67, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 409, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269 }, { 67, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, 410, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270 }, { 67, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 411, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271 }, { 67, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 412, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272 }, { 67, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 413, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273 }, { 67, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, 414, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274 }, { 67, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, 415, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275 }, { 67, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 416, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276 }, { 67, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 417, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277 }, { 67, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, 418, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278 }, { 67, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, 419, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279 }, { 67, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, 420, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280 }, { 67, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, 421, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281 }, { 67, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 422, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282 }, { 67, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 423, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 424, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 425, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283 }, { 67, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, 426, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284 }, { 67, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 427, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285 }, { 67, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 428, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286 }, { 67, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, 429, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287 }, { 67, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 430, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288 }, { 67, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 431, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289 }, { 67, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 432, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290 }, { 67, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, 433, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291 }, { 67, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, 434, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292 }, { 67, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 435, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293 }, { 67, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 436, -294, -294, -294, -294, -294, -294, 437, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294 }, { 67, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 438, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295 }, { 67, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 439, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 440, 441, -296, -296, -296, -296, -296, 442, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296 }, { 67, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, 443, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297 }, { 67, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, 444, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298 }, { 67, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, 445, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299 }, { 67, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, 446, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300 }, { 67, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301 }, { 67, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302 }, { 67, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303 }, { 67, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, 447, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304 }, { 67, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, 448, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305 }, { 67, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 449, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 450, -306, -306, 451, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306 }, { 67, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, 452, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307 }, { 67, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, 453, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308 }, { 67, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, 454, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309 }, { 67, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 455, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 456, -310, -310, -310, -310, -310, 457, -310, -310, -310, 458, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310 }, { 67, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, 459, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311 }, { 67, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312 }, { 67, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313 }, { 67, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314 }, { 67, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, 460, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315 }, { 67, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, 461, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316 }, { 67, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 462, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317 }, { 67, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318 }, { 67, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319 }, { 67, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320 }, { 67, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321 }, { 67, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322 }, { 67, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, 463, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323 }, { 67, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, 464, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324 }, { 67, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 465, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325 }, { 67, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326 }, { 67, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327 }, { 67, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328 }, { 67, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329 }, { 67, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330 }, { 67, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 466, 466, 466, 466, 466, 466, 466, 466, 466, 466, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331 }, { 67, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 468, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332 }, { 67, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, 469, 469, 469, 469, 469, 469, 469, 469, 469, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333 }, { 67, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 470, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, -334, -334, -334, -334, -334, -334, -334, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334 }, { 67, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, 472, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335 }, { 67, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, 473, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336 }, { 67, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 474, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, 474, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337 }, { 67, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 476, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338 }, { 67, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 477, 477, 477, 477, 477, 477, 477, 477, 477, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339 }, { 67, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 478, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 479, 479, 479, 479, 479, 479, 479, 479, 479, 479, -340, -340, -340, -340, -340, -340, -340, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, 478, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340 }, { 67, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 480, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341 }, { 67, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, 481, 481, 481, 481, 481, 481, 481, 481, 481, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342 }, { 67, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 482, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 483, 483, 483, 483, 483, 483, 483, 483, 483, 483, -343, -343, -343, -343, -343, -343, -343, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343 }, { 67, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344 }, { 67, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345 }, { 67, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346 }, { 67, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347 }, { 67, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348 }, { 67, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349 }, { 67, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350 }, { 67, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351 }, { 67, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352 }, { 67, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353 }, { 67, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354 }, { 67, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355 }, { 67, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356 }, { 67, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357 }, { 67, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 484, 484, 484, 484, 484, 484, 484, 484, 484, 484, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 485, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358 }, { 67, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, 486, 487, 487, 487, 487, 487, 487, 487, 487, 487, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359 }, { 67, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 488, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360 }, { 67, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 488, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 489, 489, 489, 489, 489, 489, 489, 489, 489, 489, -361, -361, -361, -361, -361, -361, -361, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, 488, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361 }, { 67, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 490, 490, 490, 490, 490, 490, 490, 490, 490, 490, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 491, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362 }, { 67, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 492, 493, 493, 493, 493, 493, 493, 493, 493, 493, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363 }, { 67, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 494, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364 }, { 67, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, 494, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, -365, -365, -365, -365, -365, -365, -365, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, 494, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365 }, { 67, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, 496, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366 }, { 67, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, 497, 498, 498, 498, 498, 498, 498, 498, 498, 498, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367 }, { 67, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 499, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368 }, { 67, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 499, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, -369, -369, -369, -369, -369, -369, -369, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369 }, { 67, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 502, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370 }, { 67, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, 503, 504, 504, 504, 504, 504, 504, 504, 504, 504, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371 }, { 67, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 505, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372 }, { 67, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 505, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, -373, -373, -373, -373, -373, -373, -373, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373 }, { 67, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, 507, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374 }, { 67, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, 508, 509, 509, 509, 509, 509, 509, 509, 509, 509, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375 }, { 67, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 510, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376 }, { 67, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 510, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 511, 511, 511, 511, 511, 511, 511, 511, 511, 511, -377, -377, -377, -377, -377, -377, -377, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, 510, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377 }, { 67, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378 }, { 67, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, 512, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379 }, { 67, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, 513, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380 }, { 67, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 514, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, 514, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381 }, { 67, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382 }, { 67, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383 }, { 67, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384 }, { 67, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, 515, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385 }, { 67, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, 516, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386 }, { 67, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, 517, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, 518, 518, 518, 518, 518, 518, 518, 518, 518, 518, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387 }, { 67, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388 }, { 67, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389 }, { 67, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390 }, { 67, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 246, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 246, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391 }, { 67, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392 }, { 67, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393 }, { 67, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394 }, { 67, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395 }, { 67, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396 }, { 67, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, 519, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397 }, { 67, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, 520, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398 }, { 67, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, 521, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399 }, { 67, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, 522, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400 }, { 67, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, 523, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401 }, { 67, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, 524, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402 }, { 67, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, 525, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403 }, { 67, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, 526, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404 }, { 67, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, 527, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405 }, { 67, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, 528, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406 }, { 67, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, 529, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407 }, { 67, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, 530, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408 }, { 67, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, 531, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409 }, { 67, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, 532, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410 }, { 67, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, 533, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411 }, { 67, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, 534, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412 }, { 67, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, 535, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413 }, { 67, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, 536, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414 }, { 67, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, 537, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415 }, { 67, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416 }, { 67, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 538, 538, 538, 538, 538, 538, 538, 538, 538, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417 }, { 67, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, 539, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418 }, { 67, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, 540, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419 }, { 67, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, 541, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420 }, { 67, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, 542, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421 }, { 67, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, 543, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422 }, { 67, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 544, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 545, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423 }, { 67, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424 }, { 67, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, 546, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425 }, { 67, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 547, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 548, 549, 550, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426 }, { 67, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, 551, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427 }, { 67, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 552, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 553, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428 }, { 67, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 554, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 555, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429 }, { 67, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430 }, { 67, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431 }, { 67, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432 }, { 67, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, 556, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433 }, { 67, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434 }, { 67, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, 557, -435, -435, -435, 558, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435 }, { 67, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436 }, { 67, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, 559, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437 }, { 67, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, 560, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438 }, { 67, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, 561, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439 }, { 67, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, 562, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440 }, { 67, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, 563, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441 }, { 67, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, 564, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442 }, { 67, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, 565, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443 }, { 67, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, 566, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444 }, { 67, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, 567, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445 }, { 67, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, 568, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446 }, { 67, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447 }, { 67, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448 }, { 67, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, 569, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449 }, { 67, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, 570, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450 }, { 67, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, 571, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451 }, { 67, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, 572, 572, 572, 572, 572, 572, 572, 572, 572, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, 573, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452 }, { 67, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453 }, { 67, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, 574, 574, 574, 574, 574, 574, 574, 574, 574, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454 }, { 67, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, 575, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455 }, { 67, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, 576, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456 }, { 67, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, 577, 577, 577, 577, 577, 577, 577, 577, 577, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457 }, { 67, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, 578, 578, 578, 578, 578, 578, 578, 578, 578, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458 }, { 67, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, 579, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459 }, { 67, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460 }, { 67, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461 }, { 67, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462 }, { 67, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463 }, { 67, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464 }, { 67, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465 }, { 67, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466 }, { 67, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, 580, 580, 580, 580, 580, 580, 580, 580, 580, 580, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, 581, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467 }, { 67, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, 582, 582, 582, 582, 582, 582, 582, 582, 582, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468 }, { 67, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, 583, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, 584, 584, 584, 584, 584, 584, 584, 584, 584, 584, -469, -469, -469, -469, -469, -469, -469, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, 583, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469 }, { 67, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, 585, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470 }, { 67, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, 586, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, 587, 587, 587, 587, 587, 587, 587, 587, 587, 587, -471, -471, -471, -471, -471, -471, -471, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, 586, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471 }, { 67, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472 }, { 67, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473 }, { 67, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474 }, { 67, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, 588, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475 }, { 67, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, 589, 589, 589, 589, 589, 589, 589, 589, 589, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476 }, { 67, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, 590, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, 591, 591, 591, 591, 591, 591, 591, 591, 591, 591, -477, -477, -477, -477, -477, -477, -477, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, 590, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477 }, { 67, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, 592, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478 }, { 67, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, 593, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, 594, 594, 594, 594, 594, 594, 594, 594, 594, 594, -479, -479, -479, -479, -479, -479, -479, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479 }, { 67, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, 595, 595, 595, 595, 595, 595, 595, 595, 595, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480 }, { 67, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, 596, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, 597, 597, 597, 597, 597, 597, 597, 597, 597, 597, -481, -481, -481, -481, -481, -481, -481, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, 596, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481 }, { 67, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, 598, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482 }, { 67, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, 599, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, -483, -483, -483, -483, -483, -483, -483, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483 }, { 67, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, 601, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484 }, { 67, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, 602, 603, 603, 603, 603, 603, 603, 603, 603, 603, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485 }, { 67, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, 604, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486 }, { 67, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, 604, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, -487, -487, -487, -487, -487, -487, -487, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487 }, { 67, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, 606, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488 }, { 67, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, 607, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, -489, -489, -489, -489, -489, -489, -489, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489 }, { 67, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, 609, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490 }, { 67, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, 610, 611, 611, 611, 611, 611, 611, 611, 611, 611, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491 }, { 67, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, 612, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492 }, { 67, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, 612, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, -493, -493, -493, -493, -493, -493, -493, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493 }, { 67, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, 614, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494 }, { 67, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, 615, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, -495, -495, -495, -495, -495, -495, -495, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495 }, { 67, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496 }, { 67, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, 618, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497 }, { 67, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, 618, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, -498, -498, -498, -498, -498, -498, -498, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498 }, { 67, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, 620, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499 }, { 67, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, 621, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, 622, 622, 622, 622, 622, 622, 622, 622, 622, 622, -500, -500, -500, -500, -500, -500, -500, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500 }, { 67, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, 623, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501 }, { 67, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, 624, 625, 625, 625, 625, 625, 625, 625, 625, 625, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502 }, { 67, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, 626, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503 }, { 67, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, 626, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, 627, 627, 627, 627, 627, 627, 627, 627, 627, 627, -504, -504, -504, -504, -504, -504, -504, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504 }, { 67, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, 628, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505 }, { 67, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, 629, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, 630, 630, 630, 630, 630, 630, 630, 630, 630, 630, -506, -506, -506, -506, -506, -506, -506, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506 }, { 67, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507 }, { 67, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, 632, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508 }, { 67, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, 632, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, -509, -509, -509, -509, -509, -509, -509, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509 }, { 67, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, 634, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510 }, { 67, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, 635, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, -511, -511, -511, -511, -511, -511, -511, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511 }, { 67, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512 }, { 67, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513 }, { 67, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514 }, { 67, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515 }, { 67, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516 }, { 67, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517 }, { 67, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518 }, { 67, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519 }, { 67, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520 }, { 67, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521 }, { 67, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522 }, { 67, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523 }, { 67, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524 }, { 67, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525 }, { 67, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526 }, { 67, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527 }, { 67, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528 }, { 67, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529 }, { 67, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530 }, { 67, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531 }, { 67, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532 }, { 67, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533 }, { 67, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534 }, { 67, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535 }, { 67, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536 }, { 67, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, 637, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, 638, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537 }, { 67, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, 639, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, 640, 640, 640, 640, 640, 640, 640, 640, 640, 640, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538 }, { 67, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, 641, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539 }, { 67, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, 642, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540 }, { 67, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, 643, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541 }, { 67, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, 644, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542 }, { 67, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, 645, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543 }, { 67, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, 646, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544 }, { 67, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, 647, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545 }, { 67, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546 }, { 67, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, 648, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547 }, { 67, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548 }, { 67, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549 }, { 67, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550 }, { 67, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551, -551 }, { 67, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, 649, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552, -552 }, { 67, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, 650, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553, -553 }, { 67, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, 651, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554, -554 }, { 67, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, 652, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555, -555 }, { 67, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, 653, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556, -556 }, { 67, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, 654, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557, -557 }, { 67, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, 655, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558, -558 }, { 67, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559, -559 }, { 67, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560, -560 }, { 67, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561, -561 }, { 67, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562, -562 }, { 67, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563, -563 }, { 67, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564, -564 }, { 67, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565, -565 }, { 67, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566, -566 }, { 67, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567, -567 }, { 67, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, 656, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568, -568 }, { 67, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, 657, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569, -569 }, { 67, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, 658, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570, -570 }, { 67, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, 659, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571, -571 }, { 67, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, 660, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, 661, 661, 661, 661, 661, 661, 661, 661, 661, 661, -572, -572, -572, -572, -572, -572, -572, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572, -572 }, { 67, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, 662, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573, -573 }, { 67, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, 663, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, -574, -574, -574, -574, -574, -574, -574, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, 663, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574, -574 }, { 67, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, 665, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575, -575 }, { 67, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, 666, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576, -576 }, { 67, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, 667, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, -577, -577, -577, -577, -577, -577, -577, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577, -577 }, { 67, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, 669, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, 670, 670, 670, 670, 670, 670, 670, 670, 670, 670, -578, -578, -578, -578, -578, -578, -578, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, 669, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578, -578 }, { 67, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, 671, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579, -579 }, { 67, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, 672, 672, 672, 672, 672, 672, 672, 672, 672, 672, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580, -580 }, { 67, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, 673, 673, 673, 673, 673, 673, 673, 673, 673, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581, -581 }, { 67, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, 674, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, -582, -582, -582, -582, -582, -582, -582, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582, -582 }, { 67, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, 676, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583, -583 }, { 67, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, 677, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, -584, -584, -584, -584, -584, -584, -584, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, 677, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584, -584 }, { 67, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, 679, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585, -585 }, { 67, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, 680, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586, -586 }, { 67, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, 681, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, 682, 682, 682, 682, 682, 682, 682, 682, 682, 682, -587, -587, -587, -587, -587, -587, -587, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, 681, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587, -587 }, { 67, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, 683, 683, 683, 683, 683, 683, 683, 683, 683, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588, -588 }, { 67, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, 684, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, -589, -589, -589, -589, -589, -589, -589, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, 684, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589, -589 }, { 67, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, 686, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590, -590 }, { 67, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, 687, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, 688, 688, 688, 688, 688, 688, 688, 688, 688, 688, -591, -591, -591, -591, -591, -591, -591, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, 687, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591, -591 }, { 67, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, 689, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592, -592 }, { 67, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, 690, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593, -593 }, { 67, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, 691, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, 692, 692, 692, 692, 692, 692, 692, 692, 692, 692, -594, -594, -594, -594, -594, -594, -594, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, 691, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594, -594 }, { 67, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595, -595 }, { 67, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596, -596 }, { 67, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597, -597 }, { 67, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598, -598 }, { 67, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599, -599 }, { 67, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600, -600 }, { 67, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, 693, 693, 693, 693, 693, 693, 693, 693, 693, 693, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601, -601 }, { 67, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, 694, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602, -602 }, { 67, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, 694, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, -603, -603, -603, -603, -603, -603, -603, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, 694, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603, -603 }, { 67, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, 696, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604, -604 }, { 67, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, 697, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698, -605, -605, -605, -605, -605, -605, -605, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, 697, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605, -605 }, { 67, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, 699, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606, -606 }, { 67, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 700, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607 }, { 67, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, 701, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, 702, 702, 702, 702, 702, 702, 702, 702, 702, 702, -608, -608, -608, -608, -608, -608, -608, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, 701, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608, -608 }, { 67, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, 703, 703, 703, 703, 703, 703, 703, 703, 703, 703, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609, -609 }, { 67, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, 704, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610, -610 }, { 67, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, 704, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, -611, -611, -611, -611, -611, -611, -611, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, -611 }, { 67, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, 706, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612, -612 }, { 67, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, 707, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, -613, -613, -613, -613, -613, -613, -613, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613, -613 }, { 67, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, 709, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614, -614 }, { 67, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, 710, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615, -615 }, { 67, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, 711, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, -616, -616, -616, -616, -616, -616, -616, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, 711, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616, -616 }, { 67, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617, -617 }, { 67, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618, -618 }, { 67, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619, -619 }, { 67, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620, -620 }, { 67, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621, -621 }, { 67, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622, -622 }, { 67, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623, -623 }, { 67, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, 714, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624, -624 }, { 67, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, 714, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, 715, 715, 715, 715, 715, 715, 715, 715, 715, 715, -625, -625, -625, -625, -625, -625, -625, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625, -625 }, { 67, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, 716, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626, -626 }, { 67, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, 717, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, 718, 718, 718, 718, 718, 718, 718, 718, 718, 718, -627, -627, -627, -627, -627, -627, -627, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, 717, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627, -627 }, { 67, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, 719, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628, -628 }, { 67, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, 720, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629, -629 }, { 67, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, 721, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, -630, -630, -630, -630, -630, -630, -630, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630, -630 }, { 67, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631, -631 }, { 67, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632, -632 }, { 67, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633, -633 }, { 67, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634, -634 }, { 67, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635, -635 }, { 67, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636, -636 }, { 67, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, 723, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637, -637 }, { 67, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, 724, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638, -638 }, { 67, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, 725, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639, -639 }, { 67, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, 726, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, 727, 727, 727, 727, 727, 727, 727, 727, 727, 727, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640, -640 }, { 67, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, 728, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641, -641 }, { 67, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, 729, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642, -642 }, { 67, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, 730, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643, -643 }, { 67, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, 731, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644, -644 }, { 67, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, 732, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645, -645 }, { 67, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, 733, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646, -646 }, { 67, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, 734, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647, -647 }, { 67, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, 735, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648, -648 }, { 67, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, 736, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, -649 }, { 67, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, 737, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650, -650 }, { 67, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, 738, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, 739, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651, -651 }, { 67, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, 740, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652, -652 }, { 67, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, 741, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653, -653 }, { 67, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, 742, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654, -654 }, { 67, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, 743, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655, -655 }, { 67, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, 744, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656, -656 }, { 67, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, 745, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657, -657 }, { 67, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, 746, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658, -658 }, { 67, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, 747, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659, -659 }, { 67, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, 748, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660, -660 }, { 67, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, 749, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, -661, -661, -661, -661, -661, -661, -661, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661, -661 }, { 67, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, 751, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662, -662 }, { 67, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, 752, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663, -663 }, { 67, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, 753, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, -664, -664, -664, -664, -664, -664, -664, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664, -664 }, { 67, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, 755, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665, -665 }, { 67, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, 756, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666, -666 }, { 67, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, 757, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667, -667 }, { 67, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, 758, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, 759, 759, 759, 759, 759, 759, 759, 759, 759, 759, -668, -668, -668, -668, -668, -668, -668, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, 758, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668, -668 }, { 67, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, 760, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669, -669 }, { 67, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, 761, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, -670, -670, -670, -670, -670, -670, -670, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, 761, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670, -670 }, { 67, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, 763, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671, -671 }, { 67, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672, -672 }, { 67, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673, -673 }, { 67, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674, -674 }, { 67, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675, -675 }, { 67, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676, -676 }, { 67, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677, -677 }, { 67, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678, -678 }, { 67, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679, -679 }, { 67, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680, -680 }, { 67, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681, -681 }, { 67, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682, -682 }, { 67, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683, -683 }, { 67, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684, -684 }, { 67, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685, -685 }, { 67, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686, -686 }, { 67, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687, -687 }, { 67, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688, -688 }, { 67, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689, -689 }, { 67, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690, -690 }, { 67, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691, -691 }, { 67, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692, -692 }, { 67, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693, -693 }, { 67, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694, -694 }, { 67, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695, -695 }, { 67, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696, -696 }, { 67, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697, -697 }, { 67, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698, -698 }, { 67, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699, -699 }, { 67, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700, -700 }, { 67, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701, -701 }, { 67, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702, -702 }, { 67, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703, -703 }, { 67, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704, -704 }, { 67, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705, -705 }, { 67, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706, -706 }, { 67, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707, -707 }, { 67, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708, -708 }, { 67, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709, -709 }, { 67, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710, -710 }, { 67, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711, -711 }, { 67, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712, -712 }, { 67, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713, -713 }, { 67, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714, -714 }, { 67, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715, -715 }, { 67, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716, -716 }, { 67, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717, -717 }, { 67, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718, -718 }, { 67, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719, -719 }, { 67, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720, -720 }, { 67, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721, -721 }, { 67, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722, -722 }, { 67, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, 764, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723, -723 }, { 67, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, 765, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724, -724 }, { 67, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, 766, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725, -725 }, { 67, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, 767, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726, -726 }, { 67, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, 768, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727, -727 }, { 67, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, 769, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728, -728 }, { 67, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, 770, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729, -729 }, { 67, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730, -730 }, { 67, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731, -731 }, { 67, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732, -732 }, { 67, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, 771, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733, -733 }, { 67, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, 772, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734, -734 }, { 67, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, 773, 774, 775, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735, -735 }, { 67, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, 776, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736, -736 }, { 67, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737, -737 }, { 67, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, 777, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738, -738 }, { 67, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739, -739 }, { 67, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740, -740 }, { 67, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741, -741 }, { 67, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742, -742 }, { 67, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743, -743 }, { 67, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, 778, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744, -744 }, { 67, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745, -745 }, { 67, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746, -746 }, { 67, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, 779, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747, -747 }, { 67, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, 780, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748, -748 }, { 67, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, 781, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749, -749 }, { 67, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, 782, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, 782, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750, -750 }, { 67, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 783, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751 }, { 67, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, 784, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752, -752 }, { 67, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, 785, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753, -753 }, { 67, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, 786, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754, -754 }, { 67, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, 787, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, 787, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755, -755 }, { 67, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756, -756 }, { 67, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, 788, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757, -757 }, { 67, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, 789, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758, -758 }, { 67, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, 790, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759, -759 }, { 67, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, 791, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760, -760 }, { 67, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, 792, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761, -761 }, { 67, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, 793, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, 793, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762, -762 }, { 67, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763, -763 }, { 67, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764, -764 }, { 67, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765, -765 }, { 67, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766, -766 }, { 67, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767, -767 }, { 67, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768, -768 }, { 67, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, 794, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769, -769 }, { 67, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770, -770 }, { 67, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771, -771 }, { 67, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772, -772 }, { 67, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773, -773 }, { 67, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774, -774 }, { 67, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775, -775 }, { 67, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776, -776 }, { 67, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777, -777 }, { 67, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, 795, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778, -778 }, { 67, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779, -779 }, { 67, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780, -780 }, { 67, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781, -781 }, { 67, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782, -782 }, { 67, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783, -783 }, { 67, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, 796, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784, -784 }, { 67, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, 797, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785, -785 }, { 67, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, 798, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786, -786 }, { 67, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, 799, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787, -787 }, { 67, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, 800, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788, -788 }, { 67, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, 801, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789, -789 }, { 67, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, 802, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790, -790 }, { 67, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, 803, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791, -791 }, { 67, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, 804, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792, -792 }, { 67, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, 805, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793, -793 }, { 67, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, 806, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794, -794 }, { 67, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, 807, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795, -795 }, { 67, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, 808, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796, -796 }, { 67, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, 809, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797, -797 }, { 67, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, 810, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798, -798 }, { 67, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, 811, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799, -799 }, { 67, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, 812, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800, -800 }, { 67, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, 813, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801, -801 }, { 67, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, 814, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802, -802 }, { 67, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, 815, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803, -803 }, { 67, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, 816, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804, -804 }, { 67, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, 817, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805, -805 }, { 67, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, 818, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806, -806 }, { 67, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, 819, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, 820, -807, 820, -807, -807, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807, -807 }, { 67, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, 822, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, 823, -808, 823, -808, -808, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808, -808 }, { 67, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, 825, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, 826, -809, 826, -809, -809, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809, -809 }, { 67, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, 828, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, 829, -810, 829, -810, -810, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810, -810 }, { 67, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, 831, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, 832, -811, 832, -811, -811, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811, -811 }, { 67, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, 834, -812, -812, -812, -812, -812, -812, 835, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812, -812 }, { 67, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, 836, -813, -813, -813, -813, -813, -813, 837, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813, -813 }, { 67, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, 838, -814, -814, -814, -814, -814, -814, 839, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814, -814 }, { 67, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, 840, -815, -815, -815, -815, -815, -815, 841, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815, -815 }, { 67, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, 842, -816, -816, -816, -816, -816, -816, 843, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816, -816 }, { 67, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, 844, -817, -817, -817, -817, -817, -817, 845, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817, -817 }, { 67, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, 846, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818, -818 }, { 67, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, 819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, 820, -819, 820, -819, -819, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819, -819 }, { 67, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820, -820 }, { 67, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, 821, 821, 821, 821, 821, 821, 821, 821, 821, 821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821, -821 }, { 67, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, 822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, 823, -822, 823, -822, -822, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822, -822 }, { 67, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823, -823 }, { 67, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824, -824 }, { 67, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, 825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, 826, -825, 826, -825, -825, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825, -825 }, { 67, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826, -826 }, { 67, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, 827, 827, 827, 827, 827, 827, 827, 827, 827, 827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827, -827 }, { 67, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, 828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, 829, -828, 829, -828, -828, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828, -828 }, { 67, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829, -829 }, { 67, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830, -830 }, { 67, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, 831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, 832, -831, 832, -831, -831, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831, -831 }, { 67, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832, -832 }, { 67, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833, -833 }, { 67, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, 834, -834, -834, -834, -834, -834, -834, 835, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834, -834 }, { 67, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847 }, { 67, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, 836, -836, -836, -836, -836, -836, -836, 837, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836, -836 }, { 67, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 850, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849 }, { 67, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, 838, -838, -838, -838, -838, -838, -838, 839, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838, -838 }, { 67, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 852, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851 }, { 67, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, 840, -840, -840, -840, -840, -840, -840, 841, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840, -840 }, { 67, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 854, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853 }, { 67, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, 842, -842, -842, -842, -842, -842, -842, 843, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842, -842 }, { 67, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 856, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855 }, { 67, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, 844, -844, -844, -844, -844, -844, -844, 845, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844, -844 }, { 67, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 858, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857 }, { 67, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, 859, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846, -846 }, { 67, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 848, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847, 847 }, { 67, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, 847, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848, -848 }, { 67, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 850, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, 849 }, { 67, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, 849, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, -850 }, { 67, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 852, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, 851 }, { 67, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, 851, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852, -852 }, { 67, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 854, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, 853 }, { 67, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, 853, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854, -854 }, { 67, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 856, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855, 855 }, { 67, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, 855, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856, -856 }, { 67, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 858, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, 857 }, { 67, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, 857, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858, -858 }, { 67, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, 860, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859, -859 }, { 67, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, 861, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860, -860 }, { 67, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, 862, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861, -861 }, { 67, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, 863, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862, -862 }, { 67, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, 864, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863, -863 }, { 67, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, 865, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864, -864 }, { 67, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, 866, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865, -865 }, { 67, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, 867, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866, -866 }, { 67, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, 868, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867, -867 }, { 67, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, 869, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868, -868 }, { 67, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, 870, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869, -869 }, { 67, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, 871, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870, -870 }, { 67, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, 872, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871, -871 }, { 67, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, 873, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872, -872 }, { 67, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, 874, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873, -873 }, { 67, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, 875, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874, -874 }, { 67, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, 876, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875, -875 }, { 67, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, 877, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876, -876 }, { 67, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, 878, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877, -877 }, { 67, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, 879, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878, -878 }, { 67, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, 880, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879, -879 }, { 67, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, 881, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880, -880 }, { 67, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, 882, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881, -881 }, { 67, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, 883, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882, -882 }, { 67, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, 884, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883, -883 }, { 67, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, 885, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884, -884 }, { 67, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, 886, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885, -885 }, { 67, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, 887, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886, -886 }, { 67, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, 888, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887, -887 }, { 67, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, 889, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888, -888 }, { 67, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, 890, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889, -889 }, { 67, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, 891, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890, -890 }, { 67, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, 892, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891, -891 }, { 67, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, 893, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892, -892 }, { 67, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, 894, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893, -893 }, { 67, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, 895, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894, -894 }, { 67, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, 896, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895, -895 }, { 67, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, 897, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896, -896 }, { 67, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, 898, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897, -897 }, { 67, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, 899, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898, -898 }, { 67, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, 900, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899, -899 }, { 67, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, 901, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900, -900 }, { 67, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, 902, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901, -901 }, { 67, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, 903, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902, -902 }, { 67, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, 904, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903, -903 }, { 67, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, 905, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904, -904 }, { 67, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, 906, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905, -905 }, { 67, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, 907, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906, -906 }, { 67, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, 908, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907, -907 }, { 67, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, 909, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908, -908 }, { 67, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, 910, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909, -909 }, { 67, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, 911, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910, -910 }, { 67, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, 912, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911, -911 }, { 67, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, 913, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912, -912 }, { 67, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, 914, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913, -913 }, { 67, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, 915, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914, -914 }, { 67, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, 916, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915, -915 }, { 67, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, 917, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916, -916 }, { 67, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, 918, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917, -917 }, { 67, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, 919, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918, -918 }, { 67, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, 920, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919, -919 }, { 67, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, 921, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920, -920 }, { 67, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, 922, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921, -921 }, { 67, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, 923, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922, -922 }, { 67, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, 924, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923, -923 }, { 67, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, 925, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924, -924 }, { 67, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, 926, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925, -925 }, { 67, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926, -926 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up wcsbthtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ wcsbthleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 283 #define YY_END_OF_BUFFER 284 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[927] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 278, 278, 280, 280, 281, 281, 0, 0, 284, 283, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 283, 148, 148, 140, 140, 149, 149, 141, 141, 161, 161, 161, 283, 182, 182, 171, 171, 187, 187, 198, 198, 199, 199, 230, 230, 265, 265, 243, 243, 266, 266, 244, 244, 268, 268, 201, 202, 200, 209, 209, 210, 210, 218, 218, 219, 219, 270, 270, 272, 272, 271, 274, 274, 274, 273, 276, 276, 279, 278, 277, 280, 281, 283, 282, 0, 0, 0, 64, 58, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 63, 57, 0, 0, 0, 0, 0, 0, 0, 23, 0, 19, 66, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 269, 271, 0, 273, 273, 273, 273, 0, 0, 275, 278, 277, 277, 280, 281, 0, 282, 0, 0, 0, 0, 0, 0, 0, 0, 65, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 20, 67, 61, 0, 0, 0, 0, 0, 0, 0, 0, 127, 128, 129, 0, 0, 0, 130, 131, 132, 137, 136, 0, 0, 0, 133, 134, 135, 139, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 183, 184, 186, 185, 188, 189, 190, 195, 194, 191, 192, 193, 197, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 267, 0, 0, 0, 206, 207, 208, 0, 0, 0, 215, 216, 217, 273, 0, 273, 22, 18, 26, 0, 69, 74, 0, 13, 44, 79, 39, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, 0, 0, 91, 51, 49, 0, 93, 0, 0, 0, 103, 0, 54, 56, 108, 106, 110, 0, 28, 0, 71, 76, 0, 15, 46, 81, 41, 36, 0, 122, 114, 0, 0, 0, 0, 112, 0, 0, 121, 0, 0, 124, 142, 143, 144, 145, 146, 147, 0, 0, 0, 0, 0, 0, 162, 163, 164, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 203, 204, 205, 211, 212, 213, 214, 27, 70, 75, 31, 14, 45, 80, 40, 35, 25, 68, 73, 30, 12, 43, 78, 38, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 97, 99, 101, 62, 0, 0, 0, 0, 0, 0, 0, 29, 72, 77, 32, 16, 47, 82, 42, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 167, 169, 165, 166, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, 234, 235, 231, 232, 233, 0, 0, 0, 0, 0, 0, 0, 0, 242, 240, 241, 237, 238, 239, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 160, 159, 155, 158, 152, 153, 157, 150, 151, 154, 156, 181, 177, 180, 174, 176, 179, 172, 173, 175, 178, 229, 225, 228, 222, 223, 227, 220, 221, 224, 226, 260, 250, 259, 248, 249, 258, 245, 246, 247, 257, 264, 256, 263, 254, 255, 262, 251, 252, 253, 261, 0, 0, 0, 0, 0, 0, 0, 90, 50, 48, 0, 0, 0, 0, 102, 0, 52, 55, 105, 107, 109, 0, 113, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0, 0, 123, 83, 85, 86, 87, 88, 0, 89, 92, 94, 96, 98, 100, 104, 53, 0, 115, 117, 118, 119, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; static yyconst yy_state_type yy_NUL_trans[927] = { 0, 68, 69, 68, 68, 85, 85, 87, 87, 89, 89, 91, 91, 93, 93, 68, 68, 97, 97, 99, 99, 101, 101, 103, 103, 105, 105, 107, 107, 109, 109, 111, 111, 113, 113, 115, 115, 117, 117, 119, 119, 120, 120, 122, 122, 124, 124, 126, 126, 128, 128, 130, 130, 132, 132, 135, 135, 139, 139, 141, 141, 144, 144, 145, 145, 146, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 0, 0, 251, 252, 253, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 0, 0, 251, 251, 252, 253, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 847, 0, 849, 0, 851, 0, 853, 0, 855, 0, 857, 0, 847, 0, 849, 0, 851, 0, 853, 0, 855, 0, 857, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; extern int wcsbth_flex_debug; int wcsbth_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *wcsbthtext; #line 1 "wcsbth.l" /*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsbth.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical * scanner for parsing the WCS keyrecords for one or more image arrays and/or * pixel lists in a FITS binary table header. It can also handle primary image * and image extension headers. * * wcsbth.l requires Flex v2.5.4 or later. Refer to wcshdr.h for a description * of the user interface and operating notes. * * Implementation notes * -------------------- * wcsbth() may be invoked with an option that causes it to recognise the * image-header form of WCS keywords as defaults for each alternate coordinate * representation (up to 27). By design, with this option enabled wcsbth() can * also handle primary image and image extension headers, effectively treating * them as a single-column binary table though with WCS keywords of a different * form. * * NAXIS is always 2 for binary tables, it refers to the two-dimensional nature * of the table. Thus NAXIS does not count the number of image axes in either * image arrays or pixels lists and for the latter there is not even a formal * equivalent of WCSAXESa. Hence NAXIS is always ignored and a first pass * through the header is required to determine the number of images, the number * of alternate coordinate representations for each image (up to 27), and the * number of coordinate axes in each representation; this pass also counts the * number of iPVn_ma and iPSn_ma or TVk_ma and TSk_ma keywords in each * representation. * * On completion of the first pass, the association between column number and * axis number is defined for each representation of a pixel list. Memory is * allocated for an array of the required number of wcsprm structs and each of * these is initialized appropriately. These structs are filled in the second * pass. * * It is permissible for a scalar table column to contain degenerate (single- * point) image arrays and simultaneously form one axis of a pixel list. * * The parser does not check for duplicated keywords, for most keywords it * accepts the last encountered. * * wcsbth() does not currently handle the Green Bank convention. * *===========================================================================*/ /* Options. */ /* Indices for parameterized keywords. */ /* Alternate coordinate system identifier. */ /* Keyvalue data types. */ /* Exclusive start states. */ #line 106 "wcsbth.l" #include #include #include #include #include #include "wcs.h" #include "wcshdr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcsutil.h" /* Codes used for keyvalue data types. */ #define INTEGER 0 #define FLOAT 1 #define STRING 2 /* Bit masks used for keyword types: */ #define IMGAUX 0x1 /* Auxiliary image header, e.g. LONPOLEa or */ /* DATE-OBS. */ #define IMGAXIS 0x2 /* Image header with axis number, e.g. */ /* CTYPEia. */ #define IMGHEAD 0x3 /* Image header of either type. */ #define BIMGARR 0x4 /* Binary table image array with axis */ /* number, e.g. iCTYna. */ #define PIXLIST 0x8 /* Pixel list, e.g. TCTYna. */ #define BINTAB 0xC /* Shared binary table image array (without */ /* axis number) or pixel list, e.g. LONPna */ /* or OBSGXn. */ #define YY_DECL int wcsbth(char *header, int nkeyrec, int relax, int ctrl, \ int keysel, int *colsel, int *nreject, int *nwcs, \ struct wcsprm **wcs) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (wcsbth_nkeyrec) { \ strncpy(inbuff, wcsbth_hdr, 80); \ inbuff[80] = '\n'; \ wcsbth_hdr += 80; \ wcsbth_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* A convenience macro to get around incompatibilities between unput() and yyless(): put wcsbthtext followed by a blank back onto the input stream. */ #define WCSBTH_PUTBACK \ sprintf(stmp, "%s ", wcsbthtext); \ itmp = strlen(stmp); \ while (itmp) unput(stmp[--itmp]); /* These global variables are required by YY_INPUT. */ char *wcsbth_hdr; int wcsbth_nkeyrec; /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsbth_abort_jmp_env; #define exit(status) longjmp(wcsbth_abort_jmp_env, status) /* Struct used internally for header bookkeeping. */ struct wcsbth_alts { int ncol, ialt, icol, imgherit; short int (*arridx)[27]; short int pixidx[27]; short int pad1; unsigned int *pixlist; unsigned char (*npv)[27]; unsigned char (*nps)[27]; unsigned char pixnpv[27]; unsigned char pixnps[27]; unsigned char pad2[2]; }; int wcsbth_pass1(int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts); int wcsbth_init1(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs); struct wcsprm *wcsbth_idx(struct wcsprm *wcs, struct wcsbth_alts *alts, int keytype, int n, char a); int wcsbth_colax(struct wcsprm *wcs, struct wcsbth_alts *alts, int k, char a); int wcsbth_epoch(void *wptr); int wcsbth_vsource(void *wptr); int wcsbth_final(struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs); #line 16846 "wcsbth.c" #define INITIAL 0 #define CCCCCia 1 #define iCCCna 2 #define iCCCCn 3 #define TCCCna 4 #define TCCCCn 5 #define CCi_ja 6 #define ijCCna 7 #define TCn_ka 8 #define TCCn_ka 9 #define CROTAi 10 #define iCROTn 11 #define TCROTn 12 #define CCi_ma 13 #define iCn_ma 14 #define iCCn_ma 15 #define TCn_ma 16 #define TCCn_ma 17 #define PROJPm 18 #define CCCCCCCC 19 #define CCCCCCCa 20 #define CCCCna 21 #define CCCCCna 22 #define CCCCn 23 #define CCCCCn 24 #define VALUE 25 #define INTEGER_VAL 26 #define FLOAT_VAL 27 #define STRING_VAL 28 #define COMMENT 29 #define DISCARD 30 #define ERROR 31 #define FLUSH 32 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int wcsbthlex_destroy (void ); int wcsbthget_debug (void ); void wcsbthset_debug (int debug_flag ); YY_EXTRA_TYPE wcsbthget_extra (void ); void wcsbthset_extra (YY_EXTRA_TYPE user_defined ); FILE *wcsbthget_in (void ); void wcsbthset_in (FILE * in_str ); FILE *wcsbthget_out (void ); void wcsbthset_out (FILE * out_str ); int wcsbthget_leng (void ); char *wcsbthget_text (void ); int wcsbthget_lineno (void ); void wcsbthset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int wcsbthwrap (void ); #else extern int wcsbthwrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( wcsbthtext, wcsbthleng, 1, wcsbthout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ while ( (result = read( fileno(wcsbthin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(wcsbthin); \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int wcsbthlex (void); #define YY_DECL int wcsbthlex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after wcsbthtext and wcsbthleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( wcsbthleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (wcsbthtext[wcsbthleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 198 "wcsbth.l" /* Keyword indices, as used in the WCS papers, e.g. iVn_ma, TPn_ka. */ char a; int i, j, k, m, n; char *cptr, *errmsg, errtxt[80], exclude[1000], *extkey, *hptr, ptype, stmp[16]; int altlin, ialt, icol, incl, ipass, ipx, itmp, ix, jx, keytype, nsel, npass, status, valtype, voff; void *vptr, *wptr; struct wcsbth_alts alts; struct wcsprm *wcsp, wcstem; int (*special)(void *); int wcsbthlex_destroy(void); /* The data structures produced. */ *nwcs = 0; *wcs = 0x0; /* Parameters used to implement YY_INPUT. */ wcsbth_hdr = header; wcsbth_nkeyrec = nkeyrec; /* Our handle on the input stream. */ hptr = header; *nreject = 0; /* Keyword parameters. */ i = j = 0; n = k = 0; m = 0; a = ' '; /* Header bookkeeping. */ alts.ncol = 0; alts.arridx = 0x0; alts.pixlist = 0x0; alts.npv = 0x0; alts.nps = 0x0; for (ialt = 0; ialt < 27; ialt++) { alts.pixidx[ialt] = 0; alts.pixnpv[ialt] = 0; alts.pixnps[ialt] = 0; } /* For decoding the keyvalue. */ keytype = 0; valtype = -1; vptr = 0x0; /* For keywords that require special handling. */ altlin = 0; ptype = ' '; special = 0x0; /* Selection by column number. */ nsel = colsel ? colsel[0] : 0; incl = (nsel > 0); for (icol = 0; icol < 1000; icol++) { exclude[icol] = incl; } for (icol = 1; icol <= abs(nsel); icol++) { itmp = colsel[icol]; if (0 < itmp && itmp < 1000) { exclude[itmp] = !incl; } } exclude[0] = 0; /* Selection by keyword type. */ itmp = keysel; keysel = 0; if (itmp) { if (itmp & WCSHDR_IMGHEAD) keysel |= IMGHEAD; if (itmp & WCSHDR_BIMGARR) keysel |= BIMGARR; if (itmp & WCSHDR_PIXLIST) keysel |= PIXLIST; } if (keysel == 0) { keysel = IMGHEAD | BINTAB; } /* Control variables. */ ipass = 1; npass = 2; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsbth_abort_jmp_env)) { return 4; } BEGIN(INITIAL); #line 17147 "wcsbth.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! wcsbthin ) wcsbthin = stdin; if ( ! wcsbthout ) wcsbthout = stdout; if ( ! YY_CURRENT_BUFFER ) { wcsbthensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); } wcsbth_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of wcsbthtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } ++yy_cp; } yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos) + 1; yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 292 "wcsbth.l" { if (ipass == 1) { if (alts.ncol == 0) { sscanf(wcsbthtext, "TFIELDS = %d", &(alts.ncol)); BEGIN(FLUSH); } else { errmsg = "Duplicate or out-of-sequence TFIELDS keyword"; BEGIN(ERROR); } } else { BEGIN(FLUSH); } } YY_BREAK case 2: YY_RULE_SETUP #line 307 "wcsbth.l" { keytype = IMGAXIS; if (!(keytype & keysel)) { /* Ignore this key type. */ BEGIN(DISCARD); } else { if (relax & WCSHDR_ALLIMG) { if (ipass == 1) { sscanf(wcsbthtext, "WCSAXES%c= %d", &a, &i); wcsbth_pass1(IMGAXIS, i, 0, 0, 0, a, ' ', &alts); } BEGIN(FLUSH); } else if (relax & WCSHDR_reject) { errmsg = "Image-header keyword WCSAXESa in binary table"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } YY_BREAK case 3: #line 335 "wcsbth.l" case 4: #line 336 "wcsbth.l" case 5: YY_RULE_SETUP #line 336 "wcsbth.l" { keytype = BIMGARR; /* Note that a blank in the sscanf() format string matches zero or more of them in the input. */ sscanf(wcsbthtext, "WCAX%d%c = %d", &n, &a, &i); if (!(keytype & keysel) || exclude[n]) { /* Ignore this key type or column. */ BEGIN(DISCARD); } else { if (ipass == 1) { wcsbth_pass1(BIMGARR, i, 0, n, 0, a, ' ', &alts); } BEGIN(FLUSH); } } YY_BREAK case 6: /* rule 6 can match eol */ #line 355 "wcsbth.l" case 7: /* rule 7 can match eol */ #line 356 "wcsbth.l" case 8: /* rule 8 can match eol */ YY_RULE_SETUP #line 356 "wcsbth.l" { /* Cross-reference supplier. */ keytype = BIMGARR; errmsg = "Cross-references are not currently implemented"; BEGIN(ERROR); } YY_BREAK case 9: /* rule 9 can match eol */ #line 364 "wcsbth.l" case 10: /* rule 10 can match eol */ #line 365 "wcsbth.l" case 11: /* rule 11 can match eol */ YY_RULE_SETUP #line 365 "wcsbth.l" { /* Cross-reference consumer. */ keytype = BIMGARR; errmsg = "Cross-references are not currently implemented"; BEGIN(ERROR); } YY_BREAK case 12: YY_RULE_SETUP #line 372 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); extkey = "CRPIXja"; BEGIN(CCCCCia); } YY_BREAK case 13: #line 381 "wcsbth.l" case 14: YY_RULE_SETUP #line 381 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { extkey = "jCRPXn"; BEGIN(iCCCCn); } } YY_BREAK case 15: #line 396 "wcsbth.l" case 16: YY_RULE_SETUP #line 396 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crpix); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { extkey = "TCRPXn"; BEGIN(TCCCCn); } } YY_BREAK case 17: YY_RULE_SETUP #line 408 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; extkey = "PCi_ja"; BEGIN(CCi_ja); } YY_BREAK case 18: YY_RULE_SETUP #line 417 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; sscanf(wcsbthtext, "%1d%1d", &i, &j); BEGIN(ijCCna); } YY_BREAK case 19: #line 428 "wcsbth.l" case 20: YY_RULE_SETUP #line 428 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pc); altlin = 1; if (wcsbthleng == 2) { BEGIN(TCn_ka); } else { extkey = "TPCn_ka"; BEGIN(TCCn_ka); } } YY_BREAK case 21: YY_RULE_SETUP #line 441 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; extkey = "CDi_ja"; BEGIN(CCi_ja); } YY_BREAK case 22: YY_RULE_SETUP #line 450 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; sscanf(wcsbthtext, "%1d%1d", &i, &j); BEGIN(ijCCna); } YY_BREAK case 23: #line 461 "wcsbth.l" case 24: YY_RULE_SETUP #line 461 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cd); altlin = 2; if (wcsbthleng == 2) { BEGIN(TCn_ka); } else { extkey = "TCDn_ka"; BEGIN(TCCn_ka); } } YY_BREAK case 25: YY_RULE_SETUP #line 474 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); extkey = "CDELTia"; BEGIN(CCCCCia); } YY_BREAK case 26: #line 483 "wcsbth.l" case 27: YY_RULE_SETUP #line 483 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { extkey = "iCDLTn"; BEGIN(iCCCCn); } } YY_BREAK case 28: #line 498 "wcsbth.l" case 29: YY_RULE_SETUP #line 498 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.cdelt); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { extkey = "TCDLTn"; BEGIN(TCCCCn); } } YY_BREAK case 30: YY_RULE_SETUP #line 510 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; extkey = "CROTAi"; BEGIN(CROTAi); } YY_BREAK case 31: YY_RULE_SETUP #line 519 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; sscanf(wcsbthtext, "%d", &i); extkey = "iCROTn"; BEGIN(iCROTn); } YY_BREAK case 32: YY_RULE_SETUP #line 530 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crota); altlin = 4; extkey = "TCROTn"; BEGIN(TCROTn); } YY_BREAK case 33: YY_RULE_SETUP #line 539 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); extkey = "CUNITia"; BEGIN(CCCCCia); } YY_BREAK case 34: #line 548 "wcsbth.l" case 35: YY_RULE_SETUP #line 548 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { extkey = "iCUNIn"; BEGIN(iCCCCn); } } YY_BREAK case 36: #line 563 "wcsbth.l" case 37: YY_RULE_SETUP #line 563 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cunit); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { extkey = "TCUNIn"; BEGIN(TCCCCn); } } YY_BREAK case 38: YY_RULE_SETUP #line 575 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); extkey = "CTYPEia"; BEGIN(CCCCCia); } YY_BREAK case 39: #line 584 "wcsbth.l" case 40: YY_RULE_SETUP #line 584 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { extkey = "iCTYPn"; BEGIN(iCCCCn); } } YY_BREAK case 41: #line 599 "wcsbth.l" case 42: YY_RULE_SETUP #line 599 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ctype); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { extkey = "TCTYPn"; BEGIN(TCCCCn); } } YY_BREAK case 43: YY_RULE_SETUP #line 611 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); extkey = "CRVALia"; BEGIN(CCCCCia); } YY_BREAK case 44: #line 620 "wcsbth.l" case 45: YY_RULE_SETUP #line 620 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { extkey = "iCRVLn"; BEGIN(iCCCCn); } } YY_BREAK case 46: #line 635 "wcsbth.l" case 47: YY_RULE_SETUP #line 635 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crval); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { extkey = "TCRVLn"; BEGIN(TCCCCn); } } YY_BREAK case 48: #line 648 "wcsbth.l" case 49: YY_RULE_SETUP #line 648 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.lonpole); if (wcsbthleng == 7) { extkey = "LONPOLEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 50: #line 661 "wcsbth.l" case 51: YY_RULE_SETUP #line 661 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.latpole); if (wcsbthleng == 7) { extkey = "LATPOLEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 52: #line 674 "wcsbth.l" case 53: #line 675 "wcsbth.l" case 54: YY_RULE_SETUP #line 675 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.restfrq); if (wcsbthleng == 8) { unput(' '); extkey = "RESTFREQ"; BEGIN(CCCCCCCa); } else if (wcsbthleng == 7) { extkey = "RESTFRQa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 55: #line 692 "wcsbth.l" case 56: YY_RULE_SETUP #line 692 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.restwav); if (wcsbthleng == 7) { extkey = "RESTWAVa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 57: YY_RULE_SETUP #line 704 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; extkey = "PVi_ma"; BEGIN(CCi_ma); } YY_BREAK case 58: #line 714 "wcsbth.l" case 59: YY_RULE_SETUP #line 714 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 2) { BEGIN(iCn_ma); } else { extkey = "iPVn_ma"; BEGIN(iCCn_ma); } } YY_BREAK case 60: #line 730 "wcsbth.l" case 61: YY_RULE_SETUP #line 730 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; if (wcsbthleng == 2) { BEGIN(TCn_ma); } else { extkey = "TPVn_ma"; BEGIN(TCCn_ma); } } YY_BREAK case 62: YY_RULE_SETUP #line 743 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.pv); ptype = 'v'; BEGIN(PROJPm); } YY_BREAK case 63: YY_RULE_SETUP #line 751 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; extkey = "PSi_ma"; BEGIN(CCi_ma); } YY_BREAK case 64: #line 761 "wcsbth.l" case 65: YY_RULE_SETUP #line 761 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 2) { BEGIN(iCn_ma); } else { extkey = "iPSn_ma"; BEGIN(iCCn_ma); } } YY_BREAK case 66: #line 777 "wcsbth.l" case 67: YY_RULE_SETUP #line 777 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.ps); ptype = 's'; if (wcsbthleng == 2) { BEGIN(TCn_ma); } else { extkey = "TPSn_ma"; BEGIN(TCCn_ma); } } YY_BREAK case 68: YY_RULE_SETUP #line 790 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); extkey = "CNAMEia"; BEGIN(CCCCCia); } YY_BREAK case 69: #line 799 "wcsbth.l" case 70: YY_RULE_SETUP #line 799 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCNAMn"; BEGIN(iCCCCn); } } YY_BREAK case 71: #line 815 "wcsbth.l" case 72: YY_RULE_SETUP #line 815 "wcsbth.l" { valtype = STRING; vptr = &(wcstem.cname); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCNAMn"; BEGIN(TCCCCn); } } YY_BREAK case 73: YY_RULE_SETUP #line 828 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); extkey = "CRDERia"; BEGIN(CCCCCia); } YY_BREAK case 74: #line 837 "wcsbth.l" case 75: YY_RULE_SETUP #line 837 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCRDEn"; BEGIN(iCCCCn); } } YY_BREAK case 76: #line 853 "wcsbth.l" case 77: YY_RULE_SETUP #line 853 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.crder); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCRDEn"; BEGIN(TCCCCn); } } YY_BREAK case 78: YY_RULE_SETUP #line 866 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); extkey = "CSYERia"; BEGIN(CCCCCia); } YY_BREAK case 79: #line 875 "wcsbth.l" case 80: YY_RULE_SETUP #line 875 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); sscanf(wcsbthtext, "%d", &i); if (wcsbthleng == 4) { BEGIN(iCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "iCSYEn"; BEGIN(iCCCCn); } } YY_BREAK case 81: #line 891 "wcsbth.l" case 82: YY_RULE_SETUP #line 891 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.csyer); if (wcsbthleng == 4) { BEGIN(TCCCna); } else { if (!(relax & WCSHDR_CNAMn)) vptr = 0x0; extkey = "TCSYEn"; BEGIN(TCCCCn); } } YY_BREAK case 83: #line 905 "wcsbth.l" case 84: YY_RULE_SETUP #line 905 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateavg; if (wcsbthleng == 8) { extkey = "DATE-AVG"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCn); } } YY_BREAK case 85: YY_RULE_SETUP #line 917 "wcsbth.l" { valtype = STRING; vptr = wcstem.dateobs; extkey = "DATE-OBS"; BEGIN(CCCCCCCC); } YY_BREAK case 86: #line 926 "wcsbth.l" case 87: #line 927 "wcsbth.l" case 88: YY_RULE_SETUP #line 927 "wcsbth.l" { if (relax & WCSHDR_DOBSn) { valtype = STRING; vptr = wcstem.dateobs; yyless(4); BEGIN(CCCCn); } else { keytype = BINTAB; if (relax & WCSHDR_reject) { errmsg = "DOBSna keyword is non-standard"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 89: YY_RULE_SETUP #line 946 "wcsbth.l" { sscanf(wcsbthtext, "EPOCH%c", &a); if (a == ' ' || (relax & WCSHDR_EPOCHa)) { valtype = FLOAT; vptr = &(wcstem.equinox); special = wcsbth_epoch; unput(a); extkey = "EPOCH"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "EPOCH keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 90: #line 970 "wcsbth.l" case 91: YY_RULE_SETUP #line 970 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.equinox); if (wcsbthleng == 7) { extkey = "EQUINOXa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 92: #line 983 "wcsbth.l" case 93: YY_RULE_SETUP #line 983 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdavg); if (wcsbthleng == 8) { extkey = "MJD-AVG"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCn); } } YY_BREAK case 94: #line 996 "wcsbth.l" case 95: YY_RULE_SETUP #line 996 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.mjdobs); if (wcsbthleng == 8) { extkey = "MJD-OBS"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } YY_BREAK case 96: #line 1009 "wcsbth.l" case 97: YY_RULE_SETUP #line 1009 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo; if (wcsbthleng == 8) { extkey = "OBSGEO-X"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } YY_BREAK case 98: #line 1022 "wcsbth.l" case 99: YY_RULE_SETUP #line 1022 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 1; if (wcsbthleng == 8) { extkey = "OBSGEO-Y"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } YY_BREAK case 100: #line 1035 "wcsbth.l" case 101: YY_RULE_SETUP #line 1035 "wcsbth.l" { valtype = FLOAT; vptr = wcstem.obsgeo + 2; if (wcsbthleng == 8) { extkey = "OBSGEO-Z"; BEGIN(CCCCCCCC); } else { BEGIN(CCCCCn); } } YY_BREAK case 102: #line 1048 "wcsbth.l" case 103: YY_RULE_SETUP #line 1048 "wcsbth.l" { valtype = STRING; vptr = wcstem.radesys; if (wcsbthleng == 7) { extkey = "RADESYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 104: YY_RULE_SETUP #line 1060 "wcsbth.l" { if (relax & WCSHDR_RADECSYS) { valtype = STRING; vptr = wcstem.radesys; unput(' '); extkey = "RADECSYS"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "RADECSYS keyword is non-standard"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 105: #line 1081 "wcsbth.l" case 106: YY_RULE_SETUP #line 1081 "wcsbth.l" { valtype = STRING; vptr = wcstem.specsys; if (wcsbthleng == 7) { extkey = "SPECSYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 107: #line 1094 "wcsbth.l" case 108: YY_RULE_SETUP #line 1094 "wcsbth.l" { valtype = STRING; vptr = wcstem.ssysobs; if (wcsbthleng == 7) { extkey = "SSYSOBSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 109: #line 1107 "wcsbth.l" case 110: YY_RULE_SETUP #line 1107 "wcsbth.l" { valtype = STRING; vptr = wcstem.ssyssrc; if (wcsbthleng == 7) { extkey = "SSYSSRCa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 111: #line 1120 "wcsbth.l" case 112: YY_RULE_SETUP #line 1120 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.velosys); if (wcsbthleng == 7) { extkey = "VELOSYSa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 113: #line 1133 "wcsbth.l" case 114: YY_RULE_SETUP #line 1133 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.velangl); if (wcsbthleng == 7) { extkey = "VELANGLa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 115: YY_RULE_SETUP #line 1145 "wcsbth.l" { sscanf(wcsbthtext, "VELREF%c", &a); if (a == ' ' || (relax & WCSHDR_VELREFa)) { valtype = INTEGER; vptr = &(wcstem.velref); unput(a); extkey = "VELREF"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "VELREF keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 116: YY_RULE_SETUP #line 1167 "wcsbth.l" { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; vptr = &(wcstem.zsource); special = wcsbth_vsource; yyless(7); extkey = "VSOURCEa"; BEGIN(CCCCCCCa); } else { keytype = IMGAUX; if (relax & WCSHDR_reject) { errmsg = "VSOURCEa keyword is deprecated"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 117: #line 1189 "wcsbth.l" case 118: #line 1190 "wcsbth.l" case 119: YY_RULE_SETUP #line 1190 "wcsbth.l" { if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; vptr = &(wcstem.zsource); special = wcsbth_vsource; yyless(4); BEGIN(CCCCna); } else { keytype = BINTAB; if (relax & WCSHDR_reject) { errmsg = "VSOUna keyword is deprecated"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } YY_BREAK case 120: #line 1212 "wcsbth.l" case 121: #line 1213 "wcsbth.l" case 122: YY_RULE_SETUP #line 1213 "wcsbth.l" { valtype = STRING; vptr = wcstem.wcsname; if (wcsbthleng == 7) { extkey = "WCSNAMEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 123: #line 1226 "wcsbth.l" case 124: YY_RULE_SETUP #line 1226 "wcsbth.l" { valtype = FLOAT; vptr = &(wcstem.zsource); if (wcsbthleng == 7) { extkey = "ZSOURCEa"; BEGIN(CCCCCCCa); } else { BEGIN(CCCCna); } } YY_BREAK case 125: YY_RULE_SETUP #line 1238 "wcsbth.l" { yyless(0); if (wcsbth_nkeyrec) { wcsbth_nkeyrec = 0; errmsg = "Keyrecords following the END keyrecord were ignored"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 126: YY_RULE_SETUP #line 1249 "wcsbth.l" { yyless(0); BEGIN(DISCARD); } YY_BREAK case 127: #line 1255 "wcsbth.l" case 128: YY_RULE_SETUP #line 1255 "wcsbth.l" { /* Image-header keyword. */ keytype = IMGAXIS; if (relax & WCSHDR_ALLIMG) { sscanf(wcsbthtext, "%d%c", &i, &a); BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 129: YY_RULE_SETUP #line 1274 "wcsbth.l" { /* Invalid axis number in image-header keyword. */ keytype = IMGAXIS; if (relax & WCSHDR_ALLIMG) { /* Will also be flagged by as invalid. */ sscanf(wcsbthtext, "%3d", &i); BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 130: #line 1289 "wcsbth.l" case 131: #line 1290 "wcsbth.l" case 132: #line 1291 "wcsbth.l" case 133: #line 1292 "wcsbth.l" case 134: #line 1293 "wcsbth.l" case 135: YY_RULE_SETUP #line 1293 "wcsbth.l" { if (vptr) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna); } else { keytype = (YY_START == iCCCCn) ? BIMGARR : PIXLIST; if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { BEGIN(DISCARD); } } } YY_BREAK case 136: #line 1310 "wcsbth.l" case 137: #line 1311 "wcsbth.l" case 138: #line 1312 "wcsbth.l" case 139: YY_RULE_SETUP #line 1312 "wcsbth.l" { if (vptr && (relax & WCSHDR_LONGKEY)) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCCCn) ? iCCCna : TCCCna); } else { keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST; if (relax & WCSHDR_reject) { errmsg = errtxt; if (!vptr) { sprintf(errmsg, "%s keyword is non-standard", extkey); } else { sprintf(errmsg, "%s keyword may not have an alternate version code", extkey); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } } YY_BREAK case 140: #line 1337 "wcsbth.l" case 141: YY_RULE_SETUP #line 1337 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 142: #line 1342 "wcsbth.l" case 143: #line 1343 "wcsbth.l" case 144: #line 1344 "wcsbth.l" case 145: #line 1345 "wcsbth.l" case 146: #line 1346 "wcsbth.l" case 147: YY_RULE_SETUP #line 1346 "wcsbth.l" { sscanf(wcsbthtext, "%d%c", &n, &a); if (YY_START == TCCCna) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCCCna) ? BIMGARR : PIXLIST; BEGIN(VALUE); } YY_BREAK case 148: #line 1354 "wcsbth.l" case 149: YY_RULE_SETUP #line 1354 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 150: #line 1359 "wcsbth.l" case 151: #line 1360 "wcsbth.l" case 152: #line 1361 "wcsbth.l" case 153: YY_RULE_SETUP #line 1361 "wcsbth.l" { /* Image-header keyword. */ if (relax & WCSHDR_ALLIMG) { sscanf(wcsbthtext, "%d_%d%c", &i, &j, &a); keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 154: #line 1381 "wcsbth.l" case 155: #line 1382 "wcsbth.l" case 156: #line 1383 "wcsbth.l" case 157: #line 1384 "wcsbth.l" case 158: #line 1385 "wcsbth.l" case 159: YY_RULE_SETUP #line 1385 "wcsbth.l" { /* Invalid axis number in image-header keyword. */ if (relax & WCSHDR_ALLIMG) { /* Will be flagged by as invalid. */ sscanf(wcsbthtext, "%d_%d", &i, &j); keytype = IMGAXIS; BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 160: YY_RULE_SETUP #line 1399 "wcsbth.l" { /* This covers the defunct forms CD00i00j and PC00i00j. */ if (((relax & WCSHDR_PC00i00j) && (altlin == 1)) || ((relax & WCSHDR_CD00i00j) && (altlin == 2))) { sscanf(wcsbthtext, "%3d%3d", &i, &j); a = ' '; keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Defunct form of %si_ja keyword", (altlin==1) ? "PC" : "CD"); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 161: YY_RULE_SETUP #line 1420 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 162: #line 1425 "wcsbth.l" case 163: #line 1426 "wcsbth.l" case 164: YY_RULE_SETUP #line 1426 "wcsbth.l" { sscanf(wcsbthtext, "%d%c", &n, &a); keytype = BIMGARR; BEGIN(VALUE); } YY_BREAK case 165: #line 1433 "wcsbth.l" case 166: #line 1434 "wcsbth.l" case 167: #line 1435 "wcsbth.l" case 168: #line 1436 "wcsbth.l" case 169: #line 1437 "wcsbth.l" case 170: YY_RULE_SETUP #line 1437 "wcsbth.l" { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; BEGIN(TCn_ka); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 171: YY_RULE_SETUP #line 1453 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 172: #line 1458 "wcsbth.l" case 173: #line 1459 "wcsbth.l" case 174: #line 1460 "wcsbth.l" case 175: #line 1461 "wcsbth.l" case 176: #line 1462 "wcsbth.l" case 177: YY_RULE_SETUP #line 1462 "wcsbth.l" { sscanf(wcsbthtext, "%d_%d%c", &n, &k, &a); i = wcsbth_colax(*wcs, &alts, n, a); j = wcsbth_colax(*wcs, &alts, k, a); keytype = PIXLIST; BEGIN(VALUE); } YY_BREAK case 178: #line 1471 "wcsbth.l" case 179: #line 1472 "wcsbth.l" case 180: #line 1473 "wcsbth.l" case 181: YY_RULE_SETUP #line 1473 "wcsbth.l" { sscanf(wcsbthtext, "%d_%d", &n, &k); a = ' '; i = wcsbth_colax(*wcs, &alts, n, a); j = wcsbth_colax(*wcs, &alts, k, a); keytype = PIXLIST; BEGIN(VALUE); } YY_BREAK case 182: YY_RULE_SETUP #line 1482 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 183: #line 1487 "wcsbth.l" case 184: YY_RULE_SETUP #line 1487 "wcsbth.l" { yyless(0); BEGIN(CCCCCia); } YY_BREAK case 185: #line 1493 "wcsbth.l" case 186: YY_RULE_SETUP #line 1493 "wcsbth.l" { if (relax & WCSHDR_CROTAia) { yyless(0); BEGIN(CCCCCia); } else if (relax & WCSHDR_reject) { errmsg = "CROTAn keyword may not have an alternate version code"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 187: YY_RULE_SETUP #line 1508 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 188: #line 1513 "wcsbth.l" case 189: #line 1514 "wcsbth.l" case 190: #line 1515 "wcsbth.l" case 191: #line 1516 "wcsbth.l" case 192: #line 1517 "wcsbth.l" case 193: YY_RULE_SETUP #line 1517 "wcsbth.l" { WCSBTH_PUTBACK; BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna); } YY_BREAK case 194: #line 1523 "wcsbth.l" case 195: #line 1524 "wcsbth.l" case 196: #line 1525 "wcsbth.l" case 197: YY_RULE_SETUP #line 1525 "wcsbth.l" { if (relax & WCSHDR_CROTAia) { WCSBTH_PUTBACK; BEGIN((YY_START == iCROTn) ? iCCCna : TCCCna); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword may not have an alternate version code", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 198: #line 1543 "wcsbth.l" case 199: YY_RULE_SETUP #line 1543 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 200: #line 1548 "wcsbth.l" case 201: YY_RULE_SETUP #line 1548 "wcsbth.l" { /* Image-header keyword. */ if (relax & (WCSHDR_AUXIMG | WCSHDR_ALLIMG)) { if (YY_START == CCCCCCCa) { sscanf(wcsbthtext, "%c", &a); } else { a = 0; unput(wcsbthtext[0]); } keytype = IMGAUX; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 202: YY_RULE_SETUP #line 1572 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 203: #line 1577 "wcsbth.l" case 204: #line 1578 "wcsbth.l" case 205: #line 1579 "wcsbth.l" case 206: #line 1580 "wcsbth.l" case 207: YY_RULE_SETUP #line 1580 "wcsbth.l" { sscanf(wcsbthtext, "%d%c", &n, &a); keytype = BINTAB; BEGIN(VALUE); } YY_BREAK case 208: YY_RULE_SETUP #line 1586 "wcsbth.l" { sscanf(wcsbthtext, "%d", &n); a = ' '; keytype = BINTAB; BEGIN(VALUE); } YY_BREAK case 209: #line 1594 "wcsbth.l" case 210: YY_RULE_SETUP #line 1594 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 211: #line 1599 "wcsbth.l" case 212: #line 1600 "wcsbth.l" case 213: #line 1601 "wcsbth.l" case 214: #line 1602 "wcsbth.l" case 215: #line 1603 "wcsbth.l" case 216: #line 1604 "wcsbth.l" case 217: YY_RULE_SETUP #line 1604 "wcsbth.l" { sscanf(wcsbthtext, "%d", &n); a = 0; keytype = BINTAB; BEGIN(VALUE); } YY_BREAK case 218: #line 1612 "wcsbth.l" case 219: YY_RULE_SETUP #line 1612 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 220: #line 1617 "wcsbth.l" case 221: #line 1618 "wcsbth.l" case 222: #line 1619 "wcsbth.l" case 223: YY_RULE_SETUP #line 1619 "wcsbth.l" { /* Image-header keyword. */ if (relax & WCSHDR_ALLIMG) { sscanf(wcsbthtext, "%d_%d%c", &i, &m, &a); keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Image-header keyword %s in binary table", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 224: #line 1639 "wcsbth.l" case 225: #line 1640 "wcsbth.l" case 226: #line 1641 "wcsbth.l" case 227: #line 1642 "wcsbth.l" case 228: #line 1643 "wcsbth.l" case 229: YY_RULE_SETUP #line 1643 "wcsbth.l" { /* Invalid parameter in image-header keyword. */ if (relax & WCSHDR_ALLIMG) { /* Will be flagged by as invalid. */ sscanf(wcsbthtext, "%d_%d", &i, &m); keytype = IMGAXIS; BEGIN(VALUE); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 230: YY_RULE_SETUP #line 1657 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 231: #line 1662 "wcsbth.l" case 232: #line 1663 "wcsbth.l" case 233: #line 1664 "wcsbth.l" case 234: #line 1665 "wcsbth.l" case 235: #line 1666 "wcsbth.l" case 236: #line 1667 "wcsbth.l" case 237: #line 1668 "wcsbth.l" case 238: #line 1669 "wcsbth.l" case 239: #line 1670 "wcsbth.l" case 240: #line 1671 "wcsbth.l" case 241: #line 1672 "wcsbth.l" case 242: YY_RULE_SETUP #line 1672 "wcsbth.l" { if (relax & WCSHDR_LONGKEY) { WCSBTH_PUTBACK; BEGIN((YY_START == iCCn_ma) ? iCn_ma : TCn_ma); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "%s keyword is non-standard", extkey); BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 243: #line 1689 "wcsbth.l" case 244: YY_RULE_SETUP #line 1689 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 245: #line 1694 "wcsbth.l" case 246: #line 1695 "wcsbth.l" case 247: #line 1696 "wcsbth.l" case 248: #line 1697 "wcsbth.l" case 249: #line 1698 "wcsbth.l" case 250: #line 1699 "wcsbth.l" case 251: #line 1700 "wcsbth.l" case 252: #line 1701 "wcsbth.l" case 253: #line 1702 "wcsbth.l" case 254: #line 1703 "wcsbth.l" case 255: #line 1704 "wcsbth.l" case 256: YY_RULE_SETUP #line 1704 "wcsbth.l" { sscanf(wcsbthtext, "%d_%d%c", &n, &m, &a); if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST; BEGIN(VALUE); } YY_BREAK case 257: #line 1712 "wcsbth.l" case 258: #line 1713 "wcsbth.l" case 259: #line 1714 "wcsbth.l" case 260: #line 1715 "wcsbth.l" case 261: #line 1716 "wcsbth.l" case 262: #line 1717 "wcsbth.l" case 263: #line 1718 "wcsbth.l" case 264: YY_RULE_SETUP #line 1718 "wcsbth.l" { /* Invalid combinations will be flagged by . */ sscanf(wcsbthtext, "%d_%d", &n, &m); a = ' '; if (YY_START == TCn_ma) i = wcsbth_colax(*wcs, &alts, n, a); keytype = (YY_START == iCn_ma) ? BIMGARR : PIXLIST; BEGIN(VALUE); } YY_BREAK case 265: #line 1728 "wcsbth.l" case 266: YY_RULE_SETUP #line 1728 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 267: YY_RULE_SETUP #line 1732 "wcsbth.l" { if (relax & WCSHDR_PROJPn) { sscanf(wcsbthtext, "%d", &m); i = 0; a = ' '; keytype = IMGAXIS; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "PROJPn keyword is defunct"; BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } YY_BREAK case 268: YY_RULE_SETUP #line 1750 "wcsbth.l" { BEGIN(DISCARD); } YY_BREAK case 269: YY_RULE_SETUP #line 1754 "wcsbth.l" { /* Do checks on i, j, m, n, k. */ if (!(keytype & keysel)) { /* Selection by keyword type. */ BEGIN(DISCARD); } else if (exclude[n] || exclude[k]) { /* One or other column is not selected. */ if (k && (exclude[n] != exclude[k])) { /* For keywords such as TCn_ka, both columns must be excluded. User error, so return immediately. */ wcsbthlex_destroy(); return 3; } else { BEGIN(DISCARD); } } else if (i > 99 || j > 99 || m > 99 || n > 999 || k > 999) { if (relax & WCSHDR_reject) { errmsg = errtxt; if (i > 99 || j > 99) { sprintf(errmsg, "Axis number exceeds 99"); } else if (m > 99) { sprintf(errmsg, "Parameter number exceeds 99"); } else if (n > 999 || k > 999) { sprintf(errmsg, "Column number exceeds 999"); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } else if (ipass == 2 && npass == 3 && (keytype & BINTAB)) { /* Skip keyvalues that won't be inherited. */ BEGIN(FLUSH); } else if (ipass == 3 && (keytype & IMGHEAD)) { /* IMGHEAD keytypes are always dealt with on the second pass. */ BEGIN(FLUSH); } else if (vptr) { alts.icol = 0; alts.ialt = 0; voff = (char *)vptr - (char *)(&wcstem); if (valtype == INTEGER) { BEGIN(INTEGER_VAL); } else if (valtype == FLOAT) { BEGIN(FLOAT_VAL); } else if (valtype == STRING) { BEGIN(STRING_VAL); } else { errmsg = errtxt; sprintf(errmsg, "Internal parser ERROR, bad data type: %d", valtype); BEGIN(ERROR); } } else { errmsg = "Internal parser ERROR, null pointer"; BEGIN(ERROR); } } YY_BREAK case 270: YY_RULE_SETUP #line 1821 "wcsbth.l" { errmsg = "Invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); } YY_BREAK case 271: YY_RULE_SETUP #line 1826 "wcsbth.l" { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Read the keyvalue. */ if (special) { special(wptr); } else { sscanf(wcsbthtext, "%d", (int *)wptr); } } BEGIN(COMMENT); } } YY_BREAK case 272: YY_RULE_SETUP #line 1849 "wcsbth.l" { errmsg = "An integer value was expected"; BEGIN(ERROR); } YY_BREAK case 273: YY_RULE_SETUP #line 1854 "wcsbth.l" { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Apply keyword parameterization. */ if (ptype == 'v') { ipx = wcsp->npv++; wcsp->pv[ipx].i = i; wcsp->pv[ipx].m = m; wptr = &(wcsp->pv[ipx].value); } else if (j) { /* Is the de-reference necessary? */ wptr = *((double **)wptr) + (i - 1)*(wcsp->naxis) + (j - 1); } else if (i) { wptr = *((double **)wptr) + (i - 1); } /* Read the keyvalue. */ if (special) { special(wptr); } else { wcsutil_str2double(wcsbthtext, "%lf", (double *)wptr); } /* Flag the presence of PC, or CD and/or CROTA. */ if (altlin) { wcsp->altlin |= altlin; altlin = 0; } } BEGIN(COMMENT); } } YY_BREAK case 274: YY_RULE_SETUP #line 1898 "wcsbth.l" { errmsg = "A floating-point value was expected"; BEGIN(ERROR); } YY_BREAK case 275: /* rule 275 can match eol */ YY_RULE_SETUP #line 1903 "wcsbth.l" { if (ipass == 1) { /* Do first-pass bookkeeping. */ wcsbth_pass1(keytype, i, j, n, k, a, ptype, &alts); BEGIN(FLUSH); } else { /* Update each coordinate representation. */ while ((wcsp = wcsbth_idx(*wcs, &alts, keytype, n, a))) { wptr = (void *)((char *)wcsp + voff); /* Apply keyword parameterization. */ if (ptype == 's') { ipx = wcsp->nps++; wcsp->ps[ipx].i = i; wcsp->ps[ipx].m = m; wptr = wcsp->ps[ipx].value; } else if (j) { wptr = *((char (**)[72])wptr) + (i - 1)*(wcsp->naxis) + (j - 1); } else if (i) { wptr = *((char (**)[72])wptr) + (i - 1); } /* Read the keyvalue. */ cptr = (char *)wptr; strcpy(cptr, wcsbthtext+1); /* Squeeze out repeated quotes. */ ix = 0; for (jx = 0; jx < 72; jx++) { if (ix < jx) { cptr[ix] = cptr[jx]; } if (cptr[jx] == '\0') { if (ix) cptr[ix-1] = '\0'; break; } else if (cptr[jx] == '\'' && cptr[jx+1] == '\'') { jx++; } ix++; } } BEGIN(COMMENT); } } YY_BREAK case 276: YY_RULE_SETUP #line 1955 "wcsbth.l" { errmsg = "A string value was expected"; BEGIN(ERROR); } YY_BREAK case 277: #line 1961 "wcsbth.l" case 278: YY_RULE_SETUP #line 1961 "wcsbth.l" { BEGIN(FLUSH); } YY_BREAK case 279: YY_RULE_SETUP #line 1965 "wcsbth.l" { errmsg = "Malformed keycomment"; BEGIN(ERROR); } YY_BREAK case 280: YY_RULE_SETUP #line 1970 "wcsbth.l" { if (ipass == npass) { if (ctrl < 0) { /* Preserve discards. */ if (hptr < wcsbth_hdr-80) { strncpy(hptr, wcsbth_hdr-80, 80); } hptr += 80; } else if (ctrl > 2) { wcsfprintf(stderr, "%.80s\n Discarded.\n", wcsbth_hdr-80); } } BEGIN(FLUSH); } YY_BREAK case 281: YY_RULE_SETUP #line 1987 "wcsbth.l" { (*nreject)++; if (ipass == npass) { if (ctrl == -1) { if (hptr < wcsbth_hdr-80) { /* Preserve rejects. */ strncpy(hptr, wcsbth_hdr-80, 80); } hptr += 80; } if (abs(ctrl) > 1) { wcsfprintf(stderr, "%.80s\n%4d: %s.\n", wcsbth_hdr-80, *nreject, errmsg); } } BEGIN(FLUSH); } YY_BREAK case 282: /* rule 282 can match eol */ YY_RULE_SETUP #line 2007 "wcsbth.l" { /* Throw away the rest of the line and reset for the next one. */ i = j = 0; n = k = 0; m = 0; a = ' '; keytype = 0; valtype = -1; vptr = 0x0; altlin = 0; ptype = ' '; special = 0x0; BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(CCCCCia): case YY_STATE_EOF(iCCCna): case YY_STATE_EOF(iCCCCn): case YY_STATE_EOF(TCCCna): case YY_STATE_EOF(TCCCCn): case YY_STATE_EOF(CCi_ja): case YY_STATE_EOF(ijCCna): case YY_STATE_EOF(TCn_ka): case YY_STATE_EOF(TCCn_ka): case YY_STATE_EOF(CROTAi): case YY_STATE_EOF(iCROTn): case YY_STATE_EOF(TCROTn): case YY_STATE_EOF(CCi_ma): case YY_STATE_EOF(iCn_ma): case YY_STATE_EOF(iCCn_ma): case YY_STATE_EOF(TCn_ma): case YY_STATE_EOF(TCCn_ma): case YY_STATE_EOF(PROJPm): case YY_STATE_EOF(CCCCCCCC): case YY_STATE_EOF(CCCCCCCa): case YY_STATE_EOF(CCCCna): case YY_STATE_EOF(CCCCCna): case YY_STATE_EOF(CCCCn): case YY_STATE_EOF(CCCCCn): case YY_STATE_EOF(VALUE): case YY_STATE_EOF(INTEGER_VAL): case YY_STATE_EOF(FLOAT_VAL): case YY_STATE_EOF(STRING_VAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(DISCARD): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): #line 2024 "wcsbth.l" { /* End-of-input. */ if (ipass == 1) { if ((status = wcsbth_init1(&alts, nwcs, wcs)) || *nwcs == 0) { wcsbthlex_destroy(); return status; } if (alts.imgherit) npass = 3; if (abs(ctrl) > 2) { if (*nwcs == 1) { wcsfprintf(stderr, "Found one coordinate representation.\n"); } else { wcsfprintf(stderr, "Found %d coordinate representations.\n", *nwcs); } } } if (ipass++ < npass) { wcsbth_hdr = header; wcsbth_nkeyrec = nkeyrec; *nreject = 0; i = j = 0; k = n = 0; m = 0; a = ' '; keytype = 0; valtype = -1; vptr = 0x0; altlin = 0; ptype = ' '; special = 0x0; wcsbthrestart(wcsbthin); } else { wcsbthlex_destroy(); if (ctrl < 0) { *hptr = '\0'; } else if (ctrl == 1) { wcsfprintf(stderr, "%d WCS keyrecords were rejected.\n", *nreject); } return wcsbth_final(&alts, nwcs, wcs); } } YY_BREAK case 283: YY_RULE_SETUP #line 2078 "wcsbth.l" ECHO; YY_BREAK #line 19586 "wcsbth.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed wcsbthin at a new source and called * wcsbthlex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsbthin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( wcsbthwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * wcsbthtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of wcsbthlex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ wcsbthrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; wcsbthrestart(wcsbthin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsbthrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { if ( *yy_cp ) { yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; } else yy_current_state = yy_NUL_trans[yy_current_state]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); if ( ! yy_is_jam ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up wcsbthtext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ wcsbthrestart(wcsbthin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( wcsbthwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve wcsbthtext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void wcsbthrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ wcsbthensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsbth_create_buffer(wcsbthin,YY_BUF_SIZE ); } wcsbth_init_buffer(YY_CURRENT_BUFFER,input_file ); wcsbth_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void wcsbth_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * wcsbthpop_buffer_state(); * wcsbthpush_buffer_state(new_buffer); */ wcsbthensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; wcsbth_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (wcsbthwrap()) processing, but the only time this flag * is looked at is after wcsbthwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void wcsbth_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; wcsbthin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE wcsbth_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) wcsbthalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsbth_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) wcsbthalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsbth_create_buffer()" ); b->yy_is_our_buffer = 1; wcsbth_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with wcsbth_create_buffer() * */ void wcsbth_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) wcsbthfree((void *) b->yy_ch_buf ); wcsbthfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a wcsbthrestart() or at EOF. */ static void wcsbth_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; wcsbth_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then wcsbth_init_buffer was _probably_ * called from wcsbthrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void wcsbth_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) wcsbth_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void wcsbthpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; wcsbthensure_buffer_stack(); /* This block is copied from wcsbth_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from wcsbth_switch_to_buffer. */ wcsbth_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void wcsbthpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; wcsbth_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { wcsbth_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void wcsbthensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)wcsbthalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsbthensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)wcsbthrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsbthensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsbth_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) wcsbthalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsbth_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; wcsbth_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to wcsbthlex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * wcsbth_scan_bytes() instead. */ YY_BUFFER_STATE wcsbth_scan_string (yyconst char * yystr ) { return wcsbth_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to wcsbthlex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsbth_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) wcsbthalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsbth_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = wcsbth_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in wcsbth_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsbthtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ wcsbthtext[wcsbthleng] = (yy_hold_char); \ (yy_c_buf_p) = wcsbthtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ wcsbthleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int wcsbthget_lineno (void) { return wcsbthlineno; } /** Get the input stream. * */ FILE *wcsbthget_in (void) { return wcsbthin; } /** Get the output stream. * */ FILE *wcsbthget_out (void) { return wcsbthout; } /** Get the length of the current token. * */ int wcsbthget_leng (void) { return wcsbthleng; } /** Get the current token. * */ char *wcsbthget_text (void) { return wcsbthtext; } /** Set the current line number. * @param line_number * */ void wcsbthset_lineno (int line_number ) { wcsbthlineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see wcsbth_switch_to_buffer */ void wcsbthset_in (FILE * in_str ) { wcsbthin = in_str ; } void wcsbthset_out (FILE * out_str ) { wcsbthout = out_str ; } int wcsbthget_debug (void) { return wcsbth_flex_debug; } void wcsbthset_debug (int bdebug ) { wcsbth_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from wcsbthlex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT wcsbthin = stdin; wcsbthout = stdout; #else wcsbthin = (FILE *) 0; wcsbthout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * wcsbthlex_init() */ return 0; } /* wcsbthlex_destroy is for both reentrant and non-reentrant scanners. */ int wcsbthlex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ wcsbth_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; wcsbthpop_buffer_state(); } /* Destroy the stack itself. */ wcsbthfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * wcsbthlex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *wcsbthalloc (yy_size_t size ) { return (void *) malloc( size ); } void *wcsbthrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void wcsbthfree (void * ptr ) { free( (char *) ptr ); /* see wcsbthrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 2078 "wcsbth.l" /*---------------------------------------------------------------------------- * Perform first-pass tasks: * * 1) Count the number of coordinate axes in each of the 27 possible alternate * image-header coordinate representations. Also count the number of PVi_ma * and PSi_ma keywords in each representation. * * 2) Determine the number of binary table columns that have an image array * with a coordinate representation (up to 999), and count the number of * coordinate axes in each of the 27 possible alternates. Also count the * number of iVn_ma and iSn_ma keywords in each representation. * * 3) Determine the number of alternate pixel list coordinate representations * (up to 27) and the table columns associated with each. Also count the * number of TVn_ma and TSn_ma keywords in each representation. * * In the first pass alts->arridx[icol][27] is used to determine the number of * axes in each of 27 possible image-header coordinate descriptions (icol == 0) * and each of the 27 possible coordinate representations for an image array in * each column. * * The elements of alts->pixlist[icol] are used as bit arrays to flag which of * the 27 possible pixel list coordinate representations are associated with * each table column. *---------------------------------------------------------------------------*/ int wcsbth_pass1( int keytype, int i, int j, int n, int k, char a, char ptype, struct wcsbth_alts *alts) { int ialt, icol, mask, ncol; if (a == 0) { /* Keywords such as DATE-OBS go along for the ride. */ return 0; } ncol = alts->ncol; /* Do we need to allocate memory for alts? */ if (alts->arridx == 0x0) { if (ncol == 0) { /* Can only happen if TFIELDS is missing or out-of-sequence. If n and k are both zero then we may be processing an image header so leave ncol alone - the array will be realloc'd later if required. */ if (n || k) { /* The header is mangled, assume the worst. */ ncol = 999; } } if (!(alts->arridx = calloc((1 + ncol)*27, sizeof(short int))) || !(alts->npv = calloc((1 + ncol)*27, sizeof(unsigned char))) || !(alts->nps = calloc((1 + ncol)*27, sizeof(unsigned char))) || !(alts->pixlist = calloc((1 + ncol), sizeof(unsigned int)))) { if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); return 2; } alts->ncol = ncol; } else if (n > ncol || k > ncol) { /* Can only happen if TFIELDS or the WCS keyword is wrong; carry on. */ ncol = 999; if (!(alts->arridx = realloc(alts->arridx, 27*(1 + ncol)*sizeof(short int))) || !(alts->npv = realloc(alts->npv, 27*(1 + ncol)*sizeof(unsigned char))) || !(alts->nps = realloc(alts->nps, 27*(1 + ncol)*sizeof(unsigned char))) || !(alts->pixlist = realloc(alts->pixlist, (1 + ncol)*sizeof(unsigned int)))) { if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); return 2; } /* Since realloc() doesn't initialize the extra memory. */ for (icol = (1 + alts->ncol); icol < (1 + ncol); icol++) { for (ialt = 0; ialt < 27; ialt++) { alts->arridx[icol][ialt] = 0; alts->npv[icol][ialt] = 0; alts->nps[icol][ialt] = 0; alts->pixlist[icol] = 0; } } alts->ncol = ncol; } ialt = 0; if (a != ' ') { ialt = a - 'A' + 1; } /* A BINTAB keytype such as LONPna, in conjunction with an IMGAXIS keytype causes a table column to be recognized as an image array. */ if (keytype & IMGHEAD || keytype & BIMGARR) { /* n == 0 is expected for IMGHEAD keywords. */ if (i == 0 && j == 0) { if (alts->arridx[n][ialt] == 0) { /* Flag that an auxiliary keyword was seen. */ alts->arridx[n][ialt] = -1; } } else { /* Record the maximum axis number found. */ if (alts->arridx[n][ialt] < i) { alts->arridx[n][ialt] = i; } if (alts->arridx[n][ialt] < j) { alts->arridx[n][ialt] = j; } } if (ptype == 'v') { alts->npv[n][ialt]++; } else if (ptype == 's') { alts->nps[n][ialt]++; } } /* BINTAB keytypes, which apply both to pixel lists as well as binary table image arrays, never contribute to recognizing a table column as a pixel list axis. A PIXLIST keytype is required for that. */ if (keytype == PIXLIST) { mask = 1 << ialt; /* n > 0 for PIXLIST keytypes. */ alts->pixlist[n] |= mask; if (k) alts->pixlist[k] |= mask; /* Used as a flag over all columns. */ alts->pixlist[0] |= mask; if (ptype == 'v') { alts->pixnpv[ialt]++; } else if (ptype == 's') { alts->pixnps[ialt]++; } } return 0; } /*---------------------------------------------------------------------------- * Perform initializations at the end of the first pass: * * 1) Determine the required number of wcsprm structs, allocate memory for * an array of them and initialize each one. *---------------------------------------------------------------------------*/ int wcsbth_init1( struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs) { int ialt, icol, inherit[27], ix, mask, ncol, npsmax, npvmax, status = 0; struct wcsprm *wcsp; if (alts->arridx == 0x0) { *nwcs = 0; return 0; } /* Determine the number of axes in each pixel list representation. */ ncol = alts->ncol; for (ialt = 0, mask = 1; ialt < 27; ialt++, mask <<= 1) { alts->pixidx[ialt] = 0; if (alts->pixlist[0] | mask) { for (icol = 1; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { alts->pixidx[ialt]++; } } } } /* Find the total number of coordinate representations. */ *nwcs = 0; alts->imgherit = 0; for (ialt = 0; ialt < 27; ialt++) { inherit[ialt] = 0; for (icol = 1; icol <= ncol; icol++) { if (alts->arridx[icol][ialt] < 0) { /* No BIMGARR keytype but there's at least one BINTAB. */ if (alts->arridx[0][ialt] > 0) { /* There is an IMGAXIS keytype that we will inherit, so count this representation. */ alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } else { alts->arridx[icol][ialt] = 0; } } if (alts->arridx[icol][ialt]) { if (alts->arridx[0][ialt]) { /* All IMGHEAD keywords are inherited for this ialt. */ inherit[ialt] = 1; if (alts->arridx[icol][ialt] < alts->arridx[0][ialt]) { /* The extra axes are also inherited. */ alts->arridx[icol][ialt] = alts->arridx[0][ialt]; } } (*nwcs)++; } } /* Count every "a" found in any IMGHEAD keyword... */ if (alts->arridx[0][ialt]) { if (inherit[ialt]) { /* ...but not if the IMGHEAD keywords will be inherited. */ alts->arridx[0][ialt] = 0; alts->imgherit = 1; } else { (*nwcs)++; } } /* We need a struct for every "a" found in a PIXLIST keyword. */ if (alts->pixidx[ialt]) { (*nwcs)++; } } if (*nwcs) { /* Allocate memory for the required number of wcsprm structs. */ if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { return 2; } /* Record the current values of NPVMAX and NPSMAX. */ npvmax = wcsnpv(-1); npsmax = wcsnps(-1); /* Initialize each wcsprm struct. */ wcsp = *wcs; *nwcs = 0; for (icol = 0; icol <= ncol; icol++) { for (ialt = 0; ialt < 27; ialt++) { if (alts->arridx[icol][ialt]) { /* Image-header representations that are not for inheritance (icol == 0) or binary table image array representations. */ wcsp->flag = -1; wcsnpv(alts->npv[icol][ialt]); wcsnps(alts->nps[icol][ialt]); if ((status = wcsini(1, (int)(alts->arridx[icol][ialt]), wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record the table column number. */ wcsp->colnum = icol; /* On the second pass alts->arridx[icol][27] indexes the array of wcsprm structs. */ alts->arridx[icol][ialt] = (*nwcs)++; wcsp++; } else { /* Signal that this column has no WCS for this "a". */ alts->arridx[icol][ialt] = -1; } } } for (ialt = 0; ialt < 27; ialt++) { if (alts->pixidx[ialt]) { /* Pixel lists representations. */ wcsp->flag = -1; wcsnpv(alts->pixnpv[ialt]); wcsnps(alts->pixnps[ialt]); if ((status = wcsini(1, (int)(alts->pixidx[ialt]), wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record the pixel list column numbers. */ mask = (1 << ialt); for (icol = 1, ix = 0; icol <= ncol; icol++) { if (alts->pixlist[icol] & mask) { wcsp->colax[ix++] = icol; } } /* alts->pixidx[] indexes the array of wcsprm structs. */ alts->pixidx[ialt] = (*nwcs)++; wcsp++; } else { /* Signal that this column is not a pixel list axis for this "a". */ alts->pixidx[ialt] = -1; } } /* Restore the original values of NPVMAX and NPSMAX. */ wcsnpv(npvmax); wcsnps(npsmax); } return status; } /*---------------------------------------------------------------------------- * Return a pointer to the next wcsprm struct for a particular column number * and alternate. *---------------------------------------------------------------------------*/ struct wcsprm *wcsbth_idx( struct wcsprm *wcs, struct wcsbth_alts *alts, int keytype, int n, char a) { const char as[] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int iwcs; if (!wcs) return 0x0; iwcs = -1; for (; iwcs < 0 && alts->ialt < 27; alts->ialt++) { /* Note that a == 0 applies to every alternate, otherwise this loop simply determines the appropriate value of alts->ialt. */ if (a && a != as[alts->ialt]) continue; if (keytype & (IMGHEAD | BIMGARR)) { for (; iwcs < 0 && alts->icol <= alts->ncol; alts->icol++) { /* Image header keywords, n == 0, apply to all columns, otherwise this loop simply determines the appropriate value of alts->icol. */ if (n && n != alts->icol) continue; iwcs = alts->arridx[alts->icol][alts->ialt]; } /* Break out of the loop to stop alts->ialt from being incremented. */ if (iwcs >= 0) break; /* Start from scratch for the next alts->ialt. */ alts->icol = 0; } if (keytype & (IMGAUX | PIXLIST)) { iwcs = alts->pixidx[alts->ialt]; } } return (iwcs >= 0) ? (wcs + iwcs) : 0x0; } /*---------------------------------------------------------------------------- * Return the axis number associated with the specified column number in a * particular pixel list coordinate representation. *---------------------------------------------------------------------------*/ int wcsbth_colax( struct wcsprm *wcs, struct wcsbth_alts *alts, int n, char a) { int ix; struct wcsprm *wcsp; if (!wcs) return 0; wcsp = wcs; if (a != ' ') { wcsp += alts->pixidx[a-'A'+1]; } for (ix = 0; ix < wcsp->naxis; ix++) { if (wcsp->colax[ix] == n) { return ++ix; } } return 0; } /*---------------------------------------------------------------------------- * Interpret EPOCH keywords. *---------------------------------------------------------------------------*/ int wcsbth_epoch(void *wptr) { double *equinox; /* If EQUINOXa is currently undefined then set it from EPOCHa. */ equinox = (double *)wptr; if (undefined(*equinox)) { wcsutil_str2double(wcsbthtext, "%lf", equinox); } return 0; } /*---------------------------------------------------------------------------- * Interpret VSOURCE keywords. *---------------------------------------------------------------------------*/ int wcsbth_vsource(void *wptr) { double beta, c = 299792458.0, vsource, *zsource; /* If ZSOURCEa is currently undefined then set it from VSOURCEa. */ zsource = (double *)wptr; if (undefined(*zsource)) { wcsutil_str2double(wcsbthtext, "%lf", &vsource); /* Convert relativistic Doppler velocity to redshift. */ beta = vsource/c; *zsource = (1.0 + beta)/sqrt(1.0 - beta*beta) - 1.0; } return 0; } /*---------------------------------------------------------------------------- * Tie up loose ends. *---------------------------------------------------------------------------*/ int wcsbth_final( struct wcsbth_alts *alts, int *nwcs, struct wcsprm **wcs) { int ialt, status; if (alts->arridx) free(alts->arridx); if (alts->npv) free(alts->npv); if (alts->nps) free(alts->nps); if (alts->pixlist) free(alts->pixlist); for (ialt = 0; ialt < *nwcs; ialt++) { /* Interpret -TAB header keywords. */ if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; } } return 0; } astropy-0.3/cextern/wcslib/C/flexed/wcsutrn.c0000644000175000017500000066624312243255342017455 0ustar oleole#line 2 "wcsutrn.c" #line 4 "wcsutrn.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer wcsutrn_create_buffer #define yy_delete_buffer wcsutrn_delete_buffer #define yy_flex_debug wcsutrn_flex_debug #define yy_init_buffer wcsutrn_init_buffer #define yy_flush_buffer wcsutrn_flush_buffer #define yy_load_buffer_state wcsutrn_load_buffer_state #define yy_switch_to_buffer wcsutrn_switch_to_buffer #define yyin wcsutrnin #define yyleng wcsutrnleng #define yylex wcsutrnlex #define yylineno wcsutrnlineno #define yyout wcsutrnout #define yyrestart wcsutrnrestart #define yytext wcsutrntext #define yywrap wcsutrnwrap #define yyalloc wcsutrnalloc #define yyrealloc wcsutrnrealloc #define yyfree wcsutrnfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE wcsutrnrestart(wcsutrnin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int wcsutrnleng; extern FILE *wcsutrnin, *wcsutrnout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsutrntext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up wcsutrntext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via wcsutrnrestart()), so that the user can continue scanning by * just pointing wcsutrnin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when wcsutrntext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int wcsutrnleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow wcsutrnwrap()'s to do buffer switches * instead of setting up a fresh wcsutrnin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void wcsutrnrestart (FILE *input_file ); void wcsutrn_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE wcsutrn_create_buffer (FILE *file,int size ); void wcsutrn_delete_buffer (YY_BUFFER_STATE b ); void wcsutrn_flush_buffer (YY_BUFFER_STATE b ); void wcsutrnpush_buffer_state (YY_BUFFER_STATE new_buffer ); void wcsutrnpop_buffer_state (void ); static void wcsutrnensure_buffer_stack (void ); static void wcsutrn_load_buffer_state (void ); static void wcsutrn_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER wcsutrn_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE wcsutrn_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE wcsutrn_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE wcsutrn_scan_bytes (yyconst char *bytes,int len ); void *wcsutrnalloc (yy_size_t ); void *wcsutrnrealloc (void *,yy_size_t ); void wcsutrnfree (void * ); #define yy_new_buffer wcsutrn_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ wcsutrnensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ wcsutrnensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define wcsutrnwrap(n) 1 #define YY_SKIP_YYWRAP typedef char YY_CHAR; FILE *wcsutrnin = (FILE *) 0, *wcsutrnout = (FILE *) 0; typedef int yy_state_type; extern int wcsutrnlineno; int wcsutrnlineno = 1; extern char *wcsutrntext; #define yytext_ptr wcsutrntext static yyconst flex_int16_t yy_nxt[][128] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 11, 12, 13, 12, 12, 14, 15, 12, 16, 17, 12, 18, 12, 19, 20, 12, 21, 22, 12, 12, 23, 12, 12, 24, 12, 8, 8, 8, 8, 8, 8, 25, 12, 12, 26, 12, 12, 12, 27, 12, 12, 28, 12, 29, 12, 12, 30, 12, 31, 32, 12, 12, 33, 12, 12, 34, 12, 8, 8, 8, 8, 8 }, { 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 35, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 11, 12, 13, 12, 12, 14, 15, 12, 16, 17, 12, 18, 12, 19, 20, 12, 21, 22, 12, 12, 23, 12, 12, 24, 12, 36, 8, 8, 8, 8, 8, 25, 12, 12, 26, 12, 12, 12, 27, 12, 12, 28, 12, 29, 12, 12, 30, 12, 31, 32, 12, 12, 33, 12, 12, 34, 12, 8, 8, 8, 8, 8 }, { 7, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 39, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 37, 37, 37, 37, 37, 37, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 37, 37, 37, 37, 37 }, { 7, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 39, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 37, 37, 37, 37, 37, 37, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 37, 37, 37, 37, 37 }, { 7, 41, 41, 41, 41, 41, 41, 41, 41, 41, 38, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41 }, { 7, 41, 41, 41, 41, 41, 41, 41, 41, 41, 38, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41 }, { -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7, -7 }, { 7, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8 }, { 7, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, 42, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9 }, { 7, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 43, 43, 43, 43, 43, 43, 43, 43, -10, -10, -10, -10, -10, -10, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -10, -10, -10, -10, -10 }, { 7, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -11, -11, -11, -11, -11, -11, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 46, 43, -11, -11, -11, -11, -11 }, { 7, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -12, -12, -12, -12, -12, -12, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -12, -12, -12, -12, -12 }, { 7, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, 47, 43, 43, 43, 48, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -13, -13, -13, -13, -13, -13, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -13, -13, -13, -13, -13 }, { 7, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, 43, 43, 43, 43, 43, 43, 43, 49, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -14, -14, -14, -14, -14, -14, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -14, -14, -14, -14, -14 }, { 7, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 50, 43, 43, 43, 43, 43, 43, 43, 51, -15, -15, -15, -15, -15, -15, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -15, -15, -15, -15, -15 }, { 7, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 52, 43, -16, -16, -16, -16, -16, -16, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -16, -16, -16, -16, -16 }, { 7, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, 43, 43, 43, 43, 53, 43, 43, 54, 43, 43, 43, 43, 55, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -17, -17, -17, -17, -17, -17, 43, 43, 43, 43, 56, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -17, -17, -17, -17, -17 }, { 7, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, 43, 43, 43, 43, 57, 43, 43, 58, 59, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -18, -18, -18, -18, -18, -18, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -18, -18, -18, -18, -18 }, { 7, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, -19, -19, -19, -19, -19, 43, 43, 43, 43, 43, 43, 43, 60, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, -19, -19, -19, -19 }, { 7, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, 61, 43, 43, 43, 43, 43, 43, 43, 62, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -20, -20, -20, -20, -20, -20, 63, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -20, -20, -20, -20, -20 }, { 7, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, 64, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -21, -21, -21, -21, -21, -21, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -21, -21, -21, -21, -21 }, { 7, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, 43, 43, 43, 43, 65, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -22, -22, -22, -22, -22, -22, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -22, -22, -22, -22, -22 }, { 7, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 66, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -23, -23, -23, -23, -23, -23, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 67, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -23, -23, -23, -23, -23 }, { 7, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, 43, 43, 43, 43, 68, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 69, 43, 43, 43, 43, 43, 43, 43, 43, -24, -24, -24, -24, -24, -24, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -24, -24, -24, -24, -24 }, { 7, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -25, -25, -25, -25, -25, -25, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 70, 43, 43, 43, 71, 43, 43, 43, 43, 43, 43, 43, 43, -25, -25, -25, -25, -25 }, { 7, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -26, -26, -26, -26, -26, -26, 72, 43, 43, 43, 73, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -26, -26, -26, -26, -26 }, { 7, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -27, -27, -27, -27, -27, -27, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 50, 43, 43, 43, 43, 43, 43, 43, 51, -27, -27, -27, -27, -27 }, { 7, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -28, -28, -28, -28, -28, -28, 43, 43, 43, 43, 56, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -28, -28, -28, -28, -28 }, { 7, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -29, -29, -29, -29, -29, -29, 43, 43, 43, 43, 74, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -29, -29, -29, -29, -29 }, { 7, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -30, -30, -30, -30, -30, -30, 63, 43, 43, 43, 43, 43, 43, 43, 75, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -30, -30, -30, -30, -30 }, { 7, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -31, -31, -31, -31, -31, -31, 76, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -31, -31, -31, -31, -31 }, { 7, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -32, -32, -32, -32, -32, -32, 43, 43, 43, 43, 77, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -32, -32, -32, -32, -32 }, { 7, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -33, -33, -33, -33, -33, -33, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 67, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -33, -33, -33, -33, -33 }, { 7, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -34, -34, -34, -34, -34, -34, 43, 43, 43, 43, 78, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -34, -34, -34, -34, -34 }, { 7, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, 79, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, 80, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 }, { 7, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 }, { 7, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37 }, { 7, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38 }, { 7, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 81, 81, 81, 81, 81, 81, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 81, 81, 81, 81, 81 }, { 7, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, -40, -40, -40, -40, -40, -40, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, -40, -40, -40, -40, -40 }, { 7, 85, 85, 85, 85, 85, 85, 85, 85, 85, -41, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85 }, { 7, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42 }, { 7, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -43, -43, -43, -43, -43, -43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -43, -43, -43, -43, -43 }, { 7, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, 43, 43, 86, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -44, -44, -44, -44, -44, -44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -44, -44, -44, -44, -44 }, { 7, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 87, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -45, -45, -45, -45, -45, -45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -45, -45, -45, -45, -45 }, { 7, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -46, -46, -46, -46, -46, -46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 88, 43, 43, 43, 43, 43, 43, -46, -46, -46, -46, -46 }, { 7, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 89, 43, -47, -47, -47, -47, -47, -47, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -47, -47, -47, -47, -47 }, { 7, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, 43, 43, 43, 43, 43, 43, 90, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -48, -48, -48, -48, -48, -48, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -48, -48, -48, -48, -48 }, { 7, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 91, -49, -49, -49, -49, -49, -49, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -49, -49, -49, -49, -49 }, { 7, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -50, -50, -50, -50, -50, -50, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -50, -50, -50, -50, -50 }, { 7, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -51, -51, -51, -51, -51, -51, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -51, -51, -51, -51, -51 }, { 7, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -52, -52, -52, -52, -52, -52, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -52, -52, -52, -52, -52 }, { 7, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 92, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -53, -53, -53, -53, -53, -53, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -53, -53, -53, -53, -53 }, { 7, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, -54, -54, -54, -54, -54, -54, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -54, -54, -54, -54, -54 }, { 7, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -55, -55, -55, -55, -55, -55, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -55, -55, -55, -55, -55 }, { 7, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -56, -56, -56, -56, -56, -56, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 94, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -56, -56, -56, -56, -56 }, { 7, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 95, 43, 43, 43, 43, 43, 43, -57, -57, -57, -57, -57, -57, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -57, -57, -57, -57, -57 }, { 7, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 96, -58, -58, -58, -58, -58, -58, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -58, -58, -58, -58, -58 }, { 7, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 97, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -59, -59, -59, -59, -59, -59, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -59, -59, -59, -59, -59 }, { 7, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -60, -60, -60, -60, -60, -60, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 98, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -60, -60, -60, -60, -60 }, { 7, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 99, 43, 43, 43, 43, 43, 43, 43, -61, -61, -61, -61, -61, -61, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -61, -61, -61, -61, -61 }, { 7, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 100, 43, 43, -62, -62, -62, -62, -62, -62, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -62, -62, -62, -62, -62 }, { 7, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -63, -63, -63, -63, -63, -63, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 101, 43, 43, 43, 43, 43, 43, 43, -63, -63, -63, -63, -63 }, { 7, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 43, 43, 43, 102, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -64, -64, -64, -64, -64, -64, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -64, -64, -64, -64, -64 }, { 7, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, 43, 43, 103, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -65, -65, -65, -65, -65, -65, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -65, -65, -65, -65, -65 }, { 7, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 104, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -66, -66, -66, -66, -66, -66, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -66, -66, -66, -66, -66 }, { 7, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -67, -67, -67, -67, -67, -67, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 105, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -67, -67, -67, -67, -67 }, { 7, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, 106, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -68, -68, -68, -68, -68, -68, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -68, -68, -68, -68, -68 }, { 7, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -69, -69, -69, -69, -69, -69, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -69, -69, -69, -69, -69 }, { 7, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -70, -70, -70, -70, -70, -70, 43, 43, 43, 43, 43, 43, 107, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -70, -70, -70, -70, -70 }, { 7, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -71, -71, -71, -71, -71, -71, 43, 43, 108, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -71, -71, -71, -71, -71 }, { 7, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -72, -72, -72, -72, -72, -72, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 109, 43, -72, -72, -72, -72, -72 }, { 7, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -73, -73, -73, -73, -73, -73, 43, 43, 43, 43, 43, 43, 110, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -73, -73, -73, -73, -73 }, { 7, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -74, -74, -74, -74, -74, -74, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 111, 43, 43, 43, 43, 43, 43, -74, -74, -74, -74, -74 }, { 7, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -75, -75, -75, -75, -75, -75, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 112, 43, 43, -75, -75, -75, -75, -75 }, { 7, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -76, -76, -76, -76, -76, -76, 43, 43, 43, 113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -76, -76, -76, -76, -76 }, { 7, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -77, -77, -77, -77, -77, -77, 43, 43, 114, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -77, -77, -77, -77, -77 }, { 7, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -78, -78, -78, -78, -78, -78, 115, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -78, -78, -78, -78, -78 }, { 7, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, 79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, 80, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79 }, { 7, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80 }, { 7, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81 }, { 7, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 81, 81, 81, 81, 81, 81, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 81, 81, 81, 81, 81 }, { 7, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83 }, { 7, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, -84, -84, -84, -84, -84, -84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, -84, -84, -84, -84, -84 }, { 7, 85, 85, 85, 85, 85, 85, 85, 85, 85, -85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85 }, { 7, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 116, 43, 43, 43, 43, 43, 117, 43, 43, 43, 43, 43, 43, 43, -86, -86, -86, -86, -86, -86, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -86, -86, -86, -86, -86 }, { 7, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 118, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -87, -87, -87, -87, -87, -87, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -87, -87, -87, -87, -87 }, { 7, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -88, -88, -88, -88, -88, -88, 43, 43, 43, 43, 119, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -88, -88, -88, -88, -88 }, { 7, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 120, 43, 43, 43, 43, 43, 43, 43, -89, -89, -89, -89, -89, -89, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -89, -89, -89, -89, -89 }, { 7, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 121, 43, 43, 43, 43, 43, 43, 43, 43, -90, -90, -90, -90, -90, -90, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -90, -90, -90, -90, -90 }, { 7, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -91, -91, -91, -91, -91, -91, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -91, -91, -91, -91, -91 }, { 7, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 122, 43, 43, 43, 43, -92, -92, -92, -92, -92, -92, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -92, -92, -92, -92, -92 }, { 7, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -93, -93, -93, -93, -93, -93, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -93, -93, -93, -93, -93 }, { 7, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -94, -94, -94, -94, -94, -94, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 123, 43, 43, 43, 43, -94, -94, -94, -94, -94 }, { 7, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 43, 43, 43, 43, 124, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 125, 43, 43, 43, 43, 43, 43, 43, 43, -95, -95, -95, -95, -95, -95, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -95, -95, -95, -95, -95 }, { 7, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -96, -96, -96, -96, -96, -96, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -96, -96, -96, -96, -96 }, { 7, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -97, -97, -97, -97, -97, -97, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -97, -97, -97, -97, -97 }, { 7, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -98, -98, -98, -98, -98, -98, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -98, -98, -98, -98, -98 }, { 7, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 43, 43, 126, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -99, -99, -99, -99, -99, -99, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -99, -99, -99, -99, -99 }, { 7, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 43, 43, 43, 43, 127, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -100, -100, -100, -100, -100, -100, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -100, -100, -100, -100, -100 }, { 7, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -101, -101, -101, -101, -101, -101, 43, 43, 128, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -101, -101, -101, -101, -101 }, { 7, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 43, 43, 43, 43, 43, 43, 43, 43, 129, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -102, -102, -102, -102, -102, -102, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -102, -102, -102, -102, -102 }, { 7, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 130, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -103, -103, -103, -103, -103, -103, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -103, -103, -103, -103, -103 }, { 7, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 131, 43, 43, 43, 43, 43, 43, -104, -104, -104, -104, -104, -104, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -104, -104, -104, -104, -104 }, { 7, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -105, -105, -105, -105, -105, -105, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 132, 43, 43, 43, 43, 43, 43, -105, -105, -105, -105, -105 }, { 7, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 133, 43, 43, 43, 43, 43, 43, 43, 43, -106, -106, -106, -106, -106, -106, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -106, -106, -106, -106, -106 }, { 7, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -107, -107, -107, -107, -107, -107, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 134, 43, 43, 43, 43, 43, 43, 43, -107, -107, -107, -107, -107 }, { 7, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -108, -108, -108, -108, -108, -108, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 135, 43, 43, 43, 43, 43, 136, 43, 43, 43, 43, 43, 43, 43, -108, -108, -108, -108, -108 }, { 7, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -109, -109, -109, -109, -109, -109, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 137, 43, 43, 43, 43, 43, 43, 43, -109, -109, -109, -109, -109 }, { 7, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -110, -110, -110, -110, -110, -110, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 138, 43, 43, 43, 43, 43, 43, 43, 43, -110, -110, -110, -110, -110 }, { 7, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -111, -111, -111, -111, -111, -111, 43, 43, 43, 43, 139, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 140, 43, 43, 43, 43, 43, 43, 43, 43, -111, -111, -111, -111, -111 }, { 7, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -112, -112, -112, -112, -112, -112, 43, 43, 43, 43, 141, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -112, -112, -112, -112, -112 }, { 7, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -113, -113, -113, -113, -113, -113, 43, 43, 43, 43, 43, 43, 43, 43, 142, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -113, -113, -113, -113, -113 }, { 7, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -114, -114, -114, -114, -114, -114, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 143, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -114, -114, -114, -114, -114 }, { 7, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -115, -115, -115, -115, -115, -115, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 144, 43, 43, 43, 43, 43, 43, 43, 43, -115, -115, -115, -115, -115 }, { 7, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 43, 43, 43, 43, 43, 43, 43, 43, 145, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -116, -116, -116, -116, -116, -116, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -116, -116, -116, -116, -116 }, { 7, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, 43, 43, 43, 43, 146, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -117, -117, -117, -117, -117, -117, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -117, -117, -117, -117, -117 }, { 7, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -118, -118, -118, -118, -118, -118, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -118, -118, -118, -118, -118 }, { 7, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -119, -119, -119, -119, -119, -119, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -119, -119, -119, -119, -119 }, { 7, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -120, -120, -120, -120, -120, -120, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -120, -120, -120, -120, -120 }, { 7, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 43, 43, 43, 43, 147, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -121, -121, -121, -121, -121, -121, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -121, -121, -121, -121, -121 }, { 7, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 43, 43, 43, 43, 43, 43, 43, 43, 148, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -122, -122, -122, -122, -122, -122, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -122, -122, -122, -122, -122 }, { 7, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -123, -123, -123, -123, -123, -123, 43, 43, 43, 43, 43, 43, 43, 43, 149, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -123, -123, -123, -123, -123 }, { 7, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 150, 43, 43, 43, 43, 43, 43, 43, 43, -124, -124, -124, -124, -124, -124, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -124, -124, -124, -124, -124 }, { 7, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, 43, 43, 43, 43, 151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -125, -125, -125, -125, -125, -125, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -125, -125, -125, -125, -125 }, { 7, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, 152, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -126, -126, -126, -126, -126, -126, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -126, -126, -126, -126, -126 }, { 7, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 153, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -127, -127, -127, -127, -127, -127, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -127, -127, -127, -127, -127 }, { 7, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -128, -128, -128, -128, -128, -128, 154, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -128, -128, -128, -128, -128 }, { 7, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, 155, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -129, -129, -129, -129, -129, -129, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -129, -129, -129, -129, -129 }, { 7, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 156, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -130, -130, -130, -130, -130, -130, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -130, -130, -130, -130, -130 }, { 7, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 157, 43, 43, 43, 43, 43, 43, 43, -131, -131, -131, -131, -131, -131, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -131, -131, -131, -131, -131 }, { 7, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -132, -132, -132, -132, -132, -132, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 158, 43, 43, 43, 43, 43, 43, 43, -132, -132, -132, -132, -132 }, { 7, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 159, 43, 43, 43, 43, 43, 43, 43, -133, -133, -133, -133, -133, -133, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -133, -133, -133, -133, -133 }, { 7, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -134, -134, -134, -134, -134, -134, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 160, 43, 43, 43, 43, 43, 43, -134, -134, -134, -134, -134 }, { 7, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -135, -135, -135, -135, -135, -135, 43, 43, 43, 43, 43, 43, 43, 43, 161, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -135, -135, -135, -135, -135 }, { 7, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -136, -136, -136, -136, -136, -136, 43, 43, 43, 43, 162, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -136, -136, -136, -136, -136 }, { 7, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -137, -137, -137, -137, -137, -137, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -137, -137, -137, -137, -137 }, { 7, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -138, -138, -138, -138, -138, -138, 43, 43, 43, 43, 163, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -138, -138, -138, -138, -138 }, { 7, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -139, -139, -139, -139, -139, -139, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 164, 43, 43, 43, 43, 43, 43, 43, 43, -139, -139, -139, -139, -139 }, { 7, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -140, -140, -140, -140, -140, -140, 43, 43, 43, 43, 165, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -140, -140, -140, -140, -140 }, { 7, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -141, -141, -141, -141, -141, -141, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 166, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -141, -141, -141, -141, -141 }, { 7, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -142, -142, -142, -142, -142, -142, 167, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -142, -142, -142, -142, -142 }, { 7, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -143, -143, -143, -143, -143, -143, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 168, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -143, -143, -143, -143, -143 }, { 7, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -144, -144, -144, -144, -144, -144, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 69, 43, 43, 43, 43, 43, 43, 43, -144, -144, -144, -144, -144 }, { 7, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 169, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -145, -145, -145, -145, -145, -145, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -145, -145, -145, -145, -145 }, { 7, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 43, 43, 170, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -146, -146, -146, -146, -146, -146, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -146, -146, -146, -146, -146 }, { 7, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, 43, 43, 43, 43, 171, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -147, -147, -147, -147, -147, -147, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -147, -147, -147, -147, -147 }, { 7, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 172, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -148, -148, -148, -148, -148, -148, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -148, -148, -148, -148, -148 }, { 7, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -149, -149, -149, -149, -149, -149, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 173, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -149, -149, -149, -149, -149 }, { 7, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 174, 43, 43, 43, 43, 43, 43, 43, -150, -150, -150, -150, -150, -150, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -150, -150, -150, -150, -150 }, { 7, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 175, 43, 43, 43, 43, 43, 43, 43, -151, -151, -151, -151, -151, -151, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -151, -151, -151, -151, -151 }, { 7, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 176, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -152, -152, -152, -152, -152, -152, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -152, -152, -152, -152, -152 }, { 7, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 177, 43, 43, 43, 43, 43, 43, 43, -153, -153, -153, -153, -153, -153, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -153, -153, -153, -153, -153 }, { 7, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -154, -154, -154, -154, -154, -154, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 178, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -154, -154, -154, -154, -154 }, { 7, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 179, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -155, -155, -155, -155, -155, -155, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -155, -155, -155, -155, -155 }, { 7, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, 43, 43, 43, 180, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -156, -156, -156, -156, -156, -156, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -156, -156, -156, -156, -156 }, { 7, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -157, -157, -157, -157, -157, -157, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -157, -157, -157, -157, -157 }, { 7, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -158, -158, -158, -158, -158, -158, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -158, -158, -158, -158, -158 }, { 7, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -159, -159, -159, -159, -159, -159, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -159, -159, -159, -159, -159 }, { 7, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -160, -160, -160, -160, -160, -160, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 181, 43, 43, 43, 43, 43, 43, 43, 43, -160, -160, -160, -160, -160 }, { 7, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -161, -161, -161, -161, -161, -161, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 182, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -161, -161, -161, -161, -161 }, { 7, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -162, -162, -162, -162, -162, -162, 43, 43, 183, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -162, -162, -162, -162, -162 }, { 7, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -163, -163, -163, -163, -163, -163, 43, 43, 43, 43, 184, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -163, -163, -163, -163, -163 }, { 7, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -164, -164, -164, -164, -164, -164, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 185, 43, 43, 43, 43, 43, 43, 43, -164, -164, -164, -164, -164 }, { 7, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -165, -165, -165, -165, -165, -165, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 186, 43, 43, 43, 43, 43, 43, 43, -165, -165, -165, -165, -165 }, { 7, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -166, -166, -166, -166, -166, -166, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 177, 43, 43, 43, 43, 43, 43, 43, -166, -166, -166, -166, -166 }, { 7, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -167, -167, -167, -167, -167, -167, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 187, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -167, -167, -167, -167, -167 }, { 7, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -168, -168, -168, -168, -168, -168, 43, 43, 43, 188, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -168, -168, -168, -168, -168 }, { 7, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 189, 43, 43, 43, 43, 43, 43, 43, -169, -169, -169, -169, -169, -169, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -169, -169, -169, -169, -169 }, { 7, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 190, 43, 43, 43, 43, 43, 43, 43, -170, -170, -170, -170, -170, -170, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -170, -170, -170, -170, -170 }, { 7, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 191, 43, 43, 43, 43, 43, 43, 43, -171, -171, -171, -171, -171, -171, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -171, -171, -171, -171, -171 }, { 7, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 192, 43, 43, 43, 43, 43, 43, 43, -172, -172, -172, -172, -172, -172, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -172, -172, -172, -172, -172 }, { 7, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -173, -173, -173, -173, -173, -173, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 193, 43, 43, 43, 43, 43, 43, 43, -173, -173, -173, -173, -173 }, { 7, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -174, -174, -174, -174, -174, -174, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -174, -174, -174, -174, -174 }, { 7, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -175, -175, -175, -175, -175, -175, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -175, -175, -175, -175, -175 }, { 7, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 194, 43, 43, 43, 43, 43, 43, 43, -176, -176, -176, -176, -176, -176, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -176, -176, -176, -176, -176 }, { 7, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -177, -177, -177, -177, -177, -177, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -177, -177, -177, -177, -177 }, { 7, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -178, -178, -178, -178, -178, -178, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 195, 43, 43, 43, 43, 43, 43, 43, -178, -178, -178, -178, -178 }, { 7, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 196, 43, 43, 43, 43, 43, 43, 43, -179, -179, -179, -179, -179, -179, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -179, -179, -179, -179, -179 }, { 7, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 197, 43, 43, 43, 43, 43, 43, 43, -180, -180, -180, -180, -180, -180, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -180, -180, -180, -180, -180 }, { 7, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -181, -181, -181, -181, -181, -181, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 198, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -181, -181, -181, -181, -181 }, { 7, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -182, -182, -182, -182, -182, -182, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 189, 43, 43, 43, 43, 43, 43, 43, -182, -182, -182, -182, -182 }, { 7, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -183, -183, -183, -183, -183, -183, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 190, 43, 43, 43, 43, 43, 43, 43, -183, -183, -183, -183, -183 }, { 7, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -184, -184, -184, -184, -184, -184, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 199, 43, 43, 43, 43, 43, 43, 43, -184, -184, -184, -184, -184 }, { 7, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -185, -185, -185, -185, -185, -185, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -185, -185, -185, -185, -185 }, { 7, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -186, -186, -186, -186, -186, -186, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -186, -186, -186, -186, -186 }, { 7, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -187, -187, -187, -187, -187, -187, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 200, 43, 43, 43, 43, 43, 43, 43, -187, -187, -187, -187, -187 }, { 7, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -188, -188, -188, -188, -188, -188, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 201, 43, 43, 43, 43, 43, 43, 43, -188, -188, -188, -188, -188 }, { 7, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -189, -189, -189, -189, -189, -189, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -189, -189, -189, -189, -189 }, { 7, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -190, -190, -190, -190, -190, -190, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -190, -190, -190, -190, -190 }, { 7, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -191, -191, -191, -191, -191, -191, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -191, -191, -191, -191, -191 }, { 7, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -192, -192, -192, -192, -192, -192, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -192, -192, -192, -192, -192 }, { 7, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -193, -193, -193, -193, -193, -193, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -193, -193, -193, -193, -193 }, { 7, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -194, -194, -194, -194, -194, -194, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -194, -194, -194, -194, -194 }, { 7, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -195, -195, -195, -195, -195, -195, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -195, -195, -195, -195, -195 }, { 7, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -196, -196, -196, -196, -196, -196, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -196, -196, -196, -196, -196 }, { 7, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -197, -197, -197, -197, -197, -197, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -197, -197, -197, -197, -197 }, { 7, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -198, -198, -198, -198, -198, -198, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 202, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -198, -198, -198, -198, -198 }, { 7, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -199, -199, -199, -199, -199, -199, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -199, -199, -199, -199, -199 }, { 7, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -200, -200, -200, -200, -200, -200, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -200, -200, -200, -200, -200 }, { 7, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -201, -201, -201, -201, -201, -201, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -201, -201, -201, -201, -201 }, { 7, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -202, -202, -202, -202, -202, -202, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, -202, -202, -202, -202, -202 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up wcsutrntext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ wcsutrnleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 37 #define YY_END_OF_BUFFER 38 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[203] = { 0, 0, 0, 0, 0, 36, 36, 38, 3, 2, 31, 31, 31, 10, 31, 14, 31, 31, 20, 31, 31, 31, 28, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 2, 1, 35, 37, 35, 32, 36, 2, 31, 31, 31, 31, 31, 31, 31, 13, 15, 17, 31, 31, 19, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 2, 1, 33, 33, 34, 32, 36, 31, 31, 31, 9, 11, 12, 31, 16, 31, 31, 22, 21, 23, 31, 31, 31, 26, 27, 31, 31, 31, 31, 31, 9, 31, 31, 31, 31, 27, 31, 31, 31, 7, 8, 9, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 29, 29, 30, 31, 31, 31, 9, 31, 31, 31, 31, 31, 31, 30, 31, 31, 31, 31, 31, 20, 20, 31, 25, 31, 31, 31, 29, 29, 30, 31, 31, 31, 31, 20, 20, 31, 31, 31, 5, 6, 11, 18, 18, 20, 20, 24, 25, 24, 26, 27, 31, 31, 31, 11, 20, 20, 26, 27, 5, 6, 11, 18, 18, 24, 24, 26, 27, 31, 11, 26, 27, 4 } ; static yyconst yy_state_type yy_NUL_trans[203] = { 0, 8, 8, 37, 37, 41, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; extern int wcsutrn_flex_debug; int wcsutrn_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *wcsutrntext; #line 1 "wcsutrn.l" /*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsutrn.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical * scanner that translates non-standard FITS units specifications. * * It requires Flex v2.5.4 or later. * * Refer to wcsunits.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ /* Exclusive start states. */ #line 49 "wcsutrn.l" /* To get the prototype for fileno() from stdio.h when gcc is invoked with * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */ #define _POSIX_SOURCE 1 #include #include #include #include #include "wcserr.h" #include "wcsunits.h" #define YY_DECL int wcsutrne(int ctrl, char unitstr[], struct wcserr **err) /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsutrn_abort_jmp_env; #define exit(status) longjmp(wcsutrn_abort_jmp_env, status) #line 4042 "wcsutrn.c" #define INITIAL 0 #define NEXT 1 #define FLUSH 2 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int wcsutrnlex_destroy (void ); int wcsutrnget_debug (void ); void wcsutrnset_debug (int debug_flag ); YY_EXTRA_TYPE wcsutrnget_extra (void ); void wcsutrnset_extra (YY_EXTRA_TYPE user_defined ); FILE *wcsutrnget_in (void ); void wcsutrnset_in (FILE * in_str ); FILE *wcsutrnget_out (void ); void wcsutrnset_out (FILE * out_str ); int wcsutrnget_leng (void ); char *wcsutrnget_text (void ); int wcsutrnget_lineno (void ); void wcsutrnset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int wcsutrnwrap (void ); #else extern int wcsutrnwrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( wcsutrntext, wcsutrnleng, 1, wcsutrnout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ while ( (result = read( fileno(wcsutrnin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(wcsutrnin); \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int wcsutrnlex (void); #define YY_DECL int wcsutrnlex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after wcsutrntext and wcsutrnleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( wcsutrnleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (wcsutrntext[wcsutrnleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 69 "wcsutrn.l" static const char *function = "wcsutrne"; char orig[80], subs[80]; int bracket = 0; int unsafe = 0; int status = -1; YY_BUFFER_STATE inbuff; int wcsutrnlex_destroy(void); if (err) *err = 0x0; *orig = '\0'; *subs = '\0'; inbuff = wcsutrn_scan_string(unitstr); *unitstr = '\0'; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsutrn_abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units translator error parsing '%s'", unitstr); } BEGIN(INITIAL); #ifdef DEBUG fprintf(stderr, "\n%s ->\n", unitstr); #endif #line 4249 "wcsutrn.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! wcsutrnin ) wcsutrnin = stdin; if ( ! wcsutrnout ) wcsutrnout = stdout; if ( ! YY_CURRENT_BUFFER ) { wcsutrnensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); } wcsutrn_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of wcsutrntext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) ++yy_cp; yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 1: YY_RULE_SETUP #line 99 "wcsutrn.l" { /* Looks like a keycomment. */ strcat(unitstr, "["); bracket = 1; } YY_BREAK case 2: YY_RULE_SETUP #line 105 "wcsutrn.l" /* Discard leading whitespace. */ YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP #line 107 "wcsutrn.l" { /* Non-alphabetic character. */ strcat(unitstr, wcsutrntext); if (bracket && *wcsutrntext == ']') { BEGIN(FLUSH); } } YY_BREAK case 4: YY_RULE_SETUP #line 115 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "Angstrom"); BEGIN(NEXT); } YY_BREAK case 5: YY_RULE_SETUP #line 121 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "arcmin"); BEGIN(NEXT); } YY_BREAK case 6: YY_RULE_SETUP #line 127 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "arcsec"); BEGIN(NEXT); } YY_BREAK case 7: YY_RULE_SETUP #line 133 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "beam"); BEGIN(NEXT); } YY_BREAK case 8: YY_RULE_SETUP #line 139 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "byte"); BEGIN(NEXT); } YY_BREAK case 9: YY_RULE_SETUP #line 145 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "d"); BEGIN(NEXT); } YY_BREAK case 10: YY_RULE_SETUP #line 151 "wcsutrn.l" { unsafe = 1; strcpy(orig, wcsutrntext); strcpy(subs, (ctrl & 4) ? "d" : "D"); BEGIN(NEXT); } YY_BREAK case 11: YY_RULE_SETUP #line 158 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "deg"); BEGIN(NEXT); } YY_BREAK case 12: YY_RULE_SETUP #line 164 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "GHz"); BEGIN(NEXT); } YY_BREAK case 13: YY_RULE_SETUP #line 170 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "h"); BEGIN(NEXT); } YY_BREAK case 14: YY_RULE_SETUP #line 176 "wcsutrn.l" { unsafe = 1; strcpy(orig, wcsutrntext); strcpy(subs, (ctrl & 2) ? "h" : "H"); BEGIN(NEXT); } YY_BREAK case 15: YY_RULE_SETUP #line 183 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "Hz"); BEGIN(NEXT); } YY_BREAK case 16: YY_RULE_SETUP #line 189 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "kHz"); BEGIN(NEXT); } YY_BREAK case 17: YY_RULE_SETUP #line 195 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "Jy"); BEGIN(NEXT); } YY_BREAK case 18: YY_RULE_SETUP #line 201 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "K"); BEGIN(NEXT); } YY_BREAK case 19: YY_RULE_SETUP #line 207 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "km"); BEGIN(NEXT); } YY_BREAK case 20: YY_RULE_SETUP #line 213 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "m"); BEGIN(NEXT); } YY_BREAK case 21: YY_RULE_SETUP #line 219 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "min"); BEGIN(NEXT); } YY_BREAK case 22: YY_RULE_SETUP #line 225 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "MHz"); BEGIN(NEXT); } YY_BREAK case 23: YY_RULE_SETUP #line 231 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "ohm"); BEGIN(NEXT); } YY_BREAK case 24: YY_RULE_SETUP #line 237 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "Pa"); BEGIN(NEXT); } YY_BREAK case 25: YY_RULE_SETUP #line 243 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "pixel"); BEGIN(NEXT); } YY_BREAK case 26: YY_RULE_SETUP #line 249 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "rad"); BEGIN(NEXT); } YY_BREAK case 27: YY_RULE_SETUP #line 255 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "s"); BEGIN(NEXT); } YY_BREAK case 28: YY_RULE_SETUP #line 261 "wcsutrn.l" { unsafe = 1; strcpy(orig, wcsutrntext); strcpy(subs, (ctrl & 1) ? "s" : "S"); BEGIN(NEXT); } YY_BREAK case 29: YY_RULE_SETUP #line 268 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "V"); BEGIN(NEXT); } YY_BREAK case 30: YY_RULE_SETUP #line 274 "wcsutrn.l" { strcpy(orig, wcsutrntext); strcpy(subs, "yr"); BEGIN(NEXT); } YY_BREAK case 31: YY_RULE_SETUP #line 280 "wcsutrn.l" { /* Not a recognized alias. */ strcpy(orig, wcsutrntext); strcpy(subs, orig); BEGIN(NEXT); } YY_BREAK case 32: YY_RULE_SETUP #line 287 "wcsutrn.l" { /* Reject the alias match. */ strcat(orig, wcsutrntext); strcpy(subs, orig); } YY_BREAK case 33: /* rule 33 can match eol */ YY_RULE_SETUP #line 293 "wcsutrn.l" { /* Discard separating whitespace. */ unput(wcsutrntext[wcsutrnleng-1]); } YY_BREAK case 34: YY_RULE_SETUP #line 298 "wcsutrn.l" { /* Compress separating whitespace. */ strcat(unitstr, subs); strcat(unitstr, " "); if (strcmp(orig, subs)) status = 0; unput(wcsutrntext[wcsutrnleng-1]); *subs = '\0'; BEGIN(INITIAL); } YY_BREAK case 35: YY_RULE_SETUP #line 308 "wcsutrn.l" { /* Copy anything else unchanged. */ strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; unput(*wcsutrntext); *subs = '\0'; BEGIN(INITIAL); } YY_BREAK case 36: YY_RULE_SETUP #line 317 "wcsutrn.l" { /* Copy out remaining input. */ strcat(unitstr, wcsutrntext); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(NEXT): case YY_STATE_EOF(FLUSH): #line 322 "wcsutrn.l" { /* End-of-string. */ if (*subs) { strcat(unitstr, subs); if (strcmp(orig, subs)) status = 0; } wcsutrnlex_destroy(); if (unsafe) { return wcserr_set(WCSERR_SET(UNITSERR_UNSAFE_TRANS), "Unsafe unit translation in '%s'", unitstr); } return status; } YY_BREAK case 37: YY_RULE_SETUP #line 337 "wcsutrn.l" ECHO; YY_BREAK #line 4663 "wcsutrn.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed wcsutrnin at a new source and called * wcsutrnlex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsutrnin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( wcsutrnwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * wcsutrntext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of wcsutrnlex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ wcsutrnrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; wcsutrnrestart(wcsutrnin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsutrnrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { if ( *yy_cp ) { yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; } else yy_current_state = yy_NUL_trans[yy_current_state]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up wcsutrntext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ wcsutrnrestart(wcsutrnin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( wcsutrnwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve wcsutrntext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void wcsutrnrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ wcsutrnensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsutrn_create_buffer(wcsutrnin,YY_BUF_SIZE ); } wcsutrn_init_buffer(YY_CURRENT_BUFFER,input_file ); wcsutrn_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void wcsutrn_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * wcsutrnpop_buffer_state(); * wcsutrnpush_buffer_state(new_buffer); */ wcsutrnensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; wcsutrn_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (wcsutrnwrap()) processing, but the only time this flag * is looked at is after wcsutrnwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void wcsutrn_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; wcsutrnin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE wcsutrn_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) wcsutrnalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrn_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) wcsutrnalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrn_create_buffer()" ); b->yy_is_our_buffer = 1; wcsutrn_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with wcsutrn_create_buffer() * */ void wcsutrn_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) wcsutrnfree((void *) b->yy_ch_buf ); wcsutrnfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a wcsutrnrestart() or at EOF. */ static void wcsutrn_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; wcsutrn_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then wcsutrn_init_buffer was _probably_ * called from wcsutrnrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void wcsutrn_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) wcsutrn_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void wcsutrnpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; wcsutrnensure_buffer_stack(); /* This block is copied from wcsutrn_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from wcsutrn_switch_to_buffer. */ wcsutrn_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void wcsutrnpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; wcsutrn_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { wcsutrn_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void wcsutrnensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)wcsutrnalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrnensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)wcsutrnrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrnensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsutrn_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) wcsutrnalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrn_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; wcsutrn_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to wcsutrnlex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * wcsutrn_scan_bytes() instead. */ YY_BUFFER_STATE wcsutrn_scan_string (yyconst char * yystr ) { return wcsutrn_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to wcsutrnlex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsutrn_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) wcsutrnalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsutrn_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = wcsutrn_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in wcsutrn_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsutrntext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ wcsutrntext[wcsutrnleng] = (yy_hold_char); \ (yy_c_buf_p) = wcsutrntext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ wcsutrnleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int wcsutrnget_lineno (void) { return wcsutrnlineno; } /** Get the input stream. * */ FILE *wcsutrnget_in (void) { return wcsutrnin; } /** Get the output stream. * */ FILE *wcsutrnget_out (void) { return wcsutrnout; } /** Get the length of the current token. * */ int wcsutrnget_leng (void) { return wcsutrnleng; } /** Get the current token. * */ char *wcsutrnget_text (void) { return wcsutrntext; } /** Set the current line number. * @param line_number * */ void wcsutrnset_lineno (int line_number ) { wcsutrnlineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see wcsutrn_switch_to_buffer */ void wcsutrnset_in (FILE * in_str ) { wcsutrnin = in_str ; } void wcsutrnset_out (FILE * out_str ) { wcsutrnout = out_str ; } int wcsutrnget_debug (void) { return wcsutrn_flex_debug; } void wcsutrnset_debug (int bdebug ) { wcsutrn_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from wcsutrnlex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT wcsutrnin = stdin; wcsutrnout = stdout; #else wcsutrnin = (FILE *) 0; wcsutrnout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * wcsutrnlex_init() */ return 0; } /* wcsutrnlex_destroy is for both reentrant and non-reentrant scanners. */ int wcsutrnlex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ wcsutrn_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; wcsutrnpop_buffer_state(); } /* Destroy the stack itself. */ wcsutrnfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * wcsutrnlex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *wcsutrnalloc (yy_size_t size ) { return (void *) malloc( size ); } void *wcsutrnrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void wcsutrnfree (void * ptr ) { free( (char *) ptr ); /* see wcsutrnrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 337 "wcsutrn.l" astropy-0.3/cextern/wcslib/C/flexed/README0000644000175000017500000000040612243255342016443 0ustar oleoleThis directory contains C code generated by flex 2.5.35 under Debian lenny from the Flex description files (*.l) in the parent directory. These pre-generated source files may be used during installation if Flex 2.5.9 or later is not available on the build host. astropy-0.3/cextern/wcslib/C/flexed/wcspih.c0000644000175000017500000156107212243255342017240 0ustar oleole#line 2 "wcspih.c" #line 4 "wcspih.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer wcspih_create_buffer #define yy_delete_buffer wcspih_delete_buffer #define yy_flex_debug wcspih_flex_debug #define yy_init_buffer wcspih_init_buffer #define yy_flush_buffer wcspih_flush_buffer #define yy_load_buffer_state wcspih_load_buffer_state #define yy_switch_to_buffer wcspih_switch_to_buffer #define yyin wcspihin #define yyleng wcspihleng #define yylex wcspihlex #define yylineno wcspihlineno #define yyout wcspihout #define yyrestart wcspihrestart #define yytext wcspihtext #define yywrap wcspihwrap #define yyalloc wcspihalloc #define yyrealloc wcspihrealloc #define yyfree wcspihfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE wcspihrestart(wcspihin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int wcspihleng; extern FILE *wcspihin, *wcspihout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up wcspihtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up wcspihtext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via wcspihrestart()), so that the user can continue scanning by * just pointing wcspihin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when wcspihtext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int wcspihleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow wcspihwrap()'s to do buffer switches * instead of setting up a fresh wcspihin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void wcspihrestart (FILE *input_file ); void wcspih_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE wcspih_create_buffer (FILE *file,int size ); void wcspih_delete_buffer (YY_BUFFER_STATE b ); void wcspih_flush_buffer (YY_BUFFER_STATE b ); void wcspihpush_buffer_state (YY_BUFFER_STATE new_buffer ); void wcspihpop_buffer_state (void ); static void wcspihensure_buffer_stack (void ); static void wcspih_load_buffer_state (void ); static void wcspih_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER wcspih_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE wcspih_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE wcspih_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE wcspih_scan_bytes (yyconst char *bytes,int len ); void *wcspihalloc (yy_size_t ); void *wcspihrealloc (void *,yy_size_t ); void wcspihfree (void * ); #define yy_new_buffer wcspih_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ wcspihensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ wcspihensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define wcspihwrap(n) 1 #define YY_SKIP_YYWRAP typedef char YY_CHAR; FILE *wcspihin = (FILE *) 0, *wcspihout = (FILE *) 0; typedef int yy_state_type; extern int wcspihlineno; int wcspihlineno = 1; extern char *wcspihtext; #define yytext_ptr wcspihtext static yyconst flex_int16_t yy_nxt[][128] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 33, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34 }, { 33, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 37, 38, 35, 35, 35, 35, 35, 35, 39, 40, 41, 42, 43, 35, 44, 45, 35, 35, 46, 47, 35, 35, 48, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35 }, { 33, 49, 49, 49, 49, 49, 49, 49, 49, 49, 34, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 }, { 33, 49, 49, 49, 49, 49, 49, 49, 49, 49, 34, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 }, { 33, 51, 51, 51, 51, 51, 51, 51, 51, 51, 34, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 }, { 33, 51, 51, 51, 51, 51, 51, 51, 51, 51, 34, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 }, { 33, 53, 53, 53, 53, 53, 53, 53, 53, 53, 34, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53 }, { 33, 53, 53, 53, 53, 53, 53, 53, 53, 53, 34, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53 }, { 33, 55, 55, 55, 55, 55, 55, 55, 55, 55, 34, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55 }, { 33, 55, 55, 55, 55, 55, 55, 55, 55, 55, 34, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 57, 57, 57, 57, 57, 57, 57, 57, 57, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55 }, { 33, 58, 58, 58, 58, 58, 58, 58, 58, 58, 34, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 }, { 33, 58, 58, 58, 58, 58, 58, 58, 58, 58, 34, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58 }, { 33, 60, 60, 60, 60, 60, 60, 60, 60, 60, 34, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 }, { 33, 60, 60, 60, 60, 60, 60, 60, 60, 60, 34, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 }, { 33, 62, 62, 62, 62, 62, 62, 62, 62, 62, 34, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 }, { 33, 62, 62, 62, 62, 62, 62, 62, 62, 62, 34, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62 }, { 33, 63, 63, 63, 63, 63, 63, 63, 63, 63, 34, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }, { 33, 63, 63, 63, 63, 63, 63, 63, 63, 63, 34, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 64, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 }, { 33, 65, 65, 65, 65, 65, 65, 65, 65, 65, 34, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 65, 66, 65, 65, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 }, { 33, 65, 65, 65, 65, 65, 65, 65, 65, 65, 34, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 65, 66, 65, 65, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65 }, { 33, 68, 68, 68, 68, 68, 68, 68, 68, 68, 34, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 68, 69, 70, 68, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 33, 68, 68, 68, 68, 68, 68, 68, 68, 68, 34, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 68, 69, 70, 68, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 }, { 33, 72, 72, 72, 72, 72, 72, 72, 72, 72, 34, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72 }, { 33, 72, 72, 72, 72, 72, 72, 72, 72, 72, 34, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72 }, { 33, 74, 74, 74, 74, 74, 74, 74, 74, 74, 34, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 76, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74 }, { 33, 74, 74, 74, 74, 74, 74, 74, 74, 74, 34, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 76, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74 }, { 33, 77, 77, 77, 77, 77, 77, 77, 77, 77, 34, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 33, 77, 77, 77, 77, 77, 77, 77, 77, 77, 34, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 33, 78, 78, 78, 78, 78, 78, 78, 78, 78, 34, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }, { 33, 78, 78, 78, 78, 78, 78, 78, 78, 78, 34, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }, { 33, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 }, { 33, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 }, { -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33 }, { 33, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34 }, { 33, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 }, { 33, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, 81, -36, -36, -36, -36, -36, -36, -36, -36, -36, 82, -36, -36, -36, 83, 84, 85, 86, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 }, { 33, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, 87, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37 }, { 33, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, 88, -38, 89, 90, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38 }, { 33, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, 91, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, 92, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39 }, { 33, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, 93, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40 }, { 33, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, 94, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41 }, { 33, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 95, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42 }, { 33, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 96, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 97, 98, -43, -43, 99, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43 }, { 33, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, 100, -44, -44, -44, 101, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44 }, { 33, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 102, -45, -45, 103, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45 }, { 33, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 104, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 105, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46 }, { 33, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, 106, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47 }, { 33, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, 107, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48 }, { 33, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49 }, { 33, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 108, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, -50, -50, -50, -50, -50, -50, -50, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50 }, { 33, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51 }, { 33, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 110, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52 }, { 33, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53 }, { 33, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 111, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, -54, -54, -54, -54, -54, -54, -54, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54 }, { 33, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55 }, { 33, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56 }, { 33, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 115, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57 }, { 33, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58 }, { 33, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 117, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59 }, { 33, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60 }, { 33, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61 }, { 33, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62 }, { 33, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63 }, { 33, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 118, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64 }, { 33, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65 }, { 33, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66 }, { 33, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 }, { 33, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68 }, { 33, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, 120, -69, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69 }, { 33, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 }, { 33, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 123, -71, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 125, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 125, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71 }, { 33, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72 }, { 33, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126 }, { 33, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74 }, { 33, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, 128, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, 129, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75 }, { 33, 130, 130, 130, 130, 130, 130, 130, 130, 130, -76, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 }, { 33, 131, 131, 131, 131, 131, 131, 131, 131, 131, -77, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131 }, { 33, 132, 132, 132, 132, 132, 132, 132, 132, 132, -78, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132 }, { 33, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133 }, { 33, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80 }, { 33, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 135, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81 }, { 33, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, 136, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82 }, { 33, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, 137, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, 138, 139, -83, -83, -83, -83, -83, 140, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83 }, { 33, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, 141, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84 }, { 33, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, 142, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85 }, { 33, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 143, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86 }, { 33, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, 144, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87 }, { 33, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 145, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88 }, { 33, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 146, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89 }, { 33, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 147, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90 }, { 33, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 148, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91 }, { 33, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 149, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92 }, { 33, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 150, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93 }, { 33, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 151, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 }, { 33, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 152, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 }, { 33, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96 }, { 33, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, 153, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97 }, { 33, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98 }, { 33, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99 }, { 33, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 154, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 }, { 33, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 155, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101 }, { 33, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 156, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102 }, { 33, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, 157, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103 }, { 33, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, 158, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104 }, { 33, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, 159, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105 }, { 33, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 160, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106 }, { 33, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 161, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107 }, { 33, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 162, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108 }, { 33, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, 163, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, -109, -109, -109, -109, -109, -109, -109, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109 }, { 33, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 165, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110 }, { 33, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 166, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111 }, { 33, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 167, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, -112, -112, -112, -112, -112, -112, -112, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 }, { 33, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113 }, { 33, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 171, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114 }, { 33, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 172, 172, 172, 172, 172, 172, 172, 172, 172, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115 }, { 33, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 174, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116 }, { 33, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117 }, { 33, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 }, { 33, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119 }, { 33, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120 }, { 33, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 123, -121, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 125, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 125, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 }, { 33, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 125, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 125, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122 }, { 33, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 125, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 125, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123 }, { 33, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, 123, -124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, 125, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, 125, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124 }, { 33, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, 178, -125, 178, -125, -125, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125 }, { 33, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126 }, { 33, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, 126, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127 }, { 33, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, 128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, 129, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128 }, { 33, 130, 130, 130, 130, 130, 130, 130, 130, 130, -129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 }, { 33, 130, 130, 130, 130, 130, 130, 130, 130, 130, -130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130 }, { 33, 131, 131, 131, 131, 131, 131, 131, 131, 131, -131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131 }, { 33, 132, 132, 132, 132, 132, 132, 132, 132, 132, -132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, 132 }, { 33, 133, 133, 133, 133, 133, 133, 133, 133, 133, 134, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133 }, { 33, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134 }, { 33, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 180, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135 }, { 33, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, 181, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136 }, { 33, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 182, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137 }, { 33, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 183, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138 }, { 33, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, 184, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139 }, { 33, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, 185, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140 }, { 33, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 186, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141 }, { 33, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 187, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142 }, { 33, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, 188, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143 }, { 33, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 189, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144 }, { 33, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 190, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145 }, { 33, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 191, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146 }, { 33, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, 192, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147 }, { 33, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 193, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148 }, { 33, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 194, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149 }, { 33, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, 195, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150 }, { 33, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, 196, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151 }, { 33, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, 197, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152 }, { 33, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, 198, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153 }, { 33, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, 199, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154 }, { 33, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 200, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155 }, { 33, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, 201, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156 }, { 33, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, 202, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157 }, { 33, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, 203, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, 204, -158, -158, 205, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158 }, { 33, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, 206, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159 }, { 33, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, 207, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, 208, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160 }, { 33, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, 209, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161 }, { 33, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162 }, { 33, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163 }, { 33, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164 }, { 33, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165 }, { 33, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166 }, { 33, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167 }, { 33, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168 }, { 33, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169 }, { 33, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 212, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170 }, { 33, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 213, 213, 213, 213, 213, 213, 213, 213, 213, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171 }, { 33, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 214, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, -172, -172, -172, -172, -172, -172, -172, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172 }, { 33, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 217, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173 }, { 33, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 218, 219, 219, 219, 219, 219, 219, 219, 219, 219, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174 }, { 33, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, 220, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175 }, { 33, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 220, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, -176, -176, -176, -176, -176, -176, -176, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176 }, { 33, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 177, 177, 177, 177, 177, 177, 177, 177, 177, 177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 125, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 125, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177 }, { 33, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178 }, { 33, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179 }, { 33, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, 222, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180 }, { 33, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, 223, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181 }, { 33, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, 224, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182 }, { 33, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, 225, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183 }, { 33, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, 226, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184 }, { 33, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, 227, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185, -185 }, { 33, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, 228, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186 }, { 33, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 229, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187 }, { 33, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 230, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188 }, { 33, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 231, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189 }, { 33, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 232, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190 }, { 33, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 233, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191 }, { 33, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 234, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192 }, { 33, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 235, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193 }, { 33, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 236, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194 }, { 33, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 237, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 238, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195 }, { 33, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, 239, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196 }, { 33, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, 240, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197 }, { 33, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 241, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198 }, { 33, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 242, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 243, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199 }, { 33, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 244, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 245, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200 }, { 33, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 246, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201 }, { 33, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 247, -202, -202, -202, 248, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202 }, { 33, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 249, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203 }, { 33, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 250, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204 }, { 33, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, 251, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205 }, { 33, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 252, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206 }, { 33, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 253, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207 }, { 33, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 254, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208 }, { 33, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 255, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209 }, { 33, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210 }, { 33, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 257, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211 }, { 33, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 258, 258, 258, 258, 258, 258, 258, 258, 258, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212 }, { 33, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, 259, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, -213, -213, -213, -213, -213, -213, -213, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213 }, { 33, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, 261, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214 }, { 33, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, 262, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, -215, -215, -215, -215, -215, -215, -215, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, 262, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215 }, { 33, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 264, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216 }, { 33, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 265, 266, 266, 266, 266, 266, 266, 266, 266, 266, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217 }, { 33, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 267, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218 }, { 33, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 267, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, -219, -219, -219, -219, -219, -219, -219, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219 }, { 33, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 269, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220 }, { 33, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 270, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, -221, -221, -221, -221, -221, -221, -221, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221 }, { 33, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222 }, { 33, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223 }, { 33, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224 }, { 33, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225 }, { 33, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226 }, { 33, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227 }, { 33, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228 }, { 33, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229 }, { 33, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230 }, { 33, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, 272, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, 273, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231 }, { 33, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 274, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232 }, { 33, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 275, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, 275, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233 }, { 33, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 276, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234 }, { 33, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 277, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235 }, { 33, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 278, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236 }, { 33, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 279, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237 }, { 33, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 280, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238 }, { 33, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 281, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239 }, { 33, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, 282, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240 }, { 33, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241 }, { 33, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 283, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242 }, { 33, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 284, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243 }, { 33, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, 285, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244 }, { 33, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 286, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245 }, { 33, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 287, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246 }, { 33, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, 288, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247 }, { 33, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 289, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248 }, { 33, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 290, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249 }, { 33, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, 291, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250 }, { 33, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, 292, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251 }, { 33, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, 293, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252 }, { 33, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, 294, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253 }, { 33, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, 295, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254 }, { 33, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 296, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255 }, { 33, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256 }, { 33, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 298, 298, 298, 298, 298, 298, 298, 298, 298, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257 }, { 33, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, 299, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, -258, -258, -258, -258, -258, -258, -258, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258 }, { 33, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, 301, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259 }, { 33, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 302, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, -260, -260, -260, -260, -260, -260, -260, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260 }, { 33, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 304, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261 }, { 33, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 305, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262 }, { 33, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 306, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, -263, -263, -263, -263, -263, -263, -263, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263 }, { 33, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264 }, { 33, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 309, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265 }, { 33, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 309, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, -266, -266, -266, -266, -266, -266, -266, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266 }, { 33, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 311, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267 }, { 33, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 312, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, -268, -268, -268, -268, -268, -268, -268, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268 }, { 33, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 314, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269 }, { 33, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, 315, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270 }, { 33, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 316, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, -271, -271, -271, -271, -271, -271, -271, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271 }, { 33, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 318, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272 }, { 33, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 319, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273 }, { 33, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, 320, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274 }, { 33, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, 321, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275 }, { 33, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 322, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276 }, { 33, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 323, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277 }, { 33, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, 324, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278 }, { 33, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, 325, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279 }, { 33, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, 326, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280 }, { 33, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, 327, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281 }, { 33, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 328, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282 }, { 33, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 329, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283 }, { 33, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, 330, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284 }, { 33, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 331, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 332, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285 }, { 33, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 333, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286 }, { 33, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, 334, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287 }, { 33, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 335, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288 }, { 33, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 336, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289 }, { 33, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 337, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290 }, { 33, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, 338, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291 }, { 33, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, 339, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292 }, { 33, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 340, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293 }, { 33, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 341, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294 }, { 33, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 342, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295 }, { 33, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 343, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296 }, { 33, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297 }, { 33, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298 }, { 33, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299 }, { 33, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300 }, { 33, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301 }, { 33, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302 }, { 33, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303 }, { 33, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304 }, { 33, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305 }, { 33, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306 }, { 33, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307 }, { 33, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308 }, { 33, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309 }, { 33, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310 }, { 33, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311 }, { 33, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312 }, { 33, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313 }, { 33, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314 }, { 33, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315 }, { 33, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316 }, { 33, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317 }, { 33, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, 344, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318 }, { 33, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, 345, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319 }, { 33, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, 346, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320 }, { 33, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, 347, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321 }, { 33, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322 }, { 33, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323 }, { 33, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324 }, { 33, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 348, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325 }, { 33, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, 349, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326 }, { 33, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, 350, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327 }, { 33, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, 351, 352, 353, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328 }, { 33, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, 354, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329 }, { 33, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330 }, { 33, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 355, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331 }, { 33, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332 }, { 33, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333 }, { 33, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334 }, { 33, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335 }, { 33, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336 }, { 33, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337 }, { 33, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338 }, { 33, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 356, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339 }, { 33, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 357, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340 }, { 33, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 358, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341 }, { 33, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342 }, { 33, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343 }, { 33, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344 }, { 33, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345 }, { 33, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, 359, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346 }, { 33, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347 }, { 33, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348 }, { 33, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349 }, { 33, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, 360, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350 }, { 33, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351 }, { 33, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352 }, { 33, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353 }, { 33, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354 }, { 33, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355 }, { 33, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356 }, { 33, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357 }, { 33, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 361, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358 }, { 33, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, 362, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359 }, { 33, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 363, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360 }, { 33, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 364, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361 }, { 33, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 365, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362 }, { 33, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 366, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 367, -363, 367, -363, -363, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363 }, { 33, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 369, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 370, -364, 370, -364, -364, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364 }, { 33, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, 372, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365 }, { 33, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, 366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, 367, -366, 367, -366, -366, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366 }, { 33, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367 }, { 33, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368 }, { 33, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 370, -369, 370, -369, -369, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369 }, { 33, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370 }, { 33, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371 }, { 33, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 373, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372 }, { 33, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 374, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373 }, { 33, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, 375, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374 }, { 33, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, 376, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375 }, { 33, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 377, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376 }, { 33, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 378, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377 }, { 33, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, 379, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378 }, { 33, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, 380, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379 }, { 33, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, 381, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380 }, { 33, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 382, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381 }, { 33, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, 383, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382 }, { 33, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, 384, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383 }, { 33, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, 385, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384 }, { 33, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, 386, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385 }, { 33, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, 387, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386 }, { 33, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, 388, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387 }, { 33, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, 389, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388 }, { 33, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, 390, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389 }, { 33, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, 391, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390 }, { 33, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 392, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391 }, { 33, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, 393, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392 }, { 33, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, 394, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393 }, { 33, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, 395, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394 }, { 33, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, 396, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395 }, { 33, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, 397, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396 }, { 33, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, 398, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397 }, { 33, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, 399, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398 }, { 33, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, 400, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399 }, { 33, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, 401, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400 }, { 33, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, 402, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401 }, { 33, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, 403, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402 }, { 33, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, 404, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403 }, { 33, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, 405, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404 }, { 33, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, 406, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405 }, { 33, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, 407, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406 }, { 33, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, 408, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407 }, { 33, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, 409, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408 }, { 33, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, 410, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409 }, { 33, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, 411, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410 }, { 33, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, 412, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411 }, { 33, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, 413, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412 }, { 33, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, 414, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413 }, { 33, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, 415, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414 }, { 33, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, 416, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415 }, { 33, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, 417, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416 }, { 33, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 418, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417 }, { 33, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, 419, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418 }, { 33, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, 420, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419 }, { 33, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, 421, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420 }, { 33, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, 422, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421 }, { 33, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, 423, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422 }, { 33, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 424, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423 }, { 33, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, 425, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424 }, { 33, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, 426, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425 }, { 33, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 427, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426 }, { 33, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, 428, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427 }, { 33, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 429, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428 }, { 33, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 430, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429 }, { 33, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, 431, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430 }, { 33, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, 432, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431 }, { 33, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, 433, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432 }, { 33, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, 434, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433 }, { 33, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, 435, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434 }, { 33, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, 436, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435 }, { 33, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, 437, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436 }, { 33, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, 438, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437 }, { 33, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, 439, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438 }, { 33, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, 440, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439 }, { 33, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up wcspihtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ wcspihleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[441] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, 89, 91, 91, 92, 92, 0, 0, 95, 94, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 63, 63, 79, 79, 47, 47, 59, 59, 59, 77, 77, 66, 64, 65, 81, 81, 83, 83, 82, 85, 85, 85, 84, 87, 87, 90, 89, 88, 91, 92, 94, 93, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 18, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 82, 0, 84, 84, 84, 84, 0, 0, 86, 89, 88, 88, 91, 92, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 61, 62, 78, 44, 45, 46, 0, 0, 0, 0, 0, 0, 0, 0, 84, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 19, 20, 7, 3, 10, 21, 9, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 57, 53, 56, 50, 51, 55, 48, 49, 52, 54, 76, 72, 75, 69, 70, 74, 67, 68, 71, 73, 0, 0, 0, 0, 25, 12, 11, 0, 0, 0, 0, 0, 31, 0, 13, 15, 33, 34, 35, 36, 37, 0, 0, 0, 40, 41, 22, 23, 0, 24, 26, 27, 0, 28, 29, 30, 32, 14, 38, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; static yyconst yy_state_type yy_NUL_trans[441] = { 0, 34, 35, 49, 49, 51, 51, 53, 53, 55, 55, 58, 58, 60, 60, 62, 62, 63, 63, 65, 65, 68, 68, 72, 72, 74, 74, 77, 77, 78, 78, 79, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 130, 131, 132, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 130, 130, 131, 132, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; extern int wcspih_flex_debug; int wcspih_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *wcspihtext; #line 1 "wcspih.l" /*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcspih.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical * scanner for parsing the WCS keyrecords from a FITS primary image or image * extension header. * * wcspih.l requires Flex v2.5.4 or later. Refer to wcshdr.h for a description * of the user interface and operating notes. * * Implementation notes * -------------------- * Use of the WCSAXESa keyword is not mandatory. Its default value is "the * larger of NAXIS and the largest index of these keywords [i.e. CRPIXj, PCi_j * or CDi_j, CDELTi, CTYPEi, CRVALi, and CUNITi] found in the FITS header". * Consequently the definition of WCSAXESa effectively invalidates the use of * NAXIS for determining the number of coordinate axes and forces a preliminary * pass through the header to determine the "largest index" in headers where * WCSAXESa was omitted. * * Furthermore, since the use of WCSAXESa is optional, there is no way to * determine the number of coordinate representations (the "a" value) other * than by parsing all of the WCS keywords in the header; even if WCSAXESa was * specified for some representations it cannot be known in advance whether it * was specified for all of those present in the header. * * Hence the definition of WCSAXESa forces the scanner to be implemented in two * passes. The first pass is used to determine the number of coordinate * representations (up to 27) and the number of coordinate axes in each. * Effectively WCSAXESa is ignored unless it exceeds the "largest index" in * which case the keywords for the extra axes assume their default values. The * number of PVi_ma and PSi_ma keywords in each representation is also counted * in the first pass. * * On completion of the first pass, memory is allocated for an array of the * required number of wcsprm structs and each of these is initialized * appropriately. These structs are filled in the second pass. * * The parser does not check for duplicated keywords, it accepts the last * encountered. * *===========================================================================*/ /* Options. */ /* Indices for parameterized keywords. */ /* Alternate coordinate system identifier. */ /* Keyvalue data types. */ /* Exclusive start states. */ #line 99 "wcspih.l" #include #include #include #include #include #include "wcs.h" #include "wcshdr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcsutil.h" #define INTEGER 0 #define FLOAT 1 #define STRING 2 #define YY_DECL int wcspih(char *header, int nkeyrec, int relax, int ctrl, \ int *nreject, int *nwcs, struct wcsprm **wcs) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (wcspih_nkeyrec) { \ strncpy(inbuff, wcspih_hdr, 80); \ inbuff[80] = '\n'; \ wcspih_hdr += 80; \ wcspih_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* These global variables are required by YY_INPUT. */ char *wcspih_hdr; int wcspih_nkeyrec; int wcspih_final(int alts[], double epoch[], double vsource[], int *nwcs, struct wcsprm **wcs); int wcspih_inits(int naxis, int alts[], int npv[], int nps[], int *nwcs, struct wcsprm **wcs); void wcspih_naxes(int naxis, int i, int j, char a, int alts[], int *npptr); /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcspih_abort_jmp_env; #define exit(status) longjmp(wcspih_abort_jmp_env, status) #line 8279 "wcspih.c" #define INITIAL 0 #define CROTAi 1 #define PROJPn 2 #define CCCCCia 3 #define CCi_ja 4 #define CCi_ma 5 #define CCCCCCCa 6 #define CCCCCCCC 7 #define VALUE 8 #define INTEGER_VAL 9 #define FLOAT_VAL 10 #define STRING_VAL 11 #define COMMENT 12 #define DISCARD 13 #define ERROR 14 #define FLUSH 15 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int wcspihlex_destroy (void ); int wcspihget_debug (void ); void wcspihset_debug (int debug_flag ); YY_EXTRA_TYPE wcspihget_extra (void ); void wcspihset_extra (YY_EXTRA_TYPE user_defined ); FILE *wcspihget_in (void ); void wcspihset_in (FILE * in_str ); FILE *wcspihget_out (void ); void wcspihset_out (FILE * out_str ); int wcspihget_leng (void ); char *wcspihget_text (void ); int wcspihget_lineno (void ); void wcspihset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int wcspihwrap (void ); #else extern int wcspihwrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( wcspihtext, wcspihleng, 1, wcspihout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ while ( (result = read( fileno(wcspihin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(wcspihin); \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int wcspihlex (void); #define YY_DECL int wcspihlex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after wcspihtext and wcspihleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( wcspihleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (wcspihtext[wcspihleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 147 "wcspih.l" /* Keyword indices, as used in the WCS papers, e.g. PCi_ja, PVi_ma. */ char a; int i, j, m; char *cptr, *errmsg, errtxt[80], *hptr, *keep; int altlin, alts[27], ialt, idx, ipx, ix, jx, naxis, *npptr, nps[27], npv[27], pass, status, valtype, voff; double epoch[27], vsource[27]; void *vptr, *wptr; struct wcsprm *wcsp; int wcspihlex_destroy(void); naxis = 0; for (ialt = 0; ialt < 27; ialt++) { alts[ialt] = 0; npv[ialt] = 0; nps[ialt] = 0; epoch[ialt] = UNDEFINED; vsource[ialt] = UNDEFINED; } /* Parameters used to implement YY_INPUT. */ wcspih_hdr = header; wcspih_nkeyrec = nkeyrec; /* Our handle on the input stream. */ hptr = header; keep = 0x0; *nreject = 0; /* Keyword parameters. */ i = j = m = 0; a = ' '; /* For decoding the keyvalue. */ valtype = -1; idx = -1; vptr = 0x0; /* For keywords that require special handling. */ altlin = 0; npptr = 0x0; /* The data structures produced. */ *nwcs = 0; *wcs = 0x0; pass = 1; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcspih_abort_jmp_env)) { return 3; } BEGIN(INITIAL); #line 8527 "wcspih.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! wcspihin ) wcspihin = stdin; if ( ! wcspihout ) wcspihout = stdout; if ( ! YY_CURRENT_BUFFER ) { wcspihensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); } wcspih_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); /* Support of wcspihtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } ++yy_cp; } yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos) + 1; yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 205 "wcspih.l" { if (pass == 1) { sscanf(wcspihtext, "NAXIS = %d", &naxis); } if (naxis < 0) { errmsg = errtxt; sprintf(errmsg, "Negative value of NAXIS ignored: %d", naxis); naxis = 0; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 2: YY_RULE_SETUP #line 220 "wcspih.l" { if (pass == 1) { sscanf(wcspihtext, "WCSAXES%c= %d", &a, &i); wcspih_naxes(naxis, i, 0, a, alts, 0); } BEGIN(FLUSH); } YY_BREAK case 3: YY_RULE_SETUP #line 228 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crpix); BEGIN(CCCCCia); } YY_BREAK case 4: YY_RULE_SETUP #line 234 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pc); altlin = 1; BEGIN(CCi_ja); } YY_BREAK case 5: YY_RULE_SETUP #line 241 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->cd); altlin = 2; BEGIN(CCi_ja); } YY_BREAK case 6: YY_RULE_SETUP #line 248 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->cdelt); BEGIN(CCCCCia); } YY_BREAK case 7: YY_RULE_SETUP #line 254 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crota); altlin = 4; BEGIN(CROTAi); } YY_BREAK case 8: YY_RULE_SETUP #line 261 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = &((*wcs)->cunit); BEGIN(CCCCCia); } YY_BREAK case 9: YY_RULE_SETUP #line 267 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = &((*wcs)->ctype); BEGIN(CCCCCia); } YY_BREAK case 10: YY_RULE_SETUP #line 273 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crval); BEGIN(CCCCCia); } YY_BREAK case 11: YY_RULE_SETUP #line 279 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->lonpole); BEGIN(CCCCCCCa); } YY_BREAK case 12: YY_RULE_SETUP #line 285 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->latpole); BEGIN(CCCCCCCa); } YY_BREAK case 13: YY_RULE_SETUP #line 291 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restfrq); BEGIN(CCCCCCCa); } YY_BREAK case 14: YY_RULE_SETUP #line 297 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restfrq); unput(' '); BEGIN(CCCCCCCa); } YY_BREAK case 15: YY_RULE_SETUP #line 304 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->restwav); BEGIN(CCCCCCCa); } YY_BREAK case 16: YY_RULE_SETUP #line 310 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pv); npptr = npv; BEGIN(CCi_ma); } YY_BREAK case 17: YY_RULE_SETUP #line 317 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->pv); npptr = npv; BEGIN(PROJPn); } YY_BREAK case 18: YY_RULE_SETUP #line 324 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = &((*wcs)->ps); npptr = nps; BEGIN(CCi_ma); } YY_BREAK case 19: YY_RULE_SETUP #line 331 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = &((*wcs)->cname); BEGIN(CCCCCia); } YY_BREAK case 20: YY_RULE_SETUP #line 337 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->crder); BEGIN(CCCCCia); } YY_BREAK case 21: YY_RULE_SETUP #line 343 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->csyer); BEGIN(CCCCCia); } YY_BREAK case 22: YY_RULE_SETUP #line 349 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->dateavg; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 23: YY_RULE_SETUP #line 356 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->dateobs; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 24: YY_RULE_SETUP #line 363 "wcspih.l" { sscanf(wcspihtext, "EPOCH%c", &a); if (a == ' ' || relax & WCSHDR_EPOCHa) { valtype = FLOAT; if (pass == 2) { vptr = epoch; if (a >= 'A') { vptr = (void *)((double *)vptr + alts[a-'A'+1]); } } unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "EPOCH keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 25: YY_RULE_SETUP #line 387 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->equinox); BEGIN(CCCCCCCa); } YY_BREAK case 26: YY_RULE_SETUP #line 393 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->mjdavg); if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 27: YY_RULE_SETUP #line 400 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->mjdobs); if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 28: YY_RULE_SETUP #line 407 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 29: YY_RULE_SETUP #line 414 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo + 1; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 30: YY_RULE_SETUP #line 421 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = (*wcs)->obsgeo + 2; if (ctrl < -10) keep = wcspih_hdr - 80; BEGIN(CCCCCCCC); } YY_BREAK case 31: YY_RULE_SETUP #line 428 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->radesys; BEGIN(CCCCCCCa); } YY_BREAK case 32: YY_RULE_SETUP #line 434 "wcspih.l" { if (relax & WCSHDR_RADECSYS) { valtype = STRING; if (pass == 2) vptr = (*wcs)->radesys; unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "RADECSYS is non-standard, use RADESYSa"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 33: YY_RULE_SETUP #line 450 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->specsys; BEGIN(CCCCCCCa); } YY_BREAK case 34: YY_RULE_SETUP #line 456 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->ssysobs; BEGIN(CCCCCCCa); } YY_BREAK case 35: YY_RULE_SETUP #line 462 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->ssyssrc; BEGIN(CCCCCCCa); } YY_BREAK case 36: YY_RULE_SETUP #line 468 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->velangl); BEGIN(CCCCCCCa); } YY_BREAK case 37: YY_RULE_SETUP #line 474 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->velosys); BEGIN(CCCCCCCa); } YY_BREAK case 38: YY_RULE_SETUP #line 480 "wcspih.l" { sscanf(wcspihtext, "VELREF%c", &a); if (a == ' ' || relax & WCSHDR_VELREFa) { valtype = INTEGER; if (pass == 2) vptr = &((*wcs)->velref); unput(a); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "VELREF keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 39: YY_RULE_SETUP #line 499 "wcspih.l" { sscanf(wcspihtext, "VSOURCE%c", &a); if (relax & WCSHDR_VSOURCE) { valtype = FLOAT; if (pass == 2) { vptr = vsource; if (a >= 'A') { vptr = (void *)((double *)vptr + alts[a-'A'+1]); } } unput(' '); BEGIN(CCCCCCCa); } else if (relax & WCSHDR_reject) { errmsg = "Deprecated VSOURCEa keyword rejected"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 40: YY_RULE_SETUP #line 523 "wcspih.l" { valtype = STRING; if (pass == 2) vptr = (*wcs)->wcsname; BEGIN(CCCCCCCa); } YY_BREAK case 41: YY_RULE_SETUP #line 529 "wcspih.l" { valtype = FLOAT; if (pass == 2) vptr = &((*wcs)->zsource); BEGIN(CCCCCCCa); } YY_BREAK case 42: YY_RULE_SETUP #line 535 "wcspih.l" { yyless(0); if (wcspih_nkeyrec) { wcspih_nkeyrec = 0; errmsg = "Keyrecords following the END keyrecord were ignored"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 43: YY_RULE_SETUP #line 546 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 44: #line 551 "wcspih.l" case 45: YY_RULE_SETUP #line 551 "wcspih.l" { sscanf(wcspihtext, "%d%c", &i, &a); idx = i - 1; BEGIN(VALUE); } YY_BREAK case 46: YY_RULE_SETUP #line 557 "wcspih.l" { /* Invalid axis number will be caught by . */ sscanf(wcspihtext, "%3d", &i); BEGIN(VALUE); } YY_BREAK case 47: YY_RULE_SETUP #line 563 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 48: #line 568 "wcspih.l" case 49: #line 569 "wcspih.l" case 50: #line 570 "wcspih.l" case 51: YY_RULE_SETUP #line 570 "wcspih.l" { sscanf(wcspihtext, "%d_%d%c", &i, &j, &a); if (pass == 2) { wcsp = *wcs; if (a != ' ') { wcsp += alts[a-'A'+1]; } idx = (i-1)*(wcsp->naxis) + j - 1; } BEGIN(VALUE); } YY_BREAK case 52: #line 584 "wcspih.l" case 53: #line 585 "wcspih.l" case 54: #line 586 "wcspih.l" case 55: #line 587 "wcspih.l" case 56: #line 588 "wcspih.l" case 57: YY_RULE_SETUP #line 588 "wcspih.l" { /* Invalid axis numbers will be caught by . */ sscanf(wcspihtext, "%d_%d", &i, &j); BEGIN(VALUE); } YY_BREAK case 58: YY_RULE_SETUP #line 594 "wcspih.l" { /* This covers the defunct forms CD00i00j and PC00i00j. */ if (((relax & WCSHDR_PC00i00j) && (altlin == 1)) || ((relax & WCSHDR_CD00i00j) && (altlin == 2))) { sscanf(wcspihtext, "%3d%3d", &i, &j); a = ' '; if (pass == 2) { idx = (i-1)*((*wcs)->naxis) + j - 1; } BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = errtxt; sprintf(errmsg, "Defunct form of %si_ja keyword", (altlin==1) ? "PC" : "CD"); BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 59: YY_RULE_SETUP #line 616 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 60: #line 621 "wcspih.l" case 61: YY_RULE_SETUP #line 621 "wcspih.l" { sscanf(wcspihtext, "%d%c", &i, &a); if (a == ' ' || relax & WCSHDR_CROTAia) { idx = i - 1; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "CROTAn keyword may not have an alternate version code"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 62: YY_RULE_SETUP #line 636 "wcspih.l" { sscanf(wcspihtext, "%d", &i); a = ' '; idx = i - 1; BEGIN(VALUE); } YY_BREAK case 63: YY_RULE_SETUP #line 643 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 64: #line 648 "wcspih.l" case 65: YY_RULE_SETUP #line 648 "wcspih.l" { idx = -1; if (YY_START == CCCCCCCa) { sscanf(wcspihtext, "%c", &a); } else { unput(wcspihtext[0]); a = 0; } BEGIN(VALUE); } YY_BREAK case 66: YY_RULE_SETUP #line 660 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 67: #line 665 "wcspih.l" case 68: #line 666 "wcspih.l" case 69: #line 667 "wcspih.l" case 70: YY_RULE_SETUP #line 667 "wcspih.l" { sscanf(wcspihtext, "%d_%d%c", &i, &m, &a); idx = -1; BEGIN(VALUE); } YY_BREAK case 71: #line 674 "wcspih.l" case 72: #line 675 "wcspih.l" case 73: #line 676 "wcspih.l" case 74: #line 677 "wcspih.l" case 75: #line 678 "wcspih.l" case 76: YY_RULE_SETUP #line 678 "wcspih.l" { /* Invalid parameters will be caught by . */ sscanf(wcspihtext, "%d_%d", &i, &m); BEGIN(VALUE); } YY_BREAK case 77: YY_RULE_SETUP #line 684 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 78: YY_RULE_SETUP #line 688 "wcspih.l" { if (relax & WCSHDR_PROJPn) { sscanf(wcspihtext, "%d", &m); i = 0; a = ' '; idx = -1; BEGIN(VALUE); } else if (relax & WCSHDR_reject) { errmsg = "Defunct PROJPn keyword rejected"; BEGIN(ERROR); } else { BEGIN(DISCARD); } } YY_BREAK case 79: YY_RULE_SETUP #line 705 "wcspih.l" { BEGIN(DISCARD); } YY_BREAK case 80: YY_RULE_SETUP #line 709 "wcspih.l" { /* Do checks on i, j & m. */ if (i > 99 || j > 99 || m > 99) { if (relax & WCSHDR_reject) { errmsg = errtxt; if (i > 99 || j > 99) { sprintf(errmsg, "Axis number exceeds 99"); } else if (m > 99) { sprintf(errmsg, "Parameter number exceeds 99"); } BEGIN(ERROR); } else { /* Pretend we don't recognize it. */ BEGIN(DISCARD); } } else { if (valtype == INTEGER) { BEGIN(INTEGER_VAL); } else if (valtype == FLOAT) { BEGIN(FLOAT_VAL); } else if (valtype == STRING) { BEGIN(STRING_VAL); } else { errmsg = errtxt; sprintf(errmsg, "Internal parser ERROR, bad data type: %d", valtype); BEGIN(ERROR); } } } YY_BREAK case 81: YY_RULE_SETUP #line 742 "wcspih.l" { errmsg = "Invalid KEYWORD = VALUE syntax"; BEGIN(ERROR); } YY_BREAK case 82: YY_RULE_SETUP #line 747 "wcspih.l" { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords that apply */ /* to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((int **)wptr) + idx; } /* Read the keyvalue. */ sscanf(wcspihtext, "%d", (int *)wptr); if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null int pointer"; BEGIN(ERROR); } } } YY_BREAK case 83: YY_RULE_SETUP #line 788 "wcspih.l" { errmsg = "An integer value was expected"; BEGIN(ERROR); } YY_BREAK case 84: YY_RULE_SETUP #line 793 "wcspih.l" { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords like MJD-OBS that */ /* apply to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((double **)wptr) + idx; } else if (npptr == npv) { ipx = (*wcs+ialt)->npv++; (*wcs+ialt)->pv[ipx].i = i; (*wcs+ialt)->pv[ipx].m = m; wptr = &((*wcs+ialt)->pv[ipx].value); } /* Read the keyvalue. */ wcsutil_str2double(wcspihtext, "%lf", (double *)wptr); /* Flag the presence of PCi_ja, or CDi_ja and/or CROTAia. */ if (altlin) { (*wcs+ialt)->altlin |= altlin; altlin = 0; } if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null float pointer"; BEGIN(ERROR); } } } YY_BREAK case 85: YY_RULE_SETUP #line 846 "wcspih.l" { errmsg = "A floating-point value was expected"; BEGIN(ERROR); } YY_BREAK case 86: /* rule 86 can match eol */ YY_RULE_SETUP #line 851 "wcspih.l" { if (pass == 1) { wcspih_naxes(naxis, i, j, a, alts, npptr); BEGIN(FLUSH); } else { if (vptr) { /* Determine the coordinate representation. */ for (ialt = 0; ialt < *nwcs; ialt++) { /* The loop here is for keywords like DATE-OBS that */ /* apply to every alternate; these have a == 0. */ if (a >= 'A') { ialt = alts[a-'A'+1]; } wptr = vptr; if (ialt) { voff = (char *)(*wcs+ialt) - (char *)(*wcs); wptr = (void *)((char *)vptr + voff); } /* Apply keyword parameterization. */ if (idx >= 0) { wptr = *((char (**)[72])wptr) + idx; } else if (npptr == nps) { ipx = (*wcs+ialt)->nps++; (*wcs+ialt)->ps[ipx].i = i; (*wcs+ialt)->ps[ipx].m = m; wptr = (*wcs+ialt)->ps[ipx].value; } /* Read the keyvalue. */ cptr = (char *)wptr; strcpy(cptr, wcspihtext+1); /* Squeeze out repeated quotes. */ ix = 0; for (jx = 0; jx < 72; jx++) { if (ix < jx) { cptr[ix] = cptr[jx]; } if (cptr[jx] == '\0') { if (ix) cptr[ix-1] = '\0'; break; } else if (cptr[jx] == '\'' && cptr[jx+1] == '\'') { jx++; } ix++; } if (a) break; } BEGIN(COMMENT); } else { errmsg = "Internal parser ERROR, null string pointer"; BEGIN(ERROR); } } } YY_BREAK case 87: YY_RULE_SETUP #line 916 "wcspih.l" { errmsg = "A string value was expected"; BEGIN(ERROR); } YY_BREAK case 88: #line 922 "wcspih.l" case 89: YY_RULE_SETUP #line 922 "wcspih.l" { BEGIN(FLUSH); } YY_BREAK case 90: YY_RULE_SETUP #line 926 "wcspih.l" { errmsg = "Malformed keycomment"; BEGIN(ERROR); } YY_BREAK case 91: YY_RULE_SETUP #line 931 "wcspih.l" { if (pass == 2) { if (ctrl < 0) { /* Preserve discards. */ keep = wcspih_hdr - 80; } else if (ctrl > 2) { wcsfprintf(stderr, "%.80s\n Discarded.\n", wcspih_hdr-80); } } BEGIN(FLUSH); } YY_BREAK case 92: YY_RULE_SETUP #line 944 "wcspih.l" { (*nreject)++; if (pass == 2) { if (ctrl%10 == -1) { /* Preserve rejects. */ keep = wcspih_hdr - 80; } if (abs(ctrl%10) > 1) { wcsfprintf(stderr, "%.80s\n%4d: %s.\n", wcspih_hdr-80, *nreject, errmsg); } } BEGIN(FLUSH); } YY_BREAK case 93: /* rule 93 can match eol */ YY_RULE_SETUP #line 960 "wcspih.l" { if (pass == 2 && keep) { if (hptr < keep) { strncpy(hptr, keep, 80); } hptr += 80; } i = j = m = 0; a = ' '; valtype = -1; keep = 0x0; altlin = 0; npptr = 0x0; BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(CROTAi): case YY_STATE_EOF(PROJPn): case YY_STATE_EOF(CCCCCia): case YY_STATE_EOF(CCi_ja): case YY_STATE_EOF(CCi_ma): case YY_STATE_EOF(CCCCCCCa): case YY_STATE_EOF(CCCCCCCC): case YY_STATE_EOF(VALUE): case YY_STATE_EOF(INTEGER_VAL): case YY_STATE_EOF(FLOAT_VAL): case YY_STATE_EOF(STRING_VAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(DISCARD): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): #line 977 "wcspih.l" { /* End-of-input. */ if (pass == 1) { if ((status = wcspih_inits(naxis, alts, npv, nps, nwcs, wcs)) || *nwcs == 0) { wcspihlex_destroy(); return status; } if (abs(ctrl%10) > 2) { if (*nwcs == 1) { if (strcmp(wcs[0]->wcsname, "DEFAULTS") != 0) { wcsfprintf(stderr, "Found one coordinate representation.\n"); } } else { wcsfprintf(stderr, "Found %d coordinate representations.\n", *nwcs); } } wcspih_hdr = header; wcspih_nkeyrec = nkeyrec; *nreject = 0; pass = 2; i = j = m = 0; a = ' '; valtype = -1; wcspihrestart(wcspihin); } else { wcspihlex_destroy(); if (ctrl < 0) { *hptr = '\0'; } else if (ctrl == 1) { wcsfprintf(stderr, "%d WCS keyrecords were rejected.\n", *nreject); } return wcspih_final(alts, epoch, vsource, nwcs, wcs); } } YY_BREAK case 94: YY_RULE_SETUP #line 1022 "wcspih.l" ECHO; YY_BREAK #line 9679 "wcspih.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed wcspihin at a new source and called * wcspihlex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = wcspihin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( wcspihwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * wcspihtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of wcspihlex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ wcspihrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; wcspihrestart(wcspihin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcspihrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { if ( *yy_cp ) { yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; } else yy_current_state = yy_NUL_trans[yy_current_state]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); if ( ! yy_is_jam ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up wcspihtext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ wcspihrestart(wcspihin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( wcspihwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve wcspihtext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void wcspihrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ wcspihensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcspih_create_buffer(wcspihin,YY_BUF_SIZE ); } wcspih_init_buffer(YY_CURRENT_BUFFER,input_file ); wcspih_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void wcspih_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * wcspihpop_buffer_state(); * wcspihpush_buffer_state(new_buffer); */ wcspihensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; wcspih_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (wcspihwrap()) processing, but the only time this flag * is looked at is after wcspihwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void wcspih_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; wcspihin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE wcspih_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) wcspihalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcspih_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) wcspihalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in wcspih_create_buffer()" ); b->yy_is_our_buffer = 1; wcspih_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with wcspih_create_buffer() * */ void wcspih_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) wcspihfree((void *) b->yy_ch_buf ); wcspihfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a wcspihrestart() or at EOF. */ static void wcspih_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; wcspih_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then wcspih_init_buffer was _probably_ * called from wcspihrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void wcspih_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) wcspih_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void wcspihpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; wcspihensure_buffer_stack(); /* This block is copied from wcspih_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from wcspih_switch_to_buffer. */ wcspih_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void wcspihpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; wcspih_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { wcspih_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void wcspihensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)wcspihalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcspihensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)wcspihrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcspihensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcspih_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) wcspihalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcspih_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; wcspih_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to wcspihlex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * wcspih_scan_bytes() instead. */ YY_BUFFER_STATE wcspih_scan_string (yyconst char * yystr ) { return wcspih_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to wcspihlex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcspih_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) wcspihalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in wcspih_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = wcspih_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in wcspih_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up wcspihtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ wcspihtext[wcspihleng] = (yy_hold_char); \ (yy_c_buf_p) = wcspihtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ wcspihleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int wcspihget_lineno (void) { return wcspihlineno; } /** Get the input stream. * */ FILE *wcspihget_in (void) { return wcspihin; } /** Get the output stream. * */ FILE *wcspihget_out (void) { return wcspihout; } /** Get the length of the current token. * */ int wcspihget_leng (void) { return wcspihleng; } /** Get the current token. * */ char *wcspihget_text (void) { return wcspihtext; } /** Set the current line number. * @param line_number * */ void wcspihset_lineno (int line_number ) { wcspihlineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see wcspih_switch_to_buffer */ void wcspihset_in (FILE * in_str ) { wcspihin = in_str ; } void wcspihset_out (FILE * out_str ) { wcspihout = out_str ; } int wcspihget_debug (void) { return wcspih_flex_debug; } void wcspihset_debug (int bdebug ) { wcspih_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from wcspihlex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT wcspihin = stdin; wcspihout = stdout; #else wcspihin = (FILE *) 0; wcspihout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * wcspihlex_init() */ return 0; } /* wcspihlex_destroy is for both reentrant and non-reentrant scanners. */ int wcspihlex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ wcspih_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; wcspihpop_buffer_state(); } /* Destroy the stack itself. */ wcspihfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * wcspihlex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *wcspihalloc (yy_size_t size ) { return (void *) malloc( size ); } void *wcspihrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void wcspihfree (void * ptr ) { free( (char *) ptr ); /* see wcspihrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 1022 "wcspih.l" /*---------------------------------------------------------------------------- * Determine the number of coordinate representations (up to 27) and the * number of coordinate axes in each, and count the number of PVi_ma and * PSi_ma keywords in each representation. *---------------------------------------------------------------------------*/ void wcspih_naxes(int naxis, int i, int j, char a, int alts[], int *npptr) { /* On the first pass alts[] is used to determine the number of axes */ /* for each of the 27 possible alternate coordinate descriptions. */ int ialt, *ip; if (a == 0) { return; } ialt = 0; if (a != ' ') { ialt = a - 'A' + 1; } ip = alts + ialt; if (*ip < naxis) { *ip = naxis; } /* i or j can be greater than naxis. */ if (*ip < i) { *ip = i; } if (*ip < j) { *ip = j; } if (npptr) { npptr[ialt]++; } } /*---------------------------------------------------------------------------- * Allocate memory for an array of the required number of wcsprm structs and * initialize each of them. *---------------------------------------------------------------------------*/ int wcspih_inits( int naxis, int alts[], int npv[], int nps[], int *nwcs, struct wcsprm **wcs) { int ialt, defaults, npsmax, npvmax, status = 0; struct wcsprm *wcsp; /* Find the number of coordinate descriptions. */ *nwcs = 0; for (ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) (*nwcs)++; } if ((defaults = !(*nwcs) && naxis)) { /* NAXIS is non-zero but there were no WCS keywords with an alternate version code; create a default WCS with blank alternate version. */ wcspih_naxes(naxis, 0, 0, ' ', alts, 0x0); *nwcs = 1; } if (*nwcs) { /* Allocate memory for the required number of wcsprm structs. */ if (!(*wcs = calloc(*nwcs, sizeof(struct wcsprm)))) { return 2; } /* Record the current values of NPVMAX and NPSMAX. */ npvmax = wcsnpv(-1); npsmax = wcsnps(-1); /* Initialize each wcsprm struct. */ wcsp = *wcs; *nwcs = 0; for (ialt = 0; ialt < 27; ialt++) { if (alts[ialt]) { wcsp->flag = -1; wcsnpv(npv[ialt]); wcsnps(nps[ialt]); if ((status = wcsini(1, alts[ialt], wcsp))) { wcsvfree(nwcs, wcs); break; } /* Record the alternate version code. */ if (ialt) { wcsp->alt[0] = 'A' + ialt - 1; } /* Record in wcsname whether this is a default description. */ if (defaults) { strcpy(wcsp->wcsname, "DEFAULTS"); } /* On the second pass alts[] indexes the array of wcsprm structs. */ alts[ialt] = (*nwcs)++; wcsp++; } } /* Restore the original values of NPVMAX and NPSMAX. */ wcsnpv(npvmax); wcsnps(npsmax); } return status; } /*---------------------------------------------------------------------------- * Interpret special keywords encountered for each coordinate representation. *---------------------------------------------------------------------------*/ int wcspih_final( int alts[], double epoch[], double vsource[], int *nwcs, struct wcsprm **wcs) { int ialt, status; double beta, c = 299792458.0; for (ialt = 0; ialt < *nwcs; ialt++) { /* Check for EPOCH overriding EQUINOXa. */ if (undefined((*wcs+ialt)->equinox) && !undefined(epoch[ialt])) { /* Set EQUINOXa. */ (*wcs+ialt)->equinox = epoch[ialt]; } /* Check for VSOURCEa overriding ZSOURCEa. */ if (undefined((*wcs+ialt)->zsource) && !undefined(vsource[ialt])) { /* Convert relativistic Doppler velocity to redshift. */ beta = vsource[ialt]/c; (*wcs+ialt)->zsource = (1.0+beta)/sqrt(1.0 - beta*beta) - 1.0; } /* Interpret -TAB header keywords. */ if ((status = wcstab(*wcs+ialt))) { wcsvfree(nwcs, wcs); return status; } } return 0; } astropy-0.3/cextern/wcslib/C/flexed/fitshdr.c0000644000175000017500000201236012243255342017376 0ustar oleole#line 2 "fitshdr.c" #line 4 "fitshdr.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer fitshdr_create_buffer #define yy_delete_buffer fitshdr_delete_buffer #define yy_flex_debug fitshdr_flex_debug #define yy_init_buffer fitshdr_init_buffer #define yy_flush_buffer fitshdr_flush_buffer #define yy_load_buffer_state fitshdr_load_buffer_state #define yy_switch_to_buffer fitshdr_switch_to_buffer #define yyin fitshdrin #define yyleng fitshdrleng #define yylex fitshdrlex #define yylineno fitshdrlineno #define yyout fitshdrout #define yyrestart fitshdrrestart #define yytext fitshdrtext #define yywrap fitshdrwrap #define yyalloc fitshdralloc #define yyrealloc fitshdrrealloc #define yyfree fitshdrfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE fitshdrrestart(fitshdrin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int fitshdrleng; extern FILE *fitshdrin, *fitshdrout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up fitshdrtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up fitshdrtext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via fitshdrrestart()), so that the user can continue scanning by * just pointing fitshdrin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when fitshdrtext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int fitshdrleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow fitshdrwrap()'s to do buffer switches * instead of setting up a fresh fitshdrin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void fitshdrrestart (FILE *input_file ); void fitshdr_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE fitshdr_create_buffer (FILE *file,int size ); void fitshdr_delete_buffer (YY_BUFFER_STATE b ); void fitshdr_flush_buffer (YY_BUFFER_STATE b ); void fitshdrpush_buffer_state (YY_BUFFER_STATE new_buffer ); void fitshdrpop_buffer_state (void ); static void fitshdrensure_buffer_stack (void ); static void fitshdr_load_buffer_state (void ); static void fitshdr_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER fitshdr_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE fitshdr_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE fitshdr_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE fitshdr_scan_bytes (yyconst char *bytes,int len ); void *fitshdralloc (yy_size_t ); void *fitshdrrealloc (void *,yy_size_t ); void fitshdrfree (void * ); #define yy_new_buffer fitshdr_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ fitshdrensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ fitshdrensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define fitshdrwrap(n) 1 #define YY_SKIP_YYWRAP typedef char YY_CHAR; FILE *fitshdrin = (FILE *) 0, *fitshdrout = (FILE *) 0; typedef int yy_state_type; extern int fitshdrlineno; int fitshdrlineno = 1; extern char *fitshdrtext; #define yytext_ptr fitshdrtext static yyconst flex_int16_t yy_nxt[][128] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }, { 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 17, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 17, 19, 19, 20, 19, 21, 19, 19, 22, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 19, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 }, { 15, 23, 23, 23, 23, 23, 23, 23, 23, 23, 16, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 23, 23, 23, 23, 23, 23, 25, 26, 23, 23, 27, 23, 27, 28, 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 32, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 32, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 }, { 15, 23, 23, 23, 23, 23, 23, 23, 23, 23, 16, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 23, 23, 23, 23, 23, 23, 25, 26, 23, 23, 27, 23, 27, 28, 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 32, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 32, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 }, { 15, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 35, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 36, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 }, { 15, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 35, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 36, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 }, { 15, 37, 37, 37, 37, 37, 37, 37, 37, 37, 16, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37 }, { 15, 37, 37, 37, 37, 37, 37, 37, 37, 37, 16, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37 }, { 15, 39, 39, 39, 39, 39, 39, 39, 39, 39, 16, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39 }, { 15, 39, 39, 39, 39, 39, 39, 39, 39, 39, 16, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39 }, { 15, 40, 40, 40, 40, 40, 40, 40, 40, 40, 16, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 }, { 15, 40, 40, 40, 40, 40, 40, 40, 40, 40, 16, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 }, { 15, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41 }, { 15, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41 }, { -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15 }, { 15, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -17, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -18, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -19, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 46, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 43, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -20, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 46, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 43, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -21, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 46, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 43, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 48, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, 43, 43, 43, 43, 43, 43, 43, 43, 43, -22, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 45, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 46, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 43, 43, 43, 46, 46, 46, 46, 46, 46, 46, 46, 49, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 43, 43, 43, 43, 46, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43 }, { 15, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23 }, { 15, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, 50, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, 51, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24 }, { 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52 }, { 15, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 54, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 55, -26, 55, 56, -26, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26 }, { 15, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 58, -27, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27 }, { 15, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28 }, { 15, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29 }, { 15, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 62, -30, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 65, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 65, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30 }, { 15, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 62, -31, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 65, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 65, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31 }, { 15, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32 }, { 15, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33 }, { 15, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34 }, { 15, -35, -35, -35, -35, -35, -35, -35, -35, -35, 67, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, 68, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, 69, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 }, { 15, -36, -36, -36, -36, -36, -36, -36, -36, -36, 70, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, 71, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 }, { 15, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37 }, { 15, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, 72, -38, -38, -38, -38, -38, -38, -38, 72, 72, 72, 72, -38, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -38, -38, -38, -38, -38, -38, -38, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -38, -38, -38, 72, -38, -38, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -38, -38, -38, -38, -38 }, { 15, 73, 73, 73, 73, 73, 73, 73, 73, 73, -39, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 15, 74, 74, 74, 74, 74, 74, 74, 74, 74, -40, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74 }, { 15, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 }, { 15, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -43, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -44, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -45, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 79, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -46, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 80, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 81, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 77, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 81, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -47, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 80, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 81, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 77, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, 83, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 81, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -48, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 80, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 81, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 77, 77, 77, 81, 81, 81, 84, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 81, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, 77, 77, 77, 77, 77, 77, 77, 77, 77, -49, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 80, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 81, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 77, 77, 77, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 85, 81, 81, 81, 81, 81, 81, 81, 77, 77, 77, 77, 81, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 }, { 15, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 51, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50 }, { 15, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51 }, { 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52 }, { 15, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 52, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53 }, { 15, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 55, -54, 55, 56, -54, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54 }, { 15, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 56, -55, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55 }, { 15, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56 }, { 15, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 87, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 88, -57, 89, -57, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 91, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, 91, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57 }, { 15, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58 }, { 15, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 62, -59, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 65, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, 65, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59 }, { 15, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 62, -60, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 65, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, 65, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60 }, { 15, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 65, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, 65, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61 }, { 15, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 65, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, 65, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62 }, { 15, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 62, -63, 93, 94, 94, 94, 94, 94, 94, 94, 94, 94, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 65, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, 65, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63 }, { 15, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 62, -64, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 65, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, 65, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64 }, { 15, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, 96, -65, 96, -65, -65, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65 }, { 15, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, 62, -66, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, 65, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, 65, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66 }, { 15, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 }, { 15, -68, -68, -68, -68, -68, -68, -68, -68, -68, 67, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, 68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, 69, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68 }, { 15, -69, -69, -69, -69, -69, -69, -69, -69, -69, 70, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, 71, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69 }, { 15, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 }, { 15, -71, -71, -71, -71, -71, -71, -71, -71, -71, 70, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, 71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71 }, { 15, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, 72, -72, -72, -72, -72, -72, -72, -72, 72, 72, 72, 72, -72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -72, -72, -72, -72, -72, -72, -72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -72, -72, 99, 72, -72, -72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, -72, -72, -72, -72, -72 }, { 15, 73, 73, 73, 73, 73, 73, 73, 73, 73, -73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, 73 }, { 15, 74, 74, 74, 74, 74, 74, 74, 74, 74, -74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74 }, { 15, 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75 }, { 15, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -77, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -78, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -79, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 102, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -80, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 103, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -81, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 104, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 105, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -82, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 104, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 105, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -83, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 104, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 105, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 107, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -84, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 108, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 105, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, 100, 100, 100, 100, 100, 100, 100, 100, 100, -85, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 104, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 105, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 100, 100, 100, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 109, 105, 105, 105, 105, 105, 105, 100, 100, 100, 100, 105, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, { 15, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 110, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 111, -86, -86, -86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 91, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, 91, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86 }, { 15, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, 87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, 88, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87 }, { 15, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 112, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 113, -88, 113, 114, -88, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88 }, { 15, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 110, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 111, -89, -89, -89, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 91, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, 91, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89 }, { 15, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 87, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 88, -90, 89, -90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 91, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, 91, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90 }, { 15, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 117, -91, 117, -91, -91, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91 }, { 15, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 65, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 65, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92 }, { 15, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 62, -93, 119, 120, 120, 120, 120, 120, 120, 120, 120, 120, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 65, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 65, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93 }, { 15, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 62, -94, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 65, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 65, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 }, { 15, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 62, -95, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 65, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, 65, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 }, { 15, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96 }, { 15, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97 }, { 15, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 62, -98, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 65, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 65, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98 }, { 15, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -100, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -101, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -102, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 126, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -103, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 127, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -104, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 128, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -105, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 129, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 130, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 124, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 130, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -106, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 129, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 130, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 124, 124, 124, 130, 130, 130, 130, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 130, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -107, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 129, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 130, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 124, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 132, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 130, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -108, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 133, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, 124, 124, 124, 124, 124, 124, 124, 124, 124, -109, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 129, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 130, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 124, 124, 124, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 134, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 124, 124, 124, 124, 130, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 }, { 15, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, 111, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110 }, { 15, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 135, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 136, -111, 136, 114, -111, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111 }, { 15, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 113, -112, 113, 114, -112, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 }, { 15, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, 114, -113, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113 }, { 15, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114 }, { 15, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 139, -115, -115, -115, -115, -115, -115, -115, -115, 140, -115, -115, -115, -115, 141, -115, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 143, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 143, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115 }, { 15, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 110, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 111, -116, -116, -116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 91, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 91, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116 }, { 15, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117 }, { 15, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 110, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 111, -118, -118, -118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 }, { 15, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 62, -119, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 65, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 65, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119 }, { 15, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 62, -120, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 65, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 65, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120 }, { 15, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 62, -121, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 65, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, 65, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 }, { 15, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 62, -122, 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 65, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, 65, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122 }, { 15, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 62, -123, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 65, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, 65, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123, -123 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -124, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -125, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -126, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 152, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -127, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 153, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -128, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 154, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -129, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 155, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -130, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 156, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 157, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 150, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 157, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -131, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 156, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 157, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 150, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 158, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 157, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -132, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 156, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 157, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 150, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 159, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 157, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -133, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 160, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, 150, 150, 150, 150, 150, 150, 150, 150, 150, -134, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 156, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 157, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 150, 150, 150, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 157, 161, 157, 157, 157, 157, 157, 157, 157, 157, 150, 150, 150, 150, 157, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 }, { 15, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 136, -135, 136, 114, -135, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135 }, { 15, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, 114, -136, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136 }, { 15, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 162, -137, -137, -137, -137, -137, -137, -137, -137, 163, -137, -137, -137, -137, 141, -137, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 143, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, 143, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137 }, { 15, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 162, -138, -138, -138, -138, -138, -138, -138, -138, 163, -138, -138, -138, -138, -138, -138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 143, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 143, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138 }, { 15, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, 139, -139, -139, -139, -139, -139, -139, -139, -139, 140, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139 }, { 15, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140 }, { 15, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 162, -141, -141, -141, -141, -141, -141, -141, -141, 163, -141, -141, -141, -141, -141, -141, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 143, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 143, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141 }, { 15, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 139, -142, -142, -142, -142, -142, -142, -142, -142, 140, -142, -142, -142, -142, 141, -142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 143, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 143, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142 }, { 15, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, 166, -143, 166, -143, -143, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143 }, { 15, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 62, -144, 168, 169, 169, 169, 169, 169, 169, 169, 169, 169, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 65, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 65, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144 }, { 15, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 62, -145, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 65, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 65, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145 }, { 15, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 62, -146, 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 65, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 65, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146 }, { 15, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, 62, -147, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, 65, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, 65, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147 }, { 15, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 62, -148, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 65, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, 65, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148 }, { 15, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 62, -149, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 65, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 65, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -150, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -151, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -152, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 177, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -153, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 178, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -154, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 179, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -155, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 180, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -156, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 181, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -157, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 182, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 183, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 175, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 183, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -158, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 182, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 183, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 175, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 183, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -159, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 182, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 183, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 175, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 185, 183, 183, 183, 183, 183, 175, 175, 175, 175, 183, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -160, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 186, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, 175, 175, 175, 175, 175, 175, 175, 175, 175, -161, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 182, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 183, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 175, 175, 175, 175, 175, 175, 175, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 184, 183, 175, 175, 175, 175, 183, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175 }, { 15, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, 162, -162, -162, -162, -162, -162, -162, -162, -162, 163, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162 }, { 15, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163 }, { 15, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 162, -164, -164, -164, -164, -164, -164, -164, -164, 163, -164, -164, -164, -164, 141, -164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 143, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 143, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164 }, { 15, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 162, -165, -165, -165, -165, -165, -165, -165, -165, 163, -165, -165, -165, -165, -165, -165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 143, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 143, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165 }, { 15, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166 }, { 15, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, 162, -167, -167, -167, -167, -167, -167, -167, -167, 163, -167, -167, -167, -167, -167, -167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167 }, { 15, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 62, -168, 187, 188, 188, 188, 188, 188, 188, 188, 188, 188, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 65, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 65, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168 }, { 15, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 62, -169, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 65, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 65, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169 }, { 15, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 62, -170, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 65, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 65, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170 }, { 15, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 62, -171, 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 65, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 65, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171 }, { 15, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 62, -172, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 65, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 65, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172 }, { 15, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 62, -173, 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 65, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 65, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173 }, { 15, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 62, -174, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 65, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 65, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -175, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -176, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -177, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -178, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -179, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -180, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -181, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -182, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -183, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 198, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 195, 195, 195, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -184, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 198, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 195, 195, 195, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -185, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 198, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 197, 195, 195, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 195, 195, 195, 197, 197, 197, 197, 199, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 195, 195, 195, 195, 197, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, 195, 195, 195, 195, 195, 195, 195, 195, 195, -186, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 200, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195 }, { 15, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 62, -187, 201, 202, 202, 202, 202, 202, 202, 202, 202, 202, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 65, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, 65, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187 }, { 15, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 62, -188, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 65, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 65, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188 }, { 15, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 62, -189, 204, 204, 204, 204, 204, 204, 204, 204, 204, 204, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 65, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 65, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189 }, { 15, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 62, -190, 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 65, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, 65, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190 }, { 15, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 62, -191, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 65, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, 65, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191 }, { 15, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 62, -192, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 65, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 65, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192 }, { 15, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 62, -193, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 65, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, 65, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193 }, { 15, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 62, -194, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 65, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, 65, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194 }, { 15, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 210, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195 }, { 15, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, 211, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, 210, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196 }, { 15, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, 212, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197 }, { 15, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 212, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198 }, { 15, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 213, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 212, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199 }, { 15, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 214, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 215, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200 }, { 15, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 62, -201, 216, 217, 217, 217, 217, 217, 217, 217, 217, 217, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 65, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 65, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201 }, { 15, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 62, -202, 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 65, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, 65, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202 }, { 15, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 62, -203, 219, 219, 219, 219, 219, 219, 219, 219, 219, 219, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 65, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 65, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203 }, { 15, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 62, -204, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 65, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 65, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204 }, { 15, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, 62, -205, 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, 65, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, 65, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205 }, { 15, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 62, -206, 222, 222, 222, 222, 222, 222, 222, 222, 222, 222, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 65, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 65, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206 }, { 15, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 62, -207, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 65, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, 65, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207 }, { 15, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 62, -208, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 65, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 65, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208 }, { 15, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 62, -209, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 65, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, 65, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209 }, { 15, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, 226, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210 }, { 15, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 227, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211 }, { 15, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 228, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212 }, { 15, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, 229, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213 }, { 15, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, 230, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214 }, { 15, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, 231, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215 }, { 15, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 62, -216, 232, 233, 233, 233, 233, 233, 233, 233, 233, 233, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 65, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 65, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216 }, { 15, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 62, -217, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 65, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 65, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217 }, { 15, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 62, -218, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 65, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 65, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218 }, { 15, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 62, -219, 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 65, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 65, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219 }, { 15, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 62, -220, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 65, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, 65, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220 }, { 15, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 62, -221, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 65, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 65, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221 }, { 15, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, 62, -222, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, 65, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, 65, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222 }, { 15, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 62, -223, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 65, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 65, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223 }, { 15, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 62, -224, 241, 241, 241, 241, 241, 241, 241, 241, 241, 241, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 65, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 65, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224 }, { 15, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, 62, -225, 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, 65, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, 65, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225 }, { 15, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, 226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226 }, { 15, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, 243, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227 }, { 15, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, 228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228 }, { 15, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, 213, -229, -229, -229, -229, -229, -229, 244, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229 }, { 15, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, 245, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230 }, { 15, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, 231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231 }, { 15, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 62, -232, 246, 247, 247, 247, 247, 247, 247, 247, 247, 247, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 65, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 65, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232 }, { 15, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 62, -233, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 65, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 65, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233 }, { 15, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 62, -234, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 65, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 65, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234 }, { 15, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 62, -235, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 65, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 65, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235 }, { 15, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 62, -236, 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 65, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 65, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236 }, { 15, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 62, -237, 252, 252, 252, 252, 252, 252, 252, 252, 252, 252, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 65, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 65, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237 }, { 15, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 62, -238, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 65, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 65, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238 }, { 15, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 62, -239, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 65, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 65, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239 }, { 15, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, 62, -240, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, 65, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, 65, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240, -240 }, { 15, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, 62, -241, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, 65, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, 65, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241 }, { 15, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 62, -242, 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 65, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 65, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242 }, { 15, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 258, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243 }, { 15, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 260, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259 }, { 15, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 261, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245 }, { 15, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 62, -246, 262, 263, 263, 263, 263, 263, 263, 263, 263, 263, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 65, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 65, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246 }, { 15, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, 62, -247, 264, 264, 264, 264, 264, 264, 264, 264, 264, 264, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, 65, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, 65, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247 }, { 15, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 62, -248, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 65, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 65, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248 }, { 15, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 62, -249, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 65, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 65, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249 }, { 15, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, 62, -250, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, 65, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, 65, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250 }, { 15, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, 62, -251, 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, 65, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, 65, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251 }, { 15, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, 62, -252, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, 65, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, 65, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252 }, { 15, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, 62, -253, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, 65, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, 65, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253 }, { 15, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, 62, -254, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, 65, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, 65, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254 }, { 15, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 62, -255, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 65, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 65, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255 }, { 15, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 62, -256, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 65, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 65, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256 }, { 15, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 62, -257, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 65, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 65, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257 }, { 15, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, 275, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258 }, { 15, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 260, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259 }, { 15, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 259, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260 }, { 15, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, 276, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261 }, { 15, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 62, -262, 277, 278, 278, 278, 278, 278, 278, 278, 278, 278, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 65, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 65, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262 }, { 15, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 62, -263, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 65, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 65, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263 }, { 15, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, 62, -264, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, 65, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, 65, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264 }, { 15, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 62, -265, 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 65, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 65, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265 }, { 15, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 62, -266, 282, 282, 282, 282, 282, 282, 282, 282, 282, 282, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 65, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 65, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266 }, { 15, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 62, -267, 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 65, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 65, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267 }, { 15, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 62, -268, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 65, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, 65, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268 }, { 15, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 62, -269, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 65, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, 65, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269 }, { 15, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, 62, -270, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, 65, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, 65, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270 }, { 15, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 62, -271, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 65, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 65, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271 }, { 15, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 62, -272, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 65, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 65, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272 }, { 15, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 62, -273, 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 65, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 65, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273 }, { 15, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, 62, -274, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, 65, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, 65, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274 }, { 15, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, 291, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275 }, { 15, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 292, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276 }, { 15, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 62, -277, 293, 294, 294, 294, 294, 294, 294, 294, 294, 294, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 65, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 65, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277 }, { 15, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, 62, -278, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, 65, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, 65, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278 }, { 15, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, 62, -279, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, 65, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, 65, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279 }, { 15, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, 62, -280, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, 65, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, 65, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280 }, { 15, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, 62, -281, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, 65, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, 65, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281 }, { 15, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 62, -282, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 65, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 65, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282 }, { 15, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 62, -283, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 65, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, 65, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283 }, { 15, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, 62, -284, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, 65, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, 65, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284 }, { 15, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 62, -285, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 65, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 65, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285 }, { 15, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 62, -286, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 65, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 65, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286 }, { 15, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, 62, -287, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, 65, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, 65, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287 }, { 15, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 62, -288, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 65, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 65, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288 }, { 15, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 62, -289, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 65, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 65, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289 }, { 15, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 62, -290, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 65, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 65, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290 }, { 15, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, 308, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291 }, { 15, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, 309, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292 }, { 15, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 62, -293, 310, 311, 311, 311, 311, 311, 311, 311, 311, 311, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 65, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 65, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293 }, { 15, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 62, -294, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 65, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 65, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294 }, { 15, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 62, -295, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 65, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 65, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295 }, { 15, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 62, -296, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 65, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, 65, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296 }, { 15, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, 62, -297, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, 65, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, 65, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297 }, { 15, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, 62, -298, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, 65, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, 65, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298 }, { 15, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, 62, -299, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, 65, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, 65, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299 }, { 15, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, 62, -300, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, 65, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, 65, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300 }, { 15, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, 62, -301, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, 65, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, 65, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301 }, { 15, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, 62, -302, 320, 320, 320, 320, 320, 320, 320, 320, 320, 320, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, 65, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, 65, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302 }, { 15, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, 62, -303, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, 65, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, 65, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303 }, { 15, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, 62, -304, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, 65, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, 65, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304 }, { 15, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, 62, -305, 323, 323, 323, 323, 323, 323, 323, 323, 323, 323, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, 65, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, 65, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305 }, { 15, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 62, -306, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 65, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 65, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306 }, { 15, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, 62, -307, 325, 325, 325, 325, 325, 325, 325, 325, 325, 325, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, 65, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, 65, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307 }, { 15, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, 326, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308 }, { 15, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, 327, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309 }, { 15, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 62, -310, 328, 329, 329, 329, 329, 329, 329, 329, 329, 329, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 65, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 65, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310 }, { 15, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, 62, -311, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, 65, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, 65, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311 }, { 15, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, 62, -312, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, 65, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, 65, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312 }, { 15, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, 62, -313, 332, 332, 332, 332, 332, 332, 332, 332, 332, 332, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, 65, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, 65, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313 }, { 15, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, 62, -314, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, 65, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, 65, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314 }, { 15, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, 62, -315, 334, 334, 334, 334, 334, 334, 334, 334, 334, 334, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, 65, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, 65, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315 }, { 15, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, 62, -316, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, 65, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, 65, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316 }, { 15, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 62, -317, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 65, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 65, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317 }, { 15, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, 62, -318, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, 65, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, 65, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318 }, { 15, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, 62, -319, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, 65, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, 65, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319 }, { 15, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, 62, -320, 339, 339, 339, 339, 339, 339, 339, 339, 339, 339, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, 65, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, 65, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320 }, { 15, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, 62, -321, 340, 340, 340, 340, 340, 340, 340, 340, 340, 340, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, 65, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, 65, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321 }, { 15, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, 62, -322, 341, 341, 341, 341, 341, 341, 341, 341, 341, 341, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, 65, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, 65, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322 }, { 15, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, 62, -323, 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, 65, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, 65, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323 }, { 15, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, 62, -324, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, 65, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, 65, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324 }, { 15, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 62, -325, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 65, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 65, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325 }, { 15, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, 345, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326 }, { 15, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, 346, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327 }, { 15, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, 62, -328, 347, 348, 348, 348, 348, 348, 348, 348, 348, 348, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, 65, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, 65, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328 }, { 15, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, 62, -329, 349, 349, 349, 349, 349, 349, 349, 349, 349, 349, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, 65, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, 65, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329 }, { 15, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, 62, -330, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, 65, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, 65, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330 }, { 15, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 62, -331, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 65, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 65, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331 }, { 15, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 62, -332, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 65, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 65, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332 }, { 15, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, 62, -333, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, 65, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, 65, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333 }, { 15, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 62, -334, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 65, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 65, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334 }, { 15, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, 62, -335, 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, 65, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, 65, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335 }, { 15, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, 62, -336, 356, 356, 356, 356, 356, 356, 356, 356, 356, 356, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, 65, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, 65, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336 }, { 15, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 62, -337, 357, 357, 357, 357, 357, 357, 357, 357, 357, 357, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 65, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 65, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337 }, { 15, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 62, -338, 358, 358, 358, 358, 358, 358, 358, 358, 358, 358, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 65, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 65, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338 }, { 15, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 62, -339, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 65, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 65, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339 }, { 15, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 62, -340, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 65, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 65, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340 }, { 15, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 62, -341, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 65, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, 65, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341 }, { 15, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, 62, -342, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, 65, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, 65, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342 }, { 15, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 62, -343, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 65, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 65, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343 }, { 15, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, 62, -344, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, 65, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, 65, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344 }, { 15, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, 365, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345 }, { 15, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, 366, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346 }, { 15, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, 62, -347, 367, 368, 368, 368, 368, 368, 368, 368, 368, 368, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, 65, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, 65, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347 }, { 15, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, 62, -348, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, 65, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, 65, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348 }, { 15, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, 62, -349, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, 65, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, 65, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349 }, { 15, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, 62, -350, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, 65, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, 65, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350 }, { 15, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, 62, -351, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, 65, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, 65, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351 }, { 15, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, 62, -352, 373, 373, 373, 373, 373, 373, 373, 373, 373, 373, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, 65, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, 65, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352 }, { 15, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, 62, -353, 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, 65, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, 65, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353 }, { 15, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, 62, -354, 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, 65, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, 65, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354 }, { 15, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, 62, -355, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, 65, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, 65, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355 }, { 15, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, 62, -356, 377, 377, 377, 377, 377, 377, 377, 377, 377, 377, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, 65, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, 65, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356 }, { 15, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, 62, -357, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, 65, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, 65, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357 }, { 15, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 62, -358, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 65, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, 65, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358 }, { 15, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, 62, -359, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, 65, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, 65, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359 }, { 15, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 62, -360, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 65, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, 65, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360 }, { 15, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 62, -361, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 65, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 65, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361 }, { 15, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 62, -362, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 65, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, 65, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362 }, { 15, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 62, -363, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 65, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 65, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363 }, { 15, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 62, -364, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 65, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 65, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364 }, { 15, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, 386, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365 }, { 15, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, 387, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366 }, { 15, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, 62, -367, 388, 389, 389, 389, 389, 389, 389, 389, 389, 389, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, 65, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, 65, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367, -367 }, { 15, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 62, -368, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 65, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, 65, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368, -368 }, { 15, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 62, -369, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 65, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, 65, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369, -369 }, { 15, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 62, -370, 392, 392, 392, 392, 392, 392, 392, 392, 392, 392, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 65, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, 65, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370, -370 }, { 15, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, 62, -371, 393, 393, 393, 393, 393, 393, 393, 393, 393, 393, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, 65, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, 65, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371, -371 }, { 15, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 62, -372, 394, 394, 394, 394, 394, 394, 394, 394, 394, 394, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 65, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, 65, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372, -372 }, { 15, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 62, -373, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 65, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, 65, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373, -373 }, { 15, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, 62, -374, 396, 396, 396, 396, 396, 396, 396, 396, 396, 396, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, 65, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, 65, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374, -374 }, { 15, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, 62, -375, 397, 397, 397, 397, 397, 397, 397, 397, 397, 397, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, 65, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, 65, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375, -375 }, { 15, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 62, -376, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 65, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, 65, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376, -376 }, { 15, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 62, -377, 399, 399, 399, 399, 399, 399, 399, 399, 399, 399, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 65, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, 65, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377, -377 }, { 15, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, 62, -378, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, 65, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, 65, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378, -378 }, { 15, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, 62, -379, 401, 401, 401, 401, 401, 401, 401, 401, 401, 401, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, 65, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, 65, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379, -379 }, { 15, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, 62, -380, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, 65, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, 65, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380, -380 }, { 15, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 62, -381, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 65, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, 65, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381, -381 }, { 15, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, 62, -382, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, 65, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, 65, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382, -382 }, { 15, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, 62, -383, 405, 405, 405, 405, 405, 405, 405, 405, 405, 405, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, 65, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, 65, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383, -383 }, { 15, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, 62, -384, 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, 65, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, 65, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, -384 }, { 15, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, 62, -385, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, 65, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, 65, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385, -385 }, { 15, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, 408, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, -386 }, { 15, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, 409, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, -387 }, { 15, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, 62, -388, 410, 411, 411, 411, 411, 411, 411, 411, 411, 411, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, 65, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, 65, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388, -388 }, { 15, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, 62, -389, 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, 65, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, 65, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389, -389 }, { 15, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, 62, -390, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, 65, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, 65, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390, -390 }, { 15, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 62, -391, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 65, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, 65, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391, -391 }, { 15, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, 62, -392, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, 65, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, 65, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392, -392 }, { 15, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, 62, -393, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, 65, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, 65, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393, -393 }, { 15, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, 62, -394, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, 65, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, 65, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394, -394 }, { 15, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, 62, -395, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, 65, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, 65, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395, -395 }, { 15, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, 62, -396, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, 65, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, 65, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396, -396 }, { 15, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, 62, -397, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, 65, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, 65, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397, -397 }, { 15, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, 62, -398, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, 65, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, 65, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398, -398 }, { 15, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, 62, -399, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, 65, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, 65, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, -399 }, { 15, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, 62, -400, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, 65, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, 65, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400, -400 }, { 15, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, 62, -401, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, 65, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, 65, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, -401 }, { 15, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, 62, -402, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, 65, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, 65, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402, -402 }, { 15, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, 62, -403, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, 65, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, 65, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, -403 }, { 15, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, 62, -404, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, 65, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, 65, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404, -404 }, { 15, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, 62, -405, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, 65, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, 65, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405, -405 }, { 15, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, 62, -406, 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, 65, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, 65, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406, -406 }, { 15, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, 62, -407, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, 65, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, 65, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407, -407 }, { 15, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, 431, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408, -408 }, { 15, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, 432, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409, -409 }, { 15, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, 62, -410, 410, 411, 411, 411, 411, 411, 411, 411, 411, 411, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, 65, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, 65, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410, -410 }, { 15, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, 62, -411, 412, 412, 412, 412, 412, 412, 412, 412, 412, 412, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, 65, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, 65, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411, -411 }, { 15, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, 62, -412, 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, 65, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, 65, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412, -412 }, { 15, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, 62, -413, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, 65, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, 65, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413, -413 }, { 15, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, 62, -414, 415, 415, 415, 415, 415, 415, 415, 415, 415, 415, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, 65, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, 65, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414, -414 }, { 15, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, 62, -415, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, 65, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, 65, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415, -415 }, { 15, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, 62, -416, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, 65, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, 65, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416, -416 }, { 15, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 62, -417, 418, 418, 418, 418, 418, 418, 418, 418, 418, 418, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 65, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, 65, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417, -417 }, { 15, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, 62, -418, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, 65, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, 65, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418, -418 }, { 15, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, 62, -419, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, 65, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, 65, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419, -419 }, { 15, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, 62, -420, 421, 421, 421, 421, 421, 421, 421, 421, 421, 421, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, 65, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, 65, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420, -420 }, { 15, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, 62, -421, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, 65, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, 65, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421, -421 }, { 15, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, 62, -422, 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, 65, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, 65, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422, -422 }, { 15, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 62, -423, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 65, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, 65, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423, -423 }, { 15, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, 62, -424, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, 65, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, 65, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424, -424 }, { 15, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, 62, -425, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, 65, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, 65, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425, -425 }, { 15, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 62, -426, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 65, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, 65, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426, -426 }, { 15, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, 62, -427, 428, 428, 428, 428, 428, 428, 428, 428, 428, 428, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, 65, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, 65, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427, -427 }, { 15, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 62, -428, 429, 429, 429, 429, 429, 429, 429, 429, 429, 429, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 65, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 65, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428 }, { 15, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 62, -429, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 65, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, 65, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429, -429 }, { 15, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, 62, -430, 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, 65, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, 65, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430, -430 }, { 15, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, 433, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431, -431 }, { 15, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, 434, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432, -432 }, { 15, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, 435, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433, -433 }, { 15, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, 436, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434, -434 }, { 15, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, 437, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435, -435 }, { 15, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, 438, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436, -436 }, { 15, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, 439, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437, -437 }, { 15, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, 440, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438, -438 }, { 15, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, 441, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439, -439 }, { 15, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, 442, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440, -440 }, { 15, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, 443, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441, -441 }, { 15, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, 444, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442, -442 }, { 15, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, 445, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443, -443 }, { 15, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, 446, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444, -444 }, { 15, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, 447, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445, -445 }, { 15, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, 448, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446, -446 }, { 15, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, 449, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, -447 }, { 15, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, 450, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448, -448 }, { 15, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, 451, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449 }, { 15, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, 452, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450, -450 }, { 15, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, 453, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451, -451 }, { 15, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, 454, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452, -452 }, { 15, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, 455, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453, -453 }, { 15, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, 456, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454, -454 }, { 15, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, 457, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455, -455 }, { 15, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, 458, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456, -456 }, { 15, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, 459, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457, -457 }, { 15, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, 460, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458, -458 }, { 15, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, 461, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459, -459 }, { 15, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, 462, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460, -460 }, { 15, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, 463, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461, -461 }, { 15, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, 464, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462, -462 }, { 15, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, 465, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, -463 }, { 15, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, 466, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464, -464 }, { 15, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, 467, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465, -465 }, { 15, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, 468, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466, -466 }, { 15, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, 469, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467, -467 }, { 15, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, 470, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468, -468 }, { 15, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, 471, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469, -469 }, { 15, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, 472, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470, -470 }, { 15, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, 473, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471, -471 }, { 15, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, 474, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472, -472 }, { 15, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, 475, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473, -473 }, { 15, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, 476, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474, -474 }, { 15, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, 477, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475, -475 }, { 15, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, 478, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476, -476 }, { 15, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, 479, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477, -477 }, { 15, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, 480, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478, -478 }, { 15, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, 481, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479, -479 }, { 15, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, 482, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480, -480 }, { 15, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, 483, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481, -481 }, { 15, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, 484, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482, -482 }, { 15, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, 485, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483, -483 }, { 15, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, 486, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484, -484 }, { 15, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, 487, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485, -485 }, { 15, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, 488, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486, -486 }, { 15, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, 489, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487, -487 }, { 15, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, 490, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488, -488 }, { 15, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, 491, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489, -489 }, { 15, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, 492, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490, -490 }, { 15, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, 493, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491, -491 }, { 15, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, 494, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492, -492 }, { 15, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, 495, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493, -493 }, { 15, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, 496, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494, -494 }, { 15, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, 497, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495, -495 }, { 15, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, 498, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496, -496 }, { 15, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, 499, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497, -497 }, { 15, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, 500, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498, -498 }, { 15, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, 501, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499, -499 }, { 15, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, 502, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500, -500 }, { 15, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, 503, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501, -501 }, { 15, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, 504, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502, -502 }, { 15, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, 505, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503, -503 }, { 15, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, 506, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504, -504 }, { 15, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, 507, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505, -505 }, { 15, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, 508, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506, -506 }, { 15, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, 509, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507, -507 }, { 15, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, 510, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508, -508 }, { 15, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, 511, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509, -509 }, { 15, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, 512, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510, -510 }, { 15, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, 513, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511, -511 }, { 15, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, 514, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512, -512 }, { 15, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, 515, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513, -513 }, { 15, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, 516, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514, -514 }, { 15, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, 517, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515, -515 }, { 15, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, 518, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516, -516 }, { 15, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, 519, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517, -517 }, { 15, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, 520, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518, -518 }, { 15, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, 521, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519, -519 }, { 15, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, 522, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520, -520 }, { 15, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, 523, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521, -521 }, { 15, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, 524, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522, -522 }, { 15, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, 525, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523, -523 }, { 15, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, 526, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524, -524 }, { 15, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, 527, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, -525 }, { 15, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, 528, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526, -526 }, { 15, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, 529, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527, -527 }, { 15, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, 530, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528, -528 }, { 15, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, 531, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529, -529 }, { 15, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, 532, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530, -530 }, { 15, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, 533, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531, -531 }, { 15, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, 534, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532, -532 }, { 15, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, 535, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533, -533 }, { 15, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, 536, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534, -534 }, { 15, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, 537, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535, -535 }, { 15, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, 538, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536, -536 }, { 15, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, 539, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537, -537 }, { 15, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, 540, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538, -538 }, { 15, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, 541, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539, -539 }, { 15, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, 542, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540, -540 }, { 15, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, 543, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541, -541 }, { 15, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, 544, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, -542 }, { 15, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, 545, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543, -543 }, { 15, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, 546, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544, -544 }, { 15, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, 547, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545, -545 }, { 15, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, 548, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546, -546 }, { 15, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, 549, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547, -547 }, { 15, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, 550, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548, -548 }, { 15, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549, -549 }, { 15, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550, -550 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up fitshdrtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ (yytext_ptr) -= (yy_more_len); \ fitshdrleng = (size_t) (yy_cp - (yytext_ptr)); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 31 #define YY_END_OF_BUFFER 32 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[551] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 29, 29, 0, 0, 32, 31, 31, 31, 31, 31, 31, 31, 20, 20, 20, 20, 20, 20, 11, 13, 13, 12, 25, 21, 24, 23, 27, 27, 28, 29, 31, 30, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 19, 0, 0, 0, 0, 0, 13, 13, 16, 16, 13, 13, 0, 13, 21, 0, 23, 22, 23, 0, 28, 29, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 13, 13, 13, 0, 16, 13, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 10, 2, 8, 8, 8, 5, 13, 13, 13, 13, 13, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 0, 6, 0, 0, 4, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 0, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 0, 0, 7, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 0, 0, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; static yyconst yy_state_type yy_NUL_trans[551] = { 0, 16, 17, 23, 23, 33, 33, 37, 37, 39, 39, 40, 40, 41, 41, 0, 0, 43, 43, 43, 43, 43, 43, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, 0, 77, 77, 77, 77, 77, 77, 77, 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 74, 75, 0, 100, 100, 100, 100, 100, 100, 100, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 259, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; extern int fitshdr_flex_debug; int fitshdr_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected static int yy_more_flag = 0; static int yy_more_len = 0; #define yymore() ((yy_more_flag) = 1) #define YY_MORE_ADJ (yy_more_len) #define YY_RESTORE_YY_MORE_OFFSET char *fitshdrtext; #line 1 "fitshdr.l" /*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: fitshdr.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner * definition for extracting keywords and keyvalues from a FITS header. * * It requires Flex v2.5.4 or later. * * Refer to fitshdr.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ /* Keywords. */ /* Keyvalue data types. */ /* Characters forming standard unit strings (jwBIQX are not used). */ /* Exclusive start states. */ #line 76 "fitshdr.l" #include #include #include #include #include #include "fitshdr.h" #include "wcsutil.h" #define YY_DECL int fitshdr(const char header[], int nkeyrec, int nkeyids, \ struct fitskeyid keyids[], int *nreject, \ struct fitskey **keys) #define YY_INPUT(inbuff, count, bufsize) \ { \ if (fitshdr_nkeyrec) { \ strncpy(inbuff, fitshdr_hdr, 80); \ inbuff[80] = '\n'; \ fitshdr_hdr += 80; \ fitshdr_nkeyrec--; \ count = 81; \ } else { \ count = YY_NULL; \ } \ } /* These global variables are required by YY_INPUT. */ const char *fitshdr_hdr; int fitshdr_nkeyrec; /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf fitshdr_abort_jmp_env; #define exit(status) longjmp(fitshdr_abort_jmp_env, status) /* Map status return value to message. */ const char *fitshdr_errmsg[] = { "Success", "Null fitskey pointer-pointer passed", "Memory allocation failed", "Fatal error returned by Flex parser"}; #line 10169 "fitshdr.c" #define INITIAL 0 #define VALUE 1 #define INLINE 2 #define UNITS 3 #define COMMENT 4 #define ERROR 5 #define FLUSH 6 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int fitshdrlex_destroy (void ); int fitshdrget_debug (void ); void fitshdrset_debug (int debug_flag ); YY_EXTRA_TYPE fitshdrget_extra (void ); void fitshdrset_extra (YY_EXTRA_TYPE user_defined ); FILE *fitshdrget_in (void ); void fitshdrset_in (FILE * in_str ); FILE *fitshdrget_out (void ); void fitshdrset_out (FILE * out_str ); int fitshdrget_leng (void ); char *fitshdrget_text (void ); int fitshdrget_lineno (void ); void fitshdrset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int fitshdrwrap (void ); #else extern int fitshdrwrap (void ); #endif #endif #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( fitshdrtext, fitshdrleng, 1, fitshdrout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ while ( (result = read( fileno(fitshdrin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(fitshdrin); \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int fitshdrlex (void); #define YY_DECL int fitshdrlex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after fitshdrtext and fitshdrleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( fitshdrleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (fitshdrtext[fitshdrleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 119 "fitshdr.l" char *cptr, ctmp[72]; int blank, continuation, end, j, k, keyno; double dtmp; struct fitskey *kptr; struct fitskeyid *iptr; void nullfill(char cptr[], int len); int fitshdrlex_destroy(void); fitshdr_hdr = header; fitshdr_nkeyrec = nkeyrec; *nreject = 0; keyno = 0; if (keys == 0x0) { return 1; } /* Allocate memory for the required number of fitskey structs. */ /* Recall that calloc() initializes allocated memory to zero. */ if (!(kptr = *keys = calloc(nkeyrec, sizeof(struct fitskey)))) { return 2; } /* Initialize keyids[]. */ iptr = keyids; for (j = 0; j < nkeyids; j++, iptr++) { iptr->count = 0; iptr->idx[0] = -1; iptr->idx[1] = -1; } blank = 0; continuation = 0; end = 0; /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(fitshdr_abort_jmp_env)) { return 3; } BEGIN(INITIAL); #line 10392 "fitshdr.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! fitshdrin ) fitshdrin = stdin; if ( ! fitshdrout ) fitshdrout = stdout; if ( ! YY_CURRENT_BUFFER ) { fitshdrensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); } fitshdr_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { (yy_more_len) = 0; if ( (yy_more_flag) ) { (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); (yy_more_flag) = 0; } yy_cp = (yy_c_buf_p); /* Support of fitshdrtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } ++yy_cp; } yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos) + 1; yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 163 "fitshdr.l" { /* A completely blank keyrecord. */ strncpy(kptr->keyword, fitshdrtext, 8); yyless(0); blank = 1; BEGIN(COMMENT); } YY_BREAK case 2: YY_RULE_SETUP #line 171 "fitshdr.l" { strncpy(kptr->keyword, fitshdrtext, 8); BEGIN(COMMENT); } YY_BREAK case 3: YY_RULE_SETUP #line 176 "fitshdr.l" { strncpy(kptr->keyword, fitshdrtext, 8); end = 1; BEGIN(FLUSH); } YY_BREAK case 4: YY_RULE_SETUP #line 182 "fitshdr.l" { /* Illegal END keyrecord. */ strncpy(kptr->keyword, fitshdrtext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(VALUE); } YY_BREAK case 5: YY_RULE_SETUP #line 189 "fitshdr.l" { /* Illegal END keyrecord. */ strncpy(kptr->keyword, fitshdrtext, 8); kptr->status |= FITSHDR_KEYREC; BEGIN(COMMENT); } YY_BREAK case 6: YY_RULE_SETUP #line 196 "fitshdr.l" { strncpy(kptr->keyword, fitshdrtext, 8); BEGIN(VALUE); } YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP #line 201 "fitshdr.l" { /* Continued string keyvalue. */ strncpy(kptr->keyword, fitshdrtext, 8); if (keyno > 0 && (kptr-1)->type%10 == 8) { /* Put back the string keyvalue. */ for (k = 10; fitshdrtext[k] != '\''; k++); yyless(k); continuation = 1; BEGIN(VALUE); } else { /* Not a valid continuation. */ yyless(8); BEGIN(COMMENT); } } YY_BREAK case 8: YY_RULE_SETUP #line 219 "fitshdr.l" { /* Keyword without value. */ strncpy(kptr->keyword, fitshdrtext, 8); BEGIN(COMMENT); } YY_BREAK case 9: YY_RULE_SETUP #line 225 "fitshdr.l" { /* Illegal keyword, carry on regardless. */ strncpy(kptr->keyword, fitshdrtext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(VALUE); } YY_BREAK case 10: YY_RULE_SETUP #line 232 "fitshdr.l" { /* Illegal keyword, carry on regardless. */ strncpy(kptr->keyword, fitshdrtext, 8); kptr->status |= FITSHDR_KEYWORD; BEGIN(COMMENT); } YY_BREAK case 11: *yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up fitshdrtext again */ YY_RULE_SETUP #line 239 "fitshdr.l" { /* Null keyvalue. */ BEGIN(INLINE); } YY_BREAK case 12: YY_RULE_SETUP #line 244 "fitshdr.l" { /* Logical keyvalue. */ kptr->type = 1; kptr->keyvalue.i = (*fitshdrtext == 'T'); BEGIN(INLINE); } YY_BREAK case 13: YY_RULE_SETUP #line 251 "fitshdr.l" { /* 32-bit signed integer keyvalue. */ kptr->type = 2; if (sscanf(fitshdrtext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } YY_BREAK case 14: YY_RULE_SETUP #line 262 "fitshdr.l" { /* 64-bit signed integer keyvalue (up to 18 digits). */ if (wcsutil_str2double(fitshdrtext, "%lf", &dtmp)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } else if (INT_MIN <= dtmp && dtmp <= INT_MAX) { /* Can be accomodated as a 32-bit signed integer. */ kptr->type = 2; if (sscanf(fitshdrtext, "%d", &(kptr->keyvalue.i)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } } else { /* 64-bit signed integer. */ kptr->type = 3; #ifdef WCSLIB_INT64 /* Native 64-bit integer is available. */ if (sscanf(fitshdrtext, "%lld", &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } #else /* 64-bit integer (up to 18 digits) implemented as int[3]. */ kptr->keyvalue.k[2] = 0; sprintf(ctmp, "%%%dd%%9d", fitshdrleng-9); if (sscanf(fitshdrtext, ctmp, kptr->keyvalue.k+1, kptr->keyvalue.k) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } else if (*fitshdrtext == '-') { kptr->keyvalue.k[0] *= -1; } #endif } BEGIN(INLINE); } YY_BREAK case 15: YY_RULE_SETUP #line 303 "fitshdr.l" { /* Very long integer keyvalue (and 19-digit int64). */ kptr->type = 4; strcpy(ctmp, fitshdrtext); k = fitshdrleng; for (j = 0; j < 8; j++) { /* Read it backwards. */ k -= 9; if (k < 0) k = 0; if (sscanf(ctmp+k, "%d", kptr->keyvalue.l+j) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } if (*fitshdrtext == '-') { kptr->keyvalue.l[j] = -abs(kptr->keyvalue.l[j]); } if (k == 0) break; ctmp[k] = '\0'; } /* Can it be accomodated as a 64-bit signed integer? */ if (j == 2 && abs(kptr->keyvalue.l[2]) <= 9 && abs(kptr->keyvalue.l[1]) <= 223372036 && kptr->keyvalue.l[0] <= 854775807 && kptr->keyvalue.l[0] >= -854775808) { kptr->type = 3; #ifdef WCSLIB_INT64 /* Native 64-bit integer is available. */ kptr->keyvalue.l[2] = 0; if (sscanf(fitshdrtext, "%lld", &(kptr->keyvalue.k)) < 1) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } #endif } BEGIN(INLINE); } YY_BREAK case 16: YY_RULE_SETUP #line 344 "fitshdr.l" { /* Float keyvalue. */ kptr->type = 5; if (wcsutil_str2double(fitshdrtext, "%lf", &(kptr->keyvalue.f))) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } YY_BREAK case 17: YY_RULE_SETUP #line 355 "fitshdr.l" { /* Integer complex keyvalue. */ kptr->type = 6; if (sscanf(fitshdrtext, "(%lf,%lf)", kptr->keyvalue.c, kptr->keyvalue.c+1) < 2) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } YY_BREAK case 18: YY_RULE_SETUP #line 367 "fitshdr.l" { /* Floating point complex keyvalue. */ kptr->type = 7; for (cptr = ctmp, k = 1; fitshdrtext[k] != ','; cptr++, k++) { *cptr = fitshdrtext[k]; } *cptr = '\0'; if (wcsutil_str2double(ctmp, "%lf", kptr->keyvalue.c)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } for (cptr = ctmp, k++; fitshdrtext[k] != ')'; cptr++, k++) { *cptr = fitshdrtext[k]; } *cptr = '\0'; if (wcsutil_str2double(ctmp, "%lf", kptr->keyvalue.c+1)) { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } BEGIN(INLINE); } YY_BREAK case 19: /* rule 19 can match eol */ YY_RULE_SETUP #line 394 "fitshdr.l" { /* String keyvalue. */ kptr->type = 8; cptr = kptr->keyvalue.s; strcpy(cptr, fitshdrtext+1); /* Squeeze out repeated quotes. */ k = 0; for (j = 0; j < 72; j++) { if (k < j) { cptr[k] = cptr[j]; } if (cptr[j] == '\0') { if (k) cptr[k-1] = '\0'; break; } else if (cptr[j] == '\'' && cptr[j+1] == '\'') { j++; } k++; } if (*cptr) { /* Retain the initial blank in all-blank strings. */ nullfill(cptr+1, 71); } else { nullfill(cptr, 72); } BEGIN(INLINE); } YY_BREAK case 20: YY_RULE_SETUP #line 427 "fitshdr.l" { kptr->status |= FITSHDR_KEYVALUE; BEGIN(ERROR); } YY_BREAK case 21: *yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up fitshdrtext again */ YY_RULE_SETUP #line 432 "fitshdr.l" { BEGIN(FLUSH); } YY_BREAK case 22: *yy_cp = (yy_hold_char); /* undo effects of setting up fitshdrtext */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up fitshdrtext again */ YY_RULE_SETUP #line 436 "fitshdr.l" { BEGIN(FLUSH); } YY_BREAK case 23: YY_RULE_SETUP #line 440 "fitshdr.l" { BEGIN(UNITS); } YY_BREAK case 24: YY_RULE_SETUP #line 444 "fitshdr.l" { kptr->status |= FITSHDR_COMMENT; BEGIN(ERROR); } YY_BREAK case 25: YY_RULE_SETUP #line 449 "fitshdr.l" { /* Keyvalue parsing must now also be suspect. */ kptr->status |= FITSHDR_COMMENT; kptr->type = 0; BEGIN(ERROR); } YY_BREAK case 26: YY_RULE_SETUP #line 456 "fitshdr.l" { kptr->ulen = fitshdrleng; yymore(); BEGIN(COMMENT); } YY_BREAK case 27: YY_RULE_SETUP #line 462 "fitshdr.l" { yymore(); BEGIN(COMMENT); } YY_BREAK case 28: YY_RULE_SETUP #line 467 "fitshdr.l" { strcpy(kptr->comment, fitshdrtext); nullfill(kptr->comment, 84); BEGIN(FLUSH); } YY_BREAK case 29: YY_RULE_SETUP #line 473 "fitshdr.l" { if (!continuation) kptr->type = -abs(kptr->type); sprintf(kptr->comment, "%.80s", fitshdr_hdr-80); kptr->comment[80] = '\0'; nullfill(kptr->comment+80, 4); BEGIN(FLUSH); } YY_BREAK case 30: /* rule 30 can match eol */ YY_RULE_SETUP #line 483 "fitshdr.l" { /* Discard the rest of the input line. */ kptr->keyno = ++keyno; /* Null-fill the keyword. */ kptr->keyword[8] = '\0'; nullfill(kptr->keyword, 12); /* Do indexing. */ iptr = keyids; kptr->keyid = -1; for (j = 0; j < nkeyids; j++, iptr++) { cptr = iptr->name; cptr[8] = '\0'; nullfill(cptr, 12); for (k = 0; k < 8; k++, cptr++) { if (*cptr != '.' && *cptr != kptr->keyword[k]) break; } if (k == 8) { /* Found a match. */ iptr->count++; if (iptr->idx[0] == -1) { iptr->idx[0] = keyno-1; } else { iptr->idx[1] = keyno-1; } kptr->keyno = -abs(kptr->keyno); if (kptr->keyid < 0) kptr->keyid = j; } } /* Deal with continued strings. */ if (continuation) { /* Tidy up the previous string keyvalue. */ if ((kptr-1)->type == 8) (kptr-1)->type += 10; cptr = (kptr-1)->keyvalue.s; if (cptr[strlen(cptr)-1] == '&') cptr[strlen(cptr)-1] = '\0'; kptr->type = (kptr-1)->type + 10; } /* Check for keyrecords following the END keyrecord. */ if (end && (end++ > 1) && !blank) { kptr->status |= FITSHDR_TRAILER; } if (kptr->status) (*nreject)++; kptr++; blank = 0; continuation = 0; BEGIN(INITIAL); } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(VALUE): case YY_STATE_EOF(INLINE): case YY_STATE_EOF(UNITS): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(ERROR): case YY_STATE_EOF(FLUSH): #line 539 "fitshdr.l" { /* End-of-input. */ fitshdrlex_destroy(); return 0; } YY_BREAK case 31: YY_RULE_SETUP #line 545 "fitshdr.l" ECHO; YY_BREAK #line 10967 "fitshdr.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed fitshdrin at a new source and called * fitshdrlex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = fitshdrin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( fitshdrwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * fitshdrtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of fitshdrlex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ fitshdrrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; fitshdrrestart(fitshdrin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) fitshdrrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { if ( *yy_cp ) { yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; } else yy_current_state = yy_NUL_trans[yy_current_state]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); if ( ! yy_is_jam ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ fitshdrrestart(fitshdrin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( fitshdrwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve fitshdrtext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void fitshdrrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ fitshdrensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = fitshdr_create_buffer(fitshdrin,YY_BUF_SIZE ); } fitshdr_init_buffer(YY_CURRENT_BUFFER,input_file ); fitshdr_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void fitshdr_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * fitshdrpop_buffer_state(); * fitshdrpush_buffer_state(new_buffer); */ fitshdrensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; fitshdr_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (fitshdrwrap()) processing, but the only time this flag * is looked at is after fitshdrwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void fitshdr_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; fitshdrin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE fitshdr_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) fitshdralloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in fitshdr_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) fitshdralloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in fitshdr_create_buffer()" ); b->yy_is_our_buffer = 1; fitshdr_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with fitshdr_create_buffer() * */ void fitshdr_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) fitshdrfree((void *) b->yy_ch_buf ); fitshdrfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a fitshdrrestart() or at EOF. */ static void fitshdr_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; fitshdr_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then fitshdr_init_buffer was _probably_ * called from fitshdrrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void fitshdr_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) fitshdr_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void fitshdrpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; fitshdrensure_buffer_stack(); /* This block is copied from fitshdr_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from fitshdr_switch_to_buffer. */ fitshdr_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void fitshdrpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; fitshdr_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { fitshdr_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void fitshdrensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)fitshdralloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in fitshdrensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)fitshdrrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in fitshdrensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE fitshdr_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) fitshdralloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in fitshdr_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; fitshdr_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to fitshdrlex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * fitshdr_scan_bytes() instead. */ YY_BUFFER_STATE fitshdr_scan_string (yyconst char * yystr ) { return fitshdr_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to fitshdrlex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE fitshdr_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) fitshdralloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in fitshdr_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = fitshdr_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in fitshdr_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up fitshdrtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ fitshdrtext[fitshdrleng] = (yy_hold_char); \ (yy_c_buf_p) = fitshdrtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ fitshdrleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int fitshdrget_lineno (void) { return fitshdrlineno; } /** Get the input stream. * */ FILE *fitshdrget_in (void) { return fitshdrin; } /** Get the output stream. * */ FILE *fitshdrget_out (void) { return fitshdrout; } /** Get the length of the current token. * */ int fitshdrget_leng (void) { return fitshdrleng; } /** Get the current token. * */ char *fitshdrget_text (void) { return fitshdrtext; } /** Set the current line number. * @param line_number * */ void fitshdrset_lineno (int line_number ) { fitshdrlineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see fitshdr_switch_to_buffer */ void fitshdrset_in (FILE * in_str ) { fitshdrin = in_str ; } void fitshdrset_out (FILE * out_str ) { fitshdrout = out_str ; } int fitshdrget_debug (void) { return fitshdr_flex_debug; } void fitshdrset_debug (int bdebug ) { fitshdr_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from fitshdrlex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT fitshdrin = stdin; fitshdrout = stdout; #else fitshdrin = (FILE *) 0; fitshdrout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * fitshdrlex_init() */ return 0; } /* fitshdrlex_destroy is for both reentrant and non-reentrant scanners. */ int fitshdrlex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ fitshdr_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; fitshdrpop_buffer_state(); } /* Destroy the stack itself. */ fitshdrfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * fitshdrlex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *fitshdralloc (yy_size_t size ) { return (void *) malloc( size ); } void *fitshdrrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void fitshdrfree (void * ptr ) { free( (char *) ptr ); /* see fitshdrrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 545 "fitshdr.l" /*--------------------------------------------------------------------------*/ void nullfill(char cptr[], int len) { int j, k; /* Null-fill the string. */ for (j = 0; j < len; j++) { if (cptr[j] == '\0') { for (k = j+1; k < len; k++) { cptr[k] = '\0'; } break; } } for (k = j-1; k >= 0; k--) { if (cptr[k] != ' ') break; cptr[k] = '\0'; } return; } astropy-0.3/cextern/wcslib/C/flexed/wcsulex.c0000644000175000017500000135053512243255342017435 0ustar oleole#line 2 "wcsulex.c" #line 4 "wcsulex.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define yy_create_buffer wcsulex_create_buffer #define yy_delete_buffer wcsulex_delete_buffer #define yy_flex_debug wcsulex_flex_debug #define yy_init_buffer wcsulex_init_buffer #define yy_flush_buffer wcsulex_flush_buffer #define yy_load_buffer_state wcsulex_load_buffer_state #define yy_switch_to_buffer wcsulex_switch_to_buffer #define yyin wcsulexin #define yyleng wcsulexleng #define yylex wcsulexlex #define yylineno wcsulexlineno #define yyout wcsulexout #define yyrestart wcsulexrestart #define yytext wcsulextext #define yywrap wcsulexwrap #define yyalloc wcsulexalloc #define yyrealloc wcsulexrealloc #define yyfree wcsulexfree #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! C99 */ #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE wcsulexrestart(wcsulexin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. * Ditto for the __ia64__ case accordingly. */ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 #endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif extern int wcsulexleng; extern FILE *wcsulexin, *wcsulexout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsulextext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up wcsulextext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via wcsulexrestart()), so that the user can continue scanning by * just pointing wcsulexin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when wcsulextext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int wcsulexleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow wcsulexwrap()'s to do buffer switches * instead of setting up a fresh wcsulexin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void wcsulexrestart (FILE *input_file ); void wcsulex_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE wcsulex_create_buffer (FILE *file,int size ); void wcsulex_delete_buffer (YY_BUFFER_STATE b ); void wcsulex_flush_buffer (YY_BUFFER_STATE b ); void wcsulexpush_buffer_state (YY_BUFFER_STATE new_buffer ); void wcsulexpop_buffer_state (void ); static void wcsulexensure_buffer_stack (void ); static void wcsulex_load_buffer_state (void ); static void wcsulex_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER wcsulex_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE wcsulex_scan_buffer (char *base,yy_size_t size ); YY_BUFFER_STATE wcsulex_scan_string (yyconst char *yy_str ); YY_BUFFER_STATE wcsulex_scan_bytes (yyconst char *bytes,int len ); void *wcsulexalloc (yy_size_t ); void *wcsulexrealloc (void *,yy_size_t ); void wcsulexfree (void * ); #define yy_new_buffer wcsulex_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ wcsulexensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ wcsulexensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ #define wcsulexwrap(n) 1 #define YY_SKIP_YYWRAP typedef char YY_CHAR; FILE *wcsulexin = (FILE *) 0, *wcsulexout = (FILE *) 0; typedef int yy_state_type; extern int wcsulexlineno; int wcsulexlineno = 1; extern char *wcsulextext; #define yytext_ptr wcsulextext static yyconst flex_int16_t yy_nxt[][128] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 16, 14, 14, 14, 14, 14, 14, 14, 17, 14, 18, 14, 14, 14, 18, 19, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 20, 21, 22, 23, 24, 22, 25, 26, 14, 27, 28, 14, 24, 22, 29, 30, 14, 31, 32, 33, 14, 22, 34, 14, 24, 24, 14, 14, 35, 14, 14, 14, 36, 37, 38, 39, 40, 41, 28, 42, 14, 14, 24, 43, 44, 41, 29, 45, 14, 46, 47, 14, 48, 49, 14, 14, 50, 41, 14, 14, 14, 14, 14 }, { 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 51, 14, 14, 14, 14, 14, 14, 14, 17, 14, 52, 14, 14, 14, 52, 19, 14, 53, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 20, 21, 22, 23, 24, 22, 25, 26, 14, 27, 28, 14, 24, 22, 29, 30, 14, 31, 32, 33, 14, 22, 34, 14, 24, 24, 54, 14, 35, 14, 14, 14, 36, 37, 38, 39, 55, 41, 28, 42, 14, 14, 24, 56, 44, 41, 29, 45, 14, 46, 47, 14, 48, 49, 14, 14, 50, 41, 14, 14, 14, 14, 14 }, { 13, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 59, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 }, { 13, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 58, 59, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57 }, { 13, 60, 60, 60, 60, 60, 60, 60, 60, 60, 15, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 60, 62, 60, 60, 60, 60, 60, 63, 60, 60, 64, 60, 60, 60, 65, 60, 60, 60, 60, 66, 67, 60, 60, 60, 60, 60, 60, 68, 60, 69, 70, 60, 71, 60, 72, 60, 60, 73, 60, 74, 75, 60, 76, 60, 60, 60, 60, 77, 60, 60, 60, 78, 79, 60, 60, 60, 60, 60 }, { 13, 60, 60, 60, 60, 60, 60, 60, 60, 60, 15, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 60, 62, 60, 60, 60, 60, 60, 63, 60, 60, 64, 60, 60, 60, 65, 60, 60, 60, 60, 66, 67, 60, 60, 60, 60, 60, 60, 68, 60, 69, 70, 60, 71, 60, 72, 60, 60, 73, 60, 74, 75, 60, 76, 60, 60, 60, 60, 77, 60, 60, 60, 78, 79, 60, 60, 60, 60, 60 }, { 13, 80, 80, 80, 80, 80, 80, 80, 80, 80, 15, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 82, 83, 84, 80, 85, 86, 87, 80, 88, 89, 80, 80, 90, 91, 92, 80, 93, 94, 95, 80, 96, 97, 80, 80, 80, 80, 80, 80, 80, 80, 80, 98, 99, 100, 101, 102, 80, 103, 104, 80, 80, 80, 105, 106, 80, 91, 107, 80, 108, 109, 80, 110, 111, 80, 80, 112, 80, 80, 80, 80, 80, 80 }, { 13, 80, 80, 80, 80, 80, 80, 80, 80, 80, 15, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81, 82, 83, 84, 80, 85, 86, 87, 80, 88, 89, 80, 80, 90, 91, 92, 80, 93, 94, 95, 80, 96, 97, 80, 80, 80, 80, 80, 80, 80, 80, 80, 98, 99, 100, 101, 102, 80, 103, 104, 80, 80, 80, 105, 106, 80, 91, 107, 80, 108, 109, 80, 110, 111, 80, 80, 112, 80, 80, 80, 80, 80, 80 }, { 13, 113, 113, 113, 113, 113, 113, 113, 113, 113, 15, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 113, 113, 113, 113, 113, 113, 113, 115, 113, 116, 117, 113, 117, 118, 119, 113, 120, 120, 120, 120, 120, 120, 120, 120, 120, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 121, 122, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 }, { 13, 113, 113, 113, 113, 113, 113, 113, 113, 113, 15, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 114, 113, 113, 113, 113, 113, 113, 113, 115, 113, 116, 117, 113, 117, 118, 119, 113, 120, 120, 120, 120, 120, 120, 120, 120, 120, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 121, 122, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113 }, { 13, 123, 123, 123, 123, 123, 123, 123, 123, 123, 15, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123 }, { 13, 123, 123, 123, 123, 123, 123, 123, 123, 123, 15, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123 }, { -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, -13 }, { 13, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, -14 }, { 13, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15 }, { 13, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, 124, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16 }, { 13, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17 }, { 13, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, -18 }, { 13, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, -19 }, { 13, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, 125, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, 126, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20 }, { 13, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, 127, -21, -21, -21, -21, -21, -21 }, { 13, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, -22 }, { 13, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, -23 }, { 13, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, 128, 129, 130, -24, -24, 130, 131, 132, -24, 133, 128, -24, -24, 130, 134, 135, -24, 131, 130, 130, -24, 130, 136, -24, -24, -24, -24, -24, -24, -24, -24, -24, 137, 138, 139, -24, 140, -24, 128, -24, -24, -24, -24, 141, 142, -24, 134, 143, -24, 144, 145, -24, -24, -24, -24, -24, 146, -24, -24, -24, -24, -24, -24 }, { 13, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, 128, 129, 130, -25, -25, 130, 131, 132, -25, 133, 128, -25, -25, 130, 134, 135, -25, 131, 130, 130, -25, 130, 136, -25, -25, -25, -25, -25, -25, -25, -25, -25, 137, 138, 139, -25, 140, -25, 128, -25, -25, -25, -25, 141, 142, -25, 134, 143, -25, 144, 145, -25, -25, -25, -25, -25, 146, -25, -25, -25, -25, -25, -25 }, { 13, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, 147, -26, -26, -26, -26, -26 }, { 13, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, 148, -27, -27, -27, -27, -27, -27 }, { 13, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28 }, { 13, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, 149, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29 }, { 13, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, 128, 129, 130, -30, -30, 130, 131, 132, -30, 133, 128, -30, -30, 130, 134, 135, -30, 131, 130, 130, -30, 130, 136, -30, -30, -30, -30, -30, -30, -30, -30, -30, 150, 138, 139, -30, 140, -30, 128, -30, -30, -30, -30, 141, 142, -30, 134, 143, -30, 144, 145, -30, -30, -30, -30, -30, 146, -30, -30, -30, -30, -30, -30 }, { 13, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, -31, 151, -31, -31, -31, -31, -31, -31 }, { 13, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 152, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32 }, { 13, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, 128, 129, 130, -33, -33, 130, 131, 132, -33, 133, 128, -33, -33, 130, 134, 135, -33, 131, 130, 130, -33, 130, 136, -33, -33, -33, -33, -33, -33, -33, -33, -33, 137, 138, 139, -33, 140, -33, 128, -33, -33, -33, -33, 141, 142, -33, 134, 143, -33, 144, 145, -33, -33, -33, -33, -33, 146, -33, -33, -33, -33, -33, -33 }, { 13, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 147, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34 }, { 13, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, -35 }, { 13, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, 128, -36, 130, -36, -36, 130, 131, 132, -36, 133, 128, -36, -36, 130, 134, 135, -36, 131, 130, 130, -36, 130, 136, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, 153, 139, 154, 140, -36, 128, -36, -36, -36, -36, 141, 155, 126, 134, -36, -36, 156, 145, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, -36 }, { 13, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, 157, -37, -37, -37, 158, -37, -37, -37, 159, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, -37, 127, -37, -37, -37, -37, -37, -37 }, { 13, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, 128, -38, 130, -38, -38, 130, 131, 132, -38, 133, 128, -38, -38, 130, 134, 135, -38, 131, 130, 130, -38, 130, 136, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, 153, 139, 160, 140, -38, 128, 161, -38, -38, -38, 141, 155, -38, 162, -38, -38, 144, 145, 163, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38 }, { 13, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, 128, -39, 130, -39, -39, 130, 131, 132, -39, 133, 128, -39, -39, 130, 134, 135, -39, 131, 130, 130, -39, 130, 136, -39, -39, -39, -39, -39, -39, -39, -39, -39, 164, 153, 139, -39, 165, -39, 128, -39, -39, -39, -39, 141, 155, -39, 134, -39, -39, 144, 145, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, -39 }, { 13, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, 148, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, 166, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, -40 }, { 13, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, 128, -41, 130, -41, -41, 130, 131, 132, -41, 133, 128, -41, -41, 130, 134, 135, -41, 131, 130, 130, -41, 130, 136, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, 153, 139, -41, 140, -41, 128, -41, -41, -41, -41, 141, 155, -41, 134, -41, -41, 144, 145, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, -41 }, { 13, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, 128, 129, 130, -42, -42, 130, 131, 132, -42, 133, 128, -42, -42, 130, 134, 135, -42, 131, 130, 130, -42, 130, 136, -42, -42, -42, -42, -42, -42, -42, -42, -42, 137, 138, 139, -42, 140, -42, 128, -42, -42, -42, -42, 141, 142, -42, 134, 143, -42, 144, 145, -42, -42, -42, -42, -42, 146, -42, -42, -42, -42, -42, -42 }, { 13, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 147, -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, 147, 167, -43, -43, -43, -43, -43, -43 }, { 13, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, 128, -44, 130, -44, -44, 130, 131, 132, -44, 133, 128, -44, -44, 130, 134, 135, -44, 131, 130, 130, -44, 130, 136, -44, -44, -44, -44, -44, -44, -44, -44, -44, 168, 153, 139, -44, 140, -44, 128, -44, 169, -44, -44, 141, 155, -44, 170, -44, -44, 144, 145, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, -44 }, { 13, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 128, -45, 130, -45, -45, 130, 131, 132, -45, 133, 128, -45, -45, 130, 134, 135, -45, 131, 130, 130, -45, 130, 136, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, 153, 171, -45, 140, -45, 128, 172, 173, -45, -45, 141, 155, -45, 134, -45, -45, 144, 145, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, -45 }, { 13, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, 174, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -46 }, { 13, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, 175, -47, 176, 160, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47 }, { 13, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, 128, -48, 130, -48, -48, 130, 131, 132, -48, 133, 128, -48, -48, 130, 134, 135, -48, 131, 130, 130, -48, 130, 136, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, 153, 139, -48, 140, -48, 128, -48, -48, -48, -48, 141, 155, -48, 134, -48, -48, 144, 145, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48 }, { 13, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, 177, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, -49 }, { 13, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 128, -50, 130, -50, -50, 130, 131, 132, -50, 133, 128, -50, -50, 130, 134, 135, -50, 131, 130, 130, -50, 130, 136, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, 153, 139, -50, 140, -50, 128, -50, -50, -50, -50, 141, 155, -50, 134, -50, -50, 178, 145, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, -50 }, { 13, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, 179, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, -51 }, { 13, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52 }, { 13, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, 180, 181, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, -53 }, { 13, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, -54 }, { 13, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 148, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, 166, -55, -55, -55, -55, -55, 182, -55, -55, -55, -55, -55, -55, -55 }, { 13, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, 147, 183, 184, -56, -56, -56, -56, -56, -56, -56, -56, 147, 167, -56, -56, -56, -56, -56, -56 }, { 13, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, -57, -57, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185 }, { 13, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58, -58 }, { 13, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59 }, { 13, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60 }, { 13, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, -61 }, { 13, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -62 }, { 13, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63 }, { 13, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, -64 }, { 13, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, -65 }, { 13, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66 }, { 13, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, -67 }, { 13, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68, -68 }, { 13, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69, -69 }, { 13, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, 186, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70, -70 }, { 13, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71, -71 }, { 13, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72 }, { 13, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73, -73 }, { 13, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, -74 }, { 13, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75 }, { 13, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, -76 }, { 13, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, -77 }, { 13, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78 }, { 13, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, -79 }, { 13, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80 }, { 13, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 187, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, 188, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, -81 }, { 13, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, 189, -82, -82, -82, -82, -82, -82 }, { 13, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, -83 }, { 13, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, -84 }, { 13, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85 }, { 13, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86, -86 }, { 13, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, 190, -87, -87, -87, -87, -87 }, { 13, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, 191, -88, -88, -88, -88, -88, -88 }, { 13, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89 }, { 13, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, -90 }, { 13, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, 192, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91, -91 }, { 13, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, 193, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, -92 }, { 13, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, 194, -93, -93, -93, -93, -93, -93 }, { 13, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, 195, -94, -94, -94, -94, -94, -94, -94, -94, -94, -94 }, { 13, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, -95 }, { 13, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96, -96 }, { 13, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, 196, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97 }, { 13, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, 197, -98, -98, -98, -98, -98, -98, -98, -98, -98, 188, -98, -98, -98, 198, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, -98 }, { 13, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 199, -99, -99, -99, 200, -99, -99, -99, 201, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, 189, -99, -99, -99, -99, -99, -99 }, { 13, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 202, -100, -100, -100, 203, -100, -100, -100, -100, -100, -100, 204, -100, -100, -100, -100, 205, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 }, { 13, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, 206, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101, -101 }, { 13, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 207, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, 208, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102, -102 }, { 13, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103, -103 }, { 13, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104, -104 }, { 13, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, 209, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, 210, 211, -105, -105, -105, -105, -105, -105 }, { 13, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, 212, -106, -106, -106, -106, -106, -106, -106, 213, -106, -106, -106, -106, -106, 214, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, -106 }, { 13, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, 215, -107, -107, -107, -107, 216, 217, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, -107 }, { 13, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, 218, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108, -108 }, { 13, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, 219, -109, -109, 220, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109, -109 }, { 13, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110, -110 }, { 13, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, 221, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111, -111 }, { 13, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, 222, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112, -112 }, { 13, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113, -113 }, { 13, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 223, -114, -114, -114, -114, -114, -114, -114, 224, -114, 225, 226, -114, 226, 227, 228, -114, 229, 229, 229, 229, 229, 229, 229, 229, 229, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, 230, 231, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114, -114 }, { 13, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 232, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, 233, -115, 233, 234, -115, 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115, -115 }, { 13, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, 237, -116, -116, -116, -116, -116, -116, -116, -116, -116, 231, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, -116 }, { 13, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, 229, 229, 229, 229, 229, 229, 229, 229, 229, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117 }, { 13, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, 237, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118, -118 }, { 13, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 238, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, -119 }, { 13, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120, -120 }, { 13, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121, -121 }, { 13, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122, -122 }, { 13, 240, 240, 240, 240, 240, 240, 240, 240, 240, -123, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240 }, { 13, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, 124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124, -124 }, { 13, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125, -125 }, { 13, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, 241, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126, -126 }, { 13, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, 242, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127 }, { 13, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128, -128 }, { 13, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, -129, 243, -129, -129, -129, -129, -129, -129 }, { 13, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130, -130 }, { 13, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131, -131 }, { 13, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, -132, 130, -132, -132, -132, -132, -132 }, { 13, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, -133, 131, -133, -133, -133, -133, -133, -133 }, { 13, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, 244, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134, -134 }, { 13, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 130, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, -135 }, { 13, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, 130, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136, -136 }, { 13, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137, -137 }, { 13, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 245, -138, -138, -138, -138, -138, -138, -138, 246, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, -138, 243, -138, -138, -138, -138, -138, -138 }, { 13, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, 128, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139, -139 }, { 13, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, 131, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140, -140 }, { 13, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 130, -141, -141, -141, -141, -141, -141, -141, -141, -141, -141, 130, -141, -141, -141, -141, -141, -141, -141 }, { 13, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, 247, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142, -142 }, { 13, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, 137, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143, -143 }, { 13, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, 248, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144, -144 }, { 13, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, 128, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145, -145 }, { 13, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 137, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146 }, { 13, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147, -147 }, { 13, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148, -148 }, { 13, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, 147, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149, -149 }, { 13, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150, -150 }, { 13, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151, -151 }, { 13, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, 125, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152, -152 }, { 13, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, 245, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153, -153 }, { 13, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154, 163, -154, -154, -154, -154, -154, -154, -154, -154, -154, -154 }, { 13, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 249, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, 247, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155, -155 }, { 13, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, 248, -156, 250, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156, -156 }, { 13, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, 251, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157, -157 }, { 13, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, 252, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158 }, { 13, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, 163, -159, -159, -159, -159, -159, 253, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159, -159 }, { 13, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160, -160 }, { 13, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, 254, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161, -161 }, { 13, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, 244, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162, 255, -162, -162, -162, -162, -162, -162, -162, -162, -162, -162 }, { 13, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163, -163 }, { 13, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, -164, 128, 129, 130, -164, -164, 130, 131, 132, -164, 133, 128, -164, -164, 130, 134, 135, -164, 131, 130, 130, -164, 130, 136, -164, -164, -164, -164, -164, -164, -164, -164, -164, 137, 138, 139, -164, 140, -164, 128, -164, -164, -164, -164, 141, 142, -164, 134, 143, -164, 144, 145, -164, -164, -164, -164, -164, 146, -164, -164, -164, -164, -164, -164 }, { 13, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 131, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, 151, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165, -165 }, { 13, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, 151, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166, -166 }, { 13, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, 125, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167, -167 }, { 13, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 148, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, 151, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168, -168 }, { 13, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, 151, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169, -169 }, { 13, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 244, -170, -170, -170, 160, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170 }, { 13, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, 128, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171, -171 }, { 13, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, 256, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172, -172 }, { 13, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, -173, 257, -173, -173, -173, -173, -173, -173, -173 }, { 13, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, 160, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174, -174 }, { 13, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, 258, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175, -175 }, { 13, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, 259, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176, -176 }, { 13, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, -177, 260, -177, -177, -177, -177, -177, -177, -177 }, { 13, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, 248, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178 }, { 13, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, 179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179, -179 }, { 13, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180, -180 }, { 13, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, -181 }, { 13, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, 262, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182, -182 }, { 13, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, 263, -183, -183, -183, -183, -183, -183, -183, 264, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183, -183 }, { 13, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, 265, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184, -184 }, { 13, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, -185, -185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185, 185 }, { 13, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186, -186 }, { 13, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, -187 }, { 13, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, 266, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188, -188 }, { 13, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, 267, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189, -189 }, { 13, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190, -190 }, { 13, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191, -191 }, { 13, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, 268, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192, -192 }, { 13, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193, -193 }, { 13, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194, -194 }, { 13, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, 269, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195, -195 }, { 13, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196, -196 }, { 13, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197, 270, -197, -197, -197, -197, -197, -197, -197, -197, -197, -197 }, { 13, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, 271, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198, -198 }, { 13, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, 272, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199, -199 }, { 13, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, 273, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200, -200 }, { 13, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, 274, -201, -201, -201, -201, -201, 275, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201, -201 }, { 13, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, -202 }, { 13, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, 276, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203, -203 }, { 13, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204, 277, -204, -204, -204, -204, -204, -204, -204, -204, -204, -204 }, { 13, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205, -205 }, { 13, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, 278, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, -206 }, { 13, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207, -207 }, { 13, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, 279, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208, -208 }, { 13, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209, -209 }, { 13, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210, -210 }, { 13, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, 280, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211, -211 }, { 13, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 281, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, 282, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212, -212 }, { 13, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, 283, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213, -213 }, { 13, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, 284, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214, -214 }, { 13, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215, -215 }, { 13, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, 285, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216 }, { 13, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, -217, 286, -217, -217, -217, -217, -217, -217, -217 }, { 13, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, 287, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218, -218 }, { 13, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, 288, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219, -219 }, { 13, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220 }, { 13, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, -221, 289, -221, -221, -221, -221, -221, -221, -221 }, { 13, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, -222 }, { 13, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 223, -223, -223, -223, -223, -223, -223, -223, 224, -223, 225, 226, -223, 226, 227, 228, -223, 229, 229, 229, 229, 229, 229, 229, 229, 229, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, 230, 231, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, -223 }, { 13, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 232, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, 233, -224, 233, 234, -224, 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224, -224 }, { 13, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, 237, -225, -225, -225, -225, -225, -225, -225, -225, -225, 231, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225, -225 }, { 13, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, 229, 229, 229, 229, 229, 229, 229, 229, 229, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, -226 }, { 13, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, 237, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227, -227 }, { 13, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, 238, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228, -228 }, { 13, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229, -229 }, { 13, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230, -230 }, { 13, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231, -231 }, { 13, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, 233, -232, 233, 234, -232, 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232, -232 }, { 13, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, 234, -233, 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233, -233 }, { 13, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, -234 }, { 13, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, 291, -235, -235, -235, -235, -235, -235, -235, -235, 292, -235, -235, -235, -235, 293, -235, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235, -235 }, { 13, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, 295, -236, -236, -236, -236, -236, -236, -236, -236, 296, -236, -236, -236, -236, 293, 297, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236, -236 }, { 13, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, 237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237, -237 }, { 13, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, 238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238, -238 }, { 13, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239, -239 }, { 13, 240, 240, 240, 240, 240, 240, 240, 240, 240, -240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, 240 }, { 13, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, 299, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241, -241 }, { 13, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, 253, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242, -242 }, { 13, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, 300, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243, -243 }, { 13, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, 130, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244, -244 }, { 13, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, 301, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245, -245 }, { 13, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, 137, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246, -246 }, { 13, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, 128, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247, -247 }, { 13, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, 128, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248, -248 }, { 13, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, 302, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249, -249 }, { 13, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, 303, -250, -250, -250, -250, -250, 304, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250, -250 }, { 13, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, 148, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251, -251 }, { 13, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, 125, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252, -252 }, { 13, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253, -253 }, { 13, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, 163, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254, -254 }, { 13, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, 305, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255, -255 }, { 13, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, 306, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, -256 }, { 13, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, 307, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257, -257 }, { 13, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, 308, 309, -258, -258, -258, -258, 310, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258, -258 }, { 13, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, 311, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, -259 }, { 13, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, 312, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, -260 }, { 13, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, -261 }, { 13, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, 313, -262, -262, -262, -262, -262, -262, -262, 314, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262, -262 }, { 13, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, 263, -263, -263, -263, -263, -263, -263, -263, 264, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263, -263 }, { 13, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264, -264 }, { 13, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, 315, -265, -265, -265, -265, -265, -265, -265, 316, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265, -265 }, { 13, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, 317, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266, -266 }, { 13, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, 318, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, -267 }, { 13, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268, -268 }, { 13, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269, -269 }, { 13, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270, -270 }, { 13, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, 319, -271, -271, -271, -271, -271, 320, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, -271 }, { 13, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, 321, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272, -272 }, { 13, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, 322, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273, -273 }, { 13, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274, -274 }, { 13, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275, -275 }, { 13, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, 323, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, -276 }, { 13, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, 324, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277, -277 }, { 13, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278, -278 }, { 13, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279, -279 }, { 13, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280, -280 }, { 13, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281, -281 }, { 13, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282 }, { 13, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283, -283 }, { 13, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284, -284 }, { 13, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, 325, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285, -285 }, { 13, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, 326, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286, -286 }, { 13, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287, -287 }, { 13, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, 327, 328, -288, -288, -288, -288, 329, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288 }, { 13, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, 330, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289, -289 }, { 13, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, 291, -290, -290, -290, -290, -290, -290, -290, -290, 292, -290, -290, -290, -290, -290, -290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290, -290 }, { 13, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, 291, -291, -291, -291, -291, -291, -291, -291, -291, 292, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291, -291 }, { 13, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292, -292 }, { 13, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, 291, -293, -293, -293, -293, -293, -293, -293, -293, 292, -293, -293, -293, -293, -293, -293, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293, -293 }, { 13, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, 291, -294, -294, -294, -294, -294, -294, -294, -294, 292, -294, -294, -294, -294, 293, -294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294, -294 }, { 13, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, 295, -295, -295, -295, -295, -295, -295, -295, -295, 296, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295, -295 }, { 13, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296, -296 }, { 13, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, 332, 332, 332, 332, 332, 332, 332, 332, 332, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, -297 }, { 13, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, 295, -298, -298, -298, -298, -298, -298, -298, -298, 296, -298, -298, -298, -298, 293, 297, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298, -298 }, { 13, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, 333, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299, -299 }, { 13, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, 137, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300, -300 }, { 13, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, 131, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301, -301 }, { 13, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302, -302 }, { 13, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, 334, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303, -303 }, { 13, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, 335, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304, -304 }, { 13, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, 163, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305, -305 }, { 13, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, 336, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306, -306 }, { 13, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, 163, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307, -307 }, { 13, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308, 337, -308, -308, -308, -308, -308, -308, -308, -308, -308, -308 }, { 13, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, 338, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309, -309 }, { 13, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, 339, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310, -310 }, { 13, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, 340, -311, -311, -311, -311, -311, -311, -311, 341, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311, -311 }, { 13, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, 163, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312, -312 }, { 13, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, 313, -313, -313, -313, -313, -313, -313, -313, 314, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313, -313 }, { 13, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314, -314 }, { 13, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, 315, -315, -315, -315, -315, -315, -315, -315, 316, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315, -315 }, { 13, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316, -316 }, { 13, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, 342, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317, -317 }, { 13, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318, -318 }, { 13, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, 343, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319, -319 }, { 13, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, 344, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320, -320 }, { 13, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321, -321 }, { 13, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322, -322 }, { 13, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323, -323 }, { 13, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, 205, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324, -324 }, { 13, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, 345, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325, -325 }, { 13, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, 346, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326, -326 }, { 13, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327, 347, -327, -327, -327, -327, -327, -327, -327, -327, -327, -327 }, { 13, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, 348, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328, -328 }, { 13, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, 349, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329, -329 }, { 13, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, 350, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330, -330 }, { 13, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, 291, -331, -331, -331, -331, -331, -331, -331, -331, 292, -331, -331, -331, -331, -331, -331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331, -331 }, { 13, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, 351, -332, -332, -332, -332, -332, -332, -332, -332, 352, -332, -332, -332, -332, -332, -332, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332, -332 }, { 13, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, 354, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333, -333 }, { 13, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, 151, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334 }, { 13, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, 151, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335, -335 }, { 13, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, 163, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336, -336 }, { 13, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, 125, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337, -337 }, { 13, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, 355, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338, -338 }, { 13, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, 125, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339, -339 }, { 13, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, 340, -340, -340, -340, -340, -340, -340, -340, 341, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340, -340 }, { 13, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341, -341 }, { 13, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, 356, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342, -342 }, { 13, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, 357, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343, -343 }, { 13, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, 358, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344, -344 }, { 13, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, 359, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345, -345 }, { 13, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346, -346 }, { 13, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, 360, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347, -347 }, { 13, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, 361, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348, -348 }, { 13, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, 362, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349, -349 }, { 13, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350, -350 }, { 13, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, 351, -351, -351, -351, -351, -351, -351, -351, -351, 352, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351, -351 }, { 13, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352, -352 }, { 13, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, 351, -353, -353, -353, -353, -353, -353, -353, -353, 352, -353, -353, -353, -353, -353, -353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353, -353 }, { 13, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, 363, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354, -354 }, { 13, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, 125, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355, -355 }, { 13, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, 364, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356, -356 }, { 13, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357, -357 }, { 13, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358, -358 }, { 13, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359, -359 }, { 13, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, -360 }, { 13, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, 365, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361, -361 }, { 13, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362, -362 }, { 13, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, 125, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363, -363 }, { 13, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, 366, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364, -364 }, { 13, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365, -365 }, { 13, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366, -366 }, } ; static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up wcsulextext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ (yytext_ptr) -= (yy_more_len); \ wcsulexleng = (size_t) (yy_cp - (yytext_ptr)); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 118 #define YY_END_OF_BUFFER 119 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; flex_int32_t yy_nxt; }; static yyconst flex_int16_t yy_accept[367] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 117, 119, 20, 118, 9, 11, 12, 14, 15, 20, 15, 15, 20, 15, 15, 15, 15, 20, 20, 15, 15, 15, 15, 19, 15, 20, 20, 15, 20, 20, 15, 20, 15, 20, 20, 15, 15, 20, 20, 1, 8, 20, 2, 20, 20, 23, 21, 22, 44, 41, 38, 37, 40, 39, 43, 42, 31, 25, 24, 30, 35, 36, 26, 28, 29, 27, 33, 32, 105, 45, 105, 57, 61, 66, 67, 69, 72, 74, 83, 105, 105, 89, 92, 99, 101, 103, 46, 105, 105, 62, 105, 68, 70, 105, 78, 105, 105, 93, 100, 105, 105, 116, 113, 112, 111, 116, 111, 114, 107, 115, 106, 117, 9, 15, 0, 0, 16, 0, 16, 16, 16, 16, 0, 0, 16, 17, 0, 0, 0, 0, 16, 0, 0, 16, 0, 15, 15, 0, 15, 15, 0, 0, 0, 16, 0, 0, 0, 0, 15, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 15, 1, 13, 4, 0, 0, 0, 23, 34, 51, 0, 0, 71, 73, 0, 85, 91, 0, 104, 0, 0, 0, 0, 0, 58, 0, 0, 60, 0, 65, 0, 75, 76, 0, 0, 0, 0, 86, 87, 0, 0, 0, 97, 0, 46, 113, 112, 111, 0, 111, 114, 107, 115, 106, 0, 0, 0, 0, 0, 111, 114, 107, 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 6, 0, 0, 0, 84, 98, 47, 0, 0, 0, 54, 55, 0, 0, 63, 64, 77, 79, 80, 81, 82, 0, 88, 90, 0, 0, 0, 0, 110, 0, 0, 0, 108, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 5, 0, 56, 0, 0, 52, 53, 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 88, 0, 0, 0, 102, 0, 109, 0, 0, 0, 0, 49, 50, 87, 94, 0, 96, 0, 0, 95, 48 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; static yyconst yy_state_type yy_NUL_trans[367] = { 0, 14, 14, 57, 57, 60, 60, 80, 80, 113, 113, 123, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; extern int wcsulex_flex_debug; int wcsulex_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected static int yy_more_flag = 0; static int yy_more_len = 0; #define yymore() ((yy_more_flag) = 1) #define YY_MORE_ADJ (yy_more_len) #define YY_RESTORE_YY_MORE_OFFSET char *wcsulextext; #line 1 "wcsulex.l" /*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcsulex.c,v 4.19 2013/09/29 14:17:52 mcalabre Exp $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a * recursive, multi-buffered lexical scanner that parses FITS units * specifications. * * It requires Flex v2.5.4 or later. * * Refer to wcsunits.h for a description of the user interface and operating * notes. * *===========================================================================*/ /* Options. */ /* Exponents. */ /* Metric prefixes. */ /* Basic and derived SI units. */ /* Additional recognized units: all metric prefixes allowed. */ /* Additional recognized units: only super-metric prefixes allowed. */ /* Additional recognized units: only sub-metric prefixes allowed. */ /* Additional recognized units for which NO metric prefixes are allowed. */ /* All additional recognized units. */ /* Exclusive start states. */ #line 85 "wcsulex.l" /* To get the prototype for fileno() from stdio.h when gcc is invoked with * -std=c89 (same as -ansi) or -std=c99 since we do not define YY_INPUT. */ #define _POSIX_SOURCE 1 #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsunits.h" #include "wcsutil.h" #define YY_DECL int wcsulexe(const char unitstr[], int *func, double *scale, \ double units[WCSUNITS_NTYPE], struct wcserr **err) /* Used in preempting the call to exit() by yy_fatal_error(). */ jmp_buf wcsulex_abort_jmp_env; #define exit(status) longjmp(wcsulex_abort_jmp_env, status) #line 6932 "wcsulex.c" #define INITIAL 0 #define PAREN 1 #define PREFIX 2 #define UNITS 3 #define EXPON 4 #define FLUSH 5 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int wcsulexlex_destroy (void ); int wcsulexget_debug (void ); void wcsulexset_debug (int debug_flag ); YY_EXTRA_TYPE wcsulexget_extra (void ); void wcsulexset_extra (YY_EXTRA_TYPE user_defined ); FILE *wcsulexget_in (void ); void wcsulexset_in (FILE * in_str ); FILE *wcsulexget_out (void ); void wcsulexset_out (FILE * out_str ); int wcsulexget_leng (void ); char *wcsulexget_text (void ); int wcsulexget_lineno (void ); void wcsulexset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int wcsulexwrap (void ); #else extern int wcsulexwrap (void ); #endif #endif static void yyunput (int c,char *buf_ptr ); #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void ); #else static int input (void ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k */ #define YY_READ_BUF_SIZE 16384 #else #define YY_READ_BUF_SIZE 8192 #endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO do { if (fwrite( wcsulextext, wcsulexleng, 1, wcsulexout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ while ( (result = read( fileno(wcsulexin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(wcsulexin); \ }\ \ #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int wcsulexlex (void); #define YY_DECL int wcsulexlex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after wcsulextext and wcsulexleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ if ( wcsulexleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ (wcsulextext[wcsulexleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 108 "wcsulex.l" static const char *function = "wcsulexe"; char ctmp[72]; int bracket = 0; int operator = 0; int paren = 0; int status = 0; int func_r, i, j; double dexp, expon, factor, factor_r, types[WCSUNITS_NTYPE]; YY_BUFFER_STATE buf; void add(double *factor, double types[], double *expon, double *scale, double units[]); int wcsulexlex_destroy(void); if (err) *err = 0x0; *func = 0; for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] = 0.0; types[i] = 0.0; } expon = 1.0; factor = 1.0; *scale = 1.0; wcsulex_scan_string(unitstr); /* Return here via longjmp() invoked by yy_fatal_error(). */ if (setjmp(wcsulex_abort_jmp_env)) { return wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); } BEGIN(INITIAL); #ifdef DEBUG fprintf(stderr, "\n%s ->\n", unitstr); #endif #line 7152 "wcsulex.c" if ( !(yy_init) ) { (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! wcsulexin ) wcsulexin = stdin; if ( ! wcsulexout ) wcsulexout = stdout; if ( ! YY_CURRENT_BUFFER ) { wcsulexensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); } wcsulex_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { (yy_more_len) = 0; if ( (yy_more_flag) ) { (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); (yy_more_flag) = 0; } yy_cp = (yy_c_buf_p); /* Support of wcsulextext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); yy_match: while ( (yy_current_state = yy_nxt[yy_current_state][ YY_SC_TO_UI(*yy_cp) ]) > 0 ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } ++yy_cp; } yy_current_state = -yy_current_state; yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = (yy_hold_char); yy_cp = (yy_last_accepting_cpos) + 1; yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP #line 148 "wcsulex.l" { /* Pretend initial whitespace doesn't exist. */ yy_set_bol(1); } YY_BREAK case 2: YY_RULE_SETUP #line 153 "wcsulex.l" { if (bracket++) { BEGIN(FLUSH); } else { yy_set_bol(1); } } YY_BREAK case 3: YY_RULE_SETUP #line 161 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_NUM_MULTIPLIER), "Invalid exponent in '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 4: YY_RULE_SETUP #line 167 "wcsulex.l" { factor = 10.0; BEGIN(EXPON); } YY_BREAK case 5: YY_RULE_SETUP #line 172 "wcsulex.l" { *func = 1; unput('('); BEGIN(PAREN); } YY_BREAK case 6: YY_RULE_SETUP #line 178 "wcsulex.l" { *func = 2; unput('('); BEGIN(PAREN); } YY_BREAK case 7: YY_RULE_SETUP #line 184 "wcsulex.l" { *func = 3; unput('('); BEGIN(PAREN); } YY_BREAK case 8: YY_RULE_SETUP #line 190 "wcsulex.l" { /* Leading binary multiply. */ status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP), "Dangling binary operator in '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 9: YY_RULE_SETUP #line 197 "wcsulex.l" /* Discard whitespace in INITIAL context. */ YY_BREAK case 10: YY_RULE_SETUP #line 199 "wcsulex.l" { expon /= 2.0; unput('('); BEGIN(PAREN); } YY_BREAK case 11: YY_RULE_SETUP #line 205 "wcsulex.l" { /* Gather terms in parentheses. */ yyless(0); BEGIN(PAREN); } YY_BREAK case 12: YY_RULE_SETUP #line 211 "wcsulex.l" { if (operator++) { BEGIN(FLUSH); } } YY_BREAK case 13: #line 218 "wcsulex.l" case 14: YY_RULE_SETUP #line 218 "wcsulex.l" { if (operator++) { BEGIN(FLUSH); } else { expon *= -1.0; } } YY_BREAK case 15: YY_RULE_SETUP #line 226 "wcsulex.l" { operator = 0; yyless(0); BEGIN(UNITS); } YY_BREAK case 16: #line 233 "wcsulex.l" case 17: #line 234 "wcsulex.l" case 18: YY_RULE_SETUP #line 234 "wcsulex.l" { operator = 0; yyless(0); BEGIN(PREFIX); } YY_BREAK case 19: YY_RULE_SETUP #line 240 "wcsulex.l" { bracket = !bracket; BEGIN(FLUSH); } YY_BREAK case 20: YY_RULE_SETUP #line 245 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_INITIAL_SYMBOL), "Invalid symbol in INITIAL context in '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 21: YY_RULE_SETUP #line 251 "wcsulex.l" { paren++; operator = 0; yymore(); } YY_BREAK case 22: YY_RULE_SETUP #line 257 "wcsulex.l" { paren--; if (paren) { /* Not balanced yet. */ yymore(); } else { /* Balanced; strip off the outer parentheses and recurse. */ wcsulextext[wcsulexleng-1] = '\0'; buf = YY_CURRENT_BUFFER; status = wcsulexe(wcsulextext+1, &func_r, &factor_r, types, err); wcsulex_switch_to_buffer(buf); if (func_r) { status = wcserr_set(WCSERR_SET(UNITSERR_FUNCTION_CONTEXT), "Function in invalid context in '%s'", unitstr); } if (status) { BEGIN(FLUSH); } else { factor *= factor_r; BEGIN(EXPON); } } } YY_BREAK case 23: /* rule 23 can match eol */ YY_RULE_SETUP #line 285 "wcsulex.l" { yymore(); } YY_BREAK case 24: YY_RULE_SETUP #line 289 "wcsulex.l" { factor = 1e-1; BEGIN(UNITS); } YY_BREAK case 25: YY_RULE_SETUP #line 294 "wcsulex.l" { factor = 1e-2; BEGIN(UNITS); } YY_BREAK case 26: YY_RULE_SETUP #line 299 "wcsulex.l" { factor = 1e-3; BEGIN(UNITS); } YY_BREAK case 27: YY_RULE_SETUP #line 304 "wcsulex.l" { factor = 1e-6; BEGIN(UNITS); } YY_BREAK case 28: YY_RULE_SETUP #line 309 "wcsulex.l" { factor = 1e-9; BEGIN(UNITS); } YY_BREAK case 29: YY_RULE_SETUP #line 314 "wcsulex.l" { factor = 1e-12; BEGIN(UNITS); } YY_BREAK case 30: YY_RULE_SETUP #line 319 "wcsulex.l" { factor = 1e-15; BEGIN(UNITS); } YY_BREAK case 31: YY_RULE_SETUP #line 324 "wcsulex.l" { factor = 1e-18; BEGIN(UNITS); } YY_BREAK case 32: YY_RULE_SETUP #line 329 "wcsulex.l" { factor = 1e-21; BEGIN(UNITS); } YY_BREAK case 33: YY_RULE_SETUP #line 334 "wcsulex.l" { factor = 1e-24; BEGIN(UNITS); } YY_BREAK case 34: YY_RULE_SETUP #line 339 "wcsulex.l" { factor = 1e+1; BEGIN(UNITS); } YY_BREAK case 35: YY_RULE_SETUP #line 344 "wcsulex.l" { factor = 1e+2; BEGIN(UNITS); } YY_BREAK case 36: YY_RULE_SETUP #line 349 "wcsulex.l" { factor = 1e+3; BEGIN(UNITS); } YY_BREAK case 37: YY_RULE_SETUP #line 354 "wcsulex.l" { factor = 1e+6; BEGIN(UNITS); } YY_BREAK case 38: YY_RULE_SETUP #line 359 "wcsulex.l" { factor = 1e+9; BEGIN(UNITS); } YY_BREAK case 39: YY_RULE_SETUP #line 364 "wcsulex.l" { factor = 1e+12; BEGIN(UNITS); } YY_BREAK case 40: YY_RULE_SETUP #line 369 "wcsulex.l" { factor = 1e+15; BEGIN(UNITS); } YY_BREAK case 41: YY_RULE_SETUP #line 374 "wcsulex.l" { factor = 1e+18; BEGIN(UNITS); } YY_BREAK case 42: YY_RULE_SETUP #line 379 "wcsulex.l" { factor = 1e+21; BEGIN(UNITS); } YY_BREAK case 43: YY_RULE_SETUP #line 384 "wcsulex.l" { factor = 1e+24; BEGIN(UNITS); } YY_BREAK case 44: YY_RULE_SETUP #line 389 "wcsulex.l" { /* Internal parser error. */ status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 45: YY_RULE_SETUP #line 396 "wcsulex.l" { /* Ampere. */ types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_TIME] -= 1.0; BEGIN(EXPON); } YY_BREAK case 46: YY_RULE_SETUP #line 403 "wcsulex.l" { /* Year (annum). */ factor *= 31557600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } YY_BREAK case 47: YY_RULE_SETUP #line 410 "wcsulex.l" { /* Analogue-to-digital converter units. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } YY_BREAK case 48: YY_RULE_SETUP #line 416 "wcsulex.l" { /* Angstrom. */ factor *= 1e-10; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 49: YY_RULE_SETUP #line 423 "wcsulex.l" { /* Minute of arc. */ factor /= 60.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 50: YY_RULE_SETUP #line 430 "wcsulex.l" { /* Second of arc. */ factor /= 3600.0; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 51: YY_RULE_SETUP #line 437 "wcsulex.l" { /* Astronomical unit. */ factor *= 1.49598e+11; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 52: YY_RULE_SETUP #line 444 "wcsulex.l" { /* Barn. */ factor *= 1e-28; types[WCSUNITS_LENGTH] += 2.0; BEGIN(EXPON); } YY_BREAK case 53: YY_RULE_SETUP #line 451 "wcsulex.l" { /* Beam, as in Jy/beam. */ types[WCSUNITS_BEAM] += 1.0; BEGIN(EXPON); } YY_BREAK case 54: YY_RULE_SETUP #line 457 "wcsulex.l" { /* Bin (e.g. histogram). */ types[WCSUNITS_BIN] += 1.0; BEGIN(EXPON); } YY_BREAK case 55: YY_RULE_SETUP #line 463 "wcsulex.l" { /* Bit. */ types[WCSUNITS_BIT] += 1.0; BEGIN(EXPON); } YY_BREAK case 56: YY_RULE_SETUP #line 469 "wcsulex.l" { /* Byte. */ factor *= 8.0; types[WCSUNITS_BIT] += 1.0; BEGIN(EXPON); } YY_BREAK case 57: YY_RULE_SETUP #line 476 "wcsulex.l" { /* Coulomb. */ types[WCSUNITS_CHARGE] += 1.0; BEGIN(EXPON); } YY_BREAK case 58: YY_RULE_SETUP #line 482 "wcsulex.l" { /* Candela. */ types[WCSUNITS_LUMINTEN] += 1.0; BEGIN(EXPON); } YY_BREAK case 59: YY_RULE_SETUP #line 488 "wcsulex.l" { /* Channel. */ types[WCSUNITS_BIN] += 1.0; BEGIN(EXPON); } YY_BREAK case 60: YY_RULE_SETUP #line 494 "wcsulex.l" { /* Count. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } YY_BREAK case 61: YY_RULE_SETUP #line 500 "wcsulex.l" { /* Debye. */ factor *= 1e-29 / 3.0; types[WCSUNITS_CHARGE] += 1.0; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 62: YY_RULE_SETUP #line 508 "wcsulex.l" { /* Day. */ factor *= 86400.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } YY_BREAK case 63: YY_RULE_SETUP #line 515 "wcsulex.l" { /* Degree. */ types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 64: YY_RULE_SETUP #line 521 "wcsulex.l" { /* Erg. */ factor *= 1e-7; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 65: YY_RULE_SETUP #line 530 "wcsulex.l" { /* Electron volt. */ factor *= 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 66: YY_RULE_SETUP #line 539 "wcsulex.l" { /* Farad. */ types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 3.0; types[WCSUNITS_CHARGE] += 2.0; BEGIN(EXPON); } YY_BREAK case 67: YY_RULE_SETUP #line 548 "wcsulex.l" { /* Gauss. */ factor *= 1e-4; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } YY_BREAK case 68: YY_RULE_SETUP #line 557 "wcsulex.l" { /* Gram. */ factor *= 1e-3; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } YY_BREAK case 69: YY_RULE_SETUP #line 564 "wcsulex.l" { /* Henry. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 2.0; types[WCSUNITS_CHARGE] -= 2.0; BEGIN(EXPON); } YY_BREAK case 70: YY_RULE_SETUP #line 573 "wcsulex.l" { /* Hour. */ factor *= 3600.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } YY_BREAK case 71: YY_RULE_SETUP #line 580 "wcsulex.l" { /* Hertz. */ types[WCSUNITS_TIME] -= 1.0; BEGIN(EXPON); } YY_BREAK case 72: YY_RULE_SETUP #line 586 "wcsulex.l" { /* Joule. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 73: YY_RULE_SETUP #line 594 "wcsulex.l" { /* Jansky. */ factor *= 1e-26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 74: YY_RULE_SETUP #line 602 "wcsulex.l" { /* Kelvin. */ types[WCSUNITS_TEMPERATURE] += 1.0; BEGIN(EXPON); } YY_BREAK case 75: YY_RULE_SETUP #line 608 "wcsulex.l" { /* Lumen. */ types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 76: YY_RULE_SETUP #line 615 "wcsulex.l" { /* Lux. */ types[WCSUNITS_LUMINTEN] += 1.0; types[WCSUNITS_SOLID_ANGLE] += 1.0; types[WCSUNITS_LENGTH] -= 2.0; BEGIN(EXPON); } YY_BREAK case 77: YY_RULE_SETUP #line 623 "wcsulex.l" { /* Light year. */ factor *= 2.99792458e8 * 31557600.0; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 78: YY_RULE_SETUP #line 630 "wcsulex.l" { /* Metre. */ types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 79: YY_RULE_SETUP #line 636 "wcsulex.l" { /* Stellar magnitude. */ types[WCSUNITS_MAGNITUDE] += 1.0; BEGIN(EXPON); } YY_BREAK case 80: YY_RULE_SETUP #line 642 "wcsulex.l" { /* Milli-arcsec. */ factor /= 3600e+3; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 81: YY_RULE_SETUP #line 649 "wcsulex.l" { /* Minute. */ factor *= 60.0; types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } YY_BREAK case 82: YY_RULE_SETUP #line 656 "wcsulex.l" { /* Mole. */ types[WCSUNITS_MOLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 83: YY_RULE_SETUP #line 662 "wcsulex.l" { /* Newton. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 84: YY_RULE_SETUP #line 670 "wcsulex.l" { /* Ohm. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 1.0; types[WCSUNITS_CHARGE] -= 2.0; BEGIN(EXPON); } YY_BREAK case 85: YY_RULE_SETUP #line 679 "wcsulex.l" { /* Pascal. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] -= 1.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 86: YY_RULE_SETUP #line 687 "wcsulex.l" { /* Parsec. */ factor *= 3.0857e16; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 87: YY_RULE_SETUP #line 694 "wcsulex.l" { /* Photon. */ types[WCSUNITS_COUNT] += 1.0; BEGIN(EXPON); } YY_BREAK case 88: YY_RULE_SETUP #line 700 "wcsulex.l" { /* Pixel. */ types[WCSUNITS_PIXEL] += 1.0; BEGIN(EXPON); } YY_BREAK case 89: YY_RULE_SETUP #line 706 "wcsulex.l" { /* Rayleigh. */ factor *= 1e10 / (4.0 * PI); types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] -= 1.0; types[WCSUNITS_SOLID_ANGLE] -= 1.0; BEGIN(EXPON); } YY_BREAK case 90: YY_RULE_SETUP #line 715 "wcsulex.l" { /* Radian. */ factor *= 180.0 / PI; types[WCSUNITS_PLANE_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 91: YY_RULE_SETUP #line 722 "wcsulex.l" { /* Rydberg. */ factor *= 13.605692 * 1.6021765e-19; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 2.0; BEGIN(EXPON); } YY_BREAK case 92: YY_RULE_SETUP #line 731 "wcsulex.l" { /* Siemen. */ types[WCSUNITS_MASS] -= 1.0; types[WCSUNITS_LENGTH] -= 2.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] += 2.0; BEGIN(EXPON); } YY_BREAK case 93: YY_RULE_SETUP #line 740 "wcsulex.l" { /* Second. */ types[WCSUNITS_TIME] += 1.0; BEGIN(EXPON); } YY_BREAK case 94: YY_RULE_SETUP #line 746 "wcsulex.l" { /* Solar luminosity. */ factor *= 3.8268e26; types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; BEGIN(EXPON); } YY_BREAK case 95: YY_RULE_SETUP #line 755 "wcsulex.l" { /* Solar mass. */ factor *= 1.9891e30; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } YY_BREAK case 96: YY_RULE_SETUP #line 762 "wcsulex.l" { /* Solar radius. */ factor *= 6.9599e8; types[WCSUNITS_LENGTH] += 1.0; BEGIN(EXPON); } YY_BREAK case 97: YY_RULE_SETUP #line 769 "wcsulex.l" { /* Steradian. */ types[WCSUNITS_SOLID_ANGLE] += 1.0; BEGIN(EXPON); } YY_BREAK case 98: YY_RULE_SETUP #line 775 "wcsulex.l" { /* Sun (with respect to). */ types[WCSUNITS_SOLRATIO] += 1.0; BEGIN(EXPON); } YY_BREAK case 99: YY_RULE_SETUP #line 781 "wcsulex.l" { /* Tesla. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } YY_BREAK case 100: YY_RULE_SETUP #line 789 "wcsulex.l" { /* Unified atomic mass unit. */ factor *= 1.6605387e-27; types[WCSUNITS_MASS] += 1.0; BEGIN(EXPON); } YY_BREAK case 101: YY_RULE_SETUP #line 796 "wcsulex.l" { /* Volt. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 1.0; types[WCSUNITS_TIME] -= 2.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } YY_BREAK case 102: YY_RULE_SETUP #line 805 "wcsulex.l" { /* Voxel. */ types[WCSUNITS_VOXEL] += 1.0; BEGIN(EXPON); } YY_BREAK case 103: YY_RULE_SETUP #line 811 "wcsulex.l" { /* Watt. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] -= 3.0; BEGIN(EXPON); } YY_BREAK case 104: YY_RULE_SETUP #line 819 "wcsulex.l" { /* Weber. */ types[WCSUNITS_MASS] += 1.0; types[WCSUNITS_LENGTH] += 2.0; types[WCSUNITS_TIME] += 1.0; types[WCSUNITS_CHARGE] -= 1.0; BEGIN(EXPON); } YY_BREAK case 105: YY_RULE_SETUP #line 828 "wcsulex.l" { /* Internal parser error. */ status = wcserr_set(WCSERR_SET(UNITSERR_PARSER_ERROR), "Internal units parser error parsing '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 106: YY_RULE_SETUP #line 835 "wcsulex.l" { /* Exponentiation. */ if (operator++) { BEGIN(FLUSH); } } YY_BREAK case 107: YY_RULE_SETUP #line 842 "wcsulex.l" { sscanf(wcsulextext, " %d", &i); expon *= (double)i; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } YY_BREAK case 108: YY_RULE_SETUP #line 850 "wcsulex.l" { sscanf(wcsulextext, " (%d)", &i); expon *= (double)i; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } YY_BREAK case 109: YY_RULE_SETUP #line 858 "wcsulex.l" { sscanf(wcsulextext, " (%d/%d)", &i, &j); expon *= (double)i / (double)j; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } YY_BREAK case 110: YY_RULE_SETUP #line 866 "wcsulex.l" { sscanf(wcsulextext, " (%s)", ctmp); wcsutil_str2double(ctmp, "%lf", &dexp); expon *= dexp; add(&factor, types, &expon, scale, units); operator = 0; BEGIN(INITIAL); } YY_BREAK case 111: YY_RULE_SETUP #line 875 "wcsulex.l" { /* Multiply. */ if (operator++) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); BEGIN(INITIAL); } } YY_BREAK case 112: YY_RULE_SETUP #line 885 "wcsulex.l" { /* Multiply. */ if (operator) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); unput('('); BEGIN(INITIAL); } } YY_BREAK case 113: YY_RULE_SETUP #line 896 "wcsulex.l" { /* Multiply. */ if (operator) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); BEGIN(INITIAL); } } YY_BREAK case 114: YY_RULE_SETUP #line 906 "wcsulex.l" { /* Divide. */ if (operator++) { BEGIN(FLUSH); } else { add(&factor, types, &expon, scale, units); expon = -1.0; BEGIN(INITIAL); } } YY_BREAK case 115: YY_RULE_SETUP #line 917 "wcsulex.l" { add(&factor, types, &expon, scale, units); bracket = !bracket; BEGIN(FLUSH); } YY_BREAK case 116: YY_RULE_SETUP #line 923 "wcsulex.l" { status = wcserr_set(WCSERR_SET(UNITSERR_BAD_EXPON_SYMBOL), "Invalid symbol in EXPON context in '%s'", unitstr); BEGIN(FLUSH); } YY_BREAK case 117: YY_RULE_SETUP #line 929 "wcsulex.l" { /* Discard any remaining input. */ } YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(PAREN): case YY_STATE_EOF(PREFIX): case YY_STATE_EOF(UNITS): case YY_STATE_EOF(EXPON): case YY_STATE_EOF(FLUSH): #line 933 "wcsulex.l" { /* End-of-string. */ if (YY_START == EXPON) { add(&factor, types, &expon, scale, units); } wcsulexlex_destroy(); if (bracket) { status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_BRACKET), "Unbalanced bracket in '%s'", unitstr); } else if (paren) { status = wcserr_set(WCSERR_SET(UNITSERR_UNBAL_PAREN), "Unbalanced parenthesis in '%s'", unitstr); } else if (operator == 1) { status = wcserr_set(WCSERR_SET(UNITSERR_DANGLING_BINOP), "Dangling binary operator in '%s'", unitstr); } else if (operator) { status = wcserr_set(WCSERR_SET(UNITSERR_CONSEC_BINOPS), "Consecutive binary operators in '%s'", unitstr); #ifdef DEBUG } else { fprintf(stderr, "EOS\n"); #endif } if (status) { for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] = 0.0; *scale = 0.0; } } return status; } YY_BREAK case 118: YY_RULE_SETUP #line 969 "wcsulex.l" ECHO; YY_BREAK #line 8409 "wcsulex.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed wcsulexin at a new source and called * wcsulexlex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = wcsulexin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = (yy_c_buf_p); goto yy_find_action; } } else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (yy_did_buffer_switch_on_eof) = 0; if ( wcsulexwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * wcsulextext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; yy_current_state = yy_get_previous_state( ); yy_cp = (yy_c_buf_p); yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of wcsulexlex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ wcsulexrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; wcsulexrestart(wcsulexin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) wcsulexrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state (void) { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { if ( *yy_cp ) { yy_current_state = yy_nxt[yy_current_state][YY_SC_TO_UI(*yy_cp)]; } else yy_current_state = yy_NUL_trans[yy_current_state]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; register char *yy_cp = (yy_c_buf_p); yy_current_state = yy_NUL_trans[yy_current_state]; yy_is_jam = (yy_current_state == 0); if ( ! yy_is_jam ) { if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; (yy_last_accepting_cpos) = yy_cp; } } return yy_is_jam ? 0 : yy_current_state; } static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; yy_cp = (yy_c_buf_p); /* undo effects of setting up wcsulextext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (yy_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; (yytext_ptr) = yy_bp; (yy_hold_char) = *yy_cp; (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) #else static int input (void) #endif { int c; *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ *(yy_c_buf_p) = '\0'; else { /* need more input */ int offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ wcsulexrestart(wcsulexin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( wcsulexwrap( ) ) return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ *(yy_c_buf_p) = '\0'; /* preserve wcsulextext */ (yy_hold_char) = *++(yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void wcsulexrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ wcsulexensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = wcsulex_create_buffer(wcsulexin,YY_BUF_SIZE ); } wcsulex_init_buffer(YY_CURRENT_BUFFER,input_file ); wcsulex_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void wcsulex_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * wcsulexpop_buffer_state(); * wcsulexpush_buffer_state(new_buffer); */ wcsulexensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; wcsulex_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (wcsulexwrap()) processing, but the only time this flag * is looked at is after wcsulexwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } static void wcsulex_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; wcsulexin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE wcsulex_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) wcsulexalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsulex_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) wcsulexalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsulex_create_buffer()" ); b->yy_is_our_buffer = 1; wcsulex_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with wcsulex_create_buffer() * */ void wcsulex_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) wcsulexfree((void *) b->yy_ch_buf ); wcsulexfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a wcsulexrestart() or at EOF. */ static void wcsulex_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; wcsulex_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; /* If b is the current buffer, then wcsulex_init_buffer was _probably_ * called from wcsulexrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->yy_bs_lineno = 1; b->yy_bs_column = 0; } b->yy_is_interactive = 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void wcsulex_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) wcsulex_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void wcsulexpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; wcsulexensure_buffer_stack(); /* This block is copied from wcsulex_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(yy_c_buf_p) = (yy_hold_char); YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from wcsulex_switch_to_buffer. */ wcsulex_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void wcsulexpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; wcsulex_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { wcsulex_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void wcsulexensure_buffer_stack (void) { int num_to_alloc; if (!(yy_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (yy_buffer_stack) = (struct yy_buffer_state**)wcsulexalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsulexensure_buffer_stack()" ); memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; } if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)wcsulexrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in wcsulexensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsulex_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) wcsulexalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in wcsulex_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; wcsulex_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to wcsulexlex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * wcsulex_scan_bytes() instead. */ YY_BUFFER_STATE wcsulex_scan_string (yyconst char * yystr ) { return wcsulex_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to wcsulexlex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE wcsulex_scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; buf = (char *) wcsulexalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in wcsulex_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = wcsulex_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in wcsulex_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void yy_fatal_error (yyconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up wcsulextext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ wcsulextext[wcsulexleng] = (yy_hold_char); \ (yy_c_buf_p) = wcsulextext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ wcsulexleng = yyless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int wcsulexget_lineno (void) { return wcsulexlineno; } /** Get the input stream. * */ FILE *wcsulexget_in (void) { return wcsulexin; } /** Get the output stream. * */ FILE *wcsulexget_out (void) { return wcsulexout; } /** Get the length of the current token. * */ int wcsulexget_leng (void) { return wcsulexleng; } /** Get the current token. * */ char *wcsulexget_text (void) { return wcsulextext; } /** Set the current line number. * @param line_number * */ void wcsulexset_lineno (int line_number ) { wcsulexlineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see wcsulex_switch_to_buffer */ void wcsulexset_in (FILE * in_str ) { wcsulexin = in_str ; } void wcsulexset_out (FILE * out_str ) { wcsulexout = out_str ; } int wcsulexget_debug (void) { return wcsulex_flex_debug; } void wcsulexset_debug (int bdebug ) { wcsulex_flex_debug = bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from wcsulexlex_destroy(), so don't allocate here. */ (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT wcsulexin = stdin; wcsulexout = stdout; #else wcsulexin = (FILE *) 0; wcsulexout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * wcsulexlex_init() */ return 0; } /* wcsulexlex_destroy is for both reentrant and non-reentrant scanners. */ int wcsulexlex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ wcsulex_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; wcsulexpop_buffer_state(); } /* Destroy the stack itself. */ wcsulexfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * wcsulexlex() is called, initialization will occur. */ yy_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *wcsulexalloc (yy_size_t size ) { return (void *) malloc( size ); } void *wcsulexrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } void wcsulexfree (void * ptr ) { free( (char *) ptr ); /* see wcsulexrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 969 "wcsulex.l" /*---------------------------------------------------------------------------- * Accumulate a term in a units specification and reset work variables. *---------------------------------------------------------------------------*/ void add( double *factor, double types[], double *expon, double *scale, double units[]) { int i; *scale *= pow(*factor, *expon); for (i = 0; i < WCSUNITS_NTYPE; i++) { units[i] += *expon * types[i]; types[i] = 0.0; } *expon = 1.0; *factor = 1.0; return; } astropy-0.3/cextern/wcslib/C/cel.h0000644000175000017500000004225312243255342015236 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: cel.h,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *============================================================================= * * WCSLIB 4.19 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to * * "Representations of world coordinates in FITS", * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) * * "Representations of celestial coordinates in FITS", * Calabretta, M.R., & Greisen, E.W. 2002, A&A, 395, 1077 (Paper II) * * Refer to the README file provided with WCSLIB for an overview of the * library. * * * Summary of the cel routines * --------------------------- * These routines implement the part of the FITS World Coordinate System (WCS) * standard that deals with celestial coordinates. They define methods to be * used for computing celestial world coordinates from intermediate world * coordinates (a linear transformation of image pixel coordinates), and vice * versa. They are based on the celprm struct which contains all information * needed for the computations. This struct contains some elements that must * be set by the user, and others that are maintained by these routines, * somewhat like a C++ class but with no encapsulation. * * Routine celini() is provided to initialize the celprm struct with default * values, celfree() reclaims any memory that may have been allocated to store * an error message, and celprt() prints its contents. * * A setup routine, celset(), computes intermediate values in the celprm struct * from parameters in it that were supplied by the user. The struct always * needs to be set up by celset() but it need not be called explicitly - refer * to the explanation of celprm::flag. * * celx2s() and cels2x() implement the WCS celestial coordinate * transformations. In fact, they are high level driver routines for the lower * level spherical coordinate rotation and projection routines described in * sph.h and prj.h. * * * celini() - Default constructor for the celprm struct * ---------------------------------------------------- * celini() sets all members of a celprm struct to default values. It should * be used to initialize every celprm struct. * * Returned: * cel struct celprm* * Celestial transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * * * celfree() - Destructor for the celprm struct * -------------------------------------------- * celfree() frees any memory that may have been allocated to store an error * message in the celprm struct. * * Given: * cel struct celprm* * Celestial transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * * * celprt() - Print routine for the celprm struct * ---------------------------------------------- * celprt() prints the contents of a celprm struct using wcsprintf(). Mainly * intended for diagnostic purposes. * * Given: * cel const struct celprm* * Celestial transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * * * celset() - Setup routine for the celprm struct * ---------------------------------------------- * celset() sets up a celprm struct according to information supplied within * it. * * Note that this routine need not be called directly; it will be invoked by * celx2s() and cels2x() if celprm::flag is anything other than a predefined * magic value. * * Given and returned: * cel struct celprm* * Celestial transformation parameters. * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * 2: Invalid projection parameters. * 3: Invalid coordinate transformation parameters. * 4: Ill-conditioned coordinate transformation * parameters. * * For returns > 1, a detailed error message is set in * celprm::err if enabled, see wcserr_enable(). * * * celx2s() - Pixel-to-world celestial transformation * -------------------------------------------------- * celx2s() transforms (x,y) coordinates in the plane of projection to * celestial coordinates (lng,lat). * * Given and returned: * cel struct celprm* * Celestial transformation parameters. * * Given: * nx,ny int Vector lengths. * * sxy,sll int Vector strides. * * x,y const double[] * Projected coordinates in pseudo "degrees". * * Returned: * phi,theta double[] Longitude and latitude (phi,theta) in the native * coordinate system of the projection [deg]. * * lng,lat double[] Celestial longitude and latitude (lng,lat) of the * projected point [deg]. * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (x,y). * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * 2: Invalid projection parameters. * 3: Invalid coordinate transformation parameters. * 4: Ill-conditioned coordinate transformation * parameters. * 5: One or more of the (x,y) coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * celprm::err if enabled, see wcserr_enable(). * * * cels2x() - World-to-pixel celestial transformation * -------------------------------------------------- * cels2x() transforms celestial coordinates (lng,lat) to (x,y) coordinates in * the plane of projection. * * Given and returned: * cel struct celprm* * Celestial transformation parameters. * * Given: * nlng,nlat int Vector lengths. * * sll,sxy int Vector strides. * * lng,lat const double[] * Celestial longitude and latitude (lng,lat) of the * projected point [deg]. * * Returned: * phi,theta double[] Longitude and latitude (phi,theta) in the native * coordinate system of the projection [deg]. * * x,y double[] Projected coordinates in pseudo "degrees". * * stat int[] Status return value for each vector element: * 0: Success. * 1: Invalid value of (lng,lat). * * Function return value: * int Status return value: * 0: Success. * 1: Null celprm pointer passed. * 2: Invalid projection parameters. * 3: Invalid coordinate transformation parameters. * 4: Ill-conditioned coordinate transformation * parameters. * 6: One or more of the (lng,lat) coordinates were * invalid, as indicated by the stat vector. * * For returns > 1, a detailed error message is set in * celprm::err if enabled, see wcserr_enable(). * * * celprm struct - Celestial transformation parameters * --------------------------------------------------- * The celprm struct contains information required to transform celestial * coordinates. It consists of certain members that must be set by the user * ("given") and others that are set by the WCSLIB routines ("returned"). Some * of the latter are supplied for informational purposes and others are for * internal use only. * * Returned celprm struct members must not be modified by the user. * * int flag * (Given and returned) This flag must be set to zero whenever any of the * following celprm struct members are set or changed: * * - celprm::offset, * - celprm::phi0, * - celprm::theta0, * - celprm::ref[4], * - celprm::prj: * - prjprm::code, * - prjprm::r0, * - prjprm::pv[], * - prjprm::phi0, * - prjprm::theta0. * * This signals the initialization routine, celset(), to recompute the * returned members of the celprm struct. celset() will reset flag to * indicate that this has been done. * * int offset * (Given) If true (non-zero), an offset will be applied to (x,y) to * force (x,y) = (0,0) at the fiducial point, (phi_0,theta_0). * Default is 0 (false). * * double phi0 * (Given) The native longitude, phi_0 [deg], and ... * * double theta0 * (Given) ... the native latitude, theta_0 [deg], of the fiducial point, * i.e. the point whose celestial coordinates are given in * celprm::ref[1:2]. If undefined (set to a magic value by prjini()) the * initialization routine, celset(), will set this to a projection-specific * default. * * double ref[4] * (Given) The first pair of values should be set to the celestial * longitude and latitude of the fiducial point [deg] - typically right * ascension and declination. These are given by the CRVALia keywords in * FITS. * * (Given and returned) The second pair of values are the native longitude, * phi_p [deg], and latitude, theta_p [deg], of the celestial pole (the * latter is the same as the celestial latitude of the native pole, * delta_p) and these are given by the FITS keywords LONPOLEa and LATPOLEa * (or by PVi_2a and PVi_3a attached to the longitude axis which take * precedence if defined). * * LONPOLEa defaults to phi_0 (see above) if the celestial latitude of the * fiducial point of the projection is greater than or equal to the native * latitude, otherwise phi_0 + 180 [deg]. (This is the condition for the * celestial latitude to increase in the same direction as the native * latitude at the fiducial point.) ref[2] may be set to UNDEFINED (from * wcsmath.h) or 999.0 to indicate that the correct default should be * substituted. * * theta_p, the native latitude of the celestial pole (or equally the * celestial latitude of the native pole, delta_p) is often determined * uniquely by CRVALia and LONPOLEa in which case LATPOLEa is ignored. * However, in some circumstances there are two valid solutions for theta_p * and LATPOLEa is used to choose between them. LATPOLEa is set in ref[3] * and the solution closest to this value is used to reset ref[3]. It is * therefore legitimate, for example, to set ref[3] to +90.0 to choose the * more northerly solution - the default if the LATPOLEa keyword is omitted * from the FITS header. For the special case where the fiducial point of * the projection is at native latitude zero, its celestial latitude is * zero, and LONPOLEa = +/- 90.0 then the celestial latitude of the native * pole is not determined by the first three reference values and LATPOLEa * specifies it completely. * * The returned value, celprm::latpreq, specifies how LATPOLEa was actually * used. * * struct prjprm prj * (Given and returned) Projection parameters described in the prologue to * prj.h. * * double euler[5] * (Returned) Euler angles and associated intermediaries derived from the * coordinate reference values. The first three values are the Z-, X-, and * Z'-Euler angles [deg], and the remaining two are the cosine and sine of * the X-Euler angle. * * int latpreq * (Returned) For informational purposes, this indicates how the LATPOLEa * keyword was used * - 0: Not required, theta_p (== delta_p) was determined uniquely by the * CRVALia and LONPOLEa keywords. * - 1: Required to select between two valid solutions of theta_p. * - 2: theta_p was specified solely by LATPOLEa. * * int isolat * (Returned) True if the spherical rotation preserves the magnitude of the * latitude, which occurs iff the axes of the native and celestial * coordinates are coincident. It signals an opportunity to cache * intermediate calculations common to all elements in a vector * computation. * * struct wcserr *err * (Returned) If enabled, when an error status is returned this struct * contains detailed information about the error, see wcserr_enable(). * * void *padding * (An unused variable inserted for alignment purposes only.) * * Global variable: const char *cel_errmsg[] - Status return messages * ------------------------------------------------------------------ * Status messages to match the status value returned from each function. * *===========================================================================*/ #ifndef WCSLIB_CEL #define WCSLIB_CEL #include "prj.h" #include "wcserr.h" #ifdef __cplusplus extern "C" { #endif extern const char *cel_errmsg[]; enum cel_errmsg_enum { CELERR_SUCCESS = 0, /* Success. */ CELERR_NULL_POINTER = 1, /* Null celprm pointer passed. */ CELERR_BAD_PARAM = 2, /* Invalid projection parameters. */ CELERR_BAD_COORD_TRANS = 3, /* Invalid coordinate transformation parameters. */ CELERR_ILL_COORD_TRANS = 4, /* Ill-conditioned coordinated transformation parameters. */ CELERR_BAD_PIX = 5, /* One or more of the (x,y) coordinates were invalid. */ CELERR_BAD_WORLD = 6 /* One or more of the (lng,lat) coordinates were invalid. */ }; struct celprm { /* Initialization flag (see the prologue above). */ /*------------------------------------------------------------------------*/ int flag; /* Set to zero to force initialization. */ /* Parameters to be provided (see the prologue above). */ /*------------------------------------------------------------------------*/ int offset; /* Force (x,y) = (0,0) at (phi_0,theta_0). */ double phi0, theta0; /* Native coordinates of fiducial point. */ double ref[4]; /* Celestial coordinates of fiducial */ /* point and native coordinates of */ /* celestial pole. */ struct prjprm prj; /* Projection parameters (see prj.h). */ /* Information derived from the parameters supplied. */ /*------------------------------------------------------------------------*/ double euler[5]; /* Euler angles and functions thereof. */ int latpreq; /* LATPOLEa requirement. */ int isolat; /* True if |latitude| is preserved. */ /* Error handling */ /*------------------------------------------------------------------------*/ struct wcserr *err; /* Private */ /*------------------------------------------------------------------------*/ void *padding; /* (Dummy inserted for alignment purposes.) */ }; /* Size of the celprm struct in int units, used by the Fortran wrappers. */ #define CELLEN (sizeof(struct celprm)/sizeof(int)) int celini(struct celprm *cel); int celfree(struct celprm *cel); int celprt(const struct celprm *cel); int celset(struct celprm *cel); int celx2s(struct celprm *cel, int nx, int ny, int sxy, int sll, const double x[], const double y[], double phi[], double theta[], double lng[], double lat[], int stat[]); int cels2x(struct celprm *cel, int nlng, int nlat, int sll, int sxy, const double lng[], const double lat[], double phi[], double theta[], double x[], double y[], int stat[]); /* Deprecated. */ #define celini_errmsg cel_errmsg #define celprt_errmsg cel_errmsg #define celset_errmsg cel_errmsg #define celx2s_errmsg cel_errmsg #define cels2x_errmsg cel_errmsg #ifdef __cplusplus } #endif #endif /* WCSLIB_CEL */ astropy-0.3/cextern/wcslib/C/wcs.c0000644000175000017500000025152112243255342015262 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: wcs.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "wcstrig.h" #include "wcsunits.h" #include "wcsutil.h" #include "lin.h" #include "log.h" #include "spc.h" #include "prj.h" #include "sph.h" #include "cel.h" #include "tab.h" #include "wcs.h" const int WCSSET = 137; /* Maximum number of PVi_ma and PSi_ma keywords. */ int NPVMAX = 64; int NPSMAX = 8; /* Map status return value to message. */ const char *wcs_errmsg[] = { "Success", "Null wcsprm pointer passed", "Memory allocation failed", "Linear transformation matrix is singular", "Inconsistent or unrecognized coordinate axis types", "Invalid parameter value", "Invalid coordinate transformation parameters", "Ill-conditioned coordinate transformation parameters", "One or more of the pixel coordinates were invalid", "One or more of the world coordinates were invalid", "Invalid world coordinate", "No solution found in the specified interval", "Invalid subimage specification", "Non-separable subimage coordinate system"}; /* Convenience macro for invoking wcserr_set(). */ #define WCS_ERRMSG(status) WCSERR_SET(status), wcs_errmsg[status] #ifndef signbit #define signbit(X) ((X) < 0.0 ? 1 : 0) #endif /* Internal helper functions, not for general use. */ static int wcs_types(struct wcsprm *); static int wcs_units(struct wcsprm *); /*--------------------------------------------------------------------------*/ int wcsnpv(int npvmax) { if (npvmax >= 0) NPVMAX = npvmax; return NPVMAX; } int wcsnps(int npsmax) { if (npsmax >= 0) NPSMAX = npsmax; return NPSMAX; } /*--------------------------------------------------------------------------*/ int wcsini(int alloc, int naxis, struct wcsprm *wcs) { static const char *function = "wcsini"; int i, j, k, status; double *cd; struct wcserr **err; if (wcs == 0x0) return WCSERR_NULL_POINTER; /* Initialize error message handling. */ err = &(wcs->err); if (wcs->flag != -1) { if (wcs->err) free(wcs->err); if (wcs->lin.err) free(wcs->lin.err); if (wcs->cel.err) free(wcs->cel.err); if (wcs->spc.err) free(wcs->spc.err); if (wcs->cel.prj.err) free(wcs->cel.prj.err); } wcs->err = 0x0; wcs->lin.err = 0x0; wcs->cel.err = 0x0; wcs->spc.err = 0x0; wcs->cel.prj.err = 0x0; /* Initialize pointers. */ if (wcs->flag == -1 || wcs->m_flag != WCSSET) { if (wcs->flag == -1) { wcs->types = 0x0; wcs->lin.flag = -1; wcs->tab = 0x0; } /* Initialize memory management. */ wcs->m_flag = 0; wcs->m_naxis = 0; wcs->m_crpix = 0x0; wcs->m_pc = 0x0; wcs->m_cdelt = 0x0; wcs->m_crval = 0x0; wcs->m_cunit = 0x0; wcs->m_ctype = 0x0; wcs->m_pv = 0x0; wcs->m_ps = 0x0; wcs->m_cd = 0x0; wcs->m_crota = 0x0; wcs->m_colax = 0x0; wcs->m_cname = 0x0; wcs->m_crder = 0x0; wcs->m_csyer = 0x0; wcs->m_tab = 0x0; wcs->m_wtb = 0x0; } if (naxis < 0) { return wcserr_set(WCSERR_SET(WCSERR_MEMORY), "naxis must not be negative (got %d)", naxis); } /* Allocate memory for arrays if required. */ if (alloc || wcs->crpix == 0x0 || wcs->pc == 0x0 || wcs->cdelt == 0x0 || wcs->crval == 0x0 || wcs->cunit == 0x0 || wcs->ctype == 0x0 || (NPVMAX && wcs->pv == 0x0) || (NPSMAX && wcs->ps == 0x0) || wcs->cd == 0x0 || wcs->crota == 0x0 || wcs->colax == 0x0 || wcs->cname == 0x0 || wcs->crder == 0x0 || wcs->csyer == 0x0) { /* Was sufficient allocated previously? */ if (wcs->m_flag == WCSSET && (wcs->m_naxis < naxis || wcs->npvmax < NPVMAX || wcs->npsmax < NPSMAX)) { /* No, free it. */ wcsfree(wcs); } if (alloc || wcs->crpix == 0x0) { if (wcs->m_crpix) { /* In case the caller fiddled with it. */ wcs->crpix = wcs->m_crpix; } else { if (!(wcs->crpix = calloc(naxis, sizeof(double)))) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_crpix = wcs->crpix; } } if (alloc || wcs->pc == 0x0) { if (wcs->m_pc) { /* In case the caller fiddled with it. */ wcs->pc = wcs->m_pc; } else { if (!(wcs->pc = calloc(naxis*naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_pc = wcs->pc; } } if (alloc || wcs->cdelt == 0x0) { if (wcs->m_cdelt) { /* In case the caller fiddled with it. */ wcs->cdelt = wcs->m_cdelt; } else { if (!(wcs->cdelt = calloc(naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_cdelt = wcs->cdelt; } } if (alloc || wcs->crval == 0x0) { if (wcs->m_crval) { /* In case the caller fiddled with it. */ wcs->crval = wcs->m_crval; } else { if (!(wcs->crval = calloc(naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_crval = wcs->crval; } } if (alloc || wcs->cunit == 0x0) { if (wcs->m_cunit) { /* In case the caller fiddled with it. */ wcs->cunit = wcs->m_cunit; } else { if (!(wcs->cunit = calloc(naxis, sizeof(char [72])))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_cunit = wcs->cunit; } } if (alloc || wcs->ctype == 0x0) { if (wcs->m_ctype) { /* In case the caller fiddled with it. */ wcs->ctype = wcs->m_ctype; } else { if (!(wcs->ctype = calloc(naxis, sizeof(char [72])))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_ctype = wcs->ctype; } } if (alloc || wcs->pv == 0x0) { if (wcs->m_pv) { /* In case the caller fiddled with it. */ wcs->pv = wcs->m_pv; } else { if (NPVMAX) { if (!(wcs->pv = calloc(NPVMAX, sizeof(struct pvcard)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } } else { wcs->pv = (struct pvcard *)0; } wcs->npvmax = NPVMAX; wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_pv = wcs->pv; } } if (alloc || wcs->ps == 0x0) { if (wcs->m_ps) { /* In case the caller fiddled with it. */ wcs->ps = wcs->m_ps; } else { if (NPSMAX) { if (!(wcs->ps = calloc(NPSMAX, sizeof(struct pscard)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } } else { wcs->ps = (struct pscard *)0; } wcs->npsmax = NPSMAX; wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_ps = wcs->ps; } } if (alloc || wcs->cd == 0x0) { if (wcs->m_cd) { /* In case the caller fiddled with it. */ wcs->cd = wcs->m_cd; } else { if (!(wcs->cd = calloc(naxis*naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_cd = wcs->cd; } } if (alloc || wcs->crota == 0x0) { if (wcs->m_crota) { /* In case the caller fiddled with it. */ wcs->crota = wcs->m_crota; } else { if (!(wcs->crota = calloc(naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_crota = wcs->crota; } } if (alloc || wcs->colax == 0x0) { if (wcs->m_colax) { /* In case the caller fiddled with it. */ wcs->colax = wcs->m_colax; } else { if (!(wcs->colax = calloc(naxis, sizeof(int)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_colax = wcs->colax; } } if (alloc || wcs->cname == 0x0) { if (wcs->m_cname) { /* In case the caller fiddled with it. */ wcs->cname = wcs->m_cname; } else { if (!(wcs->cname = calloc(naxis, sizeof(char [72])))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_cname = wcs->cname; } } if (alloc || wcs->crder == 0x0) { if (wcs->m_crder) { /* In case the caller fiddled with it. */ wcs->crder = wcs->m_crder; } else { if (!(wcs->crder = calloc(naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_crder = wcs->crder; } } if (alloc || wcs->csyer == 0x0) { if (wcs->m_csyer) { /* In case the caller fiddled with it. */ wcs->csyer = wcs->m_csyer; } else { if (!(wcs->csyer = calloc(naxis, sizeof(double)))) { wcsfree(wcs); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } wcs->m_flag = WCSSET; wcs->m_naxis = naxis; wcs->m_csyer = wcs->csyer; } } } wcs->flag = 0; wcs->naxis = naxis; /* Set defaults for the linear transformation. */ wcs->lin.crpix = wcs->crpix; wcs->lin.pc = wcs->pc; wcs->lin.cdelt = wcs->cdelt; wcs->lin.m_flag = 0; if ((status = linini(0, naxis, &(wcs->lin)))) { return wcserr_set(WCS_ERRMSG(status)); } /* CRVALia defaults to 0.0. */ for (i = 0; i < naxis; i++) { wcs->crval[i] = 0.0; } /* CUNITia and CTYPEia are blank by default. */ for (i = 0; i < naxis; i++) { memset(wcs->cunit[i], 0, 72); memset(wcs->ctype[i], 0, 72); } /* Set defaults for the celestial transformation parameters. */ wcs->lonpole = UNDEFINED; wcs->latpole = +90.0; /* Set defaults for the spectral transformation parameters. */ wcs->restfrq = 0.0; wcs->restwav = 0.0; /* Default parameter values. */ wcs->npv = 0; for (k = 0; k < wcs->npvmax; k++) { wcs->pv[k].i = 0; wcs->pv[k].m = 0; wcs->pv[k].value = 0.0; } wcs->nps = 0; for (k = 0; k < wcs->npsmax; k++) { wcs->ps[k].i = 0; wcs->ps[k].m = 0; memset(wcs->ps[k].value, 0, 72); } /* Defaults for alternate linear transformations. */ cd = wcs->cd; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { *(cd++) = 0.0; } } for (i = 0; i < naxis; i++) { wcs->crota[i] = 0.0; } wcs->altlin = 0; wcs->velref = 0; /* Defaults for auxiliary coordinate system information. */ memset(wcs->alt, 0, 4); wcs->alt[0] = ' '; wcs->colnum = 0; memset(wcs->wcsname, 0, 72); for (i = 0; i < naxis; i++) { wcs->colax[i] = 0; memset(wcs->cname[i], 0, 72); wcs->crder[i] = UNDEFINED; wcs->csyer[i] = UNDEFINED; } memset(wcs->radesys, 0, 72); wcs->equinox = UNDEFINED; memset(wcs->specsys, 0, 72); memset(wcs->ssysobs, 0, 72); wcs->velosys = UNDEFINED; memset(wcs->ssyssrc, 0, 72); wcs->zsource = UNDEFINED; wcs->obsgeo[0] = UNDEFINED; wcs->obsgeo[1] = UNDEFINED; wcs->obsgeo[2] = UNDEFINED; memset(wcs->dateobs, 0, 72); memset(wcs->dateavg, 0, 72); wcs->mjdobs = UNDEFINED; wcs->mjdavg = UNDEFINED; wcs->ntab = 0; wcs->tab = 0x0; wcs->nwtb = 0; wcs->wtb = 0x0; /* Reset derived values. */ strcpy(wcs->lngtyp, " "); strcpy(wcs->lattyp, " "); wcs->lng = -1; wcs->lat = -1; wcs->spec = -1; wcs->cubeface = -1; celini(&(wcs->cel)); spcini(&(wcs->spc)); return 0; } /*--------------------------------------------------------------------------*/ int wcssub( int alloc, const struct wcsprm *wcssrc, int *nsub, int axes[], struct wcsprm *wcsdst) { static const char *function = "wcssub"; char *c, ctypei[16]; int axis, cubeface, dealloc, dummy, i, itab, j, k, latitude, longitude, m, *map = 0x0, msub, naxis, npv, nps, other, spectral, status, stokes; const double *srcp; double *dstp; struct tabprm *tabp; struct wcserr **err; if (wcssrc == 0x0) return WCSERR_NULL_POINTER; if (wcsdst == 0x0) return WCSERR_NULL_POINTER; err = &(wcsdst->err); if ((naxis = wcssrc->naxis) <= 0) { return wcserr_set(WCSERR_SET(WCSERR_MEMORY), "naxis must be positive (got %d)", naxis); } if (!(map = calloc(naxis, sizeof(int)))) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } if (nsub == 0x0) { nsub = &dummy; *nsub = naxis; } else if (*nsub == 0) { *nsub = naxis; } if ((dealloc = (axes == 0x0))) { /* Construct an index array. */ if (!(axes = calloc(naxis, sizeof(int)))) { free(map); return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } for (i = 0; i < naxis; i++) { axes[i] = i+1; } } /* So that we don't try to free an uninitialized pointer on cleanup. */ wcsdst->m_tab = 0x0; msub = 0; for (j = 0; j < *nsub; j++) { axis = axes[j]; if (abs(axis) > 0x1000) { /* Subimage extraction by type. */ k = abs(axis) & 0xFF; longitude = k & WCSSUB_LONGITUDE; latitude = k & WCSSUB_LATITUDE; cubeface = k & WCSSUB_CUBEFACE; spectral = k & WCSSUB_SPECTRAL; stokes = k & WCSSUB_STOKES; if ((other = (axis < 0))) { longitude = !longitude; latitude = !latitude; cubeface = !cubeface; spectral = !spectral; stokes = !stokes; } for (i = 0; i < naxis; i++) { strncpy (ctypei, (char *)(wcssrc->ctype + i), 8); ctypei[8] = '\0'; /* Find the last non-blank character. */ c = ctypei + 8; while (c-- > ctypei) { if (*c == ' ') *c = '\0'; if (*c != '\0') break; } if ( strcmp(ctypei, "RA") == 0 || strcmp(ctypei+1, "LON") == 0 || strcmp(ctypei+2, "LN") == 0 || strncmp(ctypei, "RA---", 5) == 0 || strncmp(ctypei+1, "LON-", 4) == 0 || strncmp(ctypei+2, "LN-", 3) == 0) { if (!longitude) { continue; } } else if ( strcmp(ctypei, "DEC") == 0 || strcmp(ctypei+1, "LAT") == 0 || strcmp(ctypei+2, "LT") == 0 || strncmp(ctypei, "DEC--", 5) == 0 || strncmp(ctypei+1, "LAT-", 4) == 0 || strncmp(ctypei+2, "LT-", 3) == 0) { if (!latitude) { continue; } } else if (strcmp(ctypei, "CUBEFACE") == 0) { if (!cubeface) { continue; } } else if (( strncmp(ctypei, "FREQ", 4) == 0 || strncmp(ctypei, "ENER", 4) == 0 || strncmp(ctypei, "WAVN", 4) == 0 || strncmp(ctypei, "VRAD", 4) == 0 || strncmp(ctypei, "WAVE", 4) == 0 || strncmp(ctypei, "VOPT", 4) == 0 || strncmp(ctypei, "ZOPT", 4) == 0 || strncmp(ctypei, "AWAV", 4) == 0 || strncmp(ctypei, "VELO", 4) == 0 || strncmp(ctypei, "BETA", 4) == 0) && (ctypei[4] == '\0' || ctypei[4] == '-')) { if (!spectral) { continue; } } else if (strcmp(ctypei, "STOKES") == 0) { if (!stokes) { continue; } } else if (!other) { continue; } /* This axis is wanted, but has it already been added? */ for (k = 0; k < msub; k++) { if (map[k] == i+1) { break; } } if (k == msub) map[msub++] = i+1; } } else if (0 < axis && axis <= naxis) { /* Check that the requested axis has not already been added. */ for (k = 0; k < msub; k++) { if (map[k] == axis) { break; } } if (k == msub) map[msub++] = axis; } else if (axis == 0) { /* Graft on a new axis. */ map[msub++] = 0; } else { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_SUBIMAGE)); goto cleanup; } } if ((*nsub = msub) == 0) { status = wcsini(alloc, 0, wcsdst); goto cleanup; } for (i = 0; i < *nsub; i++) { axes[i] = map[i]; } /* Construct the inverse axis map: axes[i] == j means that output axis i+1 comes from input axis j, axes[i] == 0 means to create a new axis, map[i] == j means that input axis i+1 goes to output axis j, map[i] == 0 means that input axis i+1 is not used. */ for (i = 0; i < naxis; i++) { map[i] = 0; } for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { map[axes[i]-1] = i+1; } } /* Check that the subimage coordinate system is separable. */ if (*nsub < naxis) { srcp = wcssrc->pc; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { if (*(srcp++) == 0.0 || j == i) continue; if ((map[i] == 0) != (map[j] == 0)) { status = wcserr_set(WCS_ERRMSG(WCSERR_NON_SEPARABLE)); goto cleanup; } } } } /* Initialize the destination. */ npv = NPVMAX; nps = NPSMAX; NPVMAX = 0; for (k = 0; k < wcssrc->npv; k++) { i = wcssrc->pv[k].i; if (i == 0 || (i > 0 && map[i-1])) { NPVMAX++; } } NPSMAX = 0; for (k = 0; k < wcssrc->nps; k++) { i = wcssrc->ps[k].i; if (i > 0 && map[i-1]) { NPSMAX++; } } status = wcsini(alloc, *nsub, wcsdst); NPVMAX = npv; NPSMAX = nps; if (status) { goto cleanup; } /* Linear transformation. */ srcp = wcssrc->crpix; dstp = wcsdst->crpix; for (j = 0; j < *nsub; j++, dstp++) { if (axes[j] > 0) { k = axes[j] - 1; *dstp = *(srcp+k); } } srcp = wcssrc->pc; dstp = wcsdst->pc; for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { for (j = 0; j < *nsub; j++, dstp++) { if (axes[j] > 0) { k = (axes[i]-1)*naxis + (axes[j]-1); *dstp = *(srcp+k); } } } } srcp = wcssrc->cdelt; dstp = wcsdst->cdelt; for (i = 0; i < *nsub; i++, dstp++) { if (axes[i] > 0) { k = axes[i] - 1; *dstp = *(srcp+k); } } /* Coordinate reference value. */ srcp = wcssrc->crval; dstp = wcsdst->crval; for (i = 0; i < *nsub; i++, dstp++) { if (axes[i] > 0) { k = axes[i] - 1; *dstp = *(srcp+k); } } /* Coordinate units and type. */ for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { k = axes[i] - 1; strncpy(wcsdst->cunit[i], wcssrc->cunit[k], 72); strncpy(wcsdst->ctype[i], wcssrc->ctype[k], 72); } } /* Celestial and spectral transformation parameters. */ wcsdst->lonpole = wcssrc->lonpole; wcsdst->latpole = wcssrc->latpole; wcsdst->restfrq = wcssrc->restfrq; wcsdst->restwav = wcssrc->restwav; /* Parameter values. */ npv = 0; for (k = 0; k < wcssrc->npv; k++) { i = wcssrc->pv[k].i; if (i == 0) { /* i == 0 is a special code that means "the latitude axis". */ wcsdst->pv[npv] = wcssrc->pv[k]; wcsdst->pv[npv].i = 0; npv++; } else if (i > 0 && map[i-1]) { wcsdst->pv[npv] = wcssrc->pv[k]; wcsdst->pv[npv].i = map[i-1]; npv++; } } wcsdst->npv = npv; nps = 0; for (k = 0; k < wcssrc->nps; k++) { i = wcssrc->ps[k].i; if (i > 0 && map[i-1]) { wcsdst->ps[nps] = wcssrc->ps[k]; wcsdst->ps[nps].i = map[i-1]; nps++; } } wcsdst->nps = nps; /* Alternate linear transformations. */ srcp = wcssrc->cd; dstp = wcsdst->cd; for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { for (j = 0; j < *nsub; j++, dstp++) { if (axes[j] > 0) { k = (axes[i]-1)*naxis + (axes[j]-1); *dstp = *(srcp+k); } } } } srcp = wcssrc->crota; dstp = wcsdst->crota; for (i = 0; i < *nsub; i++, dstp++) { if (axes[i] > 0) { k = axes[i] - 1; *dstp = *(srcp+k); } } wcsdst->altlin = wcssrc->altlin; wcsdst->velref = wcssrc->velref; /* Auxiliary coordinate system information. */ strncpy(wcsdst->alt, wcssrc->alt, 4); wcsdst->colnum = wcssrc->colnum; strncpy(wcsdst->wcsname, wcssrc->wcsname, 72); for (i = 0; i < *nsub; i++) { if (axes[i] > 0) { k = axes[i] - 1; wcsdst->colax[i] = wcssrc->colax[k]; strncpy(wcsdst->cname[i], wcssrc->cname[k], 72); wcsdst->crder[i] = wcssrc->crder[k]; wcsdst->csyer[i] = wcssrc->csyer[k]; } } strncpy(wcsdst->radesys, wcssrc->radesys, 72); wcsdst->equinox = wcssrc->equinox; strncpy(wcsdst->specsys, wcssrc->specsys, 72); strncpy(wcsdst->ssysobs, wcssrc->ssysobs, 72); wcsdst->velosys = wcssrc->velosys; strncpy(wcsdst->ssyssrc, wcssrc->ssyssrc, 72); wcsdst->zsource = wcssrc->zsource; wcsdst->obsgeo[0] = wcssrc->obsgeo[0]; wcsdst->obsgeo[1] = wcssrc->obsgeo[1]; wcsdst->obsgeo[2] = wcssrc->obsgeo[2]; strncpy(wcsdst->dateobs, wcssrc->dateobs, 72); strncpy(wcsdst->dateavg, wcssrc->dateavg, 72); wcsdst->mjdobs = wcssrc->mjdobs; wcsdst->mjdavg = wcssrc->mjdavg; /* Coordinate lookup tables; only copy what's needed. */ wcsdst->ntab = 0; for (itab = 0; itab < wcssrc->ntab; itab++) { /* Is this table wanted? */ for (m = 0; m < wcssrc->tab[itab].M; m++) { i = wcssrc->tab[itab].map[m]; if (map[i-1]) { wcsdst->ntab++; break; } } } if (wcsdst->ntab) { /* Allocate memory for tabprm structs. */ if (!(wcsdst->tab = calloc(wcsdst->ntab, sizeof(struct tabprm)))) { wcsdst->ntab = 0; status = wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); goto cleanup; } wcsdst->m_tab = wcsdst->tab; } tabp = wcsdst->tab; for (itab = 0; itab < wcssrc->ntab; itab++) { for (m = 0; m < wcssrc->tab[itab].M; m++) { i = wcssrc->tab[itab].map[m]; if (map[i-1]) { if ((status = tabcpy(1, wcssrc->tab + itab, tabp))) { wcserr_set(WCS_ERRMSG(status)); goto cleanup; } tabp++; break; } } } cleanup: if (map) free(map); if (dealloc) { free(axes); } if (status && wcsdst->m_tab) free(wcsdst->m_tab); return status; } /*--------------------------------------------------------------------------*/ int wcsfree(struct wcsprm *wcs) { int j; if (wcs == 0x0) return WCSERR_NULL_POINTER; if (wcs->flag == -1) { wcs->lin.flag = -1; } else { /* Free memory allocated by wcsini(). */ if (wcs->m_flag == WCSSET) { if (wcs->crpix == wcs->m_crpix) wcs->crpix = 0x0; if (wcs->pc == wcs->m_pc) wcs->pc = 0x0; if (wcs->cdelt == wcs->m_cdelt) wcs->cdelt = 0x0; if (wcs->crval == wcs->m_crval) wcs->crval = 0x0; if (wcs->cunit == wcs->m_cunit) wcs->cunit = 0x0; if (wcs->ctype == wcs->m_ctype) wcs->ctype = 0x0; if (wcs->pv == wcs->m_pv) wcs->pv = 0x0; if (wcs->ps == wcs->m_ps) wcs->ps = 0x0; if (wcs->cd == wcs->m_cd) wcs->cd = 0x0; if (wcs->crota == wcs->m_crota) wcs->crota = 0x0; if (wcs->colax == wcs->m_colax) wcs->colax = 0x0; if (wcs->cname == wcs->m_cname) wcs->cname = 0x0; if (wcs->crder == wcs->m_crder) wcs->crder = 0x0; if (wcs->csyer == wcs->m_csyer) wcs->csyer = 0x0; if (wcs->tab == wcs->m_tab) wcs->tab = 0x0; if (wcs->wtb == wcs->m_wtb) wcs->wtb = 0x0; if (wcs->m_crpix) free(wcs->m_crpix); if (wcs->m_pc) free(wcs->m_pc); if (wcs->m_cdelt) free(wcs->m_cdelt); if (wcs->m_crval) free(wcs->m_crval); if (wcs->m_cunit) free(wcs->m_cunit); if (wcs->m_ctype) free(wcs->m_ctype); if (wcs->m_pv) free(wcs->m_pv); if (wcs->m_ps) free(wcs->m_ps); if (wcs->m_cd) free(wcs->m_cd); if (wcs->m_crota) free(wcs->m_crota); if (wcs->m_colax) free(wcs->m_colax); if (wcs->m_cname) free(wcs->m_cname); if (wcs->m_crder) free(wcs->m_crder); if (wcs->m_csyer) free(wcs->m_csyer); /* Free memory allocated by wcstab(). */ if (wcs->m_tab) { for (j = 0; j < wcs->ntab; j++) { tabfree(wcs->m_tab + j); } free(wcs->m_tab); } if (wcs->m_wtb) free(wcs->m_wtb); } /* Free memory allocated by wcsset(). */ if (wcs->types) free(wcs->types); if (wcs->lin.crpix == wcs->m_crpix) wcs->lin.crpix = 0x0; if (wcs->lin.pc == wcs->m_pc) wcs->lin.pc = 0x0; if (wcs->lin.cdelt == wcs->m_cdelt) wcs->lin.cdelt = 0x0; } wcs->m_flag = 0; wcs->m_naxis = 0x0; wcs->m_crpix = 0x0; wcs->m_pc = 0x0; wcs->m_cdelt = 0x0; wcs->m_crval = 0x0; wcs->m_cunit = 0x0; wcs->m_ctype = 0x0; wcs->m_pv = 0x0; wcs->m_ps = 0x0; wcs->m_cd = 0x0; wcs->m_crota = 0x0; wcs->m_colax = 0x0; wcs->m_cname = 0x0; wcs->m_crder = 0x0; wcs->m_csyer = 0x0; wcs->ntab = 0; wcs->m_tab = 0x0; wcs->nwtb = 0; wcs->m_wtb = 0x0; wcs->types = 0x0; wcs->flag = 0; if (wcs->err) { free(wcs->err); wcs->err = 0x0; } linfree(&(wcs->lin)); celfree(&(wcs->cel)); spcfree(&(wcs->spc)); return 0; } /*--------------------------------------------------------------------------*/ int wcsprt(const struct wcsprm *wcs) { int i, j, k; struct wtbarr *wtbp; if (wcs == 0x0) return WCSERR_NULL_POINTER; if (wcs->flag != WCSSET) { wcsprintf("The wcsprm struct is UNINITIALIZED.\n"); return 0; } wcsprintf(" flag: %d\n", wcs->flag); wcsprintf(" naxis: %d\n", wcs->naxis); WCSPRINTF_PTR(" crpix: ", wcs->crpix, "\n"); wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" %- 11.5g", wcs->crpix[i]); } wcsprintf("\n"); /* Linear transformation. */ k = 0; WCSPRINTF_PTR(" pc: ", wcs->pc, "\n"); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" pc[%d][]:", i); for (j = 0; j < wcs->naxis; j++) { wcsprintf(" %- 11.5g", wcs->pc[k++]); } wcsprintf("\n"); } /* Coordinate increment at reference point. */ WCSPRINTF_PTR(" cdelt: ", wcs->cdelt, "\n"); wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" %- 11.5g", wcs->cdelt[i]); } wcsprintf("\n"); /* Coordinate value at reference point. */ WCSPRINTF_PTR(" crval: ", wcs->crval, "\n"); wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" %- 11.5g", wcs->crval[i]); } wcsprintf("\n"); /* Coordinate units and type. */ WCSPRINTF_PTR(" cunit: ", wcs->cunit, "\n"); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" \"%s\"\n", wcs->cunit[i]); } WCSPRINTF_PTR(" ctype: ", wcs->ctype, "\n"); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" \"%s\"\n", wcs->ctype[i]); } /* Celestial and spectral transformation parameters. */ if (undefined(wcs->lonpole)) { wcsprintf(" lonpole: UNDEFINED\n"); } else { wcsprintf(" lonpole: %9f\n", wcs->lonpole); } wcsprintf(" latpole: %9f\n", wcs->latpole); wcsprintf(" restfrq: %f\n", wcs->restfrq); wcsprintf(" restwav: %f\n", wcs->restwav); /* Parameter values. */ wcsprintf(" npv: %d\n", wcs->npv); wcsprintf(" npvmax: %d\n", wcs->npvmax); WCSPRINTF_PTR(" pv: ", wcs->pv, "\n"); for (i = 0; i < wcs->npv; i++) { wcsprintf(" %3d%4d %- 11.5g\n", (wcs->pv[i]).i, (wcs->pv[i]).m, (wcs->pv[i]).value); } wcsprintf(" nps: %d\n", wcs->nps); wcsprintf(" npsmax: %d\n", wcs->npsmax); WCSPRINTF_PTR(" ps: ", wcs->ps, "\n"); for (i = 0; i < wcs->nps; i++) { wcsprintf(" %3d%4d %s\n", (wcs->ps[i]).i, (wcs->ps[i]).m, (wcs->ps[i]).value); } /* Alternate linear transformations. */ k = 0; WCSPRINTF_PTR(" cd: ", wcs->cd, "\n"); if (wcs->cd) { for (i = 0; i < wcs->naxis; i++) { wcsprintf(" cd[%d][]:", i); for (j = 0; j < wcs->naxis; j++) { wcsprintf(" %- 11.5g", wcs->cd[k++]); } wcsprintf("\n"); } } WCSPRINTF_PTR(" crota: ", wcs->crota, "\n"); if (wcs->crota) { wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" %- 11.5g", wcs->crota[i]); } wcsprintf("\n"); } wcsprintf(" altlin: %d\n", wcs->altlin); wcsprintf(" velref: %d\n", wcs->velref); /* Auxiliary coordinate system information. */ wcsprintf(" alt: '%c'\n", wcs->alt[0]); wcsprintf(" colnum: %d\n", wcs->colnum); WCSPRINTF_PTR(" colax: ", wcs->colax, "\n"); if (wcs->colax) { wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { wcsprintf(" %5d", wcs->colax[i]); } wcsprintf("\n"); } if (wcs->wcsname[0] == '\0') { wcsprintf(" wcsname: UNDEFINED\n"); } else { wcsprintf(" wcsname: \"%s\"\n", wcs->wcsname); } WCSPRINTF_PTR(" cname: ", wcs->cname, "\n"); if (wcs->cname) { for (i = 0; i < wcs->naxis; i++) { if (wcs->cname[i][0] == '\0') { wcsprintf(" UNDEFINED\n"); } else { wcsprintf(" \"%s\"\n", wcs->cname[i]); } } } WCSPRINTF_PTR(" crder: ", wcs->crder, "\n"); if (wcs->crder) { wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { if (undefined(wcs->crder[i])) { wcsprintf(" UNDEFINED "); } else { wcsprintf(" %- 11.5g", wcs->crder[i]); } } wcsprintf("\n"); } WCSPRINTF_PTR(" csyer: ", wcs->csyer, "\n"); if (wcs->csyer) { wcsprintf(" "); for (i = 0; i < wcs->naxis; i++) { if (undefined(wcs->csyer[i])) { wcsprintf(" UNDEFINED "); } else { wcsprintf(" %- 11.5g", wcs->csyer[i]); } } wcsprintf("\n"); } if (wcs->radesys[0] == '\0') { wcsprintf(" radesys: UNDEFINED\n"); } else { wcsprintf(" radesys: \"%s\"\n", wcs->radesys); } if (undefined(wcs->equinox)) { wcsprintf(" equinox: UNDEFINED\n"); } else { wcsprintf(" equinox: %9f\n", wcs->equinox); } if (wcs->specsys[0] == '\0') { wcsprintf(" specsys: UNDEFINED\n"); } else { wcsprintf(" specsys: \"%s\"\n", wcs->specsys); } if (wcs->ssysobs[0] == '\0') { wcsprintf(" ssysobs: UNDEFINED\n"); } else { wcsprintf(" ssysobs: \"%s\"\n", wcs->ssysobs); } if (undefined(wcs->velosys)) { wcsprintf(" velosys: UNDEFINED\n"); } else { wcsprintf(" velosys: %9f\n", wcs->velosys); } if (wcs->ssyssrc[0] == '\0') { wcsprintf(" ssyssrc: UNDEFINED\n"); } else { wcsprintf(" ssyssrc: \"%s\"\n", wcs->ssyssrc); } if (undefined(wcs->zsource)) { wcsprintf(" zsource: UNDEFINED\n"); } else { wcsprintf(" zsource: %9f\n", wcs->zsource); } wcsprintf(" obsgeo: "); for (i = 0; i < 3; i++) { if (undefined(wcs->obsgeo[i])) { wcsprintf("UNDEFINED "); } else { wcsprintf("%- 11.5g ", wcs->obsgeo[i]); } } wcsprintf("\n"); if (wcs->dateobs[0] == '\0') { wcsprintf(" dateobs: UNDEFINED\n"); } else { wcsprintf(" dateobs: \"%s\"\n", wcs->dateobs); } if (wcs->dateavg[0] == '\0') { wcsprintf(" dateavg: UNDEFINED\n"); } else { wcsprintf(" dateavg: \"%s\"\n", wcs->dateavg); } if (undefined(wcs->mjdobs)) { wcsprintf(" mjdobs: UNDEFINED\n"); } else { wcsprintf(" mjdobs: %9f\n", wcs->mjdobs); } if (undefined(wcs->mjdavg)) { wcsprintf(" mjdavg: UNDEFINED\n"); } else { wcsprintf(" mjdavg: %9f\n", wcs->mjdavg); } wcsprintf(" ntab: %d\n", wcs->ntab); WCSPRINTF_PTR(" tab: ", wcs->tab, ""); if (wcs->tab != 0x0) wcsprintf(" (see below)"); wcsprintf("\n"); wcsprintf(" nwtb: %d\n", wcs->nwtb); WCSPRINTF_PTR(" wtb: ", wcs->wtb, ""); if (wcs->wtb != 0x0) wcsprintf(" (see below)"); wcsprintf("\n"); /* Derived values. */ WCSPRINTF_PTR(" types: ", wcs->types, "\n "); for (i = 0; i < wcs->naxis; i++) { wcsprintf("%5d", wcs->types[i]); } wcsprintf("\n"); wcsprintf(" lngtyp: \"%s\"\n", wcs->lngtyp); wcsprintf(" lattyp: \"%s\"\n", wcs->lattyp); wcsprintf(" lng: %d\n", wcs->lng); wcsprintf(" lat: %d\n", wcs->lat); wcsprintf(" spec: %d\n", wcs->spec); wcsprintf(" cubeface: %d\n", wcs->cubeface); WCSPRINTF_PTR(" err: ", wcs->err, "\n"); if (wcs->err) { wcserr_prt(wcs->err, " "); } wcsprintf(" lin: (see below)\n"); wcsprintf(" cel: (see below)\n"); wcsprintf(" spc: (see below)\n"); /* Memory management. */ wcsprintf(" m_flag: %d\n", wcs->m_flag); wcsprintf(" m_naxis: %d\n", wcs->m_naxis); WCSPRINTF_PTR(" m_crpix: ", wcs->m_crpix, ""); if (wcs->m_crpix == wcs->crpix) wcsprintf(" (= crpix)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_pc: ", wcs->m_pc, ""); if (wcs->m_pc == wcs->pc) wcsprintf(" (= pc)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_cdelt: ", wcs->m_cdelt, ""); if (wcs->m_cdelt == wcs->cdelt) wcsprintf(" (= cdelt)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_crval: ", wcs->m_crval, ""); if (wcs->m_crval == wcs->crval) wcsprintf(" (= crval)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_cunit: ", wcs->m_cunit, ""); if (wcs->m_cunit == wcs->cunit) wcsprintf(" (= cunit)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_ctype: ", wcs->m_ctype, ""); if (wcs->m_ctype == wcs->ctype) wcsprintf(" (= ctype)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_pv: ", wcs->m_pv, ""); if (wcs->m_pv == wcs->pv) wcsprintf(" (= pv)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_ps: ", wcs->m_ps, ""); if (wcs->m_ps == wcs->ps) wcsprintf(" (= ps)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_cd: ", wcs->m_cd, ""); if (wcs->m_cd == wcs->cd) wcsprintf(" (= cd)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_crota: ", wcs->m_crota, ""); if (wcs->m_crota == wcs->crota) wcsprintf(" (= crota)"); wcsprintf("\n"); wcsprintf("\n"); WCSPRINTF_PTR(" m_colax: ", wcs->m_colax, ""); if (wcs->m_colax == wcs->colax) wcsprintf(" (= colax)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_cname: ", wcs->m_cname, ""); if (wcs->m_cname == wcs->cname) wcsprintf(" (= cname)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_crder: ", wcs->m_crder, ""); if (wcs->m_crder == wcs->crder) wcsprintf(" (= crder)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_csyer: ", wcs->m_csyer, ""); if (wcs->m_csyer == wcs->csyer) wcsprintf(" (= csyer)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_tab: ", wcs->m_tab, ""); if (wcs->m_tab == wcs->tab) wcsprintf(" (= tab)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_wtb: ", wcs->m_wtb, ""); if (wcs->m_wtb == wcs->wtb) wcsprintf(" (= wtb)"); wcsprintf("\n"); /* Tabular transformation parameters. */ if ((wtbp = wcs->wtb)) { for (j = 0; j < wcs->nwtb; j++, wtbp++) { wcsprintf("\n"); wcsprintf("wtb[%d].*\n", j); wcsprintf(" i: %d\n", wtbp->i); wcsprintf(" m: %d\n", wtbp->m); wcsprintf(" kind: %c\n", wtbp->kind); wcsprintf(" extnam: %s\n", wtbp->extnam); wcsprintf(" extver: %d\n", wtbp->extver); wcsprintf(" extlev: %d\n", wtbp->extlev); wcsprintf(" ttype: %s\n", wtbp->ttype); wcsprintf(" row: %ld\n", wtbp->row); wcsprintf(" ndim: %d\n", wtbp->ndim); WCSPRINTF_PTR(" dimlen: ", wtbp->dimlen, "\n"); WCSPRINTF_PTR(" arrayp: ", wtbp->arrayp, " -> "); WCSPRINTF_PTR("", *(wtbp->arrayp), "\n"); } } if (wcs->tab) { for (j = 0; j < wcs->ntab; j++) { wcsprintf("\n"); wcsprintf("tab[%d].*\n", j); tabprt(wcs->tab + j); } } /* Linear transformation parameters. */ wcsprintf("\n"); wcsprintf(" lin.*\n"); linprt(&(wcs->lin)); /* Celestial transformation parameters. */ wcsprintf("\n"); wcsprintf(" cel.*\n"); celprt(&(wcs->cel)); /* Spectral transformation parameters. */ wcsprintf("\n"); wcsprintf(" spc.*\n"); spcprt(&(wcs->spc)); return 0; } /*--------------------------------------------------------------------------*/ int wcsperr(const struct wcsprm *wcs, const char *prefix) { int j; if (wcs == 0x0) return WCSERR_NULL_POINTER; if (!wcserr_prt(wcs->err, prefix)) { wcserr_prt(wcs->lin.err, prefix); wcserr_prt(wcs->cel.err, prefix); wcserr_prt(wcs->cel.prj.err, prefix); wcserr_prt(wcs->spc.err, prefix); if (wcs->tab) { for (j = 0; j < wcs->ntab; j++) { wcserr_prt((wcs->tab + j)->err, prefix); } } } return 0; } /*--------------------------------------------------------------------------*/ int wcsset(struct wcsprm *wcs) { static const char *function = "wcsset"; char scode[4], stype[5]; int i, j, k, m, naxis, status; double lambda, rho; double *cd, *pc; struct celprm *wcscel = &(wcs->cel); struct prjprm *wcsprj = &(wcscel->prj); struct spcprm *wcsspc = &(wcs->spc); struct wcserr **err; if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); /* Determine axis types from CTYPEia. */ if ((status = wcs_types(wcs))) { return status; } /* Convert to canonical units. */ if ((status = wcs_units(wcs))) { return status; } /* Non-linear celestial axes present? */ if (wcs->lng >= 0 && wcs->types[wcs->lng] == 2200) { celini(wcscel); /* CRVALia, LONPOLEa, and LATPOLEa keyvalues. */ wcscel->ref[0] = wcs->crval[wcs->lng]; wcscel->ref[1] = wcs->crval[wcs->lat]; wcscel->ref[2] = wcs->lonpole; wcscel->ref[3] = wcs->latpole; /* PVi_ma keyvalues. */ for (k = 0; k < wcs->npv; k++) { i = wcs->pv[k].i - 1; m = wcs->pv[k].m; if (i == -1) { /* From a PROJPn keyword. */ i = wcs->lat; } if (i == wcs->lat) { /* PVi_ma associated with latitude axis. */ if (m < 30) { wcsprj->pv[m] = wcs->pv[k].value; } } else if (i == wcs->lng) { /* PVi_ma associated with longitude axis. */ switch (m) { case 0: wcscel->offset = (wcs->pv[k].value != 0.0); break; case 1: wcscel->phi0 = wcs->pv[k].value; break; case 2: wcscel->theta0 = wcs->pv[k].value; break; case 3: /* If present, overrides LONPOLEa. */ wcscel->ref[2] = wcs->pv[k].value; break; case 4: /* If present, overrides LATPOLEa. */ wcscel->ref[3] = wcs->pv[k].value; break; default: return wcserr_set(WCSERR_SET(WCSERR_BAD_COORD_TRANS), "PV%i_%i%s: Unrecognized coordinate transformation parameter", i+1, m, wcs->alt); break; } } } /* Do simple alias translations. */ if (strncmp(wcs->ctype[wcs->lng]+5, "GLS", 3) == 0) { wcscel->offset = 1; wcscel->phi0 = 0.0; wcscel->theta0 = wcs->crval[wcs->lat]; strcpy(wcsprj->code, "SFL"); } else if (strncmp(wcs->ctype[wcs->lng]+5, "NCP", 3) == 0) { /* Convert NCP to SIN. */ if (wcscel->ref[1] == 0.0) { return wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM), "Invalid projection: NCP blows up on the equator"); } strcpy(wcsprj->code, "SIN"); wcsprj->pv[1] = 0.0; wcsprj->pv[2] = cosd(wcscel->ref[1])/sind(wcscel->ref[1]); } else { strncpy(wcsprj->code, wcs->ctype[wcs->lng]+5, 3); wcsprj->code[3] = '\0'; } /* Initialize the celestial transformation routines. */ wcsprj->r0 = 0.0; if ((status = celset(wcscel))) { return wcserr_set(WCS_ERRMSG(status+3)); } /* Update LONPOLE, LATPOLE, and PVi_ma keyvalues. */ wcs->lonpole = wcscel->ref[2]; wcs->latpole = wcscel->ref[3]; for (k = 0; k < wcs->npv; k++) { i = wcs->pv[k].i - 1; m = wcs->pv[k].m; if (i == wcs->lng) { switch (m) { case 1: wcs->pv[k].value = wcscel->phi0; break; case 2: wcs->pv[k].value = wcscel->theta0; break; case 3: wcs->pv[k].value = wcscel->ref[2]; break; case 4: wcs->pv[k].value = wcscel->ref[3]; break; } } } } /* Non-linear spectral axis present? */ if (wcs->spec >= 0 && wcs->types[wcs->spec] == 3300) { spcini(wcsspc); if ((status = spctype(wcs->ctype[wcs->spec], stype, scode, 0x0, 0x0, 0x0, 0x0, 0x0, err))) { return status; } strcpy(wcsspc->type, stype); strcpy(wcsspc->code, scode); /* CRVALia, RESTFRQa, and RESTWAVa keyvalues. */ wcsspc->crval = wcs->crval[wcs->spec]; wcsspc->restfrq = wcs->restfrq; wcsspc->restwav = wcs->restwav; /* PVi_ma keyvalues. */ for (k = 0; k < wcs->npv; k++) { i = wcs->pv[k].i - 1; m = wcs->pv[k].m; if (i == wcs->spec) { /* PVi_ma associated with grism axis. */ if (m < 7) { wcsspc->pv[m] = wcs->pv[k].value; } } } /* Initialize the spectral transformation routines. */ if ((status = spcset(wcsspc))) { return wcserr_set(WCS_ERRMSG(status+3)); } } /* Tabular axes present? */ for (j = 0; j < wcs->ntab; j++) { if ((status = tabset(wcs->tab + j))) { return wcserr_set(WCS_ERRMSG(status+3)); } } /* Initialize the linear transformation. */ naxis = wcs->naxis; wcs->altlin &= 7; if (wcs->altlin > 1 && !(wcs->altlin & 1)) { pc = wcs->pc; if (wcs->altlin & 2) { /* Copy CDi_ja to PCi_ja and reset CDELTia. */ cd = wcs->cd; for (i = 0; i < naxis; i++) { for (j = 0; j < naxis; j++) { *(pc++) = *(cd++); } wcs->cdelt[i] = 1.0; } } else if (wcs->altlin & 4) { /* Construct PCi_ja from CROTAia. */ if ((i = wcs->lng) >= 0 && (j = wcs->lat) >= 0) { rho = wcs->crota[j]; if (wcs->cdelt[i] == 0.0) { return wcserr_set(WCSERR_SET(WCSERR_SINGULAR_MTX), "Singular transformation matrix, CDELT%d is zero", i+1); } lambda = wcs->cdelt[j]/wcs->cdelt[i]; *(pc + i*naxis + i) = *(pc + j*naxis + j) = cosd(rho); *(pc + i*naxis + j) = *(pc + j*naxis + i) = sind(rho); *(pc + i*naxis + j) *= -lambda; *(pc + j*naxis + i) /= lambda; } } } wcs->lin.crpix = wcs->crpix; wcs->lin.pc = wcs->pc; wcs->lin.cdelt = wcs->cdelt; if ((status = linset(&(wcs->lin)))) { return wcserr_set(WCS_ERRMSG(status)); } /* Strip off trailing blanks and null-fill auxiliary string members. */ wcsutil_null_fill(4, wcs->alt); wcsutil_null_fill(72, wcs->wcsname); for (i = 0; i < naxis; i++) { wcsutil_null_fill(72, wcs->cname[i]); } wcsutil_null_fill(72, wcs->radesys); wcsutil_null_fill(72, wcs->specsys); wcsutil_null_fill(72, wcs->ssysobs); wcsutil_null_fill(72, wcs->ssyssrc); wcsutil_null_fill(72, wcs->dateobs); wcsutil_null_fill(72, wcs->dateavg); wcs->flag = WCSSET; return 0; } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int wcs_types(struct wcsprm *wcs) { static const char *function = "wcs_types"; const int nalias = 2; const char aliases [2][4] = {"NCP", "GLS"}; const char *alt = ""; char ctypei[16], pcode[4], requir[9], scode[4], specsys[9]; int i, j, m, naxis, *ndx = 0x0, type; struct wcserr **err; if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); /* Parse the CTYPEia keyvalues. */ pcode[0] = '\0'; requir[0] = '\0'; wcs->lng = -1; wcs->lat = -1; wcs->spec = -1; wcs->cubeface = -1; if (*(wcs->alt) != ' ') alt = wcs->alt; naxis = wcs->naxis; if (wcs->types) free(wcs->types); wcs->types = calloc(naxis, sizeof(int)); if (wcs->types == NULL) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } for (i = 0; i < naxis; i++) { /* Null fill. */ wcsutil_null_fill(72, wcs->ctype[i]); strncpy(ctypei, wcs->ctype[i], 15); ctypei[15] = '\0'; /* Check for early Paper IV syntax (e.g. '-SIP' used by Spitzer). */ if (strlen(ctypei) == 12 && ctypei[8] == '-') { /* Excise the "4-3-3" or "8-3"-form distortion code. */ ctypei[8] = '\0'; /* Remove trailing dashes from "8-3"-form codes. */ for (j = 7; j > 0; j--) { if (ctypei[j] != '-') break; ctypei[j] = '\0'; } } /* Logarithmic or tabular axis? */ wcs->types[i] = 0; if (strcmp(ctypei+4, "-LOG") == 0) { /* Logarithmic axis. */ wcs->types[i] = 400; } else if (strcmp(ctypei+4, "-TAB") == 0) { /* Tabular axis. */ wcs->types[i] = 500; } if (wcs->types[i]) { /* Could have -LOG or -TAB with celestial or spectral types. */ ctypei[4] = '\0'; /* Take care of things like 'FREQ-LOG' or 'RA---TAB'. */ for (j = 3; j >= 0; j--) { if (ctypei[j] != '-') break; ctypei[j] = '\0'; } } /* Translate AIPS spectral types for spctyp(). */ if (spcaips(ctypei, wcs->velref, ctypei, specsys) == 0) { strcpy(wcs->ctype[i], ctypei); if (wcs->specsys[0] == '\0') strcpy(wcs->specsys, specsys); } /* Process linear axes. */ if (!(strlen(ctypei) == 8 && ctypei[4] == '-')) { /* Identify Stokes, celestial and spectral types. */ if (strcmp(ctypei, "STOKES") == 0) { /* STOKES axis. */ wcs->types[i] = 1100; } else if (strcmp(ctypei, "RA") == 0 || strcmp(ctypei+1, "LON") == 0 || strcmp(ctypei+2, "LN") == 0) { /* Longitude axis. */ if (wcs->lng < 0) wcs->lng = i; wcs->types[i] += 2000; } else if (strcmp(ctypei, "DEC") == 0 || strcmp(ctypei+1, "LAT") == 0 || strcmp(ctypei+2, "LT") == 0) { /* Latitude axis. */ if (wcs->lat < 0) wcs->lat = i; wcs->types[i] += 2001; } else if (strcmp(ctypei, "CUBEFACE") == 0) { /* CUBEFACE axis. */ if (wcs->cubeface == -1) { wcs->types[i] = 2102; wcs->cubeface = i; } else { /* Multiple CUBEFACE axes! */ return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Multiple CUBEFACE axes (in CTYPE%d%.1s and CTYPE%d%.1s)", wcs->cubeface+1, alt, i+1, alt); } } else if (spctyp(ctypei, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0) == 0) { /* Spectral axis. */ if (wcs->spec < 0) wcs->spec = i; wcs->types[i] += 3000; } continue; } /* CTYPEia is in "4-3" form; is it a recognized spectral type? */ if (spctyp(ctypei, 0x0, scode, 0x0, 0x0, 0x0, 0x0, 0x0) == 0) { /* Non-linear spectral axis found. */ wcs->types[i] = 3300; /* Check uniqueness. */ if (wcs->spec >= 0) { return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Multiple spectral axes (in CTYPE%d%.1s and CTYPE%d%.1s)", wcs->spec+1, alt, i+1, alt); } wcs->spec = i; continue; } /* Is it a recognized celestial projection? */ for (j = 0; j < prj_ncode; j++) { if (strncmp(ctypei+5, prj_codes[j], 3) == 0) break; } if (j == prj_ncode) { /* Not a standard projection code, maybe it's an alias. */ for (j = 0; j < nalias; j++) { if (strncmp(ctypei+5, aliases[j], 3) == 0) break; } if (j == nalias) { /* Not a recognized algorithm code of any type. */ wcs->types[i] = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Unrecognized projection code (%s in CTYPE%d%.1s)", ctypei+5, i+1, alt); } } /* Parse the celestial axis type. */ wcs->types[i] = 2200; if (*pcode == '\0') { /* The first of the two celestial axes. */ sprintf(pcode, "%.3s", ctypei+5); if (strncmp(ctypei, "RA--", 4) == 0) { wcs->lng = i; strcpy(wcs->lngtyp, "RA"); strcpy(wcs->lattyp, "DEC"); ndx = &wcs->lat; sprintf(requir, "DEC--%s", pcode); } else if (strncmp(ctypei, "DEC-", 4) == 0) { wcs->lat = i; strcpy(wcs->lngtyp, "RA"); strcpy(wcs->lattyp, "DEC"); ndx = &wcs->lng; sprintf(requir, "RA---%s", pcode); } else if (strncmp(ctypei+1, "LON", 3) == 0) { wcs->lng = i; sprintf(wcs->lngtyp, "%cLON", ctypei[0]); sprintf(wcs->lattyp, "%cLAT", ctypei[0]); ndx = &wcs->lat; sprintf(requir, "%s-%s", wcs->lattyp, pcode); } else if (strncmp(ctypei+1, "LAT", 3) == 0) { wcs->lat = i; sprintf(wcs->lngtyp, "%cLON", ctypei[0]); sprintf(wcs->lattyp, "%cLAT", ctypei[0]); ndx = &wcs->lng; sprintf(requir, "%s-%s", wcs->lngtyp, pcode); } else if (strncmp(ctypei+2, "LN", 2) == 0) { wcs->lng = i; sprintf(wcs->lngtyp, "%c%cLN", ctypei[0], ctypei[1]); sprintf(wcs->lattyp, "%c%cLT", ctypei[0], ctypei[1]); ndx = &wcs->lat; sprintf(requir, "%s-%s", wcs->lattyp, pcode); } else if (strncmp(ctypei+2, "LT", 2) == 0) { wcs->lat = i; sprintf(wcs->lngtyp, "%c%cLN", ctypei[0], ctypei[1]); sprintf(wcs->lattyp, "%c%cLT", ctypei[0], ctypei[1]); ndx = &wcs->lng; sprintf(requir, "%s-%s", wcs->lngtyp, pcode); } else { /* Unrecognized celestial type. */ wcs->types[i] = -1; wcs->lng = -1; wcs->lat = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Unrecognized celestial type (%5s in CTYPE%d%.1s)", ctypei, i+1, alt); } if (wcs->lat >= 0) wcs->types[i]++; } else { /* Looking for the complementary celestial axis. */ if (wcs->lat < 0) wcs->types[i]++; if (strncmp(ctypei, requir, 8) != 0) { /* Inconsistent projection types. */ wcs->lng = -1; wcs->lat = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Inconsistent " "projection types (expected %s, got %s in CTYPE%d%.1s)", requir, ctypei, i+1, alt); } *ndx = i; requir[0] = '\0'; } } /* Do we have a complementary pair of celestial axes? */ if (strcmp(requir, "")) { /* Unmatched celestial axis. */ wcs->lng = -1; wcs->lat = -1; return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Unmatched celestial axes"); } /* Table group numbers. */ for (j = 0; j < wcs->ntab; j++) { for (m = 0; m < wcs->tab[j].M; m++) { /* Get image axis number. */ i = wcs->tab[j].map[m]; type = (wcs->types[i] / 100) % 10; if (type != 5) { return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "Table parameters set for non-table axis type"); } wcs->types[i] += 10 * j; } } return 0; } /* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : */ int wcs_units(struct wcsprm *wcs) { static const char *function = "wcs_units"; char ctype[9], units[16]; int i, j, naxis; double scale, offset, power; struct wcserr *uniterr = 0x0, **err; if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); naxis = wcs->naxis; for (i = 0; i < naxis; i++) { /* Use types set by wcs_types(). */ switch (wcs->types[i]/1000) { case 2: /* Celestial axis. */ strcpy(units, "deg"); break; case 3: /* Spectral axis. */ strncpy(ctype, wcs->ctype[i], 8); ctype[8] = '\0'; spctyp(ctype, 0x0, 0x0, 0x0, units, 0x0, 0x0, 0x0); break; default: continue; } /* Tabular axis, CDELTia and CRVALia relate to indices. */ if ((wcs->types[i]/100)%10 == 5) { continue; } wcsutil_null_fill(72, wcs->cunit[i]); if (wcs->cunit[i][0]) { if (wcsunitse(wcs->cunit[i], units, &scale, &offset, &power, &uniterr)) { wcserr_set(WCSERR_SET(WCSERR_BAD_COORD_TRANS), "In CUNIT%d%.1s: %s", i, (*wcs->alt)?wcs->alt:"", uniterr->msg); free(uniterr); return WCSERR_BAD_COORD_TRANS; } if (scale != 1.0) { wcs->cdelt[i] *= scale; wcs->crval[i] *= scale; for (j = 0; j < naxis; j++) { *(wcs->cd + i*naxis + j) *= scale; } strcpy(wcs->cunit[i], units); } } else { strcpy(wcs->cunit[i], units); } } return 0; } /*--------------------------------------------------------------------------*/ int wcsp2s( struct wcsprm *wcs, int ncoord, int nelem, const double pixcrd[], double imgcrd[], double phi[], double theta[], double world[], int stat[]) { static const char *function = "wcsp2s"; int bits, face, i, iso_x, iso_y, istat, *istatp, itab, k, m, nx, ny, *statp, status, type; double crvali, offset; register double *img, *wrl; struct celprm *wcscel = &(wcs->cel); struct prjprm *wcsprj = &(wcscel->prj); struct wcserr **err; /* Initialize if required. */ if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } /* Sanity check. */ if (ncoord < 1 || (ncoord > 1 && nelem < wcs->naxis)) { return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "ncoord and/or nelem inconsistent with the wcsprm"); } /* Apply pixel-to-world linear transformation. */ if ((status = linp2x(&(wcs->lin), ncoord, nelem, pixcrd, imgcrd))) { return wcserr_set(WCS_ERRMSG(status)); } /* Initialize status vectors. */ if (!(istatp = calloc(ncoord, sizeof(int)))) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } stat[0] = 0; wcsutil_setAli(ncoord, 1, stat); /* Convert intermediate world coordinates to world coordinates. */ for (i = 0; i < wcs->naxis; i++) { /* Extract the second digit of the axis type code. */ type = (wcs->types[i] / 100) % 10; if (type <= 1) { /* Linear or quantized coordinate axis. */ img = imgcrd + i; wrl = world + i; crvali = wcs->crval[i]; for (k = 0; k < ncoord; k++) { *wrl = *img + crvali; img += nelem; wrl += nelem; } } else if (wcs->types[i] == 2200) { /* Convert celestial coordinates; do we have a CUBEFACE axis? */ if (wcs->cubeface != -1) { /* Separation between faces. */ if (wcsprj->r0 == 0.0) { offset = 90.0; } else { offset = wcsprj->r0*PI/2.0; } /* Lay out faces in a plane. */ img = imgcrd; statp = stat; bits = (1 << i) | (1 << wcs->lat); for (k = 0; k < ncoord; k++, statp++) { face = (int)(*(img+wcs->cubeface) + 0.5); if (fabs(*(img+wcs->cubeface) - face) > 1e-10) { *statp |= bits; status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); } else { *statp = 0; switch (face) { case 0: *(img+wcs->lat) += offset; break; case 1: break; case 2: *(img+i) += offset; break; case 3: *(img+i) += offset*2; break; case 4: *(img+i) += offset*3; break; case 5: *(img+wcs->lat) -= offset; break; default: *statp |= bits; status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); } } img += nelem; } } /* Check for constant x and/or y. */ nx = ncoord; ny = 0; if ((iso_x = wcsutil_allEq(ncoord, nelem, imgcrd+i))) { nx = 1; ny = ncoord; } if ((iso_y = wcsutil_allEq(ncoord, nelem, imgcrd+wcs->lat))) { ny = 1; } /* Transform projection plane coordinates to celestial coordinates. */ if ((istat = celx2s(wcscel, nx, ny, nelem, nelem, imgcrd+i, imgcrd+wcs->lat, phi, theta, world+i, world+wcs->lat, istatp))) { if (istat == CELERR_BAD_PIX) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); } else { status = wcserr_set(WCS_ERRMSG(istat+3)); goto cleanup; } } /* If x and y were both constant, replicate values. */ if (iso_x && iso_y) { wcsutil_setAll(ncoord, nelem, world+i); wcsutil_setAll(ncoord, nelem, world+wcs->lat); wcsutil_setAll(ncoord, 1, phi); wcsutil_setAll(ncoord, 1, theta); wcsutil_setAli(ncoord, 1, istatp); } if (istat == 5) { bits = (1 << i) | (1 << wcs->lat); wcsutil_setBit(ncoord, istatp, bits, stat); } } else if (type == 3 || type == 4) { /* Check for constant x. */ nx = ncoord; if ((iso_x = wcsutil_allEq(ncoord, nelem, imgcrd+i))) { nx = 1; } istat = 0; if (wcs->types[i] == 3300) { /* Spectral coordinates. */ istat = spcx2s(&(wcs->spc), nx, nelem, nelem, imgcrd+i, world+i, istatp); if (istat == SPCERR_BAD_X) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); } else if (istat) { status = wcserr_set(WCS_ERRMSG(istat+3)); goto cleanup; } } else if (type == 4) { /* Logarithmic coordinates. */ istat = logx2s(wcs->crval[i], nx, nelem, nelem, imgcrd+i, world+i, istatp); if (istat == LOGERR_BAD_X) { if (*err == 0x0) { wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); } } else if (istat == LOGERR_BAD_LOG_REF_VAL) { wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM), log_errmsg[istat]); goto cleanup; } } /* If x was constant, replicate values. */ if (iso_x) { wcsutil_setAll(ncoord, nelem, world+i); wcsutil_setAli(ncoord, 1, istatp); } if (istat == 3) { wcsutil_setBit(ncoord, istatp, 1 << i, stat); } } } /* Do tabular coordinates. */ for (itab = 0; itab < wcs->ntab; itab++) { istat = tabx2s(wcs->tab + itab, ncoord, nelem, imgcrd, world, istatp); if (istat == TABERR_BAD_X) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_PIX)); bits = 0; for (m = 0; m < wcs->tab[itab].M; m++) { bits |= 1 << wcs->tab[itab].map[m]; } wcsutil_setBit(ncoord, istatp, bits, stat); } else if (istat) { if (istat == TABERR_BAD_PARAMS) istat = WCSERR_BAD_PARAM; status = wcserr_set(WCS_ERRMSG(istat)); goto cleanup; } } /* Zero the unused world coordinate elements. */ for (i = wcs->naxis; i < nelem; i++) { world[i] = 0.0; wcsutil_setAll(ncoord, nelem, world+i); } cleanup: free(istatp); return status; } /*--------------------------------------------------------------------------*/ int wcss2p( struct wcsprm* wcs, int ncoord, int nelem, const double world[], double phi[], double theta[], double imgcrd[], double pixcrd[], int stat[]) { static const char *function = "wcss2p"; int bits, i, isolat, isolng, isospec, istat, *istatp, itab, k, m, nlat, nlng, nwrld, status, type; double crvali, offset; register const double *wrl; register double *img; struct celprm *wcscel = &(wcs->cel); struct prjprm *wcsprj = &(wcscel->prj); struct wcserr **err; /* Initialize if required. */ if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } /* Sanity check. */ if (ncoord < 1 || (ncoord > 1 && nelem < wcs->naxis)) { return wcserr_set(WCSERR_SET(WCSERR_BAD_CTYPE), "ncoord and/or nelem inconsistent with the wcsprm"); } /* Initialize status vectors. */ if (!(istatp = calloc(ncoord, sizeof(int)))) { return wcserr_set(WCS_ERRMSG(WCSERR_MEMORY)); } status = 0; stat[0] = 0; wcsutil_setAli(ncoord, 1, stat); /* Convert world coordinates to intermediate world coordinates. */ for (i = 0; i < wcs->naxis; i++) { /* Extract the second digit of the axis type code. */ type = (wcs->types[i] / 100) % 10; if (type <= 1) { /* Linear or quantized coordinate axis. */ wrl = world + i; img = imgcrd + i; crvali = wcs->crval[i]; for (k = 0; k < ncoord; k++) { *img = *wrl - crvali; wrl += nelem; img += nelem; } } else if (wcs->types[i] == 2200) { /* Celestial coordinates; check for constant lng and/or lat. */ nlng = ncoord; nlat = 0; if ((isolng = wcsutil_allEq(ncoord, nelem, world+i))) { nlng = 1; nlat = ncoord; } if ((isolat = wcsutil_allEq(ncoord, nelem, world+wcs->lat))) { nlat = 1; } /* Transform celestial coordinates to projection plane coordinates. */ if ((istat = cels2x(wcscel, nlng, nlat, nelem, nelem, world+i, world+wcs->lat, phi, theta, imgcrd+i, imgcrd+wcs->lat, istatp))) { if (istat == CELERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD)); } else { status = wcserr_set(WCS_ERRMSG(istat+3)); goto cleanup; } } /* If lng and lat were both constant, replicate values. */ if (isolng && isolat) { wcsutil_setAll(ncoord, nelem, imgcrd+i); wcsutil_setAll(ncoord, nelem, imgcrd+wcs->lat); wcsutil_setAll(ncoord, 1, phi); wcsutil_setAll(ncoord, 1, theta); wcsutil_setAli(ncoord, 1, istatp); } if (istat == CELERR_BAD_WORLD) { bits = (1 << i) | (1 << wcs->lat); wcsutil_setBit(ncoord, istatp, bits, stat); } /* Do we have a CUBEFACE axis? */ if (wcs->cubeface != -1) { /* Separation between faces. */ if (wcsprj->r0 == 0.0) { offset = 90.0; } else { offset = wcsprj->r0*PI/2.0; } /* Stack faces in a cube. */ img = imgcrd; for (k = 0; k < ncoord; k++) { if (*(img+wcs->lat) < -0.5*offset) { *(img+wcs->lat) += offset; *(img+wcs->cubeface) = 5.0; } else if (*(img+wcs->lat) > 0.5*offset) { *(img+wcs->lat) -= offset; *(img+wcs->cubeface) = 0.0; } else if (*(img+i) > 2.5*offset) { *(img+i) -= 3.0*offset; *(img+wcs->cubeface) = 4.0; } else if (*(img+i) > 1.5*offset) { *(img+i) -= 2.0*offset; *(img+wcs->cubeface) = 3.0; } else if (*(img+i) > 0.5*offset) { *(img+i) -= offset; *(img+wcs->cubeface) = 2.0; } else { *(img+wcs->cubeface) = 1.0; } img += nelem; } } } else if (type == 3 || type == 4) { /* Check for constancy. */ nwrld = ncoord; if ((isospec = wcsutil_allEq(ncoord, nelem, world+i))) { nwrld = 1; } istat = 0; if (wcs->types[i] == 3300) { /* Spectral coordinates. */ istat = spcs2x(&(wcs->spc), nwrld, nelem, nelem, world+i, imgcrd+i, istatp); if (istat == SPCERR_BAD_SPEC) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD)); } else if (istat) { status = wcserr_set(WCS_ERRMSG(istat+3)); goto cleanup; } } else if (type == 4) { /* Logarithmic coordinates. */ istat = logs2x(wcs->crval[i], nwrld, nelem, nelem, world+i, imgcrd+i, istatp); if (istat == LOGERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD)); } else if (istat == LOGERR_BAD_LOG_REF_VAL) { status = wcserr_set(WCSERR_SET(WCSERR_BAD_PARAM), log_errmsg[istat]); goto cleanup; } } /* If constant, replicate values. */ if (isospec) { wcsutil_setAll(ncoord, nelem, imgcrd+i); wcsutil_setAli(ncoord, 1, istatp); } if (istat == 4) { wcsutil_setBit(ncoord, istatp, 1 << i, stat); } } } /* Do tabular coordinates. */ for (itab = 0; itab < wcs->ntab; itab++) { istat = tabs2x(wcs->tab + itab, ncoord, nelem, world, imgcrd, istatp); if (istat == TABERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD)); bits = 0; for (m = 0; m < wcs->tab[itab].M; m++) { bits |= 1 << wcs->tab[itab].map[m]; } wcsutil_setBit(ncoord, istatp, bits, stat); } else if (istat) { if (istat == TABERR_BAD_PARAMS) istat = WCSERR_BAD_PARAM; status = wcserr_set(WCS_ERRMSG(istat)); goto cleanup; } } /* Zero the unused intermediate world coordinate elements. */ for (i = wcs->naxis; i < nelem; i++) { imgcrd[i] = 0.0; wcsutil_setAll(ncoord, nelem, imgcrd+i); } /* Apply world-to-pixel linear transformation. */ if ((istat = linx2p(&(wcs->lin), ncoord, nelem, imgcrd, pixcrd))) { status = wcserr_set(WCS_ERRMSG(istat)); goto cleanup; } cleanup: free(istatp); return status; } /*--------------------------------------------------------------------------*/ int wcsmix( struct wcsprm *wcs, int mixpix, int mixcel, const double vspan[2], double vstep, int viter, double world[], double phi[], double theta[], double imgcrd[], double pixcrd[]) { static const char *function = "wcsmix"; const int niter = 60; int crossed, istep, iter, j, k, nstep, retry, stat[1], status; const double tol = 1.0e-10; const double tol2 = 100.0*tol; double *worldlat, *worldlng; double lambda, span[2], step; double pixmix; double dlng, lng, lng0, lng0m, lng1, lng1m; double dlat, lat, lat0, lat0m, lat1, lat1m; double d, d0, d0m, d1, d1m, dx = 0.0; double dabs, dmin, lmin; double dphi, phi0, phi1; struct celprm *wcscel = &(wcs->cel); struct wcsprm wcs0; struct wcserr **err; /* Initialize if required. */ if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } worldlng = world + wcs->lng; worldlat = world + wcs->lat; /* Check vspan. */ if (vspan[0] <= vspan[1]) { span[0] = vspan[0]; span[1] = vspan[1]; } else { /* Swap them. */ span[0] = vspan[1]; span[1] = vspan[0]; } /* Check vstep. */ step = fabs(vstep); if (step == 0.0) { step = (span[1] - span[0])/10.0; if (step > 1.0 || step == 0.0) step = 1.0; } /* Check viter. */ nstep = viter; if (nstep < 5) { nstep = 5; } else if (nstep > 10) { nstep = 10; } /* Given pixel element. */ pixmix = pixcrd[mixpix]; /* Iterate on the step size. */ for (istep = 0; istep <= nstep; istep++) { if (istep) step /= 2.0; /* Iterate on the sky coordinate between the specified range. */ if (mixcel == 1) { /* Celestial longitude is given. */ /* Check whether the solution interval is a crossing interval. */ lat0 = span[0]; *worldlat = lat0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = pixcrd[mixpix] - pixmix; dabs = fabs(d0); if (dabs < tol) return 0; lat1 = span[1]; *worldlat = lat1; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1 = pixcrd[mixpix] - pixmix; dabs = fabs(d1); if (dabs < tol) return 0; lmin = lat1; dmin = dabs; /* Check for a crossing point. */ if (signbit(d0) != signbit(d1)) { crossed = 1; dx = d1; } else { crossed = 0; lat0 = span[1]; } for (retry = 0; retry < 4; retry++) { /* Refine the solution interval. */ while (lat0 > span[0]) { lat0 -= step; if (lat0 < span[0]) lat0 = span[0]; *worldlat = lat0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = pixcrd[mixpix] - pixmix; /* Check for a solution. */ dabs = fabs(d0); if (dabs < tol) return 0; /* Record the point of closest approach. */ if (dabs < dmin) { lmin = lat0; dmin = dabs; } /* Check for a crossing point. */ if (signbit(d0) != signbit(d1)) { crossed = 2; dx = d0; break; } /* Advance to the next subinterval. */ lat1 = lat0; d1 = d0; } if (crossed) { /* A crossing point was found. */ for (iter = 0; iter < niter; iter++) { /* Use regula falsi division of the interval. */ lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } dlat = lat1 - lat0; lat = lat0 + lambda*dlat; *worldlat = lat; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } /* Check for a solution. */ d = pixcrd[mixpix] - pixmix; dabs = fabs(d); if (dabs < tol) return 0; if (dlat < tol) { /* An artifact of numerical imprecision. */ if (dabs < tol2) return 0; /* Must be a discontinuity. */ break; } /* Record the point of closest approach. */ if (dabs < dmin) { lmin = lat; dmin = dabs; } if (signbit(d0) == signbit(d)) { lat0 = lat; d0 = d; } else { lat1 = lat; d1 = d; } } /* No convergence, must have been a discontinuity. */ if (crossed == 1) lat0 = span[1]; lat1 = lat0; d1 = dx; crossed = 0; } else { /* No crossing point; look for a tangent point. */ if (lmin == span[0]) break; if (lmin == span[1]) break; lat = lmin; lat0 = lat - step; if (lat0 < span[0]) lat0 = span[0]; lat1 = lat + step; if (lat1 > span[1]) lat1 = span[1]; *worldlat = lat0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = fabs(pixcrd[mixpix] - pixmix); d = dmin; *worldlat = lat1; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1 = fabs(pixcrd[mixpix] - pixmix); for (iter = 0; iter < niter; iter++) { lat0m = (lat0 + lat)/2.0; *worldlat = lat0m; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0m = fabs(pixcrd[mixpix] - pixmix); if (d0m < tol) return 0; lat1m = (lat1 + lat)/2.0; *worldlat = lat1m; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1m = fabs(pixcrd[mixpix] - pixmix); if (d1m < tol) return 0; if (d0m < d && d0m <= d1m) { lat1 = lat; d1 = d; lat = lat0m; d = d0m; } else if (d1m < d) { lat0 = lat; d0 = d; lat = lat1m; d = d1m; } else { lat0 = lat0m; d0 = d0m; lat1 = lat1m; d1 = d1m; } } } } } else { /* Celestial latitude is given. */ /* Check whether the solution interval is a crossing interval. */ lng0 = span[0]; *worldlng = lng0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = pixcrd[mixpix] - pixmix; dabs = fabs(d0); if (dabs < tol) return 0; lng1 = span[1]; *worldlng = lng1; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1 = pixcrd[mixpix] - pixmix; dabs = fabs(d1); if (dabs < tol) return 0; lmin = lng1; dmin = dabs; /* Check for a crossing point. */ if (signbit(d0) != signbit(d1)) { crossed = 1; dx = d1; } else { crossed = 0; lng0 = span[1]; } for (retry = 0; retry < 4; retry++) { /* Refine the solution interval. */ while (lng0 > span[0]) { lng0 -= step; if (lng0 < span[0]) lng0 = span[0]; *worldlng = lng0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = pixcrd[mixpix] - pixmix; /* Check for a solution. */ dabs = fabs(d0); if (dabs < tol) return 0; /* Record the point of closest approach. */ if (dabs < dmin) { lmin = lng0; dmin = dabs; } /* Check for a crossing point. */ if (signbit(d0) != signbit(d1)) { crossed = 2; dx = d0; break; } /* Advance to the next subinterval. */ lng1 = lng0; d1 = d0; } if (crossed) { /* A crossing point was found. */ for (iter = 0; iter < niter; iter++) { /* Use regula falsi division of the interval. */ lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } dlng = lng1 - lng0; lng = lng0 + lambda*dlng; *worldlng = lng; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } /* Check for a solution. */ d = pixcrd[mixpix] - pixmix; dabs = fabs(d); if (dabs < tol) return 0; if (dlng < tol) { /* An artifact of numerical imprecision. */ if (dabs < tol2) return 0; /* Must be a discontinuity. */ break; } /* Record the point of closest approach. */ if (dabs < dmin) { lmin = lng; dmin = dabs; } if (signbit(d0) == signbit(d)) { lng0 = lng; d0 = d; } else { lng1 = lng; d1 = d; } } /* No convergence, must have been a discontinuity. */ if (crossed == 1) lng0 = span[1]; lng1 = lng0; d1 = dx; crossed = 0; } else { /* No crossing point; look for a tangent point. */ if (lmin == span[0]) break; if (lmin == span[1]) break; lng = lmin; lng0 = lng - step; if (lng0 < span[0]) lng0 = span[0]; lng1 = lng + step; if (lng1 > span[1]) lng1 = span[1]; *worldlng = lng0; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = fabs(pixcrd[mixpix] - pixmix); d = dmin; *worldlng = lng1; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1 = fabs(pixcrd[mixpix] - pixmix); for (iter = 0; iter < niter; iter++) { lng0m = (lng0 + lng)/2.0; *worldlng = lng0m; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0m = fabs(pixcrd[mixpix] - pixmix); if (d0m < tol) return 0; lng1m = (lng1 + lng)/2.0; *worldlng = lng1m; if ((status = wcss2p(wcs, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1m = fabs(pixcrd[mixpix] - pixmix); if (d1m < tol) return 0; if (d0m < d && d0m <= d1m) { lng1 = lng; d1 = d; lng = lng0m; d = d0m; } else if (d1m < d) { lng0 = lng; d0 = d; lng = lng1m; d = d1m; } else { lng0 = lng0m; d0 = d0m; lng1 = lng1m; d1 = d1m; } } } } } } /* Set cel0 to the unity transformation. */ wcs0 = *wcs; wcs0.cel.euler[0] = -90.0; wcs0.cel.euler[1] = 0.0; wcs0.cel.euler[2] = 90.0; wcs0.cel.euler[3] = 1.0; wcs0.cel.euler[4] = 0.0; /* No convergence, check for aberrant behaviour at a native pole. */ *theta = -90.0; for (j = 1; j <= 2; j++) { /* Could the celestial coordinate element map to a native pole? */ *phi = 0.0; *theta = -*theta; sphx2s(wcscel->euler, 1, 1, 1, 1, phi, theta, &lng, &lat); if (mixcel == 1) { if (fabs(fmod(*worldlng-lng, 360.0)) > tol) continue; if (lat < span[0]) continue; if (lat > span[1]) continue; *worldlat = lat; } else { if (fabs(*worldlat-lat) > tol) continue; if (lng < span[0]) lng += 360.0; if (lng > span[1]) lng -= 360.0; if (lng < span[0]) continue; if (lng > span[1]) continue; *worldlng = lng; } /* Is there a solution for the given pixel coordinate element? */ lng = *worldlng; lat = *worldlat; /* Feed native coordinates to wcss2p() with cel0 set to unity. */ *worldlng = -180.0; *worldlat = *theta; if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (wcs->err) free(wcs->err); wcs->err = wcs0.err; if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d0 = pixcrd[mixpix] - pixmix; /* Check for a solution. */ if (fabs(d0) < tol) { /* Recall saved world coordinates. */ *worldlng = lng; *worldlat = lat; return 0; } /* Search for a crossing interval. */ phi0 = -180.0; for (k = -179; k <= 180; k++) { phi1 = (double) k; *worldlng = phi1; if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (wcs->err) free(wcs->err); wcs->err = wcs0.err; if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } d1 = pixcrd[mixpix] - pixmix; /* Check for a solution. */ dabs = fabs(d1); if (dabs < tol) { /* Recall saved world coordinates. */ *worldlng = lng; *worldlat = lat; return 0; } /* Is it a crossing interval? */ if (signbit(d0) != signbit(d1)) break; phi0 = phi1; d0 = d1; } for (iter = 1; iter <= niter; iter++) { /* Use regula falsi division of the interval. */ lambda = d0/(d0-d1); if (lambda < 0.1) { lambda = 0.1; } else if (lambda > 0.9) { lambda = 0.9; } dphi = phi1 - phi0; *worldlng = phi0 + lambda*dphi; if ((status = wcss2p(&wcs0, 1, 0, world, phi, theta, imgcrd, pixcrd, stat))) { if (wcs->err) free(wcs->err); wcs->err = wcs0.err; if (status == WCSERR_BAD_WORLD) { status = wcserr_set(WCS_ERRMSG(WCSERR_BAD_WORLD_COORD)); } return status; } /* Check for a solution. */ d = pixcrd[mixpix] - pixmix; dabs = fabs(d); if (dabs < tol || (dphi < tol && dabs < tol2)) { /* Recall saved world coordinates. */ *worldlng = lng; *worldlat = lat; return 0; } if (signbit(d0) == signbit(d)) { phi0 = *worldlng; d0 = d; } else { phi1 = *worldlng; d1 = d; } } } /* No solution. */ return wcserr_set(WCS_ERRMSG(WCSERR_NO_SOLUTION)); } /*--------------------------------------------------------------------------*/ int wcssptr( struct wcsprm *wcs, int *i, char ctype[9]) { static const char *function = "wcssptr"; int j, status; double cdelt, crval; struct wcserr **err; /* Initialize if required. */ if (wcs == 0x0) return WCSERR_NULL_POINTER; err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } if ((j = *i) < 0) { if ((j = wcs->spec) < 0) { /* Look for a linear spectral axis. */ for (j = 0; j < wcs->naxis; j++) { if (wcs->types[j]/100 == 30) { break; } } if (j >= wcs->naxis) { /* No spectral axis. */ return wcserr_set(WCSERR_SET(WCSERR_BAD_SUBIMAGE), "No spectral axis found."); } } *i = j; } /* Translate the spectral axis. */ if (spctrne(wcs->ctype[j], wcs->crval[j], wcs->cdelt[j], wcs->restfrq, wcs->restwav, ctype, &crval, &cdelt, &(wcs->spc.err))) { return wcserr_set(WCS_ERRMSG(WCSERR_BAD_COORD_TRANS)); } /* Translate keyvalues. */ wcs->flag = 0; wcs->cdelt[j] = cdelt; wcs->crval[j] = crval; spctyp(ctype, 0x0, 0x0, 0x0, wcs->cunit[j], 0x0, 0x0, 0x0); strcpy(wcs->ctype[j], ctype); /* This keeps things tidy if the spectral axis is linear. */ spcfree(&(wcs->spc)); spcini(&(wcs->spc)); return 0; } astropy-0.3/cextern/wcslib/C/tab.c0000644000175000017500000012045512243255342015235 0ustar oleole/*============================================================================ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: tab.c,v 4.19 2013/09/29 14:17:51 mcalabre Exp $ *===========================================================================*/ #include #include #include #include #include "wcserr.h" #include "wcsmath.h" #include "wcsprintf.h" #include "tab.h" const int TABSET = 137; /* Map status return value to message. */ const char *tab_errmsg[] = { "Success", "Null tabprm pointer passed", "Memory allocation failed", "Invalid tabular parameters", "One or more of the x coordinates were invalid", "One or more of the world coordinates were invalid"}; /* Convenience macro for invoking wcserr_set(). */ #define TAB_ERRMSG(status) WCSERR_SET(status), tab_errmsg[status] /*--------------------------------------------------------------------------*/ int tabini(int alloc, int M, const int K[], struct tabprm *tab) { static const char *function = "tabini"; int k, m, N; double *dp; struct wcserr **err; if (tab == 0x0) return TABERR_NULL_POINTER; /* Initialize error message handling. */ err = &(tab->err); if (tab->err && tab->flag != -1) { free(tab->err); } tab->err = 0x0; if (M <= 0) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "M must be positive, got %d", M); } /* Determine the total number of elements in the coordinate array. */ if (K) { N = M; for (m = 0; m < M; m++) { if (K[m] < 0) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Each element of K must be " "non-negative, got %d", K[m]); } N *= K[m]; } } else { /* Axis lengths as yet unknown. */ N = 0; } /* Initialize memory management. */ if (tab->flag == -1 || tab->m_flag != TABSET) { tab->m_flag = 0; tab->m_M = 0; tab->m_N = 0; tab->m_K = 0x0; tab->m_map = 0x0; tab->m_crval = 0x0; tab->m_index = 0x0; tab->m_indxs = 0x0; tab->m_coord = 0x0; } else { /* Clear any outstanding signals set by wcstab(). */ for (m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0; } if (tab->m_coord == (double *)0x1) tab->m_coord = 0x0; } if (tab->flag == -1) { tab->sense = 0x0; tab->p0 = 0x0; tab->delta = 0x0; tab->extrema = 0x0; tab->set_M = 0; } /* Allocate memory for arrays if required. */ if (alloc || tab->K == 0x0 || tab->map == 0x0 || tab->crval == 0x0 || tab->index == 0x0 || tab->coord == 0x0) { /* Was sufficient allocated previously? */ if (tab->m_flag == TABSET && (tab->m_M < M || tab->m_N < N)) { /* No, free it. */ tabfree(tab); } if (alloc || tab->K == 0x0) { if (tab->m_K) { /* In case the caller fiddled with it. */ tab->K = tab->m_K; } else { if (!(tab->K = calloc(M, sizeof(int)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_flag = TABSET; tab->m_M = M; tab->m_K = tab->K; } } if (alloc || tab->map == 0x0) { if (tab->m_map) { /* In case the caller fiddled with it. */ tab->map = tab->m_map; } else { if (!(tab->map = calloc(M, sizeof(int)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_flag = TABSET; tab->m_M = M; tab->m_map = tab->map; } } if (alloc || tab->crval == 0x0) { if (tab->m_crval) { /* In case the caller fiddled with it. */ tab->crval = tab->m_crval; } else { if (!(tab->crval = calloc(M, sizeof(double)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_flag = TABSET; tab->m_M = M; tab->m_crval = tab->crval; } } if (alloc || tab->index == 0x0) { if (tab->m_index) { /* In case the caller fiddled with it. */ tab->index = tab->m_index; } else { if (!(tab->index = calloc(M, sizeof(double *)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_flag = TABSET; tab->m_M = M; tab->m_N = N; tab->m_index = tab->index; if (!(tab->m_indxs = calloc(M, sizeof(double *)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } /* Recall that calloc() initializes these pointers to zero. */ if (K) { for (m = 0; m < M; m++) { if (K[m]) { if (!(tab->index[m] = calloc(K[m], sizeof(double)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_indxs[m] = tab->index[m]; } } } } } if (alloc || tab->coord == 0x0) { if (tab->m_coord) { /* In case the caller fiddled with it. */ tab->coord = tab->m_coord; } else if (N) { if (!(tab->coord = calloc(N, sizeof(double)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->m_flag = TABSET; tab->m_M = M; tab->m_N = N; tab->m_coord = tab->coord; } } } tab->flag = 0; tab->M = M; /* Set defaults. */ for (m = 0; m < M; m++) { tab->map[m] = -1; tab->crval[m] = 0.0; if (K) { tab->K[m] = K[m]; if ((dp = tab->index[m])) { for (k = 0; k < K[m]; k++) { *(dp++) = k; } } } else { tab->K[m] = 0; } } /* Initialize the coordinate array. */ for (dp = tab->coord; dp < tab->coord + N; dp++) { *dp = UNDEFINED; } return 0; } /*--------------------------------------------------------------------------*/ int tabmem(struct tabprm *tab) { static const char *function = "tabmem"; int m, M, N; struct wcserr **err; if (tab == 0x0) return TABERR_NULL_POINTER; err = &(tab->err); if (tab->M == 0 || tab->K == 0x0) { /* Should have been set by this time. */ return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); } N = M = tab->M; for (m = 0; m < M; m++) { if (tab->K[m] < 0) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Each element of K must be " "non-negative, got %d", M); } N *= tab->K[m]; } if (tab->m_M == 0) { tab->m_M = M; } else if (tab->m_M < M) { /* Only possible if the user changed M. */ return wcserr_set(WCSERR_SET(TABERR_MEMORY), "tabprm struct inconsistent"); } if (tab->m_N == 0) { tab->m_N = N; } else if (tab->m_N < N) { /* Only possible if the user changed K[]. */ return wcserr_set(WCSERR_SET(TABERR_MEMORY), "tabprm struct inconsistent"); } if (tab->m_K == 0x0) { if ((tab->m_K = tab->K)) { tab->m_flag = TABSET; } } if (tab->m_map == 0x0) { if ((tab->m_map = tab->map)) { tab->m_flag = TABSET; } } if (tab->m_crval == 0x0) { if ((tab->m_crval = tab->crval)) { tab->m_flag = TABSET; } } if (tab->m_index == 0x0) { if ((tab->m_index = tab->index)) { tab->m_flag = TABSET; } } for (m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == 0x0 || tab->m_indxs[m] == (double *)0x1) { if ((tab->m_indxs[m] = tab->index[m])) { tab->m_flag = TABSET; } } } if (tab->m_coord == 0x0 || tab->m_coord == (double *)0x1) { if ((tab->m_coord = tab->coord)) { tab->m_flag = TABSET; } } tab->flag = 0; return 0; } /*--------------------------------------------------------------------------*/ int tabcpy(int alloc, const struct tabprm *tabsrc, struct tabprm *tabdst) { static const char *function = "tabcpy"; int k, m, M, n, N, status; double *dstp, *srcp; struct wcserr **err; if (tabsrc == 0x0) return TABERR_NULL_POINTER; if (tabdst == 0x0) return TABERR_NULL_POINTER; err = &(tabdst->err); M = tabsrc->M; if (M <= 0) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "M must be positive, got %d", M); } if ((status = tabini(alloc, M, tabsrc->K, tabdst))) { return status; } N = M; for (m = 0; m < M; m++) { tabdst->map[m] = tabsrc->map[m]; tabdst->crval[m] = tabsrc->crval[m]; N *= tabsrc->K[m]; } for (m = 0; m < M; m++) { if ((srcp = tabsrc->index[m])) { dstp = tabdst->index[m]; for (k = 0; k < tabsrc->K[m]; k++) { *(dstp++) = *(srcp++); } } } srcp = tabsrc->coord; dstp = tabdst->coord; for (n = 0; n < N; n++) { *(dstp++) = *(srcp++); } return 0; } /*--------------------------------------------------------------------------*/ int tabfree(struct tabprm *tab) { int m; if (tab == 0x0) return TABERR_NULL_POINTER; if (tab->flag != -1) { /* Clear any outstanding signals set by wcstab(). */ for (m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1) tab->m_indxs[m] = 0x0; } if (tab->m_coord == (double *)0x1) tab->m_coord = 0x0; /* Free memory allocated by tabini(). */ if (tab->m_flag == TABSET) { if (tab->K == tab->m_K) tab->K = 0x0; if (tab->map == tab->m_map) tab->map = 0x0; if (tab->crval == tab->m_crval) tab->crval = 0x0; if (tab->index == tab->m_index) tab->index = 0x0; if (tab->coord == tab->m_coord) tab->coord = 0x0; if (tab->m_K) free(tab->m_K); if (tab->m_map) free(tab->m_map); if (tab->m_crval) free(tab->m_crval); if (tab->m_index) { for (m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m]) free(tab->m_indxs[m]); } free(tab->m_index); free(tab->m_indxs); } if (tab->m_coord) free(tab->m_coord); } /* Free memory allocated by tabset(). */ if (tab->sense) free(tab->sense); if (tab->p0) free(tab->p0); if (tab->delta) free(tab->delta); if (tab->extrema) free(tab->extrema); } tab->m_flag = 0; tab->m_M = 0; tab->m_N = 0; tab->m_K = 0x0; tab->m_map = 0x0; tab->m_crval = 0x0; tab->m_index = 0x0; tab->m_indxs = 0x0; tab->m_coord = 0x0; tab->sense = 0x0; tab->p0 = 0x0; tab->delta = 0x0; tab->extrema = 0x0; tab->set_M = 0; if (tab->err) { free(tab->err); tab->err = 0x0; } tab->flag = 0; return 0; } /*--------------------------------------------------------------------------*/ int tabprt(const struct tabprm *tab) { char *cp, text[128]; int j, k, m, n, nd; double *dp; if (tab == 0x0) return TABERR_NULL_POINTER; if (tab->flag != TABSET) { wcsprintf("The tabprm struct is UNINITIALIZED.\n"); return 0; } wcsprintf(" flag: %d\n", tab->flag); wcsprintf(" M: %d\n", tab->M); /* Array dimensions. */ WCSPRINTF_PTR(" K: ", tab->K, "\n"); wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf("%6d", tab->K[m]); } wcsprintf("\n"); /* Map vector. */ WCSPRINTF_PTR(" map: ", tab->map, "\n"); wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf("%6d", tab->map[m]); } wcsprintf("\n"); /* Reference index value. */ WCSPRINTF_PTR(" crval: ", tab->crval, "\n"); wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf(" %- 11.5g", tab->crval[m]); } wcsprintf("\n"); /* Index vectors. */ WCSPRINTF_PTR(" index: ", tab->index, "\n"); for (m = 0; m < tab->M; m++) { wcsprintf(" index[%d]: ", m); WCSPRINTF_PTR("", tab->index[m], ""); if (tab->index[m]) { for (k = 0; k < tab->K[m]; k++) { if (k%5 == 0) { wcsprintf("\n "); } wcsprintf(" %- 11.5g", tab->index[m][k]); } wcsprintf("\n"); } } /* Coordinate array. */ WCSPRINTF_PTR(" coord: ", tab->coord, "\n"); dp = tab->coord; for (n = 0; n < tab->nc; n++) { /* Array index. */ j = n; cp = text; for (m = 0; m < tab->M; m++) { nd = (tab->K[m] < 10) ? 1 : 2; sprintf(cp, ",%*d", nd, j % tab->K[m] + 1); j /= tab->K[m]; cp += strlen(cp); } wcsprintf(" (*%s)", text); for (m = 0; m < tab->M; m++) { wcsprintf(" %- 11.5g", *(dp++)); } wcsprintf("\n"); } wcsprintf(" nc: %d\n", tab->nc); WCSPRINTF_PTR(" sense: ", tab->sense, "\n"); if (tab->sense) { wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf("%6d", tab->sense[m]); } wcsprintf("\n"); } WCSPRINTF_PTR(" p0: ", tab->p0, "\n"); if (tab->p0) { wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf("%6d", tab->p0[m]); } wcsprintf("\n"); } WCSPRINTF_PTR(" delta: ", tab->delta, "\n"); if (tab->delta) { wcsprintf(" "); for (m = 0; m < tab->M; m++) { wcsprintf(" %- 11.5g", tab->delta[m]); } wcsprintf("\n"); } WCSPRINTF_PTR(" extrema: ", tab->extrema, "\n"); dp = tab->extrema; for (n = 0; n < tab->nc/tab->K[0]; n++) { /* Array index. */ j = n; cp = text; *cp = '\0'; for (m = 1; m < tab->M; m++) { nd = (tab->K[m] < 10) ? 1 : 2; sprintf(cp, ",%*d", nd, j % tab->K[m] + 1); j /= tab->K[m]; cp += strlen(cp); } wcsprintf(" (*,*%s)", text); for (m = 0; m < 2*tab->M; m++) { if (m == tab->M) wcsprintf("-> "); wcsprintf(" %- 11.5g", *(dp++)); } wcsprintf("\n"); } WCSPRINTF_PTR(" err: ", tab->err, "\n"); if (tab->err) { wcserr_prt(tab->err, " "); } /* Memory management. */ wcsprintf(" m_flag: %d\n", tab->m_flag); wcsprintf(" m_M: %d\n", tab->m_M); wcsprintf(" m_N: %d\n", tab->m_N); WCSPRINTF_PTR(" m_K: ", tab->m_K, ""); if (tab->m_K == tab->K) wcsprintf(" (= K)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_map: ", tab->m_map, ""); if (tab->m_map == tab->map) wcsprintf(" (= map)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_crval: ", tab->m_crval, ""); if (tab->m_crval == tab->crval) wcsprintf(" (= crval)"); wcsprintf("\n"); WCSPRINTF_PTR(" m_index: ", tab->m_index, ""); if (tab->m_index == tab->index) wcsprintf(" (= index)"); wcsprintf("\n"); for (m = 0; m < tab->M; m++) { wcsprintf(" m_indxs[%d]: ", m); WCSPRINTF_PTR("", tab->m_indxs[m], ""); if (tab->m_indxs[m] == tab->index[m]) wcsprintf(" (= index[%d])", m); wcsprintf("\n"); } WCSPRINTF_PTR(" m_coord: ", tab->m_coord, ""); if (tab->m_coord == tab->coord) wcsprintf(" (= coord)"); wcsprintf("\n"); return 0; } /*--------------------------------------------------------------------------*/ int tabset(struct tabprm *tab) { static const char *function = "tabset"; int i, ic, k, *Km, m, M, ne; double *dcrd, *dmax, *dmin, dPsi, dval, *Psi; struct wcserr **err; if (tab == 0x0) return TABERR_NULL_POINTER; err = &(tab->err); /* Check the number of tabular coordinate axes. */ if ((M = tab->M) < 1) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: M must be positive, got %d", M); } /* Check the axis lengths. */ if (!tab->K) { return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); } tab->nc = 1; for (m = 0; m < M; m++) { if (tab->K[m] < 1) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Each element of K must be positive, " "got %d", tab->K[m]); } /* Number of coordinate vectors in the coordinate array. */ tab->nc *= tab->K[m]; } /* Check that the map vector is sensible. */ if (!tab->map) { return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); } for (m = 0; m < M; m++) { i = tab->map[m]; if (i < 0) { return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Each element of map must be " "non-negative, got %d", i); } } /* Check memory allocation for the remaining vectors. */ if (!tab->crval || !tab->index || !tab->coord) { return wcserr_set(WCSERR_SET(TABERR_MEMORY), "Null pointers in tabprm struct"); } /* Take memory if signalled to by wcstab(). */ for (m = 0; m < tab->m_M; m++) { if (tab->m_indxs[m] == (double *)0x1 && (tab->m_indxs[m] = tab->index[m])) { tab->m_flag = TABSET; } } if (tab->m_coord == (double *)0x1 && (tab->m_coord = tab->coord)) { tab->m_flag = TABSET; } /* Allocate memory for work vectors. */ if (tab->flag != TABSET || tab->set_M < M) { /* Free memory that may have been allocated previously. */ if (tab->sense) free(tab->sense); if (tab->p0) free(tab->p0); if (tab->delta) free(tab->delta); if (tab->extrema) free(tab->extrema); /* Allocate memory for internal arrays. */ if (!(tab->sense = calloc(M, sizeof(int)))) { return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } if (!(tab->p0 = calloc(M, sizeof(int)))) { free(tab->sense); return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } if (!(tab->delta = calloc(M, sizeof(double)))) { free(tab->sense); free(tab->p0); return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } ne = M * tab->nc * 2 / tab->K[0]; if (!(tab->extrema = calloc(ne, sizeof(double)))) { free(tab->sense); free(tab->p0); free(tab->delta); return wcserr_set(TAB_ERRMSG(TABERR_MEMORY)); } tab->set_M = M; } /* Check that the index vectors are monotonic. */ Km = tab->K; for (m = 0; m < M; m++, Km++) { tab->sense[m] = 0; if (*Km > 1) { if ((Psi = tab->index[m]) == 0x0) { /* Default indexing. */ tab->sense[m] = 1; } else { for (k = 0; k < *Km-1; k++) { switch (tab->sense[m]) { case 0: if (Psi[k] < Psi[k+1]) { /* Monotonic increasing. */ tab->sense[m] = 1; } else if (Psi[k] > Psi[k+1]) { /* Monotonic decreasing. */ tab->sense[m] = -1; } break; case 1: if (Psi[k] > Psi[k+1]) { /* Should be monotonic increasing. */ free(tab->sense); free(tab->p0); free(tab->delta); free(tab->extrema); return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Index vectors are not " "monotonically increasing"); } break; case -1: if (Psi[k] < Psi[k+1]) { /* Should be monotonic decreasing. */ free(tab->sense); free(tab->p0); free(tab->delta); free(tab->extrema); return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Index vectors are not " "monotonically decreasing"); } break; } } } if (tab->sense[m] == 0) { free(tab->sense); free(tab->p0); free(tab->delta); free(tab->extrema); return wcserr_set(WCSERR_SET(TABERR_BAD_PARAMS), "Invalid tabular parameters: Index vectors are not monotonic"); } } } /* Find the extremal values of the coordinate elements in each row. */ dcrd = tab->coord; dmin = tab->extrema; dmax = tab->extrema + M; for (ic = 0; ic < tab->nc; ic += tab->K[0]) { for (m = 0; m < M; m++, dcrd++) { if (tab->K[0] > 1) { /* Extrapolate a little before the start of the row. */ Psi = tab->index[0]; if (Psi == 0x0) { dPsi = 1.0; } else { dPsi = Psi[1] - Psi[0]; } dval = *dcrd; if (dPsi != 0.0) { dval -= 0.5 * (*(dcrd+M) - *dcrd)/dPsi; } *(dmax+m) = *(dmin+m) = dval; } else { *(dmax+m) = *(dmin+m) = *dcrd; } } dcrd -= M; for (i = 0; i < tab->K[0]; i++) { for (m = 0; m < M; m++, dcrd++) { if (*(dmax+m) < *dcrd) *(dmax+m) = *dcrd; if (*(dmin+m) > *dcrd) *(dmin+m) = *dcrd; if (tab->K[0] > 1 && i == tab->K[0]-1) { /* Extrapolate a little beyond the end of the row. */ Psi = tab->index[0]; if (Psi == 0x0) { dPsi = 1.0; } else { dPsi = Psi[i] - Psi[i-1]; } dval = *dcrd; if (dPsi != 0.0) { dval += 0.5 * (*dcrd - *(dcrd-M))/dPsi; } if (*(dmax+m) < dval) *(dmax+m) = dval; if (*(dmin+m) > dval) *(dmin+m) = dval; } } } dmin += 2*M; dmax += 2*M; } tab->flag = TABSET; return 0; } /*--------------------------------------------------------------------------*/ int tabx2s( struct tabprm *tab, int ncoord, int nelem, const double x[], double world[], int stat[]) { static const char *function = "tabx2s"; int i, iv, k, *Km, m, M, n, nv, offset, p1, status; double *coord, *Psi, psi_m, upsilon, wgt; register int *statp; register const double *xp; register double *wp; struct wcserr **err; if (tab == 0x0) return TABERR_NULL_POINTER; err = &(tab->err); /* Initialize if required. */ if (tab->flag != TABSET) { if ((status = tabset(tab))) return status; } /* This is used a lot. */ M = tab->M; status = 0; xp = x; wp = world; statp = stat; for (n = 0; n < ncoord; n++) { /* Determine the indexes. */ Km = tab->K; for (m = 0; m < M; m++, Km++) { /* N.B. psi_m and Upsilon_m are 1-relative FITS indexes. */ i = tab->map[m]; psi_m = *(xp+i) + tab->crval[m]; Psi = tab->index[m]; if (Psi == 0x0) { /* Default indexing is simple. */ upsilon = psi_m; } else { /* To ease confusion, decrement Psi so that we can use 1-relative C array indexing to match the 1-relative FITS indexing. */ Psi--; if (*Km == 1) { /* Index vector is degenerate. */ if (Psi[1]-0.5 <= psi_m && psi_m <= Psi[1]+0.5) { upsilon = psi_m; } else { *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } } else { /* Interpolate in the indexing vector. */ if (tab->sense[m] == 1) { /* Monotonic increasing index values. */ if (psi_m < Psi[1]) { if (Psi[1] - 0.5*(Psi[2]-Psi[1]) <= psi_m) { /* Allow minor extrapolation. */ k = 1; } else { /* Index is out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } } else if (Psi[*Km] < psi_m) { if (psi_m <= Psi[*Km] + 0.5*(Psi[*Km]-Psi[*Km-1])) { /* Allow minor extrapolation. */ k = *Km - 1; } else { /* Index is out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } } else { for (k = 1; k < *Km; k++) { if (psi_m < Psi[k]) { continue; } if (Psi[k] == psi_m && psi_m < Psi[k+1]) { break; } if (Psi[k] < psi_m && psi_m <= Psi[k+1]) { break; } } } } else { /* Monotonic decreasing index values. */ if (psi_m > Psi[1]) { if (Psi[1] + 0.5*(Psi[1]-Psi[2]) >= psi_m) { /* Allow minor extrapolation. */ k = 1; } else { /* Index is out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } } else if (psi_m < Psi[*Km]) { if (Psi[*Km] - 0.5*(Psi[*Km-1]-Psi[*Km]) <= psi_m) { /* Allow minor extrapolation. */ k = *Km - 1; } else { /* Index is out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } } else { for (k = 1; k < *Km; k++) { if (psi_m > Psi[k]) { continue; } if (Psi[k] == psi_m && psi_m > Psi[k+1]) { break; } if (Psi[k] > psi_m && psi_m >= Psi[k+1]) { break; } } } } upsilon = k + (psi_m - Psi[k]) / (Psi[k+1] - Psi[k]); } } if (upsilon < 0.5 || upsilon > *Km + 0.5) { /* Index out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_X)); goto next; } /* Fiducial array indices and fractional offset. p1 is 1-relative while tab::p0 is 0-relative. */ p1 = (int)floor(upsilon); tab->p0[m] = p1 - 1; tab->delta[m] = upsilon - p1; if (p1 == 0) { tab->p0[m] += 1; tab->delta[m] -= 1.0; } else if (p1 == *Km && *Km > 1) { tab->p0[m] -= 1; tab->delta[m] += 1.0; } } /* Now interpolate in the coordinate array; the M-dimensional linear */ /* interpolation algorithm is described in Sect. 3.4 of WCS Paper IV. */ for (m = 0; m < M; m++) { i = tab->map[m]; *(wp+i) = 0.0; } /* Loop over the 2^M vertices surrounding P. */ nv = 1 << M; for (iv = 0; iv < nv; iv++) { /* Locate vertex in the coordinate array and compute its weight. */ offset = 0; wgt = 1.0; for (m = M-1; m >= 0; m--) { offset *= tab->K[m]; offset += tab->p0[m]; if (iv & (1 << m)) { if (tab->K[m] > 1) offset++; wgt *= tab->delta[m]; } else { wgt *= 1.0 - tab->delta[m]; } } if (wgt == 0.0) continue; /* Add the contribution from this vertex to each element. */ coord = tab->coord + offset*M; for (m = 0; m < M; m++) { i = tab->map[m]; *(wp+i) += *(coord++) * wgt; } if (wgt == 1.0) break; } *statp = 0; next: xp += nelem; wp += nelem; statp++; } return status; } /*--------------------------------------------------------------------------*/ int tabs2x( struct tabprm* tab, int ncoord, int nelem, const double world[], double x[], int stat[]) { static const char *function = "tabs2x"; int tabedge(struct tabprm *); int tabrow(struct tabprm *, const double *); int tabvox(struct tabprm *, const double *, int, double **, unsigned int *); int edge, i, ic, iv, k, *Km, M, m, n, nv, offset, status; double *dcrd, delta, *Psi, psi_m, **tabcoord, upsilon; register int *statp; register const double *wp; register double *xp; struct wcserr **err; if (tab == 0x0) return TABERR_NULL_POINTER; err = &(tab->err); /* Initialize if required. */ if (tab->flag != TABSET) { if ((status = tabset(tab))) return status; } /* This is used a lot. */ M = tab->M; tabcoord = 0x0; nv = 0; if (M > 1) { nv = 1 << M; tabcoord = calloc(nv, sizeof(double *)); } status = 0; wp = world; xp = x; statp = stat; for (n = 0; n < ncoord; n++) { /* Locate this coordinate in the coordinate array. */ edge = 0; for (m = 0; m < M; m++) { tab->p0[m] = 0; } for (ic = 0; ic < tab->nc; ic++) { if (tab->p0[0] == 0) { /* New row, could it contain a solution? */ if (edge || tabrow(tab, wp)) { /* No, skip it. */ ic += tab->K[0]; tab->p0[1]++; edge = tabedge(tab); /* Because ic will be incremented when the loop is reentered. */ ic--; continue; } } if (M == 1) { /* Deal with the one-dimensional case separately for efficiency. */ if (*wp == tab->coord[0]) { tab->p0[0] = 0; tab->delta[0] = 0.0; break; } else if (ic < tab->nc - 1) { if (((tab->coord[ic] <= *wp && *wp <= tab->coord[ic+1]) || (tab->coord[ic] >= *wp && *wp >= tab->coord[ic+1])) && (tab->index[0] == 0x0 || tab->index[0][ic] != tab->index[0][ic+1])) { tab->p0[0] = ic; tab->delta[0] = (*wp - tab->coord[ic]) / (tab->coord[ic+1] - tab->coord[ic]); break; } } } else { /* Multi-dimensional tables are harder. */ if (!edge) { /* Addresses of the coordinates for each corner of the "voxel". */ for (iv = 0; iv < nv; iv++) { offset = 0; for (m = M-1; m >= 0; m--) { offset *= tab->K[m]; offset += tab->p0[m]; if ((iv & (1 << m)) && (tab->K[m] > 1)) offset++; } tabcoord[iv] = tab->coord + offset*M; } if (tabvox(tab, wp, 0, tabcoord, 0x0) == 0) { /* Found a solution. */ break; } } /* Next voxel. */ tab->p0[0]++; edge = tabedge(tab); } } if (ic == tab->nc) { /* Coordinate not found; allow minor extrapolation. */ if (M == 1) { /* Should there be a solution? */ if (tab->extrema[0] <= *wp && *wp <= tab->extrema[1]) { dcrd = tab->coord; for (i = 0; i < 2; i++) { if (i) dcrd += tab->K[0] - 2; delta = (*wp - *dcrd) / (*(dcrd+1) - *dcrd); if (i == 0) { if (-0.5 <= delta && delta <= 0.0) { tab->p0[0] = 0; tab->delta[0] = delta; ic = 0; break; } } else { if (1.0 <= delta && delta <= 1.5) { tab->p0[0] = tab->K[0] - 1; tab->delta[0] = delta - 1.0; ic = 0; } } } } } else { /* Multi-dimensional tables. */ /* >>> TBD <<< */ } } if (ic == tab->nc) { /* Coordinate not found. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_WORLD)); } else { /* Determine the intermediate world coordinates. */ Km = tab->K; for (m = 0; m < M; m++, Km++) { /* N.B. Upsilon_m and psi_m are 1-relative FITS indexes. */ upsilon = (tab->p0[m] + 1) + tab->delta[m]; if (upsilon < 0.5 || upsilon > *Km + 0.5) { /* Index out of range. */ *statp = 1; status = wcserr_set(TAB_ERRMSG(TABERR_BAD_WORLD)); } else { /* Do inverse lookup of the index vector. */ Psi = tab->index[m]; if (Psi == 0x0) { /* Default indexing. */ psi_m = upsilon; } else { /* Decrement Psi and use 1-relative C array indexing to match the 1-relative FITS indexing. */ Psi--; if (*Km == 1) { /* Degenerate index vector. */ psi_m = Psi[1]; } else { k = (int)(upsilon); psi_m = Psi[k]; if (k < *Km) { psi_m += (upsilon - k) * (Psi[k+1] - Psi[k]); } } } i = tab->map[m]; xp[i] = psi_m - tab->crval[m]; } } *statp = 0; } wp += nelem; xp += nelem; statp++; } if (tabcoord) free(tabcoord); return status; } /*---------------------------------------------------------------------------- * Convenience routine to deal with of edge effects in tabprm::p0. *---------------------------------------------------------------------------*/ int tabedge(struct tabprm* tab) { int edge, *Km, m; edge = 0; Km = tab->K; for (m = 0; m < tab->M; m++, Km++) { if (tab->p0[m] == *Km) { /* p0 has been incremented beyond the end of the row, point it to the next one. */ tab->p0[m] = 0; tab->p0[m+1]++; } else if (tab->p0[m] == *Km - 1 && *Km > 1) { /* p0 is sitting at the end of a non-degenerate row. */ edge = 1; } } return edge; } /*---------------------------------------------------------------------------- * Quick test to see whether the world coordinate indicated by wp could lie * somewhere along (or near) the row of the image indexed by tabprm::p0. * Return 0 if so, 1 otherwise. * * tabprm::p0 selects a particular row of the image, p0[0] being ignored (i.e. * treated as zero). Adjacent rows that delimit a row of "voxels" are formed * by incrementing elements other than p0[0] in all binary combinations. N.B. * these are not the same as the voxels (pixels) that are indexed by, and * centred on, integral pixel coordinates in FITS. * * To see why it is necessary to examine the adjacent rows, consider the 2-D * case where the first world coordinate element is constant along each row. * If the first element of wp has value 0.5, and its value in the row indexed * by p0 has value 0, and in the next row it has value 1, then it is clear that * the solution lies in neither row but somewhere between them. Thus both rows * will be involved in finding the solution. * * tabprm::extrema is the address of the first element of a 1-D array that * records the minimum and maximum value of each element of the coordinate * vector in each row of the coordinate array, treated as though it were * defined as * * double extrema[K_M]...[K_2][2][M] * * The minimum is recorded in the first element of the compressed K_1 * dimension, then the maximum. *---------------------------------------------------------------------------*/ int tabrow(struct tabprm* tab, const double *wp) { int iv, M, m, nv, offset; unsigned int eq, gt, lt; const double tol = 1e-10; double *cp, w; M = tab->M; /* The number of corners in a "voxel". We need examine only half this number of rows. The extra factor of two will be used to select between the minimal and maximal values in each row. */ nv = 1 << M; eq = 0; lt = 0; gt = 0; for (iv = 0; iv < nv; iv++) { /* Find the index into tabprm::extrema for this row. */ offset = 0; for (m = M-1; m > 0; m--) { offset *= tab->K[m]; offset += tab->p0[m]; /* Select the row. */ if (iv & (1 << m)) { if (tab->K[m] > 1) offset++; } } /* The K_1 dimension has length 2 (see prologue). */ offset *= 2; /* Select the minimum on even numbered iterations, else the maximum. */ if (iv & 1) offset++; /* The last dimension has length M (see prologue). */ offset *= M; /* Address of the extremal elements (min or max) for this row. */ cp = tab->extrema + offset; /* For each coordinate element, we only need to find one row where its minimum value is less than that of wp, and one row where the maximum value is greater. That doesn't mean that there is a solution, only that there might be. */ for (m = 0; m < M; m++, cp++) { /* Apply the axis mapping. */ w = wp[tab->map[m]]; /* Finally the test itself; set bits in the bitmask. */ if (fabs(*cp - w) < tol) { eq |= (1 << m); } else if (*cp < w) { lt |= (1 << m); } else if (*cp > w) { gt |= (1 << m); } } /* Have all bits been switched on? */ if ((lt | eq) == nv-1 && (gt | eq) == nv-1) { /* A solution could lie within this row of voxels. */ return 0; } } /* No solution in this row. */ return 1; } /*---------------------------------------------------------------------------- * Does the world coordinate indicated by wp lie within the voxel indexed by * tabprm::p0? If so, do a binary chop of the interior of the voxel to find * it and return 0, with tabprm::delta set to the solution. Else return 1. * * As in tabrow(), a "voxel" is formed by incrementing the elements of * tabprm::p0 in all binary combinations. Note that these are not the same as * the voxels (pixels) that are indexed by, and centred on, integral pixel * coordinates in FITS. * * tabvox() calls itself recursively. When called from outside, level, being * the level of recursion, should be given as zero. tabcoord is an array * holding the addresses of the coordinates for each corner of the voxel. * vox is the address of a work array (vox2) used during recursive calls to * dissect the voxel. It is ignored when tabvox() is called from outside * (level == 0). * * It is assumed that the image dimensions are no greater than 16. ----------------------------------------------------------------------------*/ int tabvox( struct tabprm* tab, const double *wp, int level, double **tabcoord, unsigned int *vox) { int i, iv, jv, M, m, nv; unsigned int eq, et, gt, lt, vox2[16]; const double tol = 1e-10; double coord[16], *cp, dv, w, wgt; M = tab->M; /* The number of corners in a voxel. */ nv = 1 << M; dv = 1.0; for (i = 0; i < level; i++) { dv /= 2.0; } /* Could the coordinate lie within this voxel (level == 0) or sub-voxel (level > 0)? We use the fact that with linear interpolation the coordinate elements are extremal in a corner and test each one. */ lt = 0; gt = 0; eq = 0; for (iv = 0; iv < nv; iv++) { /* Select a corner of the sub-voxel. */ for (m = 0; m < M; m++) { coord[m] = 0.0; tab->delta[m] = level ? dv*vox[m] : 0.0; if (iv & (1 << m)) { tab->delta[m] += dv; } } /* Compute the coordinates of this corner of the sub-voxel by linear interpolation using the weighting algorithm described in Sect. 3.4 of WCS Paper IV. */ for (jv = 0; jv < nv; jv++) { /* Find the weight for this corner of the parent voxel. */ wgt = 1.0; for (m = 0; m < M; m++) { if (jv & (1 << m)) { wgt *= tab->delta[m]; } else { wgt *= 1.0 - tab->delta[m]; } } if (wgt == 0.0) continue; /* Add its contribution to each coordinate element. */ cp = tabcoord[jv]; for (m = 0; m < M; m++) { coord[m] += *(cp++) * wgt; } if (wgt == 1.0) break; } /* Coordinate elements are minimal or maximal in a corner. */ et = 0; for (m = 0; m < M; m++) { /* Apply the axis mapping. */ w = wp[tab->map[m]]; /* Finally the test itself; set bits in the bitmask. */ if (fabs(coord[m] - w) < tol) { et |= (1 << m); } else if (coord[m] < w) { lt |= (1 << m); } else if (coord[m] > w) { gt |= (1 << m); } } if (et == nv-1) { /* We've stumbled across a solution in this corner of the sub-voxel. */ return 0; } eq |= et; } /* Could the coordinate lie within this sub-voxel? */ if ((lt | eq) == nv-1 && (gt | eq) == nv-1) { /* Yes it could, but does it? */ /* Is it time to stop the recursion? */ if (level == 31) { /* We have a solution, squeeze out the last bit of juice. */ dv /= 2.0; for (m = 0; m < M; m++) { tab->delta[m] = dv * (2.0*vox[m] + 1.0); } return 0; } /* Subdivide the sub-voxel and try again for each subdivision. */ for (iv = 0; iv < nv; iv++) { /* Select the subdivision. */ for (m = 0; m < M; m++) { vox2[m] = level ? 2*vox[m] : 0; if (iv & (1 << m)) { vox2[m]++; } } /* Recurse. */ if (tabvox(tab, wp, level+1, tabcoord, vox2) == 0) { return 0; } } } /* No solution in this sub-voxel. */ return 1; } astropy-0.3/cextern/wcslib/CHANGES0000644000175000017500000021650212243255342015133 0ustar oleoleWCSLIB version 4.19 (2013/09/30) -------------------------------- * C library - Bug fix in wcshdo(), uncovered by cppcheck and reported by David Binderman. Fixed additional minor inconsistencies in hpxx2s(), wcsprintf(), and wcsfprintf() reported by cppcheck. - Minor fix to twcstab reported by cppcheck. - Bug fix in wcssub() for handling (non-standard) PROJPn keywords (uncovered by valgrind, reported by Paul Price). WCSLIB version 4.18 (2013/07/13) -------------------------------- * C library - Implemented the butterfly projection (XPH), being the polar form of the HEALPix projection with (H,K) = (4,3). Augmented tprj1.c and tprj2.c to suit. - Bug fix in celfix() when translating GLS to SFL with non-zero reference point. - Documentation generation moved to doxygen 1.8.4 (was 1.5.6). * Fortran wrappers - Wrappers for XPH and corresponding modifications to the test programs. - Fixed a few inconsequential warnings from gfortran 4.7.2 relating to implicit type conversions in the test programs. * Utilities - In HPXcvt, fixed incorrect axis scaling (CDELT1 and CDELT2) in the XPH header, and set the PCi_ja matrix in the HPX header to a pure 45 degree rotation with appropriate adjustment of CDELT1 and CDELT2 (matching XPH). Also set LONPOLE to 180 degree in the XPH header with adjustment of CRVAL1 as recommended in the errata. These changes prompted by Paddy Leahy. Also, modified the FITS header comment for XPH - it is no longer "experimental", and accept the '-x' option (i.e. without qualification) as equivalent to '-xn'. WCSLIB version 4.17 (2013/01/29) -------------------------------- * C library - Added wcsfprintf() to wcsprint.h. Now used in wcsbth() and wcspih() to allow diagnostic output to be redirected. Changes provided by Michael Droettboom. WCSLIB version 4.16 (2012/11/07) -------------------------------- * C library - When wcspih() constructs a default coordinate representation it will give it the special name "DEFAULTS", and will not report "Found one coordinate representation" (if reporting is enabled). * Utilities - wcsware has a new option, -P, which does the same as -p except that it won't print a wcsprm struct with the name "DEFAULTS". WCSLIB version 4.15 (2012/09/26) -------------------------------- * C library - Bug fixes in spctype(), spcspxe(), spcxpse, and spctrne() for propagating an error status correctly from lower-level routines. Amendments to the prologues of these routines. Reported by Hans Terlouw. - Similarly for wcsunitse(), wcsulexe(), and wcsutrne(). * PGSBOX - Bug fix in PGSBOX for handling cycles in angle when both world coordinate elements are angular. Reported by Thomas Robitaille. WCSLIB version 4.14 (2012/07/13) -------------------------------- * C library - Problems were caused for fitshdr(), wcsbth(), wcspih(), wcsulex(), datfix() and wcshdo(), by locales such as "fr_FR" in which commas are used to delimit the decimal part of floating point numbers. In particular, these locales adversely affect the behaviour of sscanf() and sprintf() when reading and writing FITS header keyvalues. Thread-safe fixes provided by Michael Droettboom. - Applied astropy patches from Michael Droettboom: attend to compiler warnings in prj.c, spc.c, tab.c, and wcsutil.c, including those for MS-Windows. WCSLIB version 4.13.4 (2012/04/02) ---------------------------------- * Installation - Relaxed the closure tolerance slightly in tlog.f as for tlog.c previously. WCSLIB version 4.13.3 (2012/03/26) ---------------------------------- * Installation - Relaxed the closure tolerance slightly in tlog.c for gcc 4.6.3 on Ubuntu 12.04 (reported by Ole Streicher). WCSLIB version 4.13.2 (2012/03/21) ---------------------------------- * Installation - Changes to configure.ac and the GNUmakefiles to put '-lm' strictly in the correct sequence when producing the sharable library (reported by Ole Streicher). WCSLIB version 4.13.1 (2012/03/15) ---------------------------------- * C library - Workaround in wcserr_set() for an unfortunate compiler segv from gcc 4.2.1 in MacOSX 10.7. WCSLIB version 4.13 (2012/03/14) -------------------------------- * C library - Allow naxis == 0 in wcsini() and linini() for a degenerate coordinate system as may be produced by wcssub(). In wcssub(), ensure that wcsini() is called for coordinate systems with naxis == 0. In wcssptr(), call spcfree() before spcini() to plug a memory leak. WCSLIB version 4.12 (2012/02/29) -------------------------------- * C library - In spctrne(), guard against restfrq == restwav == 0.0 when translating between two velocity-characteristic types, or between two wave-characteristic types (the translation is independent of restfrq and restwav, but a dummy value is needed for intermediate calculations). WCSLIB version 4.11 (2012/02/21) -------------------------------- * C library - Bug fix in spcset() for handling simple linear spectral axes. * Fortran wrappers - Bug fix in spctrne_() for handling ctypeS2. WCSLIB version 4.10 (2012/02/06) -------------------------------- * C library - datfix() and spcfix() now return informative messages when dates and AIPS-convention spectral axes are translated (changes contributed by Michael Droettboom). spcaips() now returns an error status for invalid values of VELREF. - wcssub() has been augmented with the ability to add new axes onto a wcsprm struct. WCSLIB version 4.9 (2012/01/24) ------------------------------- * C library - Fixes to wcsfixi() for collecting the messages properly in the info array (from Michael Droettboom). - Handle certain malformed date strings more gracefully in datfix(). - Make informative messages printed by wcserr_prt() a bit more informative. WCSLIB version 4.8.4 (2011/12/05) --------------------------------- * C library - Fixed the pseudo-random number generator in twcstab.c - gcc 4.6 with '-O2' baulked at testing for signed integer overflow. * Installation - In configure.ac, the Fortran compiler's libraries must be added to the link list when checking for the PGPLOT libraries since gcc is driving the linker. Likewise in C/GNUmakefile when linking test programs that use PGPLOT. - Use 'make CHECK=nopgplot check' to run only the non-graphical tests (even if PGPLOT is available). - After compiling and running the tests, 'make check' now summarizes the non-graphical test results and stops if any failed. WCSLIB version 4.8.3 (2011/11/17) --------------------------------- * C library - Minor generalization of the wcserr diagnostics to allow the return of informative messages which are associated with negative status values. wcserr_prt() will now recognize and print them as such. Added wcserr_clear() to reset (clear) a wcserr struct. - Modified unitfix() to return an informative message if a units alias is applied, and wcsfixi() to allow such messages to be propagated through the info array (from Michael Droettboom). - Modified twcsfix.c to use wcserr diagnostics, in particular to report units alias translations. * Fortran wrappers - In wcsfix_(), interpret *naxis == 0 as meaning naxis == 0x0, thus causing cylfix() to be skipped. - Modified twcsfix.f to reflect changes made to twcsfix.c. WCSLIB version 4.8.2 (2011/10/04) --------------------------------- * Installation - Changes for Debian package generation contributed by Ole Streicher: - Corrections to 'configure' reported by 'lintian'. - Generate man pages for the utility programs and install them. WCSLIB version 4.8.1 (2011/09/19) --------------------------------- * Installation - Set SONAME in the sharable library in accordance with tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html (reported by Ole Streicher, Debian package maintainer). The sharable library will again be installed with full release number and with a symbolic link from SONAME pointing to it. If defined, SHRLN will point to SONAME. WCSLIB version 4.8 (2011/08/15) ------------------------------- * C library - New error diagnostics mechanism contributed by Michael Droettboom: Most functions that return a numeric status (error) code now also write a detailed error message to a wcserr struct attached to the passed-in *prm struct. See wcserr.h for more information. Functions that didn't have a *prm struct as an argument have no direct way to return an error message. Therefore, these functions now have duplicate versions with the suffix "e" that take an additional "struct wcserr *" parameter. These functions are: spcspx() -> spcspxe() spctrn() -> spctrne() spctyp() -> spctype() spcxps() -> spcxpse() wcsulex() -> wcsulexe() wcsunits() -> wcsunitse() wcsutrn() -> wcsutrne() A new function wcsfixi() was added which is identical to wcsfix() but in addition stores all of the detailed textual messages about the fixes that were performed. - In wcssub(), ensure that wcstab->m_tab has been initialized before trying to free it on status return 12 or 13 (reported by Hans Terlow). - Bug fixes: - In sphx2s() and sphs2x() for the case where |eul[1]| = 180.0. - For parsing AIPS-convention VELREF in wcsbth(). - In spcaips() for translating AIPS-convention CTYPEia without Doppler frame. - Non-graphical test programs now simply report "PASS" if they satisfy the reporting tolerance for closure residuals, etc. Their full output is reported otherwise. Run 'make MODE=interactive check' to revert to the previous behaviour of reporting the full output for tests that succeed. - Eliminated compiler warnings about type-punning of pointer-to- function. * Fortran wrappers Extensive modifications to track the new error handling mechanism in the C library. * Installation - configure now prefers gfortran over g77 if available. - Don't rely on "." being in the PATH if config.status needs to be run in the pgsbox and utils makefile (reported by Peter Teuben). WCSLIB version 4.7 (2011/02/07) ------------------------------- * C library - Bug fix in celset() for interpreting LATPOLEa when LONPOLEa = phi0. Crept in at version 4.4. - Fixed the bounds test on y in hpxx2s() (HEALPix projection) for unconventional values of H and K. In hpxx2s() and hpxs2x(), corrected the offset of the southern polar half-facets for even K. In hpxs2x(), put the phi = 180 meridian in the expected place. - Bug fixes in tabx2s() and tabs2x() for default indexes (reported by David Berry). In tabs2x(), if no solution is found then do minor extrapolation past the ends of each row (1-D case only). Sped up tabs2x() by about 50%. - New functions wcsprintf(), wcsprintf_set(), and wcsprintf_buf(), declared in wcsprintf.h, provide control over the disposition of output from celprt(), linprt(), prjprt(), spcprt(), tabprt(), and wcsprt() routines. Prompted by Michael Droettboom, with an initial implementation. * Fortran wrappers - In the various test programs, used EQUIVALENCEs to ensure that the CEL, LIN, PRJ, etc. arrays are aligned on a DOUBLE PRECISION boundary. * PGSBOX - Bug fix for the case where NG1 == 0 and GRID1(0) < 0, and likewise for NG2 and GRID2. * Utilities - In wcsware, added a '-w' option to convert world coordinates obtained from stdin to pixel coordinates using wcss2p(). Allow multiple sets of input coordinates with the '-x' and '-w' options and report the value of the intermediate world coordinates. * User manual - Fixed list formatting for function return values < 0 or > 9. - New section for wcsprintf() and related routines. * Installation - Changes prompted by Sébastien Fabbro for the Gentoo Linux package: a) autoconf updates, b) respect LDFLAGS when building the shared library, c) install documentation, d) recognise DESTDIR for doing a staged installation. - As of this release, the minor WCSLIB version number (second field) will be incremented if and only if a change is made that affects the library itself, not the documentation or utilities. The version number on the installed libraries and header files will omit the patch number (third field). WCSLIB version 4.6.3 (2010/11/24) --------------------------------- * C library - Bug fix in wcsbth() for handling the inheritance of image header keywords (uncovered by valgrind, reported by Jim Lewis). WCSLIB version 4.6.2 (2010/11/22) --------------------------------- * C library - Fixed a memory leak in wcsbth.l (reported by Jim Lewis). WCSLIB version 4.6.1 (2010/11/18) --------------------------------- * Fortran wrappers - Fixed typos in cel_f.c, celget[cdi] -> celgt[cdi]. WCSLIB version 4.6 (2010/11/16) ------------------------------- * C library - In wcsulex.l and wcsutrn.l, stdlib.h must be included explicitly before the redefinition of exit() - most versions of flex do include it upfront but some don't (reported by Peter Williams). * Fortran wrappers - Changes intended to avert nuisance compiler warnings that could potentially obscure warnings indicative of a genuine problem: - To stop messages about unused variables when the relevant compiler option is set, e.g. 'g77 -Wunused', the various *_ERRMSG arrays defined in the Fortran include files and (formerly) initialized therein via DATA statements, e.g. PRJ_ERRMSG in prj.inc, have now been placed into COMMON blocks with names such as PRJ_DATA, and are initialized via DATA statements in BLOCK DATA subprograms defined in separate files, e.g. prj_data.f. - To stop messages about subroutines being invoked with inconsistent argument lists if the relevant compiler option is not set, e.g. 'g77 -Wno-globals', the C wrapper functions that take 'void *' arguments now have separate forms for INTEGER, DOUBLE PRECISION, and CHARACTER arguments that simply invoke the generic function. Application code must be modified to take advantage of this. * User manual - In the section on the Fortran wrappers in the manual, warn about the need for the INTEGER array holding a data structure to be aligned on a DOUBLE PRECISION boundary. WCSLIB version 4.5.6 (2010/10/28) --------------------------------- * Installation - Fixed the search for CFITSIO and PGPLOT library and include directories. WCSLIB version 4.5.5 (2010/10/14) --------------------------------- * Installation - Build the PGSBOX sharable library. WCSLIB version 4.5.4 (2010/09/28) --------------------------------- * C library - In wcshdo(), according to the FITS standard, "Letters in the exponential form ('E' or 'D') shall be upper case" (reported by Michael Droettboom). WCSLIB version 4.5.3 (2010/09/23) --------------------------------- * Utilities - Various improvements to wcsgrid: correct the scaling set via cpgwnad(); label angles other than RA,Dec in decimal degrees; draw the projection boundary for projections other than zenithals. WCSLIB version 4.5.2 (2010/09/23) --------------------------------- * C library - Fixed the translation of GLS to SFL in wcsset() and celfix() when the reference longitude is non-zero - it introduces an offset in longitude in the normal way. (This undoes part of the change applied in version 4.4.) WCSLIB version 4.5.1 (2010/08/12) --------------------------------- * C library - New utility function, sphpad(), computes the coordinates of points offset by given angular distances and position angles from a given point on the sky (complementary to sphdpa()). * Fortran wrappers - New wrapper function: - SPHPAD for sphpad(). WCSLIB version 4.5 (2010/07/16) ------------------------------- * C library - Fixed the interpretation of VELREF when translating AIPS-convention spectral types. Such translation is now handled by a new special- purpose function, spcaips(). The wcsprm struct has been augmented with an entry for velref which is filled by wcspih() and wcsbth(). Previously, selection by VELREF of the radio or optical velocity convention for type VELO was not properly handled. * Fortran wrappers - New wrapper function: - SPCAIPS for spcaips(). - Changed spc.inc, spc_f.c, wcs.inc and wcs_f.c to track VELREF changes. - Declared functions external in the include files to avoid compiler warnings about unused variables (if the particular option is set). * Utilities - Added a '-q' option to fitshdr to quit after a specified number of HDUs. WCSLIB version 4.4.4 (2009/09/14) --------------------------------- * Installation - Added more configure options for controlling the build: --disable-fortran, --disable-utils, --without-cfitsio, and --without-pgplot. WCSLIB version 4.4.3 (2009/09/03) --------------------------------- * C library - Set wave number units to "/m" in spctyp(), was "1/m" which is not strictly legal and wasn't handled by wcsulex() (reported by Hans Terlow). Also fixed a number of units specifications in the prologue of spx.h to conform with Paper I usage. - In wcsulex(), allow unit strings like "1/m" in addition to "/m", provided that the superfluous "1" is the first non-blank character in the expression, or parenthesised sub-expression. - In wcssptr(), ensure that i is always reset if given < 0. * User manual - Augmented the list of FITS WCS and related software in the manual. WCSLIB version 4.4.2 (2009/08/13) --------------------------------- * C library - In sphx2s() and sphs2x(), handle the case where |eul[1]| = 180.0 separately for speed and accuracy. This change also fixes a rare and subtle bug in cels2x() that occurs when celprm::isolat is set and the magnitude of the first latitude in the lat[] vector exceeds 90 deg (reported by Hans Terlouw). * Installation - Fix relating to creation of symlinks when installing the libraries. WCSLIB version 4.4.1 (2009/08/11) --------------------------------- * Installation - Fixes for installation of the CHANGES file and for the creation of a symbolic link for the sharable library if one already exists. WCSLIB version 4.4 (2009/08/10) ------------------------------- * C library - Creation of WCSLIB user manual from the header file prologues using a special-purpose parser, doxextr, and sed scripts to generate input for doxygen. This required minor formatting changes to all prologues plus miscellaneous changes such as naming of arguments in function prototypes. - Bug fix in wcsset() that affected handling of PROJPn (deprecated) and PVi_ma attached to the longitude (not latitude) axis. Guard against long strings when copying the projection code. In wcs_types(), allow for early Paper IV distortion codes (e.g. "RA---TAN-SIP") when parsing CTYPEia. - Use sincos() whereever possible for a ~15% speedup (patches for cel.c, prj.c and sph.c supplied by Michael Droettboom). configure checks for, and uses it automatically if available. - Fixed the translation of GLS to SFL in wcsset() and celfix() when the reference longitude and latitude are non-zero. (In the AIPS convention, this simply translates the reference point, i.e. the map as a whole, to those coordinates without creating an oblique grid.) - Bug fix in prjoff(), a utility function used by the prj routines. It forces (x,y) = (0,0) at (phi_0,theta_0) when the latter are set by PVi_[012]a attached to the longitude (not latitude) axis. Rarely used in practice. - New utility function, sphdpa(), computes the distance and position angle from a point on the sphere to a set of field points. - In sphx2s() and sphx2s(), handle a simple change in origin of longitude using a short-cut calculation for speed and accuracy. Similarly in celset(), check whether phip == phi0 when computing latp and if so use a short-cut that ensures latp == 90.0 (exactly) if lat0 == theta0. The resulting spherical rotation then becomes a simple change in origin of longitude. In particular, these changes should assist PGSBOX in drawing grid lines of +/-180 longitude, to prevent flip-flopping between one and the other. - wcsbth() & wcspih(): resolved an inconsistency between the documentation and code by renamimg WCSHDR_VSOURCEa as WCSHDR_VSOURCE. - Flex code: moved declaration of helper functions out of global scope. - Fixed the call to wcss2p() in twcshdr (in a section of code not usually exercised). * Fortran wrappers - New wrapper functions: - WCSBTH for wcsbth(), - WCSBDX for wcsbdx(), - CDFIX for cdfix(), - SPHDPA for sphdpa(). - Updated WCSLEN (in wcs.inc) and added WCS_COLAX and WCS_VELANGL to match changes to wcsprm made in v4.3 with corresponding changes to the wrapper functions. Likewise updated TABLEN (in tab.inc) for changes to tabprm, and added CEL_LATPREQ for celprm. - Struct lengths (WCSLEN, PRJLEN, etc.) are now long enough to accomodate 64-bit machines. - Updated the flag bits for the RELAX argument in wcshdr.inc to reflect changes to wcshdr.h made in v4.3. Renamed WCSHDR_VSOURCEa to WCSHDR_VSOURCE for consistency with the C library. * PGSBOX - Improved grid labelling, particularly in minimizing the number of fields required in sexagesimal labels. * Utilities - New utility program: - wcsware extracts the WCS keywords for an image from the specified FITS file, constructs wcsprm structs for each coordinate representation found, and performs a variety of operations using them. - Old utility programs (first appeared in 4.3 but were not recorded): - HPXcvt reorganises HEALPix data into a 2-D FITS image with HPX coordinate system. - wcsgrid extracts the WCS keywords for an image from the specified FITS file and uses pgsbox() to plot a 2-D coordinate graticule for each alternate representation found. - fitshdr lists headers from a FITS file specified on the command line, or else on stdin, printing them as 80-character keyrecords without trailing blanks. * Installation - New configure options, --with-pgplotinc, --with-pgplotlib, --with-cfitsioinc and --with-cfitsiolib allow additional directories to be added to the library and include file search path. - Miscellaneous fixes and improvements to the installation process. - Generate a metadata file for pkg-config. - Added 'make MODE=interactive check' to run the test programs in interactive mode rather than batch. - Merged the separate CHANGES files for C, Fortran and PGSBOX into one (this), with a new section for utilities. WCSLIB version 4.3.3 (2009/04/30) --------------------------------- * C library - fitshdr.l, wcsbth.l, and wcspih.l: use setjmp/longjmp to preempt the call to exit() which is hard-coded in function yy_fatal_error() supplied by flex. - wcspih.l: if NAXIS is non-zero but there were no WCS keywords at all in the header then create a default WCS with blank alternate version. WCSLIB version 4.3.2 (2009/03/16) --------------------------------- * C library - utils/GNUmakefile: create BINDIR if necessary prior to installing utilities. WCSLIB version 4.3.1 (2008/09/08) --------------------------------- * Installation - Top-level GNUmakefile: install header files. WCSLIB version 4.3 (2007/12/27) ------------------------------- * C library - A new general WCS header parser wcsbth() handles binary table image arrays and pixel lists as well as image array headers. Added "colax" to the wcsprm struct to record the column numbers for each axis in a pixel list. - New function wcsbdx() is the analog of wcsidx() for the array of wcsprm structs returned by wcsbth(). - New function wcshdo() writes out a wcsprm struct as a FITS header. - Changes to wcspih(): - Bug fix, check for a == 0 (indication of a keyword that applies to all alternates) in internal helper function wcspih_naxes() (reported by Craig Markwardt). - Added a new ctrl option to remove valid WCS keyrecords except for those with a more general role, namely {DATE,MJD}-{OBS,AVG} and OBSGEO-{X,Y,Z} (suggested by Jim Lewis). - Added a rule for VELANGLa. Also added "velangl" to the wcsprm struct. - Do checks on the i, k & m keyword parameters in . - Fixed the test for repeated blanks in the NAXIS and WCSAXES patterns. - Fixed three rules to allow m == 0. - Reworked the implementation notes in the prologue. - The flex scanners, fitshdr.l, wcsbth.l, wcspih.l, wcsulex.l, and wcsutrn.l, invoke yylex_destroy() before returning to avoid a 16kiB memory leak. This was reported by several people, however it may be problematic depending on the version of flex used - version 2.5.9 or later is required. If this is not available, C sources pre- generated by flex 2.5.33 will be used. - In wcs.c, don't define the signbit macro if already defined (for MacOSX). - In wcs.h, documented wtbarr namespace issues in C++. - In wcsset(), always set wcsprm.cunit[i], if possible (primarily for use by wcshdo()). - In wcsfix.c, parenthesised a boolean expression that was otherwise incorrect. - Fixed an obscure floating point rounding error in celset() that appeared with -O2 optimization in gcc v3.3.5 (Linux). - prjset() now correctly propagates the status value returned by the specific projection-setting functions (reported by Bill Pence). - Bug fix in hpxx2s(), also added bounds checking. Minor efficiencies in carx2s() and merx2s(). - In the various functions that print the contents of the structs, use the "%p" printf conversion specifier to print addresses rather than casting the pointer to int and using "#x". The latter does not work on 64-bit machines where sizeof(int) != sizeof(void*). - Reorganized the various structs to get alignment on 64-bit machines. - All header file prologues now reference the README file for an overview of the library. - Miscellaneous portability fixes for 64-bit, MacOSX, OSF compiler, etc. - Elimination of compiler warnings, e.g. parenthesised assignments used as truth values (a favourite gcc gripe!), etc. - Process flex descriptions using a newer version of flex, primarily for MacOSX. However, the processed files are now only used when flex 2.5.9 or later is not available. - Removed WCSLIB 2.x backwards-compatibility measures from lin.h, prj.h, prj.c, and sph.h. * Fortran wrappers - (No substantive changes.) * PGSBOX - Miscellaneous improvements to PGSBOX. * General - Switched licensing to LGPL 3.0. - In comment text, replaced use of the obsolete term "card" with "keyrecord" which consists of a "keyword", "keyvalue", and "keycomment". * Installation - General improvements to the installation process: autoconf-related portability improvements, particularly relating to Fortran name mangling; makefile rules for building the shared library, for processing flex descriptions; don't rely on "." being in the PATH when running tests. WCSLIB version 4.2 (2005/09/23) ------------------------------- * C library - Brought the installation process under control of GNU autoconf, the top-level makefile now builds and tests everything, and the C library has a config.h in which WCS_INT64 is set. Added an INSTALL file. - Merged the FORTRAN, C and PGSBOX READMEs into one top-level README. - Extensions for -TAB coordinate handling: in tabx2s() and tabs2x(), allow extrapolation by half a cell at either end of the index and coordinate tables; fits_read_wcstab() (in getwcstab.{h,c}) allows TDIMn to be omitted for 1-D lookup tables for which it has the form '(1,K)', i.e. describing a degenerate 2-D array; wcsprt() now prints the wtbarr structs in wcsprm. - Bug fixes for -TAB coordinate handling: in tabx2s() and tabs2x() the incorrect indexing variable, m instead of i, was used for tab->crval[]; wcsp2s() and wcss2p() returned prematurely in the tabular coordinate loop; in wcstab(), removed an extraneous assignment to wtbp->kind for index arrays. - In wcsp2s() and wcss2p(), elements of the stat[] vector that had been set were being reset incorrectly to zero. The stat[] values are now set as flag bits for each coordinate element. - Added cdfix() to the wcsfix() suite to fix erroneously omitted CDi_ja cards. - PGSBOX is now compiled into a separate object library, and is installed alongside WCSLIB. - Eliminated several instances of non-ANSI C library functions and header files and some residual K&R C usage. The Sun C compiler complained about const int definitions of initializers used in variable declarations in some of the test programs; changed these to preprocessor macros. * Fortran wrappers - Fixed handling of 64-bit integer keyvalues in keyget_(). - Fixed output formatting of 64-bit integer keyvalues in tfitshdr.f. - Fixed minor syntax errors in twcsfix.f and tpih1.f reported by the Sun Fortran compiler. - The output of each test program now identifies the source file. * PGSBOX - (No substantive changes.) WCSLIB version 4.1 (2005/08/31) ------------------------------- * C library Summary of added functionality: - -TAB coordinate axes are now fully implemented in the WCSLIB driver functions (in wcs.{h,c}); multiple -TAB axes are supported. A new function, wcstab(), which is automatically invoked by wcspih(), parses -TAB-related header cards and sets up structs for a separate routine that reads the necessary arrays from a FITS binary table extension. An implementation of this routine in CFITSIO, fits_read_wcstab(), is provided. Note however that the interface of this function is experimental, and the code itself must be considered beta-release in WCSLIB 4.1. - Units specifications, either from CNAMEia or inline comments (with brackets), of arbitrary complexity are now fully implemented via a parser, wcsulex(), and converter, wcsunits(). This is invoked automatically by wcsset(). - Translators for non-standard WCS constructs are provided. These cover date formats, units specifications, defunct celestial projection types, AIPS spectral axis types, and the repair of malformed cylindrical coordinate systems. - wcspih() now has options to remove the WCS cards it has processed from the header and a new generic FITS header parser, fitshdr(), may be used to parse the remaining non-WCS cards. In addition to the more basic types, it handles 64-bit and 'very long' (70 digit) integer keyvalues, and also continued string keyvalues. It also does keyword matching and extracts units specifications in inline comments. - -LOG coordinates are now implemented independently of spectral coordinate types. Multiple -LOG axes are supported. - New function wcssptr() translates the spectral axis in a wcsprm struct to the required type. - The README file now gives an introduction to, and complete overview of, WCSLIB. It provides a point of entry to programming with WCSLIB. Complete descriptions and usage notes for all functions are contained in the header files. - The FORTRAN wrappers and test programs are now completely up-to-date with respect to the C implementation. - All code, including the FORTRAN wrappers, PGSBOX, and all test programs, now pass 'purify' without memory leaks, uninitialized memory reads, memory access violations, or other memory faults. Change notes: - Added options to wcspih() to remove WCS cards from the input header leaving only non-WCS cards behind. Modified test programs tpih1.c and tpih2.c to use CFITSIO optionally via preprocessor macro DO_CFITSIO. - New function wcstab() in wcshdr.{h,c} parses -TAB-related header cards and sets up structs for a separate routine that reads the necessary arrays from a FITS binary table extension. New test/demo program twcstab.c using header defined in wcstab.cards. - CFITSIO implementation, fits_read_wcstab() in getwcstab.{h,c}, of a function, independent of WCSLIB, for extracting arrays from a binary table as required in constructing -TAB coordinates. - New units specification parser, wcsulex() in wcsunits.h and wcsulex.l, and converter, wcsunits() in wcsunits.{h,c}. New test/demo program tunits.c. - New parser for non-standard units specifications, wcsutrn() in wcsunits.h and wcsutrn.l, also tested by tunits.c. - New functions datfix(), unitfix() (which applies wcsutrn()), celfix(), and spcfix() join cylfix() in wcsfix.{h,c} to translate various forms of non-standard or quasi-standard FITS WCS keyvalues in a wcsprm struct. wcsfix() applies all of these in sequence. New test/demo program twcsfix.c, with wcsfix() also now invoked by tpih1.c. - New generic FITS header parser, fitshdr() in fitshdr.{h,l}. New test/demo program tfitshdr.c uses wcs.cards with extra non-WCS cards added. - -LOG coordinates are now treated as a coordinate type separate from spectral coordinates, implemented via log.{h,c} and test program tlog.c. The logarithmic functions were removed from spx.{h,c}, and spc.c. - Extensive changes to wcs.{h,c} to support multiple -TAB and -LOG coordinate axes and units conversion. Substantially changed the test program, twcs.c, to test the more general functionality. - New function wcssptr() in wcs.{h,c} translates the spectral axis in a wcsprm struct. - Added DATE-AVG to wcsprm. Also ntab, tab, nwtb, and wtb required for -TAB implementation. Define struct wtbarr. - Added a types[] member to the wcsprm struct to identify axis coordinate types using a four-digit code. - Use memset() in wcsini() to null-fill character arrays in the wcsprm struct so that they don't appear to be padded with garbage when displayed by gdb. - Do alias translation for AIPS-convention spectral types in wcsset() using spctyp(). If wcsset() finds a CTYPEia in "4-3" form with an unrecognized algorithm code it now returns an error rather than assume that it's a linear axis. wcsset() now also resets lonpole and latpole to the values actually used. - Modified spctyp() to translate AIPS-convention spectral ctypes, and modified the argument list to return the parsed spectral type and algorithm code. The return arguments will not be modified if CTYPEia is not a valid spectral type; zero-pointers may be specified for any that are not of interest. Removed the external const variables, spc_codes and spc_ncode, as their function is now fulfilled by spctyp(). - Fixed a bug in spctrn() in resolving ctypeS2 wildcarding. - Added latpreq member to the celprm struct, set by celset() to indicate how LATPOLE is used. Augmented tcel2.c to report it. - New function tabmem() in tab.{h,c} takes control of user-allocated memory. - tabini() allows K == 0 and also K[m] == 0 to initialize partially the tabprm struct (for wcstab()). It now does fine-grained bookkeeping of memory allocation for the index arrays and allocates each individually. tabprm.index[] == 0x0 is recognized as default indexing in tabset(), tabx2s() and tabs2x(). - The *prt() functions report parameters to an extra decimal place. - tabprt() prints the array index for elements of the coordinate and index vectors. - Set the 0th element in all *_errmsg arrays to "Success". - Extracted string utility functions used by WCSLIB into wcsutil.{h,c}. - Removed support for K&R C. * Fortran wrappers - The FORTRAN wrappers and test programs are now completely up-to-date with respect to the C implementation. - New include files, wrappers, and test programs: fitshdr.inc, fitshdr_f.c, getwcstab.inc, getwcstab_f.c, log.inc, log_f.c, sph.inc, tab.inc, tab_f.c, tfitshdr.f, tlog.f, ttab1.f, ttab2.f, ttab3.f, tunits.f, twcsfix.f, twcstab.f, wcsfix.inc, wcsfix_f.c, wcsunits.inc, wcsunits_f.c. - Updates to reflect changes to the C library and test programs: cel.inc, cel_f.c, prj.inc, spc.inc, spc_f.c, spx.inc, spx_f.c, tlin.f, tpih1.f, tpih2.f, tprj1.f, tprj2.f, tspc.f, tsph.f, tspx.f, twcs.f, twcsmix.f, twcssub.f, wcs.inc, wcs_f.c, wcshdr.inc, wcshdr_f.c. - Added *_ERRMSG arrays containing status messages to all include files. - Removed support for K&R C. * PGSBOX - Fixed a subtle though benign memory fault identified by 'purify'. - Reset LATPOLE in the COE example in cpgtest.f when drawing the second (native) grid because it will have been set to a non-default value by wcsset() when the first grid was drawn; set wcs.flag to -1 before wcsinit() and call wcsfree() at the end. Similarly for pgtest.f. WCSLIB version 4.0 (2005/02/07) ------------------------------- * C library - Implemented tabular coordinates (-TAB). New files: tab.h and tab.c, and test programs ttab[123].c. These have not been incorporated into the higher-level (wcs.h) functions at this stage. - New spectral functions: spchek() checks a spectral algorithm code for legitimacy; from the spectral keywords given, spcspx() derives the corresponding CRVALi and CDELTi keywords for the underlying P-, and X-type spectral coordinates; spcxps() does the opposite; spctrn() combines spcspx() and spcxps() to translate one set of spectral keywords into another, e.g. 'FREQ' -> 'ZOPT-F2W'. - Implemented the HEALPix (HPX) projection in the prj functions. - Added a new function, wcsidx(), to return an array that indexes the alternate coordinate descriptions found by wcspih() (suggested by Bill Pence, NASA/Goddard). Modified tpih1.c to exercise it. - In wcsp2s() and wcss2p(), check that nelem equals or exceeds wcs.naxis; emphasised this in the usage notes for these functions in tab.h (suggested by Bill Pence, NASA/Goddard). - Moved the macros used for UNDEFINED values and the corresponding macro test function, undefined(), to wcsmath.h for general use. Previously, UNDEFINED values were only used internally, but they are now visible in some of the structs, particularly values of undefined auxiliary header cards in the wcsprm struct. - Remove const from the double args in the specx() prototype in spx.h to match the definition in spx.c (reported by Bryan Irby, NASA/Goddard). - Fixed the interaction between the FLAVOUR and PGPLOTLIB definitions in the C and FORTRAN Makefiles by introducing a separate variable, DO_PLOTS, to control whether to exercise test programs that require PGPLOT (reported by Bill Pence, NASA/Goddard). * Fortran wrappers - New wrapper defined in wcshdr_f.c: wcsidx_(). Modified test program tpih1.f to use it. * PGSBOX - (No substantive changes.) * General - Changed the copyright notice in all library routines from LGPL to GPL as recommended by the FSF (http://www.gnu.org/licenses/why-not- lgpl.html). * Installation - General improvements to the installation process: fixed the interaction between the FLAVOUR and PGPLOTLIB definitions in the Makefile by introducing a separate variable, DO_PLOTS, to control whether to exercise test programs that require PGPLOT (reported by Bill Pence, NASA/Goddard). Added an "install" target to the Makefile. WCSLIB version 3.6 (2004/08/25) ------------------------------- * C library - New service routine, wcssub() extracts the coordinate description for a subimage from a wcsprm struct. wcscopy() is now implemented as a preprocessor macro that invokes wcssub(). New test program, twcssub.c, tests wcssub(). - In wcspih(): 1) Fixed handling of string-valued keywords where the inline comment contains a single-quote character ('). 2) Fixed the address arithmetic for EPOCH and VELREF. 3) Translate VSOURCEa into ZSOURCEa if required. 4) Recognize SSYSSRCa. 5) Support free-format string keyvalues, as well as integer and floating-point keyvalues; documented this in the prologue of wcshdr.h. 6) Allow header cards without inline comments. 7) Fixed function prototyping in wcspih.l (i.e. ANSI and non-ANSI forms were potentially mixed). 8) Catch an unhandled newline character on the END card that was echoed to stdout. 9) In error messages, print "ERROR" (uppercase) - POSIX standard. - Modified wcs.cards to explain and test free-format keyvalues, and also augmented the inline comment on illegal WCS cards that are to be rejected, and WCS-like cards to be discarded. Added a header card with no inline comment. - Removed vsource from the wcsprm struct and added ssyssrc. - In wcsini(), fixed a problem with memory management for wcs.pv when NPVMAX is zero; likewise for wcs.ps and NPSMAX. - In wcsprt(), don't print auxiliary coordinate system information in arrays with zero address. - In wcss2p(), status == 9 (one or more invalid world coordinates) was not returned appropriately. - Renamed twcs1.c to twcs.c, and twcs2.c to twcsmix.c. - "Error status/code/number" is now referred to consistently as the "status return value". - Some vestiges of K&R C were removed: preprocessor definition of const, and K&R function prototypes. * Fortran wrappers - New wrapper defined in wcs_f.c: wcssub_(). New test program, twcssub.f. - Renamed twcs1.f to twcs.f, and twcs2.f to twcsmix.f. * PGSBOX - (No substantive changes.) * Installation - Worked over the C, FORTRAN, and PGSBOX makefiles, in particular to make them all consistent. WCSLIB version 3.5 (2004/06/28) ------------------------------- * C library - WCSLIB now provides a function, wcspih() implemented as a Flex description, that parses a FITS image header, either that of a primary HDU or an image extension. Given a character array containing the header it identifies and reads all WCS cards for the primary coordinate description and up to 26 alternate descriptions and returns this information as an array of wcsprm structs. A service routine, wcsvfree(), is provided to free the memory allocated by wcspih(). The relevant header file for these functions is wcshdr.h. Test programs, tpih1 and tpih2, are provided to verify wcspih. The first simply prints the contents of the structs using wcsprt(). The second uses cpgsbox() to draw coordinate graticules. A FITS WCS test header has been developed to provide input to these test programs. It is implemented as a list of card images, wcs.cards, one card per line, together with a program, tofits, that compiles these into a valid FITS file. tpih1 uses its own code to read this, whereas tpih2 uses the fits_hdr2str() function from CFITSIO. - Removed twcsprt, tpih exercises wcsprt() much more thoroughly than twcsprt ever did. Modified twcs1 to print the size of the various structs as twcsprt used to. - Although they are not used in any coordinate calculations, the wcsprm struct now provides data members for storing all of the auxiliary FITS WCS header cards defined in Papers I, II, and III, such as WCSNAMEa, EQUINOXa, and CNAMEia. Members are also provided for storing the alternate descriptor code (the "a" in CTYPEia), and the binary table column number. These are supported by the high level WCSLIB routines, wcsini(), wcscopy(), wcsfree(), and wcsprt(). Refer to wcs.h for details. - The number of PVi_ma cards for which wcsini() allocates memory is now set by a global variable, NPVMAX (previously a C-preprocessor macro). This defaults to 64 but may be changed by a new function, wcsnpv(). The wcsprm struct contains a new member, npvmax, that records the value of this number at the time the struct was initialized. This is in addition to npv which records the actual number of cards that were encountered. Similarly, NPSMAX (default 8) is used for the number of PSi_ma cards, and it may be changed via wcsnps(). The axis number, i, in the pvcard struct used for storing PVi_ma cards may now be set to 0 to indicate the latitude axis. - calloc() is now used in place of malloc() in allocating memory for arrays, and inclusion of malloc.h has been replaced with stdlib.h for all platforms. wcsfree() checks that wcs.flag != -1 before testing wcs.m_flag when freeing memory allocated by wcsini() in case the struct is uninitialized. Similarly for linfree(). - In prj.h, renamed C-preprocessor macros INI, PRT, SET, X2S and S2X to PRJINI, PRJPRT, PRJSET, PRJX2S and PRJS2X to reduce the likelihood of namespace clashes. Similarly in spc.h. Also, in prj.c, changed the name of helper routine offset() to prjoff() to reduce the likelihood of global namespace conflicts. - In line with bonx2s() and bons2x(), bonset() now recognizes the equatorial case of Bonne's projection as Sanson-Flamsteed, mainly so that the auxiliary information in the prjprm struct more accurately reflects the truth. Modified tcel2 to exercise this by using an equatorial Bonne projection in place of the Hammer-Aitov. - zpns2x() used prj.w[0] for bounds checking, though this had not been set by zpnset() for polynomials of degree N < 3. Consequently, bounds checking for N < 3 was unreliable (reported by David Berry, STARLINK). - Changed some variable names in tscs2x(), cscx2s(), cscs2x(), qscx2s(), and qscs2x() to match Paper II, and likewise changed some inequality tests in qscs2x() without changing the results. - Minor tidying up of output formatting in prjprt(). - Added the alternate version code to FITS WCS keywords mentioned in comments, e.g. CTYPEi changed to CTYPEia. * Fortran wrappers - New wrappers defined in wcshdr_f.c: wcspih_() and wcsvfree_(), and also a new service function, wcsvcopy_(). New test programs, TPIH1 and TPIH2, being analogues of tpih1 and tpih2. Removed TWCSPRT. - In wcs_f.c, new wrappers wcsnpv_() and wcsnps_(); modified wcsput_() and wcsget_() to handle new members of the wcsprm struct. Also modified wcsput_() to null-fill all char[] members of the wcsprm struct, and likewise wcsget_() to blank-fill them. - Modified wcs.inc to support changes to the wcsprm struct. * PGSBOX - In PGSBOX, increased the dimension of the WORLD and XY vectors from 2 to 9 to accomodate higher-dimensional coordinate representations of up to 9 elements. Similarly for pgwcsl(). The assumption (presently) is that the first two world, and pixel, coordinate elements are the relevant ones; the others are all set to zero when pgwcsl() initializes and otherwise ignored. Assigned some variables in DATA to stop compiler messages about uninitialized variables. - Generalized the Makefile, bringing it into line with the WCSLIB Makefile, and adding separate targets for compiling and running the test programs. The default target now simply compiles pgsbox.c and cpgsbox.c. A separate target compiles pgwcsl.c and inserts it into ../C/libwcs.a. WCSLIB version 3.4 (2004/02/11) ------------------------------- * C library - In aitx2s(), apply the boundary condition 0.5 <= Z^2 <= 1 given after Eq. (109) in WCS Paper II to detect outlying pixels. - Fixed several special-case bugs in celset(): 1) For theta_0 = 90, in substituting the default value for phi_p (LONPOLE), a) for the special case when delta_0 = 90, celset() provided the wrong value (180 instead of 0), b) celset() neglected to add phi_0 (normally 0). 2) For theta_0 != 90, a) for the special case when delta_0 = -90, celset() incorrectly computed delta_p (as theta_0 instead of -theta_0), b) for the special case when delta_p = +90 (or -90), celset() neglected to subtract (or add) phi_0 (normally 0). 3) For |delta_0| = 90, celset() incorrectly allowed the particular, invalid, value of phi_p (LONPOLE) that put the other pole at the fiducial point. 4) For theta_0 = 0, delta_0 = 0 LATPOLE determines delta_p completely. For LATPOLE > 90 celset() now sets delta_p to 90, and for LATPOLE < -90 it sets it to -90. - Additional refinements in celset(): 1) cel->ref[2] is normalized in the range [-180,180]. 2) Account for rounding error in the computation of delta_p. - sphx2s() and sphs2x() incorrectly handled the "change in the origin of longitude" special case that arises when delta_p = -90, in the even more restrictive case where |theta| = 90 also; it applied Eq. (3) instead of Eq. (4) of Paper II. - Added a new test program, tcel2.c, to exercise celset() more thoroughly. Renamed the original tcel.c to tcel1.c and modified the Makefile to suit. * Fortran wrappers - (No changes.) * PGSBOX - (No substantive changes.) WCSLIB version 3.3 (2003/10/21) ------------------------------- * C library - In celset(), the default value for phi_p (LONPOLE) is phi_p = phi_0 + ((delta_0 < theta_0) ? 180.0 : 0.0) Previously phi_0 (which is normally zero) was not added (reported by David Berry, STARLINK). - wcsprt() and linprt() now check that the structs have been initialized. - In wcsini(), when the wcsprm flag is -1 also set the linprm flag to -1 to force initialization of the memory managed by linset(). - wcsset() now explicitly initializes the celprm and spcprm structs via celini() and spcini(). - Fixed syntax errors in the macro definitions of linrev_errmsg and linfwd_errmsg. - In Makefile, added the -ansi option to gcc to force it to behave like a strict ANSI C compiler, specifically in setting the __STDC__ preprocessor macro. * Fortran wrappers - (No changes.) * PGSBOX - PGSBOX now recognizes status returns -1, -2, and -3 from NLFUNC for opcodes +2 and +1 which cause it to accept the returned (x,y) coordinates but not consider them as one end of a crossing segment for labelling world coordinate 1, 2, or both. - PGSBOX now takes care not to lose vertical tick marks (and hence labels) at the left or right edge of the frame. Likewise for horizontal tick marks at the top or bottom edge of the frame. - Tightened up the test in PGSBOX for cycles in angle to catch the case where the coordinate value spans a full 360 degrees. - PGSBOX will no longer accept frame crossings that are too oblique; floating point rounding errors may cause grid lines that should otherwise track along the frame to weave down it from side-to-side resulting in spurious crossing points. - Fixed a bug in pgwcsl_() for processing simple linear coordinates. - pgwcsl_() now returns error -2 if the latitude is outside -90 to +90 for opcodes +2 and +1. - Amended the translation of status return codes from WCSLIB in pgwcsl_(). - Provided a header file for pgwcsl_() (mainly for C++ usage). - Added extra test plots to PGTEST and cpgtest. - Added extra functionality to the Makefile. WCSLIB version 3.2 (2003/09/09) ------------------------------- * C library - Added the facility of setting the flag member of a wcsprm struct to -1 before calling wcsini() for the first time in order to initialize memory management. Likewise for linprm and linini(). - Renamed wcscpy() to wcscopy() to avoid a conflict with the Posix "wide character string" function of the same name (wchar.h). In particular, this is used by the GNU C++ string class. - The higher level functions (wcs, cel, spc) no longer return prematurely if some of the input coordinate values are invalid. - All functions now test whether a null pointer for the particular struct (wcsprm, celprm, etc.) has been passed to them. - Function return codes have been rationalized into a consistent set within each of the wcs, cel, lin, prj, spc, and spx suites of functions. Error messages to match these error codes are now encoded in a single character array, e.g. wcs_errmsg and prj_errmsg, instead of a separate array for each function. Macro definitions for the older character arrays (e.g. wcsini_errmsg) have been provided for backward compatibility. - Declared prj_stat as extern in prj.h. * Fortran wrappers - (No changes.) * PGSBOX - Added an ENTRY point, PGLBOX, that provides a simplified interface to PGSBOX for linear axes without having to specify an NLFUNC or the associated parameters. WCSLIB version 3.1 (2003/04/29) ------------------------------- * C library - Added "global" and "divergent" prjprm struct informational members to record whether the projection is capable of mapping the whole sphere, and whether it is divergent in latitude. - Function cylfix() provided to fix WCS FITS header cards for malformed cylindrical projections (c.f. Paper II, Sect. 7.3.4). - Added support for CUNITi cards to wcsprm (but not currently implemented). - Added macro implementations of the trigd functions to wcstrig.h, enabled if WCSTRIG_MACRO is defined. - Improved printing of the WCSLIB structs. - Added macro definitions for the lengths of the WCSLIB structs measured in sizeof(int) units (mainly for the FORTRAN wrappers). * Fortran wrappers - FORTRAN is now supported via a set of wrappers on the C library. Refer to the README file. * PGSBOX WCSLIB version 3.0 beta release (2003/04/01) -------------------------------------------- * C library - Fully vectorized function interfaces (C preprocessor macros are available to implement the scalar interfaces of the proj.c, sph.c, and lin.c routines from WCSLIB 2.x). - Implementation of Paper II, Sect. 2.5: User-specified (phi0, theta0). - Implementation of Paper III (excluding "-TAB"). - Memory management is now implemented in the upper-level (wcs.c) routines. - New extensible design should accomodate Paper IV (and any other) without further change to the function interfaces. * PGSBOX - Added a C wrapper function, cpgsbox(), and C test/demo program, cpgtest, that duplicates PGTEST and serves as a C coding template. - Added calendar date axes. - Sped up the max/min search - if only tickmarks are required there is no need to search the interior of the image. - Return margin widths in CACHE(,NC). - Fixed a buglet that caused ticks at the frame edges to be skipped. - Return error 3 if CACHE overflows. - Adapted PGWCSL for WCSLIB 3.x - it is now a C function (for interfacing to WCSLIB) with a FORTRAN-like interface (for PGSBOX). WCSLIB version 2.9 (2002/04/03) ------------------------------- * C library - Fixed a bug with alias translation in wcsset(). - Added a conditional compilation directive to lin.c for Apple's MacOS X. * Fortran library - Fixed CUBEFACE handling in WCSSET. WCSLIB version 2.8 (2001/11/16) ------------------------------- * C library - Added support for the SZP projection with szpset(), szpfwd() and szprev(), and generalized AZP with support for the tilt parameter, gamma. - Added phi0 to the prjprm struct, this is set by the projection initialization routines along with theta0. - Fixed a problem in wcsmix() caused by numerical imprecision that could cause it not to recognize when convergence was reached; break out of the loop early if a discontinuity is detected. - Clarified the usage of vspan in the prologue to wcsmix(). - Fixed comments relating to LATPOLE in the prologue to cel.c and tcel.c, and replaced references to LONGPOLE with LONPOLE. - Augmented the error reports in twcs2. - Modified projex() in tproj1 and prjplt() in tproj2 to make use of the information stored in the prjprm struct. * Fortran library - Added support for the SZP projection with SZPSET, SZPFWD and SZPREV, and generalized AZP with support for the tilt parameter, gamma. - Changed the call sequence to PRJSET to return PHI0 along with THETA0. - Fixed a problem in WCSMIX caused by numerical imprecision that could cause it not to recognize when convergence was reached; break out of the loop early if a discontinuity is detected. - Clarified the usage of VSPAN in the prologue to WCSMIX. - Fixed comments relating to LATPOLE in the prologue to CEL and TCEL, and replaced references to LONGPOLE with LONPOLE. - Augmented the error reports in TWCS2. - Modified PROJEX in TPROJ1 and PRJPLT in TPROJ2 to use the generic driver routines PRJSET, PRJFWD and PRJREV. PRJPLT also now uses the projection type encoded in PRJ(11). WCSLIB version 2.7 (2001/02/19) ------------------------------- * C library - Added generic driver routines prjset(), prjfwd() and prjrev(). These invoke specific projection routines via the pointer-to- function elements, prjfwd and prjrev, transferred to the prjprm struct from celprm. - Added code (3-letter projection code) and theta0 (reference latitude) elements to prjprm. - The projection code for the Sanson-Flamsteed projection is now SFL. The upper-level routines, wcsset(), wcsfwd(), and wcsrev(), recognize GLS as an alias for this. - wcsset() now recognizes 'xyLN/xyLT' axis pairs. - Two bugs in the translation from NCP to SIN in wcsfwd() and wcsrev() were fixed: (1) the projection parameter was computed incorrectly and (2) they did not honour prj->flag set to -1 to disable strict bounds checking. - A bug in wcsmix() was fixed - it was relying on the wcsprm struct to have been initialized beforehand. - The test programs now use the cpgplot interface to PGPLOT, the old tpgc.c and tpgf.f wrappers have been removed. * Fortran library - Added generic driver routines PRJSET, PRJFWD and PRJREV. These are keyed to specific projection routines via the value of PRJ(11) which now differs for each projection. - The projection code for the Sanson-Flamsteed projection is now SFL. The upper-level routines, WCSSET, WCSFWD, and WCSREV, recognize GLS as an alias for this. - WCSSET now recognizes 'xyLN/xyLT' axis pairs. - A bug in the translation from NCP to SIN in WCSFWD and WCSREV was fixed; they did not honour PRJ(11) set to -1 to disable strict bounds checking. - A bug in WCSMIX was fixed - it was relying on the WCS array to have been initialized beforehand. WCSLIB version 2.6 (2000/05/10) ------------------------------- * C library - Check for invalid (x,y) in zearev(). - In wcsmath.h, guard against prior definition of PI and other preprocessor variables. * Fortran library - Check for invalid (X,Y) in ZEAREV. - Declare COSD and SIND in WCSFWD and WCSREV, reported by Clive Page (cgp@star.le.ac.uk). WCSLIB version 2.5 (1999/12/14) ------------------------------- * C library - Added copyright notice to header files and prefixed include guard names with "WCSLIB_". - Fixed cube face handling in wcsfwd() and wcsrev() (reported by Doug Mink, CfA). Allow more general face layout in the inverse quadcube projections. - Fixed the problem in wcsmix() where it failed to find a valid solution when the solution point lay at a native pole of a projection in which the pole is represented as a finite interval. However, wcsmix() will only ever return one solution even when two or more valid solutions may exist. - wcsmix() now accepts viter in the range 5 - 10, the specified value will be pushed up or down into this range if necessary. - The projection routines for AZP, TAN, SIN, ZPN, and COP now return error 2 if (phi,theta) correspond to the overlapped (far) side of the projection. This strict bounds checking can be switched off by setting prj->flag to -1 (rather than 0) when the projections are initialized. - The upper level routines, wcsset(), wcsfwd(), wcsrev(), and wcsmix(), now recognize the NCP projection and convert it to the equivalent SIN projection. The lower level routines do not recognize NCP. - Extracted definitions of mathematical constants (PI etc.) from proj.h into wcsmath.h in order to avoid conflicts with their definition in math.h in some systems (such as Linux). - Describe the two alternate representations of the quadcube projections (i.e. faces laid out or stacked) in the prologue of wcs.c. * Fortran library - Fixed cube face handling in WCSFWD and WCSREV, reported by Doug Mink (dmink@cfa.harvard.edu). Allow more general face layout in the inverse quadcube projections. - Fixed the problem in WCSMIX where it failed to find a valid solution when the solution point lay at a native pole of a projection in which the pole is represented as a finite interval. However, WCSMIX will only ever return one solution even when two or more valid solutions may exist. - WCSMIX now accepts VITER in the range 5 - 10, the specified value will be pushed up or down into this range if necessary. - The projection routines for AZP, TAN, SIN, ZPN, and COP now return error 2 if (phi,theta) correspond to the overlapped (far) side of the projection. This strict bounds checking can be switched off by setting PRJ(11) to -1 (rather than 0) when the projections are initialized. - The upper level routines, WCSSET, WCSFWD, WCSREV, and WCSMIX, now recognize the NCP projection and convert it to the equivalent SIN projection. The lower level routines do not recognize NCP. - Describe the two alternate representations of the quadcube projections (i.e. faces laid out or stacked) in the prologue of wcs.f. WCSLIB version 2.4 (1996/09/23) ------------------------------- * C library - In sinrev(), cscrev(), qscrev(), and tscrev(), return error 2 if (x,y) do not lie within the perimeter of the projection. In sinrev(), stop the computation of phi for the "synthesis" projection being applied to the pure "orthographic" case (reported by David Berry, STARLINK). - (Internal change) Renamed variables l <-> m in the quadcube projections to accord with standard usage (and revised WCS draft paper). * Fortran library - In SINREV, CSCREV, QSCREV, and TSCREV, return error 2 if (X,Y) do not lie within the perimeter of the projection. In SINREV, stop the computation of PHI for the "synthesis" projection being applied to the pure "orthographic" case. Reported by David Berry (dsb@ast.man.ac.uk). - (Internal change) Renamed variables L <-> M in the quadcube projections to accord with standard usage (and revised WCS draft paper). - (Internal change) Stopped PRJ(11) doing double service in any projection. It is now set and tested for a specific magic value rather than simply being non-zero. WCSLIB version 2.3 (1996/06/24) ------------------------------- * C library - Fixed two bugs in zpnset(). The first led to an incorrect determination of the degree of the polynomial and would mainly have affected the efficiency of zpnrev(). The second affected the determination of the boundary of the projection but would only have been significant for projections with a point of inflection between 9 and 10 degrees of the pole. Reported by David Berry, STARLINK. - Replaced usage of alloca() in lin.c with malloc() and free() for portability as suggested by Klaus Banse, ESO (kbanse@eso.org). - Allow for C implementations that provide their own versions of cosd(), sind(), tand(), acosd(), asind(), atand(), and atan2d(). From Klaus Banse, ESO (kbanse@eso.org). - Implemented the CUBEFACE axis for quadcube projections. - Made all function prototypes const-correct. - Adapted the header files to C++ usage. - Added a new test program, twcs1, to verify closure of wcsfwd() and wcsrev(). The old twcs test program is now called twcs2. - Added external arrays of error messages indexed by function return value. For example, extern const char *wcsmix_errmsg[] for wcsmix(). Messages for the many proj.c functions are in prjfwd_errmsg[], etc. * Fortran library - Implemented the CUBEFACE axis for quadcube projections. - Added a new test program, TWCS1, to verify closure of WCSFWD and WCSREV. The old TWCS test program is now called TWCS2. WCSLIB version 2.2 (1996/01/18) ------------------------------- * C library - Amended the projection equations for the conics (COP, COD, COE, COO) and Bonne's projection (BON) to correctly handle southern hemisphere projections with PROJP1 < 0 (reported by Lindsay Davis, NOAO). Revised tproj1 and tproj2 to test such cases. * Fortran library - Amended the projection equations for the conics (COP, COD, COE, COO) and Bonne's projection (BON) to correctly handle southern hemisphere projections with PROJP1 < 0 (reported by Lindsay Davis, NOAO). Revised TPROJ1 and TPROJ2 to test such cases. - Increased the dimension of the WCS array from WCS(0:2) to WCS(0:3) to allow for future handling of the CUBEFACE keyword - WCS(3) will store an index to the CUBEFACE axis. This affects the call sequences of WCSSET, WCSFWD, WCSREV, and WCSMIX. WCSLIB version 2.1 (1995/11/17) ------------------------------- * C library The main change of interest to programmers is that of changed argument lists for wcsfwd() and wcsrev() as described below. - The WCS linear transformations are now implemented in WCSLIB, complete with matrix inverter. The new files are lin.c, lin.h, and test program tlin.c. - Given either the celestial longitude or latitude plus an element of the pixel coordinate a new routine, wcsmix(), solves for the remaining elements by iterating on the unknown celestial coordinate element using wcsfwd(). - The high level driver routines wcsfwd(), wcsrev(), and wcsmix() now apply the full WCS algorithm chain (except for pixel regularization table), including parsing the CTYPEn header cards and computing non- celestial elements of the world coordinate. This required a change to their argument lists which now more closely reflect the sequence of algorithms applied. A new routine, wcsset(), parses the CTYPEn. - The high level driver routines of WCSLIB 1.0 are available as intermediate level drivers celset(), celfwd(), and celrev(), but note that their argument lists have been extended to return native coordinates. The related struct is now called celprm instead of wcsprm. - The reference point for conic projections is now at the midpoint of the standard parallels. The FITS header cards PROJP1 and PROJP2 now give the half-sum (midpoint) and half-difference of the latitudes of the standard parallels; previously they gave the latitudes of the standard parallels themselves. The change is reflected in this release of WCSLIB. - A bug in celset() (formerly wcsset()) that misapplied WCS draft equations 7 has been fixed (thanks to Rick Ebert IPAC/JPL and Lindsey Davis, NOAO for reporting this). This affected the computation of Euler angles for the celestial coordinate transformation for those projections that have their reference point away from the native pole. In investigating this a deficiency with the formalism was discovered that led to the introduction of a LATPOLE FITS header card which may be used to disambiguate where CRVAL1, CRVAL2, and LONGPOLE do not uniquely determine the latitude of the native pole. The celprm struct (formerly wcsprm) has been extended to accomodate LATPOLE. - Default values of LONGPOLE and LATPOLE are now supported and their use is recommended where appropriate. - Numerical precision was being lost near the native poles in the SIN, AIR, and QSC projections and this has been recovered (reported by Lindsey Davis, NOAO). Floating underflows in CSC are now avoided. - Numerical precision was also lost in certain circumstances in the spherical coordinate transformation routines and this has been fixed. - The test programs have been enhanced in various ways and the library has been validated on an SGI machine using both 32-bit and 64-bit compilers. * Fortran library The main change of interest to programmers is that of changed call sequences for WCSFWD and WCSREV as described below. - The WCS linear transformations are now implemented in WCSLIB, complete with matrix inverter. The new files are lin.f and test program tlin.f. - Given either the celestial longitude or latitude plus an element of the pixel coordinate a new routine, WCSMIX, solves for the remaining elements by iterating on the unknown celestial coordinate element using WCSFWD. - The high level driver routines WCSFWD, WCSREV, and WCSMIX now apply the full WCS algorithm chain (except for pixel regularization table), including parsing the CTYPEn header cards and computing non- celestial elements of the world coordinate. This required a change to their call sequences which now more closely reflect the sequence of algorithms applied. A new routine, WCSSET, parses the CTYPEn. - The high level driver routines of WCSLIB 1.0 are available as intermediate level drivers CELSET, CELFWD, and CELREV, but note that their call sequences have been extended to return native coordinates. The related parameter array is now called CEL instead of WCS. - The reference point for conic projections is now at the midpoint of the standard parallels. The FITS header cards PROJP1 and PROJP2 now give the half-sum (midpoint) and half-difference of the latitudes of the standard parallels; previously they gave the latitudes of the standard parallels themselves. The change is reflected in this release of WCSLIB. - A bug in CELSET (formerly WCSSET) that misapplied WCS draft equations 7 has been fixed (thanks to Rick Ebert IPAC/JPL and Lindsey Davis, NOAO for reporting this). This affected the computation of Euler angles for the celestial coordinate transformation for those projections that have their reference point away from the native pole. In investigating this a deficiency with the formalism was discovered that led to the introduction of a LATPOLE FITS header card which may be used to disambiguate where CRVAL1, CRVAL2, and LONGPOLE do not uniquely determine the latitude of the native pole. The CEL parameter array (formerly WCS) has been extended to accomodate LATPOLE as CEL(4), and the flag variable is now CEL(5) (formerly WCS(4)). - Default values of LONGPOLE and LATPOLE are now supported and their use is recommended where appropriate. - Numerical precision was being lost near the native poles in the SIN, AIR, and QSC projections and this has been recovered (reported by Lindsey Davis, NOAO). Floating underflows in CSC are now avoided. - Numerical precision was also lost in certain circumstances in the spherical coordinate transformation routines and this has been fixed. - The test programs have been enhanced in various ways and the library has been validated on an SGI machine using both 32-bit and 64-bit compilers. WCSLIB version 1.0 (1995/01/31) ------------------------------- * C library Initial release. * Fortran library Initial release. ------------------------------------------------------------------------ $Id: CHANGES,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ astropy-0.3/cextern/wcslib/wcsconfig_tests.h.in0000644000175000017500000000126712243255342020122 0ustar oleole/*============================================================================ * * wcsconfig_test.h is generated from wcsconfig_test.h.in by 'configure'. It * contains C preprocessor definitions for compiling the WCSLIB 4.19 test/demo * programs. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig_tests.h.in,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ *===========================================================================*/ #include /* Define to 1 if the CFITSIO library is available. */ #undef HAVE_CFITSIO /* Define to the printf format modifier for size_t type. */ #undef MODZ astropy-0.3/cextern/wcslib/wcslib.pc.in0000644000175000017500000000041412243255342016345 0ustar oleoleprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/wcslib Name: WCSLIB Description: An implementation of the FITS World Coordinate System standard Version: @PACKAGE_VERSION@ Requires: Libs: -L${libdir} -lwcs -lm Cflags: -I${includedir} astropy-0.3/cextern/wcslib/configure.ac0000644000175000017500000004035412243255342016426 0ustar oleole#----------------------------------------------------------------------------- # Process this file with autoconf-2.53 or later to produce a configure script. #----------------------------------------------------------------------------- # N.B. it is necessary to run autoconf on a Mac in order for configure to # locate the X11 dylibs for PGPLOT. Use autoconf-2.61 in MacOSX 10.6.2 or # later to avoid spurious messages about deleting conftest.dSYM when # configuring in MacOSX 10.6. # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta # $Id: configure.ac,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ #----------------------------------------------------------------------------- AC_INIT([WCSLIB], [4.19], [mark@calabretta.id.au], [wcslib-4.19]) AC_PREREQ([2.53]) AC_REVISION([$Revision: 4.19 $]) AC_SUBST([PACKAGE_VERSION]) AC_DEFINE_UNQUOTED([WCSLIB_VERSION], [$PACKAGE_VERSION], [Define wcslib version]) # Library version number, same as package version. LIBVER="$PACKAGE_VERSION" AC_SUBST([LIBVER]) AC_CONFIG_SRCDIR([C/wcs.h]) AC_CONFIG_AUX_DIR([config]) # Get the system type. AC_CANONICAL_BUILD ARCH="${build_cpu}-$build_os" AC_SUBST([ARCH]) # Look for Flex. AC_CHECK_PROG([FLEX], [flex], [flex], [], [], []) if test "x$FLEX" = xflex ; then # Version 2.5.9 or later is required. V=`flex --version | awk '{print $NF}'` W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20509) print "no"}'` if test "x$W" != x ; then AC_MSG_NOTICE([Flex version $V is too old, ignored.]) FLEX= else AC_MSG_NOTICE([Using Flex version $V.]) fi fi if test "x$FLEX" = x ; then AC_MSG_WARN([Flex version 2.5.9 or later does not appear to be available, will use pre-generated sources.]) fi # Look for an ANSI C compiler. AC_PROG_CPP AC_PROG_CC AC_PROG_CC_STDC AC_C_CONST AC_TYPE_SIZE_T if test "x$ac_cv_prog_cc_stdc" = xno -o \ "x$ac_cv_c_const" = xno -o \ "x$ac_cv_type_size_t" = xno; then AC_MSG_ERROR([ ------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. ERROR: WCSLIB configuration failure. -------------------------------------------------------], [1]) fi # Check for data types (suggested by autoscan - off_t is only required by # fitshdr). AC_TYPE_OFF_T AC_TYPE_INT8_T AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_UINT8_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T # Check for ANSI C headers. AC_HEADER_STDC AC_CHECK_HEADERS([ctype.h errno.h limits.h locale.h math.h setjmp.h stdarg.h \ stdio.h stdlib.h string.h]) if test "x$ac_cv_header_stdc" = xno; then AC_MSG_ERROR([ ------------------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. One of the ANSI C header files it requires is missing or unusable. ERROR: WCSLIB configuration failure. -------------------------------------------------------------------], [1]) fi # Checks for ANSI C library functions (suggested by autoscan - fseeko and # stat are only required by fitshdr). AC_CHECK_LIB([m], [floor]) AC_FUNC_FSEEKO AC_FUNC_MALLOC AC_FUNC_REALLOC AC_FUNC_SETVBUF_REVERSED AC_FUNC_STAT AC_FUNC_VPRINTF AC_CHECK_FUNCS([floor memset pow setlocale sqrt strchr strstr]) # System libraries that may be required by WCSLIB itself. # SunOS, extra maths functions. AC_CHECK_LIB([sunmath], [cosd], [LIBS="-lsunmath $LIBS"], [], []) # See if we can find sincos(). AC_CHECK_FUNCS([sincos]) # Check the size and availability of integer data types. AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long int]) AC_CHECK_SIZEOF([long long int]) # 64-bit integer data type; use long long int preferentially since that # accords with "%lld" formatting used in fitshdr.l, e.g. # int size_t long int long long int # --- ------ -------- ------------- # gcc x86: 32 32 32 64 # gcc x86_64: 32 64 64 64 if test "x$ac_cv_sizeof_long_long_int" = x8; then AC_DEFINE([WCSLIB_INT64], [long long int], [64-bit integer data type.]) elif test "x$ac_cv_sizeof_long_int" = x8; then AC_DEFINE([WCSLIB_INT64], [long int], [64-bit integer data type.]) elif test "x$ac_cv_sizeof_int" = x8; then AC_DEFINE([WCSLIB_INT64], [int], [64-bit integer data type.]) fi # Does printf() have the z modifier for size_t type? Important for 64-bit. AC_MSG_CHECKING([for printf z format modifier for size_t type]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[char buf[64]; if (sprintf(buf, "%zu", (size_t)1) != 1) return 1; else if (strcmp(buf, "1")) return 2;]])], AC_DEFINE([MODZ], ["z"], [printf format modifier for size_t type.]) AC_MSG_RESULT(yes), AC_DEFINE([MODZ], [""], [printf format modifier for size_t type.]) AC_MSG_RESULT(no), AC_DEFINE([MODZ], [""], [printf format modifier for size_t type.]) AC_MSG_RESULT(assumed not) ) # Starting values, may be augmented later. SUBDIRS="C" TSTDIRS="C" INSTDIR="C" # Ways of specifying the Fortran compiler, in order of precedence: # configure --enable-fortran= # F77= configure ...bash # # Ways of disabling Fortran: # configure --disable-fortran # configure --enable-fortran=no # F77=no configure ...bash AC_ARG_ENABLE([fortran], [AS_HELP_STRING([--enable-fortran=ARG], [Fortran compiler to use])], []) AC_ARG_ENABLE([fortran], [AS_HELP_STRING([--disable-fortran], [don't build the Fortran wrappers or PGSBOX])], []) if test "x$enable_fortran" != x -a "x$enable_fortran" != xyes ; then F77="$enable_fortran" fi if test "x$F77" = xno ; then F77= AC_MSG_WARN([Compilation of Fortran wrappers and PGSBOX disabled]) else if test "x$F77" = x ; then # Look for a Fortran compiler. AC_PROG_F77([gfortran g77 f77 ifort xlf frt pgf77 fl32 af77 fort77 f90 \ xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95]) fi if test "x$F77" = x; then AC_MSG_WARN([ ------------------------------------------------------------------ Fortran compiler not found, will skip Fortran wrappers and PGSBOX. ------------------------------------------------------------------]) # Best guess at Fortran name mangling for use if a compiler does ever # become available. AC_DEFINE([F77_FUNC(name,NAME)], [name ## _]) else if test "x$ac_cv_f77_compiler_gnu" = xyes ; then if test "x$F77" = xg77 -o "x$F77" = xf77 ; then # Not recognized by gfortran. FFLAGS="$FFLAGS -Wno-globals" fi fi AC_MSG_CHECKING(whether $F77 accepts -I) AC_LANG_PUSH(Fortran 77) FFLAGS_save=$FFLAGS FFLAGS=-I. AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], []), [FFLAGS="$FFLAGS_save -I."; AC_MSG_RESULT(yes)], [FFLAGS="$FFLAGS_save"; AC_MSG_RESULT(no)]) AC_LANG_POP() # Libraries required by the Fortran compiler itself (sets FLIBS). # Required by utilities and test programs written in C that link to # Fortran object modules such as pgsbox. AC_F77_LIBRARY_LDFLAGS # F77 name mangling (defines the F77_FUNC preprocessor macro). AC_F77_WRAPPERS SUBDIRS="C Fortran" TSTDIRS="C Fortran" INSTDIR="Fortran" fi fi # System-dependent system libraries (for building the sharable library). #----------------------------------------------------------------------- # Darwin (contains stubs for long double). AC_CHECK_LIB([SystemStubs], [printf\$LDBLStub], [LIBS="$LIBS -lSystemStubs"], [], []) # Library and installation utilities. #------------------------------------ # Static library generation. AC_PROG_RANLIB # Shared library generation. if test "x$ac_cv_c_compiler_gnu" = xyes ; then SHVER=`echo "$LIBVER" | sed -e 's/\..*$//'` # Note that -fPIC is on by default for Macs, this just makes it obvious. SHRFLAGS="-fPIC" SHRLD="\$(CC) \$(SHRFLAGS)" case "$build_os" in darwin*) SHRLIB="libwcs.$LIBVER.dylib" SONAME="libwcs.$SHVER.dylib" SHRLD="$SHRLD -dynamiclib -single_module" SHRLD="$SHRLD -compatibility_version $SHVER -current_version $LIBVER" SHRLN= case "$build_cpu" in powerpc*) # Switch off -fPIC (not applicable for PowerPC Macs). CFLAGS="$CFLAGS -mdynamic-no-pic" ;; esac ;; *) # Covers Linux and Solaris at least. SHRLIB="libwcs.so.$LIBVER" SONAME="libwcs.so.$SHVER" SHRLD="$SHRLD -shared -Wl,-h\$(SONAME)" SHRLN="libwcs.so" ;; esac else SHRLIB= SONAME= SHRFLAGS= SHRLD= SHRSFX= SHRLN= fi AC_SUBST([SHRLIB]) AC_SUBST([SONAME]) AC_SUBST([SHRFLAGS]) AC_SUBST([SHRLD]) AC_SUBST([SHRSFX]) AC_SUBST([SHRLN]) # Installation utilities. AC_PROG_LN_S AC_PROG_INSTALL AC_MSG_NOTICE([End of primary configuration. ]) # The following are required to build utilities and test programs. # ---------------------------------------------------------------- AC_MSG_NOTICE([Looking for libraries etc. for utilities and test suite...]) # Check for other quasi-standard header files. AC_CHECK_HEADERS([unistd.h]) # Large file support. AC_FUNC_FSEEKO AC_SYS_LARGEFILE # Extra places to look for third-party libraries and header files. LIBDIRS= AC_ARG_WITH([cfitsio], [AS_HELP_STRING([--without-cfitsio], [eschew CFITSIO])], []) if test "x$with_cfitsio" = xno ; then AC_MSG_WARN([CFITSIO disabled]) else AC_ARG_WITH([cfitsiolib], [AS_HELP_STRING([--with-cfitsiolib=DIR], [directory containing cfitsio library])], []) if test "x$with_cfitsiolib" != x ; then LIBDIRS="$LIBDIRS $with_cfitsiolib" fi AC_ARG_WITH([cfitsioinc], [AS_HELP_STRING([--with-cfitsioinc=DIR], [directory containing cfitsio header files])], []) if test "x$with_cfitsioinc" != x ; then CFITSIO_INCDIRS="$with_cfitsioinc" fi CFITSIO_INCDIRS="$CFITSIO_INCDIRS \ /usr/local/cfitsio/include \ /local/cfitsio/include" LIBDIRS="$LIBDIRS \ /usr/local/cfitsio/lib \ /local/cfitsio/lib" fi AC_ARG_WITH([pgplot], [AS_HELP_STRING([--without-pgplot], [eschew PGPLOT])], []) if test "x$with_pgplot" = xno ; then AC_MSG_WARN([PGPLOT disabled]) else AC_ARG_WITH([pgplotlib], [AS_HELP_STRING([--with-pgplotlib=DIR], [directory containing pgplot library])], []) if test "x$with_pgplotlib" != x ; then LIBDIRS="$LIBDIRS $with_pgplotlib" fi AC_ARG_WITH([pgplotinc], [AS_HELP_STRING([--with-pgplotinc=DIR], [directory containing pgplot header files])], []) if test "x$with_pgplotinc" != x ; then PGPLOT_INCDIRS="$with_pgplotinc" fi PGPLOT_INCDIRS="$PGPLOT_INCDIRS \ /usr/local/pgplot/include \ /local/pgplot/include" LIBDIRS="$LIBDIRS \ /usr/local/pgplot/lib \ /local/pgplot/lib" fi if test "x$with_cfitsio" != xno -o \ "x$with_pgplot" != xno ; then LIBDIRS="$LIBDIRS \ /usr/local/lib \ /local/lib \ /opt/local/lib \ /opt/SUNWspro/lib \ /sw/lib" for LIBDIR in $LIBDIRS ; do AC_CHECK_FILE([$LIBDIR], [LDFLAGS="$LDFLAGS -L$LIBDIR"], [continue]) done # Generic include directories. INCDIRS="/usr/local/include \ /local/include \ /opt/local/include \ /sw/include \ /local \ /usr/include" # CFITSIO. if test "x$with_cfitsio" != xno ; then # Search for CFITSIO. for INCDIR in $CFITSIO_INCDIRS $INCDIRS ; do AC_CHECK_FILE([$INCDIR/cfitsio/fitsio.h], [CFITSIOINC="-I$INCDIR/cfitsio"; break]) AC_CHECK_FILE([$INCDIR/fitsio.h], [CFITSIOINC="-I$INCDIR"; break]) done AC_CHECK_LIB([socket], [recv], [CFITSIOLIB="-lsocket"], [], [$LIBS]) AC_CHECK_LIB([cfitsio], [ffopen], [CFITSIOLIB="-lcfitsio $CFITSIOLIB"], [], [$CFITSIOLIB $LIBS]) if test "x$CFITSIOINC" = x -o "x$CFITSIOLIB" = x; then AC_MSG_WARN([CFITSIO not found, skipping CFITSIO-dependent tests.]) else AC_MSG_NOTICE([CFITSIO appears to be available.]) AC_DEFINE([HAVE_CFITSIO], [1], [Define to 1 if CFITSIO is available.]) # Check for fits_read_wcstab, present in CFITSIO 3.004beta and later. AC_CHECK_LIB([cfitsio], [fits_read_wcstab], [GETWCSTAB=], [GETWCSTAB=getwcstab.o], [$CFITSIOLIB $LIBS]) if test "x$GETWCSTAB" != x ; then AC_MSG_WARN([fits_read_wcstab not found in CFITSIO, will use getwcstab.c to compile test programs.]) fi fi fi # PGPLOT. if test "x$F77" != x -a "x$with_pgplot" != xno ; then # Search for PGPLOT. for INCDIR in $PGPLOT_INCDIRS $INCDIRS ; do AC_CHECK_FILE([$INCDIR/pgplot/cpgplot.h], [PGPLOTINC="-I$INCDIR/pgplot"; break]) AC_CHECK_FILE([$INCDIR/cpgplot.h], [PGPLOTINC="-I$INCDIR"; break]) done # FLIBS (found above via AC_F77_LIBRARY_LDFLAGS) only helps if PGPLOT was # built using the same Fortran compiler that we are using here. # PGPLOT compiled by the SUN Fortran compiler but linked with something # else. AC_CHECK_LIB([M77], [iand_], [PGPLOTLIB="-lM77 $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) AC_CHECK_LIB([F77], [f77_init], [PGPLOTLIB="-lF77 $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) if test "x$F77" != xg77; then # For PGPLOT compiled with g77 but linked with something else. AC_CHECK_LIB([frtbegin], [main], [PGPLOTLIB="-lfrtbegin $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) AC_CHECK_LIB([g2c], [gerror_], [PGPLOTLIB="-lg2c $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) fi if test "x$F77" != xgfortran; then # For PGPLOT compiled with gfortran but linked with something else. # Note that if gfortran itself is driving the linker it can be harmful # to add -lgfortran to the link list without also adding -lgfortranbegin. # Doing so stops gfortran from adding -lgfortranbegin which is needed to # resolve "main". AC_CHECK_LIB([gfortran], [_gfortran_abort], [PGPLOTLIB="-lgfortran $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) fi # Search for X11 includes and libraries. AC_PATH_X if test "x$no_x" = x; then if test "x$ac_x_libraries" != x ; then # Not needed for systems that keep the X11 libraries in /usr/lib. LDFLAGS="$LDFLAGS -L$ac_x_libraries" fi PGPLOTLIB="-lX11 $PGPLOTLIB" fi # It is possible that other libraries may be required depending on what # graphics drivers were installed with PGPLOT. AC_CHECK_LIB([z], [deflate], [PGPLOTLIB="-lz $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) AC_CHECK_LIB([png], [png_error], [PGPLOTLIB="-lpng $PGPLOTLIB"], [], [$PGPLOTLIB $LIBS]) AC_CHECK_LIB([pgplot], [pgbeg_], [PGPLOTLIB="-lpgplot $PGPLOTLIB"], [], [$PGPLOTLIB $FLIBS $LIBS]) AC_CHECK_LIB([cpgplot], [cpgbeg], [PGPLOTLIB="-lcpgplot $PGPLOTLIB"], [PGPLOTLIB=], [$PGPLOTLIB $FLIBS $LIBS]) # Only need the PGPLOT include file to build PGSBOX. if test "x$PGPLOTINC" != x; then SUBDIRS="$SUBDIRS pgsbox" INSTDIR="pgsbox" fi # Also need the PGPLOT library to build pgtest and cpgtest. if test "x$PGPLOTLIB" = x; then AC_MSG_WARN([PGPLOT not found, skipping PGPLOT-dependent tests.]) else AC_MSG_NOTICE([PGPLOT appears to be available.]) TSTDIRS="$TSTDIRS pgsbox" fi fi fi # Utilities are compiled last since they need the libraries. # Ways of disabling them: # configure --disable-utils # configure --enable-utils=no AC_ARG_ENABLE([utils], [AS_HELP_STRING([--disable-utils], [don't build the WCS utilities])], []) if test "x$enable_utils" != xno ; then SUBDIRS="$SUBDIRS utils" INSTDIR="$INSTDIR utils" else AC_MSG_WARN([Compilation of WCS utilities disabled]) fi AC_SUBST([CFITSIOINC]) AC_SUBST([CFITSIOLIB]) AC_SUBST([GETWCSTAB]) AC_SUBST([PGPLOTINC]) AC_SUBST([PGPLOTLIB]) AC_SUBST([SUBDIRS]) AC_SUBST([TSTDIRS]) AC_SUBST([INSTDIR]) AC_MSG_NOTICE([End of auxiliary configuration. ]) # Do it. AC_MSG_NOTICE([Configuring files...]) AC_CONFIG_FILES([makedefs wcslib.pc]) AC_CONFIG_HEADERS([wcsconfig.h wcsconfig_f77.h wcsconfig_tests.h wcsconfig_utils.h]) AC_OUTPUT astropy-0.3/cextern/wcslib/configure0000755000175000017500000130406212243255342016047 0ustar oleole#! /bin/sh # From configure.ac Revision: 4.19 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for WCSLIB 4.19. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='WCSLIB' PACKAGE_TARNAME='wcslib-4.19' PACKAGE_VERSION='4.19' PACKAGE_STRING='WCSLIB 4.19' PACKAGE_BUGREPORT='mark@calabretta.id.au' ac_unique_file="C/wcs.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias LIBVER build build_cpu build_vendor build_os ARCH FLEX CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GREP EGREP LIBOBJS F77 FFLAGS ac_ct_F77 FLIBS RANLIB SHRLIB SONAME SHRFLAGS SHRLD SHRSFX SHRLN LN_S INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA XMKMF CFITSIOINC CFITSIOLIB GETWCSTAB PGPLOTINC PGPLOTLIB SUBDIRS TSTDIRS INSTDIR LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP F77 FFLAGS XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures WCSLIB 4.19 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/wcslib-4.19] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of WCSLIB 4.19:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-fortran=ARG Fortran compiler to use --disable-fortran don't build the Fortran wrappers or PGSBOX --disable-largefile omit support for large files --disable-utils don't build the WCS utilities Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-cfitsio eschew CFITSIO --with-cfitsiolib=DIR directory containing cfitsio library --with-cfitsioinc=DIR directory containing cfitsio header files --without-pgplot eschew PGPLOT --with-pgplotlib=DIR directory containing pgplot library --with-pgplotinc=DIR directory containing pgplot header files --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF WCSLIB configure 4.19 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by WCSLIB $as_me 4.19, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >>confdefs.h <<_ACEOF #define WCSLIB_VERSION $PACKAGE_VERSION _ACEOF # Library version number, same as package version. LIBVER="$PACKAGE_VERSION" ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Get the system type. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac ARCH="${build_cpu}-$build_os" # Look for Flex. # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_FLEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$FLEX"; then ac_cv_prog_FLEX="$FLEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_FLEX="flex" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi FLEX=$ac_cv_prog_FLEX if test -n "$FLEX"; then { echo "$as_me:$LINENO: result: $FLEX" >&5 echo "${ECHO_T}$FLEX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$FLEX" = xflex ; then # Version 2.5.9 or later is required. V=`flex --version | awk '{print $NF}'` W=`echo $V | awk -F. '{if ((($1*100 + $2)*100 + $3) < 20509) print "no"}'` if test "x$W" != x ; then { echo "$as_me:$LINENO: Flex version $V is too old, ignored." >&5 echo "$as_me: Flex version $V is too old, ignored." >&6;} FLEX= else { echo "$as_me:$LINENO: Using Flex version $V." >&5 echo "$as_me: Using Flex version $V." >&6;} fi fi if test "x$FLEX" = x ; then { echo "$as_me:$LINENO: WARNING: Flex version 2.5.9 or later does not appear to be available, will use pre-generated sources." >&5 echo "$as_me: WARNING: Flex version 2.5.9 or later does not appear to be available, will use pre-generated sources." >&2;} fi # Look for an ANSI C compiler. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case $ac_cv_prog_cc_stdc in no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; *) { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5 echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c99+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c99=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include #include // Check varargs macros. These examples are taken from C99 6.10.3.5. #define debug(...) fprintf (stderr, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK your preprocessor is broken; #endif #if BIG_OK #else your preprocessor is broken; #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\0'; ++i) continue; return 0; } // Check varargs and va_copy. static void test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str; int number; float fnumber; while (*format) { switch (*format++) { case 's': // string str = va_arg (args_copy, const char *); break; case 'd': // int number = va_arg (args_copy, int); break; case 'f': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); } int main () { // Check bool. _Bool success = false; // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. test_varargs ("s, d' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' || dynamic_array[ni.number - 1] != 543); ; return 0; } _ACEOF for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c99=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c99" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c99" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;; esac if test "x$ac_cv_prog_cc_c99" != xno; then ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 else { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 else ac_cv_prog_cc_stdc=no fi fi ;; esac { echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5 echo $ECHO_N "checking for $CC option to accept ISO Standard C... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi case $ac_cv_prog_cc_stdc in no) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; '') { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; *) { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6; } ;; esac { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef size_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6; } if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi if test "x$ac_cv_prog_cc_stdc" = xno -o \ "x$ac_cv_c_const" = xno -o \ "x$ac_cv_type_size_t" = xno; then { { echo "$as_me:$LINENO: error: ------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. ERROR: WCSLIB configuration failure. -------------------------------------------------------" >&5 echo "$as_me: error: ------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. ERROR: WCSLIB configuration failure. -------------------------------------------------------" >&2;} { (exit 1); exit 1; }; } fi # Check for data types (suggested by autoscan - off_t is only required by # fitshdr). { echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef off_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi { echo "$as_me:$LINENO: checking for int8_t" >&5 echo $ECHO_N "checking for int8_t... $ECHO_C" >&6; } if test "${ac_cv_c_int8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int8_t=no for ac_type in 'int8_t' 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 1) < ($ac_type) (((($ac_type) 1 << (8 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in int8_t) ac_cv_c_int8_t=yes ;; *) ac_cv_c_int8_t=$ac_type ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_int8_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_int8_t" >&5 echo "${ECHO_T}$ac_cv_c_int8_t" >&6; } case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac { echo "$as_me:$LINENO: checking for int16_t" >&5 echo $ECHO_N "checking for int16_t... $ECHO_C" >&6; } if test "${ac_cv_c_int16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int16_t=no for ac_type in 'int16_t' 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 1) < ($ac_type) (((($ac_type) 1 << (16 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in int16_t) ac_cv_c_int16_t=yes ;; *) ac_cv_c_int16_t=$ac_type ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_int16_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_int16_t" >&5 echo "${ECHO_T}$ac_cv_c_int16_t" >&6; } case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac { echo "$as_me:$LINENO: checking for int32_t" >&5 echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } if test "${ac_cv_c_int32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int32_t=no for ac_type in 'int32_t' 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1) < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in int32_t) ac_cv_c_int32_t=yes ;; *) ac_cv_c_int32_t=$ac_type ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_int32_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 echo "${ECHO_T}$ac_cv_c_int32_t" >&6; } case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac { echo "$as_me:$LINENO: checking for uint8_t" >&5 echo $ECHO_N "checking for uint8_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint8_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint8_t=no for ac_type in 'uint8_t' 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) -1 >> (8 - 1) == 1)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then case $ac_type in uint8_t) ac_cv_c_uint8_t=yes ;; *) ac_cv_c_uint8_t=$ac_type ;; esac else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_uint8_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_uint8_t" >&5 echo "${ECHO_T}$ac_cv_c_uint8_t" >&6; } case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<\_ACEOF #define _UINT8_T 1 _ACEOF cat >>confdefs.h <<_ACEOF #define uint8_t $ac_cv_c_uint8_t _ACEOF ;; esac { echo "$as_me:$LINENO: checking for uint16_t" >&5 echo $ECHO_N "checking for uint16_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint16_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint16_t=no for ac_type in 'uint16_t' 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) -1 >> (16 - 1) == 1)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then case $ac_type in uint16_t) ac_cv_c_uint16_t=yes ;; *) ac_cv_c_uint16_t=$ac_type ;; esac else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_uint16_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_uint16_t" >&5 echo "${ECHO_T}$ac_cv_c_uint16_t" >&6; } case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define uint16_t $ac_cv_c_uint16_t _ACEOF ;; esac { echo "$as_me:$LINENO: checking for uint32_t" >&5 echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint32_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint32_t=no for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(($ac_type) -1 >> (32 - 1) == 1)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then case $ac_type in uint32_t) ac_cv_c_uint32_t=yes ;; *) ac_cv_c_uint32_t=$ac_type ;; esac else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_uint32_t" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 echo "${ECHO_T}$ac_cv_c_uint32_t" >&6; } case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<\_ACEOF #define _UINT32_T 1 _ACEOF cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Check for ANSI C headers. { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f -r conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_header in ctype.h errno.h limits.h locale.h math.h setjmp.h stdarg.h \ stdio.h stdlib.h string.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to mark@calabretta.id.au ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_header_stdc" = xno; then { { echo "$as_me:$LINENO: error: ------------------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. One of the ANSI C header files it requires is missing or unusable. ERROR: WCSLIB configuration failure. -------------------------------------------------------------------" >&5 echo "$as_me: error: ------------------------------------------------------------------- An ANSI standard C library is required to build WCSLIB. One of the ANSI C header files it requires is missing or unusable. ERROR: WCSLIB configuration failure. -------------------------------------------------------------------" >&2;} { (exit 1); exit 1; }; } fi # Checks for ANSI C library functions (suggested by autoscan - fseeko and # stat are only required by fitshdr). { echo "$as_me:$LINENO: checking for floor in -lm" >&5 echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6; } if test "${ac_cv_lib_m_floor+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char floor (); int main () { return floor (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_m_floor=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_m_floor=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5 echo "${ECHO_T}$ac_cv_lib_m_floor" >&6; } if test $ac_cv_lib_m_floor = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" fi { echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5 echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_largefile_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_sys_largefile_source=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include int main () { return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_sys_largefile_source=1; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -f -r conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then cat >>confdefs.h <<\_ACEOF #define HAVE_FSEEKO 1 _ACEOF fi for ac_header in stdlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to mark@calabretta.id.au ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; } if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_malloc_0_nonnull=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_malloc_0_nonnull=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_MALLOC 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_MALLOC 0 _ACEOF case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac cat >>confdefs.h <<\_ACEOF #define malloc rpl_malloc _ACEOF fi for ac_header in stdlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to mark@calabretta.id.au ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6; } if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_realloc_0_nonnull=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *realloc (); #endif int main () { return ! realloc (0, 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_realloc_0_nonnull=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_realloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6; } if test $ac_cv_func_realloc_0_nonnull = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_REALLOC 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define HAVE_REALLOC 0 _ACEOF case " $LIBOBJS " in *" realloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; esac cat >>confdefs.h <<\_ACEOF #define realloc rpl_realloc _ACEOF fi { echo "$as_me:$LINENO: checking for function prototypes" >&5 echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; } if test "$ac_cv_prog_cc_c89" != no; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define PROTOTYPES 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define __PROTOTYPES 1 _ACEOF else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi { echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5 echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6; } if test "${ac_cv_func_setvbuf_reversed+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_func_setvbuf_reversed=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include # ifdef PROTOTYPES int (setvbuf) (FILE *, int, char *, size_t); # endif int main () { char buf; return setvbuf (stdout, _IOLBF, &buf, 1); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include # ifdef PROTOTYPES int (setvbuf) (FILE *, int, char *, size_t); # endif int main () { char buf; return setvbuf (stdout, &buf, _IOLBF, 1); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then # It compiles and links either way, so it must not be declared # with a prototype and most likely this is a K&R C compiler. # Try running it. if test "$cross_compiling" = yes; then : # Assume setvbuf is not reversed when cross-compiling. else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* This call has the arguments reversed. A reversed system may check and see that the address of buf is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ char buf; if (setvbuf (stdout, _IOLBF, &buf, 1) != 0) return 1; putchar ('\r'); return 0; /* Non-reversed systems SEGV here. */ ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setvbuf_reversed=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_cv_func_setvbuf_reversed=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5 echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6; } if test $ac_cv_func_setvbuf_reversed = yes; then cat >>confdefs.h <<\_ACEOF #define SETVBUF_REVERSED 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; } if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then ac_cv_func_lstat_dereferences_slashed_symlink=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_lstat_dereferences_slashed_symlink=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6; } if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_stat_empty_string_bug=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_stat_empty_string_bug=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF { echo "$as_me:$LINENO: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; } if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ #define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _doprnt /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _doprnt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__doprnt || defined __stub____doprnt choke me #endif int main () { return _doprnt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6; } if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 _ACEOF fi fi done for ac_func in floor memset pow setlocale sqrt strchr strstr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # System libraries that may be required by WCSLIB itself. # SunOS, extra maths functions. { echo "$as_me:$LINENO: checking for cosd in -lsunmath" >&5 echo $ECHO_N "checking for cosd in -lsunmath... $ECHO_C" >&6; } if test "${ac_cv_lib_sunmath_cosd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsunmath $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cosd (); int main () { return cosd (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_sunmath_cosd=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_sunmath_cosd=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_sunmath_cosd" >&5 echo "${ECHO_T}$ac_cv_lib_sunmath_cosd" >&6; } if test $ac_cv_lib_sunmath_cosd = yes; then LIBS="-lsunmath $LIBS" fi # See if we can find sincos(). for ac_func in sincos do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check the size and availability of integer data types. { echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6; } if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF { echo "$as_me:$LINENO: checking for long int" >&5 echo $ECHO_N "checking for long int... $ECHO_C" >&6; } if test "${ac_cv_type_long_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_int=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long_int" >&5 echo "${ECHO_T}$ac_cv_type_long_int" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long int" >&5 echo $ECHO_N "checking size of long int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_int=$ac_lo;; '') if test "$ac_cv_type_long_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long int ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_int=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_INT $ac_cv_sizeof_long_int _ACEOF { echo "$as_me:$LINENO: checking for long long int" >&5 echo $ECHO_N "checking for long long int... $ECHO_C" >&6; } if test "${ac_cv_type_long_long_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long_long_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long_int=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5 echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long long int" >&5 echo $ECHO_N "checking size of long long int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_long_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long_int=$ac_lo;; '') if test "$ac_cv_type_long_long_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long int ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_long_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long_int=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG_INT $ac_cv_sizeof_long_long_int _ACEOF # 64-bit integer data type; use long long int preferentially since that # accords with "%lld" formatting used in fitshdr.l, e.g. # int size_t long int long long int # --- ------ -------- ------------- # gcc x86: 32 32 32 64 # gcc x86_64: 32 64 64 64 if test "x$ac_cv_sizeof_long_long_int" = x8; then cat >>confdefs.h <<\_ACEOF #define WCSLIB_INT64 long long int _ACEOF elif test "x$ac_cv_sizeof_long_int" = x8; then cat >>confdefs.h <<\_ACEOF #define WCSLIB_INT64 long int _ACEOF elif test "x$ac_cv_sizeof_int" = x8; then cat >>confdefs.h <<\_ACEOF #define WCSLIB_INT64 int _ACEOF fi # Does printf() have the z modifier for size_t type? Important for 64-bit. { echo "$as_me:$LINENO: checking for printf z format modifier for size_t type" >&5 echo $ECHO_N "checking for printf z format modifier for size_t type... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then cat >>confdefs.h <<\_ACEOF #define MODZ "" _ACEOF { echo "$as_me:$LINENO: result: assumed not" >&5 echo "${ECHO_T}assumed not" >&6; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { char buf[64]; if (sprintf(buf, "%zu", (size_t)1) != 1) return 1; else if (strcmp(buf, "1")) return 2; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define MODZ "z" _ACEOF { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) cat >>confdefs.h <<\_ACEOF #define MODZ "" _ACEOF { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi # Starting values, may be augmented later. SUBDIRS="C" TSTDIRS="C" INSTDIR="C" # Ways of specifying the Fortran compiler, in order of precedence: # configure --enable-fortran= # F77= configure ...bash # # Ways of disabling Fortran: # configure --disable-fortran # configure --enable-fortran=no # F77=no configure ...bash # Check whether --enable-fortran was given. if test "${enable_fortran+set}" = set; then enableval=$enable_fortran; fi # Check whether --enable-fortran was given. if test "${enable_fortran+set}" = set; then enableval=$enable_fortran; fi if test "x$enable_fortran" != x -a "x$enable_fortran" != xyes ; then F77="$enable_fortran" fi if test "x$F77" = xno ; then F77= { echo "$as_me:$LINENO: WARNING: Compilation of Fortran wrappers and PGSBOX disabled" >&5 echo "$as_me: WARNING: Compilation of Fortran wrappers and PGSBOX disabled" >&2;} else if test "x$F77" = x ; then # Look for a Fortran compiler. ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gfortran g77 f77 ifort xlf frt pgf77 fl32 af77 fort77 f90 \ xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$F77"; then ac_cv_prog_F77="$F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_F77="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi F77=$ac_cv_prog_F77 if test -n "$F77"; then { echo "$as_me:$LINENO: result: $F77" >&5 echo "${ECHO_T}$F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$F77" && break done fi if test -z "$F77"; then ac_ct_F77=$F77 for ac_prog in gfortran g77 f77 ifort xlf frt pgf77 fl32 af77 fort77 f90 \ xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_F77"; then ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_F77="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_F77=$ac_cv_prog_ac_ct_F77 if test -n "$ac_ct_F77"; then { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 echo "${ECHO_T}$ac_ct_F77" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_F77" && break done if test "x$ac_ct_F77" = x; then F77="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac F77=$ac_ct_F77 fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F { echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; } if test "${ac_cv_f77_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ choke me #endif end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; } ac_ext=$ac_save_ext ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= { echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_f77_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else FFLAGS=-g cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_f77_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; } if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi if test "x$F77" = x; then { echo "$as_me:$LINENO: WARNING: ------------------------------------------------------------------ Fortran compiler not found, will skip Fortran wrappers and PGSBOX. ------------------------------------------------------------------" >&5 echo "$as_me: WARNING: ------------------------------------------------------------------ Fortran compiler not found, will skip Fortran wrappers and PGSBOX. ------------------------------------------------------------------" >&2;} # Best guess at Fortran name mangling for use if a compiler does ever # become available. cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF else if test "x$ac_cv_f77_compiler_gnu" = xyes ; then if test "x$F77" = xg77 -o "x$F77" = xf77 ; then # Not recognized by gfortran. FFLAGS="$FFLAGS -Wno-globals" fi fi { echo "$as_me:$LINENO: checking whether $F77 accepts -I" >&5 echo $ECHO_N "checking whether $F77 accepts -I... $ECHO_C" >&6; } ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu FFLAGS_save=$FFLAGS FFLAGS=-I. cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then FFLAGS="$FFLAGS_save -I."; { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 FFLAGS="$FFLAGS_save"; { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Libraries required by the Fortran compiler itself (sets FLIBS). # Required by utilities and test programs written in C that link to # Fortran object modules such as pgsbox. ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { echo "$as_me:$LINENO: checking how to get verbose linking output from $F77" >&5 echo $ECHO_N "checking how to get verbose linking output from $F77... $ECHO_C" >&6; } if test "${ac_cv_prog_f77_v+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_f77_v= # Try some options frequently used verbose output for ac_verb in -v -verbose --verbose -V -\#\#\#; do cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" eval "set x $ac_link" shift echo "$as_me:$LINENO: $*" >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f -r conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" # FIXME: we keep getting bitten by quoted arguments; a more general fix # that detects unbalanced quotes in FLIBS should be implemented # and (ugh) tested at some point. case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;; # Portland Group compiler has singly- or doubly-quoted -cmdline argument # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4. # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2". *-cmdline\ * | *-ignore\ * | *-def\ *) ac_f77_v_output=`echo $ac_f77_v_output | sed "\ s/-cmdline *'[^']*'/ /g; s/-cmdline *\"[^\"]*\"/ /g s/-ignore *'[^']*'/ /g; s/-ignore *\"[^\"]*\"/ /g s/-def *'[^']*'/ /g; s/-def *\"[^\"]*\"/ /g"` ;; # If we are using Cray Fortran then delete quotes. *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;; esac # look for -l* and *.a constructs in the output for ac_arg in $ac_f77_v_output; do case $ac_arg in [\\/]*.a | ?:[\\/]*.a | -[lLRu]*) ac_cv_prog_f77_v=$ac_verb break 2 ;; esac done done if test -z "$ac_cv_prog_f77_v"; then { echo "$as_me:$LINENO: WARNING: cannot determine how to obtain linking information from $F77" >&5 echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: WARNING: compilation failed" >&5 echo "$as_me: WARNING: compilation failed" >&2;} fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_prog_f77_v" >&5 echo "${ECHO_T}$ac_cv_prog_f77_v" >&6; } { echo "$as_me:$LINENO: checking for Fortran 77 libraries of $F77" >&5 echo $ECHO_N "checking for Fortran 77 libraries of $F77... $ECHO_C" >&6; } if test "${ac_cv_f77_libs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$FLIBS" != "x"; then ac_cv_f77_libs="$FLIBS" # Let the user override the test. else cat >conftest.$ac_ext <<_ACEOF program main end _ACEOF # Compile and link our simple test program by passing a flag (argument # 1 to this macro) to the Fortran compiler in order to get # "verbose" output that we can then parse for the Fortran linker # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" eval "set x $ac_link" shift echo "$as_me:$LINENO: $*" >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS rm -f -r conftest* # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where # /foo, /bar, and /baz are search directories for the Fortran linker. # Here, we change these into -L/foo -L/bar -L/baz (and put it first): ac_f77_v_output="`echo $ac_f77_v_output | grep 'LPATH is:' | sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" # FIXME: we keep getting bitten by quoted arguments; a more general fix # that detects unbalanced quotes in FLIBS should be implemented # and (ugh) tested at some point. case $ac_f77_v_output in # If we are using xlf then replace all the commas with spaces. *xlfentry*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted # $LIBS confuse us, and the libraries appear later in the output anyway). *mGLOB_options_string*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"-mGLOB[^"]*"/ /g'` ;; # Portland Group compiler has singly- or doubly-quoted -cmdline argument # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4. # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2". *-cmdline\ * | *-ignore\ * | *-def\ *) ac_f77_v_output=`echo $ac_f77_v_output | sed "\ s/-cmdline *'[^']*'/ /g; s/-cmdline *\"[^\"]*\"/ /g s/-ignore *'[^']*'/ /g; s/-ignore *\"[^\"]*\"/ /g s/-def *'[^']*'/ /g; s/-def *\"[^\"]*\"/ /g"` ;; # If we are using Cray Fortran then delete quotes. *cft90*) ac_f77_v_output=`echo $ac_f77_v_output | sed 's/"//g'` ;; esac ac_cv_f77_libs= # Save positional arguments (if any) ac_save_positional="$@" set X $ac_f77_v_output while test $# != 1; do shift ac_arg=$1 case $ac_arg in [\\/]*.a | ?:[\\/]*.a) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; -bI:*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_arg; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi fi ;; # Ignore these flags. -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -LANG:=* | -LIST:* | -LNO:*) ;; -lkernel32) test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" ;; -[LRuYz]) # These flags, when seen by themselves, take an argument. # We remove the space between option and argument and re-iterate # unless we find an empty arg or a new option (starting with -) case $2 in "" | -*);; *) ac_arg="$ac_arg$2" shift; shift set X $ac_arg "$@" ;; esac ;; -YP,*) for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_j" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_arg="$ac_arg $ac_j" ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" fi done ;; -[lLR]*) ac_exists=false for ac_i in $ac_cv_f77_libs; do if test x"$ac_arg" = x"$ac_i"; then ac_exists=true break fi done if test x"$ac_exists" = xtrue; then : else ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" fi ;; -zallextract*| -zdefaultextract) ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" ;; # Ignore everything else. esac done # restore positional arguments set X $ac_save_positional; shift # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, # then we insist that the "run path" must be an absolute path (i.e. it # must begin with a "/"). case `(uname -sr) 2>/dev/null` in "SunOS 5"*) ac_ld_run_path=`echo $ac_f77_v_output | sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` test "x$ac_ld_run_path" != x && if test "$ac_compiler_gnu" = yes; then for ac_link_opt in $ac_ld_run_path; do ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" done else ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path" fi ;; esac fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" fi { echo "$as_me:$LINENO: result: $ac_cv_f77_libs" >&5 echo "${ECHO_T}$ac_cv_f77_libs" >&6; } FLIBS="$ac_cv_f77_libs" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # F77 name mangling (defines the F77_FUNC preprocessor macro). ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { echo "$as_me:$LINENO: checking for dummy main to link with Fortran 77 libraries" >&5 echo $ECHO_N "checking for dummy main to link with Fortran 77 libraries... $ECHO_C" >&6; } if test "${ac_cv_f77_dummy_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_f77_dm_save_LIBS=$LIBS LIBS="$LIBS $FLIBS" ac_fortran_dm_var=F77_DUMMY_MAIN ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # First, try linking without a dummy main: cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_fortran_dummy_main=none else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_fortran_dummy_main=unknown fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test $ac_cv_fortran_dummy_main = unknown; then for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define $ac_fortran_dm_var $ac_func #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_fortran_dummy_main=$ac_func; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done fi ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu ac_cv_f77_dummy_main=$ac_cv_fortran_dummy_main rm -f -r conftest* LIBS=$ac_f77_dm_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_f77_dummy_main" >&5 echo "${ECHO_T}$ac_cv_f77_dummy_main" >&6; } F77_DUMMY_MAIN=$ac_cv_f77_dummy_main if test "$F77_DUMMY_MAIN" != unknown; then if test $F77_DUMMY_MAIN != none; then cat >>confdefs.h <<_ACEOF #define F77_DUMMY_MAIN $F77_DUMMY_MAIN _ACEOF if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then cat >>confdefs.h <<\_ACEOF #define FC_DUMMY_MAIN_EQ_F77 1 _ACEOF fi fi else { { echo "$as_me:$LINENO: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&5 echo "$as_me: error: linking to Fortran libraries from C fails See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu { echo "$as_me:$LINENO: checking for Fortran 77 name-mangling scheme" >&5 echo $ECHO_N "checking for Fortran 77 name-mangling scheme... $ECHO_C" >&6; } if test "${ac_cv_f77_mangling+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF subroutine foobar() return end subroutine foo_bar() return end _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_f77_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then mv conftest.$ac_objext cfortran_test.$ac_objext ac_save_LIBS=$LIBS LIBS="cfortran_test.$ac_objext $LIBS $FLIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success=no for ac_foobar in foobar FOOBAR; do for ac_underscore in "" "_"; do ac_func="$ac_foobar$ac_underscore" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_success=yes; break 2 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success" = "yes"; then case $ac_foobar in foobar) ac_case=lower ac_foo_bar=foo_bar ;; FOOBAR) ac_case=upper ac_foo_bar=FOO_BAR ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_success_extra=no for ac_extra in "" "_"; do ac_func="$ac_foo_bar$ac_underscore$ac_extra" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_success_extra=yes; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext done ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test "$ac_success_extra" = "yes"; then ac_cv_f77_mangling="$ac_case case" if test -z "$ac_underscore"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, underscore" fi if test -z "$ac_extra"; then ac_cv_f77_mangling="$ac_cv_f77_mangling, no extra underscore" else ac_cv_f77_mangling="$ac_cv_f77_mangling, extra underscore" fi else ac_cv_f77_mangling="unknown" fi else ac_cv_f77_mangling="unknown" fi LIBS=$ac_save_LIBS rm -f -r cfortran_test* conftest* else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compile a simple Fortran program See \`config.log' for more details." >&5 echo "$as_me: error: cannot compile a simple Fortran program See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_f77_mangling" >&5 echo "${ECHO_T}$ac_cv_f77_mangling" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu case $ac_cv_f77_mangling in "lower case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name _ACEOF ;; "lower case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## _ _ACEOF ;; "lower case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) name ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) name ## __ _ACEOF ;; "upper case, no underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME _ACEOF ;; "upper case, no underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, no extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## _ _ACEOF ;; "upper case, underscore, extra underscore") cat >>confdefs.h <<\_ACEOF #define F77_FUNC(name,NAME) NAME ## _ _ACEOF cat >>confdefs.h <<\_ACEOF #define F77_FUNC_(name,NAME) NAME ## __ _ACEOF ;; *) { echo "$as_me:$LINENO: WARNING: unknown Fortran name-mangling scheme" >&5 echo "$as_me: WARNING: unknown Fortran name-mangling scheme" >&2;} ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu SUBDIRS="C Fortran" TSTDIRS="C Fortran" INSTDIR="Fortran" fi fi # System-dependent system libraries (for building the sharable library). #----------------------------------------------------------------------- # Darwin (contains stubs for long double). as_ac_Lib=`echo "ac_cv_lib_SystemStubs_printf\$LDBLStub" | $as_tr_sh` { echo "$as_me:$LINENO: checking for printf\$LDBLStub in -lSystemStubs" >&5 echo $ECHO_N "checking for printf\$LDBLStub in -lSystemStubs... $ECHO_C" >&6; } if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSystemStubs $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char printf\$LDBLStub (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return printf\$LDBLStub (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi ac_res=`eval echo '${'$as_ac_Lib'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Lib'}'` = yes; then LIBS="$LIBS -lSystemStubs" fi # Library and installation utilities. #------------------------------------ # Static library generation. if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Shared library generation. if test "x$ac_cv_c_compiler_gnu" = xyes ; then SHVER=`echo "$LIBVER" | sed -e 's/\..*$//'` # Note that -fPIC is on by default for Macs, this just makes it obvious. SHRFLAGS="-fPIC" SHRLD="\$(CC) \$(SHRFLAGS)" case "$build_os" in darwin*) SHRLIB="libwcs.$LIBVER.dylib" SONAME="libwcs.$SHVER.dylib" SHRLD="$SHRLD -dynamiclib -single_module" SHRLD="$SHRLD -compatibility_version $SHVER -current_version $LIBVER" SHRLN= case "$build_cpu" in powerpc*) # Switch off -fPIC (not applicable for PowerPC Macs). CFLAGS="$CFLAGS -mdynamic-no-pic" ;; esac ;; *) # Covers Linux and Solaris at least. SHRLIB="libwcs.so.$LIBVER" SONAME="libwcs.so.$SHVER" SHRLD="$SHRLD -shared -Wl,-h\$(SONAME)" SHRLN="libwcs.so" ;; esac else SHRLIB= SONAME= SHRFLAGS= SHRLD= SHRSFX= SHRLN= fi # Installation utilities. { echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6; } fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: End of primary configuration. " >&5 echo "$as_me: End of primary configuration. " >&6;} # The following are required to build utilities and test programs. # ---------------------------------------------------------------- { echo "$as_me:$LINENO: Looking for libraries etc. for utilities and test suite..." >&5 echo "$as_me: Looking for libraries etc. for utilities and test suite..." >&6;} # Check for other quasi-standard header files. for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to mark@calabretta.id.au ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Large file support. { echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5 echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_largefile_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_sys_largefile_source=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_sys_largefile_source=1; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext ac_cv_sys_largefile_source=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5 echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6; } case $ac_cv_sys_largefile_source in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source _ACEOF ;; esac rm -f -r conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. if test $ac_cv_sys_largefile_source != unknown; then cat >>confdefs.h <<\_ACEOF #define HAVE_FSEEKO 1 _ACEOF fi # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -f -r conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_large_files+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -f -r conftest* fi fi # Extra places to look for third-party libraries and header files. LIBDIRS= # Check whether --with-cfitsio was given. if test "${with_cfitsio+set}" = set; then withval=$with_cfitsio; fi if test "x$with_cfitsio" = xno ; then { echo "$as_me:$LINENO: WARNING: CFITSIO disabled" >&5 echo "$as_me: WARNING: CFITSIO disabled" >&2;} else # Check whether --with-cfitsiolib was given. if test "${with_cfitsiolib+set}" = set; then withval=$with_cfitsiolib; fi if test "x$with_cfitsiolib" != x ; then LIBDIRS="$LIBDIRS $with_cfitsiolib" fi # Check whether --with-cfitsioinc was given. if test "${with_cfitsioinc+set}" = set; then withval=$with_cfitsioinc; fi if test "x$with_cfitsioinc" != x ; then CFITSIO_INCDIRS="$with_cfitsioinc" fi CFITSIO_INCDIRS="$CFITSIO_INCDIRS \ /usr/local/cfitsio/include \ /local/cfitsio/include" LIBDIRS="$LIBDIRS \ /usr/local/cfitsio/lib \ /local/cfitsio/lib" fi # Check whether --with-pgplot was given. if test "${with_pgplot+set}" = set; then withval=$with_pgplot; fi if test "x$with_pgplot" = xno ; then { echo "$as_me:$LINENO: WARNING: PGPLOT disabled" >&5 echo "$as_me: WARNING: PGPLOT disabled" >&2;} else # Check whether --with-pgplotlib was given. if test "${with_pgplotlib+set}" = set; then withval=$with_pgplotlib; fi if test "x$with_pgplotlib" != x ; then LIBDIRS="$LIBDIRS $with_pgplotlib" fi # Check whether --with-pgplotinc was given. if test "${with_pgplotinc+set}" = set; then withval=$with_pgplotinc; fi if test "x$with_pgplotinc" != x ; then PGPLOT_INCDIRS="$with_pgplotinc" fi PGPLOT_INCDIRS="$PGPLOT_INCDIRS \ /usr/local/pgplot/include \ /local/pgplot/include" LIBDIRS="$LIBDIRS \ /usr/local/pgplot/lib \ /local/pgplot/lib" fi if test "x$with_cfitsio" != xno -o \ "x$with_pgplot" != xno ; then LIBDIRS="$LIBDIRS \ /usr/local/lib \ /local/lib \ /opt/local/lib \ /opt/SUNWspro/lib \ /sw/lib" for LIBDIR in $LIBDIRS ; do as_ac_File=`echo "ac_cv_file_$LIBDIR" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $LIBDIR" >&5 echo $ECHO_N "checking for $LIBDIR... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$LIBDIR"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then LDFLAGS="$LDFLAGS -L$LIBDIR" else continue fi done # Generic include directories. INCDIRS="/usr/local/include \ /local/include \ /opt/local/include \ /sw/include \ /local \ /usr/include" # CFITSIO. if test "x$with_cfitsio" != xno ; then # Search for CFITSIO. for INCDIR in $CFITSIO_INCDIRS $INCDIRS ; do as_ac_File=`echo "ac_cv_file_$INCDIR/cfitsio/fitsio.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $INCDIR/cfitsio/fitsio.h" >&5 echo $ECHO_N "checking for $INCDIR/cfitsio/fitsio.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$INCDIR/cfitsio/fitsio.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then CFITSIOINC="-I$INCDIR/cfitsio"; break fi as_ac_File=`echo "ac_cv_file_$INCDIR/fitsio.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $INCDIR/fitsio.h" >&5 echo $ECHO_N "checking for $INCDIR/fitsio.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$INCDIR/fitsio.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then CFITSIOINC="-I$INCDIR"; break fi done { echo "$as_me:$LINENO: checking for recv in -lsocket" >&5 echo $ECHO_N "checking for recv in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_recv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char recv (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return recv (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_recv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_recv=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_socket_recv" >&5 echo "${ECHO_T}$ac_cv_lib_socket_recv" >&6; } if test $ac_cv_lib_socket_recv = yes; then CFITSIOLIB="-lsocket" fi { echo "$as_me:$LINENO: checking for ffopen in -lcfitsio" >&5 echo $ECHO_N "checking for ffopen in -lcfitsio... $ECHO_C" >&6; } if test "${ac_cv_lib_cfitsio_ffopen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcfitsio $CFITSIOLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ffopen (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return ffopen (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_cfitsio_ffopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cfitsio_ffopen=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_cfitsio_ffopen" >&5 echo "${ECHO_T}$ac_cv_lib_cfitsio_ffopen" >&6; } if test $ac_cv_lib_cfitsio_ffopen = yes; then CFITSIOLIB="-lcfitsio $CFITSIOLIB" fi if test "x$CFITSIOINC" = x -o "x$CFITSIOLIB" = x; then { echo "$as_me:$LINENO: WARNING: CFITSIO not found, skipping CFITSIO-dependent tests." >&5 echo "$as_me: WARNING: CFITSIO not found, skipping CFITSIO-dependent tests." >&2;} else { echo "$as_me:$LINENO: CFITSIO appears to be available." >&5 echo "$as_me: CFITSIO appears to be available." >&6;} cat >>confdefs.h <<\_ACEOF #define HAVE_CFITSIO 1 _ACEOF # Check for fits_read_wcstab, present in CFITSIO 3.004beta and later. { echo "$as_me:$LINENO: checking for fits_read_wcstab in -lcfitsio" >&5 echo $ECHO_N "checking for fits_read_wcstab in -lcfitsio... $ECHO_C" >&6; } if test "${ac_cv_lib_cfitsio_fits_read_wcstab+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcfitsio $CFITSIOLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char fits_read_wcstab (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return fits_read_wcstab (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_cfitsio_fits_read_wcstab=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cfitsio_fits_read_wcstab=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_cfitsio_fits_read_wcstab" >&5 echo "${ECHO_T}$ac_cv_lib_cfitsio_fits_read_wcstab" >&6; } if test $ac_cv_lib_cfitsio_fits_read_wcstab = yes; then GETWCSTAB= else GETWCSTAB=getwcstab.o fi if test "x$GETWCSTAB" != x ; then { echo "$as_me:$LINENO: WARNING: fits_read_wcstab not found in CFITSIO, will use getwcstab.c to compile test programs." >&5 echo "$as_me: WARNING: fits_read_wcstab not found in CFITSIO, will use getwcstab.c to compile test programs." >&2;} fi fi fi # PGPLOT. if test "x$F77" != x -a "x$with_pgplot" != xno ; then # Search for PGPLOT. for INCDIR in $PGPLOT_INCDIRS $INCDIRS ; do as_ac_File=`echo "ac_cv_file_$INCDIR/pgplot/cpgplot.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $INCDIR/pgplot/cpgplot.h" >&5 echo $ECHO_N "checking for $INCDIR/pgplot/cpgplot.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$INCDIR/pgplot/cpgplot.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then PGPLOTINC="-I$INCDIR/pgplot"; break fi as_ac_File=`echo "ac_cv_file_$INCDIR/cpgplot.h" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $INCDIR/cpgplot.h" >&5 echo $ECHO_N "checking for $INCDIR/cpgplot.h... $ECHO_C" >&6; } if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test "$cross_compiling" = yes && { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5 echo "$as_me: error: cannot check for file existence when cross compiling" >&2;} { (exit 1); exit 1; }; } if test -r "$INCDIR/cpgplot.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi ac_res=`eval echo '${'$as_ac_File'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_File'}'` = yes; then PGPLOTINC="-I$INCDIR"; break fi done # FLIBS (found above via AC_F77_LIBRARY_LDFLAGS) only helps if PGPLOT was # built using the same Fortran compiler that we are using here. # PGPLOT compiled by the SUN Fortran compiler but linked with something # else. { echo "$as_me:$LINENO: checking for iand_ in -lM77" >&5 echo $ECHO_N "checking for iand_ in -lM77... $ECHO_C" >&6; } if test "${ac_cv_lib_M77_iand_+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lM77 $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iand_ (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return iand_ (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_M77_iand_=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_M77_iand_=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_M77_iand_" >&5 echo "${ECHO_T}$ac_cv_lib_M77_iand_" >&6; } if test $ac_cv_lib_M77_iand_ = yes; then PGPLOTLIB="-lM77 $PGPLOTLIB" fi { echo "$as_me:$LINENO: checking for f77_init in -lF77" >&5 echo $ECHO_N "checking for f77_init in -lF77... $ECHO_C" >&6; } if test "${ac_cv_lib_F77_f77_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lF77 $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char f77_init (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return f77_init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_F77_f77_init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_F77_f77_init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_F77_f77_init" >&5 echo "${ECHO_T}$ac_cv_lib_F77_f77_init" >&6; } if test $ac_cv_lib_F77_f77_init = yes; then PGPLOTLIB="-lF77 $PGPLOTLIB" fi if test "x$F77" != xg77; then # For PGPLOT compiled with g77 but linked with something else. { echo "$as_me:$LINENO: checking for main in -lfrtbegin" >&5 echo $ECHO_N "checking for main in -lfrtbegin... $ECHO_C" >&6; } if test "${ac_cv_lib_frtbegin_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfrtbegin $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return main (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_frtbegin_main=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_frtbegin_main=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_frtbegin_main" >&5 echo "${ECHO_T}$ac_cv_lib_frtbegin_main" >&6; } if test $ac_cv_lib_frtbegin_main = yes; then PGPLOTLIB="-lfrtbegin $PGPLOTLIB" fi { echo "$as_me:$LINENO: checking for gerror_ in -lg2c" >&5 echo $ECHO_N "checking for gerror_ in -lg2c... $ECHO_C" >&6; } if test "${ac_cv_lib_g2c_gerror_+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lg2c $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gerror_ (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return gerror_ (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_g2c_gerror_=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_g2c_gerror_=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_g2c_gerror_" >&5 echo "${ECHO_T}$ac_cv_lib_g2c_gerror_" >&6; } if test $ac_cv_lib_g2c_gerror_ = yes; then PGPLOTLIB="-lg2c $PGPLOTLIB" fi fi if test "x$F77" != xgfortran; then # For PGPLOT compiled with gfortran but linked with something else. # Note that if gfortran itself is driving the linker it can be harmful # to add -lgfortran to the link list without also adding -lgfortranbegin. # Doing so stops gfortran from adding -lgfortranbegin which is needed to # resolve "main". { echo "$as_me:$LINENO: checking for _gfortran_abort in -lgfortran" >&5 echo $ECHO_N "checking for _gfortran_abort in -lgfortran... $ECHO_C" >&6; } if test "${ac_cv_lib_gfortran__gfortran_abort+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgfortran $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _gfortran_abort (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return _gfortran_abort (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_gfortran__gfortran_abort=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gfortran__gfortran_abort=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_gfortran__gfortran_abort" >&5 echo "${ECHO_T}$ac_cv_lib_gfortran__gfortran_abort" >&6; } if test $ac_cv_lib_gfortran__gfortran_abort = yes; then PGPLOTLIB="-lgfortran $PGPLOTLIB" fi fi # Search for X11 includes and libraries. { echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 echo "$as_me: error: Cannot use X directory names containing '" >&2;} { (exit 1); exit 1; }; };; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { XrmInitialize () ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; } fi if test "x$no_x" = x; then if test "x$ac_x_libraries" != x ; then # Not needed for systems that keep the X11 libraries in /usr/lib. LDFLAGS="$LDFLAGS -L$ac_x_libraries" fi PGPLOTLIB="-lX11 $PGPLOTLIB" fi # It is possible that other libraries may be required depending on what # graphics drivers were installed with PGPLOT. { echo "$as_me:$LINENO: checking for deflate in -lz" >&5 echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; } if test "${ac_cv_lib_z_deflate+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char deflate (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return deflate (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_z_deflate=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_deflate=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; } if test $ac_cv_lib_z_deflate = yes; then PGPLOTLIB="-lz $PGPLOTLIB" fi { echo "$as_me:$LINENO: checking for png_error in -lpng" >&5 echo $ECHO_N "checking for png_error in -lpng... $ECHO_C" >&6; } if test "${ac_cv_lib_png_png_error+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpng $PGPLOTLIB $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char png_error (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return png_error (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_png_png_error=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_png_png_error=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_error" >&5 echo "${ECHO_T}$ac_cv_lib_png_png_error" >&6; } if test $ac_cv_lib_png_png_error = yes; then PGPLOTLIB="-lpng $PGPLOTLIB" fi { echo "$as_me:$LINENO: checking for pgbeg_ in -lpgplot" >&5 echo $ECHO_N "checking for pgbeg_ in -lpgplot... $ECHO_C" >&6; } if test "${ac_cv_lib_pgplot_pgbeg_+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpgplot $PGPLOTLIB $FLIBS $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pgbeg_ (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return pgbeg_ (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_pgplot_pgbeg_=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pgplot_pgbeg_=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_pgplot_pgbeg_" >&5 echo "${ECHO_T}$ac_cv_lib_pgplot_pgbeg_" >&6; } if test $ac_cv_lib_pgplot_pgbeg_ = yes; then PGPLOTLIB="-lpgplot $PGPLOTLIB" fi { echo "$as_me:$LINENO: checking for cpgbeg in -lcpgplot" >&5 echo $ECHO_N "checking for cpgbeg in -lcpgplot... $ECHO_C" >&6; } if test "${ac_cv_lib_cpgplot_cpgbeg+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcpgplot $PGPLOTLIB $FLIBS $LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char cpgbeg (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { return cpgbeg (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_cpgplot_cpgbeg=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cpgplot_cpgbeg=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_cpgplot_cpgbeg" >&5 echo "${ECHO_T}$ac_cv_lib_cpgplot_cpgbeg" >&6; } if test $ac_cv_lib_cpgplot_cpgbeg = yes; then PGPLOTLIB="-lcpgplot $PGPLOTLIB" else PGPLOTLIB= fi # Only need the PGPLOT include file to build PGSBOX. if test "x$PGPLOTINC" != x; then SUBDIRS="$SUBDIRS pgsbox" INSTDIR="pgsbox" fi # Also need the PGPLOT library to build pgtest and cpgtest. if test "x$PGPLOTLIB" = x; then { echo "$as_me:$LINENO: WARNING: PGPLOT not found, skipping PGPLOT-dependent tests." >&5 echo "$as_me: WARNING: PGPLOT not found, skipping PGPLOT-dependent tests." >&2;} else { echo "$as_me:$LINENO: PGPLOT appears to be available." >&5 echo "$as_me: PGPLOT appears to be available." >&6;} TSTDIRS="$TSTDIRS pgsbox" fi fi fi # Utilities are compiled last since they need the libraries. # Ways of disabling them: # configure --disable-utils # configure --enable-utils=no # Check whether --enable-utils was given. if test "${enable_utils+set}" = set; then enableval=$enable_utils; fi if test "x$enable_utils" != xno ; then SUBDIRS="$SUBDIRS utils" INSTDIR="$INSTDIR utils" else { echo "$as_me:$LINENO: WARNING: Compilation of WCS utilities disabled" >&5 echo "$as_me: WARNING: Compilation of WCS utilities disabled" >&2;} fi { echo "$as_me:$LINENO: End of auxiliary configuration. " >&5 echo "$as_me: End of auxiliary configuration. " >&6;} # Do it. { echo "$as_me:$LINENO: Configuring files..." >&5 echo "$as_me: Configuring files..." >&6;} ac_config_files="$ac_config_files makedefs wcslib.pc" ac_config_headers="$ac_config_headers wcsconfig.h wcsconfig_f77.h wcsconfig_tests.h wcsconfig_utils.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by WCSLIB $as_me 4.19, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ WCSLIB config.status 4.19 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "makedefs") CONFIG_FILES="$CONFIG_FILES makedefs" ;; "wcslib.pc") CONFIG_FILES="$CONFIG_FILES wcslib.pc" ;; "wcsconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS wcsconfig.h" ;; "wcsconfig_f77.h") CONFIG_HEADERS="$CONFIG_HEADERS wcsconfig_f77.h" ;; "wcsconfig_tests.h") CONFIG_HEADERS="$CONFIG_HEADERS wcsconfig_tests.h" ;; "wcsconfig_utils.h") CONFIG_HEADERS="$CONFIG_HEADERS wcsconfig_utils.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim LIBVER!$LIBVER$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim ARCH!$ARCH$ac_delim FLEX!$FLEX$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LIBOBJS!$LIBOBJS$ac_delim F77!$F77$ac_delim FFLAGS!$FFLAGS$ac_delim ac_ct_F77!$ac_ct_F77$ac_delim FLIBS!$FLIBS$ac_delim RANLIB!$RANLIB$ac_delim SHRLIB!$SHRLIB$ac_delim SONAME!$SONAME$ac_delim SHRFLAGS!$SHRFLAGS$ac_delim SHRLD!$SHRLD$ac_delim SHRSFX!$SHRSFX$ac_delim SHRLN!$SHRLN$ac_delim LN_S!$LN_S$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim XMKMF!$XMKMF$ac_delim CFITSIOINC!$CFITSIOINC$ac_delim CFITSIOLIB!$CFITSIOLIB$ac_delim GETWCSTAB!$GETWCSTAB$ac_delim PGPLOTINC!$PGPLOTINC$ac_delim PGPLOTLIB!$PGPLOTLIB$ac_delim SUBDIRS!$SUBDIRS$ac_delim TSTDIRS!$TSTDIRS$ac_delim INSTDIR!$INSTDIR$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi astropy-0.3/cextern/wcslib/VALIDATION0000644000175000017500000002174612243255342015521 0ustar oleolePlatforms on which the installation procedures and test suite were exercised WCSLIB version 4.19 (2013/09/30) -------------------------------- * Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy) uname -r (kernel version): 3.2.0-4-686-pae gcc --version: gcc (Debian 4.7.2-5) 4.7.2 gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2 WCSLIB version 4.18 (2013/07/12) -------------------------------- * Dell Latitude D620 (Intel Centrino, i686) running Debian linux 7.0 (wheezy) uname -r (kernel version): 3.2.0-4-686-pae gcc --version: gcc (Debian 4.7.2-5) 4.7.2 gfortran --version: GNU Fortran (Debian 4.7.2-5) 4.7.2 WCSLIB version 4.17 (2013/01/29) -------------------------------- * Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny) uname -r (kernel version): 2.6.26-2-686 gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 WCSLIB version 4.15 (2012/09/26) -------------------------------- * Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny) uname -r (kernel version): 2.6.26-2-686 gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 WCSLIB version 4.14 (2012/07/13) -------------------------------- * Dell Latitude D620 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny) uname -r (kernel version): 2.6.26-2-686 gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 * MacBook Pro (Intel Core 2 Duo) running MacOSX 10.7.3 (11D50) uname -r (Darwin kernel version): 11.3.0 gcc --version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Apple Inc. build 5658) (LLVM build 2336.1.00) gfortran --version: GNU Fortran (GCC) 4.6.1 (Non-graphics tests only.) WCSLIB version 4.13.1 (2012/03/15) ---------------------------------- * Dell Latitude D630 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny) uname -r (kernel version): 2.6.32-bpo.5-686 gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 * MacBook Pro (Intel Core 2 Duo) running MacOSX 10.7.3 (11D50) uname -r (Darwin kernel version): 11.3.0 gcc --version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Apple Inc. build 5658) (LLVM build 2336.1.00) gfortran --version: GNU Fortran (GCC) 4.6.1 (Non-graphics tests only.) WCSLIB version 4.10 (2012/02/06) -------------------------------- * Dell Latitude D630 (Intel Centrino, i686) running Debian linux 5.0.9 (lenny) uname -r (kernel version): 2.6.32-bpo.5-686 gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 WCSLIB version 4.8 (2011/08/15) ------------------------------- * Dell Latitude D620 (Intel Centrino Duo, i686), Debian linux 4.0 (etch) uname -r (kernel version): 2.6.24-1-686 (32-bit) gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) * Dell PowerEdge 2950 (Intel Xeon, 8 x X5460), Debian linux 5.0.8 (lenny) uname -r (kernel version): 2.6.26-2-amd64 (64-bit) gcc --version: gcc (Debian 4.3.2-1.1) 4.3.2 gfortran --version: GNU Fortran (Debian 4.3.2-1.1) 4.3.2 * Marvell SheevaPlug (Feroceon 88FR131 rev 1 ARM v5L), Debian linux 6.0 (squeeze) uname -r (kernel version): 2.6.32-5-kirkwood gcc --version: gcc (Debian 4.4.5-8) 4.4.5 gfortran --version: GNU Fortran (Debian 4.4.5-8) 4.4.5 * Mac mini (Intel Core 2 Duo) running MacOSX 10.6.2 (10C540) uname -r (Darwin kernel version): 10.2.0 gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental) * Enterprise 450 Model 2250 (Sparc, sun4u 64-bit), SunOS 5.9 (Solaris 9) uname -r (SunOS version): 5.9 gcc --version: gcc (GCC) 4.5.1 gfortran --version: GNU Fortran (GCC) 4.5.1 WCSLIB version 4.7 (2011/02/07) ------------------------------- * Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.24-1-686 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) * Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.18-6-amd64 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) * Enterprise 450 Model 2250 (Sparc, sun4u 64-bit), SunOS 5.9 (Solaris 9) uname -r (SunOS version): 5.9 gcc --version: gcc (GCC) 4.5.1 gfortran --version: GNU Fortran (GCC) 4.5.1 and cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20 f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07 2004/04/23 * Mac Xserve (Quad-Core Intel Xeon) running MacOSX 10.6.5 (10H575) uname -r (Darwin kernel version): 10.5.0 gcc --version: 4.2.1 (Apple Inc. build 5664) gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental) * Mac mini (Intel Core 2 Duo) running MacOSX 10.6.2 (10C540) uname -r (Darwin kernel version): 10.2.0 gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental) * Mac mini (Intel Core Duo) running MacOSX 10.4.9 (8P2137) uname -r (Darwin kernel version): 8.9.1 gcc --version: gcc (GCC) 4.3.0 20070316 (experimental) g77 --version: GNU Fortran (GCC) 3.4.0 WCSLIB version 4.5 (2010/07/16) ------------------------------- * Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.24-1-686 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) and gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) ifort -V: Intel(R) Fortran Compiler for 32-bit applications, Version 8.1 Build 20041118Z Package ID: l_fc_pc_8.1.023 * Mac mini (Intel Core 2 Duo, i386) running MacOSX 10.6.2 (10C540) uname -r (Darwin kernel version): 10.2.0 gcc --version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) gfortran --version: GNU Fortran (GCC) 4.5.0 20100107 (experimental) * Mac mini (Intel Core Duo, i386) running MacOSX 10.4.9 (8P2137) uname -r (Darwin kernel version): 8.9.1 gcc --version: gcc (GCC) 4.3.0 20070316 (experimental) g77 --version: GNU Fortran (GCC) 3.4.0 and gcc --version: gcc (GCC) 4.3.0 20070316 (experimental) gfortran --version: GNU Fortran (GCC) 4.3.0 20070316 (experimental) * Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.18-6-amd64 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) and gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) * Sun Ultra-60 (Sparc, sun4u) running SunOS 5.6 (Solaris 2.6) uname -r (SunOS version): 5.6 gcc --version: 2.95.3 g77 --version: GNU Fortran 0.5.25 20010315 (release) and cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20 f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07 2004/04/23 WCSLIB version 4.4 (2009/08/06) ------------------------------- * Dell Latitude D630 (Intel Centrino, i686) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.24-1-686 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) * Mac mini (Intel Core Duo, i386) running MacOSX 10.4.9 (8P2137) uname -r (Darwin kernel version): 8.9.1 gcc --version: gcc (GCC) 4.3.0 20070316 (experimental) g77 --version: GNU Fortran (GCC) 3.4.0 and gcc --version: gcc (GCC) 4.3.0 20070316 (experimental) gfortran --version: GNU Fortran (GCC) 4.3.0 20070316 (experimental) * Sun SunFire V20z (AMD Opteron, x86_64) running Debian linux 4.0 (etch) uname -r (kernel version): 2.6.18-6-amd64 gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) g77 --version: GNU Fortran (GCC) 3.4.6 (Debian 3.4.6-5) and gcc --version: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) gfortran --version: GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) * Sun SunBlade 1000 (Sparc, sun4u) running SunOS 5.8 (Solaris 2.8) uname -r (SunOS version): 5.8 gcc --version: 2.95.3 g77 --version: GNU Fortran 0.5.25 20010315 (release) and cc -V: cc: Sun WorkShop 6 update 2 C 5.3 Patch 111679-14 2004/02/20 f77 -V: f77: Sun WorkShop 6 update 2 FORTRAN 77 5.3 Patch 111691-07 2004/04/23 ------------------------------------------------------------------------------ $Id: VALIDATION,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ astropy-0.3/cextern/wcslib/config/0000755000175000017500000000000012243263747015407 5ustar oleoleastropy-0.3/cextern/wcslib/config/missing0000755000175000017500000002466612243255342017014 0ustar oleole#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: astropy-0.3/cextern/wcslib/config/mdate-sh0000755000175000017500000001013012243255342017022 0ustar oleole#!/bin/sh # Get modification time of a file or directory and pretty-print it. # Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc. # written by Ulrich Drepper , June 1995 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Prevent date giving response in another language. LANG=C export LANG LC_ALL=C export LC_ALL LC_TIME=C export LC_TIME save_arg1="$1" # Find out how to get the extended ls output of a file or directory. if ls -L /dev/null 1>/dev/null 2>&1; then ls_command='ls -L -l -d' else ls_command='ls -l -d' fi # A `ls -l' line looks as follows on OS/2. # drwxrwx--- 0 Aug 11 2001 foo # This differs from Unix, which adds ownership information. # drwxrwx--- 2 root root 4096 Aug 11 2001 foo # # To find the date, we split the line on spaces and iterate on words # until we find a month. This cannot work with files whose owner is a # user named `Jan', or `Feb', etc. However, it's unlikely that `/' # will be owned by a user whose name is a month. So we first look at # the extended ls output of the root directory to decide how many # words should be skipped to get the date. # On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. set - x`$ls_command /` # Find which argument is the month. month= command= until test $month do shift # Add another shift to the command. command="$command shift;" case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac done # Get the extended ls output of the file or directory. set - x`eval "$ls_command \"\$save_arg1\""` # Remove all preceding arguments eval $command # Get the month. Next argument is day, followed by the year or time. case $1 in Jan) month=January; nummonth=1;; Feb) month=February; nummonth=2;; Mar) month=March; nummonth=3;; Apr) month=April; nummonth=4;; May) month=May; nummonth=5;; Jun) month=June; nummonth=6;; Jul) month=July; nummonth=7;; Aug) month=August; nummonth=8;; Sep) month=September; nummonth=9;; Oct) month=October; nummonth=10;; Nov) month=November; nummonth=11;; Dec) month=December; nummonth=12;; esac day=$2 # Here we have to deal with the problem that the ls output gives either # the time of day or the year. case $3 in *:*) set `date`; eval year=\$$# case $2 in Jan) nummonthtod=1;; Feb) nummonthtod=2;; Mar) nummonthtod=3;; Apr) nummonthtod=4;; May) nummonthtod=5;; Jun) nummonthtod=6;; Jul) nummonthtod=7;; Aug) nummonthtod=8;; Sep) nummonthtod=9;; Oct) nummonthtod=10;; Nov) nummonthtod=11;; Dec) nummonthtod=12;; esac # For the first six month of the year the time notation can also # be used for files modified in the last year. if (expr $nummonth \> $nummonthtod) > /dev/null; then year=`expr $year - 1` fi;; *) year=$3;; esac # The result. echo $day $month $year astropy-0.3/cextern/wcslib/config/mkinstalldirs0000755000175000017500000000530012243255342020203 0ustar oleole#! /bin/sh # mkinstalldirs --- make directory hierarchy # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. scriptversion=2003-09-26.19 errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. " # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit 0 ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit 0 ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./-- && rmdir ./-- fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./-- "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: astropy-0.3/cextern/wcslib/config/move-if-change0000755000175000017500000000037312243255342020115 0ustar oleole#!/bin/sh # Like mv $1 $2, but if the files are the same, just delete $1. # Status is 0 if $2 is changed, 1 otherwise. if test -r $2; then if cmp -s $1 $2; then echo $2 is unchanged rm -f $1 else mv -f $1 $2 fi else mv -f $1 $2 fi astropy-0.3/cextern/wcslib/config/install-sh0000755000175000017500000002017412243255342017407 0ustar oleole#!/bin/sh # install - install a program, script, or datafile scriptversion=2003-09-24.23 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # 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 THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename= transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 -d DIR1 DIR2... In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. In the second, create the directory path DIR. Options: -b=TRANSFORMBASENAME -c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. -g GROUP $chgrp installed files to GROUP. -m MODE $chmod installed files to MODE. -o USER $chown installed files to USER. -s strip installed files (using $stripprog). -t=TRANSFORM --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; --version) echo "$0 $scriptversion"; exit 0;; *) if test -z "$src"; then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if test -z "$src"; then echo "$0: no input file specified." >&2 exit 1 fi # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then instcmd=: chmodcmd= else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst"; then echo "$0: no destination specified." >&2 exit 1 fi # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift test -d "$pathcomp" || $mkdirprog "$pathcomp" pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else # If we're going to rename the final executable, determine the name now. if test -z "$transformarg"; then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename \ | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename. test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now remove or move aside any old file at destination location. We # try this two ways since rm can't unlink itself on some systems and # the destination file might be busy for other reasons. In this case, # the final cleanup might fail but the new file should still install # successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: astropy-0.3/cextern/wcslib/config/config.guess0000755000175000017500000012675512243255342017737 0ustar oleole#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-10-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo hexagon-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: astropy-0.3/cextern/wcslib/config/config.sub0000755000175000017500000010503412243255342017365 0ustar oleole#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-09-09' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze) basic_machine=microblaze-xilinx ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: astropy-0.3/cextern/wcslib/config/elisp-comp0000755000175000017500000000405612243255342017402 0ustar oleole#!/bin/sh # Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc. # Franc,ois Pinard , 1995. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This script byte-compiles all `.el' files which are part of its # arguments, using GNU Emacs, and put the resulting `.elc' files into # the current directory, so disregarding the original directories used # in `.el' arguments. # # This script manages in such a way that all Emacs LISP files to # be compiled are made visible between themselves, in the event # they require or load-library one another. if test $# = 0; then echo 1>&2 "No files given to $0" exit 1 fi if test -z "$EMACS" || test "$EMACS" = "t"; then # Value of "t" means we are running in a shell under Emacs. # Just assume Emacs is called "emacs". EMACS=emacs fi tempdir=elc.$$ # Cleanup the temporary directory on exit. trap 'status=$?; rm -rf "$tempdir" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 mkdir $tempdir cp "$@" $tempdir ( cd $tempdir echo "(setq load-path (cons nil load-path))" > script $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $? mv *.elc .. ) || exit $? (exit 0); exit astropy-0.3/cextern/wcslib/wcsconfig.h.in0000644000175000017500000000122712243255342016674 0ustar oleole/*============================================================================ * * wcsconfig.h is generated from wcsconfig.h.in by 'configure'. It contains * C preprocessor macro definitions for compiling WCSLIB 4.19 * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig.h.in,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ *===========================================================================*/ /* WCSLIB library version number. */ #undef WCSLIB_VERSION /* Define to 1 if sincos() is available. */ #undef HAVE_SINCOS /* 64-bit integer data type. */ #undef WCSLIB_INT64 astropy-0.3/cextern/wcslib/GNUmakefile0000644000175000017500000001501112243255342016202 0ustar oleole#----------------------------------------------------------------------------- # GNU makefile for building WCSLIB 4.19 # # Summary of the main targets # --------------------------- # all: Do 'make all' in each subdirectory (excluding ./doxygen). # check: Do 'make check' in each subdirectory (compile and run tests). # tests: Do 'make tests' in each subdirectory (compile test programs but # don't run them). # install: Do 'make install' in each subdirectory. # clean: Recursively delete intermediate files produced as part of the # build, e.g. object modules, core dumps, etc. # cleaner: Recursively clean, and also delete test executables, test # input and output, and intermediates produced in compiling the # programmers' manual. # distclean (or realclean): Recursively delete all platform-dependent files # generated during the build, preserving only the programmers' # manual and man pages (which are normally provided pre-built). # It is the one to use between builds for multiple platforms. # cleanest: Like distclean, but deletes everything that can be regenerated # from the source files, including the programmers' manual and # man pages, but excluding 'configure'. # show: Print the values of important variables used in this and the # other makefiles. # writable: Run chmod recursively to make all sources writable. # # Notes: # 1) If you need to make changes then preferably modify makedefs.in instead. # # 2) Refer also to the makefiles in subdirectories, particularly # C/GNUmakefile. # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta # $Id: GNUmakefile,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ #----------------------------------------------------------------------------- # Get configure settings. include makedefs ifeq "$(CHECK)" "nopgplot" TSTDIRS := $(filter-out pgsbox,$(TSTDIRS)) endif .PHONY : build check chmod clean cleaner cleanest distclean install \ realclean show tests writable build : -@ for DIR in $(SUBDIRS) ; do \ echo '' ; \ $(TIMER) ; \ $(MAKE) -k -C $$DIR build ; \ done check tests :: show -@ echo '' -@ $(TIMER) @ for DIR in $(SUBDIRS) ; do \ echo '' ; \ $(MAKE) -i -C $$DIR cleaner ; \ done -@ echo '' @ for DIR in $(TSTDIRS) ; do \ echo '' ; \ $(TIMER) ; \ $(MAKE) -k -C $$DIR $@ ; \ done check :: -@ echo '' -@ echo 'Summary of results for non-graphical tests' -@ echo '------------------------------------------' -@ cat ./*/test_results @ if grep 'FAIL:' ./*/test_results > /dev/null ; then \ exit 1 ; \ else \ exit 0 ; \ fi install : @ for DIR in $(INSTDIR) ; do \ $(MAKE) -k -C $$DIR $@ ; \ done $(INSTALL) -m 444 wcsconfig.h wcsconfig_f77.h $(INCDIR) - if [ ! -d "$(DOCDIR)" ] ; then \ $(INSTALL) -d -m 2775 $(DOCDIR) ; \ fi $(INSTALL) -m 444 CHANGES COPYING* README $(DOCDIR) - if [ -h $(DOCLINK) ] ; then \ $(RM) $(DOCLINK) ; \ $(LN_S) $(notdir $(DOCDIR)) $(DOCLINK) ; \ fi - if [ ! -d "$(PDFDIR)" ] ; then \ $(INSTALL) -d -m 2775 $(PDFDIR) ; \ fi $(INSTALL) -m 444 wcslib.pdf $(PDFDIR) - if [ ! -d "$(HTMLDIR)/html" ] ; then \ $(INSTALL) -d -m 2775 $(HTMLDIR)/html ; \ fi $(INSTALL) -m 444 html/* $(HTMLDIR)/html if [ ! -d "$(LIBDIR)/pkgconfig" ] ; then \ $(INSTALL) -d -m 2775 $(LIBDIR)/pkgconfig ; \ fi $(INSTALL) -m 444 wcslib.pc $(LIBDIR)/pkgconfig/wcslib.pc clean cleaner : for DIR in $(SUBDIRS) doxygen ; do \ $(MAKE) -C $$DIR $@ ; \ done cleanest distclean realclean : for DIR in $(SUBDIRS) doxygen ; do \ $(MAKE) -C $$DIR $@ ; \ done - $(RM) *.log - $(RM) -r autom4te.cache autoscan.log - $(RM) -r api-sanity-check - $(RM) confdefs.h conftest.* - $(RM) config.log config.status configure.lineno - $(RM) makedefs wcslib.pc - $(RM) wcsconfig.h wcsconfig_*.h - $(RM) wcslib-*.tar.gz show :: -@ echo 'Subdirectories to be built...' -@ echo ' SUBDIRS := $(SUBDIRS)' -@ echo ' TSTDIRS := $(TSTDIRS)' -@ echo '' writable : chmod -R u+w . GNUmakefile : makedefs ; makedefs : makedefs.in config.status -@ echo '' -@ $(TIMER) ./config.status config.status : configure -@ echo '' -@ $(TIMER) -@ echo '' -@ echo "Environment variables that affect 'configure':" -@ echo " CC = $${CC-(undefined)}" -@ echo " CFLAGS = $${CFLAGS-(undefined)}" -@ echo " CPP = $${CPP-(undefined)}" -@ echo " CPPFLAGS = $${CPPFLAGS-(undefined)}" -@ echo " F77 = $${F77-(undefined)}" -@ echo " FFLAGS = $${FFLAGS-(undefined)}" -@ echo " LDFLAGS = $${LDFLAGS-(undefined)}" -@ echo '' ./configure --no-create #----------------------------------------------------------------------------- # These are for code management. .PHONY : dist dist : $(MAKE) -C doxygen cleanest build $(MAKE) -C utils man $(MAKE) distclean -@ echo $(WCSLIBPKG)/C/RCS > wcslib.X -@ echo $(WCSLIBPKG)/C/flexed/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/C/test/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/doxygen/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/Fortran/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/Fortran/test/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/makedefs >> wcslib.X -@ echo $(WCSLIBPKG)/other >> wcslib.X -@ echo $(WCSLIBPKG)/pgsbox/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/TODO >> wcslib.X -@ echo $(WCSLIBPKG)/utils/RCS >> wcslib.X -@ echo $(WCSLIBPKG)/wcslib.T >> wcslib.X -@ echo $(WCSLIBPKG)/wcslib.X >> wcslib.X rm -f $(WCSLIBPKG).tar.bz2 tar cf - -C .. -X wcslib.X $(WCSLIBPKG) | \ tar t | \ grep -v '/$$' | \ sort > wcslib.T rm -f wcslib.X tar cvf $(WCSLIBPKG).tar -C .. -T wcslib.T rm -f wcslib.T bzip2 $(WCSLIBPKG).tar chmod 444 $(WCSLIBPKG).tar.bz2 install_dist : scp -p $(WCSLIBPKG).tar.bz2 cal103@venice:/nfs/ftp/software/wcslib/ mv -f $(WCSLIBPKG).tar.bz2 ../wcslib-releases/ ssh cal103@venice "cd /nfs/ftp/software/wcslib/ && \ rm -f wcslib.tar.bz2 && \ ln -s $(WCSLIBPKG).tar.bz2 wcslib.tar.bz2" cp -fp CHANGES wcslib.pdf ~/public_html/WCS/ rsync --archive --delete html/ ~/public_html/WCS/wcslib/ configure : configure.ac -@ echo '' -@ $(TIMER) autoconf # Code development overrides must be included specifically before 'configure' # generates makedefs. -include flavours astropy-0.3/cextern/wcslib/makedefs.in0000644000175000017500000002034412243255342016244 0ustar oleole#----------------------------------------------------------------------------- # GNU makefile definitions for building WCSLIB 4.19 # # makedefs is generated from makedefs.in by configure. It contains variable # definitions and some general-purpose rules for building WCSLIB. # # Targets defined here # -------------------- # printenv: Print the environment as seen within makefile rules. # show: Print the values of all makefile variables used. # # Notes: # 1) If you need to make changes then it may be preferable to modify # makedefs.in (not makedefs). The makefile will detect this and # automatically re-run config.status to regenerate makedefs. # # 2) There are three choices for trigd functions - cosd(), sind(), tand(), # acosd(), asind(), atand(), and atan2d(), made by setting WCSTRIG: # # 1: Use the wrapper functions supplied with WCSLIB (default): # WCSTRIG := WRAPPER # # 2: Use native trigd functions supplied in a mathematics library such # as libsunmath (you will also need to add the library to the LIBS # variable below): # WCSTRIG := NATIVE # # 3: Use C preprocessor macro implementations of the trigd functions # (this method is typically 20% faster but may lead to rounding # errors near the poles): # WCSTRIG := MACRO # # 3) Variables for creating the shared (dynamic) library are currently # only set by 'configure' if the GNU C compiler is used. However, # you can set these variables by hand, preferably in makedefs.in. # # Shared libraries require position-independent code (PIC) which imposes # a performance overhead. Consequently the static libraries are # compiled separately without this option. # # The shared library will be installed with version number, e.g. as # libwcs.so.4.19 or libwcs.4.19.dylib with or without the symlink # required to make it visible to the linker (controlled by the SHRLN # variable). On Macs it is deliberately not created because its very # existence precludes static linking with the cctools linker. You can # still link dynamically by using -lwcs.4.19. # # 4) PGPLOT is Tim Pearson's Fortran graphics library with separate C # interface available from astro.caltech.edu. It is only required by # one utility, wcsgrid, and the test programs that plot test grids # (tprj2, tcel1, tcel2, tspc, ttab2, ttab3, twcsmix, and tpih2). You can # skip these by setting PGPLOTLIB to blank. # # It is difficult for configure to deduce what auxiliary graphics # libraries may be needed for PGPLOT since it depends on which of many # possible graphics drivers were selected when PGPLOT was installed. # Therefore it is quite likely that you will need to add additional # libraries to PGPLOTLIB. # # 5) CFITSIO is Bill Pence's FITS I/O library written in C with Fortran # wrappers, available from http://heasarc.gsfc.nasa.gov/fitsio. # # CFITSIO is required by three utilities, HPXcvt, wcsgrid, and wcsware, # and also by the test programs twcstab and twcshdr. wcsware and the # test programs use fits_read_wcstab() which is implemented by # getwcstab.c. However, this implementation is included in CFITSIO post # 3.004beta, so getwcstab.c is required here only for older releases # (controlled by variable GETWCSTAB). getwcstab.o itself is not inserted # into the WCSLIB object library. # # If available, CFITSIO is also optionally used for test programs # tfitshdr, tbth1, tpih1 and tpih2 by setting preprocessor macro # -DDO_CFITSIO. # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta # $Id: makedefs.in,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ #----------------------------------------------------------------------------- # Version. LIBVER := @LIBVER@ WCSLIBPKG := wcslib-@PACKAGE_VERSION@ # System architecture. ARCH := @ARCH@ # Flex and options. FLEX := @FLEX@ FLFLAGS := # C preprocessor and options. CPP := @CPP@ CPPFLAGS := @DEFS@ WCSTRIG := WRAPPER # C compiler and options. CC := @CC@ CFLAGS := @CFLAGS@ # Fortran compiler and options. FC := @F77@ FFLAGS := @FFLAGS@ # Static object library. WCSLIB := libwcs-$(LIBVER).a RANLIB := @RANLIB@ # Shared (dynamic) library (see note 3 above). SHRLIB := @SHRLIB@ SONAME := @SONAME@ SHRFLAGS := @SHRFLAGS@ SHRLD := @SHRLD@ SHRLN := @SHRLN@ # What subdirectories to build. SUBDIRS := @SUBDIRS@ TSTDIRS := @TSTDIRS@ # Top of the 'make install' hierarchy: pgsbox -> Fortran -> C. INSTDIR := @INSTDIR@ # Installation utilities and locations. LN_S := @LN_S@ INSTALL := @INSTALL@ # Needed for the definitions provided by autoconf. prefix := @prefix@ exec_prefix := @exec_prefix@ datarootdir := @datarootdir@ PACKAGE_TARNAME := @PACKAGE_TARNAME@ docdir := @docdir@ LIBDIR := $(DESTDIR)@libdir@ BINDIR := $(DESTDIR)@bindir@ INCDIR := $(DESTDIR)@includedir@/wcslib-$(LIBVER) INCLINK := $(DESTDIR)@includedir@/wcslib DOCDIR := $(DESTDIR)@docdir@ DOCLINK := $(dir $(DESTDIR)@docdir@)wcslib HTMLDIR := $(DESTDIR)@htmldir@ PDFDIR := $(DESTDIR)@pdfdir@ MANDIR := $(DESTDIR)@mandir@ # For putting timestamps in the build log. TIMER := date +"%a %Y/%m/%d %X %z, executing on $$HOST" # The remaining options are for building utilities and test programs. # ------------------------------------------------------------------- # Linker options (use CC for linking). LD = $(CC) LDFLAGS := @LDFLAGS@ # PGPLOT (see note 4 above). PGPLOTINC := @PGPLOTINC@ PGPLOTLIB := @PGPLOTLIB@ # CFITSIO (see note 5 above). CFITSIOINC := @CFITSIOINC@ CFITSIOLIB := @CFITSIOLIB@ GETWCSTAB := @GETWCSTAB@ # Libraries required by the above Fortran compiler. FLIBS := @FLIBS@ # Libraries required by WCSLIB itself. LIBS := @LIBS@ #----------------------------------------------------------------------------- # You shouldn't need to change anything below here. #----------------------------------------------------------------------------- SHELL := /bin/sh VPATH := .. # Common targets. .PHONY : all build printenv show all : show build # Print the environment as seen by makefile rules. printenv : -@ printenv | sort # Print variable definitions. show :: wcsconfig.h -@ echo '' -@ uname -a -@ echo '' -@ $(MAKE) --version | head -1 -@ echo ' MAKEFLAGS := $(MAKEFLAGS)' -@ echo '' -@ echo 'For building and installing $(WCSLIBPKG)...' -@ echo ' ARCH := $(ARCH)' -@ echo ' FLEX := $(FLEX)' -@ echo ' FLFLAGS := $(FLFLAGS)' -@ echo ' CPP := $(CPP)' -@ echo ' CPPFLAGS := $(CPPFLAGS)' -@ echo ' WCSTRIG := $(WCSTRIG)' -@ echo ' CC := $(CC)' -@ echo ' CFLAGS := $(CFLAGS)' -@ echo ' FC := $(FC)' -@ echo ' FFLAGS := $(FFLAGS)' -@ echo ' WCSLIB := $(WCSLIB)' -@ echo ' RANLIB := $(RANLIB)' -@ echo ' SHRLIB := $(SHRLIB)' -@ echo ' SONAME := $(SONAME)' -@ echo ' SHRFLAGS := $(SHRFLAGS)' -@ echo ' SHRLD := $(SHRLD)' -@ echo ' SHRLN := $(SHRLN)' -@ echo ' LN_S := $(LN_S)' -@ echo ' INSTALL := $(INSTALL)' -@ echo ' LIBDIR := $(LIBDIR)' -@ echo ' BINDIR := $(BINDIR)' -@ echo ' INCDIR := $(INCDIR)' -@ echo ' INCLINK := $(INCLINK)' -@ echo ' DOCDIR := $(DOCDIR)' -@ echo ' DOCLINK := $(DOCLINK)' -@ echo ' HTMLDIR := $(HTMLDIR)' -@ echo ' PDFDIR := $(PDFDIR)' -@ echo ' MANDIR := $(MANDIR)' -@ echo ' TIMER := $(TIMER)' -@ echo '' -@ echo 'Important wcsconfig.h defines...' -@ echo " `grep HAVE_SINCOS $<`" -@ echo " `grep WCSLIB_INT64 $<`" -@ echo '' -@ echo 'To build utilities and test programs...' -@ echo ' LD := $(LD)' -@ echo ' LDFLAGS := $(LDFLAGS)' -@ echo ' PGPLOTINC := $(PGPLOTINC)' -@ echo ' PGPLOTLIB := $(PGPLOTLIB)' -@ echo ' CFITSIOINC := $(CFITSIOINC)' -@ echo ' CFITSIOLIB := $(CFITSIOLIB)' -@ echo ' GETWCSTAB := $(GETWCSTAB)' -@ echo ' FLIBS := $(FLIBS)' -@ echo ' LIBS := $(LIBS)' -@ echo '' # Code development overrides, for use in the code subdirectories. -include ../flavours astropy-0.3/cextern/wcslib/INSTALL0000644000175000017500000003106012243255342015163 0ustar oleole------------------------------------------------------------------------------ WCSLIB 4.19 and PGSBOX 4.19 INSTALLATION -------------------------------------- WCSLIB requires an ANSI C compiler with standard ANSI C environment, that is, a standard C library and header files as defined in Appendix B of Kernigan & Ritchie, 2nd ed. Installation of WCSLIB is handled by GNU autoconf; GNU make (referred to here as 'gmake') must be used. The WCSLIB distribution also includes PGSBOX (refer to the README file), to unpack it type zcat wcslib-4.19.tar.gz | tar pvxf - cd wcslib-4.19 then if you do not need to specify any configuration options, simply run gmake This will run 'configure' to generate "makedefs" which is included by the top- level GNUmakefile and those in each subdirectory, and then build 'libwcs.a', which includes both the C library and Fortran wrappers, and also libpgsbox.a. (WARNING: The build may fail with gmake 3.79, upgrade to 3.79.1 or later.) configure tries to determine the location of the PGPLOT and CFITSIO libraries required by some programs in the test suite. If it fails to find them you can, if you wish, tailor the few variables found at the start of "makedefs". Of course you do not need to exercise the test suite in order to build and install the library - if configure fails to find anything required for that it will issue an explicit error message. To build and exercise the test suite use gmake check To install the object libraries and header files, do gmake install TWEAKING THE INSTALLATION DEFAULTS ---------------------------------- By default the library and header files are installed in the lib and include subdirectories of /usr/local/. To change this, or any other options, run configure separately before gmake: ./configure --prefix=/some/other/dir gmake Use ./configure --help to list configure's options. Useful options are --with-pgplotinc --with-pgplotlib --with-cfitsioinc --with-cfitsiolib Which allow additional directories to be added to the library and include file search path. Installation of WCSLIB differs a little from most packages in that all configurable makefile variables are defined in a single file, "makedefs", which configure generates from "makedefs.in". If you need to redefine any of the makefile variables you can modify makedefs, or preferably makedefs.in. The makefile will automatically detect this and re-run config.status to re-generate a new makedefs. configure also creates four header files: wcsconfig.h: Contains general purpose preprocessor definitions. It is included by the other wcsconfig header files. wcsconfig_f77.h: By common convention the WCSLIB Fortran wrappers have been written (in C) using function names in lower case with an underscore ("_") suffix. wcsconfig_f77.h defines a preprocessor macro, F77_FUNC(name,NAME), that may redefine these to suit different name mangling schemes used by some Fortran compilers. wcsconfig_tests.h: Contains C preprocessor definitions for compiling the test/demo programs. wcsconfig_utils.h: Contains C preprocessor macro definitions for compiling the utility programs provided with WCSLIB. If you do have trouble building the library please send me config.log. The INSTALL file provided with GNU autoconf 2.53 is appended without change. Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: INSTALL,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ ============================================================================== Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. astropy-0.3/cextern/wcslib/THANKS0000644000175000017500000000430712243255342015051 0ustar oleoleI would like to acknowledge the following people who have contributed to WCSLIB and/or PGSBOX in some way since 1995 - via bug reports, patches, suggestions for improvements, positive feedback, etc. James M. Anderson (MPIfR) Robbie Auld (Cardiff U.) Klaus Banse (ESO) David Barnes (ATNF/CSIRO) David Berry (STARLINK & JAC) Emmanuel Bertin (IAP) David Binderman Jeremy Brewer (U. Pittsburgh) Wim Brouw (ATNF/CSIRO) Peter Bunclark (IoA, U. Cambridge) Pan Chai (GSFC/NASA) Charles Copley Neil Crighton Cesar Enrique Garcia Dabo (ESO) Lindsey Davis (NOAO) Ger van Diepen (ASTRON) Patrick Dowler (CADC/NRC) Michael Droettboom (STScI) Rick Ebert (IPAC/NASA) Ken Ebisawa (GSFC/NASA) Sébastien Fabbro (Gentoo linux maintainer) Bob Garwood (NRAO) Brian Glendenning (NRAO) Eric Greisen (NRAO) Michael Halle (AM/Harvard) Booth Hartley (IPAC/NASA) Phil Hodge (STScI) Bryan Irby (GSFC/NASA) Justin Jonas (Rhodes U.) Yves Jung (ESO) David Kaplan (KITP/UCSB) Daniel S. Katz (JPL/NASA) Neil Killeen (ATNF/CSIRO) David King (NRAO) Paul F. Kunz (SLAC/Stanford U.) Jonas Møller Larsen (ESO) Paddy Leahy (U. Manchester) Jim Lewis (IoA, U. Cambridge) Marco Lombardi (ESO) Lars Kristian Lundin (ESO) Robert Lupton (Princeton U.) Craig Markwardt (GSFC/NASA) Malte Marquarding (ATNF/CSIRO) Tom Marsh (U. Warwick) Sean Mattingly (IPAC/NASA) Dave McConnell (ATNF/CSIRO) Thomas A. McGlynn (GSFC/NASA) Michelle Miller (NOAO) Jessica Mink (CfA) August Muench (CfA) Fergal Mullally (Princeton U.) Clive Page (U. Leicester) Sergio Pascual (U. Complutense de Madrid) Bill Pence (NASA/GSFC) Olivier Perdereau (LAL/IN2P3) Dirk Petry (ESO) Ray Plante (NCSA/UIUC) Paul Price (Princeton U.) Niruj Mohan Ramanujam (Leiden Obs) Harold Ravlin (U. Illinois) Thomas Robitaille (MPIA) Boud Roukema (TCfA) Keith A. Scollick (GSFC/NASA) Arno Schoenmakers (ASTRON) Hanno Spreeuw (ASTRON) Ole Streicher (Debian maintainer) Hans Terlouw (Kapteyn, Groningen) Peter Teuben (U. Maryland) Harro Verkouter (JIVE) John C. Vernaleo (GSFC/NASA) Martin Vogelaar (Kapteyn, Groningen) Stephen Walton (CSUN) Boyd Waters NRAO) Randall Wayth (Curtin U.) Matthew Whiting (ATNF/CSIRO) Peter Williams (UCB) Daren Scot Wilson (NRAO) Tony Wong (ATNF/CSIRO) $Id: THANKS,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ astropy-0.3/cextern/wcslib/README0000644000175000017500000000346712243255342015024 0ustar oleole------------------------------------------------------------------------------ WCSLIB 4.19 and PGSBOX 4.19 ------------------------------------------------------------------------------ WCSLIB 4.19 - an implementation of the FITS WCS standard. Copyright (C) 1995-2013, Mark Calabretta This file is part of WCSLIB. WCSLIB is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. WCSLIB is distributed in the hope that it 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 WCSLIB. If not, see http://www.gnu.org/licenses. Direct correspondence concerning WCSLIB to mark@calabretta.id.au Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta $Id: README,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ ------------------------------------------------------------------------------ Please refer to ./INSTALL ...Installation instructions. ./html/index.html ...The WCSLIB programmer's manual in HTML format. ./wcslib.pdf ...The WCSLIB programmer's manual in PDF format. ./CHANGES ...Log of changes made to WCSLIB. ./THANKS ...List of contributors to WCSLIB. ./VALIDATION ...List of platforms on which the installation procedures and test suite were exercised. ./COPYING ...A copy of the GNU General Public License, v3.0. ./COPYING.LESSER ...A copy of the Lesser GNU General Public License. astropy-0.3/cextern/wcslib/COPYING0000644000175000017500000010451312243255342015171 0ustar oleole GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . astropy-0.3/cextern/wcslib/COPYING.LESSER0000644000175000017500000001672512243255342016174 0ustar oleole GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. astropy-0.3/cextern/wcslib/wcsconfig_utils.h.in0000644000175000017500000000250012243255342020107 0ustar oleole/*============================================================================ * * wcsconfig_utils.h is generated from wcsconfig_utils.h.in by 'configure'. * It contains C preprocessor macro definitions for compiling the WCSLIB 4.19 * utilities. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig_utils.h.in,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ *===========================================================================*/ #include /* Definitions for Large File Support (LFS), i.e. files larger than 2GiB, for * the fitshdr utility. */ /* Define to 1 if fseeko() is available (for small or large files). */ #undef HAVE_FSEEKO /* Define _LARGEFILE_SOURCE to get prototypes from stdio.h for the LFS * functions fseeko() and ftello() which use an off_t argument in place of a * long. */ #undef _LARGEFILE_SOURCE /* There seems to be a bug in autoconf that causes _LARGEFILE_SOURCE not to be * set in Linux. This dreadful kludge gets around it for now. */ #if (defined HAVE_FSEEKO && !defined _LARGEFILE_SOURCE) #define _LARGEFILE_SOURCE #endif /* Number of bits in a file offset (off_t) on systems where it can be set. */ #undef _FILE_OFFSET_BITS /* Define for large files needed on AIX-type systems. */ #undef _LARGE_FILES astropy-0.3/cextern/wcslib/wcsconfig_f77.h.in0000644000175000017500000000207412243255342017360 0ustar oleole/*============================================================================ * * wcsconfig_f77.h is generated from wcsconfig_f77.h.in by 'configure'. It * contains C preprocessor definitions for building the WCSLIB 4.19 Fortran * wrappers. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta * $Id: wcsconfig_f77.h.in,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ *===========================================================================*/ /* Integer array type large enough to hold an address. Set here to int[2] for * 64-bit addresses, but could be defined as int* on 32-bit machines. */ typedef int iptr[2]; /* Macro for mangling Fortran subroutine names that do not contain * underscores. Typically a name like "WCSINI" (case-insensitive) will become * something like "wcsini_" (case-sensitive). The Fortran wrappers, which are * written in C, are preprocessed into names that match the latter. The macro * takes two arguments which specify the name in lower and upper case. */ #undef F77_FUNC astropy-0.3/cextern/wcslib/flavours0000644000175000017500000001137012243255342015720 0ustar oleole#----------------------------------------------------------------------------- # Makefile overrides for various combinations of architecture, operating # system and compiler. Used for development and testing only, not required # for building WCSLIB. # # Variables like CC and CFLAGS are exported into the environment so that they # will be seen by 'configure'. Thus, normal usage is as follows: # # make distclean # make FLAVOUR=Linux configure # make # # Reminder: add '-d' to FLFLAGS for debugging. # # $Id: flavours,v 4.19 2013/09/29 14:17:53 mcalabre Exp $ #----------------------------------------------------------------------------- # The list of FLAVOURs can be set on the command line. F := $(shell echo $(FLAVOURS) | tr a-z A-Z) ifeq "$F" "" F := FLAVOURS := "" endif ifeq "$F" "LINUX" override FLAVOURS := "" Linux Linuxp endif ifeq "$F" "SUN" override FLAVOURS := "" SUN/GNU SUN/GNU3 SUN/GNUp SUN/ANSI endif ifeq "$F" "PURE" override FLAVOURS := SUN/Pure SUN/Quant endif F := # Various C standards handled by features.h in Linux. FEATURES := ifeq "$(notdir $(shell pwd))" "utils" # To get off_t for fseeko() usage in fitshdr when gcc is invoked with the # -std=c89 (same as -ansi) or the -std=c99 options. FEATURES := -D_XOPEN_SOURCE endif # Linux with gcc/gfortran (also works for Darwin). ifeq "$(FLAVOUR)" "Linux" F := $(FLAVOUR) export CC := gcc -std=c89 -pedantic export CPPFLAGS := $(FEATURES) export CFLAGS := -g -O0 -Wall -Wpadded -Wno-long-long export FFLAGS := -g -O0 -fimplicit-none -Wall -I. VALGRIND := valgrind -v --leak-check=yes endif ifeq "$(FLAVOUR)" "Linuxp" F := $(FLAVOUR) export CC := gcc -std=c89 -pedantic export CPPFLAGS := $(FEATURES) export CFLAGS := -pg -g -O -Wall -Wpadded -Wno-long-long export FFLAGS := -pg -a -g -O -fimplicit-none -Wall -I. export LDFLAGS := -pg -g $(filter -L%, $(LDFLAGS)) override EXTRA_CLEAN := gmon.out bb.out endif # Solaris with gcc/gfortran 4.x (lynx). ifeq "$(FLAVOUR)" "SUN/GNU" F := $(FLAVOUR) export CC := gcc -std=c89 export CPPFLAGS := $(FEATURES) export CFLAGS := -g -Wall -Wpadded -Wno-long-long export F77 := gfortran export FFLAGS := -g -fimplicit-none -Wall -I. LD := gcc endif ifeq "$(FLAVOUR)" "SUN/GNU3" F := $(FLAVOUR) export CC := gcc-3.1.1 -std=c89 export CPPFLAGS := $(FEATURES) export CFLAGS := -g -Wall -Wpadded -Wno-long-long export F77 := g77-3.1.1 export FFLAGS := -g -Wimplicit -Wunused -Wno-globals -I. LD := gcc-3.1.1 endif ifeq "$(FLAVOUR)" "SUN/GNUp" F := $(FLAVOUR) export CC := gcc -std=c89 -pedantic export CPPFLAGS := $(FEATURES) export CFLAGS := -pg -a -g -O -Wall -Wpadded -Wno-long-long export FFLAGS := -pg -a -g -O -fimplicit-none -Wall -I. export LDFLAGS := -pg -a -g $(filter -L%, $(LDFLAGS)) override EXTRA_CLEAN := gmon.out bb.out endif # Solaris with SUN cc/f77. ifeq "$(FLAVOUR)" "SUN/ANSI" F := $(FLAVOUR) WCSTRIG := NATIVE export CC := cc export CFLAGS := -g -I/usr/local/include export F77 := f77 export FFLAGS := -g -erroff=WDECL_LOCAL_NOTUSED LD := f77 endif # Purify and quantify in Solaris. ifeq "$(FLAVOUR)" "SUN/Pure" F := $(FLAVOUR) WCSTRIG := NATIVE export CC := purify gcc export CFLAGS := -g export F77 := purify gcc export FFLAGS := -g -Wimplicit -Wno-globals -I. export LDFLAGS := $(filter -L%, $(LDFLAGS)) override EXTRA_CLEAN := *_pure_p*.[ao] *.pcv .pure ../C/*_pure_p*.[ao] endif ifeq "$(FLAVOUR)" "SUN/Quant" F := $(FLAVOUR) WCSTRIG := NATIVE export CC := quantify gcc export CFLAGS := -g export F77 := quantify gcc export FFLAGS := -g -Wimplicit -Wno-globals -I. export LDFLAGS := $(filter -L%, $(LDFLAGS)) override EXTRA_CLEAN := *_pure_q*.[ao] .pure endif ifneq "$F" "$(FLAVOUR)" override FLAVOUR := unrecognised endif # gmake uses FC in place of configure's F77. ifdef F77 FC := $(F77) endif ifndef TIMER TIMER := date +"%a %Y/%m/%d %X %z, executing on $$HOST" endif ifdef FLAVOUR TIMER := $(TIMER) ; echo " with $(FLAVOUR) FLAVOUR." endif # Experimental (see http://upstream-tracker.org/versions/wcslib.html). api-sanity-check : -@ $(RM) -r $@/ @ mkdir $@/ @ cp C/*.h C/$(SHRLIB) $@/ @ echo "$(LIBVER)" > $@/opts.xml @ echo "." >> $@/opts.xml @ echo "." >> $@/opts.xml @ echo "-Dwtbarr=wtbarr_s" >> $@/opts.xml cd $@ && api-sanity-checker -lib WCSLIB -d opts.xml \ -show-retval -gen -build -run show :: -@ echo 'For code development...' -@ echo ' FLAVOURS := $(FLAVOURS)' -@ echo ' FLAVOUR := $(FLAVOUR)' -@ echo ' VALGRIND := $(VALGRIND)' -@ echo ' EXTRA_CLEAN := $(EXTRA_CLEAN)' -@ echo '' astropy-0.3/cextern/erfa/0000755000175000017500000000000012243263747013574 5ustar oleoleastropy-0.3/cextern/erfa/erfa.c0000644000175000017500000336734012243255342014665 0ustar oleole#include "erfa.h" #include #include #include void eraA2af(int ndp, double angle, char *sign, int idmsf[4]) /* ** - - - - - - - - ** e r a A 2 a f ** - - - - - - - - ** ** Decompose radians into degrees, arcminutes, arcseconds, fraction. ** ** Given: ** ndp int resolution (Note 1) ** angle double angle in radians ** ** Returned: ** sign char '+' or '-' ** idmsf int[4] degrees, arcminutes, arcseconds, fraction ** ** Called: ** eraD2tf decompose days to hms ** ** Notes: ** ** 1) The argument ndp is interpreted as follows: ** ** ndp resolution ** : ...0000 00 00 ** -7 1000 00 00 ** -6 100 00 00 ** -5 10 00 00 ** -4 1 00 00 ** -3 0 10 00 ** -2 0 01 00 ** -1 0 00 10 ** 0 0 00 01 ** 1 0 00 00.1 ** 2 0 00 00.01 ** 3 0 00 00.001 ** : 0 00 00.000... ** ** 2) The largest positive useful value for ndp is determined by the ** size of angle, the format of doubles on the target platform, and ** the risk of overflowing idmsf[3]. On a typical platform, for ** angle up to 2pi, the available floating-point precision might ** correspond to ndp=12. However, the practical limit is typically ** ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is ** only 16 bits. ** ** 3) The absolute value of angle may exceed 2pi. In cases where it ** does not, it is up to the caller to test for and handle the ** case where angle is very nearly 2pi and rounds up to 360 degrees, ** by testing for idmsf[0]=360 and setting idmsf[0-3] to zero. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Hours to degrees * radians to turns */ const double F = 15.0 / ERFA_D2PI; /* Scale then use days to h,m,s function. */ eraD2tf(ndp, angle*F, sign, idmsf); return; } void eraA2tf(int ndp, double angle, char *sign, int ihmsf[4]) /* ** - - - - - - - - ** e r a A 2 t f ** - - - - - - - - ** ** Decompose radians into hours, minutes, seconds, fraction. ** ** Given: ** ndp int resolution (Note 1) ** angle double angle in radians ** ** Returned: ** sign char '+' or '-' ** ihmsf int[4] hours, minutes, seconds, fraction ** ** Called: ** eraD2tf decompose days to hms ** ** Notes: ** ** 1) The argument ndp is interpreted as follows: ** ** ndp resolution ** : ...0000 00 00 ** -7 1000 00 00 ** -6 100 00 00 ** -5 10 00 00 ** -4 1 00 00 ** -3 0 10 00 ** -2 0 01 00 ** -1 0 00 10 ** 0 0 00 01 ** 1 0 00 00.1 ** 2 0 00 00.01 ** 3 0 00 00.001 ** : 0 00 00.000... ** ** 2) The largest positive useful value for ndp is determined by the ** size of angle, the format of doubles on the target platform, and ** the risk of overflowing ihmsf[3]. On a typical platform, for ** angle up to 2pi, the available floating-point precision might ** correspond to ndp=12. However, the practical limit is typically ** ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is ** only 16 bits. ** ** 3) The absolute value of angle may exceed 2pi. In cases where it ** does not, it is up to the caller to test for and handle the ** case where angle is very nearly 2pi and rounds up to 24 hours, ** by testing for ihmsf[0]=24 and setting ihmsf(0-3) to zero. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Scale then use days to h,m,s function. */ eraD2tf(ndp, angle/ERFA_D2PI, sign, ihmsf); return; } int eraAf2a(char s, int ideg, int iamin, double asec, double *rad) /* ** - - - - - - - - ** e r a A f 2 a ** - - - - - - - - ** ** Convert degrees, arcminutes, arcseconds to radians. ** ** Given: ** s char sign: '-' = negative, otherwise positive ** ideg int degrees ** iamin int arcminutes ** asec double arcseconds ** ** Returned: ** rad double angle in radians ** ** Returned (function value): ** int status: 0 = OK ** 1 = ideg outside range 0-359 ** 2 = iamin outside range 0-59 ** 3 = asec outside range 0-59.999... ** ** Notes: ** ** 1) The result is computed even if any of the range checks fail. ** ** 2) Negative ideg, iamin and/or asec produce a warning status, but ** the absolute value is used in the conversion. ** ** 3) If there are multiple errors, the status value reflects only the ** first, the smallest taking precedence. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Compute the interval. */ *rad = ( s == '-' ? -1.0 : 1.0 ) * ( 60.0 * ( 60.0 * ( (double) abs(ideg) ) + ( (double) abs(iamin) ) ) + fabs(asec) ) * ERFA_DAS2R; /* Validate arguments and return status. */ if ( ideg < 0 || ideg > 359 ) return 1; if ( iamin < 0 || iamin > 59 ) return 2; if ( asec < 0.0 || asec >= 60.0 ) return 3; return 0; } double eraAnp(double a) /* ** - - - - - - - ** e r a A n p ** - - - - - - - ** ** Normalize angle into the range 0 <= a < 2pi. ** ** Given: ** a double angle (radians) ** ** Returned (function value): ** double angle in range 0-2pi ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w; w = fmod(a, ERFA_D2PI); if (w < 0) w += ERFA_D2PI; return w; } double eraAnpm(double a) /* ** - - - - - - - - ** e r a A n p m ** - - - - - - - - ** ** Normalize angle into the range -pi <= a < +pi. ** ** Given: ** a double angle (radians) ** ** Returned (function value): ** double angle in range +/-pi ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w; w = fmod(a, ERFA_D2PI); if (fabs(w) >= ERFA_DPI) w -= ERFA_DSIGN(ERFA_D2PI, a); return w; } void eraBi00(double *dpsibi, double *depsbi, double *dra) /* ** - - - - - - - - ** e r a B i 0 0 ** - - - - - - - - ** ** Frame bias components of IAU 2000 precession-nutation models (part ** of MHB2000 with additions). ** ** Returned: ** dpsibi,depsbi double longitude and obliquity corrections ** dra double the ICRS RA of the J2000.0 mean equinox ** ** Notes: ** ** 1) The frame bias corrections in longitude and obliquity (radians) ** are required in order to correct for the offset between the GCRS ** pole and the mean J2000.0 pole. They define, with respect to the ** GCRS frame, a J2000.0 mean pole that is consistent with the rest ** of the IAU 2000A precession-nutation model. ** ** 2) In addition to the displacement of the pole, the complete ** description of the frame bias requires also an offset in right ** ascension. This is not part of the IAU 2000A model, and is from ** Chapront et al. (2002). It is returned in radians. ** ** 3) This is a supplemented implementation of one aspect of the IAU ** 2000A nutation model, formally adopted by the IAU General ** Assembly in 2000, namely MHB2000 (Mathews et al. 2002). ** ** References: ** ** Chapront, J., Chapront-Touze, M. & Francou, G., Astron. ** Astrophys., 387, 700, 2002. ** ** Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation ** and precession New nutation series for nonrigid Earth and ** insights into the Earth's interior", J.Geophys.Res., 107, B4, ** 2002. The MHB2000 code itself was obtained on 9th September 2002 ** from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* The frame bias corrections in longitude and obliquity */ const double DPBIAS = -0.041775 * ERFA_DAS2R, DEBIAS = -0.0068192 * ERFA_DAS2R; /* The ICRS RA of the J2000.0 equinox (Chapront et al., 2002) */ const double DRA0 = -0.0146 * ERFA_DAS2R; /* Return the results (which are fixed). */ *dpsibi = DPBIAS; *depsbi = DEBIAS; *dra = DRA0; return; } void eraBp00(double date1, double date2, double rb[3][3], double rp[3][3], double rbp[3][3]) /* ** - - - - - - - - ** e r a B p 0 0 ** - - - - - - - - ** ** Frame bias and precession, IAU 2000. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rb double[3][3] frame bias matrix (Note 2) ** rp double[3][3] precession matrix (Note 3) ** rbp double[3][3] bias-precession matrix (Note 4) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rb transforms vectors from GCRS to mean J2000.0 by ** applying frame bias. ** ** 3) The matrix rp transforms vectors from J2000.0 mean equator and ** equinox to mean equator and equinox of date by applying ** precession. ** ** 4) The matrix rbp transforms vectors from GCRS to mean equator and ** equinox of date by applying frame bias then precession. It is ** the product rp x rb. ** ** 5) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the order given. ** ** Called: ** eraBi00 frame bias components, IAU 2000 ** eraPr00 IAU 2000 precession adjustments ** eraIr initialize r-matrix to identity ** eraRx rotate around X-axis ** eraRy rotate around Y-axis ** eraRz rotate around Z-axis ** eraCr copy r-matrix ** eraRxr product of two r-matrices ** ** Reference: ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* J2000.0 obliquity (Lieske et al. 1977) */ const double EPS0 = 84381.448 * ERFA_DAS2R; double t, dpsibi, depsbi; double dra0, psia77, oma77, chia, dpsipr, depspr, psia, oma, rbw[3][3]; /* Interval between fundamental epoch J2000.0 and current date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Frame bias. */ eraBi00(&dpsibi, &depsbi, &dra0); /* Precession angles (Lieske et al. 1977) */ psia77 = (5038.7784 + (-1.07259 + (-0.001147) * t) * t) * t * ERFA_DAS2R; oma77 = EPS0 + ((0.05127 + (-0.007726) * t) * t) * t * ERFA_DAS2R; chia = ( 10.5526 + (-2.38064 + (-0.001125) * t) * t) * t * ERFA_DAS2R; /* Apply IAU 2000 precession corrections. */ eraPr00(date1, date2, &dpsipr, &depspr); psia = psia77 + dpsipr; oma = oma77 + depspr; /* Frame bias matrix: GCRS to J2000.0. */ eraIr(rbw); eraRz(dra0, rbw); eraRy(dpsibi * sin(EPS0), rbw); eraRx(-depsbi, rbw); eraCr(rbw, rb); /* Precession matrix: J2000.0 to mean of date. */ eraIr(rp); eraRx(EPS0, rp); eraRz(-psia, rp); eraRx(-oma, rp); eraRz(chia, rp); /* Bias-precession matrix: GCRS to mean of date. */ eraRxr(rp, rbw, rbp); return; } void eraBp06(double date1, double date2, double rb[3][3], double rp[3][3], double rbp[3][3]) /* ** - - - - - - - - ** e r a B p 0 6 ** - - - - - - - - ** ** Frame bias and precession, IAU 2006. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rb double[3][3] frame bias matrix (Note 2) ** rp double[3][3] precession matrix (Note 3) ** rbp double[3][3] bias-precession matrix (Note 4) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rb transforms vectors from GCRS to mean J2000.0 by ** applying frame bias. ** ** 3) The matrix rp transforms vectors from mean J2000.0 to mean of ** date by applying precession. ** ** 4) The matrix rbp transforms vectors from GCRS to mean of date by ** applying frame bias then precession. It is the product rp x rb. ** ** Called: ** eraPfw06 bias-precession F-W angles, IAU 2006 ** eraFw2m F-W angles to r-matrix ** eraPmat06 PB matrix, IAU 2006 ** eraTr transpose r-matrix ** eraRxr product of two r-matrices ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gamb, phib, psib, epsa, rbt[3][3]; /* B matrix. */ eraPfw06(ERFA_DJM0, ERFA_DJM00, &gamb, &phib, &psib, &epsa); eraFw2m(gamb, phib, psib, epsa, rb); /* PxB matrix. */ eraPmat06(date1, date2, rbp); /* P matrix. */ eraTr(rb, rbt); eraRxr(rbp, rbt, rp); return; } void eraBpn2xy(double rbpn[3][3], double *x, double *y) /* ** - - - - - - - - - - ** e r a B p n 2 x y ** - - - - - - - - - - ** ** Extract from the bias-precession-nutation matrix the X,Y coordinates ** of the Celestial Intermediate Pole. ** ** Given: ** rbpn double[3][3] celestial-to-true matrix (Note 1) ** ** Returned: ** x,y double Celestial Intermediate Pole (Note 2) ** ** Notes: ** ** 1) The matrix rbpn transforms vectors from GCRS to true equator (and ** CIO or equinox) of date, and therefore the Celestial Intermediate ** Pole unit vector is the bottom row of the matrix. ** ** 2) The arguments x,y are components of the Celestial Intermediate ** Pole unit vector in the Geocentric Celestial Reference System. ** ** Reference: ** ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 ** (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Extract the X,Y coordinates. */ *x = rbpn[2][0]; *y = rbpn[2][1]; return; } void eraC2i00a(double date1, double date2, double rc2i[3][3]) /* ** - - - - - - - - - - ** e r a C 2 i 0 0 a ** - - - - - - - - - - ** ** Form the celestial-to-intermediate matrix for a given date using the ** IAU 2000A precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** 3) A faster, but slightly less accurate result (about 1 mas), can be ** obtained by using instead the eraC2i00b function. ** ** Called: ** eraPnm00a classical NPB matrix, IAU 2000A ** eraC2ibpn celestial-to-intermediate matrix, given NPB matrix ** ** References: ** ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 ** (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3]; /* Obtain the celestial-to-true matrix (IAU 2000A). */ eraPnm00a(date1, date2, rbpn); /* Form the celestial-to-intermediate matrix. */ eraC2ibpn(date1, date2, rbpn, rc2i); return; } void eraC2i00b(double date1, double date2, double rc2i[3][3]) /* ** - - - - - - - - - - ** e r a C 2 i 0 0 b ** - - - - - - - - - - ** ** Form the celestial-to-intermediate matrix for a given date using the ** IAU 2000B precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** 3) The present function is faster, but slightly less accurate (about ** 1 mas), than the eraC2i00a function. ** ** Called: ** eraPnm00b classical NPB matrix, IAU 2000B ** eraC2ibpn celestial-to-intermediate matrix, given NPB matrix ** ** References: ** ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 ** (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3]; /* Obtain the celestial-to-true matrix (IAU 2000B). */ eraPnm00b(date1, date2, rbpn); /* Form the celestial-to-intermediate matrix. */ eraC2ibpn(date1, date2, rbpn, rc2i); return; } void eraC2i06a(double date1, double date2, double rc2i[3][3]) /* ** - - - - - - - - - - ** e r a _ c 2 i 0 6 a ** - - - - - - - - - - ** ** Form the celestial-to-intermediate matrix for a given date using the ** IAU 2006 precession and IAU 2000A nutation models. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = RC2T * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** Called: ** eraPnm06a classical NPB matrix, IAU 2006/2000A ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS06 the CIO locator s, Given X,Y, IAU 2006 ** eraC2ixys celestial-to-intermediate matrix, Given X,Y and s ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3], x, y, s; /* Obtain the celestial-to-true matrix (IAU 2006/2000A). */ eraPnm06a(date1, date2, rbpn); /* Extract the X,Y coordinates. */ eraBpn2xy(rbpn, &x, &y); /* Obtain the CIO locator. */ s = eraS06(date1, date2, x, y); /* Form the celestial-to-intermediate matrix. */ eraC2ixys(x, y, s, rc2i); return; } void eraC2ibpn(double date1, double date2, double rbpn[3][3], double rc2i[3][3]) /* ** - - - - - - - - - - ** e r a C 2 i b p n ** - - - - - - - - - - ** ** Form the celestial-to-intermediate matrix for a given date given ** the bias-precession-nutation matrix. IAU 2000. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** rbpn double[3][3] celestial-to-true matrix (Note 2) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 3) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix rbpn transforms vectors from GCRS to true equator (and ** CIO or equinox) of date. Only the CIP (bottom row) is used. ** ** 3) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = RC2T * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** 4) Although its name does not include "00", This function is in fact ** specific to the IAU 2000 models. ** ** Called: ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraC2ixy celestial-to-intermediate matrix, given X,Y ** ** References: ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y; /* Extract the X,Y coordinates. */ eraBpn2xy(rbpn, &x, &y); /* Form the celestial-to-intermediate matrix (n.b. IAU 2000 specific). */ eraC2ixy(date1, date2, x, y, rc2i); return; } void eraC2ixy(double date1, double date2, double x, double y, double rc2i[3][3]) /* ** - - - - - - - - - ** e r a C 2 i x y ** - - - - - - - - - ** ** Form the celestial to intermediate-frame-of-date matrix for a given ** date when the CIP X,Y coordinates are known. IAU 2000. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** x,y double Celestial Intermediate Pole (Note 2) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 3) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The Celestial Intermediate Pole coordinates are the x,y components ** of the unit vector in the Geocentric Celestial Reference System. ** ** 3) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = RC2T * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** 4) Although its name does not include "00", This function is in fact ** specific to the IAU 2000 models. ** ** Called: ** eraC2ixys celestial-to-intermediate matrix, given X,Y and s ** eraS00 the CIO locator s, given X,Y, IAU 2000A ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Compute s and then the matrix. */ eraC2ixys(x, y, eraS00(date1, date2, x, y), rc2i); return; } void eraC2ixys(double x, double y, double s, double rc2i[3][3]) /* ** - - - - - - - - - - ** e r a C 2 i x y s ** - - - - - - - - - - ** ** Form the celestial to intermediate-frame-of-date matrix given the CIP ** X,Y and the CIO locator s. ** ** Given: ** x,y double Celestial Intermediate Pole (Note 1) ** s double the CIO locator s (Note 2) ** ** Returned: ** rc2i double[3][3] celestial-to-intermediate matrix (Note 3) ** ** Notes: ** ** 1) The Celestial Intermediate Pole coordinates are the x,y ** components of the unit vector in the Geocentric Celestial ** Reference System. ** ** 2) The CIO locator s (in radians) positions the Celestial ** Intermediate Origin on the equator of the CIP. ** ** 3) The matrix rc2i is the first stage in the transformation from ** celestial to terrestrial coordinates: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = RC2T * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** Called: ** eraIr initialize r-matrix to identity ** eraRz rotate around Z-axis ** eraRy rotate around Y-axis ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r2, e, d; /* Obtain the spherical angles E and d. */ r2 = x*x + y*y; e = (r2 != 0.0) ? atan2(y, x) : 0.0; d = atan(sqrt(r2 / (1.0 - r2))); /* Form the matrix. */ eraIr(rc2i); eraRz(e, rc2i); eraRy(d, rc2i); eraRz(-(e+s), rc2i); return; } void eraC2s(double p[3], double *theta, double *phi) /* ** - - - - - - - ** e r a C 2 s ** - - - - - - - ** ** P-vector to spherical coordinates. ** ** Given: ** p double[3] p-vector ** ** Returned: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** ** Notes: ** ** 1) The vector p can have any magnitude; only its direction is used. ** ** 2) If p is null, zero theta and phi are returned. ** ** 3) At either pole, zero theta is returned. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y, z, d2; x = p[0]; y = p[1]; z = p[2]; d2 = x*x + y*y; *theta = (d2 == 0.0) ? 0.0 : atan2(y, x); *phi = (z == 0.0) ? 0.0 : atan2(z, sqrt(d2)); return; } void eraC2t00a(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]) /* ** - - - - - - - - - - ** e r a C 2 t 0 0 a ** - - - - - - - - - - ** ** Form the celestial to terrestrial matrix given the date, the UT1 and ** the polar motion, using the IAU 2000A nutation model. ** ** Given: ** tta,ttb double TT as a 2-part Julian Date (Note 1) ** uta,utb double UT1 as a 2-part Julian Date (Note 1) ** xp,yp double coordinates of the pole (radians, Note 2) ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 3) ** ** Notes: ** ** 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, ** apportioned in any convenient way between the arguments uta and ** utb. For example, JD(UT1)=2450123.7 could be expressed in any of ** these ways, among others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. In the case of uta,utb, the ** date & time method is best matched to the Earth rotation angle ** algorithm used: maximum precision is delivered when the uta ** argument is for 0hrs UT1 on the day in question and the utb ** argument lies in the range 0 to 1, or vice versa. ** ** 2) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 3) The matrix rc2t transforms from celestial to terrestrial ** coordinates: ** ** [TRS] = RPOM * R_3(ERA) * RC2I * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), RC2I is the ** celestial-to-intermediate matrix, ERA is the Earth rotation ** angle and RPOM is the polar motion matrix. ** ** 4) A faster, but slightly less accurate result (about 1 mas), can ** be obtained by using instead the eraC2t00b function. ** ** Called: ** eraC2i00a celestial-to-intermediate matrix, IAU 2000A ** eraEra00 Earth rotation angle, IAU 2000 ** eraSp00 the TIO locator s', IERS 2000 ** eraPom00 polar motion matrix ** eraC2tcio form CIO-based celestial-to-terrestrial matrix ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rc2i[3][3], era, sp, rpom[3][3]; /* Form the celestial-to-intermediate matrix for this TT (IAU 2000A). */ eraC2i00a(tta, ttb, rc2i ); /* Predict the Earth rotation angle for this UT1. */ era = eraEra00(uta, utb); /* Estimate s'. */ sp = eraSp00(tta, ttb); /* Form the polar motion matrix. */ eraPom00(xp, yp, sp, rpom); /* Combine to form the celestial-to-terrestrial matrix. */ eraC2tcio(rc2i, era, rpom, rc2t); return; } void eraC2t00b(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]) /* ** - - - - - - - - - - ** e r a C 2 t 0 0 b ** - - - - - - - - - - ** ** Form the celestial to terrestrial matrix given the date, the UT1 and ** the polar motion, using the IAU 2000B nutation model. ** ** Given: ** tta,ttb double TT as a 2-part Julian Date (Note 1) ** uta,utb double UT1 as a 2-part Julian Date (Note 1) ** xp,yp double coordinates of the pole (radians, Note 2) ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 3) ** ** Notes: ** ** 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, ** apportioned in any convenient way between the arguments uta and ** utb. For example, JD(UT1)=2450123.7 could be expressed in any of ** these ways, among others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. In the case of uta,utb, the ** date & time method is best matched to the Earth rotation angle ** algorithm used: maximum precision is delivered when the uta ** argument is for 0hrs UT1 on the day in question and the utb ** argument lies in the range 0 to 1, or vice versa. ** ** 2) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 3) The matrix rc2t transforms from celestial to terrestrial ** coordinates: ** ** [TRS] = RPOM * R_3(ERA) * RC2I * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), RC2I is the ** celestial-to-intermediate matrix, ERA is the Earth rotation ** angle and RPOM is the polar motion matrix. ** ** 4) The present function is faster, but slightly less accurate (about ** 1 mas), than the eraC2t00a function. ** ** Called: ** eraC2i00b celestial-to-intermediate matrix, IAU 2000B ** eraEra00 Earth rotation angle, IAU 2000 ** eraPom00 polar motion matrix ** eraC2tcio form CIO-based celestial-to-terrestrial matrix ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rc2i[3][3], era, rpom[3][3]; /* Form the celestial-to-intermediate matrix for this TT (IAU 2000B). */ eraC2i00b(tta, ttb, rc2i); /* Predict the Earth rotation angle for this UT1. */ era = eraEra00(uta, utb); /* Form the polar motion matrix (neglecting s'). */ eraPom00(xp, yp, 0.0, rpom); /* Combine to form the celestial-to-terrestrial matrix. */ eraC2tcio(rc2i, era, rpom, rc2t); return; } void eraC2t06a(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]) /* ** - - - - - - - - - - ** e r a C 2 t 0 6 a ** - - - - - - - - - - ** ** Form the celestial to terrestrial matrix given the date, the UT1 and ** the polar motion, using the IAU 2006 precession and IAU 2000A ** nutation models. ** ** Given: ** tta,ttb double TT as a 2-part Julian Date (Note 1) ** uta,utb double UT1 as a 2-part Julian Date (Note 1) ** xp,yp double coordinates of the pole (radians, Note 2) ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 3) ** ** Notes: ** ** 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, ** apportioned in any convenient way between the arguments uta and ** utb. For example, JD(UT1)=2450123.7 could be expressed in any of ** these ways, among others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. In the case of uta,utb, the ** date & time method is best matched to the Earth rotation angle ** algorithm used: maximum precision is delivered when the uta ** argument is for 0hrs UT1 on the day in question and the utb ** argument lies in the range 0 to 1, or vice versa. ** ** 2) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 3) The matrix rc2t transforms from celestial to terrestrial ** coordinates: ** ** [TRS] = RPOM * R_3(ERA) * RC2I * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), RC2I is the ** celestial-to-intermediate matrix, ERA is the Earth rotation ** angle and RPOM is the polar motion matrix. ** ** Called: ** eraC2i06a celestial-to-intermediate matrix, IAU 2006/2000A ** eraEra00 Earth rotation angle, IAU 2000 ** eraSp00 the TIO locator s', IERS 2000 ** eraPom00 polar motion matrix ** eraC2tcio form CIO-based celestial-to-terrestrial matrix ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rc2i[3][3], era, sp, rpom[3][3]; /* Form the celestial-to-intermediate matrix for this TT. */ eraC2i06a(tta, ttb, rc2i); /* Predict the Earth rotation angle for this UT1. */ era = eraEra00(uta, utb); /* Estimate s'. */ sp = eraSp00(tta, ttb); /* Form the polar motion matrix. */ eraPom00(xp, yp, sp, rpom); /* Combine to form the celestial-to-terrestrial matrix. */ eraC2tcio(rc2i, era, rpom, rc2t); return; } void eraC2tcio(double rc2i[3][3], double era, double rpom[3][3], double rc2t[3][3]) /* ** - - - - - - - - - - ** e r a C 2 t c i o ** - - - - - - - - - - ** ** Assemble the celestial to terrestrial matrix from CIO-based ** components (the celestial-to-intermediate matrix, the Earth Rotation ** Angle and the polar motion matrix). ** ** Given: ** rc2i double[3][3] celestial-to-intermediate matrix ** era double Earth rotation angle ** rpom double[3][3] polar-motion matrix ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix ** ** Notes: ** ** 1) This function constructs the rotation matrix that transforms ** vectors in the celestial system into vectors in the terrestrial ** system. It does so starting from precomputed components, namely ** the matrix which rotates from celestial coordinates to the ** intermediate frame, the Earth rotation angle and the polar motion ** matrix. One use of the present function is when generating a ** series of celestial-to-terrestrial matrices where only the Earth ** Rotation Angle changes, avoiding the considerable overhead of ** recomputing the precession-nutation more often than necessary to ** achieve given accuracy objectives. ** ** 2) The relationship between the arguments is as follows: ** ** [TRS] = RPOM * R_3(ERA) * rc2i * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003). ** ** Called: ** eraCr copy r-matrix ** eraRz rotate around Z-axis ** eraRxr product of two r-matrices ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r[3][3]; /* Construct the matrix. */ eraCr(rc2i, r); eraRz(era, r); eraRxr(rpom, r, rc2t); return; } void eraC2teqx(double rbpn[3][3], double gst, double rpom[3][3], double rc2t[3][3]) /* ** - - - - - - - - - - ** e r a C 2 t e q x ** - - - - - - - - - - ** ** Assemble the celestial to terrestrial matrix from equinox-based ** components (the celestial-to-true matrix, the Greenwich Apparent ** Sidereal Time and the polar motion matrix). ** ** Given: ** rbpn double[3][3] celestial-to-true matrix ** gst double Greenwich (apparent) Sidereal Time ** rpom double[3][3] polar-motion matrix ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 2) ** ** Notes: ** ** 1) This function constructs the rotation matrix that transforms ** vectors in the celestial system into vectors in the terrestrial ** system. It does so starting from precomputed components, namely ** the matrix which rotates from celestial coordinates to the ** true equator and equinox of date, the Greenwich Apparent Sidereal ** Time and the polar motion matrix. One use of the present function ** is when generating a series of celestial-to-terrestrial matrices ** where only the Sidereal Time changes, avoiding the considerable ** overhead of recomputing the precession-nutation more often than ** necessary to achieve given accuracy objectives. ** ** 2) The relationship between the arguments is as follows: ** ** [TRS] = rpom * R_3(gst) * rbpn * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003). ** ** Called: ** eraCr copy r-matrix ** eraRz rotate around Z-axis ** eraRxr product of two r-matrices ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r[3][3]; /* Construct the matrix. */ eraCr(rbpn, r); eraRz(gst, r); eraRxr(rpom, r, rc2t); return; } void eraC2tpe(double tta, double ttb, double uta, double utb, double dpsi, double deps, double xp, double yp, double rc2t[3][3]) /* ** - - - - - - - - - ** e r a C 2 t p e ** - - - - - - - - - ** ** Form the celestial to terrestrial matrix given the date, the UT1, ** the nutation and the polar motion. IAU 2000. ** ** Given: ** tta,ttb double TT as a 2-part Julian Date (Note 1) ** uta,utb double UT1 as a 2-part Julian Date (Note 1) ** dpsi,deps double nutation (Note 2) ** xp,yp double coordinates of the pole (radians, Note 3) ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 4) ** ** Notes: ** ** 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, ** apportioned in any convenient way between the arguments uta and ** utb. For example, JD(UT1)=2450123.7 could be expressed in any of ** these ways, among others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. In the case of uta,utb, the ** date & time method is best matched to the Earth rotation angle ** algorithm used: maximum precision is delivered when the uta ** argument is for 0hrs UT1 on the day in question and the utb ** argument lies in the range 0 to 1, or vice versa. ** ** 2) The caller is responsible for providing the nutation components; ** they are in longitude and obliquity, in radians and are with ** respect to the equinox and ecliptic of date. For high-accuracy ** applications, free core nutation should be included as well as ** any other relevant corrections to the position of the CIP. ** ** 3) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 4) The matrix rc2t transforms from celestial to terrestrial ** coordinates: ** ** [TRS] = RPOM * R_3(GST) * RBPN * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), RBPN is the ** bias-precession-nutation matrix, GST is the Greenwich (apparent) ** Sidereal Time and RPOM is the polar motion matrix. ** ** 5) Although its name does not include "00", This function is in fact ** specific to the IAU 2000 models. ** ** Called: ** eraPn00 bias/precession/nutation results, IAU 2000 ** eraGmst00 Greenwich mean sidereal time, IAU 2000 ** eraSp00 the TIO locator s', IERS 2000 ** eraEe00 equation of the equinoxes, IAU 2000 ** eraPom00 polar motion matrix ** eraC2teqx form equinox-based celestial-to-terrestrial matrix ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3], rbpn[3][3], gmst, ee, sp, rpom[3][3]; /* Form the celestial-to-true matrix for this TT. */ eraPn00(tta, ttb, dpsi, deps, &epsa, rb, rp, rbp, rn, rbpn); /* Predict the Greenwich Mean Sidereal Time for this UT1 and TT. */ gmst = eraGmst00(uta, utb, tta, ttb); /* Predict the equation of the equinoxes given TT and nutation. */ ee = eraEe00(tta, ttb, epsa, dpsi); /* Estimate s'. */ sp = eraSp00(tta, ttb); /* Form the polar motion matrix. */ eraPom00(xp, yp, sp, rpom); /* Combine to form the celestial-to-terrestrial matrix. */ eraC2teqx(rbpn, gmst + ee, rpom, rc2t); return; } void eraC2txy(double tta, double ttb, double uta, double utb, double x, double y, double xp, double yp, double rc2t[3][3]) /* ** - - - - - - - - - ** e r a C 2 t x y ** - - - - - - - - - ** ** Form the celestial to terrestrial matrix given the date, the UT1, ** the CIP coordinates and the polar motion. IAU 2000. ** ** Given: ** tta,ttb double TT as a 2-part Julian Date (Note 1) ** uta,utb double UT1 as a 2-part Julian Date (Note 1) ** x,y double Celestial Intermediate Pole (Note 2) ** xp,yp double coordinates of the pole (radians, Note 3) ** ** Returned: ** rc2t double[3][3] celestial-to-terrestrial matrix (Note 4) ** ** Notes: ** ** 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, ** apportioned in any convenient way between the arguments uta and ** utb. For example, JD(UT1)=2450123.7 could be expressed in any o ** these ways, among others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. In the case of uta,utb, the ** date & time method is best matched to the Earth rotation angle ** algorithm used: maximum precision is delivered when the uta ** argument is for 0hrs UT1 on the day in question and the utb ** argument lies in the range 0 to 1, or vice versa. ** ** 2) The Celestial Intermediate Pole coordinates are the x,y ** components of the unit vector in the Geocentric Celestial ** Reference System. ** ** 3) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 4) The matrix rc2t transforms from celestial to terrestrial ** coordinates: ** ** [TRS] = RPOM * R_3(ERA) * RC2I * [CRS] ** ** = rc2t * [CRS] ** ** where [CRS] is a vector in the Geocentric Celestial Reference ** System and [TRS] is a vector in the International Terrestrial ** Reference System (see IERS Conventions 2003), ERA is the Earth ** Rotation Angle and RPOM is the polar motion matrix. ** ** 5) Although its name does not include "00", This function is in fact ** specific to the IAU 2000 models. ** ** Called: ** eraC2ixy celestial-to-intermediate matrix, given X,Y ** eraEra00 Earth rotation angle, IAU 2000 ** eraSp00 the TIO locator s', IERS 2000 ** eraPom00 polar motion matrix ** eraC2tcio form CIO-based celestial-to-terrestrial matrix ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rc2i[3][3], era, sp, rpom[3][3]; /* Form the celestial-to-intermediate matrix for this TT. */ eraC2ixy(tta, ttb, x, y, rc2i); /* Predict the Earth rotation angle for this UT1. */ era = eraEra00(uta, utb); /* Estimate s'. */ sp = eraSp00(tta, ttb); /* Form the polar motion matrix. */ eraPom00(xp, yp, sp, rpom); /* Combine to form the celestial-to-terrestrial matrix. */ eraC2tcio(rc2i, era, rpom, rc2t); return; } int eraCal2jd(int iy, int im, int id, double *djm0, double *djm) /* ** - - - - - - - - - - ** e r a C a l 2 j d ** - - - - - - - - - - ** ** Gregorian Calendar to Julian Date. ** ** Given: ** iy,im,id int year, month, day in Gregorian calendar (Note 1) ** ** Returned: ** djm0 double MJD zero-point: always 2400000.5 ** djm double Modified Julian Date for 0 hrs ** ** Returned (function value): ** int status: ** 0 = OK ** -1 = bad year (Note 3: JD not computed) ** -2 = bad month (JD not computed) ** -3 = bad day (JD computed) ** ** Notes: ** ** 1) The algorithm used is valid from -4800 March 1, but this ** implementation rejects dates before -4799 January 1. ** ** 2) The Julian Date is returned in two pieces, in the usual ERFA ** manner, which is designed to preserve time resolution. The ** Julian Date is available as a single number by adding djm0 and ** djm. ** ** 3) In early eras the conversion is from the "Proleptic Gregorian ** Calendar"; no account is taken of the date(s) of adoption of ** the Gregorian Calendar, nor is the AD/BC numbering convention ** observed. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 12.92 (p604). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int j, ly, my; long iypmy; /* Earliest year allowed (4800BC) */ const int IYMIN = -4799; /* Month lengths in days */ static const int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; /* Preset status. */ j = 0; /* Validate year and month. */ if (iy < IYMIN) return -1; if (im < 1 || im > 12) return -2; /* If February in a leap year, 1, otherwise 0. */ ly = ((im == 2) && !(iy%4) && (iy%100 || !(iy%400))); /* Validate day, taking into account leap years. */ if ( (id < 1) || (id > (mtab[im-1] + ly))) j = -3; /* Return result. */ my = (im - 14) / 12; iypmy = (long) (iy + my); *djm0 = 2400000.5; *djm = (double)((1461L * (iypmy + 4800L)) / 4L + (367L * (long) (im - 2 - 12 * my)) / 12L - (3L * ((iypmy + 4900L) / 100L)) / 4L + (long) id - 2432076L); /* Return status. */ return j; } void eraCp(double p[3], double c[3]) /* ** - - - - - - ** e r a C p ** - - - - - - ** ** Copy a p-vector. ** ** Given: ** p double[3] p-vector to be copied ** ** Returned: ** c double[3] copy ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { c[0] = p[0]; c[1] = p[1]; c[2] = p[2]; return; } void eraCpv(double pv[2][3], double c[2][3]) /* ** - - - - - - - ** e r a C p v ** - - - - - - - ** ** Copy a position/velocity vector. ** ** Given: ** pv double[2][3] position/velocity vector to be copied ** ** Returned: ** c double[2][3] copy ** ** Called: ** eraCp copy p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraCp(pv[0], c[0]); eraCp(pv[1], c[1]); return; } void eraCr(double r[3][3], double c[3][3]) /* ** - - - - - - ** e r a C r ** - - - - - - ** ** Copy an r-matrix. ** ** Given: ** r double[3][3] r-matrix to be copied ** ** Returned: ** char[] double[3][3] copy ** ** Called: ** eraCp copy p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraCp(r[0], c[0]); eraCp(r[1], c[1]); eraCp(r[2], c[2]); return; } int eraD2dtf(const char *scale, int ndp, double d1, double d2, int *iy, int *im, int *id, int ihmsf[4]) /* ** - - - - - - - - - ** e r a D 2 d t f ** - - - - - - - - - ** ** Format for output a 2-part Julian Date (or in the case of UTC a ** quasi-JD form that includes special provision for leap seconds). ** ** Given: ** scale char[] time scale ID (Note 1) ** ndp int resolution (Note 2) ** d1,d2 double time as a 2-part Julian Date (Notes 3,4) ** ** Returned: ** iy,im,id int year, month, day in Gregorian calendar (Note 5) ** ihmsf int[4] hours, minutes, seconds, fraction (Note 1) ** ** Returned (function value): ** int status: +1 = dubious year (Note 5) ** 0 = OK ** -1 = unacceptable date (Note 6) ** ** Notes: ** ** 1) scale identifies the time scale. Only the value "UTC" (in upper ** case) is significant, and enables handling of leap seconds (see ** Note 4). ** ** 2) ndp is the number of decimal places in the seconds field, and can ** have negative as well as positive values, such as: ** ** ndp resolution ** -4 1 00 00 ** -3 0 10 00 ** -2 0 01 00 ** -1 0 00 10 ** 0 0 00 01 ** 1 0 00 00.1 ** 2 0 00 00.01 ** 3 0 00 00.001 ** ** The limits are platform dependent, but a safe range is -5 to +9. ** ** 3) d1+d2 is Julian Date, apportioned in any convenient way between ** the two arguments, for example where d1 is the Julian Day Number ** and d2 is the fraction of a day. In the case of UTC, where the ** use of JD is problematical, special conventions apply: see the ** next note. ** ** 4) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The ERFA internal convention is that ** the quasi-JD day represents UTC days whether the length is 86399, ** 86400 or 86401 SI seconds. ** ** 5) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** 6) For calendar conventions and limitations, see eraCal2jd. ** ** Called: ** eraJd2cal JD to Gregorian calendar ** eraD2tf decompose days to hms ** eraDat delta(AT) = TAI-UTC ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int leap; char s; int iy1, im1, id1, js, iy2, im2, id2, ihmsf1[4], i; double a1, b1, fd, dat1, w, dat2, ddt; /* The two-part JD. */ a1 = d1; b1 = d2; /* Provisional calendar date. */ js = eraJd2cal(a1, b1, &iy1, &im1, &id1, &fd); if ( js ) return js < 0 ? -1 : js; /* Is this a leap second day? */ leap = 0; if ( ! strcmp(scale,"UTC") ) { /* TAI-UTC today. */ js = eraDat(iy1, im1, id1, fd, &dat1); if ( js < 0 ) return -1; /* TAI-UTC tomorrow (at noon, to avoid rounding effects). */ js = eraJd2cal(a1+1.5, b1-fd, &iy2, &im2, &id2, &w); js = eraDat(iy2, im2, id2, 0.0, &dat2); if ( js < 0 ) return -1; /* The change in TAI-UTC (seconds). */ ddt = dat2 - dat1; /* If leap second day, scale the fraction of a day into SI. */ leap = fabs(ddt) > 0.5; if (leap) fd += fd * ddt/ERFA_DAYSEC; } /* Provisional time of day. */ eraD2tf ( ndp, fd, &s, ihmsf1 ); /* Is this a leap second day? */ if ( ! leap ) { /* No. Has the time rounded up to 24h? */ if ( ihmsf1[0] > 23 ) { /* Yes. We will need tomorrow's calendar date. */ js = eraJd2cal(a1+1.5, b1-fd, &iy2, &im2, &id2, &w); /* Use 0h tomorrow. */ iy1 = iy2; im1 = im2; id1 = id2; for ( i = 0; i < 4; i++ ) { ihmsf1[i] = 0; } } } else { /* This is a leap second day. Has the time reached or passed 24h? */ if ( ihmsf1[0] > 23 ) { /* Yes. Use 23 59 60... */ ihmsf1[0] = 23; ihmsf1[1] = 59; ihmsf1[2] = 60; } } /* Results. */ *iy = iy1; *im = im1; *id = id1; for ( i = 0; i < 4; i++ ) { ihmsf[i] = ihmsf1[i]; } /* Status. */ return js < 0 ? -1 : js; } void eraD2tf(int ndp, double days, char *sign, int ihmsf[4]) /* ** - - - - - - - - ** e r a D 2 t f ** - - - - - - - - ** ** Decompose days to hours, minutes, seconds, fraction. ** ** Given: ** ndp int resolution (Note 1) ** days double interval in days ** ** Returned: ** sign char '+' or '-' ** ihmsf int[4] hours, minutes, seconds, fraction ** ** Notes: ** ** 1) The argument ndp is interpreted as follows: ** ** ndp resolution ** : ...0000 00 00 ** -7 1000 00 00 ** -6 100 00 00 ** -5 10 00 00 ** -4 1 00 00 ** -3 0 10 00 ** -2 0 01 00 ** -1 0 00 10 ** 0 0 00 01 ** 1 0 00 00.1 ** 2 0 00 00.01 ** 3 0 00 00.001 ** : 0 00 00.000... ** ** 2) The largest positive useful value for ndp is determined by the ** size of days, the format of double on the target platform, and ** the risk of overflowing ihmsf[3]. On a typical platform, for ** days up to 1.0, the available floating-point precision might ** correspond to ndp=12. However, the practical limit is typically ** ndp=9, set by the capacity of a 32-bit int, or ndp=4 if int is ** only 16 bits. ** ** 3) The absolute value of days may exceed 1.0. In cases where it ** does not, it is up to the caller to test for and handle the ** case where days is very nearly 1.0 and rounds up to 24 hours, ** by testing for ihmsf[0]=24 and setting ihmsf[0-3] to zero. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int nrs, n; double rs, rm, rh, a, w, ah, am, as, af; /* Handle sign. */ *sign = (char) ( ( days >= 0.0 ) ? '+' : '-' ); /* Interval in seconds. */ a = ERFA_DAYSEC * fabs(days); /* Pre-round if resolution coarser than 1s (then pretend ndp=1). */ if (ndp < 0) { nrs = 1; for (n = 1; n <= -ndp; n++) { nrs *= (n == 2 || n == 4) ? 6 : 10; } rs = (double) nrs; w = a / rs; a = rs * ERFA_DNINT(w); } /* Express the unit of each field in resolution units. */ nrs = 1; for (n = 1; n <= ndp; n++) { nrs *= 10; } rs = (double) nrs; rm = rs * 60.0; rh = rm * 60.0; /* Round the interval and express in resolution units. */ a = ERFA_DNINT(rs * a); /* Break into fields. */ ah = a / rh; ah = ERFA_DINT(ah); a -= ah * rh; am = a / rm; am = ERFA_DINT(am); a -= am * rm; as = a / rs; as = ERFA_DINT(as); af = a - as * rs; /* Return results. */ ihmsf[0] = (int) ah; ihmsf[1] = (int) am; ihmsf[2] = (int) as; ihmsf[3] = (int) af; return; } int eraDat(int iy, int im, int id, double fd, double *deltat ) /* ** - - - - - - - ** e r a D a t ** - - - - - - - ** ** For a given UTC date, calculate delta(AT) = TAI-UTC. ** ** :------------------------------------------: ** : : ** : IMPORTANT : ** : : ** : A new version of this function must be : ** : produced whenever a new leap second is : ** : announced. There are four items to : ** : change on each such occasion: : ** : : ** : 1) A new line must be added to the set : ** : of statements that initialize the : ** : array "changes". : ** : : ** : 2) The parameter IYV must be set to : ** : the current year. : ** : : ** : 3) The "Latest leap second" comment : ** : below must be set to the new leap : ** : second date. : ** : : ** : 4) The "This revision" comment, later, : ** : must be set to the current date. : ** : : ** : Change (2) must also be carried out : ** : whenever the function is re-issued, : ** : even if no leap seconds have been : ** : added. : ** : : ** : Latest leap second: 2012 June 30 : ** : : ** :__________________________________________: ** ** Given: ** iy int UTC: year (Notes 1 and 2) ** im int month (Note 2) ** id int day (Notes 2 and 3) ** fd double fraction of day (Note 4) ** ** Returned: ** deltat double TAI minus UTC, seconds ** ** Returned (function value): ** int status (Note 5): ** 1 = dubious year (Note 1) ** 0 = OK ** -1 = bad year ** -2 = bad month ** -3 = bad day (Note 3) ** -4 = bad fraction (Note 4) ** ** Notes: ** ** 1) UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper ** to call the function with an earlier date. If this is attempted, ** zero is returned together with a warning status. ** ** Because leap seconds cannot, in principle, be predicted in ** advance, a reliable check for dates beyond the valid range is ** impossible. To guard against gross errors, a year five or more ** after the release year of the present function (see parameter ** IYV) is considered dubious. In this case a warning status is ** returned but the result is computed in the normal way. ** ** For both too-early and too-late years, the warning status is ** j=+1. This is distinct from the error status j=-1, which ** signifies a year so early that JD could not be computed. ** ** 2) If the specified date is for a day which ends with a leap second, ** the UTC-TAI value returned is for the period leading up to the ** leap second. If the date is for a day which begins as a leap ** second ends, the UTC-TAI returned is for the period following the ** leap second. ** ** 3) The day number must be in the normal calendar range, for example ** 1 through 30 for April. The "almanac" convention of allowing ** such dates as January 0 and December 32 is not supported in this ** function, in order to avoid confusion near leap seconds. ** ** 4) The fraction of day is used only for dates before the ** introduction of leap seconds, the first of which occurred at the ** end of 1971. It is tested for validity (0 to 1 is the valid ** range) even if not used; if invalid, zero is used and status ** j=-4 is returned. For many applications, setting fd to zero is ** acceptable; the resulting error is always less than 3 ms (and ** occurs only pre-1972). ** ** 5) The status value returned in the case where there are multiple ** errors refers to the first error detected. For example, if the ** month and day are 13 and 32 respectively, j=-2 (bad month) ** will be returned. ** ** 6) In cases where a valid result is not available, zero is returned. ** ** References: ** ** 1) For dates from 1961 January 1 onwards, the expressions from the ** file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used. ** ** 2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of ** the 1992 Explanatory Supplement. ** ** Called: ** eraCal2jd Gregorian calendar to Julian Day number ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Release year for this version of eraDat */ #define IYV (2012) /* Reference dates (MJD) and drift rates (s/day), pre leap seconds */ static const double drift[][2] = { { 37300.0, 0.0012960 }, { 37300.0, 0.0012960 }, { 37300.0, 0.0012960 }, { 37665.0, 0.0011232 }, { 37665.0, 0.0011232 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 38761.0, 0.0012960 }, { 39126.0, 0.0025920 }, { 39126.0, 0.0025920 } }; /* Number of Delta(AT) expressions before leap seconds were introduced */ #define NERA1 ((int) (sizeof drift / sizeof (double) / 2)) /* Dates and Delta(AT)s */ static const struct { int iyear, month; double delat; } changes[] = { { 1960, 1, 1.4178180 }, { 1961, 1, 1.4228180 }, { 1961, 8, 1.3728180 }, { 1962, 1, 1.8458580 }, { 1963, 11, 1.9458580 }, { 1964, 1, 3.2401300 }, { 1964, 4, 3.3401300 }, { 1964, 9, 3.4401300 }, { 1965, 1, 3.5401300 }, { 1965, 3, 3.6401300 }, { 1965, 7, 3.7401300 }, { 1965, 9, 3.8401300 }, { 1966, 1, 4.3131700 }, { 1968, 2, 4.2131700 }, { 1972, 1, 10.0 }, { 1972, 7, 11.0 }, { 1973, 1, 12.0 }, { 1974, 1, 13.0 }, { 1975, 1, 14.0 }, { 1976, 1, 15.0 }, { 1977, 1, 16.0 }, { 1978, 1, 17.0 }, { 1979, 1, 18.0 }, { 1980, 1, 19.0 }, { 1981, 7, 20.0 }, { 1982, 7, 21.0 }, { 1983, 7, 22.0 }, { 1985, 7, 23.0 }, { 1988, 1, 24.0 }, { 1990, 1, 25.0 }, { 1991, 1, 26.0 }, { 1992, 7, 27.0 }, { 1993, 7, 28.0 }, { 1994, 7, 29.0 }, { 1996, 1, 30.0 }, { 1997, 7, 31.0 }, { 1999, 1, 32.0 }, { 2006, 1, 33.0 }, { 2009, 1, 34.0 }, { 2012, 7, 35.0 } }; /* Number of Delta(AT) changes */ const int NDAT = sizeof changes / sizeof changes[0]; /* Miscellaneous local variables */ int j, i, m; double da, djm0, djm; /* Initialize the result to zero. */ *deltat = da = 0.0; /* If invalid fraction of a day, set error status and give up. */ if (fd < 0.0 || fd > 1.0) return -4; /* Convert the date into an MJD. */ j = eraCal2jd(iy, im, id, &djm0, &djm); /* If invalid year, month, or day, give up. */ if (j < 0) return j; /* If pre-UTC year, set warning status and give up. */ if (iy < changes[0].iyear) return 1; /* If suspiciously late year, set warning status but proceed. */ if (iy > IYV + 5) j = 1; /* Combine year and month to form a date-ordered integer... */ m = 12*iy + im; /* ...and use it to find the preceding table entry. */ for (i = NDAT-1; i >=0; i--) { if (m >= (12 * changes[i].iyear + changes[i].month)) break; } /* Get the Delta(AT). */ da = changes[i].delat; /* If pre-1972, adjust for drift. */ if (i < NERA1) da += (djm + fd - drift[i][0]) * drift[i][1]; /* Return the Delta(AT) value. */ *deltat = da; /* Return the status. */ return j; } double eraDtdb(double date1, double date2, double ut, double elong, double u, double v) /* ** - - - - - - - - ** e r a D t d b ** - - - - - - - - ** ** An approximation to TDB-TT, the difference between barycentric ** dynamical time and terrestrial time, for an observer on the Earth. ** ** The different time scales - proper, coordinate and realized - are ** related to each other: ** ** TAI <- physically realized ** : ** offset <- observed (nominally +32.184s) ** : ** TT <- terrestrial time ** : ** rate adjustment (L_G) <- definition of TT ** : ** TCG <- time scale for GCRS ** : ** "periodic" terms <- eraDtdb is an implementation ** : ** rate adjustment (L_C) <- function of solar-system ephemeris ** : ** TCB <- time scale for BCRS ** : ** rate adjustment (-L_B) <- definition of TDB ** : ** TDB <- TCB scaled to track TT ** : ** "periodic" terms <- -eraDtdb is an approximation ** : ** TT <- terrestrial time ** ** Adopted values for the various constants can be found in the IERS ** Conventions (McCarthy & Petit 2003). ** ** Given: ** date1,date2 double date, TDB (Notes 1-3) ** ut double universal time (UT1, fraction of one day) ** elong double longitude (east positive, radians) ** u double distance from Earth spin axis (km) ** v double distance north of equatorial plane (km) ** ** Returned (function value): ** double TDB-TT (seconds) ** ** Notes: ** ** 1) The date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** Although the date is, formally, barycentric dynamical time (TDB), ** the terrestrial dynamical time (TT) can be used with no practical ** effect on the accuracy of the prediction. ** ** 2) TT can be regarded as a coordinate time that is realized as an ** offset of 32.184s from International Atomic Time, TAI. TT is a ** specific linear transformation of geocentric coordinate time TCG, ** which is the time scale for the Geocentric Celestial Reference ** System, GCRS. ** ** 3) TDB is a coordinate time, and is a specific linear transformation ** of barycentric coordinate time TCB, which is the time scale for ** the Barycentric Celestial Reference System, BCRS. ** ** 4) The difference TCG-TCB depends on the masses and positions of the ** bodies of the solar system and the velocity of the Earth. It is ** dominated by a rate difference, the residual being of a periodic ** character. The latter, which is modeled by the present function, ** comprises a main (annual) sinusoidal term of amplitude ** approximately 0.00166 seconds, plus planetary terms up to about ** 20 microseconds, and lunar and diurnal terms up to 2 microseconds. ** These effects come from the changing transverse Doppler effect ** and gravitational red-shift as the observer (on the Earth's ** surface) experiences variations in speed (with respect to the ** BCRS) and gravitational potential. ** ** 5) TDB can be regarded as the same as TCB but with a rate adjustment ** to keep it close to TT, which is convenient for many applications. ** The history of successive attempts to define TDB is set out in ** Resolution 3 adopted by the IAU General Assembly in 2006, which ** defines a fixed TDB(TCB) transformation that is consistent with ** contemporary solar-system ephemerides. Future ephemerides will ** imply slightly changed transformations between TCG and TCB, which ** could introduce a linear drift between TDB and TT; however, any ** such drift is unlikely to exceed 1 nanosecond per century. ** ** 6) The geocentric TDB-TT model used in the present function is that of ** Fairhead & Bretagnon (1990), in its full form. It was originally ** supplied by Fairhead (private communications with P.T.Wallace, ** 1990) as a Fortran subroutine. The present C function contains an ** adaptation of the Fairhead code. The numerical results are ** essentially unaffected by the changes, the differences with ** respect to the Fairhead & Bretagnon original being at the 1e-20 s ** level. ** ** The topocentric part of the model is from Moyer (1981) and ** Murray (1983), with fundamental arguments adapted from ** Simon et al. 1994. It is an approximation to the expression ** ( v / c ) . ( r / c ), where v is the barycentric velocity of ** the Earth, r is the geocentric position of the observer and ** c is the speed of light. ** ** By supplying zeroes for u and v, the topocentric part of the ** model can be nullified, and the function will return the Fairhead ** & Bretagnon result alone. ** ** 7) During the interval 1950-2050, the absolute accuracy is better ** than +/- 3 nanoseconds relative to time ephemerides obtained by ** direct numerical integrations based on the JPL DE405 solar system ** ephemeris. ** ** 8) It must be stressed that the present function is merely a model, ** and that numerical integration of solar-system ephemerides is the ** definitive method for predicting the relationship between TCG and ** TCB and hence between TT and TDB. ** ** References: ** ** Fairhead, L., & Bretagnon, P., Astron.Astrophys., 229, 240-247 ** (1990). ** ** IAU 2006 Resolution 3. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Moyer, T.D., Cel.Mech., 23, 33 (1981). ** ** Murray, C.A., Vectorial Astrometry, Adam Hilger (1983). ** ** Seidelmann, P.K. et al., Explanatory Supplement to the ** Astronomical Almanac, Chapter 2, University Science Books (1992). ** ** Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G. & Laskar, J., Astron.Astrophys., 282, 663-683 (1994). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, tsol, w, elsun, emsun, d, elj, els, wt, w0, w1, w2, w3, w4, wf, wj; int j; /* ** ===================== ** Fairhead et al. model ** ===================== ** ** 787 sets of three coefficients. ** ** Each set is ** amplitude (microseconds) ** frequency (radians per Julian millennium since J2000.0) ** phase (radians) ** ** Sets 1-474 are the T**0 terms ** " 475-679 " " T**1 ** " 680-764 " " T**2 ** " 765-784 " " T**3 ** " 785-787 " " T**4 */ static const double fairhd[787][3] = { /* 1, 10 */ { 1656.674564e-6, 6283.075849991, 6.240054195 }, { 22.417471e-6, 5753.384884897, 4.296977442 }, { 13.839792e-6, 12566.151699983, 6.196904410 }, { 4.770086e-6, 529.690965095, 0.444401603 }, { 4.676740e-6, 6069.776754553, 4.021195093 }, { 2.256707e-6, 213.299095438, 5.543113262 }, { 1.694205e-6, -3.523118349, 5.025132748 }, { 1.554905e-6, 77713.771467920, 5.198467090 }, { 1.276839e-6, 7860.419392439, 5.988822341 }, { 1.193379e-6, 5223.693919802, 3.649823730 }, /* 11, 20 */ { 1.115322e-6, 3930.209696220, 1.422745069 }, { 0.794185e-6, 11506.769769794, 2.322313077 }, { 0.447061e-6, 26.298319800, 3.615796498 }, { 0.435206e-6, -398.149003408, 4.349338347 }, { 0.600309e-6, 1577.343542448, 2.678271909 }, { 0.496817e-6, 6208.294251424, 5.696701824 }, { 0.486306e-6, 5884.926846583, 0.520007179 }, { 0.432392e-6, 74.781598567, 2.435898309 }, { 0.468597e-6, 6244.942814354, 5.866398759 }, { 0.375510e-6, 5507.553238667, 4.103476804 }, /* 21, 30 */ { 0.243085e-6, -775.522611324, 3.651837925 }, { 0.173435e-6, 18849.227549974, 6.153743485 }, { 0.230685e-6, 5856.477659115, 4.773852582 }, { 0.203747e-6, 12036.460734888, 4.333987818 }, { 0.143935e-6, -796.298006816, 5.957517795 }, { 0.159080e-6, 10977.078804699, 1.890075226 }, { 0.119979e-6, 38.133035638, 4.551585768 }, { 0.118971e-6, 5486.777843175, 1.914547226 }, { 0.116120e-6, 1059.381930189, 0.873504123 }, { 0.137927e-6, 11790.629088659, 1.135934669 }, /* 31, 40 */ { 0.098358e-6, 2544.314419883, 0.092793886 }, { 0.101868e-6, -5573.142801634, 5.984503847 }, { 0.080164e-6, 206.185548437, 2.095377709 }, { 0.079645e-6, 4694.002954708, 2.949233637 }, { 0.062617e-6, 20.775395492, 2.654394814 }, { 0.075019e-6, 2942.463423292, 4.980931759 }, { 0.064397e-6, 5746.271337896, 1.280308748 }, { 0.063814e-6, 5760.498431898, 4.167901731 }, { 0.048042e-6, 2146.165416475, 1.495846011 }, { 0.048373e-6, 155.420399434, 2.251573730 }, /* 41, 50 */ { 0.058844e-6, 426.598190876, 4.839650148 }, { 0.046551e-6, -0.980321068, 0.921573539 }, { 0.054139e-6, 17260.154654690, 3.411091093 }, { 0.042411e-6, 6275.962302991, 2.869567043 }, { 0.040184e-6, -7.113547001, 3.565975565 }, { 0.036564e-6, 5088.628839767, 3.324679049 }, { 0.040759e-6, 12352.852604545, 3.981496998 }, { 0.036507e-6, 801.820931124, 6.248866009 }, { 0.036955e-6, 3154.687084896, 5.071801441 }, { 0.042732e-6, 632.783739313, 5.720622217 }, /* 51, 60 */ { 0.042560e-6, 161000.685737473, 1.270837679 }, { 0.040480e-6, 15720.838784878, 2.546610123 }, { 0.028244e-6, -6286.598968340, 5.069663519 }, { 0.033477e-6, 6062.663207553, 4.144987272 }, { 0.034867e-6, 522.577418094, 5.210064075 }, { 0.032438e-6, 6076.890301554, 0.749317412 }, { 0.030215e-6, 7084.896781115, 3.389610345 }, { 0.029247e-6, -71430.695617928, 4.183178762 }, { 0.033529e-6, 9437.762934887, 2.404714239 }, { 0.032423e-6, 8827.390269875, 5.541473556 }, /* 61, 70 */ { 0.027567e-6, 6279.552731642, 5.040846034 }, { 0.029862e-6, 12139.553509107, 1.770181024 }, { 0.022509e-6, 10447.387839604, 1.460726241 }, { 0.020937e-6, 8429.241266467, 0.652303414 }, { 0.020322e-6, 419.484643875, 3.735430632 }, { 0.024816e-6, -1194.447010225, 1.087136918 }, { 0.025196e-6, 1748.016413067, 2.901883301 }, { 0.021691e-6, 14143.495242431, 5.952658009 }, { 0.017673e-6, 6812.766815086, 3.186129845 }, { 0.022567e-6, 6133.512652857, 3.307984806 }, /* 71, 80 */ { 0.016155e-6, 10213.285546211, 1.331103168 }, { 0.014751e-6, 1349.867409659, 4.308933301 }, { 0.015949e-6, -220.412642439, 4.005298270 }, { 0.015974e-6, -2352.866153772, 6.145309371 }, { 0.014223e-6, 17789.845619785, 2.104551349 }, { 0.017806e-6, 73.297125859, 3.475975097 }, { 0.013671e-6, -536.804512095, 5.971672571 }, { 0.011942e-6, 8031.092263058, 2.053414715 }, { 0.014318e-6, 16730.463689596, 3.016058075 }, { 0.012462e-6, 103.092774219, 1.737438797 }, /* 81, 90 */ { 0.010962e-6, 3.590428652, 2.196567739 }, { 0.015078e-6, 19651.048481098, 3.969480770 }, { 0.010396e-6, 951.718406251, 5.717799605 }, { 0.011707e-6, -4705.732307544, 2.654125618 }, { 0.010453e-6, 5863.591206116, 1.913704550 }, { 0.012420e-6, 4690.479836359, 4.734090399 }, { 0.011847e-6, 5643.178563677, 5.489005403 }, { 0.008610e-6, 3340.612426700, 3.661698944 }, { 0.011622e-6, 5120.601145584, 4.863931876 }, { 0.010825e-6, 553.569402842, 0.842715011 }, /* 91, 100 */ { 0.008666e-6, -135.065080035, 3.293406547 }, { 0.009963e-6, 149.563197135, 4.870690598 }, { 0.009858e-6, 6309.374169791, 1.061816410 }, { 0.007959e-6, 316.391869657, 2.465042647 }, { 0.010099e-6, 283.859318865, 1.942176992 }, { 0.007147e-6, -242.728603974, 3.661486981 }, { 0.007505e-6, 5230.807466803, 4.920937029 }, { 0.008323e-6, 11769.853693166, 1.229392026 }, { 0.007490e-6, -6256.777530192, 3.658444681 }, { 0.009370e-6, 149854.400134205, 0.673880395 }, /* 101, 110 */ { 0.007117e-6, 38.027672636, 5.294249518 }, { 0.007857e-6, 12168.002696575, 0.525733528 }, { 0.007019e-6, 6206.809778716, 0.837688810 }, { 0.006056e-6, 955.599741609, 4.194535082 }, { 0.008107e-6, 13367.972631107, 3.793235253 }, { 0.006731e-6, 5650.292110678, 5.639906583 }, { 0.007332e-6, 36.648562930, 0.114858677 }, { 0.006366e-6, 4164.311989613, 2.262081818 }, { 0.006858e-6, 5216.580372801, 0.642063318 }, { 0.006919e-6, 6681.224853400, 6.018501522 }, /* 111, 120 */ { 0.006826e-6, 7632.943259650, 3.458654112 }, { 0.005308e-6, -1592.596013633, 2.500382359 }, { 0.005096e-6, 11371.704689758, 2.547107806 }, { 0.004841e-6, 5333.900241022, 0.437078094 }, { 0.005582e-6, 5966.683980335, 2.246174308 }, { 0.006304e-6, 11926.254413669, 2.512929171 }, { 0.006603e-6, 23581.258177318, 5.393136889 }, { 0.005123e-6, -1.484472708, 2.999641028 }, { 0.004648e-6, 1589.072895284, 1.275847090 }, { 0.005119e-6, 6438.496249426, 1.486539246 }, /* 121, 130 */ { 0.004521e-6, 4292.330832950, 6.140635794 }, { 0.005680e-6, 23013.539539587, 4.557814849 }, { 0.005488e-6, -3.455808046, 0.090675389 }, { 0.004193e-6, 7234.794256242, 4.869091389 }, { 0.003742e-6, 7238.675591600, 4.691976180 }, { 0.004148e-6, -110.206321219, 3.016173439 }, { 0.004553e-6, 11499.656222793, 5.554998314 }, { 0.004892e-6, 5436.993015240, 1.475415597 }, { 0.004044e-6, 4732.030627343, 1.398784824 }, { 0.004164e-6, 12491.370101415, 5.650931916 }, /* 131, 140 */ { 0.004349e-6, 11513.883316794, 2.181745369 }, { 0.003919e-6, 12528.018664345, 5.823319737 }, { 0.003129e-6, 6836.645252834, 0.003844094 }, { 0.004080e-6, -7058.598461315, 3.690360123 }, { 0.003270e-6, 76.266071276, 1.517189902 }, { 0.002954e-6, 6283.143160294, 4.447203799 }, { 0.002872e-6, 28.449187468, 1.158692983 }, { 0.002881e-6, 735.876513532, 0.349250250 }, { 0.003279e-6, 5849.364112115, 4.893384368 }, { 0.003625e-6, 6209.778724132, 1.473760578 }, /* 141, 150 */ { 0.003074e-6, 949.175608970, 5.185878737 }, { 0.002775e-6, 9917.696874510, 1.030026325 }, { 0.002646e-6, 10973.555686350, 3.918259169 }, { 0.002575e-6, 25132.303399966, 6.109659023 }, { 0.003500e-6, 263.083923373, 1.892100742 }, { 0.002740e-6, 18319.536584880, 4.320519510 }, { 0.002464e-6, 202.253395174, 4.698203059 }, { 0.002409e-6, 2.542797281, 5.325009315 }, { 0.003354e-6, -90955.551694697, 1.942656623 }, { 0.002296e-6, 6496.374945429, 5.061810696 }, /* 151, 160 */ { 0.003002e-6, 6172.869528772, 2.797822767 }, { 0.003202e-6, 27511.467873537, 0.531673101 }, { 0.002954e-6, -6283.008539689, 4.533471191 }, { 0.002353e-6, 639.897286314, 3.734548088 }, { 0.002401e-6, 16200.772724501, 2.605547070 }, { 0.003053e-6, 233141.314403759, 3.029030662 }, { 0.003024e-6, 83286.914269554, 2.355556099 }, { 0.002863e-6, 17298.182327326, 5.240963796 }, { 0.002103e-6, -7079.373856808, 5.756641637 }, { 0.002303e-6, 83996.847317911, 2.013686814 }, /* 161, 170 */ { 0.002303e-6, 18073.704938650, 1.089100410 }, { 0.002381e-6, 63.735898303, 0.759188178 }, { 0.002493e-6, 6386.168624210, 0.645026535 }, { 0.002366e-6, 3.932153263, 6.215885448 }, { 0.002169e-6, 11015.106477335, 4.845297676 }, { 0.002397e-6, 6243.458341645, 3.809290043 }, { 0.002183e-6, 1162.474704408, 6.179611691 }, { 0.002353e-6, 6246.427287062, 4.781719760 }, { 0.002199e-6, -245.831646229, 5.956152284 }, { 0.001729e-6, 3894.181829542, 1.264976635 }, /* 171, 180 */ { 0.001896e-6, -3128.388765096, 4.914231596 }, { 0.002085e-6, 35.164090221, 1.405158503 }, { 0.002024e-6, 14712.317116458, 2.752035928 }, { 0.001737e-6, 6290.189396992, 5.280820144 }, { 0.002229e-6, 491.557929457, 1.571007057 }, { 0.001602e-6, 14314.168113050, 4.203664806 }, { 0.002186e-6, 454.909366527, 1.402101526 }, { 0.001897e-6, 22483.848574493, 4.167932508 }, { 0.001825e-6, -3738.761430108, 0.545828785 }, { 0.001894e-6, 1052.268383188, 5.817167450 }, /* 181, 190 */ { 0.001421e-6, 20.355319399, 2.419886601 }, { 0.001408e-6, 10984.192351700, 2.732084787 }, { 0.001847e-6, 10873.986030480, 2.903477885 }, { 0.001391e-6, -8635.942003763, 0.593891500 }, { 0.001388e-6, -7.046236698, 1.166145902 }, { 0.001810e-6, -88860.057071188, 0.487355242 }, { 0.001288e-6, -1990.745017041, 3.913022880 }, { 0.001297e-6, 23543.230504682, 3.063805171 }, { 0.001335e-6, -266.607041722, 3.995764039 }, { 0.001376e-6, 10969.965257698, 5.152914309 }, /* 191, 200 */ { 0.001745e-6, 244287.600007027, 3.626395673 }, { 0.001649e-6, 31441.677569757, 1.952049260 }, { 0.001416e-6, 9225.539273283, 4.996408389 }, { 0.001238e-6, 4804.209275927, 5.503379738 }, { 0.001472e-6, 4590.910180489, 4.164913291 }, { 0.001169e-6, 6040.347246017, 5.841719038 }, { 0.001039e-6, 5540.085789459, 2.769753519 }, { 0.001004e-6, -170.672870619, 0.755008103 }, { 0.001284e-6, 10575.406682942, 5.306538209 }, { 0.001278e-6, 71.812653151, 4.713486491 }, /* 201, 210 */ { 0.001321e-6, 18209.330263660, 2.624866359 }, { 0.001297e-6, 21228.392023546, 0.382603541 }, { 0.000954e-6, 6282.095528923, 0.882213514 }, { 0.001145e-6, 6058.731054289, 1.169483931 }, { 0.000979e-6, 5547.199336460, 5.448375984 }, { 0.000987e-6, -6262.300454499, 2.656486959 }, { 0.001070e-6, -154717.609887482, 1.827624012 }, { 0.000991e-6, 4701.116501708, 4.387001801 }, { 0.001155e-6, -14.227094002, 3.042700750 }, { 0.001176e-6, 277.034993741, 3.335519004 }, /* 211, 220 */ { 0.000890e-6, 13916.019109642, 5.601498297 }, { 0.000884e-6, -1551.045222648, 1.088831705 }, { 0.000876e-6, 5017.508371365, 3.969902609 }, { 0.000806e-6, 15110.466119866, 5.142876744 }, { 0.000773e-6, -4136.910433516, 0.022067765 }, { 0.001077e-6, 175.166059800, 1.844913056 }, { 0.000954e-6, -6284.056171060, 0.968480906 }, { 0.000737e-6, 5326.786694021, 4.923831588 }, { 0.000845e-6, -433.711737877, 4.749245231 }, { 0.000819e-6, 8662.240323563, 5.991247817 }, /* 221, 230 */ { 0.000852e-6, 199.072001436, 2.189604979 }, { 0.000723e-6, 17256.631536341, 6.068719637 }, { 0.000940e-6, 6037.244203762, 6.197428148 }, { 0.000885e-6, 11712.955318231, 3.280414875 }, { 0.000706e-6, 12559.038152982, 2.824848947 }, { 0.000732e-6, 2379.164473572, 2.501813417 }, { 0.000764e-6, -6127.655450557, 2.236346329 }, { 0.000908e-6, 131.541961686, 2.521257490 }, { 0.000907e-6, 35371.887265976, 3.370195967 }, { 0.000673e-6, 1066.495477190, 3.876512374 }, /* 231, 240 */ { 0.000814e-6, 17654.780539750, 4.627122566 }, { 0.000630e-6, 36.027866677, 0.156368499 }, { 0.000798e-6, 515.463871093, 5.151962502 }, { 0.000798e-6, 148.078724426, 5.909225055 }, { 0.000806e-6, 309.278322656, 6.054064447 }, { 0.000607e-6, -39.617508346, 2.839021623 }, { 0.000601e-6, 412.371096874, 3.984225404 }, { 0.000646e-6, 11403.676995575, 3.852959484 }, { 0.000704e-6, 13521.751441591, 2.300991267 }, { 0.000603e-6, -65147.619767937, 4.140083146 }, /* 241, 250 */ { 0.000609e-6, 10177.257679534, 0.437122327 }, { 0.000631e-6, 5767.611978898, 4.026532329 }, { 0.000576e-6, 11087.285125918, 4.760293101 }, { 0.000674e-6, 14945.316173554, 6.270510511 }, { 0.000726e-6, 5429.879468239, 6.039606892 }, { 0.000710e-6, 28766.924424484, 5.672617711 }, { 0.000647e-6, 11856.218651625, 3.397132627 }, { 0.000678e-6, -5481.254918868, 6.249666675 }, { 0.000618e-6, 22003.914634870, 2.466427018 }, { 0.000738e-6, 6134.997125565, 2.242668890 }, /* 251, 260 */ { 0.000660e-6, 625.670192312, 5.864091907 }, { 0.000694e-6, 3496.032826134, 2.668309141 }, { 0.000531e-6, 6489.261398429, 1.681888780 }, { 0.000611e-6, -143571.324284214, 2.424978312 }, { 0.000575e-6, 12043.574281889, 4.216492400 }, { 0.000553e-6, 12416.588502848, 4.772158039 }, { 0.000689e-6, 4686.889407707, 6.224271088 }, { 0.000495e-6, 7342.457780181, 3.817285811 }, { 0.000567e-6, 3634.621024518, 1.649264690 }, { 0.000515e-6, 18635.928454536, 3.945345892 }, /* 261, 270 */ { 0.000486e-6, -323.505416657, 4.061673868 }, { 0.000662e-6, 25158.601719765, 1.794058369 }, { 0.000509e-6, 846.082834751, 3.053874588 }, { 0.000472e-6, -12569.674818332, 5.112133338 }, { 0.000461e-6, 6179.983075773, 0.513669325 }, { 0.000641e-6, 83467.156352816, 3.210727723 }, { 0.000520e-6, 10344.295065386, 2.445597761 }, { 0.000493e-6, 18422.629359098, 1.676939306 }, { 0.000478e-6, 1265.567478626, 5.487314569 }, { 0.000472e-6, -18.159247265, 1.999707589 }, /* 271, 280 */ { 0.000559e-6, 11190.377900137, 5.783236356 }, { 0.000494e-6, 9623.688276691, 3.022645053 }, { 0.000463e-6, 5739.157790895, 1.411223013 }, { 0.000432e-6, 16858.482532933, 1.179256434 }, { 0.000574e-6, 72140.628666286, 1.758191830 }, { 0.000484e-6, 17267.268201691, 3.290589143 }, { 0.000550e-6, 4907.302050146, 0.864024298 }, { 0.000399e-6, 14.977853527, 2.094441910 }, { 0.000491e-6, 224.344795702, 0.878372791 }, { 0.000432e-6, 20426.571092422, 6.003829241 }, /* 281, 290 */ { 0.000481e-6, 5749.452731634, 4.309591964 }, { 0.000480e-6, 5757.317038160, 1.142348571 }, { 0.000485e-6, 6702.560493867, 0.210580917 }, { 0.000426e-6, 6055.549660552, 4.274476529 }, { 0.000480e-6, 5959.570433334, 5.031351030 }, { 0.000466e-6, 12562.628581634, 4.959581597 }, { 0.000520e-6, 39302.096962196, 4.788002889 }, { 0.000458e-6, 12132.439962106, 1.880103788 }, { 0.000470e-6, 12029.347187887, 1.405611197 }, { 0.000416e-6, -7477.522860216, 1.082356330 }, /* 291, 300 */ { 0.000449e-6, 11609.862544012, 4.179989585 }, { 0.000465e-6, 17253.041107690, 0.353496295 }, { 0.000362e-6, -4535.059436924, 1.583849576 }, { 0.000383e-6, 21954.157609398, 3.747376371 }, { 0.000389e-6, 17.252277143, 1.395753179 }, { 0.000331e-6, 18052.929543158, 0.566790582 }, { 0.000430e-6, 13517.870106233, 0.685827538 }, { 0.000368e-6, -5756.908003246, 0.731374317 }, { 0.000330e-6, 10557.594160824, 3.710043680 }, { 0.000332e-6, 20199.094959633, 1.652901407 }, /* 301, 310 */ { 0.000384e-6, 11933.367960670, 5.827781531 }, { 0.000387e-6, 10454.501386605, 2.541182564 }, { 0.000325e-6, 15671.081759407, 2.178850542 }, { 0.000318e-6, 138.517496871, 2.253253037 }, { 0.000305e-6, 9388.005909415, 0.578340206 }, { 0.000352e-6, 5749.861766548, 3.000297967 }, { 0.000311e-6, 6915.859589305, 1.693574249 }, { 0.000297e-6, 24072.921469776, 1.997249392 }, { 0.000363e-6, -640.877607382, 5.071820966 }, { 0.000323e-6, 12592.450019783, 1.072262823 }, /* 311, 320 */ { 0.000341e-6, 12146.667056108, 4.700657997 }, { 0.000290e-6, 9779.108676125, 1.812320441 }, { 0.000342e-6, 6132.028180148, 4.322238614 }, { 0.000329e-6, 6268.848755990, 3.033827743 }, { 0.000374e-6, 17996.031168222, 3.388716544 }, { 0.000285e-6, -533.214083444, 4.687313233 }, { 0.000338e-6, 6065.844601290, 0.877776108 }, { 0.000276e-6, 24.298513841, 0.770299429 }, { 0.000336e-6, -2388.894020449, 5.353796034 }, { 0.000290e-6, 3097.883822726, 4.075291557 }, /* 321, 330 */ { 0.000318e-6, 709.933048357, 5.941207518 }, { 0.000271e-6, 13095.842665077, 3.208912203 }, { 0.000331e-6, 6073.708907816, 4.007881169 }, { 0.000292e-6, 742.990060533, 2.714333592 }, { 0.000362e-6, 29088.811415985, 3.215977013 }, { 0.000280e-6, 12359.966151546, 0.710872502 }, { 0.000267e-6, 10440.274292604, 4.730108488 }, { 0.000262e-6, 838.969287750, 1.327720272 }, { 0.000250e-6, 16496.361396202, 0.898769761 }, { 0.000325e-6, 20597.243963041, 0.180044365 }, /* 331, 340 */ { 0.000268e-6, 6148.010769956, 5.152666276 }, { 0.000284e-6, 5636.065016677, 5.655385808 }, { 0.000301e-6, 6080.822454817, 2.135396205 }, { 0.000294e-6, -377.373607916, 3.708784168 }, { 0.000236e-6, 2118.763860378, 1.733578756 }, { 0.000234e-6, 5867.523359379, 5.575209112 }, { 0.000268e-6, -226858.238553767, 0.069432392 }, { 0.000265e-6, 167283.761587465, 4.369302826 }, { 0.000280e-6, 28237.233459389, 5.304829118 }, { 0.000292e-6, 12345.739057544, 4.096094132 }, /* 341, 350 */ { 0.000223e-6, 19800.945956225, 3.069327406 }, { 0.000301e-6, 43232.306658416, 6.205311188 }, { 0.000264e-6, 18875.525869774, 1.417263408 }, { 0.000304e-6, -1823.175188677, 3.409035232 }, { 0.000301e-6, 109.945688789, 0.510922054 }, { 0.000260e-6, 813.550283960, 2.389438934 }, { 0.000299e-6, 316428.228673312, 5.384595078 }, { 0.000211e-6, 5756.566278634, 3.789392838 }, { 0.000209e-6, 5750.203491159, 1.661943545 }, { 0.000240e-6, 12489.885628707, 5.684549045 }, /* 351, 360 */ { 0.000216e-6, 6303.851245484, 3.862942261 }, { 0.000203e-6, 1581.959348283, 5.549853589 }, { 0.000200e-6, 5642.198242609, 1.016115785 }, { 0.000197e-6, -70.849445304, 4.690702525 }, { 0.000227e-6, 6287.008003254, 2.911891613 }, { 0.000197e-6, 533.623118358, 1.048982898 }, { 0.000205e-6, -6279.485421340, 1.829362730 }, { 0.000209e-6, -10988.808157535, 2.636140084 }, { 0.000208e-6, -227.526189440, 4.127883842 }, { 0.000191e-6, 415.552490612, 4.401165650 }, /* 361, 370 */ { 0.000190e-6, 29296.615389579, 4.175658539 }, { 0.000264e-6, 66567.485864652, 4.601102551 }, { 0.000256e-6, -3646.350377354, 0.506364778 }, { 0.000188e-6, 13119.721102825, 2.032195842 }, { 0.000185e-6, -209.366942175, 4.694756586 }, { 0.000198e-6, 25934.124331089, 3.832703118 }, { 0.000195e-6, 4061.219215394, 3.308463427 }, { 0.000234e-6, 5113.487598583, 1.716090661 }, { 0.000188e-6, 1478.866574064, 5.686865780 }, { 0.000222e-6, 11823.161639450, 1.942386641 }, /* 371, 380 */ { 0.000181e-6, 10770.893256262, 1.999482059 }, { 0.000171e-6, 6546.159773364, 1.182807992 }, { 0.000206e-6, 70.328180442, 5.934076062 }, { 0.000169e-6, 20995.392966449, 2.169080622 }, { 0.000191e-6, 10660.686935042, 5.405515999 }, { 0.000228e-6, 33019.021112205, 4.656985514 }, { 0.000184e-6, -4933.208440333, 3.327476868 }, { 0.000220e-6, -135.625325010, 1.765430262 }, { 0.000166e-6, 23141.558382925, 3.454132746 }, { 0.000191e-6, 6144.558353121, 5.020393445 }, /* 381, 390 */ { 0.000180e-6, 6084.003848555, 0.602182191 }, { 0.000163e-6, 17782.732072784, 4.960593133 }, { 0.000225e-6, 16460.333529525, 2.596451817 }, { 0.000222e-6, 5905.702242076, 3.731990323 }, { 0.000204e-6, 227.476132789, 5.636192701 }, { 0.000159e-6, 16737.577236597, 3.600691544 }, { 0.000200e-6, 6805.653268085, 0.868220961 }, { 0.000187e-6, 11919.140866668, 2.629456641 }, { 0.000161e-6, 127.471796607, 2.862574720 }, { 0.000205e-6, 6286.666278643, 1.742882331 }, /* 391, 400 */ { 0.000189e-6, 153.778810485, 4.812372643 }, { 0.000168e-6, 16723.350142595, 0.027860588 }, { 0.000149e-6, 11720.068865232, 0.659721876 }, { 0.000189e-6, 5237.921013804, 5.245313000 }, { 0.000143e-6, 6709.674040867, 4.317625647 }, { 0.000146e-6, 4487.817406270, 4.815297007 }, { 0.000144e-6, -664.756045130, 5.381366880 }, { 0.000175e-6, 5127.714692584, 4.728443327 }, { 0.000162e-6, 6254.626662524, 1.435132069 }, { 0.000187e-6, 47162.516354635, 1.354371923 }, /* 401, 410 */ { 0.000146e-6, 11080.171578918, 3.369695406 }, { 0.000180e-6, -348.924420448, 2.490902145 }, { 0.000148e-6, 151.047669843, 3.799109588 }, { 0.000157e-6, 6197.248551160, 1.284375887 }, { 0.000167e-6, 146.594251718, 0.759969109 }, { 0.000133e-6, -5331.357443741, 5.409701889 }, { 0.000154e-6, 95.979227218, 3.366890614 }, { 0.000148e-6, -6418.140930027, 3.384104996 }, { 0.000128e-6, -6525.804453965, 3.803419985 }, { 0.000130e-6, 11293.470674356, 0.939039445 }, /* 411, 420 */ { 0.000152e-6, -5729.506447149, 0.734117523 }, { 0.000138e-6, 210.117701700, 2.564216078 }, { 0.000123e-6, 6066.595360816, 4.517099537 }, { 0.000140e-6, 18451.078546566, 0.642049130 }, { 0.000126e-6, 11300.584221356, 3.485280663 }, { 0.000119e-6, 10027.903195729, 3.217431161 }, { 0.000151e-6, 4274.518310832, 4.404359108 }, { 0.000117e-6, 6072.958148291, 0.366324650 }, { 0.000165e-6, -7668.637425143, 4.298212528 }, { 0.000117e-6, -6245.048177356, 5.379518958 }, /* 421, 430 */ { 0.000130e-6, -5888.449964932, 4.527681115 }, { 0.000121e-6, -543.918059096, 6.109429504 }, { 0.000162e-6, 9683.594581116, 5.720092446 }, { 0.000141e-6, 6219.339951688, 0.679068671 }, { 0.000118e-6, 22743.409379516, 4.881123092 }, { 0.000129e-6, 1692.165669502, 0.351407289 }, { 0.000126e-6, 5657.405657679, 5.146592349 }, { 0.000114e-6, 728.762966531, 0.520791814 }, { 0.000120e-6, 52.596639600, 0.948516300 }, { 0.000115e-6, 65.220371012, 3.504914846 }, /* 431, 440 */ { 0.000126e-6, 5881.403728234, 5.577502482 }, { 0.000158e-6, 163096.180360983, 2.957128968 }, { 0.000134e-6, 12341.806904281, 2.598576764 }, { 0.000151e-6, 16627.370915377, 3.985702050 }, { 0.000109e-6, 1368.660252845, 0.014730471 }, { 0.000131e-6, 6211.263196841, 0.085077024 }, { 0.000146e-6, 5792.741760812, 0.708426604 }, { 0.000146e-6, -77.750543984, 3.121576600 }, { 0.000107e-6, 5341.013788022, 0.288231904 }, { 0.000138e-6, 6281.591377283, 2.797450317 }, /* 441, 450 */ { 0.000113e-6, -6277.552925684, 2.788904128 }, { 0.000115e-6, -525.758811831, 5.895222200 }, { 0.000138e-6, 6016.468808270, 6.096188999 }, { 0.000139e-6, 23539.707386333, 2.028195445 }, { 0.000146e-6, -4176.041342449, 4.660008502 }, { 0.000107e-6, 16062.184526117, 4.066520001 }, { 0.000142e-6, 83783.548222473, 2.936315115 }, { 0.000128e-6, 9380.959672717, 3.223844306 }, { 0.000135e-6, 6205.325306007, 1.638054048 }, { 0.000101e-6, 2699.734819318, 5.481603249 }, /* 451, 460 */ { 0.000104e-6, -568.821874027, 2.205734493 }, { 0.000103e-6, 6321.103522627, 2.440421099 }, { 0.000119e-6, 6321.208885629, 2.547496264 }, { 0.000138e-6, 1975.492545856, 2.314608466 }, { 0.000121e-6, 137.033024162, 4.539108237 }, { 0.000123e-6, 19402.796952817, 4.538074405 }, { 0.000119e-6, 22805.735565994, 2.869040566 }, { 0.000133e-6, 64471.991241142, 6.056405489 }, { 0.000129e-6, -85.827298831, 2.540635083 }, { 0.000131e-6, 13613.804277336, 4.005732868 }, /* 461, 470 */ { 0.000104e-6, 9814.604100291, 1.959967212 }, { 0.000112e-6, 16097.679950283, 3.589026260 }, { 0.000123e-6, 2107.034507542, 1.728627253 }, { 0.000121e-6, 36949.230808424, 6.072332087 }, { 0.000108e-6, -12539.853380183, 3.716133846 }, { 0.000113e-6, -7875.671863624, 2.725771122 }, { 0.000109e-6, 4171.425536614, 4.033338079 }, { 0.000101e-6, 6247.911759770, 3.441347021 }, { 0.000113e-6, 7330.728427345, 0.656372122 }, { 0.000113e-6, 51092.726050855, 2.791483066 }, /* 471, 480 */ { 0.000106e-6, 5621.842923210, 1.815323326 }, { 0.000101e-6, 111.430161497, 5.711033677 }, { 0.000103e-6, 909.818733055, 2.812745443 }, { 0.000101e-6, 1790.642637886, 1.965746028 }, /* T */ { 102.156724e-6, 6283.075849991, 4.249032005 }, { 1.706807e-6, 12566.151699983, 4.205904248 }, { 0.269668e-6, 213.299095438, 3.400290479 }, { 0.265919e-6, 529.690965095, 5.836047367 }, { 0.210568e-6, -3.523118349, 6.262738348 }, { 0.077996e-6, 5223.693919802, 4.670344204 }, /* 481, 490 */ { 0.054764e-6, 1577.343542448, 4.534800170 }, { 0.059146e-6, 26.298319800, 1.083044735 }, { 0.034420e-6, -398.149003408, 5.980077351 }, { 0.032088e-6, 18849.227549974, 4.162913471 }, { 0.033595e-6, 5507.553238667, 5.980162321 }, { 0.029198e-6, 5856.477659115, 0.623811863 }, { 0.027764e-6, 155.420399434, 3.745318113 }, { 0.025190e-6, 5746.271337896, 2.980330535 }, { 0.022997e-6, -796.298006816, 1.174411803 }, { 0.024976e-6, 5760.498431898, 2.467913690 }, /* 491, 500 */ { 0.021774e-6, 206.185548437, 3.854787540 }, { 0.017925e-6, -775.522611324, 1.092065955 }, { 0.013794e-6, 426.598190876, 2.699831988 }, { 0.013276e-6, 6062.663207553, 5.845801920 }, { 0.011774e-6, 12036.460734888, 2.292832062 }, { 0.012869e-6, 6076.890301554, 5.333425680 }, { 0.012152e-6, 1059.381930189, 6.222874454 }, { 0.011081e-6, -7.113547001, 5.154724984 }, { 0.010143e-6, 4694.002954708, 4.044013795 }, { 0.009357e-6, 5486.777843175, 3.416081409 }, /* 501, 510 */ { 0.010084e-6, 522.577418094, 0.749320262 }, { 0.008587e-6, 10977.078804699, 2.777152598 }, { 0.008628e-6, 6275.962302991, 4.562060226 }, { 0.008158e-6, -220.412642439, 5.806891533 }, { 0.007746e-6, 2544.314419883, 1.603197066 }, { 0.007670e-6, 2146.165416475, 3.000200440 }, { 0.007098e-6, 74.781598567, 0.443725817 }, { 0.006180e-6, -536.804512095, 1.302642751 }, { 0.005818e-6, 5088.628839767, 4.827723531 }, { 0.004945e-6, -6286.598968340, 0.268305170 }, /* 511, 520 */ { 0.004774e-6, 1349.867409659, 5.808636673 }, { 0.004687e-6, -242.728603974, 5.154890570 }, { 0.006089e-6, 1748.016413067, 4.403765209 }, { 0.005975e-6, -1194.447010225, 2.583472591 }, { 0.004229e-6, 951.718406251, 0.931172179 }, { 0.005264e-6, 553.569402842, 2.336107252 }, { 0.003049e-6, 5643.178563677, 1.362634430 }, { 0.002974e-6, 6812.766815086, 1.583012668 }, { 0.003403e-6, -2352.866153772, 2.552189886 }, { 0.003030e-6, 419.484643875, 5.286473844 }, /* 521, 530 */ { 0.003210e-6, -7.046236698, 1.863796539 }, { 0.003058e-6, 9437.762934887, 4.226420633 }, { 0.002589e-6, 12352.852604545, 1.991935820 }, { 0.002927e-6, 5216.580372801, 2.319951253 }, { 0.002425e-6, 5230.807466803, 3.084752833 }, { 0.002656e-6, 3154.687084896, 2.487447866 }, { 0.002445e-6, 10447.387839604, 2.347139160 }, { 0.002990e-6, 4690.479836359, 6.235872050 }, { 0.002890e-6, 5863.591206116, 0.095197563 }, { 0.002498e-6, 6438.496249426, 2.994779800 }, /* 531, 540 */ { 0.001889e-6, 8031.092263058, 3.569003717 }, { 0.002567e-6, 801.820931124, 3.425611498 }, { 0.001803e-6, -71430.695617928, 2.192295512 }, { 0.001782e-6, 3.932153263, 5.180433689 }, { 0.001694e-6, -4705.732307544, 4.641779174 }, { 0.001704e-6, -1592.596013633, 3.997097652 }, { 0.001735e-6, 5849.364112115, 0.417558428 }, { 0.001643e-6, 8429.241266467, 2.180619584 }, { 0.001680e-6, 38.133035638, 4.164529426 }, { 0.002045e-6, 7084.896781115, 0.526323854 }, /* 541, 550 */ { 0.001458e-6, 4292.330832950, 1.356098141 }, { 0.001437e-6, 20.355319399, 3.895439360 }, { 0.001738e-6, 6279.552731642, 0.087484036 }, { 0.001367e-6, 14143.495242431, 3.987576591 }, { 0.001344e-6, 7234.794256242, 0.090454338 }, { 0.001438e-6, 11499.656222793, 0.974387904 }, { 0.001257e-6, 6836.645252834, 1.509069366 }, { 0.001358e-6, 11513.883316794, 0.495572260 }, { 0.001628e-6, 7632.943259650, 4.968445721 }, { 0.001169e-6, 103.092774219, 2.838496795 }, /* 551, 560 */ { 0.001162e-6, 4164.311989613, 3.408387778 }, { 0.001092e-6, 6069.776754553, 3.617942651 }, { 0.001008e-6, 17789.845619785, 0.286350174 }, { 0.001008e-6, 639.897286314, 1.610762073 }, { 0.000918e-6, 10213.285546211, 5.532798067 }, { 0.001011e-6, -6256.777530192, 0.661826484 }, { 0.000753e-6, 16730.463689596, 3.905030235 }, { 0.000737e-6, 11926.254413669, 4.641956361 }, { 0.000694e-6, 3340.612426700, 2.111120332 }, { 0.000701e-6, 3894.181829542, 2.760823491 }, /* 561, 570 */ { 0.000689e-6, -135.065080035, 4.768800780 }, { 0.000700e-6, 13367.972631107, 5.760439898 }, { 0.000664e-6, 6040.347246017, 1.051215840 }, { 0.000654e-6, 5650.292110678, 4.911332503 }, { 0.000788e-6, 6681.224853400, 4.699648011 }, { 0.000628e-6, 5333.900241022, 5.024608847 }, { 0.000755e-6, -110.206321219, 4.370971253 }, { 0.000628e-6, 6290.189396992, 3.660478857 }, { 0.000635e-6, 25132.303399966, 4.121051532 }, { 0.000534e-6, 5966.683980335, 1.173284524 }, /* 571, 580 */ { 0.000543e-6, -433.711737877, 0.345585464 }, { 0.000517e-6, -1990.745017041, 5.414571768 }, { 0.000504e-6, 5767.611978898, 2.328281115 }, { 0.000485e-6, 5753.384884897, 1.685874771 }, { 0.000463e-6, 7860.419392439, 5.297703006 }, { 0.000604e-6, 515.463871093, 0.591998446 }, { 0.000443e-6, 12168.002696575, 4.830881244 }, { 0.000570e-6, 199.072001436, 3.899190272 }, { 0.000465e-6, 10969.965257698, 0.476681802 }, { 0.000424e-6, -7079.373856808, 1.112242763 }, /* 581, 590 */ { 0.000427e-6, 735.876513532, 1.994214480 }, { 0.000478e-6, -6127.655450557, 3.778025483 }, { 0.000414e-6, 10973.555686350, 5.441088327 }, { 0.000512e-6, 1589.072895284, 0.107123853 }, { 0.000378e-6, 10984.192351700, 0.915087231 }, { 0.000402e-6, 11371.704689758, 4.107281715 }, { 0.000453e-6, 9917.696874510, 1.917490952 }, { 0.000395e-6, 149.563197135, 2.763124165 }, { 0.000371e-6, 5739.157790895, 3.112111866 }, { 0.000350e-6, 11790.629088659, 0.440639857 }, /* 591, 600 */ { 0.000356e-6, 6133.512652857, 5.444568842 }, { 0.000344e-6, 412.371096874, 5.676832684 }, { 0.000383e-6, 955.599741609, 5.559734846 }, { 0.000333e-6, 6496.374945429, 0.261537984 }, { 0.000340e-6, 6055.549660552, 5.975534987 }, { 0.000334e-6, 1066.495477190, 2.335063907 }, { 0.000399e-6, 11506.769769794, 5.321230910 }, { 0.000314e-6, 18319.536584880, 2.313312404 }, { 0.000424e-6, 1052.268383188, 1.211961766 }, { 0.000307e-6, 63.735898303, 3.169551388 }, /* 601, 610 */ { 0.000329e-6, 29.821438149, 6.106912080 }, { 0.000357e-6, 6309.374169791, 4.223760346 }, { 0.000312e-6, -3738.761430108, 2.180556645 }, { 0.000301e-6, 309.278322656, 1.499984572 }, { 0.000268e-6, 12043.574281889, 2.447520648 }, { 0.000257e-6, 12491.370101415, 3.662331761 }, { 0.000290e-6, 625.670192312, 1.272834584 }, { 0.000256e-6, 5429.879468239, 1.913426912 }, { 0.000339e-6, 3496.032826134, 4.165930011 }, { 0.000283e-6, 3930.209696220, 4.325565754 }, /* 611, 620 */ { 0.000241e-6, 12528.018664345, 3.832324536 }, { 0.000304e-6, 4686.889407707, 1.612348468 }, { 0.000259e-6, 16200.772724501, 3.470173146 }, { 0.000238e-6, 12139.553509107, 1.147977842 }, { 0.000236e-6, 6172.869528772, 3.776271728 }, { 0.000296e-6, -7058.598461315, 0.460368852 }, { 0.000306e-6, 10575.406682942, 0.554749016 }, { 0.000251e-6, 17298.182327326, 0.834332510 }, { 0.000290e-6, 4732.030627343, 4.759564091 }, { 0.000261e-6, 5884.926846583, 0.298259862 }, /* 621, 630 */ { 0.000249e-6, 5547.199336460, 3.749366406 }, { 0.000213e-6, 11712.955318231, 5.415666119 }, { 0.000223e-6, 4701.116501708, 2.703203558 }, { 0.000268e-6, -640.877607382, 0.283670793 }, { 0.000209e-6, 5636.065016677, 1.238477199 }, { 0.000193e-6, 10177.257679534, 1.943251340 }, { 0.000182e-6, 6283.143160294, 2.456157599 }, { 0.000184e-6, -227.526189440, 5.888038582 }, { 0.000182e-6, -6283.008539689, 0.241332086 }, { 0.000228e-6, -6284.056171060, 2.657323816 }, /* 631, 640 */ { 0.000166e-6, 7238.675591600, 5.930629110 }, { 0.000167e-6, 3097.883822726, 5.570955333 }, { 0.000159e-6, -323.505416657, 5.786670700 }, { 0.000154e-6, -4136.910433516, 1.517805532 }, { 0.000176e-6, 12029.347187887, 3.139266834 }, { 0.000167e-6, 12132.439962106, 3.556352289 }, { 0.000153e-6, 202.253395174, 1.463313961 }, { 0.000157e-6, 17267.268201691, 1.586837396 }, { 0.000142e-6, 83996.847317911, 0.022670115 }, { 0.000152e-6, 17260.154654690, 0.708528947 }, /* 641, 650 */ { 0.000144e-6, 6084.003848555, 5.187075177 }, { 0.000135e-6, 5756.566278634, 1.993229262 }, { 0.000134e-6, 5750.203491159, 3.457197134 }, { 0.000144e-6, 5326.786694021, 6.066193291 }, { 0.000160e-6, 11015.106477335, 1.710431974 }, { 0.000133e-6, 3634.621024518, 2.836451652 }, { 0.000134e-6, 18073.704938650, 5.453106665 }, { 0.000134e-6, 1162.474704408, 5.326898811 }, { 0.000128e-6, 5642.198242609, 2.511652591 }, { 0.000160e-6, 632.783739313, 5.628785365 }, /* 651, 660 */ { 0.000132e-6, 13916.019109642, 0.819294053 }, { 0.000122e-6, 14314.168113050, 5.677408071 }, { 0.000125e-6, 12359.966151546, 5.251984735 }, { 0.000121e-6, 5749.452731634, 2.210924603 }, { 0.000136e-6, -245.831646229, 1.646502367 }, { 0.000120e-6, 5757.317038160, 3.240883049 }, { 0.000134e-6, 12146.667056108, 3.059480037 }, { 0.000137e-6, 6206.809778716, 1.867105418 }, { 0.000141e-6, 17253.041107690, 2.069217456 }, { 0.000129e-6, -7477.522860216, 2.781469314 }, /* 661, 670 */ { 0.000116e-6, 5540.085789459, 4.281176991 }, { 0.000116e-6, 9779.108676125, 3.320925381 }, { 0.000129e-6, 5237.921013804, 3.497704076 }, { 0.000113e-6, 5959.570433334, 0.983210840 }, { 0.000122e-6, 6282.095528923, 2.674938860 }, { 0.000140e-6, -11.045700264, 4.957936982 }, { 0.000108e-6, 23543.230504682, 1.390113589 }, { 0.000106e-6, -12569.674818332, 0.429631317 }, { 0.000110e-6, -266.607041722, 5.501340197 }, { 0.000115e-6, 12559.038152982, 4.691456618 }, /* 671, 680 */ { 0.000134e-6, -2388.894020449, 0.577313584 }, { 0.000109e-6, 10440.274292604, 6.218148717 }, { 0.000102e-6, -543.918059096, 1.477842615 }, { 0.000108e-6, 21228.392023546, 2.237753948 }, { 0.000101e-6, -4535.059436924, 3.100492232 }, { 0.000103e-6, 76.266071276, 5.594294322 }, { 0.000104e-6, 949.175608970, 5.674287810 }, { 0.000101e-6, 13517.870106233, 2.196632348 }, { 0.000100e-6, 11933.367960670, 4.056084160 }, /* T^2 */ { 4.322990e-6, 6283.075849991, 2.642893748 }, /* 681, 690 */ { 0.406495e-6, 0.000000000, 4.712388980 }, { 0.122605e-6, 12566.151699983, 2.438140634 }, { 0.019476e-6, 213.299095438, 1.642186981 }, { 0.016916e-6, 529.690965095, 4.510959344 }, { 0.013374e-6, -3.523118349, 1.502210314 }, { 0.008042e-6, 26.298319800, 0.478549024 }, { 0.007824e-6, 155.420399434, 5.254710405 }, { 0.004894e-6, 5746.271337896, 4.683210850 }, { 0.004875e-6, 5760.498431898, 0.759507698 }, { 0.004416e-6, 5223.693919802, 6.028853166 }, /* 691, 700 */ { 0.004088e-6, -7.113547001, 0.060926389 }, { 0.004433e-6, 77713.771467920, 3.627734103 }, { 0.003277e-6, 18849.227549974, 2.327912542 }, { 0.002703e-6, 6062.663207553, 1.271941729 }, { 0.003435e-6, -775.522611324, 0.747446224 }, { 0.002618e-6, 6076.890301554, 3.633715689 }, { 0.003146e-6, 206.185548437, 5.647874613 }, { 0.002544e-6, 1577.343542448, 6.232904270 }, { 0.002218e-6, -220.412642439, 1.309509946 }, { 0.002197e-6, 5856.477659115, 2.407212349 }, /* 701, 710 */ { 0.002897e-6, 5753.384884897, 5.863842246 }, { 0.001766e-6, 426.598190876, 0.754113147 }, { 0.001738e-6, -796.298006816, 2.714942671 }, { 0.001695e-6, 522.577418094, 2.629369842 }, { 0.001584e-6, 5507.553238667, 1.341138229 }, { 0.001503e-6, -242.728603974, 0.377699736 }, { 0.001552e-6, -536.804512095, 2.904684667 }, { 0.001370e-6, -398.149003408, 1.265599125 }, { 0.001889e-6, -5573.142801634, 4.413514859 }, { 0.001722e-6, 6069.776754553, 2.445966339 }, /* 711, 720 */ { 0.001124e-6, 1059.381930189, 5.041799657 }, { 0.001258e-6, 553.569402842, 3.849557278 }, { 0.000831e-6, 951.718406251, 2.471094709 }, { 0.000767e-6, 4694.002954708, 5.363125422 }, { 0.000756e-6, 1349.867409659, 1.046195744 }, { 0.000775e-6, -11.045700264, 0.245548001 }, { 0.000597e-6, 2146.165416475, 4.543268798 }, { 0.000568e-6, 5216.580372801, 4.178853144 }, { 0.000711e-6, 1748.016413067, 5.934271972 }, { 0.000499e-6, 12036.460734888, 0.624434410 }, /* 721, 730 */ { 0.000671e-6, -1194.447010225, 4.136047594 }, { 0.000488e-6, 5849.364112115, 2.209679987 }, { 0.000621e-6, 6438.496249426, 4.518860804 }, { 0.000495e-6, -6286.598968340, 1.868201275 }, { 0.000456e-6, 5230.807466803, 1.271231591 }, { 0.000451e-6, 5088.628839767, 0.084060889 }, { 0.000435e-6, 5643.178563677, 3.324456609 }, { 0.000387e-6, 10977.078804699, 4.052488477 }, { 0.000547e-6, 161000.685737473, 2.841633844 }, { 0.000522e-6, 3154.687084896, 2.171979966 }, /* 731, 740 */ { 0.000375e-6, 5486.777843175, 4.983027306 }, { 0.000421e-6, 5863.591206116, 4.546432249 }, { 0.000439e-6, 7084.896781115, 0.522967921 }, { 0.000309e-6, 2544.314419883, 3.172606705 }, { 0.000347e-6, 4690.479836359, 1.479586566 }, { 0.000317e-6, 801.820931124, 3.553088096 }, { 0.000262e-6, 419.484643875, 0.606635550 }, { 0.000248e-6, 6836.645252834, 3.014082064 }, { 0.000245e-6, -1592.596013633, 5.519526220 }, { 0.000225e-6, 4292.330832950, 2.877956536 }, /* 741, 750 */ { 0.000214e-6, 7234.794256242, 1.605227587 }, { 0.000205e-6, 5767.611978898, 0.625804796 }, { 0.000180e-6, 10447.387839604, 3.499954526 }, { 0.000229e-6, 199.072001436, 5.632304604 }, { 0.000214e-6, 639.897286314, 5.960227667 }, { 0.000175e-6, -433.711737877, 2.162417992 }, { 0.000209e-6, 515.463871093, 2.322150893 }, { 0.000173e-6, 6040.347246017, 2.556183691 }, { 0.000184e-6, 6309.374169791, 4.732296790 }, { 0.000227e-6, 149854.400134205, 5.385812217 }, /* 751, 760 */ { 0.000154e-6, 8031.092263058, 5.120720920 }, { 0.000151e-6, 5739.157790895, 4.815000443 }, { 0.000197e-6, 7632.943259650, 0.222827271 }, { 0.000197e-6, 74.781598567, 3.910456770 }, { 0.000138e-6, 6055.549660552, 1.397484253 }, { 0.000149e-6, -6127.655450557, 5.333727496 }, { 0.000137e-6, 3894.181829542, 4.281749907 }, { 0.000135e-6, 9437.762934887, 5.979971885 }, { 0.000139e-6, -2352.866153772, 4.715630782 }, { 0.000142e-6, 6812.766815086, 0.513330157 }, /* 761, 770 */ { 0.000120e-6, -4705.732307544, 0.194160689 }, { 0.000131e-6, -71430.695617928, 0.000379226 }, { 0.000124e-6, 6279.552731642, 2.122264908 }, { 0.000108e-6, -6256.777530192, 0.883445696 }, /* T^3 */ { 0.143388e-6, 6283.075849991, 1.131453581 }, { 0.006671e-6, 12566.151699983, 0.775148887 }, { 0.001480e-6, 155.420399434, 0.480016880 }, { 0.000934e-6, 213.299095438, 6.144453084 }, { 0.000795e-6, 529.690965095, 2.941595619 }, { 0.000673e-6, 5746.271337896, 0.120415406 }, /* 771, 780 */ { 0.000672e-6, 5760.498431898, 5.317009738 }, { 0.000389e-6, -220.412642439, 3.090323467 }, { 0.000373e-6, 6062.663207553, 3.003551964 }, { 0.000360e-6, 6076.890301554, 1.918913041 }, { 0.000316e-6, -21.340641002, 5.545798121 }, { 0.000315e-6, -242.728603974, 1.884932563 }, { 0.000278e-6, 206.185548437, 1.266254859 }, { 0.000238e-6, -536.804512095, 4.532664830 }, { 0.000185e-6, 522.577418094, 4.578313856 }, { 0.000245e-6, 18849.227549974, 0.587467082 }, /* 781, 787 */ { 0.000180e-6, 426.598190876, 5.151178553 }, { 0.000200e-6, 553.569402842, 5.355983739 }, { 0.000141e-6, 5223.693919802, 1.336556009 }, { 0.000104e-6, 5856.477659115, 4.239842759 }, /* T^4 */ { 0.003826e-6, 6283.075849991, 5.705257275 }, { 0.000303e-6, 12566.151699983, 5.407132842 }, { 0.000209e-6, 155.420399434, 1.989815753 } }; /* Time since J2000.0 in Julian millennia. */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJM; /* ================= */ /* Topocentric terms */ /* ================= */ /* Convert UT to local solar time in radians. */ tsol = fmod(ut, 1.0) * ERFA_D2PI + elong; /* FUNDAMENTAL ARGUMENTS: Simon et al. 1994. */ /* Combine time argument (millennia) with deg/arcsec factor. */ w = t / 3600.0; /* Sun Mean Longitude. */ elsun = fmod(280.46645683 + 1296027711.03429 * w, 360.0) * ERFA_DD2R; /* Sun Mean Anomaly. */ emsun = fmod(357.52910918 + 1295965810.481 * w, 360.0) * ERFA_DD2R; /* Mean Elongation of Moon from Sun. */ d = fmod(297.85019547 + 16029616012.090 * w, 360.0) * ERFA_DD2R; /* Mean Longitude of Jupiter. */ elj = fmod(34.35151874 + 109306899.89453 * w, 360.0) * ERFA_DD2R; /* Mean Longitude of Saturn. */ els = fmod(50.07744430 + 44046398.47038 * w, 360.0) * ERFA_DD2R; /* TOPOCENTRIC TERMS: Moyer 1981 and Murray 1983. */ wt = + 0.00029e-10 * u * sin(tsol + elsun - els) + 0.00100e-10 * u * sin(tsol - 2.0 * emsun) + 0.00133e-10 * u * sin(tsol - d) + 0.00133e-10 * u * sin(tsol + elsun - elj) - 0.00229e-10 * u * sin(tsol + 2.0 * elsun + emsun) - 0.02200e-10 * v * cos(elsun + emsun) + 0.05312e-10 * u * sin(tsol - emsun) - 0.13677e-10 * u * sin(tsol + 2.0 * elsun) - 1.31840e-10 * v * cos(elsun) + 3.17679e-10 * u * sin(tsol); /* ===================== */ /* Fairhead et al. model */ /* ===================== */ /* T**0 */ w0 = 0; for (j = 473; j >= 0; j--) { w0 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]); } /* T**1 */ w1 = 0; for (j = 678; j >= 474; j--) { w1 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]); } /* T**2 */ w2 = 0; for (j = 763; j >= 679; j--) { w2 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]); } /* T**3 */ w3 = 0; for (j = 783; j >= 764; j--) { w3 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]); } /* T**4 */ w4 = 0; for (j = 786; j >= 784; j--) { w4 += fairhd[j][0] * sin(fairhd[j][1] * t + fairhd[j][2]); } /* Multiply by powers of T and combine. */ wf = t * (t * (t * (t * w4 + w3) + w2) + w1) + w0; /* Adjustments to use JPL planetary masses instead of IAU. */ wj = 0.00065e-6 * sin(6069.776754 * t + 4.021194) + 0.00033e-6 * sin( 213.299095 * t + 5.543132) + (-0.00196e-6 * sin(6208.294251 * t + 5.696701)) + (-0.00173e-6 * sin( 74.781599 * t + 2.435900)) + 0.03638e-6 * t * t; /* ============ */ /* Final result */ /* ============ */ /* TDB-TT in seconds. */ w = wt + wf + wj; return w; } int eraDtf2d(const char *scale, int iy, int im, int id, int ihr, int imn, double sec, double *d1, double *d2) /* ** - - - - - - - - - ** e r a D t f 2 d ** - - - - - - - - - ** ** Encode date and time fields into 2-part Julian Date (or in the case ** of UTC a quasi-JD form that includes special provision for leap ** seconds). ** ** Given: ** scale char[] time scale ID (Note 1) ** iy,im,id int year, month, day in Gregorian calendar (Note 2) ** ihr,imn int hour, minute ** sec double seconds ** ** Returned: ** d1,d2 double 2-part Julian Date (Notes 3,4) ** ** Returned (function value): ** int status: +3 = both of next two ** +2 = time is after end of day (Note 5) ** +1 = dubious year (Note 6) ** 0 = OK ** -1 = bad year ** -2 = bad month ** -3 = bad day ** -4 = bad hour ** -5 = bad minute ** -6 = bad second (<0) ** ** Notes: ** ** 1) scale identifies the time scale. Only the value "UTC" (in upper ** case) is significant, and enables handling of leap seconds (see ** Note 4). ** ** 2) For calendar conventions and limitations, see eraCal2jd. ** ** 3) The sum of the results, d1+d2, is Julian Date, where normally d1 ** is the Julian Day Number and d2 is the fraction of a day. In the ** case of UTC, where the use of JD is problematical, special ** conventions apply: see the next note. ** ** 4) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The ERFA internal convention is that ** the quasi-JD day represents UTC days whether the length is 86399, ** 86400 or 86401 SI seconds. ** ** 5) The warning status "time is after end of day" usually means that ** the sec argument is greater than 60.0. However, in a day ending ** in a leap second the limit changes to 61.0 (or 59.0 in the case ** of a negative leap second). ** ** 6) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** 7) Only in the case of continuous and regular time scales (TAI, TT, ** TCG, TCB and TDB) is the result d1+d2 a Julian Date, strictly ** speaking. In the other cases (UT1 and UTC) the result must be ** used with circumspection; in particular the difference between ** two such results cannot be interpreted as a precise time ** interval. ** ** Called: ** eraCal2jd Gregorian calendar to JD ** eraDat delta(AT) = TAI-UTC ** eraJd2cal JD to Gregorian calendar ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int js, iy2, im2, id2; double dj, w, day, seclim, dat1, dat2, ddt, time; /* Today's Julian Day Number. */ js = eraCal2jd(iy, im, id, &dj, &w); if ( js ) return js; dj += w; /* Day length and final minute length in seconds (provisional). */ day = ERFA_DAYSEC; seclim = 60; /* Deal with the UTC leap second case. */ if ( ! strcmp(scale,"UTC") ) { /* TAI-UTC today. */ js = eraDat(iy, im, id, 0.0, &dat1); if ( js < 0 ) return js; /* TAI-UTC tomorrow. */ js = eraJd2cal ( dj, 1.0, &iy2, &im2, &id2, &w); if ( js ) return js; js = eraDat(iy2, im2, id2, 0.0, &dat2); if ( js < 0 ) return js; /* The change in TAI-UTC (seconds). */ ddt = dat2 - dat1; /* If leap second day, correct the day and final minute lengths. */ if ( fabs(ddt) > 0.5 ) { day += ddt; if ( ihr == 23 && imn == 59 ) seclim += ddt; } } /* Validate the time. */ if ( ihr >= 0 && ihr <= 23 ) { if ( imn >= 0 && imn <= 59 ) { if ( sec >= 0 ) { if ( sec >= seclim ) { js += 2; } } else { js = -6; } } else { js = -5; } } else { js = -4; } if ( js < 0 ) return js; /* The time in days. */ time = ( 60.0 * ( (double) ( 60 * ihr + imn ) ) + sec ) / day; /* Return the date and time. */ *d1 = dj; *d2 = time; /* Status. */ return js; } double eraEe00(double date1, double date2, double epsa, double dpsi) /* ** - - - - - - - - ** e r a E e 0 0 ** - - - - - - - - ** ** The equation of the equinoxes, compatible with IAU 2000 resolutions, ** given the nutation in longitude and the mean obliquity. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** epsa double mean obliquity (Note 2) ** dpsi double nutation in longitude (Note 3) ** ** Returned (function value): ** double equation of the equinoxes (Note 4) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The obliquity, in radians, is mean of date. ** ** 3) The result, which is in radians, operates in the following sense: ** ** Greenwich apparent ST = GMST + equation of the equinoxes ** ** 4) The result is compatible with the IAU 2000 resolutions. For ** further details, see IERS Conventions 2003 and Capitaine et al. ** (2002). ** ** Called: ** eraEect00 equation of the equinoxes complementary terms ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double ee; /* Equation of the equinoxes. */ ee = dpsi * cos(epsa) + eraEect00(date1, date2); return ee; } double eraEe00a(double date1, double date2) /* ** - - - - - - - - - ** e r a E e 0 0 a ** - - - - - - - - - ** ** Equation of the equinoxes, compatible with IAU 2000 resolutions. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double equation of the equinoxes (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result, which is in radians, operates in the following sense: ** ** Greenwich apparent ST = GMST + equation of the equinoxes ** ** 3) The result is compatible with the IAU 2000 resolutions. For ** further details, see IERS Conventions 2003 and Capitaine et al. ** (2002). ** ** Called: ** eraPr00 IAU 2000 precession adjustments ** eraObl80 mean obliquity, IAU 1980 ** eraNut00a nutation, IAU 2000A ** eraEe00 equation of the equinoxes, IAU 2000 ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003). ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsipr, depspr, epsa, dpsi, deps, ee; /* IAU 2000 precession-rate adjustments. */ eraPr00(date1, date2, &dpsipr, &depspr); /* Mean obliquity, consistent with IAU 2000 precession-nutation. */ epsa = eraObl80(date1, date2) + depspr; /* Nutation in longitude. */ eraNut00a(date1, date2, &dpsi, &deps); /* Equation of the equinoxes. */ ee = eraEe00(date1, date2, epsa, dpsi); return ee; } double eraEe00b(double date1, double date2) /* ** - - - - - - - - - ** e r a E e 0 0 b ** - - - - - - - - - ** ** Equation of the equinoxes, compatible with IAU 2000 resolutions but ** using the truncated nutation model IAU 2000B. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double equation of the equinoxes (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result, which is in radians, operates in the following sense: ** ** Greenwich apparent ST = GMST + equation of the equinoxes ** ** 3) The result is compatible with the IAU 2000 resolutions except ** that accuracy has been compromised for the sake of speed. For ** further details, see McCarthy & Luzum (2001), IERS Conventions ** 2003 and Capitaine et al. (2003). ** ** Called: ** eraPr00 IAU 2000 precession adjustments ** eraObl80 mean obliquity, IAU 1980 ** eraNut00b nutation, IAU 2000B ** eraEe00 equation of the equinoxes, IAU 2000 ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** McCarthy, D.D. & Luzum, B.J., "An abridged model of the ** precession-nutation of the celestial pole", Celestial Mechanics & ** Dynamical Astronomy, 85, 37-49 (2003) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsipr, depspr, epsa, dpsi, deps, ee; /* IAU 2000 precession-rate adjustments. */ eraPr00(date1, date2, &dpsipr, &depspr); /* Mean obliquity, consistent with IAU 2000 precession-nutation. */ epsa = eraObl80(date1, date2) + depspr; /* Nutation in longitude. */ eraNut00b(date1, date2, &dpsi, &deps); /* Equation of the equinoxes. */ ee = eraEe00(date1, date2, epsa, dpsi); return ee; } double eraEe06a(double date1, double date2) /* ** - - - - - - - - - ** e r a E e 0 6 a ** - - - - - - - - - ** ** Equation of the equinoxes, compatible with IAU 2000 resolutions and ** IAU 2006/2000A precession-nutation. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double equation of the equinoxes (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result, which is in radians, operates in the following sense: ** ** Greenwich apparent ST = GMST + equation of the equinoxes ** ** Called: ** eraAnpm normalize angle into range +/- pi ** eraGst06a Greenwich apparent sidereal time, IAU 2006/2000A ** eraGmst06 Greenwich mean sidereal time, IAU 2006 ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gst06a, gmst06, ee; /* Apparent and mean sidereal times. */ gst06a = eraGst06a(0.0, 0.0, date1, date2); gmst06 = eraGmst06(0.0, 0.0, date1, date2); /* Equation of the equinoxes. */ ee = eraAnpm(gst06a - gmst06); return ee; } double eraEect00(double date1, double date2) /* ** - - - - - - - - - - ** e r a E e c t 0 0 ** - - - - - - - - - - ** ** Equation of the equinoxes complementary terms, consistent with ** IAU 2000 resolutions. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double complementary terms (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The "complementary terms" are part of the equation of the ** equinoxes (EE), classically the difference between apparent and ** mean Sidereal Time: ** ** GAST = GMST + EE ** ** with: ** ** EE = dpsi * cos(eps) ** ** where dpsi is the nutation in longitude and eps is the obliquity ** of date. However, if the rotation of the Earth were constant in ** an inertial frame the classical formulation would lead to ** apparent irregularities in the UT1 timescale traceable to side- ** effects of precession-nutation. In order to eliminate these ** effects from UT1, "complementary terms" were introduced in 1994 ** (IAU, 1994) and took effect from 1997 (Capitaine and Gontier, ** 1993): ** ** GAST = GMST + CT + EE ** ** By convention, the complementary terms are included as part of ** the equation of the equinoxes rather than as part of the mean ** Sidereal Time. This slightly compromises the "geometrical" ** interpretation of mean sidereal time but is otherwise ** inconsequential. ** ** The present function computes CT in the above expression, ** compatible with IAU 2000 resolutions (Capitaine et al., 2002, and ** IERS Conventions 2003). ** ** Called: ** eraFal03 mean anomaly of the Moon ** eraFalp03 mean anomaly of the Sun ** eraFaf03 mean argument of the latitude of the Moon ** eraFad03 mean elongation of the Moon from the Sun ** eraFaom03 mean longitude of the Moon's ascending node ** eraFave03 mean longitude of Venus ** eraFae03 mean longitude of Earth ** eraFapa03 general accumulated precession in longitude ** ** References: ** ** Capitaine, N. & Gontier, A.-M., Astron. Astrophys., 275, ** 645-650 (1993) ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** IAU Resolution C7, Recommendation 3 (1994) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Time since J2000.0, in Julian centuries */ double t; /* Miscellaneous */ int i, j; double a, s0, s1; /* Fundamental arguments */ double fa[14]; /* Returned value. */ double eect; /* ----------------------------------------- */ /* The series for the EE complementary terms */ /* ----------------------------------------- */ typedef struct { int nfa[8]; /* coefficients of l,l',F,D,Om,LVe,LE,pA */ double s, c; /* sine and cosine coefficients */ } TERM; /* Terms of order t^0 */ static const TERM e0[] = { /* 1-10 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, 2640.96e-6, -0.39e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, 63.52e-6, -0.02e-6 }, {{ 0, 0, 2, -2, 3, 0, 0, 0}, 11.75e-6, 0.01e-6 }, {{ 0, 0, 2, -2, 1, 0, 0, 0}, 11.21e-6, 0.01e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, -4.55e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 3, 0, 0, 0}, 2.02e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 1, 0, 0, 0}, 1.98e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 3, 0, 0, 0}, -1.72e-6, 0.00e-6 }, {{ 0, 1, 0, 0, 1, 0, 0, 0}, -1.41e-6, -0.01e-6 }, {{ 0, 1, 0, 0, -1, 0, 0, 0}, -1.26e-6, -0.01e-6 }, /* 11-20 */ {{ 1, 0, 0, 0, -1, 0, 0, 0}, -0.63e-6, 0.00e-6 }, {{ 1, 0, 0, 0, 1, 0, 0, 0}, -0.63e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 3, 0, 0, 0}, 0.46e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 1, 0, 0, 0}, 0.45e-6, 0.00e-6 }, {{ 0, 0, 4, -4, 4, 0, 0, 0}, 0.36e-6, 0.00e-6 }, {{ 0, 0, 1, -1, 1, -8, 12, 0}, -0.24e-6, -0.12e-6 }, {{ 0, 0, 2, 0, 0, 0, 0, 0}, 0.32e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, 0.28e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 3, 0, 0, 0}, 0.27e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 1, 0, 0, 0}, 0.26e-6, 0.00e-6 }, /* 21-30 */ {{ 0, 0, 2, -2, 0, 0, 0, 0}, -0.21e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -3, 0, 0, 0}, 0.19e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -1, 0, 0, 0}, 0.18e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 0, 8,-13, -1}, -0.10e-6, 0.05e-6 }, {{ 0, 0, 0, 2, 0, 0, 0, 0}, 0.15e-6, 0.00e-6 }, {{ 2, 0, -2, 0, -1, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, 1, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 2, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, -1, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 0, 0, 4, -2, 4, 0, 0, 0}, 0.13e-6, 0.00e-6 }, /* 31-33 */ {{ 0, 0, 2, -2, 4, 0, 0, 0}, -0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -3, 0, 0, 0}, 0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -1, 0, 0, 0}, 0.11e-6, 0.00e-6 } }; /* Terms of order t^1 */ static const TERM e1[] = { {{ 0, 0, 0, 0, 1, 0, 0, 0}, -0.87e-6, 0.00e-6 } }; /* Number of terms in the series */ const int NE0 = (int) (sizeof e0 / sizeof (TERM)); const int NE1 = (int) (sizeof e1 / sizeof (TERM)); /*--------------------------------------------------------------------*/ /* Interval between fundamental epoch J2000.0 and current date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Fundamental Arguments (from IERS Conventions 2003) */ /* Mean anomaly of the Moon. */ fa[0] = eraFal03(t); /* Mean anomaly of the Sun. */ fa[1] = eraFalp03(t); /* Mean longitude of the Moon minus that of the ascending node. */ fa[2] = eraFaf03(t); /* Mean elongation of the Moon from the Sun. */ fa[3] = eraFad03(t); /* Mean longitude of the ascending node of the Moon. */ fa[4] = eraFaom03(t); /* Mean longitude of Venus. */ fa[5] = eraFave03(t); /* Mean longitude of Earth. */ fa[6] = eraFae03(t); /* General precession in longitude. */ fa[7] = eraFapa03(t); /* Evaluate the EE complementary terms. */ s0 = 0.0; s1 = 0.0; for (i = NE0-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)(e0[i].nfa[j]) * fa[j]; } s0 += e0[i].s * sin(a) + e0[i].c * cos(a); } for (i = NE1-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)(e1[i].nfa[j]) * fa[j]; } s1 += e1[i].s * sin(a) + e1[i].c * cos(a); } eect = (s0 + s1 * t ) * ERFA_DAS2R; return eect; } int eraEform ( int n, double *a, double *f ) /* ** - - - - - - - - - ** e r a E f o r m ** - - - - - - - - - ** ** Earth reference ellipsoids. ** ** Given: ** n int ellipsoid identifier (Note 1) ** ** Returned: ** a double equatorial radius (meters, Note 2) ** f double flattening (Note 2) ** ** Returned (function value): ** int status: 0 = OK ** -1 = illegal identifier (Note 3) ** ** Notes: ** ** 1) The identifier n is a number that specifies the choice of ** reference ellipsoid. The following are supported: ** ** n ellipsoid ** ** 1 ERFA_WGS84 ** 2 ERFA_GRS80 ** 3 ERFA_WGS72 ** ** The n value has no significance outside the ERFA software. For ** convenience, symbols ERFA_WGS84 etc. are defined in erfam.h. ** ** 2) The ellipsoid parameters are returned in the form of equatorial ** radius in meters (a) and flattening (f). The latter is a number ** around 0.00335, i.e. around 1/298. ** ** 3) For the case where an unsupported n value is supplied, zero a and ** f are returned, as well as error status. ** ** References: ** ** Department of Defense World Geodetic System 1984, National ** Imagery and Mapping Agency Technical Report 8350.2, Third ** Edition, p3-2. ** ** Moritz, H., Bull. Geodesique 66-2, 187 (1992). ** ** The Department of Defense World Geodetic System 1972, World ** Geodetic System Committee, May 1974. ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** p220. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Look up a and f for the specified reference ellipsoid. */ switch ( n ) { case ERFA_WGS84: *a = 6378137.0; *f = 1.0 / 298.257223563; break; case ERFA_GRS80: *a = 6378137.0; *f = 1.0 / 298.257222101; break; case ERFA_WGS72: *a = 6378135.0; *f = 1.0 / 298.26; break; default: /* Invalid identifier. */ *a = 0.0; *f = 0.0; return -1; } /* OK status. */ return 0; } double eraEo06a(double date1, double date2) /* ** - - - - - - - - - ** e r a E o 0 6 a ** - - - - - - - - - ** ** Equation of the origins, IAU 2006 precession and IAU 2000A nutation. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double equation of the origins in radians ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The equation of the origins is the distance between the true ** equinox and the celestial intermediate origin and, equivalently, ** the difference between Earth rotation angle and Greenwich ** apparent sidereal time (ERA-GST). It comprises the precession ** (since J2000.0) in right ascension plus the equation of the ** equinoxes (including the small correction terms). ** ** Called: ** eraPnm06a classical NPB matrix, IAU 2006/2000A ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS06 the CIO locator s, given X,Y, IAU 2006 ** eraEors equation of the origins, Given NPB matrix and s ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r[3][3], x, y, s, eo; /* Classical nutation x precession x bias matrix. */ eraPnm06a(date1, date2, r); /* Extract CIP coordinates. */ eraBpn2xy(r, &x, &y); /* The CIO locator, s. */ s = eraS06(date1, date2, x, y); /* Solve for the EO. */ eo = eraEors(r, s); return eo; } double eraEors(double rnpb[3][3], double s) /* ** - - - - - - - - ** e r a E o r s ** - - - - - - - - ** ** Equation of the origins, given the classical NPB matrix and the ** quantity s. ** ** Given: ** rnpb double[3][3] classical nutation x precession x bias matrix ** s double the quantity s (the CIO locator) ** ** Returned (function value): ** double the equation of the origins in radians. ** ** Notes: ** ** 1) The equation of the origins is the distance between the true ** equinox and the celestial intermediate origin and, equivalently, ** the difference between Earth rotation angle and Greenwich ** apparent sidereal time (ERA-GST). It comprises the precession ** (since J2000.0) in right ascension plus the equation of the ** equinoxes (including the small correction terms). ** ** 2) The algorithm is from Wallace & Capitaine (2006). ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, ax, xs, ys, zs, p, q, eo; /* Evaluate Wallace & Capitaine (2006) expression (16). */ x = rnpb[2][0]; ax = x / (1.0 + rnpb[2][2]); xs = 1.0 - ax * x; ys = -ax * rnpb[2][1]; zs = -x; p = rnpb[0][0] * xs + rnpb[0][1] * ys + rnpb[0][2] * zs; q = rnpb[1][0] * xs + rnpb[1][1] * ys + rnpb[1][2] * zs; eo = ((p != 0) || (q != 0)) ? s - atan2(q, p) : s; return eo; } double eraEpb(double dj1, double dj2) /* ** - - - - - - - ** e r a E p b ** - - - - - - - ** ** Julian Date to Besselian Epoch. ** ** Given: ** dj1,dj2 double Julian Date (see note) ** ** Returned (function value): ** double Besselian Epoch. ** ** Note: ** ** The Julian Date is supplied in two pieces, in the usual ERFA ** manner, which is designed to preserve time resolution. The ** Julian Date is available as a single number by adding dj1 and ** dj2. The maximum resolution is achieved if dj1 is 2451545D0 ** (J2000.0). ** ** Reference: ** ** Lieske,J.H., 1979. Astron.Astrophys.,73,282. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* J2000.0 minus B1900.0 (2415019.81352) in Julian days */ static const double D1900 = 36524.68648; double epb; epb = 1900.0 + ((dj1 - ERFA_DJ00) + (dj2 + D1900)) / ERFA_DTY; return epb; } void eraEpb2jd(double epb, double *djm0, double *djm) /* ** - - - - - - - - - - ** e r a E p b 2 j d ** - - - - - - - - - - ** ** Besselian Epoch to Julian Date. ** ** Given: ** epb double Besselian Epoch (e.g. 1957.3D0) ** ** Returned: ** djm0 double MJD zero-point: always 2400000.5 ** djm double Modified Julian Date ** ** Note: ** ** The Julian Date is returned in two pieces, in the usual ERFA ** manner, which is designed to preserve time resolution. The ** Julian Date is available as a single number by adding djm0 and ** djm. ** ** Reference: ** ** Lieske, J.H., 1979, Astron.Astrophys. 73, 282. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { *djm0 = 2400000.5; *djm = 15019.81352 + (epb - 1900.0) * ERFA_DTY; return; } double eraEpj(double dj1, double dj2) /* ** - - - - - - - ** e r a E p j ** - - - - - - - ** ** Julian Date to Julian Epoch. ** ** Given: ** dj1,dj2 double Julian Date (see note) ** ** Returned (function value): ** double Julian Epoch ** ** Note: ** ** The Julian Date is supplied in two pieces, in the usual ERFA ** manner, which is designed to preserve time resolution. The ** Julian Date is available as a single number by adding dj1 and ** dj2. The maximum resolution is achieved if dj1 is 2451545D0 ** (J2000.0). ** ** Reference: ** ** Lieske, J.H., 1979, Astron.Astrophys. 73, 282. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double epj; epj = 2000.0 + ((dj1 - ERFA_DJ00) + dj2) / ERFA_DJY; return epj; } void eraEpj2jd(double epj, double *djm0, double *djm) /* ** - - - - - - - - - - ** e r a E p j 2 j d ** - - - - - - - - - - ** ** Julian Epoch to Julian Date. ** ** Given: ** epj double Julian Epoch (e.g. 1996.8D0) ** ** Returned: ** djm0 double MJD zero-point: always 2400000.5 ** djm double Modified Julian Date ** ** Note: ** ** The Julian Date is returned in two pieces, in the usual ERFA ** manner, which is designed to preserve time resolution. The ** Julian Date is available as a single number by adding djm0 and ** djm. ** ** Reference: ** ** Lieske, J.H., 1979, Astron.Astrophys. 73, 282. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { *djm0 = 2400000.5; *djm = 51544.5 + (epj - 2000.0) * 365.25; return; } int eraEpv00(double date1, double date2, double pvh[2][3], double pvb[2][3]) /* ** - - - - - - - - - ** e r a E p v 0 0 ** - - - - - - - - - ** ** Earth position and velocity, heliocentric and barycentric, with ** respect to the Barycentric Celestial Reference System. ** ** Given: ** date1,date2 double TDB date (Note 1) ** ** Returned: ** pvh double[2][3] heliocentric Earth position/velocity ** pvb double[2][3] barycentric Earth position/velocity ** ** Returned (function value): ** int status: 0 = OK ** +1 = warning: date outside ** the range 1900-2100 AD ** ** Notes: ** ** 1) The TDB date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TDB)=2450123.7 could be expressed in any of these ways, among ** others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in cases ** where the loss of several decimal digits of resolution is ** acceptable. The J2000 method is best matched to the way the ** argument is handled internally and will deliver the optimum ** resolution. The MJD method and the date & time methods are both ** good compromises between resolution and convenience. However, ** the accuracy of the result is more likely to be limited by the ** algorithm itself than the way the date has been expressed. ** ** n.b. TT can be used instead of TDB in most applications. ** ** 2) On return, the arrays pvh and pvb contain the following: ** ** pvh[0][0] x } ** pvh[0][1] y } heliocentric position, AU ** pvh[0][2] z } ** ** pvh[1][0] xdot } ** pvh[1][1] ydot } heliocentric velocity, AU/d ** pvh[1][2] zdot } ** ** pvb[0][0] x } ** pvb[0][1] y } barycentric position, AU ** pvb[0][2] z } ** ** pvb[1][0] xdot } ** pvb[1][1] ydot } barycentric velocity, AU/d ** pvb[1][2] zdot } ** ** The vectors are with respect to the Barycentric Celestial ** Reference System. The time unit is one day in TDB. ** ** 3) The function is a SIMPLIFIED SOLUTION from the planetary theory ** VSOP2000 (X. Moisson, P. Bretagnon, 2001, Celes. Mechanics & ** Dyn. Astron., 80, 3/4, 205-213) and is an adaptation of original ** Fortran code supplied by P. Bretagnon (private comm., 2000). ** ** 4) Comparisons over the time span 1900-2100 with this simplified ** solution and the JPL DE405 ephemeris give the following results: ** ** RMS max ** Heliocentric: ** position error 3.7 11.2 km ** velocity error 1.4 5.0 mm/s ** ** Barycentric: ** position error 4.6 13.4 km ** velocity error 1.4 4.9 mm/s ** ** Comparisons with the JPL DE406 ephemeris show that by 1800 and ** 2200 the position errors are approximately double their 1900-2100 ** size. By 1500 and 2500 the deterioration is a factor of 10 and ** by 1000 and 3000 a factor of 60. The velocity accuracy falls off ** at about half that rate. ** ** 5) It is permissible to use the same array for pvh and pvb, which ** will receive the barycentric values. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* ** Matrix elements for orienting the analytical model to DE405. ** ** The corresponding Euler angles are: ** ** d ' " ** 1st rotation - 23 26 21.4091 about the x-axis (obliquity) ** 2nd rotation + 0.0475 about the z-axis (RA offset) ** ** These were obtained empirically, by comparisons with DE405 over ** 1900-2100. */ static const double am12 = 0.000000211284, am13 = -0.000000091603, am21 = -0.000000230286, am22 = 0.917482137087, am23 = -0.397776982902, am32 = 0.397776982902, am33 = 0.917482137087; /* ** ---------------------- ** Ephemeris Coefficients ** ---------------------- ** ** The ephemeris consists of harmonic terms for predicting (i) the Sun ** to Earth vector and (ii) the Solar-System-barycenter to Sun vector ** respectively. The coefficients are stored in arrays which, although ** 1-demensional, contain groups of three. Each triplet of ** coefficients is the amplitude, phase and frequency for one term in ** the model, and each array contains the number of terms called for by ** the model. ** ** There are eighteen such arrays, named as follows: ** ** array model power of T component ** ** e0x Sun-to-Earth 0 x ** e0y Sun-to-Earth 0 y ** e0z Sun-to-Earth 0 z ** ** e1x Sun-to-Earth 1 x ** e1y Sun-to-Earth 1 y ** e1z Sun-to-Earth 1 z ** ** e2x Sun-to-Earth 2 x ** e2y Sun-to-Earth 2 y ** e2z Sun-to-Earth 2 z ** ** s0x SSB-to-Sun 0 x ** s0y SSB-to-Sun 0 y ** s0z SSB-to-Sun 0 z ** ** s1x SSB-to-Sun 1 x ** s1y SSB-to-Sun 1 y ** s1z SSB-to-Sun 1 z ** ** s2x SSB-to-Sun 2 x ** s2y SSB-to-Sun 2 y ** s2z SSB-to-Sun 2 z */ /* Sun-to-Earth, T^0, X */ static const double e0x[] = { 0.9998292878132e+00, 0.1753485171504e+01, 0.6283075850446e+01, 0.8352579567414e-02, 0.1710344404582e+01, 0.1256615170089e+02, 0.5611445335148e-02, 0.0000000000000e+00, 0.0000000000000e+00, 0.1046664295572e-03, 0.1667225416770e+01, 0.1884922755134e+02, 0.3110842534677e-04, 0.6687513390251e+00, 0.8399684731857e+02, 0.2552413503550e-04, 0.5830637358413e+00, 0.5296909721118e+00, 0.2137207845781e-04, 0.1092330954011e+01, 0.1577343543434e+01, 0.1680240182951e-04, 0.4955366134987e+00, 0.6279552690824e+01, 0.1679012370795e-04, 0.6153014091901e+01, 0.6286599010068e+01, 0.1445526946777e-04, 0.3472744100492e+01, 0.2352866153506e+01, 0.1091038246184e-04, 0.3689845786119e+01, 0.5223693906222e+01, 0.9344399733932e-05, 0.6073934645672e+01, 0.1203646072878e+02, 0.8993182910652e-05, 0.3175705249069e+01, 0.1021328554739e+02, 0.5665546034116e-05, 0.2152484672246e+01, 0.1059381944224e+01, 0.6844146703035e-05, 0.1306964099750e+01, 0.5753384878334e+01, 0.7346610905565e-05, 0.4354980070466e+01, 0.3981490189893e+00, 0.6815396474414e-05, 0.2218229211267e+01, 0.4705732307012e+01, 0.6112787253053e-05, 0.5384788425458e+01, 0.6812766822558e+01, 0.4518120711239e-05, 0.6087604012291e+01, 0.5884926831456e+01, 0.4521963430706e-05, 0.1279424524906e+01, 0.6256777527156e+01, 0.4497426764085e-05, 0.5369129144266e+01, 0.6309374173736e+01, 0.4062190566959e-05, 0.5436473303367e+00, 0.6681224869435e+01, 0.5412193480192e-05, 0.7867838528395e+00, 0.7755226100720e+00, 0.5469839049386e-05, 0.1461440311134e+01, 0.1414349524433e+02, 0.5205264083477e-05, 0.4432944696116e+01, 0.7860419393880e+01, 0.2149759935455e-05, 0.4502237496846e+01, 0.1150676975667e+02, 0.2279109618501e-05, 0.1239441308815e+01, 0.7058598460518e+01, 0.2259282939683e-05, 0.3272430985331e+01, 0.4694002934110e+01, 0.2558950271319e-05, 0.2265471086404e+01, 0.1216800268190e+02, 0.2561581447555e-05, 0.1454740653245e+01, 0.7099330490126e+00, 0.1781441115440e-05, 0.2962068630206e+01, 0.7962980379786e+00, 0.1612005874644e-05, 0.1473255041006e+01, 0.5486777812467e+01, 0.1818630667105e-05, 0.3743903293447e+00, 0.6283008715021e+01, 0.1818601377529e-05, 0.6274174354554e+01, 0.6283142985870e+01, 0.1554475925257e-05, 0.1624110906816e+01, 0.2513230340178e+02, 0.2090948029241e-05, 0.5852052276256e+01, 0.1179062909082e+02, 0.2000176345460e-05, 0.4072093298513e+01, 0.1778984560711e+02, 0.1289535917759e-05, 0.5217019331069e+01, 0.7079373888424e+01, 0.1281135307881e-05, 0.4802054538934e+01, 0.3738761453707e+01, 0.1518229005692e-05, 0.8691914742502e+00, 0.2132990797783e+00, 0.9450128579027e-06, 0.4601859529950e+01, 0.1097707878456e+02, 0.7781119494996e-06, 0.1844352816694e+01, 0.8827390247185e+01, 0.7733407759912e-06, 0.3582790154750e+01, 0.5507553240374e+01, 0.7350644318120e-06, 0.2695277788230e+01, 0.1589072916335e+01, 0.6535928827023e-06, 0.3651327986142e+01, 0.1176985366291e+02, 0.6324624183656e-06, 0.2241302375862e+01, 0.6262300422539e+01, 0.6298565300557e-06, 0.4407122406081e+01, 0.6303851278352e+01, 0.8587037089179e-06, 0.3024307223119e+01, 0.1672837615881e+03, 0.8299954491035e-06, 0.6192539428237e+01, 0.3340612434717e+01, 0.6311263503401e-06, 0.2014758795416e+01, 0.7113454667900e-02, 0.6005646745452e-06, 0.3399500503397e+01, 0.4136910472696e+01, 0.7917715109929e-06, 0.2493386877837e+01, 0.6069776770667e+01, 0.7556958099685e-06, 0.4159491740143e+01, 0.6496374930224e+01, 0.6773228244949e-06, 0.4034162934230e+01, 0.9437762937313e+01, 0.5370708577847e-06, 0.1562219163734e+01, 0.1194447056968e+01, 0.5710804266203e-06, 0.2662730803386e+01, 0.6282095334605e+01, 0.5709824583726e-06, 0.3985828430833e+01, 0.6284056366286e+01, 0.5143950896447e-06, 0.1308144688689e+01, 0.6290189305114e+01, 0.5088010604546e-06, 0.5352817214804e+01, 0.6275962395778e+01, 0.4960369085172e-06, 0.2644267922349e+01, 0.6127655567643e+01, 0.4803137891183e-06, 0.4008844192080e+01, 0.6438496133249e+01, 0.5731747768225e-06, 0.3794550174597e+01, 0.3154687086868e+01, 0.4735947960579e-06, 0.6107118308982e+01, 0.3128388763578e+01, 0.4808348796625e-06, 0.4771458618163e+01, 0.8018209333619e+00, 0.4115073743137e-06, 0.3327111335159e+01, 0.8429241228195e+01, 0.5230575889287e-06, 0.5305708551694e+01, 0.1336797263425e+02, 0.5133977889215e-06, 0.5784230738814e+01, 0.1235285262111e+02, 0.5065815825327e-06, 0.2052064793679e+01, 0.1185621865188e+02, 0.4339831593868e-06, 0.3644994195830e+01, 0.1726015463500e+02, 0.3952928638953e-06, 0.4930376436758e+01, 0.5481254917084e+01, 0.4898498111942e-06, 0.4542084219731e+00, 0.9225539266174e+01, 0.4757490209328e-06, 0.3161126388878e+01, 0.5856477690889e+01, 0.4727701669749e-06, 0.6214993845446e+00, 0.2544314396739e+01, 0.3800966681863e-06, 0.3040132339297e+01, 0.4265981595566e+00, 0.3257301077939e-06, 0.8064977360087e+00, 0.3930209696940e+01, 0.3255810528674e-06, 0.1974147981034e+01, 0.2146165377750e+01, 0.3252029748187e-06, 0.2845924913135e+01, 0.4164311961999e+01, 0.3255505635308e-06, 0.3017900824120e+01, 0.5088628793478e+01, 0.2801345211990e-06, 0.6109717793179e+01, 0.1256967486051e+02, 0.3688987740970e-06, 0.2911550235289e+01, 0.1807370494127e+02, 0.2475153429458e-06, 0.2179146025856e+01, 0.2629832328990e-01, 0.3033457749150e-06, 0.1994161050744e+01, 0.4535059491685e+01, 0.2186743763110e-06, 0.5125687237936e+01, 0.1137170464392e+02, 0.2764777032774e-06, 0.4822646860252e+00, 0.1256262854127e+02, 0.2199028768592e-06, 0.4637633293831e+01, 0.1255903824622e+02, 0.2046482824760e-06, 0.1467038733093e+01, 0.7084896783808e+01, 0.2611209147507e-06, 0.3044718783485e+00, 0.7143069561767e+02, 0.2286079656818e-06, 0.4764220356805e+01, 0.8031092209206e+01, 0.1855071202587e-06, 0.3383637774428e+01, 0.1748016358760e+01, 0.2324669506784e-06, 0.6189088449251e+01, 0.1831953657923e+02, 0.1709528015688e-06, 0.5874966729774e+00, 0.4933208510675e+01, 0.2168156875828e-06, 0.4302994009132e+01, 0.1044738781244e+02, 0.2106675556535e-06, 0.3800475419891e+01, 0.7477522907414e+01, 0.1430213830465e-06, 0.1294660846502e+01, 0.2942463415728e+01, 0.1388396901944e-06, 0.4594797202114e+01, 0.8635942003952e+01, 0.1922258844190e-06, 0.4943044543591e+00, 0.1729818233119e+02, 0.1888460058292e-06, 0.2426943912028e+01, 0.1561374759853e+03, 0.1789449386107e-06, 0.1582973303499e+00, 0.1592596075957e+01, 0.1360803685374e-06, 0.5197240440504e+01, 0.1309584267300e+02, 0.1504038014709e-06, 0.3120360916217e+01, 0.1649636139783e+02, 0.1382769533389e-06, 0.6164702888205e+01, 0.7632943190217e+01, 0.1438059769079e-06, 0.1437423770979e+01, 0.2042657109477e+02, 0.1326303260037e-06, 0.3609688799679e+01, 0.1213955354133e+02, 0.1159244950540e-06, 0.5463018167225e+01, 0.5331357529664e+01, 0.1433118149136e-06, 0.6028909912097e+01, 0.7342457794669e+01, 0.1234623148594e-06, 0.3109645574997e+01, 0.6279485555400e+01, 0.1233949875344e-06, 0.3539359332866e+01, 0.6286666145492e+01, 0.9927196061299e-07, 0.1259321569772e+01, 0.7234794171227e+01, 0.1242302191316e-06, 0.1065949392609e+01, 0.1511046609763e+02, 0.1098402195201e-06, 0.2192508743837e+01, 0.1098880815746e+02, 0.1158191395315e-06, 0.4054411278650e+01, 0.5729506548653e+01, 0.9048475596241e-07, 0.5429764748518e+01, 0.9623688285163e+01, 0.8889853269023e-07, 0.5046586206575e+01, 0.6148010737701e+01, 0.1048694242164e-06, 0.2628858030806e+01, 0.6836645152238e+01, 0.1112308378646e-06, 0.4177292719907e+01, 0.1572083878776e+02, 0.8631729709901e-07, 0.1601345232557e+01, 0.6418140963190e+01, 0.8527816951664e-07, 0.2463888997513e+01, 0.1471231707864e+02, 0.7892139456991e-07, 0.3154022088718e+01, 0.2118763888447e+01, 0.1051782905236e-06, 0.4795035816088e+01, 0.1349867339771e+01, 0.1048219943164e-06, 0.2952983395230e+01, 0.5999216516294e+01, 0.7435760775143e-07, 0.5420547991464e+01, 0.6040347114260e+01, 0.9869574106949e-07, 0.3695646753667e+01, 0.6566935184597e+01, 0.9156886364226e-07, 0.3922675306609e+01, 0.5643178611111e+01, 0.7006834356188e-07, 0.1233968624861e+01, 0.6525804586632e+01, 0.9806170182601e-07, 0.1919542280684e+01, 0.2122839202813e+02, 0.9052289673607e-07, 0.4615902724369e+01, 0.4690479774488e+01, 0.7554200867893e-07, 0.1236863719072e+01, 0.1253985337760e+02, 0.8215741286498e-07, 0.3286800101559e+00, 0.1097355562493e+02, 0.7185178575397e-07, 0.5880942158367e+01, 0.6245048154254e+01, 0.7130726476180e-07, 0.7674871987661e+00, 0.6321103546637e+01, 0.6650894461162e-07, 0.6987129150116e+00, 0.5327476111629e+01, 0.7396888823688e-07, 0.3576824794443e+01, 0.5368044267797e+00, 0.7420588884775e-07, 0.5033615245369e+01, 0.2354323048545e+02, 0.6141181642908e-07, 0.9449927045673e+00, 0.1296430071988e+02, 0.6373557924058e-07, 0.6206342280341e+01, 0.9517183207817e+00, 0.6359474329261e-07, 0.5036079095757e+01, 0.1990745094947e+01, 0.5740173582646e-07, 0.6105106371350e+01, 0.9555997388169e+00, 0.7019864084602e-07, 0.7237747359018e+00, 0.5225775174439e+00, 0.6398054487042e-07, 0.3976367969666e+01, 0.2407292145756e+02, 0.7797092650498e-07, 0.4305423910623e+01, 0.2200391463820e+02, 0.6466760000900e-07, 0.3500136825200e+01, 0.5230807360890e+01, 0.7529417043890e-07, 0.3514779246100e+01, 0.1842262939178e+02, 0.6924571140892e-07, 0.2743457928679e+01, 0.1554202828031e+00, 0.6220798650222e-07, 0.2242598118209e+01, 0.1845107853235e+02, 0.5870209391853e-07, 0.2332832707527e+01, 0.6398972393349e+00, 0.6263953473888e-07, 0.2191105358956e+01, 0.6277552955062e+01, 0.6257781390012e-07, 0.4457559396698e+01, 0.6288598745829e+01, 0.5697304945123e-07, 0.3499234761404e+01, 0.1551045220144e+01, 0.6335438746791e-07, 0.6441691079251e+00, 0.5216580451554e+01, 0.6377258441152e-07, 0.2252599151092e+01, 0.5650292065779e+01, 0.6484841818165e-07, 0.1992812417646e+01, 0.1030928125552e+00, 0.4735551485250e-07, 0.3744672082942e+01, 0.1431416805965e+02, 0.4628595996170e-07, 0.1334226211745e+01, 0.5535693017924e+00, 0.6258152336933e-07, 0.4395836159154e+01, 0.2608790314060e+02, 0.6196171366594e-07, 0.2587043007997e+01, 0.8467247584405e+02, 0.6159556952126e-07, 0.4782499769128e+01, 0.2394243902548e+03, 0.4987741172394e-07, 0.7312257619924e+00, 0.7771377146812e+02, 0.5459280703142e-07, 0.3001376372532e+01, 0.6179983037890e+01, 0.4863461189999e-07, 0.3767222128541e+01, 0.9027992316901e+02, 0.5349912093158e-07, 0.3663594450273e+01, 0.6386168663001e+01, 0.5673725607806e-07, 0.4331187919049e+01, 0.6915859635113e+01, 0.4745485060512e-07, 0.5816195745518e+01, 0.6282970628506e+01, 0.4745379005326e-07, 0.8323672435672e+00, 0.6283181072386e+01, 0.4049002796321e-07, 0.3785023976293e+01, 0.6254626709878e+01, 0.4247084014515e-07, 0.2378220728783e+01, 0.7875671926403e+01, 0.4026912363055e-07, 0.2864103423269e+01, 0.6311524991013e+01, 0.4062935011774e-07, 0.2415408595975e+01, 0.3634620989887e+01, 0.5347771048509e-07, 0.3343479309801e+01, 0.2515860172507e+02, 0.4829494136505e-07, 0.2821742398262e+01, 0.5760498333002e+01, 0.4342554404599e-07, 0.5624662458712e+01, 0.7238675589263e+01, 0.4021599184361e-07, 0.5557250275009e+00, 0.1101510648075e+02, 0.4104900474558e-07, 0.3296691780005e+01, 0.6709674010002e+01, 0.4376532905131e-07, 0.3814443999443e+01, 0.6805653367890e+01, 0.3314590480650e-07, 0.3560229189250e+01, 0.1259245002418e+02, 0.3232421839643e-07, 0.5185389180568e+01, 0.1066495398892e+01, 0.3541176318876e-07, 0.3921381909679e+01, 0.9917696840332e+01, 0.3689831242681e-07, 0.4190658955386e+01, 0.1192625446156e+02, 0.3890605376774e-07, 0.5546023371097e+01, 0.7478166569050e-01, 0.3038559339780e-07, 0.6231032794494e+01, 0.1256621883632e+02, 0.3137083969782e-07, 0.6207063419190e+01, 0.4292330755499e+01, 0.4024004081854e-07, 0.1195257375713e+01, 0.1334167431096e+02, 0.3300234879283e-07, 0.1804694240998e+01, 0.1057540660594e+02, 0.3635399155575e-07, 0.5597811343500e+01, 0.6208294184755e+01, 0.3032668691356e-07, 0.3191059366530e+01, 0.1805292951336e+02, 0.2809652069058e-07, 0.4094348032570e+01, 0.3523159621801e-02, 0.3696955383823e-07, 0.5219282738794e+01, 0.5966683958112e+01, 0.3562894142503e-07, 0.1037247544554e+01, 0.6357857516136e+01, 0.3510598524148e-07, 0.1430020816116e+01, 0.6599467742779e+01, 0.3617736142953e-07, 0.3002911403677e+01, 0.6019991944201e+01, 0.2624524910730e-07, 0.2437046757292e+01, 0.6702560555334e+01, 0.2535824204490e-07, 0.1581594689647e+01, 0.3141537925223e+02, 0.3519787226257e-07, 0.5379863121521e+01, 0.2505706758577e+03, 0.2578406709982e-07, 0.4904222639329e+01, 0.1673046366289e+02, 0.3423887981473e-07, 0.3646448997315e+01, 0.6546159756691e+01, 0.2776083886467e-07, 0.3307829300144e+01, 0.1272157198369e+02, 0.3379592818379e-07, 0.1747541251125e+01, 0.1494531617769e+02, 0.3050255426284e-07, 0.1784689432607e-01, 0.4732030630302e+01, 0.2652378350236e-07, 0.4420055276260e+01, 0.5863591145557e+01, 0.2374498173768e-07, 0.3629773929208e+01, 0.2388894113936e+01, 0.2716451255140e-07, 0.3079623706780e+01, 0.1202934727411e+02, 0.3038583699229e-07, 0.3312487903507e+00, 0.1256608456547e+02, 0.2220681228760e-07, 0.5265520401774e+01, 0.1336244973887e+02, 0.3044156540912e-07, 0.4766664081250e+01, 0.2908881142201e+02, 0.2731859923561e-07, 0.5069146530691e+01, 0.1391601904066e+02, 0.2285603018171e-07, 0.5954935112271e+01, 0.6076890225335e+01, 0.2025006454555e-07, 0.4061789589267e+01, 0.4701116388778e+01, 0.2012597519804e-07, 0.2485047705241e+01, 0.6262720680387e+01, 0.2003406962258e-07, 0.4163779209320e+01, 0.6303431020504e+01, 0.2207863441371e-07, 0.6923839133828e+00, 0.6489261475556e+01, 0.2481374305624e-07, 0.5944173595676e+01, 0.1204357418345e+02, 0.2130923288870e-07, 0.4641013671967e+01, 0.5746271423666e+01, 0.2446370543391e-07, 0.6125796518757e+01, 0.1495633313810e+00, 0.1932492759052e-07, 0.2234572324504e+00, 0.1352175143971e+02, 0.2600122568049e-07, 0.4281012405440e+01, 0.4590910121555e+01, 0.2431754047488e-07, 0.1429943874870e+00, 0.1162474756779e+01, 0.1875902869209e-07, 0.9781803816948e+00, 0.6279194432410e+01, 0.1874381139426e-07, 0.5670368130173e+01, 0.6286957268481e+01, 0.2156696047173e-07, 0.2008985006833e+01, 0.1813929450232e+02, 0.1965076182484e-07, 0.2566186202453e+00, 0.4686889479442e+01, 0.2334816372359e-07, 0.4408121891493e+01, 0.1002183730415e+02, 0.1869937408802e-07, 0.5272745038656e+01, 0.2427287361862e+00, 0.2436236460883e-07, 0.4407720479029e+01, 0.9514313292143e+02, 0.1761365216611e-07, 0.1943892315074e+00, 0.1351787002167e+02, 0.2156289480503e-07, 0.1418570924545e+01, 0.6037244212485e+01, 0.2164748979255e-07, 0.4724603439430e+01, 0.2301353951334e+02, 0.2222286670853e-07, 0.2400266874598e+01, 0.1266924451345e+02, 0.2070901414929e-07, 0.5230348028732e+01, 0.6528907488406e+01, 0.1792745177020e-07, 0.2099190328945e+01, 0.6819880277225e+01, 0.1841802068445e-07, 0.3467527844848e+00, 0.6514761976723e+02, 0.1578401631718e-07, 0.7098642356340e+00, 0.2077542790660e-01, 0.1561690152531e-07, 0.5943349620372e+01, 0.6272439236156e+01, 0.1558591045463e-07, 0.7040653478980e+00, 0.6293712464735e+01, 0.1737356469576e-07, 0.4487064760345e+01, 0.1765478049437e+02, 0.1434755619991e-07, 0.2993391570995e+01, 0.1102062672231e+00, 0.1482187806654e-07, 0.2278049198251e+01, 0.1052268489556e+01, 0.1424812827089e-07, 0.1682114725827e+01, 0.1311972100268e+02, 0.1380282448623e-07, 0.3262668602579e+01, 0.1017725758696e+02, 0.1811481244566e-07, 0.3187771221777e+01, 0.1887552587463e+02, 0.1504446185696e-07, 0.5650162308647e+01, 0.7626583626240e-01, 0.1740776154137e-07, 0.5487068607507e+01, 0.1965104848470e+02, 0.1374339536251e-07, 0.5745688172201e+01, 0.6016468784579e+01, 0.1761377477704e-07, 0.5748060203659e+01, 0.2593412433514e+02, 0.1535138225795e-07, 0.6226848505790e+01, 0.9411464614024e+01, 0.1788140543676e-07, 0.6189318878563e+01, 0.3301902111895e+02, 0.1375002807996e-07, 0.5371812884394e+01, 0.6327837846670e+00, 0.1242115758632e-07, 0.1471687569712e+01, 0.3894181736510e+01, 0.1450977333938e-07, 0.4143836662127e+01, 0.1277945078067e+02, 0.1297579575023e-07, 0.9003477661957e+00, 0.6549682916313e+01, 0.1462667934821e-07, 0.5760505536428e+01, 0.1863592847156e+02, 0.1381774374799e-07, 0.1085471729463e+01, 0.2379164476796e+01, 0.1682333169307e-07, 0.5409870870133e+01, 0.1620077269078e+02, 0.1190812918837e-07, 0.1397205174601e+01, 0.1149965630200e+02, 0.1221434762106e-07, 0.9001804809095e+00, 0.1257326515556e+02, 0.1549934644860e-07, 0.4262528275544e+01, 0.1820933031200e+02, 0.1252138953050e-07, 0.1411642012027e+01, 0.6993008899458e+01, 0.1237078905387e-07, 0.2844472403615e+01, 0.2435678079171e+02, 0.1446953389615e-07, 0.5295835522223e+01, 0.3813291813120e-01, 0.1388446457170e-07, 0.4969428135497e+01, 0.2458316379602e+00, 0.1019339179228e-07, 0.2491369561806e+01, 0.6112403035119e+01, 0.1258880815343e-07, 0.4679426248976e+01, 0.5429879531333e+01, 0.1297768238261e-07, 0.1074509953328e+01, 0.1249137003520e+02, 0.9913505718094e-08, 0.4735097918224e+01, 0.6247047890016e+01, 0.9830453155969e-08, 0.4158649187338e+01, 0.6453748665772e+01, 0.1192615865309e-07, 0.3438208613699e+01, 0.6290122169689e+01, 0.9835874798277e-08, 0.1913300781229e+01, 0.6319103810876e+01, 0.9639087569277e-08, 0.9487683644125e+00, 0.8273820945392e+01, 0.1175716107001e-07, 0.3228141664287e+01, 0.6276029531202e+01, 0.1018926508678e-07, 0.2216607854300e+01, 0.1254537627298e+02, 0.9500087869225e-08, 0.2625116459733e+01, 0.1256517118505e+02, 0.9664192916575e-08, 0.5860562449214e+01, 0.6259197520765e+01, 0.9612858712203e-08, 0.7885682917381e+00, 0.6306954180126e+01, 0.1117645675413e-07, 0.3932148831189e+01, 0.1779695906178e+02, 0.1158864052160e-07, 0.9995605521691e+00, 0.1778273215245e+02, 0.9021043467028e-08, 0.5263769742673e+01, 0.6172869583223e+01, 0.8836134773563e-08, 0.1496843220365e+01, 0.1692165728891e+01, 0.1045872200691e-07, 0.7009039517214e+00, 0.2204125344462e+00, 0.1211463487798e-07, 0.4041544938511e+01, 0.8257698122054e+02, 0.8541990804094e-08, 0.1447586692316e+01, 0.6393282117669e+01, 0.1038720703636e-07, 0.4594249718112e+00, 0.1550861511662e+02, 0.1126722351445e-07, 0.3925550579036e+01, 0.2061856251104e+00, 0.8697373859631e-08, 0.4411341856037e+01, 0.9491756770005e+00, 0.8869380028441e-08, 0.2402659724813e+01, 0.3903911373650e+01, 0.9247014693258e-08, 0.1401579743423e+01, 0.6267823317922e+01, 0.9205062930950e-08, 0.5245978000814e+01, 0.6298328382969e+01, 0.8000745038049e-08, 0.3590803356945e+01, 0.2648454860559e+01, 0.9168973650819e-08, 0.2470150501679e+01, 0.1498544001348e+03, 0.1075444949238e-07, 0.1328606161230e+01, 0.3694923081589e+02, 0.7817298525817e-08, 0.6162256225998e+01, 0.4804209201333e+01, 0.9541469226356e-08, 0.3942568967039e+01, 0.1256713221673e+02, 0.9821910122027e-08, 0.2360246287233e+00, 0.1140367694411e+02, 0.9897822023777e-08, 0.4619805634280e+01, 0.2280573557157e+02, 0.7737289283765e-08, 0.3784727847451e+01, 0.7834121070590e+01, 0.9260204034710e-08, 0.2223352487601e+01, 0.2787043132925e+01, 0.7320252888486e-08, 0.1288694636874e+01, 0.6282655592598e+01, 0.7319785780946e-08, 0.5359869567774e+01, 0.6283496108294e+01, 0.7147219933778e-08, 0.5516616675856e+01, 0.1725663147538e+02, 0.7946502829878e-08, 0.2630459984567e+01, 0.1241073141809e+02, 0.9001711808932e-08, 0.2849815827227e+01, 0.6281591679874e+01, 0.8994041507257e-08, 0.3795244450750e+01, 0.6284560021018e+01, 0.8298582787358e-08, 0.5236413127363e+00, 0.1241658836951e+02, 0.8526596520710e-08, 0.4794605424426e+01, 0.1098419223922e+02, 0.8209822103197e-08, 0.1578752370328e+01, 0.1096996532989e+02, 0.6357049861094e-08, 0.5708926113761e+01, 0.1596186371003e+01, 0.7370473179049e-08, 0.3842402530241e+01, 0.4061219149443e+01, 0.7232154664726e-08, 0.3067548981535e+01, 0.1610006857377e+03, 0.6328765494903e-08, 0.1313930030069e+01, 0.1193336791622e+02, 0.8030064908595e-08, 0.3488500408886e+01, 0.8460828644453e+00, 0.6275464259232e-08, 0.1532061626198e+01, 0.8531963191132e+00, 0.7051897446325e-08, 0.3285859929993e+01, 0.5849364236221e+01, 0.6161593705428e-08, 0.1477341999464e+01, 0.5573142801433e+01, 0.7754683957278e-08, 0.1586118663096e+01, 0.8662240327241e+01, 0.5889928990701e-08, 0.1304887868803e+01, 0.1232342296471e+02, 0.5705756047075e-08, 0.4555333589350e+01, 0.1258692712880e+02, 0.5964178808332e-08, 0.3001762842062e+01, 0.5333900173445e+01, 0.6712446027467e-08, 0.4886780007595e+01, 0.1171295538178e+02, 0.5941809275464e-08, 0.4701509603824e+01, 0.9779108567966e+01, 0.5466993627395e-08, 0.4588357817278e+01, 0.1884211409667e+02, 0.6340512090980e-08, 0.1164543038893e+01, 0.5217580628120e+02, 0.6325505710045e-08, 0.3919171259645e+01, 0.1041998632314e+02, 0.6164789509685e-08, 0.2143828253542e+01, 0.6151533897323e+01, 0.5263330812430e-08, 0.6066564434241e+01, 0.1885275071096e+02, 0.5597087780221e-08, 0.2926316429472e+01, 0.4337116142245e+00, 0.5396556236817e-08, 0.3244303591505e+01, 0.6286362197481e+01, 0.5396615148223e-08, 0.3404304703662e+01, 0.6279789503410e+01, 0.7091832443341e-08, 0.8532377803192e+00, 0.4907302013889e+01, 0.6572352589782e-08, 0.4901966774419e+01, 0.1176433076753e+02, 0.5960236060795e-08, 0.1874672315797e+01, 0.1422690933580e-01, 0.5125480043511e-08, 0.3735726064334e+01, 0.1245594543367e+02, 0.5928241866410e-08, 0.4502033899935e+01, 0.6414617803568e+01, 0.5249600357424e-08, 0.4372334799878e+01, 0.1151388321134e+02, 0.6059171276087e-08, 0.2581617302908e+01, 0.6062663316000e+01, 0.5295235081662e-08, 0.2974811513158e+01, 0.3496032717521e+01, 0.5820561875933e-08, 0.1796073748244e+00, 0.2838593341516e+00, 0.4754696606440e-08, 0.1981998136973e+01, 0.3104930017775e+01, 0.6385053548955e-08, 0.2559174171605e+00, 0.6133512519065e+01, 0.6589828273941e-08, 0.2750967106776e+01, 0.4087944051283e+02, 0.5383376567189e-08, 0.6325947523578e+00, 0.2248384854122e+02, 0.5928941683538e-08, 0.1672304519067e+01, 0.1581959461667e+01, 0.4816060709794e-08, 0.3512566172575e+01, 0.9388005868221e+01, 0.6003381586512e-08, 0.5610932219189e+01, 0.5326786718777e+01, 0.5504225393105e-08, 0.4037501131256e+01, 0.6503488384892e+01, 0.5353772620129e-08, 0.6122774968240e+01, 0.1735668374386e+03, 0.5786253768544e-08, 0.5527984999515e+01, 0.1350651127443e+00, 0.5065706702002e-08, 0.9980765573624e+00, 0.1248988586463e+02, 0.5972838885276e-08, 0.6044489493203e+01, 0.2673594526851e+02, 0.5323585877961e-08, 0.3924265998147e+01, 0.4171425416666e+01, 0.5210772682858e-08, 0.6220111376901e+01, 0.2460261242967e+02, 0.4726549040535e-08, 0.3716043206862e+01, 0.7232251527446e+01, 0.6029425105059e-08, 0.8548704071116e+00, 0.3227113045244e+03, 0.4481542826513e-08, 0.1426925072829e+01, 0.5547199253223e+01, 0.5836024505068e-08, 0.7135651752625e-01, 0.7285056171570e+02, 0.4137046613272e-08, 0.5330767643283e+01, 0.1087398597200e+02, 0.5171977473924e-08, 0.4494262335353e+00, 0.1884570439172e+02, 0.5694429833732e-08, 0.2952369582215e+01, 0.9723862754494e+02, 0.4009158925298e-08, 0.3500003416535e+01, 0.6244942932314e+01, 0.4784939596873e-08, 0.6196709413181e+01, 0.2929661536378e+02, 0.3983725022610e-08, 0.5103690031897e+01, 0.4274518229222e+01, 0.3870535232462e-08, 0.3187569587401e+01, 0.6321208768577e+01, 0.5140501213951e-08, 0.1668924357457e+01, 0.1232032006293e+02, 0.3849034819355e-08, 0.4445722510309e+01, 0.1726726808967e+02, 0.4002383075060e-08, 0.5226224152423e+01, 0.7018952447668e+01, 0.3890719543549e-08, 0.4371166550274e+01, 0.1491901785440e+02, 0.4887084607881e-08, 0.5973556689693e+01, 0.1478866649112e+01, 0.3739939287592e-08, 0.2089084714600e+01, 0.6922973089781e+01, 0.5031925918209e-08, 0.4658371936827e+01, 0.1715706182245e+02, 0.4387748764954e-08, 0.4825580552819e+01, 0.2331413144044e+03, 0.4147398098865e-08, 0.3739003524998e+01, 0.1376059875786e+02, 0.3719089993586e-08, 0.1148941386536e+01, 0.6297302759782e+01, 0.3934238461056e-08, 0.1559893008343e+01, 0.7872148766781e+01, 0.3672471375622e-08, 0.5516145383612e+01, 0.6268848941110e+01, 0.3768911277583e-08, 0.6116053700563e+01, 0.4157198507331e+01, 0.4033388417295e-08, 0.5076821746017e+01, 0.1567108171867e+02, 0.3764194617832e-08, 0.8164676232075e+00, 0.3185192151914e+01, 0.4840628226284e-08, 0.1360479453671e+01, 0.1252801878276e+02, 0.4949443923785e-08, 0.2725622229926e+01, 0.1617106187867e+03, 0.4117393089971e-08, 0.6054459628492e+00, 0.5642198095270e+01, 0.3925754020428e-08, 0.8570462135210e+00, 0.2139354194808e+02, 0.3630551757923e-08, 0.3552067338279e+01, 0.6294805223347e+01, 0.3627274802357e-08, 0.3096565085313e+01, 0.6271346477544e+01, 0.3806143885093e-08, 0.6367751709777e+00, 0.1725304118033e+02, 0.4433254641565e-08, 0.4848461503937e+01, 0.7445550607224e+01, 0.3712319846576e-08, 0.1331950643655e+01, 0.4194847048887e+00, 0.3849847534783e-08, 0.4958368297746e+00, 0.9562891316684e+00, 0.3483955430165e-08, 0.2237215515707e+01, 0.1161697602389e+02, 0.3961912730982e-08, 0.3332402188575e+01, 0.2277943724828e+02, 0.3419978244481e-08, 0.5785600576016e+01, 0.1362553364512e+02, 0.3329417758177e-08, 0.9812676559709e-01, 0.1685848245639e+02, 0.4207206893193e-08, 0.9494780468236e+00, 0.2986433403208e+02, 0.3268548976410e-08, 0.1739332095686e+00, 0.5749861718712e+01, 0.3321880082685e-08, 0.1423354800666e+01, 0.6279143387820e+01, 0.4503173010852e-08, 0.2314972675293e+00, 0.1385561574497e+01, 0.4316599090954e-08, 0.1012646782616e+00, 0.4176041334900e+01, 0.3283493323850e-08, 0.5233306881265e+01, 0.6287008313071e+01, 0.3164033542343e-08, 0.4005597257511e+01, 0.2099539292909e+02, 0.4159720956725e-08, 0.5365676242020e+01, 0.5905702259363e+01, 0.3565176892217e-08, 0.4284440620612e+01, 0.3932462625300e-02, 0.3514440950221e-08, 0.4270562636575e+01, 0.7335344340001e+01, 0.3540596871909e-08, 0.5953553201060e+01, 0.1234573916645e+02, 0.2960769905118e-08, 0.1115180417718e+01, 0.2670964694522e+02, 0.2962213739684e-08, 0.3863811918186e+01, 0.6408777551755e+00, 0.3883556700251e-08, 0.1268617928302e+01, 0.6660449441528e+01, 0.2919225516346e-08, 0.4908605223265e+01, 0.1375773836557e+01, 0.3115158863370e-08, 0.3744519976885e+01, 0.3802769619140e-01, 0.4099438144212e-08, 0.4173244670532e+01, 0.4480965020977e+02, 0.2899531858964e-08, 0.5910601428850e+01, 0.2059724391010e+02, 0.3289733429855e-08, 0.2488050078239e+01, 0.1081813534213e+02, 0.3933075612875e-08, 0.1122363652883e+01, 0.3773735910827e+00, 0.3021403764467e-08, 0.4951973724904e+01, 0.2982630633589e+02, 0.2798598949757e-08, 0.5117057845513e+01, 0.1937891852345e+02, 0.3397421302707e-08, 0.6104159180476e+01, 0.6923953605621e+01, 0.3720398002179e-08, 0.1184933429829e+01, 0.3066615496545e+02, 0.3598484186267e-08, 0.3505282086105e+01, 0.6147450479709e+01, 0.3694594027310e-08, 0.2286651088141e+01, 0.2636725487657e+01, 0.2680444152969e-08, 0.1871816775482e+00, 0.6816289982179e+01, 0.3497574865641e-08, 0.3143251755431e+01, 0.6418701221183e+01, 0.3130274129494e-08, 0.2462167316018e+01, 0.1235996607578e+02, 0.3241119069551e-08, 0.4256374004686e+01, 0.1652265972112e+02, 0.2601960842061e-08, 0.4970362941425e+01, 0.1045450126711e+02, 0.2690601527504e-08, 0.2372657824898e+01, 0.3163918923335e+00, 0.2908688152664e-08, 0.4232652627721e+01, 0.2828699048865e+02, 0.3120456131875e-08, 0.3925747001137e+00, 0.2195415756911e+02, 0.3148855423384e-08, 0.3093478330445e+01, 0.1172006883645e+02, 0.3051044261017e-08, 0.5560948248212e+01, 0.6055599646783e+01, 0.2826006876660e-08, 0.5072790310072e+01, 0.5120601093667e+01, 0.3100034191711e-08, 0.4998530231096e+01, 0.1799603123222e+02, 0.2398771640101e-08, 0.2561739802176e+01, 0.6255674361143e+01, 0.2384002842728e-08, 0.4087420284111e+01, 0.6310477339748e+01, 0.2842146517568e-08, 0.2515048217955e+01, 0.5469525544182e+01, 0.2847674371340e-08, 0.5235326497443e+01, 0.1034429499989e+02, 0.2903722140764e-08, 0.1088200795797e+01, 0.6510552054109e+01, 0.3187610710605e-08, 0.4710624424816e+01, 0.1693792562116e+03, 0.3048869992813e-08, 0.2857975896445e+00, 0.8390110365991e+01, 0.2860216950984e-08, 0.2241619020815e+01, 0.2243449970715e+00, 0.2701117683113e-08, 0.6651573305272e-01, 0.6129297044991e+01, 0.2509891590152e-08, 0.1285135324585e+01, 0.1044027435778e+02, 0.2623200252223e-08, 0.2981229834530e+00, 0.6436854655901e+01, 0.2622541669202e-08, 0.6122470726189e+01, 0.9380959548977e+01, 0.2818435667099e-08, 0.4251087148947e+01, 0.5934151399930e+01, 0.2365196797465e-08, 0.3465070460790e+01, 0.2470570524223e+02, 0.2358704646143e-08, 0.5791603815350e+01, 0.8671969964381e+01, 0.2388299481390e-08, 0.4142483772941e+01, 0.7096626156709e+01, 0.1996041217224e-08, 0.2101901889496e+01, 0.1727188400790e+02, 0.2687593060336e-08, 0.1526689456959e+01, 0.7075506709219e+02, 0.2618913670810e-08, 0.2397684236095e+01, 0.6632000300961e+01, 0.2571523050364e-08, 0.5751929456787e+00, 0.6206810014183e+01, 0.2582135006946e-08, 0.5595464352926e+01, 0.4873985990671e+02, 0.2372530190361e-08, 0.5092689490655e+01, 0.1590676413561e+02, 0.2357178484712e-08, 0.4444363527851e+01, 0.3097883698531e+01, 0.2451590394723e-08, 0.3108251687661e+01, 0.6612329252343e+00, 0.2370045949608e-08, 0.2608133861079e+01, 0.3459636466239e+02, 0.2268997267358e-08, 0.3639717753384e+01, 0.2844914056730e-01, 0.1731432137906e-08, 0.1741898445707e+00, 0.2019909489111e+02, 0.1629869741622e-08, 0.3902225646724e+01, 0.3035599730800e+02, 0.2206215801974e-08, 0.4971131250731e+01, 0.6281667977667e+01, 0.2205469554680e-08, 0.1677462357110e+01, 0.6284483723224e+01, 0.2148792362509e-08, 0.4236259604006e+01, 0.1980482729015e+02, 0.1873733657847e-08, 0.5926814998687e+01, 0.2876692439167e+02, 0.2026573758959e-08, 0.4349643351962e+01, 0.2449240616245e+02, 0.1807770325110e-08, 0.5700940482701e+01, 0.2045286941806e+02, 0.1881174408581e-08, 0.6601286363430e+00, 0.2358125818164e+02, 0.1368023671690e-08, 0.2211098592752e+01, 0.2473415438279e+02, 0.1720017916280e-08, 0.4942488551129e+01, 0.1679593901136e+03, 0.1702427665131e-08, 0.1452233856386e+01, 0.3338575901272e+03, 0.1414032510054e-08, 0.5525357721439e+01, 0.1624205518357e+03, 0.1652626045364e-08, 0.4108794283624e+01, 0.8956999012000e+02, 0.1642957769686e-08, 0.7344335209984e+00, 0.5267006960365e+02, 0.1614952403624e-08, 0.3541213951363e+01, 0.3332657872986e+02, 0.1535988291188e-08, 0.4031094072151e+01, 0.3852657435933e+02, 0.1593193738177e-08, 0.4185136203609e+01, 0.2282781046519e+03, 0.1074569126382e-08, 0.1720485636868e+01, 0.8397383534231e+02, 0.1074408214509e-08, 0.2758613420318e+01, 0.8401985929482e+02, 0.9700199670465e-09, 0.4216686842097e+01, 0.7826370942180e+02, 0.1258433517061e-08, 0.2575068876639e+00, 0.3115650189215e+03, 0.1240303229539e-08, 0.4800844956756e+00, 0.1784300471910e+03, 0.9018345948127e-09, 0.3896756361552e+00, 0.5886454391678e+02, 0.1135301432805e-08, 0.3700805023550e+00, 0.7842370451713e+02, 0.9215887951370e-09, 0.4364579276638e+01, 0.1014262087719e+03, 0.1055401054147e-08, 0.2156564222111e+01, 0.5660027930059e+02, 0.1008725979831e-08, 0.5454015785234e+01, 0.4245678405627e+02, 0.7217398104321e-09, 0.1597772562175e+01, 0.2457074661053e+03, 0.6912033134447e-09, 0.5824090621461e+01, 0.1679936946371e+03, 0.6833881523549e-09, 0.3578778482835e+01, 0.6053048899753e+02, 0.4887304205142e-09, 0.3724362812423e+01, 0.9656299901946e+02, 0.5173709754788e-09, 0.5422427507933e+01, 0.2442876000072e+03, 0.4671353097145e-09, 0.2396106924439e+01, 0.1435713242844e+03, 0.5652608439480e-09, 0.2804028838685e+01, 0.8365903305582e+02, 0.5604061331253e-09, 0.1638816006247e+01, 0.8433466158131e+02, 0.4712723365400e-09, 0.8979003224474e+00, 0.3164282286739e+03, 0.4909967465112e-09, 0.3210426725516e+01, 0.4059982187939e+03, 0.4771358267658e-09, 0.5308027211629e+01, 0.1805255418145e+03, 0.3943451445989e-09, 0.2195145341074e+01, 0.2568537517081e+03, 0.3952109120244e-09, 0.5081189491586e+01, 0.2449975330562e+03, 0.3788134594789e-09, 0.4345171264441e+01, 0.1568131045107e+03, 0.3738330190479e-09, 0.2613062847997e+01, 0.3948519331910e+03, 0.3099866678136e-09, 0.2846760817689e+01, 0.1547176098872e+03, 0.2002962716768e-09, 0.4921360989412e+01, 0.2268582385539e+03, 0.2198291338754e-09, 0.1130360117454e+00, 0.1658638954901e+03, 0.1491958330784e-09, 0.4228195232278e+01, 0.2219950288015e+03, 0.1475384076173e-09, 0.3005721811604e+00, 0.3052819430710e+03, 0.1661626624624e-09, 0.7830125621203e+00, 0.2526661704812e+03, 0.9015823460025e-10, 0.3807792942715e+01, 0.4171445043968e+03 }; /* Sun-to-Earth, T^0, Y */ static const double e0y[] = { 0.9998921098898e+00, 0.1826583913846e+00, 0.6283075850446e+01, -0.2442700893735e-01, 0.0000000000000e+00, 0.0000000000000e+00, 0.8352929742915e-02, 0.1395277998680e+00, 0.1256615170089e+02, 0.1046697300177e-03, 0.9641423109763e-01, 0.1884922755134e+02, 0.3110841876663e-04, 0.5381140401712e+01, 0.8399684731857e+02, 0.2570269094593e-04, 0.5301016407128e+01, 0.5296909721118e+00, 0.2147389623610e-04, 0.2662510869850e+01, 0.1577343543434e+01, 0.1680344384050e-04, 0.5207904119704e+01, 0.6279552690824e+01, 0.1679117312193e-04, 0.4582187486968e+01, 0.6286599010068e+01, 0.1440512068440e-04, 0.1900688517726e+01, 0.2352866153506e+01, 0.1135139664999e-04, 0.5273108538556e+01, 0.5223693906222e+01, 0.9345482571018e-05, 0.4503047687738e+01, 0.1203646072878e+02, 0.9007418719568e-05, 0.1605621059637e+01, 0.1021328554739e+02, 0.5671536712314e-05, 0.5812849070861e+00, 0.1059381944224e+01, 0.7451401861666e-05, 0.2807346794836e+01, 0.3981490189893e+00, 0.6393470057114e-05, 0.6029224133855e+01, 0.5753384878334e+01, 0.6814275881697e-05, 0.6472990145974e+00, 0.4705732307012e+01, 0.6113705628887e-05, 0.3813843419700e+01, 0.6812766822558e+01, 0.4503851367273e-05, 0.4527804370996e+01, 0.5884926831456e+01, 0.4522249141926e-05, 0.5991783029224e+01, 0.6256777527156e+01, 0.4501794307018e-05, 0.3798703844397e+01, 0.6309374173736e+01, 0.5514927480180e-05, 0.3961257833388e+01, 0.5507553240374e+01, 0.4062862799995e-05, 0.5256247296369e+01, 0.6681224869435e+01, 0.5414900429712e-05, 0.5499032014097e+01, 0.7755226100720e+00, 0.5463153987424e-05, 0.6173092454097e+01, 0.1414349524433e+02, 0.5071611859329e-05, 0.2870244247651e+01, 0.7860419393880e+01, 0.2195112094455e-05, 0.2952338617201e+01, 0.1150676975667e+02, 0.2279139233919e-05, 0.5951775132933e+01, 0.7058598460518e+01, 0.2278386100876e-05, 0.4845456398785e+01, 0.4694002934110e+01, 0.2559088003308e-05, 0.6945321117311e+00, 0.1216800268190e+02, 0.2561079286856e-05, 0.6167224608301e+01, 0.7099330490126e+00, 0.1792755796387e-05, 0.1400122509632e+01, 0.7962980379786e+00, 0.1818715656502e-05, 0.4703347611830e+01, 0.6283142985870e+01, 0.1818744924791e-05, 0.5086748900237e+01, 0.6283008715021e+01, 0.1554518791390e-05, 0.5331008042713e-01, 0.2513230340178e+02, 0.2063265737239e-05, 0.4283680484178e+01, 0.1179062909082e+02, 0.1497613520041e-05, 0.6074207826073e+01, 0.5486777812467e+01, 0.2000617940427e-05, 0.2501426281450e+01, 0.1778984560711e+02, 0.1289731195580e-05, 0.3646340599536e+01, 0.7079373888424e+01, 0.1282657998934e-05, 0.3232864804902e+01, 0.3738761453707e+01, 0.1528915968658e-05, 0.5581433416669e+01, 0.2132990797783e+00, 0.1187304098432e-05, 0.5453576453694e+01, 0.9437762937313e+01, 0.7842782928118e-06, 0.2823953922273e+00, 0.8827390247185e+01, 0.7352892280868e-06, 0.1124369580175e+01, 0.1589072916335e+01, 0.6570189360797e-06, 0.2089154042840e+01, 0.1176985366291e+02, 0.6324967590410e-06, 0.6704855581230e+00, 0.6262300422539e+01, 0.6298289872283e-06, 0.2836414855840e+01, 0.6303851278352e+01, 0.6476686465855e-06, 0.4852433866467e+00, 0.7113454667900e-02, 0.8587034651234e-06, 0.1453511005668e+01, 0.1672837615881e+03, 0.8068948788113e-06, 0.9224087798609e+00, 0.6069776770667e+01, 0.8353786011661e-06, 0.4631707184895e+01, 0.3340612434717e+01, 0.6009324532132e-06, 0.1829498827726e+01, 0.4136910472696e+01, 0.7558158559566e-06, 0.2588596800317e+01, 0.6496374930224e+01, 0.5809279504503e-06, 0.5516818853476e+00, 0.1097707878456e+02, 0.5374131950254e-06, 0.6275674734960e+01, 0.1194447056968e+01, 0.5711160507326e-06, 0.1091905956872e+01, 0.6282095334605e+01, 0.5710183170746e-06, 0.2415001635090e+01, 0.6284056366286e+01, 0.5144373590610e-06, 0.6020336443438e+01, 0.6290189305114e+01, 0.5103108927267e-06, 0.3775634564605e+01, 0.6275962395778e+01, 0.4960654697891e-06, 0.1073450946756e+01, 0.6127655567643e+01, 0.4786385689280e-06, 0.2431178012310e+01, 0.6438496133249e+01, 0.6109911263665e-06, 0.5343356157914e+01, 0.3154687086868e+01, 0.4839898944024e-06, 0.5830833594047e-01, 0.8018209333619e+00, 0.4734822623919e-06, 0.4536080134821e+01, 0.3128388763578e+01, 0.4834741473290e-06, 0.2585090489754e+00, 0.7084896783808e+01, 0.5134858581156e-06, 0.4213317172603e+01, 0.1235285262111e+02, 0.5064004264978e-06, 0.4814418806478e+00, 0.1185621865188e+02, 0.3753476772761e-06, 0.1599953399788e+01, 0.8429241228195e+01, 0.4935264014283e-06, 0.2157417556873e+01, 0.2544314396739e+01, 0.3950929600897e-06, 0.3359394184254e+01, 0.5481254917084e+01, 0.4895849789777e-06, 0.5165704376558e+01, 0.9225539266174e+01, 0.4215241688886e-06, 0.2065368800993e+01, 0.1726015463500e+02, 0.3796773731132e-06, 0.1468606346612e+01, 0.4265981595566e+00, 0.3114178142515e-06, 0.3615638079474e+01, 0.2146165377750e+01, 0.3260664220838e-06, 0.4417134922435e+01, 0.4164311961999e+01, 0.3976996123008e-06, 0.4700866883004e+01, 0.5856477690889e+01, 0.2801459672924e-06, 0.4538902060922e+01, 0.1256967486051e+02, 0.3638931868861e-06, 0.1334197991475e+01, 0.1807370494127e+02, 0.2487013269476e-06, 0.3749275558275e+01, 0.2629832328990e-01, 0.3034165481994e-06, 0.4236622030873e+00, 0.4535059491685e+01, 0.2676278825586e-06, 0.5970848007811e+01, 0.3930209696940e+01, 0.2764903818918e-06, 0.5194636754501e+01, 0.1256262854127e+02, 0.2485149930507e-06, 0.1002434207846e+01, 0.5088628793478e+01, 0.2199305540941e-06, 0.3066773098403e+01, 0.1255903824622e+02, 0.2571106500435e-06, 0.7588312459063e+00, 0.1336797263425e+02, 0.2049751817158e-06, 0.3444977434856e+01, 0.1137170464392e+02, 0.2599707296297e-06, 0.1873128542205e+01, 0.7143069561767e+02, 0.1785018072217e-06, 0.5015891306615e+01, 0.1748016358760e+01, 0.2324833891115e-06, 0.4618271239730e+01, 0.1831953657923e+02, 0.1709711119545e-06, 0.5300003455669e+01, 0.4933208510675e+01, 0.2107159351716e-06, 0.2229819815115e+01, 0.7477522907414e+01, 0.1750333080295e-06, 0.6161485880008e+01, 0.1044738781244e+02, 0.2000598210339e-06, 0.2967357299999e+01, 0.8031092209206e+01, 0.1380920248681e-06, 0.3027007923917e+01, 0.8635942003952e+01, 0.1412460470299e-06, 0.6037597163798e+01, 0.2942463415728e+01, 0.1888459803001e-06, 0.8561476243374e+00, 0.1561374759853e+03, 0.1788370542585e-06, 0.4869736290209e+01, 0.1592596075957e+01, 0.1360893296167e-06, 0.3626411886436e+01, 0.1309584267300e+02, 0.1506846530160e-06, 0.1550975377427e+01, 0.1649636139783e+02, 0.1800913376176e-06, 0.2075826033190e+01, 0.1729818233119e+02, 0.1436261390649e-06, 0.6148876420255e+01, 0.2042657109477e+02, 0.1220227114151e-06, 0.4382583879906e+01, 0.7632943190217e+01, 0.1337883603592e-06, 0.2036644327361e+01, 0.1213955354133e+02, 0.1159326650738e-06, 0.3892276994687e+01, 0.5331357529664e+01, 0.1352853128569e-06, 0.1447950649744e+01, 0.1673046366289e+02, 0.1433408296083e-06, 0.4457854692961e+01, 0.7342457794669e+01, 0.1234701666518e-06, 0.1538818147151e+01, 0.6279485555400e+01, 0.1234027192007e-06, 0.1968523220760e+01, 0.6286666145492e+01, 0.1244024091797e-06, 0.5779803499985e+01, 0.1511046609763e+02, 0.1097934945516e-06, 0.6210975221388e+00, 0.1098880815746e+02, 0.1254611329856e-06, 0.2591963807998e+01, 0.1572083878776e+02, 0.1158247286784e-06, 0.2483612812670e+01, 0.5729506548653e+01, 0.9039078252960e-07, 0.3857554579796e+01, 0.9623688285163e+01, 0.9108024978836e-07, 0.5826368512984e+01, 0.7234794171227e+01, 0.8887068108436e-07, 0.3475694573987e+01, 0.6148010737701e+01, 0.8632374035438e-07, 0.3059070488983e-01, 0.6418140963190e+01, 0.7893186992967e-07, 0.1583194837728e+01, 0.2118763888447e+01, 0.8297650201172e-07, 0.8519770534637e+00, 0.1471231707864e+02, 0.1019759578988e-06, 0.1319598738732e+00, 0.1349867339771e+01, 0.1010037696236e-06, 0.9937860115618e+00, 0.6836645152238e+01, 0.1047727548266e-06, 0.1382138405399e+01, 0.5999216516294e+01, 0.7351993881086e-07, 0.3833397851735e+01, 0.6040347114260e+01, 0.9868771092341e-07, 0.2124913814390e+01, 0.6566935184597e+01, 0.7007321959390e-07, 0.5946305343763e+01, 0.6525804586632e+01, 0.6861411679709e-07, 0.4574654977089e+01, 0.7238675589263e+01, 0.7554519809614e-07, 0.5949232686844e+01, 0.1253985337760e+02, 0.9541880448335e-07, 0.3495242990564e+01, 0.2122839202813e+02, 0.7185606722155e-07, 0.4310113471661e+01, 0.6245048154254e+01, 0.7131360871710e-07, 0.5480309323650e+01, 0.6321103546637e+01, 0.6651142021039e-07, 0.5411097713654e+01, 0.5327476111629e+01, 0.8538618213667e-07, 0.1827849973951e+01, 0.1101510648075e+02, 0.8634954288044e-07, 0.5443584943349e+01, 0.5643178611111e+01, 0.7449415051484e-07, 0.2011535459060e+01, 0.5368044267797e+00, 0.7421047599169e-07, 0.3464562529249e+01, 0.2354323048545e+02, 0.6140694354424e-07, 0.5657556228815e+01, 0.1296430071988e+02, 0.6353525143033e-07, 0.3463816593821e+01, 0.1990745094947e+01, 0.6221964013447e-07, 0.1532259498697e+01, 0.9517183207817e+00, 0.5852480257244e-07, 0.1375396598875e+01, 0.9555997388169e+00, 0.6398637498911e-07, 0.2405645801972e+01, 0.2407292145756e+02, 0.7039744069878e-07, 0.5397541799027e+01, 0.5225775174439e+00, 0.6977997694382e-07, 0.4762347105419e+01, 0.1097355562493e+02, 0.7460629558396e-07, 0.2711944692164e+01, 0.2200391463820e+02, 0.5376577536101e-07, 0.2352980430239e+01, 0.1431416805965e+02, 0.7530607893556e-07, 0.1943940180699e+01, 0.1842262939178e+02, 0.6822928971605e-07, 0.4337651846959e+01, 0.1554202828031e+00, 0.6220772380094e-07, 0.6716871369278e+00, 0.1845107853235e+02, 0.6586950799043e-07, 0.2229714460505e+01, 0.5216580451554e+01, 0.5873800565771e-07, 0.7627013920580e+00, 0.6398972393349e+00, 0.6264346929745e-07, 0.6202785478961e+00, 0.6277552955062e+01, 0.6257929115669e-07, 0.2886775596668e+01, 0.6288598745829e+01, 0.5343536033409e-07, 0.1977241012051e+01, 0.4690479774488e+01, 0.5587849781714e-07, 0.1922923484825e+01, 0.1551045220144e+01, 0.6905100845603e-07, 0.3570757164631e+01, 0.1030928125552e+00, 0.6178957066649e-07, 0.5197558947765e+01, 0.5230807360890e+01, 0.6187270224331e-07, 0.8193497368922e+00, 0.5650292065779e+01, 0.5385664291426e-07, 0.5406336665586e+01, 0.7771377146812e+02, 0.6329363917926e-07, 0.2837760654536e+01, 0.2608790314060e+02, 0.4546018761604e-07, 0.2933580297050e+01, 0.5535693017924e+00, 0.6196091049375e-07, 0.4157871494377e+01, 0.8467247584405e+02, 0.6159555108218e-07, 0.3211703561703e+01, 0.2394243902548e+03, 0.4995340539317e-07, 0.1459098102922e+01, 0.4732030630302e+01, 0.5457031243572e-07, 0.1430457676136e+01, 0.6179983037890e+01, 0.4863461418397e-07, 0.2196425916730e+01, 0.9027992316901e+02, 0.5342947626870e-07, 0.2086612890268e+01, 0.6386168663001e+01, 0.5674296648439e-07, 0.2760204966535e+01, 0.6915859635113e+01, 0.4745783120161e-07, 0.4245368971862e+01, 0.6282970628506e+01, 0.4745676961198e-07, 0.5544725787016e+01, 0.6283181072386e+01, 0.4049796869973e-07, 0.2213984363586e+01, 0.6254626709878e+01, 0.4248333596940e-07, 0.8075781952896e+00, 0.7875671926403e+01, 0.4027178070205e-07, 0.1293268540378e+01, 0.6311524991013e+01, 0.4066543943476e-07, 0.3986141175804e+01, 0.3634620989887e+01, 0.4858863787880e-07, 0.1276112738231e+01, 0.5760498333002e+01, 0.5277398263530e-07, 0.4916111741527e+01, 0.2515860172507e+02, 0.4105635656559e-07, 0.1725805864426e+01, 0.6709674010002e+01, 0.4376781925772e-07, 0.2243642442106e+01, 0.6805653367890e+01, 0.3235827894693e-07, 0.3614135118271e+01, 0.1066495398892e+01, 0.3073244740308e-07, 0.2460873393460e+01, 0.5863591145557e+01, 0.3088609271373e-07, 0.5678431771790e+01, 0.9917696840332e+01, 0.3393022279836e-07, 0.3814017477291e+01, 0.1391601904066e+02, 0.3038686508802e-07, 0.4660216229171e+01, 0.1256621883632e+02, 0.4019677752497e-07, 0.5906906243735e+01, 0.1334167431096e+02, 0.3288834998232e-07, 0.9536146445882e+00, 0.1620077269078e+02, 0.3889973794631e-07, 0.3942205097644e+01, 0.7478166569050e-01, 0.3050438987141e-07, 0.1624810271286e+01, 0.1805292951336e+02, 0.3601142564638e-07, 0.4030467142575e+01, 0.6208294184755e+01, 0.3689015557141e-07, 0.3648878818694e+01, 0.5966683958112e+01, 0.3563471893565e-07, 0.5749584017096e+01, 0.6357857516136e+01, 0.2776183170667e-07, 0.2630124187070e+01, 0.3523159621801e-02, 0.2922350530341e-07, 0.1790346403629e+01, 0.1272157198369e+02, 0.3511076917302e-07, 0.6142198301611e+01, 0.6599467742779e+01, 0.3619351007632e-07, 0.1432421386492e+01, 0.6019991944201e+01, 0.2561254711098e-07, 0.2302822475792e+01, 0.1259245002418e+02, 0.2626903942920e-07, 0.8660470994571e+00, 0.6702560555334e+01, 0.2550187397083e-07, 0.6069721995383e+01, 0.1057540660594e+02, 0.2535873526138e-07, 0.1079020331795e-01, 0.3141537925223e+02, 0.3519786153847e-07, 0.3809066902283e+01, 0.2505706758577e+03, 0.3424651492873e-07, 0.2075435114417e+01, 0.6546159756691e+01, 0.2372676630861e-07, 0.2057803120154e+01, 0.2388894113936e+01, 0.2710980779541e-07, 0.1510068488010e+01, 0.1202934727411e+02, 0.3038710889704e-07, 0.5043617528901e+01, 0.1256608456547e+02, 0.2220364130585e-07, 0.3694793218205e+01, 0.1336244973887e+02, 0.3025880825460e-07, 0.5450618999049e-01, 0.2908881142201e+02, 0.2784493486864e-07, 0.3381164084502e+01, 0.1494531617769e+02, 0.2294414142438e-07, 0.4382309025210e+01, 0.6076890225335e+01, 0.2012723294724e-07, 0.9142212256518e+00, 0.6262720680387e+01, 0.2036357831958e-07, 0.5676172293154e+01, 0.4701116388778e+01, 0.2003474823288e-07, 0.2592767977625e+01, 0.6303431020504e+01, 0.2207144900109e-07, 0.5404976271180e+01, 0.6489261475556e+01, 0.2481664905135e-07, 0.4373284587027e+01, 0.1204357418345e+02, 0.2674949182295e-07, 0.5859182188482e+01, 0.4590910121555e+01, 0.2450554720322e-07, 0.4555381557451e+01, 0.1495633313810e+00, 0.2601975986457e-07, 0.3933165584959e+01, 0.1965104848470e+02, 0.2199860022848e-07, 0.5227977189087e+01, 0.1351787002167e+02, 0.2448121172316e-07, 0.4858060353949e+01, 0.1162474756779e+01, 0.1876014864049e-07, 0.5690546553605e+01, 0.6279194432410e+01, 0.1874513219396e-07, 0.4099539297446e+01, 0.6286957268481e+01, 0.2156380842559e-07, 0.4382594769913e+00, 0.1813929450232e+02, 0.1981691240061e-07, 0.1829784152444e+01, 0.4686889479442e+01, 0.2329992648539e-07, 0.2836254278973e+01, 0.1002183730415e+02, 0.1765184135302e-07, 0.2803494925833e+01, 0.4292330755499e+01, 0.2436368366085e-07, 0.2836897959677e+01, 0.9514313292143e+02, 0.2164089203889e-07, 0.6127522446024e+01, 0.6037244212485e+01, 0.1847755034221e-07, 0.3683163635008e+01, 0.2427287361862e+00, 0.1674798769966e-07, 0.3316993867246e+00, 0.1311972100268e+02, 0.2222542124356e-07, 0.8294097805480e+00, 0.1266924451345e+02, 0.2071074505925e-07, 0.3659492220261e+01, 0.6528907488406e+01, 0.1608224471835e-07, 0.4774492067182e+01, 0.1352175143971e+02, 0.1857583439071e-07, 0.2873120597682e+01, 0.8662240327241e+01, 0.1793018836159e-07, 0.5282441177929e+00, 0.6819880277225e+01, 0.1575391221692e-07, 0.1320789654258e+01, 0.1102062672231e+00, 0.1840132009557e-07, 0.1917110916256e+01, 0.6514761976723e+02, 0.1760917288281e-07, 0.2972635937132e+01, 0.5746271423666e+01, 0.1561779518516e-07, 0.4372569261981e+01, 0.6272439236156e+01, 0.1558687885205e-07, 0.5416424926425e+01, 0.6293712464735e+01, 0.1951359382579e-07, 0.3094448898752e+01, 0.2301353951334e+02, 0.1569144275614e-07, 0.2802103689808e+01, 0.1765478049437e+02, 0.1479130389462e-07, 0.2136435020467e+01, 0.2077542790660e-01, 0.1467828510764e-07, 0.7072627435674e+00, 0.1052268489556e+01, 0.1627627337440e-07, 0.3947607143237e+01, 0.6327837846670e+00, 0.1503498479758e-07, 0.4079248909190e+01, 0.7626583626240e-01, 0.1297967708237e-07, 0.6269637122840e+01, 0.1149965630200e+02, 0.1374416896634e-07, 0.4175657970702e+01, 0.6016468784579e+01, 0.1783812325219e-07, 0.1476540547560e+01, 0.3301902111895e+02, 0.1525884228756e-07, 0.4653477715241e+01, 0.9411464614024e+01, 0.1451067396763e-07, 0.2573001128225e+01, 0.1277945078067e+02, 0.1297713111950e-07, 0.5612799618771e+01, 0.6549682916313e+01, 0.1462784012820e-07, 0.4189661623870e+01, 0.1863592847156e+02, 0.1384185980007e-07, 0.2656915472196e+01, 0.2379164476796e+01, 0.1221497599801e-07, 0.5612515760138e+01, 0.1257326515556e+02, 0.1560574525896e-07, 0.4783414317919e+01, 0.1887552587463e+02, 0.1544598372036e-07, 0.2694431138063e+01, 0.1820933031200e+02, 0.1531678928696e-07, 0.4105103489666e+01, 0.2593412433514e+02, 0.1349321503795e-07, 0.3082437194015e+00, 0.5120601093667e+01, 0.1252030290917e-07, 0.6124072334087e+01, 0.6993008899458e+01, 0.1459243816687e-07, 0.3733103981697e+01, 0.3813291813120e-01, 0.1226103625262e-07, 0.1267127706817e+01, 0.2435678079171e+02, 0.1019449641504e-07, 0.4367790112269e+01, 0.1725663147538e+02, 0.1380789433607e-07, 0.3387201768700e+01, 0.2458316379602e+00, 0.1019453421658e-07, 0.9204143073737e+00, 0.6112403035119e+01, 0.1297929434405e-07, 0.5786874896426e+01, 0.1249137003520e+02, 0.9912677786097e-08, 0.3164232870746e+01, 0.6247047890016e+01, 0.9829386098599e-08, 0.2586762413351e+01, 0.6453748665772e+01, 0.1226807746104e-07, 0.6239068436607e+01, 0.5429879531333e+01, 0.1192691755997e-07, 0.1867380051424e+01, 0.6290122169689e+01, 0.9836499227081e-08, 0.3424716293727e+00, 0.6319103810876e+01, 0.9642862564285e-08, 0.5661372990657e+01, 0.8273820945392e+01, 0.1165184404862e-07, 0.5768367239093e+01, 0.1778273215245e+02, 0.1175794418818e-07, 0.1657351222943e+01, 0.6276029531202e+01, 0.1018948635601e-07, 0.6458292350865e+00, 0.1254537627298e+02, 0.9500383606676e-08, 0.1054306140741e+01, 0.1256517118505e+02, 0.1227512202906e-07, 0.2505278379114e+01, 0.2248384854122e+02, 0.9664792009993e-08, 0.4289737277000e+01, 0.6259197520765e+01, 0.9613285666331e-08, 0.5500597673141e+01, 0.6306954180126e+01, 0.1117906736211e-07, 0.2361405953468e+01, 0.1779695906178e+02, 0.9611378640782e-08, 0.2851310576269e+01, 0.2061856251104e+00, 0.8845354852370e-08, 0.6208777705343e+01, 0.1692165728891e+01, 0.1054046966600e-07, 0.5413091423934e+01, 0.2204125344462e+00, 0.1215539124483e-07, 0.5613969479755e+01, 0.8257698122054e+02, 0.9932460955209e-08, 0.1106124877015e+01, 0.1017725758696e+02, 0.8785804715043e-08, 0.2869224476477e+01, 0.9491756770005e+00, 0.8538084097562e-08, 0.6159640899344e+01, 0.6393282117669e+01, 0.8648994369529e-08, 0.1374901198784e+01, 0.4804209201333e+01, 0.1039063219067e-07, 0.5171080641327e+01, 0.1550861511662e+02, 0.8867983926439e-08, 0.8317320304902e+00, 0.3903911373650e+01, 0.8327495955244e-08, 0.3605591969180e+01, 0.6172869583223e+01, 0.9243088356133e-08, 0.6114299196843e+01, 0.6267823317922e+01, 0.9205657357835e-08, 0.3675153683737e+01, 0.6298328382969e+01, 0.1033269714606e-07, 0.3313328813024e+01, 0.5573142801433e+01, 0.8001706275552e-08, 0.2019980960053e+01, 0.2648454860559e+01, 0.9171858254191e-08, 0.8992015524177e+00, 0.1498544001348e+03, 0.1075327150242e-07, 0.2898669963648e+01, 0.3694923081589e+02, 0.9884866689828e-08, 0.4946715904478e+01, 0.1140367694411e+02, 0.9541835576677e-08, 0.2371787888469e+01, 0.1256713221673e+02, 0.7739903376237e-08, 0.2213775190612e+01, 0.7834121070590e+01, 0.7311962684106e-08, 0.3429378787739e+01, 0.1192625446156e+02, 0.9724904869624e-08, 0.6195878564404e+01, 0.2280573557157e+02, 0.9251628983612e-08, 0.6511509527390e+00, 0.2787043132925e+01, 0.7320763787842e-08, 0.6001083639421e+01, 0.6282655592598e+01, 0.7320296650962e-08, 0.3789073265087e+01, 0.6283496108294e+01, 0.7947032271039e-08, 0.1059659582204e+01, 0.1241073141809e+02, 0.9005277053115e-08, 0.1280315624361e+01, 0.6281591679874e+01, 0.8995601652048e-08, 0.2224439106766e+01, 0.6284560021018e+01, 0.8288040568796e-08, 0.5234914433867e+01, 0.1241658836951e+02, 0.6359381347255e-08, 0.4137989441490e+01, 0.1596186371003e+01, 0.8699572228626e-08, 0.1758411009497e+01, 0.6133512519065e+01, 0.6456797542736e-08, 0.5919285089994e+01, 0.1685848245639e+02, 0.7424573475452e-08, 0.5414616938827e+01, 0.4061219149443e+01, 0.7235671196168e-08, 0.1496516557134e+01, 0.1610006857377e+03, 0.8104015182733e-08, 0.1919918242764e+01, 0.8460828644453e+00, 0.8098576535937e-08, 0.3819615855458e+01, 0.3894181736510e+01, 0.6275292346625e-08, 0.6244264115141e+01, 0.8531963191132e+00, 0.6052432989112e-08, 0.5037731872610e+00, 0.1567108171867e+02, 0.5705651535817e-08, 0.2984557271995e+01, 0.1258692712880e+02, 0.5789650115138e-08, 0.6087038140697e+01, 0.1193336791622e+02, 0.5512132153377e-08, 0.5855668994076e+01, 0.1232342296471e+02, 0.7388890819102e-08, 0.2443128574740e+01, 0.4907302013889e+01, 0.5467593991798e-08, 0.3017561234194e+01, 0.1884211409667e+02, 0.6388519802999e-08, 0.5887386712935e+01, 0.5217580628120e+02, 0.6106777149944e-08, 0.3483461059895e+00, 0.1422690933580e-01, 0.7383420275489e-08, 0.5417387056707e+01, 0.2358125818164e+02, 0.5505208141738e-08, 0.2848193644783e+01, 0.1151388321134e+02, 0.6310757462877e-08, 0.2349882520828e+01, 0.1041998632314e+02, 0.6166904929691e-08, 0.5728575944077e+00, 0.6151533897323e+01, 0.5263442042754e-08, 0.4495796125937e+01, 0.1885275071096e+02, 0.5591828082629e-08, 0.1355441967677e+01, 0.4337116142245e+00, 0.5397051680497e-08, 0.1673422864307e+01, 0.6286362197481e+01, 0.5396992745159e-08, 0.1833502206373e+01, 0.6279789503410e+01, 0.6572913000726e-08, 0.3331122065824e+01, 0.1176433076753e+02, 0.5123421866413e-08, 0.2165327142679e+01, 0.1245594543367e+02, 0.5930495725999e-08, 0.2931146089284e+01, 0.6414617803568e+01, 0.6431797403933e-08, 0.4134407994088e+01, 0.1350651127443e+00, 0.5003182207604e-08, 0.3805420303749e+01, 0.1096996532989e+02, 0.5587731032504e-08, 0.1082469260599e+01, 0.6062663316000e+01, 0.5935263407816e-08, 0.8384333678401e+00, 0.5326786718777e+01, 0.4756019827760e-08, 0.3552588749309e+01, 0.3104930017775e+01, 0.6599951172637e-08, 0.4320826409528e+01, 0.4087944051283e+02, 0.5902606868464e-08, 0.4811879454445e+01, 0.5849364236221e+01, 0.5921147809031e-08, 0.9942628922396e-01, 0.1581959461667e+01, 0.5505382581266e-08, 0.2466557607764e+01, 0.6503488384892e+01, 0.5353771071862e-08, 0.4551978748683e+01, 0.1735668374386e+03, 0.5063282210946e-08, 0.5710812312425e+01, 0.1248988586463e+02, 0.5926120403383e-08, 0.1333998428358e+01, 0.2673594526851e+02, 0.5211016176149e-08, 0.4649315360760e+01, 0.2460261242967e+02, 0.5347075084894e-08, 0.5512754081205e+01, 0.4171425416666e+01, 0.4872609773574e-08, 0.1308025299938e+01, 0.5333900173445e+01, 0.4727711321420e-08, 0.2144908368062e+01, 0.7232251527446e+01, 0.6029426018652e-08, 0.5567259412084e+01, 0.3227113045244e+03, 0.4321485284369e-08, 0.5230667156451e+01, 0.9388005868221e+01, 0.4476406760553e-08, 0.6134081115303e+01, 0.5547199253223e+01, 0.5835268277420e-08, 0.4783808492071e+01, 0.7285056171570e+02, 0.5172183602748e-08, 0.5161817911099e+01, 0.1884570439172e+02, 0.5693571465184e-08, 0.1381646203111e+01, 0.9723862754494e+02, 0.4060634965349e-08, 0.3876705259495e+00, 0.4274518229222e+01, 0.3967398770473e-08, 0.5029491776223e+01, 0.3496032717521e+01, 0.3943754005255e-08, 0.1923162955490e+01, 0.6244942932314e+01, 0.4781323427824e-08, 0.4633332586423e+01, 0.2929661536378e+02, 0.3871483781204e-08, 0.1616650009743e+01, 0.6321208768577e+01, 0.5141741733997e-08, 0.9817316704659e-01, 0.1232032006293e+02, 0.4002385978497e-08, 0.3656161212139e+01, 0.7018952447668e+01, 0.4901092604097e-08, 0.4404098713092e+01, 0.1478866649112e+01, 0.3740932630345e-08, 0.5181188732639e+00, 0.6922973089781e+01, 0.4387283718538e-08, 0.3254859566869e+01, 0.2331413144044e+03, 0.5019197802033e-08, 0.3086773224677e+01, 0.1715706182245e+02, 0.3834931695175e-08, 0.2797882673542e+01, 0.1491901785440e+02, 0.3760413942497e-08, 0.2892676280217e+01, 0.1726726808967e+02, 0.3719717204628e-08, 0.5861046025739e+01, 0.6297302759782e+01, 0.4145623530149e-08, 0.2168239627033e+01, 0.1376059875786e+02, 0.3932788425380e-08, 0.6271811124181e+01, 0.7872148766781e+01, 0.3686377476857e-08, 0.3936853151404e+01, 0.6268848941110e+01, 0.3779077950339e-08, 0.1404148734043e+01, 0.4157198507331e+01, 0.4091334550598e-08, 0.2452436180854e+01, 0.9779108567966e+01, 0.3926694536146e-08, 0.6102292739040e+01, 0.1098419223922e+02, 0.4841000253289e-08, 0.6072760457276e+01, 0.1252801878276e+02, 0.4949340130240e-08, 0.1154832815171e+01, 0.1617106187867e+03, 0.3761557737360e-08, 0.5527545321897e+01, 0.3185192151914e+01, 0.3647396268188e-08, 0.1525035688629e+01, 0.6271346477544e+01, 0.3932405074189e-08, 0.5570681040569e+01, 0.2139354194808e+02, 0.3631322501141e-08, 0.1981240601160e+01, 0.6294805223347e+01, 0.4130007425139e-08, 0.2050060880201e+01, 0.2195415756911e+02, 0.4433905965176e-08, 0.3277477970321e+01, 0.7445550607224e+01, 0.3851814176947e-08, 0.5210690074886e+01, 0.9562891316684e+00, 0.3485807052785e-08, 0.6653274904611e+00, 0.1161697602389e+02, 0.3979772816991e-08, 0.1767941436148e+01, 0.2277943724828e+02, 0.3402607460500e-08, 0.3421746306465e+01, 0.1087398597200e+02, 0.4049993000926e-08, 0.1127144787547e+01, 0.3163918923335e+00, 0.3420511182382e-08, 0.4214794779161e+01, 0.1362553364512e+02, 0.3640772365012e-08, 0.5324905497687e+01, 0.1725304118033e+02, 0.3323037987501e-08, 0.6135761838271e+01, 0.6279143387820e+01, 0.4503141663637e-08, 0.1802305450666e+01, 0.1385561574497e+01, 0.4314560055588e-08, 0.4812299731574e+01, 0.4176041334900e+01, 0.3294226949110e-08, 0.3657547059723e+01, 0.6287008313071e+01, 0.3215657197281e-08, 0.4866676894425e+01, 0.5749861718712e+01, 0.4129362656266e-08, 0.3809342558906e+01, 0.5905702259363e+01, 0.3137762976388e-08, 0.2494635174443e+01, 0.2099539292909e+02, 0.3514010952384e-08, 0.2699961831678e+01, 0.7335344340001e+01, 0.3327607571530e-08, 0.3318457714816e+01, 0.5436992986000e+01, 0.3541066946675e-08, 0.4382703582466e+01, 0.1234573916645e+02, 0.3216179847052e-08, 0.5271066317054e+01, 0.3802769619140e-01, 0.2959045059570e-08, 0.5819591585302e+01, 0.2670964694522e+02, 0.3884040326665e-08, 0.5980934960428e+01, 0.6660449441528e+01, 0.2922027539886e-08, 0.3337290282483e+01, 0.1375773836557e+01, 0.4110846382042e-08, 0.5742978187327e+01, 0.4480965020977e+02, 0.2934508411032e-08, 0.2278075804200e+01, 0.6408777551755e+00, 0.3966896193000e-08, 0.5835747858477e+01, 0.3773735910827e+00, 0.3286695827610e-08, 0.5838898193902e+01, 0.3932462625300e-02, 0.3720643094196e-08, 0.1122212337858e+01, 0.1646033343740e+02, 0.3285508906174e-08, 0.9182250996416e+00, 0.1081813534213e+02, 0.3753880575973e-08, 0.5174761973266e+01, 0.5642198095270e+01, 0.3022129385587e-08, 0.3381611020639e+01, 0.2982630633589e+02, 0.2798569205621e-08, 0.3546193723922e+01, 0.1937891852345e+02, 0.3397872070505e-08, 0.4533203197934e+01, 0.6923953605621e+01, 0.3708099772977e-08, 0.2756168198616e+01, 0.3066615496545e+02, 0.3599283541510e-08, 0.1934395469918e+01, 0.6147450479709e+01, 0.3688702753059e-08, 0.7149920971109e+00, 0.2636725487657e+01, 0.2681084724003e-08, 0.4899819493154e+01, 0.6816289982179e+01, 0.3495993460759e-08, 0.1572418915115e+01, 0.6418701221183e+01, 0.3130770324995e-08, 0.8912190180489e+00, 0.1235996607578e+02, 0.2744353821941e-08, 0.3800821940055e+01, 0.2059724391010e+02, 0.2842732906341e-08, 0.2644717440029e+01, 0.2828699048865e+02, 0.3046882682154e-08, 0.3987793020179e+01, 0.6055599646783e+01, 0.2399072455143e-08, 0.9908826440764e+00, 0.6255674361143e+01, 0.2384306274204e-08, 0.2516149752220e+01, 0.6310477339748e+01, 0.2977324500559e-08, 0.5849195642118e+01, 0.1652265972112e+02, 0.3062835258972e-08, 0.1681660100162e+01, 0.1172006883645e+02, 0.3109682589231e-08, 0.5804143987737e+00, 0.2751146787858e+02, 0.2903920355299e-08, 0.5800768280123e+01, 0.6510552054109e+01, 0.2823221989212e-08, 0.9241118370216e+00, 0.5469525544182e+01, 0.3187949696649e-08, 0.3139776445735e+01, 0.1693792562116e+03, 0.2922559771655e-08, 0.3549440782984e+01, 0.2630839062450e+00, 0.2436302066603e-08, 0.4735540696319e+01, 0.3946258593675e+00, 0.3049473043606e-08, 0.4998289124561e+01, 0.8390110365991e+01, 0.2863682575784e-08, 0.6709515671102e+00, 0.2243449970715e+00, 0.2641750517966e-08, 0.5410978257284e+01, 0.2986433403208e+02, 0.2704093466243e-08, 0.4778317207821e+01, 0.6129297044991e+01, 0.2445522177011e-08, 0.6009020662222e+01, 0.1171295538178e+02, 0.2623608810230e-08, 0.5010449777147e+01, 0.6436854655901e+01, 0.2079259704053e-08, 0.5980943768809e+01, 0.2019909489111e+02, 0.2820225596771e-08, 0.2679965110468e+01, 0.5934151399930e+01, 0.2365221950927e-08, 0.1894231148810e+01, 0.2470570524223e+02, 0.2359682077149e-08, 0.4220752950780e+01, 0.8671969964381e+01, 0.2387577137206e-08, 0.2571783940617e+01, 0.7096626156709e+01, 0.1982102089816e-08, 0.5169765997119e+00, 0.1727188400790e+02, 0.2687502389925e-08, 0.6239078264579e+01, 0.7075506709219e+02, 0.2207751669135e-08, 0.2031184412677e+01, 0.4377611041777e+01, 0.2618370214274e-08, 0.8266079985979e+00, 0.6632000300961e+01, 0.2591951887361e-08, 0.8819350522008e+00, 0.4873985990671e+02, 0.2375055656248e-08, 0.3520944177789e+01, 0.1590676413561e+02, 0.2472019978911e-08, 0.1551431908671e+01, 0.6612329252343e+00, 0.2368157127199e-08, 0.4178610147412e+01, 0.3459636466239e+02, 0.1764846605693e-08, 0.1506764000157e+01, 0.1980094587212e+02, 0.2291769608798e-08, 0.2118250611782e+01, 0.2844914056730e-01, 0.2209997316943e-08, 0.3363255261678e+01, 0.2666070658668e+00, 0.2292699097923e-08, 0.4200423956460e+00, 0.1484170571900e-02, 0.1629683015329e-08, 0.2331362582487e+01, 0.3035599730800e+02, 0.2206492862426e-08, 0.3400274026992e+01, 0.6281667977667e+01, 0.2205746568257e-08, 0.1066051230724e+00, 0.6284483723224e+01, 0.2026310767991e-08, 0.2779066487979e+01, 0.2449240616245e+02, 0.1762977622163e-08, 0.9951450691840e+00, 0.2045286941806e+02, 0.1368535049606e-08, 0.6402447365817e+00, 0.2473415438279e+02, 0.1720598775450e-08, 0.2303524214705e+00, 0.1679593901136e+03, 0.1702429015449e-08, 0.6164622655048e+01, 0.3338575901272e+03, 0.1414033197685e-08, 0.3954561185580e+01, 0.1624205518357e+03, 0.1573768958043e-08, 0.2028286308984e+01, 0.3144167757552e+02, 0.1650705184447e-08, 0.2304040666128e+01, 0.5267006960365e+02, 0.1651087618855e-08, 0.2538461057280e+01, 0.8956999012000e+02, 0.1616409518983e-08, 0.5111054348152e+01, 0.3332657872986e+02, 0.1537175173581e-08, 0.5601130666603e+01, 0.3852657435933e+02, 0.1593191980553e-08, 0.2614340453411e+01, 0.2282781046519e+03, 0.1499480170643e-08, 0.3624721577264e+01, 0.2823723341956e+02, 0.1493807843235e-08, 0.4214569879008e+01, 0.2876692439167e+02, 0.1074571199328e-08, 0.1496911744704e+00, 0.8397383534231e+02, 0.1074406983417e-08, 0.1187817671922e+01, 0.8401985929482e+02, 0.9757576855851e-09, 0.2655703035858e+01, 0.7826370942180e+02, 0.1258432887565e-08, 0.4969896184844e+01, 0.3115650189215e+03, 0.1240336343282e-08, 0.5192460776926e+01, 0.1784300471910e+03, 0.9016107005164e-09, 0.1960356923057e+01, 0.5886454391678e+02, 0.1135392360918e-08, 0.5082427809068e+01, 0.7842370451713e+02, 0.9216046089565e-09, 0.2793775037273e+01, 0.1014262087719e+03, 0.1061276615030e-08, 0.3726144311409e+01, 0.5660027930059e+02, 0.1010110596263e-08, 0.7404080708937e+00, 0.4245678405627e+02, 0.7217424756199e-09, 0.2697449980577e-01, 0.2457074661053e+03, 0.6912003846756e-09, 0.4253296276335e+01, 0.1679936946371e+03, 0.6871814664847e-09, 0.5148072412354e+01, 0.6053048899753e+02, 0.4887158016343e-09, 0.2153581148294e+01, 0.9656299901946e+02, 0.5161802866314e-09, 0.3852750634351e+01, 0.2442876000072e+03, 0.5652599559057e-09, 0.1233233356270e+01, 0.8365903305582e+02, 0.4710812608586e-09, 0.5610486976767e+01, 0.3164282286739e+03, 0.4909977500324e-09, 0.1639629524123e+01, 0.4059982187939e+03, 0.4772641839378e-09, 0.3737100368583e+01, 0.1805255418145e+03, 0.4487562567153e-09, 0.1158417054478e+00, 0.8433466158131e+02, 0.3943441230497e-09, 0.6243502862796e+00, 0.2568537517081e+03, 0.3952236913598e-09, 0.3510377382385e+01, 0.2449975330562e+03, 0.3788898363417e-09, 0.5916128302299e+01, 0.1568131045107e+03, 0.3738329328831e-09, 0.1042266763456e+01, 0.3948519331910e+03, 0.2451199165151e-09, 0.1166788435700e+01, 0.1435713242844e+03, 0.2436734402904e-09, 0.3254726114901e+01, 0.2268582385539e+03, 0.2213605274325e-09, 0.1687210598530e+01, 0.1658638954901e+03, 0.1491521204829e-09, 0.2657541786794e+01, 0.2219950288015e+03, 0.1474995329744e-09, 0.5013089805819e+01, 0.3052819430710e+03, 0.1661939475656e-09, 0.5495315428418e+01, 0.2526661704812e+03, 0.9015946748003e-10, 0.2236989966505e+01, 0.4171445043968e+03 }; /* Sun-to-Earth, T^0, Z */ static const double e0z[] = { 0.2796207639075e-05, 0.3198701560209e+01, 0.8433466158131e+02, 0.1016042198142e-05, 0.5422360395913e+01, 0.5507553240374e+01, 0.8044305033647e-06, 0.3880222866652e+01, 0.5223693906222e+01, 0.4385347909274e-06, 0.3704369937468e+01, 0.2352866153506e+01, 0.3186156414906e-06, 0.3999639363235e+01, 0.1577343543434e+01, 0.2272412285792e-06, 0.3984738315952e+01, 0.1047747311755e+01, 0.1645620103007e-06, 0.3565412516841e+01, 0.5856477690889e+01, 0.1815836921166e-06, 0.4984507059020e+01, 0.6283075850446e+01, 0.1447461676364e-06, 0.3702753570108e+01, 0.9437762937313e+01, 0.1430760876382e-06, 0.3409658712357e+01, 0.1021328554739e+02, 0.1120445753226e-06, 0.4829561570246e+01, 0.1414349524433e+02, 0.1090232840797e-06, 0.2080729178066e+01, 0.6812766822558e+01, 0.9715727346551e-07, 0.3476295881948e+01, 0.4694002934110e+01, 0.1036267136217e-06, 0.4056639536648e+01, 0.7109288135493e+02, 0.8752665271340e-07, 0.4448159519911e+01, 0.5753384878334e+01, 0.8331864956004e-07, 0.4991704044208e+01, 0.7084896783808e+01, 0.6901658670245e-07, 0.4325358994219e+01, 0.6275962395778e+01, 0.9144536848998e-07, 0.1141826375363e+01, 0.6620890113188e+01, 0.7205085037435e-07, 0.3624344170143e+01, 0.5296909721118e+00, 0.7697874654176e-07, 0.5554257458998e+01, 0.1676215758509e+03, 0.5197545738384e-07, 0.6251760961735e+01, 0.1807370494127e+02, 0.5031345378608e-07, 0.2497341091913e+01, 0.4705732307012e+01, 0.4527110205840e-07, 0.2335079920992e+01, 0.6309374173736e+01, 0.4753355798089e-07, 0.7094148987474e+00, 0.5884926831456e+01, 0.4296951977516e-07, 0.1101916352091e+01, 0.6681224869435e+01, 0.3855341568387e-07, 0.1825495405486e+01, 0.5486777812467e+01, 0.5253930970990e-07, 0.4424740687208e+01, 0.7860419393880e+01, 0.4024630496471e-07, 0.5120498157053e+01, 0.1336797263425e+02, 0.4061069791453e-07, 0.6029771435451e+01, 0.3930209696940e+01, 0.3797883804205e-07, 0.4435193600836e+00, 0.3154687086868e+01, 0.2933033225587e-07, 0.5124157356507e+01, 0.1059381944224e+01, 0.3503000930426e-07, 0.5421830162065e+01, 0.6069776770667e+01, 0.3670096214050e-07, 0.4582101667297e+01, 0.1219403291462e+02, 0.2905609437008e-07, 0.1926566420072e+01, 0.1097707878456e+02, 0.2466827821713e-07, 0.6090174539834e+00, 0.6496374930224e+01, 0.2691647295332e-07, 0.1393432595077e+01, 0.2200391463820e+02, 0.2150554667946e-07, 0.4308671715951e+01, 0.5643178611111e+01, 0.2237481922680e-07, 0.8133968269414e+00, 0.8635942003952e+01, 0.1817741038157e-07, 0.3755205127454e+01, 0.3340612434717e+01, 0.2227820762132e-07, 0.2759558596664e+01, 0.1203646072878e+02, 0.1944713772307e-07, 0.5699645869121e+01, 0.1179062909082e+02, 0.1527340520662e-07, 0.1986749091746e+01, 0.3981490189893e+00, 0.1577282574914e-07, 0.3205017217983e+01, 0.5088628793478e+01, 0.1424738825424e-07, 0.6256747903666e+01, 0.2544314396739e+01, 0.1616563121701e-07, 0.2601671259394e+00, 0.1729818233119e+02, 0.1401210391692e-07, 0.4686939173506e+01, 0.7058598460518e+01, 0.1488726974214e-07, 0.2815862451372e+01, 0.2593412433514e+02, 0.1692626442388e-07, 0.4956894109797e+01, 0.1564752902480e+03, 0.1123571582910e-07, 0.2381192697696e+01, 0.3738761453707e+01, 0.9903308606317e-08, 0.4294851657684e+01, 0.9225539266174e+01, 0.9174533187191e-08, 0.3075171510642e+01, 0.4164311961999e+01, 0.8645985631457e-08, 0.5477534821633e+00, 0.8429241228195e+01, -0.1085876492688e-07, 0.0000000000000e+00, 0.0000000000000e+00, 0.9264309077815e-08, 0.5968571670097e+01, 0.7079373888424e+01, 0.8243116984954e-08, 0.1489098777643e+01, 0.1044738781244e+02, 0.8268102113708e-08, 0.3512977691983e+01, 0.1150676975667e+02, 0.9043613988227e-08, 0.1290704408221e+00, 0.1101510648075e+02, 0.7432912038789e-08, 0.1991086893337e+01, 0.2608790314060e+02, 0.8586233727285e-08, 0.4238357924414e+01, 0.2986433403208e+02, 0.7612230060131e-08, 0.2911090150166e+01, 0.4732030630302e+01, 0.7097787751408e-08, 0.1908938392390e+01, 0.8031092209206e+01, 0.7640237040175e-08, 0.6129219000168e+00, 0.7962980379786e+00, 0.7070445688081e-08, 0.1380417036651e+01, 0.2146165377750e+01, 0.7690770957702e-08, 0.1680504249084e+01, 0.2122839202813e+02, 0.8051292542594e-08, 0.5127423484511e+01, 0.2942463415728e+01, 0.5902709104515e-08, 0.2020274190917e+01, 0.7755226100720e+00, 0.5134567496462e-08, 0.2606778676418e+01, 0.1256615170089e+02, 0.5525802046102e-08, 0.1613011769663e+01, 0.8018209333619e+00, 0.5880724784221e-08, 0.4604483417236e+01, 0.4690479774488e+01, 0.5211699081370e-08, 0.5718964114193e+01, 0.8827390247185e+01, 0.4891849573562e-08, 0.3689658932196e+01, 0.2132990797783e+00, 0.5150246069997e-08, 0.4099769855122e+01, 0.6480980550449e+02, 0.5102434319633e-08, 0.5660834602509e+01, 0.3379454372902e+02, 0.5083405254252e-08, 0.9842221218974e+00, 0.4136910472696e+01, 0.4206562585682e-08, 0.1341363634163e+00, 0.3128388763578e+01, 0.4663249683579e-08, 0.8130132735866e+00, 0.5216580451554e+01, 0.4099474416530e-08, 0.5791497770644e+01, 0.4265981595566e+00, 0.4628251220767e-08, 0.1249802769331e+01, 0.1572083878776e+02, 0.5024068728142e-08, 0.4795684802743e+01, 0.6290189305114e+01, 0.5120234327758e-08, 0.3810420387208e+01, 0.5230807360890e+01, 0.5524029815280e-08, 0.1029264714351e+01, 0.2397622045175e+03, 0.4757415718860e-08, 0.3528044781779e+01, 0.1649636139783e+02, 0.3915786131127e-08, 0.5593889282646e+01, 0.1589072916335e+01, 0.4869053149991e-08, 0.3299636454433e+01, 0.7632943190217e+01, 0.3649365703729e-08, 0.1286049002584e+01, 0.6206810014183e+01, 0.3992493949002e-08, 0.3100307589464e+01, 0.2515860172507e+02, 0.3320247477418e-08, 0.6212683940807e+01, 0.1216800268190e+02, 0.3287123739696e-08, 0.4699118445928e+01, 0.7234794171227e+01, 0.3472776811103e-08, 0.2630507142004e+01, 0.7342457794669e+01, 0.3423253294767e-08, 0.2946432844305e+01, 0.9623688285163e+01, 0.3896173898244e-08, 0.1224834179264e+01, 0.6438496133249e+01, 0.3388455337924e-08, 0.1543807616351e+01, 0.1494531617769e+02, 0.3062704716523e-08, 0.1191777572310e+01, 0.8662240327241e+01, 0.3270075600400e-08, 0.5483498767737e+01, 0.1194447056968e+01, 0.3101209215259e-08, 0.8000833804348e+00, 0.3772475342596e+02, 0.2780883347311e-08, 0.4077980721888e+00, 0.5863591145557e+01, 0.2903605931824e-08, 0.2617490302147e+01, 0.1965104848470e+02, 0.2682014743119e-08, 0.2634703158290e+01, 0.7238675589263e+01, 0.2534360108492e-08, 0.6102446114873e+01, 0.6836645152238e+01, 0.2392564882509e-08, 0.3681820208691e+01, 0.5849364236221e+01, 0.2656667254856e-08, 0.6216045388886e+01, 0.6133512519065e+01, 0.2331242096773e-08, 0.5864949777744e+01, 0.4535059491685e+01, 0.2287898363668e-08, 0.4566628532802e+01, 0.7477522907414e+01, 0.2336944521306e-08, 0.2442722126930e+01, 0.1137170464392e+02, 0.3156632236269e-08, 0.1626628050682e+01, 0.2509084901204e+03, 0.2982612402766e-08, 0.2803604512609e+01, 0.1748016358760e+01, 0.2774031674807e-08, 0.4654002897158e+01, 0.8223916695780e+02, 0.2295236548638e-08, 0.4326518333253e+01, 0.3378142627421e+00, 0.2190714699873e-08, 0.4519614578328e+01, 0.2908881142201e+02, 0.2191495845045e-08, 0.3012626912549e+01, 0.1673046366289e+02, 0.2492901628386e-08, 0.1290101424052e+00, 0.1543797956245e+03, 0.1993778064319e-08, 0.3864046799414e+01, 0.1778984560711e+02, 0.1898146479022e-08, 0.5053777235891e+01, 0.2042657109477e+02, 0.1918280127634e-08, 0.2222470192548e+01, 0.4165496312290e+02, 0.1916351061607e-08, 0.8719067257774e+00, 0.7737595720538e+02, 0.1834720181466e-08, 0.4031491098040e+01, 0.2358125818164e+02, 0.1249201523806e-08, 0.5938379466835e+01, 0.3301902111895e+02, 0.1477304050539e-08, 0.6544722606797e+00, 0.9548094718417e+02, 0.1264316431249e-08, 0.2059072853236e+01, 0.8399684731857e+02, 0.1203526495039e-08, 0.3644813532605e+01, 0.4558517281984e+02, 0.9221681059831e-09, 0.3241815055602e+01, 0.7805158573086e+02, 0.7849278367646e-09, 0.5043812342457e+01, 0.5217580628120e+02, 0.7983392077387e-09, 0.5000024502753e+01, 0.1501922143975e+03, 0.7925395431654e-09, 0.1398734871821e-01, 0.9061773743175e+02, 0.7640473285886e-09, 0.5067111723130e+01, 0.4951538251678e+02, 0.5398937754482e-09, 0.5597382200075e+01, 0.1613385000004e+03, 0.5626247550193e-09, 0.2601338209422e+01, 0.7318837597844e+02, 0.5525197197855e-09, 0.5814832109256e+01, 0.1432335100216e+03, 0.5407629837898e-09, 0.3384820609076e+01, 0.3230491187871e+03, 0.3856739119801e-09, 0.1072391840473e+01, 0.2334791286671e+03, 0.3856425239987e-09, 0.2369540393327e+01, 0.1739046517013e+03, 0.4350867755983e-09, 0.5255575751082e+01, 0.1620484330494e+03, 0.3844113924996e-09, 0.5482356246182e+01, 0.9757644180768e+02, 0.2854869155431e-09, 0.9573634763143e+00, 0.1697170704744e+03, 0.1719227671416e-09, 0.1887203025202e+01, 0.2265204242912e+03, 0.1527846879755e-09, 0.3982183931157e+01, 0.3341954043900e+03, 0.1128229264847e-09, 0.2787457156298e+01, 0.3119028331842e+03 }; /* Sun-to-Earth, T^1, X */ static const double e1x[] = { 0.1234046326004e-05, 0.0000000000000e+00, 0.0000000000000e+00, 0.5150068824701e-06, 0.6002664557501e+01, 0.1256615170089e+02, 0.1290743923245e-07, 0.5959437664199e+01, 0.1884922755134e+02, 0.1068615564952e-07, 0.2015529654209e+01, 0.6283075850446e+01, 0.2079619142538e-08, 0.1732960531432e+01, 0.6279552690824e+01, 0.2078009243969e-08, 0.4915604476996e+01, 0.6286599010068e+01, 0.6206330058856e-09, 0.3616457953824e+00, 0.4705732307012e+01, 0.5989335313746e-09, 0.3802607304474e+01, 0.6256777527156e+01, 0.5958495663840e-09, 0.2845866560031e+01, 0.6309374173736e+01, 0.4866923261539e-09, 0.5213203771824e+01, 0.7755226100720e+00, 0.4267785823142e-09, 0.4368189727818e+00, 0.1059381944224e+01, 0.4610675141648e-09, 0.1837249181372e-01, 0.7860419393880e+01, 0.3626989993973e-09, 0.2161590545326e+01, 0.5753384878334e+01, 0.3563071194389e-09, 0.1452631954746e+01, 0.5884926831456e+01, 0.3557015642807e-09, 0.4470593393054e+01, 0.6812766822558e+01, 0.3210412089122e-09, 0.5195926078314e+01, 0.6681224869435e+01, 0.2875473577986e-09, 0.5916256610193e+01, 0.2513230340178e+02, 0.2842913681629e-09, 0.1149902426047e+01, 0.6127655567643e+01, 0.2751248215916e-09, 0.5502088574662e+01, 0.6438496133249e+01, 0.2481432881127e-09, 0.2921989846637e+01, 0.5486777812467e+01, 0.2059885976560e-09, 0.3718070376585e+01, 0.7079373888424e+01, 0.2015522342591e-09, 0.5979395259740e+01, 0.6290189305114e+01, 0.1995364084253e-09, 0.6772087985494e+00, 0.6275962395778e+01, 0.1957436436943e-09, 0.2899210654665e+01, 0.5507553240374e+01, 0.1651609818948e-09, 0.6228206482192e+01, 0.1150676975667e+02, 0.1822980550699e-09, 0.1469348746179e+01, 0.1179062909082e+02, 0.1675223159760e-09, 0.3813910555688e+01, 0.7058598460518e+01, 0.1706491764745e-09, 0.3004380506684e+00, 0.7113454667900e-02, 0.1392952362615e-09, 0.1440393973406e+01, 0.7962980379786e+00, 0.1209868266342e-09, 0.4150425791727e+01, 0.4694002934110e+01, 0.1009827202611e-09, 0.3290040429843e+01, 0.3738761453707e+01, 0.1047261388602e-09, 0.4229590090227e+01, 0.6282095334605e+01, 0.1047006652004e-09, 0.2418967680575e+01, 0.6284056366286e+01, 0.9609993143095e-10, 0.4627943659201e+01, 0.6069776770667e+01, 0.9590900593873e-10, 0.1894393939924e+01, 0.4136910472696e+01, 0.9146249188071e-10, 0.2010647519562e+01, 0.6496374930224e+01, 0.8545274480290e-10, 0.5529846956226e-01, 0.1194447056968e+01, 0.8224377881194e-10, 0.1254304102174e+01, 0.1589072916335e+01, 0.6183529510410e-10, 0.3360862168815e+01, 0.8827390247185e+01, 0.6259255147141e-10, 0.4755628243179e+01, 0.8429241228195e+01, 0.5539291694151e-10, 0.5371746955142e+01, 0.4933208510675e+01, 0.7328259466314e-10, 0.4927699613906e+00, 0.4535059491685e+01, 0.6017835843560e-10, 0.5776682001734e-01, 0.1255903824622e+02, 0.7079827775243e-10, 0.4395059432251e+01, 0.5088628793478e+01, 0.5170358878213e-10, 0.5154062619954e+01, 0.1176985366291e+02, 0.4872301838682e-10, 0.6289611648973e+00, 0.6040347114260e+01, 0.5249869411058e-10, 0.5617272046949e+01, 0.3154687086868e+01, 0.4716172354411e-10, 0.3965901800877e+01, 0.5331357529664e+01, 0.4871214940964e-10, 0.4627507050093e+01, 0.1256967486051e+02, 0.4598076850751e-10, 0.6023631226459e+01, 0.6525804586632e+01, 0.4562196089485e-10, 0.4138562084068e+01, 0.3930209696940e+01, 0.4325493872224e-10, 0.1330845906564e+01, 0.7632943190217e+01, 0.5673781176748e-10, 0.2558752615657e+01, 0.5729506548653e+01, 0.3961436642503e-10, 0.2728071734630e+01, 0.7234794171227e+01, 0.5101868209058e-10, 0.4113444965144e+01, 0.6836645152238e+01, 0.5257043167676e-10, 0.6195089830590e+01, 0.8031092209206e+01, 0.5076613989393e-10, 0.2305124132918e+01, 0.7477522907414e+01, 0.3342169352778e-10, 0.5415998155071e+01, 0.1097707878456e+02, 0.3545881983591e-10, 0.3727160564574e+01, 0.4164311961999e+01, 0.3364063738599e-10, 0.2901121049204e+00, 0.1137170464392e+02, 0.3357039670776e-10, 0.1652229354331e+01, 0.5223693906222e+01, 0.4307412268687e-10, 0.4938909587445e+01, 0.1592596075957e+01, 0.3405769115435e-10, 0.2408890766511e+01, 0.3128388763578e+01, 0.3001926198480e-10, 0.4862239006386e+01, 0.1748016358760e+01, 0.2778264787325e-10, 0.5241168661353e+01, 0.7342457794669e+01, 0.2676159480666e-10, 0.3423593942199e+01, 0.2146165377750e+01, 0.2954273399939e-10, 0.1881721265406e+01, 0.5368044267797e+00, 0.3309362888795e-10, 0.1931525677349e+01, 0.8018209333619e+00, 0.2810283608438e-10, 0.2414659495050e+01, 0.5225775174439e+00, 0.3378045637764e-10, 0.4238019163430e+01, 0.1554202828031e+00, 0.2558134979840e-10, 0.1828225235805e+01, 0.5230807360890e+01, 0.2273755578447e-10, 0.5858184283998e+01, 0.7084896783808e+01, 0.2294176037690e-10, 0.4514589779057e+01, 0.1726015463500e+02, 0.2533506099435e-10, 0.2355717851551e+01, 0.5216580451554e+01, 0.2716685375812e-10, 0.2221003625100e+01, 0.8635942003952e+01, 0.2419043435198e-10, 0.5955704951635e+01, 0.4690479774488e+01, 0.2521232544812e-10, 0.1395676848521e+01, 0.5481254917084e+01, 0.2630195021491e-10, 0.5727468918743e+01, 0.2629832328990e-01, 0.2548395840944e-10, 0.2628351859400e-03, 0.1349867339771e+01 }; /* Sun-to-Earth, T^1, Y */ static const double e1y[] = { 0.9304690546528e-06, 0.0000000000000e+00, 0.0000000000000e+00, 0.5150715570663e-06, 0.4431807116294e+01, 0.1256615170089e+02, 0.1290825411056e-07, 0.4388610039678e+01, 0.1884922755134e+02, 0.4645466665386e-08, 0.5827263376034e+01, 0.6283075850446e+01, 0.2079625310718e-08, 0.1621698662282e+00, 0.6279552690824e+01, 0.2078189850907e-08, 0.3344713435140e+01, 0.6286599010068e+01, 0.6207190138027e-09, 0.5074049319576e+01, 0.4705732307012e+01, 0.5989826532569e-09, 0.2231842216620e+01, 0.6256777527156e+01, 0.5961360812618e-09, 0.1274975769045e+01, 0.6309374173736e+01, 0.4874165471016e-09, 0.3642277426779e+01, 0.7755226100720e+00, 0.4283834034360e-09, 0.5148765510106e+01, 0.1059381944224e+01, 0.4652389287529e-09, 0.4715794792175e+01, 0.7860419393880e+01, 0.3751707476401e-09, 0.6617207370325e+00, 0.5753384878334e+01, 0.3559998806198e-09, 0.6155548875404e+01, 0.5884926831456e+01, 0.3558447558857e-09, 0.2898827297664e+01, 0.6812766822558e+01, 0.3211116927106e-09, 0.3625813502509e+01, 0.6681224869435e+01, 0.2875609914672e-09, 0.4345435813134e+01, 0.2513230340178e+02, 0.2843109704069e-09, 0.5862263940038e+01, 0.6127655567643e+01, 0.2744676468427e-09, 0.3926419475089e+01, 0.6438496133249e+01, 0.2481285237789e-09, 0.1351976572828e+01, 0.5486777812467e+01, 0.2060338481033e-09, 0.2147556998591e+01, 0.7079373888424e+01, 0.2015822358331e-09, 0.4408358972216e+01, 0.6290189305114e+01, 0.2001195944195e-09, 0.5385829822531e+01, 0.6275962395778e+01, 0.1953667642377e-09, 0.1304933746120e+01, 0.5507553240374e+01, 0.1839744078713e-09, 0.6173567228835e+01, 0.1179062909082e+02, 0.1643334294845e-09, 0.4635942997523e+01, 0.1150676975667e+02, 0.1768051018652e-09, 0.5086283558874e+01, 0.7113454667900e-02, 0.1674874205489e-09, 0.2243332137241e+01, 0.7058598460518e+01, 0.1421445397609e-09, 0.6186899771515e+01, 0.7962980379786e+00, 0.1255163958267e-09, 0.5730238465658e+01, 0.4694002934110e+01, 0.1013945281961e-09, 0.1726055228402e+01, 0.3738761453707e+01, 0.1047294335852e-09, 0.2658801228129e+01, 0.6282095334605e+01, 0.1047103879392e-09, 0.8481047835035e+00, 0.6284056366286e+01, 0.9530343962826e-10, 0.3079267149859e+01, 0.6069776770667e+01, 0.9604637611690e-10, 0.3258679792918e+00, 0.4136910472696e+01, 0.9153518537177e-10, 0.4398599886584e+00, 0.6496374930224e+01, 0.8562458214922e-10, 0.4772686794145e+01, 0.1194447056968e+01, 0.8232525360654e-10, 0.5966220721679e+01, 0.1589072916335e+01, 0.6150223411438e-10, 0.1780985591923e+01, 0.8827390247185e+01, 0.6272087858000e-10, 0.3184305429012e+01, 0.8429241228195e+01, 0.5540476311040e-10, 0.3801260595433e+01, 0.4933208510675e+01, 0.7331901699361e-10, 0.5205948591865e+01, 0.4535059491685e+01, 0.6018528702791e-10, 0.4770139083623e+01, 0.1255903824622e+02, 0.5150530724804e-10, 0.3574796899585e+01, 0.1176985366291e+02, 0.6471933741811e-10, 0.2679787266521e+01, 0.5088628793478e+01, 0.5317460644174e-10, 0.9528763345494e+00, 0.3154687086868e+01, 0.4832187748783e-10, 0.5329322498232e+01, 0.6040347114260e+01, 0.4716763555110e-10, 0.2395235316466e+01, 0.5331357529664e+01, 0.4871509139861e-10, 0.3056663648823e+01, 0.1256967486051e+02, 0.4598417696768e-10, 0.4452762609019e+01, 0.6525804586632e+01, 0.5674189533175e-10, 0.9879680872193e+00, 0.5729506548653e+01, 0.4073560328195e-10, 0.5939127696986e+01, 0.7632943190217e+01, 0.5040994945359e-10, 0.4549875824510e+01, 0.8031092209206e+01, 0.5078185134679e-10, 0.7346659893982e+00, 0.7477522907414e+01, 0.3769343537061e-10, 0.1071317188367e+01, 0.7234794171227e+01, 0.4980331365299e-10, 0.2500345341784e+01, 0.6836645152238e+01, 0.3458236594757e-10, 0.3825159450711e+01, 0.1097707878456e+02, 0.3578859493602e-10, 0.5299664791549e+01, 0.4164311961999e+01, 0.3370504646419e-10, 0.5002316301593e+01, 0.1137170464392e+02, 0.3299873338428e-10, 0.2526123275282e+01, 0.3930209696940e+01, 0.4304917318409e-10, 0.3368078557132e+01, 0.1592596075957e+01, 0.3402418753455e-10, 0.8385495425800e+00, 0.3128388763578e+01, 0.2778460572146e-10, 0.3669905203240e+01, 0.7342457794669e+01, 0.2782710128902e-10, 0.2691664812170e+00, 0.1748016358760e+01, 0.2711725179646e-10, 0.4707487217718e+01, 0.5296909721118e+00, 0.2981760946340e-10, 0.3190260867816e+00, 0.5368044267797e+00, 0.2811672977772e-10, 0.3196532315372e+01, 0.7084896783808e+01, 0.2863454474467e-10, 0.2263240324780e+00, 0.5223693906222e+01, 0.3333464634051e-10, 0.3498451685065e+01, 0.8018209333619e+00, 0.3312991747609e-10, 0.5839154477412e+01, 0.1554202828031e+00, 0.2813255564006e-10, 0.8268044346621e+00, 0.5225775174439e+00, 0.2665098083966e-10, 0.3934021725360e+01, 0.5216580451554e+01, 0.2349795705216e-10, 0.5197620913779e+01, 0.2146165377750e+01, 0.2330352293961e-10, 0.2984999231807e+01, 0.1726015463500e+02, 0.2728001683419e-10, 0.6521679638544e+00, 0.8635942003952e+01, 0.2484061007669e-10, 0.3468955561097e+01, 0.5230807360890e+01, 0.2646328768427e-10, 0.1013724533516e+01, 0.2629832328990e-01, 0.2518630264831e-10, 0.6108081057122e+01, 0.5481254917084e+01, 0.2421901455384e-10, 0.1651097776260e+01, 0.1349867339771e+01, 0.6348533267831e-11, 0.3220226560321e+01, 0.8433466158131e+02 }; /* Sun-to-Earth, T^1, Z */ static const double e1z[] = { 0.2278290449966e-05, 0.3413716033863e+01, 0.6283075850446e+01, 0.5429458209830e-07, 0.0000000000000e+00, 0.0000000000000e+00, 0.1903240492525e-07, 0.3370592358297e+01, 0.1256615170089e+02, 0.2385409276743e-09, 0.3327914718416e+01, 0.1884922755134e+02, 0.8676928342573e-10, 0.1824006811264e+01, 0.5223693906222e+01, 0.7765442593544e-10, 0.3888564279247e+01, 0.5507553240374e+01, 0.7066158332715e-10, 0.5194267231944e+01, 0.2352866153506e+01, 0.7092175288657e-10, 0.2333246960021e+01, 0.8399684731857e+02, 0.5357582213535e-10, 0.2224031176619e+01, 0.5296909721118e+00, 0.3828035865021e-10, 0.2156710933584e+01, 0.6279552690824e+01, 0.3824857220427e-10, 0.1529755219915e+01, 0.6286599010068e+01, 0.3286995181628e-10, 0.4879512900483e+01, 0.1021328554739e+02 }; /* Sun-to-Earth, T^2, X */ static const double e2x[] = { -0.4143818297913e-10, 0.0000000000000e+00, 0.0000000000000e+00, 0.2171497694435e-10, 0.4398225628264e+01, 0.1256615170089e+02, 0.9845398442516e-11, 0.2079720838384e+00, 0.6283075850446e+01, 0.9256833552682e-12, 0.4191264694361e+01, 0.1884922755134e+02, 0.1022049384115e-12, 0.5381133195658e+01, 0.8399684731857e+02 }; /* Sun-to-Earth, T^2, Y */ static const double e2y[] = { 0.5063375872532e-10, 0.0000000000000e+00, 0.0000000000000e+00, 0.2173815785980e-10, 0.2827805833053e+01, 0.1256615170089e+02, 0.1010231999920e-10, 0.4634612377133e+01, 0.6283075850446e+01, 0.9259745317636e-12, 0.2620612076189e+01, 0.1884922755134e+02, 0.1022202095812e-12, 0.3809562326066e+01, 0.8399684731857e+02 }; /* Sun-to-Earth, T^2, Z */ static const double e2z[] = { 0.9722666114891e-10, 0.5152219582658e+01, 0.6283075850446e+01, -0.3494819171909e-11, 0.0000000000000e+00, 0.0000000000000e+00, 0.6713034376076e-12, 0.6440188750495e+00, 0.1256615170089e+02 }; /* SSB-to-Sun, T^0, X */ static const double s0x[] = { 0.4956757536410e-02, 0.3741073751789e+01, 0.5296909721118e+00, 0.2718490072522e-02, 0.4016011511425e+01, 0.2132990797783e+00, 0.1546493974344e-02, 0.2170528330642e+01, 0.3813291813120e-01, 0.8366855276341e-03, 0.2339614075294e+01, 0.7478166569050e-01, 0.2936777942117e-03, 0.0000000000000e+00, 0.0000000000000e+00, 0.1201317439469e-03, 0.4090736353305e+01, 0.1059381944224e+01, 0.7578550887230e-04, 0.3241518088140e+01, 0.4265981595566e+00, 0.1941787367773e-04, 0.1012202064330e+01, 0.2061856251104e+00, 0.1889227765991e-04, 0.3892520416440e+01, 0.2204125344462e+00, 0.1937896968613e-04, 0.4797779441161e+01, 0.1495633313810e+00, 0.1434506110873e-04, 0.3868960697933e+01, 0.5225775174439e+00, 0.1406659911580e-04, 0.4759766557397e+00, 0.5368044267797e+00, 0.1179022300202e-04, 0.7774961520598e+00, 0.7626583626240e-01, 0.8085864460959e-05, 0.3254654471465e+01, 0.3664874755930e-01, 0.7622752967615e-05, 0.4227633103489e+01, 0.3961708870310e-01, 0.6209171139066e-05, 0.2791828325711e+00, 0.7329749511860e-01, 0.4366435633970e-05, 0.4440454875925e+01, 0.1589072916335e+01, 0.3792124889348e-05, 0.5156393842356e+01, 0.7113454667900e-02, 0.3154548963402e-05, 0.6157005730093e+01, 0.4194847048887e+00, 0.3088359882942e-05, 0.2494567553163e+01, 0.6398972393349e+00, 0.2788440902136e-05, 0.4934318747989e+01, 0.1102062672231e+00, 0.3039928456376e-05, 0.4895077702640e+01, 0.6283075850446e+01, 0.2272258457679e-05, 0.5278394064764e+01, 0.1030928125552e+00, 0.2162007057957e-05, 0.5802978019099e+01, 0.3163918923335e+00, 0.1767632855737e-05, 0.3415346595193e-01, 0.1021328554739e+02, 0.1349413459362e-05, 0.2001643230755e+01, 0.1484170571900e-02, 0.1170141900476e-05, 0.2424750491620e+01, 0.6327837846670e+00, 0.1054355266820e-05, 0.3123311487576e+01, 0.4337116142245e+00, 0.9800822461610e-06, 0.3026258088130e+01, 0.1052268489556e+01, 0.1091203749931e-05, 0.3157811670347e+01, 0.1162474756779e+01, 0.6960236715913e-06, 0.8219570542313e+00, 0.1066495398892e+01, 0.5689257296909e-06, 0.1323052375236e+01, 0.9491756770005e+00, 0.6613172135802e-06, 0.2765348881598e+00, 0.8460828644453e+00, 0.6277702517571e-06, 0.5794064466382e+01, 0.1480791608091e+00, 0.6304884066699e-06, 0.7323555380787e+00, 0.2243449970715e+00, 0.4897850467382e-06, 0.3062464235399e+01, 0.3340612434717e+01, 0.3759148598786e-06, 0.4588290469664e+01, 0.3516457698740e-01, 0.3110520548195e-06, 0.1374299536572e+01, 0.6373574839730e-01, 0.3064708359780e-06, 0.4222267485047e+01, 0.1104591729320e-01, 0.2856347168241e-06, 0.3714202944973e+01, 0.1510475019529e+00, 0.2840945514288e-06, 0.2847972875882e+01, 0.4110125927500e-01, 0.2378951599405e-06, 0.3762072563388e+01, 0.2275259891141e+00, 0.2714229481417e-06, 0.1036049980031e+01, 0.2535050500000e-01, 0.2323551717307e-06, 0.4682388599076e+00, 0.8582758298370e-01, 0.1881790512219e-06, 0.4790565425418e+01, 0.2118763888447e+01, 0.2261353968371e-06, 0.1669144912212e+01, 0.7181332454670e-01, 0.2214546389848e-06, 0.3937717281614e+01, 0.2968341143800e-02, 0.2184915594933e-06, 0.1129169845099e+00, 0.7775000683430e-01, 0.2000164937936e-06, 0.4030009638488e+01, 0.2093666171530e+00, 0.1966105136719e-06, 0.8745955786834e+00, 0.2172315424036e+00, 0.1904742332624e-06, 0.5919743598964e+01, 0.2022531624851e+00, 0.1657399705031e-06, 0.2549141484884e+01, 0.7358765972222e+00, 0.1574070533987e-06, 0.5277533020230e+01, 0.7429900518901e+00, 0.1832261651039e-06, 0.3064688127777e+01, 0.3235053470014e+00, 0.1733615346569e-06, 0.3011432799094e+01, 0.1385174140878e+00, 0.1549124014496e-06, 0.4005569132359e+01, 0.5154640627760e+00, 0.1637044713838e-06, 0.1831375966632e+01, 0.8531963191132e+00, 0.1123420082383e-06, 0.1180270407578e+01, 0.1990721704425e+00, 0.1083754165740e-06, 0.3414101320863e+00, 0.5439178814476e+00, 0.1156638012655e-06, 0.6130479452594e+00, 0.5257585094865e+00, 0.1142548785134e-06, 0.3724761948846e+01, 0.5336234347371e+00, 0.7921463895965e-07, 0.2435425589361e+01, 0.1478866649112e+01, 0.7428600285231e-07, 0.3542144398753e+01, 0.2164800718209e+00, 0.8323211246747e-07, 0.3525058072354e+01, 0.1692165728891e+01, 0.7257595116312e-07, 0.1364299431982e+01, 0.2101180877357e+00, 0.7111185833236e-07, 0.2460478875808e+01, 0.4155522422634e+00, 0.6868090383716e-07, 0.4397327670704e+01, 0.1173197218910e+00, 0.7226419974175e-07, 0.4042647308905e+01, 0.1265567569334e+01, 0.6955642383177e-07, 0.2865047906085e+01, 0.9562891316684e+00, 0.7492139296331e-07, 0.5014278994215e+01, 0.1422690933580e-01, 0.6598363128857e-07, 0.2376730020492e+01, 0.6470106940028e+00, 0.7381147293385e-07, 0.3272990384244e+01, 0.1581959461667e+01, 0.6402909624032e-07, 0.5302290955138e+01, 0.9597935788730e-01, 0.6237454263857e-07, 0.5444144425332e+01, 0.7084920306520e-01, 0.5241198544016e-07, 0.4215359579205e+01, 0.5265099800692e+00, 0.5144463853918e-07, 0.1218916689916e+00, 0.5328719641544e+00, 0.5868164772299e-07, 0.2369402002213e+01, 0.7871412831580e-01, 0.6233195669151e-07, 0.1254922242403e+01, 0.2608790314060e+02, 0.6068463791422e-07, 0.5679713760431e+01, 0.1114304132498e+00, 0.4359361135065e-07, 0.6097219641646e+00, 0.1375773836557e+01, 0.4686510366826e-07, 0.4786231041431e+01, 0.1143987543936e+00, 0.3758977287225e-07, 0.1167368068139e+01, 0.1596186371003e+01, 0.4282051974778e-07, 0.1519471064319e+01, 0.2770348281756e+00, 0.5153765386113e-07, 0.1860532322984e+01, 0.2228608264996e+00, 0.4575129387188e-07, 0.7632857887158e+00, 0.1465949902372e+00, 0.3326844933286e-07, 0.1298219485285e+01, 0.5070101000000e-01, 0.3748617450984e-07, 0.1046510321062e+01, 0.4903339079539e+00, 0.2816756661499e-07, 0.3434522346190e+01, 0.2991266627620e+00, 0.3412750405039e-07, 0.2523766270318e+01, 0.3518164938661e+00, 0.2655796761776e-07, 0.2904422260194e+01, 0.6256703299991e+00, 0.2963597929458e-07, 0.5923900431149e+00, 0.1099462426779e+00, 0.2539523734781e-07, 0.4851947722567e+01, 0.1256615170089e+02, 0.2283087914139e-07, 0.3400498595496e+01, 0.6681224869435e+01, 0.2321309799331e-07, 0.5789099148673e+01, 0.3368040641550e-01, 0.2549657649750e-07, 0.3991856479792e-01, 0.1169588211447e+01, 0.2290462303977e-07, 0.2788567577052e+01, 0.1045155034888e+01, 0.1945398522914e-07, 0.3290896998176e+01, 0.1155361302111e+01, 0.1849171512638e-07, 0.2698060129367e+01, 0.4452511715700e-02, 0.1647199834254e-07, 0.3016735644085e+01, 0.4408250688924e+00, 0.1529530765273e-07, 0.5573043116178e+01, 0.6521991896920e-01, 0.1433199339978e-07, 0.1481192356147e+01, 0.9420622223326e+00, 0.1729134193602e-07, 0.1422817538933e+01, 0.2108507877249e+00, 0.1716463931346e-07, 0.3469468901855e+01, 0.2157473718317e+00, 0.1391206061378e-07, 0.6122436220547e+01, 0.4123712502208e+00, 0.1404746661924e-07, 0.1647765641936e+01, 0.4258542984690e-01, 0.1410452399455e-07, 0.5989729161964e+01, 0.2258291676434e+00, 0.1089828772168e-07, 0.2833705509371e+01, 0.4226656969313e+00, 0.1047374564948e-07, 0.5090690007331e+00, 0.3092784376656e+00, 0.1358279126532e-07, 0.5128990262836e+01, 0.7923417740620e-01, 0.1020456476148e-07, 0.9632772880808e+00, 0.1456308687557e+00, 0.1033428735328e-07, 0.3223779318418e+01, 0.1795258541446e+01, 0.1412435841540e-07, 0.2410271572721e+01, 0.1525316725248e+00, 0.9722759371574e-08, 0.2333531395690e+01, 0.8434341241180e-01, 0.9657334084704e-08, 0.6199270974168e+01, 0.1272681024002e+01, 0.1083641148690e-07, 0.2864222292929e+01, 0.7032915397480e-01, 0.1067318403838e-07, 0.5833458866568e+00, 0.2123349582968e+00, 0.1062366201976e-07, 0.4307753989494e+01, 0.2142632012598e+00, 0.1236364149266e-07, 0.2873917870593e+01, 0.1847279083684e+00, 0.1092759489593e-07, 0.2959887266733e+01, 0.1370332435159e+00, 0.8912069362899e-08, 0.5141213702562e+01, 0.2648454860559e+01, 0.9656467707970e-08, 0.4532182462323e+01, 0.4376440768498e+00, 0.8098386150135e-08, 0.2268906338379e+01, 0.2880807454688e+00, 0.7857714675000e-08, 0.4055544260745e+01, 0.2037373330570e+00, 0.7288455940646e-08, 0.5357901655142e+01, 0.1129145838217e+00, 0.9450595950552e-08, 0.4264926963939e+01, 0.5272426800584e+00, 0.9381718247537e-08, 0.7489366976576e-01, 0.5321392641652e+00, 0.7079052646038e-08, 0.1923311052874e+01, 0.6288513220417e+00, 0.9259004415344e-08, 0.2970256853438e+01, 0.1606092486742e+00, 0.8259801499742e-08, 0.3327056314697e+01, 0.8389694097774e+00, 0.6476334355779e-08, 0.2954925505727e+01, 0.2008557621224e+01, 0.5984021492007e-08, 0.9138753105829e+00, 0.2042657109477e+02, 0.5989546863181e-08, 0.3244464082031e+01, 0.2111650433779e+01, 0.6233108606023e-08, 0.4995232638403e+00, 0.4305306221819e+00, 0.6877299149965e-08, 0.2834987233449e+01, 0.9561746721300e-02, 0.8311234227190e-08, 0.2202951835758e+01, 0.3801276407308e+00, 0.6599472832414e-08, 0.4478581462618e+01, 0.1063314406849e+01, 0.6160491096549e-08, 0.5145858696411e+01, 0.1368660381889e+01, 0.6164772043891e-08, 0.3762976697911e+00, 0.4234171675140e+00, 0.6363248684450e-08, 0.3162246718685e+01, 0.1253008786510e-01, 0.6448587520999e-08, 0.3442693302119e+01, 0.5287268506303e+00, 0.6431662283977e-08, 0.8977549136606e+00, 0.5306550935933e+00, 0.6351223158474e-08, 0.4306447410369e+01, 0.5217580628120e+02, 0.5476721393451e-08, 0.3888529177855e+01, 0.2221856701002e+01, 0.5341772572619e-08, 0.2655560662512e+01, 0.7466759693650e-01, 0.5337055758302e-08, 0.5164990735946e+01, 0.7489573444450e-01, 0.5373120816787e-08, 0.6041214553456e+01, 0.1274714967946e+00, 0.5392351705426e-08, 0.9177763485932e+00, 0.1055449481598e+01, 0.6688495850205e-08, 0.3089608126937e+01, 0.2213766559277e+00, 0.5072003660362e-08, 0.4311316541553e+01, 0.2132517061319e+00, 0.5070726650455e-08, 0.5790675464444e+00, 0.2133464534247e+00, 0.5658012950032e-08, 0.2703945510675e+01, 0.7287631425543e+00, 0.4835509924854e-08, 0.2975422976065e+01, 0.7160067364790e-01, 0.6479821978012e-08, 0.1324168733114e+01, 0.2209183458640e-01, 0.6230636494980e-08, 0.2860103632836e+01, 0.3306188016693e+00, 0.4649239516213e-08, 0.4832259763403e+01, 0.7796265773310e-01, 0.6487325792700e-08, 0.2726165825042e+01, 0.3884652414254e+00, 0.4682823682770e-08, 0.6966602455408e+00, 0.1073608853559e+01, 0.5704230804976e-08, 0.5669634104606e+01, 0.8731175355560e-01, 0.6125413585489e-08, 0.1513386538915e+01, 0.7605151500000e-01, 0.6035825038187e-08, 0.1983509168227e+01, 0.9846002785331e+00, 0.4331123462303e-08, 0.2782892992807e+01, 0.4297791515992e+00, 0.4681107685143e-08, 0.5337232886836e+01, 0.2127790306879e+00, 0.4669105829655e-08, 0.5837133792160e+01, 0.2138191288687e+00, 0.5138823602365e-08, 0.3080560200507e+01, 0.7233337363710e-01, 0.4615856664534e-08, 0.1661747897471e+01, 0.8603097737811e+00, 0.4496916702197e-08, 0.2112508027068e+01, 0.7381754420900e-01, 0.4278479042945e-08, 0.5716528462627e+01, 0.7574578717200e-01, 0.3840525503932e-08, 0.6424172726492e+00, 0.3407705765729e+00, 0.4866636509685e-08, 0.4919244697715e+01, 0.7722995774390e-01, 0.3526100639296e-08, 0.2550821052734e+01, 0.6225157782540e-01, 0.3939558488075e-08, 0.3939331491710e+01, 0.5268983110410e-01, 0.4041268772576e-08, 0.2275337571218e+01, 0.3503323232942e+00, 0.3948761842853e-08, 0.1999324200790e+01, 0.1451108196653e+00, 0.3258394550029e-08, 0.9121001378200e+00, 0.5296435984654e+00, 0.3257897048761e-08, 0.3428428660869e+01, 0.5297383457582e+00, 0.3842559031298e-08, 0.6132927720035e+01, 0.9098186128426e+00, 0.3109920095448e-08, 0.7693650193003e+00, 0.3932462625300e-02, 0.3132237775119e-08, 0.3621293854908e+01, 0.2346394437820e+00, 0.3942189421510e-08, 0.4841863659733e+01, 0.3180992042600e-02, 0.3796972285340e-08, 0.1814174994268e+01, 0.1862120789403e+00, 0.3995640233688e-08, 0.1386990406091e+01, 0.4549093064213e+00, 0.2875013727414e-08, 0.9178318587177e+00, 0.1905464808669e+01, 0.3073719932844e-08, 0.2688923811835e+01, 0.3628624111593e+00, 0.2731016580075e-08, 0.1188259127584e+01, 0.2131850110243e+00, 0.2729549896546e-08, 0.3702160634273e+01, 0.2134131485323e+00, 0.3339372892449e-08, 0.7199163960331e+00, 0.2007689919132e+00, 0.2898833764204e-08, 0.1916709364999e+01, 0.5291709230214e+00, 0.2894536549362e-08, 0.2424043195547e+01, 0.5302110212022e+00, 0.3096872473843e-08, 0.4445894977497e+01, 0.2976424921901e+00, 0.2635672326810e-08, 0.3814366984117e+01, 0.1485980103780e+01, 0.3649302697001e-08, 0.2924200596084e+01, 0.6044726378023e+00, 0.3127954585895e-08, 0.1842251648327e+01, 0.1084620721060e+00, 0.2616040173947e-08, 0.4155841921984e+01, 0.1258454114666e+01, 0.2597395859860e-08, 0.1158045978874e+00, 0.2103781122809e+00, 0.2593286172210e-08, 0.4771850408691e+01, 0.2162200472757e+00, 0.2481823585747e-08, 0.4608842558889e+00, 0.1062562936266e+01, 0.2742219550725e-08, 0.1538781127028e+01, 0.5651155736444e+00, 0.3199558469610e-08, 0.3226647822878e+00, 0.7036329877322e+00, 0.2666088542957e-08, 0.1967991731219e+00, 0.1400015846597e+00, 0.2397067430580e-08, 0.3707036669873e+01, 0.2125476091956e+00, 0.2376570772738e-08, 0.1182086628042e+01, 0.2140505503610e+00, 0.2547228007887e-08, 0.4906256820629e+01, 0.1534957940063e+00, 0.2265575594114e-08, 0.3414949866857e+01, 0.2235935264888e+00, 0.2464381430585e-08, 0.4599122275378e+01, 0.2091065926078e+00, 0.2433408527044e-08, 0.2830751145445e+00, 0.2174915669488e+00, 0.2443605509076e-08, 0.4212046432538e+01, 0.1739420156204e+00, 0.2319779262465e-08, 0.9881978408630e+00, 0.7530171478090e-01, 0.2284622835465e-08, 0.5565347331588e+00, 0.7426161660010e-01, 0.2467268750783e-08, 0.5655708150766e+00, 0.2526561439362e+00, 0.2808513492782e-08, 0.1418405053408e+01, 0.5636314030725e+00, 0.2329528932532e-08, 0.4069557545675e+01, 0.1056200952181e+01, 0.9698639532817e-09, 0.1074134313634e+01, 0.7826370942180e+02 }; /* SSB-to-Sun, T^0, Y */ static const double s0y[] = { 0.4955392320126e-02, 0.2170467313679e+01, 0.5296909721118e+00, 0.2722325167392e-02, 0.2444433682196e+01, 0.2132990797783e+00, 0.1546579925346e-02, 0.5992779281546e+00, 0.3813291813120e-01, 0.8363140252966e-03, 0.7687356310801e+00, 0.7478166569050e-01, 0.3385792683603e-03, 0.0000000000000e+00, 0.0000000000000e+00, 0.1201192221613e-03, 0.2520035601514e+01, 0.1059381944224e+01, 0.7587125720554e-04, 0.1669954006449e+01, 0.4265981595566e+00, 0.1964155361250e-04, 0.5707743963343e+01, 0.2061856251104e+00, 0.1891900364909e-04, 0.2320960679937e+01, 0.2204125344462e+00, 0.1937373433356e-04, 0.3226940689555e+01, 0.1495633313810e+00, 0.1437139941351e-04, 0.2301626908096e+01, 0.5225775174439e+00, 0.1406267683099e-04, 0.5188579265542e+01, 0.5368044267797e+00, 0.1178703080346e-04, 0.5489483248476e+01, 0.7626583626240e-01, 0.8079835186041e-05, 0.1683751835264e+01, 0.3664874755930e-01, 0.7623253594652e-05, 0.2656400462961e+01, 0.3961708870310e-01, 0.6248667483971e-05, 0.4992775362055e+01, 0.7329749511860e-01, 0.4366353695038e-05, 0.2869706279678e+01, 0.1589072916335e+01, 0.3829101568895e-05, 0.3572131359950e+01, 0.7113454667900e-02, 0.3175733773908e-05, 0.4535372530045e+01, 0.4194847048887e+00, 0.3092437902159e-05, 0.9230153317909e+00, 0.6398972393349e+00, 0.2874168812154e-05, 0.3363143761101e+01, 0.1102062672231e+00, 0.3040119321826e-05, 0.3324250895675e+01, 0.6283075850446e+01, 0.2699723308006e-05, 0.2917882441928e+00, 0.1030928125552e+00, 0.2134832683534e-05, 0.4220997202487e+01, 0.3163918923335e+00, 0.1770412139433e-05, 0.4747318496462e+01, 0.1021328554739e+02, 0.1377264209373e-05, 0.4305058462401e+00, 0.1484170571900e-02, 0.1127814538960e-05, 0.8538177240740e+00, 0.6327837846670e+00, 0.1055608090130e-05, 0.1551800742580e+01, 0.4337116142245e+00, 0.9802673861420e-06, 0.1459646735377e+01, 0.1052268489556e+01, 0.1090329461951e-05, 0.1587351228711e+01, 0.1162474756779e+01, 0.6959590025090e-06, 0.5534442628766e+01, 0.1066495398892e+01, 0.5664914529542e-06, 0.6030673003297e+01, 0.9491756770005e+00, 0.6607787763599e-06, 0.4989507233927e+01, 0.8460828644453e+00, 0.6269725742838e-06, 0.4222951804572e+01, 0.1480791608091e+00, 0.6301889697863e-06, 0.5444316669126e+01, 0.2243449970715e+00, 0.4891042662861e-06, 0.1490552839784e+01, 0.3340612434717e+01, 0.3457083123290e-06, 0.3030475486049e+01, 0.3516457698740e-01, 0.3032559967314e-06, 0.2652038793632e+01, 0.1104591729320e-01, 0.2841133988903e-06, 0.1276744786829e+01, 0.4110125927500e-01, 0.2855564444432e-06, 0.2143368674733e+01, 0.1510475019529e+00, 0.2765157135038e-06, 0.5444186109077e+01, 0.6373574839730e-01, 0.2382312465034e-06, 0.2190521137593e+01, 0.2275259891141e+00, 0.2808060365077e-06, 0.5735195064841e+01, 0.2535050500000e-01, 0.2332175234405e-06, 0.9481985524859e-01, 0.7181332454670e-01, 0.2322488199659e-06, 0.5180499361533e+01, 0.8582758298370e-01, 0.1881850258423e-06, 0.3219788273885e+01, 0.2118763888447e+01, 0.2196111392808e-06, 0.2366941159761e+01, 0.2968341143800e-02, 0.2183810335519e-06, 0.4825445110915e+01, 0.7775000683430e-01, 0.2002733093326e-06, 0.2457148995307e+01, 0.2093666171530e+00, 0.1967111767229e-06, 0.5586291545459e+01, 0.2172315424036e+00, 0.1568473250543e-06, 0.3708003123320e+01, 0.7429900518901e+00, 0.1852528314300e-06, 0.4310638151560e+01, 0.2022531624851e+00, 0.1832111226447e-06, 0.1494665322656e+01, 0.3235053470014e+00, 0.1746805502310e-06, 0.1451378500784e+01, 0.1385174140878e+00, 0.1555730966650e-06, 0.1068040418198e+01, 0.7358765972222e+00, 0.1554883462559e-06, 0.2442579035461e+01, 0.5154640627760e+00, 0.1638380568746e-06, 0.2597913420625e+00, 0.8531963191132e+00, 0.1159938593640e-06, 0.5834512021280e+01, 0.1990721704425e+00, 0.1083427965695e-06, 0.5054033177950e+01, 0.5439178814476e+00, 0.1156480369431e-06, 0.5325677432457e+01, 0.5257585094865e+00, 0.1141308860095e-06, 0.2153403923857e+01, 0.5336234347371e+00, 0.7913146470946e-07, 0.8642846847027e+00, 0.1478866649112e+01, 0.7439752463733e-07, 0.1970628496213e+01, 0.2164800718209e+00, 0.7280277104079e-07, 0.6073307250609e+01, 0.2101180877357e+00, 0.8319567719136e-07, 0.1954371928334e+01, 0.1692165728891e+01, 0.7137705549290e-07, 0.8904989440909e+00, 0.4155522422634e+00, 0.6900825396225e-07, 0.2825717714977e+01, 0.1173197218910e+00, 0.7245757216635e-07, 0.2481677513331e+01, 0.1265567569334e+01, 0.6961165696255e-07, 0.1292955312978e+01, 0.9562891316684e+00, 0.7571804456890e-07, 0.3427517575069e+01, 0.1422690933580e-01, 0.6605425721904e-07, 0.8052192701492e+00, 0.6470106940028e+00, 0.7375477357248e-07, 0.1705076390088e+01, 0.1581959461667e+01, 0.7041664951470e-07, 0.4848356967891e+00, 0.9597935788730e-01, 0.6322199535763e-07, 0.3878069473909e+01, 0.7084920306520e-01, 0.5244380279191e-07, 0.2645560544125e+01, 0.5265099800692e+00, 0.5143125704988e-07, 0.4834486101370e+01, 0.5328719641544e+00, 0.5871866319373e-07, 0.7981472548900e+00, 0.7871412831580e-01, 0.6300822573871e-07, 0.5979398788281e+01, 0.2608790314060e+02, 0.6062154271548e-07, 0.4108655402756e+01, 0.1114304132498e+00, 0.4361912339976e-07, 0.5322624319280e+01, 0.1375773836557e+01, 0.4417005920067e-07, 0.6240817359284e+01, 0.2770348281756e+00, 0.4686806749936e-07, 0.3214977301156e+01, 0.1143987543936e+00, 0.3758892132305e-07, 0.5879809634765e+01, 0.1596186371003e+01, 0.5151351332319e-07, 0.2893377688007e+00, 0.2228608264996e+00, 0.4554683578572e-07, 0.5475427144122e+01, 0.1465949902372e+00, 0.3442381385338e-07, 0.5992034796640e+01, 0.5070101000000e-01, 0.2831093954933e-07, 0.5367350273914e+01, 0.3092784376656e+00, 0.3756267090084e-07, 0.5758171285420e+01, 0.4903339079539e+00, 0.2816374679892e-07, 0.1863718700923e+01, 0.2991266627620e+00, 0.3419307025569e-07, 0.9524347534130e+00, 0.3518164938661e+00, 0.2904250494239e-07, 0.5304471615602e+01, 0.1099462426779e+00, 0.2471734511206e-07, 0.1297069793530e+01, 0.6256703299991e+00, 0.2539620831872e-07, 0.3281126083375e+01, 0.1256615170089e+02, 0.2281017868007e-07, 0.1829122133165e+01, 0.6681224869435e+01, 0.2275319473335e-07, 0.5797198160181e+01, 0.3932462625300e-02, 0.2547755368442e-07, 0.4752697708330e+01, 0.1169588211447e+01, 0.2285979669317e-07, 0.1223205292886e+01, 0.1045155034888e+01, 0.1913386560994e-07, 0.1757532993389e+01, 0.1155361302111e+01, 0.1809020525147e-07, 0.4246116108791e+01, 0.3368040641550e-01, 0.1649213300201e-07, 0.1445162890627e+01, 0.4408250688924e+00, 0.1834972793932e-07, 0.1126917567225e+01, 0.4452511715700e-02, 0.1439550648138e-07, 0.6160756834764e+01, 0.9420622223326e+00, 0.1487645457041e-07, 0.4358761931792e+01, 0.4123712502208e+00, 0.1731729516660e-07, 0.6134456753344e+01, 0.2108507877249e+00, 0.1717747163567e-07, 0.1898186084455e+01, 0.2157473718317e+00, 0.1418190430374e-07, 0.4180286741266e+01, 0.6521991896920e-01, 0.1404844134873e-07, 0.7654053565412e-01, 0.4258542984690e-01, 0.1409842846538e-07, 0.4418612420312e+01, 0.2258291676434e+00, 0.1090948346291e-07, 0.1260615686131e+01, 0.4226656969313e+00, 0.1357577323612e-07, 0.3558248818690e+01, 0.7923417740620e-01, 0.1018154061960e-07, 0.5676087241256e+01, 0.1456308687557e+00, 0.1412073972109e-07, 0.8394392632422e+00, 0.1525316725248e+00, 0.1030938326496e-07, 0.1653593274064e+01, 0.1795258541446e+01, 0.1180081567104e-07, 0.1285802592036e+01, 0.7032915397480e-01, 0.9708510575650e-08, 0.7631889488106e+00, 0.8434341241180e-01, 0.9637689663447e-08, 0.4630642649176e+01, 0.1272681024002e+01, 0.1068910429389e-07, 0.5294934032165e+01, 0.2123349582968e+00, 0.1063716179336e-07, 0.2736266800832e+01, 0.2142632012598e+00, 0.1234858713814e-07, 0.1302891146570e+01, 0.1847279083684e+00, 0.8912631189738e-08, 0.3570415993621e+01, 0.2648454860559e+01, 0.1036378285534e-07, 0.4236693440949e+01, 0.1370332435159e+00, 0.9667798501561e-08, 0.2960768892398e+01, 0.4376440768498e+00, 0.8108314201902e-08, 0.6987781646841e+00, 0.2880807454688e+00, 0.7648364324628e-08, 0.2499017863863e+01, 0.2037373330570e+00, 0.7286136828406e-08, 0.3787426951665e+01, 0.1129145838217e+00, 0.9448237743913e-08, 0.2694354332983e+01, 0.5272426800584e+00, 0.9374276106428e-08, 0.4787121277064e+01, 0.5321392641652e+00, 0.7100226287462e-08, 0.3530238792101e+00, 0.6288513220417e+00, 0.9253056659571e-08, 0.1399478925664e+01, 0.1606092486742e+00, 0.6636432145504e-08, 0.3479575438447e+01, 0.1368660381889e+01, 0.6469975312932e-08, 0.1383669964800e+01, 0.2008557621224e+01, 0.7335849729765e-08, 0.1243698166898e+01, 0.9561746721300e-02, 0.8743421205855e-08, 0.3776164289301e+01, 0.3801276407308e+00, 0.5993635744494e-08, 0.5627122113596e+01, 0.2042657109477e+02, 0.5981008479693e-08, 0.1674336636752e+01, 0.2111650433779e+01, 0.6188535145838e-08, 0.5214925208672e+01, 0.4305306221819e+00, 0.6596074017566e-08, 0.2907653268124e+01, 0.1063314406849e+01, 0.6630815126226e-08, 0.2127643669658e+01, 0.8389694097774e+00, 0.6156772830040e-08, 0.5082160803295e+01, 0.4234171675140e+00, 0.6446960563014e-08, 0.1872100916905e+01, 0.5287268506303e+00, 0.6429324424668e-08, 0.5610276103577e+01, 0.5306550935933e+00, 0.6302232396465e-08, 0.1592152049607e+01, 0.1253008786510e-01, 0.6399244436159e-08, 0.2746214421532e+01, 0.5217580628120e+02, 0.5474965172558e-08, 0.2317666374383e+01, 0.2221856701002e+01, 0.5339293190692e-08, 0.1084724961156e+01, 0.7466759693650e-01, 0.5334733683389e-08, 0.3594106067745e+01, 0.7489573444450e-01, 0.5392665782110e-08, 0.5630254365606e+01, 0.1055449481598e+01, 0.6682075673789e-08, 0.1518480041732e+01, 0.2213766559277e+00, 0.5079130495960e-08, 0.2739765115711e+01, 0.2132517061319e+00, 0.5077759793261e-08, 0.5290711290094e+01, 0.2133464534247e+00, 0.4832037368310e-08, 0.1404473217200e+01, 0.7160067364790e-01, 0.6463279674802e-08, 0.6038381695210e+01, 0.2209183458640e-01, 0.6240592771560e-08, 0.1290170653666e+01, 0.3306188016693e+00, 0.4672013521493e-08, 0.3261895939677e+01, 0.7796265773310e-01, 0.6500650750348e-08, 0.1154522312095e+01, 0.3884652414254e+00, 0.6344161389053e-08, 0.6206111545062e+01, 0.7605151500000e-01, 0.4682518370646e-08, 0.5409118796685e+01, 0.1073608853559e+01, 0.5329460015591e-08, 0.1202985784864e+01, 0.7287631425543e+00, 0.5701588675898e-08, 0.4098715257064e+01, 0.8731175355560e-01, 0.6030690867211e-08, 0.4132033218460e+00, 0.9846002785331e+00, 0.4336256312655e-08, 0.1211415991827e+01, 0.4297791515992e+00, 0.4688498808975e-08, 0.3765479072409e+01, 0.2127790306879e+00, 0.4675578609335e-08, 0.4265540037226e+01, 0.2138191288687e+00, 0.4225578112158e-08, 0.5237566010676e+01, 0.3407705765729e+00, 0.5139422230028e-08, 0.1507173079513e+01, 0.7233337363710e-01, 0.4619995093571e-08, 0.9023957449848e-01, 0.8603097737811e+00, 0.4494776255461e-08, 0.5414930552139e+00, 0.7381754420900e-01, 0.4274026276788e-08, 0.4145735303659e+01, 0.7574578717200e-01, 0.5018141789353e-08, 0.3344408829055e+01, 0.3180992042600e-02, 0.4866163952181e-08, 0.3348534657607e+01, 0.7722995774390e-01, 0.4111986020501e-08, 0.4198823597220e+00, 0.1451108196653e+00, 0.3356142784950e-08, 0.5609144747180e+01, 0.1274714967946e+00, 0.4070575554551e-08, 0.7028411059224e+00, 0.3503323232942e+00, 0.3257451857278e-08, 0.5624697983086e+01, 0.5296435984654e+00, 0.3256973703026e-08, 0.1857842076707e+01, 0.5297383457582e+00, 0.3830771508640e-08, 0.4562887279931e+01, 0.9098186128426e+00, 0.3725024005962e-08, 0.2358058692652e+00, 0.1084620721060e+00, 0.3136763921756e-08, 0.2049731526845e+01, 0.2346394437820e+00, 0.3795147256194e-08, 0.2432356296933e+00, 0.1862120789403e+00, 0.2877342229911e-08, 0.5631101279387e+01, 0.1905464808669e+01, 0.3076931798805e-08, 0.1117615737392e+01, 0.3628624111593e+00, 0.2734765945273e-08, 0.5899826516955e+01, 0.2131850110243e+00, 0.2733405296885e-08, 0.2130562964070e+01, 0.2134131485323e+00, 0.2898552353410e-08, 0.3462387048225e+00, 0.5291709230214e+00, 0.2893736103681e-08, 0.8534352781543e+00, 0.5302110212022e+00, 0.3095717734137e-08, 0.2875061429041e+01, 0.2976424921901e+00, 0.2636190425832e-08, 0.2242512846659e+01, 0.1485980103780e+01, 0.3645512095537e-08, 0.1354016903958e+01, 0.6044726378023e+00, 0.2808173547723e-08, 0.6705114365631e-01, 0.6225157782540e-01, 0.2625012866888e-08, 0.4775705748482e+01, 0.5268983110410e-01, 0.2572233995651e-08, 0.2638924216139e+01, 0.1258454114666e+01, 0.2604238824792e-08, 0.4826358927373e+01, 0.2103781122809e+00, 0.2596886385239e-08, 0.3200388483118e+01, 0.2162200472757e+00, 0.3228057304264e-08, 0.5384848409563e+01, 0.2007689919132e+00, 0.2481601798252e-08, 0.5173373487744e+01, 0.1062562936266e+01, 0.2745977498864e-08, 0.6250966149853e+01, 0.5651155736444e+00, 0.2669878833811e-08, 0.4906001352499e+01, 0.1400015846597e+00, 0.3203986611711e-08, 0.5034333010005e+01, 0.7036329877322e+00, 0.3354961227212e-08, 0.6108262423137e+01, 0.4549093064213e+00, 0.2400407324558e-08, 0.2135399294955e+01, 0.2125476091956e+00, 0.2379905859802e-08, 0.5893721933961e+01, 0.2140505503610e+00, 0.2550844302187e-08, 0.3331940762063e+01, 0.1534957940063e+00, 0.2268824211001e-08, 0.1843418461035e+01, 0.2235935264888e+00, 0.2464700891204e-08, 0.3029548547230e+01, 0.2091065926078e+00, 0.2436814726024e-08, 0.4994717970364e+01, 0.2174915669488e+00, 0.2443623894745e-08, 0.2645102591375e+01, 0.1739420156204e+00, 0.2318701783838e-08, 0.5700547397897e+01, 0.7530171478090e-01, 0.2284448700256e-08, 0.5268898905872e+01, 0.7426161660010e-01, 0.2468848123510e-08, 0.5276280575078e+01, 0.2526561439362e+00, 0.2814052350303e-08, 0.6130168623475e+01, 0.5636314030725e+00, 0.2243662755220e-08, 0.6631692457995e+00, 0.8886590321940e-01, 0.2330795855941e-08, 0.2499435487702e+01, 0.1056200952181e+01, 0.9757679038404e-09, 0.5796846023126e+01, 0.7826370942180e+02 }; /* SSB-to-Sun, T^0, Z */ static const double s0z[] = { 0.1181255122986e-03, 0.4607918989164e+00, 0.2132990797783e+00, 0.1127777651095e-03, 0.4169146331296e+00, 0.5296909721118e+00, 0.4777754401806e-04, 0.4582657007130e+01, 0.3813291813120e-01, 0.1129354285772e-04, 0.5758735142480e+01, 0.7478166569050e-01, -0.1149543637123e-04, 0.0000000000000e+00, 0.0000000000000e+00, 0.3298730512306e-05, 0.5978801994625e+01, 0.4265981595566e+00, 0.2733376706079e-05, 0.7665413691040e+00, 0.1059381944224e+01, 0.9426389657270e-06, 0.3710201265838e+01, 0.2061856251104e+00, 0.8187517749552e-06, 0.3390675605802e+00, 0.2204125344462e+00, 0.4080447871819e-06, 0.4552296640088e+00, 0.5225775174439e+00, 0.3169973017028e-06, 0.3445455899321e+01, 0.5368044267797e+00, 0.2438098615549e-06, 0.5664675150648e+01, 0.3664874755930e-01, 0.2601897517235e-06, 0.1931894095697e+01, 0.1495633313810e+00, 0.2314558080079e-06, 0.3666319115574e+00, 0.3961708870310e-01, 0.1962549548002e-06, 0.3167411699020e+01, 0.7626583626240e-01, 0.2180518287925e-06, 0.1544420746580e+01, 0.7113454667900e-02, 0.1451382442868e-06, 0.1583756740070e+01, 0.1102062672231e+00, 0.1358439007389e-06, 0.5239941758280e+01, 0.6398972393349e+00, 0.1050585898028e-06, 0.2266958352859e+01, 0.3163918923335e+00, 0.1050029870186e-06, 0.2711495250354e+01, 0.4194847048887e+00, 0.9934920679800e-07, 0.1116208151396e+01, 0.1589072916335e+01, 0.1048395331560e-06, 0.3408619600206e+01, 0.1021328554739e+02, 0.8370147196668e-07, 0.3810459401087e+01, 0.2535050500000e-01, 0.7989856510998e-07, 0.3769910473647e+01, 0.7329749511860e-01, 0.5441221655233e-07, 0.2416994903374e+01, 0.1030928125552e+00, 0.4610812906784e-07, 0.5858503336994e+01, 0.4337116142245e+00, 0.3923022803444e-07, 0.3354170010125e+00, 0.1484170571900e-02, 0.2610725582128e-07, 0.5410600646324e+01, 0.6327837846670e+00, 0.2455279767721e-07, 0.6120216681403e+01, 0.1162474756779e+01, 0.2375530706525e-07, 0.6055443426143e+01, 0.1052268489556e+01, 0.1782967577553e-07, 0.3146108708004e+01, 0.8460828644453e+00, 0.1581687095238e-07, 0.6255496089819e+00, 0.3340612434717e+01, 0.1594657672461e-07, 0.3782604300261e+01, 0.1066495398892e+01, 0.1563448615040e-07, 0.1997775733196e+01, 0.2022531624851e+00, 0.1463624258525e-07, 0.1736316792088e+00, 0.3516457698740e-01, 0.1331585056673e-07, 0.4331941830747e+01, 0.9491756770005e+00, 0.1130634557637e-07, 0.6152017751825e+01, 0.2968341143800e-02, 0.1028949607145e-07, 0.2101792614637e+00, 0.2275259891141e+00, 0.1024074971618e-07, 0.4071833211074e+01, 0.5070101000000e-01, 0.8826956060303e-08, 0.4861633688145e+00, 0.2093666171530e+00, 0.8572230171541e-08, 0.5268190724302e+01, 0.4110125927500e-01, 0.7649332643544e-08, 0.5134543417106e+01, 0.2608790314060e+02, 0.8581673291033e-08, 0.2920218146681e+01, 0.1480791608091e+00, 0.8430589300938e-08, 0.3604576619108e+01, 0.2172315424036e+00, 0.7776165501012e-08, 0.3772942249792e+01, 0.6373574839730e-01, 0.8311070234408e-08, 0.6200412329888e+01, 0.3235053470014e+00, 0.6927365212582e-08, 0.4543353113437e+01, 0.8531963191132e+00, 0.6791574208598e-08, 0.2882188406238e+01, 0.7181332454670e-01, 0.5593100811839e-08, 0.1776646892780e+01, 0.7429900518901e+00, 0.4553381853021e-08, 0.3949617611240e+01, 0.7775000683430e-01, 0.5758000450068e-08, 0.3859251775075e+01, 0.1990721704425e+00, 0.4281283457133e-08, 0.1466294631206e+01, 0.2118763888447e+01, 0.4206935661097e-08, 0.5421776011706e+01, 0.1104591729320e-01, 0.4213751641837e-08, 0.3412048993322e+01, 0.2243449970715e+00, 0.5310506239878e-08, 0.5421641370995e+00, 0.5154640627760e+00, 0.3827450341320e-08, 0.8887314524995e+00, 0.1510475019529e+00, 0.4292435241187e-08, 0.1405043757194e+01, 0.1422690933580e-01, 0.3189780702289e-08, 0.1060049293445e+01, 0.1173197218910e+00, 0.3226611928069e-08, 0.6270858897442e+01, 0.2164800718209e+00, 0.2893897608830e-08, 0.5117563223301e+01, 0.6470106940028e+00, 0.3239852024578e-08, 0.4079092237983e+01, 0.2101180877357e+00, 0.2956892222200e-08, 0.1594917021704e+01, 0.3092784376656e+00, 0.2980177912437e-08, 0.5258787667564e+01, 0.4155522422634e+00, 0.3163725690776e-08, 0.3854589225479e+01, 0.8582758298370e-01, 0.2662262399118e-08, 0.3561326430187e+01, 0.5257585094865e+00, 0.2766689135729e-08, 0.3180732086830e+00, 0.1385174140878e+00, 0.2411600278464e-08, 0.3324798335058e+01, 0.5439178814476e+00, 0.2483527695131e-08, 0.4169069291947e+00, 0.5336234347371e+00, 0.7788777276590e-09, 0.1900569908215e+01, 0.5217580628120e+02 }; /* SSB-to-Sun, T^1, X */ static const double s1x[] = { -0.1296310361520e-07, 0.0000000000000e+00, 0.0000000000000e+00, 0.8975769009438e-08, 0.1128891609250e+01, 0.4265981595566e+00, 0.7771113441307e-08, 0.2706039877077e+01, 0.2061856251104e+00, 0.7538303866642e-08, 0.2191281289498e+01, 0.2204125344462e+00, 0.6061384579336e-08, 0.3248167319958e+01, 0.1059381944224e+01, 0.5726994235594e-08, 0.5569981398610e+01, 0.5225775174439e+00, 0.5616492836424e-08, 0.5057386614909e+01, 0.5368044267797e+00, 0.1010881584769e-08, 0.3473577116095e+01, 0.7113454667900e-02, 0.7259606157626e-09, 0.3651858593665e+00, 0.6398972393349e+00, 0.8755095026935e-09, 0.1662835408338e+01, 0.4194847048887e+00, 0.5370491182812e-09, 0.1327673878077e+01, 0.4337116142245e+00, 0.5743773887665e-09, 0.4250200846687e+01, 0.2132990797783e+00, 0.4408103140300e-09, 0.3598752574277e+01, 0.1589072916335e+01, 0.3101892374445e-09, 0.4887822983319e+01, 0.1052268489556e+01, 0.3209453713578e-09, 0.9702272295114e+00, 0.5296909721118e+00, 0.3017228286064e-09, 0.5484462275949e+01, 0.1066495398892e+01, 0.3200700038601e-09, 0.2846613338643e+01, 0.1495633313810e+00, 0.2137637279911e-09, 0.5692163292729e+00, 0.3163918923335e+00, 0.1899686386727e-09, 0.2061077157189e+01, 0.2275259891141e+00, 0.1401994545308e-09, 0.4177771136967e+01, 0.1102062672231e+00, 0.1578057810499e-09, 0.5782460597335e+01, 0.7626583626240e-01, 0.1237713253351e-09, 0.5705900866881e+01, 0.5154640627760e+00, 0.1313076837395e-09, 0.5163438179576e+01, 0.3664874755930e-01, 0.1184963304860e-09, 0.3054804427242e+01, 0.6327837846670e+00, 0.1238130878565e-09, 0.2317292575962e+01, 0.3961708870310e-01, 0.1015959527736e-09, 0.2194643645526e+01, 0.7329749511860e-01, 0.9017954423714e-10, 0.2868603545435e+01, 0.1990721704425e+00, 0.8668024955603e-10, 0.4923849675082e+01, 0.5439178814476e+00, 0.7756083930103e-10, 0.3014334135200e+01, 0.9491756770005e+00, 0.7536503401741e-10, 0.2704886279769e+01, 0.1030928125552e+00, 0.5483308679332e-10, 0.6010983673799e+01, 0.8531963191132e+00, 0.5184339620428e-10, 0.1952704573291e+01, 0.2093666171530e+00, 0.5108658712030e-10, 0.2958575786649e+01, 0.2172315424036e+00, 0.5019424524650e-10, 0.1736317621318e+01, 0.2164800718209e+00, 0.4909312625978e-10, 0.3167216416257e+01, 0.2101180877357e+00, 0.4456638901107e-10, 0.7697579923471e+00, 0.3235053470014e+00, 0.4227030350925e-10, 0.3490910137928e+01, 0.6373574839730e-01, 0.4095456040093e-10, 0.5178888984491e+00, 0.6470106940028e+00, 0.4990537041422e-10, 0.3323887668974e+01, 0.1422690933580e-01, 0.4321170010845e-10, 0.4288484987118e+01, 0.7358765972222e+00, 0.3544072091802e-10, 0.6021051579251e+01, 0.5265099800692e+00, 0.3480198638687e-10, 0.4600027054714e+01, 0.5328719641544e+00, 0.3440287244435e-10, 0.4349525970742e+01, 0.8582758298370e-01, 0.3330628322713e-10, 0.2347391505082e+01, 0.1104591729320e-01, 0.2973060707184e-10, 0.4789409286400e+01, 0.5257585094865e+00, 0.2932606766089e-10, 0.5831693799927e+01, 0.5336234347371e+00, 0.2876972310953e-10, 0.2692638514771e+01, 0.1173197218910e+00, 0.2827488278556e-10, 0.2056052487960e+01, 0.2022531624851e+00, 0.2515028239756e-10, 0.7411863262449e+00, 0.9597935788730e-01, 0.2853033744415e-10, 0.3948481024894e+01, 0.2118763888447e+01 }; /* SSB-to-Sun, T^1, Y */ static const double s1y[] = { 0.8989047573576e-08, 0.5840593672122e+01, 0.4265981595566e+00, 0.7815938401048e-08, 0.1129664707133e+01, 0.2061856251104e+00, 0.7550926713280e-08, 0.6196589104845e+00, 0.2204125344462e+00, 0.6056556925895e-08, 0.1677494667846e+01, 0.1059381944224e+01, 0.5734142698204e-08, 0.4000920852962e+01, 0.5225775174439e+00, 0.5614341822459e-08, 0.3486722577328e+01, 0.5368044267797e+00, 0.1028678147656e-08, 0.1877141024787e+01, 0.7113454667900e-02, 0.7270792075266e-09, 0.5077167301739e+01, 0.6398972393349e+00, 0.8734141726040e-09, 0.9069550282609e-01, 0.4194847048887e+00, 0.5377371402113e-09, 0.6039381844671e+01, 0.4337116142245e+00, 0.4729719431571e-09, 0.2153086311760e+01, 0.2132990797783e+00, 0.4458052820973e-09, 0.5059830025565e+01, 0.5296909721118e+00, 0.4406855467908e-09, 0.2027971692630e+01, 0.1589072916335e+01, 0.3101659310977e-09, 0.3317677981860e+01, 0.1052268489556e+01, 0.3016749232545e-09, 0.3913703482532e+01, 0.1066495398892e+01, 0.3198541352656e-09, 0.1275513098525e+01, 0.1495633313810e+00, 0.2142065389871e-09, 0.5301351614597e+01, 0.3163918923335e+00, 0.1902615247592e-09, 0.4894943352736e+00, 0.2275259891141e+00, 0.1613410990871e-09, 0.2449891130437e+01, 0.1102062672231e+00, 0.1576992165097e-09, 0.4211421447633e+01, 0.7626583626240e-01, 0.1241637259894e-09, 0.4140803368133e+01, 0.5154640627760e+00, 0.1313974830355e-09, 0.3591920305503e+01, 0.3664874755930e-01, 0.1181697118258e-09, 0.1506314382788e+01, 0.6327837846670e+00, 0.1238239742779e-09, 0.7461405378404e+00, 0.3961708870310e-01, 0.1010107068241e-09, 0.6271010795475e+00, 0.7329749511860e-01, 0.9226316616509e-10, 0.1259158839583e+01, 0.1990721704425e+00, 0.8664946419555e-10, 0.3353244696934e+01, 0.5439178814476e+00, 0.7757230468978e-10, 0.1447677295196e+01, 0.9491756770005e+00, 0.7693168628139e-10, 0.1120509896721e+01, 0.1030928125552e+00, 0.5487897454612e-10, 0.4439380426795e+01, 0.8531963191132e+00, 0.5196118677218e-10, 0.3788856619137e+00, 0.2093666171530e+00, 0.5110853339935e-10, 0.1386879372016e+01, 0.2172315424036e+00, 0.5027804534813e-10, 0.1647881805466e+00, 0.2164800718209e+00, 0.4922485922674e-10, 0.1594315079862e+01, 0.2101180877357e+00, 0.6155599524400e-10, 0.0000000000000e+00, 0.0000000000000e+00, 0.4447147832161e-10, 0.5480720918976e+01, 0.3235053470014e+00, 0.4144691276422e-10, 0.1931371033660e+01, 0.6373574839730e-01, 0.4099950625452e-10, 0.5229611294335e+01, 0.6470106940028e+00, 0.5060541682953e-10, 0.1731112486298e+01, 0.1422690933580e-01, 0.4293615946300e-10, 0.2714571038925e+01, 0.7358765972222e+00, 0.3545659845763e-10, 0.4451041444634e+01, 0.5265099800692e+00, 0.3479112041196e-10, 0.3029385448081e+01, 0.5328719641544e+00, 0.3438516493570e-10, 0.2778507143731e+01, 0.8582758298370e-01, 0.3297341285033e-10, 0.7898709807584e+00, 0.1104591729320e-01, 0.2972585818015e-10, 0.3218785316973e+01, 0.5257585094865e+00, 0.2931707295017e-10, 0.4260731012098e+01, 0.5336234347371e+00, 0.2897198149403e-10, 0.1120753978101e+01, 0.1173197218910e+00, 0.2832293240878e-10, 0.4597682717827e+00, 0.2022531624851e+00, 0.2864348326612e-10, 0.2169939928448e+01, 0.9597935788730e-01, 0.2852714675471e-10, 0.2377659870578e+01, 0.2118763888447e+01 }; /* SSB-to-Sun, T^1, Z */ static const double s1z[] = { 0.5444220475678e-08, 0.1803825509310e+01, 0.2132990797783e+00, 0.3883412695596e-08, 0.4668616389392e+01, 0.5296909721118e+00, 0.1334341434551e-08, 0.0000000000000e+00, 0.0000000000000e+00, 0.3730001266883e-09, 0.5401405918943e+01, 0.2061856251104e+00, 0.2894929197956e-09, 0.4932415609852e+01, 0.2204125344462e+00, 0.2857950357701e-09, 0.3154625362131e+01, 0.7478166569050e-01, 0.2499226432292e-09, 0.3657486128988e+01, 0.4265981595566e+00, 0.1937705443593e-09, 0.5740434679002e+01, 0.1059381944224e+01, 0.1374894396320e-09, 0.1712857366891e+01, 0.5368044267797e+00, 0.1217248678408e-09, 0.2312090870932e+01, 0.5225775174439e+00, 0.7961052740870e-10, 0.5283368554163e+01, 0.3813291813120e-01, 0.4979225949689e-10, 0.4298290471860e+01, 0.4194847048887e+00, 0.4388552286597e-10, 0.6145515047406e+01, 0.7113454667900e-02, 0.2586835212560e-10, 0.3019448001809e+01, 0.6398972393349e+00 }; /* SSB-to-Sun, T^2, X */ static const double s2x[] = { 0.1603551636587e-11, 0.4404109410481e+01, 0.2061856251104e+00, 0.1556935889384e-11, 0.4818040873603e+00, 0.2204125344462e+00, 0.1182594414915e-11, 0.9935762734472e+00, 0.5225775174439e+00, 0.1158794583180e-11, 0.3353180966450e+01, 0.5368044267797e+00, 0.9597358943932e-12, 0.5567045358298e+01, 0.2132990797783e+00, 0.6511516579605e-12, 0.5630872420788e+01, 0.4265981595566e+00, 0.7419792747688e-12, 0.2156188581957e+01, 0.5296909721118e+00, 0.3951972655848e-12, 0.1981022541805e+01, 0.1059381944224e+01, 0.4478223877045e-12, 0.0000000000000e+00, 0.0000000000000e+00 }; /* SSB-to-Sun, T^2, Y */ static const double s2y[] = { 0.1609114495091e-11, 0.2831096993481e+01, 0.2061856251104e+00, 0.1560330784946e-11, 0.5193058213906e+01, 0.2204125344462e+00, 0.1183535479202e-11, 0.5707003443890e+01, 0.5225775174439e+00, 0.1158183066182e-11, 0.1782400404928e+01, 0.5368044267797e+00, 0.1032868027407e-11, 0.4036925452011e+01, 0.2132990797783e+00, 0.6540142847741e-12, 0.4058241056717e+01, 0.4265981595566e+00, 0.7305236491596e-12, 0.6175401942957e+00, 0.5296909721118e+00, -0.5580725052968e-12, 0.0000000000000e+00, 0.0000000000000e+00, 0.3946122651015e-12, 0.4108265279171e+00, 0.1059381944224e+01 }; /* SSB-to-Sun, T^2, Z */ static const double s2z[] = { 0.3749920358054e-12, 0.3230285558668e+01, 0.2132990797783e+00, 0.2735037220939e-12, 0.6154322683046e+01, 0.5296909721118e+00 }; /* Pointers to coefficient arrays, in x,y,z sets */ static const double *ce0[] = { e0x, e0y, e0z }, *ce1[] = { e1x, e1y, e1z }, *ce2[] = { e2x, e2y, e2z }, *cs0[] = { s0x, s0y, s0z }, *cs1[] = { s1x, s1y, s1z }, *cs2[] = { s2x, s2y, s2z }; const double *coeffs; /* Numbers of terms for each component of the model, in x,y,z sets */ static const int ne0[3] = {(int)(sizeof e0x / sizeof (double) / 3), (int)(sizeof e0y / sizeof (double) / 3), (int)(sizeof e0z / sizeof (double) / 3) }, ne1[3] = {(int)(sizeof e1x / sizeof (double) / 3), (int)(sizeof e1y / sizeof (double) / 3), (int)(sizeof e1z / sizeof (double) / 3) }, ne2[3] = {(int)(sizeof e2x / sizeof (double) / 3), (int)(sizeof e2y / sizeof (double) / 3), (int)(sizeof e2z / sizeof (double) / 3) }, ns0[3] = {(int)(sizeof s0x / sizeof (double) / 3), (int)(sizeof s0y / sizeof (double) / 3), (int)(sizeof s0z / sizeof (double) / 3) }, ns1[3] = {(int)(sizeof s1x / sizeof (double) / 3), (int)(sizeof s1y / sizeof (double) / 3), (int)(sizeof s1z / sizeof (double) / 3) }, ns2[3] = {(int)(sizeof s2x / sizeof (double) / 3), (int)(sizeof s2y / sizeof (double) / 3), (int)(sizeof s2z / sizeof (double) / 3) }; int nterms; /* Miscellaneous */ int jstat, i, j; double t, t2, xyz, xyzd, a, b, c, ct, p, cp, ph[3], vh[3], pb[3], vb[3], x, y, z; /*--------------------------------------------------------------------*/ /* Time since reference epoch, Julian years. */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY; t2 = t*t; /* Set status. */ jstat = fabs(t) <= 100.0 ? 0 : 1; /* X then Y then Z. */ for (i = 0; i < 3; i++) { /* Initialize position and velocity component. */ xyz = 0.0; xyzd = 0.0; /* ------------------------------------------------ */ /* Obtain component of Sun to Earth ecliptic vector */ /* ------------------------------------------------ */ /* Sun to Earth, T^0 terms. */ coeffs = ce0[i]; nterms = ne0[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; p = b + c*t; xyz += a*cos(p); xyzd -= a*c*sin(p); } /* Sun to Earth, T^1 terms. */ coeffs = ce1[i]; nterms = ne1[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; ct = c*t; p = b + ct; cp = cos(p); xyz += a*t*cp; xyzd += a*( cp - ct*sin(p) ); } /* Sun to Earth, T^2 terms. */ coeffs = ce2[i]; nterms = ne2[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; ct = c*t; p = b + ct; cp = cos(p); xyz += a*t2*cp; xyzd += a*t*( 2.0*cp - ct*sin(p) ); } /* Heliocentric Earth position and velocity component. */ ph[i] = xyz; vh[i] = xyzd / ERFA_DJY; /* ------------------------------------------------ */ /* Obtain component of SSB to Earth ecliptic vector */ /* ------------------------------------------------ */ /* SSB to Sun, T^0 terms. */ coeffs = cs0[i]; nterms = ns0[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; p = b + c*t; xyz += a*cos(p); xyzd -= a*c*sin(p); } /* SSB to Sun, T^1 terms. */ coeffs = cs1[i]; nterms = ns1[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; ct = c*t; p = b + ct; cp = cos(p); xyz += a*t*cp; xyzd += a*(cp - ct*sin(p)); } /* SSB to Sun, T^2 terms. */ coeffs = cs2[i]; nterms = ns2[i]; for (j = 0; j < nterms; j++) { a = *coeffs++; b = *coeffs++; c = *coeffs++; ct = c*t; p = b + ct; cp = cos(p); xyz += a*t2*cp; xyzd += a*t*(2.0*cp - ct*sin(p)); } /* Barycentric Earth position and velocity component. */ pb[i] = xyz; vb[i] = xyzd / ERFA_DJY; /* Next Cartesian component. */ } /* Rotate from ecliptic to BCRS coordinates. */ x = ph[0]; y = ph[1]; z = ph[2]; pvh[0][0] = x + am12*y + am13*z; pvh[0][1] = am21*x + am22*y + am23*z; pvh[0][2] = am32*y + am33*z; x = vh[0]; y = vh[1]; z = vh[2]; pvh[1][0] = x + am12*y + am13*z; pvh[1][1] = am21*x + am22*y + am23*z; pvh[1][2] = am32*y + am33*z; x = pb[0]; y = pb[1]; z = pb[2]; pvb[0][0] = x + am12*y + am13*z; pvb[0][1] = am21*x + am22*y + am23*z; pvb[0][2] = am32*y + am33*z; x = vb[0]; y = vb[1]; z = vb[2]; pvb[1][0] = x + am12*y + am13*z; pvb[1][1] = am21*x + am22*y + am23*z; pvb[1][2] = am32*y + am33*z; /* Return the status. */ return jstat; } double eraEqeq94(double date1, double date2) /* ** - - - - - - - - - - ** e r a E q e q 9 4 ** - - - - - - - - - - ** ** Equation of the equinoxes, IAU 1994 model. ** ** Given: ** date1,date2 double TDB date (Note 1) ** ** Returned (function value): ** double equation of the equinoxes (Note 2) ** ** Notes: ** ** 1) The date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result, which is in radians, operates in the following sense: ** ** Greenwich apparent ST = GMST + equation of the equinoxes ** ** Called: ** eraNut80 nutation, IAU 1980 ** eraObl80 mean obliquity, IAU 1980 ** ** References: ** ** IAU Resolution C7, Recommendation 3 (1994). ** ** Capitaine, N. & Gontier, A.-M., 1993, Astron. Astrophys., 275, ** 645-650. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, om, dpsi, deps, eps0, ee; /* Interval between fundamental epoch J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Longitude of the mean ascending node of the lunar orbit on the */ /* ecliptic, measured from the mean equinox of date. */ om = eraAnpm((450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t) * ERFA_DAS2R + fmod(-5.0 * t, 1.0) * ERFA_D2PI); /* Nutation components and mean obliquity. */ eraNut80(date1, date2, &dpsi, &deps); eps0 = eraObl80(date1, date2); /* Equation of the equinoxes. */ ee = dpsi*cos(eps0) + ERFA_DAS2R*(0.00264*sin(om) + 0.000063*sin(om+om)); return ee; } double eraEra00(double dj1, double dj2) /* ** - - - - - - - - - ** e r a E r a 0 0 ** - - - - - - - - - ** ** Earth rotation angle (IAU 2000 model). ** ** Given: ** dj1,dj2 double UT1 as a 2-part Julian Date (see note) ** ** Returned (function value): ** double Earth rotation angle (radians), range 0-2pi ** ** Notes: ** ** 1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any ** convenient way between the arguments dj1 and dj2. For example, ** JD(UT1)=2450123.7 could be expressed in any of these ways, ** among others: ** ** dj1 dj2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. The date & time method is ** best matched to the algorithm used: maximum precision is ** delivered when the dj1 argument is for 0hrs UT1 on the day in ** question and the dj2 argument lies in the range 0 to 1, or vice ** versa. ** ** 2) The algorithm is adapted from Expression 22 of Capitaine et al. ** 2000. The time argument has been expressed in days directly, ** and, to retain precision, integer contributions have been ** eliminated. The same formulation is given in IERS Conventions ** (2003), Chap. 5, Eq. 14. ** ** Called: ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Capitaine N., Guinot B. and McCarthy D.D, 2000, Astron. ** Astrophys., 355, 398-405. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double d1, d2, t, f, theta; /* Days since fundamental epoch. */ if (dj1 < dj2) { d1 = dj1; d2 = dj2; } else { d1 = dj2; d2 = dj1; } t = d1 + (d2- ERFA_DJ00); /* Fractional part of T (days). */ f = fmod(d1, 1.0) + fmod(d2, 1.0); /* Earth rotation angle at this UT1. */ theta = eraAnp(ERFA_D2PI * (f + 0.7790572732640 + 0.00273781191135448 * t)); return theta; } double eraFad03(double t) /* ** - - - - - - - - - ** e r a F a d 0 3 ** - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean elongation of the Moon from the Sun. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double D, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean elongation of the Moon from the Sun (IERS Conventions 2003). */ a = fmod( 1072260.703692 + t * ( 1602961601.2090 + t * ( - 6.3706 + t * ( 0.006593 + t * ( - 0.00003169 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R; return a; } double eraFae03(double t) /* ** - - - - - - - - - ** e r a F a e 0 3 ** - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Earth. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Earth, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Earth (IERS Conventions 2003). */ a = fmod(1.753470314 + 628.3075849991 * t, ERFA_D2PI); return a; } double eraFaf03(double t) /* ** - - - - - - - - - ** e r a F a f 0 3 ** - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of the Moon minus mean longitude of the ascending ** node. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double F, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of the Moon minus that of the ascending node */ /* (IERS Conventions 2003). */ a = fmod( 335779.526232 + t * ( 1739527262.8478 + t * ( - 12.7512 + t * ( - 0.001037 + t * ( 0.00000417 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R; return a; } double eraFaju03(double t) /* ** - - - - - - - - - - ** e r a F a j u 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Jupiter. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Jupiter, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Jupiter (IERS Conventions 2003). */ a = fmod(0.599546497 + 52.9690962641 * t, ERFA_D2PI); return a; } double eraFal03(double t) /* ** - - - - - - - - - ** e r a F a l 0 3 ** - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean anomaly of the Moon. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double l, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean anomaly of the Moon (IERS Conventions 2003). */ a = fmod( 485868.249036 + t * ( 1717915923.2178 + t * ( 31.8792 + t * ( 0.051635 + t * ( - 0.00024470 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R; return a; } double eraFalp03(double t) /* ** - - - - - - - - - - ** e r a F a l p 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean anomaly of the Sun. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double l', radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean anomaly of the Sun (IERS Conventions 2003). */ a = fmod( 1287104.793048 + t * ( 129596581.0481 + t * ( - 0.5532 + t * ( 0.000136 + t * ( - 0.00001149 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R; return a; } double eraFama03(double t) /* ** - - - - - - - - - - ** e r a F a m a 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Mars. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Mars, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Mars (IERS Conventions 2003). */ a = fmod(6.203480913 + 334.0612426700 * t, ERFA_D2PI); return a; } double eraFame03(double t) /* ** - - - - - - - - - - ** e r a F a m e 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Mercury. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Mercury, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Mercury (IERS Conventions 2003). */ a = fmod(4.402608842 + 2608.7903141574 * t, ERFA_D2PI); return a; } double eraFane03(double t) /* ** - - - - - - - - - - ** e r a F a n e 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Neptune. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Neptune, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is adapted from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Neptune (IERS Conventions 2003). */ a = fmod(5.311886287 + 3.8133035638 * t, ERFA_D2PI); return a; } double eraFaom03(double t) /* ** - - - - - - - - - - ** e r a F a o m 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of the Moon's ascending node. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double Omega, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of the Moon's ascending node */ /* (IERS Conventions 2003). */ a = fmod( 450160.398036 + t * ( - 6962890.5431 + t * ( 7.4722 + t * ( 0.007702 + t * ( - 0.00005939 ) ) ) ), ERFA_TURNAS ) * ERFA_DAS2R; return a; } double eraFapa03(double t) /* ** - - - - - - - - - - ** e r a F a p a 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** general accumulated precession in longitude. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double general precession in longitude, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003). It ** is taken from Kinoshita & Souchay (1990) and comes originally ** from Lieske et al. (1977). ** ** References: ** ** Kinoshita, H. and Souchay J. 1990, Celest.Mech. and Dyn.Astron. ** 48, 187 ** ** Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977, ** Astron.Astrophys. 58, 1-16 ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* General accumulated precession in longitude. */ a = (0.024381750 + 0.00000538691 * t) * t; return a; } double eraFasa03(double t) /* ** - - - - - - - - - - ** e r a F a s a 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Saturn. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Saturn, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Saturn (IERS Conventions 2003). */ a = fmod(0.874016757 + 21.3299104960 * t, ERFA_D2PI); return a; } double eraFaur03(double t) /* ** - - - - - - - - - - ** e r a F a u r 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Uranus. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Uranus, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** is adapted from Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Uranus (IERS Conventions 2003). */ a = fmod(5.481293872 + 7.4781598567 * t, ERFA_D2PI); return a; } double eraFave03(double t) /* ** - - - - - - - - - - ** e r a F a v e 0 3 ** - - - - - - - - - - ** ** Fundamental argument, IERS Conventions (2003): ** mean longitude of Venus. ** ** Given: ** t double TDB, Julian centuries since J2000.0 (Note 1) ** ** Returned (function value): ** double mean longitude of Venus, radians (Note 2) ** ** Notes: ** ** 1) Though t is strictly TDB, it is usually more convenient to use ** TT, which makes no significant difference. ** ** 2) The expression used is as adopted in IERS Conventions (2003) and ** comes from Souchay et al. (1999) after Simon et al. (1994). ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double a; /* Mean longitude of Venus (IERS Conventions 2003). */ a = fmod(3.176146697 + 1021.3285546211 * t, ERFA_D2PI); return a; } void eraFk52h(double r5, double d5, double dr5, double dd5, double px5, double rv5, double *rh, double *dh, double *drh, double *ddh, double *pxh, double *rvh) /* ** - - - - - - - - - ** e r a F k 5 2 h ** - - - - - - - - - ** ** Transform FK5 (J2000.0) star data into the Hipparcos system. ** ** Given (all FK5, equinox J2000.0, epoch J2000.0): ** r5 double RA (radians) ** d5 double Dec (radians) ** dr5 double proper motion in RA (dRA/dt, rad/Jyear) ** dd5 double proper motion in Dec (dDec/dt, rad/Jyear) ** px5 double parallax (arcsec) ** rv5 double radial velocity (km/s, positive = receding) ** ** Returned (all Hipparcos, epoch J2000.0): ** rh double RA (radians) ** dh double Dec (radians) ** drh double proper motion in RA (dRA/dt, rad/Jyear) ** ddh double proper motion in Dec (dDec/dt, rad/Jyear) ** pxh double parallax (arcsec) ** rvh double radial velocity (km/s, positive = receding) ** ** Notes: ** ** 1) This function transforms FK5 star positions and proper motions ** into the system of the Hipparcos catalog. ** ** 2) The proper motions in RA are dRA/dt rather than ** cos(Dec)*dRA/dt, and are per year rather than per century. ** ** 3) The FK5 to Hipparcos transformation is modeled as a pure ** rotation and spin; zonal errors in the FK5 catalog are not ** taken into account. ** ** 4) See also eraH2fk5, eraFk5hz, eraHfk5z. ** ** Called: ** eraStarpv star catalog data to space motion pv-vector ** eraFk5hip FK5 to Hipparcos rotation and spin ** eraRxp product of r-matrix and p-vector ** eraPxp vector product of two p-vectors ** eraPpp p-vector plus p-vector ** eraPvstar space motion pv-vector to star catalog data ** ** Reference: ** ** F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int i; double pv5[2][3], r5h[3][3], s5h[3], wxp[3], vv[3], pvh[2][3]; /* FK5 barycentric position/velocity pv-vector (normalized). */ eraStarpv(r5, d5, dr5, dd5, px5, rv5, pv5); /* FK5 to Hipparcos orientation matrix and spin vector. */ eraFk5hip(r5h, s5h); /* Make spin units per day instead of per year. */ for ( i = 0; i < 3; s5h[i++] /= 365.25 ); /* Orient the FK5 position into the Hipparcos system. */ eraRxp(r5h, pv5[0], pvh[0]); /* Apply spin to the position giving an extra space motion component. */ eraPxp(pv5[0], s5h, wxp); /* Add this component to the FK5 space motion. */ eraPpp(wxp, pv5[1], vv); /* Orient the FK5 space motion into the Hipparcos system. */ eraRxp(r5h, vv, pvh[1]); /* Hipparcos pv-vector to spherical. */ eraPvstar(pvh, rh, dh, drh, ddh, pxh, rvh); return; } void eraFk5hip(double r5h[3][3], double s5h[3]) /* ** - - - - - - - - - - ** e r a F k 5 h i p ** - - - - - - - - - - ** ** FK5 to Hipparcos rotation and spin. ** ** Returned: ** r5h double[3][3] r-matrix: FK5 rotation wrt Hipparcos (Note 2) ** s5h double[3] r-vector: FK5 spin wrt Hipparcos (Note 3) ** ** Notes: ** ** 1) This function models the FK5 to Hipparcos transformation as a ** pure rotation and spin; zonal errors in the FK5 catalogue are ** not taken into account. ** ** 2) The r-matrix r5h operates in the sense: ** ** P_Hipparcos = r5h x P_FK5 ** ** where P_FK5 is a p-vector in the FK5 frame, and P_Hipparcos is ** the equivalent Hipparcos p-vector. ** ** 3) The r-vector s5h represents the time derivative of the FK5 to ** Hipparcos rotation. The units are radians per year (Julian, ** TDB). ** ** Called: ** eraRv2m r-vector to r-matrix ** ** Reference: ** ** F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double v[3]; /* FK5 wrt Hipparcos orientation and spin (radians, radians/year) */ double epx, epy, epz; double omx, omy, omz; epx = -19.9e-3 * ERFA_DAS2R; epy = -9.1e-3 * ERFA_DAS2R; epz = 22.9e-3 * ERFA_DAS2R; omx = -0.30e-3 * ERFA_DAS2R; omy = 0.60e-3 * ERFA_DAS2R; omz = 0.70e-3 * ERFA_DAS2R; /* FK5 to Hipparcos orientation expressed as an r-vector. */ v[0] = epx; v[1] = epy; v[2] = epz; /* Re-express as an r-matrix. */ eraRv2m(v, r5h); /* Hipparcos wrt FK5 spin expressed as an r-vector. */ s5h[0] = omx; s5h[1] = omy; s5h[2] = omz; return; } void eraFk5hz(double r5, double d5, double date1, double date2, double *rh, double *dh) /* ** - - - - - - - - - ** e r a F k 5 h z ** - - - - - - - - - ** ** Transform an FK5 (J2000.0) star position into the system of the ** Hipparcos catalogue, assuming zero Hipparcos proper motion. ** ** Given: ** r5 double FK5 RA (radians), equinox J2000.0, at date ** d5 double FK5 Dec (radians), equinox J2000.0, at date ** date1,date2 double TDB date (Notes 1,2) ** ** Returned: ** rh double Hipparcos RA (radians) ** dh double Hipparcos Dec (radians) ** ** Notes: ** ** 1) This function converts a star position from the FK5 system to ** the Hipparcos system, in such a way that the Hipparcos proper ** motion is zero. Because such a star has, in general, a non-zero ** proper motion in the FK5 system, the function requires the date ** at which the position in the FK5 system was determined. ** ** 2) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 3) The FK5 to Hipparcos transformation is modeled as a pure ** rotation and spin; zonal errors in the FK5 catalogue are not ** taken into account. ** ** 4) The position returned by this function is in the Hipparcos ** reference system but at date date1+date2. ** ** 5) See also eraFk52h, eraH2fk5, eraHfk5z. ** ** Called: ** eraS2c spherical coordinates to unit vector ** eraFk5hip FK5 to Hipparcos rotation and spin ** eraSxp multiply p-vector by scalar ** eraRv2m r-vector to r-matrix ** eraTrxp product of transpose of r-matrix and p-vector ** eraPxp vector product of two p-vectors ** eraC2s p-vector to spherical ** eraAnp normalize angle into range 0 to 2pi ** ** Reference: ** ** F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, p5e[3], r5h[3][3], s5h[3], vst[3], rst[3][3], p5[3], ph[3], w; /* Interval from given date to fundamental epoch J2000.0 (JY). */ t = - ((date1 - ERFA_DJ00) + date2) / ERFA_DJY; /* FK5 barycentric position vector. */ eraS2c(r5, d5, p5e); /* FK5 to Hipparcos orientation matrix and spin vector. */ eraFk5hip(r5h, s5h); /* Accumulated Hipparcos wrt FK5 spin over that interval. */ eraSxp(t, s5h, vst); /* Express the accumulated spin as a rotation matrix. */ eraRv2m(vst, rst); /* Derotate the vector's FK5 axes back to date. */ eraTrxp(rst, p5e, p5); /* Rotate the vector into the Hipparcos system. */ eraRxp(r5h, p5, ph); /* Hipparcos vector to spherical. */ eraC2s(ph, &w, dh); *rh = eraAnp(w); return; } void eraFw2m(double gamb, double phib, double psi, double eps, double r[3][3]) /* ** - - - - - - - - ** e r a F w 2 m ** - - - - - - - - ** ** Form rotation matrix given the Fukushima-Williams angles. ** ** Given: ** gamb double F-W angle gamma_bar (radians) ** phib double F-W angle phi_bar (radians) ** psi double F-W angle psi (radians) ** eps double F-W angle epsilon (radians) ** ** Returned: ** r double[3][3] rotation matrix ** ** Notes: ** ** 1) Naming the following points: ** ** e = J2000.0 ecliptic pole, ** p = GCRS pole, ** E = ecliptic pole of date, ** and P = CIP, ** ** the four Fukushima-Williams angles are as follows: ** ** gamb = gamma = epE ** phib = phi = pE ** psi = psi = pEP ** eps = epsilon = EP ** ** 2) The matrix representing the combined effects of frame bias, ** precession and nutation is: ** ** NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb) ** ** 3) Three different matrices can be constructed, depending on the ** supplied angles: ** ** o To obtain the nutation x precession x frame bias matrix, ** generate the four precession angles, generate the nutation ** components and add them to the psi_bar and epsilon_A angles, ** and call the present function. ** ** o To obtain the precession x frame bias matrix, generate the ** four precession angles and call the present function. ** ** o To obtain the frame bias matrix, generate the four precession ** angles for date J2000.0 and call the present function. ** ** The nutation-only and precession-only matrices can if necessary ** be obtained by combining these three appropriately. ** ** Called: ** eraIr initialize r-matrix to identity ** eraRz rotate around Z-axis ** eraRx rotate around X-axis ** ** Reference: ** ** Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Construct the matrix. */ eraIr(r); eraRz(gamb, r); eraRx(phib, r); eraRz(-psi, r); eraRx(-eps, r); return; } void eraFw2xy(double gamb, double phib, double psi, double eps, double *x, double *y) /* ** - - - - - - - - - ** e r a F w 2 x y ** - - - - - - - - - ** ** CIP X,Y given Fukushima-Williams bias-precession-nutation angles. ** ** Given: ** gamb double F-W angle gamma_bar (radians) ** phib double F-W angle phi_bar (radians) ** psi double F-W angle psi (radians) ** eps double F-W angle epsilon (radians) ** ** Returned: ** x,y double CIP X,Y ("radians") ** ** Notes: ** ** 1) Naming the following points: ** ** e = J2000.0 ecliptic pole, ** p = GCRS pole ** E = ecliptic pole of date, ** and P = CIP, ** ** the four Fukushima-Williams angles are as follows: ** ** gamb = gamma = epE ** phib = phi = pE ** psi = psi = pEP ** eps = epsilon = EP ** ** 2) The matrix representing the combined effects of frame bias, ** precession and nutation is: ** ** NxPxB = R_1(-epsA).R_3(-psi).R_1(phib).R_3(gamb) ** ** X,Y are elements (3,1) and (3,2) of the matrix. ** ** Called: ** eraFw2m F-W angles to r-matrix ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** ** Reference: ** ** Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r[3][3]; /* Form NxPxB matrix. */ eraFw2m(gamb, phib, psi, eps, r); /* Extract CIP X,Y. */ eraBpn2xy(r, x, y); return; } int eraGc2gd ( int n, double xyz[3], double *elong, double *phi, double *height ) /* ** - - - - - - - - - ** e r a G c 2 g d ** - - - - - - - - - ** ** Transform geocentric coordinates to geodetic using the specified ** reference ellipsoid. ** ** Given: ** n int ellipsoid identifier (Note 1) ** xyz double[3] geocentric vector (Note 2) ** ** Returned: ** elong double longitude (radians, east +ve) ** phi double latitude (geodetic, radians, Note 3) ** height double height above ellipsoid (geodetic, Notes 2,3) ** ** Returned (function value): ** int status: 0 = OK ** -1 = illegal identifier (Note 3) ** -2 = internal error (Note 3) ** ** Notes: ** ** 1) The identifier n is a number that specifies the choice of ** reference ellipsoid. The following are supported: ** ** n ellipsoid ** ** 1 ERFA_WGS84 ** 2 ERFA_GRS80 ** 3 ERFA_WGS72 ** ** The n value has no significance outside the ERFA software. For ** convenience, symbols ERFA_WGS84 etc. are defined in erfam.h. ** ** 2) The geocentric vector (xyz, given) and height (height, returned) ** are in meters. ** ** 3) An error status -1 means that the identifier n is illegal. An ** error status -2 is theoretically impossible. In all error cases, ** phi and height are both set to -1e9. ** ** 4) The inverse transformation is performed in the function eraGd2gc. ** ** Called: ** eraEform Earth reference ellipsoids ** eraGc2gde geocentric to geodetic transformation, general ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int j; double a, f; /* Obtain reference ellipsoid parameters. */ j = eraEform ( n, &a, &f ); /* If OK, transform x,y,z to longitude, geodetic latitude, height. */ if ( j == 0 ) { j = eraGc2gde ( a, f, xyz, elong, phi, height ); if ( j < 0 ) j = -2; } /* Deal with any errors. */ if ( j < 0 ) { *phi = -1e9; *height = -1e9; } /* Return the status. */ return j; } int eraGc2gde ( double a, double f, double xyz[3], double *elong, double *phi, double *height ) /* ** - - - - - - - - - - ** e r a G c 2 g d e ** - - - - - - - - - - ** ** Transform geocentric coordinates to geodetic for a reference ** ellipsoid of specified form. ** ** Given: ** a double equatorial radius (Notes 2,4) ** f double flattening (Note 3) ** xyz double[3] geocentric vector (Note 4) ** ** Returned: ** elong double longitude (radians, east +ve) ** phi double latitude (geodetic, radians) ** height double height above ellipsoid (geodetic, Note 4) ** ** Returned (function value): ** int status: 0 = OK ** -1 = illegal f ** -2 = illegal a ** ** Notes: ** ** 1) This function is based on the GCONV2H Fortran subroutine by ** Toshio Fukushima (see reference). ** ** 2) The equatorial radius, a, can be in any units, but meters is ** the conventional choice. ** ** 3) The flattening, f, is (for the Earth) a value around 0.00335, ** i.e. around 1/298. ** ** 4) The equatorial radius, a, and the geocentric vector, xyz, ** must be given in the same units, and determine the units of ** the returned height, height. ** ** 5) If an error occurs (status < 0), elong, phi and height are ** unchanged. ** ** 6) The inverse transformation is performed in the function ** eraGd2gce. ** ** 7) The transformation for a standard ellipsoid (such as ERFA_WGS84) can ** more conveniently be performed by calling eraGc2gd, which uses a ** numerical code to identify the required A and F values. ** ** Reference: ** ** Fukushima, T., "Transformation from Cartesian to geodetic ** coordinates accelerated by Halley's method", J.Geodesy (2006) ** 79: 689-693 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double aeps2, e2, e4t, ec2, ec, b, x, y, z, p2, absz, p, s0, pn, zc, c0, c02, c03, s02, s03, a02, a0, a03, d0, f0, b0, s1, cc, s12, cc2; /* ------------- */ /* Preliminaries */ /* ------------- */ /* Validate ellipsoid parameters. */ if ( f < 0.0 || f >= 1.0 ) return -1; if ( a <= 0.0 ) return -2; /* Functions of ellipsoid parameters (with further validation of f). */ aeps2 = a*a * 1e-32; e2 = (2.0 - f) * f; e4t = e2*e2 * 1.5; ec2 = 1.0 - e2; if ( ec2 <= 0.0 ) return -1; ec = sqrt(ec2); b = a * ec; /* Cartesian components. */ x = xyz[0]; y = xyz[1]; z = xyz[2]; /* Distance from polar axis squared. */ p2 = x*x + y*y; /* Longitude. */ *elong = p2 != 0.0 ? atan2(y, x) : 0.0; /* Unsigned z-coordinate. */ absz = fabs(z); /* Proceed unless polar case. */ if ( p2 > aeps2 ) { /* Distance from polar axis. */ p = sqrt(p2); /* Normalization. */ s0 = absz / a; pn = p / a; zc = ec * s0; /* Prepare Newton correction factors. */ c0 = ec * pn; c02 = c0 * c0; c03 = c02 * c0; s02 = s0 * s0; s03 = s02 * s0; a02 = c02 + s02; a0 = sqrt(a02); a03 = a02 * a0; d0 = zc*a03 + e2*s03; f0 = pn*a03 - e2*c03; /* Prepare Halley correction factor. */ b0 = e4t * s02 * c02 * pn * (a0 - ec); s1 = d0*f0 - b0*s0; cc = ec * (f0*f0 - b0*c0); /* Evaluate latitude and height. */ *phi = atan(s1/cc); s12 = s1 * s1; cc2 = cc * cc; *height = (p*cc + absz*s1 - a * sqrt(ec2*s12 + cc2)) / sqrt(s12 + cc2); } else { /* Exception: pole. */ *phi = ERFA_DPI / 2.0; *height = absz - b; } /* Restore sign of latitude. */ if ( z < 0 ) *phi = -*phi; /* OK status. */ return 0; } int eraGd2gc ( int n, double elong, double phi, double height, double xyz[3] ) /* ** - - - - - - - - - ** e r a G d 2 g c ** - - - - - - - - - ** ** Transform geodetic coordinates to geocentric using the specified ** reference ellipsoid. ** ** Given: ** n int ellipsoid identifier (Note 1) ** elong double longitude (radians, east +ve) ** phi double latitude (geodetic, radians, Note 3) ** height double height above ellipsoid (geodetic, Notes 2,3) ** ** Returned: ** xyz double[3] geocentric vector (Note 2) ** ** Returned (function value): ** int status: 0 = OK ** -1 = illegal identifier (Note 3) ** -2 = illegal case (Note 3) ** ** Notes: ** ** 1) The identifier n is a number that specifies the choice of ** reference ellipsoid. The following are supported: ** ** n ellipsoid ** ** 1 ERFA_WGS84 ** 2 ERFA_GRS80 ** 3 ERFA_WGS72 ** ** The n value has no significance outside the ERFA software. For ** convenience, symbols ERFA_WGS84 etc. are defined in erfam.h. ** ** 2) The height (height, given) and the geocentric vector (xyz, ** returned) are in meters. ** ** 3) No validation is performed on the arguments elong, phi and ** height. An error status -1 means that the identifier n is ** illegal. An error status -2 protects against cases that would ** lead to arithmetic exceptions. In all error cases, xyz is set ** to zeros. ** ** 4) The inverse transformation is performed in the function eraGc2gd. ** ** Called: ** eraEform Earth reference ellipsoids ** eraGd2gce geodetic to geocentric transformation, general ** eraZp zero p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int j; double a, f; /* Obtain reference ellipsoid parameters. */ j = eraEform ( n, &a, &f ); /* If OK, transform longitude, geodetic latitude, height to x,y,z. */ if ( j == 0 ) { j = eraGd2gce ( a, f, elong, phi, height, xyz ); if ( j != 0 ) j = -2; } /* Deal with any errors. */ if ( j != 0 ) eraZp ( xyz ); /* Return the status. */ return j; } int eraGd2gce ( double a, double f, double elong, double phi, double height, double xyz[3] ) /* ** - - - - - - - - - - ** e r a G d 2 g c e ** - - - - - - - - - - ** ** Transform geodetic coordinates to geocentric for a reference ** ellipsoid of specified form. ** ** Given: ** a double equatorial radius (Notes 1,4) ** f double flattening (Notes 2,4) ** elong double longitude (radians, east +ve) ** phi double latitude (geodetic, radians, Note 4) ** height double height above ellipsoid (geodetic, Notes 3,4) ** ** Returned: ** xyz double[3] geocentric vector (Note 3) ** ** Returned (function value): ** int status: 0 = OK ** -1 = illegal case (Note 4) ** Notes: ** ** 1) The equatorial radius, a, can be in any units, but meters is ** the conventional choice. ** ** 2) The flattening, f, is (for the Earth) a value around 0.00335, ** i.e. around 1/298. ** ** 3) The equatorial radius, a, and the height, height, must be ** given in the same units, and determine the units of the ** returned geocentric vector, xyz. ** ** 4) No validation is performed on individual arguments. The error ** status -1 protects against (unrealistic) cases that would lead ** to arithmetic exceptions. If an error occurs, xyz is unchanged. ** ** 5) The inverse transformation is performed in the function ** eraGc2gde. ** ** 6) The transformation for a standard ellipsoid (such as ERFA_WGS84) can ** more conveniently be performed by calling eraGd2gc, which uses a ** numerical code to identify the required a and f values. ** ** References: ** ** Green, R.M., Spherical Astronomy, Cambridge University Press, ** (1985) Section 4.5, p96. ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 4.22, p202. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double sp, cp, w, d, ac, as, r; /* Functions of geodetic latitude. */ sp = sin(phi); cp = cos(phi); w = 1.0 - f; w = w * w; d = cp*cp + w*sp*sp; if ( d <= 0.0 ) return -1; ac = a / sqrt(d); as = w * ac; /* Geocentric vector. */ r = (ac + height) * cp; xyz[0] = r * cos(elong); xyz[1] = r * sin(elong); xyz[2] = (as + height) * sp; /* Success. */ return 0; } double eraGmst00(double uta, double utb, double tta, double ttb) /* ** - - - - - - - - - - ** e r a G m s t 0 0 ** - - - - - - - - - - ** ** Greenwich mean sidereal time (model consistent with IAU 2000 ** resolutions). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich mean sidereal time (radians) ** ** Notes: ** ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both ** Julian Dates, apportioned in any convenient way between the ** argument pairs. For example, JD=2450123.7 could be expressed in ** any of these ways, among others: ** ** Part A Part B ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable (in the case of UT; the TT is not at all critical ** in this respect). The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** Rotation Angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation ** and TT to predict the effects of precession. If UT1 is used for ** both purposes, errors of order 100 microarcseconds result. ** ** 3) This GMST is compatible with the IAU 2000 resolutions and must be ** used only in conjunction with other IAU 2000 compatible ** components such as precession-nutation and equation of the ** equinoxes. ** ** 4) The result is returned in the range 0 to 2pi. ** ** 5) The algorithm is from Capitaine et al. (2003) and IERS ** Conventions 2003. ** ** Called: ** eraEra00 Earth rotation angle, IAU 2000 ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, gmst; /* TT Julian centuries since J2000.0. */ t = ((tta - ERFA_DJ00) + ttb) / ERFA_DJC; /* Greenwich Mean Sidereal Time, IAU 2000. */ gmst = eraAnp(eraEra00(uta, utb) + ( 0.014506 + ( 4612.15739966 + ( 1.39667721 + ( -0.00009344 + ( 0.00001882 ) * t) * t) * t) * t) * ERFA_DAS2R); return gmst; } double eraGmst06(double uta, double utb, double tta, double ttb) /* ** - - - - - - - - - - ** e r a G m s t 0 6 ** - - - - - - - - - - ** ** Greenwich mean sidereal time (consistent with IAU 2006 precession). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich mean sidereal time (radians) ** ** Notes: ** ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both ** Julian Dates, apportioned in any convenient way between the ** argument pairs. For example, JD=2450123.7 could be expressed in ** any of these ways, among others: ** ** Part A Part B ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable (in the case of UT; the TT is not at all critical ** in this respect). The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** rotation angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation ** and TT to predict the effects of precession. If UT1 is used for ** both purposes, errors of order 100 microarcseconds result. ** ** 3) This GMST is compatible with the IAU 2006 precession and must not ** be used with other precession models. ** ** 4) The result is returned in the range 0 to 2pi. ** ** Called: ** eraEra00 Earth rotation angle, IAU 2000 ** eraAnp normalize angle into range 0 to 2pi ** ** Reference: ** ** Capitaine, N., Wallace, P.T. & Chapront, J., 2005, ** Astron.Astrophys. 432, 355 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, gmst; /* TT Julian centuries since J2000.0. */ t = ((tta - ERFA_DJ00) + ttb) / ERFA_DJC; /* Greenwich mean sidereal time, IAU 2006. */ gmst = eraAnp(eraEra00(uta, utb) + ( 0.014506 + ( 4612.156534 + ( 1.3915817 + ( -0.00000044 + ( -0.000029956 + ( -0.0000000368 ) * t) * t) * t) * t) * t) * ERFA_DAS2R); return gmst; } double eraGmst82(double dj1, double dj2) /* ** - - - - - - - - - - ** e r a G m s t 8 2 ** - - - - - - - - - - ** ** Universal Time to Greenwich mean sidereal time (IAU 1982 model). ** ** Given: ** dj1,dj2 double UT1 Julian Date (see note) ** ** Returned (function value): ** double Greenwich mean sidereal time (radians) ** ** Notes: ** ** 1) The UT1 date dj1+dj2 is a Julian Date, apportioned in any ** convenient way between the arguments dj1 and dj2. For example, ** JD(UT1)=2450123.7 could be expressed in any of these ways, ** among others: ** ** dj1 dj2 ** ** 2450123.7D0 0D0 (JD method) ** 2451545D0 -1421.3D0 (J2000 method) ** 2400000.5D0 50123.2D0 (MJD method) ** 2450123.5D0 0.2D0 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. The date & time method is ** best matched to the algorithm used: maximum accuracy (or, at ** least, minimum noise) is delivered when the dj1 argument is for ** 0hrs UT1 on the day in question and the dj2 argument lies in the ** range 0 to 1, or vice versa. ** ** 2) The algorithm is based on the IAU 1982 expression. This is ** always described as giving the GMST at 0 hours UT1. In fact, it ** gives the difference between the GMST and the UT, the steady ** 4-minutes-per-day drawing-ahead of ST with respect to UT. When ** whole days are ignored, the expression happens to equal the GMST ** at 0 hours UT1 each day. ** ** 3) In this function, the entire UT1 (the sum of the two arguments ** dj1 and dj2) is used directly as the argument for the standard ** formula, the constant term of which is adjusted by 12 hours to ** take account of the noon phasing of Julian Date. The UT1 is then ** added, but omitting whole days to conserve accuracy. ** ** Called: ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Transactions of the International Astronomical Union, ** XVIII B, 67 (1983). ** ** Aoki et al., Astron. Astrophys. 105, 359-361 (1982). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Coefficients of IAU 1982 GMST-UT1 model */ double A = 24110.54841 - ERFA_DAYSEC / 2.0; double B = 8640184.812866; double C = 0.093104; double D = -6.2e-6; /* Note: the first constant, A, has to be adjusted by 12 hours */ /* because the UT1 is supplied as a Julian date, which begins */ /* at noon. */ double d1, d2, t, f, gmst; /* Julian centuries since fundamental epoch. */ if (dj1 < dj2) { d1 = dj1; d2 = dj2; } else { d1 = dj2; d2 = dj1; } t = (d1 + (d2 - ERFA_DJ00)) / ERFA_DJC; /* Fractional part of JD(UT1), in seconds. */ f = ERFA_DAYSEC * (fmod(d1, 1.0) + fmod(d2, 1.0)); /* GMST at this UT1. */ gmst = eraAnp(ERFA_DS2R * ((A + (B + (C + D * t) * t) * t) + f)); return gmst; } double eraGst00a(double uta, double utb, double tta, double ttb) /* ** - - - - - - - - - - ** e r a G s t 0 0 a ** - - - - - - - - - - ** ** Greenwich apparent sidereal time (consistent with IAU 2000 ** resolutions). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich apparent sidereal time (radians) ** ** Notes: ** ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both ** Julian Dates, apportioned in any convenient way between the ** argument pairs. For example, JD=2450123.7 could be expressed in ** any of these ways, among others: ** ** Part A Part B ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable (in the case of UT; the TT is not at all critical ** in this respect). The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** Rotation Angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation ** and TT to predict the effects of precession-nutation. If UT1 is ** used for both purposes, errors of order 100 microarcseconds ** result. ** ** 3) This GAST is compatible with the IAU 2000 resolutions and must be ** used only in conjunction with other IAU 2000 compatible ** components such as precession-nutation. ** ** 4) The result is returned in the range 0 to 2pi. ** ** 5) The algorithm is from Capitaine et al. (2003) and IERS ** Conventions 2003. ** ** Called: ** eraGmst00 Greenwich mean sidereal time, IAU 2000 ** eraEe00a equation of the equinoxes, IAU 2000A ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gmst00, ee00a, gst; gmst00 = eraGmst00(uta, utb, tta, ttb); ee00a = eraEe00a(tta, ttb); gst = eraAnp(gmst00 + ee00a); return gst; } double eraGst00b(double uta, double utb) /* ** - - - - - - - - - - ** e r a G s t 0 0 b ** - - - - - - - - - - ** ** Greenwich apparent sidereal time (consistent with IAU 2000 ** resolutions but using the truncated nutation model IAU 2000B). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich apparent sidereal time (radians) ** ** Notes: ** ** 1) The UT1 date uta+utb is a Julian Date, apportioned in any ** convenient way between the argument pair. For example, ** JD=2450123.7 could be expressed in any of these ways, among ** others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in cases ** where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** Rotation Angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) The result is compatible with the IAU 2000 resolutions, except ** that accuracy has been compromised for the sake of speed and ** convenience in two respects: ** ** . UT is used instead of TDB (or TT) to compute the precession ** component of GMST and the equation of the equinoxes. This ** results in errors of order 0.1 mas at present. ** ** . The IAU 2000B abridged nutation model (McCarthy & Luzum, 2001) ** is used, introducing errors of up to 1 mas. ** ** 3) This GAST is compatible with the IAU 2000 resolutions and must be ** used only in conjunction with other IAU 2000 compatible ** components such as precession-nutation. ** ** 4) The result is returned in the range 0 to 2pi. ** ** 5) The algorithm is from Capitaine et al. (2003) and IERS ** Conventions 2003. ** ** Called: ** eraGmst00 Greenwich mean sidereal time, IAU 2000 ** eraEe00b equation of the equinoxes, IAU 2000B ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Capitaine, N., Wallace, P.T. and McCarthy, D.D., "Expressions to ** implement the IAU 2000 definition of UT1", Astronomy & ** Astrophysics, 406, 1135-1149 (2003) ** ** McCarthy, D.D. & Luzum, B.J., "An abridged model of the ** precession-nutation of the celestial pole", Celestial Mechanics & ** Dynamical Astronomy, 85, 37-49 (2003) ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gmst00, ee00b, gst; gmst00 = eraGmst00(uta, utb, uta, utb); ee00b = eraEe00b(uta, utb); gst = eraAnp(gmst00 + ee00b); return gst; } double eraGst06(double uta, double utb, double tta, double ttb, double rnpb[3][3]) /* ** - - - - - - - - - ** e r a G s t 0 6 ** - - - - - - - - - ** ** Greenwich apparent sidereal time, IAU 2006, given the NPB matrix. ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2) ** rnpb double[3][3] nutation x precession x bias matrix ** ** Returned (function value): ** double Greenwich apparent sidereal time (radians) ** ** Notes: ** ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both ** Julian Dates, apportioned in any convenient way between the ** argument pairs. For example, JD=2450123.7 could be expressed in ** any of these ways, among others: ** ** Part A Part B ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable (in the case of UT; the TT is not at all critical ** in this respect). The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** rotation angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation ** and TT to predict the effects of precession-nutation. If UT1 is ** used for both purposes, errors of order 100 microarcseconds ** result. ** ** 3) Although the function uses the IAU 2006 series for s+XY/2, it is ** otherwise independent of the precession-nutation model and can in ** practice be used with any equinox-based NPB matrix. ** ** 4) The result is returned in the range 0 to 2pi. ** ** Called: ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS06 the CIO locator s, given X,Y, IAU 2006 ** eraAnp normalize angle into range 0 to 2pi ** eraEra00 Earth rotation angle, IAU 2000 ** eraEors equation of the origins, given NPB matrix and s ** ** Reference: ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y, s, era, eors, gst; /* Extract CIP coordinates. */ eraBpn2xy(rnpb, &x, &y); /* The CIO locator, s. */ s = eraS06(tta, ttb, x, y); /* Greenwich apparent sidereal time. */ era = eraEra00(uta, utb); eors = eraEors(rnpb, s); gst = eraAnp(era - eors); return gst; } double eraGst06a(double uta, double utb, double tta, double ttb) /* ** - - - - - - - - - - ** e r a G s t 0 6 a ** - - - - - - - - - - ** ** Greenwich apparent sidereal time (consistent with IAU 2000 and 2006 ** resolutions). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** tta,ttb double TT as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich apparent sidereal time (radians) ** ** Notes: ** ** 1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both ** Julian Dates, apportioned in any convenient way between the ** argument pairs. For example, JD=2450123.7 could be expressed in ** any of these ways, among others: ** ** Part A Part B ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable (in the case of UT; the TT is not at all critical ** in this respect). The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** rotation angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) Both UT1 and TT are required, UT1 to predict the Earth rotation ** and TT to predict the effects of precession-nutation. If UT1 is ** used for both purposes, errors of order 100 microarcseconds ** result. ** ** 3) This GAST is compatible with the IAU 2000/2006 resolutions and ** must be used only in conjunction with IAU 2006 precession and ** IAU 2000A nutation. ** ** 4) The result is returned in the range 0 to 2pi. ** ** Called: ** eraPnm06a classical NPB matrix, IAU 2006/2000A ** eraGst06 Greenwich apparent ST, IAU 2006, given NPB matrix ** ** Reference: ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rnpb[3][3], gst; /* Classical nutation x precession x bias matrix, IAU 2000A. */ eraPnm06a(tta, ttb, rnpb); /* Greenwich apparent sidereal time. */ gst = eraGst06(uta, utb, tta, ttb, rnpb); return gst; } double eraGst94(double uta, double utb) /* ** - - - - - - - - - ** e r a G s t 9 4 ** - - - - - - - - - ** ** Greenwich apparent sidereal time (consistent with IAU 1982/94 ** resolutions). ** ** Given: ** uta,utb double UT1 as a 2-part Julian Date (Notes 1,2) ** ** Returned (function value): ** double Greenwich apparent sidereal time (radians) ** ** Notes: ** ** 1) The UT1 date uta+utb is a Julian Date, apportioned in any ** convenient way between the argument pair. For example, ** JD=2450123.7 could be expressed in any of these ways, among ** others: ** ** uta utb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in cases ** where the loss of several decimal digits of resolution is ** acceptable. The J2000 and MJD methods are good compromises ** between resolution and convenience. For UT, the date & time ** method is best matched to the algorithm that is used by the Earth ** Rotation Angle function, called internally: maximum precision is ** delivered when the uta argument is for 0hrs UT1 on the day in ** question and the utb argument lies in the range 0 to 1, or vice ** versa. ** ** 2) The result is compatible with the IAU 1982 and 1994 resolutions, ** except that accuracy has been compromised for the sake of ** convenience in that UT is used instead of TDB (or TT) to compute ** the equation of the equinoxes. ** ** 3) This GAST must be used only in conjunction with contemporaneous ** IAU standards such as 1976 precession, 1980 obliquity and 1982 ** nutation. It is not compatible with the IAU 2000 resolutions. ** ** 4) The result is returned in the range 0 to 2pi. ** ** Called: ** eraGmst82 Greenwich mean sidereal time, IAU 1982 ** eraEqeq94 equation of the equinoxes, IAU 1994 ** eraAnp normalize angle into range 0 to 2pi ** ** References: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** IAU Resolution C7, Recommendation 3 (1994) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gmst82, eqeq94, gst; gmst82 = eraGmst82(uta, utb); eqeq94 = eraEqeq94(uta, utb); gst = eraAnp(gmst82 + eqeq94); return gst; } void eraH2fk5(double rh, double dh, double drh, double ddh, double pxh, double rvh, double *r5, double *d5, double *dr5, double *dd5, double *px5, double *rv5) /* ** - - - - - - - - - ** e r a H 2 f k 5 ** - - - - - - - - - ** ** Transform Hipparcos star data into the FK5 (J2000.0) system. ** ** Given (all Hipparcos, epoch J2000.0): ** rh double RA (radians) ** dh double Dec (radians) ** drh double proper motion in RA (dRA/dt, rad/Jyear) ** ddh double proper motion in Dec (dDec/dt, rad/Jyear) ** pxh double parallax (arcsec) ** rvh double radial velocity (km/s, positive = receding) ** ** Returned (all FK5, equinox J2000.0, epoch J2000.0): ** r5 double RA (radians) ** d5 double Dec (radians) ** dr5 double proper motion in RA (dRA/dt, rad/Jyear) ** dd5 double proper motion in Dec (dDec/dt, rad/Jyear) ** px5 double parallax (arcsec) ** rv5 double radial velocity (km/s, positive = receding) ** ** Notes: ** ** 1) This function transforms Hipparcos star positions and proper ** motions into FK5 J2000.0. ** ** 2) The proper motions in RA are dRA/dt rather than ** cos(Dec)*dRA/dt, and are per year rather than per century. ** ** 3) The FK5 to Hipparcos transformation is modeled as a pure ** rotation and spin; zonal errors in the FK5 catalog are not ** taken into account. ** ** 4) See also eraFk52h, eraFk5hz, eraHfk5z. ** ** Called: ** eraStarpv star catalog data to space motion pv-vector ** eraFk5hip FK5 to Hipparcos rotation and spin ** eraRv2m r-vector to r-matrix ** eraRxp product of r-matrix and p-vector ** eraTrxp product of transpose of r-matrix and p-vector ** eraPxp vector product of two p-vectors ** eraPmp p-vector minus p-vector ** eraPvstar space motion pv-vector to star catalog data ** ** Reference: ** ** F.Mignard & M.Froeschle, Astron. Astrophys. 354, 732-739 (2000). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int i; double pvh[2][3], r5h[3][3], s5h[3], sh[3], wxp[3], vv[3], pv5[2][3]; /* Hipparcos barycentric position/velocity pv-vector (normalized). */ eraStarpv(rh, dh, drh, ddh, pxh, rvh, pvh); /* FK5 to Hipparcos orientation matrix and spin vector. */ eraFk5hip(r5h, s5h); /* Make spin units per day instead of per year. */ for ( i = 0; i < 3; s5h[i++] /= 365.25 ); /* Orient the spin into the Hipparcos system. */ eraRxp(r5h, s5h, sh); /* De-orient the Hipparcos position into the FK5 system. */ eraTrxp(r5h, pvh[0], pv5[0]); /* Apply spin to the position giving an extra space motion component. */ eraPxp(pvh[0], sh, wxp); /* Subtract this component from the Hipparcos space motion. */ eraPmp(pvh[1], wxp, vv); /* De-orient the Hipparcos space motion into the FK5 system. */ eraTrxp(r5h, vv, pv5[1]); /* FK5 pv-vector to spherical. */ eraPvstar(pv5, r5, d5, dr5, dd5, px5, rv5); return; } void eraHfk5z(double rh, double dh, double date1, double date2, double *r5, double *d5, double *dr5, double *dd5) /* ** - - - - - - - - - ** e r a H f k 5 z ** - - - - - - - - - ** ** Transform a Hipparcos star position into FK5 J2000.0, assuming ** zero Hipparcos proper motion. ** ** Given: ** rh double Hipparcos RA (radians) ** dh double Hipparcos Dec (radians) ** date1,date2 double TDB date (Note 1) ** ** Returned (all FK5, equinox J2000.0, date date1+date2): ** r5 double RA (radians) ** d5 double Dec (radians) ** dr5 double FK5 RA proper motion (rad/year, Note 4) ** dd5 double Dec proper motion (rad/year, Note 4) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt. ** ** 3) The FK5 to Hipparcos transformation is modeled as a pure rotation ** and spin; zonal errors in the FK5 catalogue are not taken into ** account. ** ** 4) It was the intention that Hipparcos should be a close ** approximation to an inertial frame, so that distant objects have ** zero proper motion; such objects have (in general) non-zero ** proper motion in FK5, and this function returns those fictitious ** proper motions. ** ** 5) The position returned by this function is in the FK5 J2000.0 ** reference system but at date date1+date2. ** ** 6) See also eraFk52h, eraH2fk5, eraFk5zhz. ** ** Called: ** eraS2c spherical coordinates to unit vector ** eraFk5hip FK5 to Hipparcos rotation and spin ** eraRxp product of r-matrix and p-vector ** eraSxp multiply p-vector by scalar ** eraRxr product of two r-matrices ** eraTrxp product of transpose of r-matrix and p-vector ** eraPxp vector product of two p-vectors ** eraPv2s pv-vector to spherical ** eraAnp normalize angle into range 0 to 2pi ** ** Reference: ** ** F.Mignard & M.Froeschle, 2000, Astron.Astrophys. 354, 732-739. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, ph[3], r5h[3][3], s5h[3], sh[3], vst[3], rst[3][3], r5ht[3][3], pv5e[2][3], vv[3], w, r, v; /* Time interval from fundamental epoch J2000.0 to given date (JY). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJY; /* Hipparcos barycentric position vector (normalized). */ eraS2c(rh, dh, ph); /* FK5 to Hipparcos orientation matrix and spin vector. */ eraFk5hip(r5h, s5h); /* Rotate the spin into the Hipparcos system. */ eraRxp(r5h, s5h, sh); /* Accumulated Hipparcos wrt FK5 spin over that interval. */ eraSxp(t, s5h, vst); /* Express the accumulated spin as a rotation matrix. */ eraRv2m(vst, rst); /* Rotation matrix: accumulated spin, then FK5 to Hipparcos. */ eraRxr(r5h, rst, r5ht); /* De-orient & de-spin the Hipparcos position into FK5 J2000.0. */ eraTrxp(r5ht, ph, pv5e[0]); /* Apply spin to the position giving a space motion. */ eraPxp(sh, ph, vv); /* De-orient & de-spin the Hipparcos space motion into FK5 J2000.0. */ eraTrxp(r5ht, vv, pv5e[1]); /* FK5 position/velocity pv-vector to spherical. */ eraPv2s(pv5e, &w, d5, &r, dr5, dd5, &v); *r5 = eraAnp(w); return; } void eraIr(double r[3][3]) /* ** - - - - - - ** e r a I r ** - - - - - - ** ** Initialize an r-matrix to the identity matrix. ** ** Returned: ** r double[3][3] r-matrix ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { r[0][0] = 1.0; r[0][1] = 0.0; r[0][2] = 0.0; r[1][0] = 0.0; r[1][1] = 1.0; r[1][2] = 0.0; r[2][0] = 0.0; r[2][1] = 0.0; r[2][2] = 1.0; return; } int eraJd2cal(double dj1, double dj2, int *iy, int *im, int *id, double *fd) /* ** - - - - - - - - - - ** e r a J d 2 c a l ** - - - - - - - - - - ** ** Julian Date to Gregorian year, month, day, and fraction of a day. ** ** Given: ** dj1,dj2 double Julian Date (Notes 1, 2) ** ** Returned (arguments): ** iy int year ** im int month ** id int day ** fd double fraction of day ** ** Returned (function value): ** int status: ** 0 = OK ** -1 = unacceptable date (Note 3) ** ** Notes: ** ** 1) The earliest valid date is -68569.5 (-4900 March 1). The ** largest value accepted is 10^9. ** ** 2) The Julian Date is apportioned in any convenient way between ** the arguments dj1 and dj2. For example, JD=2450123.7 could ** be expressed in any of these ways, among others: ** ** dj1 dj2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** 3) In early eras the conversion is from the "proleptic Gregorian ** calendar"; no account is taken of the date(s) of adoption of ** the Gregorian calendar, nor is the AD/BC numbering convention ** observed. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 12.92 (p604). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Minimum and maximum allowed JD */ static const double djmin = -68569.5; static const double djmax = 1e9; long jd, l, n, i, k; double dj, d1, d2, f1, f2, f, d; /* Verify date is acceptable. */ dj = dj1 + dj2; if (dj < djmin || dj > djmax) return -1; /* Copy the date, big then small, and re-align to midnight. */ if (dj1 >= dj2) { d1 = dj1; d2 = dj2; } else { d1 = dj2; d2 = dj1; } d2 -= 0.5; /* Separate day and fraction. */ f1 = fmod(d1, 1.0); f2 = fmod(d2, 1.0); f = fmod(f1 + f2, 1.0); if (f < 0.0) f += 1.0; d = floor(d1 - f1) + floor(d2 - f2) + floor(f1 + f2 - f); jd = (long) floor(d) + 1L; /* Express day in Gregorian calendar. */ l = jd + 68569L; n = (4L * l) / 146097L; l -= (146097L * n + 3L) / 4L; i = (4000L * (l + 1L)) / 1461001L; l -= (1461L * i) / 4L - 31L; k = (80L * l) / 2447L; *id = (int) (l - (2447L * k) / 80L); l = k / 11L; *im = (int) (k + 2L - 12L * l); *iy = (int) (100L * (n - 49L) + i + l); *fd = f; return 0; } int eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4]) /* ** - - - - - - - - - - ** e r a J d c a l f ** - - - - - - - - - - ** ** Julian Date to Gregorian Calendar, expressed in a form convenient ** for formatting messages: rounded to a specified precision. ** ** Given: ** ndp int number of decimal places of days in fraction ** dj1,dj2 double dj1+dj2 = Julian Date (Note 1) ** ** Returned: ** iymdf int[4] year, month, day, fraction in Gregorian ** calendar ** ** Returned (function value): ** int status: ** -1 = date out of range ** 0 = OK ** +1 = NDP not 0-9 (interpreted as 0) ** ** Notes: ** ** 1) The Julian Date is apportioned in any convenient way between ** the arguments dj1 and dj2. For example, JD=2450123.7 could ** be expressed in any of these ways, among others: ** ** dj1 dj2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** 2) In early eras the conversion is from the "Proleptic Gregorian ** Calendar"; no account is taken of the date(s) of adoption of ** the Gregorian Calendar, nor is the AD/BC numbering convention ** observed. ** ** 3) Refer to the function eraJd2cal. ** ** 4) NDP should be 4 or less if internal overflows are to be ** avoided on machines which use 16-bit integers. ** ** Called: ** eraJd2cal JD to Gregorian calendar ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 12.92 (p604). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int j, js; double denom, d1, d2, f1, f2, f; /* Denominator of fraction (e.g. 100 for 2 decimal places). */ if ((ndp >= 0) && (ndp <= 9)) { j = 0; denom = pow(10.0, ndp); } else { j = 1; denom = 1.0; } /* Copy the date, big then small, and realign to midnight. */ if (dj1 >= dj2) { d1 = dj1; d2 = dj2; } else { d1 = dj2; d2 = dj1; } d2 -= 0.5; /* Separate days and fractions. */ f1 = fmod(d1, 1.0); f2 = fmod(d2, 1.0); d1 = floor(d1 - f1); d2 = floor(d2 - f2); /* Round the total fraction to the specified number of places. */ f = floor((f1+f2)*denom + 0.5) / denom; /* Re-assemble the rounded date and re-align to noon. */ d2 += f + 0.5; /* Convert to Gregorian calendar. */ js = eraJd2cal(d1, d2, &iymdf[0], &iymdf[1], &iymdf[2], &f); if (js == 0) { iymdf[3] = (int) (f * denom); } else { j = js; } /* Return the status. */ return j; } void eraNum00a(double date1, double date2, double rmatn[3][3]) /* ** - - - - - - - - - - ** e r a N u m 0 0 a ** - - - - - - - - - - ** ** Form the matrix of nutation for a given date, IAU 2000A model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rmatn double[3][3] nutation matrix ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(true) = rmatn * V(mean), where ** the p-vector V(true) is with respect to the true equatorial triad ** of date and the p-vector V(mean) is with respect to the mean ** equatorial triad of date. ** ** 3) A faster, but slightly less accurate result (about 1 mas), can be ** obtained by using instead the eraNum00b function. ** ** Called: ** eraPn00a bias/precession/nutation, IAU 2000A ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.222-3 (p114). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rbpn[3][3]; /* Obtain the required matrix (discarding other results). */ eraPn00a(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rmatn, rbpn); return; } void eraNum00b(double date1, double date2, double rmatn[3][3]) /* ** - - - - - - - - - - ** e r a N u m 0 0 b ** - - - - - - - - - - ** ** Form the matrix of nutation for a given date, IAU 2000B model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rmatn double[3][3] nutation matrix ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(true) = rmatn * V(mean), where ** the p-vector V(true) is with respect to the true equatorial triad ** of date and the p-vector V(mean) is with respect to the mean ** equatorial triad of date. ** ** 3) The present function is faster, but slightly less accurate (about ** 1 mas), than the eraNum00a function. ** ** Called: ** eraPn00b bias/precession/nutation, IAU 2000B ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.222-3 (p114). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rbpn[3][3]; /* Obtain the required matrix (discarding other results). */ eraPn00b(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rmatn, rbpn); return; } void eraNum06a(double date1, double date2, double rmatn[3][3]) /* ** - - - - - - - - - - ** e r a N u m 0 6 a ** - - - - - - - - - - ** ** Form the matrix of nutation for a given date, IAU 2006/2000A model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rmatn double[3][3] nutation matrix ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(true) = rmatn * V(mean), where ** the p-vector V(true) is with respect to the true equatorial triad ** of date and the p-vector V(mean) is with respect to the mean ** equatorial triad of date. ** ** Called: ** eraObl06 mean obliquity, IAU 2006 ** eraNut06a nutation, IAU 2006/2000A ** eraNumat form nutation matrix ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.222-3 (p114). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double eps, dp, de; /* Mean obliquity. */ eps = eraObl06(date1, date2); /* Nutation components. */ eraNut06a(date1, date2, &dp, &de); /* Nutation matrix. */ eraNumat(eps, dp, de, rmatn); return; } void eraNumat(double epsa, double dpsi, double deps, double rmatn[3][3]) /* ** - - - - - - - - - ** e r a N u m a t ** - - - - - - - - - ** ** Form the matrix of nutation. ** ** Given: ** epsa double mean obliquity of date (Note 1) ** dpsi,deps double nutation (Note 2) ** ** Returned: ** rmatn double[3][3] nutation matrix (Note 3) ** ** Notes: ** ** ** 1) The supplied mean obliquity epsa, must be consistent with the ** precession-nutation models from which dpsi and deps were obtained. ** ** 2) The caller is responsible for providing the nutation components; ** they are in longitude and obliquity, in radians and are with ** respect to the equinox and ecliptic of date. ** ** 3) The matrix operates in the sense V(true) = rmatn * V(mean), ** where the p-vector V(true) is with respect to the true ** equatorial triad of date and the p-vector V(mean) is with ** respect to the mean equatorial triad of date. ** ** Called: ** eraIr initialize r-matrix to identity ** eraRx rotate around X-axis ** eraRz rotate around Z-axis ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.222-3 (p114). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Build the rotation matrix. */ eraIr(rmatn); eraRx(epsa, rmatn); eraRz(-dpsi, rmatn); eraRx(-(epsa + deps), rmatn); return; } void eraNut00a(double date1, double date2, double *dpsi, double *deps) /* ** - - - - - - - - - - ** e r a N u t 0 0 a ** - - - - - - - - - - ** ** Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation ** with free core nutation omitted). ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation, luni-solar + planetary (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components in longitude and obliquity are in radians ** and with respect to the equinox and ecliptic of date. The ** obliquity at J2000.0 is assumed to be the Lieske et al. (1977) ** value of 84381.448 arcsec. ** ** Both the luni-solar and planetary nutations are included. The ** latter are due to direct planetary nutations and the ** perturbations of the lunar and terrestrial orbits. ** ** 3) The function computes the MHB2000 nutation series with the ** associated corrections for planetary nutations. It is an ** implementation of the nutation part of the IAU 2000A precession- ** nutation model, formally adopted by the IAU General Assembly in ** 2000, namely MHB2000 (Mathews et al. 2002), but with the free ** core nutation (FCN - see Note 4) omitted. ** ** 4) The full MHB2000 model also contains contributions to the ** nutations in longitude and obliquity due to the free-excitation ** of the free-core-nutation during the period 1979-2000. These FCN ** terms, which are time-dependent and unpredictable, are NOT ** included in the present function and, if required, must be ** independently computed. With the FCN corrections included, the ** present function delivers a pole which is at current epochs ** accurate to a few hundred microarcseconds. The omission of FCN ** introduces further errors of about that size. ** ** 5) The present function provides classical nutation. The MHB2000 ** algorithm, from which it is adapted, deals also with (i) the ** offsets between the GCRS and mean poles and (ii) the adjustments ** in longitude and obliquity due to the changed precession rates. ** These additional functions, namely frame bias and precession ** adjustments, are supported by the ERFA functions eraBi00 and ** eraPr00. ** ** 6) The MHB2000 algorithm also provides "total" nutations, comprising ** the arithmetic sum of the frame bias, precession adjustments, ** luni-solar nutation and planetary nutation. These total ** nutations can be used in combination with an existing IAU 1976 ** precession implementation, such as eraPmat76, to deliver GCRS- ** to-true predictions of sub-mas accuracy at current dates. ** However, there are three shortcomings in the MHB2000 model that ** must be taken into account if more accurate or definitive results ** are required (see Wallace 2002): ** ** (i) The MHB2000 total nutations are simply arithmetic sums, ** yet in reality the various components are successive Euler ** rotations. This slight lack of rigor leads to cross terms ** that exceed 1 mas after a century. The rigorous procedure ** is to form the GCRS-to-true rotation matrix by applying the ** bias, precession and nutation in that order. ** ** (ii) Although the precession adjustments are stated to be with ** respect to Lieske et al. (1977), the MHB2000 model does ** not specify which set of Euler angles are to be used and ** how the adjustments are to be applied. The most literal ** and straightforward procedure is to adopt the 4-rotation ** epsilon_0, psi_A, omega_A, xi_A option, and to add DPSIPR ** to psi_A and DEPSPR to both omega_A and eps_A. ** ** (iii) The MHB2000 model predates the determination by Chapront ** et al. (2002) of a 14.6 mas displacement between the ** J2000.0 mean equinox and the origin of the ICRS frame. It ** should, however, be noted that neglecting this displacement ** when calculating star coordinates does not lead to a ** 14.6 mas change in right ascension, only a small second- ** order distortion in the pattern of the precession-nutation ** effect. ** ** For these reasons, the ERFA functions do not generate the "total ** nutations" directly, though they can of course easily be ** generated by calling eraBi00, eraPr00 and the present function ** and adding the results. ** ** 7) The MHB2000 model contains 41 instances where the same frequency ** appears multiple times, of which 38 are duplicates and three are ** triplicates. To keep the present code close to the original MHB ** algorithm, this small inefficiency has not been corrected. ** ** Called: ** eraFal03 mean anomaly of the Moon ** eraFaf03 mean argument of the latitude of the Moon ** eraFaom03 mean longitude of the Moon's ascending node ** eraFame03 mean longitude of Mercury ** eraFave03 mean longitude of Venus ** eraFae03 mean longitude of Earth ** eraFama03 mean longitude of Mars ** eraFaju03 mean longitude of Jupiter ** eraFasa03 mean longitude of Saturn ** eraFaur03 mean longitude of Uranus ** eraFapa03 general accumulated precession in longitude ** ** References: ** ** Chapront, J., Chapront-Touze, M. & Francou, G. 2002, ** Astron.Astrophys. 387, 700 ** ** Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977, ** Astron.Astrophys. 58, 1-16 ** ** Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res. ** 107, B4. The MHB_2000 code itself was obtained on 9th September ** 2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A. ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Wallace, P.T., "Software for Implementing the IAU 2000 ** Resolutions", in IERS Workshop 5.1 (2002) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int i; double t, el, elp, f, d, om, arg, dp, de, sarg, carg, al, af, ad, aom, alme, alve, alea, alma, alju, alsa, alur, alne, apa, dpsils, depsls, dpsipl, depspl; /* Units of 0.1 microarcsecond to radians */ const double U2R = ERFA_DAS2R / 1e7; /* ------------------------- */ /* Luni-Solar nutation model */ /* ------------------------- */ /* The units for the sine and cosine coefficients are */ /* 0.1 microarcsecond and the same per Julian century */ static const struct { int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */ double sp,spt,cp; /* longitude sin, t*sin, cos coefficients */ double ce,cet,se; /* obliquity cos, t*cos, sin coefficients */ } xls[] = { /* 1- 10 */ { 0, 0, 0, 0, 1, -172064161.0, -174666.0, 33386.0, 92052331.0, 9086.0, 15377.0}, { 0, 0, 2,-2, 2, -13170906.0, -1675.0, -13696.0, 5730336.0, -3015.0, -4587.0}, { 0, 0, 2, 0, 2,-2276413.0,-234.0,2796.0,978459.0,-485.0, 1374.0}, { 0, 0, 0, 0, 2,2074554.0, 207.0, -698.0,-897492.0,470.0, -291.0}, { 0, 1, 0, 0, 0,1475877.0,-3633.0,11817.0,73871.0,-184.0,-1924.0}, { 0, 1, 2,-2, 2,-516821.0,1226.0, -524.0,224386.0,-677.0, -174.0}, { 1, 0, 0, 0, 0, 711159.0, 73.0, -872.0, -6750.0, 0.0, 358.0}, { 0, 0, 2, 0, 1,-387298.0,-367.0, 380.0, 200728.0, 18.0, 318.0}, { 1, 0, 2, 0, 2,-301461.0, -36.0, 816.0, 129025.0,-63.0, 367.0}, { 0,-1, 2,-2, 2, 215829.0,-494.0, 111.0, -95929.0,299.0, 132.0}, /* 11-20 */ { 0, 0, 2,-2, 1, 128227.0, 137.0, 181.0, -68982.0, -9.0, 39.0}, {-1, 0, 2, 0, 2, 123457.0, 11.0, 19.0, -53311.0, 32.0, -4.0}, {-1, 0, 0, 2, 0, 156994.0, 10.0, -168.0, -1235.0, 0.0, 82.0}, { 1, 0, 0, 0, 1, 63110.0, 63.0, 27.0, -33228.0, 0.0, -9.0}, {-1, 0, 0, 0, 1, -57976.0, -63.0, -189.0, 31429.0, 0.0, -75.0}, {-1, 0, 2, 2, 2, -59641.0, -11.0, 149.0, 25543.0,-11.0, 66.0}, { 1, 0, 2, 0, 1, -51613.0, -42.0, 129.0, 26366.0, 0.0, 78.0}, {-2, 0, 2, 0, 1, 45893.0, 50.0, 31.0, -24236.0,-10.0, 20.0}, { 0, 0, 0, 2, 0, 63384.0, 11.0, -150.0, -1220.0, 0.0, 29.0}, { 0, 0, 2, 2, 2, -38571.0, -1.0, 158.0, 16452.0,-11.0, 68.0}, /* 21-30 */ { 0,-2, 2,-2, 2, 32481.0, 0.0, 0.0, -13870.0, 0.0, 0.0}, {-2, 0, 0, 2, 0, -47722.0, 0.0, -18.0, 477.0, 0.0, -25.0}, { 2, 0, 2, 0, 2, -31046.0, -1.0, 131.0, 13238.0,-11.0, 59.0}, { 1, 0, 2,-2, 2, 28593.0, 0.0, -1.0, -12338.0, 10.0, -3.0}, {-1, 0, 2, 0, 1, 20441.0, 21.0, 10.0, -10758.0, 0.0, -3.0}, { 2, 0, 0, 0, 0, 29243.0, 0.0, -74.0, -609.0, 0.0, 13.0}, { 0, 0, 2, 0, 0, 25887.0, 0.0, -66.0, -550.0, 0.0, 11.0}, { 0, 1, 0, 0, 1, -14053.0, -25.0, 79.0, 8551.0, -2.0, -45.0}, {-1, 0, 0, 2, 1, 15164.0, 10.0, 11.0, -8001.0, 0.0, -1.0}, { 0, 2, 2,-2, 2, -15794.0, 72.0, -16.0, 6850.0,-42.0, -5.0}, /* 31-40 */ { 0, 0,-2, 2, 0, 21783.0, 0.0, 13.0, -167.0, 0.0, 13.0}, { 1, 0, 0,-2, 1, -12873.0, -10.0, -37.0, 6953.0, 0.0, -14.0}, { 0,-1, 0, 0, 1, -12654.0, 11.0, 63.0, 6415.0, 0.0, 26.0}, {-1, 0, 2, 2, 1, -10204.0, 0.0, 25.0, 5222.0, 0.0, 15.0}, { 0, 2, 0, 0, 0, 16707.0, -85.0, -10.0, 168.0, -1.0, 10.0}, { 1, 0, 2, 2, 2, -7691.0, 0.0, 44.0, 3268.0, 0.0, 19.0}, {-2, 0, 2, 0, 0, -11024.0, 0.0, -14.0, 104.0, 0.0, 2.0}, { 0, 1, 2, 0, 2, 7566.0, -21.0, -11.0, -3250.0, 0.0, -5.0}, { 0, 0, 2, 2, 1, -6637.0, -11.0, 25.0, 3353.0, 0.0, 14.0}, { 0,-1, 2, 0, 2, -7141.0, 21.0, 8.0, 3070.0, 0.0, 4.0}, /* 41-50 */ { 0, 0, 0, 2, 1, -6302.0, -11.0, 2.0, 3272.0, 0.0, 4.0}, { 1, 0, 2,-2, 1, 5800.0, 10.0, 2.0, -3045.0, 0.0, -1.0}, { 2, 0, 2,-2, 2, 6443.0, 0.0, -7.0, -2768.0, 0.0, -4.0}, {-2, 0, 0, 2, 1, -5774.0, -11.0, -15.0, 3041.0, 0.0, -5.0}, { 2, 0, 2, 0, 1, -5350.0, 0.0, 21.0, 2695.0, 0.0, 12.0}, { 0,-1, 2,-2, 1, -4752.0, -11.0, -3.0, 2719.0, 0.0, -3.0}, { 0, 0, 0,-2, 1, -4940.0, -11.0, -21.0, 2720.0, 0.0, -9.0}, {-1,-1, 0, 2, 0, 7350.0, 0.0, -8.0, -51.0, 0.0, 4.0}, { 2, 0, 0,-2, 1, 4065.0, 0.0, 6.0, -2206.0, 0.0, 1.0}, { 1, 0, 0, 2, 0, 6579.0, 0.0, -24.0, -199.0, 0.0, 2.0}, /* 51-60 */ { 0, 1, 2,-2, 1, 3579.0, 0.0, 5.0, -1900.0, 0.0, 1.0}, { 1,-1, 0, 0, 0, 4725.0, 0.0, -6.0, -41.0, 0.0, 3.0}, {-2, 0, 2, 0, 2, -3075.0, 0.0, -2.0, 1313.0, 0.0, -1.0}, { 3, 0, 2, 0, 2, -2904.0, 0.0, 15.0, 1233.0, 0.0, 7.0}, { 0,-1, 0, 2, 0, 4348.0, 0.0, -10.0, -81.0, 0.0, 2.0}, { 1,-1, 2, 0, 2, -2878.0, 0.0, 8.0, 1232.0, 0.0, 4.0}, { 0, 0, 0, 1, 0, -4230.0, 0.0, 5.0, -20.0, 0.0, -2.0}, {-1,-1, 2, 2, 2, -2819.0, 0.0, 7.0, 1207.0, 0.0, 3.0}, {-1, 0, 2, 0, 0, -4056.0, 0.0, 5.0, 40.0, 0.0, -2.0}, { 0,-1, 2, 2, 2, -2647.0, 0.0, 11.0, 1129.0, 0.0, 5.0}, /* 61-70 */ {-2, 0, 0, 0, 1, -2294.0, 0.0, -10.0, 1266.0, 0.0, -4.0}, { 1, 1, 2, 0, 2, 2481.0, 0.0, -7.0, -1062.0, 0.0, -3.0}, { 2, 0, 0, 0, 1, 2179.0, 0.0, -2.0, -1129.0, 0.0, -2.0}, {-1, 1, 0, 1, 0, 3276.0, 0.0, 1.0, -9.0, 0.0, 0.0}, { 1, 1, 0, 0, 0, -3389.0, 0.0, 5.0, 35.0, 0.0, -2.0}, { 1, 0, 2, 0, 0, 3339.0, 0.0, -13.0, -107.0, 0.0, 1.0}, {-1, 0, 2,-2, 1, -1987.0, 0.0, -6.0, 1073.0, 0.0, -2.0}, { 1, 0, 0, 0, 2, -1981.0, 0.0, 0.0, 854.0, 0.0, 0.0}, {-1, 0, 0, 1, 0, 4026.0, 0.0, -353.0, -553.0, 0.0, -139.0}, { 0, 0, 2, 1, 2, 1660.0, 0.0, -5.0, -710.0, 0.0, -2.0}, /* 71-80 */ {-1, 0, 2, 4, 2, -1521.0, 0.0, 9.0, 647.0, 0.0, 4.0}, {-1, 1, 0, 1, 1, 1314.0, 0.0, 0.0, -700.0, 0.0, 0.0}, { 0,-2, 2,-2, 1, -1283.0, 0.0, 0.0, 672.0, 0.0, 0.0}, { 1, 0, 2, 2, 1, -1331.0, 0.0, 8.0, 663.0, 0.0, 4.0}, {-2, 0, 2, 2, 2, 1383.0, 0.0, -2.0, -594.0, 0.0, -2.0}, {-1, 0, 0, 0, 2, 1405.0, 0.0, 4.0, -610.0, 0.0, 2.0}, { 1, 1, 2,-2, 2, 1290.0, 0.0, 0.0, -556.0, 0.0, 0.0}, {-2, 0, 2, 4, 2, -1214.0, 0.0, 5.0, 518.0, 0.0, 2.0}, {-1, 0, 4, 0, 2, 1146.0, 0.0, -3.0, -490.0, 0.0, -1.0}, { 2, 0, 2,-2, 1, 1019.0, 0.0, -1.0, -527.0, 0.0, -1.0}, /* 81-90 */ { 2, 0, 2, 2, 2, -1100.0, 0.0, 9.0, 465.0, 0.0, 4.0}, { 1, 0, 0, 2, 1, -970.0, 0.0, 2.0, 496.0, 0.0, 1.0}, { 3, 0, 0, 0, 0, 1575.0, 0.0, -6.0, -50.0, 0.0, 0.0}, { 3, 0, 2,-2, 2, 934.0, 0.0, -3.0, -399.0, 0.0, -1.0}, { 0, 0, 4,-2, 2, 922.0, 0.0, -1.0, -395.0, 0.0, -1.0}, { 0, 1, 2, 0, 1, 815.0, 0.0, -1.0, -422.0, 0.0, -1.0}, { 0, 0,-2, 2, 1, 834.0, 0.0, 2.0, -440.0, 0.0, 1.0}, { 0, 0, 2,-2, 3, 1248.0, 0.0, 0.0, -170.0, 0.0, 1.0}, {-1, 0, 0, 4, 0, 1338.0, 0.0, -5.0, -39.0, 0.0, 0.0}, { 2, 0,-2, 0, 1, 716.0, 0.0, -2.0, -389.0, 0.0, -1.0}, /* 91-100 */ {-2, 0, 0, 4, 0, 1282.0, 0.0, -3.0, -23.0, 0.0, 1.0}, {-1,-1, 0, 2, 1, 742.0, 0.0, 1.0, -391.0, 0.0, 0.0}, {-1, 0, 0, 1, 1, 1020.0, 0.0, -25.0, -495.0, 0.0, -10.0}, { 0, 1, 0, 0, 2, 715.0, 0.0, -4.0, -326.0, 0.0, 2.0}, { 0, 0,-2, 0, 1, -666.0, 0.0, -3.0, 369.0, 0.0, -1.0}, { 0,-1, 2, 0, 1, -667.0, 0.0, 1.0, 346.0, 0.0, 1.0}, { 0, 0, 2,-1, 2, -704.0, 0.0, 0.0, 304.0, 0.0, 0.0}, { 0, 0, 2, 4, 2, -694.0, 0.0, 5.0, 294.0, 0.0, 2.0}, {-2,-1, 0, 2, 0, -1014.0, 0.0, -1.0, 4.0, 0.0, -1.0}, { 1, 1, 0,-2, 1, -585.0, 0.0, -2.0, 316.0, 0.0, -1.0}, /* 101-110 */ {-1, 1, 0, 2, 0, -949.0, 0.0, 1.0, 8.0, 0.0, -1.0}, {-1, 1, 0, 1, 2, -595.0, 0.0, 0.0, 258.0, 0.0, 0.0}, { 1,-1, 0, 0, 1, 528.0, 0.0, 0.0, -279.0, 0.0, 0.0}, { 1,-1, 2, 2, 2, -590.0, 0.0, 4.0, 252.0, 0.0, 2.0}, {-1, 1, 2, 2, 2, 570.0, 0.0, -2.0, -244.0, 0.0, -1.0}, { 3, 0, 2, 0, 1, -502.0, 0.0, 3.0, 250.0, 0.0, 2.0}, { 0, 1,-2, 2, 0, -875.0, 0.0, 1.0, 29.0, 0.0, 0.0}, {-1, 0, 0,-2, 1, -492.0, 0.0, -3.0, 275.0, 0.0, -1.0}, { 0, 1, 2, 2, 2, 535.0, 0.0, -2.0, -228.0, 0.0, -1.0}, {-1,-1, 2, 2, 1, -467.0, 0.0, 1.0, 240.0, 0.0, 1.0}, /* 111-120 */ { 0,-1, 0, 0, 2, 591.0, 0.0, 0.0, -253.0, 0.0, 0.0}, { 1, 0, 2,-4, 1, -453.0, 0.0, -1.0, 244.0, 0.0, -1.0}, {-1, 0,-2, 2, 0, 766.0, 0.0, 1.0, 9.0, 0.0, 0.0}, { 0,-1, 2, 2, 1, -446.0, 0.0, 2.0, 225.0, 0.0, 1.0}, { 2,-1, 2, 0, 2, -488.0, 0.0, 2.0, 207.0, 0.0, 1.0}, { 0, 0, 0, 2, 2, -468.0, 0.0, 0.0, 201.0, 0.0, 0.0}, { 1,-1, 2, 0, 1, -421.0, 0.0, 1.0, 216.0, 0.0, 1.0}, {-1, 1, 2, 0, 2, 463.0, 0.0, 0.0, -200.0, 0.0, 0.0}, { 0, 1, 0, 2, 0, -673.0, 0.0, 2.0, 14.0, 0.0, 0.0}, { 0,-1,-2, 2, 0, 658.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 121-130 */ { 0, 3, 2,-2, 2, -438.0, 0.0, 0.0, 188.0, 0.0, 0.0}, { 0, 0, 0, 1, 1, -390.0, 0.0, 0.0, 205.0, 0.0, 0.0}, {-1, 0, 2, 2, 0, 639.0, -11.0, -2.0, -19.0, 0.0, 0.0}, { 2, 1, 2, 0, 2, 412.0, 0.0, -2.0, -176.0, 0.0, -1.0}, { 1, 1, 0, 0, 1, -361.0, 0.0, 0.0, 189.0, 0.0, 0.0}, { 1, 1, 2, 0, 1, 360.0, 0.0, -1.0, -185.0, 0.0, -1.0}, { 2, 0, 0, 2, 0, 588.0, 0.0, -3.0, -24.0, 0.0, 0.0}, { 1, 0,-2, 2, 0, -578.0, 0.0, 1.0, 5.0, 0.0, 0.0}, {-1, 0, 0, 2, 2, -396.0, 0.0, 0.0, 171.0, 0.0, 0.0}, { 0, 1, 0, 1, 0, 565.0, 0.0, -1.0, -6.0, 0.0, 0.0}, /* 131-140 */ { 0, 1, 0,-2, 1, -335.0, 0.0, -1.0, 184.0, 0.0, -1.0}, {-1, 0, 2,-2, 2, 357.0, 0.0, 1.0, -154.0, 0.0, 0.0}, { 0, 0, 0,-1, 1, 321.0, 0.0, 1.0, -174.0, 0.0, 0.0}, {-1, 1, 0, 0, 1, -301.0, 0.0, -1.0, 162.0, 0.0, 0.0}, { 1, 0, 2,-1, 2, -334.0, 0.0, 0.0, 144.0, 0.0, 0.0}, { 1,-1, 0, 2, 0, 493.0, 0.0, -2.0, -15.0, 0.0, 0.0}, { 0, 0, 0, 4, 0, 494.0, 0.0, -2.0, -19.0, 0.0, 0.0}, { 1, 0, 2, 1, 2, 337.0, 0.0, -1.0, -143.0, 0.0, -1.0}, { 0, 0, 2, 1, 1, 280.0, 0.0, -1.0, -144.0, 0.0, 0.0}, { 1, 0, 0,-2, 2, 309.0, 0.0, 1.0, -134.0, 0.0, 0.0}, /* 141-150 */ {-1, 0, 2, 4, 1, -263.0, 0.0, 2.0, 131.0, 0.0, 1.0}, { 1, 0,-2, 0, 1, 253.0, 0.0, 1.0, -138.0, 0.0, 0.0}, { 1, 1, 2,-2, 1, 245.0, 0.0, 0.0, -128.0, 0.0, 0.0}, { 0, 0, 2, 2, 0, 416.0, 0.0, -2.0, -17.0, 0.0, 0.0}, {-1, 0, 2,-1, 1, -229.0, 0.0, 0.0, 128.0, 0.0, 0.0}, {-2, 0, 2, 2, 1, 231.0, 0.0, 0.0, -120.0, 0.0, 0.0}, { 4, 0, 2, 0, 2, -259.0, 0.0, 2.0, 109.0, 0.0, 1.0}, { 2,-1, 0, 0, 0, 375.0, 0.0, -1.0, -8.0, 0.0, 0.0}, { 2, 1, 2,-2, 2, 252.0, 0.0, 0.0, -108.0, 0.0, 0.0}, { 0, 1, 2, 1, 2, -245.0, 0.0, 1.0, 104.0, 0.0, 0.0}, /* 151-160 */ { 1, 0, 4,-2, 2, 243.0, 0.0, -1.0, -104.0, 0.0, 0.0}, {-1,-1, 0, 0, 1, 208.0, 0.0, 1.0, -112.0, 0.0, 0.0}, { 0, 1, 0, 2, 1, 199.0, 0.0, 0.0, -102.0, 0.0, 0.0}, {-2, 0, 2, 4, 1, -208.0, 0.0, 1.0, 105.0, 0.0, 0.0}, { 2, 0, 2, 0, 0, 335.0, 0.0, -2.0, -14.0, 0.0, 0.0}, { 1, 0, 0, 1, 0, -325.0, 0.0, 1.0, 7.0, 0.0, 0.0}, {-1, 0, 0, 4, 1, -187.0, 0.0, 0.0, 96.0, 0.0, 0.0}, {-1, 0, 4, 0, 1, 197.0, 0.0, -1.0, -100.0, 0.0, 0.0}, { 2, 0, 2, 2, 1, -192.0, 0.0, 2.0, 94.0, 0.0, 1.0}, { 0, 0, 2,-3, 2, -188.0, 0.0, 0.0, 83.0, 0.0, 0.0}, /* 161-170 */ {-1,-2, 0, 2, 0, 276.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 1, 0, 0, 0, -286.0, 0.0, 1.0, 6.0, 0.0, 0.0}, { 0, 0, 4, 0, 2, 186.0, 0.0, -1.0, -79.0, 0.0, 0.0}, { 0, 0, 0, 0, 3, -219.0, 0.0, 0.0, 43.0, 0.0, 0.0}, { 0, 3, 0, 0, 0, 276.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 2,-4, 1, -153.0, 0.0, -1.0, 84.0, 0.0, 0.0}, { 0,-1, 0, 2, 1, -156.0, 0.0, 0.0, 81.0, 0.0, 0.0}, { 0, 0, 0, 4, 1, -154.0, 0.0, 1.0, 78.0, 0.0, 0.0}, {-1,-1, 2, 4, 2, -174.0, 0.0, 1.0, 75.0, 0.0, 0.0}, { 1, 0, 2, 4, 2, -163.0, 0.0, 2.0, 69.0, 0.0, 1.0}, /* 171-180 */ {-2, 2, 0, 2, 0, -228.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-2,-1, 2, 0, 1, 91.0, 0.0, -4.0, -54.0, 0.0, -2.0}, {-2, 0, 0, 2, 2, 175.0, 0.0, 0.0, -75.0, 0.0, 0.0}, {-1,-1, 2, 0, 2, -159.0, 0.0, 0.0, 69.0, 0.0, 0.0}, { 0, 0, 4,-2, 1, 141.0, 0.0, 0.0, -72.0, 0.0, 0.0}, { 3, 0, 2,-2, 1, 147.0, 0.0, 0.0, -75.0, 0.0, 0.0}, {-2,-1, 0, 2, 1, -132.0, 0.0, 0.0, 69.0, 0.0, 0.0}, { 1, 0, 0,-1, 1, 159.0, 0.0, -28.0, -54.0, 0.0, 11.0}, { 0,-2, 0, 2, 0, 213.0, 0.0, 0.0, -4.0, 0.0, 0.0}, {-2, 0, 0, 4, 1, 123.0, 0.0, 0.0, -64.0, 0.0, 0.0}, /* 181-190 */ {-3, 0, 0, 0, 1, -118.0, 0.0, -1.0, 66.0, 0.0, 0.0}, { 1, 1, 2, 2, 2, 144.0, 0.0, -1.0, -61.0, 0.0, 0.0}, { 0, 0, 2, 4, 1, -121.0, 0.0, 1.0, 60.0, 0.0, 0.0}, { 3, 0, 2, 2, 2, -134.0, 0.0, 1.0, 56.0, 0.0, 1.0}, {-1, 1, 2,-2, 1, -105.0, 0.0, 0.0, 57.0, 0.0, 0.0}, { 2, 0, 0,-4, 1, -102.0, 0.0, 0.0, 56.0, 0.0, 0.0}, { 0, 0, 0,-2, 2, 120.0, 0.0, 0.0, -52.0, 0.0, 0.0}, { 2, 0, 2,-4, 1, 101.0, 0.0, 0.0, -54.0, 0.0, 0.0}, {-1, 1, 0, 2, 1, -113.0, 0.0, 0.0, 59.0, 0.0, 0.0}, { 0, 0, 2,-1, 1, -106.0, 0.0, 0.0, 61.0, 0.0, 0.0}, /* 191-200 */ { 0,-2, 2, 2, 2, -129.0, 0.0, 1.0, 55.0, 0.0, 0.0}, { 2, 0, 0, 2, 1, -114.0, 0.0, 0.0, 57.0, 0.0, 0.0}, { 4, 0, 2,-2, 2, 113.0, 0.0, -1.0, -49.0, 0.0, 0.0}, { 2, 0, 0,-2, 2, -102.0, 0.0, 0.0, 44.0, 0.0, 0.0}, { 0, 2, 0, 0, 1, -94.0, 0.0, 0.0, 51.0, 0.0, 0.0}, { 1, 0, 0,-4, 1, -100.0, 0.0, -1.0, 56.0, 0.0, 0.0}, { 0, 2, 2,-2, 1, 87.0, 0.0, 0.0, -47.0, 0.0, 0.0}, {-3, 0, 0, 4, 0, 161.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-1, 1, 2, 0, 1, 96.0, 0.0, 0.0, -50.0, 0.0, 0.0}, {-1,-1, 0, 4, 0, 151.0, 0.0, -1.0, -5.0, 0.0, 0.0}, /* 201-210 */ {-1,-2, 2, 2, 2, -104.0, 0.0, 0.0, 44.0, 0.0, 0.0}, {-2,-1, 2, 4, 2, -110.0, 0.0, 0.0, 48.0, 0.0, 0.0}, { 1,-1, 2, 2, 1, -100.0, 0.0, 1.0, 50.0, 0.0, 0.0}, {-2, 1, 0, 2, 0, 92.0, 0.0, -5.0, 12.0, 0.0, -2.0}, {-2, 1, 2, 0, 1, 82.0, 0.0, 0.0, -45.0, 0.0, 0.0}, { 2, 1, 0,-2, 1, 82.0, 0.0, 0.0, -45.0, 0.0, 0.0}, {-3, 0, 2, 0, 1, -78.0, 0.0, 0.0, 41.0, 0.0, 0.0}, {-2, 0, 2,-2, 1, -77.0, 0.0, 0.0, 43.0, 0.0, 0.0}, {-1, 1, 0, 2, 2, 2.0, 0.0, 0.0, 54.0, 0.0, 0.0}, { 0,-1, 2,-1, 2, 94.0, 0.0, 0.0, -40.0, 0.0, 0.0}, /* 211-220 */ {-1, 0, 4,-2, 2, -93.0, 0.0, 0.0, 40.0, 0.0, 0.0}, { 0,-2, 2, 0, 2, -83.0, 0.0, 10.0, 40.0, 0.0, -2.0}, {-1, 0, 2, 1, 2, 83.0, 0.0, 0.0, -36.0, 0.0, 0.0}, { 2, 0, 0, 0, 2, -91.0, 0.0, 0.0, 39.0, 0.0, 0.0}, { 0, 0, 2, 0, 3, 128.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-2, 0, 4, 0, 2, -79.0, 0.0, 0.0, 34.0, 0.0, 0.0}, {-1, 0,-2, 0, 1, -83.0, 0.0, 0.0, 47.0, 0.0, 0.0}, {-1, 1, 2, 2, 1, 84.0, 0.0, 0.0, -44.0, 0.0, 0.0}, { 3, 0, 0, 0, 1, 83.0, 0.0, 0.0, -43.0, 0.0, 0.0}, {-1, 0, 2, 3, 2, 91.0, 0.0, 0.0, -39.0, 0.0, 0.0}, /* 221-230 */ { 2,-1, 2, 0, 1, -77.0, 0.0, 0.0, 39.0, 0.0, 0.0}, { 0, 1, 2, 2, 1, 84.0, 0.0, 0.0, -43.0, 0.0, 0.0}, { 0,-1, 2, 4, 2, -92.0, 0.0, 1.0, 39.0, 0.0, 0.0}, { 2,-1, 2, 2, 2, -92.0, 0.0, 1.0, 39.0, 0.0, 0.0}, { 0, 2,-2, 2, 0, -94.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 2,-1, 1, 68.0, 0.0, 0.0, -36.0, 0.0, 0.0}, { 0,-2, 0, 0, 1, -61.0, 0.0, 0.0, 32.0, 0.0, 0.0}, { 1, 0, 2,-4, 2, 71.0, 0.0, 0.0, -31.0, 0.0, 0.0}, { 1,-1, 0,-2, 1, 62.0, 0.0, 0.0, -34.0, 0.0, 0.0}, {-1,-1, 2, 0, 1, -63.0, 0.0, 0.0, 33.0, 0.0, 0.0}, /* 231-240 */ { 1,-1, 2,-2, 2, -73.0, 0.0, 0.0, 32.0, 0.0, 0.0}, {-2,-1, 0, 4, 0, 115.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 0, 0, 3, 0, -103.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2,-1, 2, 2, 2, 63.0, 0.0, 0.0, -28.0, 0.0, 0.0}, { 0, 2, 2, 0, 2, 74.0, 0.0, 0.0, -32.0, 0.0, 0.0}, { 1, 1, 0, 2, 0, -103.0, 0.0, -3.0, 3.0, 0.0, -1.0}, { 2, 0, 2,-1, 2, -69.0, 0.0, 0.0, 30.0, 0.0, 0.0}, { 1, 0, 2, 1, 1, 57.0, 0.0, 0.0, -29.0, 0.0, 0.0}, { 4, 0, 0, 0, 0, 94.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 2, 1, 2, 0, 1, 64.0, 0.0, 0.0, -33.0, 0.0, 0.0}, /* 241-250 */ { 3,-1, 2, 0, 2, -63.0, 0.0, 0.0, 26.0, 0.0, 0.0}, {-2, 2, 0, 2, 1, -38.0, 0.0, 0.0, 20.0, 0.0, 0.0}, { 1, 0, 2,-3, 1, -43.0, 0.0, 0.0, 24.0, 0.0, 0.0}, { 1, 1, 2,-4, 1, -45.0, 0.0, 0.0, 23.0, 0.0, 0.0}, {-1,-1, 2,-2, 1, 47.0, 0.0, 0.0, -24.0, 0.0, 0.0}, { 0,-1, 0,-1, 1, -48.0, 0.0, 0.0, 25.0, 0.0, 0.0}, { 0,-1, 0,-2, 1, 45.0, 0.0, 0.0, -26.0, 0.0, 0.0}, {-2, 0, 0, 0, 2, 56.0, 0.0, 0.0, -25.0, 0.0, 0.0}, {-2, 0,-2, 2, 0, 88.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 0,-2, 4, 0, -75.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 251-260 */ { 1,-2, 0, 0, 0, 85.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 0, 1, 1, 49.0, 0.0, 0.0, -26.0, 0.0, 0.0}, {-1, 2, 0, 2, 0, -74.0, 0.0, -3.0, -1.0, 0.0, -1.0}, { 1,-1, 2,-2, 1, -39.0, 0.0, 0.0, 21.0, 0.0, 0.0}, { 1, 2, 2,-2, 2, 45.0, 0.0, 0.0, -20.0, 0.0, 0.0}, { 2,-1, 2,-2, 2, 51.0, 0.0, 0.0, -22.0, 0.0, 0.0}, { 1, 0, 2,-1, 1, -40.0, 0.0, 0.0, 21.0, 0.0, 0.0}, { 2, 1, 2,-2, 1, 41.0, 0.0, 0.0, -21.0, 0.0, 0.0}, {-2, 0, 0,-2, 1, -42.0, 0.0, 0.0, 24.0, 0.0, 0.0}, { 1,-2, 2, 0, 2, -51.0, 0.0, 0.0, 22.0, 0.0, 0.0}, /* 261-270 */ { 0, 1, 2, 1, 1, -42.0, 0.0, 0.0, 22.0, 0.0, 0.0}, { 1, 0, 4,-2, 1, 39.0, 0.0, 0.0, -21.0, 0.0, 0.0}, {-2, 0, 4, 2, 2, 46.0, 0.0, 0.0, -18.0, 0.0, 0.0}, { 1, 1, 2, 1, 2, -53.0, 0.0, 0.0, 22.0, 0.0, 0.0}, { 1, 0, 0, 4, 0, 82.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 1, 0, 2, 2, 0, 81.0, 0.0, -1.0, -4.0, 0.0, 0.0}, { 2, 0, 2, 1, 2, 47.0, 0.0, 0.0, -19.0, 0.0, 0.0}, { 3, 1, 2, 0, 2, 53.0, 0.0, 0.0, -23.0, 0.0, 0.0}, { 4, 0, 2, 0, 1, -45.0, 0.0, 0.0, 22.0, 0.0, 0.0}, {-2,-1, 2, 0, 0, -44.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 271-280 */ { 0, 1,-2, 2, 1, -33.0, 0.0, 0.0, 16.0, 0.0, 0.0}, { 1, 0,-2, 1, 0, -61.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 0,-1,-2, 2, 1, 28.0, 0.0, 0.0, -15.0, 0.0, 0.0}, { 2,-1, 0,-2, 1, -38.0, 0.0, 0.0, 19.0, 0.0, 0.0}, {-1, 0, 2,-1, 2, -33.0, 0.0, 0.0, 21.0, 0.0, 0.0}, { 1, 0, 2,-3, 2, -60.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 2,-2, 3, 48.0, 0.0, 0.0, -10.0, 0.0, 0.0}, { 0, 0, 2,-3, 1, 27.0, 0.0, 0.0, -14.0, 0.0, 0.0}, {-1, 0,-2, 2, 1, 38.0, 0.0, 0.0, -20.0, 0.0, 0.0}, { 0, 0, 2,-4, 2, 31.0, 0.0, 0.0, -13.0, 0.0, 0.0}, /* 281-290 */ {-2, 1, 0, 0, 1, -29.0, 0.0, 0.0, 15.0, 0.0, 0.0}, {-1, 0, 0,-1, 1, 28.0, 0.0, 0.0, -15.0, 0.0, 0.0}, { 2, 0, 2,-4, 2, -32.0, 0.0, 0.0, 15.0, 0.0, 0.0}, { 0, 0, 4,-4, 4, 45.0, 0.0, 0.0, -8.0, 0.0, 0.0}, { 0, 0, 4,-4, 2, -44.0, 0.0, 0.0, 19.0, 0.0, 0.0}, {-1,-2, 0, 2, 1, 28.0, 0.0, 0.0, -15.0, 0.0, 0.0}, {-2, 0, 0, 3, 0, -51.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0,-2, 2, 1, -36.0, 0.0, 0.0, 20.0, 0.0, 0.0}, {-3, 0, 2, 2, 2, 44.0, 0.0, 0.0, -19.0, 0.0, 0.0}, {-3, 0, 2, 2, 1, 26.0, 0.0, 0.0, -14.0, 0.0, 0.0}, /* 291-300 */ {-2, 0, 2, 2, 0, -60.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2,-1, 0, 0, 1, 35.0, 0.0, 0.0, -18.0, 0.0, 0.0}, {-2, 1, 2, 2, 2, -27.0, 0.0, 0.0, 11.0, 0.0, 0.0}, { 1, 1, 0, 1, 0, 47.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0, 1, 4,-2, 2, 36.0, 0.0, 0.0, -15.0, 0.0, 0.0}, {-1, 1, 0,-2, 1, -36.0, 0.0, 0.0, 20.0, 0.0, 0.0}, { 0, 0, 0,-4, 1, -35.0, 0.0, 0.0, 19.0, 0.0, 0.0}, { 1,-1, 0, 2, 1, -37.0, 0.0, 0.0, 19.0, 0.0, 0.0}, { 1, 1, 0, 2, 1, 32.0, 0.0, 0.0, -16.0, 0.0, 0.0}, {-1, 2, 2, 2, 2, 35.0, 0.0, 0.0, -14.0, 0.0, 0.0}, /* 301-310 */ { 3, 1, 2,-2, 2, 32.0, 0.0, 0.0, -13.0, 0.0, 0.0}, { 0,-1, 0, 4, 0, 65.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2,-1, 0, 2, 0, 47.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0, 0, 4, 0, 1, 32.0, 0.0, 0.0, -16.0, 0.0, 0.0}, { 2, 0, 4,-2, 2, 37.0, 0.0, 0.0, -16.0, 0.0, 0.0}, {-1,-1, 2, 4, 1, -30.0, 0.0, 0.0, 15.0, 0.0, 0.0}, { 1, 0, 0, 4, 1, -32.0, 0.0, 0.0, 16.0, 0.0, 0.0}, { 1,-2, 2, 2, 2, -31.0, 0.0, 0.0, 13.0, 0.0, 0.0}, { 0, 0, 2, 3, 2, 37.0, 0.0, 0.0, -16.0, 0.0, 0.0}, {-1, 1, 2, 4, 2, 31.0, 0.0, 0.0, -13.0, 0.0, 0.0}, /* 311-320 */ { 3, 0, 0, 2, 0, 49.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 0, 4, 2, 2, 32.0, 0.0, 0.0, -13.0, 0.0, 0.0}, { 1, 1, 2, 2, 1, 23.0, 0.0, 0.0, -12.0, 0.0, 0.0}, {-2, 0, 2, 6, 2, -43.0, 0.0, 0.0, 18.0, 0.0, 0.0}, { 2, 1, 2, 2, 2, 26.0, 0.0, 0.0, -11.0, 0.0, 0.0}, {-1, 0, 2, 6, 2, -32.0, 0.0, 0.0, 14.0, 0.0, 0.0}, { 1, 0, 2, 4, 1, -29.0, 0.0, 0.0, 14.0, 0.0, 0.0}, { 2, 0, 2, 4, 2, -27.0, 0.0, 0.0, 12.0, 0.0, 0.0}, { 1, 1,-2, 1, 0, 30.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3, 1, 2, 1, 2, -11.0, 0.0, 0.0, 5.0, 0.0, 0.0}, /* 321-330 */ { 2, 0,-2, 0, 2, -21.0, 0.0, 0.0, 10.0, 0.0, 0.0}, {-1, 0, 0, 1, 2, -34.0, 0.0, 0.0, 15.0, 0.0, 0.0}, {-4, 0, 2, 2, 1, -10.0, 0.0, 0.0, 6.0, 0.0, 0.0}, {-1,-1, 0, 1, 0, -36.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0,-2, 2, 2, -9.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 1, 0, 0,-1, 2, -12.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 0,-1, 2,-2, 3, -21.0, 0.0, 0.0, 5.0, 0.0, 0.0}, {-2, 1, 2, 0, 0, -29.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0, 0, 2,-2, 4, -15.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-2,-2, 0, 2, 0, -20.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 331-340 */ {-2, 0,-2, 4, 0, 28.0, 0.0, 0.0, 0.0, 0.0, -2.0}, { 0,-2,-2, 2, 0, 17.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 2, 0,-2, 1, -22.0, 0.0, 0.0, 12.0, 0.0, 0.0}, { 3, 0, 0,-4, 1, -14.0, 0.0, 0.0, 7.0, 0.0, 0.0}, {-1, 1, 2,-2, 2, 24.0, 0.0, 0.0, -11.0, 0.0, 0.0}, { 1,-1, 2,-4, 1, 11.0, 0.0, 0.0, -6.0, 0.0, 0.0}, { 1, 1, 0,-2, 2, 14.0, 0.0, 0.0, -6.0, 0.0, 0.0}, {-3, 0, 2, 0, 0, 24.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3, 0, 2, 0, 2, 18.0, 0.0, 0.0, -8.0, 0.0, 0.0}, {-2, 0, 0, 1, 0, -38.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 341-350 */ { 0, 0,-2, 1, 0, -31.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3, 0, 0, 2, 1, -16.0, 0.0, 0.0, 8.0, 0.0, 0.0}, {-1,-1,-2, 2, 0, 29.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 2,-4, 1, -18.0, 0.0, 0.0, 10.0, 0.0, 0.0}, { 2, 1, 0,-4, 1, -10.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 0, 2, 0,-2, 1, -17.0, 0.0, 0.0, 10.0, 0.0, 0.0}, { 1, 0, 0,-3, 1, 9.0, 0.0, 0.0, -4.0, 0.0, 0.0}, {-2, 0, 2,-2, 2, 16.0, 0.0, 0.0, -6.0, 0.0, 0.0}, {-2,-1, 0, 0, 1, 22.0, 0.0, 0.0, -12.0, 0.0, 0.0}, {-4, 0, 0, 2, 0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 351-360 */ { 1, 1, 0,-4, 1, -13.0, 0.0, 0.0, 6.0, 0.0, 0.0}, {-1, 0, 2,-4, 1, -17.0, 0.0, 0.0, 9.0, 0.0, 0.0}, { 0, 0, 4,-4, 1, -14.0, 0.0, 0.0, 8.0, 0.0, 0.0}, { 0, 3, 2,-2, 2, 0.0, 0.0, 0.0, -7.0, 0.0, 0.0}, {-3,-1, 0, 4, 0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3, 0, 0, 4, 1, 19.0, 0.0, 0.0, -10.0, 0.0, 0.0}, { 1,-1,-2, 2, 0, -34.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 0, 2, 2, -20.0, 0.0, 0.0, 8.0, 0.0, 0.0}, { 1,-2, 0, 0, 1, 9.0, 0.0, 0.0, -5.0, 0.0, 0.0}, { 1,-1, 0, 0, 2, -18.0, 0.0, 0.0, 7.0, 0.0, 0.0}, /* 361-370 */ { 0, 0, 0, 1, 2, 13.0, 0.0, 0.0, -6.0, 0.0, 0.0}, {-1,-1, 2, 0, 0, 17.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1,-2, 2,-2, 2, -12.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 0,-1, 2,-1, 1, 15.0, 0.0, 0.0, -8.0, 0.0, 0.0}, {-1, 0, 2, 0, 3, -11.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 1, 1, 0, 0, 2, 13.0, 0.0, 0.0, -5.0, 0.0, 0.0}, {-1, 1, 2, 0, 0, -18.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 2, 0, 0, 0, -35.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 2, 2, 0, 2, 9.0, 0.0, 0.0, -4.0, 0.0, 0.0}, {-1, 0, 4,-2, 1, -19.0, 0.0, 0.0, 10.0, 0.0, 0.0}, /* 371-380 */ { 3, 0, 2,-4, 2, -26.0, 0.0, 0.0, 11.0, 0.0, 0.0}, { 1, 2, 2,-2, 1, 8.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 1, 0, 4,-4, 2, -10.0, 0.0, 0.0, 4.0, 0.0, 0.0}, {-2,-1, 0, 4, 1, 10.0, 0.0, 0.0, -6.0, 0.0, 0.0}, { 0,-1, 0, 2, 2, -21.0, 0.0, 0.0, 9.0, 0.0, 0.0}, {-2, 1, 0, 4, 0, -15.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2,-1, 2, 2, 1, 9.0, 0.0, 0.0, -5.0, 0.0, 0.0}, { 2, 0,-2, 2, 0, -29.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 0, 1, 1, -19.0, 0.0, 0.0, 10.0, 0.0, 0.0}, { 0, 1, 0, 2, 2, 12.0, 0.0, 0.0, -5.0, 0.0, 0.0}, /* 381-390 */ { 1,-1, 2,-1, 2, 22.0, 0.0, 0.0, -9.0, 0.0, 0.0}, {-2, 0, 4, 0, 1, -10.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 2, 1, 0, 0, 1, -20.0, 0.0, 0.0, 11.0, 0.0, 0.0}, { 0, 1, 2, 0, 0, -20.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0,-1, 4,-2, 2, -17.0, 0.0, 0.0, 7.0, 0.0, 0.0}, { 0, 0, 4,-2, 4, 15.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 0, 2, 2, 0, 1, 8.0, 0.0, 0.0, -4.0, 0.0, 0.0}, {-3, 0, 0, 6, 0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 0, 4, 1, -12.0, 0.0, 0.0, 6.0, 0.0, 0.0}, { 1,-2, 0, 2, 0, 25.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 391-400 */ {-1, 0, 0, 4, 2, -13.0, 0.0, 0.0, 6.0, 0.0, 0.0}, {-1,-2, 2, 2, 1, -14.0, 0.0, 0.0, 8.0, 0.0, 0.0}, {-1, 0, 0,-2, 2, 13.0, 0.0, 0.0, -5.0, 0.0, 0.0}, { 1, 0,-2,-2, 1, -17.0, 0.0, 0.0, 9.0, 0.0, 0.0}, { 0, 0,-2,-2, 1, -12.0, 0.0, 0.0, 6.0, 0.0, 0.0}, {-2, 0,-2, 0, 1, -10.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 0, 0, 0, 3, 1, 10.0, 0.0, 0.0, -6.0, 0.0, 0.0}, { 0, 0, 0, 3, 0, -15.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 1, 0, 4, 0, -22.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 2, 2, 0, 28.0, 0.0, 0.0, -1.0, 0.0, 0.0}, /* 401-410 */ {-2, 0, 2, 3, 2, 15.0, 0.0, 0.0, -7.0, 0.0, 0.0}, { 1, 0, 0, 2, 2, 23.0, 0.0, 0.0, -10.0, 0.0, 0.0}, { 0,-1, 2, 1, 2, 12.0, 0.0, 0.0, -5.0, 0.0, 0.0}, { 3,-1, 0, 0, 0, 29.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 2, 0, 0, 1, 0, -25.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 1,-1, 2, 0, 0, 22.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0, 2, 1, 0, -18.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 2, 0, 3, 15.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 3, 1, 0, 0, 0, -23.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 3,-1, 2,-2, 2, 12.0, 0.0, 0.0, -5.0, 0.0, 0.0}, /* 411-420 */ { 2, 0, 2,-1, 1, -8.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 1, 1, 2, 0, 0, -19.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0, 4,-1, 2, -10.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 1, 2, 2, 0, 2, 21.0, 0.0, 0.0, -9.0, 0.0, 0.0}, {-2, 0, 0, 6, 0, 23.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0,-1, 0, 4, 1, -16.0, 0.0, 0.0, 8.0, 0.0, 0.0}, {-2,-1, 2, 4, 1, -19.0, 0.0, 0.0, 9.0, 0.0, 0.0}, { 0,-2, 2, 2, 1, -22.0, 0.0, 0.0, 10.0, 0.0, 0.0}, { 0,-1, 2, 2, 0, 27.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-1, 0, 2, 3, 1, 16.0, 0.0, 0.0, -8.0, 0.0, 0.0}, /* 421-430 */ {-2, 1, 2, 4, 2, 19.0, 0.0, 0.0, -8.0, 0.0, 0.0}, { 2, 0, 0, 2, 2, 9.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 2,-2, 2, 0, 2, -9.0, 0.0, 0.0, 4.0, 0.0, 0.0}, {-1, 1, 2, 3, 2, -9.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 3, 0, 2,-1, 2, -8.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 4, 0, 2,-2, 1, 18.0, 0.0, 0.0, -9.0, 0.0, 0.0}, {-1, 0, 0, 6, 0, 16.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-1,-2, 2, 4, 2, -10.0, 0.0, 0.0, 4.0, 0.0, 0.0}, {-3, 0, 2, 6, 2, -23.0, 0.0, 0.0, 9.0, 0.0, 0.0}, {-1, 0, 2, 4, 0, 16.0, 0.0, 0.0, -1.0, 0.0, 0.0}, /* 431-440 */ { 3, 0, 0, 2, 1, -12.0, 0.0, 0.0, 6.0, 0.0, 0.0}, { 3,-1, 2, 0, 1, -8.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 3, 0, 2, 0, 0, 30.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 1, 0, 4, 0, 2, 24.0, 0.0, 0.0, -10.0, 0.0, 0.0}, { 5, 0, 2,-2, 2, 10.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 0,-1, 2, 4, 1, -16.0, 0.0, 0.0, 7.0, 0.0, 0.0}, { 2,-1, 2, 2, 1, -16.0, 0.0, 0.0, 7.0, 0.0, 0.0}, { 0, 1, 2, 4, 2, 17.0, 0.0, 0.0, -7.0, 0.0, 0.0}, { 1,-1, 2, 4, 2, -24.0, 0.0, 0.0, 10.0, 0.0, 0.0}, { 3,-1, 2, 2, 2, -12.0, 0.0, 0.0, 5.0, 0.0, 0.0}, /* 441-450 */ { 3, 0, 2, 2, 1, -24.0, 0.0, 0.0, 11.0, 0.0, 0.0}, { 5, 0, 2, 0, 2, -23.0, 0.0, 0.0, 9.0, 0.0, 0.0}, { 0, 0, 2, 6, 2, -13.0, 0.0, 0.0, 5.0, 0.0, 0.0}, { 4, 0, 2, 2, 2, -15.0, 0.0, 0.0, 7.0, 0.0, 0.0}, { 0,-1, 1,-1, 1, 0.0, 0.0,-1988.0, 0.0, 0.0,-1679.0}, {-1, 0, 1, 0, 3, 0.0, 0.0, -63.0, 0.0, 0.0, -27.0}, { 0,-2, 2,-2, 3, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0,-1, 0, 1, 0.0, 0.0, 5.0, 0.0, 0.0, 4.0}, { 2,-2, 0,-2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-1, 0, 1, 0, 2, 0.0, 0.0, 364.0, 0.0, 0.0, 176.0}, /* 451-460 */ {-1, 0, 1, 0, 1, 0.0, 0.0,-1044.0, 0.0, 0.0, -891.0}, {-1,-1, 2,-1, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-2, 2, 0, 2, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 0, 1, 0, 0, 0.0, 0.0, 330.0, 0.0, 0.0, 0.0}, {-4, 1, 2, 2, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-3, 0, 2, 1, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-2,-1, 2, 0, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 1, 0,-2, 1, 1, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2,-1,-2, 0, 1, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-4, 0, 2, 2, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 461-470 */ {-3, 1, 0, 3, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 0,-1, 2, 0, 0.0, 0.0, 5.0, 0.0, 0.0, 0.0}, { 0,-2, 0, 0, 2, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 0,-2, 0, 0, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-3, 0, 0, 3, 0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2,-1, 0, 2, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 0,-2, 3, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-4, 0, 0, 4, 0, -12.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 1,-2, 0, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 2,-1, 0,-2, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, /* 471-480 */ { 0, 0, 1,-1, 0, -5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 2, 0, 1, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 1, 2, 0, 2, -7.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 1, 1, 0,-1, 1, 7.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 1, 0, 1,-2, 1, 0.0, 0.0, -12.0, 0.0, 0.0, -10.0}, { 0, 2, 0, 0, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 1,-1, 2,-3, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 1, 2,-1, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2, 0, 4,-2, 2, -7.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-2, 0, 4,-2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, /* 481-490 */ {-2,-2, 0, 2, 1, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-2, 0,-2, 4, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 2, 2,-4, 1, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 1, 1, 2,-4, 2, 7.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-1, 2, 2,-2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2, 0, 0,-3, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 2, 0, 0, 1, -5.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 0, 0, 0,-2, 0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 2,-2, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 1, 0, 0, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 491-500 */ { 0, 0, 0,-1, 2, -8.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-2, 1, 0, 1, 0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1,-2, 0,-2, 1, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 1, 0,-2, 0, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-3, 1, 0, 2, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 1,-2, 2, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 0, 0, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-3, 0, 0, 2, 0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3,-1, 0, 2, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 0, 2,-6, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, /* 501-510 */ { 0, 1, 2,-4, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 0, 0,-4, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-2, 1, 2,-2, 1, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0,-1, 2,-4, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 0, 1, 0,-2, 2, 9.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-1, 0, 0,-2, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 0,-2,-2, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-4, 0, 2, 0, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1,-1, 0,-1, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0,-2, 0, 2, 9.0, 0.0, 0.0, -3.0, 0.0, 0.0}, /* 511-520 */ {-3, 0, 0, 1, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 0,-2, 1, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 0,-2, 2, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 0, 0,-4, 2, 0, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2,-1,-2, 2, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 2,-6, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 0, 2,-4, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 1, 0, 0,-4, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 2, 1, 2,-4, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 2, 1, 2,-4, 1, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, /* 521-530 */ { 0, 1, 4,-4, 4, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 4,-4, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-1,-1,-2, 4, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-3, 0, 2, 0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 0,-2, 4, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2,-1, 0, 3, 0, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0,-2, 3, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 0, 0, 3, 1, -5.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 0,-1, 0, 1, 0, -13.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3, 0, 2, 2, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 531-540 */ { 1, 1,-2, 2, 0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 1, 0, 2, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 1,-2, 2,-2, 1, 10.0, 0.0, 13.0, 6.0, 0.0, -5.0}, { 0, 0, 1, 0, 2, 0.0, 0.0, 30.0, 0.0, 0.0, 14.0}, { 0, 0, 1, 0, 1, 0.0, 0.0, -162.0, 0.0, 0.0, -138.0}, { 0, 0, 1, 0, 0, 0.0, 0.0, 75.0, 0.0, 0.0, 0.0}, {-1, 2, 0, 2, 1, -7.0, 0.0, 0.0, 4.0, 0.0, 0.0}, { 0, 0, 2, 0, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2, 0, 2, 0, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 0, 0,-1, 1, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 541-550 */ { 3, 0, 0,-2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 1, 0, 2,-2, 3, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 2, 0, 0, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2, 0, 2,-3, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 1, 4,-2, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2,-2, 0, 4, 0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0,-3, 0, 2, 0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0,-2, 4, 0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 0, 3, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 0, 0, 4, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, /* 551-560 */ {-1, 0, 0, 3, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2,-2, 0, 0, 0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1,-1, 0, 1, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 0, 0, 2, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0,-2, 2, 0, 1, -6.0, 0.0, -3.0, 3.0, 0.0, 1.0}, {-1, 0, 1, 2, 1, 0.0, 0.0, -3.0, 0.0, 0.0, -2.0}, {-1, 1, 0, 3, 0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-1, 2, 1, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0,-1, 2, 0, 0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 1, 2, 2, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, /* 561-570 */ { 2,-2, 2,-2, 2, -1.0, 0.0, 3.0, 3.0, 0.0, -1.0}, { 1, 1, 0, 1, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 1, 0, 1, 0, 1, 0.0, 0.0, -13.0, 0.0, 0.0, -11.0}, { 1, 0, 1, 0, 0, 3.0, 0.0, 6.0, 0.0, 0.0, 0.0}, { 0, 2, 0, 2, 0, -7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2,-1, 2,-2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 0,-1, 4,-2, 1, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 0, 0, 4,-2, 3, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 4,-2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 4, 0, 2,-4, 2, -7.0, 0.0, 0.0, 3.0, 0.0, 0.0}, /* 571-580 */ { 2, 2, 2,-2, 2, 8.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 2, 0, 4,-4, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1,-2, 0, 4, 0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1,-3, 2, 2, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-3, 0, 2, 4, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-3, 0, 2,-2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1,-1, 0,-2, 1, 8.0, 0.0, 0.0, -4.0, 0.0, 0.0}, {-3, 0, 0, 0, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-3, 0,-2, 2, 0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 0,-4, 1, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, /* 581-590 */ {-2, 1, 0,-2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-4, 0, 0, 0, 1, -8.0, 0.0, 0.0, 4.0, 0.0, 0.0}, {-1, 0, 0,-4, 1, -7.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-3, 0, 0,-2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 0, 3, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-1, 1, 0, 4, 1, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 1,-2, 2, 0, 1, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 0, 1, 0, 3, 0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-1, 0, 2, 2, 3, 6.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 0, 0, 2, 2, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 591-600 */ {-2, 0, 2, 2, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 1, 2, 2, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 3, 0, 0, 0, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2, 1, 0, 1, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2,-1, 2,-1, 2, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 0, 0, 2, 0, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 3, 0, 3, 0.0, 0.0, -26.0, 0.0, 0.0, -11.0}, { 0, 0, 3, 0, 2, 0.0, 0.0, -10.0, 0.0, 0.0, -5.0}, {-1, 2, 2, 2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-1, 0, 4, 0, 0, -13.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 601-610 */ { 1, 2, 2, 0, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 3, 1, 2,-2, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 1, 1, 4,-2, 2, 7.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-2,-1, 0, 6, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0,-2, 0, 4, 0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-2, 0, 0, 6, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2,-2, 2, 4, 2, -6.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0,-3, 2, 2, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 0, 4, 2, -7.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-1,-1, 2, 3, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 611-620 */ {-2, 0, 2, 4, 0, 13.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2,-1, 0, 2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 1, 0, 0, 3, 0, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 0, 4, 1, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 0, 1, 0, 4, 0, -11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1,-1, 2, 1, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 0, 0, 2, 2, 3, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 2, 2, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-1, 0, 2, 2, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-2, 0, 4, 2, 1, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, /* 621-630 */ { 2, 1, 0, 2, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 1, 0, 2, 0, -12.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2,-1, 2, 0, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 2, 1, 0, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 1, 2, 2, 0, -4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 0, 2, 0, 3, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 3, 0, 2, 0, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 1, 0, 2, 0, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 1, 0, 3, 0, 3, 0.0, 0.0, -5.0, 0.0, 0.0, -2.0}, { 1, 1, 2, 1, 1, -7.0, 0.0, 0.0, 4.0, 0.0, 0.0}, /* 631-640 */ { 0, 2, 2, 2, 2, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 2, 1, 2, 0, 0, -3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 0, 4,-2, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 4, 1, 2,-2, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, {-1,-1, 0, 6, 0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0}, {-3,-1, 2, 6, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, {-1, 0, 0, 6, 1, -5.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-3, 0, 2, 6, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 1,-1, 0, 4, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 1,-1, 0, 4, 0, 12.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 641-650 */ {-2, 0, 2, 5, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 1,-2, 2, 2, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 3,-1, 0, 2, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1,-1, 2, 2, 0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0, 2, 3, 1, 5.0, 0.0, 0.0, -3.0, 0.0, 0.0}, {-1, 1, 2, 4, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 0, 1, 2, 3, 2, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-1, 0, 4, 2, 1, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 0, 2, 1, 1, 6.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 5, 0, 0, 0, 0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 651-660 */ { 2, 1, 2, 1, 2, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 1, 0, 4, 0, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 3, 1, 2, 0, 1, 7.0, 0.0, 0.0, -4.0, 0.0, 0.0}, { 3, 0, 4,-2, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, {-2,-1, 2, 6, 2, -5.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 0, 6, 0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0,-2, 2, 4, 2, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, {-2, 0, 2, 6, 1, -6.0, 0.0, 0.0, 3.0, 0.0, 0.0}, { 2, 0, 0, 4, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 2, 0, 0, 4, 0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0}, /* 661-670 */ { 2,-2, 2, 2, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 0, 0, 2, 4, 0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 1, 0, 2, 3, 2, 7.0, 0.0, 0.0, -3.0, 0.0, 0.0}, { 4, 0, 0, 2, 0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 2, 0, 2, 2, 0, 11.0, 0.0, 0.0, 0.0, 0.0, 0.0}, { 0, 0, 4, 2, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 4,-1, 2, 0, 2, -6.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 3, 0, 2, 1, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 2, 1, 2, 2, 1, 3.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 4, 1, 2, 0, 2, 5.0, 0.0, 0.0, -2.0, 0.0, 0.0}, /* 671-678 */ {-1,-1, 2, 6, 2, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, {-1, 0, 2, 6, 1, -4.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 1,-1, 2, 4, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0}, { 1, 1, 2, 4, 2, 4.0, 0.0, 0.0, -2.0, 0.0, 0.0}, { 3, 1, 2, 2, 2, 3.0, 0.0, 0.0, -1.0, 0.0, 0.0}, { 5, 0, 2, 0, 1, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 2,-1, 2, 4, 2, -3.0, 0.0, 0.0, 1.0, 0.0, 0.0}, { 2, 0, 2, 4, 1, -3.0, 0.0, 0.0, 2.0, 0.0, 0.0} }; /* Number of terms in the luni-solar nutation model */ const int NLS = (int) (sizeof xls / sizeof xls[0]); /* ------------------------ */ /* Planetary nutation model */ /* ------------------------ */ /* The units for the sine and cosine coefficients are */ /* 0.1 microarcsecond */ static const struct { int nl, /* coefficients of l, F, D and Omega */ nf, nd, nom, nme, /* coefficients of planetary longitudes */ nve, nea, nma, nju, nsa, nur, nne, npa; /* coefficient of general precession */ int sp,cp; /* longitude sin, cos coefficients */ int se,ce; /* obliquity sin, cos coefficients */ } xpl[] = { /* 1-10 */ { 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 0, 1440, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, -8, 16,-4,-5, 0, 0, 2, 56,-117, -42, -40}, { 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 2, 125, -43, 0, -54}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-1, 2, 2, 0, 5, 0, 0}, { 0, 0, 0, 0, 0, 0, -4, 8,-1,-5, 0, 0, 2, 3, -7, -3, 0}, { 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 1, 3, 0, 0, -2}, { 0, 1,-1, 1, 0, 0, 3, -8, 3, 0, 0, 0, 0, -114, 0, 0, 61}, {-1, 0, 0, 0, 0, 10, -3, 0, 0, 0, 0, 0, 0, -219, 89, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0,-2, 6,-3, 0, 2, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, -462,1604, 0, 0}, /* 11-20 */ { 0, 1,-1, 1, 0, 0, -5, 8,-3, 0, 0, 0, 0, 99, 0, 0, -53}, { 0, 0, 0, 0, 0, 0, -4, 8,-3, 0, 0, 0, 1, -3, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 4, -8, 1, 5, 0, 0, 2, 0, 6, 2, 0}, { 0, 0, 0, 0, 0, -5, 6, 4, 0, 0, 0, 0, 2, 3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 2,-5, 0, 0, 2, -12, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 2,-5, 0, 0, 1, 14,-218, 117, 8}, { 0, 1,-1, 1, 0, 0, -1, 0, 2,-5, 0, 0, 0, 31,-481, -257, -17}, { 0, 0, 0, 0, 0, 0, 0, 0, 2,-5, 0, 0, 0, -491, 128, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0,-2, 5, 0, 0, 0,-3084,5123, 2735,1647}, { 0, 0, 0, 0, 0, 0, 0, 0,-2, 5, 0, 0, 1,-1444,2409,-1286,-771}, /* 21-30 */ { 0, 0, 0, 0, 0, 0, 0, 0,-2, 5, 0, 0, 2, 11, -24, -11, -9}, { 2,-1,-1, 0, 0, 0, 3, -7, 0, 0, 0, 0, 0, 26, -9, 0, 0}, { 1, 0,-2, 0, 0, 19,-21, 3, 0, 0, 0, 0, 0, 103, -60, 0, 0}, { 0, 1,-1, 1, 0, 2, -4, 0,-3, 0, 0, 0, 0, 0, -13, -7, 0}, { 1, 0,-1, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0, -26, -29, -16, 14}, { 0, 1,-1, 1, 0, 0, -1, 0,-4,10, 0, 0, 0, 9, -27, -14, -5}, {-2, 0, 2, 1, 0, 0, 2, 0, 0,-5, 0, 0, 0, 12, 0, 0, -6}, { 0, 0, 0, 0, 0, 3, -7, 4, 0, 0, 0, 0, 0, -7, 0, 0, 0}, { 0,-1, 1, 0, 0, 0, 1, 0, 1,-1, 0, 0, 0, 0, 24, 0, 0}, {-2, 0, 2, 1, 0, 0, 2, 0,-2, 0, 0, 0, 0, 284, 0, 0,-151}, /* 31-40 */ {-1, 0, 0, 0, 0, 18,-16, 0, 0, 0, 0, 0, 0, 226, 101, 0, 0}, {-2, 1, 1, 2, 0, 0, 1, 0,-2, 0, 0, 0, 0, 0, -8, -2, 0}, {-1, 1,-1, 1, 0, 18,-17, 0, 0, 0, 0, 0, 0, 0, -6, -3, 0}, {-1, 0, 1, 1, 0, 0, 2, -2, 0, 0, 0, 0, 0, 5, 0, 0, -3}, { 0, 0, 0, 0, 0, -8, 13, 0, 0, 0, 0, 0, 2, -41, 175, 76, 17}, { 0, 2,-2, 2, 0, -8, 11, 0, 0, 0, 0, 0, 0, 0, 15, 6, 0}, { 0, 0, 0, 0, 0, -8, 13, 0, 0, 0, 0, 0, 1, 425, 212, -133, 269}, { 0, 1,-1, 1, 0, -8, 12, 0, 0, 0, 0, 0, 0, 1200, 598, 319,-641}, { 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, 0, 235, 334, 0, 0}, { 0, 1,-1, 1, 0, 8,-14, 0, 0, 0, 0, 0, 0, 11, -12, -7, -6}, /* 41-50 */ { 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, 1, 5, -6, 3, 3}, {-2, 0, 2, 1, 0, 0, 2, 0,-4, 5, 0, 0, 0, -5, 0, 0, 3}, {-2, 0, 2, 2, 0, 3, -3, 0, 0, 0, 0, 0, 0, 6, 0, 0, -3}, {-2, 0, 2, 0, 0, 0, 2, 0,-3, 1, 0, 0, 0, 15, 0, 0, 0}, { 0, 0, 0, 1, 0, 3, -5, 0, 2, 0, 0, 0, 0, 13, 0, 0, -7}, {-2, 0, 2, 0, 0, 0, 2, 0,-4, 3, 0, 0, 0, -6, -9, 0, 0}, { 0,-1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 266, -78, 0, 0}, { 0, 0, 0, 1, 0, 0, -1, 2, 0, 0, 0, 0, 0, -460,-435, -232, 246}, { 0, 1,-1, 2, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0, 15, 7, 0}, {-1, 1, 0, 1, 0, 3, -5, 0, 0, 0, 0, 0, 0, -3, 0, 0, 2}, /* 51-60 */ {-1, 0, 1, 0, 0, 3, -4, 0, 0, 0, 0, 0, 0, 0, 131, 0, 0}, {-2, 0, 2, 0, 0, 0, 2, 0,-2,-2, 0, 0, 0, 4, 0, 0, 0}, {-2, 2, 0, 2, 0, 0, -5, 9, 0, 0, 0, 0, 0, 0, 3, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 0,-1, 0, 0, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 0, 0, 2, 0, -17, -19, -10, 9}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, -9, -11, 6, -5}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, -6, 0, 0, 3}, {-1, 0, 1, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, -16, 8, 0, 0}, { 0,-1, 1, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0}, /* 61-70 */ { 0, 1,-1, 2, 0, 0, -1, 0, 0, 2, 0, 0, 0, 11, 24, 11, -5}, { 0, 0, 0, 1, 0, 0, -9, 17, 0, 0, 0, 0, 0, -3, -4, -2, 1}, { 0, 0, 0, 2, 0, -3, 5, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 1,-1, 1, 0, 0, -1, 0,-1, 2, 0, 0, 0, 0, -8, -4, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 1,-2, 0, 0, 0, 0, 3, 0, 0}, { 1, 0,-2, 0, 0, 17,-16, 0,-2, 0, 0, 0, 0, 0, 5, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0, 1,-3, 0, 0, 0, 0, 3, 2, 0}, {-2, 0, 2, 1, 0, 0, 5, -6, 0, 0, 0, 0, 0, -6, 4, 2, 3}, { 0,-2, 2, 0, 0, 0, 9,-13, 0, 0, 0, 0, 0, -3, -5, 0, 0}, { 0, 1,-1, 2, 0, 0, -1, 0, 0, 1, 0, 0, 0, -5, 0, 0, 2}, /* 71-80 */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 4, 24, 13, -2}, { 0,-1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, -42, 20, 0, 0}, { 0,-2, 2, 0, 0, 5, -6, 0, 0, 0, 0, 0, 0, -10, 233, 0, 0}, { 0,-1, 1, 1, 0, 5, -7, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1}, {-2, 0, 2, 0, 0, 6, -8, 0, 0, 0, 0, 0, 0, 78, -18, 0, 0}, { 2, 1,-3, 1, 0, -6, 7, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -3, -1, 0}, { 0,-1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, -4, -2, 1}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 0, 2, 0, 0, 0, -8, -4, -1}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, -5, 3, 0}, /* 81-90 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, -7, 0, 0, 3}, { 0, 0, 0, 0, 0, 0, -8, 15, 0, 0, 0, 0, 2, -14, 8, 3, 6}, { 0, 0, 0, 0, 0, 0, -8, 15, 0, 0, 0, 0, 1, 0, 8, -4, 0}, { 0, 1,-1, 1, 0, 0, -9, 15, 0, 0, 0, 0, 0, 0, 19, 10, 0}, { 0, 0, 0, 0, 0, 0, 8,-15, 0, 0, 0, 0, 0, 45, -22, 0, 0}, { 1,-1,-1, 0, 0, 0, 8,-15, 0, 0, 0, 0, 0, -3, 0, 0, 0}, { 2, 0,-2, 0, 0, 2, -5, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0}, {-2, 0, 2, 0, 0, 0, 2, 0,-5, 5, 0, 0, 0, 0, 3, 0, 0}, { 2, 0,-2, 1, 0, 0, -6, 8, 0, 0, 0, 0, 0, 3, 5, 3, -2}, { 2, 0,-2, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0, 89, -16, -9, -48}, /* 91-100 */ {-2, 1, 1, 0, 0, 0, 1, 0,-3, 0, 0, 0, 0, 0, 3, 0, 0}, {-2, 1, 1, 1, 0, 0, 1, 0,-3, 0, 0, 0, 0, -3, 7, 4, 2}, {-2, 0, 2, 0, 0, 0, 2, 0,-3, 0, 0, 0, 0, -349, -62, 0, 0}, {-2, 0, 2, 0, 0, 0, 6, -8, 0, 0, 0, 0, 0, -15, 22, 0, 0}, {-2, 0, 2, 0, 0, 0, 2, 0,-1,-5, 0, 0, 0, -3, 0, 0, 0}, {-1, 0, 1, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, -53, 0, 0, 0}, {-1, 1, 1, 1, 0,-20, 20, 0, 0, 0, 0, 0, 0, 5, 0, 0, -3}, { 1, 0,-2, 0, 0, 20,-21, 0, 0, 0, 0, 0, 0, 0, -8, 0, 0}, { 0, 0, 0, 1, 0, 0, 8,-15, 0, 0, 0, 0, 0, 15, -7, -4, -8}, { 0, 2,-2, 1, 0, 0,-10, 15, 0, 0, 0, 0, 0, -3, 0, 0, 1}, /* 101-110 */ { 0,-1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, -21, -78, 0, 0}, { 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 20, -70, -37, -11}, { 0, 1,-1, 2, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 6, 3, 0}, { 0, 1,-1, 1, 0, 0, -1, 0,-2, 4, 0, 0, 0, 5, 3, 2, -2}, { 2, 0,-2, 1, 0, -6, 8, 0, 0, 0, 0, 0, 0, -17, -4, -2, 9}, { 0,-2, 2, 1, 0, 5, -6, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 1, 32, 15, -8, 17}, { 0, 1,-1, 1, 0, 0, -1, 0, 0,-1, 0, 0, 0, 174, 84, 45, -93}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 11, 56, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, -66, -12, -6, 35}, /* 111-120 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 47, 8, 4, -25}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 8, 4, 0}, { 0, 2,-2, 1, 0, 0, -9, 13, 0, 0, 0, 0, 0, 10, -22, -12, -5}, { 0, 0, 0, 1, 0, 0, 7,-13, 0, 0, 0, 0, 0, -3, 0, 0, 2}, {-2, 0, 2, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, -24, 12, 0, 0}, { 0, 0, 0, 0, 0, 0, 9,-17, 0, 0, 0, 0, 0, 5, -6, 0, 0}, { 0, 0, 0, 0, 0, 0, -9, 17, 0, 0, 0, 0, 2, 3, 0, 0, -2}, { 1, 0,-1, 1, 0, 0, -3, 4, 0, 0, 0, 0, 0, 4, 3, 1, -2}, { 1, 0,-1, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0, 0, 29, 15, 0}, { 0, 0, 0, 2, 0, 0, -1, 2, 0, 0, 0, 0, 0, -5, -4, -2, 2}, /* 121-130 */ { 0,-1, 1, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 8, -3, -1, -5}, { 0,-2, 2, 0, 1, 0, -2, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0}, { 0, 0, 0, 0, 0, 3, -5, 0, 2, 0, 0, 0, 0, 10, 0, 0, 0}, {-2, 0, 2, 1, 0, 0, 2, 0,-3, 1, 0, 0, 0, 3, 0, 0, -2}, {-2, 0, 2, 1, 0, 3, -3, 0, 0, 0, 0, 0, 0, -5, 0, 0, 3}, { 0, 0, 0, 1, 0, 8,-13, 0, 0, 0, 0, 0, 0, 46, 66, 35, -25}, { 0,-1, 1, 0, 0, 8,-12, 0, 0, 0, 0, 0, 0, -14, 7, 0, 0}, { 0, 2,-2, 1, 0, -8, 11, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0}, {-1, 0, 1, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, -5, 0, 0, 0}, {-1, 0, 0, 1, 0, 18,-16, 0, 0, 0, 0, 0, 0, -68, -34, -18, 36}, /* 131-140 */ { 0, 1,-1, 1, 0, 0, -1, 0,-1, 1, 0, 0, 0, 0, 14, 7, 0}, { 0, 0, 0, 1, 0, 3, -7, 4, 0, 0, 0, 0, 0, 10, -6, -3, -5}, {-2, 1, 1, 1, 0, 0, -3, 7, 0, 0, 0, 0, 0, -5, -4, -2, 3}, { 0, 1,-1, 2, 0, 0, -1, 0,-2, 5, 0, 0, 0, -3, 5, 2, 1}, { 0, 0, 0, 1, 0, 0, 0, 0,-2, 5, 0, 0, 0, 76, 17, 9, -41}, { 0, 0, 0, 1, 0, 0, -4, 8,-3, 0, 0, 0, 0, 84, 298, 159, -45}, { 1, 0, 0, 1, 0,-10, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 2,-2, 1, 0, 0, -2, 0, 0, 0, 0, 0, 0, -3, 0, 0, 2}, {-1, 0, 0, 1, 0, 10, -3, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1}, { 0, 0, 0, 1, 0, 0, 4, -8, 3, 0, 0, 0, 0, -82, 292, 156, 44}, /* 141-150 */ { 0, 0, 0, 1, 0, 0, 0, 0, 2,-5, 0, 0, 0, -73, 17, 9, 39}, { 0,-1, 1, 0, 0, 0, 1, 0, 2,-5, 0, 0, 0, -9, -16, 0, 0}, { 2,-1,-1, 1, 0, 0, 3, -7, 0, 0, 0, 0, 0, 3, 0, -1, -2}, {-2, 0, 2, 0, 0, 0, 2, 0, 0,-5, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 1, 0, -3, 7, -4, 0, 0, 0, 0, 0, -9, -5, -3, 5}, {-2, 0, 2, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, -439, 0, 0, 0}, { 1, 0, 0, 1, 0,-18, 16, 0, 0, 0, 0, 0, 0, 57, -28, -15, -30}, {-2, 1, 1, 1, 0, 0, 1, 0,-2, 0, 0, 0, 0, 0, -6, -3, 0}, { 0, 1,-1, 2, 0, -8, 12, 0, 0, 0, 0, 0, 0, -4, 0, 0, 2}, { 0, 0, 0, 1, 0, -8, 13, 0, 0, 0, 0, 0, 0, -40, 57, 30, 21}, /* 151-160 */ { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 1, 23, 7, 3, -13}, { 0, 1,-1, 1, 0, 0, 0, -2, 0, 0, 0, 0, 0, 273, 80, 43,-146}, { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, -449, 430, 0, 0}, { 0, 1,-1, 1, 0, 0, -2, 2, 0, 0, 0, 0, 0, -8, -47, -25, 4}, { 0, 0, 0, 0, 0, 0, -1, 2, 0, 0, 0, 0, 1, 6, 47, 25, -3}, {-1, 0, 1, 1, 0, 3, -4, 0, 0, 0, 0, 0, 0, 0, 23, 13, 0}, {-1, 0, 1, 1, 0, 0, 3, -4, 0, 0, 0, 0, 0, -3, 0, 0, 2}, { 0, 1,-1, 1, 0, 0, -1, 0, 0,-2, 0, 0, 0, 3, -4, -2, -2}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 2, 0, 0, 0, -48,-110, -59, 26}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 51, 114, 61, -27}, /* 161-170 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, -133, 0, 0, 57}, { 0, 1,-1, 0, 0, 3, -6, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0}, { 0, 0, 0, 1, 0, -3, 5, 0, 0, 0, 0, 0, 0, -21, -6, -3, 11}, { 0, 1,-1, 2, 0, -3, 4, 0, 0, 0, 0, 0, 0, 0, -3, -1, 0}, { 0, 0, 0, 1, 0, 0, -2, 4, 0, 0, 0, 0, 0, -11, -21, -11, 6}, { 0, 2,-2, 1, 0, -5, 6, 0, 0, 0, 0, 0, 0, -18,-436, -233, 9}, { 0,-1, 1, 0, 0, 5, -7, 0, 0, 0, 0, 0, 0, 35, -7, 0, 0}, { 0, 0, 0, 1, 0, 5, -8, 0, 0, 0, 0, 0, 0, 0, 5, 3, 0}, {-2, 0, 2, 1, 0, 6, -8, 0, 0, 0, 0, 0, 0, 11, -3, -1, -6}, { 0, 0, 0, 1, 0, 0, -8, 15, 0, 0, 0, 0, 0, -5, -3, -1, 3}, /* 171-180 */ {-2, 0, 2, 1, 0, 0, 2, 0,-3, 0, 0, 0, 0, -53, -9, -5, 28}, {-2, 0, 2, 1, 0, 0, 6, -8, 0, 0, 0, 0, 0, 0, 3, 2, 1}, { 1, 0,-1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 4, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 0, 0, 3,-5, 0, 0, 0, 0, -4, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0,-1, 0, 0, 0, 0, -50, 194, 103, 27}, { 0, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 1, -13, 52, 28, 7}, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -91, 248, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 6, 49, 26, -3}, { 0, 1,-1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, -6, -47, -25, 3}, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 3, 0}, /* 181-190 */ { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 52, 23, 10, -23}, { 0, 1,-1, 2, 0, 0, -1, 0, 0,-1, 0, 0, 0, -3, 0, 0, 1}, { 0, 0, 0, 1, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 5, 3, 0}, { 0,-1, 1, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0, -4, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, -7, 13, 0, 0, 0, 0, 2, -4, 8, 3, 2}, { 0, 0, 0, 0, 0, 0, 7,-13, 0, 0, 0, 0, 0, 10, 0, 0, 0}, { 2, 0,-2, 1, 0, 0, -5, 6, 0, 0, 0, 0, 0, 3, 0, 0, -2}, { 0, 2,-2, 1, 0, 0, -8, 11, 0, 0, 0, 0, 0, 0, 8, 4, 0}, { 0, 2,-2, 1,-1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 8, 4, 1}, {-2, 0, 2, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, -4, 0, 0, 0}, /* 191-200 */ { 0, 0, 0, 0, 0, 0, 0, 0, 2,-2, 0, 0, 0, -4, 0, 0, 0}, { 0, 1,-1, 1, 0, 0, -1, 0, 0, 3, 0, 0, 0, -8, 4, 2, 4}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1, 8, -4, -2, -4}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 2, 0, 15, 7, 0}, {-2, 0, 2, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0, -138, 0, 0, 0}, { 0, 0, 0, 2, 0, 0, -4, 8,-3, 0, 0, 0, 0, 0, -7, -3, 0}, { 0, 0, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, -7, -3, 0}, { 2, 0,-2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0, 54, 0, 0, -29}, { 0, 1,-1, 2, 0, 0, -1, 0, 2, 0, 0, 0, 0, 0, 10, 4, 0}, { 0, 1,-1, 2, 0, 0, 0, -2, 0, 0, 0, 0, 0, -7, 0, 0, 3}, /* 201-210 */ { 0, 0, 0, 1, 0, 0, 1, -2, 0, 0, 0, 0, 0, -37, 35, 19, 20}, { 0,-1, 1, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, 4, 0, 0}, { 0,-1, 1, 0, 0, 0, 1, 0, 0,-2, 0, 0, 0, -4, 9, 0, 0}, { 0, 2,-2, 1, 0, 0, -2, 0, 0, 2, 0, 0, 0, 8, 0, 0, -4}, { 0, 1,-1, 1, 0, 3, -6, 0, 0, 0, 0, 0, 0, -9, -14, -8, 5}, { 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, 1, -3, -9, -5, 3}, { 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, 0, -145, 47, 0, 0}, { 0, 1,-1, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0, -10, 40, 21, 5}, { 0, 0, 0, 0, 0, -3, 5, 0, 0, 0, 0, 0, 1, 11, -49, -26, -7}, { 0, 0, 0, 0, 0, -3, 5, 0, 0, 0, 0, 0, 2,-2150, 0, 0, 932}, /* 211-220 */ { 0, 2,-2, 2, 0, -3, 3, 0, 0, 0, 0, 0, 0, -12, 0, 0, 5}, { 0, 0, 0, 0, 0, -3, 5, 0, 0, 0, 0, 0, 2, 85, 0, 0, -37}, { 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 1, 4, 0, 0, -2}, { 0, 1,-1, 1, 0, 0, 1, -4, 0, 0, 0, 0, 0, 3, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0, -86, 153, 0, 0}, { 0, 0, 0, 0, 0, 0, -2, 4, 0, 0, 0, 0, 1, -6, 9, 5, 3}, { 0, 1,-1, 1, 0, 0, -3, 4, 0, 0, 0, 0, 0, 9, -13, -7, -5}, { 0, 0, 0, 0, 0, 0, -2, 4, 0, 0, 0, 0, 1, -8, 12, 6, 4}, { 0, 0, 0, 0, 0, 0, -2, 4, 0, 0, 0, 0, 2, -51, 0, 0, 22}, { 0, 0, 0, 0, 0, -5, 8, 0, 0, 0, 0, 0, 2, -11,-268, -116, 5}, /* 221-230 */ { 0, 2,-2, 2, 0, -5, 6, 0, 0, 0, 0, 0, 0, 0, 12, 5, 0}, { 0, 0, 0, 0, 0, -5, 8, 0, 0, 0, 0, 0, 2, 0, 7, 3, 0}, { 0, 0, 0, 0, 0, -5, 8, 0, 0, 0, 0, 0, 1, 31, 6, 3, -17}, { 0, 1,-1, 1, 0, -5, 7, 0, 0, 0, 0, 0, 0, 140, 27, 14, -75}, { 0, 0, 0, 0, 0, -5, 8, 0, 0, 0, 0, 0, 1, 57, 11, 6, -30}, { 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0, 0, -14, -39, 0, 0}, { 0, 1,-1, 2, 0, 0, -1, 0,-1, 0, 0, 0, 0, 0, -6, -2, 0}, { 0, 0, 0, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0, 4, 15, 8, -2}, { 0,-1, 1, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 0, 4, 0, 0}, { 0, 2,-2, 1, 0, 0, -2, 0, 1, 0, 0, 0, 0, -3, 0, 0, 1}, /* 231-240 */ { 0, 0, 0, 0, 0, 0, -6, 11, 0, 0, 0, 0, 2, 0, 11, 5, 0}, { 0, 0, 0, 0, 0, 0, 6,-11, 0, 0, 0, 0, 0, 9, 6, 0, 0}, { 0, 0, 0, 0,-1, 0, 4, 0, 0, 0, 0, 0, 2, -4, 10, 4, 2}, { 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, 0, 0, 0, 5, 3, 0, 0}, { 2, 0,-2, 1, 0, -3, 3, 0, 0, 0, 0, 0, 0, 16, 0, 0, -9}, {-2, 0, 2, 0, 0, 0, 2, 0, 0,-2, 0, 0, 0, -3, 0, 0, 0}, { 0, 2,-2, 1, 0, 0, -7, 9, 0, 0, 0, 0, 0, 0, 3, 2, -1}, { 0, 0, 0, 0, 0, 0, 0, 0, 4,-5, 0, 0, 2, 7, 0, 0, -3}, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, -25, 22, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 42, 223, 119, -22}, /* 241-250 */ { 0, 1,-1, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0, -27,-143, -77, 14}, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 9, 49, 26, -5}, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2,-1166, 0, 0, 505}, { 0, 2,-2, 2, 0, 0, -2, 0, 2, 0, 0, 0, 0, -5, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 2, -6, 0, 0, 3}, { 0, 0, 0, 1, 0, 3, -5, 0, 0, 0, 0, 0, 0, -8, 0, 1, 4}, { 0,-1, 1, 0, 0, 3, -4, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0}, { 0, 2,-2, 1, 0, -3, 3, 0, 0, 0, 0, 0, 0, 117, 0, 0, -63}, { 0, 0, 0, 1, 0, 0, 2, -4, 0, 0, 0, 0, 0, -4, 8, 4, 2}, { 0, 2,-2, 1, 0, 0, -4, 4, 0, 0, 0, 0, 0, 3, 0, 0, -2}, /* 251-260 */ { 0, 1,-1, 2, 0, -5, 7, 0, 0, 0, 0, 0, 0, -5, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0, 0, 31, 0, 0}, { 0, 0, 0, 0, 0, 0, -3, 6, 0, 0, 0, 0, 1, -5, 0, 1, 3}, { 0, 1,-1, 1, 0, 0, -4, 6, 0, 0, 0, 0, 0, 4, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, -3, 6, 0, 0, 0, 0, 1, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, -3, 6, 0, 0, 0, 0, 2, -24, -13, -6, 10}, { 0,-1, 1, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0}, { 0, 0, 0, 1, 0, 2, -3, 0, 0, 0, 0, 0, 0, 0, -32, -17, 0}, { 0, 0, 0, 0, 0, 0, -5, 9, 0, 0, 0, 0, 2, 8, 12, 5, -3}, { 0, 0, 0, 0, 0, 0, -5, 9, 0, 0, 0, 0, 1, 3, 0, 0, -1}, /* 261-270 */ { 0, 0, 0, 0, 0, 0, 5, -9, 0, 0, 0, 0, 0, 7, 13, 0, 0}, { 0,-1, 1, 0, 0, 0, 1, 0,-2, 0, 0, 0, 0, -3, 16, 0, 0}, { 0, 2,-2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0, 50, 0, 0, -27}, {-2, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -5, -3, 0}, { 0,-2, 2, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0}, { 0, 0, 0, 0, 0, -6, 10, 0, 0, 0, 0, 0, 1, 0, 5, 3, 1}, { 0, 0, 0, 0, 0, -6, 10, 0, 0, 0, 0, 0, 2, 24, 5, 2, -11}, { 0, 0, 0, 0, 0, -2, 3, 0, 0, 0, 0, 0, 2, 5, -11, -5, -2}, { 0, 0, 0, 0, 0, -2, 3, 0, 0, 0, 0, 0, 1, 30, -3, -2, -16}, { 0, 1,-1, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0, 18, 0, 0, -9}, /* 271-280 */ { 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, 0, 8, 614, 0, 0}, { 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, 1, 3, -3, -1, -2}, { 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 6, 17, 9, -3}, { 0, 1,-1, 1, 0, 0, -1, 0, 3, 0, 0, 0, 0, -3, -9, -5, 2}, { 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 6, 3, -1}, { 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, -127, 21, 9, 55}, { 0, 0, 0, 0, 0, 0, 4, -8, 0, 0, 0, 0, 0, 3, 5, 0, 0}, { 0, 0, 0, 0, 0, 0, -4, 8, 0, 0, 0, 0, 2, -6, -10, -4, 3}, { 0,-2, 2, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 5, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, -4, 7, 0, 0, 0, 0, 2, 16, 9, 4, -7}, /* 281-290 */ { 0, 0, 0, 0, 0, 0, -4, 7, 0, 0, 0, 0, 1, 3, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, 0, 0, 22, 0, 0}, { 0, 0, 0, 1, 0, -2, 3, 0, 0, 0, 0, 0, 0, 0, 19, 10, 0}, { 0, 2,-2, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0, 7, 0, 0, -4}, { 0, 0, 0, 0, 0, 0, -5, 10, 0, 0, 0, 0, 2, 0, -5, -2, 0}, { 0, 0, 0, 1, 0, -1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, -9, 3, 1, 4}, { 0, 0, 0, 0, 0, 0, -3, 5, 0, 0, 0, 0, 2, 17, 0, 0, -7}, { 0, 0, 0, 0, 0, 0, -3, 5, 0, 0, 0, 0, 1, 0, -3, -2, -1}, { 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, -20, 34, 0, 0}, /* 291-300 */ { 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, 1, -10, 0, 1, 5}, { 0, 1,-1, 1, 0, 1, -3, 0, 0, 0, 0, 0, 0, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, 0, 22, -87, 0, 0}, { 0, 0, 0, 0, 0, -1, 2, 0, 0, 0, 0, 0, 1, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, -1, 2, 0, 0, 0, 0, 0, 2, -3, -6, -2, 1}, { 0, 0, 0, 0, 0, -7, 11, 0, 0, 0, 0, 0, 2, -16, -3, -1, 7}, { 0, 0, 0, 0, 0, -7, 11, 0, 0, 0, 0, 0, 1, 0, -3, -2, 0}, { 0,-2, 2, 0, 0, 4, -4, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, -68, 39, 0, 0}, { 0, 2,-2, 1, 0, -4, 4, 0, 0, 0, 0, 0, 0, 27, 0, 0, -14}, /* 301-310 */ { 0,-1, 1, 0, 0, 4, -5, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, -25, 0, 0, 0}, { 0, 0, 0, 0, 0, -4, 7, 0, 0, 0, 0, 0, 1, -12, -3, -2, 6}, { 0, 1,-1, 1, 0, -4, 6, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, -4, 7, 0, 0, 0, 0, 0, 2, 3, 66, 29, -1}, { 0, 0, 0, 0, 0, -4, 6, 0, 0, 0, 0, 0, 2, 490, 0, 0,-213}, { 0, 0, 0, 0, 0, -4, 6, 0, 0, 0, 0, 0, 1, -22, 93, 49, 12}, { 0, 1,-1, 1, 0, -4, 5, 0, 0, 0, 0, 0, 0, -7, 28, 15, 4}, { 0, 0, 0, 0, 0, -4, 6, 0, 0, 0, 0, 0, 1, -3, 13, 7, 2}, { 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0, 0, -46, 14, 0, 0}, /* 311-320 */ {-2, 0, 2, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 0}, { 0,-1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0}, { 0, 0, 0, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, -28, 0, 0, 15}, { 0, 0, 0, 0, 0, 0, -1, 0, 5, 0, 0, 0, 2, 5, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0, 0, 3, 0, 0}, { 0, 0, 0, 0, 0, 0, -1, 3, 0, 0, 0, 0, 2, -11, 0, 0, 5}, { 0, 0, 0, 0, 0, 0, -7, 12, 0, 0, 0, 0, 2, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 1, 25, 106, 57, -13}, /* 321-330 */ { 0, 1,-1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 5, 21, 11, -3}, { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 1485, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1, -7, -32, -17, 4}, { 0, 1,-1, 1, 0, 1, -2, 0, 0, 0, 0, 0, 0, 0, 5, 3, 0}, { 0, 0, 0, 0, 0, 0, -2, 5, 0, 0, 0, 0, 2, -6, -3, -2, 3}, { 0, 0, 0, 0, 0, 0, -1, 0, 4, 0, 0, 0, 2, 30, -6, -2, -13}, { 0, 0, 0, 0, 0, 0, 1, 0,-4, 0, 0, 0, 0, -4, 4, 0, 0}, { 0, 0, 0, 1, 0, -1, 1, 0, 0, 0, 0, 0, 0, -19, 0, 0, 10}, { 0, 0, 0, 0, 0, 0, -6, 10, 0, 0, 0, 0, 2, 0, 4, 2, -1}, { 0, 0, 0, 0, 0, 0, -6, 10, 0, 0, 0, 0, 0, 0, 3, 0, 0}, /* 331-340 */ { 0, 2,-2, 1, 0, 0, -3, 0, 3, 0, 0, 0, 0, 4, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, -3, 7, 0, 0, 0, 0, 2, 0, -3, -1, 0}, {-2, 0, 2, 0, 0, 4, -4, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, -5, 8, 0, 0, 0, 0, 2, 5, 3, 1, -2}, { 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0, 0, 11, 0, 0}, { 0, 0, 0, 0, 0, 0, -1, 0, 3, 0, 0, 0, 2, 118, 0, 0, -52}, { 0, 0, 0, 0, 0, 0, -1, 0, 3, 0, 0, 0, 1, 0, -5, -3, 0}, { 0, 0, 0, 0, 0, 0, 1, 0,-3, 0, 0, 0, 0, -28, 36, 0, 0}, { 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0, 0, 5, -5, 0, 0}, { 0, 0, 0, 0, 0, -2, 4, 0, 0, 0, 0, 0, 1, 14, -59, -31, -8}, /* 341-350 */ { 0, 1,-1, 1, 0, -2, 3, 0, 0, 0, 0, 0, 0, 0, 9, 5, 1}, { 0, 0, 0, 0, 0, -2, 4, 0, 0, 0, 0, 0, 2, -458, 0, 0, 198}, { 0, 0, 0, 0, 0, -6, 9, 0, 0, 0, 0, 0, 2, 0, -45, -20, 0}, { 0, 0, 0, 0, 0, -6, 9, 0, 0, 0, 0, 0, 1, 9, 0, 0, -5}, { 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0}, { 0, 0, 0, 1, 0, 0, 1, 0,-2, 0, 0, 0, 0, 0, -4, -2, -1}, { 0, 2,-2, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0, 11, 0, 0, -6}, { 0, 0, 0, 0, 0, 0, -4, 6, 0, 0, 0, 0, 2, 6, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0, -16, 23, 0, 0}, { 0, 0, 0, 1, 0, 3, -4, 0, 0, 0, 0, 0, 0, 0, -4, -2, 0}, /* 351-360 */ { 0, 0, 0, 0, 0, 0, -1, 0, 2, 0, 0, 0, 2, -5, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 1, 0,-2, 0, 0, 0, 0, -166, 269, 0, 0}, { 0, 0, 0, 1, 0, 0, 1, 0,-1, 0, 0, 0, 0, 15, 0, 0, -8}, { 0, 0, 0, 0, 0, -5, 9, 0, 0, 0, 0, 0, 2, 10, 0, 0, -4}, { 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, -78, 45, 0, 0}, { 0, 0, 0, 0, 0, -3, 4, 0, 0, 0, 0, 0, 2, 0, -5, -2, 0}, { 0, 0, 0, 0, 0, -3, 4, 0, 0, 0, 0, 0, 1, 7, 0, 0, -4}, { 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, 0, -5, 328, 0, 0}, { 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, 1, 3, 0, 0, -2}, { 0, 0, 0, 1, 0, 0, 2, -2, 0, 0, 0, 0, 0, 5, 0, 0, -2}, /* 361-370 */ { 0, 0, 0, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 0,-3, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 1,-5, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0, -4, -2, 0}, { 0, 0, 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0,-1223, -26, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 1, 0, 7, 3, 0}, { 0, 0, 0, 0, 0, 0, 1, 0,-3, 5, 0, 0, 0, 3, 0, 0, 0}, { 0, 0, 0, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 0,-2, 0, 0, 0, -6, 20, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, -368, 0, 0, 0}, /* 371-380 */ { 0, 0, 0, 0, 0, 0, 1, 0, 0,-1, 0, 0, 0, -75, 0, 0, 0}, { 0, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 11, 0, 0, -6}, { 0, 0, 0, 1, 0, 0, -2, 2, 0, 0, 0, 0, 0, 3, 0, 0, -2}, { 0, 0, 0, 0, 0, -8, 14, 0, 0, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, 0, 1, 0, 2,-5, 0, 0, 0, -13, -30, 0, 0}, { 0, 0, 0, 0, 0, 0, 5, -8, 3, 0, 0, 0, 0, 21, 3, 0, 0}, { 0, 0, 0, 0, 0, 0, 5, -8, 3, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 8, -27, 0, 0}, { 0, 0, 0, 0, 0, 0, 3, -8, 3, 0, 0, 0, 0, -19, -11, 0, 0}, /* 381-390 */ { 0, 0, 0, 0, 0, 0, -3, 8,-3, 0, 0, 0, 2, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 1, 0,-2, 5, 0, 0, 2, 0, 5, 2, 0}, { 0, 0, 0, 0, 0, -8, 12, 0, 0, 0, 0, 0, 2, -6, 0, 0, 2}, { 0, 0, 0, 0, 0, -8, 12, 0, 0, 0, 0, 0, 0, -8, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 1,-2, 0, 0, 0, -1, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, -14, 0, 0, 6}, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, -74, 0, 0, 32}, { 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2, 0, -3, -1, 0}, { 0, 2,-2, 1, 0, -5, 5, 0, 0, 0, 0, 0, 0, 4, 0, 0, -2}, /* 391-400 */ { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 8, 11, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 3, 2, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, -262, 0, 0, 114}, { 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0}, { 0, 0, 0, 0, 0, -3, 6, 0, 0, 0, 0, 0, 1, -7, 0, 0, 4}, { 0, 0, 0, 0, 0, -3, 6, 0, 0, 0, 0, 0, 2, 0, -27, -12, 0}, { 0, 0, 0, 0, 0, 0, -1, 4, 0, 0, 0, 0, 2, -19, -8, -4, 8}, { 0, 0, 0, 0, 0, -5, 7, 0, 0, 0, 0, 0, 2, 202, 0, 0, -87}, { 0, 0, 0, 0, 0, -5, 7, 0, 0, 0, 0, 0, 1, -8, 35, 19, 5}, { 0, 1,-1, 1, 0, -5, 6, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0}, /* 401-410 */ { 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0, 0, 16, -5, 0, 0}, { 0, 2,-2, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0, 5, 0, 0, -3}, { 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, -3, 0, 0}, { 0, 0, 0, 0,-1, 0, 3, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 2, -35, -48, -21, 15}, { 0, 0, 0, 0, 0, 0, -2, 6, 0, 0, 0, 0, 2, -3, -5, -2, 1}, { 0, 0, 0, 1, 0, 2, -2, 0, 0, 0, 0, 0, 0, 6, 0, 0, -3}, { 0, 0, 0, 0, 0, 0, -6, 9, 0, 0, 0, 0, 2, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, 0, -5, 0, 0}, { 0, 0, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0, 1, 12, 55, 29, -6}, /* 411-420 */ { 0, 1,-1, 1, 0, -2, 1, 0, 0, 0, 0, 0, 0, 0, 5, 3, 0}, { 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, -598, 0, 0, 0}, { 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, 1, -3, -13, -7, 1}, { 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 2, -5, -7, -3, 2}, { 0, 0, 0, 0, 0, 0, -5, 7, 0, 0, 0, 0, 2, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0, 5, -7, 0, 0}, { 0, 0, 0, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0, 4, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0, 16, -6, 0, 0}, { 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0, 0, 8, -3, 0, 0}, { 0, 0, 0, 0, 0, -1, 3, 0, 0, 0, 0, 0, 1, 8, -31, -16, -4}, /* 421-430 */ { 0, 1,-1, 1, 0, -1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, -1, 3, 0, 0, 0, 0, 0, 2, 113, 0, 0, -49}, { 0, 0, 0, 0, 0, -7, 10, 0, 0, 0, 0, 0, 2, 0, -24, -10, 0}, { 0, 0, 0, 0, 0, -7, 10, 0, 0, 0, 0, 0, 1, 4, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 27, 0, 0, 0}, { 0, 0, 0, 0, 0, -4, 8, 0, 0, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, -4, 5, 0, 0, 0, 0, 0, 2, 0, -4, -2, 0}, { 0, 0, 0, 0, 0, -4, 5, 0, 0, 0, 0, 0, 1, 5, 0, 0, -2}, { 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0}, { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, -13, 0, 0, 6}, /* 431-440 */ { 0, 0, 0, 0, 0, 0, -2, 0, 5, 0, 0, 0, 2, 5, 0, 0, -2}, { 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 2, -18, -10, -4, 8}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -4, -28, 0, 0}, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, -5, 6, 3, 2}, { 0, 0, 0, 0, 0, -9, 13, 0, 0, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, 0, -1, 5, 0, 0, 0, 0, 2, -5, -9, -4, 2}, { 0, 0, 0, 0, 0, 0, -2, 0, 4, 0, 0, 0, 2, 17, 0, 0, -7}, { 0, 0, 0, 0, 0, 0, 2, 0,-4, 0, 0, 0, 0, 11, 4, 0, 0}, { 0, 0, 0, 0, 0, 0, -2, 7, 0, 0, 0, 0, 2, 0, -6, -2, 0}, { 0, 0, 0, 0, 0, 0, 2, 0,-3, 0, 0, 0, 0, 83, 15, 0, 0}, /* 441-450 */ { 0, 0, 0, 0, 0, -2, 5, 0, 0, 0, 0, 0, 1, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, -2, 5, 0, 0, 0, 0, 0, 2, 0,-114, -49, 0}, { 0, 0, 0, 0, 0, -6, 8, 0, 0, 0, 0, 0, 2, 117, 0, 0, -51}, { 0, 0, 0, 0, 0, -6, 8, 0, 0, 0, 0, 0, 1, -5, 19, 10, 2}, { 0, 0, 0, 0, 0, 6, -8, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 1, 0, 0, 2, 0,-2, 0, 0, 0, 0, -3, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, -3, 9, 0, 0, 0, 0, 2, 0, -3, -1, 0}, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, 3, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 2, 0, -6, -2, 0}, { 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 393, 3, 0, 0}, /* 451-460 */ { 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 1, -4, 21, 11, 2}, { 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 2, -6, 0, -1, 3}, { 0, 0, 0, 0, 0, -5, 10, 0, 0, 0, 0, 0, 2, -3, 8, 4, 1}, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 8, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 2, 18, -29, -13, -8}, { 0, 0, 0, 0, 0, -3, 3, 0, 0, 0, 0, 0, 1, 8, 34, 18, -4}, { 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0, 89, 0, 0, 0}, { 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 1, 3, 12, 6, -1}, { 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 2, 54, -15, -7, -24}, { 0, 0, 0, 0, 0, 0, 2, 0, 0,-3, 0, 0, 0, 0, 3, 0, 0}, /* 461-470 */ { 0, 0, 0, 0, 0, 0, -5, 13, 0, 0, 0, 0, 2, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 0, 2, 0,-1, 0, 0, 0, 0, 0, 35, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, 0,-1, 0, 0, 0, 2, -154, -30, -13, 67}, { 0, 0, 0, 0, 0, 0, 2, 0, 0,-2, 0, 0, 0, 15, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, 0, 0,-2, 0, 0, 1, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0, 0, 9, 0, 0}, { 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 2, 80, -71, -31, -35}, { 0, 0, 0, 0, 0, 0, 2, 0, 0,-1, 0, 0, 2, 0, -20, -9, 0}, { 0, 0, 0, 0, 0, 0, -6, 15, 0, 0, 0, 0, 2, 11, 5, 2, -5}, { 0, 0, 0, 0, 0, -8, 15, 0, 0, 0, 0, 0, 2, 61, -96, -42, -27}, /* 471-480 */ { 0, 0, 0, 0, 0, -3, 9, -4, 0, 0, 0, 0, 2, 14, 9, 4, -6}, { 0, 0, 0, 0, 0, 0, 2, 0, 2,-5, 0, 0, 2, -11, -6, -3, 5}, { 0, 0, 0, 0, 0, 0, -2, 8,-1,-5, 0, 0, 2, 0, -3, -1, 0}, { 0, 0, 0, 0, 0, 0, 6, -8, 3, 0, 0, 0, 2, 123,-415, -180, -53}, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, -35}, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 7, -32, -17, -4}, { 0, 1,-1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -9, -5, 0}, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, -4, 2, 0}, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, -89, 0, 0, 38}, /* 481-490 */ { 0, 0, 0, 0, 0, 0, -6, 16,-4,-5, 0, 0, 2, 0, -86, -19, -6}, { 0, 0, 0, 0, 0, 0, -2, 8,-3, 0, 0, 0, 2, 0, 0, -19, 6}, { 0, 0, 0, 0, 0, 0, -2, 8,-3, 0, 0, 0, 2, -123,-416, -180, 53}, { 0, 0, 0, 0, 0, 0, 6, -8, 1, 5, 0, 0, 2, 0, -3, -1, 0}, { 0, 0, 0, 0, 0, 0, 2, 0,-2, 5, 0, 0, 2, 12, -6, -3, -5}, { 0, 0, 0, 0, 0, 3, -5, 4, 0, 0, 0, 0, 2, -13, 9, 4, 6}, { 0, 0, 0, 0, 0, -8, 11, 0, 0, 0, 0, 0, 2, 0, -15, -7, 0}, { 0, 0, 0, 0, 0, -8, 11, 0, 0, 0, 0, 0, 1, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, -8, 11, 0, 0, 0, 0, 0, 2, -62, -97, -42, 27}, { 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 2, -11, 5, 2, 5}, /* 491-500 */ { 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 2, 0, -19, -8, 0}, { 0, 0, 0, 0, 0, 3, -3, 0, 2, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 2,-2, 1, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, 4, 2, 0}, { 0, 1,-1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, { 0, 2,-2, 1, 0, 0, -4, 8,-3, 0, 0, 0, 0, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 2, -85, -70, -31, 37}, { 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 2, 163, -12, -5, -72}, { 0, 0, 0, 0, 0, -3, 7, 0, 0, 0, 0, 0, 2, -63, -16, -7, 28}, { 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 2, -21, -32, -14, 9}, { 0, 0, 0, 0, 0, -5, 6, 0, 0, 0, 0, 0, 2, 0, -3, -1, 0}, /* 501-510 */ { 0, 0, 0, 0, 0, -5, 6, 0, 0, 0, 0, 0, 1, 3, 0, 0, -2}, { 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0}, { 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, 2, 3, 10, 4, -1}, { 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 0, -1, 6, 0, 0, 0, 0, 2, 0, -7, -3, 0}, { 0, 0, 0, 0, 0, 0, 7, -9, 0, 0, 0, 0, 2, 0, -4, -2, 0}, { 0, 0, 0, 0, 0, 2, -1, 0, 0, 0, 0, 0, 0, 6, 19, 0, 0}, { 0, 0, 0, 0, 0, 2, -1, 0, 0, 0, 0, 0, 2, 5,-173, -75, -2}, { 0, 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 2, 0, -7, -3, 0}, { 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 2, 7, -12, -5, -3}, /* 511-520 */ { 0, 0, 0, 0, 0, -1, 4, 0, 0, 0, 0, 0, 1, -3, 0, 0, 2}, { 0, 0, 0, 0, 0, -1, 4, 0, 0, 0, 0, 0, 2, 3, -4, -2, -1}, { 0, 0, 0, 0, 0, -7, 9, 0, 0, 0, 0, 0, 2, 74, 0, 0, -32}, { 0, 0, 0, 0, 0, -7, 9, 0, 0, 0, 0, 0, 1, -3, 12, 6, 2}, { 0, 0, 0, 0, 0, 0, 4, -3, 0, 0, 0, 0, 2, 26, -14, -6, -11}, { 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 2, 19, 0, 0, -8}, { 0, 0, 0, 0, 0, -4, 4, 0, 0, 0, 0, 0, 1, 6, 24, 13, -3}, { 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0}, { 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 1, 0, -10, -5, 0}, { 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 2, 11, -3, -1, -5}, /* 521-530 */ { 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2, 3, 0, 1, -1}, { 0, 0, 0, 0, 0, 0, -3, 0, 5, 0, 0, 0, 2, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0}, { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 5, -23, -12, -3}, { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2, -339, 0, 0, 147}, { 0, 0, 0, 0, 0, -9, 12, 0, 0, 0, 0, 0, 2, 0, -10, -5, 0}, { 0, 0, 0, 0, 0, 0, 3, 0,-4, 0, 0, 0, 0, 5, 0, 0, 0}, { 0, 2,-2, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 0, 7, -8, 0, 0, 0, 0, 2, 0, -4, -2, 0}, { 0, 0, 0, 0, 0, 0, 3, 0,-3, 0, 0, 0, 0, 18, -3, 0, 0}, /* 531-540 */ { 0, 0, 0, 0, 0, 0, 3, 0,-3, 0, 0, 0, 2, 9, -11, -5, -4}, { 0, 0, 0, 0, 0, -2, 6, 0, 0, 0, 0, 0, 2, -8, 0, 0, 4}, { 0, 0, 0, 0, 0, -6, 7, 0, 0, 0, 0, 0, 1, 3, 0, 0, -1}, { 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0}, { 0, 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 2, 6, -9, -4, -2}, { 0, 0, 0, 0, 0, 0, 3, 0,-2, 0, 0, 0, 0, -4, -12, 0, 0}, { 0, 0, 0, 0, 0, 0, 3, 0,-2, 0, 0, 0, 2, 67, -91, -39, -29}, { 0, 0, 0, 0, 0, 0, 5, -4, 0, 0, 0, 0, 2, 30, -18, -8, -13}, { 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0, 2, 0,-114, -50, 0}, /* 541-550 */ { 0, 0, 0, 0, 0, 0, 3, 0,-1, 0, 0, 0, 2, 0, 0, 0, 23}, { 0, 0, 0, 0, 0, 0, 3, 0,-1, 0, 0, 0, 2, 517, 16, 7,-224}, { 0, 0, 0, 0, 0, 0, 3, 0, 0,-2, 0, 0, 2, 0, -7, -3, 0}, { 0, 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 2, 143, -3, -1, -62}, { 0, 0, 0, 0, 0, 0, 3, 0, 0,-1, 0, 0, 2, 29, 0, 0, -13}, { 0, 2,-2, 1, 0, 0, 1, 0,-1, 0, 0, 0, 0, -4, 0, 0, 2}, { 0, 0, 0, 0, 0, -8, 16, 0, 0, 0, 0, 0, 2, -6, 0, 0, 3}, { 0, 0, 0, 0, 0, 0, 3, 0, 2,-5, 0, 0, 2, 5, 12, 5, -2}, { 0, 0, 0, 0, 0, 0, 7, -8, 3, 0, 0, 0, 2, -25, 0, 0, 11}, { 0, 0, 0, 0, 0, 0, -5, 16,-4,-5, 0, 0, 2, -3, 0, 0, 1}, /* 551-560 */ { 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 2, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, 0, -1, 8,-3, 0, 0, 0, 2, -22, 12, 5, 10}, { 0, 0, 0, 0, 0, -8, 10, 0, 0, 0, 0, 0, 2, 50, 0, 0, -22}, { 0, 0, 0, 0, 0, -8, 10, 0, 0, 0, 0, 0, 1, 0, 7, 4, 0}, { 0, 0, 0, 0, 0, -8, 10, 0, 0, 0, 0, 0, 2, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2, -4, 4, 2, 2}, { 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 2, -5, -11, -5, 2}, { 0, 0, 0, 0, 0, -3, 8, 0, 0, 0, 0, 0, 2, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, -5, 5, 0, 0, 0, 0, 0, 1, 4, 17, 9, -2}, { 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 0, 59, 0, 0, 0}, /* 561-570 */ { 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 1, 0, -4, -2, 0}, { 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 2, -8, 0, 0, 4}, { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 4, -15, -8, -2}, { 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 370, -8, 0,-160}, { 0, 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 2, 0, 0, -3, 0}, { 0, 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 2, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, 0, 6, -5, 0, 0, 0, 0, 2, -6, 3, 1, 3}, { 0, 0, 0, 0, 0, 7, -8, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0}, { 0, 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 2, -10, 0, 0, 4}, /* 571-580 */ { 0, 0, 0, 0, 0, 4, -3, 0, 0, 0, 0, 0, 2, 0, 9, 4, 0}, { 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 2, 4, 17, 7, -2}, { 0, 0, 0, 0, 0, -9, 11, 0, 0, 0, 0, 0, 2, 34, 0, 0, -15}, { 0, 0, 0, 0, 0, -9, 11, 0, 0, 0, 0, 0, 1, 0, 5, 3, 0}, { 0, 0, 0, 0, 0, 0, 4, 0,-4, 0, 0, 0, 2, -5, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 4, 0,-3, 0, 0, 0, 2, -37, -7, -3, 16}, { 0, 0, 0, 0, 0, -6, 6, 0, 0, 0, 0, 0, 1, 3, 13, 7, -2}, { 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}, { 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 0, 1, 0, -3, -2, 0}, { 0, 0, 0, 0, 0, 0, 4, 0,-2, 0, 0, 0, 2, -184, -3, -1, 80}, /* 581-590 */ { 0, 0, 0, 0, 0, 0, 6, -4, 0, 0, 0, 0, 2, -3, 0, 0, 1}, { 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 0, -3, 0, 0, 0}, { 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 1, 0, -10, -6, -1}, { 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 2, 31, -6, 0, -13}, { 0, 0, 0, 0, 0, 0, 4, 0,-1, 0, 0, 0, 2, -3, -32, -14, 1}, { 0, 0, 0, 0, 0, 0, 4, 0, 0,-2, 0, 0, 2, -7, 0, 0, 3}, { 0, 0, 0, 0, 0, 0, 5, -2, 0, 0, 0, 0, 2, 0, -8, -4, 0}, { 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 3, -4, 0, 0}, { 0, 0, 0, 0, 0, 8, -9, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0}, { 0, 0, 0, 0, 0, 5, -4, 0, 0, 0, 0, 0, 2, 0, 3, 1, 0}, /* 591-600 */ { 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 2, 19, -23, -10, 2}, { 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, -10}, { 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1, 0, 3, 2, 0}, { 0, 0, 0, 0, 0, -7, 7, 0, 0, 0, 0, 0, 1, 0, 9, 5, -1}, { 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0}, { 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 1, 0, -7, -4, 0}, { 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 2, 8, -4, 0, -4}, { 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0}, { 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, { 0, 0, 0, 0, 0, 0, 5, 0,-4, 0, 0, 0, 2, -3, 0, 0, 1}, /* 601-610 */ { 0, 0, 0, 0, 0, 0, 5, 0,-3, 0, 0, 0, 2, -9, 0, 1, 4}, { 0, 0, 0, 0, 0, 0, 5, 0,-2, 0, 0, 0, 2, 3, 12, 5, -1}, { 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 17, -3, -1, 0}, { 0, 0, 0, 0, 0, -8, 8, 0, 0, 0, 0, 0, 1, 0, 7, 4, 0}, { 0, 0, 0, 0, 0, 8, -8, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0}, { 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 0, 1, 0, -5, -3, 0}, { 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 0, 2, 14, -3, 0, -1}, { 0, 0, 0, 0, 0, -9, 9, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0}, { 0, 0, 0, 0, 0, -9, 9, 0, 0, 0, 0, 0, 1, 0, 0, 0, -5}, { 0, 0, 0, 0, 0, -9, 9, 0, 0, 0, 0, 0, 1, 0, 5, 3, 0}, /* 611-620 */ { 0, 0, 0, 0, 0, 9, -9, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0}, { 0, 0, 0, 0, 0, 6, -4, 0, 0, 0, 0, 0, 1, 0, -3, -2, 0}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2, 2, 9, 4, 3}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1, 0, 4, 2, 0}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2, 6, 0, 0, -3}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1, 0, 3, 1, 0}, { 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2, 5, 0, 0, -2}, /* 621-630 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, 0, -1}, { 1, 0,-2, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, -3, 0, 0, 0}, { 1, 0,-2, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0}, { 1, 0,-2, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 7, 0, 0, 0}, { 1, 0,-2, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0}, {-1, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 6, 0, 0, 0}, {-1, 0, 2, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, -4, 0, 0}, { 1, 0,-2, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, -4, 0, 0}, {-2, 0, 2, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, 5, 0, 0, 0}, /* 631-640 */ {-1, 0, 0, 0, 0, 0, 2, 0,-3, 0, 0, 0, 0, -3, 0, 0, 0}, {-1, 0, 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 4, 0, 0, 0}, {-1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, -5, 0, 0, 0}, {-1, 0, 2, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0}, { 1,-1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0}, {-1, 0, 2, 0, 0, 0, 2, 0,-3, 0, 0, 0, 0, 13, 0, 0, 0}, {-2, 0, 0, 0, 0, 0, 2, 0,-3, 0, 0, 0, 0, 21, 11, 0, 0}, { 1, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, -5, 0, 0}, {-1, 1,-1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -5, -2, 0}, { 1, 1,-1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 5, 3, 0}, /* 641-650 */ {-1, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, -5, 0, 0}, {-1, 0, 2, 1, 0, 0, 2, 0,-2, 0, 0, 0, 0, -3, 0, 0, 2}, { 0, 0, 0, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, 20, 10, 0, 0}, {-1, 0, 2, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, -34, 0, 0, 0}, {-1, 0, 2, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0, -19, 0, 0, 0}, { 1, 0,-2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0, 3, 0, 0, -2}, { 1, 2,-2, 2, 0, -3, 3, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1}, { 1, 2,-2, 2, 0, 0, -2, 0, 2, 0, 0, 0, 0, -6, 0, 0, 3}, { 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0}, { 1, 0, 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 3, 0, 0, 0}, /* 651-660 */ { 0, 0,-2, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0}, { 0, 0,-2, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 4, 0, 0, 0}, { 0, 2, 0, 2, 0, -2, 2, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 2, 0, 2, 0, 0, -1, 0, 1, 0, 0, 0, 0, 6, 0, 0, -3}, { 0, 2, 0, 2, 0, -1, 1, 0, 0, 0, 0, 0, 0, -8, 0, 0, 3}, { 0, 2, 0, 2, 0, -2, 3, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 0, 2, 0, 0, 0, 2, 0,-2, 0, 0, 0, 0, -3, 0, 0, 0}, { 0, 1, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -3, -2, 0}, { 1, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 126, -63, -27, -55}, {-1, 2, 0, 2, 0, 10, -3, 0, 0, 0, 0, 0, 0, -5, 0, 1, 2}, /* 661-670 */ { 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, -3, 28, 15, 2}, { 1, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 5, 0, 1, -2}, { 0, 2, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, 9, 4, 1}, { 0, 2, 0, 2, 0, 0, -4, 8,-3, 0, 0, 0, 0, 0, 9, 4, -1}, {-1, 2, 0, 2, 0, 0, -4, 8,-3, 0, 0, 0, 0, -126, -63, -27, 55}, { 2, 2,-2, 2, 0, 0, -2, 0, 3, 0, 0, 0, 0, 3, 0, 0, -1}, { 1, 2, 0, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0, 21, -11, -6, -11}, { 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0}, {-1, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, -21, -11, -6, 11}, {-2, 2, 2, 2, 0, 0, 2, 0,-2, 0, 0, 0, 0, -3, 0, 0, 1}, /* 671-680 */ { 0, 2, 0, 2, 0, 2, -3, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0}, { 0, 2, 0, 2, 0, 1, -1, 0, 0, 0, 0, 0, 0, 8, 0, 0, -4}, { 0, 2, 0, 2, 0, 0, 1, 0,-1, 0, 0, 0, 0, -6, 0, 0, 3}, { 0, 2, 0, 2, 0, 2, -2, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1}, {-1, 2, 2, 2, 0, 0, -1, 0, 1, 0, 0, 0, 0, 3, 0, 0, -1}, { 1, 2, 0, 2, 0, -1, 1, 0, 0, 0, 0, 0, 0, -3, 0, 0, 1}, {-1, 2, 2, 2, 0, 0, 2, 0,-3, 0, 0, 0, 0, -5, 0, 0, 2}, { 2, 2, 0, 2, 0, 0, 2, 0,-3, 0, 0, 0, 0, 24, -12, -5, -11}, { 1, 2, 0, 2, 0, 0, -4, 8,-3, 0, 0, 0, 0, 0, 3, 1, 0}, { 1, 2, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0, 0, 3, 1, 0}, /* 681-687 */ { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0}, { 0, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, -24, -12, -5, 10}, { 2, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 4, 0, -1, -2}, {-1, 2, 2, 2, 0, 0, 2, 0,-2, 0, 0, 0, 0, 13, 0, 0, -6}, {-1, 2, 2, 2, 0, 3, -3, 0, 0, 0, 0, 0, 0, 7, 0, 0, -3}, { 1, 2, 0, 2, 0, 1, -1, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1}, { 0, 2, 2, 2, 0, 0, 2, 0,-2, 0, 0, 0, 0, 3, 0, 0, -1} }; /* Number of terms in the planetary nutation model */ const int NPL = (int) (sizeof xpl / sizeof xpl[0]); /*--------------------------------------------------------------------*/ /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* ------------------- */ /* LUNI-SOLAR NUTATION */ /* ------------------- */ /* Fundamental (Delaunay) arguments */ /* Mean anomaly of the Moon (IERS 2003). */ el = eraFal03(t); /* Mean anomaly of the Sun (MHB2000). */ elp = fmod(1287104.79305 + t * (129596581.0481 + t * (-0.5532 + t * (0.000136 + t * (-0.00001149)))), ERFA_TURNAS) * ERFA_DAS2R; /* Mean longitude of the Moon minus that of the ascending node */ /* (IERS 2003. */ f = eraFaf03(t); /* Mean elongation of the Moon from the Sun (MHB2000). */ d = fmod(1072260.70369 + t * (1602961601.2090 + t * (-6.3706 + t * (0.006593 + t * (-0.00003169)))), ERFA_TURNAS) * ERFA_DAS2R; /* Mean longitude of the ascending node of the Moon (IERS 2003). */ om = eraFaom03(t); /* Initialize the nutation values. */ dp = 0.0; de = 0.0; /* Summation of luni-solar nutation series (in reverse order). */ for (i = NLS-1; i >= 0; i--) { /* Argument and functions. */ arg = fmod((double)xls[i].nl * el + (double)xls[i].nlp * elp + (double)xls[i].nf * f + (double)xls[i].nd * d + (double)xls[i].nom * om, ERFA_D2PI); sarg = sin(arg); carg = cos(arg); /* Term. */ dp += (xls[i].sp + xls[i].spt * t) * sarg + xls[i].cp * carg; de += (xls[i].ce + xls[i].cet * t) * carg + xls[i].se * sarg; } /* Convert from 0.1 microarcsec units to radians. */ dpsils = dp * U2R; depsls = de * U2R; /* ------------------ */ /* PLANETARY NUTATION */ /* ------------------ */ /* n.b. The MHB2000 code computes the luni-solar and planetary nutation */ /* in different functions, using slightly different Delaunay */ /* arguments in the two cases. This behaviour is faithfully */ /* reproduced here. Use of the IERS 2003 expressions for both */ /* cases leads to negligible changes, well below */ /* 0.1 microarcsecond. */ /* Mean anomaly of the Moon (MHB2000). */ al = fmod(2.35555598 + 8328.6914269554 * t, ERFA_D2PI); /* Mean longitude of the Moon minus that of the ascending node */ /*(MHB2000). */ af = fmod(1.627905234 + 8433.466158131 * t, ERFA_D2PI); /* Mean elongation of the Moon from the Sun (MHB2000). */ ad = fmod(5.198466741 + 7771.3771468121 * t, ERFA_D2PI); /* Mean longitude of the ascending node of the Moon (MHB2000). */ aom = fmod(2.18243920 - 33.757045 * t, ERFA_D2PI); /* General accumulated precession in longitude (IERS 2003). */ apa = eraFapa03(t); /* Planetary longitudes, Mercury through Uranus (IERS 2003). */ alme = eraFame03(t); alve = eraFave03(t); alea = eraFae03(t); alma = eraFama03(t); alju = eraFaju03(t); alsa = eraFasa03(t); alur = eraFaur03(t); /* Neptune longitude (MHB2000). */ alne = fmod(5.321159000 + 3.8127774000 * t, ERFA_D2PI); /* Initialize the nutation values. */ dp = 0.0; de = 0.0; /* Summation of planetary nutation series (in reverse order). */ for (i = NPL-1; i >= 0; i--) { /* Argument and functions. */ arg = fmod((double)xpl[i].nl * al + (double)xpl[i].nf * af + (double)xpl[i].nd * ad + (double)xpl[i].nom * aom + (double)xpl[i].nme * alme + (double)xpl[i].nve * alve + (double)xpl[i].nea * alea + (double)xpl[i].nma * alma + (double)xpl[i].nju * alju + (double)xpl[i].nsa * alsa + (double)xpl[i].nur * alur + (double)xpl[i].nne * alne + (double)xpl[i].npa * apa, ERFA_D2PI); sarg = sin(arg); carg = cos(arg); /* Term. */ dp += (double)xpl[i].sp * sarg + (double)xpl[i].cp * carg; de += (double)xpl[i].se * sarg + (double)xpl[i].ce * carg; } /* Convert from 0.1 microarcsec units to radians. */ dpsipl = dp * U2R; depspl = de * U2R; /* ------- */ /* RESULTS */ /* ------- */ /* Add luni-solar and planetary components. */ *dpsi = dpsils + dpsipl; *deps = depsls + depspl; return; } void eraNut00b(double date1, double date2, double *dpsi, double *deps) /* ** - - - - - - - - - - ** e r a N u t 0 0 b ** - - - - - - - - - - ** ** Nutation, IAU 2000B model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation, luni-solar + planetary (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components in longitude and obliquity are in radians ** and with respect to the equinox and ecliptic of date. The ** obliquity at J2000.0 is assumed to be the Lieske et al. (1977) ** value of 84381.448 arcsec. (The errors that result from using ** this function with the IAU 2006 value of 84381.406 arcsec can be ** neglected.) ** ** The nutation model consists only of luni-solar terms, but ** includes also a fixed offset which compensates for certain long- ** period planetary terms (Note 7). ** ** 3) This function is an implementation of the IAU 2000B abridged ** nutation model formally adopted by the IAU General Assembly in ** 2000. The function computes the MHB_2000_SHORT luni-solar ** nutation series (Luzum 2001), but without the associated ** corrections for the precession rate adjustments and the offset ** between the GCRS and J2000.0 mean poles. ** ** 4) The full IAU 2000A (MHB2000) nutation model contains nearly 1400 ** terms. The IAU 2000B model (McCarthy & Luzum 2003) contains only ** 77 terms, plus additional simplifications, yet still delivers ** results of 1 mas accuracy at present epochs. This combination of ** accuracy and size makes the IAU 2000B abridged nutation model ** suitable for most practical applications. ** ** The function delivers a pole accurate to 1 mas from 1900 to 2100 ** (usually better than 1 mas, very occasionally just outside ** 1 mas). The full IAU 2000A model, which is implemented in the ** function eraNut00a (q.v.), delivers considerably greater accuracy ** at current dates; however, to realize this improved accuracy, ** corrections for the essentially unpredictable free-core-nutation ** (FCN) must also be included. ** ** 5) The present function provides classical nutation. The ** MHB_2000_SHORT algorithm, from which it is adapted, deals also ** with (i) the offsets between the GCRS and mean poles and (ii) the ** adjustments in longitude and obliquity due to the changed ** precession rates. These additional functions, namely frame bias ** and precession adjustments, are supported by the ERFA functions ** eraBi00 and eraPr00. ** ** 6) The MHB_2000_SHORT algorithm also provides "total" nutations, ** comprising the arithmetic sum of the frame bias, precession ** adjustments, and nutation (luni-solar + planetary). These total ** nutations can be used in combination with an existing IAU 1976 ** precession implementation, such as eraPmat76, to deliver GCRS- ** to-true predictions of mas accuracy at current epochs. However, ** for symmetry with the eraNut00a function (q.v. for the reasons), ** the ERFA functions do not generate the "total nutations" ** directly. Should they be required, they could of course easily ** be generated by calling eraBi00, eraPr00 and the present function ** and adding the results. ** ** 7) The IAU 2000B model includes "planetary bias" terms that are ** fixed in size but compensate for long-period nutations. The ** amplitudes quoted in McCarthy & Luzum (2003), namely ** Dpsi = -1.5835 mas and Depsilon = +1.6339 mas, are optimized for ** the "total nutations" method described in Note 6. The Luzum ** (2001) values used in this ERFA implementation, namely -0.135 mas ** and +0.388 mas, are optimized for the "rigorous" method, where ** frame bias, precession and nutation are applied separately and in ** that order. During the interval 1995-2050, the ERFA ** implementation delivers a maximum error of 1.001 mas (not ** including FCN). ** ** References: ** ** Lieske, J.H., Lederle, T., Fricke, W., Morando, B., "Expressions ** for the precession quantities based upon the IAU /1976/ system of ** astronomical constants", Astron.Astrophys. 58, 1-2, 1-16. (1977) ** ** Luzum, B., private communication, 2001 (Fortran code ** MHB_2000_SHORT) ** ** McCarthy, D.D. & Luzum, B.J., "An abridged model of the ** precession-nutation of the celestial pole", Cel.Mech.Dyn.Astron. ** 85, 37-49 (2003) ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J., Astron.Astrophys. 282, 663-683 (1994) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, el, elp, f, d, om, arg, dp, de, sarg, carg, dpsils, depsls, dpsipl, depspl; int i; /* Units of 0.1 microarcsecond to radians */ static const double U2R = ERFA_DAS2R / 1e7; /* ---------------------------------------- */ /* Fixed offsets in lieu of planetary terms */ /* ---------------------------------------- */ static const double DPPLAN = -0.135 * ERFA_DMAS2R; static const double DEPLAN = 0.388 * ERFA_DMAS2R; /* --------------------------------------------------- */ /* Luni-solar nutation: argument and term coefficients */ /* --------------------------------------------------- */ /* The units for the sine and cosine coefficients are */ /* 0.1 microarcsec and the same per Julian century */ static const struct { int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */ double ps,pst,pc; /* longitude sin, t*sin, cos coefficients */ double ec,ect,es; /* obliquity cos, t*cos, sin coefficients */ } x[] = { /* 1-10 */ { 0, 0, 0, 0,1, -172064161.0, -174666.0, 33386.0, 92052331.0, 9086.0, 15377.0}, { 0, 0, 2,-2,2, -13170906.0, -1675.0, -13696.0, 5730336.0, -3015.0, -4587.0}, { 0, 0, 2, 0,2,-2276413.0,-234.0, 2796.0, 978459.0,-485.0,1374.0}, { 0, 0, 0, 0,2,2074554.0, 207.0, -698.0,-897492.0, 470.0,-291.0}, { 0, 1, 0, 0,0,1475877.0,-3633.0,11817.0, 73871.0,-184.0,-1924.0}, { 0, 1, 2,-2,2,-516821.0, 1226.0, -524.0, 224386.0,-677.0,-174.0}, { 1, 0, 0, 0,0, 711159.0, 73.0, -872.0, -6750.0, 0.0, 358.0}, { 0, 0, 2, 0,1,-387298.0, -367.0, 380.0, 200728.0, 18.0, 318.0}, { 1, 0, 2, 0,2,-301461.0, -36.0, 816.0, 129025.0, -63.0, 367.0}, { 0,-1, 2,-2,2, 215829.0, -494.0, 111.0, -95929.0, 299.0, 132.0}, /* 11-20 */ { 0, 0, 2,-2,1, 128227.0, 137.0, 181.0, -68982.0, -9.0, 39.0}, {-1, 0, 2, 0,2, 123457.0, 11.0, 19.0, -53311.0, 32.0, -4.0}, {-1, 0, 0, 2,0, 156994.0, 10.0, -168.0, -1235.0, 0.0, 82.0}, { 1, 0, 0, 0,1, 63110.0, 63.0, 27.0, -33228.0, 0.0, -9.0}, {-1, 0, 0, 0,1, -57976.0, -63.0, -189.0, 31429.0, 0.0, -75.0}, {-1, 0, 2, 2,2, -59641.0, -11.0, 149.0, 25543.0, -11.0, 66.0}, { 1, 0, 2, 0,1, -51613.0, -42.0, 129.0, 26366.0, 0.0, 78.0}, {-2, 0, 2, 0,1, 45893.0, 50.0, 31.0, -24236.0, -10.0, 20.0}, { 0, 0, 0, 2,0, 63384.0, 11.0, -150.0, -1220.0, 0.0, 29.0}, { 0, 0, 2, 2,2, -38571.0, -1.0, 158.0, 16452.0, -11.0, 68.0}, /* 21-30 */ { 0,-2, 2,-2,2, 32481.0, 0.0, 0.0, -13870.0, 0.0, 0.0}, {-2, 0, 0, 2,0, -47722.0, 0.0, -18.0, 477.0, 0.0, -25.0}, { 2, 0, 2, 0,2, -31046.0, -1.0, 131.0, 13238.0, -11.0, 59.0}, { 1, 0, 2,-2,2, 28593.0, 0.0, -1.0, -12338.0, 10.0, -3.0}, {-1, 0, 2, 0,1, 20441.0, 21.0, 10.0, -10758.0, 0.0, -3.0}, { 2, 0, 0, 0,0, 29243.0, 0.0, -74.0, -609.0, 0.0, 13.0}, { 0, 0, 2, 0,0, 25887.0, 0.0, -66.0, -550.0, 0.0, 11.0}, { 0, 1, 0, 0,1, -14053.0, -25.0, 79.0, 8551.0, -2.0, -45.0}, {-1, 0, 0, 2,1, 15164.0, 10.0, 11.0, -8001.0, 0.0, -1.0}, { 0, 2, 2,-2,2, -15794.0, 72.0, -16.0, 6850.0, -42.0, -5.0}, /* 31-40 */ { 0, 0,-2, 2,0, 21783.0, 0.0, 13.0, -167.0, 0.0, 13.0}, { 1, 0, 0,-2,1, -12873.0, -10.0, -37.0, 6953.0, 0.0, -14.0}, { 0,-1, 0, 0,1, -12654.0, 11.0, 63.0, 6415.0, 0.0, 26.0}, {-1, 0, 2, 2,1, -10204.0, 0.0, 25.0, 5222.0, 0.0, 15.0}, { 0, 2, 0, 0,0, 16707.0, -85.0, -10.0, 168.0, -1.0, 10.0}, { 1, 0, 2, 2,2, -7691.0, 0.0, 44.0, 3268.0, 0.0, 19.0}, {-2, 0, 2, 0,0, -11024.0, 0.0, -14.0, 104.0, 0.0, 2.0}, { 0, 1, 2, 0,2, 7566.0, -21.0, -11.0, -3250.0, 0.0, -5.0}, { 0, 0, 2, 2,1, -6637.0, -11.0, 25.0, 3353.0, 0.0, 14.0}, { 0,-1, 2, 0,2, -7141.0, 21.0, 8.0, 3070.0, 0.0, 4.0}, /* 41-50 */ { 0, 0, 0, 2,1, -6302.0, -11.0, 2.0, 3272.0, 0.0, 4.0}, { 1, 0, 2,-2,1, 5800.0, 10.0, 2.0, -3045.0, 0.0, -1.0}, { 2, 0, 2,-2,2, 6443.0, 0.0, -7.0, -2768.0, 0.0, -4.0}, {-2, 0, 0, 2,1, -5774.0, -11.0, -15.0, 3041.0, 0.0, -5.0}, { 2, 0, 2, 0,1, -5350.0, 0.0, 21.0, 2695.0, 0.0, 12.0}, { 0,-1, 2,-2,1, -4752.0, -11.0, -3.0, 2719.0, 0.0, -3.0}, { 0, 0, 0,-2,1, -4940.0, -11.0, -21.0, 2720.0, 0.0, -9.0}, {-1,-1, 0, 2,0, 7350.0, 0.0, -8.0, -51.0, 0.0, 4.0}, { 2, 0, 0,-2,1, 4065.0, 0.0, 6.0, -2206.0, 0.0, 1.0}, { 1, 0, 0, 2,0, 6579.0, 0.0, -24.0, -199.0, 0.0, 2.0}, /* 51-60 */ { 0, 1, 2,-2,1, 3579.0, 0.0, 5.0, -1900.0, 0.0, 1.0}, { 1,-1, 0, 0,0, 4725.0, 0.0, -6.0, -41.0, 0.0, 3.0}, {-2, 0, 2, 0,2, -3075.0, 0.0, -2.0, 1313.0, 0.0, -1.0}, { 3, 0, 2, 0,2, -2904.0, 0.0, 15.0, 1233.0, 0.0, 7.0}, { 0,-1, 0, 2,0, 4348.0, 0.0, -10.0, -81.0, 0.0, 2.0}, { 1,-1, 2, 0,2, -2878.0, 0.0, 8.0, 1232.0, 0.0, 4.0}, { 0, 0, 0, 1,0, -4230.0, 0.0, 5.0, -20.0, 0.0, -2.0}, {-1,-1, 2, 2,2, -2819.0, 0.0, 7.0, 1207.0, 0.0, 3.0}, {-1, 0, 2, 0,0, -4056.0, 0.0, 5.0, 40.0, 0.0, -2.0}, { 0,-1, 2, 2,2, -2647.0, 0.0, 11.0, 1129.0, 0.0, 5.0}, /* 61-70 */ {-2, 0, 0, 0,1, -2294.0, 0.0, -10.0, 1266.0, 0.0, -4.0}, { 1, 1, 2, 0,2, 2481.0, 0.0, -7.0, -1062.0, 0.0, -3.0}, { 2, 0, 0, 0,1, 2179.0, 0.0, -2.0, -1129.0, 0.0, -2.0}, {-1, 1, 0, 1,0, 3276.0, 0.0, 1.0, -9.0, 0.0, 0.0}, { 1, 1, 0, 0,0, -3389.0, 0.0, 5.0, 35.0, 0.0, -2.0}, { 1, 0, 2, 0,0, 3339.0, 0.0, -13.0, -107.0, 0.0, 1.0}, {-1, 0, 2,-2,1, -1987.0, 0.0, -6.0, 1073.0, 0.0, -2.0}, { 1, 0, 0, 0,2, -1981.0, 0.0, 0.0, 854.0, 0.0, 0.0}, {-1, 0, 0, 1,0, 4026.0, 0.0, -353.0, -553.0, 0.0,-139.0}, { 0, 0, 2, 1,2, 1660.0, 0.0, -5.0, -710.0, 0.0, -2.0}, /* 71-77 */ {-1, 0, 2, 4,2, -1521.0, 0.0, 9.0, 647.0, 0.0, 4.0}, {-1, 1, 0, 1,1, 1314.0, 0.0, 0.0, -700.0, 0.0, 0.0}, { 0,-2, 2,-2,1, -1283.0, 0.0, 0.0, 672.0, 0.0, 0.0}, { 1, 0, 2, 2,1, -1331.0, 0.0, 8.0, 663.0, 0.0, 4.0}, {-2, 0, 2, 2,2, 1383.0, 0.0, -2.0, -594.0, 0.0, -2.0}, {-1, 0, 0, 0,2, 1405.0, 0.0, 4.0, -610.0, 0.0, 2.0}, { 1, 1, 2,-2,2, 1290.0, 0.0, 0.0, -556.0, 0.0, 0.0} }; /* Number of terms in the series */ const int NLS = (int) (sizeof x / sizeof x[0]); /*--------------------------------------------------------------------*/ /* Interval between fundamental epoch J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* --------------------*/ /* LUNI-SOLAR NUTATION */ /* --------------------*/ /* Fundamental (Delaunay) arguments from Simon et al. (1994) */ /* Mean anomaly of the Moon. */ el = fmod(485868.249036 + (1717915923.2178) * t, ERFA_TURNAS) * ERFA_DAS2R; /* Mean anomaly of the Sun. */ elp = fmod(1287104.79305 + (129596581.0481) * t, ERFA_TURNAS) * ERFA_DAS2R; /* Mean argument of the latitude of the Moon. */ f = fmod(335779.526232 + (1739527262.8478) * t, ERFA_TURNAS) * ERFA_DAS2R; /* Mean elongation of the Moon from the Sun. */ d = fmod(1072260.70369 + (1602961601.2090) * t, ERFA_TURNAS) * ERFA_DAS2R; /* Mean longitude of the ascending node of the Moon. */ om = fmod(450160.398036 + (-6962890.5431) * t, ERFA_TURNAS) * ERFA_DAS2R; /* Initialize the nutation values. */ dp = 0.0; de = 0.0; /* Summation of luni-solar nutation series (smallest terms first). */ for (i = NLS-1; i >= 0; i--) { /* Argument and functions. */ arg = fmod( (double)x[i].nl * el + (double)x[i].nlp * elp + (double)x[i].nf * f + (double)x[i].nd * d + (double)x[i].nom * om, ERFA_D2PI ); sarg = sin(arg); carg = cos(arg); /* Term. */ dp += (x[i].ps + x[i].pst * t) * sarg + x[i].pc * carg; de += (x[i].ec + x[i].ect * t) * carg + x[i].es * sarg; } /* Convert from 0.1 microarcsec units to radians. */ dpsils = dp * U2R; depsls = de * U2R; /* ------------------------------*/ /* IN LIEU OF PLANETARY NUTATION */ /* ------------------------------*/ /* Fixed offset to correct for missing terms in truncated series. */ dpsipl = DPPLAN; depspl = DEPLAN; /* --------*/ /* RESULTS */ /* --------*/ /* Add luni-solar and planetary components. */ *dpsi = dpsils + dpsipl; *deps = depsls + depspl; return; } void eraNut06a(double date1, double date2, double *dpsi, double *deps) /* ** - - - - - - - - - - ** e r a N u t 0 6 a ** - - - - - - - - - - ** ** IAU 2000A nutation with adjustments to match the IAU 2006 ** precession. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation, luni-solar + planetary (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components in longitude and obliquity are in radians ** and with respect to the mean equinox and ecliptic of date, ** IAU 2006 precession model (Hilton et al. 2006, Capitaine et al. ** 2005). ** ** 3) The function first computes the IAU 2000A nutation, then applies ** adjustments for (i) the consequences of the change in obliquity ** from the IAU 1980 ecliptic to the IAU 2006 ecliptic and (ii) the ** secular variation in the Earth's dynamical form factor J2. ** ** 4) The present function provides classical nutation, complementing ** the IAU 2000 frame bias and IAU 2006 precession. It delivers a ** pole which is at current epochs accurate to a few tens of ** microarcseconds, apart from the free core nutation. ** ** Called: ** eraNut00a nutation, IAU 2000A ** ** References: ** ** Chapront, J., Chapront-Touze, M. & Francou, G. 2002, ** Astron.Astrophys. 387, 700 ** ** Lieske, J.H., Lederle, T., Fricke, W. & Morando, B. 1977, ** Astron.Astrophys. 58, 1-16 ** ** Mathews, P.M., Herring, T.A., Buffet, B.A. 2002, J.Geophys.Res. ** 107, B4. The MHB_2000 code itself was obtained on 9th September ** 2002 from ftp//maia.usno.navy.mil/conv2000/chapter5/IAU2000A. ** ** Simon, J.-L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G., Laskar, J. 1994, Astron.Astrophys. 282, 663-683 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M. 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Wallace, P.T., "Software for Implementing the IAU 2000 ** Resolutions", in IERS Workshop 5.1 (2002) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, fj2, dp, de; /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Factor correcting for secular variation of J2. */ fj2 = -2.7774e-6 * t; /* Obtain IAU 2000A nutation. */ eraNut00a(date1, date2, &dp, &de); /* Apply P03 adjustments (Wallace & Capitaine, 2006, Eqs.5). */ *dpsi = dp + dp * (0.4697e-6 + fj2); *deps = de + de * fj2; return; } void eraNut80(double date1, double date2, double *dpsi, double *deps) /* ** - - - - - - - - - ** e r a N u t 8 0 ** - - - - - - - - - ** ** Nutation, IAU 1980 model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi double nutation in longitude (radians) ** deps double nutation in obliquity (radians) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components are with respect to the ecliptic of ** date. ** ** Called: ** eraAnpm normalize angle into range +/- pi ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.222 (p111). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, el, elp, f, d, om, dp, de, arg, s, c; int j; /* Units of 0.1 milliarcsecond to radians */ const double U2R = ERFA_DAS2R / 1e4; /* ------------------------------------------------ */ /* Table of multiples of arguments and coefficients */ /* ------------------------------------------------ */ /* The units for the sine and cosine coefficients are 0.1 mas and */ /* the same per Julian century */ static const struct { int nl,nlp,nf,nd,nom; /* coefficients of l,l',F,D,Om */ double sp,spt; /* longitude sine, 1 and t coefficients */ double ce,cet; /* obliquity cosine, 1 and t coefficients */ } x[] = { /* 1-10 */ { 0, 0, 0, 0, 1, -171996.0, -174.2, 92025.0, 8.9 }, { 0, 0, 0, 0, 2, 2062.0, 0.2, -895.0, 0.5 }, { -2, 0, 2, 0, 1, 46.0, 0.0, -24.0, 0.0 }, { 2, 0, -2, 0, 0, 11.0, 0.0, 0.0, 0.0 }, { -2, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, { 1, -1, 0, -1, 0, -3.0, 0.0, 0.0, 0.0 }, { 0, -2, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, { 2, 0, -2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, { 0, 0, 2, -2, 2, -13187.0, -1.6, 5736.0, -3.1 }, { 0, 1, 0, 0, 0, 1426.0, -3.4, 54.0, -0.1 }, /* 11-20 */ { 0, 1, 2, -2, 2, -517.0, 1.2, 224.0, -0.6 }, { 0, -1, 2, -2, 2, 217.0, -0.5, -95.0, 0.3 }, { 0, 0, 2, -2, 1, 129.0, 0.1, -70.0, 0.0 }, { 2, 0, 0, -2, 0, 48.0, 0.0, 1.0, 0.0 }, { 0, 0, 2, -2, 0, -22.0, 0.0, 0.0, 0.0 }, { 0, 2, 0, 0, 0, 17.0, -0.1, 0.0, 0.0 }, { 0, 1, 0, 0, 1, -15.0, 0.0, 9.0, 0.0 }, { 0, 2, 2, -2, 2, -16.0, 0.1, 7.0, 0.0 }, { 0, -1, 0, 0, 1, -12.0, 0.0, 6.0, 0.0 }, { -2, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, /* 21-30 */ { 0, -1, 2, -2, 1, -5.0, 0.0, 3.0, 0.0 }, { 2, 0, 0, -2, 1, 4.0, 0.0, -2.0, 0.0 }, { 0, 1, 2, -2, 1, 4.0, 0.0, -2.0, 0.0 }, { 1, 0, 0, -1, 0, -4.0, 0.0, 0.0, 0.0 }, { 2, 1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, { 0, 0, -2, 2, 1, 1.0, 0.0, 0.0, 0.0 }, { 0, 1, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, { 0, 1, 0, 0, 2, 1.0, 0.0, 0.0, 0.0 }, { -1, 0, 0, 1, 1, 1.0, 0.0, 0.0, 0.0 }, { 0, 1, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, /* 31-40 */ { 0, 0, 2, 0, 2, -2274.0, -0.2, 977.0, -0.5 }, { 1, 0, 0, 0, 0, 712.0, 0.1, -7.0, 0.0 }, { 0, 0, 2, 0, 1, -386.0, -0.4, 200.0, 0.0 }, { 1, 0, 2, 0, 2, -301.0, 0.0, 129.0, -0.1 }, { 1, 0, 0, -2, 0, -158.0, 0.0, -1.0, 0.0 }, { -1, 0, 2, 0, 2, 123.0, 0.0, -53.0, 0.0 }, { 0, 0, 0, 2, 0, 63.0, 0.0, -2.0, 0.0 }, { 1, 0, 0, 0, 1, 63.0, 0.1, -33.0, 0.0 }, { -1, 0, 0, 0, 1, -58.0, -0.1, 32.0, 0.0 }, { -1, 0, 2, 2, 2, -59.0, 0.0, 26.0, 0.0 }, /* 41-50 */ { 1, 0, 2, 0, 1, -51.0, 0.0, 27.0, 0.0 }, { 0, 0, 2, 2, 2, -38.0, 0.0, 16.0, 0.0 }, { 2, 0, 0, 0, 0, 29.0, 0.0, -1.0, 0.0 }, { 1, 0, 2, -2, 2, 29.0, 0.0, -12.0, 0.0 }, { 2, 0, 2, 0, 2, -31.0, 0.0, 13.0, 0.0 }, { 0, 0, 2, 0, 0, 26.0, 0.0, -1.0, 0.0 }, { -1, 0, 2, 0, 1, 21.0, 0.0, -10.0, 0.0 }, { -1, 0, 0, 2, 1, 16.0, 0.0, -8.0, 0.0 }, { 1, 0, 0, -2, 1, -13.0, 0.0, 7.0, 0.0 }, { -1, 0, 2, 2, 1, -10.0, 0.0, 5.0, 0.0 }, /* 51-60 */ { 1, 1, 0, -2, 0, -7.0, 0.0, 0.0, 0.0 }, { 0, 1, 2, 0, 2, 7.0, 0.0, -3.0, 0.0 }, { 0, -1, 2, 0, 2, -7.0, 0.0, 3.0, 0.0 }, { 1, 0, 2, 2, 2, -8.0, 0.0, 3.0, 0.0 }, { 1, 0, 0, 2, 0, 6.0, 0.0, 0.0, 0.0 }, { 2, 0, 2, -2, 2, 6.0, 0.0, -3.0, 0.0 }, { 0, 0, 0, 2, 1, -6.0, 0.0, 3.0, 0.0 }, { 0, 0, 2, 2, 1, -7.0, 0.0, 3.0, 0.0 }, { 1, 0, 2, -2, 1, 6.0, 0.0, -3.0, 0.0 }, { 0, 0, 0, -2, 1, -5.0, 0.0, 3.0, 0.0 }, /* 61-70 */ { 1, -1, 0, 0, 0, 5.0, 0.0, 0.0, 0.0 }, { 2, 0, 2, 0, 1, -5.0, 0.0, 3.0, 0.0 }, { 0, 1, 0, -2, 0, -4.0, 0.0, 0.0, 0.0 }, { 1, 0, -2, 0, 0, 4.0, 0.0, 0.0, 0.0 }, { 0, 0, 0, 1, 0, -4.0, 0.0, 0.0, 0.0 }, { 1, 1, 0, 0, 0, -3.0, 0.0, 0.0, 0.0 }, { 1, 0, 2, 0, 0, 3.0, 0.0, 0.0, 0.0 }, { 1, -1, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, { -1, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, { -2, 0, 0, 0, 1, -2.0, 0.0, 1.0, 0.0 }, /* 71-80 */ { 3, 0, 2, 0, 2, -3.0, 0.0, 1.0, 0.0 }, { 0, -1, 2, 2, 2, -3.0, 0.0, 1.0, 0.0 }, { 1, 1, 2, 0, 2, 2.0, 0.0, -1.0, 0.0 }, { -1, 0, 2, -2, 1, -2.0, 0.0, 1.0, 0.0 }, { 2, 0, 0, 0, 1, 2.0, 0.0, -1.0, 0.0 }, { 1, 0, 0, 0, 2, -2.0, 0.0, 1.0, 0.0 }, { 3, 0, 0, 0, 0, 2.0, 0.0, 0.0, 0.0 }, { 0, 0, 2, 1, 2, 2.0, 0.0, -1.0, 0.0 }, { -1, 0, 0, 0, 2, 1.0, 0.0, -1.0, 0.0 }, { 1, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, /* 81-90 */ { -2, 0, 2, 2, 2, 1.0, 0.0, -1.0, 0.0 }, { -1, 0, 2, 4, 2, -2.0, 0.0, 1.0, 0.0 }, { 2, 0, 0, -4, 0, -1.0, 0.0, 0.0, 0.0 }, { 1, 1, 2, -2, 2, 1.0, 0.0, -1.0, 0.0 }, { 1, 0, 2, 2, 1, -1.0, 0.0, 1.0, 0.0 }, { -2, 0, 2, 4, 2, -1.0, 0.0, 1.0, 0.0 }, { -1, 0, 4, 0, 2, 1.0, 0.0, 0.0, 0.0 }, { 1, -1, 0, -2, 0, 1.0, 0.0, 0.0, 0.0 }, { 2, 0, 2, -2, 1, 1.0, 0.0, -1.0, 0.0 }, { 2, 0, 2, 2, 2, -1.0, 0.0, 0.0, 0.0 }, /* 91-100 */ { 1, 0, 0, 2, 1, -1.0, 0.0, 0.0, 0.0 }, { 0, 0, 4, -2, 2, 1.0, 0.0, 0.0, 0.0 }, { 3, 0, 2, -2, 2, 1.0, 0.0, 0.0, 0.0 }, { 1, 0, 2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, { 0, 1, 2, 0, 1, 1.0, 0.0, 0.0, 0.0 }, { -1, -1, 0, 2, 1, 1.0, 0.0, 0.0, 0.0 }, { 0, 0, -2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, { 0, 0, 2, -1, 2, -1.0, 0.0, 0.0, 0.0 }, { 0, 1, 0, 2, 0, -1.0, 0.0, 0.0, 0.0 }, { 1, 0, -2, -2, 0, -1.0, 0.0, 0.0, 0.0 }, /* 101-106 */ { 0, -1, 2, 0, 1, -1.0, 0.0, 0.0, 0.0 }, { 1, 1, 0, -2, 1, -1.0, 0.0, 0.0, 0.0 }, { 1, 0, -2, 2, 0, -1.0, 0.0, 0.0, 0.0 }, { 2, 0, 0, 2, 0, 1.0, 0.0, 0.0, 0.0 }, { 0, 0, 2, 4, 2, -1.0, 0.0, 0.0, 0.0 }, { 0, 1, 0, 1, 0, 1.0, 0.0, 0.0, 0.0 } }; /* Number of terms in the series */ const int NT = (int) (sizeof x / sizeof x[0]); /*--------------------------------------------------------------------*/ /* Interval between fundamental epoch J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* --------------------- */ /* Fundamental arguments */ /* --------------------- */ /* Mean longitude of Moon minus mean longitude of Moon's perigee. */ el = eraAnpm( (485866.733 + (715922.633 + (31.310 + 0.064 * t) * t) * t) * ERFA_DAS2R + fmod(1325.0 * t, 1.0) * ERFA_D2PI); /* Mean longitude of Sun minus mean longitude of Sun's perigee. */ elp = eraAnpm( (1287099.804 + (1292581.224 + (-0.577 - 0.012 * t) * t) * t) * ERFA_DAS2R + fmod(99.0 * t, 1.0) * ERFA_D2PI); /* Mean longitude of Moon minus mean longitude of Moon's node. */ f = eraAnpm( (335778.877 + (295263.137 + (-13.257 + 0.011 * t) * t) * t) * ERFA_DAS2R + fmod(1342.0 * t, 1.0) * ERFA_D2PI); /* Mean elongation of Moon from Sun. */ d = eraAnpm( (1072261.307 + (1105601.328 + (-6.891 + 0.019 * t) * t) * t) * ERFA_DAS2R + fmod(1236.0 * t, 1.0) * ERFA_D2PI); /* Longitude of the mean ascending node of the lunar orbit on the */ /* ecliptic, measured from the mean equinox of date. */ om = eraAnpm( (450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t) * ERFA_DAS2R + fmod(-5.0 * t, 1.0) * ERFA_D2PI); /* --------------- */ /* Nutation series */ /* --------------- */ /* Initialize nutation components. */ dp = 0.0; de = 0.0; /* Sum the nutation terms, ending with the biggest. */ for (j = NT-1; j >= 0; j--) { /* Form argument for current term. */ arg = (double)x[j].nl * el + (double)x[j].nlp * elp + (double)x[j].nf * f + (double)x[j].nd * d + (double)x[j].nom * om; /* Accumulate current nutation term. */ s = x[j].sp + x[j].spt * t; c = x[j].ce + x[j].cet * t; if (s != 0.0) dp += s * sin(arg); if (c != 0.0) de += c * cos(arg); } /* Convert results from 0.1 mas units to radians. */ *dpsi = dp * U2R; *deps = de * U2R; return; } void eraNutm80(double date1, double date2, double rmatn[3][3]) /* ** - - - - - - - - - - ** e r a N u t m 8 0 ** - - - - - - - - - - ** ** Form the matrix of nutation for a given date, IAU 1980 model. ** ** Given: ** date1,date2 double TDB date (Note 1) ** ** Returned: ** rmatn double[3][3] nutation matrix ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(true) = rmatn * V(mean), ** where the p-vector V(true) is with respect to the true ** equatorial triad of date and the p-vector V(mean) is with ** respect to the mean equatorial triad of date. ** ** Called: ** eraNut80 nutation, IAU 1980 ** eraObl80 mean obliquity, IAU 1980 ** eraNumat form nutation matrix ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsi, deps, epsa; /* Nutation components and mean obliquity. */ eraNut80(date1, date2, &dpsi, &deps); epsa = eraObl80(date1, date2); /* Build the rotation matrix. */ eraNumat(epsa, dpsi, deps, rmatn); return; } double eraObl06(double date1, double date2) /* ** - - - - - - - - - ** e r a O b l 0 6 ** - - - - - - - - - ** ** Mean obliquity of the ecliptic, IAU 2006 precession model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double obliquity of the ecliptic (radians, Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result is the angle between the ecliptic and mean equator of ** date date1+date2. ** ** Reference: ** ** Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, eps0; /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Mean obliquity. */ eps0 = (84381.406 + (-46.836769 + ( -0.0001831 + ( 0.00200340 + ( -0.000000576 + ( -0.0000000434) * t) * t) * t) * t) * t) * ERFA_DAS2R; return eps0; } double eraObl80(double date1, double date2) /* ** - - - - - - - - - ** e r a O b l 8 0 ** - - - - - - - - - ** ** Mean obliquity of the ecliptic, IAU 1980 model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double obliquity of the ecliptic (radians, Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The result is the angle between the ecliptic and mean equator of ** date date1+date2. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Expression 3.222-1 (p114). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, eps0; /* Interval between fundamental epoch J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Mean obliquity of date. */ eps0 = ERFA_DAS2R * (84381.448 + (-46.8150 + (-0.00059 + ( 0.001813) * t) * t) * t); return eps0; } void eraP06e(double date1, double date2, double *eps0, double *psia, double *oma, double *bpa, double *bqa, double *pia, double *bpia, double *epsa, double *chia, double *za, double *zetaa, double *thetaa, double *pa, double *gam, double *phi, double *psi) /* ** - - - - - - - - ** e r a P 0 6 e ** - - - - - - - - ** ** Precession angles, IAU 2006, equinox based. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (see Note 2): ** eps0 double epsilon_0 ** psia double psi_A ** oma double omega_A ** bpa double P_A ** bqa double Q_A ** pia double pi_A ** bpia double Pi_A ** epsa double obliquity epsilon_A ** chia double chi_A ** za double z_A ** zetaa double zeta_A ** thetaa double theta_A ** pa double p_A ** gam double F-W angle gamma_J2000 ** phi double F-W angle phi_J2000 ** psi double F-W angle psi_J2000 ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) This function returns the set of equinox based angles for the ** Capitaine et al. "P03" precession theory, adopted by the IAU in ** 2006. The angles are set out in Table 1 of Hilton et al. (2006): ** ** eps0 epsilon_0 obliquity at J2000.0 ** psia psi_A luni-solar precession ** oma omega_A inclination of equator wrt J2000.0 ecliptic ** bpa P_A ecliptic pole x, J2000.0 ecliptic triad ** bqa Q_A ecliptic pole -y, J2000.0 ecliptic triad ** pia pi_A angle between moving and J2000.0 ecliptics ** bpia Pi_A longitude of ascending node of the ecliptic ** epsa epsilon_A obliquity of the ecliptic ** chia chi_A planetary precession ** za z_A equatorial precession: -3rd 323 Euler angle ** zetaa zeta_A equatorial precession: -1st 323 Euler angle ** thetaa theta_A equatorial precession: 2nd 323 Euler angle ** pa p_A general precession ** gam gamma_J2000 J2000.0 RA difference of ecliptic poles ** phi phi_J2000 J2000.0 codeclination of ecliptic pole ** psi psi_J2000 longitude difference of equator poles, J2000.0 ** ** The returned values are all radians. ** ** 3) Hilton et al. (2006) Table 1 also contains angles that depend on ** models distinct from the P03 precession theory itself, namely the ** IAU 2000A frame bias and nutation. The quoted polynomials are ** used in other ERFA functions: ** ** . eraXy06 contains the polynomial parts of the X and Y series. ** ** . eraS06 contains the polynomial part of the s+XY/2 series. ** ** . eraPfw06 implements the series for the Fukushima-Williams ** angles that are with respect to the GCRS pole (i.e. the variants ** that include frame bias). ** ** 4) The IAU resolution stipulated that the choice of parameterization ** was left to the user, and so an IAU compliant precession ** implementation can be constructed using various combinations of ** the angles returned by the present function. ** ** 5) The parameterization used by ERFA is the version of the Fukushima- ** Williams angles that refers directly to the GCRS pole. These ** angles may be calculated by calling the function eraPfw06. ERFA ** also supports the direct computation of the CIP GCRS X,Y by ** series, available by calling eraXy06. ** ** 6) The agreement between the different parameterizations is at the ** 1 microarcsecond level in the present era. ** ** 7) When constructing a precession formulation that refers to the GCRS ** pole rather than the dynamical pole, it may (depending on the ** choice of angles) be necessary to introduce the frame bias ** explicitly. ** ** 8) It is permissible to re-use the same variable in the returned ** arguments. The quantities are stored in the stated order. ** ** Reference: ** ** Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351 ** ** Called: ** eraObl06 mean obliquity, IAU 2006 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t; /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Obliquity at J2000.0. */ *eps0 = 84381.406 * ERFA_DAS2R; /* Luni-solar precession. */ *psia = ( 5038.481507 + ( -1.0790069 + ( -0.00114045 + ( 0.000132851 + ( -0.0000000951 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Inclination of mean equator with respect to the J2000.0 ecliptic. */ *oma = *eps0 + ( -0.025754 + ( 0.0512623 + ( -0.00772503 + ( -0.000000467 + ( 0.0000003337 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Ecliptic pole x, J2000.0 ecliptic triad. */ *bpa = ( 4.199094 + ( 0.1939873 + ( -0.00022466 + ( -0.000000912 + ( 0.0000000120 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Ecliptic pole -y, J2000.0 ecliptic triad. */ *bqa = ( -46.811015 + ( 0.0510283 + ( 0.00052413 + ( -0.000000646 + ( -0.0000000172 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Angle between moving and J2000.0 ecliptics. */ *pia = ( 46.998973 + ( -0.0334926 + ( -0.00012559 + ( 0.000000113 + ( -0.0000000022 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Longitude of ascending node of the moving ecliptic. */ *bpia = ( 629546.7936 + ( -867.95758 + ( 0.157992 + ( -0.0005371 + ( -0.00004797 + ( 0.000000072 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; /* Mean obliquity of the ecliptic. */ *epsa = eraObl06(date1, date2); /* Planetary precession. */ *chia = ( 10.556403 + ( -2.3814292 + ( -0.00121197 + ( 0.000170663 + ( -0.0000000560 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Equatorial precession: minus the third of the 323 Euler angles. */ *za = ( -2.650545 + ( 2306.077181 + ( 1.0927348 + ( 0.01826837 + ( -0.000028596 + ( -0.0000002904 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; /* Equatorial precession: minus the first of the 323 Euler angles. */ *zetaa = ( 2.650545 + ( 2306.083227 + ( 0.2988499 + ( 0.01801828 + ( -0.000005971 + ( -0.0000003173 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; /* Equatorial precession: second of the 323 Euler angles. */ *thetaa = ( 2004.191903 + ( -0.4294934 + ( -0.04182264 + ( -0.000007089 + ( -0.0000001274 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* General precession. */ *pa = ( 5028.796195 + ( 1.1054348 + ( 0.00007964 + ( -0.000023857 + ( 0.0000000383 ) * t) * t) * t) * t) * t * ERFA_DAS2R; /* Fukushima-Williams angles for precession. */ *gam = ( 10.556403 + ( 0.4932044 + ( -0.00031238 + ( -0.000002788 + ( 0.0000000260 ) * t) * t) * t) * t) * t * ERFA_DAS2R; *phi = *eps0 + ( -46.811015 + ( 0.0511269 + ( 0.00053289 + ( -0.000000440 + ( -0.0000000176 ) * t) * t) * t) * t) * t * ERFA_DAS2R; *psi = ( 5038.481507 + ( 1.5584176 + ( -0.00018522 + ( -0.000026452 + ( -0.0000000148 ) * t) * t) * t) * t) * t * ERFA_DAS2R; return; } void eraP2pv(double p[3], double pv[2][3]) /* ** - - - - - - - - ** e r a P 2 p v ** - - - - - - - - ** ** Extend a p-vector to a pv-vector by appending a zero velocity. ** ** Given: ** p double[3] p-vector ** ** Returned: ** pv double[2][3] pv-vector ** ** Called: ** eraCp copy p-vector ** eraZp zero p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraCp(p, pv[0]); eraZp(pv[1]); return; } void eraP2s(double p[3], double *theta, double *phi, double *r) /* ** - - - - - - - ** e r a P 2 s ** - - - - - - - ** ** P-vector to spherical polar coordinates. ** ** Given: ** p double[3] p-vector ** ** Returned: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** r double radial distance ** ** Notes: ** ** 1) If P is null, zero theta, phi and r are returned. ** ** 2) At either pole, zero theta is returned. ** ** Called: ** eraC2s p-vector to spherical ** eraPm modulus of p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraC2s(p, theta, phi); *r = eraPm(p); return; } double eraPap(double a[3], double b[3]) /* ** - - - - - - - ** e r a P a p ** - - - - - - - ** ** Position-angle from two p-vectors. ** ** Given: ** a double[3] direction of reference point ** b double[3] direction of point whose PA is required ** ** Returned (function value): ** double position angle of b with respect to a (radians) ** ** Notes: ** ** 1) The result is the position angle, in radians, of direction b with ** respect to direction a. It is in the range -pi to +pi. The ** sense is such that if b is a small distance "north" of a the ** position angle is approximately zero, and if b is a small ** distance "east" of a the position angle is approximately +pi/2. ** ** 2) The vectors a and b need not be of unit length. ** ** 3) Zero is returned if the two directions are the same or if either ** vector is null. ** ** 4) If vector a is at a pole, the result is ill-defined. ** ** Called: ** eraPn decompose p-vector into modulus and direction ** eraPm modulus of p-vector ** eraPxp vector product of two p-vectors ** eraPmp p-vector minus p-vector ** eraPdp scalar product of two p-vectors ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double am, au[3], bm, st, ct, xa, ya, za, eta[3], xi[3], a2b[3], pa; /* Modulus and direction of the a vector. */ eraPn(a, &am, au); /* Modulus of the b vector. */ bm = eraPm(b); /* Deal with the case of a null vector. */ if ((am == 0.0) || (bm == 0.0)) { st = 0.0; ct = 1.0; } else { /* The "north" axis tangential from a (arbitrary length). */ xa = a[0]; ya = a[1]; za = a[2]; eta[0] = -xa * za; eta[1] = -ya * za; eta[2] = xa*xa + ya*ya; /* The "east" axis tangential from a (same length). */ eraPxp(eta, au, xi); /* The vector from a to b. */ eraPmp(b, a, a2b); /* Resolve into components along the north and east axes. */ st = eraPdp(a2b, xi); ct = eraPdp(a2b, eta); /* Deal with degenerate cases. */ if ((st == 0.0) && (ct == 0.0)) ct = 1.0; } /* Position angle. */ pa = atan2(st, ct); return pa; } double eraPas(double al, double ap, double bl, double bp) /* ** - - - - - - - ** e r a P a s ** - - - - - - - ** ** Position-angle from spherical coordinates. ** ** Given: ** al double longitude of point A (e.g. RA) in radians ** ap double latitude of point A (e.g. Dec) in radians ** bl double longitude of point B ** bp double latitude of point B ** ** Returned (function value): ** double position angle of B with respect to A ** ** Notes: ** ** 1) The result is the bearing (position angle), in radians, of point ** B with respect to point A. It is in the range -pi to +pi. The ** sense is such that if B is a small distance "east" of point A, ** the bearing is approximately +pi/2. ** ** 2) Zero is returned if the two points are coincident. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dl, x, y, pa; dl = bl - al; y = sin(dl) * cos(bp); x = sin(bp) * cos(ap) - cos(bp) * sin(ap) * cos(dl); pa = ((x != 0.0) || (y != 0.0)) ? atan2(y, x) : 0.0; return pa; } void eraPb06(double date1, double date2, double *bzeta, double *bz, double *btheta) /* ** - - - - - - - - ** e r a P b 0 6 ** - - - - - - - - ** ** This function forms three Euler angles which implement general ** precession from epoch J2000.0, using the IAU 2006 model. Frame ** bias (the offset between ICRS and mean J2000.0) is included. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** bzeta double 1st rotation: radians cw around z ** bz double 3rd rotation: radians cw around z ** btheta double 2nd rotation: radians ccw around y ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The traditional accumulated precession angles zeta_A, z_A, ** theta_A cannot be obtained in the usual way, namely through ** polynomial expressions, because of the frame bias. The latter ** means that two of the angles undergo rapid changes near this ** date. They are instead the results of decomposing the ** precession-bias matrix obtained by using the Fukushima-Williams ** method, which does not suffer from the problem. The ** decomposition returns values which can be used in the ** conventional formulation and which include frame bias. ** ** 3) The three angles are returned in the conventional order, which ** is not the same as the order of the corresponding Euler ** rotations. The precession-bias matrix is ** R_3(-z) x R_2(+theta) x R_3(-zeta). ** ** 4) Should zeta_A, z_A, theta_A angles be required that do not ** contain frame bias, they are available by calling the ERFA ** function eraP06e. ** ** Called: ** eraPmat06 PB matrix, IAU 2006 ** eraRz rotate around Z-axis ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r[3][3], r31, r32; /* Precession matrix via Fukushima-Williams angles. */ eraPmat06(date1, date2, r); /* Solve for z. */ *bz = atan2(r[1][2], r[0][2]); /* Remove it from the matrix. */ eraRz(*bz, r); /* Solve for the remaining two angles. */ *bzeta = atan2 (r[1][0], r[1][1]); r31 = r[2][0]; r32 = r[2][1]; *btheta = atan2(-ERFA_DSIGN(sqrt(r31 * r31 + r32 * r32), r[0][2]), r[2][2]); return; } double eraPdp(double a[3], double b[3]) /* ** - - - - - - - ** e r a P d p ** - - - - - - - ** ** p-vector inner (=scalar=dot) product. ** ** Given: ** a double[3] first p-vector ** b double[3] second p-vector ** ** Returned (function value): ** double a . b ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w; w = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; return w; } void eraPfw06(double date1, double date2, double *gamb, double *phib, double *psib, double *epsa) /* ** - - - - - - - - - ** e r a P f w 0 6 ** - - - - - - - - - ** ** Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation). ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** gamb double F-W angle gamma_bar (radians) ** phib double F-W angle phi_bar (radians) ** psib double F-W angle psi_bar (radians) ** epsa double F-W angle epsilon_A (radians) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) Naming the following points: ** ** e = J2000.0 ecliptic pole, ** p = GCRS pole, ** E = mean ecliptic pole of date, ** and P = mean pole of date, ** ** the four Fukushima-Williams angles are as follows: ** ** gamb = gamma_bar = epE ** phib = phi_bar = pE ** psib = psi_bar = pEP ** epsa = epsilon_A = EP ** ** 3) The matrix representing the combined effects of frame bias and ** precession is: ** ** PxB = R_1(-epsa).R_3(-psib).R_1(phib).R_3(gamb) ** ** 4) The matrix representing the combined effects of frame bias, ** precession and nutation is simply: ** ** NxPxB = R_1(-epsa-dE).R_3(-psib-dP).R_1(phib).R_3(gamb) ** ** where dP and dE are the nutation components with respect to the ** ecliptic of date. ** ** Reference: ** ** Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351 ** ** Called: ** eraObl06 mean obliquity, IAU 2006 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t; /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* P03 bias+precession angles. */ *gamb = ( -0.052928 + ( 10.556378 + ( 0.4932044 + ( -0.00031238 + ( -0.000002788 + ( 0.0000000260 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; *phib = ( 84381.412819 + ( -46.811016 + ( 0.0511268 + ( 0.00053289 + ( -0.000000440 + ( -0.0000000176 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; *psib = ( -0.041775 + ( 5038.481484 + ( 1.5584175 + ( -0.00018522 + ( -0.000026452 + ( -0.0000000148 ) * t) * t) * t) * t) * t) * ERFA_DAS2R; *epsa = eraObl06(date1, date2); return; } int eraPlan94(double date1, double date2, int np, double pv[2][3]) /* ** - - - - - - - - - - ** e r a P l a n 9 4 ** - - - - - - - - - - ** ** Approximate heliocentric position and velocity of a nominated major ** planet: Mercury, Venus, EMB, Mars, Jupiter, Saturn, Uranus or ** Neptune (but not the Earth itself). ** ** Given: ** date1 double TDB date part A (Note 1) ** date2 double TDB date part B (Note 1) ** np int planet (1=Mercury, 2=Venus, 3=EMB, 4=Mars, ** 5=Jupiter, 6=Saturn, 7=Uranus, 8=Neptune) ** ** Returned (argument): ** pv double[2][3] planet p,v (heliocentric, J2000.0, AU,AU/d) ** ** Returned (function value): ** int status: -1 = illegal NP (outside 1-8) ** 0 = OK ** +1 = warning: year outside 1000-3000 ** +2 = warning: failed to converge ** ** Notes: ** ** 1) The date date1+date2 is in the TDB time scale (in practice TT can ** be used) and is a Julian Date, apportioned in any convenient way ** between the two arguments. For example, JD(TDB)=2450123.7 could ** be expressed in any of these ways, among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in cases ** where the loss of several decimal digits of resolution is ** acceptable. The J2000 method is best matched to the way the ** argument is handled internally and will deliver the optimum ** resolution. The MJD method and the date & time methods are both ** good compromises between resolution and convenience. The limited ** accuracy of the present algorithm is such that any of the methods ** is satisfactory. ** ** 2) If an np value outside the range 1-8 is supplied, an error status ** (function value -1) is returned and the pv vector set to zeroes. ** ** 3) For np=3 the result is for the Earth-Moon Barycenter. To obtain ** the heliocentric position and velocity of the Earth, use instead ** the ERFA function eraEpv00. ** ** 4) On successful return, the array pv contains the following: ** ** pv[0][0] x } ** pv[0][1] y } heliocentric position, AU ** pv[0][2] z } ** ** pv[1][0] xdot } ** pv[1][1] ydot } heliocentric velocity, AU/d ** pv[1][2] zdot } ** ** The reference frame is equatorial and is with respect to the ** mean equator and equinox of epoch J2000.0. ** ** 5) The algorithm is due to J.L. Simon, P. Bretagnon, J. Chapront, ** M. Chapront-Touze, G. Francou and J. Laskar (Bureau des ** Longitudes, Paris, France). From comparisons with JPL ** ephemeris DE102, they quote the following maximum errors ** over the interval 1800-2050: ** ** L (arcsec) B (arcsec) R (km) ** ** Mercury 4 1 300 ** Venus 5 1 800 ** EMB 6 1 1000 ** Mars 17 1 7700 ** Jupiter 71 5 76000 ** Saturn 81 13 267000 ** Uranus 86 7 712000 ** Neptune 11 1 253000 ** ** Over the interval 1000-3000, they report that the accuracy is no ** worse than 1.5 times that over 1800-2050. Outside 1000-3000 the ** accuracy declines. ** ** Comparisons of the present function with the JPL DE200 ephemeris ** give the following RMS errors over the interval 1960-2025: ** ** position (km) velocity (m/s) ** ** Mercury 334 0.437 ** Venus 1060 0.855 ** EMB 2010 0.815 ** Mars 7690 1.98 ** Jupiter 71700 7.70 ** Saturn 199000 19.4 ** Uranus 564000 16.4 ** Neptune 158000 14.4 ** ** Comparisons against DE200 over the interval 1800-2100 gave the ** following maximum absolute differences. (The results using ** DE406 were essentially the same.) ** ** L (arcsec) B (arcsec) R (km) Rdot (m/s) ** ** Mercury 7 1 500 0.7 ** Venus 7 1 1100 0.9 ** EMB 9 1 1300 1.0 ** Mars 26 1 9000 2.5 ** Jupiter 78 6 82000 8.2 ** Saturn 87 14 263000 24.6 ** Uranus 86 7 661000 27.4 ** Neptune 11 2 248000 21.4 ** ** 6) The present ERFA re-implementation of the original Simon et al. ** Fortran code differs from the original in the following respects: ** ** * C instead of Fortran. ** ** * The date is supplied in two parts. ** ** * The result is returned only in equatorial Cartesian form; ** the ecliptic longitude, latitude and radius vector are not ** returned. ** ** * The result is in the J2000.0 equatorial frame, not ecliptic. ** ** * More is done in-line: there are fewer calls to subroutines. ** ** * Different error/warning status values are used. ** ** * A different Kepler's-equation-solver is used (avoiding ** use of double precision complex). ** ** * Polynomials in t are nested to minimize rounding errors. ** ** * Explicit double constants are used to avoid mixed-mode ** expressions. ** ** None of the above changes affects the result significantly. ** ** 7) The returned status indicates the most serious condition ** encountered during execution of the function. Illegal np is ** considered the most serious, overriding failure to converge, ** which in turn takes precedence over the remote date warning. ** ** Called: ** eraAnp normalize angle into range 0 to 2pi ** ** Reference: Simon, J.L, Bretagnon, P., Chapront, J., ** Chapront-Touze, M., Francou, G., and Laskar, J., ** Astron. Astrophys. 282, 663 (1994). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Gaussian constant */ static const double GK = 0.017202098950; /* Sin and cos of J2000.0 mean obliquity (IAU 1976) */ static const double SINEPS = 0.3977771559319137; static const double COSEPS = 0.9174820620691818; /* Maximum number of iterations allowed to solve Kepler's equation */ static const int KMAX = 10; int jstat, i, k; double t, da, dl, de, dp, di, dom, dmu, arga, argl, am, ae, dae, ae2, at, r, v, si2, xq, xp, tl, xsw, xcw, xm2, xf, ci2, xms, xmc, xpxq2, x, y, z; /* Planetary inverse masses */ static const double amas[] = { 6023600.0, /* Mercury */ 408523.5, /* Venus */ 328900.5, /* EMB */ 3098710.0, /* Mars */ 1047.355, /* Jupiter */ 3498.5, /* Saturn */ 22869.0, /* Uranus */ 19314.0 }; /* Neptune */ /* ** Tables giving the mean Keplerian elements, limited to t^2 terms: ** ** a semi-major axis (AU) ** dlm mean longitude (degree and arcsecond) ** e eccentricity ** pi longitude of the perihelion (degree and arcsecond) ** dinc inclination (degree and arcsecond) ** omega longitude of the ascending node (degree and arcsecond) */ static const double a[][3] = { { 0.3870983098, 0.0, 0.0 }, /* Mercury */ { 0.7233298200, 0.0, 0.0 }, /* Venus */ { 1.0000010178, 0.0, 0.0 }, /* EMB */ { 1.5236793419, 3e-10, 0.0 }, /* Mars */ { 5.2026032092, 19132e-10, -39e-10 }, /* Jupiter */ { 9.5549091915, -0.0000213896, 444e-10 }, /* Saturn */ { 19.2184460618, -3716e-10, 979e-10 }, /* Uranus */ { 30.1103868694, -16635e-10, 686e-10 } /* Neptune */ }; static const double dlm[][3] = { { 252.25090552, 5381016286.88982, -1.92789 }, { 181.97980085, 2106641364.33548, 0.59381 }, { 100.46645683, 1295977422.83429, -2.04411 }, { 355.43299958, 689050774.93988, 0.94264 }, { 34.35151874, 109256603.77991, -30.60378 }, { 50.07744430, 43996098.55732, 75.61614 }, { 314.05500511, 15424811.93933, -1.75083 }, { 304.34866548, 7865503.20744, 0.21103 } }; static const double e[][3] = { { 0.2056317526, 0.0002040653, -28349e-10 }, { 0.0067719164, -0.0004776521, 98127e-10 }, { 0.0167086342, -0.0004203654, -0.0000126734 }, { 0.0934006477, 0.0009048438, -80641e-10 }, { 0.0484979255, 0.0016322542, -0.0000471366 }, { 0.0555481426, -0.0034664062, -0.0000643639 }, { 0.0463812221, -0.0002729293, 0.0000078913 }, { 0.0094557470, 0.0000603263, 0.0 } }; static const double pi[][3] = { { 77.45611904, 5719.11590, -4.83016 }, { 131.56370300, 175.48640, -498.48184 }, { 102.93734808, 11612.35290, 53.27577 }, { 336.06023395, 15980.45908, -62.32800 }, { 14.33120687, 7758.75163, 259.95938 }, { 93.05723748, 20395.49439, 190.25952 }, { 173.00529106, 3215.56238, -34.09288 }, { 48.12027554, 1050.71912, 27.39717 } }; static const double dinc[][3] = { { 7.00498625, -214.25629, 0.28977 }, { 3.39466189, -30.84437, -11.67836 }, { 0.0, 469.97289, -3.35053 }, { 1.84972648, -293.31722, -8.11830 }, { 1.30326698, -71.55890, 11.95297 }, { 2.48887878, 91.85195, -17.66225 }, { 0.77319689, -60.72723, 1.25759 }, { 1.76995259, 8.12333, 0.08135 } }; static const double omega[][3] = { { 48.33089304, -4515.21727, -31.79892 }, { 76.67992019, -10008.48154, -51.32614 }, { 174.87317577, -8679.27034, 15.34191 }, { 49.55809321, -10620.90088, -230.57416 }, { 100.46440702, 6362.03561, 326.52178 }, { 113.66550252, -9240.19942, -66.23743 }, { 74.00595701, 2669.15033, 145.93964 }, { 131.78405702, -221.94322, -0.78728 } }; /* Tables for trigonometric terms to be added to the mean elements of */ /* the semi-major axes */ static const double kp[][9] = { { 69613, 75645, 88306, 59899, 15746, 71087, 142173, 3086, 0 }, { 21863, 32794, 26934, 10931, 26250, 43725, 53867, 28939, 0 }, { 16002, 21863, 32004, 10931, 14529, 16368, 15318, 32794, 0 }, { 6345, 7818, 15636, 7077, 8184, 14163, 1107, 4872, 0 }, { 1760, 1454, 1167, 880, 287, 2640, 19, 2047, 1454 }, { 574, 0, 880, 287, 19, 1760, 1167, 306, 574 }, { 204, 0, 177, 1265, 4, 385, 200, 208, 204 }, { 0, 102, 106, 4, 98, 1367, 487, 204, 0 } }; static const double ca[][9] = { { 4, -13, 11, -9, -9, -3, -1, 4, 0 }, { -156, 59, -42, 6, 19, -20, -10, -12, 0 }, { 64, -152, 62, -8, 32, -41, 19, -11, 0 }, { 124, 621, -145, 208, 54, -57, 30, 15, 0 }, { -23437, -2634, 6601, 6259, -1507,-1821, 2620, -2115, -1489 }, { 62911,-119919, 79336,17814,-24241,12068, 8306, -4893, 8902 }, { 389061,-262125,-44088, 8387,-22976,-2093, -615, -9720, 6633 }, { -412235,-157046,-31430,37817, -9740, -13, -7449, 9644, 0 } }; static const double sa[][9] = { { -29, -1, 9, 6, -6, 5, 4, 0, 0 }, { -48, -125, -26, -37, 18, -13, -20, -2, 0 }, { -150, -46, 68, 54, 14, 24, -28, 22, 0 }, { -621, 532, -694, -20, 192, -94, 71, -73, 0 }, { -14614,-19828, -5869, 1881, -4372, -2255, 782, 930, 913 }, { 139737, 0, 24667, 51123, -5102, 7429, -4095, -1976, -9566 }, { -138081, 0, 37205,-49039,-41901,-33872,-27037,-12474, 18797 }, { 0, 28492,133236, 69654, 52322,-49577,-26430, -3593, 0 } }; /* Tables giving the trigonometric terms to be added to the mean */ /* elements of the mean longitudes */ static const double kq[][10] = { { 3086,15746,69613,59899,75645,88306, 12661, 2658, 0, 0 }, { 21863,32794,10931, 73, 4387,26934, 1473, 2157, 0, 0 }, { 10,16002,21863,10931, 1473,32004, 4387, 73, 0, 0 }, { 10, 6345, 7818, 1107,15636, 7077, 8184, 532, 10, 0 }, { 19, 1760, 1454, 287, 1167, 880, 574, 2640, 19, 1454 }, { 19, 574, 287, 306, 1760, 12, 31, 38, 19, 574 }, { 4, 204, 177, 8, 31, 200, 1265, 102, 4, 204 }, { 4, 102, 106, 8, 98, 1367, 487, 204, 4, 102 } }; static const double cl[][10] = { { 21, -95, -157, 41, -5, 42, 23, 30, 0, 0 }, { -160, -313, -235, 60, -74, -76, -27, 34, 0, 0 }, { -325, -322, -79, 232, -52, 97, 55, -41, 0, 0 }, { 2268, -979, 802, 602, -668, -33, 345, 201, -55, 0 }, { 7610, -4997,-7689,-5841,-2617, 1115,-748,-607, 6074, 354 }, { -18549, 30125,20012, -730, 824, 23,1289,-352, -14767, -2062 }, { -135245,-14594, 4197,-4030,-5630,-2898,2540,-306, 2939, 1986 }, { 89948, 2103, 8963, 2695, 3682, 1648, 866,-154, -1963, -283 } }; static const double sl[][10] = { { -342, 136, -23, 62, 66, -52, -33, 17, 0, 0 }, { 524, -149, -35, 117, 151, 122, -71, -62, 0, 0 }, { -105, -137, 258, 35, -116, -88,-112, -80, 0, 0 }, { 854, -205, -936, -240, 140, -341, -97, -232, 536, 0 }, { -56980, 8016, 1012, 1448,-3024,-3710, 318, 503, 3767, 577 }, { 138606,-13478,-4964, 1441,-1319,-1482, 427, 1236, -9167, -1918 }, { 71234,-41116, 5334,-4935,-1848, 66, 434, -1748, 3780, -701 }, { -47645, 11647, 2166, 3194, 679, 0,-244, -419, -2531, 48 } }; /*--------------------------------------------------------------------*/ /* Validate the planet number. */ if ((np < 1) || (np > 8)) { jstat = -1; /* Reset the result in case of failure. */ for (k = 0; k < 2; k++) { for (i = 0; i < 3; i++) { pv[k][i] = 0.0; } } } else { /* Decrement the planet number to start at zero. */ np--; /* Time: Julian millennia since J2000.0. */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJM; /* OK status unless remote date. */ jstat = fabs(t) <= 1.0 ? 0 : 1; /* Compute the mean elements. */ da = a[np][0] + (a[np][1] + a[np][2] * t) * t; dl = (3600.0 * dlm[np][0] + (dlm[np][1] + dlm[np][2] * t) * t) * ERFA_DAS2R; de = e[np][0] + ( e[np][1] + e[np][2] * t) * t; dp = eraAnpm((3600.0 * pi[np][0] + (pi[np][1] + pi[np][2] * t) * t) * ERFA_DAS2R); di = (3600.0 * dinc[np][0] + (dinc[np][1] + dinc[np][2] * t) * t) * ERFA_DAS2R; dom = eraAnpm((3600.0 * omega[np][0] + (omega[np][1] + omega[np][2] * t) * t) * ERFA_DAS2R); /* Apply the trigonometric terms. */ dmu = 0.35953620 * t; for (k = 0; k < 8; k++) { arga = kp[np][k] * dmu; argl = kq[np][k] * dmu; da += (ca[np][k] * cos(arga) + sa[np][k] * sin(arga)) * 1e-7; dl += (cl[np][k] * cos(argl) + sl[np][k] * sin(argl)) * 1e-7; } arga = kp[np][8] * dmu; da += t * (ca[np][8] * cos(arga) + sa[np][8] * sin(arga)) * 1e-7; for (k = 8; k < 10; k++) { argl = kq[np][k] * dmu; dl += t * (cl[np][k] * cos(argl) + sl[np][k] * sin(argl)) * 1e-7; } dl = fmod(dl, ERFA_D2PI); /* Iterative soln. of Kepler's equation to get eccentric anomaly. */ am = dl - dp; ae = am + de * sin(am); k = 0; dae = 1.0; while (k < KMAX && fabs(dae) > 1e-12) { dae = (am - ae + de * sin(ae)) / (1.0 - de * cos(ae)); ae += dae; k++; if (k == KMAX-1) jstat = 2; } /* True anomaly. */ ae2 = ae / 2.0; at = 2.0 * atan2(sqrt((1.0 + de) / (1.0 - de)) * sin(ae2), cos(ae2)); /* Distance (AU) and speed (radians per day). */ r = da * (1.0 - de * cos(ae)); v = GK * sqrt((1.0 + 1.0 / amas[np]) / (da * da * da)); si2 = sin(di / 2.0); xq = si2 * cos(dom); xp = si2 * sin(dom); tl = at + dp; xsw = sin(tl); xcw = cos(tl); xm2 = 2.0 * (xp * xcw - xq * xsw); xf = da / sqrt(1 - de * de); ci2 = cos(di / 2.0); xms = (de * sin(dp) + xsw) * xf; xmc = (de * cos(dp) + xcw) * xf; xpxq2 = 2 * xp * xq; /* Position (J2000.0 ecliptic x,y,z in AU). */ x = r * (xcw - xm2 * xp); y = r * (xsw + xm2 * xq); z = r * (-xm2 * ci2); /* Rotate to equatorial. */ pv[0][0] = x; pv[0][1] = y * COSEPS - z * SINEPS; pv[0][2] = y * SINEPS + z * COSEPS; /* Velocity (J2000.0 ecliptic xdot,ydot,zdot in AU/d). */ x = v * (( -1.0 + 2.0 * xp * xp) * xms + xpxq2 * xmc); y = v * (( 1.0 - 2.0 * xq * xq) * xmc - xpxq2 * xms); z = v * (2.0 * ci2 * (xp * xms + xq * xmc)); /* Rotate to equatorial. */ pv[1][0] = x; pv[1][1] = y * COSEPS - z * SINEPS; pv[1][2] = y * SINEPS + z * COSEPS; } /* Return the status. */ return jstat; } double eraPm(double p[3]) /* ** - - - - - - ** e r a P m ** - - - - - - ** ** Modulus of p-vector. ** ** Given: ** p double[3] p-vector ** ** Returned (function value): ** double modulus ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w; w = sqrt( p[0] * p[0] + p[1] * p[1] + p[2] * p[2] ); return w; } void eraPmat00(double date1, double date2, double rbp[3][3]) /* ** - - - - - - - - - - ** e r a P m a t 0 0 ** - - - - - - - - - - ** ** Precession matrix (including frame bias) from GCRS to a specified ** date, IAU 2000 model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rbp double[3][3] bias-precession matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rbp * V(GCRS), where ** the p-vector V(GCRS) is with respect to the Geocentric Celestial ** Reference System (IAU, 2000) and the p-vector V(date) is with ** respect to the mean equatorial triad of the given date. ** ** Called: ** eraBp00 frame bias and precession matrices, IAU 2000 ** ** Reference: ** ** IAU: Trans. International Astronomical Union, Vol. XXIVB; Proc. ** 24th General Assembly, Manchester, UK. Resolutions B1.3, B1.6. ** (2000) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rb[3][3], rp[3][3]; /* Obtain the required matrix (discarding others). */ eraBp00(date1, date2, rb, rp, rbp); return; } void eraPmat06(double date1, double date2, double rbp[3][3]) /* ** - - - - - - - - - - ** e r a P m a t 0 6 ** - - - - - - - - - - ** ** Precession matrix (including frame bias) from GCRS to a specified ** date, IAU 2006 model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rbp double[3][3] bias-precession matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rbp * V(GCRS), where ** the p-vector V(GCRS) is with respect to the Geocentric Celestial ** Reference System (IAU, 2000) and the p-vector V(date) is with ** respect to the mean equatorial triad of the given date. ** ** Called: ** eraPfw06 bias-precession F-W angles, IAU 2006 ** eraFw2m F-W angles to r-matrix ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gamb, phib, psib, epsa; /* Bias-precession Fukushima-Williams angles. */ eraPfw06(date1, date2, &gamb, &phib, &psib, &epsa); /* Form the matrix. */ eraFw2m(gamb, phib, psib, epsa, rbp); return; } void eraPmat76(double date1, double date2, double rmatp[3][3]) /* ** - - - - - - - - - - ** e r a P m a t 7 6 ** - - - - - - - - - - ** ** Precession matrix from J2000.0 to a specified date, IAU 1976 model. ** ** Given: ** date1,date2 double ending date, TT (Note 1) ** ** Returned: ** rmatp double[3][3] precession matrix, J2000.0 -> date1+date2 ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = RMATP * V(J2000), ** where the p-vector V(J2000) is with respect to the mean ** equatorial triad of epoch J2000.0 and the p-vector V(date) ** is with respect to the mean equatorial triad of the given ** date. ** ** 3) Though the matrix method itself is rigorous, the precession ** angles are expressed through canonical polynomials which are ** valid only for a limited time span. In addition, the IAU 1976 ** precession rate is known to be imperfect. The absolute accuracy ** of the present formulation is better than 0.1 arcsec from ** 1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD, ** and remains below 3 arcsec for the whole of the period ** 500BC to 3000AD. The errors exceed 10 arcsec outside the ** range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to ** 5600AD and exceed 1000 arcsec outside 6800BC to 8200AD. ** ** Called: ** eraPrec76 accumulated precession angles, IAU 1976 ** eraIr initialize r-matrix to identity ** eraRz rotate around Z-axis ** eraRy rotate around Y-axis ** eraCr copy r-matrix ** ** References: ** ** Lieske, J.H., 1979, Astron.Astrophys. 73, 282. ** equations (6) & (7), p283. ** ** Kaplan,G.H., 1981. USNO circular no. 163, pA2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double zeta, z, theta, wmat[3][3]; /* Precession Euler angles, J2000.0 to specified date. */ eraPrec76(ERFA_DJ00, 0.0, date1, date2, &zeta, &z, &theta); /* Form the rotation matrix. */ eraIr( wmat); eraRz( -zeta, wmat); eraRy( theta, wmat); eraRz( -z, wmat); eraCr( wmat, rmatp); return; } void eraPmp(double a[3], double b[3], double amb[3]) /* ** - - - - - - - ** e r a P m p ** - - - - - - - ** ** P-vector subtraction. ** ** Given: ** a double[3] first p-vector ** b double[3] second p-vector ** ** Returned: ** amb double[3] a - b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { amb[0] = a[0] - b[0]; amb[1] = a[1] - b[1]; amb[2] = a[2] - b[2]; return; } void eraPn(double p[3], double *r, double u[3]) /* ** - - - - - - ** e r a P n ** - - - - - - ** ** Convert a p-vector into modulus and unit vector. ** ** Given: ** p double[3] p-vector ** ** Returned: ** r double modulus ** u double[3] unit vector ** ** Notes: ** ** 1) If p is null, the result is null. Otherwise the result is a unit ** vector. ** ** 2) It is permissible to re-use the same array for any of the ** arguments. ** ** Called: ** eraPm modulus of p-vector ** eraZp zero p-vector ** eraSxp multiply p-vector by scalar ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w; /* Obtain the modulus and test for zero. */ w = eraPm(p); if (w == 0.0) { /* Null vector. */ eraZp(u); } else { /* Unit vector. */ eraSxp(1.0/w, p, u); } /* Return the modulus. */ *r = w; return; } void eraPn00(double date1, double date2, double dpsi, double deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]) /* ** - - - - - - - - ** e r a P n 0 0 ** - - - - - - - - ** ** Precession-nutation, IAU 2000 model: a multi-purpose function, ** supporting classical (equinox-based) use directly and CIO-based ** use indirectly. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** dpsi,deps double nutation (Note 2) ** ** Returned: ** epsa double mean obliquity (Note 3) ** rb double[3][3] frame bias matrix (Note 4) ** rp double[3][3] precession matrix (Note 5) ** rbp double[3][3] bias-precession matrix (Note 6) ** rn double[3][3] nutation matrix (Note 7) ** rbpn double[3][3] GCRS-to-true matrix (Note 8) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The caller is responsible for providing the nutation components; ** they are in longitude and obliquity, in radians and are with ** respect to the equinox and ecliptic of date. For high-accuracy ** applications, free core nutation should be included as well as ** any other relevant corrections to the position of the CIP. ** ** 3) The returned mean obliquity is consistent with the IAU 2000 ** precession-nutation models. ** ** 4) The matrix rb transforms vectors from GCRS to J2000.0 mean ** equator and equinox by applying frame bias. ** ** 5) The matrix rp transforms vectors from J2000.0 mean equator and ** equinox to mean equator and equinox of date by applying ** precession. ** ** 6) The matrix rbp transforms vectors from GCRS to mean equator and ** equinox of date by applying frame bias then precession. It is ** the product rp x rb. ** ** 7) The matrix rn transforms vectors from mean equator and equinox of ** date to true equator and equinox of date by applying the nutation ** (luni-solar + planetary). ** ** 8) The matrix rbpn transforms vectors from GCRS to true equator and ** equinox of date. It is the product rn x rbp, applying frame ** bias, precession and nutation in that order. ** ** 9) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the order given. ** ** Called: ** eraPr00 IAU 2000 precession adjustments ** eraObl80 mean obliquity, IAU 1980 ** eraBp00 frame bias and precession matrices, IAU 2000 ** eraCr copy r-matrix ** eraNumat form nutation matrix ** eraRxr product of two r-matrices ** ** Reference: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsipr, depspr, rbpw[3][3], rnw[3][3]; /* IAU 2000 precession-rate adjustments. */ eraPr00(date1, date2, &dpsipr, &depspr); /* Mean obliquity, consistent with IAU 2000 precession-nutation. */ *epsa = eraObl80(date1, date2) + depspr; /* Frame bias and precession matrices and their product. */ eraBp00(date1, date2, rb, rp, rbpw); eraCr(rbpw, rbp); /* Nutation matrix. */ eraNumat(*epsa, dpsi, deps, rnw); eraCr(rnw, rn); /* Bias-precession-nutation matrix (classical). */ eraRxr(rnw, rbpw, rbpn); return; } void eraPn00a(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]) /* ** - - - - - - - - - ** e r a P n 0 0 a ** - - - - - - - - - ** ** Precession-nutation, IAU 2000A model: a multi-purpose function, ** supporting classical (equinox-based) use directly and CIO-based ** use indirectly. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation (Note 2) ** epsa double mean obliquity (Note 3) ** rb double[3][3] frame bias matrix (Note 4) ** rp double[3][3] precession matrix (Note 5) ** rbp double[3][3] bias-precession matrix (Note 6) ** rn double[3][3] nutation matrix (Note 7) ** rbpn double[3][3] GCRS-to-true matrix (Notes 8,9) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components (luni-solar + planetary, IAU 2000A) in ** longitude and obliquity are in radians and with respect to the ** equinox and ecliptic of date. Free core nutation is omitted; ** for the utmost accuracy, use the eraPn00 function, where the ** nutation components are caller-specified. For faster but ** slightly less accurate results, use the eraPn00b function. ** ** 3) The mean obliquity is consistent with the IAU 2000 precession. ** ** 4) The matrix rb transforms vectors from GCRS to J2000.0 mean ** equator and equinox by applying frame bias. ** ** 5) The matrix rp transforms vectors from J2000.0 mean equator and ** equinox to mean equator and equinox of date by applying ** precession. ** ** 6) The matrix rbp transforms vectors from GCRS to mean equator and ** equinox of date by applying frame bias then precession. It is ** the product rp x rb. ** ** 7) The matrix rn transforms vectors from mean equator and equinox ** of date to true equator and equinox of date by applying the ** nutation (luni-solar + planetary). ** ** 8) The matrix rbpn transforms vectors from GCRS to true equator and ** equinox of date. It is the product rn x rbp, applying frame ** bias, precession and nutation in that order. ** ** 9) The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate ** Pole are elements (3,1-3) of the matrix rbpn. ** ** 10) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the order given. ** ** Called: ** eraNut00a nutation, IAU 2000A ** eraPn00 bias/precession/nutation results, IAU 2000 ** ** Reference: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Nutation. */ eraNut00a(date1, date2, dpsi, deps); /* Remaining results. */ eraPn00(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn); return; } void eraPn00b(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]) /* ** - - - - - - - - - ** e r a P n 0 0 b ** - - - - - - - - - ** ** Precession-nutation, IAU 2000B model: a multi-purpose function, ** supporting classical (equinox-based) use directly and CIO-based ** use indirectly. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation (Note 2) ** epsa double mean obliquity (Note 3) ** rb double[3][3] frame bias matrix (Note 4) ** rp double[3][3] precession matrix (Note 5) ** rbp double[3][3] bias-precession matrix (Note 6) ** rn double[3][3] nutation matrix (Note 7) ** rbpn double[3][3] GCRS-to-true matrix (Notes 8,9) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components (luni-solar + planetary, IAU 2000B) in ** longitude and obliquity are in radians and with respect to the ** equinox and ecliptic of date. For more accurate results, but ** at the cost of increased computation, use the eraPn00a function. ** For the utmost accuracy, use the eraPn00 function, where the ** nutation components are caller-specified. ** ** 3) The mean obliquity is consistent with the IAU 2000 precession. ** ** 4) The matrix rb transforms vectors from GCRS to J2000.0 mean ** equator and equinox by applying frame bias. ** ** 5) The matrix rp transforms vectors from J2000.0 mean equator and ** equinox to mean equator and equinox of date by applying ** precession. ** ** 6) The matrix rbp transforms vectors from GCRS to mean equator and ** equinox of date by applying frame bias then precession. It is ** the product rp x rb. ** ** 7) The matrix rn transforms vectors from mean equator and equinox ** of date to true equator and equinox of date by applying the ** nutation (luni-solar + planetary). ** ** 8) The matrix rbpn transforms vectors from GCRS to true equator and ** equinox of date. It is the product rn x rbp, applying frame ** bias, precession and nutation in that order. ** ** 9) The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate ** Pole are elements (3,1-3) of the matrix rbpn. ** ** 10) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the stated order. ** ** Called: ** eraNut00b nutation, IAU 2000B ** eraPn00 bias/precession/nutation results, IAU 2000 ** ** Reference: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003). ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Nutation. */ eraNut00b(date1, date2, dpsi, deps); /* Remaining results. */ eraPn00(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn); return; } void eraPn06(double date1, double date2, double dpsi, double deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]) /* ** - - - - - - - - ** e r a P n 0 6 ** - - - - - - - - ** ** Precession-nutation, IAU 2006 model: a multi-purpose function, ** supporting classical (equinox-based) use directly and CIO-based use ** indirectly. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** dpsi,deps double nutation (Note 2) ** ** Returned: ** epsa double mean obliquity (Note 3) ** rb double[3][3] frame bias matrix (Note 4) ** rp double[3][3] precession matrix (Note 5) ** rbp double[3][3] bias-precession matrix (Note 6) ** rn double[3][3] nutation matrix (Note 7) ** rbpn double[3][3] GCRS-to-true matrix (Note 8) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The caller is responsible for providing the nutation components; ** they are in longitude and obliquity, in radians and are with ** respect to the equinox and ecliptic of date. For high-accuracy ** applications, free core nutation should be included as well as ** any other relevant corrections to the position of the CIP. ** ** 3) The returned mean obliquity is consistent with the IAU 2006 ** precession. ** ** 4) The matrix rb transforms vectors from GCRS to J2000.0 mean ** equator and equinox by applying frame bias. ** ** 5) The matrix rp transforms vectors from J2000.0 mean equator and ** equinox to mean equator and equinox of date by applying ** precession. ** ** 6) The matrix rbp transforms vectors from GCRS to mean equator and ** equinox of date by applying frame bias then precession. It is ** the product rp x rb. ** ** 7) The matrix rn transforms vectors from mean equator and equinox ** of date to true equator and equinox of date by applying the ** nutation (luni-solar + planetary). ** ** 8) The matrix rbpn transforms vectors from GCRS to true equator and ** equinox of date. It is the product rn x rbp, applying frame ** bias, precession and nutation in that order. ** ** 9) The X,Y,Z coordinates of the IAU 2000B Celestial Intermediate ** Pole are elements (3,1-3) of the matrix rbpn. ** ** 10) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the stated order. ** ** Called: ** eraPfw06 bias-precession F-W angles, IAU 2006 ** eraFw2m F-W angles to r-matrix ** eraCr copy r-matrix ** eraTr transpose r-matrix ** eraRxr product of two r-matrices ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gamb, phib, psib, eps, r1[3][3], r2[3][3], rt[3][3]; /* Bias-precession Fukushima-Williams angles of J2000.0 = frame bias. */ eraPfw06(ERFA_DJM0, ERFA_DJM00, &gamb, &phib, &psib, &eps); /* B matrix. */ eraFw2m(gamb, phib, psib, eps, r1); eraCr(r1, rb); /* Bias-precession Fukushima-Williams angles of date. */ eraPfw06(date1, date2, &gamb, &phib, &psib, &eps); /* Bias-precession matrix. */ eraFw2m(gamb, phib, psib, eps, r2); eraCr(r2, rbp); /* Solve for precession matrix. */ eraTr(r1, rt); eraRxr(r2, rt, rp); /* Equinox-based bias-precession-nutation matrix. */ eraFw2m(gamb, phib, psib + dpsi, eps + deps, r1); eraCr(r1, rbpn); /* Solve for nutation matrix. */ eraTr(r2, rt); eraRxr(r1, rt, rn); /* Obliquity, mean of date. */ *epsa = eps; return; } void eraPn06a(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]) /* ** - - - - - - - - - ** e r a P n 0 6 a ** - - - - - - - - - ** ** Precession-nutation, IAU 2006/2000A models: a multi-purpose function, ** supporting classical (equinox-based) use directly and CIO-based use ** indirectly. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsi,deps double nutation (Note 2) ** epsa double mean obliquity (Note 3) ** rb double[3][3] frame bias matrix (Note 4) ** rp double[3][3] precession matrix (Note 5) ** rbp double[3][3] bias-precession matrix (Note 6) ** rn double[3][3] nutation matrix (Note 7) ** rbpn double[3][3] GCRS-to-true matrix (Notes 8,9) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The nutation components (luni-solar + planetary, IAU 2000A) in ** longitude and obliquity are in radians and with respect to the ** equinox and ecliptic of date. Free core nutation is omitted; ** for the utmost accuracy, use the eraPn06 function, where the ** nutation components are caller-specified. ** ** 3) The mean obliquity is consistent with the IAU 2006 precession. ** ** 4) The matrix rb transforms vectors from GCRS to mean J2000.0 by ** applying frame bias. ** ** 5) The matrix rp transforms vectors from mean J2000.0 to mean of ** date by applying precession. ** ** 6) The matrix rbp transforms vectors from GCRS to mean of date by ** applying frame bias then precession. It is the product rp x rb. ** ** 7) The matrix rn transforms vectors from mean of date to true of ** date by applying the nutation (luni-solar + planetary). ** ** 8) The matrix rbpn transforms vectors from GCRS to true of date ** (CIP/equinox). It is the product rn x rbp, applying frame bias, ** precession and nutation in that order. ** ** 9) The X,Y,Z coordinates of the IAU 2006/2000A Celestial ** Intermediate Pole are elements (1,1-3) of the matrix rbpn. ** ** 10) It is permissible to re-use the same array in the returned ** arguments. The arrays are filled in the stated order. ** ** Called: ** eraNut06a nutation, IAU 2006/2000A ** eraPn06 bias/precession/nutation results, IAU 2006 ** ** Reference: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Nutation. */ eraNut06a(date1, date2, dpsi, deps); /* Remaining results. */ eraPn06(date1, date2, *dpsi, *deps, epsa, rb, rp, rbp, rn, rbpn); return; } void eraPnm00a(double date1, double date2, double rbpn[3][3]) /* ** - - - - - - - - - - ** e r a P n m 0 0 a ** - - - - - - - - - - ** ** Form the matrix of precession-nutation for a given date (including ** frame bias), equinox-based, IAU 2000A model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rbpn double[3][3] classical NPB matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where ** the p-vector V(date) is with respect to the true equatorial triad ** of date date1+date2 and the p-vector V(GCRS) is with respect to ** the Geocentric Celestial Reference System (IAU, 2000). ** ** 3) A faster, but slightly less accurate result (about 1 mas), can be ** obtained by using instead the eraPnm00b function. ** ** Called: ** eraPn00a bias/precession/nutation, IAU 2000A ** ** Reference: ** ** IAU: Trans. International Astronomical Union, Vol. XXIVB; Proc. ** 24th General Assembly, Manchester, UK. Resolutions B1.3, B1.6. ** (2000) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3]; /* Obtain the required matrix (discarding other results). */ eraPn00a(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn); return; } void eraPnm00b(double date1, double date2, double rbpn[3][3]) /* ** - - - - - - - - - - ** e r a P n m 0 0 b ** - - - - - - - - - - ** ** Form the matrix of precession-nutation for a given date (including ** frame bias), equinox-based, IAU 2000B model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rbpn double[3][3] bias-precession-nutation matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rbpn * V(GCRS), where ** the p-vector V(date) is with respect to the true equatorial triad ** of date date1+date2 and the p-vector V(GCRS) is with respect to ** the Geocentric Celestial Reference System (IAU, 2000). ** ** 3) The present function is faster, but slightly less accurate (about ** 1 mas), than the eraPnm00a function. ** ** Called: ** eraPn00b bias/precession/nutation, IAU 2000B ** ** Reference: ** ** IAU: Trans. International Astronomical Union, Vol. XXIVB; Proc. ** 24th General Assembly, Manchester, UK. Resolutions B1.3, B1.6. ** (2000) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dpsi, deps, epsa, rb[3][3], rp[3][3], rbp[3][3], rn[3][3]; /* Obtain the required matrix (discarding other results). */ eraPn00b(date1, date2, &dpsi, &deps, &epsa, rb, rp, rbp, rn, rbpn); return; } void eraPnm06a(double date1, double date2, double rnpb[3][3]) /* ** - - - - - - - - - - ** e r a P n m 0 6 a ** - - - - - - - - - - ** ** Form the matrix of precession-nutation for a given date (including ** frame bias), IAU 2006 precession and IAU 2000A nutation models. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** rnpb double[3][3] bias-precession-nutation matrix (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rnpb * V(GCRS), where ** the p-vector V(date) is with respect to the true equatorial triad ** of date date1+date2 and the p-vector V(GCRS) is with respect to ** the Geocentric Celestial Reference System (IAU, 2000). ** ** Called: ** eraPfw06 bias-precession F-W angles, IAU 2006 ** eraNut06a nutation, IAU 2006/2000A ** eraFw2m F-W angles to r-matrix ** ** Reference: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double gamb, phib, psib, epsa, dp, de; /* Fukushima-Williams angles for frame bias and precession. */ eraPfw06(date1, date2, &gamb, &phib, &psib, &epsa); /* Nutation components. */ eraNut06a(date1, date2, &dp, &de); /* Equinox based nutation x precession x bias matrix. */ eraFw2m(gamb, phib, psib + dp, epsa + de, rnpb); return; } void eraPnm80(double date1, double date2, double rmatpn[3][3]) /* ** - - - - - - - - - ** e r a P n m 8 0 ** - - - - - - - - - ** ** Form the matrix of precession/nutation for a given date, IAU 1976 ** precession model, IAU 1980 nutation model. ** ** Given: ** date1,date2 double TDB date (Note 1) ** ** Returned: ** rmatpn double[3][3] combined precession/nutation matrix ** ** Notes: ** ** 1) The TDB date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TDB)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The matrix operates in the sense V(date) = rmatpn * V(J2000), ** where the p-vector V(date) is with respect to the true equatorial ** triad of date date1+date2 and the p-vector V(J2000) is with ** respect to the mean equatorial triad of epoch J2000.0. ** ** Called: ** eraPmat76 precession matrix, IAU 1976 ** eraNutm80 nutation matrix, IAU 1980 ** eraRxr product of two r-matrices ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992), ** Section 3.3 (p145). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rmatp[3][3], rmatn[3][3]; /* Precession matrix, J2000.0 to date. */ eraPmat76(date1, date2, rmatp); /* Nutation matrix. */ eraNutm80(date1, date2, rmatn); /* Combine the matrices: PN = N x P. */ eraRxr(rmatn, rmatp, rmatpn); return; } void eraPom00(double xp, double yp, double sp, double rpom[3][3]) /* ** - - - - - - - - - - ** e r a P o m 0 0 ** - - - - - - - - - - ** ** Form the matrix of polar motion for a given date, IAU 2000. ** ** Given: ** xp,yp double coordinates of the pole (radians, Note 1) ** sp double the TIO locator s' (radians, Note 2) ** ** Returned: ** rpom double[3][3] polar-motion matrix (Note 3) ** ** Notes: ** ** 1) The arguments xp and yp are the coordinates (in radians) of the ** Celestial Intermediate Pole with respect to the International ** Terrestrial Reference System (see IERS Conventions 2003), ** measured along the meridians to 0 and 90 deg west respectively. ** ** 2) The argument sp is the TIO locator s', in radians, which ** positions the Terrestrial Intermediate Origin on the equator. It ** is obtained from polar motion observations by numerical ** integration, and so is in essence unpredictable. However, it is ** dominated by a secular drift of about 47 microarcseconds per ** century, and so can be taken into account by using s' = -47*t, ** where t is centuries since J2000.0. The function eraSp00 ** implements this approximation. ** ** 3) The matrix operates in the sense V(TRS) = rpom * V(CIP), meaning ** that it is the final rotation when computing the pointing ** direction to a celestial source. ** ** Called: ** eraIr initialize r-matrix to identity ** eraRz rotate around Z-axis ** eraRy rotate around Y-axis ** eraRx rotate around X-axis ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Construct the matrix. */ eraIr(rpom); eraRz(sp, rpom); eraRy(-xp, rpom); eraRx(-yp, rpom); return; } void eraPpp(double a[3], double b[3], double apb[3]) /* ** - - - - - - - ** e r a P p p ** - - - - - - - ** ** P-vector addition. ** ** Given: ** a double[3] first p-vector ** b double[3] second p-vector ** ** Returned: ** apb double[3] a + b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { apb[0] = a[0] + b[0]; apb[1] = a[1] + b[1]; apb[2] = a[2] + b[2]; return; } void eraPpsp(double a[3], double s, double b[3], double apsb[3]) /* ** - - - - - - - - ** e r a P p s p ** - - - - - - - - ** ** P-vector plus scaled p-vector. ** ** Given: ** a double[3] first p-vector ** s double scalar (multiplier for b) ** b double[3] second p-vector ** ** Returned: ** apsb double[3] a + s*b ** ** Note: ** It is permissible for any of a, b and apsb to be the same array. ** ** Called: ** eraSxp multiply p-vector by scalar ** eraPpp p-vector plus p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double sb[3]; /* s*b. */ eraSxp(s, b, sb); /* a + s*b. */ eraPpp(a, sb, apsb); return; } void eraPr00(double date1, double date2, double *dpsipr, double *depspr) /* ** - - - - - - - - ** e r a P r 0 0 ** - - - - - - - - ** ** Precession-rate part of the IAU 2000 precession-nutation models ** (part of MHB2000). ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** dpsipr,depspr double precession corrections (Notes 2,3) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The precession adjustments are expressed as "nutation ** components", corrections in longitude and obliquity with respect ** to the J2000.0 equinox and ecliptic. ** ** 3) Although the precession adjustments are stated to be with respect ** to Lieske et al. (1977), the MHB2000 model does not specify which ** set of Euler angles are to be used and how the adjustments are to ** be applied. The most literal and straightforward procedure is to ** adopt the 4-rotation epsilon_0, psi_A, omega_A, xi_A option, and ** to add dpsipr to psi_A and depspr to both omega_A and eps_A. ** ** 4) This is an implementation of one aspect of the IAU 2000A nutation ** model, formally adopted by the IAU General Assembly in 2000, ** namely MHB2000 (Mathews et al. 2002). ** ** References: ** ** Lieske, J.H., Lederle, T., Fricke, W. & Morando, B., "Expressions ** for the precession quantities based upon the IAU (1976) System of ** Astronomical Constants", Astron.Astrophys., 58, 1-16 (1977) ** ** Mathews, P.M., Herring, T.A., Buffet, B.A., "Modeling of nutation ** and precession New nutation series for nonrigid Earth and ** insights into the Earth's interior", J.Geophys.Res., 107, B4, ** 2002. The MHB2000 code itself was obtained on 9th September 2002 ** from ftp://maia.usno.navy.mil/conv2000/chapter5/IAU2000A. ** ** Wallace, P.T., "Software for Implementing the IAU 2000 ** Resolutions", in IERS Workshop 5.1 (2002). ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t; /* Precession and obliquity corrections (radians per century) */ static const double PRECOR = -0.29965 * ERFA_DAS2R, OBLCOR = -0.02524 * ERFA_DAS2R; /* Interval between fundamental epoch J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Precession rate contributions with respect to IAU 1976/80. */ *dpsipr = PRECOR * t; *depspr = OBLCOR * t; return; } void eraPrec76(double ep01, double ep02, double ep11, double ep12, double *zeta, double *z, double *theta) /* ** - - - - - - - - - - ** e r a P r e c 7 6 ** - - - - - - - - - - ** ** IAU 1976 precession model. ** ** This function forms the three Euler angles which implement general ** precession between two epochs, using the IAU 1976 model (as for ** the FK5 catalog). ** ** Given: ** ep01,ep02 double TDB starting epoch (Note 1) ** ep11,ep12 double TDB ending epoch (Note 1) ** ** Returned: ** zeta double 1st rotation: radians cw around z ** z double 3rd rotation: radians cw around z ** theta double 2nd rotation: radians ccw around y ** ** Notes: ** ** 1) The epochs ep01+ep02 and ep11+ep12 are Julian Dates, apportioned ** in any convenient way between the arguments epn1 and epn2. For ** example, JD(TDB)=2450123.7 could be expressed in any of these ** ways, among others: ** ** epn1 epn2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in cases ** where the loss of several decimal digits of resolution is ** acceptable. The J2000 method is best matched to the way the ** argument is handled internally and will deliver the optimum ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** The two epochs may be expressed using different methods, but at ** the risk of losing some resolution. ** ** 2) The accumulated precession angles zeta, z, theta are expressed ** through canonical polynomials which are valid only for a limited ** time span. In addition, the IAU 1976 precession rate is known to ** be imperfect. The absolute accuracy of the present formulation ** is better than 0.1 arcsec from 1960AD to 2040AD, better than ** 1 arcsec from 1640AD to 2360AD, and remains below 3 arcsec for ** the whole of the period 500BC to 3000AD. The errors exceed ** 10 arcsec outside the range 1200BC to 3900AD, exceed 100 arcsec ** outside 4200BC to 5600AD and exceed 1000 arcsec outside 6800BC to ** 8200AD. ** ** 3) The three angles are returned in the conventional order, which ** is not the same as the order of the corresponding Euler ** rotations. The precession matrix is ** R_3(-z) x R_2(+theta) x R_3(-zeta). ** ** Reference: ** ** Lieske, J.H., 1979, Astron.Astrophys. 73, 282, equations ** (6) & (7), p283. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t0, t, tas2r, w; /* Interval between fundamental epoch J2000.0 and start epoch (JC). */ t0 = ((ep01 - ERFA_DJ00) + ep02) / ERFA_DJC; /* Interval over which precession required (JC). */ t = ((ep11 - ep01) + (ep12 - ep02)) / ERFA_DJC; /* Euler angles. */ tas2r = t * ERFA_DAS2R; w = 2306.2181 + (1.39656 - 0.000139 * t0) * t0; *zeta = (w + ((0.30188 - 0.000344 * t0) + 0.017998 * t) * t) * tas2r; *z = (w + ((1.09468 + 0.000066 * t0) + 0.018203 * t) * t) * tas2r; *theta = ((2004.3109 + (-0.85330 - 0.000217 * t0) * t0) + ((-0.42665 - 0.000217 * t0) - 0.041833 * t) * t) * tas2r; return; } void eraPv2p(double pv[2][3], double p[3]) /* ** - - - - - - - - ** e r a P v 2 p ** - - - - - - - - ** ** Discard velocity component of a pv-vector. ** ** Given: ** pv double[2][3] pv-vector ** ** Returned: ** p double[3] p-vector ** ** Called: ** eraCp copy p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraCp(pv[0], p); return; } void eraPv2s(double pv[2][3], double *theta, double *phi, double *r, double *td, double *pd, double *rd) /* ** - - - - - - - - ** e r a P v 2 s ** - - - - - - - - ** ** Convert position/velocity from Cartesian to spherical coordinates. ** ** Given: ** pv double[2][3] pv-vector ** ** Returned: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** r double radial distance ** td double rate of change of theta ** pd double rate of change of phi ** rd double rate of change of r ** ** Notes: ** ** 1) If the position part of pv is null, theta, phi, td and pd ** are indeterminate. This is handled by extrapolating the ** position through unit time by using the velocity part of ** pv. This moves the origin without changing the direction ** of the velocity component. If the position and velocity ** components of pv are both null, zeroes are returned for all ** six results. ** ** 2) If the position is a pole, theta, td and pd are indeterminate. ** In such cases zeroes are returned for all three. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y, z, xd, yd, zd, rxy2, rxy, r2, rtrue, rw, xyp; /* Components of position/velocity vector. */ x = pv[0][0]; y = pv[0][1]; z = pv[0][2]; xd = pv[1][0]; yd = pv[1][1]; zd = pv[1][2]; /* Component of r in XY plane squared. */ rxy2 = x*x + y*y; /* Modulus squared. */ r2 = rxy2 + z*z; /* Modulus. */ rtrue = sqrt(r2); /* If null vector, move the origin along the direction of movement. */ rw = rtrue; if (rtrue == 0.0) { x = xd; y = yd; z = zd; rxy2 = x*x + y*y; r2 = rxy2 + z*z; rw = sqrt(r2); } /* Position and velocity in spherical coordinates. */ rxy = sqrt(rxy2); xyp = x*xd + y*yd; if (rxy2 != 0.0) { *theta = atan2(y, x); *phi = atan2(z, rxy); *td = (x*yd - y*xd) / rxy2; *pd = (zd*rxy2 - z*xyp) / (r2*rxy); } else { *theta = 0.0; *phi = (z != 0.0) ? atan2(z, rxy) : 0.0; *td = 0.0; *pd = 0.0; } *r = rtrue; *rd = (rw != 0.0) ? (xyp + z*zd) / rw : 0.0; return; } void eraPvdpv(double a[2][3], double b[2][3], double adb[2]) /* ** - - - - - - - - - ** e r a P v d p v ** - - - - - - - - - ** ** Inner (=scalar=dot) product of two pv-vectors. ** ** Given: ** a double[2][3] first pv-vector ** b double[2][3] second pv-vector ** ** Returned: ** adb double[2] a . b (see note) ** ** Note: ** ** If the position and velocity components of the two pv-vectors are ** ( ap, av ) and ( bp, bv ), the result, a . b, is the pair of ** numbers ( ap . bp , ap . bv + av . bp ). The two numbers are the ** dot-product of the two p-vectors and its derivative. ** ** Called: ** eraPdp scalar product of two p-vectors ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double adbd, addb; /* a . b = constant part of result. */ adb[0] = eraPdp(a[0], b[0]); /* a . bdot */ adbd = eraPdp(a[0], b[1]); /* adot . b */ addb = eraPdp(a[1], b[0]); /* Velocity part of result. */ adb[1] = adbd + addb; return; } void eraPvm(double pv[2][3], double *r, double *s) /* ** - - - - - - - ** e r a P v m ** - - - - - - - ** ** Modulus of pv-vector. ** ** Given: ** pv double[2][3] pv-vector ** ** Returned: ** r double modulus of position component ** s double modulus of velocity component ** ** Called: ** eraPm modulus of p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Distance. */ *r = eraPm(pv[0]); /* Speed. */ *s = eraPm(pv[1]); return; } void eraPvmpv(double a[2][3], double b[2][3], double amb[2][3]) /* ** - - - - - - - - - ** e r a P v m p v ** - - - - - - - - - ** ** Subtract one pv-vector from another. ** ** Given: ** a double[2][3] first pv-vector ** b double[2][3] second pv-vector ** ** Returned: ** amb double[2][3] a - b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Called: ** eraPmp p-vector minus p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraPmp(a[0], b[0], amb[0]); eraPmp(a[1], b[1], amb[1]); return; } void eraPvppv(double a[2][3], double b[2][3], double apb[2][3]) /* ** - - - - - - - - - ** e r a P v p p v ** - - - - - - - - - ** ** Add one pv-vector to another. ** ** Given: ** a double[2][3] first pv-vector ** b double[2][3] second pv-vector ** ** Returned: ** apb double[2][3] a + b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Called: ** eraPpp p-vector plus p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraPpp(a[0], b[0], apb[0]); eraPpp(a[1], b[1], apb[1]); return; } int eraPvstar(double pv[2][3], double *ra, double *dec, double *pmr, double *pmd, double *px, double *rv) /* ** - - - - - - - - - - ** e r a P v s t a r ** - - - - - - - - - - ** ** Convert star position+velocity vector to catalog coordinates. ** ** Given (Note 1): ** pv double[2][3] pv-vector (AU, AU/day) ** ** Returned (Note 2): ** ra double right ascension (radians) ** dec double declination (radians) ** pmr double RA proper motion (radians/year) ** pmd double Dec proper motion (radians/year) ** px double parallax (arcsec) ** rv double radial velocity (km/s, positive = receding) ** ** Returned (function value): ** int status: ** 0 = OK ** -1 = superluminal speed (Note 5) ** -2 = null position vector ** ** Notes: ** ** 1) The specified pv-vector is the coordinate direction (and its rate ** of change) for the date at which the light leaving the star ** reached the solar-system barycenter. ** ** 2) The star data returned by this function are "observables" for an ** imaginary observer at the solar-system barycenter. Proper motion ** and radial velocity are, strictly, in terms of barycentric ** coordinate time, TCB. For most practical applications, it is ** permissible to neglect the distinction between TCB and ordinary ** "proper" time on Earth (TT/TAI). The result will, as a rule, be ** limited by the intrinsic accuracy of the proper-motion and ** radial-velocity data; moreover, the supplied pv-vector is likely ** to be merely an intermediate result (for example generated by the ** function eraStarpv), so that a change of time unit will cancel ** out overall. ** ** In accordance with normal star-catalog conventions, the object's ** right ascension and declination are freed from the effects of ** secular aberration. The frame, which is aligned to the catalog ** equator and equinox, is Lorentzian and centered on the SSB. ** ** Summarizing, the specified pv-vector is for most stars almost ** identical to the result of applying the standard geometrical ** "space motion" transformation to the catalog data. The ** differences, which are the subject of the Stumpff paper cited ** below, are: ** ** (i) In stars with significant radial velocity and proper motion, ** the constantly changing light-time distorts the apparent proper ** motion. Note that this is a classical, not a relativistic, ** effect. ** ** (ii) The transformation complies with special relativity. ** ** 3) Care is needed with units. The star coordinates are in radians ** and the proper motions in radians per Julian year, but the ** parallax is in arcseconds; the radial velocity is in km/s, but ** the pv-vector result is in AU and AU/day. ** ** 4) The proper motions are the rate of change of the right ascension ** and declination at the catalog epoch and are in radians per Julian ** year. The RA proper motion is in terms of coordinate angle, not ** true angle, and will thus be numerically larger at high ** declinations. ** ** 5) Straight-line motion at constant speed in the inertial frame is ** assumed. If the speed is greater than or equal to the speed of ** light, the function aborts with an error status. ** ** 6) The inverse transformation is performed by the function eraStarpv. ** ** Called: ** eraPn decompose p-vector into modulus and direction ** eraPdp scalar product of two p-vectors ** eraSxp multiply p-vector by scalar ** eraPmp p-vector minus p-vector ** eraPm modulus of p-vector ** eraPpp p-vector plus p-vector ** eraPv2s pv-vector to spherical ** eraAnp normalize angle into range 0 to 2pi ** ** Reference: ** ** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double r, x[3], vr, ur[3], vt, ut[3], bett, betr, d, w, del, usr[3], ust[3], a, rad, decd, rd; /* Isolate the radial component of the velocity (AU/day, inertial). */ eraPn(pv[0], &r, x); vr = eraPdp(x, pv[1]); eraSxp(vr, x, ur); /* Isolate the transverse component of the velocity (AU/day, inertial). */ eraPmp(pv[1], ur, ut); vt = eraPm(ut); /* Special-relativity dimensionless parameters. */ bett = vt / ERFA_DC; betr = vr / ERFA_DC; /* The inertial-to-observed correction terms. */ d = 1.0 + betr; w = 1.0 - betr*betr - bett*bett; if (d == 0.0 || w < 0) return -1; del = sqrt(w) - 1.0; /* Apply relativistic correction factor to radial velocity component. */ w = (betr != 0) ? (betr - del) / (betr * d) : 1.0; eraSxp(w, ur, usr); /* Apply relativistic correction factor to tangential velocity */ /* component. */ eraSxp(1.0/d, ut, ust); /* Combine the two to obtain the observed velocity vector (AU/day). */ eraPpp(usr, ust, pv[1]); /* Cartesian to spherical. */ eraPv2s(pv, &a, dec, &r, &rad, &decd, &rd); if (r == 0.0) return -2; /* Return RA in range 0 to 2pi. */ *ra = eraAnp(a); /* Return proper motions in radians per year. */ *pmr = rad * ERFA_DJY; *pmd = decd * ERFA_DJY; /* Return parallax in arcsec. */ *px = ERFA_DR2AS / r; /* Return radial velocity in km/s. */ *rv = 1e-3 * rd * ERFA_DAU / ERFA_DAYSEC; /* OK status. */ return 0; } void eraPvu(double dt, double pv[2][3], double upv[2][3]) /* ** - - - - - - - ** e r a P v u ** - - - - - - - ** ** Update a pv-vector. ** ** Given: ** dt double time interval ** pv double[2][3] pv-vector ** ** Returned: ** upv double[2][3] p updated, v unchanged ** ** Notes: ** ** 1) "Update" means "refer the position component of the vector ** to a new date dt time units from the existing date". ** ** 2) The time units of dt must match those of the velocity. ** ** 3) It is permissible for pv and upv to be the same array. ** ** Called: ** eraPpsp p-vector plus scaled p-vector ** eraCp copy p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraPpsp(pv[0], dt, pv[1], upv[0]); eraCp(pv[1], upv[1]); return; } void eraPvup(double dt, double pv[2][3], double p[3]) /* ** - - - - - - - - ** e r a P v u p ** - - - - - - - - ** ** Update a pv-vector, discarding the velocity component. ** ** Given: ** dt double time interval ** pv double[2][3] pv-vector ** ** Returned: ** p double[3] p-vector ** ** Notes: ** ** 1) "Update" means "refer the position component of the vector to a ** new date dt time units from the existing date". ** ** 2) The time units of dt must match those of the velocity. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { p[0] = pv[0][0] + dt * pv[1][0]; p[1] = pv[0][1] + dt * pv[1][1]; p[2] = pv[0][2] + dt * pv[1][2]; return; } void eraPvxpv(double a[2][3], double b[2][3], double axb[2][3]) /* ** - - - - - - - - - ** e r a P v x p v ** - - - - - - - - - ** ** Outer (=vector=cross) product of two pv-vectors. ** ** Given: ** a double[2][3] first pv-vector ** b double[2][3] second pv-vector ** ** Returned: ** axb double[2][3] a x b ** ** Notes: ** ** 1) If the position and velocity components of the two pv-vectors are ** ( ap, av ) and ( bp, bv ), the result, a x b, is the pair of ** vectors ( ap x bp, ap x bv + av x bp ). The two vectors are the ** cross-product of the two p-vectors and its derivative. ** ** 2) It is permissible to re-use the same array for any of the ** arguments. ** ** Called: ** eraCpv copy pv-vector ** eraPxp vector product of two p-vectors ** eraPpp p-vector plus p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double wa[2][3], wb[2][3], axbd[3], adxb[3]; /* Make copies of the inputs. */ eraCpv(a, wa); eraCpv(b, wb); /* a x b = position part of result. */ eraPxp(wa[0], wb[0], axb[0]); /* a x bdot + adot x b = velocity part of result. */ eraPxp(wa[0], wb[1], axbd); eraPxp(wa[1], wb[0], adxb); eraPpp(axbd, adxb, axb[1]); return; } void eraPxp(double a[3], double b[3], double axb[3]) /* ** - - - - - - - ** e r a P x p ** - - - - - - - ** ** p-vector outer (=vector=cross) product. ** ** Given: ** a double[3] first p-vector ** b double[3] second p-vector ** ** Returned: ** axb double[3] a x b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double xa, ya, za, xb, yb, zb; xa = a[0]; ya = a[1]; za = a[2]; xb = b[0]; yb = b[1]; zb = b[2]; axb[0] = ya*zb - za*yb; axb[1] = za*xb - xa*zb; axb[2] = xa*yb - ya*xb; return; } void eraRm2v(double r[3][3], double w[3]) /* ** - - - - - - - - ** e r a R m 2 v ** - - - - - - - - ** ** Express an r-matrix as an r-vector. ** ** Given: ** r double[3][3] rotation matrix ** ** Returned: ** w double[3] rotation vector (Note 1) ** ** Notes: ** ** 1) A rotation matrix describes a rotation through some angle about ** some arbitrary axis called the Euler axis. The "rotation vector" ** returned by this function has the same direction as the Euler axis, ** and its magnitude is the angle in radians. (The magnitude and ** direction can be separated by means of the function eraPn.) ** ** 2) If r is null, so is the result. If r is not a rotation matrix ** the result is undefined; r must be proper (i.e. have a positive ** determinant) and real orthogonal (inverse = transpose). ** ** 3) The reference frame rotates clockwise as seen looking along ** the rotation vector from the origin. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y, z, s2, c2, phi, f; x = r[1][2] - r[2][1]; y = r[2][0] - r[0][2]; z = r[0][1] - r[1][0]; s2 = sqrt(x*x + y*y + z*z); if (s2 != 0) { c2 = r[0][0] + r[1][1] + r[2][2] - 1.0; phi = atan2(s2, c2); f = phi / s2; w[0] = x * f; w[1] = y * f; w[2] = z * f; } else { w[0] = 0.0; w[1] = 0.0; w[2] = 0.0; } return; } void eraRv2m(double w[3], double r[3][3]) /* ** - - - - - - - - ** e r a R v 2 m ** - - - - - - - - ** ** Form the r-matrix corresponding to a given r-vector. ** ** Given: ** w double[3] rotation vector (Note 1) ** ** Returned: ** r double[3][3] rotation matrix ** ** Notes: ** ** 1) A rotation matrix describes a rotation through some angle about ** some arbitrary axis called the Euler axis. The "rotation vector" ** supplied to This function has the same direction as the Euler ** axis, and its magnitude is the angle in radians. ** ** 2) If w is null, the unit matrix is returned. ** ** 3) The reference frame rotates clockwise as seen looking along the ** rotation vector from the origin. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double x, y, z, phi, s, c, f; /* Euler angle (magnitude of rotation vector) and functions. */ x = w[0]; y = w[1]; z = w[2]; phi = sqrt(x*x + y*y + z*z); s = sin(phi); c = cos(phi); f = 1.0 - c; /* Euler axis (direction of rotation vector), perhaps null. */ if (phi != 0.0) { x /= phi; y /= phi; z /= phi; } /* Form the rotation matrix. */ r[0][0] = x*x*f + c; r[0][1] = x*y*f + z*s; r[0][2] = x*z*f - y*s; r[1][0] = y*x*f - z*s; r[1][1] = y*y*f + c; r[1][2] = y*z*f + x*s; r[2][0] = z*x*f + y*s; r[2][1] = z*y*f - x*s; r[2][2] = z*z*f + c; return; } void eraRx(double phi, double r[3][3]) /* ** - - - - - - ** e r a R x ** - - - - - - ** ** Rotate an r-matrix about the x-axis. ** ** Given: ** phi double angle (radians) ** ** Given and returned: ** r double[3][3] r-matrix, rotated ** ** Notes: ** ** 1) Calling this function with positive phi incorporates in the ** supplied r-matrix r an additional rotation, about the x-axis, ** anticlockwise as seen looking towards the origin from positive x. ** ** 2) The additional rotation can be represented by this matrix: ** ** ( 1 0 0 ) ** ( ) ** ( 0 + cos(phi) + sin(phi) ) ** ( ) ** ( 0 - sin(phi) + cos(phi) ) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double s, c, a10, a11, a12, a20, a21, a22; s = sin(phi); c = cos(phi); a10 = c*r[1][0] + s*r[2][0]; a11 = c*r[1][1] + s*r[2][1]; a12 = c*r[1][2] + s*r[2][2]; a20 = - s*r[1][0] + c*r[2][0]; a21 = - s*r[1][1] + c*r[2][1]; a22 = - s*r[1][2] + c*r[2][2]; r[1][0] = a10; r[1][1] = a11; r[1][2] = a12; r[2][0] = a20; r[2][1] = a21; r[2][2] = a22; return; } void eraRxp(double r[3][3], double p[3], double rp[3]) /* ** - - - - - - - ** e r a R x p ** - - - - - - - ** ** Multiply a p-vector by an r-matrix. ** ** Given: ** r double[3][3] r-matrix ** p double[3] p-vector ** ** Returned: ** rp double[3] r * p ** ** Note: ** It is permissible for p and rp to be the same array. ** ** Called: ** eraCp copy p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double w, wrp[3]; int i, j; /* Matrix r * vector p. */ for (j = 0; j < 3; j++) { w = 0.0; for (i = 0; i < 3; i++) { w += r[j][i] * p[i]; } wrp[j] = w; } /* Return the result. */ eraCp(wrp, rp); return; } void eraRxpv(double r[3][3], double pv[2][3], double rpv[2][3]) /* ** - - - - - - - - ** e r a R x p v ** - - - - - - - - ** ** Multiply a pv-vector by an r-matrix. ** ** Given: ** r double[3][3] r-matrix ** pv double[2][3] pv-vector ** ** Returned: ** rpv double[2][3] r * pv ** ** Note: ** It is permissible for pv and rpv to be the same array. ** ** Called: ** eraRxp product of r-matrix and p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraRxp(r, pv[0], rpv[0]); eraRxp(r, pv[1], rpv[1]); return; } void eraRxr(double a[3][3], double b[3][3], double atb[3][3]) /* ** - - - - - - - ** e r a R x r ** - - - - - - - ** ** Multiply two r-matrices. ** ** Given: ** a double[3][3] first r-matrix ** b double[3][3] second r-matrix ** ** Returned: ** atb double[3][3] a * b ** ** Note: ** It is permissible to re-use the same array for any of the ** arguments. ** ** Called: ** eraCr copy r-matrix ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int i, j, k; double w, wm[3][3]; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { w = 0.0; for (k = 0; k < 3; k++) { w += a[i][k] * b[k][j]; } wm[i][j] = w; } } eraCr(wm, atb); return; } void eraRy(double theta, double r[3][3]) /* ** - - - - - - ** e r a R y ** - - - - - - ** ** Rotate an r-matrix about the y-axis. ** ** Given: ** theta double angle (radians) ** ** Given and returned: ** r double[3][3] r-matrix, rotated ** ** Notes: ** ** 1) Calling this function with positive theta incorporates in the ** supplied r-matrix r an additional rotation, about the y-axis, ** anticlockwise as seen looking towards the origin from positive y. ** ** 2) The additional rotation can be represented by this matrix: ** ** ( + cos(theta) 0 - sin(theta) ) ** ( ) ** ( 0 1 0 ) ** ( ) ** ( + sin(theta) 0 + cos(theta) ) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double s, c, a00, a01, a02, a20, a21, a22; s = sin(theta); c = cos(theta); a00 = c*r[0][0] - s*r[2][0]; a01 = c*r[0][1] - s*r[2][1]; a02 = c*r[0][2] - s*r[2][2]; a20 = s*r[0][0] + c*r[2][0]; a21 = s*r[0][1] + c*r[2][1]; a22 = s*r[0][2] + c*r[2][2]; r[0][0] = a00; r[0][1] = a01; r[0][2] = a02; r[2][0] = a20; r[2][1] = a21; r[2][2] = a22; return; } void eraRz(double psi, double r[3][3]) /* ** - - - - - - ** e r a R z ** - - - - - - ** ** Rotate an r-matrix about the z-axis. ** ** Given: ** psi double angle (radians) ** ** Given and returned: ** r double[3][3] r-matrix, rotated ** ** Notes: ** ** 1) Calling this function with positive psi incorporates in the ** supplied r-matrix r an additional rotation, about the z-axis, ** anticlockwise as seen looking towards the origin from positive z. ** ** 2) The additional rotation can be represented by this matrix: ** ** ( + cos(psi) + sin(psi) 0 ) ** ( ) ** ( - sin(psi) + cos(psi) 0 ) ** ( ) ** ( 0 0 1 ) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double s, c, a00, a01, a02, a10, a11, a12; s = sin(psi); c = cos(psi); a00 = c*r[0][0] + s*r[1][0]; a01 = c*r[0][1] + s*r[1][1]; a02 = c*r[0][2] + s*r[1][2]; a10 = - s*r[0][0] + c*r[1][0]; a11 = - s*r[0][1] + c*r[1][1]; a12 = - s*r[0][2] + c*r[1][2]; r[0][0] = a00; r[0][1] = a01; r[0][2] = a02; r[1][0] = a10; r[1][1] = a11; r[1][2] = a12; return; } double eraS00(double date1, double date2, double x, double y) /* ** - - - - - - - ** e r a S 0 0 ** - - - - - - - ** ** The CIO locator s, positioning the Celestial Intermediate Origin on ** the equator of the Celestial Intermediate Pole, given the CIP's X,Y ** coordinates. Compatible with IAU 2000A precession-nutation. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** x,y double CIP coordinates (Note 3) ** ** Returned (function value): ** double the CIO locator s in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The CIO locator s is the difference between the right ascensions ** of the same point in two systems: the two systems are the GCRS ** and the CIP,CIO, and the point is the ascending node of the ** CIP equator. The quantity s remains below 0.1 arcsecond ** throughout 1900-2100. ** ** 3) The series used to compute s is in fact for s+XY/2, where X and Y ** are the x and y components of the CIP unit vector; this series ** is more compact than a direct series for s would be. This ** function requires X,Y to be supplied by the caller, who is ** responsible for providing values that are consistent with the ** supplied date. ** ** 4) The model is consistent with the IAU 2000A precession-nutation. ** ** Called: ** eraFal03 mean anomaly of the Moon ** eraFalp03 mean anomaly of the Sun ** eraFaf03 mean argument of the latitude of the Moon ** eraFad03 mean elongation of the Moon from the Sun ** eraFaom03 mean longitude of the Moon's ascending node ** eraFave03 mean longitude of Venus ** eraFae03 mean longitude of Earth ** eraFapa03 general accumulated precession in longitude ** ** References: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Time since J2000.0, in Julian centuries */ double t; /* Miscellaneous */ int i, j; double a, w0, w1, w2, w3, w4, w5; /* Fundamental arguments */ double fa[8]; /* Returned value */ double s; /* --------------------- */ /* The series for s+XY/2 */ /* --------------------- */ typedef struct { int nfa[8]; /* coefficients of l,l',F,D,Om,LVe,LE,pA */ double s, c; /* sine and cosine coefficients */ } TERM; /* Polynomial coefficients */ static const double sp[] = { /* 1-6 */ 94.00e-6, 3808.35e-6, -119.94e-6, -72574.09e-6, 27.70e-6, 15.61e-6 }; /* Terms of order t^0 */ static const TERM s0[] = { /* 1-10 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, -2640.73e-6, 0.39e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, -63.53e-6, 0.02e-6 }, {{ 0, 0, 2, -2, 3, 0, 0, 0}, -11.75e-6, -0.01e-6 }, {{ 0, 0, 2, -2, 1, 0, 0, 0}, -11.21e-6, -0.01e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, 4.57e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 3, 0, 0, 0}, -2.02e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 1, 0, 0, 0}, -1.98e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 3, 0, 0, 0}, 1.72e-6, 0.00e-6 }, {{ 0, 1, 0, 0, 1, 0, 0, 0}, 1.41e-6, 0.01e-6 }, {{ 0, 1, 0, 0, -1, 0, 0, 0}, 1.26e-6, 0.01e-6 }, /* 11-20 */ {{ 1, 0, 0, 0, -1, 0, 0, 0}, 0.63e-6, 0.00e-6 }, {{ 1, 0, 0, 0, 1, 0, 0, 0}, 0.63e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 3, 0, 0, 0}, -0.46e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 1, 0, 0, 0}, -0.45e-6, 0.00e-6 }, {{ 0, 0, 4, -4, 4, 0, 0, 0}, -0.36e-6, 0.00e-6 }, {{ 0, 0, 1, -1, 1, -8, 12, 0}, 0.24e-6, 0.12e-6 }, {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.32e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.28e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 3, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 1, 0, 0, 0}, -0.26e-6, 0.00e-6 }, /* 21-30 */ {{ 0, 0, 2, -2, 0, 0, 0, 0}, 0.21e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -3, 0, 0, 0}, -0.19e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -1, 0, 0, 0}, -0.18e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 0, 8,-13, -1}, 0.10e-6, -0.05e-6 }, {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.15e-6, 0.00e-6 }, {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 2, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, 1, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, -1, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 0, 0, 4, -2, 4, 0, 0, 0}, -0.13e-6, 0.00e-6 }, /* 31-33 */ {{ 0, 0, 2, -2, 4, 0, 0, 0}, 0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -3, 0, 0, 0}, -0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -1, 0, 0, 0}, -0.11e-6, 0.00e-6 } }; /* Terms of order t^1 */ static const TERM s1[] ={ /* 1-3 */ {{ 0, 0, 0, 0, 2, 0, 0, 0}, -0.07e-6, 3.57e-6 }, {{ 0, 0, 0, 0, 1, 0, 0, 0}, 1.71e-6, -0.03e-6 }, {{ 0, 0, 2, -2, 3, 0, 0, 0}, 0.00e-6, 0.48e-6 } }; /* Terms of order t^2 */ static const TERM s2[] ={ /* 1-10 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, 743.53e-6, -0.17e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, 56.91e-6, 0.06e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, 9.84e-6, -0.01e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, -8.85e-6, 0.01e-6 }, {{ 0, 1, 0, 0, 0, 0, 0, 0}, -6.38e-6, -0.05e-6 }, {{ 1, 0, 0, 0, 0, 0, 0, 0}, -3.07e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 2, 0, 0, 0}, 2.23e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 1, 0, 0, 0}, 1.67e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 2, 0, 0, 0}, 1.30e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -2, 0, 0, 0}, 0.93e-6, 0.00e-6 }, /* 11-20 */ {{ 1, 0, 0, -2, 0, 0, 0, 0}, 0.68e-6, 0.00e-6 }, {{ 0, 0, 2, -2, 1, 0, 0, 0}, -0.55e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -2, 0, 0, 0}, 0.53e-6, 0.00e-6 }, {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, 0, 0, 1, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, -2, -2, -2, 0, 0, 0}, -0.26e-6, 0.00e-6 }, {{ 1, 0, 0, 0, -1, 0, 0, 0}, -0.25e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 1, 0, 0, 0}, 0.22e-6, 0.00e-6 }, {{ 2, 0, 0, -2, 0, 0, 0, 0}, -0.21e-6, 0.00e-6 }, {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.20e-6, 0.00e-6 }, /* 21-25 */ {{ 0, 0, 2, 2, 2, 0, 0, 0}, 0.17e-6, 0.00e-6 }, {{ 2, 0, 2, 0, 2, 0, 0, 0}, 0.13e-6, 0.00e-6 }, {{ 2, 0, 0, 0, 0, 0, 0, 0}, -0.13e-6, 0.00e-6 }, {{ 1, 0, 2, -2, 2, 0, 0, 0}, -0.12e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.11e-6, 0.00e-6 } }; /* Terms of order t^3 */ static const TERM s3[] ={ /* 1-4 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, 0.30e-6, -23.51e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, -0.03e-6, -1.39e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.01e-6, -0.24e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, 0.00e-6, 0.22e-6 } }; /* Terms of order t^4 */ static const TERM s4[] ={ /* 1-1 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, -0.26e-6, -0.01e-6 } }; /* Number of terms in the series */ const int NS0 = (int) (sizeof s0 / sizeof (TERM)); const int NS1 = (int) (sizeof s1 / sizeof (TERM)); const int NS2 = (int) (sizeof s2 / sizeof (TERM)); const int NS3 = (int) (sizeof s3 / sizeof (TERM)); const int NS4 = (int) (sizeof s4 / sizeof (TERM)); /*--------------------------------------------------------------------*/ /* Interval between fundamental epoch J2000.0 and current date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Fundamental Arguments (from IERS Conventions 2003) */ /* Mean anomaly of the Moon. */ fa[0] = eraFal03(t); /* Mean anomaly of the Sun. */ fa[1] = eraFalp03(t); /* Mean longitude of the Moon minus that of the ascending node. */ fa[2] = eraFaf03(t); /* Mean elongation of the Moon from the Sun. */ fa[3] = eraFad03(t); /* Mean longitude of the ascending node of the Moon. */ fa[4] = eraFaom03(t); /* Mean longitude of Venus. */ fa[5] = eraFave03(t); /* Mean longitude of Earth. */ fa[6] = eraFae03(t); /* General precession in longitude. */ fa[7] = eraFapa03(t); /* Evaluate s. */ w0 = sp[0]; w1 = sp[1]; w2 = sp[2]; w3 = sp[3]; w4 = sp[4]; w5 = sp[5]; for (i = NS0-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s0[i].nfa[j] * fa[j]; } w0 += s0[i].s * sin(a) + s0[i].c * cos(a); } for (i = NS1-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s1[i].nfa[j] * fa[j]; } w1 += s1[i].s * sin(a) + s1[i].c * cos(a); } for (i = NS2-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s2[i].nfa[j] * fa[j]; } w2 += s2[i].s * sin(a) + s2[i].c * cos(a); } for (i = NS3-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s3[i].nfa[j] * fa[j]; } w3 += s3[i].s * sin(a) + s3[i].c * cos(a); } for (i = NS4-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s4[i].nfa[j] * fa[j]; } w4 += s4[i].s * sin(a) + s4[i].c * cos(a); } s = (w0 + (w1 + (w2 + (w3 + (w4 + w5 * t) * t) * t) * t) * t) * ERFA_DAS2R - x*y/2.0; return s; } double eraS00a(double date1, double date2) /* ** - - - - - - - - ** e r a S 0 0 a ** - - - - - - - - ** ** The CIO locator s, positioning the Celestial Intermediate Origin on ** the equator of the Celestial Intermediate Pole, using the IAU 2000A ** precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double the CIO locator s in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The CIO locator s is the difference between the right ascensions ** of the same point in two systems. The two systems are the GCRS ** and the CIP,CIO, and the point is the ascending node of the ** CIP equator. The CIO locator s remains a small fraction of ** 1 arcsecond throughout 1900-2100. ** ** 3) The series used to compute s is in fact for s+XY/2, where X and Y ** are the x and y components of the CIP unit vector; this series ** is more compact than a direct series for s would be. The present ** function uses the full IAU 2000A nutation model when predicting ** the CIP position. Faster results, with no significant loss of ** accuracy, can be obtained via the function eraS00b, which uses ** instead the IAU 2000B truncated model. ** ** Called: ** eraPnm00a classical NPB matrix, IAU 2000A ** eraBnp2xy extract CIP X,Y from the BPN matrix ** eraS00 the CIO locator s, given X,Y, IAU 2000A ** ** References: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3], x, y, s; /* Bias-precession-nutation-matrix, IAU 2000A. */ eraPnm00a(date1, date2, rbpn); /* Extract the CIP coordinates. */ eraBpn2xy(rbpn, &x, &y); /* Compute the CIO locator s, given the CIP coordinates. */ s = eraS00(date1, date2, x, y); return s; } double eraS00b(double date1, double date2) /* ** - - - - - - - - ** e r a S 0 0 b ** - - - - - - - - ** ** The CIO locator s, positioning the Celestial Intermediate Origin on ** the equator of the Celestial Intermediate Pole, using the IAU 2000B ** precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double the CIO locator s in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The CIO locator s is the difference between the right ascensions ** of the same point in two systems. The two systems are the GCRS ** and the CIP,CIO, and the point is the ascending node of the ** CIP equator. The CIO locator s remains a small fraction of ** 1 arcsecond throughout 1900-2100. ** ** 3) The series used to compute s is in fact for s+XY/2, where X and Y ** are the x and y components of the CIP unit vector; this series ** is more compact than a direct series for s would be. The present ** function uses the IAU 2000B truncated nutation model when ** predicting the CIP position. The function eraS00a uses instead ** the full IAU 2000A model, but with no significant increase in ** accuracy and at some cost in speed. ** ** Called: ** eraPnm00b classical NPB matrix, IAU 2000B ** eraBnp2xy extract CIP X,Y from the BPN matrix ** eraS00 the CIO locator s, given X,Y, IAU 2000A ** ** References: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3], x, y, s; /* Bias-precession-nutation-matrix, IAU 2000B. */ eraPnm00b(date1, date2, rbpn); /* Extract the CIP coordinates. */ eraBpn2xy(rbpn, &x, &y); /* Compute the CIO locator s, given the CIP coordinates. */ s = eraS00(date1, date2, x, y); return s; } double eraS06(double date1, double date2, double x, double y) /* ** - - - - - - - ** e r a S 0 6 ** - - - - - - - ** ** The CIO locator s, positioning the Celestial Intermediate Origin on ** the equator of the Celestial Intermediate Pole, given the CIP's X,Y ** coordinates. Compatible with IAU 2006/2000A precession-nutation. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** x,y double CIP coordinates (Note 3) ** ** Returned (function value): ** double the CIO locator s in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The CIO locator s is the difference between the right ascensions ** of the same point in two systems: the two systems are the GCRS ** and the CIP,CIO, and the point is the ascending node of the ** CIP equator. The quantity s remains below 0.1 arcsecond ** throughout 1900-2100. ** ** 3) The series used to compute s is in fact for s+XY/2, where X and Y ** are the x and y components of the CIP unit vector; this series ** is more compact than a direct series for s would be. This ** function requires X,Y to be supplied by the caller, who is ** responsible for providing values that are consistent with the ** supplied date. ** ** 4) The model is consistent with the "P03" precession (Capitaine et ** al. 2003), adopted by IAU 2006 Resolution 1, 2006, and the ** IAU 2000A nutation (with P03 adjustments). ** ** Called: ** eraFal03 mean anomaly of the Moon ** eraFalp03 mean anomaly of the Sun ** eraFaf03 mean argument of the latitude of the Moon ** eraFad03 mean elongation of the Moon from the Sun ** eraFaom03 mean longitude of the Moon's ascending node ** eraFave03 mean longitude of Venus ** eraFae03 mean longitude of Earth ** eraFapa03 general accumulated precession in longitude ** ** References: ** ** Capitaine, N., Wallace, P.T. & Chapront, J., 2003, Astron. ** Astrophys. 432, 355 ** ** McCarthy, D.D., Petit, G. (eds.) 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Time since J2000.0, in Julian centuries */ double t; /* Miscellaneous */ int i, j; double a, w0, w1, w2, w3, w4, w5; /* Fundamental arguments */ double fa[8]; /* Returned value */ double s; /* --------------------- */ /* The series for s+XY/2 */ /* --------------------- */ typedef struct { int nfa[8]; /* coefficients of l,l',F,D,Om,LVe,LE,pA */ double s, c; /* sine and cosine coefficients */ } TERM; /* Polynomial coefficients */ static const double sp[] = { /* 1-6 */ 94.00e-6, 3808.65e-6, -122.68e-6, -72574.11e-6, 27.98e-6, 15.62e-6 }; /* Terms of order t^0 */ static const TERM s0[] = { /* 1-10 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, -2640.73e-6, 0.39e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, -63.53e-6, 0.02e-6 }, {{ 0, 0, 2, -2, 3, 0, 0, 0}, -11.75e-6, -0.01e-6 }, {{ 0, 0, 2, -2, 1, 0, 0, 0}, -11.21e-6, -0.01e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, 4.57e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 3, 0, 0, 0}, -2.02e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 1, 0, 0, 0}, -1.98e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 3, 0, 0, 0}, 1.72e-6, 0.00e-6 }, {{ 0, 1, 0, 0, 1, 0, 0, 0}, 1.41e-6, 0.01e-6 }, {{ 0, 1, 0, 0, -1, 0, 0, 0}, 1.26e-6, 0.01e-6 }, /* 11-20 */ {{ 1, 0, 0, 0, -1, 0, 0, 0}, 0.63e-6, 0.00e-6 }, {{ 1, 0, 0, 0, 1, 0, 0, 0}, 0.63e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 3, 0, 0, 0}, -0.46e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 1, 0, 0, 0}, -0.45e-6, 0.00e-6 }, {{ 0, 0, 4, -4, 4, 0, 0, 0}, -0.36e-6, 0.00e-6 }, {{ 0, 0, 1, -1, 1, -8, 12, 0}, 0.24e-6, 0.12e-6 }, {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.32e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.28e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 3, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 1, 0, 0, 0}, -0.26e-6, 0.00e-6 }, /* 21-30 */ {{ 0, 0, 2, -2, 0, 0, 0, 0}, 0.21e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -3, 0, 0, 0}, -0.19e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -1, 0, 0, 0}, -0.18e-6, 0.00e-6 }, {{ 0, 0, 0, 0, 0, 8,-13, -1}, 0.10e-6, -0.05e-6 }, {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.15e-6, 0.00e-6 }, {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 2, 0, 0, 0}, 0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, 1, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 1, 0, 0, -2, -1, 0, 0, 0}, -0.14e-6, 0.00e-6 }, {{ 0, 0, 4, -2, 4, 0, 0, 0}, -0.13e-6, 0.00e-6 }, /* 31-33 */ {{ 0, 0, 2, -2, 4, 0, 0, 0}, 0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -3, 0, 0, 0}, -0.11e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -1, 0, 0, 0}, -0.11e-6, 0.00e-6 } }; /* Terms of order t^1 */ static const TERM s1[] = { /* 1 - 3 */ {{ 0, 0, 0, 0, 2, 0, 0, 0}, -0.07e-6, 3.57e-6 }, {{ 0, 0, 0, 0, 1, 0, 0, 0}, 1.73e-6, -0.03e-6 }, {{ 0, 0, 2, -2, 3, 0, 0, 0}, 0.00e-6, 0.48e-6 } }; /* Terms of order t^2 */ static const TERM s2[] = { /* 1-10 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, 743.52e-6, -0.17e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, 56.91e-6, 0.06e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, 9.84e-6, -0.01e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, -8.85e-6, 0.01e-6 }, {{ 0, 1, 0, 0, 0, 0, 0, 0}, -6.38e-6, -0.05e-6 }, {{ 1, 0, 0, 0, 0, 0, 0, 0}, -3.07e-6, 0.00e-6 }, {{ 0, 1, 2, -2, 2, 0, 0, 0}, 2.23e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 1, 0, 0, 0}, 1.67e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 2, 0, 0, 0}, 1.30e-6, 0.00e-6 }, {{ 0, 1, -2, 2, -2, 0, 0, 0}, 0.93e-6, 0.00e-6 }, /* 11-20 */ {{ 1, 0, 0, -2, 0, 0, 0, 0}, 0.68e-6, 0.00e-6 }, {{ 0, 0, 2, -2, 1, 0, 0, 0}, -0.55e-6, 0.00e-6 }, {{ 1, 0, -2, 0, -2, 0, 0, 0}, 0.53e-6, 0.00e-6 }, {{ 0, 0, 0, 2, 0, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, 0, 0, 1, 0, 0, 0}, -0.27e-6, 0.00e-6 }, {{ 1, 0, -2, -2, -2, 0, 0, 0}, -0.26e-6, 0.00e-6 }, {{ 1, 0, 0, 0, -1, 0, 0, 0}, -0.25e-6, 0.00e-6 }, {{ 1, 0, 2, 0, 1, 0, 0, 0}, 0.22e-6, 0.00e-6 }, {{ 2, 0, 0, -2, 0, 0, 0, 0}, -0.21e-6, 0.00e-6 }, {{ 2, 0, -2, 0, -1, 0, 0, 0}, 0.20e-6, 0.00e-6 }, /* 21-25 */ {{ 0, 0, 2, 2, 2, 0, 0, 0}, 0.17e-6, 0.00e-6 }, {{ 2, 0, 2, 0, 2, 0, 0, 0}, 0.13e-6, 0.00e-6 }, {{ 2, 0, 0, 0, 0, 0, 0, 0}, -0.13e-6, 0.00e-6 }, {{ 1, 0, 2, -2, 2, 0, 0, 0}, -0.12e-6, 0.00e-6 }, {{ 0, 0, 2, 0, 0, 0, 0, 0}, -0.11e-6, 0.00e-6 } }; /* Terms of order t^3 */ static const TERM s3[] = { /* 1-4 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, 0.30e-6, -23.42e-6 }, {{ 0, 0, 2, -2, 2, 0, 0, 0}, -0.03e-6, -1.46e-6 }, {{ 0, 0, 2, 0, 2, 0, 0, 0}, -0.01e-6, -0.25e-6 }, {{ 0, 0, 0, 0, 2, 0, 0, 0}, 0.00e-6, 0.23e-6 } }; /* Terms of order t^4 */ static const TERM s4[] = { /* 1-1 */ {{ 0, 0, 0, 0, 1, 0, 0, 0}, -0.26e-6, -0.01e-6 } }; /* Number of terms in the series */ static const int NS0 = (int) (sizeof s0 / sizeof (TERM)); static const int NS1 = (int) (sizeof s1 / sizeof (TERM)); static const int NS2 = (int) (sizeof s2 / sizeof (TERM)); static const int NS3 = (int) (sizeof s3 / sizeof (TERM)); static const int NS4 = (int) (sizeof s4 / sizeof (TERM)); /*--------------------------------------------------------------------*/ /* Interval between fundamental epoch J2000.0 and current date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Fundamental Arguments (from IERS Conventions 2003) */ /* Mean anomaly of the Moon. */ fa[0] = eraFal03(t); /* Mean anomaly of the Sun. */ fa[1] = eraFalp03(t); /* Mean longitude of the Moon minus that of the ascending node. */ fa[2] = eraFaf03(t); /* Mean elongation of the Moon from the Sun. */ fa[3] = eraFad03(t); /* Mean longitude of the ascending node of the Moon. */ fa[4] = eraFaom03(t); /* Mean longitude of Venus. */ fa[5] = eraFave03(t); /* Mean longitude of Earth. */ fa[6] = eraFae03(t); /* General precession in longitude. */ fa[7] = eraFapa03(t); /* Evaluate s. */ w0 = sp[0]; w1 = sp[1]; w2 = sp[2]; w3 = sp[3]; w4 = sp[4]; w5 = sp[5]; for (i = NS0-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s0[i].nfa[j] * fa[j]; } w0 += s0[i].s * sin(a) + s0[i].c * cos(a); } for (i = NS1-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s1[i].nfa[j] * fa[j]; } w1 += s1[i].s * sin(a) + s1[i].c * cos(a); } for (i = NS2-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s2[i].nfa[j] * fa[j]; } w2 += s2[i].s * sin(a) + s2[i].c * cos(a); } for (i = NS3-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s3[i].nfa[j] * fa[j]; } w3 += s3[i].s * sin(a) + s3[i].c * cos(a); } for (i = NS4-1; i >= 0; i--) { a = 0.0; for (j = 0; j < 8; j++) { a += (double)s4[i].nfa[j] * fa[j]; } w4 += s4[i].s * sin(a) + s4[i].c * cos(a); } s = (w0 + (w1 + (w2 + (w3 + (w4 + w5 * t) * t) * t) * t) * t) * ERFA_DAS2R - x*y/2.0; return s; } double eraS06a(double date1, double date2) /* ** - - - - - - - - ** e r a S 0 6 a ** - - - - - - - - ** ** The CIO locator s, positioning the Celestial Intermediate Origin on ** the equator of the Celestial Intermediate Pole, using the IAU 2006 ** precession and IAU 2000A nutation models. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double the CIO locator s in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The CIO locator s is the difference between the right ascensions ** of the same point in two systems. The two systems are the GCRS ** and the CIP,CIO, and the point is the ascending node of the ** CIP equator. The CIO locator s remains a small fraction of ** 1 arcsecond throughout 1900-2100. ** ** 3) The series used to compute s is in fact for s+XY/2, where X and Y ** are the x and y components of the CIP unit vector; this series is ** more compact than a direct series for s would be. The present ** function uses the full IAU 2000A nutation model when predicting ** the CIP position. ** ** Called: ** eraPnm06a classical NPB matrix, IAU 2006/2000A ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS06 the CIO locator s, given X,Y, IAU 2006 ** ** References: ** ** Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., ** "Expressions for the Celestial Intermediate Pole and Celestial ** Ephemeris Origin consistent with the IAU 2000A precession- ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003) ** ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial ** intermediate origin" (CIO) by IAU 2006 Resolution 2. ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rnpb[3][3], x, y, s; /* Bias-precession-nutation-matrix, IAU 20006/2000A. */ eraPnm06a(date1, date2, rnpb); /* Extract the CIP coordinates. */ eraBpn2xy(rnpb, &x, &y); /* Compute the CIO locator s, given the CIP coordinates. */ s = eraS06(date1, date2, x, y); return s; } void eraS2c(double theta, double phi, double c[3]) /* ** - - - - - - - ** e r a S 2 c ** - - - - - - - ** ** Convert spherical coordinates to Cartesian. ** ** Given: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** ** Returned: ** c double[3] direction cosines ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double cp; cp = cos(phi); c[0] = cos(theta) * cp; c[1] = sin(theta) * cp; c[2] = sin(phi); return; } void eraS2p(double theta, double phi, double r, double p[3]) /* ** - - - - - - - ** e r a S 2 p ** - - - - - - - ** ** Convert spherical polar coordinates to p-vector. ** ** Given: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** r double radial distance ** ** Returned: ** p double[3] Cartesian coordinates ** ** Called: ** eraS2c spherical coordinates to unit vector ** eraSxp multiply p-vector by scalar ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double u[3]; eraS2c(theta, phi, u); eraSxp(r, u, p); return; } void eraS2pv(double theta, double phi, double r, double td, double pd, double rd, double pv[2][3]) /* ** - - - - - - - - ** e r a S 2 p v ** - - - - - - - - ** ** Convert position/velocity from spherical to Cartesian coordinates. ** ** Given: ** theta double longitude angle (radians) ** phi double latitude angle (radians) ** r double radial distance ** td double rate of change of theta ** pd double rate of change of phi ** rd double rate of change of r ** ** Returned: ** pv double[2][3] pv-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double st, ct, sp, cp, rcp, x, y, rpd, w; st = sin(theta); ct = cos(theta); sp = sin(phi); cp = cos(phi); rcp = r * cp; x = rcp * ct; y = rcp * st; rpd = r * pd; w = rpd*sp - cp*rd; pv[0][0] = x; pv[0][1] = y; pv[0][2] = r * sp; pv[1][0] = -y*td - w*ct; pv[1][1] = x*td - w*st; pv[1][2] = rpd*cp + sp*rd; return; } void eraS2xpv(double s1, double s2, double pv[2][3], double spv[2][3]) /* ** - - - - - - - - - ** e r a S 2 x p v ** - - - - - - - - - ** ** Multiply a pv-vector by two scalars. ** ** Given: ** s1 double scalar to multiply position component by ** s2 double scalar to multiply velocity component by ** pv double[2][3] pv-vector ** ** Returned: ** spv double[2][3] pv-vector: p scaled by s1, v scaled by s2 ** ** Note: ** It is permissible for pv and spv to be the same array. ** ** Called: ** eraSxp multiply p-vector by scalar ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraSxp(s1, pv[0], spv[0]); eraSxp(s2, pv[1], spv[1]); return; } double eraSepp(double a[3], double b[3]) /* ** - - - - - - - - ** e r a S e p p ** - - - - - - - - ** ** Angular separation between two p-vectors. ** ** Given: ** a double[3] first p-vector (not necessarily unit length) ** b double[3] second p-vector (not necessarily unit length) ** ** Returned (function value): ** double angular separation (radians, always positive) ** ** Notes: ** ** 1) If either vector is null, a zero result is returned. ** ** 2) The angular separation is most simply formulated in terms of ** scalar product. However, this gives poor accuracy for angles ** near zero and pi. The present algorithm uses both cross product ** and dot product, to deliver full accuracy whatever the size of ** the angle. ** ** Called: ** eraPxp vector product of two p-vectors ** eraPm modulus of p-vector ** eraPdp scalar product of two p-vectors ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double axb[3], ss, cs, s; /* Sine of angle between the vectors, multiplied by the two moduli. */ eraPxp(a, b, axb); ss = eraPm(axb); /* Cosine of the angle, multiplied by the two moduli. */ cs = eraPdp(a, b); /* The angle. */ s = ((ss != 0.0) || (cs != 0.0)) ? atan2(ss, cs) : 0.0; return s; } double eraSeps(double al, double ap, double bl, double bp) /* ** - - - - - - - - ** e r a S e p s ** - - - - - - - - ** ** Angular separation between two sets of spherical coordinates. ** ** Given: ** al double first longitude (radians) ** ap double first latitude (radians) ** bl double second longitude (radians) ** bp double second latitude (radians) ** ** Returned (function value): ** double angular separation (radians) ** ** Called: ** eraS2c spherical coordinates to unit vector ** eraSepp angular separation between two p-vectors ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double ac[3], bc[3], s; /* Spherical to Cartesian. */ eraS2c(al, ap, ac); eraS2c(bl, bp, bc); /* Angle between the vectors. */ s = eraSepp(ac, bc); return s; } double eraSp00(double date1, double date2) /* ** - - - - - - - - ** e r a S p 0 0 ** - - - - - - - - ** ** The TIO locator s', positioning the Terrestrial Intermediate Origin ** on the equator of the Celestial Intermediate Pole. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned (function value): ** double the TIO locator s' in radians (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The TIO locator s' is obtained from polar motion observations by ** numerical integration, and so is in essence unpredictable. ** However, it is dominated by a secular drift of about ** 47 microarcseconds per century, which is the approximation ** evaluated by the present function. ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double t, sp; /* Interval between fundamental epoch J2000.0 and current date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Approximate s'. */ sp = -47e-6 * t * ERFA_DAS2R; return sp; } int eraStarpm(double ra1, double dec1, double pmr1, double pmd1, double px1, double rv1, double ep1a, double ep1b, double ep2a, double ep2b, double *ra2, double *dec2, double *pmr2, double *pmd2, double *px2, double *rv2) /* ** - - - - - - - - - - ** e r a S t a r p m ** - - - - - - - - - - ** ** Star proper motion: update star catalog data for space motion. ** ** Given: ** ra1 double right ascension (radians), before ** dec1 double declination (radians), before ** pmr1 double RA proper motion (radians/year), before ** pmd1 double Dec proper motion (radians/year), before ** px1 double parallax (arcseconds), before ** rv1 double radial velocity (km/s, +ve = receding), before ** ep1a double "before" epoch, part A (Note 1) ** ep1b double "before" epoch, part B (Note 1) ** ep2a double "after" epoch, part A (Note 1) ** ep2b double "after" epoch, part B (Note 1) ** ** Returned: ** ra2 double right ascension (radians), after ** dec2 double declination (radians), after ** pmr2 double RA proper motion (radians/year), after ** pmd2 double Dec proper motion (radians/year), after ** px2 double parallax (arcseconds), after ** rv2 double radial velocity (km/s, +ve = receding), after ** ** Returned (function value): ** int status: ** -1 = system error (should not occur) ** 0 = no warnings or errors ** 1 = distance overridden (Note 6) ** 2 = excessive velocity (Note 7) ** 4 = solution didn't converge (Note 8) ** else = binary logical OR of the above warnings ** ** Notes: ** ** 1) The starting and ending TDB dates ep1a+ep1b and ep2a+ep2b are ** Julian Dates, apportioned in any convenient way between the two ** parts (A and B). For example, JD(TDB)=2450123.7 could be ** expressed in any of these ways, among others: ** ** epna epnb ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) In accordance with normal star-catalog conventions, the object's ** right ascension and declination are freed from the effects of ** secular aberration. The frame, which is aligned to the catalog ** equator and equinox, is Lorentzian and centered on the SSB. ** ** The proper motions are the rate of change of the right ascension ** and declination at the catalog epoch and are in radians per TDB ** Julian year. ** ** The parallax and radial velocity are in the same frame. ** ** 3) Care is needed with units. The star coordinates are in radians ** and the proper motions in radians per Julian year, but the ** parallax is in arcseconds. ** ** 4) The RA proper motion is in terms of coordinate angle, not true ** angle. If the catalog uses arcseconds for both RA and Dec proper ** motions, the RA proper motion will need to be divided by cos(Dec) ** before use. ** ** 5) Straight-line motion at constant speed, in the inertial frame, ** is assumed. ** ** 6) An extremely small (or zero or negative) parallax is interpreted ** to mean that the object is on the "celestial sphere", the radius ** of which is an arbitrary (large) value (see the eraStarpv ** function for the value used). When the distance is overridden in ** this way, the status, initially zero, has 1 added to it. ** ** 7) If the space velocity is a significant fraction of c (see the ** constant VMAX in the function eraStarpv), it is arbitrarily set ** to zero. When this action occurs, 2 is added to the status. ** ** 8) The relativistic adjustment carried out in the eraStarpv function ** involves an iterative calculation. If the process fails to ** converge within a set number of iterations, 4 is added to the ** status. ** ** Called: ** eraStarpv star catalog data to space motion pv-vector ** eraPvu update a pv-vector ** eraPdp scalar product of two p-vectors ** eraPvstar space motion pv-vector to star catalog data ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double pv1[2][3], tl1, dt, pv[2][3], r2, rdv, v2, c2mv2, tl2, pv2[2][3]; int j1, j2, j; /* RA,Dec etc. at the "before" epoch to space motion pv-vector. */ j1 = eraStarpv(ra1, dec1, pmr1, pmd1, px1, rv1, pv1); /* Light time when observed (days). */ tl1 = eraPm(pv1[0]) / ERFA_DC; /* Time interval, "before" to "after" (days). */ dt = (ep2a - ep1a) + (ep2b - ep1b); /* Move star along track from the "before" observed position to the */ /* "after" geometric position. */ eraPvu(dt + tl1, pv1, pv); /* From this geometric position, deduce the observed light time (days) */ /* at the "after" epoch (with theoretically unneccessary error check). */ r2 = eraPdp(pv[0], pv[0]); rdv = eraPdp(pv[0], pv[1]); v2 = eraPdp(pv[1], pv[1]); c2mv2 = ERFA_DC*ERFA_DC - v2; if (c2mv2 <= 0) return -1; tl2 = (-rdv + sqrt(rdv*rdv + c2mv2*r2)) / c2mv2; /* Move the position along track from the observed place at the */ /* "before" epoch to the observed place at the "after" epoch. */ eraPvu(dt + (tl1 - tl2), pv1, pv2); /* Space motion pv-vector to RA,Dec etc. at the "after" epoch. */ j2 = eraPvstar(pv2, ra2, dec2, pmr2, pmd2, px2, rv2); /* Final status. */ j = (j2 == 0) ? j1 : -1; return j; } int eraStarpv(double ra, double dec, double pmr, double pmd, double px, double rv, double pv[2][3]) /* ** - - - - - - - - - - ** e r a S t a r p v ** - - - - - - - - - - ** ** Convert star catalog coordinates to position+velocity vector. ** ** Given (Note 1): ** ra double right ascension (radians) ** dec double declination (radians) ** pmr double RA proper motion (radians/year) ** pmd double Dec proper motion (radians/year) ** px double parallax (arcseconds) ** rv double radial velocity (km/s, positive = receding) ** ** Returned (Note 2): ** pv double[2][3] pv-vector (AU, AU/day) ** ** Returned (function value): ** int status: ** 0 = no warnings ** 1 = distance overridden (Note 6) ** 2 = excessive speed (Note 7) ** 4 = solution didn't converge (Note 8) ** else = binary logical OR of the above ** ** Notes: ** ** 1) The star data accepted by this function are "observables" for an ** imaginary observer at the solar-system barycenter. Proper motion ** and radial velocity are, strictly, in terms of barycentric ** coordinate time, TCB. For most practical applications, it is ** permissible to neglect the distinction between TCB and ordinary ** "proper" time on Earth (TT/TAI). The result will, as a rule, be ** limited by the intrinsic accuracy of the proper-motion and ** radial-velocity data; moreover, the pv-vector is likely to be ** merely an intermediate result, so that a change of time unit ** would cancel out overall. ** ** In accordance with normal star-catalog conventions, the object's ** right ascension and declination are freed from the effects of ** secular aberration. The frame, which is aligned to the catalog ** equator and equinox, is Lorentzian and centered on the SSB. ** ** 2) The resulting position and velocity pv-vector is with respect to ** the same frame and, like the catalog coordinates, is freed from ** the effects of secular aberration. Should the "coordinate ** direction", where the object was located at the catalog epoch, be ** required, it may be obtained by calculating the magnitude of the ** position vector pv[0][0-2] dividing by the speed of light in ** AU/day to give the light-time, and then multiplying the space ** velocity pv[1][0-2] by this light-time and adding the result to ** pv[0][0-2]. ** ** Summarizing, the pv-vector returned is for most stars almost ** identical to the result of applying the standard geometrical ** "space motion" transformation. The differences, which are the ** subject of the Stumpff paper referenced below, are: ** ** (i) In stars with significant radial velocity and proper motion, ** the constantly changing light-time distorts the apparent proper ** motion. Note that this is a classical, not a relativistic, ** effect. ** ** (ii) The transformation complies with special relativity. ** ** 3) Care is needed with units. The star coordinates are in radians ** and the proper motions in radians per Julian year, but the ** parallax is in arcseconds; the radial velocity is in km/s, but ** the pv-vector result is in AU and AU/day. ** ** 4) The RA proper motion is in terms of coordinate angle, not true ** angle. If the catalog uses arcseconds for both RA and Dec proper ** motions, the RA proper motion will need to be divided by cos(Dec) ** before use. ** ** 5) Straight-line motion at constant speed, in the inertial frame, ** is assumed. ** ** 6) An extremely small (or zero or negative) parallax is interpreted ** to mean that the object is on the "celestial sphere", the radius ** of which is an arbitrary (large) value (see the constant PXMIN). ** When the distance is overridden in this way, the status, ** initially zero, has 1 added to it. ** ** 7) If the space velocity is a significant fraction of c (see the ** constant VMAX), it is arbitrarily set to zero. When this action ** occurs, 2 is added to the status. ** ** 8) The relativistic adjustment involves an iterative calculation. ** If the process fails to converge within a set number (IMAX) of ** iterations, 4 is added to the status. ** ** 9) The inverse transformation is performed by the function ** eraPvstar. ** ** Called: ** eraS2pv spherical coordinates to pv-vector ** eraPm modulus of p-vector ** eraZp zero p-vector ** eraPn decompose p-vector into modulus and direction ** eraPdp scalar product of two p-vectors ** eraSxp multiply p-vector by scalar ** eraPmp p-vector minus p-vector ** eraPpp p-vector plus p-vector ** ** Reference: ** ** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Smallest allowed parallax */ static const double PXMIN = 1e-7; /* Largest allowed speed (fraction of c) */ static const double VMAX = 0.5; /* Maximum number of iterations for relativistic solution */ static const int IMAX = 100; int i, iwarn; double w, r, rd, rad, decd, v, x[3], usr[3], ust[3], vsr, vst, betst, betsr, bett, betr, dd, ddel, ur[3], ut[3], d = 0.0, del = 0.0, /* to prevent */ odd = 0.0, oddel = 0.0, /* compiler */ od = 0.0, odel = 0.0; /* warnings */ /* Distance (AU). */ if (px >= PXMIN) { w = px; iwarn = 0; } else { w = PXMIN; iwarn = 1; } r = ERFA_DR2AS / w; /* Radial velocity (AU/day). */ rd = ERFA_DAYSEC * rv * 1e3 / ERFA_DAU; /* Proper motion (radian/day). */ rad = pmr / ERFA_DJY; decd = pmd / ERFA_DJY; /* To pv-vector (AU,AU/day). */ eraS2pv(ra, dec, r, rad, decd, rd, pv); /* If excessive velocity, arbitrarily set it to zero. */ v = eraPm(pv[1]); if (v / ERFA_DC > VMAX) { eraZp(pv[1]); iwarn += 2; } /* Isolate the radial component of the velocity (AU/day). */ eraPn(pv[0], &w, x); vsr = eraPdp(x, pv[1]); eraSxp(vsr, x, usr); /* Isolate the transverse component of the velocity (AU/day). */ eraPmp(pv[1], usr, ust); vst = eraPm(ust); /* Special-relativity dimensionless parameters. */ betsr = vsr / ERFA_DC; betst = vst / ERFA_DC; /* Determine the inertial-to-observed relativistic correction terms. */ bett = betst; betr = betsr; for (i = 0; i < IMAX; i++) { d = 1.0 + betr; del = sqrt(1.0 - betr*betr - bett*bett) - 1.0; betr = d * betsr + del; bett = d * betst; if (i > 0) { dd = fabs(d - od); ddel = fabs(del - odel); if ((i > 1) && (dd >= odd) && (ddel >= oddel)) break; odd = dd; oddel = ddel; } od = d; odel = del; } if (i >= IMAX) iwarn += 4; /* Replace observed radial velocity with inertial value. */ w = (betsr != 0.0) ? d + del / betsr : 1.0; eraSxp(w, usr, ur); /* Replace observed tangential velocity with inertial value. */ eraSxp(d, ust, ut); /* Combine the two to obtain the inertial space velocity. */ eraPpp(ur, ut, pv[1]); /* Return the status. */ return iwarn; } void eraSxp(double s, double p[3], double sp[3]) /* ** - - - - - - - ** e r a S x p ** - - - - - - - ** ** Multiply a p-vector by a scalar. ** ** Given: ** s double scalar ** p double[3] p-vector ** ** Returned: ** sp double[3] s * p ** ** Note: ** It is permissible for p and sp to be the same array. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { sp[0] = s * p[0]; sp[1] = s * p[1]; sp[2] = s * p[2]; return; } void eraSxpv(double s, double pv[2][3], double spv[2][3]) /* ** - - - - - - - - ** e r a S x p v ** - - - - - - - - ** ** Multiply a pv-vector by a scalar. ** ** Given: ** s double scalar ** pv double[2][3] pv-vector ** ** Returned: ** spv double[2][3] s * pv ** ** Note: ** It is permissible for pv and psv to be the same array ** ** Called: ** eraS2xpv multiply pv-vector by two scalars ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraS2xpv(s, s, pv, spv); return; } int eraTaitt(double tai1, double tai2, double *tt1, double *tt2) /* ** - - - - - - - - - ** e r a T a i t t ** - - - - - - - - - ** ** Time scale transformation: International Atomic Time, TAI, to ** Terrestrial Time, TT. ** ** Given: ** tai1,tai2 double TAI as a 2-part Julian Date ** ** Returned: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Note: ** ** tai1+tai2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tai1 is the Julian ** Day Number and tai2 is the fraction of a day. The returned ** tt1,tt2 follow suit. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* TT minus TAI (days). */ static const double dtat = ERFA_TTMTAI/ERFA_DAYSEC; /* Result, safeguarding precision. */ if ( tai1 > tai2 ) { *tt1 = tai1; *tt2 = tai2 + dtat; } else { *tt1 = tai1 + dtat; *tt2 = tai2; } /* Status (always OK). */ return 0; } int eraTaiut1(double tai1, double tai2, double dta, double *ut11, double *ut12) /* ** - - - - - - - - - - ** e r a T a i u t 1 ** - - - - - - - - - - ** ** Time scale transformation: International Atomic Time, TAI, to ** Universal Time, UT1. ** ** Given: ** tai1,tai2 double TAI as a 2-part Julian Date ** dta double UT1-TAI in seconds ** ** Returned: ** ut11,ut12 double UT1 as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tai1+tai2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tai1 is the Julian ** Day Number and tai2 is the fraction of a day. The returned ** UT11,UT12 follow suit. ** ** 2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is ** available from IERS tabulations. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtad; /* Result, safeguarding precision. */ dtad = dta / ERFA_DAYSEC; if ( tai1 > tai2 ) { *ut11 = tai1; *ut12 = tai2 + dtad; } else { *ut11 = tai1 + dtad; *ut12 = tai2; } /* Status (always OK). */ return 0; } int eraTaiutc(double tai1, double tai2, double *utc1, double *utc2) /* ** - - - - - - - - - - ** e r a T a i u t c ** - - - - - - - - - - ** ** Time scale transformation: International Atomic Time, TAI, to ** Coordinated Universal Time, UTC. ** ** Given: ** tai1,tai2 double TAI as a 2-part Julian Date (Note 1) ** ** Returned: ** utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 1-3) ** ** Returned (function value): ** int status: +1 = dubious year (Note 4) ** 0 = OK ** -1 = unacceptable date ** ** Notes: ** ** 1) tai1+tai2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tai1 is the Julian ** Day Number and tai2 is the fraction of a day. The returned utc1 ** and utc2 form an analogous pair, except that a special convention ** is used, to deal with the problem of leap seconds - see the next ** note. ** ** 2) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The convention in the present ** function is that the JD day represents UTC days whether the ** length is 86399, 86400 or 86401 SI seconds. ** ** 3) The function eraD2dtf can be used to transform the UTC quasi-JD ** into calendar date and clock time, including UTC leap second ** handling. ** ** 4) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** Called: ** eraJd2cal JD to Gregorian calendar ** eraDat delta(AT) = TAI-UTC ** eraCal2jd Gregorian calendar to JD ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int big1; int i, iy, im, id, js; double a1, a2, d1, dats1, d2, fd, ddats, dats2, datd, as1, as2, da; /* Put the two parts of the TAI into big-first order. */ big1 = ( tai1 >= tai2 ); if ( big1 ) { a1 = tai1; a2 = tai2; } else { a1 = tai2; a2 = tai1; } /* See if the TAI can possibly be in a leap-second day. */ d1 = a1; dats1 = 0.0; for ( i = -1; i <= 3; i++ ) { d2 = a2 + (double) i; if ( eraJd2cal(d1, d2, &iy, &im, &id, &fd) ) return -1; js = eraDat(iy, im, id, 0.0, &dats2); if ( js < 0 ) return -1; if ( i == -1 ) dats1 = dats2; ddats = dats2 - dats1; datd = dats1 / ERFA_DAYSEC; if ( fabs(ddats) >= 0.5 ) { /* Yes. Get TAI for the start of the UTC day that */ /* ends in a leap. */ if ( eraCal2jd(iy, im, id, &d1, &d2) ) return -1; as1 = d1; as2 = d2 - 1.0 + datd; /* Is the TAI after this point? */ da = a1 - as1; da = da + ( a2 - as2 ); if ( da > 0 ) { /* Yes: fraction of the current UTC day that has elapsed. */ fd = da * ERFA_DAYSEC / ( ERFA_DAYSEC + ddats ); /* Ramp TAI-UTC to bring about ERFA's JD(UTC) convention. */ datd += ddats * ( fd <= 1.0 ? fd : 1.0 ) / ERFA_DAYSEC; } /* Done. */ break; } dats1 = dats2; } /* Subtract the (possibly adjusted) TAI-UTC from TAI to give UTC. */ a2 -= datd; /* Return the UTC result, preserving the TAI order. */ if ( big1 ) { *utc1 = a1; *utc2 = a2; } else { *utc1 = a2; *utc2 = a1; } /* Status. */ return js; } int eraTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2) /* ** - - - - - - - - - - ** e r a T c b t d b ** - - - - - - - - - - ** ** Time scale transformation: Barycentric Coordinate Time, TCB, to ** Barycentric Dynamical Time, TDB. ** ** Given: ** tcb1,tcb2 double TCB as a 2-part Julian Date ** ** Returned: ** tdb1,tdb2 double TDB as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tcb1+tcb2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tcb1 is the Julian ** Day Number and tcb2 is the fraction of a day. The returned ** tdb1,tdb2 follow suit. ** ** 2) The 2006 IAU General Assembly introduced a conventional linear ** transformation between TDB and TCB. This transformation ** compensates for the drift between TCB and terrestrial time TT, ** and keeps TDB approximately centered on TT. Because the ** relationship between TT and TCB depends on the adopted solar ** system ephemeris, the degree of alignment between TDB and TT over ** long intervals will vary according to which ephemeris is used. ** Former definitions of TDB attempted to avoid this problem by ** stipulating that TDB and TT should differ only by periodic ** effects. This is a good description of the nature of the ** relationship but eluded precise mathematical formulation. The ** conventional linear relationship adopted in 2006 sidestepped ** these difficulties whilst delivering a TDB that in practice was ** consistent with values before that date. ** ** 3) TDB is essentially the same as Teph, the time argument for the ** JPL solar system ephemerides. ** ** Reference: ** ** IAU 2006 Resolution B3 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* 1977 Jan 1 00:00:32.184 TT, as two-part JD */ static const double t77td = ERFA_DJM0 + ERFA_DJM77; static const double t77tf = ERFA_TTMTAI/ERFA_DAYSEC; /* TDB (days) at TAI 1977 Jan 1.0 */ static const double tdb0 = ERFA_TDB0/ERFA_DAYSEC; double d; /* Result, safeguarding precision. */ if ( tcb1 > tcb2 ) { d = tcb1 - t77td; *tdb1 = tcb1; *tdb2 = tcb2 + tdb0 - ( d + ( tcb2 - t77tf ) ) * ERFA_ELB; } else { d = tcb2 - t77td; *tdb1 = tcb1 + tdb0 - ( d + ( tcb1 - t77tf ) ) * ERFA_ELB; *tdb2 = tcb2; } /* Status (always OK). */ return 0; } int eraTcgtt(double tcg1, double tcg2, double *tt1, double *tt2) /* ** - - - - - - - - - ** e r a T c g t t ** - - - - - - - - - ** ** Time scale transformation: Geocentric Coordinate Time, TCG, to ** Terrestrial Time, TT. ** ** Given: ** tcg1,tcg2 double TCG as a 2-part Julian Date ** ** Returned: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Note: ** ** tcg1+tcg2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tcg1 is the Julian ** Day Number and tcg22 is the fraction of a day. The returned ** tt1,tt2 follow suit. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),. ** IERS Technical Note No. 32, BKG (2004) ** ** IAU 2000 Resolution B1.9 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* 1977 Jan 1 00:00:32.184 TT, as MJD */ static const double t77t = ERFA_DJM77 + ERFA_TTMTAI/ERFA_DAYSEC; /* Result, safeguarding precision. */ if ( tcg1 > tcg2 ) { *tt1 = tcg1; *tt2 = tcg2 - ( ( tcg1 - ERFA_DJM0 ) + ( tcg2 - t77t ) ) * ERFA_ELG; } else { *tt1 = tcg1 - ( ( tcg2 - ERFA_DJM0 ) + ( tcg1 - t77t ) ) * ERFA_ELG; *tt2 = tcg2; } /* OK status. */ return 0; } int eraTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2) /* ** - - - - - - - - - - ** e r a T d b t c b ** - - - - - - - - - - ** ** Time scale transformation: Barycentric Dynamical Time, TDB, to ** Barycentric Coordinate Time, TCB. ** ** Given: ** tdb1,tdb2 double TDB as a 2-part Julian Date ** ** Returned: ** tcb1,tcb2 double TCB as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tdb1+tdb2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tdb1 is the Julian ** Day Number and tdb2 is the fraction of a day. The returned ** tcb1,tcb2 follow suit. ** ** 2) The 2006 IAU General Assembly introduced a conventional linear ** transformation between TDB and TCB. This transformation ** compensates for the drift between TCB and terrestrial time TT, ** and keeps TDB approximately centered on TT. Because the ** relationship between TT and TCB depends on the adopted solar ** system ephemeris, the degree of alignment between TDB and TT over ** long intervals will vary according to which ephemeris is used. ** Former definitions of TDB attempted to avoid this problem by ** stipulating that TDB and TT should differ only by periodic ** effects. This is a good description of the nature of the ** relationship but eluded precise mathematical formulation. The ** conventional linear relationship adopted in 2006 sidestepped ** these difficulties whilst delivering a TDB that in practice was ** consistent with values before that date. ** ** 3) TDB is essentially the same as Teph, the time argument for the ** JPL solar system ephemerides. ** ** Reference: ** ** IAU 2006 Resolution B3 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* 1977 Jan 1 00:00:32.184 TT, as two-part JD */ static const double t77td = ERFA_DJM0 + ERFA_DJM77; static const double t77tf = ERFA_TTMTAI/ERFA_DAYSEC; /* TDB (days) at TAI 1977 Jan 1.0 */ static const double tdb0 = ERFA_TDB0/ERFA_DAYSEC; /* TDB to TCB rate */ static const double elbb = ERFA_ELB/(1.0-ERFA_ELB); double d, f; /* Result, preserving date format but safeguarding precision. */ if ( tdb1 > tdb2 ) { d = t77td - tdb1; f = tdb2 - tdb0; *tcb1 = tdb1; *tcb2 = f - ( d - ( f - t77tf ) ) * elbb; } else { d = t77td - tdb2; f = tdb1 - tdb0; *tcb1 = f + ( d - ( f - t77tf ) ) * elbb; *tcb2 = tdb2; } /* Status (always OK). */ return 0; } int eraTdbtt(double tdb1, double tdb2, double dtr, double *tt1, double *tt2 ) /* ** - - - - - - - - - ** e r a T d b t t ** - - - - - - - - - ** ** Time scale transformation: Barycentric Dynamical Time, TDB, to ** Terrestrial Time, TT. ** ** Given: ** tdb1,tdb2 double TDB as a 2-part Julian Date ** dtr double TDB-TT in seconds ** ** Returned: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tdb1+tdb2 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where tdb1 is the Julian ** Day Number and tdb2 is the fraction of a day. The returned ** tt1,tt2 follow suit. ** ** 2) The argument dtr represents the quasi-periodic component of the ** GR transformation between TT and TCB. It is dependent upon the ** adopted solar-system ephemeris, and can be obtained by numerical ** integration, by interrogating a precomputed time ephemeris or by ** evaluating a model such as that implemented in the ERFA function ** eraDtdb. The quantity is dominated by an annual term of 1.7 ms ** amplitude. ** ** 3) TDB is essentially the same as Teph, the time argument for the ** JPL solar system ephemerides. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** IAU 2006 Resolution 3 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtrd; /* Result, safeguarding precision. */ dtrd = dtr / ERFA_DAYSEC; if ( tdb1 > tdb2 ) { *tt1 = tdb1; *tt2 = tdb2 - dtrd; } else { *tt1 = tdb1 - dtrd; *tt2 = tdb2; } /* Status (always OK). */ return 0; } int eraTf2a(char s, int ihour, int imin, double sec, double *rad) /* ** - - - - - - - - ** e r a T f 2 a ** - - - - - - - - ** ** Convert hours, minutes, seconds to radians. ** ** Given: ** s char sign: '-' = negative, otherwise positive ** ihour int hours ** imin int minutes ** sec double seconds ** ** Returned: ** rad double angle in radians ** ** Returned (function value): ** int status: 0 = OK ** 1 = ihour outside range 0-23 ** 2 = imin outside range 0-59 ** 3 = sec outside range 0-59.999... ** ** Notes: ** ** 1) The result is computed even if any of the range checks fail. ** ** 2) Negative ihour, imin and/or sec produce a warning status, but ** the absolute value is used in the conversion. ** ** 3) If there are multiple errors, the status value reflects only the ** first, the smallest taking precedence. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Compute the interval. */ *rad = ( s == '-' ? -1.0 : 1.0 ) * ( 60.0 * ( 60.0 * ( (double) abs(ihour) ) + ( (double) abs(imin) ) ) + fabs(sec) ) * ERFA_DS2R; /* Validate arguments and return status. */ if ( ihour < 0 || ihour > 23 ) return 1; if ( imin < 0 || imin > 59 ) return 2; if ( sec < 0.0 || sec >= 60.0 ) return 3; return 0; } int eraTf2d(char s, int ihour, int imin, double sec, double *days) /* ** - - - - - - - - ** e r a T f 2 d ** - - - - - - - - ** ** Convert hours, minutes, seconds to days. ** ** Given: ** s char sign: '-' = negative, otherwise positive ** ihour int hours ** imin int minutes ** sec double seconds ** ** Returned: ** days double interval in days ** ** Returned (function value): ** int status: 0 = OK ** 1 = ihour outside range 0-23 ** 2 = imin outside range 0-59 ** 3 = sec outside range 0-59.999... ** ** Notes: ** ** 1) The result is computed even if any of the range checks fail. ** ** 2) Negative ihour, imin and/or sec produce a warning status, but ** the absolute value is used in the conversion. ** ** 3) If there are multiple errors, the status value reflects only the ** first, the smallest taking precedence. ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Compute the interval. */ *days = ( s == '-' ? -1.0 : 1.0 ) * ( 60.0 * ( 60.0 * ( (double) abs(ihour) ) + ( (double) abs(imin) ) ) + fabs(sec) ) / ERFA_DAYSEC; /* Validate arguments and return status. */ if ( ihour < 0 || ihour > 23 ) return 1; if ( imin < 0 || imin > 59 ) return 2; if ( sec < 0.0 || sec >= 60.0 ) return 3; return 0; } void eraTr(double r[3][3], double rt[3][3]) /* ** - - - - - - ** e r a T r ** - - - - - - ** ** Transpose an r-matrix. ** ** Given: ** r double[3][3] r-matrix ** ** Returned: ** rt double[3][3] transpose ** ** Note: ** It is permissible for r and rt to be the same array. ** ** Called: ** eraCr copy r-matrix ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double wm[3][3]; int i, j; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { wm[i][j] = r[j][i]; } } eraCr(wm, rt); return; } void eraTrxp(double r[3][3], double p[3], double trp[3]) /* ** - - - - - - - - ** e r a T r x p ** - - - - - - - - ** ** Multiply a p-vector by the transpose of an r-matrix. ** ** Given: ** r double[3][3] r-matrix ** p double[3] p-vector ** ** Returned: ** trp double[3] r * p ** ** Note: ** It is permissible for p and trp to be the same array. ** ** Called: ** eraTr transpose r-matrix ** eraRxp product of r-matrix and p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double tr[3][3]; /* Transpose of matrix r. */ eraTr(r, tr); /* Matrix tr * vector p -> vector trp. */ eraRxp(tr, p, trp); return; } void eraTrxpv(double r[3][3], double pv[2][3], double trpv[2][3]) /* ** - - - - - - - - - ** e r a T r x p v ** - - - - - - - - - ** ** Multiply a pv-vector by the transpose of an r-matrix. ** ** Given: ** r double[3][3] r-matrix ** pv double[2][3] pv-vector ** ** Returned: ** trpv double[2][3] r * pv ** ** Note: ** It is permissible for pv and trpv to be the same array. ** ** Called: ** eraTr transpose r-matrix ** eraRxpv product of r-matrix and pv-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double tr[3][3]; /* Transpose of matrix r. */ eraTr(r, tr); /* Matrix tr * vector pv -> vector trpv. */ eraRxpv(tr, pv, trpv); return; } int eraTttai(double tt1, double tt2, double *tai1, double *tai2) /* ** - - - - - - - - - ** e r a T t t a i ** - - - - - - - - - ** ** Time scale transformation: Terrestrial Time, TT, to International ** Atomic Time, TAI. ** ** Given: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned: ** tai1,tai2 double TAI as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Note: ** ** tt1+tt2 is Julian Date, apportioned in any convenient way between ** the two arguments, for example where tt1 is the Julian Day Number ** and tt2 is the fraction of a day. The returned tai1,tai2 follow ** suit. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* TT minus TAI (days). */ static const double dtat = ERFA_TTMTAI/ERFA_DAYSEC; /* Result, safeguarding precision. */ if ( tt1 > tt2 ) { *tai1 = tt1; *tai2 = tt2 - dtat; } else { *tai1 = tt1 - dtat; *tai2 = tt2; } /* Status (always OK). */ return 0; } int eraTttcg(double tt1, double tt2, double *tcg1, double *tcg2) /* ** - - - - - - - - - ** e r a T t t c g ** - - - - - - - - - ** ** Time scale transformation: Terrestrial Time, TT, to Geocentric ** Coordinate Time, TCG. ** ** Given: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned: ** tcg1,tcg2 double TCG as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Note: ** ** tt1+tt2 is Julian Date, apportioned in any convenient way between ** the two arguments, for example where tt1 is the Julian Day Number ** and tt2 is the fraction of a day. The returned tcg1,tcg2 follow ** suit. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** IAU 2000 Resolution B1.9 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* 1977 Jan 1 00:00:32.184 TT, as MJD */ static const double t77t = ERFA_DJM77 + ERFA_TTMTAI/ERFA_DAYSEC; /* TT to TCG rate */ static const double elgg = ERFA_ELG/(1.0-ERFA_ELG); /* Result, safeguarding precision. */ if ( tt1 > tt2 ) { *tcg1 = tt1; *tcg2 = tt2 + ( ( tt1 - ERFA_DJM0 ) + ( tt2 - t77t ) ) * elgg; } else { *tcg1 = tt1 + ( ( tt2 - ERFA_DJM0 ) + ( tt1 - t77t ) ) * elgg; *tcg2 = tt2; } /* Status (always OK). */ return 0; } int eraTttdb(double tt1, double tt2, double dtr, double *tdb1, double *tdb2) /* ** - - - - - - - - - ** e r a T t t d b ** - - - - - - - - - ** ** Time scale transformation: Terrestrial Time, TT, to Barycentric ** Dynamical Time, TDB. ** ** Given: ** tt1,tt2 double TT as a 2-part Julian Date ** dtr double TDB-TT in seconds ** ** Returned: ** tdb1,tdb2 double TDB as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tt1+tt2 is Julian Date, apportioned in any convenient way between ** the two arguments, for example where tt1 is the Julian Day Number ** and tt2 is the fraction of a day. The returned tdb1,tdb2 follow ** suit. ** ** 2) The argument dtr represents the quasi-periodic component of the ** GR transformation between TT and TCB. It is dependent upon the ** adopted solar-system ephemeris, and can be obtained by numerical ** integration, by interrogating a precomputed time ephemeris or by ** evaluating a model such as that implemented in the ERFA function ** eraDtdb. The quantity is dominated by an annual term of 1.7 ms ** amplitude. ** ** 3) TDB is essentially the same as Teph, the time argument for the JPL ** solar system ephemerides. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** IAU 2006 Resolution 3 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtrd; /* Result, safeguarding precision. */ dtrd = dtr / ERFA_DAYSEC; if ( tt1 > tt2 ) { *tdb1 = tt1; *tdb2 = tt2 + dtrd; } else { *tdb1 = tt1 + dtrd; *tdb2 = tt2; } /* Status (always OK). */ return 0; } int eraTtut1(double tt1, double tt2, double dt, double *ut11, double *ut12) /* ** - - - - - - - - - ** e r a T t u t 1 ** - - - - - - - - - ** ** Time scale transformation: Terrestrial Time, TT, to Universal Time, ** UT1. ** ** Given: ** tt1,tt2 double TT as a 2-part Julian Date ** dt double TT-UT1 in seconds ** ** Returned: ** ut11,ut12 double UT1 as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) tt1+tt2 is Julian Date, apportioned in any convenient way between ** the two arguments, for example where tt1 is the Julian Day Number ** and tt2 is the fraction of a day. The returned ut11,ut12 follow ** suit. ** ** 2) The argument dt is classical Delta T. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtd; /* Result, safeguarding precision. */ dtd = dt / ERFA_DAYSEC; if ( tt1 > tt2 ) { *ut11 = tt1; *ut12 = tt2 - dtd; } else { *ut11 = tt1 - dtd; *ut12 = tt2; } /* Status (always OK). */ return 0; } int eraUt1tai(double ut11, double ut12, double dta, double *tai1, double *tai2) /* ** - - - - - - - - - - ** e r a U t 1 t a i ** - - - - - - - - - - ** ** Time scale transformation: Universal Time, UT1, to International ** Atomic Time, TAI. ** ** Given: ** ut11,ut12 double UT1 as a 2-part Julian Date ** dta double UT1-TAI in seconds ** ** Returned: ** tai1,tai2 double TAI as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) ut11+ut12 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where ut11 is the Julian ** Day Number and ut12 is the fraction of a day. The returned ** tai1,tai2 follow suit. ** ** 2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is ** available from IERS tabulations. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtad; /* Result, safeguarding precision. */ dtad = dta / ERFA_DAYSEC; if ( ut11 > ut12 ) { *tai1 = ut11; *tai2 = ut12 - dtad; } else { *tai1 = ut11 - dtad; *tai2 = ut12; } /* Status (always OK). */ return 0; } int eraUt1tt(double ut11, double ut12, double dt, double *tt1, double *tt2) /* ** - - - - - - - - - ** e r a U t 1 t t ** - - - - - - - - - ** ** Time scale transformation: Universal Time, UT1, to Terrestrial ** Time, TT. ** ** Given: ** ut11,ut12 double UT1 as a 2-part Julian Date ** dt double TT-UT1 in seconds ** ** Returned: ** tt1,tt2 double TT as a 2-part Julian Date ** ** Returned (function value): ** int status: 0 = OK ** ** Notes: ** ** 1) ut11+ut12 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where ut11 is the Julian ** Day Number and ut12 is the fraction of a day. The returned ** tt1,tt2 follow suit. ** ** 2) The argument dt is classical Delta T. ** ** Reference: ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double dtd; /* Result, safeguarding precision. */ dtd = dt / ERFA_DAYSEC; if ( ut11 > ut12 ) { *tt1 = ut11; *tt2 = ut12 + dtd; } else { *tt1 = ut11 + dtd; *tt2 = ut12; } /* Status (always OK). */ return 0; } int eraUt1utc(double ut11, double ut12, double dut1, double *utc1, double *utc2) /* ** - - - - - - - - - - ** e r a U t 1 u t c ** - - - - - - - - - - ** ** Time scale transformation: Universal Time, UT1, to Coordinated ** Universal Time, UTC. ** ** Given: ** ut11,ut12 double UT1 as a 2-part Julian Date (Note 1) ** dut1 double Delta UT1: UT1-UTC in seconds (Note 2) ** ** Returned: ** utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 3,4) ** ** Returned (function value): ** int status: +1 = dubious year (Note 5) ** 0 = OK ** -1 = unacceptable date ** ** Notes: ** ** 1) ut11+ut12 is Julian Date, apportioned in any convenient way ** between the two arguments, for example where ut11 is the Julian ** Day Number and ut12 is the fraction of a day. The returned utc1 ** and utc2 form an analogous pair, except that a special convention ** is used, to deal with the problem of leap seconds - see Note 3. ** ** 2) Delta UT1 can be obtained from tabulations provided by the ** International Earth Rotation and Reference Systems Service. The ** value changes abruptly by 1s at a leap second; however, close to ** a leap second the algorithm used here is tolerant of the "wrong" ** choice of value being made. ** ** 3) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The convention in the present ** function is that the returned quasi JD day UTC1+UTC2 represents ** UTC days whether the length is 86399, 86400 or 86401 SI seconds. ** ** 4) The function eraD2dtf can be used to transform the UTC quasi-JD ** into calendar date and clock time, including UTC leap second ** handling. ** ** 5) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** Called: ** eraJd2cal JD to Gregorian calendar ** eraDat delta(AT) = TAI-UTC ** eraCal2jd Gregorian calendar to JD ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int big1; int i, iy, im, id, js; double duts, u1, u2, d1, dats1, d2, fd, dats2, ddats, us1, us2, du; /* UT1-UTC in seconds. */ duts = dut1; /* Put the two parts of the UT1 into big-first order. */ big1 = ( ut11 >= ut12 ); if ( big1 ) { u1 = ut11; u2 = ut12; } else { u1 = ut12; u2 = ut11; } /* See if the UT1 can possibly be in a leap-second day. */ d1 = u1; dats1 = 0; for ( i = -1; i <= 3; i++ ) { d2 = u2 + (double) i; if ( eraJd2cal(d1, d2, &iy, &im, &id, &fd) ) return -1; js = eraDat(iy, im, id, 0.0, &dats2); if ( js < 0 ) return -1; if ( i == - 1 ) dats1 = dats2; ddats = dats2 - dats1; if ( fabs(ddats) >= 0.5 ) { /* Yes, leap second nearby: ensure UT1-UTC is "before" value. */ if ( ddats * duts >= 0 ) duts -= ddats; /* UT1 for the start of the UTC day that ends in a leap. */ if ( eraCal2jd(iy, im, id, &d1, &d2) ) return -1; us1 = d1; us2 = d2 - 1.0 + duts/ERFA_DAYSEC; /* Is the UT1 after this point? */ du = u1 - us1; du += u2 - us2; if ( du > 0 ) { /* Yes: fraction of the current UTC day that has elapsed. */ fd = du * ERFA_DAYSEC / ( ERFA_DAYSEC + ddats ); /* Ramp UT1-UTC to bring about ERFA's JD(UTC) convention. */ duts += ddats * ( fd <= 1.0 ? fd : 1.0 ); } /* Done. */ break; } dats1 = dats2; } /* Subtract the (possibly adjusted) UT1-UTC from UT1 to give UTC. */ u2 -= duts / ERFA_DAYSEC; /* Result, safeguarding precision. */ if ( big1 ) { *utc1 = u1; *utc2 = u2; } else { *utc1 = u2; *utc2 = u1; } /* Status. */ return js; } int eraUtctai(double utc1, double utc2, double *tai1, double *tai2) /* ** - - - - - - - - - - ** e r a U t c t a i ** - - - - - - - - - - ** ** Time scale transformation: Coordinated Universal Time, UTC, to ** International Atomic Time, TAI. ** ** Given: ** utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 1-4) ** ** Returned: ** tai1,tai2 double TAI as a 2-part Julian Date (Note 5) ** ** Returned (function value): ** int status: +1 = dubious year (Note 3) ** 0 = OK ** -1 = unacceptable date ** ** Notes: ** ** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any ** convenient way between the two arguments, for example where utc1 ** is the Julian Day Number and utc2 is the fraction of a day. ** ** 2) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The convention in the present ** function is that the JD day represents UTC days whether the ** length is 86399, 86400 or 86401 SI seconds. ** ** 3) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** 4) The function eraDtf2d converts from calendar date and time of day ** into 2-part Julian Date, and in the case of UTC implements the ** leap-second-ambiguity convention described above. ** ** 5) The returned TAI1,TAI2 are such that their sum is the TAI Julian ** Date. ** ** Called: ** eraJd2cal JD to Gregorian calendar ** eraDat delta(AT) = TAI-UTC ** eraCal2jd Gregorian calendar to JD ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int big1; int iy, im, id, js, iyt, imt, idt; double u1, u2, fd, dats, fdt, datst, ddat, z1, z2, a2; /* Put the two parts of the UTC into big-first order. */ big1 = ( utc1 >= utc2 ); if ( big1 ) { u1 = utc1; u2 = utc2; } else { u1 = utc2; u2 = utc1; } /* Get TAI-UTC now. */ if ( eraJd2cal(u1, u2, &iy, &im, &id, &fd) ) return -1; js = eraDat(iy, im, id, fd, &dats); if ( js < 0 ) return -1; /* Get TAI-UTC tomorrow. */ if ( eraJd2cal(u1+1.5, u2-fd, &iyt, &imt, &idt, &fdt) ) return -1; js = eraDat(iyt, imt, idt, fdt, &datst); if ( js < 0 ) return -1; /* If today ends in a leap second, scale the fraction into SI days. */ ddat = datst - dats; if ( fabs(ddat) > 0.5 ) fd += fd * ddat / ERFA_DAYSEC; /* Today's calendar date to 2-part JD. */ if ( eraCal2jd(iy, im, id, &z1, &z2) ) return -1; /* Assemble the TAI result, preserving the UTC split and order. */ a2 = z1 - u1; a2 += z2; a2 += fd + dats / ERFA_DAYSEC; if ( big1 ) { *tai1 = u1; *tai2 = a2; } else { *tai1 = a2; *tai2 = u1; } /* Status. */ return js; } int eraUtcut1(double utc1, double utc2, double dut1, double *ut11, double *ut12) /* ** - - - - - - - - - - ** e r a U t c u t 1 ** - - - - - - - - - - ** ** Time scale transformation: Coordinated Universal Time, UTC, to ** Universal Time, UT1. ** ** Given: ** utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 1-4) ** dut1 double Delta UT1 = UT1-UTC in seconds (Note 5) ** ** Returned: ** ut11,ut12 double UT1 as a 2-part Julian Date (Note 6) ** ** Returned (function value): ** int status: +1 = dubious year (Note 7) ** 0 = OK ** -1 = unacceptable date ** ** Notes: ** ** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any ** convenient way between the two arguments, for example where utc1 ** is the Julian Day Number and utc2 is the fraction of a day. ** ** 2) JD cannot unambiguously represent UTC during a leap second unless ** special measures are taken. The convention in the present ** function is that the JD day represents UTC days whether the ** length is 86399, 86400 or 86401 SI seconds. ** ** 3) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** 4) The function eraDtf2d converts from calendar date and time of ** day into 2-part Julian Date, and in the case of UTC implements ** the leap-second-ambiguity convention described above. ** ** 5) Delta UT1 can be obtained from tabulations provided by the ** International Earth Rotation and Reference Systems Service. It ** It is the caller's responsibility to supply a DUT argument ** containing the UT1-UTC value that matches the given UTC. ** ** 6) The returned ut11,ut12 are such that their sum is the UT1 Julian ** Date. ** ** 7) The warning status "dubious year" flags UTCs that predate the ** introduction of the time scale and that are too far in the future ** to be trusted. See eraDat for further details. ** ** References: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Explanatory Supplement to the Astronomical Almanac, ** P. Kenneth Seidelmann (ed), University Science Books (1992) ** ** Called: ** eraJd2cal JD to Gregorian calendar ** eraDat delta(AT) = TAI-UTC ** eraUtctai UTC to TAI ** eraTaiut1 TAI to UT1 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { int iy, im, id, js, jw; double w, dat, dta, tai1, tai2; /* Look up TAI-UTC. */ if ( eraJd2cal(utc1, utc2, &iy, &im, &id, &w) ) return -1; js = eraDat ( iy, im, id, 0.0, &dat); if ( js < 0 ) return -1; /* Form UT1-TAI. */ dta = dut1 - dat; /* UTC to TAI to UT1. */ jw = eraUtctai(utc1, utc2, &tai1, &tai2); if ( jw < 0 ) { return -1; } else if ( jw > 0 ) { js = jw; } if ( eraTaiut1(tai1, tai2, dta, ut11, ut12) ) return -1; /* Status. */ return js; } void eraXy06(double date1, double date2, double *x, double *y) /* ** - - - - - - - - ** e r a X y 0 6 ** - - - - - - - - ** ** X,Y coordinates of celestial intermediate pole from series based ** on IAU 2006 precession and IAU 2000A nutation. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** x,y double CIP X,Y coordinates (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The X,Y coordinates are those of the unit vector towards the ** celestial intermediate pole. They represent the combined effects ** of frame bias, precession and nutation. ** ** 3) The fundamental arguments used are as adopted in IERS Conventions ** (2003) and are from Simon et al. (1994) and Souchay et al. ** (1999). ** ** 4) This is an alternative to the angles-based method, via the ERFA ** function eraFw2xy and as used in eraXys06a for example. The two ** methods agree at the 1 microarcsecond level (at present), a ** negligible amount compared with the intrinsic accuracy of the ** models. However, it would be unwise to mix the two methods ** (angles-based and series-based) in a single application. ** ** Called: ** eraFal03 mean anomaly of the Moon ** eraFalp03 mean anomaly of the Sun ** eraFaf03 mean argument of the latitude of the Moon ** eraFad03 mean elongation of the Moon from the Sun ** eraFaom03 mean longitude of the Moon's ascending node ** eraFame03 mean longitude of Mercury ** eraFave03 mean longitude of Venus ** eraFae03 mean longitude of Earth ** eraFama03 mean longitude of Mars ** eraFaju03 mean longitude of Jupiter ** eraFasa03 mean longitude of Saturn ** eraFaur03 mean longitude of Uranus ** eraFane03 mean longitude of Neptune ** eraFapa03 general accumulated precession in longitude ** ** References: ** ** Capitaine, N., Wallace, P.T. & Chapront, J., 2003, ** Astron.Astrophys., 412, 567 ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003), ** IERS Technical Note No. 32, BKG ** ** Simon, J.L., Bretagnon, P., Chapront, J., Chapront-Touze, M., ** Francou, G. & Laskar, J., Astron.Astrophys., 1994, 282, 663 ** ** Souchay, J., Loysel, B., Kinoshita, H., Folgueira, M., 1999, ** Astron.Astrophys.Supp.Ser. 135, 111 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { /* Maximum power of T in the polynomials for X and Y */ #define MAXPT (5) /* Polynomial coefficients (arcsec, X then Y). */ static const double xyp[2][MAXPT+1] = { { -0.016617, 2004.191898, -0.4297829, -0.19861834, 0.000007578, 0.0000059285 }, { -0.006951, -0.025896, -22.4072747, 0.00190059, 0.001112526, 0.0000001358 } }; /* Fundamental-argument multipliers: luni-solar terms */ static const int mfals[][5] = { /* 1-10 */ { 0, 0, 0, 0, 1 }, { 0, 0, 2, -2, 2 }, { 0, 0, 2, 0, 2 }, { 0, 0, 0, 0, 2 }, { 0, 1, 0, 0, 0 }, { 0, 1, 2, -2, 2 }, { 1, 0, 0, 0, 0 }, { 0, 0, 2, 0, 1 }, { 1, 0, 2, 0, 2 }, { 0, 1, -2, 2, -2 }, /* 11-20 */ { 0, 0, 2, -2, 1 }, { 1, 0, -2, 0, -2 }, { 1, 0, 0, -2, 0 }, { 1, 0, 0, 0, 1 }, { 1, 0, 0, 0, -1 }, { 1, 0, -2, -2, -2 }, { 1, 0, 2, 0, 1 }, { 2, 0, -2, 0, -1 }, { 0, 0, 0, 2, 0 }, { 0, 0, 2, 2, 2 }, /* 21-30 */ { 2, 0, 0, -2, 0 }, { 0, 2, -2, 2, -2 }, { 2, 0, 2, 0, 2 }, { 1, 0, 2, -2, 2 }, { 1, 0, -2, 0, -1 }, { 2, 0, 0, 0, 0 }, { 0, 0, 2, 0, 0 }, { 0, 1, 0, 0, 1 }, { 1, 0, 0, -2, -1 }, { 0, 2, 2, -2, 2 }, /* 31-40 */ { 0, 0, 2, -2, 0 }, { 1, 0, 0, -2, 1 }, { 0, 1, 0, 0, -1 }, { 0, 2, 0, 0, 0 }, { 1, 0, -2, -2, -1 }, { 1, 0, 2, 2, 2 }, { 0, 1, 2, 0, 2 }, { 2, 0, -2, 0, 0 }, { 0, 0, 2, 2, 1 }, { 0, 1, -2, 0, -2 }, /* 41-50 */ { 0, 0, 0, 2, 1 }, { 1, 0, 2, -2, 1 }, { 2, 0, 0, -2, -1 }, { 2, 0, 2, -2, 2 }, { 2, 0, 2, 0, 1 }, { 0, 0, 0, 2, -1 }, { 0, 1, -2, 2, -1 }, { 1, 1, 0, -2, 0 }, { 2, 0, 0, -2, 1 }, { 1, 0, 0, 2, 0 }, /* 51-60 */ { 0, 1, 2, -2, 1 }, { 1, -1, 0, 0, 0 }, { 0, 1, -1, 1, -1 }, { 2, 0, -2, 0, -2 }, { 0, 1, 0, -2, 0 }, { 1, 0, 0, -1, 0 }, { 3, 0, 2, 0, 2 }, { 0, 0, 0, 1, 0 }, { 1, -1, 2, 0, 2 }, { 1, 1, -2, -2, -2 }, /* 61-70 */ { 1, 0, -2, 0, 0 }, { 2, 0, 0, 0, -1 }, { 0, 1, -2, -2, -2 }, { 1, 1, 2, 0, 2 }, { 2, 0, 0, 0, 1 }, { 1, 1, 0, 0, 0 }, { 1, 0, -2, 2, -1 }, { 1, 0, 2, 0, 0 }, { 1, -1, 0, -1, 0 }, { 1, 0, 0, 0, 2 }, /* 71-80 */ { 1, 0, -1, 0, -1 }, { 0, 0, 2, 1, 2 }, { 1, 0, -2, -4, -2 }, { 1, -1, 0, -1, -1 }, { 1, 0, 2, 2, 1 }, { 0, 2, -2, 2, -1 }, { 1, 0, 0, 0, -2 }, { 2, 0, -2, -2, -2 }, { 1, 1, 2, -2, 2 }, { 2, 0, -2, -4, -2 }, /* 81-90 */ { 1, 0, -4, 0, -2 }, { 2, 0, 2, -2, 1 }, { 1, 0, 0, -1, -1 }, { 2, 0, 2, 2, 2 }, { 3, 0, 0, 0, 0 }, { 1, 0, 0, 2, 1 }, { 0, 0, 2, -2, -1 }, { 3, 0, 2, -2, 2 }, { 0, 0, 4, -2, 2 }, { 1, 0, 0, -4, 0 }, /* 91-100 */ { 0, 1, 2, 0, 1 }, { 2, 0, 0, -4, 0 }, { 1, 1, 0, -2, -1 }, { 2, 0, -2, 0, 1 }, { 0, 0, 2, 0, -1 }, { 0, 1, -2, 0, -1 }, { 0, 1, 0, 0, 2 }, { 0, 0, 2, -1, 2 }, { 0, 0, 2, 4, 2 }, { 2, 1, 0, -2, 0 }, /* 101-110 */ { 1, 1, 0, -2, 1 }, { 1, -1, 0, -2, 0 }, { 1, -1, 0, -1, -2 }, { 1, -1, 0, 0, 1 }, { 0, 1, -2, 2, 0 }, { 0, 1, 0, 0, -2 }, { 1, -1, 2, 2, 2 }, { 1, 0, 0, 2, -1 }, { 1, -1, -2, -2, -2 }, { 3, 0, 2, 0, 1 }, /* 111-120 */ { 0, 1, 2, 2, 2 }, { 1, 0, 2, -2, 0 }, { 1, 1, -2, -2, -1 }, { 1, 0, 2, -4, 1 }, { 0, 1, -2, -2, -1 }, { 2, -1, 2, 0, 2 }, { 0, 0, 0, 2, 2 }, { 1, -1, 2, 0, 1 }, { 1, -1, -2, 0, -2 }, { 0, 1, 0, 2, 0 }, /* 121-130 */ { 0, 1, 2, -2, 0 }, { 0, 0, 0, 1, 1 }, { 1, 0, -2, -2, 0 }, { 0, 3, 2, -2, 2 }, { 2, 1, 2, 0, 2 }, { 1, 1, 0, 0, 1 }, { 2, 0, 0, 2, 0 }, { 1, 1, 2, 0, 1 }, { 1, 0, 0, -2, -2 }, { 1, 0, -2, 2, 0 }, /* 131-140 */ { 1, 0, -1, 0, -2 }, { 0, 1, 0, -2, 1 }, { 0, 1, 0, 1, 0 }, { 0, 0, 0, 1, -1 }, { 1, 0, -2, 2, -2 }, { 1, -1, 0, 0, -1 }, { 0, 0, 0, 4, 0 }, { 1, -1, 0, 2, 0 }, { 1, 0, 2, 1, 2 }, { 1, 0, 2, -1, 2 }, /* 141-150 */ { 0, 0, 2, 1, 1 }, { 1, 0, 0, -2, 2 }, { 1, 0, -2, 0, 1 }, { 1, 0, -2, -4, -1 }, { 0, 0, 2, 2, 0 }, { 1, 1, 2, -2, 1 }, { 1, 0, -2, 1, -1 }, { 0, 0, 1, 0, 1 }, { 2, 0, -2, -2, -1 }, { 4, 0, 2, 0, 2 }, /* 151-160 */ { 2, -1, 0, 0, 0 }, { 2, 1, 2, -2, 2 }, { 0, 1, 2, 1, 2 }, { 1, 0, 4, -2, 2 }, { 1, 1, 0, 0, -1 }, { 2, 0, 2, 0, 0 }, { 2, 0, -2, -4, -1 }, { 1, 0, -1, 0, 0 }, { 1, 0, 0, 1, 0 }, { 0, 1, 0, 2, 1 }, /* 161-170 */ { 1, 0, -4, 0, -1 }, { 1, 0, 0, -4, -1 }, { 2, 0, 2, 2, 1 }, { 2, 1, 0, 0, 0 }, { 0, 0, 2, -3, 2 }, { 1, 2, 0, -2, 0 }, { 0, 3, 0, 0, 0 }, { 0, 0, 4, 0, 2 }, { 0, 0, 2, -4, 1 }, { 2, 0, 0, -2, -2 }, /* 171-180 */ { 1, 1, -2, -4, -2 }, { 0, 1, 0, -2, -1 }, { 0, 0, 0, 4, 1 }, { 3, 0, 2, -2, 1 }, { 1, 0, 2, 4, 2 }, { 1, 1, -2, 0, -2 }, { 0, 0, 4, -2, 1 }, { 2, -2, 0, -2, 0 }, { 2, 1, 0, -2, -1 }, { 0, 2, 0, -2, 0 }, /* 181-190 */ { 1, 0, 0, -1, 1 }, { 1, 1, 2, 2, 2 }, { 3, 0, 0, 0, -1 }, { 2, 0, 0, -4, -1 }, { 3, 0, 2, 2, 2 }, { 0, 0, 2, 4, 1 }, { 0, 2, -2, -2, -2 }, { 1, -1, 0, -2, -1 }, { 0, 0, 2, -1, 1 }, { 2, 0, 0, 2, 1 }, /* 191-200 */ { 1, -1, -2, 2, -1 }, { 0, 0, 0, 2, -2 }, { 2, 0, 0, -4, 1 }, { 1, 0, 0, -4, 1 }, { 2, 0, 2, -4, 1 }, { 4, 0, 2, -2, 2 }, { 2, 1, -2, 0, -1 }, { 2, 1, -2, -4, -2 }, { 3, 0, 0, -4, 0 }, { 1, -1, 2, 2, 1 }, /* 201-210 */ { 1, -1, -2, 0, -1 }, { 0, 2, 0, 0, 1 }, { 1, 2, -2, -2, -2 }, { 1, 1, 0, -4, 0 }, { 2, 0, 0, -2, 2 }, { 0, 2, 2, -2, 1 }, { 1, 0, 2, 0, -1 }, { 2, 1, 0, -2, 1 }, { 2, -1, -2, 0, -1 }, { 1, -1, -2, -2, -1 }, /* 211-220 */ { 0, 1, -2, 1, -2 }, { 1, 0, -4, 2, -2 }, { 0, 1, 2, 2, 1 }, { 3, 0, 0, 0, 1 }, { 2, -1, 2, 2, 2 }, { 0, 1, -2, -4, -2 }, { 1, 0, -2, -3, -2 }, { 2, 0, 0, 0, 2 }, { 1, -1, 0, -2, -2 }, { 2, 0, -2, 2, -1 }, /* 221-230 */ { 0, 2, -2, 0, -2 }, { 3, 0, -2, 0, -1 }, { 2, -1, 2, 0, 1 }, { 1, 0, -2, -1, -2 }, { 0, 0, 2, 0, 3 }, { 2, 0, -4, 0, -2 }, { 2, 1, 0, -4, 0 }, { 1, 1, -2, 1, -1 }, { 0, 2, 2, 0, 2 }, { 1, -1, 2, -2, 2 }, /* 231-240 */ { 1, -1, 0, -2, 1 }, { 2, 1, 2, 0, 1 }, { 1, 0, 2, -4, 2 }, { 1, 1, -2, 0, -1 }, { 1, 1, 0, 2, 0 }, { 1, 0, 0, -3, 0 }, { 2, 0, 2, -1, 2 }, { 0, 2, 0, 0, -1 }, { 2, -1, 0, -2, 0 }, { 4, 0, 0, 0, 0 }, /* 241-250 */ { 2, 1, -2, -2, -2 }, { 0, 2, -2, 2, 0 }, { 1, 0, 2, 1, 1 }, { 1, 0, -1, 0, -3 }, { 3, -1, 2, 0, 2 }, { 2, 0, 2, -2, 0 }, { 1, -2, 0, 0, 0 }, { 2, 0, 0, 0, -2 }, { 1, 0, 0, 4, 0 }, { 0, 1, 0, 1, 1 }, /* 251-260 */ { 1, 0, 2, 2, 0 }, { 0, 1, 0, 2, -1 }, { 0, 1, 0, 1, -1 }, { 0, 0, 2, -2, 3 }, { 3, 1, 2, 0, 2 }, { 1, 1, 2, 1, 2 }, { 1, 1, -2, 2, -1 }, { 2, -1, 2, -2, 2 }, { 1, -2, 2, 0, 2 }, { 1, 0, 2, -4, 0 }, /* 261-270 */ { 0, 0, 1, 0, 0 }, { 1, 0, 2, -3, 1 }, { 1, -2, 0, -2, 0 }, { 2, 0, 0, 2, -1 }, { 1, 1, 2, -4, 1 }, { 4, 0, 2, 0, 1 }, { 0, 1, 2, 1, 1 }, { 1, 2, 2, -2, 2 }, { 2, 0, 2, 1, 2 }, { 2, 1, 2, -2, 1 }, /* 271-280 */ { 1, 0, 2, -1, 1 }, { 1, 0, 4, -2, 1 }, { 1, -1, 2, -2, 1 }, { 0, 1, 0, -4, 0 }, { 3, 0, -2, -2, -2 }, { 0, 0, 4, -4, 2 }, { 2, 0, -4, -2, -2 }, { 2, -2, 0, -2, -1 }, { 1, 0, 2, -2, -1 }, { 2, 0, -2, -6, -2 }, /* 281-290 */ { 1, 0, -2, 1, -2 }, { 1, 0, -2, 2, 1 }, { 1, -1, 0, 2, -1 }, { 1, 0, -2, 1, 0 }, { 2, -1, 0, -2, 1 }, { 1, -1, 0, 2, 1 }, { 2, 0, -2, -2, 0 }, { 1, 0, 2, -3, 2 }, { 0, 0, 0, 4, -1 }, { 2, -1, 0, 0, 1 }, /* 291-300 */ { 2, 0, 4, -2, 2 }, { 0, 0, 2, 3, 2 }, { 0, 1, 4, -2, 2 }, { 0, 1, -2, 2, 1 }, { 1, 1, 0, 2, 1 }, { 1, 0, 0, 4, 1 }, { 0, 0, 4, 0, 1 }, { 2, 0, 0, -3, 0 }, { 1, 0, 0, -1, -2 }, { 1, -2, -2, -2, -2 }, /* 301-310 */ { 3, 0, 0, 2, 0 }, { 2, 0, 2, -4, 2 }, { 1, 1, -2, -4, -1 }, { 1, 0, -2, -6, -2 }, { 2, -1, 0, 0, -1 }, { 2, -1, 0, 2, 0 }, { 0, 1, 2, -2, -1 }, { 1, 1, 0, 1, 0 }, { 1, 2, 0, -2, -1 }, { 1, 0, 0, 1, -1 }, /* 311-320 */ { 0, 0, 1, 0, 2 }, { 3, 1, 2, -2, 2 }, { 1, 0, -4, -2, -2 }, { 1, 0, 2, 4, 1 }, { 1, -2, 2, 2, 2 }, { 1, -1, -2, -4, -2 }, { 0, 0, 2, -4, 2 }, { 0, 0, 2, -3, 1 }, { 2, 1, -2, 0, 0 }, { 3, 0, -2, -2, -1 }, /* 321-330 */ { 2, 0, 2, 4, 2 }, { 0, 0, 0, 0, 3 }, { 2, -1, -2, -2, -2 }, { 2, 0, 0, -1, 0 }, { 3, 0, 2, -4, 2 }, { 2, 1, 2, 2, 2 }, { 0, 0, 3, 0, 3 }, { 1, 1, 2, 2, 1 }, { 2, 1, 0, 0, -1 }, { 1, 2, 0, -2, 1 }, /* 331-340 */ { 3, 0, 2, 2, 1 }, { 1, -1, -2, 2, -2 }, { 1, 1, 0, -1, 0 }, { 1, 2, 0, 0, 0 }, { 1, 0, 4, 0, 2 }, { 1, -1, 2, 4, 2 }, { 2, 1, 0, 0, 1 }, { 1, 0, 0, 2, 2 }, { 1, -1, -2, 2, 0 }, { 0, 2, -2, -2, -1 }, /* 341-350 */ { 2, 0, -2, 0, 2 }, { 5, 0, 2, 0, 2 }, { 3, 0, -2, -6, -2 }, { 1, -1, 2, -1, 2 }, { 3, 0, 0, -4, -1 }, { 1, 0, 0, 1, 1 }, { 1, 0, -4, 2, -1 }, { 0, 1, 2, -4, 1 }, { 1, 2, 2, 0, 2 }, { 0, 1, 0, -2, -2 }, /* 351-360 */ { 0, 0, 2, -1, 0 }, { 1, 0, 1, 0, 1 }, { 0, 2, 0, -2, 1 }, { 3, 0, 2, 0, 0 }, { 1, 1, -2, 1, 0 }, { 2, 1, -2, -4, -1 }, { 3, -1, 0, 0, 0 }, { 2, -1, -2, 0, 0 }, { 4, 0, 2, -2, 1 }, { 2, 0, -2, 2, 0 }, /* 361-370 */ { 1, 1, 2, -2, 0 }, { 1, 0, -2, 4, -1 }, { 1, 0, -2, -2, 1 }, { 2, 0, 2, -4, 0 }, { 1, 1, 0, -2, -2 }, { 1, 1, -2, -2, 0 }, { 1, 0, 1, -2, 1 }, { 2, -1, -2, -4, -2 }, { 3, 0, -2, 0, -2 }, { 0, 1, -2, -2, 0 }, /* 371-380 */ { 3, 0, 0, -2, -1 }, { 1, 0, -2, -3, -1 }, { 0, 1, 0, -4, -1 }, { 1, -2, 2, -2, 1 }, { 0, 1, -2, 1, -1 }, { 1, -1, 0, 0, 2 }, { 2, 0, 0, 1, 0 }, { 1, -2, 0, 2, 0 }, { 1, 2, -2, -2, -1 }, { 0, 0, 4, -4, 1 }, /* 381-390 */ { 0, 1, 2, 4, 2 }, { 0, 1, -4, 2, -2 }, { 3, 0, -2, 0, 0 }, { 2, -1, 2, 2, 1 }, { 0, 1, -2, -4, -1 }, { 4, 0, 2, 2, 2 }, { 2, 0, -2, -3, -2 }, { 2, 0, 0, -6, 0 }, { 1, 0, 2, 0, 3 }, { 3, 1, 0, 0, 0 }, /* 391-400 */ { 3, 0, 0, -4, 1 }, { 1, -1, 2, 0, 0 }, { 1, -1, 0, -4, 0 }, { 2, 0, -2, 2, -2 }, { 1, 1, 0, -2, 2 }, { 4, 0, 0, -2, 0 }, { 2, 2, 0, -2, 0 }, { 0, 1, 2, 0, 0 }, { 1, 1, 0, -4, 1 }, { 1, 0, 0, -4, -2 }, /* 401-410 */ { 0, 0, 0, 1, 2 }, { 3, 0, 0, 2, 1 }, { 1, 1, 0, -4, -1 }, { 0, 0, 2, 2, -1 }, { 1, 1, 2, 0, 0 }, { 1, -1, 2, -4, 1 }, { 1, 1, 0, 0, 2 }, { 0, 0, 2, 6, 2 }, { 4, 0, -2, -2, -1 }, { 2, 1, 0, -4, -1 }, /* 411-420 */ { 0, 0, 0, 3, 1 }, { 1, -1, -2, 0, 0 }, { 0, 0, 2, 1, 0 }, { 1, 0, 0, 2, -2 }, { 3, -1, 2, 2, 2 }, { 3, -1, 2, -2, 2 }, { 1, 0, 0, -1, 2 }, { 1, -2, 2, -2, 2 }, { 0, 1, 0, 2, 2 }, { 0, 1, -2, -1, -2 }, /* 421-430 */ { 1, 1, -2, 0, 0 }, { 0, 2, 2, -2, 0 }, { 3, -1, -2, -1, -2 }, { 1, 0, 0, -6, 0 }, { 1, 0, -2, -4, 0 }, { 2, 1, 0, -4, 1 }, { 2, 0, 2, 0, -1 }, { 2, 0, -4, 0, -1 }, { 0, 0, 3, 0, 2 }, { 2, 1, -2, -2, -1 }, /* 431-440 */ { 1, -2, 0, 0, 1 }, { 2, -1, 0, -4, 0 }, { 0, 0, 0, 3, 0 }, { 5, 0, 2, -2, 2 }, { 1, 2, -2, -4, -2 }, { 1, 0, 4, -4, 2 }, { 0, 0, 4, -1, 2 }, { 3, 1, 0, -4, 0 }, { 3, 0, 0, -6, 0 }, { 2, 0, 0, 2, 2 }, /* 441-450 */ { 2, -2, 2, 0, 2 }, { 1, 0, 0, -3, 1 }, { 1, -2, -2, 0, -2 }, { 1, -1, -2, -3, -2 }, { 0, 0, 2, -2, -2 }, { 2, 0, -2, -4, 0 }, { 1, 0, -4, 0, 0 }, { 0, 1, 0, -1, 0 }, { 4, 0, 0, 0, -1 }, { 3, 0, 2, -1, 2 }, /* 451-460 */ { 3, -1, 2, 0, 1 }, { 2, 0, 2, -1, 1 }, { 1, 2, 2, -2, 1 }, { 1, 1, 0, 2, -1 }, { 0, 2, 2, 0, 1 }, { 3, 1, 2, 0, 1 }, { 1, 1, 2, 1, 1 }, { 1, 1, 0, -1, 1 }, { 1, -2, 0, -2, -1 }, { 4, 0, 0, -4, 0 }, /* 461-470 */ { 2, 1, 0, 2, 0 }, { 1, -1, 0, 4, 0 }, { 0, 1, 0, -2, 2 }, { 0, 0, 2, 0, -2 }, { 1, 0, -1, 0, 1 }, { 3, 0, 2, -2, 0 }, { 2, 0, 2, 2, 0 }, { 1, 2, 0, -4, 0 }, { 1, -1, 0, -3, 0 }, { 0, 1, 0, 4, 0 }, /* 471 - 480 */ { 0, 1, -2, 0, 0 }, { 2, 2, 2, -2, 2 }, { 0, 0, 0, 1, -2 }, { 0, 2, -2, 0, -1 }, { 4, 0, 2, -4, 2 }, { 2, 0, -4, 2, -2 }, { 2, -1, -2, 0, -2 }, { 1, 1, 4, -2, 2 }, { 1, 1, 2, -4, 2 }, { 1, 0, 2, 3, 2 }, /* 481-490 */ { 1, 0, 0, 4, -1 }, { 0, 0, 0, 4, 2 }, { 2, 0, 0, 4, 0 }, { 1, 1, -2, 2, 0 }, { 2, 1, 2, 1, 2 }, { 2, 1, 2, -4, 1 }, { 2, 0, 2, 1, 1 }, { 2, 0, -4, -2, -1 }, { 2, 0, -2, -6, -1 }, { 2, -1, 2, -1, 2 }, /* 491-500 */ { 1, -2, 2, 0, 1 }, { 1, -2, 0, -2, 1 }, { 1, -1, 0, -4, -1 }, { 0, 2, 2, 2, 2 }, { 0, 2, -2, -4, -2 }, { 0, 1, 2, 3, 2 }, { 0, 1, 0, -4, 1 }, { 3, 0, 0, -2, 1 }, { 2, 1, -2, 0, 1 }, { 2, 0, 4, -2, 1 }, /* 501-510 */ { 2, 0, 0, -3, -1 }, { 2, -2, 0, -2, 1 }, { 2, -1, 2, -2, 1 }, { 1, 0, 0, -6, -1 }, { 1, -2, 0, 0, -1 }, { 1, -2, -2, -2, -1 }, { 0, 1, 4, -2, 1 }, { 0, 0, 2, 3, 1 }, { 2, -1, 0, -1, 0 }, { 1, 3, 0, -2, 0 }, /* 511-520 */ { 0, 3, 0, -2, 0 }, { 2, -2, 2, -2, 2 }, { 0, 0, 4, -2, 0 }, { 4, -1, 2, 0, 2 }, { 2, 2, -2, -4, -2 }, { 4, 1, 2, 0, 2 }, { 4, -1, -2, -2, -2 }, { 2, 1, 0, -2, -2 }, { 2, 1, -2, -6, -2 }, { 2, 0, 0, -1, 1 }, /* 521-530 */ { 2, -1, -2, 2, -1 }, { 1, 1, -2, 2, -2 }, { 1, 1, -2, -3, -2 }, { 1, 0, 3, 0, 3 }, { 1, 0, -2, 1, 1 }, { 1, 0, -2, 0, 2 }, { 1, -1, 2, 1, 2 }, { 1, -1, 0, 0, -2 }, { 1, -1, -4, 2, -2 }, { 0, 3, -2, -2, -2 }, /* 531-540 */ { 0, 1, 0, 4, 1 }, { 0, 0, 4, 2, 2 }, { 3, 0, -2, -2, 0 }, { 2, -2, 0, 0, 0 }, { 1, 1, 2, -4, 0 }, { 1, 1, 0, -3, 0 }, { 1, 0, 2, -3, 0 }, { 1, -1, 2, -2, 0 }, { 0, 2, 0, 2, 0 }, { 0, 0, 2, 4, 0 }, /* 541-550 */ { 1, 0, 1, 0, 0 }, { 3, 1, 2, -2, 1 }, { 3, 0, 4, -2, 2 }, { 3, 0, 2, 1, 2 }, { 3, 0, 0, 2, -1 }, { 3, 0, 0, 0, 2 }, { 3, 0, -2, 2, -1 }, { 2, 0, 4, -4, 2 }, { 2, 0, 2, -3, 2 }, { 2, 0, 0, 4, 1 }, /* 551-560 */ { 2, 0, 0, -3, 1 }, { 2, 0, -4, 2, -1 }, { 2, 0, -2, -2, 1 }, { 2, -2, 2, 2, 2 }, { 2, -2, 0, -2, -2 }, { 2, -1, 0, 2, 1 }, { 2, -1, 0, 2, -1 }, { 1, 1, 2, 4, 2 }, { 1, 1, 0, 1, 1 }, { 1, 1, 0, 1, -1 }, /* 561-570 */ { 1, 1, -2, -6, -2 }, { 1, 0, 0, -3, -1 }, { 1, 0, -4, -2, -1 }, { 1, 0, -2, -6, -1 }, { 1, -2, 2, 2, 1 }, { 1, -2, -2, 2, -1 }, { 1, -1, -2, -4, -1 }, { 0, 2, 0, 0, 2 }, { 0, 1, 2, -4, 2 }, { 0, 1, -2, 4, -1 }, /* 571-580 */ { 5, 0, 0, 0, 0 }, { 3, 0, 0, -3, 0 }, { 2, 2, 0, -4, 0 }, { 1, -1, 2, 2, 0 }, { 0, 1, 0, 3, 0 }, { 4, 0, -2, 0, -1 }, { 3, 0, -2, -6, -1 }, { 3, 0, -2, -1, -1 }, { 2, 1, 2, 2, 1 }, { 2, 1, 0, 2, 1 }, /* 581-590 */ { 2, 0, 2, 4, 1 }, { 2, 0, 2, -6, 1 }, { 2, 0, 2, -2, -1 }, { 2, 0, 0, -6, -1 }, { 2, -1, -2, -2, -1 }, { 1, 2, 2, 0, 1 }, { 1, 2, 0, 0, 1 }, { 1, 0, 4, 0, 1 }, { 1, 0, 2, -6, 1 }, { 1, 0, 2, -4, -1 }, /* 591-600 */ { 1, 0, -1, -2, -1 }, { 1, -1, 2, 4, 1 }, { 1, -1, 2, -3, 1 }, { 1, -1, 0, 4, 1 }, { 1, -1, -2, 1, -1 }, { 0, 1, 2, -2, 3 }, { 3, 0, 0, -2, 0 }, { 1, 0, 1, -2, 0 }, { 0, 2, 0, -4, 0 }, { 0, 0, 2, -4, 0 }, /* 601-610 */ { 0, 0, 1, -1, 0 }, { 0, 0, 0, 6, 0 }, { 0, 2, 0, 0, -2 }, { 0, 1, -2, 2, -3 }, { 4, 0, 0, 2, 0 }, { 3, 0, 0, -1, 0 }, { 3, -1, 0, 2, 0 }, { 2, 1, 0, 1, 0 }, { 2, 1, 0, -6, 0 }, { 2, -1, 2, 0, 0 }, /* 611-620 */ { 1, 0, 2, -1, 0 }, { 1, -1, 0, 1, 0 }, { 1, -1, -2, -2, 0 }, { 0, 1, 2, 2, 0 }, { 0, 0, 2, -3, 0 }, { 2, 2, 0, -2, -1 }, { 2, -1, -2, 0, 1 }, { 1, 2, 2, -4, 1 }, { 0, 1, 4, -4, 2 }, { 0, 0, 0, 3, 2 }, /* 621-630 */ { 5, 0, 2, 0, 1 }, { 4, 1, 2, -2, 2 }, { 4, 0, -2, -2, 0 }, { 3, 1, 2, 2, 2 }, { 3, 1, 0, -2, 0 }, { 3, 1, -2, -6, -2 }, { 3, 0, 0, 0, -2 }, { 3, 0, -2, -4, -2 }, { 3, -1, 0, -3, 0 }, { 3, -1, 0, -2, 0 }, /* 631-640 */ { 2, 1, 2, 0, 0 }, { 2, 1, 2, -4, 2 }, { 2, 1, 2, -2, 0 }, { 2, 1, 0, -3, 0 }, { 2, 1, -2, 0, -2 }, { 2, 0, 0, -4, 2 }, { 2, 0, 0, -4, -2 }, { 2, 0, -2, -5, -2 }, { 2, -1, 2, 4, 2 }, { 2, -1, 0, -2, 2 }, /* 641-650 */ { 1, 3, -2, -2, -2 }, { 1, 1, 0, 0, -2 }, { 1, 1, 0, -6, 0 }, { 1, 1, -2, 1, -2 }, { 1, 1, -2, -1, -2 }, { 1, 0, 2, 1, 0 }, { 1, 0, 0, 3, 0 }, { 1, 0, 0, -4, 2 }, { 1, 0, -2, 4, -2 }, { 1, -2, 0, -1, 0 }, /* 651-NFLS */ { 0, 1, -4, 2, -1 }, { 1, 0, -2, 0, -3 }, { 0, 0, 4, -4, 4 } }; /* Number of frequencies: luni-solar */ static const int NFLS = (int) (sizeof mfals / sizeof (int) / 5); /* Fundamental-argument multipliers: planetary terms */ static const int mfapl[][14] = { /* 1-10 */ { 0, 0, 1, -1, 1, 0, 0, -1, 0, -2, 5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, -8, 12, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -1, 2, 0, 0, 0, 0, 0 }, /* 11-20 */ { 0, 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 2, -5, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, -5, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -1, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, -8, 3, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 6, -8, 3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, 0 }, /* 21-30 */ { 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 1, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 2 }, { 0, 0, 1, -1, 1, 0, 0, 0, -2, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, -1, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, /* 31-40 */ { 0, 0, 0, 0, 0, 0, 0, 2, 0, -2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 1 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, -1, 0, 0, 0 }, /* 41-50 */ { 0, 0, 0, 0, 0, 0, 0, 1, 0, -2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, -2, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, -1, 0, 0, 0, 0, 0, 2 }, { 1, 0, 0, 0, 0, 0,-18, 16, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 2 }, /* 51-60 */ { 0, 0, 1, -1, 1, 0, -5, 7, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0,-10, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, 0, -5, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -1, 0, 0, 0, 2 }, { 1, 0, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1 }, { 1, 0, -2, 0, -2, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 2, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, /* 61-70 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, 0, 3, -8, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-11, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 8,-16, 4, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -3, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0 }, /* 71-80 */ { 0, 0, 0, 0, 0, 0, 6, -8, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 8,-15, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -2, 0, 0, 0, 2 }, { 0, 0, 1, -1, 1, 0, 0, -5, 8, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, 0 }, /* 81-90 */ { 2, 0, 0, -2, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0, -1 }, { 2, 0, 0, -2, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 8,-13, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, -2, 5, 0, 0, 0 }, { 1, 0, 0, -1, 0, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2 }, { 1, 0, 0, 0, -1, 0,-18, 16, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, -5, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, /* 91-100 */ { 1, 0, 0, -2, 0, 0, 19,-21, 3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -8, 13, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7, -9, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2 }, { 1, 0, 0, 0, 1, 0,-18, 16, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 6,-16, 4, 5, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 3, -7, 0, 0, 0, 0, 0, -2 }, /* 101-110 */ { 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }, { 2, 0, 0, -2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, -1, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 2 }, /* 111-120 */ { 0, 0, 0, 0, 1, 0, 0, 1, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2 }, { 0, 0, 2, -2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, -6, 8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, /* 121-130 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-10, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, -2 }, { 1, 0, 0, -1, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, /* 131-140 */ { 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, -3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 2, -3, 0, 0, 0, 0, 0, 0 }, /* 141-150 */ { 1, 0, 0, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 5, -4, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 9,-11, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 8,-15, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -4, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, -1, 0, 0, 0, 2 }, /* 151-160 */ { 1, 0, 0, -1, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, -4, 10, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, -2 }, { 0, 0, 2, -2, 1, 0, -4, 4, 0, 0, 0, 0, 0, 0 }, /* 161-170 */ { 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -3, 0, 0, 0, 0, 2 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -9, 13, 0, 0, 0, 0, 0 }, { 2, 0, 2, 0, 2, 0, 0, 2, 0, -3, 0, 0, 0, 0 }, /* 171-180 */ { 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, 0, 2, 0, 0, 0 }, { 1, 0, 0, -1, -1, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1 }, { 1, 0, 2, 0, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 1, 0, -2, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -2, 4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0 }, /* 181-190 */ { 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1 }, { 0, 0, 2, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, -8, 3, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 6,-10, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 7, -8, 3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 1, 0, -3, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -1, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, -5, 7, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -2, 0, 0, 0, 1 }, /* 191-200 */ { 0, 0, 0, 0, 0, 0, 0, 2, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7,-10, 0, 0, 0, 0, 0, -2 }, { 1, 0, 0, -2, 0, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, -5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6, -8, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, 1, 0, 0, -9, 15, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -2, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -1, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0 }, /* 201-210 */ { 0, 0, 0, 0, 0, 0, 0, 1, -4, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -1, 0, 0, 2 }, { 2, 0, 0, -2, 1, 0, -6, 8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, 1, 0, 3, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 8,-14, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, /* 211-220 */ { 0, 0, 0, 0, 1, 0, 0, 8,-15, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 1, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 2 }, { 2, 0, -1, -1, 0, 0, 0, 3, -7, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -3, 4, 0, 0, 0, 0, 0 }, /* 221-230 */ { 2, 0, 0, -2, 0, 0, 0, -6, 8, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -5, 6, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 1, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -9, 4, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, -2 }, /* 231-240 */ { 0, 0, 0, 0, 0, 0, 0, 2, 0, -4, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1 }, { 0, 0, 0, 0, 0, 0, 7,-11, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 3, -5, 4, 0, 0, 0, 0, 2 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, -1, 1, 0, 0, 0 }, { 2, 0, 0, 0, 0, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 8,-15, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 2, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 0, -1 }, /* 241-250 */ { 0, 0, 1, -1, 1, 0, 0, -1, 0, -1, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -8, 3, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 2, -4, 0, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 3, -5, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -3, 0, 0, 0, 2 }, { 0, 0, 2, -2, 2, 0, -8, 11, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, -8, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -2, 0, 0, 0 }, /* 251-260 */ { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -9, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 7, -9, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 2, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, -2, -2, -2, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -2, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 0, 0, 0, 0, 1 }, /* 261-270 */ { 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, -5, 0, 0, 2 }, { 2, 0, 0, -2, -1, 0, 0, -2, 0, 0, 5, 0, 0, 0 }, { 2, 0, 0, -2, -1, 0, -6, 8, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8, -8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, 2, -5, 0, 0, 2 }, { 0, 0, 0, 0, 1, 0, 3, -7, 4, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, /* 271-280 */ { 0, 0, 1, -1, 0, 0, 0, -1, 0, -2, 5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 6,-15, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 2 }, { 1, 0, 0, -1, 0, 0, 0, -3, 4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -3, 7, -4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, 0, -2, 0, 0, 0, 2 }, /* 281-290 */ { 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, 0, 1 }, { 0, 0, 2, -2, 2, 0, -5, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 2, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 6,-11, 0, 0, 0, 0, -2 }, /* 291-300 */ { 0, 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 3, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 9,-12, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0, 1 }, { 0, 0, 1, -1, 0, 0, -8, 12, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -2, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, -1 }, /* 301-310 */ { 0, 0, 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, -1, 0, 0, 0, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, -5, 0, 0, 0, 0, -2 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 3, -1, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -2, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, -9, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, 2 }, /* 311-320 */ { 0, 0, 0, 0, 0, 0, 9, -9, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 3, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 2, -4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 1 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -9, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2 }, { 0, 0, 2, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, /* 321-330 */ { 0, 0, 2, 0, 2, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, 0, -3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 }, { 2, 0, -1, -1, -1, 0, 0, -1, 0, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4, -3, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 5,-10, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 8,-13, 0, 0, 0, 0, 0, 1 }, { 0, 0, 2, -2, 1, -1, 0, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 0, 2, 0, 0 }, /* 331-340 */ { 0, 0, 0, 0, 1, 0, 3, -5, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 9, -9, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -8, 11, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -2, 0, 0, 2, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, -1, 2, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 2, -6, 0, 0, 0, 0, 0, -2 }, /* 341-350 */ { 0, 0, 0, 0, 0, 0, 0, 8,-15, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 5, -2, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 7,-13, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 2 }, { 0, 0, 2, -2, 1, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8, -8, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 8,-10, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 1 }, /* 351-360 */ { 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -4, 0, 0, 0, 0 }, { 2, 0, 0, -2, -1, 0, 0, -5, 6, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 0, 0, -2 }, { 2, 0, -1, -1, -1, 0, 0, 3, -7, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, -1, 1, 0, 0, 0, 0, 0, 0 }, /* 361-370 */ { 2, 0, 0, -2, 0, 0, 0, -2, 0, 4, -3, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 6,-11, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 1, 0, 0, -6, 8, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 1, 5, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 6, -5, 0, 0, 0, 0, 2 }, { 1, 0, -2, -2, -2, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, 0, 0, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 2, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 1 }, /* 371-380 */ { 0, 0, 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, -2, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, -2, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 1, -6, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2 }, { 0, 0, 0, 0, 0, 0, 3, -5, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 7,-13, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -2, 0, 0, 0, 2 }, /* 381-390 */ { 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 2, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -8, 15, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, -2, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 2, 0, -1, -1, -1, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 1, 0, 2, -2, 2, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 1, 0, -1, 1, -1, 0,-18, 17, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 2, -2, -1, 0, -5, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, /* 391-400 */ { 0, 0, 0, 0, 1, 0, 2, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-16, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2 }, { 0, 0, 0, 0, 2, 0, 0, -1, 2, 0, 0, 0, 0, 0 }, { 2, 0, -1, -1, -2, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6,-10, 0, 0, 0, 0, 0, -1 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, -2, 4, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2 }, { 2, 0, 0, -2, -1, 0, 0, -2, 0, 4, -5, 0, 0, 0 }, /* 401-410 */ { 2, 0, 0, -2, -1, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 2, 0, -1, -1, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 1, -1, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -1, -1, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, { 1, 0, -1, -1, -1, 0, 20,-20, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 1, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -2, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 5, -8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0 }, /* 411-420 */ { 0, 0, 0, 0, 0, 0, 9,-11, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 5, -3, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -3, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1 }, { 0, 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, -2 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, -2, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, -2, 5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, 0 }, /* 421-430 */ { 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, -8, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, -6, 0, 0, 0, 0, -2 }, { 1, 0, 0, -2, 0, 0, 20,-21, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-12, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -4, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 8,-12, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 9,-17, 0, 0, 0, 0, 0 }, /* 431-440 */ { 0, 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 1, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -6, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, -7, 0, 0, 0, 0, -2 }, { 1, 0, 0, -1, 1, 0, 0, -3, 4, 0, 0, 0, 0, 0 }, { 1, 0, -2, 0, -2, 0,-10, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -9, 17, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -4, 0, 0, 0, 0, 0, -2 }, { 1, 0, -2, -2, -2, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 1, 0, -1, 1, -1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, /* 441-450 */ { 0, 0, 2, -2, 2, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, 0, -1, 0, 0, 1, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, -5, 7, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 2, -2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5,-10, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, -4, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, -5, 0, 0, 0, -2 }, /* 451-460 */ { 0, 0, 0, 0, 0, 0, 0, 1, 0, -5, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -2, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -2, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -3, 0, 0, 0, 0, 0, 1 }, { 1, 0, 0, -2, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -7, 4, 0, 0, 0, 0, 0 }, { 2, 0, 2, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, -1, 0, 0, -1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 1, 0, -2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 6,-10, 0, 0, 0, 0, -2 }, /* 461-470 */ { 1, 0, 0, -1, 1, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -3, 0, 3, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, -5, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 1, -3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -4, 6, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 0, 0, -1, 0, 0 }, { 0, 0, 1, -1, 1, 0, -5, 6, 0, 0, 0, 0, 0, 0 }, /* 471-480 */ { 0, 0, 0, 0, 1, 0, 3, -4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7,-10, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 5, -5, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 3, -8, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 2, -5, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 7, -9, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 7, -8, 0, 0, 0, 0, 2 }, /* 481-490 */ { 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -8, 3, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -2, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 2, -4, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, -1 }, { 2, 0, 0, -2, -1, 0, 0, -6, 8, 0, 0, 0, 0, 0 }, { 2, 0, -1, -1, 1, 0, 0, 3, -7, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -7, 9, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0, 0, -1 }, /* 491-500 */ { 0, 0, 1, -1, 2, 0, -8, 12, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 2, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7, -8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 1, 0, 0, -5, 6, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, -1, 0, 0, -2, 0, 3, -1, 0, 0, 0 }, { 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 1, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 1, 0, 0, -2, -1, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, /* 501-510 */ { 1, 0, 0, -1, -1, 0, 0, -3, 4, 0, 0, 0, 0, 0 }, { 1, 0, -1, 0, -1, 0, -3, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -4, 4, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, -8, 11, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, 0, 0, -9, 13, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, 1, -4, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, 0, -1, 0, 1, -3, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 7,-13, 0, 0, 0, 0, 0 }, /* 511-520 */ { 0, 0, 0, 0, 1, 0, 0, 2, 0, -2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 7,-11, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 6, -6, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 6, -4, 0, 0, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 4, -2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -4, 0, 0, 0, 0, 0, 1 }, /* 521-530 */ { 0, 0, 0, 0, 0, 0, 1, -4, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 9,-17, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 7, -7, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 4, -8, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, -7, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -4, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, /* 531-540 */ { 2, 0, 0, -2, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 17,-16, 0, -2, 0, 0, 0, 0 }, { 1, 0, 0, -1, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 3, 0, -4, 0, 0, 0, 0 }, /* 541-550 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 2 }, { 2, 0, 0, -2, 0, 0, 0, -4, 4, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 2, 2, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, /* 551-560 */ { 1, 0, 0, -2, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, 0, -4, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 3, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -2, 2, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, -4, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 2, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 }, /* 561-570 */ { 0, 0, 0, 0, 0, 0, 8, -9, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -2, 0, 0, 0 }, { 2, 0, -2, -2, -2, 0, 0, -2, 0, 2, 0, 0, 0, 0 }, { 1, 0, 0, 0, 1, 0,-10, 3, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, -1, 0,-10, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, 2, -3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, 2, -2, 0, 0, 0, 0, 0, 0 }, /* 571-580 */ { 0, 0, 2, 0, 2, 0, -2, 3, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, 0, 2, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, -1, 0, 2, 0, 0, 0, 0 }, { 2, 0, 2, -2, 2, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 2, 0, 1, -3, 1, 0, -6, 7, 0, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 2, -5, 0, 0, 0, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 5, -5, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 1, 5, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, 0, -2, 0, 0, 5, 0, 0, 0 }, /* 581-590 */ { 2, 0, 0, -2, 0, 0, 0, -2, 0, 0, 2, 0, 0, 0 }, { 2, 0, 0, -2, 0, 0, -4, 4, 0, 0, 0, 0, 0, 0 }, { 2, 0, -2, 0, -2, 0, 0, 5, -9, 0, 0, 0, 0, 0 }, { 2, 0, -1, -1, 0, 0, 0, -1, 0, 3, 0, 0, 0, 0 }, { 1, 0, 2, 0, 2, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 2, 0, 2, 0, 0, 4, -8, 3, 0, 0, 0, 0 }, { 1, 0, 2, 0, 2, 0, 0, -4, 8, -3, 0, 0, 0, 0 }, { 1, 0, 2, 0, 2, 0, -1, 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 2, -2, 2, 0, -3, 3, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, /* 591-600 */ { 1, 0, 0, 0, 0, 0, 0, -2, 0, 3, 0, 0, 0, 0 }, { 1, 0, 0, -2, 0, 0, 0, 2, 0, -2, 0, 0, 0, 0 }, { 1, 0, -2, -2, -2, 0, 0, 1, 0, -1, 0, 0, 0, 0 }, { 1, 0, -1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, -1, -1, 0, 0, 0, 8,-15, 0, 0, 0, 0, 0 }, { 0, 0, 2, 2, 2, 0, 0, 2, 0, -2, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0, -2, 0, 1, 0, 0, 0, 0 }, { 0, 0, 2, -2, 1, 0, 0,-10, 15, 0, 0, 0, 0, 0 }, { 0, 0, 2, -2, 0, -1, 0, 2, 0, 0, 0, 0, 0, 0 }, /* 601-610 */ { 0, 0, 1, -1, 2, 0, 0, -1, 0, 0, -1, 0, 0, 0 }, { 0, 0, 1, -1, 2, 0, -3, 4, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -4, 6, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 1, 0, -1, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, -2, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, -1, -1, 0, -5, 7, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 2, 0, 0, 0, 2, 0, -2, 0, 0, 0, 0 }, /* 611-620 */ { 0, 0, 0, 2, 0, 0, -2, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 2, 0, -3, 5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, -1, 2, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 9,-13, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 8,-14, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 8,-11, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6, -8, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 6, -7, 0, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0, -2 }, /* 621-630 */ { 0, 0, 0, 0, 0, 0, 5, -6, -4, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 5, -4, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 4, -8, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 4, -5, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 3, -3, 0, 2, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 7,-12, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 6, -9, 0, 0, 0, 0, -2 }, /* 631-640 */ { 0, 0, 0, 0, 0, 0, 0, 6, -8, 1, 5, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 6, -4, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 6,-10, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5, 0, -4, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -9, 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, 0, 0, 0, 5, -8, 3, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -7, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 5, -6, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 5,-16, 4, 5, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 5,-13, 0, 0, 0, 0, -2 }, /* 641-650 */ { 0, 0, 0, 0, 0, 0, 0, 3, 0, -5, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -9, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 3, -7, 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -3, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 2, -8, 1, 5, 0, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, -5, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, -3, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 1, 0, -3, 5, 0, 0, 0 }, /* 651-NFPL */ { 0, 0, 0, 0, 0, 0, 0, 1, -3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -6, 3, 0, -2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -2, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } }; /* Number of frequencies: planetary */ static const int NFPL = (int) (sizeof mfapl / sizeof (int) / 14); /* Pointers into amplitudes array, one pointer per frequency */ static const int nc[] = { /* 1-100 */ 1, 21, 37, 51, 65, 79, 91, 103, 115, 127, 139, 151, 163, 172, 184, 196, 207, 219, 231, 240, 252, 261, 273, 285, 297, 309, 318, 327, 339, 351, 363, 372, 384, 396, 405, 415, 423, 435, 444, 452, 460, 467, 474, 482, 490, 498, 506, 513, 521, 528, 536, 543, 551, 559, 566, 574, 582, 590, 597, 605, 613, 620, 628, 636, 644, 651, 658, 666, 674, 680, 687, 695, 702, 710, 717, 725, 732, 739, 746, 753, 760, 767, 774, 782, 790, 798, 805, 812, 819, 826, 833, 840, 846, 853, 860, 867, 874, 881, 888, 895, /* 101-200 */ 901, 908, 914, 921, 928, 934, 941, 948, 955, 962, 969, 976, 982, 989, 996, 1003, 1010, 1017, 1024, 1031, 1037, 1043, 1050, 1057, 1064, 1071, 1078, 1084, 1091, 1098, 1104, 1112, 1118, 1124, 1131, 1138, 1145, 1151, 1157, 1164, 1171, 1178, 1185, 1192, 1199, 1205, 1212, 1218, 1226, 1232, 1239, 1245, 1252, 1259, 1266, 1272, 1278, 1284, 1292, 1298, 1304, 1310, 1316, 1323, 1329, 1335, 1341, 1347, 1353, 1359, 1365, 1371, 1377, 1383, 1389, 1396, 1402, 1408, 1414, 1420, 1426, 1434, 1440, 1446, 1452, 1459, 1465, 1471, 1477, 1482, 1488, 1493, 1499, 1504, 1509, 1514, 1520, 1527, 1532, 1538, /* 201-300 */ 1543, 1548, 1553, 1558, 1564, 1569, 1574, 1579, 1584, 1589, 1594, 1596, 1598, 1600, 1602, 1605, 1608, 1610, 1612, 1617, 1619, 1623, 1625, 1627, 1629, 1632, 1634, 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1654, 1658, 1660, 1662, 1664, 1668, 1670, 1672, 1673, 1675, 1679, 1681, 1683, 1684, 1686, 1688, 1690, 1693, 1695, 1697, 1701, 1703, 1705, 1707, 1709, 1711, 1712, 1715, 1717, 1721, 1723, 1725, 1727, 1729, 1731, 1733, 1735, 1737, 1739, 1741, 1743, 1745, 1747, 1749, 1751, 1753, 1755, 1757, 1759, 1761, 1762, 1764, 1766, 1768, 1769, 1771, 1773, 1775, 1777, 1779, 1781, 1783, 1785, 1787, 1788, 1790, /* 301-400 */ 1792, 1794, 1796, 1798, 1800, 1802, 1804, 1806, 1807, 1809, 1811, 1815, 1817, 1819, 1821, 1823, 1825, 1827, 1829, 1831, 1833, 1835, 1837, 1839, 1840, 1842, 1844, 1848, 1850, 1852, 1854, 1856, 1858, 1859, 1860, 1862, 1864, 1866, 1868, 1869, 1871, 1873, 1875, 1877, 1879, 1881, 1883, 1885, 1887, 1889, 1891, 1892, 1896, 1898, 1900, 1901, 1903, 1905, 1907, 1909, 1910, 1911, 1913, 1915, 1919, 1921, 1923, 1927, 1929, 1931, 1933, 1935, 1937, 1939, 1943, 1945, 1947, 1948, 1949, 1951, 1953, 1955, 1957, 1958, 1960, 1962, 1964, 1966, 1968, 1970, 1971, 1973, 1974, 1975, 1977, 1979, 1980, 1981, 1982, 1984, /* 401-500 */ 1986, 1988, 1990, 1992, 1994, 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2008, 2009, 2011, 2013, 2015, 2017, 2019, 2021, 2023, 2024, 2025, 2027, 2029, 2031, 2033, 2035, 2037, 2041, 2043, 2045, 2046, 2047, 2049, 2051, 2053, 2055, 2056, 2057, 2059, 2061, 2063, 2065, 2067, 2069, 2070, 2071, 2072, 2074, 2076, 2078, 2080, 2082, 2084, 2086, 2088, 2090, 2092, 2094, 2095, 2096, 2097, 2099, 2101, 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2113, 2115, 2119, 2121, 2123, 2125, 2127, 2129, 2131, 2133, 2135, 2136, 2137, 2139, 2141, 2143, 2145, 2147, 2149, 2151, 2153, 2155, 2157, 2159, 2161, 2163, 2165, 2167, /* 501-600 */ 2169, 2171, 2173, 2175, 2177, 2179, 2181, 2183, 2185, 2186, 2187, 2188, 2192, 2193, 2195, 2197, 2199, 2201, 2203, 2205, 2207, 2209, 2211, 2213, 2217, 2219, 2221, 2223, 2225, 2227, 2229, 2231, 2233, 2234, 2235, 2236, 2237, 2238, 2239, 2240, 2241, 2244, 2246, 2248, 2250, 2252, 2254, 2256, 2258, 2260, 2262, 2264, 2266, 2268, 2270, 2272, 2274, 2276, 2278, 2280, 2282, 2284, 2286, 2288, 2290, 2292, 2294, 2296, 2298, 2300, 2302, 2303, 2304, 2305, 2306, 2307, 2309, 2311, 2313, 2315, 2317, 2319, 2321, 2323, 2325, 2327, 2329, 2331, 2333, 2335, 2337, 2341, 2343, 2345, 2347, 2349, 2351, 2352, 2355, 2356, /* 601-700 */ 2357, 2358, 2359, 2361, 2363, 2364, 2365, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2376, 2378, 2380, 2382, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2417, 2418, 2430, 2438, 2445, 2453, 2460, 2468, 2474, 2480, 2488, 2496, 2504, 2512, 2520, 2527, 2535, 2543, 2550, 2558, 2566, 2574, 2580, 2588, 2596, 2604, 2612, 2619, 2627, 2634, 2642, 2648, 2656, 2664, 2671, 2679, 2685, 2693, 2701, 2709, 2717, 2725, 2733, 2739, 2747, 2753, 2761, 2769, /* 701-800 */ 2777, 2785, 2793, 2801, 2809, 2817, 2825, 2833, 2841, 2848, 2856, 2864, 2872, 2878, 2884, 2892, 2898, 2906, 2914, 2922, 2930, 2938, 2944, 2952, 2958, 2966, 2974, 2982, 2988, 2996, 3001, 3009, 3017, 3025, 3032, 3039, 3045, 3052, 3059, 3067, 3069, 3076, 3083, 3090, 3098, 3105, 3109, 3111, 3113, 3120, 3124, 3128, 3132, 3136, 3140, 3144, 3146, 3150, 3158, 3161, 3165, 3166, 3168, 3172, 3176, 3180, 3182, 3185, 3189, 3193, 3194, 3197, 3200, 3204, 3208, 3212, 3216, 3219, 3221, 3222, 3226, 3230, 3234, 3238, 3242, 3243, 3247, 3251, 3254, 3258, 3262, 3266, 3270, 3274, 3275, 3279, 3283, 3287, 3289, 3293, /* 801-900 */ 3296, 3300, 3303, 3307, 3311, 3315, 3319, 3321, 3324, 3327, 3330, 3334, 3338, 3340, 3342, 3346, 3350, 3354, 3358, 3361, 3365, 3369, 3373, 3377, 3381, 3385, 3389, 3393, 3394, 3398, 3402, 3406, 3410, 3413, 3417, 3421, 3425, 3429, 3433, 3435, 3439, 3443, 3446, 3450, 3453, 3457, 3458, 3461, 3464, 3468, 3472, 3476, 3478, 3481, 3485, 3489, 3493, 3497, 3501, 3505, 3507, 3511, 3514, 3517, 3521, 3524, 3525, 3527, 3529, 3533, 3536, 3540, 3541, 3545, 3548, 3551, 3555, 3559, 3563, 3567, 3569, 3570, 3574, 3576, 3578, 3582, 3586, 3590, 3593, 3596, 3600, 3604, 3608, 3612, 3616, 3620, 3623, 3626, 3630, 3632, /* 901-1000 */ 3636, 3640, 3643, 3646, 3648, 3652, 3656, 3660, 3664, 3667, 3669, 3671, 3675, 3679, 3683, 3687, 3689, 3693, 3694, 3695, 3699, 3703, 3705, 3707, 3710, 3713, 3717, 3721, 3725, 3729, 3733, 3736, 3740, 3744, 3748, 3752, 3754, 3757, 3759, 3763, 3767, 3770, 3773, 3777, 3779, 3783, 3786, 3790, 3794, 3798, 3801, 3805, 3809, 3813, 3817, 3821, 3825, 3827, 3831, 3835, 3836, 3837, 3840, 3844, 3848, 3852, 3856, 3859, 3863, 3867, 3869, 3871, 3875, 3879, 3883, 3887, 3890, 3894, 3898, 3901, 3905, 3909, 3913, 3917, 3921, 3922, 3923, 3924, 3926, 3930, 3932, 3936, 3938, 3940, 3944, 3948, 3952, 3956, 3959, 3963, /* 1001-1100 */ 3965, 3969, 3973, 3977, 3979, 3981, 3982, 3986, 3989, 3993, 3997, 4001, 4004, 4006, 4009, 4012, 4016, 4020, 4024, 4026, 4028, 4032, 4036, 4040, 4044, 4046, 4050, 4054, 4058, 4060, 4062, 4063, 4064, 4068, 4071, 4075, 4077, 4081, 4083, 4087, 4089, 4091, 4095, 4099, 4101, 4103, 4105, 4107, 4111, 4115, 4119, 4123, 4127, 4129, 4131, 4135, 4139, 4141, 4143, 4145, 4149, 4153, 4157, 4161, 4165, 4169, 4173, 4177, 4180, 4183, 4187, 4191, 4195, 4198, 4201, 4205, 4209, 4212, 4213, 4216, 4217, 4221, 4223, 4226, 4230, 4234, 4236, 4240, 4244, 4248, 4252, 4256, 4258, 4262, 4264, 4266, 4268, 4270, 4272, 4276, /* 1101-1200 */ 4279, 4283, 4285, 4287, 4289, 4293, 4295, 4299, 4300, 4301, 4305, 4309, 4313, 4317, 4319, 4323, 4325, 4329, 4331, 4333, 4335, 4337, 4341, 4345, 4349, 4351, 4353, 4357, 4361, 4365, 4367, 4369, 4373, 4377, 4381, 4383, 4387, 4389, 4391, 4395, 4399, 4403, 4407, 4411, 4413, 4414, 4415, 4418, 4419, 4421, 4423, 4427, 4429, 4431, 4433, 4435, 4437, 4439, 4443, 4446, 4450, 4452, 4456, 4458, 4460, 4462, 4466, 4469, 4473, 4477, 4481, 4483, 4487, 4489, 4491, 4493, 4497, 4499, 4501, 4504, 4506, 4510, 4513, 4514, 4515, 4518, 4521, 4522, 4525, 4526, 4527, 4530, 4533, 4534, 4537, 4541, 4542, 4543, 4544, 4545, /* 1201-1300 */ 4546, 4547, 4550, 4553, 4554, 4555, 4558, 4561, 4564, 4567, 4568, 4571, 4574, 4575, 4578, 4581, 4582, 4585, 4586, 4588, 4590, 4592, 4596, 4598, 4602, 4604, 4608, 4612, 4613, 4616, 4619, 4622, 4623, 4624, 4625, 4626, 4629, 4632, 4633, 4636, 4639, 4640, 4641, 4642, 4643, 4644, 4645, 4648, 4649, 4650, 4651, 4652, 4653, 4656, 4657, 4660, 4661, 4664, 4667, 4670, 4671, 4674, 4675, 4676, 4677, 4678, 4681, 4682, 4683, 4684, 4687, 4688, 4689, 4692, 4693, 4696, 4697, 4700, 4701, 4702, 4703, 4704, 4707, 4708, 4711, 4712, 4715, 4716, 4717, 4718, 4719, 4720, 4721, 4722, 4723, 4726, 4729, 4730, 4733, 4736, /* 1301-(NFLS+NFPL) */ 4737, 4740, 4741, 4742, 4745, 4746, 4749, 4752, 4753 }; /* Amplitude coefficients (microarcsec); indexed using the nc array. */ static const double a[] = { /* 1-105 */ -6844318.44, 9205236.26,1328.67,1538.18, 205833.11, 153041.79, -3309.73, 853.32,2037.98, -2301.27, 81.46, 120.56, -20.39, -15.22, 1.73, -1.61, -0.10, 0.11, -0.02, -0.02, -523908.04, 573033.42,-544.75,-458.66, 12814.01, 11714.49, 198.97,-290.91, 155.74,-143.27, -2.75, -1.03, -1.27, -1.16, 0.00, -0.01, -90552.22, 97846.69, 111.23, 137.41,2187.91,2024.68, 41.44, -51.26, 26.92, -24.46, -0.46, -0.28, -0.22, -0.20, 82168.76, -89618.24, -27.64, -29.05, -2004.36, -1837.32, -36.07, 48.00, -24.43, 22.41, 0.47, 0.24, 0.20, 0.18, 58707.02,7387.02, 470.05,-192.40, 164.33, -1312.21, -179.73, -28.93, -17.36, -1.83, -0.50, 3.57, 0.00, 0.13, -20557.78, 22438.42, -20.84, -17.40, 501.82, 459.68, 59.20, -67.30, 6.08, -5.61, -1.36, -1.19, 28288.28, -674.99, -34.69, 35.80, -15.07,-632.54, -11.19, 0.78, -8.41, 0.17, 0.01, 0.07, -15406.85, 20069.50, 15.12, /* 106-219 */ 31.80, 448.76, 344.50, -5.77, 1.41, 4.59, -5.02, 0.17, 0.24, -11991.74, 12902.66, 32.46, 36.70, 288.49, 268.14, 5.70, -7.06, 3.57, -3.23, -0.06, -0.04, -8584.95, -9592.72, 4.42, -13.20,-214.50, 192.06, 23.87, 29.83, 2.54, 2.40, 0.60, -0.48,5095.50, -6918.22, 7.19, 3.92,-154.91,-113.94, 2.86, -1.04, -1.52, 1.73, -0.07, -0.10, -4910.93, -5331.13, 0.76, 0.40,-119.21, 109.81, 2.16, 3.20, 1.46, 1.33, 0.04, -0.02, -6245.02,-123.48, -6.68, -8.20, -2.76, 139.64, 2.71, 0.15, 1.86,2511.85, -3323.89, 1.07, -0.90, -74.33, -56.17, 1.16, -0.01, -0.75, 0.83, -0.02, -0.04,2307.58,3143.98, -7.52, 7.50, 70.31, -51.60, 1.46, 0.16, -0.69, -0.79, 0.02, -0.05,2372.58,2554.51, 5.93, -6.60, 57.12, -53.05, -0.96, -1.24, -0.71, -0.64, -0.01, -2053.16,2636.13, 5.13, 7.80, 58.94, 45.91, -0.42, -0.12, 0.61, -0.66, 0.02, 0.03, -1825.49, /* 220-339 */ -2423.59, 1.23, -2.00, -54.19, 40.82, -1.07, -1.02, 0.54, 0.61, -0.04, 0.04,2521.07,-122.28, -5.97, 2.90, -2.73, -56.37, -0.82, 0.13, -0.75, -1534.09,1645.01, 6.29, 6.80, 36.78, 34.30, 0.92, -1.25, 0.46, -0.41, -0.02, -0.01,1898.27, 47.70, -0.72, 2.50, 1.07, -42.45, -0.94, 0.02, -0.56, -1292.02, -1387.00, 0.00, 0.00, -31.01, 28.89, 0.68, 0.00, 0.38, 0.35, -0.01, -0.01, -1234.96,1323.81, 5.21, 5.90, 29.60, 27.61, 0.74, -1.22, 0.37, -0.33, -0.02, -0.01,1137.48, -1233.89, -0.04, -0.30, -27.59, -25.43, -0.61, 1.00, -0.34, 0.31, 0.01, 0.01,-813.13, -1075.60, 0.40, 0.30, -24.05, 18.18, -0.40, -0.01, 0.24, 0.27, -0.01, 0.01,1163.22, -60.90, -2.94, 1.30, -1.36, -26.01, -0.58, 0.07, -0.35,1029.70, -55.55, -2.63, 1.10, -1.25, -23.02, -0.52, 0.06, -0.31,-556.26, 852.85, 3.16, -4.48, 19.06, 12.44, -0.81, -0.27, 0.17, -0.21, 0.00, 0.02,-603.52, /* 340-467 */ -800.34, 0.44, 0.10, -17.90, 13.49, -0.08, -0.01, 0.18, 0.20, -0.01, 0.01,-628.24, 684.99, -0.64, -0.50, 15.32, 14.05, 3.18, -4.19, 0.19, -0.17, -0.09, -0.07,-866.48, -16.26, 0.52, -1.30, -0.36, 19.37, 0.43, -0.01, 0.26, -512.37, 695.54, -1.47, -1.40, 15.55, 11.46, -0.16, 0.03, 0.15, -0.17, 0.01, 0.01, 506.65, 643.75, 2.54, -2.62, 14.40, -11.33, -0.77, -0.06, -0.15, -0.16, 0.00, 0.01, 664.57, 16.81, -0.40, 1.00, 0.38, -14.86, -3.71, -0.09, -0.20, 405.91, 522.11, 0.99, -1.50, 11.67, -9.08, -0.25, -0.02, -0.12, -0.13,-305.78, 326.60, 1.75, 1.90, 7.30, 6.84, 0.20, -0.04, 300.99,-325.03, -0.44, -0.50, -7.27, -6.73, -1.01, 0.01, 0.00, 0.08, 0.00, 0.02, 438.51, 10.47, -0.56, -0.20, 0.24, -9.81, -0.24, 0.01, -0.13, -264.02, 335.24, 0.99, 1.40, 7.49, 5.90, -0.27, -0.02, 284.09, 307.03, 0.32, -0.40, 6.87, -6.35, -0.99, -0.01, -250.54, 327.11, 0.08, 0.40, 7.31, 5.60, -0.30, 230.72, /* 468-595 */ -304.46, 0.08, -0.10, -6.81, -5.16, 0.27, 229.78, 304.17, -0.60, 0.50, 6.80, -5.14, 0.33, 0.01, 256.30,-276.81, -0.28, -0.40, -6.19, -5.73, -0.14, 0.01,-212.82, 269.45, 0.84, 1.20, 6.02, 4.76, 0.14, -0.02, 196.64, 272.05, -0.84, 0.90, 6.08, -4.40, 0.35, 0.02, 188.95, 272.22, -0.12, 0.30, 6.09, -4.22, 0.34,-292.37, -5.10, -0.32, -0.40, -0.11, 6.54, 0.14, 0.01, 161.79,-220.67, 0.24, 0.10, -4.93, -3.62, -0.08, 261.54, -19.94, -0.95, 0.20, -0.45, -5.85, -0.13, 0.02, 142.16,-190.79, 0.20, 0.10, -4.27, -3.18, -0.07, 187.95, -4.11, -0.24, 0.30, -0.09, -4.20, -0.09, 0.01, 0.00, 0.00, -79.08, 167.90, 0.04, 0.00, 3.75, 1.77, 121.98, 131.04, -0.08, 0.10, 2.93, -2.73, -0.06,-172.95, -8.11, -0.40, -0.20, -0.18, 3.87, 0.09, 0.01,-160.15, -55.30, -14.04, 13.90, -1.23, 3.58, 0.40, 0.31,-115.40, 123.20, 0.60, 0.70, 2.75, 2.58, 0.08, -0.01,-168.26, -2.00, 0.20, -0.20, -0.04, 3.76, /* 596-723 */ 0.08,-114.49, 123.20, 0.32, 0.40, 2.75, 2.56, 0.07, -0.01, 112.14, 120.70, 0.28, -0.30, 2.70, -2.51, -0.07, -0.01, 161.34, 4.03, 0.20, 0.20, 0.09, -3.61, -0.08, 91.31, 126.64, -0.40, 0.40, 2.83, -2.04, -0.04, 0.01, 105.29, 112.90, 0.44, -0.50, 2.52, -2.35, -0.07, -0.01, 98.69,-106.20, -0.28, -0.30, -2.37, -2.21, -0.06, 0.01, 86.74,-112.94, -0.08, -0.20, -2.53, -1.94, -0.05,-134.81, 3.51, 0.20, -0.20, 0.08, 3.01, 0.07, 79.03, 107.31, -0.24, 0.20, 2.40, -1.77, -0.04, 0.01, 132.81, -10.77, -0.52, 0.10, -0.24, -2.97, -0.07, 0.01,-130.31, -0.90, 0.04, 0.00, 0.00, 2.91, -78.56, 85.32, 0.00, 0.00, 1.91, 1.76, 0.04, 0.00, 0.00, -41.53, 89.10, 0.02, 0.00, 1.99, 0.93, 66.03, -71.00, -0.20, -0.20, -1.59, -1.48, -0.04, 60.50, 64.70, 0.36, -0.40, 1.45, -1.35, -0.04, -0.01, -52.27, -70.01, 0.00, 0.00, -1.57, 1.17, 0.03, -52.95, 66.29, 0.32, 0.40, 1.48, 1.18, 0.04, /* 724-851 */ -0.01, 51.02, 67.25, 0.00, 0.00, 1.50, -1.14, -0.03, -55.66, -60.92, 0.16, -0.20, -1.36, 1.24, 0.03, -54.81, -59.20, -0.08, 0.20, -1.32, 1.23, 0.03, 51.32, -55.60, 0.00, 0.00, -1.24, -1.15, -0.03, 48.29, 51.80, 0.20, -0.20, 1.16, -1.08, -0.03, -45.59, -49.00, -0.12, 0.10, -1.10, 1.02, 0.03, 40.54, -52.69, -0.04, -0.10, -1.18, -0.91, -0.02, -40.58, -49.51, -1.00, 1.00, -1.11, 0.91, 0.04, 0.02, -43.76, 46.50, 0.36, 0.40, 1.04, 0.98, 0.03, -0.01, 62.65, -5.00, -0.24, 0.00, -0.11, -1.40, -0.03, 0.01, -38.57, 49.59, 0.08, 0.10, 1.11, 0.86, 0.02, -33.22, -44.04, 0.08, -0.10, -0.98, 0.74, 0.02, 37.15, -39.90, -0.12, -0.10, -0.89, -0.83, -0.02, 36.68, -39.50, -0.04, -0.10, -0.88, -0.82, -0.02, -53.22, -3.91, -0.20, 0.00, -0.09, 1.19, 0.03, 32.43, -42.19, -0.04, -0.10, -0.94, -0.73, -0.02, -51.00, -2.30, -0.12, -0.10, 0.00, 1.14, -29.53, -39.11, 0.04, 0.00, -0.87, 0.66, /* 852-979 */ 0.02, 28.50, -38.92, -0.08, -0.10, -0.87, -0.64, -0.02, 26.54, 36.95, -0.12, 0.10, 0.83, -0.59, -0.01, 26.54, 34.59, 0.04, -0.10, 0.77, -0.59, -0.02, 28.35, -32.55, -0.16, 0.20, -0.73, -0.63, -0.01, -28.00, 30.40, 0.00, 0.00, 0.68, 0.63, 0.01, -27.61, 29.40, 0.20, 0.20, 0.66, 0.62, 0.02, 40.33, 0.40, -0.04, 0.10, 0.00, -0.90, -23.28, 31.61, -0.08, -0.10, 0.71, 0.52, 0.01, 37.75, 0.80, 0.04, 0.10, 0.00, -0.84, 23.66, 25.80, 0.00, 0.00, 0.58, -0.53, -0.01, 21.01, -27.91, 0.00, 0.00, -0.62, -0.47, -0.01, -34.81, 2.89, 0.04, 0.00, 0.00, 0.78, -23.49, -25.31, 0.00, 0.00, -0.57, 0.53, 0.01, -23.47, 25.20, 0.16, 0.20, 0.56, 0.52, 0.02, 19.58, 27.50, -0.12, 0.10, 0.62, -0.44, -0.01, -22.67, -24.40, -0.08, 0.10, -0.55, 0.51, 0.01, -19.97, 25.00, 0.12, 0.20, 0.56, 0.45, 0.01, 21.28, -22.80, -0.08, -0.10, -0.51, -0.48, -0.01, -30.47, 0.91, 0.04, 0.00, /* 980-1107 */ 0.00, 0.68, 18.58, 24.00, 0.04, -0.10, 0.54, -0.42, -0.01, -18.02, 24.40, -0.04, -0.10, 0.55, 0.40, 0.01, 17.74, 22.50, 0.08, -0.10, 0.50, -0.40, -0.01, -19.41, 20.70, 0.08, 0.10, 0.46, 0.43, 0.01, -18.64, 20.11, 0.00, 0.00, 0.45, 0.42, 0.01, -16.75, 21.60, 0.04, 0.10, 0.48, 0.37, 0.01, -18.42, -20.00, 0.00, 0.00, -0.45, 0.41, 0.01, -26.77, 1.41, 0.08, 0.00, 0.00, 0.60, -26.17, -0.19, 0.00, 0.00, 0.00, 0.59, -15.52, 20.51, 0.00, 0.00, 0.46, 0.35, 0.01, -25.42, -1.91, -0.08, 0.00, -0.04, 0.57, 0.45, -17.42, 18.10, 0.00, 0.00, 0.40, 0.39, 0.01, 16.39, -17.60, -0.08, -0.10, -0.39, -0.37, -0.01, -14.37, 18.91, 0.00, 0.00, 0.42, 0.32, 0.01, 23.39, -2.40, -0.12, 0.00, 0.00, -0.52, 14.32, -18.50, -0.04, -0.10, -0.41, -0.32, -0.01, 15.69, 17.08, 0.00, 0.00, 0.38, -0.35, -0.01, -22.99, 0.50, 0.04, 0.00, 0.00, 0.51, 0.00, 0.00, 14.47, -17.60, /* 1108-1235 */ -0.01, 0.00, -0.39, -0.32, -13.33, 18.40, -0.04, -0.10, 0.41, 0.30, 22.47, -0.60, -0.04, 0.00, 0.00, -0.50, -12.78, -17.41, 0.04, 0.00, -0.39, 0.29, 0.01, -14.10, -15.31, 0.04, 0.00, -0.34, 0.32, 0.01, 11.98, 16.21, -0.04, 0.00, 0.36, -0.27, -0.01, 19.65, -1.90, -0.08, 0.00, 0.00, -0.44, 19.61, -1.50, -0.08, 0.00, 0.00, -0.44, 13.41, -14.30, -0.04, -0.10, -0.32, -0.30, -0.01, -13.29, 14.40, 0.00, 0.00, 0.32, 0.30, 0.01, 11.14, -14.40, -0.04, 0.00, -0.32, -0.25, -0.01, 12.24, -13.38, 0.04, 0.00, -0.30, -0.27, -0.01, 10.07, -13.81, 0.04, 0.00, -0.31, -0.23, -0.01, 10.46, 13.10, 0.08, -0.10, 0.29, -0.23, -0.01, 16.55, -1.71, -0.08, 0.00, 0.00, -0.37, 9.75, -12.80, 0.00, 0.00, -0.29, -0.22, -0.01, 9.11, 12.80, 0.00, 0.00, 0.29, -0.20, 0.00, 0.00, -6.44, -13.80, 0.00, 0.00, -0.31, 0.14, -9.19, -12.00, 0.00, 0.00, -0.27, 0.21, -10.30, 10.90, 0.08, 0.10, /* 1236-1363 */ 0.24, 0.23, 0.01, 14.92, -0.80, -0.04, 0.00, 0.00, -0.33, 10.02, -10.80, 0.00, 0.00, -0.24, -0.22, -0.01, -9.75, 10.40, 0.04, 0.00, 0.23, 0.22, 0.01, 9.67, -10.40, -0.04, 0.00, -0.23, -0.22, -0.01, -8.28, -11.20, 0.04, 0.00, -0.25, 0.19, 13.32, -1.41, -0.08, 0.00, 0.00, -0.30, 8.27, 10.50, 0.04, 0.00, 0.23, -0.19, 0.00, 0.00, 13.13, 0.00, 0.00, 0.00, 0.00, -0.29, -12.93, 0.70, 0.04, 0.00, 0.00, 0.29, 7.91, -10.20, 0.00, 0.00, -0.23, -0.18, -7.84, -10.00, -0.04, 0.00, -0.22, 0.18, 7.44, 9.60, 0.00, 0.00, 0.21, -0.17, -7.64, 9.40, 0.08, 0.10, 0.21, 0.17, 0.01, -11.38, 0.60, 0.04, 0.00, 0.00, 0.25, -7.48, 8.30, 0.00, 0.00, 0.19, 0.17, -10.98, -0.20, 0.00, 0.00, 0.00, 0.25, 10.98, 0.20, 0.00, 0.00, 0.00, -0.25, 7.40, -7.90, -0.04, 0.00, -0.18, -0.17, -6.09, 8.40, -0.04, 0.00, 0.19, 0.14, -6.94, -7.49, 0.00, 0.00, -0.17, /* 1364-1491 */ 0.16, 6.92, 7.50, 0.04, 0.00, 0.17, -0.15, 6.20, 8.09, 0.00, 0.00, 0.18, -0.14, -6.12, 7.80, 0.04, 0.00, 0.17, 0.14, 5.85, -7.50, 0.00, 0.00, -0.17, -0.13, -6.48, 6.90, 0.08, 0.10, 0.15, 0.14, 0.01, 6.32, 6.90, 0.00, 0.00, 0.15, -0.14, 5.61, -7.20, 0.00, 0.00, -0.16, -0.13, 9.07, 0.00, 0.00, 0.00, 0.00, -0.20, 5.25, 6.90, 0.00, 0.00, 0.15, -0.12, -8.47, -0.40, 0.00, 0.00, 0.00, 0.19, 6.32, -5.39, -1.11, 1.10, -0.12, -0.14, 0.02, 0.02, 5.73, -6.10, -0.04, 0.00, -0.14, -0.13, 4.70, 6.60, -0.04, 0.00, 0.15, -0.11, -4.90, -6.40, 0.00, 0.00, -0.14, 0.11, -5.33, 5.60, 0.04, 0.10, 0.13, 0.12, 0.01, -4.81, 6.00, 0.04, 0.00, 0.13, 0.11, 5.13, 5.50, 0.04, 0.00, 0.12, -0.11, 4.50, 5.90, 0.00, 0.00, 0.13, -0.10, -4.22, 6.10, 0.00, 0.00, 0.14, -4.53, 5.70, 0.00, 0.00, 0.13, 0.10, 4.18, 5.70, 0.00, 0.00, /* 1492-1619 */ 0.13, -4.75, -5.19, 0.00, 0.00, -0.12, 0.11, -4.06, 5.60, 0.00, 0.00, 0.13, -3.98, 5.60, -0.04, 0.00, 0.13, 4.02, -5.40, 0.00, 0.00, -0.12, 4.49, -4.90, -0.04, 0.00, -0.11, -0.10, -3.62, -5.40, -0.16, 0.20, -0.12, 0.00, 0.01, 4.38, 4.80, 0.00, 0.00, 0.11, -6.40, -0.10, 0.00, 0.00, 0.00, 0.14, -3.98, 5.00, 0.04, 0.00, 0.11, -3.82, -5.00, 0.00, 0.00, -0.11, -3.71, 5.07, 0.00, 0.00, 0.11, 4.14, 4.40, 0.00, 0.00, 0.10, -6.01, -0.50, -0.04, 0.00, 0.00, 0.13, -4.04, 4.39, 0.00, 0.00, 0.10, 3.45, -4.72, 0.00, 0.00, -0.11, 3.31, 4.71, 0.00, 0.00, 0.11, 3.26, -4.50, 0.00, 0.00, -0.10, -3.26, -4.50, 0.00, 0.00, -0.10, -3.34, -4.40, 0.00, 0.00, -0.10, -3.74, -4.00, 3.70, 4.00, 3.34, -4.30, 3.30, -4.30, -3.66, 3.90, 0.04, 3.66, 3.90, 0.04, -3.62, -3.90, -3.61, 3.90, -0.20, 5.30, 0.00, 0.00, 0.12, 3.06, 4.30, 3.30, /* 1620-1747 */ 4.00, 0.40, 0.20, 3.10, 4.10, -3.06, 3.90, -3.30, -3.60, -3.30, 3.36, 0.01, 3.14, 3.40, -4.57, -0.20, 0.00, 0.00, 0.00, 0.10, -2.70, -3.60, 2.94, -3.20, -2.90, 3.20, 2.47, -3.40, 2.55, -3.30, 2.80, -3.08, 2.51, 3.30, -4.10, 0.30, -0.12, -0.10, 4.10, 0.20, -2.74, 3.00, 2.46, 3.23, -3.66, 1.20, -0.20, 0.20, 3.74, -0.40, -2.51, -2.80, -3.74, 2.27, -2.90, 0.00, 0.00, -2.50, 2.70, -2.51, 2.60, -3.50, 0.20, 3.38, -2.22, -2.50, 3.26, -0.40, 1.95, -2.60, 3.22, -0.40, -0.04, -1.79, -2.60, 1.91, 2.50, 0.74, 3.05, -0.04, 0.08, 2.11, -2.30, -2.11, 2.20, -1.87, -2.40, 2.03, -2.20, -2.03, 2.20, 2.98, 0.00, 0.00, 2.98, -1.71, 2.40, 2.94, -0.10, -0.12, 0.10, 1.67, 2.40, -1.79, 2.30, -1.79, 2.20, -1.67, 2.20, 1.79, -2.00, 1.87, -1.90, 1.63, -2.10, -1.59, 2.10, 1.55, -2.10, -1.55, 2.10, -2.59, -0.20, -1.75, -1.90, -1.75, 1.90, -1.83, /* 1748-1875 */ -1.80, 1.51, 2.00, -1.51, -2.00, 1.71, 1.80, 1.31, 2.10, -1.43, 2.00, 1.43, 2.00, -2.43, -1.51, 1.90, -1.47, 1.90, 2.39, 0.20, -2.39, 1.39, 1.90, 1.39, -1.80, 1.47, -1.60, 1.47, -1.60, 1.43, -1.50, -1.31, 1.60, 1.27, -1.60, -1.27, 1.60, 1.27, -1.60, 2.03, 1.35, 1.50, -1.39, -1.40, 1.95, -0.20, -1.27, 1.49, 1.19, 1.50, 1.27, 1.40, 1.15, 1.50, 1.87, -0.10, -1.12, -1.50, 1.87, -1.11, -1.50, -1.11, -1.50, 0.00, 0.00, 1.19, 1.40, 1.27, -1.30, -1.27, -1.30, -1.15, 1.40, -1.23, 1.30, -1.23, -1.30, 1.22, -1.29, 1.07, -1.40, 1.75, -0.20, -1.03, -1.40, -1.07, 1.20, -1.03, 1.15, 1.07, 1.10, 1.51, -1.03, 1.10, 1.03, -1.10, 0.00, 0.00, -1.03, -1.10, 0.91, -1.20, -0.88, -1.20, -0.88, 1.20, -0.95, 1.10, -0.95, -1.10, 1.43, -1.39, 0.95, -1.00, -0.95, 1.00, -0.80, 1.10, 0.91, -1.00, -1.35, 0.88, 1.00, -0.83, 1.00, -0.91, 0.90, 0.91, /* 1876-2003 */ 0.90, 0.88, -0.90, -0.76, -1.00, -0.76, 1.00, 0.76, 1.00, -0.72, 1.00, 0.84, -0.90, 0.84, 0.90, 1.23, 0.00, 0.00, -0.52, -1.10, -0.68, 1.00, 1.19, -0.20, 1.19, 0.76, 0.90, 1.15, -0.10, 1.15, -0.10, 0.72, -0.90, -1.15, -1.15, 0.68, 0.90, -0.68, 0.90, -1.11, 0.00, 0.00, 0.20, 0.79, 0.80, -1.11, -0.10, 0.00, 0.00, -0.48, -1.00, -0.76, -0.80, -0.72, -0.80, -1.07, -0.10, 0.64, 0.80, -0.64, -0.80, 0.64, 0.80, 0.40, 0.60, 0.52, -0.50, -0.60, -0.80, -0.71, 0.70, -0.99, 0.99, 0.56, 0.80, -0.56, 0.80, 0.68, -0.70, 0.68, 0.70, -0.95, -0.64, 0.70, 0.64, 0.70, -0.60, 0.70, -0.60, -0.70, -0.91, -0.10, -0.51, 0.76, -0.91, -0.56, 0.70, 0.88, 0.88, -0.63, -0.60, 0.55, -0.60, -0.80, 0.80, -0.80, -0.52, 0.60, 0.52, 0.60, 0.52, -0.60, -0.48, 0.60, 0.48, 0.60, 0.48, 0.60, -0.76, 0.44, -0.60, 0.52, -0.50, -0.52, 0.50, 0.40, 0.60, -0.40, /* 2004-2131 */ -0.60, 0.40, -0.60, 0.72, -0.72, -0.51, -0.50, -0.48, 0.50, 0.48, -0.50, -0.48, 0.50, -0.48, 0.50, 0.48, -0.50, -0.48, -0.50, -0.68, -0.68, 0.44, 0.50, -0.64, -0.10, -0.64, -0.10, -0.40, 0.50, 0.40, 0.50, 0.40, 0.50, 0.00, 0.00, -0.40, -0.50, -0.36, -0.50, 0.36, -0.50, 0.60, -0.60, 0.40, -0.40, 0.40, 0.40, -0.40, 0.40, -0.40, 0.40, -0.56, -0.56, 0.36, -0.40, -0.36, 0.40, 0.36, -0.40, -0.36, -0.40, 0.36, 0.40, 0.36, 0.40, -0.52, 0.52, 0.52, 0.32, 0.40, -0.32, 0.40, -0.32, 0.40, -0.32, 0.40, 0.32, -0.40, -0.32, -0.40, 0.32, -0.40, 0.28, -0.40, -0.28, 0.40, 0.28, -0.40, 0.28, 0.40, 0.48, -0.48, 0.48, 0.36, -0.30, -0.36, -0.30, 0.00, 0.00, 0.20, 0.40, -0.44, 0.44, -0.44, -0.44, -0.44, -0.44, 0.32, -0.30, 0.32, 0.30, 0.24, 0.30, -0.12, -0.10, -0.28, 0.30, 0.28, 0.30, 0.28, 0.30, 0.28, -0.30, 0.28, -0.30, 0.28, -0.30, 0.28, /* 2132-2259 */ 0.30, -0.28, 0.30, 0.40, 0.40, -0.24, 0.30, 0.24, -0.30, 0.24, -0.30, -0.24, -0.30, 0.24, 0.30, 0.24, -0.30, -0.24, 0.30, 0.24, -0.30, -0.24, -0.30, 0.24, -0.30, 0.24, 0.30, -0.24, 0.30, -0.24, 0.30, 0.20, -0.30, 0.20, -0.30, 0.20, -0.30, 0.20, 0.30, 0.20, -0.30, 0.20, -0.30, 0.20, 0.30, 0.20, 0.30, -0.20, -0.30, 0.20, -0.30, 0.20, -0.30, -0.36, -0.36, -0.36, -0.04, 0.30, 0.12, -0.10, -0.32, -0.24, 0.20, 0.24, 0.20, 0.20, -0.20, -0.20, -0.20, -0.20, -0.20, 0.20, 0.20, 0.20, -0.20, 0.20, 0.20, 0.20, 0.20, -0.20, -0.20, 0.00, 0.00, -0.20, -0.20, -0.20, 0.20, -0.20, 0.20, 0.20, -0.20, -0.20, -0.20, 0.20, 0.20, 0.20, 0.20, 0.20, -0.20, 0.20, -0.20, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, -0.28, 0.28, 0.12, 0.00, 0.24, 0.16, -0.20, 0.16, -0.20, 0.16, -0.20, 0.16, 0.20, -0.16, 0.20, 0.16, 0.20, -0.16, 0.20, -0.16, 0.20, /* 2260-2387 */ -0.16, 0.20, 0.16, -0.20, 0.16, 0.20, 0.16, -0.20, -0.16, 0.20, -0.16, -0.20, -0.16, 0.20, 0.16, 0.20, 0.16, -0.20, 0.16, -0.20, 0.16, 0.20, 0.16, 0.20, 0.16, 0.20, -0.16, -0.20, 0.16, 0.20, -0.16, 0.20, 0.16, 0.20, -0.16, -0.20, 0.16, -0.20, 0.16, -0.20, -0.16, -0.20, 0.24, -0.24, -0.24, 0.24, 0.24, 0.12, 0.20, 0.12, 0.20, -0.12, -0.20, 0.12, -0.20, 0.12, -0.20, -0.12, 0.20, -0.12, 0.20, -0.12, -0.20, 0.12, 0.20, 0.12, 0.20, 0.12, -0.20, -0.12, 0.20, 0.12, -0.20, -0.12, 0.20, 0.12, 0.20, 0.00, 0.00, -0.12, 0.20, -0.12, 0.20, 0.12, -0.20, -0.12, 0.20, 0.12, 0.20, 0.00, -0.21, -0.20, 0.00, 0.00, 0.20, -0.20, -0.20, -0.20, 0.20, -0.16, -0.10, 0.00, 0.17, 0.16, 0.16, 0.16, 0.16, -0.16, 0.16, 0.16, -0.16, 0.16, -0.16, 0.16, 0.12, 0.10, 0.12, -0.10, -0.12, 0.10, -0.12, 0.10, 0.12, -0.10, -0.12, 0.12, -0.12, 0.12, /* 2388-2515 */ -0.12, 0.12, -0.12, -0.12, -0.12, -0.12, -0.12, -0.12, -0.12, 0.12, 0.12, 0.12, 0.12, -0.12, -0.12, 0.12, 0.12, 0.12, -0.12, 0.12, -0.12, -0.12, -0.12, 0.12, -0.12, -0.12, 0.12, 0.00, 0.11, 0.11,-122.67, 164.70, 203.78, 273.50, 3.58, 2.74, 6.18, -4.56, 0.00, -0.04, 0.00, -0.07, 57.44, -77.10, 95.82, 128.60, -1.77, -1.28, 2.85, -2.14, 82.14, 89.50, 0.00, 0.00, 2.00, -1.84, -0.04, 47.73, -64.10, 23.79, 31.90, -1.45, -1.07, 0.69, -0.53, -46.38, 50.50, 0.00, 0.00, 1.13, 1.04, 0.02, -18.38, 0.00, 63.80, 0.00, 0.00, 0.41, 0.00, -1.43, 59.07, 0.00, 0.00, 0.00, 0.00, -1.32, 57.28, 0.00, 0.00, 0.00, 0.00, -1.28, -48.65, 0.00, -1.15, 0.00, 0.00, 1.09, 0.00, 0.03, -18.30, 24.60, -17.30, -23.20, 0.56, 0.41, -0.51, 0.39, -16.91, 26.90, 8.43, 13.30, 0.60, 0.38, 0.31, -0.19, 1.23, -1.70, -19.13, -25.70, -0.03, -0.03, -0.58, 0.43, -0.72, 0.90, -17.34, -23.30, /* 2516-2643 */ 0.03, 0.02, -0.52, 0.39, -19.49, -21.30, 0.00, 0.00, -0.48, 0.44, 0.01, 20.57, -20.10, 0.64, 0.70, -0.45, -0.46, 0.00, -0.01, 4.89, 5.90, -16.55, 19.90, 0.14, -0.11, 0.44, 0.37, 18.22, 19.80, 0.00, 0.00, 0.44, -0.41, -0.01, 4.89, -5.30, -16.51, -18.00, -0.11, -0.11, -0.41, 0.37, -17.86, 0.00, 17.10, 0.00, 0.00, 0.40, 0.00, -0.38, 0.32, 0.00, 24.42, 0.00, 0.00, -0.01, 0.00, -0.55, -23.79, 0.00, 0.00, 0.00, 0.00, 0.53, 14.72, -16.00, -0.32, 0.00, -0.36, -0.33, -0.01, 0.01, 3.34, -4.50, 11.86, 15.90, -0.11, -0.07, 0.35, -0.27, -3.26, 4.40, 11.62, 15.60, 0.09, 0.07, 0.35, -0.26, -19.53, 0.00, 5.09, 0.00, 0.00, 0.44, 0.00, -0.11, -13.48, 14.70, 0.00, 0.00, 0.33, 0.30, 0.01, 10.86, -14.60, 3.18, 4.30, -0.33, -0.24, 0.09, -0.07, -11.30, -15.10, 0.00, 0.00, -0.34, 0.25, 0.01, 2.03, -2.70, 10.82, 14.50, -0.07, -0.05, 0.32, -0.24, 17.46, 0.00, /* 2644-2771 */ 0.00, 0.00, 0.00, -0.39, 16.43, 0.00, 0.52, 0.00, 0.00, -0.37, 0.00, -0.01, 9.35, 0.00, 13.29, 0.00, 0.00, -0.21, 0.00, -0.30, -10.42, 11.40, 0.00, 0.00, 0.25, 0.23, 0.01, 0.44, 0.50, -10.38, 11.30, 0.02, -0.01, 0.25, 0.23, -14.64, 0.00, 0.00, 0.00, 0.00, 0.33, 0.56, 0.80, -8.67, 11.70, 0.02, -0.01, 0.26, 0.19, 13.88, 0.00, -2.47, 0.00, 0.00, -0.31, 0.00, 0.06, -1.99, 2.70, 7.72, 10.30, 0.06, 0.04, 0.23, -0.17, -0.20, 0.00, 13.05, 0.00, 0.00, 0.00, 0.00, -0.29, 6.92, -9.30, 3.34, 4.50, -0.21, -0.15, 0.10, -0.07, -6.60, 0.00, 10.70, 0.00, 0.00, 0.15, 0.00, -0.24, -8.04, -8.70, 0.00, 0.00, -0.19, 0.18, -10.58, 0.00, -3.10, 0.00, 0.00, 0.24, 0.00, 0.07, -7.32, 8.00, -0.12, -0.10, 0.18, 0.16, 1.63, 1.70, 6.96, -7.60, 0.03, -0.04, -0.17, -0.16, -3.62, 0.00, 9.86, 0.00, 0.00, 0.08, 0.00, -0.22, 0.20, -0.20, -6.88, /* 2772-2899 */ -7.50, 0.00, 0.00, -0.17, 0.15, -8.99, 0.00, 4.02, 0.00, 0.00, 0.20, 0.00, -0.09, -1.07, 1.40, -5.69, -7.70, 0.03, 0.02, -0.17, 0.13, 6.48, -7.20, -0.48, -0.50, -0.16, -0.14, -0.01, 0.01, 5.57, -7.50, 1.07, 1.40, -0.17, -0.12, 0.03, -0.02, 8.71, 0.00, 3.54, 0.00, 0.00, -0.19, 0.00, -0.08, 0.40, 0.00, 9.27, 0.00, 0.00, -0.01, 0.00, -0.21, -6.13, 6.70, -1.19, -1.30, 0.15, 0.14, -0.03, 0.03, 5.21, -5.70, -2.51, -2.60, -0.13, -0.12, -0.06, 0.06, 5.69, -6.20, -0.12, -0.10, -0.14, -0.13, -0.01, 2.03, -2.70, 4.53, 6.10, -0.06, -0.05, 0.14, -0.10, 5.01, 5.50, -2.51, 2.70, 0.12, -0.11, 0.06, 0.06, -1.91, 2.60, -4.38, -5.90, 0.06, 0.04, -0.13, 0.10, 4.65, -6.30, 0.00, 0.00, -0.14, -0.10, -5.29, 5.70, 0.00, 0.00, 0.13, 0.12, -2.23, -4.00, -4.65, 4.20, -0.09, 0.05, 0.10, 0.10, -4.53, 6.10, 0.00, 0.00, 0.14, 0.10, 2.47, 2.70, /* 2900-3027 */ -4.46, 4.90, 0.06, -0.06, 0.11, 0.10, -5.05, 5.50, 0.84, 0.90, 0.12, 0.11, 0.02, -0.02, 4.97, -5.40, -1.71, 0.00, -0.12, -0.11, 0.00, 0.04, -0.99, -1.30, 4.22, -5.70, -0.03, 0.02, -0.13, -0.09, 0.99, 1.40, 4.22, -5.60, 0.03, -0.02, -0.13, -0.09, -4.69, -5.20, 0.00, 0.00, -0.12, 0.10, -3.42, 0.00, 6.09, 0.00, 0.00, 0.08, 0.00, -0.14, -4.65, -5.10, 0.00, 0.00, -0.11, 0.10, 0.00, 0.00, -4.53, -5.00, 0.00, 0.00, -0.11, 0.10, -2.43, -2.70, -3.82, 4.20, -0.06, 0.05, 0.10, 0.09, 0.00, 0.00, -4.53, 4.90, 0.00, 0.00, 0.11, 0.10, -4.49, -4.90, 0.00, 0.00, -0.11, 0.10, 2.67, -2.90, -3.62, -3.90, -0.06, -0.06, -0.09, 0.08, 3.94, -5.30, 0.00, 0.00, -0.12, -3.38, 3.70, -2.78, -3.10, 0.08, 0.08, -0.07, 0.06, 3.18, -3.50, -2.82, -3.10, -0.08, -0.07, -0.07, 0.06, -5.77, 0.00, 1.87, 0.00, 0.00, 0.13, 0.00, -0.04, 3.54, -4.80, -0.64, /* 3028-3155 */ -0.90, -0.11, 0.00, -0.02, -3.50, -4.70, 0.68, -0.90, -0.11, 0.00, -0.02, 5.49, 0.00, 0.00, 0.00, 0.00, -0.12, 1.83, -2.50, 2.63, 3.50, -0.06, 0.00, 0.08, 3.02, -4.10, 0.68, 0.90, -0.09, 0.00, 0.02, 0.00, 0.00, 5.21, 0.00, 0.00, 0.00, 0.00, -0.12, -3.54, 3.80, 2.70, 3.60, -1.35, 1.80, 0.08, 0.00, 0.04, -2.90, 3.90, 0.68, 0.90, 0.09, 0.00, 0.02, 0.80, -1.10, -2.78, -3.70, -0.02, 0.00, -0.08, 4.10, 0.00, -2.39, 0.00, 0.00, -0.09, 0.00, 0.05, -1.59, 2.10, 2.27, 3.00, 0.05, 0.00, 0.07, -2.63, 3.50, -0.48, -0.60, -2.94, -3.20, -2.94, 3.20, 2.27, -3.00, -1.11, -1.50, -0.07, 0.00, -0.03, -0.56, -0.80, -2.35, 3.10, 0.00, -0.60, -3.42, 1.90, -0.12, -0.10, 2.63, -2.90, 2.51, 2.80, -0.64, 0.70, -0.48, -0.60, 2.19, -2.90, 0.24, -0.30, 2.15, 2.90, 2.15, -2.90, 0.52, 0.70, 2.07, -2.80, -3.10, 0.00, 1.79, 0.00, 0.00, 0.07, /* 3156-3283 */ 0.00, -0.04, 0.88, 0.00, -3.46, 2.11, 2.80, -0.36, 0.50, 3.54, -0.20, -3.50, -1.39, 1.50, -1.91, -2.10, -1.47, 2.00, 1.39, 1.90, 2.07, -2.30, 0.91, 1.00, 1.99, -2.70, 3.30, 0.00, 0.60, -0.44, -0.70, -1.95, 2.60, 2.15, -2.40, -0.60, -0.70, 3.30, 0.84, 0.00, -3.10, -3.10, 0.00, -0.72, -0.32, 0.40, -1.87, -2.50, 1.87, -2.50, 0.32, 0.40, -0.24, 0.30, -1.87, -2.50, -0.24, -0.30, 1.87, -2.50, -2.70, 0.00, 1.55, 2.03, 2.20, -2.98, -1.99, -2.20, 0.12, -0.10, -0.40, 0.50, 1.59, 2.10, 0.00, 0.00, -1.79, 2.00, -1.03, 1.40, -1.15, -1.60, 0.32, 0.50, 1.39, -1.90, 2.35, -1.27, 1.70, 0.60, 0.80, -0.32, -0.40, 1.35, -1.80, 0.44, 0.00, 2.23, -0.84, 0.90, -1.27, -1.40, -1.47, 1.60, -0.28, -0.30, -0.28, 0.40, -1.27, -1.70, 0.28, -0.40, -1.43, -1.50, 0.00, 0.00, -1.27, -1.70, 2.11, -0.32, -0.40, -1.23, 1.60, 1.19, -1.30, -0.72, -0.80, 0.72, /* 3284-3411 */ -0.80, -1.15, -1.30, -1.35, -1.50, -1.19, -1.60, -0.12, 0.20, 1.79, 0.00, -0.88, -0.28, 0.40, 1.11, 1.50, -1.83, 0.00, 0.56, -0.12, 0.10, -1.27, -1.40, 0.00, 0.00, 1.15, 1.50, -0.12, 0.20, 1.11, 1.50, 0.36, -0.50, -1.07, -1.40, -1.11, 1.50, 1.67, 0.00, 0.80, -1.11, 0.00, 1.43, 1.23, -1.30, -0.24, -1.19, -1.30, -0.24, 0.20, -0.44, -0.90, -0.95, 1.10, 1.07, -1.40, 1.15, -1.30, 1.03, -1.10, -0.56, -0.60, -0.68, 0.90, -0.76, -1.00, -0.24, -0.30, 0.95, -1.30, 0.56, 0.70, 0.84, -1.10, -0.56, 0.00, -1.55, 0.91, -1.30, 0.28, 0.30, 0.16, -0.20, 0.95, 1.30, 0.40, -0.50, -0.88, -1.20, 0.95, -1.10, -0.48, -0.50, 0.00, 0.00, -1.07, 1.20, 0.44, -0.50, 0.95, 1.10, 0.00, 0.00, 0.92, -1.30, 0.95, 1.00, -0.52, 0.60, 1.59, 0.24, -0.40, 0.91, 1.20, 0.84, -1.10, -0.44, -0.60, 0.84, 1.10, -0.44, 0.60, -0.44, 0.60, -0.84, -1.10, -0.80, 0.00, /* 3412-3539 */ 1.35, 0.76, 0.20, -0.91, -1.00, 0.20, -0.30, -0.91, -1.20, -0.95, 1.00, -0.48, -0.50, 0.88, 1.00, 0.48, -0.50, -0.95, -1.10, 0.20, -0.20, -0.99, 1.10, -0.84, 1.10, -0.24, -0.30, 0.20, -0.30, 0.84, 1.10, -1.39, 0.00, -0.28, -0.16, 0.20, 0.84, 1.10, 0.00, 0.00, 1.39, 0.00, 0.00, -0.95, 1.00, 1.35, -0.99, 0.00, 0.88, -0.52, 0.00, -1.19, 0.20, 0.20, 0.76, -1.00, 0.00, 0.00, 0.76, 1.00, 0.00, 0.00, 0.76, 1.00, -0.76, 1.00, 0.00, 0.00, 1.23, 0.76, 0.80, -0.32, 0.40, -0.72, 0.80, -0.40, -0.40, 0.00, 0.00, -0.80, -0.90, -0.68, 0.90, -0.16, -0.20, -0.16, -0.20, 0.68, -0.90, -0.36, 0.50, -0.56, -0.80, 0.72, -0.90, 0.44, -0.60, -0.48, -0.70, -0.16, 0.00, -1.11, 0.32, 0.00, -1.07, 0.60, -0.80, -0.28, -0.40, -0.64, 0.00, 0.91, 1.11, 0.64, -0.90, 0.76, -0.80, 0.00, 0.00, -0.76, -0.80, 1.03, 0.00, -0.36, -0.64, -0.70, 0.36, -0.40, /* 3540-3667 */ 1.07, 0.36, -0.50, -0.52, -0.70, 0.60, 0.00, 0.88, 0.95, 0.00, 0.48, 0.16, -0.20, 0.60, 0.80, 0.16, -0.20, -0.60, -0.80, 0.00, -1.00, 0.12, 0.20, 0.16, -0.20, 0.68, 0.70, 0.59, -0.80, -0.99, -0.56, -0.60, 0.36, -0.40, -0.68, -0.70, -0.68, -0.70, -0.36, -0.50, -0.44, 0.60, 0.64, 0.70, -0.12, 0.10, -0.52, 0.60, 0.36, 0.40, 0.00, 0.00, 0.95, -0.84, 0.00, 0.44, 0.56, 0.60, 0.32, -0.30, 0.00, 0.00, 0.60, 0.70, 0.00, 0.00, 0.60, 0.70, -0.12, -0.20, 0.52, -0.70, 0.00, 0.00, 0.56, 0.70, -0.12, 0.10, -0.52, -0.70, 0.00, 0.00, 0.88, -0.76, 0.00, -0.44, 0.00, 0.00, -0.52, -0.70, 0.52, -0.70, 0.36, -0.40, -0.44, -0.50, 0.00, 0.00, 0.60, 0.60, 0.84, 0.00, 0.12, -0.24, 0.00, 0.80, -0.56, 0.60, -0.32, -0.30, 0.48, -0.50, 0.28, -0.30, -0.48, -0.50, 0.12, 0.20, 0.48, -0.60, 0.48, 0.60, -0.12, 0.20, 0.24, 0.00, 0.76, -0.52, /* 3668-3795 */ -0.60, -0.52, 0.60, 0.48, -0.50, -0.24, -0.30, 0.12, -0.10, 0.48, 0.60, 0.52, -0.20, 0.36, 0.40, -0.44, 0.50, -0.24, -0.30, -0.48, -0.60, -0.44, -0.60, -0.12, 0.10, 0.76, 0.76, 0.20, -0.20, 0.48, 0.50, 0.40, -0.50, -0.24, -0.30, 0.44, -0.60, 0.44, -0.60, 0.36, 0.00, -0.64, 0.72, 0.00, -0.12, 0.00, -0.10, -0.40, -0.60, -0.20, -0.20, -0.44, 0.50, -0.44, 0.50, 0.20, 0.20, -0.44, -0.50, 0.20, -0.20, -0.20, 0.20, -0.44, -0.50, 0.64, 0.00, 0.32, -0.36, 0.50, -0.20, -0.30, 0.12, -0.10, 0.48, 0.50, -0.12, 0.30, -0.36, -0.50, 0.00, 0.00, 0.48, 0.50, -0.48, 0.50, 0.68, 0.00, -0.12, 0.56, -0.40, 0.44, -0.50, -0.12, -0.10, 0.24, 0.30, -0.40, 0.40, 0.64, 0.00, -0.24, 0.64, 0.00, -0.20, 0.00, 0.00, 0.44, -0.50, 0.44, 0.50, -0.12, 0.20, -0.36, -0.50, 0.12, 0.00, 0.64, -0.40, 0.50, 0.00, 0.10, 0.00, 0.00, -0.40, 0.50, 0.00, 0.00, /* 3796-3923 */ -0.40, -0.50, 0.56, 0.00, 0.28, 0.00, 0.10, 0.36, 0.50, 0.00, -0.10, 0.36, -0.50, 0.36, 0.50, 0.00, -0.10, 0.24, -0.20, -0.36, -0.40, 0.16, 0.20, 0.40, -0.40, 0.00, 0.00, -0.36, -0.50, -0.36, -0.50, -0.32, -0.50, -0.12, 0.10, 0.20, 0.20, -0.36, 0.40, -0.60, 0.60, 0.28, 0.00, 0.52, 0.12, -0.10, 0.40, 0.40, 0.00, -0.50, 0.20, -0.20, -0.32, 0.40, 0.16, 0.20, -0.16, 0.20, 0.32, 0.40, 0.56, 0.00, -0.12, 0.32, -0.40, -0.16, -0.20, 0.00, 0.00, 0.40, 0.40, -0.40, -0.40, -0.40, 0.40, -0.36, 0.40, 0.12, 0.10, 0.00, 0.10, 0.36, 0.40, 0.00, -0.10, 0.36, 0.40, -0.36, 0.40, 0.00, 0.10, 0.32, 0.00, 0.44, 0.12, 0.20, 0.28, -0.40, 0.00, 0.00, 0.36, 0.40, 0.32, -0.40, -0.16, 0.12, 0.10, 0.32, -0.40, 0.20, 0.30, -0.24, 0.30, 0.00, 0.10, 0.32, 0.40, 0.00, -0.10, -0.32, -0.40, -0.32, 0.40, 0.00, 0.10, -0.52, -0.52, 0.52, /* 3924-4051 */ 0.32, -0.40, 0.00, 0.00, 0.32, 0.40, 0.32, -0.40, 0.00, 0.00, -0.32, -0.40, -0.32, 0.40, 0.32, 0.40, 0.00, 0.00, 0.32, 0.40, 0.00, 0.00, -0.32, -0.40, 0.00, 0.00, 0.32, 0.40, 0.16, 0.20, 0.32, -0.30, -0.16, 0.00, -0.48, -0.20, 0.20, -0.28, -0.30, 0.28, -0.40, 0.00, 0.00, 0.28, -0.40, 0.00, 0.00, 0.28, -0.40, 0.00, 0.00, -0.28, -0.40, 0.28, 0.40, -0.28, -0.40, -0.48, -0.20, 0.20, 0.24, 0.30, 0.44, 0.00, 0.16, 0.24, 0.30, 0.16, -0.20, 0.24, 0.30, -0.12, 0.20, 0.20, 0.30, -0.16, 0.20, 0.00, 0.00, 0.44, -0.32, 0.30, 0.24, 0.00, -0.36, 0.36, 0.00, 0.24, 0.12, -0.20, 0.20, 0.30, -0.12, 0.00, -0.28, 0.30, -0.24, 0.30, 0.12, 0.10, -0.28, -0.30, -0.28, 0.30, 0.00, 0.00, -0.28, -0.30, 0.00, 0.00, -0.28, -0.30, 0.00, 0.00, 0.28, 0.30, 0.00, 0.00, -0.28, -0.30, -0.28, 0.30, 0.00, 0.00, -0.28, -0.30, 0.00, 0.00, /* 4052-4179 */ 0.28, 0.30, 0.00, 0.00, -0.28, 0.30, 0.28, -0.30, -0.28, 0.30, 0.40, 0.40, -0.24, 0.30, 0.00, -0.10, 0.16, 0.00, 0.36, -0.20, 0.30, -0.12, -0.10, -0.24, -0.30, 0.00, 0.00, -0.24, 0.30, -0.24, 0.30, 0.00, 0.00, -0.24, 0.30, -0.24, 0.30, 0.24, -0.30, 0.00, 0.00, 0.24, -0.30, 0.00, 0.00, 0.24, 0.30, 0.24, -0.30, 0.24, 0.30, -0.24, 0.30, -0.24, 0.30, -0.20, 0.20, -0.16, -0.20, 0.00, 0.00, -0.32, 0.20, 0.00, 0.10, 0.20, -0.30, 0.20, -0.20, 0.12, 0.20, -0.16, 0.20, 0.16, 0.20, 0.20, 0.30, 0.20, 0.30, 0.00, 0.00, -0.20, 0.30, 0.00, 0.00, 0.20, 0.30, -0.20, -0.30, -0.20, -0.30, 0.20, -0.30, 0.00, 0.00, 0.20, 0.30, 0.00, 0.00, 0.20, 0.30, 0.00, 0.00, 0.20, 0.30, 0.00, 0.00, 0.20, 0.30, 0.00, 0.00, 0.20, -0.30, 0.00, 0.00, -0.20, -0.30, 0.00, 0.00, -0.20, 0.30, 0.00, 0.00, -0.20, 0.30, 0.00, 0.00, 0.36, /* 4180-4307 */ 0.00, 0.00, 0.36, 0.12, 0.10, -0.24, 0.20, 0.12, -0.20, -0.16, -0.20, -0.13, 0.10, 0.22, 0.21, 0.20, 0.00, -0.28, 0.32, 0.00, -0.12, -0.20, -0.20, 0.12, -0.10, 0.12, 0.10, -0.20, 0.20, 0.00, 0.00, -0.32, 0.32, 0.00, 0.00, 0.32, 0.32, 0.00, 0.00, -0.24, -0.20, 0.24, 0.20, 0.20, 0.00, -0.24, 0.00, 0.00, -0.24, -0.20, 0.00, 0.00, 0.24, 0.20, -0.24, -0.20, 0.00, 0.00, -0.24, 0.20, 0.16, -0.20, 0.12, 0.10, 0.20, 0.20, 0.00, -0.10, -0.12, 0.10, -0.16, -0.20, -0.12, -0.10, -0.16, 0.20, 0.20, 0.20, 0.00, 0.00, -0.20, 0.20, -0.20, 0.20, -0.20, 0.20, -0.20, 0.20, 0.20, -0.20, -0.20, -0.20, 0.00, 0.00, -0.20, 0.20, 0.20, 0.00, -0.20, 0.00, 0.00, -0.20, 0.20, -0.20, 0.20, -0.20, -0.20, -0.20, -0.20, 0.00, 0.00, 0.20, 0.20, 0.20, 0.20, 0.12, -0.20, -0.12, -0.10, 0.28, -0.28, 0.16, -0.20, 0.00, -0.10, 0.00, 0.10, -0.16, /* 4308-4435 */ 0.20, 0.00, -0.10, -0.16, -0.20, 0.00, -0.10, 0.16, -0.20, 0.16, -0.20, 0.00, 0.00, 0.16, 0.20, -0.16, 0.20, 0.00, 0.00, 0.16, 0.20, 0.16, -0.20, 0.16, -0.20, -0.16, 0.20, 0.16, -0.20, 0.00, 0.00, 0.16, 0.20, 0.00, 0.00, 0.16, 0.20, 0.00, 0.00, -0.16, -0.20, 0.16, -0.20, -0.16, -0.20, 0.00, 0.00, -0.16, -0.20, 0.00, 0.00, -0.16, 0.20, 0.00, 0.00, 0.16, -0.20, 0.16, 0.20, 0.16, 0.20, 0.00, 0.00, -0.16, -0.20, 0.00, 0.00, -0.16, -0.20, 0.00, 0.00, 0.16, 0.20, 0.16, 0.20, 0.00, 0.00, 0.16, 0.20, 0.16, -0.20, 0.16, 0.20, 0.00, 0.00, -0.16, 0.20, 0.00, 0.10, 0.12, -0.20, 0.12, -0.20, 0.00, -0.10, 0.00, -0.10, 0.12, 0.20, 0.00, -0.10, -0.12, 0.20, -0.15, 0.20, -0.24, 0.24, 0.00, 0.00, 0.24, 0.24, 0.12, -0.20, -0.12, -0.20, 0.00, 0.00, 0.12, 0.20, 0.12, -0.20, 0.12, 0.20, 0.12, 0.20, 0.12, 0.20, 0.12, /* 4436-4563 */ -0.20, -0.12, 0.20, 0.00, 0.00, 0.12, 0.20, 0.12, 0.00, -0.20, 0.00, 0.00, -0.12, -0.20, 0.12, -0.20, 0.00, 0.00, 0.12, 0.20, -0.12, 0.20, -0.12, 0.20, 0.12, -0.20, 0.00, 0.00, 0.12, 0.20, 0.20, 0.00, 0.12, 0.00, 0.00, -0.12, 0.20, 0.00, 0.00, -0.12, -0.20, 0.00, 0.00, -0.12, -0.20, -0.12, -0.20, 0.00, 0.00, 0.12, -0.20, 0.12, -0.20, 0.12, 0.20, -0.12, -0.20, 0.00, 0.00, 0.12, -0.20, 0.12, -0.20, 0.12, 0.20, 0.12, 0.00, 0.20, -0.12, -0.20, 0.00, 0.00, 0.12, 0.20, -0.16, 0.00, 0.16, -0.20, 0.20, 0.00, 0.00, -0.20, 0.00, 0.00, -0.20, 0.20, 0.00, 0.00, 0.20, 0.20, -0.20, 0.00, 0.00, -0.20, 0.12, 0.00, -0.16, 0.20, 0.00, 0.00, 0.20, 0.12, -0.10, 0.00, 0.10, 0.16, -0.16, -0.16, -0.16, -0.16, -0.16, 0.00, 0.00, -0.16, 0.00, 0.00, -0.16, -0.16, -0.16, 0.00, 0.00, -0.16, 0.00, 0.00, 0.16, 0.00, 0.00, 0.16, /* 4564-4691 */ 0.00, 0.00, 0.16, 0.16, 0.00, 0.00, -0.16, 0.00, 0.00, -0.16, -0.16, 0.00, 0.00, 0.16, 0.00, 0.00, -0.16, -0.16, 0.00, 0.00, -0.16, -0.16, 0.12, 0.10, 0.12, -0.10, 0.12, 0.10, 0.00, 0.00, 0.12, 0.10, -0.12, 0.10, 0.00, 0.00, 0.12, 0.10, 0.12, -0.10, 0.00, 0.00, -0.12, -0.10, 0.00, 0.00, 0.12, 0.10, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, -0.12, 0.00, 0.00, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, 0.12, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, 0.12, -0.12, -0.12, 0.12, 0.12, -0.12, -0.12, 0.00, 0.00, 0.12, -0.12, 0.12, 0.12, -0.12, -0.12, 0.00, 0.00, -0.12, -0.12, 0.00, 0.00, -0.12, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, 0.12, -0.12, 0.00, 0.00, -0.12, 0.12, -0.12, -0.12, 0.12, 0.00, 0.00, 0.12, 0.12, 0.12, -0.12, 0.00, 0.00, -0.12, -0.12, -0.12, 0.00, 0.00, -0.12, /* 4692-NA */ -0.12, 0.00, 0.00, 0.12, 0.12, 0.00, 0.00, -0.12, -0.12, -0.12, -0.12, 0.12, 0.00, 0.00, 0.12, -0.12, 0.00, 0.00, -0.12, -0.12, 0.00, 0.00, 0.12, -0.12, -0.12, -0.12, -0.12, 0.12, 0.12, -0.12, -0.12, 0.00, 0.00, -0.12, 0.00, 0.00, -0.12, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, -0.12, -0.12, 0.00, 0.00, -0.12, -0.12, 0.12, 0.00, 0.00, 0.12, 0.12, 0.00, 0.00, 0.12, 0.00, 0.00, 0.12, 0.12, 0.08, 0.00, 0.04 }; /* Number of amplitude coefficients */ static const int NA = (int) (sizeof a / sizeof (double)); /* Amplitude usage: X or Y, sin or cos, power of T. */ static const int jaxy[] = {0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1}; static const int jasc[] = {0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0}; static const int japt[] = {0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4}; /* Miscellaneous */ double t, w, pt[MAXPT+1], fa[14], xypr[2], xypl[2], xyls[2], arg, sc[2]; int jpt, i, j, jxy, ialast, ifreq, m, ia, jsc; /*--------------------------------------------------------------------*/ /* Interval between fundamental date J2000.0 and given date (JC). */ t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC; /* Powers of T. */ w = 1.0; for (jpt = 0; jpt <= MAXPT; jpt++) { pt[jpt] = w; w *= t; } /* Initialize totals in X and Y: polynomial, luni-solar, planetary. */ for (jxy = 0; jxy < 2; jxy++) { xypr[jxy] = 0.0; xyls[jxy] = 0.0; xypl[jxy] = 0.0; } /* --------------------------------- */ /* Fundamental arguments (IERS 2003) */ /* --------------------------------- */ /* Mean anomaly of the Moon. */ fa[0] = eraFal03(t); /* Mean anomaly of the Sun. */ fa[1] = eraFalp03(t); /* Mean argument of the latitude of the Moon. */ fa[2] = eraFaf03(t); /* Mean elongation of the Moon from the Sun. */ fa[3] = eraFad03(t); /* Mean longitude of the ascending node of the Moon. */ fa[4] = eraFaom03(t); /* Planetary longitudes, Mercury through Neptune. */ fa[5] = eraFame03(t); fa[6] = eraFave03(t); fa[7] = eraFae03(t); fa[8] = eraFama03(t); fa[9] = eraFaju03(t); fa[10] = eraFasa03(t); fa[11] = eraFaur03(t); fa[12] = eraFane03(t); /* General accumulated precession in longitude. */ fa[13] = eraFapa03(t); /* -------------------------------------- */ /* Polynomial part of precession-nutation */ /* -------------------------------------- */ for (jxy = 0; jxy < 2; jxy++) { for (j = MAXPT; j >= 0; j--) { xypr[jxy] += xyp[jxy][j] * pt[j]; } } /* ---------------------------------- */ /* Nutation periodic terms, planetary */ /* ---------------------------------- */ /* Work backwards through the coefficients per frequency list. */ ialast = NA; for (ifreq = NFPL-1; ifreq >= 0; ifreq--) { /* Obtain the argument functions. */ arg = 0.0; for (i = 0; i < 14; i++) { m = mfapl[ifreq][i]; if (m != 0) arg += (double)m * fa[i]; } sc[0] = sin(arg); sc[1] = cos(arg); /* Work backwards through the amplitudes at this frequency. */ ia = nc[ifreq+NFLS]; for (i = ialast; i >= ia; i--) { /* Coefficient number (0 = 1st). */ j = i-ia; /* X or Y. */ jxy = jaxy[j]; /* Sin or cos. */ jsc = jasc[j]; /* Power of T. */ jpt = japt[j]; /* Accumulate the component. */ xypl[jxy] += a[i-1] * sc[jsc] * pt[jpt]; } ialast = ia-1; } /* ----------------------------------- */ /* Nutation periodic terms, luni-solar */ /* ----------------------------------- */ /* Continue working backwards through the number of coefficients list. */ for (ifreq = NFLS-1; ifreq >= 0; ifreq--) { /* Obtain the argument functions. */ arg = 0.0; for (i = 0; i < 5; i++) { m = mfals[ifreq][i]; if (m != 0) arg += (double)m * fa[i]; } sc[0] = sin(arg); sc[1] = cos(arg); /* Work backwards through the amplitudes at this frequency. */ ia = nc[ifreq]; for (i = ialast; i >= ia; i--) { /* Coefficient number (0 = 1st). */ j = i-ia; /* X or Y. */ jxy = jaxy[j]; /* Sin or cos. */ jsc = jasc[j]; /* Power of T. */ jpt = japt[j]; /* Accumulate the component. */ xyls[jxy] += a[i-1] * sc[jsc] * pt[jpt]; } ialast = ia-1; } /* ------------------------------------ */ /* Results: CIP unit vector components */ /* ------------------------------------ */ *x = ERFA_DAS2R * (xypr[0] + (xyls[0] + xypl[0]) / 1e6); *y = ERFA_DAS2R * (xypr[1] + (xyls[1] + xypl[1]) / 1e6); return; } void eraXys00a(double date1, double date2, double *x, double *y, double *s) /* ** - - - - - - - - - - ** e r a X y s 0 0 a ** - - - - - - - - - - ** ** For a given TT date, compute the X,Y coordinates of the Celestial ** Intermediate Pole and the CIO locator s, using the IAU 2000A ** precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** x,y double Celestial Intermediate Pole (Note 2) ** s double the CIO locator s (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The Celestial Intermediate Pole coordinates are the x,y ** components of the unit vector in the Geocentric Celestial ** Reference System. ** ** 3) The CIO locator s (in radians) positions the Celestial ** Intermediate Origin on the equator of the CIP. ** ** 4) A faster, but slightly less accurate result (about 1 mas for ** X,Y), can be obtained by using instead the eraXys00b function. ** ** Called: ** eraPnm00a classical NPB matrix, IAU 2000A ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS00 the CIO locator s, given X,Y, IAU 2000A ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3]; /* Form the bias-precession-nutation matrix, IAU 2000A. */ eraPnm00a(date1, date2, rbpn); /* Extract X,Y. */ eraBpn2xy(rbpn, x, y); /* Obtain s. */ *s = eraS00(date1, date2, *x, *y); return; } void eraXys00b(double date1, double date2, double *x, double *y, double *s) /* ** - - - - - - - - - - ** e r a X y s 0 0 b ** - - - - - - - - - - ** ** For a given TT date, compute the X,Y coordinates of the Celestial ** Intermediate Pole and the CIO locator s, using the IAU 2000B ** precession-nutation model. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** x,y double Celestial Intermediate Pole (Note 2) ** s double the CIO locator s (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The Celestial Intermediate Pole coordinates are the x,y ** components of the unit vector in the Geocentric Celestial ** Reference System. ** ** 3) The CIO locator s (in radians) positions the Celestial ** Intermediate Origin on the equator of the CIP. ** ** 4) The present function is faster, but slightly less accurate (about ** 1 mas in X,Y), than the eraXys00a function. ** ** Called: ** eraPnm00b classical NPB matrix, IAU 2000B ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS00 the CIO locator s, given X,Y, IAU 2000A ** ** Reference: ** ** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), ** IERS Technical Note No. 32, BKG (2004) ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3]; /* Form the bias-precession-nutation matrix, IAU 2000A. */ eraPnm00b(date1, date2, rbpn); /* Extract X,Y. */ eraBpn2xy(rbpn, x, y); /* Obtain s. */ *s = eraS00(date1, date2, *x, *y); return; } void eraXys06a(double date1, double date2, double *x, double *y, double *s) /* ** - - - - - - - - - - ** e r a X y s 0 6 a ** - - - - - - - - - - ** ** For a given TT date, compute the X,Y coordinates of the Celestial ** Intermediate Pole and the CIO locator s, using the IAU 2006 ** precession and IAU 2000A nutation models. ** ** Given: ** date1,date2 double TT as a 2-part Julian Date (Note 1) ** ** Returned: ** x,y double Celestial Intermediate Pole (Note 2) ** s double the CIO locator s (Note 2) ** ** Notes: ** ** 1) The TT date date1+date2 is a Julian Date, apportioned in any ** convenient way between the two arguments. For example, ** JD(TT)=2450123.7 could be expressed in any of these ways, ** among others: ** ** date1 date2 ** ** 2450123.7 0.0 (JD method) ** 2451545.0 -1421.3 (J2000 method) ** 2400000.5 50123.2 (MJD method) ** 2450123.5 0.2 (date & time method) ** ** The JD method is the most natural and convenient to use in ** cases where the loss of several decimal digits of resolution ** is acceptable. The J2000 method is best matched to the way ** the argument is handled internally and will deliver the ** optimum resolution. The MJD method and the date & time methods ** are both good compromises between resolution and convenience. ** ** 2) The Celestial Intermediate Pole coordinates are the x,y components ** of the unit vector in the Geocentric Celestial Reference System. ** ** 3) The CIO locator s (in radians) positions the Celestial ** Intermediate Origin on the equator of the CIP. ** ** 4) Series-based solutions for generating X and Y are also available: ** see Capitaine & Wallace (2006) and eraXy06. ** ** Called: ** eraPnm06a classical NPB matrix, IAU 2006/2000A ** eraBpn2xy extract CIP X,Y coordinates from NPB matrix ** eraS06 the CIO locator s, given X,Y, IAU 2006 ** ** References: ** ** Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855 ** ** Wallace, P.T. & Capitaine, N., 2006, Astron.Astrophys. 459, 981 ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { double rbpn[3][3]; /* Form the bias-precession-nutation matrix, IAU 2000A. */ eraPnm06a(date1, date2, rbpn); /* Extract X,Y. */ eraBpn2xy(rbpn, x, y); /* Obtain s. */ *s = eraS06(date1, date2, *x, *y); return; } void eraZp(double p[3]) /* ** - - - - - - ** e r a Z p ** - - - - - - ** ** Zero a p-vector. ** ** Returned: ** p double[3] p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { p[0] = 0.0; p[1] = 0.0; p[2] = 0.0; return; } void eraZpv(double pv[2][3]) /* ** - - - - - - - ** e r a Z p v ** - - - - - - - ** ** Zero a pv-vector. ** ** Returned: ** pv double[2][3] pv-vector ** ** Called: ** eraZp zero p-vector ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { eraZp(pv[0]); eraZp(pv[1]); return; } void eraZr(double r[3][3]) /* ** - - - - - - ** e r a Z r ** - - - - - - ** ** Initialize an r-matrix to the null matrix. ** ** Returned: ** r double[3][3] r-matrix ** ** Copyright (C) 2013, NumFOCUS Foundation. ** Derived, with permission, from the SOFA library. See notes at end of file. */ { r[0][0] = 0.0; r[0][1] = 0.0; r[0][2] = 0.0; r[1][0] = 0.0; r[1][1] = 0.0; r[1][2] = 0.0; r[2][0] = 0.0; r[2][1] = 0.0; r[2][2] = 0.0; return; } /*---------------------------------------------------------------------- ** ** ** Copyright (C) 2013, NumFOCUS Foundation. ** All rights reserved. ** ** This library is derived, with permission, from the International ** Astronomical Union's "Standards of Fundamental Astronomy" library, ** available from http://www.iausofa.org. ** ** The ERFA version is intended to retain identical functionality to ** the SOFA library, but made distinct through different function and ** file names, as set out in the SOFA license conditions. The SOFA ** original has a role as a reference standard for the IAU and IERS, ** and consequently redistribution is permitted only in its unaltered ** state. The ERFA version is not subject to this restriction and ** therefore can be included in distributions which do not support the ** concept of "read only" software. ** ** Although the intent is to replicate the SOFA API (other than ** replacement of prefix names) and results (with the exception of ** bugs; any that are discovered will be fixed), SOFA is not ** responsible for any errors found in this version of the library. ** ** If you wish to acknowledge the SOFA heritage, please acknowledge ** that you are using a library derived from SOFA, rather than SOFA ** itself. ** ** ** TERMS AND CONDITIONS ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions ** are met: ** ** 1 Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** ** 2 Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** ** 3 Neither the name of the Standards Of Fundamental Astronomy Board, ** the International Astronomical Union nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ** POSSIBILITY OF SUCH DAMAGE. ** */ astropy-0.3/cextern/erfa/erfa.h0000644000175000017500000004606112243255342014661 0ustar oleole#ifndef SRCHDEF #define SRCHDEF #include /* ** - - - - - - - ** s r c . h ** - - - - - - - ** ** Prototype function declarations and macros for src library. ** */ #ifdef __cplusplus extern "C" { #endif /* Astronomy/Calendars */ int eraCal2jd(int iy, int im, int id, double *djm0, double *djm); double eraEpb(double dj1, double dj2); void eraEpb2jd(double epb, double *djm0, double *djm); double eraEpj(double dj1, double dj2); void eraEpj2jd(double epj, double *djm0, double *djm); int eraJd2cal(double dj1, double dj2, int *iy, int *im, int *id, double *fd); int eraJdcalf(int ndp, double dj1, double dj2, int iymdf[4]); /* Astronomy/Ephemerides */ int eraEpv00(double date1, double date2, double pvh[2][3], double pvb[2][3]); int eraPlan94(double date1, double date2, int np, double pv[2][3]); /* Astronomy/FundamentalArgs */ double eraFad03(double t); double eraFae03(double t); double eraFaf03(double t); double eraFaju03(double t); double eraFal03(double t); double eraFalp03(double t); double eraFama03(double t); double eraFame03(double t); double eraFane03(double t); double eraFaom03(double t); double eraFapa03(double t); double eraFasa03(double t); double eraFaur03(double t); double eraFave03(double t); /* Astronomy/PrecNutPolar */ void eraBi00(double *dpsibi, double *depsbi, double *dra); void eraBp00(double date1, double date2, double rb[3][3], double rp[3][3], double rbp[3][3]); void eraBp06(double date1, double date2, double rb[3][3], double rp[3][3], double rbp[3][3]); void eraBpn2xy(double rbpn[3][3], double *x, double *y); void eraC2i00a(double date1, double date2, double rc2i[3][3]); void eraC2i00b(double date1, double date2, double rc2i[3][3]); void eraC2i06a(double date1, double date2, double rc2i[3][3]); void eraC2ibpn(double date1, double date2, double rbpn[3][3], double rc2i[3][3]); void eraC2ixy(double date1, double date2, double x, double y, double rc2i[3][3]); void eraC2ixys(double x, double y, double s, double rc2i[3][3]); void eraC2t00a(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]); void eraC2t00b(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]); void eraC2t06a(double tta, double ttb, double uta, double utb, double xp, double yp, double rc2t[3][3]); void eraC2tcio(double rc2i[3][3], double era, double rpom[3][3], double rc2t[3][3]); void eraC2teqx(double rbpn[3][3], double gst, double rpom[3][3], double rc2t[3][3]); void eraC2tpe(double tta, double ttb, double uta, double utb, double dpsi, double deps, double xp, double yp, double rc2t[3][3]); void eraC2txy(double tta, double ttb, double uta, double utb, double x, double y, double xp, double yp, double rc2t[3][3]); double eraEo06a(double date1, double date2); double eraEors(double rnpb[3][3], double s); void eraFw2m(double gamb, double phib, double psi, double eps, double r[3][3]); void eraFw2xy(double gamb, double phib, double psi, double eps, double *x, double *y); void eraNum00a(double date1, double date2, double rmatn[3][3]); void eraNum00b(double date1, double date2, double rmatn[3][3]); void eraNum06a(double date1, double date2, double rmatn[3][3]); void eraNumat(double epsa, double dpsi, double deps, double rmatn[3][3]); void eraNut00a(double date1, double date2, double *dpsi, double *deps); void eraNut00b(double date1, double date2, double *dpsi, double *deps); void eraNut06a(double date1, double date2, double *dpsi, double *deps); void eraNut80(double date1, double date2, double *dpsi, double *deps); void eraNutm80(double date1, double date2, double rmatn[3][3]); double eraObl06(double date1, double date2); double eraObl80(double date1, double date2); void eraP06e(double date1, double date2, double *eps0, double *psia, double *oma, double *bpa, double *bqa, double *pia, double *bpia, double *epsa, double *chia, double *za, double *zetaa, double *thetaa, double *pa, double *gam, double *phi, double *psi); void eraPb06(double date1, double date2, double *bzeta, double *bz, double *btheta); void eraPfw06(double date1, double date2, double *gamb, double *phib, double *psib, double *epsa); void eraPmat00(double date1, double date2, double rbp[3][3]); void eraPmat06(double date1, double date2, double rbp[3][3]); void eraPmat76(double date1, double date2, double rmatp[3][3]); void eraPn00(double date1, double date2, double dpsi, double deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]); void eraPn00a(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]); void eraPn00b(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]); void eraPn06(double date1, double date2, double dpsi, double deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]); void eraPn06a(double date1, double date2, double *dpsi, double *deps, double *epsa, double rb[3][3], double rp[3][3], double rbp[3][3], double rn[3][3], double rbpn[3][3]); void eraPnm00a(double date1, double date2, double rbpn[3][3]); void eraPnm00b(double date1, double date2, double rbpn[3][3]); void eraPnm06a(double date1, double date2, double rnpb[3][3]); void eraPnm80(double date1, double date2, double rmatpn[3][3]); void eraPom00(double xp, double yp, double sp, double rpom[3][3]); void eraPr00(double date1, double date2, double *dpsipr, double *depspr); void eraPrec76(double ep01, double ep02, double ep11, double ep12, double *zeta, double *z, double *theta); double eraS00(double date1, double date2, double x, double y); double eraS00a(double date1, double date2); double eraS00b(double date1, double date2); double eraS06(double date1, double date2, double x, double y); double eraS06a(double date1, double date2); double eraSp00(double date1, double date2); void eraXy06(double date1, double date2, double *x, double *y); void eraXys00a(double date1, double date2, double *x, double *y, double *s); void eraXys00b(double date1, double date2, double *x, double *y, double *s); void eraXys06a(double date1, double date2, double *x, double *y, double *s); /* Astronomy/RotationAndTime */ double eraEe00(double date1, double date2, double epsa, double dpsi); double eraEe00a(double date1, double date2); double eraEe00b(double date1, double date2); double eraEe06a(double date1, double date2); double eraEect00(double date1, double date2); double eraEqeq94(double date1, double date2); double eraEra00(double dj1, double dj2); double eraGmst00(double uta, double utb, double tta, double ttb); double eraGmst06(double uta, double utb, double tta, double ttb); double eraGmst82(double dj1, double dj2); double eraGst00a(double uta, double utb, double tta, double ttb); double eraGst00b(double uta, double utb); double eraGst06(double uta, double utb, double tta, double ttb, double rnpb[3][3]); double eraGst06a(double uta, double utb, double tta, double ttb); double eraGst94(double uta, double utb); /* Astronomy/SpaceMotion */ int eraPvstar(double pv[2][3], double *ra, double *dec, double *pmr, double *pmd, double *px, double *rv); int eraStarpv(double ra, double dec, double pmr, double pmd, double px, double rv, double pv[2][3]); /* Astronomy/StarCatalogs */ void eraFk52h(double r5, double d5, double dr5, double dd5, double px5, double rv5, double *rh, double *dh, double *drh, double *ddh, double *pxh, double *rvh); void eraFk5hip(double r5h[3][3], double s5h[3]); void eraFk5hz(double r5, double d5, double date1, double date2, double *rh, double *dh); void eraH2fk5(double rh, double dh, double drh, double ddh, double pxh, double rvh, double *r5, double *d5, double *dr5, double *dd5, double *px5, double *rv5); void eraHfk5z(double rh, double dh, double date1, double date2, double *r5, double *d5, double *dr5, double *dd5); int eraStarpm(double ra1, double dec1, double pmr1, double pmd1, double px1, double rv1, double ep1a, double ep1b, double ep2a, double ep2b, double *ra2, double *dec2, double *pmr2, double *pmd2, double *px2, double *rv2); /* Astronomy/Geodetic/Geocentric */ int eraEform(int n, double *a, double *f); int eraGc2gd(int n, double xyz[3], double *elong, double *phi, double *height); int eraGc2gde(double a, double f, double xyz[3], double *elong, double *phi, double *height); int eraGd2gc(int n, double elong, double phi, double height, double xyz[3]); int eraGd2gce(double a, double f, double elong, double phi, double height, double xyz[3]); /* Astronomy/Timescales */ int eraD2dtf(const char *scale, int ndp, double d1, double d2, int *iy, int *im, int *id, int ihmsf[4]); int eraDat(int iy, int im, int id, double fd, double *deltat); double eraDtdb(double date1, double date2, double ut, double elong, double u, double v); int eraDtf2d(const char *scale, int iy, int im, int id, int ihr, int imn, double sec, double *d1, double *d2); int eraTaitt(double tai1, double tai2, double *tt1, double *tt2); int eraTaiut1(double tai1, double tai2, double dta, double *ut11, double *ut12); int eraTaiutc(double tai1, double tai2, double *utc1, double *utc2); int eraTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2); int eraTcgtt(double tcg1, double tcg2, double *tt1, double *tt2); int eraTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2); int eraTdbtt(double tdb1, double tdb2, double dtr, double *tt1, double *tt2); int eraTttai(double tt1, double tt2, double *tai1, double *tai2); int eraTttcg(double tt1, double tt2, double *tcg1, double *tcg2); int eraTttdb(double tt1, double tt2, double dtr, double *tdb1, double *tdb2); int eraTtut1(double tt1, double tt2, double dt, double *ut11, double *ut12); int eraUt1tai(double ut11, double ut12, double dta, double *tai1, double *tai2); int eraUt1tt(double ut11, double ut12, double dt, double *tt1, double *tt2); int eraUt1utc(double ut11, double ut12, double dut1, double *utc1, double *utc2); int eraUtctai(double utc1, double utc2, double *tai1, double *tai2); int eraUtcut1(double utc1, double utc2, double dut1, double *ut11, double *ut12); /* VectorMatrix/AngleOps */ void eraA2af(int ndp, double angle, char *sign, int idmsf[4]); void eraA2tf(int ndp, double angle, char *sign, int ihmsf[4]); int eraAf2a(char s, int ideg, int iamin, double asec, double *rad); double eraAnp(double a); double eraAnpm(double a); void eraD2tf(int ndp, double days, char *sign, int ihmsf[4]); int eraTf2a(char s, int ihour, int imin, double sec, double *rad); int eraTf2d(char s, int ihour, int imin, double sec, double *days); /* VectorMatrix/BuildRotations */ void eraRx(double phi, double r[3][3]); void eraRy(double theta, double r[3][3]); void eraRz(double psi, double r[3][3]); /* VectorMatrix/CopyExtendExtract */ void eraCp(double p[3], double c[3]); void eraCpv(double pv[2][3], double c[2][3]); void eraCr(double r[3][3], double c[3][3]); void eraP2pv(double p[3], double pv[2][3]); void eraPv2p(double pv[2][3], double p[3]); /* VectorMatrix/Initialization */ void eraIr(double r[3][3]); void eraZp(double p[3]); void eraZpv(double pv[2][3]); void eraZr(double r[3][3]); /* VectorMatrix/MatrixOps */ void eraRxr(double a[3][3], double b[3][3], double atb[3][3]); void eraTr(double r[3][3], double rt[3][3]); /* VectorMatrix/MatrixVectorProducts */ void eraRxp(double r[3][3], double p[3], double rp[3]); void eraRxpv(double r[3][3], double pv[2][3], double rpv[2][3]); void eraTrxp(double r[3][3], double p[3], double trp[3]); void eraTrxpv(double r[3][3], double pv[2][3], double trpv[2][3]); /* VectorMatrix/RotationVectors */ void eraRm2v(double r[3][3], double w[3]); void eraRv2m(double w[3], double r[3][3]); /* VectorMatrix/SeparationAndAngle */ double eraPap(double a[3], double b[3]); double eraPas(double al, double ap, double bl, double bp); double eraSepp(double a[3], double b[3]); double eraSeps(double al, double ap, double bl, double bp); /* VectorMatrix/SphericalCartesian */ void eraC2s(double p[3], double *theta, double *phi); void eraP2s(double p[3], double *theta, double *phi, double *r); void eraPv2s(double pv[2][3], double *theta, double *phi, double *r, double *td, double *pd, double *rd); void eraS2c(double theta, double phi, double c[3]); void eraS2p(double theta, double phi, double r, double p[3]); void eraS2pv(double theta, double phi, double r, double td, double pd, double rd, double pv[2][3]); /* VectorMatrix/VectorOps */ double eraPdp(double a[3], double b[3]); double eraPm(double p[3]); void eraPmp(double a[3], double b[3], double amb[3]); void eraPn(double p[3], double *r, double u[3]); void eraPpp(double a[3], double b[3], double apb[3]); void eraPpsp(double a[3], double s, double b[3], double apsb[3]); void eraPvdpv(double a[2][3], double b[2][3], double adb[2]); void eraPvm(double pv[2][3], double *r, double *s); void eraPvmpv(double a[2][3], double b[2][3], double amb[2][3]); void eraPvppv(double a[2][3], double b[2][3], double apb[2][3]); void eraPvu(double dt, double pv[2][3], double upv[2][3]); void eraPvup(double dt, double pv[2][3], double p[3]); void eraPvxpv(double a[2][3], double b[2][3], double axb[2][3]); void eraPxp(double a[3], double b[3], double axb[3]); void eraS2xpv(double s1, double s2, double pv[2][3], double spv[2][3]); void eraSxp(double s, double p[3], double sp[3]); void eraSxpv(double s, double pv[2][3], double spv[2][3]); /* Pi */ #define ERFA_DPI (3.141592653589793238462643) /* 2Pi */ #define ERFA_D2PI (6.283185307179586476925287) /* Degrees to radians */ #define ERFA_DD2R (1.745329251994329576923691e-2) /* Radians to arcseconds */ #define ERFA_DR2AS (206264.8062470963551564734) /* Arcseconds to radians */ #define ERFA_DAS2R (4.848136811095359935899141e-6) /* Seconds of time to radians */ #define ERFA_DS2R (7.272205216643039903848712e-5) /* Arcseconds in a full circle */ #define ERFA_TURNAS (1296000.0) /* Milliarcseconds to radians */ #define ERFA_DMAS2R (ERFA_DAS2R / 1e3) /* Length of tropical year B1900 (days) */ #define ERFA_DTY (365.242198781) /* Seconds per day. */ #define ERFA_DAYSEC (86400.0) /* Days per Julian year */ #define ERFA_DJY (365.25) /* Days per Julian century */ #define ERFA_DJC (36525.0) /* Days per Julian millennium */ #define ERFA_DJM (365250.0) /* Reference epoch (J2000.0), Julian Date */ #define ERFA_DJ00 (2451545.0) /* Julian Date of Modified Julian Date zero */ #define ERFA_DJM0 (2400000.5) /* Reference epoch (J2000.0), Modified Julian Date */ #define ERFA_DJM00 (51544.5) /* 1977 Jan 1.0 as MJD */ #define ERFA_DJM77 (43144.0) /* TT minus TAI (s) */ #define ERFA_TTMTAI (32.184) /* AU (m) */ #define ERFA_DAU (149597870e3) /* Speed of light (AU per day) */ #define ERFA_DC (ERFA_DAYSEC / 499.004782) /* L_G = 1 - d(TT)/d(TCG) */ #define ERFA_ELG (6.969290134e-10) /* L_B = 1 - d(TDB)/d(TCB), and TDB (s) at TAI 1977/1/1.0 */ #define ERFA_ELB (1.550519768e-8) #define ERFA_TDB0 (-6.55e-5) /* ERFA_DINT(A) - truncate to nearest whole number towards zero (double) */ #define ERFA_DINT(A) ((A)<0.0?ceil(A):floor(A)) /* ERFA_DNINT(A) - round to nearest whole number (double) */ #define ERFA_DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5)) /* ERFA_DSIGN(A,B) - magnitude of A with sign of B (double) */ #define ERFA_DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A)) /* Reference ellipsoids */ #define ERFA_WGS84 1 #define ERFA_GRS80 2 #define ERFA_WGS72 3 #endif /*---------------------------------------------------------------------- ** ** ** Copyright (C) 2013, NumFOCUS Foundation. ** All rights reserved. ** ** This library is derived, with permission, from the International ** Astronomical Union's "Standards of Fundamental Astronomy" library, ** available from http://www.iausofa.org. ** ** The ERFA version is intended to retain identical functionality to ** the SOFA library, but made distinct through different function and ** file names, as set out in the SOFA license conditions. The SOFA ** original has a role as a reference standard for the IAU and IERS, ** and consequently redistribution is permitted only in its unaltered ** state. The ERFA version is not subject to this restriction and ** therefore can be included in distributions which do not support the ** concept of "read only" software. ** ** Although the intent is to replicate the SOFA API (other than ** replacement of prefix names) and results (with the exception of ** bugs; any that are discovered will be fixed), SOFA is not ** responsible for any errors found in this version of the library. ** ** If you wish to acknowledge the SOFA heritage, please acknowledge ** that you are using a library derived from SOFA, rather than SOFA ** itself. ** ** ** TERMS AND CONDITIONS ** ** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions ** are met: ** ** 1 Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** ** 2 Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** ** 3 Neither the name of the Standards Of Fundamental Astronomy Board, ** the International Astronomical Union nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ** POSSIBILITY OF SUCH DAMAGE. ** */ astropy-0.3/cextern/.gitignore0000644000175000017500000000000512243255342014632 0ustar oleole!*.c astropy-0.3/cextern/cfitsio/0000755000175000017500000000000012243263747014317 5ustar oleoleastropy-0.3/cextern/cfitsio/putcoluk.c0000644000175000017500000010441712243255342016330 0ustar oleole/* This file, putcolk.c, contains routines that write data elements to */ /* a FITS image or table, with 'unsigned int' datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppruk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned int *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; unsigned int nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TUINT, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcluk(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnuk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned int *array, /* I - array of values that are written */ unsigned int nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; unsigned int nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TUINT, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnuk(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2duk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3duk(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3duk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TUINT, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcluk(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcluk(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssuk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ unsigned int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TUINT, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcluk(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpuk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ unsigned int *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcluk(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcluk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned int *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem, hdutype; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* call the 'short' or 'long' version of this routine, if possible */ if (sizeof(int) == sizeof(short)) ffpclui(fptr, colnum, firstrow, firstelem, nelem, (unsigned short *) array, status); else if (sizeof(int) == sizeof(long)) ffpcluj(fptr, colnum, firstrow, firstelem, nelem, (unsigned long *) array, status); else { /* This is a special case: sizeof(int) is not equal to sizeof(short) or sizeof(long). This occurs on Alpha OSF systems where short = 2 bytes, int = 4 bytes, and long = 8 bytes. */ buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TLONG): /* convert the raw data before writing to FITS file */ ffuintfi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TLONGLONG): ffuintfi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffuintfi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffuintfi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TFLOAT): ffuintfr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffuintfr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffuintfstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcluk).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } } /* end of Dec ALPHA special case */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned int *array, /* I - array of values to write */ unsigned int nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcluk(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcluk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcluk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfi1(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfi2(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfi4(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 2147483648.) { /* Instead of subtracting 2147483648, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(int *) &input[ii] ) ^ 0x80000000; } else if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > INT32_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfi8(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfr4(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfr8(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffuintfstr(unsigned int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/drvrmem.c0000644000175000017500000010744512243255342016142 0ustar oleole/* This file, drvrmem.c, contains driver routines for memory files. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include /* apparently needed to define size_t */ #include "fitsio2.h" /* prototype for .Z file uncompression function in zuncompress.c */ int zuncompress2mem(char *filename, FILE *diskfile, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); #define RECBUFLEN 1000 static char stdin_outfile[FLEN_FILENAME]; typedef struct /* structure containing mem file structure */ { char **memaddrptr; /* Pointer to memory address pointer; */ /* This may or may not point to memaddr. */ char *memaddr; /* Pointer to starting memory address; may */ /* not always be used, so use *memaddrptr instead */ size_t *memsizeptr; /* Pointer to the size of the memory allocation. */ /* This may or may not point to memsize. */ size_t memsize; /* Size of the memory allocation; this may not */ /* always be used, so use *memsizeptr instead. */ size_t deltasize; /* Suggested increment for reallocating memory */ void *(*mem_realloc)(void *p, size_t newsize); /* realloc function */ LONGLONG currentpos; /* current file position, relative to start */ LONGLONG fitsfilesize; /* size of the FITS file (always <= *memsizeptr) */ FILE *fileptr; /* pointer to compressed output disk file */ } memdriver; static memdriver memTable[NMAXFILES]; /* allocate mem file handle tables */ /*--------------------------------------------------------------------------*/ int mem_init(void) { int ii; for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */ { memTable[ii].memaddrptr = 0; memTable[ii].memaddr = 0; } return(0); } /*--------------------------------------------------------------------------*/ int mem_setoptions(int options) { /* do something with the options argument, to stop compiler warning */ options = 0; return(options); } /*--------------------------------------------------------------------------*/ int mem_getoptions(int *options) { *options = 0; return(0); } /*--------------------------------------------------------------------------*/ int mem_getversion(int *version) { *version = 10; return(0); } /*--------------------------------------------------------------------------*/ int mem_shutdown(void) { return(0); } /*--------------------------------------------------------------------------*/ int mem_create(char *filename, int *handle) /* Create a new empty memory file for subsequent writes. The file name is ignored in this case. */ { int status; /* initially allocate 1 FITS block = 2880 bytes */ status = mem_createmem(2880L, handle); if (status) { ffpmsg("failed to create empty memory file (mem_create)"); return(status); } return(0); } /*--------------------------------------------------------------------------*/ int mem_create_comp(char *filename, int *handle) /* Create a new empty memory file for subsequent writes. Also create an empty compressed .gz file. The memory file will be compressed and written to the disk file when the file is closed. */ { FILE *diskfile; char mode[4]; int status; /* first, create disk file for the compressed output */ if ( !strcmp(filename, "-.gz") || !strcmp(filename, "stdout.gz") || !strcmp(filename, "STDOUT.gz") ) { /* special case: create uncompressed FITS file in memory, then compress it an write it out to 'stdout' when it is closed. */ diskfile = stdout; } else { /* normal case: create disk file for the compressed output */ strcpy(mode, "w+b"); /* create file with read-write */ diskfile = fopen(filename, "r"); /* does file already exist? */ if (diskfile) { fclose(diskfile); /* close file and exit with error */ return(FILE_NOT_CREATED); } #if MACHINE == ALPHAVMS || MACHINE == VAXVMS /* specify VMS record structure: fixed format, 2880 byte records */ /* but force stream mode access to enable random I/O access */ diskfile = fopen(filename, mode, "rfm=fix", "mrs=2880", "ctx=stm"); #else diskfile = fopen(filename, mode); #endif if (!(diskfile)) /* couldn't create file */ { return(FILE_NOT_CREATED); } } /* now create temporary memory file */ /* initially allocate 1 FITS block = 2880 bytes */ status = mem_createmem(2880L, handle); if (status) { ffpmsg("failed to create empty memory file (mem_create_comp)"); return(status); } memTable[*handle].fileptr = diskfile; return(0); } /*--------------------------------------------------------------------------*/ int mem_openmem(void **buffptr, /* I - address of memory pointer */ size_t *buffsize, /* I - size of buffer, in bytes */ size_t deltasize, /* I - increment for future realloc's */ void *(*memrealloc)(void *p, size_t newsize), /* function */ int *handle) /* lowest level routine to open a pre-existing memory file. */ { int ii; *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in handle table */ { if (memTable[ii].memaddrptr == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ memTable[ii].memaddrptr = (char **) buffptr; /* pointer to start addres */ memTable[ii].memsizeptr = buffsize; /* allocated size of memory */ memTable[ii].deltasize = deltasize; /* suggested realloc increment */ memTable[ii].fitsfilesize = *buffsize; /* size of FITS file (upper limit) */ memTable[ii].currentpos = 0; /* at beginning of the file */ memTable[ii].mem_realloc = memrealloc; /* memory realloc function */ return(0); } /*--------------------------------------------------------------------------*/ int mem_createmem(size_t msize, int *handle) /* lowest level routine to allocate a memory file. */ { int ii; *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in handle table */ { if (memTable[ii].memaddrptr == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ /* use the internally allocated memaddr and memsize variables */ memTable[ii].memaddrptr = &memTable[ii].memaddr; memTable[ii].memsizeptr = &memTable[ii].memsize; /* allocate initial block of memory for the file */ if (msize > 0) { memTable[ii].memaddr = (char *) malloc(msize); if ( !(memTable[ii].memaddr) ) { ffpmsg("malloc of initial memory failed (mem_createmem)"); return(FILE_NOT_OPENED); } } /* set initial state of the file */ memTable[ii].memsize = msize; memTable[ii].deltasize = 2880; memTable[ii].fitsfilesize = 0; memTable[ii].currentpos = 0; memTable[ii].mem_realloc = realloc; return(0); } /*--------------------------------------------------------------------------*/ int mem_truncate(int handle, LONGLONG filesize) /* truncate the file to a new size */ { char *ptr; /* call the memory reallocation function, if defined */ if ( memTable[handle].mem_realloc ) { /* explicit LONGLONG->size_t cast */ ptr = (memTable[handle].mem_realloc)( *(memTable[handle].memaddrptr), (size_t) filesize); if (!ptr) { ffpmsg("Failed to reallocate memory (mem_truncate)"); return(MEMORY_ALLOCATION); } /* if allocated more memory, initialize it to zero */ if ( filesize > *(memTable[handle].memsizeptr) ) { memset(ptr + *(memTable[handle].memsizeptr), 0, ((size_t) filesize) - *(memTable[handle].memsizeptr) ); } *(memTable[handle].memaddrptr) = ptr; *(memTable[handle].memsizeptr) = (size_t) (filesize); } memTable[handle].currentpos = filesize; memTable[handle].fitsfilesize = filesize; return(0); } /*--------------------------------------------------------------------------*/ int stdin_checkfile(char *urltype, char *infile, char *outfile) /* do any special case checking when opening a file on the stdin stream */ { if (strlen(outfile)) { stdin_outfile[0] = '\0'; strncat(stdin_outfile,outfile,FLEN_FILENAME-1); /* an output file is specified */ strcpy(urltype,"stdinfile://"); } else *stdin_outfile = '\0'; /* no output file was specified */ return(0); } /*--------------------------------------------------------------------------*/ int stdin_open(char *filename, int rwmode, int *handle) /* open a FITS file from the stdin file stream by copying it into memory The file name is ignored in this case. */ { int status; char cbuff; if (*stdin_outfile) { /* copy the stdin stream to the specified disk file then open the file */ /* Create the output file */ status = file_create(stdin_outfile,handle); if (status) { ffpmsg("Unable to create output file to copy stdin (stdin_open):"); ffpmsg(stdin_outfile); return(status); } /* copy the whole stdin stream to the file */ status = stdin2file(*handle); file_close(*handle); if (status) { ffpmsg("failed to copy stdin to file (stdin_open)"); ffpmsg(stdin_outfile); return(status); } /* reopen file with proper rwmode attribute */ status = file_open(stdin_outfile, rwmode, handle); } else { /* get the first character, then put it back */ cbuff = fgetc(stdin); ungetc(cbuff, stdin); /* compressed files begin with 037 or 'P' */ if (cbuff == 31 || cbuff == 75) { /* looks like the input stream is compressed */ status = mem_compress_stdin_open(filename, rwmode, handle); } else { /* copy the stdin stream into memory then open file in memory */ if (rwmode != READONLY) { ffpmsg("cannot open stdin with WRITE access"); return(READONLY_FILE); } status = mem_createmem(2880L, handle); if (status) { ffpmsg("failed to create empty memory file (stdin_open)"); return(status); } /* copy the whole stdin stream into memory */ status = stdin2mem(*handle); if (status) { ffpmsg("failed to copy stdin into memory (stdin_open)"); free(memTable[*handle].memaddr); } } } return(status); } /*--------------------------------------------------------------------------*/ int stdin2mem(int hd) /* handle number */ /* Copy the stdin stream into memory. Fill whatever amount of memory has already been allocated, then realloc more memory if necessary. */ { size_t nread, memsize, delta; LONGLONG filesize; char *memptr; char simple[] = "SIMPLE"; int c, ii, jj; memptr = *memTable[hd].memaddrptr; memsize = *memTable[hd].memsizeptr; delta = memTable[hd].deltasize; filesize = 0; ii = 0; for(jj = 0; (c = fgetc(stdin)) != EOF && jj < 2000; jj++) { /* Skip over any garbage at the beginning of the stdin stream by */ /* reading 1 char at a time, looking for 'S', 'I', 'M', 'P', 'L', 'E' */ /* Give up if not found in the first 2000 characters */ if (c == simple[ii]) { ii++; if (ii == 6) /* found the complete string? */ { memcpy(memptr, simple, 6); /* copy "SIMPLE" to buffer */ filesize = 6; break; } } else ii = 0; /* reset search to beginning of the string */ } if (filesize == 0) { ffpmsg("Couldn't find the string 'SIMPLE' in the stdin stream."); ffpmsg("This does not look like a FITS file."); return(FILE_NOT_OPENED); } /* fill up the remainder of the initial memory allocation */ nread = fread(memptr + 6, 1, memsize - 6, stdin); nread += 6; /* add in the 6 characters in 'SIMPLE' */ if (nread < memsize) /* reached the end? */ { memTable[hd].fitsfilesize = nread; return(0); } filesize = nread; while (1) { /* allocate memory for another FITS block */ memptr = realloc(memptr, memsize + delta); if (!memptr) { ffpmsg("realloc failed while copying stdin (stdin2mem)"); return(MEMORY_ALLOCATION); } memsize += delta; /* read another FITS block */ nread = fread(memptr + filesize, 1, delta, stdin); filesize += nread; if (nread < delta) /* reached the end? */ break; } memTable[hd].fitsfilesize = filesize; *memTable[hd].memaddrptr = memptr; *memTable[hd].memsizeptr = memsize; return(0); } /*--------------------------------------------------------------------------*/ int stdin2file(int handle) /* handle number */ /* Copy the stdin stream to a file. . */ { size_t nread; char simple[] = "SIMPLE"; int c, ii, jj, status; char recbuf[RECBUFLEN]; ii = 0; for(jj = 0; (c = fgetc(stdin)) != EOF && jj < 2000; jj++) { /* Skip over any garbage at the beginning of the stdin stream by */ /* reading 1 char at a time, looking for 'S', 'I', 'M', 'P', 'L', 'E' */ /* Give up if not found in the first 2000 characters */ if (c == simple[ii]) { ii++; if (ii == 6) /* found the complete string? */ { memcpy(recbuf, simple, 6); /* copy "SIMPLE" to buffer */ break; } } else ii = 0; /* reset search to beginning of the string */ } if (ii != 6) { ffpmsg("Couldn't find the string 'SIMPLE' in the stdin stream"); return(FILE_NOT_OPENED); } /* fill up the remainder of the buffer */ nread = fread(recbuf + 6, 1, RECBUFLEN - 6, stdin); nread += 6; /* add in the 6 characters in 'SIMPLE' */ status = file_write(handle, recbuf, nread); if (status) return(status); /* copy the rest of stdin stream */ while(0 != (nread = fread(recbuf,1,RECBUFLEN, stdin))) { status = file_write(handle, recbuf, nread); if (status) return(status); } return(status); } /*--------------------------------------------------------------------------*/ int stdout_close(int handle) /* copy the memory file to stdout, then free the memory */ { int status = 0; /* copy from memory to standard out. explicit LONGLONG->size_t cast */ if(fwrite(memTable[handle].memaddr, 1, ((size_t) memTable[handle].fitsfilesize), stdout) != (size_t) memTable[handle].fitsfilesize ) { ffpmsg("failed to copy memory file to stdout (stdout_close)"); status = WRITE_ERROR; } free( memTable[handle].memaddr ); /* free the memory */ memTable[handle].memaddrptr = 0; memTable[handle].memaddr = 0; return(status); } /*--------------------------------------------------------------------------*/ int mem_compress_openrw(char *filename, int rwmode, int *hdl) /* This routine opens the compressed diskfile and creates an empty memory buffer with an appropriate size, then calls mem_uncompress2mem. It allows the memory 'file' to be opened with READWRITE access. */ { return(mem_compress_open(filename, READONLY, hdl)); } /*--------------------------------------------------------------------------*/ int mem_compress_open(char *filename, int rwmode, int *hdl) /* This routine opens the compressed diskfile and creates an empty memory buffer with an appropriate size, then calls mem_uncompress2mem. */ { FILE *diskfile; int status, estimated = 1; unsigned char buffer[4]; size_t finalsize, filesize; unsigned int modulosize; char *ptr; if (rwmode != READONLY) { ffpmsg( "cannot open compressed file with WRITE access (mem_compress_open)"); ffpmsg(filename); return(READONLY_FILE); } /* open the compressed disk file */ status = file_openfile(filename, READONLY, &diskfile); if (status) { ffpmsg("failed to open compressed disk file (compress_open)"); ffpmsg(filename); return(status); } if (fread(buffer, 1, 2, diskfile) != 2) /* read 2 bytes */ { fclose(diskfile); return(READ_ERROR); } if (memcmp(buffer, "\037\213", 2) == 0) /* GZIP */ { /* the uncompressed file size is give at the end */ /* of the file in the ISIZE field (modulo 2^32) */ fseek(diskfile, 0, 2); /* move to end of file */ filesize = ftell(diskfile); /* position = size of file */ fseek(diskfile, -4L, 1); /* move back 4 bytes */ fread(buffer, 1, 4L, diskfile); /* read 4 bytes */ /* have to worry about integer byte order */ modulosize = buffer[0]; modulosize |= buffer[1] << 8; modulosize |= buffer[2] << 16; modulosize |= buffer[3] << 24; /* the field ISIZE in the gzipped file header only stores 4 bytes and contains the uncompressed file size modulo 2^32. If the uncompressed file size is less than the compressed file size (filesize), then one probably needs to add 2^32 = 4294967296 to the uncompressed file size, assuming that the gzip produces a compressed file that is smaller than the original file. But one must allow for the case of very small files, where the gzipped file may actually be larger then the original uncompressed file. Therefore, only perform the modulo 2^32 correction test if the compressed file is greater than 10,000 bytes in size. (Note: this threhold would fail only if the original file was greater than 2^32 bytes in size AND gzip was able to compress it by more than a factor of 400,000 (!) which seems highly unlikely.) Also, obviously, this 2^32 modulo correction cannot be performed if the finalsize variable is only 32-bits long. Typically, the 'size_t' integer type must be 8 bytes or larger in size to support data files that are greater than 2 GB (2^31 bytes) in size. */ finalsize = modulosize; if (sizeof(size_t) > 4 && filesize > 10000) { while (finalsize < filesize) finalsize += 4294967296; } estimated = 0; /* file size is known, not estimated */ } else if (memcmp(buffer, "\120\113", 2) == 0) /* PKZIP */ { /* the uncompressed file size is give at byte 22 the file */ fseek(diskfile, 22L, 0); /* move to byte 22 */ fread(buffer, 1, 4L, diskfile); /* read 4 bytes */ /* have to worry about integer byte order */ modulosize = buffer[0]; modulosize |= buffer[1] << 8; modulosize |= buffer[2] << 16; modulosize |= buffer[3] << 24; finalsize = modulosize; estimated = 0; /* file size is known, not estimated */ } else if (memcmp(buffer, "\037\036", 2) == 0) /* PACK */ finalsize = 0; /* for most methods we can't determine final size */ else if (memcmp(buffer, "\037\235", 2) == 0) /* LZW */ finalsize = 0; /* for most methods we can't determine final size */ else if (memcmp(buffer, "\037\240", 2) == 0) /* LZH */ finalsize = 0; /* for most methods we can't determine final size */ else { /* not a compressed file; this should never happen */ fclose(diskfile); return(1); } if (finalsize == 0) /* estimate uncompressed file size */ { fseek(diskfile, 0, 2); /* move to end of the compressed file */ finalsize = ftell(diskfile); /* position = size of file */ finalsize = finalsize * 3; /* assume factor of 3 compression */ } fseek(diskfile, 0, 0); /* move back to beginning of file */ /* create a memory file big enough (hopefully) for the uncompressed file */ status = mem_createmem(finalsize, hdl); if (status && estimated) { /* memory allocation failed, so try a smaller estimated size */ finalsize = finalsize / 3; status = mem_createmem(finalsize, hdl); } if (status) { fclose(diskfile); ffpmsg("failed to create empty memory file (compress_open)"); return(status); } /* uncompress file into memory */ status = mem_uncompress2mem(filename, diskfile, *hdl); fclose(diskfile); if (status) { mem_close_free(*hdl); /* free up the memory */ ffpmsg("failed to uncompress file into memory (compress_open)"); return(status); } /* if we allocated too much memory initially, then free it */ if (*(memTable[*hdl].memsizeptr) > (( (size_t) memTable[*hdl].fitsfilesize) + 256L) ) { ptr = realloc(*(memTable[*hdl].memaddrptr), ((size_t) memTable[*hdl].fitsfilesize) ); if (!ptr) { ffpmsg("Failed to reduce size of allocated memory (compress_open)"); return(MEMORY_ALLOCATION); } *(memTable[*hdl].memaddrptr) = ptr; *(memTable[*hdl].memsizeptr) = (size_t) (memTable[*hdl].fitsfilesize); } return(0); } /*--------------------------------------------------------------------------*/ int mem_compress_stdin_open(char *filename, int rwmode, int *hdl) /* This routine reads the compressed input stream and creates an empty memory buffer, then calls mem_uncompress2mem. */ { int status; char *ptr; if (rwmode != READONLY) { ffpmsg( "cannot open compressed input stream with WRITE access (mem_compress_stdin_open)"); return(READONLY_FILE); } /* create a memory file for the uncompressed file */ status = mem_createmem(28800, hdl); if (status) { ffpmsg("failed to create empty memory file (compress_stdin_open)"); return(status); } /* uncompress file into memory */ status = mem_uncompress2mem(filename, stdin, *hdl); if (status) { mem_close_free(*hdl); /* free up the memory */ ffpmsg("failed to uncompress stdin into memory (compress_stdin_open)"); return(status); } /* if we allocated too much memory initially, then free it */ if (*(memTable[*hdl].memsizeptr) > (( (size_t) memTable[*hdl].fitsfilesize) + 256L) ) { ptr = realloc(*(memTable[*hdl].memaddrptr), ((size_t) memTable[*hdl].fitsfilesize) ); if (!ptr) { ffpmsg("Failed to reduce size of allocated memory (compress_stdin_open)"); return(MEMORY_ALLOCATION); } *(memTable[*hdl].memaddrptr) = ptr; *(memTable[*hdl].memsizeptr) = (size_t) (memTable[*hdl].fitsfilesize); } return(0); } /*--------------------------------------------------------------------------*/ int mem_iraf_open(char *filename, int rwmode, int *hdl) /* This routine creates an empty memory buffer, then calls iraf2mem to open the IRAF disk file and convert it to a FITS file in memeory. */ { int status; size_t filesize = 0; /* create a memory file with size = 0 for the FITS converted IRAF file */ status = mem_createmem(filesize, hdl); if (status) { ffpmsg("failed to create empty memory file (mem_iraf_open)"); return(status); } /* convert the iraf file into a FITS file in memory */ status = iraf2mem(filename, memTable[*hdl].memaddrptr, memTable[*hdl].memsizeptr, &filesize, &status); if (status) { mem_close_free(*hdl); /* free up the memory */ ffpmsg("failed to convert IRAF file into memory (mem_iraf_open)"); return(status); } memTable[*hdl].currentpos = 0; /* save starting position */ memTable[*hdl].fitsfilesize=filesize; /* and initial file size */ return(0); } /*--------------------------------------------------------------------------*/ int mem_rawfile_open(char *filename, int rwmode, int *hdl) /* This routine creates an empty memory buffer, writes a minimal image header, then copies the image data from the raw file into memory. It will byteswap the pixel values if the raw array is in little endian byte order. */ { FILE *diskfile; fitsfile *fptr; short *sptr; int status, endian, datatype, bytePerPix, naxis; long dim[5] = {1,1,1,1,1}, ii, nvals, offset = 0; size_t filesize = 0, datasize; char rootfile[FLEN_FILENAME], *cptr = 0, *cptr2 = 0; void *ptr; if (rwmode != READONLY) { ffpmsg( "cannot open raw binary file with WRITE access (mem_rawfile_open)"); ffpmsg(filename); return(READONLY_FILE); } cptr = strchr(filename, '['); /* search for opening bracket [ */ if (!cptr) { ffpmsg("binary file name missing '[' character (mem_rawfile_open)"); ffpmsg(filename); return(URL_PARSE_ERROR); } *rootfile = '\0'; strncat(rootfile, filename, cptr - filename); /* store the rootname */ cptr++; while (*cptr == ' ') cptr++; /* skip leading blanks */ /* Get the Data Type of the Image */ if (*cptr == 'b' || *cptr == 'B') { datatype = BYTE_IMG; bytePerPix = 1; } else if (*cptr == 'i' || *cptr == 'I') { datatype = SHORT_IMG; bytePerPix = 2; } else if (*cptr == 'u' || *cptr == 'U') { datatype = USHORT_IMG; bytePerPix = 2; } else if (*cptr == 'j' || *cptr == 'J') { datatype = LONG_IMG; bytePerPix = 4; } else if (*cptr == 'r' || *cptr == 'R' || *cptr == 'f' || *cptr == 'F') { datatype = FLOAT_IMG; bytePerPix = 4; } else if (*cptr == 'd' || *cptr == 'D') { datatype = DOUBLE_IMG; bytePerPix = 8; } else { ffpmsg("error in raw binary file datatype (mem_rawfile_open)"); ffpmsg(filename); return(URL_PARSE_ERROR); } cptr++; /* get Endian: Big or Little; default is same as the local machine */ if (*cptr == 'b' || *cptr == 'B') { endian = 0; cptr++; } else if (*cptr == 'l' || *cptr == 'L') { endian = 1; cptr++; } else endian = BYTESWAPPED; /* byteswapped machines are little endian */ /* read each dimension (up to 5) */ naxis = 1; dim[0] = strtol(cptr, &cptr2, 10); if (cptr2 && *cptr2 == ',') { naxis = 2; dim[1] = strtol(cptr2+1, &cptr, 10); if (cptr && *cptr == ',') { naxis = 3; dim[2] = strtol(cptr+1, &cptr2, 10); if (cptr2 && *cptr2 == ',') { naxis = 4; dim[3] = strtol(cptr2+1, &cptr, 10); if (cptr && *cptr == ',') naxis = 5; dim[4] = strtol(cptr+1, &cptr2, 10); } } } cptr = maxvalue(cptr, cptr2); if (*cptr == ':') /* read starting offset value */ offset = strtol(cptr+1, 0, 10); nvals = dim[0] * dim[1] * dim[2] * dim[3] * dim[4]; datasize = nvals * bytePerPix; filesize = nvals * bytePerPix + 2880; filesize = ((filesize - 1) / 2880 + 1) * 2880; /* open the raw binary disk file */ status = file_openfile(rootfile, READONLY, &diskfile); if (status) { ffpmsg("failed to open raw binary file (mem_rawfile_open)"); ffpmsg(rootfile); return(status); } /* create a memory file with corrct size for the FITS converted raw file */ status = mem_createmem(filesize, hdl); if (status) { ffpmsg("failed to create memory file (mem_rawfile_open)"); fclose(diskfile); return(status); } /* open this piece of memory as a new FITS file */ ffimem(&fptr, (void **) memTable[*hdl].memaddrptr, &filesize, 0, 0, &status); /* write the required header keywords */ ffcrim(fptr, datatype, naxis, dim, &status); /* close the FITS file, but keep the memory allocated */ ffclos(fptr, &status); if (status > 0) { ffpmsg("failed to write basic image header (mem_rawfile_open)"); fclose(diskfile); mem_close_free(*hdl); /* free up the memory */ return(status); } if (offset > 0) fseek(diskfile, offset, 0); /* offset to start of the data */ /* read the raw data into memory */ ptr = *memTable[*hdl].memaddrptr + 2880; if (fread((char *) ptr, 1, datasize, diskfile) != datasize) status = READ_ERROR; fclose(diskfile); /* close the raw binary disk file */ if (status) { mem_close_free(*hdl); /* free up the memory */ ffpmsg("failed to copy raw file data into memory (mem_rawfile_open)"); return(status); } if (datatype == USHORT_IMG) /* have to subtract 32768 from each unsigned */ { /* value to conform to FITS convention. More */ /* efficient way to do this is to just flip */ /* the most significant bit. */ sptr = (short *) ptr; if (endian == BYTESWAPPED) /* working with native format */ { for (ii = 0; ii < nvals; ii++, sptr++) { *sptr = ( *sptr ) ^ 0x8000; } } else /* pixels are byteswapped WRT the native format */ { for (ii = 0; ii < nvals; ii++, sptr++) { *sptr = ( *sptr ) ^ 0x80; } } } if (endian) /* swap the bytes if array is in little endian byte order */ { if (datatype == SHORT_IMG || datatype == USHORT_IMG) { ffswap2( (short *) ptr, nvals); } else if (datatype == LONG_IMG || datatype == FLOAT_IMG) { ffswap4( (INT32BIT *) ptr, nvals); } else if (datatype == DOUBLE_IMG) { ffswap8( (double *) ptr, nvals); } } memTable[*hdl].currentpos = 0; /* save starting position */ memTable[*hdl].fitsfilesize=filesize; /* and initial file size */ return(0); } /*--------------------------------------------------------------------------*/ int mem_uncompress2mem(char *filename, FILE *diskfile, int hdl) { /* lower level routine to uncompress a file into memory. The file has already been opened and the memory buffer has been allocated. */ size_t finalsize; int status; /* uncompress file into memory */ status = 0; if (strstr(filename, ".Z")) { zuncompress2mem(filename, diskfile, memTable[hdl].memaddrptr, /* pointer to memory address */ memTable[hdl].memsizeptr, /* pointer to size of memory */ realloc, /* reallocation function */ &finalsize, &status); /* returned file size nd status*/ } else { uncompress2mem(filename, diskfile, memTable[hdl].memaddrptr, /* pointer to memory address */ memTable[hdl].memsizeptr, /* pointer to size of memory */ realloc, /* reallocation function */ &finalsize, &status); /* returned file size nd status*/ } memTable[hdl].currentpos = 0; /* save starting position */ memTable[hdl].fitsfilesize=finalsize; /* and initial file size */ return status; } /*--------------------------------------------------------------------------*/ int mem_size(int handle, LONGLONG *filesize) /* return the size of the file; only called when the file is first opened */ { *filesize = memTable[handle].fitsfilesize; return(0); } /*--------------------------------------------------------------------------*/ int mem_close_free(int handle) /* close the file and free the memory. */ { free( *(memTable[handle].memaddrptr) ); memTable[handle].memaddrptr = 0; memTable[handle].memaddr = 0; return(0); } /*--------------------------------------------------------------------------*/ int mem_close_keep(int handle) /* close the memory file but do not free the memory. */ { memTable[handle].memaddrptr = 0; memTable[handle].memaddr = 0; return(0); } /*--------------------------------------------------------------------------*/ int mem_close_comp(int handle) /* compress the memory file, writing it out to the fileptr (which might be stdout) */ { int status = 0; size_t compsize; /* compress file in memory to a .gz disk file */ if(compress2file_from_mem(memTable[handle].memaddr, (size_t) (memTable[handle].fitsfilesize), memTable[handle].fileptr, &compsize, &status ) ) { ffpmsg("failed to copy memory file to file (mem_close_comp)"); status = WRITE_ERROR; } free( memTable[handle].memaddr ); /* free the memory */ memTable[handle].memaddrptr = 0; memTable[handle].memaddr = 0; /* close the compressed disk file (except if it is 'stdout' */ if (memTable[handle].fileptr != stdout) fclose(memTable[handle].fileptr); return(status); } /*--------------------------------------------------------------------------*/ int mem_seek(int handle, LONGLONG offset) /* seek to position relative to start of the file. */ { if (offset > memTable[handle].fitsfilesize ) return(END_OF_FILE); memTable[handle].currentpos = offset; return(0); } /*--------------------------------------------------------------------------*/ int mem_read(int hdl, void *buffer, long nbytes) /* read bytes from the current position in the file */ { if (memTable[hdl].currentpos + nbytes > memTable[hdl].fitsfilesize) return(END_OF_FILE); memcpy(buffer, *(memTable[hdl].memaddrptr) + memTable[hdl].currentpos, nbytes); memTable[hdl].currentpos += nbytes; return(0); } /*--------------------------------------------------------------------------*/ int mem_write(int hdl, void *buffer, long nbytes) /* write bytes at the current position in the file */ { size_t newsize; char *ptr; if ((size_t) (memTable[hdl].currentpos + nbytes) > *(memTable[hdl].memsizeptr) ) { if (!(memTable[hdl].mem_realloc)) { ffpmsg("realloc function not defined (mem_write)"); return(WRITE_ERROR); } /* Attempt to reallocate additional memory: the memory buffer size is incremented by the larger of: 1 FITS block (2880 bytes) or the defined 'deltasize' parameter */ newsize = maxvalue( (size_t) (((memTable[hdl].currentpos + nbytes - 1) / 2880) + 1) * 2880, *(memTable[hdl].memsizeptr) + memTable[hdl].deltasize); /* call the realloc function */ ptr = (memTable[hdl].mem_realloc)( *(memTable[hdl].memaddrptr), newsize); if (!ptr) { ffpmsg("Failed to reallocate memory (mem_write)"); return(MEMORY_ALLOCATION); } *(memTable[hdl].memaddrptr) = ptr; *(memTable[hdl].memsizeptr) = newsize; } /* now copy the bytes from the buffer into memory */ memcpy( *(memTable[hdl].memaddrptr) + memTable[hdl].currentpos, buffer, nbytes); memTable[hdl].currentpos += nbytes; memTable[hdl].fitsfilesize = maxvalue(memTable[hdl].fitsfilesize, memTable[hdl].currentpos); return(0); } astropy-0.3/cextern/cfitsio/zuncompress.c0000644000175000017500000004005112243255342017043 0ustar oleole/* gzcompress.h -- definitions for the .Z decompression routine used in CFITSIO */ #include #include #include #include #define get_char() get_byte() /* gzip.h -- common declarations for all gzip modules */ #define OF(args) args typedef void *voidp; #define memzero(s, n) memset ((voidp)(s), 0, (n)) typedef unsigned char uch; typedef unsigned short ush; typedef unsigned long ulg; /* private version of MIN function */ #define MINZIP(a,b) ((a) <= (b) ? (a) : (b)) /* Return codes from gzip */ #define OK 0 #define ERROR 1 #define COMPRESSED 1 #define DEFLATED 8 #define INBUFSIZ 0x8000 /* input buffer size */ #define INBUF_EXTRA 64 /* required by unlzw() */ #define OUTBUFSIZ 16384 /* output buffer size */ #define OUTBUF_EXTRA 2048 /* required by unlzw() */ #define DIST_BUFSIZE 0x8000 /* buffer for distances, see trees.c */ #define WSIZE 0x8000 /* window size--must be a power of two, and */ #define DECLARE(type, array, size) type array[size] #define tab_suffix window #define tab_prefix prev /* hash link (see deflate.c) */ #define head (prev+WSIZE) /* hash head (see deflate.c) */ #define LZW_MAGIC "\037\235" /* Magic header for lzw files, 1F 9D */ #define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)) /* Diagnostic functions */ # define Assert(cond,msg) # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) /* lzw.h -- define the lzw functions. */ #ifndef BITS # define BITS 16 #endif #define INIT_BITS 9 /* Initial number of bits per code */ #define BIT_MASK 0x1f /* Mask for 'number of compression bits' */ #define BLOCK_MODE 0x80 #define LZW_RESERVED 0x60 /* reserved bits */ #define CLEAR 256 /* flush the dictionary */ #define FIRST (CLEAR+1) /* first free entry */ /* prototypes */ #define local static void ffpmsg(const char *err_message); local int fill_inbuf OF((int eof_ok)); local void write_buf OF((voidp buf, unsigned cnt)); local void error OF((char *m)); local int unlzw OF((FILE *in, FILE *out)); typedef int file_t; /* Do not use stdio */ int (*work) OF((FILE *infile, FILE *outfile)) = unlzw; /* function to call */ local void error OF((char *m)); /* global buffers */ static DECLARE(uch, inbuf, INBUFSIZ +INBUF_EXTRA); static DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); static DECLARE(ush, d_buf, DIST_BUFSIZE); static DECLARE(uch, window, 2L*WSIZE); #ifndef MAXSEG_64K static DECLARE(ush, tab_prefix, 1L< 0) return(*status); /* save input parameters into global variables */ ifname[0] = '\0'; strncat(ifname, filename, 127); ifd = indiskfile; memptr = (void **) buffptr; memsize = buffsize; realloc_fn = mem_realloc; /* clear input and output buffers */ insize = inptr = 0; bytes_in = bytes_out = 0L; magic[0] = (char)get_byte(); magic[1] = (char)get_byte(); if (memcmp(magic, LZW_MAGIC, 2) != 0) { error("ERROR: input .Z file is in unrecognized compression format.\n"); return(-1); } work = unlzw; method = COMPRESSED; last_member = 1; /* do the uncompression */ if ((*work)(ifd, ofd) != OK) { method = -1; /* force cleanup */ *status = 414; /* report some sort of decompression error */ } if (filesize) *filesize = bytes_out; return(*status); } /*=========================================================================*/ /*=========================================================================*/ /* this marks the begining of the original file 'unlzw.c' */ /*=========================================================================*/ /*=========================================================================*/ /* unlzw.c -- decompress files in LZW format. * The code in this file is directly derived from the public domain 'compress' * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies, * Ken Turkowski, Dave Mack and Peter Jannesen. */ typedef unsigned char char_type; typedef long code_int; typedef unsigned long count_int; typedef unsigned short count_short; typedef unsigned long cmp_code_int; #define MAXCODE(n) (1L << (n)) #ifndef REGISTERS # define REGISTERS 2 #endif #define REG1 #define REG2 #define REG3 #define REG4 #define REG5 #define REG6 #define REG7 #define REG8 #define REG9 #define REG10 #define REG11 #define REG12 #define REG13 #define REG14 #define REG15 #define REG16 #if REGISTERS >= 1 # undef REG1 # define REG1 register #endif #if REGISTERS >= 2 # undef REG2 # define REG2 register #endif #if REGISTERS >= 3 # undef REG3 # define REG3 register #endif #if REGISTERS >= 4 # undef REG4 # define REG4 register #endif #if REGISTERS >= 5 # undef REG5 # define REG5 register #endif #if REGISTERS >= 6 # undef REG6 # define REG6 register #endif #if REGISTERS >= 7 # undef REG7 # define REG7 register #endif #if REGISTERS >= 8 # undef REG8 # define REG8 register #endif #if REGISTERS >= 9 # undef REG9 # define REG9 register #endif #if REGISTERS >= 10 # undef REG10 # define REG10 register #endif #if REGISTERS >= 11 # undef REG11 # define REG11 register #endif #if REGISTERS >= 12 # undef REG12 # define REG12 register #endif #if REGISTERS >= 13 # undef REG13 # define REG13 register #endif #if REGISTERS >= 14 # undef REG14 # define REG14 register #endif #if REGISTERS >= 15 # undef REG15 # define REG15 register #endif #if REGISTERS >= 16 # undef REG16 # define REG16 register #endif #ifndef BYTEORDER # define BYTEORDER 0000 #endif #ifndef NOALLIGN # define NOALLIGN 0 #endif union bytes { long word; struct { #if BYTEORDER == 4321 char_type b1; char_type b2; char_type b3; char_type b4; #else #if BYTEORDER == 1234 char_type b4; char_type b3; char_type b2; char_type b1; #else # undef BYTEORDER int dummy; #endif #endif } bytes; }; #if BYTEORDER == 4321 && NOALLIGN == 1 # define input(b,o,c,n,m){ \ (c) = (*(long *)(&(b)[(o)>>3])>>((o)&0x7))&(m); \ (o) += (n); \ } #else # define input(b,o,c,n,m){ \ REG1 char_type *p = &(b)[(o)>>3]; \ (c) = ((((long)(p[0]))|((long)(p[1])<<8)| \ ((long)(p[2])<<16))>>((o)&0x7))&(m); \ (o) += (n); \ } #endif #ifndef MAXSEG_64K /* DECLARE(ush, tab_prefix, (1<>1] # define clear_tab_prefixof() \ memzero(tab_prefix0, 128), \ memzero(tab_prefix1, 128); #endif #define de_stack ((char_type *)(&d_buf[DIST_BUFSIZE-1])) #define tab_suffixof(i) tab_suffix[i] int block_mode = BLOCK_MODE; /* block compress mode -C compatible with 2.0 */ /* ============================================================================ * Decompress in to out. This routine adapts to the codes in the * file building the "string" table on-the-fly; requiring no table to * be stored in the compressed file. * IN assertions: the buffer inbuf contains already the beginning of * the compressed data, from offsets iptr to insize-1 included. * The magic header has already been checked and skipped. * bytes_in and bytes_out have been initialized. */ local int unlzw(FILE *in, FILE *out) /* input and output file descriptors */ { REG2 char_type *stackp; REG3 code_int code; REG4 int finchar; REG5 code_int oldcode; REG6 code_int incode; REG7 long inbits; REG8 long posbits; REG9 int outpos; /* REG10 int insize; (global) */ REG11 unsigned bitmask; REG12 code_int free_ent; REG13 code_int maxcode; REG14 code_int maxmaxcode; REG15 int n_bits; REG16 int rsize; ofd = out; #ifdef MAXSEG_64K tab_prefix[0] = tab_prefix0; tab_prefix[1] = tab_prefix1; #endif maxbits = get_byte(); block_mode = maxbits & BLOCK_MODE; if ((maxbits & LZW_RESERVED) != 0) { error( "warning, unknown flags in unlzw decompression"); } maxbits &= BIT_MASK; maxmaxcode = MAXCODE(maxbits); if (maxbits > BITS) { error("compressed with too many bits; cannot handle file"); exit_code = ERROR; return ERROR; } rsize = insize; maxcode = MAXCODE(n_bits = INIT_BITS)-1; bitmask = (1<= 0 ; --code) { tab_suffixof(code) = (char_type)code; } do { REG1 int i; int e; int o; resetbuf: e = insize-(o = (posbits>>3)); for (i = 0 ; i < e ; ++i) { inbuf[i] = inbuf[i+o]; } insize = e; posbits = 0; if (insize < INBUF_EXTRA) { /* modified to use fread instead of read - WDP 10/22/97 */ /* if ((rsize = read(in, (char*)inbuf+insize, INBUFSIZ)) == EOF) { */ if ((rsize = fread((char*)inbuf+insize, 1, INBUFSIZ, in)) == EOF) { error("unexpected end of file"); exit_code = ERROR; return ERROR; } insize += rsize; bytes_in += (ulg)rsize; } inbits = ((rsize != 0) ? ((long)insize - insize%n_bits)<<3 : ((long)insize<<3)-(n_bits-1)); while (inbits > posbits) { if (free_ent > maxcode) { posbits = ((posbits-1) + ((n_bits<<3)-(posbits-1+(n_bits<<3))%(n_bits<<3))); ++n_bits; if (n_bits == maxbits) { maxcode = maxmaxcode; } else { maxcode = MAXCODE(n_bits)-1; } bitmask = (1<= 256) { error("corrupt input."); exit_code = ERROR; return ERROR; } outbuf[outpos++] = (char_type)(finchar = (int)(oldcode=code)); continue; } if (code == CLEAR && block_mode) { clear_tab_prefixof(); free_ent = FIRST - 1; posbits = ((posbits-1) + ((n_bits<<3)-(posbits-1+(n_bits<<3))%(n_bits<<3))); maxcode = MAXCODE(n_bits = INIT_BITS)-1; bitmask = (1<= free_ent) { /* Special case for KwKwK string. */ if (code > free_ent) { if (outpos > 0) { write_buf((char*)outbuf, outpos); bytes_out += (ulg)outpos; } error("corrupt input."); exit_code = ERROR; return ERROR; } *--stackp = (char_type)finchar; code = oldcode; } while ((cmp_code_int)code >= (cmp_code_int)256) { /* Generate output characters in reverse order */ *--stackp = tab_suffixof(code); code = tab_prefixof(code); } *--stackp = (char_type)(finchar = tab_suffixof(code)); /* And put them out in forward order */ { /* REG1 int i; already defined above (WDP) */ if (outpos+(i = (de_stack-stackp)) >= OUTBUFSIZ) { do { if (i > OUTBUFSIZ-outpos) i = OUTBUFSIZ-outpos; if (i > 0) { memcpy(outbuf+outpos, stackp, i); outpos += i; } if (outpos >= OUTBUFSIZ) { write_buf((char*)outbuf, outpos); bytes_out += (ulg)outpos; outpos = 0; } stackp+= i; } while ((i = (de_stack-stackp)) > 0); } else { memcpy(outbuf+outpos, stackp, i); outpos += i; } } if ((code = free_ent) < maxmaxcode) { /* Generate the new entry. */ tab_prefixof(code) = (unsigned short)oldcode; tab_suffixof(code) = (char_type)finchar; free_ent = code+1; } oldcode = incode; /* Remember previous code. */ } } while (rsize != 0); if (outpos > 0) { write_buf((char*)outbuf, outpos); bytes_out += (ulg)outpos; } return OK; } /* ========================================================================*/ /* this marks the start of the code from 'util.c' */ local int fill_inbuf(int eof_ok) /* set if EOF acceptable as a result */ { int len; /* Read as much as possible from file */ insize = 0; do { len = fread((char*)inbuf+insize, 1, INBUFSIZ-insize, ifd); if (len == 0 || len == EOF) break; insize += len; } while (insize < INBUFSIZ); if (insize == 0) { if (eof_ok) return EOF; error("unexpected end of file"); exit_code = ERROR; return ERROR; } bytes_in += (ulg)insize; inptr = 1; return inbuf[0]; } /* =========================================================================== */ local void write_buf(voidp buf, unsigned cnt) /* copy buffer into memory; allocate more memory if required*/ { if (!realloc_fn) { /* append buffer to file */ /* added 'unsigned' to get rid of compiler warning (WDP 1/1/99) */ if ((unsigned long) fwrite(buf, 1, cnt, ofd) != cnt) { error ("failed to write buffer to uncompressed output file (write_buf)"); exit_code = ERROR; return; } } else { /* get more memory if current buffer is too small */ if (bytes_out + cnt > *memsize) { *memptr = realloc_fn(*memptr, bytes_out + cnt); *memsize = bytes_out + cnt; /* new memory buffer size */ if (!(*memptr)) { error("malloc failed while uncompressing (write_buf)"); exit_code = ERROR; return; } } /* copy into memory buffer */ memcpy((char *) *memptr + bytes_out, (char *) buf, cnt); } } /* ======================================================================== */ local void error(char *m) /* Error handler */ { ffpmsg(ifname); ffpmsg(m); } astropy-0.3/cextern/cfitsio/putcolu.c0000644000175000017500000005176712243255342016166 0ustar oleole/* This file, putcolu.c, contains routines that write data elements to */ /* a FITS image or table. Writes null values. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppru( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *status) /* IO - error status */ /* Write null values to the primary array. */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } row=maxvalue(1,group); ffpclu(fptr, 2, row, firstelem, nelem, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpprn( fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *status) /* IO - error status */ /* Write null values to the primary array. (Doesn't support groups). */ { long row = 1; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } ffpclu(fptr, 2, row, firstelem, nelem, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclu( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelempar, /* I - number of values to write */ int *status) /* IO - error status */ /* Set elements of a table column to the appropriate null value for the column The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. This routine support COMPLEX and DOUBLE COMPLEX binary table columns, and sets both the real and imaginary components of the element to a NaN. */ { int tcode, maxelem, hdutype, writemode = 2, leng; short i2null; INT32BIT i4null; long twidth, incre; long ii; LONGLONG largeelem, nelem, tnull, i8null; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, ntodo; double scale, zero; unsigned char i1null, lognul = 0; char tform[20], *cstring = 0; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ long jbuff[2] = { -1, -1}; /* all bits set is equivalent to a NaN */ size_t buffsize; if (*status > 0) /* inherit input status value if > 0 */ return(*status); nelem = nelempar; largeelem = firstelem; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ /* note that writemode = 2 by default (not 1), so that the returned */ /* repeat and incre values will be the actual values for this column. */ /* If writing nulls to a variable length column then dummy data values */ /* must have already been written to the heap. */ /* We just have to overwrite the previous values with null values. */ /* Set writemode = 0 in this case, to test that values have been written */ fits_get_coltype(fptr, colnum, &tcode, NULL, NULL, status); if (tcode < 0) writemode = 0; /* this is a variable length column */ if (abs(tcode) >= TCOMPLEX) { /* treat complex columns as pairs of numbers */ largeelem = (largeelem - 1) * 2 + 1; nelem *= 2; } if (ffgcprll( fptr, colnum, firstrow, largeelem, nelem, writemode, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) { if (snull[0] == ASCII_NULL_UNDEFINED) { ffpmsg( "Null value string for ASCII table column is not defined (FTPCLU)."); return(*status = NO_NULL); } /* allocate buffer to hold the null string. Must write the entire */ /* width of the column (twidth bytes) to avoid possible problems */ /* with uninitialized FITS blocks, in case the field spans blocks */ buffsize = maxvalue(20, twidth); cstring = (char *) malloc(buffsize); if (!cstring) return(*status = MEMORY_ALLOCATION); memset(cstring, ' ', buffsize); /* initialize with blanks */ leng = strlen(snull); if (hdutype == BINARY_TBL) leng++; /* copy the terminator too in binary tables */ strncpy(cstring, snull, leng); /* copy null string to temp buffer */ } else if ( tcode == TBYTE || tcode == TSHORT || tcode == TLONG || tcode == TLONGLONG) { if (tnull == NULL_UNDEFINED) { ffpmsg( "Null value for integer table column is not defined (FTPCLU)."); return(*status = NO_NULL); } if (tcode == TBYTE) i1null = (unsigned char) tnull; else if (tcode == TSHORT) { i2null = (short) tnull; #if BYTESWAPPED ffswap2(&i2null, 1); /* reverse order of bytes */ #endif } else if (tcode == TLONG) { i4null = (INT32BIT) tnull; #if BYTESWAPPED ffswap4(&i4null, 1); /* reverse order of bytes */ #endif } else { i8null = tnull; #if BYTESWAPPED ffswap8((double *)(&i8null), 1); /* reverse order of bytes */ #endif } } /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ ntodo = remain; /* number of elements to write at one time */ while (ntodo) { /* limit the number of pixels to process at one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TBYTE): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 1, &i1null, status); break; case (TSHORT): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 2, &i2null, status); break; case (TLONG): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 4, &i4null, status); break; case (TLONGLONG): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 8, &i8null, status); break; case (TFLOAT): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 4, jbuff, status); break; case (TDOUBLE): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 8, jbuff, status); break; case (TLOGICAL): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 1, &lognul, status); break; case (TSTRING): /* an ASCII table column */ /* repeat always = 1, so ntodo is also guaranteed to = 1 */ ffpbyt(fptr, twidth, cstring, status); break; default: /* error trap */ sprintf(message, "Cannot write null value to column %d which has format %s", colnum,tform); ffpmsg(message); return(*status); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing %.0f thru %.0f of null values (ffpclu).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); if (cstring) free(cstring); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } ntodo = remain; /* this is the maximum number to do in next loop */ } /* End of main while Loop */ if (cstring) free(cstring); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcluc( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *status) /* IO - error status */ /* Set elements of a table column to the appropriate null value for the column The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. This routine does not do anything special in the case of COMPLEX table columns (unlike the similar ffpclu routine). This routine is mainly for use by ffpcne which already compensates for the effective doubling of the number of elements in a complex column. */ { int tcode, maxelem, hdutype, writemode = 2, leng; short i2null; INT32BIT i4null; long twidth, incre; long ii; LONGLONG tnull, i8null; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, ntodo; double scale, zero; unsigned char i1null, lognul = 0; char tform[20], *cstring = 0; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ long jbuff[2] = { -1, -1}; /* all bits set is equivalent to a NaN */ size_t buffsize; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ /* note that writemode = 2 by default (not 1), so that the returned */ /* repeat and incre values will be the actual values for this column. */ /* If writing nulls to a variable length column then dummy data values */ /* must have already been written to the heap. */ /* We just have to overwrite the previous values with null values. */ /* Set writemode = 0 in this case, to test that values have been written */ fits_get_coltype(fptr, colnum, &tcode, NULL, NULL, status); if (tcode < 0) writemode = 0; /* this is a variable length column */ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, writemode, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) { if (snull[0] == ASCII_NULL_UNDEFINED) { ffpmsg( "Null value string for ASCII table column is not defined (FTPCLU)."); return(*status = NO_NULL); } /* allocate buffer to hold the null string. Must write the entire */ /* width of the column (twidth bytes) to avoid possible problems */ /* with uninitialized FITS blocks, in case the field spans blocks */ buffsize = maxvalue(20, twidth); cstring = (char *) malloc(buffsize); if (!cstring) return(*status = MEMORY_ALLOCATION); memset(cstring, ' ', buffsize); /* initialize with blanks */ leng = strlen(snull); if (hdutype == BINARY_TBL) leng++; /* copy the terminator too in binary tables */ strncpy(cstring, snull, leng); /* copy null string to temp buffer */ } else if ( tcode == TBYTE || tcode == TSHORT || tcode == TLONG || tcode == TLONGLONG) { if (tnull == NULL_UNDEFINED) { ffpmsg( "Null value for integer table column is not defined (FTPCLU)."); return(*status = NO_NULL); } if (tcode == TBYTE) i1null = (unsigned char) tnull; else if (tcode == TSHORT) { i2null = (short) tnull; #if BYTESWAPPED ffswap2(&i2null, 1); /* reverse order of bytes */ #endif } else if (tcode == TLONG) { i4null = (INT32BIT) tnull; #if BYTESWAPPED ffswap4(&i4null, 1); /* reverse order of bytes */ #endif } else { i8null = tnull; #if BYTESWAPPED ffswap4( (INT32BIT*) &i8null, 2); /* reverse order of bytes */ #endif } } /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ ntodo = remain; /* number of elements to write at one time */ while (ntodo) { /* limit the number of pixels to process at one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TBYTE): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 1, &i1null, status); break; case (TSHORT): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 2, &i2null, status); break; case (TLONG): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 4, &i4null, status); break; case (TLONGLONG): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 8, &i8null, status); break; case (TFLOAT): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 4, jbuff, status); break; case (TDOUBLE): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 8, jbuff, status); break; case (TLOGICAL): for (ii = 0; ii < ntodo; ii++) ffpbyt(fptr, 1, &lognul, status); break; case (TSTRING): /* an ASCII table column */ /* repeat always = 1, so ntodo is also guaranteed to = 1 */ ffpbyt(fptr, twidth, cstring, status); break; default: /* error trap */ sprintf(message, "Cannot write null value to column %d which has format %s", colnum,tform); ffpmsg(message); return(*status); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing %.0f thru %.0f of null values (ffpclu).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); if (cstring) free(cstring); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } ntodo = remain; /* this is the maximum number to do in next loop */ } /* End of main while Loop */ if (cstring) free(cstring); return(*status); } /*--------------------------------------------------------------------------*/ int ffprwu(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status) /* * fits_write_nullrows / ffprwu - write TNULLs to all columns in one or more rows * * fitsfile *fptr - pointer to FITS HDU opened for read/write * long int firstrow - first table row to set to null. (firstrow >= 1) * long int nrows - total number or rows to set to null. (nrows >= 1) * int *status - upon return, *status contains CFITSIO status code * * RETURNS: CFITSIO status code * * written by Craig Markwardt, GSFC */ { LONGLONG ntotrows; int ncols, i; int typecode = 0; LONGLONG repeat = 0, width = 0; int nullstatus; if (*status > 0) return *status; if ((firstrow <= 0) || (nrows <= 0)) return (*status = BAD_ROW_NUM); fits_get_num_rowsll(fptr, &ntotrows, status); if (firstrow + nrows - 1 > ntotrows) return (*status = BAD_ROW_NUM); fits_get_num_cols(fptr, &ncols, status); if (*status) return *status; /* Loop through each column and write nulls */ for (i=1; i <= ncols; i++) { repeat = 0; typecode = 0; width = 0; fits_get_coltypell(fptr, i, &typecode, &repeat, &width, status); if (*status) break; /* NOTE: data of TSTRING type must not write the total repeat count, since the repeat count is the *character* count, not the nstring count. Divide by string width to get number of strings. */ if (typecode == TSTRING) repeat /= width; /* Write NULLs */ nullstatus = 0; fits_write_col_null(fptr, i, firstrow, 1, repeat*nrows, &nullstatus); /* ignore error if no null value is defined for the column */ if (nullstatus && nullstatus != NO_NULL) return (*status = nullstatus); } return *status; } astropy-0.3/cextern/cfitsio/region.c0000644000175000017500000015420612243255342015746 0ustar oleole#include #include #include #include #include #include "fitsio2.h" #include "region.h" static int Pt_in_Poly( double x, double y, int nPts, double *Pts ); /*---------------------------------------------------------------------------*/ int fits_read_rgnfile( const char *filename, WCSdata *wcs, SAORegion **Rgn, int *status ) /* Read regions from either a FITS or ASCII region file and return the information */ /* in the "SAORegion" structure. If it is nonNULL, use wcs to convert the */ /* region coordinates to pixels. Return an error if region is in degrees */ /* but no WCS data is provided. */ /*---------------------------------------------------------------------------*/ { fitsfile *fptr; int tstatus = 0; if( *status ) return( *status ); /* try to open as a FITS file - if that doesn't work treat as an ASCII file */ fits_write_errmark(); if ( ffopen(&fptr, filename, READONLY, &tstatus) ) { fits_clear_errmark(); fits_read_ascii_region(filename, wcs, Rgn, status); } else { fits_read_fits_region(fptr, wcs, Rgn, status); } return(*status); } /*---------------------------------------------------------------------------*/ int fits_read_ascii_region( const char *filename, WCSdata *wcs, SAORegion **Rgn, int *status ) /* Read regions from a SAO-style region file and return the information */ /* in the "SAORegion" structure. If it is nonNULL, use wcs to convert the */ /* region coordinates to pixels. Return an error if region is in degrees */ /* but no WCS data is provided. */ /*---------------------------------------------------------------------------*/ { char *currLine; char *namePtr, *paramPtr, *currLoc; char *pX, *pY, *endp; long allocLen, lineLen, hh, mm, dd; double *coords, X, Y, x, y, ss, div, xsave= 0., ysave= 0.; int nParams, nCoords, negdec; int i, done; FILE *rgnFile; coordFmt cFmt; SAORegion *aRgn; RgnShape *newShape, *tmpShape; if( *status ) return( *status ); aRgn = (SAORegion *)malloc( sizeof(SAORegion) ); if( ! aRgn ) { ffpmsg("Couldn't allocate memory to hold Region file contents."); return(*status = MEMORY_ALLOCATION ); } aRgn->nShapes = 0; aRgn->Shapes = NULL; if( wcs && wcs->exists ) aRgn->wcs = *wcs; else aRgn->wcs.exists = 0; cFmt = pixel_fmt; /* set default format */ /* Allocate Line Buffer */ allocLen = 512; currLine = (char *)malloc( allocLen * sizeof(char) ); if( !currLine ) { free( aRgn ); ffpmsg("Couldn't allocate memory to hold Region file contents."); return(*status = MEMORY_ALLOCATION ); } /* Open Region File */ if( (rgnFile = fopen( filename, "r" ))==NULL ) { sprintf(currLine,"Could not open Region file %s.",filename); ffpmsg( currLine ); free( currLine ); free( aRgn ); return( *status = FILE_NOT_OPENED ); } /* Read in file, line by line */ /* First, set error status in case file is empty */ *status = FILE_NOT_OPENED; while( fgets(currLine,allocLen,rgnFile) != NULL ) { /* reset status if we got here */ *status = 0; /* Make sure we have a full line of text */ lineLen = strlen(currLine); while( lineLen==allocLen-1 && currLine[lineLen-1]!='\n' ) { currLoc = (char *)realloc( currLine, 2 * allocLen * sizeof(char) ); if( !currLoc ) { ffpmsg("Couldn't allocate memory to hold Region file contents."); *status = MEMORY_ALLOCATION; goto error; } else { currLine = currLoc; } fgets( currLine+lineLen, allocLen+1, rgnFile ); allocLen += allocLen; lineLen += strlen(currLine+lineLen); } currLoc = currLine; if( *currLoc == '#' ) { /* Look to see if it is followed by a format statement... */ /* if not skip line */ currLoc++; while( isspace(*currLoc) ) currLoc++; if( !strncasecmp( currLoc, "format:", 7 ) ) { if( aRgn->nShapes ) { ffpmsg("Format code encountered after reading 1 or more shapes."); *status = PARSE_SYNTAX_ERR; goto error; } currLoc += 7; while( isspace(*currLoc) ) currLoc++; if( !strncasecmp( currLoc, "pixel", 5 ) ) { cFmt = pixel_fmt; } else if( !strncasecmp( currLoc, "degree", 6 ) ) { cFmt = degree_fmt; } else if( !strncasecmp( currLoc, "hhmmss", 6 ) ) { cFmt = hhmmss_fmt; } else if( !strncasecmp( currLoc, "hms", 3 ) ) { cFmt = hhmmss_fmt; } else { ffpmsg("Unknown format code encountered in region file."); *status = PARSE_SYNTAX_ERR; goto error; } } } else if( !strncasecmp( currLoc, "glob", 4 ) ) { /* skip lines that begin with the word 'global' */ } else { while( *currLoc != '\0' ) { namePtr = currLoc; paramPtr = NULL; nParams = 1; /* Search for closing parenthesis */ done = 0; while( !done && !*status && *currLoc ) { switch (*currLoc) { case '(': *currLoc = '\0'; currLoc++; if( paramPtr ) /* Can't have two '(' in a region! */ *status = 1; else paramPtr = currLoc; break; case ')': *currLoc = '\0'; currLoc++; if( !paramPtr ) /* Can't have a ')' without a '(' first */ *status = 1; else done = 1; break; case '#': case '\n': *currLoc = '\0'; if( !paramPtr ) /* Allow for a blank line */ done = 1; break; case ':': currLoc++; if ( paramPtr ) cFmt = hhmmss_fmt; /* set format if parameter has : */ break; case 'd': currLoc++; if ( paramPtr ) cFmt = degree_fmt; /* set format if parameter has d */ break; case ',': nParams++; /* Fall through to default */ default: currLoc++; break; } } if( *status || !done ) { ffpmsg( "Error reading Region file" ); *status = PARSE_SYNTAX_ERR; goto error; } /* Skip white space in region name */ while( isspace(*namePtr) ) namePtr++; /* Was this a blank line? Or the end of the current one */ if( ! *namePtr && ! paramPtr ) continue; /* Check for format code at beginning of the line */ if( !strncasecmp( namePtr, "image;", 6 ) ) { namePtr += 6; cFmt = pixel_fmt; } else if( !strncasecmp( namePtr, "physical;", 9 ) ) { namePtr += 9; cFmt = pixel_fmt; } else if( !strncasecmp( namePtr, "linear;", 7 ) ) { namePtr += 7; cFmt = pixel_fmt; } else if( !strncasecmp( namePtr, "fk4;", 4 ) ) { namePtr += 4; cFmt = degree_fmt; } else if( !strncasecmp( namePtr, "fk5;", 4 ) ) { namePtr += 4; cFmt = degree_fmt; } else if( !strncasecmp( namePtr, "icrs;", 5 ) ) { namePtr += 5; cFmt = degree_fmt; /* the following 5 cases support region files created by POW (or ds9 Version 4.x) which may have lines containing only a format code, not followed by a ';' (and with no region specifier on the line). We use the 'continue' statement to jump to the end of the loop and then continue reading the next line of the region file. */ } else if( !strncasecmp( namePtr, "fk5", 3 ) ) { cFmt = degree_fmt; continue; /* supports POW region file format */ } else if( !strncasecmp( namePtr, "fk4", 3 ) ) { cFmt = degree_fmt; continue; /* supports POW region file format */ } else if( !strncasecmp( namePtr, "icrs", 4 ) ) { cFmt = degree_fmt; continue; /* supports POW region file format */ } else if( !strncasecmp( namePtr, "image", 5 ) ) { cFmt = pixel_fmt; continue; /* supports POW region file format */ } else if( !strncasecmp( namePtr, "physical", 8 ) ) { cFmt = pixel_fmt; continue; /* supports POW region file format */ } else if( !strncasecmp( namePtr, "galactic;", 9 ) ) { ffpmsg( "Galactic region coordinates not supported" ); ffpmsg( namePtr ); *status = PARSE_SYNTAX_ERR; goto error; } else if( !strncasecmp( namePtr, "ecliptic;", 9 ) ) { ffpmsg( "ecliptic region coordinates not supported" ); ffpmsg( namePtr ); *status = PARSE_SYNTAX_ERR; goto error; } /**************************************************/ /* We've apparently found a region... Set it up */ /**************************************************/ if( !(aRgn->nShapes % 10) ) { if( aRgn->Shapes ) tmpShape = (RgnShape *)realloc( aRgn->Shapes, (10+aRgn->nShapes) * sizeof(RgnShape) ); else tmpShape = (RgnShape *) malloc( 10 * sizeof(RgnShape) ); if( tmpShape ) { aRgn->Shapes = tmpShape; } else { ffpmsg( "Failed to allocate memory for Region data"); *status = MEMORY_ALLOCATION; goto error; } } newShape = &aRgn->Shapes[aRgn->nShapes++]; newShape->sign = 1; newShape->shape = point_rgn; for (i=0; i<8; i++) newShape->param.gen.p[i] = 0.0; newShape->param.gen.a = 0.0; newShape->param.gen.b = 0.0; newShape->param.gen.sinT = 0.0; newShape->param.gen.cosT = 0.0; while( isspace(*namePtr) ) namePtr++; /* Check for the shape's sign */ if( *namePtr=='+' ) { namePtr++; } else if( *namePtr=='-' ) { namePtr++; newShape->sign = 0; } /* Skip white space in region name */ while( isspace(*namePtr) ) namePtr++; if( *namePtr=='\0' ) { ffpmsg( "Error reading Region file" ); *status = PARSE_SYNTAX_ERR; goto error; } lineLen = strlen( namePtr ) - 1; while( isspace(namePtr[lineLen]) ) namePtr[lineLen--] = '\0'; /* Now identify the region */ if( !strcasecmp( namePtr, "circle" ) ) { newShape->shape = circle_rgn; if( nParams != 3 ) *status = PARSE_SYNTAX_ERR; nCoords = 2; } else if( !strcasecmp( namePtr, "annulus" ) ) { newShape->shape = annulus_rgn; if( nParams != 4 ) *status = PARSE_SYNTAX_ERR; nCoords = 2; } else if( !strcasecmp( namePtr, "ellipse" ) ) { if( nParams < 4 || nParams > 8 ) { *status = PARSE_SYNTAX_ERR; } else if ( nParams < 6 ) { newShape->shape = ellipse_rgn; newShape->param.gen.p[4] = 0.0; } else { newShape->shape = elliptannulus_rgn; newShape->param.gen.p[6] = 0.0; newShape->param.gen.p[7] = 0.0; } nCoords = 2; } else if( !strcasecmp( namePtr, "elliptannulus" ) ) { newShape->shape = elliptannulus_rgn; if( !( nParams==8 || nParams==6 ) ) *status = PARSE_SYNTAX_ERR; newShape->param.gen.p[6] = 0.0; newShape->param.gen.p[7] = 0.0; nCoords = 2; } else if( !strcasecmp( namePtr, "box" ) || !strcasecmp( namePtr, "rotbox" ) ) { if( nParams < 4 || nParams > 8 ) { *status = PARSE_SYNTAX_ERR; } else if ( nParams < 6 ) { newShape->shape = box_rgn; newShape->param.gen.p[4] = 0.0; } else { newShape->shape = boxannulus_rgn; newShape->param.gen.p[6] = 0.0; newShape->param.gen.p[7] = 0.0; } nCoords = 2; } else if( !strcasecmp( namePtr, "rectangle" ) || !strcasecmp( namePtr, "rotrectangle" ) ) { newShape->shape = rectangle_rgn; if( nParams < 4 || nParams > 5 ) *status = PARSE_SYNTAX_ERR; newShape->param.gen.p[4] = 0.0; nCoords = 4; } else if( !strcasecmp( namePtr, "diamond" ) || !strcasecmp( namePtr, "rotdiamond" ) || !strcasecmp( namePtr, "rhombus" ) || !strcasecmp( namePtr, "rotrhombus" ) ) { newShape->shape = diamond_rgn; if( nParams < 4 || nParams > 5 ) *status = PARSE_SYNTAX_ERR; newShape->param.gen.p[4] = 0.0; nCoords = 2; } else if( !strcasecmp( namePtr, "sector" ) || !strcasecmp( namePtr, "pie" ) ) { newShape->shape = sector_rgn; if( nParams != 4 ) *status = PARSE_SYNTAX_ERR; nCoords = 2; } else if( !strcasecmp( namePtr, "point" ) ) { newShape->shape = point_rgn; if( nParams != 2 ) *status = PARSE_SYNTAX_ERR; nCoords = 2; } else if( !strcasecmp( namePtr, "line" ) ) { newShape->shape = line_rgn; if( nParams != 4 ) *status = PARSE_SYNTAX_ERR; nCoords = 4; } else if( !strcasecmp( namePtr, "polygon" ) ) { newShape->shape = poly_rgn; if( nParams < 6 || (nParams&1) ) *status = PARSE_SYNTAX_ERR; nCoords = nParams; } else if( !strcasecmp( namePtr, "panda" ) ) { newShape->shape = panda_rgn; if( nParams != 8 ) *status = PARSE_SYNTAX_ERR; nCoords = 2; } else if( !strcasecmp( namePtr, "epanda" ) ) { newShape->shape = epanda_rgn; if( nParams < 10 || nParams > 11 ) *status = PARSE_SYNTAX_ERR; newShape->param.gen.p[10] = 0.0; nCoords = 2; } else if( !strcasecmp( namePtr, "bpanda" ) ) { newShape->shape = bpanda_rgn; if( nParams < 10 || nParams > 11 ) *status = PARSE_SYNTAX_ERR; newShape->param.gen.p[10] = 0.0; nCoords = 2; } else { ffpmsg( "Unrecognized region found in region file:" ); ffpmsg( namePtr ); *status = PARSE_SYNTAX_ERR; goto error; } if( *status ) { ffpmsg( "Wrong number of parameters found for region" ); ffpmsg( namePtr ); goto error; } /* Parse Parameter string... convert to pixels if necessary */ if( newShape->shape==poly_rgn ) { newShape->param.poly.Pts = (double *)malloc( nParams * sizeof(double) ); if( !newShape->param.poly.Pts ) { ffpmsg( "Could not allocate memory to hold polygon parameters" ); *status = MEMORY_ALLOCATION; goto error; } newShape->param.poly.nPts = nParams; coords = newShape->param.poly.Pts; } else coords = newShape->param.gen.p; /* Parse the initial "WCS?" coordinates */ for( i=0; iexists ) { ffpmsg("WCS information needed to convert region coordinates."); *status = NO_WCS_KEY; goto error; } if( ffxypx( X, Y, wcs->xrefval, wcs->yrefval, wcs->xrefpix, wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot, wcs->type, &x, &y, status ) ) { ffpmsg("Error converting region to pixel coordinates."); goto error; } X = x; Y = y; } coords[i] = X; coords[i+1] = Y; } /* Read in remaining parameters... */ for( ; ixrefval, wcs->yrefval, wcs->xrefpix, wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot, wcs->type, &x, &y, status ) ) { ffpmsg("Error converting region to pixel coordinates."); goto error; } coords[i] = sqrt( pow(x-coords[0],2) + pow(y-coords[1],2) ); } } /* special case for elliptannulus and boxannulus if only one angle was given */ if ( (newShape->shape == elliptannulus_rgn || newShape->shape == boxannulus_rgn ) && nParams == 7 ) { coords[7] = coords[6]; } /* Also, correct the position angle for any WCS rotation: */ /* If regions are specified in WCS coordintes, then the angles */ /* are relative to the WCS system, not the pixel X,Y system */ if( cFmt!=pixel_fmt ) { switch( newShape->shape ) { case sector_rgn: case panda_rgn: coords[2] += (wcs->rot); coords[3] += (wcs->rot); break; case box_rgn: case rectangle_rgn: case diamond_rgn: case ellipse_rgn: coords[4] += (wcs->rot); break; case boxannulus_rgn: case elliptannulus_rgn: coords[6] += (wcs->rot); coords[7] += (wcs->rot); break; case epanda_rgn: case bpanda_rgn: coords[2] += (wcs->rot); coords[3] += (wcs->rot); coords[10] += (wcs->rot); } } /* do some precalculations to speed up tests */ fits_setup_shape(newShape); } /* End of while( *currLoc ) */ /* if (coords)printf("%.8f %.8f %.8f %.8f %.8f\n", coords[0],coords[1],coords[2],coords[3],coords[4]); */ } /* End of if...else parse line */ } /* End of while( fgets(rgnFile) ) */ /* set up component numbers */ fits_set_region_components( aRgn ); error: if( *status ) { fits_free_region( aRgn ); } else { *Rgn = aRgn; } fclose( rgnFile ); free( currLine ); return( *status ); } /*---------------------------------------------------------------------------*/ int fits_in_region( double X, double Y, SAORegion *Rgn ) /* Test if the given point is within the region described by Rgn. X and */ /* Y are in pixel coordinates. */ /*---------------------------------------------------------------------------*/ { double x, y, dx, dy, xprime, yprime, r, th; RgnShape *Shapes; int i, cur_comp; int result, comp_result; Shapes = Rgn->Shapes; result = 0; comp_result = 0; cur_comp = Rgn->Shapes[0].comp; for( i=0; inShapes; i++, Shapes++ ) { /* if this region has a different component number to the last one */ /* then replace the accumulated selection logical with the union of */ /* the current logical and the total logical. Reinitialize the */ /* temporary logical. */ if ( i==0 || Shapes->comp != cur_comp ) { result = result || comp_result; cur_comp = Shapes->comp; /* if an excluded region is given first, then implicitly */ /* assume a previous shape that includes the entire image. */ comp_result = !Shapes->sign; } /* only need to test if */ /* the point is not already included and this is an include region, */ /* or the point is included and this is an excluded region */ if ( (!comp_result && Shapes->sign) || (comp_result && !Shapes->sign) ) { comp_result = 1; switch( Shapes->shape ) { case box_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; dx = 0.5 * Shapes->param.gen.p[2]; dy = 0.5 * Shapes->param.gen.p[3]; if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) ) comp_result = 0; break; case boxannulus_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; dx = 0.5 * Shapes->param.gen.p[4]; dy = 0.5 * Shapes->param.gen.p[5]; if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) ) { comp_result = 0; } else { /* Repeat test for inner box */ x = xprime * Shapes->param.gen.b + yprime * Shapes->param.gen.a; y = -xprime * Shapes->param.gen.a + yprime * Shapes->param.gen.b; dx = 0.5 * Shapes->param.gen.p[2]; dy = 0.5 * Shapes->param.gen.p[3]; if( (x >= -dx) && (x <= dx) && (y >= -dy) && (y <= dy) ) comp_result = 0; } break; case rectangle_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[5]; yprime = Y - Shapes->param.gen.p[6]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; dx = Shapes->param.gen.a; dy = Shapes->param.gen.b; if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) ) comp_result = 0; break; case diamond_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; dx = 0.5 * Shapes->param.gen.p[2]; dy = 0.5 * Shapes->param.gen.p[3]; r = fabs(x/dx) + fabs(y/dy); if( r > 1 ) comp_result = 0; break; case circle_rgn: /* Shift origin to center of region */ x = X - Shapes->param.gen.p[0]; y = Y - Shapes->param.gen.p[1]; r = x*x + y*y; if ( r > Shapes->param.gen.a ) comp_result = 0; break; case annulus_rgn: /* Shift origin to center of region */ x = X - Shapes->param.gen.p[0]; y = Y - Shapes->param.gen.p[1]; r = x*x + y*y; if ( r < Shapes->param.gen.a || r > Shapes->param.gen.b ) comp_result = 0; break; case sector_rgn: /* Shift origin to center of region */ x = X - Shapes->param.gen.p[0]; y = Y - Shapes->param.gen.p[1]; if( x || y ) { r = atan2( y, x ) * RadToDeg; if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) { if( r < Shapes->param.gen.p[2] || r > Shapes->param.gen.p[3] ) comp_result = 0; } else { if( r < Shapes->param.gen.p[2] && r > Shapes->param.gen.p[3] ) comp_result = 0; } } break; case ellipse_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; x /= Shapes->param.gen.p[2]; y /= Shapes->param.gen.p[3]; r = x*x + y*y; if( r>1.0 ) comp_result = 0; break; case elliptannulus_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to outer ellipse's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; x /= Shapes->param.gen.p[4]; y /= Shapes->param.gen.p[5]; r = x*x + y*y; if( r>1.0 ) comp_result = 0; else { /* Repeat test for inner ellipse */ x = xprime * Shapes->param.gen.b + yprime * Shapes->param.gen.a; y = -xprime * Shapes->param.gen.a + yprime * Shapes->param.gen.b; x /= Shapes->param.gen.p[2]; y /= Shapes->param.gen.p[3]; r = x*x + y*y; if( r<1.0 ) comp_result = 0; } break; case line_rgn: /* Shift origin to first point of line */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to line's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; if( (y < -0.5) || (y >= 0.5) || (x < -0.5) || (x >= Shapes->param.gen.a) ) comp_result = 0; break; case point_rgn: /* Shift origin to center of region */ x = X - Shapes->param.gen.p[0]; y = Y - Shapes->param.gen.p[1]; if ( (x<-0.5) || (x>=0.5) || (y<-0.5) || (y>=0.5) ) comp_result = 0; break; case poly_rgn: if( Xxmin || X>Shapes->xmax || Yymin || Y>Shapes->ymax ) comp_result = 0; else comp_result = Pt_in_Poly( X, Y, Shapes->param.poly.nPts, Shapes->param.poly.Pts ); break; case panda_rgn: /* Shift origin to center of region */ x = X - Shapes->param.gen.p[0]; y = Y - Shapes->param.gen.p[1]; r = x*x + y*y; if ( r < Shapes->param.gen.a || r > Shapes->param.gen.b ) { comp_result = 0; } else { if( x || y ) { th = atan2( y, x ) * RadToDeg; if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) { if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] ) comp_result = 0; } else { if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] ) comp_result = 0; } } } break; case epanda_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; xprime = x; yprime = y; /* outer region test */ x = xprime/Shapes->param.gen.p[7]; y = yprime/Shapes->param.gen.p[8]; r = x*x + y*y; if ( r>1.0 ) comp_result = 0; else { /* inner region test */ x = xprime/Shapes->param.gen.p[5]; y = yprime/Shapes->param.gen.p[6]; r = x*x + y*y; if ( r<1.0 ) comp_result = 0; else { /* angle test */ if( xprime || yprime ) { th = atan2( yprime, xprime ) * RadToDeg; if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) { if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] ) comp_result = 0; } else { if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] ) comp_result = 0; } } } } break; case bpanda_rgn: /* Shift origin to center of region */ xprime = X - Shapes->param.gen.p[0]; yprime = Y - Shapes->param.gen.p[1]; /* Rotate point to region's orientation */ x = xprime * Shapes->param.gen.cosT + yprime * Shapes->param.gen.sinT; y = -xprime * Shapes->param.gen.sinT + yprime * Shapes->param.gen.cosT; /* outer box test */ dx = 0.5 * Shapes->param.gen.p[7]; dy = 0.5 * Shapes->param.gen.p[8]; if( (x < -dx) || (x > dx) || (y < -dy) || (y > dy) ) comp_result = 0; else { /* inner box test */ dx = 0.5 * Shapes->param.gen.p[5]; dy = 0.5 * Shapes->param.gen.p[6]; if( (x >= -dx) && (x <= dx) && (y >= -dy) && (y <= dy) ) comp_result = 0; else { /* angle test */ if( x || y ) { th = atan2( y, x ) * RadToDeg; if( Shapes->param.gen.p[2] <= Shapes->param.gen.p[3] ) { if( th < Shapes->param.gen.p[2] || th > Shapes->param.gen.p[3] ) comp_result = 0; } else { if( th < Shapes->param.gen.p[2] && th > Shapes->param.gen.p[3] ) comp_result = 0; } } } } break; } if( !Shapes->sign ) comp_result = !comp_result; } } result = result || comp_result; return( result ); } /*---------------------------------------------------------------------------*/ void fits_free_region( SAORegion *Rgn ) /* Free up memory allocated to hold the region data. */ /*---------------------------------------------------------------------------*/ { int i; for( i=0; inShapes; i++ ) if( Rgn->Shapes[i].shape == poly_rgn ) free( Rgn->Shapes[i].param.poly.Pts ); if( Rgn->Shapes ) free( Rgn->Shapes ); free( Rgn ); } /*---------------------------------------------------------------------------*/ static int Pt_in_Poly( double x, double y, int nPts, double *Pts ) /* Internal routine for testing whether the coordinate x,y is within the */ /* polygon region traced out by the array Pts. */ /*---------------------------------------------------------------------------*/ { int i, j, flag=0; double prevX, prevY; double nextX, nextY; double dx, dy, Dy; nextX = Pts[nPts-2]; nextY = Pts[nPts-1]; for( i=0; iprevY && y>=nextY) || (yprevX && x>=nextX) ) continue; /* Check to see if x,y lies right on the segment */ if( x>=prevX || x>nextX ) { dy = y - prevY; Dy = nextY - prevY; if( fabs(Dy)<1e-10 ) { if( fabs(dy)<1e-10 ) return( 1 ); else continue; } dx = prevX + ( (nextX-prevX)/(Dy) ) * dy - x; if( dx < -1e-10 ) continue; if( dx < 1e-10 ) return( 1 ); } /* There is an intersection! Make sure it isn't a V point. */ if( y != prevY ) { flag = 1 - flag; } else { j = i+1; /* Point to Y component */ do { if( j>1 ) j -= 2; else j = nPts-1; } while( y == Pts[j] ); if( (nextY-y)*(y-Pts[j]) > 0 ) flag = 1-flag; } } return( flag ); } /*---------------------------------------------------------------------------*/ void fits_set_region_components ( SAORegion *aRgn ) { /* Internal routine to turn a collection of regions read from an ascii file into the more complex structure that is allowed by the FITS REGION extension with multiple components. Regions are anded within components and ored between them ie for a pixel to be selected it must be selected by at least one component and to be selected by a component it must be selected by all that component's shapes. The algorithm is to replicate every exclude region after every include region before it in the list. eg reg1, reg2, -reg3, reg4, -reg5 becomes (reg1, -reg3, -reg5), (reg2, -reg5, -reg3), (reg4, -reg5) where the parentheses designate components. */ int i, j, k, icomp; /* loop round shapes */ i = 0; while ( inShapes ) { /* first do the case of an exclude region */ if ( !aRgn->Shapes[i].sign ) { /* we need to run back through the list copying the current shape as required. start by findin the first include shape before this exclude */ j = i-1; while ( j > 0 && !aRgn->Shapes[j].sign ) j--; /* then go back one more shape */ j--; /* and loop back through the regions */ while ( j >= 0 ) { /* if this is an include region then insert a copy of the exclude region immediately after it */ if ( aRgn->Shapes[j].sign ) { aRgn->Shapes = (RgnShape *) realloc (aRgn->Shapes,(1+aRgn->nShapes)*sizeof(RgnShape)); aRgn->nShapes++; for (k=aRgn->nShapes-1; k>j+1; k--) aRgn->Shapes[k] = aRgn->Shapes[k-1]; i++; aRgn->Shapes[j+1] = aRgn->Shapes[i]; } j--; } } i++; } /* now set the component numbers */ icomp = 0; for ( i=0; inShapes; i++ ) { if ( aRgn->Shapes[i].sign ) icomp++; aRgn->Shapes[i].comp = icomp; /* printf("i = %d, shape = %d, sign = %d, comp = %d\n", i, aRgn->Shapes[i].shape, aRgn->Shapes[i].sign, aRgn->Shapes[i].comp); */ } return; } /*---------------------------------------------------------------------------*/ void fits_setup_shape ( RgnShape *newShape) { /* Perform some useful calculations now to speed up filter later */ double X, Y, R; double *coords; int i; if ( newShape->shape == poly_rgn ) { coords = newShape->param.poly.Pts; } else { coords = newShape->param.gen.p; } switch( newShape->shape ) { case circle_rgn: newShape->param.gen.a = coords[2] * coords[2]; break; case annulus_rgn: newShape->param.gen.a = coords[2] * coords[2]; newShape->param.gen.b = coords[3] * coords[3]; break; case sector_rgn: while( coords[2]> 180.0 ) coords[2] -= 360.0; while( coords[2]<=-180.0 ) coords[2] += 360.0; while( coords[3]> 180.0 ) coords[3] -= 360.0; while( coords[3]<=-180.0 ) coords[3] += 360.0; break; case ellipse_rgn: newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) ); break; case elliptannulus_rgn: newShape->param.gen.a = sin( myPI * (coords[6] / 180.0) ); newShape->param.gen.b = cos( myPI * (coords[6] / 180.0) ); newShape->param.gen.sinT = sin( myPI * (coords[7] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[7] / 180.0) ); break; case box_rgn: newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) ); break; case boxannulus_rgn: newShape->param.gen.a = sin( myPI * (coords[6] / 180.0) ); newShape->param.gen.b = cos( myPI * (coords[6] / 180.0) ); newShape->param.gen.sinT = sin( myPI * (coords[7] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[7] / 180.0) ); break; case rectangle_rgn: newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) ); X = 0.5 * ( coords[2]-coords[0] ); Y = 0.5 * ( coords[3]-coords[1] ); newShape->param.gen.a = fabs( X * newShape->param.gen.cosT + Y * newShape->param.gen.sinT ); newShape->param.gen.b = fabs( Y * newShape->param.gen.cosT - X * newShape->param.gen.sinT ); newShape->param.gen.p[5] = 0.5 * ( coords[2]+coords[0] ); newShape->param.gen.p[6] = 0.5 * ( coords[3]+coords[1] ); break; case diamond_rgn: newShape->param.gen.sinT = sin( myPI * (coords[4] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[4] / 180.0) ); break; case line_rgn: X = coords[2] - coords[0]; Y = coords[3] - coords[1]; R = sqrt( X*X + Y*Y ); newShape->param.gen.sinT = ( R ? Y/R : 0.0 ); newShape->param.gen.cosT = ( R ? X/R : 1.0 ); newShape->param.gen.a = R + 0.5; break; case panda_rgn: while( coords[2]> 180.0 ) coords[2] -= 360.0; while( coords[2]<=-180.0 ) coords[2] += 360.0; while( coords[3]> 180.0 ) coords[3] -= 360.0; while( coords[3]<=-180.0 ) coords[3] += 360.0; newShape->param.gen.a = newShape->param.gen.p[5]*newShape->param.gen.p[5]; newShape->param.gen.b = newShape->param.gen.p[6]*newShape->param.gen.p[6]; break; case epanda_rgn: case bpanda_rgn: while( coords[2]> 180.0 ) coords[2] -= 360.0; while( coords[2]<=-180.0 ) coords[2] += 360.0; while( coords[3]> 180.0 ) coords[3] -= 360.0; while( coords[3]<=-180.0 ) coords[3] += 360.0; newShape->param.gen.sinT = sin( myPI * (coords[10] / 180.0) ); newShape->param.gen.cosT = cos( myPI * (coords[10] / 180.0) ); break; } /* Set the xmin, xmax, ymin, ymax elements of the RgnShape structure */ /* For everything which has first two parameters as center position just */ /* find a circle that encompasses the region and use it to set the */ /* bounding box */ R = -1.0; switch ( newShape->shape ) { case circle_rgn: R = coords[2]; break; case annulus_rgn: R = coords[3]; break; case ellipse_rgn: if ( coords[2] > coords[3] ) { R = coords[2]; } else { R = coords[3]; } break; case elliptannulus_rgn: if ( coords[4] > coords[5] ) { R = coords[4]; } else { R = coords[5]; } break; case box_rgn: R = sqrt(coords[2]*coords[2]+ coords[3]*coords[3])/2.0; break; case boxannulus_rgn: R = sqrt(coords[4]*coords[5]+ coords[4]*coords[5])/2.0; break; case diamond_rgn: if ( coords[2] > coords[3] ) { R = coords[2]/2.0; } else { R = coords[3]/2.0; } break; case point_rgn: R = 1.0; break; case panda_rgn: R = coords[6]; break; case epanda_rgn: if ( coords[7] > coords[8] ) { R = coords[7]; } else { R = coords[8]; } break; case bpanda_rgn: R = sqrt(coords[7]*coords[8]+ coords[7]*coords[8])/2.0; break; } if ( R > 0.0 ) { newShape->xmin = coords[0] - R; newShape->xmax = coords[0] + R; newShape->ymin = coords[1] - R; newShape->ymax = coords[1] + R; return; } /* Now do the rest of the shapes that require individual methods */ switch ( newShape->shape ) { case rectangle_rgn: R = sqrt((coords[5]-coords[0])*(coords[5]-coords[0])+ (coords[6]-coords[1])*(coords[6]-coords[1])); newShape->xmin = coords[5] - R; newShape->xmax = coords[5] + R; newShape->ymin = coords[6] - R; newShape->ymax = coords[6] + R; break; case poly_rgn: newShape->xmin = coords[0]; newShape->xmax = coords[0]; newShape->ymin = coords[1]; newShape->ymax = coords[1]; for( i=2; i < newShape->param.poly.nPts; ) { if( newShape->xmin > coords[i] ) /* Min X */ newShape->xmin = coords[i]; if( newShape->xmax < coords[i] ) /* Max X */ newShape->xmax = coords[i]; i++; if( newShape->ymin > coords[i] ) /* Min Y */ newShape->ymin = coords[i]; if( newShape->ymax < coords[i] ) /* Max Y */ newShape->ymax = coords[i]; i++; } break; case line_rgn: if ( coords[0] > coords[2] ) { newShape->xmin = coords[2]; newShape->xmax = coords[0]; } else { newShape->xmin = coords[0]; newShape->xmax = coords[2]; } if ( coords[1] > coords[3] ) { newShape->ymin = coords[3]; newShape->ymax = coords[1]; } else { newShape->ymin = coords[1]; newShape->ymax = coords[3]; } break; /* sector doesn't have min and max so indicate by setting max < min */ case sector_rgn: newShape->xmin = 1.0; newShape->xmax = -1.0; newShape->ymin = 1.0; newShape->ymax = -1.0; break; } return; } /*---------------------------------------------------------------------------*/ int fits_read_fits_region ( fitsfile *fptr, WCSdata *wcs, SAORegion **Rgn, int *status) /* Read regions from a FITS region extension and return the information */ /* in the "SAORegion" structure. If it is nonNULL, use wcs to convert the */ /* region coordinates to pixels. Return an error if region is in degrees */ /* but no WCS data is provided. */ /*---------------------------------------------------------------------------*/ { int i, j, icol[6], idum, anynul, npos; int dotransform, got_component = 1, tstatus; long icsize[6]; double X, Y, Theta, Xsave, Ysave, Xpos, Ypos; double *coords; char *cvalue, *cvalue2; char comment[FLEN_COMMENT]; char colname[6][FLEN_VALUE] = {"X", "Y", "SHAPE", "R", "ROTANG", "COMPONENT"}; char shapename[17][FLEN_VALUE] = {"POINT","CIRCLE","ELLIPSE","ANNULUS", "ELLIPTANNULUS","BOX","ROTBOX","BOXANNULUS", "RECTANGLE","ROTRECTANGLE","POLYGON","PIE", "SECTOR","DIAMOND","RHOMBUS","ROTDIAMOND", "ROTRHOMBUS"}; int shapetype[17] = {point_rgn, circle_rgn, ellipse_rgn, annulus_rgn, elliptannulus_rgn, box_rgn, box_rgn, boxannulus_rgn, rectangle_rgn, rectangle_rgn, poly_rgn, sector_rgn, sector_rgn, diamond_rgn, diamond_rgn, diamond_rgn, diamond_rgn}; SAORegion *aRgn; RgnShape *newShape; WCSdata *regwcs; if ( *status ) return( *status ); aRgn = (SAORegion *)malloc( sizeof(SAORegion) ); if( ! aRgn ) { ffpmsg("Couldn't allocate memory to hold Region file contents."); return(*status = MEMORY_ALLOCATION ); } aRgn->nShapes = 0; aRgn->Shapes = NULL; if( wcs && wcs->exists ) aRgn->wcs = *wcs; else aRgn->wcs.exists = 0; /* See if we are already positioned to a region extension, else */ /* move to the REGION extension (file is already open). */ tstatus = 0; for (i=0; i<5; i++) { ffgcno(fptr, CASEINSEN, colname[i], &icol[i], &tstatus); } if (tstatus) { /* couldn't find the required columns, so search for "REGION" extension */ if ( ffmnhd(fptr, BINARY_TBL, "REGION", 1, status) ) { ffpmsg("Could not move to REGION extension."); goto error; } } /* get the number of shapes and allocate memory */ if ( ffgky(fptr, TINT, "NAXIS2", &aRgn->nShapes, comment, status) ) { ffpmsg("Could not read NAXIS2 keyword."); goto error; } aRgn->Shapes = (RgnShape *) malloc(aRgn->nShapes * sizeof(RgnShape)); if ( !aRgn->Shapes ) { ffpmsg( "Failed to allocate memory for Region data"); *status = MEMORY_ALLOCATION; goto error; } /* get the required column numbers */ for (i=0; i<5; i++) { if ( ffgcno(fptr, CASEINSEN, colname[i], &icol[i], status) ) { ffpmsg("Could not find column."); goto error; } } /* try to get the optional column numbers */ if ( ffgcno(fptr, CASEINSEN, colname[5], &icol[5], status) ) { got_component = 0; } /* if there was input WCS then read the WCS info for the region in case they */ /* are different and we have to transform */ dotransform = 0; if ( aRgn->wcs.exists ) { regwcs = (WCSdata *) malloc ( sizeof(WCSdata) ); if ( !regwcs ) { ffpmsg( "Failed to allocate memory for Region WCS data"); *status = MEMORY_ALLOCATION; goto error; } regwcs->exists = 1; if ( ffgtcs(fptr, icol[0], icol[1], ®wcs->xrefval, ®wcs->yrefval, ®wcs->xrefpix, ®wcs->yrefpix, ®wcs->xinc, ®wcs->yinc, ®wcs->rot, regwcs->type, status) ) { regwcs->exists = 0; *status = 0; } if ( regwcs->exists && wcs->exists ) { if ( fabs(regwcs->xrefval-wcs->xrefval) > 1.0e-6 || fabs(regwcs->yrefval-wcs->yrefval) > 1.0e-6 || fabs(regwcs->xrefpix-wcs->xrefpix) > 1.0e-6 || fabs(regwcs->yrefpix-wcs->yrefpix) > 1.0e-6 || fabs(regwcs->xinc-wcs->xinc) > 1.0e-6 || fabs(regwcs->yinc-wcs->yinc) > 1.0e-6 || fabs(regwcs->rot-wcs->rot) > 1.0e-6 || !strcmp(regwcs->type,wcs->type) ) dotransform = 1; } } /* get the sizes of the X, Y, R, and ROTANG vectors */ for (i=0; i<6; i++) { if ( ffgtdm(fptr, icol[i], 1, &idum, &icsize[i], status) ) { ffpmsg("Could not find vector size of column."); goto error; } } cvalue = (char *) malloc ((FLEN_VALUE+1)*sizeof(char)); /* loop over the shapes - note 1-based counting for rows in FITS files */ for (i=1; i<=aRgn->nShapes; i++) { newShape = &aRgn->Shapes[i-1]; for (j=0; j<8; j++) newShape->param.gen.p[j] = 0.0; newShape->param.gen.a = 0.0; newShape->param.gen.b = 0.0; newShape->param.gen.sinT = 0.0; newShape->param.gen.cosT = 0.0; /* get the shape */ if ( ffgcvs(fptr, icol[2], i, 1, 1, " ", &cvalue, &anynul, status) ) { ffpmsg("Could not read shape."); goto error; } /* set include or exclude */ newShape->sign = 1; cvalue2 = cvalue; if ( !strncmp(cvalue,"!",1) ) { newShape->sign = 0; cvalue2++; } /* set the shape type */ for (j=0; j<9; j++) { if ( !strcmp(cvalue2, shapename[j]) ) newShape->shape = shapetype[j]; } /* allocate memory for polygon case and set coords pointer */ if ( newShape->shape == poly_rgn ) { newShape->param.poly.Pts = (double *) calloc (2*icsize[0], sizeof(double)); if ( !newShape->param.poly.Pts ) { ffpmsg("Could not allocate memory to hold polygon parameters" ); *status = MEMORY_ALLOCATION; goto error; } newShape->param.poly.nPts = 2*icsize[0]; coords = newShape->param.poly.Pts; } else { coords = newShape->param.gen.p; } /* read X and Y. Polygon and Rectangle require special cases */ npos = 1; if ( newShape->shape == poly_rgn ) npos = newShape->param.poly.nPts/2; if ( newShape->shape == rectangle_rgn ) npos = 2; for (j=0; jparam.poly.nPts = npos * 2; break; } coords++; if ( ffgcvd(fptr, icol[1], i, j+1, 1, DOUBLENULLVALUE, coords, &anynul, status) ) { ffpmsg("Failed to read Y column for polygon region"); goto error; } if (*coords == DOUBLENULLVALUE) { /* check for null value end of array marker */ npos = j; newShape->param.poly.nPts = npos * 2; coords--; break; } coords++; if (j == 0) { /* save the first X and Y coordinate */ Xsave = *(coords - 2); Ysave = *(coords - 1); } else if ((Xsave == *(coords - 2)) && (Ysave == *(coords - 1)) ) { /* if point has same coordinate as first point, this marks the end of the array */ npos = j + 1; newShape->param.poly.nPts = npos * 2; break; } } /* transform positions if the region and input wcs differ */ if ( dotransform ) { coords -= npos*2; Xsave = coords[0]; Ysave = coords[1]; for (j=0; jxrefval, regwcs->yrefval, regwcs->xrefpix, regwcs->yrefpix, regwcs->xinc, regwcs->yinc, regwcs->rot, regwcs->type, &Xpos, &Ypos, status); ffxypx(Xpos, Ypos, wcs->xrefval, wcs->yrefval, wcs->xrefpix, wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot, wcs->type, &coords[2*j], &coords[2*j+1], status); if ( *status ) { ffpmsg("Failed to transform coordinates"); goto error; } } coords += npos*2; } /* read R. Circle requires one number; Box, Diamond, Ellipse, Annulus, Sector and Panda two; Boxannulus and Elliptannulus four; Point, Rectangle and Polygon none. */ npos = 0; switch ( newShape->shape ) { case circle_rgn: npos = 1; break; case box_rgn: case diamond_rgn: case ellipse_rgn: case annulus_rgn: case sector_rgn: npos = 2; break; case boxannulus_rgn: case elliptannulus_rgn: npos = 4; break; } if ( npos > 0 ) { if ( ffgcvd(fptr, icol[3], i, 1, npos, 0.0, coords, &anynul, status) ) { ffpmsg("Failed to read R column for region"); goto error; } /* transform lengths if the region and input wcs differ */ if ( dotransform ) { for (j=0; jxrefval, regwcs->yrefval, regwcs->xrefpix, regwcs->yrefpix, regwcs->xinc, regwcs->yinc, regwcs->rot, regwcs->type, &Xpos, &Ypos, status); ffxypx(Xpos, Ypos, wcs->xrefval, wcs->yrefval, wcs->xrefpix, wcs->yrefpix, wcs->xinc, wcs->yinc, wcs->rot, wcs->type, &X, &Y, status); if ( *status ) { ffpmsg("Failed to transform coordinates"); goto error; } *(coords++) = sqrt(pow(X-newShape->param.gen.p[0],2)+pow(Y-newShape->param.gen.p[1],2)); } } else { coords += npos; } } /* read ROTANG. Requires two values for Boxannulus, Elliptannulus, Sector, Panda; one for Box, Diamond, Ellipse; and none for Circle, Point, Annulus, Rectangle, Polygon */ npos = 0; switch ( newShape->shape ) { case box_rgn: case diamond_rgn: case ellipse_rgn: npos = 1; break; case boxannulus_rgn: case elliptannulus_rgn: case sector_rgn: npos = 2; break; } if ( npos > 0 ) { if ( ffgcvd(fptr, icol[4], i, 1, npos, 0.0, coords, &anynul, status) ) { ffpmsg("Failed to read ROTANG column for region"); goto error; } /* transform angles if the region and input wcs differ */ if ( dotransform ) { Theta = (wcs->rot) - (regwcs->rot); for (j=0; jcomp, &anynul, status) ) { ffpmsg("Failed to read COMPONENT column for region"); goto error; } } else { newShape->comp = 1; } /* do some precalculations to speed up tests */ fits_setup_shape(newShape); /* end loop over shapes */ } error: if( *status ) fits_free_region( aRgn ); else *Rgn = aRgn; ffclos(fptr, status); return( *status ); } astropy-0.3/cextern/cfitsio/buffers.c0000644000175000017500000014745612243255342016130 0ustar oleole/* This file, buffers.c, contains the core set of FITSIO routines */ /* that use or manage the internal set of IO buffers. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffmbyt(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG bytepos, /* I - byte position in file to move to */ int err_mode, /* I - 1=ignore error, 0 = return error */ int *status) /* IO - error status */ { /* Move to the input byte location in the file. When writing to a file, a move may sometimes be made to a position beyond the current EOF. The err_mode parameter determines whether such conditions should be returned as an error or simply ignored. */ long record; if (*status > 0) return(*status); if (bytepos < 0) return(*status = NEG_FILE_POS); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); record = (long) (bytepos / IOBUFLEN); /* zero-indexed record number */ /* if this is not the current record, then load it */ if ( ((fptr->Fptr)->curbuf < 0) || (record != (fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf])) ffldrc(fptr, record, err_mode, status); if (*status <= 0) (fptr->Fptr)->bytepos = bytepos; /* save new file position */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpbyt(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG nbytes, /* I - number of bytes to write */ void *buffer, /* I - buffer containing the bytes to write */ int *status) /* IO - error status */ /* put (write) the buffer of bytes to the output FITS file, starting at the current file position. Write large blocks of data directly to disk; write smaller segments to intermediate IO buffers to improve efficiency. */ { int ii, nbuff; LONGLONG filepos; long recstart, recend; long ntodo, bufpos, nspace, nwrite; char *cptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); cptr = (char *)buffer; ntodo = (long) nbytes; if ((fptr->Fptr)->curbuf < 0) /* no current data buffer for this file */ { /* so reload the last one that was used */ ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status); } if (nbytes >= MINDIRECT) { /* write large blocks of data directly to disk instead of via buffers */ /* first, fill up the current IO buffer before flushing it to disk */ nbuff = (fptr->Fptr)->curbuf; /* current IO buffer number */ filepos = (fptr->Fptr)->bytepos; /* save the write starting position */ recstart = (fptr->Fptr)->bufrecnum[nbuff]; /* starting record */ recend = (long) ((filepos + nbytes - 1) / IOBUFLEN); /* ending record */ /* bufpos is the starting position within the IO buffer */ bufpos = (long) (filepos - ((LONGLONG)recstart * IOBUFLEN)); nspace = IOBUFLEN - bufpos; /* amount of space left in the buffer */ if (nspace) { /* fill up the IO buffer */ memcpy((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN) + bufpos, cptr, nspace); ntodo -= nspace; /* decrement remaining number of bytes */ cptr += nspace; /* increment user buffer pointer */ filepos += nspace; /* increment file position pointer */ (fptr->Fptr)->dirty[nbuff] = TRUE; /* mark record as having been modified */ } for (ii = 0; ii < NIOBUF; ii++) /* flush any affected buffers to disk */ { if ((fptr->Fptr)->bufrecnum[ii] >= recstart && (fptr->Fptr)->bufrecnum[ii] <= recend ) { if ((fptr->Fptr)->dirty[ii]) /* flush modified buffer to disk */ ffbfwt(fptr->Fptr, ii, status); (fptr->Fptr)->bufrecnum[ii] = -1; /* disassociate buffer from the file */ } } /* move to the correct write position */ if ((fptr->Fptr)->io_pos != filepos) ffseek(fptr->Fptr, filepos); nwrite = ((ntodo - 1) / IOBUFLEN) * IOBUFLEN; /* don't write last buff */ ffwrite(fptr->Fptr, nwrite, cptr, status); /* write the data */ ntodo -= nwrite; /* decrement remaining number of bytes */ cptr += nwrite; /* increment user buffer pointer */ (fptr->Fptr)->io_pos = filepos + nwrite; /* update the file position */ if ((fptr->Fptr)->io_pos >= (fptr->Fptr)->filesize) /* at the EOF? */ { (fptr->Fptr)->filesize = (fptr->Fptr)->io_pos; /* increment file size */ /* initialize the current buffer with the correct fill value */ if ((fptr->Fptr)->hdutype == ASCII_TBL) memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 32, IOBUFLEN); /* blank fill */ else memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 0, IOBUFLEN); /* zero fill */ } else { /* read next record */ ffread(fptr->Fptr, IOBUFLEN, (fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), status); (fptr->Fptr)->io_pos += IOBUFLEN; } /* copy remaining bytes from user buffer into current IO buffer */ memcpy((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), cptr, ntodo); (fptr->Fptr)->dirty[nbuff] = TRUE; /* mark record as having been modified */ (fptr->Fptr)->bufrecnum[nbuff] = recend; /* record number */ (fptr->Fptr)->logfilesize = maxvalue((fptr->Fptr)->logfilesize, (LONGLONG)(recend + 1) * IOBUFLEN); (fptr->Fptr)->bytepos = filepos + nwrite + ntodo; } else { /* bufpos is the starting position in IO buffer */ bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)(fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf] * IOBUFLEN)); nspace = IOBUFLEN - bufpos; /* amount of space left in the buffer */ while (ntodo) { nwrite = minvalue(ntodo, nspace); /* copy bytes from user's buffer to the IO buffer */ memcpy((fptr->Fptr)->iobuffer + ((fptr->Fptr)->curbuf * IOBUFLEN) + bufpos, cptr, nwrite); ntodo -= nwrite; /* decrement remaining number of bytes */ cptr += nwrite; (fptr->Fptr)->bytepos += nwrite; /* increment file position pointer */ (fptr->Fptr)->dirty[(fptr->Fptr)->curbuf] = TRUE; /* mark record as modified */ if (ntodo) /* load next record into a buffer */ { ffldrc(fptr, (long) ((fptr->Fptr)->bytepos / IOBUFLEN), IGNORE_EOF, status); bufpos = 0; nspace = IOBUFLEN; } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffpbytoff(fitsfile *fptr, /* I - FITS file pointer */ long gsize, /* I - size of each group of bytes */ long ngroups, /* I - number of groups to write */ long offset, /* I - size of gap between groups */ void *buffer, /* I - buffer to be written */ int *status) /* IO - error status */ /* put (write) the buffer of bytes to the output FITS file, with an offset between each group of bytes. This function combines ffmbyt and ffpbyt for increased efficiency. */ { int bcurrent; long ii, bufpos, nspace, nwrite, record; char *cptr, *ioptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->curbuf < 0) /* no current data buffer for this file */ { /* so reload the last one that was used */ ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status); } cptr = (char *)buffer; bcurrent = (fptr->Fptr)->curbuf; /* number of the current IO buffer */ record = (fptr->Fptr)->bufrecnum[bcurrent]; /* zero-indexed record number */ bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)record * IOBUFLEN)); /* start pos */ nspace = IOBUFLEN - bufpos; /* amount of space left in buffer */ ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos; for (ii = 1; ii < ngroups; ii++) /* write all but the last group */ { /* copy bytes from user's buffer to the IO buffer */ nwrite = minvalue(gsize, nspace); memcpy(ioptr, cptr, nwrite); cptr += nwrite; /* increment buffer pointer */ if (nwrite < gsize) /* entire group did not fit */ { (fptr->Fptr)->dirty[bcurrent] = TRUE; /* mark record as having been modified */ record++; ffldrc(fptr, record, IGNORE_EOF, status); /* load next record */ bcurrent = (fptr->Fptr)->curbuf; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN); nwrite = gsize - nwrite; memcpy(ioptr, cptr, nwrite); cptr += nwrite; /* increment buffer pointer */ ioptr += (offset + nwrite); /* increment IO buffer pointer */ nspace = IOBUFLEN - offset - nwrite; /* amount of space left */ } else { ioptr += (offset + nwrite); /* increment IO bufer pointer */ nspace -= (offset + nwrite); } if (nspace <= 0) /* beyond current record? */ { (fptr->Fptr)->dirty[bcurrent] = TRUE; record += ((IOBUFLEN - nspace) / IOBUFLEN); /* new record number */ ffldrc(fptr, record, IGNORE_EOF, status); bcurrent = (fptr->Fptr)->curbuf; bufpos = (-nspace) % IOBUFLEN; /* starting buffer pos */ nspace = IOBUFLEN - bufpos; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos; } } /* now write the last group */ nwrite = minvalue(gsize, nspace); memcpy(ioptr, cptr, nwrite); cptr += nwrite; /* increment buffer pointer */ if (nwrite < gsize) /* entire group did not fit */ { (fptr->Fptr)->dirty[bcurrent] = TRUE; /* mark record as having been modified */ record++; ffldrc(fptr, record, IGNORE_EOF, status); /* load next record */ bcurrent = (fptr->Fptr)->curbuf; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN); nwrite = gsize - nwrite; memcpy(ioptr, cptr, nwrite); } (fptr->Fptr)->dirty[bcurrent] = TRUE; /* mark record as having been modified */ (fptr->Fptr)->bytepos = (fptr->Fptr)->bytepos + (ngroups * gsize) + (ngroups - 1) * offset; return(*status); } /*--------------------------------------------------------------------------*/ int ffgbyt(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG nbytes, /* I - number of bytes to read */ void *buffer, /* O - buffer to read into */ int *status) /* IO - error status */ /* get (read) the requested number of bytes from the file, starting at the current file position. Read large blocks of data directly from disk; read smaller segments via intermediate IO buffers to improve efficiency. */ { int ii; LONGLONG filepos; long recstart, recend, ntodo, bufpos, nspace, nread; char *cptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); cptr = (char *)buffer; if (nbytes >= MINDIRECT) { /* read large blocks of data directly from disk instead of via buffers */ filepos = (fptr->Fptr)->bytepos; /* save the read starting position */ /* note that in this case, ffmbyt has not been called, and so */ /* bufrecnum[(fptr->Fptr)->curbuf] does not point to the intended */ /* output buffer */ recstart = (long) (filepos / IOBUFLEN); /* starting record */ recend = (long) ((filepos + nbytes - 1) / IOBUFLEN); /* ending record */ for (ii = 0; ii < NIOBUF; ii++) /* flush any affected buffers to disk */ { if ((fptr->Fptr)->dirty[ii] && (fptr->Fptr)->bufrecnum[ii] >= recstart && (fptr->Fptr)->bufrecnum[ii] <= recend) { ffbfwt(fptr->Fptr, ii, status); /* flush modified buffer to disk */ } } /* move to the correct read position */ if ((fptr->Fptr)->io_pos != filepos) ffseek(fptr->Fptr, filepos); ffread(fptr->Fptr, (long) nbytes, cptr, status); /* read the data */ (fptr->Fptr)->io_pos = filepos + nbytes; /* update the file position */ } else { /* read small chucks of data using the IO buffers for efficiency */ if ((fptr->Fptr)->curbuf < 0) /* no current data buffer for this file */ { /* so reload the last one that was used */ ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status); } /* bufpos is the starting position in IO buffer */ bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)(fptr->Fptr)->bufrecnum[(fptr->Fptr)->curbuf] * IOBUFLEN)); nspace = IOBUFLEN - bufpos; /* amount of space left in the buffer */ ntodo = (long) nbytes; while (ntodo) { nread = minvalue(ntodo, nspace); /* copy bytes from IO buffer to user's buffer */ memcpy(cptr, (fptr->Fptr)->iobuffer + ((fptr->Fptr)->curbuf * IOBUFLEN) + bufpos, nread); ntodo -= nread; /* decrement remaining number of bytes */ cptr += nread; (fptr->Fptr)->bytepos += nread; /* increment file position pointer */ if (ntodo) /* load next record into a buffer */ { ffldrc(fptr, (long) ((fptr->Fptr)->bytepos / IOBUFLEN), REPORT_EOF, status); bufpos = 0; nspace = IOBUFLEN; } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgbytoff(fitsfile *fptr, /* I - FITS file pointer */ long gsize, /* I - size of each group of bytes */ long ngroups, /* I - number of groups to read */ long offset, /* I - size of gap between groups (may be < 0) */ void *buffer, /* I - buffer to be filled */ int *status) /* IO - error status */ /* get (read) the requested number of bytes from the file, starting at the current file position. This function combines ffmbyt and ffgbyt for increased efficiency. */ { int bcurrent; long ii, bufpos, nspace, nread, record; char *cptr, *ioptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->curbuf < 0) /* no current data buffer for this file */ { /* so reload the last one that was used */ ffldrc(fptr, (long) (((fptr->Fptr)->bytepos) / IOBUFLEN), REPORT_EOF, status); } cptr = (char *)buffer; bcurrent = (fptr->Fptr)->curbuf; /* number of the current IO buffer */ record = (fptr->Fptr)->bufrecnum[bcurrent]; /* zero-indexed record number */ bufpos = (long) ((fptr->Fptr)->bytepos - ((LONGLONG)record * IOBUFLEN)); /* start pos */ nspace = IOBUFLEN - bufpos; /* amount of space left in buffer */ ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos; for (ii = 1; ii < ngroups; ii++) /* read all but the last group */ { /* copy bytes from IO buffer to the user's buffer */ nread = minvalue(gsize, nspace); memcpy(cptr, ioptr, nread); cptr += nread; /* increment buffer pointer */ if (nread < gsize) /* entire group did not fit */ { record++; ffldrc(fptr, record, REPORT_EOF, status); /* load next record */ bcurrent = (fptr->Fptr)->curbuf; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN); nread = gsize - nread; memcpy(cptr, ioptr, nread); cptr += nread; /* increment buffer pointer */ ioptr += (offset + nread); /* increment IO buffer pointer */ nspace = IOBUFLEN - offset - nread; /* amount of space left */ } else { ioptr += (offset + nread); /* increment IO bufer pointer */ nspace -= (offset + nread); } if (nspace <= 0 || nspace > IOBUFLEN) /* beyond current record? */ { if (nspace <= 0) { record += ((IOBUFLEN - nspace) / IOBUFLEN); /* new record number */ bufpos = (-nspace) % IOBUFLEN; /* starting buffer pos */ } else { record -= ((nspace - 1 ) / IOBUFLEN); /* new record number */ bufpos = IOBUFLEN - (nspace % IOBUFLEN); /* starting buffer pos */ } ffldrc(fptr, record, REPORT_EOF, status); bcurrent = (fptr->Fptr)->curbuf; nspace = IOBUFLEN - bufpos; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN) + bufpos; } } /* now read the last group */ nread = minvalue(gsize, nspace); memcpy(cptr, ioptr, nread); cptr += nread; /* increment buffer pointer */ if (nread < gsize) /* entire group did not fit */ { record++; ffldrc(fptr, record, REPORT_EOF, status); /* load next record */ bcurrent = (fptr->Fptr)->curbuf; ioptr = (fptr->Fptr)->iobuffer + (bcurrent * IOBUFLEN); nread = gsize - nread; memcpy(cptr, ioptr, nread); } (fptr->Fptr)->bytepos = (fptr->Fptr)->bytepos + (ngroups * gsize) + (ngroups - 1) * offset; return(*status); } /*--------------------------------------------------------------------------*/ int ffldrc(fitsfile *fptr, /* I - FITS file pointer */ long record, /* I - record number to be loaded */ int err_mode, /* I - 1=ignore EOF, 0 = return EOF error */ int *status) /* IO - error status */ { /* low-level routine to load a specified record from a file into a physical buffer, if it is not already loaded. Reset all pointers to make this the new current record for that file. Update ages of all the physical buffers. */ int ibuff, nbuff; LONGLONG rstart; /* check if record is already loaded in one of the buffers */ /* search from youngest to oldest buffer for efficiency */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); for (ibuff = NIOBUF - 1; ibuff >= 0; ibuff--) { nbuff = (fptr->Fptr)->ageindex[ibuff]; if (record == (fptr->Fptr)->bufrecnum[nbuff]) { goto updatebuf; /* use 'goto' for efficiency */ } } /* record is not already loaded */ rstart = (LONGLONG)record * IOBUFLEN; if ( !err_mode && (rstart >= (fptr->Fptr)->logfilesize) ) /* EOF? */ return(*status = END_OF_FILE); if (ffwhbf(fptr, &nbuff) < 0) /* which buffer should we reuse? */ return(*status = TOO_MANY_FILES); if ((fptr->Fptr)->dirty[nbuff]) ffbfwt(fptr->Fptr, nbuff, status); /* write dirty buffer to disk */ if (rstart >= (fptr->Fptr)->filesize) /* EOF? */ { /* initialize an empty buffer with the correct fill value */ if ((fptr->Fptr)->hdutype == ASCII_TBL) memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 32, IOBUFLEN); /* blank fill */ else memset((fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), 0, IOBUFLEN); /* zero fill */ (fptr->Fptr)->logfilesize = maxvalue((fptr->Fptr)->logfilesize, rstart + IOBUFLEN); (fptr->Fptr)->dirty[nbuff] = TRUE; /* mark record as having been modified */ } else /* not EOF, so read record from disk */ { if ((fptr->Fptr)->io_pos != rstart) ffseek(fptr->Fptr, rstart); ffread(fptr->Fptr, IOBUFLEN, (fptr->Fptr)->iobuffer + (nbuff * IOBUFLEN), status); (fptr->Fptr)->io_pos = rstart + IOBUFLEN; /* set new IO position */ } (fptr->Fptr)->bufrecnum[nbuff] = record; /* record number contained in buffer */ updatebuf: (fptr->Fptr)->curbuf = nbuff; /* this is the current buffer for this file */ if (ibuff < 0) { /* find the current position of the buffer in the age index */ for (ibuff = 0; ibuff < NIOBUF; ibuff++) if ((fptr->Fptr)->ageindex[ibuff] == nbuff) break; } /* increment the age of all the buffers that were younger than it */ for (ibuff++; ibuff < NIOBUF; ibuff++) (fptr->Fptr)->ageindex[ibuff - 1] = (fptr->Fptr)->ageindex[ibuff]; (fptr->Fptr)->ageindex[NIOBUF - 1] = nbuff; /* this is now the youngest buffer */ return(*status); } /*--------------------------------------------------------------------------*/ int ffwhbf(fitsfile *fptr, /* I - FITS file pointer */ int *nbuff) /* O - which buffer to use */ { /* decide which buffer to (re)use to hold a new file record */ return(*nbuff = (fptr->Fptr)->ageindex[0]); /* return oldest buffer */ } /*--------------------------------------------------------------------------*/ int ffflus(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Flush all the data in the current FITS file to disk. This ensures that if the program subsequently dies, the disk FITS file will be closed correctly. */ { int hdunum, hdutype; if (*status > 0) return(*status); ffghdn(fptr, &hdunum); /* get the current HDU number */ if (ffchdu(fptr,status) > 0) /* close out the current HDU */ ffpmsg("ffflus could not close the current HDU."); ffflsh(fptr, FALSE, status); /* flush any modified IO buffers to disk */ if (ffgext(fptr, hdunum - 1, &hdutype, status) > 0) /* reopen HDU */ ffpmsg("ffflus could not reopen the current HDU."); return(*status); } /*--------------------------------------------------------------------------*/ int ffflsh(fitsfile *fptr, /* I - FITS file pointer */ int clearbuf, /* I - also clear buffer contents? */ int *status) /* IO - error status */ { /* flush all dirty IO buffers associated with the file to disk */ int ii; /* no need to move to a different HDU if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); */ for (ii = 0; ii < NIOBUF; ii++) { /* flush modified buffer to disk */ if ((fptr->Fptr)->bufrecnum[ii] >= 0 &&(fptr->Fptr)->dirty[ii]) ffbfwt(fptr->Fptr, ii, status); if (clearbuf) (fptr->Fptr)->bufrecnum[ii] = -1; /* set contents of buffer as undefined */ } if (*status != READONLY_FILE) ffflushx(fptr->Fptr); /* flush system buffers to disk */ return(*status); } /*--------------------------------------------------------------------------*/ int ffbfeof(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ { /* clear any buffers beyond the end of file */ int ii; for (ii = 0; ii < NIOBUF; ii++) { if ( (LONGLONG) (fptr->Fptr)->bufrecnum[ii] * IOBUFLEN >= fptr->Fptr->filesize) { (fptr->Fptr)->bufrecnum[ii] = -1; /* set contents of buffer as undefined */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffbfwt(FITSfile *Fptr, /* I - FITS file pointer */ int nbuff, /* I - which buffer to write */ int *status) /* IO - error status */ { /* write contents of buffer to file; If the position of the buffer is beyond the current EOF, then the file may need to be extended with fill values, and/or with the contents of some of the other i/o buffers. */ int ii,ibuff; long jj, irec, minrec, nloop; LONGLONG filepos; static char zeros[IOBUFLEN]; /* initialized to zero by default */ if (!(Fptr->writemode) ) { ffpmsg("Error: trying to write to READONLY file."); if (Fptr->driver == 8) { /* gzip compressed file */ ffpmsg("Cannot write to a GZIP or COMPRESS compressed file."); } Fptr->dirty[nbuff] = FALSE; /* reset buffer status to prevent later probs */ *status = READONLY_FILE; return(*status); } filepos = (LONGLONG)Fptr->bufrecnum[nbuff] * IOBUFLEN; if (filepos <= Fptr->filesize) { /* record is located within current file, so just write it */ /* move to the correct write position */ if (Fptr->io_pos != filepos) ffseek(Fptr, filepos); ffwrite(Fptr, IOBUFLEN, Fptr->iobuffer + (nbuff * IOBUFLEN), status); Fptr->io_pos = filepos + IOBUFLEN; if (filepos == Fptr->filesize) /* appended new record? */ Fptr->filesize += IOBUFLEN; /* increment the file size */ Fptr->dirty[nbuff] = FALSE; } else /* if record is beyond the EOF, append any other records */ /* and/or insert fill values if necessary */ { /* move to EOF */ if (Fptr->io_pos != Fptr->filesize) ffseek(Fptr, Fptr->filesize); ibuff = NIOBUF; /* initialize to impossible value */ while(ibuff != nbuff) /* repeat until requested buffer is written */ { minrec = (long) (Fptr->filesize / IOBUFLEN); /* write lowest record beyond the EOF first */ irec = Fptr->bufrecnum[nbuff]; /* initially point to the requested buffer */ ibuff = nbuff; for (ii = 0; ii < NIOBUF; ii++) { if (Fptr->bufrecnum[ii] >= minrec && Fptr->bufrecnum[ii] < irec) { irec = Fptr->bufrecnum[ii]; /* found a lower record */ ibuff = ii; } } filepos = (LONGLONG)irec * IOBUFLEN; /* byte offset of record in file */ /* append 1 or more fill records if necessary */ if (filepos > Fptr->filesize) { nloop = (long) ((filepos - (Fptr->filesize)) / IOBUFLEN); for (jj = 0; jj < nloop && !(*status); jj++) ffwrite(Fptr, IOBUFLEN, zeros, status); /* ffseek(Fptr, filepos); */ Fptr->filesize = filepos; /* increment the file size */ } /* write the buffer itself */ ffwrite(Fptr, IOBUFLEN, Fptr->iobuffer + (ibuff * IOBUFLEN), status); Fptr->dirty[ibuff] = FALSE; Fptr->filesize += IOBUFLEN; /* increment the file size */ } /* loop back if more buffers need to be written */ Fptr->io_pos = Fptr->filesize; /* currently positioned at EOF */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffgrsz( fitsfile *fptr, /* I - FITS file pionter */ long *ndata, /* O - optimal amount of data to access */ int *status) /* IO - error status */ /* Returns an optimal value for the number of rows in a binary table or the number of pixels in an image that should be read or written at one time for maximum efficiency. Accessing more data than this may cause excessive flushing and rereading of buffers to/from disk. */ { int typecode, bytesperpixel; /* There are NIOBUF internal buffers available each IOBUFLEN bytes long. */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header to get hdu struct */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU ) /* calc pixels per buffer size */ { /* image pixels are in column 2 of the 'table' */ ffgtcl(fptr, 2, &typecode, NULL, NULL, status); bytesperpixel = typecode / 10; *ndata = ((NIOBUF - 1) * IOBUFLEN) / bytesperpixel; } else /* calc number of rows that fit in buffers */ { *ndata = (long) (((NIOBUF - 1) * IOBUFLEN) / maxvalue(1, (fptr->Fptr)->rowlength)); *ndata = maxvalue(1, *ndata); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgtbb(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstrow, /* I - starting row (1 = first row) */ LONGLONG firstchar, /* I - starting byte in row (1=first) */ LONGLONG nchars, /* I - number of bytes to read */ unsigned char *values, /* I - array of bytes to read */ int *status) /* IO - error status */ /* read a consecutive string of bytes from an ascii or binary table. This will span multiple rows of the table if nchars + firstchar is greater than the length of a row. */ { LONGLONG bytepos, endrow; if (*status > 0 || nchars <= 0) return(*status); else if (firstrow < 1) return(*status=BAD_ROW_NUM); else if (firstchar < 1) return(*status=BAD_ELEM_NUM); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* check that we do not exceed number of rows in the table */ endrow = ((firstchar + nchars - 2) / (fptr->Fptr)->rowlength) + firstrow; if (endrow > (fptr->Fptr)->numrows) { ffpmsg("attempt to read past end of table (ffgtbb)"); return(*status=BAD_ROW_NUM); } /* move the i/o pointer to the start of the sequence of characters */ bytepos = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * (firstrow - 1)) + firstchar - 1; ffmbyt(fptr, bytepos, REPORT_EOF, status); ffgbyt(fptr, nchars, values, status); /* read the bytes */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgi1b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ unsigned char *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { LONGLONG postemp; if (incre == 1) /* read all the values at once (contiguous bytes) */ { if (nvals < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 1, nvals, incre - 1, values, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgi2b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ short *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { LONGLONG postemp; if (incre == 2) /* read all the values at once (contiguous bytes) */ { if (nvals * 2 < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals * 2, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals * 2, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 2, nvals, incre - 2, values, status); } #if BYTESWAPPED ffswap2(values, nvals); /* reverse order of bytes in each value */ #endif return(*status); } /*--------------------------------------------------------------------------*/ int ffgi4b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ INT32BIT *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { LONGLONG postemp; if (incre == 4) /* read all the values at once (contiguous bytes) */ { if (nvals * 4 < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals * 4, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals * 4, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 4, nvals, incre - 4, values, status); } #if BYTESWAPPED ffswap4(values, nvals); /* reverse order of bytes in each value */ #endif return(*status); } /*--------------------------------------------------------------------------*/ int ffgi8b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ long *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! This routine reads 'nvals' 8-byte integers into 'values'. This works both on platforms that have sizeof(long) = 64, and 32, as long as 'values' has been allocated to large enough to hold 8 * nvals bytes of data. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ { LONGLONG postemp; if (incre == 8) /* read all the values at once (contiguous bytes) */ { if (nvals * 8 < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals * 8, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals * 8, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 8, nvals, incre - 8, values, status); } #if BYTESWAPPED ffswap8((double *) values, nvals); /* reverse bytes in each value */ #endif return(*status); } /*--------------------------------------------------------------------------*/ int ffgr4b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ float *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { LONGLONG postemp; #if MACHINE == VAXVMS long ii; #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) short *sptr; long ii; #endif if (incre == 4) /* read all the values at once (contiguous bytes) */ { if (nvals * 4 < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals * 4, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals * 4, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 4, nvals, incre - 4, values, status); } #if MACHINE == VAXVMS ii = nvals; /* call VAX macro routine to convert */ ieevur(values, values, &ii); /* from IEEE float -> F float */ #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) ffswap2( (short *) values, nvals * 2); /* swap pairs of bytes */ /* convert from IEEE float format to VMS GFLOAT float format */ sptr = (short *) values; for (ii = 0; ii < nvals; ii++, sptr += 2) { if (!fnan(*sptr) ) /* test for NaN or underflow */ values[ii] *= 4.0; } #elif BYTESWAPPED ffswap4((INT32BIT *)values, nvals); /* reverse order of bytes in values */ #endif return(*status); } /*--------------------------------------------------------------------------*/ int ffgr8b(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG byteloc, /* I - position within file to start reading */ long nvals, /* I - number of pixels to read */ long incre, /* I - byte increment between pixels */ double *values, /* O - returned array of values */ int *status) /* IO - error status */ /* get (read) the array of values from the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { LONGLONG postemp; #if MACHINE == VAXVMS long ii; #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) short *sptr; long ii; #endif if (incre == 8) /* read all the values at once (contiguous bytes) */ { if (nvals * 8 < MINDIRECT) /* read normally via IO buffers */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbyt(fptr, nvals * 8, values, status); } else /* read directly from disk, bypassing IO buffers */ { postemp = (fptr->Fptr)->bytepos; /* store current file position */ (fptr->Fptr)->bytepos = byteloc; /* set to the desired position */ ffgbyt(fptr, nvals * 8, values, status); (fptr->Fptr)->bytepos = postemp; /* reset to original position */ } } else /* have to read each value individually (not contiguous ) */ { ffmbyt(fptr, byteloc, REPORT_EOF, status); ffgbytoff(fptr, 8, nvals, incre - 8, values, status); } #if MACHINE == VAXVMS ii = nvals; /* call VAX macro routine to convert */ ieevud(values, values, &ii); /* from IEEE float -> D float */ #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) ffswap2( (short *) values, nvals * 4); /* swap pairs of bytes */ /* convert from IEEE float format to VMS GFLOAT float format */ sptr = (short *) values; for (ii = 0; ii < nvals; ii++, sptr += 4) { if (!dnan(*sptr) ) /* test for NaN or underflow */ values[ii] *= 4.0; } #elif BYTESWAPPED ffswap8(values, nvals); /* reverse order of bytes in each value */ #endif return(*status); } /*--------------------------------------------------------------------------*/ int ffptbb(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstrow, /* I - starting row (1 = first row) */ LONGLONG firstchar, /* I - starting byte in row (1=first) */ LONGLONG nchars, /* I - number of bytes to write */ unsigned char *values, /* I - array of bytes to write */ int *status) /* IO - error status */ /* write a consecutive string of bytes to an ascii or binary table. This will span multiple rows of the table if nchars + firstchar is greater than the length of a row. */ { LONGLONG bytepos, endrow, nrows; char message[81]; if (*status > 0 || nchars <= 0) return(*status); else if (firstrow < 1) return(*status=BAD_ROW_NUM); else if (firstchar < 1) return(*status=BAD_ELEM_NUM); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart < 0) /* rescan header if data undefined */ ffrdef(fptr, status); endrow = ((firstchar + nchars - 2) / (fptr->Fptr)->rowlength) + firstrow; /* check if we are writing beyond the current end of table */ if (endrow > (fptr->Fptr)->numrows) { /* if there are more HDUs following the current one, or */ /* if there is a data heap, then we must insert space */ /* for the new rows. */ if ( !((fptr->Fptr)->lasthdu) || (fptr->Fptr)->heapsize > 0) { nrows = endrow - ((fptr->Fptr)->numrows); /* ffirow also updates the heap address and numrows */ if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0) { sprintf(message, "ffptbb failed to add space for %.0f new rows in table.", (double) nrows); ffpmsg(message); return(*status); } } else { /* manally update heap starting address */ (fptr->Fptr)->heapstart += ((LONGLONG)(endrow - (fptr->Fptr)->numrows) * (fptr->Fptr)->rowlength ); (fptr->Fptr)->numrows = endrow; /* update number of rows */ } } /* move the i/o pointer to the start of the sequence of characters */ bytepos = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * (firstrow - 1)) + firstchar - 1; ffmbyt(fptr, bytepos, IGNORE_EOF, status); ffpbyt(fptr, nchars, values, status); /* write the bytes */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpi1b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ unsigned char *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { if (incre == 1) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 1, nvals, incre - 1, values, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpi2b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ short *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { #if BYTESWAPPED ffswap2(values, nvals); /* reverse order of bytes in each value */ #endif if (incre == 2) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals * 2, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 2, nvals, incre - 2, values, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpi4b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ INT32BIT *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { #if BYTESWAPPED ffswap4(values, nvals); /* reverse order of bytes in each value */ #endif if (incre == 4) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals * 4, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 4, nvals, incre - 4, values, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpi8b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ long *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! This routine writes 'nvals' 8-byte integers from 'values'. This works both on platforms that have sizeof(long) = 64, and 32, as long as 'values' has been allocated to large enough to hold 8 * nvals bytes of data. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ { #if BYTESWAPPED ffswap8((double *) values, nvals); /* reverse bytes in each value */ #endif if (incre == 8) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals * 8, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 8, nvals, incre - 8, values, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpr4b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ float *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { #if MACHINE == VAXVMS long ii; ii = nvals; /* call VAX macro routine to convert */ ieevpr(values, values, &ii); /* from F float -> IEEE float */ #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) long ii; /* convert from VMS FFLOAT float format to IEEE float format */ for (ii = 0; ii < nvals; ii++) values[ii] *= 0.25; ffswap2( (short *) values, nvals * 2); /* swap pairs of bytes */ #elif BYTESWAPPED ffswap4((INT32BIT *) values, nvals); /* reverse order of bytes in values */ #endif if (incre == 4) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals * 4, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 4, nvals, incre - 4, values, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpr8b(fitsfile *fptr, /* I - FITS file pointer */ long nvals, /* I - number of pixels in the values array */ long incre, /* I - byte increment between pixels */ double *values, /* I - array of values to write */ int *status) /* IO - error status */ /* put (write) the array of values to the FITS file, doing machine dependent format conversion (e.g. byte-swapping) if necessary. */ { #if MACHINE == VAXVMS long ii; ii = nvals; /* call VAX macro routine to convert */ ieevpd(values, values, &ii); /* from D float -> IEEE float */ #elif (MACHINE == ALPHAVMS) && (FLOATTYPE == GFLOAT) long ii; /* convert from VMS GFLOAT float format to IEEE float format */ for (ii = 0; ii < nvals; ii++) values[ii] *= 0.25; ffswap2( (short *) values, nvals * 4); /* swap pairs of bytes */ #elif BYTESWAPPED ffswap8(values, nvals); /* reverse order of bytes in each value */ #endif if (incre == 8) /* write all the values at once (contiguous bytes) */ ffpbyt(fptr, nvals * 8, values, status); else /* have to write each value individually (not contiguous ) */ ffpbytoff(fptr, 8, nvals, incre - 8, values, status); return(*status); } astropy-0.3/cextern/cfitsio/putcolb.c0000644000175000017500000010735112243255342016132 0ustar oleole/* This file, putcolb.c, contains routines that write data elements to */ /* a FITS image or table with char (byte) datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned char *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; unsigned char nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TBYTE, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpclb(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned char *array, /* I - array of values that are written */ unsigned char nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; unsigned char nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TBYTE, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnb(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2db(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3db(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3db(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; LONGLONG nfits, narray; long fpixel[3]= {1,1,1}, lpixel[3]; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TBYTE, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpclb(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpclb(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ unsigned char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TBYTE, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpclb(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ unsigned char *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpclb(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclb( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned char *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise, we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && tcode == TBYTE) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TBYTE): if (writeraw) { /* write raw input bytes without conversion */ ffpi1b(fptr, ntodo, incre, &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffi1fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); } break; case (TLONGLONG): ffi1fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TSHORT): ffi1fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TLONG): ffi1fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TFLOAT): ffi1fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffi1fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (strchr(tform,'A')) { /* write raw input bytes without conversion */ /* This case is a hack to let users write a stream */ /* of bytes directly to the 'A' format column */ if (incre == twidth) ffpbyt(fptr, ntodo, &array[next], status); else ffpbytoff(fptr, twidth, ntodo/twidth, incre - twidth, &array[next], status); break; } else if (cform[1] != 's') /* "%s" format is a string */ { ffi1fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclb).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnb( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned char *array, /* I - array of values to write */ unsigned char nulvalue, /* I - flag for undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpclb(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood + 1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpclb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad + 1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpclb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffpextn( fitsfile *fptr, /* I - FITS file pointer */ LONGLONG offset, /* I - byte offset from start of extension data */ LONGLONG nelem, /* I - number of elements to write */ void *buffer, /* I - stream of bytes to write */ int *status) /* IO - error status */ /* Write a stream of bytes to the current FITS HDU. This primative routine is mainly for writing non-standard "conforming" extensions and should not be used for standard IMAGE, TABLE or BINTABLE extensions. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); /* move to write position */ ffmbyt(fptr, (fptr->Fptr)->datastart+ offset, IGNORE_EOF, status); /* write the buffer */ ffpbyt(fptr, nelem, buffer, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fi1(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { memcpy(output, input, ntodo); /* just copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ( ((double) input[ii]) - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fi2(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; /* just copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (((double) input[ii]) - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fi4(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (INT32BIT) input[ii]; /* copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (((double) input[ii]) - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fi8(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fr4(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) (( ( (double) input[ii] ) - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fr8(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = ( ( (double) input[ii] ) - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffi1fstr(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/fits_hdecompress.c0000644000175000017500000017356612243255342020036 0ustar oleole/* ######################################################################### These routines to apply the H-compress decompression algorithm to a 2-D Fits image were written by R. White at the STScI and were obtained from the STScI at http://www.stsci.edu/software/hcompress.html This source file is a concatination of the following sources files in the original distribution hinv.c hsmooth.c undigitize.c decode.c dodecode.c qtree_decode.c qread.c bit_input.c The following modifications have been made to the original code: - commented out redundant "include" statements - added the nextchar global variable - changed all the 'extern' declarations to 'static', since all the routines are in the same source file - changed the first parameter in decode (and in lower level routines from a file stream to a char array - modified the myread routine, and lower level byte reading routines, to copy the input bytes to a char array, instead of reading them from a file stream - changed the function declarations to the more modern ANSI C style - changed calls to printf and perror to call the CFITSIO ffpmsg routine - replace "exit" statements with "return" statements ############################################################################ */ #include #include #include #include #include "fitsio2.h" /* WDP added test to see if min and max are already defined */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif #ifndef max #define max(a,b) (((a)>(b))?(a):(b)) #endif static long nextchar; static int decode(unsigned char *infile, int *a, int *nx, int *ny, int *scale); static int decode64(unsigned char *infile, LONGLONG *a, int *nx, int *ny, int *scale); static int hinv(int a[], int nx, int ny, int smooth ,int scale); static int hinv64(LONGLONG a[], int nx, int ny, int smooth ,int scale); static void undigitize(int a[], int nx, int ny, int scale); static void undigitize64(LONGLONG a[], int nx, int ny, int scale); static void unshuffle(int a[], int n, int n2, int tmp[]); static void unshuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[]); static void hsmooth(int a[], int nxtop, int nytop, int ny, int scale); static void hsmooth64(LONGLONG a[], int nxtop, int nytop, int ny, int scale); static void qread(unsigned char *infile,char *a, int n); static int readint(unsigned char *infile); static LONGLONG readlonglong(unsigned char *infile); static int dodecode(unsigned char *infile, int a[], int nx, int ny, unsigned char nbitplanes[3]); static int dodecode64(unsigned char *infile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3]); static int qtree_decode(unsigned char *infile, int a[], int n, int nqx, int nqy, int nbitplanes); static int qtree_decode64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes); static void start_inputing_bits(void); static int input_bit(unsigned char *infile); static int input_nbits(unsigned char *infile, int n); /* make input_nybble a separate routine, for added effiency */ /* #define input_nybble(infile) input_nbits(infile,4) */ static int input_nybble(unsigned char *infile); static int input_nnybble(unsigned char *infile, int n, unsigned char *array); static void qtree_expand(unsigned char *infile, unsigned char a[], int nx, int ny, unsigned char b[]); static void qtree_bitins(unsigned char a[], int nx, int ny, int b[], int n, int bit); static void qtree_bitins64(unsigned char a[], int nx, int ny, LONGLONG b[], int n, int bit); static void qtree_copy(unsigned char a[], int nx, int ny, unsigned char b[], int n); static void read_bdirect(unsigned char *infile, int a[], int n, int nqx, int nqy, unsigned char scratch[], int bit); static void read_bdirect64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, unsigned char scratch[], int bit); static int input_huffman(unsigned char *infile); /* ---------------------------------------------------------------------- */ int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status) { /* decompress the input byte stream using the H-compress algorithm input - input array of compressed bytes a - pre-allocated array to hold the output uncompressed image nx - returned X axis size ny - returned Y axis size NOTE: the nx and ny dimensions as defined within this code are reversed from the usual FITS notation. ny is the fastest varying dimension, which is usually considered the X axis in the FITS image display */ int stat; if (*status > 0) return(*status); /* decode the input array */ FFLOCK; /* decode uses the nextchar global variable */ stat = decode(input, a, nx, ny, scale); FFUNLOCK; *status = stat; if (stat) return(*status); /* * Un-Digitize */ undigitize(a, *nx, *ny, *scale); /* * Inverse H-transform */ stat = hinv(a, *nx, *ny, smooth, *scale); *status = stat; return(*status); } /* ---------------------------------------------------------------------- */ int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status) { /* decompress the input byte stream using the H-compress algorithm input - input array of compressed bytes a - pre-allocated array to hold the output uncompressed image nx - returned X axis size ny - returned Y axis size NOTE: the nx and ny dimensions as defined within this code are reversed from the usual FITS notation. ny is the fastest varying dimension, which is usually considered the X axis in the FITS image display */ int stat, *iarray, ii, nval; if (*status > 0) return(*status); /* decode the input array */ FFLOCK; /* decode uses the nextchar global variable */ stat = decode64(input, a, nx, ny, scale); FFUNLOCK; *status = stat; if (stat) return(*status); /* * Un-Digitize */ undigitize64(a, *nx, *ny, *scale); /* * Inverse H-transform */ stat = hinv64(a, *nx, *ny, smooth, *scale); *status = stat; /* pack the I*8 values back into an I*4 array */ iarray = (int *) a; nval = (*nx) * (*ny); for (ii = 0; ii < nval; ii++) iarray[ii] = (int) a[ii]; return(*status); } /* ############################################################################ */ /* ############################################################################ */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* hinv.c Inverse H-transform of NX x NY integer image * * Programmer: R. White Date: 23 July 1993 */ /* ############################################################################ */ static int hinv(int a[], int nx, int ny, int smooth ,int scale) /* int smooth; 0 for no smoothing, else smooth during inversion int scale; used if smoothing is specified */ { int nmax, log2n, i, j, k; int nxtop,nytop,nxf,nyf,c; int oddx,oddy; int shift, bit0, bit1, bit2, mask0, mask1, mask2, prnd0, prnd1, prnd2, nrnd0, nrnd1, nrnd2, lowbit0, lowbit1; int h0, hx, hy, hc; int s10, s00; int *tmp; /* * log2n is log2 of max(nx,ny) rounded up to next power of 2 */ nmax = (nx>ny) ? nx : ny; log2n = (int) (log((float) nmax)/log(2.0)+0.5); if ( nmax > (1<> 1; prnd1 = bit1 >> 1; prnd2 = bit2 >> 1; nrnd0 = prnd0 - 1; nrnd1 = prnd1 - 1; nrnd2 = prnd2 - 1; /* * round h0 to multiple of bit2 */ a[0] = (a[0] + ((a[0] >= 0) ? prnd2 : nrnd2)) & mask2; /* * do log2n expansions * * We're indexing a as a 2-D array with dimensions (nx,ny). */ nxtop = 1; nytop = 1; nxf = nx; nyf = ny; c = 1<=0; k--) { /* * this somewhat cryptic code generates the sequence * ntop[k-1] = (ntop[k]+1)/2, where ntop[log2n] = n */ c = c>>1; nxtop = nxtop<<1; nytop = nytop<<1; if (nxf <= c) { nxtop -= 1; } else { nxf -= c; } if (nyf <= c) { nytop -= 1; } else { nyf -= c; } /* * double shift and fix nrnd0 (because prnd0=0) on last pass */ if (k == 0) { nrnd0 = 0; shift = 2; } /* * unshuffle in each dimension to interleave coefficients */ for (i = 0; i= 0) ? prnd1 : nrnd1)) & mask1; hy = (hy + ((hy >= 0) ? prnd1 : nrnd1)) & mask1; hc = (hc + ((hc >= 0) ? prnd0 : nrnd0)) & mask0; /* * propagate bit0 of hc to hx,hy */ lowbit0 = hc & bit0; hx = (hx >= 0) ? (hx - lowbit0) : (hx + lowbit0); hy = (hy >= 0) ? (hy - lowbit0) : (hy + lowbit0); /* * Propagate bits 0 and 1 of hc,hx,hy to h0. * This could be simplified if we assume h0>0, but then * the inversion would not be lossless for images with * negative pixels. */ lowbit1 = (hc ^ hx ^ hy) & bit1; h0 = (h0 >= 0) ? (h0 + lowbit0 - lowbit1) : (h0 + ((lowbit0 == 0) ? lowbit1 : (lowbit0-lowbit1))); /* * Divide sums by 2 (4 last time) */ a[s10+1] = (h0 + hx + hy + hc) >> shift; a[s10 ] = (h0 + hx - hy - hc) >> shift; a[s00+1] = (h0 - hx + hy - hc) >> shift; a[s00 ] = (h0 - hx - hy + hc) >> shift; s00 += 2; s10 += 2; } if (oddy) { /* * do last element in row if row length is odd * s00+1, s10+1 are off edge */ h0 = a[s00 ]; hx = a[s10 ]; hx = ((hx >= 0) ? (hx+prnd1) : (hx+nrnd1)) & mask1; lowbit1 = hx & bit1; h0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1); a[s10 ] = (h0 + hx) >> shift; a[s00 ] = (h0 - hx) >> shift; } } if (oddx) { /* * do last row if column length is odd * s10, s10+1 are off edge */ s00 = ny*i; for (j = 0; j= 0) ? (hy+prnd1) : (hy+nrnd1)) & mask1; lowbit1 = hy & bit1; h0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1); a[s00+1] = (h0 + hy) >> shift; a[s00 ] = (h0 - hy) >> shift; s00 += 2; } if (oddy) { /* * do corner element if both row and column lengths are odd * s00+1, s10, s10+1 are off edge */ h0 = a[s00 ]; a[s00 ] = h0 >> shift; } } /* * divide all the masks and rounding values by 2 */ bit2 = bit1; bit1 = bit0; bit0 = bit0 >> 1; mask1 = mask0; mask0 = mask0 >> 1; prnd1 = prnd0; prnd0 = prnd0 >> 1; nrnd1 = nrnd0; nrnd0 = prnd0 - 1; } free(tmp); return(0); } /* ############################################################################ */ static int hinv64(LONGLONG a[], int nx, int ny, int smooth ,int scale) /* int smooth; 0 for no smoothing, else smooth during inversion int scale; used if smoothing is specified */ { int nmax, log2n, i, j, k; int nxtop,nytop,nxf,nyf,c; int oddx,oddy; int shift; LONGLONG mask0, mask1, mask2, prnd0, prnd1, prnd2, bit0, bit1, bit2; LONGLONG nrnd0, nrnd1, nrnd2, lowbit0, lowbit1; LONGLONG h0, hx, hy, hc; int s10, s00; LONGLONG *tmp; /* * log2n is log2 of max(nx,ny) rounded up to next power of 2 */ nmax = (nx>ny) ? nx : ny; log2n = (int) (log((float) nmax)/log(2.0)+0.5); if ( nmax > (1<> 1; prnd1 = bit1 >> 1; prnd2 = bit2 >> 1; nrnd0 = prnd0 - 1; nrnd1 = prnd1 - 1; nrnd2 = prnd2 - 1; /* * round h0 to multiple of bit2 */ a[0] = (a[0] + ((a[0] >= 0) ? prnd2 : nrnd2)) & mask2; /* * do log2n expansions * * We're indexing a as a 2-D array with dimensions (nx,ny). */ nxtop = 1; nytop = 1; nxf = nx; nyf = ny; c = 1<=0; k--) { /* * this somewhat cryptic code generates the sequence * ntop[k-1] = (ntop[k]+1)/2, where ntop[log2n] = n */ c = c>>1; nxtop = nxtop<<1; nytop = nytop<<1; if (nxf <= c) { nxtop -= 1; } else { nxf -= c; } if (nyf <= c) { nytop -= 1; } else { nyf -= c; } /* * double shift and fix nrnd0 (because prnd0=0) on last pass */ if (k == 0) { nrnd0 = 0; shift = 2; } /* * unshuffle in each dimension to interleave coefficients */ for (i = 0; i= 0) ? prnd1 : nrnd1)) & mask1; hy = (hy + ((hy >= 0) ? prnd1 : nrnd1)) & mask1; hc = (hc + ((hc >= 0) ? prnd0 : nrnd0)) & mask0; /* * propagate bit0 of hc to hx,hy */ lowbit0 = hc & bit0; hx = (hx >= 0) ? (hx - lowbit0) : (hx + lowbit0); hy = (hy >= 0) ? (hy - lowbit0) : (hy + lowbit0); /* * Propagate bits 0 and 1 of hc,hx,hy to h0. * This could be simplified if we assume h0>0, but then * the inversion would not be lossless for images with * negative pixels. */ lowbit1 = (hc ^ hx ^ hy) & bit1; h0 = (h0 >= 0) ? (h0 + lowbit0 - lowbit1) : (h0 + ((lowbit0 == 0) ? lowbit1 : (lowbit0-lowbit1))); /* * Divide sums by 2 (4 last time) */ a[s10+1] = (h0 + hx + hy + hc) >> shift; a[s10 ] = (h0 + hx - hy - hc) >> shift; a[s00+1] = (h0 - hx + hy - hc) >> shift; a[s00 ] = (h0 - hx - hy + hc) >> shift; s00 += 2; s10 += 2; } if (oddy) { /* * do last element in row if row length is odd * s00+1, s10+1 are off edge */ h0 = a[s00 ]; hx = a[s10 ]; hx = ((hx >= 0) ? (hx+prnd1) : (hx+nrnd1)) & mask1; lowbit1 = hx & bit1; h0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1); a[s10 ] = (h0 + hx) >> shift; a[s00 ] = (h0 - hx) >> shift; } } if (oddx) { /* * do last row if column length is odd * s10, s10+1 are off edge */ s00 = ny*i; for (j = 0; j= 0) ? (hy+prnd1) : (hy+nrnd1)) & mask1; lowbit1 = hy & bit1; h0 = (h0 >= 0) ? (h0 - lowbit1) : (h0 + lowbit1); a[s00+1] = (h0 + hy) >> shift; a[s00 ] = (h0 - hy) >> shift; s00 += 2; } if (oddy) { /* * do corner element if both row and column lengths are odd * s00+1, s10, s10+1 are off edge */ h0 = a[s00 ]; a[s00 ] = h0 >> shift; } } /* * divide all the masks and rounding values by 2 */ bit2 = bit1; bit1 = bit0; bit0 = bit0 >> 1; mask1 = mask0; mask0 = mask0 >> 1; prnd1 = prnd0; prnd0 = prnd0 >> 1; nrnd1 = nrnd0; nrnd0 = prnd0 - 1; } free(tmp); return(0); } /* ############################################################################ */ static void unshuffle(int a[], int n, int n2, int tmp[]) /* int a[]; array to shuffle int n; number of elements to shuffle int n2; second dimension int tmp[]; scratch storage */ { int i; int nhalf; int *p1, *p2, *pt; /* * copy 2nd half of array to tmp */ nhalf = (n+1)>>1; pt = tmp; p1 = &a[n2*nhalf]; /* pointer to a[i] */ for (i=nhalf; i= 0; i--) { *p1 = *p2; p2 -= n2; p1 -= (n2+n2); } /* * now distribute 2nd half of array (in tmp) to odd elements */ pt = tmp; p1 = &a[n2]; /* pointer to a[i] */ for (i=1; i>1; pt = tmp; p1 = &a[n2*nhalf]; /* pointer to a[i] */ for (i=nhalf; i= 0; i--) { *p1 = *p2; p2 -= n2; p1 -= (n2+n2); } /* * now distribute 2nd half of array (in tmp) to odd elements */ pt = tmp; p1 = &a[n2]; /* pointer to a[i] */ for (i=1; i> 1); if (smax <= 0) return; ny2 = ny << 1; /* * We're indexing a as a 2-D array with dimensions (nxtop,ny) of which * only (nxtop,nytop) are used. The coefficients on the edge of the * array are not adjusted (which is why the loops below start at 2 * instead of 0 and end at nxtop-2 instead of nxtop.) */ /* * Adjust x difference hx */ for (i = 2; i=0, dmin<=0. */ if (dmin < dmax) { diff = max( min(diff, dmax), dmin); /* * Compute change in slope limited to range +/- smax. * Careful with rounding negative numbers when using * shift for divide by 8. */ s = diff-(a[s10]<<3); s = (s>=0) ? (s>>3) : ((s+7)>>3) ; s = max( min(s, smax), -smax); a[s10] = a[s10]+s; } s00 += 2; s10 += 2; } } /* * Adjust y difference hy */ for (i = 0; i=0) ? (s>>3) : ((s+7)>>3) ; s = max( min(s, smax), -smax); a[s00+1] = a[s00+1]+s; } s00 += 2; s10 += 2; } } /* * Adjust curvature difference hc */ for (i = 2; i=0, dmin<=0. */ if (dmin < dmax) { diff = max( min(diff, dmax), dmin); /* * Compute change in slope limited to range +/- smax. * Careful with rounding negative numbers when using * shift for divide by 64. */ s = diff-(a[s10+1]<<6); s = (s>=0) ? (s>>6) : ((s+63)>>6) ; s = max( min(s, smax), -smax); a[s10+1] = a[s10+1]+s; } s00 += 2; s10 += 2; } } } /* ############################################################################ */ static void hsmooth64(LONGLONG a[], int nxtop, int nytop, int ny, int scale) /* LONGLONG a[]; array of H-transform coefficients int nxtop,nytop; size of coefficient block to use int ny; actual 1st dimension of array int scale; truncation scale factor that was used */ { int i, j; int ny2, s10, s00; LONGLONG hm, h0, hp, hmm, hpm, hmp, hpp, hx2, hy2, diff, dmax, dmin, s, smax, m1, m2; /* * Maximum change in coefficients is determined by scale factor. * Since we rounded during division (see digitize.c), the biggest * permitted change is scale/2. */ smax = (scale >> 1); if (smax <= 0) return; ny2 = ny << 1; /* * We're indexing a as a 2-D array with dimensions (nxtop,ny) of which * only (nxtop,nytop) are used. The coefficients on the edge of the * array are not adjusted (which is why the loops below start at 2 * instead of 0 and end at nxtop-2 instead of nxtop.) */ /* * Adjust x difference hx */ for (i = 2; i=0, dmin<=0. */ if (dmin < dmax) { diff = max( min(diff, dmax), dmin); /* * Compute change in slope limited to range +/- smax. * Careful with rounding negative numbers when using * shift for divide by 8. */ s = diff-(a[s10]<<3); s = (s>=0) ? (s>>3) : ((s+7)>>3) ; s = max( min(s, smax), -smax); a[s10] = a[s10]+s; } s00 += 2; s10 += 2; } } /* * Adjust y difference hy */ for (i = 0; i=0) ? (s>>3) : ((s+7)>>3) ; s = max( min(s, smax), -smax); a[s00+1] = a[s00+1]+s; } s00 += 2; s10 += 2; } } /* * Adjust curvature difference hc */ for (i = 2; i=0, dmin<=0. */ if (dmin < dmax) { diff = max( min(diff, dmax), dmin); /* * Compute change in slope limited to range +/- smax. * Careful with rounding negative numbers when using * shift for divide by 64. */ s = diff-(a[s10+1]<<6); s = (s>=0) ? (s>>6) : ((s+63)>>6) ; s = max( min(s, smax), -smax); a[s10+1] = a[s10+1]+s; } s00 += 2; s10 += 2; } } } /* ############################################################################ */ /* ############################################################################ */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* undigitize.c undigitize H-transform * * Programmer: R. White Date: 9 May 1991 */ /* ############################################################################ */ static void undigitize(int a[], int nx, int ny, int scale) { int *p; /* * multiply by scale */ if (scale <= 1) return; for (p=a; p <= &a[nx*ny-1]; p++) *p = (*p)*scale; } /* ############################################################################ */ static void undigitize64(LONGLONG a[], int nx, int ny, int scale) { LONGLONG *p, scale64; /* * multiply by scale */ if (scale <= 1) return; scale64 = (LONGLONG) scale; /* use a 64-bit int for efficiency in the big loop */ for (p=a; p <= &a[nx*ny-1]; p++) *p = (*p)*scale64; } /* ############################################################################ */ /* ############################################################################ */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* decode.c read codes from infile and construct array * * Programmer: R. White Date: 2 February 1994 */ static char code_magic[2] = { (char)0xDD, (char)0x99 }; /* ############################################################################ */ static int decode(unsigned char *infile, int *a, int *nx, int *ny, int *scale) /* char *infile; input file int *a; address of output array [nx][ny] int *nx,*ny; size of output array int *scale; scale factor for digitization */ { LONGLONG sumall; int nel, stat; unsigned char nbitplanes[3]; char tmagic[2]; /* initialize the byte read position to the beginning of the array */; nextchar = 0; /* * File starts either with special 2-byte magic code or with * FITS keyword "SIMPLE =" */ qread(infile, tmagic, sizeof(tmagic)); /* * check for correct magic code value */ if (memcmp(tmagic,code_magic,sizeof(code_magic)) != 0) { ffpmsg("bad file format"); return(DATA_DECOMPRESSION_ERR); } *nx =readint(infile); /* x size of image */ *ny =readint(infile); /* y size of image */ *scale=readint(infile); /* scale factor for digitization */ nel = (*nx) * (*ny); /* sum of all pixels */ sumall=readlonglong(infile); /* # bits in quadrants */ qread(infile, (char *) nbitplanes, sizeof(nbitplanes)); stat = dodecode(infile, a, *nx, *ny, nbitplanes); /* * put sum of all pixels back into pixel 0 */ a[0] = (int) sumall; return(stat); } /* ############################################################################ */ static int decode64(unsigned char *infile, LONGLONG *a, int *nx, int *ny, int *scale) /* char *infile; input file LONGLONG *a; address of output array [nx][ny] int *nx,*ny; size of output array int *scale; scale factor for digitization */ { int nel, stat; LONGLONG sumall; unsigned char nbitplanes[3]; char tmagic[2]; /* initialize the byte read position to the beginning of the array */; nextchar = 0; /* * File starts either with special 2-byte magic code or with * FITS keyword "SIMPLE =" */ qread(infile, tmagic, sizeof(tmagic)); /* * check for correct magic code value */ if (memcmp(tmagic,code_magic,sizeof(code_magic)) != 0) { ffpmsg("bad file format"); return(DATA_DECOMPRESSION_ERR); } *nx =readint(infile); /* x size of image */ *ny =readint(infile); /* y size of image */ *scale=readint(infile); /* scale factor for digitization */ nel = (*nx) * (*ny); /* sum of all pixels */ sumall=readlonglong(infile); /* # bits in quadrants */ qread(infile, (char *) nbitplanes, sizeof(nbitplanes)); stat = dodecode64(infile, a, *nx, *ny, nbitplanes); /* * put sum of all pixels back into pixel 0 */ a[0] = sumall; return(stat); } /* ############################################################################ */ /* ############################################################################ */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* dodecode.c Decode stream of characters on infile and return array * * This version encodes the different quadrants separately * * Programmer: R. White Date: 9 May 1991 */ /* ############################################################################ */ static int dodecode(unsigned char *infile, int a[], int nx, int ny, unsigned char nbitplanes[3]) /* int a[]; int nx,ny; Array dimensions are [nx][ny] unsigned char nbitplanes[3]; Number of bit planes in quadrants */ { int i, nel, nx2, ny2, stat; nel = nx*ny; nx2 = (nx+1)/2; ny2 = (ny+1)/2; /* * initialize a to zero */ for (i=0; inqy) ? nqx : nqy; log2n = (int) (log((float) nqmax)/log(2.0)+0.5); if (nqmax > (1<= 0; bit--) { /* * Was bitplane was quadtree-coded or written directly? */ b = input_nybble(infile); if(b == 0) { /* * bit map was written directly */ read_bdirect(infile,a,n,nqx,nqy,scratch,bit); } else if (b != 0xf) { ffpmsg("qtree_decode: bad format code"); return(DATA_DECOMPRESSION_ERR); } else { /* * bitmap was quadtree-coded, do log2n expansions * * read first code */ scratch[0] = input_huffman(infile); /* * now do log2n expansions, reading codes from file as necessary */ nx = 1; ny = 1; nfx = nqx; nfy = nqy; c = 1<>1; nx = nx<<1; ny = ny<<1; if (nfx <= c) { nx -= 1; } else { nfx -= c; } if (nfy <= c) { ny -= 1; } else { nfy -= c; } qtree_expand(infile,scratch,nx,ny,scratch); } /* * now copy last set of 4-bit codes to bitplane bit of array a */ qtree_bitins(scratch,nqx,nqy,a,n,bit); } } free(scratch); return(0); } /* ############################################################################ */ static int qtree_decode64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes) /* char *infile; LONGLONG a[]; a is 2-D array with dimensions (n,n) int n; length of full row in a int nqx; partial length of row to decode int nqy; partial length of column (<=n) int nbitplanes; number of bitplanes to decode */ { int log2n, k, bit, b, nqmax; int nx,ny,nfx,nfy,c; int nqx2, nqy2; unsigned char *scratch; /* * log2n is log2 of max(nqx,nqy) rounded up to next power of 2 */ nqmax = (nqx>nqy) ? nqx : nqy; log2n = (int) (log((float) nqmax)/log(2.0)+0.5); if (nqmax > (1<= 0; bit--) { /* * Was bitplane was quadtree-coded or written directly? */ b = input_nybble(infile); if(b == 0) { /* * bit map was written directly */ read_bdirect64(infile,a,n,nqx,nqy,scratch,bit); } else if (b != 0xf) { ffpmsg("qtree_decode64: bad format code"); return(DATA_DECOMPRESSION_ERR); } else { /* * bitmap was quadtree-coded, do log2n expansions * * read first code */ scratch[0] = input_huffman(infile); /* * now do log2n expansions, reading codes from file as necessary */ nx = 1; ny = 1; nfx = nqx; nfy = nqy; c = 1<>1; nx = nx<<1; ny = ny<<1; if (nfx <= c) { nx -= 1; } else { nfx -= c; } if (nfy <= c) { ny -= 1; } else { nfy -= c; } qtree_expand(infile,scratch,nx,ny,scratch); } /* * now copy last set of 4-bit codes to bitplane bit of array a */ qtree_bitins64(scratch,nqx,nqy,a,n,bit); } } free(scratch); return(0); } /* ############################################################################ */ /* * do one quadtree expansion step on array a[(nqx+1)/2,(nqy+1)/2] * results put into b[nqx,nqy] (which may be the same as a) */ static void qtree_expand(unsigned char *infile, unsigned char a[], int nx, int ny, unsigned char b[]) { int i; /* * first copy a to b, expanding each 4-bit value */ qtree_copy(a,nx,ny,b,ny); /* * now read new 4-bit values into b for each non-zero element */ for (i = nx*ny-1; i >= 0; i--) { if (b[i]) b[i] = input_huffman(infile); } } /* ############################################################################ */ /* * copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding * each value to 2x2 pixels * a,b may be same array */ static void qtree_copy(unsigned char a[], int nx, int ny, unsigned char b[], int n) /* int n; declared y dimension of b */ { int i, j, k, nx2, ny2; int s00, s10; /* * first copy 4-bit values to b * start at end in case a,b are same array */ nx2 = (nx+1)/2; ny2 = (ny+1)/2; k = ny2*(nx2-1)+ny2-1; /* k is index of a[i,j] */ for (i = nx2-1; i >= 0; i--) { s00 = 2*(n*i+ny2-1); /* s00 is index of b[2*i,2*j] */ for (j = ny2-1; j >= 0; j--) { b[s00] = a[k]; k -= 1; s00 -= 2; } } /* * now expand each 2x2 block */ for (i = 0; i>1) & 1; b[s00+1] = (b[s00]>>2) & 1; b[s00 ] = (b[s00]>>3) & 1; */ s00 += 2; s10 += 2; } if (j < ny) { /* * row size is odd, do last element in row * s00+1, s10+1 are off edge */ /* not worth converting this to use 16 case statements */ b[s10 ] = (b[s00]>>1) & 1; b[s00 ] = (b[s00]>>3) & 1; } } if (i < nx) { /* * column size is odd, do last row * s10, s10+1 are off edge */ s00 = n*i; for (j = 0; j>2) & 1; b[s00 ] = (b[s00]>>3) & 1; s00 += 2; } if (j < ny) { /* * both row and column size are odd, do corner element * s00+1, s10, s10+1 are off edge */ /* not worth converting this to use 16 case statements */ b[s00 ] = (b[s00]>>3) & 1; } } } /* ############################################################################ */ /* * Copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding * each value to 2x2 pixels and inserting into bitplane BIT of B. * A,B may NOT be same array (it wouldn't make sense to be inserting * bits into the same array anyway.) */ static void qtree_bitins(unsigned char a[], int nx, int ny, int b[], int n, int bit) /* int n; declared y dimension of b */ { int i, j, k; int s00; int plane_val; plane_val = 1 << bit; /* * expand each 2x2 block */ k = 0; /* k is index of a[i/2,j/2] */ for (i = 0; i>1) & 1) << bit; b[s00+1] |= ((a[k]>>2) & 1) << bit; b[s00 ] |= ((a[k]>>3) & 1) << bit; */ s00 += 2; /* s10 += 2; */ k += 1; } if (j < ny) { /* * row size is odd, do last element in row * s00+1, s10+1 are off edge */ switch (a[k]) { case(0): break; case(1): break; case(2): b[s00+n ] |= plane_val; break; case(3): b[s00+n ] |= plane_val; break; case(4): break; case(5): break; case(6): b[s00+n ] |= plane_val; break; case(7): b[s00+n ] |= plane_val; break; case(8): b[s00 ] |= plane_val; break; case(9): b[s00 ] |= plane_val; break; case(10): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(11): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(12): b[s00 ] |= plane_val; break; case(13): b[s00 ] |= plane_val; break; case(14): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(15): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; } /* b[s10 ] |= ((a[k]>>1) & 1) << bit; b[s00 ] |= ((a[k]>>3) & 1) << bit; */ k += 1; } } if (i < nx) { /* * column size is odd, do last row * s10, s10+1 are off edge */ s00 = n*i; for (j = 0; j>2) & 1) << bit; b[s00 ] |= ((a[k]>>3) & 1) << bit; */ s00 += 2; k += 1; } if (j < ny) { /* * both row and column size are odd, do corner element * s00+1, s10, s10+1 are off edge */ switch (a[k]) { case(0): break; case(1): break; case(2): break; case(3): break; case(4): break; case(5): break; case(6): break; case(7): break; case(8): b[s00 ] |= plane_val; break; case(9): b[s00 ] |= plane_val; break; case(10): b[s00 ] |= plane_val; break; case(11): b[s00 ] |= plane_val; break; case(12): b[s00 ] |= plane_val; break; case(13): b[s00 ] |= plane_val; break; case(14): b[s00 ] |= plane_val; break; case(15): b[s00 ] |= plane_val; break; } /* b[s00 ] |= ((a[k]>>3) & 1) << bit; */ k += 1; } } } /* ############################################################################ */ /* * Copy 4-bit values from a[(nx+1)/2,(ny+1)/2] to b[nx,ny], expanding * each value to 2x2 pixels and inserting into bitplane BIT of B. * A,B may NOT be same array (it wouldn't make sense to be inserting * bits into the same array anyway.) */ static void qtree_bitins64(unsigned char a[], int nx, int ny, LONGLONG b[], int n, int bit) /* int n; declared y dimension of b */ { int i, j, k; int s00; int plane_val; plane_val = 1 << bit; /* * expand each 2x2 block */ k = 0; /* k is index of a[i/2,j/2] */ for (i = 0; i>1) & 1) << bit; b[s00+1] |= ((((LONGLONG)a[k])>>2) & 1) << bit; b[s00 ] |= ((((LONGLONG)a[k])>>3) & 1) << bit; */ s00 += 2; /* s10 += 2; */ k += 1; } if (j < ny) { /* * row size is odd, do last element in row * s00+1, s10+1 are off edge */ switch (a[k]) { case(0): break; case(1): break; case(2): b[s00+n ] |= plane_val; break; case(3): b[s00+n ] |= plane_val; break; case(4): break; case(5): break; case(6): b[s00+n ] |= plane_val; break; case(7): b[s00+n ] |= plane_val; break; case(8): b[s00 ] |= plane_val; break; case(9): b[s00 ] |= plane_val; break; case(10): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(11): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(12): b[s00 ] |= plane_val; break; case(13): b[s00 ] |= plane_val; break; case(14): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; case(15): b[s00+n ] |= plane_val; b[s00 ] |= plane_val; break; } /* b[s10 ] |= ((((LONGLONG)a[k])>>1) & 1) << bit; b[s00 ] |= ((((LONGLONG)a[k])>>3) & 1) << bit; */ k += 1; } } if (i < nx) { /* * column size is odd, do last row * s10, s10+1 are off edge */ s00 = n*i; for (j = 0; j>2) & 1) << bit; b[s00 ] |= ((((LONGLONG)a[k])>>3) & 1) << bit; */ s00 += 2; k += 1; } if (j < ny) { /* * both row and column size are odd, do corner element * s00+1, s10, s10+1 are off edge */ switch (a[k]) { case(0): break; case(1): break; case(2): break; case(3): break; case(4): break; case(5): break; case(6): break; case(7): break; case(8): b[s00 ] |= plane_val; break; case(9): b[s00 ] |= plane_val; break; case(10): b[s00 ] |= plane_val; break; case(11): b[s00 ] |= plane_val; break; case(12): b[s00 ] |= plane_val; break; case(13): b[s00 ] |= plane_val; break; case(14): b[s00 ] |= plane_val; break; case(15): b[s00 ] |= plane_val; break; } /* b[s00 ] |= ((((LONGLONG)a[k])>>3) & 1) << bit; */ k += 1; } } } /* ############################################################################ */ static void read_bdirect(unsigned char *infile, int a[], int n, int nqx, int nqy, unsigned char scratch[], int bit) { /* * read bit image packed 4 pixels/nybble */ /* int i; for (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) { scratch[i] = input_nybble(infile); } */ input_nnybble(infile, ((nqx+1)/2) * ((nqy+1)/2), scratch); /* * insert in bitplane BIT of image A */ qtree_bitins(scratch,nqx,nqy,a,n,bit); } /* ############################################################################ */ static void read_bdirect64(unsigned char *infile, LONGLONG a[], int n, int nqx, int nqy, unsigned char scratch[], int bit) { /* * read bit image packed 4 pixels/nybble */ /* int i; for (i = 0; i < ((nqx+1)/2) * ((nqy+1)/2); i++) { scratch[i] = input_nybble(infile); } */ input_nnybble(infile, ((nqx+1)/2) * ((nqy+1)/2), scratch); /* * insert in bitplane BIT of image A */ qtree_bitins64(scratch,nqx,nqy,a,n,bit); } /* ############################################################################ */ /* * Huffman decoding for fixed codes * * Coded values range from 0-15 * * Huffman code values (hex): * * 3e, 00, 01, 08, 02, 09, 1a, 1b, * 03, 1c, 0a, 1d, 0b, 1e, 3f, 0c * * and number of bits in each code: * * 6, 3, 3, 4, 3, 4, 5, 5, * 3, 5, 4, 5, 4, 5, 6, 4 */ static int input_huffman(unsigned char *infile) { int c; /* * get first 3 bits to start */ c = input_nbits(infile,3); if (c < 4) { /* * this is all we need * return 1,2,4,8 for c=0,1,2,3 */ return(1<>bits_to_go) & 1); } /* ############################################################################ */ /* INPUT N BITS (N must be <= 8) */ static int input_nbits(unsigned char *infile, int n) { /* AND mask for retreiving the right-most n bits */ static int mask[9] = {0, 1, 3, 7, 15, 31, 63, 127, 255}; if (bits_to_go < n) { /* * need another byte's worth of bits */ buffer2 = (buffer2<<8) | (int) infile[nextchar]; nextchar++; bits_to_go += 8; } /* * now pick off the first n bits */ bits_to_go -= n; /* there was a slight gain in speed by replacing the following line */ /* return( (buffer2>>bits_to_go) & ((1<>bits_to_go) & (*(mask+n)) ); } /* ############################################################################ */ /* INPUT 4 BITS */ static int input_nybble(unsigned char *infile) { if (bits_to_go < 4) { /* * need another byte's worth of bits */ buffer2 = (buffer2<<8) | (int) infile[nextchar]; nextchar++; bits_to_go += 8; } /* * now pick off the first 4 bits */ bits_to_go -= 4; return( (buffer2>>bits_to_go) & 15 ); } /* ############################################################################ */ /* INPUT array of 4 BITS */ static int input_nnybble(unsigned char *infile, int n, unsigned char array[]) { /* copy n 4-bit nybbles from infile to the lower 4 bits of array */ int ii, kk, shift1, shift2; /* forcing byte alignment doesn;t help, and even makes it go slightly slower if (bits_to_go != 8) input_nbits(infile, bits_to_go); */ if (n == 1) { array[0] = input_nybble(infile); return(0); } if (bits_to_go == 8) { /* already have 2 full nybbles in buffer2, so backspace the infile array to reuse last char */ nextchar--; bits_to_go = 0; } /* bits_to_go now has a value in the range 0 - 7. After adding */ /* another byte, bits_to_go effectively will be in range 8 - 15 */ shift1 = bits_to_go + 4; /* shift1 will be in range 4 - 11 */ shift2 = bits_to_go; /* shift2 will be in range 0 - 7 */ kk = 0; /* special case */ if (bits_to_go == 0) { for (ii = 0; ii < n/2; ii++) { /* * refill the buffer with next byte */ buffer2 = (buffer2<<8) | (int) infile[nextchar]; nextchar++; array[kk] = (int) ((buffer2>>4) & 15); array[kk + 1] = (int) ((buffer2) & 15); /* no shift required */ kk += 2; } } else { for (ii = 0; ii < n/2; ii++) { /* * refill the buffer with next byte */ buffer2 = (buffer2<<8) | (int) infile[nextchar]; nextchar++; array[kk] = (int) ((buffer2>>shift1) & 15); array[kk + 1] = (int) ((buffer2>>shift2) & 15); kk += 2; } } if (ii * 2 != n) { /* have to read last odd byte */ array[n-1] = input_nybble(infile); } return( (buffer2>>bits_to_go) & 15 ); } astropy-0.3/cextern/cfitsio/swapproc.c0000644000175000017500000001702712243255342016320 0ustar oleole/* This file, swapproc.c, contains general utility routines that are */ /* used by other FITSIO routines to swap bytes. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ /* The fast SSE2 and SSSE3 functions were provided by Julian Taylor, ESO */ #include #include #include "fitsio2.h" /* bswap builtin is available since GCC 4.3 */ #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) #define HAVE_BSWAP #endif #ifdef __SSSE3__ #include /* swap 16 bytes according to mask, values must be 16 byte aligned */ static inline void swap_ssse3(char * values, __m128i mask) { __m128i v = _mm_load_si128((__m128i *)values); __m128i s = _mm_shuffle_epi8(v, mask); _mm_store_si128((__m128i*)values, s); } #endif #ifdef __SSE2__ #include /* swap 8 shorts, values must be 16 byte aligned * faster than ssse3 variant for shorts */ static inline void swap2_sse2(char * values) { __m128i r1 = _mm_load_si128((__m128i *)values); __m128i r2 = r1; r1 = _mm_srli_epi16(r1, 8); r2 = _mm_slli_epi16(r2, 8); r1 = _mm_or_si128(r1, r2); _mm_store_si128((__m128i*)values, r1); } /* the three shuffles required for 4 and 8 byte variants make * SSE2 slower than bswap */ /* get number of elements to peel to reach alignment */ static inline size_t get_peel(void * addr, size_t esize, size_t nvals, size_t alignment) { const size_t offset = (size_t)addr % alignment; size_t peel = offset ? (alignment - offset) / esize : 0; peel = nvals < peel ? nvals : peel; return peel; } #endif /*--------------------------------------------------------------------------*/ static void ffswap2_slow(short *svalues, long nvals) { register long ii; unsigned short * usvalues; usvalues = (unsigned short *) svalues; for (ii = 0; ii < nvals; ii++) { usvalues[ii] = (usvalues[ii]>>8) | (usvalues[ii]<<8); } } /*--------------------------------------------------------------------------*/ #if __SSE2__ void ffswap2(short *svalues, /* IO - pointer to shorts to be swapped */ long nvals) /* I - number of shorts to be swapped */ /* swap the bytes in the input short integers: ( 0 1 -> 1 0 ) */ { if ((long)svalues % 2 != 0) { /* should not happen */ ffswap2_slow(svalues, nvals); return; } long ii; size_t peel = get_peel((void*)&svalues[0], sizeof(svalues[0]), nvals, 16); ffswap2_slow(svalues, peel); for (ii = peel; ii < (nvals - peel - (nvals - peel) % 8); ii+=8) { swap2_sse2((char*)&svalues[ii]); } ffswap2_slow(&svalues[ii], nvals - ii); } #else void ffswap2(short *svalues, /* IO - pointer to shorts to be swapped */ long nvals) /* I - number of shorts to be swapped */ /* swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 ) */ { ffswap2_slow(svalues, nvals); } #endif /*--------------------------------------------------------------------------*/ static void ffswap4_slow(INT32BIT *ivalues, long nvals) { register long ii; #if defined(HAVE_BSWAP) for (ii = 0; ii < nvals; ii++) { ivalues[ii] = __builtin_bswap32(ivalues[ii]); } #elif defined(_MSC_VER) && (_MSC_VER >= 1400) /* intrinsic byte swapping function in Microsoft Visual C++ 8.0 and later */ unsigned int* uivalues = (unsigned int *) ivalues; /* intrinsic byte swapping function in Microsoft Visual C++ */ for (ii = 0; ii < nvals; ii++) { uivalues[ii] = _byteswap_ulong(uivalues[ii]); } #else char *cvalues, tmp; for (ii = 0; ii < nvals; ii++) { cvalues = (char *)&ivalues[ii]; tmp = cvalues[0]; cvalues[0] = cvalues[3]; cvalues[3] = tmp; tmp = cvalues[1]; cvalues[1] = cvalues[2]; cvalues[2] = tmp; } #endif } /*--------------------------------------------------------------------------*/ #ifdef __SSSE3__ void ffswap4(INT32BIT *ivalues, /* IO - pointer to INT*4 to be swapped */ long nvals) /* I - number of floats to be swapped */ /* swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 ) */ { if ((long)ivalues % 4 != 0) { /* should not happen */ ffswap4_slow(ivalues, nvals); return; } long ii; const __m128i cmask4 = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2 ,3); size_t peel = get_peel((void*)&ivalues[0], sizeof(ivalues[0]), nvals, 16); ffswap4_slow(ivalues, peel); for (ii = peel; ii < (nvals - peel - (nvals - peel) % 4); ii+=4) { swap_ssse3((char*)&ivalues[ii], cmask4); } ffswap4_slow(&ivalues[ii], nvals - ii); } #else void ffswap4(INT32BIT *ivalues, /* IO - pointer to INT*4 to be swapped */ long nvals) /* I - number of floats to be swapped */ /* swap the bytes in the input 4-byte integer: ( 0 1 2 3 -> 3 2 1 0 ) */ { ffswap4_slow(ivalues, nvals); } #endif /*--------------------------------------------------------------------------*/ static void ffswap8_slow(double *dvalues, long nvals) { register long ii; #ifdef HAVE_BSWAP LONGLONG * llvalues = (LONGLONG*)dvalues; for (ii = 0; ii < nvals; ii++) { llvalues[ii] = __builtin_bswap64(llvalues[ii]); } #elif defined(_MSC_VER) && (_MSC_VER >= 1400) /* intrinsic byte swapping function in Microsoft Visual C++ 8.0 and later */ unsigned __int64 * llvalues = (unsigned __int64 *) dvalues; for (ii = 0; ii < nvals; ii++) { llvalues[ii] = _byteswap_uint64(llvalues[ii]); } #else register char *cvalues; register char temp; cvalues = (char *) dvalues; /* copy the pointer value */ for (ii = 0; ii < nvals*8; ii += 8) { temp = cvalues[ii]; cvalues[ii] = cvalues[ii+7]; cvalues[ii+7] = temp; temp = cvalues[ii+1]; cvalues[ii+1] = cvalues[ii+6]; cvalues[ii+6] = temp; temp = cvalues[ii+2]; cvalues[ii+2] = cvalues[ii+5]; cvalues[ii+5] = temp; temp = cvalues[ii+3]; cvalues[ii+3] = cvalues[ii+4]; cvalues[ii+4] = temp; } #endif } /*--------------------------------------------------------------------------*/ #ifdef __SSSE3__ void ffswap8(double *dvalues, /* IO - pointer to doubles to be swapped */ long nvals) /* I - number of doubles to be swapped */ /* swap the bytes in the input doubles: ( 01234567 -> 76543210 ) */ { if ((long)dvalues % 8 != 0) { /* should not happen on amd64 */ ffswap8_slow(dvalues, nvals); return; } long ii; const __m128i cmask8 = _mm_set_epi8(8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2 ,3, 4, 5, 6, 7); size_t peel = get_peel((void*)&dvalues[0], sizeof(dvalues[0]), nvals, 16); ffswap8_slow(dvalues, peel); for (ii = peel; ii < (nvals - peel - (nvals - peel) % 2); ii+=2) { swap_ssse3((char*)&dvalues[ii], cmask8); } ffswap8_slow(&dvalues[ii], nvals - ii); } #else void ffswap8(double *dvalues, /* IO - pointer to doubles to be swapped */ long nvals) /* I - number of doubles to be swapped */ /* swap the bytes in the input doubles: ( 01234567 -> 76543210 ) */ { ffswap8_slow(dvalues, nvals); } #endif astropy-0.3/cextern/cfitsio/grparser.h0000644000175000017500000001326512243255342016314 0ustar oleole/* T E M P L A T E P A R S E R H E A D E R F I L E ===================================================== by Jerzy.Borkowski@obs.unige.ch Integral Science Data Center ch. d'Ecogia 16 1290 Versoix Switzerland 14-Oct-98: initial release 16-Oct-98: reference to fitsio.h removed, also removed strings after #endif directives to make gcc -Wall not to complain 20-Oct-98: added declarations NGP_XTENSION_SIMPLE and NGP_XTENSION_FIRST 24-Oct-98: prototype of ngp_read_line() function updated. 22-Jan-99: prototype for ngp_set_extver() function added. 20-Jun-2002 Wm Pence, added support for the HIERARCH keyword convention (changed NGP_MAX_NAME from (20) to FLEN_KEYWORD) */ #ifndef GRPARSER_H_INCLUDED #define GRPARSER_H_INCLUDED #ifdef __cplusplus extern "C" { #endif /* error codes - now defined in fitsio.h */ /* common constants definitions */ #define NGP_ALLOCCHUNK (1000) #define NGP_MAX_INCLUDE (10) /* include file nesting limit */ #define NGP_MAX_COMMENT (80) /* max size for comment */ #define NGP_MAX_NAME FLEN_KEYWORD /* max size for KEYWORD (FITS limits it to 8 chars) */ /* except HIERARCH can have longer effective keyword names */ #define NGP_MAX_STRING (80) /* max size for various strings */ #define NGP_MAX_ARRAY_DIM (999) /* max. number of dimensions in array */ #define NGP_MAX_FNAME (1000) /* max size of combined path+fname */ #define NGP_MAX_ENVFILES (10000) /* max size of CFITSIO_INCLUDE_FILES env. variable */ #define NGP_TOKEN_UNKNOWN (-1) /* token type unknown */ #define NGP_TOKEN_INCLUDE (0) /* \INCLUDE token */ #define NGP_TOKEN_GROUP (1) /* \GROUP token */ #define NGP_TOKEN_END (2) /* \END token */ #define NGP_TOKEN_XTENSION (3) /* XTENSION token */ #define NGP_TOKEN_SIMPLE (4) /* SIMPLE token */ #define NGP_TOKEN_EOF (5) /* End Of File pseudo token */ #define NGP_TTYPE_UNKNOWN (0) /* undef (yet) token type - invalid to print/write to disk */ #define NGP_TTYPE_BOOL (1) /* boolean, it is 'T' or 'F' */ #define NGP_TTYPE_STRING (2) /* something withing "" or starting with letter */ #define NGP_TTYPE_INT (3) /* starting with digit and not with '.' */ #define NGP_TTYPE_REAL (4) /* digits + '.' */ #define NGP_TTYPE_COMPLEX (5) /* 2 reals, separated with ',' */ #define NGP_TTYPE_NULL (6) /* NULL token, format is : NAME = / comment */ #define NGP_TTYPE_RAW (7) /* HISTORY/COMMENT/8SPACES + comment string without / */ #define NGP_FOUND_EQUAL_SIGN (1) /* line contains '=' after keyword name */ #define NGP_FORMAT_OK (0) /* line format OK */ #define NGP_FORMAT_ERROR (1) /* line format error */ #define NGP_NODE_INVALID (0) /* default node type - invalid (to catch errors) */ #define NGP_NODE_IMAGE (1) /* IMAGE type */ #define NGP_NODE_ATABLE (2) /* ASCII table type */ #define NGP_NODE_BTABLE (3) /* BINARY table type */ #define NGP_NON_SYSTEM_ONLY (0) /* save all keywords except NAXIS,BITPIX,etc.. */ #define NGP_REALLY_ALL (1) /* save really all keywords */ #define NGP_XTENSION_SIMPLE (1) /* HDU defined with SIMPLE T */ #define NGP_XTENSION_FIRST (2) /* this is first extension in template */ #define NGP_LINE_REREAD (1) /* reread line */ #define NGP_BITPIX_INVALID (-12345) /* default BITPIX (to catch errors) */ /* common macro definitions */ #ifdef NGP_PARSER_DEBUG_MALLOC #define ngp_alloc(x) dal_malloc(x) #define ngp_free(x) dal_free(x) #define ngp_realloc(x,y) dal_realloc(x,y) #else #define ngp_alloc(x) malloc(x) #define ngp_free(x) free(x) #define ngp_realloc(x,y) realloc(x,y) #endif /* type definitions */ typedef struct NGP_RAW_LINE_STRUCT { char *line; char *name; char *value; int type; char *comment; int format; int flags; } NGP_RAW_LINE; typedef union NGP_TOKVAL_UNION { char *s; /* space allocated separately, be careful !!! */ char b; int i; double d; struct NGP_COMPLEX_STRUCT { double re; double im; } c; /* complex value */ } NGP_TOKVAL; typedef struct NGP_TOKEN_STRUCT { int type; char name[NGP_MAX_NAME]; NGP_TOKVAL value; char comment[NGP_MAX_COMMENT]; } NGP_TOKEN; typedef struct NGP_HDU_STRUCT { int tokcnt; NGP_TOKEN *tok; } NGP_HDU; typedef struct NGP_TKDEF_STRUCT { char *name; int code; } NGP_TKDEF; typedef struct NGP_EXTVER_TAB_STRUCT { char *extname; int version; } NGP_EXTVER_TAB; /* globally visible variables declarations */ extern NGP_RAW_LINE ngp_curline; extern NGP_RAW_LINE ngp_prevline; extern int ngp_extver_tab_size; extern NGP_EXTVER_TAB *ngp_extver_tab; /* globally visible functions declarations */ int ngp_get_extver(char *extname, int *version); int ngp_set_extver(char *extname, int version); int ngp_delete_extver_tab(void); int ngp_strcasecmp(char *p1, char *p2); int ngp_strcasencmp(char *p1, char *p2, int n); int ngp_line_from_file(FILE *fp, char **p); int ngp_free_line(void); int ngp_free_prevline(void); int ngp_read_line_buffered(FILE *fp); int ngp_unread_line(void); int ngp_extract_tokens(NGP_RAW_LINE *cl); int ngp_include_file(char *fname); int ngp_read_line(int ignore_blank_lines); int ngp_keyword_is_write(NGP_TOKEN *ngp_tok); int ngp_keyword_all_write(NGP_HDU *ngph, fitsfile *ffp, int mode); int ngp_hdu_init(NGP_HDU *ngph); int ngp_hdu_clear(NGP_HDU *ngph); int ngp_hdu_insert_token(NGP_HDU *ngph, NGP_TOKEN *newtok); int ngp_append_columns(fitsfile *ff, NGP_HDU *ngph, int aftercol); int ngp_read_xtension(fitsfile *ff, int parent_hn, int simple_mode); int ngp_read_group(fitsfile *ff, char *grpname, int parent_hn); /* top level API function - now defined in fitsio.h */ #ifdef __cplusplus } #endif #endif astropy-0.3/cextern/cfitsio/longnam.h0000644000175000017500000005010012243255342016107 0ustar oleole#ifndef _LONGNAME_H #define _LONGNAME_H #define fits_parse_input_url ffiurl #define fits_parse_input_filename ffifile #define fits_parse_rootname ffrtnm #define fits_file_exists ffexist #define fits_parse_output_url ffourl #define fits_parse_extspec ffexts #define fits_parse_extnum ffextn #define fits_parse_binspec ffbins #define fits_parse_binrange ffbinr #define fits_parse_range ffrwrg #define fits_parse_rangell ffrwrgll #define fits_open_memfile ffomem /* use the following special macro to test that the fitsio.h include file that was used to build the CFITSIO library is compatible with the version as included when compiling the application program */ #define fits_open_file(A, B, C, D) ffopentest( CFITSIO_SONAME, A, B, C, D) #define fits_open_data ffdopn #define fits_open_table fftopn #define fits_open_image ffiopn #define fits_open_diskfile ffdkopn #define fits_reopen_file ffreopen #define fits_create_file ffinit #define fits_create_diskfile ffdkinit #define fits_create_memfile ffimem #define fits_create_template fftplt #define fits_flush_file ffflus #define fits_flush_buffer ffflsh #define fits_close_file ffclos #define fits_delete_file ffdelt #define fits_file_name ffflnm #define fits_file_mode ffflmd #define fits_url_type ffurlt #define fits_get_version ffvers #define fits_uppercase ffupch #define fits_get_errstatus ffgerr #define fits_write_errmsg ffpmsg #define fits_write_errmark ffpmrk #define fits_read_errmsg ffgmsg #define fits_clear_errmsg ffcmsg #define fits_clear_errmark ffcmrk #define fits_report_error ffrprt #define fits_compare_str ffcmps #define fits_test_keyword fftkey #define fits_test_record fftrec #define fits_null_check ffnchk #define fits_make_keyn ffkeyn #define fits_make_nkey ffnkey #define fits_make_key ffmkky #define fits_get_keyclass ffgkcl #define fits_get_keytype ffdtyp #define fits_get_inttype ffinttyp #define fits_parse_value ffpsvc #define fits_get_keyname ffgknm #define fits_parse_template ffgthd #define fits_ascii_tform ffasfm #define fits_binary_tform ffbnfm #define fits_binary_tformll ffbnfmll #define fits_get_tbcol ffgabc #define fits_get_rowsize ffgrsz #define fits_get_col_display_width ffgcdw #define fits_write_record ffprec #define fits_write_key ffpky #define fits_write_key_unit ffpunt #define fits_write_comment ffpcom #define fits_write_history ffphis #define fits_write_date ffpdat #define fits_get_system_time ffgstm #define fits_get_system_date ffgsdt #define fits_date2str ffdt2s #define fits_time2str fftm2s #define fits_str2date ffs2dt #define fits_str2time ffs2tm #define fits_write_key_longstr ffpkls #define fits_write_key_longwarn ffplsw #define fits_write_key_null ffpkyu #define fits_write_key_str ffpkys #define fits_write_key_log ffpkyl #define fits_write_key_lng ffpkyj #define fits_write_key_fixflt ffpkyf #define fits_write_key_flt ffpkye #define fits_write_key_fixdbl ffpkyg #define fits_write_key_dbl ffpkyd #define fits_write_key_fixcmp ffpkfc #define fits_write_key_cmp ffpkyc #define fits_write_key_fixdblcmp ffpkfm #define fits_write_key_dblcmp ffpkym #define fits_write_key_triple ffpkyt #define fits_write_tdim ffptdm #define fits_write_tdimll ffptdmll #define fits_write_keys_str ffpkns #define fits_write_keys_log ffpknl #define fits_write_keys_lng ffpknj #define fits_write_keys_fixflt ffpknf #define fits_write_keys_flt ffpkne #define fits_write_keys_fixdbl ffpkng #define fits_write_keys_dbl ffpknd #define fits_copy_key ffcpky #define fits_write_imghdr ffphps #define fits_write_imghdrll ffphpsll #define fits_write_grphdr ffphpr #define fits_write_grphdrll ffphprll #define fits_write_atblhdr ffphtb #define fits_write_btblhdr ffphbn #define fits_write_exthdr ffphext #define fits_write_key_template ffpktp #define fits_get_hdrspace ffghsp #define fits_get_hdrpos ffghps #define fits_movabs_key ffmaky #define fits_movrel_key ffmrky #define fits_find_nextkey ffgnxk #define fits_read_record ffgrec #define fits_read_card ffgcrd #define fits_read_str ffgstr #define fits_read_key_unit ffgunt #define fits_read_keyn ffgkyn #define fits_read_key ffgky #define fits_read_keyword ffgkey #define fits_read_key_str ffgkys #define fits_read_key_log ffgkyl #define fits_read_key_lng ffgkyj #define fits_read_key_lnglng ffgkyjj #define fits_read_key_flt ffgkye #define fits_read_key_dbl ffgkyd #define fits_read_key_cmp ffgkyc #define fits_read_key_dblcmp ffgkym #define fits_read_key_triple ffgkyt #define fits_read_key_longstr ffgkls #define fits_free_memory fffree #define fits_read_tdim ffgtdm #define fits_read_tdimll ffgtdmll #define fits_decode_tdim ffdtdm #define fits_decode_tdimll ffdtdmll #define fits_read_keys_str ffgkns #define fits_read_keys_log ffgknl #define fits_read_keys_lng ffgknj #define fits_read_keys_lnglng ffgknjj #define fits_read_keys_flt ffgkne #define fits_read_keys_dbl ffgknd #define fits_read_imghdr ffghpr #define fits_read_imghdrll ffghprll #define fits_read_atblhdr ffghtb #define fits_read_btblhdr ffghbn #define fits_read_atblhdrll ffghtbll #define fits_read_btblhdrll ffghbnll #define fits_hdr2str ffhdr2str #define fits_convert_hdr2str ffcnvthdr2str #define fits_update_card ffucrd #define fits_update_key ffuky #define fits_update_key_null ffukyu #define fits_update_key_str ffukys #define fits_update_key_longstr ffukls #define fits_update_key_log ffukyl #define fits_update_key_lng ffukyj #define fits_update_key_fixflt ffukyf #define fits_update_key_flt ffukye #define fits_update_key_fixdbl ffukyg #define fits_update_key_dbl ffukyd #define fits_update_key_fixcmp ffukfc #define fits_update_key_cmp ffukyc #define fits_update_key_fixdblcmp ffukfm #define fits_update_key_dblcmp ffukym #define fits_modify_record ffmrec #define fits_modify_card ffmcrd #define fits_modify_name ffmnam #define fits_modify_comment ffmcom #define fits_modify_key_null ffmkyu #define fits_modify_key_str ffmkys #define fits_modify_key_longstr ffmkls #define fits_modify_key_log ffmkyl #define fits_modify_key_lng ffmkyj #define fits_modify_key_fixflt ffmkyf #define fits_modify_key_flt ffmkye #define fits_modify_key_fixdbl ffmkyg #define fits_modify_key_dbl ffmkyd #define fits_modify_key_fixcmp ffmkfc #define fits_modify_key_cmp ffmkyc #define fits_modify_key_fixdblcmp ffmkfm #define fits_modify_key_dblcmp ffmkym #define fits_insert_record ffirec #define fits_insert_card ffikey #define fits_insert_key_null ffikyu #define fits_insert_key_str ffikys #define fits_insert_key_longstr ffikls #define fits_insert_key_log ffikyl #define fits_insert_key_lng ffikyj #define fits_insert_key_fixflt ffikyf #define fits_insert_key_flt ffikye #define fits_insert_key_fixdbl ffikyg #define fits_insert_key_dbl ffikyd #define fits_insert_key_fixcmp ffikfc #define fits_insert_key_cmp ffikyc #define fits_insert_key_fixdblcmp ffikfm #define fits_insert_key_dblcmp ffikym #define fits_delete_key ffdkey #define fits_delete_str ffdstr #define fits_delete_record ffdrec #define fits_get_hdu_num ffghdn #define fits_get_hdu_type ffghdt #define fits_get_hduaddr ffghad #define fits_get_hduaddrll ffghadll #define fits_get_hduoff ffghof #define fits_get_img_param ffgipr #define fits_get_img_paramll ffgiprll #define fits_get_img_type ffgidt #define fits_get_img_equivtype ffgiet #define fits_get_img_dim ffgidm #define fits_get_img_size ffgisz #define fits_get_img_sizell ffgiszll #define fits_movabs_hdu ffmahd #define fits_movrel_hdu ffmrhd #define fits_movnam_hdu ffmnhd #define fits_get_num_hdus ffthdu #define fits_create_img ffcrim #define fits_create_imgll ffcrimll #define fits_create_tbl ffcrtb #define fits_create_hdu ffcrhd #define fits_insert_img ffiimg #define fits_insert_imgll ffiimgll #define fits_insert_atbl ffitab #define fits_insert_btbl ffibin #define fits_resize_img ffrsim #define fits_resize_imgll ffrsimll #define fits_delete_hdu ffdhdu #define fits_copy_hdu ffcopy #define fits_copy_file ffcpfl #define fits_copy_header ffcphd #define fits_copy_data ffcpdt #define fits_write_hdu ffwrhdu #define fits_set_hdustruc ffrdef #define fits_set_hdrsize ffhdef #define fits_write_theap ffpthp #define fits_encode_chksum ffesum #define fits_decode_chksum ffdsum #define fits_write_chksum ffpcks #define fits_update_chksum ffupck #define fits_verify_chksum ffvcks #define fits_get_chksum ffgcks #define fits_set_bscale ffpscl #define fits_set_tscale fftscl #define fits_set_imgnull ffpnul #define fits_set_btblnull fftnul #define fits_set_atblnull ffsnul #define fits_get_colnum ffgcno #define fits_get_colname ffgcnn #define fits_get_coltype ffgtcl #define fits_get_coltypell ffgtclll #define fits_get_eqcoltype ffeqty #define fits_get_eqcoltypell ffeqtyll #define fits_get_num_rows ffgnrw #define fits_get_num_rowsll ffgnrwll #define fits_get_num_cols ffgncl #define fits_get_acolparms ffgacl #define fits_get_bcolparms ffgbcl #define fits_get_bcolparmsll ffgbclll #define fits_iterate_data ffiter #define fits_read_grppar_byt ffggpb #define fits_read_grppar_sbyt ffggpsb #define fits_read_grppar_usht ffggpui #define fits_read_grppar_ulng ffggpuj #define fits_read_grppar_sht ffggpi #define fits_read_grppar_lng ffggpj #define fits_read_grppar_lnglng ffggpjj #define fits_read_grppar_int ffggpk #define fits_read_grppar_uint ffggpuk #define fits_read_grppar_flt ffggpe #define fits_read_grppar_dbl ffggpd #define fits_read_pix ffgpxv #define fits_read_pixll ffgpxvll #define fits_read_pixnull ffgpxf #define fits_read_pixnullll ffgpxfll #define fits_read_img ffgpv #define fits_read_imgnull ffgpf #define fits_read_img_byt ffgpvb #define fits_read_img_sbyt ffgpvsb #define fits_read_img_usht ffgpvui #define fits_read_img_ulng ffgpvuj #define fits_read_img_sht ffgpvi #define fits_read_img_lng ffgpvj #define fits_read_img_lnglng ffgpvjj #define fits_read_img_uint ffgpvuk #define fits_read_img_int ffgpvk #define fits_read_img_flt ffgpve #define fits_read_img_dbl ffgpvd #define fits_read_imgnull_byt ffgpfb #define fits_read_imgnull_sbyt ffgpfsb #define fits_read_imgnull_usht ffgpfui #define fits_read_imgnull_ulng ffgpfuj #define fits_read_imgnull_sht ffgpfi #define fits_read_imgnull_lng ffgpfj #define fits_read_imgnull_lnglng ffgpfjj #define fits_read_imgnull_uint ffgpfuk #define fits_read_imgnull_int ffgpfk #define fits_read_imgnull_flt ffgpfe #define fits_read_imgnull_dbl ffgpfd #define fits_read_2d_byt ffg2db #define fits_read_2d_sbyt ffg2dsb #define fits_read_2d_usht ffg2dui #define fits_read_2d_ulng ffg2duj #define fits_read_2d_sht ffg2di #define fits_read_2d_lng ffg2dj #define fits_read_2d_lnglng ffg2djj #define fits_read_2d_uint ffg2duk #define fits_read_2d_int ffg2dk #define fits_read_2d_flt ffg2de #define fits_read_2d_dbl ffg2dd #define fits_read_3d_byt ffg3db #define fits_read_3d_sbyt ffg3dsb #define fits_read_3d_usht ffg3dui #define fits_read_3d_ulng ffg3duj #define fits_read_3d_sht ffg3di #define fits_read_3d_lng ffg3dj #define fits_read_3d_lnglng ffg3djj #define fits_read_3d_uint ffg3duk #define fits_read_3d_int ffg3dk #define fits_read_3d_flt ffg3de #define fits_read_3d_dbl ffg3dd #define fits_read_subset ffgsv #define fits_read_subset_byt ffgsvb #define fits_read_subset_sbyt ffgsvsb #define fits_read_subset_usht ffgsvui #define fits_read_subset_ulng ffgsvuj #define fits_read_subset_sht ffgsvi #define fits_read_subset_lng ffgsvj #define fits_read_subset_lnglng ffgsvjj #define fits_read_subset_uint ffgsvuk #define fits_read_subset_int ffgsvk #define fits_read_subset_flt ffgsve #define fits_read_subset_dbl ffgsvd #define fits_read_subsetnull_byt ffgsfb #define fits_read_subsetnull_sbyt ffgsfsb #define fits_read_subsetnull_usht ffgsfui #define fits_read_subsetnull_ulng ffgsfuj #define fits_read_subsetnull_sht ffgsfi #define fits_read_subsetnull_lng ffgsfj #define fits_read_subsetnull_lnglng ffgsfjj #define fits_read_subsetnull_uint ffgsfuk #define fits_read_subsetnull_int ffgsfk #define fits_read_subsetnull_flt ffgsfe #define fits_read_subsetnull_dbl ffgsfd #define ffcpimg fits_copy_image_section #define fits_compress_img fits_comp_img #define fits_decompress_img fits_decomp_img #define fits_read_col ffgcv #define fits_read_colnull ffgcf #define fits_read_col_str ffgcvs #define fits_read_col_log ffgcvl #define fits_read_col_byt ffgcvb #define fits_read_col_sbyt ffgcvsb #define fits_read_col_usht ffgcvui #define fits_read_col_ulng ffgcvuj #define fits_read_col_sht ffgcvi #define fits_read_col_lng ffgcvj #define fits_read_col_lnglng ffgcvjj #define fits_read_col_uint ffgcvuk #define fits_read_col_int ffgcvk #define fits_read_col_flt ffgcve #define fits_read_col_dbl ffgcvd #define fits_read_col_cmp ffgcvc #define fits_read_col_dblcmp ffgcvm #define fits_read_col_bit ffgcx #define fits_read_col_bit_usht ffgcxui #define fits_read_col_bit_uint ffgcxuk #define fits_read_colnull_str ffgcfs #define fits_read_colnull_log ffgcfl #define fits_read_colnull_byt ffgcfb #define fits_read_colnull_sbyt ffgcfsb #define fits_read_colnull_usht ffgcfui #define fits_read_colnull_ulng ffgcfuj #define fits_read_colnull_sht ffgcfi #define fits_read_colnull_lng ffgcfj #define fits_read_colnull_lnglng ffgcfjj #define fits_read_colnull_uint ffgcfuk #define fits_read_colnull_int ffgcfk #define fits_read_colnull_flt ffgcfe #define fits_read_colnull_dbl ffgcfd #define fits_read_colnull_cmp ffgcfc #define fits_read_colnull_dblcmp ffgcfm #define fits_read_descript ffgdes #define fits_read_descriptll ffgdesll #define fits_read_descripts ffgdess #define fits_read_descriptsll ffgdessll #define fits_read_tblbytes ffgtbb #define fits_write_grppar_byt ffpgpb #define fits_write_grppar_sbyt ffpgpsb #define fits_write_grppar_usht ffpgpui #define fits_write_grppar_ulng ffpgpuj #define fits_write_grppar_sht ffpgpi #define fits_write_grppar_lng ffpgpj #define fits_write_grppar_lnglng ffpgpjj #define fits_write_grppar_uint ffpgpuk #define fits_write_grppar_int ffpgpk #define fits_write_grppar_flt ffpgpe #define fits_write_grppar_dbl ffpgpd #define fits_write_pix ffppx #define fits_write_pixll ffppxll #define fits_write_pixnull ffppxn #define fits_write_pixnullll ffppxnll #define fits_write_img ffppr #define fits_write_img_byt ffpprb #define fits_write_img_sbyt ffpprsb #define fits_write_img_usht ffpprui #define fits_write_img_ulng ffppruj #define fits_write_img_sht ffppri #define fits_write_img_lng ffpprj #define fits_write_img_lnglng ffpprjj #define fits_write_img_uint ffppruk #define fits_write_img_int ffpprk #define fits_write_img_flt ffppre #define fits_write_img_dbl ffpprd #define fits_write_imgnull ffppn #define fits_write_imgnull_byt ffppnb #define fits_write_imgnull_sbyt ffppnsb #define fits_write_imgnull_usht ffppnui #define fits_write_imgnull_ulng ffppnuj #define fits_write_imgnull_sht ffppni #define fits_write_imgnull_lng ffppnj #define fits_write_imgnull_lnglng ffppnjj #define fits_write_imgnull_uint ffppnuk #define fits_write_imgnull_int ffppnk #define fits_write_imgnull_flt ffppne #define fits_write_imgnull_dbl ffppnd #define fits_write_img_null ffppru #define fits_write_null_img ffpprn #define fits_write_2d_byt ffp2db #define fits_write_2d_sbyt ffp2dsb #define fits_write_2d_usht ffp2dui #define fits_write_2d_ulng ffp2duj #define fits_write_2d_sht ffp2di #define fits_write_2d_lng ffp2dj #define fits_write_2d_lnglng ffp2djj #define fits_write_2d_uint ffp2duk #define fits_write_2d_int ffp2dk #define fits_write_2d_flt ffp2de #define fits_write_2d_dbl ffp2dd #define fits_write_3d_byt ffp3db #define fits_write_3d_sbyt ffp3dsb #define fits_write_3d_usht ffp3dui #define fits_write_3d_ulng ffp3duj #define fits_write_3d_sht ffp3di #define fits_write_3d_lng ffp3dj #define fits_write_3d_lnglng ffp3djj #define fits_write_3d_uint ffp3duk #define fits_write_3d_int ffp3dk #define fits_write_3d_flt ffp3de #define fits_write_3d_dbl ffp3dd #define fits_write_subset ffpss #define fits_write_subset_byt ffpssb #define fits_write_subset_sbyt ffpsssb #define fits_write_subset_usht ffpssui #define fits_write_subset_ulng ffpssuj #define fits_write_subset_sht ffpssi #define fits_write_subset_lng ffpssj #define fits_write_subset_lnglng ffpssjj #define fits_write_subset_uint ffpssuk #define fits_write_subset_int ffpssk #define fits_write_subset_flt ffpsse #define fits_write_subset_dbl ffpssd #define fits_write_col ffpcl #define fits_write_col_str ffpcls #define fits_write_col_log ffpcll #define fits_write_col_byt ffpclb #define fits_write_col_sbyt ffpclsb #define fits_write_col_usht ffpclui #define fits_write_col_ulng ffpcluj #define fits_write_col_sht ffpcli #define fits_write_col_lng ffpclj #define fits_write_col_lnglng ffpcljj #define fits_write_col_uint ffpcluk #define fits_write_col_int ffpclk #define fits_write_col_flt ffpcle #define fits_write_col_dbl ffpcld #define fits_write_col_cmp ffpclc #define fits_write_col_dblcmp ffpclm #define fits_write_col_null ffpclu #define fits_write_col_bit ffpclx #define fits_write_nulrows ffprwu #define fits_write_nullrows ffprwu #define fits_write_colnull ffpcn #define fits_write_colnull_str ffpcns #define fits_write_colnull_log ffpcnl #define fits_write_colnull_byt ffpcnb #define fits_write_colnull_sbyt ffpcnsb #define fits_write_colnull_usht ffpcnui #define fits_write_colnull_ulng ffpcnuj #define fits_write_colnull_sht ffpcni #define fits_write_colnull_lng ffpcnj #define fits_write_colnull_lnglng ffpcnjj #define fits_write_colnull_uint ffpcnuk #define fits_write_colnull_int ffpcnk #define fits_write_colnull_flt ffpcne #define fits_write_colnull_dbl ffpcnd #define fits_write_ext ffpextn #define fits_read_ext ffgextn #define fits_write_descript ffpdes #define fits_compress_heap ffcmph #define fits_test_heap fftheap #define fits_write_tblbytes ffptbb #define fits_insert_rows ffirow #define fits_delete_rows ffdrow #define fits_delete_rowrange ffdrrg #define fits_delete_rowlist ffdrws #define fits_delete_rowlistll ffdrwsll #define fits_insert_col fficol #define fits_insert_cols fficls #define fits_delete_col ffdcol #define fits_copy_col ffcpcl #define fits_copy_rows ffcprw #define fits_modify_vector_len ffmvec #define fits_read_img_coord ffgics #define fits_read_img_coord_version ffgicsa #define fits_read_tbl_coord ffgtcs #define fits_pix_to_world ffwldp #define fits_world_to_pix ffxypx #define fits_get_image_wcs_keys ffgiwcs #define fits_get_table_wcs_keys ffgtwcs #define fits_find_rows fffrow #define fits_find_first_row ffffrw #define fits_find_rows_cmp fffrwc #define fits_select_rows ffsrow #define fits_calc_rows ffcrow #define fits_calculator ffcalc #define fits_calculator_rng ffcalc_rng #define fits_test_expr fftexp #define fits_create_group ffgtcr #define fits_insert_group ffgtis #define fits_change_group ffgtch #define fits_remove_group ffgtrm #define fits_copy_group ffgtcp #define fits_merge_groups ffgtmg #define fits_compact_group ffgtcm #define fits_verify_group ffgtvf #define fits_open_group ffgtop #define fits_add_group_member ffgtam #define fits_get_num_members ffgtnm #define fits_get_num_groups ffgmng #define fits_open_member ffgmop #define fits_copy_member ffgmcp #define fits_transfer_member ffgmtf #define fits_remove_member ffgmrm #endif astropy-0.3/cextern/cfitsio/changes.txt0000644000175000017500000055216612243255342016477 0ustar oleole Log of Changes Made to CFITSIO - modified Makefile.in so that doing 'make distclean' does not delete new config.sub and config.guess files that were recently added. Version 3.35 - 26 June 2013 (1st beta release on 24 May) - fixed problem with the default tile size when compressing images with fpack using the Hcompress algorithm. - fixed returned value ("status" instead of "*status") - in imcompress.c, declared some arrays that are used to store the dimensions of the image from 'int' to 'long', to support very large images (at least on systems where sizeof(long) = 8), - modified the routines that convert a string value to a float or double to prevent them from returning a NaN or Inf value if the string is "NaN" or "Inf" (as can happen with gcc implementation of the strtod function). - removed/replaced the use of the assert() functions when locking or unlocking threads because they did not work correctly if NDEBUG is defined. - made modifications to the way the command-line file filters are parsed to 1) remove the 1024-character limit when specifying a column filter, 2) fixed a potential character buffer-overflow risk in fits_get_token, and 3) improved the parsing logic to remove any possible of confusing 2 slash characters ("//") in the string as the beginning of a comment string. - modified configure and Makefile.in so that when building CFITSIO as a shared library on linux or Mac platforms, it will use the SONAME convention to indicate whether each new release of the CFITSIO library is binary-compatible with the previous version. Application programs that link with the shared library will not need to be recompiled as long as the versions are compatible. In practice, this means that the shared library binary file that is created (on Linux systems) will have a name like 'libcfitsio.so.I.J.K', where I is the SONAME version number, J is the major CFITSIO version number (e.g. 3), and K is the minor CFITSIO version number (e.g., 34). Two link files will also be created such that libcfitsio.so -> libcfitsio.so.I, and libcfitsio.so.I -> libcfitsio.I.J.K Application programs will still run correctly with the new version of CFITSIO as long as the 'I' version number remains the same, but the applications will fail to run if the 'I' number changes, thus alerting the user that the application must be rebuilt. - fixed bug in fits_insert_col when computing the new table row width when inserting a '1Q' variable length array column. - modified the image compression routines so that the output compressed image (stored in a FITS binary table) uses the '1Q' variable length array format (instead of '1P') when the input file is larger than 4 GB. - added support for "compression directive" keywords which indicate how that HDU should be compressed (e.g., which compression algorithm to use, what tiling pattern to use, etc.). The values of these keywords will override the compression parameters that were specified on the command line when running the fpack FITS file compression program. - globally changed the variable and/or subroutine name "dither_offset" to "dither_seed" and "quantize_dither" to "quantize_method" so that the names more accurately reflects their purpose. - added support for a new SUBTRACTIVE_DITHER_2 method when compressing floating point images. The only difference with the previous method is that pixels with a value exactly equal to 0.0 will not be dithered, and instead will be exactly preserved when the image is compressed. - added support for an alias of "RICE_ONE" for "RICE_1" as the value of the ZCMPTYPE keyword, which gives the name of the image compression algorithm. This alias is used if the new SUBTRACTIVE_DITHER_2 option is used, to prevent old versions of funpack from creating a corrupted uncompressed image file. Only newer versions of funpack will recognize this alias and be able to uncompress the image. - made performance improvement to fits_read_compressed_img so that when reading a section of an compressed image that includes only every nth pixel in some dimension, it will only uncompressed a tile if there are actually any pixels of interest in that tile. - fixed several issues with the beta FITS binary table compression code that is used by fpack: added support for zero-length vector columns, made improvements to the output report when using the -T option in fpack, changed the default table compression method to 'Rice' instead of 'Best', and now writes the 'ZTILELEN' keyword to document the number of table rows in each tile. - fixed error in ffbinit in calculating the total length of the binary table extension if the THEAP keyword was used to override the default starting location of the heap. Version 3.34 - 20 March 2013 - modified configure and configure.in to support cross-compiled cfitsio as a static library for Windows on a Linux platform using MXE (http://mxe.cc) - a build environment for mingw32. (contributed by Niels Kristian Bech Jensen) - added conditional compilation statementsfor the mingw32 environment in drvrfile.c because mingw32 does not include the ftello and fseeko functions. (contributed by Niels Kristian Bech Jensen) - fixed a potential bug in ffcpcl (routine to copy a column from one table to another table) when dealing with the rare case of a '0X' column (zero length bit column). - fixed an issue in the routines that update or modify string-valued keyword values, as a result of the change to ffc2s in the previous release. These routines would exit with a 204 error status if the current value of the keyword to be updated or modified is null. - fixed typo in the previous modification that was intended to ignore numerical overflows in Hcompress when decompressing an image. - moved the 'startcol' static variable out of the ffgcnn routine and instead added it as a member of the 'FITSfile' structure that is defined in fitsio.h. This removes a possible race condition in ffgcnn in multi-threaded environments. Version 3.33 - 14 Feb 2013 - modified the imcomp_decompress_tile routine to ignore any numerical overflows that might occur when using Hcompress to decompress the image. If Hcompress is used in its 'lossy' mode, the uncompressed image pixel values may slightly exceed the range of an integer*2 variable. This is generally of no consequence, so we can safely ignore any overflows in this case and just clip the values to the legal range. - the default tiling pattern when writing a tile-compressed image has been changed. The old behavior was to compress the whole image as one single large tile. This is often not optimal when dealing with large images, so the new default behavior is to treat each row of the image as one tile. This is the same default behavior as in the standalone fpack program. The default tile size can be overridden by calling fits_set_tile_dim. - fixed bug that resulted in a corrupted output FITS image when attempting to write a float or double array of values to a tile-compressed integer data type image. CFITSIO does not support implicit data type conversion in this case and now correctly returns an appropriate error status. - modified ricecomp.c to define the nonzero_count lookup table as an external variable, rather then dynamically allocating it within the 3 routines that use it. This simplifies the code and eliminates the need for special thread locking and unlocking statements. (Thanks to Lars Kr. Lundin for this suggestion). - modifed how the uncompressed size of a gzipped file is computed in the mem_compress_open routine in drvrmem.c. Since gzip only uses 4 bytes in the compressed file header to store the original file size, one may need to apply a modulo 2^32 byte correction in some cases. The logic here was modified to allow for corner cases (e.g., very small files, and when running on 32-bit platforms that do not support files larger than 2^31 bytes in size). - added new public routine to construct a 80 keyword record from the 3 input component strings, i.e, the keyword name string, the value string, and the comment string: fits_make_key/ffmkky. (This was already an undocumented internal routine in previous versions of CFITSIO). - modified ffc2s so that if the input keyword value string is a null string, then it will return a VALUE_UNDEFINED (204) status value. This makes it consistent with the behavior when attempting to read a null keyword (which has no value) as a logical or as a number (which also returns the 204 error). This should only affect cases where the header keyword does not have an equal sign followed by a space character in columns 9 and 10 of the header record. - Changed the "char *" parameter declarations to "const char *" in many of the routines (mainly the routines that modify or update keywords) to avoid compiler warnings or errors from C++ programs that tend to be more rigorous about using "const char *" when appropriate. - added support for caching uncompressed image tiles, so that the tile does not need to be uncompressed again if the application program wants to read more data from the same tile. This required changes to the main FITS file structure that is defined in fitsio.h, as well as changes to imcompress.c. - enhanced the previous modification to drvrfile.c to handle additional user cases when running in the HEASARC's Hera environment. Version 3.32 - Oct 2012 - fixed flaw in the way logical columns (TFORM = 'L') in binary tables were read which caused an illegal value of 1 in the column to be interpreted as a 'T' (TRUE) value. - extended the column filtering syntax in the CFITSIO file name parser to enable users and scripts to append new COMMENT or HISTORY keyword into the header of the filtered file (provided by Craig Markwardt). For example, fcopy "infile.fits[col #HISTORY='Processed on 2012-10-05']" outfile.fits will append this header keyword: "HISTORY Processed on 2012-10-05" - small change to the code that opens and reads an ASCII region file to return an error if the file is empty. - fixed obscure sign propagation error when attempting to read the uncompressed size of a gzipped FITS file. This resulted in a memory allocation error if the gzipped file had an uncompressed file size between 2^31 and 2^32 bytes. Fix supplied by Gudlaugur Johannesson (Stanford). Version 3.31 - 18 July 2012 - enhanced the CFITSIO column filtering syntax to allow the comma, in addition to the semi-colon, to be used to separate clauses, for example: [col X,Y;Z = max(X,Y)]. This was done because users are not allowed to enter the semi-colon character in the on-line Hera data processing system due to computer security concerns. - enhanced the CFITSIO extended filename syntax to allow specifying image compression parameters (e.g. '[compress Rice]') when opening an existing FITS file with write access. The specified compression parameters will be used by default if more images are appended to the existing file. - modified drvrfile.c to do additional file security checks when CFITSIO is running within the HEASARC's Hera software system. In this case CFITSIO will not allow FITS files to be created outside of the user's individual Hera data directory area. - fixed an issue in fpack and funpack on Windows machines, caused by the fact that the 'rename' function behaves differently on Windows in that it does not clobber an existing file, as it does on Unix platforms. - fixed bug in the way byte-swapping was being performed when writing integer*8 null values to an image or binary table column. - added the missing macro definition for fffree to fitsio.h. - modified the low level table read and write functions in getcol*.c and putcol*.c to remove the 32-bit limitation on the number of elements. These routines now support reading and writing more than 2**31 elements at one time. Thanks to Keh-Cheng Chu (Stanford U.) for the patch. - modified Makefile.in so that the shared libcfitsio.so is linked against pthreads and libm. Version 3.30 - 11 April 2012 Enhancements - Added new routine called fits_is_reentrant which returns 1 or 0 depending on whether or not CFITSIO was compiled with the -D_REENTRANT directive. This can be used to determine if it is safe to use CFITSIO in multi-threaded programs. - Implemented much faster byte-swapping algorithms in swapproc.c based on code provided by Julian Taylor at ESO, Garching. These routines significantly improve the FITS image read and write speed (by more than a factor of 2 in some cases) on little-endian machines (e.g., Linux and Microsoft Windows and Macs running on x86 CPUs) where byte-swapping is required when reading and writing data in FITS files. This has no effect on big-endian machines (e.g. Motorola CPUs and some IBM systems). Even faster byte-swapping performance can be achieved in some cases by invoking the new "--enable-sse2" or "--enable-ssse3" configure options when building CFITSIO on machines that have CPUs and compilers that support the SSE2 and SSSE3 machine instructions. - added additional support for implicit data type conversion in cases where the floating point image has been losslessly compressed with gzip. The pixels in these compressed images can now be read back as arrays of short, int, and long integers as well as single and double precision floating-point. - modified fitsio2.h and f77_wrap.h to recognize IBM System z mainframes by testing if __s390x__ or __s390__ is defined. - small change to ffgcrd in getkey.c so that it supports reading a blank keyword (e.g., a keyword whose name simply contains 8 space characters). Bug Fixes - fixed a bug in imcomp_decompress_tile that caused the tile-compressed image to be uncompressed incorrectly (even though the tile-compressed image itself was written correctly) under the following specific conditions: - the original FITS image has a "float" datatype (R*4) - one or more of the image tiles cannot be compressed using the standard quantization method and instead are losslessly compressed with gzip - the pixels in these tiles are not all equal to zero (this bug does affect tiles where all the pixels are equal to zero) - the program that is reading the compressed image uses CFITSIO's "implicit datatype conversion" feature to read the "float" image back into an array of "double" pixel values. If all these conditions are met, then the returned pixel values in the affected image tiles will be garbage, with values often ranging up to 10**34. Note that this bug does not affect the fpack/funpack programs, because funpack does not use CFITSIO's implicit datatype conversion feature when uncompressing the image. Version 3.29 - 2 December 2011 Enhancements - modified Makefile.in to allow configure to override the lib and include destination directories. - added (or restored actually) support for tile compression of 1-byte integer images in imcomp_compress_tile. Support for that data type was overlooked during recent updates to this routine. - modified the fits_get_token command-line parsing routine to perform more rigorous checks to determine if the token can be interpreted as a number or not. - made small modification to fpack.c to not allow the -i2f option (convert image from integer to floating point) with the "-g -q 0" option (do lossless gzip compression). It is more efficient to simply use the -g option alone. - made modifications to fitsio.h and drvrfile.c to support reading and writing large FITS files (> 2.1 GB) when building CFITSIO using Microsoft Visual C++ on Windows platforms. - added new WCS routine (ffgicsa) which returns the WCS keyword values for a particular WCS version ('A' - 'Z'). Bug Fixes - fixed a problem with multi-threaded apps that open/close FITS files simultaneously by putting mutex locks around the call to fits_already_open and in fits_clear_Fptr. - fixed a bug when using the 'regfilter' function to select a subset of the rows in a FITS table that have coordinates that lie within a specified spatial region on the sky. This bug only affects the rarely used panda (and epanda and bpanda) region shapes in which the region is defined by the intersection of an annulus and a pie-shaped wedge. The previous code (starting with version 3.181 of CFITSIO where support for the panda region was first introduced) only worked correctly if the 2 angles that define the wedge have values between -180 and +180. If not, then fewer rows than expected may have been selected from the table. - fixed the extended filename parser so that when creating a histogram by binning 2 table columns, if a keyword or column name is given as the weighting factor, then the output histrogram image will have a floating point datatype, not the default integer datatype as is the case when no weight is specified (e.g. with a filename like "myfile.fits[bin x,y; weight_column]" - added fix to the code in imcompress.c to work around a problem with dereferencing the value of a pointer, in cases where the address of that pointer has not been defined (e.g., the nulval variable). - modified the byte shuffling algorithm in fits_shuffle_8bytes to work around a strange bug in the proprietary SunStudioExpress C compiler under OpenSolaris. - removed spurious messages on the CFITSIO error stack when opening a FITS file with FTP (in drvrnet.c); Version 3.28 - 12 May 2011 - added an enhancement to the tiled-image compression method when compressing floating-point image using the standard (lossy) quantization method. In cases where an image tile cannot be quantized, The floating-point pixel values will be losslessly compressed with gzip before writing them to the tile- compressed file. Previously, the uncompressed pixel values would have been written to the file, which obviously requires more disk space. - made significant internal changes to the structure of the tile compression and uncompression routines in imcompress.c to make them more modular and easier to maintain. - modified configure.in and configure to force it to build a Universal binary on Mac OS X. - modified the ffiter function in putcol.c to properly clean up allocated memory if an error occurs. - in quantize.c, when searching for the min and max values in a float array, initialize the max value to -FLT_MAX instead of FLT_MIN (and similarly for double array). Version 3.27 - 3 March 2011 Enhancements - added new routines fits_read_str and fits_delete_str which read or delete, respectively, a header keyword record that contains a specified character string. - added a new routine called fits_free_memory which frees the memory that fits_read_key_longstr allocated for the long string keyword value. - enhanced the ffmkky routine in fitscore.c to not put a space before the equals sign when writing long string-valued keywords using the ESO HIERARCH keyword convention, if that extra character is needed to fit the length of the keyword name + value string within the 80-character FITS keyword record. - made small change to fits_translate_keyword to support translation of blank keywords (where the name = 8 blank characters) - modified fpack so that it uses the minimum of the 2nd, 3rd, and 5th order MAD noise values when quantizing and compressing a floating point image. This is more conservative than just using the 3rd order MAD value alone. - added new routine imcomp_copy_prime2img to imcompress.c that is used by funpack to copy any keywords that may have been added to the primary array of the compressed image file (a null image) back into the header of the uncompressed image. - enhanced the fits_quantize_float and fits_quantize_double routines in quantize.c to also compress the tile if it is completely filled with null values. Previously, this type of tile would have been written to the output compressed image without any compression. - enhanced imcomp_decompress_tile to support implicit datatype conversion when reading a losslessly compressed (with gzip) real*4 image into an array of real*8 values. - in imcompress.c, removed possible attempt to free memory that had not been allocated. Version 3.26 - 30 December 2010 Enhancements - defined 2 new macros in fitsio.h: #define CFITSIO_MAJOR 3 #define CFITSIO_MINOR 26 These may be used within other macros to detect the CFITSIO version number at compile time. - modified group.c to initialize the output URL to a null string in fits_url2relurl. Also added more robust tests to see if 2 file pointers point to the same file. - enhanced the template keyword parsing code in grparser.c to support the 'D' exponent character in the ASCII representation of floating point keyword values (as in TVAL = 1.23D03). Previously, the parser would have written this keyword with a string value (TVAL = '1.23D03'). - modified the low-level routines that write a keyword record to a FITS header so that they silently replace any illegal characters (ASCII values less than 32 or greater than 126) with an ASCII space character. Previously, these routines would have returned with an error when encountering these illegal characters in the keyword record (most commonly tab, carriage return, and line feed characters). - made substantial internal changes to imcompress.c in preparation for possible future support for compression methods for FITS tables analogous to the tiled image compression method. - replaced all the source code in CFITSIO that was distributed under the GNU General Public License with freely available code. In particular, the gzip file compression and uncompression code was replaced by the zlib compression library. Thus, beginning with this version 3.26 of CFITSIO, other software applications may freely use CFITSIO without necessarily incurring any GNU licensing requirement. See the License.txt file for the CFITSIO licensing requirements. - added support for using cfitsio in different 'locales' which use a comma, not a period, as the decimal point character in ASCII representation of a floating point number (e.g., France). This affects how floating point keyword values and floating point numbers in ASCII tables are read and written with the 'printf' and 'strtod' functions. - added a new utility routine called fits_copy_rows/ffcprw that copies a specified range of rows from one table to another. - enhanced the test for illegal ASCII characters in a header (fftrec) to print out the name of the offending character (e.g TAB or Line Feed) as well as the Hex value of the character. - modified ffgtbc (in fitscore.c) to support nonstandard vector variable length array columns in binary tables (e.g. with TFORMn = 2000PE(500)'). - modified the configure file to add "-lm" when linking CFITSIO on Solaris machines. - added new routine, fits_get_inttype, to parse an integer keyword value string and return the minimum integer datatype (TBYTE, TSHORT, TLONG, TLONGLONG) required to store the integer value. - added new routine, fits_convert_hdr2str, which is similar to fits_hdr2str except that if the input HDU is a tile compressed image (stored in a binary table) then it will first convert that header back to that of a normal uncompressed FITS image before concatenating the header keyword records. - modified the file template reading routine (ngp_line_from_file in grparser.c) so that it ignores any carriage return characters (\r) in the line, that might be present, e.g. if the file was created on a Windows machine that uses \r\n as end of line characters. - modified the ffoptplt routine in cfileio.c to check if the PCOUNT keyword in the template file has a non-zero value, and if so, resets it to zero in the newly created file. Bug Fixes - fixed a bug when uncompressing floating-point images that contain Nan values on some 64-bit platforms. - fixed a bug when updating the value of the CRPIXn world coordinate system keywords when extracting a subimage from larger FITS image, using the extended CFITSIO syntax (e.g. myimage[1:500:2, 1:500:2]). This bug only affects cases where the pixel increment value is not equal to 1, and caused the coordinate grid to be shifted by between 0.25 pixels (in the case of a pixel increment of 2) and 0.5 pixels (for large pixel increment values). - fixed a potential string buffer overflow error in the ffmkls routine that modifies the value and comment strings in a keyword that uses the HEASARC long string keyword convention. - fixed a bug in imcompress.c that could cause programs to abort on 64-bit machines when using gzip to tile-compress images. Changed the declaration of clen in imcomp_compress_tile from int to size_t. Version 3.25 - 9 June 2010 - fixed bug that was introduced in version 3.13 that broke the ability to reverse an image section along the y-axis with an image section specifier like this: myimage.fits[*,-*]. This bug caused the output image to be filled with zeros. - fixed typo in the definition of the ftgprh Fortran wrapper routine in f77_wrap3.c. - modified the cfitsio.pc.in configuration file to make the lib path a variable instead of hard coding the path. The provides more flexibility for projects such as suse and fedora when building CFITSIO. - fixed bug in imcomp_compress_tile in imcompress.c which caused null pixel values to be written incorrectly in the rare case where the floating-point tile of pixels could not be quantized into integers. - modified imcompress.c to add a new specialized routine to uncompress an input image and then write it to a output image on a tile by tile basis. This appears to be faster than the old method of uncompressing the whole image into memory before writing it out. It also supports large images with more than 2**31 pixels. - made trivial changes to 2 statements in drvrfile.c to suppress nuisance compiler warnings. - some compilers define CLOCKS_PER_SEC as a double instead of an integer, so added an explicted integer type conversion to 2 statements in imcompress.c that used this macro. - removed debugging printf statements in drvrnet.c (15 July) Version 3.24 - 26 January 2010 - modified fits_translate_keywords so that it silently ignores any illegal ASCII characters in the value or comment fields of the input FITS file. Otherwise, fpack would abort without compressing input files that contained this minor violation of the FITS rules. - added support for Super H cpu in fitsio2.h - updated funpack to correctly handle the -S option, and to use a more robust algorithm for creating temporary output files. - modified the imcomp_compress_tile routine to support the NOCOMPRESS debugging option for real*4 images. Version 3.23 - 7 January 2010 - reduced the default value for the floating point image quantization parameter (q) from 16 to 4. This parameter is used when tile compressing floating point images. This change will increase the average compression ratio for floating point images from about 4.6 to about 6.5 without losing any significant information in the image. - enhanced the template keyword parsing routine to reject a header template string that only contains a sequence of dashes. - enhanced the ASCII region file reading routine to allow tabs as well as spaces between fields in the file. - got rid of bogus error message when calling fits_update_key_longstr - Made the error message more explicit when CFITSIO tries to write to a GZIP compressed file. Instead of just stating "cannot write to a READONLY file", it will say "cannot write to a GZIP compressed file". Version 3.22 - 28 October 2009 - added an option (in imcompress.c) to losslessly compress floating point images, rather than using the default integer scaling method. This option is almost never useful in practice for astronomical images (because the amount of compression is so poor), but it has been added for test comparison purposes. - enhanced the dithering option when quantizing and compressing floating point images so that a random dithering starting point is used, so that the same dithering pattern does not get used for every image. - modified the architecture setup section of fitsio2.h to support the 64-core 8x8-architecture Tile64 platform (thanks to Ken Mighell, NOAO) Fixes - fixed a problem that was introduced in version 3.13 of CFITSIO in cases where a program writes it own END keyword to the header instead of letting CFITSIO do it, as is strongly recommended. In one case this caused CFITSIO to rewrite the END keyword and any blank fill keywords in the header many times, causing a noticeable slow-down in the FITS file writing speed. Version 3.21 - 24 September 2009 - fixed bug in cfileio.c that caused CFITSIO to crash with a bus error on Mac OS X if CFITSIO was compiled with multi-threaded support (with the --enable-reentrant configure option). The Mac requires an additional thread initialization step that is not required on Linux machines. Even with this fix, occasional bus errors have been seen on some Mac platforms, The bus errors are seen when running the thread_test.c program. The bus errors are very intermittent, and occur less than about 1% of the time, on the affected platforms. These bus errors have not been seen on Linux platforms. - fixed invalid C comment delimiter ("//*" should have been "/*") in imcompress.c. - Increased the CFITSIO version number string length in fpackutil.c, to fix problem on some platforms when running fpack -V or funpack -V. Also modified the output format of the fpack -L command. Version 3.20 - 31 August 2009 - modified configure.in and configure so that it will build the Fortran interface routines by default, even if no Fortran compiler is found in the user's path. Building the interface routines may be disabled by specifying FC="none". This was done at the request of users who obtained CFITSIO from some other standard linux distributions, where CFITSIO was apparently built in an environment that had no Fortran compiler and hence did not build the Fortran wrappers. - modified ffchdu (close HDU) so that it calls the routine to update the maximum length of variable length table columns in the TFORM values in all cases where the values may have changed. Previously it would not update the values if a value was already specified in the TFORM value. - added 2 new string manipulation functions to the CFITSIO parser (contributed by Craig Markwardt): strmid extracts a substring from a string, and strstr searches for a substring within a string. - removed the code in quantize.c that treated "floating-point integer" images as a special case (it would just do a datatype conversion from float to int, and not otherwise quantize the pixel values). This caused complications with the new subtractive dithering feature. - enhanced the code for converting floating point images to quantized scaled integer prior to tile-compressing them, to apply a random subtractive dithering, which improves the photometric accuracy of the compressed images. - added new internal routine, iraf_delete_file, for use by fpack to delete a pair of IRAF format header and pixel files. - small change in cfileio.c in the way it recognizes an IRAF format .imh file. Instead of just requiring that the filename contain the ".imh" string, that string must occur at the end of the file name. - fixed bug in the code that is used when tile-compressing real*4 FITS images, which quantizes the floating point pixel values into integer levels. The bug would only appear in the fairly rare circumstance of tile compressing a floating point image that contains null pixels (NaNs) and only when using the lossy Hcompress algorithm (with the s parameter not equal to 1). This could cause underflow of low valued pixels, causing them to appear as very large pixel values (e.g., > 10**30) in the compressed image - changed the "if defined" blocks in fitsio.h, fitsio2.h and f77_wrap.h to correctly set the length of long variables on sparc64 machines. Patch contributed by Matthew Truch (U. Penn). - modified the HTTP file access code in drvrnet.c to support basic HTTP authentication, where the user supplies a user name and password. The CFITSIO filename format in this case is: "http://username:password@hostname/..." Thanks to Jochen Liske (ESO) for the suggestion and the code. Version 3.181 (BETA) - 12 May 2009 - modified region.c and region.h to add support for additional types of region shapes that are supported by ds9: panda, epanda, and bpanda. - fixed compiler error when using the new _REENTRANT flag, having to do with the an attempted static definition of Fitsio_Lock in several source files, after declaring it to be non-static in fitsio2.h. Version 3.18 (BETA) - 10 April 2009 - Made extensive changes to make CFITSIO thread safe. Previously, all opened FITS files shared a common pool of memory to store the most recently read or written FITS records in the files. In a multi-threaded environment different threads could simultaneously read or write to this common area causing unpredictable results. This was changed so that every opened FITS file has its own private memory area for buffering the file. Most of the changes were in buffers.c, fitsio.h, and fitsio2.h. Additional changes were made to cfileio.c, mainly to put locks around small sections of code when setting up the low-level drivers to read or write the FITS file. Also, locks were needed around the GZIP compression and uncompression code in compress.c., the error message stack access routine in fitscore.c, the encode and decode routines in fits_hcompress.c and fits_hdecompress.c, in ricecomp.c, and the table row selection and table calculator functions. Also, removed the 'static' declaration of the local variables in pliocomp.c which did not appeared to be required and prevented the routines from being thread safe. As a consequence of having a separate memory buffer for every FITS file (by default, about 115 kB per file), CFITSIO may now allocate more memory than previously when an application program opens multiple FITS files at once. The read and write speed may also be slightly faster, since the buffers are not shared between files. - Added new families of Fortran wrapper routines to read and write values to large tables that have more than 2**31 rows. The arguments that define the first row and first element to read or write must be I*8 integers, not ordinary I*4 integers. The names of these new routines have 'LL' appended to them, so for example, ftgcvb becomes ftgcvbll. Fixes - Corrected an obscure bug in imcompress.c that would have incorrectly written the null values only in the rare case of writing a signed byte array that is then tile compressed using the Hcompress or PLIO algorithm. Version 3.14 - 18 March 2009 Enhancements - modified the tiled-image compression and uncompression code to support compressing unsigned 16-bit integer images with PLIO. FITS unsigned integer arrays are offset by -32768, but the PLIO algorithm does not work with negative integer values. In this case, an offset of 32768 is added to the array before compression, and then subtracted again when reading the compressed array. IMPORTANT NOTE: This change is not backward compatible, so these PLIO compressed unsigned 16-bit integer images will not be read correctly by previous versions of CFITSIO; the pixel values will have an offset of +32768. - minor changes to the fpack utility to print out more complete version information with the -V option, and format the report produced by the -T option more compactly. Fixes - Modified imcomp_compress_image (which is called by fpack) so that it will preserve any null values (NaNs) if the input image has a floating point datatype (BITPIX = -32 or -64). Null values in integer datatype images are handled correctly. - Modified imcomp_copy_comp2img so that it does not copy the ZBLANK keyword, if present, from the compressed image header when uncompressing the image. - Fixed typo in the Fortran wrapper macro for the ftexist function. Version 3.13 - 5 January 2009 Enhancements - updated the typedef of LONGLONG in fitsio.h and cfortran.h to support the Borland compiler which uses the __int64 data type. - added new feature to the extended filename syntax so that when performing a filtering operation on specified HDU, if you add a '#' character after the name or number of the HDU, then ONLY that HDU (and the primary array if the HDU is a table) will be copied into the filtered version of the file in memory. Otherwise, by default CFITSIO copies all the HDUs from the input file into memory. - when specifying a section, if the specified number of dimensions is less than the number of dimensions in the image, then CFITSIO will use the entire dimension, as if a '*' had been specified. Thus [1:100] is equivalent to [1:100,*] when specifying a section of 2 dimensional image. - modified fits_copy_image_section to read/write the section 1 row at a time, instead of the whole section, to reduce memory usage. - added new stream:// drivers for reading/writing to stdin/stdout. This driver is somewhat fragile, but for simple FITS read and write operations this driver streams the FITS file on stdin or stdout without first copying the entire file in memory, as is done when specifying the file name as "-". - slight modification to ffcopy to make sure that the END keyword is correctly written before copying the data. This is required by the new stream driver. - modified ffgcprll, so that when writing data to an HDU, it first checks that the END keyword has been written to the correct place. This is required by the new stream driver. Fixes - fixed bug in ffgcls2 when reading an ASCII string column in binary tables in cases where the width of the column is greater than 2880 characters and when reading more than 1 row at a time. Similar change was made to ffpcls to fix same problem with writing to columns wider than 2880 characters. - updated the source files listed in makepc.bat so that it can be used to build CFITSIO with the Borland C++ compiler. - fixed overflow error in ffiblk that could cause writing to Large Files (> 2.1 GB) to fail with an error status. - fixed a bug in the spatial region code (region.c) with the annulus region. This bug only affected specialized applications which directly use the internal region structure; it does not affect any CFITSIO functions directly. - fixed memory corruption bug in region.c that was triggered if the region file contained a large number of excluded regions. - got rid of a harmless error message that would appear if filtering a FITS table with a GTI file that has zero rows. (eval_f.c) - modified fits_read_rgnfile so that it removes the error messages from the error stack if it is unable to open the region file as a FITS file. (region.c) Version 3.12 - 8 October 2008 - modified the histogramming code so that the first pixel in the binned array is chosen as the reference pixel by default, if no other value is previously defined. - modified ffitab and ffibin to allow a null pointer to the EXTNAME string, when inserting a table with no name. Version 3.11 - 19 September 2008 - optimized the code when tile compressing real*4 images (which get scaled to integers). This produced a modest speed increase. For best performance, one must specify the absolute q quantization parameter, rather than relative to the noise in the tile (which is expensive to compute). - modified the FITS region file reading code to check for NaN values, which signify the end of the array of points in a polygon region. - removed the test for LONGSIZE == 64 from fitsio.h, since it may not be defined. - modified imcompress.c to support unconventional floating point FITS images that also have BSCALE and BZERO keywords. The compressed floating point images are linearly scaled twice in this case. Version 3.10 - 20 August 2008 - fixed a number of cases, mainly dealing with long input file names (> 1024 char), where unsafe usage of strcat and strcpy could have caused buffer overflows. These buffer overflows could cause the application to crash, and at least theoretically, could be exploited by a malicious user to execute arbitrary code. There are no known instances of this type of malicious attack on CFITSIO applications, and the likelihood of such an attack seems remote. None the less, it would be prudent for CFITSIO users to upgrade to this new version to guard against this possibility. - modified some of the routines to define input character string parameters as "const char *" rather than just "char *" to eliminate some compiler warnings when the calling routine passes a constant string to the CFITSIO routine. Most of the changes were to the keyword name argument in the many routines that read or write keywords. - fixed bug when tile-compressing a FITS image which caused all the completely blank keywords in the input header to be deleted from the output compressed image. Also added a feature to preserve any empty FITS blocks in the header (reserved space for future keywords) when compressing or uncompressing an image. - fixed small bug in the way the default tile size is set in imcompress.c. (Fix sent in by Paul Price). - added support for reading FITS format region files (in addition to the ASCII format that was previously supported). Thanks to Keith Arnaud for modifying region.c to do this. Version 3.09 - 12 June 2008 - fixed bug in the calculator function, parse_data, that evaluates expressions then selecting rows or modifying values in table columns. This bug only appeared in unusual circumstances where the calculated value has a null value (= TNULLn). The bug could cause elements to not be flagged as having a null value, or in rare cases could cause valid elements to be flagged as null. This only appears to have affected 64-bit platforms (where size(long) = 8). - fixed typo in imcomp_decompress_tile: call to fffi2r8 should have been to fffi4r8. - in the imcopy_copy_comp2img routine, moved the call to fits_translate_keywords outside of the 'if' statement. This could affect reading compressed images that did not have a EXTNAME keyword in the header. - fixed imcomp_compress_tile in imcompress.c to properly support writing unsigned integers, in place, to tile compressed images. - modified fits_read_compressed_img so that if the calling routine specifies nullval = 0, then it will not check for null-valued pixels in the compressed FITS image. This mimics the same behavior when reading normal uncompressed FITS images. Version 3.08 - 15 April 2008 - fixed backwards compatibility issue when uncompressing a Rice compressed image that was created with previous versions of CFITSIO (this late fix was added on May 18). - small change to cfortran.h to add "extern" to the common block definition. This was done for compatibility with the version of cfortran.h that is distributed by the debian project. - relaxed the requirement that a string valued keyword must have a closing quote character. If the quote is missing, CFITSIO will silently append a quote at the end of the keyword record. This change was made because otherwise it is very difficult to correct the keyword because CFITSIO would exit with an error before making the fix. - added a new BYTEPIX compression parameter when tile-compressing images with the Rice algorithm. - cached the NAXIS and NAXISn keyword values in the fitsio structure for efficiency, to eliminate duplicates reads of these keywords. - added variants of the Rice compression and uncompression routines to support short int images (in addition to the routines that support int). - moved the definition of LONGLONG_MIN and LONGLONG_MAX from fitsio2.h to fitsio.h, to make it accessible to application programs. - make efficiency improvements to fitscore.c, to avoid needless searches through the entire header when reading the required keywords that must be near the beginning of the header. - made several improvements to getcol.c to optimize reading of compressed and uncompressed images. - changed the compression level in the gzip code from 6 to 1. In most cases this will provide nearly the same amount of compression, but is significantly faster in some cases. - added new "helper routines' to imcompress.c to allow applications to specified the "quantize level" and Hcompress scaling and smoothing parameters - modified the extended filename syntax to support the "quantize level" and Hcompress scaling and smoothing parameters. The parser in cfileio.c was extensively modified. - extensive changes to quantize.c: - replace the "nbits" parameter with "quantize level" - the quantize level is now relative to the RMS noise in the image - the HCOMPRESS scale factor is now relative to the RMS noise - added routines to calculate RMS noise in image (these changes require a change to the main file structure in fitsio.h) - initialize errno = 0 before the call to strtol in ffext, in case errno has previously been set by an unrelated error condition. - added the corresponding long name for the ffgkyjj routine to longnam.h. - changed imcomp_copy_comp2img (in imcompress.c) to not require the presence of the EXTNAME keyword in the input compressed image header. - modified imcompress.c to only write the UNCOMPRESSED_DATA column in tile-compressed images if it is actually needed. This eliminates the need to subsequently delete the column if it is not used (which is almost always the case). - found that it is necessary to seek to the EOF of a file after truncating the size of the file, to reestablish a definite current location in the file. The required small changes to 3 routines: file_truncate (to seek to EOF) and fftrun (to set io_pos) and the truncation routine in drvrmem.c. - improved the efficiency when compressing integer images with gzip. Previously, the image was always represented using integer*4 pixels, which were then compressed. Now, if the range of pixel values can be represented with integer*2 pixels or integer*1 pixels, then that is used. This change is backward compatible with any compressed images that used the previous method. - changed the default tiling pattern when using Hcompress from large squares (200 to 600 pixels wide) to 16 rows of the image. This generally requires less memory, compresses faster, and is more consistent with the default row by row tiling when using the other compression methods. - modified imcomp_init_table in imcompress.c to enforce a restriction when using the Hcompress algorithm that the 1st 2 dimensions of sll image tiles must be at least 4 pixels long. Hcompress becomes very inefficient for smaller dimensions, and does not work at all with 1D images. - fixed bug in the Hcompress compression algorithm that could affect compression of I*4 images, using non-square compression tiles (in the encode64 routine). Version 3.07 - 6 December 2007 (internal release) - fixed bug with the PLIO image compression routine which silently produced a corrupted compressed image if the uncompressed image pixels were not all in the range 0 to 2**24. (fixed in November) - fixed several 'for' loops in imcompress.c which were exceeding the bounds of an array by 1. (fixed in November) - fixed a possible, but unlikely, memory overflow issue in iraffits.c. - added a clarification to the cfortran.doc file that cfortran.h may be used and distributed under the terms of the GNU Library General Public License. - fixed bug in the fits_modify_vector_len routine when modifying the vector length of a 'X' bit column. Version 3.06 - 27 August 2007 - modified the imcopy.c utility program (to tile-compress images) so that it writes the default EXTNAME = 'COMPRESSED_IMAGE' keyword in the compressed images, to preserve the behavior of earlier versions of imcopy. - modified the angsep function in the FITS calculator (in eval.y) to use haversines, instead of the 'law of cosines', to provide more precision at small angles (< 0.1 arcsec). Version 3.05 - July 2007 (internal release only) - extensive changes to imcompress.c to fully support implicit data type conversion when reading and writing arrays of data to FITS images, where the data type of the array is not the same as the data type of the FITS image. This includes support for null pixels, and data scaling via the BSCALE and BZERO keywords. - rewrote the fits_read_tbl_coord routine in wcssub.c, that gets the standard set of WCS keywords appropriate to a pair of columns in a table, to better support the full set of officially approved WCS keywords. - made significant changes to histo.c, which creates an image by binning columns of a table, to better translate the WCS keywords in the table header into the WCS keywords that are appropriate for an image HDU. - modified imcompress.c so that when pixels are written to a tile-compressed image, the appropriate BSCALE and BZERO values of that image are applied. This fixes a bug in which writing to an unsigned integer datatype image (with BZERO = 32768) was not done correctly. Version 3.04 - 3 April 2007 - The various table calculator routines (fits_select_rows, etc.) implicitly assumed that the input table has not been modified immediately prior to the call. To cover cases where the table has been modified a call to ffrdef has been added to ffprs. IN UNUSUAL CASES THIS CHANGE COULD CAUSE CFITSIO TO BEHAVE DIFFERENTLY THAN IN PREVIOUS VERSIONS. For example, opening a FITS table with this column-editing virtual file expression: myfile.fits[3][col A==X; B = sqrt(X)] no longer works, because the X column does not exist when the sqrt expression is evaluated. The correct expression in this case is myfile.fits[3][col A==X; B = sqrt(A)] - modified putkey.c to support USHORT_IMG when calling fits_create_img to create a signed byte datatype image. - enhanced the column histogramming function to propagate any TCn_k and TPn_k keywords in the table header to the corresponding CDi_j and PCi_j keywords in the image header. - enhanced the random, randomn, and randomp functions in the lexical parser to take a vector column name argument to specify the length of the vector of random numbers that should be generated (provided by Craig Markwardt, GSFC) - enhanced the ffmcrd routine (to modify an existing header card) to support long string keywords so that any CONTINUE keywords associated with the previous keyword will be deleted. - modified the ffgtbp routine to recognize the TDIMn keyword for ASCII string columns in a binary table. The first dimension is taken to be the size of a unit string. (The TFORMn = 'rAw' syntax may also be used to specify the unit string size). - in fits_img_decompress, the fits_get_img_param function was called with an invalid dimension size, which caused a fatal error on at least 1 platform. - in ffopentest, set the status value before returning in case of error. - in the drvrnet.c file, the string terminators needed to be changed from "\n" to "\r\n" to support the strict interpretation of the http and ftp standard that is enforced by some newer web servers. Version 3.03 - 11 December 2006 New Routine - fits_write_hdu writes the current HDU to a FILE stream (e.g. stdout). Changes - modified the region parsing code to support region files where the keyword "physical" is on a separate line preceding the region shape token. (However, "physical" coordinates are not fully supported, and are treated identically to "image" coordinates). - enhanced the iterator routines to support calculations on 64-bit integer columns and images. Currently, the values are cast to double precision when doing the calculations, which can cause a loss of precision for integer values greater than about 2**52. - added support for accessing FITS files on the computational grid. Giuliano Taffoni and Andrea Barisani, at INAF, University of Trieste, Italy, implemented the necessary I/O driver routines in drvrgsiftp.c. - modified the tiled image compression/uncompression routines to preserve/restore the original CHECKSUM and DATASUM keywords if they exist. (saved as ZHECKSUM and ZDATASUM in the compressed image) - split fits_select_image_section into 2 routines: a higher level routine that creates the output file and copies other HDUs from the input file to the output file, and a lower level routine that extracts the image section from the input image into an output image HDU. - Improved the error messages that get generated if one tries to use the lexical parser to perform calculations on variable-length array columns. - added "#define MACHINE NATIVE" in fitsio2.h for all machines where BYTESWAPPED == FALSE. This may improve the file writing performance by eliminating the need to allocate a temporary buffer in some cases. - modified the configure.in and configure script to fix problems with testing if network services are available, which affects the definition of the HAVE_NET_SERVICES flag. - added explicit type casting to all malloc statements, and deleted declarations of unreferenced variables in the image compression code to suppress compiler warnings. - fixed incorrect logic in fitsio2.h in the way it determined if numerical values are byteswapped or not on MIPS and ARM architectures. - added __BORLANDC__ to the list of environments in fitsio.h that don't use %lld in printf for longlong integers - added "#if defined(unix)" around "#include " statements in several C source files, to make them compatible with Windows. Version 3.02 - 18 Sept 2006 - applied the security patch to the gzip code, available at http://security.FreeBSD.org/patches/SA-06:21/gzip.patch The insufficient bounds checks in buffer use can cause gzip to crash, and may permit the execution of arbitrary code. The NULL pointer deference can cause gzip to crash. The infinite loop can cause a Denial-of-Service situation where gzip uses all available CPU time. - added HCOMPRESS as one of the compression algorithm options in the tiled image compression code. (code provided by Richard White (STScI)) Made other improvements to preserve the exact header structure in the compressed image file so that the compressed-and-then-uncompressed FITS image will be as identical as possible to the original FITS image file. New Routines - the following new routines were added to support reading and writing non-standard extension types: fits_write_exthdr - write required keywords for a conforming extension fits_write_ext - write data to the extension fits_read_ext - read data from the extension - added new routines to compute the RMS noise in the background pixels of an image: fits_rms_float and fits_rms_short (take an input array of floats or shorts, respectively). Fixes - added the missing 64-bit integer case to set of "if (datatype)" statements in the routine that returns information about a particular column (ffgbclll). - fixed a parsing error in ffexts in cases where an extension number is followed by a semi-colon and then the column and row number of an array in a binary table. Also removed an extraneous HISTORY keyword that was being written when specifying an input image in a table cel. - modified the routine that reads a table column returning a string value (ffgcls) so that if the displayed numerical value is too wide to fit in the specified length string, then it will return a string of "*" characters instead of the number string. - small change to fitsio.h to support a particular Fortran and C compiler combination on a SGI Altix system - added a test in the gunzip code to prevent seg. fault when trying to uncompress a corrupted file (at least in some cases). - fixed a rarely-occurring bug in the routine that copies a table cell into an image; had to call the ffflsh call a few lines earlier. Version 3.01 - (in FTOOLS 6.1 release) - modified fits_copy_image2cell to correctly copy all the appropriate header keywords when copying an image into a table cell - in eval.y, explicitly included the code for the lgamma function instead of assuming it is available in a system library (e.g., the lgamma function is currently not included in MS Visual++ libraries) - modified the logic in fits_pixel_filter so that the default data type of the output image will be promoted to at least BITPIX = -32 (a single precision floating point) if the expression that is being evaluated resolves to a floating point result. If the expression resolves to an integer result, the output image will have the same BITPIX as the input image. - in fits_copy_cell2image, added 5 more WCS keywords to the list of keywords related to other columns that should be deleted in the output image header. - disabled code in cfileio.c that would write HISTORY keywords to the output file in fits_copy_image2cell and cell2image, because some tasks would not want these extraneous HISTORY keywords. - added 2 new random number functions to the CFITSIO parser RANDOMN() - produces a normal deviate (mean=0, stddev=1) RANDOMP(X) - produces a Poisson deviate for an expected # of counts X - in f77_wrap.h, removed the restriction that "g77Fortran" must be defined on 64-bit Itanium machines before assuming that sizeof(long) = 8. It appears that "long"s are always 8 bytes long on this machine, regardless of what compilers are used. - added test in fitsio.h so that LONGLONG cannot be multiply defined - modified longnam.h so that both "fits_write_nulrows" and "fits_write_nullrows" get replace by the string "ffprwu". This fixes a documentation error regarding the long name of this routine. Bug fixes - fixed a potential null character string dereferencing error in the the ffphtb and ffphbn routines that write the FITS table keywords. This concerned the optional TUNITn keywords. - fixed a few issues in fits_copy_cell2image and fits_copy_image2cell related to converting some WCS keyword between the image extension form and the table cell form of the keyword. (cfileio.c) - fixed bug in fits_translate_keyword (fitscore.c) that, e.g., caused 'EQUINOX' to be translated to EQUINOXA' if the pattern is 'EQUINOXa' - fixed 2 bugs that could affect 'tile compressed' floating point images that contain NaN pixels (null pixels). First, the ZBLANK keyword was not being written, and second, an integer overflow could occur when computing the BZERO offset in the compressed array. (quantize.c and imcompress.c) Version 3.006 - 20 February 2006 -(first full release of v3) - enhanced the 'col' extended filename syntax to support keyword name expressions like [col error=sqrt(rate); #TUNIT# = 'counts/s'], in which the trailing '#' will be replaced by the column number of the most recently referenced column. - fixed bug in the parse_data iterator work function that caused it to fail to return a value of -1 in cases where only a selected set of rows were to be processed. (affected Fv) - added code to fitsio.h and cfortran.h to typedef LONGLONG to the appropriate 8-byte integer data type. Most compilers now support the 'long long' data type, but older MS Visual C++ compilers used '__int64' instead. - made several small changes based on testing by Martin Reinecke: o in eval.y, change 'int undef' to 'long undef' o in getcold.c and getcole.c, fixed a couple format conversion specifiers when displaying the value of long long variables. o in fitsio.h, modified the definition of USE_LL_SUFFIX in the case of Athon64 machines. o in fitsio2.h, defined BYTESWAPPED in the case of SGI machines. o in group.c, added 'include unistd.h' to get rid of compiler warning. Version 3.005 - 20 December 2005 (beta) - cfortran.h has been enhanced to support 64-bit integer parameters when calling C routines from Fortran. This modification was kindly provided by Martin Reinecke (MPE, Garching). - Many new Fortran wrapper routines have been added to support reading and writing 64-bit integer values in FITS files. These new routines are documented in the updated version of the 'FITSIO User's Guide' for Fortran programmers. - fixed a problem in the fits_get_keyclass routine that caused it to not recognize the special COMMENT keywords at the beginning of most FITS files that defines the FITS format. - added a new check to the ffifile routine that parses the input extended file name, to distinguish between a FITS extension name that begins with 'pix', and a pixel filtering operator that begins with the 'pix' keyword. - small change to the WCSLIB interface routine, fits_read_wcstab, to be more permissive in allowing the TDIMn keyword to be omitted for degenerate coordinate array. Version 3.004 - 16 September 2005 (3rd public beta release) - a major enhancement to the CFITSIO virtual file parser was provided by Robert Wiegand (GSFC). One can now specify filtering operations that will be applied on the fly to the pixel values in a FITS image. For example [pix sqrt(X)] will create a virtual FITS image where the pixel values are the square root of the input image pixels. - modified region.c so that it interprets the position angles of regions in a SAO style region file in the same way as DS9. In particular, if the region parameters are given in WCS units, then the position angle should be relative to the WCS coordinates of the image (increasing CCW from West) instead of relative to the X/Y pixel coordinate system. This only affects rotated images (e.g. with non-zero CROTA2 keyword) with elliptical or rectangular regions. - cleaned up fitsio.h and fitsio2.h to make the definition of LONGLONG and BYTESWAPPED and MACHINE more logical. - removed HAVE_LONGLONG everywhere since it is no longer needed (the compiler now must have an 8-byte integer datatype to build CFITSIO). - added support for the 64-bit IBM AIX platform - modified eval.y so that the circle, ellipse, box, and near functions can operate on vectors as well as scalars. This allows region filtering on images that are stored in a vector cell in a binary table. (provided by Craig Markwardt, GSFC) New Routines - added new fits_read_wcstab routine that serves as an interface to Mark Calabretta's wcslib library for reading WCS information when the -TAB table lookup convention is used in the FITS file. - added new fits_write_nullrows routine, which writes null values into every column of a specified range of rows in a FITS table. - added the fits_translate_keyword and fits_translate_keywords utility routines for converting the names of keywords when moving columns and images around. - added fits_copy_cell2image and fits_copy_image2cell routines for copying an image extension (or primary array) to or from a cell in a binary table vector column. Bug fixes - fixed a memory leak in eval.y; was fixed by changing a call to malloc to cmalloc instead. - changed the definition of several global variables at the beginning of buffers.c to make them 'static' and thus invisible to applications programs. - in fits_copy_image_cell, added a call to flush the internal buffers before reading from the file, in case any records had been modified. Version 3.003 - 28 July 2005 - 2nd public beta release (used in HEASOFT) Enhancements - enhanced the string column reading routing fits_get_col_str to support cases where the user enters a null pointer (rather than a null string) as the nulval parameter. - modified the low level ffread and ffwrite routines that physically read and write data from the FITS file so that they write the name of the file to the CFITSIO error stack if an error occurs. - changed the definition of fits_open_file into a macro that will test that the version of the fitsio.h include file that was used to build the CFITSIO library is the same version as included when compiling the application program. - made a simple modification to region.c to support regions files of type "linear", for compatibility with ds9 and fv. - modified the internal ffgpr routine (and renamed it ffgprll) so that it returns the TNULL value as a LONGLONG parameter instead of 'long'. - in fits_get_col_display_width, added support for TFORM = 'k' - modified fitsio.h, fitsio2.h, and f77_wrap.h to add test for (_SX) to identify NEC SX supercomputers. - modified eval_f.c to treat table columns of TULONG (unsigned long) as a double. Also added support for TLONGLONG (8-byte integers) as a double, which is only a temporary fix, since doubles only have about 52 bits of precision. - changed the 'blank' parameter in the internal ffgphd function to to type LONGLONG to support integer*8 FITS images. - when reading the TNULL keyword value, now use ffc2jj instead of ffc2ii, to support integer*8 values. Bug fixes - fixed a significant bug when writing character strings to a variable length array column of a binary table. This bug would result in some unused space in the variable length heap, making the heap somewhat larger than necessary. This in itself is usually a minor issue, since the FITS files are perfectly valid, and other software should have no problems reading back the characters strings. In some cases, however, this problem could cause the program that is writing the table to exit with a status = 108 disk read error. - modified the standalone imcopy.c utility program to fix a memory allocation bug when running on 64-bit platforms where sizeof(long) = 8 bytes. - added an immediate 'return' statement to ffgtcl if the input status >0, to prevent a segfault on some platforms. Version 3.002 - 15 April 2005 - first public beta release - in drvrfile.c, if it fails to open the file for some reason, then it should reset file_outfile to a null string, to avoid errors on a subsequent call to open a file. - updated fits_get_keyclass to recognize most of the WCS keywords defined in the WCS Papers I and II. Version 3.001 - 15 March 2005 - released with HEASOFT 6.0 - numerous minor changes to the code to get rid of compiler warning messages, mainly dealing with numerical data type casting and the subsequent possible loss of precision in the result. Version 3.000 - 1 March 2005 (internal beta release) Enhancements: - Made major changes to many of the CFITSIO routines to more generally support Large Files (> 2.1 GB). These changes are intended to be 100% backward compatible with software that used the previous versions of CFITSIO. The datatype of many of the integer parameters in the CFITSIO functions has been changed from 'long' to 'LONGLONG', which is typedef'ed to be equivalent to an 8-byte integer datatype on each platform. With these changes, CFITSIO supports the following: - integer FITS keywords with absolute values > 2**31 - FITS files with total sizes > 2**31 bytes - FITS tables in which the number of rows, the row width, or the size of the heap is > 2**31 bytes - FITS images with dimensions > 2**31 bytes (support is still somewhat limited, with full support to be added later). - added another lexical parser function (thanks to Craig Markwardt, GSFC): angsep computes the angular separation between 2 positions on the celestial sphere. - modified the image subset extraction code (e.g., when specifying an image subregion when opening the file, such as 'myimage.fits[21:40, 81:90]') so that in addition to updating the values of the primary WCS keywords CRPIXk, CDELTi, and CDj_i in the extracted/binned image, it also looks for and updates any secondary WCS keywords (e.g., 'CRPIX1P'). - made cosmetic change to group.c, so that when a group table is copied, any extra columns will be appended after the last existing column, instead of being inserted before the last column. - modified the routines that read tile compressed images to support NULL as the input value for the 'anynul' parameter (meaning the calling program does not want the value of 'anynul' returned to it). - when constructing or parsing a year/month/day character string, (e.g, when writing the DATE keyword) the routines now rigorously verify that the input day value is valid for the given month (including leap years). - added some checks in cfileio.c to detect if some vital parameters that are stored in memory have been corrupted. This can occur if a user's program writes to areas of memory that it did not allocate. - added the wcsutil_alternate.c source code file which contains non-working stubs for the 2 Classic AIPS world coordinate conversion routines that are distributed under the GNU General Public License. Users who are unwilling or unable to distribute their software under the General Public License may use this alternate source file which has no GPL restrictions, instead of wcsutil.c. This will have no effect on programs that use CFITSIO as long as they do not call the fits_pix_to_world/ffwldp or fits_world_to_pix/ffxypx routines. Bug Fixes - in ffdtdm (which parses the TDIMn keyword value), the check for consistency between the length of the array defined by TDIMn and the size of the TFORMn repeat value, is now not performed for variable length array columns (which always have repeat = 1). - fixed byteswapping problem when writing null values to non-standard long integer FITS images with BITPIX = 64 and FITS table columns with TFORMn = 'K'. - fixed buffer overflow problem in fits_parse_template/ffgthd that occurred only if the input template keyword value string was much longer than can fit in an 80-char header record. Version 2.510 - 2 December 2004 New Routines: - added fits_open_diskfile and fits_create_diskfile routines that simply open or create a FITS file with a specified name. CFITSIO does not try to parse the name using the extended filename syntax. - 2 new C functions, CFITS2Unit and CUnit2FITS, were added to convert between the C fitsfile pointer value and the Fortran unit number. These functions may be useful in mixed language C and Fortran programs. Enhancements: - added the ability to recognize and open a compressed FITS file (compressed with gzip or unix compress) on the stdin standard input stream. - Craig Markwardt (GSFC) provided 2 more lexical parser functions: accum(x) and seqdiff(x) that compute the cumulative sum and the sequential difference of the values of x. - modified putcole.c and putcold.c so that when writing arrays of pixels to the FITS image or column that contain null values, and there are also numerical overflows when converting some of the non-null values to the FITS values, CFITSIO will now ignore the overflow error until after all the data have been written. Previously, in some circumstances CFITSIO would have simply stopped writing any data after the first overflow error. - modified fitsio2.h to try to eliminate compiler warning messages on some platforms about the use of 'long long' constants when defining the value of LONGLONG_MAX (whether to use L or LL suffix). - modified region.c to support 'physical' regions in addition to 'image', 'fk4', etc. - modified ffiurl (input filename parsing routine) to increase the maximum allowed extension number that can be specified from 9999 to 99999 (e.g. 'myfile.fits+99999') Bug Fixes: - added check to fits_create_template to force it to start with the primary array in the template file, in case an extension number was specified as part of the template FITS file name. Version 2.500 - 28 & 30 July 2004 New Routine: - fits_file_exists tests whether the specified input file, or a compressed version of the file, exists on disk. Enhancements: - modified the way CFITSIO reads and writes data in COMPLEX ('C') and DBLCOMPLEX 'M' columns. Now, in all cases, when referring to the number of elements in the vector, or the value of the offset to a particular element within the vector, CFITSIO considers each pair of numbers (the imaginary and real parts) as a single element instead of treating each single number as an element. In particular, this changes the behavior of fits_write_col_null when writing to complex columns. It also changes the length of the 'nullarray' vector in the fits_read_colnull routine; it is now only 1/2 as long as before. Each element of the nullarray is set = 1 if either the real or imaginary parts of the corresponding complex value have a null value.(this change was added to version 2.500 on 30 July). - Craig Markwardt, at GSFC, provided a number of significant enhancements to the CFITSIO lexical parser that is used to evaluate expressions: - the parser now can operate on bit columns ('X') in a similar way as for other numeric columns (e.g., 'B' or 'I' columns) - range checking has been implemented, so that the following conditions return a Null value, rather than returning an error: divide by zero, sqrt(negative), arccos(>1), arcsin(>1), log(negative), log10(negative) - new vector functions: MEDIAN, AVERAGE, STDDEV, and NVALID (returns the number of non-null values in the vector) - all the new functions (and SUM, MIN and MAX) ignore null values - modified the iterator to support variable-length array columns - modified configure to support AIX systems that have flock in a non- standard location. - modified configure to remove the -D_FILE_OFFSET_BITS flag when running on Mac Darwin systems. This caused conflicts with the Fortran wrappers, and should only be needed in any case when using CFITSIO to read/write FITS files greater than 2.1 GB in size. - modified fitsio2.h to support compilers that define LONG_LONG_MAX. - modified ffrsim (resize an existing image) so that it supports changing the datatype to an unsigned integer image using the USHORT_IMG and ULONG_IMG definitions. - modified the disk file driver (drvrfile.c) so that if an output file is specified when opening an ordinary file (e.g. with the syntax 'myfile.fits(outputfile.fits)' then it will make a copy of the file, close the original file and open the copy. Previously, the specified output file would be ignored unless the file was compressed. - modified f77_wrap.h and f77_wrap3.c to support the Fortran wrappers on 64-bit AMD Opteron machines Bug fixes: - made small change to ffsrow in eval_f.c to avoid potential array bounds overflow. - made small change to group.c to fix problem where an 'int' was incorrectly being cast to a 'long'. - corrected a memory allocation error in the new fits_hdr2str routine that was added in version 2.48 - The on-the-fly row-selection filtering would fail with a segfault if the length of a table row (NAXIS1 value) was greater than 500000 bytes. A small change to eval_f.c was required to fix this. Version 2.490 - 11 February 2004 Bug fixes: - fixed a bug that was introduced in the previous release, which caused the CFITSIO parser to no longer move to a named extension when opening a FITS file, e.g., when opening myfile.fit[events] CFITSIO would just open the primary array instead of moving to the EVENTS extension. - new group.c file from the INTEGRAL Science Data Center. It fixes a problem when you attach a child to a parent and they are both is the same file, but, that parent contains groups in other files. In certain cases the attach would not happen because it seemed that the new child was already in the parent group. - fixed bug in fits_calculator_rng when performing a calculation on a range of rows in a table, so that it does not reset the value in all the other rows that are not in the range = 0. - modified fits_write_chksum so that it updates the TFORMn keywords for any variable length vector table columns BEFORE calculating the CHECKSUM values. Otherwise the CHECKSUM value is invalidated when the HDU is subsequently closed. Version 2.480 - 28 January 2004 New Routines: - fits_get_img_equivtype - just like fits_get_img_type, except in the case of scaled integer images, it returns the 'equivalent' data type that is necessary to store the scaled data values. - fits_hdr2str copies all the header keywords in the current HDU into a single long character string. This is a convenient method of passing the header information to other subroutines. The user may exclude any specified keywords from the list. Enhancements: - modified the filename parser so that it accepts extension names that begin with digits, as in 'myfile.fits[123TEST]'. In this case CFITSIO will try to open the extension with EXTNAME = '123TEST' instead of trying to move to the 123rd extension in the file. - the template keyword parser now preserves the comments on the the mandatory FITS keywords if present, otherwise a standard default comment is provided. - modified the ftp driver file (drvrnet.c) to overcome a timeout or hangup problem caused by some firewall software at the user's end (Thanks to Bruce O'Neel for this fix). - modified iraffits.c to incorporate Doug Mink's latest changes to his wcstools library routines. The biggest change is that now the actual image dimensions, rather than the physically stored dimensions, are used when converting an IRAF file to FITS. Bug fixes: - when writing to ASCII FITS tables, the 'elemnum' parameter was supposed to be ignored if it did not have the default value of 1. In some cases however setting elemnum to a value other than 1 could cause the wrong number of rows to be produced in the output table. - If a cfitsio calculator expression was imported from a text file (e.g. using the extended filename syntax 'file.fits[col @file.calc]') and if any individual lines in that text file were greater than 255 characters long, then a space character would be inserted after the 255th character. This could corrupt the line if the space was inserted within a column name or keyword name token. Version 2.480beta (used in the FTOOLS 5.3 release, 1 Nov 2003) New Routines: - fits_get_eqcoltype - just like fits_get_coltype, except in the case of scaled integer columns, it returns the 'equivalent' data type that is necessary to store the scaled data values. - fits_split_names - splits an input string containing a comma or space delimited list of names (typically file names or column names) into individual name tokens. Enhancements: - changed fhist in histo.c so that it can make histograms of ASCII table columns as well as binary table columns (as long as they contain numeric data). Bug fixes: - removed an erroneous reference to listhead.c in makefile.vcc, that is used to build the cfitsio dll under Windows. This caused a 'main' routine to be added to the library, which causes problems when linking fortran programs to cfitsio under windows. - if an error occurs when opening for a 2nd time (with ffopen) a file that is already open (e.g., the specified extension doesn't exist), and if the file had been modified before attempting to reopen it, then the modified buffers may not get written to disk and the internal state of the file may become corrupted. ffclos was modified to always set status=0 before calling ffflsh if the file has been concurrently opened more than once. Version 2.470 - 18 August 2003 Enhancements: - defined 'TSBYTE' to represent the 'signed char' datatype (similar to 'TBYTE' that represents the 'unsigned char' datatype) and added support for this datatype to all the routines that read or write data to a FITS image or table. This was implemented by adding 2 new C source code files to the package: getcolsb.c and putcolsb.c. - Defined a new '1S' shorthand data code for a signed byte column in a binary table. CFITSIO will write TFORMn = '1B' and TZEROn = -128 in this case, which is the convention used to store signed byte values in a 'B' type column. - in fitsio2.h, added test of whether `__x86_64__` is defined, to support the new AMD Opteron 64-bit processor - modified configure to not use the -fast compiler flag on Solaris platforms when using the proprietary Solaris cc compiler. This flag causes compilation problems in eval_y.c (compiler just hangs forever). Bug fixes: - In the special case of writing 0 elements to a vector table column that contains 0 rows, ffgcpr no longer adds a blank row to the table. - added error checking code for cases where a ASCII string column in a binary table is greater than 28800 characters wide, to avoid going into an infinite loop. - the fits_get_col_display_width routine was incorrectly returning width = 0 for a 'A' binary table column that did not have an explicit vector length character. Version 2.460 - 20 May 2003 Enhancements: - modified the HTTP driver in drvrnet.c so that CFITSIO can read FITS files via a proxy HTTP server. (This code was contributed by Philippe Prugniel, Obs. de Lyon). To use this feature, the 'http_proxy' environment variable must be defined with the address (URL) and port number of the proxy server, i.e., > setenv http_proxy http://heasarc.gsfc.nasa.gov:3128 will use port 3128 on heasarc.gsfc.nasa.gov - suppressed some compiler warnings by casting a variable of type 'size_t' to type 'int' in fftkey (in fitscore.c) and iraftofits and irafrdimge (in iraffits.c). Version 2.450 - 30 April 2003 Enhancements: - modified the WCS keyword reading routine (ffgics) to support cases where some of the CDi_j keywords are omitted (with an assumed value = 0). - Made a change to http_open_network in drvrnet.c to add a 'Host: ' string to the open request. This is required by newer HTTP 1.1 servers (so-called virtual servers). - modified ffgcll (read logical table column) to return the illegal character value itself if the FITS file contains a logical value that is not equal to T, F or zero. Previously it treated this case the same as if the FITS file value was = 0. - modified fits_movnam_hdu (ffmnhd) so that it will move to a tile- compressed image (that is stored in a binary table) if the input desired HDU type is BINARY_TBL as well as if the HDU type = IMAGE_HDU. Bug fixes: - in the routine that checks the data fill bytes (ffcdfl), the call to ffmbyt should not ignore an EOF error when trying to read the bytes. This is a little-used routine that is not called by any other CFITSIO routine. - fits_copy_file was not reporting an error if it hit the End Of File while copying the last extension in the input file to the output file. - fixed inconsistencies in the virtual file column filter parser (ffedit_columns) to properly support expressions which create or modify a keyword, instead of a column. Previously it was only possible to modify keywords in a table extension (not an image), and the keyword filtering could cause some of the table columns to not get propagated into the virtual file. Also, spaces are now allowed within the specified keyword comment field. - ffdtyp was incorrectly returning the data type of FITS keyword values of the form '1E-09' (i.e., an exponential value without a decimal point) as integer rather than floating point. - The enhancement in the previous 2.440 release to allow more files to be opened at one time introduced a bug: if ffclos is called with a non-zero status value, then any subsequent call to ffopen will likely cause a segmentation fault. The fits_clear_Fptr routine was modified to fix this. - rearranged the order of some computations in fits_resize_img so as to not exceed the range of a 32-bit integer when dealing with large images. - the template parser routine, ngp_read_xtension, was testing for "ASCIITABLE" instead of "TABLE" as the XTENSION value of an ASCII table, and it did not allow for optional trailing spaces in the IMAGE" or "TABLE" string value. Version 2.440 - 8 January 2003 Enhancements: - modified the iterator function, ffiter, to operate on random groups files. - decoupled the NIOBUF (= 40) parameter from the limit on the number FITS files that can be opened, so that more files may be opened without the overhead of having to increase the number of NIOBUF buffers. A new NMAXFILES parameter is defined in fitsio2.h which sets the maximum number of opened FITS files. It is set = 300 by default. Note however, that the underlying compiler or operating system may not allow this many files to be opened at one time. - updated the version of cfortran.h that is distributed with CFITSIO from version 3.9 to version 4.4. This required changes to f77_wrap.h and f77_wrap3.c. The original cfortran.h v4.4 file was modified slightly to support CFITSIO and ftools (see comments in the header of cfortran.h). - modified ffhist so that it copies all the non-structural keywords from the original binary table header to the binned image header. - modified fits_get_keyclass so that it recognizes EXTNAME = COMPRESSED_IMAGE as a special tile compression keyword. - modified Makefile.in to support the standard --prefix convention for specifying the install target directory. Bug fixes: - in fits_decompress_img, needed to add a call to ffpscl to turn off the BZERO and BSCALE scaling when reading the compressed image. Version 2.430 - 4 November 2002 Enhancements: - modified fits_create_hdu/ffcrhd so that it returns without doing anything and does not generate an error if the current HDU is already an empty HDU. There is no need in this case to append a new empty HDU to the file. - new version of group.c (supplied by B. O'Neel at the ISDC) fixes 2 limitations: 1 - Groups now have 256 characters rather than 160 for the path lengths in the group tables. - ISDC SPR 1720. 2 - Groups now can have backpointers longer than 68 chars using the long string convention. - ISDC SPR 1738. - small change to f77_wrap.h and f77_wrap3.c to support the fortran wrappers on SUN solaris 64-bit sparc systems (see also change to v2.033) - small change to find_column in eval_f.c to support unsigned long columns in binary tables (with TZEROn = 2147483648.0) - small modification to cfortran.h to support Mac OS-X, (Darwin) Bug fixes: - When reading tile-compress images, the BSCALE and BZERO scaling keywords were not being applied, if present. - Previous changes to the error message stack code caused the tile compressed image routines to not clean up spurious error messages properly. - fits_open_image was not skipping over null primary arrays. Version 2.420 - 19 July 2002 Enhancements: - modified the virtual filename parser to support exponential notation when specifying the min, max or binsize in a binning specifier, as in: myfile.fits[binr X=1:10:1.0E-01, Y=1:10:1.0E-01] - removed the limitation on the maximum number of HDUs in a FITS file (limit used to be 1000 HDUs per file). Now any number of HDUs can be written/read in a FITS file. (BUT files that have huge numbers of HDUs can be difficult to manage and are not recommended); - modified grparser.c to support HIERARCH keywords, based on code supplied by Richard Mathar (Max-Planck) - moved the ffflsh (fits_flush_buffer) from the private to the public interface, since this routine may be useful for some applications. It is much faster than ffflus. - small change to the definition of OFF_T in fitsio.h to support large files on IBM AIX operating systems. Bug fixes: - fixed potential problem reading beyond array bounds in ffpkls. This would not have affected the content of any previously generated FITS files. - in the net driver code in drvrnet.c, the requested protocol string was changed from "http/1.0" to "HTTP/1.0" to support apache 1.3.26. - When using the virtual file syntax to open a vector cell in a binary table as if it were a primary array image, there was a bug in fits_copy_image_cell which garbled the data if the vector was more than 30000 bytes long. - fixed problem that caused fits_report_error to crash under Visual C++ on Windows systems. The fix is to use the '/MD' switch on the cl command line, or, in Visual Studio, under project settings / C++ select use runtime library multithreaded DLL - modified ffpscl so it does not attempt to reset the scaling values in the internal structure if the image is tile-compressed. - fixed multiple bugs in mem_rawfile_open which affected the case where a raw binary file is read and converted on the fly into a FITS file. - several small changes to group.c to suppress compiler warnings. Version 2.410 - 22 April 2002 (used in the FTOOLS 5.2 release) New Routines: - fits_open_data behaves similarly to fits_open_file except that it also will move to the first HDU containing significant data if and an explicit HDU name or number to open was not specified. This is useful for automatically skipping over a null primary array when opening the file. - fits_open_table and fits_open_image behaves similarly to fits_open_data, except they move to the first table or image HDU in the file, respectively. - fits_write_errmark and fits_clear_errmark routines can be use to write an invisible marker to the CFITSIO error stack, and then clear any more recent messages on the stack, back to that mark. This preserves any older messages on the stack. - fits_parse_range utility routine parses a row list string and returns integer arrays giving the min and max row in each range. - fits_delete_rowrange deletes a specified list of rows or row ranges. - fits_copy_file copies all or part of the HDUs in the input file to the output file. - added fits_insert_card/ffikey to the publicly defined set of routines (previously, it was a private routine). Enhancements: - changed the default numeric display format in ffgkys from 'E' format to 'G' format, and changed the format for 'X' columns to a string of 8 1s or 0s representing each bit value. - modified ffflsh so the system 'fflush' call is not made in cases where the file was opened with 'READONLY' access. - modified the output filename parser so the "-.gz", and "stdout.gz" now cause the output file to be initially created in memory, and then compressed and written out to the stdout stream when the file is closed. - modified the routines that delete rows from a table to also update the variable length array heap, to remove any orphaned data from the heap. - modified ffedit_columns so that wild card characters may be used when specifying column names in the 'col' file filter specifier (e.g., file.fits[col TIME; *RAW] will create a virtual table contain only the TIME column and any other columns whose name ends with 'RAW'). - modified the keyword classifier utility, fits_get_keyclass, to support cases where the input string is just the keyword name, not the entire 80-character card. - modified configure.in and configure to see if a proprietary C compiler is available (e.g. 'cc'), and only use 'gcc' if not. - modified ffcpcl (copy columns from one table to another) so that it also copies any WCS keywords related to that column. - included an alternate source file that can be used to replace compress.c, which is distributed under the GNU General Public License. The alternate file contains non-functional stubs for the compression routines, which can be used to make a version of CFITSIO that does not have the GPL restrictions (and is also less functional since it cannot read or write compressed FITS files). - modifications to the iterator routine (ffiter) to support writing tile compressed output images. - modified ffourl to support the [compress] qualifier when specifying the optional output file name. E.g., file.fit(out.file[compress])[3] - modified imcomp_compress_tile to fully support implicit data type conversion when writing to tile-compressed images. Previously, one could not write a floating point array to an integer compressed image. - increased the number of internal 2880-byte I/O buffers allocated by CFITSIO from 25 to 40, in recognition of the larger amount of memory available on typical machines today compared with a few years ago. The number of buffers can be set by the user with the NIOBUF parameter in fitsio2.h. (Setting this too large can actually hurt performance). - modified the #if statements in fitsio2.h, f77_wrap.h and f77_wrap1.c to support the new Itanium 64-bit Intel PC. - a couple minor modifications to fitsio.h needed to support the off_t datatype on debian linux systems. - increased internal buffer sizes in ffshft and ffsrow to improve the I/O performance. Bug fixes: - fits_get_keyclass could sometimes try to append to an unterminated string, causing an overflow of a string array. - fits_create_template no longer worked because of improvements made to other routines. Had to modify ffghdt to not try to rescan the header keywords if the file is still empty and contains no keywords yet. - ffrtnm, which returns the root filename, sometimes did not work properly when testing if the 'filename+n' convention was used for specifying an extension number. - fixed minor problem in the keyword template parsing routine, ffgthd which in rare cases could cause an improperly terminated string to be returned. - the routine to compare 2 strings, ffcmps, failed to find a match in comparing strings like "*R" and "ERROR" where the match occurs on the last character, but where the same matching character occurs previously in the 2nd string. - the region file reading routine (ffrrgn) did not work correctly if the region file (created by POW and perhaps other programs) had an 'exclude' region (beginning with a '-' sign) as the first region in the file. In this case all points outside the excluded region should be accepted, but in fact no points were being accepted in this case. Version 2.401 - 28 Jan 2002 - added the imcopy example program to the release (and Makefile) Bug fixes: - fixed typo in the imcompress code which affected compression of 3D datacubes. - made small change to fficls (insert column) to allow colums with TFORMn = '1PU' and '1PV' to be inserted in a binary table. The 'U' and 'V' are codes only used within CFITSIO to represent unsigned 16-bit and 32-bit integers; They get replaced by '1PI' and '1PJ' respectively in the FITS table header, along with the appropriate TZEROn keyword. Version 2.400 - 18 Jan 2002 (N.B.: Application programs must be recompiled, not just relinked with the new CFITSIO library because of changes made to fitsio.h) New Routines: - fits_write_subset/ffpss writes a rectangular subset (or the whole image) to a FITS image. - added a whole new family of routines to read and write arrays of 'long long' integers (64-bit) to FITS images or table columns. The new routine names all end in 'jj': ffpprjj, ffppnjj, ffp2djj, ffp3djj, ffppssjj, ffpgpjj, ffpcljj, ffpcnjj. ffgpvjj, ffgpfjj, ffg2djj, ffg3djj, ffgsvjj, ffgsfjj, ffggpjj, ffgcvjj, and ffgcfjj. - added a set of helper routines that are used in conjunction with the new support for tiled image compression. 3 routines set the parameters that should be used when CFITSIO compresses an image: fits_set_compression_type fits_set_tile_dim fits_set_noise_bits 3 corresponding routines report back the current settings: fits_get_compression_type fits_get_tile_dim fits_get_noise_bits Enhancements: - major enhancement was made to support writing to tile-compressed images. In this format, the image is divided up into a rectangular grid of tiles, and each tile of pixels is compressed individually and stored in a row of a variable-length array column in a binary table. CFITSIO has been able to transparently read this compressed image format ever since version 2.1. Now all the CFITSIO image writing routines also transparently support this format. There are 2 ways to force CFITSIO to write compressed images: 1) call the fits_set_compression_type routine before writing the image header keywords, or 2), specify that the image should be compressed when entering the name of the output FITS file, using a new extended filename syntax. (examples: "myfile.fits[compress]" will use the default compression parameters, and "myfile.fits[compress GZIP 100,100] will use the GZIP compression algorithm with 100 x 100 pixel tiles. - added new driver to support creating output .gz compressed fits files. If the name of the output FITS file to be created ends with '.gz' then CFITSIO will initially write the FITS file in memory and then, when the FITS file is closed, CFITSIO will gzip the entire file before writing it out to disk. - when over-writing vectors in a variable length array in a binary table, if the new vector to be written is less than or equal to the length of the previously written vector, then CFITSIO will now reuse the existing space in the heap, rather than always appending the new array to the end of the heap. - modified configure.in to support building cfitsio as a dynamic library on Mac OS X. Use 'make shared' like on other UNIX platforms, but a .dylib file will be created instead of .so. If installed in a nonstandard location, add its location to the DYLD_LIBRARY_PATH environment variable so that the library can be found at run time. - made various modifications to better support the 8-byte long integer datatype on more platforms. The 'LONGLONG' datatype is typedef'ed to equal 'long long' on most Unix platforms and MacOS, and equal to '__int64' on Windows machines. - modified configure.in and makefile.in to better support cases where the system has no Fortran compiler and thus the f77 wrapper routines should not be compiled. - made small modification to eval.y and eval_y.f to get rid of warning on some platforms about redefinition of the 'alloca'. Bug fixes: - other recent bug fixes in ffdblk (delete blocks) caused ffdhdu (delete HDU) to fail when trying to replace the primary array with a null primary array. - fixed bug that prevented inserting a new variable length column into a table that already contained variable length data. - modified fits_delete_file so that it will delete the file even if the input status value is not equal to zero. - in fits_resize_image, it was sometimes necessary to call ffrdef to force the image structure to be defined. - modified the filename parser to support input files with names like: "myfile.fits.gz(mem://tmp)" in which the url type is specified for the output file but not for the input file itself. This required modifications to ffiurl and ffrtnm. Version 2.301 - 7 Dec 2001 Enhancements: - modified the http file driver so that if the filename to be opened contains a '?' character (most likely a cgi related string) then it will not attempt to append a .gz or .Z as it would normally do. - added support for the '!' clobber character when specifying the output disk file name in CFITSIO's extended filename syntax, e.g., 'http://a.b.c.d/myfile.fits.gz(!outfile.fits)' - added new device driver which is used when opening a compressed FITS file on disk by uncompressing it into memory with READWRITE access. This happens when specifying an output filename 'mem://'. - added 2 other device drivers to open http and ftp files in memory with write access. - improved the error trapping and reporting in cases where program attempts to write to a READONLY file (especially in cases where the 'file' resides in memory, as is the case when opening an ftp or http file. - modified the extended filename parser so that it is does not confuse the bracket character '[' which is sometimes used in the root name of files of type 'http://', as the start of an extname or row filter expression. If the file is of type 'http://', the parser now checks to see if the last character in the extended file name is a ')' or ']'. If not, it does not try to parse the file name any further. - improved the efficiency when writing FITS files in memory, by initially allocating enough memory for the entire HDU when it is created, rather than incrementally reallocing memory 2880 bytes at a time (modified ffrhdu and mem_truncate). This change also means that the program will fail much sooner if it cannot allocate enough memory to hold the entire FITS HDU. Bug fixes: - There was an error in the definition of the Fortran ftphtb wrapper routine (writes required ASCII table header keywords) that caused it to fail on DEC OSF and other platforms where sizeof(long) = 8. Version 2.300 - 23 Oct 2001 New Routines: - fits_comp_img and fits_decomp_img are now fully supported and documented. These routine compress and decompress, respective, a FITS image using a new algorithm in which the image is first divided into a grid of rectangular tiles, then the compressed byte stream from each tile is stored in a row of a binary table. CFITSIO can transparently read FITS images stored in this compressed format. Compression ratios of 3 - 6 are typically achieved. Large compression ratios are achieved for floating point images by throwing away non-significant noise bits in the pixel values. - fits_test_heap tests the integrity of the binary table heap and returns statistics on the amount of unused space in the heap and the amount of space that is pointed to by more than 1 descriptor. - fits_compress_heap which will reorder the arrays in the binary table heap, recovering any unused space. Enhancements: - made substantial internal changes to the code to support FITS files containing 64-bit integer data values. These files have BITPIX = 64 or TFORMn = 'K'. This new feature in CFITSIO is currently only enabled if SUPPORT_64BIT_INTEGERS is defined = 1 in the beginning of the fitsio2.h file. By default support for 64-bit integers is not enabled. - improved the ability to read and return a table column value as a formatted string by supporting quasi-legal TDISPn values which have a lowercase format code letter, and by completely ignoring other unrecognizable TDISPn values. Previously, unrecognized TDISPn values could cause zero length strings to be returned. - made fits_write_key_longstr more efficient when writing keywords using the long string CONTINUE convention. It previously did not use all the available space on each card when the string to be written contained many single quote characters. - added a new "CFITSIO Quick Start Guide" which provides all the basic information needed to write C programs using CFITSIO. - updated the standard COMMENT keywords that are written at the beginning of every primary array to refer to the newly published FITS Standard document in Astronomy and Astrophysics. Note: because of this change, any FITS file created with this version of CFITSIO will not be identical to the same file written with a previous version of CFITSIO. - replaced the 2 routines in pliocomp.c with new versions provided by D Tody and N Zarate. These routines compress/uncompress image pixels using the IRAF pixel list compression algorithm. - modified fits_copy_hdu so that when copying a Primary Array to an Image extension, the COMMENT cards which give the reference to the A&A journal article about FITS are not copied. In the inverse case the COMMENT keywords are inserted in the header. - modified configure and Makefile.in to add capability to build a shared version of the CFITSIO library. Type 'make shared' or 'make libcfitsio.so' to invoke this option. - disabled some uninformative error messages on the error stack: 1) when calling ffclos (and then ffchdu) with input status > 0 2) when ffmahd tries to move beyond the end of file. The returned status value remains the same as before, but the annoying error messages no longer get written to the error stack. - The syntax for column filtering has been modified so that if one only specifies a list of column names, then only those columns will be copied into the output file. This provides a simple way to make a copy of a table containing only a specified list of columns. If the column specifier explicitly deletes a column, however, than all the other columns will be copied to the filtered input file, regardless of whether the columns were listed or not. Similarly, if the expression specifies only a column to be modified or created, then all the other columns in the table will be copied. mytable.fit[1][col Time;Rate] - only the Time and Rate columns will be copied to the filtered input file. mytable.fit[1][col -Time ] - all but the Time column are copied to the filtered input file. mytable.fit[1][col Rate;-Time] - same as above. - changed a '#if defined' statement in f77_wrap.h and f77_wrap1.c to support the fortran wrappers on 64-bit IBM/RS6000 systems - modified group.c so that when attaching one group (the child) to another (the parent), check in each file for the existence of a pointer to the other before adding the link. This is to prevent multiple links from forming under all circumstances. - modified the filename parser to accept 'STDIN', 'stdin', 'STDOUT' and 'stdout' in addition to '-' to mean read the file from standard input or write to standard output. - Added support for reversing an axis when reading a subsection of a compressed image using the extended filename syntax, as in myfile.fits+1[-*, *] or myfile.fits+1[600:501,501:600] - When copying a compressed image to a uncompressed image, the EXTNAME keyword is no longer copied if the value is equal to 'COMPRESSED_IMAGE'. - slight change to the comment field of the DATE keyword to reflect the fact that the Unix system date and time is not true UTC time. Bug fixes: - fits_write_key_longstr was not writing the keyword if a null input string value was given. - writing data to a variable length column, if that binary table is not the last HDU in the FITS file, might overwrite the following HDU. Fixed this by changing the order of a couple operations in ffgcpr. - deleting a column from a table containing variable length columns could cause the last few FITS blocks of the file to be reset = 0. This bug occurred as a result of modifications to ffdblk in v2.202. This mainly affects users of the 'compress_fits' utility program. - fixed obscure problem when writing bits to a variable length 'B' column. - when reading a subsection of an image, the BSCALE and BZERO pixel scaling may not have been applied when reading image pixel values (even though the scaling keywords were properly written in the header). - fits_get_keyclass was not returning 'TYP_STRUCT_KEY' for the END keyword. Version 2.204 - 26 July 2001 Bug fixes: - Re-write of fits_clean_url in group.c to solve various problems with invalid bounds checking. Version 2.203 - 19 July 2001 (version in FTOOLS v5.1) Enhancements: - When a row selection or calculator expression is written in an external file (and read by CFITSIO with the '@filename' syntax) the file can now contain comment lines. The comment line must begin with 2 slash characters as the first 2 characters on the line. CFITSIO will ignore the entire line when reading the expression. Bug fixes: - With previous versions of CFITSIO, the pixel values in a FITS image could be read incorrectly in the following case: when opening a subset of a FITS image (using the 'filename.fits[Xmin:Xmax,Ymin:Ymax]' notation) on a PC linux, PC Windows, or DEC OSF machine (but not on a SUN or Mac). This problem only occurs when reading more than 8640 bytes of data (2160 4-byte integers) at a time, and usually only occurs if the reading program reads the pixel data immediately after opening the file, without first reading any header keywords. This error would cause strips of zero valued pixels to appear at semi-random positions in the image, where each strip usually would be 2880 bytes long. This problem does not affect cases where the input subsetted image is simply copied to a new output FITS file. Version 2.202 - 22 May 2001 Enhancements: - revised the logic in the routine that tests if a point is within a region: if the first region is an excluded region, then it implicitly assumes a prior include region covering the entire detector. It also now supports cases where a smaller include region is within a prior exclude region. - made enhancement to ffgclb (read bytes) so that it can also read values from a logical column, returning an array of 1s and 0s. - defined 2 new grouping error status values (349, 350) in cfitsio.h and made minor changes to group.c to use these new status values. - modified fits_open_file so that if it encounters an error while trying to move to a user-specified extension (or select a subset of the rows in an input table, or make a histogram of the column values) it will close the input file instead of leaving it open. - when using the extended filename syntax to filter the rows in an input table, or create a histogram image from the values in a table column, CFITSIO now writes HISTORY keywords in the output file to document the filtering expression that was used. Bug fixes: - ffdblk (called by ffdrow) could overwrite the last FITS block(s) in the file in some cases where one writes data to a variable length column and then calls ffdrow to delete rows in the table. This bug was similar to the ffiblk bug that was fixed in v2.033. - modified fits_write_col_null to fix a problem which under unusual circumstances would cause a End-of-File error when trying to read back the value in an ASCII string column, after initializing if by writing a null value to it. - fixed obscure bug in the calculator function that caused an error when trying to modify the value of a keyword in a HDU that does not have a NAXIS2 keyword (e.g., a null primary array). - the iterator function (in putcol.c) had a bug when calculating the optimum number rows to process in the case where the table has very wide rows (>33120 bytes) and the calculator expression involves columns from more than one FITS table. This could cause an infinite loop in calls to the ffcalc calculator function. - fixed bug in ffmvec, which modifies the length of an existing vector column in a binary table. If the vector was reduced in length, the FITS file could sometimes be left in a corrupted state, and in all cases the values in the remaining vector elements of that column would be altered. - in drvrfile.c, replaced calls to fsetpos and fgetpos with fseek and ftell (or fseeko and ftello) because the fpos_t filetype used in fsetpos is incompatible with the off_t filetype used in fseek, at least on some platforms (Linux 7.0). (This fix was inserted into the V2.201 release on April 4). - added "#define fits_write_pixnull ffppxn" to longnam.h Version 2.201 - 15 March 2001 Enhancements - enhanced the keyword reading routines so that they will do implicit datatype conversion from a string keyword value to a numeric keyword value, if the string consist of a valid number enclosed in quotes. For example, the keyword mykey = '37.5' can be read by ffgkye. - modified ffiimg so that it is possible to insert a new primary array at the beginning of the file. The original primary array is then converted into an IMAGE extension. - modified ffcpdt (copy data unit) to support the case where the data unit is being copied between 2 HDUs in the same file. - enhanced the fits_read_pix and fits_read_pixnull routines so that they support the tiled image compression format that the other image reading routines also support. - modified the Extended File Name syntax to also accept a minus sign (-) as well as an exclamation point (!) as the leading character when specifying a column or or keyword to be deleted, as in [col -time] will delete the TIME column. - now completely support reading subimages, including pixel increments in each dimension, for tile-compressed images (where the compressed image tiles are stored in a binary table). Bug fixes: - fixed confusion in the use of the fpos_t and off_t datatypes in the fgetpos and fsetpos routines in drvrfile.c which caused problems with the Windows VC++ compiler. (fpos_t is not necessarily identical to off_t) - fixed a typo in the fits_get_url function in group.c which caused problems when determining the relative URL to a compressed FITS file. - included fitsio.h in the shared memory utility program, smem.c, in order to define OFF_T. - fixed typo in the datatype of 'nullvalue' in ffgsvi, which caused attempts to read subsections of a short integer tiled compressed image to fail with a bus error. - fixed bug in ffdkey which sometimes worked incorrectly if one tried to delete a nonexistent keyword beyond the end of the header. - fixed problem in fits_select_image_section when it writes a dummy value to the last pixel of the section. If the image contains scaled integer pixels, then in some cases the pixel value could end up out of range. - fixed obscure bug in the ffpcn_ family of routines which gave a floating exception when trying to write zero number of pixels to a zero length array (why would anyone do this?) Version 2.200 - 26 Jan 2001 Enhancements - updated the region filtering code to support the latest region file formats that are generated by the POW, SAOtng and ds9 programs. Region positions may now be given in HH:MM:SS.s, DD:MM:SS.s format, and region sizes may be given arcsec or arcmin instead of only in pixel units. Also changed the logic so that if multiple 'include' regions are specified in the region file, they are ORed together, instead of ANDed, so that the filtering keeps points that are located within any of the 'include' regions, not just the intersection of the regions. - added support for reading raw binary data arrays by converting them on the fly into virtual FITS files. - modified ffpmsg, which writes error messages to CFITSIO's internal error stack, so that messages > 80 characters long will be wrapped around into multiple 80 character messages, instead of just being truncated at 80 characters. - modified the CFITSIO parser so that expression which involve scaled integer columns get cast to double rather than int. - Modified the keyword template parsing routine, ffgthd, to support the HIERARCH keyword. - modified ffainit and ffbinit so that they don't unnecessarily allocate 0 bytes of memory if there are no columns (TFIELDS = 0) in the table that is being opened. - modified fitsio2.h to support NetBSD on Alpha OSF platforms (NetBSD does not define the '__unix__' symbol). - changed the way OFF_T is defined in fitsio.h for greater portability. - changed drvrsmem.c so it is compiled only when HAVE_SHMEM_SERVICES is defined in order to removed the conditional logic from the Makefile - reorganized the CFITSIO User's guide to make it clearer and easier for new users to learn the basic routines. - fixed ffhdef (which reserves space for more header keywords) so that is also updates the start position of the next HDU. This affected the offset values returned by ffghof. Version 2.100 - 18 Oct 2000 Enhancements - made substantial modification to the code to support Large files, i.e., files larger than 2**31 bytes = 2.1GB. FITS files up to 6 terabytes in size may now be read and written on platforms that support Large files (currently only Solaris). - modified ffpcom and ffphis, which write COMMENT and HISTORY keywords, respectively, so that they now use columns 9 - 80, instead of only columns 11 - 80. Previously, these routines avoided using columns 9 and 10, but this is was unnecessarily restrictive. - modified ffdhdu so that instead of refusing to delete the primary array, it will replace the current primary array with a null primary array containing the bare minimum of required keywords and no data. New Routines - fits_read_pix, fits_read_pixnull, fits_read_subset, and fits_write_pix routines were added to enable reading and writing of Large images, with more than 2.1e9 pixels. These new routines are now recommended as the basic routines for reading and writing all images. - fits_get_hduoff returns the byte offset in the file to the start and end of the current HDU. This routine replaces the now obsolete fits_get_hduaddr routine; it uses 'off_t' instead of 'long' as the datatype of the arguments and can support offsets in files greater than 2.1GB in size. Bug fixes: - fixed bug in fits_select_image_section that caused an integer overflow when reading very large image sections (bigger than 8192 x 8192 4-byte pixels). - improved ffptbb, the low-level table writing routine, so that it will insert additional rows in the table if the table is not already big enough. Previously it would have just over- written any HDUs following the table in the FITS file. - fixed a bug in the fits_write_col_bit/ffpclx routine which could not write to a bit 'X' column if that was the first column in the table to be written to. This bug would not appear if any other datatype column was written to first. - non-sensible (but still formally legal) binary table TFORM values such as '8A15', or '1A8' or 'A8' would confuse CFITSIO and cause it to return a 308 error. When parsing the TFORMn = 'rAw' value, the ffbnfm routine has been modified to ignore the 'w' value in cases where w > r. - fixed bug in the blsearch routine in iraffits.c which sometimes caused an out-of-bounds string pointer to be returned when searching for blank space in the header just before the 'END' keyword. - fixed minor problem in ffgtcr in group.c, which sometimes failed while trying to move to the end of file before appending a grouping table. - on Solaris, with Sun CC 5.0, one must check for '__unix' rather than '__unix__' or 'unix' as it's symbol. Needed to modify this in drvrfile.c in 3 places. - in ffextn, the FITS file would be left open if the named extension doesn't exist, thus preventing the file from being opened again later with write access. - fixed bug in ffiimg that would cause attempts to insert a new image extension following a table extension, and in front of any other type of extension, to fail. Version 2.037 - 6 July 2000 Enhancements - added support in the extended filename syntax for flipping an image along any axis either by specifying a starting section pixel number greater than the ending pixel number, or by using '-*' to flip the whole axis. Examples: "myfile.fits[1:100, 50:10]" or "myfile.fits[-*,*]". - when reading a section of an image with the extended filename syntax (e.g. image.fits[1:100:2, 1:100:2), any CDi_j WCS keywords will be updated if necessary to transfer the world coordinate system from the imput image to the output image section. - on UNIX platforms, added support for filenames that begin with "~/" or "~user/". The "~" symbol will get expanded into a string that gives the user's home directory. - changed the filename parser to support disk file names that begin with a minus sign. Previously, the leading minus sign would cause CFITSIO to try to read/write the file from/to stdin/stdout. - modified the general fits_update_key routine, which writes or updates a keyword value, to use the 'G' display format instead of the 'E' format for floating point keyword values. This will eliminate trailing zeros from appearing in the value. - added support for the "-CAR" celestial coordinate projection in the ffwldp and ffxypx routines. The "-CAR" projection is the default simplest possible linear projection. - added new fits_create_memfile/ffimem routine to create a new fits file at a designated memory location. - ported f77_wrap.h and f77_wrap1.c so that the Fortran interface wrappers work correctly on 64-bit SGI operating systems. In this environment, C 'long's are 8-bytes long, but Fortran 'integers' are still only 4-bytes long, so the words have to be converted by the wrappers. - minor modification to cfortran.h to automatically detect when it is running on a linux platform, and then define f2cFortran in that case. This eliminates the need to define -Df2cFortran on the command line. - modified group.c to support multiple "/" characters in the path name of the file to be opened/created. - minor modifications to the parser (eval.y, eval_f.c, eval_y.c) to a) add the unary '+' operator, and b) support copying the TDIMn keyword from the input to the output image under certain circumstances. - modified the lexical parser in eval_l.y and eval_l.c to support #NULL and #SNULL constants which act to set the value to Null. Support was also added for the C-conditional expression: 'boolean ? trueVal : falseVal'. - small modification to eval_f.c to write an error message to the error stack if numerical overflow occurs when evaluating an expression. - configure and configure.in now support the egcs g77 compiler on Linux platforms. Bug fixes: - fixed a significant bug when using the extended filename binning syntax to generate a 2-dimensional image from a histogram of the values in 2 table columns. This bug would cause table events that should have been located in the row just below the bottom row of the image (and thus should have been excluded from the histogram) to be instead added into the first row of the image. Similarly, the first plane of a 3-D or 4-D data cube would include the events that should have been excluded as falling in the previous plane of the cube. - fixed minor bug when parsing an extended filename that contains nested pairs of square brackets (e.g., '[col newcol=oldcol[9]]'). - fixed bug when reading unsigned integer values from a table or image with fits_read_col_uint/ffgcvuk. This bug only occurred on systems like Digital Unix (now Tru64 Unix) in which 'long' integers are 8 bytes long, and only when reading more than 7200 elements at a time. This bug would generally cause the program to crash with a segmentation fault. - modified ffgcpr to update 'heapstart' as well as 'numrows' when writing more rows beyond the end of the table. heapstart is needed to calculate if more space needs to be inserted in the table when inserting columns into the table. - modified fficls (insert column), ffmvec, ffdrow and ffdcol to not use the value of the NAXIS2 keyword as the number of rows in the table, and instead use the value that is stored in an internal structure, because the keyword value may not be up to date. - Fixed bug in the iterator function that affected the handling of null values in string columns in ASCII and binary tables. - Reading a subsample of pixels in very large images, (e.g., file = myfile.fits[1:10000:10,1:10000:10], could cause a long integer overflow (value > 2**31) in the computation of the starting byte offset in the file, and cause a return error status = 304 (negative byte address). This was fixed by changing the order of the arithmetic operations in calculating the value of 'readptr' in the ffgcli, ffgclj, ffgcle, ffgcld, etc. routines. - In version 2.031, a fix to prevent compressed files from being opened with write privilege was implemented incorrectly. The fix was intended to not allow a compressed FITS file to be opened except when a local uncompressed copy of the file is being produced (then the copy is opened with write access), but in fact the opposite behavior occurred: Compressed files could be opened with write access, EXCEPT when a local copy is produced. This has been fixed in the mem_compress_open and file_compress_open routines. - in iraffits.c, a global variable called 'val' caused multiply defined symbols warning when linking cfitsio and IRAF libraries. This was fixed by making 'val' a local variable within the routine. Version 2.036 - 1 Feb 2000 - added 2 new generic routines, ffgpf and ffgcf which are analogous to ffgpv and ffgcv but return an array of null flag values instead of setting null pixels to a reserved value. - minor change to eval_y.c and eval.y to "define alloca malloc" on all platforms, not just VMS. - added support for the unsigned int datatype (TUINT) in the generic ffuky routine and changed ffpky so that unsigned ints are cast to double instead of long before being written to the header. - modified ffs2c so that if a null string is given as input then a null FITS string (2 successive single quotes) will be returned. Previously this routine would just return a string with a single quote, which could cause an illegal keyword record to be written. - The file flush operation on Windows platforms apparently changes the internal file position pointer (!) in violation of the C standard. Put a patch into the file_flush routine to explicitly seek back to the original file position. - changed the name of imcomp_get_compressed_image_parms to imcomp_get_compressed_image_par to not exceed the 31 character limit on some compilers. - modified the filename parser (which is used when moving to a named HDU) to support EXTNAME values which contain embedded blanks. - modified drvrnet.c to deal with ftp compressed files better so that even fits files returned from cgi queries which have the wrong mime types and/or wrong types of file names should still decompress. - modified ffgics to reduce the tolerance for acceptable skewness between the axes, and added a new warning return status = APPROX_WCS_KEY in cases where there is significant skewness between the axes. - fixed bug in ffgics that affected cases where the first coordinate axis was DEC, not RA, and the image was a mirror image of the sky. - fixed bug in ffhist when trying to read the default binning factor keyword, TDBIN. - modified ffhist so that is correctly computes the rotation angle in a 2-D image if the first histogram column has a CROTA type keyword but the 2nd column does not. - modified ffcpcl so that it preserves the comment fields on the TTYPE and TFORM keywords when the column is copied to a new file. - make small change to configure.in to support FreeBSD Linux by setting CFLAGS = -Df2cFortran instead of -Dg77Fortran. Then regenerated configure with autoconf 2.13 instead of 2.12. Version 2.035 - 7 Dec 1999 (internal release only, FTOOLS 5.0.2) - added new routine called fits_get_keyclass/ffgkcl that returns the general class of the keyword, e.g., required structural keyword, WCS keyword, Comment keyword, etc. 15 classes of keywords have been defined in fitsio.h - added new routine called fits_get_img_parm/ffgipr that is similar to ffgphd but it only return the bitpix, naxis, and naxisn values. - added 3 new routines that support the long string keyword convention: fits_insert_key_longstr, fits_modify_key_longstr fits_update_key_longstr. - modified ffgphd which reads image header keywords to support the new experimental compressed image format. - when opening a .Z compressed file, CFITSIO tries to allocate memory equal to 3 times the file size, which may be excessive in some cases. This was changed so that if the allocation fails, then CFITSIO will try again to allocate only enough memory equal to 1 times the file size. More memory will be allocated later if this turns out to be too small. - improved the error checking in the fits_insert_key routine to check for illegal characters in the keyword. Version 2.034 - 23 Nov 1999 - enhanced support for the new 'CD' matrix world coordinate system keywords in the ffigics routine. This routine has been enhanced to look for the new 'CD' keywords, if present, and convert them back to the old CDELTn and CROTAn values, which are then returned. The routine will also swap the WCS parameters for the 2 axes if the declination-like axis is the first WCS axis. - modified ffphbn in putkey.c to support the 'U' and 'V" TFORM characters (which represent unsigned short and unsigned int columns) in variable length array columns. (previously only supported these types in fixed length columns). - added checks when reading gzipped files to detect unexpected EOF. Previously, the 'inflate_codes' routine would just sit in an infinite loop if the file ended unexpectedly. - modified fits_verify_chksum/ffvcks so that checksum keywords with a blank value string are treated as undefined, the same as if the keyword did not exist at all. - fixed ffghtb and ffghbn so that they return the extname value in cases where there are no columns in the table. - fixed bug in the ffgtwcs routine (this is a little utility routine to aid in interfacing to Doug Mink's WCS routines); it was not correctly padding the length of string-valued keywords in the returned string. - fixed bug in 'iraffits.c' that prevented Type-2 IRAF images from being correctly byte-swapped on PCs and DEC-OSF machines. - fixed tiny memory leak in irafncmp in iraffits.c. Only relevant when reading IRAF .imh files. - fixed a bug (introduced in version 2.027) that caused the keyword reading routines to sometimes not find a matching keyword if the input name template used the '*' wildcard as the last character. (e.g., if input name = 'COMMENT*' then it would not find the 'COMMENT' keywords. (It would have found longer keywords like 'COMMENTX' correctly). The fix required a minor change to ffgcrd in getkey.c - modified the routine (ffswap8) that does byteswapping of double precision numbers. Some linux systems have reported floating point exceptions because they were trying to interpret the bytes as a double before the bytes had been swapped. - fixed bug in the calculation of the position of the last byte in the string of bits to be read in ffgcxuk and ffgcxui. This bug generally caused no harm, but could cause the routine to exit with an invalid error message about trying to read beyond the size of the field. - If a unix machine did not have '__unix__', 'unix', or '__unix' C preprocessor symbols defined, then CFITSIO would correctly open one FITS file, but would not correctly open subsequent files. Instead it would think that the same file was being opened multiple times. This problem has only been seen on an IBM/AIX machine. The fits_path2url and fits_url2path routines in group.c were modified to fix the problem. - fixed bug in group.c, which affected WINDOWS platforms only, that caused programs to go into infinite loop when trying to open certain files. - the ftrsim Fortran wrapper routine to ffrsim was not defined correctly, which caused the naxis(2) value to be passed incorrectly on Dec OSF machines, where sizeof(long) != sizeof(int). Version 2.033 - 17 Sept 1999 - New Feature: enhanced the row selection parser so that comparisons between values in different rows of the table are allowed, and the string comparisons with <, >, <=, and >= are supported. - added new routine the returns the name of the keyword in the input keyword record string. The name is usually the first 8 characters of the record, except if the HIERARCH convention is being used in which case the name may be up to 67 characters long. - added new routine called fits_null_check/ffnchk that checks to see if the current header contains any null (ASCII 0) characters. These characters are illegal in FITS headers, but they go undetected by the other CFITSIO routines that read the header keywords. - the group.c file has been replaced with a new version as supplied by the ISDC. The changes are mainly to support partial URLs and absolute URLs more robustly. Host dependent directory paths are now converted to true URLs before being read from/written to grouping tables. - modified ffnmhd slightly so that it will move to the first extension in which either the EXTNAME or the HDUNAME keyword is equal to the user-specified name. Previously, it only checked for HDUNAME if the EXTNAME keyword did not exist. - made small change to drvrnet.c so that it uncompress files which end in .Z and .gz just as for ftp files. - rewrote ffcphd (copy header) to handle the case where the input and output HDU are in the same physical FITS file. - fixed bug in how long string keyword values (using the CONTINUE convention) were read. If the string keyword value ended in an '&' character, then fits_read_key_longstr, fits_modify_key_str, and fits_delete_key would interpret the following keyword as a continuation, regardless of whether that keyword name was 'CONTINUE' as required by this convention. There was also a bug in that if the string keyword value was all blanks, then fits_modify_key_str could in certain unusual cases think that the keyword ended in an '&' and go into an infinite loop. - modified ffgpv so that it calls the higher level ffgpv_ routine rather than directly calling the lower level ffgcl_ routine. This change is needed to eventually support reading compressed images. - added 3 new routines to get the image datatype, image dimensions, and image axes length. These support the case where the image is compressed and stored in a binary table. - fixed bug in ffiblk that could sometimes cause it to insert a new block in a file somewhere in the middle of the data, instead of at the end of the HDU. This fortunately is a rare problem, mainly only occurring in certain cases when inserting rows in a binary table that contains variable length array data (i.e., has a heap). - modified fits_write_tdim so that it double checks the TFORMn value directly if the column repeat count stored in the internal structure is not equal to the product of all the dimensions. - fixed bug that prevented ffitab or ffibin from inserting a new table after a null primary array (can't read NAXIS2 keyword). Required a small change to ffrdef. - modified testprog.c so that it will continue to run even if it cannot open or process the template file testprog.tpt. - modified the logic in lines 1182-1185 of grparser.c so that it returns the correct status value in case of an error. - added test in fitsio2.h to see if __sparcv9 is defined; this identifies a machine running Solaris 7 in 64-bit mode where long integers are 64 bits long. Version 2.032 - 25 May 1999 - the distribution .tar file was changed so that all the files will be untarred into a subdirectory by default instead of into the current directory. - modified ffclos so that it always frees the space allocated by the fptr pointer, even when another fptr points to the same file. - plugged a potential (but rare in practice) memory leak in ffpinit - fixed bug in all the ffp3d_ and ffg3d_ routines in cases where the data cube that has been allocated in memory has more planes than the data cube in the FITS file. - modified drvrsmem.c so that it allocates a small shared memory segment only if CFITSIO tries to read or write a FITS file in shared memory. Previously it always allocated the segment whether it was needed or not. Also, this small segment is removed if 0 shared memory segments remain in the system. - put "static" in front of 7 DECLARE macros in compress.c because these global variables were causing conflicts with other applications programs that had variables with the same names. - modified ffasfm to return datatype = TDOUBLE instead of TFLOAT if the ASCII table column has TFORMn = 'Ew.d' with d > 6. - modified the column reading routines to a) print out the offending entry if an error occurs when trying to read a numeric ASCII table column, and b) print out the column number that had the error (the messages are written to CFITSIOs error stack) - major updates to the Fortran FITSIO User's Guide to include many new functions that have been added to CFITSIO in the past year. - modified fitsio2.h so that the test for __D_FLOAT etc. is only made on Alpha VMS machines, to avoid syntax errors on some other platforms. - modified ffgthd so that it recognizes a floating point value that uses the 'd' or 'D' exponent character. - removed the range check in fftm2s that returned an error if 'decimals' was less than zero. A negative value is OK and is used to return only the date and not the time in the string. Version 2.031 - 31 Mar 1999 - moved the code that updates the NAXIS2 and PCOUNT keywords from ffchdu into the lower lever ffrdef routine. This ensures that other routines which call ffrdef will correctly update these 2 keywords if required. Otherwise, for instance, calling fits_write_checksum before closing the HDU could cause the NAXIS2 keyword (number of rows in the table) to not be updated. - fixed bug (introduced in version 2.030) when writing null values to a primary array or image extension. If trying to set more than 1 pixel to null at a time, then typically only 1 null would be written. Also fixed related bug when writing null values to rows in a table that are beyond the currently defined size of the table (the size of the table was not being expanded properly). - enhanced the extended filename parser to support '*' in image section specifiers, to mean use the whole range of the axis. myfile.fits[*,1:100] means use the whole range of the first axis and pixels 1 to 100 in the second axis. Also supports an increment, as in myfile.fits[*:2, *:2] to use just the odd numbered rows and columns. - modified fitscore.c to set the initial max size of the header, when first reading it, to the current size of the file, rather than to 2 x 10**9 to avoid rare cases where CFITSIO ends up writing a huge file to disk. - modified file_compress_open so that it will not allow a compressed FITS file to be opened with write access. Otherwise, a program could write to the temporary copy of the uncompressed file, but the modification would be lost when the program exits. Version 2.030 - 24 Feb 1999 - fixed bug in ffpclu when trying to write a null value to a row beyond the current size of the table (wouldn't append new rows like it should). - major new feature: enhanced the routines that read ASCII string columns in tables so that they can read any table column, including logical and numeric valued columns. The column values are returned as a formatted string. The format is determined by the TDISPn keyword if present, otherwise a default format based on the datatype of the column is used. - new routine: fits_get_col_display_width/ffgcdw returns the length of the formatted strings that will be returned by the routines that read table columns as strings. - major new feature: added support for specifying an 'image section' when opening an image: e.g, myfile.fits[1:512:2,2:512:2] to open a 256x256 pixel image consisting of the odd columns and the even numbered rows of the input image. - added supporting project files and instructions for building CFITSIO under Windows NT with the Microsoft Visual C++ compiler. - changed the variable 'template' to 'templt' in testprog.c since it conflicted with a reserved word on some compilers. - modified group.c to conditionally include sys/stat.h only on unix platforms - fixed bug in the ffiter iterator function that caused it to always pass 'firstn' = 1 to the work function when reading from the primary array or IMAGE extension. It worked correctly for tables. - fixed bug in the template header keyword parser (ffgthd) in cases where the input template line contains a logical valued keyword (T or F) without any following comment string. It was previously interpreting this as a string-valued keyword. - modified ffrhdu that reads and opens a new HDU, so that it ignores any leading blank characters in the XTENSION name, e.g., XTENSION= ' BINTABLE' will not cause any errors, even though this technically violates the FITS Standard. - modified ffgtbp that reads the required table keywords to make it more lenient and not exit with an error if the THEAP keyword in binary tables cannot be read as an integer. Now it will simply ignore this keyword if it cannot be read. - added test for 'WIN32' as well as '__WIN32__' in fitsio2.h, eval.l and eval_l.c in a preprocessor statement. - changed definition of strcasecmp and strncasecmp in fitsio2.h, eval.l and eval_l.c to conform to the function prototypes under the Alpha VMS v7.1 compiler. - corrected the long function names in longnam.h for the new WCS utility functions in wcssubs.c Version 2.029 - 11 Feb 1999 - fixed bug in the way NANs and underflows were being detected on VAX and Alpha VMS machines. - enhanced the filename parser to distinguish between a VMS-style directory name (e.g. disk:[directory]myfile.fits) and a CFITSIO filter specifier at the end of the name. - modified ffgthd to support the HIERARCH convention for keyword names that are longer than 8 characters or contain characters that would be illegal in standard FITS keyword names. - modified the include statements in grparser.c so that malloc.h and memory.h are only included on the few platforms that really need them. - modified the file_read routine in drvrfile.c to ignore the last record in the FITS file it it only contains a single character that is equal to 0, 10 or 32. Text editors sometimes append a character like this to the end of the file, so CFITSIO will ignore it and treat it as if it had reached the end of file. - minor modifications to fitsio.h to help support the ROOT environment. - installed new version of group.c and group.h; the main change is to support relative paths (e.g. "../filename") in the URLs - modified the histogramming routines so that it looks for the default preferred column axes in a keyword of the form CPREF = 'Xcol, Ycol' instead of separate keywords of the form CPREF1 = 'Xcol' CPREF2 = 'Ycol' - fixed bug so that if the binning spec is just a single integer, as in [bin 4] then this will be interpreted as meaning to make a 2D histogram using the preferred or default axes, with the integer taken as the binning factor in both axes. Version 2.028 - 27 Jan 1999 - if the TNULLn keyword value was outside the range of a 'I' or 'B' column, an overflow would occur when setting the short or char to the TNULLn value, leading to incorrect values being flagged as being undefined. This has been fixed so that CFITSIO will ignore TNULLn values that are beyond the range of the column data type. - changed a few instances of the string {"\0"} to {'\0'} in the file groups.c - installed new version of the grparser.c file from the ISDC - added new WCS support routines (in wcssub.c) which make it easier to call Doug Mink's WCSlib routines for converting between plate and sky coordinates. The CFITSIO routines themselves never call a WCSlib routine, so CFITSIO is not dependent on WCSlib. - modified ffopen so that if you use the extended filename syntax to both select rows in a table and then bin columns into a histogram, then CFITSIO will simply construct an array listing the good row numbers to be used when making the histogram, instead of making a whole new temporary FITS file containing the selected rows. - modified ffgphd which parses the primary array header keywords when opening a file, to not choke on minor format errors in optional keywords. Otherwise, this prevents CFITSIO from even opening the file. - changed a few more variable declarations in compress.c from global to static. Version 2.027 - 12 Jan 1999 - modified the usage of the output filename specifier so that it, a) gives the name of the binned image, if specified, else, b) gives the name of column filtered and/or row filtered table, if specified, else c) is the name for a local copy of the ftp or http file, else, d) is the name for the local uncompressed version of the compressed FITS file, else, e) the output filename is ignored. - fixed minor bug in ffcmps, when comparing 2 strings while using a '*' wild card character. - fixed bug in ftgthd that affected cases where the template string started with a minus sign and contained 2 tokens (to rename a keyword). - added support for the HIERARCH keyword convention for reading and writing keywords longer than 8 characters or that contain ASCII characters not allowed in normal FITS keywords. - modified the extended filename syntax to support opening images that are contained in a single cell of a binary table with syntax: filename.fits[extname; col_name(row_expression)] Version 2.026 - 23 Dec 1998 - modified the group parser to: a) support CFITSIO_INCLUDE_FILES environment variable, which can point to the location of template files, and, b) the FITS file parameter passed to the parser no longer has to point to an empty file. If there are already HDUs in the file, then the parser appends new HDUs to the end of the file. - make a small change to the drvrnet.c file to accommodate creating a static version of the CFITSIO library. - added 2 new routines to read consecutive bits as an unsigned integer from a Bit 'X' or Byte 'B' column (ffgcxui and ffgcxuk). - modified the logic for determining histogram boundaries in ffhisto to add one more bin by default, to catch values that are right on the upper boundary of the histogram, or are in the last partial bin. - modified cfitsio2.h to support the new Solaris 7 64-bit mode operating system. - Add utility routine, CFits2Unit, to the Fortran wrappers which searches the gFitsFiles array for a fptr, returning its element (Fortran unit number), or allocating a new element if one doesn't already exists... for C calling Fortran calling CFITSIO. - modified configure so that it does not use the compiler optimizer when using gcc 2.8.x on Linux - (re)added the fitsio.* documentation files that describe the Fortran-callable FITSIO interface to the C routines. - modified the lexical parser in eval_f.c to fix bug in null detections and bug in ffsrow when nrows = 0. - modified ffcalc so that it creates a TNULLn keyword if appropriate when a new column is created. Also fixed detection of OVERFLOWs so that it ignores null values. - added hyperbolic trig and rounding functions to the lexical parser in the eval* files. - improved error message that gets written when the group number is out of range when reading a 'random groups' array. - added description of shared memory, grouping, and template parsing error messages to ffgerr and to the User's Guide. Moved the error code definitions from drvsmem.h to fitsio.h. - modified grparser.c to compile correctly on Alpha/OSF machines - modified drvrnet.c to eliminate compiler warnings - Modified Makefile.in to include targets for building all the sample programs that are included with CFITSIO. Version 2.025 - 1 Dec 1998 - modified ffgphd and ffgtbp so that they ignores BLANK and TNULLn keywords that do not have a valid integer value. Also, any error while reading the BSCALE, BZERO, TSCALn, or TZEROn keywords will be ignored. Previously, CFITSIO would have simply refused to read an HDU that had such an invalid keyword. - modified the parser in eval_f.c to accept out of order times in GTIs - updated cfitsio_mac.sit.hqx to fix bad target parameters for Mac's speed test program - modified template parser in grparser.c to: 1) not write GRPNAME keyword twice, and 2) assign correct value for EXTVERS keyword. - fixed minor bugs in group.c; mainly would only affect users of the INTEGRAL Data Access Layer. - temporarily removed the prototype for ffiwcs from fitsio.h until full WCS support is added to CFITSIO in the near future. - modified the HTTP driver to send a User-Agent string: HEASARC/CFITSIO/ - declared local variables in compress.c as 'static' to avoid conflicts with other libraries. Version 2.024 - 9 Nov 1998 - added new function fits_url_type which returns the driver prefix string associated with a particular FITS file pointer. Version 2.023 - 1 Nov 1998 - first full release of CFITSIO 2.0 - slightly modified the way real keyword values are formatted, to ensure that it includes a decimal point. E.g., '1.0E-09' instead of '1E-09' - added new function to support template files when creating new FITS files. - support the TCROTn WCS keyword in tables, when reading the WCS keywords. - modified the iterator to support null values in logical columns in binary tables. - fixed bug in iterator to support null values in integer columns in ASCII tables. - changed the values for FLOATNULLVALUE and DOUBLENULLVALUE to make them less likely to duplicate actual values in the data. - fixed major bug when freeing memory in the iterator function. It caused mysterious crashes on a few platforms, but had no effect on most others. - added support for reading IRAF format image (.imh files) - added more error checking to return an error if the size of the FITS file exceeds the largest value of a long integer (2.1 GB on 32-bit platforms). - CFITSIO now will automatically insert space for additional table rows or add space to the data heap, if one writes beyond the current end of the table or heap. This prevents any HDUs which might follow the current HDU from being overwritten. It is thus no longer necessary to explicitly call fits_insert_rows before writing new rows of data to the FITS file. - CFITSIO now automatically keeps track of the number of rows that have been written to a FITS table, and updates the NAXIS2 keyword accordingly when the table is closed. It is no longer necessary for the application program to updated NAXIS2. - When reading from a FITS table, CFITSIO will now return an error if the application tries to read beyond the end of the table. - added 2 routines to get the number of rows or columns in a table. - improved the undocumented feature that allows a '20A' column to be read as though it were a '20B' column by fits_read_col_byt. - added overflow error checking when reading keywords. Previously, the returned value could be silently truncated to the maximum allowed value for that data type. Now an error status is returned whenever an overflow occurs. - added new set of routines dealing with hierarchical groups of files. These were provided by Don Jennings of the INTEGRAL Science Data Center. - added new URL parsing routines. - changed the calling sequence to ffghad (get HDU address) from ffghad(fitsfile *fptr, > long *headstart, long *dataend) to ffghad(fitsfile *fptr, > long *headstart, long datastart, long *dataend, int *status) - major modification to support opening the same FITS file more than once. Now one can open the same file multiple times and read and write simultaneously to different HDUs within the file. fits_open_file automatically detects if the file is already opened. - added the ability to clobber/overwrite an existing file with the same name when creating a new output file. Just precede the output file name with '!' (an exclamation mark) - changed the ffpdat routine which writes the DATE keyword to use the new 'YYYY-MM-DDThh:mm:ss' format. - added several new routines to create or parse the new date/time format string. - changed ifdef for DECFortran in f77_wrap.h and f77_wrap1.c: expanded to recognize Linux/Alpha - added new lexical parsing routines (from Peter Wilson): eval_l.c, eval_y.c, eval_f.c, eval_defs.h, and eval_tab.h. These are used when doing on-the-fly table row selections. - added new family of routines to support reading and writing 'unsigned int' data type values in keywords, images or tables. - restructured all the putcol and getcol routines to provide simpler and more robust support for machines which have sizeof(long) = 8. Defined a new datatype INT32BIT which is always 32 bits long (platform independent) and is used internally in CFITSIO when reading or writing BITPIX = 32 images or 'J' columns. This eliminated the need for specialize routines like ffswaplong, ffunswaplong, and ffpacklong. - overhauled cfileio.c (and other files) to use loadable drivers for doing data I/O to different devices. Now CFITSIO support network access to ftp:// and http:// files, and to shared memory files. - removed the ffsmem routine and replaced it with ffomem. This will only affect software that reads an existing file in core memory. (written there by some other process). - modified all the ffgkn[] routines (get an array of keywords) so that the 'nfound' parameter is = the number of keywords returned, not the highest index value on the returned keywords. This makes no difference if the starting index value to look for = 1. This change is not backward compatible with previous versions of CFITSIO, but is the way that FITSIO behaved. - added new error code = 1 for any application error external to CFITSIO. Also reports "unknown error status" if the value doesn't match a known CFITSIO error. Version 1.42 - 30 April 1998 (included in FTOOLS 4.1 release) - modified the routines which read a FITS float values into a float array, or read FITS double values into a double array, so that the array value is also explicitly set in addition to setting the array of flag values, if the FITS value is a NaN. This ensures that no NaN values get passed back to the calling program, which can cause serious problems on some platforms (OSF). - added calls to ffrdef at the beginning of the insert or delete rows or columns routines in editcol.c to make sure that CFITSIO has correctly initialized the HDU information. - added new routine ffdrws to delete a list of rows in a table - added ffcphd to copy the header keywords from one hdu to another - made the anynul parameter in the ffgcl* routines optional by first checking to see if the pointer is not null before initializing it. - modified ffbinit and ffainit to ignore minor format errors in header keywords so that cfitsio can at least move to an extension that contains illegal keywords. - modified all the ffgcl* routines to simply return without error if nelem = 0. - added check to ffclose to check the validity of the fitsfile pointer before closing it. This should prevent program crashes when someone tries to close the same file more than once. - replaced calls to strcmp and strncmp with macros FSTRCMP and FSTRNCMP in a few places to improve performance when reading header keywords (suggested by Mike Noble) Bug Fixes: - fixed typo in macro definition of error 504 in the file fitsio.h. - in ffopen, reserved space for 4 more characters in the input file name in case a '.zip' suffix needs to be added. - small changes to ffpclx to fix problems when writing bit (X) data columns beyond the current end of file. - fixed small bug in ffcrhd where a dummy pointer was not initialized - initialized the dummy variable in ffgcfe and ffgcfd which was causing crashes under OSF in some cases. - increased the length of the allocated string ffgkls by 2 to support the case of reading a numeric keyword as a string which doesn't have the enclosing quote characters. Version 1.4 - 6 Feb 1998 - major restructuring of the CFITSIO User's Guide - added the new 'iterator' function. The fortran wrapper is in f77_iter.c for now. - enhanced ffcrtb so that it writes a dummy primary array if none currently exists before appending the table. - removed the ffgcl routine and replaced it with ffgcvl - modified ffpcnl to just take a single input null value instead of an entire array of null value flags. - modified ffcmps and ffgnxk so that, for example, the string 'rate' is not considered a match to the string 'rate2', and 'rate*' is a match to the string 'rate'. - modified ffgrsz to also work with images, in which case it returns the optimum number of pixels to process at one time. - modified ffgthd to support null valued keywords - added a new source file 'f77_wrap.c' that includes all the Fortran77 wrapper routines for calling CFITSIO. This will eventually replace the Fortran FITSIO library. - added new routines: ffppn - generic write primary array with null values ffpprn - write null values to primary array ffuky - 'update' a keyword value, with any specified datatype. ffrprt - write out report of error status and error messages ffiter - apply a user function iteratively to all the rows of a table ffpkyc - write complex-valued keyword ffpkym - write double complex-valued keyword ffpkfc - write complex-valued keyword in fixed format ffpkfm - write double complex-valued keyword in fixed format ffgkyc - read complex-valued keyword ffgkym - read double complex-valued keyword ffmkyc - modify complex-valued keyword ffmkym - modify double complex-valued keyword ffmkfc - modify complex-valued keyword in fixed format ffmkfm - modify double complex-valued keyword in fixed format ffukyc - update complex-valued keyword ffukym - update double complex-valued keyword ffukfc - update complex-valued keyword in fixed format ffukfm - update double complex-valued keyword in fixed format ffikyc - insert complex-valued keyword ffikym - insert double complex-valued keyword ffikfc - insert complex-valued keyword in fixed format ffikfm - insert double complex-valued keyword in fixed format ffpktp - write or modify keywords using ASCII template file ffcpcl - copy a column from one table to another ffcpky - copy an indexed keyword from one HDU to another ffpcnl - write logical values, including nulls, to binary table ffpcns - write string values, including nulls, to table ffmnhd - move to HDU with given exttype, EXTNAME and EXTVERS values ffthdu - return the total number of HDUs in the file ffghdt - return the type of the CHDU ffflnm - return the name of the open FITS file ffflmd - return the mode of the file (READONLY or READWRITE) - modified ffmahd and ffmrhd (to move to a new extension) so that a null pointer may be given for the returned HDUTYPE argument. - worked around a bug in the Mac CWpro2 compiler by changing all the statements like "#if BYTESWAPPED == TRUE" to "if BYTESWAPPED". - modified ffitab (insert new ASCII table) to allow tables with zero number of columns - modified Makefile.in and configure to define the -Dg77Fortran CFLAGS variable on Linux platforms. This is needed to compile the new f77_wrap.c file (which includes cfortran.h) Bug Fixes: - fixed small bug in ffgrz (get optimum row size) which sometimes caused it to return slightly less than the maximum optimum size. This bug would have done no harm to application programs. - fixed bug in ffpclk and ffgclk to add an 'else' case if size of int is not equal to size of short or size of long. - added test to ffgkls to check if the input string is not null before allocating memory for it. Version 1.32 - 21 November 1997 (internal release only) - fixed bug in the memory deallocation (free) statements in the ffopen routine in the cfileio.c file. - modified ffgphd to tolerate minor violations of the FITS standard in the format of the XTENSION = 'IMAGE ' keyword when reading FITS files. Extra trailing spaces are now allowed in the keyword value. (FITS standard will be changed so that this is not a violation). Version 1.31 - 4 November 1997 (internal release only) Enhancements: - added support for directly reading compressed FITS files by copying the algorithms from the gzip program. This supports the Unix compress, gzip and pkzip algorithms. - modified ffiimg, ffitab, and ffibin (insert HDUs into a FITS file) so that if the inserted HDU is at the end of the FITS file, then it simply appends a new empty HDU and writes the required keywords. This allows space to be reserved for additional keywords in the header if desired. - added the ffchfl and ffcdfl routines to check the header and data fill values, for compatibility with the Fortran FITSIO library. - added the ffgsdt routine to return the system date for compatibility with the Fortran FITSIO library. - added a diagnostic error message (written to the error stack) if the routines that read data from image or column fail. - modified ffgclb so that it simply copies the bytes from an ASCII 'nA' or 'An' format column into the user's byte array. Previously, CFITSIO would return an error when trying to read an 'A' column with ffgclb. - modified ffpclb so that it simply copies the input array of bytes to an ASCII 'nA' or 'An' format column. Previously, CFITSIO would return an error when trying to write to an 'A' column with ffpclb. Bug Fixes: - ffgkls was allocating one too few bytes when reading continued string keyword values. - in testprog.c added code to properly free the memory that had been allocated for string arrays. - corrected typographical errors in the User's Guide. Version 1.30 - 11 September 1997 - major overhaul to support reading and writing FITS files in memory. The new routines fits_set_mem_buff and fits_write_mem_buff have been added to initialize and copy out the memory buffer, respectively. - added support for reading FITS files piped in on 'stdin' and piped out on 'stdout'. Just specify the file name as '-' when opening or creating the FITS file. - added support for 64-bit SGI IRIX machines. This required adding routines to pack and unpack 32-bit integers into 64-bit integers. - cleaned up the code that supports G_FLOAT and IEEE_FLOAT on Alpha VMS systems. Now, the type of float is determined at compile time, not run time. Bug Fixes: - replaced the malloc calls in the error message stack routines with a static fixed size array. The malloc's cause more problems than they solved, and were prone to cause memory leaks if users don't clear the error message stack when closing the FITS file. - when writing float or double keywords, test that the value is not a special IEEE value such as a NaN. Some compilers would write the string 'NaN' in this case into the output value string. - fixed bug in ffiblk, to ignore EOF status return if it is inserting blocks at the end of the file. - removed the 'l' from printf format string that is constructed in the ffcfmt routine. This 'l' is non-standard and causes problems with the Metrowerks compiler on a Mac. - the default null value in images was mistakenly being set equal to NO_NULL = 314, rather than NULL_UNDEFINED = 1234554321 in the ffgphd routine. - check status value in ffgkls to make sure the keyword exists before allocating memory for the value string. - fixed the support for writing and reading unsigned long integer keyword values in ffpky and ffgky by internally treating the values as doubles. This required changes to ffc2r and ffc2d as well. - added explicit cast to 'double' in one place in putcolb.c and 6 places in pubcolui.c, to get rid of warning messages issued by one compiler. - in ffbinit and ffainit, it is necessary to test that tfield > 0 before trying to allocate memory with calloc. Otherwise, some compilers return a null pointer which CFITSIO interprets to mean the memory allocation failed. - had to explicitly cast the null buffer pointer to a char pointer (cptr = (char *)buffer;) in 4 places in the buffers.c file to satisfy a picky C++ compiler. - changed the test for an ALPHA VMS system to see if '__VMS' is defined, rather than 'VMS'. The latter is not defined by at least one C++ compiler. - modified ffpcls so that it can write a null string to a variable length string column, without going into an infinite loop. - fixed bug in ffgcfl that caused the 'next' variable to be incremented twice. - fixed bug in ffgcpr that caused it write 2x the number of complex elements into the descriptor when writing to a complex or double complex variable length array column. - added call to ffrdef at the end of ffrsim to ensure that the internal structures are updated to correspond to the modified header keywords Version 1.25 - 7 July 1997 - improved the efficiency of the ffiblk routine, when inserting more than one block into the file. - fixed bug in ffwend that in rare instances caused the beginning of the following extension to be overwritten by blank fill. - added new routine to modify the size of an existing primary array or image extension: fits_resize_img/ffrsim. - added support for null-valued keywords, e.g., keywords that have no defined value. These keywords have an equal sign and space in columns 9-10, but have not value string. Example: KEYNAME = / null-valued keyword Support for this feature required the following changes: - modified ffpsvc to return a null value string without error - modified ffc2[ilrd] to return error VALUE_UNDEFINED in this case - modified ffgkn[sljed] to continue reading additional keywords even if one or more keywords have undefined values. - added 4 new routines: ffpkyu, ffikyu, ffmkyu, ffukyu to write, insert, modify, or update an undefined keyword - a new makefile.os2 file was added, for building CFITSIO on OS/2 systems. - modified ffgtkn so that if it finds an unexpected keyword name, the returned error status = BAD_ORDER instead of NOT_POS_INT. - added 2 new routines, fits_write_key_unit/ffpunt and fits_read_key_unit/ffgunt to write/read the physical units of a keyword value. These routines use a local FITS convention for storing the units in square brackets following the '/' comment field separator, as in: VELOCITY= 12 / [km/s] orbit speed The testprog.c program was modified to test these new routines. - in the test of Alpha OSF/1 machines in fitsio2.h, change 'defined(unix)' to 'defined(__unix__)' which appears to be a more robust test. - remove test for linux environment variable from fitsio2.h Version 1.24 - 2 May 1997 - fixed bug in ffpbyt that incorrectly computed the current location in the FITS file when writing > 10000 bytes. - changed the datatype of the 'nbytes' parameter in ffpbyt from 'int' to 'long'. Made corresponding datatype change to some internal variables in ffshft. - changed '(unsigned short *)' to '(short *)' in getcolui.c, and changed '(unsigned long *)' to '(long *)' in getcoluj.c, to work around problem with the VAX/VMS cc compiler. Version 1.23 - 24 April 1997 - modified ffcins and ffdins (in editcol.c) to simply return without error if there are no (zero) rows in the table. Version 1.22 - 18 April 1997 - fixed bug in ffgcpr that caused it to think that all values were undefined in ASCII tables columns that have TNULLn = ' ' (i.e., the TNULLn keyword value is a string of blanks. - fixed bug in the ffgcl[bdeijk,ui,uj] family of routines when parsing a numeric value in an ASCII table. The returned values would have the decimal place shifted to the left if the table field contained an explicit decimal point followed by blanks. Example: in an F5.2 column, the value '16. ' would be returned as 0.16. If the trailing zeros were present, then cfitsio returned the correct value (e.g., '16.00' returns 16.). - fixed another bug in the ffgcl[bdeijk,ui,uj] family of routines that caused them to misread values in an ASCII table in rows following an undefined value when all the values were read at once in a single call to the routine. Version 1.21 - 26 March 1997 - added general support for reading and writing unsigned integer keywords, images, and binary table column values. - fixed bug in the way the column number was used in ffgsve and similar routines. This bug caused cfitsio to read (colnum - 1) rather than the desired column. - fixed a bug in ftgkls that prevented it from reading more than one continuation line of a long string keyword value. - fixed the definition of fits_write_longwarn in longnam.h Version 1.20 - 29 Jan 1997 - when creating a binary table with variable length vector columns, if the calling routine does not specify a value for the maximum length of the vector (e.g., TFORMn = '1PE(400)') then cfitsio will automatically calculate the maximum value and append it to the TFORM value when the binary table is first closed. - added the set of routines to do coordinate system transformations - added support for wildcards ('*', '?', and '#') in the input keyword name when reading, modifying, or deleting keywords. - added new general keyword reading routine, ffgnxk, to return the next keyword whose name matches a list of template names, but does not match any names on a second template list. - modified ftgrec so that it simply moves to the beginning of the header if the input keyword number = 0 - added check in ffdelt to make sure the input fits file pointer is not already null - added check in ffcopy to make sure the output HDU does not already contain any keywords (it must be empty). - modified ffgcls so that it does not test if each string column value equals the null string value if the null string value is longer than the width of the column. - fixed bug in ftgtdm that caused it to fail if the TDIMn keyword did not exist in the FITS file - modified testprog.c to include tests of keyword wildcards and the WCS coordinate transformation routines. - added a test for 'EMX' in fitsio2.h so that cfitsio builds correctly on a PC running OS/2. Version 1.11 - 04 Dec 1996 - modified the testprog.c program that is included with the distribution, so that the output FITS file is identical to that produced by the Fortran FITSIO test program. - changed all instances of the 'extname' variable to 'extnm' to avoid a conflict with the -Dextname switch in cfortran.h on HP machines. - in all the routines like ffi4fi1, which convert an array of values to integers just prior to writing them to the FITS file, the integer value is now rounded to the nearest integer rather than truncated. (ffi4fi1, ffi4fi2, ffi4fi4, etc) - changed ffgcfl (and hence ffgcl) so that the input value of the logical array element is not changed if the corresponding FITS value is undefined. - in ffgacl, the returned value of TBCOL was off by 1 (too small) - fixed the comment of EXTNAME keyword to read 'binary table' instead of 'ASCII table' in the header of binary tables. Version 1.101 - 17 Nov 1996 - Made major I/O efficiency improvements by adding internal buffers rather than directly reading or writing to disk. Access to columns in binary tables is now 50 - 150 times faster. Access to FITS image is also slightly faster. - made significant speed improvements when reading numerical data in FITS ASCII tables by writing my own number parsing routines rather than using the sscanf C library routine. This change requires that the -lm argument now be included when linking a program that calls cfitsio (under UNIX). - regrouped the source files into logically related sets of routines. The Makefile now runs much faster since every single routine is not split into a separate file. - now use the memcpy function, rather than a 'for' loop in several places for added efficiency - redesigned the low-level binary table read and write routines (ffpbytoff and ffgbytoff) for greater efficiency. - added a new error status: 103 = too many open FITS files. - added a 'extern "C"' statement around the function prototypes in fitsio.h, to support use of cfitsio by C++ compilers. - fixed routines for writing or reading fixed-length substrings within a binary table ASCII column, with TFORM values of of the form 'rAw' where 'r' is the total width of the ASCII column and 'w' is the width of a substring within the column. - no longer automatically rewrite the END card and following fill values if they are already correct. - all the 'get keyword value and comment' routines have been changed so that the comment is not returned if the input pointer is NULL. - added new routine to return the optimum number of tables rows that should be read or written at one time for optimum efficiency. - modified the way numerical values in ASCII tables are parsed so that embedded spaces in the value are ignored, and implicit decimal points are now supported. (e.g, the string '123E 12' in a 'E10.2' format column will be interpreted as 1.23 * 10**12). - modified ffpcl and ffgcl to support binary table columns of all datatype (added logical, bit, complex, and double complex) - when writing numerical data to ASCII table columns, the ffpcl_ routines now return an overflow error if a value is too large to be expressed in the column format. - closed small memory leak in ffpcls. - initialized the 'incre' variable in ffgcpr to eliminate compiler warning. Version 1.04 - 17 Sept 1996 - added README.MacOS and cfitsio_mac.sit.hqx to the distribution to support the Mac platforms. - fixed bug in ffpdfl that caused an EOF error (107) when a program creates a new extension that is an exact multiple of 2880 bytes long, AND the program does not write a value to the last element in the table or image. - fixed bug in all the ffgsf* and ffgcv* routines which caused core dumps when reading null values in a table. Version 1.03 - 20 August 1996 - added full support for reading and writing the C 'int' data type. This was a problem on Alpha/OSF where short, int, and long datatypes are 2, 4, and 8 bytes long, respectively. - cleaned up the code in the byte-swapping routines. - renamed the file 'longname.h' to 'longnam.h' to avoid conflict with a file with the same name in another unrelated package. Version 1.02 - 15 August 1996 - ffgtbp was not correctly reading the THEAP keyword, hence would not correctly read variable length data in binary tables if the heap was not at the default starting location (i.e., starting immediately after the fixed length table). - now force the cbuff variable in ffpcl_ and ffgcl_ to be aligned on a double word boundary. Non-alignment can cause program to crash on some systems. Version 1.01 - 12 August 1996 - initial public release astropy-0.3/cextern/cfitsio/putcoli.c0000644000175000017500000010374112243255342016140 0ustar oleole/* This file, putcoli.c, contains routines that write data elements to */ /* a FITS image or table, with short datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppri( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ short *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; short nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TSHORT, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcli(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppni( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ short *array, /* I - array of values that are written */ short nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; short nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TSHORT, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcni(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2di(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3di(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3di(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TSHORT, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcli(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcli(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssi(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TSHORT, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcli(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpi( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ short *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcli(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcli( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ short *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped, then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise, we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TSHORT) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TSHORT): if (writeraw) { /* write raw input bytes without conversion */ ffpi2b(fptr, ntodo, incre, &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffi2fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); } break; case (TLONGLONG): ffi2fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffi2fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TLONG): ffi2fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TFLOAT): ffi2fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffi2fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffi2fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcli).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcni( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ short *array, /* I - array of values to write */ short nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcli(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcli(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcli(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fi1(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fi2(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { memcpy(output, input, ntodo * sizeof(short) ); } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fi4(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (INT32BIT) input[ii]; /* just copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fi8(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fr4(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fr8(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffi2fstr(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr, *tptr; cptr = output; tptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/getcoli.c0000644000175000017500000021615112243255342016107 0ustar oleole/* This file, getcoli.c, contains routines that read data elements from */ /* a FITS image or table, with short datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvi( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ short nulval, /* I - value for undefined pixels */ short *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; short nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TSHORT, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcli(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfi( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ short *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TSHORT, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcli(fptr, 2, row, firstelem, nelem, 1, 2, 0, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2di(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ short nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3di(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3di(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ short nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; LONGLONG nfits, narray; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}; LONGLONG lpixel[3]; short nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TSHORT, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcli(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcli(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvi(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ short nulval, /* I - value to set undefined pixels */ short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; short nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvi is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TSHORT, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvi: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgcli(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfi(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ short *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; short nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvi is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TSHORT, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvi: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcli(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpi( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ short *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcli(fptr, 1, row, firstelem, nelem, 1, 1, 0, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvi(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ short nulval, /* I - value for null pixels */ short *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfi(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ short *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { short dummy = 0; ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcli( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ short nulval, /* I - value for null pixels if nultyp = 1 */ short *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TSHORT) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, &array[next], status); if (convert) fffi2i2(&array[next], ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8i2( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1i2((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4i2((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4i2((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8i2((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstri2((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgcli).", dtemp+1, dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgcli).", dtemp+1, dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1i2(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (short) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2i2(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { memcpy(output, input, ntodo * sizeof(short) ); } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4i2(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8i2(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4i2(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (zero > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8i2(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (zero > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstri2(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/pliocomp.c0000644000175000017500000001562712243255342016310 0ustar oleole/* stdlib is needed for the abs function */ #include /* The following prototype code was provided by Doug Tody, NRAO, for performing conversion between pixel arrays and line lists. The compression technique is used in IRAF. */ int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); /* * PL_P2L -- Convert a pixel array to a line list. The length of the list is * returned as the function value. * * Translated from the SPP version using xc -f, f2c. 8Sep99 DCT. */ #ifndef min #define min(a,b) (((a)<(b))?(a):(b)) #endif #ifndef max #define max(a,b) (((a)>(b))?(a):(b)) #endif int pl_p2li (int *pxsrc, int xs, short *lldst, int npix) /* int *pxsrc; input pixel array */ /* int xs; starting index in pxsrc (?) */ /* short *lldst; encoded line list */ /* int npix; number of pixels to convert */ { /* System generated locals */ int ret_val, i__1, i__2, i__3; /* Local variables */ int zero, v, x1, hi, ip, dv, xe, np, op, iz, nv, pv, nz; /* Parameter adjustments */ --lldst; --pxsrc; /* Function Body */ if (! (npix <= 0)) { goto L110; } ret_val = 0; goto L100; L110: lldst[3] = -100; lldst[2] = 7; lldst[1] = 0; lldst[6] = 0; lldst[7] = 0; xe = xs + npix - 1; op = 8; zero = 0; /* Computing MAX */ i__1 = zero, i__2 = pxsrc[xs]; pv = max(i__1,i__2); x1 = xs; iz = xs; hi = 1; i__1 = xe; for (ip = xs; ip <= i__1; ++ip) { if (! (ip < xe)) { goto L130; } /* Computing MAX */ i__2 = zero, i__3 = pxsrc[ip + 1]; nv = max(i__2,i__3); if (! (nv == pv)) { goto L140; } goto L120; L140: if (! (pv == 0)) { goto L150; } pv = nv; x1 = ip + 1; goto L120; L150: goto L131; L130: if (! (pv == 0)) { goto L160; } x1 = xe + 1; L160: L131: np = ip - x1 + 1; nz = x1 - iz; if (! (pv > 0)) { goto L170; } dv = pv - hi; if (! (dv != 0)) { goto L180; } hi = pv; if (! (abs(dv) > 4095)) { goto L190; } lldst[op] = (short) ((pv & 4095) + 4096); ++op; lldst[op] = (short) (pv / 4096); ++op; goto L191; L190: if (! (dv < 0)) { goto L200; } lldst[op] = (short) (-dv + 12288); goto L201; L200: lldst[op] = (short) (dv + 8192); L201: ++op; if (! (np == 1 && nz == 0)) { goto L210; } v = lldst[op - 1]; lldst[op - 1] = (short) (v | 16384); goto L91; L210: L191: L180: L170: if (! (nz > 0)) { goto L220; } L230: if (! (nz > 0)) { goto L232; } lldst[op] = (short) min(4095,nz); ++op; /* L231: */ nz += -4095; goto L230; L232: if (! (np == 1 && pv > 0)) { goto L240; } lldst[op - 1] = (short) (lldst[op - 1] + 20481); goto L91; L240: L220: L250: if (! (np > 0)) { goto L252; } lldst[op] = (short) (min(4095,np) + 16384); ++op; /* L251: */ np += -4095; goto L250; L252: L91: x1 = ip + 1; iz = x1; pv = nv; L120: ; } /* L121: */ lldst[4] = (short) ((op - 1) % 32768); lldst[5] = (short) ((op - 1) / 32768); ret_val = op - 1; goto L100; L100: return ret_val; } /* plp2li_ */ /* * PL_L2PI -- Translate a PLIO line list into an integer pixel array. * The number of pixels output (always npix) is returned as the function * value. * * Translated from the SPP version using xc -f, f2c. 8Sep99 DCT. */ int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix) /* short *ll_src; encoded line list */ /* int xs; starting index in ll_src */ /* int *px_dst; output pixel array */ /* int npix; number of pixels to convert */ { /* System generated locals */ int ret_val, i__1, i__2; /* Local variables */ int data, sw0001, otop, i__, lllen, i1, i2, x1, x2, ip, xe, np, op, pv, opcode, llfirt; int skipwd; /* Parameter adjustments */ --px_dst; --ll_src; /* Function Body */ if (! (ll_src[3] > 0)) { goto L110; } lllen = ll_src[3]; llfirt = 4; goto L111; L110: lllen = (ll_src[5] << 15) + ll_src[4]; llfirt = ll_src[2] + 1; L111: if (! (npix <= 0 || lllen <= 0)) { goto L120; } ret_val = 0; goto L100; L120: xe = xs + npix - 1; skipwd = 0; op = 1; x1 = 1; pv = 1; i__1 = lllen; for (ip = llfirt; ip <= i__1; ++ip) { if (! skipwd) { goto L140; } skipwd = 0; goto L130; L140: opcode = ll_src[ip] / 4096; data = ll_src[ip] & 4095; sw0001 = opcode; goto L150; L160: x2 = x1 + data - 1; i1 = max(x1,xs); i2 = min(x2,xe); np = i2 - i1 + 1; if (! (np > 0)) { goto L170; } otop = op + np - 1; if (! (opcode == 4)) { goto L180; } i__2 = otop; for (i__ = op; i__ <= i__2; ++i__) { px_dst[i__] = pv; /* L190: */ } /* L191: */ goto L181; L180: i__2 = otop; for (i__ = op; i__ <= i__2; ++i__) { px_dst[i__] = 0; /* L200: */ } /* L201: */ if (! (opcode == 5 && i2 == x2)) { goto L210; } px_dst[otop] = pv; L210: L181: op = otop + 1; L170: x1 = x2 + 1; goto L151; L220: pv = (ll_src[ip + 1] << 12) + data; skipwd = 1; goto L151; L230: pv += data; goto L151; L240: pv -= data; goto L151; L250: pv += data; goto L91; L260: pv -= data; L91: if (! (x1 >= xs && x1 <= xe)) { goto L270; } px_dst[op] = pv; ++op; L270: ++x1; goto L151; L150: ++sw0001; if (sw0001 < 1 || sw0001 > 8) { goto L151; } switch ((int)sw0001) { case 1: goto L160; case 2: goto L220; case 3: goto L230; case 4: goto L240; case 5: goto L160; case 6: goto L160; case 7: goto L250; case 8: goto L260; } L151: if (! (x1 > xe)) { goto L280; } goto L131; L280: L130: ; } L131: i__1 = npix; for (i__ = op; i__ <= i__1; ++i__) { px_dst[i__] = 0; /* L290: */ } /* L291: */ ret_val = npix; goto L100; L100: return ret_val; } /* pll2pi_ */ astropy-0.3/cextern/cfitsio/iraffits.c0000644000175000017500000015671012243255342016274 0ustar oleole/*------------------------------------------------------------------------*/ /* */ /* These routines have been modified by William Pence for use by CFITSIO */ /* The original files were provided by Doug Mink */ /*------------------------------------------------------------------------*/ /* File imhfile.c * August 6, 1998 * By Doug Mink, based on Mike VanHilst's readiraf.c * Module: imhfile.c (IRAF .imh image file reading and writing) * Purpose: Read and write IRAF image files (and translate headers) * Subroutine: irafrhead (filename, lfhead, fitsheader, lihead) * Read IRAF image header * Subroutine: irafrimage (fitsheader) * Read IRAF image pixels (call after irafrhead) * Subroutine: same_path (pixname, hdrname) * Put filename and header path together * Subroutine: iraf2fits (hdrname, irafheader, nbiraf, nbfits) * Convert IRAF image header to FITS image header * Subroutine: irafgeti4 (irafheader, offset) * Get 4-byte integer from arbitrary part of IRAF header * Subroutine: irafgetc2 (irafheader, offset) * Get character string from arbitrary part of IRAF v.1 header * Subroutine: irafgetc (irafheader, offset) * Get character string from arbitrary part of IRAF header * Subroutine: iraf2str (irafstring, nchar) * Convert 2-byte/char IRAF string to 1-byte/char string * Subroutine: irafswap (bitpix,string,nbytes) * Swap bytes in string in place, with FITS bits/pixel code * Subroutine: irafswap2 (string,nbytes) * Swap bytes in string in place * Subroutine irafswap4 (string,nbytes) * Reverse bytes of Integer*4 or Real*4 vector in place * Subroutine irafswap8 (string,nbytes) * Reverse bytes of Real*8 vector in place * Copyright: 2000 Smithsonian Astrophysical Observatory * You may do anything you like with this file except remove * this copyright. The Smithsonian Astrophysical Observatory * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. */ #include /* define stderr, FD, and NULL */ #include #include /* stddef.h is apparently needed to define size_t */ #include #define FILE_NOT_OPENED 104 /* Parameters from iraf/lib/imhdr.h for IRAF version 1 images */ #define SZ_IMPIXFILE 79 /* name of pixel storage file */ #define SZ_IMHDRFILE 79 /* length of header storage file */ #define SZ_IMTITLE 79 /* image title string */ #define LEN_IMHDR 2052 /* length of std header */ /* Parameters from iraf/lib/imhdr.h for IRAF version 2 images */ #define SZ_IM2PIXFILE 255 /* name of pixel storage file */ #define SZ_IM2HDRFILE 255 /* name of header storage file */ #define SZ_IM2TITLE 383 /* image title string */ #define LEN_IM2HDR 2046 /* length of std header */ /* Offsets into header in bytes for parameters in IRAF version 1 images */ #define IM_HDRLEN 12 /* Length of header in 4-byte ints */ #define IM_PIXTYPE 16 /* Datatype of the pixels */ #define IM_NDIM 20 /* Number of dimensions */ #define IM_LEN 24 /* Length (as stored) */ #define IM_PHYSLEN 52 /* Physical length (as stored) */ #define IM_PIXOFF 88 /* Offset of the pixels */ #define IM_CTIME 108 /* Time of image creation */ #define IM_MTIME 112 /* Time of last modification */ #define IM_LIMTIME 116 /* Time of min,max computation */ #define IM_MAX 120 /* Maximum pixel value */ #define IM_MIN 124 /* Maximum pixel value */ #define IM_PIXFILE 412 /* Name of pixel storage file */ #define IM_HDRFILE 572 /* Name of header storage file */ #define IM_TITLE 732 /* Image name string */ /* Offsets into header in bytes for parameters in IRAF version 2 images */ #define IM2_HDRLEN 6 /* Length of header in 4-byte ints */ #define IM2_PIXTYPE 10 /* Datatype of the pixels */ #define IM2_SWAPPED 14 /* Pixels are byte swapped */ #define IM2_NDIM 18 /* Number of dimensions */ #define IM2_LEN 22 /* Length (as stored) */ #define IM2_PHYSLEN 50 /* Physical length (as stored) */ #define IM2_PIXOFF 86 /* Offset of the pixels */ #define IM2_CTIME 106 /* Time of image creation */ #define IM2_MTIME 110 /* Time of last modification */ #define IM2_LIMTIME 114 /* Time of min,max computation */ #define IM2_MAX 118 /* Maximum pixel value */ #define IM2_MIN 122 /* Maximum pixel value */ #define IM2_PIXFILE 126 /* Name of pixel storage file */ #define IM2_HDRFILE 382 /* Name of header storage file */ #define IM2_TITLE 638 /* Image name string */ /* Codes from iraf/unix/hlib/iraf.h */ #define TY_CHAR 2 #define TY_SHORT 3 #define TY_INT 4 #define TY_LONG 5 #define TY_REAL 6 #define TY_DOUBLE 7 #define TY_COMPLEX 8 #define TY_POINTER 9 #define TY_STRUCT 10 #define TY_USHORT 11 #define TY_UBYTE 12 #define LEN_PIXHDR 1024 #define MAXINT 2147483647 /* Biggest number that can fit in long */ static int isirafswapped(char *irafheader, int offset); static int irafgeti4(char *irafheader, int offset); static char *irafgetc2(char *irafheader, int offset, int nc); static char *irafgetc(char *irafheader, int offset, int nc); static char *iraf2str(char *irafstring, int nchar); static char *irafrdhead(const char *filename, int *lihead); static int irafrdimage (char **buffptr, size_t *buffsize, size_t *filesize, int *status); static int iraftofits (char *hdrname, char *irafheader, int nbiraf, char **buffptr, size_t *nbfits, size_t *fitssize, int *status); static char *same_path(char *pixname, const char *hdrname); static int swaphead=0; /* =1 to swap data bytes of IRAF header values */ static int swapdata=0; /* =1 to swap bytes in IRAF data pixels */ static void irafswap(int bitpix, char *string, int nbytes); static void irafswap2(char *string, int nbytes); static void irafswap4(char *string, int nbytes); static void irafswap8(char *string, int nbytes); static int pix_version (char *irafheader); static int irafncmp (char *irafheader, char *teststring, int nc); static int machswap(void); static int head_version (char *irafheader); static int hgeti4(char* hstring, char* keyword, int* val); static int hgets(char* hstring, char* keyword, int lstr, char* string); static char* hgetc(char* hstring, char* keyword); static char* ksearch(char* hstring, char* keyword); static char *blsearch (char* hstring, char* keyword); static char *strsrch (char* s1, char* s2); static char *strnsrch ( char* s1,char* s2,int ls1); static void hputi4(char* hstring,char* keyword, int ival); static void hputs(char* hstring,char* keyword,char* cval); static void hputcom(char* hstring,char* keyword,char* comment); static void hputl(char* hstring,char* keyword,int lval); static void hputc(char* hstring,char* keyword,char* cval); static int getirafpixname (const char *hdrname, char *irafheader, char *pixfilename, int *status); int iraf2mem(char *filename, char **buffptr, size_t *buffsize, size_t *filesize, int *status); void ffpmsg(const char *err_message); /*--------------------------------------------------------------------------*/ int fits_delete_iraf_file(const char *filename, /* name of input file */ int *status) /* IO - error status */ /* Delete the iraf .imh header file and the associated .pix data file */ { char *irafheader; int lenirafhead; char pixfilename[SZ_IM2PIXFILE+1]; /* read IRAF header into dynamically created char array (free it later!) */ irafheader = irafrdhead(filename, &lenirafhead); if (!irafheader) { return(*status = FILE_NOT_OPENED); } getirafpixname (filename, irafheader, pixfilename, status); /* don't need the IRAF header any more */ free(irafheader); if (*status > 0) return(*status); remove(filename); remove(pixfilename); return(*status); } /*--------------------------------------------------------------------------*/ int iraf2mem(char *filename, /* name of input file */ char **buffptr, /* O - memory pointer (initially NULL) */ size_t *buffsize, /* O - size of mem buffer, in bytes */ size_t *filesize, /* O - size of FITS file, in bytes */ int *status) /* IO - error status */ /* Driver routine that reads an IRAF image into memory, also converting it into FITS format. */ { char *irafheader; int lenirafhead; *buffptr = NULL; *buffsize = 0; *filesize = 0; /* read IRAF header into dynamically created char array (free it later!) */ irafheader = irafrdhead(filename, &lenirafhead); if (!irafheader) { return(*status = FILE_NOT_OPENED); } /* convert IRAF header to FITS header in memory */ iraftofits(filename, irafheader, lenirafhead, buffptr, buffsize, filesize, status); /* don't need the IRAF header any more */ free(irafheader); if (*status > 0) return(*status); *filesize = (((*filesize - 1) / 2880 ) + 1 ) * 2880; /* multiple of 2880 */ /* append the image data onto the FITS header */ irafrdimage(buffptr, buffsize, filesize, status); return(*status); } /*--------------------------------------------------------------------------*/ /* Subroutine: irafrdhead (was irafrhead in D. Mink's original code) * Purpose: Open and read the iraf .imh file. * Returns: NULL if failure, else pointer to IRAF .imh image header * Notes: The imhdr format is defined in iraf/lib/imhdr.h, some of * which defines or mimicked, above. */ static char *irafrdhead ( const char *filename, /* Name of IRAF header file */ int *lihead) /* Length of IRAF image header in bytes (returned) */ { FILE *fd; int nbr; char *irafheader; char errmsg[81]; long nbhead; int nihead; *lihead = 0; /* open the image header file */ fd = fopen (filename, "rb"); if (fd == NULL) { ffpmsg("unable to open IRAF header file:"); ffpmsg(filename); return (NULL); } /* Find size of image header file */ if (fseek(fd, 0, 2) != 0) /* move to end of the file */ { ffpmsg("IRAFRHEAD: cannot seek in file:"); ffpmsg(filename); return(NULL); } nbhead = ftell(fd); /* position = size of file */ if (nbhead < 0) { ffpmsg("IRAFRHEAD: cannot get pos. in file:"); ffpmsg(filename); return(NULL); } if (fseek(fd, 0, 0) != 0) /* move back to beginning */ { ffpmsg("IRAFRHEAD: cannot seek to beginning of file:"); ffpmsg(filename); return(NULL); } /* allocate initial sized buffer */ nihead = nbhead + 5000; irafheader = (char *) calloc (1, nihead); if (irafheader == NULL) { sprintf(errmsg, "IRAFRHEAD Cannot allocate %d-byte header", nihead); ffpmsg(errmsg); ffpmsg(filename); return (NULL); } *lihead = nihead; /* Read IRAF header */ nbr = fread (irafheader, 1, nbhead, fd); fclose (fd); /* Reject if header less than minimum length */ if (nbr < LEN_PIXHDR) { sprintf(errmsg, "IRAFRHEAD header file: %d / %d bytes read.", nbr,LEN_PIXHDR); ffpmsg(errmsg); ffpmsg(filename); free (irafheader); return (NULL); } return (irafheader); } /*--------------------------------------------------------------------------*/ static int irafrdimage ( char **buffptr, /* FITS image header (filled) */ size_t *buffsize, /* allocated size of the buffer */ size_t *filesize, /* actual size of the FITS file */ int *status) { FILE *fd; char *bang; int nax = 1, naxis1 = 1, naxis2 = 1, naxis3 = 1, naxis4 = 1, npaxis1 = 1, npaxis2; int bitpix, bytepix, i; char *fitsheader, *image; int nbr, nbimage, nbaxis, nbl, nbdiff; char *pixheader; char *linebuff; int imhver, lpixhead = 0; char pixname[SZ_IM2PIXFILE+1]; char errmsg[81]; size_t newfilesize; fitsheader = *buffptr; /* pointer to start of header */ /* Convert pixel file name to character string */ hgets (fitsheader, "PIXFILE", SZ_IM2PIXFILE, pixname); hgeti4 (fitsheader, "PIXOFF", &lpixhead); /* Open pixel file, ignoring machine name if present */ if ((bang = strchr (pixname, '!')) != NULL ) fd = fopen (bang + 1, "rb"); else fd = fopen (pixname, "rb"); /* Print error message and exit if pixel file is not found */ if (!fd) { ffpmsg("IRAFRIMAGE: Cannot open IRAF pixel file:"); ffpmsg(pixname); return (*status = FILE_NOT_OPENED); } /* Read pixel header */ pixheader = (char *) calloc (lpixhead, 1); if (pixheader == NULL) { ffpmsg("IRAFRIMAGE: Cannot alloc memory for pixel header"); ffpmsg(pixname); fclose (fd); return (*status = FILE_NOT_OPENED); } nbr = fread (pixheader, 1, lpixhead, fd); /* Check size of pixel header */ if (nbr < lpixhead) { sprintf(errmsg, "IRAF pixel file: %d / %d bytes read.", nbr,LEN_PIXHDR); ffpmsg(errmsg); free (pixheader); fclose (fd); return (*status = FILE_NOT_OPENED); } /* check pixel header magic word */ imhver = pix_version (pixheader); if (imhver < 1) { ffpmsg("File not valid IRAF pixel file:"); ffpmsg(pixname); free (pixheader); fclose (fd); return (*status = FILE_NOT_OPENED); } free (pixheader); /* Find number of bytes to read */ hgeti4 (fitsheader,"NAXIS",&nax); hgeti4 (fitsheader,"NAXIS1",&naxis1); hgeti4 (fitsheader,"NPAXIS1",&npaxis1); if (nax > 1) { hgeti4 (fitsheader,"NAXIS2",&naxis2); hgeti4 (fitsheader,"NPAXIS2",&npaxis2); } if (nax > 2) hgeti4 (fitsheader,"NAXIS3",&naxis3); if (nax > 3) hgeti4 (fitsheader,"NAXIS4",&naxis4); hgeti4 (fitsheader,"BITPIX",&bitpix); if (bitpix < 0) bytepix = -bitpix / 8; else bytepix = bitpix / 8; nbimage = naxis1 * naxis2 * naxis3 * naxis4 * bytepix; newfilesize = *filesize + nbimage; /* header + data */ newfilesize = (((newfilesize - 1) / 2880 ) + 1 ) * 2880; if (newfilesize > *buffsize) /* need to allocate more memory? */ { fitsheader = (char *) realloc (*buffptr, newfilesize); if (fitsheader == NULL) { sprintf(errmsg, "IRAFRIMAGE Cannot allocate %d-byte image buffer", (int) (*filesize)); ffpmsg(errmsg); ffpmsg(pixname); fclose (fd); return (*status = FILE_NOT_OPENED); } } *buffptr = fitsheader; *buffsize = newfilesize; image = fitsheader + *filesize; *filesize = newfilesize; /* Read IRAF image all at once if physical and image dimensions are the same */ if (npaxis1 == naxis1) nbr = fread (image, 1, nbimage, fd); /* Read IRAF image one line at a time if physical and image dimensions differ */ else { nbdiff = (npaxis1 - naxis1) * bytepix; nbaxis = naxis1 * bytepix; linebuff = image; nbr = 0; if (naxis2 == 1 && naxis3 > 1) naxis2 = naxis3; for (i = 0; i < naxis2; i++) { nbl = fread (linebuff, 1, nbaxis, fd); nbr = nbr + nbl; fseek (fd, nbdiff, 1); linebuff = linebuff + nbaxis; } } fclose (fd); /* Check size of image */ if (nbr < nbimage) { sprintf(errmsg, "IRAF pixel file: %d / %d bytes read.", nbr,nbimage); ffpmsg(errmsg); ffpmsg(pixname); return (*status = FILE_NOT_OPENED); } /* Byte-reverse image, if necessary */ if (swapdata) irafswap (bitpix, image, nbimage); return (*status); } /*--------------------------------------------------------------------------*/ /* Return IRAF image format version number from magic word in IRAF header*/ static int head_version ( char *irafheader) /* IRAF image header from file */ { /* Check header file magic word */ if (irafncmp (irafheader, "imhdr", 5) != 0 ) { if (strncmp (irafheader, "imhv2", 5) != 0) return (0); else return (2); } else return (1); } /*--------------------------------------------------------------------------*/ /* Return IRAF image format version number from magic word in IRAF pixel file */ static int pix_version ( char *irafheader) /* IRAF image header from file */ { /* Check pixel file header magic word */ if (irafncmp (irafheader, "impix", 5) != 0) { if (strncmp (irafheader, "impv2", 5) != 0) return (0); else return (2); } else return (1); } /*--------------------------------------------------------------------------*/ /* Verify that file is valid IRAF imhdr or impix by checking first 5 chars * Returns: 0 on success, 1 on failure */ static int irafncmp ( char *irafheader, /* IRAF image header from file */ char *teststring, /* C character string to compare */ int nc) /* Number of characters to compate */ { char *line; if ((line = iraf2str (irafheader, nc)) == NULL) return (1); if (strncmp (line, teststring, nc) == 0) { free (line); return (0); } else { free (line); return (1); } } /*--------------------------------------------------------------------------*/ /* Convert IRAF image header to FITS image header, returning FITS header */ static int iraftofits ( char *hdrname, /* IRAF header file name (may be path) */ char *irafheader, /* IRAF image header */ int nbiraf, /* Number of bytes in IRAF header */ char **buffptr, /* pointer to the FITS header */ size_t *nbfits, /* allocated size of the FITS header buffer */ size_t *fitssize, /* Number of bytes in FITS header (returned) */ /* = number of bytes to the end of the END keyword */ int *status) { char *objname; /* object name from FITS file */ int lstr, i, j, k, ib, nax, nbits; char *pixname, *newpixname, *bang, *chead; char *fitsheader; int nblock, nlines; char *fhead, *fhead1, *fp, endline[81]; char irafchar; char fitsline[81]; int pixtype; int imhver, n, imu, pixoff, impixoff; /* int immax, immin, imtime; */ int imndim, imlen, imphyslen, impixtype; char errmsg[81]; /* Set up last line of FITS header */ (void)strncpy (endline,"END", 3); for (i = 3; i < 80; i++) endline[i] = ' '; endline[80] = 0; /* Check header magic word */ imhver = head_version (irafheader); if (imhver < 1) { ffpmsg("File not valid IRAF image header"); ffpmsg(hdrname); return(*status = FILE_NOT_OPENED); } if (imhver == 2) { nlines = 24 + ((nbiraf - LEN_IM2HDR) / 81); imndim = IM2_NDIM; imlen = IM2_LEN; imphyslen = IM2_PHYSLEN; impixtype = IM2_PIXTYPE; impixoff = IM2_PIXOFF; /* imtime = IM2_MTIME; */ /* immax = IM2_MAX; */ /* immin = IM2_MIN; */ } else { nlines = 24 + ((nbiraf - LEN_IMHDR) / 162); imndim = IM_NDIM; imlen = IM_LEN; imphyslen = IM_PHYSLEN; impixtype = IM_PIXTYPE; impixoff = IM_PIXOFF; /* imtime = IM_MTIME; */ /* immax = IM_MAX; */ /* immin = IM_MIN; */ } /* Initialize FITS header */ nblock = (nlines * 80) / 2880; *nbfits = (nblock + 5) * 2880 + 4; fitsheader = (char *) calloc (*nbfits, 1); if (fitsheader == NULL) { sprintf(errmsg, "IRAF2FITS Cannot allocate %d-byte FITS header", (int) (*nbfits)); ffpmsg(hdrname); return (*status = FILE_NOT_OPENED); } fhead = fitsheader; *buffptr = fitsheader; (void)strncpy (fitsheader, endline, 80); hputl (fitsheader, "SIMPLE", 1); fhead = fhead + 80; /* check if the IRAF file is in big endian (sun) format (= 0) or not. */ /* This is done by checking the 4 byte integer in the header that */ /* represents the iraf pixel type. This 4-byte word is guaranteed to */ /* have the least sig byte != 0 and the most sig byte = 0, so if the */ /* first byte of the word != 0, then the file in little endian format */ /* like on an Alpha machine. */ swaphead = isirafswapped(irafheader, impixtype); if (imhver == 1) swapdata = swaphead; /* vers 1 data has same swapness as header */ else swapdata = irafgeti4 (irafheader, IM2_SWAPPED); /* Set pixel size in FITS header */ pixtype = irafgeti4 (irafheader, impixtype); switch (pixtype) { case TY_CHAR: nbits = 8; break; case TY_UBYTE: nbits = 8; break; case TY_SHORT: nbits = 16; break; case TY_USHORT: nbits = -16; break; case TY_INT: case TY_LONG: nbits = 32; break; case TY_REAL: nbits = -32; break; case TY_DOUBLE: nbits = -64; break; default: sprintf(errmsg,"Unsupported IRAF data type: %d", pixtype); ffpmsg(errmsg); ffpmsg(hdrname); return (*status = FILE_NOT_OPENED); } hputi4 (fitsheader,"BITPIX",nbits); hputcom (fitsheader,"BITPIX", "IRAF .imh pixel type"); fhead = fhead + 80; /* Set image dimensions in FITS header */ nax = irafgeti4 (irafheader, imndim); hputi4 (fitsheader,"NAXIS",nax); hputcom (fitsheader,"NAXIS", "IRAF .imh naxis"); fhead = fhead + 80; n = irafgeti4 (irafheader, imlen); hputi4 (fitsheader, "NAXIS1", n); hputcom (fitsheader,"NAXIS1", "IRAF .imh image naxis[1]"); fhead = fhead + 80; if (nax > 1) { n = irafgeti4 (irafheader, imlen+4); hputi4 (fitsheader, "NAXIS2", n); hputcom (fitsheader,"NAXIS2", "IRAF .imh image naxis[2]"); fhead = fhead + 80; } if (nax > 2) { n = irafgeti4 (irafheader, imlen+8); hputi4 (fitsheader, "NAXIS3", n); hputcom (fitsheader,"NAXIS3", "IRAF .imh image naxis[3]"); fhead = fhead + 80; } if (nax > 3) { n = irafgeti4 (irafheader, imlen+12); hputi4 (fitsheader, "NAXIS4", n); hputcom (fitsheader,"NAXIS4", "IRAF .imh image naxis[4]"); fhead = fhead + 80; } /* Set object name in FITS header */ if (imhver == 2) objname = irafgetc (irafheader, IM2_TITLE, SZ_IM2TITLE); else objname = irafgetc2 (irafheader, IM_TITLE, SZ_IMTITLE); if ((lstr = strlen (objname)) < 8) { for (i = lstr; i < 8; i++) objname[i] = ' '; objname[8] = 0; } hputs (fitsheader,"OBJECT",objname); hputcom (fitsheader,"OBJECT", "IRAF .imh title"); free (objname); fhead = fhead + 80; /* Save physical axis lengths so image file can be read */ n = irafgeti4 (irafheader, imphyslen); hputi4 (fitsheader, "NPAXIS1", n); hputcom (fitsheader,"NPAXIS1", "IRAF .imh physical naxis[1]"); fhead = fhead + 80; if (nax > 1) { n = irafgeti4 (irafheader, imphyslen+4); hputi4 (fitsheader, "NPAXIS2", n); hputcom (fitsheader,"NPAXIS2", "IRAF .imh physical naxis[2]"); fhead = fhead + 80; } if (nax > 2) { n = irafgeti4 (irafheader, imphyslen+8); hputi4 (fitsheader, "NPAXIS3", n); hputcom (fitsheader,"NPAXIS3", "IRAF .imh physical naxis[3]"); fhead = fhead + 80; } if (nax > 3) { n = irafgeti4 (irafheader, imphyslen+12); hputi4 (fitsheader, "NPAXIS4", n); hputcom (fitsheader,"NPAXIS4", "IRAF .imh physical naxis[4]"); fhead = fhead + 80; } /* Save image header filename in header */ hputs (fitsheader,"IMHFILE",hdrname); hputcom (fitsheader,"IMHFILE", "IRAF header file name"); fhead = fhead + 80; /* Save image pixel file pathname in header */ if (imhver == 2) pixname = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE); else pixname = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE); if (strncmp(pixname, "HDR", 3) == 0 ) { newpixname = same_path (pixname, hdrname); if (newpixname) { free (pixname); pixname = newpixname; } } if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) { newpixname = same_path (pixname, hdrname); if (newpixname) { free (pixname); pixname = newpixname; } } if ((bang = strchr (pixname, '!')) != NULL ) hputs (fitsheader,"PIXFILE",bang+1); else hputs (fitsheader,"PIXFILE",pixname); free (pixname); hputcom (fitsheader,"PIXFILE", "IRAF .pix pixel file"); fhead = fhead + 80; /* Save image offset from star of pixel file */ pixoff = irafgeti4 (irafheader, impixoff); pixoff = (pixoff - 1) * 2; hputi4 (fitsheader, "PIXOFF", pixoff); hputcom (fitsheader,"PIXOFF", "IRAF .pix pixel offset (Do not change!)"); fhead = fhead + 80; /* Save IRAF file format version in header */ hputi4 (fitsheader,"IMHVER",imhver); hputcom (fitsheader,"IMHVER", "IRAF .imh format version (1 or 2)"); fhead = fhead + 80; /* Save flag as to whether to swap IRAF data for this file and machine */ if (swapdata) hputl (fitsheader, "PIXSWAP", 1); else hputl (fitsheader, "PIXSWAP", 0); hputcom (fitsheader,"PIXSWAP", "IRAF pixels, FITS byte orders differ if T"); fhead = fhead + 80; /* Add user portion of IRAF header to FITS header */ fitsline[80] = 0; if (imhver == 2) { imu = LEN_IM2HDR; chead = irafheader; j = 0; for (k = 0; k < 80; k++) fitsline[k] = ' '; for (i = imu; i < nbiraf; i++) { irafchar = chead[i]; if (irafchar == 0) break; else if (irafchar == 10) { (void)strncpy (fhead, fitsline, 80); /* fprintf (stderr,"%80s\n",fitsline); */ if (strncmp (fitsline, "OBJECT ", 7) != 0) { fhead = fhead + 80; } for (k = 0; k < 80; k++) fitsline[k] = ' '; j = 0; } else { if (j > 80) { if (strncmp (fitsline, "OBJECT ", 7) != 0) { (void)strncpy (fhead, fitsline, 80); /* fprintf (stderr,"%80s\n",fitsline); */ j = 9; fhead = fhead + 80; } for (k = 0; k < 80; k++) fitsline[k] = ' '; } if (irafchar > 32 && irafchar < 127) fitsline[j] = irafchar; j++; } } } else { imu = LEN_IMHDR; chead = irafheader; if (swaphead == 1) ib = 0; else ib = 1; for (k = 0; k < 80; k++) fitsline[k] = ' '; j = 0; for (i = imu; i < nbiraf; i=i+2) { irafchar = chead[i+ib]; if (irafchar == 0) break; else if (irafchar == 10) { if (strncmp (fitsline, "OBJECT ", 7) != 0) { (void)strncpy (fhead, fitsline, 80); fhead = fhead + 80; } /* fprintf (stderr,"%80s\n",fitsline); */ j = 0; for (k = 0; k < 80; k++) fitsline[k] = ' '; } else { if (j > 80) { if (strncmp (fitsline, "OBJECT ", 7) != 0) { (void)strncpy (fhead, fitsline, 80); j = 9; fhead = fhead + 80; } /* fprintf (stderr,"%80s\n",fitsline); */ for (k = 0; k < 80; k++) fitsline[k] = ' '; } if (irafchar > 32 && irafchar < 127) fitsline[j] = irafchar; j++; } } } /* Add END to last line */ (void)strncpy (fhead, endline, 80); /* Find end of last 2880-byte block of header */ fhead = ksearch (fitsheader, "END") + 80; nblock = *nbfits / 2880; fhead1 = fitsheader + (nblock * 2880); *fitssize = fhead - fitsheader; /* no. of bytes to end of END keyword */ /* Pad rest of header with spaces */ strncpy (endline," ",3); for (fp = fhead; fp < fhead1; fp = fp + 80) { (void)strncpy (fp, endline,80); } return (*status); } /*--------------------------------------------------------------------------*/ /* get the IRAF pixel file name */ static int getirafpixname ( const char *hdrname, /* IRAF header file name (may be path) */ char *irafheader, /* IRAF image header */ char *pixfilename, /* IRAF pixel file name */ int *status) { int imhver; char *pixname, *newpixname, *bang; /* Check header magic word */ imhver = head_version (irafheader); if (imhver < 1) { ffpmsg("File not valid IRAF image header"); ffpmsg(hdrname); return(*status = FILE_NOT_OPENED); } /* get image pixel file pathname in header */ if (imhver == 2) pixname = irafgetc (irafheader, IM2_PIXFILE, SZ_IM2PIXFILE); else pixname = irafgetc2 (irafheader, IM_PIXFILE, SZ_IMPIXFILE); if (strncmp(pixname, "HDR", 3) == 0 ) { newpixname = same_path (pixname, hdrname); if (newpixname) { free (pixname); pixname = newpixname; } } if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) { newpixname = same_path (pixname, hdrname); if (newpixname) { free (pixname); pixname = newpixname; } } if ((bang = strchr (pixname, '!')) != NULL ) strcpy(pixfilename,bang+1); else strcpy(pixfilename,pixname); free (pixname); return (*status); } /*--------------------------------------------------------------------------*/ /* Put filename and header path together */ static char *same_path ( char *pixname, /* IRAF pixel file pathname */ const char *hdrname) /* IRAF image header file pathname */ { int len; char *newpixname; /* WDP - 10/16/2007 - increased allocation to avoid possible overflow */ /* newpixname = (char *) calloc (SZ_IM2PIXFILE, sizeof (char)); */ newpixname = (char *) calloc (2*SZ_IM2PIXFILE+1, sizeof (char)); if (newpixname == NULL) { ffpmsg("iraffits same_path: Cannot alloc memory for newpixname"); return (NULL); } /* Pixel file is in same directory as header */ if (strncmp(pixname, "HDR$", 4) == 0 ) { (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE); /* find the end of the pathname */ len = strlen (newpixname); #ifndef VMS while( (len > 0) && (newpixname[len-1] != '/') ) #else while( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') ) #endif len--; /* add name */ newpixname[len] = '\0'; (void)strncat (newpixname, &pixname[4], SZ_IM2PIXFILE); } /* Bare pixel file with no path is assumed to be same as HDR$filename */ else if (strchr (pixname, '/') == NULL && strchr (pixname, '$') == NULL) { (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE); /* find the end of the pathname */ len = strlen (newpixname); #ifndef VMS while( (len > 0) && (newpixname[len-1] != '/') ) #else while( (len > 0) && (newpixname[len-1] != ']') && (newpixname[len-1] != ':') ) #endif len--; /* add name */ newpixname[len] = '\0'; (void)strncat (newpixname, pixname, SZ_IM2PIXFILE); } /* Pixel file has same name as header file, but with .pix extension */ else if (strncmp (pixname, "HDR", 3) == 0) { /* load entire header name string into name buffer */ (void)strncpy (newpixname, hdrname, SZ_IM2PIXFILE); len = strlen (newpixname); newpixname[len-3] = 'p'; newpixname[len-2] = 'i'; newpixname[len-1] = 'x'; } return (newpixname); } /*--------------------------------------------------------------------------*/ static int isirafswapped ( char *irafheader, /* IRAF image header */ int offset) /* Number of bytes to skip before number */ /* check if the IRAF file is in big endian (sun) format (= 0) or not */ /* This is done by checking the 4 byte integer in the header that */ /* represents the iraf pixel type. This 4-byte word is guaranteed to */ /* have the least sig byte != 0 and the most sig byte = 0, so if the */ /* first byte of the word != 0, then the file in little endian format */ /* like on an Alpha machine. */ { int swapped; if (irafheader[offset] != 0) swapped = 1; else swapped = 0; return (swapped); } /*--------------------------------------------------------------------------*/ static int irafgeti4 ( char *irafheader, /* IRAF image header */ int offset) /* Number of bytes to skip before number */ { char *ctemp, *cheader; int temp; cheader = irafheader; ctemp = (char *) &temp; if (machswap() != swaphead) { ctemp[3] = cheader[offset]; ctemp[2] = cheader[offset+1]; ctemp[1] = cheader[offset+2]; ctemp[0] = cheader[offset+3]; } else { ctemp[0] = cheader[offset]; ctemp[1] = cheader[offset+1]; ctemp[2] = cheader[offset+2]; ctemp[3] = cheader[offset+3]; } return (temp); } /*--------------------------------------------------------------------------*/ /* IRAFGETC2 -- Get character string from arbitrary part of v.1 IRAF header */ static char *irafgetc2 ( char *irafheader, /* IRAF image header */ int offset, /* Number of bytes to skip before string */ int nc) /* Maximum number of characters in string */ { char *irafstring, *string; irafstring = irafgetc (irafheader, offset, 2*(nc+1)); string = iraf2str (irafstring, nc); free (irafstring); return (string); } /*--------------------------------------------------------------------------*/ /* IRAFGETC -- Get character string from arbitrary part of IRAF header */ static char *irafgetc ( char *irafheader, /* IRAF image header */ int offset, /* Number of bytes to skip before string */ int nc) /* Maximum number of characters in string */ { char *ctemp, *cheader; int i; cheader = irafheader; ctemp = (char *) calloc (nc+1, 1); if (ctemp == NULL) { ffpmsg("IRAFGETC Cannot allocate memory for string variable"); return (NULL); } for (i = 0; i < nc; i++) { ctemp[i] = cheader[offset+i]; if (ctemp[i] > 0 && ctemp[i] < 32) ctemp[i] = ' '; } return (ctemp); } /*--------------------------------------------------------------------------*/ /* Convert IRAF 2-byte/char string to 1-byte/char string */ static char *iraf2str ( char *irafstring, /* IRAF 2-byte/character string */ int nchar) /* Number of characters in string */ { char *string; int i, j; string = (char *) calloc (nchar+1, 1); if (string == NULL) { ffpmsg("IRAF2STR Cannot allocate memory for string variable"); return (NULL); } /* the chars are in bytes 1, 3, 5, ... if bigendian format (SUN) */ /* else in bytes 0, 2, 4, ... if little endian format (Alpha) */ if (irafstring[0] != 0) j = 0; else j = 1; /* Convert appropriate byte of input to output character */ for (i = 0; i < nchar; i++) { string[i] = irafstring[j]; j = j + 2; } return (string); } /*--------------------------------------------------------------------------*/ /* IRAFSWAP -- Reverse bytes of any type of vector in place */ static void irafswap ( int bitpix, /* Number of bits per pixel */ /* 16 = short, -16 = unsigned short, 32 = int */ /* -32 = float, -64 = double */ char *string, /* Address of starting point of bytes to swap */ int nbytes) /* Number of bytes to swap */ { switch (bitpix) { case 16: if (nbytes < 2) return; irafswap2 (string,nbytes); break; case 32: if (nbytes < 4) return; irafswap4 (string,nbytes); break; case -16: if (nbytes < 2) return; irafswap2 (string,nbytes); break; case -32: if (nbytes < 4) return; irafswap4 (string,nbytes); break; case -64: if (nbytes < 8) return; irafswap8 (string,nbytes); break; } return; } /*--------------------------------------------------------------------------*/ /* IRAFSWAP2 -- Swap bytes in string in place */ static void irafswap2 ( char *string, /* Address of starting point of bytes to swap */ int nbytes) /* Number of bytes to swap */ { char *sbyte, temp, *slast; slast = string + nbytes; sbyte = string; while (sbyte < slast) { temp = sbyte[0]; sbyte[0] = sbyte[1]; sbyte[1] = temp; sbyte= sbyte + 2; } return; } /*--------------------------------------------------------------------------*/ /* IRAFSWAP4 -- Reverse bytes of Integer*4 or Real*4 vector in place */ static void irafswap4 ( char *string, /* Address of Integer*4 or Real*4 vector */ int nbytes) /* Number of bytes to reverse */ { char *sbyte, *slast; char temp0, temp1, temp2, temp3; slast = string + nbytes; sbyte = string; while (sbyte < slast) { temp3 = sbyte[0]; temp2 = sbyte[1]; temp1 = sbyte[2]; temp0 = sbyte[3]; sbyte[0] = temp0; sbyte[1] = temp1; sbyte[2] = temp2; sbyte[3] = temp3; sbyte = sbyte + 4; } return; } /*--------------------------------------------------------------------------*/ /* IRAFSWAP8 -- Reverse bytes of Real*8 vector in place */ static void irafswap8 ( char *string, /* Address of Real*8 vector */ int nbytes) /* Number of bytes to reverse */ { char *sbyte, *slast; char temp[8]; slast = string + nbytes; sbyte = string; while (sbyte < slast) { temp[7] = sbyte[0]; temp[6] = sbyte[1]; temp[5] = sbyte[2]; temp[4] = sbyte[3]; temp[3] = sbyte[4]; temp[2] = sbyte[5]; temp[1] = sbyte[6]; temp[0] = sbyte[7]; sbyte[0] = temp[0]; sbyte[1] = temp[1]; sbyte[2] = temp[2]; sbyte[3] = temp[3]; sbyte[4] = temp[4]; sbyte[5] = temp[5]; sbyte[6] = temp[6]; sbyte[7] = temp[7]; sbyte = sbyte + 8; } return; } /*--------------------------------------------------------------------------*/ static int machswap (void) { char *ctest; int itest; itest = 1; ctest = (char *)&itest; if (*ctest) return (1); else return (0); } /*--------------------------------------------------------------------------*/ /* the following routines were originally in hget.c */ /*--------------------------------------------------------------------------*/ static int lhead0 = 0; /*--------------------------------------------------------------------------*/ /* Extract long value for variable from FITS header string */ static int hgeti4 (hstring,keyword,ival) char *hstring; /* character string containing FITS header information in the format = {/ } */ char *keyword; /* character string containing the name of the keyword the value of which is returned. hget searches for a line beginning with this string. if "[n]" is present, the n'th token in the value is returned. (the first 8 characters must be unique) */ int *ival; { char *value; double dval; int minint; char val[30]; /* Get value and comment from header string */ value = hgetc (hstring,keyword); /* Translate value from ASCII to binary */ if (value != NULL) { minint = -MAXINT - 1; strcpy (val, value); dval = atof (val); if (dval+0.001 > MAXINT) *ival = MAXINT; else if (dval >= 0) *ival = (int) (dval + 0.001); else if (dval-0.001 < minint) *ival = minint; else *ival = (int) (dval - 0.001); return (1); } else { return (0); } } /*-------------------------------------------------------------------*/ /* Extract string value for variable from FITS header string */ static int hgets (hstring, keyword, lstr, str) char *hstring; /* character string containing FITS header information in the format = {/ } */ char *keyword; /* character string containing the name of the keyword the value of which is returned. hget searches for a line beginning with this string. if "[n]" is present, the n'th token in the value is returned. (the first 8 characters must be unique) */ int lstr; /* Size of str in characters */ char *str; /* String (returned) */ { char *value; int lval; /* Get value and comment from header string */ value = hgetc (hstring,keyword); if (value != NULL) { lval = strlen (value); if (lval < lstr) strcpy (str, value); else if (lstr > 1) strncpy (str, value, lstr-1); else str[0] = value[0]; return (1); } else return (0); } /*-------------------------------------------------------------------*/ /* Extract character value for variable from FITS header string */ static char * hgetc (hstring,keyword0) char *hstring; /* character string containing FITS header information in the format = {/ } */ char *keyword0; /* character string containing the name of the keyword the value of which is returned. hget searches for a line beginning with this string. if "[n]" is present, the n'th token in the value is returned. (the first 8 characters must be unique) */ { static char cval[80]; char *value; char cwhite[2]; char squot[2], dquot[2], lbracket[2], rbracket[2], slash[2], comma[2]; char keyword[81]; /* large for ESO hierarchical keywords */ char line[100]; char *vpos, *cpar = NULL; char *q1, *q2 = NULL, *v1, *v2, *c1, *brack1, *brack2; int ipar, i; squot[0] = 39; squot[1] = 0; dquot[0] = 34; dquot[1] = 0; lbracket[0] = 91; lbracket[1] = 0; comma[0] = 44; comma[1] = 0; rbracket[0] = 93; rbracket[1] = 0; slash[0] = 47; slash[1] = 0; /* Find length of variable name */ strncpy (keyword,keyword0, sizeof(keyword)-1); brack1 = strsrch (keyword,lbracket); if (brack1 == NULL) brack1 = strsrch (keyword,comma); if (brack1 != NULL) { *brack1 = '\0'; brack1++; } /* Search header string for variable name */ vpos = ksearch (hstring,keyword); /* Exit if not found */ if (vpos == NULL) { return (NULL); } /* Initialize line to nulls */ for (i = 0; i < 100; i++) line[i] = 0; /* In standard FITS, data lasts until 80th character */ /* Extract entry for this variable from the header */ strncpy (line,vpos,80); /* check for quoted value */ q1 = strsrch (line,squot); c1 = strsrch (line,slash); if (q1 != NULL) { if (c1 != NULL && q1 < c1) q2 = strsrch (q1+1,squot); else if (c1 == NULL) q2 = strsrch (q1+1,squot); else q1 = NULL; } else { q1 = strsrch (line,dquot); if (q1 != NULL) { if (c1 != NULL && q1 < c1) q2 = strsrch (q1+1,dquot); else if (c1 == NULL) q2 = strsrch (q1+1,dquot); else q1 = NULL; } else { q1 = NULL; q2 = line + 10; } } /* Extract value and remove excess spaces */ if (q1 != NULL) { v1 = q1 + 1; v2 = q2; c1 = strsrch (q2,"/"); } else { v1 = strsrch (line,"=") + 1; c1 = strsrch (line,"/"); if (c1 != NULL) v2 = c1; else v2 = line + 79; } /* Ignore leading spaces */ while (*v1 == ' ' && v1 < v2) { v1++; } /* Drop trailing spaces */ *v2 = '\0'; v2--; while (*v2 == ' ' && v2 > v1) { *v2 = '\0'; v2--; } if (!strcmp (v1, "-0")) v1++; strcpy (cval,v1); value = cval; /* If keyword has brackets, extract appropriate token from value */ if (brack1 != NULL) { brack2 = strsrch (brack1,rbracket); if (brack2 != NULL) *brack2 = '\0'; ipar = atoi (brack1); if (ipar > 0) { cwhite[0] = ' '; cwhite[1] = '\0'; for (i = 1; i <= ipar; i++) { cpar = strtok (v1,cwhite); v1 = NULL; } if (cpar != NULL) { strcpy (cval,cpar); } else value = NULL; } } return (value); } /*-------------------------------------------------------------------*/ /* Find beginning of fillable blank line before FITS header keyword line */ static char * blsearch (hstring,keyword) /* Find entry for keyword keyword in FITS header string hstring. (the keyword may have a maximum of eight letters) NULL is returned if the keyword is not found */ char *hstring; /* character string containing fits-style header information in the format = {/ } the default is that each entry is 80 characters long; however, lines may be of arbitrary length terminated by nulls, carriage returns or linefeeds, if packed is true. */ char *keyword; /* character string containing the name of the variable to be returned. ksearch searches for a line beginning with this string. The string may be a character literal or a character variable terminated by a null or '$'. it is truncated to 8 characters. */ { char *loc, *headnext, *headlast, *pval, *lc, *line; char *bval; int icol, nextchar, lkey, nleft, lhstr; pval = 0; /* Search header string for variable name */ if (lhead0) lhstr = lhead0; else { lhstr = 0; while (lhstr < 57600 && hstring[lhstr] != 0) lhstr++; } headlast = hstring + lhstr; headnext = hstring; pval = NULL; while (headnext < headlast) { nleft = headlast - headnext; loc = strnsrch (headnext, keyword, nleft); /* Exit if keyword is not found */ if (loc == NULL) { break; } icol = (loc - hstring) % 80; lkey = strlen (keyword); nextchar = (int) *(loc + lkey); /* If this is not in the first 8 characters of a line, keep searching */ if (icol > 7) headnext = loc + 1; /* If parameter name in header is longer, keep searching */ else if (nextchar != 61 && nextchar > 32 && nextchar < 127) headnext = loc + 1; /* If preceeding characters in line are not blanks, keep searching */ else { line = loc - icol; for (lc = line; lc < loc; lc++) { if (*lc != ' ') headnext = loc + 1; } /* Return pointer to start of line if match */ if (loc >= headnext) { pval = line; break; } } } /* Return NULL if keyword is found at start of FITS header string */ if (pval == NULL) return (pval); /* Return NULL if found the first keyword in the header */ if (pval == hstring) return (NULL); /* Find last nonblank line before requested keyword */ bval = pval - 80; while (!strncmp (bval," ",8)) bval = bval - 80; bval = bval + 80; /* Return pointer to calling program if blank lines found */ if (bval < pval) return (bval); else return (NULL); } /*-------------------------------------------------------------------*/ /* Find FITS header line containing specified keyword */ static char *ksearch (hstring,keyword) /* Find entry for keyword keyword in FITS header string hstring. (the keyword may have a maximum of eight letters) NULL is returned if the keyword is not found */ char *hstring; /* character string containing fits-style header information in the format = {/ } the default is that each entry is 80 characters long; however, lines may be of arbitrary length terminated by nulls, carriage returns or linefeeds, if packed is true. */ char *keyword; /* character string containing the name of the variable to be returned. ksearch searches for a line beginning with this string. The string may be a character literal or a character variable terminated by a null or '$'. it is truncated to 8 characters. */ { char *loc, *headnext, *headlast, *pval, *lc, *line; int icol, nextchar, lkey, nleft, lhstr; pval = 0; /* Search header string for variable name */ if (lhead0) lhstr = lhead0; else { lhstr = 0; while (lhstr < 57600 && hstring[lhstr] != 0) lhstr++; } headlast = hstring + lhstr; headnext = hstring; pval = NULL; while (headnext < headlast) { nleft = headlast - headnext; loc = strnsrch (headnext, keyword, nleft); /* Exit if keyword is not found */ if (loc == NULL) { break; } icol = (loc - hstring) % 80; lkey = strlen (keyword); nextchar = (int) *(loc + lkey); /* If this is not in the first 8 characters of a line, keep searching */ if (icol > 7) headnext = loc + 1; /* If parameter name in header is longer, keep searching */ else if (nextchar != 61 && nextchar > 32 && nextchar < 127) headnext = loc + 1; /* If preceeding characters in line are not blanks, keep searching */ else { line = loc - icol; for (lc = line; lc < loc; lc++) { if (*lc != ' ') headnext = loc + 1; } /* Return pointer to start of line if match */ if (loc >= headnext) { pval = line; break; } } } /* Return pointer to calling program */ return (pval); } /*-------------------------------------------------------------------*/ /* Find string s2 within null-terminated string s1 */ static char * strsrch (s1, s2) char *s1; /* String to search */ char *s2; /* String to look for */ { int ls1; ls1 = strlen (s1); return (strnsrch (s1, s2, ls1)); } /*-------------------------------------------------------------------*/ /* Find string s2 within string s1 */ static char * strnsrch (s1, s2, ls1) char *s1; /* String to search */ char *s2; /* String to look for */ int ls1; /* Length of string being searched */ { char *s,*s1e; char cfirst,clast; int i,ls2; /* Return null string if either pointer is NULL */ if (s1 == NULL || s2 == NULL) return (NULL); /* A zero-length pattern is found in any string */ ls2 = strlen (s2); if (ls2 ==0) return (s1); /* Only a zero-length string can be found in a zero-length string */ if (ls1 ==0) return (NULL); cfirst = s2[0]; clast = s2[ls2-1]; s1e = s1 + ls1 - ls2 + 1; s = s1; while (s < s1e) { /* Search for first character in pattern string */ if (*s == cfirst) { /* If single character search, return */ if (ls2 == 1) return (s); /* Search for last character in pattern string if first found */ if (s[ls2-1] == clast) { /* If two-character search, return */ if (ls2 == 2) return (s); /* If 3 or more characters, check for rest of search string */ i = 1; while (i < ls2 && s[i] == s2[i]) i++; /* If entire string matches, return */ if (i >= ls2) return (s); } } s++; } return (NULL); } /*-------------------------------------------------------------------*/ /* the following routines were originally in hget.c */ /*-------------------------------------------------------------------*/ /* HPUTI4 - Set int keyword = ival in FITS header string */ static void hputi4 (hstring,keyword,ival) char *hstring; /* character string containing FITS-style header information in the format = {/ } each entry is padded with spaces to 80 characters */ char *keyword; /* character string containing the name of the variable to be returned. hput searches for a line beginning with this string, and if there isn't one, creates one. The first 8 characters of keyword must be unique. */ int ival; /* int number */ { char value[30]; /* Translate value from binary to ASCII */ sprintf (value,"%d",ival); /* Put value into header string */ hputc (hstring,keyword,value); /* Return to calling program */ return; } /*-------------------------------------------------------------------*/ /* HPUTL - Set keyword = F if lval=0, else T, in FITS header string */ static void hputl (hstring, keyword,lval) char *hstring; /* FITS header */ char *keyword; /* Keyword name */ int lval; /* logical variable (0=false, else true) */ { char value[8]; /* Translate value from binary to ASCII */ if (lval) strcpy (value, "T"); else strcpy (value, "F"); /* Put value into header string */ hputc (hstring,keyword,value); /* Return to calling program */ return; } /*-------------------------------------------------------------------*/ /* HPUTS - Set character string keyword = 'cval' in FITS header string */ static void hputs (hstring,keyword,cval) char *hstring; /* FITS header */ char *keyword; /* Keyword name */ char *cval; /* character string containing the value for variable keyword. trailing and leading blanks are removed. */ { char squot = 39; char value[70]; int lcval; /* find length of variable string */ lcval = strlen (cval); if (lcval > 67) lcval = 67; /* Put quotes around string */ value[0] = squot; strncpy (&value[1],cval,lcval); value[lcval+1] = squot; value[lcval+2] = 0; /* Put value into header string */ hputc (hstring,keyword,value); /* Return to calling program */ return; } /*---------------------------------------------------------------------*/ /* HPUTC - Set character string keyword = value in FITS header string */ static void hputc (hstring,keyword,value) char *hstring; char *keyword; char *value; /* character string containing the value for variable keyword. trailing and leading blanks are removed. */ { char squot = 39; char line[100]; char newcom[50]; char blank[80]; char *v, *vp, *v1, *v2, *q1, *q2, *c1, *ve; int lkeyword, lcom, lval, lc, i; for (i = 0; i < 80; i++) blank[i] = ' '; /* find length of keyword and value */ lkeyword = strlen (keyword); lval = strlen (value); /* If COMMENT or HISTORY, always add it just before the END */ if (lkeyword == 7 && (strncmp (keyword,"COMMENT",7) == 0 || strncmp (keyword,"HISTORY",7) == 0)) { /* Find end of header */ v1 = ksearch (hstring,"END"); v2 = v1 + 80; /* Move END down one line */ strncpy (v2, v1, 80); /* Insert keyword */ strncpy (v1,keyword,7); /* Pad with spaces */ for (vp = v1+lkeyword; vp < v2; vp++) *vp = ' '; /* Insert comment */ strncpy (v1+9,value,lval); return; } /* Otherwise search for keyword */ else v1 = ksearch (hstring,keyword); /* If parameter is not found, find a place to put it */ if (v1 == NULL) { /* First look for blank lines before END */ v1 = blsearch (hstring, "END"); /* Otherwise, create a space for it at the end of the header */ if (v1 == NULL) { ve = ksearch (hstring,"END"); v1 = ve; v2 = v1 + 80; strncpy (v2, ve, 80); } else v2 = v1 + 80; lcom = 0; newcom[0] = 0; } /* Otherwise, extract the entry for this keyword from the header */ else { strncpy (line, v1, 80); line[80] = 0; v2 = v1 + 80; /* check for quoted value */ q1 = strchr (line, squot); if (q1 != NULL) q2 = strchr (q1+1,squot); else q2 = line; /* extract comment and remove trailing spaces */ c1 = strchr (q2,'/'); if (c1 != NULL) { lcom = 80 - (c1 - line); strncpy (newcom, c1+1, lcom); vp = newcom + lcom - 1; while (vp-- > newcom && *vp == ' ') *vp = 0; lcom = strlen (newcom); } else { newcom[0] = 0; lcom = 0; } } /* Fill new entry with spaces */ for (vp = v1; vp < v2; vp++) *vp = ' '; /* Copy keyword to new entry */ strncpy (v1, keyword, lkeyword); /* Add parameter value in the appropriate place */ vp = v1 + 8; *vp = '='; vp = v1 + 9; *vp = ' '; vp = vp + 1; if (*value == squot) { strncpy (vp, value, lval); if (lval+12 > 31) lc = lval + 12; else lc = 30; } else { vp = v1 + 30 - lval; strncpy (vp, value, lval); lc = 30; } /* Add comment in the appropriate place */ if (lcom > 0) { if (lc+2+lcom > 80) lcom = 78 - lc; vp = v1 + lc + 2; /* Jul 16 1997: was vp = v1 + lc * 2 */ *vp = '/'; vp = vp + 1; strncpy (vp, newcom, lcom); for (v = vp + lcom; v < v2; v++) *v = ' '; } return; } /*-------------------------------------------------------------------*/ /* HPUTCOM - Set comment for keyword or on line in FITS header string */ static void hputcom (hstring,keyword,comment) char *hstring; char *keyword; char *comment; { char squot; char line[100]; int lkeyword, lcom; char *vp, *v1, *v2, *c0 = NULL, *c1, *q1, *q2; squot = 39; /* Find length of variable name */ lkeyword = strlen (keyword); /* If COMMENT or HISTORY, always add it just before the END */ if (lkeyword == 7 && (strncmp (keyword,"COMMENT",7) == 0 || strncmp (keyword,"HISTORY",7) == 0)) { /* Find end of header */ v1 = ksearch (hstring,"END"); v2 = v1 + 80; strncpy (v2, v1, 80); /* blank out new line and insert keyword */ for (vp = v1; vp < v2; vp++) *vp = ' '; strncpy (v1, keyword, lkeyword); } /* search header string for variable name */ else { v1 = ksearch (hstring,keyword); v2 = v1 + 80; /* if parameter is not found, return without doing anything */ if (v1 == NULL) { return; } /* otherwise, extract entry for this variable from the header */ strncpy (line, v1, 80); /* check for quoted value */ q1 = strchr (line,squot); if (q1 != NULL) q2 = strchr (q1+1,squot); else q2 = NULL; if (q2 == NULL || q2-line < 31) c0 = v1 + 31; else c0 = v1 + (q2-line) + 2; /* allan: 1997-09-30, was c0=q2+2 */ strncpy (c0, "/ ",2); } /* create new entry */ lcom = strlen (comment); if (lcom > 0) { c1 = c0 + 2; if (c1+lcom > v2) lcom = v2 - c1; strncpy (c1, comment, lcom); } } astropy-0.3/cextern/cfitsio/getcoluk.c0000644000175000017500000021727312243255342016304 0ustar oleole/* This file, getcolk.c, contains routines that read data elements from */ /* a FITS image or table, with 'unsigned int' data type. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvuk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned int nulval, /* I - value for undefined pixels */ unsigned int *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; unsigned int nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TUINT, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluk(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfuk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned int *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TUINT, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluk(fptr, 2, row, firstelem, nelem, 1, 2, 0L, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2duk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned int nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3duk(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3duk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned int nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3]; unsigned int nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TUINT, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcluk(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcluk(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned int nulval, /* I - value to set undefined pixels */ unsigned int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; unsigned int nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvuk is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TUINT, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvuk: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcluk(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned int *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; long nulval = 0; int hdutype, anyf; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TUINT, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcluk(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpuk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ unsigned int *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluk(fptr, 1, row, firstelem, nelem, 1, 1, 0L, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned int nulval, /* I - value for null pixels */ unsigned int *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned int *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { int dummy = 0; ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcluk( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ unsigned int nulval, /* I - value for null pixels if nultyp = 1 */ unsigned int *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int nulcheck; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* call the 'short' or 'long' version of this routine, if possible */ if (sizeof(int) == sizeof(short)) ffgclui(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp, (unsigned short) nulval, (unsigned short *) array, nularray, anynul, status); else if (sizeof(int) == sizeof(long)) ffgcluj(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp, (unsigned long) nulval, (unsigned long *) array, nularray, anynul, status); else { /* This is a special case: sizeof(int) is not equal to sizeof(short) or sizeof(long). This occurs on Alpha OSF systems where short = 2 bytes, int = 4 bytes, and long = 8 bytes. */ buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ if (tcode == TLONG) /* Special Case: */ { /* data are 4-bytes long, so read */ maxelem = nelem; /* data directly into output buffer. */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next], status); fffi4uint((INT32BIT *) &array[next], ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8uint( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1uint((unsigned char *) buffer, ntodo, scale, zero,nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2uint((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4uint((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8uint((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstruint((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgcluk).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgcluk).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } } /* end of DEC Alpha special case */ return(*status); } /*--------------------------------------------------------------------------*/ int fffi1uint(unsigned char *input,/* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (unsigned int) input[ii]; /* copy input */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2uint(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4uint(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 2147483648.) { /* Instead of adding 2147483648, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(unsigned int *) &input[ii] ) ^ 0x80000000; } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned int) input[ii]; /* copy to output */ } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 2147483648.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = ( *(unsigned int *) &input[ii] ) ^ 0x80000000; } } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8uint(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4uint(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8uint(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (unsigned int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstruint(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ unsigned int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DUINT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUINT_MAX) { *status = OVERFLOW_ERR; output[ii] = UINT_MAX; } else output[ii] = (long) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/infback.c0000644000175000017500000005413612243255342016061 0ustar oleole/* infback.c -- inflate using a call-back interface * Copyright (C) 1995-2009 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* This code is largely copied from inflate.c. Normally either infback.o or inflate.o would be linked into an application--not both. The interface with inffast.c is retained so that optimized assembler-coded versions of inflate_fast() can be used with either inflate.c or infback.c. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); /* strm provides memory allocation functions in zalloc and zfree, or Z_NULL to use the library memory allocation functions. windowBits is in the range 8..15, and window is a user-supplied window and output buffer that is 2**windowBits bytes. */ int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) z_streamp strm; int windowBits; unsigned char FAR *window; const char *version; int stream_size; { struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL || window == Z_NULL || windowBits < 8 || windowBits > 15) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state FAR *)ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->dmax = 32768U; state->wbits = windowBits; state->wsize = 1U << windowBits; state->window = window; state->wnext = 0; state->whave = 0; return Z_OK; } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } /* Macros for inflateBack(): */ /* Load returned state from inflate_fast() */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Set state from registers for inflate_fast() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Assure that some input is available. If input is requested, but denied, then return a Z_BUF_ERROR from inflateBack(). */ #define PULL() \ do { \ if (have == 0) { \ have = in(in_desc, &next); \ if (have == 0) { \ next = Z_NULL; \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflateBack() with an error if there is no input available. */ #define PULLBYTE() \ do { \ PULL(); \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflateBack() with an error. */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* Assure that some output space is available, by writing out the window if it's full. If the write fails, return from inflateBack() with a Z_BUF_ERROR. */ #define ROOM() \ do { \ if (left == 0) { \ put = state->window; \ left = state->wsize; \ state->whave = left; \ if (out(out_desc, put, left)) { \ ret = Z_BUF_ERROR; \ goto inf_leave; \ } \ } \ } while (0) /* strm provides the memory allocation functions and window buffer on input, and provides information on the unused input on return. For Z_DATA_ERROR returns, strm will also provide an error message. in() and out() are the call-back input and output functions. When inflateBack() needs more input, it calls in(). When inflateBack() has filled the window with output, or when it completes with data in the window, it calls out() to write out the data. The application must not change the provided input until in() is called again or inflateBack() returns. The application must not change the window/output buffer until inflateBack() returns. in() and out() are called with a descriptor parameter provided in the inflateBack() call. This parameter can be a structure that provides the information required to do the read or write, as well as accumulated information on the input and output such as totals and check values. in() should return zero on failure. out() should return non-zero on failure. If either in() or out() fails, than inflateBack() returns a Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it was in() or out() that caused in the error. Otherwise, inflateBack() returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format error, or Z_MEM_ERROR if it could not allocate memory for the state. inflateBack() can also return Z_STREAM_ERROR if the input parameters are not correct, i.e. strm is Z_NULL or the state was not initialized. */ int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) z_streamp strm; in_func in; void FAR *in_desc; out_func out; void FAR *out_desc; { struct inflate_state FAR *state; unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code here; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* Check that the strm exists and that the state was initialized */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* Reset the state */ strm->msg = Z_NULL; state->mode = TYPE; state->last = 0; state->whave = 0; next = strm->next_in; have = next != Z_NULL ? strm->avail_in : 0; hold = 0; bits = 0; put = state->window; left = state->wsize; /* Inflate until end of block marked as last */ for (;;) switch (state->mode) { case TYPE: /* determine and dispatch block type */ if (state->last) { BYTEBITS(); state->mode = DONE; break; } NEEDBITS(3); state->last = BITS(1); DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN; /* decode codes */ break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = (char *)"invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: /* get and verify stored block length */ BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = (char *)"invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); /* copy stored block from input to output */ while (state->length != 0) { copy = state->length; PULL(); ROOM(); if (copy > have) copy = have; if (copy > left) copy = left; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: /* get dynamic table entries descriptor */ NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = (char *)"too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); /* get code length code lengths (not a typo) */ state->have = 0; while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); /* get length and distance code code lengths */ state->have = 0; while (state->have < state->nlen + state->ndist) { for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.val < 16) { NEEDBITS(here.bits); DROPBITS(here.bits); state->lens[state->have++] = here.val; } else { if (here.val == 16) { NEEDBITS(here.bits + 2); DROPBITS(here.bits); if (state->have == 0) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } len = (unsigned)(state->lens[state->have - 1]); copy = 3 + BITS(2); DROPBITS(2); } else if (here.val == 17) { NEEDBITS(here.bits + 3); DROPBITS(here.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(here.bits + 7); DROPBITS(here.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { strm->msg = (char *)"invalid code -- missing end-of-block"; state->mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; case LEN: /* use inflate_fast() if we have enough input and output */ if (have >= 6 && left >= 258) { RESTORE(); if (state->whave < state->wsize) state->whave = state->wsize - left; inflate_fast(strm, state->wsize); LOAD(); break; } /* get a literal, length, or end-of-block code */ for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.op && (here.op & 0xf0) == 0) { last = here; for (;;) { here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(here.bits); state->length = (unsigned)here.val; /* process literal */ if (here.op == 0) { Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); ROOM(); *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; } /* process end of block */ if (here.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } /* invalid code */ if (here.op & 64) { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } /* length code -- get extra bits, if any */ state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); } Tracevv((stderr, "inflate: length %u\n", state->length)); /* get distance code */ for (;;) { here = state->distcode[BITS(state->distbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if ((here.op & 0xf0) == 0) { last = here; for (;;) { here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); } DROPBITS(here.bits); if (here.op & 64) { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)here.val; /* get distance extra bits, if any */ state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); } if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } Tracevv((stderr, "inflate: distance %u\n", state->offset)); /* copy match from window to output */ do { ROOM(); copy = state->wsize - state->offset; if (copy < left) { from = put + copy; copy = left - copy; } else { from = put - state->offset; copy = left; } if (copy > state->length) copy = state->length; state->length -= copy; left -= copy; do { *put++ = *from++; } while (--copy); } while (state->length != 0); break; case DONE: /* inflate stream terminated properly -- write leftover output */ ret = Z_STREAM_END; if (left < state->wsize) { if (out(out_desc, state->window, state->wsize - left)) ret = Z_BUF_ERROR; } goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; default: /* can't happen, but makes compilers happy */ ret = Z_STREAM_ERROR; goto inf_leave; } /* Return unused input */ inf_leave: strm->next_in = next; strm->avail_in = have; return ret; } int ZEXPORT inflateBackEnd(strm) z_streamp strm; { if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } astropy-0.3/cextern/cfitsio/License.txt0000644000175000017500000000260212243255342016432 0ustar oleoleCopyright (Unpublished--all rights reserved under the copyright laws of the United States), U.S. Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code. Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this copyright notice and disclaimer of warranty appears in all copies. DISCLAIMER: THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER. astropy-0.3/cextern/cfitsio/drvrgsiftp.h0000644000175000017500000000142312243255342016652 0ustar oleole#ifndef _GSIFTP_H #define _GSIFTP_H int gsiftp_init(void); int gsiftp_setoptions(int options); int gsiftp_getoptions(int *options); int gsiftp_getversion(int *version); int gsiftp_shutdown(void); int gsiftp_checkfile(char *urltype, char *infile, char *outfile); int gsiftp_open(char *filename, int rwmode, int *driverhandle); int gsiftp_create(char *filename, int *driverhandle); int gsiftp_truncate(int driverhandle, LONGLONG filesize); int gsiftp_size(int driverhandle, LONGLONG *filesize); int gsiftp_close(int driverhandle); int gsiftp_remove(char *filename); int gsiftp_flush(int driverhandle); int gsiftp_seek(int driverhandle, LONGLONG offset); int gsiftp_read (int driverhandle, void *buffer, long nbytes); int gsiftp_write(int driverhandle, void *buffer, long nbytes); #endif astropy-0.3/cextern/cfitsio/getcold.c0000644000175000017500000020312012243255342016072 0ustar oleole/* This file, getcold.c, contains routines that read data elements from */ /* a FITS image or table, with double datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double nulval, /* I - value for undefined pixels */ double *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; double nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TDOUBLE, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcld(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TDOUBLE, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcld(fptr, 2, row, firstelem, nelem, 1, 2, 0., array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2dd(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ double nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ double *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3dd(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3dd(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ double nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ double *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { LONGLONG nfits, narray; long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}; LONGLONG lpixel[3]; double nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TDOUBLE, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcld(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcld(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvd(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ double nulval, /* I - value to set undefined pixels */ double *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; double nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvd is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TDOUBLE, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvd: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgcld(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfd(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ double *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; double nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvd is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TDOUBLE, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvd: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcld(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ double *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcld(fptr, 1, row, firstelem, nelem, 1, 1, 0., array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvd(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double nulval, /* I - value for null pixels */ double *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvm(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double nulval, /* I - value for null pixels */ double *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. TSCAL and ZERO should not be used with complex values. */ { char cdummy; /* a complex double value is interpreted as a pair of double values, */ /* thus need to multiply the first element and number of elements by 2 */ ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfd(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { double dummy = 0; ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfm(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ double *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. TSCAL and ZERO should not be used with complex values. */ { long ii, jj; float dummy = 0; char *carray; /* a complex double value is interpreted as a pair of double values, */ /* thus need to multiply the first element and number of elements by 2 */ /* allocate temporary array */ carray = (char *) calloc( (size_t) (nelem * 2), 1); ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 2, dummy, array, carray, anynul, status); for (ii = 0, jj = 0; jj < nelem; ii += 2, jj++) { if (carray[ii] || carray[ii + 1]) nularray[jj] = 1; else nularray[jj] = 0; } free(carray); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcld( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ double nulval, /* I - value for null pixels if nultyp = 1 */ double *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1, dtemp; int tcode, hdutype, xcode, decimals, maxelem2; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TDOUBLE) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, &array[next], status); if (convert) fffr8r8(&array[next], ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1r8((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2r8((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4r8((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8r8( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4r8((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstrr8((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgcld).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgcld).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = (long) (elemnum / repeat); rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (long) ((-elemnum - 1) / repeat + 1); rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1r8(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (double) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = input[ii] * scale + zero; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2r8(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (double) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = input[ii] * scale + zero; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4r8(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (double) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = input[ii] * scale + zero; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8r8(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (double) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = input[ii] * scale + zero; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4r8(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else output[ii] = (double) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = zero; } else output[ii] = input[ii] * scale + zero; } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8r8(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { memcpy(output, input, ntodo * sizeof(double) ); } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = input[ii] * scale + zero; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else { nullarray[ii] = 1; /* explicitly set value in case output contains a NaN */ output[ii] = DOUBLENULLVALUE; } } else /* it's an underflow */ output[ii] = 0; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else { nullarray[ii] = 1; /* explicitly set value in case output contains a NaN */ output[ii] = DOUBLENULLVALUE; } } else /* it's an underflow */ output[ii] = zero; } else output[ii] = input[ii] * scale + zero; } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstrr8(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); output[ii] = (dvalue * scale + zero); /* apply the scaling */ } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/eval_l.c0000644000175000017500000016627312243255342015734 0ustar oleole/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /software/lheasoft/lheavc/hip/cfitsio/eval_l.c,v 3.47 2009/09/04 18:35:05 pence Exp $ */ #define FLEX_SCANNER #define FF_FLEX_MAJOR_VERSION 2 #define FF_FLEX_MINOR_VERSION 5 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define FF_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define FF_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define FF_USE_PROTOS #define FF_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define FF_USE_CONST #define FF_USE_PROTOS #endif #ifdef FF_USE_CONST #define ffconst const #else #define ffconst #endif #ifdef FF_USE_PROTOS #define FF_PROTO(proto) proto #else #define FF_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define FF_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define FF_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN ff_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The FFSTATE alias is for lex * compatibility. */ #define FF_START ((ff_start - 1) / 2) #define FFSTATE FF_START /* Action number for EOF rule of a given start state. */ #define FF_STATE_EOF(state) (FF_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define FF_NEW_FILE ffrestart( ffin ) #define FF_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define FF_BUF_SIZE 16384 typedef struct ff_buffer_state *FF_BUFFER_STATE; extern int ffleng; extern FILE *ffin, *ffout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * ffless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the ffless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define ffless(n) \ do \ { \ /* Undo effects of setting up fftext. */ \ *ff_cp = ff_hold_char; \ FF_RESTORE_FF_MORE_OFFSET \ ff_c_buf_p = ff_cp = ff_bp + n - FF_MORE_ADJ; \ FF_DO_BEFORE_ACTION; /* set up fftext again */ \ } \ while ( 0 ) #define unput(c) ffunput( c, fftext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int ff_size_t; struct ff_buffer_state { FILE *ff_input_file; char *ff_ch_buf; /* input buffer */ char *ff_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ ff_size_t ff_buf_size; /* Number of characters read into ff_ch_buf, not including EOB * characters. */ int ff_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int ff_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int ff_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int ff_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int ff_fill_buffer; int ff_buffer_status; #define FF_BUFFER_NEW 0 #define FF_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as FF_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via ffrestart()), so that the user can continue scanning by * just pointing ffin at a new input file. */ #define FF_BUFFER_EOF_PENDING 2 }; static FF_BUFFER_STATE ff_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define FF_CURRENT_BUFFER ff_current_buffer /* ff_hold_char holds the character lost when fftext is formed. */ static char ff_hold_char; static int ff_n_chars; /* number of characters read into ff_ch_buf */ int ffleng; /* Points to current character in buffer. */ static char *ff_c_buf_p = (char *) 0; static int ff_init = 1; /* whether we need to initialize */ static int ff_start = 0; /* start state number */ /* Flag which is used to allow ffwrap()'s to do buffer switches * instead of setting up a fresh ffin. A bit of a hack ... */ static int ff_did_buffer_switch_on_eof; void ffrestart FF_PROTO(( FILE *input_file )); void ff_switch_to_buffer FF_PROTO(( FF_BUFFER_STATE new_buffer )); void ff_load_buffer_state FF_PROTO(( void )); FF_BUFFER_STATE ff_create_buffer FF_PROTO(( FILE *file, int size )); void ff_delete_buffer FF_PROTO(( FF_BUFFER_STATE b )); void ff_init_buffer FF_PROTO(( FF_BUFFER_STATE b, FILE *file )); void ff_flush_buffer FF_PROTO(( FF_BUFFER_STATE b )); #define FF_FLUSH_BUFFER ff_flush_buffer( ff_current_buffer ) FF_BUFFER_STATE ff_scan_buffer FF_PROTO(( char *base, ff_size_t size )); FF_BUFFER_STATE ff_scan_string FF_PROTO(( ffconst char *ff_str )); FF_BUFFER_STATE ff_scan_bytes FF_PROTO(( ffconst char *bytes, int len )); static void *ff_flex_alloc FF_PROTO(( ff_size_t )); static void *ff_flex_realloc FF_PROTO(( void *, ff_size_t )); static void ff_flex_free FF_PROTO(( void * )); #define ff_new_buffer ff_create_buffer #define ff_set_interactive(is_interactive) \ { \ if ( ! ff_current_buffer ) \ ff_current_buffer = ff_create_buffer( ffin, FF_BUF_SIZE ); \ ff_current_buffer->ff_is_interactive = is_interactive; \ } #define ff_set_bol(at_bol) \ { \ if ( ! ff_current_buffer ) \ ff_current_buffer = ff_create_buffer( ffin, FF_BUF_SIZE ); \ ff_current_buffer->ff_at_bol = at_bol; \ } #define FF_AT_BOL() (ff_current_buffer->ff_at_bol) typedef unsigned char FF_CHAR; FILE *ffin = (FILE *) 0, *ffout = (FILE *) 0; typedef int ff_state_type; extern char *fftext; #define fftext_ptr fftext static ff_state_type ff_get_previous_state FF_PROTO(( void )); static ff_state_type ff_try_NUL_trans FF_PROTO(( ff_state_type current_state )); static int ff_get_next_buffer FF_PROTO(( void )); static void ff_fatal_error FF_PROTO(( ffconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up fftext. */ #define FF_DO_BEFORE_ACTION \ fftext_ptr = ff_bp; \ ffleng = (int) (ff_cp - ff_bp); \ ff_hold_char = *ff_cp; \ *ff_cp = '\0'; \ ff_c_buf_p = ff_cp; #define FF_NUM_RULES 26 #define FF_END_OF_BUFFER 27 static ffconst short int ff_accept[160] = { 0, 0, 0, 27, 25, 1, 24, 15, 25, 25, 25, 25, 25, 25, 25, 7, 5, 21, 25, 20, 10, 10, 10, 10, 6, 10, 10, 10, 10, 10, 14, 10, 10, 10, 10, 10, 10, 10, 25, 1, 19, 0, 9, 0, 8, 0, 10, 17, 0, 0, 0, 0, 0, 0, 0, 14, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 0, 23, 18, 22, 10, 10, 10, 2, 10, 10, 10, 4, 10, 10, 10, 10, 3, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 16, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 11, 10, 20, 21, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0 } ; static ffconst int ff_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 7, 1, 8, 9, 10, 11, 12, 13, 1, 13, 14, 1, 15, 15, 16, 16, 16, 16, 16, 16, 17, 17, 1, 1, 18, 19, 20, 1, 1, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 31, 30, 32, 33, 30, 34, 35, 30, 36, 37, 30, 30, 38, 30, 30, 1, 1, 1, 39, 40, 1, 41, 42, 23, 43, 44, 45, 46, 28, 47, 30, 30, 48, 30, 49, 50, 30, 51, 52, 30, 53, 54, 30, 30, 38, 30, 30, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static ffconst int ff_meta[56] = { 0, 1, 1, 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1 } ; static ffconst short int ff_base[167] = { 0, 0, 0, 367, 368, 364, 368, 346, 359, 356, 355, 353, 351, 32, 347, 66, 103, 339, 44, 338, 25, 52, 316, 26, 315, 34, 133, 48, 61, 125, 368, 0, 29, 45, 60, 81, 82, 93, 299, 351, 368, 347, 368, 344, 343, 342, 368, 368, 339, 314, 315, 313, 294, 295, 293, 368, 121, 164, 307, 301, 70, 117, 43, 296, 276, 271, 58, 86, 79, 269, 152, 168, 181, 368, 368, 368, 151, 162, 0, 180, 189, 190, 191, 309, 196, 199, 205, 204, 211, 214, 207, 223, 224, 232, 238, 243, 245, 222, 246, 368, 311, 310, 279, 282, 278, 259, 262, 258, 252, 286, 295, 294, 293, 292, 291, 290, 267, 288, 258, 285, 284, 278, 270, 268, 259, 218, 252, 264, 272, 368, 251, 368, 368, 260, 280, 283, 236, 222, 230, 193, 184, 212, 208, 202, 173, 156, 368, 133, 126, 368, 104, 98, 119, 132, 80, 94, 92, 368, 78, 368, 323, 325, 329, 333, 68, 67, 337 } ; static ffconst short int ff_def[167] = { 0, 159, 1, 159, 159, 159, 159, 159, 160, 161, 162, 159, 163, 159, 159, 159, 159, 159, 159, 159, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 159, 165, 164, 164, 164, 164, 164, 164, 159, 159, 159, 160, 159, 166, 161, 162, 159, 159, 163, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 164, 164, 165, 164, 164, 164, 164, 26, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 159, 166, 166, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 164, 159, 159, 164, 164, 164, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 0, 159, 159, 159, 159, 159, 159, 159 } ; static ffconst short int ff_nxt[424] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 14, 4, 15, 16, 16, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 22, 22, 27, 28, 29, 22, 22, 24, 22, 22, 30, 31, 32, 21, 22, 33, 24, 34, 22, 35, 36, 37, 22, 22, 24, 22, 38, 49, 77, 50, 81, 80, 51, 73, 74, 75, 78, 78, 79, 115, 78, 82, 78, 76, 84, 78, 52, 116, 53, 90, 54, 56, 57, 57, 57, 85, 78, 86, 58, 78, 157, 79, 59, 78, 60, 87, 111, 91, 61, 62, 63, 78, 78, 120, 157, 92, 157, 112, 64, 88, 88, 65, 121, 66, 93, 67, 68, 69, 70, 71, 71, 71, 78, 78, 124, 158, 94, 96, 72, 72, 125, 122, 88, 97, 78, 95, 56, 108, 108, 108, 123, 88, 88, 113, 157, 156, 98, 72, 72, 83, 83, 83, 155, 154, 114, 83, 83, 83, 83, 83, 83, 89, 129, 153, 88, 152, 78, 56, 57, 57, 57, 146, 83, 129, 78, 83, 83, 83, 83, 83, 57, 57, 57, 70, 71, 71, 71, 130, 47, 72, 72, 129, 78, 72, 72, 127, 79, 128, 128, 128, 129, 129, 129, 78, 74, 75, 131, 129, 72, 72, 129, 73, 72, 72, 132, 129, 129, 146, 129, 79, 40, 78, 129, 47, 149, 129, 151, 88, 88, 99, 78, 78, 78, 129, 129, 129, 150, 78, 74, 75, 78, 133, 149, 129, 148, 78, 78, 131, 78, 129, 88, 134, 78, 73, 129, 78, 129, 129, 132, 147, 40, 99, 129, 78, 78, 78, 47, 99, 108, 108, 108, 129, 145, 78, 40, 146, 135, 72, 72, 78, 128, 128, 128, 132, 78, 73, 78, 78, 128, 128, 128, 129, 78, 131, 129, 47, 72, 72, 146, 75, 74, 78, 144, 99, 143, 40, 132, 73, 131, 75, 74, 142, 141, 140, 139, 138, 137, 136, 101, 101, 129, 78, 126, 119, 78, 41, 118, 41, 41, 44, 44, 45, 117, 45, 45, 48, 110, 48, 48, 100, 109, 100, 100, 107, 106, 105, 104, 103, 102, 42, 46, 159, 101, 42, 39, 99, 78, 78, 75, 73, 55, 42, 47, 46, 43, 42, 40, 39, 159, 3, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159 } ; static ffconst short int ff_chk[424] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 20, 13, 25, 23, 13, 18, 18, 18, 20, 23, 21, 62, 32, 25, 165, 164, 27, 25, 13, 62, 13, 32, 13, 15, 15, 15, 15, 27, 33, 28, 15, 27, 158, 21, 15, 21, 15, 28, 60, 33, 15, 15, 15, 34, 28, 66, 156, 34, 155, 60, 15, 37, 37, 15, 66, 15, 34, 15, 15, 15, 16, 16, 16, 16, 35, 36, 68, 154, 35, 36, 16, 16, 68, 67, 37, 36, 37, 35, 56, 56, 56, 56, 67, 29, 29, 61, 153, 152, 37, 16, 16, 26, 26, 26, 151, 150, 61, 26, 26, 26, 26, 26, 26, 29, 76, 148, 29, 147, 29, 70, 70, 70, 70, 145, 26, 77, 26, 26, 26, 26, 26, 26, 57, 57, 57, 71, 71, 71, 71, 77, 144, 57, 57, 79, 76, 71, 71, 72, 79, 72, 72, 72, 80, 81, 82, 77, 80, 81, 82, 84, 57, 57, 85, 84, 71, 71, 85, 87, 86, 143, 90, 79, 86, 79, 88, 142, 141, 89, 140, 88, 88, 89, 80, 81, 82, 97, 91, 92, 139, 84, 91, 92, 85, 87, 138, 93, 137, 87, 86, 93, 90, 94, 88, 90, 88, 94, 95, 89, 96, 98, 95, 136, 96, 98, 130, 97, 91, 92, 130, 126, 108, 108, 108, 133, 125, 93, 124, 133, 97, 108, 108, 94, 127, 127, 127, 123, 95, 122, 96, 98, 128, 128, 128, 134, 130, 121, 135, 134, 108, 108, 135, 120, 119, 133, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 107, 106, 105, 104, 103, 102, 101, 100, 83, 134, 69, 65, 135, 160, 64, 160, 160, 161, 161, 162, 63, 162, 162, 163, 59, 163, 163, 166, 58, 166, 166, 54, 53, 52, 51, 50, 49, 48, 45, 44, 43, 41, 39, 38, 24, 22, 19, 17, 14, 12, 11, 10, 9, 8, 7, 5, 3, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, 159 } ; static ff_state_type ff_last_accepting_state; static char *ff_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define ffmore() ffmore_used_but_not_detected #define FF_MORE_ADJ 0 #define FF_RESTORE_FF_MORE_OFFSET char *fftext; #line 1 "eval.l" #define INITIAL 0 #line 2 "eval.l" /************************************************************************/ /* */ /* CFITSIO Lexical Parser */ /* */ /* This file is one of 3 files containing code which parses an */ /* arithmetic expression and evaluates it in the context of an input */ /* FITS file table extension. The CFITSIO lexical parser is divided */ /* into the following 3 parts/files: the CFITSIO "front-end", */ /* eval_f.c, contains the interface between the user/CFITSIO and the */ /* real core of the parser; the FLEX interpreter, eval_l.c, takes the */ /* input string and parses it into tokens and identifies the FITS */ /* information required to evaluate the expression (ie, keywords and */ /* columns); and, the BISON grammar and evaluation routines, eval_y.c, */ /* receives the FLEX output and determines and performs the actual */ /* operations. The files eval_l.c and eval_y.c are produced from */ /* running flex and bison on the files eval.l and eval.y, respectively. */ /* (flex and bison are available from any GNU archive: see www.gnu.org) */ /* */ /* The grammar rules, rather than evaluating the expression in situ, */ /* builds a tree, or Nodal, structure mapping out the order of */ /* operations and expression dependencies. This "compilation" process */ /* allows for much faster processing of multiple rows. This technique */ /* was developed by Uwe Lammers of the XMM Science Analysis System, */ /* although the CFITSIO implementation is entirely code original. */ /* */ /* */ /* Modification History: */ /* */ /* Kent Blackburn c1992 Original parser code developed for the */ /* FTOOLS software package, in particular, */ /* the fselect task. */ /* Kent Blackburn c1995 BIT column support added */ /* Peter D Wilson Feb 1998 Vector column support added */ /* Peter D Wilson May 1998 Ported to CFITSIO library. User */ /* interface routines written, in essence */ /* making fselect, fcalc, and maketime */ /* capabilities available to all tools */ /* via single function calls. */ /* Peter D Wilson Jun 1998 Major rewrite of parser core, so as to */ /* create a run-time evaluation tree, */ /* inspired by the work of Uwe Lammers, */ /* resulting in a speed increase of */ /* 10-100 times. */ /* Peter D Wilson Jul 1998 gtifilter(a,b,c,d) function added */ /* Peter D Wilson Aug 1998 regfilter(a,b,c,d) function added */ /* Peter D Wilson Jul 1999 Make parser fitsfile-independent, */ /* allowing a purely vector-based usage */ /* */ /************************************************************************/ #include #include #include #ifdef sparc #include #else #include #endif #include "eval_defs.h" ParseData gParse; /* Global structure holding all parser information */ /***** Internal functions *****/ int ffGetVariable( char *varName, FFSTYPE *varVal ); static int find_variable( char *varName ); static int expr_read( char *buf, int nbytes ); /***** Definitions *****/ #define FF_NO_UNPUT /* Don't include FFUNPUT function */ #define FF_NEVER_INTERACTIVE 1 #define MAXCHR 256 #define MAXBIT 128 #define OCT_0 "000" #define OCT_1 "001" #define OCT_2 "010" #define OCT_3 "011" #define OCT_4 "100" #define OCT_5 "101" #define OCT_6 "110" #define OCT_7 "111" #define OCT_X "xxx" #define HEX_0 "0000" #define HEX_1 "0001" #define HEX_2 "0010" #define HEX_3 "0011" #define HEX_4 "0100" #define HEX_5 "0101" #define HEX_6 "0110" #define HEX_7 "0111" #define HEX_8 "1000" #define HEX_9 "1001" #define HEX_A "1010" #define HEX_B "1011" #define HEX_C "1100" #define HEX_D "1101" #define HEX_E "1110" #define HEX_F "1111" #define HEX_X "xxxx" /* MJT - 13 June 1996 read from buffer instead of stdin (as per old ftools.skel) */ #undef FF_INPUT #define FF_INPUT(buf,result,max_size) \ if ( (result = expr_read( (char *) buf, max_size )) < 0 ) \ FF_FATAL_ERROR( "read() in flex scanner failed" ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef FF_SKIP_FFWRAP #ifdef __cplusplus extern "C" int ffwrap FF_PROTO(( void )); #else extern int ffwrap FF_PROTO(( void )); #endif #endif #ifndef FF_NO_UNPUT static void ffunput FF_PROTO(( int c, char *buf_ptr )); #endif #ifndef fftext_ptr static void ff_flex_strncpy FF_PROTO(( char *, ffconst char *, int )); #endif #ifdef FF_NEED_STRLEN static int ff_flex_strlen FF_PROTO(( ffconst char * )); #endif #ifndef FF_NO_INPUT #ifdef __cplusplus static int ffinput FF_PROTO(( void )); #else static int input FF_PROTO(( void )); #endif #endif #if FF_STACK_USED static int ff_start_stack_ptr = 0; static int ff_start_stack_depth = 0; static int *ff_start_stack = 0; #ifndef FF_NO_PUSH_STATE static void ff_push_state FF_PROTO(( int new_state )); #endif #ifndef FF_NO_POP_STATE static void ff_pop_state FF_PROTO(( void )); #endif #ifndef FF_NO_TOP_STATE static int ff_top_state FF_PROTO(( void )); #endif #else #define FF_NO_PUSH_STATE 1 #define FF_NO_POP_STATE 1 #define FF_NO_TOP_STATE 1 #endif #ifdef FF_MALLOC_DECL FF_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef FF_READ_BUF_SIZE #define FF_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( fftext, ffleng, 1, ffout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or FF_NULL, * is returned in "result". */ #ifndef FF_INPUT #define FF_INPUT(buf,result,max_size) \ if ( ff_current_buffer->ff_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( ffin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( ffin ) ) \ FF_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, ffin )) == 0) \ && ferror( ffin ) ) \ FF_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "ffterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef ffterminate #define ffterminate() return FF_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef FF_START_STACK_INCR #define FF_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef FF_FATAL_ERROR #define FF_FATAL_ERROR(msg) ff_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef FF_DECL #define FF_DECL int fflex FF_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after fftext and ffleng * have been set up. */ #ifndef FF_USER_ACTION #define FF_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef FF_BREAK #define FF_BREAK break; #endif #define FF_RULE_SETUP \ FF_USER_ACTION FF_DECL { register ff_state_type ff_current_state; register char *ff_cp, *ff_bp; register int ff_act; #line 142 "eval.l" if ( ff_init ) { ff_init = 0; #ifdef FF_USER_INIT FF_USER_INIT; #endif if ( ! ff_start ) ff_start = 1; /* first start state */ if ( ! ffin ) ffin = stdin; if ( ! ffout ) ffout = stdout; if ( ! ff_current_buffer ) ff_current_buffer = ff_create_buffer( ffin, FF_BUF_SIZE ); ff_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { ff_cp = ff_c_buf_p; /* Support of fftext. */ *ff_cp = ff_hold_char; /* ff_bp points to the position in ff_ch_buf of the start of * the current run. */ ff_bp = ff_cp; ff_current_state = ff_start; ff_match: do { register FF_CHAR ff_c = ff_ec[FF_SC_TO_UI(*ff_cp)]; if ( ff_accept[ff_current_state] ) { ff_last_accepting_state = ff_current_state; ff_last_accepting_cpos = ff_cp; } while ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state ) { ff_current_state = (int) ff_def[ff_current_state]; if ( ff_current_state >= 160 ) ff_c = ff_meta[(unsigned int) ff_c]; } ff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c]; ++ff_cp; } while ( ff_base[ff_current_state] != 368 ); ff_find_action: ff_act = ff_accept[ff_current_state]; if ( ff_act == 0 ) { /* have to back up */ ff_cp = ff_last_accepting_cpos; ff_current_state = ff_last_accepting_state; ff_act = ff_accept[ff_current_state]; } FF_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( ff_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of FF_DO_BEFORE_ACTION */ *ff_cp = ff_hold_char; ff_cp = ff_last_accepting_cpos; ff_current_state = ff_last_accepting_state; goto ff_find_action; case 1: FF_RULE_SETUP #line 144 "eval.l" ; FF_BREAK case 2: FF_RULE_SETUP #line 145 "eval.l" { int len; len = strlen(fftext); while (fftext[len] == ' ') len--; len = len - 1; strncpy(fflval.str,&fftext[1],len); fflval.str[len] = '\0'; return( BITSTR ); } FF_BREAK case 3: FF_RULE_SETUP #line 155 "eval.l" { int len; char tmpstring[256]; char bitstring[256]; len = strlen(fftext); if (len >= 256) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"Bit string exceeds maximum length: '"); strncat(errMsg, &(fftext[0]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { while (fftext[len] == ' ') len--; len = len - 1; strncpy(tmpstring,&fftext[1],len); } tmpstring[len] = '\0'; bitstring[0] = '\0'; len = 0; while ( tmpstring[len] != '\0') { switch ( tmpstring[len] ) { case '0': strcat(bitstring,OCT_0); break; case '1': strcat(bitstring,OCT_1); break; case '2': strcat(bitstring,OCT_2); break; case '3': strcat(bitstring,OCT_3); break; case '4': strcat(bitstring,OCT_4); break; case '5': strcat(bitstring,OCT_5); break; case '6': strcat(bitstring,OCT_6); break; case '7': strcat(bitstring,OCT_7); break; case 'x': case 'X': strcat(bitstring,OCT_X); break; } len++; } strcpy( fflval.str, bitstring ); return( BITSTR ); } FF_BREAK case 4: FF_RULE_SETUP #line 215 "eval.l" { int len; char tmpstring[256]; char bitstring[256]; len = strlen(fftext); if (len >= 256) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"Hex string exceeds maximum length: '"); strncat(errMsg, &(fftext[0]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { while (fftext[len] == ' ') len--; len = len - 1; strncpy(tmpstring,&fftext[1],len); } tmpstring[len] = '\0'; bitstring[0] = '\0'; len = 0; while ( tmpstring[len] != '\0') { switch ( tmpstring[len] ) { case '0': strcat(bitstring,HEX_0); break; case '1': strcat(bitstring,HEX_1); break; case '2': strcat(bitstring,HEX_2); break; case '3': strcat(bitstring,HEX_3); break; case '4': strcat(bitstring,HEX_4); break; case '5': strcat(bitstring,HEX_5); break; case '6': strcat(bitstring,HEX_6); break; case '7': strcat(bitstring,HEX_7); break; case '8': strcat(bitstring,HEX_8); break; case '9': strcat(bitstring,HEX_9); break; case 'a': case 'A': strcat(bitstring,HEX_A); break; case 'b': case 'B': strcat(bitstring,HEX_B); break; case 'c': case 'C': strcat(bitstring,HEX_C); break; case 'd': case 'D': strcat(bitstring,HEX_D); break; case 'e': case 'E': strcat(bitstring,HEX_E); break; case 'f': case 'F': strcat(bitstring,HEX_F); break; case 'x': case 'X': strcat(bitstring,HEX_X); break; } len++; } strcpy( fflval.str, bitstring ); return( BITSTR ); } FF_BREAK case 5: FF_RULE_SETUP #line 306 "eval.l" { fflval.lng = atol(fftext); return( LONG ); } FF_BREAK case 6: FF_RULE_SETUP #line 310 "eval.l" { if ((fftext[0] == 't') || (fftext[0] == 'T')) fflval.log = 1; else fflval.log = 0; return( BOOLEAN ); } FF_BREAK case 7: FF_RULE_SETUP #line 317 "eval.l" { fflval.dbl = atof(fftext); return( DOUBLE ); } FF_BREAK case 8: FF_RULE_SETUP #line 321 "eval.l" { if( !strcasecmp(fftext,"#PI") ) { fflval.dbl = (double)(4) * atan((double)(1)); return( DOUBLE ); } else if( !strcasecmp(fftext,"#E") ) { fflval.dbl = exp((double)(1)); return( DOUBLE ); } else if( !strcasecmp(fftext,"#DEG") ) { fflval.dbl = ((double)4)*atan((double)1)/((double)180); return( DOUBLE ); } else if( !strcasecmp(fftext,"#ROW") ) { return( ROWREF ); } else if( !strcasecmp(fftext,"#NULL") ) { return( NULLREF ); } else if( !strcasecmp(fftext,"#SNULL") ) { return( SNULLREF ); } else { int len; if (fftext[1] == '$') { len = strlen(fftext) - 3; fflval.str[0] = '#'; strncpy(fflval.str+1,&fftext[2],len); fflval.str[len+1] = '\0'; fftext = fflval.str; } return( (*gParse.getData)(fftext, &fflval) ); } } FF_BREAK case 9: FF_RULE_SETUP #line 349 "eval.l" { int len; len = strlen(fftext) - 2; if (len >= MAX_STRLEN) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"String exceeds maximum length: '"); strncat(errMsg, &(fftext[1]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { strncpy(fflval.str,&fftext[1],len); } fflval.str[len] = '\0'; return( STRING ); } FF_BREAK case 10: FF_RULE_SETUP #line 366 "eval.l" { int len,type; if (fftext[0] == '$') { len = strlen(fftext) - 2; strncpy(fflval.str,&fftext[1],len); fflval.str[len] = '\0'; fftext = fflval.str; } type = ffGetVariable(fftext, &fflval); return( type ); } FF_BREAK case 11: FF_RULE_SETUP #line 378 "eval.l" { char *fname; int len=0; fname = &fflval.str[0]; while( (fname[len]=toupper(fftext[len])) ) len++; if( FSTRCMP(fname,"BOX(")==0 || FSTRCMP(fname,"CIRCLE(")==0 || FSTRCMP(fname,"ELLIPSE(")==0 || FSTRCMP(fname,"NEAR(")==0 || FSTRCMP(fname,"ISNULL(")==0 ) /* Return type is always boolean */ return( BFUNCTION ); else if( FSTRCMP(fname,"GTIFILTER(")==0 ) return( GTIFILTER ); else if( FSTRCMP(fname,"REGFILTER(")==0 ) return( REGFILTER ); else if( FSTRCMP(fname,"STRSTR(")==0 ) return( IFUNCTION ); /* Returns integer */ else return( FUNCTION ); } FF_BREAK case 12: FF_RULE_SETUP #line 405 "eval.l" { return( INTCAST ); } FF_BREAK case 13: FF_RULE_SETUP #line 406 "eval.l" { return( FLTCAST ); } FF_BREAK case 14: FF_RULE_SETUP #line 407 "eval.l" { return( POWER ); } FF_BREAK case 15: FF_RULE_SETUP #line 408 "eval.l" { return( NOT ); } FF_BREAK case 16: FF_RULE_SETUP #line 409 "eval.l" { return( OR ); } FF_BREAK case 17: FF_RULE_SETUP #line 410 "eval.l" { return( AND ); } FF_BREAK case 18: FF_RULE_SETUP #line 411 "eval.l" { return( EQ ); } FF_BREAK case 19: FF_RULE_SETUP #line 412 "eval.l" { return( NE ); } FF_BREAK case 20: FF_RULE_SETUP #line 413 "eval.l" { return( GT ); } FF_BREAK case 21: FF_RULE_SETUP #line 414 "eval.l" { return( LT ); } FF_BREAK case 22: FF_RULE_SETUP #line 415 "eval.l" { return( GTE ); } FF_BREAK case 23: FF_RULE_SETUP #line 416 "eval.l" { return( LTE ); } FF_BREAK case 24: FF_RULE_SETUP #line 417 "eval.l" { return( '\n' ); } FF_BREAK case 25: FF_RULE_SETUP #line 418 "eval.l" { return( fftext[0] ); } FF_BREAK case 26: FF_RULE_SETUP #line 419 "eval.l" ECHO; FF_BREAK case FF_STATE_EOF(INITIAL): ffterminate(); case FF_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int ff_amount_of_matched_text = (int) (ff_cp - fftext_ptr) - 1; /* Undo the effects of FF_DO_BEFORE_ACTION. */ *ff_cp = ff_hold_char; FF_RESTORE_FF_MORE_OFFSET if ( ff_current_buffer->ff_buffer_status == FF_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed ffin at a new source and called * fflex(). If so, then we have to assure * consistency between ff_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ ff_n_chars = ff_current_buffer->ff_n_chars; ff_current_buffer->ff_input_file = ffin; ff_current_buffer->ff_buffer_status = FF_BUFFER_NORMAL; } /* Note that here we test for ff_c_buf_p "<=" to the position * of the first EOB in the buffer, since ff_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( ff_c_buf_p <= &ff_current_buffer->ff_ch_buf[ff_n_chars] ) { /* This was really a NUL. */ ff_state_type ff_next_state; ff_c_buf_p = fftext_ptr + ff_amount_of_matched_text; ff_current_state = ff_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * ff_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ ff_next_state = ff_try_NUL_trans( ff_current_state ); ff_bp = fftext_ptr + FF_MORE_ADJ; if ( ff_next_state ) { /* Consume the NUL. */ ff_cp = ++ff_c_buf_p; ff_current_state = ff_next_state; goto ff_match; } else { ff_cp = ff_c_buf_p; goto ff_find_action; } } else switch ( ff_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { ff_did_buffer_switch_on_eof = 0; if ( ffwrap() ) { /* Note: because we've taken care in * ff_get_next_buffer() to have set up * fftext, we can now set up * ff_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * FF_NULL, it'll still work - another * FF_NULL will get returned. */ ff_c_buf_p = fftext_ptr + FF_MORE_ADJ; ff_act = FF_STATE_EOF(FF_START); goto do_action; } else { if ( ! ff_did_buffer_switch_on_eof ) FF_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: ff_c_buf_p = fftext_ptr + ff_amount_of_matched_text; ff_current_state = ff_get_previous_state(); ff_cp = ff_c_buf_p; ff_bp = fftext_ptr + FF_MORE_ADJ; goto ff_match; case EOB_ACT_LAST_MATCH: ff_c_buf_p = &ff_current_buffer->ff_ch_buf[ff_n_chars]; ff_current_state = ff_get_previous_state(); ff_cp = ff_c_buf_p; ff_bp = fftext_ptr + FF_MORE_ADJ; goto ff_find_action; } break; } default: FF_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of fflex */ /* ff_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int ff_get_next_buffer() { register char *dest = ff_current_buffer->ff_ch_buf; register char *source = fftext_ptr; register int number_to_move, i; int ret_val; if ( ff_c_buf_p > &ff_current_buffer->ff_ch_buf[ff_n_chars + 1] ) FF_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( ff_current_buffer->ff_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( ff_c_buf_p - fftext_ptr - FF_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (ff_c_buf_p - fftext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( ff_current_buffer->ff_buffer_status == FF_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ ff_current_buffer->ff_n_chars = ff_n_chars = 0; else { int num_to_read = ff_current_buffer->ff_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef FF_USES_REJECT FF_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ FF_BUFFER_STATE b = ff_current_buffer; int ff_c_buf_p_offset = (int) (ff_c_buf_p - b->ff_ch_buf); if ( b->ff_is_our_buffer ) { int new_size = b->ff_buf_size * 2; if ( new_size <= 0 ) b->ff_buf_size += b->ff_buf_size / 8; else b->ff_buf_size *= 2; b->ff_ch_buf = (char *) /* Include room in for 2 EOB chars. */ ff_flex_realloc( (void *) b->ff_ch_buf, b->ff_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->ff_ch_buf = 0; if ( ! b->ff_ch_buf ) FF_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); ff_c_buf_p = &b->ff_ch_buf[ff_c_buf_p_offset]; num_to_read = ff_current_buffer->ff_buf_size - number_to_move - 1; #endif } if ( num_to_read > FF_READ_BUF_SIZE ) num_to_read = FF_READ_BUF_SIZE; /* Read in more data. */ FF_INPUT( (&ff_current_buffer->ff_ch_buf[number_to_move]), ff_n_chars, num_to_read ); ff_current_buffer->ff_n_chars = ff_n_chars; } if ( ff_n_chars == 0 ) { if ( number_to_move == FF_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; ffrestart( ffin ); } else { ret_val = EOB_ACT_LAST_MATCH; ff_current_buffer->ff_buffer_status = FF_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; ff_n_chars += number_to_move; ff_current_buffer->ff_ch_buf[ff_n_chars] = FF_END_OF_BUFFER_CHAR; ff_current_buffer->ff_ch_buf[ff_n_chars + 1] = FF_END_OF_BUFFER_CHAR; fftext_ptr = &ff_current_buffer->ff_ch_buf[0]; return ret_val; } /* ff_get_previous_state - get the state just before the EOB char was reached */ static ff_state_type ff_get_previous_state() { register ff_state_type ff_current_state; register char *ff_cp; ff_current_state = ff_start; for ( ff_cp = fftext_ptr + FF_MORE_ADJ; ff_cp < ff_c_buf_p; ++ff_cp ) { register FF_CHAR ff_c = (*ff_cp ? ff_ec[FF_SC_TO_UI(*ff_cp)] : 1); if ( ff_accept[ff_current_state] ) { ff_last_accepting_state = ff_current_state; ff_last_accepting_cpos = ff_cp; } while ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state ) { ff_current_state = (int) ff_def[ff_current_state]; if ( ff_current_state >= 160 ) ff_c = ff_meta[(unsigned int) ff_c]; } ff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c]; } return ff_current_state; } /* ff_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = ff_try_NUL_trans( current_state ); */ #ifdef FF_USE_PROTOS static ff_state_type ff_try_NUL_trans( ff_state_type ff_current_state ) #else static ff_state_type ff_try_NUL_trans( ff_current_state ) ff_state_type ff_current_state; #endif { register int ff_is_jam; register char *ff_cp = ff_c_buf_p; register FF_CHAR ff_c = 1; if ( ff_accept[ff_current_state] ) { ff_last_accepting_state = ff_current_state; ff_last_accepting_cpos = ff_cp; } while ( ff_chk[ff_base[ff_current_state] + ff_c] != ff_current_state ) { ff_current_state = (int) ff_def[ff_current_state]; if ( ff_current_state >= 160 ) ff_c = ff_meta[(unsigned int) ff_c]; } ff_current_state = ff_nxt[ff_base[ff_current_state] + (unsigned int) ff_c]; ff_is_jam = (ff_current_state == 159); return ff_is_jam ? 0 : ff_current_state; } #ifndef FF_NO_UNPUT #ifdef FF_USE_PROTOS static void ffunput( int c, register char *ff_bp ) #else static void ffunput( c, ff_bp ) int c; register char *ff_bp; #endif { register char *ff_cp = ff_c_buf_p; /* undo effects of setting up fftext */ *ff_cp = ff_hold_char; if ( ff_cp < ff_current_buffer->ff_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = ff_n_chars + 2; register char *dest = &ff_current_buffer->ff_ch_buf[ ff_current_buffer->ff_buf_size + 2]; register char *source = &ff_current_buffer->ff_ch_buf[number_to_move]; while ( source > ff_current_buffer->ff_ch_buf ) *--dest = *--source; ff_cp += (int) (dest - source); ff_bp += (int) (dest - source); ff_current_buffer->ff_n_chars = ff_n_chars = ff_current_buffer->ff_buf_size; if ( ff_cp < ff_current_buffer->ff_ch_buf + 2 ) FF_FATAL_ERROR( "flex scanner push-back overflow" ); } *--ff_cp = (char) c; fftext_ptr = ff_bp; ff_hold_char = *ff_cp; ff_c_buf_p = ff_cp; } #endif /* ifndef FF_NO_UNPUT */ #ifdef __cplusplus static int ffinput() #else static int input() #endif { int c; *ff_c_buf_p = ff_hold_char; if ( *ff_c_buf_p == FF_END_OF_BUFFER_CHAR ) { /* ff_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( ff_c_buf_p < &ff_current_buffer->ff_ch_buf[ff_n_chars] ) /* This was really a NUL. */ *ff_c_buf_p = '\0'; else { /* need more input */ int offset = ff_c_buf_p - fftext_ptr; ++ff_c_buf_p; switch ( ff_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because ff_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ ffrestart( ffin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( ffwrap() ) return EOF; if ( ! ff_did_buffer_switch_on_eof ) FF_NEW_FILE; #ifdef __cplusplus return ffinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: ff_c_buf_p = fftext_ptr + offset; break; } } } c = *(unsigned char *) ff_c_buf_p; /* cast for 8-bit char's */ *ff_c_buf_p = '\0'; /* preserve fftext */ ff_hold_char = *++ff_c_buf_p; return c; } #ifdef FF_USE_PROTOS void ffrestart( FILE *input_file ) #else void ffrestart( input_file ) FILE *input_file; #endif { if ( ! ff_current_buffer ) ff_current_buffer = ff_create_buffer( ffin, FF_BUF_SIZE ); ff_init_buffer( ff_current_buffer, input_file ); ff_load_buffer_state(); } #ifdef FF_USE_PROTOS void ff_switch_to_buffer( FF_BUFFER_STATE new_buffer ) #else void ff_switch_to_buffer( new_buffer ) FF_BUFFER_STATE new_buffer; #endif { if ( ff_current_buffer == new_buffer ) return; if ( ff_current_buffer ) { /* Flush out information for old buffer. */ *ff_c_buf_p = ff_hold_char; ff_current_buffer->ff_buf_pos = ff_c_buf_p; ff_current_buffer->ff_n_chars = ff_n_chars; } ff_current_buffer = new_buffer; ff_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (ffwrap()) processing, but the only time this flag * is looked at is after ffwrap() is called, so it's safe * to go ahead and always set it. */ ff_did_buffer_switch_on_eof = 1; } #ifdef FF_USE_PROTOS void ff_load_buffer_state( void ) #else void ff_load_buffer_state() #endif { ff_n_chars = ff_current_buffer->ff_n_chars; fftext_ptr = ff_c_buf_p = ff_current_buffer->ff_buf_pos; ffin = ff_current_buffer->ff_input_file; ff_hold_char = *ff_c_buf_p; } #ifdef FF_USE_PROTOS FF_BUFFER_STATE ff_create_buffer( FILE *file, int size ) #else FF_BUFFER_STATE ff_create_buffer( file, size ) FILE *file; int size; #endif { FF_BUFFER_STATE b; b = (FF_BUFFER_STATE) ff_flex_alloc( sizeof( struct ff_buffer_state ) ); if ( ! b ) FF_FATAL_ERROR( "out of dynamic memory in ff_create_buffer()" ); b->ff_buf_size = size; /* ff_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->ff_ch_buf = (char *) ff_flex_alloc( b->ff_buf_size + 2 ); if ( ! b->ff_ch_buf ) FF_FATAL_ERROR( "out of dynamic memory in ff_create_buffer()" ); b->ff_is_our_buffer = 1; ff_init_buffer( b, file ); return b; } #ifdef FF_USE_PROTOS void ff_delete_buffer( FF_BUFFER_STATE b ) #else void ff_delete_buffer( b ) FF_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == ff_current_buffer ) ff_current_buffer = (FF_BUFFER_STATE) 0; if ( b->ff_is_our_buffer ) ff_flex_free( (void *) b->ff_ch_buf ); ff_flex_free( (void *) b ); } #ifndef FF_ALWAYS_INTERACTIVE #ifndef FF_NEVER_INTERACTIVE extern int isatty FF_PROTO(( int )); #endif #endif #ifdef FF_USE_PROTOS void ff_init_buffer( FF_BUFFER_STATE b, FILE *file ) #else void ff_init_buffer( b, file ) FF_BUFFER_STATE b; FILE *file; #endif { ff_flush_buffer( b ); b->ff_input_file = file; b->ff_fill_buffer = 1; #if FF_ALWAYS_INTERACTIVE b->ff_is_interactive = 1; #else #if FF_NEVER_INTERACTIVE b->ff_is_interactive = 0; #else b->ff_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef FF_USE_PROTOS void ff_flush_buffer( FF_BUFFER_STATE b ) #else void ff_flush_buffer( b ) FF_BUFFER_STATE b; #endif { if ( ! b ) return; b->ff_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->ff_ch_buf[0] = FF_END_OF_BUFFER_CHAR; b->ff_ch_buf[1] = FF_END_OF_BUFFER_CHAR; b->ff_buf_pos = &b->ff_ch_buf[0]; b->ff_at_bol = 1; b->ff_buffer_status = FF_BUFFER_NEW; if ( b == ff_current_buffer ) ff_load_buffer_state(); } #ifndef FF_NO_SCAN_BUFFER #ifdef FF_USE_PROTOS FF_BUFFER_STATE ff_scan_buffer( char *base, ff_size_t size ) #else FF_BUFFER_STATE ff_scan_buffer( base, size ) char *base; ff_size_t size; #endif { FF_BUFFER_STATE b; if ( size < 2 || base[size-2] != FF_END_OF_BUFFER_CHAR || base[size-1] != FF_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (FF_BUFFER_STATE) ff_flex_alloc( sizeof( struct ff_buffer_state ) ); if ( ! b ) FF_FATAL_ERROR( "out of dynamic memory in ff_scan_buffer()" ); b->ff_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->ff_buf_pos = b->ff_ch_buf = base; b->ff_is_our_buffer = 0; b->ff_input_file = 0; b->ff_n_chars = b->ff_buf_size; b->ff_is_interactive = 0; b->ff_at_bol = 1; b->ff_fill_buffer = 0; b->ff_buffer_status = FF_BUFFER_NEW; ff_switch_to_buffer( b ); return b; } #endif #ifndef FF_NO_SCAN_STRING #ifdef FF_USE_PROTOS FF_BUFFER_STATE ff_scan_string( ffconst char *ff_str ) #else FF_BUFFER_STATE ff_scan_string( ff_str ) ffconst char *ff_str; #endif { int len; for ( len = 0; ff_str[len]; ++len ) ; return ff_scan_bytes( ff_str, len ); } #endif #ifndef FF_NO_SCAN_BYTES #ifdef FF_USE_PROTOS FF_BUFFER_STATE ff_scan_bytes( ffconst char *bytes, int len ) #else FF_BUFFER_STATE ff_scan_bytes( bytes, len ) ffconst char *bytes; int len; #endif { FF_BUFFER_STATE b; char *buf; ff_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) ff_flex_alloc( n ); if ( ! buf ) FF_FATAL_ERROR( "out of dynamic memory in ff_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = FF_END_OF_BUFFER_CHAR; b = ff_scan_buffer( buf, n ); if ( ! b ) FF_FATAL_ERROR( "bad buffer in ff_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->ff_is_our_buffer = 1; return b; } #endif #ifndef FF_NO_PUSH_STATE #ifdef FF_USE_PROTOS static void ff_push_state( int new_state ) #else static void ff_push_state( new_state ) int new_state; #endif { if ( ff_start_stack_ptr >= ff_start_stack_depth ) { ff_size_t new_size; ff_start_stack_depth += FF_START_STACK_INCR; new_size = ff_start_stack_depth * sizeof( int ); if ( ! ff_start_stack ) ff_start_stack = (int *) ff_flex_alloc( new_size ); else ff_start_stack = (int *) ff_flex_realloc( (void *) ff_start_stack, new_size ); if ( ! ff_start_stack ) FF_FATAL_ERROR( "out of memory expanding start-condition stack" ); } ff_start_stack[ff_start_stack_ptr++] = FF_START; BEGIN(new_state); } #endif #ifndef FF_NO_POP_STATE static void ff_pop_state() { if ( --ff_start_stack_ptr < 0 ) FF_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(ff_start_stack[ff_start_stack_ptr]); } #endif #ifndef FF_NO_TOP_STATE static int ff_top_state() { return ff_start_stack[ff_start_stack_ptr - 1]; } #endif #ifndef FF_EXIT_FAILURE #define FF_EXIT_FAILURE 2 #endif #ifdef FF_USE_PROTOS static void ff_fatal_error( ffconst char msg[] ) #else static void ff_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( FF_EXIT_FAILURE ); } /* Redefine ffless() so it works in section 3 code. */ #undef ffless #define ffless(n) \ do \ { \ /* Undo effects of setting up fftext. */ \ fftext[ffleng] = ff_hold_char; \ ff_c_buf_p = fftext + n; \ ff_hold_char = *ff_c_buf_p; \ *ff_c_buf_p = '\0'; \ ffleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef fftext_ptr #ifdef FF_USE_PROTOS static void ff_flex_strncpy( char *s1, ffconst char *s2, int n ) #else static void ff_flex_strncpy( s1, s2, n ) char *s1; ffconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef FF_NEED_STRLEN #ifdef FF_USE_PROTOS static int ff_flex_strlen( ffconst char *s ) #else static int ff_flex_strlen( s ) ffconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef FF_USE_PROTOS static void *ff_flex_alloc( ff_size_t size ) #else static void *ff_flex_alloc( size ) ff_size_t size; #endif { return (void *) malloc( size ); } #ifdef FF_USE_PROTOS static void *ff_flex_realloc( void *ptr, ff_size_t size ) #else static void *ff_flex_realloc( ptr, size ) void *ptr; ff_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef FF_USE_PROTOS static void ff_flex_free( void *ptr ) #else static void ff_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if FF_MAIN int main() { fflex(); return 0; } #endif #line 419 "eval.l" int ffwrap() { /* MJT -- 13 June 1996 Supplied for compatibility with pre-2.5.1 versions of flex which do not recognize %option noffwrap */ return(1); } /* expr_read is lifted from old ftools.skel. Now we can use any version of flex with no .skel file necessary! MJT - 13 June 1996 keep a memory of how many bytes have been read previously, so that an unlimited-sized buffer can be supported. PDW - 28 Feb 1998 */ static int expr_read(char *buf, int nbytes) { int n; n = 0; if( !gParse.is_eobuf ) { do { buf[n++] = gParse.expr[gParse.index++]; } while ((nlng = varNum; } return( type ); } static int find_variable(char *varName) { int i; if( gParse.nCols ) for( i=0; i c2) return(1); if (c1 == 0) return(0); s1++; s2++; } } int strncasecmp(const char *s1, const char *s2, size_t n) { char c1, c2; for (; n-- ;) { c1 = toupper( *s1 ); c2 = toupper( *s2 ); if (c1 < c2) return(-1); if (c1 > c2) return(1); if (c1 == 0) return(0); s1++; s2++; } return(0); } #endif astropy-0.3/cextern/cfitsio/drvrgsiftp.c0000644000175000017500000003241612243255342016653 0ustar oleole /* This file, drvrgsiftp.c contains driver routines for gsiftp files. */ /* Andrea Barisani */ /* Taffoni Giuliano */ #ifdef HAVE_NET_SERVICES #ifdef HAVE_GSIFTP #include #include #include #include #include #include "fitsio2.h" #include #define MAXLEN 1200 #define NETTIMEOUT 80 #define MAX_BUFFER_SIZE_R 1024 #define MAX_BUFFER_SIZE_W (64*1024) static int gsiftpopen = 0; static int global_offset = 0; static int gsiftp_get(char *filename, FILE **gsiftpfile, int num_streams); static globus_mutex_t lock; static globus_cond_t cond; static globus_bool_t done; static char *gsiftp_tmpfile; static char *gsiftpurl = NULL; static char gsiftp_tmpdir[MAXLEN]; static jmp_buf env; /* holds the jump buffer for setjmp/longjmp pairs */ static void signal_handler(int sig); int gsiftp_init(void) { if (getenv("GSIFTP_TMPFILE")) { gsiftp_tmpfile = getenv("GSIFTP_TMPFILE"); } else { strncpy(gsiftp_tmpdir, "/tmp/gsiftp_XXXXXX", sizeof gsiftp_tmpdir); if (mkdtemp(gsiftp_tmpdir) == NULL) { ffpmsg("Cannot create temporary directory!"); return (FILE_NOT_OPENED); } gsiftp_tmpfile = malloc(strlen(gsiftp_tmpdir) + strlen("/gsiftp_buffer.tmp")); strcat(gsiftp_tmpfile, gsiftp_tmpdir); strcat(gsiftp_tmpfile, "/gsiftp_buffer.tmp"); } return file_init(); } int gsiftp_shutdown(void) { free(gsiftpurl); free(gsiftp_tmpfile); free(gsiftp_tmpdir); return file_shutdown(); } int gsiftp_setoptions(int options) { return file_setoptions(options); } int gsiftp_getoptions(int *options) { return file_getoptions(options); } int gsiftp_getversion(int *version) { return file_getversion(version); } int gsiftp_checkfile(char *urltype, char *infile, char *outfile) { return file_checkfile(urltype, infile, outfile); } int gsiftp_open(char *filename, int rwmode, int *handle) { FILE *gsiftpfile; int num_streams; if (getenv("GSIFTP_STREAMS")) { num_streams = (int)getenv("GSIFTP_STREAMS"); } else { num_streams = 1; } if (rwmode) { gsiftpopen = 2; } else { gsiftpopen = 1; } if (gsiftpurl) free(gsiftpurl); gsiftpurl = strdup(filename); if (setjmp(env) != 0) { ffpmsg("Timeout (gsiftp_open)"); goto error; } signal(SIGALRM, signal_handler); alarm(NETTIMEOUT); if (gsiftp_get(filename,&gsiftpfile,num_streams)) { alarm(0); ffpmsg("Unable to open gsiftp file (gsiftp_open)"); ffpmsg(filename); goto error; } fclose(gsiftpfile); signal(SIGALRM, SIG_DFL); alarm(0); return file_open(gsiftp_tmpfile, rwmode, handle); error: alarm(0); signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } int gsiftp_create(char *filename, int *handle) { if (gsiftpurl) free(gsiftpurl); gsiftpurl = strdup(filename); return file_create(gsiftp_tmpfile, handle); } int gsiftp_truncate(int handle, LONGLONG filesize) { return file_truncate(handle, filesize); } int gsiftp_size(int handle, LONGLONG *filesize) { return file_size(handle, filesize); } int gsiftp_flush(int handle) { FILE *gsiftpfile; int num_streams; if (getenv("GSIFTP_STREAMS")) { num_streams = (int)getenv("GSIFTP_STREAMS"); } else { num_streams = 1; } int rc = file_flush(handle); if (gsiftpopen != 1) { if (setjmp(env) != 0) { ffpmsg("Timeout (gsiftp_write)"); goto error; } signal(SIGALRM, signal_handler); alarm(NETTIMEOUT); if (gsiftp_put(gsiftpurl,&gsiftpfile,num_streams)) { alarm(0); ffpmsg("Unable to open gsiftp file (gsiftp_flush)"); ffpmsg(gsiftpurl); goto error; } fclose(gsiftpfile); signal(SIGALRM, SIG_DFL); alarm(0); } return rc; error: alarm(0); signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } int gsiftp_seek(int handle, LONGLONG offset) { return file_seek(handle, offset); } int gsiftp_read(int hdl, void *buffer, long nbytes) { return file_read(hdl, buffer, nbytes); } int gsiftp_write(int hdl, void *buffer, long nbytes) { return file_write(hdl, buffer, nbytes); } int gsiftp_close(int handle) { unlink(gsiftp_tmpfile); if (gsiftp_tmpdir) rmdir(gsiftp_tmpdir); return file_close(handle); } static void done_cb( void * user_arg, globus_ftp_client_handle_t * handle, globus_object_t * err) { if(err){ fprintf(stderr, "%s", globus_object_printable_to_string(err)); } globus_mutex_lock(&lock); done = GLOBUS_TRUE; globus_cond_signal(&cond); globus_mutex_unlock(&lock); return; } static void data_cb_read( void * user_arg, globus_ftp_client_handle_t * handle, globus_object_t * err, globus_byte_t * buffer, globus_size_t length, globus_off_t offset, globus_bool_t eof) { if(err) { fprintf(stderr, "%s", globus_object_printable_to_string(err)); } else { FILE* fd = (FILE*) user_arg; int rc = fwrite(buffer, 1, length, fd); if (ferror(fd)) { printf("Read error in function data_cb_read; errno = %d\n", errno); return; } if (!eof) { globus_ftp_client_register_read(handle, buffer, MAX_BUFFER_SIZE_R, data_cb_read, (void*) fd); } } return; } static void data_cb_write( void * user_arg, globus_ftp_client_handle_t * handle, globus_object_t * err, globus_byte_t * buffer, globus_size_t length, globus_off_t offset, globus_bool_t eof) { int curr_offset; if(err) { fprintf(stderr, "%s", globus_object_printable_to_string(err)); } else { if (!eof) { FILE* fd = (FILE*) user_arg; int rc; globus_mutex_lock(&lock); curr_offset = global_offset; rc = fread(buffer, 1, MAX_BUFFER_SIZE_W, fd); global_offset += rc; globus_mutex_unlock(&lock); if (ferror(fd)) { printf("Read error in function data_cb_write; errno = %d\n", errno); return; } globus_ftp_client_register_write(handle, buffer, rc, curr_offset, feof(fd) != 0, data_cb_write, (void*) fd); } else { globus_libc_free(buffer); } } return; } int gsiftp_get(char *filename, FILE **gsiftpfile, int num_streams) { char gsiurl[MAXLEN]; globus_ftp_client_handle_t handle; globus_ftp_client_operationattr_t attr; globus_ftp_client_handleattr_t handle_attr; globus_ftp_control_parallelism_t parallelism; globus_ftp_control_layout_t layout; globus_byte_t buffer[MAX_BUFFER_SIZE_R]; globus_size_t buffer_length = sizeof(buffer); globus_result_t result; globus_ftp_client_restart_marker_t restart; globus_ftp_control_type_t filetype; globus_module_activate(GLOBUS_FTP_CLIENT_MODULE); globus_mutex_init(&lock, GLOBUS_NULL); globus_cond_init(&cond, GLOBUS_NULL); globus_ftp_client_handle_init(&handle, GLOBUS_NULL); globus_ftp_client_handleattr_init(&handle_attr); globus_ftp_client_operationattr_init(&attr); layout.mode = GLOBUS_FTP_CONTROL_STRIPING_NONE; globus_ftp_client_restart_marker_init(&restart); globus_ftp_client_operationattr_set_mode( &attr, GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK); if (num_streams >= 1) { parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED; parallelism.fixed.size = num_streams; globus_ftp_client_operationattr_set_parallelism( &attr, ¶llelism); } globus_ftp_client_operationattr_set_layout(&attr, &layout); filetype = GLOBUS_FTP_CONTROL_TYPE_IMAGE; globus_ftp_client_operationattr_set_type (&attr, filetype); globus_ftp_client_handle_init(&handle, &handle_attr); done = GLOBUS_FALSE; strcpy(gsiurl,"gsiftp://"); strcat(gsiurl,filename); *gsiftpfile = fopen(gsiftp_tmpfile,"w+"); if (!*gsiftpfile) { ffpmsg("Unable to open temporary file!"); return (FILE_NOT_OPENED); } result = globus_ftp_client_get(&handle, gsiurl, &attr, &restart, done_cb, 0); if(result != GLOBUS_SUCCESS) { globus_object_t * err; err = globus_error_get(result); fprintf(stderr, "%s", globus_object_printable_to_string(err)); done = GLOBUS_TRUE; } else { globus_ftp_client_register_read(&handle, buffer, buffer_length, data_cb_read, (void*) *gsiftpfile); } globus_mutex_lock(&lock); while(!done) { globus_cond_wait(&cond, &lock); } globus_mutex_unlock(&lock); globus_ftp_client_handle_destroy(&handle); globus_module_deactivate_all(); return 0; } int gsiftp_put(char *filename, FILE **gsiftpfile, int num_streams) { int i; char gsiurl[MAXLEN]; globus_ftp_client_handle_t handle; globus_ftp_client_operationattr_t attr; globus_ftp_client_handleattr_t handle_attr; globus_ftp_control_parallelism_t parallelism; globus_ftp_control_layout_t layout; globus_byte_t * buffer; globus_size_t buffer_length = sizeof(buffer); globus_result_t result; globus_ftp_client_restart_marker_t restart; globus_ftp_control_type_t filetype; globus_module_activate(GLOBUS_FTP_CLIENT_MODULE); globus_mutex_init(&lock, GLOBUS_NULL); globus_cond_init(&cond, GLOBUS_NULL); globus_ftp_client_handle_init(&handle, GLOBUS_NULL); globus_ftp_client_handleattr_init(&handle_attr); globus_ftp_client_operationattr_init(&attr); layout.mode = GLOBUS_FTP_CONTROL_STRIPING_NONE; globus_ftp_client_restart_marker_init(&restart); globus_ftp_client_operationattr_set_mode( &attr, GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK); if (num_streams >= 1) { parallelism.mode = GLOBUS_FTP_CONTROL_PARALLELISM_FIXED; parallelism.fixed.size = num_streams; globus_ftp_client_operationattr_set_parallelism( &attr, ¶llelism); } globus_ftp_client_operationattr_set_layout(&attr, &layout); filetype = GLOBUS_FTP_CONTROL_TYPE_IMAGE; globus_ftp_client_operationattr_set_type (&attr, filetype); globus_ftp_client_handle_init(&handle, &handle_attr); done = GLOBUS_FALSE; strcpy(gsiurl,"gsiftp://"); strcat(gsiurl,filename); *gsiftpfile = fopen(gsiftp_tmpfile,"r"); if (!*gsiftpfile) { ffpmsg("Unable to open temporary file!"); return (FILE_NOT_OPENED); } result = globus_ftp_client_put(&handle, gsiurl, &attr, &restart, done_cb, 0); if(result != GLOBUS_SUCCESS) { globus_object_t * err; err = globus_error_get(result); fprintf(stderr, "%s", globus_object_printable_to_string(err)); done = GLOBUS_TRUE; } else { int rc; int curr_offset; for (i = 0; i< 2 * num_streams && feof(*gsiftpfile) == 0; i++) { buffer = malloc(MAX_BUFFER_SIZE_W); globus_mutex_lock(&lock); curr_offset = global_offset; rc = fread(buffer, 1, MAX_BUFFER_SIZE_W, *gsiftpfile); global_offset += rc; globus_mutex_unlock(&lock); globus_ftp_client_register_write( &handle, buffer, rc, curr_offset, feof(*gsiftpfile) != 0, data_cb_write, (void*) *gsiftpfile); } } globus_mutex_lock(&lock); while(!done) { globus_cond_wait(&cond, &lock); } globus_mutex_unlock(&lock); globus_ftp_client_handle_destroy(&handle); globus_module_deactivate_all(); return 0; } static void signal_handler(int sig) { switch (sig) { case SIGALRM: /* process for alarm */ longjmp(env,sig); default: { /* Hmm, shouldn't have happend */ exit(sig); } } } #endif #endif astropy-0.3/cextern/cfitsio/eval_f.c0000644000175000017500000030057712243255342015723 0ustar oleole/************************************************************************/ /* */ /* CFITSIO Lexical Parser */ /* */ /* This file is one of 3 files containing code which parses an */ /* arithmetic expression and evaluates it in the context of an input */ /* FITS file table extension. The CFITSIO lexical parser is divided */ /* into the following 3 parts/files: the CFITSIO "front-end", */ /* eval_f.c, contains the interface between the user/CFITSIO and the */ /* real core of the parser; the FLEX interpreter, eval_l.c, takes the */ /* input string and parses it into tokens and identifies the FITS */ /* information required to evaluate the expression (ie, keywords and */ /* columns); and, the BISON grammar and evaluation routines, eval_y.c, */ /* receives the FLEX output and determines and performs the actual */ /* operations. The files eval_l.c and eval_y.c are produced from */ /* running flex and bison on the files eval.l and eval.y, respectively. */ /* (flex and bison are available from any GNU archive: see www.gnu.org) */ /* */ /* The grammar rules, rather than evaluating the expression in situ, */ /* builds a tree, or Nodal, structure mapping out the order of */ /* operations and expression dependencies. This "compilation" process */ /* allows for much faster processing of multiple rows. This technique */ /* was developed by Uwe Lammers of the XMM Science Analysis System, */ /* although the CFITSIO implementation is entirely code original. */ /* */ /* */ /* Modification History: */ /* */ /* Kent Blackburn c1992 Original parser code developed for the */ /* FTOOLS software package, in particular, */ /* the fselect task. */ /* Kent Blackburn c1995 BIT column support added */ /* Peter D Wilson Feb 1998 Vector column support added */ /* Peter D Wilson May 1998 Ported to CFITSIO library. User */ /* interface routines written, in essence */ /* making fselect, fcalc, and maketime */ /* capabilities available to all tools */ /* via single function calls. */ /* Peter D Wilson Jun 1998 Major rewrite of parser core, so as to */ /* create a run-time evaluation tree, */ /* inspired by the work of Uwe Lammers, */ /* resulting in a speed increase of */ /* 10-100 times. */ /* Peter D Wilson Jul 1998 gtifilter(a,b,c,d) function added */ /* Peter D Wilson Aug 1998 regfilter(a,b,c,d) function added */ /* Peter D Wilson Jul 1999 Make parser fitsfile-independent, */ /* allowing a purely vector-based usage */ /* Peter D Wilson Aug 1999 Add row-offset capability */ /* Peter D Wilson Sep 1999 Add row-range capability to ffcalc_rng */ /* */ /************************************************************************/ #include #include #include "eval_defs.h" #include "region.h" typedef struct { int datatype; /* Data type to cast parse results into for user */ void *dataPtr; /* Pointer to array of results, NULL if to use iterCol */ void *nullPtr; /* Pointer to nulval, use zero if NULL */ long maxRows; /* Max No. of rows to process, -1=all, 0=1 iteration */ int anyNull; /* Flag indicating at least 1 undef value encountered */ } parseInfo; /* Internal routines needed to allow the evaluator to operate on FITS data */ static void Setup_DataArrays( int nCols, iteratorCol *cols, long fRow, long nRows ); static int find_column( char *colName, void *itslval ); static int find_keywd ( char *key, void *itslval ); static int allocateCol( int nCol, int *status ); static int load_column( int varNum, long fRow, long nRows, void *data, char *undef ); static int DEBUG_PIXFILTER; #define FREE(x) { if (x) free(x); else printf("invalid free(" #x ") at %s:%d\n", __FILE__, __LINE__); } /*---------------------------------------------------------------------------*/ int fffrow( fitsfile *fptr, /* I - Input FITS file */ char *expr, /* I - Boolean expression */ long firstrow, /* I - First row of table to eval */ long nrows, /* I - Number of rows to evaluate */ long *n_good_rows, /* O - Number of rows eval to True */ char *row_status, /* O - Array of boolean results */ int *status ) /* O - Error status */ /* */ /* Evaluate a boolean expression using the indicated rows, returning an */ /* array of flags indicating which rows evaluated to TRUE/FALSE */ /*---------------------------------------------------------------------------*/ { parseInfo Info; int naxis, constant; long nelem, naxes[MAXDIMS], elem; char result; if( *status ) return( *status ); FFLOCK; if( ffiprs( fptr, 0, expr, MAXDIMS, &Info.datatype, &nelem, &naxis, naxes, status ) ) { ffcprs(); FFUNLOCK; return( *status ); } if( nelem<0 ) { constant = 1; nelem = -nelem; } else constant = 0; if( Info.datatype!=TLOGICAL || nelem!=1 ) { ffcprs(); ffpmsg("Expression does not evaluate to a logical scalar."); FFUNLOCK; return( *status = PARSE_BAD_TYPE ); } if( constant ) { /* No need to call parser... have result from ffiprs */ result = gParse.Nodes[gParse.resultNode].value.data.log; *n_good_rows = nrows; for( elem=0; elem1 ? firstrow : 1); Info.dataPtr = row_status; Info.nullPtr = NULL; Info.maxRows = nrows; if( ffiter( gParse.nCols, gParse.colData, firstrow-1, 0, parse_data, (void*)&Info, status ) == -1 ) *status = 0; /* -1 indicates exitted without error before end... OK */ if( *status ) { /***********************/ /* Error... Do nothing */ /***********************/ } else { /***********************************/ /* Count number of good rows found */ /***********************************/ *n_good_rows = 0L; for( elem=0; elemHDUposition != (infptr->Fptr)->curhdu ) ffmahd( infptr, (infptr->HDUposition) + 1, NULL, status ); if( *status ) { ffcprs(); FFUNLOCK; return( *status ); } inExt.rowLength = (long) (infptr->Fptr)->rowlength; inExt.numRows = (infptr->Fptr)->numrows; inExt.heapSize = (infptr->Fptr)->heapsize; if( inExt.numRows == 0 ) { /* Nothing to copy */ ffcprs(); FFUNLOCK; return( *status ); } if( outfptr->HDUposition != (outfptr->Fptr)->curhdu ) ffmahd( outfptr, (outfptr->HDUposition) + 1, NULL, status ); if( (outfptr->Fptr)->datastart < 0 ) ffrdef( outfptr, status ); if( *status ) { ffcprs(); FFUNLOCK; return( *status ); } outExt.rowLength = (long) (outfptr->Fptr)->rowlength; outExt.numRows = (outfptr->Fptr)->numrows; if( !outExt.numRows ) (outfptr->Fptr)->heapsize = 0L; outExt.heapSize = (outfptr->Fptr)->heapsize; if( inExt.rowLength != outExt.rowLength ) { ffpmsg("Output table has different row length from input"); ffcprs(); FFUNLOCK; return( *status = PARSE_BAD_OUTPUT ); } /***********************************/ /* Fill out Info data for parser */ /***********************************/ Info.dataPtr = (char *)malloc( (size_t) ((inExt.numRows + 1) * sizeof(char)) ); Info.nullPtr = NULL; Info.maxRows = (long) inExt.numRows; if( !Info.dataPtr ) { ffpmsg("Unable to allocate memory for row selection"); ffcprs(); FFUNLOCK; return( *status = MEMORY_ALLOCATION ); } /* make sure array is zero terminated */ ((char*)Info.dataPtr)[inExt.numRows] = 0; if( constant ) { /* Set all rows to the same value from constant result */ result = gParse.Nodes[gParse.resultNode].value.data.log; for( ntodo = 0; ntodo 1) ffirow( outfptr, outExt.numRows, nGood, status ); } do { if( ((char*)Info.dataPtr)[inloc-1] ) { ffgtbb( infptr, inloc, 1L, rdlen, buffer+rdlen*nbuff, status ); nbuff++; if( nbuff==maxrows ) { ffptbb( outfptr, outloc, 1L, rdlen*nbuff, buffer, status ); outloc += nbuff; nbuff = 0; } } inloc++; } while( !*status && inloc<=inExt.numRows ); if( nbuff ) { ffptbb( outfptr, outloc, 1L, rdlen*nbuff, buffer, status ); outloc += nbuff; } if( infptr==outfptr ) { if( outloc<=inExt.numRows ) ffdrow( infptr, outloc, inExt.numRows-outloc+1, status ); } else if( inExt.heapSize && nGood ) { /* Copy heap, if it exists and at least one row copied */ /********************************************************/ /* Get location information from the output extension */ /********************************************************/ if( outfptr->HDUposition != (outfptr->Fptr)->curhdu ) ffmahd( outfptr, (outfptr->HDUposition) + 1, NULL, status ); outExt.dataStart = (outfptr->Fptr)->datastart; outExt.heapStart = (outfptr->Fptr)->heapstart; /*************************************************/ /* Insert more space into outfptr if necessary */ /*************************************************/ hsize = outExt.heapStart + outExt.heapSize; freespace = (long) (( ( (hsize + 2879) / 2880) * 2880) - hsize); ntodo = inExt.heapSize; if ( (freespace - ntodo) < 0) { /* not enough existing space? */ ntodo = (ntodo - freespace + 2879) / 2880; /* number of blocks */ ffiblk(outfptr, (long) ntodo, 1, status); /* insert the blocks */ } ffukyj( outfptr, "PCOUNT", inExt.heapSize+outExt.heapSize, NULL, status ); /*******************************************************/ /* Get location information from the input extension */ /*******************************************************/ if( infptr->HDUposition != (infptr->Fptr)->curhdu ) ffmahd( infptr, (infptr->HDUposition) + 1, NULL, status ); inExt.dataStart = (infptr->Fptr)->datastart; inExt.heapStart = (infptr->Fptr)->heapstart; /**********************************/ /* Finally copy heap to outfptr */ /**********************************/ ntodo = inExt.heapSize; inbyteloc = inExt.heapStart + inExt.dataStart; outbyteloc = outExt.heapStart + outExt.dataStart + outExt.heapSize; while ( ntodo && !*status ) { rdlen = (long) minvalue(ntodo,500000); ffmbyt( infptr, inbyteloc, REPORT_EOF, status ); ffgbyt( infptr, rdlen, buffer, status ); ffmbyt( outfptr, outbyteloc, IGNORE_EOF, status ); ffpbyt( outfptr, rdlen, buffer, status ); inbyteloc += rdlen; outbyteloc += rdlen; ntodo -= rdlen; } /***********************************************************/ /* But must update DES if data is being appended to a */ /* pre-existing heap space. Edit each new entry in file */ /***********************************************************/ if( outExt.heapSize ) { LONGLONG repeat, offset, j; int i; for( i=1; i<=(outfptr->Fptr)->tfield; i++ ) { if( (outfptr->Fptr)->tableptr[i-1].tdatatype<0 ) { for( j=outExt.numRows+1; j<=outExt.numRows+nGood; j++ ) { ffgdesll( outfptr, i, j, &repeat, &offset, status ); offset += outExt.heapSize; ffpdes( outfptr, i, j, repeat, offset, status ); } } } } } /* End of HEAP copy */ FREE(buffer); } FREE(Info.dataPtr); ffcprs(); ffcmph(outfptr, status); /* compress heap, deleting any orphaned data */ FFUNLOCK; return(*status); } /*---------------------------------------------------------------------------*/ int ffcrow( fitsfile *fptr, /* I - Input FITS file */ int datatype, /* I - Datatype to return results as */ char *expr, /* I - Arithmetic expression */ long firstrow, /* I - First row to evaluate */ long nelements, /* I - Number of elements to return */ void *nulval, /* I - Ptr to value to use as UNDEF */ void *array, /* O - Array of results */ int *anynul, /* O - Were any UNDEFs encountered? */ int *status ) /* O - Error status */ /* */ /* Calculate an expression for the indicated rows of a table, returning */ /* the results, cast as datatype (TSHORT, TDOUBLE, etc), in array. If */ /* nulval==NULL, UNDEFs will be zeroed out. For vector results, the number */ /* of elements returned may be less than nelements if nelements is not an */ /* even multiple of the result dimension. Call fftexp to obtain the */ /* dimensions of the results. */ /*---------------------------------------------------------------------------*/ { parseInfo Info; int naxis; long nelem1, naxes[MAXDIMS]; if( *status ) return( *status ); FFLOCK; if( ffiprs( fptr, 0, expr, MAXDIMS, &Info.datatype, &nelem1, &naxis, naxes, status ) ) { ffcprs(); FFUNLOCK; return( *status ); } if( nelem1<0 ) nelem1 = - nelem1; if( nelements1 ? firstrow : 1); if( datatype ) Info.datatype = datatype; Info.dataPtr = array; Info.nullPtr = nulval; Info.maxRows = nelements / nelem1; if( ffiter( gParse.nCols, gParse.colData, firstrow-1, 0, parse_data, (void*)&Info, status ) == -1 ) *status=0; /* -1 indicates exitted without error before end... OK */ *anynul = Info.anyNull; ffcprs(); FFUNLOCK; return( *status ); } /*--------------------------------------------------------------------------*/ int ffcalc( fitsfile *infptr, /* I - Input FITS file */ char *expr, /* I - Arithmetic expression */ fitsfile *outfptr, /* I - Output fits file */ char *parName, /* I - Name of output parameter */ char *parInfo, /* I - Extra information on parameter */ int *status ) /* O - Error status */ /* */ /* Evaluate an expression for all rows of a table. Call ffcalc_rng with */ /* a row range of 1-MAX. */ { long start=1, end=LONG_MAX; return ffcalc_rng( infptr, expr, outfptr, parName, parInfo, 1, &start, &end, status ); } /*--------------------------------------------------------------------------*/ int ffcalc_rng( fitsfile *infptr, /* I - Input FITS file */ char *expr, /* I - Arithmetic expression */ fitsfile *outfptr, /* I - Output fits file */ char *parName, /* I - Name of output parameter */ char *parInfo, /* I - Extra information on parameter */ int nRngs, /* I - Row range info */ long *start, /* I - Row range info */ long *end, /* I - Row range info */ int *status ) /* O - Error status */ /* */ /* Evaluate an expression using the data in the input FITS file and place */ /* the results into either a column or keyword in the output fits file, */ /* depending on the value of parName (keywords normally prefixed with '#') */ /* and whether the expression evaluates to a constant or a table column. */ /* The logic is as follows: */ /* (1) If a column exists with name, parName, put results there. */ /* (2) If parName starts with '#', as in #NAXIS, put result there, */ /* with parInfo used as the comment. If expression does not evaluate */ /* to a constant, flag an error. */ /* (3) If a keyword exists with name, parName, and expression is a */ /* constant, put result there, using parInfo as the new comment. */ /* (4) Else, create a new column with name parName and TFORM parInfo. */ /* If parInfo is NULL, use a default data type for the column. */ /*--------------------------------------------------------------------------*/ { parseInfo Info; int naxis, constant, typecode, newNullKwd=0; long nelem, naxes[MAXDIMS], repeat, width; int col_cnt, colNo; Node *result; char card[81], tform[16], nullKwd[9], tdimKwd[9]; if( *status ) return( *status ); FFLOCK; if( ffiprs( infptr, 0, expr, MAXDIMS, &Info.datatype, &nelem, &naxis, naxes, status ) ) { ffcprs(); FFUNLOCK; return( *status ); } if( nelem<0 ) { constant = 1; nelem = -nelem; } else constant = 0; /* Case (1): If column exists put it there */ colNo = 0; if( ffgcno( outfptr, CASEINSEN, parName, &colNo, status )==COL_NOT_FOUND ) { /* Output column doesn't exist. Test for keyword. */ /* Case (2): Does parName indicate result should be put into keyword */ *status = 0; if( parName[0]=='#' ) { if( ! constant ) { ffcprs(); ffpmsg( "Cannot put tabular result into keyword (ffcalc)" ); FFUNLOCK; return( *status = PARSE_BAD_TYPE ); } parName++; /* Advance past '#' */ if ( (strcasecmp(parName,"HISTORY") == 0 || strcasecmp(parName,"COMMENT") == 0) && Info.datatype != TSTRING ) { ffcprs(); ffpmsg( "HISTORY and COMMENT values must be strings (ffcalc)" ); FFUNLOCK; return( *status = PARSE_BAD_TYPE ); } } else if( constant ) { /* Case (3): Does a keyword named parName already exist */ if( ffgcrd( outfptr, parName, card, status )==KEY_NO_EXIST ) { colNo = -1; } else if( *status ) { ffcprs(); FFUNLOCK; return( *status ); } } else colNo = -1; if( colNo<0 ) { /* Case (4): Create new column */ *status = 0; ffgncl( outfptr, &colNo, status ); colNo++; if( parInfo==NULL || *parInfo=='\0' ) { /* Figure out best default column type */ if( gParse.hdutype==BINARY_TBL ) { sprintf(tform,"%ld",nelem); switch( Info.datatype ) { case TLOGICAL: strcat(tform,"L"); break; case TLONG: strcat(tform,"J"); break; case TDOUBLE: strcat(tform,"D"); break; case TSTRING: strcat(tform,"A"); break; case TBIT: strcat(tform,"X"); break; case TLONGLONG: strcat(tform,"K"); break; } } else { switch( Info.datatype ) { case TLOGICAL: ffcprs(); ffpmsg("Cannot create LOGICAL column in ASCII table"); FFUNLOCK; return( *status = NOT_BTABLE ); case TLONG: strcpy(tform,"I11"); break; case TDOUBLE: strcpy(tform,"D23.15"); break; case TSTRING: case TBIT: sprintf(tform,"A%ld",nelem); break; } } parInfo = tform; } else if( !(isdigit((int) *parInfo)) && gParse.hdutype==BINARY_TBL ) { if( Info.datatype==TBIT && *parInfo=='B' ) nelem = (nelem+7)/8; sprintf(tform,"%ld%s",nelem,parInfo); parInfo = tform; } fficol( outfptr, colNo, parName, parInfo, status ); if( naxis>1 ) ffptdm( outfptr, colNo, naxis, naxes, status ); /* Setup TNULLn keyword in case NULLs are encountered */ ffkeyn("TNULL", colNo, nullKwd, status); if( ffgcrd( outfptr, nullKwd, card, status )==KEY_NO_EXIST ) { *status = 0; if( gParse.hdutype==BINARY_TBL ) { LONGLONG nullVal=0; fits_binary_tform( parInfo, &typecode, &repeat, &width, status ); if( typecode==TBYTE ) nullVal = UCHAR_MAX; else if( typecode==TSHORT ) nullVal = SHRT_MIN; else if( typecode==TINT ) nullVal = INT_MIN; else if( typecode==TLONG ) nullVal = LONG_MIN; else if( typecode==TLONGLONG ) nullVal = LONGLONG_MIN; if( nullVal ) { ffpkyj( outfptr, nullKwd, nullVal, "Null value", status ); fits_set_btblnull( outfptr, colNo, nullVal, status ); newNullKwd = 1; } } else if( gParse.hdutype==ASCII_TBL ) { ffpkys( outfptr, nullKwd, "NULL", "Null value string", status ); fits_set_atblnull( outfptr, colNo, "NULL", status ); newNullKwd = 1; } } } } else if( *status ) { ffcprs(); FFUNLOCK; return( *status ); } else { /********************************************************/ /* Check if a TDIM keyword should be written/updated. */ /********************************************************/ ffkeyn("TDIM", colNo, tdimKwd, status); ffgcrd( outfptr, tdimKwd, card, status ); if( *status==0 ) { /* TDIM exists, so update it with result's dimension */ ffptdm( outfptr, colNo, naxis, naxes, status ); } else if( *status==KEY_NO_EXIST ) { /* TDIM does not exist, so clear error stack and */ /* write a TDIM only if result is multi-dimensional */ *status = 0; ffcmsg(); if( naxis>1 ) ffptdm( outfptr, colNo, naxis, naxes, status ); } if( *status ) { /* Either some other error happened in ffgcrd */ /* or one happened in ffptdm */ ffcprs(); FFUNLOCK; return( *status ); } } if( colNo>0 ) { /* Output column exists (now)... put results into it */ int anyNull = 0; int nPerLp, i; long totaln; ffgkyj(infptr, "NAXIS2", &totaln, 0, status); /*************************************/ /* Create new iterator Output Column */ /*************************************/ col_cnt = gParse.nCols; if( allocateCol( col_cnt, status ) ) { ffcprs(); FFUNLOCK; return( *status ); } fits_iter_set_by_num( gParse.colData+col_cnt, outfptr, colNo, 0, OutputCol ); gParse.nCols++; for( i=0; i= 10) && (nRngs == 1) && (start[0] == 1) && (end[0] == totaln)) nPerLp = 0; else nPerLp = Info.maxRows; if( ffiter( gParse.nCols, gParse.colData, start[i]-1, nPerLp, parse_data, (void*)&Info, status ) == -1 ) *status = 0; else if( *status ) { ffcprs(); FFUNLOCK; return( *status ); } if( Info.anyNull ) anyNull = 1; } if( newNullKwd && !anyNull ) { ffdkey( outfptr, nullKwd, status ); } } else { /* Put constant result into keyword */ result = gParse.Nodes + gParse.resultNode; switch( Info.datatype ) { case TDOUBLE: ffukyd( outfptr, parName, result->value.data.dbl, 15, parInfo, status ); break; case TLONG: ffukyj( outfptr, parName, result->value.data.lng, parInfo, status ); break; case TLOGICAL: ffukyl( outfptr, parName, result->value.data.log, parInfo, status ); break; case TBIT: case TSTRING: if (strcasecmp(parName,"HISTORY") == 0) { ffphis( outfptr, result->value.data.str, status); } else if (strcasecmp(parName,"COMMENT") == 0) { ffpcom( outfptr, result->value.data.str, status); } else { ffukys( outfptr, parName, result->value.data.str, parInfo, status ); } break; } } ffcprs(); FFUNLOCK; return( *status ); } /*--------------------------------------------------------------------------*/ int fftexp( fitsfile *fptr, /* I - Input FITS file */ char *expr, /* I - Arithmetic expression */ int maxdim, /* I - Max Dimension of naxes */ int *datatype, /* O - Data type of result */ long *nelem, /* O - Vector length of result */ int *naxis, /* O - # of dimensions of result */ long *naxes, /* O - Size of each dimension */ int *status ) /* O - Error status */ /* */ /* Evaluate the given expression and return information on the result. */ /*--------------------------------------------------------------------------*/ { FFLOCK; ffiprs( fptr, 0, expr, maxdim, datatype, nelem, naxis, naxes, status ); ffcprs(); FFUNLOCK; return( *status ); } /*--------------------------------------------------------------------------*/ int ffiprs( fitsfile *fptr, /* I - Input FITS file */ int compressed, /* I - Is FITS file hkunexpanded? */ char *expr, /* I - Arithmetic expression */ int maxdim, /* I - Max Dimension of naxes */ int *datatype, /* O - Data type of result */ long *nelem, /* O - Vector length of result */ int *naxis, /* O - # of dimensions of result */ long *naxes, /* O - Size of each dimension */ int *status ) /* O - Error status */ /* */ /* Initialize the parser and determine what type of result the expression */ /* produces. */ /*--------------------------------------------------------------------------*/ { Node *result; int i,lexpr, tstatus = 0; int xaxis, bitpix; long xaxes[9]; static iteratorCol dmyCol; if( *status ) return( *status ); /* make sure all internal structures for this HDU are current */ if ( ffrdef(fptr, status) ) return(*status); /* Initialize the Parser structure */ gParse.def_fptr = fptr; gParse.compressed = compressed; gParse.nCols = 0; gParse.colData = NULL; gParse.varData = NULL; gParse.getData = find_column; gParse.loadData = load_column; gParse.Nodes = NULL; gParse.nNodesAlloc= 0; gParse.nNodes = 0; gParse.hdutype = 0; gParse.status = 0; fits_get_hdu_type(fptr, &gParse.hdutype, status ); if (gParse.hdutype == IMAGE_HDU) { fits_get_img_param(fptr, 9, &bitpix, &xaxis, xaxes, status); if (*status) { ffpmsg("ffiprs: unable to get image dimensions"); return( *status ); } gParse.totalRows = xaxis > 0 ? 1 : 0; for (i = 0; i < xaxis; ++i) gParse.totalRows *= xaxes[i]; if (DEBUG_PIXFILTER) printf("naxis=%d, gParse.totalRows=%ld\n", xaxis, gParse.totalRows); } else if( ffgkyj(fptr, "NAXIS2", &gParse.totalRows, 0, &tstatus) ) { /* this might be a 1D or null image with no NAXIS2 keyword */ gParse.totalRows = 0; } /* Copy expression into parser... read from file if necessary */ if( expr[0]=='@' ) { if( ffimport_file( expr+1, &gParse.expr, status ) ) return( *status ); lexpr = strlen(gParse.expr); } else { lexpr = strlen(expr); gParse.expr = (char*)malloc( (2+lexpr)*sizeof(char)); strcpy(gParse.expr,expr); } strcat(gParse.expr + lexpr,"\n"); gParse.index = 0; gParse.is_eobuf = 0; /* Parse the expression, building the Nodes and determing */ /* which columns are needed and what data type is returned */ ffrestart(NULL); if( ffparse() ) { return( *status = PARSE_SYNTAX_ERR ); } /* Check results */ *status = gParse.status; if( *status ) return(*status); if( !gParse.nNodes ) { ffpmsg("Blank expression"); return( *status = PARSE_SYNTAX_ERR ); } if( !gParse.nCols ) { dmyCol.fptr = fptr; /* This allows iterator to know value of */ gParse.colData = &dmyCol; /* fptr when no columns are referenced */ } result = gParse.Nodes + gParse.resultNode; *naxis = result->value.naxis; *nelem = result->value.nelem; for( i=0; i<*naxis && ivalue.naxes[i]; switch( result->type ) { case BOOLEAN: *datatype = TLOGICAL; break; case LONG: *datatype = TLONG; break; case DOUBLE: *datatype = TDOUBLE; break; case BITSTR: *datatype = TBIT; break; case STRING: *datatype = TSTRING; break; default: *datatype = 0; ffpmsg("Bad return data type"); *status = gParse.status = PARSE_BAD_TYPE; break; } gParse.datatype = *datatype; FREE(gParse.expr); if( result->operation==CONST_OP ) *nelem = - *nelem; return(*status); } /*--------------------------------------------------------------------------*/ void ffcprs( void ) /* No parameters */ /* */ /* Clear the parser, making it ready to accept a new expression. */ /*--------------------------------------------------------------------------*/ { int col, node, i; if( gParse.nCols > 0 ) { FREE( gParse.colData ); for( col=0; col 0 ) { node = gParse.nNodes; while( node-- ) { if( gParse.Nodes[node].operation==gtifilt_fct ) { i = gParse.Nodes[node].SubNodes[0]; if (gParse.Nodes[ i ].value.data.ptr) FREE( gParse.Nodes[ i ].value.data.ptr ); } else if( gParse.Nodes[node].operation==regfilt_fct ) { i = gParse.Nodes[node].SubNodes[0]; fits_free_region( (SAORegion *)gParse.Nodes[ i ].value.data.ptr ); } } gParse.nNodes = 0; } if( gParse.Nodes ) free( gParse.Nodes ); gParse.Nodes = NULL; gParse.hdutype = ANY_HDU; gParse.pixFilter = 0; } /*---------------------------------------------------------------------------*/ int parse_data( long totalrows, /* I - Total rows to be processed */ long offset, /* I - Number of rows skipped at start*/ long firstrow, /* I - First row of this iteration */ long nrows, /* I - Number of rows in this iter */ int nCols, /* I - Number of columns in use */ iteratorCol *colData, /* IO- Column information/data */ void *userPtr ) /* I - Data handling instructions */ /* */ /* Iterator work function which calls the parser and copies the results */ /* into either an OutputCol or a data pointer supplied in the userPtr */ /* structure. */ /*---------------------------------------------------------------------------*/ { int status, constant=0, anyNullThisTime=0; long jj, kk, idx, remain, ntodo; Node *result; iteratorCol * outcol; /* declare variables static to preserve their values between calls */ static void *Data, *Null; static int datasize; static long lastRow, repeat, resDataSize; static LONGLONG jnull; static parseInfo *userInfo; static long zeros[4] = {0,0,0,0}; if (DEBUG_PIXFILTER) printf("parse_data(total=%ld, offset=%ld, first=%ld, rows=%ld, cols=%d)\n", totalrows, offset, firstrow, nrows, nCols); /*--------------------------------------------------------*/ /* Initialization procedures: execute on the first call */ /*--------------------------------------------------------*/ outcol = colData + (nCols - 1); if (firstrow == offset+1) { userInfo = (parseInfo*)userPtr; userInfo->anyNull = 0; if( userInfo->maxRows>0 ) userInfo->maxRows = minvalue(totalrows,userInfo->maxRows); else if( userInfo->maxRows<0 ) userInfo->maxRows = totalrows; else userInfo->maxRows = nrows; lastRow = firstrow + userInfo->maxRows - 1; if( userInfo->dataPtr==NULL ) { if( outcol->iotype == InputCol ) { ffpmsg("Output column for parser results not found!"); return( PARSE_NO_OUTPUT ); } /* Data gets set later */ Null = outcol->array; userInfo->datatype = outcol->datatype; /* Check for a TNULL/BLANK keyword for output column/image */ status = 0; jnull = 0; if (gParse.hdutype == IMAGE_HDU) { if (gParse.pixFilter->blank) jnull = (LONGLONG) gParse.pixFilter->blank; } else { ffgknjj( outcol->fptr, "TNULL", outcol->colnum, 1, &jnull, (int*)&jj, &status ); if( status==BAD_INTKEY ) { /* Probably ASCII table with text TNULL keyword */ switch( userInfo->datatype ) { case TSHORT: jnull = (LONGLONG) SHRT_MIN; break; case TINT: jnull = (LONGLONG) INT_MIN; break; case TLONG: jnull = (LONGLONG) LONG_MIN; break; } } } repeat = outcol->repeat; /* if (DEBUG_PIXFILTER) printf("parse_data: using null value %ld\n", jnull); */ } else { Data = userInfo->dataPtr; Null = (userInfo->nullPtr ? userInfo->nullPtr : zeros); repeat = gParse.Nodes[gParse.resultNode].value.nelem; } /* Determine the size of each element of the returned result */ switch( userInfo->datatype ) { case TBIT: /* Fall through to TBYTE */ case TLOGICAL: /* Fall through to TBYTE */ case TBYTE: datasize = sizeof(char); break; case TSHORT: datasize = sizeof(short); break; case TINT: datasize = sizeof(int); break; case TLONG: datasize = sizeof(long); break; case TLONGLONG: datasize = sizeof(LONGLONG); break; case TFLOAT: datasize = sizeof(float); break; case TDOUBLE: datasize = sizeof(double); break; case TSTRING: datasize = sizeof(char*); break; } /* Determine the size of each element of the calculated result */ /* (only matters for numeric/logical data) */ switch( gParse.Nodes[gParse.resultNode].type ) { case BOOLEAN: resDataSize = sizeof(char); break; case LONG: resDataSize = sizeof(long); break; case DOUBLE: resDataSize = sizeof(double); break; } } /*-------------------------------------------*/ /* Main loop: process all the rows of data */ /*-------------------------------------------*/ /* If writing to output column, set first element to appropriate */ /* null value. If no NULLs encounter, zero out before returning. */ /* if (DEBUG_PIXFILTER) printf("parse_data: using null value %ld\n", jnull); */ if( userInfo->dataPtr == NULL ) { /* First, reset Data pointer to start of output array */ Data = (char*) outcol->array + datasize; switch( userInfo->datatype ) { case TLOGICAL: *(char *)Null = 'U'; break; case TBYTE: *(char *)Null = (char )jnull; break; case TSHORT: *(short *)Null = (short)jnull; break; case TINT: *(int *)Null = (int )jnull; break; case TLONG: *(long *)Null = (long )jnull; break; case TLONGLONG: *(LONGLONG *)Null = (LONGLONG )jnull; break; case TFLOAT: *(float *)Null = FLOATNULLVALUE; break; case TDOUBLE: *(double*)Null = DOUBLENULLVALUE; break; case TSTRING: (*(char **)Null)[0] = '\1'; (*(char **)Null)[1] = '\0'; break; } } /* Alter nrows in case calling routine didn't want to do all rows */ nrows = minvalue(nrows,lastRow-firstrow+1); Setup_DataArrays( nCols, colData, firstrow, nrows ); /* Parser allocates arrays for each column and calculation it performs. */ /* Limit number of rows processed during each pass to reduce memory */ /* requirements... In most cases, iterator will limit rows to less */ /* than 2500 rows per iteration, so this is really only relevant for */ /* hk-compressed files which must be decompressed in memory and sent */ /* whole to parse_data in a single iteration. */ remain = nrows; while( remain ) { ntodo = minvalue(remain,2500); Evaluate_Parser ( firstrow, ntodo ); if( gParse.status ) break; firstrow += ntodo; remain -= ntodo; /* Copy results into data array */ result = gParse.Nodes + gParse.resultNode; if( result->operation==CONST_OP ) constant = 1; switch( result->type ) { case BOOLEAN: case LONG: case DOUBLE: if( constant ) { char undef=0; for( kk=0; kkvalue.data), &undef, result->value.nelem /* 1 */, userInfo->datatype, Null, (char*)Data + (kk*repeat+jj)*datasize, &anyNullThisTime, &gParse.status ); } else { if ( repeat == result->value.nelem ) { ffcvtn( gParse.datatype, result->value.data.ptr, result->value.undef, result->value.nelem*ntodo, userInfo->datatype, Null, Data, &anyNullThisTime, &gParse.status ); } else if( result->value.nelem == 1 ) { for( kk=0; kkvalue.data.ptr + kk*resDataSize, (char*)result->value.undef + kk, 1, userInfo->datatype, Null, (char*)Data + (kk*repeat+jj)*datasize, &anyNullThisTime, &gParse.status ); } } else { int nCopy; nCopy = minvalue( repeat, result->value.nelem ); for( kk=0; kkvalue.data.ptr + kk*result->value.nelem*resDataSize, (char*)result->value.undef + kk*result->value.nelem, nCopy, userInfo->datatype, Null, (char*)Data + (kk*repeat)*datasize, &anyNullThisTime, &gParse.status ); if( nCopy < repeat ) { memset( (char*)Data + (kk*repeat+nCopy)*datasize, 0, (repeat-nCopy)*datasize); } } } if( result->operation>0 ) { FREE( result->value.data.ptr ); } } if( gParse.status==OVERFLOW_ERR ) { gParse.status = NUM_OVERFLOW; ffpmsg("Numerical overflow while converting expression to necessary datatype"); } break; case BITSTR: switch( userInfo->datatype ) { case TBYTE: idx = -1; for( kk=0; kkvalue.nelem; jj++ ) { if( jj%8 == 0 ) ((char*)Data)[++idx] = 0; if( constant ) { if( result->value.data.str[jj]=='1' ) ((char*)Data)[idx] |= 128>>(jj%8); } else { if( result->value.data.strptr[kk][jj]=='1' ) ((char*)Data)[idx] |= 128>>(jj%8); } } } break; case TBIT: case TLOGICAL: if( constant ) { for( kk=0; kkvalue.nelem; jj++ ) { ((char*)Data)[ jj+kk*result->value.nelem ] = ( result->value.data.str[jj]=='1' ); } } else { for( kk=0; kkvalue.nelem; jj++ ) { ((char*)Data)[ jj+kk*result->value.nelem ] = ( result->value.data.strptr[kk][jj]=='1' ); } } break; case TSTRING: if( constant ) { for( jj=0; jjvalue.data.str ); } } else { for( jj=0; jjvalue.data.strptr[jj] ); } } break; default: ffpmsg("Cannot convert bit expression to desired type."); gParse.status = PARSE_BAD_TYPE; break; } if( result->operation>0 ) { FREE( result->value.data.strptr[0] ); FREE( result->value.data.strptr ); } break; case STRING: if( userInfo->datatype==TSTRING ) { if( constant ) { for( jj=0; jjvalue.data.str ); } else { for( jj=0; jjvalue.undef[jj] ) { anyNullThisTime = 1; strcpy( ((char**)Data)[jj], *(char **)Null ); } else { strcpy( ((char**)Data)[jj], result->value.data.strptr[jj] ); } } } else { ffpmsg("Cannot convert string expression to desired type."); gParse.status = PARSE_BAD_TYPE; } if( result->operation>0 ) { FREE( result->value.data.strptr[0] ); FREE( result->value.data.strptr ); } break; } if( gParse.status ) break; /* Increment Data to point to where the next block should go */ if( result->type==BITSTR && userInfo->datatype==TBYTE ) Data = (char*)Data + datasize * ( (result->value.nelem+7)/8 ) * ntodo; else if( result->type==STRING ) Data = (char*)Data + datasize * ntodo; else Data = (char*)Data + datasize * ntodo * repeat; } /* If no NULLs encountered during this pass, set Null value to */ /* zero to make the writing of the output column data faster */ if( anyNullThisTime ) userInfo->anyNull = 1; else if( userInfo->dataPtr == NULL ) { if( userInfo->datatype == TSTRING ) memcpy( *(char **)Null, zeros, 2 ); else memcpy( Null, zeros, datasize ); } /*-------------------------------------------------------*/ /* Clean up procedures: after processing all the rows */ /*-------------------------------------------------------*/ /* if the calling routine specified that only a limited number */ /* of rows in the table should be processed, return a value of -1 */ /* once all the rows have been done, if no other error occurred. */ if (gParse.hdutype != IMAGE_HDU && firstrow - 1 == lastRow) { if (!gParse.status && userInfo->maxRowsiotype == OutputCol ) continue; nelem = varData->nelem; len = nelem * nRows; switch ( varData->type ) { case BITSTR: /* No need for UNDEF array, but must make string DATA array */ len = (nelem+1)*nRows; /* Count '\0' */ bitStrs = (char**)varData->data; if( bitStrs ) FREE( bitStrs[0] ); free( bitStrs ); bitStrs = (char**)malloc( nRows*sizeof(char*) ); if( bitStrs==NULL ) { varData->data = varData->undef = NULL; gParse.status = MEMORY_ALLOCATION; break; } bitStrs[0] = (char*)malloc( len*sizeof(char) ); if( bitStrs[0]==NULL ) { free( bitStrs ); varData->data = varData->undef = NULL; gParse.status = MEMORY_ALLOCATION; break; } for( row=0; rowarray)[idx] & (1<<(7-len%8)) ) bitStrs[row][len] = '1'; else bitStrs[row][len] = '0'; if( len%8==7 ) idx++; } bitStrs[row][len] = '\0'; } varData->undef = (char*)bitStrs; varData->data = (char*)bitStrs; break; case STRING: sptr = (char**)icol->array; if (varData->undef) free( varData->undef ); varData->undef = (char*)malloc( nRows*sizeof(char) ); if( varData->undef==NULL ) { gParse.status = MEMORY_ALLOCATION; break; } row = nRows; while( row-- ) varData->undef[row] = ( **sptr != '\0' && FSTRCMP( sptr[0], sptr[row+1] )==0 ); varData->data = sptr + 1; break; case BOOLEAN: barray = (char*)icol->array; if (varData->undef) free( varData->undef ); varData->undef = (char*)malloc( len*sizeof(char) ); if( varData->undef==NULL ) { gParse.status = MEMORY_ALLOCATION; break; } while( len-- ) { varData->undef[len] = ( barray[0]!=0 && barray[0]==barray[len+1] ); } varData->data = barray + 1; break; case LONG: iarray = (long*)icol->array; if (varData->undef) free( varData->undef ); varData->undef = (char*)malloc( len*sizeof(char) ); if( varData->undef==NULL ) { gParse.status = MEMORY_ALLOCATION; break; } while( len-- ) { varData->undef[len] = ( iarray[0]!=0L && iarray[0]==iarray[len+1] ); } varData->data = iarray + 1; break; case DOUBLE: rarray = (double*)icol->array; if (varData->undef) free( varData->undef ); varData->undef = (char*)malloc( len*sizeof(char) ); if( varData->undef==NULL ) { gParse.status = MEMORY_ALLOCATION; break; } while( len-- ) { varData->undef[len] = ( rarray[0]!=0.0 && rarray[0]==rarray[len+1]); } varData->data = rarray + 1; break; default: sprintf(msg, "SetupDataArrays, unhandled type %d\n", varData->type); ffpmsg(msg); } if( gParse.status ) { /* Deallocate NULL arrays of previous columns */ while( i-- ) { varData = gParse.varData + i; if( varData->type==BITSTR ) FREE( ((char**)varData->data)[0] ); FREE( varData->undef ); varData->undef = NULL; } return; } } } /*--------------------------------------------------------------------------*/ int ffcvtn( int inputType, /* I - Data type of input array */ void *input, /* I - Input array of type inputType */ char *undef, /* I - Array of flags indicating UNDEF elems */ long ntodo, /* I - Number of elements to process */ int outputType, /* I - Data type of output array */ void *nulval, /* I - Ptr to value to use for UNDEF elements */ void *output, /* O - Output array of type outputType */ int *anynull, /* O - Any nulls flagged? */ int *status ) /* O - Error status */ /* */ /* Convert an array of any input data type to an array of any output */ /* data type, using an array of UNDEF flags to assign nulvals to */ /*--------------------------------------------------------------------------*/ { long i; switch( outputType ) { case TLOGICAL: switch( inputType ) { case TLOGICAL: case TBYTE: for( i=0; i UCHAR_MAX ) { *status = OVERFLOW_ERR; ((unsigned char*)output)[i] = UCHAR_MAX; } else ((unsigned char*)output)[i] = (unsigned char) ((long*)input)[i]; } } return( *status ); case TFLOAT: fffr4i1((float*)input,ntodo,1.,0.,0,0,NULL,NULL, (unsigned char*)output,status); break; case TDOUBLE: fffr8i1((double*)input,ntodo,1.,0.,0,0,NULL,NULL, (unsigned char*)output,status); break; default: *status = BAD_DATATYPE; break; } for(i=0;i SHRT_MAX ) { *status = OVERFLOW_ERR; ((short*)output)[i] = SHRT_MAX; } else ((short*)output)[i] = (short) ((long*)input)[i]; } } return( *status ); case TFLOAT: fffr4i2((float*)input,ntodo,1.,0.,0,0,NULL,NULL, (short*)output,status); break; case TDOUBLE: fffr8i2((double*)input,ntodo,1.,0.,0,0,NULL,NULL, (short*)output,status); break; default: *status = BAD_DATATYPE; break; } for(i=0;i=0 ) { found[parNo] = 1; /* Flag this parameter as found */ switch( gParse.colData[parNo].datatype ) { case TLONG: ffgcvj( fptr, gParse.valCol, row, 1L, 1L, ((long*)gParse.colData[parNo].array)[0], ((long*)gParse.colData[parNo].array)+currelem, &anynul, status ); break; case TDOUBLE: ffgcvd( fptr, gParse.valCol, row, 1L, 1L, ((double*)gParse.colData[parNo].array)[0], ((double*)gParse.colData[parNo].array)+currelem, &anynul, status ); break; case TSTRING: ffgcvs( fptr, gParse.valCol, row, 1L, 1L, ((char**)gParse.colData[parNo].array)[0], ((char**)gParse.colData[parNo].array)+currelem, &anynul, status ); break; } if( *status ) return( *status ); } } if( currelemoperation==CONST_OP ) { if( result->value.data.log ) { *(long*)userPtr = firstrow; return( -1 ); } } else { for( idx=0; idxvalue.data.logptr[idx] && !result->value.undef[idx] ) { *(long*)userPtr = firstrow + idx; return( -1 ); } } } return( gParse.status ); } static int set_image_col_types (fitsfile * fptr, const char * name, int bitpix, DataInfo * varInfo, iteratorCol *colIter) { int istatus; double tscale, tzero; char temp[80]; switch (bitpix) { case BYTE_IMG: case SHORT_IMG: case LONG_IMG: istatus = 0; if (fits_read_key(fptr, TDOUBLE, "BZERO", &tzero, NULL, &istatus)) tzero = 0.0; istatus = 0; if (fits_read_key(fptr, TDOUBLE, "BSCALE", &tscale, NULL, &istatus)) tscale = 1.0; if (tscale == 1.0 && (tzero == 0.0 || tzero == 32768.0 )) { varInfo->type = LONG; colIter->datatype = TLONG; } else { varInfo->type = DOUBLE; colIter->datatype = TDOUBLE; if (DEBUG_PIXFILTER) printf("use DOUBLE for %s with BSCALE=%g/BZERO=%g\n", name, tscale, tzero); } break; case LONGLONG_IMG: case FLOAT_IMG: case DOUBLE_IMG: varInfo->type = DOUBLE; colIter->datatype = TDOUBLE; break; default: sprintf(temp, "set_image_col_types: unrecognized image bitpix [%d]\n", bitpix); ffpmsg(temp); return gParse.status = PARSE_BAD_TYPE; } return 0; } /************************************************************************* Functions used by the evaluator to access FITS data (find_column, find_keywd, allocateCol, load_column) *************************************************************************/ static int find_column( char *colName, void *itslval ) { FFSTYPE *thelval = (FFSTYPE*)itslval; int col_cnt, status; int colnum, typecode, type; long repeat, width; fitsfile *fptr; char temp[80]; double tzero,tscale; int istatus; DataInfo *varInfo; iteratorCol *colIter; if (DEBUG_PIXFILTER) printf("find_column(%s)\n", colName); if( *colName == '#' ) return( find_keywd( colName + 1, itslval ) ); fptr = gParse.def_fptr; status = 0; col_cnt = gParse.nCols; if (gParse.hdutype == IMAGE_HDU) { int i; if (!gParse.pixFilter) { gParse.status = COL_NOT_FOUND; ffpmsg("find_column: IMAGE_HDU but no PixelFilter"); return pERROR; } colnum = -1; for (i = 0; i < gParse.pixFilter->count; ++i) { if (!strcasecmp(colName, gParse.pixFilter->tag[i])) colnum = i; } if (colnum < 0) { sprintf(temp, "find_column: PixelFilter tag %s not found", colName); ffpmsg(temp); gParse.status = COL_NOT_FOUND; return pERROR; } if( allocateCol( col_cnt, &gParse.status ) ) return pERROR; varInfo = gParse.varData + col_cnt; colIter = gParse.colData + col_cnt; fptr = gParse.pixFilter->ifptr[colnum]; fits_get_img_param(fptr, MAXDIMS, &typecode, /* actually bitpix */ &varInfo->naxis, &varInfo->naxes[0], &status); varInfo->nelem = 1; type = COLUMN; if (set_image_col_types(fptr, colName, typecode, varInfo, colIter)) return pERROR; colIter->fptr = fptr; colIter->iotype = InputCol; } else { /* HDU holds a table */ if( gParse.compressed ) colnum = gParse.valCol; else if( fits_get_colnum( fptr, CASEINSEN, colName, &colnum, &status ) ) { if( status == COL_NOT_FOUND ) { type = find_keywd( colName, itslval ); if( type != pERROR ) ffcmsg(); return( type ); } gParse.status = status; return pERROR; } if( fits_get_coltype( fptr, colnum, &typecode, &repeat, &width, &status ) ) { gParse.status = status; return pERROR; } if( allocateCol( col_cnt, &gParse.status ) ) return pERROR; varInfo = gParse.varData + col_cnt; colIter = gParse.colData + col_cnt; fits_iter_set_by_num( colIter, fptr, colnum, 0, InputCol ); } /* Make sure we don't overflow variable name array */ strncpy(varInfo->name,colName,MAXVARNAME); varInfo->name[MAXVARNAME] = '\0'; if (gParse.hdutype != IMAGE_HDU) { switch( typecode ) { case TBIT: varInfo->type = BITSTR; colIter->datatype = TBYTE; type = BITCOL; break; case TBYTE: case TSHORT: case TLONG: /* The datatype of column with TZERO and TSCALE keywords might be float or double. */ sprintf(temp,"TZERO%d",colnum); istatus = 0; if(fits_read_key(fptr,TDOUBLE,temp,&tzero,NULL,&istatus)) { tzero = 0.0; } sprintf(temp,"TSCAL%d",colnum); istatus = 0; if(fits_read_key(fptr,TDOUBLE,temp,&tscale,NULL,&istatus)) { tscale = 1.0; } if (tscale == 1.0 && (tzero == 0.0 || tzero == 32768.0 )) { varInfo->type = LONG; colIter->datatype = TLONG; /* Reading an unsigned long column as a long can cause overflow errors. Treat the column as a double instead. } else if (tscale == 1.0 && tzero == 2147483648.0 ) { varInfo->type = LONG; colIter->datatype = TULONG; */ } else { varInfo->type = DOUBLE; colIter->datatype = TDOUBLE; } type = COLUMN; break; /* For now, treat 8-byte integer columns as type double. This can lose precision, so the better long term solution will be to add support for TLONGLONG as a separate datatype. */ case TLONGLONG: case TFLOAT: case TDOUBLE: varInfo->type = DOUBLE; colIter->datatype = TDOUBLE; type = COLUMN; break; case TLOGICAL: varInfo->type = BOOLEAN; colIter->datatype = TLOGICAL; type = BCOLUMN; break; case TSTRING: varInfo->type = STRING; colIter->datatype = TSTRING; type = SCOLUMN; if ( width >= MAX_STRLEN ) { sprintf(temp, "column %d is wider than maximum %d characters", colnum, MAX_STRLEN-1); ffpmsg(temp); gParse.status = PARSE_LRG_VECTOR; return pERROR; } if( gParse.hdutype == ASCII_TBL ) repeat = width; break; default: if (typecode < 0) { sprintf(temp, "variable-length array columns are not supported. typecode = %d", typecode); ffpmsg(temp); } gParse.status = PARSE_BAD_TYPE; return pERROR; } varInfo->nelem = repeat; if( repeat>1 && typecode!=TSTRING ) { if( fits_read_tdim( fptr, colnum, MAXDIMS, &varInfo->naxis, &varInfo->naxes[0], &status ) ) { gParse.status = status; return pERROR; } } else { varInfo->naxis = 1; varInfo->naxes[0] = 1; } } gParse.nCols++; thelval->lng = col_cnt; return( type ); } static int find_keywd(char *keyname, void *itslval ) { FFSTYPE *thelval = (FFSTYPE*)itslval; int status, type; char keyvalue[FLEN_VALUE], dtype; fitsfile *fptr; double rval; int bval; long ival; status = 0; fptr = gParse.def_fptr; if( fits_read_keyword( fptr, keyname, keyvalue, NULL, &status ) ) { if( status == KEY_NO_EXIST ) { /* Do this since ffgkey doesn't put an error message on stack */ sprintf(keyvalue, "ffgkey could not find keyword: %s",keyname); ffpmsg(keyvalue); } gParse.status = status; return( pERROR ); } if( fits_get_keytype( keyvalue, &dtype, &status ) ) { gParse.status = status; return( pERROR ); } switch( dtype ) { case 'C': fits_read_key_str( fptr, keyname, keyvalue, NULL, &status ); type = STRING; strcpy( thelval->str , keyvalue ); break; case 'L': fits_read_key_log( fptr, keyname, &bval, NULL, &status ); type = BOOLEAN; thelval->log = bval; break; case 'I': fits_read_key_lng( fptr, keyname, &ival, NULL, &status ); type = LONG; thelval->lng = ival; break; case 'F': fits_read_key_dbl( fptr, keyname, &rval, NULL, &status ); type = DOUBLE; thelval->dbl = rval; break; default: type = pERROR; break; } if( status ) { gParse.status=status; return pERROR; } return( type ); } static int allocateCol( int nCol, int *status ) { if( (nCol%25)==0 ) { if( nCol ) { gParse.colData = (iteratorCol*) realloc( gParse.colData, (nCol+25)*sizeof(iteratorCol) ); gParse.varData = (DataInfo *) realloc( gParse.varData, (nCol+25)*sizeof(DataInfo) ); } else { gParse.colData = (iteratorCol*) malloc( 25*sizeof(iteratorCol) ); gParse.varData = (DataInfo *) malloc( 25*sizeof(DataInfo) ); } if( gParse.colData == NULL || gParse.varData == NULL ) { if( gParse.colData ) free(gParse.colData); if( gParse.varData ) free(gParse.varData); gParse.colData = NULL; gParse.varData = NULL; return( *status = MEMORY_ALLOCATION ); } } gParse.varData[nCol].data = NULL; gParse.varData[nCol].undef = NULL; return 0; } static int load_column( int varNum, long fRow, long nRows, void *data, char *undef ) { iteratorCol *var = gParse.colData+varNum; long nelem,nbytes,row,len,idx; char **bitStrs, msg[80]; unsigned char *bytes; int status = 0, anynul; if (gParse.hdutype == IMAGE_HDU) { /* This test would need to be on a per varNum basis to support * cross HDU operations */ fits_read_imgnull(var->fptr, var->datatype, fRow, nRows, data, undef, &anynul, &status); if (DEBUG_PIXFILTER) printf("load_column: IMAGE_HDU fRow=%ld, nRows=%ld => %d\n", fRow, nRows, status); } else { nelem = nRows * var->repeat; switch( var->datatype ) { case TBYTE: nbytes = ((var->repeat+7)/8) * nRows; bytes = (unsigned char *)malloc( nbytes * sizeof(char) ); ffgcvb(var->fptr, var->colnum, fRow, 1L, nbytes, 0, bytes, &anynul, &status); nelem = var->repeat; bitStrs = (char **)data; for( row=0; rowfptr, var->colnum, fRow, 1L, nRows, (char **)data, undef, &anynul, &status); break; case TLOGICAL: ffgcfl(var->fptr, var->colnum, fRow, 1L, nelem, (char *)data, undef, &anynul, &status); break; case TLONG: ffgcfj(var->fptr, var->colnum, fRow, 1L, nelem, (long *)data, undef, &anynul, &status); break; case TDOUBLE: ffgcfd(var->fptr, var->colnum, fRow, 1L, nelem, (double *)data, undef, &anynul, &status); break; default: sprintf(msg,"load_column: unexpected datatype %d", var->datatype); ffpmsg(msg); } } if( status ) { gParse.status = status; return pERROR; } return 0; } /*--------------------------------------------------------------------------*/ int fits_pixel_filter (PixelFilter * filter, int * status) /* Evaluate an expression using the data in the input FITS file(s) */ /*--------------------------------------------------------------------------*/ { parseInfo Info = { 0 }; int naxis, bitpix; long nelem, naxes[MAXDIMS]; int col_cnt; Node *result; int datatype; fitsfile * infptr; fitsfile * outfptr; char * DEFAULT_TAGS[] = { "X" }; char msg[256]; int writeBlankKwd = 0; /* write BLANK if any output nulls? */ DEBUG_PIXFILTER = getenv("DEBUG_PIXFILTER") ? 1 : 0; if (*status) return (*status); FFLOCK; if (!filter->tag || !filter->tag[0] || !filter->tag[0][0]) { filter->tag = DEFAULT_TAGS; if (DEBUG_PIXFILTER) printf("using default tag '%s'\n", filter->tag[0]); } infptr = filter->ifptr[0]; outfptr = filter->ofptr; gParse.pixFilter = filter; if (ffiprs(infptr, 0, filter->expression, MAXDIMS, &Info.datatype, &nelem, &naxis, naxes, status)) { goto CLEANUP; } if (nelem < 0) { nelem = -nelem; } { /* validate result type */ const char * type = 0; switch (Info.datatype) { case TLOGICAL: type = "LOGICAL"; break; case TLONG: type = "LONG"; break; case TDOUBLE: type = "DOUBLE"; break; case TSTRING: type = "STRING"; *status = pERROR; ffpmsg("pixel_filter: cannot have string image"); case TBIT: type = "BIT"; if (DEBUG_PIXFILTER) printf("hmm, image from bits?\n"); break; default: type = "UNKNOWN?!"; *status = pERROR; ffpmsg("pixel_filter: unexpected result datatype"); } if (DEBUG_PIXFILTER) printf("result type is %s [%d]\n", type, Info.datatype); if (*status) goto CLEANUP; } if (fits_get_img_param(infptr, MAXDIMS, &bitpix, &naxis, &naxes[0], status)) { ffpmsg("pixel_filter: unable to read input image parameters"); goto CLEANUP; } if (DEBUG_PIXFILTER) printf("input bitpix %d\n", bitpix); if (Info.datatype == TDOUBLE) { /* for floating point expressions, set the default output image to bitpix = -32 (float) unless the default is already a double */ if (bitpix != DOUBLE_IMG) bitpix = FLOAT_IMG; } /* override output image bitpix if specified by caller */ if (filter->bitpix) bitpix = filter->bitpix; if (DEBUG_PIXFILTER) printf("output bitpix %d\n", bitpix); if (fits_create_img(outfptr, bitpix, naxis, naxes, status)) { ffpmsg("pixel_filter: unable to create output image"); goto CLEANUP; } /* transfer keycards */ { int i, ncards, more; if (fits_get_hdrspace(infptr, &ncards, &more, status)) { ffpmsg("pixel_filter: unable to determine number of keycards"); goto CLEANUP; } for (i = 1; i <= ncards; ++i) { int keyclass; char card[FLEN_CARD]; if (fits_read_record(infptr, i, card, status)) { sprintf(msg, "pixel_filter: unable to read keycard %d", i); ffpmsg(msg); goto CLEANUP; } keyclass = fits_get_keyclass(card); if (keyclass == TYP_STRUC_KEY) { /* output structure defined by fits_create_img */ } else if (keyclass == TYP_COMM_KEY && i < 12) { /* assume this is one of the FITS standard comments */ } else if (keyclass == TYP_NULL_KEY && bitpix < 0) { /* do not transfer BLANK to real output image */ } else if (keyclass == TYP_SCAL_KEY && bitpix < 0) { /* do not transfer BZERO, BSCALE to real output image */ } else if (fits_write_record(outfptr, card, status)) { sprintf(msg, "pixel_filter: unable to write keycard '%s' [%d]\n", card, *status); ffpmsg(msg); goto CLEANUP; } } } switch (bitpix) { case BYTE_IMG: datatype = TLONG; Info.datatype = TBYTE; break; case SHORT_IMG: datatype = TLONG; Info.datatype = TSHORT; break; case LONG_IMG: datatype = TLONG; Info.datatype = TLONG; break; case FLOAT_IMG: datatype = TDOUBLE; Info.datatype = TFLOAT; break; case DOUBLE_IMG: datatype = TDOUBLE; Info.datatype = TDOUBLE; break; default: sprintf(msg, "pixel_filter: unexpected output bitpix %d\n", bitpix); ffpmsg(msg); *status = pERROR; goto CLEANUP; } if (bitpix > 0) { /* arrange for NULLs in output */ long nullVal = filter->blank; if (!filter->blank) { int tstatus = 0; if (fits_read_key_lng(infptr, "BLANK", &nullVal, 0, &tstatus)) { writeBlankKwd = 1; if (bitpix == BYTE_IMG) nullVal = UCHAR_MAX; else if (bitpix == SHORT_IMG) nullVal = SHRT_MIN; else if (bitpix == LONG_IMG) nullVal = LONG_MIN; else printf("unhandled positive output BITPIX %d\n", bitpix); } filter->blank = nullVal; } fits_set_imgnull(outfptr, filter->blank, status); if (DEBUG_PIXFILTER) printf("using blank %ld\n", nullVal); } if (!filter->keyword[0]) { iteratorCol * colIter; DataInfo * varInfo; /*************************************/ /* Create new iterator Output Column */ /*************************************/ col_cnt = gParse.nCols; if (allocateCol(col_cnt, status)) goto CLEANUP; gParse.nCols++; colIter = &gParse.colData[col_cnt]; colIter->fptr = filter->ofptr; colIter->iotype = OutputCol; varInfo = &gParse.varData[col_cnt]; set_image_col_types(colIter->fptr, "CREATED", bitpix, varInfo, colIter); Info.maxRows = -1; if (ffiter(gParse.nCols, gParse.colData, 0, 0, parse_data, &Info, status) == -1) *status = 0; else if (*status) goto CLEANUP; if (Info.anyNull) { if (writeBlankKwd) { fits_update_key_lng(outfptr, "BLANK", filter->blank, "NULL pixel value", status); if (*status) ffpmsg("pixel_filter: unable to write BLANK keyword"); if (DEBUG_PIXFILTER) { printf("output has NULLs\n"); printf("wrote blank [%d]\n", *status); } } } else if (bitpix > 0) /* never used a null */ if (fits_set_imgnull(outfptr, -1234554321, status)) ffpmsg("pixel_filter: unable to reset imgnull"); } else { /* Put constant result into keyword */ char * parName = filter->keyword; char * parInfo = filter->comment; result = gParse.Nodes + gParse.resultNode; switch (Info.datatype) { case TDOUBLE: ffukyd(outfptr, parName, result->value.data.dbl, 15, parInfo, status); break; case TLONG: ffukyj(outfptr, parName, result->value.data.lng, parInfo, status); break; case TLOGICAL: ffukyl(outfptr, parName, result->value.data.log, parInfo, status); break; case TBIT: case TSTRING: ffukys(outfptr, parName, result->value.data.str, parInfo, status); break; default: sprintf(msg, "pixel_filter: unexpected constant result type [%d]\n", Info.datatype); ffpmsg(msg); } } CLEANUP: ffcprs(); FFUNLOCK; return (*status); } astropy-0.3/cextern/cfitsio/group.c0000644000175000017500000052437712243255342015631 0ustar oleole/* This file, group.c, contains the grouping convention suport routines. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ /* */ /* The group.c module of CFITSIO was written by Donald G. Jennings of */ /* the INTEGRAL Science Data Centre (ISDC) under NASA contract task */ /* 66002J6. The above copyright laws apply. Copyright guidelines of The */ /* University of Geneva might also apply. */ /* The following routines are designed to create, read, and manipulate */ /* FITS Grouping Tables as defined in the FITS Grouping Convention paper */ /* by Jennings, Pence, Folk and Schlesinger. The development of the */ /* grouping structure was partially funded under the NASA AISRP Program. */ #include "fitsio2.h" #include "group.h" #include #include #include #if defined(WIN32) || defined(__WIN32__) #include /* defines the getcwd function on Windows PCs */ #endif #if defined(unix) || defined(__unix__) || defined(__unix) #include /* needed for getcwd prototype on unix machines */ #endif #define HEX_ESCAPE '%' /*--------------------------------------------------------------------------- Change record: D. Jennings, 18/06/98, version 1.0 of group module delivered to B. Pence for integration into CFITSIO 2.005 D. Jennings, 17/11/98, fixed bug in ffgtcpr(). Now use fits_find_nextkey() correctly and insert auxiliary keyword records directly before the TTYPE1 keyword in the copied group table. D. Jennings, 22/01/99, ffgmop() now looks for relative file paths when the MEMBER_LOCATION information is given in a grouping table. D. Jennings, 01/02/99, ffgtop() now looks for relatve file paths when the GRPLCn keyword value is supplied in the member HDU header. D. Jennings, 01/02/99, ffgtam() now trys to construct relative file paths from the member's file to the group table's file (and visa versa) when both the member's file and group table file are of access type FILE://. D. Jennings, 05/05/99, removed the ffgtcn() function; made obsolete by fits_get_url(). D. Jennings, 05/05/99, updated entire module to handle partial URLs and absolute URLs more robustly. Host dependent directory paths are now converted to true URLs before being read from/written to grouping tables. D. Jennings, 05/05/99, added the following new functions (note, none of these are directly callable by the application) int fits_path2url() int fits_url2path() int fits_get_cwd() int fits_get_url() int fits_clean_url() int fits_relurl2url() int fits_encode_url() int fits_unencode_url() int fits_is_url_absolute() -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ int ffgtcr(fitsfile *fptr, /* FITS file pointer */ char *grpname, /* name of the grouping table */ int grouptype, /* code specifying the type of grouping table information: GT_ID_ALL_URI 0 ==> defualt (all columns) GT_ID_REF 1 ==> ID by reference GT_ID_POS 2 ==> ID by position GT_ID_ALL 3 ==> ID by ref. and position GT_ID_REF_URI 11 ==> (1) + URI info GT_ID_POS_URI 12 ==> (2) + URI info */ int *status )/* return status code */ /* create a grouping table at the end of the current FITS file. This function makes the last HDU in the file the CHDU, then calls the fits_insert_group() function to actually create the new grouping table. */ { int hdutype; int hdunum; if(*status != 0) return(*status); *status = fits_get_num_hdus(fptr,&hdunum,status); /* If hdunum is 0 then we are at the beginning of the file and we actually haven't closed the first header yet, so don't do anything more */ if (0 != hdunum) { *status = fits_movabs_hdu(fptr,hdunum,&hdutype,status); } /* Now, the whole point of the above two fits_ calls was to get to the end of file. Let's ignore errors at this point and keep going since any error is likely to mean that we are already at the EOF, or the file is fatally corrupted. If we are at the EOF then the next fits_ call will be ok. If it's corrupted then the next call will fail, but that's not big deal at this point. */ if (0 != *status ) *status = 0; *status = fits_insert_group(fptr,grpname,grouptype,status); return(*status); } /*---------------------------------------------------------------------------*/ int ffgtis(fitsfile *fptr, /* FITS file pointer */ char *grpname, /* name of the grouping table */ int grouptype, /* code specifying the type of grouping table information: GT_ID_ALL_URI 0 ==> defualt (all columns) GT_ID_REF 1 ==> ID by reference GT_ID_POS 2 ==> ID by position GT_ID_ALL 3 ==> ID by ref. and position GT_ID_REF_URI 11 ==> (1) + URI info GT_ID_POS_URI 12 ==> (2) + URI info */ int *status) /* return status code */ /* insert a grouping table just after the current HDU of the current FITS file. This is the same as fits_create_group() only it allows the user to select the place within the FITS file to add the grouping table. */ { int tfields = 0; int hdunum = 0; int hdutype = 0; int extver; int i; long pcount = 0; char *ttype[6]; char *tform[6]; char ttypeBuff[102]; char tformBuff[54]; char extname[] = "GROUPING"; char keyword[FLEN_KEYWORD]; char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; do { /* set up the ttype and tform character buffers */ for(i = 0; i < 6; ++i) { ttype[i] = ttypeBuff+(i*17); tform[i] = tformBuff+(i*9); } /* define the columns required according to the grouptype parameter */ *status = ffgtdc(grouptype,0,0,0,0,0,0,ttype,tform,&tfields,status); /* create the grouping table using the columns defined above */ *status = fits_insert_btbl(fptr,0,tfields,ttype,tform,NULL, NULL,pcount,status); if(*status != 0) continue; /* retrieve the hdu position of the new grouping table for future use */ fits_get_hdu_num(fptr,&hdunum); /* add the EXTNAME and EXTVER keywords to the HDU just after the TFIELDS keyword; for now the EXTVER value is set to 0, it will be set to the correct value later on */ fits_read_keyword(fptr,"TFIELDS",keyvalue,comment,status); fits_insert_key_str(fptr,"EXTNAME",extname, "HDU contains a Grouping Table",status); fits_insert_key_lng(fptr,"EXTVER",0,"Grouping Table vers. (this file)", status); /* if the grpname parameter value was defined (Non NULL and non zero length) then add the GRPNAME keyword and value */ if(grpname != NULL && strlen(grpname) > 0) fits_insert_key_str(fptr,"GRPNAME",grpname,"Grouping Table name", status); /* add the TNULL keywords and values for each integer column defined; integer null values are zero (0) for the MEMBER_POSITION and MEMBER_VERSION columns. */ for(i = 0; i < tfields && *status == 0; ++i) { if(strcasecmp(ttype[i],"MEMBER_POSITION") == 0 || strcasecmp(ttype[i],"MEMBER_VERSION") == 0) { sprintf(keyword,"TFORM%d",i+1); *status = fits_read_key_str(fptr,keyword,keyvalue,comment, status); sprintf(keyword,"TNULL%d",i+1); *status = fits_insert_key_lng(fptr,keyword,0,"Column Null Value", status); } } /* determine the correct EXTVER value for the new grouping table by finding the highest numbered grouping table EXTVER value the currently exists */ for(extver = 1; (fits_movnam_hdu(fptr,ANY_HDU,"GROUPING",extver,status)) == 0; ++extver); if(*status == BAD_HDU_NUM) *status = 0; /* move back to the new grouping table HDU and update the EXTVER keyword value */ fits_movabs_hdu(fptr,hdunum,&hdutype,status); fits_modify_key_lng(fptr,"EXTVER",extver,"&",status); }while(0); return(*status); } /*---------------------------------------------------------------------------*/ int ffgtch(fitsfile *gfptr, /* FITS pointer to group */ int grouptype, /* code specifying the type of grouping table information: GT_ID_ALL_URI 0 ==> defualt (all columns) GT_ID_REF 1 ==> ID by reference GT_ID_POS 2 ==> ID by position GT_ID_ALL 3 ==> ID by ref. and position GT_ID_REF_URI 11 ==> (1) + URI info GT_ID_POS_URI 12 ==> (2) + URI info */ int *status) /* return status code */ /* Change the grouping table structure of the grouping table pointed to by gfptr. The grouptype code specifies the new structure of the table. This operation only adds or removes grouping table columns, it does not add or delete group members (i.e., table rows). If the grouping table already has the desired structure then no operations are performed and function simply returns with a (0) success status code. If the requested structure change creates new grouping table columns, then the column values for all existing members will be filled with the appropriate null values. */ { int xtensionCol, extnameCol, extverCol, positionCol, locationCol, uriCol; int ncols = 0; int colnum = 0; int nrows = 0; int grptype = 0; int i,j; long intNull = 0; long tfields = 0; char *tform[6]; char *ttype[6]; unsigned char charNull[1] = {'\0'}; char ttypeBuff[102]; char tformBuff[54]; char keyword[FLEN_KEYWORD]; char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; if(*status != 0) return(*status); do { /* set up the ttype and tform character buffers */ for(i = 0; i < 6; ++i) { ttype[i] = ttypeBuff+(i*17); tform[i] = tformBuff+(i*9); } /* retrieve positions of all Grouping table reserved columns */ *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol, &locationCol,&uriCol,&grptype,status); if(*status != 0) continue; /* determine the total number of grouping table columns */ *status = fits_read_key_lng(gfptr,"TFIELDS",&tfields,comment,status); /* define grouping table columns to be added to the configuration */ *status = ffgtdc(grouptype,xtensionCol,extnameCol,extverCol,positionCol, locationCol,uriCol,ttype,tform,&ncols,status); /* delete any grouping tables columns that exist but do not belong to new desired configuration; note that we delete before creating new columns for (file size) efficiency reasons */ switch(grouptype) { case GT_ID_ALL_URI: /* no columns to be deleted in this case */ break; case GT_ID_REF: if(positionCol != 0) { *status = fits_delete_col(gfptr,positionCol,status); --tfields; if(uriCol > positionCol) --uriCol; if(locationCol > positionCol) --locationCol; } if(uriCol != 0) { *status = fits_delete_col(gfptr,uriCol,status); --tfields; if(locationCol > uriCol) --locationCol; } if(locationCol != 0) *status = fits_delete_col(gfptr,locationCol,status); break; case GT_ID_POS: if(xtensionCol != 0) { *status = fits_delete_col(gfptr,xtensionCol,status); --tfields; if(extnameCol > xtensionCol) --extnameCol; if(extverCol > xtensionCol) --extverCol; if(uriCol > xtensionCol) --uriCol; if(locationCol > xtensionCol) --locationCol; } if(extnameCol != 0) { *status = fits_delete_col(gfptr,extnameCol,status); --tfields; if(extverCol > extnameCol) --extverCol; if(uriCol > extnameCol) --uriCol; if(locationCol > extnameCol) --locationCol; } if(extverCol != 0) { *status = fits_delete_col(gfptr,extverCol,status); --tfields; if(uriCol > extverCol) --uriCol; if(locationCol > extverCol) --locationCol; } if(uriCol != 0) { *status = fits_delete_col(gfptr,uriCol,status); --tfields; if(locationCol > uriCol) --locationCol; } if(locationCol != 0) { *status = fits_delete_col(gfptr,locationCol,status); --tfields; } break; case GT_ID_ALL: if(uriCol != 0) { *status = fits_delete_col(gfptr,uriCol,status); --tfields; if(locationCol > uriCol) --locationCol; } if(locationCol != 0) { *status = fits_delete_col(gfptr,locationCol,status); --tfields; } break; case GT_ID_REF_URI: if(positionCol != 0) { *status = fits_delete_col(gfptr,positionCol,status); --tfields; } break; case GT_ID_POS_URI: if(xtensionCol != 0) { *status = fits_delete_col(gfptr,xtensionCol,status); --tfields; if(extnameCol > xtensionCol) --extnameCol; if(extverCol > xtensionCol) --extverCol; } if(extnameCol != 0) { *status = fits_delete_col(gfptr,extnameCol,status); --tfields; if(extverCol > extnameCol) --extverCol; } if(extverCol != 0) { *status = fits_delete_col(gfptr,extverCol,status); --tfields; } break; default: *status = BAD_OPTION; ffpmsg("Invalid value for grouptype parameter specified (ffgtch)"); break; } /* add all the new grouping table columns that were not there previously but are called for by the grouptype parameter */ for(i = 0; i < ncols && *status == 0; ++i) *status = fits_insert_col(gfptr,tfields+i+1,ttype[i],tform[i],status); /* add the TNULL keywords and values for each new integer column defined; integer null values are zero (0) for the MEMBER_POSITION and MEMBER_VERSION columns. Insert a null ("/0") into each new string column defined: MEMBER_XTENSION, MEMBER_NAME, MEMBER_URI_TYPE and MEMBER_LOCATION. Note that by convention a null string is the TNULL value for character fields so no TNULL is required. */ for(i = 0; i < ncols && *status == 0; ++i) { if(strcasecmp(ttype[i],"MEMBER_POSITION") == 0 || strcasecmp(ttype[i],"MEMBER_VERSION") == 0) { /* col contains int data; set TNULL and insert 0 for each col */ *status = fits_get_colnum(gfptr,CASESEN,ttype[i],&colnum, status); sprintf(keyword,"TFORM%d",colnum); *status = fits_read_key_str(gfptr,keyword,keyvalue,comment, status); sprintf(keyword,"TNULL%d",colnum); *status = fits_insert_key_lng(gfptr,keyword,0, "Column Null Value",status); for(j = 1; j <= nrows && *status == 0; ++j) *status = fits_write_col_lng(gfptr,colnum,j,1,1,&intNull, status); } else if(strcasecmp(ttype[i],"MEMBER_XTENSION") == 0 || strcasecmp(ttype[i],"MEMBER_NAME") == 0 || strcasecmp(ttype[i],"MEMBER_URI_TYPE") == 0 || strcasecmp(ttype[i],"MEMBER_LOCATION") == 0) { /* new col contains character data; insert NULLs into each col */ *status = fits_get_colnum(gfptr,CASESEN,ttype[i],&colnum, status); for(j = 1; j <= nrows && *status == 0; ++j) /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/ *status = fits_write_col_byt(gfptr,colnum,j,1,1,charNull, status); } } }while(0); return(*status); } /*---------------------------------------------------------------------------*/ int ffgtrm(fitsfile *gfptr, /* FITS file pointer to group */ int rmopt, /* code specifying if member elements are to be deleted: OPT_RM_GPT ==> remove only group table OPT_RM_ALL ==> recursively remove members and their members (if groups) */ int *status) /* return status code */ /* remove a grouping table, and optionally all its members. Any groups containing the grouping table are updated, and all members (if not deleted) have their GRPIDn and GRPLCn keywords updated accordingly. If the (deleted) members are members of another grouping table then those tables are also updated. The CHDU of the FITS file pointed to by gfptr must be positioned to the grouping table to be deleted. */ { int hdutype; long i; long nmembers = 0; HDUtracker HDU; if(*status != 0) return(*status); /* remove the grouping table depending upon the rmopt parameter */ switch(rmopt) { case OPT_RM_GPT: /* for this option, the grouping table is deleted, but the member HDUs remain; in this case we only have to remove each member from the grouping table by calling fits_remove_member() with the OPT_RM_ENTRY option */ /* get the number of members contained by this table */ *status = fits_get_num_members(gfptr,&nmembers,status); /* loop over all grouping table members and remove them */ for(i = nmembers; i > 0 && *status == 0; --i) *status = fits_remove_member(gfptr,i,OPT_RM_ENTRY,status); break; case OPT_RM_ALL: /* for this option the entire Group is deleted -- this includes all members and their members (if grouping tables themselves). Call the recursive form of this function to perform the removal. */ /* add the current grouping table to the HDUtracker struct */ HDU.nHDU = 0; *status = fftsad(gfptr,&HDU,NULL,NULL); /* call the recursive group remove function */ *status = ffgtrmr(gfptr,&HDU,status); /* free the memory allocated to the HDUtracker struct */ for(i = 0; i < HDU.nHDU; ++i) { free(HDU.filename[i]); free(HDU.newFilename[i]); } break; default: *status = BAD_OPTION; ffpmsg("Invalid value for the rmopt parameter specified (ffgtrm)"); break; } /* if all went well then unlink and delete the grouping table HDU */ *status = ffgmul(gfptr,0,status); *status = fits_delete_hdu(gfptr,&hdutype,status); return(*status); } /*---------------------------------------------------------------------------*/ int ffgtcp(fitsfile *infptr, /* input FITS file pointer */ fitsfile *outfptr, /* output FITS file pointer */ int cpopt, /* code specifying copy options: OPT_GCP_GPT (0) ==> copy only grouping table OPT_GCP_ALL (2) ==> recusrively copy members and their members (if groups) */ int *status) /* return status code */ /* copy a grouping table, and optionally all its members, to a new FITS file. If the cpopt is set to OPT_GCP_GPT (copy grouping table only) then the existing members have their GRPIDn and GRPLCn keywords updated to reflect the existance of the new group, since they now belong to another group. If cpopt is set to OPT_GCP_ALL (copy grouping table and members recursively) then the original members are not updated; the new grouping table is modified to include only the copied member HDUs and not the original members. Note that the recursive version of this function, ffgtcpr(), is called to perform the group table copy. In the case of cpopt == OPT_GCP_GPT ffgtcpr() does not actually use recursion. */ { int i; HDUtracker HDU; if(*status != 0) return(*status); /* make sure infptr and outfptr are not the same pointer */ if(infptr == outfptr) *status = IDENTICAL_POINTERS; else { /* initialize the HDUtracker struct */ HDU.nHDU = 0; *status = fftsad(infptr,&HDU,NULL,NULL); /* call the recursive form of this function to copy the grouping table. If the cpopt is OPT_GCP_GPT then there is actually no recursion performed */ *status = ffgtcpr(infptr,outfptr,cpopt,&HDU,status); /* free memory allocated for the HDUtracker struct */ for(i = 0; i < HDU.nHDU; ++i) { free(HDU.filename[i]); free(HDU.newFilename[i]); } } return(*status); } /*---------------------------------------------------------------------------*/ int ffgtmg(fitsfile *infptr, /* FITS file ptr to source grouping table */ fitsfile *outfptr, /* FITS file ptr to target grouping table */ int mgopt, /* code specifying merge options: OPT_MRG_COPY (0) ==> copy members to target group, leaving source group in place OPT_MRG_MOV (1) ==> move members to target group, source group is deleted after merge */ int *status) /* return status code */ /* merge two grouping tables by combining their members into a single table. The source grouping table must be the CHDU of the fitsfile pointed to by infptr, and the target grouping table must be the CHDU of the fitsfile to by outfptr. All members of the source grouping table shall be copied to the target grouping table. If the mgopt parameter is OPT_MRG_COPY then the source grouping table continues to exist after the merge. If the mgopt parameter is OPT_MRG_MOV then the source grouping table is deleted after the merge, and all member HDUs are updated accordingly. */ { long i ; long nmembers = 0; fitsfile *tmpfptr = NULL; if(*status != 0) return(*status); do { *status = fits_get_num_members(infptr,&nmembers,status); for(i = 1; i <= nmembers && *status == 0; ++i) { *status = fits_open_member(infptr,i,&tmpfptr,status); *status = fits_add_group_member(outfptr,tmpfptr,0,status); if(*status == HDU_ALREADY_MEMBER) *status = 0; if(tmpfptr != NULL) { fits_close_file(tmpfptr,status); tmpfptr = NULL; } } if(*status != 0) continue; if(mgopt == OPT_MRG_MOV) *status = fits_remove_group(infptr,OPT_RM_GPT,status); }while(0); if(tmpfptr != NULL) { fits_close_file(tmpfptr,status); } return(*status); } /*---------------------------------------------------------------------------*/ int ffgtcm(fitsfile *gfptr, /* FITS file pointer to grouping table */ int cmopt, /* code specifying compact options OPT_CMT_MBR (1) ==> compact only direct members (if groups) OPT_CMT_MBR_DEL (11) ==> (1) + delete all compacted groups */ int *status) /* return status code */ /* "Compact" a group pointed to by the FITS file pointer gfptr. This is achieved by flattening the tree structure of a group and its (grouping table) members. All members HDUs of a grouping table which is itself a member of the grouping table gfptr are added to gfptr. Optionally, the grouping tables which are "compacted" are deleted. If the grouping table contains no members that are themselves grouping tables then this function performs a NOOP. */ { long i; long nmembers = 0; char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; fitsfile *mfptr = NULL; if(*status != 0) return(*status); do { if(cmopt != OPT_CMT_MBR && cmopt != OPT_CMT_MBR_DEL) { *status = BAD_OPTION; ffpmsg("Invalid value for cmopt parameter specified (ffgtcm)"); continue; } /* reteive the number of grouping table members */ *status = fits_get_num_members(gfptr,&nmembers,status); /* loop over all the grouping table members; if the member is a grouping table then merge its members with the parent grouping table */ for(i = 1; i <= nmembers && *status == 0; ++i) { *status = fits_open_member(gfptr,i,&mfptr,status); if(*status != 0) continue; *status = fits_read_key_str(mfptr,"EXTNAME",keyvalue,comment,status); /* if no EXTNAME keyword then cannot be a grouping table */ if(*status == KEY_NO_EXIST) { *status = 0; continue; } prepare_keyvalue(keyvalue); if(*status != 0) continue; /* if EXTNAME == "GROUPING" then process member as grouping table */ if(strcasecmp(keyvalue,"GROUPING") == 0) { /* merge the member (grouping table) into the grouping table */ *status = fits_merge_groups(mfptr,gfptr,OPT_MRG_COPY,status); *status = fits_close_file(mfptr,status); mfptr = NULL; /* remove the member from the grouping table now that all of its members have been transferred; if cmopt is set to OPT_CMT_MBR_DEL then remove and delete the member */ if(cmopt == OPT_CMT_MBR) *status = fits_remove_member(gfptr,i,OPT_RM_ENTRY,status); else *status = fits_remove_member(gfptr,i,OPT_RM_MBR,status); } else { /* not a grouping table; just close the opened member */ *status = fits_close_file(mfptr,status); mfptr = NULL; } } }while(0); return(*status); } /*--------------------------------------------------------------------------*/ int ffgtvf(fitsfile *gfptr, /* FITS file pointer to group */ long *firstfailed, /* Member ID (if positive) of first failed member HDU verify check or GRPID index (if negitive) of first failed group link verify check. */ int *status) /* return status code */ /* check the integrity of a grouping table to make sure that all group members are accessible and all the links to other grouping tables are valid. The firstfailed parameter returns the member ID of the first member HDU to fail verification if positive or the first group link to fail if negative; otherwise firstfailed contains a return value of 0. */ { long i; long nmembers = 0; long ngroups = 0; char errstr[FLEN_VALUE]; fitsfile *fptr = NULL; if(*status != 0) return(*status); *firstfailed = 0; do { /* attempt to open all the members of the grouping table. We stop at the first member which cannot be opened (which implies that it cannot be located) */ *status = fits_get_num_members(gfptr,&nmembers,status); for(i = 1; i <= nmembers && *status == 0; ++i) { *status = fits_open_member(gfptr,i,&fptr,status); fits_close_file(fptr,status); } /* if the status is non-zero from the above loop then record the member index that caused the error */ if(*status != 0) { *firstfailed = i; sprintf(errstr,"Group table verify failed for member %ld (ffgtvf)", i); ffpmsg(errstr); continue; } /* attempt to open all the groups linked to this grouping table. We stop at the first group which cannot be opened (which implies that it cannot be located) */ *status = fits_get_num_groups(gfptr,&ngroups,status); for(i = 1; i <= ngroups && *status == 0; ++i) { *status = fits_open_group(gfptr,i,&fptr,status); fits_close_file(fptr,status); } /* if the status from the above loop is non-zero, then record the GRPIDn index of the group that caused the failure */ if(*status != 0) { *firstfailed = -1*i; sprintf(errstr, "Group table verify failed for GRPID index %ld (ffgtvf)",i); ffpmsg(errstr); continue; } }while(0); return(*status); } /*---------------------------------------------------------------------------*/ int ffgtop(fitsfile *mfptr, /* FITS file pointer to the member HDU */ int grpid, /* group ID (GRPIDn index) within member HDU */ fitsfile **gfptr, /* FITS file pointer to grouping table HDU */ int *status) /* return status code */ /* open the grouping table that contains the member HDU. The member HDU must be the CHDU of the FITS file pointed to by mfptr, and the grouping table is identified by the Nth index number of the GRPIDn keywords specified in the member HDU's header. The fitsfile gfptr pointer is positioned with the appropriate FITS file with the grouping table as the CHDU. If the group grouping table resides in a file other than the member then an attempt is first made to open the file readwrite, and failing that readonly. Note that it is possible for the GRPIDn/GRPLCn keywords in a member header to be non-continuous, e.g., GRPID1, GRPID2, GRPID5, GRPID6. In such cases, the grpid index value specified in the function call shall identify the (grpid)th GRPID value. In the above example, if grpid == 3, then the group specified by GRPID5 would be opened. */ { int i; int found; long ngroups = 0; long grpExtver = 0; char keyword[FLEN_KEYWORD]; char keyvalue[FLEN_FILENAME]; char *tkeyvalue; char location[FLEN_FILENAME]; char location1[FLEN_FILENAME]; char location2[FLEN_FILENAME]; char comment[FLEN_COMMENT]; char *url[2]; if(*status != 0) return(*status); do { /* set the grouping table pointer to NULL for error checking later */ *gfptr = NULL; /* make sure that the group ID requested is valid ==> cannot be larger than the number of GRPIDn keywords in the member HDU header */ *status = fits_get_num_groups(mfptr,&ngroups,status); if(grpid > ngroups) { *status = BAD_GROUP_ID; sprintf(comment, "GRPID index %d larger total GRPID keywords %ld (ffgtop)", grpid,ngroups); ffpmsg(comment); continue; } /* find the (grpid)th group that the member HDU belongs to and read the value of the GRPID(grpid) keyword; fits_get_num_groups() automatically re-enumerates the GRPIDn/GRPLCn keywords to fill in any gaps */ sprintf(keyword,"GRPID%d",grpid); *status = fits_read_key_lng(mfptr,keyword,&grpExtver,comment,status); if(*status != 0) continue; /* if the value of the GRPIDn keyword is positive then the member is in the same FITS file as the grouping table and we only have to reopen the current FITS file. Else the member and grouping table HDUs reside in different files and another FITS file must be opened as specified by the corresponding GRPLCn keyword The DO WHILE loop only executes once and is used to control the file opening logic. */ do { if(grpExtver > 0) { /* the member resides in the same file as the grouping table, so just reopen the grouping table file */ *status = fits_reopen_file(mfptr,gfptr,status); continue; } else if(grpExtver == 0) { /* a GRPIDn value of zero (0) is undefined */ *status = BAD_GROUP_ID; sprintf(comment,"Invalid value of %ld for GRPID%d (ffgtop)", grpExtver,grpid); ffpmsg(comment); continue; } /* The GRPLCn keyword value is negative, which implies that the grouping table must reside in another FITS file; search for the corresponding GRPLCn keyword */ /* set the grpExtver value positive */ grpExtver = -1*grpExtver; /* read the GRPLCn keyword value */ sprintf(keyword,"GRPLC%d",grpid); /* SPR 1738 */ *status = fits_read_key_longstr(mfptr,keyword,&tkeyvalue,comment, status); if (0 == *status) { strcpy(keyvalue,tkeyvalue); free(tkeyvalue); } /* if the GRPLCn keyword was not found then there is a problem */ if(*status == KEY_NO_EXIST) { *status = BAD_GROUP_ID; sprintf(comment,"Cannot find GRPLC%d keyword (ffgtop)", grpid); ffpmsg(comment); continue; } prepare_keyvalue(keyvalue); /* if the GRPLCn keyword value specifies an absolute URL then try to open the file; we cannot attempt any relative URL or host-dependent file path reconstruction */ if(fits_is_url_absolute(keyvalue)) { ffpmsg("Try to open group table file as absolute URL (ffgtop)"); *status = fits_open_file(gfptr,keyvalue,READWRITE,status); /* if the open was successful then continue */ if(*status == 0) continue; /* if READWRITE failed then try opening it READONLY */ ffpmsg("OK, try open group table file as READONLY (ffgtop)"); *status = 0; *status = fits_open_file(gfptr,keyvalue,READONLY,status); /* continue regardless of the outcome */ continue; } /* see if the URL gives a file path that is absolute on the host machine */ *status = fits_url2path(keyvalue,location1,status); *status = fits_open_file(gfptr,location1,READWRITE,status); /* if the file opened then continue */ if(*status == 0) continue; /* if READWRITE failed then try opening it READONLY */ ffpmsg("OK, try open group table file as READONLY (ffgtop)"); *status = 0; *status = fits_open_file(gfptr,location1,READONLY,status); /* if the file opened then continue */ if(*status == 0) continue; /* the grouping table location given by GRPLCn must specify a relative URL. We assume that this URL is relative to the member HDU's FITS file. Try to construct a full URL location for the grouping table's FITS file and then open it */ *status = 0; /* retrieve the URL information for the member HDU's file */ url[0] = location1; url[1] = location2; *status = fits_get_url(mfptr,url[0],url[1],NULL,NULL,NULL,status); /* It is possible that the member HDU file has an initial URL it was opened with and a real URL that the file actually exists at (e.g., an HTTP accessed file copied to a local file). For each possible URL try to construct a */ for(i = 0, found = 0, *gfptr = NULL; i < 2 && !found; ++i) { /* the url string could be empty */ if(*url[i] == 0) continue; /* create a full URL from the partial and the member HDU file URL */ *status = fits_relurl2url(url[i],keyvalue,location,status); /* if an error occured then contniue */ if(*status != 0) { *status = 0; continue; } /* if the location does not specify an access method then turn it into a host dependent path */ if(! fits_is_url_absolute(location)) { *status = fits_url2path(location,url[i],status); strcpy(location,url[i]); } /* try to open the grouping table file READWRITE */ *status = fits_open_file(gfptr,location,READWRITE,status); if(*status != 0) { /* try to open the grouping table file READONLY */ ffpmsg("opening file as READWRITE failed (ffgtop)"); ffpmsg("OK, try to open file as READONLY (ffgtop)"); *status = 0; *status = fits_open_file(gfptr,location,READONLY,status); } /* either set the found flag or reset the status flag */ if(*status == 0) found = 1; else *status = 0; } }while(0); /* end of file opening loop */ /* if an error occured with the file opening then exit */ if(*status != 0) continue; if(*gfptr == NULL) { ffpmsg("Cannot open or find grouping table FITS file (ffgtop)"); *status = GROUP_NOT_FOUND; continue; } /* search for the grouping table in its FITS file */ *status = fits_movnam_hdu(*gfptr,ANY_HDU,"GROUPING",(int)grpExtver, status); if(*status != 0) *status = GROUP_NOT_FOUND; }while(0); if(*status != 0 && *gfptr != NULL) { fits_close_file(*gfptr,status); *gfptr = NULL; } return(*status); } /*---------------------------------------------------------------------------*/ int ffgtam(fitsfile *gfptr, /* FITS file pointer to grouping table HDU */ fitsfile *mfptr, /* FITS file pointer to member HDU */ int hdupos, /* member HDU position IF in the same file as the grouping table AND mfptr == NULL */ int *status) /* return status code */ /* add a member HDU to an existing grouping table. The fitsfile pointer gfptr must be positioned with the grouping table as the CHDU. The member HDU may either be identifed with the fitsfile *mfptr (which must be positioned to the member HDU) or the hdupos parameter (the HDU number of the member HDU) if both reside in the same FITS file. The hdupos value is only used if the mfptr parameter has a value of NULL (0). The new member HDU shall have the appropriate GRPIDn and GRPLCn keywords created in its header. Note that if the member HDU to be added to the grouping table is already a member of the group then it will not be added a sceond time. */ { int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol; int memberPosition = 0; int grptype = 0; int hdutype = 0; int useLocation = 0; int nkeys = 6; int found; int i; int memberIOstate; int groupIOstate; int iomode; long memberExtver = 0; long groupExtver = 0; long memberID = 0; long nmembers = 0; long ngroups = 0; long grpid = 0; char memberAccess1[FLEN_VALUE]; char memberAccess2[FLEN_VALUE]; char memberFileName[FLEN_FILENAME]; char memberLocation[FLEN_FILENAME]; char grplc[FLEN_FILENAME]; char *tgrplc; char memberHDUtype[FLEN_VALUE]; char memberExtname[FLEN_VALUE]; char memberURI[] = "URL"; char groupAccess1[FLEN_VALUE]; char groupAccess2[FLEN_VALUE]; char groupFileName[FLEN_FILENAME]; char groupLocation[FLEN_FILENAME]; char tmprootname[FLEN_FILENAME], grootname[FLEN_FILENAME]; char cwd[FLEN_FILENAME]; char *keys[] = {"GRPNAME","EXTVER","EXTNAME","TFIELDS","GCOUNT","EXTEND"}; char *tmpPtr[1]; char keyword[FLEN_KEYWORD]; char card[FLEN_CARD]; unsigned char charNull[] = {'\0'}; fitsfile *tmpfptr = NULL; int parentStatus = 0; if(*status != 0) return(*status); do { /* make sure the grouping table can be modified before proceeding */ fits_file_mode(gfptr,&iomode,status); if(iomode != READWRITE) { ffpmsg("cannot modify grouping table (ffgtam)"); *status = BAD_GROUP_ATTACH; continue; } /* if the calling function supplied the HDU position of the member HDU instead of fitsfile pointer then get a fitsfile pointer */ if(mfptr == NULL) { *status = fits_reopen_file(gfptr,&tmpfptr,status); *status = fits_movabs_hdu(tmpfptr,hdupos,&hdutype,status); if(*status != 0) continue; } else tmpfptr = mfptr; /* determine all the information about the member HDU that will be needed later; note that we establish the default values for all information values that are not explicitly found */ *status = fits_read_key_str(tmpfptr,"XTENSION",memberHDUtype,card, status); if(*status == KEY_NO_EXIST) { strcpy(memberHDUtype,"PRIMARY"); *status = 0; } prepare_keyvalue(memberHDUtype); *status = fits_read_key_lng(tmpfptr,"EXTVER",&memberExtver,card,status); if(*status == KEY_NO_EXIST) { memberExtver = 1; *status = 0; } *status = fits_read_key_str(tmpfptr,"EXTNAME",memberExtname,card, status); if(*status == KEY_NO_EXIST) { memberExtname[0] = 0; *status = 0; } prepare_keyvalue(memberExtname); fits_get_hdu_num(tmpfptr,&memberPosition); /* Determine if the member HDU's FITS file location needs to be taken into account when building its grouping table reference If the member location needs to be used (==> grouping table and member HDU reside in different files) then create an appropriate URL for the member HDU's file and grouping table's file. Note that the logic for this is rather complicated */ /* SPR 3463, don't do this if(tmpfptr->Fptr == gfptr->Fptr) { */ /* member HDU and grouping table reside in the same file, no need to use the location information */ /* printf ("same file\n"); useLocation = 0; memberIOstate = 1; *memberFileName = 0; } else { */ /* the member HDU and grouping table FITS file location information must be used. First determine the correct driver and file name for the group table and member HDU files. If either are disk files then construct an absolute file path for them. Finally, if both are disk files construct relative file paths from the group(member) file to the member(group) file. */ /* set the USELOCATION flag to true */ useLocation = 1; /* get the location, access type and iostate (RO, RW) of the member HDU file */ *status = fits_get_url(tmpfptr,memberFileName,memberLocation, memberAccess1,memberAccess2,&memberIOstate, status); /* if the memberFileName string is empty then use the values of the memberLocation string. This corresponds to a file where the "real" file is a temporary memory file, and we must assume the the application really wants the original file to be the group member */ if(strlen(memberFileName) == 0) { strcpy(memberFileName,memberLocation); strcpy(memberAccess1,memberAccess2); } /* get the location, access type and iostate (RO, RW) of the grouping table file */ *status = fits_get_url(gfptr,groupFileName,groupLocation, groupAccess1,groupAccess2,&groupIOstate, status); if(*status != 0) continue; /* the grouping table file must be writable to continue */ if(groupIOstate == 0) { ffpmsg("cannot modify grouping table (ffgtam)"); *status = BAD_GROUP_ATTACH; continue; } /* determine how to construct the resulting URLs for the member and group files */ if(strcasecmp(groupAccess1,"file://") && strcasecmp(memberAccess1,"file://")) { *cwd = 0; /* nothing to do in this case; both the member and group files must be of an access type that already gives valid URLs; i.e., URLs that we can pass directly to the file drivers */ } else { /* retrieve the Current Working Directory as a Unix-like URL standard string */ *status = fits_get_cwd(cwd,status); /* create full file path for the member HDU FITS file URL if it is of access type file:// */ if(strcasecmp(memberAccess1,"file://") == 0) { if(*memberFileName == '/') { strcpy(memberLocation,memberFileName); } else { strcpy(memberLocation,cwd); strcat(memberLocation,"/"); strcat(memberLocation,memberFileName); } *status = fits_clean_url(memberLocation,memberFileName, status); } /* create full file path for the grouping table HDU FITS file URL if it is of access type file:// */ if(strcasecmp(groupAccess1,"file://") == 0) { if(*groupFileName == '/') { strcpy(groupLocation,groupFileName); } else { strcpy(groupLocation,cwd); strcat(groupLocation,"/"); strcat(groupLocation,groupFileName); } *status = fits_clean_url(groupLocation,groupFileName,status); } /* if both the member and group files are disk files then create a relative path (relative URL) strings with respect to the grouping table's file and the grouping table's file with respect to the member HDU's file */ if(strcasecmp(groupAccess1,"file://") == 0 && strcasecmp(memberAccess1,"file://") == 0) { fits_url2relurl(memberFileName,groupFileName, groupLocation,status); fits_url2relurl(groupFileName,memberFileName, memberLocation,status); /* copy the resulting partial URL strings to the memberFileName and groupFileName variables for latter use in the function */ strcpy(memberFileName,memberLocation); strcpy(groupFileName,groupLocation); } } /* beo done */ /* } */ /* retrieve the grouping table's EXTVER value */ *status = fits_read_key_lng(gfptr,"EXTVER",&groupExtver,card,status); /* if useLocation is true then make the group EXTVER value negative for the subsequent GRPIDn/GRPLCn matching */ /* SPR 3463 change test; WDP added test for same filename */ /* Now, if either the Fptr values are the same, or the root filenames are the same, then assume these refer to the same file. */ fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status); fits_parse_rootname(gfptr->Fptr->filename, grootname, status); if((tmpfptr->Fptr != gfptr->Fptr) && strncmp(tmprootname, grootname, FLEN_FILENAME)) groupExtver = -1*groupExtver; /* retrieve the number of group members */ *status = fits_get_num_members(gfptr,&nmembers,status); do { /* make sure the member HDU is not already an entry in the grouping table before adding it */ *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver, memberPosition,memberFileName,&memberID,status); if(*status == MEMBER_NOT_FOUND) *status = 0; else if(*status == 0) { parentStatus = HDU_ALREADY_MEMBER; ffpmsg("Specified HDU is already a member of the Grouping table (ffgtam)"); continue; } else continue; /* if the member HDU is not already recorded in the grouping table then add it */ /* add a new row to the grouping table */ *status = fits_insert_rows(gfptr,nmembers,1,status); ++nmembers; /* retrieve the grouping table column IDs and structure type */ *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol, &locationCol,&uriCol,&grptype,status); /* fill in the member HDU data in the new grouping table row */ *tmpPtr = memberHDUtype; if(xtensionCol != 0) fits_write_col_str(gfptr,xtensionCol,nmembers,1,1,tmpPtr,status); *tmpPtr = memberExtname; if(extnameCol != 0) { if(strlen(memberExtname) != 0) fits_write_col_str(gfptr,extnameCol,nmembers,1,1,tmpPtr,status); else /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/ fits_write_col_byt(gfptr,extnameCol,nmembers,1,1,charNull,status); } if(extverCol != 0) fits_write_col_lng(gfptr,extverCol,nmembers,1,1,&memberExtver, status); if(positionCol != 0) fits_write_col_int(gfptr,positionCol,nmembers,1,1, &memberPosition,status); *tmpPtr = memberFileName; if(locationCol != 0) { /* Change the test for SPR 3463 */ /* Now, if either the Fptr values are the same, or the root filenames are the same, then assume these refer to the same file. */ fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status); fits_parse_rootname(gfptr->Fptr->filename, grootname, status); if((tmpfptr->Fptr != gfptr->Fptr) && strncmp(tmprootname, grootname, FLEN_FILENAME)) fits_write_col_str(gfptr,locationCol,nmembers,1,1,tmpPtr,status); else /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/ fits_write_col_byt(gfptr,locationCol,nmembers,1,1,charNull,status); } *tmpPtr = memberURI; if(uriCol != 0) { /* Change the test for SPR 3463 */ /* Now, if either the Fptr values are the same, or the root filenames are the same, then assume these refer to the same file. */ fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status); fits_parse_rootname(gfptr->Fptr->filename, grootname, status); if((tmpfptr->Fptr != gfptr->Fptr) && strncmp(tmprootname, grootname, FLEN_FILENAME)) fits_write_col_str(gfptr,uriCol,nmembers,1,1,tmpPtr,status); else /* WILL THIS WORK FOR VAR LENTH CHAR COLS??????*/ fits_write_col_byt(gfptr,uriCol,nmembers,1,1,charNull,status); } } while(0); if(0 != *status) continue; /* add GRPIDn/GRPLCn keywords to the member HDU header to link it to the grouing table if the they do not already exist and the member file is RW */ fits_file_mode(tmpfptr,&iomode,status); if(memberIOstate == 0 || iomode != READWRITE) { ffpmsg("cannot add GRPID/LC keywords to member HDU: (ffgtam)"); ffpmsg(memberFileName); continue; } *status = fits_get_num_groups(tmpfptr,&ngroups,status); /* look for the GRPID/LC keywords in the member HDU; if the keywords for the back-link to the grouping table already exist then no need to add them again */ for(i = 1, found = 0; i <= ngroups && !found && *status == 0; ++i) { sprintf(keyword,"GRPID%d",(int)ngroups); *status = fits_read_key_lng(tmpfptr,keyword,&grpid,card,status); if(grpid == groupExtver) { if(grpid < 0) { /* have to make sure the GRPLCn keyword matches too */ sprintf(keyword,"GRPLC%d",(int)ngroups); /* SPR 1738 */ *status = fits_read_key_longstr(mfptr,keyword,&tgrplc,card, status); if (0 == *status) { strcpy(grplc,tgrplc); free(tgrplc); } /* always compare files using absolute paths the presence of a non-empty cwd indicates that the file names may require conversion to absolute paths */ if(0 < strlen(cwd)) { /* temp buffer for use in assembling abs. path(s) */ char tmp[FLEN_FILENAME]; /* make grplc absolute if necessary */ if(!fits_is_url_absolute(grplc)) { fits_path2url(grplc,groupLocation,status); if(groupLocation[0] != '/') { strcpy(tmp, cwd); strcat(tmp,"/"); strcat(tmp,groupLocation); fits_clean_url(tmp,grplc,status); } } /* make groupFileName absolute if necessary */ if(!fits_is_url_absolute(groupFileName)) { fits_path2url(groupFileName,groupLocation,status); if(groupLocation[0] != '/') { strcpy(tmp, cwd); strcat(tmp,"/"); strcat(tmp,groupLocation); /* note: use groupLocation (which is not used below this block), to store the absolute file name instead of using groupFileName. The latter may be needed unaltered if the GRPLC is written below */ fits_clean_url(tmp,groupLocation,status); } } } /* see if the grplc value and the group file name match */ if(strcmp(grplc,groupLocation) == 0) found = 1; } else { /* the match is found with GRPIDn alone */ found = 1; } } } /* if FOUND is true then no need to continue */ if(found) { ffpmsg("HDU already has GRPID/LC keywords for group table (ffgtam)"); continue; } /* add the GRPID/LC keywords to the member header for this grouping table If NGROUPS == 0 then we must position the header pointer to the record where we want to insert the GRPID/LC keywords (the pointer is already correctly positioned if the above search loop activiated) */ if(ngroups == 0) { /* no GRPIDn/GRPLCn keywords currently exist in header so try to position the header pointer to a desirable position */ for(i = 0, *status = KEY_NO_EXIST; i < nkeys && *status == KEY_NO_EXIST; ++i) { *status = 0; *status = fits_read_card(tmpfptr,keys[i],card,status); } /* all else fails: move write pointer to end of header */ if(*status == KEY_NO_EXIST) { *status = 0; fits_get_hdrspace(tmpfptr,&nkeys,&i,status); ffgrec(tmpfptr,nkeys,card,status); } /* any other error status then abort */ if(*status != 0) continue; } /* now that the header pointer is positioned for the GRPID/LC keyword insertion increment the number of group links counter for the member HDU */ ++ngroups; /* if the member HDU and grouping table reside in the same FITS file then there is no need to add a GRPLCn keyword */ /* SPR 3463 change test */ /* Now, if either the Fptr values are the same, or the root filenames are the same, then assume these refer to the same file. */ fits_parse_rootname(tmpfptr->Fptr->filename, tmprootname, status); fits_parse_rootname(gfptr->Fptr->filename, grootname, status); if((tmpfptr->Fptr == gfptr->Fptr) || strncmp(tmprootname, grootname, FLEN_FILENAME) == 0) { /* add the GRPIDn keyword only */ sprintf(keyword,"GRPID%d",(int)ngroups); fits_insert_key_lng(tmpfptr,keyword,groupExtver, "EXTVER of Group containing this HDU",status); } else { /* add the GRPIDn and GRPLCn keywords */ sprintf(keyword,"GRPID%d",(int)ngroups); fits_insert_key_lng(tmpfptr,keyword,groupExtver, "EXTVER of Group containing this HDU",status); sprintf(keyword,"GRPLC%d",(int)ngroups); /* SPR 1738 */ fits_insert_key_longstr(tmpfptr,keyword,groupFileName, "URL of file containing Group",status); fits_write_key_longwarn(tmpfptr,status); } }while(0); /* close the tmpfptr pointer if it was opened in this function */ if(mfptr == NULL) { *status = fits_close_file(tmpfptr,status); } *status = 0 == *status ? parentStatus : *status; return(*status); } /*---------------------------------------------------------------------------*/ int ffgtnm(fitsfile *gfptr, /* FITS file pointer to grouping table */ long *nmembers, /* member count of the groping table */ int *status) /* return status code */ /* return the number of member HDUs in a grouping table. The fitsfile pointer gfptr must be positioned with the grouping table as the CHDU. The number of grouping table member HDUs is just the NAXIS2 value of the grouping table. */ { char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; if(*status != 0) return(*status); *status = fits_read_keyword(gfptr,"EXTNAME",keyvalue,comment,status); if(*status == KEY_NO_EXIST) *status = NOT_GROUP_TABLE; else { prepare_keyvalue(keyvalue); if(strcasecmp(keyvalue,"GROUPING") != 0) { *status = NOT_GROUP_TABLE; ffpmsg("Specified HDU is not a Grouping table (ffgtnm)"); } *status = fits_read_key_lng(gfptr,"NAXIS2",nmembers,comment,status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgmng(fitsfile *mfptr, /* FITS file pointer to member HDU */ long *ngroups, /* total number of groups linked to HDU */ int *status) /* return status code */ /* return the number of groups to which a HDU belongs, as defined by the number of GRPIDn/GRPLCn keyword records that appear in the HDU header. The fitsfile pointer mfptr must be positioned with the member HDU as the CHDU. Each time this function is called, the indicies of the GRPIDn/GRPLCn keywords are checked to make sure they are continuous (ie no gaps) and are re-enumerated to eliminate gaps if gaps are found to be present. */ { int offset; int index; int newIndex; int i; long grpid; char *inclist[] = {"GRPID#"}; char keyword[FLEN_KEYWORD]; char newKeyword[FLEN_KEYWORD]; char card[FLEN_CARD]; char comment[FLEN_COMMENT]; char *tkeyvalue; if(*status != 0) return(*status); *ngroups = 0; /* reset the member HDU keyword counter to the beginning */ *status = ffgrec(mfptr,0,card,status); /* search for the number of GRPIDn keywords in the member HDU header and count them with the ngroups variable */ while(*status == 0) { /* read the next GRPIDn keyword in the series */ *status = fits_find_nextkey(mfptr,inclist,1,NULL,0,card,status); if(*status != 0) continue; ++(*ngroups); } if(*status == KEY_NO_EXIST) *status = 0; /* read each GRPIDn/GRPLCn keyword and adjust their index values so that there are no gaps in the index count */ for(index = 1, offset = 0, i = 1; i <= *ngroups && *status == 0; ++index) { sprintf(keyword,"GRPID%d",index); /* try to read the next GRPIDn keyword in the series */ *status = fits_read_key_lng(mfptr,keyword,&grpid,card,status); /* if not found then increment the offset counter and continue */ if(*status == KEY_NO_EXIST) { *status = 0; ++offset; } else { /* increment the number_keys_found counter and see if the index of the keyword needs to be updated */ ++i; if(offset > 0) { /* compute the new index for the GRPIDn/GRPLCn keywords */ newIndex = index - offset; /* update the GRPIDn keyword index */ sprintf(newKeyword,"GRPID%d",newIndex); fits_modify_name(mfptr,keyword,newKeyword,status); /* If present, update the GRPLCn keyword index */ sprintf(keyword,"GRPLC%d",index); sprintf(newKeyword,"GRPLC%d",newIndex); /* SPR 1738 */ *status = fits_read_key_longstr(mfptr,keyword,&tkeyvalue,comment, status); if (0 == *status) { fits_delete_key(mfptr,keyword,status); fits_insert_key_longstr(mfptr,newKeyword,tkeyvalue,comment,status); fits_write_key_longwarn(mfptr,status); free(tkeyvalue); } if(*status == KEY_NO_EXIST) *status = 0; } } } return(*status); } /*---------------------------------------------------------------------------*/ int ffgmop(fitsfile *gfptr, /* FITS file pointer to grouping table */ long member, /* member ID (row num) within grouping table */ fitsfile **mfptr, /* FITS file pointer to member HDU */ int *status) /* return status code */ /* open a grouping table member, returning a pointer to the member's FITS file with the CHDU set to the member HDU. The grouping table must be the CHDU of the FITS file pointed to by gfptr. The member to open is identified by its row number within the grouping table (first row/member == 1). If the member resides in a FITS file different from the grouping table the member file is first opened readwrite and if this fails then it is opened readonly. For access type of FILE:// the member file is searched for assuming (1) an absolute path is given, (2) a path relative to the CWD is given, and (3) a path relative to the grouping table file but not relative to the CWD is given. If all of these fail then the error FILE_NOT_FOUND is returned. */ { int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol; int grptype,hdutype; int dummy; long hdupos = 0; long extver = 0; char xtension[FLEN_VALUE]; char extname[FLEN_VALUE]; char uri[FLEN_VALUE]; char grpLocation1[FLEN_FILENAME]; char grpLocation2[FLEN_FILENAME]; char mbrLocation1[FLEN_FILENAME]; char mbrLocation2[FLEN_FILENAME]; char mbrLocation3[FLEN_FILENAME]; char cwd[FLEN_FILENAME]; char card[FLEN_CARD]; char nstr[] = {'\0'}; char *tmpPtr[1]; if(*status != 0) return(*status); do { /* retrieve the Grouping Convention reserved column positions within the grouping table */ *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol, &locationCol,&uriCol,&grptype,status); if(*status != 0) continue; /* extract the member information from grouping table */ tmpPtr[0] = xtension; if(xtensionCol != 0) { *status = fits_read_col_str(gfptr,xtensionCol,member,1,1,nstr, tmpPtr,&dummy,status); /* convert the xtension string to a hdutype code */ if(strcasecmp(xtension,"PRIMARY") == 0) hdutype = IMAGE_HDU; else if(strcasecmp(xtension,"IMAGE") == 0) hdutype = IMAGE_HDU; else if(strcasecmp(xtension,"TABLE") == 0) hdutype = ASCII_TBL; else if(strcasecmp(xtension,"BINTABLE") == 0) hdutype = BINARY_TBL; else hdutype = ANY_HDU; } tmpPtr[0] = extname; if(extnameCol != 0) *status = fits_read_col_str(gfptr,extnameCol,member,1,1,nstr, tmpPtr,&dummy,status); if(extverCol != 0) *status = fits_read_col_lng(gfptr,extverCol,member,1,1,0, (long*)&extver,&dummy,status); if(positionCol != 0) *status = fits_read_col_lng(gfptr,positionCol,member,1,1,0, (long*)&hdupos,&dummy,status); tmpPtr[0] = mbrLocation1; if(locationCol != 0) *status = fits_read_col_str(gfptr,locationCol,member,1,1,nstr, tmpPtr,&dummy,status); tmpPtr[0] = uri; if(uriCol != 0) *status = fits_read_col_str(gfptr,uriCol,member,1,1,nstr, tmpPtr,&dummy,status); if(*status != 0) continue; /* decide what FITS file the member HDU resides in and open the file using the fitsfile* pointer mfptr; note that this logic is rather complicated and is based primiarly upon if a URL specifier is given for the member file in the grouping table */ switch(grptype) { case GT_ID_POS: case GT_ID_REF: case GT_ID_ALL: /* no location information is given so we must assume that the member HDU resides in the same FITS file as the grouping table; if the grouping table was incorrectly constructed then this assumption will be false, but there is nothing to be done about it at this point */ *status = fits_reopen_file(gfptr,mfptr,status); break; case GT_ID_REF_URI: case GT_ID_POS_URI: case GT_ID_ALL_URI: /* The member location column exists. Determine if the member resides in the same file as the grouping table or in a separate file; open the member file in either case */ if(strlen(mbrLocation1) == 0) { /* since no location information was given we must assume that the member is in the same FITS file as the grouping table */ *status = fits_reopen_file(gfptr,mfptr,status); } else { /* make sure the location specifiation is "URL"; we cannot decode any other URI types at this time */ if(strcasecmp(uri,"URL") != 0) { *status = FILE_NOT_OPENED; sprintf(card, "Cannot open member HDU file with URI type %s (ffgmop)", uri); ffpmsg(card); continue; } /* The location string for the member is not NULL, so it does not necessially reside in the same FITS file as the grouping table. Three cases are attempted for opening the member's file in the following order: 1. The URL given for the member's file is absolute (i.e., access method supplied); try to open the member 2. The URL given for the member's file is not absolute but is an absolute file path; try to open the member as a file after the file path is converted to a host-dependent form 3. The URL given for the member's file is not absolute and is given as a relative path to the location of the grouping table's file. Create an absolute URL using the grouping table's file URL and try to open the member. If all three cases fail then an error is returned. In each case the file is first opened in read/write mode and failing that readonly mode. The following DO loop is only used as a mechanism to break (continue) when the proper file opening method is found */ do { /* CASE 1: See if the member URL is absolute (i.e., includes a access directive) and if so open the file */ if(fits_is_url_absolute(mbrLocation1)) { /* the URL must specify an access method, which implies that its an absolute reference regardless of the access method, pass the whole URL to the open function for processing */ ffpmsg("member URL is absolute, try open R/W (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation1,READWRITE, status); if(*status == 0) continue; *status = 0; /* now try to open file using full URL specs in readonly mode */ ffpmsg("OK, now try to open read-only (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation1,READONLY, status); /* break from DO loop regardless of status */ continue; } /* CASE 2: If we got this far then the member URL location has no access type ==> FILE:// Try to open the member file using the URL as is, i.e., assume that it is given as absolute, if it starts with a '/' character */ ffpmsg("Member URL is of type FILE (ffgmop)"); if(*mbrLocation1 == '/') { ffpmsg("Member URL specifies abs file path (ffgmop)"); /* convert the URL path to a host dependent path */ *status = fits_url2path(mbrLocation1,mbrLocation2, status); ffpmsg("Try to open member URL in R/W mode (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation2,READWRITE, status); if(*status == 0) continue; *status = 0; /* now try to open file using the URL as an absolute path in readonly mode */ ffpmsg("OK, now try to open read-only (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation2,READONLY, status); /* break from the Do loop regardless of the status */ continue; } /* CASE 3: If we got this far then the URL does not specify an absoulte file path or URL with access method. Since the path to the group table's file is (obviously) valid for the CWD, create a full location string for the member HDU using the grouping table URL as a basis The only problem is that the grouping table file might have two URLs, the original one used to open it and the one that points to the real file being accessed (i.e., a file accessed via HTTP but transferred to a local disk file). Have to attempt to build a URL to the member HDU file using both of these URLs if defined. */ ffpmsg("Try to open member file as relative URL (ffgmop)"); /* get the URL information for the grouping table file */ *status = fits_get_url(gfptr,grpLocation1,grpLocation2, NULL,NULL,NULL,status); /* if the "real" grouping table file URL is defined then build a full url for the member HDU file using it and try to open the member HDU file */ if(*grpLocation1) { /* make sure the group location is absolute */ if(! fits_is_url_absolute(grpLocation1) && *grpLocation1 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,grpLocation1); strcpy(grpLocation1,cwd); } /* create a full URL for the member HDU file */ *status = fits_relurl2url(grpLocation1,mbrLocation1, mbrLocation2,status); if(*status != 0) continue; /* if the URL does not have an access method given then translate it into a host dependent file path */ if(! fits_is_url_absolute(mbrLocation2)) { *status = fits_url2path(mbrLocation2,mbrLocation3, status); strcpy(mbrLocation2,mbrLocation3); } /* try to open the member file READWRITE */ *status = fits_open_file(mfptr,mbrLocation2,READWRITE, status); if(*status == 0) continue; *status = 0; /* now try to open in readonly mode */ ffpmsg("now try to open file as READONLY (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation2,READONLY, status); if(*status == 0) continue; *status = 0; } /* if we got this far then either the "real" grouping table file URL was not defined or all attempts to open the resulting member HDU file URL failed. if the "original" grouping table file URL is defined then build a full url for the member HDU file using it and try to open the member HDU file */ if(*grpLocation2) { /* make sure the group location is absolute */ if(! fits_is_url_absolute(grpLocation2) && *grpLocation2 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,grpLocation2); strcpy(grpLocation2,cwd); } /* create an absolute URL for the member HDU file */ *status = fits_relurl2url(grpLocation2,mbrLocation1, mbrLocation2,status); if(*status != 0) continue; /* if the URL does not have an access method given then translate it into a host dependent file path */ if(! fits_is_url_absolute(mbrLocation2)) { *status = fits_url2path(mbrLocation2,mbrLocation3, status); strcpy(mbrLocation2,mbrLocation3); } /* try to open the member file READWRITE */ *status = fits_open_file(mfptr,mbrLocation2,READWRITE, status); if(*status == 0) continue; *status = 0; /* now try to open in readonly mode */ ffpmsg("now try to open file as READONLY (ffgmop)"); *status = fits_open_file(mfptr,mbrLocation2,READONLY, status); if(*status == 0) continue; *status = 0; } /* if we got this far then the member HDU file could not be opened using any method. Log the error. */ ffpmsg("Cannot open member HDU FITS file (ffgmop)"); *status = MEMBER_NOT_FOUND; }while(0); } break; default: /* no default action */ break; } if(*status != 0) continue; /* attempt to locate the member HDU within its FITS file as determined and opened above */ switch(grptype) { case GT_ID_POS: case GT_ID_POS_URI: /* try to find the member hdu in the the FITS file pointed to by mfptr based upon its HDU posistion value. Note that is impossible to verify if the HDU is actually the correct HDU due to a lack of information. */ *status = fits_movabs_hdu(*mfptr,(int)hdupos,&hdutype,status); break; case GT_ID_REF: case GT_ID_REF_URI: /* try to find the member hdu in the FITS file pointed to by mfptr based upon its XTENSION, EXTNAME and EXTVER keyword values */ *status = fits_movnam_hdu(*mfptr,hdutype,extname,extver,status); if(*status == BAD_HDU_NUM) { *status = MEMBER_NOT_FOUND; ffpmsg("Cannot find specified member HDU (ffgmop)"); } /* if the above function returned without error then the mfptr is pointed to the member HDU */ break; case GT_ID_ALL: case GT_ID_ALL_URI: /* if the member entry has reference information then use it (ID by reference is safer than ID by position) else use the position information */ if(strlen(xtension) > 0 && strlen(extname) > 0 && extver > 0) { /* valid reference info exists so use it */ /* try to find the member hdu in the grouping table's file */ *status = fits_movnam_hdu(*mfptr,hdutype,extname,extver,status); if(*status == BAD_HDU_NUM) { *status = MEMBER_NOT_FOUND; ffpmsg("Cannot find specified member HDU (ffgmop)"); } } else { *status = fits_movabs_hdu(*mfptr,(int)hdupos,&hdutype, status); if(*status == END_OF_FILE) *status = MEMBER_NOT_FOUND; } /* if the above function returned without error then the mfptr is pointed to the member HDU */ break; default: /* no default action */ break; } }while(0); if(*status != 0 && *mfptr != NULL) { fits_close_file(*mfptr,status); } return(*status); } /*---------------------------------------------------------------------------*/ int ffgmcp(fitsfile *gfptr, /* FITS file pointer to group */ fitsfile *mfptr, /* FITS file pointer to new member FITS file */ long member, /* member ID (row num) within grouping table */ int cpopt, /* code specifying copy options: OPT_MCP_ADD (0) ==> add copied member to the grouping table OPT_MCP_NADD (1) ==> do not add member copy to the grouping table OPT_MCP_REPL (2) ==> replace current member entry with member copy */ int *status) /* return status code */ /* copy a member HDU of a grouping table to a new FITS file. The grouping table must be the CHDU of the FITS file pointed to by gfptr. The copy of the group member shall be appended to the end of the FITS file pointed to by mfptr. If the cpopt parameter is set to OPT_MCP_ADD then the copy of the member is added to the grouping table as a new member, if OPT_MCP_NADD then the copied member is not added to the grouping table, and if OPT_MCP_REPL then the copied member is used to replace the original member. The copied member HDU also has its EXTVER value updated so that its combination of XTENSION, EXTNAME and EXVTER is unique within its new FITS file. */ { int numkeys = 0; int keypos = 0; int hdunum = 0; int hdutype = 0; int i; char *incList[] = {"GRPID#","GRPLC#"}; char extname[FLEN_VALUE]; char card[FLEN_CARD]; char comment[FLEN_COMMENT]; char keyname[FLEN_CARD]; char value[FLEN_CARD]; fitsfile *tmpfptr = NULL; if(*status != 0) return(*status); do { /* open the member HDU to be copied */ *status = fits_open_member(gfptr,member,&tmpfptr,status); if(*status != 0) continue; /* if the member is a grouping table then copy it with a call to fits_copy_group() using the "copy only the grouping table" option if it is not a grouping table then copy the hdu with fits_copy_hdu() remove all GRPIDn and GRPLCn keywords, and update the EXTVER keyword value */ /* get the member HDU's EXTNAME value */ *status = fits_read_key_str(tmpfptr,"EXTNAME",extname,comment,status); /* if no EXTNAME value was found then set the extname to a null string */ if(*status == KEY_NO_EXIST) { extname[0] = 0; *status = 0; } else if(*status != 0) continue; prepare_keyvalue(extname); /* if a grouping table then copy with fits_copy_group() */ if(strcasecmp(extname,"GROUPING") == 0) *status = fits_copy_group(tmpfptr,mfptr,OPT_GCP_GPT,status); else { /* copy the non-grouping table HDU the conventional way */ *status = fits_copy_hdu(tmpfptr,mfptr,0,status); ffgrec(mfptr,0,card,status); /* delete all the GRPIDn and GRPLCn keywords in the copied HDU */ while(*status == 0) { *status = fits_find_nextkey(mfptr,incList,2,NULL,0,card,status); *status = fits_get_hdrpos(mfptr,&numkeys,&keypos,status); /* SPR 1738 */ *status = fits_read_keyn(mfptr,keypos-1,keyname,value, comment,status); *status = fits_read_record(mfptr,keypos-1,card,status); *status = fits_delete_key(mfptr,keyname,status); } if(*status == KEY_NO_EXIST) *status = 0; if(*status != 0) continue; } /* if the member HDU does not have an EXTNAME keyword then add one with a default value */ if(strlen(extname) == 0) { if(fits_get_hdu_num(tmpfptr,&hdunum) == 1) { strcpy(extname,"PRIMARY"); *status = fits_write_key_str(mfptr,"EXTNAME",extname, "HDU was Formerly a Primary Array", status); } else { strcpy(extname,"DEFAULT"); *status = fits_write_key_str(mfptr,"EXTNAME",extname, "default EXTNAME set by CFITSIO", status); } } /* update the member HDU's EXTVER value (add it if not present) */ fits_get_hdu_num(mfptr,&hdunum); fits_get_hdu_type(mfptr,&hdutype,status); /* set the EXTVER value to 0 for now */ *status = fits_modify_key_lng(mfptr,"EXTVER",0,NULL,status); /* if the EXTVER keyword was not found then add it */ if(*status == KEY_NO_EXIST) { *status = 0; *status = fits_read_key_str(mfptr,"EXTNAME",extname,comment, status); *status = fits_insert_key_lng(mfptr,"EXTVER",0, "Extension version ID",status); } if(*status != 0) continue; /* find the first available EXTVER value for the copied HDU */ for(i = 1; fits_movnam_hdu(mfptr,hdutype,extname,i,status) == 0; ++i); *status = 0; fits_movabs_hdu(mfptr,hdunum,&hdutype,status); /* reset the copied member HDUs EXTVER value */ *status = fits_modify_key_lng(mfptr,"EXTVER",(long)i,NULL,status); /* perform member copy operations that are dependent upon the cpopt parameter value */ switch(cpopt) { case OPT_MCP_ADD: /* add the copied member to the grouping table, leaving the entry for the original member in place */ *status = fits_add_group_member(gfptr,mfptr,0,status); break; case OPT_MCP_NADD: /* nothing to do for this copy option */ break; case OPT_MCP_REPL: /* remove the original member from the grouping table and add the copied member in its place */ *status = fits_remove_member(gfptr,member,OPT_RM_ENTRY,status); *status = fits_add_group_member(gfptr,mfptr,0,status); break; default: *status = BAD_OPTION; ffpmsg("Invalid value specified for the cmopt parameter (ffgmcp)"); break; } }while(0); if(tmpfptr != NULL) { fits_close_file(tmpfptr,status); } return(*status); } /*---------------------------------------------------------------------------*/ int ffgmtf(fitsfile *infptr, /* FITS file pointer to source grouping table */ fitsfile *outfptr, /* FITS file pointer to target grouping table */ long member, /* member ID within source grouping table */ int tfopt, /* code specifying transfer opts: OPT_MCP_ADD (0) ==> copy member to dest. OPT_MCP_MOV (3) ==> move member to dest. */ int *status) /* return status code */ /* transfer a group member from one grouping table to another. The source grouping table must be the CHDU of the fitsfile pointed to by infptr, and the destination grouping table must be the CHDU of the fitsfile to by outfptr. If the tfopt parameter is OPT_MCP_ADD then the member is made a member of the target group and remains a member of the source group. If the tfopt parameter is OPT_MCP_MOV then the member is deleted from the source group after the transfer to the destination group. The member to be transfered is identified by its row number within the source grouping table. */ { fitsfile *mfptr = NULL; if(*status != 0) return(*status); if(tfopt != OPT_MCP_MOV && tfopt != OPT_MCP_ADD) { *status = BAD_OPTION; ffpmsg("Invalid value specified for the tfopt parameter (ffgmtf)"); } else { /* open the member of infptr to be transfered */ *status = fits_open_member(infptr,member,&mfptr,status); /* add the member to the outfptr grouping table */ *status = fits_add_group_member(outfptr,mfptr,0,status); /* close the member HDU */ *status = fits_close_file(mfptr,status); /* if the tfopt is "move member" then remove it from the infptr grouping table */ if(tfopt == OPT_MCP_MOV) *status = fits_remove_member(infptr,member,OPT_RM_ENTRY,status); } return(*status); } /*---------------------------------------------------------------------------*/ int ffgmrm(fitsfile *gfptr, /* FITS file pointer to group table */ long member, /* member ID (row num) in the group */ int rmopt, /* code specifying the delete option: OPT_RM_ENTRY ==> delete the member entry OPT_RM_MBR ==> delete entry and member HDU */ int *status) /* return status code */ /* remove a member HDU from a grouping table. The fitsfile pointer gfptr must be positioned with the grouping table as the CHDU, and the member to delete is identified by its row number in the table (first member == 1). The rmopt parameter determines if the member entry is deleted from the grouping table (in which case GRPIDn and GRPLCn keywords in the member HDU's header shall be updated accordingly) or if the member HDU shall itself be removed from its FITS file. */ { int found; int hdutype = 0; int index; int iomode = 0; long i; long ngroups = 0; long nmembers = 0; long groupExtver = 0; long grpid = 0; char grpLocation1[FLEN_FILENAME]; char grpLocation2[FLEN_FILENAME]; char grpLocation3[FLEN_FILENAME]; char cwd[FLEN_FILENAME]; char keyword[FLEN_KEYWORD]; /* SPR 1738 This can now be longer */ char grplc[FLEN_FILENAME]; char *tgrplc; char keyvalue[FLEN_VALUE]; char card[FLEN_CARD]; char *editLocation; char mrootname[FLEN_FILENAME], grootname[FLEN_FILENAME]; fitsfile *mfptr = NULL; if(*status != 0) return(*status); do { /* make sure the grouping table can be modified before proceeding */ fits_file_mode(gfptr,&iomode,status); if(iomode != READWRITE) { ffpmsg("cannot modify grouping table (ffgtam)"); *status = BAD_GROUP_DETACH; continue; } /* open the group member to be deleted and get its IOstatus*/ *status = fits_open_member(gfptr,member,&mfptr,status); *status = fits_file_mode(mfptr,&iomode,status); /* if the member HDU is to be deleted then call fits_unlink_member() to remove it from all groups to which it belongs (including this one) and then delete it. Note that if the member is a grouping table then we have to recursively call fits_remove_member() for each member of the member before we delete the member itself. */ if(rmopt == OPT_RM_MBR) { /* cannot delete a PHDU */ if(fits_get_hdu_num(mfptr,&hdutype) == 1) { *status = BAD_HDU_NUM; continue; } /* determine if the member HDU is itself a grouping table */ *status = fits_read_key_str(mfptr,"EXTNAME",keyvalue,card,status); /* if no EXTNAME is found then the HDU cannot be a grouping table */ if(*status == KEY_NO_EXIST) { keyvalue[0] = 0; *status = 0; } prepare_keyvalue(keyvalue); /* Any other error is a reason to abort */ if(*status != 0) continue; /* if the EXTNAME == GROUPING then the member is a grouping table */ if(strcasecmp(keyvalue,"GROUPING") == 0) { /* remove each of the grouping table members */ *status = fits_get_num_members(mfptr,&nmembers,status); for(i = nmembers; i > 0 && *status == 0; --i) *status = fits_remove_member(mfptr,i,OPT_RM_ENTRY,status); if(*status != 0) continue; } /* unlink the member HDU from all groups that contain it */ *status = ffgmul(mfptr,0,status); if(*status != 0) continue; /* reset the grouping table HDU struct */ fits_set_hdustruc(gfptr,status); /* delete the member HDU */ if(iomode != READONLY) *status = fits_delete_hdu(mfptr,&hdutype,status); } else if(rmopt == OPT_RM_ENTRY) { /* The member HDU is only to be removed as an entry from this grouping table. Actions are (1) find the GRPIDn/GRPLCn keywords that link the member to the grouping table, (2) remove the GRPIDn/GRPLCn keyword from the member HDU header and (3) remove the member entry from the grouping table */ /* there is no need to seach for and remove the GRPIDn/GRPLCn keywords from the member HDU if it has not been opened in READWRITE mode */ if(iomode == READWRITE) { /* determine the group EXTVER value of the grouping table; if the member HDU and grouping table HDU do not reside in the same file then set the groupExtver value to its negative */ *status = fits_read_key_lng(gfptr,"EXTVER",&groupExtver,card, status); /* Now, if either the Fptr values are the same, or the root filenames are the same, then assume these refer to the same file. */ fits_parse_rootname(mfptr->Fptr->filename, mrootname, status); fits_parse_rootname(gfptr->Fptr->filename, grootname, status); if((mfptr->Fptr != gfptr->Fptr) && strncmp(mrootname, grootname, FLEN_FILENAME)) groupExtver = -1*groupExtver; /* retrieve the URLs for the grouping table; note that it is possible that the grouping table file has two URLs, the one used to open it and the "real" one pointing to the actual file being accessed */ *status = fits_get_url(gfptr,grpLocation1,grpLocation2,NULL, NULL,NULL,status); if(*status != 0) continue; /* if either of the group location strings specify a relative file path then convert them into absolute file paths */ *status = fits_get_cwd(cwd,status); if(*grpLocation1 != 0 && *grpLocation1 != '/' && !fits_is_url_absolute(grpLocation1)) { strcpy(grpLocation3,cwd); strcat(grpLocation3,"/"); strcat(grpLocation3,grpLocation1); fits_clean_url(grpLocation3,grpLocation1,status); } if(*grpLocation2 != 0 && *grpLocation2 != '/' && !fits_is_url_absolute(grpLocation2)) { strcpy(grpLocation3,cwd); strcat(grpLocation3,"/"); strcat(grpLocation3,grpLocation2); fits_clean_url(grpLocation3,grpLocation2,status); } /* determine the number of groups to which the member HDU belongs */ *status = fits_get_num_groups(mfptr,&ngroups,status); /* reset the HDU keyword position counter to the beginning */ *status = ffgrec(mfptr,0,card,status); /* loop over all the GRPIDn keywords in the member HDU header and find the appropriate GRPIDn and GRPLCn keywords that identify it as belonging to the group */ for(index = 1, found = 0; index <= ngroups && *status == 0 && !found; ++index) { /* read the next GRPIDn keyword in the series */ sprintf(keyword,"GRPID%d",index); *status = fits_read_key_lng(mfptr,keyword,&grpid,card, status); if(*status != 0) continue; /* grpid value == group EXTVER value then we could have a match */ if(grpid == groupExtver && grpid > 0) { /* if GRPID is positive then its a match because both the member HDU and grouping table HDU reside in the same FITS file */ found = index; } else if(grpid == groupExtver && grpid < 0) { /* have to look at the GRPLCn value to determine a match because the member HDU and grouping table HDU reside in different FITS files */ sprintf(keyword,"GRPLC%d",index); /* SPR 1738 */ *status = fits_read_key_longstr(mfptr,keyword,&tgrplc, card, status); if (0 == *status) { strcpy(grplc,tgrplc); free(tgrplc); } if(*status == KEY_NO_EXIST) { /* no GRPLCn keyword value found ==> grouping convention not followed; nothing we can do about it, so just continue */ sprintf(card,"No GRPLC%d found for GRPID%d", index,index); ffpmsg(card); *status = 0; continue; } else if (*status != 0) continue; /* construct the URL for the GRPLCn value */ prepare_keyvalue(grplc); /* if the grplc value specifies a relative path then turn it into a absolute file path for comparison purposes */ if(*grplc != 0 && !fits_is_url_absolute(grplc) && *grplc != '/') { /* No, wrong, strcpy(grpLocation3,cwd); should be */ *status = fits_file_name(mfptr,grpLocation3,status); /* Remove everything after the last / */ if (NULL != (editLocation = strrchr(grpLocation3,'/'))) { *editLocation = '\0'; } strcat(grpLocation3,"/"); strcat(grpLocation3,grplc); *status = fits_clean_url(grpLocation3,grplc, status); } /* if the absolute value of GRPIDn is equal to the EXTVER value of the grouping table and (one of the possible two) grouping table file URL matches the GRPLCn keyword value then we hava a match */ if(strcmp(grplc,grpLocation1) == 0 || strcmp(grplc,grpLocation2) == 0) found = index; } } /* if found == 0 (false) after the above search then we assume that it is due to an inpromper updating of the GRPIDn and GRPLCn keywords in the member header ==> nothing to delete in the header. Else delete the GRPLCn and GRPIDn keywords that identify the member HDU with the group HDU and re-enumerate the remaining GRPIDn and GRPLCn keywords */ if(found != 0) { sprintf(keyword,"GRPID%d",found); *status = fits_delete_key(mfptr,keyword,status); sprintf(keyword,"GRPLC%d",found); *status = fits_delete_key(mfptr,keyword,status); *status = 0; /* call fits_get_num_groups() to re-enumerate the GRPIDn */ *status = fits_get_num_groups(mfptr,&ngroups,status); } } /* finally, remove the member entry from the current grouping table pointed to by gfptr */ *status = fits_delete_rows(gfptr,member,1,status); } else { *status = BAD_OPTION; ffpmsg("Invalid value specified for the rmopt parameter (ffgmrm)"); } }while(0); if(mfptr != NULL) { fits_close_file(mfptr,status); } return(*status); } /*--------------------------------------------------------------------------- Grouping Table support functions ---------------------------------------------------------------------------*/ int ffgtgc(fitsfile *gfptr, /* pointer to the grouping table */ int *xtensionCol, /* column ID of the MEMBER_XTENSION column */ int *extnameCol, /* column ID of the MEMBER_NAME column */ int *extverCol, /* column ID of the MEMBER_VERSION column */ int *positionCol, /* column ID of the MEMBER_POSITION column */ int *locationCol, /* column ID of the MEMBER_LOCATION column */ int *uriCol, /* column ID of the MEMBER_URI_TYPE column */ int *grptype, /* group structure type code specifying the grouping table columns that are defined: GT_ID_ALL_URI (0) ==> all columns defined GT_ID_REF (1) ==> reference cols only GT_ID_POS (2) ==> position col only GT_ID_ALL (3) ==> ref & pos cols GT_ID_REF_URI (11) ==> ref & loc cols GT_ID_POS_URI (12) ==> pos & loc cols */ int *status) /* return status code */ /* examine the grouping table pointed to by gfptr and determine the column index ID of each possible grouping column. If a column is not found then an index of 0 is returned. the grptype parameter returns the structure of the grouping table ==> what columns are defined. */ { char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; if(*status != 0) return(*status); do { /* if the HDU does not have an extname of "GROUPING" then it is not a grouping table */ *status = fits_read_key_str(gfptr,"EXTNAME",keyvalue,comment,status); if(*status == KEY_NO_EXIST) { *status = NOT_GROUP_TABLE; ffpmsg("Specified HDU is not a Grouping Table (ffgtgc)"); } if(*status != 0) continue; prepare_keyvalue(keyvalue); if(strcasecmp(keyvalue,"GROUPING") != 0) { *status = NOT_GROUP_TABLE; continue; } /* search for the MEMBER_XTENSION, MEMBER_NAME, MEMBER_VERSION, MEMBER_POSITION, MEMBER_LOCATION and MEMBER_URI_TYPE columns and determine their column index ID */ *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_XTENSION",xtensionCol, status); if(*status == COL_NOT_FOUND) { *status = 0; *xtensionCol = 0; } if(*status != 0) continue; *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_NAME",extnameCol,status); if(*status == COL_NOT_FOUND) { *status = 0; *extnameCol = 0; } if(*status != 0) continue; *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_VERSION",extverCol, status); if(*status == COL_NOT_FOUND) { *status = 0; *extverCol = 0; } if(*status != 0) continue; *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_POSITION",positionCol, status); if(*status == COL_NOT_FOUND) { *status = 0; *positionCol = 0; } if(*status != 0) continue; *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_LOCATION",locationCol, status); if(*status == COL_NOT_FOUND) { *status = 0; *locationCol = 0; } if(*status != 0) continue; *status = fits_get_colnum(gfptr,CASESEN,"MEMBER_URI_TYPE",uriCol, status); if(*status == COL_NOT_FOUND) { *status = 0; *uriCol = 0; } if(*status != 0) continue; /* determine the type of grouping table structure used by this grouping table and record it in the grptype parameter */ if(*xtensionCol && *extnameCol && *extverCol && *positionCol && *locationCol && *uriCol) *grptype = GT_ID_ALL_URI; else if(*xtensionCol && *extnameCol && *extverCol && *locationCol && *uriCol) *grptype = GT_ID_REF_URI; else if(*xtensionCol && *extnameCol && *extverCol && *positionCol) *grptype = GT_ID_ALL; else if(*xtensionCol && *extnameCol && *extverCol) *grptype = GT_ID_REF; else if(*positionCol && *locationCol && *uriCol) *grptype = GT_ID_POS_URI; else if(*positionCol) *grptype = GT_ID_POS; else *status = NOT_GROUP_TABLE; }while(0); /* if the table contained more than one column with a reserved name then this cannot be considered a vailid grouping table */ if(*status == COL_NOT_UNIQUE) { *status = NOT_GROUP_TABLE; ffpmsg("Specified HDU has multipule Group table cols defined (ffgtgc)"); } return(*status); } /*****************************************************************************/ int ffgtdc(int grouptype, /* code specifying the type of grouping table information: GT_ID_ALL_URI 0 ==> defualt (all columns) GT_ID_REF 1 ==> ID by reference GT_ID_POS 2 ==> ID by position GT_ID_ALL 3 ==> ID by ref. and position GT_ID_REF_URI 11 ==> (1) + URI info GT_ID_POS_URI 12 ==> (2) + URI info */ int xtensioncol, /* does MEMBER_XTENSION already exist? */ int extnamecol, /* does MEMBER_NAME aleady exist? */ int extvercol, /* does MEMBER_VERSION already exist? */ int positioncol, /* does MEMBER_POSITION already exist? */ int locationcol, /* does MEMBER_LOCATION already exist? */ int uricol, /* does MEMBER_URI_TYPE aleardy exist? */ char *ttype[], /* array of grouping table column TTYPE names to define (if *col var false) */ char *tform[], /* array of grouping table column TFORM values to define (if*col variable false) */ int *ncols, /* number of TTYPE and TFORM values returned */ int *status) /* return status code */ /* create the TTYPE and TFORM values for the grouping table according to the value of the grouptype parameter and the values of the *col flags. The resulting TTYPE and TFORM are returned in ttype[] and tform[] respectively. The number of TTYPE and TFORMs returned is given by ncols. Both the TTYPE[] and TTFORM[] arrays must contain enough pre-allocated strings to hold the returned information. */ { int i = 0; char xtension[] = "MEMBER_XTENSION"; char xtenTform[] = "8A"; char name[] = "MEMBER_NAME"; char nameTform[] = "32A"; char version[] = "MEMBER_VERSION"; char verTform[] = "1J"; char position[] = "MEMBER_POSITION"; char posTform[] = "1J"; char URI[] = "MEMBER_URI_TYPE"; char URITform[] = "3A"; char location[] = "MEMBER_LOCATION"; /* SPR 01720, move from 160A to 256A */ char locTform[] = "256A"; if(*status != 0) return(*status); switch(grouptype) { case GT_ID_ALL_URI: if(xtensioncol == 0) { strcpy(ttype[i],xtension); strcpy(tform[i],xtenTform); ++i; } if(extnamecol == 0) { strcpy(ttype[i],name); strcpy(tform[i],nameTform); ++i; } if(extvercol == 0) { strcpy(ttype[i],version); strcpy(tform[i],verTform); ++i; } if(positioncol == 0) { strcpy(ttype[i],position); strcpy(tform[i],posTform); ++i; } if(locationcol == 0) { strcpy(ttype[i],location); strcpy(tform[i],locTform); ++i; } if(uricol == 0) { strcpy(ttype[i],URI); strcpy(tform[i],URITform); ++i; } break; case GT_ID_REF: if(xtensioncol == 0) { strcpy(ttype[i],xtension); strcpy(tform[i],xtenTform); ++i; } if(extnamecol == 0) { strcpy(ttype[i],name); strcpy(tform[i],nameTform); ++i; } if(extvercol == 0) { strcpy(ttype[i],version); strcpy(tform[i],verTform); ++i; } break; case GT_ID_POS: if(positioncol == 0) { strcpy(ttype[i],position); strcpy(tform[i],posTform); ++i; } break; case GT_ID_ALL: if(xtensioncol == 0) { strcpy(ttype[i],xtension); strcpy(tform[i],xtenTform); ++i; } if(extnamecol == 0) { strcpy(ttype[i],name); strcpy(tform[i],nameTform); ++i; } if(extvercol == 0) { strcpy(ttype[i],version); strcpy(tform[i],verTform); ++i; } if(positioncol == 0) { strcpy(ttype[i],position); strcpy(tform[i], posTform); ++i; } break; case GT_ID_REF_URI: if(xtensioncol == 0) { strcpy(ttype[i],xtension); strcpy(tform[i],xtenTform); ++i; } if(extnamecol == 0) { strcpy(ttype[i],name); strcpy(tform[i],nameTform); ++i; } if(extvercol == 0) { strcpy(ttype[i],version); strcpy(tform[i],verTform); ++i; } if(locationcol == 0) { strcpy(ttype[i],location); strcpy(tform[i],locTform); ++i; } if(uricol == 0) { strcpy(ttype[i],URI); strcpy(tform[i],URITform); ++i; } break; case GT_ID_POS_URI: if(positioncol == 0) { strcpy(ttype[i],position); strcpy(tform[i],posTform); ++i; } if(locationcol == 0) { strcpy(ttype[i],location); strcpy(tform[i],locTform); ++i; } if(uricol == 0) { strcpy(ttype[i],URI); strcpy(tform[i],URITform); ++i; } break; default: *status = BAD_OPTION; ffpmsg("Invalid value specified for the grouptype parameter (ffgtdc)"); break; } *ncols = i; return(*status); } /*****************************************************************************/ int ffgmul(fitsfile *mfptr, /* pointer to the grouping table member HDU */ int rmopt, /* 0 ==> leave GRPIDn/GRPLCn keywords, 1 ==> remove GRPIDn/GRPLCn keywords */ int *status) /* return status code */ /* examine all the GRPIDn and GRPLCn keywords in the member HDUs header and remove the member from the grouping tables referenced; This effectively "unlinks" the member from all of its groups. The rmopt specifies if the GRPIDn/GRPLCn keywords are to be removed from the member HDUs header after the unlinking. */ { int memberPosition = 0; int iomode; long index; long ngroups = 0; long memberExtver = 0; long memberID = 0; char mbrLocation1[FLEN_FILENAME]; char mbrLocation2[FLEN_FILENAME]; char memberHDUtype[FLEN_VALUE]; char memberExtname[FLEN_VALUE]; char keyword[FLEN_KEYWORD]; char card[FLEN_CARD]; fitsfile *gfptr = NULL; if(*status != 0) return(*status); do { /* determine location parameters of the member HDU; note that default values are supplied if the expected keywords are not found */ *status = fits_read_key_str(mfptr,"XTENSION",memberHDUtype,card,status); if(*status == KEY_NO_EXIST) { strcpy(memberHDUtype,"PRIMARY"); *status = 0; } prepare_keyvalue(memberHDUtype); *status = fits_read_key_lng(mfptr,"EXTVER",&memberExtver,card,status); if(*status == KEY_NO_EXIST) { memberExtver = 1; *status = 0; } *status = fits_read_key_str(mfptr,"EXTNAME",memberExtname,card,status); if(*status == KEY_NO_EXIST) { memberExtname[0] = 0; *status = 0; } prepare_keyvalue(memberExtname); fits_get_hdu_num(mfptr,&memberPosition); *status = fits_get_url(mfptr,mbrLocation1,mbrLocation2,NULL,NULL, NULL,status); if(*status != 0) continue; /* open each grouping table linked to this HDU and remove the member from the grouping tables */ *status = fits_get_num_groups(mfptr,&ngroups,status); /* loop over each group linked to the member HDU */ for(index = 1; index <= ngroups && *status == 0; ++index) { /* open the (index)th group linked to the member HDU */ *status = fits_open_group(mfptr,index,&gfptr,status); /* if the group could not be opened then just skip it */ if(*status != 0) { *status = 0; sprintf(card,"Cannot open the %dth group table (ffgmul)", (int)index); ffpmsg(card); continue; } /* make sure the grouping table can be modified before proceeding */ fits_file_mode(gfptr,&iomode,status); if(iomode != READWRITE) { sprintf(card,"The %dth group cannot be modified (ffgtam)", (int)index); ffpmsg(card); continue; } /* try to find the member's row within the grouping table; first try using the member HDU file's "real" URL string then try using its originally opened URL string if either string exist */ memberID = 0; if(strlen(mbrLocation1) != 0) { *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver, memberPosition,mbrLocation1,&memberID,status); } if(*status == MEMBER_NOT_FOUND && strlen(mbrLocation2) != 0) { *status = 0; *status = ffgmf(gfptr,memberHDUtype,memberExtname,memberExtver, memberPosition,mbrLocation2,&memberID,status); } /* if the member was found then delete it from the grouping table */ if(*status == 0) *status = fits_delete_rows(gfptr,memberID,1,status); /* continue the loop over all member groups even if an error was generated */ if(*status == MEMBER_NOT_FOUND) { ffpmsg("cannot locate member's entry in group table (ffgmul)"); } *status = 0; /* close the file pointed to by gfptr if it is non NULL to prepare for the next loop iterration */ if(gfptr != NULL) { fits_close_file(gfptr,status); gfptr = NULL; } } if(*status != 0) continue; /* if rmopt is non-zero then find and delete the GRPIDn/GRPLCn keywords from the member HDU header */ if(rmopt != 0) { fits_file_mode(mfptr,&iomode,status); if(iomode == READONLY) { ffpmsg("Cannot modify member HDU, opened READONLY (ffgmul)"); continue; } /* delete all the GRPIDn/GRPLCn keywords */ for(index = 1; index <= ngroups && *status == 0; ++index) { sprintf(keyword,"GRPID%d",(int)index); fits_delete_key(mfptr,keyword,status); sprintf(keyword,"GRPLC%d",(int)index); fits_delete_key(mfptr,keyword,status); if(*status == KEY_NO_EXIST) *status = 0; } } }while(0); /* make sure the gfptr has been closed */ if(gfptr != NULL) { fits_close_file(gfptr,status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgmf(fitsfile *gfptr, /* pointer to grouping table HDU to search */ char *xtension, /* XTENSION value for member HDU */ char *extname, /* EXTNAME value for member HDU */ int extver, /* EXTVER value for member HDU */ int position, /* HDU position value for member HDU */ char *location, /* FITS file location value for member HDU */ long *member, /* member HDU ID within group table (if found) */ int *status) /* return status code */ /* try to find the entry for the member HDU defined by the xtension, extname, extver, position, and location parameters within the grouping table pointed to by gfptr. If the member HDU is found then its ID (row number) within the grouping table is returned in the member variable; if not found then member is returned with a value of 0 and the status return code will be set to MEMBER_NOT_FOUND. Note that the member HDU postion information is used to obtain a member match only if the grouping table type is GT_ID_POS_URI or GT_ID_POS. This is because the position information can become invalid much more easily then the reference information for a group member. */ { int xtensionCol,extnameCol,extverCol,positionCol,locationCol,uriCol; int mposition = 0; int grptype; int dummy; int i; long nmembers = 0; long mextver = 0; char charBuff1[FLEN_FILENAME]; char charBuff2[FLEN_FILENAME]; char tmpLocation[FLEN_FILENAME]; char mbrLocation1[FLEN_FILENAME]; char mbrLocation2[FLEN_FILENAME]; char mbrLocation3[FLEN_FILENAME]; char grpLocation1[FLEN_FILENAME]; char grpLocation2[FLEN_FILENAME]; char cwd[FLEN_FILENAME]; char nstr[] = {'\0'}; char *tmpPtr[2]; if(*status != 0) return(*status); *member = 0; tmpPtr[0] = charBuff1; tmpPtr[1] = charBuff2; if(*status != 0) return(*status); /* if the passed LOCATION value is not an absolute URL then turn it into an absolute path */ if(location == NULL) { *tmpLocation = 0; } else if(*location == 0) { *tmpLocation = 0; } else if(!fits_is_url_absolute(location)) { fits_path2url(location,tmpLocation,status); if(*tmpLocation != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,tmpLocation); fits_clean_url(cwd,tmpLocation,status); } } else strcpy(tmpLocation,location); /* retrieve the Grouping Convention reserved column positions within the grouping table */ *status = ffgtgc(gfptr,&xtensionCol,&extnameCol,&extverCol,&positionCol, &locationCol,&uriCol,&grptype,status); /* retrieve the number of group members */ *status = fits_get_num_members(gfptr,&nmembers,status); /* loop over all grouping table rows until the member HDU is found */ for(i = 1; i <= nmembers && *member == 0 && *status == 0; ++i) { if(xtensionCol != 0) { fits_read_col_str(gfptr,xtensionCol,i,1,1,nstr,tmpPtr,&dummy,status); if(strcasecmp(tmpPtr[0],xtension) != 0) continue; } if(extnameCol != 0) { fits_read_col_str(gfptr,extnameCol,i,1,1,nstr,tmpPtr,&dummy,status); if(strcasecmp(tmpPtr[0],extname) != 0) continue; } if(extverCol != 0) { fits_read_col_lng(gfptr,extverCol,i,1,1,0, (long*)&mextver,&dummy,status); if(extver != mextver) continue; } /* note we only use postionCol if we have to */ if(positionCol != 0 && (grptype == GT_ID_POS || grptype == GT_ID_POS_URI)) { fits_read_col_int(gfptr,positionCol,i,1,1,0, &mposition,&dummy,status); if(position != mposition) continue; } /* if no location string was passed to the function then assume that the calling application does not wish to use it as a comparision critera ==> if we got this far then we have a match */ if(location == NULL) { ffpmsg("NULL Location string given ==> ingore location (ffgmf)"); *member = i; continue; } /* if the grouping table MEMBER_LOCATION column exists then read the location URL for the member, else set the location string to a zero-length string for subsequent comparisions */ if(locationCol != 0) { fits_read_col_str(gfptr,locationCol,i,1,1,nstr,tmpPtr,&dummy,status); strcpy(mbrLocation1,tmpPtr[0]); *mbrLocation2 = 0; } else *mbrLocation1 = 0; /* if the member location string from the grouping table is zero length (either implicitly or explicitly) then assume that the member HDU is in the same file as the grouping table HDU; retrieve the possible URL values of the grouping table HDU file */ if(*mbrLocation1 == 0) { /* retrieve the possible URLs of the grouping table file */ *status = fits_get_url(gfptr,mbrLocation1,mbrLocation2,NULL,NULL, NULL,status); /* if non-NULL, make sure the first URL is absolute or a full path */ if(*mbrLocation1 != 0 && !fits_is_url_absolute(mbrLocation1) && *mbrLocation1 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,mbrLocation1); fits_clean_url(cwd,mbrLocation1,status); } /* if non-NULL, make sure the first URL is absolute or a full path */ if(*mbrLocation2 != 0 && !fits_is_url_absolute(mbrLocation2) && *mbrLocation2 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,mbrLocation2); fits_clean_url(cwd,mbrLocation2,status); } } /* if the member location was specified, then make sure that it is either an absolute URL or specifies a full path */ else if(!fits_is_url_absolute(mbrLocation1) && *mbrLocation1 != '/') { strcpy(mbrLocation2,mbrLocation1); /* get the possible URLs for the grouping table file */ *status = fits_get_url(gfptr,grpLocation1,grpLocation2,NULL,NULL, NULL,status); if(*grpLocation1 != 0) { /* make sure the first grouping table URL is absolute */ if(!fits_is_url_absolute(grpLocation1) && *grpLocation1 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,grpLocation1); fits_clean_url(cwd,grpLocation1,status); } /* create an absoute URL for the member */ fits_relurl2url(grpLocation1,mbrLocation1,mbrLocation3,status); /* if URL construction succeeded then copy it to the first location string; else set the location string to empty */ if(*status == 0) { strcpy(mbrLocation1,mbrLocation3); } else if(*status == URL_PARSE_ERROR) { *status = 0; *mbrLocation1 = 0; } } else *mbrLocation1 = 0; if(*grpLocation2 != 0) { /* make sure the second grouping table URL is absolute */ if(!fits_is_url_absolute(grpLocation2) && *grpLocation2 != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,grpLocation2); fits_clean_url(cwd,grpLocation2,status); } /* create an absolute URL for the member */ fits_relurl2url(grpLocation2,mbrLocation2,mbrLocation3,status); /* if URL construction succeeded then copy it to the second location string; else set the location string to empty */ if(*status == 0) { strcpy(mbrLocation2,mbrLocation3); } else if(*status == URL_PARSE_ERROR) { *status = 0; *mbrLocation2 = 0; } } else *mbrLocation2 = 0; } /* compare the passed member HDU file location string with the (possibly two) member location strings to see if there is a match */ if(strcmp(mbrLocation1,tmpLocation) != 0 && strcmp(mbrLocation2,tmpLocation) != 0 ) continue; /* if we made it this far then a match to the member HDU was found */ *member = i; } /* if a match was not found then set the return status code */ if(*member == 0 && *status == 0) { *status = MEMBER_NOT_FOUND; ffpmsg("Cannot find specified member HDU (ffgmf)"); } return(*status); } /*-------------------------------------------------------------------------- Recursive Group Functions --------------------------------------------------------------------------*/ int ffgtrmr(fitsfile *gfptr, /* FITS file pointer to group */ HDUtracker *HDU, /* list of processed HDUs */ int *status) /* return status code */ /* recursively remove a grouping table and all its members. Each member of the grouping table pointed to by gfptr it processed. If the member is itself a grouping table then ffgtrmr() is recursively called to process all of its members. The HDUtracker struct *HDU is used to make sure a member is not processed twice, thus avoiding an infinite loop (e.g., a grouping table contains itself as a member). */ { int i; int hdutype; long nmembers = 0; char keyvalue[FLEN_VALUE]; char comment[FLEN_COMMENT]; fitsfile *mfptr = NULL; if(*status != 0) return(*status); /* get the number of members contained by this grouping table */ *status = fits_get_num_members(gfptr,&nmembers,status); /* loop over all group members and delete them */ for(i = nmembers; i > 0 && *status == 0; --i) { /* open the member HDU */ *status = fits_open_member(gfptr,i,&mfptr,status); /* if the member cannot be opened then just skip it and continue */ if(*status == MEMBER_NOT_FOUND) { *status = 0; continue; } /* Any other error is a reason to abort */ if(*status != 0) continue; /* add the member HDU to the HDUtracker struct */ *status = fftsad(mfptr,HDU,NULL,NULL); /* status == HDU_ALREADY_TRACKED ==> HDU has already been processed */ if(*status == HDU_ALREADY_TRACKED) { *status = 0; fits_close_file(mfptr,status); continue; } else if(*status != 0) continue; /* determine if the member HDU is itself a grouping table */ *status = fits_read_key_str(mfptr,"EXTNAME",keyvalue,comment,status); /* if no EXTNAME is found then the HDU cannot be a grouping table */ if(*status == KEY_NO_EXIST) { *status = 0; keyvalue[0] = 0; } prepare_keyvalue(keyvalue); /* Any other error is a reason to abort */ if(*status != 0) continue; /* if the EXTNAME == GROUPING then the member is a grouping table and we must call ffgtrmr() to process its members */ if(strcasecmp(keyvalue,"GROUPING") == 0) *status = ffgtrmr(mfptr,HDU,status); /* unlink all the grouping tables that contain this HDU as a member and then delete the HDU (if not a PHDU) */ if(fits_get_hdu_num(mfptr,&hdutype) == 1) *status = ffgmul(mfptr,1,status); else { *status = ffgmul(mfptr,0,status); *status = fits_delete_hdu(mfptr,&hdutype,status); } /* close the fitsfile pointer */ fits_close_file(mfptr,status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgtcpr(fitsfile *infptr, /* input FITS file pointer */ fitsfile *outfptr, /* output FITS file pointer */ int cpopt, /* code specifying copy options: OPT_GCP_GPT (0) ==> cp only grouping table OPT_GCP_ALL (2) ==> recusrively copy members and their members (if groups) */ HDUtracker *HDU, /* list of already copied HDUs */ int *status) /* return status code */ /* copy a Group to a new FITS file. If the cpopt parameter is set to OPT_GCP_GPT (copy grouping table only) then the existing members have their GRPIDn and GRPLCn keywords updated to reflect the existance of the new group, since they now belong to another group. If cpopt is set to OPT_GCP_ALL (copy grouping table and members recursively) then the original members are not updated; the new grouping table is modified to include only the copied member HDUs and not the original members. Note that this function is recursive. When copt is OPT_GCP_ALL it will call itself whenever a member HDU of the current grouping table is itself a grouping table (i.e., EXTNAME = 'GROUPING'). */ { int i; int nexclude = 8; int hdutype = 0; int groupHDUnum = 0; int numkeys = 0; int keypos = 0; int startSearch = 0; int newPosition = 0; long nmembers = 0; long tfields = 0; long newTfields = 0; char keyword[FLEN_KEYWORD]; char keyvalue[FLEN_VALUE]; char card[FLEN_CARD]; char comment[FLEN_CARD]; char *tkeyvalue; char *includeList[] = {"*"}; char *excludeList[] = {"EXTNAME","EXTVER","GRPNAME","GRPID#","GRPLC#", "THEAP","TDIM#","T????#"}; fitsfile *mfptr = NULL; if(*status != 0) return(*status); do { /* create a new grouping table in the FITS file pointed to by outptr */ *status = fits_get_num_members(infptr,&nmembers,status); *status = fits_read_key_str(infptr,"GRPNAME",keyvalue,card,status); if(*status == KEY_NO_EXIST) { keyvalue[0] = 0; *status = 0; } prepare_keyvalue(keyvalue); *status = fits_create_group(outfptr,keyvalue,GT_ID_ALL_URI,status); /* save the new grouping table's HDU position for future use */ fits_get_hdu_num(outfptr,&groupHDUnum); /* update the HDUtracker struct with the grouping table's new position */ *status = fftsud(infptr,HDU,groupHDUnum,NULL); /* Now populate the copied grouping table depending upon the copy option parameter value */ switch(cpopt) { /* for the "copy grouping table only" option we only have to add the members of the original grouping table to the new grouping table */ case OPT_GCP_GPT: for(i = 1; i <= nmembers && *status == 0; ++i) { *status = fits_open_member(infptr,i,&mfptr,status); *status = fits_add_group_member(outfptr,mfptr,0,status); fits_close_file(mfptr,status); mfptr = NULL; } break; case OPT_GCP_ALL: /* for the "copy the entire group" option */ /* loop over all the grouping table members */ for(i = 1; i <= nmembers && *status == 0; ++i) { /* open the ith member */ *status = fits_open_member(infptr,i,&mfptr,status); if(*status != 0) continue; /* add it to the HDUtracker struct */ *status = fftsad(mfptr,HDU,&newPosition,NULL); /* if already copied then just add the member to the group */ if(*status == HDU_ALREADY_TRACKED) { *status = 0; *status = fits_add_group_member(outfptr,NULL,newPosition, status); fits_close_file(mfptr,status); mfptr = NULL; continue; } else if(*status != 0) continue; /* see if the member is a grouping table */ *status = fits_read_key_str(mfptr,"EXTNAME",keyvalue,card, status); if(*status == KEY_NO_EXIST) { keyvalue[0] = 0; *status = 0; } prepare_keyvalue(keyvalue); /* if the member is a grouping table then copy it and all of its members using ffgtcpr(), else copy it using fits_copy_member(); the outptr will point to the newly copied member upon return from both functions */ if(strcasecmp(keyvalue,"GROUPING") == 0) *status = ffgtcpr(mfptr,outfptr,OPT_GCP_ALL,HDU,status); else *status = fits_copy_member(infptr,outfptr,i,OPT_MCP_NADD, status); /* retrieve the position of the newly copied member */ fits_get_hdu_num(outfptr,&newPosition); /* update the HDUtracker struct with member's new position */ if(strcasecmp(keyvalue,"GROUPING") != 0) *status = fftsud(mfptr,HDU,newPosition,NULL); /* move the outfptr back to the copied grouping table HDU */ *status = fits_movabs_hdu(outfptr,groupHDUnum,&hdutype,status); /* add the copied member HDU to the copied grouping table */ *status = fits_add_group_member(outfptr,NULL,newPosition,status); /* close the mfptr pointer */ fits_close_file(mfptr,status); mfptr = NULL; } break; default: *status = BAD_OPTION; ffpmsg("Invalid value specified for cmopt parameter (ffgtcpr)"); break; } if(*status != 0) continue; /* reposition the outfptr to the grouping table so that the grouping table is the CHDU upon return to the calling function */ fits_movabs_hdu(outfptr,groupHDUnum,&hdutype,status); /* copy all auxiliary keyword records from the original grouping table to the new grouping table; they are copied in their original order and inserted just before the TTYPE1 keyword record */ *status = fits_read_card(outfptr,"TTYPE1",card,status); *status = fits_get_hdrpos(outfptr,&numkeys,&keypos,status); --keypos; startSearch = 8; while(*status == 0) { ffgrec(infptr,startSearch,card,status); *status = fits_find_nextkey(infptr,includeList,1,excludeList, nexclude,card,status); *status = fits_get_hdrpos(infptr,&numkeys,&startSearch,status); --startSearch; /* SPR 1738 */ if (strncmp(card,"GRPLC",5)) { /* Not going to be a long string so we're ok */ *status = fits_insert_record(outfptr,keypos,card,status); } else { /* We could have a long string */ *status = fits_read_record(infptr,startSearch,card,status); card[9] = '\0'; *status = fits_read_key_longstr(infptr,card,&tkeyvalue,comment, status); if (0 == *status) { fits_insert_key_longstr(outfptr,card,tkeyvalue,comment,status); fits_write_key_longwarn(outfptr,status); free(tkeyvalue); } } ++keypos; } if(*status == KEY_NO_EXIST) *status = 0; else if(*status != 0) continue; /* search all the columns of the original grouping table and copy those to the new grouping table that were not part of the grouping convention. Note that is legal to have additional columns in a grouping table. Also note that the order of the columns may not be the same in the original and copied grouping table. */ /* retrieve the number of columns in the original and new group tables */ *status = fits_read_key_lng(infptr,"TFIELDS",&tfields,card,status); *status = fits_read_key_lng(outfptr,"TFIELDS",&newTfields,card,status); for(i = 1; i <= tfields; ++i) { sprintf(keyword,"TTYPE%d",i); *status = fits_read_key_str(infptr,keyword,keyvalue,card,status); if(*status == KEY_NO_EXIST) { *status = 0; keyvalue[0] = 0; } prepare_keyvalue(keyvalue); if(strcasecmp(keyvalue,"MEMBER_XTENSION") != 0 && strcasecmp(keyvalue,"MEMBER_NAME") != 0 && strcasecmp(keyvalue,"MEMBER_VERSION") != 0 && strcasecmp(keyvalue,"MEMBER_POSITION") != 0 && strcasecmp(keyvalue,"MEMBER_LOCATION") != 0 && strcasecmp(keyvalue,"MEMBER_URI_TYPE") != 0 ) { /* SPR 3956, add at the end of the table */ *status = fits_copy_col(infptr,outfptr,i,newTfields+1,1,status); ++newTfields; } } }while(0); if(mfptr != NULL) { fits_close_file(mfptr,status); } return(*status); } /*-------------------------------------------------------------------------- HDUtracker struct manipulation functions --------------------------------------------------------------------------*/ int fftsad(fitsfile *mfptr, /* pointer to an member HDU */ HDUtracker *HDU, /* pointer to an HDU tracker struct */ int *newPosition, /* new HDU position of the member HDU */ char *newFileName) /* file containing member HDU */ /* add an HDU to the HDUtracker struct pointed to by HDU. The HDU is only added if it does not already reside in the HDUtracker. If it already resides in the HDUtracker then the new HDU postion and file name are returned in newPosition and newFileName (if != NULL) */ { int i; int hdunum; int status = 0; char filename1[FLEN_FILENAME]; char filename2[FLEN_FILENAME]; do { /* retrieve the HDU's position within the FITS file */ fits_get_hdu_num(mfptr,&hdunum); /* retrieve the HDU's file name */ status = fits_file_name(mfptr,filename1,&status); /* parse the file name and construct the "standard" URL for it */ status = ffrtnm(filename1,filename2,&status); /* examine all the existing HDUs in the HDUtracker an see if this HDU has already been registered */ for(i = 0; i < HDU->nHDU && !(HDU->position[i] == hdunum && strcmp(HDU->filename[i],filename2) == 0); ++i); if(i != HDU->nHDU) { status = HDU_ALREADY_TRACKED; if(newPosition != NULL) *newPosition = HDU->newPosition[i]; if(newFileName != NULL) strcpy(newFileName,HDU->newFilename[i]); continue; } if(HDU->nHDU == MAX_HDU_TRACKER) { status = TOO_MANY_HDUS_TRACKED; continue; } HDU->filename[i] = (char*) malloc(FLEN_FILENAME * sizeof(char)); if(HDU->filename[i] == NULL) { status = MEMORY_ALLOCATION; continue; } HDU->newFilename[i] = (char*) malloc(FLEN_FILENAME * sizeof(char)); if(HDU->newFilename[i] == NULL) { status = MEMORY_ALLOCATION; free(HDU->filename[i]); continue; } HDU->position[i] = hdunum; HDU->newPosition[i] = hdunum; strcpy(HDU->filename[i],filename2); strcpy(HDU->newFilename[i],filename2); ++(HDU->nHDU); }while(0); return(status); } /*--------------------------------------------------------------------------*/ int fftsud(fitsfile *mfptr, /* pointer to an member HDU */ HDUtracker *HDU, /* pointer to an HDU tracker struct */ int newPosition, /* new HDU position of the member HDU */ char *newFileName) /* file containing member HDU */ /* update the HDU information in the HDUtracker struct pointed to by HDU. The HDU to update is pointed to by mfptr. If non-zero, the value of newPosition is used to update the HDU->newPosition[] value for the mfptr, and if non-NULL the newFileName value is used to update the HDU->newFilename[] value for mfptr. */ { int i; int hdunum; int status = 0; char filename1[FLEN_FILENAME]; char filename2[FLEN_FILENAME]; /* retrieve the HDU's position within the FITS file */ fits_get_hdu_num(mfptr,&hdunum); /* retrieve the HDU's file name */ status = fits_file_name(mfptr,filename1,&status); /* parse the file name and construct the "standard" URL for it */ status = ffrtnm(filename1,filename2,&status); /* examine all the existing HDUs in the HDUtracker an see if this HDU has already been registered */ for(i = 0; i < HDU->nHDU && !(HDU->position[i] == hdunum && strcmp(HDU->filename[i],filename2) == 0); ++i); /* if previously registered then change newPosition and newFileName */ if(i != HDU->nHDU) { if(newPosition != 0) HDU->newPosition[i] = newPosition; if(newFileName != NULL) { strcpy(HDU->newFilename[i],newFileName); } } else status = MEMBER_NOT_FOUND; return(status); } /*---------------------------------------------------------------------------*/ void prepare_keyvalue(char *keyvalue) /* string containing keyword value */ /* strip off all single quote characters "'" and blank spaces from a keyword value retrieved via fits_read_key*() routines this is necessary so that a standard comparision of keyword values may be made */ { int i; int length; /* strip off any leading or trailing single quotes (`) and (') from the keyword value */ length = strlen(keyvalue) - 1; if(keyvalue[0] == '\'' && keyvalue[length] == '\'') { for(i = 0; i < length - 1; ++i) keyvalue[i] = keyvalue[i+1]; keyvalue[length-1] = 0; } /* strip off any trailing blanks from the keyword value; note that if the keyvalue consists of nothing but blanks then no blanks are stripped */ length = strlen(keyvalue) - 1; for(i = 0; i < length && keyvalue[i] == ' '; ++i); if(i != length) { for(i = length; i >= 0 && keyvalue[i] == ' '; --i) keyvalue[i] = '\0'; } } /*--------------------------------------------------------------------------- Host dependent directory path to/from URL functions --------------------------------------------------------------------------*/ int fits_path2url(char *inpath, /* input file path string */ char *outpath, /* output file path string */ int *status) /* convert a file path into its Unix-style equivelent for URL purposes. Note that this process is platform dependent. This function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. The plaform dependant code is conditionally compiled depending upon the setting of the appropriate C preprocessor macros. */ { char buff[FLEN_FILENAME]; #if defined(WINNT) || defined(__WINNT__) /* Microsoft Windows NT case. We assume input file paths of the form: //disk/path/filename All path segments may be null, so that a single file name is the simplist case. The leading "//" becomes a single "/" if present. If no "//" is present, then make sure the resulting URL path is relative, i.e., does not begin with a "/". In other words, the only way that an absolute URL file path may be generated is if the drive specification is given. */ if(*status > 0) return(*status); if(inpath[0] == '/') { strcpy(buff,inpath+1); } else { strcpy(buff,inpath); } #elif defined(MSDOS) || defined(__WIN32__) || defined(WIN32) /* MSDOS or Microsoft windows/NT case. The assumed form of the input path is: disk:\path\filename All path segments may be null, so that a single file name is the simplist case. All back-slashes '\' become slashes '/'; if the path starts with a string of the form "X:" then it is replaced with "/X/" */ int i,j,k; int size; if(*status > 0) return(*status); for(i = 0, j = 0, size = strlen(inpath), buff[0] = 0; i < size; j = strlen(buff)) { switch(inpath[i]) { case ':': /* must be a disk desiginator; add a slash '/' at the start of outpath to designate that the path is absolute, then change the colon ':' to a slash '/' */ for(k = j; k >= 0; --k) buff[k+1] = buff[k]; buff[0] = '/'; strcat(buff,"/"); ++i; break; case '\\': /* just replace the '\' with a '/' IF its not the first character */ if(i != 0 && buff[(j == 0 ? 0 : j-1)] != '/') { buff[j] = '/'; buff[j+1] = 0; } ++i; break; default: /* copy the character from inpath to buff as is */ buff[j] = inpath[i]; buff[j+1] = 0; ++i; break; } } #elif defined(VMS) || defined(vms) || defined(__vms) /* VMS case. Assumed format of the input path is: node::disk:[path]filename.ext;version Any part of the file path may be missing, so that in the simplist case a single file name/extension is given. all brackets "[", "]" and dots "." become "/"; dashes "-" become "..", all single colons ":" become ":/", all double colons "::" become "FILE://" */ int i,j,k; int done; int size; if(*status > 0) return(*status); /* see if inpath contains a directory specification */ if(strchr(inpath,']') == NULL) done = 1; else done = 0; for(i = 0, j = 0, size = strlen(inpath), buff[0] = 0; i < size && j < FLEN_FILENAME - 8; j = strlen(buff)) { switch(inpath[i]) { case ':': /* must be a logical/symbol separator or (in the case of a double colon "::") machine node separator */ if(inpath[i+1] == ':') { /* insert a "FILE://" at the start of buff ==> machine given */ for(k = j; k >= 0; --k) buff[k+7] = buff[k]; strncpy(buff,"FILE://",7); i += 2; } else if(strstr(buff,"FILE://") == NULL) { /* insert a "/" at the start of buff ==> absolute path */ for(k = j; k >= 0; --k) buff[k+1] = buff[k]; buff[0] = '/'; ++i; } else ++i; /* a colon always ==> path separator */ strcat(buff,"/"); break; case ']': /* end of directory spec, file name spec begins after this */ done = 1; buff[j] = '/'; buff[j+1] = 0; ++i; break; case '[': /* begin directory specification; add a '/' only if the last char is not '/' */ if(i != 0 && buff[(j == 0 ? 0 : j-1)] != '/') { buff[j] = '/'; buff[j+1] = 0; } ++i; break; case '.': /* directory segment separator or file name/extension separator; we decide which by looking at the value of done */ if(!done) { /* must be a directory segment separator */ if(inpath[i-1] == '[') { strcat(buff,"./"); ++j; } else buff[j] = '/'; } else /* must be a filename/extension separator */ buff[j] = '.'; buff[j+1] = 0; ++i; break; case '-': /* a dash is the same as ".." in Unix speak, but lets make sure that its not part of the file name first! */ if(!done) /* must be part of the directory path specification */ strcat(buff,".."); else { /* the dash is part of the filename, so just copy it as is */ buff[j] = '-'; buff[j+1] = 0; } ++i; break; default: /* nothing special, just copy the character as is */ buff[j] = inpath[i]; buff[j+1] = 0; ++i; break; } } if(j > FLEN_FILENAME - 8) { *status = URL_PARSE_ERROR; ffpmsg("resulting path to URL conversion too big (fits_path2url)"); } #elif defined(macintosh) /* MacOS case. The assumed form of the input path is: disk:path:filename It is assumed that all paths are absolute with disk and path specified, unless no colons ":" are supplied with the string ==> a single file name only. All colons ":" become slashes "/", and if one or more colon is encountered then the path is specified as absolute. */ int i,j,k; int firstColon; int size; if(*status > 0) return(*status); for(i = 0, j = 0, firstColon = 1, size = strlen(inpath), buff[0] = 0; i < size; j = strlen(buff)) { switch(inpath[i]) { case ':': /* colons imply path separators. If its the first colon encountered then assume that its the disk designator and add a slash to the beginning of the buff string */ if(firstColon) { firstColon = 0; for(k = j; k >= 0; --k) buff[k+1] = buff[k]; buff[0] = '/'; } /* all colons become slashes */ strcat(buff,"/"); ++i; break; default: /* copy the character from inpath to buff as is */ buff[j] = inpath[i]; buff[j+1] = 0; ++i; break; } } #else /* Default Unix case. Nothing special to do here except to remove the double or more // and replace them with single / */ int ii = 0; int jj = 0; if(*status > 0) return(*status); while (inpath[ii]) { if (inpath[ii] == '/' && inpath[ii+1] == '/') { /* do nothing */ } else { buff[jj] = inpath[ii]; jj++; } ii++; } buff[jj] = '\0'; /* printf("buff is %s\ninpath is %s\n",buff,inpath); */ /* strcpy(buff,inpath); */ #endif /* encode all "unsafe" and "reserved" URL characters */ *status = fits_encode_url(buff,outpath,status); return(*status); } /*---------------------------------------------------------------------------*/ int fits_url2path(char *inpath, /* input file path string */ char *outpath, /* output file path string */ int *status) /* convert a Unix-style URL into a platform dependent directory path. Note that this process is platform dependent. This function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. Each platform dependent code segment is conditionally compiled depending upon the setting of the appropriate C preprocesser macros. */ { char buff[FLEN_FILENAME]; int absolute; #if defined(MSDOS) || defined(__WIN32__) || defined(WIN32) char *tmpStr; #elif defined(VMS) || defined(vms) || defined(__vms) int i; char *tmpStr; #elif defined(macintosh) char *tmpStr; #endif if(*status != 0) return(*status); /* make a copy of the inpath so that we can manipulate it */ strcpy(buff,inpath); /* convert any encoded characters to their unencoded values */ *status = fits_unencode_url(inpath,buff,status); /* see if the URL is given as absolute w.r.t. the "local" file system */ if(buff[0] == '/') absolute = 1; else absolute = 0; #if defined(WINNT) || defined(__WINNT__) /* Microsoft Windows NT case. We create output paths of the form //disk/path/filename All path segments but the last may be null, so that a single file name is the simplist case. */ if(absolute) { strcpy(outpath,"/"); strcat(outpath,buff); } else { strcpy(outpath,buff); } #elif defined(MSDOS) || defined(__WIN32__) || defined(WIN32) /* MSDOS or Microsoft windows/NT case. The output path will be of the form disk:\path\filename All path segments but the last may be null, so that a single file name is the simplist case. */ /* separate the URL into tokens at each slash '/' and process until all tokens have been examined */ for(tmpStr = strtok(buff,"/"), outpath[0] = 0; tmpStr != NULL; tmpStr = strtok(NULL,"/")) { strcat(outpath,tmpStr); /* if the absolute flag is set then process the token as a disk specification; else just process it as a directory path or filename */ if(absolute) { strcat(outpath,":\\"); absolute = 0; } else strcat(outpath,"\\"); } /* remove the last "\" from the outpath, it does not belong there */ outpath[strlen(outpath)-1] = 0; #elif defined(VMS) || defined(vms) || defined(__vms) /* VMS case. The output path will be of the form: node::disk:[path]filename.ext;version Any part of the file path may be missing execpt filename.ext, so that in the simplist case a single file name/extension is given. if the path is specified as relative starting with "./" then the first part of the VMS path is "[.". If the path is relative and does not start with "./" (e.g., "a/b/c") then the VMS path is constructed as "[a.b.c]" */ /* separate the URL into tokens at each slash '/' and process until all tokens have been examined */ for(tmpStr = strtok(buff,"/"), outpath[0] = 0; tmpStr != NULL; tmpStr = strtok(NULL,"/")) { if(strcasecmp(tmpStr,"FILE:") == 0) { /* the next token should contain the DECnet machine name */ tmpStr = strtok(NULL,"/"); if(tmpStr == NULL) continue; strcat(outpath,tmpStr); strcat(outpath,"::"); /* set the absolute flag to true for the next token */ absolute = 1; } else if(strcmp(tmpStr,"..") == 0) { /* replace all Unix-like ".." with VMS "-" */ if(strlen(outpath) == 0) strcat(outpath,"["); strcat(outpath,"-."); } else if(strcmp(tmpStr,".") == 0 && strlen(outpath) == 0) { /* must indicate a relative path specifier */ strcat(outpath,"[."); } else if(strchr(tmpStr,'.') != NULL) { /* must be up to the file name; turn the last "." path separator into a "]" and then add the file name to the outpath */ i = strlen(outpath); if(i > 0 && outpath[i-1] == '.') outpath[i-1] = ']'; strcat(outpath,tmpStr); } else { /* process the token as a a directory path segement */ if(absolute) { /* treat the token as a disk specifier */ absolute = 0; strcat(outpath,tmpStr); strcat(outpath,":["); } else if(strlen(outpath) == 0) { /* treat the token as the first directory path specifier */ strcat(outpath,"["); strcat(outpath,tmpStr); strcat(outpath,"."); } else { /* treat the token as an imtermediate path specifier */ strcat(outpath,tmpStr); strcat(outpath,"."); } } } #elif defined(macintosh) /* MacOS case. The output path will be of the form disk:path:filename All path segments but the last may be null, so that a single file name is the simplist case. */ /* separate the URL into tokens at each slash '/' and process until all tokens have been examined */ for(tmpStr = strtok(buff,"/"), outpath[0] = 0; tmpStr != NULL; tmpStr = strtok(NULL,"/")) { strcat(outpath,tmpStr); strcat(outpath,":"); } /* remove the last ":" from the outpath, it does not belong there */ outpath[strlen(outpath)-1] = 0; #else /* Default Unix case. Nothing special to do here */ strcpy(outpath,buff); #endif return(*status); } /****************************************************************************/ int fits_get_cwd(char *cwd, /* IO current working directory string */ int *status) /* retrieve the string containing the current working directory absolute path in Unix-like URL standard notation. It is assumed that the CWD string has a size of at least FLEN_FILENAME. Note that this process is platform dependent. This function supports Unix, MSDOS/WIN32, VMS and Macintosh platforms. Each platform dependent code segment is conditionally compiled depending upon the setting of the appropriate C preprocesser macros. */ { char buff[FLEN_FILENAME]; if(*status != 0) return(*status); #if defined(macintosh) /* MacOS case. Currently unknown !!!! */ *buff = 0; #else /* Good old getcwd() seems to work with all other platforms */ getcwd(buff,FLEN_FILENAME); #endif /* convert the cwd string to a URL standard path string */ fits_path2url(buff,cwd,status); return(*status); } /*---------------------------------------------------------------------------*/ int fits_get_url(fitsfile *fptr, /* I ptr to FITS file to evaluate */ char *realURL, /* O URL of real FITS file */ char *startURL, /* O URL of starting FITS file */ char *realAccess, /* O true access method of FITS file */ char *startAccess,/* O "official" access of FITS file */ int *iostate, /* O can this file be modified? */ int *status) /* For grouping convention purposes, determine the URL of the FITS file associated with the fitsfile pointer fptr. The true access type (file://, mem://, shmem://, root://), starting "official" access type, and iostate (0 ==> readonly, 1 ==> readwrite) are also returned. It is assumed that the url string has enough room to hold the resulting URL, and the the accessType string has enough room to hold the access type. */ { int i; int tmpIOstate = 0; char infile[FLEN_FILENAME]; char outfile[FLEN_FILENAME]; char tmpStr1[FLEN_FILENAME]; char tmpStr2[FLEN_FILENAME]; char tmpStr3[FLEN_FILENAME]; char tmpStr4[FLEN_FILENAME]; char *tmpPtr; if(*status != 0) return(*status); do { /* retrieve the member HDU's file name as opened by ffopen() and parse it into its constitutent pieces; get the currently active driver token too */ *tmpStr1 = *tmpStr2 = *tmpStr3 = *tmpStr4 = 0; *status = fits_file_name(fptr,tmpStr1,status); *status = ffiurl(tmpStr1,NULL,infile,outfile,NULL,tmpStr2,tmpStr3, tmpStr4,status); if((*tmpStr2) || (*tmpStr3) || (*tmpStr4)) tmpIOstate = -1; *status = ffurlt(fptr,tmpStr3,status); strcpy(tmpStr4,tmpStr3); *status = ffrtnm(tmpStr1,tmpStr2,status); strcpy(tmpStr1,tmpStr2); /* for grouping convention purposes (only) determine the URL of the actual FITS file being used for the given fptr, its true access type (file://, mem://, shmem://, root://) and its iostate (0 ==> read only, 1 ==> readwrite) */ /* The first set of access types are "simple" in that they do not use any redirection to temporary memory or outfiles */ /* standard disk file driver is in use */ if(strcasecmp(tmpStr3,"file://") == 0) { tmpIOstate = 1; if(strlen(outfile)) strcpy(tmpStr1,outfile); else *tmpStr2 = 0; /* make sure no FILE:// specifier is given in the tmpStr1 or tmpStr2 strings; the convention calls for local files to have no access specification */ if((tmpPtr = strstr(tmpStr1,"://")) != NULL) { strcpy(infile,tmpPtr+3); strcpy(tmpStr1,infile); } if((tmpPtr = strstr(tmpStr2,"://")) != NULL) { strcpy(infile,tmpPtr+3); strcpy(tmpStr2,infile); } } /* file stored in conventional memory */ else if(strcasecmp(tmpStr3,"mem://") == 0) { if(tmpIOstate < 0) { /* file is a temp mem file only */ ffpmsg("cannot make URL from temp MEM:// file (fits_get_url)"); *status = URL_PARSE_ERROR; } else { /* file is a "perminate" mem file for this process */ tmpIOstate = 1; *tmpStr2 = 0; } } /* file stored in conventional memory */ else if(strcasecmp(tmpStr3,"memkeep://") == 0) { strcpy(tmpStr3,"mem://"); *tmpStr4 = 0; *tmpStr2 = 0; tmpIOstate = 1; } /* file residing in shared memory */ else if(strcasecmp(tmpStr3,"shmem://") == 0) { *tmpStr4 = 0; *tmpStr2 = 0; tmpIOstate = 1; } /* file accessed via the ROOT network protocol */ else if(strcasecmp(tmpStr3,"root://") == 0) { *tmpStr4 = 0; *tmpStr2 = 0; tmpIOstate = 1; } /* the next set of access types redirect the contents of the original file to an special outfile because the original could not be directly modified (i.e., resides on the network, was compressed). In these cases the URL string takes on the value of the OUTFILE, the access type becomes file://, and the iostate is set to 1 (can read/write to the file). */ /* compressed file uncompressed and written to disk */ else if(strcasecmp(tmpStr3,"compressfile://") == 0) { strcpy(tmpStr1,outfile); strcpy(tmpStr2,infile); strcpy(tmpStr3,"file://"); strcpy(tmpStr4,"file://"); tmpIOstate = 1; } /* HTTP accessed file written locally to disk */ else if(strcasecmp(tmpStr3,"httpfile://") == 0) { strcpy(tmpStr1,outfile); strcpy(tmpStr3,"file://"); strcpy(tmpStr4,"http://"); tmpIOstate = 1; } /* FTP accessd file written locally to disk */ else if(strcasecmp(tmpStr3,"ftpfile://") == 0) { strcpy(tmpStr1,outfile); strcpy(tmpStr3,"file://"); strcpy(tmpStr4,"ftp://"); tmpIOstate = 1; } /* file from STDIN written to disk */ else if(strcasecmp(tmpStr3,"stdinfile://") == 0) { strcpy(tmpStr1,outfile); strcpy(tmpStr3,"file://"); strcpy(tmpStr4,"stdin://"); tmpIOstate = 1; } /* the following access types use memory resident files as temporary storage; they cannot be modified or be made group members for grouping conventions purposes, but their original files can be. Thus, their tmpStr3s are reset to mem://, their iostate values are set to 0 (for no-modification), and their URL string values remain set to their original values */ /* compressed disk file uncompressed into memory */ else if(strcasecmp(tmpStr3,"compress://") == 0) { *tmpStr1 = 0; strcpy(tmpStr2,infile); strcpy(tmpStr3,"mem://"); strcpy(tmpStr4,"file://"); tmpIOstate = 0; } /* HTTP accessed file transferred into memory */ else if(strcasecmp(tmpStr3,"http://") == 0) { *tmpStr1 = 0; strcpy(tmpStr3,"mem://"); strcpy(tmpStr4,"http://"); tmpIOstate = 0; } /* HTTP accessed compressed file transferred into memory */ else if(strcasecmp(tmpStr3,"httpcompress://") == 0) { *tmpStr1 = 0; strcpy(tmpStr3,"mem://"); strcpy(tmpStr4,"http://"); tmpIOstate = 0; } /* FTP accessed file transferred into memory */ else if(strcasecmp(tmpStr3,"ftp://") == 0) { *tmpStr1 = 0; strcpy(tmpStr3,"mem://"); strcpy(tmpStr4,"ftp://"); tmpIOstate = 0; } /* FTP accessed compressed file transferred into memory */ else if(strcasecmp(tmpStr3,"ftpcompress://") == 0) { *tmpStr1 = 0; strcpy(tmpStr3,"mem://"); strcpy(tmpStr4,"ftp://"); tmpIOstate = 0; } /* The last set of access types cannot be used to make a meaningful URL strings from; thus an error is generated */ else if(strcasecmp(tmpStr3,"stdin://") == 0) { *status = URL_PARSE_ERROR; ffpmsg("cannot make vaild URL from stdin:// (fits_get_url)"); *tmpStr1 = *tmpStr2 = 0; } else if(strcasecmp(tmpStr3,"stdout://") == 0) { *status = URL_PARSE_ERROR; ffpmsg("cannot make vaild URL from stdout:// (fits_get_url)"); *tmpStr1 = *tmpStr2 = 0; } else if(strcasecmp(tmpStr3,"irafmem://") == 0) { *status = URL_PARSE_ERROR; ffpmsg("cannot make vaild URL from irafmem:// (fits_get_url)"); *tmpStr1 = *tmpStr2 = 0; } if(*status != 0) continue; /* assign values to the calling parameters if they are non-NULL */ if(realURL != NULL) { if(strlen(tmpStr1) == 0) *realURL = 0; else { if((tmpPtr = strstr(tmpStr1,"://")) != NULL) { tmpPtr += 3; i = (long)tmpPtr - (long)tmpStr1; strncpy(realURL,tmpStr1,i); } else { tmpPtr = tmpStr1; i = 0; } *status = fits_path2url(tmpPtr,realURL+i,status); } } if(startURL != NULL) { if(strlen(tmpStr2) == 0) *startURL = 0; else { if((tmpPtr = strstr(tmpStr2,"://")) != NULL) { tmpPtr += 3; i = (long)tmpPtr - (long)tmpStr2; strncpy(startURL,tmpStr2,i); } else { tmpPtr = tmpStr2; i = 0; } *status = fits_path2url(tmpPtr,startURL+i,status); } } if(realAccess != NULL) strcpy(realAccess,tmpStr3); if(startAccess != NULL) strcpy(startAccess,tmpStr4); if(iostate != NULL) *iostate = tmpIOstate; }while(0); return(*status); } /*-------------------------------------------------------------------------- URL parse support functions --------------------------------------------------------------------------*/ /* simple push/pop/shift/unshift string stack for use by fits_clean_url */ typedef char* grp_stack_data; /* type of data held by grp_stack */ typedef struct grp_stack_item_struct { grp_stack_data data; /* value of this stack item */ struct grp_stack_item_struct* next; /* next stack item */ struct grp_stack_item_struct* prev; /* previous stack item */ } grp_stack_item; typedef struct grp_stack_struct { size_t stack_size; /* number of items on stack */ grp_stack_item* top; /* top item */ } grp_stack; static char* grp_stack_default = NULL; /* initial value for new instances of grp_stack_data */ /* the following functions implement the group string stack grp_stack */ static void delete_grp_stack(grp_stack** mystack); static grp_stack_item* grp_stack_append( grp_stack_item* last, grp_stack_data data ); static grp_stack_data grp_stack_remove(grp_stack_item* last); static grp_stack* new_grp_stack(void); static grp_stack_data pop_grp_stack(grp_stack* mystack); static void push_grp_stack(grp_stack* mystack, grp_stack_data data); static grp_stack_data shift_grp_stack(grp_stack* mystack); /* static void unshift_grp_stack(grp_stack* mystack, grp_stack_data data); */ int fits_clean_url(char *inURL, /* I input URL string */ char *outURL, /* O output URL string */ int *status) /* clean the URL by eliminating any ".." or "." specifiers in the inURL string, and write the output to the outURL string. Note that this function must have a valid Unix-style URL as input; platform dependent path strings are not allowed. */ { grp_stack* mystack; /* stack to hold pieces of URL */ char* tmp; if(*status) return *status; mystack = new_grp_stack(); *outURL = 0; do { /* handle URL scheme and domain if they exist */ tmp = strstr(inURL, "://"); if(tmp) { /* there is a URL scheme, so look for the end of the domain too */ tmp = strchr(tmp + 3, '/'); if(tmp) { /* tmp is now the end of the domain, so * copy URL scheme and domain as is, and terminate by hand */ size_t string_size = (size_t) (tmp - inURL); strncpy(outURL, inURL, string_size); outURL[string_size] = 0; /* now advance the input pointer to just after the domain and go on */ inURL = tmp; } else { /* '/' was not found, which means there are no path-like * portions, so copy whole inURL to outURL and we're done */ strcpy(outURL, inURL); continue; /* while(0) */ } } /* explicitly copy a leading / (absolute path) */ if('/' == *inURL) strcat(outURL, "/"); /* now clean the remainder of the inURL. push URL segments onto * stack, dealing with .. and . as we go */ tmp = strtok(inURL, "/"); /* finds first / */ while(tmp) { if(!strcmp(tmp, "..")) { /* discard previous URL segment, if there was one. if not, * add the .. to the stack if this is *not* an absolute path * (for absolute paths, leading .. has no effect, so skip it) */ if(0 < mystack->stack_size) pop_grp_stack(mystack); else if('/' != *inURL) push_grp_stack(mystack, tmp); } else { /* always just skip ., but otherwise add segment to stack */ if(strcmp(tmp, ".")) push_grp_stack(mystack, tmp); } tmp = strtok(NULL, "/"); /* get the next segment */ } /* stack now has pieces of cleaned URL, so just catenate them * onto output string until stack is empty */ while(0 < mystack->stack_size) { tmp = shift_grp_stack(mystack); strcat(outURL, tmp); strcat(outURL, "/"); } outURL[strlen(outURL) - 1] = 0; /* blank out trailing / */ } while(0); delete_grp_stack(&mystack); return *status; } /* free all stack contents using pop_grp_stack before freeing the * grp_stack itself */ static void delete_grp_stack(grp_stack** mystack) { if(!mystack || !*mystack) return; while((*mystack)->stack_size) pop_grp_stack(*mystack); free(*mystack); *mystack = NULL; } /* append an item to the stack, handling the special case of the first * item appended */ static grp_stack_item* grp_stack_append( grp_stack_item* last, grp_stack_data data ) { /* first create a new stack item, and copy data to it */ grp_stack_item* new_item = (grp_stack_item*) malloc(sizeof(grp_stack_item)); new_item->data = data; if(last) { /* attach this item between the "last" item and its "next" item */ new_item->next = last->next; new_item->prev = last; last->next->prev = new_item; last->next = new_item; } else { /* stack is empty, so "next" and "previous" both point back to it */ new_item->next = new_item; new_item->prev = new_item; } return new_item; } /* remove an item from the stack, handling the special case of the last * item removed */ static grp_stack_data grp_stack_remove(grp_stack_item* last) { grp_stack_data retval = last->data; last->prev->next = last->next; last->next->prev = last->prev; free(last); return retval; } /* create new stack dynamically, and give it valid initial values */ static grp_stack* new_grp_stack(void) { grp_stack* retval = (grp_stack*) malloc(sizeof(grp_stack)); if(retval) { retval->stack_size = 0; retval->top = NULL; } return retval; } /* return the value at the top of the stack and remove it, updating * stack_size. top->prev becomes the new "top" */ static grp_stack_data pop_grp_stack(grp_stack* mystack) { grp_stack_data retval = grp_stack_default; if(mystack && mystack->top) { grp_stack_item* newtop = mystack->top->prev; retval = grp_stack_remove(mystack->top); mystack->top = newtop; if(0 == --mystack->stack_size) mystack->top = NULL; } return retval; } /* add to the stack after the top element. the added element becomes * the new "top" */ static void push_grp_stack(grp_stack* mystack, grp_stack_data data) { if(!mystack) return; mystack->top = grp_stack_append(mystack->top, data); ++mystack->stack_size; return; } /* return the value at the bottom of the stack and remove it, updating * stack_size. "top" pointer is unaffected */ static grp_stack_data shift_grp_stack(grp_stack* mystack) { grp_stack_data retval = grp_stack_default; if(mystack && mystack->top) { retval = grp_stack_remove(mystack->top->next); /* top->next == bottom */ if(0 == --mystack->stack_size) mystack->top = NULL; } return retval; } /* add to the stack after the top element. "top" is unaffected, except * in the special case of an initially empty stack */ /* static void unshift_grp_stack(grp_stack* mystack, grp_stack_data data) { if(!mystack) return; if(mystack->top) grp_stack_append(mystack->top, data); else mystack->top = grp_stack_append(NULL, data); ++mystack->stack_size; return; } */ /*--------------------------------------------------------------------------*/ int fits_url2relurl(char *refURL, /* I reference URL string */ char *absURL, /* I absoulute URL string to process */ char *relURL, /* O resulting relative URL string */ int *status) /* create a relative URL to the file referenced by absURL with respect to the reference URL refURL. The relative URL is returned in relURL. Both refURL and absURL must be absolute URL strings; i.e. either begin with an access method specification "XXX://" or with a '/' character signifiying that they are absolute file paths. Note that it is possible to make a relative URL from two input URLs (absURL and refURL) that are not compatable. This function does not check to see if the resulting relative URL makes any sence. For instance, it is impossible to make a relative URL from the following two inputs: absURL = ftp://a.b.c.com/x/y/z/foo.fits refURL = /a/b/c/ttt.fits The resulting relURL will be: ../../../ftp://a.b.c.com/x/y/z/foo.fits Which is syntically correct but meaningless. The problem is that a file with an access method of ftp:// cannot be expressed a a relative URL to a local disk file. */ { int i,j; int refcount,abscount; int refsize,abssize; int done; if(*status != 0) return(*status); /* initialize the relative URL string */ relURL[0] = 0; do { /* refURL and absURL must be absolute to process */ if(!(fits_is_url_absolute(refURL) || *refURL == '/') || !(fits_is_url_absolute(absURL) || *absURL == '/')) { *status = URL_PARSE_ERROR; ffpmsg("Cannot make rel. URL from non abs. URLs (fits_url2relurl)"); continue; } /* determine the size of the refURL and absURL strings */ refsize = strlen(refURL); abssize = strlen(absURL); /* process the two URL strings and build the relative URL between them */ for(done = 0, refcount = 0, abscount = 0; !done && refcount < refsize && abscount < abssize; ++refcount, ++abscount) { for(; abscount < abssize && absURL[abscount] == '/'; ++abscount); for(; refcount < refsize && refURL[refcount] == '/'; ++refcount); /* find the next path segment in absURL */ for(i = abscount; absURL[i] != '/' && i < abssize; ++i); /* find the next path segment in refURL */ for(j = refcount; refURL[j] != '/' && j < refsize; ++j); /* do the two path segments match? */ if(i == j && strncmp(absURL+abscount, refURL+refcount,i-refcount) == 0) { /* they match, so ignore them and continue */ abscount = i; refcount = j; continue; } /* We found a difference in the paths in refURL and absURL. For every path segment remaining in the refURL string, append a "../" path segment to the relataive URL relURL. */ for(j = refcount; j < refsize; ++j) if(refURL[j] == '/') strcat(relURL,"../"); /* copy all remaining characters of absURL to the output relURL */ strcat(relURL,absURL+abscount); /* we are done building the relative URL */ done = 1; } }while(0); return(*status); } /*--------------------------------------------------------------------------*/ int fits_relurl2url(char *refURL, /* I reference URL string */ char *relURL, /* I relative URL string to process */ char *absURL, /* O absolute URL string */ int *status) /* create an absolute URL from a relative url and a reference URL. The reference URL is given by the FITS file pointed to by fptr. The construction of the absolute URL from the partial and reference URl is performed using the rules set forth in: http://www.w3.org/Addressing/URL/URL_TOC.html and http://www.w3.org/Addressing/URL/4_3_Partial.html Note that the relative URL string relURL must conform to the Unix-like URL syntax; host dependent partial URL strings are not allowed. */ { int i; char tmpStr[FLEN_FILENAME]; char *tmpStr1, *tmpStr2; if(*status != 0) return(*status); do { /* make a copy of the reference URL string refURL for parsing purposes */ strcpy(tmpStr,refURL); /* if the reference file has an access method of mem:// or shmem:// then we cannot use it as the basis of an absolute URL construction for a partial URL */ if(strncasecmp(tmpStr,"MEM:",4) == 0 || strncasecmp(tmpStr,"SHMEM:",6) == 0) { ffpmsg("ref URL has access mem:// or shmem:// (fits_relurl2url)"); ffpmsg(" cannot construct full URL from a partial URL and "); ffpmsg(" MEM/SHMEM base URL"); *status = URL_PARSE_ERROR; continue; } if(relURL[0] != '/') { /* just append the relative URL string to the reference URL string (minus the reference URL file name) to form the absolute URL string */ tmpStr1 = strrchr(tmpStr,'/'); if(tmpStr1 != NULL) tmpStr1[1] = 0; else tmpStr[0] = 0; strcat(tmpStr,relURL); } else { /* have to parse the refURL string for the first occurnace of the same number of '/' characters as contained in the beginning of location that is not followed by a greater number of consective '/' charaters (yes, that is a confusing statement); this is the location in the refURL string where the relURL string is to be appended to form the new absolute URL string */ /* first, build up a slash pattern string that has one more slash in it than the starting slash pattern of the relURL string */ strcpy(absURL,"/"); for(i = 0; relURL[i] == '/'; ++i) strcat(absURL,"/"); /* loop over the refURL string until the slash pattern stored in absURL is no longer found */ for(tmpStr1 = tmpStr, i = strlen(absURL); (tmpStr2 = strstr(tmpStr1,absURL)) != NULL; tmpStr1 = tmpStr2 + i); /* reduce the slash pattern string by one slash */ absURL[i-1] = 0; /* search for the slash pattern in the remaining portion of the refURL string */ tmpStr2 = strstr(tmpStr1,absURL); /* if no slash pattern match was found */ if(tmpStr2 == NULL) { /* just strip off the file name from the refURL */ tmpStr2 = strrchr(tmpStr1,'/'); if(tmpStr2 != NULL) tmpStr2[0] = 0; else tmpStr[0] = 0; } else { /* set a string terminator at the slash pattern match */ *tmpStr2 = 0; } /* conatenate the relURL string to the refURL string to form the absURL */ strcat(tmpStr,relURL); } /* normalize the absURL by removing any ".." or "." specifiers in the string */ *status = fits_clean_url(tmpStr,absURL,status); }while(0); return(*status); } /*--------------------------------------------------------------------------*/ int fits_encode_url(char *inpath, /* I URL to be encoded */ char *outpath, /* O output encoded URL */ int *status) /* encode all URL "unsafe" and "reserved" characters using the "%XX" convention, where XX stand for the two hexidecimal digits of the encode character's ASCII code. Note that the output path is at least as large as, if not larger than the input path, so that OUTPATH should be passed to this function with room for growth. If not a runtime error could result. It is assumed that OUTPATH has been allocated with enough room to hold the resulting encoded URL. This function was adopted from code in the libwww.a library available via the W3 consortium */ { unsigned char a; char *p; char *q; char *hex = "0123456789ABCDEF"; unsigned const char isAcceptable[96] = {/* 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA 0xB 0xC 0xD 0xE 0xF */ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xF,0xE,0x0,0xF,0xF,0xC, /* 2x !"#$%&'()*+,-./ */ 0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x8,0x0,0x0,0x0,0x0,0x0, /* 3x 0123456789:;<=>? */ 0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF, /* 4x @ABCDEFGHIJKLMNO */ 0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x0,0x0,0x0,0x0,0xF, /* 5X PQRSTUVWXYZ[\]^_ */ 0x0,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF, /* 6x `abcdefghijklmno */ 0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0xF,0x0,0x0,0x0,0x0,0x0 /* 7X pqrstuvwxyz{\}~DEL */ }; if(*status != 0) return(*status); /* loop over all characters in inpath until '\0' is encountered */ for(q = outpath, p = inpath; *p; p++) { a = (unsigned char)*p; /* if the charcter requires encoding then process it */ if(!( a>=32 && a<128 && (isAcceptable[a-32]))) { /* add a '%' character to the outpath */ *q++ = HEX_ESCAPE; /* add the most significant ASCII code hex value */ *q++ = hex[a >> 4]; /* add the least significant ASCII code hex value */ *q++ = hex[a & 15]; } /* else just copy the character as is */ else *q++ = *p; } /* null terminate the outpath string */ *q++ = 0; return(*status); } /*---------------------------------------------------------------------------*/ int fits_unencode_url(char *inpath, /* I input URL with encoding */ char *outpath, /* O unencoded URL */ int *status) /* unencode all URL "unsafe" and "reserved" characters to their actual ASCII representation. All tokens of the form "%XX" where XX is the hexidecimal code for an ASCII character, are searched for and translated into the actuall ASCII character (so three chars become 1 char). It is assumed that OUTPATH has enough room to hold the unencoded URL. This function was adopted from code in the libwww.a library available via the W3 consortium */ { char *p; char *q; char c; if(*status != 0) return(*status); p = inpath; q = outpath; /* loop over all characters in the inpath looking for the '%' escape character; if found the process the escape sequence */ while(*p != 0) { /* if the character is '%' then unencode the sequence, else just copy the character from inpath to outpath */ if (*p == HEX_ESCAPE) { if((c = *(++p)) != 0) { *q = ( (c >= '0' && c <= '9') ? (c - '0') : ((c >= 'A' && c <= 'F') ? (c - 'A' + 10) : (c - 'a' + 10)) )*16; if((c = *(++p)) != 0) { *q = *q + ( (c >= '0' && c <= '9') ? (c - '0') : ((c >= 'A' && c <= 'F') ? (c - 'A' + 10) : (c - 'a' + 10)) ); p++, q++; } } } else *q++ = *p++; } /* terminate the outpath */ *q = 0; return(*status); } /*---------------------------------------------------------------------------*/ int fits_is_url_absolute(char *url) /* Return a True (1) or False (0) value indicating whether or not the passed URL string contains an access method specifier or not. Note that this is a boolean function and it neither reads nor returns the standard error status parameter */ { char *tmpStr1, *tmpStr2; char reserved[] = {':',';','/','?','@','&','=','+','$',','}; /* The rule for determing if an URL is relative or absolute is that it (1) must have a colon ":" and (2) that the colon must appear before any other reserved URL character in the URL string. We first see if a colon exists, get its position in the string, and then check to see if any of the other reserved characters exists and if their position in the string is greater than that of the colons. */ if( (tmpStr1 = strchr(url,reserved[0])) != NULL && ((tmpStr2 = strchr(url,reserved[1])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[2])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[3])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[4])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[5])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[6])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[7])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[8])) == NULL || tmpStr2 > tmpStr1) && ((tmpStr2 = strchr(url,reserved[9])) == NULL || tmpStr2 > tmpStr1) ) { return(1); } else { return(0); } } astropy-0.3/cextern/cfitsio/uncompr.c0000644000175000017500000000367112243255342016145 0ustar oleole/* uncompr.c -- decompress a memory buffer * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ #define ZLIB_INTERNAL #include "zlib.h" /* =========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ int ZEXPORT uncompress (dest, destLen, source, sourceLen) Bytef *dest; uLongf *destLen; const Bytef *source; uLong sourceLen; { z_stream stream; int err; stream.next_in = (Bytef*)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; stream.next_out = dest; stream.avail_out = (uInt)*destLen; if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; err = inflateInit(&stream); if (err != Z_OK) return err; err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { inflateEnd(&stream); if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) return Z_DATA_ERROR; return err; } *destLen = stream.total_out; err = inflateEnd(&stream); return err; } astropy-0.3/cextern/cfitsio/putcoll.c0000644000175000017500000003264112243255342016143 0ustar oleole/* This file, putcoll.c, contains routines that write data elements to */ /* a FITS image or table, with logical datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpcll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ char *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of logical values to a column in the current FITS HDU. */ { int tcode, maxelem, hdutype; long twidth, incre; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], ctrue = 'T', cfalse = 'F'; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ if (*status > 0) /* inherit input status value if > 0 */ return(*status); /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode != TLOGICAL) return(*status = NOT_LOGICAL_COL); /*---------------------------------------------------------------------*/ /* Now write the logical values one at a time to the FITS column. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { wrtptr = startpos + (rowlen * rownum) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ if (array[next]) ffpbyt(fptr, 1, &ctrue, status); else ffpbyt(fptr, 1, &cfalse, status); if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing element %.0f of input array of logicals (ffpcll).", (double) (next+1)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain--; if (remain) { next++; elemnum++; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ char *array, /* I - array of values to write */ char nulvalue, /* I - array flagging undefined pixels if true */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels flagged as null will be replaced by the appropriate null value in the output FITS file. */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* first write the whole input vector, then go back and fill in the nulls */ if (ffpcll(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) return(*status); /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ /* good values have already been written if (ffpcll(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) return(*status); */ ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ /* these have already been written ffpcll(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); */ } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpclx( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG frow, /* I - first row to write (1 = 1st row) */ long fbit, /* I - first bit to write (1 = 1st) */ long nbit, /* I - number of bits to write */ char *larray, /* I - array of logicals corresponding to bits */ int *status) /* IO - error status */ /* write an array of logical values to a specified bit or byte column of the binary table. If larray is TRUE, then the corresponding bit is set to 1, otherwise it is set to 0. The binary table column being written to must have datatype 'B' or 'X'. */ { LONGLONG offset, bstart, repeat, rowlen, elemnum, rstart, estart, tnull; long fbyte, lbyte, nbyte, bitloc, ndone; long ii, twidth, incre; int tcode, descrp, maxelem, hdutype; double dummyd; char tform[12], snull[12]; unsigned char cbuff; static unsigned char onbit[8] = {128, 64, 32, 16, 8, 4, 2, 1}; static unsigned char offbit[8] = {127, 191, 223, 239, 247, 251, 253, 254}; tcolumn *colptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check input parameters */ if (nbit < 1) return(*status); else if (frow < 1) return(*status = BAD_ROW_NUM); else if (fbit < 1) return(*status = BAD_ELEM_NUM); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); fbyte = (fbit + 7) / 8; lbyte = (fbit + nbit + 6) / 8; nbyte = lbyte - fbyte +1; /* Save the current heapsize; ffgcprll will increment the value if */ /* we are writing to a variable length column. */ offset = (fptr->Fptr)->heapsize; /* call ffgcprll in case we are writing beyond the current end of */ /* the table; it will allocate more space and shift any following */ /* HDU's. Otherwise, we have little use for most of the returned */ /* parameters, therefore just use dummy parameters. */ if (ffgcprll( fptr, colnum, frow, fbyte, nbyte, 1, &dummyd, &dummyd, tform, &twidth, &tcode, &maxelem, &bstart, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); bitloc = fbit - 1 - ((fbit - 1) / 8 * 8); ndone = 0; rstart = frow - 1; estart = fbyte - 1; colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (abs(tcode) > TBYTE) return(*status = NOT_LOGICAL_COL); /* not correct datatype column */ if (tcode > 0) { descrp = FALSE; /* not a variable length descriptor column */ repeat = colptr->trepeat; if (tcode == TBIT) repeat = (repeat + 7) / 8; /* convert from bits to bytes */ if (fbyte > repeat) return(*status = BAD_ELEM_NUM); /* calc the i/o pointer location to start of sequence of pixels */ bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) + colptr->tbcol + estart; } else { descrp = TRUE; /* a variable length descriptor column */ /* only bit arrays (tform = 'X') are supported for variable */ /* length arrays. REPEAT is the number of BITS in the array. */ repeat = fbit + nbit -1; /* write the number of elements and the starting offset. */ /* Note: ffgcprll previous wrote the descripter, but with the */ /* wrong repeat value (gave bytes instead of bits). */ if (tcode == -TBIT) ffpdes(fptr, colnum, frow, (long) repeat, offset, status); /* Calc the i/o pointer location to start of sequence of pixels. */ /* ffgcprll has already calculated a value for bstart that */ /* points to the first element of the vector; we just have to */ /* increment it to point to the first element we want to write to. */ /* Note: ffgcprll also already updated the size of the heap, so we */ /* don't have to do that again here. */ bstart += estart; } /* move the i/o pointer to the start of the pixel sequence */ ffmbyt(fptr, bstart, IGNORE_EOF, status); /* read the next byte (we may only be modifying some of the bits) */ while (1) { if (ffgbyt(fptr, 1, &cbuff, status) == END_OF_FILE) { /* hit end of file trying to read the byte, so just set byte = 0 */ *status = 0; cbuff = 0; } /* move back, to be able to overwrite the byte */ ffmbyt(fptr, bstart, IGNORE_EOF, status); for (ii = bitloc; (ii < 8) && (ndone < nbit); ii++, ndone++) { if(larray[ndone]) cbuff = cbuff | onbit[ii]; else cbuff = cbuff & offbit[ii]; } ffpbyt(fptr, 1, &cbuff, status); /* write the modified byte */ if (ndone == nbit) /* finished all the bits */ return(*status); /* not done, so get the next byte */ bstart++; if (!descrp) { estart++; if (estart == repeat) { /* move the i/o pointer to the next row of pixels */ estart = 0; rstart = rstart + 1; bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) + colptr->tbcol; ffmbyt(fptr, bstart, IGNORE_EOF, status); } } bitloc = 0; } } astropy-0.3/cextern/cfitsio/putcols.c0000644000175000017500000002521412243255342016150 0ustar oleole/* This file, putcols.c, contains routines that write data elements to */ /* a FITS image or table, of type character string. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpcls( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of strings to write */ char **array, /* I - array of pointers to strings */ int *status) /* IO - error status */ /* Write an array of string values to a column in the current FITS HDU. */ { int tcode, maxelem, hdutype, nchar; long twidth, incre; long ii, jj, ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], *blanks; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ tcolumn *colptr; double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ char *buffer, *arrayptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (colnum < 1 || colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d", colnum); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode == -TSTRING) /* variable length column in a binary table? */ { /* only write a single string; ignore value of firstelem */ nchar = maxvalue(1,strlen(array[0])); /* will write at least 1 char */ /* even if input string is null */ if (ffgcprll( fptr, colnum, firstrow, 1, nchar, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); /* simply move to write position, then write the string */ ffmbyt(fptr, startpos, IGNORE_EOF, status); ffpbyt(fptr, nchar, array[0], status); if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing to variable length string column (ffpcls)."); ffpmsg(message); } return(*status); } else if (tcode == TSTRING) { if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); /* if string length is greater than a FITS block (2880 char) then must */ /* only write 1 string at a time, to force writein by ffpbyt instead of */ /* ffpbytoff (ffpbytoff can't handle this case) */ if (twidth > IOBUFLEN) { maxelem = 1; incre = twidth; repeat = 1; } blanks = (char *) malloc(twidth); /* string for blank fill values */ if (!blanks) { ffpmsg("Could not allocate memory for string (ffpcls)"); return(*status = ARRAY_TOO_BIG); } for (ii = 0; ii < twidth; ii++) blanks[ii] = ' '; /* fill string with blanks */ remain = nelem; /* remaining number of values to write */ } else return(*status = NOT_ASCII_COL); /*-------------------------------------------------------*/ /* Now write the strings to the FITS column. */ /*-------------------------------------------------------*/ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process at one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + (rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ buffer = (char *) cbuff; /* copy the user's strings into the buffer */ for (ii = 0; ii < ntodo; ii++) { arrayptr = array[next]; for (jj = 0; jj < twidth; jj++) /* copy the string, char by char */ { if (*arrayptr) { *buffer = *arrayptr; buffer++; arrayptr++; } else break; } for (;jj < twidth; jj++) /* fill field with blanks, if needed */ { *buffer = ' '; buffer++; } next++; } /* write the buffer full of strings to the FITS file */ if (incre == twidth) ffpbyt(fptr, ntodo * twidth, cbuff, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, cbuff, status); if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcls).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); if (blanks) free(blanks); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ if (blanks) free(blanks); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcns( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ char **array, /* I - array of values to write */ char *nulvalue, /* I - string representing a null value */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels flagged as null will be replaced by the appropriate null value in the output FITS file. */ { long repeat, width, ngood = 0, nbad = 0, ii; LONGLONG first, fstelm, fstrow; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } /* get the vector repeat length of the column */ ffgtcl(fptr, colnum, NULL, &repeat, &width, status); if ((fptr->Fptr)->hdutype == BINARY_TBL) repeat = repeat / width; /* convert from chars to unit strings */ /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (strcmp(nulvalue, array[ii])) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpcls(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) return(*status); ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpcls(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } return(*status); } astropy-0.3/cextern/cfitsio/edithdu.c0000644000175000017500000007475112243255342016117 0ustar oleole/* This file, edithdu.c, contains the FITSIO routines related to */ /* copying, inserting, or deleting HDUs in a FITS file */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffcopy(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int morekeys, /* I - reserve space in output header */ int *status) /* IO - error status */ /* copy the CHDU from infptr to the CHDU of outfptr. This will also allocate space in the output header for MOREKY keywords */ { int nspace; if (*status > 0) return(*status); if (infptr == outfptr) return(*status = SAME_FILE); if (ffcphd(infptr, outfptr, status) ) /* copy the header keywords */ return(*status); if (morekeys > 0) { ffhdef(outfptr, morekeys, status); /* reserve space for more keywords */ } else { if (ffghsp(infptr, NULL, &nspace, status) > 0) /* get existing space */ return(*status); if (nspace > 0) { ffhdef(outfptr, nspace, status); /* preserve same amount of space */ if (nspace >= 35) { /* There is at least 1 full empty FITS block in the header. */ /* Physically write the END keyword at the beginning of the */ /* last block to preserve this extra space now rather than */ /* later. This is needed by the stream: driver which cannot */ /* seek back to the header to write the END keyword later. */ ffwend(outfptr, status); } } } ffcpdt(infptr, outfptr, status); /* now copy the data unit */ return(*status); } /*--------------------------------------------------------------------------*/ int ffcpfl(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int previous, /* I - copy any previous HDUs? */ int current, /* I - copy the current HDU? */ int following, /* I - copy any following HDUs? */ int *status) /* IO - error status */ /* copy all or part of the input file to the output file. */ { int hdunum, ii; if (*status > 0) return(*status); if (infptr == outfptr) return(*status = SAME_FILE); ffghdn(infptr, &hdunum); if (previous) { /* copy any previous HDUs */ for (ii=1; ii < hdunum; ii++) { ffmahd(infptr, ii, NULL, status); ffcopy(infptr, outfptr, 0, status); } } if (current && (*status <= 0) ) { /* copy current HDU */ ffmahd(infptr, hdunum, NULL, status); ffcopy(infptr, outfptr, 0, status); } if (following && (*status <= 0) ) { /* copy any remaining HDUs */ ii = hdunum + 1; while (1) { if (ffmahd(infptr, ii, NULL, status) ) { /* reset expected end of file status */ if (*status == END_OF_FILE) *status = 0; break; } if (ffcopy(infptr, outfptr, 0, status)) break; /* quit on unexpected error */ ii++; } } ffmahd(infptr, hdunum, NULL, status); /* restore initial position */ return(*status); } /*--------------------------------------------------------------------------*/ int ffcphd(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int *status) /* IO - error status */ /* copy the header keywords from infptr to outfptr. */ { int nkeys, ii, inPrim = 0, outPrim = 0; long naxis, naxes[1]; char *card, comm[FLEN_COMMENT]; char *tmpbuff; if (*status > 0) return(*status); if (infptr == outfptr) return(*status = SAME_FILE); /* set the input pointer to the correct HDU */ if (infptr->HDUposition != (infptr->Fptr)->curhdu) ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status); if (ffghsp(infptr, &nkeys, NULL, status) > 0) /* get no. of keywords */ return(*status); /* create a memory buffer to hold the header records */ tmpbuff = (char*) malloc(nkeys*FLEN_CARD*sizeof(char)); if (!tmpbuff) return(*status = MEMORY_ALLOCATION); /* read all of the header records in the input HDU */ for (ii = 0; ii < nkeys; ii++) ffgrec(infptr, ii+1, tmpbuff + (ii * FLEN_CARD), status); if (infptr->HDUposition == 0) /* set flag if this is the Primary HDU */ inPrim = 1; /* if input is an image hdu, get the number of axes */ naxis = -1; /* negative if HDU is a table */ if ((infptr->Fptr)->hdutype == IMAGE_HDU) ffgkyj(infptr, "NAXIS", &naxis, NULL, status); /* set the output pointer to the correct HDU */ if (outfptr->HDUposition != (outfptr->Fptr)->curhdu) ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status); /* check if output header is empty; if not create new empty HDU */ if ((outfptr->Fptr)->headend != (outfptr->Fptr)->headstart[(outfptr->Fptr)->curhdu] ) ffcrhd(outfptr, status); if (outfptr->HDUposition == 0) { if (naxis < 0) { /* the input HDU is a table, so we have to create */ /* a dummy Primary array before copying it to the output */ ffcrim(outfptr, 8, 0, naxes, status); ffcrhd(outfptr, status); /* create new empty HDU */ } else { /* set flag that this is the Primary HDU */ outPrim = 1; } } if (*status > 0) /* check for errors before proceeding */ { free(tmpbuff); return(*status); } if ( inPrim == 1 && outPrim == 0 ) { /* copying from primary array to image extension */ strcpy(comm, "IMAGE extension"); ffpkys(outfptr, "XTENSION", "IMAGE", comm, status); /* copy BITPIX through NAXISn keywords */ for (ii = 1; ii < 3 + naxis; ii++) { card = tmpbuff + (ii * FLEN_CARD); ffprec(outfptr, card, status); } strcpy(comm, "number of random group parameters"); ffpkyj(outfptr, "PCOUNT", 0, comm, status); strcpy(comm, "number of random groups"); ffpkyj(outfptr, "GCOUNT", 1, comm, status); /* copy remaining keywords, excluding EXTEND, and reference COMMENT keywords */ for (ii = 3 + naxis ; ii < nkeys; ii++) { card = tmpbuff+(ii * FLEN_CARD); if (FSTRNCMP(card, "EXTEND ", 8) && FSTRNCMP(card, "COMMENT FITS (Flexible Image Transport System) format is", 58) && FSTRNCMP(card, "COMMENT and Astrophysics', volume 376, page 3", 47) ) { ffprec(outfptr, card, status); } } } else if ( inPrim == 0 && outPrim == 1 ) { /* copying between image extension and primary array */ strcpy(comm, "file does conform to FITS standard"); ffpkyl(outfptr, "SIMPLE", TRUE, comm, status); /* copy BITPIX through NAXISn keywords */ for (ii = 1; ii < 3 + naxis; ii++) { card = tmpbuff + (ii * FLEN_CARD); ffprec(outfptr, card, status); } /* add the EXTEND keyword */ strcpy(comm, "FITS dataset may contain extensions"); ffpkyl(outfptr, "EXTEND", TRUE, comm, status); /* write standard block of self-documentating comments */ ffprec(outfptr, "COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy", status); ffprec(outfptr, "COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H", status); /* copy remaining keywords, excluding pcount, gcount */ for (ii = 3 + naxis; ii < nkeys; ii++) { card = tmpbuff+(ii * FLEN_CARD); if (FSTRNCMP(card, "PCOUNT ", 8) && FSTRNCMP(card, "GCOUNT ", 8)) { ffprec(outfptr, card, status); } } } else { /* input and output HDUs are same type; simply copy all keywords */ for (ii = 0; ii < nkeys; ii++) { card = tmpbuff+(ii * FLEN_CARD); ffprec(outfptr, card, status); } } free(tmpbuff); return(*status); } /*--------------------------------------------------------------------------*/ int ffcpdt(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int *status) /* IO - error status */ { /* copy the data unit from the CHDU of infptr to the CHDU of outfptr. This will overwrite any data already in the outfptr CHDU. */ long nb, ii; LONGLONG indatastart, indataend, outdatastart; char buffer[2880]; if (*status > 0) return(*status); if (infptr == outfptr) return(*status = SAME_FILE); ffghadll(infptr, NULL, &indatastart, &indataend, status); ffghadll(outfptr, NULL, &outdatastart, NULL, status); /* Calculate the number of blocks to be copied */ nb = (long) ((indataend - indatastart) / 2880); if (nb > 0) { if (infptr->Fptr == outfptr->Fptr) { /* copying between 2 HDUs in the SAME file */ for (ii = 0; ii < nb; ii++) { ffmbyt(infptr, indatastart, REPORT_EOF, status); ffgbyt(infptr, 2880L, buffer, status); /* read input block */ ffmbyt(outfptr, outdatastart, IGNORE_EOF, status); ffpbyt(outfptr, 2880L, buffer, status); /* write output block */ indatastart += 2880; /* move address */ outdatastart += 2880; /* move address */ } } else { /* copying between HDUs in separate files */ /* move to the initial copy position in each of the files */ ffmbyt(infptr, indatastart, REPORT_EOF, status); ffmbyt(outfptr, outdatastart, IGNORE_EOF, status); for (ii = 0; ii < nb; ii++) { ffgbyt(infptr, 2880L, buffer, status); /* read input block */ ffpbyt(outfptr, 2880L, buffer, status); /* write output block */ } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffwrhdu(fitsfile *infptr, /* I - FITS file pointer to input file */ FILE *outstream, /* I - stream to write HDU to */ int *status) /* IO - error status */ { /* write the data unit from the CHDU of infptr to the output file stream */ long nb, ii; LONGLONG hdustart, hduend; char buffer[2880]; if (*status > 0) return(*status); ffghadll(infptr, &hdustart, NULL, &hduend, status); nb = (long) ((hduend - hdustart) / 2880); /* number of blocks to copy */ if (nb > 0) { /* move to the start of the HDU */ ffmbyt(infptr, hdustart, REPORT_EOF, status); for (ii = 0; ii < nb; ii++) { ffgbyt(infptr, 2880L, buffer, status); /* read input block */ fwrite(buffer, 1, 2880, outstream ); /* write to output stream */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffiimg(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ long *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* insert an IMAGE extension following the current HDU */ { LONGLONG tnaxes[99]; int ii; if (*status > 0) return(*status); if (naxis > 99) { ffpmsg("NAXIS value is too large (>99) (ffiimg)"); return(*status = 212); } for (ii = 0; (ii < naxis); ii++) tnaxes[ii] = naxes[ii]; ffiimgll(fptr, bitpix, naxis, tnaxes, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffiimgll(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ LONGLONG *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* insert an IMAGE extension following the current HDU */ { int bytlen, nexthdu, maxhdu, ii, onaxis; long nblocks; LONGLONG npixels, newstart, datasize; char errmsg[FLEN_ERRMSG], card[FLEN_CARD], naxiskey[FLEN_KEYWORD]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); maxhdu = (fptr->Fptr)->maxhdu; if (*status != PREPEND_PRIMARY) { /* if the current header is completely empty ... */ if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) /* or, if we are at the end of the file, ... */ || ( (((fptr->Fptr)->curhdu) == maxhdu ) && ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) ) { /* then simply append new image extension */ ffcrimll(fptr, bitpix, naxis, naxes, status); return(*status); } } if (bitpix == 8) bytlen = 1; else if (bitpix == 16) bytlen = 2; else if (bitpix == 32 || bitpix == -32) bytlen = 4; else if (bitpix == 64 || bitpix == -64) bytlen = 8; else { sprintf(errmsg, "Illegal value for BITPIX keyword: %d", bitpix); ffpmsg(errmsg); return(*status = BAD_BITPIX); /* illegal bitpix value */ } if (naxis < 0 || naxis > 999) { sprintf(errmsg, "Illegal value for NAXIS keyword: %d", naxis); ffpmsg(errmsg); return(*status = BAD_NAXIS); } for (ii = 0; ii < naxis; ii++) { if (naxes[ii] < 0) { sprintf(errmsg, "Illegal value for NAXIS%d keyword: %ld", ii + 1, (long) naxes[ii]); ffpmsg(errmsg); return(*status = BAD_NAXES); } } /* calculate number of pixels in the image */ if (naxis == 0) npixels = 0; else npixels = naxes[0]; for (ii = 1; ii < naxis; ii++) npixels = npixels * naxes[ii]; datasize = npixels * bytlen; /* size of image in bytes */ nblocks = (long) (((datasize + 2879) / 2880) + 1); /* +1 for the header */ if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */ { /* close the CHDU */ ffrdef(fptr, status); /* scan header to redefine structure */ ffpdfl(fptr, status); /* insure correct data file values */ } else return(*status = READONLY_FILE); if (*status == PREPEND_PRIMARY) { /* inserting a new primary array; the current primary */ /* array must be transformed into an image extension. */ *status = 0; ffmahd(fptr, 1, NULL, status); /* move to the primary array */ ffgidm(fptr, &onaxis, status); if (onaxis > 0) ffkeyn("NAXIS",onaxis, naxiskey, status); else strcpy(naxiskey, "NAXIS"); ffgcrd(fptr, naxiskey, card, status); /* read last NAXIS keyword */ ffikyj(fptr, "PCOUNT", 0, "required keyword", status); /* add PCOUNT and */ ffikyj(fptr, "GCOUNT", 1, "required keyword", status); /* GCOUNT keywords */ if (*status > 0) return(*status); if (ffdkey(fptr, "EXTEND", status) ) /* delete the EXTEND keyword */ *status = 0; /* redefine internal structure for this HDU */ ffrdef(fptr, status); /* insert space for the primary array */ if (ffiblk(fptr, nblocks, -1, status) > 0) /* insert the blocks */ return(*status); nexthdu = 0; /* number of the new hdu */ newstart = 0; /* starting addr of HDU */ } else { nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */ newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */ (fptr->Fptr)->hdutype = IMAGE_HDU; /* so that correct fill value is used */ /* ffiblk also increments headstart for all following HDUs */ if (ffiblk(fptr, nblocks, 1, status) > 0) /* insert the blocks */ return(*status); } ((fptr->Fptr)->maxhdu)++; /* increment known number of HDUs in the file */ for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--) (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */ if (nexthdu == 0) (fptr->Fptr)->headstart[1] = nblocks * 2880; /* start of the old Primary array */ (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */ /* set default parameters for this new empty HDU */ (fptr->Fptr)->curhdu = nexthdu; /* we are now located at the next HDU */ fptr->HDUposition = nexthdu; /* we are now located at the next HDU */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + 2880; (fptr->Fptr)->hdutype = IMAGE_HDU; /* might need to be reset... */ /* write the required header keywords */ ffphprll(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status); /* redefine internal structure for this HDU */ ffrdef(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffitab(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis1, /* I - width of row in the table */ LONGLONG naxis2, /* I - number of rows in the table */ int tfields, /* I - number of columns in the table */ char **ttype, /* I - name of each column */ long *tbcol, /* I - byte offset in row to each column */ char **tform, /* I - value of TFORMn keyword for each column */ char **tunit, /* I - value of TUNITn keyword for each column */ const char *extnmx, /* I - value of EXTNAME keyword, if any */ int *status) /* IO - error status */ /* insert an ASCII table extension following the current HDU */ { int nexthdu, maxhdu, ii, nunit, nhead, ncols, gotmem = 0; long nblocks, rowlen; LONGLONG datasize, newstart; char errmsg[81], extnm[FLEN_VALUE]; if (*status > 0) return(*status); extnm[0] = '\0'; if (extnmx) strncat(extnm, extnmx, FLEN_VALUE-1); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); maxhdu = (fptr->Fptr)->maxhdu; /* if the current header is completely empty ... */ if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) /* or, if we are at the end of the file, ... */ || ( (((fptr->Fptr)->curhdu) == maxhdu ) && ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) ) { /* then simply append new image extension */ ffcrtb(fptr, ASCII_TBL, naxis2, tfields, ttype, tform, tunit, extnm, status); return(*status); } if (naxis1 < 0) return(*status = NEG_WIDTH); else if (naxis2 < 0) return(*status = NEG_ROWS); else if (tfields < 0 || tfields > 999) { sprintf(errmsg, "Illegal value for TFIELDS keyword: %d", tfields); ffpmsg(errmsg); return(*status = BAD_TFIELDS); } /* count number of optional TUNIT keywords to be written */ nunit = 0; for (ii = 0; ii < tfields; ii++) { if (tunit && *tunit && *tunit[ii]) nunit++; } if (extnm && *extnm) nunit++; /* add one for the EXTNAME keyword */ rowlen = (long) naxis1; if (!tbcol || !tbcol[0] || (!naxis1 && tfields)) /* spacing not defined? */ { /* allocate mem for tbcol; malloc may have problems allocating small */ /* arrays, so allocate at least 20 bytes */ ncols = maxvalue(5, tfields); tbcol = (long *) calloc(ncols, sizeof(long)); if (tbcol) { gotmem = 1; /* calculate width of a row and starting position of each column. */ /* Each column will be separated by 1 blank space */ ffgabc(tfields, tform, 1, &rowlen, tbcol, status); } } nhead = (9 + (3 * tfields) + nunit + 35) / 36; /* no. of header blocks */ datasize = (LONGLONG)rowlen * naxis2; /* size of table in bytes */ nblocks = (long) (((datasize + 2879) / 2880) + nhead); /* size of HDU */ if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */ { /* close the CHDU */ ffrdef(fptr, status); /* scan header to redefine structure */ ffpdfl(fptr, status); /* insure correct data file values */ } else return(*status = READONLY_FILE); nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */ newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */ (fptr->Fptr)->hdutype = ASCII_TBL; /* so that correct fill value is used */ /* ffiblk also increments headstart for all following HDUs */ if (ffiblk(fptr, nblocks, 1, status) > 0) /* insert the blocks */ { if (gotmem) free(tbcol); return(*status); } ((fptr->Fptr)->maxhdu)++; /* increment known number of HDUs in the file */ for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--) (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */ (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */ /* set default parameters for this new empty HDU */ (fptr->Fptr)->curhdu = nexthdu; /* we are now located at the next HDU */ fptr->HDUposition = nexthdu; /* we are now located at the next HDU */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + (nhead * 2880); (fptr->Fptr)->hdutype = ASCII_TBL; /* might need to be reset... */ /* write the required header keywords */ ffphtb(fptr, rowlen, naxis2, tfields, ttype, tbcol, tform, tunit, extnm, status); if (gotmem) free(tbcol); /* redefine internal structure for this HDU */ ffrdef(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffibin(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis2, /* I - number of rows in the table */ int tfields, /* I - number of columns in the table */ char **ttype, /* I - name of each column */ char **tform, /* I - value of TFORMn keyword for each column */ char **tunit, /* I - value of TUNITn keyword for each column */ const char *extnmx, /* I - value of EXTNAME keyword, if any */ LONGLONG pcount, /* I - size of special data area (heap) */ int *status) /* IO - error status */ /* insert a Binary table extension following the current HDU */ { int nexthdu, maxhdu, ii, nunit, nhead, datacode; LONGLONG naxis1; long nblocks, repeat, width; LONGLONG datasize, newstart; char errmsg[81], extnm[FLEN_VALUE]; if (*status > 0) return(*status); extnm[0] = '\0'; if (extnmx) strncat(extnm, extnmx, FLEN_VALUE-1); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); maxhdu = (fptr->Fptr)->maxhdu; /* if the current header is completely empty ... */ if (( (fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) /* or, if we are at the end of the file, ... */ || ( (((fptr->Fptr)->curhdu) == maxhdu ) && ((fptr->Fptr)->headstart[maxhdu + 1] >= (fptr->Fptr)->logfilesize ) ) ) { /* then simply append new image extension */ ffcrtb(fptr, BINARY_TBL, naxis2, tfields, ttype, tform, tunit, extnm, status); return(*status); } if (naxis2 < 0) return(*status = NEG_ROWS); else if (tfields < 0 || tfields > 999) { sprintf(errmsg, "Illegal value for TFIELDS keyword: %d", tfields); ffpmsg(errmsg); return(*status = BAD_TFIELDS); } /* count number of optional TUNIT keywords to be written */ nunit = 0; for (ii = 0; ii < tfields; ii++) { if (tunit && *tunit && *tunit[ii]) nunit++; } if (extnm && *extnm) nunit++; /* add one for the EXTNAME keyword */ nhead = (9 + (2 * tfields) + nunit + 35) / 36; /* no. of header blocks */ /* calculate total width of the table */ naxis1 = 0; for (ii = 0; ii < tfields; ii++) { ffbnfm(tform[ii], &datacode, &repeat, &width, status); if (datacode == TBIT) naxis1 = naxis1 + ((repeat + 7) / 8); else if (datacode == TSTRING) naxis1 += repeat; else naxis1 = naxis1 + (repeat * width); } datasize = ((LONGLONG)naxis1 * naxis2) + pcount; /* size of table in bytes */ nblocks = (long) ((datasize + 2879) / 2880) + nhead; /* size of HDU */ if ((fptr->Fptr)->writemode == READWRITE) /* must have write access */ { /* close the CHDU */ ffrdef(fptr, status); /* scan header to redefine structure */ ffpdfl(fptr, status); /* insure correct data file values */ } else return(*status = READONLY_FILE); nexthdu = ((fptr->Fptr)->curhdu) + 1; /* number of the next (new) hdu */ newstart = (fptr->Fptr)->headstart[nexthdu]; /* save starting addr of HDU */ (fptr->Fptr)->hdutype = BINARY_TBL; /* so that correct fill value is used */ /* ffiblk also increments headstart for all following HDUs */ if (ffiblk(fptr, nblocks, 1, status) > 0) /* insert the blocks */ return(*status); ((fptr->Fptr)->maxhdu)++; /* increment known number of HDUs in the file */ for (ii = (fptr->Fptr)->maxhdu; ii > (fptr->Fptr)->curhdu; ii--) (fptr->Fptr)->headstart[ii + 1] = (fptr->Fptr)->headstart[ii]; /* incre start addr */ (fptr->Fptr)->headstart[nexthdu] = newstart; /* set starting addr of HDU */ /* set default parameters for this new empty HDU */ (fptr->Fptr)->curhdu = nexthdu; /* we are now located at the next HDU */ fptr->HDUposition = nexthdu; /* we are now located at the next HDU */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->headend = (fptr->Fptr)->headstart[nexthdu]; (fptr->Fptr)->datastart = ((fptr->Fptr)->headstart[nexthdu]) + (nhead * 2880); (fptr->Fptr)->hdutype = BINARY_TBL; /* might need to be reset... */ /* write the required header keywords. This will write PCOUNT = 0 */ /* so that the variable length data will be written at the right place */ ffphbn(fptr, naxis2, tfields, ttype, tform, tunit, extnm, pcount, status); /* redefine internal structure for this HDU (with PCOUNT = 0) */ ffrdef(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffdhdu(fitsfile *fptr, /* I - FITS file pointer */ int *hdutype, /* O - type of the new CHDU after deletion */ int *status) /* IO - error status */ /* Delete the CHDU. If the CHDU is the primary array, then replace the HDU with an empty primary array with no data. Return the type of the new CHDU after the old CHDU is deleted. */ { int tmptype = 0; long nblocks, ii, naxes[1]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->curhdu == 0) /* replace primary array with null image */ { /* ignore any existing keywords */ (fptr->Fptr)->headend = 0; (fptr->Fptr)->nextkey = 0; /* write default primary array header */ ffphpr(fptr,1,8,0,naxes,0,1,1,status); /* calc number of blocks to delete (leave just 1 block) */ nblocks = (long) (( (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1] - 2880 ) / 2880); /* ffdblk also updates the starting address of all following HDUs */ if (nblocks > 0) { if (ffdblk(fptr, nblocks, status) > 0) /* delete the HDU */ return(*status); } /* this might not be necessary, but is doesn't hurt */ (fptr->Fptr)->datastart = DATA_UNDEFINED; ffrdef(fptr, status); /* reinitialize the primary array */ } else { /* calc number of blocks to delete */ nblocks = (long) (( (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1] - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) / 2880); /* ffdblk also updates the starting address of all following HDUs */ if (ffdblk(fptr, nblocks, status) > 0) /* delete the HDU */ return(*status); /* delete the CHDU from the list of HDUs */ for (ii = (fptr->Fptr)->curhdu + 1; ii <= (fptr->Fptr)->maxhdu; ii++) (fptr->Fptr)->headstart[ii] = (fptr->Fptr)->headstart[ii + 1]; (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] = 0; ((fptr->Fptr)->maxhdu)--; /* decrement the known number of HDUs */ if (ffrhdu(fptr, &tmptype, status) > 0) /* initialize next HDU */ { /* failed (end of file?), so move back one HDU */ *status = 0; ffcmsg(); /* clear extraneous error messages */ ffgext(fptr, ((fptr->Fptr)->curhdu) - 1, &tmptype, status); } } if (hdutype) *hdutype = tmptype; return(*status); } astropy-0.3/cextern/cfitsio/putcolui.c0000644000175000017500000010275112243255342016325 0ustar oleole/* This file, putcolui.c, contains routines that write data elements to */ /* a FITS image or table, with unsigned short datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned short *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; unsigned short nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TUSHORT, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpclui(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned short *array, /* I - array of values that are written */ unsigned short nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; unsigned short nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TUSHORT, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnui(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2dui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3dui(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3dui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TUSHORT, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpclui(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpclui(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ unsigned short *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TUSHORT, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpclui(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpui( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ unsigned short *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpclui(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclui( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned short *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem, hdutype; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TSHORT): ffu2fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TLONGLONG): ffu2fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffu2fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TLONG): ffu2fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TFLOAT): ffu2fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffu2fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffu2fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclui).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned short *array, /* I - array of values to write */ unsigned short nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpclui(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpclui(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpclui(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fi1(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fi2(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 32768.) { /* Instead of subtracting 32768, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(short *) &input[ii] ) ^ 0x8000; } else if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fi4(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (INT32BIT) input[ii]; /* copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fi8(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fr4(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) (((double) input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fr8(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = ((double) input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffu2fstr(unsigned short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/putcolsb.c0000644000175000017500000010403512243255342016311 0ustar oleole/* This file, putcolsb.c, contains routines that write data elements to */ /* a FITS image or table with signed char (signed byte) datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprsb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ signed char *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; signed char nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TSBYTE, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpclsb(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnsb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ signed char *array, /* I - array of values that are written */ signed char nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; signed char nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TSBYTE, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnsb(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2dsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ signed char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3dsb(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3dsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ signed char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TSBYTE, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpclsb(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpclsb(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpsssb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ signed char *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TSBYTE, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpclsb(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpsb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ signed char *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpclsb(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclsb( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ signed char *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem, hdutype; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TBYTE): /* convert the raw data before writing to FITS file */ ffs1fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TLONGLONG): ffs1fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TSHORT): ffs1fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TLONG): ffs1fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TFLOAT): ffs1fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffs1fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (strchr(tform,'A')) { /* write raw input bytes without conversion */ /* This case is a hack to let users write a stream */ /* of bytes directly to the 'A' format column */ if (incre == twidth) ffpbyt(fptr, ntodo, &array[next], status); else ffpbytoff(fptr, twidth, ntodo/twidth, incre - twidth, &array[next], status); break; } else if (cform[1] != 's') /* "%s" format is a string */ { ffs1fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclsb).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnsb( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ signed char *array, /* I - array of values to write */ signed char nulvalue, /* I - flag for undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpclsb(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood + 1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpclsb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad + 1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpclsb(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fi1(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == -128.) { /* Instead of adding 128, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(unsigned char *) &input[ii] ) ^ 0x80; } else if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ( ((double) input[ii]) - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fi2(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; /* just copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (((double) input[ii]) - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fi4(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (INT32BIT) input[ii]; /* copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (((double) input[ii]) - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fi8(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fr4(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) (( ( (double) input[ii] ) - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fr8(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = ( ( (double) input[ii] ) - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffs1fstr(signed char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = ((double) input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/drvrnet.c0000644000175000017500000021322712243255342016146 0ustar oleole/* This file, drvrhttp.c contains driver routines for http, ftp and root files. */ /* This file was written by Bruce O'Neel at the ISDC, Switzerland */ /* The FITSIO software is maintained by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ /* Notes on the drivers: The ftp driver uses passive mode exclusivly. If your remote system can't deal with passive mode then it'll fail. Since Netscape Navigator uses passive mode as well there shouldn't be too many ftp servers which have problems. The http driver works properly with 301 and 302 redirects. For many more gory details see http://www.w3c.org/Protocols/rfc2068/rfc2068. The only catch to the 301/302 redirects is that they have to redirect to another http:// url. If not, things would have to change a lot in cfitsio and this was thought to be too difficult. Redirects look like 301 Moved Permanently

Moved Permanently

The document has moved here.

This redirect was from apache 1.2.5 but most of the other servers produce something very similiar. The parser for the redirects finds the first anchor tag in the body and goes there. If that wasn't what was intended by the remote system then hopefully the error stack, which includes notes about the redirect will help the user fix the problem. Root protocal doesn't have any real docs, so, the emperical docs are as follows. First, you must use a slightly modified rootd server. The modifications include implimentation of the stat command which returns the size of the remote file. Without that it's impossible for cfitsio to work properly since fitsfiles don't include any information about the size of the files in the headers. The rootd server closes the connections on any errors, including reading beyond the end of the file or seeking beyond the end of the file. The rootd:// driver doesn't reopen a closed connection, if the connection is closed you're pretty much done. The messages are of the form All binary information is transfered in network format, so use htonl and ntohl to convert back and forth. :== 4 byte length, in network format, the len doesn't include the length of :== one of the message opcodes below, 4 bytes, network format :== depends on opcode The response is of the same form with the same opcode sent. Success is indicated by being 0. Root is a NFSish protocol where each read/write includes the byte offset to read or write to. As a result, seeks will always succeed in the driver even if they would cause a fatal error when you try to read because you're beyond the end of the file. There is file locking on the host such that you need to possibly create /usr/tmp/rootdtab on the host system. There is one file per socket connection, though the rootd daemon can support multiple files open at once. The messages are sent in the following order: ROOTD_USER - user name, is the user name, trailing null is sent though it's not required it seems. A ROOTD_AUTH message is returned with any sort of error meaning that the user name is wrong. ROOTD_PASS - password, ones complemented, stored in . Once again the trailing null is sent. Once again a ROOTD_AUTH message is returned ROOTD_OPEN - includes filename and one of {create|update|read} as the file mode. ~ seems to be dealt with as the username's login directory. A ROOTD_OPEN message is returned. Once the file is opened any of the following can be sent: ROOTD_STAT - file status and size returns a message where is the file length in bytes ROOTD_FLUSH - flushes the file, not sure this has any real effect on the daemon since the daemon uses open/read/write/close rather than the buffered fopen/fread/fwrite/fclose. ROOTD_GET - on send includes a text message of offset and length to get. Return is a status message first with a status value, then, the raw bytes for the length that you requested. It's an error to seek or read past the end of the file, and, the rootd daemon exits and won't respond anymore. Ie, don't do this. ROOTD_PUT - on send includes a text message of offset and length to put. Then send the raw bytes you want to write. Then recieve a status message When you are finished then you send the message: ROOTD_CLOSE - closes the file Once the file is closed then the socket is closed. Revision 1.56 2000/01/04 11:58:31 oneel Updates so that compressed network files are dealt with regardless of their file names and/or mime types. Revision 1.55 2000/01/04 10:52:40 oneel cfitsio 2.034 Revision 1.51 1999/08/10 12:13:40 oneel Make the http code a bit less picky about the types of files it uncompresses. Now it also uncompresses files which end in .Z or .gz. Revision 1.50 1999/08/04 12:38:46 oneel Don's 2.0.32 patch with dal 1.3 Revision 1.39 1998/12/02 15:31:33 oneel Updates to drvrnet.c so that less compiler warnings would be generated. Fixes the signal handling. Revision 1.38 1998/11/23 10:03:24 oneel Added in a useragent string, as suggested by: Tim Kimball · Data Systems Division ¦ kimball@stsci.edu · 410-338-4417 Space Telescope Science Institute ¦ http://www.stsci.edu/~kimball/ 3700 San Martin Drive ¦ http://archive.stsci.edu/ Baltimore MD 21218 USA ¦ http://faxafloi.stsci.edu:4547/ */ #ifdef HAVE_NET_SERVICES #include #include #include #include #include #include #include #include #include #include #include #if defined(unix) || defined(__unix__) || defined(__unix) #include #endif #include #include #include "fitsio2.h" static jmp_buf env; /* holds the jump buffer for setjmp/longjmp pairs */ static void signal_handler(int sig); /* Network routine error codes */ #define NET_OK 0 #define NOT_INET_ADDRESS -1000 #define UNKNOWN_INET_HOST -1001 #define CONNECTION_ERROR -1002 /* Network routine constants */ #define NET_DEFAULT 0 #define NET_OOB 1 #define NET_PEEK 2 #define NETTIMEOUT 180 /* in secs */ /* local defines and variables */ #define MAXLEN 1200 #define SHORTLEN 100 static char netoutfile[MAXLEN]; #define ROOTD_USER 2000 /*user id follows */ #define ROOTD_PASS 2001 /*passwd follows */ #define ROOTD_AUTH 2002 /*authorization status (to client) */ #define ROOTD_FSTAT 2003 /*filename follows */ #define ROOTD_OPEN 2004 /*filename follows + mode */ #define ROOTD_PUT 2005 /*offset, number of bytes and buffer */ #define ROOTD_GET 2006 /*offset, number of bytes */ #define ROOTD_FLUSH 2007 /*flush file */ #define ROOTD_CLOSE 2008 /*close file */ #define ROOTD_STAT 2009 /*return rootd statistics */ #define ROOTD_ACK 2010 /*acknowledgement (all OK) */ #define ROOTD_ERR 2011 /*error code and message follow */ typedef struct /* structure containing disk file structure */ { int sock; LONGLONG currentpos; } rootdriver; static rootdriver handleTable[NMAXFILES]; /* allocate diskfile handle tables */ /* static prototypes */ static int NET_TcpConnect(char *hostname, int port); static int NET_SendRaw(int sock, const void *buf, int length, int opt); static int NET_RecvRaw(int sock, void *buffer, int length); static int NET_ParseUrl(const char *url, char *proto, char *host, int *port, char *fn); static int CreateSocketAddress(struct sockaddr_in *sockaddrPtr, char *host,int port); static int ftp_status(FILE *ftp, char *statusstr); static int http_open_network(char *url, FILE **httpfile, char *contentencoding, int *contentlength); static int ftp_open_network(char *url, FILE **ftpfile, FILE **command, int *sock); static int root_send_buffer(int sock, int op, char *buffer, int buflen); static int root_recv_buffer(int sock, int *op, char *buffer,int buflen); static int root_openfile(char *filename, char *rwmode, int *sock); static int encode64(unsigned s_len, char *src, unsigned d_len, char *dst); /***************************/ /* Static variables */ static int closehttpfile; static int closememfile; static int closefdiskfile; static int closediskfile; static int closefile; static int closeoutfile; static int closecommandfile; static int closeftpfile; static FILE *diskfile; static FILE *outfile; /*--------------------------------------------------------------------------*/ /* This creates a memory file handle with a copy of the URL in filename. The file is uncompressed if necessary */ int http_open(char *filename, int rwmode, int *handle) { FILE *httpfile; char contentencoding[SHORTLEN]; char newfilename[MAXLEN]; char errorstr[MAXLEN]; char recbuf[MAXLEN]; long len; int contentlength; int status; char firstchar; closehttpfile = 0; closememfile = 0; /* don't do r/w files */ if (rwmode != 0) { ffpmsg("Can't open http:// type file with READWRITE access"); ffpmsg(" Specify an outfile for r/w access (http_open)"); goto error; } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } (void) signal(SIGALRM, signal_handler); /* Open the network connection */ /* Does the file have a .Z or .gz in it */ /* Also, if file has a '?' in it (probably cgi script) */ if (strstr(filename,".Z") || strstr(filename,".gz") || strstr(filename,"?")) { alarm(NETTIMEOUT); if (http_open_network(filename,&httpfile,contentencoding, &contentlength)) { alarm(0); ffpmsg("Unable to open http file (http_open):"); ffpmsg(filename); goto error; } } else { if (strlen(filename) >= MAXLEN - 4) { ffpmsg("http file name is too long (http_open)"); ffpmsg(filename); goto error; } alarm(NETTIMEOUT); /* Try the .gz one */ strcpy(newfilename,filename); strcat(newfilename,".gz"); if (http_open_network(newfilename,&httpfile,contentencoding, &contentlength)) { alarm(0); /* Now the .Z one */ strcpy(newfilename,filename); strcat(newfilename,".Z"); alarm(NETTIMEOUT); if (http_open_network(newfilename,&httpfile,contentencoding, &contentlength)) { alarm(0); alarm(NETTIMEOUT); if (http_open_network(filename,&httpfile,contentencoding, &contentlength)) { alarm(0); ffpmsg("Unable to open http file (http_open)"); ffpmsg(filename); goto error; } } } } closehttpfile++; /* Create the memory file */ if ((status = mem_create(filename,handle))) { ffpmsg("Unable to create memory file (http_open)"); goto error; } closememfile++; /* Now, what do we do with the file */ /* Check to see what the first character is */ firstchar = fgetc(httpfile); ungetc(firstchar,httpfile); if (!strcmp(contentencoding,"x-gzip") || !strcmp(contentencoding,"x-compress") || strstr(filename,".gz") || strstr(filename,".Z") || ('\037' == firstchar)) { /* do the compress dance, which is the same as the gzip dance */ /* Using the cfitsio routine */ status = 0; /* Ok, this is a tough case, let's be arbritary and say 10*NETTIMEOUT, Given the choices for nettimeout above they'll probaby ^C before, but it's always worth a shot*/ alarm(NETTIMEOUT*10); status = mem_uncompress2mem(filename, httpfile, *handle); alarm(0); if (status) { ffpmsg("Error writing compressed memory file (http_open)"); ffpmsg(filename); goto error; } } else { /* It's not compressed, bad choice, but we'll copy it anyway */ if (contentlength % 2880) { sprintf(errorstr,"Content-Length not a multiple of 2880 (http_open) %d", contentlength); ffpmsg(errorstr); } /* write a memory file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) { alarm(0); /* cancel alarm */ status = mem_write(*handle,recbuf,len); if (status) { ffpmsg("Error copying http file into memory (http_open)"); ffpmsg(filename); goto error; } alarm(NETTIMEOUT); /* rearm the alarm */ } } fclose(httpfile); signal(SIGALRM, SIG_DFL); alarm(0); return mem_seek(*handle,0); error: alarm(0); /* clear it */ if (closehttpfile) { fclose(httpfile); } if (closememfile) { mem_close_free(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* This creates a memory file handle with a copy of the URL in filename. The file must be compressed and is copied (still compressed) to disk first. The compressed disk file is then uncompressed into memory (READONLY). */ int http_compress_open(char *url, int rwmode, int *handle) { FILE *httpfile; char contentencoding[SHORTLEN]; char recbuf[MAXLEN]; long len; int contentlength; int ii, flen, status; char firstchar; closehttpfile = 0; closediskfile = 0; closefdiskfile = 0; closememfile = 0; /* cfileio made a mistake, should set the netoufile first otherwise we don't know where to write the output file */ flen = strlen(netoutfile); if (!flen) { ffpmsg ("Output file not set, shouldn't have happened (http_compress_open)"); goto error; } if (rwmode != 0) { ffpmsg("Can't open compressed http:// type file with READWRITE access"); ffpmsg(" Specify an UNCOMPRESSED outfile (http_compress_open)"); goto error; } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } signal(SIGALRM, signal_handler); /* Open the http connectin */ alarm(NETTIMEOUT); if ((status = http_open_network(url,&httpfile,contentencoding, &contentlength))) { alarm(0); ffpmsg("Unable to open http file (http_compress_open)"); ffpmsg(url); goto error; } closehttpfile++; /* Better be compressed */ firstchar = fgetc(httpfile); ungetc(firstchar,httpfile); if (!strcmp(contentencoding,"x-gzip") || !strcmp(contentencoding,"x-compress") || ('\037' == firstchar)) { if (*netoutfile == '!') { /* user wants to clobber file, if it already exists */ for (ii = 0; ii < flen; ii++) netoutfile[ii] = netoutfile[ii + 1]; /* remove '!' */ status = file_remove(netoutfile); } /* Create the new file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output disk file (http_compress_open):"); ffpmsg(netoutfile); goto error; } closediskfile++; /* write a file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) { alarm(0); status = file_write(*handle,recbuf,len); if (status) { ffpmsg("Error writing disk file (http_compres_open)"); ffpmsg(netoutfile); goto error; } alarm(NETTIMEOUT); } file_close(*handle); fclose(httpfile); closehttpfile--; closediskfile--; /* File is on disk, let's uncompress it into memory */ if (NULL == (diskfile = fopen(netoutfile,"r"))) { ffpmsg("Unable to reopen disk file (http_compress_open)"); ffpmsg(netoutfile); goto error; } closefdiskfile++; /* Create the memory handle to hold it */ if ((status = mem_create(url,handle))) { ffpmsg("Unable to create memory file (http_compress_open)"); goto error; } closememfile++; /* Uncompress it */ status = 0; status = mem_uncompress2mem(url,diskfile,*handle); fclose(diskfile); closefdiskfile--; if (status) { ffpmsg("Error uncompressing disk file to memory (http_compress_open)"); ffpmsg(netoutfile); goto error; } } else { /* Opps, this should not have happened */ ffpmsg("Can only have compressed files here (http_compress_open)"); goto error; } signal(SIGALRM, SIG_DFL); alarm(0); return mem_seek(*handle,0); error: alarm(0); /* clear it */ if (closehttpfile) { fclose(httpfile); } if (closefdiskfile) { fclose(diskfile); } if (closememfile) { mem_close_free(*handle); } if (closediskfile) { file_close(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* This creates a file handle with a copy of the URL in filename. The http file is copied to disk first. If it's compressed then it is uncompressed when copying to the disk */ int http_file_open(char *url, int rwmode, int *handle) { FILE *httpfile; char contentencoding[SHORTLEN]; char errorstr[MAXLEN]; char recbuf[MAXLEN]; long len; int contentlength; int ii, flen, status; char firstchar; /* Check if output file is actually a memory file */ if (!strncmp(netoutfile, "mem:", 4) ) { /* allow the memory file to be opened with write access */ return( http_open(url, READONLY, handle) ); } closehttpfile = 0; closefile = 0; closeoutfile = 0; /* cfileio made a mistake, we need to know where to write the file */ flen = strlen(netoutfile); if (!flen) { ffpmsg("Output file not set, shouldn't have happened (http_file_open)"); return (FILE_NOT_OPENED); } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } signal(SIGALRM, signal_handler); /* Open the network connection */ alarm(NETTIMEOUT); if ((status = http_open_network(url,&httpfile,contentencoding, &contentlength))) { alarm(0); ffpmsg("Unable to open http file (http_file_open)"); ffpmsg(url); goto error; } closehttpfile++; if (*netoutfile == '!') { /* user wants to clobber disk file, if it already exists */ for (ii = 0; ii < flen; ii++) netoutfile[ii] = netoutfile[ii + 1]; /* remove '!' */ status = file_remove(netoutfile); } firstchar = fgetc(httpfile); ungetc(firstchar,httpfile); if (!strcmp(contentencoding,"x-gzip") || !strcmp(contentencoding,"x-compress") || ('\037' == firstchar)) { /* to make this more cfitsioish we use the file driver calls to create the disk file */ /* Create the output file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output file (http_file_open)"); ffpmsg(netoutfile); goto error; } file_close(*handle); if (NULL == (outfile = fopen(netoutfile,"w"))) { ffpmsg("Unable to reopen the output file (http_file_open)"); ffpmsg(netoutfile); goto error; } closeoutfile++; status = 0; /* Ok, this is a tough case, let's be arbritary and say 10*NETTIMEOUT, Given the choices for nettimeout above they'll probaby ^C before, but it's always worth a shot*/ alarm(NETTIMEOUT*10); status = uncompress2file(url,httpfile,outfile,&status); alarm(0); if (status) { ffpmsg("Error uncompressing http file to disk file (http_file_open)"); ffpmsg(url); ffpmsg(netoutfile); goto error; } fclose(outfile); closeoutfile--; } else { /* Create the output file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output file (http_file_open)"); ffpmsg(netoutfile); goto error; } /* Give a warning message. This could just be bad padding at the end so don't treat it like an error. */ closefile++; if (contentlength % 2880) { sprintf(errorstr, "Content-Length not a multiple of 2880 (http_file_open) %d", contentlength); ffpmsg(errorstr); } /* write a file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,httpfile))) { alarm(0); status = file_write(*handle,recbuf,len); if (status) { ffpmsg("Error copying http file to disk file (http_file_open)"); ffpmsg(url); ffpmsg(netoutfile); goto error; } } file_close(*handle); closefile--; } fclose(httpfile); closehttpfile--; signal(SIGALRM, SIG_DFL); alarm(0); return file_open(netoutfile,rwmode,handle); error: alarm(0); /* clear it */ if (closehttpfile) { fclose(httpfile); } if (closeoutfile) { fclose(outfile); } if (closefile) { file_close(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* This is the guts of the code to get a file via http. url is the input url httpfile is set to be the file connected to the socket which you can read the file from contentencoding is the mime type of the file, returned if the http server returns it contentlength is the lenght of the file, returned if the http server returns it */ static int http_open_network(char *url, FILE **httpfile, char *contentencoding, int *contentlength) { int status; int sock; int tmpint; char recbuf[MAXLEN]; char tmpstr[MAXLEN]; char tmpstr1[SHORTLEN]; char tmpstr2[MAXLEN]; char errorstr[MAXLEN]; char proto[SHORTLEN]; char host[SHORTLEN]; char userpass[MAXLEN]; char fn[MAXLEN]; char turl[MAXLEN]; char *scratchstr; int port; float version; char pproto[SHORTLEN]; char phost[SHORTLEN]; /* address of the proxy server */ int pport; /* port number of the proxy server */ char pfn[MAXLEN]; char *proxy; /* URL of the proxy server */ /* Parse the URL apart again */ strcpy(turl,"http://"); strncat(turl,url,MAXLEN - 8); if (NET_ParseUrl(turl,proto,host,&port,fn)) { sprintf(errorstr,"URL Parse Error (http_open) %s",url); ffpmsg(errorstr); return (FILE_NOT_OPENED); } /* Do we have a user:password combo ? */ strcpy(userpass, url); if ((scratchstr = strchr(userpass, '@')) != NULL) { *scratchstr = '\0'; } else strcpy(userpass, ""); /* Ph. Prugniel 2003/04/03 Are we using a proxy? We use a proxy if the environment variable "http_proxy" is set to an address, eg. http://wwwcache.nottingham.ac.uk:3128 ("http_proxy" is also used by wget) */ proxy = getenv("http_proxy"); /* Connect to the remote host */ if (proxy) { if (NET_ParseUrl(proxy,pproto,phost,&pport,pfn)) { sprintf(errorstr,"URL Parse Error (http_open) %s",proxy); ffpmsg(errorstr); return (FILE_NOT_OPENED); } sock = NET_TcpConnect(phost,pport); } else sock = NET_TcpConnect(host,port); if (sock < 0) { if (proxy) { ffpmsg("Couldn't connect to host via proxy server (http_open_network)"); ffpmsg(proxy); } return (FILE_NOT_OPENED); } /* Make the socket a stdio file */ if (NULL == (*httpfile = fdopen(sock,"r"))) { ffpmsg ("fdopen failed to convert socket to file (http_open_network)"); close(sock); return (FILE_NOT_OPENED); } /* Send the GET request to the remote server */ /* Ph. Prugniel 2003/04/03 One must add the Host: command because of HTTP 1.1 servers (ie. virtual hosts) */ if (proxy) sprintf(tmpstr,"GET http://%s:%-d%s HTTP/1.0\r\n",host,port,fn); else sprintf(tmpstr,"GET %s HTTP/1.0\r\n",fn); if (strcmp(userpass, "")) { encode64(strlen(userpass), userpass, MAXLEN, tmpstr2); sprintf(tmpstr1, "Authorization: Basic %s\r\n", tmpstr2); if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1) return (FILE_NOT_OPENED); strcat(tmpstr,tmpstr1); } sprintf(tmpstr1,"User-Agent: HEASARC/CFITSIO/%-8.3f\r\n",ffvers(&version)); if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1) return (FILE_NOT_OPENED); strcat(tmpstr,tmpstr1); /* HTTP 1.1 servers require the following 'Host: ' string */ sprintf(tmpstr1,"Host: %s:%-d\r\n\r\n",host,port); if (strlen(tmpstr) + strlen(tmpstr1) > MAXLEN - 1) return (FILE_NOT_OPENED); strcat(tmpstr,tmpstr1); status = NET_SendRaw(sock,tmpstr,strlen(tmpstr),NET_DEFAULT); /* read the header */ if (!(fgets(recbuf,MAXLEN,*httpfile))) { sprintf (errorstr,"http header short (http_open_network) %s",recbuf); ffpmsg(errorstr); fclose(*httpfile); return (FILE_NOT_OPENED); } *contentlength = 0; contentencoding[0] = '\0'; /* Our choices are 200, ok, 301, temporary redirect, or 302 perm redirect */ sscanf(recbuf,"%s %d",tmpstr,&status); if (status != 200){ if (status == 301 || status == 302) { /* got a redirect */ if (status == 301) { ffpmsg("Note: Web server replied with a temporary redirect from"); } else { ffpmsg("Note: Web server replied with a redirect from"); } ffpmsg(turl); /* now, let's not write the most sophisticated parser here */ while (fgets(recbuf,MAXLEN,*httpfile)) { scratchstr = strstr(recbuf," 3) { recbuf[strlen(recbuf)-1] = '\0'; recbuf[strlen(recbuf)-1] = '\0'; } sscanf(recbuf,"%s %d",tmpstr,&tmpint); /* Did we get a content-length header ? */ if (!strcmp(tmpstr,"Content-Length:")) { *contentlength = tmpint; } /* Did we get the content-encoding header ? */ if (!strcmp(tmpstr,"Content-Encoding:")) { if (NULL != (scratchstr = strstr(recbuf,":"))) { /* Found the : */ scratchstr++; /* skip the : */ scratchstr++; /* skip the extra space */ strcpy(contentencoding,scratchstr); } } } /* we're done, so return */ return 0; } /*--------------------------------------------------------------------------*/ /* This creates a memory file handle with a copy of the URL in filename. The file is uncompressed if necessary */ int ftp_open(char *filename, int rwmode, int *handle) { FILE *ftpfile; FILE *command; int sock; char newfilename[MAXLEN]; char recbuf[MAXLEN]; long len; int status; char firstchar; closememfile = 0; closecommandfile = 0; closeftpfile = 0; /* don't do r/w files */ if (rwmode != 0) { ffpmsg("Can't open ftp:// type file with READWRITE access"); ffpmsg("Specify an outfile for r/w access (ftp_open)"); return (FILE_NOT_OPENED); } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } signal(SIGALRM, signal_handler); /* Open the ftp connetion. ftpfile is connected to the file port, command is connected to port 21. sock is the socket on port 21 */ if (strlen(filename) > MAXLEN - 4) { ffpmsg("filename too long (ftp_open)"); ffpmsg(filename); goto error; } alarm(NETTIMEOUT); strcpy(newfilename,filename); /* Does the file have a .Z or .gz in it */ if (strstr(newfilename,".Z") || strstr(newfilename,".gz")) { alarm(NETTIMEOUT); if (ftp_open_network(filename,&ftpfile,&command,&sock)) { alarm(0); ffpmsg("Unable to open ftp file (ftp_open)"); ffpmsg(filename); goto error; } } else { /* Try the .gz one */ strcpy(newfilename,filename); strcat(newfilename,".gz"); alarm(NETTIMEOUT); if (ftp_open_network(newfilename,&ftpfile,&command,&sock)) { alarm(0); strcpy(newfilename,filename); strcat(newfilename,".Z"); alarm(NETTIMEOUT); if (ftp_open_network(newfilename,&ftpfile,&command,&sock)) { /* Now as given */ alarm(0); strcpy(newfilename,filename); alarm(NETTIMEOUT); if (ftp_open_network(newfilename,&ftpfile,&command,&sock)) { alarm(0); ffpmsg("Unable to open ftp file (ftp_open)"); ffpmsg(newfilename); goto error; } } } } closeftpfile++; closecommandfile++; /* create the memory file */ if ((status = mem_create(filename,handle))) { ffpmsg ("Could not create memory file to passive port (ftp_open)"); ffpmsg(filename); goto error; } closememfile++; /* This isn't quite right, it'll fail if the file has .gzabc at the end for instance */ /* Decide if the file is compressed */ firstchar = fgetc(ftpfile); ungetc(firstchar,ftpfile); if (strstr(newfilename,".gz") || strstr(newfilename,".Z") || ('\037' == firstchar)) { status = 0; /* A bit arbritary really, the user will probably hit ^C */ alarm(NETTIMEOUT*10); status = mem_uncompress2mem(filename, ftpfile, *handle); alarm(0); if (status) { ffpmsg("Error writing compressed memory file (ftp_open)"); ffpmsg(filename); goto error; } } else { /* write a memory file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) { alarm(0); status = mem_write(*handle,recbuf,len); if (status) { ffpmsg("Error writing memory file (http_open)"); ffpmsg(filename); goto error; } alarm(NETTIMEOUT); } } /* close and clean up */ fclose(ftpfile); closeftpfile--; NET_SendRaw(sock,"QUIT\n",5,NET_DEFAULT); fclose(command); closecommandfile--; signal(SIGALRM, SIG_DFL); alarm(0); return mem_seek(*handle,0); error: alarm(0); /* clear it */ if (closecommandfile) { fclose(command); } if (closeftpfile) { fclose(ftpfile); } if (closememfile) { mem_close_free(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* This creates a file handle with a copy of the URL in filename. The file must be uncompressed and is copied to disk first */ int ftp_file_open(char *url, int rwmode, int *handle) { FILE *ftpfile; FILE *command; char recbuf[MAXLEN]; long len; int sock; int ii, flen, status; char firstchar; /* Check if output file is actually a memory file */ if (!strncmp(netoutfile, "mem:", 4) ) { /* allow the memory file to be opened with write access */ return( ftp_open(url, READONLY, handle) ); } closeftpfile = 0; closecommandfile = 0; closefile = 0; closeoutfile = 0; /* cfileio made a mistake, need to know where to write the output file */ flen = strlen(netoutfile); if (!flen) { ffpmsg("Output file not set, shouldn't have happened (ftp_file_open)"); return (FILE_NOT_OPENED); } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } signal(SIGALRM, signal_handler); /* open the network connection to url. ftpfile holds the connection to the input file, command holds the connection to port 21, and sock is the socket connected to port 21 */ alarm(NETTIMEOUT); if ((status = ftp_open_network(url,&ftpfile,&command,&sock))) { alarm(0); ffpmsg("Unable to open http file (ftp_file_open)"); ffpmsg(url); goto error; } closeftpfile++; closecommandfile++; if (*netoutfile == '!') { /* user wants to clobber file, if it already exists */ for (ii = 0; ii < flen; ii++) netoutfile[ii] = netoutfile[ii + 1]; /* remove '!' */ status = file_remove(netoutfile); } /* Now, what do we do with the file */ firstchar = fgetc(ftpfile); ungetc(firstchar,ftpfile); if (strstr(url,".gz") || strstr(url,".Z") || ('\037' == firstchar)) { /* to make this more cfitsioish we use the file driver calls to create the file */ /* Create the output file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output file (ftp_file_open)"); ffpmsg(netoutfile); goto error; } file_close(*handle); if (NULL == (outfile = fopen(netoutfile,"w"))) { ffpmsg("Unable to reopen the output file (ftp_file_open)"); ffpmsg(netoutfile); goto error; } closeoutfile++; status = 0; /* Ok, this is a tough case, let's be arbritary and say 10*NETTIMEOUT, Given the choices for nettimeout above they'll probaby ^C before, but it's always worth a shot*/ alarm(NETTIMEOUT*10); status = uncompress2file(url,ftpfile,outfile,&status); alarm(0); if (status) { ffpmsg("Unable to uncompress the output file (ftp_file_open)"); ffpmsg(url); ffpmsg(netoutfile); goto error; } fclose(outfile); closeoutfile--; } else { /* Create the output file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output file (ftp_file_open)"); ffpmsg(netoutfile); goto error; } closefile++; /* write a file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) { alarm(0); status = file_write(*handle,recbuf,len); if (status) { ffpmsg("Error writing file (ftp_file_open)"); ffpmsg(url); ffpmsg(netoutfile); goto error; } alarm(NETTIMEOUT); } file_close(*handle); } fclose(ftpfile); closeftpfile--; NET_SendRaw(sock,"QUIT\n",5,NET_DEFAULT); fclose(command); closecommandfile--; signal(SIGALRM, SIG_DFL); alarm(0); return file_open(netoutfile,rwmode,handle); error: alarm(0); /* clear it */ if (closeftpfile) { fclose(ftpfile); } if (closecommandfile) { fclose(command); } if (closeoutfile) { fclose(outfile); } if (closefile) { file_close(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* This creates a memory handle with a copy of the URL in filename. The file must be compressed and is copied to disk first */ int ftp_compress_open(char *url, int rwmode, int *handle) { FILE *ftpfile; FILE *command; char recbuf[MAXLEN]; long len; int ii, flen, status; int sock; char firstchar; closeftpfile = 0; closecommandfile = 0; closememfile = 0; closefdiskfile = 0; closediskfile = 0; /* don't do r/w files */ if (rwmode != 0) { ffpmsg("Compressed files must be r/o"); return (FILE_NOT_OPENED); } /* Need to know where to write the output file */ flen = strlen(netoutfile); if (!flen) { ffpmsg( "Output file not set, shouldn't have happened (ftp_compress_open)"); return (FILE_NOT_OPENED); } /* do the signal handler bits */ if (setjmp(env) != 0) { /* feels like the second time */ /* this means something bad happened */ ffpmsg("Timeout (http_open)"); goto error; } signal(SIGALRM, signal_handler); /* Open the network connection to url, ftpfile is connected to the file port, command is connected to port 21. sock is for writing to port 21 */ alarm(NETTIMEOUT); if ((status = ftp_open_network(url,&ftpfile,&command,&sock))) { alarm(0); ffpmsg("Unable to open ftp file (ftp_compress_open)"); ffpmsg(url); goto error; } closeftpfile++; closecommandfile++; /* Now, what do we do with the file */ firstchar = fgetc(ftpfile); ungetc(firstchar,ftpfile); if (strstr(url,".gz") || strstr(url,".Z") || ('\037' == firstchar)) { if (*netoutfile == '!') { /* user wants to clobber file, if it already exists */ for (ii = 0; ii < flen; ii++) netoutfile[ii] = netoutfile[ii + 1]; /* remove '!' */ status = file_remove(netoutfile); } /* Create the output file */ if ((status = file_create(netoutfile,handle))) { ffpmsg("Unable to create output file (ftp_compress_open)"); ffpmsg(netoutfile); goto error; } closediskfile++; /* write a file */ alarm(NETTIMEOUT); while(0 != (len = fread(recbuf,1,MAXLEN,ftpfile))) { alarm(0); status = file_write(*handle,recbuf,len); if (status) { ffpmsg("Error writing file (ftp_compres_open)"); ffpmsg(url); ffpmsg(netoutfile); goto error; } alarm(NETTIMEOUT); } file_close(*handle); closediskfile--; fclose(ftpfile); closeftpfile--; /* Close down the ftp connection */ NET_SendRaw(sock,"QUIT\n",5,NET_DEFAULT); fclose(command); closecommandfile--; /* File is on disk, let's uncompress it into memory */ if (NULL == (diskfile = fopen(netoutfile,"r"))) { ffpmsg("Unable to reopen disk file (ftp_compress_open)"); ffpmsg(netoutfile); return (FILE_NOT_OPENED); } closefdiskfile++; if ((status = mem_create(url,handle))) { ffpmsg("Unable to create memory file (ftp_compress_open)"); ffpmsg(url); goto error; } closememfile++; status = 0; status = mem_uncompress2mem(url,diskfile,*handle); fclose(diskfile); closefdiskfile--; if (status) { ffpmsg("Error writing compressed memory file (ftp_compress_open)"); goto error; } } else { /* Opps, this should not have happened */ ffpmsg("Can only compressed files here (ftp_compress_open)"); goto error; } signal(SIGALRM, SIG_DFL); alarm(0); return mem_seek(*handle,0); error: alarm(0); /* clear it */ if (closeftpfile) { fclose(ftpfile); } if (closecommandfile) { fclose(command); } if (closefdiskfile) { fclose(diskfile); } if (closememfile) { mem_close_free(*handle); } if (closediskfile) { file_close(*handle); } signal(SIGALRM, SIG_DFL); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* Open a ftp connection to filename (really a URL), return ftpfile set to the file connection, and command set to the control connection, with sock also set to the control connection */ int ftp_open_network(char *filename, FILE **ftpfile, FILE **command, int *sock) { int status; int sock1; int tmpint; char recbuf[MAXLEN]; char errorstr[MAXLEN]; char tmpstr[MAXLEN]; char proto[SHORTLEN]; char host[SHORTLEN]; char *newhost; char *username; char *password; char fn[MAXLEN]; char *newfn; char *passive; char *tstr; char ip[SHORTLEN]; char turl[MAXLEN]; int port; /* parse the URL */ if (strlen(filename) > MAXLEN - 7) { ffpmsg("ftp filename is too long (ftp_open)"); return (FILE_NOT_OPENED); } strcpy(turl,"ftp://"); strcat(turl,filename); if (NET_ParseUrl(turl,proto,host,&port,fn)) { sprintf(errorstr,"URL Parse Error (ftp_open) %s",filename); ffpmsg(errorstr); return (FILE_NOT_OPENED); } #ifdef DEBUG printf ("proto, %s, host, %s, port %d, fn %s\n",proto,host,port,fn); #endif port = 21; /* we might have a user name */ username = "anonymous"; password = "user@host.com"; /* is there an @ sign */ if (NULL != (newhost = strrchr(host,'@'))) { *newhost = '\0'; /* make it a null, */ newhost++; /* Now newhost points to the host name and host points to the user name, password combo */ username = host; /* is there a : for a password */ if (NULL != strchr(username,':')) { password = strchr(username,':'); *password = '\0'; password++; } } else { newhost = host; } #ifdef DEBUG printf("User %s pass %s\n",username,password); #endif /* Connect to the host on the required port */ *sock = NET_TcpConnect(newhost,port); /* convert it to a stdio file */ if (NULL == (*command = fdopen(*sock,"r"))) { ffpmsg ("fdopen failed to convert socket to stdio file (ftp_open)"); return (FILE_NOT_OPENED); } /* Wait for the 220 response */ if (ftp_status(*command,"220 ")) { ffpmsg ("error connecting to remote server, no 220 seen (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* Send the user name and wait for the right response */ sprintf(tmpstr,"USER %s\n",username); status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT); if (ftp_status(*command,"331 ")) { ffpmsg ("USER error no 331 seen (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* Send the password and wait for the right response */ sprintf(tmpstr,"PASS %s\n",password); status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT); if (ftp_status(*command,"230 ")) { ffpmsg ("PASS error, no 230 seen (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* now do the cwd command */ newfn = strrchr(fn,'/'); if (newfn == NULL) { strcpy(tmpstr,"CWD /\n"); newfn = fn; } else { *newfn = '\0'; newfn++; if (strlen(fn) == 0) { strcpy(tmpstr,"CWD /\n"); } else { /* remove the leading slash */ if (fn[0] == '/') { sprintf(tmpstr,"CWD %s\n",&fn[1]); } else { sprintf(tmpstr,"CWD %s\n",fn); } } } #ifdef DEBUG printf("CWD command is %s\n",tmpstr); #endif status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT); if (ftp_status(*command,"250 ")) { ffpmsg ("CWD error, no 250 seen (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } if (!strlen(newfn)) { ffpmsg("Null file name (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* Always use binary mode */ sprintf(tmpstr,"TYPE I\n"); status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT); if (ftp_status(*command,"200 ")) { ffpmsg ("TYPE I error, 200 not seen (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } status = NET_SendRaw(*sock,"PASV\n",5,NET_DEFAULT); if (!(fgets(recbuf,MAXLEN,*command))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* Passive mode response looks like 227 Entering Passive Mode (129,194,67,8,210,80) */ if (recbuf[0] == '2' && recbuf[1] == '2' && recbuf[2] == '7') { /* got a good passive mode response, find the opening ( */ if (!(passive = strchr(recbuf,'('))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } *passive = '\0'; passive++; ip[0] = '\0'; /* Messy parsing of response from PASV *command */ if (!(tstr = strtok(passive,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } strcpy(ip,tstr); strcat(ip,"."); if (!(tstr = strtok(NULL,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } strcat(ip,tstr); strcat(ip,"."); if (!(tstr = strtok(NULL,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } strcat(ip,tstr); strcat(ip,"."); if (!(tstr = strtok(NULL,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } strcat(ip,tstr); /* Done the ip number, now do the port # */ if (!(tstr = strtok(NULL,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } sscanf(tstr,"%d",&port); port *= 256; if (!(tstr = strtok(NULL,",)"))) { ffpmsg ("PASV error (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } sscanf(tstr,"%d",&tmpint); port += tmpint; if (!strlen(newfn)) { ffpmsg("Null file name (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } #ifdef DEBUG puts("connection to passive port"); #endif /* COnnect to the data port */ sock1 = NET_TcpConnect(ip,port); if (NULL == (*ftpfile = fdopen(sock1,"r"))) { ffpmsg ("Could not connect to passive port (ftp_open)"); fclose(*command); return (FILE_NOT_OPENED); } /* now we return */ /* Send the retrieve command */ sprintf(tmpstr,"RETR %s\n",newfn); status = NET_SendRaw(*sock,tmpstr,strlen(tmpstr),NET_DEFAULT); #ifdef DEBUG puts("Sent RETR command"); #endif if (ftp_status(*command,"150 ")) { /* ffpmsg ("RETR error, most likely file is not there (ftp_open)"); */ fclose(*command); #ifdef DEBUG puts("File not there"); #endif return (FILE_NOT_OPENED); } return 0; } /* no passive mode */ NET_SendRaw(*sock,"QUIT\n",5,NET_DEFAULT); fclose(*command); return (FILE_NOT_OPENED); } /*--------------------------------------------------------------------------*/ /* return a socket which results from connection to hostname on port port */ static int NET_TcpConnect(char *hostname, int port) { /* Connect to hostname on port */ struct sockaddr_in sockaddr; int sock; int stat; int val = 1; CreateSocketAddress(&sockaddr,hostname,port); /* Create socket */ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { ffpmsg("Can't create socket"); return CONNECTION_ERROR; } if ((stat = connect(sock, (struct sockaddr*) &sockaddr, sizeof(sockaddr))) < 0) { close(sock); /* perror("NET_Tcpconnect - Connection error"); ffpmsg("Can't connect to host, connection error"); */ return CONNECTION_ERROR; } setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&val, sizeof(val)); val = 65536; setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&val, sizeof(val)); setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&val, sizeof(val)); return sock; } /*--------------------------------------------------------------------------*/ /* Write len bytes from buffer to socket sock */ static int NET_SendRaw(int sock, const void *buffer, int length, int opt) { char * buf = (char *) buffer; int flag; int n, nsent = 0; switch (opt) { case NET_DEFAULT: flag = 0; break; case NET_OOB: flag = MSG_OOB; break; case NET_PEEK: default: flag = 0; break; } if (sock < 0) return -1; for (n = 0; n < length; n += nsent) { if ((nsent = send(sock, buf+n, length-n, flag)) <= 0) { return nsent; } #ifdef DEBUG printf ("send raw, sent %d bytes\n",nsent); #endif } #ifdef DEBUG printf ("send raw end, sent %d bytes\n",n); #endif return n; } /*--------------------------------------------------------------------------*/ static int NET_RecvRaw(int sock, void *buffer, int length) { /* Receive exactly length bytes into buffer. Returns number of bytes */ /* received. Returns -1 in case of error. */ int nrecv, n; char *buf = (char *)buffer; if (sock < 0) return -1; for (n = 0; n < length; n += nrecv) { while ((nrecv = recv(sock, buf+n, length-n, 0)) == -1 && errno == EINTR) errno = 0; /* probably a SIGCLD that was caught */ if (nrecv < 0) return nrecv; else if (nrecv == 0) break; /*/ EOF */ } return n; } /*--------------------------------------------------------------------------*/ /* Yet Another URL Parser url - input url proto - input protocol host - output host port - output port fn - output filename */ static int NET_ParseUrl(const char *url, char *proto, char *host, int *port, char *fn) { /* parses urls into their bits */ /* returns 1 if error, else 0 */ char *urlcopy, *urlcopyorig; char *ptrstr; char *thost; int isftp = 0; /* figure out if there is a http: or ftp: */ urlcopyorig = urlcopy = (char *) malloc(strlen(url)+1); strcpy(urlcopy,url); /* set some defaults */ *port = 80; strcpy(proto,"http:"); strcpy(host,"localhost"); strcpy(fn,"/"); ptrstr = strstr(urlcopy,"http:"); if (ptrstr == NULL) { /* Nope, not http: */ ptrstr = strstr(urlcopy,"root:"); if (ptrstr == NULL) { /* Nope, not root either */ ptrstr = strstr(urlcopy,"ftp:"); if (ptrstr != NULL) { if (ptrstr == urlcopy) { strcpy(proto,"ftp:"); *port = 21; isftp++; urlcopy += 4; /* move past ftp: */ } else { /* not at the beginning, bad url */ free(urlcopyorig); return 1; } } } else { if (ptrstr == urlcopy) { urlcopy += 5; /* move past root: */ } else { /* not at the beginning, bad url */ free(urlcopyorig); return 1; } } } else { if (ptrstr == urlcopy) { urlcopy += 5; /* move past http: */ } else { free(urlcopyorig); return 1; } } /* got the protocol */ /* get the hostname */ if (urlcopy[0] == '/' && urlcopy[1] == '/') { /* we have a hostname */ urlcopy += 2; /* move past the // */ } /* do this only if http */ if (!strcmp(proto,"http:")) { /* Move past any user:password */ if ((thost = strchr(urlcopy, '@')) != NULL) urlcopy = thost+1; strcpy(host,urlcopy); thost = host; while (*urlcopy != '/' && *urlcopy != ':' && *urlcopy) { thost++; urlcopy++; } /* we should either be at the end of the string, have a /, or have a : */ *thost = '\0'; if (*urlcopy == ':') { /* follows a port number */ urlcopy++; sscanf(urlcopy,"%d",port); while (*urlcopy != '/' && *urlcopy) urlcopy++; /* step to the */ } } else { /* do this for ftp */ strcpy(host,urlcopy); thost = host; while (*urlcopy != '/' && *urlcopy) { thost++; urlcopy++; } *thost = '\0'; /* Now, we should either be at the end of the string, or have a / */ } /* Now the rest is a fn */ if (*urlcopy) { strcpy(fn,urlcopy); } free(urlcopyorig); return 0; } /*--------------------------------------------------------------------------*/ /* Small helper functions to set the netoutfile static string */ /* Called by cfileio after parsing the output file off of the input file url */ int http_checkfile (char *urltype, char *infile, char *outfile1) { char newinfile[MAXLEN]; FILE *httpfile; char contentencoding[MAXLEN]; int contentlength; /* default to http:// if there is no output file */ strcpy(urltype,"http://"); if (strlen(outfile1)) { /* there is an output file */ /* don't copy the "file://" prefix, if present. */ if (!strncmp(outfile1, "file://", 7) ) strcpy(netoutfile,outfile1+7); else strcpy(netoutfile,outfile1); if (!strncmp(outfile1, "mem:", 4) ) { /* copy the file to memory, with READ and WRITE access In this case, it makes no difference whether the http file and or the output file are compressed or not. */ strcpy(urltype, "httpmem://"); /* use special driver */ return 0; } if (strstr(infile, "?")) { /* file name contains a '?' so probably a cgi string; don't open it */ strcpy(urltype,"httpfile://"); return 0; } if (!http_open_network(infile,&httpfile,contentencoding,&contentlength)) { fclose(httpfile); /* It's there, we're happy */ if (strstr(infile,".gz") || (strstr(infile,".Z"))) { /* It's compressed */ if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"httpcompress://"); } else { strcpy(urltype,"httpfile://"); } } else { strcpy(urltype,"httpfile://"); } return 0; } /* Ok, let's try the .gz one */ strcpy(newinfile,infile); strcat(newinfile,".gz"); if (!http_open_network(newinfile,&httpfile,contentencoding, &contentlength)) { fclose(httpfile); strcpy(infile,newinfile); /* It's there, we're happy, and, it's compressed */ /* It's compressed */ if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"httpcompress://"); } else { strcpy(urltype,"httpfile://"); } return 0; } /* Ok, let's try the .Z one */ strcpy(newinfile,infile); strcat(newinfile,".Z"); if (!http_open_network(newinfile,&httpfile,contentencoding, &contentlength)) { fclose(httpfile); strcpy(infile,newinfile); /* It's there, we're happy, and, it's compressed */ if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"httpcompress://"); } else { strcpy(urltype,"httpfile://"); } return 0; } } return 0; } /*--------------------------------------------------------------------------*/ int ftp_checkfile (char *urltype, char *infile, char *outfile1) { char newinfile[MAXLEN]; FILE *ftpfile; FILE *command; int sock; /* default to ftp:// */ strcpy(urltype,"ftp://"); if (strlen(outfile1)) { /* there is an output file */ /* don't copy the "file://" prefix, if present. */ if (!strncmp(outfile1, "file://", 7) ) strcpy(netoutfile,outfile1+7); else strcpy(netoutfile,outfile1); if (!strncmp(outfile1, "mem:", 4) ) { /* copy the file to memory, with READ and WRITE access In this case, it makes no difference whether the ftp file and or the output file are compressed or not. */ strcpy(urltype, "ftpmem://"); /* use special driver */ return 0; } if (!ftp_open_network(infile,&ftpfile,&command,&sock)) { fclose(ftpfile); fclose(command); /* It's there, we're happy */ if (strstr(infile,".gz") || (strstr(infile,".Z"))) { /* It's compressed */ if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"ftpcompress://"); } else { strcpy(urltype,"ftpfile://"); } } else { strcpy(urltype,"ftpfile://"); } return 0; } /* Ok, let's try the .gz one */ strcpy(newinfile,infile); strcat(newinfile,".gz"); if (!ftp_open_network(newinfile,&ftpfile,&command,&sock)) { fclose(ftpfile); fclose(command); strcpy(infile,newinfile); /* It's there, we're happy, and, it's compressed */ if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"ftpcompress://"); } else { strcpy(urltype,"ftpfile://"); } return 0; } /* Ok, let's try the .Z one */ strcpy(newinfile,infile); strcat(newinfile,".Z"); if (!ftp_open_network(newinfile,&ftpfile,&command,&sock)) { fclose(ftpfile); fclose(command); strcpy(infile,newinfile); if (strstr(outfile1,".gz") || (strstr(outfile1,".Z"))) { strcpy(urltype,"ftpcompress://"); } else { strcpy(urltype,"ftpfile://"); } return 0; } } return 0; } /*--------------------------------------------------------------------------*/ /* A small helper function to wait for a particular status on the ftp connectino */ static int ftp_status(FILE *ftp, char *statusstr) { /* read through until we find a string beginning with statusstr */ /* This needs a timeout */ char recbuf[MAXLEN]; int len; len = strlen(statusstr); while (1) { if (!(fgets(recbuf,MAXLEN,ftp))) { #ifdef DEBUG puts("error reading response in ftp_status"); #endif return 1; /* error reading */ } #ifdef DEBUG printf("ftp_status, return string was %s\n",recbuf); #endif recbuf[len] = '\0'; /* make it short */ if (!strcmp(recbuf,statusstr)) { return 0; /* we're ok */ } if (recbuf[0] > '3') { /* oh well, some sort of error */ return 1; } } } /* *---------------------------------------------------------------------- * * CreateSocketAddress -- * * This function initializes a sockaddr structure for a host and port. * * Results: * 1 if the host was valid, 0 if the host could not be converted to * an IP address. * * Side effects: * Fills in the *sockaddrPtr structure. * *---------------------------------------------------------------------- */ static int CreateSocketAddress( struct sockaddr_in *sockaddrPtr, /* Socket address */ char *host, /* Host. NULL implies INADDR_ANY */ int port) /* Port number */ { struct hostent *hostent; /* Host database entry */ struct in_addr addr; /* For 64/32 bit madness */ char localhost[MAXLEN]; strcpy(localhost,host); memset((void *) sockaddrPtr, '\0', sizeof(struct sockaddr_in)); sockaddrPtr->sin_family = AF_INET; sockaddrPtr->sin_port = htons((unsigned short) (port & 0xFFFF)); if (host == NULL) { addr.s_addr = INADDR_ANY; } else { addr.s_addr = inet_addr(localhost); if (addr.s_addr == 0xFFFFFFFF) { hostent = gethostbyname(localhost); if (hostent != NULL) { memcpy((void *) &addr, (void *) hostent->h_addr_list[0], (size_t) hostent->h_length); } else { #ifdef EHOSTUNREACH errno = EHOSTUNREACH; #else #ifdef ENXIO errno = ENXIO; #endif #endif return 0; /* error */ } } } /* * NOTE: On 64 bit machines the assignment below is rumored to not * do the right thing. Please report errors related to this if you * observe incorrect behavior on 64 bit machines such as DEC Alphas. * Should we modify this code to do an explicit memcpy? */ sockaddrPtr->sin_addr.s_addr = addr.s_addr; return 1; /* Success. */ } /* Signal handler for timeouts */ static void signal_handler(int sig) { switch (sig) { case SIGALRM: /* process for alarm */ longjmp(env,sig); default: { /* Hmm, shouldn't have happend */ exit(sig); } } } /**************************************************************/ /* Root driver */ /*--------------------------------------------------------------------------*/ int root_init(void) { int ii; for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */ { handleTable[ii].sock = 0; handleTable[ii].currentpos = 0; } return(0); } /*--------------------------------------------------------------------------*/ int root_setoptions(int options) { /* do something with the options argument, to stop compiler warning */ options = 0; return(options); } /*--------------------------------------------------------------------------*/ int root_getoptions(int *options) { *options = 0; return(0); } /*--------------------------------------------------------------------------*/ int root_getversion(int *version) { *version = 10; return(0); } /*--------------------------------------------------------------------------*/ int root_shutdown(void) { return(0); } /*--------------------------------------------------------------------------*/ int root_open(char *url, int rwmode, int *handle) { int ii, status; int sock; *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in table */ { if (handleTable[ii].sock == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ /*open the file */ if (rwmode) { status = root_openfile(url, "update", &sock); } else { status = root_openfile(url, "read", &sock); } if (status) return(status); handleTable[ii].sock = sock; handleTable[ii].currentpos = 0; return(0); } /*--------------------------------------------------------------------------*/ int root_create(char *filename, int *handle) { int ii, status; int sock; *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in table */ { if (handleTable[ii].sock == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ /*open the file */ status = root_openfile(filename, "create", &sock); if (status) { ffpmsg("Unable to create file"); return(status); } handleTable[ii].sock = sock; handleTable[ii].currentpos = 0; return(0); } /*--------------------------------------------------------------------------*/ int root_size(int handle, LONGLONG *filesize) /* return the size of the file in bytes */ { int sock; int offset; int status; int op; sock = handleTable[handle].sock; status = root_send_buffer(sock,ROOTD_STAT,NULL,0); status = root_recv_buffer(sock,&op,(char *)&offset, 4); *filesize = (LONGLONG) ntohl(offset); return(0); } /*--------------------------------------------------------------------------*/ int root_close(int handle) /* close the file */ { int status; int sock; sock = handleTable[handle].sock; status = root_send_buffer(sock,ROOTD_CLOSE,NULL,0); close(sock); handleTable[handle].sock = 0; return(0); } /*--------------------------------------------------------------------------*/ int root_flush(int handle) /* flush the file */ { int status; int sock; sock = handleTable[handle].sock; status = root_send_buffer(sock,ROOTD_FLUSH,NULL,0); return(0); } /*--------------------------------------------------------------------------*/ int root_seek(int handle, LONGLONG offset) /* seek to position relative to start of the file */ { handleTable[handle].currentpos = offset; return(0); } /*--------------------------------------------------------------------------*/ int root_read(int hdl, void *buffer, long nbytes) /* read bytes from the current position in the file */ { char msg[SHORTLEN]; int op; int status; int astat; /* we presume here that the file position will never be > 2**31 = 2.1GB */ sprintf(msg,"%ld %ld ",(long) handleTable[hdl].currentpos,nbytes); status = root_send_buffer(handleTable[hdl].sock,ROOTD_GET,msg,strlen(msg)); if ((unsigned) status != strlen(msg)) { return (READ_ERROR); } astat = 0; status = root_recv_buffer(handleTable[hdl].sock,&op,(char *) &astat,4); if (astat != 0) { return (READ_ERROR); } #ifdef DEBUG printf("root_read, op %d astat %d\n",op,astat); #endif status = NET_RecvRaw(handleTable[hdl].sock,buffer,nbytes); if (status != nbytes) { return (READ_ERROR); } handleTable[hdl].currentpos += nbytes; return(0); } /*--------------------------------------------------------------------------*/ int root_write(int hdl, void *buffer, long nbytes) /* write bytes at the current position in the file */ { char msg[SHORTLEN]; int len; int sock; int status; int astat; int op; sock = handleTable[hdl].sock; /* we presume here that the file position will never be > 2**31 = 2.1GB */ sprintf(msg,"%ld %ld ",(long) handleTable[hdl].currentpos,nbytes); len = strlen(msg); status = root_send_buffer(sock,ROOTD_PUT,msg,len+1); if (status != len+1) { return (WRITE_ERROR); } status = NET_SendRaw(sock,buffer,nbytes,NET_DEFAULT); if (status != nbytes) { return (WRITE_ERROR); } astat = 0; status = root_recv_buffer(handleTable[hdl].sock,&op,(char *) &astat,4); #ifdef DEBUG printf("root_read, op %d astat %d\n",op,astat); #endif if (astat != 0) { return (WRITE_ERROR); } handleTable[hdl].currentpos += nbytes; return(0); } /*--------------------------------------------------------------------------*/ int root_openfile(char *url, char *rwmode, int *sock) /* lowest level routine to physically open a root file */ { int status; char recbuf[MAXLEN]; char errorstr[MAXLEN]; char proto[SHORTLEN]; char host[SHORTLEN]; char fn[MAXLEN]; char turl[MAXLEN]; int port; int op; int ii; int authstat; /* Parse the URL apart again */ strcpy(turl,"root://"); strcat(turl,url); if (NET_ParseUrl(turl,proto,host,&port,fn)) { sprintf(errorstr,"URL Parse Error (root_open) %s",url); ffpmsg(errorstr); return (FILE_NOT_OPENED); } #ifdef DEBUG printf("Connecting to %s on port %d\n",host,port); #endif /* Connect to the remote host */ *sock = NET_TcpConnect(host,port); if (*sock < 0) { ffpmsg("Couldn't connect to host (http_open_network)"); return (FILE_NOT_OPENED); } /* get the username */ if (NULL != getenv("ROOTUSERNAME")) { strcpy(recbuf,getenv("ROOTUSERNAME")); } else { printf("Username: "); fgets(recbuf,MAXLEN,stdin); recbuf[strlen(recbuf)-1] = '\0'; } status = root_send_buffer(*sock, ROOTD_USER, recbuf,strlen(recbuf)); if (status < 0) { ffpmsg("error talking to remote system on username "); return (FILE_NOT_OPENED); } status = root_recv_buffer(*sock,&op,(char *)&authstat,4); if (!status) { ffpmsg("error talking to remote system on username"); return (FILE_NOT_OPENED); } #ifdef DEBUG printf("op is %d and authstat is %d\n",op,authstat); #endif if (op != ROOTD_AUTH) { ffpmsg("ERROR on ROOTD_USER"); ffpmsg(recbuf); return (FILE_NOT_OPENED); } /* now the password */ if (NULL != getenv("ROOTPASSWORD")) { strcpy(recbuf,getenv("ROOTPASSWORD")); } else { printf("Password: "); fgets(recbuf,MAXLEN,stdin); recbuf[strlen(recbuf)-1] = '\0'; } /* ones complement the password */ for (ii=0;(unsigned) ii includes the 4 bytes for the op, the length bytes (4) are implicit if buffer is null don't send it, not everything needs something sent */ int len; int status; int hdr[2]; len = 4; if (buffer != NULL) { len += buflen; } hdr[0] = htonl(len); #ifdef DEBUG printf("len sent is %x\n",hdr[0]); #endif hdr[1] = htonl(op); #ifdef DEBUG printf("op sent is %x\n",hdr[1]); #endif #ifdef DEBUG printf("Sending op %d and length of %d\n",op,len); #endif status = NET_SendRaw(sock,hdr,sizeof(hdr),NET_DEFAULT); if (status < 0) { return status; } if (buffer != NULL) { status = NET_SendRaw(sock,buffer,buflen,NET_DEFAULT); } return status; } static int root_recv_buffer(int sock, int *op, char *buffer, int buflen) { /* recv a buffer, the form is */ int recv1 = 0; int len; int status; char recbuf[MAXLEN]; status = NET_RecvRaw(sock,&len,4); #ifdef DEBUG printf("Recv: status from rec is %d\n",status); #endif if (status < 0) { return status; } recv1 += status; len = ntohl(len); #ifdef DEBUG printf ("Recv: length is %d\n",len); #endif /* ok, have the length, recive the operation */ len -= 4; status = NET_RecvRaw(sock,op,4); if (status < 0) { return status; } recv1 += status; *op = ntohl(*op); #ifdef DEBUG printf ("Recv: Operation is %d\n",*op); #endif if (len > MAXLEN) { len = MAXLEN; } if (len > 0) { /* Get the rest of the message */ status = NET_RecvRaw(sock,recbuf,len); if (len > buflen) { len = buflen; } memcpy(buffer,recbuf,len); if (status < 0) { return status; } } recv1 += status; return recv1; } /*****************************************************************************/ /* Encode a string into MIME Base64 format string */ static int encode64(unsigned s_len, char *src, unsigned d_len, char *dst) { static char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "+/"; unsigned triad; for (triad = 0; triad < s_len; triad += 3) { unsigned long int sr; unsigned byte; for (byte = 0; (byte<3) && (triad+byte /* the following was provided by Michael Greason (GSFC) to fix a */ /* C/Fortran compatibility problem on an SGI Altix system running */ /* SGI ProPack 4 [this is a Novell SuSE Enterprise 9 derivative] */ /* and using the Intel C++ and Fortran compilers (version 9.1) */ #if defined(__INTEL_COMPILER) && defined(__itanium__) # define mipsFortran 1 # define _MIPS_SZLONG 64 #endif #if defined(linux) || defined(__APPLE__) || defined(__sgi) # include /* apparently needed on debian linux systems */ #endif /* to define off_t */ #include /* apparently needed to define size_t with gcc 2.8.1 */ #include /* needed for LLONG_MAX and INT64_MAX definitions */ /* Define the datatype for variables which store file offset values. */ /* The newer 'off_t' datatype should be used for this purpose, but some */ /* older compilers do not recognize this type, in which case we use 'long' */ /* instead. Note that _OFF_T is defined (or not) in stdio.h depending */ /* on whether _LARGEFILE_SOURCE is defined in sys/feature_tests.h */ /* (at least on Solaris platforms using cc) */ /* Debian systems require the 2nd test, below, */ /* i.e, "(defined(linux) && defined(__off_t_defined))" */ #if defined(_OFF_T) || (defined(linux) && defined(__off_t_defined)) || defined(_MIPS_SZLONG) || defined(__APPLE__) || defined(_AIX) # define OFF_T off_t #elif defined(_MSC_VER) && (_MSC_VER>= 1400) # define OFF_T long long #else # define OFF_T long #endif /* this block determines if the the string function name is strtol or strtoll, and whether to use %ld or %lld in printf statements */ /* The following 2 cases for that Athon64 were removed on 4 Jan 2006; they appear to be incorrect now that LONGLONG is always typedef'ed to 'long long' || defined(__ia64__) \ || defined(__x86_64__) \ */ #if (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \ || defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__)) \ || defined(__powerpc64__) || defined(__64BIT__) \ || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) \ || defined( _MSC_VER)|| defined(__BORLANDC__) # define USE_LL_SUFFIX 0 #else # define USE_LL_SUFFIX 1 #endif /* Determine what 8-byte integer data type is available. 'long long' is now supported by most compilers, but older MS Visual C++ compilers before V7.0 use '__int64' instead. */ #ifndef LONGLONG_TYPE /* this may have been previously defined */ #if defined(_MSC_VER) /* Microsoft Visual C++ */ #if (_MSC_VER < 1300) /* versions earlier than V7.0 do not have 'long long' */ typedef __int64 LONGLONG; #else /* newer versions do support 'long long' */ typedef long long LONGLONG; #endif #elif defined( __BORLANDC__) /* for the Borland 5.5 compiler, in particular */ typedef __int64 LONGLONG; #else typedef long long LONGLONG; #endif #define LONGLONG_TYPE #endif #ifndef LONGLONG_MAX #ifdef LLONG_MAX /* Linux and Solaris definition */ #define LONGLONG_MAX LLONG_MAX #define LONGLONG_MIN LLONG_MIN #elif defined(LONG_LONG_MAX) #define LONGLONG_MAX LONG_LONG_MAX #define LONGLONG_MIN LONG_LONG_MIN #elif defined(__LONG_LONG_MAX__) /* Mac OS X & CYGWIN defintion */ #define LONGLONG_MAX __LONG_LONG_MAX__ #define LONGLONG_MIN (-LONGLONG_MAX -1LL) #elif defined(INT64_MAX) /* windows definition */ #define LONGLONG_MAX INT64_MAX #define LONGLONG_MIN INT64_MIN #elif defined(_I64_MAX) /* windows definition */ #define LONGLONG_MAX _I64_MAX #define LONGLONG_MIN _I64_MIN #elif (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \ || defined(__sparcv9) \ || defined(__ia64__) \ || defined(__x86_64__) \ || defined(_SX) \ || defined(__powerpc64__) || defined(__64BIT__) \ || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) /* sizeof(long) = 64 */ #define LONGLONG_MAX 9223372036854775807L /* max 64-bit integer */ #define LONGLONG_MIN (-LONGLONG_MAX -1L) /* min 64-bit integer */ #else /* define a default value, even if it is never used */ #define LONGLONG_MAX 9223372036854775807LL /* max 64-bit integer */ #define LONGLONG_MIN (-LONGLONG_MAX -1LL) /* min 64-bit integer */ #endif #endif /* end of ndef LONGLONG_MAX section */ /* ================================================================= */ /* The following exclusion if __CINT__ is defined is needed for ROOT */ #ifndef __CINT__ #include "longnam.h" #endif #define NIOBUF 40 /* number of IO buffers to create (default = 40) */ /* !! Significantly increasing NIOBUF may degrade performance !! */ #define IOBUFLEN 2880 /* size in bytes of each IO buffer (DONT CHANGE!) */ /* global variables */ #define FLEN_FILENAME 1025 /* max length of a filename */ #define FLEN_KEYWORD 72 /* max length of a keyword (HIERARCH convention) */ #define FLEN_CARD 81 /* length of a FITS header card */ #define FLEN_VALUE 71 /* max length of a keyword value string */ #define FLEN_COMMENT 73 /* max length of a keyword comment string */ #define FLEN_ERRMSG 81 /* max length of a FITSIO error message */ #define FLEN_STATUS 31 /* max length of a FITSIO status text string */ #define TBIT 1 /* codes for FITS table data types */ #define TBYTE 11 #define TSBYTE 12 #define TLOGICAL 14 #define TSTRING 16 #define TUSHORT 20 #define TSHORT 21 #define TUINT 30 #define TINT 31 #define TULONG 40 #define TLONG 41 #define TINT32BIT 41 /* used when returning datatype of a column */ #define TFLOAT 42 #define TLONGLONG 81 #define TDOUBLE 82 #define TCOMPLEX 83 #define TDBLCOMPLEX 163 #define TYP_STRUC_KEY 10 #define TYP_CMPRS_KEY 20 #define TYP_SCAL_KEY 30 #define TYP_NULL_KEY 40 #define TYP_DIM_KEY 50 #define TYP_RANG_KEY 60 #define TYP_UNIT_KEY 70 #define TYP_DISP_KEY 80 #define TYP_HDUID_KEY 90 #define TYP_CKSUM_KEY 100 #define TYP_WCS_KEY 110 #define TYP_REFSYS_KEY 120 #define TYP_COMM_KEY 130 #define TYP_CONT_KEY 140 #define TYP_USER_KEY 150 #define INT32BIT int /* 32-bit integer datatype. Currently this */ /* datatype is an 'int' on all useful platforms */ /* however, it is possible that that are cases */ /* where 'int' is a 2-byte integer, in which case */ /* INT32BIT would need to be defined as 'long'. */ #define BYTE_IMG 8 /* BITPIX code values for FITS image types */ #define SHORT_IMG 16 #define LONG_IMG 32 #define LONGLONG_IMG 64 #define FLOAT_IMG -32 #define DOUBLE_IMG -64 /* The following 2 codes are not true FITS */ /* datatypes; these codes are only used internally */ /* within cfitsio to make it easier for users */ /* to deal with unsigned integers. */ #define SBYTE_IMG 10 #define USHORT_IMG 20 #define ULONG_IMG 40 #define IMAGE_HDU 0 /* Primary Array or IMAGE HDU */ #define ASCII_TBL 1 /* ASCII table HDU */ #define BINARY_TBL 2 /* Binary table HDU */ #define ANY_HDU -1 /* matches any HDU type */ #define READONLY 0 /* options when opening a file */ #define READWRITE 1 /* adopt a hopefully obscure number to use as a null value flag */ /* could be problems if the FITS files contain data with these values */ #define FLOATNULLVALUE -9.11912E-36F #define DOUBLENULLVALUE -9.1191291391491E-36 /* compression algorithm codes */ #define NO_DITHER -1 #define SUBTRACTIVE_DITHER_1 1 #define SUBTRACTIVE_DITHER_2 2 #define MAX_COMPRESS_DIM 6 #define RICE_1 11 #define GZIP_1 21 #define GZIP_2 22 #define PLIO_1 31 #define HCOMPRESS_1 41 #define BZIP2_1 51 /* not publicly supported; only for test purposes */ #define NOCOMPRESS -1 #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #define CASESEN 1 /* do case-sensitive string match */ #define CASEINSEN 0 /* do case-insensitive string match */ #define GT_ID_ALL_URI 0 /* hierarchical grouping parameters */ #define GT_ID_REF 1 #define GT_ID_POS 2 #define GT_ID_ALL 3 #define GT_ID_REF_URI 11 #define GT_ID_POS_URI 12 #define OPT_RM_GPT 0 #define OPT_RM_ENTRY 1 #define OPT_RM_MBR 2 #define OPT_RM_ALL 3 #define OPT_GCP_GPT 0 #define OPT_GCP_MBR 1 #define OPT_GCP_ALL 2 #define OPT_MCP_ADD 0 #define OPT_MCP_NADD 1 #define OPT_MCP_REPL 2 #define OPT_MCP_MOV 3 #define OPT_MRG_COPY 0 #define OPT_MRG_MOV 1 #define OPT_CMT_MBR 1 #define OPT_CMT_MBR_DEL 11 typedef struct /* structure used to store table column information */ { char ttype[70]; /* column name = FITS TTYPEn keyword; */ LONGLONG tbcol; /* offset in row to first byte of each column */ int tdatatype; /* datatype code of each column */ LONGLONG trepeat; /* repeat count of column; number of elements */ double tscale; /* FITS TSCALn linear scaling factor */ double tzero; /* FITS TZEROn linear scaling zero point */ LONGLONG tnull; /* FITS null value for int image or binary table cols */ char strnull[20]; /* FITS null value string for ASCII table columns */ char tform[10]; /* FITS tform keyword value */ long twidth; /* width of each ASCII table column */ }tcolumn; #define VALIDSTRUC 555 /* magic value used to identify if structure is valid */ typedef struct /* structure used to store basic FITS file information */ { int filehandle; /* handle returned by the file open function */ int driver; /* defines which set of I/O drivers should be used */ int open_count; /* number of opened 'fitsfiles' using this structure */ char *filename; /* file name */ int validcode; /* magic value used to verify that structure is valid */ int only_one; /* flag meaning only copy the specified extension */ LONGLONG filesize; /* current size of the physical disk file in bytes */ LONGLONG logfilesize; /* logical size of file, including unflushed buffers */ int lasthdu; /* is this the last HDU in the file? 0 = no, else yes */ LONGLONG bytepos; /* current logical I/O pointer position in file */ LONGLONG io_pos; /* current I/O pointer position in the physical file */ int curbuf; /* number of I/O buffer currently in use */ int curhdu; /* current HDU number; 0 = primary array */ int hdutype; /* 0 = primary array, 1 = ASCII table, 2 = binary table */ int writemode; /* 0 = readonly, 1 = readwrite */ int maxhdu; /* highest numbered HDU known to exist in the file */ int MAXHDU; /* dynamically allocated dimension of headstart array */ LONGLONG *headstart; /* byte offset in file to start of each HDU */ LONGLONG headend; /* byte offest in file to end of the current HDU header */ LONGLONG ENDpos; /* byte offest to where the END keyword was last written */ LONGLONG nextkey; /* byte offset in file to beginning of next keyword */ LONGLONG datastart; /* byte offset in file to start of the current data unit */ int imgdim; /* dimension of image; cached for fast access */ LONGLONG imgnaxis[99]; /* length of each axis; cached for fast access */ int tfield; /* number of fields in the table (primary array has 2 */ int startcol; /* used by ffgcnn to record starting column number */ LONGLONG origrows; /* original number of rows (value of NAXIS2 keyword) */ LONGLONG numrows; /* number of rows in the table (dynamically updated) */ LONGLONG rowlength; /* length of a table row or image size (bytes) */ tcolumn *tableptr; /* pointer to the table structure */ LONGLONG heapstart; /* heap start byte relative to start of data unit */ LONGLONG heapsize; /* size of the heap, in bytes */ /* the following elements are related to compressed images */ /* these record the 'requested' options to be used when the image is compressed */ int request_compress_type; /* requested image compression algorithm */ long request_tilesize[MAX_COMPRESS_DIM]; /* requested tiling size */ float request_quantize_level; /* requested quantize level */ int request_quantize_method ; /* requested quantizing method */ int request_dither_seed; /* starting offset into the array of random dithering */ int request_lossy_int_compress; /* lossy compress integer image as if float image? */ int request_huge_hdu; /* use '1Q' rather then '1P' variable length arrays */ float request_hcomp_scale; /* requested HCOMPRESS scale factor */ int request_hcomp_smooth; /* requested HCOMPRESS smooth parameter */ /* these record the actual options that were used when the image was compressed */ int compress_type; /* type of compression algorithm */ long tilesize[MAX_COMPRESS_DIM]; /* size of compression tiles */ float quantize_level; /* floating point quantization level */ int quantize_method; /* floating point pixel quantization algorithm */ int dither_seed; /* starting offset into the array of random dithering */ /* other compression parameters */ int compressimg; /* 1 if HDU contains a compressed image, else 0 */ char zcmptype[12]; /* compression type string */ int zbitpix; /* FITS data type of image (BITPIX) */ int zndim; /* dimension of image */ long znaxis[MAX_COMPRESS_DIM]; /* length of each axis */ long maxtilelen; /* max number of pixels in each image tile */ long maxelem; /* maximum byte length of tile compressed arrays */ int cn_compressed; /* column number for COMPRESSED_DATA column */ int cn_uncompressed; /* column number for UNCOMPRESSED_DATA column */ int cn_gzip_data; /* column number for GZIP2 lossless compressed data */ int cn_zscale; /* column number for ZSCALE column */ int cn_zzero; /* column number for ZZERO column */ int cn_zblank; /* column number for the ZBLANK column */ double zscale; /* scaling value, if same for all tiles */ double zzero; /* zero pt, if same for all tiles */ double cn_bscale; /* value of the BSCALE keyword in header */ double cn_bzero; /* value of the BZERO keyword (may be reset) */ double cn_actual_bzero; /* actual value of the BZERO keyword */ int zblank; /* value for null pixels, if not a column */ int rice_blocksize; /* first compression parameter: Rice pixels/block */ int rice_bytepix; /* 2nd compression parameter: Rice bytes/pixel */ float hcomp_scale; /* 1st hcompress compression parameter */ int hcomp_smooth; /* 2nd hcompress compression parameter */ int *tilerow; /* row number of the array of uncompressed tiledata */ long *tiledatasize; /* length of the array of tile data in bytes */ int *tiletype; /* datatype of the array of tile (TINT, TSHORT, etc) */ void **tiledata; /* array of uncompressed tile of data, for row *tilerow */ void **tilenullarray; /* array of optional array of null value flags */ int *tileanynull; /* anynulls in the array of tile? */ char *iobuffer; /* pointer to FITS file I/O buffers */ long bufrecnum[NIOBUF]; /* file record number of each of the buffers */ int dirty[NIOBUF]; /* has the corresponding buffer been modified? */ int ageindex[NIOBUF]; /* relative age of each buffer */ } FITSfile; typedef struct /* structure used to store basic HDU information */ { int HDUposition; /* HDU position in file; 0 = first HDU */ FITSfile *Fptr; /* pointer to FITS file structure */ }fitsfile; typedef struct /* structure for the iterator function column information */ { /* elements required as input to fits_iterate_data: */ fitsfile *fptr; /* pointer to the HDU containing the column */ int colnum; /* column number in the table (use name if < 1) */ char colname[70]; /* name (= TTYPEn value) of the column (optional) */ int datatype; /* output datatype (converted if necessary */ int iotype; /* = InputCol, InputOutputCol, or OutputCol */ /* output elements that may be useful for the work function: */ void *array; /* pointer to the array (and the null value) */ long repeat; /* binary table vector repeat value */ long tlmin; /* legal minimum data value */ long tlmax; /* legal maximum data value */ char tunit[70]; /* physical unit string */ char tdisp[70]; /* suggested display format */ } iteratorCol; #define InputCol 0 /* flag for input only iterator column */ #define InputOutputCol 1 /* flag for input and output iterator column */ #define OutputCol 2 /* flag for output only iterator column */ /*============================================================================= * * The following wtbarr typedef is used in the fits_read_wcstab() routine, * which is intended for use with the WCSLIB library written by Mark * Calabretta, http://www.atnf.csiro.au/~mcalabre/index.html * * In order to maintain WCSLIB and CFITSIO as independent libraries it * was not permissible for any CFITSIO library code to include WCSLIB * header files, or vice versa. However, the CFITSIO function * fits_read_wcstab() accepts an array of structs defined by wcs.h within * WCSLIB. The problem then was to define this struct within fitsio.h * without including wcs.h, especially noting that wcs.h will often (but * not always) be included together with fitsio.h in an applications * program that uses fits_read_wcstab(). * * Of the various possibilities, the solution adopted was for WCSLIB to * define "struct wtbarr" while fitsio.h defines "typedef wtbarr", a * untagged struct with identical members. This allows both wcs.h and * fitsio.h to define a wtbarr data type without conflict by virtue of * the fact that structure tags and typedef names share different * namespaces in C. Therefore, declarations within WCSLIB look like * * struct wtbarr *w; * * while within CFITSIO they are simply * * wtbarr *w; * * but as suggested by the commonality of the names, these are really the * same aggregate data type. However, in passing a (struct wtbarr *) to * fits_read_wcstab() a cast to (wtbarr *) is formally required. *===========================================================================*/ #ifndef WCSLIB_GETWCSTAB #define WCSLIB_GETWCSTAB typedef struct { int i; /* Image axis number. */ int m; /* Array axis number for index vectors. */ int kind; /* Array type, 'c' (coord) or 'i' (index). */ char extnam[72]; /* EXTNAME of binary table extension. */ int extver; /* EXTVER of binary table extension. */ int extlev; /* EXTLEV of binary table extension. */ char ttype[72]; /* TTYPEn of column containing the array. */ long row; /* Table row number. */ int ndim; /* Expected array dimensionality. */ int *dimlen; /* Where to write the array axis lengths. */ double **arrayp; /* Where to write the address of the array */ /* allocated to store the array. */ } wtbarr; int fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status); #endif /* WCSLIB_GETWCSTAB */ /* error status codes */ #define CREATE_DISK_FILE -106 /* create disk file, without extended filename syntax */ #define OPEN_DISK_FILE -105 /* open disk file, without extended filename syntax */ #define SKIP_TABLE -104 /* move to 1st image when opening file */ #define SKIP_IMAGE -103 /* move to 1st table when opening file */ #define SKIP_NULL_PRIMARY -102 /* skip null primary array when opening file */ #define USE_MEM_BUFF -101 /* use memory buffer when opening file */ #define OVERFLOW_ERR -11 /* overflow during datatype conversion */ #define PREPEND_PRIMARY -9 /* used in ffiimg to insert new primary array */ #define SAME_FILE 101 /* input and output files are the same */ #define TOO_MANY_FILES 103 /* tried to open too many FITS files */ #define FILE_NOT_OPENED 104 /* could not open the named file */ #define FILE_NOT_CREATED 105 /* could not create the named file */ #define WRITE_ERROR 106 /* error writing to FITS file */ #define END_OF_FILE 107 /* tried to move past end of file */ #define READ_ERROR 108 /* error reading from FITS file */ #define FILE_NOT_CLOSED 110 /* could not close the file */ #define ARRAY_TOO_BIG 111 /* array dimensions exceed internal limit */ #define READONLY_FILE 112 /* Cannot write to readonly file */ #define MEMORY_ALLOCATION 113 /* Could not allocate memory */ #define BAD_FILEPTR 114 /* invalid fitsfile pointer */ #define NULL_INPUT_PTR 115 /* NULL input pointer to routine */ #define SEEK_ERROR 116 /* error seeking position in file */ #define BAD_URL_PREFIX 121 /* invalid URL prefix on file name */ #define TOO_MANY_DRIVERS 122 /* tried to register too many IO drivers */ #define DRIVER_INIT_FAILED 123 /* driver initialization failed */ #define NO_MATCHING_DRIVER 124 /* matching driver is not registered */ #define URL_PARSE_ERROR 125 /* failed to parse input file URL */ #define RANGE_PARSE_ERROR 126 /* failed to parse input file URL */ #define SHARED_ERRBASE (150) #define SHARED_BADARG (SHARED_ERRBASE + 1) #define SHARED_NULPTR (SHARED_ERRBASE + 2) #define SHARED_TABFULL (SHARED_ERRBASE + 3) #define SHARED_NOTINIT (SHARED_ERRBASE + 4) #define SHARED_IPCERR (SHARED_ERRBASE + 5) #define SHARED_NOMEM (SHARED_ERRBASE + 6) #define SHARED_AGAIN (SHARED_ERRBASE + 7) #define SHARED_NOFILE (SHARED_ERRBASE + 8) #define SHARED_NORESIZE (SHARED_ERRBASE + 9) #define HEADER_NOT_EMPTY 201 /* header already contains keywords */ #define KEY_NO_EXIST 202 /* keyword not found in header */ #define KEY_OUT_BOUNDS 203 /* keyword record number is out of bounds */ #define VALUE_UNDEFINED 204 /* keyword value field is blank */ #define NO_QUOTE 205 /* string is missing the closing quote */ #define BAD_INDEX_KEY 206 /* illegal indexed keyword name */ #define BAD_KEYCHAR 207 /* illegal character in keyword name or card */ #define BAD_ORDER 208 /* required keywords out of order */ #define NOT_POS_INT 209 /* keyword value is not a positive integer */ #define NO_END 210 /* couldn't find END keyword */ #define BAD_BITPIX 211 /* illegal BITPIX keyword value*/ #define BAD_NAXIS 212 /* illegal NAXIS keyword value */ #define BAD_NAXES 213 /* illegal NAXISn keyword value */ #define BAD_PCOUNT 214 /* illegal PCOUNT keyword value */ #define BAD_GCOUNT 215 /* illegal GCOUNT keyword value */ #define BAD_TFIELDS 216 /* illegal TFIELDS keyword value */ #define NEG_WIDTH 217 /* negative table row size */ #define NEG_ROWS 218 /* negative number of rows in table */ #define COL_NOT_FOUND 219 /* column with this name not found in table */ #define BAD_SIMPLE 220 /* illegal value of SIMPLE keyword */ #define NO_SIMPLE 221 /* Primary array doesn't start with SIMPLE */ #define NO_BITPIX 222 /* Second keyword not BITPIX */ #define NO_NAXIS 223 /* Third keyword not NAXIS */ #define NO_NAXES 224 /* Couldn't find all the NAXISn keywords */ #define NO_XTENSION 225 /* HDU doesn't start with XTENSION keyword */ #define NOT_ATABLE 226 /* the CHDU is not an ASCII table extension */ #define NOT_BTABLE 227 /* the CHDU is not a binary table extension */ #define NO_PCOUNT 228 /* couldn't find PCOUNT keyword */ #define NO_GCOUNT 229 /* couldn't find GCOUNT keyword */ #define NO_TFIELDS 230 /* couldn't find TFIELDS keyword */ #define NO_TBCOL 231 /* couldn't find TBCOLn keyword */ #define NO_TFORM 232 /* couldn't find TFORMn keyword */ #define NOT_IMAGE 233 /* the CHDU is not an IMAGE extension */ #define BAD_TBCOL 234 /* TBCOLn keyword value < 0 or > rowlength */ #define NOT_TABLE 235 /* the CHDU is not a table */ #define COL_TOO_WIDE 236 /* column is too wide to fit in table */ #define COL_NOT_UNIQUE 237 /* more than 1 column name matches template */ #define BAD_ROW_WIDTH 241 /* sum of column widths not = NAXIS1 */ #define UNKNOWN_EXT 251 /* unrecognizable FITS extension type */ #define UNKNOWN_REC 252 /* unrecognizable FITS record */ #define END_JUNK 253 /* END keyword is not blank */ #define BAD_HEADER_FILL 254 /* Header fill area not blank */ #define BAD_DATA_FILL 255 /* Data fill area not blank or zero */ #define BAD_TFORM 261 /* illegal TFORM format code */ #define BAD_TFORM_DTYPE 262 /* unrecognizable TFORM datatype code */ #define BAD_TDIM 263 /* illegal TDIMn keyword value */ #define BAD_HEAP_PTR 264 /* invalid BINTABLE heap address */ #define BAD_HDU_NUM 301 /* HDU number < 1 or > MAXHDU */ #define BAD_COL_NUM 302 /* column number < 1 or > tfields */ #define NEG_FILE_POS 304 /* tried to move before beginning of file */ #define NEG_BYTES 306 /* tried to read or write negative bytes */ #define BAD_ROW_NUM 307 /* illegal starting row number in table */ #define BAD_ELEM_NUM 308 /* illegal starting element number in vector */ #define NOT_ASCII_COL 309 /* this is not an ASCII string column */ #define NOT_LOGICAL_COL 310 /* this is not a logical datatype column */ #define BAD_ATABLE_FORMAT 311 /* ASCII table column has wrong format */ #define BAD_BTABLE_FORMAT 312 /* Binary table column has wrong format */ #define NO_NULL 314 /* null value has not been defined */ #define NOT_VARI_LEN 317 /* this is not a variable length column */ #define BAD_DIMEN 320 /* illegal number of dimensions in array */ #define BAD_PIX_NUM 321 /* first pixel number greater than last pixel */ #define ZERO_SCALE 322 /* illegal BSCALE or TSCALn keyword = 0 */ #define NEG_AXIS 323 /* illegal axis length < 1 */ #define NOT_GROUP_TABLE 340 #define HDU_ALREADY_MEMBER 341 #define MEMBER_NOT_FOUND 342 #define GROUP_NOT_FOUND 343 #define BAD_GROUP_ID 344 #define TOO_MANY_HDUS_TRACKED 345 #define HDU_ALREADY_TRACKED 346 #define BAD_OPTION 347 #define IDENTICAL_POINTERS 348 #define BAD_GROUP_ATTACH 349 #define BAD_GROUP_DETACH 350 #define BAD_I2C 401 /* bad int to formatted string conversion */ #define BAD_F2C 402 /* bad float to formatted string conversion */ #define BAD_INTKEY 403 /* can't interprete keyword value as integer */ #define BAD_LOGICALKEY 404 /* can't interprete keyword value as logical */ #define BAD_FLOATKEY 405 /* can't interprete keyword value as float */ #define BAD_DOUBLEKEY 406 /* can't interprete keyword value as double */ #define BAD_C2I 407 /* bad formatted string to int conversion */ #define BAD_C2F 408 /* bad formatted string to float conversion */ #define BAD_C2D 409 /* bad formatted string to double conversion */ #define BAD_DATATYPE 410 /* bad keyword datatype code */ #define BAD_DECIM 411 /* bad number of decimal places specified */ #define NUM_OVERFLOW 412 /* overflow during datatype conversion */ # define DATA_COMPRESSION_ERR 413 /* error in imcompress routines */ # define DATA_DECOMPRESSION_ERR 414 /* error in imcompress routines */ # define NO_COMPRESSED_TILE 415 /* compressed tile doesn't exist */ #define BAD_DATE 420 /* error in date or time conversion */ #define PARSE_SYNTAX_ERR 431 /* syntax error in parser expression */ #define PARSE_BAD_TYPE 432 /* expression did not evaluate to desired type */ #define PARSE_LRG_VECTOR 433 /* vector result too large to return in array */ #define PARSE_NO_OUTPUT 434 /* data parser failed not sent an out column */ #define PARSE_BAD_COL 435 /* bad data encounter while parsing column */ #define PARSE_BAD_OUTPUT 436 /* Output file not of proper type */ #define ANGLE_TOO_BIG 501 /* celestial angle too large for projection */ #define BAD_WCS_VAL 502 /* bad celestial coordinate or pixel value */ #define WCS_ERROR 503 /* error in celestial coordinate calculation */ #define BAD_WCS_PROJ 504 /* unsupported type of celestial projection */ #define NO_WCS_KEY 505 /* celestial coordinate keywords not found */ #define APPROX_WCS_KEY 506 /* approximate WCS keywords were calculated */ #define NO_CLOSE_ERROR 999 /* special value used internally to switch off */ /* the error message from ffclos and ffchdu */ /*------- following error codes are used in the grparser.c file -----------*/ #define NGP_ERRBASE (360) /* base chosen so not to interfere with CFITSIO */ #define NGP_OK (0) #define NGP_NO_MEMORY (NGP_ERRBASE + 0) /* malloc failed */ #define NGP_READ_ERR (NGP_ERRBASE + 1) /* read error from file */ #define NGP_NUL_PTR (NGP_ERRBASE + 2) /* null pointer passed as argument */ #define NGP_EMPTY_CURLINE (NGP_ERRBASE + 3) /* line read seems to be empty */ #define NGP_UNREAD_QUEUE_FULL (NGP_ERRBASE + 4) /* cannot unread more then 1 line (or single line twice) */ #define NGP_INC_NESTING (NGP_ERRBASE + 5) /* too deep include file nesting (inf. loop ?) */ #define NGP_ERR_FOPEN (NGP_ERRBASE + 6) /* fopen() failed, cannot open file */ #define NGP_EOF (NGP_ERRBASE + 7) /* end of file encountered */ #define NGP_BAD_ARG (NGP_ERRBASE + 8) /* bad arguments passed */ #define NGP_TOKEN_NOT_EXPECT (NGP_ERRBASE + 9) /* token not expected here */ /* The following exclusion if __CINT__ is defined is needed for ROOT */ #ifndef __CINT__ /* the following 3 lines are needed to support C++ compilers */ #ifdef __cplusplus extern "C" { #endif #endif int CFITS2Unit( fitsfile *fptr ); fitsfile* CUnit2FITS(int unit); /*---------------- FITS file URL parsing routines -------------*/ int fits_get_token (char **ptr, char *delimiter, char *token, int *isanumber); int fits_get_token2(char **ptr, char *delimiter, char **token, int *isanumber, int *status); char *fits_split_names(char *list); int ffiurl( char *url, char *urltype, char *infile, char *outfile, char *extspec, char *rowfilter, char *binspec, char *colspec, int *status); int ffifile (char *url, char *urltype, char *infile, char *outfile, char *extspec, char *rowfilter, char *binspec, char *colspec, char *pixfilter, int *status); int ffifile2 (char *url, char *urltype, char *infile, char *outfile, char *extspec, char *rowfilter, char *binspec, char *colspec, char *pixfilter, char *compspec, int *status); int ffrtnm(char *url, char *rootname, int *status); int ffexist(const char *infile, int *exists, int *status); int ffexts(char *extspec, int *extnum, char *extname, int *extvers, int *hdutype, char *colname, char *rowexpress, int *status); int ffextn(char *url, int *extension_num, int *status); int ffurlt(fitsfile *fptr, char *urlType, int *status); int ffbins(char *binspec, int *imagetype, int *haxis, char colname[4][FLEN_VALUE], double *minin, double *maxin, double *binsizein, char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], char binname[4][FLEN_VALUE], double *weight, char *wtname, int *recip, int *status); int ffbinr(char **binspec, char *colname, double *minin, double *maxin, double *binsizein, char *minname, char *maxname, char *binname, int *status); int fits_copy_cell2image(fitsfile *fptr, fitsfile *newptr, char *colname, long rownum, int *status); int fits_copy_image2cell(fitsfile *fptr, fitsfile *newptr, char *colname, long rownum, int copykeyflag, int *status); int fits_copy_pixlist2image(fitsfile *infptr, fitsfile *outfptr, int firstkey, /* I - first HDU record number to start with */ int naxis, int *colnum, int *status); int ffimport_file( char *filename, char **contents, int *status ); int ffrwrg( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges, long *minrow, long *maxrow, int *status); int ffrwrgll( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges, LONGLONG *minrow, LONGLONG *maxrow, int *status); /*---------------- FITS file I/O routines -------------*/ int fits_init_cfitsio(void); int ffomem(fitsfile **fptr, const char *name, int mode, void **buffptr, size_t *buffsize, size_t deltasize, void *(*mem_realloc)(void *p, size_t newsize), int *status); int ffopen(fitsfile **fptr, const char *filename, int iomode, int *status); int ffopentest(int soname, fitsfile **fptr, const char *filename, int iomode, int *status); int ffdopn(fitsfile **fptr, const char *filename, int iomode, int *status); int fftopn(fitsfile **fptr, const char *filename, int iomode, int *status); int ffiopn(fitsfile **fptr, const char *filename, int iomode, int *status); int ffdkopn(fitsfile **fptr, const char *filename, int iomode, int *status); int ffreopen(fitsfile *openfptr, fitsfile **newfptr, int *status); int ffinit( fitsfile **fptr, const char *filename, int *status); int ffdkinit(fitsfile **fptr, const char *filename, int *status); int ffimem(fitsfile **fptr, void **buffptr, size_t *buffsize, size_t deltasize, void *(*mem_realloc)(void *p, size_t newsize), int *status); int fftplt(fitsfile **fptr, const char *filename, const char *tempname, int *status); int ffflus(fitsfile *fptr, int *status); int ffflsh(fitsfile *fptr, int clearbuf, int *status); int ffclos(fitsfile *fptr, int *status); int ffdelt(fitsfile *fptr, int *status); int ffflnm(fitsfile *fptr, char *filename, int *status); int ffflmd(fitsfile *fptr, int *filemode, int *status); int fits_delete_iraf_file(const char *filename, int *status); /*---------------- utility routines -------------*/ float ffvers(float *version); void ffupch(char *string); void ffgerr(int status, char *errtext); void ffpmsg(const char *err_message); void ffpmrk(void); int ffgmsg(char *err_message); void ffcmsg(void); void ffcmrk(void); void ffrprt(FILE *stream, int status); void ffcmps(char *templt, char *colname, int casesen, int *match, int *exact); int fftkey(const char *keyword, int *status); int fftrec(char *card, int *status); int ffnchk(fitsfile *fptr, int *status); int ffkeyn(const char *keyroot, int value, char *keyname, int *status); int ffnkey(int value, const char *keyroot, char *keyname, int *status); int ffgkcl(char *card); int ffdtyp(const char *cval, char *dtype, int *status); int ffinttyp(char *cval, int *datatype, int *negative, int *status); int ffpsvc(char *card, char *value, char *comm, int *status); int ffgknm(char *card, char *name, int *length, int *status); int ffgthd(char *tmplt, char *card, int *hdtype, int *status); int ffmkky(const char *keyname, char *keyval, const char *comm, char *card, int *status); int fits_translate_keyword(char *inrec, char *outrec, char *patterns[][2], int npat, int n_value, int n_offset, int n_range, int *pat_num, int *i, int *j, int *m, int *n, int *status); int fits_translate_keywords(fitsfile *infptr, fitsfile *outfptr, int firstkey, char *patterns[][2], int npat, int n_value, int n_offset, int n_range, int *status); int ffasfm(char *tform, int *datacode, long *width, int *decim, int *status); int ffbnfm(char *tform, int *datacode, long *repeat, long *width, int *status); int ffbnfmll(char *tform, int *datacode, LONGLONG *repeat, long *width, int *status); int ffgabc(int tfields, char **tform, int space, long *rowlen, long *tbcol, int *status); int fits_get_section_range(char **ptr,long *secmin,long *secmax,long *incre, int *status); /* ffmbyt should not normally be used in application programs, but it is defined here as a publicly available routine because there are a few rare cases where it is needed */ int ffmbyt(fitsfile *fptr, LONGLONG bytpos, int ignore_err, int *status); /*----------------- write single keywords --------------*/ int ffpky(fitsfile *fptr, int datatype, const char *keyname, void *value, const char *comm, int *status); int ffprec(fitsfile *fptr, const char *card, int *status); int ffpcom(fitsfile *fptr, const char *comm, int *status); int ffpunt(fitsfile *fptr, const char *keyname, const char *unit, int *status); int ffphis(fitsfile *fptr, const char *history, int *status); int ffpdat(fitsfile *fptr, int *status); int ffverifydate(int year, int month, int day, int *status); int ffgstm(char *timestr, int *timeref, int *status); int ffgsdt(int *day, int *month, int *year, int *status); int ffdt2s(int year, int month, int day, char *datestr, int *status); int fftm2s(int year, int month, int day, int hour, int minute, double second, int decimals, char *datestr, int *status); int ffs2dt(char *datestr, int *year, int *month, int *day, int *status); int ffs2tm(char *datestr, int *year, int *month, int *day, int *hour, int *minute, double *second, int *status); int ffpkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); int ffpkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffpkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffplsw(fitsfile *fptr, int *status); int ffpkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); int ffpkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); int ffpkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffpkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffpkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffpkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffpkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffpkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); int ffpkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffpkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); int ffpkyt(fitsfile *fptr, const char *keyname, long intval, double frac, const char *comm, int *status); int ffptdm( fitsfile *fptr, int colnum, int naxis, long naxes[], int *status); int ffptdmll( fitsfile *fptr, int colnum, int naxis, LONGLONG naxes[], int *status); /*----------------- write array of keywords --------------*/ int ffpkns(fitsfile *fptr, const char *keyroot, int nstart, int nkey, char *value[], char *comm[], int *status); int ffpknl(fitsfile *fptr, const char *keyroot, int nstart, int nkey, int *value, char *comm[], int *status); int ffpknj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, long *value, char *comm[], int *status); int ffpknjj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, LONGLONG *value, char *comm[], int *status); int ffpknf(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value, int decim, char *comm[], int *status); int ffpkne(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value, int decim, char *comm[], int *status); int ffpkng(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value, int decim, char *comm[], int *status); int ffpknd(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value, int decim, char *comm[], int *status); int ffcpky(fitsfile *infptr,fitsfile *outfptr,int incol,int outcol, char *rootname, int *status); /*----------------- write required header keywords --------------*/ int ffphps( fitsfile *fptr, int bitpix, int naxis, long naxes[], int *status); int ffphpsll( fitsfile *fptr, int bitpix, int naxis, LONGLONG naxes[], int *status); int ffphpr( fitsfile *fptr, int simple, int bitpix, int naxis, long naxes[], LONGLONG pcount, LONGLONG gcount, int extend, int *status); int ffphprll( fitsfile *fptr, int simple, int bitpix, int naxis, LONGLONG naxes[], LONGLONG pcount, LONGLONG gcount, int extend, int *status); int ffphtb(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype, long *tbcol, char **tform, char **tunit, const char *extname, int *status); int ffphbn(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, char **tform, char **tunit, const char *extname, LONGLONG pcount, int *status); int ffphext( fitsfile *fptr, const char *xtension, int bitpix, int naxis, long naxes[], LONGLONG pcount, LONGLONG gcount, int *status); /*----------------- write template keywords --------------*/ int ffpktp(fitsfile *fptr, const char *filename, int *status); /*------------------ get header information --------------*/ int ffghsp(fitsfile *fptr, int *nexist, int *nmore, int *status); int ffghps(fitsfile *fptr, int *nexist, int *position, int *status); /*------------------ move position in header -------------*/ int ffmaky(fitsfile *fptr, int nrec, int *status); int ffmrky(fitsfile *fptr, int nrec, int *status); /*------------------ read single keywords -----------------*/ int ffgnxk(fitsfile *fptr, char **inclist, int ninc, char **exclist, int nexc, char *card, int *status); int ffgrec(fitsfile *fptr, int nrec, char *card, int *status); int ffgcrd(fitsfile *fptr, const char *keyname, char *card, int *status); int ffgstr(fitsfile *fptr, const char *string, char *card, int *status); int ffgunt(fitsfile *fptr, const char *keyname, char *unit, int *status); int ffgkyn(fitsfile *fptr, int nkey, char *keyname, char *keyval, char *comm, int *status); int ffgkey(fitsfile *fptr, const char *keyname, char *keyval, char *comm, int *status); int ffgky( fitsfile *fptr, int datatype, const char *keyname, void *value, char *comm, int *status); int ffgkys(fitsfile *fptr, const char *keyname, char *value, char *comm, int *status); int ffgkls(fitsfile *fptr, const char *keyname, char **value, char *comm, int *status); int fffree(void *value, int *status); int fffkls(char *value, int *status); int ffgkyl(fitsfile *fptr, const char *keyname, int *value, char *comm, int *status); int ffgkyj(fitsfile *fptr, const char *keyname, long *value, char *comm, int *status); int ffgkyjj(fitsfile *fptr, const char *keyname, LONGLONG *value, char *comm, int *status); int ffgkye(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status); int ffgkyd(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status); int ffgkyc(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status); int ffgkym(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status); int ffgkyt(fitsfile *fptr, const char *keyname, long *ivalue, double *dvalue, char *comm, int *status); int ffgtdm(fitsfile *fptr, int colnum, int maxdim, int *naxis, long naxes[], int *status); int ffgtdmll(fitsfile *fptr, int colnum, int maxdim, int *naxis, LONGLONG naxes[], int *status); int ffdtdm(fitsfile *fptr, char *tdimstr, int colnum, int maxdim, int *naxis, long naxes[], int *status); int ffdtdmll(fitsfile *fptr, char *tdimstr, int colnum, int maxdim, int *naxis, LONGLONG naxes[], int *status); /*------------------ read array of keywords -----------------*/ int ffgkns(fitsfile *fptr, const char *keyname, int nstart, int nmax, char *value[], int *nfound, int *status); int ffgknl(fitsfile *fptr, const char *keyname, int nstart, int nmax, int *value, int *nfound, int *status); int ffgknj(fitsfile *fptr, const char *keyname, int nstart, int nmax, long *value, int *nfound, int *status); int ffgknjj(fitsfile *fptr, const char *keyname, int nstart, int nmax, LONGLONG *value, int *nfound, int *status); int ffgkne(fitsfile *fptr, const char *keyname, int nstart, int nmax, float *value, int *nfound, int *status); int ffgknd(fitsfile *fptr, const char *keyname, int nstart, int nmax, double *value, int *nfound, int *status); int ffh2st(fitsfile *fptr, char **header, int *status); int ffhdr2str( fitsfile *fptr, int exclude_comm, char **exclist, int nexc, char **header, int *nkeys, int *status); int ffcnvthdr2str( fitsfile *fptr, int exclude_comm, char **exclist, int nexc, char **header, int *nkeys, int *status); /*----------------- read required header keywords --------------*/ int ffghpr(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis, long naxes[], long *pcount, long *gcount, int *extend, int *status); int ffghprll(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis, LONGLONG naxes[], long *pcount, long *gcount, int *extend, int *status); int ffghtb(fitsfile *fptr,int maxfield, long *naxis1, long *naxis2, int *tfields, char **ttype, long *tbcol, char **tform, char **tunit, char *extname, int *status); int ffghtbll(fitsfile *fptr,int maxfield, LONGLONG *naxis1, LONGLONG *naxis2, int *tfields, char **ttype, LONGLONG *tbcol, char **tform, char **tunit, char *extname, int *status); int ffghbn(fitsfile *fptr, int maxfield, long *naxis2, int *tfields, char **ttype, char **tform, char **tunit, char *extname, long *pcount, int *status); int ffghbnll(fitsfile *fptr, int maxfield, LONGLONG *naxis2, int *tfields, char **ttype, char **tform, char **tunit, char *extname, LONGLONG *pcount, int *status); /*--------------------- update keywords ---------------*/ int ffuky(fitsfile *fptr, int datatype, const char *keyname, void *value, const char *comm, int *status); int ffucrd(fitsfile *fptr, const char *keyname, const char *card, int *status); int ffukyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); int ffukys(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status); int ffukls(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status); int ffukyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); int ffukyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); int ffukyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffukye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffukyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffukyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffukyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffukym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); int ffukfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffukfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); /*--------------------- modify keywords ---------------*/ int ffmrec(fitsfile *fptr, int nkey, const char *card, int *status); int ffmcrd(fitsfile *fptr, const char *keyname, const char *card, int *status); int ffmnam(fitsfile *fptr, const char *oldname, const char *newname, int *status); int ffmcom(fitsfile *fptr, const char *keyname, const char *comm, int *status); int ffmkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); int ffmkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffmkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffmkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); int ffmkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); int ffmkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffmkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffmkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffmkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffmkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffmkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); int ffmkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffmkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); /*--------------------- insert keywords ---------------*/ int ffirec(fitsfile *fptr, int nkey, const char *card, int *status); int ffikey(fitsfile *fptr, const char *card, int *status); int ffikyu(fitsfile *fptr, const char *keyname, const char *comm, int *status); int ffikys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffikls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status); int ffikyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status); int ffikyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status); int ffikyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffikye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm, int *status); int ffikyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffikyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm, int *status); int ffikyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffikym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); int ffikfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm, int *status); int ffikfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm, int *status); /*--------------------- delete keywords ---------------*/ int ffdkey(fitsfile *fptr, const char *keyname, int *status); int ffdstr(fitsfile *fptr, const char *string, int *status); int ffdrec(fitsfile *fptr, int keypos, int *status); /*--------------------- get HDU information -------------*/ int ffghdn(fitsfile *fptr, int *chdunum); int ffghdt(fitsfile *fptr, int *exttype, int *status); int ffghad(fitsfile *fptr, long *headstart, long *datastart, long *dataend, int *status); int ffghadll(fitsfile *fptr, LONGLONG *headstart, LONGLONG *datastart, LONGLONG *dataend, int *status); int ffghof(fitsfile *fptr, OFF_T *headstart, OFF_T *datastart, OFF_T *dataend, int *status); int ffgipr(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis, long *naxes, int *status); int ffgiprll(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis, LONGLONG *naxes, int *status); int ffgidt(fitsfile *fptr, int *imgtype, int *status); int ffgiet(fitsfile *fptr, int *imgtype, int *status); int ffgidm(fitsfile *fptr, int *naxis, int *status); int ffgisz(fitsfile *fptr, int nlen, long *naxes, int *status); int ffgiszll(fitsfile *fptr, int nlen, LONGLONG *naxes, int *status); /*--------------------- HDU operations -------------*/ int ffmahd(fitsfile *fptr, int hdunum, int *exttype, int *status); int ffmrhd(fitsfile *fptr, int hdumov, int *exttype, int *status); int ffmnhd(fitsfile *fptr, int exttype, char *hduname, int hduvers, int *status); int ffthdu(fitsfile *fptr, int *nhdu, int *status); int ffcrhd(fitsfile *fptr, int *status); int ffcrim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); int ffcrimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); int ffcrtb(fitsfile *fptr, int tbltype, LONGLONG naxis2, int tfields, char **ttype, char **tform, char **tunit, const char *extname, int *status); int ffiimg(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); int ffiimgll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); int ffitab(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype, long *tbcol, char **tform, char **tunit, const char *extname, int *status); int ffibin(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, char **tform, char **tunit, const char *extname, LONGLONG pcount, int *status); int ffrsim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status); int ffrsimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status); int ffdhdu(fitsfile *fptr, int *hdutype, int *status); int ffcopy(fitsfile *infptr, fitsfile *outfptr, int morekeys, int *status); int ffcpfl(fitsfile *infptr, fitsfile *outfptr, int prev, int cur, int follow, int *status); int ffcphd(fitsfile *infptr, fitsfile *outfptr, int *status); int ffcpdt(fitsfile *infptr, fitsfile *outfptr, int *status); int ffchfl(fitsfile *fptr, int *status); int ffcdfl(fitsfile *fptr, int *status); int ffwrhdu(fitsfile *fptr, FILE *outstream, int *status); int ffrdef(fitsfile *fptr, int *status); int ffhdef(fitsfile *fptr, int morekeys, int *status); int ffpthp(fitsfile *fptr, long theap, int *status); int ffcsum(fitsfile *fptr, long nrec, unsigned long *sum, int *status); void ffesum(unsigned long sum, int complm, char *ascii); unsigned long ffdsum(char *ascii, int complm, unsigned long *sum); int ffpcks(fitsfile *fptr, int *status); int ffupck(fitsfile *fptr, int *status); int ffvcks(fitsfile *fptr, int *datastatus, int *hdustatus, int *status); int ffgcks(fitsfile *fptr, unsigned long *datasum, unsigned long *hdusum, int *status); /*--------------------- define scaling or null values -------------*/ int ffpscl(fitsfile *fptr, double scale, double zero, int *status); int ffpnul(fitsfile *fptr, LONGLONG nulvalue, int *status); int fftscl(fitsfile *fptr, int colnum, double scale, double zero, int *status); int fftnul(fitsfile *fptr, int colnum, LONGLONG nulvalue, int *status); int ffsnul(fitsfile *fptr, int colnum, char *nulstring, int *status); /*--------------------- get column information -------------*/ int ffgcno(fitsfile *fptr, int casesen, char *templt, int *colnum, int *status); int ffgcnn(fitsfile *fptr, int casesen, char *templt, char *colname, int *colnum, int *status); int ffgtcl(fitsfile *fptr, int colnum, int *typecode, long *repeat, long *width, int *status); int ffgtclll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat, LONGLONG *width, int *status); int ffeqty(fitsfile *fptr, int colnum, int *typecode, long *repeat, long *width, int *status); int ffeqtyll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat, LONGLONG *width, int *status); int ffgncl(fitsfile *fptr, int *ncols, int *status); int ffgnrw(fitsfile *fptr, long *nrows, int *status); int ffgnrwll(fitsfile *fptr, LONGLONG *nrows, int *status); int ffgacl(fitsfile *fptr, int colnum, char *ttype, long *tbcol, char *tunit, char *tform, double *tscal, double *tzero, char *tnull, char *tdisp, int *status); int ffgbcl(fitsfile *fptr, int colnum, char *ttype, char *tunit, char *dtype, long *repeat, double *tscal, double *tzero, long *tnull, char *tdisp, int *status); int ffgbclll(fitsfile *fptr, int colnum, char *ttype, char *tunit, char *dtype, LONGLONG *repeat, double *tscal, double *tzero, LONGLONG *tnull, char *tdisp, int *status); int ffgrsz(fitsfile *fptr, long *nrows, int *status); int ffgcdw(fitsfile *fptr, int colnum, int *width, int *status); /*--------------------- read primary array or image elements -------------*/ int ffgpxv(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, void *nulval, void *array, int *anynul, int *status); int ffgpxvll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, void *nulval, void *array, int *anynul, int *status); int ffgpxf(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, void *array, char *nullarray, int *anynul, int *status); int ffgpxfll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, void *array, char *nullarray, int *anynul, int *status); int ffgsv(fitsfile *fptr, int datatype, long *blc, long *trc, long *inc, void *nulval, void *array, int *anynul, int *status); int ffgpv(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, void *nulval, void *array, int *anynul, int *status); int ffgpf(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, void *array, char *nullarray, int *anynul, int *status); int ffgpvb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned char nulval, unsigned char *array, int *anynul, int *status); int ffgpvsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed char nulval, signed char *array, int *anynul, int *status); int ffgpvui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned short nulval, unsigned short *array, int *anynul, int *status); int ffgpvi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, short nulval, short *array, int *anynul, int *status); int ffgpvuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned long nulval, unsigned long *array, int *anynul, int *status); int ffgpvj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, long nulval, long *array, int *anynul, int *status); int ffgpvjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, LONGLONG nulval, LONGLONG *array, int *anynul, int *status); int ffgpvuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned int nulval, unsigned int *array, int *anynul, int *status); int ffgpvk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, int nulval, int *array, int *anynul, int *status); int ffgpve(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, float nulval, float *array, int *anynul, int *status); int ffgpvd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, double nulval, double *array, int *anynul, int *status); int ffgpfb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, char *nularray, int *anynul, int *status); int ffgpfsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed char *array, char *nularray, int *anynul, int *status); int ffgpfui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, char *nularray, int *anynul, int *status); int ffgpfi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, short *array, char *nularray, int *anynul, int *status); int ffgpfuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, char *nularray, int *anynul, int *status); int ffgpfj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, long *array, char *nularray, int *anynul, int *status); int ffgpfjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, char *nularray, int *anynul, int *status); int ffgpfuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, char *nularray, int *anynul, int *status); int ffgpfk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, int *array, char *nularray, int *anynul, int *status); int ffgpfe(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, float *array, char *nularray, int *anynul, int *status); int ffgpfd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, double *array, char *nularray, int *anynul, int *status); int ffg2db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned char *array, int *anynul, int *status); int ffg2dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, signed char *array, int *anynul, int *status); int ffg2dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned short *array, int *anynul, int *status); int ffg2di(fitsfile *fptr, long group, short nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, short *array, int *anynul, int *status); int ffg2duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned long *array, int *anynul, int *status); int ffg2dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, long *array, int *anynul, int *status); int ffg2djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, LONGLONG *array, int *anynul, int *status); int ffg2duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned int *array, int *anynul, int *status); int ffg2dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, int *array, int *anynul, int *status); int ffg2de(fitsfile *fptr, long group, float nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, float *array, int *anynul, int *status); int ffg2dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, double *array, int *anynul, int *status); int ffg3db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned char *array, int *anynul, int *status); int ffg3dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, signed char *array, int *anynul, int *status); int ffg3dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned short *array, int *anynul, int *status); int ffg3di(fitsfile *fptr, long group, short nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, short *array, int *anynul, int *status); int ffg3duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned long *array, int *anynul, int *status); int ffg3dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, long *array, int *anynul, int *status); int ffg3djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, LONGLONG *array, int *anynul, int *status); int ffg3duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned int *array, int *anynul, int *status); int ffg3dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, int *array, int *anynul, int *status); int ffg3de(fitsfile *fptr, long group, float nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, float *array, int *anynul, int *status); int ffg3dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, double *array, int *anynul, int *status); int ffgsvb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned char nulval, unsigned char *array, int *anynul, int *status); int ffgsvsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, signed char nulval, signed char *array, int *anynul, int *status); int ffgsvui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned short nulval, unsigned short *array, int *anynul, int *status); int ffgsvi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, short nulval, short *array, int *anynul, int *status); int ffgsvuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned long nulval, unsigned long *array, int *anynul, int *status); int ffgsvj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, long nulval, long *array, int *anynul, int *status); int ffgsvjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, LONGLONG nulval, LONGLONG *array, int *anynul, int *status); int ffgsvuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned int nulval, unsigned int *array, int *anynul, int *status); int ffgsvk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, int nulval, int *array, int *anynul, int *status); int ffgsve(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, float nulval, float *array, int *anynul, int *status); int ffgsvd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, double nulval, double *array, int *anynul, int *status); int ffgsfb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned char *array, char *flagval, int *anynul, int *status); int ffgsfsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, signed char *array, char *flagval, int *anynul, int *status); int ffgsfui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned short *array, char *flagval, int *anynul, int *status); int ffgsfi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, short *array, char *flagval, int *anynul, int *status); int ffgsfuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned long *array, char *flagval, int *anynul, int *status); int ffgsfj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, long *array, char *flagval, int *anynul, int *status); int ffgsfjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, LONGLONG *array, char *flagval, int *anynul, int *status); int ffgsfuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, unsigned int *array, char *flagval, int *anynul, int *status); int ffgsfk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, int *array, char *flagval, int *anynul, int *status); int ffgsfe(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, float *array, char *flagval, int *anynul, int *status); int ffgsfd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc, long *trc, long *inc, double *array, char *flagval, int *anynul, int *status); int ffggpb(fitsfile *fptr, long group, long firstelem, long nelem, unsigned char *array, int *status); int ffggpsb(fitsfile *fptr, long group, long firstelem, long nelem, signed char *array, int *status); int ffggpui(fitsfile *fptr, long group, long firstelem, long nelem, unsigned short *array, int *status); int ffggpi(fitsfile *fptr, long group, long firstelem, long nelem, short *array, int *status); int ffggpuj(fitsfile *fptr, long group, long firstelem, long nelem, unsigned long *array, int *status); int ffggpj(fitsfile *fptr, long group, long firstelem, long nelem, long *array, int *status); int ffggpjj(fitsfile *fptr, long group, long firstelem, long nelem, LONGLONG *array, int *status); int ffggpuk(fitsfile *fptr, long group, long firstelem, long nelem, unsigned int *array, int *status); int ffggpk(fitsfile *fptr, long group, long firstelem, long nelem, int *array, int *status); int ffggpe(fitsfile *fptr, long group, long firstelem, long nelem, float *array, int *status); int ffggpd(fitsfile *fptr, long group, long firstelem, long nelem, double *array, int *status); /*--------------------- read column elements -------------*/ int ffgcv( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, void *nulval, void *array, int *anynul, int *status); int ffgcf( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, void *array, char *nullarray, int *anynul, int *status); int ffgcvs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char *nulval, char **array, int *anynul, int *status); int ffgcl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char *array, int *status); int ffgcvl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char nulval, char *array, int *anynul, int *status); int ffgcvb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned char nulval, unsigned char *array, int *anynul, int *status); int ffgcvsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, signed char nulval, signed char *array, int *anynul, int *status); int ffgcvui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned short nulval, unsigned short *array, int *anynul, int *status); int ffgcvi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, short nulval, short *array, int *anynul, int *status); int ffgcvuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned long nulval, unsigned long *array, int *anynul, int *status); int ffgcvj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long nulval, long *array, int *anynul, int *status); int ffgcvjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, LONGLONG nulval, LONGLONG *array, int *anynul, int *status); int ffgcvuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned int nulval, unsigned int *array, int *anynul, int *status); int ffgcvk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int nulval, int *array, int *anynul, int *status); int ffgcve(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float nulval, float *array, int *anynul, int *status); int ffgcvd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double nulval, double *array, int *anynul, int *status); int ffgcvc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float nulval, float *array, int *anynul, int *status); int ffgcvm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double nulval, double *array, int *anynul, int *status); int ffgcx(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstbit, LONGLONG nbits, char *larray, int *status); int ffgcxui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long firstbit, int nbits, unsigned short *array, int *status); int ffgcxuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long firstbit, int nbits, unsigned int *array, int *status); int ffgcfs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char **array, char *nularray, int *anynul, int *status); int ffgcfl(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char *array, char *nularray, int *anynul, int *status); int ffgcfb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, char *nularray, int *anynul, int *status); int ffgcfsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, signed char *array, char *nularray, int *anynul, int *status); int ffgcfui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, char *nularray, int *anynul, int *status); int ffgcfi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, short *array, char *nularray, int *anynul, int *status); int ffgcfuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, char *nularray, int *anynul, int *status); int ffgcfj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long *array, char *nularray, int *anynul, int *status); int ffgcfjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, char *nularray, int *anynul, int *status); int ffgcfuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, char *nularray, int *anynul, int *status); int ffgcfk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int *array, char *nularray, int *anynul, int *status); int ffgcfe(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float *array, char *nularray, int *anynul, int *status); int ffgcfd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double *array, char *nularray, int *anynul, int *status); int ffgcfc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float *array, char *nularray, int *anynul, int *status); int ffgcfm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double *array, char *nularray, int *anynul, int *status); int ffgdes(fitsfile *fptr, int colnum, LONGLONG rownum, long *length, long *heapaddr, int *status); int ffgdesll(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG *length, LONGLONG *heapaddr, int *status); int ffgdess(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long *length, long *heapaddr, int *status); int ffgdessll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, LONGLONG *length, LONGLONG *heapaddr, int *status); int ffpdes(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG length, LONGLONG heapaddr, int *status); int fftheap(fitsfile *fptr, LONGLONG *heapsize, LONGLONG *unused, LONGLONG *overlap, int *valid, int *status); int ffcmph(fitsfile *fptr, int *status); int ffgtbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars, unsigned char *values, int *status); int ffgextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status); int ffpextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status); /*------------ write primary array or image elements -------------*/ int ffppx(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, void *array, int *status); int ffppxll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, void *array, int *status); int ffppxn(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem, void *array, void *nulval, int *status); int ffppxnll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem, void *array, void *nulval, int *status); int ffppr(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, void *array, int *status); int ffpprb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, int *status); int ffpprsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed char *array, int *status); int ffpprui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, int *status); int ffppri(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, short *array, int *status); int ffppruj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, int *status); int ffpprj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, long *array, int *status); int ffppruk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, int *status); int ffpprk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, int *array, int *status); int ffppre(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, float *array, int *status); int ffpprd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, double *array, int *status); int ffpprjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, int *status); int ffppru(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, int *status); int ffpprn(fitsfile *fptr, LONGLONG firstelem, LONGLONG nelem, int *status); int ffppn(fitsfile *fptr, int datatype, LONGLONG firstelem, LONGLONG nelem, void *array, void *nulval, int *status); int ffppnb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, unsigned char nulval, int *status); int ffppnsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed char *array, signed char nulval, int *status); int ffppnui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, unsigned short nulval, int *status); int ffppni(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, short *array, short nulval, int *status); int ffppnj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, long *array, long nulval, int *status); int ffppnuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, unsigned long nulval, int *status); int ffppnuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, unsigned int nulval, int *status); int ffppnk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, int *array, int nulval, int *status); int ffppne(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, float *array, float nulval, int *status); int ffppnd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, double *array, double nulval, int *status); int ffppnjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, LONGLONG nulval, int *status); int ffp2db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned char *array, int *status); int ffp2dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, signed char *array, int *status); int ffp2dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned short *array, int *status); int ffp2di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, short *array, int *status); int ffp2duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned long *array, int *status); int ffp2dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, long *array, int *status); int ffp2duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, unsigned int *array, int *status); int ffp2dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, int *array, int *status); int ffp2de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, float *array, int *status); int ffp2dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, double *array, int *status); int ffp2djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1, LONGLONG naxis2, LONGLONG *array, int *status); int ffp3db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned char *array, int *status); int ffp3dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, signed char *array, int *status); int ffp3dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned short *array, int *status); int ffp3di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, short *array, int *status); int ffp3duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned long *array, int *status); int ffp3dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, long *array, int *status); int ffp3duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, unsigned int *array, int *status); int ffp3dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, int *array, int *status); int ffp3de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, float *array, int *status); int ffp3dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, double *array, int *status); int ffp3djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3, LONGLONG *array, int *status); int ffpss(fitsfile *fptr, int datatype, long *fpixel, long *lpixel, void *array, int *status); int ffpssb(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, unsigned char *array, int *status); int ffpsssb(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, signed char *array, int *status); int ffpssui(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, unsigned short *array, int *status); int ffpssi(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, short *array, int *status); int ffpssuj(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, unsigned long *array, int *status); int ffpssj(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, long *array, int *status); int ffpssuk(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, unsigned int *array, int *status); int ffpssk(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, int *array, int *status); int ffpsse(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, float *array, int *status); int ffpssd(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, double *array, int *status); int ffpssjj(fitsfile *fptr, long group, long naxis, long *naxes, long *fpixel, long *lpixel, LONGLONG *array, int *status); int ffpgpb(fitsfile *fptr, long group, long firstelem, long nelem, unsigned char *array, int *status); int ffpgpsb(fitsfile *fptr, long group, long firstelem, long nelem, signed char *array, int *status); int ffpgpui(fitsfile *fptr, long group, long firstelem, long nelem, unsigned short *array, int *status); int ffpgpi(fitsfile *fptr, long group, long firstelem, long nelem, short *array, int *status); int ffpgpuj(fitsfile *fptr, long group, long firstelem, long nelem, unsigned long *array, int *status); int ffpgpj(fitsfile *fptr, long group, long firstelem, long nelem, long *array, int *status); int ffpgpuk(fitsfile *fptr, long group, long firstelem, long nelem, unsigned int *array, int *status); int ffpgpk(fitsfile *fptr, long group, long firstelem, long nelem, int *array, int *status); int ffpgpe(fitsfile *fptr, long group, long firstelem, long nelem, float *array, int *status); int ffpgpd(fitsfile *fptr, long group, long firstelem, long nelem, double *array, int *status); int ffpgpjj(fitsfile *fptr, long group, long firstelem, long nelem, LONGLONG *array, int *status); /*--------------------- iterator functions -------------*/ int fits_iter_set_by_name(iteratorCol *col, fitsfile *fptr, char *colname, int datatype, int iotype); int fits_iter_set_by_num(iteratorCol *col, fitsfile *fptr, int colnum, int datatype, int iotype); int fits_iter_set_file(iteratorCol *col, fitsfile *fptr); int fits_iter_set_colname(iteratorCol *col, char *colname); int fits_iter_set_colnum(iteratorCol *col, int colnum); int fits_iter_set_datatype(iteratorCol *col, int datatype); int fits_iter_set_iotype(iteratorCol *col, int iotype); fitsfile * fits_iter_get_file(iteratorCol *col); char * fits_iter_get_colname(iteratorCol *col); int fits_iter_get_colnum(iteratorCol *col); int fits_iter_get_datatype(iteratorCol *col); int fits_iter_get_iotype(iteratorCol *col); void * fits_iter_get_array(iteratorCol *col); long fits_iter_get_tlmin(iteratorCol *col); long fits_iter_get_tlmax(iteratorCol *col); long fits_iter_get_repeat(iteratorCol *col); char * fits_iter_get_tunit(iteratorCol *col); char * fits_iter_get_tdisp(iteratorCol *col); int ffiter(int ncols, iteratorCol *data, long offset, long nPerLoop, int (*workFn)( long totaln, long offset, long firstn, long nvalues, int narrays, iteratorCol *data, void *userPointer), void *userPointer, int *status); /*--------------------- write column elements -------------*/ int ffpcl(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, void *array, int *status); int ffpcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char **array, int *status); int ffpcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char *array, int *status); int ffpclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, int *status); int ffpclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, signed char *array, int *status); int ffpclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, int *status); int ffpcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, short *array, int *status); int ffpcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, int *status); int ffpclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long *array, int *status); int ffpcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, int *status); int ffpclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int *array, int *status); int ffpcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float *array, int *status); int ffpcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double *array, int *status); int ffpclc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float *array, int *status); int ffpclm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double *array, int *status); int ffpclu(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int *status); int ffprwu(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); int ffpcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, int *status); int ffpclx(fitsfile *fptr, int colnum, LONGLONG frow, long fbit, long nbit, char *larray, int *status); int ffpcn(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, void *array, void *nulval, int *status); int ffpcns( fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char **array, char *nulvalue, int *status); int ffpcnl( fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, char *array, char nulvalue, int *status); int ffpcnb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned char *array, unsigned char nulvalue, int *status); int ffpcnsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, signed char *array, signed char nulvalue, int *status); int ffpcnui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned short *array, unsigned short nulvalue, int *status); int ffpcni(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, short *array, short nulvalue, int *status); int ffpcnuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned long *array, unsigned long nulvalue, int *status); int ffpcnj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long *array, long nulvalue, int *status); int ffpcnuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, unsigned int *array, unsigned int nulvalue, int *status); int ffpcnk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int *array, int nulvalue, int *status); int ffpcne(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, float *array, float nulvalue, int *status); int ffpcnd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, double *array, double nulvalue, int *status); int ffpcnjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, LONGLONG *array, LONGLONG nulvalue, int *status); int ffptbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars, unsigned char *values, int *status); int ffirow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); int ffdrow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status); int ffdrrg(fitsfile *fptr, char *ranges, int *status); int ffdrws(fitsfile *fptr, long *rownum, long nrows, int *status); int ffdrwsll(fitsfile *fptr, LONGLONG *rownum, LONGLONG nrows, int *status); int fficol(fitsfile *fptr, int numcol, char *ttype, char *tform, int *status); int fficls(fitsfile *fptr, int firstcol, int ncols, char **ttype, char **tform, int *status); int ffmvec(fitsfile *fptr, int colnum, LONGLONG newveclen, int *status); int ffdcol(fitsfile *fptr, int numcol, int *status); int ffcpcl(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol, int create_col, int *status); int ffcprw(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow, LONGLONG nrows, int *status); /*--------------------- WCS Utilities ------------------*/ int ffgics(fitsfile *fptr, double *xrval, double *yrval, double *xrpix, double *yrpix, double *xinc, double *yinc, double *rot, char *type, int *status); int ffgicsa(fitsfile *fptr, char version, double *xrval, double *yrval, double *xrpix, double *yrpix, double *xinc, double *yinc, double *rot, char *type, int *status); int ffgtcs(fitsfile *fptr, int xcol, int ycol, double *xrval, double *yrval, double *xrpix, double *yrpix, double *xinc, double *yinc, double *rot, char *type, int *status); int ffwldp(double xpix, double ypix, double xref, double yref, double xrefpix, double yrefpix, double xinc, double yinc, double rot, char *type, double *xpos, double *ypos, int *status); int ffxypx(double xpos, double ypos, double xref, double yref, double xrefpix, double yrefpix, double xinc, double yinc, double rot, char *type, double *xpix, double *ypix, int *status); /* WCS support routines (provide interface to Doug Mink's WCS library */ int ffgiwcs(fitsfile *fptr, char **header, int *status); int ffgtwcs(fitsfile *fptr, int xcol, int ycol, char **header, int *status); /*--------------------- lexical parsing routines ------------------*/ int fftexp( fitsfile *fptr, char *expr, int maxdim, int *datatype, long *nelem, int *naxis, long *naxes, int *status ); int fffrow( fitsfile *infptr, char *expr, long firstrow, long nrows, long *n_good_rows, char *row_status, int *status); int ffffrw( fitsfile *fptr, char *expr, long *rownum, int *status); int fffrwc( fitsfile *fptr, char *expr, char *timeCol, char *parCol, char *valCol, long ntimes, double *times, char *time_status, int *status ); int ffsrow( fitsfile *infptr, fitsfile *outfptr, char *expr, int *status); int ffcrow( fitsfile *fptr, int datatype, char *expr, long firstrow, long nelements, void *nulval, void *array, int *anynul, int *status ); int ffcalc_rng( fitsfile *infptr, char *expr, fitsfile *outfptr, char *parName, char *parInfo, int nRngs, long *start, long *end, int *status ); int ffcalc( fitsfile *infptr, char *expr, fitsfile *outfptr, char *parName, char *parInfo, int *status ); /* ffhist is not really intended as a user-callable routine */ /* but it may be useful for some specialized applications */ /* ffhist2 is a newer version which is strongly recommended instead of ffhist */ int ffhist(fitsfile **fptr, char *outfile, int imagetype, int naxis, char colname[4][FLEN_VALUE], double *minin, double *maxin, double *binsizein, char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], char binname[4][FLEN_VALUE], double weightin, char wtcol[FLEN_VALUE], int recip, char *rowselect, int *status); int ffhist2(fitsfile **fptr, char *outfile, int imagetype, int naxis, char colname[4][FLEN_VALUE], double *minin, double *maxin, double *binsizein, char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], char binname[4][FLEN_VALUE], double weightin, char wtcol[FLEN_VALUE], int recip, char *rowselect, int *status); int fits_select_image_section(fitsfile **fptr, char *outfile, char *imagesection, int *status); int fits_copy_image_section(fitsfile *infptr, fitsfile *outfile, char *imagesection, int *status); int fits_calc_binning(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE], double *minin, double *maxin, double *binsizein, char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE], char binname[4][FLEN_VALUE], int *colnum, long *haxes, float *amin, float *amax, float *binsize, int *status); int fits_write_keys_histo(fitsfile *fptr, fitsfile *histptr, int naxis, int *colnum, int *status); int fits_rebin_wcs( fitsfile *fptr, int naxis, float *amin, float *binsize, int *status); int fits_make_hist(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis, long *naxes, int *colnum, float *amin, float *amax, float *binsize, float weight, int wtcolnum, int recip, char *selectrow, int *status); typedef struct { /* input(s) */ int count; char ** path; char ** tag; fitsfile ** ifptr; char * expression; /* output control */ int bitpix; long blank; fitsfile * ofptr; char keyword[FLEN_KEYWORD]; char comment[FLEN_COMMENT]; } PixelFilter; int fits_pixel_filter (PixelFilter * filter, int * status); /*--------------------- grouping routines ------------------*/ int ffgtcr(fitsfile *fptr, char *grpname, int grouptype, int *status); int ffgtis(fitsfile *fptr, char *grpname, int grouptype, int *status); int ffgtch(fitsfile *gfptr, int grouptype, int *status); int ffgtrm(fitsfile *gfptr, int rmopt, int *status); int ffgtcp(fitsfile *infptr, fitsfile *outfptr, int cpopt, int *status); int ffgtmg(fitsfile *infptr, fitsfile *outfptr, int mgopt, int *status); int ffgtcm(fitsfile *gfptr, int cmopt, int *status); int ffgtvf(fitsfile *gfptr, long *firstfailed, int *status); int ffgtop(fitsfile *mfptr,int group,fitsfile **gfptr,int *status); int ffgtam(fitsfile *gfptr, fitsfile *mfptr, int hdupos, int *status); int ffgtnm(fitsfile *gfptr, long *nmembers, int *status); int ffgmng(fitsfile *mfptr, long *nmembers, int *status); int ffgmop(fitsfile *gfptr, long member, fitsfile **mfptr, int *status); int ffgmcp(fitsfile *gfptr, fitsfile *mfptr, long member, int cpopt, int *status); int ffgmtf(fitsfile *infptr, fitsfile *outfptr, long member, int tfopt, int *status); int ffgmrm(fitsfile *fptr, long member, int rmopt, int *status); /*--------------------- group template parser routines ------------------*/ int fits_execute_template(fitsfile *ff, char *ngp_template, int *status); int fits_img_stats_short(short *array,long nx, long ny, int nullcheck, short nullvalue,long *ngoodpix, short *minvalue, short *maxvalue, double *mean, double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); int fits_img_stats_int(int *array,long nx, long ny, int nullcheck, int nullvalue,long *ngoodpix, int *minvalue, int *maxvalue, double *mean, double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); int fits_img_stats_float(float *array, long nx, long ny, int nullcheck, float nullvalue,long *ngoodpix, float *minvalue, float *maxvalue, double *mean, double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status); /*--------------------- image compression routines ------------------*/ int fits_set_compression_type(fitsfile *fptr, int ctype, int *status); int fits_set_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status); int fits_set_noise_bits(fitsfile *fptr, int noisebits, int *status); int fits_set_quantize_level(fitsfile *fptr, float qlevel, int *status); int fits_set_hcomp_scale(fitsfile *fptr, float scale, int *status); int fits_set_hcomp_smooth(fitsfile *fptr, int smooth, int *status); int fits_set_quantize_method(fitsfile *fptr, int method, int *status); int fits_set_quantize_dither(fitsfile *fptr, int dither, int *status); int fits_set_dither_seed(fitsfile *fptr, int seed, int *status); int fits_set_dither_offset(fitsfile *fptr, int offset, int *status); int fits_set_lossy_int(fitsfile *fptr, int lossy_int, int *status); int fits_set_huge_hdu(fitsfile *fptr, int huge, int *status); int fits_set_compression_pref(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_get_compression_type(fitsfile *fptr, int *ctype, int *status); int fits_get_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status); int fits_get_quantize_level(fitsfile *fptr, float *qlevel, int *status); int fits_get_noise_bits(fitsfile *fptr, int *noisebits, int *status); int fits_get_hcomp_scale(fitsfile *fptr, float *scale, int *status); int fits_get_hcomp_smooth(fitsfile *fptr, int *smooth, int *status); int fits_get_dither_seed(fitsfile *fptr, int *seed, int *status); int fits_img_compress(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_compress_img(fitsfile *infptr, fitsfile *outfptr, int compress_type, long *tilesize, int parm1, int parm2, int *status); int fits_is_compressed_image(fitsfile *fptr, int *status); int fits_is_reentrant(void); int fits_decompress_img (fitsfile *infptr, fitsfile *outfptr, int *status); int fits_img_decompress_header(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_img_decompress (fitsfile *infptr, fitsfile *outfptr, int *status); /* H-compress routines */ int fits_hcompress(int *a, int nx, int ny, int scale, char *output, long *nbytes, int *status); int fits_hcompress64(LONGLONG *a, int nx, int ny, int scale, char *output, long *nbytes, int *status); int fits_hdecompress(unsigned char *input, int smooth, int *a, int *nx, int *ny, int *scale, int *status); int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *nx, int *ny, int *scale, int *status); int fits_compress_table_gzip(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_compress_table_shuffle(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_compress_table_best(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_compress_table_rice(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status); int fits_gzip_datablocks(fitsfile *fptr, size_t *size, int *status); /* The following exclusion if __CINT__ is defined is needed for ROOT */ #ifndef __CINT__ #ifdef __cplusplus } #endif #endif #endif astropy-0.3/cextern/cfitsio/drvrsmem.h0000644000175000017500000001461012243255342016321 0ustar oleole/* S H A R E D M E M O R Y D R I V E R ======================================= by Jerzy.Borkowski@obs.unige.ch 09-Mar-98 : initial version 1.0 released 23-Mar-98 : shared_malloc now accepts new handle as an argument */ #include /* this is necessary for Solaris/Linux */ #include #include #ifdef _AIX #include #else #include #endif /* configuration parameters */ #define SHARED_MAXSEG (16) /* maximum number of shared memory blocks */ #define SHARED_KEYBASE (14011963) /* base for shared memory keys, may be overriden by getenv */ #define SHARED_FDNAME ("/tmp/.shmem-lockfile") /* template for lock file name */ #define SHARED_ENV_KEYBASE ("SHMEM_LIB_KEYBASE") /* name of environment variable */ #define SHARED_ENV_MAXSEG ("SHMEM_LIB_MAXSEG") /* name of environment variable */ /* useful constants */ #define SHARED_RDONLY (0) /* flag for shared_(un)lock, lock for read */ #define SHARED_RDWRITE (1) /* flag for shared_(un)lock, lock for write */ #define SHARED_WAIT (0) /* flag for shared_lock, block if cannot lock immediate */ #define SHARED_NOWAIT (2) /* flag for shared_lock, fail if cannot lock immediate */ #define SHARED_NOLOCK (0x100) /* flag for shared_validate function */ #define SHARED_RESIZE (4) /* flag for shared_malloc, object is resizeable */ #define SHARED_PERSIST (8) /* flag for shared_malloc, object is not deleted after last proc detaches */ #define SHARED_INVALID (-1) /* invalid handle for semaphore/shared memory */ #define SHARED_EMPTY (0) /* entries for shared_used table */ #define SHARED_USED (1) #define SHARED_GRANUL (16384) /* granularity of shared_malloc allocation = phys page size, system dependent */ /* checkpoints in shared memory segments - might be omitted */ #define SHARED_ID_0 ('J') /* first byte of identifier in BLKHEAD */ #define SHARED_ID_1 ('B') /* second byte of identifier in BLKHEAD */ #define BLOCK_REG (0) /* value for tflag member of BLKHEAD */ #define BLOCK_SHARED (1) /* value for tflag member of BLKHEAD */ /* generic error codes */ #define SHARED_OK (0) #define SHARED_ERR_MIN_IDX SHARED_BADARG #define SHARED_ERR_MAX_IDX SHARED_NORESIZE #define DAL_SHM_FREE (0) #define DAL_SHM_USED (1) #define DAL_SHM_ID0 ('D') #define DAL_SHM_ID1 ('S') #define DAL_SHM_ID2 ('M') #define DAL_SHM_SEGHEAD_ID (0x19630114) /* data types */ /* BLKHEAD object is placed at the beginning of every memory segment (both shared and regular) to allow automatic recognition of segments type */ typedef union { struct BLKHEADstruct { char ID[2]; /* ID = 'JB', just as a checkpoint */ char tflag; /* is it shared memory or regular one ? */ int handle; /* this is not necessary, used only for non-resizeable objects via ptr */ } s; double d; /* for proper alignment on every machine */ } BLKHEAD; typedef void *SHARED_P; /* generic type of shared memory pointer */ typedef struct SHARED_GTABstruct /* data type used in global table */ { int sem; /* access semaphore (1 field): process count */ int semkey; /* key value used to generate semaphore handle */ int key; /* key value used to generate shared memory handle (realloc changes it) */ int handle; /* handle of shared memory segment */ int size; /* size of shared memory segment */ int nprocdebug; /* attached proc counter, helps remove zombie segments */ char attr; /* attributes of shared memory object */ } SHARED_GTAB; typedef struct SHARED_LTABstruct /* data type used in local table */ { BLKHEAD *p; /* pointer to segment (may be null) */ int tcnt; /* number of threads in this process attached to segment */ int lkcnt; /* >=0 <- number of read locks, -1 - write lock */ long seekpos; /* current pointer position, read/write/seek operations change it */ } SHARED_LTAB; /* system dependent definitions */ #ifndef HAVE_FLOCK_T typedef struct flock flock_t; #define HAVE_FLOCK_T #endif #ifndef HAVE_UNION_SEMUN union semun { int val; struct semid_ds *buf; unsigned short *array; }; #define HAVE_UNION_SEMUN #endif typedef struct DAL_SHM_SEGHEAD_STRUCT DAL_SHM_SEGHEAD; struct DAL_SHM_SEGHEAD_STRUCT { int ID; /* ID for debugging */ int h; /* handle of sh. mem */ int size; /* size of data area */ int nodeidx; /* offset of root object (node struct typically) */ }; /* API routines */ #ifdef __cplusplus extern "C" { #endif void shared_cleanup(void); /* must be called at exit/abort */ int shared_init(int debug_msgs); /* must be called before any other shared memory routine */ int shared_recover(int id); /* try to recover dormant segment(s) after applic crash */ int shared_malloc(long size, int mode, int newhandle); /* allocate n-bytes of shared memory */ int shared_attach(int idx); /* attach to segment given index to table */ int shared_free(int idx); /* release shared memory */ SHARED_P shared_lock(int idx, int mode); /* lock segment for reading */ SHARED_P shared_realloc(int idx, long newsize); /* reallocate n-bytes of shared memory (ON LOCKED SEGMENT ONLY) */ int shared_size(int idx); /* get size of attached shared memory segment (ON LOCKED SEGMENT ONLY) */ int shared_attr(int idx); /* get attributes of attached shared memory segment (ON LOCKED SEGMENT ONLY) */ int shared_set_attr(int idx, int newattr); /* set attributes of attached shared memory segment (ON LOCKED SEGMENT ONLY) */ int shared_unlock(int idx); /* unlock segment (ON LOCKED SEGMENT ONLY) */ int shared_set_debug(int debug_msgs); /* set/reset debug mode */ int shared_set_createmode(int mode); /* set/reset debug mode */ int shared_list(int id); /* list segment(s) */ int shared_uncond_delete(int id); /* uncondintionally delete (NOWAIT operation) segment(s) */ int shared_getaddr(int id, char **address); /* get starting address of FITS file in segment */ int smem_init(void); int smem_shutdown(void); int smem_setoptions(int options); int smem_getoptions(int *options); int smem_getversion(int *version); int smem_open(char *filename, int rwmode, int *driverhandle); int smem_create(char *filename, int *driverhandle); int smem_close(int driverhandle); int smem_remove(char *filename); int smem_size(int driverhandle, LONGLONG *size); int smem_flush(int driverhandle); int smem_seek(int driverhandle, LONGLONG offset); int smem_read(int driverhandle, void *buffer, long nbytes); int smem_write(int driverhandle, void *buffer, long nbytes); #ifdef __cplusplus } #endif astropy-0.3/cextern/cfitsio/scalnull.c0000644000175000017500000002141512243255342016273 0ustar oleole/* This file, scalnull.c, contains the FITSIO routines used to define */ /* the starting heap address, the value scaling and the null values. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpthp(fitsfile *fptr, /* I - FITS file pointer */ long theap, /* I - starting addrss for the heap */ int *status) /* IO - error status */ /* Define the starting address for the heap for a binary table. The default address is NAXIS1 * NAXIS2. It is in units of bytes relative to the beginning of the regular binary table data. This routine also writes the appropriate THEAP keyword to the FITS header. */ { if (*status > 0 || theap < 1) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->heapstart = theap; ffukyj(fptr, "THEAP", theap, "byte offset to heap area", status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpscl(fitsfile *fptr, /* I - FITS file pointer */ double scale, /* I - scaling factor: value of BSCALE */ double zero, /* I - zero point: value of BZERO */ int *status) /* IO - error status */ /* Define the linear scaling factor for the primary array or image extension pixel values. This routine overrides the scaling values given by the BSCALE and BZERO keywords if present. Note that this routine does not write or modify the BSCALE and BZERO keywords, but instead only modifies the values temporarily in the internal buffer. Thus, a subsequent call to the ffrdef routine will reset the scaling back to the BSCALE and BZERO keyword values (or 1. and 0. respectively if the keywords are not present). */ { tcolumn *colptr; int hdutype; if (*status > 0) return(*status); if (scale == 0) return(*status = ZERO_SCALE); /* zero scale value is illegal */ if (ffghdt(fptr, &hdutype, status) > 0) /* get HDU type */ return(*status); if (hdutype != IMAGE_HDU) return(*status = NOT_IMAGE); /* not proper HDU type */ if (fits_is_compressed_image(fptr, status)) /* compressed images */ { (fptr->Fptr)->cn_bscale = scale; (fptr->Fptr)->cn_bzero = zero; return(*status); } /* set pointer to the first 'column' (contains group parameters if any) */ colptr = (fptr->Fptr)->tableptr; colptr++; /* increment to the 2nd 'column' pointer (the image itself) */ colptr->tscale = scale; colptr->tzero = zero; return(*status); } /*--------------------------------------------------------------------------*/ int ffpnul(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG nulvalue, /* I - null pixel value: value of BLANK */ int *status) /* IO - error status */ /* Define the value used to represent undefined pixels in the primary array or image extension. This only applies to integer image pixel (i.e. BITPIX > 0). This routine overrides the null pixel value given by the BLANK keyword if present. Note that this routine does not write or modify the BLANK keyword, but instead only modifies the value temporarily in the internal buffer. Thus, a subsequent call to the ffrdef routine will reset the null value back to the BLANK keyword value (or not defined if the keyword is not present). */ { tcolumn *colptr; int hdutype; if (*status > 0) return(*status); if (ffghdt(fptr, &hdutype, status) > 0) /* get HDU type */ return(*status); if (hdutype != IMAGE_HDU) return(*status = NOT_IMAGE); /* not proper HDU type */ if (fits_is_compressed_image(fptr, status)) /* ignore compressed images */ return(*status); /* set pointer to the first 'column' (contains group parameters if any) */ colptr = (fptr->Fptr)->tableptr; colptr++; /* increment to the 2nd 'column' pointer (the image itself) */ colptr->tnull = nulvalue; return(*status); } /*--------------------------------------------------------------------------*/ int fftscl(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number to apply scaling to */ double scale, /* I - scaling factor: value of TSCALn */ double zero, /* I - zero point: value of TZEROn */ int *status) /* IO - error status */ /* Define the linear scaling factor for the TABLE or BINTABLE extension column values. This routine overrides the scaling values given by the TSCALn and TZEROn keywords if present. Note that this routine does not write or modify the TSCALn and TZEROn keywords, but instead only modifies the values temporarily in the internal buffer. Thus, a subsequent call to the ffrdef routine will reset the scaling back to the TSCALn and TZEROn keyword values (or 1. and 0. respectively if the keywords are not present). */ { tcolumn *colptr; int hdutype; if (*status > 0) return(*status); if (scale == 0) return(*status = ZERO_SCALE); /* zero scale value is illegal */ if (ffghdt(fptr, &hdutype, status) > 0) /* get HDU type */ return(*status); if (hdutype == IMAGE_HDU) return(*status = NOT_TABLE); /* not proper HDU type */ colptr = (fptr->Fptr)->tableptr; /* set pointer to the first column */ colptr += (colnum - 1); /* increment to the correct column */ colptr->tscale = scale; colptr->tzero = zero; return(*status); } /*--------------------------------------------------------------------------*/ int fftnul(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number to apply nulvalue to */ LONGLONG nulvalue, /* I - null pixel value: value of TNULLn */ int *status) /* IO - error status */ /* Define the value used to represent undefined pixels in the BINTABLE column. This only applies to integer datatype columns (TFORM = B, I, or J). This routine overrides the null pixel value given by the TNULLn keyword if present. Note that this routine does not write or modify the TNULLn keyword, but instead only modifies the value temporarily in the internal buffer. Thus, a subsequent call to the ffrdef routine will reset the null value back to the TNULLn keyword value (or not defined if the keyword is not present). */ { tcolumn *colptr; int hdutype; if (*status > 0) return(*status); if (ffghdt(fptr, &hdutype, status) > 0) /* get HDU type */ return(*status); if (hdutype != BINARY_TBL) return(*status = NOT_BTABLE); /* not proper HDU type */ colptr = (fptr->Fptr)->tableptr; /* set pointer to the first column */ colptr += (colnum - 1); /* increment to the correct column */ colptr->tnull = nulvalue; return(*status); } /*--------------------------------------------------------------------------*/ int ffsnul(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number to apply nulvalue to */ char *nulstring, /* I - null pixel value: value of TNULLn */ int *status) /* IO - error status */ /* Define the string used to represent undefined pixels in the ASCII TABLE column. This routine overrides the null value given by the TNULLn keyword if present. Note that this routine does not write or modify the TNULLn keyword, but instead only modifies the value temporarily in the internal buffer. Thus, a subsequent call to the ffrdef routine will reset the null value back to the TNULLn keyword value (or not defined if the keyword is not present). */ { tcolumn *colptr; int hdutype; if (*status > 0) return(*status); if (ffghdt(fptr, &hdutype, status) > 0) /* get HDU type */ return(*status); if (hdutype != ASCII_TBL) return(*status = NOT_ATABLE); /* not proper HDU type */ colptr = (fptr->Fptr)->tableptr; /* set pointer to the first column */ colptr += (colnum - 1); /* increment to the correct column */ colptr->strnull[0] = '\0'; strncat(colptr->strnull, nulstring, 19); /* limit string to 19 chars */ return(*status); } astropy-0.3/cextern/cfitsio/cfileio.c0000644000175000017500000072270512243255342016102 0ustar oleole/* This file, cfileio.c, contains the low-level file access routines. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include #include /* apparently needed to define size_t */ #include "fitsio2.h" #include "group.h" #define MAX_PREFIX_LEN 20 /* max length of file type prefix (e.g. 'http://') */ #define MAX_DRIVERS 24 /* max number of file I/O drivers */ typedef struct /* structure containing pointers to I/O driver functions */ { char prefix[MAX_PREFIX_LEN]; int (*init)(void); int (*shutdown)(void); int (*setoptions)(int option); int (*getoptions)(int *options); int (*getversion)(int *version); int (*checkfile)(char *urltype, char *infile, char *outfile); int (*open)(char *filename, int rwmode, int *driverhandle); int (*create)(char *filename, int *drivehandle); int (*truncate)(int drivehandle, LONGLONG size); int (*close)(int drivehandle); int (*remove)(char *filename); int (*size)(int drivehandle, LONGLONG *size); int (*flush)(int drivehandle); int (*seek)(int drivehandle, LONGLONG offset); int (*read)(int drivehandle, void *buffer, long nbytes); int (*write)(int drivehandle, void *buffer, long nbytes); } fitsdriver; fitsdriver driverTable[MAX_DRIVERS]; /* allocate driver tables */ FITSfile *FptrTable[NMAXFILES]; /* this table of Fptr pointers is */ /* used by fits_already_open */ int need_to_initialize = 1; /* true if CFITSIO has not been initialized */ int no_of_drivers = 0; /* number of currently defined I/O drivers */ static int pixel_filter_helper(fitsfile **fptr, char *outfile, char *expr, int *status); static int find_quote(char **string); static int find_doublequote(char **string); static int find_paren(char **string); static int find_bracket(char **string); static int find_curlybracket(char **string); int comma2semicolon(char *string); #ifdef _REENTRANT pthread_mutex_t Fitsio_InitLock = PTHREAD_MUTEX_INITIALIZER; #endif /*--------------------------------------------------------------------------*/ int fitsio_init_lock(void) { static int need_to_init = 1; int status; #ifdef _REENTRANT pthread_mutexattr_t mutex_init; FFLOCK1(Fitsio_InitLock); if (need_to_init) { /* Init the main fitsio lock here since we need a a recursive lock */ status = pthread_mutexattr_init(&mutex_init); if (status) { ffpmsg("pthread_mutexattr_init failed (fitsio_init_lock)"); return(status); } #ifdef linux status = pthread_mutexattr_settype(&mutex_init, PTHREAD_MUTEX_RECURSIVE_NP); #else status = pthread_mutexattr_settype(&mutex_init, PTHREAD_MUTEX_RECURSIVE); #endif if (status) { ffpmsg("pthread_mutexattr_settu[e failed (fitsio_init_lock)"); return(status); } status = pthread_mutex_init(&Fitsio_Lock,&mutex_init); if (status) { ffpmsg("pthread_mutex_init failed (fitsio_init_lock)"); return(status); } need_to_init = 0; } FFUNLOCK1(Fitsio_InitLock); #endif return(0); } /*--------------------------------------------------------------------------*/ int ffomem(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ void **buffptr, /* I - address of memory pointer */ size_t *buffsize, /* I - size of buffer, in bytes */ size_t deltasize, /* I - increment for future realloc's */ void *(*mem_realloc)(void *p, size_t newsize), /* function */ int *status) /* IO - error status */ /* Open an existing FITS file in core memory. This is a specialized version of ffopen. */ { int ii, driver, handle, hdutyp, slen, movetotype, extvers, extnum; char extname[FLEN_VALUE]; LONGLONG filesize; char urltype[MAX_PREFIX_LEN], infile[FLEN_FILENAME], outfile[FLEN_FILENAME]; char extspec[FLEN_FILENAME], rowfilter[FLEN_FILENAME]; char binspec[FLEN_FILENAME], colspec[FLEN_FILENAME]; char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME]; char *url, errmsg[FLEN_ERRMSG]; char *hdtype[3] = {"IMAGE", "TABLE", "BINTABLE"}; if (*status > 0) return(*status); *fptr = 0; /* initialize null file pointer */ if (need_to_initialize) /* this is called only once */ { *status = fits_init_cfitsio(); if (*status > 0) return(*status); } url = (char *) name; while (*url == ' ') /* ignore leading spaces in the file spec */ url++; /* parse the input file specification */ fits_parse_input_url(url, urltype, infile, outfile, extspec, rowfilter, binspec, colspec, status); strcpy(urltype, "memkeep://"); /* URL type for pre-existing memory file */ *status = urltype2driver(urltype, &driver); if (*status > 0) { ffpmsg("could not find driver for pre-existing memory file: (ffomem)"); return(*status); } /* call driver routine to open the memory file */ FFLOCK; /* lock this while searching for vacant handle */ *status = mem_openmem( buffptr, buffsize,deltasize, mem_realloc, &handle); FFUNLOCK; if (*status > 0) { ffpmsg("failed to open pre-existing memory file: (ffomem)"); return(*status); } /* get initial file size */ *status = (*driverTable[driver].size)(handle, &filesize); if (*status > 0) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed get the size of the memory file: (ffomem)"); return(*status); } /* allocate fitsfile structure and initialize = 0 */ *fptr = (fitsfile *) calloc(1, sizeof(fitsfile)); if (!(*fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffomem)"); ffpmsg(url); return(*status = MEMORY_ALLOCATION); } /* allocate FITSfile structure and initialize = 0 */ (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile)); if (!((*fptr)->Fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffomem)"); ffpmsg(url); free(*fptr); *fptr = 0; return(*status = MEMORY_ALLOCATION); } slen = strlen(url) + 1; slen = maxvalue(slen, 32); /* reserve at least 32 chars */ ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */ if ( !(((*fptr)->Fptr)->filename) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for filename: (ffomem)"); ffpmsg(url); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for headstart array */ ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); if ( !(((*fptr)->Fptr)->headstart) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for headstart array: (ffomem)"); ffpmsg(url); free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for file I/O buffers */ ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN); if ( !(((*fptr)->Fptr)->iobuffer) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for iobuffer array: (ffomem)"); ffpmsg(url); free( ((*fptr)->Fptr)->headstart); /* free memory for headstart array */ free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* initialize the ageindex array (relative age of the I/O buffers) */ /* and initialize the bufrecnum array as being empty */ for (ii = 0; ii < NIOBUF; ii++) { ((*fptr)->Fptr)->ageindex[ii] = ii; ((*fptr)->Fptr)->bufrecnum[ii] = -1; } /* store the parameters describing the file */ ((*fptr)->Fptr)->MAXHDU = 1000; /* initial size of headstart */ ((*fptr)->Fptr)->filehandle = handle; /* file handle */ ((*fptr)->Fptr)->driver = driver; /* driver number */ strcpy(((*fptr)->Fptr)->filename, url); /* full input filename */ ((*fptr)->Fptr)->filesize = filesize; /* physical file size */ ((*fptr)->Fptr)->logfilesize = filesize; /* logical file size */ ((*fptr)->Fptr)->writemode = mode; /* read-write mode */ ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */ ((*fptr)->Fptr)->curbuf = -1; /* undefined current IO buffer */ ((*fptr)->Fptr)->open_count = 1; /* structure is currently used once */ ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */ ffldrc(*fptr, 0, REPORT_EOF, status); /* load first record */ fits_store_Fptr( (*fptr)->Fptr, status); /* store Fptr address */ if (ffrhdu(*fptr, &hdutyp, status) > 0) /* determine HDU structure */ { ffpmsg( "ffomem could not interpret primary array header of file: (ffomem)"); ffpmsg(url); if (*status == UNKNOWN_REC) ffpmsg("This does not look like a FITS file."); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ } /* ---------------------------------------------------------- */ /* move to desired extension, if specified as part of the URL */ /* ---------------------------------------------------------- */ imagecolname[0] = '\0'; rowexpress[0] = '\0'; if (*extspec) { /* parse the extension specifier into individual parameters */ ffexts(extspec, &extnum, extname, &extvers, &movetotype, imagecolname, rowexpress, status); if (*status > 0) return(*status); if (extnum) { ffmahd(*fptr, extnum + 1, &hdutyp, status); } else if (*extname) /* move to named extension, if specified */ { ffmnhd(*fptr, movetotype, extname, extvers, status); } if (*status > 0) { ffpmsg("ffomem could not move to the specified extension:"); if (extnum > 0) { sprintf(errmsg, " extension number %d doesn't exist or couldn't be opened.",extnum); ffpmsg(errmsg); } else { sprintf(errmsg, " extension with EXTNAME = %s,", extname); ffpmsg(errmsg); if (extvers) { sprintf(errmsg, " and with EXTVERS = %d,", extvers); ffpmsg(errmsg); } if (movetotype != ANY_HDU) { sprintf(errmsg, " and with XTENSION = %s,", hdtype[movetotype]); ffpmsg(errmsg); } ffpmsg(" doesn't exist or couldn't be opened."); } return(*status); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffdkopn(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file on magnetic disk with either readonly or read/write access. The routine does not support CFITSIO's extended filename syntax and simply uses the entire input 'name' string as the name of the file. */ { if (*status > 0) return(*status); *status = OPEN_DISK_FILE; ffopen(fptr, name, mode, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffdopn(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' data, if the primary array contains a null image (i.e., NAXIS = 0). */ { if (*status > 0) return(*status); *status = SKIP_NULL_PRIMARY; ffopen(fptr, name, mode, status); return(*status); } /*--------------------------------------------------------------------------*/ int fftopn(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' table (not an image). */ { int hdutype; if (*status > 0) return(*status); *status = SKIP_IMAGE; ffopen(fptr, name, mode, status); if (ffghdt(*fptr, &hdutype, status) <= 0) { if (hdutype == IMAGE_HDU) *status = NOT_TABLE; } return(*status); } /*--------------------------------------------------------------------------*/ int ffiopn(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' image (not an table). */ { int hdutype; if (*status > 0) return(*status); *status = SKIP_TABLE; ffopen(fptr, name, mode, status); if (ffghdt(*fptr, &hdutype, status) <= 0) { if (hdutype != IMAGE_HDU) *status = NOT_IMAGE; } return(*status); } /*--------------------------------------------------------------------------*/ int ffopentest(int soname, /* I - CFITSIO shared library version */ /* application program (fitsio.h file) */ fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file with either readonly or read/write access. First test that the SONAME of fitsio.h used to build the CFITSIO library is the same as was used in compiling the application program that links to the library. */ { if (soname != CFITSIO_SONAME) { printf("\nERROR: Mismatch in the CFITSIO_SONAME value in the fitsio.h include file\n"); printf("that was used to build the CFITSIO library, and the value in the include file\n"); printf("that was used when compiling the application program:\n"); printf(" Version used to build the CFITSIO library = %d\n",CFITSIO_SONAME); printf(" Version included by the application program = %d\n",soname); printf("\nFix this by recompiling and then relinking this application program \n"); printf("with the CFITSIO library.\n"); *status = FILE_NOT_OPENED; return(*status); } /* now call the normal file open routine */ ffopen(fptr, name, mode, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffopen(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - full name of file to open */ int mode, /* I - 0 = open readonly; 1 = read/write */ int *status) /* IO - error status */ /* Open an existing FITS file with either readonly or read/write access. */ { fitsfile *newptr; int ii, driver, hdutyp, hdunum, slen, writecopy, isopen; LONGLONG filesize; long rownum, nrows, goodrows; int extnum, extvers, handle, movetotype, tstatus = 0, only_one = 0; char urltype[MAX_PREFIX_LEN], infile[FLEN_FILENAME], outfile[FLEN_FILENAME]; char origurltype[MAX_PREFIX_LEN], extspec[FLEN_FILENAME]; char extname[FLEN_VALUE], rowfilter[FLEN_FILENAME], tblname[FLEN_VALUE]; char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME]; char binspec[FLEN_FILENAME], colspec[FLEN_FILENAME], pixfilter[FLEN_FILENAME]; char histfilename[FLEN_FILENAME]; char filtfilename[FLEN_FILENAME], compspec[FLEN_FILENAME]; char wtcol[FLEN_VALUE]; char minname[4][FLEN_VALUE], maxname[4][FLEN_VALUE]; char binname[4][FLEN_VALUE]; char *url; double minin[4], maxin[4], binsizein[4], weight; int imagetype, naxis = 1, haxis, recip; int skip_null = 0, skip_image = 0, skip_table = 0, open_disk_file = 0; char colname[4][FLEN_VALUE]; char errmsg[FLEN_ERRMSG]; char *hdtype[3] = {"IMAGE", "TABLE", "BINTABLE"}; char *rowselect = 0; if (*status > 0) return(*status); if (*status == SKIP_NULL_PRIMARY) { /* this special status value is used as a flag by ffdopn to tell */ /* ffopen to skip over a null primary array when opening the file. */ skip_null = 1; *status = 0; } else if (*status == SKIP_IMAGE) { /* this special status value is used as a flag by fftopn to tell */ /* ffopen to move to 1st significant table when opening the file. */ skip_image = 1; *status = 0; } else if (*status == SKIP_TABLE) { /* this special status value is used as a flag by ffiopn to tell */ /* ffopen to move to 1st significant image when opening the file. */ skip_table = 1; *status = 0; } else if (*status == OPEN_DISK_FILE) { /* this special status value is used as a flag by ffdkopn to tell */ /* ffopen to not interpret the input filename using CFITSIO's */ /* extended filename syntax, and simply open the specified disk file */ open_disk_file = 1; *status = 0; } *fptr = 0; /* initialize null file pointer */ writecopy = 0; /* have we made a write-able copy of the input file? */ if (need_to_initialize) { /* this is called only once */ *status = fits_init_cfitsio(); } if (*status > 0) return(*status); url = (char *) name; while (*url == ' ') /* ignore leading spaces in the filename */ url++; if (*url == '\0') { ffpmsg("Name of file to open is blank. (ffopen)"); return(*status = FILE_NOT_OPENED); } if (open_disk_file) { /* treat the input URL literally as the name of the file to open */ /* and don't try to parse the URL using the extended filename syntax */ if (strlen(url) > FLEN_FILENAME - 1) { ffpmsg("Name of file to open is too long. (ffopen)"); return(*status = FILE_NOT_OPENED); } strcpy(infile,url); strcpy(urltype, "file://"); outfile[0] = '\0'; extspec[0] = '\0'; binspec[0] = '\0'; colspec[0] = '\0'; rowfilter[0] = '\0'; pixfilter[0] = '\0'; compspec[0] = '\0'; } else { /* parse the input file specification */ /* NOTE: This routine tests that all the strings do not */ /* overflow the standard buffer sizes (FLEN_FILENAME, etc.) */ /* therefore in general we do not have to worry about buffer */ /* overflow of any of the returned strings. */ /* call the newer version of this parsing routine that supports 'compspec' */ ffifile2(url, urltype, infile, outfile, extspec, rowfilter, binspec, colspec, pixfilter, compspec, status); } if (*status > 0) { ffpmsg("could not parse the input filename: (ffopen)"); ffpmsg(url); return(*status); } imagecolname[0] = '\0'; rowexpress[0] = '\0'; if (*extspec) { slen = strlen(extspec); if (extspec[slen - 1] == '#') { /* special symbol to mean only copy this extension */ extspec[slen - 1] = '\0'; only_one = 1; } /* parse the extension specifier into individual parameters */ ffexts(extspec, &extnum, extname, &extvers, &movetotype, imagecolname, rowexpress, status); if (*status > 0) return(*status); } /*-------------------------------------------------------------------*/ /* special cases: */ /*-------------------------------------------------------------------*/ histfilename[0] = '\0'; filtfilename[0] = '\0'; if (*outfile && (*binspec || *imagecolname || *pixfilter)) { /* if binspec or imagecolumn are specified, then the */ /* output file name is intended for the final image, */ /* and not a copy of the input file. */ strcpy(histfilename, outfile); outfile[0] = '\0'; } else if (*outfile && (*rowfilter || *colspec)) { /* if rowfilter or colspece are specified, then the */ /* output file name is intended for the filtered file */ /* and not a copy of the input file. */ strcpy(filtfilename, outfile); outfile[0] = '\0'; } /*-------------------------------------------------------------------*/ /* check if this same file is already open, and if so, attach to it */ /*-------------------------------------------------------------------*/ FFLOCK; if (fits_already_open(fptr, url, urltype, infile, extspec, rowfilter, binspec, colspec, mode, &isopen, status) > 0) { FFUNLOCK; return(*status); } FFUNLOCK; if (isopen) { goto move2hdu; } /* get the driver number corresponding to this urltype */ *status = urltype2driver(urltype, &driver); if (*status > 0) { ffpmsg("could not find driver for this file: (ffopen)"); ffpmsg(urltype); ffpmsg(url); return(*status); } /*------------------------------------------------------------------- deal with all those messy special cases which may require that a different driver be used: - is disk file compressed? - are ftp:, gsiftp:, or http: files compressed? - has user requested that a local copy be made of the ftp or http file? -------------------------------------------------------------------*/ if (driverTable[driver].checkfile) { strcpy(origurltype,urltype); /* Save the urltype */ /* 'checkfile' may modify the urltype, infile and outfile strings */ *status = (*driverTable[driver].checkfile)(urltype, infile, outfile); if (*status) { ffpmsg("checkfile failed for this file: (ffopen)"); ffpmsg(url); return(*status); } if (strcmp(origurltype, urltype)) /* did driver changed on us? */ { *status = urltype2driver(urltype, &driver); if (*status > 0) { ffpmsg("could not change driver for this file: (ffopen)"); ffpmsg(url); ffpmsg(urltype); return(*status); } } } /* call appropriate driver to open the file */ if (driverTable[driver].open) { FFLOCK; /* lock this while searching for vacant handle */ *status = (*driverTable[driver].open)(infile, mode, &handle); FFUNLOCK; if (*status > 0) { ffpmsg("failed to find or open the following file: (ffopen)"); ffpmsg(url); return(*status); } } else { ffpmsg("cannot open an existing file of this type: (ffopen)"); ffpmsg(url); return(*status = FILE_NOT_OPENED); } /* get initial file size */ *status = (*driverTable[driver].size)(handle, &filesize); if (*status > 0) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed get the size of the following file: (ffopen)"); ffpmsg(url); return(*status); } /* allocate fitsfile structure and initialize = 0 */ *fptr = (fitsfile *) calloc(1, sizeof(fitsfile)); if (!(*fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffopen)"); ffpmsg(url); return(*status = MEMORY_ALLOCATION); } /* allocate FITSfile structure and initialize = 0 */ (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile)); if (!((*fptr)->Fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffopen)"); ffpmsg(url); free(*fptr); *fptr = 0; return(*status = MEMORY_ALLOCATION); } slen = strlen(url) + 1; slen = maxvalue(slen, 32); /* reserve at least 32 chars */ ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */ if ( !(((*fptr)->Fptr)->filename) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for filename: (ffopen)"); ffpmsg(url); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for headstart array */ ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); if ( !(((*fptr)->Fptr)->headstart) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for headstart array: (ffopen)"); ffpmsg(url); free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for file I/O buffers */ ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN); if ( !(((*fptr)->Fptr)->iobuffer) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for iobuffer array: (ffopen)"); ffpmsg(url); free( ((*fptr)->Fptr)->headstart); /* free memory for headstart array */ free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* initialize the ageindex array (relative age of the I/O buffers) */ /* and initialize the bufrecnum array as being empty */ for (ii = 0; ii < NIOBUF; ii++) { ((*fptr)->Fptr)->ageindex[ii] = ii; ((*fptr)->Fptr)->bufrecnum[ii] = -1; } /* store the parameters describing the file */ ((*fptr)->Fptr)->MAXHDU = 1000; /* initial size of headstart */ ((*fptr)->Fptr)->filehandle = handle; /* file handle */ ((*fptr)->Fptr)->driver = driver; /* driver number */ strcpy(((*fptr)->Fptr)->filename, url); /* full input filename */ ((*fptr)->Fptr)->filesize = filesize; /* physical file size */ ((*fptr)->Fptr)->logfilesize = filesize; /* logical file size */ ((*fptr)->Fptr)->writemode = mode; /* read-write mode */ ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */ ((*fptr)->Fptr)->curbuf = -1; /* undefined current IO buffer */ ((*fptr)->Fptr)->open_count = 1; /* structure is currently used once */ ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */ ((*fptr)->Fptr)->only_one = only_one; /* flag denoting only copy single extension */ ffldrc(*fptr, 0, REPORT_EOF, status); /* load first record */ fits_store_Fptr( (*fptr)->Fptr, status); /* store Fptr address */ if (ffrhdu(*fptr, &hdutyp, status) > 0) /* determine HDU structure */ { ffpmsg( "ffopen could not interpret primary array header of file: "); ffpmsg(url); if (*status == UNKNOWN_REC) ffpmsg("This does not look like a FITS file."); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } /* ------------------------------------------------------------- */ /* At this point, the input file has been opened. If outfile was */ /* specified, then we have opened a copy of the file, not the */ /* original file so it is safe to modify it if necessary */ /* ------------------------------------------------------------- */ if (*outfile) writecopy = 1; move2hdu: /* ---------------------------------------------------------- */ /* move to desired extension, if specified as part of the URL */ /* ---------------------------------------------------------- */ if (*extspec) { if (extnum) /* extension number was specified */ { ffmahd(*fptr, extnum + 1, &hdutyp, status); } else if (*extname) /* move to named extension, if specified */ { ffmnhd(*fptr, movetotype, extname, extvers, status); } if (*status > 0) /* clean up after error */ { ffpmsg("ffopen could not move to the specified extension:"); if (extnum > 0) { sprintf(errmsg, " extension number %d doesn't exist or couldn't be opened.",extnum); ffpmsg(errmsg); } else { sprintf(errmsg, " extension with EXTNAME = %s,", extname); ffpmsg(errmsg); if (extvers) { sprintf(errmsg, " and with EXTVERS = %d,", extvers); ffpmsg(errmsg); } if (movetotype != ANY_HDU) { sprintf(errmsg, " and with XTENSION = %s,", hdtype[movetotype]); ffpmsg(errmsg); } ffpmsg(" doesn't exist or couldn't be opened."); } ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } } else if (skip_null || skip_image || skip_table || (*imagecolname || *colspec || *rowfilter || *binspec)) { /* ------------------------------------------------------------------ If no explicit extension specifier is given as part of the file name, and, if a) skip_null is true (set if ffopen is called by ffdopn) or b) skip_image or skip_table is true (set if ffopen is called by fftopn or ffdopn) or c) other file filters are specified, then CFITSIO will attempt to move to the first 'interesting' HDU after opening an existing FITS file (or to first interesting table HDU if skip_image is true); An 'interesting' HDU is defined to be either an image with NAXIS > 0 (i.e., not a null array) or a table which has an EXTNAME value which does not contain any of the following strings: 'GTI' - Good Time Interval extension 'OBSTABLE' - used in Beppo SAX data files The main purpose for this is to allow CFITSIO to skip over a null primary and other non-interesting HDUs when opening an existing file, and move directly to the first extension that contains significant data. ------------------------------------------------------------------ */ fits_get_hdu_num(*fptr, &hdunum); if (hdunum == 1) { fits_get_img_dim(*fptr, &naxis, status); if (naxis == 0 || skip_image) /* skip primary array */ { while(1) { /* see if the next HDU is 'interesting' */ if (fits_movrel_hdu(*fptr, 1, &hdutyp, status)) { if (*status == END_OF_FILE) *status = 0; /* reset expected error */ /* didn't find an interesting HDU so move back to beginning */ fits_movabs_hdu(*fptr, 1, &hdutyp, status); break; } if (hdutyp == IMAGE_HDU && skip_image) { continue; /* skip images */ } else if (hdutyp != IMAGE_HDU && skip_table) { continue; /* skip tables */ } else if (hdutyp == IMAGE_HDU) { fits_get_img_dim(*fptr, &naxis, status); if (naxis > 0) break; /* found a non-null image */ } else { tstatus = 0; tblname[0] = '\0'; fits_read_key(*fptr, TSTRING, "EXTNAME", tblname, NULL,&tstatus); if ( (!strstr(tblname, "GTI") && !strstr(tblname, "gti")) && strncasecmp(tblname, "OBSTABLE", 8) ) break; /* found an interesting table */ } } /* end while */ } } /* end if (hdunum==1) */ } if (*imagecolname) { /* ----------------------------------------------------------------- */ /* we need to open an image contained in a single table cell */ /* First, determine which row of the table to use. */ /* ----------------------------------------------------------------- */ if (isdigit((int) *rowexpress)) /* is the row specification a number? */ { sscanf(rowexpress, "%ld", &rownum); if (rownum < 1) { ffpmsg("illegal rownum for image cell:"); ffpmsg(rowexpress); ffpmsg("Could not open the following image in a table cell:"); ffpmsg(extspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status = BAD_ROW_NUM); } } else if (fits_find_first_row(*fptr, rowexpress, &rownum, status) > 0) { ffpmsg("Failed to find row matching this expression:"); ffpmsg(rowexpress); ffpmsg("Could not open the following image in a table cell:"); ffpmsg(extspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } if (rownum == 0) { ffpmsg("row statisfying this expression doesn't exist::"); ffpmsg(rowexpress); ffpmsg("Could not open the following image in a table cell:"); ffpmsg(extspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status = BAD_ROW_NUM); } /* determine the name of the new file to contain copy of the image */ if (*histfilename && !(*pixfilter) ) strcpy(outfile, histfilename); /* the original outfile name */ else strcpy(outfile, "mem://_1"); /* create image file in memory */ /* Copy the image into new primary array and open it as the current */ /* fptr. This will close the table that contains the original image. */ /* create new empty file to hold copy of the image */ if (ffinit(&newptr, outfile, status) > 0) { ffpmsg("failed to create file for copy of image in table cell:"); ffpmsg(outfile); return(*status); } if (fits_copy_cell2image(*fptr, newptr, imagecolname, rownum, status) > 0) { ffpmsg("Failed to copy table cell to new primary array:"); ffpmsg(extspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } /* close the original file and set fptr to the new image */ ffclos(*fptr, status); *fptr = newptr; /* reset the pointer to the new table */ writecopy = 1; /* we are now dealing with a copy of the original file */ /* add some HISTORY; fits_copy_image_cell also wrote HISTORY keywords */ /* disable this; leave it up to calling routine to write any HISTORY keywords if (*extname) sprintf(card,"HISTORY in HDU '%.16s' of file '%.36s'",extname,infile); else sprintf(card,"HISTORY in HDU %d of file '%.45s'", extnum, infile); ffprec(*fptr, card, status); */ } /* --------------------------------------------------------------------- */ /* edit columns (and/or keywords) in the table, if specified in the URL */ /* --------------------------------------------------------------------- */ if (*colspec) { /* the column specifier will modify the file, so make sure */ /* we are already dealing with a copy, or else make a new copy */ if (!writecopy) /* Is the current file already a copy? */ writecopy = fits_is_this_a_copy(urltype); if (!writecopy) { if (*filtfilename && *outfile == '\0') strcpy(outfile, filtfilename); /* the original outfile name */ else strcpy(outfile, "mem://_1"); /* will create copy in memory */ writecopy = 1; } else { ((*fptr)->Fptr)->writemode = READWRITE; /* we have write access */ outfile[0] = '\0'; } if (ffedit_columns(fptr, outfile, colspec, status) > 0) { ffpmsg("editing columns in input table failed (ffopen)"); ffpmsg(" while trying to perform the following operation:"); ffpmsg(colspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } } /* ------------------------------------------------------------------- */ /* select rows from the table, if specified in the URL */ /* or select a subimage (if this is an image HDU and not a table) */ /* ------------------------------------------------------------------- */ if (*rowfilter) { fits_get_hdu_type(*fptr, &hdutyp, status); /* get type of HDU */ if (hdutyp == IMAGE_HDU) { /* this is an image so 'rowfilter' is an image section specification */ if (*filtfilename && *outfile == '\0') strcpy(outfile, filtfilename); /* the original outfile name */ else if (*outfile == '\0') /* output file name not already defined? */ strcpy(outfile, "mem://_2"); /* will create file in memory */ /* create new file containing the image section, plus a copy of */ /* any other HDUs that exist in the input file. This routine */ /* will close the original image file and return a pointer */ /* to the new file. */ if (fits_select_image_section(fptr, outfile, rowfilter, status) > 0) { ffpmsg("on-the-fly selection of image section failed (ffopen)"); ffpmsg(" while trying to use the following section filter:"); ffpmsg(rowfilter); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } } else { /* this is a table HDU, so the rowfilter is really a row filter */ if (*binspec) { /* since we are going to make a histogram of the selected rows, */ /* it would be a waste of time and memory to make a whole copy of */ /* the selected rows. Instead, just construct an array of TRUE */ /* or FALSE values that indicate which rows are to be included */ /* in the histogram and pass that to the histogram generating */ /* routine */ fits_get_num_rows(*fptr, &nrows, status); /* get no. of rows */ rowselect = (char *) calloc(nrows, 1); if (!rowselect) { ffpmsg( "failed to allocate memory for selected columns array (ffopen)"); ffpmsg(" while trying to select rows with the following filter:"); ffpmsg(rowfilter); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } if (fits_find_rows(*fptr, rowfilter, 1L, nrows, &goodrows, rowselect, status) > 0) { ffpmsg("selection of rows in input table failed (ffopen)"); ffpmsg(" while trying to select rows with the following filter:"); ffpmsg(rowfilter); free(rowselect); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } } else { if (!writecopy) /* Is the current file already a copy? */ writecopy = fits_is_this_a_copy(urltype); if (!writecopy) { if (*filtfilename && *outfile == '\0') strcpy(outfile, filtfilename); /* the original outfile name */ else if (*outfile == '\0') /* output filename not already defined? */ strcpy(outfile, "mem://_2"); /* will create copy in memory */ } else { ((*fptr)->Fptr)->writemode = READWRITE; /* we have write access */ outfile[0] = '\0'; } /* select rows in the table. If a copy of the input file has */ /* not already been made, then this routine will make a copy */ /* and then close the input file, so that the modifications will */ /* only be made on the copy, not the original */ if (ffselect_table(fptr, outfile, rowfilter, status) > 0) { ffpmsg("on-the-fly selection of rows in input table failed (ffopen)"); ffpmsg(" while trying to select rows with the following filter:"); ffpmsg(rowfilter); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } /* write history records */ ffphis(*fptr, "CFITSIO used the following filtering expression to create this table:", status); ffphis(*fptr, name, status); } /* end of no binspec case */ } /* end of table HDU case */ } /* end of rowfilter exists case */ /* ------------------------------------------------------------------- */ /* make an image histogram by binning columns, if specified in the URL */ /* ------------------------------------------------------------------- */ if (*binspec) { if (*histfilename && !(*pixfilter) ) strcpy(outfile, histfilename); /* the original outfile name */ else strcpy(outfile, "mem://_3"); /* create histogram in memory */ /* if not already copied the file */ /* parse the binning specifier into individual parameters */ ffbins(binspec, &imagetype, &haxis, colname, minin, maxin, binsizein, minname, maxname, binname, &weight, wtcol, &recip, status); /* Create the histogram primary array and open it as the current fptr */ /* This will close the table that was used to create the histogram. */ ffhist2(fptr, outfile, imagetype, haxis, colname, minin, maxin, binsizein, minname, maxname, binname, weight, wtcol, recip, rowselect, status); if (rowselect) free(rowselect); if (*status > 0) { ffpmsg("on-the-fly histogramming of input table failed (ffopen)"); ffpmsg(" while trying to execute the following histogram specification:"); ffpmsg(binspec); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } /* write history records */ ffphis(*fptr, "CFITSIO used the following expression to create this histogram:", status); ffphis(*fptr, name, status); } if (*pixfilter) { if (*histfilename) strcpy(outfile, histfilename); /* the original outfile name */ else strcpy(outfile, "mem://_4"); /* create in memory */ /* if not already copied the file */ /* Ensure type of HDU is consistent with pixel filtering */ fits_get_hdu_type(*fptr, &hdutyp, status); /* get type of HDU */ if (hdutyp == IMAGE_HDU) { pixel_filter_helper(fptr, outfile, pixfilter, status); if (*status > 0) { ffpmsg("pixel filtering of input image failed (ffopen)"); ffpmsg(" while trying to execute the following:"); ffpmsg(pixfilter); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ return(*status); } /* write history records */ ffphis(*fptr, "CFITSIO used the following expression to create this image:", status); ffphis(*fptr, name, status); } else { ffpmsg("cannot use pixel filter on non-IMAGE HDU"); ffpmsg(pixfilter); ffclos(*fptr, status); *fptr = 0; /* return null file pointer */ *status = NOT_IMAGE; return(*status); } } /* parse and save image compression specification, if given */ if (*compspec) { ffparsecompspec(*fptr, compspec, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffreopen(fitsfile *openfptr, /* I - FITS file pointer to open file */ fitsfile **newfptr, /* O - pointer to new re opened file */ int *status) /* IO - error status */ /* Reopen an existing FITS file with either readonly or read/write access. The reopened file shares the same FITSfile structure but may point to a different HDU within the file. */ { if (*status > 0) return(*status); /* check that the open file pointer is valid */ if (!openfptr) return(*status = NULL_INPUT_PTR); else if ((openfptr->Fptr)->validcode != VALIDSTRUC) /* check magic value */ return(*status = BAD_FILEPTR); /* allocate fitsfile structure and initialize = 0 */ *newfptr = (fitsfile *) calloc(1, sizeof(fitsfile)); (*newfptr)->Fptr = openfptr->Fptr; /* both point to the same structure */ (*newfptr)->HDUposition = 0; /* set initial position to primary array */ (((*newfptr)->Fptr)->open_count)++; /* increment the file usage counter */ return(*status); } /*--------------------------------------------------------------------------*/ int fits_store_Fptr(FITSfile *Fptr, /* O - FITS file pointer */ int *status) /* IO - error status */ /* store the new Fptr address for future use by fits_already_open */ { int ii; if (*status > 0) return(*status); FFLOCK; for (ii = 0; ii < NMAXFILES; ii++) { if (FptrTable[ii] == 0) { FptrTable[ii] = Fptr; break; } } FFUNLOCK; return(*status); } /*--------------------------------------------------------------------------*/ int fits_clear_Fptr(FITSfile *Fptr, /* O - FITS file pointer */ int *status) /* IO - error status */ /* clear the Fptr address from the Fptr Table */ { int ii; FFLOCK; for (ii = 0; ii < NMAXFILES; ii++) { if (FptrTable[ii] == Fptr) { FptrTable[ii] = 0; break; } } FFUNLOCK; return(*status); } /*--------------------------------------------------------------------------*/ int fits_already_open(fitsfile **fptr, /* I/O - FITS file pointer */ char *url, char *urltype, char *infile, char *extspec, char *rowfilter, char *binspec, char *colspec, int mode, /* I - 0 = open readonly; 1 = read/write */ int *isopen, /* O - 1 = file is already open */ int *status) /* IO - error status */ /* Check if the file to be opened is already open. If so, then attach to it. */ /* the input strings must not exceed the standard lengths */ /* of FLEN_FILENAME, MAX_PREFIX_LEN, etc. */ /* this function was changed so that for files of access method FILE:// the file paths are compared using standard URL syntax and absolute paths (as opposed to relative paths). This eliminates some instances where a file is already opened but it is not realized because it was opened with another file path. For instance, if the CWD is /a/b/c and I open /a/b/c/foo.fits then open ./foo.fits the previous version of this function would not have reconized that the two files were the same. This version does recognize that the two files are the same. */ { FITSfile *oldFptr; int ii; char oldurltype[MAX_PREFIX_LEN], oldinfile[FLEN_FILENAME]; char oldextspec[FLEN_FILENAME], oldoutfile[FLEN_FILENAME]; char oldrowfilter[FLEN_FILENAME]; char oldbinspec[FLEN_FILENAME], oldcolspec[FLEN_FILENAME]; char cwd[FLEN_FILENAME]; char tmpStr[FLEN_FILENAME]; char tmpinfile[FLEN_FILENAME]; *isopen = 0; /* When opening a file with readonly access then we simply let the operating system open the file again, instead of using the CFITSIO trick of attaching to the previously opened file. This is required if CFITSIO is running in a multi-threaded environment, because 2 different threads cannot share the same FITSfile pointer. If the file is opened/reopened with write access, then the file MUST only be physically opened once.. */ if (mode == 0) return(*status); if(strcasecmp(urltype,"FILE://") == 0) { fits_path2url(infile,tmpinfile,status); if(tmpinfile[0] != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); if (strlen(cwd) + strlen(tmpinfile) > FLEN_FILENAME-1) { ffpmsg("File name is too long. (fits_already_open)"); return(*status = FILE_NOT_OPENED); } strcat(cwd,tmpinfile); fits_clean_url(cwd,tmpinfile,status); } } else strcpy(tmpinfile,infile); for (ii = 0; ii < NMAXFILES; ii++) /* check every buffer */ { if (FptrTable[ii] != 0) { oldFptr = FptrTable[ii]; fits_parse_input_url(oldFptr->filename, oldurltype, oldinfile, oldoutfile, oldextspec, oldrowfilter, oldbinspec, oldcolspec, status); if (*status > 0) { ffpmsg("could not parse the previously opened filename: (ffopen)"); ffpmsg(oldFptr->filename); return(*status); } if(strcasecmp(oldurltype,"FILE://") == 0) { fits_path2url(oldinfile,tmpStr,status); if(tmpStr[0] != '/') { fits_get_cwd(cwd,status); strcat(cwd,"/"); strcat(cwd,tmpStr); fits_clean_url(cwd,tmpStr,status); } strcpy(oldinfile,tmpStr); } if (!strcmp(urltype, oldurltype) && !strcmp(tmpinfile, oldinfile) ) { /* identical type of file and root file name */ if ( (!rowfilter[0] && !oldrowfilter[0] && !binspec[0] && !oldbinspec[0] && !colspec[0] && !oldcolspec[0]) /* no filtering or binning specs for either file, so */ /* this is a case where the same file is being reopened. */ /* It doesn't matter if the extensions are different */ || /* or */ (!strcmp(rowfilter, oldrowfilter) && !strcmp(binspec, oldbinspec) && !strcmp(colspec, oldcolspec) && !strcmp(extspec, oldextspec) ) ) /* filtering specs are given and are identical, and */ /* the same extension is specified */ { if (mode == READWRITE && oldFptr->writemode == READONLY) { /* cannot assume that a file previously opened with READONLY can now be written to (e.g., files on CDROM, or over the the network, or STDIN), so return with an error. */ ffpmsg( "cannot reopen file READWRITE when previously opened READONLY"); ffpmsg(url); return(*status = FILE_NOT_OPENED); } *fptr = (fitsfile *) calloc(1, sizeof(fitsfile)); if (!(*fptr)) { ffpmsg( "failed to allocate structure for following file: (ffopen)"); ffpmsg(url); return(*status = MEMORY_ALLOCATION); } (*fptr)->Fptr = oldFptr; /* point to the structure */ (*fptr)->HDUposition = 0; /* set initial position */ (((*fptr)->Fptr)->open_count)++; /* increment usage counter */ if (binspec[0]) /* if binning specified, don't move */ extspec[0] = '\0'; /* all the filtering has already been applied, so ignore */ rowfilter[0] = '\0'; binspec[0] = '\0'; colspec[0] = '\0'; *isopen = 1; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_is_this_a_copy(char *urltype) /* I - type of file */ /* specialized routine that returns 1 if the file is known to be a temporary copy of the originally opened file. Otherwise it returns 0. */ { int iscopy; if (!strncmp(urltype, "mem", 3) ) iscopy = 1; /* file copy is in memory */ else if (!strncmp(urltype, "compress", 8) ) iscopy = 1; /* compressed diskfile that is uncompressed in memory */ else if (!strncmp(urltype, "http", 4) ) iscopy = 1; /* copied file using http protocol */ else if (!strncmp(urltype, "ftp", 3) ) iscopy = 1; /* copied file using ftp protocol */ else if (!strncmp(urltype, "gsiftp", 6) ) iscopy = 1; /* copied file using gsiftp protocol */ else if (!strncpy(urltype, "stdin", 5) ) iscopy = 1; /* piped stdin has been copied to memory */ else iscopy = 0; /* file is not known to be a copy */ return(iscopy); } /*--------------------------------------------------------------------------*/ static int find_quote(char **string) /* look for the closing single quote character in the input string */ { char *tstr; tstr = *string; while (*tstr) { if (*tstr == '\'') { /* found the closing quote */ *string = tstr + 1; /* set pointer to next char */ return(0); } else { /* skip over any other character */ tstr++; } } return(1); /* opps, didn't find the closing character */ } /*--------------------------------------------------------------------------*/ static int find_doublequote(char **string) /* look for the closing double quote character in the input string */ { char *tstr; tstr = *string; while (*tstr) { if (*tstr == '"') { /* found the closing quote */ *string = tstr + 1; /* set pointer to next char */ return(0); } else { /* skip over any other character */ tstr++; } } return(1); /* opps, didn't find the closing character */ } /*--------------------------------------------------------------------------*/ static int find_paren(char **string) /* look for the closing parenthesis character in the input string */ { char *tstr; tstr = *string; while (*tstr) { if (*tstr == ')') { /* found the closing parens */ *string = tstr + 1; /* set pointer to next char */ return(0); } else if (*tstr == '(') { /* found another level of parens */ tstr++; if (find_paren(&tstr)) return(1); } else if (*tstr == '[') { tstr++; if (find_bracket(&tstr)) return(1); } else if (*tstr == '{') { tstr++; if (find_curlybracket(&tstr)) return(1); } else if (*tstr == '"') { tstr++; if (find_doublequote(&tstr)) return(1); } else if (*tstr == '\'') { tstr++; if (find_quote(&tstr)) return(1); } else { tstr++; } } return(1); /* opps, didn't find the closing character */ } /*--------------------------------------------------------------------------*/ static int find_bracket(char **string) /* look for the closing bracket character in the input string */ { char *tstr; tstr = *string; while (*tstr) { if (*tstr == ']') { /* found the closing bracket */ *string = tstr + 1; /* set pointer to next char */ return(0); } else if (*tstr == '(') { /* found another level of parens */ tstr++; if (find_paren(&tstr)) return(1); } else if (*tstr == '[') { tstr++; if (find_bracket(&tstr)) return(1); } else if (*tstr == '{') { tstr++; if (find_curlybracket(&tstr)) return(1); } else if (*tstr == '"') { tstr++; if (find_doublequote(&tstr)) return(1); } else if (*tstr == '\'') { tstr++; if (find_quote(&tstr)) return(1); } else { tstr++; } } return(1); /* opps, didn't find the closing character */ } /*--------------------------------------------------------------------------*/ static int find_curlybracket(char **string) /* look for the closing curly bracket character in the input string */ { char *tstr; tstr = *string; while (*tstr) { if (*tstr == '}') { /* found the closing curly bracket */ *string = tstr + 1; /* set pointer to next char */ return(0); } else if (*tstr == '(') { /* found another level of parens */ tstr++; if (find_paren(&tstr)) return(1); } else if (*tstr == '[') { tstr++; if (find_bracket(&tstr)) return(1); } else if (*tstr == '{') { tstr++; if (find_curlybracket(&tstr)) return(1); } else if (*tstr == '"') { tstr++; if (find_doublequote(&tstr)) return(1); } else if (*tstr == '\'') { tstr++; if (find_quote(&tstr)) return(1); } else { tstr++; } } return(1); /* opps, didn't find the closing character */ } /*--------------------------------------------------------------------------*/ int comma2semicolon(char *string) /* replace commas with semicolons, unless the comma is within a quoted or bracketed expression */ { char *tstr; tstr = string; while (*tstr) { if (*tstr == ',') { /* found a comma */ *tstr = ';'; tstr++; } else if (*tstr == '(') { /* found another level of parens */ tstr++; if (find_paren(&tstr)) return(1); } else if (*tstr == '[') { tstr++; if (find_bracket(&tstr)) return(1); } else if (*tstr == '{') { tstr++; if (find_curlybracket(&tstr)) return(1); } else if (*tstr == '"') { tstr++; if (find_doublequote(&tstr)) return(1); } else if (*tstr == '\'') { tstr++; if (find_quote(&tstr)) return(1); } else { tstr++; } } return(0); /* reached end of string */ } /*--------------------------------------------------------------------------*/ int ffedit_columns( fitsfile **fptr, /* IO - pointer to input table; on output it */ /* points to the new selected rows table */ char *outfile, /* I - name for output file */ char *expr, /* I - column edit expression */ int *status) /* modify columns in a table and/or header keywords in the HDU */ { fitsfile *newptr; int ii, hdunum, slen, colnum = -1, testnum, deletecol = 0, savecol = 0; int numcols = 0, *colindex = 0, tstatus = 0, inparen; char *cptr, *cptr2, *cptr3, *clause = NULL, keyname[FLEN_KEYWORD]; char colname[FLEN_VALUE], oldname[FLEN_VALUE], colformat[FLEN_VALUE]; char *file_expr = NULL, testname[FLEN_VALUE], card[FLEN_CARD]; if (*outfile) { /* create new empty file in to hold the selected rows */ if (ffinit(&newptr, outfile, status) > 0) { ffpmsg("failed to create file for copy (ffedit_columns)"); return(*status); } fits_get_hdu_num(*fptr, &hdunum); /* current HDU number in input file */ /* copy all HDUs to the output copy, if the 'only_one' flag is not set */ if (!((*fptr)->Fptr)->only_one) { for (ii = 1; 1; ii++) { if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0) break; fits_copy_hdu(*fptr, newptr, 0, status); } if (*status == END_OF_FILE) { *status = 0; /* got the expected EOF error; reset = 0 */ } else if (*status > 0) { ffclos(newptr, status); ffpmsg("failed to copy all HDUs from input file (ffedit_columns)"); return(*status); } } else { /* only copy the primary array and the designated table extension */ fits_movabs_hdu(*fptr, 1, NULL, status); fits_copy_hdu(*fptr, newptr, 0, status); fits_movabs_hdu(*fptr, hdunum, NULL, status); fits_copy_hdu(*fptr, newptr, 0, status); if (*status > 0) { ffclos(newptr, status); ffpmsg("failed to copy all HDUs from input file (ffedit_columns)"); return(*status); } hdunum = 2; } /* close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = newptr; /* reset the pointer to the new table */ /* move back to the selected table HDU */ if (fits_movabs_hdu(*fptr, hdunum, NULL, status) > 0) { ffpmsg("failed to copy the input file (ffedit_columns)"); return(*status); } } /* remove the "col " from the beginning of the column edit expression */ cptr = expr + 4; while (*cptr == ' ') cptr++; /* skip leading white space */ /* Check if need to import expression from a file */ if( *cptr=='@' ) { if( ffimport_file( cptr+1, &file_expr, status ) ) return(*status); cptr = file_expr; while (*cptr == ' ') cptr++; /* skip leading white space... again */ } tstatus = 0; ffgncl(*fptr, &numcols, &tstatus); /* get initial # of cols */ /* as of July 2012, the CFITSIO column filter syntax was modified */ /* so that commas may be used to separate clauses, as well as semi-colons. */ /* This was done because users cannot enter the semi-colon in the HEASARC's */ /* Hera on-line data processing system for computer security reasons. */ /* Therefore, we must convert those commas back to semi-colons here, but we */ /* must not convert any columns that occur within parenthesies. */ if (comma2semicolon(cptr)) { ffpmsg("parsing error in column filter expression"); ffpmsg(cptr); if( file_expr ) free( file_expr ); *status = PARSE_SYNTAX_ERR; return(*status); } /* parse expression and get first clause, if more than 1 */ while ((slen = fits_get_token2(&cptr, ";", &clause, NULL, status)) > 0 ) { if( *cptr==';' ) cptr++; clause[slen] = '\0'; if (clause[0] == '!' || clause[0] == '-') { /* ===================================== */ /* Case I. delete this column or keyword */ /* ===================================== */ if (ffgcno(*fptr, CASEINSEN, &clause[1], &colnum, status) <= 0) { /* a column with this name exists, so try to delete it */ if (ffdcol(*fptr, colnum, status) > 0) { ffpmsg("failed to delete column in input file:"); ffpmsg(clause); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if( clause ) free(clause); return(*status); } deletecol = 1; /* set flag that at least one col was deleted */ numcols--; colnum = -1; } else { ffcmsg(); /* clear previous error message from ffgcno */ /* try deleting a keyword with this name */ *status = 0; if (ffdkey(*fptr, &clause[1], status) > 0) { ffpmsg("column or keyword to be deleted does not exist:"); ffpmsg(clause); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if( clause ) free(clause); return(*status); } } } else { /* ===================================================== */ /* Case II: this is either a column name, (case 1) or a new column name followed by double = ("==") followed by the old name which is to be renamed. (case 2A) or a column or keyword name followed by a single "=" and a calculation expression (case 2B) */ /* ===================================================== */ cptr2 = clause; slen = fits_get_token(&cptr2, "( =", colname, NULL); if (slen == 0) { ffpmsg("error: column or keyword name is blank:"); ffpmsg(clause); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status= URL_PARSE_ERROR); } /* If this is a keyword of the form #KEYWORD# then transform to the form #KEYWORDn where n is the previously used column number */ if (colname[0] == '#' && strstr(colname+1, "#") == (colname + strlen(colname) - 1)) { if (colnum <= 0) { ffpmsg("The keyword name:"); ffpmsg(colname); ffpmsg("is invalid unless a column has been previously"); ffpmsg("created or editted by a calculator command"); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status = URL_PARSE_ERROR); } colname[strlen(colname)-1] = '\0'; /* Make keyword name and put it in oldname */ ffkeyn(colname+1, colnum, oldname, status); if (*status) return (*status); /* Re-copy back into colname */ strcpy(colname+1,oldname); } else if (strstr(colname, "#") == (colname + strlen(colname) - 1)) { /* colname is of the form "NAME#"; if a) colnum is defined, and b) a column with literal name "NAME#" does not exist, and c) a keyword with name "NAMEn" (where n=colnum) exists, then transfrom the colname string to "NAMEn", otherwise do nothing. */ if (colnum > 0) { /* colnum must be defined */ tstatus = 0; ffgcno(*fptr, CASEINSEN, colname, &testnum, &tstatus); if (tstatus != 0 && tstatus != COL_NOT_UNIQUE) { /* OK, column doesn't exist, now see if keyword exists */ ffcmsg(); /* clear previous error message from ffgcno */ strcpy(testname, colname); testname[strlen(testname)-1] = '\0'; /* Make keyword name and put it in oldname */ ffkeyn(testname, colnum, oldname, status); if (*status) { if( file_expr ) free( file_expr ); if (clause) free(clause); return (*status); } tstatus = 0; if (!fits_read_card(*fptr, oldname, card, &tstatus)) { /* Keyword does exist; copy real name back into colname */ strcpy(colname,oldname); } } } } /* if we encountered an opening parenthesis, then we need to */ /* find the closing parenthesis, and concatinate the 2 strings */ /* This supports expressions like: [col #EXTNAME(Extension name)="GTI"] */ if (*cptr2 == '(') { fits_get_token(&cptr2, ")", oldname, NULL); strcat(colname, oldname); strcat(colname, ")"); cptr2++; } while (*cptr2 == ' ') cptr2++; /* skip white space */ if (*cptr2 != '=') { /* ------------------------------------ */ /* case 1 - simply the name of a column */ /* ------------------------------------ */ /* look for matching column */ ffgcno(*fptr, CASEINSEN, colname, &testnum, status); while (*status == COL_NOT_UNIQUE) { /* the column name contained wild cards, and it */ /* matches more than one column in the table. */ colnum = testnum; /* keep this column in the output file */ savecol = 1; if (!colindex) colindex = (int *) calloc(999, sizeof(int)); colindex[colnum - 1] = 1; /* flag this column number */ /* look for other matching column names */ ffgcno(*fptr, CASEINSEN, colname, &testnum, status); if (*status == COL_NOT_FOUND) *status = 999; /* temporary status flag value */ } if (*status <= 0) { colnum = testnum; /* keep this column in the output file */ savecol = 1; if (!colindex) colindex = (int *) calloc(999, sizeof(int)); colindex[colnum - 1] = 1; /* flag this column number */ } else if (*status == 999) { /* this special flag value does not represent an error */ *status = 0; } else { ffpmsg("Syntax error in columns specifier in input URL:"); ffpmsg(cptr2); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status = URL_PARSE_ERROR); } } else { /* ----------------------------------------------- */ /* case 2 where the token ends with an equals sign */ /* ----------------------------------------------- */ cptr2++; /* skip over the first '=' */ if (*cptr2 == '=') { /*................................................. */ /* Case A: rename a column or keyword; syntax is "new_name == old_name" */ /*................................................. */ cptr2++; /* skip the 2nd '=' */ while (*cptr2 == ' ') cptr2++; /* skip white space */ fits_get_token(&cptr2, " ", oldname, NULL); /* get column number of the existing column */ if (ffgcno(*fptr, CASEINSEN, oldname, &colnum, status) <= 0) { /* modify the TTYPEn keyword value with the new name */ ffkeyn("TTYPE", colnum, keyname, status); if (ffmkys(*fptr, keyname, colname, NULL, status) > 0) { ffpmsg("failed to rename column in input file"); ffpmsg(" oldname ="); ffpmsg(oldname); ffpmsg(" newname ="); ffpmsg(colname); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status); } /* keep this column in the output file */ savecol = 1; if (!colindex) colindex = (int *) calloc(999, sizeof(int)); colindex[colnum - 1] = 1; /* flag this column number */ } else { /* try renaming a keyword */ ffcmsg(); /* clear error message stack */ *status = 0; if (ffmnam(*fptr, oldname, colname, status) > 0) { ffpmsg("column or keyword to be renamed does not exist:"); ffpmsg(clause); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status); } } } else { /*...................................................... */ /* Case B: */ /* this must be a general column/keyword calc expression */ /* "name = expression" or "colname(TFORM) = expression" */ /*...................................................... */ /* parse the name and TFORM values, if present */ colformat[0] = '\0'; cptr3 = colname; fits_get_token(&cptr3, "(", oldname, NULL); if (cptr3[0] == '(' ) { cptr3++; /* skip the '(' */ fits_get_token(&cptr3, ")", colformat, NULL); } /* calculate values for the column or keyword */ /* cptr2 = the expression to be calculated */ /* oldname = name of the column or keyword */ /* colformat = column format, or keyword comment string */ if (fits_calculator(*fptr, cptr2, *fptr, oldname, colformat, status) > 0) { ffpmsg("Unable to calculate expression"); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status); } /* test if this is a column and not a keyword */ tstatus = 0; ffgcno(*fptr, CASEINSEN, oldname, &testnum, &tstatus); if (tstatus == 0) { /* keep this column in the output file */ colnum = testnum; savecol = 1; if (!colindex) colindex = (int *) calloc(999, sizeof(int)); colindex[colnum - 1] = 1; if (colnum > numcols)numcols++; } else { ffcmsg(); /* clear the error message stack */ } } } } if (clause) free(clause); /* free old clause before getting new one */ clause = NULL; } if (savecol && !deletecol) { /* need to delete all but the specified columns */ for (ii = numcols; ii > 0; ii--) { if (!colindex[ii-1]) /* delete this column */ { if (ffdcol(*fptr, ii, status) > 0) { ffpmsg("failed to delete column in input file:"); ffpmsg(clause); if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status); } } } } if( colindex ) free( colindex ); if( file_expr ) free( file_expr ); if (clause) free(clause); return(*status); } /*--------------------------------------------------------------------------*/ int fits_copy_cell2image( fitsfile *fptr, /* I - point to input table */ fitsfile *newptr, /* O - existing output file; new image HDU will be appended to it */ char *colname, /* I - column name / number containing the image*/ long rownum, /* I - number of the row containing the image */ int *status) /* IO - error status */ /* Copy a table cell of a given row and column into an image extension. The output file must already have been created. A new image extension will be created in that file. This routine was written by Craig Markwardt, GSFC */ { unsigned char buffer[30000]; int hdutype, colnum, typecode, bitpix, naxis, maxelem, tstatus; LONGLONG naxes[9], nbytes, firstbyte, ntodo; LONGLONG repeat, startpos, elemnum, rowlen, tnull; long twidth, incre; double scale, zero; char tform[20]; char card[FLEN_CARD]; char templt[FLEN_CARD] = ""; /* Table-to-image keyword translation table */ /* INPUT OUTPUT */ /* 01234567 01234567 */ char *patterns[][2] = {{"TSCALn", "BSCALE" }, /* Standard FITS keywords */ {"TZEROn", "BZERO" }, {"TUNITn", "BUNIT" }, {"TNULLn", "BLANK" }, {"TDMINn", "DATAMIN" }, {"TDMAXn", "DATAMAX" }, {"iCTYPn", "CTYPEi" }, /* Coordinate labels */ {"iCTYna", "CTYPEia" }, {"iCUNIn", "CUNITi" }, /* Coordinate units */ {"iCUNna", "CUNITia" }, {"iCRVLn", "CRVALi" }, /* WCS keywords */ {"iCRVna", "CRVALia" }, {"iCDLTn", "CDELTi" }, {"iCDEna", "CDELTia" }, {"iCRPXn", "CRPIXi" }, {"iCRPna", "CRPIXia" }, {"ijPCna", "PCi_ja" }, {"ijCDna", "CDi_ja" }, {"iVn_ma", "PVi_ma" }, {"iSn_ma", "PSi_ma" }, {"iCRDna", "CRDERia" }, {"iCSYna", "CSYERia" }, {"iCROTn", "CROTAi" }, {"WCAXna", "WCSAXESa"}, {"WCSNna", "WCSNAMEa"}, {"LONPna", "LONPOLEa"}, {"LATPna", "LATPOLEa"}, {"EQUIna", "EQUINOXa"}, {"MJDOBn", "MJD-OBS" }, {"MJDAn", "MJD-AVG" }, {"RADEna", "RADESYSa"}, {"iCNAna", "CNAMEia" }, {"DAVGn", "DATE-AVG"}, /* Delete table keywords related to other columns */ {"T????#a", "-" }, {"TC??#a", "-" }, {"TWCS#a", "-" }, {"TDIM#", "-" }, {"iCTYPm", "-" }, {"iCUNIm", "-" }, {"iCRVLm", "-" }, {"iCDLTm", "-" }, {"iCRPXm", "-" }, {"iCTYma", "-" }, {"iCUNma", "-" }, {"iCRVma", "-" }, {"iCDEma", "-" }, {"iCRPma", "-" }, {"ijPCma", "-" }, {"ijCDma", "-" }, {"iVm_ma", "-" }, {"iSm_ma", "-" }, {"iCRDma", "-" }, {"iCSYma", "-" }, {"iCROTm", "-" }, {"WCAXma", "-" }, {"WCSNma", "-" }, {"LONPma", "-" }, {"LATPma", "-" }, {"EQUIma", "-" }, {"MJDOBm", "-" }, {"MJDAm", "-" }, {"RADEma", "-" }, {"iCNAma", "-" }, {"DAVGm", "-" }, {"EXTNAME", "-" }, /* Remove structural keywords*/ {"EXTVER", "-" }, {"EXTLEVEL","-" }, {"CHECKSUM","-" }, {"DATASUM", "-" }, {"*", "+" }}; /* copy all other keywords */ int npat; if (*status > 0) return(*status); /* get column number */ if (ffgcno(fptr, CASEINSEN, colname, &colnum, status) > 0) { ffpmsg("column containing image in table cell does not exist:"); ffpmsg(colname); return(*status); } /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if ( ffgcprll(fptr, colnum, rownum, 1L, 1L, 0, &scale, &zero, tform, &twidth, &typecode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, (char *) buffer, status) > 0 ) return(*status); /* get the actual column name, in case a column number was given */ ffkeyn("", colnum, templt, &tstatus); ffgcnn(fptr, CASEINSEN, templt, colname, &colnum, &tstatus); if (hdutype != BINARY_TBL) { ffpmsg("This extension is not a binary table."); ffpmsg(" Cannot open the image in a binary table cell."); return(*status = NOT_BTABLE); } if (typecode < 0) { /* variable length array */ typecode *= -1; /* variable length arrays are 1-dimensional by default */ naxis = 1; naxes[0] = repeat; } else { /* get the dimensions of the image */ ffgtdmll(fptr, colnum, 9, &naxis, naxes, status); } if (*status > 0) { ffpmsg("Error getting the dimensions of the image"); return(*status); } /* determine BITPIX value for the image */ if (typecode == TBYTE) { bitpix = BYTE_IMG; nbytes = repeat; } else if (typecode == TSHORT) { bitpix = SHORT_IMG; nbytes = repeat * 2; } else if (typecode == TLONG) { bitpix = LONG_IMG; nbytes = repeat * 4; } else if (typecode == TFLOAT) { bitpix = FLOAT_IMG; nbytes = repeat * 4; } else if (typecode == TDOUBLE) { bitpix = DOUBLE_IMG; nbytes = repeat * 8; } else if (typecode == TLONGLONG) { bitpix = LONGLONG_IMG; nbytes = repeat * 8; } else if (typecode == TLOGICAL) { bitpix = BYTE_IMG; nbytes = repeat; } else { ffpmsg("Error: the following image column has invalid datatype:"); ffpmsg(colname); ffpmsg(tform); ffpmsg("Cannot open an image in a single row of this column."); return(*status = BAD_TFORM); } /* create new image in output file */ if (ffcrimll(newptr, bitpix, naxis, naxes, status) > 0) { ffpmsg("failed to write required primary array keywords in the output file"); return(*status); } npat = sizeof(patterns)/sizeof(patterns[0][0])/2; /* skip over the first 8 keywords, starting just after TFIELDS */ fits_translate_keywords(fptr, newptr, 9, patterns, npat, colnum, 0, 0, status); /* add some HISTORY */ sprintf(card,"HISTORY This image was copied from row %ld of column '%s',", rownum, colname); /* disable this; leave it up to the caller to write history if needed. ffprec(newptr, card, status); */ /* the use of ffread routine, below, requires that any 'dirty' */ /* buffers in memory be flushed back to the file first */ ffflsh(fptr, FALSE, status); /* finally, copy the data, one buffer size at a time */ ffmbyt(fptr, startpos, TRUE, status); firstbyte = 1; /* the upper limit on the number of bytes must match the declaration */ /* read up to the first 30000 bytes in the normal way with ffgbyt */ ntodo = minvalue(30000, nbytes); ffgbyt(fptr, ntodo, buffer, status); ffptbb(newptr, 1, firstbyte, ntodo, buffer, status); nbytes -= ntodo; firstbyte += ntodo; /* read any additional bytes with low-level ffread routine, for speed */ while (nbytes && (*status <= 0) ) { ntodo = minvalue(30000, nbytes); ffread((fptr)->Fptr, (long) ntodo, buffer, status); ffptbb(newptr, 1, firstbyte, ntodo, buffer, status); nbytes -= ntodo; firstbyte += ntodo; } /* Re-scan the header so that CFITSIO knows about all the new keywords */ ffrdef(newptr,status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_copy_image2cell( fitsfile *fptr, /* I - pointer to input image extension */ fitsfile *newptr, /* I - pointer to output table */ char *colname, /* I - name of column containing the image */ long rownum, /* I - number of the row containing the image */ int copykeyflag, /* I - controls which keywords to copy */ int *status) /* IO - error status */ /* Copy an image extension into a table cell at a given row and column. The table must have already been created. If the "colname" column exists, it will be used, otherwise a new column will be created in the table. The "copykeyflag" parameter controls which keywords to copy from the input image to the output table header (with any appropriate translation). copykeyflag = 0 -- no keywords will be copied copykeyflag = 1 -- essentially all keywords will be copied copykeyflag = 2 -- copy only the WCS related keywords This routine was written by Craig Markwardt, GSFC */ { tcolumn *colptr; unsigned char buffer[30000]; int ii, hdutype, colnum, typecode, bitpix, naxis, ncols, hdunum; char tformchar, tform[20], card[FLEN_CARD]; LONGLONG imgstart, naxes[9], nbytes, repeat, ntodo,firstbyte; char filename[FLEN_FILENAME+20]; int npat; int naxis1; LONGLONG naxes1[9] = {0,0,0,0,0,0,0,0,0}, repeat1, width1; int typecode1; unsigned char dummy = 0; LONGLONG headstart, datastart, dataend; /* Image-to-table keyword translation table */ /* INPUT OUTPUT */ /* 01234567 01234567 */ char *patterns[][2] = {{"BSCALE", "TSCALn" }, /* Standard FITS keywords */ {"BZERO", "TZEROn" }, {"BUNIT", "TUNITn" }, {"BLANK", "TNULLn" }, {"DATAMIN", "TDMINn" }, {"DATAMAX", "TDMAXn" }, {"CTYPEi", "iCTYPn" }, /* Coordinate labels */ {"CTYPEia", "iCTYna" }, {"CUNITi", "iCUNIn" }, /* Coordinate units */ {"CUNITia", "iCUNna" }, {"CRVALi", "iCRVLn" }, /* WCS keywords */ {"CRVALia", "iCRVna" }, {"CDELTi", "iCDLTn" }, {"CDELTia", "iCDEna" }, {"CRPIXj", "jCRPXn" }, {"CRPIXja", "jCRPna" }, {"PCi_ja", "ijPCna" }, {"CDi_ja", "ijCDna" }, {"PVi_ma", "iVn_ma" }, {"PSi_ma", "iSn_ma" }, {"WCSAXESa","WCAXna" }, {"WCSNAMEa","WCSNna" }, {"CRDERia", "iCRDna" }, {"CSYERia", "iCSYna" }, {"CROTAi", "iCROTn" }, {"LONPOLEa","LONPna"}, {"LATPOLEa","LATPna"}, {"EQUINOXa","EQUIna"}, {"MJD-OBS", "MJDOBn" }, {"MJD-AVG", "MJDAn" }, {"RADESYSa","RADEna"}, {"CNAMEia", "iCNAna" }, {"DATE-AVG","DAVGn"}, {"NAXISi", "-" }, /* Remove structural keywords*/ {"PCOUNT", "-" }, {"GCOUNT", "-" }, {"EXTEND", "-" }, {"EXTNAME", "-" }, {"EXTVER", "-" }, {"EXTLEVEL","-" }, {"CHECKSUM","-" }, {"DATASUM", "-" }, {"*", "+" }}; /* copy all other keywords */ if (*status > 0) return(*status); if (fptr == 0 || newptr == 0) return (*status = NULL_INPUT_PTR); if (ffghdt(fptr, &hdutype, status) > 0) { ffpmsg("could not get input HDU type"); return (*status); } if (hdutype != IMAGE_HDU) { ffpmsg("The input extension is not an image."); ffpmsg(" Cannot open the image."); return(*status = NOT_IMAGE); } if (ffghdt(newptr, &hdutype, status) > 0) { ffpmsg("could not get output HDU type"); return (*status); } if (hdutype != BINARY_TBL) { ffpmsg("The output extension is not a table."); return(*status = NOT_BTABLE); } if (ffgiprll(fptr, 9, &bitpix, &naxis, naxes, status) > 0) { ffpmsg("Could not read image parameters."); return (*status); } /* Determine total number of pixels in the image */ repeat = 1; for (ii = 0; ii < naxis; ii++) repeat *= naxes[ii]; /* Determine the TFORM value for the table cell */ if (bitpix == BYTE_IMG) { typecode = TBYTE; tformchar = 'B'; nbytes = repeat; } else if (bitpix == SHORT_IMG) { typecode = TSHORT; tformchar = 'I'; nbytes = repeat*2; } else if (bitpix == LONG_IMG) { typecode = TLONG; tformchar = 'J'; nbytes = repeat*4; } else if (bitpix == FLOAT_IMG) { typecode = TFLOAT; tformchar = 'E'; nbytes = repeat*4; } else if (bitpix == DOUBLE_IMG) { typecode = TDOUBLE; tformchar = 'D'; nbytes = repeat*8; } else if (bitpix == LONGLONG_IMG) { typecode = TLONGLONG; tformchar = 'K'; nbytes = repeat*8; } else { ffpmsg("Error: the image has an invalid datatype."); return (*status = BAD_BITPIX); } /* get column number */ ffpmrk(); ffgcno(newptr, CASEINSEN, colname, &colnum, status); ffcmrk(); /* Column does not exist; create it */ if (*status) { *status = 0; sprintf(tform, "%.0f%c", (double) repeat, tformchar); ffgncl(newptr, &ncols, status); colnum = ncols+1; fficol(newptr, colnum, colname, tform, status); ffptdmll(newptr, colnum, naxis, naxes, status); if (*status) { ffpmsg("Could not insert new column into output table."); return *status; } } else { ffgtdmll(newptr, colnum, 9, &naxis1, naxes1, status); if (*status > 0 || naxis != naxis1) { ffpmsg("Input image dimensions and output table cell dimensions do not match."); return (*status = BAD_DIMEN); } for (ii=0; ii 0) || (typecode1 != typecode) || (repeat1 != repeat)) { ffpmsg("Input image data type does not match output table cell type."); return (*status = BAD_TFORM); } } /* copy keywords from input image to output table, if required */ if (copykeyflag) { npat = sizeof(patterns)/sizeof(patterns[0][0])/2; if (copykeyflag == 2) { /* copy only the WCS-related keywords */ patterns[npat-1][1] = "-"; } /* The 3rd parameter value = 5 means skip the first 4 keywords in the image */ fits_translate_keywords(fptr, newptr, 5, patterns, npat, colnum, 0, 0, status); } /* Here is all the code to compute offsets: * * byte offset from start of row to column (dest table) * * byte offset from start of file to image data (source image) */ /* Force the writing of the row of the table by writing the last byte of the array, which grows the table, and/or shifts following extensions */ ffpcl(newptr, TBYTE, colnum, rownum, repeat, 1, &dummy, status); /* byte offset within the row to the start of the image column */ colptr = (newptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ firstbyte = colptr->tbcol + 1; /* get starting address of input image to be read */ ffghadll(fptr, &headstart, &datastart, &dataend, status); imgstart = datastart; sprintf(card, "HISTORY Table column '%s' row %ld copied from image", colname, rownum); /* Don't automatically write History keywords; leave this up to the caller. ffprec(newptr, card, status); */ /* write HISTORY keyword with the file name (this is now disabled)*/ filename[0] = '\0'; hdunum = 0; strcpy(filename, "HISTORY "); ffflnm(fptr, filename+strlen(filename), status); ffghdn(fptr, &hdunum); sprintf(filename+strlen(filename),"[%d]", hdunum-1); /* ffprec(newptr, filename, status); */ /* the use of ffread routine, below, requires that any 'dirty' */ /* buffers in memory be flushed back to the file first */ ffflsh(fptr, FALSE, status); /* move to the first byte of the input image */ ffmbyt(fptr, imgstart, TRUE, status); ntodo = minvalue(30000L, nbytes); ffgbyt(fptr, ntodo, buffer, status); /* read input image */ ffptbb(newptr, rownum, firstbyte, ntodo, buffer, status); /* write to table */ nbytes -= ntodo; firstbyte += ntodo; /* read any additional bytes with low-level ffread routine, for speed */ while (nbytes && (*status <= 0) ) { ntodo = minvalue(30000L, nbytes); ffread(fptr->Fptr, (long) ntodo, buffer, status); ffptbb(newptr, rownum, firstbyte, ntodo, buffer, status); nbytes -= ntodo; firstbyte += ntodo; } /* Re-scan the header so that CFITSIO knows about all the new keywords */ ffrdef(newptr,status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_select_image_section( fitsfile **fptr, /* IO - pointer to input image; on output it */ /* points to the new subimage */ char *outfile, /* I - name for output file */ char *expr, /* I - Image section expression */ int *status) { /* copies an image section from the input file to a new output file. Any HDUs preceding or following the image are also copied to the output file. */ fitsfile *newptr; int ii, hdunum; /* create new empty file to hold the image section */ if (ffinit(&newptr, outfile, status) > 0) { ffpmsg( "failed to create output file for image section:"); ffpmsg(outfile); return(*status); } fits_get_hdu_num(*fptr, &hdunum); /* current HDU number in input file */ /* copy all preceding extensions to the output file, if 'only_one' flag not set */ if (!(((*fptr)->Fptr)->only_one)) { for (ii = 1; ii < hdunum; ii++) { fits_movabs_hdu(*fptr, ii, NULL, status); if (fits_copy_hdu(*fptr, newptr, 0, status) > 0) { ffclos(newptr, status); return(*status); } } /* move back to the original HDU position */ fits_movabs_hdu(*fptr, hdunum, NULL, status); } if (fits_copy_image_section(*fptr, newptr, expr, status) > 0) { ffclos(newptr, status); return(*status); } /* copy any remaining HDUs to the output file, if 'only_one' flag not set */ if (!(((*fptr)->Fptr)->only_one)) { for (ii = hdunum + 1; 1; ii++) { if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0) break; fits_copy_hdu(*fptr, newptr, 0, status); } if (*status == END_OF_FILE) *status = 0; /* got the expected EOF error; reset = 0 */ else if (*status > 0) { ffclos(newptr, status); return(*status); } } else { ii = hdunum + 1; /* this value of ii is required below */ } /* close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = newptr; /* reset the pointer to the new table */ /* move back to the image subsection */ if (ii - 1 != hdunum) fits_movabs_hdu(*fptr, hdunum, NULL, status); else { /* may have to reset BSCALE and BZERO pixel scaling, */ /* since the keywords were previously turned off */ if (ffrdef(*fptr, status) > 0) { ffclos(*fptr, status); return(*status); } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_copy_image_section( fitsfile *fptr, /* I - pointer to input image */ fitsfile *newptr, /* I - pointer to output image */ char *expr, /* I - Image section expression */ int *status) { /* copies an image section from the input file to a new output HDU */ int bitpix, naxis, numkeys, nkey; long naxes[] = {1,1,1,1,1,1,1,1,1}, smin, smax, sinc; long fpixels[] = {1,1,1,1,1,1,1,1,1}; long lpixels[] = {1,1,1,1,1,1,1,1,1}; long incs[] = {1,1,1,1,1,1,1,1,1}; char *cptr, keyname[FLEN_KEYWORD], card[FLEN_CARD]; int ii, tstatus, anynull; long minrow, maxrow, minslice, maxslice, mincube, maxcube; long firstpix; long ncubeiter, nsliceiter, nrowiter, kiter, jiter, iiter; int klen, kk, jj; long outnaxes[9], outsize, buffsize; double *buffer, crpix, cdelt; if (*status > 0) return(*status); /* get the size of the input image */ fits_get_img_type(fptr, &bitpix, status); fits_get_img_dim(fptr, &naxis, status); if (fits_get_img_size(fptr, naxis, naxes, status) > 0) return(*status); if (naxis < 1 || naxis > 4) { ffpmsg( "Input image either had NAXIS = 0 (NULL image) or has > 4 dimensions"); return(*status = BAD_NAXIS); } /* create output image with same size and type as the input image */ /* Will update the size later */ fits_create_img(newptr, bitpix, naxis, naxes, status); /* copy all other non-structural keywords from the input to output file */ fits_get_hdrspace(fptr, &numkeys, NULL, status); for (nkey = 4; nkey <= numkeys; nkey++) /* skip the first few keywords */ { fits_read_record(fptr, nkey, card, status); if (fits_get_keyclass(card) > TYP_CMPRS_KEY) { /* write the record to the output file */ fits_write_record(newptr, card, status); } } if (*status > 0) { ffpmsg("error copying header from input image to output image"); return(*status); } /* parse the section specifier to get min, max, and inc for each axis */ /* and the size of each output image axis */ cptr = expr; for (ii=0; ii < naxis; ii++) { if (fits_get_section_range(&cptr, &smin, &smax, &sinc, status) > 0) { ffpmsg("error parsing the following image section specifier:"); ffpmsg(expr); return(*status); } if (smax == 0) smax = naxes[ii]; /* use whole axis by default */ else if (smin == 0) smin = naxes[ii]; /* use inverted whole axis */ if (smin > naxes[ii] || smax > naxes[ii]) { ffpmsg("image section exceeds dimensions of input image:"); ffpmsg(expr); return(*status = BAD_NAXIS); } fpixels[ii] = smin; lpixels[ii] = smax; incs[ii] = sinc; if (smin <= smax) outnaxes[ii] = (smax - smin + sinc) / sinc; else outnaxes[ii] = (smin - smax + sinc) / sinc; /* modify the NAXISn keyword */ fits_make_keyn("NAXIS", ii + 1, keyname, status); fits_modify_key_lng(newptr, keyname, outnaxes[ii], NULL, status); /* modify the WCS keywords if necessary */ if (fpixels[ii] != 1 || incs[ii] != 1) { for (kk=-1;kk<26; kk++) /* modify any alternate WCS keywords */ { /* read the CRPIXn keyword if it exists in the input file */ fits_make_keyn("CRPIX", ii + 1, keyname, status); if (kk != -1) { klen = strlen(keyname); keyname[klen]='A' + kk; keyname[klen + 1] = '\0'; } tstatus = 0; if (fits_read_key(fptr, TDOUBLE, keyname, &crpix, NULL, &tstatus) == 0) { /* calculate the new CRPIXn value */ if (fpixels[ii] <= lpixels[ii]) { crpix = (crpix - (fpixels[ii])) / incs[ii] + 1.0; /* crpix = (crpix - (fpixels[ii] - 1.0) - .5) / incs[ii] + 0.5; */ } else { crpix = (fpixels[ii] - crpix) / incs[ii] + 1.0; /* crpix = (fpixels[ii] - (crpix - 1.0) - .5) / incs[ii] + 0.5; */ } /* modify the value in the output file */ fits_modify_key_dbl(newptr, keyname, crpix, 15, NULL, status); if (incs[ii] != 1 || fpixels[ii] > lpixels[ii]) { /* read the CDELTn keyword if it exists in the input file */ fits_make_keyn("CDELT", ii + 1, keyname, status); if (kk != -1) { klen = strlen(keyname); keyname[klen]='A' + kk; keyname[klen + 1] = '\0'; } tstatus = 0; if (fits_read_key(fptr, TDOUBLE, keyname, &cdelt, NULL, &tstatus) == 0) { /* calculate the new CDELTn value */ if (fpixels[ii] <= lpixels[ii]) cdelt = cdelt * incs[ii]; else cdelt = cdelt * (-incs[ii]); /* modify the value in the output file */ fits_modify_key_dbl(newptr, keyname, cdelt, 15, NULL, status); } /* modify the CDi_j keywords if they exist in the input file */ fits_make_keyn("CD1_", ii + 1, keyname, status); if (kk != -1) { klen = strlen(keyname); keyname[klen]='A' + kk; keyname[klen + 1] = '\0'; } for (jj=0; jj < 9; jj++) /* look for up to 9 dimensions */ { keyname[2] = '1' + jj; tstatus = 0; if (fits_read_key(fptr, TDOUBLE, keyname, &cdelt, NULL, &tstatus) == 0) { /* calculate the new CDi_j value */ if (fpixels[ii] <= lpixels[ii]) cdelt = cdelt * incs[ii]; else cdelt = cdelt * (-incs[ii]); /* modify the value in the output file */ fits_modify_key_dbl(newptr, keyname, cdelt, 15, NULL, status); } } } /* end of if (incs[ii]... loop */ } /* end of fits_read_key loop */ } /* end of for (kk loop */ } } /* end of main NAXIS loop */ if (ffrdef(newptr, status) > 0) /* force the header to be scanned */ { return(*status); } /* turn off any scaling of the pixel values */ fits_set_bscale(fptr, 1.0, 0.0, status); fits_set_bscale(newptr, 1.0, 0.0, status); /* to reduce memory foot print, just read/write image 1 row at a time */ outsize = outnaxes[0]; buffsize = (abs(bitpix) / 8) * outsize; buffer = (double *) malloc(buffsize); /* allocate memory for the image row */ if (!buffer) { ffpmsg("fits_copy_image_section: no memory for image section"); return(*status = MEMORY_ALLOCATION); } /* read the image section then write it to the output file */ minrow = fpixels[1]; maxrow = lpixels[1]; if (minrow > maxrow) { nrowiter = (minrow - maxrow + incs[1]) / incs[1]; } else { nrowiter = (maxrow - minrow + incs[1]) / incs[1]; } minslice = fpixels[2]; maxslice = lpixels[2]; if (minslice > maxslice) { nsliceiter = (minslice - maxslice + incs[2]) / incs[2]; } else { nsliceiter = (maxslice - minslice + incs[2]) / incs[2]; } mincube = fpixels[3]; maxcube = lpixels[3]; if (mincube > maxcube) { ncubeiter = (mincube - maxcube + incs[3]) / incs[3]; } else { ncubeiter = (maxcube - mincube + incs[3]) / incs[3]; } firstpix = 1; for (kiter = 0; kiter < ncubeiter; kiter++) { if (mincube > maxcube) { fpixels[3] = mincube - (kiter * incs[3]); } else { fpixels[3] = mincube + (kiter * incs[3]); } lpixels[3] = fpixels[3]; for (jiter = 0; jiter < nsliceiter; jiter++) { if (minslice > maxslice) { fpixels[2] = minslice - (jiter * incs[2]); } else { fpixels[2] = minslice + (jiter * incs[2]); } lpixels[2] = fpixels[2]; for (iiter = 0; iiter < nrowiter; iiter++) { if (minrow > maxrow) { fpixels[1] = minrow - (iiter * incs[1]); } else { fpixels[1] = minrow + (iiter * incs[1]); } lpixels[1] = fpixels[1]; if (bitpix == 8) { ffgsvb(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0, (unsigned char *) buffer, &anynull, status); ffpprb(newptr, 1, firstpix, outsize, (unsigned char *) buffer, status); } else if (bitpix == 16) { ffgsvi(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0, (short *) buffer, &anynull, status); ffppri(newptr, 1, firstpix, outsize, (short *) buffer, status); } else if (bitpix == 32) { ffgsvk(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0, (int *) buffer, &anynull, status); ffpprk(newptr, 1, firstpix, outsize, (int *) buffer, status); } else if (bitpix == -32) { ffgsve(fptr, 1, naxis, naxes, fpixels, lpixels, incs, FLOATNULLVALUE, (float *) buffer, &anynull, status); ffppne(newptr, 1, firstpix, outsize, (float *) buffer, FLOATNULLVALUE, status); } else if (bitpix == -64) { ffgsvd(fptr, 1, naxis, naxes, fpixels, lpixels, incs, DOUBLENULLVALUE, buffer, &anynull, status); ffppnd(newptr, 1, firstpix, outsize, buffer, DOUBLENULLVALUE, status); } else if (bitpix == 64) { ffgsvjj(fptr, 1, naxis, naxes, fpixels, lpixels, incs, 0, (LONGLONG *) buffer, &anynull, status); ffpprjj(newptr, 1, firstpix, outsize, (LONGLONG *) buffer, status); } firstpix += outsize; } } } free(buffer); /* finished with the memory */ if (*status > 0) { ffpmsg("fits_copy_image_section: error copying image section"); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_section_range(char **ptr, long *secmin, long *secmax, long *incre, int *status) /* Parse the input image section specification string, returning the min, max and increment values. Typical string = "1:512:2" or "1:512" */ { int slen, isanumber; char token[FLEN_VALUE]; if (*status > 0) return(*status); slen = fits_get_token(ptr, " ,:", token, &isanumber); /* get 1st token */ /* support [:2,:2] type syntax, where the leading * is implied */ if (slen==0) strcpy(token,"*"); if (*token == '*') /* wild card means to use the whole range */ { *secmin = 1; *secmax = 0; } else if (*token == '-' && *(token+1) == '*' ) /* invert the whole range */ { *secmin = 0; *secmax = 1; } else { if (slen == 0 || !isanumber || **ptr != ':') return(*status = URL_PARSE_ERROR); /* the token contains the min value */ *secmin = atol(token); (*ptr)++; /* skip the colon between the min and max values */ slen = fits_get_token(ptr, " ,:", token, &isanumber); /* get token */ if (slen == 0 || !isanumber) return(*status = URL_PARSE_ERROR); /* the token contains the max value */ *secmax = atol(token); } if (**ptr == ':') { (*ptr)++; /* skip the colon between the max and incre values */ slen = fits_get_token(ptr, " ,", token, &isanumber); /* get token */ if (slen == 0 || !isanumber) return(*status = URL_PARSE_ERROR); *incre = atol(token); } else *incre = 1; /* default increment if none is supplied */ if (**ptr == ',') (*ptr)++; while (**ptr == ' ') /* skip any trailing blanks */ (*ptr)++; if (*secmin < 0 || *secmax < 0 || *incre < 1) *status = URL_PARSE_ERROR; return(*status); } /*--------------------------------------------------------------------------*/ int ffselect_table( fitsfile **fptr, /* IO - pointer to input table; on output it */ /* points to the new selected rows table */ char *outfile, /* I - name for output file */ char *expr, /* I - Boolean expression */ int *status) { fitsfile *newptr; int ii, hdunum; if (*outfile) { /* create new empty file in to hold the selected rows */ if (ffinit(&newptr, outfile, status) > 0) { ffpmsg( "failed to create file for selected rows from input table"); ffpmsg(outfile); return(*status); } fits_get_hdu_num(*fptr, &hdunum); /* current HDU number in input file */ /* copy all preceding extensions to the output file, if the 'only_one' flag is not set */ if (!((*fptr)->Fptr)->only_one) { for (ii = 1; ii < hdunum; ii++) { fits_movabs_hdu(*fptr, ii, NULL, status); if (fits_copy_hdu(*fptr, newptr, 0, status) > 0) { ffclos(newptr, status); return(*status); } } } else { /* just copy the primary array */ fits_movabs_hdu(*fptr, 1, NULL, status); if (fits_copy_hdu(*fptr, newptr, 0, status) > 0) { ffclos(newptr, status); return(*status); } } fits_movabs_hdu(*fptr, hdunum, NULL, status); /* copy all the header keywords from the input to output file */ if (fits_copy_header(*fptr, newptr, status) > 0) { ffclos(newptr, status); return(*status); } /* set number of rows = 0 */ fits_modify_key_lng(newptr, "NAXIS2", 0, NULL,status); (newptr->Fptr)->numrows = 0; (newptr->Fptr)->origrows = 0; if (ffrdef(newptr, status) > 0) /* force the header to be scanned */ { ffclos(newptr, status); return(*status); } } else newptr = *fptr; /* will delete rows in place in the table */ /* copy rows which satisfy the selection expression to the output table */ /* or delete the nonqualifying rows if *fptr = newptr. */ if (fits_select_rows(*fptr, newptr, expr, status) > 0) { if (*outfile) ffclos(newptr, status); return(*status); } if (*outfile) { /* copy any remaining HDUs to the output copy */ if (!((*fptr)->Fptr)->only_one) { for (ii = hdunum + 1; 1; ii++) { if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0) break; fits_copy_hdu(*fptr, newptr, 0, status); } if (*status == END_OF_FILE) *status = 0; /* got the expected EOF error; reset = 0 */ else if (*status > 0) { ffclos(newptr, status); return(*status); } } else { hdunum = 2; } /* close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = newptr; /* reset the pointer to the new table */ /* move back to the selected table HDU */ fits_movabs_hdu(*fptr, hdunum, NULL, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffparsecompspec(fitsfile *fptr, /* I - FITS file pointer */ char *compspec, /* I - image compression specification */ int *status) /* IO - error status */ /* Parse the image compression specification that was give in square brackets following the output FITS file name, as in these examples: myfile.fits[compress] - default Rice compression, row by row myfile.fits[compress TYPE] - the first letter of TYPE defines the compression algorithm: R = Rice G = GZIP H = HCOMPRESS HS = HCOMPRESS (with smoothing) B - BZIP2 P = PLIO myfile.fits[compress TYPE 100,100] - the numbers give the dimensions of the compression tiles. Default is NAXIS1, 1, 1, ... other optional parameters may be specified following a semi-colon myfile.fits[compress; q 8.0] q specifies the floating point mufile.fits[compress TYPE; q -.0002] quantization level; myfile.fits[compress TYPE 100,100; q 10, s 25] s specifies the HCOMPRESS integer scaling parameter The compression parameters are saved in the fptr->Fptr structure for use when writing FITS images. */ { char *ptr1; /* initialize with default values */ int ii, compresstype = RICE_1, smooth = 0; int quantize_method = SUBTRACTIVE_DITHER_1; long tilesize[MAX_COMPRESS_DIM] = {0,0,0,0,0,0}; float qlevel = -99., scale = 0.; ptr1 = compspec; while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; if (strncmp(ptr1, "compress", 8) && strncmp(ptr1, "COMPRESS", 8) ) { /* apparently this string does not specify compression parameters */ return(*status = URL_PARSE_ERROR); } ptr1 += 8; while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; /* ========================= */ /* look for compression type */ /* ========================= */ if (*ptr1 == 'r' || *ptr1 == 'R') { compresstype = RICE_1; while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\0') ptr1++; } else if (*ptr1 == 'g' || *ptr1 == 'G') { compresstype = GZIP_1; while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\0') ptr1++; } /* else if (*ptr1 == 'b' || *ptr1 == 'B') { compresstype = BZIP2_1; while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\0') ptr1++; } */ else if (*ptr1 == 'p' || *ptr1 == 'P') { compresstype = PLIO_1; while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\0') ptr1++; } else if (*ptr1 == 'h' || *ptr1 == 'H') { compresstype = HCOMPRESS_1; ptr1++; if (*ptr1 == 's' || *ptr1 == 'S') smooth = 1; /* apply smoothing when uncompressing HCOMPRESSed image */ while (*ptr1 != ' ' && *ptr1 != ';' && *ptr1 != '\0') ptr1++; } /* ======================== */ /* look for tile dimensions */ /* ======================== */ while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; ii = 0; while (isdigit( (int) *ptr1) && ii < 9) { tilesize[ii] = atol(ptr1); /* read the integer value */ ii++; while (isdigit((int) *ptr1)) /* skip over the integer */ ptr1++; if (*ptr1 == ',') ptr1++; /* skip over the comma */ while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; } /* ========================================================= */ /* look for semi-colon, followed by other optional parameters */ /* ========================================================= */ if (*ptr1 == ';') { ptr1++; while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; while (*ptr1 != 0) { /* haven't reached end of string yet */ if (*ptr1 == 's' || *ptr1 == 'S') { /* this should be the HCOMPRESS "scale" parameter; default = 1 */ ptr1++; while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; scale = (float) strtod(ptr1, &ptr1); while (*ptr1 == ' ' || *ptr1 == ',') /* skip over blanks or comma */ ptr1++; } else if (*ptr1 == 'q' || *ptr1 == 'Q') { /* this should be the floating point quantization parameter */ ptr1++; if (*ptr1 == 'z' || *ptr1 == 'Z') { /* use the subtractive_dither_2 option */ quantize_method = SUBTRACTIVE_DITHER_2; ptr1++; } else if (*ptr1 == '0') { /* do not dither */ quantize_method = NO_DITHER; ptr1++; } while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; qlevel = (float) strtod(ptr1, &ptr1); while (*ptr1 == ' ' || *ptr1 == ',') /* skip over blanks or comma */ ptr1++; } else { return(*status = URL_PARSE_ERROR); } } } /* ================================= */ /* finished parsing; save the values */ /* ================================= */ fits_set_compression_type(fptr, compresstype, status); fits_set_tile_dim(fptr, MAX_COMPRESS_DIM, tilesize, status); if (compresstype == HCOMPRESS_1) { fits_set_hcomp_scale (fptr, scale, status); fits_set_hcomp_smooth(fptr, smooth, status); } if (qlevel != -99.) { fits_set_quantize_level(fptr, qlevel, status); fits_set_quantize_method(fptr, quantize_method, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffdkinit(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - name of file to create */ int *status) /* IO - error status */ /* Create and initialize a new FITS file on disk. This routine differs from ffinit in that the input 'name' is literally taken as the name of the disk file to be created, and it does not support CFITSIO's extended filename syntax. */ { if (*status > 0) return(*status); *status = CREATE_DISK_FILE; ffinit(fptr, name,status); return(*status); } /*--------------------------------------------------------------------------*/ int ffinit(fitsfile **fptr, /* O - FITS file pointer */ const char *name, /* I - name of file to create */ int *status) /* IO - error status */ /* Create and initialize a new FITS file. */ { int ii, driver, slen, clobber = 0; char *url; char urltype[MAX_PREFIX_LEN], outfile[FLEN_FILENAME]; char tmplfile[FLEN_FILENAME], compspec[80]; int handle, create_disk_file = 0; if (*status > 0) return(*status); if (*status == CREATE_DISK_FILE) { create_disk_file = 1; *status = 0; } *fptr = 0; /* initialize null file pointer */ if (need_to_initialize) { /* this is called only once */ *status = fits_init_cfitsio(); } if (*status > 0) return(*status); url = (char *) name; while (*url == ' ') /* ignore leading spaces in the filename */ url++; if (*url == '\0') { ffpmsg("Name of file to create is blank. (ffinit)"); return(*status = FILE_NOT_CREATED); } if (create_disk_file) { if (strlen(url) > FLEN_FILENAME - 1) { ffpmsg("Filename is too long. (ffinit)"); return(*status = FILE_NOT_CREATED); } strcpy(outfile, url); strcpy(urltype, "file://"); tmplfile[0] = '\0'; compspec[0] = '\0'; } else { /* check for clobber symbol, i.e, overwrite existing file */ if (*url == '!') { clobber = TRUE; url++; } else clobber = FALSE; /* parse the output file specification */ /* this routine checks that the strings will not overflow */ ffourl(url, urltype, outfile, tmplfile, compspec, status); if (*status > 0) { ffpmsg("could not parse the output filename: (ffinit)"); ffpmsg(url); return(*status); } } /* find which driver corresponds to the urltype */ *status = urltype2driver(urltype, &driver); if (*status) { ffpmsg("could not find driver for this file: (ffinit)"); ffpmsg(url); return(*status); } /* delete pre-existing file, if asked to do so */ if (clobber) { if (driverTable[driver].remove) (*driverTable[driver].remove)(outfile); } /* call appropriate driver to create the file */ if (driverTable[driver].create) { FFLOCK; /* lock this while searching for vacant handle */ *status = (*driverTable[driver].create)(outfile, &handle); FFUNLOCK; if (*status) { ffpmsg("failed to create new file (already exists?):"); ffpmsg(url); return(*status); } } else { ffpmsg("cannot create a new file of this type: (ffinit)"); ffpmsg(url); return(*status = FILE_NOT_CREATED); } /* allocate fitsfile structure and initialize = 0 */ *fptr = (fitsfile *) calloc(1, sizeof(fitsfile)); if (!(*fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffopen)"); ffpmsg(url); return(*status = MEMORY_ALLOCATION); } /* allocate FITSfile structure and initialize = 0 */ (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile)); if (!((*fptr)->Fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for following file: (ffopen)"); ffpmsg(url); free(*fptr); *fptr = 0; return(*status = MEMORY_ALLOCATION); } slen = strlen(url) + 1; slen = maxvalue(slen, 32); /* reserve at least 32 chars */ ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */ if ( !(((*fptr)->Fptr)->filename) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for filename: (ffinit)"); ffpmsg(url); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = FILE_NOT_CREATED); } /* mem for headstart array */ ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); if ( !(((*fptr)->Fptr)->headstart) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for headstart array: (ffinit)"); ffpmsg(url); free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for file I/O buffers */ ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN); if ( !(((*fptr)->Fptr)->iobuffer) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for iobuffer array: (ffinit)"); ffpmsg(url); free( ((*fptr)->Fptr)->headstart); /* free memory for headstart array */ free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* initialize the ageindex array (relative age of the I/O buffers) */ /* and initialize the bufrecnum array as being empty */ for (ii = 0; ii < NIOBUF; ii++) { ((*fptr)->Fptr)->ageindex[ii] = ii; ((*fptr)->Fptr)->bufrecnum[ii] = -1; } /* store the parameters describing the file */ ((*fptr)->Fptr)->MAXHDU = 1000; /* initial size of headstart */ ((*fptr)->Fptr)->filehandle = handle; /* store the file pointer */ ((*fptr)->Fptr)->driver = driver; /* driver number */ strcpy(((*fptr)->Fptr)->filename, url); /* full input filename */ ((*fptr)->Fptr)->filesize = 0; /* physical file size */ ((*fptr)->Fptr)->logfilesize = 0; /* logical file size */ ((*fptr)->Fptr)->writemode = 1; /* read-write mode */ ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */ ((*fptr)->Fptr)->curbuf = -1; /* undefined current IO buffer */ ((*fptr)->Fptr)->open_count = 1; /* structure is currently used once */ ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */ ffldrc(*fptr, 0, IGNORE_EOF, status); /* initialize first record */ fits_store_Fptr( (*fptr)->Fptr, status); /* store Fptr address */ /* if template file was given, use it to define structure of new file */ if (tmplfile[0]) ffoptplt(*fptr, tmplfile, status); /* parse and save image compression specification, if given */ if (compspec[0]) ffparsecompspec(*fptr, compspec, status); return(*status); /* successful return */ } /*--------------------------------------------------------------------------*/ /* ffimem == fits_create_memfile */ int ffimem(fitsfile **fptr, /* O - FITS file pointer */ void **buffptr, /* I - address of memory pointer */ size_t *buffsize, /* I - size of buffer, in bytes */ size_t deltasize, /* I - increment for future realloc's */ void *(*mem_realloc)(void *p, size_t newsize), /* function */ int *status) /* IO - error status */ /* Create and initialize a new FITS file in memory */ { int ii, driver, slen; char urltype[MAX_PREFIX_LEN]; int handle; if (*status > 0) return(*status); *fptr = 0; /* initialize null file pointer */ if (need_to_initialize) { /* this is called only once */ *status = fits_init_cfitsio(); } if (*status > 0) return(*status); strcpy(urltype, "memkeep://"); /* URL type for pre-existing memory file */ *status = urltype2driver(urltype, &driver); if (*status > 0) { ffpmsg("could not find driver for pre-existing memory file: (ffimem)"); return(*status); } /* call driver routine to "open" the memory file */ FFLOCK; /* lock this while searching for vacant handle */ *status = mem_openmem( buffptr, buffsize, deltasize, mem_realloc, &handle); FFUNLOCK; if (*status > 0) { ffpmsg("failed to open pre-existing memory file: (ffimem)"); return(*status); } /* allocate fitsfile structure and initialize = 0 */ *fptr = (fitsfile *) calloc(1, sizeof(fitsfile)); if (!(*fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for memory file: (ffimem)"); return(*status = MEMORY_ALLOCATION); } /* allocate FITSfile structure and initialize = 0 */ (*fptr)->Fptr = (FITSfile *) calloc(1, sizeof(FITSfile)); if (!((*fptr)->Fptr)) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate structure for memory file: (ffimem)"); free(*fptr); *fptr = 0; return(*status = MEMORY_ALLOCATION); } slen = 32; /* reserve at least 32 chars */ ((*fptr)->Fptr)->filename = (char *) malloc(slen); /* mem for file name */ if ( !(((*fptr)->Fptr)->filename) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for filename: (ffimem)"); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for headstart array */ ((*fptr)->Fptr)->headstart = (LONGLONG *) calloc(1001, sizeof(LONGLONG)); if ( !(((*fptr)->Fptr)->headstart) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for headstart array: (ffimem)"); free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* mem for file I/O buffers */ ((*fptr)->Fptr)->iobuffer = (char *) calloc(NIOBUF, IOBUFLEN); if ( !(((*fptr)->Fptr)->iobuffer) ) { (*driverTable[driver].close)(handle); /* close the file */ ffpmsg("failed to allocate memory for iobuffer array: (ffimem)"); free( ((*fptr)->Fptr)->headstart); /* free memory for headstart array */ free( ((*fptr)->Fptr)->filename); free((*fptr)->Fptr); free(*fptr); *fptr = 0; /* return null file pointer */ return(*status = MEMORY_ALLOCATION); } /* initialize the ageindex array (relative age of the I/O buffers) */ /* and initialize the bufrecnum array as being empty */ for (ii = 0; ii < NIOBUF; ii++) { ((*fptr)->Fptr)->ageindex[ii] = ii; ((*fptr)->Fptr)->bufrecnum[ii] = -1; } /* store the parameters describing the file */ ((*fptr)->Fptr)->MAXHDU = 1000; /* initial size of headstart */ ((*fptr)->Fptr)->filehandle = handle; /* file handle */ ((*fptr)->Fptr)->driver = driver; /* driver number */ strcpy(((*fptr)->Fptr)->filename, "memfile"); /* dummy filename */ ((*fptr)->Fptr)->filesize = *buffsize; /* physical file size */ ((*fptr)->Fptr)->logfilesize = *buffsize; /* logical file size */ ((*fptr)->Fptr)->writemode = 1; /* read-write mode */ ((*fptr)->Fptr)->datastart = DATA_UNDEFINED; /* unknown start of data */ ((*fptr)->Fptr)->curbuf = -1; /* undefined current IO buffer */ ((*fptr)->Fptr)->open_count = 1; /* structure is currently used once */ ((*fptr)->Fptr)->validcode = VALIDSTRUC; /* flag denoting valid structure */ ffldrc(*fptr, 0, IGNORE_EOF, status); /* initialize first record */ fits_store_Fptr( (*fptr)->Fptr, status); /* store Fptr address */ return(*status); } /*--------------------------------------------------------------------------*/ int fits_init_cfitsio(void) /* initialize anything that is required before using the CFITSIO routines */ { int status; union u_tag { short ival; char cval[2]; } u; fitsio_init_lock(); FFLOCK; /* lockout other threads while executing this critical */ /* section of code */ if (need_to_initialize == 0) { /* already initialized? */ FFUNLOCK; return(0); } /* test for correct byteswapping. */ u.ival = 1; if ((BYTESWAPPED && u.cval[0] != 1) || (BYTESWAPPED == FALSE && u.cval[1] != 1) ) { printf ("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); printf(" Byteswapping is not being done correctly on this system.\n"); printf(" Check the MACHINE and BYTESWAPPED definitions in fitsio2.h\n"); printf(" Please report this problem to the CFITSIO developers.\n"); printf( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); FFUNLOCK; return(1); } /* test that LONGLONG is an 8 byte integer */ if (sizeof(LONGLONG) != 8) { printf ("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); printf(" CFITSIO did not find an 8-byte long integer data type.\n"); printf(" sizeof(LONGLONG) = %d\n",(int)sizeof(LONGLONG)); printf(" Please report this problem to the CFITSIO developers.\n"); printf( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); FFUNLOCK; return(1); } /* register the standard I/O drivers that are always available */ /* 1--------------------disk file driver-----------------------*/ status = fits_register_driver("file://", file_init, file_shutdown, file_setoptions, file_getoptions, file_getversion, file_checkfile, file_open, file_create, #ifdef HAVE_FTRUNCATE file_truncate, #else NULL, /* no file truncate function */ #endif file_close, file_remove, file_size, file_flush, file_seek, file_read, file_write); if (status) { ffpmsg("failed to register the file:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 2------------ output temporary memory file driver ----------------*/ status = fits_register_driver("mem://", mem_init, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ NULL, /* open function not allowed */ mem_create, mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the mem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 3--------------input pre-existing memory file driver----------------*/ status = fits_register_driver("memkeep://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ NULL, /* file open driver function is not used */ NULL, /* create function not allowed */ mem_truncate, mem_close_keep, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the memkeep:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 4-------------------stdin stream driver----------------------*/ /* the stdin stream is copied to memory then opened in memory */ status = fits_register_driver("stdin://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, stdin_checkfile, stdin_open, NULL, /* create function not allowed */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the stdin:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 5-------------------stdin file stream driver----------------------*/ /* the stdin stream is copied to a disk file then the disk file is opened */ status = fits_register_driver("stdinfile://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ stdin_open, NULL, /* create function not allowed */ #ifdef HAVE_FTRUNCATE file_truncate, #else NULL, /* no file truncate function */ #endif file_close, file_remove, file_size, file_flush, file_seek, file_read, file_write); if (status) { ffpmsg("failed to register the stdinfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 6-----------------------stdout stream driver------------------*/ status = fits_register_driver("stdout://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ NULL, /* open function not required */ mem_create, mem_truncate, stdout_close, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the stdout:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 7------------------iraf disk file to memory driver -----------*/ status = fits_register_driver("irafmem://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ mem_iraf_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the irafmem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 8------------------raw binary file to memory driver -----------*/ status = fits_register_driver("rawfile://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ mem_rawfile_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the rawfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 9------------------compressed disk file to memory driver -----------*/ status = fits_register_driver("compress://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ mem_compress_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the compress:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 10------------------compressed disk file to memory driver -----------*/ /* Identical to compress://, except it allows READWRITE access */ status = fits_register_driver("compressmem://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ mem_compress_openrw, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the compressmem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 11------------------compressed disk file to disk file driver -------*/ status = fits_register_driver("compressfile://", NULL, file_shutdown, file_setoptions, file_getoptions, file_getversion, NULL, /* checkfile not needed */ file_compress_open, file_create, #ifdef HAVE_FTRUNCATE file_truncate, #else NULL, /* no file truncate function */ #endif file_close, file_remove, file_size, file_flush, file_seek, file_read, file_write); if (status) { ffpmsg("failed to register the compressfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 12---create file in memory, then compress it to disk file on close--*/ status = fits_register_driver("compressoutfile://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ NULL, /* open function not allowed */ mem_create_comp, mem_truncate, mem_close_comp, file_remove, /* delete existing compressed disk file */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg( "failed to register the compressoutfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* Register Optional drivers */ #ifdef HAVE_NET_SERVICES /* 13--------------------root driver-----------------------*/ status = fits_register_driver("root://", root_init, root_shutdown, root_setoptions, root_getoptions, root_getversion, NULL, /* checkfile not needed */ root_open, root_create, NULL, /* No truncate possible */ root_close, NULL, /* No remove possible */ root_size, /* no size possible */ root_flush, root_seek, /* Though will always succeed */ root_read, root_write); if (status) { ffpmsg("failed to register the root:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 14--------------------http driver-----------------------*/ status = fits_register_driver("http://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, http_checkfile, http_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the http:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 15--------------------http file driver-----------------------*/ status = fits_register_driver("httpfile://", NULL, file_shutdown, file_setoptions, file_getoptions, file_getversion, NULL, /* checkfile not needed */ http_file_open, file_create, #ifdef HAVE_FTRUNCATE file_truncate, #else NULL, /* no file truncate function */ #endif file_close, file_remove, file_size, file_flush, file_seek, file_read, file_write); if (status) { ffpmsg("failed to register the httpfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 16--------------------http memory driver-----------------------*/ /* same as http:// driver, except memory file can be opened READWRITE */ status = fits_register_driver("httpmem://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, http_checkfile, http_file_open, /* this will simply call http_open */ NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the httpmem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 17--------------------httpcompress file driver-----------------------*/ status = fits_register_driver("httpcompress://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ http_compress_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the httpcompress:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 18--------------------ftp driver-----------------------*/ status = fits_register_driver("ftp://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, ftp_checkfile, ftp_open, NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the ftp:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 19--------------------ftp file driver-----------------------*/ status = fits_register_driver("ftpfile://", NULL, file_shutdown, file_setoptions, file_getoptions, file_getversion, NULL, /* checkfile not needed */ ftp_file_open, file_create, #ifdef HAVE_FTRUNCATE file_truncate, #else NULL, /* no file truncate function */ #endif file_close, file_remove, file_size, file_flush, file_seek, file_read, file_write); if (status) { ffpmsg("failed to register the ftpfile:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 20--------------------ftp mem driver-----------------------*/ /* same as ftp:// driver, except memory file can be opened READWRITE */ status = fits_register_driver("ftpmem://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, ftp_checkfile, ftp_file_open, /* this will simply call ftp_open */ NULL, /* create function not required */ mem_truncate, mem_close_free, NULL, /* remove function not required */ mem_size, NULL, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the ftpmem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* 21--------------------ftp compressed file driver------------------*/ status = fits_register_driver("ftpcompress://", NULL, mem_shutdown, mem_setoptions, mem_getoptions, mem_getversion, NULL, /* checkfile not needed */ ftp_compress_open, 0, /* create function not required */ mem_truncate, mem_close_free, 0, /* remove function not required */ mem_size, 0, /* flush function not required */ mem_seek, mem_read, mem_write); if (status) { ffpmsg("failed to register the ftpcompress:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* === End of net drivers section === */ #endif /* ==================== SHARED MEMORY DRIVER SECTION ======================= */ #ifdef HAVE_SHMEM_SERVICES /* 22--------------------shared memory driver-----------------------*/ status = fits_register_driver("shmem://", smem_init, smem_shutdown, smem_setoptions, smem_getoptions, smem_getversion, NULL, /* checkfile not needed */ smem_open, smem_create, NULL, /* truncate file not supported yet */ smem_close, smem_remove, smem_size, smem_flush, smem_seek, smem_read, smem_write ); if (status) { ffpmsg("failed to register the shmem:// driver (init_cfitsio)"); FFUNLOCK; return(status); } #endif /* ==================== END OF SHARED MEMORY DRIVER SECTION ================ */ #ifdef HAVE_GSIFTP /* 23--------------------gsiftp driver-----------------------*/ status = fits_register_driver("gsiftp://", gsiftp_init, gsiftp_shutdown, gsiftp_setoptions, gsiftp_getoptions, gsiftp_getversion, gsiftp_checkfile, gsiftp_open, gsiftp_create, #ifdef HAVE_FTRUNCATE gsiftp_truncate, #else NULL, #endif gsiftp_close, NULL, /* remove function not yet implemented */ gsiftp_size, gsiftp_flush, gsiftp_seek, gsiftp_read, gsiftp_write); if (status) { ffpmsg("failed to register the gsiftp:// driver (init_cfitsio)"); FFUNLOCK; return(status); } #endif /* 24---------------stdin and stdout stream driver-------------------*/ status = fits_register_driver("stream://", NULL, NULL, NULL, NULL, NULL, NULL, stream_open, stream_create, NULL, /* no stream truncate function */ stream_close, NULL, /* no stream remove */ stream_size, stream_flush, stream_seek, stream_read, stream_write); if (status) { ffpmsg("failed to register the stream:// driver (init_cfitsio)"); FFUNLOCK; return(status); } /* reset flag. Any other threads will now not need to call this routine */ need_to_initialize = 0; FFUNLOCK; return(status); } /*--------------------------------------------------------------------------*/ int fits_register_driver(char *prefix, int (*init)(void), int (*shutdown)(void), int (*setoptions)(int option), int (*getoptions)(int *options), int (*getversion)(int *version), int (*checkfile) (char *urltype, char *infile, char *outfile), int (*open)(char *filename, int rwmode, int *driverhandle), int (*create)(char *filename, int *driverhandle), int (*truncate)(int driverhandle, LONGLONG filesize), int (*close)(int driverhandle), int (*fremove)(char *filename), int (*size)(int driverhandle, LONGLONG *size), int (*flush)(int driverhandle), int (*seek)(int driverhandle, LONGLONG offset), int (*read) (int driverhandle, void *buffer, long nbytes), int (*write)(int driverhandle, void *buffer, long nbytes) ) /* register all the functions needed to support an I/O driver */ { int status; if (no_of_drivers < 0 ) { /* This is bad. looks like memory has been corrupted. */ ffpmsg("Vital CFITSIO parameters held in memory have been corrupted!!"); ffpmsg("Fatal condition detected in fits_register_driver."); return(TOO_MANY_DRIVERS); } if (no_of_drivers + 1 > MAX_DRIVERS) return(TOO_MANY_DRIVERS); if (prefix == NULL) return(BAD_URL_PREFIX); if (init != NULL) { status = (*init)(); /* initialize the driver */ if (status) return(status); } /* fill in data in table */ strncpy(driverTable[no_of_drivers].prefix, prefix, MAX_PREFIX_LEN); driverTable[no_of_drivers].prefix[MAX_PREFIX_LEN - 1] = 0; driverTable[no_of_drivers].init = init; driverTable[no_of_drivers].shutdown = shutdown; driverTable[no_of_drivers].setoptions = setoptions; driverTable[no_of_drivers].getoptions = getoptions; driverTable[no_of_drivers].getversion = getversion; driverTable[no_of_drivers].checkfile = checkfile; driverTable[no_of_drivers].open = open; driverTable[no_of_drivers].create = create; driverTable[no_of_drivers].truncate = truncate; driverTable[no_of_drivers].close = close; driverTable[no_of_drivers].remove = fremove; driverTable[no_of_drivers].size = size; driverTable[no_of_drivers].flush = flush; driverTable[no_of_drivers].seek = seek; driverTable[no_of_drivers].read = read; driverTable[no_of_drivers].write = write; no_of_drivers++; /* increment the number of drivers */ return(0); } /*--------------------------------------------------------------------------*/ /* fits_parse_input_url */ int ffiurl(char *url, /* input filename */ char *urltype, /* e.g., 'file://', 'http://', 'mem://' */ char *infilex, /* root filename (may be complete path) */ char *outfile, /* optional output file name */ char *extspec, /* extension spec: +n or [extname, extver] */ char *rowfilterx, /* boolean row filter expression */ char *binspec, /* histogram binning specifier */ char *colspec, /* column or keyword modifier expression */ int *status) /* parse the input URL into its basic components. This routine does not support the pixfilter or compspec components. */ { return ffifile2(url, urltype, infilex, outfile, extspec, rowfilterx, binspec, colspec, 0, 0, status); } /*--------------------------------------------------------------------------*/ /* fits_parse_input_file */ int ffifile(char *url, /* input filename */ char *urltype, /* e.g., 'file://', 'http://', 'mem://' */ char *infilex, /* root filename (may be complete path) */ char *outfile, /* optional output file name */ char *extspec, /* extension spec: +n or [extname, extver] */ char *rowfilterx, /* boolean row filter expression */ char *binspec, /* histogram binning specifier */ char *colspec, /* column or keyword modifier expression */ char *pixfilter, /* pixel filter expression */ int *status) /* fits_parse_input_filename parse the input URL into its basic components. This routine does not support the compspec component. */ { return ffifile2(url, urltype, infilex, outfile, extspec, rowfilterx, binspec, colspec, pixfilter, 0, status); } /*--------------------------------------------------------------------------*/ int ffifile2(char *url, /* input filename */ char *urltype, /* e.g., 'file://', 'http://', 'mem://' */ char *infilex, /* root filename (may be complete path) */ char *outfile, /* optional output file name */ char *extspec, /* extension spec: +n or [extname, extver] */ char *rowfilterx, /* boolean row filter expression */ char *binspec, /* histogram binning specifier */ char *colspec, /* column or keyword modifier expression */ char *pixfilter, /* pixel filter expression */ char *compspec, /* image compression specification */ int *status) /* fits_parse_input_filename parse the input URL into its basic components. This routine is big and ugly and should be redesigned someday! */ { int ii, jj, slen, infilelen, plus_ext = 0, collen; char *ptr1, *ptr2, *ptr3, *ptr4, *tmptr; int hasAt, hasDot, hasOper, followingOper, spaceTerm, rowFilter; int colStart, binStart, pixStart, compStart; /* must have temporary variable for these, in case inputs are NULL */ char *infile; char *rowfilter; char *tmpstr; if (*status > 0) return(*status); /* Initialize null strings */ if (infilex) *infilex = '\0'; if (urltype) *urltype = '\0'; if (outfile) *outfile = '\0'; if (extspec) *extspec = '\0'; if (binspec) *binspec = '\0'; if (colspec) *colspec = '\0'; if (rowfilterx) *rowfilterx = '\0'; if (pixfilter) *pixfilter = '\0'; if (compspec) *compspec = '\0'; slen = strlen(url); if (slen == 0) /* blank filename ?? */ return(*status); /* allocate memory for 3 strings, each as long as the input url */ infile = (char *) calloc(3, slen + 1); if (!infile) return(*status = MEMORY_ALLOCATION); rowfilter = &infile[slen + 1]; tmpstr = &rowfilter[slen + 1]; ptr1 = url; /* -------------------------------------------------------- */ /* get urltype (e.g., file://, ftp://, http://, etc.) */ /* --------------------------------------------------------- */ if (*ptr1 == '-' && ( *(ptr1 +1) == 0 || *(ptr1 +1) == ' ' || *(ptr1 +1) == '[' || *(ptr1 +1) == '(' ) ) { /* "-" means read file from stdin. Also support "- ", */ /* "-[extname]" and '-(outfile.fits)" but exclude disk file */ /* names that begin with a minus sign, e.g., "-55d33m.fits" */ if (urltype) strcat(urltype, "stdin://"); ptr1++; } else if (!strncasecmp(ptr1, "stdin", 5)) { if (urltype) strcat(urltype, "stdin://"); ptr1 = ptr1 + 5; } else { ptr2 = strstr(ptr1, "://"); ptr3 = strstr(ptr1, "(" ); if (ptr3 && (ptr3 < ptr2) ) { /* the urltype follows a '(' character, so it must apply */ /* to the output file, and is not the urltype of the input file */ ptr2 = 0; /* so reset pointer to zero */ } if (ptr2) /* copy the explicit urltype string */ { if (urltype) strncat(urltype, ptr1, ptr2 - ptr1 + 3); ptr1 = ptr2 + 3; } else if (!strncmp(ptr1, "ftp:", 4) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "ftp://"); ptr1 += 4; } else if (!strncmp(ptr1, "gsiftp:", 7) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "gsiftp://"); ptr1 += 7; } else if (!strncmp(ptr1, "http:", 5) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "http://"); ptr1 += 5; } else if (!strncmp(ptr1, "mem:", 4) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "mem://"); ptr1 += 4; } else if (!strncmp(ptr1, "shmem:", 6) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "shmem://"); ptr1 += 6; } else if (!strncmp(ptr1, "file:", 5) ) { /* the 2 //'s are optional */ if (urltype) strcat(urltype, "file://"); ptr1 += 5; } else /* assume file driver */ { if (urltype) strcat(urltype, "file://"); } } /* ---------------------------------------------------------- If this is a http:// type file, then the cgi file name could include the '[' character, which should not be interpreted as part of CFITSIO's Extended File Name Syntax. Test for this case by seeing if the last character is a ']' or ')'. If it is not, then just treat the whole input string as the file name and do not attempt to interprete the name using the extended filename syntax. ----------------------------------------------------------- */ if (urltype && !strncmp(urltype, "http://", 7) ) { /* test for opening parenthesis or bracket in the file name */ if( strchr(ptr1, '(' ) || strchr(ptr1, '[' ) ) { slen = strlen(ptr1); ptr3 = ptr1 + slen - 1; while (*ptr3 == ' ') /* ignore trailing blanks */ ptr3--; if (*ptr3 != ']' && *ptr3 != ')' ) { /* name doesn't end with a ']' or ')' so don't try */ /* to parse this unusual string (may be cgi string) */ if (infilex) { if (strlen(ptr1) > FLEN_FILENAME - 1) { ffpmsg("Name of file is too long."); return(*status = URL_PARSE_ERROR); } strcpy(infilex, ptr1); } free(infile); return(*status); } } } /* ---------------------------------------------------------- Look for VMS style filenames like: disk:[directory.subdirectory]filename.ext, or [directory.subdirectory]filename.ext Check if the first character is a '[' and urltype != stdin or if there is a ':[' string in the remaining url string. If so, then need to move past this bracket character before search for the opening bracket of a filter specification. ----------------------------------------------------------- */ tmptr = ptr1; if (*ptr1 == '[') { if (*url != '-') tmptr = ptr1 + 1; /* this bracket encloses a VMS directory name */ } else { tmptr = strstr(ptr1, ":["); if (tmptr) /* these 2 chars are part of the VMS disk and directory */ tmptr += 2; else tmptr = ptr1; } /* ------------------------ */ /* get the input file name */ /* ------------------------ */ ptr2 = strchr(tmptr, '('); /* search for opening parenthesis ( */ ptr3 = strchr(tmptr, '['); /* search for opening bracket [ */ if (ptr2 == ptr3) /* simple case: no [ or ( in the file name */ { strcat(infile, ptr1); } else if (!ptr3 || /* no bracket, so () enclose output file name */ (ptr2 && (ptr2 < ptr3)) ) /* () enclose output name before bracket */ { strncat(infile, ptr1, ptr2 - ptr1); ptr2++; ptr1 = strchr(ptr2, ')' ); /* search for closing ) */ if (!ptr1) { free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ) */ } if (outfile) { if (ptr1 - ptr2 > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strncat(outfile, ptr2, ptr1 - ptr2); } /* the opening [ could have been part of output name, */ /* e.g., file(out[compress])[3][#row > 5] */ /* so search again for opening bracket following the closing ) */ ptr3 = strchr(ptr1, '['); } else /* bracket comes first, so there is no output name */ { strncat(infile, ptr1, ptr3 - ptr1); } /* strip off any trailing blanks in the names */ slen = strlen(infile); while ( (--slen) > 0 && infile[slen] == ' ') infile[slen] = '\0'; if (outfile) { slen = strlen(outfile); while ( (--slen) > 0 && outfile[slen] == ' ') outfile[slen] = '\0'; } /* --------------------------------------------- */ /* check if this is an IRAF file (.imh extension */ /* --------------------------------------------- */ ptr4 = strstr(infile, ".imh"); /* did the infile name end with ".imh" ? */ if (ptr4 && (*(ptr4 + 4) == '\0')) { if (urltype) strcpy(urltype, "irafmem://"); } /* --------------------------------------------- */ /* check if the 'filename+n' convention has been */ /* used to specifiy which HDU number to open */ /* --------------------------------------------- */ jj = strlen(infile); for (ii = jj - 1; ii >= 0; ii--) { if (infile[ii] == '+') /* search backwards for '+' sign */ break; } if (ii > 0 && (jj - ii) < 7) /* limit extension numbers to 5 digits */ { infilelen = ii; ii++; ptr1 = infile+ii; /* pointer to start of sequence */ for (; ii < jj; ii++) { if (!isdigit((int) infile[ii] ) ) /* are all the chars digits? */ break; } if (ii == jj) { /* yes, the '+n' convention was used. Copy */ /* the digits to the output extspec string. */ plus_ext = 1; if (extspec) { if (jj - infilelen > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strncpy(extspec, ptr1, jj - infilelen); } infile[infilelen] = '\0'; /* delete the extension number */ } } /* -------------------------------------------------------------------- */ /* if '*' was given for the output name expand it to the root file name */ /* -------------------------------------------------------------------- */ if (outfile && outfile[0] == '*') { /* scan input name backwards to the first '/' character */ for (ii = jj - 1; ii >= 0; ii--) { if (infile[ii] == '/' || ii == 0) { if (strlen(&infile[ii + 1]) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcpy(outfile, &infile[ii + 1]); break; } } } /* ------------------------------------------ */ /* copy strings from local copy to the output */ /* ------------------------------------------ */ if (infilex) { if (strlen(infile) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcpy(infilex, infile); } /* ---------------------------------------------------------- */ /* if no '[' character in the input string, then we are done. */ /* ---------------------------------------------------------- */ if (!ptr3) { free(infile); return(*status); } /* ------------------------------------------- */ /* see if [ extension specification ] is given */ /* ------------------------------------------- */ if (!plus_ext) /* extension no. not already specified? Then */ /* first brackets must enclose extension name or # */ /* or it encloses a image subsection specification */ /* or a raw binary image specifier */ /* or a image compression specifier */ /* Or, the extension specification may have been */ /* omitted and we have to guess what the user intended */ { ptr1 = ptr3 + 1; /* pointer to first char after the [ */ ptr2 = strchr(ptr1, ']' ); /* search for closing ] */ if (!ptr2) { ffpmsg("input file URL is missing closing bracket ']'"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } /* ---------------------------------------------- */ /* First, test if this is a rawfile specifier */ /* which looks something like: '[ib512,512:2880]' */ /* Test if first character is b,i,j,d,r,f, or u, */ /* and optional second character is b or l, */ /* followed by one or more digits, */ /* finally followed by a ',', ':', or ']' */ /* ---------------------------------------------- */ if (*ptr1 == 'b' || *ptr1 == 'B' || *ptr1 == 'i' || *ptr1 == 'I' || *ptr1 == 'j' || *ptr1 == 'J' || *ptr1 == 'd' || *ptr1 == 'D' || *ptr1 == 'r' || *ptr1 == 'R' || *ptr1 == 'f' || *ptr1 == 'F' || *ptr1 == 'u' || *ptr1 == 'U') { /* next optional character may be a b or l (for Big or Little) */ ptr1++; if (*ptr1 == 'b' || *ptr1 == 'B' || *ptr1 == 'l' || *ptr1 == 'L') ptr1++; if (isdigit((int) *ptr1)) /* must have at least 1 digit */ { while (isdigit((int) *ptr1)) ptr1++; /* skip over digits */ if (*ptr1 == ',' || *ptr1 == ':' || *ptr1 == ']' ) { /* OK, this looks like a rawfile specifier */ if (urltype) { if (strstr(urltype, "stdin") ) strcpy(urltype, "rawstdin://"); else strcpy(urltype, "rawfile://"); } /* append the raw array specifier to infilex */ if (infilex) { if (strlen(infilex) + strlen(ptr3) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcat(infilex, ptr3); ptr1 = strchr(infilex, ']'); /* find the closing ] char */ if (ptr1) *(ptr1 + 1) = '\0'; /* terminate string after the ] */ } if (extspec) strcpy(extspec, "0"); /* the 0 ext number is implicit */ tmptr = strchr(ptr2 + 1, '[' ); /* search for another [ char */ /* copy any remaining characters into rowfilterx */ if (tmptr && rowfilterx) { if (strlen(rowfilterx) + strlen(tmptr + 1) > FLEN_FILENAME -1) { free(infile); return(*status = URL_PARSE_ERROR); } strcat(rowfilterx, tmptr + 1); tmptr = strchr(rowfilterx, ']' ); /* search for closing ] */ if (tmptr) *tmptr = '\0'; /* overwrite the ] with null terminator */ } free(infile); /* finished parsing, so return */ return(*status); } } } /* end of rawfile specifier test */ /* -------------------------------------------------------- */ /* Not a rawfile, so next, test if this is an image section */ /* i.e., an integer followed by a ':' or a '*' or '-*' */ /* -------------------------------------------------------- */ ptr1 = ptr3 + 1; /* reset pointer to first char after the [ */ tmptr = ptr1; while (*tmptr == ' ') tmptr++; /* skip leading blanks */ while (isdigit((int) *tmptr)) tmptr++; /* skip over leading digits */ if (*tmptr == ':' || *tmptr == '*' || *tmptr == '-') { /* this is an image section specifier */ strcat(rowfilter, ptr3); /* don't want to assume 0 extension any more; may imply an image extension. if (extspec) strcpy(extspec, "0"); */ } else { /* ----------------------------------------------------------------- Not an image section or rawfile spec so may be an extension spec. Examples of valid extension specifiers: [3] - 3rd extension; 0 = primary array [events] - events extension [events, 2] - events extension, with EXTVER = 2 [events,2] - spaces are optional [events, 3, b] - same as above, plus XTENSION = 'BINTABLE' [PICS; colName(12)] - an image in row 12 of the colName column in the PICS table extension [PICS; colName(exposure > 1000)] - as above, but find image in first row with with exposure column value > 1000. [Rate Table] - extension name can contain spaces! [Rate Table;colName(exposure>1000)] Examples of other types of specifiers (Not extension specifiers) [bin] !!! this is ambiguous, and can't be distinguished from a valid extension specifier [bini X=1:512:16] (also binb, binj, binr, and bind are allowed) [binr (X,Y) = 5] [bin @binfilter.txt] [col Time;rate] [col PI=PHA * 1.1] [col -Time; status] [X > 5] [X>5] [@filter.txt] [StatusCol] !!! this is ambiguous, and can't be distinguished from a valid extension specifier [StatusCol==0] [StatusCol || x>6] [gtifilter()] [regfilter("region.reg")] [compress Rice] There will always be some ambiguity between an extension name and a boolean row filtering expression, (as in a couple of the above examples). If there is any doubt, the expression should be treated as an extension specification; The user can always add an explicit expression specifier to override this interpretation. The following decision logic will be used: 1) locate the first token, terminated with a space, comma, semi-colon, or closing bracket. 2) the token is not part of an extension specifier if any of the following is true: - if the token begins with '@' and contains a '.' - if the token contains an operator: = > < || && - if the token begins with "gtifilter(" or "regfilter(" - if the token is terminated by a space and is followed by additional characters (not a ']') AND any of the following: - the token is 'col' - the token is 3 or 4 chars long and begins with 'bin' - the second token begins with an operator: ! = < > | & + - * / % 3) otherwise, the string is assumed to be an extension specifier ----------------------------------------------------------------- */ tmptr = ptr1; while(*tmptr == ' ') tmptr++; hasAt = 0; hasDot = 0; hasOper = 0; followingOper = 0; spaceTerm = 0; rowFilter = 0; colStart = 0; binStart = 0; pixStart = 0; compStart = 0; if (*tmptr == '@') /* test for leading @ symbol */ hasAt = 1; if ( !strncasecmp(tmptr, "col ", 4) ) colStart = 1; if ( !strncasecmp(tmptr, "bin", 3) ) binStart = 1; if ( !strncasecmp(tmptr, "pix", 3) ) pixStart = 1; if ( !strncasecmp(tmptr, "compress ", 9) || !strncasecmp(tmptr, "compress]", 9) ) compStart = 1; if ( !strncasecmp(tmptr, "gtifilter(", 10) || !strncasecmp(tmptr, "regfilter(", 10) ) { rowFilter = 1; } else { /* parse the first token of the expression */ for (ii = 0; ii < ptr2 - ptr1 + 1; ii++, tmptr++) { if (*tmptr == '.') hasDot = 1; else if (*tmptr == '=' || *tmptr == '>' || *tmptr == '<' || (*tmptr == '|' && *(tmptr+1) == '|') || (*tmptr == '&' && *(tmptr+1) == '&') ) hasOper = 1; else if (*tmptr == ',' || *tmptr == ';' || *tmptr == ']') { break; } else if (*tmptr == ' ') /* a space char? */ { while(*tmptr == ' ') /* skip spaces */ tmptr++; if (*tmptr == ']') /* is this the end? */ break; spaceTerm = 1; /* 1st token is terminated by space */ /* test if this is a column or binning specifier */ if (colStart || (ii <= 4 && (binStart || pixStart)) ) rowFilter = 1; else { /* check if next character is an operator */ if (*tmptr == '=' || *tmptr == '>' || *tmptr == '<' || *tmptr == '|' || *tmptr == '&' || *tmptr == '!' || *tmptr == '+' || *tmptr == '-' || *tmptr == '*' || *tmptr == '/' || *tmptr == '%') followingOper = 1; } break; } } } /* test if this is NOT an extension specifier */ if ( rowFilter || (pixStart && spaceTerm) || (hasAt && hasDot) || hasOper || compStart || (spaceTerm && followingOper) ) { /* this is (probably) not an extension specifier */ /* so copy all chars to filter spec string */ strcat(rowfilter, ptr3); } else { /* this appears to be a legit extension specifier */ /* copy the extension specification */ if (extspec) { if (ptr2 - ptr1 > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strncat(extspec, ptr1, ptr2 - ptr1); } /* copy any remaining chars to filter spec string */ strcat(rowfilter, ptr2 + 1); } } } /* end of if (!plus_ext) */ else { /* ------------------------------------------------------------------ */ /* already have extension, so this must be a filter spec of some sort */ /* ------------------------------------------------------------------ */ strcat(rowfilter, ptr3); } /* strip off any trailing blanks from filter */ slen = strlen(rowfilter); while ( (--slen) >= 0 && rowfilter[slen] == ' ') rowfilter[slen] = '\0'; if (!rowfilter[0]) { free(infile); return(*status); /* nothing left to parse */ } /* ------------------------------------------------ */ /* does the filter contain a binning specification? */ /* ------------------------------------------------ */ ptr1 = strstr(rowfilter, "[bin"); /* search for "[bin" */ if (!ptr1) ptr1 = strstr(rowfilter, "[BIN"); /* search for "[BIN" */ if (!ptr1) ptr1 = strstr(rowfilter, "[Bin"); /* search for "[Bin" */ if (ptr1) { ptr2 = ptr1 + 4; /* end of the '[bin' string */ if (*ptr2 == 'b' || *ptr2 == 'i' || *ptr2 == 'j' || *ptr2 == 'r' || *ptr2 == 'd') ptr2++; /* skip the datatype code letter */ if ( *ptr2 != ' ' && *ptr2 != ']') ptr1 = NULL; /* bin string must be followed by space or ] */ } if (ptr1) { /* found the binning string */ if (binspec) { if (strlen(ptr1 +1) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcpy(binspec, ptr1 + 1); ptr2 = strchr(binspec, ']'); if (ptr2) /* terminate the binning filter */ { *ptr2 = '\0'; if ( *(--ptr2) == ' ') /* delete trailing spaces */ *ptr2 = '\0'; } else { ffpmsg("input file URL is missing closing bracket ']'"); ffpmsg(rowfilter); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } /* delete the binning spec from the row filter string */ ptr2 = strchr(ptr1, ']'); strcpy(tmpstr, ptr2+1); /* copy any chars after the binspec */ strcpy(ptr1, tmpstr); /* overwrite binspec */ } /* --------------------------------------------------------- */ /* does the filter contain a column selection specification? */ /* --------------------------------------------------------- */ ptr1 = strstr(rowfilter, "[col "); if (!ptr1) { ptr1 = strstr(rowfilter, "[COL "); if (!ptr1) ptr1 = strstr(rowfilter, "[Col "); } if (ptr1) { /* find the end of the column specifier */ ptr2 = ptr1 + 5; while (*ptr2 != ']') { if (*ptr2 == '\0') { ffpmsg("input file URL is missing closing bracket ']'"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } if (*ptr2 == '\'') /* start of a literal string */ { ptr2 = strchr(ptr2 + 1, '\''); /* find closing quote */ if (!ptr2) { ffpmsg ("literal string in input file URL is missing closing single quote"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } if (*ptr2 == '[') /* set of nested square brackets */ { ptr2 = strchr(ptr2 + 1, ']'); /* find closing bracket */ if (!ptr2) { ffpmsg ("nested brackets in input file URL is missing closing bracket"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } ptr2++; /* continue search for the closing bracket character */ } collen = ptr2 - ptr1 - 1; if (colspec) /* copy the column specifier to output string */ { if (collen > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strncpy(colspec, ptr1 + 1, collen); colspec[collen] = '\0'; while (colspec[--collen] == ' ') colspec[collen] = '\0'; /* strip trailing blanks */ } /* delete the column selection spec from the row filter string */ strcpy(tmpstr, ptr2 + 1); /* copy any chars after the colspec */ strcpy(ptr1, tmpstr); /* overwrite binspec */ } /* --------------------------------------------------------- */ /* does the filter contain a pixel filter specification? */ /* --------------------------------------------------------- */ ptr1 = strstr(rowfilter, "[pix"); if (!ptr1) { ptr1 = strstr(rowfilter, "[PIX"); if (!ptr1) ptr1 = strstr(rowfilter, "[Pix"); } if (ptr1) { ptr2 = ptr1 + 4; /* end of the '[pix' string */ if (*ptr2 == 'b' || *ptr2 == 'i' || *ptr2 == 'j' || *ptr2 == 'B' || *ptr2 == 'I' || *ptr2 == 'J' || *ptr2 == 'r' || *ptr2 == 'd' || *ptr2 == 'R' || *ptr2 == 'D') ptr2++; /* skip the datatype code letter */ if (*ptr2 == '1') ptr2++; /* skip the single HDU indicator */ if ( *ptr2 != ' ') ptr1 = NULL; /* pix string must be followed by space */ } if (ptr1) { /* find the end of the pixel filter */ while (*ptr2 != ']') { if (*ptr2 == '\0') { ffpmsg("input file URL is missing closing bracket ']'"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } if (*ptr2 == '\'') /* start of a literal string */ { ptr2 = strchr(ptr2 + 1, '\''); /* find closing quote */ if (!ptr2) { ffpmsg ("literal string in input file URL is missing closing single quote"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } if (*ptr2 == '[') /* set of nested square brackets */ { ptr2 = strchr(ptr2 + 1, ']'); /* find closing bracket */ if (!ptr2) { ffpmsg ("nested brackets in input file URL is missing closing bracket"); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } ptr2++; /* continue search for the closing bracket character */ } collen = ptr2 - ptr1 - 1; if (pixfilter) /* copy the column specifier to output string */ { if (collen > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strncpy(pixfilter, ptr1 + 1, collen); pixfilter[collen] = '\0'; while (pixfilter[--collen] == ' ') pixfilter[collen] = '\0'; /* strip trailing blanks */ } /* delete the pixel filter from the row filter string */ strcpy(tmpstr, ptr2 + 1); /* copy any chars after the pixel filter */ strcpy(ptr1, tmpstr); /* overwrite binspec */ } /* ------------------------------------------------------------ */ /* does the filter contain an image compression specification? */ /* ------------------------------------------------------------ */ ptr1 = strstr(rowfilter, "[compress"); if (ptr1) { ptr2 = ptr1 + 9; /* end of the '[compress' string */ if ( *ptr2 != ' ' && *ptr2 != ']') ptr1 = NULL; /* compress string must be followed by space or ] */ } if (ptr1) { /* found the compress string */ if (compspec) { if (strlen(ptr1 +1) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcpy(compspec, ptr1 + 1); ptr2 = strchr(compspec, ']'); if (ptr2) /* terminate the binning filter */ { *ptr2 = '\0'; if ( *(--ptr2) == ' ') /* delete trailing spaces */ *ptr2 = '\0'; } else { ffpmsg("input file URL is missing closing bracket ']'"); ffpmsg(rowfilter); free(infile); return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } } /* delete the compression spec from the row filter string */ ptr2 = strchr(ptr1, ']'); strcpy(tmpstr, ptr2+1); /* copy any chars after the binspec */ strcpy(ptr1, tmpstr); /* overwrite binspec */ } /* copy the remaining string to the rowfilter output... should only */ /* contain a rowfilter expression of the form "[expr]" */ if (rowfilterx && rowfilter[0]) { ptr2 = rowfilter + strlen(rowfilter) - 1; if( rowfilter[0]=='[' && *ptr2==']' ) { *ptr2 = '\0'; if (strlen(rowfilter + 1) > FLEN_FILENAME - 1) { free(infile); return(*status = URL_PARSE_ERROR); } strcpy(rowfilterx, rowfilter+1); } else { ffpmsg("input file URL lacks valid row filter expression"); *status = URL_PARSE_ERROR; } } free(infile); return(*status); } /*--------------------------------------------------------------------------*/ int ffexist(const char *infile, /* I - input filename or URL */ int *exists, /* O - 2 = a compressed version of file exists */ /* 1 = yes, disk file exists */ /* 0 = no, disk file could not be found */ /* -1 = infile is not a disk file (could */ /* be a http, ftp, gsiftp, smem, or stdin file) */ int *status) /* I/O status */ /* test if the input file specifier is an existing file on disk If the specified file can't be found, it then searches for a compressed version of the file. */ { FILE *diskfile; char rootname[FLEN_FILENAME]; char *ptr1; if (*status > 0) return(*status); /* strip off any extname or filters from the name */ ffrtnm( (char *)infile, rootname, status); ptr1 = strstr(rootname, "://"); if (ptr1 || *rootname == '-') { if (!strncmp(rootname, "file", 4) ) { ptr1 = ptr1 + 3; /* pointer to start of the disk file name */ } else { *exists = -1; /* this is not a disk file */ return (*status); } } else { ptr1 = rootname; } /* see if the disk file exists */ if (file_openfile(ptr1, 0, &diskfile)) { /* no, couldn't open file, so see if there is a compressed version */ if (file_is_compressed(ptr1) ) { *exists = 2; /* a compressed version of the file exists */ } else { *exists = 0; /* neither file nor compressed version exist */ } } else { /* yes, file exists */ *exists = 1; fclose(diskfile); } return(*status); } /*--------------------------------------------------------------------------*/ int ffrtnm(char *url, char *rootname, int *status) /* parse the input URL, returning the root name (filetype://basename). */ { int ii, jj, slen, infilelen; char *ptr1, *ptr2, *ptr3; char urltype[MAX_PREFIX_LEN]; char infile[FLEN_FILENAME]; if (*status > 0) return(*status); ptr1 = url; *rootname = '\0'; *urltype = '\0'; *infile = '\0'; /* get urltype (e.g., file://, ftp://, http://, etc.) */ if (*ptr1 == '-') /* "-" means read file from stdin */ { strcat(urltype, "-"); ptr1++; } else if (!strncmp(ptr1, "stdin", 5) || !strncmp(ptr1, "STDIN", 5)) { strcat(urltype, "-"); ptr1 = ptr1 + 5; } else { ptr2 = strstr(ptr1, "://"); ptr3 = strstr(ptr1, "(" ); if (ptr3 && (ptr3 < ptr2) ) { /* the urltype follows a '(' character, so it must apply */ /* to the output file, and is not the urltype of the input file */ ptr2 = 0; /* so reset pointer to zero */ } if (ptr2) /* copy the explicit urltype string */ { if (ptr2 - ptr1 + 3 > MAX_PREFIX_LEN - 1) { return(*status = URL_PARSE_ERROR); } strncat(urltype, ptr1, ptr2 - ptr1 + 3); ptr1 = ptr2 + 3; } else if (!strncmp(ptr1, "ftp:", 4) ) { /* the 2 //'s are optional */ strcat(urltype, "ftp://"); ptr1 += 4; } else if (!strncmp(ptr1, "gsiftp:", 7) ) { /* the 2 //'s are optional */ strcat(urltype, "gsiftp://"); ptr1 += 7; } else if (!strncmp(ptr1, "http:", 5) ) { /* the 2 //'s are optional */ strcat(urltype, "http://"); ptr1 += 5; } else if (!strncmp(ptr1, "mem:", 4) ) { /* the 2 //'s are optional */ strcat(urltype, "mem://"); ptr1 += 4; } else if (!strncmp(ptr1, "shmem:", 6) ) { /* the 2 //'s are optional */ strcat(urltype, "shmem://"); ptr1 += 6; } else if (!strncmp(ptr1, "file:", 5) ) { /* the 2 //'s are optional */ ptr1 += 5; } /* else assume file driver */ } /* get the input file name */ ptr2 = strchr(ptr1, '('); /* search for opening parenthesis ( */ ptr3 = strchr(ptr1, '['); /* search for opening bracket [ */ if (ptr2 == ptr3) /* simple case: no [ or ( in the file name */ { if (strlen(ptr1) > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strcat(infile, ptr1); } else if (!ptr3) /* no bracket, so () enclose output file name */ { if (ptr2 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(infile, ptr1, ptr2 - ptr1); ptr2++; ptr1 = strchr(ptr2, ')' ); /* search for closing ) */ if (!ptr1) return(*status = URL_PARSE_ERROR); /* error, no closing ) */ } else if (ptr2 && (ptr2 < ptr3)) /* () enclose output name before bracket */ { if (ptr2 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(infile, ptr1, ptr2 - ptr1); ptr2++; ptr1 = strchr(ptr2, ')' ); /* search for closing ) */ if (!ptr1) return(*status = URL_PARSE_ERROR); /* error, no closing ) */ } else /* bracket comes first, so there is no output name */ { if (ptr3 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(infile, ptr1, ptr3 - ptr1); } /* strip off any trailing blanks in the names */ slen = strlen(infile); for (ii = slen - 1; ii > 0; ii--) { if (infile[ii] == ' ') infile[ii] = '\0'; else break; } /* --------------------------------------------- */ /* check if the 'filename+n' convention has been */ /* used to specifiy which HDU number to open */ /* --------------------------------------------- */ jj = strlen(infile); for (ii = jj - 1; ii >= 0; ii--) { if (infile[ii] == '+') /* search backwards for '+' sign */ break; } if (ii > 0 && (jj - ii) < 5) /* limit extension numbers to 4 digits */ { infilelen = ii; ii++; for (; ii < jj; ii++) { if (!isdigit((int) infile[ii] ) ) /* are all the chars digits? */ break; } if (ii == jj) { /* yes, the '+n' convention was used. */ infile[infilelen] = '\0'; /* delete the extension number */ } } if (strlen(urltype) + strlen(infile) > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strcat(rootname, urltype); /* construct the root name */ strcat(rootname, infile); return(*status); } /*--------------------------------------------------------------------------*/ int ffourl(char *url, /* I - full input URL */ char *urltype, /* O - url type */ char *outfile, /* O - base file name */ char *tpltfile, /* O - template file name, if any */ char *compspec, /* O - compression specification, if any */ int *status) /* parse the output URL into its basic components. */ { char *ptr1, *ptr2, *ptr3; if (*status > 0) return(*status); if (urltype) *urltype = '\0'; if (outfile) *outfile = '\0'; if (tpltfile) *tpltfile = '\0'; if (compspec) *compspec = '\0'; ptr1 = url; while (*ptr1 == ' ') /* ignore leading blanks */ ptr1++; if ( ( (*ptr1 == '-') && ( *(ptr1 +1) == 0 || *(ptr1 +1) == ' ' ) ) || !strcmp(ptr1, "stdout") || !strcmp(ptr1, "STDOUT")) /* "-" means write to stdout; also support "- " */ /* but exclude disk file names that begin with a minus sign */ /* e.g., "-55d33m.fits" */ { if (urltype) strcpy(urltype, "stdout://"); } else { /* not writing to stdout */ /* get urltype (e.g., file://, ftp://, http://, etc.) */ ptr2 = strstr(ptr1, "://"); if (ptr2) /* copy the explicit urltype string */ { if (urltype) { if (ptr2 - ptr1 + 3 > MAX_PREFIX_LEN - 1) { return(*status = URL_PARSE_ERROR); } strncat(urltype, ptr1, ptr2 - ptr1 + 3); } ptr1 = ptr2 + 3; } else /* assume file driver */ { if (urltype) strcat(urltype, "file://"); } /* look for template file name, enclosed in parenthesis */ ptr2 = strchr(ptr1, '('); /* look for image compression parameters, enclosed in sq. brackets */ ptr3 = strchr(ptr1, '['); if (outfile) { if (ptr2) { /* template file was specified */ if (ptr2 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(outfile, ptr1, ptr2 - ptr1); } else if (ptr3) { /* compression was specified */ if (ptr3 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(outfile, ptr1, ptr3 - ptr1); } else { /* no template file or compression */ if (strlen(ptr1) > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strcpy(outfile, ptr1); } } if (ptr2) /* template file was specified */ { ptr2++; ptr1 = strchr(ptr2, ')' ); /* search for closing ) */ if (!ptr1) { return(*status = URL_PARSE_ERROR); /* error, no closing ) */ } if (tpltfile) { if (ptr1 - ptr2 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(tpltfile, ptr2, ptr1 - ptr2); } } if (ptr3) /* compression was specified */ { ptr3++; ptr1 = strchr(ptr3, ']' ); /* search for closing ] */ if (!ptr1) { return(*status = URL_PARSE_ERROR); /* error, no closing ] */ } if (compspec) { if (ptr1 - ptr3 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(compspec, ptr3, ptr1 - ptr3); } } /* check if a .gz compressed output file is to be created */ /* by seeing if the filename ends in '.gz' */ if (urltype && outfile) { if (!strcmp(urltype, "file://") ) { ptr1 = strstr(outfile, ".gz"); if (ptr1) { /* make sure the ".gz" is at the end of the file name */ ptr1 += 3; if (*ptr1 == 0 || *ptr1 == ' ' ) strcpy(urltype, "compressoutfile://"); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffexts(char *extspec, int *extnum, char *extname, int *extvers, int *hdutype, char *imagecolname, char *rowexpress, int *status) { /* Parse the input extension specification string, returning either the extension number or the values of the EXTNAME, EXTVERS, and XTENSION keywords in desired extension. Also return the name of the column containing an image, and an expression to be used to determine which row to use, if present. */ char *ptr1, *ptr2; int slen, nvals; int notint = 1; /* initially assume specified extname is not an integer */ char tmpname[FLEN_VALUE], *loc; *extnum = 0; *extname = '\0'; *extvers = 0; *hdutype = ANY_HDU; *imagecolname = '\0'; *rowexpress = '\0'; if (*status > 0) return(*status); ptr1 = extspec; /* pointer to first char */ while (*ptr1 == ' ') /* skip over any leading blanks */ ptr1++; if (isdigit((int) *ptr1)) /* is the extension specification a number? */ { notint = 0; /* looks like extname may actually be the ext. number */ errno = 0; /* reset this prior to calling strtol */ *extnum = strtol(ptr1, &loc, 10); /* read the string as an integer */ while (*loc == ' ') /* skip over trailing blanks */ loc++; /* check for read error, or junk following the integer */ if ((*loc != '\0' && *loc != ';' ) || (errno == ERANGE) ) { *extnum = 0; notint = 1; /* no, extname was not a simple integer after all */ errno = 0; /* reset error condition flag if it was set */ } if ( *extnum < 0 || *extnum > 99999) { *extnum = 0; /* this is not a reasonable extension number */ ffpmsg("specified extension number is out of range:"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } } /* This logic was too simple, and failed on extnames like '1000TEMP' where it would try to move to the 1000th extension if (isdigit((int) *ptr1)) { sscanf(ptr1, "%d", extnum); if (*extnum < 0 || *extnum > 9999) { *extnum = 0; ffpmsg("specified extension number is out of range:"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } } */ if (notint) { /* not a number, so EXTNAME must be specified, followed by */ /* optional EXTVERS and XTENSION values */ /* don't use space char as end indicator, because there */ /* may be imbedded spaces in the EXTNAME value */ slen = strcspn(ptr1, ",:;"); /* length of EXTNAME */ if (slen > FLEN_VALUE - 1) { return(*status = URL_PARSE_ERROR); } strncat(extname, ptr1, slen); /* EXTNAME value */ /* now remove any trailing blanks */ while (slen > 0 && *(extname + slen -1) == ' ') { *(extname + slen -1) = '\0'; slen--; } ptr1 += slen; slen = strspn(ptr1, " ,:"); /* skip delimiter characters */ ptr1 += slen; slen = strcspn(ptr1, " ,:;"); /* length of EXTVERS */ if (slen) { nvals = sscanf(ptr1, "%d", extvers); /* EXTVERS value */ if (nvals != 1) { ffpmsg("illegal EXTVER value in input URL:"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } ptr1 += slen; slen = strspn(ptr1, " ,:"); /* skip delimiter characters */ ptr1 += slen; slen = strcspn(ptr1, ";"); /* length of HDUTYPE */ if (slen) { if (*ptr1 == 'b' || *ptr1 == 'B') *hdutype = BINARY_TBL; else if (*ptr1 == 't' || *ptr1 == 'T' || *ptr1 == 'a' || *ptr1 == 'A') *hdutype = ASCII_TBL; else if (*ptr1 == 'i' || *ptr1 == 'I') *hdutype = IMAGE_HDU; else { ffpmsg("unknown type of HDU in input URL:"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } } } else { strcpy(tmpname, extname); ffupch(tmpname); if (!strcmp(tmpname, "PRIMARY") || !strcmp(tmpname, "P") ) *extname = '\0'; /* return extnum = 0 */ } } ptr1 = strchr(ptr1, ';'); if (ptr1) { /* an image is to be opened; the image is contained in a single */ /* cell of a binary table. A column name and an expression to */ /* determine which row to use has been entered. */ ptr1++; /* skip over the ';' delimiter */ while (*ptr1 == ' ') /* skip over any leading blanks */ ptr1++; ptr2 = strchr(ptr1, '('); if (!ptr2) { ffpmsg("illegal specification of image in table cell in input URL:"); ffpmsg(" did not find a row expression enclosed in ( )"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } if (ptr2 - ptr1 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(imagecolname, ptr1, ptr2 - ptr1); /* copy column name */ ptr2++; /* skip over the '(' delimiter */ while (*ptr2 == ' ') /* skip over any leading blanks */ ptr2++; ptr1 = strchr(ptr2, ')'); if (!ptr2) { ffpmsg("illegal specification of image in table cell in input URL:"); ffpmsg(" missing closing ')' character in row expression"); ffpmsg(extspec); return(*status = URL_PARSE_ERROR); } if (ptr1 - ptr2 > FLEN_FILENAME - 1) { return(*status = URL_PARSE_ERROR); } strncat(rowexpress, ptr2, ptr1 - ptr2); /* row expression */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffextn(char *url, /* I - input filename/URL */ int *extension_num, /* O - returned extension number */ int *status) { /* Parse the input url string and return the number of the extension that CFITSIO would automatically move to if CFITSIO were to open this input URL. The extension numbers are one's based, so 1 = the primary array, 2 = the first extension, etc. The extension number that gets returned is determined by the following algorithm: 1. If the input URL includes a binning specification (e.g. 'myfile.fits[3][bin X,Y]') then the returned extension number will always = 1, since CFITSIO would create a temporary primary image on the fly in this case. The same is true if an image within a single cell of a binary table is opened. 2. Else if the input URL specifies an extension number (e.g., 'myfile.fits[3]' or 'myfile.fits+3') then the specified extension number (+ 1) is returned. 3. Else if the extension name is specified in brackets (e.g., this 'myfile.fits[EVENTS]') then the file will be opened and searched for the extension number. If the input URL is '-' (reading from the stdin file stream) this is not possible and an error will be returned. 4. Else if the URL does not specify an extension (e.g. 'myfile.fits') then a special extension number = -99 will be returned to signal that no extension was specified. This feature is mainly for compatibility with existing FTOOLS software. CFITSIO would open the primary array by default (extension_num = 1) in this case. */ fitsfile *fptr; char urltype[20]; char infile[FLEN_FILENAME]; char outfile[FLEN_FILENAME]; char extspec[FLEN_FILENAME]; char extname[FLEN_FILENAME]; char rowfilter[FLEN_FILENAME]; char binspec[FLEN_FILENAME]; char colspec[FLEN_FILENAME]; char imagecolname[FLEN_VALUE], rowexpress[FLEN_FILENAME]; char *cptr; int extnum, extvers, hdutype, tstatus = 0; if (*status > 0) return(*status); /* parse the input URL into its basic components */ fits_parse_input_url(url, urltype, infile, outfile, extspec, rowfilter,binspec, colspec, status); if (*status > 0) return(*status); if (*binspec) /* is there a binning specification? */ { *extension_num = 1; /* a temporary primary array image is created */ return(*status); } if (*extspec) /* is an extension specified? */ { ffexts(extspec, &extnum, extname, &extvers, &hdutype, imagecolname, rowexpress, status); if (*status > 0) return(*status); if (*imagecolname) /* is an image within a table cell being opened? */ { *extension_num = 1; /* a temporary primary array image is created */ return(*status); } if (*extname) { /* have to open the file to search for the extension name (curses!) */ if (!strcmp(urltype, "stdin://")) /* opening stdin would destroying it! */ return(*status = URL_PARSE_ERROR); /* First, strip off any filtering specification */ infile[0] = '\0'; strncat(infile, url, FLEN_FILENAME -1); cptr = strchr(infile, ']'); /* locate the closing bracket */ if (!cptr) { return(*status = URL_PARSE_ERROR); } else { cptr++; *cptr = '\0'; /* terminate URl after the extension spec */ } if (ffopen(&fptr, infile, READONLY, status) > 0) /* open the file */ { ffclos(fptr, &tstatus); return(*status); } ffghdn(fptr, &extnum); /* where am I in the file? */ *extension_num = extnum; ffclos(fptr, status); return(*status); } else { *extension_num = extnum + 1; /* return the specified number (+ 1) */ return(*status); } } else { *extension_num = -99; /* no specific extension was specified */ /* defaults to primary array */ return(*status); } } /*--------------------------------------------------------------------------*/ int ffurlt(fitsfile *fptr, char *urlType, int *status) /* return the prefix string associated with the driver in use by the fitsfile pointer fptr */ { strcpy(urlType, driverTable[fptr->Fptr->driver].prefix); return(*status); } /*--------------------------------------------------------------------------*/ int ffimport_file( char *filename, /* Text file to read */ char **contents, /* Pointer to pointer to hold file */ int *status ) /* CFITSIO error code */ /* Read and concatenate all the lines from the given text file. User must free the pointer returned in contents. Pointer is guaranteed to hold 2 characters more than the length of the text... allows the calling routine to append (or prepend) a newline (or quotes?) without reallocating memory. */ { int allocLen, totalLen, llen, eoline = 1; char *lines,line[256]; FILE *aFile; if( *status > 0 ) return( *status ); totalLen = 0; allocLen = 1024; lines = (char *)malloc( allocLen * sizeof(char) ); if( !lines ) { ffpmsg("Couldn't allocate memory to hold ASCII file contents."); return(*status = MEMORY_ALLOCATION ); } lines[0] = '\0'; if( (aFile = fopen( filename, "r" ))==NULL ) { sprintf(line,"Could not open ASCII file %s.",filename); ffpmsg(line); free( lines ); return(*status = FILE_NOT_OPENED); } while( fgets(line,256,aFile)!=NULL ) { llen = strlen(line); if ( eoline && (llen > 1) && (line[0] == '/' && line[1] == '/')) continue; /* skip comment lines begging with // */ eoline = 0; /* replace CR and newline chars at end of line with nulls */ if ((llen > 0) && (line[llen-1]=='\n' || line[llen-1] == '\r')) { line[--llen] = '\0'; eoline = 1; /* found an end of line character */ if ((llen > 0) && (line[llen-1]=='\n' || line[llen-1] == '\r')) { line[--llen] = '\0'; } } if( totalLen + llen + 3 >= allocLen ) { allocLen += 256; lines = (char *)realloc(lines, allocLen * sizeof(char) ); if( ! lines ) { ffpmsg("Couldn't allocate memory to hold ASCII file contents."); *status = MEMORY_ALLOCATION; break; } } strcpy( lines+totalLen, line ); totalLen += llen; if (eoline) { strcpy( lines+totalLen, " "); /* add a space between lines */ totalLen += 1; } } fclose(aFile); *contents = lines; return( *status ); } /*--------------------------------------------------------------------------*/ int fits_get_token(char **ptr, char *delimiter, char *token, int *isanumber) /* O - is this token a number? */ /* parse off the next token, delimited by a character in 'delimiter', from the input ptr string; increment *ptr to the end of the token. Returns the length of the token, not including the delimiter char; */ { char *loc, tval[73]; int slen; double dval; *token = '\0'; while (**ptr == ' ') /* skip over leading blanks */ (*ptr)++; slen = strcspn(*ptr, delimiter); /* length of next token */ if (slen) { strncat(token, *ptr, slen); /* copy token */ (*ptr) += slen; /* skip over the token */ if (isanumber) /* check if token is a number */ { *isanumber = 1; if (strchr(token, 'D')) { strncpy(tval, token, 72); tval[72] = '\0'; /* The C language does not support a 'D'; replace with 'E' */ if (loc = strchr(tval, 'D')) *loc = 'E'; dval = strtod(tval, &loc); } else { dval = strtod(token, &loc); } /* check for read error, or junk following the value */ if (*loc != '\0' && *loc != ' ' ) *isanumber = 0; if (errno == ERANGE) *isanumber = 0; } } return(slen); } /*--------------------------------------------------------------------------*/ int fits_get_token2(char **ptr, char *delimiter, char **token, int *isanumber, /* O - is this token a number? */ int *status) /* parse off the next token, delimited by a character in 'delimiter', from the input ptr string; increment *ptr to the end of the token. Returns the length of the token, not including the delimiter char; This routine allocates the *token string; the calling routine must free it */ { char *loc, tval[73]; int slen; double dval; if (*status) return(0); while (**ptr == ' ') /* skip over leading blanks */ (*ptr)++; slen = strcspn(*ptr, delimiter); /* length of next token */ if (slen) { *token = (char *) calloc(slen + 1, 1); if (!(*token)) { ffpmsg("Couldn't allocate memory to hold token string (fits_get_token2)."); *status = MEMORY_ALLOCATION ; return(0); } strncat(*token, *ptr, slen); /* copy token */ (*ptr) += slen; /* skip over the token */ if (isanumber) /* check if token is a number */ { *isanumber = 1; if (strchr(*token, 'D')) { strncpy(tval, *token, 72); tval[72] = '\0'; /* The C language does not support a 'D'; replace with 'E' */ if (loc = strchr(tval, 'D')) *loc = 'E'; dval = strtod(tval, &loc); } else { dval = strtod(*token, &loc); } /* check for read error, or junk following the value */ if (*loc != '\0' && *loc != ' ' ) *isanumber = 0; if (errno == ERANGE) *isanumber = 0; } } return(slen); } /*---------------------------------------------------------------------------*/ char *fits_split_names( char *list) /* I - input list of names */ { /* A sequence of calls to fits_split_names will split the input string into name tokens. The string typically contains a list of file or column names. The names must be delimited by a comma and/or spaces. This routine ignores spaces and commas that occur within parentheses, brackets, or curly brackets. It also strips any leading and trailing blanks from the returned name. This routine is similar to the ANSI C 'strtok' function: The first call to fits_split_names has a non-null input string. It finds the first name in the string and terminates it by overwriting the next character of the string with a '\0' and returns a pointer to the name. Each subsequent call, indicated by a NULL value of the input string, returns the next name, searching from just past the end of the previous name. It returns NULL when no further names are found. The following line illustrates how a string would be split into 3 names: myfile[1][bin (x,y)=4], file2.fits file3.fits ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^ 1st name 2nd name 3rd name NOTE: This routine is not thread-safe. This routine is simply provided as a utility routine for other external software. It is not used by any CFITSIO routine. */ int depth = 0; char *start; static char *ptr; if (list) /* reset ptr if a string is given */ ptr = list; while (*ptr == ' ')ptr++; /* skip leading white space */ if (*ptr == '\0')return(0); /* no remaining file names */ start = ptr; while (*ptr != '\0') { if ((*ptr == '[') || (*ptr == '(') || (*ptr == '{')) depth ++; else if ((*ptr == '}') || (*ptr == ')') || (*ptr == ']')) depth --; else if ((depth == 0) && (*ptr == ',' || *ptr == ' ')) { *ptr = '\0'; /* terminate the filename here */ ptr++; /* save pointer to start of next filename */ break; } ptr++; } return(start); } /*--------------------------------------------------------------------------*/ int urltype2driver(char *urltype, int *driver) /* compare input URL with list of known drivers, returning the matching driver numberL. */ { int ii; /* find matching driver; search most recent drivers first */ for (ii=no_of_drivers - 1; ii >= 0; ii--) { if (0 == strcmp(driverTable[ii].prefix, urltype)) { *driver = ii; return(0); } } return(NO_MATCHING_DRIVER); } /*--------------------------------------------------------------------------*/ int ffclos(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* close the FITS file by completing the current HDU, flushing it to disk, then calling the system dependent routine to physically close the FITS file */ { int tstatus = NO_CLOSE_ERROR, zerostatus = 0; if (!fptr) return(*status = NULL_INPUT_PTR); else if ((fptr->Fptr)->validcode != VALIDSTRUC) /* check for magic value */ return(*status = BAD_FILEPTR); /* close and flush the current HDU */ if (*status > 0) ffchdu(fptr, &tstatus); /* turn off the error message from ffchdu */ else ffchdu(fptr, status); ((fptr->Fptr)->open_count)--; /* decrement usage counter */ if ((fptr->Fptr)->open_count == 0) /* if no other files use structure */ { ffflsh(fptr, TRUE, status); /* flush and disassociate IO buffers */ /* call driver function to actually close the file */ if ((*driverTable[(fptr->Fptr)->driver].close)((fptr->Fptr)->filehandle)) { if (*status <= 0) { *status = FILE_NOT_CLOSED; /* report if no previous error */ ffpmsg("failed to close the following file: (ffclos)"); ffpmsg((fptr->Fptr)->filename); } } fits_clear_Fptr( fptr->Fptr, status); /* clear Fptr address */ free((fptr->Fptr)->iobuffer); /* free memory for I/O buffers */ free((fptr->Fptr)->headstart); /* free memory for headstart array */ free((fptr->Fptr)->filename); /* free memory for the filename */ (fptr->Fptr)->filename = 0; (fptr->Fptr)->validcode = 0; /* magic value to indicate invalid fptr */ free(fptr->Fptr); /* free memory for the FITS file structure */ free(fptr); /* free memory for the FITS file structure */ } else { /* to minimize the fallout from any previous error (e.g., trying to open a non-existent extension in a already opened file), always call ffflsh with status = 0. */ /* just flush the buffers, don't disassociate them */ if (*status > 0) ffflsh(fptr, FALSE, &zerostatus); else ffflsh(fptr, FALSE, status); free(fptr); /* free memory for the FITS file structure */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffdelt(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* close and DELETE the FITS file. */ { char *basename; int slen, tstatus = 0; if (!fptr) return(*status = NULL_INPUT_PTR); else if ((fptr->Fptr)->validcode != VALIDSTRUC) /* check for magic value */ return(*status = BAD_FILEPTR); ffchdu(fptr, status); /* close the current HDU, ignore any errors */ ffflsh(fptr, TRUE, status); /* flush and disassociate IO buffers */ /* call driver function to actually close the file */ if ( (*driverTable[(fptr->Fptr)->driver].close)((fptr->Fptr)->filehandle) ) { if (*status <= 0) { *status = FILE_NOT_CLOSED; /* report error if no previous error */ ffpmsg("failed to close the following file: (ffdelt)"); ffpmsg((fptr->Fptr)->filename); } } /* call driver function to actually delete the file */ if ( (driverTable[(fptr->Fptr)->driver].remove) ) { /* parse the input URL to get the base filename */ slen = strlen((fptr->Fptr)->filename); basename = (char *) malloc(slen +1); if (!basename) return(*status = MEMORY_ALLOCATION); fits_parse_input_url((fptr->Fptr)->filename, NULL, basename, NULL, NULL, NULL, NULL, NULL, &tstatus); if ((*driverTable[(fptr->Fptr)->driver].remove)(basename)) { ffpmsg("failed to delete the following file: (ffdelt)"); ffpmsg((fptr->Fptr)->filename); if (!(*status)) *status = FILE_NOT_CLOSED; } free(basename); } fits_clear_Fptr( fptr->Fptr, status); /* clear Fptr address */ free((fptr->Fptr)->iobuffer); /* free memory for I/O buffers */ free((fptr->Fptr)->headstart); /* free memory for headstart array */ free((fptr->Fptr)->filename); /* free memory for the filename */ (fptr->Fptr)->filename = 0; (fptr->Fptr)->validcode = 0; /* magic value to indicate invalid fptr */ free(fptr->Fptr); /* free memory for the FITS file structure */ free(fptr); /* free memory for the FITS file structure */ return(*status); } /*--------------------------------------------------------------------------*/ int fftrun( fitsfile *fptr, /* I - FITS file pointer */ LONGLONG filesize, /* I - size to truncate the file */ int *status) /* O - error status */ /* low level routine to truncate a file to a new smaller size. */ { if (driverTable[(fptr->Fptr)->driver].truncate) { ffflsh(fptr, FALSE, status); /* flush all the buffers first */ (fptr->Fptr)->filesize = filesize; (fptr->Fptr)->io_pos = filesize; (fptr->Fptr)->logfilesize = filesize; (fptr->Fptr)->bytepos = filesize; ffbfeof(fptr, status); /* eliminate any buffers beyond current EOF */ return (*status = (*driverTable[(fptr->Fptr)->driver].truncate)((fptr->Fptr)->filehandle, filesize) ); } else return(*status); } /*--------------------------------------------------------------------------*/ int ffflushx( FITSfile *fptr) /* I - FITS file pointer */ /* low level routine to flush internal file buffers to the file. */ { if (driverTable[fptr->driver].flush) return ( (*driverTable[fptr->driver].flush)(fptr->filehandle) ); else return(0); /* no flush function defined for this driver */ } /*--------------------------------------------------------------------------*/ int ffseek( FITSfile *fptr, /* I - FITS file pointer */ LONGLONG position) /* I - byte position to seek to */ /* low level routine to seek to a position in a file. */ { return( (*driverTable[fptr->driver].seek)(fptr->filehandle, position) ); } /*--------------------------------------------------------------------------*/ int ffwrite( FITSfile *fptr, /* I - FITS file pointer */ long nbytes, /* I - number of bytes to write */ void *buffer, /* I - buffer to write */ int *status) /* O - error status */ /* low level routine to write bytes to a file. */ { if ( (*driverTable[fptr->driver].write)(fptr->filehandle, buffer, nbytes) ) { ffpmsg("Error writing data buffer to file:"); ffpmsg(fptr->filename); *status = WRITE_ERROR; } return(*status); } /*--------------------------------------------------------------------------*/ int ffread( FITSfile *fptr, /* I - FITS file pointer */ long nbytes, /* I - number of bytes to read */ void *buffer, /* O - buffer to read into */ int *status) /* O - error status */ /* low level routine to read bytes from a file. */ { int readstatus; readstatus = (*driverTable[fptr->driver].read)(fptr->filehandle, buffer, nbytes); if (readstatus == END_OF_FILE) *status = END_OF_FILE; else if (readstatus > 0) { ffpmsg("Error reading data buffer from file:"); ffpmsg(fptr->filename); *status = READ_ERROR; } return(*status); } /*--------------------------------------------------------------------------*/ int fftplt(fitsfile **fptr, /* O - FITS file pointer */ const char *filename, /* I - name of file to create */ const char *tempname, /* I - name of template file */ int *status) /* IO - error status */ /* Create and initialize a new FITS file based on a template file. Uses C fopen and fgets functions. */ { if (*status > 0) return(*status); if ( ffinit(fptr, filename, status) ) /* create empty file */ return(*status); ffoptplt(*fptr, tempname, status); /* open and use template */ return(*status); } /*--------------------------------------------------------------------------*/ int ffoptplt(fitsfile *fptr, /* O - FITS file pointer */ const char *tempname, /* I - name of template file */ int *status) /* IO - error status */ /* open template file and use it to create new file */ { fitsfile *tptr; int tstatus = 0, nkeys, nadd, ii; char card[FLEN_CARD]; if (*status > 0) return(*status); if (tempname == NULL || *tempname == '\0') /* no template file? */ return(*status); /* try opening template */ ffopen(&tptr, (char *) tempname, READONLY, &tstatus); if (tstatus) /* not a FITS file, so treat it as an ASCII template */ { ffxmsg(2, card); /* clear the error message */ fits_execute_template(fptr, (char *) tempname, status); ffmahd(fptr, 1, 0, status); /* move back to the primary array */ return(*status); } else /* template is a valid FITS file */ { ffmahd(tptr, 1, NULL, status); /* make sure we are at the beginning */ while (*status <= 0) { ffghsp(tptr, &nkeys, &nadd, status); /* get no. of keywords */ for (ii = 1; ii <= nkeys; ii++) /* copy keywords */ { ffgrec(tptr, ii, card, status); /* must reset the PCOUNT keyword to zero in the new output file */ if (strncmp(card, "PCOUNT ",8) == 0) { /* the PCOUNT keyword? */ if (strncmp(card+25, " 0", 5)) { /* non-zero value? */ strncpy(card, "PCOUNT = 0", 30); } } ffprec(fptr, card, status); } ffmrhd(tptr, 1, 0, status); /* move to next HDU until error */ ffcrhd(fptr, status); /* create empty new HDU in output file */ } if (*status == END_OF_FILE) { *status = 0; /* expected error condition */ } ffclos(tptr, status); /* close the template file */ } ffmahd(fptr, 1, 0, status); /* move to the primary array */ return(*status); } /*--------------------------------------------------------------------------*/ void ffrprt( FILE *stream, int status) /* Print out report of cfitsio error status and messages on the error stack. Uses C FILE stream. */ { char status_str[FLEN_STATUS], errmsg[FLEN_ERRMSG]; if (status) { fits_get_errstatus(status, status_str); /* get the error description */ fprintf(stream, "\nFITSIO status = %d: %s\n", status, status_str); while ( fits_read_errmsg(errmsg) ) /* get error stack messages */ fprintf(stream, "%s\n", errmsg); } return; } /*--------------------------------------------------------------------------*/ int pixel_filter_helper( fitsfile **fptr, /* IO - pointer to input image; on output it */ /* points to the new image */ char *outfile, /* I - name for output file */ char *expr, /* I - Image filter expression */ int *status) { PixelFilter filter = { 0 }; char * DEFAULT_TAG = "X"; int ii, hdunum; int singleHDU = 0; filter.count = 1; filter.ifptr = fptr; filter.tag = &DEFAULT_TAG; /* create new empty file for result */ if (ffinit(&filter.ofptr, outfile, status) > 0) { ffpmsg("failed to create output file for pixel filter:"); ffpmsg(outfile); return(*status); } fits_get_hdu_num(*fptr, &hdunum); /* current HDU number in input file */ expr += 3; /* skip 'pix' */ switch (expr[0]) { case 'b': case 'B': filter.bitpix = BYTE_IMG; break; case 'i': case 'I': filter.bitpix = SHORT_IMG; break; case 'j': case 'J': filter.bitpix = LONG_IMG; break; case 'r': case 'R': filter.bitpix = FLOAT_IMG; break; case 'd': case 'D': filter.bitpix = DOUBLE_IMG; break; } if (filter.bitpix) /* skip bitpix indicator */ ++expr; if (*expr == '1') { ++expr; singleHDU = 1; } if (((*fptr)->Fptr)->only_one) singleHDU = 1; if (*expr != ' ') { ffpmsg("pixel filtering expression not space separated:"); ffpmsg(expr); } while (*expr == ' ') ++expr; /* copy all preceding extensions to the output file */ for (ii = 1; !singleHDU && ii < hdunum; ii++) { fits_movabs_hdu(*fptr, ii, NULL, status); if (fits_copy_hdu(*fptr, filter.ofptr, 0, status) > 0) { ffclos(filter.ofptr, status); return(*status); } } /* move back to the original HDU position */ fits_movabs_hdu(*fptr, hdunum, NULL, status); filter.expression = expr; if (fits_pixel_filter(&filter, status)) { ffpmsg("failed to execute image filter:"); ffpmsg(expr); ffclos(filter.ofptr, status); return(*status); } /* copy any remaining HDUs to the output file */ for (ii = hdunum + 1; !singleHDU; ii++) { if (fits_movabs_hdu(*fptr, ii, NULL, status) > 0) break; fits_copy_hdu(*fptr, filter.ofptr, 0, status); } if (*status == END_OF_FILE) *status = 0; /* got the expected EOF error; reset = 0 */ else if (*status > 0) { ffclos(filter.ofptr, status); return(*status); } /* close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = filter.ofptr; /* reset the pointer to the new table */ /* move back to the image subsection */ if (ii - 1 != hdunum) fits_movabs_hdu(*fptr, hdunum, NULL, status); return(*status); } astropy-0.3/cextern/cfitsio/inffast.h0000644000175000017500000000065312243255342016116 0ustar oleole/* inffast.h -- header to use inffast.c * Copyright (C) 1995-2003, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); astropy-0.3/cextern/cfitsio/getkey.c0000644000175000017500000034002012243255342015742 0ustar oleole/* This file, getkey.c, contains routines that read keywords from */ /* a FITS header. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include /* stddef.h is apparently needed to define size_t */ #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffghsp(fitsfile *fptr, /* I - FITS file pointer */ int *nexist, /* O - number of existing keywords in header */ int *nmore, /* O - how many more keywords will fit */ int *status) /* IO - error status */ /* returns the number of existing keywords (not counting the END keyword) and the number of more keyword that will fit in the current header without having to insert more FITS blocks. */ { if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (nexist) *nexist = (int) (( ((fptr->Fptr)->headend) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80); if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if (nmore) *nmore = -1; /* data not written yet, so room for any keywords */ } else { /* calculate space available between the data and the END card */ if (nmore) *nmore = (int) (((fptr->Fptr)->datastart - (fptr->Fptr)->headend) / 80 - 1); } return(*status); } /*--------------------------------------------------------------------------*/ int ffghps(fitsfile *fptr, /* I - FITS file pointer */ int *nexist, /* O - number of existing keywords in header */ int *position, /* O - position of next keyword to be read */ int *status) /* IO - error status */ /* return the number of existing keywords and the position of the next keyword that will be read. */ { if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); *nexist = (int) (( ((fptr->Fptr)->headend) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80); *position = (int) (( ((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) ) / 80 + 1); return(*status); } /*--------------------------------------------------------------------------*/ int ffnchk(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* function returns the position of the first null character (ASCII 0), if any, in the current header. Null characters are illegal, but the other CFITSIO routines that read the header will not detect this error, because the null gets interpreted as a normal end of string character. */ { long ii, nblock; LONGLONG bytepos; int length, nullpos; char block[2881]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { return(0); /* Don't check a file that is just being created. */ /* It cannot contain nulls since CFITSIO wrote it. */ } else { /* calculate number of blocks in the header */ nblock = (long) (( (fptr->Fptr)->datastart - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) / 2880); } bytepos = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]; ffmbyt(fptr, bytepos, REPORT_EOF, status); /* move to read pos. */ block[2880] = '\0'; for (ii = 0; ii < nblock; ii++) { if (ffgbyt(fptr, 2880, block, status) > 0) return(0); /* read error of some sort */ length = strlen(block); if (length != 2880) { nullpos = (ii * 2880) + length + 1; return(nullpos); } } return(0); } /*--------------------------------------------------------------------------*/ int ffmaky(fitsfile *fptr, /* I - FITS file pointer */ int nrec, /* I - one-based keyword number to move to */ int *status) /* IO - error status */ { /* move pointer to the specified absolute keyword position. E.g. this keyword will then be read by the next call to ffgnky. */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] + ( (nrec - 1) * 80); return(*status); } /*--------------------------------------------------------------------------*/ int ffmrky(fitsfile *fptr, /* I - FITS file pointer */ int nmove, /* I - relative number of keywords to move */ int *status) /* IO - error status */ { /* move pointer to the specified keyword position relative to the current position. E.g. this keyword will then be read by the next call to ffgnky. */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->nextkey += (nmove * 80); return(*status); } /*--------------------------------------------------------------------------*/ int ffgnky(fitsfile *fptr, /* I - FITS file pointer */ char *card, /* O - card string */ int *status) /* IO - error status */ /* read the next keyword from the header - used internally by cfitsio */ { int jj, nrec; LONGLONG bytepos, endhead; char message[FLEN_ERRMSG]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); card[0] = '\0'; /* make sure card is terminated, even affer read error */ /* Check that nextkey points to a legal keyword position. Note that headend is the current end of the header, i.e., the position where a new keyword would be appended, however, if there are more than 1 FITS block worth of blank keywords at the end of the header (36 keywords per 2880 byte block) then the actual physical END card must be located at a starting position which is just 2880 bytes prior to the start of the data unit. */ bytepos = (fptr->Fptr)->nextkey; endhead = maxvalue( ((fptr->Fptr)->headend), ((fptr->Fptr)->datastart - 2880) ); /* nextkey must be < endhead and > than headstart */ if (bytepos > endhead || bytepos < (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) { nrec= (int) ((bytepos - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]) / 80 + 1); sprintf(message, "Cannot get keyword number %d. It does not exist.", nrec); ffpmsg(message); return(*status = KEY_OUT_BOUNDS); } ffmbyt(fptr, bytepos, REPORT_EOF, status); /* move to read pos. */ card[80] = '\0'; /* make sure card is terminate, even if ffgbyt fails */ if (ffgbyt(fptr, 80, card, status) <= 0) { (fptr->Fptr)->nextkey += 80; /* increment pointer to next keyword */ /* strip off trailing blanks with terminated string */ jj = 79; while (jj >= 0 && card[jj] == ' ') jj--; card[jj + 1] = '\0'; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgnxk( fitsfile *fptr, /* I - FITS file pointer */ char **inclist, /* I - list of included keyword names */ int ninc, /* I - number of names in inclist */ char **exclist, /* I - list of excluded keyword names */ int nexc, /* I - number of names in exclist */ char *card, /* O - first matching keyword */ int *status) /* IO - error status */ /* Return the next keyword that matches one of the names in inclist but does not match any of the names in exclist. The search goes from the current position to the end of the header, only. Wild card characters may be used in the name lists ('*', '?' and '#'). */ { int casesn, match, exact, namelen; long ii, jj; char keybuf[FLEN_CARD], keyname[FLEN_KEYWORD]; card[0] = '\0'; if (*status > 0) return(*status); casesn = FALSE; /* get next card, and return with an error if hit end of header */ while( ffgcrd(fptr, "*", keybuf, status) <= 0) { ffgknm(keybuf, keyname, &namelen, status); /* get the keyword name */ /* does keyword match any names in the include list? */ for (ii = 0; ii < ninc; ii++) { ffcmps(inclist[ii], keyname, casesn, &match, &exact); if (match) { /* does keyword match any names in the exclusion list? */ jj = -1; while ( ++jj < nexc ) { ffcmps(exclist[jj], keyname, casesn, &match, &exact); if (match) break; } if (jj >= nexc) { /* not in exclusion list, so return this keyword */ strcat(card, keybuf); return(*status); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgky( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ const char *keyname, /* I - name of keyword to read */ void *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the keyword value and comment from the FITS header. Reads a keyword value with the datatype specified by the 2nd argument. */ { long longval; double doubleval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TSTRING) { ffgkys(fptr, keyname, (char *) value, comm, status); } else if (datatype == TBYTE) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > UCHAR_MAX || longval < 0) *status = NUM_OVERFLOW; else *(unsigned char *) value = (unsigned char) longval; } } else if (datatype == TSBYTE) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > 127 || longval < -128) *status = NUM_OVERFLOW; else *(signed char *) value = (signed char) longval; } } else if (datatype == TUSHORT) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > (long) USHRT_MAX || longval < 0) *status = NUM_OVERFLOW; else *(unsigned short *) value = (unsigned short) longval; } } else if (datatype == TSHORT) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > SHRT_MAX || longval < SHRT_MIN) *status = NUM_OVERFLOW; else *(short *) value = (short) longval; } } else if (datatype == TUINT) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > (long) UINT_MAX || longval < 0) *status = NUM_OVERFLOW; else *(unsigned int *) value = longval; } } else if (datatype == TINT) { if (ffgkyj(fptr, keyname, &longval, comm, status) <= 0) { if (longval > INT_MAX || longval < INT_MIN) *status = NUM_OVERFLOW; else *(int *) value = longval; } } else if (datatype == TLOGICAL) { ffgkyl(fptr, keyname, (int *) value, comm, status); } else if (datatype == TULONG) { if (ffgkyd(fptr, keyname, &doubleval, comm, status) <= 0) { if (doubleval > (double) ULONG_MAX || doubleval < 0) *status = NUM_OVERFLOW; else *(unsigned long *) value = (unsigned long) doubleval; } } else if (datatype == TLONG) { ffgkyj(fptr, keyname, (long *) value, comm, status); } else if (datatype == TLONGLONG) { ffgkyjj(fptr, keyname, (LONGLONG *) value, comm, status); } else if (datatype == TFLOAT) { ffgkye(fptr, keyname, (float *) value, comm, status); } else if (datatype == TDOUBLE) { ffgkyd(fptr, keyname, (double *) value, comm, status); } else if (datatype == TCOMPLEX) { ffgkyc(fptr, keyname, (float *) value, comm, status); } else if (datatype == TDBLCOMPLEX) { ffgkym(fptr, keyname, (double *) value, comm, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgkey( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ char *keyval, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the keyword value and comment. The value is just the literal string of characters in the value field of the keyword. In the case of a string valued keyword, the returned value includes the leading and closing quote characters. The value may be up to 70 characters long, and the comment may be up to 72 characters long. If the keyword has no value (no equal sign in column 9) then a null value is returned. */ { char card[FLEN_CARD]; keyval[0] = '\0'; if (comm) comm[0] = '\0'; if (*status > 0) return(*status); if (ffgcrd(fptr, keyname, card, status) > 0) /* get the 80-byte card */ return(*status); ffpsvc(card, keyval, comm, status); /* parse the value and comment */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgrec( fitsfile *fptr, /* I - FITS file pointer */ int nrec, /* I - number of keyword to read */ char *card, /* O - keyword card */ int *status) /* IO - error status */ /* Read (get) the nrec-th keyword, returning the entire keyword card up to 80 characters long. The first keyword in the header has nrec = 1, not 0. The returned card value is null terminated with any trailing blank characters removed. If nrec = 0, then this routine simply moves the current header pointer to the top of the header. */ { if (*status > 0) return(*status); if (nrec == 0) { ffmaky(fptr, 1, status); /* simply move to beginning of header */ if (card) card[0] = '\0'; /* and return null card */ } else if (nrec > 0) { ffmaky(fptr, nrec, status); ffgnky(fptr, card, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgcrd( fitsfile *fptr, /* I - FITS file pointer */ const char *name, /* I - name of keyword to read */ char *card, /* O - keyword card */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the entire keyword card up to 80 characters long. The returned card value is null terminated with any trailing blank characters removed. If the input name contains wild cards ('?' matches any single char and '*' matches any sequence of chars, # matches any string of decimal digits) then the search ends once the end of header is reached and does not automatically resume from the top of the header. */ { int nkeys, nextkey, ntodo, namelen, namelen_limit, namelenminus1, cardlen; int ii = 0, jj, kk, wild, match, exact, hier = 0; char keyname[FLEN_KEYWORD], cardname[FLEN_KEYWORD]; char *ptr1, *ptr2, *gotstar; if (*status > 0) return(*status); *keyname = '\0'; while (name[ii] == ' ') /* skip leading blanks in name */ ii++; strncat(keyname, &name[ii], FLEN_KEYWORD - 1); namelen = strlen(keyname); while (namelen > 0 && keyname[namelen - 1] == ' ') namelen--; /* ignore trailing blanks in name */ keyname[namelen] = '\0'; /* terminate the name */ for (ii=0; ii < namelen; ii++) keyname[ii] = toupper(keyname[ii]); /* make upper case */ if (FSTRNCMP("HIERARCH", keyname, 8) == 0) { if (namelen == 8) { /* special case: just looking for any HIERARCH keyword */ hier = 1; } else { /* ignore the leading HIERARCH and look for the 'real' name */ /* starting with first non-blank character following HIERARCH */ ptr1 = keyname; ptr2 = &keyname[8]; while(*ptr2 == ' ') ptr2++; namelen = 0; while(*ptr2) { *ptr1 = *ptr2; ptr1++; ptr2++; namelen++; } *ptr1 = '\0'; } } /* does input name contain wild card chars? ('?', '*', or '#') */ /* wild cards are currently not supported with HIERARCH keywords */ namelen_limit = namelen; gotstar = 0; if (namelen < 9 && (strchr(keyname,'?') || (gotstar = strchr(keyname,'*')) || strchr(keyname,'#')) ) { wild = 1; /* if we found a '*' wild card in the name, there might be */ /* more than one. Support up to 2 '*' in the template. */ /* Thus we need to compare keywords whose names have at least */ /* namelen - 2 characters. */ if (gotstar) namelen_limit -= 2; } else wild = 0; ffghps(fptr, &nkeys, &nextkey, status); /* get no. keywords and position */ namelenminus1 = maxvalue(namelen - 1, 1); ntodo = nkeys - nextkey + 1; /* first, read from next keyword to end */ for (jj=0; jj < 2; jj++) { for (kk = 0; kk < ntodo; kk++) { ffgnky(fptr, card, status); /* get next keyword */ if (hier) { if (FSTRNCMP("HIERARCH", card, 8) == 0) return(*status); /* found a HIERARCH keyword */ } else { ffgknm(card, cardname, &cardlen, status); /* get the keyword name */ if (cardlen >= namelen_limit) /* can't match if card < name */ { /* if there are no wild cards, lengths must be the same */ if (!( !wild && cardlen != namelen) ) { for (ii=0; ii < cardlen; ii++) { /* make sure keyword is in uppercase */ if (cardname[ii] > 96) { /* This assumes the ASCII character set in which */ /* upper case characters start at ASCII(97) */ /* Timing tests showed that this is 20% faster */ /* than calling the isupper function. */ cardname[ii] = toupper(cardname[ii]); /* make upper case */ } } if (wild) { ffcmps(keyname, cardname, 1, &match, &exact); if (match) return(*status); /* found a matching keyword */ } else if (keyname[namelenminus1] == cardname[namelenminus1]) { /* test the last character of the keyword name first, on */ /* the theory that it is less likely to match then the first */ /* character since many keywords begin with 'T', for example */ if (FSTRNCMP(keyname, cardname, namelenminus1) == 0) { return(*status); /* found the matching keyword */ } } else if (namelen == 0 && cardlen == 0) { /* matched a blank keyword */ return(*status); } } } } } if (wild || jj == 1) break; /* stop at end of header if template contains wildcards */ ffmaky(fptr, 1, status); /* reset pointer to beginning of header */ ntodo = nextkey - 1; /* number of keyword to read */ } return(*status = KEY_NO_EXIST); /* couldn't find the keyword */ } /*--------------------------------------------------------------------------*/ int ffgstr( fitsfile *fptr, /* I - FITS file pointer */ const char *string, /* I - string to match */ char *card, /* O - keyword card */ int *status) /* IO - error status */ /* Read (get) the next keyword record that contains the input character string, returning the entire keyword card up to 80 characters long. The returned card value is null terminated with any trailing blank characters removed. */ { int nkeys, nextkey, ntodo, stringlen; int jj, kk; if (*status > 0) return(*status); stringlen = strlen(string); if (stringlen > 80) { return(*status = KEY_NO_EXIST); /* matching string is too long to exist */ } ffghps(fptr, &nkeys, &nextkey, status); /* get no. keywords and position */ ntodo = nkeys - nextkey + 1; /* first, read from next keyword to end */ for (jj=0; jj < 2; jj++) { for (kk = 0; kk < ntodo; kk++) { ffgnky(fptr, card, status); /* get next keyword */ if (strstr(card, string) != 0) { return(*status); /* found the matching string */ } } ffmaky(fptr, 1, status); /* reset pointer to beginning of header */ ntodo = nextkey - 1; /* number of keyword to read */ } return(*status = KEY_NO_EXIST); /* couldn't find the keyword */ } /*--------------------------------------------------------------------------*/ int ffgknm( char *card, /* I - keyword card */ char *name, /* O - name of the keyword */ int *length, /* O - length of the keyword name */ int *status) /* IO - error status */ /* Return the name of the keyword, and the name length. This supports the ESO HIERARCH convention where keyword names may be > 8 characters long. */ { char *ptr1, *ptr2; int ii; *name = '\0'; *length = 0; /* support for ESO HIERARCH keywords; find the '=' */ if (FSTRNCMP(card, "HIERARCH ", 9) == 0) { ptr2 = strchr(card, '='); if (!ptr2) /* no value indicator ??? */ { /* this probably indicates an error, so just return FITS name */ strcat(name, "HIERARCH"); *length = 8; return(*status); } /* find the start and end of the HIERARCH name */ ptr1 = &card[9]; while (*ptr1 == ' ') /* skip spaces */ ptr1++; strncat(name, ptr1, ptr2 - ptr1); ii = ptr2 - ptr1; while (ii > 0 && name[ii - 1] == ' ') /* remove trailing spaces */ ii--; name[ii] = '\0'; *length = ii; } else { for (ii = 0; ii < 8; ii++) { /* look for string terminator, or a blank */ if (*(card+ii) != ' ' && *(card+ii) !='\0') { *(name+ii) = *(card+ii); } else { name[ii] = '\0'; *length = ii; return(*status); } } /* if we got here, keyword is 8 characters long */ name[8] = '\0'; *length = 8; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgunt( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ char *unit, /* O - keyword units */ int *status) /* IO - error status */ /* Read (get) the units string from the comment field of the existing keyword. This routine uses a local FITS convention (not defined in the official FITS standard) in which the units are enclosed in square brackets following the '/' comment field delimiter, e.g.: KEYWORD = 12 / [kpc] comment string goes here */ { char valstring[FLEN_VALUE]; char comm[FLEN_COMMENT]; char *loc; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ if (comm[0] == '[') { loc = strchr(comm, ']'); /* find the closing bracket */ if (loc) *loc = '\0'; /* terminate the string */ strcpy(unit, &comm[1]); /* copy the string */ } else unit[0] = '\0'; return(*status); } /*--------------------------------------------------------------------------*/ int ffgkys( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ char *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Get KeYword with a String value: Read (get) a simple string valued keyword. The returned value may be up to 68 chars long ( + 1 null terminator char). The routine does not support the HEASARC convention for continuing long string values over multiple keywords. The ffgkls routine may be used to read long continued strings. The returned comment string may be up to 69 characters long (including null terminator). */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ value[0] = '\0'; ffc2s(valstring, value, status); /* remove quotes from string */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkls( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ char **value, /* O - pointer to keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Get Keyword with possible Long String value: Read (get) the named keyword, returning the value and comment. The returned value string may be arbitrarily long (by using the HEASARC convention for continuing long string values over multiple keywords) so this routine allocates the required memory for the returned string value. It is up to the calling routine to free the memory once it is finished with the value string. The returned comment string may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; int contin; size_t len; if (*status > 0) return(*status); *value = NULL; /* initialize a null pointer in case of error */ ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ if (*status > 0) return(*status); if (!valstring[0]) /* null value string? */ { *value = (char *) malloc(1); /* allocate and return a null string */ **value = '\0'; } else { /* allocate space, plus 1 for null */ *value = (char *) malloc(strlen(valstring) + 1); ffc2s(valstring, *value, status); /* convert string to value */ len = strlen(*value); /* If last character is a & then value may be continued on next keyword */ contin = 1; while (contin) { if (len && *(*value+len-1) == '&') /* is last char an anpersand? */ { ffgcnt(fptr, valstring, status); if (*valstring) /* a null valstring indicates no continuation */ { *(*value+len-1) = '\0'; /* erase the trailing & char */ len += strlen(valstring) - 1; *value = (char *) realloc(*value, len + 1); /* increase size */ strcat(*value, valstring); /* append the continued chars */ } else contin = 0; } else contin = 0; } } return(*status); } /*--------------------------------------------------------------------------*/ int fffree( void *value, /* I - pointer to keyword value */ int *status) /* IO - error status */ /* Free the memory that was previously allocated by CFITSIO, such as by ffgkls or fits_hdr2str */ { if (*status > 0) return(*status); if (value) free(value); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcnt( fitsfile *fptr, /* I - FITS file pointer */ char *value, /* O - continued string value */ int *status) /* IO - error status */ /* Attempt to read the next keyword, returning the string value if it is a continuation of the previous string keyword value. This uses the HEASARC convention for continuing long string values over multiple keywords. Each continued string is terminated with a backslash character, and the continuation follows on the next keyword which must have the name CONTINUE without an equal sign in column 9 of the card. If the next card is not a continuation, then the returned value string will be null. */ { int tstatus; char card[FLEN_CARD], strval[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); tstatus = 0; value[0] = '\0'; if (ffgnky(fptr, card, &tstatus) > 0) /* read next keyword */ return(*status); /* hit end of header */ if (strncmp(card, "CONTINUE ", 10) == 0) /* a continuation card? */ { strncpy(card, "D2345678= ", 10); /* overwrite a dummy keyword name */ ffpsvc(card, strval, comm, &tstatus); /* get the string value */ ffc2s(strval, value, &tstatus); /* remove the surrounding quotes */ if (tstatus) /* return null if error status was returned */ value[0] = '\0'; } else ffmrky(fptr, -1, status); /* reset the keyword pointer */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyl( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ int *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The returned value = 1 if the keyword is true, else = 0 if false. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ ffc2l(valstring, value, status); /* convert string to value */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ long *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The value will be implicitly converted to a (long) integer if it not already of this datatype. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ ffc2i(valstring, value, status); /* convert string to value */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyjj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ LONGLONG *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The value will be implicitly converted to a (long) integer if it not already of this datatype. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ ffc2j(valstring, value, status); /* convert string to value */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkye( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ float *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The value will be implicitly converted to a float if it not already of this datatype. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ ffc2r(valstring, value, status); /* convert string to value */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyd( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ double *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The value will be implicitly converted to a double if it not already of this datatype. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ ffc2d(valstring, value, status); /* convert string to value */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyc( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ float *value, /* O - keyword value (real,imag) */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The keyword must have a complex value. No implicit data conversion will be performed. */ { char valstring[FLEN_VALUE], message[81]; int len; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ if (valstring[0] != '(' ) /* test that this is a complex keyword */ { sprintf(message, "keyword %s does not have a complex value (ffgkyc):", keyname); ffpmsg(message); ffpmsg(valstring); return(*status = BAD_C2F); } valstring[0] = ' '; /* delete the opening parenthesis */ len = strcspn(valstring, ")" ); valstring[len] = '\0'; /* delete the closing parenthesis */ len = strcspn(valstring, ","); valstring[len] = '\0'; ffc2r(valstring, &value[0], status); /* convert the real part */ ffc2r(&valstring[len + 1], &value[1], status); /* convert imag. part */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkym( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ double *value, /* O - keyword value (real,imag) */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The keyword must have a complex value. No implicit data conversion will be performed. */ { char valstring[FLEN_VALUE], message[81]; int len; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ if (valstring[0] != '(' ) /* test that this is a complex keyword */ { sprintf(message, "keyword %s does not have a complex value (ffgkym):", keyname); ffpmsg(message); ffpmsg(valstring); return(*status = BAD_C2D); } valstring[0] = ' '; /* delete the opening parenthesis */ len = strcspn(valstring, ")" ); valstring[len] = '\0'; /* delete the closing parenthesis */ len = strcspn(valstring, ","); valstring[len] = '\0'; ffc2d(valstring, &value[0], status); /* convert the real part */ ffc2d(&valstring[len + 1], &value[1], status); /* convert the imag. part */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyt( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to read */ long *ivalue, /* O - integer part of keyword value */ double *fraction, /* O - fractional part of keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the named keyword, returning the value and comment. The integer and fractional parts of the value are returned in separate variables, to allow more numerical precision to be passed. This effectively passes a 'triple' precision value, with a 4-byte integer and an 8-byte fraction. The comment may be up to 69 characters long. */ { char valstring[FLEN_VALUE]; char *loc; if (*status > 0) return(*status); ffgkey(fptr, keyname, valstring, comm, status); /* read the keyword */ /* read the entire value string as a double, to get the integer part */ ffc2d(valstring, fraction, status); *ivalue = (long) *fraction; *fraction = *fraction - *ivalue; /* see if we need to read the fractional part again with more precision */ /* look for decimal point, without an exponential E or D character */ loc = strchr(valstring, '.'); if (loc) { if (!strchr(valstring, 'E') && !strchr(valstring, 'D')) ffc2d(loc, fraction, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgkyn( fitsfile *fptr, /* I - FITS file pointer */ int nkey, /* I - number of the keyword to read */ char *keyname, /* O - name of the keyword */ char *value, /* O - keyword value */ char *comm, /* O - keyword comment */ int *status) /* IO - error status */ /* Read (get) the nkey-th keyword returning the keyword name, value and comment. The value is just the literal string of characters in the value field of the keyword. In the case of a string valued keyword, the returned value includes the leading and closing quote characters. The value may be up to 70 characters long, and the comment may be up to 72 characters long. If the keyword has no value (no equal sign in column 9) then a null value is returned. If comm = NULL, then do not return the comment string. */ { char card[FLEN_CARD], sbuff[FLEN_CARD]; int namelen; keyname[0] = '\0'; value[0] = '\0'; if (comm) comm[0] = '\0'; if (*status > 0) return(*status); if (ffgrec(fptr, nkey, card, status) > 0 ) /* get the 80-byte card */ return(*status); ffgknm(card, keyname, &namelen, status); /* get the keyword name */ if (ffpsvc(card, value, comm, status) > 0) /* parse value and comment */ return(*status); if (fftrec(keyname, status) > 0) /* test keyword name; catches no END */ { sprintf(sbuff,"Name of keyword no. %d contains illegal character(s): %s", nkey, keyname); ffpmsg(sbuff); if (nkey % 36 == 0) /* test if at beginning of 36-card FITS record */ ffpmsg(" (This may indicate a missing END keyword)."); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgkns( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ char *value[], /* O - array of pointers to keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. This routine does NOT support the HEASARC long string convention. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgrec(fptr, ii, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2s(svalue, value[ival-nstart], status); /* convert */ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgknl( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ int *value, /* O - array of keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. The returned value = 1 if the keyword is true, else = 0 if false. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ ffmaky(fptr, 3, status); /* move to 3rd keyword (skip 1st 2 keywords) */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgnky(fptr, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2l(svalue, &value[ival-nstart], status); /* convert*/ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgknj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ long *value, /* O - array of keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ ffmaky(fptr, 3, status); /* move to 3rd keyword (skip 1st 2 keywords) */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgnky(fptr, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2i(svalue, &value[ival-nstart], status); /* convert */ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgknjj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ LONGLONG *value, /* O - array of keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ ffmaky(fptr, 3, status); /* move to 3rd keyword (skip 1st 2 keywords) */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgnky(fptr, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2j(svalue, &value[ival-nstart], status); /* convert */ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgkne( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ float *value, /* O - array of keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ ffmaky(fptr, 3, status); /* move to 3rd keyword (skip 1st 2 keywords) */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgnky(fptr, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2r(svalue, &value[ival-nstart], status); /* convert */ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgknd( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - root name of keywords to read */ int nstart, /* I - starting index number */ int nmax, /* I - maximum number of keywords to return */ double *value, /* O - array of keyword values */ int *nfound, /* O - number of values that were returned */ int *status) /* IO - error status */ /* Read (get) an indexed array of keywords with index numbers between NSTART and (NSTART + NMAX -1) inclusive. */ { int nend, lenroot, ii, nkeys, mkeys, tstatus, undefinedval; long ival; char keyroot[FLEN_KEYWORD], keyindex[8], card[FLEN_CARD]; char svalue[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) return(*status); *nfound = 0; nend = nstart + nmax - 1; keyroot[0] = '\0'; strncat(keyroot, keyname, 8); lenroot = strlen(keyroot); if (lenroot == 0 || lenroot > 7) /* root must be 1 - 7 chars long */ return(*status); for (ii=0; ii < lenroot; ii++) /* make sure upper case */ keyroot[ii] = toupper(keyroot[ii]); ffghps(fptr, &nkeys, &mkeys, status); /* get the number of keywords */ ffmaky(fptr, 3, status); /* move to 3rd keyword (skip 1st 2 keywords) */ undefinedval = FALSE; for (ii=3; ii <= nkeys; ii++) { if (ffgnky(fptr, card, status) > 0) /* get next keyword */ return(*status); if (strncmp(keyroot, card, lenroot) == 0) /* see if keyword matches */ { keyindex[0] = '\0'; strncat(keyindex, &card[lenroot], 8-lenroot); /* copy suffix */ tstatus = 0; if (ffc2ii(keyindex, &ival, &tstatus) <= 0) /* test suffix */ { if (ival <= nend && ival >= nstart) /* is index within range? */ { ffpsvc(card, svalue, comm, status); /* parse the value */ ffc2d(svalue, &value[ival-nstart], status); /* convert */ if (ival - nstart + 1 > *nfound) *nfound = ival - nstart + 1; /* max found */ if (*status == VALUE_UNDEFINED) { undefinedval = TRUE; *status = 0; /* reset status to read remaining values */ } } } } } if (undefinedval && (*status <= 0) ) *status = VALUE_UNDEFINED; /* report at least 1 value undefined */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgtdm(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read */ int maxdim, /* I - maximum no. of dimensions to read; */ int *naxis, /* O - number of axes in the data array */ long naxes[], /* O - length of each data axis */ int *status) /* IO - error status */ /* read and parse the TDIMnnn keyword to get the dimensionality of a column */ { int tstatus = 0; char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE]; if (*status > 0) return(*status); ffkeyn("TDIM", colnum, keyname, status); /* construct keyword name */ ffgkys(fptr, keyname, tdimstr, NULL, &tstatus); /* try reading keyword */ ffdtdm(fptr, tdimstr, colnum, maxdim,naxis, naxes, status); /* decode it */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgtdmll(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read */ int maxdim, /* I - maximum no. of dimensions to read; */ int *naxis, /* O - number of axes in the data array */ LONGLONG naxes[], /* O - length of each data axis */ int *status) /* IO - error status */ /* read and parse the TDIMnnn keyword to get the dimensionality of a column */ { int tstatus = 0; char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE]; if (*status > 0) return(*status); ffkeyn("TDIM", colnum, keyname, status); /* construct keyword name */ ffgkys(fptr, keyname, tdimstr, NULL, &tstatus); /* try reading keyword */ ffdtdmll(fptr, tdimstr, colnum, maxdim,naxis, naxes, status); /* decode it */ return(*status); } /*--------------------------------------------------------------------------*/ int ffdtdm(fitsfile *fptr, /* I - FITS file pointer */ char *tdimstr, /* I - TDIMn keyword value string. e.g. (10,10) */ int colnum, /* I - number of the column */ int maxdim, /* I - maximum no. of dimensions to read; */ int *naxis, /* O - number of axes in the data array */ long naxes[], /* O - length of each data axis */ int *status) /* IO - error status */ /* decode the TDIMnnn keyword to get the dimensionality of a column. Check that the value is legal and consistent with the TFORM value. If colnum = 0, then the validity checking is disabled. */ { long dimsize, totalpix = 1; char *loc, *lastloc, message[81]; tcolumn *colptr; if (*status > 0) return(*status); if (colnum != 0) { if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); colptr = (fptr->Fptr)->tableptr; /* set pointer to the first column */ colptr += (colnum - 1); /* increment to the correct column */ if (!tdimstr[0]) /* TDIMn keyword doesn't exist? */ { *naxis = 1; /* default = 1 dimensional */ if (maxdim > 0) naxes[0] = (long) colptr->trepeat; /* default length = repeat */ return(*status); } } *naxis = 0; loc = strchr(tdimstr, '(' ); /* find the opening quote */ if (!loc) { sprintf(message, "Illegal dimensions format: %s", tdimstr); return(*status = BAD_TDIM); } while (loc) { loc++; dimsize = strtol(loc, &loc, 10); /* read size of next dimension */ if (*naxis < maxdim) naxes[*naxis] = dimsize; if (dimsize < 0) { ffpmsg("one or more dimension are less than 0 (ffdtdm)"); ffpmsg(tdimstr); return(*status = BAD_TDIM); } totalpix *= dimsize; (*naxis)++; lastloc = loc; loc = strchr(loc, ','); /* look for comma before next dimension */ } loc = strchr(lastloc, ')' ); /* check for the closing quote */ if (!loc) { sprintf(message, "Illegal dimensions format: %s", tdimstr); return(*status = BAD_TDIM); } if (colnum != 0) { if ((colptr->tdatatype > 0) && ((long) colptr->trepeat != totalpix)) { sprintf(message, "column vector length, %ld, does not equal TDIMn array size, %ld", (long) colptr->trepeat, totalpix); ffpmsg(message); ffpmsg(tdimstr); return(*status = BAD_TDIM); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffdtdmll(fitsfile *fptr, /* I - FITS file pointer */ char *tdimstr, /* I - TDIMn keyword value string. e.g. (10,10) */ int colnum, /* I - number of the column */ int maxdim, /* I - maximum no. of dimensions to read; */ int *naxis, /* O - number of axes in the data array */ LONGLONG naxes[], /* O - length of each data axis */ int *status) /* IO - error status */ /* decode the TDIMnnn keyword to get the dimensionality of a column. Check that the value is legal and consistent with the TFORM value. */ { LONGLONG dimsize; LONGLONG totalpix = 1; char *loc, *lastloc, message[81]; tcolumn *colptr; double doublesize; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); colptr = (fptr->Fptr)->tableptr; /* set pointer to the first column */ colptr += (colnum - 1); /* increment to the correct column */ if (!tdimstr[0]) /* TDIMn keyword doesn't exist? */ { *naxis = 1; /* default = 1 dimensional */ if (maxdim > 0) naxes[0] = colptr->trepeat; /* default length = repeat */ } else { *naxis = 0; loc = strchr(tdimstr, '(' ); /* find the opening quote */ if (!loc) { sprintf(message, "Illegal TDIM keyword value: %s", tdimstr); return(*status = BAD_TDIM); } while (loc) { loc++; /* Read value as a double because the string to 64-bit int function is */ /* platform dependent (strtoll, strtol, _atoI64). This still gives */ /* about 48 bits of precision, which is plenty for this purpose. */ doublesize = strtod(loc, &loc); dimsize = (LONGLONG) (doublesize + 0.1); if (*naxis < maxdim) naxes[*naxis] = dimsize; if (dimsize < 0) { ffpmsg("one or more TDIM values are less than 0 (ffdtdm)"); ffpmsg(tdimstr); return(*status = BAD_TDIM); } totalpix *= dimsize; (*naxis)++; lastloc = loc; loc = strchr(loc, ','); /* look for comma before next dimension */ } loc = strchr(lastloc, ')' ); /* check for the closing quote */ if (!loc) { sprintf(message, "Illegal TDIM keyword value: %s", tdimstr); return(*status = BAD_TDIM); } if ((colptr->tdatatype > 0) && (colptr->trepeat != totalpix)) { sprintf(message, "column vector length, %.0f, does not equal TDIMn array size, %.0f", (double) (colptr->trepeat), (double) totalpix); ffpmsg(message); ffpmsg(tdimstr); return(*status = BAD_TDIM); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffghpr(fitsfile *fptr, /* I - FITS file pointer */ int maxdim, /* I - maximum no. of dimensions to read; */ int *simple, /* O - does file conform to FITS standard? 1/0 */ int *bitpix, /* O - number of bits per data value pixel */ int *naxis, /* O - number of axes in the data array */ long naxes[], /* O - length of each data axis */ long *pcount, /* O - number of group parameters (usually 0) */ long *gcount, /* O - number of random groups (usually 1 or 0) */ int *extend, /* O - may FITS file haave extensions? */ int *status) /* IO - error status */ /* Get keywords from the Header of the PRimary array: Check that the keywords conform to the FITS standard and return the parameters which determine the size and structure of the primary array or IMAGE extension. */ { int idummy, ii; LONGLONG lldummy; double ddummy; LONGLONG tnaxes[99]; ffgphd(fptr, maxdim, simple, bitpix, naxis, tnaxes, pcount, gcount, extend, &ddummy, &ddummy, &lldummy, &idummy, status); if (naxis && naxes) { for (ii = 0; (ii < *naxis) && (ii < maxdim); ii++) naxes[ii] = (long) tnaxes[ii]; } else if (naxes) { for (ii = 0; ii < maxdim; ii++) naxes[ii] = (long) tnaxes[ii]; } return(*status); } /*--------------------------------------------------------------------------*/ int ffghprll(fitsfile *fptr, /* I - FITS file pointer */ int maxdim, /* I - maximum no. of dimensions to read; */ int *simple, /* O - does file conform to FITS standard? 1/0 */ int *bitpix, /* O - number of bits per data value pixel */ int *naxis, /* O - number of axes in the data array */ LONGLONG naxes[], /* O - length of each data axis */ long *pcount, /* O - number of group parameters (usually 0) */ long *gcount, /* O - number of random groups (usually 1 or 0) */ int *extend, /* O - may FITS file haave extensions? */ int *status) /* IO - error status */ /* Get keywords from the Header of the PRimary array: Check that the keywords conform to the FITS standard and return the parameters which determine the size and structure of the primary array or IMAGE extension. */ { int idummy; LONGLONG lldummy; double ddummy; ffgphd(fptr, maxdim, simple, bitpix, naxis, naxes, pcount, gcount, extend, &ddummy, &ddummy, &lldummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffghtb(fitsfile *fptr, /* I - FITS file pointer */ int maxfield, /* I - maximum no. of columns to read; */ long *naxis1, /* O - length of table row in bytes */ long *naxis2, /* O - number of rows in the table */ int *tfields, /* O - number of columns in the table */ char **ttype, /* O - name of each column */ long *tbcol, /* O - byte offset in row to each column */ char **tform, /* O - value of TFORMn keyword for each column */ char **tunit, /* O - value of TUNITn keyword for each column */ char *extnm, /* O - value of EXTNAME keyword, if any */ int *status) /* IO - error status */ /* Get keywords from the Header of the ASCII TaBle: Check that the keywords conform to the FITS standard and return the parameters which describe the table. */ { int ii, maxf, nfound, tstatus; long fields; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xtension[FLEN_VALUE], message[81]; LONGLONG llnaxis1, llnaxis2, pcount; if (*status > 0) return(*status); /* read the first keyword of the extension */ ffgkyn(fptr, 1, name, value, comm, status); if (!strcmp(name, "XTENSION")) { if (ffc2s(value, xtension, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } /* allow the quoted string value to begin in any column and */ /* allow any number of trailing blanks before the closing quote */ if ( (value[0] != '\'') || /* first char must be a quote */ ( strcmp(xtension, "TABLE") ) ) { sprintf(message, "This is not a TABLE extension: %s", value); ffpmsg(message); return(*status = NOT_ATABLE); } } else /* error: 1st keyword of extension != XTENSION */ { sprintf(message, "First keyword of the extension is not XTENSION: %s", name); ffpmsg(message); return(*status = NO_XTENSION); } if (ffgttb(fptr, &llnaxis1, &llnaxis2, &pcount, &fields, status) > 0) return(*status); if (naxis1) *naxis1 = (long) llnaxis1; if (naxis2) *naxis2 = (long) llnaxis2; if (pcount != 0) { sprintf(message, "PCOUNT = %.0f is illegal in ASCII table; must = 0", (double) pcount); ffpmsg(message); return(*status = BAD_PCOUNT); } if (tfields) *tfields = fields; if (maxfield < 0) maxf = fields; else maxf = minvalue(maxfield, fields); if (maxf > 0) { for (ii = 0; ii < maxf; ii++) { /* initialize optional keyword values */ if (ttype) *ttype[ii] = '\0'; if (tunit) *tunit[ii] = '\0'; } if (ttype) ffgkns(fptr, "TTYPE", 1, maxf, ttype, &nfound, status); if (tunit) ffgkns(fptr, "TUNIT", 1, maxf, tunit, &nfound, status); if (*status > 0) return(*status); if (tbcol) { ffgknj(fptr, "TBCOL", 1, maxf, tbcol, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TBCOL keyword(s) not found in ASCII table header (ffghtb)."); return(*status = NO_TBCOL); } } if (tform) { ffgkns(fptr, "TFORM", 1, maxf, tform, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TFORM keyword(s) not found in ASCII table header (ffghtb)."); return(*status = NO_TFORM); } } } if (extnm) { extnm[0] = '\0'; tstatus = *status; ffgkys(fptr, "EXTNAME", extnm, comm, status); if (*status == KEY_NO_EXIST) *status = tstatus; /* keyword not required, so ignore error */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffghtbll(fitsfile *fptr, /* I - FITS file pointer */ int maxfield, /* I - maximum no. of columns to read; */ LONGLONG *naxis1, /* O - length of table row in bytes */ LONGLONG *naxis2, /* O - number of rows in the table */ int *tfields, /* O - number of columns in the table */ char **ttype, /* O - name of each column */ LONGLONG *tbcol, /* O - byte offset in row to each column */ char **tform, /* O - value of TFORMn keyword for each column */ char **tunit, /* O - value of TUNITn keyword for each column */ char *extnm, /* O - value of EXTNAME keyword, if any */ int *status) /* IO - error status */ /* Get keywords from the Header of the ASCII TaBle: Check that the keywords conform to the FITS standard and return the parameters which describe the table. */ { int ii, maxf, nfound, tstatus; long fields; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xtension[FLEN_VALUE], message[81]; LONGLONG llnaxis1, llnaxis2, pcount; if (*status > 0) return(*status); /* read the first keyword of the extension */ ffgkyn(fptr, 1, name, value, comm, status); if (!strcmp(name, "XTENSION")) { if (ffc2s(value, xtension, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } /* allow the quoted string value to begin in any column and */ /* allow any number of trailing blanks before the closing quote */ if ( (value[0] != '\'') || /* first char must be a quote */ ( strcmp(xtension, "TABLE") ) ) { sprintf(message, "This is not a TABLE extension: %s", value); ffpmsg(message); return(*status = NOT_ATABLE); } } else /* error: 1st keyword of extension != XTENSION */ { sprintf(message, "First keyword of the extension is not XTENSION: %s", name); ffpmsg(message); return(*status = NO_XTENSION); } if (ffgttb(fptr, &llnaxis1, &llnaxis2, &pcount, &fields, status) > 0) return(*status); if (naxis1) *naxis1 = llnaxis1; if (naxis2) *naxis2 = llnaxis2; if (pcount != 0) { sprintf(message, "PCOUNT = %.0f is illegal in ASCII table; must = 0", (double) pcount); ffpmsg(message); return(*status = BAD_PCOUNT); } if (tfields) *tfields = fields; if (maxfield < 0) maxf = fields; else maxf = minvalue(maxfield, fields); if (maxf > 0) { for (ii = 0; ii < maxf; ii++) { /* initialize optional keyword values */ if (ttype) *ttype[ii] = '\0'; if (tunit) *tunit[ii] = '\0'; } if (ttype) ffgkns(fptr, "TTYPE", 1, maxf, ttype, &nfound, status); if (tunit) ffgkns(fptr, "TUNIT", 1, maxf, tunit, &nfound, status); if (*status > 0) return(*status); if (tbcol) { ffgknjj(fptr, "TBCOL", 1, maxf, tbcol, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TBCOL keyword(s) not found in ASCII table header (ffghtbll)."); return(*status = NO_TBCOL); } } if (tform) { ffgkns(fptr, "TFORM", 1, maxf, tform, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TFORM keyword(s) not found in ASCII table header (ffghtbll)."); return(*status = NO_TFORM); } } } if (extnm) { extnm[0] = '\0'; tstatus = *status; ffgkys(fptr, "EXTNAME", extnm, comm, status); if (*status == KEY_NO_EXIST) *status = tstatus; /* keyword not required, so ignore error */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffghbn(fitsfile *fptr, /* I - FITS file pointer */ int maxfield, /* I - maximum no. of columns to read; */ long *naxis2, /* O - number of rows in the table */ int *tfields, /* O - number of columns in the table */ char **ttype, /* O - name of each column */ char **tform, /* O - TFORMn value for each column */ char **tunit, /* O - TUNITn value for each column */ char *extnm, /* O - value of EXTNAME keyword, if any */ long *pcount, /* O - value of PCOUNT keyword */ int *status) /* IO - error status */ /* Get keywords from the Header of the BiNary table: Check that the keywords conform to the FITS standard and return the parameters which describe the table. */ { int ii, maxf, nfound, tstatus; long fields; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xtension[FLEN_VALUE], message[81]; LONGLONG naxis1ll, naxis2ll, pcountll; if (*status > 0) return(*status); /* read the first keyword of the extension */ ffgkyn(fptr, 1, name, value, comm, status); if (!strcmp(name, "XTENSION")) { if (ffc2s(value, xtension, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } /* allow the quoted string value to begin in any column and */ /* allow any number of trailing blanks before the closing quote */ if ( (value[0] != '\'') || /* first char must be a quote */ ( strcmp(xtension, "BINTABLE") && strcmp(xtension, "A3DTABLE") && strcmp(xtension, "3DTABLE") ) ) { sprintf(message, "This is not a BINTABLE extension: %s", value); ffpmsg(message); return(*status = NOT_BTABLE); } } else /* error: 1st keyword of extension != XTENSION */ { sprintf(message, "First keyword of the extension is not XTENSION: %s", name); ffpmsg(message); return(*status = NO_XTENSION); } if (ffgttb(fptr, &naxis1ll, &naxis2ll, &pcountll, &fields, status) > 0) return(*status); if (naxis2) *naxis2 = (long) naxis2ll; if (pcount) *pcount = (long) pcountll; if (tfields) *tfields = fields; if (maxfield < 0) maxf = fields; else maxf = minvalue(maxfield, fields); if (maxf > 0) { for (ii = 0; ii < maxf; ii++) { /* initialize optional keyword values */ if (ttype) *ttype[ii] = '\0'; if (tunit) *tunit[ii] = '\0'; } if (ttype) ffgkns(fptr, "TTYPE", 1, maxf, ttype, &nfound, status); if (tunit) ffgkns(fptr, "TUNIT", 1, maxf, tunit, &nfound, status); if (*status > 0) return(*status); if (tform) { ffgkns(fptr, "TFORM", 1, maxf, tform, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TFORM keyword(s) not found in binary table header (ffghbn)."); return(*status = NO_TFORM); } } } if (extnm) { extnm[0] = '\0'; tstatus = *status; ffgkys(fptr, "EXTNAME", extnm, comm, status); if (*status == KEY_NO_EXIST) *status = tstatus; /* keyword not required, so ignore error */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffghbnll(fitsfile *fptr, /* I - FITS file pointer */ int maxfield, /* I - maximum no. of columns to read; */ LONGLONG *naxis2, /* O - number of rows in the table */ int *tfields, /* O - number of columns in the table */ char **ttype, /* O - name of each column */ char **tform, /* O - TFORMn value for each column */ char **tunit, /* O - TUNITn value for each column */ char *extnm, /* O - value of EXTNAME keyword, if any */ LONGLONG *pcount, /* O - value of PCOUNT keyword */ int *status) /* IO - error status */ /* Get keywords from the Header of the BiNary table: Check that the keywords conform to the FITS standard and return the parameters which describe the table. */ { int ii, maxf, nfound, tstatus; long fields; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xtension[FLEN_VALUE], message[81]; LONGLONG naxis1ll, naxis2ll, pcountll; if (*status > 0) return(*status); /* read the first keyword of the extension */ ffgkyn(fptr, 1, name, value, comm, status); if (!strcmp(name, "XTENSION")) { if (ffc2s(value, xtension, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } /* allow the quoted string value to begin in any column and */ /* allow any number of trailing blanks before the closing quote */ if ( (value[0] != '\'') || /* first char must be a quote */ ( strcmp(xtension, "BINTABLE") && strcmp(xtension, "A3DTABLE") && strcmp(xtension, "3DTABLE") ) ) { sprintf(message, "This is not a BINTABLE extension: %s", value); ffpmsg(message); return(*status = NOT_BTABLE); } } else /* error: 1st keyword of extension != XTENSION */ { sprintf(message, "First keyword of the extension is not XTENSION: %s", name); ffpmsg(message); return(*status = NO_XTENSION); } if (ffgttb(fptr, &naxis1ll, &naxis2ll, &pcountll, &fields, status) > 0) return(*status); if (naxis2) *naxis2 = naxis2ll; if (pcount) *pcount = pcountll; if (tfields) *tfields = fields; if (maxfield < 0) maxf = fields; else maxf = minvalue(maxfield, fields); if (maxf > 0) { for (ii = 0; ii < maxf; ii++) { /* initialize optional keyword values */ if (ttype) *ttype[ii] = '\0'; if (tunit) *tunit[ii] = '\0'; } if (ttype) ffgkns(fptr, "TTYPE", 1, maxf, ttype, &nfound, status); if (tunit) ffgkns(fptr, "TUNIT", 1, maxf, tunit, &nfound, status); if (*status > 0) return(*status); if (tform) { ffgkns(fptr, "TFORM", 1, maxf, tform, &nfound, status); if (*status > 0 || nfound != maxf) { ffpmsg( "Required TFORM keyword(s) not found in binary table header (ffghbn)."); return(*status = NO_TFORM); } } } if (extnm) { extnm[0] = '\0'; tstatus = *status; ffgkys(fptr, "EXTNAME", extnm, comm, status); if (*status == KEY_NO_EXIST) *status = tstatus; /* keyword not required, so ignore error */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffgphd(fitsfile *fptr, /* I - FITS file pointer */ int maxdim, /* I - maximum no. of dimensions to read; */ int *simple, /* O - does file conform to FITS standard? 1/0 */ int *bitpix, /* O - number of bits per data value pixel */ int *naxis, /* O - number of axes in the data array */ LONGLONG naxes[], /* O - length of each data axis */ long *pcount, /* O - number of group parameters (usually 0) */ long *gcount, /* O - number of random groups (usually 1 or 0) */ int *extend, /* O - may FITS file haave extensions? */ double *bscale, /* O - array pixel linear scaling factor */ double *bzero, /* O - array pixel linear scaling zero point */ LONGLONG *blank, /* O - value used to represent undefined pixels */ int *nspace, /* O - number of blank keywords prior to END */ int *status) /* IO - error status */ { /* Get the Primary HeaDer parameters. Check that the keywords conform to the FITS standard and return the parameters which determine the size and structure of the primary array or IMAGE extension. */ int unknown, found_end, tstatus, ii, nextkey, namelen; long longbitpix, longnaxis; LONGLONG axislen; char message[FLEN_ERRMSG], keyword[FLEN_KEYWORD]; char card[FLEN_CARD]; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xtension[FLEN_VALUE]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (simple) *simple = 1; unknown = 0; /*--------------------------------------------------------------------*/ /* Get 1st keyword of HDU and test whether it is SIMPLE or XTENSION */ /*--------------------------------------------------------------------*/ ffgkyn(fptr, 1, name, value, comm, status); if ((fptr->Fptr)->curhdu == 0) /* Is this the beginning of the FITS file? */ { if (!strcmp(name, "SIMPLE")) { if (value[0] == 'F') { if (simple) *simple=0; /* not a simple FITS file */ } else if (value[0] != 'T') return(*status = BAD_SIMPLE); } else { sprintf(message, "First keyword of the file is not SIMPLE: %s", name); ffpmsg(message); return(*status = NO_SIMPLE); } } else /* not beginning of the file, so presumably an IMAGE extension */ { /* or it could be a compressed image in a binary table */ if (!strcmp(name, "XTENSION")) { if (ffc2s(value, xtension, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } /* allow the quoted string value to begin in any column and */ /* allow any number of trailing blanks before the closing quote */ if ( (value[0] != '\'') || /* first char must be a quote */ ( strcmp(xtension, "IMAGE") && strcmp(xtension, "IUEIMAGE") ) ) { unknown = 1; /* unknown type of extension; press on anyway */ sprintf(message, "This is not an IMAGE extension: %s", value); ffpmsg(message); } } else /* error: 1st keyword of extension != XTENSION */ { sprintf(message, "First keyword of the extension is not XTENSION: %s", name); ffpmsg(message); return(*status = NO_XTENSION); } } if (unknown && (fptr->Fptr)->compressimg) { /* this is a compressed image, so read ZBITPIX, ZNAXIS keywords */ unknown = 0; /* reset flag */ ffxmsg(3, message); /* clear previous spurious error message */ if (bitpix) { ffgidt(fptr, bitpix, status); /* get bitpix value */ if (*status > 0) { ffpmsg("Error reading BITPIX value of compressed image"); return(*status); } } if (naxis) { ffgidm(fptr, naxis, status); /* get NAXIS value */ if (*status > 0) { ffpmsg("Error reading NAXIS value of compressed image"); return(*status); } } if (naxes) { ffgiszll(fptr, maxdim, naxes, status); /* get NAXISn value */ if (*status > 0) { ffpmsg("Error reading NAXISn values of compressed image"); return(*status); } } nextkey = 9; /* skip required table keywords in the following search */ } else { /*----------------------------------------------------------------*/ /* Get 2nd keyword; test whether it is BITPIX with legal value */ /*----------------------------------------------------------------*/ ffgkyn(fptr, 2, name, value, comm, status); /* BITPIX = 2nd keyword */ if (strcmp(name, "BITPIX")) { sprintf(message, "Second keyword of the extension is not BITPIX: %s", name); ffpmsg(message); return(*status = NO_BITPIX); } if (ffc2ii(value, &longbitpix, status) > 0) { sprintf(message, "Value of BITPIX keyword is not an integer: %s", value); ffpmsg(message); return(*status = BAD_BITPIX); } else if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG && longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG && longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG) { sprintf(message, "Illegal value for BITPIX keyword: %s", value); ffpmsg(message); return(*status = BAD_BITPIX); } if (bitpix) *bitpix = longbitpix; /* do explicit type conversion */ /*---------------------------------------------------------------*/ /* Get 3rd keyword; test whether it is NAXIS with legal value */ /*---------------------------------------------------------------*/ ffgtkn(fptr, 3, "NAXIS", &longnaxis, status); if (*status == BAD_ORDER) return(*status = NO_NAXIS); else if (*status == NOT_POS_INT || longnaxis > 999) { sprintf(message,"NAXIS = %ld is illegal", longnaxis); ffpmsg(message); return(*status = BAD_NAXIS); } else if (naxis) *naxis = longnaxis; /* do explicit type conversion */ /*---------------------------------------------------------*/ /* Get the next NAXISn keywords and test for legal values */ /*---------------------------------------------------------*/ for (ii=0, nextkey=4; ii < longnaxis; ii++, nextkey++) { ffkeyn("NAXIS", ii+1, keyword, status); ffgtknjj(fptr, 4+ii, keyword, &axislen, status); if (*status == BAD_ORDER) return(*status = NO_NAXES); else if (*status == NOT_POS_INT) return(*status = BAD_NAXES); else if (ii < maxdim) if (naxes) naxes[ii] = axislen; } } /*---------------------------------------------------------*/ /* now look for other keywords of interest: */ /* BSCALE, BZERO, BLANK, PCOUNT, GCOUNT, EXTEND, and END */ /*---------------------------------------------------------*/ /* initialize default values in case keyword is not present */ if (bscale) *bscale = 1.0; if (bzero) *bzero = 0.0; if (pcount) *pcount = 0; if (gcount) *gcount = 1; if (extend) *extend = 0; if (blank) *blank = NULL_UNDEFINED; /* no default null value for BITPIX=8,16,32 */ *nspace = 0; found_end = 0; tstatus = *status; for (; !found_end; nextkey++) { /* get next keyword */ /* don't use ffgkyn here because it trys to parse the card to read */ /* the value string, thus failing to read the file just because of */ /* minor syntax errors in optional keywords. */ if (ffgrec(fptr, nextkey, card, status) > 0 ) /* get the 80-byte card */ { if (*status == KEY_OUT_BOUNDS) { found_end = 1; /* simply hit the end of the header */ *status = tstatus; /* reset error status */ } else { ffpmsg("Failed to find the END keyword in header (ffgphd)."); } } else /* got the next keyword without error */ { ffgknm(card, name, &namelen, status); /* get the keyword name */ if (fftrec(name, status) > 0) /* test keyword name; catches no END */ { sprintf(message, "Name of keyword no. %d contains illegal character(s): %s", nextkey, name); ffpmsg(message); if (nextkey % 36 == 0) /* test if at beginning of 36-card record */ ffpmsg(" (This may indicate a missing END keyword)."); } if (!strcmp(name, "BSCALE") && bscale) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2dd(value, bscale, status) > 0) /* convert to double */ { /* reset error status and continue, but still issue warning */ *status = tstatus; *bscale = 1.0; sprintf(message, "Error reading BSCALE keyword value as a double: %s", value); ffpmsg(message); } } else if (!strcmp(name, "BZERO") && bzero) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2dd(value, bzero, status) > 0) /* convert to double */ { /* reset error status and continue, but still issue warning */ *status = tstatus; *bzero = 0.0; sprintf(message, "Error reading BZERO keyword value as a double: %s", value); ffpmsg(message); } } else if (!strcmp(name, "BLANK") && blank) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2jj(value, blank, status) > 0) /* convert to LONGLONG */ { /* reset error status and continue, but still issue warning */ *status = tstatus; *blank = NULL_UNDEFINED; sprintf(message, "Error reading BLANK keyword value as an integer: %s", value); ffpmsg(message); } } else if (!strcmp(name, "PCOUNT") && pcount) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2ii(value, pcount, status) > 0) /* convert to long */ { sprintf(message, "Error reading PCOUNT keyword value as an integer: %s", value); ffpmsg(message); } } else if (!strcmp(name, "GCOUNT") && gcount) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2ii(value, gcount, status) > 0) /* convert to long */ { sprintf(message, "Error reading GCOUNT keyword value as an integer: %s", value); ffpmsg(message); } } else if (!strcmp(name, "EXTEND") && extend) { *nspace = 0; /* reset count of blank keywords */ ffpsvc(card, value, comm, status); /* parse value and comment */ if (ffc2ll(value, extend, status) > 0) /* convert to logical */ { /* reset error status and continue, but still issue warning */ *status = tstatus; *extend = 0; sprintf(message, "Error reading EXTEND keyword value as a logical: %s", value); ffpmsg(message); } } else if (!strcmp(name, "END")) found_end = 1; else if (!card[0] ) *nspace = *nspace + 1; /* this is a blank card in the header */ else *nspace = 0; /* reset count of blank keywords immediately before the END keyword to zero */ } if (*status > 0) /* exit on error after writing error message */ { if ((fptr->Fptr)->curhdu == 0) ffpmsg( "Failed to read the required primary array header keywords."); else ffpmsg( "Failed to read the required image extension header keywords."); return(*status); } } if (unknown) *status = NOT_IMAGE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgttb(fitsfile *fptr, /* I - FITS file pointer*/ LONGLONG *rowlen, /* O - length of a table row, in bytes */ LONGLONG *nrows, /* O - number of rows in the table */ LONGLONG *pcount, /* O - value of PCOUNT keyword */ long *tfields, /* O - number of fields in the table */ int *status) /* IO - error status */ { /* Get and Test TaBle; Test that this is a legal ASCII or binary table and get some keyword values. We assume that the calling routine has already tested the 1st keyword of the extension to ensure that this is really a table extension. */ if (*status > 0) return(*status); if (fftkyn(fptr, 2, "BITPIX", "8", status) == BAD_ORDER) /* 2nd keyword */ return(*status = NO_BITPIX); /* keyword not BITPIX */ else if (*status == NOT_POS_INT) return(*status = BAD_BITPIX); /* value != 8 */ if (fftkyn(fptr, 3, "NAXIS", "2", status) == BAD_ORDER) /* 3rd keyword */ return(*status = NO_NAXIS); /* keyword not NAXIS */ else if (*status == NOT_POS_INT) return(*status = BAD_NAXIS); /* value != 2 */ if (ffgtknjj(fptr, 4, "NAXIS1", rowlen, status) == BAD_ORDER) /* 4th key */ return(*status = NO_NAXES); /* keyword not NAXIS1 */ else if (*status == NOT_POS_INT) return(*status == BAD_NAXES); /* bad NAXIS1 value */ if (ffgtknjj(fptr, 5, "NAXIS2", nrows, status) == BAD_ORDER) /* 5th key */ return(*status = NO_NAXES); /* keyword not NAXIS2 */ else if (*status == NOT_POS_INT) return(*status == BAD_NAXES); /* bad NAXIS2 value */ if (ffgtknjj(fptr, 6, "PCOUNT", pcount, status) == BAD_ORDER) /* 6th key */ return(*status = NO_PCOUNT); /* keyword not PCOUNT */ else if (*status == NOT_POS_INT) return(*status = BAD_PCOUNT); /* bad PCOUNT value */ if (fftkyn(fptr, 7, "GCOUNT", "1", status) == BAD_ORDER) /* 7th keyword */ return(*status = NO_GCOUNT); /* keyword not GCOUNT */ else if (*status == NOT_POS_INT) return(*status = BAD_GCOUNT); /* value != 1 */ if (ffgtkn(fptr, 8, "TFIELDS", tfields, status) == BAD_ORDER) /* 8th key*/ return(*status = NO_TFIELDS); /* keyword not TFIELDS */ else if (*status == NOT_POS_INT || *tfields > 999) return(*status == BAD_TFIELDS); /* bad TFIELDS value */ if (*status > 0) ffpmsg( "Error reading required keywords in the table header (FTGTTB)."); return(*status); } /*--------------------------------------------------------------------------*/ int ffgtkn(fitsfile *fptr, /* I - FITS file pointer */ int numkey, /* I - number of the keyword to read */ char *name, /* I - expected name of the keyword */ long *value, /* O - integer value of the keyword */ int *status) /* IO - error status */ { /* test that keyword number NUMKEY has the expected name and get the integer value of the keyword. Return an error if the keyword name does not match the input name, or if the value of the keyword is not a positive integer. */ char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE]; char comm[FLEN_COMMENT], message[FLEN_ERRMSG]; if (*status > 0) return(*status); keyname[0] = '\0'; valuestring[0] = '\0'; if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0) { if (strcmp(keyname, name) ) *status = BAD_ORDER; /* incorrect keyword name */ else { ffc2ii(valuestring, value, status); /* convert to integer */ if (*status > 0 || *value < 0 ) *status = NOT_POS_INT; } if (*status > 0) { sprintf(message, "ffgtkn found unexpected keyword or value for keyword no. %d.", numkey); ffpmsg(message); sprintf(message, " Expected positive integer keyword %s, but instead", name); ffpmsg(message); sprintf(message, " found keyword %s with value %s", keyname, valuestring); ffpmsg(message); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgtknjj(fitsfile *fptr, /* I - FITS file pointer */ int numkey, /* I - number of the keyword to read */ char *name, /* I - expected name of the keyword */ LONGLONG *value, /* O - integer value of the keyword */ int *status) /* IO - error status */ { /* test that keyword number NUMKEY has the expected name and get the integer value of the keyword. Return an error if the keyword name does not match the input name, or if the value of the keyword is not a positive integer. */ char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE]; char comm[FLEN_COMMENT], message[FLEN_ERRMSG]; if (*status > 0) return(*status); keyname[0] = '\0'; valuestring[0] = '\0'; if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0) { if (strcmp(keyname, name) ) *status = BAD_ORDER; /* incorrect keyword name */ else { ffc2jj(valuestring, value, status); /* convert to integer */ if (*status > 0 || *value < 0 ) *status = NOT_POS_INT; } if (*status > 0) { sprintf(message, "ffgtknjj found unexpected keyword or value for keyword no. %d.", numkey); ffpmsg(message); sprintf(message, " Expected positive integer keyword %s, but instead", name); ffpmsg(message); sprintf(message, " found keyword %s with value %s", keyname, valuestring); ffpmsg(message); } } return(*status); } /*--------------------------------------------------------------------------*/ int fftkyn(fitsfile *fptr, /* I - FITS file pointer */ int numkey, /* I - number of the keyword to read */ char *name, /* I - expected name of the keyword */ char *value, /* I - expected value of the keyword */ int *status) /* IO - error status */ { /* test that keyword number NUMKEY has the expected name and the expected value string. */ char keyname[FLEN_KEYWORD], valuestring[FLEN_VALUE]; char comm[FLEN_COMMENT], message[FLEN_ERRMSG]; if (*status > 0) return(*status); keyname[0] = '\0'; valuestring[0] = '\0'; if (ffgkyn(fptr, numkey, keyname, valuestring, comm, status) <= 0) { if (strcmp(keyname, name) ) *status = BAD_ORDER; /* incorrect keyword name */ if (strcmp(value, valuestring) ) *status = NOT_POS_INT; /* incorrect keyword value */ } if (*status > 0) { sprintf(message, "fftkyn found unexpected keyword or value for keyword no. %d.", numkey); ffpmsg(message); sprintf(message, " Expected keyword %s with value %s, but", name, value); ffpmsg(message); sprintf(message, " found keyword %s with value %s", keyname, valuestring); ffpmsg(message); } return(*status); } /*--------------------------------------------------------------------------*/ int ffh2st(fitsfile *fptr, /* I - FITS file pointer */ char **header, /* O - returned header string */ int *status) /* IO - error status */ /* read header keywords into a long string of chars. This routine allocates memory for the string, so the calling routine must eventually free the memory when it is not needed any more. */ { int nkeys; long nrec; LONGLONG headstart; if (*status > 0) return(*status); /* get number of keywords in the header (doesn't include END) */ if (ffghsp(fptr, &nkeys, NULL, status) > 0) return(*status); nrec = (nkeys / 36 + 1); /* allocate memory for all the keywords (multiple of 2880 bytes) */ *header = (char *) calloc ( nrec * 2880 + 1, 1); if (!(*header)) { *status = MEMORY_ALLOCATION; ffpmsg("failed to allocate memory to hold all the header keywords"); return(*status); } ffghadll(fptr, &headstart, NULL, NULL, status); /* get header address */ ffmbyt(fptr, headstart, REPORT_EOF, status); /* move to header */ ffgbyt(fptr, nrec * 2880, *header, status); /* copy header */ *(*header + (nrec * 2880)) = '\0'; return(*status); } /*--------------------------------------------------------------------------*/ int ffhdr2str( fitsfile *fptr, /* I - FITS file pointer */ int exclude_comm, /* I - if TRUE, exclude commentary keywords */ char **exclist, /* I - list of excluded keyword names */ int nexc, /* I - number of names in exclist */ char **header, /* O - returned header string */ int *nkeys, /* O - returned number of 80-char keywords */ int *status) /* IO - error status */ /* read header keywords into a long string of chars. This routine allocates memory for the string, so the calling routine must eventually free the memory when it is not needed any more. If exclude_comm is TRUE, then all the COMMENT, HISTORY, and keywords will be excluded from the output string of keywords. Any other list of keywords to be excluded may be specified with the exclist parameter. */ { int casesn, match, exact, totkeys; long ii, jj; char keybuf[162], keyname[FLEN_KEYWORD], *headptr; *nkeys = 0; if (*status > 0) return(*status); /* get number of keywords in the header (doesn't include END) */ if (ffghsp(fptr, &totkeys, NULL, status) > 0) return(*status); /* allocate memory for all the keywords */ /* (will reallocate it later to minimize the memory size) */ *header = (char *) calloc ( (totkeys + 1) * 80 + 1, 1); if (!(*header)) { *status = MEMORY_ALLOCATION; ffpmsg("failed to allocate memory to hold all the header keywords"); return(*status); } headptr = *header; casesn = FALSE; /* read every keyword */ for (ii = 1; ii <= totkeys; ii++) { ffgrec(fptr, ii, keybuf, status); /* pad record with blanks so that it is at least 80 chars long */ strcat(keybuf, " "); keyname[0] = '\0'; strncat(keyname, keybuf, 8); /* copy the keyword name */ if (exclude_comm) { if (!FSTRCMP("COMMENT ", keyname) || !FSTRCMP("HISTORY ", keyname) || !FSTRCMP(" ", keyname) ) continue; /* skip this commentary keyword */ } /* does keyword match any names in the exclusion list? */ for (jj = 0; jj < nexc; jj++ ) { ffcmps(exclist[jj], keyname, casesn, &match, &exact); if (match) break; } if (jj == nexc) { /* not in exclusion list, add this keyword to the string */ strcpy(headptr, keybuf); headptr += 80; (*nkeys)++; } } /* add the END keyword */ strcpy(headptr, "END "); headptr += 80; (*nkeys)++; *headptr = '\0'; /* terminate the header string */ /* minimize the allocated memory */ *header = (char *) realloc(*header, (*nkeys *80) + 1); return(*status); } /*--------------------------------------------------------------------------*/ int ffcnvthdr2str( fitsfile *fptr, /* I - FITS file pointer */ int exclude_comm, /* I - if TRUE, exclude commentary keywords */ char **exclist, /* I - list of excluded keyword names */ int nexc, /* I - number of names in exclist */ char **header, /* O - returned header string */ int *nkeys, /* O - returned number of 80-char keywords */ int *status) /* IO - error status */ /* Same as ffhdr2str, except that if the input HDU is a tile compressed image (stored in a binary table) then it will first convert that header back to that of a normal uncompressed FITS image before concatenating the header keyword records. */ { fitsfile *tempfptr; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status) ) { /* this is a tile compressed image, so need to make an uncompressed */ /* copy of the image header in memory before concatenating the keywords */ if (fits_create_file(&tempfptr, "mem://", status) > 0) { return(*status); } if (fits_img_decompress_header(fptr, tempfptr, status) > 0) { fits_delete_file(tempfptr, status); return(*status); } ffhdr2str(tempfptr, exclude_comm, exclist, nexc, header, nkeys, status); fits_close_file(tempfptr, status); } else { ffhdr2str(fptr, exclude_comm, exclist, nexc, header, nkeys, status); } return(*status); } astropy-0.3/cextern/cfitsio/zcompress.c0000644000175000017500000004230412243255342016503 0ustar oleole#include #include #include #include #include "zlib.h" unsigned int GZBUFSIZE = 115200; /* 40 FITS blocks */ int BUFFINCR = 28800; /* 10 FITS blocks */ /* prototype for the following functions */ int uncompress2mem(char *filename, FILE *diskfile, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int uncompress2mem_from_mem( char *inmemptr, size_t inmemsize, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int uncompress2file(char *filename, FILE *indiskfile, FILE *outdiskfile, int *status); int compress2mem_from_mem( char *inmemptr, size_t inmemsize, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int compress2file_from_mem( char *inmemptr, size_t inmemsize, FILE *outdiskfile, size_t *filesize, /* O - size of file, in bytes */ int *status); /*--------------------------------------------------------------------------*/ int uncompress2mem(char *filename, /* name of input file */ FILE *diskfile, /* I - file pointer */ char **buffptr, /* IO - memory pointer */ size_t *buffsize, /* IO - size of buffer, in bytes */ void *(*mem_realloc)(void *p, size_t newsize), /* function */ size_t *filesize, /* O - size of file, in bytes */ int *status) /* IO - error status */ /* Uncompress the disk file into memory. Fill whatever amount of memory has already been allocated, then realloc more memory, using the supplied input function, if necessary. */ { int err, len; char *filebuff; z_stream d_stream; /* decompression stream */ if (*status > 0) return(*status); /* Allocate memory to hold compressed bytes read from the file. */ filebuff = (char*)malloc(GZBUFSIZE); if (!filebuff) return(*status = 113); /* memory error */ d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; d_stream.next_out = (unsigned char*) *buffptr; d_stream.avail_out = *buffsize; /* Initialize the decompression. The argument (15+16) tells the decompressor that we are to use the gzip algorithm */ err = inflateInit2(&d_stream, (15+16)); if (err != Z_OK) return(*status = 414); /* loop through the file, reading a buffer and uncompressing it */ for (;;) { len = fread(filebuff, 1, GZBUFSIZE, diskfile); if (ferror(diskfile)) { inflateEnd(&d_stream); free(filebuff); return(*status = 414); } if (len == 0) break; /* no more data */ d_stream.next_in = (unsigned char*)filebuff; d_stream.avail_in = len; for (;;) { /* uncompress as much of the input as will fit in the output */ err = inflate(&d_stream, Z_NO_FLUSH); if (err == Z_STREAM_END ) { /* We reached the end of the input */ break; } else if (err == Z_OK ) { if (!d_stream.avail_in) break; /* need more input */ /* need more space in output buffer */ if (mem_realloc) { *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR); if (*buffptr == NULL){ inflateEnd(&d_stream); free(filebuff); return(*status = 414); /* memory allocation failed */ } d_stream.avail_out = BUFFINCR; d_stream.next_out = (unsigned char*) (*buffptr + *buffsize); *buffsize = *buffsize + BUFFINCR; } else { /* error: no realloc function available */ inflateEnd(&d_stream); free(filebuff); return(*status = 414); } } else { /* some other error */ inflateEnd(&d_stream); free(filebuff); return(*status = 414); } } if (feof(diskfile)) break; d_stream.next_out = (unsigned char*) (*buffptr + d_stream.total_out); d_stream.avail_out = *buffsize - d_stream.total_out; } /* Set the output file size to be the total output data */ *filesize = d_stream.total_out; free(filebuff); /* free temporary output data buffer */ err = inflateEnd(&d_stream); /* End the decompression */ if (err != Z_OK) return(*status = 414); return(*status); } /*--------------------------------------------------------------------------*/ int uncompress2mem_from_mem( char *inmemptr, /* I - memory pointer to compressed bytes */ size_t inmemsize, /* I - size of input compressed file */ char **buffptr, /* IO - memory pointer */ size_t *buffsize, /* IO - size of buffer, in bytes */ void *(*mem_realloc)(void *p, size_t newsize), /* function */ size_t *filesize, /* O - size of file, in bytes */ int *status) /* IO - error status */ /* Uncompress the file in memory into memory. Fill whatever amount of memory has already been allocated, then realloc more memory, using the supplied input function, if necessary. */ { int err; z_stream d_stream; /* decompression stream */ if (*status > 0) return(*status); d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; /* Initialize the decompression. The argument (15+16) tells the decompressor that we are to use the gzip algorithm */ err = inflateInit2(&d_stream, (15+16)); if (err != Z_OK) return(*status = 414); d_stream.next_in = (unsigned char*)inmemptr; d_stream.avail_in = inmemsize; d_stream.next_out = (unsigned char*) *buffptr; d_stream.avail_out = *buffsize; for (;;) { /* uncompress as much of the input as will fit in the output */ err = inflate(&d_stream, Z_NO_FLUSH); if (err == Z_STREAM_END) { /* We reached the end of the input */ break; } else if (err == Z_OK ) { /* need more space in output buffer */ if (mem_realloc) { *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR); if (*buffptr == NULL){ inflateEnd(&d_stream); return(*status = 414); /* memory allocation failed */ } d_stream.avail_out = BUFFINCR; d_stream.next_out = (unsigned char*) (*buffptr + *buffsize); *buffsize = *buffsize + BUFFINCR; } else { /* error: no realloc function available */ inflateEnd(&d_stream); return(*status = 414); } } else { /* some other error */ inflateEnd(&d_stream); return(*status = 414); } } /* Set the output file size to be the total output data */ if (filesize) *filesize = d_stream.total_out; /* End the decompression */ err = inflateEnd(&d_stream); if (err != Z_OK) return(*status = 414); return(*status); } /*--------------------------------------------------------------------------*/ int uncompress2file(char *filename, /* name of input file */ FILE *indiskfile, /* I - input file pointer */ FILE *outdiskfile, /* I - output file pointer */ int *status) /* IO - error status */ /* Uncompress the file into another file. */ { int err, len; unsigned long bytes_out = 0; char *infilebuff, *outfilebuff; z_stream d_stream; /* decompression stream */ if (*status > 0) return(*status); /* Allocate buffers to hold compressed and uncompressed */ infilebuff = (char*)malloc(GZBUFSIZE); if (!infilebuff) return(*status = 113); /* memory error */ outfilebuff = (char*)malloc(GZBUFSIZE); if (!outfilebuff) return(*status = 113); /* memory error */ d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; d_stream.next_out = (unsigned char*) outfilebuff; d_stream.avail_out = GZBUFSIZE; /* Initialize the decompression. The argument (15+16) tells the decompressor that we are to use the gzip algorithm */ err = inflateInit2(&d_stream, (15+16)); if (err != Z_OK) return(*status = 414); /* loop through the file, reading a buffer and uncompressing it */ for (;;) { len = fread(infilebuff, 1, GZBUFSIZE, indiskfile); if (ferror(indiskfile)) { inflateEnd(&d_stream); free(infilebuff); free(outfilebuff); return(*status = 414); } if (len == 0) break; /* no more data */ d_stream.next_in = (unsigned char*)infilebuff; d_stream.avail_in = len; for (;;) { /* uncompress as much of the input as will fit in the output */ err = inflate(&d_stream, Z_NO_FLUSH); if (err == Z_STREAM_END ) { /* We reached the end of the input */ break; } else if (err == Z_OK ) { if (!d_stream.avail_in) break; /* need more input */ /* flush out the full output buffer */ if ((int)fwrite(outfilebuff, 1, GZBUFSIZE, outdiskfile) != GZBUFSIZE) { inflateEnd(&d_stream); free(infilebuff); free(outfilebuff); return(*status = 414); } bytes_out += GZBUFSIZE; d_stream.next_out = (unsigned char*) outfilebuff; d_stream.avail_out = GZBUFSIZE; } else { /* some other error */ inflateEnd(&d_stream); free(infilebuff); free(outfilebuff); return(*status = 414); } } if (feof(indiskfile)) break; } /* write out any remaining bytes in the buffer */ if (d_stream.total_out > bytes_out) { if ((int)fwrite(outfilebuff, 1, (d_stream.total_out - bytes_out), outdiskfile) != (d_stream.total_out - bytes_out)) { inflateEnd(&d_stream); free(infilebuff); free(outfilebuff); return(*status = 414); } } free(infilebuff); /* free temporary output data buffer */ free(outfilebuff); /* free temporary output data buffer */ err = inflateEnd(&d_stream); /* End the decompression */ if (err != Z_OK) return(*status = 414); return(*status); } /*--------------------------------------------------------------------------*/ int compress2mem_from_mem( char *inmemptr, /* I - memory pointer to uncompressed bytes */ size_t inmemsize, /* I - size of input uncompressed file */ char **buffptr, /* IO - memory pointer for compressed file */ size_t *buffsize, /* IO - size of buffer, in bytes */ void *(*mem_realloc)(void *p, size_t newsize), /* function */ size_t *filesize, /* O - size of file, in bytes */ int *status) /* IO - error status */ /* Compress the file into memory. Fill whatever amount of memory has already been allocated, then realloc more memory, using the supplied input function, if necessary. */ { int err; z_stream c_stream; /* compression stream */ if (*status > 0) return(*status); c_stream.zalloc = (alloc_func)0; c_stream.zfree = (free_func)0; c_stream.opaque = (voidpf)0; /* Initialize the compression. The argument (15+16) tells the compressor that we are to use the gzip algorythm. Also use Z_BEST_SPEED for maximum speed with very minor loss in compression factor. */ err = deflateInit2(&c_stream, Z_BEST_SPEED, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY); if (err != Z_OK) return(*status = 413); c_stream.next_in = (unsigned char*)inmemptr; c_stream.avail_in = inmemsize; c_stream.next_out = (unsigned char*) *buffptr; c_stream.avail_out = *buffsize; for (;;) { /* compress as much of the input as will fit in the output */ err = deflate(&c_stream, Z_FINISH); if (err == Z_STREAM_END) { /* We reached the end of the input */ break; } else if (err == Z_OK ) { /* need more space in output buffer */ if (mem_realloc) { *buffptr = mem_realloc(*buffptr,*buffsize + BUFFINCR); if (*buffptr == NULL){ deflateEnd(&c_stream); return(*status = 413); /* memory allocation failed */ } c_stream.avail_out = BUFFINCR; c_stream.next_out = (unsigned char*) (*buffptr + *buffsize); *buffsize = *buffsize + BUFFINCR; } else { /* error: no realloc function available */ deflateEnd(&c_stream); return(*status = 413); } } else { /* some other error */ deflateEnd(&c_stream); return(*status = 413); } } /* Set the output file size to be the total output data */ if (filesize) *filesize = c_stream.total_out; /* End the compression */ err = deflateEnd(&c_stream); if (err != Z_OK) return(*status = 413); return(*status); } /*--------------------------------------------------------------------------*/ int compress2file_from_mem( char *inmemptr, /* I - memory pointer to uncompressed bytes */ size_t inmemsize, /* I - size of input uncompressed file */ FILE *outdiskfile, size_t *filesize, /* O - size of file, in bytes */ int *status) /* Compress the memory file into disk file. */ { int err; unsigned long bytes_out = 0; char *outfilebuff; z_stream c_stream; /* compression stream */ if (*status > 0) return(*status); /* Allocate buffer to hold compressed bytes */ outfilebuff = (char*)malloc(GZBUFSIZE); if (!outfilebuff) return(*status = 113); /* memory error */ c_stream.zalloc = (alloc_func)0; c_stream.zfree = (free_func)0; c_stream.opaque = (voidpf)0; /* Initialize the compression. The argument (15+16) tells the compressor that we are to use the gzip algorythm. Also use Z_BEST_SPEED for maximum speed with very minor loss in compression factor. */ err = deflateInit2(&c_stream, Z_BEST_SPEED, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY); if (err != Z_OK) return(*status = 413); c_stream.next_in = (unsigned char*)inmemptr; c_stream.avail_in = inmemsize; c_stream.next_out = (unsigned char*) outfilebuff; c_stream.avail_out = GZBUFSIZE; for (;;) { /* compress as much of the input as will fit in the output */ err = deflate(&c_stream, Z_FINISH); if (err == Z_STREAM_END) { /* We reached the end of the input */ break; } else if (err == Z_OK ) { /* need more space in output buffer */ /* flush out the full output buffer */ if ((int)fwrite(outfilebuff, 1, GZBUFSIZE, outdiskfile) != GZBUFSIZE) { deflateEnd(&c_stream); free(outfilebuff); return(*status = 413); } bytes_out += GZBUFSIZE; c_stream.next_out = (unsigned char*) outfilebuff; c_stream.avail_out = GZBUFSIZE; } else { /* some other error */ deflateEnd(&c_stream); free(outfilebuff); return(*status = 413); } } /* write out any remaining bytes in the buffer */ if (c_stream.total_out > bytes_out) { if ((int)fwrite(outfilebuff, 1, (c_stream.total_out - bytes_out), outdiskfile) != (c_stream.total_out - bytes_out)) { deflateEnd(&c_stream); free(outfilebuff); return(*status = 413); } } free(outfilebuff); /* free temporary output data buffer */ /* Set the output file size to be the total output data */ if (filesize) *filesize = c_stream.total_out; /* End the compression */ err = deflateEnd(&c_stream); if (err != Z_OK) return(*status = 413); return(*status); } astropy-0.3/cextern/cfitsio/getcoll.c0000644000175000017500000005514112243255342016112 0ustar oleole/* This file, getcoll.c, contains routines that read data elements from */ /* a FITS image or table, with logical datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgcvl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ char nulval, /* I - value for null pixels */ char *array, /* O - array of values */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of logical values from a column in the current FITS HDU. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcll( fptr, colnum, firstrow, firstelem, nelem, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ char *array, /* O - array of values */ int *status) /* IO - error status */ /* !!!! THIS ROUTINE IS DEPRECATED AND SHOULD NOT BE USED !!!!!! !!!! USE ffgcvl INSTEAD !!!!!! Read an array of logical values from a column in the current FITS HDU. No checking for null values will be performed. */ { char nulval = 0; int anynul; ffgcvl( fptr, colnum, firstrow, firstelem, nelem, nulval, array, &anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ char *array, /* O - array of values */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of logical values from a column in the current FITS HDU. */ { char nulval = 0; ffgcll( fptr, colnum, firstrow, firstelem, nelem, 2, nulval, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ char nulval, /* I - value for null pixels if nultyp = 1 */ char *array, /* O - array of values */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of logical values from a column in the current FITS HDU. */ { double dtemp; int tcode, maxelem, hdutype, ii, nulcheck; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, readptr, tnull, rowlen, rownum, remain, next; double scale, zero; char tform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ unsigned char buffer[DBUFFSIZE], *buffptr; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode != TLOGICAL) return(*status = NOT_LOGICAL_COL); /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default, check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ /*---------------------------------------------------------------------*/ /* Now read the logical values from the FITS column. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ ntodo = (long) remain; /* max number of elements to read at one time */ while (ntodo) { /* limit the number of pixels to read at one time to the number that remain in the current vector. */ ntodo = (long) minvalue(ntodo, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); readptr = startpos + (rowlen * rownum) + (elemnum * incre); ffgi1b(fptr, readptr, ntodo, incre, buffer, status); /* convert from T or F to 1 or 0 */ buffptr = buffer; for (ii = 0; ii < ntodo; ii++, next++, buffptr++) { if (*buffptr == 'T') array[next] = 1; else if (*buffptr =='F') array[next] = 0; else if (*buffptr == 0) { array[next] = nulval; /* set null values to input nulval */ if (anynul) *anynul = 1; if (nulcheck == 2) { nularray[next] = 1; /* set null flags */ } } else /* some other illegal character; return the char value */ { if (*buffptr == 1) { /* this is an unfortunate case where the illegal value is the same as what we set True values to, so set the value to the character '1' instead, which has ASCII value 49. */ array[next] = 49; } else { array[next] = (char) *buffptr; } } } if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; sprintf(message, "Error reading elements %.0f thruough %.0f of logical array (ffgcl).", dtemp+1., dtemp + ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on later row */ { elemnum = 0; rownum++; } } ntodo = (long) remain; /* this is the maximum number to do in next loop */ } /* End of main while Loop */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgcx( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG frow, /* I - first row to write (1 = 1st row) */ LONGLONG fbit, /* I - first bit to write (1 = 1st) */ LONGLONG nbit, /* I - number of bits to write */ char *larray, /* O - array of logicals corresponding to bits */ int *status) /* IO - error status */ /* read an array of logical values from a specified bit or byte column of the binary table. larray is set = TRUE, if the corresponding bit = 1, otherwise it is set to FALSE. The binary table column being read from must have datatype 'B' or 'X'. */ { LONGLONG bstart; long offset, ndone, ii, repeat, bitloc, fbyte; LONGLONG rstart, estart; int tcode, descrp; unsigned char cbuff; static unsigned char onbit[8] = {128, 64, 32, 16, 8, 4, 2, 1}; tcolumn *colptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check input parameters */ if (nbit < 1) return(*status); else if (frow < 1) return(*status = BAD_ROW_NUM); else if (fbit < 1) return(*status = BAD_ELEM_NUM); /* position to the correct HDU */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); fbyte = (long) ((fbit + 7) / 8); bitloc = (long) (fbit - 1 - ((fbit - 1) / 8 * 8)); ndone = 0; rstart = frow - 1; estart = fbyte - 1; colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (abs(tcode) > TBYTE) return(*status = NOT_LOGICAL_COL); /* not correct datatype column */ if (tcode > 0) { descrp = FALSE; /* not a variable length descriptor column */ /* N.B: REPEAT is the number of bytes, not number of bits */ repeat = (long) colptr->trepeat; if (tcode == TBIT) repeat = (repeat + 7) / 8; /* convert from bits to bytes */ if (fbyte > repeat) return(*status = BAD_ELEM_NUM); /* calc the i/o pointer location to start of sequence of pixels */ bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) + colptr->tbcol + estart; } else { descrp = TRUE; /* a variable length descriptor column */ /* only bit arrays (tform = 'X') are supported for variable */ /* length arrays. REPEAT is the number of BITS in the array. */ ffgdes(fptr, colnum, frow, &repeat, &offset, status); if (tcode == -TBIT) repeat = (repeat + 7) / 8; if ((fbit + nbit + 6) / 8 > repeat) return(*status = BAD_ELEM_NUM); /* calc the i/o pointer location to start of sequence of pixels */ bstart = (fptr->Fptr)->datastart + offset + (fptr->Fptr)->heapstart + estart; } /* move the i/o pointer to the start of the pixel sequence */ if (ffmbyt(fptr, bstart, REPORT_EOF, status) > 0) return(*status); /* read the next byte */ while (1) { if (ffgbyt(fptr, 1, &cbuff, status) > 0) return(*status); for (ii = bitloc; (ii < 8) && (ndone < nbit); ii++, ndone++) { if(cbuff & onbit[ii]) /* test if bit is set */ larray[ndone] = TRUE; else larray[ndone] = FALSE; } if (ndone == nbit) /* finished all the bits */ return(*status); /* not done, so get the next byte */ if (!descrp) { estart++; if (estart == repeat) { /* move the i/o pointer to the next row of pixels */ estart = 0; rstart = rstart + 1; bstart = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * rstart) + colptr->tbcol; ffmbyt(fptr, bstart, REPORT_EOF, status); } } bitloc = 0; } } /*--------------------------------------------------------------------------*/ int ffgcxui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG nrows, /* I - no. of rows to read */ long input_first_bit, /* I - first bit to read (1 = 1st) */ int input_nbits, /* I - number of bits to read (<= 32) */ unsigned short *array, /* O - array of integer values */ int *status) /* IO - error status */ /* Read a consecutive string of bits from an 'X' or 'B' column and interprete them as an unsigned integer. The number of bits must be less than or equal to 16 or the total number of bits in the column, which ever is less. */ { int ii, firstbit, nbits, bytenum, startbit, numbits, endbit; int firstbyte, lastbyte, nbytes, rshift, lshift; unsigned short colbyte[5]; tcolumn *colptr; char message[81]; if (*status > 0 || nrows == 0) return(*status); /* check input parameters */ if (firstrow < 1) { sprintf(message, "Starting row number is less than 1: %ld (ffgcxui)", (long) firstrow); ffpmsg(message); return(*status = BAD_ROW_NUM); } else if (input_first_bit < 1) { sprintf(message, "Starting bit number is less than 1: %ld (ffgcxui)", input_first_bit); ffpmsg(message); return(*status = BAD_ELEM_NUM); } else if (input_nbits > 16) { sprintf(message, "Number of bits to read is > 16: %d (ffgcxui)", input_nbits); ffpmsg(message); return(*status = BAD_ELEM_NUM); } /* position to the correct HDU */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype != BINARY_TBL) { ffpmsg("This is not a binary table extension (ffgcxui)"); return(*status = NOT_BTABLE); } if (colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d (ffgcxui)", colnum); ffpmsg(message); sprintf(message, " There are %d columns in this table.", (fptr->Fptr)->tfield ); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ if (abs(colptr->tdatatype) > TBYTE) { ffpmsg("Can only read bits from X or B type columns. (ffgcxui)"); return(*status = NOT_LOGICAL_COL); /* not correct datatype column */ } firstbyte = (input_first_bit - 1 ) / 8 + 1; lastbyte = (input_first_bit + input_nbits - 2) / 8 + 1; nbytes = lastbyte - firstbyte + 1; if (colptr->tdatatype == TBIT && input_first_bit + input_nbits - 1 > (long) colptr->trepeat) { ffpmsg("Too many bits. Tried to read past width of column (ffgcxui)"); return(*status = BAD_ELEM_NUM); } else if (colptr->tdatatype == TBYTE && lastbyte > (long) colptr->trepeat) { ffpmsg("Too many bits. Tried to read past width of column (ffgcxui)"); return(*status = BAD_ELEM_NUM); } for (ii = 0; ii < nrows; ii++) { /* read the relevant bytes from the row */ if (ffgcvui(fptr, colnum, firstrow+ii, firstbyte, nbytes, 0, colbyte, NULL, status) > 0) { ffpmsg("Error reading bytes from column (ffgcxui)"); return(*status); } firstbit = (input_first_bit - 1) % 8; /* modulus operator */ nbits = input_nbits; array[ii] = 0; /* select and shift the bits from each byte into the output word */ while(nbits) { bytenum = firstbit / 8; startbit = firstbit % 8; numbits = minvalue(nbits, 8 - startbit); endbit = startbit + numbits - 1; rshift = 7 - endbit; lshift = nbits - numbits; array[ii] = ((colbyte[bytenum] >> rshift) << lshift) | array[ii]; nbits -= numbits; firstbit += numbits; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgcxuk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG nrows, /* I - no. of rows to read */ long input_first_bit, /* I - first bit to read (1 = 1st) */ int input_nbits, /* I - number of bits to read (<= 32) */ unsigned int *array, /* O - array of integer values */ int *status) /* IO - error status */ /* Read a consecutive string of bits from an 'X' or 'B' column and interprete them as an unsigned integer. The number of bits must be less than or equal to 32 or the total number of bits in the column, which ever is less. */ { int ii, firstbit, nbits, bytenum, startbit, numbits, endbit; int firstbyte, lastbyte, nbytes, rshift, lshift; unsigned int colbyte[5]; tcolumn *colptr; char message[81]; if (*status > 0 || nrows == 0) return(*status); /* check input parameters */ if (firstrow < 1) { sprintf(message, "Starting row number is less than 1: %ld (ffgcxuk)", (long) firstrow); ffpmsg(message); return(*status = BAD_ROW_NUM); } else if (input_first_bit < 1) { sprintf(message, "Starting bit number is less than 1: %ld (ffgcxuk)", input_first_bit); ffpmsg(message); return(*status = BAD_ELEM_NUM); } else if (input_nbits > 32) { sprintf(message, "Number of bits to read is > 32: %d (ffgcxuk)", input_nbits); ffpmsg(message); return(*status = BAD_ELEM_NUM); } /* position to the correct HDU */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype != BINARY_TBL) { ffpmsg("This is not a binary table extension (ffgcxuk)"); return(*status = NOT_BTABLE); } if (colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d (ffgcxuk)", colnum); ffpmsg(message); sprintf(message, " There are %d columns in this table.", (fptr->Fptr)->tfield ); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ if (abs(colptr->tdatatype) > TBYTE) { ffpmsg("Can only read bits from X or B type columns. (ffgcxuk)"); return(*status = NOT_LOGICAL_COL); /* not correct datatype column */ } firstbyte = (input_first_bit - 1 ) / 8 + 1; lastbyte = (input_first_bit + input_nbits - 2) / 8 + 1; nbytes = lastbyte - firstbyte + 1; if (colptr->tdatatype == TBIT && input_first_bit + input_nbits - 1 > (long) colptr->trepeat) { ffpmsg("Too many bits. Tried to read past width of column (ffgcxuk)"); return(*status = BAD_ELEM_NUM); } else if (colptr->tdatatype == TBYTE && lastbyte > (long) colptr->trepeat) { ffpmsg("Too many bits. Tried to read past width of column (ffgcxuk)"); return(*status = BAD_ELEM_NUM); } for (ii = 0; ii < nrows; ii++) { /* read the relevant bytes from the row */ if (ffgcvuk(fptr, colnum, firstrow+ii, firstbyte, nbytes, 0, colbyte, NULL, status) > 0) { ffpmsg("Error reading bytes from column (ffgcxuk)"); return(*status); } firstbit = (input_first_bit - 1) % 8; /* modulus operator */ nbits = input_nbits; array[ii] = 0; /* select and shift the bits from each byte into the output word */ while(nbits) { bytenum = firstbit / 8; startbit = firstbit % 8; numbits = minvalue(nbits, 8 - startbit); endbit = startbit + numbits - 1; rshift = 7 - endbit; lshift = nbits - numbits; array[ii] = ((colbyte[bytenum] >> rshift) << lshift) | array[ii]; nbits -= numbits; firstbit += numbits; } } return(*status); } astropy-0.3/cextern/cfitsio/putkey.c0000644000175000017500000032205212243255342016000 0ustar oleole/* This file, putkey.c, contains routines that write keywords to */ /* a FITS header. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include /* stddef.h is apparently needed to define size_t */ #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffcrim(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ long *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* create an IMAGE extension following the current HDU. If the current HDU is empty (contains no header keywords), then simply write the required image (or primary array) keywords to the current HDU. */ { if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* create new extension if current header is not empty */ if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) ffcrhd(fptr, status); /* write the required header keywords */ ffphpr(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffcrimll(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ LONGLONG *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* create an IMAGE extension following the current HDU. If the current HDU is empty (contains no header keywords), then simply write the required image (or primary array) keywords to the current HDU. */ { if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* create new extension if current header is not empty */ if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) ffcrhd(fptr, status); /* write the required header keywords */ ffphprll(fptr, TRUE, bitpix, naxis, naxes, 0, 1, TRUE, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffcrtb(fitsfile *fptr, /* I - FITS file pointer */ int tbltype, /* I - type of table to create */ LONGLONG naxis2, /* I - number of rows in the table */ int tfields, /* I - number of columns in the table */ char **ttype, /* I - name of each column */ char **tform, /* I - value of TFORMn keyword for each column */ char **tunit, /* I - value of TUNITn keyword for each column */ const char *extnm, /* I - value of EXTNAME keyword, if any */ int *status) /* IO - error status */ /* Create a table extension in a FITS file. */ { LONGLONG naxis1 = 0; long *tbcol = 0; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* create new extension if current header is not empty */ if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) ffcrhd(fptr, status); if ((fptr->Fptr)->curhdu == 0) /* have to create dummy primary array */ { ffcrim(fptr, 16, 0, tbcol, status); ffcrhd(fptr, status); } if (tbltype == BINARY_TBL) { /* write the required header keywords. This will write PCOUNT = 0 */ ffphbn(fptr, naxis2, tfields, ttype, tform, tunit, extnm, 0, status); } else if (tbltype == ASCII_TBL) { /* write the required header keywords */ /* default values for naxis1 and tbcol will be calculated */ ffphtb(fptr, naxis1, naxis2, tfields, ttype, tbcol, tform, tunit, extnm, status); } else *status = NOT_TABLE; return(*status); } /*-------------------------------------------------------------------------*/ int ffpktp(fitsfile *fptr, /* I - FITS file pointer */ const char *filename, /* I - name of template file */ int *status) /* IO - error status */ /* read keywords from template file and append to the FITS file */ { FILE *diskfile; char card[FLEN_CARD], template[161]; char keyname[FLEN_KEYWORD], newname[FLEN_KEYWORD]; int keytype; size_t slen; if (*status > 0) /* inherit input status value if > 0 */ return(*status); diskfile = fopen(filename,"r"); if (!diskfile) /* couldn't open file */ { ffpmsg("ffpktp could not open the following template file:"); ffpmsg(filename); return(*status = FILE_NOT_OPENED); } while (fgets(template, 160, diskfile) ) /* get next template line */ { template[160] = '\0'; /* make sure string is terminated */ slen = strlen(template); /* get string length */ template[slen - 1] = '\0'; /* over write the 'newline' char */ if (ffgthd(template, card, &keytype, status) > 0) /* parse template */ break; strncpy(keyname, card, 8); keyname[8] = '\0'; if (keytype == -2) /* rename the card */ { strncpy(newname, &card[40], 8); newname[8] = '\0'; ffmnam(fptr, keyname, newname, status); } else if (keytype == -1) /* delete the card */ { ffdkey(fptr, keyname, status); } else if (keytype == 0) /* update the card */ { ffucrd(fptr, keyname, card, status); } else if (keytype == 1) /* append the card */ { ffprec(fptr, card, status); } else /* END card; stop here */ { break; } } fclose(diskfile); /* close the template file */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpky( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ const char *keyname,/* I - name of keyword to write */ void *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes a keyword value with the datatype specified by the 2nd argument. */ { char errmsg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TSTRING) { ffpkys(fptr, keyname, (char *) value, comm, status); } else if (datatype == TBYTE) { ffpkyj(fptr, keyname, (LONGLONG) *(unsigned char *) value, comm, status); } else if (datatype == TSBYTE) { ffpkyj(fptr, keyname, (LONGLONG) *(signed char *) value, comm, status); } else if (datatype == TUSHORT) { ffpkyj(fptr, keyname, (LONGLONG) *(unsigned short *) value, comm, status); } else if (datatype == TSHORT) { ffpkyj(fptr, keyname, (LONGLONG) *(short *) value, comm, status); } else if (datatype == TUINT) { ffpkyg(fptr, keyname, (double) *(unsigned int *) value, 0, comm, status); } else if (datatype == TINT) { ffpkyj(fptr, keyname, (LONGLONG) *(int *) value, comm, status); } else if (datatype == TLOGICAL) { ffpkyl(fptr, keyname, *(int *) value, comm, status); } else if (datatype == TULONG) { ffpkyg(fptr, keyname, (double) *(unsigned long *) value, 0, comm, status); } else if (datatype == TLONG) { ffpkyj(fptr, keyname, (LONGLONG) *(long *) value, comm, status); } else if (datatype == TLONGLONG) { ffpkyj(fptr, keyname, *(LONGLONG *) value, comm, status); } else if (datatype == TFLOAT) { ffpkye(fptr, keyname, *(float *) value, -7, comm, status); } else if (datatype == TDOUBLE) { ffpkyd(fptr, keyname, *(double *) value, -15, comm, status); } else if (datatype == TCOMPLEX) { ffpkyc(fptr, keyname, (float *) value, -7, comm, status); } else if (datatype == TDBLCOMPLEX) { ffpkym(fptr, keyname, (double *) value, -15, comm, status); } else { sprintf(errmsg, "Bad keyword datatype code: %d (ffpky)", datatype); ffpmsg(errmsg); *status = BAD_DATATYPE; } return(*status); } /*-------------------------------------------------------------------------*/ int ffprec(fitsfile *fptr, /* I - FITS file pointer */ const char *card, /* I - string to be written */ int *status) /* IO - error status */ /* write a keyword record (80 bytes long) to the end of the header */ { char tcard[FLEN_CARD]; size_t len, ii; long nblocks; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ( ((fptr->Fptr)->datastart - (fptr->Fptr)->headend) == 80) /* no room */ { nblocks = 1; if (ffiblk(fptr, nblocks, 0, status) > 0) /* insert 2880-byte block */ return(*status); } strncpy(tcard,card,80); tcard[80] = '\0'; len = strlen(tcard); /* silently replace any illegal characters with a space */ for (ii=0; ii < len; ii++) if (tcard[ii] < ' ' || tcard[ii] > 126) tcard[ii] = ' '; for (ii=len; ii < 80; ii++) /* fill card with spaces if necessary */ tcard[ii] = ' '; for (ii=0; ii < 8; ii++) /* make sure keyword name is uppercase */ tcard[ii] = toupper(tcard[ii]); fftkey(tcard, status); /* test keyword name contains legal chars */ /* no need to do this any more, since any illegal characters have been removed fftrec(tcard, status); */ /* test rest of keyword for legal chars */ ffmbyt(fptr, (fptr->Fptr)->headend, IGNORE_EOF, status); /* move to end */ ffpbyt(fptr, 80, tcard, status); /* write the 80 byte card */ if (*status <= 0) (fptr->Fptr)->headend += 80; /* update end-of-header position */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyu( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) a null-valued keyword and comment into the FITS header. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring," "); /* create a dummy value string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword */ ffprec(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpkys( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. The value string will be truncated at 68 characters which is the maximum length that will fit on a single FITS keyword. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffs2c(value, valstring, status); /* put quotes around the string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword */ ffprec(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpkls( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. This routine is a modified version of ffpkys which supports the HEASARC long string convention and can write arbitrarily long string keyword values. The value is continued over multiple keywords that have the name COMTINUE without an equal sign in column 9 of the card. This routine also supports simple string keywords which are less than 69 characters in length. */ { char valstring[FLEN_CARD]; char card[FLEN_CARD], tmpkeyname[FLEN_CARD]; char tstring[FLEN_CARD], *cptr; int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1; if (*status > 0) /* inherit input status value if > 0 */ return(*status); remain = maxvalue(strlen(value), 1); /* no. of chars to write (at least 1) */ /* count the number of single quote characters are in the string */ tstring[0] = '\0'; strncat(tstring, value, 68); /* copy 1st part of string to temp buff */ nquote = 0; cptr = strchr(tstring, '\''); /* search for quote character */ while (cptr) /* search for quote character */ { nquote++; /* increment no. of quote characters */ cptr++; /* increment pointer to next character */ cptr = strchr(cptr, '\''); /* search for another quote char */ } strncpy(tmpkeyname, keyname, 80); tmpkeyname[80] = '\0'; cptr = tmpkeyname; while(*cptr == ' ') /* skip over leading spaces in name */ cptr++; /* determine the number of characters that will fit on the line */ /* Note: each quote character is expanded to 2 quotes */ namelen = strlen(cptr); if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) ) { /* This a normal 8-character FITS keyword */ nchar = 68 - nquote; /* max of 68 chars fit in a FITS string value */ } else { /* This a HIERARCH keyword */ if (FSTRNCMP(cptr, "HIERARCH ", 9) && FSTRNCMP(cptr, "hierarch ", 9)) nchar = 66 - nquote - namelen; else nchar = 75 - nquote - namelen; /* don't count 'HIERARCH' twice */ } contin = 0; next = 0; /* pointer to next character to write */ while (remain > 0) { tstring[0] = '\0'; strncat(tstring, &value[next], nchar); /* copy string to temp buff */ ffs2c(tstring, valstring, status); /* put quotes around the string */ if (remain > nchar) /* if string is continued, put & as last char */ { vlen = strlen(valstring); nchar -= 1; /* outputting one less character now */ if (valstring[vlen-2] != '\'') valstring[vlen-2] = '&'; /* over write last char with & */ else { /* last char was a pair of single quotes, so over write both */ valstring[vlen-3] = '&'; valstring[vlen-1] = '\0'; } } if (contin) /* This is a CONTINUEd keyword */ { ffmkky("CONTINUE", valstring, comm, card, status); /* make keyword */ strncpy(&card[8], " ", 2); /* overwrite the '=' */ } else { ffmkky(keyname, valstring, comm, card, status); /* make keyword */ } ffprec(fptr, card, status); /* write the keyword */ contin = 1; remain -= nchar; next += nchar; if (remain > 0) { /* count the number of single quote characters in next section */ tstring[0] = '\0'; strncat(tstring, &value[next], 68); /* copy next part of string */ nquote = 0; cptr = strchr(tstring, '\''); /* search for quote character */ while (cptr) /* search for quote character */ { nquote++; /* increment no. of quote characters */ cptr++; /* increment pointer to next character */ cptr = strchr(cptr, '\''); /* search for another quote char */ } nchar = 68 - nquote; /* max number of chars to write this time */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffplsw( fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Write the LONGSTRN keyword and a series of related COMMENT keywords which document that this FITS header may contain long string keyword values which are continued over multiple keywords using the HEASARC long string keyword convention. If the LONGSTRN keyword already exists then this routine simple returns without doing anything. */ { char valstring[FLEN_VALUE], comm[FLEN_COMMENT]; int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = 0; if (ffgkys(fptr, "LONGSTRN", valstring, comm, &tstatus) == 0) return(*status); /* keyword already exists, so just return */ ffpkys(fptr, "LONGSTRN", "OGIP 1.0", "The HEASARC Long String Convention may be used.", status); ffpcom(fptr, " This FITS file may contain long string keyword values that are", status); ffpcom(fptr, " continued over multiple keywords. The HEASARC convention uses the &", status); ffpcom(fptr, " character at the end of each substring which is then continued", status); ffpcom(fptr, " on the next keyword which has the name CONTINUE.", status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyl( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ int value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Values equal to 0 will result in a False FITS keyword; any other non-zero value will result in a True FITS keyword. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffl2c(value, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ LONGLONG value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an integer keyword value. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffi2c(value, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyf( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ float value, /* I - keyword value */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes a fixed float keyword value. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffr2f(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkye( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ float value, /* I - keyword value */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an exponential float keyword value. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffr2e(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyg( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ double value, /* I - keyword value */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes a fixed double keyword value.*/ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffd2f(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyd( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ double value, /* I - keyword value */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an exponential double keyword value.*/ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffd2e(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyc( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ float *value, /* I - keyword value (real, imaginary) */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an complex float keyword value. Format = (realvalue, imagvalue) */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffr2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkym( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ double *value, /* I - keyword value (real, imaginary) */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an complex double keyword value. Format = (realvalue, imagvalue) */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffd2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkfc( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ float *value, /* I - keyword value (real, imaginary) */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an complex float keyword value. Format = (realvalue, imagvalue) */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffr2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkfm( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ double *value, /* I - keyword value (real, imaginary) */ int decim, /* I - number of decimal places to display */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) the keyword, value and comment into the FITS header. Writes an complex double keyword value. Format = (realvalue, imagvalue) */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffd2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffpkyt( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - name of keyword to write */ long intval, /* I - integer part of value */ double fraction, /* I - fractional part of value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Write (put) a 'triple' precision keyword where the integer and fractional parts of the value are passed in separate parameters to increase the total amount of numerical precision. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; char fstring[20], *cptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (fraction > 1. || fraction < 0.) { ffpmsg("fraction must be between 0. and 1. (ffpkyt)"); return(*status = BAD_F2C); } ffi2c(intval, valstring, status); /* convert integer to string */ ffd2f(fraction, 16, fstring, status); /* convert to 16 decimal string */ cptr = strchr(fstring, '.'); /* find the decimal point */ strcat(valstring, cptr); /* append the fraction to the integer */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffprec(fptr, card, status); /* write the keyword*/ return(*status); } /*-----------------------------------------------------------------*/ int ffpcom( fitsfile *fptr, /* I - FITS file pointer */ const char *comm, /* I - comment string */ int *status) /* IO - error status */ /* Write 1 or more COMMENT keywords. If the comment string is too long to fit on a single keyword (72 chars) then it will automatically be continued on multiple CONTINUE keywords. */ { char card[FLEN_CARD]; int len, ii; if (*status > 0) /* inherit input status value if > 0 */ return(*status); len = strlen(comm); ii = 0; for (; len > 0; len -= 72) { strcpy(card, "COMMENT "); strncat(card, &comm[ii], 72); ffprec(fptr, card, status); ii += 72; } return(*status); } /*-----------------------------------------------------------------*/ int ffphis( fitsfile *fptr, /* I - FITS file pointer */ const char *history, /* I - history string */ int *status) /* IO - error status */ /* Write 1 or more HISTORY keywords. If the history string is too long to fit on a single keyword (72 chars) then it will automatically be continued on multiple HISTORY keywords. */ { char card[FLEN_CARD]; int len, ii; if (*status > 0) /* inherit input status value if > 0 */ return(*status); len = strlen(history); ii = 0; for (; len > 0; len -= 72) { strcpy(card, "HISTORY "); strncat(card, &history[ii], 72); ffprec(fptr, card, status); ii += 72; } return(*status); } /*-----------------------------------------------------------------*/ int ffpdat( fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Write the DATE keyword into the FITS header. If the keyword already exists then the date will simply be updated in the existing keyword. */ { int timeref; char date[30], tmzone[10], card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffgstm(date, &timeref, status); if (timeref) /* GMT not available on this machine */ strcpy(tmzone, " Local"); else strcpy(tmzone, " UT"); strcpy(card, "DATE = '"); strcat(card, date); strcat(card, "' / file creation date (YYYY-MM-DDThh:mm:ss"); strcat(card, tmzone); strcat(card, ")"); ffucrd(fptr, "DATE", card, status); return(*status); } /*-------------------------------------------------------------------*/ int ffverifydate(int year, /* I - year (0 - 9999) */ int month, /* I - month (1 - 12) */ int day, /* I - day (1 - 31) */ int *status) /* IO - error status */ /* Verify that the date is valid */ { int ndays[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; char errmsg[81]; if (year < 0 || year > 9999) { sprintf(errmsg, "input year value = %d is out of range 0 - 9999", year); ffpmsg(errmsg); return(*status = BAD_DATE); } else if (month < 1 || month > 12) { sprintf(errmsg, "input month value = %d is out of range 1 - 12", month); ffpmsg(errmsg); return(*status = BAD_DATE); } if (ndays[month] == 31) { if (day < 1 || day > 31) { sprintf(errmsg, "input day value = %d is out of range 1 - 31 for month %d", day, month); ffpmsg(errmsg); return(*status = BAD_DATE); } } else if (ndays[month] == 30) { if (day < 1 || day > 30) { sprintf(errmsg, "input day value = %d is out of range 1 - 30 for month %d", day, month); ffpmsg(errmsg); return(*status = BAD_DATE); } } else { if (day < 1 || day > 28) { if (day == 29) { /* year is a leap year if it is divisible by 4 but not by 100, except years divisible by 400 are leap years */ if ((year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0) return (*status); sprintf(errmsg, "input day value = %d is out of range 1 - 28 for February %d (not leap year)", day, year); ffpmsg(errmsg); } else { sprintf(errmsg, "input day value = %d is out of range 1 - 28 (or 29) for February", day); ffpmsg(errmsg); } return(*status = BAD_DATE); } } return(*status); } /*-----------------------------------------------------------------*/ int ffgstm( char *timestr, /* O - returned system date and time string */ int *timeref, /* O - GMT = 0, Local time = 1 */ int *status) /* IO - error status */ /* Returns the current date and time in format 'yyyy-mm-ddThh:mm:ss'. */ { time_t tp; struct tm *ptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); time(&tp); ptr = gmtime(&tp); /* get GMT (= UTC) time */ if (timeref) { if (ptr) *timeref = 0; /* returning GMT */ else *timeref = 1; /* returning local time */ } if (!ptr) /* GMT not available on this machine */ ptr = localtime(&tp); strftime(timestr, 25, "%Y-%m-%dT%H:%M:%S", ptr); return(*status); } /*-----------------------------------------------------------------*/ int ffdt2s(int year, /* I - year (0 - 9999) */ int month, /* I - month (1 - 12) */ int day, /* I - day (1 - 31) */ char *datestr, /* O - date string: "YYYY-MM-DD" */ int *status) /* IO - error status */ /* Construct a date character string */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); *datestr = '\0'; if (ffverifydate(year, month, day, status) > 0) { ffpmsg("invalid date (ffdt2s)"); return(*status); } if (year >= 1900 && year <= 1998) /* use old 'dd/mm/yy' format */ sprintf(datestr, "%.2d/%.2d/%.2d", day, month, year - 1900); else /* use the new 'YYYY-MM-DD' format */ sprintf(datestr, "%.4d-%.2d-%.2d", year, month, day); return(*status); } /*-----------------------------------------------------------------*/ int ffs2dt(char *datestr, /* I - date string: "YYYY-MM-DD" or "dd/mm/yy" */ int *year, /* O - year (0 - 9999) */ int *month, /* O - month (1 - 12) */ int *day, /* O - day (1 - 31) */ int *status) /* IO - error status */ /* Parse a date character string into year, month, and day values */ { int slen, lyear, lmonth, lday; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (year) *year = 0; if (month) *month = 0; if (day) *day = 0; if (!datestr) { ffpmsg("error: null input date string (ffs2dt)"); return(*status = BAD_DATE); /* Null datestr pointer ??? */ } slen = strlen(datestr); if (slen == 8 && datestr[2] == '/' && datestr[5] == '/') { if (isdigit((int) datestr[0]) && isdigit((int) datestr[1]) && isdigit((int) datestr[3]) && isdigit((int) datestr[4]) && isdigit((int) datestr[6]) && isdigit((int) datestr[7]) ) { /* this is an old format string: "dd/mm/yy" */ lyear = atoi(&datestr[6]) + 1900; lmonth = atoi(&datestr[3]); lday = atoi(datestr); if (year) *year = lyear; if (month) *month = lmonth; if (day) *day = lday; } else { ffpmsg("input date string has illegal format (ffs2dt):"); ffpmsg(datestr); return(*status = BAD_DATE); } } else if (slen >= 10 && datestr[4] == '-' && datestr[7] == '-') { if (isdigit((int) datestr[0]) && isdigit((int) datestr[1]) && isdigit((int) datestr[2]) && isdigit((int) datestr[3]) && isdigit((int) datestr[5]) && isdigit((int) datestr[6]) && isdigit((int) datestr[8]) && isdigit((int) datestr[9]) ) { if (slen > 10 && datestr[10] != 'T') { ffpmsg("input date string has illegal format (ffs2dt):"); ffpmsg(datestr); return(*status = BAD_DATE); } /* this is a new format string: "yyyy-mm-dd" */ lyear = atoi(datestr); lmonth = atoi(&datestr[5]); lday = atoi(&datestr[8]); if (year) *year = lyear; if (month) *month = lmonth; if (day) *day = lday; } else { ffpmsg("input date string has illegal format (ffs2dt):"); ffpmsg(datestr); return(*status = BAD_DATE); } } else { ffpmsg("input date string has illegal format (ffs2dt):"); ffpmsg(datestr); return(*status = BAD_DATE); } if (ffverifydate(lyear, lmonth, lday, status) > 0) { ffpmsg("invalid date (ffs2dt)"); } return(*status); } /*-----------------------------------------------------------------*/ int fftm2s(int year, /* I - year (0 - 9999) */ int month, /* I - month (1 - 12) */ int day, /* I - day (1 - 31) */ int hour, /* I - hour (0 - 23) */ int minute, /* I - minute (0 - 59) */ double second, /* I - second (0. - 60.9999999) */ int decimals, /* I - number of decimal points to write */ char *datestr, /* O - date string: "YYYY-MM-DDThh:mm:ss.ddd" */ /* or "hh:mm:ss.ddd" if year, month day = 0 */ int *status) /* IO - error status */ /* Construct a date and time character string */ { int width; char errmsg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); *datestr='\0'; if (year != 0 || month != 0 || day !=0) { if (ffverifydate(year, month, day, status) > 0) { ffpmsg("invalid date (fftm2s)"); return(*status); } } if (hour < 0 || hour > 23) { sprintf(errmsg, "input hour value is out of range 0 - 23: %d (fftm2s)", hour); ffpmsg(errmsg); return(*status = BAD_DATE); } else if (minute < 0 || minute > 59) { sprintf(errmsg, "input minute value is out of range 0 - 59: %d (fftm2s)", minute); ffpmsg(errmsg); return(*status = BAD_DATE); } else if (second < 0. || second >= 61) { sprintf(errmsg, "input second value is out of range 0 - 60.999: %f (fftm2s)", second); ffpmsg(errmsg); return(*status = BAD_DATE); } else if (decimals > 25) { sprintf(errmsg, "input decimals value is out of range 0 - 25: %d (fftm2s)", decimals); ffpmsg(errmsg); return(*status = BAD_DATE); } if (decimals == 0) width = 2; else width = decimals + 3; if (decimals < 0) { /* a negative decimals value means return only the date, not time */ sprintf(datestr, "%.4d-%.2d-%.2d", year, month, day); } else if (year == 0 && month == 0 && day == 0) { /* return only the time, not the date */ sprintf(datestr, "%.2d:%.2d:%0*.*f", hour, minute, width, decimals, second); } else { /* return both the time and date */ sprintf(datestr, "%.4d-%.2d-%.2dT%.2d:%.2d:%0*.*f", year, month, day, hour, minute, width, decimals, second); } return(*status); } /*-----------------------------------------------------------------*/ int ffs2tm(char *datestr, /* I - date string: "YYYY-MM-DD" */ /* or "YYYY-MM-DDThh:mm:ss.ddd" */ /* or "dd/mm/yy" */ int *year, /* O - year (0 - 9999) */ int *month, /* O - month (1 - 12) */ int *day, /* O - day (1 - 31) */ int *hour, /* I - hour (0 - 23) */ int *minute, /* I - minute (0 - 59) */ double *second, /* I - second (0. - 60.9999999) */ int *status) /* IO - error status */ /* Parse a date character string into date and time values */ { int slen; char errmsg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (year) *year = 0; if (month) *month = 0; if (day) *day = 0; if (hour) *hour = 0; if (minute) *minute = 0; if (second) *second = 0.; if (!datestr) { ffpmsg("error: null input date string (ffs2tm)"); return(*status = BAD_DATE); /* Null datestr pointer ??? */ } if (datestr[2] == '/' || datestr[4] == '-') { /* Parse the year, month, and date */ if (ffs2dt(datestr, year, month, day, status) > 0) return(*status); slen = strlen(datestr); if (slen == 8 || slen == 10) return(*status); /* OK, no time fields */ else if (slen < 19) { ffpmsg("input date string has illegal format:"); ffpmsg(datestr); return(*status = BAD_DATE); } else if (datestr[10] == 'T' && datestr[13] == ':' && datestr[16] == ':') { if (isdigit((int) datestr[11]) && isdigit((int) datestr[12]) && isdigit((int) datestr[14]) && isdigit((int) datestr[15]) && isdigit((int) datestr[17]) && isdigit((int) datestr[18]) ) { if (slen > 19 && datestr[19] != '.') { ffpmsg("input date string has illegal format:"); ffpmsg(datestr); return(*status = BAD_DATE); } /* this is a new format string: "yyyy-mm-ddThh:mm:ss.dddd" */ if (hour) *hour = atoi(&datestr[11]); if (minute) *minute = atoi(&datestr[14]); if (second) *second = atof(&datestr[17]); } else { ffpmsg("input date string has illegal format:"); ffpmsg(datestr); return(*status = BAD_DATE); } } } else /* no date fields */ { if (datestr[2] == ':' && datestr[5] == ':') /* time string */ { if (isdigit((int) datestr[0]) && isdigit((int) datestr[1]) && isdigit((int) datestr[3]) && isdigit((int) datestr[4]) && isdigit((int) datestr[6]) && isdigit((int) datestr[7]) ) { /* this is a time string: "hh:mm:ss.dddd" */ if (hour) *hour = atoi(&datestr[0]); if (minute) *minute = atoi(&datestr[3]); if (second) *second = atof(&datestr[6]); } else { ffpmsg("input date string has illegal format:"); ffpmsg(datestr); return(*status = BAD_DATE); } } else { ffpmsg("input date string has illegal format:"); ffpmsg(datestr); return(*status = BAD_DATE); } } if (hour) if (*hour < 0 || *hour > 23) { sprintf(errmsg, "hour value is out of range 0 - 23: %d (ffs2tm)", *hour); ffpmsg(errmsg); return(*status = BAD_DATE); } if (minute) if (*minute < 0 || *minute > 59) { sprintf(errmsg, "minute value is out of range 0 - 59: %d (ffs2tm)", *minute); ffpmsg(errmsg); return(*status = BAD_DATE); } if (second) if (*second < 0 || *second >= 61.) { sprintf(errmsg, "second value is out of range 0 - 60.9999: %f (ffs2tm)", *second); ffpmsg(errmsg); return(*status = BAD_DATE); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsdt( int *day, int *month, int *year, int *status ) { /* This routine is included for backward compatibility with the Fortran FITSIO library. ffgsdt : Get current System DaTe (GMT if available) Return integer values of the day, month, and year Function parameters: day Day of the month month Numerical month (1=Jan, etc.) year Year (1999, 2000, etc.) status output error status */ time_t now; struct tm *date; now = time( NULL ); date = gmtime(&now); /* get GMT (= UTC) time */ if (!date) /* GMT not available on this machine */ { date = localtime(&now); } *day = date->tm_mday; *month = date->tm_mon + 1; *year = date->tm_year + 1900; /* tm_year is defined as years since 1900 */ return( *status ); } /*--------------------------------------------------------------------------*/ int ffpkns( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ char *value[], /* I - array of pointers to keyword values */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes string keywords. The value strings will be truncated at 68 characters, and the HEASARC long string keyword convention is not supported by this routine. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkys(fptr, keyname, value[ii], tcomment, status); else ffpkys(fptr, keyname, value[ii], comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpknl( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ int *value, /* I - array of keyword values */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes logical keywords Values equal to zero will be written as a False FITS keyword value; any other non-zero value will result in a True FITS keyword. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyl(fptr, keyname, value[ii], tcomment, status); else ffpkyl(fptr, keyname, value[ii], comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpknj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ long *value, /* I - array of keyword values */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Write integer keywords */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyj(fptr, keyname, value[ii], tcomment, status); else ffpkyj(fptr, keyname, value[ii], comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpknjj( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ LONGLONG *value, /* I - array of keyword values */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Write integer keywords */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyj(fptr, keyname, value[ii], tcomment, status); else ffpkyj(fptr, keyname, value[ii], comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpknf( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ float *value, /* I - array of keyword values */ int decim, /* I - number of decimals to display */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes fixed float values. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyf(fptr, keyname, value[ii], decim, tcomment, status); else ffpkyf(fptr, keyname, value[ii], decim, comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpkne( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ float *value, /* I - array of keyword values */ int decim, /* I - number of decimals to display */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes exponential float values. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkye(fptr, keyname, value[ii], decim, tcomment, status); else ffpkye(fptr, keyname, value[ii], decim, comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpkng( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ double *value, /* I - array of keyword values */ int decim, /* I - number of decimals to display */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes fixed double values. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyg(fptr, keyname, value[ii], decim, tcomment, status); else ffpkyg(fptr, keyname, value[ii], decim, comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffpknd( fitsfile *fptr, /* I - FITS file pointer */ const char *keyroot, /* I - root name of keywords to write */ int nstart, /* I - starting index number */ int nkey, /* I - number of keywords to write */ double *value, /* I - array of keyword values */ int decim, /* I - number of decimals to display */ char *comm[], /* I - array of pointers to keyword comment */ int *status) /* IO - error status */ /* Write (put) an indexed array of keywords with index numbers between NSTART and (NSTART + NKEY -1) inclusive. Writes exponential double values. */ { char keyname[FLEN_KEYWORD], tcomment[FLEN_COMMENT]; int ii, jj, repeat, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check if first comment string is to be repeated for all the keywords */ /* by looking to see if the last non-blank character is a '&' char */ repeat = 0; if (comm) { len = strlen(comm[0]); while (len > 0 && comm[0][len - 1] == ' ') len--; /* ignore trailing blanks */ if (comm[0][len - 1] == '&') { len = minvalue(len, FLEN_COMMENT); tcomment[0] = '\0'; strncat(tcomment, comm[0], len-1); /* don't copy the final '&' char */ repeat = 1; } } else { repeat = 1; tcomment[0] = '\0'; } for (ii=0, jj=nstart; ii < nkey; ii++, jj++) { ffkeyn(keyroot, jj, keyname, status); if (repeat) ffpkyd(fptr, keyname, value[ii], decim, tcomment, status); else ffpkyd(fptr, keyname, value[ii], decim, comm[ii], status); if (*status > 0) return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffptdm( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int naxis, /* I - number of axes in the data array */ long naxes[], /* I - length of each data axis */ int *status) /* IO - error status */ /* write the TDIMnnn keyword describing the dimensionality of a column */ { char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE], comm[FLEN_COMMENT]; char value[80], message[81]; int ii; long totalpix = 1, repeat; tcolumn *colptr; if (*status > 0) return(*status); if (colnum < 1 || colnum > 999) { ffpmsg("column number is out of range 1 - 999 (ffptdm)"); return(*status = BAD_COL_NUM); } if (naxis < 1) { ffpmsg("naxis is less than 1 (ffptdm)"); return(*status = BAD_DIMEN); } /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ( (fptr->Fptr)->hdutype != BINARY_TBL) { ffpmsg( "Error: The TDIMn keyword is only allowed in BINTABLE extensions (ffptdm)"); return(*status = NOT_BTABLE); } strcpy(tdimstr, "("); /* start constructing the TDIM value */ for (ii = 0; ii < naxis; ii++) { if (ii > 0) strcat(tdimstr, ","); /* append the comma separator */ if (naxes[ii] < 0) { ffpmsg("one or more TDIM values are less than 0 (ffptdm)"); return(*status = BAD_TDIM); } sprintf(value, "%ld", naxes[ii]); strcat(tdimstr, value); /* append the axis size */ totalpix *= naxes[ii]; } colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* point to the specified column number */ if ((long) colptr->trepeat != totalpix) { /* There is an apparent inconsistency between TDIMn and TFORMn. */ /* The colptr->trepeat value may be out of date, so re-read */ /* the TFORMn keyword to be sure. */ ffkeyn("TFORM", colnum, keyname, status); /* construct TFORMn name */ ffgkys(fptr, keyname, value, NULL, status); /* read TFORMn keyword */ ffbnfm(value, NULL, &repeat, NULL, status); /* parse the repeat count */ if (*status > 0 || repeat != totalpix) { sprintf(message, "column vector length, %ld, does not equal TDIMn array size, %ld", (long) colptr->trepeat, totalpix); ffpmsg(message); return(*status = BAD_TDIM); } } strcat(tdimstr, ")" ); /* append the closing parenthesis */ strcpy(comm, "size of the multidimensional array"); ffkeyn("TDIM", colnum, keyname, status); /* construct TDIMn name */ ffpkys(fptr, keyname, tdimstr, comm, status); /* write the keyword */ return(*status); } /*--------------------------------------------------------------------------*/ int ffptdmll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int naxis, /* I - number of axes in the data array */ LONGLONG naxes[], /* I - length of each data axis */ int *status) /* IO - error status */ /* write the TDIMnnn keyword describing the dimensionality of a column */ { char keyname[FLEN_KEYWORD], tdimstr[FLEN_VALUE], comm[FLEN_COMMENT]; char value[80], message[81]; int ii; LONGLONG totalpix = 1, repeat; tcolumn *colptr; if (*status > 0) return(*status); if (colnum < 1 || colnum > 999) { ffpmsg("column number is out of range 1 - 999 (ffptdm)"); return(*status = BAD_COL_NUM); } if (naxis < 1) { ffpmsg("naxis is less than 1 (ffptdm)"); return(*status = BAD_DIMEN); } /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ( (fptr->Fptr)->hdutype != BINARY_TBL) { ffpmsg( "Error: The TDIMn keyword is only allowed in BINTABLE extensions (ffptdm)"); return(*status = NOT_BTABLE); } strcpy(tdimstr, "("); /* start constructing the TDIM value */ for (ii = 0; ii < naxis; ii++) { if (ii > 0) strcat(tdimstr, ","); /* append the comma separator */ if (naxes[ii] < 0) { ffpmsg("one or more TDIM values are less than 0 (ffptdm)"); return(*status = BAD_TDIM); } /* cast to double because the 64-bit int conversion character in */ /* sprintf is platform dependent ( %lld, %ld, %I64d ) */ sprintf(value, "%.0f", (double) naxes[ii]); strcat(tdimstr, value); /* append the axis size */ totalpix *= naxes[ii]; } colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* point to the specified column number */ if ( colptr->trepeat != totalpix) { /* There is an apparent inconsistency between TDIMn and TFORMn. */ /* The colptr->trepeat value may be out of date, so re-read */ /* the TFORMn keyword to be sure. */ ffkeyn("TFORM", colnum, keyname, status); /* construct TFORMn name */ ffgkys(fptr, keyname, value, NULL, status); /* read TFORMn keyword */ ffbnfmll(value, NULL, &repeat, NULL, status); /* parse the repeat count */ if (*status > 0 || repeat != totalpix) { sprintf(message, "column vector length, %.0f, does not equal TDIMn array size, %.0f", (double) (colptr->trepeat), (double) totalpix); ffpmsg(message); return(*status = BAD_TDIM); } } strcat(tdimstr, ")" ); /* append the closing parenthesis */ strcpy(comm, "size of the multidimensional array"); ffkeyn("TDIM", colnum, keyname, status); /* construct TDIMn name */ ffpkys(fptr, keyname, tdimstr, comm, status); /* write the keyword */ return(*status); } /*--------------------------------------------------------------------------*/ int ffphps( fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - number of bits per data value pixel */ int naxis, /* I - number of axes in the data array */ long naxes[], /* I - length of each data axis */ int *status) /* IO - error status */ /* write STANDARD set of required primary header keywords */ { int simple = 1; /* does file conform to FITS standard? 1/0 */ long pcount = 0; /* number of group parameters (usually 0) */ long gcount = 1; /* number of random groups (usually 1 or 0) */ int extend = 1; /* may FITS file have extensions? */ ffphpr(fptr, simple, bitpix, naxis, naxes, pcount, gcount, extend, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffphpsll( fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - number of bits per data value pixel */ int naxis, /* I - number of axes in the data array */ LONGLONG naxes[], /* I - length of each data axis */ int *status) /* IO - error status */ /* write STANDARD set of required primary header keywords */ { int simple = 1; /* does file conform to FITS standard? 1/0 */ LONGLONG pcount = 0; /* number of group parameters (usually 0) */ LONGLONG gcount = 1; /* number of random groups (usually 1 or 0) */ int extend = 1; /* may FITS file have extensions? */ ffphprll(fptr, simple, bitpix, naxis, naxes, pcount, gcount, extend, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffphpr( fitsfile *fptr, /* I - FITS file pointer */ int simple, /* I - does file conform to FITS standard? 1/0 */ int bitpix, /* I - number of bits per data value pixel */ int naxis, /* I - number of axes in the data array */ long naxes[], /* I - length of each data axis */ LONGLONG pcount, /* I - number of group parameters (usually 0) */ LONGLONG gcount, /* I - number of random groups (usually 1 or 0) */ int extend, /* I - may FITS file have extensions? */ int *status) /* IO - error status */ /* write required primary header keywords */ { int ii; LONGLONG naxesll[20]; for (ii = 0; (ii < naxis) && (ii < 20); ii++) naxesll[ii] = naxes[ii]; ffphprll(fptr, simple, bitpix, naxis, naxesll, pcount, gcount, extend, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffphprll( fitsfile *fptr, /* I - FITS file pointer */ int simple, /* I - does file conform to FITS standard? 1/0 */ int bitpix, /* I - number of bits per data value pixel */ int naxis, /* I - number of axes in the data array */ LONGLONG naxes[], /* I - length of each data axis */ LONGLONG pcount, /* I - number of group parameters (usually 0) */ LONGLONG gcount, /* I - number of random groups (usually 1 or 0) */ int extend, /* I - may FITS file have extensions? */ int *status) /* IO - error status */ /* write required primary header keywords */ { int ii; long longbitpix, tnaxes[20]; char name[FLEN_KEYWORD], comm[FLEN_COMMENT], message[FLEN_ERRMSG]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) return(*status = HEADER_NOT_EMPTY); if (naxis != 0) /* never try to compress a null image */ { if ( (fptr->Fptr)->request_compress_type ) { for (ii = 0; ii < naxis; ii++) tnaxes[ii] = (long) naxes[ii]; /* write header for a compressed image */ imcomp_init_table(fptr, bitpix, naxis, tnaxes, 1, status); return(*status); } } if ((fptr->Fptr)->curhdu == 0) { /* write primary array header */ if (simple) strcpy(comm, "file does conform to FITS standard"); else strcpy(comm, "file does not conform to FITS standard"); ffpkyl(fptr, "SIMPLE", simple, comm, status); } else { /* write IMAGE extension header */ strcpy(comm, "IMAGE extension"); ffpkys(fptr, "XTENSION", "IMAGE", comm, status); } longbitpix = bitpix; /* test for the 3 special cases that represent unsigned integers */ if (longbitpix == USHORT_IMG) longbitpix = SHORT_IMG; else if (longbitpix == ULONG_IMG) longbitpix = LONG_IMG; else if (longbitpix == SBYTE_IMG) longbitpix = BYTE_IMG; if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG && longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG && longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG) { sprintf(message, "Illegal value for BITPIX keyword: %d", bitpix); ffpmsg(message); return(*status = BAD_BITPIX); } strcpy(comm, "number of bits per data pixel"); if (ffpkyj(fptr, "BITPIX", longbitpix, comm, status) > 0) return(*status); if (naxis < 0 || naxis > 999) { sprintf(message, "Illegal value for NAXIS keyword: %d", naxis); ffpmsg(message); return(*status = BAD_NAXIS); } strcpy(comm, "number of data axes"); ffpkyj(fptr, "NAXIS", naxis, comm, status); strcpy(comm, "length of data axis "); for (ii = 0; ii < naxis; ii++) { if (naxes[ii] < 0) { sprintf(message, "Illegal negative value for NAXIS%d keyword: %.0f", ii + 1, (double) (naxes[ii])); ffpmsg(message); return(*status = BAD_NAXES); } sprintf(&comm[20], "%d", ii + 1); ffkeyn("NAXIS", ii + 1, name, status); ffpkyj(fptr, name, naxes[ii], comm, status); } if ((fptr->Fptr)->curhdu == 0) /* the primary array */ { if (extend) { /* only write EXTEND keyword if value = true */ strcpy(comm, "FITS dataset may contain extensions"); ffpkyl(fptr, "EXTEND", extend, comm, status); } if (pcount < 0) { ffpmsg("pcount value is less than 0"); return(*status = BAD_PCOUNT); } else if (gcount < 1) { ffpmsg("gcount value is less than 1"); return(*status = BAD_GCOUNT); } else if (pcount > 0 || gcount > 1) { /* only write these keyword if non-standard values */ strcpy(comm, "random group records are present"); ffpkyl(fptr, "GROUPS", 1, comm, status); strcpy(comm, "number of random group parameters"); ffpkyj(fptr, "PCOUNT", pcount, comm, status); strcpy(comm, "number of random groups"); ffpkyj(fptr, "GCOUNT", gcount, comm, status); } /* write standard block of self-documentating comments */ ffprec(fptr, "COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy", status); ffprec(fptr, "COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H", status); } else /* an IMAGE extension */ { /* image extension; cannot have random groups */ if (pcount != 0) { ffpmsg("image extensions must have pcount = 0"); *status = BAD_PCOUNT; } else if (gcount != 1) { ffpmsg("image extensions must have gcount = 1"); *status = BAD_GCOUNT; } else { strcpy(comm, "required keyword; must = 0"); ffpkyj(fptr, "PCOUNT", 0, comm, status); strcpy(comm, "required keyword; must = 1"); ffpkyj(fptr, "GCOUNT", 1, comm, status); } } /* Write the BSCALE and BZERO keywords, if an unsigned integer image */ if (bitpix == USHORT_IMG) { strcpy(comm, "offset data range to that of unsigned short"); ffpkyg(fptr, "BZERO", 32768., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(fptr, "BSCALE", 1.0, 0, comm, status); } else if (bitpix == ULONG_IMG) { strcpy(comm, "offset data range to that of unsigned long"); ffpkyg(fptr, "BZERO", 2147483648., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(fptr, "BSCALE", 1.0, 0, comm, status); } else if (bitpix == SBYTE_IMG) { strcpy(comm, "offset data range to that of signed byte"); ffpkyg(fptr, "BZERO", -128., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(fptr, "BSCALE", 1.0, 0, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffphtb(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis1, /* I - width of row in the table */ LONGLONG naxis2, /* I - number of rows in the table */ int tfields, /* I - number of columns in the table */ char **ttype, /* I - name of each column */ long *tbcol, /* I - byte offset in row to each column */ char **tform, /* I - value of TFORMn keyword for each column */ char **tunit, /* I - value of TUNITn keyword for each column */ const char *extnmx, /* I - value of EXTNAME keyword, if any */ int *status) /* IO - error status */ /* Put required Header keywords into the ASCII TaBle: */ { int ii, ncols, gotmem = 0; long rowlen; /* must be 'long' because it is passed to ffgabc */ char tfmt[30], name[FLEN_KEYWORD], comm[FLEN_COMMENT], extnm[FLEN_VALUE]; if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (*status > 0) return(*status); else if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) return(*status = HEADER_NOT_EMPTY); else if (naxis1 < 0) return(*status = NEG_WIDTH); else if (naxis2 < 0) return(*status = NEG_ROWS); else if (tfields < 0 || tfields > 999) return(*status = BAD_TFIELDS); extnm[0] = '\0'; if (extnmx) strncat(extnm, extnmx, FLEN_VALUE-1); rowlen = (long) naxis1; if (!tbcol || !tbcol[0] || (!naxis1 && tfields)) /* spacing not defined? */ { /* allocate mem for tbcol; malloc can have problems allocating small */ /* arrays, so allocate at least 20 bytes */ ncols = maxvalue(5, tfields); tbcol = (long *) calloc(ncols, sizeof(long)); if (tbcol) { gotmem = 1; /* calculate width of a row and starting position of each column. */ /* Each column will be separated by 1 blank space */ ffgabc(tfields, tform, 1, &rowlen, tbcol, status); } } ffpkys(fptr, "XTENSION", "TABLE", "ASCII table extension", status); ffpkyj(fptr, "BITPIX", 8, "8-bit ASCII characters", status); ffpkyj(fptr, "NAXIS", 2, "2-dimensional ASCII table", status); ffpkyj(fptr, "NAXIS1", rowlen, "width of table in characters", status); ffpkyj(fptr, "NAXIS2", naxis2, "number of rows in table", status); ffpkyj(fptr, "PCOUNT", 0, "no group parameters (required keyword)", status); ffpkyj(fptr, "GCOUNT", 1, "one data group (required keyword)", status); ffpkyj(fptr, "TFIELDS", tfields, "number of fields in each row", status); for (ii = 0; ii < tfields; ii++) /* loop over every column */ { if ( *(ttype[ii]) ) /* optional TTYPEn keyword */ { sprintf(comm, "label for field %3d", ii + 1); ffkeyn("TTYPE", ii + 1, name, status); ffpkys(fptr, name, ttype[ii], comm, status); } if (tbcol[ii] < 1 || tbcol[ii] > rowlen) *status = BAD_TBCOL; sprintf(comm, "beginning column of field %3d", ii + 1); ffkeyn("TBCOL", ii + 1, name, status); ffpkyj(fptr, name, tbcol[ii], comm, status); strcpy(tfmt, tform[ii]); /* required TFORMn keyword */ ffupch(tfmt); ffkeyn("TFORM", ii + 1, name, status); ffpkys(fptr, name, tfmt, "Fortran-77 format of field", status); if (tunit) { if (tunit[ii] && *(tunit[ii]) ) /* optional TUNITn keyword */ { ffkeyn("TUNIT", ii + 1, name, status); ffpkys(fptr, name, tunit[ii], "physical unit of field", status) ; } } if (*status > 0) break; /* abort loop on error */ } if (extnm) { if (extnm[0]) /* optional EXTNAME keyword */ ffpkys(fptr, "EXTNAME", extnm, "name of this ASCII table extension", status); } if (*status > 0) ffpmsg("Failed to write ASCII table header keywords (ffphtb)"); if (gotmem) free(tbcol); return(*status); } /*--------------------------------------------------------------------------*/ int ffphbn(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis2, /* I - number of rows in the table */ int tfields, /* I - number of columns in the table */ char **ttype, /* I - name of each column */ char **tform, /* I - value of TFORMn keyword for each column */ char **tunit, /* I - value of TUNITn keyword for each column */ const char *extnmx, /* I - value of EXTNAME keyword, if any */ LONGLONG pcount, /* I - size of the variable length heap area */ int *status) /* IO - error status */ /* Put required Header keywords into the Binary Table: */ { int ii, datatype, iread = 0; long repeat, width; LONGLONG naxis1; char tfmt[30], name[FLEN_KEYWORD], comm[FLEN_COMMENT], extnm[FLEN_VALUE]; char *cptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) return(*status = HEADER_NOT_EMPTY); else if (naxis2 < 0) return(*status = NEG_ROWS); else if (pcount < 0) return(*status = BAD_PCOUNT); else if (tfields < 0 || tfields > 999) return(*status = BAD_TFIELDS); extnm[0] = '\0'; if (extnmx) strncat(extnm, extnmx, FLEN_VALUE-1); ffpkys(fptr, "XTENSION", "BINTABLE", "binary table extension", status); ffpkyj(fptr, "BITPIX", 8, "8-bit bytes", status); ffpkyj(fptr, "NAXIS", 2, "2-dimensional binary table", status); naxis1 = 0; for (ii = 0; ii < tfields; ii++) /* sum the width of each field */ { ffbnfm(tform[ii], &datatype, &repeat, &width, status); if (datatype == TSTRING) naxis1 += repeat; /* one byte per char */ else if (datatype == TBIT) naxis1 += (repeat + 7) / 8; else if (datatype > 0) naxis1 += repeat * (datatype / 10); else if (tform[ii][0] == 'P' || tform[ii][1] == 'P') /* this is a 'P' variable length descriptor (neg. datatype) */ naxis1 += 8; else /* this is a 'Q' variable length descriptor (neg. datatype) */ naxis1 += 16; if (*status > 0) break; /* abort loop on error */ } ffpkyj(fptr, "NAXIS1", naxis1, "width of table in bytes", status); ffpkyj(fptr, "NAXIS2", naxis2, "number of rows in table", status); /* the initial value of PCOUNT (= size of the variable length array heap) should always be zero. If any variable length data is written, then the value of PCOUNT will be updated when the HDU is closed */ ffpkyj(fptr, "PCOUNT", 0, "size of special data area", status); ffpkyj(fptr, "GCOUNT", 1, "one data group (required keyword)", status); ffpkyj(fptr, "TFIELDS", tfields, "number of fields in each row", status); for (ii = 0; ii < tfields; ii++) /* loop over every column */ { if ( *(ttype[ii]) ) /* optional TTYPEn keyword */ { sprintf(comm, "label for field %3d", ii + 1); ffkeyn("TTYPE", ii + 1, name, status); ffpkys(fptr, name, ttype[ii], comm, status); } strcpy(tfmt, tform[ii]); /* required TFORMn keyword */ ffupch(tfmt); ffkeyn("TFORM", ii + 1, name, status); strcpy(comm, "data format of field"); ffbnfm(tfmt, &datatype, &repeat, &width, status); if (datatype == TSTRING) { strcat(comm, ": ASCII Character"); /* Do sanity check to see if an ASCII table format was used, */ /* e.g., 'A8' instead of '8A', or a bad unit width eg '8A9'. */ /* Don't want to return an error status, so write error into */ /* the keyword comment. */ cptr = strchr(tfmt,'A'); cptr++; if (cptr) iread = sscanf(cptr,"%ld", &width); if (iread == 1 && (width > repeat)) { if (repeat == 1) strcpy(comm, "ERROR?? USING ASCII TABLE SYNTAX BY MISTAKE??"); else strcpy(comm, "rAw FORMAT ERROR! UNIT WIDTH w > COLUMN WIDTH r"); } } else if (datatype == TBIT) strcat(comm, ": BIT"); else if (datatype == TBYTE) strcat(comm, ": BYTE"); else if (datatype == TLOGICAL) strcat(comm, ": 1-byte LOGICAL"); else if (datatype == TSHORT) strcat(comm, ": 2-byte INTEGER"); else if (datatype == TUSHORT) strcat(comm, ": 2-byte INTEGER"); else if (datatype == TLONG) strcat(comm, ": 4-byte INTEGER"); else if (datatype == TLONGLONG) strcat(comm, ": 8-byte INTEGER"); else if (datatype == TULONG) strcat(comm, ": 4-byte INTEGER"); else if (datatype == TFLOAT) strcat(comm, ": 4-byte REAL"); else if (datatype == TDOUBLE) strcat(comm, ": 8-byte DOUBLE"); else if (datatype == TCOMPLEX) strcat(comm, ": COMPLEX"); else if (datatype == TDBLCOMPLEX) strcat(comm, ": DOUBLE COMPLEX"); else if (datatype < 0) strcat(comm, ": variable length array"); if (abs(datatype) == TSBYTE) /* signed bytes */ { /* Replace the 'S' with an 'B' in the TFORMn code */ cptr = tfmt; while (*cptr != 'S') cptr++; *cptr = 'B'; ffpkys(fptr, name, tfmt, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", ii + 1, name, status); strcpy(comm, "offset for signed bytes"); ffpkyg(fptr, name, -128., 0, comm, status); ffkeyn("TSCAL", ii + 1, name, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, name, 1., 0, comm, status); } else if (abs(datatype) == TUSHORT) { /* Replace the 'U' with an 'I' in the TFORMn code */ cptr = tfmt; while (*cptr != 'U') cptr++; *cptr = 'I'; ffpkys(fptr, name, tfmt, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", ii + 1, name, status); strcpy(comm, "offset for unsigned integers"); ffpkyg(fptr, name, 32768., 0, comm, status); ffkeyn("TSCAL", ii + 1, name, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, name, 1., 0, comm, status); } else if (abs(datatype) == TULONG) { /* Replace the 'V' with an 'J' in the TFORMn code */ cptr = tfmt; while (*cptr != 'V') cptr++; *cptr = 'J'; ffpkys(fptr, name, tfmt, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", ii + 1, name, status); strcpy(comm, "offset for unsigned integers"); ffpkyg(fptr, name, 2147483648., 0, comm, status); ffkeyn("TSCAL", ii + 1, name, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, name, 1., 0, comm, status); } else { ffpkys(fptr, name, tfmt, comm, status); } if (tunit) { if (tunit[ii] && *(tunit[ii]) ) /* optional TUNITn keyword */ { ffkeyn("TUNIT", ii + 1, name, status); ffpkys(fptr, name, tunit[ii], "physical unit of field", status); } } if (*status > 0) break; /* abort loop on error */ } if (extnm) { if (extnm[0]) /* optional EXTNAME keyword */ ffpkys(fptr, "EXTNAME", extnm, "name of this binary table extension", status); } if (*status > 0) ffpmsg("Failed to write binary table header keywords (ffphbn)"); return(*status); } /*--------------------------------------------------------------------------*/ int ffphext(fitsfile *fptr, /* I - FITS file pointer */ const char *xtensionx, /* I - value for the XTENSION keyword */ int bitpix, /* I - value for the BIXPIX keyword */ int naxis, /* I - value for the NAXIS keyword */ long naxes[], /* I - value for the NAXISn keywords */ LONGLONG pcount, /* I - value for the PCOUNT keyword */ LONGLONG gcount, /* I - value for the GCOUNT keyword */ int *status) /* IO - error status */ /* Put required Header keywords into a conforming extension: */ { char message[FLEN_ERRMSG],comm[81], name[20], xtension[FLEN_VALUE]; int ii; if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (*status > 0) return(*status); else if ((fptr->Fptr)->headend != (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) return(*status = HEADER_NOT_EMPTY); if (naxis < 0 || naxis > 999) { sprintf(message, "Illegal value for NAXIS keyword: %d", naxis); ffpmsg(message); return(*status = BAD_NAXIS); } xtension[0] = '\0'; strncat(xtension, xtensionx, FLEN_VALUE-1); ffpkys(fptr, "XTENSION", xtension, "extension type", status); ffpkyj(fptr, "BITPIX", bitpix, "number of bits per data pixel", status); ffpkyj(fptr, "NAXIS", naxis, "number of data axes", status); strcpy(comm, "length of data axis "); for (ii = 0; ii < naxis; ii++) { if (naxes[ii] < 0) { sprintf(message, "Illegal negative value for NAXIS%d keyword: %.0f", ii + 1, (double) (naxes[ii])); ffpmsg(message); return(*status = BAD_NAXES); } sprintf(&comm[20], "%d", ii + 1); ffkeyn("NAXIS", ii + 1, name, status); ffpkyj(fptr, name, naxes[ii], comm, status); } ffpkyj(fptr, "PCOUNT", pcount, " ", status); ffpkyj(fptr, "GCOUNT", gcount, " ", status); if (*status > 0) ffpmsg("Failed to write extension header keywords (ffphext)"); return(*status); } /*--------------------------------------------------------------------------*/ int ffi2c(LONGLONG ival, /* I - value to be converted to a string */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status */ /* convert value to a null-terminated formatted string. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); cval[0] = '\0'; #if defined(_MSC_VER) /* Microsoft Visual C++ 6.0 uses '%I64d' syntax for 8-byte integers */ if (sprintf(cval, "%I64d", ival) < 0) #elif (USE_LL_SUFFIX == 1) if (sprintf(cval, "%lld", ival) < 0) #else if (sprintf(cval, "%ld", ival) < 0) #endif { ffpmsg("Error in ffi2c converting integer to string"); *status = BAD_I2C; } return(*status); } /*--------------------------------------------------------------------------*/ int ffl2c(int lval, /* I - value to be converted to a string */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status ) */ /* convert logical value to a null-terminated formatted string. If the input value == 0, then the output character is the letter F, else the output character is the letter T. The output string is null terminated. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (lval) strcpy(cval,"T"); else strcpy(cval,"F"); return(*status); } /*--------------------------------------------------------------------------*/ int ffs2c(const char *instr, /* I - null terminated input string */ char *outstr, /* O - null terminated quoted output string */ int *status) /* IO - error status */ /* convert an input string to a quoted string. Leading spaces are significant. FITS string keyword values must be at least 8 chars long so pad out string with spaces if necessary. Example: km/s ==> 'km/s ' Single quote characters in the input string will be replace by two single quote characters. e.g., o'brian ==> 'o''brian' */ { size_t len, ii, jj; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (!instr) /* a null input pointer?? */ { strcpy(outstr, "''"); /* a null FITS string */ return(*status); } outstr[0] = '\''; /* start output string with a quote */ len = strlen(instr); if (len > 68) len = 68; /* limit input string to 68 chars */ for (ii=0, jj=1; ii < len && jj < 69; ii++, jj++) { outstr[jj] = instr[ii]; /* copy each char from input to output */ if (instr[ii] == '\'') { jj++; outstr[jj]='\''; /* duplicate any apostrophies in the input */ } } for (; jj < 9; jj++) /* pad string so it is at least 8 chars long */ outstr[jj] = ' '; if (jj == 70) /* only occurs if the last char of string was a quote */ outstr[69] = '\0'; else { outstr[jj] = '\''; /* append closing quote character */ outstr[jj+1] = '\0'; /* terminate the string */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffr2f(float fval, /* I - value to be converted to a string */ int decim, /* I - number of decimal places to display */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status */ /* convert float value to a null-terminated F format string */ { char *cptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); cval[0] = '\0'; if (decim < 0) { ffpmsg("Error in ffr2f: no. of decimal places < 0"); return(*status = BAD_DECIM); } if (sprintf(cval, "%.*f", decim, fval) < 0) { ffpmsg("Error in ffr2f converting float to string"); *status = BAD_F2C; } /* replace comma with a period (e.g. in French locale) */ if ( (cptr = strchr(cval, ','))) *cptr = '.'; /* test if output string is 'NaN', 'INDEF', or 'INF' */ if (strchr(cval, 'N')) { ffpmsg("Error in ffr2f: float value is a NaN or INDEF"); *status = BAD_F2C; } return(*status); } /*--------------------------------------------------------------------------*/ int ffr2e(float fval, /* I - value to be converted to a string */ int decim, /* I - number of decimal places to display */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status */ /* convert float value to a null-terminated exponential format string */ { char *cptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); cval[0] = '\0'; if (decim < 0) { /* use G format if decim is negative */ if ( sprintf(cval, "%.*G", -decim, fval) < 0) { ffpmsg("Error in ffr2e converting float to string"); *status = BAD_F2C; } else { /* test if E format was used, and there is no displayed decimal */ if ( !strchr(cval, '.') && strchr(cval,'E') ) { /* reformat value with a decimal point and single zero */ if ( sprintf(cval, "%.1E", fval) < 0) { ffpmsg("Error in ffr2e converting float to string"); *status = BAD_F2C; } return(*status); } } } else { if ( sprintf(cval, "%.*E", decim, fval) < 0) { ffpmsg("Error in ffr2e converting float to string"); *status = BAD_F2C; } } if (*status <= 0) { /* replace comma with a period (e.g. in French locale) */ if ( (cptr = strchr(cval, ','))) *cptr = '.'; /* test if output string is 'NaN', 'INDEF', or 'INF' */ if (strchr(cval, 'N')) { ffpmsg("Error in ffr2e: float value is a NaN or INDEF"); *status = BAD_F2C; } else if ( !strchr(cval, '.') && !strchr(cval,'E') ) { /* add decimal point if necessary to distinquish from integer */ strcat(cval, "."); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffd2f(double dval, /* I - value to be converted to a string */ int decim, /* I - number of decimal places to display */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status */ /* convert double value to a null-terminated F format string */ { char *cptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); cval[0] = '\0'; if (decim < 0) { ffpmsg("Error in ffd2f: no. of decimal places < 0"); return(*status = BAD_DECIM); } if (sprintf(cval, "%.*f", decim, dval) < 0) { ffpmsg("Error in ffd2f converting double to string"); *status = BAD_F2C; } /* replace comma with a period (e.g. in French locale) */ if ( (cptr = strchr(cval, ','))) *cptr = '.'; /* test if output string is 'NaN', 'INDEF', or 'INF' */ if (strchr(cval, 'N')) { ffpmsg("Error in ffd2f: double value is a NaN or INDEF"); *status = BAD_F2C; } return(*status); } /*--------------------------------------------------------------------------*/ int ffd2e(double dval, /* I - value to be converted to a string */ int decim, /* I - number of decimal places to display */ char *cval, /* O - character string representation of the value */ int *status) /* IO - error status */ /* convert double value to a null-terminated exponential format string. */ { char *cptr; if (*status > 0) /* inherit input status value if > 0 */ return(*status); cval[0] = '\0'; if (decim < 0) { /* use G format if decim is negative */ if ( sprintf(cval, "%.*G", -decim, dval) < 0) { ffpmsg("Error in ffd2e converting float to string"); *status = BAD_F2C; } else { /* test if E format was used, and there is no displayed decimal */ if ( !strchr(cval, '.') && strchr(cval,'E') ) { /* reformat value with a decimal point and single zero */ if ( sprintf(cval, "%.1E", dval) < 0) { ffpmsg("Error in ffd2e converting float to string"); *status = BAD_F2C; } return(*status); } } } else { if ( sprintf(cval, "%.*E", decim, dval) < 0) { ffpmsg("Error in ffd2e converting float to string"); *status = BAD_F2C; } } if (*status <= 0) { /* replace comma with a period (e.g. in French locale) */ if ( (cptr = strchr(cval, ','))) *cptr = '.'; /* test if output string is 'NaN', 'INDEF', or 'INF' */ if (strchr(cval, 'N')) { ffpmsg("Error in ffd2e: double value is a NaN or INDEF"); *status = BAD_F2C; } else if ( !strchr(cval, '.') && !strchr(cval,'E') ) { /* add decimal point if necessary to distinquish from integer */ strcat(cval, "."); } } return(*status); } astropy-0.3/cextern/cfitsio/inffixed.h0000644000175000017500000001430712243255342016261 0ustar oleole /* inffixed.h -- table for decoding fixed codes * Generated automatically by makefixed(). */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ static const code lenfix[512] = { {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, {0,9,255} }; static const code distfix[32] = { {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, {22,5,193},{64,5,0} }; astropy-0.3/cextern/cfitsio/crc32.c0000644000175000017500000003254012243255342015373 0ustar oleole/* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2006, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing * tables for updating the shift register in one step with three exclusive-ors * instead of four steps with four exclusive-ors. This results in about a * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. */ /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore protection on the static variables used to control the first-use generation of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should first call get_crc_table() to initialize the tables before allowing more than one thread to use crc32(). */ #ifdef MAKECRCH # include # ifndef DYNAMIC_CRC_TABLE # define DYNAMIC_CRC_TABLE # endif /* !DYNAMIC_CRC_TABLE */ #endif /* MAKECRCH */ #include "zutil.h" /* for STDC and FAR definitions */ #define local static /* Find a four-byte integer type for crc32_little() and crc32_big(). */ #ifndef NOBYFOUR # ifdef STDC /* need ANSI C limits.h to determine sizes */ # include # define BYFOUR # if (UINT_MAX == 0xffffffffUL) typedef unsigned int u4; # else # if (ULONG_MAX == 0xffffffffUL) typedef unsigned long u4; # else # if (USHRT_MAX == 0xffffffffUL) typedef unsigned short u4; # else # undef BYFOUR /* can't find a four-byte integer type! */ # endif # endif # endif # endif /* STDC */ #endif /* !NOBYFOUR */ /* Definitions for doing the crc four data bytes at a time. */ #ifdef BYFOUR # define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \ (((w)&0xff00)<<8)+(((w)&0xff)<<24)) local unsigned long crc32_little OF((unsigned long, const unsigned char FAR *, unsigned)); local unsigned long crc32_big OF((unsigned long, const unsigned char FAR *, unsigned)); # define TBLS 8 #else # define TBLS 1 #endif /* BYFOUR */ /* Local functions for crc concatenation */ local unsigned long gf2_matrix_times OF((unsigned long *mat, unsigned long vec)); local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2); #ifdef DYNAMIC_CRC_TABLE local volatile int crc_table_empty = 1; local unsigned long FAR crc_table[TBLS][256]; local void make_crc_table OF((void)); #ifdef MAKECRCH local void write_table OF((FILE *, const unsigned long FAR *)); #endif /* MAKECRCH */ /* Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x (which is shifting right by one and adding x^32 mod p if the bit shifted out is a one). We start with the highest power (least significant bit) of q and repeat for all eight bits of q. The first table is simply the CRC of all possible eight bit values. This is all the information needed to generate CRCs on data a byte at a time for all combinations of CRC register values and incoming bytes. The remaining tables allow for word-at-a-time CRC calculation for both big-endian and little- endian machines, where a word is four bytes. */ local void make_crc_table() { unsigned long c; int n, k; unsigned long poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static volatile int first = 1; /* flag to limit concurrent making */ static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; /* See if another task is already doing this (not thread-safe, but better than nothing -- significantly reduces duration of vulnerability in case the advice about DYNAMIC_CRC_TABLE is ignored) */ if (first) { first = 0; /* make exclusive-or pattern from polynomial (0xedb88320UL) */ poly = 0UL; for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) poly |= 1UL << (31 - p[n]); /* generate a crc for every 8-bit value */ for (n = 0; n < 256; n++) { c = (unsigned long)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[0][n] = c; } #ifdef BYFOUR /* generate crc for each value followed by one, two, and three zeros, and then the byte reversal of those as well as the first table */ for (n = 0; n < 256; n++) { c = crc_table[0][n]; crc_table[4][n] = REV(c); for (k = 1; k < 4; k++) { c = crc_table[0][c & 0xff] ^ (c >> 8); crc_table[k][n] = c; crc_table[k + 4][n] = REV(c); } } #endif /* BYFOUR */ crc_table_empty = 0; } else { /* not first */ /* wait for the other guy to finish (not efficient, but rare) */ while (crc_table_empty) ; } #ifdef MAKECRCH /* write out CRC tables to crc32.h */ { FILE *out; out = fopen("crc32.h", "w"); if (out == NULL) return; fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); fprintf(out, "local const unsigned long FAR "); fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); write_table(out, crc_table[0]); # ifdef BYFOUR fprintf(out, "#ifdef BYFOUR\n"); for (k = 1; k < 8; k++) { fprintf(out, " },\n {\n"); write_table(out, crc_table[k]); } fprintf(out, "#endif\n"); # endif /* BYFOUR */ fprintf(out, " }\n};\n"); fclose(out); } #endif /* MAKECRCH */ } #ifdef MAKECRCH local void write_table(out, table) FILE *out; const unsigned long FAR *table; { int n; for (n = 0; n < 256; n++) fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } #endif /* MAKECRCH */ #else /* !DYNAMIC_CRC_TABLE */ /* ======================================================================== * Tables of CRC-32s of all single-byte values, made by make_crc_table(). */ #include "crc32.h" #endif /* DYNAMIC_CRC_TABLE */ /* ========================================================================= * This function can be used by asm versions of crc32() */ const unsigned long FAR * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ return (const unsigned long FAR *)crc_table; } /* ========================================================================= */ #define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 /* ========================================================================= */ unsigned long ZEXPORT crc32(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; uInt len; { if (buf == Z_NULL) return 0UL; #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ #ifdef BYFOUR if (sizeof(void *) == sizeof(ptrdiff_t)) { u4 endian; endian = 1; if (*((unsigned char *)(&endian))) return crc32_little(crc, buf, len); else return crc32_big(crc, buf, len); } #endif /* BYFOUR */ crc = crc ^ 0xffffffffUL; while (len >= 8) { DO8; len -= 8; } if (len) do { DO1; } while (--len); return crc ^ 0xffffffffUL; } #ifdef BYFOUR /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 /* ========================================================================= */ local unsigned long crc32_little(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register u4 c; register const u4 FAR *buf4; c = (u4)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); len--; } buf4 = (const u4 FAR *)(const void FAR *)buf; while (len >= 32) { DOLIT32; len -= 32; } while (len >= 4) { DOLIT4; len -= 4; } buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); } while (--len); c = ~c; return (unsigned long)c; } /* ========================================================================= */ #define DOBIG4 c ^= *++buf4; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* ========================================================================= */ local unsigned long crc32_big(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; unsigned len; { register u4 c; register const u4 FAR *buf4; c = REV((u4)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); len--; } buf4 = (const u4 FAR *)(const void FAR *)buf; buf4--; while (len >= 32) { DOBIG32; len -= 32; } while (len >= 4) { DOBIG4; len -= 4; } buf4++; buf = (const unsigned char FAR *)buf4; if (len) do { c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); } while (--len); c = ~c; return (unsigned long)(REV(c)); } #endif /* BYFOUR */ #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ /* ========================================================================= */ local unsigned long gf2_matrix_times(mat, vec) unsigned long *mat; unsigned long vec; { unsigned long sum; sum = 0; while (vec) { if (vec & 1) sum ^= *mat; vec >>= 1; mat++; } return sum; } /* ========================================================================= */ local void gf2_matrix_square(square, mat) unsigned long *square; unsigned long *mat; { int n; for (n = 0; n < GF2_DIM; n++) square[n] = gf2_matrix_times(mat, mat[n]); } /* ========================================================================= */ local uLong crc32_combine_(crc1, crc2, len2) uLong crc1; uLong crc2; z_off64_t len2; { int n; unsigned long row; unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ /* degenerate case (also disallow negative lengths) */ if (len2 <= 0) return crc1; /* put operator for one zero bit in odd */ odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ row = 1; for (n = 1; n < GF2_DIM; n++) { odd[n] = row; row <<= 1; } /* put operator for two zero bits in even */ gf2_matrix_square(even, odd); /* put operator for four zero bits in odd */ gf2_matrix_square(odd, even); /* apply len2 zeros to crc1 (first square will put the operator for one zero byte, eight zero bits, in even) */ do { /* apply zeros operator for this bit of len2 */ gf2_matrix_square(even, odd); if (len2 & 1) crc1 = gf2_matrix_times(even, crc1); len2 >>= 1; /* if no more bits set, then done */ if (len2 == 0) break; /* another iteration of the loop with odd and even swapped */ gf2_matrix_square(odd, even); if (len2 & 1) crc1 = gf2_matrix_times(odd, crc1); len2 >>= 1; /* if no more bits set, then done */ } while (len2 != 0); /* return combined crc */ crc1 ^= crc2; return crc1; } /* ========================================================================= */ uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; z_off_t len2; { return crc32_combine_(crc1, crc2, len2); } uLong ZEXPORT crc32_combine64(crc1, crc2, len2) uLong crc1; uLong crc2; z_off64_t len2; { return crc32_combine_(crc1, crc2, len2); } astropy-0.3/cextern/cfitsio/trees.c0000644000175000017500000013025112243255342015577 0ustar oleole/* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2010 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process uses several Huffman trees. The more * common source values are represented by shorter bit sequences. * * Each code tree is stored in a compressed form which is itself * a Huffman encoding of the lengths of all the code strings (in * ascending order by source values). The actual code strings are * reconstructed from the lengths in the inflate process, as described * in the deflate specification. * * REFERENCES * * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc * * Storer, James A. * Data Compression: Methods and Theory, pp. 49-50. * Computer Science Press, 1988. ISBN 0-7167-8156-5. * * Sedgewick, R. * Algorithms, p290. * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ /* #define GEN_TREES_H */ #include "deflate.h" #ifdef DEBUG # include #endif /* =========================================================================== * Constants */ #define MAX_BL_BITS 7 /* Bit length codes must not exceed MAX_BL_BITS bits */ #define END_BLOCK 256 /* end of block literal code */ #define REP_3_6 16 /* repeat previous bit length 3-6 times (2 bits of repeat count) */ #define REPZ_3_10 17 /* repeat a zero length 3-10 times (3 bits of repeat count) */ #define REPZ_11_138 18 /* repeat a zero length 11-138 times (7 bits of repeat count) */ local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; local const int extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ #define Buf_size (8 * 2*sizeof(char)) /* Number of bits used within bi_buf. (bi_buf might be implemented on * more than 16 bits on some systems.) */ /* =========================================================================== * Local data. These are initialized only once. */ #define DIST_CODE_LEN 512 /* see definition of array dist_code below */ #if defined(GEN_TREES_H) || !defined(STDC) /* non ANSI compilers may not accept trees.h */ local ct_data static_ltree[L_CODES+2]; /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ local ct_data static_dtree[D_CODES]; /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ uch _dist_code[DIST_CODE_LEN]; /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ uch _length_code[MAX_MATCH-MIN_MATCH+1]; /* length code for each normalized match length (0 == MIN_MATCH) */ local int base_length[LENGTH_CODES]; /* First normalized length for each code (0 = MIN_MATCH) */ local int base_dist[D_CODES]; /* First normalized distance for each code (0 = distance of 1) */ #else # include "trees.h" #endif /* GEN_TREES_H */ struct static_tree_desc_s { const ct_data *static_tree; /* static tree or NULL */ const intf *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ }; local static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; local static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; local static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== * Local (static) routines in this file. */ local void tr_static_init OF((void)); local void init_block OF((deflate_state *s)); local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); local void build_tree OF((deflate_state *s, tree_desc *desc)); local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); local void compress_block OF((deflate_state *s, ct_data *ltree, ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); local void copy_block OF((deflate_state *s, charf *buf, unsigned len, int header)); #ifdef GEN_TREES_H local void gen_trees_header OF((void)); #endif #ifndef DEBUG # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ #else /* DEBUG */ # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); } #endif /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ #define put_short(s, w) { \ put_byte(s, (uch)((w) & 0xff)); \ put_byte(s, (uch)((ush)(w) >> 8)); \ } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #ifdef DEBUG local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits(s, value, length) deflate_state *s; int value; /* value to send */ int length; /* number of bits */ { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { s->bi_buf |= (ush)value << s->bi_valid; put_short(s, s->bi_buf); s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); s->bi_valid += length - Buf_size; } else { s->bi_buf |= (ush)value << s->bi_valid; s->bi_valid += length; } } #else /* !DEBUG */ #define send_bits(s, value, length) \ { int len = length;\ if (s->bi_valid > (int)Buf_size - len) {\ int val = value;\ s->bi_buf |= (ush)val << s->bi_valid;\ put_short(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ s->bi_valid += len - Buf_size;\ } else {\ s->bi_buf |= (ush)(value) << s->bi_valid;\ s->bi_valid += len;\ }\ } #endif /* DEBUG */ /* the arguments must not have side effects */ /* =========================================================================== * Initialize the various 'constant' tables. */ local void tr_static_init() { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ #ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bi_reverse((unsigned)n, 5); } static_init_done = 1; # ifdef GEN_TREES_H gen_trees_header(); # endif #endif /* defined(GEN_TREES_H) || !defined(STDC) */ } /* =========================================================================== * Genererate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef DEBUG # include # endif # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ ((i) % (width) == (width)-1 ? ",\n" : ", ")) void gen_trees_header() { FILE *header = fopen("trees.h", "w"); int i; Assert (header != NULL, "Can't open trees.h"); fprintf(header, "/* header created automatically with -DGEN_TREES_H */\n\n"); fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { fprintf(header, "%2u%s", _dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); } fprintf(header, "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { fprintf(header, "%2u%s", _length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { fprintf(header, "%1u%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); } fprintf(header, "local const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "%5u%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); } fclose(header); } #endif /* GEN_TREES_H */ /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ void ZLIB_INTERNAL _tr_init(s) deflate_state *s; { tr_static_init(); s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; s->d_desc.dyn_tree = s->dyn_dtree; s->d_desc.stat_desc = &static_d_desc; s->bl_desc.dyn_tree = s->bl_tree; s->bl_desc.stat_desc = &static_bl_desc; s->bi_buf = 0; s->bi_valid = 0; s->last_eob_len = 8; /* enough lookahead for inflate */ #ifdef DEBUG s->compressed_len = 0L; s->bits_sent = 0L; #endif /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Initialize a new block. */ local void init_block(s) deflate_state *s; { int n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; s->last_lit = s->matches = 0; } #define SMALLEST 1 /* Index within the heap array of least frequent node in the Huffman tree */ /* =========================================================================== * Remove the smallest element from the heap and recreate the heap with * one less element. Updates heap and heap_len. */ #define pqremove(s, tree, top) \ {\ top = s->heap[SMALLEST]; \ s->heap[SMALLEST] = s->heap[s->heap_len--]; \ pqdownheap(s, tree, SMALLEST); \ } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ #define smaller(tree, n, m, depth) \ (tree[n].Freq < tree[m].Freq || \ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ local void pqdownheap(s, tree, k) deflate_state *s; ct_data *tree; /* the tree to restore */ int k; /* node to move down */ { int v = s->heap[k]; int j = k << 1; /* left son of k */ while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s->heap[j], s->depth)) break; /* Exchange v with the smallest son */ s->heap[k] = s->heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s->heap[k] = v; } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ local void gen_bitlen(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; const ct_data *stree = desc->stat_desc->static_tree; const intf *extra = desc->stat_desc->extra_bits; int base = desc->stat_desc->extra_base; int max_length = desc->stat_desc->max_length; int h; /* heap index */ int n, m; /* iterate over the tree elements */ int bits; /* bit length */ int xbits; /* extra bits */ ush f; /* frequency */ int overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ for (h = s->heap_max+1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) continue; /* not a leaf node */ s->bl_count[bits]++; xbits = 0; if (n >= base) xbits = extra[n-base]; f = tree[n].Freq; s->opt_len += (ulg)f * (bits + xbits); if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); } if (overflow == 0) return; Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s->bl_count[bits] == 0) bits--; s->bl_count[bits]--; /* move one leaf down the tree */ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits != 0; bits--) { n = s->bl_count[bits]; while (n != 0) { m = s->heap[--h]; if (m > max_code) continue; if ((unsigned) tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ local void gen_codes (tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; int elems = desc->stat_desc->elems; int n, m; /* iterate over heap elements */ int max_code = -1; /* largest code with non zero frequency */ int node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s->heap_len = 0, s->heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n].Freq != 0) { s->heap[++(s->heap_len)] = max_code = n; s->depth[n] = 0; } else { tree[n].Len = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s->heap_len < 2) { node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); tree[node].Freq = 1; s->depth[node] = 0; s->opt_len--; if (stree) s->static_len -= stree[node].Len; /* node is 0 or 1 so it does not have extra bits */ } desc->max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { pqremove(s, tree, n); /* n = node of least frequency */ m = s->heap[SMALLEST]; /* m = node of next least frequency */ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ s->heap[--(s->heap_max)] = m; /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? s->depth[n] : s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); } #endif /* and insert the new node in the heap */ s->heap[SMALLEST] = node++; pqdownheap(s, tree, SMALLEST); } while (s->heap_len >= 2); s->heap[--(s->heap_max)] = s->heap[SMALLEST]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, (tree_desc *)desc); /* The field len is now set, we can generate the bit codes */ gen_codes ((ct_data *)tree, max_code, s->bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ local void scan_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; tree[max_code+1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { s->bl_tree[curlen].Freq += count; } else if (curlen != 0) { if (curlen != prevlen) s->bl_tree[curlen].Freq++; s->bl_tree[REP_3_6].Freq++; } else if (count <= 10) { s->bl_tree[REPZ_3_10].Freq++; } else { s->bl_tree[REPZ_11_138].Freq++; } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ local void send_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s->bl_tree); } while (--count != 0); } else if (curlen != 0) { if (curlen != prevlen) { send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ local int build_bl_tree(s) deflate_state *s; { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ s->opt_len += 3*(max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ local void send_all_trees(s, lcodes, dcodes, blcodes) deflate_state *s; int lcodes, dcodes, blcodes; /* number of codes for each tree */ { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Send a stored block */ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) deflate_state *s; charf *buf; /* input block */ ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ #ifdef DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; #endif copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. * The current inflate code requires 9 bits of lookahead. If the * last two codes for the previous block (real code plus EOB) were coded * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode * the last real code. In this case we send two empty static blocks instead * of one. (There are no problems if the previous block is stored or fixed.) * To simplify the code, we assume the worst case of last real code encoded * on one bit only. */ void ZLIB_INTERNAL _tr_align(s) deflate_state *s; { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); /* Of the 10 bits for the empty block, we have already sent * (10 - bi_valid) bits. The lookahead for the last real code (before * the EOB of the previous block) was thus at least one plus the length * of the EOB plus what we have just sent of the empty static block. */ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; #endif bi_flush(s); } s->last_eob_len = 7; } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { /* Check if the file is binary or text */ if (s->strm->data_type == Z_UNKNOWN) s->strm->data_type = detect_data_type(s); /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, s->static_len)); build_tree(s, (tree_desc *)(&(s->d_desc))); Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, s->last_lit)); if (static_lenb <= opt_lenb) opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else if (stored_len+4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); #ifdef FORCE_STATIC } else if (static_lenb >= 0) { /* force static trees */ #else } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+last, 3); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif } else { send_bits(s, (DYN_TREES<<1)+last, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { bi_windup(s); #ifdef DEBUG s->compressed_len += 7; /* align on byte boundary */ #endif } Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally (s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; } else { s->matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ Assert((ush)dist < (ush)MAX_DIST(s) && (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } #ifdef TRUNCATE_BLOCK /* Try to guess if it is profitable to stop the current block here */ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { /* Compute an upper bound for the compressed length */ ulg out_length = (ulg)s->last_lit*8L; ulg in_length = (ulg)((long)s->strstart - s->block_start); int dcode; for (dcode = 0; dcode < D_CODES; dcode++) { out_length += (ulg)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]); } out_length >>= 3; Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", s->last_lit, in_length, out_length, 100L - out_length*100L/in_length)); if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; } #endif return (s->last_lit == s->lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block(s, ltree, dtree) deflate_state *s; ct_data *ltree; /* literal tree */ ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->last_lit != 0) do { dist = s->d_buf[lx]; lc = s->l_buf[lx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra != 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, "pendingBuf overflow"); } while (lx < s->last_lit); send_code(s, END_BLOCK, ltree); s->last_eob_len = ltree[END_BLOCK].Len; } /* =========================================================================== * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the * "black list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ local int detect_data_type(s) deflate_state *s; { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ unsigned long black_mask = 0xf3ffc07fUL; int n; /* Check for non-textual ("black-listed") bytes. */ for (n = 0; n <= 31; n++, black_mask >>= 1) if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) return Z_BINARY; /* Check for textual ("white-listed") bytes. */ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) return Z_TEXT; for (n = 32; n < LITERALS; n++) if (s->dyn_ltree[n].Freq != 0) return Z_TEXT; /* There are no "black-listed" or "white-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ local unsigned bi_reverse(code, len) unsigned code; /* the value to invert */ int len; /* its bit length */ { register unsigned res = 0; do { res |= code & 1; code >>= 1, res <<= 1; } while (--len > 0); return res >> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ local void bi_flush(s) deflate_state *s; { if (s->bi_valid == 16) { put_short(s, s->bi_buf); s->bi_buf = 0; s->bi_valid = 0; } else if (s->bi_valid >= 8) { put_byte(s, (Byte)s->bi_buf); s->bi_buf >>= 8; s->bi_valid -= 8; } } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ local void bi_windup(s) deflate_state *s; { if (s->bi_valid > 8) { put_short(s, s->bi_buf); } else if (s->bi_valid > 0) { put_byte(s, (Byte)s->bi_buf); } s->bi_buf = 0; s->bi_valid = 0; #ifdef DEBUG s->bits_sent = (s->bits_sent+7) & ~7; #endif } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ local void copy_block(s, buf, len, header) deflate_state *s; charf *buf; /* the input data */ unsigned len; /* its length */ int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; #endif } #ifdef DEBUG s->bits_sent += (ulg)len<<3; #endif while (len--) { put_byte(s, *buf++); } } astropy-0.3/cextern/cfitsio/putcol.c0000644000175000017500000017765012243255342016001 0ustar oleole/* This file, putcol.c, contains routines that write data elements to */ /* a FITS image or table. These are the generic routines. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppx( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *firstpix, /* I - coord of first pixel to write(1 based) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of pixels to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine is simillar to ffppr, except it supports writing to large images with more than 2**31 pixels. */ { int naxis, ii; long group = 1; LONGLONG firstelem, dimsize = 1, naxes[9]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; } firstelem++; if (datatype == TBYTE) { ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status); } else if (datatype == TSBYTE) { ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status); } else if (datatype == TUSHORT) { ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array, status); } else if (datatype == TSHORT) { ffppri(fptr, group, firstelem, nelem, (short *) array, status); } else if (datatype == TUINT) { ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status); } else if (datatype == TINT) { ffpprk(fptr, group, firstelem, nelem, (int *) array, status); } else if (datatype == TULONG) { ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status); } else if (datatype == TLONG) { ffpprj(fptr, group, firstelem, nelem, (long *) array, status); } else if (datatype == TLONGLONG) { ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status); } else if (datatype == TFLOAT) { ffppre(fptr, group, firstelem, nelem, (float *) array, status); } else if (datatype == TDOUBLE) { ffpprd(fptr, group, firstelem, nelem, (double *) array, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffppxll( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG *firstpix, /* I - coord of first pixel to write(1 based) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of pixels to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine is simillar to ffppr, except it supports writing to large images with more than 2**31 pixels. */ { int naxis, ii; long group = 1; LONGLONG firstelem, dimsize = 1, naxes[9]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; } firstelem++; if (datatype == TBYTE) { ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status); } else if (datatype == TSBYTE) { ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status); } else if (datatype == TUSHORT) { ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array, status); } else if (datatype == TSHORT) { ffppri(fptr, group, firstelem, nelem, (short *) array, status); } else if (datatype == TUINT) { ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status); } else if (datatype == TINT) { ffpprk(fptr, group, firstelem, nelem, (int *) array, status); } else if (datatype == TULONG) { ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status); } else if (datatype == TLONG) { ffpprj(fptr, group, firstelem, nelem, (long *) array, status); } else if (datatype == TLONGLONG) { ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status); } else if (datatype == TFLOAT) { ffppre(fptr, group, firstelem, nelem, (float *) array, status); } else if (datatype == TDOUBLE) { ffpprd(fptr, group, firstelem, nelem, (double *) array, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffppxn( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *firstpix, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ void *nulval, /* I - pointer to the null value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine supports writing to large images with more than 2**31 pixels. */ { int naxis, ii; long group = 1; LONGLONG firstelem, dimsize = 1, naxes[9]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (nulval == NULL) /* null value not defined? */ { ffppx(fptr, datatype, firstpix, nelem, array, status); return(*status); } /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; } firstelem++; if (datatype == TBYTE) { ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, *(unsigned char *) nulval, status); } else if (datatype == TSBYTE) { ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, *(signed char *) nulval, status); } else if (datatype == TUSHORT) { ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array, *(unsigned short *) nulval,status); } else if (datatype == TSHORT) { ffppni(fptr, group, firstelem, nelem, (short *) array, *(short *) nulval, status); } else if (datatype == TUINT) { ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array, *(unsigned int *) nulval, status); } else if (datatype == TINT) { ffppnk(fptr, group, firstelem, nelem, (int *) array, *(int *) nulval, status); } else if (datatype == TULONG) { ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array, *(unsigned long *) nulval,status); } else if (datatype == TLONG) { ffppnj(fptr, group, firstelem, nelem, (long *) array, *(long *) nulval, status); } else if (datatype == TLONGLONG) { ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array, *(LONGLONG *) nulval, status); } else if (datatype == TFLOAT) { ffppne(fptr, group, firstelem, nelem, (float *) array, *(float *) nulval, status); } else if (datatype == TDOUBLE) { ffppnd(fptr, group, firstelem, nelem, (double *) array, *(double *) nulval, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffppxnll( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG *firstpix, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ void *nulval, /* I - pointer to the null value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine supports writing to large images with more than 2**31 pixels. */ { int naxis, ii; long group = 1; LONGLONG firstelem, dimsize = 1, naxes[9]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (nulval == NULL) /* null value not defined? */ { ffppxll(fptr, datatype, firstpix, nelem, array, status); return(*status); } /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; } firstelem++; if (datatype == TBYTE) { ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, *(unsigned char *) nulval, status); } else if (datatype == TSBYTE) { ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, *(signed char *) nulval, status); } else if (datatype == TUSHORT) { ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array, *(unsigned short *) nulval,status); } else if (datatype == TSHORT) { ffppni(fptr, group, firstelem, nelem, (short *) array, *(short *) nulval, status); } else if (datatype == TUINT) { ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array, *(unsigned int *) nulval, status); } else if (datatype == TINT) { ffppnk(fptr, group, firstelem, nelem, (int *) array, *(int *) nulval, status); } else if (datatype == TULONG) { ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array, *(unsigned long *) nulval,status); } else if (datatype == TLONG) { ffppnj(fptr, group, firstelem, nelem, (long *) array, *(long *) nulval, status); } else if (datatype == TLONGLONG) { ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array, *(LONGLONG *) nulval, status); } else if (datatype == TFLOAT) { ffppne(fptr, group, firstelem, nelem, (float *) array, *(float *) nulval, status); } else if (datatype == TDOUBLE) { ffppnd(fptr, group, firstelem, nelem, (double *) array, *(double *) nulval, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffppr( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long group = 1; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TBYTE) { ffpprb(fptr, group, firstelem, nelem, (unsigned char *) array, status); } else if (datatype == TSBYTE) { ffpprsb(fptr, group, firstelem, nelem, (signed char *) array, status); } else if (datatype == TUSHORT) { ffpprui(fptr, group, firstelem, nelem, (unsigned short *) array, status); } else if (datatype == TSHORT) { ffppri(fptr, group, firstelem, nelem, (short *) array, status); } else if (datatype == TUINT) { ffppruk(fptr, group, firstelem, nelem, (unsigned int *) array, status); } else if (datatype == TINT) { ffpprk(fptr, group, firstelem, nelem, (int *) array, status); } else if (datatype == TULONG) { ffppruj(fptr, group, firstelem, nelem, (unsigned long *) array, status); } else if (datatype == TLONG) { ffpprj(fptr, group, firstelem, nelem, (long *) array, status); } else if (datatype == TLONGLONG) { ffpprjj(fptr, group, firstelem, nelem, (LONGLONG *) array, status); } else if (datatype == TFLOAT) { ffppre(fptr, group, firstelem, nelem, (float *) array, status); } else if (datatype == TDOUBLE) { ffpprd(fptr, group, firstelem, nelem, (double *) array, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffppn( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ void *array, /* I - array of values that are written */ void *nulval, /* I - pointer to the null value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long group = 1; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (nulval == NULL) /* null value not defined? */ { ffppr(fptr, datatype, firstelem, nelem, array, status); return(*status); } if (datatype == TBYTE) { ffppnb(fptr, group, firstelem, nelem, (unsigned char *) array, *(unsigned char *) nulval, status); } else if (datatype == TSBYTE) { ffppnsb(fptr, group, firstelem, nelem, (signed char *) array, *(signed char *) nulval, status); } else if (datatype == TUSHORT) { ffppnui(fptr, group, firstelem, nelem, (unsigned short *) array, *(unsigned short *) nulval,status); } else if (datatype == TSHORT) { ffppni(fptr, group, firstelem, nelem, (short *) array, *(short *) nulval, status); } else if (datatype == TUINT) { ffppnuk(fptr, group, firstelem, nelem, (unsigned int *) array, *(unsigned int *) nulval, status); } else if (datatype == TINT) { ffppnk(fptr, group, firstelem, nelem, (int *) array, *(int *) nulval, status); } else if (datatype == TULONG) { ffppnuj(fptr, group, firstelem, nelem, (unsigned long *) array, *(unsigned long *) nulval,status); } else if (datatype == TLONG) { ffppnj(fptr, group, firstelem, nelem, (long *) array, *(long *) nulval, status); } else if (datatype == TLONGLONG) { ffppnjj(fptr, group, firstelem, nelem, (LONGLONG *) array, *(LONGLONG *) nulval, status); } else if (datatype == TFLOAT) { ffppne(fptr, group, firstelem, nelem, (float *) array, *(float *) nulval, status); } else if (datatype == TDOUBLE) { ffppnd(fptr, group, firstelem, nelem, (double *) array, *(double *) nulval, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffpss( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc , /* I - 'top right corner' of the subsection */ void *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write a section of values to the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine supports writing to large images with more than 2**31 pixels. */ { int naxis; long naxes[9]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgisz(fptr, 9, naxes, status); if (datatype == TBYTE) { ffpssb(fptr, 1, naxis, naxes, blc, trc, (unsigned char *) array, status); } else if (datatype == TSBYTE) { ffpsssb(fptr, 1, naxis, naxes, blc, trc, (signed char *) array, status); } else if (datatype == TUSHORT) { ffpssui(fptr, 1, naxis, naxes, blc, trc, (unsigned short *) array, status); } else if (datatype == TSHORT) { ffpssi(fptr, 1, naxis, naxes, blc, trc, (short *) array, status); } else if (datatype == TUINT) { ffpssuk(fptr, 1, naxis, naxes, blc, trc, (unsigned int *) array, status); } else if (datatype == TINT) { ffpssk(fptr, 1, naxis, naxes, blc, trc, (int *) array, status); } else if (datatype == TULONG) { ffpssuj(fptr, 1, naxis, naxes, blc, trc, (unsigned long *) array, status); } else if (datatype == TLONG) { ffpssj(fptr, 1, naxis, naxes, blc, trc, (long *) array, status); } else if (datatype == TLONGLONG) { ffpssjj(fptr, 1, naxis, naxes, blc, trc, (LONGLONG *) array, status); } else if (datatype == TFLOAT) { ffpsse(fptr, 1, naxis, naxes, blc, trc, (float *) array, status); } else if (datatype == TDOUBLE) { ffpssd(fptr, 1, naxis, naxes, blc, trc, (double *) array, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffpcl( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of elements to write */ void *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to a table column. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS column is not the same as the array being written). */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TBIT) { ffpclx(fptr, colnum, firstrow, (long) firstelem, (long) nelem, (char *) array, status); } else if (datatype == TBYTE) { ffpclb(fptr, colnum, firstrow, firstelem, nelem, (unsigned char *) array, status); } else if (datatype == TSBYTE) { ffpclsb(fptr, colnum, firstrow, firstelem, nelem, (signed char *) array, status); } else if (datatype == TUSHORT) { ffpclui(fptr, colnum, firstrow, firstelem, nelem, (unsigned short *) array, status); } else if (datatype == TSHORT) { ffpcli(fptr, colnum, firstrow, firstelem, nelem, (short *) array, status); } else if (datatype == TUINT) { ffpcluk(fptr, colnum, firstrow, firstelem, nelem, (unsigned int *) array, status); } else if (datatype == TINT) { ffpclk(fptr, colnum, firstrow, firstelem, nelem, (int *) array, status); } else if (datatype == TULONG) { ffpcluj(fptr, colnum, firstrow, firstelem, nelem, (unsigned long *) array, status); } else if (datatype == TLONG) { ffpclj(fptr, colnum, firstrow, firstelem, nelem, (long *) array, status); } else if (datatype == TLONGLONG) { ffpcljj(fptr, colnum, firstrow, firstelem, nelem, (LONGLONG *) array, status); } else if (datatype == TFLOAT) { ffpcle(fptr, colnum, firstrow, firstelem, nelem, (float *) array, status); } else if (datatype == TDOUBLE) { ffpcld(fptr, colnum, firstrow, firstelem, nelem, (double *) array, status); } else if (datatype == TCOMPLEX) { ffpcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, (float *) array, status); } else if (datatype == TDBLCOMPLEX) { ffpcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, (double *) array, status); } else if (datatype == TLOGICAL) { ffpcll(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status); } else if (datatype == TSTRING) { ffpcls(fptr, colnum, firstrow, firstelem, nelem, (char **) array, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffpcn( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of elements to write */ void *array, /* I - array of values that are written */ void *nulval, /* I - pointer to the null value */ int *status) /* IO - error status */ /* Write an array of values to a table column. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS column is not the same as the array being written). */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (nulval == NULL) /* null value not defined? */ { ffpcl(fptr, datatype, colnum, firstrow, firstelem, nelem, array, status); return(*status); } if (datatype == TBYTE) { ffpcnb(fptr, colnum, firstrow, firstelem, nelem, (unsigned char *) array, *(unsigned char *) nulval, status); } else if (datatype == TSBYTE) { ffpcnsb(fptr, colnum, firstrow, firstelem, nelem, (signed char *) array, *(signed char *) nulval, status); } else if (datatype == TUSHORT) { ffpcnui(fptr, colnum, firstrow, firstelem, nelem, (unsigned short *) array, *(unsigned short *) nulval, status); } else if (datatype == TSHORT) { ffpcni(fptr, colnum, firstrow, firstelem, nelem, (short *) array, *(unsigned short *) nulval, status); } else if (datatype == TUINT) { ffpcnuk(fptr, colnum, firstrow, firstelem, nelem, (unsigned int *) array, *(unsigned int *) nulval, status); } else if (datatype == TINT) { ffpcnk(fptr, colnum, firstrow, firstelem, nelem, (int *) array, *(int *) nulval, status); } else if (datatype == TULONG) { ffpcnuj(fptr, colnum, firstrow, firstelem, nelem, (unsigned long *) array, *(unsigned long *) nulval, status); } else if (datatype == TLONG) { ffpcnj(fptr, colnum, firstrow, firstelem, nelem, (long *) array, *(long *) nulval, status); } else if (datatype == TLONGLONG) { ffpcnjj(fptr, colnum, firstrow, firstelem, nelem, (LONGLONG *) array, *(LONGLONG *) nulval, status); } else if (datatype == TFLOAT) { ffpcne(fptr, colnum, firstrow, firstelem, nelem, (float *) array, *(float *) nulval, status); } else if (datatype == TDOUBLE) { ffpcnd(fptr, colnum, firstrow, firstelem, nelem, (double *) array, *(double *) nulval, status); } else if (datatype == TCOMPLEX) { ffpcne(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, (float *) array, *(float *) nulval, status); } else if (datatype == TDBLCOMPLEX) { ffpcnd(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, (double *) array, *(double *) nulval, status); } else if (datatype == TLOGICAL) { ffpcnl(fptr, colnum, firstrow, firstelem, nelem, (char *) array, *(char *) nulval, status); } else if (datatype == TSTRING) { ffpcns(fptr, colnum, firstrow, firstelem, nelem, (char **) array, (char *) nulval, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int fits_iter_set_by_name(iteratorCol *col, /* I - iterator col structure */ fitsfile *fptr, /* I - FITS file pointer */ char *colname, /* I - column name */ int datatype, /* I - column datatype */ int iotype) /* I - InputCol, InputOutputCol, or OutputCol */ /* set all the parameters for an iterator column, by column name */ { col->fptr = fptr; strcpy(col->colname, colname); col->colnum = 0; /* set column number undefined since name is given */ col->datatype = datatype; col->iotype = iotype; return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_by_num(iteratorCol *col, /* I - iterator column structure */ fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int datatype, /* I - column datatype */ int iotype) /* I - InputCol, InputOutputCol, or OutputCol */ /* set all the parameters for an iterator column, by column number */ { col->fptr = fptr; col->colnum = colnum; col->datatype = datatype; col->iotype = iotype; return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_file(iteratorCol *col, /* I - iterator column structure */ fitsfile *fptr) /* I - FITS file pointer */ /* set iterator column parameter */ { col->fptr = fptr; return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_colname(iteratorCol *col, /* I - iterator col structure */ char *colname) /* I - column name */ /* set iterator column parameter */ { strcpy(col->colname, colname); col->colnum = 0; /* set column number undefined since name is given */ return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_colnum(iteratorCol *col, /* I - iterator column structure */ int colnum) /* I - column number */ /* set iterator column parameter */ { col->colnum = colnum; return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_datatype(iteratorCol *col, /* I - iterator col structure */ int datatype) /* I - column datatype */ /* set iterator column parameter */ { col->datatype = datatype; return(0); } /*--------------------------------------------------------------------------*/ int fits_iter_set_iotype(iteratorCol *col, /* I - iterator column structure */ int iotype) /* I - InputCol, InputOutputCol, or OutputCol */ /* set iterator column parameter */ { col->iotype = iotype; return(0); } /*--------------------------------------------------------------------------*/ fitsfile * fits_iter_get_file(iteratorCol *col) /* I -iterator col structure */ /* get iterator column parameter */ { return(col->fptr); } /*--------------------------------------------------------------------------*/ char * fits_iter_get_colname(iteratorCol *col) /* I -iterator col structure */ /* get iterator column parameter */ { return(col->colname); } /*--------------------------------------------------------------------------*/ int fits_iter_get_colnum(iteratorCol *col) /* I - iterator column structure */ /* get iterator column parameter */ { return(col->colnum); } /*--------------------------------------------------------------------------*/ int fits_iter_get_datatype(iteratorCol *col) /* I - iterator col structure */ /* get iterator column parameter */ { return(col->datatype); } /*--------------------------------------------------------------------------*/ int fits_iter_get_iotype(iteratorCol *col) /* I - iterator column structure */ /* get iterator column parameter */ { return(col->iotype); } /*--------------------------------------------------------------------------*/ void * fits_iter_get_array(iteratorCol *col) /* I - iterator col structure */ /* get iterator column parameter */ { return(col->array); } /*--------------------------------------------------------------------------*/ long fits_iter_get_tlmin(iteratorCol *col) /* I - iterator column structure */ /* get iterator column parameter */ { return(col->tlmin); } /*--------------------------------------------------------------------------*/ long fits_iter_get_tlmax(iteratorCol *col) /* I - iterator column structure */ /* get iterator column parameter */ { return(col->tlmax); } /*--------------------------------------------------------------------------*/ long fits_iter_get_repeat(iteratorCol *col) /* I - iterator col structure */ /* get iterator column parameter */ { return(col->repeat); } /*--------------------------------------------------------------------------*/ char * fits_iter_get_tunit(iteratorCol *col) /* I - iterator col structure */ /* get iterator column parameter */ { return(col->tunit); } /*--------------------------------------------------------------------------*/ char * fits_iter_get_tdisp(iteratorCol *col) /* I -iterator col structure */ /* get iterator column parameter */ { return(col->tdisp); } /*--------------------------------------------------------------------------*/ int ffiter(int n_cols, iteratorCol *cols, long offset, long n_per_loop, int (*work_fn)(long total_n, long offset, long first_n, long n_values, int n_cols, iteratorCol *cols, void *userPointer), void *userPointer, int *status) /* The iterator function. This function will pass the specified columns from a FITS table or pixels from a FITS image to the user-supplied function. Depending on the size of the table or image, only a subset of the rows or pixels may be passed to the function on each call, in which case the function will be called multiple times until all the rows or pixels have been processed. */ { typedef struct /* structure to store the column null value */ { int nullsize; /* length of the null value, in bytes */ union { /* default null value for the column */ char *stringnull; unsigned char charnull; signed char scharnull; int intnull; short shortnull; long longnull; unsigned int uintnull; unsigned short ushortnull; unsigned long ulongnull; float floatnull; double doublenull; LONGLONG longlongnull; } null; } colNulls; void *dataptr, *defaultnull; colNulls *col; int ii, jj, tstatus, naxis, bitpix; int typecode, hdutype, jtype, type, anynul, nfiles, nbytes; long totaln, nleft, frow, felement, n_optimum, i_optimum, ntodo; long rept, rowrept, width, tnull, naxes[9] = {1,1,1,1,1,1,1,1,1}, groups; double zeros = 0.; char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], nullstr[FLEN_VALUE]; char **stringptr, *nullptr, *cptr; if (*status > 0) return(*status); if (n_cols < 0 || n_cols > 999 ) { ffpmsg("Illegal number of columms (ffiter)"); return(*status = BAD_COL_NUM); /* negative number of columns */ } /*------------------------------------------------------------*/ /* Make sure column numbers and datatypes are in legal range */ /* and column numbers and datatypes are legal. */ /* Also fill in other parameters in the column structure. */ /*------------------------------------------------------------*/ ffghdt(cols[0].fptr, &hdutype, status); /* type of first HDU */ for (jj = 0; jj < n_cols; jj++) { /* check that output datatype code value is legal */ type = cols[jj].datatype; /* Allow variable length arrays for InputCol and InputOutputCol columns, but not for OutputCol columns. Variable length arrays have a negative type code value. */ if ((cols[jj].iotype != OutputCol) && (type<0)) { type*=-1; } if (type != 0 && type != TBYTE && type != TSBYTE && type != TLOGICAL && type != TSTRING && type != TSHORT && type != TINT && type != TLONG && type != TFLOAT && type != TDOUBLE && type != TCOMPLEX && type != TULONG && type != TUSHORT && type != TDBLCOMPLEX && type != TLONGLONG ) { if (type < 0) { sprintf(message, "Variable length array not allowed for output column number %d (ffiter)", jj + 1); } else { sprintf(message, "Illegal datatype for column number %d: %d (ffiter)", jj + 1, cols[jj].datatype); } ffpmsg(message); return(*status = BAD_DATATYPE); } /* initialize TLMINn, TLMAXn, column name, and display format */ cols[jj].tlmin = 0; cols[jj].tlmax = 0; cols[jj].tunit[0] = '\0'; cols[jj].tdisp[0] = '\0'; ffghdt(cols[jj].fptr, &jtype, status); /* get HDU type */ if (hdutype == IMAGE_HDU) /* operating on FITS images */ { if (jtype != IMAGE_HDU) { sprintf(message, "File %d not positioned to an image extension (ffiter)", jj + 1); return(*status = NOT_IMAGE); } /* since this is an image, set a dummy column number = 0 */ cols[jj].colnum = 0; strcpy(cols[jj].colname, "IMAGE"); /* dummy name for images */ tstatus = 0; ffgkys(cols[jj].fptr, "BUNIT", cols[jj].tunit, 0, &tstatus); } else /* operating on FITS tables */ { if (jtype == IMAGE_HDU) { sprintf(message, "File %d not positioned to a table extension (ffiter)", jj + 1); return(*status = NOT_TABLE); } if (cols[jj].colnum < 1) { /* find the column number for the named column */ if (ffgcno(cols[jj].fptr, CASEINSEN, cols[jj].colname, &cols[jj].colnum, status) ) { sprintf(message, "Column '%s' not found for column number %d (ffiter)", cols[jj].colname, jj + 1); ffpmsg(message); return(*status); } } /* check that the column number is valid */ if (cols[jj].colnum < 1 || cols[jj].colnum > ((cols[jj].fptr)->Fptr)->tfield) { sprintf(message, "Column %d has illegal table position number: %d (ffiter)", jj + 1, cols[jj].colnum); ffpmsg(message); return(*status = BAD_COL_NUM); } /* look for column description keywords and update structure */ tstatus = 0; ffkeyn("TLMIN", cols[jj].colnum, keyname, &tstatus); ffgkyj(cols[jj].fptr, keyname, &cols[jj].tlmin, 0, &tstatus); tstatus = 0; ffkeyn("TLMAX", cols[jj].colnum, keyname, &tstatus); ffgkyj(cols[jj].fptr, keyname, &cols[jj].tlmax, 0, &tstatus); tstatus = 0; ffkeyn("TTYPE", cols[jj].colnum, keyname, &tstatus); ffgkys(cols[jj].fptr, keyname, cols[jj].colname, 0, &tstatus); if (tstatus) cols[jj].colname[0] = '\0'; tstatus = 0; ffkeyn("TUNIT", cols[jj].colnum, keyname, &tstatus); ffgkys(cols[jj].fptr, keyname, cols[jj].tunit, 0, &tstatus); tstatus = 0; ffkeyn("TDISP", cols[jj].colnum, keyname, &tstatus); ffgkys(cols[jj].fptr, keyname, cols[jj].tdisp, 0, &tstatus); } } /* end of loop over all columns */ /*-----------------------------------------------------------------*/ /* use the first file to set the total number of values to process */ /*-----------------------------------------------------------------*/ offset = maxvalue(offset, 0L); /* make sure offset is legal */ if (hdutype == IMAGE_HDU) /* get total number of pixels in the image */ { fits_get_img_dim(cols[0].fptr, &naxis, status); fits_get_img_size(cols[0].fptr, 9, naxes, status); tstatus = 0; ffgkyj(cols[0].fptr, "GROUPS", &groups, NULL, &tstatus); if (!tstatus && groups && (naxis > 1) && (naxes[0] == 0) ) { /* this is a random groups file, with NAXIS1 = 0 */ /* Use GCOUNT, the number of groups, as the first multiplier */ /* to calculate the total number of pixels in all the groups. */ ffgkyj(cols[0].fptr, "GCOUNT", &totaln, NULL, status); } else { totaln = naxes[0]; } for (ii = 1; ii < naxis; ii++) totaln *= naxes[ii]; frow = 1; felement = 1 + offset; } else /* get total number or rows in the table */ { ffgkyj(cols[0].fptr, "NAXIS2", &totaln, 0, status); frow = 1 + offset; felement = 1; } /* adjust total by the input starting offset value */ totaln -= offset; totaln = maxvalue(totaln, 0L); /* don't allow negative number */ /*------------------------------------------------------------------*/ /* Determine number of values to pass to work function on each loop */ /*------------------------------------------------------------------*/ if (n_per_loop == 0) { /* Determine optimum number of values for each iteration. */ /* Look at all the fitsfile pointers to determine the number */ /* of unique files. */ nfiles = 1; ffgrsz(cols[0].fptr, &n_optimum, status); for (jj = 1; jj < n_cols; jj++) { for (ii = 0; ii < jj; ii++) { if (cols[ii].fptr == cols[jj].fptr) break; } if (ii == jj) /* this is a new file */ { nfiles++; ffgrsz(cols[jj].fptr, &i_optimum, status); n_optimum = minvalue(n_optimum, i_optimum); } } /* divid n_optimum by the number of files that will be processed */ n_optimum = n_optimum / nfiles; n_optimum = maxvalue(n_optimum, 1); } else if (n_per_loop < 0) /* must pass all the values at one time */ { n_optimum = totaln; } else /* calling routine specified how many values to pass at a time */ { n_optimum = minvalue(n_per_loop, totaln); } /*--------------------------------------*/ /* allocate work arrays for each column */ /* and determine the null pixel value */ /*--------------------------------------*/ col = calloc(n_cols, sizeof(colNulls) ); /* memory for the null values */ if (!col) { ffpmsg("ffiter failed to allocate memory for null values"); *status = MEMORY_ALLOCATION; /* memory allocation failed */ return(*status); } for (jj = 0; jj < n_cols; jj++) { /* get image or column datatype and vector length */ if (hdutype == IMAGE_HDU) /* get total number of pixels in the image */ { fits_get_img_type(cols[jj].fptr, &bitpix, status); switch(bitpix) { case BYTE_IMG: typecode = TBYTE; break; case SHORT_IMG: typecode = TSHORT; break; case LONG_IMG: typecode = TLONG; break; case FLOAT_IMG: typecode = TFLOAT; break; case DOUBLE_IMG: typecode = TDOUBLE; break; case LONGLONG_IMG: typecode = TLONGLONG; break; } } else { if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept, &width, status) > 0) goto cleanup; if (typecode < 0) { /* if any variable length arrays, then the */ n_optimum = 1; /* must process the table 1 row at a time */ /* Allow variable length arrays for InputCol and InputOutputCol columns, but not for OutputCol columns. Variable length arrays have a negative type code value. */ if (cols[jj].iotype == OutputCol) { sprintf(message, "Variable length array not allowed for output column number %d (ffiter)", jj + 1); ffpmsg(message); return(*status = BAD_DATATYPE); } } } /* special case where sizeof(long) = 8: use TINT instead of TLONG */ if (abs(typecode) == TLONG && sizeof(long) == 8 && sizeof(int) == 4) { if(typecode<0) { typecode = -TINT; } else { typecode = TINT; } } /* Special case: interprete 'X' column as 'B' */ if (abs(typecode) == TBIT) { typecode = typecode / TBIT * TBYTE; rept = (rept + 7) / 8; } if (cols[jj].datatype == 0) /* output datatype not specified? */ { /* special case if sizeof(long) = 8: use TINT instead of TLONG */ if (abs(typecode) == TLONG && sizeof(long) == 8 && sizeof(int) == 4) cols[jj].datatype = TINT; else cols[jj].datatype = abs(typecode); } /* calc total number of elements to do on each iteration */ if (hdutype == IMAGE_HDU || cols[jj].datatype == TSTRING) { ntodo = n_optimum; cols[jj].repeat = 1; /* get the BLANK keyword value, if it exists */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tstatus = 0; ffgkyj(cols[jj].fptr, "BLANK", &tnull, 0, &tstatus); if (tstatus) { tnull = 0L; /* no null values */ } } } else { if (typecode < 0) { /* get max size of the variable length vector; dont't trust the value given by the TFORM keyword */ rept = 1; for (ii = 0; ii < totaln; ii++) { ffgdes(cols[jj].fptr, cols[jj].colnum, frow + ii, &rowrept, NULL, status); rept = maxvalue(rept, rowrept); } } ntodo = n_optimum * rept; /* vector columns */ cols[jj].repeat = rept; /* get the TNULL keyword value, if it exists */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tstatus = 0; if (hdutype == ASCII_TBL) /* TNULLn value is a string */ { ffkeyn("TNULL", cols[jj].colnum, keyname, &tstatus); ffgkys(cols[jj].fptr, keyname, nullstr, 0, &tstatus); if (tstatus) { tnull = 0L; /* keyword doesn't exist; no null values */ } else { cptr = nullstr; while (*cptr == ' ') /* skip over leading blanks */ cptr++; if (*cptr == '\0') /* TNULLn is all blanks? */ tnull = LONG_MIN; else { /* attempt to read TNULLn string as an integer */ ffc2ii(nullstr, &tnull, &tstatus); if (tstatus) tnull = LONG_MIN; /* choose smallest value */ } /* to represent nulls */ } } else /* Binary table; TNULLn value is an integer */ { ffkeyn("TNULL", cols[jj].colnum, keyname, &tstatus); ffgkyj(cols[jj].fptr, keyname, &tnull, 0, &tstatus); if (tstatus) { tnull = 0L; /* keyword doesn't exist; no null values */ } else if (tnull == 0) { /* worst possible case: a value of 0 is used to */ /* represent nulls in the FITS file. We have to */ /* use a non-zero null value here (zero is used to */ /* mean there are no null values in the array) so we */ /* will use the smallest possible integer instead. */ tnull = LONG_MIN; /* choose smallest possible value */ } } } } /* Note that the data array starts with 2nd element; */ /* 1st element of the array gives the null data value */ switch (cols[jj].datatype) { case TBYTE: cols[jj].array = calloc(ntodo + 1, sizeof(char)); col[jj].nullsize = sizeof(char); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, 255); tnull = maxvalue(tnull, 0); col[jj].null.charnull = (unsigned char) tnull; } else { col[jj].null.charnull = (unsigned char) 255; /* use 255 as null */ } break; case TSBYTE: cols[jj].array = calloc(ntodo + 1, sizeof(char)); col[jj].nullsize = sizeof(char); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, 127); tnull = maxvalue(tnull, -128); col[jj].null.scharnull = (signed char) tnull; } else { col[jj].null.scharnull = (signed char) -128; /* use -128 null */ } break; case TSHORT: cols[jj].array = calloc(ntodo + 1, sizeof(short)); col[jj].nullsize = sizeof(short); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, SHRT_MAX); tnull = maxvalue(tnull, SHRT_MIN); col[jj].null.shortnull = (short) tnull; } else { col[jj].null.shortnull = SHRT_MIN; /* use minimum as null */ } break; case TUSHORT: cols[jj].array = calloc(ntodo + 1, sizeof(unsigned short)); col[jj].nullsize = sizeof(unsigned short); /* bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, (long) USHRT_MAX); tnull = maxvalue(tnull, 0); /* don't allow negative value */ col[jj].null.ushortnull = (unsigned short) tnull; } else { col[jj].null.ushortnull = USHRT_MAX; /* use maximum null */ } break; case TINT: cols[jj].array = calloc(sizeof(int), ntodo + 1); col[jj].nullsize = sizeof(int); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, INT_MAX); tnull = maxvalue(tnull, INT_MIN); col[jj].null.intnull = (int) tnull; } else { col[jj].null.intnull = INT_MIN; /* use minimum as null */ } break; case TUINT: cols[jj].array = calloc(ntodo + 1, sizeof(unsigned int)); col[jj].nullsize = sizeof(unsigned int); /* bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { tnull = minvalue(tnull, INT32_MAX); tnull = maxvalue(tnull, 0); col[jj].null.uintnull = (unsigned int) tnull; } else { col[jj].null.intnull = UINT_MAX; /* use maximum as null */ } break; case TLONG: cols[jj].array = calloc(ntodo + 1, sizeof(long)); col[jj].nullsize = sizeof(long); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { col[jj].null.longnull = tnull; } else { col[jj].null.longnull = LONG_MIN; /* use minimum as null */ } break; case TULONG: cols[jj].array = calloc(ntodo + 1, sizeof(unsigned long)); col[jj].nullsize = sizeof(unsigned long); /* bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { if (tnull < 0) /* can't use a negative null value */ col[jj].null.ulongnull = LONG_MAX; else col[jj].null.ulongnull = (unsigned long) tnull; } else { col[jj].null.ulongnull = LONG_MAX; /* use maximum as null */ } break; case TFLOAT: cols[jj].array = calloc(ntodo + 1, sizeof(float)); col[jj].nullsize = sizeof(float); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { col[jj].null.floatnull = (float) tnull; } else { col[jj].null.floatnull = FLOATNULLVALUE; /* special value */ } break; case TCOMPLEX: cols[jj].array = calloc((ntodo * 2) + 1, sizeof(float)); col[jj].nullsize = sizeof(float); /* number of bytes per value */ col[jj].null.floatnull = FLOATNULLVALUE; /* special value */ break; case TDOUBLE: cols[jj].array = calloc(ntodo + 1, sizeof(double)); col[jj].nullsize = sizeof(double); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG) { col[jj].null.doublenull = (double) tnull; } else { col[jj].null.doublenull = DOUBLENULLVALUE; /* special value */ } break; case TDBLCOMPLEX: cols[jj].array = calloc((ntodo * 2) + 1, sizeof(double)); col[jj].nullsize = sizeof(double); /* number of bytes per value */ col[jj].null.doublenull = DOUBLENULLVALUE; /* special value */ break; case TSTRING: /* allocate array of pointers to all the strings */ if( hdutype==ASCII_TBL ) rept = width; stringptr = calloc((ntodo + 1) , sizeof(stringptr)); cols[jj].array = stringptr; col[jj].nullsize = rept + 1; /* number of bytes per value */ if (stringptr) { /* allocate string to store the null string value */ col[jj].null.stringnull = calloc(rept + 1, sizeof(char) ); col[jj].null.stringnull[1] = 1; /* to make sure string != 0 */ /* allocate big block for the array of table column strings */ stringptr[0] = calloc((ntodo + 1) * (rept + 1), sizeof(char) ); if (stringptr[0]) { for (ii = 1; ii <= ntodo; ii++) { /* pointer to each string */ stringptr[ii] = stringptr[ii - 1] + (rept + 1); } /* get the TNULL keyword value, if it exists */ tstatus = 0; ffkeyn("TNULL", cols[jj].colnum, keyname, &tstatus); ffgkys(cols[jj].fptr, keyname, nullstr, 0, &tstatus); if (!tstatus) strncat(col[jj].null.stringnull, nullstr, rept); } else { ffpmsg("ffiter failed to allocate memory arrays"); *status = MEMORY_ALLOCATION; /* memory allocation failed */ goto cleanup; } } break; case TLOGICAL: cols[jj].array = calloc(ntodo + 1, sizeof(char)); col[jj].nullsize = sizeof(char); /* number of bytes per value */ /* use value = 2 to flag null values in logical columns */ col[jj].null.charnull = 2; break; case TLONGLONG: cols[jj].array = calloc(ntodo + 1, sizeof(LONGLONG)); col[jj].nullsize = sizeof(LONGLONG); /* number of bytes per value */ if (abs(typecode) == TBYTE || abs(typecode) == TSHORT || abs(typecode) == TLONG || abs(typecode) == TLONGLONG) { col[jj].null.longlongnull = tnull; } else { col[jj].null.longlongnull = LONGLONG_MIN; /* use minimum as null */ } break; default: sprintf(message, "Column %d datatype currently not supported: %d: (ffiter)", jj + 1, cols[jj].datatype); ffpmsg(message); *status = BAD_DATATYPE; goto cleanup; } /* end of switch block */ /* check that all the arrays were allocated successfully */ if (!cols[jj].array) { ffpmsg("ffiter failed to allocate memory arrays"); *status = MEMORY_ALLOCATION; /* memory allocation failed */ goto cleanup; } } /*--------------------------------------------------*/ /* main loop while there are values left to process */ /*--------------------------------------------------*/ nleft = totaln; while (nleft) { ntodo = minvalue(nleft, n_optimum); /* no. of values for this loop */ /* read input columns from FITS file(s) */ for (jj = 0; jj < n_cols; jj++) { if (cols[jj].iotype != OutputCol) { if (cols[jj].datatype == TSTRING) { stringptr = cols[jj].array; dataptr = stringptr + 1; defaultnull = col[jj].null.stringnull; /* ptr to the null value */ } else { dataptr = (char *) cols[jj].array + col[jj].nullsize; defaultnull = &col[jj].null.charnull; /* ptr to the null value */ } if (hdutype == IMAGE_HDU) { if (ffgpv(cols[jj].fptr, cols[jj].datatype, felement, cols[jj].repeat * ntodo, defaultnull, dataptr, &anynul, status) > 0) { break; } } else { if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0) goto cleanup; if (typecode<0) { /* get size of the variable length vector */ ffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status); } if (ffgcv(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow, felement, cols[jj].repeat * ntodo, defaultnull, dataptr, &anynul, status) > 0) { break; } } /* copy the appropriate null value into first array element */ if (anynul) /* are there any nulls in the data? */ { if (cols[jj].datatype == TSTRING) { stringptr = cols[jj].array; memcpy(*stringptr, col[jj].null.stringnull, col[jj].nullsize); } else { memcpy(cols[jj].array, defaultnull, col[jj].nullsize); } } else /* no null values so copy zero into first element */ { if (cols[jj].datatype == TSTRING) { stringptr = cols[jj].array; memset(*stringptr, 0, col[jj].nullsize); } else { memset(cols[jj].array, 0, col[jj].nullsize); } } } } if (*status > 0) break; /* looks like an error occurred; quit immediately */ /* call work function */ if (hdutype == IMAGE_HDU) *status = work_fn(totaln, offset, felement, ntodo, n_cols, cols, userPointer); else *status = work_fn(totaln, offset, frow, ntodo, n_cols, cols, userPointer); if (*status > 0 || *status < -1 ) break; /* looks like an error occurred; quit immediately */ /* write output columns before quiting if status = -1 */ tstatus = 0; for (jj = 0; jj < n_cols; jj++) { if (cols[jj].iotype != InputCol) { if (cols[jj].datatype == TSTRING) { stringptr = cols[jj].array; dataptr = stringptr + 1; nullptr = *stringptr; nbytes = 2; } else { dataptr = (char *) cols[jj].array + col[jj].nullsize; nullptr = (char *) cols[jj].array; nbytes = col[jj].nullsize; } if (memcmp(nullptr, &zeros, nbytes) ) { /* null value flag not zero; must check for and write nulls */ if (hdutype == IMAGE_HDU) { if (ffppn(cols[jj].fptr, cols[jj].datatype, felement, cols[jj].repeat * ntodo, dataptr, nullptr, &tstatus) > 0) break; } else { if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0) goto cleanup; if (typecode<0) /* variable length array colum */ { ffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status); } if (ffpcn(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow, felement, cols[jj].repeat * ntodo, dataptr, nullptr, &tstatus) > 0) break; } } else { /* no null values; just write the array */ if (hdutype == IMAGE_HDU) { if (ffppr(cols[jj].fptr, cols[jj].datatype, felement, cols[jj].repeat * ntodo, dataptr, &tstatus) > 0) break; } else { if (ffgtcl(cols[jj].fptr, cols[jj].colnum, &typecode, &rept,&width, status) > 0) goto cleanup; if (typecode<0) /* variable length array column */ { ffgdes(cols[jj].fptr, cols[jj].colnum, frow,&cols[jj].repeat, NULL,status); } if (ffpcl(cols[jj].fptr, cols[jj].datatype, cols[jj].colnum, frow, felement, cols[jj].repeat * ntodo, dataptr, &tstatus) > 0) break; } } } } if (*status == 0) *status = tstatus; /* propagate any error status from the writes */ if (*status) break; /* exit on any error */ nleft -= ntodo; if (hdutype == IMAGE_HDU) felement += ntodo; else frow += ntodo; } cleanup: /*----------------------------------*/ /* free work arrays for the columns */ /*----------------------------------*/ for (jj = 0; jj < n_cols; jj++) { if (cols[jj].datatype == TSTRING) { if (cols[jj].array) { stringptr = cols[jj].array; free(*stringptr); /* free the block of strings */ free(col[jj].null.stringnull); /* free the null string */ } } if (cols[jj].array) free(cols[jj].array); /* memory for the array of values from the col */ } free(col); /* the structure containing the null values */ return(*status); } astropy-0.3/cextern/cfitsio/inflate.h0000644000175000017500000001437712243255342016116 0ustar oleole/* inflate.h -- internal inflate state definition * Copyright (C) 1995-2009 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip decoding should be left enabled. */ #ifndef NO_GZIP # define GUNZIP #endif /* Possible inflate modes between inflate() calls */ typedef enum { HEAD, /* i: waiting for magic header */ FLAGS, /* i: waiting for method and flags (gzip) */ TIME, /* i: waiting for modification time (gzip) */ OS, /* i: waiting for extra flags and operating system (gzip) */ EXLEN, /* i: waiting for extra length (gzip) */ EXTRA, /* i: waiting for extra bytes (gzip) */ NAME, /* i: waiting for end of file name (gzip) */ COMMENT, /* i: waiting for end of comment (gzip) */ HCRC, /* i: waiting for header crc (gzip) */ DICTID, /* i: waiting for dictionary check value */ DICT, /* waiting for inflateSetDictionary() call */ TYPE, /* i: waiting for type bits, including last-flag bit */ TYPEDO, /* i: same, but skip check to exit inflate on new block */ STORED, /* i: waiting for stored size (length and complement) */ COPY_, /* i/o: same as COPY below, but only first time in */ COPY, /* i/o: waiting for input or output to copy stored block */ TABLE, /* i: waiting for dynamic block table lengths */ LENLENS, /* i: waiting for code length code lengths */ CODELENS, /* i: waiting for length/lit and distance code lengths */ LEN_, /* i: same as LEN below, but only first time in */ LEN, /* i: waiting for length/lit/eob code */ LENEXT, /* i: waiting for length extra bits */ DIST, /* i: waiting for distance code */ DISTEXT, /* i: waiting for distance extra bits */ MATCH, /* o: waiting for output space to copy string */ LIT, /* o: waiting for output space to write literal */ CHECK, /* i: waiting for 32-bit check value */ LENGTH, /* i: waiting for 32-bit length (gzip) */ DONE, /* finished check, done -- remain here until reset */ BAD, /* got a data error -- remain here until reset */ MEM, /* got an inflate() memory error -- remain here until reset */ SYNC /* looking for synchronization bytes to restart inflate() */ } inflate_mode; /* State transitions between above modes - (most modes can go to BAD or MEM on error -- not shown for clarity) Process header: HEAD -> (gzip) or (zlib) or (raw) (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> HCRC -> TYPE (zlib) -> DICTID or TYPE DICTID -> DICT -> TYPE (raw) -> TYPEDO Read deflate blocks: TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK STORED -> COPY_ -> COPY -> TYPE TABLE -> LENLENS -> CODELENS -> LEN_ LEN_ -> LEN Read deflate codes in fixed or dynamic block: LEN -> LENEXT or LIT or TYPE LENEXT -> DIST -> DISTEXT -> MATCH -> LEN LIT -> LEN Process trailer: CHECK -> LENGTH -> DONE */ /* state maintained between inflate() calls. Approximately 10K bytes. */ struct inflate_state { inflate_mode mode; /* current inflate mode */ int last; /* true if processing last block */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ int havedict; /* true if dictionary provided */ int flags; /* gzip header method and flags (0 if zlib) */ unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ unsigned long check; /* protected copy of check value */ unsigned long total; /* protected copy of output count */ gz_headerp head; /* where to save gzip header information */ /* sliding window */ unsigned wbits; /* log base 2 of requested window size */ unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ /* bit accumulator */ unsigned long hold; /* input bit accumulator */ unsigned bits; /* number of bits in "in" */ /* for string and stored block copying */ unsigned length; /* literal or length of data to copy */ unsigned offset; /* distance back to copy string from */ /* for table and code decoding */ unsigned extra; /* extra bits needed */ /* fixed and dynamic code tables */ code const FAR *lencode; /* starting table for length/literal codes */ code const FAR *distcode; /* starting table for distance codes */ unsigned lenbits; /* index bits for lencode */ unsigned distbits; /* index bits for distcode */ /* dynamic table building */ unsigned ncode; /* number of code length code lengths */ unsigned nlen; /* number of length code lengths */ unsigned ndist; /* number of distance code lengths */ unsigned have; /* number of code lengths in lens[] */ code FAR *next; /* next available space in codes[] */ unsigned short lens[320]; /* temporary storage for code lengths */ unsigned short work[288]; /* work area for code table building */ code codes[ENOUGH]; /* space for code tables */ int sane; /* if false, allow invalid distance too far */ int back; /* bits back of last unprocessed length/lit */ unsigned was; /* initial length of match */ }; astropy-0.3/cextern/cfitsio/deflate.h0000644000175000017500000003055712243255342016076 0ustar oleole/* deflate.h -- internal compression state * Copyright (C) 1995-2010 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ #ifndef DEFLATE_H #define DEFLATE_H #include "zutil.h" /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in the crc code when it is not needed. For shared libraries, gzip encoding should be left enabled. */ #ifndef NO_GZIP # define GZIP #endif /* =========================================================================== * Internal compression state. */ #define LENGTH_CODES 29 /* number of length codes, not counting the special END_BLOCK code */ #define LITERALS 256 /* number of literal bytes 0..255 */ #define L_CODES (LITERALS+1+LENGTH_CODES) /* number of Literal or Length codes, including the END_BLOCK code */ #define D_CODES 30 /* number of distance codes */ #define BL_CODES 19 /* number of codes used to transfer the bit lengths */ #define HEAP_SIZE (2*L_CODES+1) /* maximum heap size */ #define MAX_BITS 15 /* All codes must not exceed MAX_BITS bits */ #define INIT_STATE 42 #define EXTRA_STATE 69 #define NAME_STATE 73 #define COMMENT_STATE 91 #define HCRC_STATE 103 #define BUSY_STATE 113 #define FINISH_STATE 666 /* Stream status */ /* Data structure describing a single value and its code string. */ typedef struct ct_data_s { union { ush freq; /* frequency count */ ush code; /* bit string */ } fc; union { ush dad; /* father node in Huffman tree */ ush len; /* length of bit string */ } dl; } FAR ct_data; #define Freq fc.freq #define Code fc.code #define Dad dl.dad #define Len dl.len typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; typedef Pos FAR Posf; typedef unsigned IPos; /* A Pos is an index in the character window. We use short instead of int to * save space in the various tables. IPos is used only for parameter passing. */ typedef struct internal_state { z_streamp strm; /* pointer back to this zlib stream */ int status; /* as the name implies */ Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ uInt pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ uInt gzindex; /* where in extra, name, or comment */ Byte method; /* STORED (for zip only) or DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ uInt w_size; /* LZ77 window size (32K by default) */ uInt w_bits; /* log2(w_size) (8..16) */ uInt w_mask; /* w_size - 1 */ Bytef *window; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. Also, it limits * the window size to 64K, which is quite useful on MSDOS. * To do: use the user input buffer as sliding window. */ ulg window_size; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ Posf *prev; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ Posf *head; /* Heads of the hash chains or NIL. */ uInt ins_h; /* hash index of string to be inserted */ uInt hash_size; /* number of elements in hash table */ uInt hash_bits; /* log2(hash_size) */ uInt hash_mask; /* hash_size-1 */ uInt hash_shift; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ long block_start; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ uInt match_length; /* length of best match */ IPos prev_match; /* previous match */ int match_available; /* set if previous match exists */ uInt strstart; /* start of string to insert */ uInt match_start; /* start of matching string */ uInt lookahead; /* number of valid bytes ahead in window */ uInt prev_length; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ uInt max_chain_length; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ uInt max_lazy_match; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ # define max_insert_length max_lazy_match /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ int level; /* compression level (1..9) */ int strategy; /* favor or force Huffman coding*/ uInt good_match; /* Use a faster search when the previous match is longer than this */ int nice_match; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to supress compiler warning */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ struct tree_desc_s l_desc; /* desc. for literal tree */ struct tree_desc_s d_desc; /* desc. for distance tree */ struct tree_desc_s bl_desc; /* desc. for bit length tree */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ int heap_len; /* number of elements in the heap */ int heap_max; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ uch depth[2*L_CODES+1]; /* Depth of each subtree used as tie breaker for trees of equal frequency */ uchf *l_buf; /* buffer for literals or lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ uInt last_lit; /* running index in l_buf */ ushf *d_buf; /* Buffer for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ uInt matches; /* number of string matches in current block */ int last_eob_len; /* bit length of EOB code for last block */ #ifdef DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif ush bi_buf; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ int bi_valid; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ ulg high_water; /* High water mark offset in window for initialized bytes -- bytes above * this are set to zero in order to avoid memory check warnings when * longest match routines access bytes past the input. This is then * updated to the new high water mark. */ } FAR deflate_state; /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) /* In order to simplify the code, particularly on 16 bit machines, match * distances are limited to MAX_DIST instead of WSIZE. */ #define WIN_INIT MAX_MATCH /* Number of bytes after end of data in window to initialize in order to avoid memory checker errors from longest match routines */ /* in trees.c */ void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int last)); #define d_code(dist) \ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. _dist_code[256] and _dist_code[257] are never * used. */ #ifndef DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) extern uch ZLIB_INTERNAL _length_code[]; extern uch ZLIB_INTERNAL _dist_code[]; #else extern const uch ZLIB_INTERNAL _length_code[]; extern const uch ZLIB_INTERNAL _dist_code[]; #endif # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->d_buf[s->last_lit] = 0; \ s->l_buf[s->last_lit++] = cc; \ s->dyn_ltree[cc].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (length); \ ush dist = (distance); \ s->d_buf[s->last_lit] = dist; \ s->l_buf[s->last_lit++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ flush = _tr_tally(s, distance, length) #endif #endif /* DEFLATE_H */ astropy-0.3/cextern/cfitsio/getcolj.c0000644000175000017500000043065212243255342016114 0ustar oleole/* This file, getcolj.c, contains routines that read data elements from */ /* a FITS image or table, with long data type. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long nulval, /* I - value for undefined pixels */ long *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; long nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TLONG, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclj(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TLONG, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclj(fptr, 2, row, firstelem, nelem, 1, 2, 0L, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2dj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3dj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3dj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3], nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TLONG, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgclj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgclj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ long nulval, /* I - value to set undefined pixels */ long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; long nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TLONG, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgclj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ long *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; long nulval = 0; int hdutype, anyf; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TLONG, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ long *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclj(fptr, 1, row, firstelem, nelem, 1, 1, 0L, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long nulval, /* I - value for null pixels */ long *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { long dummy = 0; ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgclj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ long nulval, /* I - value for null pixels if nultyp = 1 */ long *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if (ffgcprll(fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TLONG) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0. && LONGSIZE == 32) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next], status); if (convert) fffi4i4((INT32BIT *) &array[next], ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8i4((LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1i4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2i4((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4i4((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8i4((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstri4((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclj).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclj).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1i4(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (long) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2i4(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (long) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4i4(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; Process the array of data in reverse order, to handle the case where the input data is 4-bytes and the output is 8-bytes and the conversion is being done in place in the same array. */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = ntodo - 1; ii >= 0; ii--) output[ii] = (long) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = ntodo - 1; ii >= 0; ii--) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8i4(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < LONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > LONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < LONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > LONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4i4(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (zero > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8i4(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (input[ii] > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (zero > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstri4(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONG_MIN; } else if (dvalue > DLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONG_MAX; } else output[ii] = (long) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } /* ======================================================================== */ /* the following routines support the 'long long' data type */ /* ======================================================================== */ /*--------------------------------------------------------------------------*/ int ffgpvjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ LONGLONG nulval, /* I - value for undefined pixels */ LONGLONG *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; LONGLONG nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TLONGLONG, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcljj(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ LONGLONG *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; LONGLONG dummy = 0; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TLONGLONG, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcljj(fptr, 2, row, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2djj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG nulval ,/* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG *array,/* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3djj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3djj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ LONGLONG *array,/* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3]; LONGLONG nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TLONGLONG, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcljj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcljj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvjj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ LONGLONG nulval,/* I - value to set undefined pixels */ LONGLONG *array,/* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; LONGLONG nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TLONGLONG, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgcljj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfjj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ LONGLONG *array,/* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; LONGLONG nulval = 0; int hdutype, anyf; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TLONGLONG, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcljj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ LONGLONG *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; LONGLONG dummy = 0; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcljj(fptr, 1, row, firstelem, nelem, 1, 1, dummy, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvjj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ LONGLONG nulval, /* I - value for null pixels */ LONGLONG *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfjj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ LONGLONG *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { LONGLONG dummy = 0; ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcljj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ LONGLONG nulval, /* I - value for null pixels if nultyp = 1 */ LONGLONG *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if (ffgcprll(fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TLONGLONG) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) &array[next], status); if (convert) fffi8i8((LONGLONG *) &array[next], ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4i8((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1i8((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2i8((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4i8((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8i8((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstri8((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclj).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclj).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1i8(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (LONGLONG) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (LONGLONG) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2i8(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (LONGLONG) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (LONGLONG) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4i8(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (LONGLONG) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (LONGLONG) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8i8(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4i8(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (zero > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8i8(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (zero > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstri8(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ LONGLONG nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ LONGLONG *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/modkey.c0000644000175000017500000017563212243255342015761 0ustar oleole/* This file, modkey.c, contains routines that modify, insert, or update */ /* keywords in a FITS header. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include /* stddef.h is apparently needed to define size_t */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffuky( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ const char *keyname,/* I - name of keyword to write */ void *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Update the keyword, value and comment in the FITS header. The datatype is specified by the 2nd argument. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TSTRING) { ffukys(fptr, keyname, (char *) value, comm, status); } else if (datatype == TBYTE) { ffukyj(fptr, keyname, (LONGLONG) *(unsigned char *) value, comm, status); } else if (datatype == TSBYTE) { ffukyj(fptr, keyname, (LONGLONG) *(signed char *) value, comm, status); } else if (datatype == TUSHORT) { ffukyj(fptr, keyname, (LONGLONG) *(unsigned short *) value, comm, status); } else if (datatype == TSHORT) { ffukyj(fptr, keyname, (LONGLONG) *(short *) value, comm, status); } else if (datatype == TINT) { ffukyj(fptr, keyname, (LONGLONG) *(int *) value, comm, status); } else if (datatype == TUINT) { ffukyg(fptr, keyname, (double) *(unsigned int *) value, 0, comm, status); } else if (datatype == TLOGICAL) { ffukyl(fptr, keyname, *(int *) value, comm, status); } else if (datatype == TULONG) { ffukyg(fptr, keyname, (double) *(unsigned long *) value, 0, comm, status); } else if (datatype == TLONG) { ffukyj(fptr, keyname, (LONGLONG) *(long *) value, comm, status); } else if (datatype == TLONGLONG) { ffukyj(fptr, keyname, *(LONGLONG *) value, comm, status); } else if (datatype == TFLOAT) { ffukye(fptr, keyname, *(float *) value, -7, comm, status); } else if (datatype == TDOUBLE) { ffukyd(fptr, keyname, *(double *) value, -15, comm, status); } else if (datatype == TCOMPLEX) { ffukyc(fptr, keyname, (float *) value, -7, comm, status); } else if (datatype == TDBLCOMPLEX) { ffukym(fptr, keyname, (double *) value, -15, comm, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffukyu(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyu(fptr, keyname, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyu(fptr, keyname, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukys(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkys(fptr, keyname, value, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkys(fptr, keyname, value, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukls(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { /* update a long string keyword */ int tstatus; char junk[FLEN_ERRMSG]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkls(fptr, keyname, value, comm, status) == KEY_NO_EXIST) { /* since the ffmkls call failed, it wrote a bogus error message */ fits_read_errmsg(junk); /* clear the error message */ *status = tstatus; ffpkls(fptr, keyname, value, comm, status); } return(*status); }/*--------------------------------------------------------------------------*/ int ffukyl(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ int value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyl(fptr, keyname, value, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyl(fptr, keyname, value, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukyj(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ LONGLONG value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyj(fptr, keyname, value, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyj(fptr, keyname, value, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukyf(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyf(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyf(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukye(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkye(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkye(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukyg(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyg(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyg(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukyd(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyd(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyd(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukfc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkfc(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkfc(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukyc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkyc(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkyc(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukfm(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkfm(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkfm(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffukym(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmkym(fptr, keyname, value, decim, comm, status) == KEY_NO_EXIST) { *status = tstatus; ffpkym(fptr, keyname, value, decim, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffucrd(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ const char *card, /* I - card string value */ int *status) /* IO - error status */ { int tstatus; if (*status > 0) /* inherit input status value if > 0 */ return(*status); tstatus = *status; if (ffmcrd(fptr, keyname, card, status) == KEY_NO_EXIST) { *status = tstatus; ffprec(fptr, card, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffmrec(fitsfile *fptr, /* I - FITS file pointer */ int nkey, /* I - number of the keyword to modify */ const char *card, /* I - card string value */ int *status) /* IO - error status */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffmaky(fptr, nkey+1, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmcrd(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *card, /* I - card string value */ int *status) /* IO - error status */ { char tcard[FLEN_CARD], valstring[FLEN_CARD], comm[FLEN_CARD], value[FLEN_CARD]; int keypos, len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgcrd(fptr, keyname, tcard, status) > 0) return(*status); ffmkey(fptr, card, status); /* calc position of keyword in header */ keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80) + 1; ffpsvc(tcard, valstring, comm, status); if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check for string value which may be continued over multiple keywords */ ffpmrk(); /* put mark on message stack; erase any messages after this */ ffc2s(valstring, value, status); /* remove quotes and trailing spaces */ if (*status == VALUE_UNDEFINED) { ffcmrk(); /* clear any spurious error messages, back to the mark */ *status = 0; } else { len = strlen(value); while (len && value[len - 1] == '&') /* ampersand used as continuation char */ { ffgcnt(fptr, value, status); if (*value) { ffdrec(fptr, keypos, status); /* delete the keyword */ len = strlen(value); } else /* a null valstring indicates no continuation */ len = 0; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffmnam(fitsfile *fptr, /* I - FITS file pointer */ const char *oldname,/* I - existing keyword name */ const char *newname,/* I - new name for keyword */ int *status) /* IO - error status */ { char comm[FLEN_COMMENT]; char value[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, oldname, value, comm, status) > 0) return(*status); ffmkky(newname, value, comm, card, status); /* construct the card */ ffmkey(fptr, card, status); /* rewrite with new name */ return(*status); } /*--------------------------------------------------------------------------*/ int ffmcom(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char oldcomm[FLEN_COMMENT]; char value[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, value, oldcomm, status) > 0) return(*status); ffmkky(keyname, value, comm, card, status); /* construct the card */ ffmkey(fptr, card, status); /* rewrite with new comment */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpunt(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ const char *unit, /* I - keyword unit string */ int *status) /* IO - error status */ /* Write (put) the units string into the comment field of the existing keyword. This routine uses a local FITS convention (not defined in the official FITS standard) in which the units are enclosed in square brackets following the '/' comment field delimiter, e.g.: KEYWORD = 12 / [kpc] comment string goes here */ { char oldcomm[FLEN_COMMENT]; char newcomm[FLEN_COMMENT]; char value[FLEN_VALUE]; char card[FLEN_CARD]; char *loc; size_t len; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, value, oldcomm, status) > 0) return(*status); /* copy the units string to the new comment string if not null */ if (*unit) { strcpy(newcomm, "["); strncat(newcomm, unit, 45); /* max allowed length is about 45 chars */ strcat(newcomm, "] "); len = strlen(newcomm); len = FLEN_COMMENT - len - 1; /* amount of space left in the field */ } else { newcomm[0] = '\0'; len = FLEN_COMMENT - 1; } if (oldcomm[0] == '[') /* check for existing units field */ { loc = strchr(oldcomm, ']'); /* look for the closing bracket */ if (loc) { loc++; while (*loc == ' ') /* skip any blank spaces */ loc++; strncat(newcomm, loc, len); /* concat remainder of comment */ } else { strncat(newcomm, oldcomm, len); /* append old comment onto new */ } } else { strncat(newcomm, oldcomm, len); } ffmkky(keyname, value, newcomm, card, status); /* construct the card */ ffmkey(fptr, card, status); /* rewrite with new units string */ return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyu(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname,/* I - keyword name */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ strcpy(valstring," "); /* create a dummy value string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkys(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { /* NOTE: This routine does not support long continued strings */ /* It will correctly overwrite an existing long continued string, */ /* but it will not write a new long string. */ char oldval[FLEN_VALUE], valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; int len, keypos; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, oldval, oldcomm, status) > 0) return(*status); /* get old comment */ ffs2c(value, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); /* overwrite the previous keyword */ keypos = (int) (((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80) + 1); if (*status > 0) return(*status); /* check if old string value was continued over multiple keywords */ ffpmrk(); /* put mark on message stack; erase any messages after this */ ffc2s(oldval, valstring, status); /* remove quotes and trailing spaces */ if (*status == VALUE_UNDEFINED) { ffcmrk(); /* clear any spurious error messages, back to the mark */ *status = 0; } else { len = strlen(valstring); while (len && valstring[len - 1] == '&') /* ampersand is continuation char */ { ffgcnt(fptr, valstring, status); if (*valstring) { ffdrec(fptr, keypos, status); /* delete the continuation */ len = strlen(valstring); } else /* a null valstring indicates no continuation */ len = 0; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffmkls( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to write */ const char *value, /* I - keyword value */ const char *incomm, /* I - keyword comment */ int *status) /* IO - error status */ /* Modify the value and optionally the comment of a long string keyword. This routine supports the HEASARC long string convention and can modify arbitrarily long string keyword values. The value is continued over multiple keywords that have the name COMTINUE without an equal sign in column 9 of the card. This routine also supports simple string keywords which are less than 69 characters in length. This routine is not very efficient, so it should be used sparingly. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD], tmpkeyname[FLEN_CARD]; char comm[FLEN_COMMENT]; char tstring[FLEN_VALUE], *cptr; char *longval; int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1; int nkeys, keypos; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (!incomm || incomm[0] == '&') /* preserve the old comment string */ { ffghps(fptr, &nkeys, &keypos, status); /* save current position */ if (ffgkls(fptr, keyname, &longval, comm, status) > 0) return(*status); /* keyword doesn't exist */ free(longval); /* don't need the old value */ /* move back to previous position to ensure that we delete */ /* the right keyword in case there are more than one keyword */ /* with this same name. */ ffgrec(fptr, keypos - 1, card, status); } else { /* copy the input comment string */ strncpy(comm, incomm, FLEN_COMMENT-1); comm[FLEN_COMMENT-1] = '\0'; } /* delete the old keyword */ if (ffdkey(fptr, keyname, status) > 0) return(*status); /* keyword doesn't exist */ ffghps(fptr, &nkeys, &keypos, status); /* save current position */ /* now construct the new keyword, and insert into header */ remain = strlen(value); /* number of characters to write out */ next = 0; /* pointer to next character to write */ /* count the number of single quote characters in the string */ nquote = 0; cptr = strchr(value, '\''); /* search for quote character */ while (cptr) /* search for quote character */ { nquote++; /* increment no. of quote characters */ cptr++; /* increment pointer to next character */ cptr = strchr(cptr, '\''); /* search for another quote char */ } strncpy(tmpkeyname, keyname, 80); tmpkeyname[80] = '\0'; cptr = tmpkeyname; while(*cptr == ' ') /* skip over leading spaces in name */ cptr++; /* determine the number of characters that will fit on the line */ /* Note: each quote character is expanded to 2 quotes */ namelen = strlen(cptr); if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) ) { /* This a normal 8-character FITS keyword */ nchar = 68 - nquote; /* max of 68 chars fit in a FITS string value */ } else { /* This a HIERARCH keyword */ if (FSTRNCMP(cptr, "HIERARCH ", 9) && FSTRNCMP(cptr, "hierarch ", 9)) nchar = 66 - nquote - namelen; else nchar = 75 - nquote - namelen; /* don't count 'HIERARCH' twice */ } contin = 0; while (remain > 0) { strncpy(tstring, &value[next], nchar); /* copy string to temp buff */ tstring[nchar] = '\0'; ffs2c(tstring, valstring, status); /* put quotes around the string */ if (remain > nchar) /* if string is continued, put & as last char */ { vlen = strlen(valstring); nchar -= 1; /* outputting one less character now */ if (valstring[vlen-2] != '\'') valstring[vlen-2] = '&'; /* over write last char with & */ else { /* last char was a pair of single quotes, so over write both */ valstring[vlen-3] = '&'; valstring[vlen-1] = '\0'; } } if (contin) /* This is a CONTINUEd keyword */ { ffmkky("CONTINUE", valstring, comm, card, status); /* make keyword */ strncpy(&card[8], " ", 2); /* overwrite the '=' */ } else { ffmkky(keyname, valstring, comm, card, status); /* make keyword */ } ffirec(fptr, keypos, card, status); /* insert the keyword */ keypos++; /* next insert position */ contin = 1; remain -= nchar; next += nchar; nchar = 68 - nquote; } return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyl(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ int value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffl2c(value, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyj(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ LONGLONG value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffi2c(value, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyf(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffr2f(value, decim, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkye(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffr2e(value, decim, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyg(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffd2f(value, decim, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyd(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ ffd2e(value, decim, valstring, status); /* convert value to a string */ if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkfc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ strcpy(valstring, "(" ); ffr2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkyc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ strcpy(valstring, "(" ); ffr2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkfm(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ strcpy(valstring, "(" ); ffd2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmkym(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char oldcomm[FLEN_COMMENT]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, oldcomm, status) > 0) return(*status); /* get old comment */ strcpy(valstring, "(" ); ffd2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); if (!comm || comm[0] == '&') /* preserve the current comment string */ ffmkky(keyname, valstring, oldcomm, card, status); else ffmkky(keyname, valstring, comm, card, status); ffmkey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffikyu(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Insert a null-valued keyword and comment into the FITS header. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring," "); /* create a dummy value string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffikys(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffs2c(value, valstring, status); /* put quotes around the string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffikls( fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - name of keyword to write */ const char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ /* Insert a long string keyword. This routine supports the HEASARC long string convention and can insert arbitrarily long string keyword values. The value is continued over multiple keywords that have the name COMTINUE without an equal sign in column 9 of the card. This routine also supports simple string keywords which are less than 69 characters in length. */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD], tmpkeyname[FLEN_CARD]; char tstring[FLEN_VALUE], *cptr; int next, remain, vlen, nquote, nchar, namelen, contin, tstatus = -1; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* construct the new keyword, and insert into header */ remain = strlen(value); /* number of characters to write out */ next = 0; /* pointer to next character to write */ /* count the number of single quote characters in the string */ nquote = 0; cptr = strchr(value, '\''); /* search for quote character */ while (cptr) /* search for quote character */ { nquote++; /* increment no. of quote characters */ cptr++; /* increment pointer to next character */ cptr = strchr(cptr, '\''); /* search for another quote char */ } strncpy(tmpkeyname, keyname, 80); tmpkeyname[80] = '\0'; cptr = tmpkeyname; while(*cptr == ' ') /* skip over leading spaces in name */ cptr++; /* determine the number of characters that will fit on the line */ /* Note: each quote character is expanded to 2 quotes */ namelen = strlen(cptr); if (namelen <= 8 && (fftkey(cptr, &tstatus) <= 0) ) { /* This a normal 8-character FITS keyword */ nchar = 68 - nquote; /* max of 68 chars fit in a FITS string value */ } else { /* This a HIERARCH keyword */ if (FSTRNCMP(cptr, "HIERARCH ", 9) && FSTRNCMP(cptr, "hierarch ", 9)) nchar = 66 - nquote - namelen; else nchar = 75 - nquote - namelen; /* don't count 'HIERARCH' twice */ } contin = 0; while (remain > 0) { strncpy(tstring, &value[next], nchar); /* copy string to temp buff */ tstring[nchar] = '\0'; ffs2c(tstring, valstring, status); /* put quotes around the string */ if (remain > nchar) /* if string is continued, put & as last char */ { vlen = strlen(valstring); nchar -= 1; /* outputting one less character now */ if (valstring[vlen-2] != '\'') valstring[vlen-2] = '&'; /* over write last char with & */ else { /* last char was a pair of single quotes, so over write both */ valstring[vlen-3] = '&'; valstring[vlen-1] = '\0'; } } if (contin) /* This is a CONTINUEd keyword */ { ffmkky("CONTINUE", valstring, comm, card, status); /* make keyword */ strncpy(&card[8], " ", 2); /* overwrite the '=' */ } else { ffmkky(keyname, valstring, comm, card, status); /* make keyword */ } ffikey(fptr, card, status); /* insert the keyword */ contin = 1; remain -= nchar; next += nchar; nchar = 68 - nquote; } return(*status); } /*--------------------------------------------------------------------------*/ int ffikyl(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ int value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffl2c(value, valstring, status); /* convert logical to 'T' or 'F' */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikyj(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ LONGLONG value, /* I - keyword value */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffi2c(value, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikyf(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffr2f(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikye(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffr2e(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikyg(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffd2f(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikyd(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffd2e(value, decim, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikfc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffr2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikyc(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ float *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffr2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffr2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikfm(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffd2f(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2f(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffikym(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ double *value, /* I - keyword value */ int decim, /* I - no of decimals */ const char *comm, /* I - keyword comment */ int *status) /* IO - error status */ { char valstring[FLEN_VALUE], tmpstring[FLEN_VALUE]; char card[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); strcpy(valstring, "(" ); ffd2e(value[0], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ", "); ffd2e(value[1], decim, tmpstring, status); /* convert to string */ strcat(valstring, tmpstring); strcat(valstring, ")"); ffmkky(keyname, valstring, comm, card, status); /* construct the keyword*/ ffikey(fptr, card, status); /* write the keyword*/ return(*status); } /*--------------------------------------------------------------------------*/ int ffirec(fitsfile *fptr, /* I - FITS file pointer */ int nkey, /* I - position to insert new keyword */ const char *card, /* I - card string value */ int *status) /* IO - error status */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); ffmaky(fptr, nkey, status); /* move to insert position */ ffikey(fptr, card, status); /* insert the keyword card */ return(*status); } /*--------------------------------------------------------------------------*/ int ffikey(fitsfile *fptr, /* I - FITS file pointer */ const char *card, /* I - card string value */ int *status) /* IO - error status */ /* insert a keyword at the position of (fptr->Fptr)->nextkey */ { int ii, len, nshift; long nblocks; LONGLONG bytepos; char *inbuff, *outbuff, *tmpbuff, buff1[FLEN_CARD], buff2[FLEN_CARD]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if ( ((fptr->Fptr)->datastart - (fptr->Fptr)->headend) == 80) /* only room for END card */ { nblocks = 1; if (ffiblk(fptr, nblocks, 0, status) > 0) /* add new 2880-byte block*/ return(*status); } /* no. keywords to shift */ nshift= (int) (( (fptr->Fptr)->headend - (fptr->Fptr)->nextkey ) / 80); strncpy(buff2, card, 80); /* copy card to output buffer */ buff2[80] = '\0'; len = strlen(buff2); /* silently replace any illegal characters with a space */ for (ii=0; ii < len; ii++) if (buff2[ii] < ' ' || buff2[ii] > 126) buff2[ii] = ' '; for (ii=len; ii < 80; ii++) /* fill buffer with spaces if necessary */ buff2[ii] = ' '; for (ii=0; ii < 8; ii++) /* make sure keyword name is uppercase */ buff2[ii] = toupper(buff2[ii]); fftkey(buff2, status); /* test keyword name contains legal chars */ /* no need to do this any more, since any illegal characters have been removed fftrec(buff2, status); */ /* test rest of keyword for legal chars */ inbuff = buff1; outbuff = buff2; bytepos = (fptr->Fptr)->nextkey; /* pointer to next keyword in header */ ffmbyt(fptr, bytepos, REPORT_EOF, status); for (ii = 0; ii < nshift; ii++) /* shift each keyword down one position */ { ffgbyt(fptr, 80, inbuff, status); /* read the current keyword */ ffmbyt(fptr, bytepos, REPORT_EOF, status); /* move back */ ffpbyt(fptr, 80, outbuff, status); /* overwrite with other buffer */ tmpbuff = inbuff; /* swap input and output buffers */ inbuff = outbuff; outbuff = tmpbuff; bytepos += 80; } ffpbyt(fptr, 80, outbuff, status); /* write the final keyword */ (fptr->Fptr)->headend += 80; /* increment the position of the END keyword */ (fptr->Fptr)->nextkey += 80; /* increment the pointer to next keyword */ return(*status); } /*--------------------------------------------------------------------------*/ int ffdkey(fitsfile *fptr, /* I - FITS file pointer */ const char *keyname, /* I - keyword name */ int *status) /* IO - error status */ /* delete a specified header keyword */ { int keypos, len; char valstring[FLEN_VALUE], comm[FLEN_COMMENT], value[FLEN_VALUE]; char message[FLEN_ERRMSG]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgkey(fptr, keyname, valstring, comm, status) > 0) /* read keyword */ { sprintf(message, "Could not find the %s keyword to delete (ffdkey)", keyname); ffpmsg(message); return(*status); } /* calc position of keyword in header */ keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80); ffdrec(fptr, keypos, status); /* delete the keyword */ if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check for string value which may be continued over multiple keywords */ ffpmrk(); /* put mark on message stack; erase any messages after this */ ffc2s(valstring, value, status); /* remove quotes and trailing spaces */ if (*status == VALUE_UNDEFINED) { ffcmrk(); /* clear any spurious error messages, back to the mark */ *status = 0; } else { len = strlen(value); while (len && value[len - 1] == '&') /* ampersand used as continuation char */ { ffgcnt(fptr, value, status); if (*value) { ffdrec(fptr, keypos, status); /* delete the keyword */ len = strlen(value); } else /* a null valstring indicates no continuation */ len = 0; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffdstr(fitsfile *fptr, /* I - FITS file pointer */ const char *string, /* I - keyword name */ int *status) /* IO - error status */ /* delete a specified header keyword containing the input string */ { int keypos, len; char valstring[FLEN_VALUE], comm[FLEN_COMMENT], value[FLEN_VALUE]; char card[FLEN_CARD], message[FLEN_ERRMSG]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (ffgstr(fptr, string, card, status) > 0) /* read keyword */ { sprintf(message, "Could not find the %s keyword to delete (ffdkey)", string); ffpmsg(message); return(*status); } /* calc position of keyword in header */ keypos = (int) ((((fptr->Fptr)->nextkey) - ((fptr->Fptr)->headstart[(fptr->Fptr)->curhdu])) / 80); ffdrec(fptr, keypos, status); /* delete the keyword */ /* check for string value which may be continued over multiple keywords */ ffpsvc(card, valstring, comm, status); if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* check for string value which may be continued over multiple keywords */ ffpmrk(); /* put mark on message stack; erase any messages after this */ ffc2s(valstring, value, status); /* remove quotes and trailing spaces */ if (*status == VALUE_UNDEFINED) { ffcmrk(); /* clear any spurious error messages, back to the mark */ *status = 0; } else { len = strlen(value); while (len && value[len - 1] == '&') /* ampersand used as continuation char */ { ffgcnt(fptr, value, status); if (*value) { ffdrec(fptr, keypos, status); /* delete the keyword */ len = strlen(value); } else /* a null valstring indicates no continuation */ len = 0; } } return(*status); }/*--------------------------------------------------------------------------*/ int ffdrec(fitsfile *fptr, /* I - FITS file pointer */ int keypos, /* I - position in header of keyword to delete */ int *status) /* IO - error status */ /* Delete a header keyword at position keypos. The 1st keyword is at keypos=1. */ { int ii, nshift; LONGLONG bytepos; char *inbuff, *outbuff, *tmpbuff, buff1[81], buff2[81]; char message[FLEN_ERRMSG]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (keypos < 1 || keypos > (fptr->Fptr)->headend - (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] / 80 ) return(*status = KEY_OUT_BOUNDS); (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] + (keypos - 1) * 80; nshift=(int) (( (fptr->Fptr)->headend - (fptr->Fptr)->nextkey ) / 80); /* no. keywords to shift */ if (nshift <= 0) { sprintf(message, "Cannot delete keyword number %d. It does not exist.", keypos); ffpmsg(message); return(*status = KEY_OUT_BOUNDS); } bytepos = (fptr->Fptr)->headend - 80; /* last keyword in header */ /* construct a blank keyword */ strcpy(buff2, " "); strcat(buff2, " "); inbuff = buff1; outbuff = buff2; for (ii = 0; ii < nshift; ii++) /* shift each keyword up one position */ { ffmbyt(fptr, bytepos, REPORT_EOF, status); ffgbyt(fptr, 80, inbuff, status); /* read the current keyword */ ffmbyt(fptr, bytepos, REPORT_EOF, status); ffpbyt(fptr, 80, outbuff, status); /* overwrite with next keyword */ tmpbuff = inbuff; /* swap input and output buffers */ inbuff = outbuff; outbuff = tmpbuff; bytepos -= 80; } (fptr->Fptr)->headend -= 80; /* decrement the position of the END keyword */ return(*status); } astropy-0.3/cextern/cfitsio/adler32.c0000644000175000017500000001164712243255342015720 0ustar oleole/* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2007 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #define local static local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2); #define BASE 65521UL /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ #define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); /* use NO_DIVIDE if your processor does not do division in hardware */ #ifdef NO_DIVIDE # define MOD(a) \ do { \ if (a >= (BASE << 16)) a -= (BASE << 16); \ if (a >= (BASE << 15)) a -= (BASE << 15); \ if (a >= (BASE << 14)) a -= (BASE << 14); \ if (a >= (BASE << 13)) a -= (BASE << 13); \ if (a >= (BASE << 12)) a -= (BASE << 12); \ if (a >= (BASE << 11)) a -= (BASE << 11); \ if (a >= (BASE << 10)) a -= (BASE << 10); \ if (a >= (BASE << 9)) a -= (BASE << 9); \ if (a >= (BASE << 8)) a -= (BASE << 8); \ if (a >= (BASE << 7)) a -= (BASE << 7); \ if (a >= (BASE << 6)) a -= (BASE << 6); \ if (a >= (BASE << 5)) a -= (BASE << 5); \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) # define MOD4(a) \ do { \ if (a >= (BASE << 4)) a -= (BASE << 4); \ if (a >= (BASE << 3)) a -= (BASE << 3); \ if (a >= (BASE << 2)) a -= (BASE << 2); \ if (a >= (BASE << 1)) a -= (BASE << 1); \ if (a >= BASE) a -= BASE; \ } while (0) #else # define MOD(a) a %= BASE # define MOD4(a) a %= BASE #endif /* ========================================================================= */ uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; { unsigned long sum2; unsigned n; /* split Adler-32 into component sums */ sum2 = (adler >> 16) & 0xffff; adler &= 0xffff; /* in case user likes doing a byte at a time, keep it fast */ if (len == 1) { adler += buf[0]; if (adler >= BASE) adler -= BASE; sum2 += adler; if (sum2 >= BASE) sum2 -= BASE; return adler | (sum2 << 16); } /* initial Adler-32 value (deferred check for len == 1 speed) */ if (buf == Z_NULL) return 1L; /* in case short lengths are provided, keep it somewhat fast */ if (len < 16) { while (len--) { adler += *buf++; sum2 += adler; } if (adler >= BASE) adler -= BASE; MOD4(sum2); /* only added so many BASE's */ return adler | (sum2 << 16); } /* do length NMAX blocks -- requires just one modulo operation */ while (len >= NMAX) { len -= NMAX; n = NMAX / 16; /* NMAX is divisible by 16 */ do { DO16(buf); /* 16 sums unrolled */ buf += 16; } while (--n); MOD(adler); MOD(sum2); } /* do remaining bytes (less than NMAX, still just one modulo) */ if (len) { /* avoid modulos if none remaining */ while (len >= 16) { len -= 16; DO16(buf); buf += 16; } while (len--) { adler += *buf++; sum2 += adler; } MOD(adler); MOD(sum2); } /* return recombined sums */ return adler | (sum2 << 16); } /* ========================================================================= */ local uLong adler32_combine_(adler1, adler2, len2) uLong adler1; uLong adler2; z_off64_t len2; { unsigned long sum1; unsigned long sum2; unsigned rem; /* the derivation of this formula is left as an exercise for the reader */ rem = (unsigned)(len2 % BASE); sum1 = adler1 & 0xffff; sum2 = rem * sum1; MOD(sum2); sum1 += (adler2 & 0xffff) + BASE - 1; sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; if (sum1 >= BASE) sum1 -= BASE; if (sum1 >= BASE) sum1 -= BASE; if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); if (sum2 >= BASE) sum2 -= BASE; return sum1 | (sum2 << 16); } /* ========================================================================= */ uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong adler1; uLong adler2; z_off_t len2; { return adler32_combine_(adler1, adler2, len2); } uLong ZEXPORT adler32_combine64(adler1, adler2, len2) uLong adler1; uLong adler2; z_off64_t len2; { return adler32_combine_(adler1, adler2, len2); } astropy-0.3/cextern/cfitsio/zconf.h0000644000175000017500000003205112243255342015600 0ustar oleole/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ #ifndef ZCONF_H #define ZCONF_H /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. * Even better than compiling with -DZ_PREFIX would be to use configure to set * this permanently in zconf.h using "./configure --zprefix". */ #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 # define adler32_combine z_adler32_combine # define adler32_combine64 z_adler32_combine64 # define compress z_compress # define compress2 z_compress2 # define compressBound z_compressBound # define crc32 z_crc32 # define crc32_combine z_crc32_combine # define crc32_combine64 z_crc32_combine64 # define deflate z_deflate # define deflateBound z_deflateBound # define deflateCopy z_deflateCopy # define deflateEnd z_deflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateInit_ z_deflateInit_ # define deflateParams z_deflateParams # define deflatePrime z_deflatePrime # define deflateReset z_deflateReset # define deflateSetDictionary z_deflateSetDictionary # define deflateSetHeader z_deflateSetHeader # define deflateTune z_deflateTune # define deflate_copyright z_deflate_copyright # define get_crc_table z_get_crc_table # define gz_error z_gz_error # define gz_intmax z_gz_intmax # define gz_strwinerror z_gz_strwinerror # define gzbuffer z_gzbuffer # define gzclearerr z_gzclearerr # define gzclose z_gzclose # define gzclose_r z_gzclose_r # define gzclose_w z_gzclose_w # define gzdirect z_gzdirect # define gzdopen z_gzdopen # define gzeof z_gzeof # define gzerror z_gzerror # define gzflush z_gzflush # define gzgetc z_gzgetc # define gzgets z_gzgets # define gzoffset z_gzoffset # define gzoffset64 z_gzoffset64 # define gzopen z_gzopen # define gzopen64 z_gzopen64 # define gzprintf z_gzprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek # define gzseek64 z_gzseek64 # define gzsetparams z_gzsetparams # define gztell z_gztell # define gztell64 z_gztell64 # define gzungetc z_gzungetc # define gzwrite z_gzwrite # define inflate z_inflate # define inflateBack z_inflateBack # define inflateBackEnd z_inflateBackEnd # define inflateBackInit_ z_inflateBackInit_ # define inflateCopy z_inflateCopy # define inflateEnd z_inflateEnd # define inflateGetHeader z_inflateGetHeader # define inflateInit2_ z_inflateInit2_ # define inflateInit_ z_inflateInit_ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflate_copyright z_inflate_copyright # define inflate_fast z_inflate_fast # define inflate_table z_inflate_table # define uncompress z_uncompress # define zError z_zError # define zcalloc z_zcalloc # define zcfree z_zcfree # define zlibCompileFlags z_zlibCompileFlags # define zlibVersion z_zlibVersion /* all zlib typedefs in zlib.h and zconf.h */ # define Byte z_Byte # define Bytef z_Bytef # define alloc_func z_alloc_func # define charf z_charf # define free_func z_free_func # define gzFile z_gzFile # define gz_header z_gz_header # define gz_headerp z_gz_headerp # define in_func z_in_func # define intf z_intf # define out_func z_out_func # define uInt z_uInt # define uIntf z_uIntf # define uLong z_uLong # define uLongf z_uLongf # define voidp z_voidp # define voidpc z_voidpc # define voidpf z_voidpf /* all zlib structs in zlib.h and zconf.h */ # define gz_header_s z_gz_header_s # define internal_state z_internal_state #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) # define OS2 #endif #if defined(_WINDOWS) && !defined(WINDOWS) # define WINDOWS #endif #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) # ifndef WIN32 # define WIN32 # endif #endif #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) # ifndef SYS16BIT # define SYS16BIT # endif # endif #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #ifdef SYS16BIT # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #ifdef __STDC_VERSION__ # ifndef STDC # define STDC # endif # if __STDC_VERSION__ >= 199901L # ifndef STDC99 # define STDC99 # endif # endif #endif #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) # define STDC #endif #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) # define STDC #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC #endif #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ # define STDC #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const /* note: need a more gentle solution here */ # endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #ifdef SYS16BIT # if defined(M_I86SM) || defined(M_I86MM) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif # endif # if (defined(__SMALL__) || defined(__MEDIUM__)) /* Turbo C small or medium model */ # define SMALL_MEDIUM # ifdef __BORLANDC__ # define FAR _far # else # define FAR far # endif # endif #endif #if defined(WINDOWS) || defined(WIN32) /* If building or using zlib as a DLL, define ZLIB_DLL. * This is not mandatory, but it offers a little performance increase. */ # ifdef ZLIB_DLL # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) # ifdef ZLIB_INTERNAL # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif # endif # endif /* ZLIB_DLL */ /* If building or using zlib with the WINAPI/WINAPIV calling convention, * define ZLIB_WINAPI. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. */ # ifdef ZLIB_WINAPI # ifdef FAR # undef FAR # endif # include /* No need for _export, use ZLIB.DEF instead. */ /* For complete Windows compatibility, use WINAPI, not __stdcall. */ # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR CDECL # endif # endif #endif #if defined (__BEOS__) # ifdef ZLIB_DLL # ifdef ZLIB_INTERNAL # define ZEXPORT __declspec(dllexport) # define ZEXPORTVA __declspec(dllexport) # else # define ZEXPORT __declspec(dllimport) # define ZEXPORTVA __declspec(dllimport) # endif # endif #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef FAR # define FAR #endif #if !defined(__MACTYPES__) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #if !defined(MSDOS) && !defined(WINDOWS) && !defined(WIN32) # define Z_HAVE_UNISTD_H #endif #ifdef STDC # include /* for off_t */ #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ #if -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_* and off_t */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t # define z_off_t off_t # endif #endif #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 # define z_off64_t off64_t #else # define z_off64_t z_off_t #endif #if defined(__OS400__) # define NO_vsnprintf #endif #if defined(__MVS__) # define NO_vsnprintf #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) #pragma map(deflateInit_,"DEIN") #pragma map(deflateInit2_,"DEIN2") #pragma map(deflateEnd,"DEEND") #pragma map(deflateBound,"DEBND") #pragma map(inflateInit_,"ININ") #pragma map(inflateInit2_,"ININ2") #pragma map(inflateEnd,"INEND") #pragma map(inflateSync,"INSY") #pragma map(inflateSetDictionary,"INSEDI") #pragma map(compressBound,"CMBND") #pragma map(inflate_table,"INTABL") #pragma map(inflate_fast,"INFA") #pragma map(inflate_copyright,"INCOPY") #endif #endif /* ZCONF_H */ astropy-0.3/cextern/cfitsio/ricecomp.c0000644000175000017500000010462212243255342016261 0ustar oleole/* The following code was written by Richard White at STScI and made available for use in CFITSIO in July 1999. These routines were originally contained in 2 source files: rcomp.c and rdecomp.c, and the 'include' file now called ricecomp.h was originally called buffer.h. */ /*----------------------------------------------------------*/ /* */ /* START OF SOURCE FILE ORIGINALLY CALLED rcomp.c */ /* */ /*----------------------------------------------------------*/ /* @(#) rcomp.c 1.5 99/03/01 12:40:27 */ /* rcomp.c Compress image line using * (1) Difference of adjacent pixels * (2) Rice algorithm coding * * Returns number of bytes written to code buffer or * -1 on failure */ #include #include #include /* * nonzero_count is lookup table giving number of bits in 8-bit values not including * leading zeros used in fits_rdecomp, fits_rdecomp_short and fits_rdecomp_byte */ static const int nonzero_count[256] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; typedef unsigned char Buffer_t; typedef struct { int bitbuffer; /* bit buffer */ int bits_to_go; /* bits to go in buffer */ Buffer_t *start; /* start of buffer */ Buffer_t *current; /* current position in buffer */ Buffer_t *end; /* end of buffer */ } Buffer; #define putcbuf(c,mf) ((*(mf->current)++ = c), 0) #include "fitsio2.h" static void start_outputing_bits(Buffer *buffer); static int done_outputing_bits(Buffer *buffer); static int output_nbits(Buffer *buffer, int bits, int n); /* only used for diagnoistics static int case1, case2, case3; int fits_get_case(int *c1, int*c2, int*c3) { *c1 = case1; *c2 = case2; *c3 = case3; return(0); } */ /* this routine used to be called 'rcomp' (WDP) */ /*---------------------------------------------------------------------------*/ int fits_rcomp(int a[], /* input array */ int nx, /* number of input pixels */ unsigned char *c, /* output buffer */ int clen, /* max length of output */ int nblock) /* coding block size */ { Buffer bufmem, *buffer = &bufmem; /* int bsize; */ int i, j, thisblock; int lastpix, nextpix, pdiff; int v, fs, fsmask, top, fsmax, fsbits, bbits; int lbitbuffer, lbits_to_go; unsigned int psum; double pixelsum, dpsum; unsigned int *diff; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 4; */ /* nblock = 32; now an input parameter*/ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return(-1); } */ /* move out of switch block, to tweak performance */ fsbits = 5; fsmax = 25; bbits = 1<start = c; buffer->current = c; buffer->end = c+clen; buffer->bits_to_go = 8; /* * array for differences mapped to non-negative values */ diff = (unsigned int *) malloc(nblock*sizeof(unsigned int)); if (diff == (unsigned int *) NULL) { ffpmsg("fits_rcomp: insufficient memory"); return(-1); } /* * Code in blocks of nblock pixels */ start_outputing_bits(buffer); /* write out first int value to the first 4 bytes of the buffer */ if (output_nbits(buffer, a[0], 32) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } lastpix = a[0]; /* the first difference will always be zero */ thisblock = nblock; for (i=0; i> 1; for (fs = 0; psum>0; fs++) psum >>= 1; /* * write the codes * fsbits ID bits used to indicate split level */ if (fs >= fsmax) { /* Special high entropy case when FS >= fsmax * Just write pixel difference values directly, no Rice coding at all. */ if (output_nbits(buffer, fsmax+1, fsbits) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } for (j=0; jbitbuffer; lbits_to_go = buffer->bits_to_go; for (j=0; j> fs; /* * top is coded by top zeros + 1 */ if (lbits_to_go >= top+1) { lbitbuffer <<= top+1; lbitbuffer |= 1; lbits_to_go -= top+1; } else { lbitbuffer <<= lbits_to_go; putcbuf(lbitbuffer & 0xff,buffer); for (top -= lbits_to_go; top>=8; top -= 8) { putcbuf(0, buffer); } lbitbuffer = 1; lbits_to_go = 7-top; } /* * bottom FS bits are written without coding * code is output_nbits, moved into this routine to reduce overheads * This code potentially breaks if FS>24, so I am limiting * FS to 24 by choice of FSMAX above. */ if (fs > 0) { lbitbuffer <<= fs; lbitbuffer |= v & fsmask; lbits_to_go -= fs; while (lbits_to_go <= 0) { putcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer); lbits_to_go += 8; } } } /* check if overflowed output buffer */ if (buffer->current > buffer->end) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } buffer->bitbuffer = lbitbuffer; buffer->bits_to_go = lbits_to_go; } } done_outputing_bits(buffer); free(diff); /* * return number of bytes used */ return(buffer->current - buffer->start); } /*---------------------------------------------------------------------------*/ int fits_rcomp_short( short a[], /* input array */ int nx, /* number of input pixels */ unsigned char *c, /* output buffer */ int clen, /* max length of output */ int nblock) /* coding block size */ { Buffer bufmem, *buffer = &bufmem; /* int bsize; */ int i, j, thisblock; /* NOTE: in principle, the following 2 variable could be declared as 'short' but in fact the code runs faster (on 32-bit Linux at least) as 'int' */ int lastpix, nextpix; /* int pdiff; */ short pdiff; int v, fs, fsmask, top, fsmax, fsbits, bbits; int lbitbuffer, lbits_to_go; /* unsigned int psum; */ unsigned short psum; double pixelsum, dpsum; unsigned int *diff; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 2; */ /* nblock = 32; now an input parameter */ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return(-1); } */ /* move these out of switch block to further tweak performance */ fsbits = 4; fsmax = 14; bbits = 1<start = c; buffer->current = c; buffer->end = c+clen; buffer->bits_to_go = 8; /* * array for differences mapped to non-negative values */ diff = (unsigned int *) malloc(nblock*sizeof(unsigned int)); if (diff == (unsigned int *) NULL) { ffpmsg("fits_rcomp: insufficient memory"); return(-1); } /* * Code in blocks of nblock pixels */ start_outputing_bits(buffer); /* write out first short value to the first 2 bytes of the buffer */ if (output_nbits(buffer, a[0], 16) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } lastpix = a[0]; /* the first difference will always be zero */ thisblock = nblock; for (i=0; i> 1; */ psum = ((unsigned short) dpsum ) >> 1; for (fs = 0; psum>0; fs++) psum >>= 1; /* * write the codes * fsbits ID bits used to indicate split level */ if (fs >= fsmax) { /* case3++; */ /* Special high entropy case when FS >= fsmax * Just write pixel difference values directly, no Rice coding at all. */ if (output_nbits(buffer, fsmax+1, fsbits) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } for (j=0; jbitbuffer; lbits_to_go = buffer->bits_to_go; for (j=0; j> fs; /* * top is coded by top zeros + 1 */ if (lbits_to_go >= top+1) { lbitbuffer <<= top+1; lbitbuffer |= 1; lbits_to_go -= top+1; } else { lbitbuffer <<= lbits_to_go; putcbuf(lbitbuffer & 0xff,buffer); for (top -= lbits_to_go; top>=8; top -= 8) { putcbuf(0, buffer); } lbitbuffer = 1; lbits_to_go = 7-top; } /* * bottom FS bits are written without coding * code is output_nbits, moved into this routine to reduce overheads * This code potentially breaks if FS>24, so I am limiting * FS to 24 by choice of FSMAX above. */ if (fs > 0) { lbitbuffer <<= fs; lbitbuffer |= v & fsmask; lbits_to_go -= fs; while (lbits_to_go <= 0) { putcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer); lbits_to_go += 8; } } } /* check if overflowed output buffer */ if (buffer->current > buffer->end) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } buffer->bitbuffer = lbitbuffer; buffer->bits_to_go = lbits_to_go; } } done_outputing_bits(buffer); free(diff); /* * return number of bytes used */ return(buffer->current - buffer->start); } /*---------------------------------------------------------------------------*/ int fits_rcomp_byte( signed char a[], /* input array */ int nx, /* number of input pixels */ unsigned char *c, /* output buffer */ int clen, /* max length of output */ int nblock) /* coding block size */ { Buffer bufmem, *buffer = &bufmem; /* int bsize; */ int i, j, thisblock; /* NOTE: in principle, the following 2 variable could be declared as 'short' but in fact the code runs faster (on 32-bit Linux at least) as 'int' */ int lastpix, nextpix; /* int pdiff; */ signed char pdiff; int v, fs, fsmask, top, fsmax, fsbits, bbits; int lbitbuffer, lbits_to_go; /* unsigned int psum; */ unsigned char psum; double pixelsum, dpsum; unsigned int *diff; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 1; */ /* nblock = 32; now an input parameter */ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return(-1); } */ /* move these out of switch block to further tweak performance */ fsbits = 3; fsmax = 6; bbits = 1<start = c; buffer->current = c; buffer->end = c+clen; buffer->bits_to_go = 8; /* * array for differences mapped to non-negative values */ diff = (unsigned int *) malloc(nblock*sizeof(unsigned int)); if (diff == (unsigned int *) NULL) { ffpmsg("fits_rcomp: insufficient memory"); return(-1); } /* * Code in blocks of nblock pixels */ start_outputing_bits(buffer); /* write out first byte value to the first byte of the buffer */ if (output_nbits(buffer, a[0], 8) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } lastpix = a[0]; /* the first difference will always be zero */ thisblock = nblock; for (i=0; i> 1; */ psum = ((unsigned char) dpsum ) >> 1; for (fs = 0; psum>0; fs++) psum >>= 1; /* * write the codes * fsbits ID bits used to indicate split level */ if (fs >= fsmax) { /* Special high entropy case when FS >= fsmax * Just write pixel difference values directly, no Rice coding at all. */ if (output_nbits(buffer, fsmax+1, fsbits) == EOF) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } for (j=0; jbitbuffer; lbits_to_go = buffer->bits_to_go; for (j=0; j> fs; /* * top is coded by top zeros + 1 */ if (lbits_to_go >= top+1) { lbitbuffer <<= top+1; lbitbuffer |= 1; lbits_to_go -= top+1; } else { lbitbuffer <<= lbits_to_go; putcbuf(lbitbuffer & 0xff,buffer); for (top -= lbits_to_go; top>=8; top -= 8) { putcbuf(0, buffer); } lbitbuffer = 1; lbits_to_go = 7-top; } /* * bottom FS bits are written without coding * code is output_nbits, moved into this routine to reduce overheads * This code potentially breaks if FS>24, so I am limiting * FS to 24 by choice of FSMAX above. */ if (fs > 0) { lbitbuffer <<= fs; lbitbuffer |= v & fsmask; lbits_to_go -= fs; while (lbits_to_go <= 0) { putcbuf((lbitbuffer>>(-lbits_to_go)) & 0xff,buffer); lbits_to_go += 8; } } } /* check if overflowed output buffer */ if (buffer->current > buffer->end) { ffpmsg("rice_encode: end of buffer"); free(diff); return(-1); } buffer->bitbuffer = lbitbuffer; buffer->bits_to_go = lbits_to_go; } } done_outputing_bits(buffer); free(diff); /* * return number of bytes used */ return(buffer->current - buffer->start); } /*---------------------------------------------------------------------------*/ /* bit_output.c * * Bit output routines * Procedures return zero on success, EOF on end-of-buffer * * Programmer: R. White Date: 20 July 1998 */ /* Initialize for bit output */ static void start_outputing_bits(Buffer *buffer) { /* * Buffer is empty to start with */ buffer->bitbuffer = 0; buffer->bits_to_go = 8; } /*---------------------------------------------------------------------------*/ /* Output N bits (N must be <= 32) */ static int output_nbits(Buffer *buffer, int bits, int n) { /* local copies */ int lbitbuffer; int lbits_to_go; /* AND mask for the right-most n bits */ static unsigned int mask[33] = {0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff}; /* * insert bits at end of bitbuffer */ lbitbuffer = buffer->bitbuffer; lbits_to_go = buffer->bits_to_go; if (lbits_to_go+n > 32) { /* * special case for large n: put out the top lbits_to_go bits first * note that 0 < lbits_to_go <= 8 */ lbitbuffer <<= lbits_to_go; /* lbitbuffer |= (bits>>(n-lbits_to_go)) & ((1<>(n-lbits_to_go)) & *(mask+lbits_to_go); putcbuf(lbitbuffer & 0xff,buffer); n -= lbits_to_go; lbits_to_go = 8; } lbitbuffer <<= n; /* lbitbuffer |= ( bits & ((1<>(-lbits_to_go)) & 0xff,buffer); lbits_to_go += 8; } buffer->bitbuffer = lbitbuffer; buffer->bits_to_go = lbits_to_go; return(0); } /*---------------------------------------------------------------------------*/ /* Flush out the last bits */ static int done_outputing_bits(Buffer *buffer) { if(buffer->bits_to_go < 8) { putcbuf(buffer->bitbuffer<bits_to_go,buffer); /* if (putcbuf(buffer->bitbuffer<bits_to_go,buffer) == EOF) return(EOF); */ } return(0); } /*---------------------------------------------------------------------------*/ /*----------------------------------------------------------*/ /* */ /* START OF SOURCE FILE ORIGINALLY CALLED rdecomp.c */ /* */ /*----------------------------------------------------------*/ /* @(#) rdecomp.c 1.4 99/03/01 12:38:41 */ /* rdecomp.c Decompress image line using * (1) Difference of adjacent pixels * (2) Rice algorithm coding * * Returns 0 on success or 1 on failure */ /* moved these 'includes' to the beginning of the file (WDP) #include #include */ /*---------------------------------------------------------------------------*/ /* this routine used to be called 'rdecomp' (WDP) */ int fits_rdecomp (unsigned char *c, /* input buffer */ int clen, /* length of input */ unsigned int array[], /* output array */ int nx, /* number of output pixels */ int nblock) /* coding block size */ { /* int bsize; */ int i, k, imax; int nbits, nzero, fs; unsigned char *cend, bytevalue; unsigned int b, diff, lastpix; int fsmax, fsbits, bbits; extern const int nonzero_count[]; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 4; */ /* nblock = 32; now an input parameter */ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return 1; } */ /* move out of switch block, to tweak performance */ fsbits = 5; fsmax = 25; bbits = 1<> nbits) - 1; b &= (1< nx) imax = nx; if (fs<0) { /* low-entropy case, all zero differences */ for ( ; i= 0; k -= 8) { b = *c++; diff |= b<0) { b = *c++; diff |= b>>(-k); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } else { /* normal case, Rice coding */ for ( ; i>nbits); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } if (c > cend) { ffpmsg("decompression error: hit end of compressed byte stream"); return 1; } } if (c < cend) { ffpmsg("decompression warning: unused bytes at end of compressed buffer"); } return 0; } /*---------------------------------------------------------------------------*/ /* this routine used to be called 'rdecomp' (WDP) */ int fits_rdecomp_short (unsigned char *c, /* input buffer */ int clen, /* length of input */ unsigned short array[], /* output array */ int nx, /* number of output pixels */ int nblock) /* coding block size */ { int i, imax; /* int bsize; */ int k; int nbits, nzero, fs; unsigned char *cend, bytevalue; unsigned int b, diff, lastpix; int fsmax, fsbits, bbits; extern const int nonzero_count[]; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 2; */ /* nblock = 32; now an input parameter */ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return 1; } */ /* move out of switch block, to tweak performance */ fsbits = 4; fsmax = 14; bbits = 1<> nbits) - 1; b &= (1< nx) imax = nx; if (fs<0) { /* low-entropy case, all zero differences */ for ( ; i= 0; k -= 8) { b = *c++; diff |= b<0) { b = *c++; diff |= b>>(-k); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } else { /* normal case, Rice coding */ for ( ; i>nbits); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } if (c > cend) { ffpmsg("decompression error: hit end of compressed byte stream"); return 1; } } if (c < cend) { ffpmsg("decompression warning: unused bytes at end of compressed buffer"); } return 0; } /*---------------------------------------------------------------------------*/ /* this routine used to be called 'rdecomp' (WDP) */ int fits_rdecomp_byte (unsigned char *c, /* input buffer */ int clen, /* length of input */ unsigned char array[], /* output array */ int nx, /* number of output pixels */ int nblock) /* coding block size */ { int i, imax; /* int bsize; */ int k; int nbits, nzero, fs; unsigned char *cend; unsigned int b, diff, lastpix; int fsmax, fsbits, bbits; extern const int nonzero_count[]; /* * Original size of each pixel (bsize, bytes) and coding block * size (nblock, pixels) * Could make bsize a parameter to allow more efficient * compression of short & byte images. */ /* bsize = 1; */ /* nblock = 32; now an input parameter */ /* * From bsize derive: * FSBITS = # bits required to store FS * FSMAX = maximum value for FS * BBITS = bits/pixel for direct coding */ /* switch (bsize) { case 1: fsbits = 3; fsmax = 6; break; case 2: fsbits = 4; fsmax = 14; break; case 4: fsbits = 5; fsmax = 25; break; default: ffpmsg("rdecomp: bsize must be 1, 2, or 4 bytes"); return 1; } */ /* move out of switch block, to tweak performance */ fsbits = 3; fsmax = 6; bbits = 1<> nbits) - 1; b &= (1< nx) imax = nx; if (fs<0) { /* low-entropy case, all zero differences */ for ( ; i= 0; k -= 8) { b = *c++; diff |= b<0) { b = *c++; diff |= b>>(-k); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } else { /* normal case, Rice coding */ for ( ; i>nbits); b &= (1<>1; } else { diff = ~(diff>>1); } array[i] = diff+lastpix; lastpix = array[i]; } } if (c > cend) { ffpmsg("decompression error: hit end of compressed byte stream"); return 1; } } if (c < cend) { ffpmsg("decompression warning: unused bytes at end of compressed buffer"); } return 0; } astropy-0.3/cextern/cfitsio/getcolsb.c0000644000175000017500000022324512243255342016265 0ustar oleole/* This file, getcolsb.c, contains routines that read data elements from */ /* a FITS image or table, with signed char (signed byte) data type. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ signed char nulval, /* I - value for undefined pixels */ signed char *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; signed char nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TSBYTE, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclsb(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ signed char *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TSBYTE, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclsb(fptr, 2, row, firstelem, nelem, 1, 2, 0, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2dsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ signed char nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ signed char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3dsb(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3dsb(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ signed char nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ signed char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; LONGLONG nfits, narray; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}; LONGLONG lpixel[3]; signed char nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TSBYTE, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgclsb(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgclsb(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvsb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ signed char nulval, /* I - value to set undefined pixels */ signed char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii, i0, i1, i2, i3, i4, i5, i6, i7, i8, row, rstr, rstp, rinc; long str[9], stp[9], incr[9], dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; signed char nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvsb is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TSBYTE, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvsb: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgclsb(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfsb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ signed char *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; signed char nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvsb is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TSBYTE, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvsb: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclsb(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpsb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ signed char *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclsb(fptr, 1, row, firstelem, nelem, 1, 1, 0, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvsb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ signed char nulval, /* I - value for null pixels */ signed char *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfsb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ signed char *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { signed char dummy = 0; ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgclsb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ signed char nulval, /* I - value for null pixels if nultyp = 1 */ signed char *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; union u_tag { char charval; signed char scharval; } u; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status); /* special case: read column of T/F logicals */ if (tcode == TLOGICAL && elemincre == 1) { u.scharval = nulval; ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp, u.charval, (char *) array, nularray, anynul, status); return(*status); } if (strchr(tform,'A') != NULL) { if (*status == BAD_ELEM_NUM) { /* ignore this error message */ *status = 0; ffcmsg(); /* clear error stack */ } /* interpret a 'A' ASCII column as a 'B' byte column ('8A' == '8B') */ /* This is an undocumented 'feature' in CFITSIO */ /* we have to reset some of the values returned by ffgcpr */ tcode = TBYTE; incre = 1; /* each element is 1 byte wide */ repeat = twidth; /* total no. of chars in the col */ twidth = 1; /* width of each element */ scale = 1.0; /* no scaling */ zero = 0.0; tnull = NULL_UNDEFINED; /* don't test for nulls */ maxelem = DBUFFSIZE; } if (*status > 0) return(*status); incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING && hdutype == ASCII_TBL) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default, check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + (rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) &array[next], status); fffi1s1((unsigned char *)&array[next], ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2s1((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4s1((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8s1( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4s1((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8s1((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); /* interpret the string as an ASCII formated number */ fffstrs1((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read bytes from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclsb).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclsb).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1s1(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == -128.) { /* Instead of subtracting 128, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(signed char *) &input[ii] ) ^ 0x80; } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; /* copy input */ } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == -128.) { /* Instead of subtracting 128, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = ( *(signed char *) &input[ii] ) ^ 0x80; } } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2s1(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4s1(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8s1(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < -128) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > 127) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4s1(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { /* use redundant boolean logic in following statement */ /* to suppress irritating Borland compiler warning message */ if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (zero > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8s1(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (input[ii] > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (zero > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstrs1(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ signed char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ signed char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DSCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = -128; } else if (dvalue > DSCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = 127; } else output[ii] = (signed char) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/getcol.c0000644000175000017500000011563212243255342015740 0ustar oleole /* This file, getcol.c, contains routines that read data elements from */ /* a FITS image or table. There are generic datatype routines. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpxv( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *firstpix, /* I - coord of first pixel to read (1s based) */ LONGLONG nelem, /* I - number of values to read */ void *nulval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { LONGLONG tfirstpix[99]; int naxis, ii; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); for (ii=0; ii < naxis; ii++) tfirstpix[ii] = firstpix[ii]; ffgpxvll(fptr, datatype, tfirstpix, nelem, nulval, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpxvll( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG *firstpix, /* I - coord of first pixel to read (1s based) */ LONGLONG nelem, /* I - number of values to read */ void *nulval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { int naxis, ii; char cdummy; int nullcheck = 1; LONGLONG naxes[9], trc[9]= {1,1,1,1,1,1,1,1,1}; long inc[9]= {1,1,1,1,1,1,1,1,1}; LONGLONG dimsize = 1, firstelem; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); if (naxis == 0 || naxes[0] == 0) { *status = BAD_DIMEN; return(*status); } /* calculate the position of the first element in the array */ firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; trc[ii] = firstpix[ii]; } firstelem++; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ /* test for special case of reading an integral number of */ /* rows in a 2D or 3D image (which includes reading the whole image */ if (naxis > 1 && naxis < 4 && firstpix[0] == 1 && (nelem / naxes[0]) * naxes[0] == nelem) { /* calculate coordinate of last pixel */ trc[0] = naxes[0]; /* reading whole rows */ trc[1] = firstpix[1] + (nelem / naxes[0] - 1); while (trc[1] > naxes[1]) { trc[1] = trc[1] - naxes[1]; trc[2] = trc[2] + 1; /* increment to next plane of cube */ } fits_read_compressed_img(fptr, datatype, firstpix, trc, inc, 1, nulval, array, NULL, anynul, status); } else { fits_read_compressed_pixels(fptr, datatype, firstelem, nelem, nullcheck, nulval, array, NULL, anynul, status); } return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (datatype == TBYTE) { if (nulval == 0) ffgclb(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (unsigned char *) array, &cdummy, anynul, status); else ffgclb(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned char *) nulval, (unsigned char *) array, &cdummy, anynul, status); } else if (datatype == TSBYTE) { if (nulval == 0) ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (signed char *) array, &cdummy, anynul, status); else ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 1, *(signed char *) nulval, (signed char *) array, &cdummy, anynul, status); } else if (datatype == TUSHORT) { if (nulval == 0) ffgclui(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (unsigned short *) array, &cdummy, anynul, status); else ffgclui(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned short *) nulval, (unsigned short *) array, &cdummy, anynul, status); } else if (datatype == TSHORT) { if (nulval == 0) ffgcli(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (short *) array, &cdummy, anynul, status); else ffgcli(fptr, 2, 1, firstelem, nelem, 1, 1, *(short *) nulval, (short *) array, &cdummy, anynul, status); } else if (datatype == TUINT) { if (nulval == 0) ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (unsigned int *) array, &cdummy, anynul, status); else ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned int *) nulval, (unsigned int *) array, &cdummy, anynul, status); } else if (datatype == TINT) { if (nulval == 0) ffgclk(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (int *) array, &cdummy, anynul, status); else ffgclk(fptr, 2, 1, firstelem, nelem, 1, 1, *(int *) nulval, (int *) array, &cdummy, anynul, status); } else if (datatype == TULONG) { if (nulval == 0) ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (unsigned long *) array, &cdummy, anynul, status); else ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 1, *(unsigned long *) nulval, (unsigned long *) array, &cdummy, anynul, status); } else if (datatype == TLONG) { if (nulval == 0) ffgclj(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (long *) array, &cdummy, anynul, status); else ffgclj(fptr, 2, 1, firstelem, nelem, 1, 1, *(long *) nulval, (long *) array, &cdummy, anynul, status); } else if (datatype == TLONGLONG) { if (nulval == 0) ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (LONGLONG *) array, &cdummy, anynul, status); else ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 1, *(LONGLONG *) nulval, (LONGLONG *) array, &cdummy, anynul, status); } else if (datatype == TFLOAT) { if (nulval == 0) ffgcle(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (float *) array, &cdummy, anynul, status); else ffgcle(fptr, 2, 1, firstelem, nelem, 1, 1, *(float *) nulval, (float *) array, &cdummy, anynul, status); } else if (datatype == TDOUBLE) { if (nulval == 0) ffgcld(fptr, 2, 1, firstelem, nelem, 1, 1, 0, (double *) array, &cdummy, anynul, status); else ffgcld(fptr, 2, 1, firstelem, nelem, 1, 1, *(double *) nulval, (double *) array, &cdummy, anynul, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgpxf( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *firstpix, /* I - coord of first pixel to read (1s based) */ LONGLONG nelem, /* I - number of values to read */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - returned array of null value flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). The nullarray values will = 1 if the corresponding array value is null. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { LONGLONG tfirstpix[99]; int naxis, ii; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); for (ii=0; ii < naxis; ii++) tfirstpix[ii] = firstpix[ii]; ffgpxfll(fptr, datatype, tfirstpix, nelem, array, nullarray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpxfll( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG *firstpix, /* I - coord of first pixel to read (1s based) */ LONGLONG nelem, /* I - number of values to read */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - returned array of null value flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). The nullarray values will = 1 if the corresponding array value is null. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { int naxis, ii; int nullcheck = 2; LONGLONG naxes[9]; LONGLONG dimsize = 1, firstelem; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgiszll(fptr, 9, naxes, status); /* calculate the position of the first element in the array */ firstelem = 0; for (ii=0; ii < naxis; ii++) { firstelem += ((firstpix[ii] - 1) * dimsize); dimsize *= naxes[ii]; } firstelem++; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, datatype, firstelem, nelem, nullcheck, NULL, array, nullarray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (datatype == TBYTE) { ffgclb(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (unsigned char *) array, nullarray, anynul, status); } else if (datatype == TSBYTE) { ffgclsb(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (signed char *) array, nullarray, anynul, status); } else if (datatype == TUSHORT) { ffgclui(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (unsigned short *) array, nullarray, anynul, status); } else if (datatype == TSHORT) { ffgcli(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (short *) array, nullarray, anynul, status); } else if (datatype == TUINT) { ffgcluk(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (unsigned int *) array, nullarray, anynul, status); } else if (datatype == TINT) { ffgclk(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (int *) array, nullarray, anynul, status); } else if (datatype == TULONG) { ffgcluj(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (unsigned long *) array, nullarray, anynul, status); } else if (datatype == TLONG) { ffgclj(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (long *) array, nullarray, anynul, status); } else if (datatype == TLONGLONG) { ffgcljj(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (LONGLONG *) array, nullarray, anynul, status); } else if (datatype == TFLOAT) { ffgcle(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (float *) array, nullarray, anynul, status); } else if (datatype == TDOUBLE) { ffgcld(fptr, 2, 1, firstelem, nelem, 1, 2, 0, (double *) array, nullarray, anynul, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgsv( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc , /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dim. */ void *nulval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an section of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { int naxis, ii; long naxes[9]; LONGLONG nelem = 1; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* get the size of the image */ ffgidm(fptr, &naxis, status); ffgisz(fptr, 9, naxes, status); /* test for the important special case where we are reading the whole image */ /* this is only useful for images that are not tile-compressed */ if (!fits_is_compressed_image(fptr, status)) { for (ii = 0; ii < naxis; ii++) { if (inc[ii] != 1 || blc[ii] !=1 || trc[ii] != naxes[ii]) break; nelem = nelem * naxes[ii]; } if (ii == naxis) { /* read the whole image more efficiently */ ffgpxv(fptr, datatype, blc, nelem, nulval, array, anynul, status); return(*status); } } if (datatype == TBYTE) { if (nulval == 0) ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, 0, (unsigned char *) array, anynul, status); else ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned char *) nulval, (unsigned char *) array, anynul, status); } else if (datatype == TSBYTE) { if (nulval == 0) ffgsvsb(fptr, 1, naxis, naxes, blc, trc, inc, 0, (signed char *) array, anynul, status); else ffgsvsb(fptr, 1, naxis, naxes, blc, trc, inc, *(signed char *) nulval, (signed char *) array, anynul, status); } else if (datatype == TUSHORT) { if (nulval == 0) ffgsvui(fptr, 1, naxis, naxes, blc, trc, inc, 0, (unsigned short *) array, anynul, status); else ffgsvui(fptr, 1, naxis, naxes,blc, trc, inc, *(unsigned short *) nulval, (unsigned short *) array, anynul, status); } else if (datatype == TSHORT) { if (nulval == 0) ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, 0, (short *) array, anynul, status); else ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, *(short *) nulval, (short *) array, anynul, status); } else if (datatype == TUINT) { if (nulval == 0) ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, 0, (unsigned int *) array, anynul, status); else ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned int *) nulval, (unsigned int *) array, anynul, status); } else if (datatype == TINT) { if (nulval == 0) ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, 0, (int *) array, anynul, status); else ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, *(int *) nulval, (int *) array, anynul, status); } else if (datatype == TULONG) { if (nulval == 0) ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, 0, (unsigned long *) array, anynul, status); else ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned long *) nulval, (unsigned long *) array, anynul, status); } else if (datatype == TLONG) { if (nulval == 0) ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, 0, (long *) array, anynul, status); else ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, *(long *) nulval, (long *) array, anynul, status); } else if (datatype == TLONGLONG) { if (nulval == 0) ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, 0, (LONGLONG *) array, anynul, status); else ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, *(LONGLONG *) nulval, (LONGLONG *) array, anynul, status); } else if (datatype == TFLOAT) { if (nulval == 0) ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, 0, (float *) array, anynul, status); else ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, *(float *) nulval, (float *) array, anynul, status); } else if (datatype == TDOUBLE) { if (nulval == 0) ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, 0, (double *) array, anynul, status); else ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, *(double *) nulval, (double *) array, anynul, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgpv( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ void *nulval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (datatype == TBYTE) { if (nulval == 0) ffgpvb(fptr, 1, firstelem, nelem, 0, (unsigned char *) array, anynul, status); else ffgpvb(fptr, 1, firstelem, nelem, *(unsigned char *) nulval, (unsigned char *) array, anynul, status); } else if (datatype == TSBYTE) { if (nulval == 0) ffgpvsb(fptr, 1, firstelem, nelem, 0, (signed char *) array, anynul, status); else ffgpvsb(fptr, 1, firstelem, nelem, *(signed char *) nulval, (signed char *) array, anynul, status); } else if (datatype == TUSHORT) { if (nulval == 0) ffgpvui(fptr, 1, firstelem, nelem, 0, (unsigned short *) array, anynul, status); else ffgpvui(fptr, 1, firstelem, nelem, *(unsigned short *) nulval, (unsigned short *) array, anynul, status); } else if (datatype == TSHORT) { if (nulval == 0) ffgpvi(fptr, 1, firstelem, nelem, 0, (short *) array, anynul, status); else ffgpvi(fptr, 1, firstelem, nelem, *(short *) nulval, (short *) array, anynul, status); } else if (datatype == TUINT) { if (nulval == 0) ffgpvuk(fptr, 1, firstelem, nelem, 0, (unsigned int *) array, anynul, status); else ffgpvuk(fptr, 1, firstelem, nelem, *(unsigned int *) nulval, (unsigned int *) array, anynul, status); } else if (datatype == TINT) { if (nulval == 0) ffgpvk(fptr, 1, firstelem, nelem, 0, (int *) array, anynul, status); else ffgpvk(fptr, 1, firstelem, nelem, *(int *) nulval, (int *) array, anynul, status); } else if (datatype == TULONG) { if (nulval == 0) ffgpvuj(fptr, 1, firstelem, nelem, 0, (unsigned long *) array, anynul, status); else ffgpvuj(fptr, 1, firstelem, nelem, *(unsigned long *) nulval, (unsigned long *) array, anynul, status); } else if (datatype == TLONG) { if (nulval == 0) ffgpvj(fptr, 1, firstelem, nelem, 0, (long *) array, anynul, status); else ffgpvj(fptr, 1, firstelem, nelem, *(long *) nulval, (long *) array, anynul, status); } else if (datatype == TLONGLONG) { if (nulval == 0) ffgpvjj(fptr, 1, firstelem, nelem, 0, (LONGLONG *) array, anynul, status); else ffgpvjj(fptr, 1, firstelem, nelem, *(LONGLONG *) nulval, (LONGLONG *) array, anynul, status); } else if (datatype == TFLOAT) { if (nulval == 0) ffgpve(fptr, 1, firstelem, nelem, 0, (float *) array, anynul, status); else ffgpve(fptr, 1, firstelem, nelem, *(float *) nulval, (float *) array, anynul, status); } else if (datatype == TDOUBLE) { if (nulval == 0) ffgpvd(fptr, 1, firstelem, nelem, 0, (double *) array, anynul, status); else { ffgpvd(fptr, 1, firstelem, nelem, *(double *) nulval, (double *) array, anynul, status); } } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgpf( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - array of null value flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). The nullarray values will = 1 if the corresponding array value is null. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (datatype == TBYTE) { ffgpfb(fptr, 1, firstelem, nelem, (unsigned char *) array, nullarray, anynul, status); } else if (datatype == TSBYTE) { ffgpfsb(fptr, 1, firstelem, nelem, (signed char *) array, nullarray, anynul, status); } else if (datatype == TUSHORT) { ffgpfui(fptr, 1, firstelem, nelem, (unsigned short *) array, nullarray, anynul, status); } else if (datatype == TSHORT) { ffgpfi(fptr, 1, firstelem, nelem, (short *) array, nullarray, anynul, status); } else if (datatype == TUINT) { ffgpfuk(fptr, 1, firstelem, nelem, (unsigned int *) array, nullarray, anynul, status); } else if (datatype == TINT) { ffgpfk(fptr, 1, firstelem, nelem, (int *) array, nullarray, anynul, status); } else if (datatype == TULONG) { ffgpfuj(fptr, 1, firstelem, nelem, (unsigned long *) array, nullarray, anynul, status); } else if (datatype == TLONG) { ffgpfj(fptr, 1, firstelem, nelem, (long *) array, nullarray, anynul, status); } else if (datatype == TLONGLONG) { ffgpfjj(fptr, 1, firstelem, nelem, (LONGLONG *) array, nullarray, anynul, status); } else if (datatype == TFLOAT) { ffgpfe(fptr, 1, firstelem, nelem, (float *) array, nullarray, anynul, status); } else if (datatype == TDOUBLE) { ffgpfd(fptr, 1, firstelem, nelem, (double *) array, nullarray, anynul, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgcv( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ void *nulval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a table column. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of true if any pixels are undefined. */ { char cdummy[2]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (datatype == TBIT) { ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status); } else if (datatype == TBYTE) { if (nulval == 0) ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (unsigned char *) array, cdummy, anynul, status); else ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned char *) nulval, (unsigned char *) array, cdummy, anynul, status); } else if (datatype == TSBYTE) { if (nulval == 0) ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (signed char *) array, cdummy, anynul, status); else ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(signed char *) nulval, (signed char *) array, cdummy, anynul, status); } else if (datatype == TUSHORT) { if (nulval == 0) ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (unsigned short *) array, cdummy, anynul, status); else ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned short *) nulval, (unsigned short *) array, cdummy, anynul, status); } else if (datatype == TSHORT) { if (nulval == 0) ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (short *) array, cdummy, anynul, status); else ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(short *) nulval, (short *) array, cdummy, anynul, status); } else if (datatype == TUINT) { if (nulval == 0) ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (unsigned int *) array, cdummy, anynul, status); else ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned int *) nulval, (unsigned int *) array, cdummy, anynul, status); } else if (datatype == TINT) { if (nulval == 0) ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (int *) array, cdummy, anynul, status); else ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(int *) nulval, (int *) array, cdummy, anynul, status); } else if (datatype == TULONG) { if (nulval == 0) ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (unsigned long *) array, cdummy, anynul, status); else ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned long *) nulval, (unsigned long *) array, cdummy, anynul, status); } else if (datatype == TLONG) { if (nulval == 0) ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (long *) array, cdummy, anynul, status); else ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(long *) nulval, (long *) array, cdummy, anynul, status); } else if (datatype == TLONGLONG) { if (nulval == 0) ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0, (LONGLONG *) array, cdummy, anynul, status); else ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(LONGLONG *) nulval, (LONGLONG *) array, cdummy, anynul, status); } else if (datatype == TFLOAT) { if (nulval == 0) ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0., (float *) array, cdummy, anynul, status); else ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(float *) nulval,(float *) array, cdummy, anynul, status); } else if (datatype == TDOUBLE) { if (nulval == 0) ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0., (double *) array, cdummy, anynul, status); else ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(double *) nulval, (double *) array, cdummy, anynul, status); } else if (datatype == TCOMPLEX) { if (nulval == 0) ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, 0., (float *) array, cdummy, anynul, status); else ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, *(float *) nulval, (float *) array, cdummy, anynul, status); } else if (datatype == TDBLCOMPLEX) { if (nulval == 0) ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, 0., (double *) array, cdummy, anynul, status); else ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, *(double *) nulval, (double *) array, cdummy, anynul, status); } else if (datatype == TLOGICAL) { if (nulval == 0) ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, 0, (char *) array, cdummy, anynul, status); else ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, *(char *) nulval, (char *) array, cdummy, anynul, status); } else if (datatype == TSTRING) { if (nulval == 0) { cdummy[0] = '\0'; ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, cdummy, (char **) array, cdummy, anynul, status); } else ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, (char *) nulval, (char **) array, cdummy, anynul, status); } else *status = BAD_DATATYPE; return(*status); } /*--------------------------------------------------------------------------*/ int ffgcf( fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the value */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - array of null value flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a table column. The datatype of the input array is defined by the 2nd argument. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). ANYNUL is returned with a value of true if any pixels are undefined. */ { void *nulval; /* dummy argument */ double dnulval = 0.; if (*status > 0) /* inherit input status value if > 0 */ return(*status); nulval = &dnulval; /* set to a harmless value; this is never used */ if (datatype == TBIT) { ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status); } else if (datatype == TBYTE) { ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(unsigned char *) nulval, (unsigned char *) array, nullarray, anynul, status); } else if (datatype == TSBYTE) { ffgclsb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(signed char *) nulval, (signed char *) array, nullarray, anynul, status); } else if (datatype == TUSHORT) { ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(unsigned short *) nulval, (unsigned short *) array, nullarray, anynul, status); } else if (datatype == TSHORT) { ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(short *) nulval, (short *) array, nullarray, anynul, status); } else if (datatype == TUINT) { ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(unsigned int *) nulval, (unsigned int *) array, nullarray, anynul, status); } else if (datatype == TINT) { ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(int *) nulval, (int *) array, nullarray, anynul, status); } else if (datatype == TULONG) { ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(unsigned long *) nulval, (unsigned long *) array, nullarray, anynul, status); } else if (datatype == TLONG) { ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(long *) nulval, (long *) array, nullarray, anynul, status); } else if (datatype == TLONGLONG) { ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(LONGLONG *) nulval, (LONGLONG *) array, nullarray, anynul, status); } else if (datatype == TFLOAT) { ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(float *) nulval,(float *) array, nullarray, anynul, status); } else if (datatype == TDOUBLE) { ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(double *) nulval, (double *) array, nullarray, anynul, status); } else if (datatype == TCOMPLEX) { ffgcfc(fptr, colnum, firstrow, firstelem, nelem, (float *) array, nullarray, anynul, status); } else if (datatype == TDBLCOMPLEX) { ffgcfm(fptr, colnum, firstrow, firstelem, nelem, (double *) array, nullarray, anynul, status); } else if (datatype == TLOGICAL) { ffgcll(fptr, colnum, firstrow, firstelem, nelem, 2, *(char *) nulval, (char *) array, nullarray, anynul, status); } else if (datatype == TSTRING) { ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, (char *) nulval, (char **) array, nullarray, anynul, status); } else *status = BAD_DATATYPE; return(*status); } astropy-0.3/cextern/cfitsio/trees.h0000644000175000017500000002043012243255342015601 0ustar oleole/* header created automatically with -DGEN_TREES_H */ local const ct_data static_ltree[L_CODES+2] = { {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} }; local const ct_data static_dtree[D_CODES] = { {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} }; const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }; const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }; local const int base_length[LENGTH_CODES] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 }; local const int base_dist[D_CODES] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 }; astropy-0.3/cextern/cfitsio/getcols.c0000644000175000017500000007055212243255342016124 0ustar oleole/* This file, getcols.c, contains routines that read data elements from */ /* a FITS image or table, with a character string datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include /* stddef.h is apparently needed to define size_t */ #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgcvs( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of strings to read */ char *nulval, /* I - string for null pixels */ char **array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of string values from a column in the current FITS HDU. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = null in which case no checks for undefined pixels will be made. */ { char cdummy[2]; ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, nulval, array, cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfs( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of strings to read */ char **array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of string values from a column in the current FITS HDU. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { char dummy[2]; ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcls( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of strings to read */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ char *nulval, /* I - value for null pixels if nultyp = 1 */ char **array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of string values from a column in the current FITS HDU. Returns a formated string value, regardless of the datatype of the column */ { int tcode, hdutype, tstatus, scaled, intcol, dwidth, nulwidth, ll, dlen; long ii, jj; tcolumn *colptr; char message[FLEN_ERRMSG], *carray, keyname[FLEN_KEYWORD]; char cform[20], dispfmt[20], tmpstr[400], *flgarray, tmpnull[80]; unsigned char byteval; float *earray; double *darray, tscale = 1.0; LONGLONG *llarray; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d", colnum); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = abs(colptr->tdatatype); if (tcode == TSTRING) { /* simply call the string column reading routine */ ffgcls2(fptr, colnum, firstrow, firstelem, nelem, nultyp, nulval, array, nularray, anynul, status); } else if (tcode == TLOGICAL) { /* allocate memory for the array of logical values */ carray = (char *) malloc((size_t) nelem); /* call the logical column reading routine */ ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp, *nulval, carray, nularray, anynul, status); if (*status <= 0) { /* convert logical values to "T", "F", or "N" (Null) */ for (ii = 0; ii < nelem; ii++) { if (carray[ii] == 1) strcpy(array[ii], "T"); else if (carray[ii] == 0) strcpy(array[ii], "F"); else /* undefined values = 2 */ strcpy(array[ii],"N"); } } free(carray); /* free the memory */ } else if (tcode == TCOMPLEX) { /* allocate memory for the array of double values */ earray = (float *) calloc((size_t) (nelem * 2), sizeof(float) ); ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, FLOATNULLVALUE, earray, nularray, anynul, status); if (*status <= 0) { /* determine the format for the output strings */ ffgcdw(fptr, colnum, &dwidth, status); dwidth = (dwidth - 3) / 2; /* use the TDISPn keyword if it exists */ ffkeyn("TDISP", colnum, keyname, status); tstatus = 0; cform[0] = '\0'; if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) { /* convert the Fortran style format to a C style format */ ffcdsp(dispfmt, cform); } if (!cform[0]) strcpy(cform, "%14.6E"); /* write the formated string for each value: "(real,imag)" */ jj = 0; for (ii = 0; ii < nelem; ii++) { strcpy(array[ii], "("); /* test for null value */ if (earray[jj] == FLOATNULLVALUE) { strcpy(tmpstr, "NULL"); if (nultyp == 2) nularray[ii] = 1; } else sprintf(tmpstr, cform, earray[jj]); strncat(array[ii], tmpstr, dwidth); strcat(array[ii], ","); jj++; /* test for null value */ if (earray[jj] == FLOATNULLVALUE) { strcpy(tmpstr, "NULL"); if (nultyp == 2) nularray[ii] = 1; } else sprintf(tmpstr, cform, earray[jj]); strncat(array[ii], tmpstr, dwidth); strcat(array[ii], ")"); jj++; } } free(earray); /* free the memory */ } else if (tcode == TDBLCOMPLEX) { /* allocate memory for the array of double values */ darray = (double *) calloc((size_t) (nelem * 2), sizeof(double) ); ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 1, DOUBLENULLVALUE, darray, nularray, anynul, status); if (*status <= 0) { /* determine the format for the output strings */ ffgcdw(fptr, colnum, &dwidth, status); dwidth = (dwidth - 3) / 2; /* use the TDISPn keyword if it exists */ ffkeyn("TDISP", colnum, keyname, status); tstatus = 0; cform[0] = '\0'; if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) { /* convert the Fortran style format to a C style format */ ffcdsp(dispfmt, cform); } if (!cform[0]) strcpy(cform, "%23.15E"); /* write the formated string for each value: "(real,imag)" */ jj = 0; for (ii = 0; ii < nelem; ii++) { strcpy(array[ii], "("); /* test for null value */ if (darray[jj] == DOUBLENULLVALUE) { strcpy(tmpstr, "NULL"); if (nultyp == 2) nularray[ii] = 1; } else sprintf(tmpstr, cform, darray[jj]); strncat(array[ii], tmpstr, dwidth); strcat(array[ii], ","); jj++; /* test for null value */ if (darray[jj] == DOUBLENULLVALUE) { strcpy(tmpstr, "NULL"); if (nultyp == 2) nularray[ii] = 1; } else sprintf(tmpstr, cform, darray[jj]); strncat(array[ii], tmpstr, dwidth); strcat(array[ii], ")"); jj++; } } free(darray); /* free the memory */ } else if (tcode == TLONGLONG) { /* allocate memory for the array of LONGLONG values */ llarray = (LONGLONG *) calloc((size_t) nelem, sizeof(LONGLONG) ); flgarray = (char *) calloc((size_t) nelem, sizeof(char) ); dwidth = 20; /* max width of displayed long long integer value */ if (ffgcfjj(fptr, colnum, firstrow, firstelem, nelem, llarray, flgarray, anynul, status) > 0) { free(flgarray); free(llarray); return(*status); } /* write the formated string for each value */ if (nulval) { strcpy(tmpnull, nulval); nulwidth = strlen(nulval); } else { strcpy(tmpnull, " "); nulwidth = 1; } for (ii = 0; ii < nelem; ii++) { if ( flgarray[ii] ) { *array[ii] = '\0'; if (dwidth < nulwidth) strncat(array[ii], tmpnull, dwidth); else sprintf(array[ii],"%*s",dwidth,tmpnull); if (nultyp == 2) nularray[ii] = 1; } else { #if defined(_MSC_VER) /* Microsoft Visual C++ 6.0 uses '%I64d' syntax for 8-byte integers */ sprintf(tmpstr, "%20I64d", llarray[ii]); #elif (USE_LL_SUFFIX == 1) sprintf(tmpstr, "%20lld", llarray[ii]); #else sprintf(tmpstr, "%20ld", llarray[ii]); #endif *array[ii] = '\0'; strncat(array[ii], tmpstr, 20); } } free(flgarray); free(llarray); /* free the memory */ } else { /* allocate memory for the array of double values */ darray = (double *) calloc((size_t) nelem, sizeof(double) ); /* read all other numeric type columns as doubles */ if (ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, nultyp, DOUBLENULLVALUE, darray, nularray, anynul, status) > 0) { free(darray); return(*status); } /* determine the format for the output strings */ ffgcdw(fptr, colnum, &dwidth, status); /* check if column is scaled */ ffkeyn("TSCAL", colnum, keyname, status); tstatus = 0; scaled = 0; if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0) { if (tscale != 1.0) scaled = 1; /* yes, this is a scaled column */ } intcol = 0; if (tcode <= TLONG && !scaled) intcol = 1; /* this is an unscaled integer column */ /* use the TDISPn keyword if it exists */ ffkeyn("TDISP", colnum, keyname, status); tstatus = 0; cform[0] = '\0'; if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) { /* convert the Fortran style TDISPn to a C style format */ ffcdsp(dispfmt, cform); } if (!cform[0]) { /* no TDISPn keyword; use TFORMn instead */ ffkeyn("TFORM", colnum, keyname, status); ffgkys(fptr, keyname, dispfmt, NULL, status); if (scaled && tcode <= TSHORT) { /* scaled short integer column == float */ strcpy(cform, "%#14.6G"); } else if (scaled && tcode == TLONG) { /* scaled long integer column == double */ strcpy(cform, "%#23.15G"); } else { ffghdt(fptr, &hdutype, status); if (hdutype == ASCII_TBL) { /* convert the Fortran style TFORMn to a C style format */ ffcdsp(dispfmt, cform); } else { /* this is a binary table, need to convert the format */ if (tcode == TBIT) { /* 'X' */ strcpy(cform, "%4d"); } else if (tcode == TBYTE) { /* 'B' */ strcpy(cform, "%4d"); } else if (tcode == TSHORT) { /* 'I' */ strcpy(cform, "%6d"); } else if (tcode == TLONG) { /* 'J' */ strcpy(cform, "%11.0f"); intcol = 0; /* needed to support unsigned int */ } else if (tcode == TFLOAT) { /* 'E' */ strcpy(cform, "%#14.6G"); } else if (tcode == TDOUBLE) { /* 'D' */ strcpy(cform, "%#23.15G"); } } } } if (nulval) { strcpy(tmpnull, nulval); nulwidth = strlen(nulval); } else { strcpy(tmpnull, " "); nulwidth = 1; } /* write the formated string for each value */ for (ii = 0; ii < nelem; ii++) { if (tcode == TBIT) { byteval = (char) darray[ii]; for (ll=0; ll < 8; ll++) { if ( ((unsigned char) (byteval << ll)) >> 7 ) *(array[ii] + ll) = '1'; else *(array[ii] + ll) = '0'; } *(array[ii] + 8) = '\0'; } /* test for null value */ else if ( (nultyp == 1 && darray[ii] == DOUBLENULLVALUE) || (nultyp == 2 && nularray[ii]) ) { *array[ii] = '\0'; if (dwidth < nulwidth) strncat(array[ii], tmpnull, dwidth); else sprintf(array[ii],"%*s",dwidth,tmpnull); } else { if (intcol) sprintf(tmpstr, cform, (int) darray[ii]); else sprintf(tmpstr, cform, darray[ii]); /* fill field with '*' if number is too wide */ dlen = strlen(tmpstr); if (dlen > dwidth) { memset(tmpstr, '*', dwidth); } *array[ii] = '\0'; strncat(array[ii], tmpstr, dwidth); } } free(darray); /* free the memory */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffgcdw( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column (1 = 1st col) */ int *width, /* O - display width */ int *status) /* IO - error status */ /* Get Column Display Width. */ { tcolumn *colptr; char *cptr; char message[FLEN_ERRMSG], keyname[FLEN_KEYWORD], dispfmt[20]; int tcode, hdutype, tstatus, scaled; double tscale; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d", colnum); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = abs(colptr->tdatatype); /* use the TDISPn keyword if it exists */ ffkeyn("TDISP", colnum, keyname, status); *width = 0; tstatus = 0; if (ffgkys(fptr, keyname, dispfmt, NULL, &tstatus) == 0) { /* parse TDISPn get the display width */ cptr = dispfmt; while(*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == 'A' || *cptr == 'a' || *cptr == 'I' || *cptr == 'i' || *cptr == 'O' || *cptr == 'o' || *cptr == 'Z' || *cptr == 'z' || *cptr == 'F' || *cptr == 'f' || *cptr == 'E' || *cptr == 'e' || *cptr == 'D' || *cptr == 'd' || *cptr == 'G' || *cptr == 'g') { while(!isdigit((int) *cptr) && *cptr != '\0') /* find 1st digit */ cptr++; *width = atoi(cptr); if (tcode >= TCOMPLEX) *width = (2 * (*width)) + 3; } } if (*width == 0) { /* no valid TDISPn keyword; use TFORMn instead */ ffkeyn("TFORM", colnum, keyname, status); ffgkys(fptr, keyname, dispfmt, NULL, status); /* check if column is scaled */ ffkeyn("TSCAL", colnum, keyname, status); tstatus = 0; scaled = 0; if (ffgkyd(fptr, keyname, &tscale, NULL, &tstatus) == 0) { if (tscale != 1.0) scaled = 1; /* yes, this is a scaled column */ } if (scaled && tcode <= TSHORT) { /* scaled short integer col == float; default format is 14.6G */ *width = 14; } else if (scaled && tcode == TLONG) { /* scaled long integer col == double; default format is 23.15G */ *width = 23; } else { ffghdt(fptr, &hdutype, status); /* get type of table */ if (hdutype == ASCII_TBL) { /* parse TFORMn get the display width */ cptr = dispfmt; while(!isdigit((int) *cptr) && *cptr != '\0') /* find 1st digit */ cptr++; *width = atoi(cptr); } else { /* this is a binary table */ if (tcode == TBIT) /* 'X' */ *width = 8; else if (tcode == TBYTE) /* 'B' */ *width = 4; else if (tcode == TSHORT) /* 'I' */ *width = 6; else if (tcode == TLONG) /* 'J' */ *width = 11; else if (tcode == TLONGLONG) /* 'K' */ *width = 20; else if (tcode == TFLOAT) /* 'E' */ *width = 14; else if (tcode == TDOUBLE) /* 'D' */ *width = 23; else if (tcode == TCOMPLEX) /* 'C' */ *width = 31; else if (tcode == TDBLCOMPLEX) /* 'M' */ *width = 49; else if (tcode == TLOGICAL) /* 'L' */ *width = 1; else if (tcode == TSTRING) /* 'A' */ { cptr = dispfmt; while(!isdigit((int) *cptr) && *cptr != '\0') cptr++; *width = atoi(cptr); if (*width < 1) *width = 1; /* default is at least 1 column */ } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgcls2 ( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of strings to read */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ char *nulval, /* I - value for null pixels if nultyp = 1 */ char **array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of string values from a column in the current FITS HDU. */ { double dtemp; long nullen; int tcode, maxelem, hdutype, nulcheck; long twidth, incre; long ii, jj, ntodo; LONGLONG repeat, startpos, elemnum, readptr, tnull, rowlen, rownum, remain, next; double scale, zero; char tform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ tcolumn *colptr; double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ char *buffer, *arrayptr; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (colnum < 1 || colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d", colnum); ffpmsg(message); return(*status = BAD_COL_NUM); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode == -TSTRING) /* variable length column in a binary table? */ { /* only read a single string; ignore value of firstelem */ if (ffgcprll( fptr, colnum, firstrow, 1, 1, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); remain = 1; twidth = (long) repeat; } else if (tcode == TSTRING) { if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); /* if string length is greater than a FITS block (2880 char) then must */ /* only read 1 string at a time, to force reading by ffgbyt instead of */ /* ffgbytoff (ffgbytoff can't handle this case) */ if (twidth > IOBUFLEN) { maxelem = 1; incre = twidth; repeat = 1; } remain = nelem; } else return(*status = NOT_ASCII_COL); nullen = strlen(snull); /* length of the undefined pixel string */ if (nullen == 0) nullen = 1; /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (nultyp == 1 && nulval && nulval[0] == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /* null value string in ASCII table not defined */ else if (nullen > twidth) nulcheck = 0; /* null value string is longer than width of column */ /* thus impossible for any column elements to = null */ /*---------------------------------------------------------------------*/ /* Now read the strings one at a time from the FITS column. */ /*---------------------------------------------------------------------*/ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process at one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, readptr, REPORT_EOF, status); /* move to read position */ /* read the array of strings from the FITS file into the buffer */ if (incre == twidth) ffgbyt(fptr, ntodo * twidth, cbuff, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, cbuff, status); /* copy from the buffer into the user's array of strings */ /* work backwards from last char of last string to 1st char of 1st */ buffer = ((char *) cbuff) + (ntodo * twidth) - 1; for (ii = (long) (next + ntodo - 1); ii >= next; ii--) { arrayptr = array[ii] + twidth - 1; for (jj = twidth - 1; jj > 0; jj--) /* ignore trailing blanks */ { if (*buffer == ' ') { buffer--; arrayptr--; } else break; } *(arrayptr + 1) = 0; /* write the string terminator */ for (; jj >= 0; jj--) /* copy the string itself */ { *arrayptr = *buffer; buffer--; arrayptr--; } /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (nulcheck && !strncmp(snull, array[ii], nullen) ) { *anynul = 1; /* this is a null value */ if (nultyp == 1) { if (nulval) strcpy(array[ii], nulval); else strcpy(array[ii], " "); } else nularray[ii] = 1; } } if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; sprintf(message, "Error reading elements %.0f thru %.0f of data array (ffpcls).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ next += ntodo; remain -= ntodo; if (remain) { elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ return(*status); } astropy-0.3/cextern/cfitsio/eval_defs.h0000644000175000017500000001023612243255342016412 0ustar oleole#include #include #include #include #if defined(__sgi) || defined(__hpux) #include #endif #ifdef sparc #include #endif #include "fitsio2.h" #define MAXDIMS 5 #define MAXSUBS 10 #define MAXVARNAME 80 #define CONST_OP -1000 #define pERROR -1 #define MAX_STRLEN 256 #define MAX_STRLEN_S "255" #ifndef FFBISON #include "eval_tab.h" #endif typedef struct { char name[MAXVARNAME+1]; int type; long nelem; int naxis; long naxes[MAXDIMS]; char *undef; void *data; } DataInfo; typedef struct { long nelem; int naxis; long naxes[MAXDIMS]; char *undef; union { double dbl; long lng; char log; char str[MAX_STRLEN]; double *dblptr; long *lngptr; char *logptr; char **strptr; void *ptr; } data; } lval; typedef struct Node { int operation; void (*DoOp)(struct Node *this); int nSubNodes; int SubNodes[MAXSUBS]; int type; lval value; } Node; typedef struct { fitsfile *def_fptr; int (*getData)( char *dataName, void *dataValue ); int (*loadData)( int varNum, long fRow, long nRows, void *data, char *undef ); int compressed; int timeCol; int parCol; int valCol; char *expr; int index; int is_eobuf; Node *Nodes; int nNodes; int nNodesAlloc; int resultNode; long firstRow; long nRows; int nCols; iteratorCol *colData; DataInfo *varData; PixelFilter *pixFilter; long firstDataRow; long nDataRows; long totalRows; int datatype; int hdutype; int status; } ParseData; typedef enum { rnd_fct = 1001, sum_fct, nelem_fct, sin_fct, cos_fct, tan_fct, asin_fct, acos_fct, atan_fct, sinh_fct, cosh_fct, tanh_fct, exp_fct, log_fct, log10_fct, sqrt_fct, abs_fct, atan2_fct, ceil_fct, floor_fct, round_fct, min1_fct, min2_fct, max1_fct, max2_fct, near_fct, circle_fct, box_fct, elps_fct, isnull_fct, defnull_fct, gtifilt_fct, regfilt_fct, ifthenelse_fct, row_fct, null_fct, median_fct, average_fct, stddev_fct, nonnull_fct, angsep_fct, gasrnd_fct, poirnd_fct, strmid_fct, strpos_fct } funcOp; extern ParseData gParse; #ifdef __cplusplus extern "C" { #endif int ffparse(void); int fflex(void); void ffrestart(FILE*); void Evaluate_Parser( long firstRow, long nRows ); #ifdef __cplusplus } #endif astropy-0.3/cextern/cfitsio/wcssub.c0000644000175000017500000010470412243255342015767 0ustar oleole#include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int fits_read_wcstab( fitsfile *fptr, /* I - FITS file pointer */ int nwtb, /* Number of arrays to be read from the binary table(s) */ wtbarr *wtb, /* Address of the first element of an array of wtbarr typedefs. This wtbarr typedef is defined below to match the wtbarr struct defined in WCSLIB. An array of such structs returned by the WCSLIB function wcstab(). */ int *status) /* * Author: Mark Calabretta, Australia Telescope National Facility * http://www.atnf.csiro.au/~mcalabre/index.html * * fits_read_wcstab() extracts arrays from a binary table required in * constructing -TAB coordinates. This helper routine is intended for * use by routines in the WCSLIB library when dealing with the -TAB table * look up WCS convention. */ { int anynul, colnum, hdunum, iwtb, m, naxis, nostat; long *naxes = 0, nelem; wtbarr *wtbp; if (*status) return *status; if (fptr == 0) { return (*status = NULL_INPUT_PTR); } if (nwtb == 0) return 0; /* Zero the array pointers. */ wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { *wtbp->arrayp = 0x0; } /* Save HDU number so that we can move back to it later. */ fits_get_hdu_num(fptr, &hdunum); wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { /* Move to the required binary table extension. */ if (fits_movnam_hdu(fptr, BINARY_TBL, (char *)(wtbp->extnam), wtbp->extver, status)) { goto cleanup; } /* Locate the table column. */ if (fits_get_colnum(fptr, CASEINSEN, (char *)(wtbp->ttype), &colnum, status)) { goto cleanup; } /* Get the array dimensions and check for consistency. */ if (wtbp->ndim < 1) { *status = NEG_AXIS; goto cleanup; } if (!(naxes = calloc(wtbp->ndim, sizeof(long)))) { *status = MEMORY_ALLOCATION; goto cleanup; } if (fits_read_tdim(fptr, colnum, wtbp->ndim, &naxis, naxes, status)) { goto cleanup; } if (naxis != wtbp->ndim) { if (wtbp->kind == 'c' && wtbp->ndim == 2) { /* Allow TDIMn to be omitted for degenerate coordinate arrays. */ naxis = 2; naxes[1] = naxes[0]; naxes[0] = 1; } else { *status = BAD_TDIM; goto cleanup; } } if (wtbp->kind == 'c') { /* Coordinate array; calculate the array size. */ nelem = naxes[0]; for (m = 0; m < naxis-1; m++) { *(wtbp->dimlen + m) = naxes[m+1]; nelem *= naxes[m+1]; } } else { /* Index vector; check length. */ if ((nelem = naxes[0]) != *(wtbp->dimlen)) { /* N.B. coordinate array precedes the index vectors. */ *status = BAD_TDIM; goto cleanup; } } free(naxes); naxes = 0; /* Allocate memory for the array. */ if (!(*wtbp->arrayp = calloc((size_t)nelem, sizeof(double)))) { *status = MEMORY_ALLOCATION; goto cleanup; } /* Read the array from the table. */ if (fits_read_col_dbl(fptr, colnum, wtbp->row, 1L, nelem, 0.0, *wtbp->arrayp, &anynul, status)) { goto cleanup; } } cleanup: /* Move back to the starting HDU. */ nostat = 0; fits_movabs_hdu(fptr, hdunum, 0, &nostat); /* Release allocated memory. */ if (naxes) free(naxes); if (*status) { wtbp = wtb; for (iwtb = 0; iwtb < nwtb; iwtb++, wtbp++) { if (*wtbp->arrayp) free(*wtbp->arrayp); } } return *status; } /*--------------------------------------------------------------------------*/ int ffgiwcs(fitsfile *fptr, /* I - FITS file pointer */ char **header, /* O - pointer to the WCS related keywords */ int *status) /* IO - error status */ /* int fits_get_image_wcs_keys return a string containing all the image WCS header keywords. This string is then used as input to the wcsinit WCSlib routine. THIS ROUTINE IS DEPRECATED. USE fits_hdr2str INSTEAD */ { int hdutype; if (*status > 0) return(*status); fits_get_hdu_type(fptr, &hdutype, status); if (hdutype != IMAGE_HDU) { ffpmsg( "Error in ffgiwcs. This HDU is not an image. Can't read WCS keywords"); return(*status = NOT_IMAGE); } /* read header keywords into a long string of chars */ if (ffh2st(fptr, header, status) > 0) { ffpmsg("error creating string of image WCS keywords (ffgiwcs)"); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgics(fitsfile *fptr, /* I - FITS file pointer */ double *xrval, /* O - X reference value */ double *yrval, /* O - Y reference value */ double *xrpix, /* O - X reference pixel */ double *yrpix, /* O - Y reference pixel */ double *xinc, /* O - X increment per pixel */ double *yinc, /* O - Y increment per pixel */ double *rot, /* O - rotation angle (degrees) */ char *type, /* O - type of projection ('-tan') */ int *status) /* IO - error status */ /* read the values of the celestial coordinate system keywords. These values may be used as input to the subroutines that calculate celestial coordinates. (ffxypx, ffwldp) Modified in Nov 1999 to convert the CD matrix keywords back to the old CDELTn form, and to swap the axes if the dec-like axis is given first, and to assume default values if any of the keywords are not present. */ { int tstat = 0, cd_exists = 0, pc_exists = 0; char ctype[FLEN_VALUE]; double cd11 = 0.0, cd21 = 0.0, cd22 = 0.0, cd12 = 0.0; double pc11 = 1.0, pc21 = 0.0, pc22 = 1.0, pc12 = 0.0; double pi = 3.1415926535897932; double phia, phib, temp; double toler = .0002; /* tolerance for angles to agree (radians) */ /* (= approximately 0.01 degrees) */ if (*status > 0) return(*status); tstat = 0; if (ffgkyd(fptr, "CRVAL1", xrval, NULL, &tstat)) *xrval = 0.; tstat = 0; if (ffgkyd(fptr, "CRVAL2", yrval, NULL, &tstat)) *yrval = 0.; tstat = 0; if (ffgkyd(fptr, "CRPIX1", xrpix, NULL, &tstat)) *xrpix = 0.; tstat = 0; if (ffgkyd(fptr, "CRPIX2", yrpix, NULL, &tstat)) *yrpix = 0.; /* look for CDELTn first, then CDi_j keywords */ tstat = 0; if (ffgkyd(fptr, "CDELT1", xinc, NULL, &tstat)) { /* CASE 1: no CDELTn keyword, so look for the CD matrix */ tstat = 0; if (ffgkyd(fptr, "CD1_1", &cd11, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ if (ffgkyd(fptr, "CD2_1", &cd21, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ if (ffgkyd(fptr, "CD1_2", &cd12, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ if (ffgkyd(fptr, "CD2_2", &cd22, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ if (cd_exists) /* convert CDi_j back to CDELTn */ { /* there are 2 ways to compute the angle: */ phia = atan2( cd21, cd11); phib = atan2(-cd12, cd22); /* ensure that phia <= phib */ temp = minvalue(phia, phib); phib = maxvalue(phia, phib); phia = temp; /* there is a possible 180 degree ambiguity in the angles */ /* so add 180 degress to the smaller value if the values */ /* differ by more than 90 degrees = pi/2 radians. */ /* (Later, we may decide to take the other solution by */ /* subtracting 180 degrees from the larger value). */ if ((phib - phia) > (pi / 2.)) phia += pi; if (fabs(phia - phib) > toler) { /* angles don't agree, so looks like there is some skewness */ /* between the axes. Return with an error to be safe. */ *status = APPROX_WCS_KEY; } phia = (phia + phib) /2.; /* use the average of the 2 values */ *xinc = cd11 / cos(phia); *yinc = cd22 / cos(phia); *rot = phia * 180. / pi; /* common usage is to have a positive yinc value. If it is */ /* negative, then subtract 180 degrees from rot and negate */ /* both xinc and yinc. */ if (*yinc < 0) { *xinc = -(*xinc); *yinc = -(*yinc); *rot = *rot - 180.; } } else /* no CD matrix keywords either */ { *xinc = 1.; /* there was no CDELT1 keyword, but check for CDELT2 just in case */ tstat = 0; if (ffgkyd(fptr, "CDELT2", yinc, NULL, &tstat)) *yinc = 1.; tstat = 0; if (ffgkyd(fptr, "CROTA2", rot, NULL, &tstat)) *rot=0.; } } else /* Case 2: CDELTn + optional PC matrix */ { if (ffgkyd(fptr, "CDELT2", yinc, NULL, &tstat)) *yinc = 1.; tstat = 0; if (ffgkyd(fptr, "CROTA2", rot, NULL, &tstat)) { *rot=0.; /* no CROTA2 keyword, so look for the PC matrix */ tstat = 0; if (ffgkyd(fptr, "PC1_1", &pc11, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ if (ffgkyd(fptr, "PC2_1", &pc21, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ if (ffgkyd(fptr, "PC1_2", &pc12, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ if (ffgkyd(fptr, "PC2_2", &pc22, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ if (pc_exists) /* convert PCi_j back to CDELTn */ { /* there are 2 ways to compute the angle: */ phia = atan2( pc21, pc11); phib = atan2(-pc12, pc22); /* ensure that phia <= phib */ temp = minvalue(phia, phib); phib = maxvalue(phia, phib); phia = temp; /* there is a possible 180 degree ambiguity in the angles */ /* so add 180 degress to the smaller value if the values */ /* differ by more than 90 degrees = pi/2 radians. */ /* (Later, we may decide to take the other solution by */ /* subtracting 180 degrees from the larger value). */ if ((phib - phia) > (pi / 2.)) phia += pi; if (fabs(phia - phib) > toler) { /* angles don't agree, so looks like there is some skewness */ /* between the axes. Return with an error to be safe. */ *status = APPROX_WCS_KEY; } phia = (phia + phib) /2.; /* use the average of the 2 values */ *rot = phia * 180. / pi; } } } /* get the type of projection, if any */ tstat = 0; if (ffgkys(fptr, "CTYPE1", ctype, NULL, &tstat)) type[0] = '\0'; else { /* copy the projection type string */ strncpy(type, &ctype[4], 4); type[4] = '\0'; /* check if RA and DEC are inverted */ if (!strncmp(ctype, "DEC-", 4) || !strncmp(ctype+1, "LAT", 3)) { /* the latitudinal axis is given first, so swap them */ /* this case was removed on 12/9. Apparently not correct. if ((*xinc / *yinc) < 0. ) *rot = -90. - (*rot); else */ *rot = 90. - (*rot); /* Empirical tests with ds9 show the y-axis sign must be negated */ /* and the xinc and yinc values must NOT be swapped. */ *yinc = -(*yinc); temp = *xrval; *xrval = *yrval; *yrval = temp; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgicsa(fitsfile *fptr, /* I - FITS file pointer */ char version, /* I - character code of desired version *(/ /* A - Z or blank */ double *xrval, /* O - X reference value */ double *yrval, /* O - Y reference value */ double *xrpix, /* O - X reference pixel */ double *yrpix, /* O - Y reference pixel */ double *xinc, /* O - X increment per pixel */ double *yinc, /* O - Y increment per pixel */ double *rot, /* O - rotation angle (degrees) */ char *type, /* O - type of projection ('-tan') */ int *status) /* IO - error status */ /* read the values of the celestial coordinate system keywords. These values may be used as input to the subroutines that calculate celestial coordinates. (ffxypx, ffwldp) Modified in Nov 1999 to convert the CD matrix keywords back to the old CDELTn form, and to swap the axes if the dec-like axis is given first, and to assume default values if any of the keywords are not present. */ { int tstat = 0, cd_exists = 0, pc_exists = 0; char ctype[FLEN_VALUE], keyname[FLEN_VALUE], alt[2]; double cd11 = 0.0, cd21 = 0.0, cd22 = 0.0, cd12 = 0.0; double pc11 = 1.0, pc21 = 0.0, pc22 = 1.0, pc12 = 0.0; double pi = 3.1415926535897932; double phia, phib, temp; double toler = .0002; /* tolerance for angles to agree (radians) */ /* (= approximately 0.01 degrees) */ if (*status > 0) return(*status); if (version == ' ') { ffgics(fptr, xrval, yrval, xrpix, yrpix, xinc, yinc, rot, type, status); return (*status); } if (version > 'Z' || version < 'A') { ffpmsg("ffgicsa: illegal WCS version code (must be A - Z or blank)"); return(*status = WCS_ERROR); } alt[0] = version; alt[1] = '\0'; tstat = 0; strcpy(keyname, "CRVAL1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, xrval, NULL, &tstat)) *xrval = 0.; tstat = 0; strcpy(keyname, "CRVAL2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, yrval, NULL, &tstat)) *yrval = 0.; tstat = 0; strcpy(keyname, "CRPIX1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, xrpix, NULL, &tstat)) *xrpix = 0.; tstat = 0; strcpy(keyname, "CRPIX2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, yrpix, NULL, &tstat)) *yrpix = 0.; /* look for CDELTn first, then CDi_j keywords */ tstat = 0; strcpy(keyname, "CDELT1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, xinc, NULL, &tstat)) { /* CASE 1: no CDELTn keyword, so look for the CD matrix */ tstat = 0; strcpy(keyname, "CD1_1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &cd11, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ strcpy(keyname, "CD2_1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &cd21, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ strcpy(keyname, "CD1_2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &cd12, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ strcpy(keyname, "CD2_2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &cd22, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else cd_exists = 1; /* found at least 1 CD_ keyword */ if (cd_exists) /* convert CDi_j back to CDELTn */ { /* there are 2 ways to compute the angle: */ phia = atan2( cd21, cd11); phib = atan2(-cd12, cd22); /* ensure that phia <= phib */ temp = minvalue(phia, phib); phib = maxvalue(phia, phib); phia = temp; /* there is a possible 180 degree ambiguity in the angles */ /* so add 180 degress to the smaller value if the values */ /* differ by more than 90 degrees = pi/2 radians. */ /* (Later, we may decide to take the other solution by */ /* subtracting 180 degrees from the larger value). */ if ((phib - phia) > (pi / 2.)) phia += pi; if (fabs(phia - phib) > toler) { /* angles don't agree, so looks like there is some skewness */ /* between the axes. Return with an error to be safe. */ *status = APPROX_WCS_KEY; } phia = (phia + phib) /2.; /* use the average of the 2 values */ *xinc = cd11 / cos(phia); *yinc = cd22 / cos(phia); *rot = phia * 180. / pi; /* common usage is to have a positive yinc value. If it is */ /* negative, then subtract 180 degrees from rot and negate */ /* both xinc and yinc. */ if (*yinc < 0) { *xinc = -(*xinc); *yinc = -(*yinc); *rot = *rot - 180.; } } else /* no CD matrix keywords either */ { *xinc = 1.; /* there was no CDELT1 keyword, but check for CDELT2 just in case */ tstat = 0; strcpy(keyname, "CDELT2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, yinc, NULL, &tstat)) *yinc = 1.; tstat = 0; strcpy(keyname, "CROTA2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, rot, NULL, &tstat)) *rot=0.; } } else /* Case 2: CDELTn + optional PC matrix */ { strcpy(keyname, "CDELT2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, yinc, NULL, &tstat)) *yinc = 1.; tstat = 0; strcpy(keyname, "CROTA2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, rot, NULL, &tstat)) { *rot=0.; /* no CROTA2 keyword, so look for the PC matrix */ tstat = 0; strcpy(keyname, "PC1_1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &pc11, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ strcpy(keyname, "PC2_1"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &pc21, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ strcpy(keyname, "PC1_2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &pc12, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ strcpy(keyname, "PC2_2"); strcat(keyname, alt); if (ffgkyd(fptr, keyname, &pc22, NULL, &tstat)) tstat = 0; /* reset keyword not found error */ else pc_exists = 1; /* found at least 1 PC_ keyword */ if (pc_exists) /* convert PCi_j back to CDELTn */ { /* there are 2 ways to compute the angle: */ phia = atan2( pc21, pc11); phib = atan2(-pc12, pc22); /* ensure that phia <= phib */ temp = minvalue(phia, phib); phib = maxvalue(phia, phib); phia = temp; /* there is a possible 180 degree ambiguity in the angles */ /* so add 180 degress to the smaller value if the values */ /* differ by more than 90 degrees = pi/2 radians. */ /* (Later, we may decide to take the other solution by */ /* subtracting 180 degrees from the larger value). */ if ((phib - phia) > (pi / 2.)) phia += pi; if (fabs(phia - phib) > toler) { /* angles don't agree, so looks like there is some skewness */ /* between the axes. Return with an error to be safe. */ *status = APPROX_WCS_KEY; } phia = (phia + phib) /2.; /* use the average of the 2 values */ *rot = phia * 180. / pi; } } } /* get the type of projection, if any */ tstat = 0; strcpy(keyname, "CTYPE1"); strcat(keyname, alt); if (ffgkys(fptr, keyname, ctype, NULL, &tstat)) type[0] = '\0'; else { /* copy the projection type string */ strncpy(type, &ctype[4], 4); type[4] = '\0'; /* check if RA and DEC are inverted */ if (!strncmp(ctype, "DEC-", 4) || !strncmp(ctype+1, "LAT", 3)) { /* the latitudinal axis is given first, so swap them */ *rot = 90. - (*rot); /* Empirical tests with ds9 show the y-axis sign must be negated */ /* and the xinc and yinc values must NOT be swapped. */ *yinc = -(*yinc); temp = *xrval; *xrval = *yrval; *yrval = temp; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgtcs(fitsfile *fptr, /* I - FITS file pointer */ int xcol, /* I - column containing the RA coordinate */ int ycol, /* I - column containing the DEC coordinate */ double *xrval, /* O - X reference value */ double *yrval, /* O - Y reference value */ double *xrpix, /* O - X reference pixel */ double *yrpix, /* O - Y reference pixel */ double *xinc, /* O - X increment per pixel */ double *yinc, /* O - Y increment per pixel */ double *rot, /* O - rotation angle (degrees) */ char *type, /* O - type of projection ('-sin') */ int *status) /* IO - error status */ /* read the values of the celestial coordinate system keywords from a FITS table where the X and Y or RA and DEC coordinates are stored in separate column. Do this by converting the table to a temporary FITS image, then reading the keywords from the image file. These values may be used as input to the subroutines that calculate celestial coordinates. (ffxypx, ffwldp) */ { int colnum[2]; long naxes[2]; fitsfile *tptr; if (*status > 0) return(*status); colnum[0] = xcol; colnum[1] = ycol; naxes[0] = 10; naxes[1] = 10; /* create temporary FITS file, in memory */ ffinit(&tptr, "mem://", status); /* create a temporary image; the datatype and size are not important */ ffcrim(tptr, 32, 2, naxes, status); /* now copy the relevant keywords from the table to the image */ fits_copy_pixlist2image(fptr, tptr, 9, 2, colnum, status); /* write default WCS keywords, if they are not present */ fits_write_keys_histo(fptr, tptr, 2, colnum, status); if (*status > 0) return(*status); /* read the WCS keyword values from the temporary image */ ffgics(tptr, xrval, yrval, xrpix, yrpix, xinc, yinc, rot, type, status); if (*status > 0) { ffpmsg ("ffgtcs could not find all the celestial coordinate keywords"); return(*status = NO_WCS_KEY); } /* delete the temporary file */ fits_delete_file(tptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgtwcs(fitsfile *fptr, /* I - FITS file pointer */ int xcol, /* I - column number for the X column */ int ycol, /* I - column number for the Y column */ char **header, /* O - string of all the WCS keywords */ int *status) /* IO - error status */ /* int fits_get_table_wcs_keys Return string containing all the WCS keywords appropriate for the pair of X and Y columns containing the coordinate of each event in an event list table. This string may then be passed to Doug Mink's WCS library wcsinit routine, to create and initialize the WCS structure. The calling routine must free the header character string when it is no longer needed. THIS ROUTINE IS DEPRECATED. USE fits_hdr2str INSTEAD */ { int hdutype, ncols, tstatus, length; int naxis1 = 1, naxis2 = 1; long tlmin, tlmax; char keyname[FLEN_KEYWORD]; char valstring[FLEN_VALUE]; char comm[2]; char *cptr; /* construct a string of 80 blanks, for adding fill to the keywords */ /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 */ char blanks[] = " "; if (*status > 0) return(*status); fits_get_hdu_type(fptr, &hdutype, status); if (hdutype == IMAGE_HDU) { ffpmsg("Can't read table WSC keywords. This HDU is not a table"); return(*status = NOT_TABLE); } fits_get_num_cols(fptr, &ncols, status); if (xcol < 1 || xcol > ncols) { ffpmsg("illegal X axis column number in fftwcs"); return(*status = BAD_COL_NUM); } if (ycol < 1 || ycol > ncols) { ffpmsg("illegal Y axis column number in fftwcs"); return(*status = BAD_COL_NUM); } /* allocate character string for all the WCS keywords */ *header = calloc(1, 2401); /* room for up to 30 keywords */ if (*header == 0) { ffpmsg("error allocating memory for WCS header keywords (fftwcs)"); return(*status = MEMORY_ALLOCATION); } cptr = *header; comm[0] = '\0'; tstatus = 0; ffkeyn("TLMIN",xcol,keyname,status); ffgkyj(fptr,keyname, &tlmin,NULL,&tstatus); if (!tstatus) { ffkeyn("TLMAX",xcol,keyname,status); ffgkyj(fptr,keyname, &tlmax,NULL,&tstatus); } if (!tstatus) { naxis1 = tlmax - tlmin + 1; } tstatus = 0; ffkeyn("TLMIN",ycol,keyname,status); ffgkyj(fptr,keyname, &tlmin,NULL,&tstatus); if (!tstatus) { ffkeyn("TLMAX",ycol,keyname,status); ffgkyj(fptr,keyname, &tlmax,NULL,&tstatus); } if (!tstatus) { naxis2 = tlmax - tlmin + 1; } /* 123456789012345678901234567890 */ strcat(cptr, "NAXIS = 2"); strncat(cptr, blanks, 50); cptr += 80; ffi2c(naxis1, valstring, status); /* convert to formatted string */ ffmkky("NAXIS1", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; strcpy(keyname, "NAXIS2"); ffi2c(naxis2, valstring, status); /* convert to formatted string */ ffmkky(keyname, valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* read the required header keywords (use defaults if not found) */ /* CTYPE1 keyword */ tstatus = 0; ffkeyn("TCTYP",xcol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) valstring[0] = '\0'; ffmkky("CTYPE1", valstring, comm, cptr, status); /* construct the keyword*/ length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; /* CTYPE2 keyword */ tstatus = 0; ffkeyn("TCTYP",ycol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) valstring[0] = '\0'; ffmkky("CTYPE2", valstring, comm, cptr, status); /* construct the keyword*/ length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; /* CRPIX1 keyword */ tstatus = 0; ffkeyn("TCRPX",xcol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CRPIX1", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* CRPIX2 keyword */ tstatus = 0; ffkeyn("TCRPX",ycol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CRPIX2", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* CRVAL1 keyword */ tstatus = 0; ffkeyn("TCRVL",xcol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CRVAL1", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* CRVAL2 keyword */ tstatus = 0; ffkeyn("TCRVL",ycol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CRVAL2", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* CDELT1 keyword */ tstatus = 0; ffkeyn("TCDLT",xcol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CDELT1", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* CDELT2 keyword */ tstatus = 0; ffkeyn("TCDLT",ycol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) ) strcpy(valstring, "1"); ffmkky("CDELT2", valstring, comm, cptr, status); /* construct the keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; /* the following keywords may not exist */ /* CROTA2 keyword */ tstatus = 0; ffkeyn("TCROT",ycol,keyname,status); if (ffgkey(fptr, keyname, valstring, NULL, &tstatus) == 0 ) { ffmkky("CROTA2", valstring, comm, cptr, status); /* construct keyword*/ strncat(cptr, blanks, 50); /* pad with blanks */ cptr += 80; } /* EPOCH keyword */ tstatus = 0; if (ffgkey(fptr, "EPOCH", valstring, NULL, &tstatus) == 0 ) { ffmkky("EPOCH", valstring, comm, cptr, status); /* construct keyword*/ length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* EQUINOX keyword */ tstatus = 0; if (ffgkey(fptr, "EQUINOX", valstring, NULL, &tstatus) == 0 ) { ffmkky("EQUINOX", valstring, comm, cptr, status); /* construct keyword*/ length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* RADECSYS keyword */ tstatus = 0; if (ffgkey(fptr, "RADECSYS", valstring, NULL, &tstatus) == 0 ) { ffmkky("RADECSYS", valstring, comm, cptr, status); /*construct keyword*/ length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* TELESCOPE keyword */ tstatus = 0; if (ffgkey(fptr, "TELESCOP", valstring, NULL, &tstatus) == 0 ) { ffmkky("TELESCOP", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* INSTRUME keyword */ tstatus = 0; if (ffgkey(fptr, "INSTRUME", valstring, NULL, &tstatus) == 0 ) { ffmkky("INSTRUME", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* DETECTOR keyword */ tstatus = 0; if (ffgkey(fptr, "DETECTOR", valstring, NULL, &tstatus) == 0 ) { ffmkky("DETECTOR", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* MJD-OBS keyword */ tstatus = 0; if (ffgkey(fptr, "MJD-OBS", valstring, NULL, &tstatus) == 0 ) { ffmkky("MJD-OBS", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* DATE-OBS keyword */ tstatus = 0; if (ffgkey(fptr, "DATE-OBS", valstring, NULL, &tstatus) == 0 ) { ffmkky("DATE-OBS", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } /* DATE keyword */ tstatus = 0; if (ffgkey(fptr, "DATE", valstring, NULL, &tstatus) == 0 ) { ffmkky("DATE", valstring, comm, cptr, status); length = strlen(cptr); strncat(cptr, blanks, 80 - length); /* pad with blanks */ cptr += 80; } strcat(cptr, "END"); strncat(cptr, blanks, 77); return(*status); } astropy-0.3/cextern/cfitsio/eval_y.c0000644000175000017500000073314712243255342015751 0ustar oleole /* A Bison parser, made from eval.y by GNU Bison version 1.25 */ #define FFBISON 1 /* Identify Bison output. */ #define BOOLEAN 258 #define LONG 259 #define DOUBLE 260 #define STRING 261 #define BITSTR 262 #define FUNCTION 263 #define BFUNCTION 264 #define IFUNCTION 265 #define GTIFILTER 266 #define REGFILTER 267 #define COLUMN 268 #define BCOLUMN 269 #define SCOLUMN 270 #define BITCOL 271 #define ROWREF 272 #define NULLREF 273 #define SNULLREF 274 #define OR 275 #define AND 276 #define EQ 277 #define NE 278 #define GT 279 #define LT 280 #define LTE 281 #define GTE 282 #define POWER 283 #define NOT 284 #define INTCAST 285 #define FLTCAST 286 #define UMINUS 287 #define ACCUM 288 #define DIFF 289 #line 1 "eval.y" /************************************************************************/ /* */ /* CFITSIO Lexical Parser */ /* */ /* This file is one of 3 files containing code which parses an */ /* arithmetic expression and evaluates it in the context of an input */ /* FITS file table extension. The CFITSIO lexical parser is divided */ /* into the following 3 parts/files: the CFITSIO "front-end", */ /* eval_f.c, contains the interface between the user/CFITSIO and the */ /* real core of the parser; the FLEX interpreter, eval_l.c, takes the */ /* input string and parses it into tokens and identifies the FITS */ /* information required to evaluate the expression (ie, keywords and */ /* columns); and, the BISON grammar and evaluation routines, eval_y.c, */ /* receives the FLEX output and determines and performs the actual */ /* operations. The files eval_l.c and eval_y.c are produced from */ /* running flex and bison on the files eval.l and eval.y, respectively. */ /* (flex and bison are available from any GNU archive: see www.gnu.org) */ /* */ /* The grammar rules, rather than evaluating the expression in situ, */ /* builds a tree, or Nodal, structure mapping out the order of */ /* operations and expression dependencies. This "compilation" process */ /* allows for much faster processing of multiple rows. This technique */ /* was developed by Uwe Lammers of the XMM Science Analysis System, */ /* although the CFITSIO implementation is entirely code original. */ /* */ /* */ /* Modification History: */ /* */ /* Kent Blackburn c1992 Original parser code developed for the */ /* FTOOLS software package, in particular, */ /* the fselect task. */ /* Kent Blackburn c1995 BIT column support added */ /* Peter D Wilson Feb 1998 Vector column support added */ /* Peter D Wilson May 1998 Ported to CFITSIO library. User */ /* interface routines written, in essence */ /* making fselect, fcalc, and maketime */ /* capabilities available to all tools */ /* via single function calls. */ /* Peter D Wilson Jun 1998 Major rewrite of parser core, so as to */ /* create a run-time evaluation tree, */ /* inspired by the work of Uwe Lammers, */ /* resulting in a speed increase of */ /* 10-100 times. */ /* Peter D Wilson Jul 1998 gtifilter(a,b,c,d) function added */ /* Peter D Wilson Aug 1998 regfilter(a,b,c,d) function added */ /* Peter D Wilson Jul 1999 Make parser fitsfile-independent, */ /* allowing a purely vector-based usage */ /* Craig B Markwardt Jun 2004 Add MEDIAN() function */ /* Craig B Markwardt Jun 2004 Add SUM(), and MIN/MAX() for bit arrays */ /* Craig B Markwardt Jun 2004 Allow subscripting of nX bit arrays */ /* Craig B Markwardt Jun 2004 Implement statistical functions */ /* NVALID(), AVERAGE(), and STDDEV() */ /* for integer and floating point vectors */ /* Craig B Markwardt Jun 2004 Use NULL values for range errors instead*/ /* of throwing a parse error */ /* Craig B Markwardt Oct 2004 Add ACCUM() and SEQDIFF() functions */ /* Craig B Markwardt Feb 2005 Add ANGSEP() function */ /* Craig B Markwardt Aug 2005 CIRCLE, BOX, ELLIPSE, NEAR and REGFILTER*/ /* functions now accept vector arguments */ /* Craig B Markwardt Sum 2006 Add RANDOMN() and RANDOMP() functions */ /* Craig B Markwardt Mar 2007 Allow arguments to RANDOM and RANDOMN to*/ /* determine the output dimensions */ /* Craig B Markwardt Aug 2009 Add substring STRMID() and string search*/ /* STRSTR() functions; more overflow checks*/ /* */ /************************************************************************/ #define APPROX 1.0e-7 #include "eval_defs.h" #include "region.h" #include #include #ifndef alloca #define alloca malloc #endif /* Shrink the initial stack depth to keep local data <32K (mac limit) */ /* yacc will allocate more space if needed, though. */ #define FFINITDEPTH 100 /***************************************************************/ /* Replace Bison's BACKUP macro with one that fixes a bug -- */ /* must update state after popping the stack -- and allows */ /* popping multiple terms at one time. */ /***************************************************************/ #define FFNEWBACKUP(token, value) \ do \ if (ffchar == FFEMPTY ) \ { ffchar = (token); \ memcpy( &fflval, &(value), sizeof(value) ); \ ffchar1 = FFTRANSLATE (ffchar); \ while (fflen--) FFPOPSTACK; \ ffstate = *ffssp; \ goto ffbackup; \ } \ else \ { fferror ("syntax error: cannot back up"); FFERROR; } \ while (0) /***************************************************************/ /* Useful macros for accessing/testing Nodes */ /***************************************************************/ #define TEST(a) if( (a)<0 ) FFERROR #define SIZE(a) gParse.Nodes[ a ].value.nelem #define TYPE(a) gParse.Nodes[ a ].type #define OPER(a) gParse.Nodes[ a ].operation #define PROMOTE(a,b) if( TYPE(a) > TYPE(b) ) \ b = New_Unary( TYPE(a), 0, b ); \ else if( TYPE(a) < TYPE(b) ) \ a = New_Unary( TYPE(b), 0, a ); /***** Internal functions *****/ #ifdef __cplusplus extern "C" { #endif static int Alloc_Node ( void ); static void Free_Last_Node( void ); static void Evaluate_Node ( int thisNode ); static int New_Const ( int returnType, void *value, long len ); static int New_Column( int ColNum ); static int New_Offset( int ColNum, int offset ); static int New_Unary ( int returnType, int Op, int Node1 ); static int New_BinOp ( int returnType, int Node1, int Op, int Node2 ); static int New_Func ( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7 ); static int New_FuncSize( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7, int Size); static int New_Deref ( int Var, int nDim, int Dim1, int Dim2, int Dim3, int Dim4, int Dim5 ); static int New_GTI ( char *fname, int Node1, char *start, char *stop ); static int New_REG ( char *fname, int NodeX, int NodeY, char *colNames ); static int New_Vector( int subNode ); static int Close_Vec ( int vecNode ); static int Locate_Col( Node *this ); static int Test_Dims ( int Node1, int Node2 ); static void Copy_Dims ( int Node1, int Node2 ); static void Allocate_Ptrs( Node *this ); static void Do_Unary ( Node *this ); static void Do_Offset ( Node *this ); static void Do_BinOp_bit ( Node *this ); static void Do_BinOp_str ( Node *this ); static void Do_BinOp_log ( Node *this ); static void Do_BinOp_lng ( Node *this ); static void Do_BinOp_dbl ( Node *this ); static void Do_Func ( Node *this ); static void Do_Deref ( Node *this ); static void Do_GTI ( Node *this ); static void Do_REG ( Node *this ); static void Do_Vector ( Node *this ); static long Search_GTI ( double evtTime, long nGTI, double *start, double *stop, int ordered ); static char saobox (double xcen, double ycen, double xwid, double ywid, double rot, double xcol, double ycol); static char ellipse(double xcen, double ycen, double xrad, double yrad, double rot, double xcol, double ycol); static char circle (double xcen, double ycen, double rad, double xcol, double ycol); static char bnear (double x, double y, double tolerance); static char bitcmp (char *bitstrm1, char *bitstrm2); static char bitlgte(char *bits1, int oper, char *bits2); static void bitand(char *result, char *bitstrm1, char *bitstrm2); static void bitor (char *result, char *bitstrm1, char *bitstrm2); static void bitnot(char *result, char *bits); static int cstrmid(char *dest_str, int dest_len, char *src_str, int src_len, int pos); static void fferror(char *msg); #ifdef __cplusplus } #endif #line 189 "eval.y" typedef union { int Node; /* Index of Node */ double dbl; /* real value */ long lng; /* integer value */ char log; /* logical value */ char str[MAX_STRLEN]; /* string value */ } FFSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define FFFINAL 290 #define FFFLAG -32768 #define FFNTBASE 54 #define FFTRANSLATE(x) ((unsigned)(x) <= 289 ? fftranslate[x] : 62) static const char fftranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 50, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 37, 41, 2, 52, 53, 38, 35, 20, 36, 2, 39, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 22, 2, 2, 21, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 2, 51, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 23, 40, 24, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 26, 27, 28, 29, 31, 32, 33, 34, 42, 43, 44, 45, 46, 48, 49 }; #if FFDEBUG != 0 static const short ffprhs[] = { 0, 0, 1, 4, 6, 9, 12, 15, 18, 21, 24, 28, 31, 35, 39, 43, 46, 49, 51, 53, 58, 62, 66, 70, 75, 82, 91, 102, 115, 118, 122, 124, 126, 128, 133, 135, 137, 141, 145, 149, 153, 157, 161, 164, 167, 171, 175, 179, 185, 191, 197, 200, 204, 208, 212, 216, 222, 228, 238, 243, 250, 259, 270, 283, 286, 289, 292, 295, 297, 299, 304, 308, 312, 316, 320, 324, 328, 332, 336, 340, 344, 348, 352, 356, 360, 364, 368, 372, 376, 380, 384, 388, 392, 396, 402, 408, 412, 416, 420, 426, 434, 446, 462, 465, 469, 475, 485, 489, 497, 507, 512, 519, 528, 539, 552, 555, 559, 561, 563, 568, 570, 574, 578, 584, 590 }; static const short ffrhs[] = { -1, 54, 55, 0, 50, 0, 58, 50, 0, 59, 50, 0, 61, 50, 0, 60, 50, 0, 1, 50, 0, 23, 59, 0, 56, 20, 59, 0, 23, 58, 0, 57, 20, 58, 0, 57, 20, 59, 0, 56, 20, 58, 0, 57, 24, 0, 56, 24, 0, 7, 0, 16, 0, 16, 23, 58, 24, 0, 60, 41, 60, 0, 60, 40, 60, 0, 60, 35, 60, 0, 60, 47, 58, 51, 0, 60, 47, 58, 20, 58, 51, 0, 60, 47, 58, 20, 58, 20, 58, 51, 0, 60, 47, 58, 20, 58, 20, 58, 20, 58, 51, 0, 60, 47, 58, 20, 58, 20, 58, 20, 58, 20, 58, 51, 0, 43, 60, 0, 52, 60, 53, 0, 4, 0, 5, 0, 13, 0, 13, 23, 58, 24, 0, 17, 0, 18, 0, 58, 37, 58, 0, 58, 35, 58, 0, 58, 36, 58, 0, 58, 38, 58, 0, 58, 39, 58, 0, 58, 42, 58, 0, 35, 58, 0, 36, 58, 0, 52, 58, 53, 0, 58, 38, 59, 0, 59, 38, 58, 0, 59, 25, 58, 22, 58, 0, 59, 25, 59, 22, 58, 0, 59, 25, 58, 22, 59, 0, 8, 53, 0, 8, 59, 53, 0, 8, 61, 53, 0, 8, 60, 53, 0, 8, 58, 53, 0, 10, 61, 20, 61, 53, 0, 8, 58, 20, 58, 53, 0, 8, 58, 20, 58, 20, 58, 20, 58, 53, 0, 58, 47, 58, 51, 0, 58, 47, 58, 20, 58, 51, 0, 58, 47, 58, 20, 58, 20, 58, 51, 0, 58, 47, 58, 20, 58, 20, 58, 20, 58, 51, 0, 58, 47, 58, 20, 58, 20, 58, 20, 58, 20, 58, 51, 0, 44, 58, 0, 44, 59, 0, 45, 58, 0, 45, 59, 0, 3, 0, 14, 0, 14, 23, 58, 24, 0, 60, 28, 60, 0, 60, 29, 60, 0, 60, 32, 60, 0, 60, 33, 60, 0, 60, 31, 60, 0, 60, 34, 60, 0, 58, 31, 58, 0, 58, 32, 58, 0, 58, 34, 58, 0, 58, 33, 58, 0, 58, 30, 58, 0, 58, 28, 58, 0, 58, 29, 58, 0, 61, 28, 61, 0, 61, 29, 61, 0, 61, 31, 61, 0, 61, 34, 61, 0, 61, 32, 61, 0, 61, 33, 61, 0, 59, 27, 59, 0, 59, 26, 59, 0, 59, 28, 59, 0, 59, 29, 59, 0, 58, 21, 58, 22, 58, 0, 59, 25, 59, 22, 59, 0, 9, 58, 53, 0, 9, 59, 53, 0, 9, 61, 53, 0, 8, 59, 20, 59, 53, 0, 9, 58, 20, 58, 20, 58, 53, 0, 9, 58, 20, 58, 20, 58, 20, 58, 20, 58, 53, 0, 9, 58, 20, 58, 20, 58, 20, 58, 20, 58, 20, 58, 20, 58, 53, 0, 11, 53, 0, 11, 6, 53, 0, 11, 6, 20, 58, 53, 0, 11, 6, 20, 58, 20, 6, 20, 6, 53, 0, 12, 6, 53, 0, 12, 6, 20, 58, 20, 58, 53, 0, 12, 6, 20, 58, 20, 58, 20, 6, 53, 0, 59, 47, 58, 51, 0, 59, 47, 58, 20, 58, 51, 0, 59, 47, 58, 20, 58, 20, 58, 51, 0, 59, 47, 58, 20, 58, 20, 58, 20, 58, 51, 0, 59, 47, 58, 20, 58, 20, 58, 20, 58, 20, 58, 51, 0, 43, 59, 0, 52, 59, 53, 0, 6, 0, 15, 0, 15, 23, 58, 24, 0, 19, 0, 52, 61, 53, 0, 61, 35, 61, 0, 59, 25, 61, 22, 61, 0, 8, 61, 20, 61, 53, 0, 8, 61, 20, 58, 20, 58, 53, 0 }; #endif #if FFDEBUG != 0 static const short ffrline[] = { 0, 241, 242, 245, 246, 252, 258, 264, 270, 273, 275, 288, 290, 303, 314, 328, 332, 336, 340, 342, 351, 354, 357, 366, 368, 370, 372, 374, 376, 379, 383, 385, 387, 389, 398, 400, 402, 405, 408, 411, 414, 417, 420, 422, 424, 426, 430, 434, 453, 472, 491, 504, 518, 530, 561, 659, 667, 729, 753, 755, 757, 759, 761, 763, 765, 767, 769, 773, 775, 777, 786, 789, 792, 795, 798, 801, 804, 807, 810, 813, 816, 819, 822, 825, 828, 831, 834, 837, 840, 843, 845, 847, 849, 852, 859, 876, 889, 902, 913, 929, 953, 981, 1018, 1022, 1026, 1029, 1033, 1037, 1040, 1044, 1046, 1048, 1050, 1052, 1054, 1056, 1060, 1063, 1065, 1074, 1076, 1078, 1087, 1106, 1125 }; #endif #if FFDEBUG != 0 || defined (FFERROR_VERBOSE) static const char * const fftname[] = { "$","error","$undefined.","BOOLEAN", "LONG","DOUBLE","STRING","BITSTR","FUNCTION","BFUNCTION","IFUNCTION","GTIFILTER", "REGFILTER","COLUMN","BCOLUMN","SCOLUMN","BITCOL","ROWREF","NULLREF","SNULLREF", "','","'='","':'","'{'","'}'","'?'","OR","AND","EQ","NE","'~'","GT","LT","LTE", "GTE","'+'","'-'","'%'","'*'","'/'","'|'","'&'","POWER","NOT","INTCAST","FLTCAST", "UMINUS","'['","ACCUM","DIFF","'\\n'","']'","'('","')'","lines","line","bvector", "vector","expr","bexpr","bits","sexpr", NULL }; #endif static const short ffr1[] = { 0, 54, 54, 55, 55, 55, 55, 55, 55, 56, 56, 57, 57, 57, 57, 58, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 61, 61, 61, 61, 61, 61, 61, 61, 61 }; static const short ffr2[] = { 0, 0, 2, 1, 2, 2, 2, 2, 2, 2, 3, 2, 3, 3, 3, 2, 2, 1, 1, 4, 3, 3, 3, 4, 6, 8, 10, 12, 2, 3, 1, 1, 1, 4, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 5, 5, 5, 2, 3, 3, 3, 3, 5, 5, 9, 4, 6, 8, 10, 12, 2, 2, 2, 2, 1, 1, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, 3, 3, 5, 7, 11, 15, 2, 3, 5, 9, 3, 7, 9, 4, 6, 8, 10, 12, 2, 3, 1, 1, 4, 1, 3, 3, 5, 5, 7 }; static const short ffdefact[] = { 1, 0, 0, 67, 30, 31, 116, 17, 0, 0, 0, 0, 0, 32, 68, 117, 18, 34, 35, 119, 0, 0, 0, 0, 0, 0, 3, 0, 2, 0, 0, 0, 0, 0, 0, 8, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 11, 9, 0, 42, 43, 114, 28, 63, 64, 65, 66, 0, 0, 0, 0, 0, 16, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 6, 0, 54, 0, 51, 53, 0, 52, 0, 95, 96, 97, 0, 0, 103, 0, 106, 0, 0, 0, 0, 44, 115, 29, 120, 14, 10, 12, 13, 0, 81, 82, 80, 76, 77, 79, 78, 37, 38, 36, 39, 45, 40, 41, 0, 0, 0, 0, 90, 89, 91, 92, 46, 0, 0, 0, 70, 71, 74, 72, 73, 75, 22, 21, 20, 0, 83, 84, 85, 87, 88, 86, 121, 0, 0, 0, 0, 0, 0, 0, 0, 33, 69, 118, 19, 0, 0, 58, 0, 0, 0, 0, 109, 28, 0, 0, 23, 0, 56, 98, 0, 123, 0, 55, 0, 104, 0, 93, 0, 47, 49, 48, 94, 122, 0, 0, 0, 0, 0, 0, 0, 0, 59, 0, 110, 0, 24, 0, 124, 0, 99, 0, 0, 107, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 111, 0, 25, 57, 0, 105, 108, 0, 0, 0, 0, 0, 61, 0, 112, 0, 26, 0, 100, 0, 0, 0, 0, 62, 113, 27, 0, 0, 101, 0, 0 }; static const short ffdefgoto[] = { 1, 28, 29, 30, 45, 46, 43, 57 }; static const short ffpact[] = {-32768, 301, -41,-32768,-32768,-32768,-32768,-32768, 351, 402, 402, -5, 12, 8, 33, 34, 41,-32768,-32768,-32768, 402, 402, 402, 402, 402, 402,-32768, 402,-32768, -18, 9, 1092, 403, 1438, 79,-32768,-32768, 428, 143, 294, 10, 456, 224, 1478, 125, 1390, 1436, 1523, -6,-32768, 2, 402, 402, 402, 402, 1390, 1436, 1129, 19, 19, 20, 21, 19, 20, 19, 20, 623, 240, 344, 1120, 402, -32768, 402,-32768, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402,-32768, 402, 402, 402, 402, 402, 402, 402,-32768, -3, -3, -3, -3, -3, -3, -3, -3, -3, 402,-32768, 402, 402, 402, 402, 402, 402, 402,-32768, 402,-32768, 402,-32768, -32768, 402,-32768, 402,-32768,-32768,-32768, 402, 402,-32768, 402,-32768, 1266, 1286, 1306, 1326,-32768,-32768,-32768,-32768, 1390, 1436, 1390, 1436, 1348, 1503, 1503, 1503, 23, 23, 23, 23, 160, 160, 160, -15, 20, -15, -15, 732, 1370, 1413, 1531, 146, -13, -35, -35, -15, 756, -3, -3, -30, -30, -30, -30, -30, -30, 50, 21, 21, 780, 67, 67, 11, 11, 11, 11,-32768, 484, 1118, 1146, 1415, 1166, 1424, 512, 1186,-32768,-32768,-32768,-32768, 402, 402,-32768, 402, 402, 402, 402,-32768, 21, 1480, 402,-32768, 402,-32768,-32768, 402,-32768, 402,-32768, 66, -32768, 402, 1461, 804, 1461, 1436, 1461, 1436, 1129, 828, 852, 1206, 650, 540, 68, 568, 402,-32768, 402,-32768, 402,-32768, 402,-32768, 402,-32768, 86, 87,-32768, 876, 900, 924, 677, 1226, 52, 56, 402,-32768, 402,-32768, 402,-32768,-32768, 402,-32768,-32768, 948, 972, 996, 596, 402,-32768, 402,-32768, 402,-32768, 402,-32768, 1020, 1044, 1068, 1246,-32768,-32768,-32768, 402, 704,-32768, 126,-32768 }; static const short ffpgoto[] = {-32768, -32768,-32768,-32768, -1, 95, 124, 27 }; #define FFLAST 1566 static const short fftable[] = { 31, 48, 70, 95, 7, 104, 71, 37, 41, 35, 105, 106, 96, 16, 129, 93, 94, 107, 50, 55, 58, 59, 131, 62, 64, 95, 66, 87, 34, 72, 122, 51, 88, 73, 96, 40, 44, 47, 109, 110, 170, 111, 112, 113, 114, 115, 115, 130, 49, 171, 133, 134, 135, 136, 69, 132, 52, 53, 82, 83, 84, 85, 86, 123, 54, 87, 88, 96, 107, 141, 88, 143, 235, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 159, 160, 247, 161, 105, 106, 255, 256, 168, 169, 32, 107, 111, 112, 113, 114, 115, 38, 42, 265, 181, 109, 110, 266, 111, 112, 113, 114, 115, 56, 189, 163, 60, 63, 65, 191, 67, 193, 0, 33, 290, 0, 195, 116, 196, 0, 39, 0, 0, 0, 182, 183, 184, 185, 186, 187, 188, 0, 0, 0, 0, 61, 0, 192, 0, 68, 0, 109, 110, 194, 111, 112, 113, 114, 115, 0, 0, 119, 0, 142, 0, 144, 90, 91, 92, 93, 94, 92, 93, 94, 0, 0, 127, 0, 157, 95, 0, 0, 95, 162, 164, 165, 166, 167, 96, 0, 0, 96, 0, 0, 120, 0, 85, 86, 223, 224, 87, 225, 227, 0, 230, 88, 0, 0, 231, 0, 232, 0, 190, 233, 0, 234, 0, 0, 0, 236, 172, 173, 174, 175, 176, 177, 178, 179, 180, 0, 0, 229, 0, 0, 250, 0, 251, 0, 252, 0, 253, 0, 254, 0, 0, 0, 0, 90, 91, 92, 93, 94, 0, 0, 267, 0, 268, 0, 269, 0, 95, 270, 0, 90, 91, 92, 93, 94, 279, 96, 280, 0, 281, 0, 282, 126, 95, 0, 0, 0, 0, 0, 0, 287, 0, 96, 0, 0, 0, 0, 0, 138, 209, 210, 0, 0, 0, 226, 228, 289, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 98, 99, 20, 100, 101, 102, 103, 104, 0, 0, 0, 0, 105, 106, 21, 22, 0, 0, 0, 107, 0, 0, 23, 24, 25, 121, 0, 0, 0, 26, 0, 27, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 98, 99, 20, 100, 101, 102, 103, 104, 0, 0, 0, 0, 105, 106, 21, 22, 0, 0, 0, 107, 0, 0, 23, 24, 25, 139, 0, 0, 0, 0, 0, 27, 36, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 20, 0, 0, 90, 91, 92, 93, 94, 0, 0, 0, 0, 21, 22, 0, 0, 95, 0, 0, 0, 23, 24, 25, 117, 74, 96, 0, 0, 97, 27, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 124, 74, 0, 0, 0, 118, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 213, 74, 0, 0, 0, 125, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 220, 74, 0, 0, 0, 214, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 245, 74, 0, 0, 0, 221, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 248, 74, 0, 0, 0, 246, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 277, 74, 0, 0, 0, 249, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 74, 0, 0, 0, 0, 278, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 74, 0, 0, 0, 0, 137, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 74, 0, 0, 0, 0, 244, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 74, 0, 0, 0, 0, 263, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 202, 74, 0, 0, 0, 288, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 207, 74, 0, 88, 0, 0, 0, 203, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 211, 74, 0, 88, 0, 0, 0, 208, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 237, 74, 0, 88, 0, 0, 0, 212, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 239, 74, 0, 88, 0, 0, 0, 238, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 241, 74, 0, 88, 0, 0, 0, 240, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 257, 74, 0, 88, 0, 0, 0, 242, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 259, 74, 0, 88, 0, 0, 0, 258, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 261, 74, 0, 88, 0, 0, 0, 260, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 271, 74, 0, 88, 0, 0, 0, 262, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 273, 74, 0, 88, 0, 0, 0, 272, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 275, 74, 0, 88, 0, 0, 0, 274, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 74, 0, 88, 0, 0, 0, 276, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 74, 0, 88, 0, 0, 0, 283, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 74, 0, 88, 0, 0, 0, 284, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 74, 0, 88, 0, 0, 0, 285, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 0, 0, 88, 0, 0, 89, 90, 91, 92, 93, 94, 109, 110, 0, 111, 112, 113, 114, 115, 95, 109, 110, 0, 111, 112, 113, 114, 115, 96, 216, 74, 0, 0, 0, 215, 0, 140, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 218, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 222, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 243, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 264, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 286, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 74, 87, 0, 197, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 74, 87, 0, 198, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 74, 87, 0, 199, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 74, 87, 0, 200, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 74, 201, 0, 0, 88, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 74, 204, 0, 0, 88, 0, 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 74, 87, 0, 0, 0, 0, 88, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 205, 0, 88, 90, 91, 92, 93, 94, 109, 110, 0, 111, 112, 113, 114, 115, 95, 109, 110, 0, 111, 112, 113, 114, 115, 96, 90, 91, 92, 93, 94, 98, 99, 217, 100, 101, 102, 103, 104, 95, 0, 0, 219, 105, 106, 0, 0, 0, 96, 0, 107, 0, 0, 108, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 87, 0, 0, 98, 99, 88, 100, 101, 102, 103, 104, 0, 104, 0, 0, 105, 106, 105, 106, 0, 0, 0, 107, 0, 107, 0, 0, 0, 0, 0, 139, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 0, 87, 0, 0, 0, 0, 88, 109, 110, 206, 111, 112, 113, 114, 115, 109, 110, 0, 111, 112, 113, 114, 115 }; static const short ffcheck[] = { 1, 6, 20, 38, 7, 35, 24, 8, 9, 50, 40, 41, 47, 16, 20, 28, 29, 47, 6, 20, 21, 22, 20, 24, 25, 38, 27, 42, 1, 20, 20, 23, 47, 24, 47, 8, 9, 10, 28, 29, 43, 31, 32, 33, 34, 35, 35, 53, 53, 52, 51, 52, 53, 54, 27, 53, 23, 23, 35, 36, 37, 38, 39, 53, 23, 42, 47, 47, 47, 70, 47, 72, 6, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 20, 90, 40, 41, 6, 6, 95, 96, 1, 47, 31, 32, 33, 34, 35, 8, 9, 53, 107, 28, 29, 53, 31, 32, 33, 34, 35, 20, 117, 90, 23, 24, 25, 122, 27, 124, -1, 1, 0, -1, 129, 50, 131, -1, 8, -1, -1, -1, 109, 110, 111, 112, 113, 114, 115, -1, -1, -1, -1, 23, -1, 122, -1, 27, -1, 28, 29, 128, 31, 32, 33, 34, 35, -1, -1, 20, -1, 70, -1, 72, 25, 26, 27, 28, 29, 27, 28, 29, -1, -1, 53, -1, 85, 38, -1, -1, 38, 90, 91, 92, 93, 94, 47, -1, -1, 47, -1, -1, 53, -1, 38, 39, 201, 202, 42, 204, 205, -1, 207, 47, -1, -1, 211, -1, 213, -1, 119, 216, -1, 218, -1, -1, -1, 222, 98, 99, 100, 101, 102, 103, 104, 105, 106, -1, -1, 206, -1, -1, 237, -1, 239, -1, 241, -1, 243, -1, 245, -1, -1, -1, -1, 25, 26, 27, 28, 29, -1, -1, 257, -1, 259, -1, 261, -1, 38, 264, -1, 25, 26, 27, 28, 29, 271, 47, 273, -1, 275, -1, 277, 53, 38, -1, -1, -1, -1, -1, -1, 286, -1, 47, -1, -1, -1, -1, -1, 53, 170, 171, -1, -1, -1, 204, 205, 0, 1, -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, 28, 29, 23, 31, 32, 33, 34, 35, -1, -1, -1, -1, 40, 41, 35, 36, -1, -1, -1, 47, -1, -1, 43, 44, 45, 53, -1, -1, -1, 50, -1, 52, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, 28, 29, 23, 31, 32, 33, 34, 35, -1, -1, -1, -1, 40, 41, 35, 36, -1, -1, -1, 47, -1, -1, 43, 44, 45, 53, -1, -1, -1, -1, -1, 52, 53, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, 23, -1, -1, 25, 26, 27, 28, 29, -1, -1, -1, -1, 35, 36, -1, -1, 38, -1, -1, -1, 43, 44, 45, 20, 21, 47, -1, -1, 50, 52, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 21, -1, -1, -1, -1, 53, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 21, -1, -1, -1, -1, 53, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 21, -1, -1, -1, -1, 53, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 21, -1, -1, -1, -1, 53, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, 20, 21, -1, -1, -1, 53, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, 20, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 21, -1, 47, -1, -1, -1, 51, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, -1, -1, 47, -1, -1, 50, 25, 26, 27, 28, 29, 28, 29, -1, 31, 32, 33, 34, 35, 38, 28, 29, -1, 31, 32, 33, 34, 35, 47, 20, 21, -1, -1, -1, 53, -1, 53, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, 21, 42, -1, 24, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, 21, 42, -1, 24, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, 21, 42, -1, 24, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, 21, 42, -1, 24, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, 21, 22, -1, -1, 47, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, 21, 22, -1, -1, 47, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, 21, 42, -1, -1, -1, -1, 47, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 22, -1, 47, 25, 26, 27, 28, 29, 28, 29, -1, 31, 32, 33, 34, 35, 38, 28, 29, -1, 31, 32, 33, 34, 35, 47, 25, 26, 27, 28, 29, 28, 29, 53, 31, 32, 33, 34, 35, 38, -1, -1, 53, 40, 41, -1, -1, -1, 47, -1, 47, -1, -1, 50, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, 42, -1, -1, 28, 29, 47, 31, 32, 33, 34, 35, -1, 35, -1, -1, 40, 41, 40, 41, -1, -1, -1, 47, -1, 47, -1, -1, -1, -1, -1, 53, 31, 32, 33, 34, 35, 36, 37, 38, 39, 20, -1, 42, -1, -1, -1, -1, 47, 28, 29, 22, 31, 32, 33, 34, 35, 28, 29, -1, 31, 32, 33, 34, 35 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr1/local/share/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include #pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { void *alloca (unsigned int); }; #else /* not __cplusplus */ void *alloca (); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc. */ #endif /* not GNU C. */ #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define fferrok (fferrstatus = 0) #define ffclearin (ffchar = FFEMPTY) #define FFEMPTY -2 #define FFEOF 0 #define FFACCEPT return(0) #define FFABORT return(1) #define FFERROR goto fferrlab1 /* Like FFERROR except do call fferror. This remains here temporarily to ease the transition to the new meaning of FFERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define FFFAIL goto fferrlab #define FFRECOVERING() (!!fferrstatus) #define FFBACKUP(token, value) \ do \ if (ffchar == FFEMPTY && fflen == 1) \ { ffchar = (token), fflval = (value); \ ffchar1 = FFTRANSLATE (ffchar); \ FFPOPSTACK; \ goto ffbackup; \ } \ else \ { fferror ("syntax error: cannot back up"); FFERROR; } \ while (0) #define FFTERROR 1 #define FFERRCODE 256 #ifndef FFPURE #define FFLEX fflex() #endif #ifdef FFPURE #ifdef FFLSP_NEEDED #ifdef FFLEX_PARAM #define FFLEX fflex(&fflval, &fflloc, FFLEX_PARAM) #else #define FFLEX fflex(&fflval, &fflloc) #endif #else /* not FFLSP_NEEDED */ #ifdef FFLEX_PARAM #define FFLEX fflex(&fflval, FFLEX_PARAM) #else #define FFLEX fflex(&fflval) #endif #endif /* not FFLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef FFPURE int ffchar; /* the lookahead symbol */ FFSTYPE fflval; /* the semantic value of the */ /* lookahead symbol */ #ifdef FFLSP_NEEDED FFLTYPE fflloc; /* location data for the lookahead */ /* symbol */ #endif int ffnerrs; /* number of parse errors so far */ #endif /* not FFPURE */ #if FFDEBUG != 0 int ffdebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* FFINITDEPTH indicates the initial size of the parser's stacks */ #ifndef FFINITDEPTH #define FFINITDEPTH 200 #endif /* FFMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if FFMAXDEPTH == 0 #undef FFMAXDEPTH #endif #ifndef FFMAXDEPTH #define FFMAXDEPTH 10000 #endif /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ int ffparse (void); #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __ff_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __ff_memcpy (to, from, count) char *to; char *from; int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __ff_memcpy (char *to, char *from, int count) { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif #line 196 "/usr1/local/share/bison.simple" /* The user can define FFPARSE_PARAM as the name of an argument to be passed into ffparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef FFPARSE_PARAM #ifdef __cplusplus #define FFPARSE_PARAM_ARG void *FFPARSE_PARAM #define FFPARSE_PARAM_DECL #else /* not __cplusplus */ #define FFPARSE_PARAM_ARG FFPARSE_PARAM #define FFPARSE_PARAM_DECL void *FFPARSE_PARAM; #endif /* not __cplusplus */ #else /* not FFPARSE_PARAM */ #define FFPARSE_PARAM_ARG #define FFPARSE_PARAM_DECL #endif /* not FFPARSE_PARAM */ int ffparse(FFPARSE_PARAM_ARG) FFPARSE_PARAM_DECL { register int ffstate; register int ffn; register short *ffssp; register FFSTYPE *ffvsp; int fferrstatus; /* number of tokens to shift before error messages enabled */ int ffchar1 = 0; /* lookahead token as an internal (translated) token number */ short ffssa[FFINITDEPTH]; /* the state stack */ FFSTYPE ffvsa[FFINITDEPTH]; /* the semantic value stack */ short *ffss = ffssa; /* refer to the stacks thru separate pointers */ FFSTYPE *ffvs = ffvsa; /* to allow ffoverflow to reallocate them elsewhere */ #ifdef FFLSP_NEEDED FFLTYPE fflsa[FFINITDEPTH]; /* the location stack */ FFLTYPE *ffls = fflsa; FFLTYPE *fflsp; #define FFPOPSTACK (ffvsp--, ffssp--, fflsp--) #else #define FFPOPSTACK (ffvsp--, ffssp--) #endif int ffstacksize = FFINITDEPTH; #ifdef FFPURE int ffchar; FFSTYPE fflval; int ffnerrs; #ifdef FFLSP_NEEDED FFLTYPE fflloc; #endif #endif FFSTYPE ffval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int fflen; #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Starting parse\n"); #endif ffstate = 0; fferrstatus = 0; ffnerrs = 0; ffchar = FFEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ ffssp = ffss - 1; ffvsp = ffvs; #ifdef FFLSP_NEEDED fflsp = ffls; #endif /* Push a new state, which is found in ffstate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ ffnewstate: *++ffssp = ffstate; if (ffssp >= ffss + ffstacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ FFSTYPE *ffvs1 = ffvs; short *ffss1 = ffss; #ifdef FFLSP_NEEDED FFLTYPE *ffls1 = ffls; #endif /* Get the current used size of the three stacks, in elements. */ int size = ffssp - ffss + 1; #ifdef ffoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef FFLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if ffoverflow is a macro. */ ffoverflow("parser stack overflow", &ffss1, size * sizeof (*ffssp), &ffvs1, size * sizeof (*ffvsp), &ffls1, size * sizeof (*fflsp), &ffstacksize); #else ffoverflow("parser stack overflow", &ffss1, size * sizeof (*ffssp), &ffvs1, size * sizeof (*ffvsp), &ffstacksize); #endif ffss = ffss1; ffvs = ffvs1; #ifdef FFLSP_NEEDED ffls = ffls1; #endif #else /* no ffoverflow */ /* Extend the stack our own way. */ if (ffstacksize >= FFMAXDEPTH) { fferror("parser stack overflow"); return 2; } ffstacksize *= 2; if (ffstacksize > FFMAXDEPTH) ffstacksize = FFMAXDEPTH; ffss = (short *) alloca (ffstacksize * sizeof (*ffssp)); __ff_memcpy ((char *)ffss, (char *)ffss1, size * sizeof (*ffssp)); ffvs = (FFSTYPE *) alloca (ffstacksize * sizeof (*ffvsp)); __ff_memcpy ((char *)ffvs, (char *)ffvs1, size * sizeof (*ffvsp)); #ifdef FFLSP_NEEDED ffls = (FFLTYPE *) alloca (ffstacksize * sizeof (*fflsp)); __ff_memcpy ((char *)ffls, (char *)ffls1, size * sizeof (*fflsp)); #endif #endif /* no ffoverflow */ ffssp = ffss + size - 1; ffvsp = ffvs + size - 1; #ifdef FFLSP_NEEDED fflsp = ffls + size - 1; #endif #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Stack size increased to %d\n", ffstacksize); #endif if (ffssp >= ffss + ffstacksize - 1) FFABORT; } #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Entering state %d\n", ffstate); #endif goto ffbackup; ffbackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* ffresume: */ /* First try to decide what to do without reference to lookahead token. */ ffn = ffpact[ffstate]; if (ffn == FFFLAG) goto ffdefault; /* Not known => get a lookahead token if don't already have one. */ /* ffchar is either FFEMPTY or FFEOF or a valid token in external form. */ if (ffchar == FFEMPTY) { #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Reading a token: "); #endif ffchar = FFLEX; } /* Convert token to internal form (in ffchar1) for indexing tables with */ if (ffchar <= 0) /* This means end of input. */ { ffchar1 = 0; ffchar = FFEOF; /* Don't call FFLEX any more */ #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { ffchar1 = FFTRANSLATE(ffchar); #if FFDEBUG != 0 if (ffdebug) { fprintf (stderr, "Next token is %d (%s", ffchar, fftname[ffchar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef FFPRINT FFPRINT (stderr, ffchar, fflval); #endif fprintf (stderr, ")\n"); } #endif } ffn += ffchar1; if (ffn < 0 || ffn > FFLAST || ffcheck[ffn] != ffchar1) goto ffdefault; ffn = fftable[ffn]; /* ffn is what to do for this token type in this state. Negative => reduce, -ffn is rule number. Positive => shift, ffn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (ffn < 0) { if (ffn == FFFLAG) goto fferrlab; ffn = -ffn; goto ffreduce; } else if (ffn == 0) goto fferrlab; if (ffn == FFFINAL) FFACCEPT; /* Shift the lookahead token. */ #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Shifting token %d (%s), ", ffchar, fftname[ffchar1]); #endif /* Discard the token being shifted unless it is eof. */ if (ffchar != FFEOF) ffchar = FFEMPTY; *++ffvsp = fflval; #ifdef FFLSP_NEEDED *++fflsp = fflloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (fferrstatus) fferrstatus--; ffstate = ffn; goto ffnewstate; /* Do the default action for the current state. */ ffdefault: ffn = ffdefact[ffstate]; if (ffn == 0) goto fferrlab; /* Do a reduction. ffn is the number of a rule to reduce with. */ ffreduce: fflen = ffr2[ffn]; if (fflen > 0) ffval = ffvsp[1-fflen]; /* implement default value of the action */ #if FFDEBUG != 0 if (ffdebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", ffn, ffrline[ffn]); /* Print the symbols being reduced, and their result. */ for (i = ffprhs[ffn]; ffrhs[i] > 0; i++) fprintf (stderr, "%s ", fftname[ffrhs[i]]); fprintf (stderr, " -> %s\n", fftname[ffr1[ffn]]); } #endif switch (ffn) { case 3: #line 245 "eval.y" {; break;} case 4: #line 247 "eval.y" { if( ffvsp[-1].Node<0 ) { fferror("Couldn't build node structure: out of memory?"); FFERROR; } gParse.resultNode = ffvsp[-1].Node; ; break;} case 5: #line 253 "eval.y" { if( ffvsp[-1].Node<0 ) { fferror("Couldn't build node structure: out of memory?"); FFERROR; } gParse.resultNode = ffvsp[-1].Node; ; break;} case 6: #line 259 "eval.y" { if( ffvsp[-1].Node<0 ) { fferror("Couldn't build node structure: out of memory?"); FFERROR; } gParse.resultNode = ffvsp[-1].Node; ; break;} case 7: #line 265 "eval.y" { if( ffvsp[-1].Node<0 ) { fferror("Couldn't build node structure: out of memory?"); FFERROR; } gParse.resultNode = ffvsp[-1].Node; ; break;} case 8: #line 270 "eval.y" { fferrok; ; break;} case 9: #line 274 "eval.y" { ffval.Node = New_Vector( ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 10: #line 276 "eval.y" { if( gParse.Nodes[ffvsp[-2].Node].nSubNodes >= MAXSUBS ) { ffvsp[-2].Node = Close_Vec( ffvsp[-2].Node ); TEST(ffvsp[-2].Node); ffval.Node = New_Vector( ffvsp[-2].Node ); TEST(ffval.Node); } else { ffval.Node = ffvsp[-2].Node; } gParse.Nodes[ffval.Node].SubNodes[ gParse.Nodes[ffval.Node].nSubNodes++ ] = ffvsp[0].Node; ; break;} case 11: #line 289 "eval.y" { ffval.Node = New_Vector( ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 12: #line 291 "eval.y" { if( TYPE(ffvsp[-2].Node) < TYPE(ffvsp[0].Node) ) TYPE(ffvsp[-2].Node) = TYPE(ffvsp[0].Node); if( gParse.Nodes[ffvsp[-2].Node].nSubNodes >= MAXSUBS ) { ffvsp[-2].Node = Close_Vec( ffvsp[-2].Node ); TEST(ffvsp[-2].Node); ffval.Node = New_Vector( ffvsp[-2].Node ); TEST(ffval.Node); } else { ffval.Node = ffvsp[-2].Node; } gParse.Nodes[ffval.Node].SubNodes[ gParse.Nodes[ffval.Node].nSubNodes++ ] = ffvsp[0].Node; ; break;} case 13: #line 304 "eval.y" { if( gParse.Nodes[ffvsp[-2].Node].nSubNodes >= MAXSUBS ) { ffvsp[-2].Node = Close_Vec( ffvsp[-2].Node ); TEST(ffvsp[-2].Node); ffval.Node = New_Vector( ffvsp[-2].Node ); TEST(ffval.Node); } else { ffval.Node = ffvsp[-2].Node; } gParse.Nodes[ffval.Node].SubNodes[ gParse.Nodes[ffval.Node].nSubNodes++ ] = ffvsp[0].Node; ; break;} case 14: #line 315 "eval.y" { TYPE(ffvsp[-2].Node) = TYPE(ffvsp[0].Node); if( gParse.Nodes[ffvsp[-2].Node].nSubNodes >= MAXSUBS ) { ffvsp[-2].Node = Close_Vec( ffvsp[-2].Node ); TEST(ffvsp[-2].Node); ffval.Node = New_Vector( ffvsp[-2].Node ); TEST(ffval.Node); } else { ffval.Node = ffvsp[-2].Node; } gParse.Nodes[ffval.Node].SubNodes[ gParse.Nodes[ffval.Node].nSubNodes++ ] = ffvsp[0].Node; ; break;} case 15: #line 329 "eval.y" { ffval.Node = Close_Vec( ffvsp[-1].Node ); TEST(ffval.Node); ; break;} case 16: #line 333 "eval.y" { ffval.Node = Close_Vec( ffvsp[-1].Node ); TEST(ffval.Node); ; break;} case 17: #line 337 "eval.y" { ffval.Node = New_Const( BITSTR, ffvsp[0].str, strlen(ffvsp[0].str)+1 ); TEST(ffval.Node); SIZE(ffval.Node) = strlen(ffvsp[0].str); ; break;} case 18: #line 341 "eval.y" { ffval.Node = New_Column( ffvsp[0].lng ); TEST(ffval.Node); ; break;} case 19: #line 343 "eval.y" { if( TYPE(ffvsp[-1].Node) != LONG || OPER(ffvsp[-1].Node) != CONST_OP ) { fferror("Offset argument must be a constant integer"); FFERROR; } ffval.Node = New_Offset( ffvsp[-3].lng, ffvsp[-1].Node ); TEST(ffval.Node); ; break;} case 20: #line 352 "eval.y" { ffval.Node = New_BinOp( BITSTR, ffvsp[-2].Node, '&', ffvsp[0].Node ); TEST(ffval.Node); SIZE(ffval.Node) = ( SIZE(ffvsp[-2].Node)>SIZE(ffvsp[0].Node) ? SIZE(ffvsp[-2].Node) : SIZE(ffvsp[0].Node) ); ; break;} case 21: #line 355 "eval.y" { ffval.Node = New_BinOp( BITSTR, ffvsp[-2].Node, '|', ffvsp[0].Node ); TEST(ffval.Node); SIZE(ffval.Node) = ( SIZE(ffvsp[-2].Node)>SIZE(ffvsp[0].Node) ? SIZE(ffvsp[-2].Node) : SIZE(ffvsp[0].Node) ); ; break;} case 22: #line 358 "eval.y" { if (SIZE(ffvsp[-2].Node)+SIZE(ffvsp[0].Node) >= MAX_STRLEN) { fferror("Combined bit string size exceeds " MAX_STRLEN_S " bits"); FFERROR; } ffval.Node = New_BinOp( BITSTR, ffvsp[-2].Node, '+', ffvsp[0].Node ); TEST(ffval.Node); SIZE(ffval.Node) = SIZE(ffvsp[-2].Node) + SIZE(ffvsp[0].Node); ; break;} case 23: #line 367 "eval.y" { ffval.Node = New_Deref( ffvsp[-3].Node, 1, ffvsp[-1].Node, 0, 0, 0, 0 ); TEST(ffval.Node); ; break;} case 24: #line 369 "eval.y" { ffval.Node = New_Deref( ffvsp[-5].Node, 2, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0 ); TEST(ffval.Node); ; break;} case 25: #line 371 "eval.y" { ffval.Node = New_Deref( ffvsp[-7].Node, 3, ffvsp[-5].Node, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0 ); TEST(ffval.Node); ; break;} case 26: #line 373 "eval.y" { ffval.Node = New_Deref( ffvsp[-9].Node, 4, ffvsp[-7].Node, ffvsp[-5].Node, ffvsp[-3].Node, ffvsp[-1].Node, 0 ); TEST(ffval.Node); ; break;} case 27: #line 375 "eval.y" { ffval.Node = New_Deref( ffvsp[-11].Node, 5, ffvsp[-9].Node, ffvsp[-7].Node, ffvsp[-5].Node, ffvsp[-3].Node, ffvsp[-1].Node ); TEST(ffval.Node); ; break;} case 28: #line 377 "eval.y" { ffval.Node = New_Unary( BITSTR, NOT, ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 29: #line 380 "eval.y" { ffval.Node = ffvsp[-1].Node; ; break;} case 30: #line 384 "eval.y" { ffval.Node = New_Const( LONG, &(ffvsp[0].lng), sizeof(long) ); TEST(ffval.Node); ; break;} case 31: #line 386 "eval.y" { ffval.Node = New_Const( DOUBLE, &(ffvsp[0].dbl), sizeof(double) ); TEST(ffval.Node); ; break;} case 32: #line 388 "eval.y" { ffval.Node = New_Column( ffvsp[0].lng ); TEST(ffval.Node); ; break;} case 33: #line 390 "eval.y" { if( TYPE(ffvsp[-1].Node) != LONG || OPER(ffvsp[-1].Node) != CONST_OP ) { fferror("Offset argument must be a constant integer"); FFERROR; } ffval.Node = New_Offset( ffvsp[-3].lng, ffvsp[-1].Node ); TEST(ffval.Node); ; break;} case 34: #line 399 "eval.y" { ffval.Node = New_Func( LONG, row_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); ; break;} case 35: #line 401 "eval.y" { ffval.Node = New_Func( LONG, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); ; break;} case 36: #line 403 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '%', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 37: #line 406 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '+', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 38: #line 409 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '-', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 39: #line 412 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '*', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 40: #line 415 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '/', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 41: #line 418 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, POWER, ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 42: #line 421 "eval.y" { ffval.Node = ffvsp[0].Node; ; break;} case 43: #line 423 "eval.y" { ffval.Node = New_Unary( TYPE(ffvsp[0].Node), UMINUS, ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 44: #line 425 "eval.y" { ffval.Node = ffvsp[-1].Node; ; break;} case 45: #line 427 "eval.y" { ffvsp[0].Node = New_Unary( TYPE(ffvsp[-2].Node), 0, ffvsp[0].Node ); ffval.Node = New_BinOp( TYPE(ffvsp[-2].Node), ffvsp[-2].Node, '*', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 46: #line 431 "eval.y" { ffvsp[-2].Node = New_Unary( TYPE(ffvsp[0].Node), 0, ffvsp[-2].Node ); ffval.Node = New_BinOp( TYPE(ffvsp[0].Node), ffvsp[-2].Node, '*', ffvsp[0].Node ); TEST(ffval.Node); ; break;} case 47: #line 435 "eval.y" { PROMOTE(ffvsp[-2].Node,ffvsp[0].Node); if( ! Test_Dims(ffvsp[-2].Node,ffvsp[0].Node) ) { fferror("Incompatible dimensions in '?:' arguments"); FFERROR; } ffval.Node = New_Func( 0, ifthenelse_fct, 3, ffvsp[-2].Node, ffvsp[0].Node, ffvsp[-4].Node, 0, 0, 0, 0 ); TEST(ffval.Node); if( SIZE(ffvsp[-2].Node)=SIZE(ffvsp[-1].Node) && Test_Dims( ffvsp[-3].Node, ffvsp[-1].Node ) ) { PROMOTE(ffvsp[-3].Node,ffvsp[-1].Node); ffval.Node = New_Func( 0, defnull_fct, 2, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0, 0, 0 ); TEST(ffval.Node); } else { fferror("Dimensions of DEFNULL arguments " "are not compatible"); FFERROR; } } else if (FSTRCMP(ffvsp[-4].str,"ARCTAN2(") == 0) { if( TYPE(ffvsp[-3].Node) != DOUBLE ) ffvsp[-3].Node = New_Unary( DOUBLE, 0, ffvsp[-3].Node ); if( TYPE(ffvsp[-1].Node) != DOUBLE ) ffvsp[-1].Node = New_Unary( DOUBLE, 0, ffvsp[-1].Node ); if( Test_Dims( ffvsp[-3].Node, ffvsp[-1].Node ) ) { ffval.Node = New_Func( 0, atan2_fct, 2, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0, 0, 0 ); TEST(ffval.Node); if( SIZE(ffvsp[-3].Node)=SIZE(ffvsp[-1].Node) && Test_Dims( ffvsp[-3].Node, ffvsp[-1].Node ) ) { ffval.Node = New_Func( 0, defnull_fct, 2, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0, 0, 0 ); TEST(ffval.Node); } else { fferror("Dimensions of DEFNULL arguments are not compatible"); FFERROR; } } else { fferror("Boolean Function(expr,expr) not supported"); FFERROR; } ; break;} case 99: #line 930 "eval.y" { if( TYPE(ffvsp[-5].Node) != DOUBLE ) ffvsp[-5].Node = New_Unary( DOUBLE, 0, ffvsp[-5].Node ); if( TYPE(ffvsp[-3].Node) != DOUBLE ) ffvsp[-3].Node = New_Unary( DOUBLE, 0, ffvsp[-3].Node ); if( TYPE(ffvsp[-1].Node) != DOUBLE ) ffvsp[-1].Node = New_Unary( DOUBLE, 0, ffvsp[-1].Node ); if( ! (Test_Dims( ffvsp[-5].Node, ffvsp[-3].Node ) && Test_Dims( ffvsp[-3].Node, ffvsp[-1].Node ) ) ) { fferror("Dimensions of NEAR arguments " "are not compatible"); FFERROR; } else { if (FSTRCMP(ffvsp[-6].str,"NEAR(") == 0) { ffval.Node = New_Func( BOOLEAN, near_fct, 3, ffvsp[-5].Node, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0, 0 ); } else { fferror("Boolean Function not supported"); FFERROR; } TEST(ffval.Node); if( SIZE(ffval.Node)= MAX_STRLEN) { fferror("Combined string size exceeds " MAX_STRLEN_S " characters"); FFERROR; } ffval.Node = New_BinOp( STRING, ffvsp[-2].Node, '+', ffvsp[0].Node ); TEST(ffval.Node); SIZE(ffval.Node) = SIZE(ffvsp[-2].Node) + SIZE(ffvsp[0].Node); ; break;} case 122: #line 1088 "eval.y" { int outSize; if( SIZE(ffvsp[-4].Node)!=1 ) { fferror("Cannot have a vector string column"); FFERROR; } /* Since the output can be calculated now, as a constant scalar, we must precalculate the output size, in order to avoid an overflow. */ outSize = SIZE(ffvsp[-2].Node); if (SIZE(ffvsp[0].Node) > outSize) outSize = SIZE(ffvsp[0].Node); ffval.Node = New_FuncSize( 0, ifthenelse_fct, 3, ffvsp[-2].Node, ffvsp[0].Node, ffvsp[-4].Node, 0, 0, 0, 0, outSize); TEST(ffval.Node); if( SIZE(ffvsp[-2].Node) outSize) outSize = SIZE(ffvsp[-1].Node); ffval.Node = New_FuncSize( 0, defnull_fct, 2, ffvsp[-3].Node, ffvsp[-1].Node, 0, 0, 0, 0, 0, outSize ); TEST(ffval.Node); if( SIZE(ffvsp[-1].Node)>SIZE(ffvsp[-3].Node) ) SIZE(ffval.Node) = SIZE(ffvsp[-1].Node); } else { fferror("Function(string,string) not supported"); FFERROR; } ; break;} case 124: #line 1126 "eval.y" { if (FSTRCMP(ffvsp[-6].str,"STRMID(") == 0) { int len; if( TYPE(ffvsp[-3].Node) != LONG || SIZE(ffvsp[-3].Node) != 1 || TYPE(ffvsp[-1].Node) != LONG || SIZE(ffvsp[-1].Node) != 1) { fferror("When using STRMID(S,P,N), P and N must be integers (and not vector columns)"); FFERROR; } if (OPER(ffvsp[-1].Node) == CONST_OP) { /* Constant value: use that directly */ len = (gParse.Nodes[ffvsp[-1].Node].value.data.lng); } else { /* Variable value: use the maximum possible (from $2) */ len = SIZE(ffvsp[-5].Node); } if (len <= 0 || len >= MAX_STRLEN) { fferror("STRMID(S,P,N), N must be 1-" MAX_STRLEN_S); FFERROR; } ffval.Node = New_FuncSize( 0, strmid_fct, 3, ffvsp[-5].Node, ffvsp[-3].Node,ffvsp[-1].Node,0,0,0,0,len); TEST(ffval.Node); } else { fferror("Function(string,expr,expr) not supported"); FFERROR; } ; break;} } /* the action file gets copied in in place of this dollarsign */ #line 498 "/usr1/local/share/bison.simple" ffvsp -= fflen; ffssp -= fflen; #ifdef FFLSP_NEEDED fflsp -= fflen; #endif #if FFDEBUG != 0 if (ffdebug) { short *ssp1 = ffss - 1; fprintf (stderr, "state stack now"); while (ssp1 != ffssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++ffvsp = ffval; #ifdef FFLSP_NEEDED fflsp++; if (fflen == 0) { fflsp->first_line = fflloc.first_line; fflsp->first_column = fflloc.first_column; fflsp->last_line = (fflsp-1)->last_line; fflsp->last_column = (fflsp-1)->last_column; fflsp->text = 0; } else { fflsp->last_line = (fflsp+fflen-1)->last_line; fflsp->last_column = (fflsp+fflen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ ffn = ffr1[ffn]; ffstate = ffpgoto[ffn - FFNTBASE] + *ffssp; if (ffstate >= 0 && ffstate <= FFLAST && ffcheck[ffstate] == *ffssp) ffstate = fftable[ffstate]; else ffstate = ffdefgoto[ffn - FFNTBASE]; goto ffnewstate; fferrlab: /* here on detecting error */ if (! fferrstatus) /* If not already recovering from an error, report this error. */ { ++ffnerrs; #ifdef FFERROR_VERBOSE ffn = ffpact[ffstate]; if (ffn > FFFLAG && ffn < FFLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -ffn if nec to avoid negative indexes in ffcheck. */ for (x = (ffn < 0 ? -ffn : 0); x < (sizeof(fftname) / sizeof(char *)); x++) if (ffcheck[x + ffn] == x) size += strlen(fftname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (ffn < 0 ? -ffn : 0); x < (sizeof(fftname) / sizeof(char *)); x++) if (ffcheck[x + ffn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, fftname[x]); strcat(msg, "'"); count++; } } fferror(msg); free(msg); } else fferror ("parse error; also virtual memory exceeded"); } else #endif /* FFERROR_VERBOSE */ fferror("parse error"); } goto fferrlab1; fferrlab1: /* here on error raised explicitly by an action */ if (fferrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (ffchar == FFEOF) FFABORT; #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Discarding token %d (%s).\n", ffchar, fftname[ffchar1]); #endif ffchar = FFEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ fferrstatus = 3; /* Each real token shifted decrements this */ goto fferrhandle; fferrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ ffn = ffdefact[ffstate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (ffn) goto ffdefault; #endif fferrpop: /* pop the current state because it cannot handle the error token */ if (ffssp == ffss) FFABORT; ffvsp--; ffstate = *--ffssp; #ifdef FFLSP_NEEDED fflsp--; #endif #if FFDEBUG != 0 if (ffdebug) { short *ssp1 = ffss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != ffssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif fferrhandle: ffn = ffpact[ffstate]; if (ffn == FFFLAG) goto fferrdefault; ffn += FFTERROR; if (ffn < 0 || ffn > FFLAST || ffcheck[ffn] != FFTERROR) goto fferrdefault; ffn = fftable[ffn]; if (ffn < 0) { if (ffn == FFFLAG) goto fferrpop; ffn = -ffn; goto ffreduce; } else if (ffn == 0) goto fferrpop; if (ffn == FFFINAL) FFACCEPT; #if FFDEBUG != 0 if (ffdebug) fprintf(stderr, "Shifting error token, "); #endif *++ffvsp = fflval; #ifdef FFLSP_NEEDED *++fflsp = fflloc; #endif ffstate = ffn; goto ffnewstate; } #line 1155 "eval.y" /*************************************************************************/ /* Start of "New" routines which build the expression Nodal structure */ /*************************************************************************/ static int Alloc_Node( void ) { /* Use this for allocation to guarantee *Nodes */ Node *newNodePtr; /* survives on failure, making it still valid */ /* while working our way out of this error */ if( gParse.nNodes == gParse.nNodesAlloc ) { if( gParse.Nodes ) { gParse.nNodesAlloc += gParse.nNodesAlloc; newNodePtr = (Node *)realloc( gParse.Nodes, sizeof(Node)*gParse.nNodesAlloc ); } else { gParse.nNodesAlloc = 100; newNodePtr = (Node *)malloc ( sizeof(Node)*gParse.nNodesAlloc ); } if( newNodePtr ) { gParse.Nodes = newNodePtr; } else { gParse.status = MEMORY_ALLOCATION; return( -1 ); } } return ( gParse.nNodes++ ); } static void Free_Last_Node( void ) { if( gParse.nNodes ) gParse.nNodes--; } static int New_Const( int returnType, void *value, long len ) { Node *this; int n; n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = CONST_OP; /* Flag a constant */ this->DoOp = NULL; this->nSubNodes = 0; this->type = returnType; memcpy( &(this->value.data), value, len ); this->value.undef = NULL; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } return(n); } static int New_Column( int ColNum ) { Node *this; int n, i; n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = -ColNum; this->DoOp = NULL; this->nSubNodes = 0; this->type = gParse.varData[ColNum].type; this->value.nelem = gParse.varData[ColNum].nelem; this->value.naxis = gParse.varData[ColNum].naxis; for( i=0; ivalue.naxes[i] = gParse.varData[ColNum].naxes[i]; } return(n); } static int New_Offset( int ColNum, int offsetNode ) { Node *this; int n, i, colNode; colNode = New_Column( ColNum ); if( colNode<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = '{'; this->DoOp = Do_Offset; this->nSubNodes = 2; this->SubNodes[0] = colNode; this->SubNodes[1] = offsetNode; this->type = gParse.varData[ColNum].type; this->value.nelem = gParse.varData[ColNum].nelem; this->value.naxis = gParse.varData[ColNum].naxis; for( i=0; ivalue.naxes[i] = gParse.varData[ColNum].naxes[i]; } return(n); } static int New_Unary( int returnType, int Op, int Node1 ) { Node *this, *that; int i,n; if( Node1<0 ) return(-1); that = gParse.Nodes + Node1; if( !Op ) Op = returnType; if( (Op==DOUBLE || Op==FLTCAST) && that->type==DOUBLE ) return( Node1 ); if( (Op==LONG || Op==INTCAST) && that->type==LONG ) return( Node1 ); if( (Op==BOOLEAN ) && that->type==BOOLEAN ) return( Node1 ); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = Op; this->DoOp = Do_Unary; this->nSubNodes = 1; this->SubNodes[0] = Node1; this->type = returnType; that = gParse.Nodes + Node1; /* Reset in case .Nodes mv'd */ this->value.nelem = that->value.nelem; this->value.naxis = that->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that->value.naxes[i]; if( that->operation==CONST_OP ) this->DoOp( this ); } return( n ); } static int New_BinOp( int returnType, int Node1, int Op, int Node2 ) { Node *this,*that1,*that2; int n,i,constant; if( Node1<0 || Node2<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = Op; this->nSubNodes = 2; this->SubNodes[0]= Node1; this->SubNodes[1]= Node2; this->type = returnType; that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; constant = (that1->operation==CONST_OP && that2->operation==CONST_OP); if( that1->type!=STRING && that1->type!=BITSTR ) if( !Test_Dims( Node1, Node2 ) ) { Free_Last_Node(); fferror("Array sizes/dims do not match for binary operator"); return(-1); } if( that1->value.nelem == 1 ) that1 = that2; this->value.nelem = that1->value.nelem; this->value.naxis = that1->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that1->value.naxes[i]; if ( Op == ACCUM && that1->type == BITSTR ) { /* ACCUM is rank-reducing on bit strings */ this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } /* Both subnodes should be of same time */ switch( that1->type ) { case BITSTR: this->DoOp = Do_BinOp_bit; break; case STRING: this->DoOp = Do_BinOp_str; break; case BOOLEAN: this->DoOp = Do_BinOp_log; break; case LONG: this->DoOp = Do_BinOp_lng; break; case DOUBLE: this->DoOp = Do_BinOp_dbl; break; } if( constant ) this->DoOp( this ); } return( n ); } static int New_Func( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7 ) { return New_FuncSize(returnType, Op, nNodes, Node1, Node2, Node3, Node4, Node5, Node6, Node7, 0); } static int New_FuncSize( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7, int Size ) /* If returnType==0 , use Node1's type and vector sizes as returnType, */ /* else return a single value of type returnType */ { Node *this, *that; int i,n,constant; if( Node1<0 || Node2<0 || Node3<0 || Node4<0 || Node5<0 || Node6<0 || Node7<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = (int)Op; this->DoOp = Do_Func; this->nSubNodes = nNodes; this->SubNodes[0] = Node1; this->SubNodes[1] = Node2; this->SubNodes[2] = Node3; this->SubNodes[3] = Node4; this->SubNodes[4] = Node5; this->SubNodes[5] = Node6; this->SubNodes[6] = Node7; i = constant = nNodes; /* Functions with zero params are not const */ if (Op == poirnd_fct) constant = 0; /* Nor is Poisson deviate */ while( i-- ) constant = ( constant && OPER(this->SubNodes[i]) == CONST_OP ); if( returnType ) { this->type = returnType; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } else { that = gParse.Nodes + Node1; this->type = that->type; this->value.nelem = that->value.nelem; this->value.naxis = that->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that->value.naxes[i]; } /* Force explicit size before evaluating */ if (Size > 0) this->value.nelem = Size; if( constant ) this->DoOp( this ); } return( n ); } static int New_Deref( int Var, int nDim, int Dim1, int Dim2, int Dim3, int Dim4, int Dim5 ) { int n, idx, constant; long elem=0; Node *this, *theVar, *theDim[MAXDIMS]; if( Var<0 || Dim1<0 || Dim2<0 || Dim3<0 || Dim4<0 || Dim5<0 ) return(-1); theVar = gParse.Nodes + Var; if( theVar->operation==CONST_OP || theVar->value.nelem==1 ) { fferror("Cannot index a scalar value"); return(-1); } n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->nSubNodes = nDim+1; theVar = gParse.Nodes + (this->SubNodes[0]=Var); theDim[0] = gParse.Nodes + (this->SubNodes[1]=Dim1); theDim[1] = gParse.Nodes + (this->SubNodes[2]=Dim2); theDim[2] = gParse.Nodes + (this->SubNodes[3]=Dim3); theDim[3] = gParse.Nodes + (this->SubNodes[4]=Dim4); theDim[4] = gParse.Nodes + (this->SubNodes[5]=Dim5); constant = theVar->operation==CONST_OP; for( idx=0; idxoperation==CONST_OP); for( idx=0; idxvalue.nelem>1 ) { Free_Last_Node(); fferror("Cannot use an array as an index value"); return(-1); } else if( theDim[idx]->type!=LONG ) { Free_Last_Node(); fferror("Index value must be an integer type"); return(-1); } this->operation = '['; this->DoOp = Do_Deref; this->type = theVar->type; if( theVar->value.naxis == nDim ) { /* All dimensions specified */ this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } else if( nDim==1 ) { /* Dereference only one dimension */ elem=1; this->value.naxis = theVar->value.naxis-1; for( idx=0; idxvalue.naxis; idx++ ) { elem *= ( this->value.naxes[idx] = theVar->value.naxes[idx] ); } this->value.nelem = elem; } else { Free_Last_Node(); fferror("Must specify just one or all indices for vector"); return(-1); } if( constant ) this->DoOp( this ); } return(n); } extern int ffGetVariable( char *varName, FFSTYPE *varVal ); static int New_GTI( char *fname, int Node1, char *start, char *stop ) { fitsfile *fptr; Node *this, *that0, *that1; int type,i,n, startCol, stopCol, Node0; int hdutype, hdunum, evthdu, samefile, extvers, movetotype, tstat; char extname[100]; long nrows; double timeZeroI[2], timeZeroF[2], dt, timeSpan; char xcol[20], xexpr[20]; FFSTYPE colVal; if( Node1==-99 ) { type = ffGetVariable( "TIME", &colVal ); if( type==COLUMN ) { Node1 = New_Column( (int)colVal.lng ); } else { fferror("Could not build TIME column for GTIFILTER"); return(-1); } } Node1 = New_Unary( DOUBLE, 0, Node1 ); Node0 = Alloc_Node(); /* This will hold the START/STOP times */ if( Node1<0 || Node0<0 ) return(-1); /* Record current HDU number in case we need to move within this file */ fptr = gParse.def_fptr; ffghdn( fptr, &evthdu ); /* Look for TIMEZERO keywords in current extension */ tstat = 0; if( ffgkyd( fptr, "TIMEZERO", timeZeroI, NULL, &tstat ) ) { tstat = 0; if( ffgkyd( fptr, "TIMEZERI", timeZeroI, NULL, &tstat ) ) { timeZeroI[0] = timeZeroF[0] = 0.0; } else if( ffgkyd( fptr, "TIMEZERF", timeZeroF, NULL, &tstat ) ) { timeZeroF[0] = 0.0; } } else { timeZeroF[0] = 0.0; } /* Resolve filename parameter */ switch( fname[0] ) { case '\0': samefile = 1; hdunum = 1; break; case '[': samefile = 1; i = 1; while( fname[i] != '\0' && fname[i] != ']' ) i++; if( fname[i] ) { fname[i] = '\0'; fname++; ffexts( fname, &hdunum, extname, &extvers, &movetotype, xcol, xexpr, &gParse.status ); if( *extname ) { ffmnhd( fptr, movetotype, extname, extvers, &gParse.status ); ffghdn( fptr, &hdunum ); } else if( hdunum ) { ffmahd( fptr, ++hdunum, &hdutype, &gParse.status ); } else if( !gParse.status ) { fferror("Cannot use primary array for GTI filter"); return( -1 ); } } else { fferror("File extension specifier lacks closing ']'"); return( -1 ); } break; case '+': samefile = 1; hdunum = atoi( fname ) + 1; if( hdunum>1 ) ffmahd( fptr, hdunum, &hdutype, &gParse.status ); else { fferror("Cannot use primary array for GTI filter"); return( -1 ); } break; default: samefile = 0; if( ! ffopen( &fptr, fname, READONLY, &gParse.status ) ) ffghdn( fptr, &hdunum ); break; } if( gParse.status ) return(-1); /* If at primary, search for GTI extension */ if( hdunum==1 ) { while( 1 ) { hdunum++; if( ffmahd( fptr, hdunum, &hdutype, &gParse.status ) ) break; if( hdutype==IMAGE_HDU ) continue; tstat = 0; if( ffgkys( fptr, "EXTNAME", extname, NULL, &tstat ) ) continue; ffupch( extname ); if( strstr( extname, "GTI" ) ) break; } if( gParse.status ) { if( gParse.status==END_OF_FILE ) fferror("GTI extension not found in this file"); return(-1); } } /* Locate START/STOP Columns */ ffgcno( fptr, CASEINSEN, start, &startCol, &gParse.status ); ffgcno( fptr, CASEINSEN, stop, &stopCol, &gParse.status ); if( gParse.status ) return(-1); /* Look for TIMEZERO keywords in GTI extension */ tstat = 0; if( ffgkyd( fptr, "TIMEZERO", timeZeroI+1, NULL, &tstat ) ) { tstat = 0; if( ffgkyd( fptr, "TIMEZERI", timeZeroI+1, NULL, &tstat ) ) { timeZeroI[1] = timeZeroF[1] = 0.0; } else if( ffgkyd( fptr, "TIMEZERF", timeZeroF+1, NULL, &tstat ) ) { timeZeroF[1] = 0.0; } } else { timeZeroF[1] = 0.0; } n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; this->nSubNodes = 2; this->SubNodes[1] = Node1; this->operation = (int)gtifilt_fct; this->DoOp = Do_GTI; this->type = BOOLEAN; that1 = gParse.Nodes + Node1; this->value.nelem = that1->value.nelem; this->value.naxis = that1->value.naxis; for( i=0; i < that1->value.naxis; i++ ) this->value.naxes[i] = that1->value.naxes[i]; /* Init START/STOP node to be treated as a "constant" */ this->SubNodes[0] = Node0; that0 = gParse.Nodes + Node0; that0->operation = CONST_OP; that0->DoOp = NULL; that0->value.data.ptr= NULL; /* Read in START/STOP times */ if( ffgkyj( fptr, "NAXIS2", &nrows, NULL, &gParse.status ) ) return(-1); that0->value.nelem = nrows; if( nrows ) { that0->value.data.dblptr = (double*)malloc( 2*nrows*sizeof(double) ); if( !that0->value.data.dblptr ) { gParse.status = MEMORY_ALLOCATION; return(-1); } ffgcvd( fptr, startCol, 1L, 1L, nrows, 0.0, that0->value.data.dblptr, &i, &gParse.status ); ffgcvd( fptr, stopCol, 1L, 1L, nrows, 0.0, that0->value.data.dblptr+nrows, &i, &gParse.status ); if( gParse.status ) { free( that0->value.data.dblptr ); return(-1); } /* Test for fully time-ordered GTI... both START && STOP */ that0->type = 1; /* Assume yes */ i = nrows; while( --i ) if( that0->value.data.dblptr[i-1] >= that0->value.data.dblptr[i] || that0->value.data.dblptr[i-1+nrows] >= that0->value.data.dblptr[i+nrows] ) { that0->type = 0; break; } /* Handle TIMEZERO offset, if any */ dt = (timeZeroI[1] - timeZeroI[0]) + (timeZeroF[1] - timeZeroF[0]); timeSpan = that0->value.data.dblptr[nrows+nrows-1] - that0->value.data.dblptr[0]; if( fabs( dt / timeSpan ) > 1e-12 ) { for( i=0; i<(nrows+nrows); i++ ) that0->value.data.dblptr[i] += dt; } } if( OPER(Node1)==CONST_OP ) this->DoOp( this ); } if( samefile ) ffmahd( fptr, evthdu, &hdutype, &gParse.status ); else ffclos( fptr, &gParse.status ); return( n ); } static int New_REG( char *fname, int NodeX, int NodeY, char *colNames ) { Node *this, *that0; int type, n, Node0; int Xcol, Ycol, tstat; WCSdata wcs; SAORegion *Rgn; char *cX, *cY; FFSTYPE colVal; if( NodeX==-99 ) { type = ffGetVariable( "X", &colVal ); if( type==COLUMN ) { NodeX = New_Column( (int)colVal.lng ); } else { fferror("Could not build X column for REGFILTER"); return(-1); } } if( NodeY==-99 ) { type = ffGetVariable( "Y", &colVal ); if( type==COLUMN ) { NodeY = New_Column( (int)colVal.lng ); } else { fferror("Could not build Y column for REGFILTER"); return(-1); } } NodeX = New_Unary( DOUBLE, 0, NodeX ); NodeY = New_Unary( DOUBLE, 0, NodeY ); Node0 = Alloc_Node(); /* This will hold the Region Data */ if( NodeX<0 || NodeY<0 || Node0<0 ) return(-1); if( ! (Test_Dims( NodeX, NodeY ) ) ) { fferror("Dimensions of REGFILTER arguments are not compatible"); return (-1); } n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; this->nSubNodes = 3; this->SubNodes[0] = Node0; this->SubNodes[1] = NodeX; this->SubNodes[2] = NodeY; this->operation = (int)regfilt_fct; this->DoOp = Do_REG; this->type = BOOLEAN; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; Copy_Dims(n, NodeX); if( SIZE(NodeX)operation = CONST_OP; that0->DoOp = NULL; /* Identify what columns to use for WCS information */ Xcol = Ycol = 0; if( *colNames ) { /* Use the column names in this string for WCS info */ while( *colNames==' ' ) colNames++; cX = cY = colNames; while( *cY && *cY!=' ' && *cY!=',' ) cY++; if( *cY ) *(cY++) = '\0'; while( *cY==' ' ) cY++; if( !*cY ) { fferror("Could not extract valid pair of column names from REGFILTER"); Free_Last_Node(); return( -1 ); } fits_get_colnum( gParse.def_fptr, CASEINSEN, cX, &Xcol, &gParse.status ); fits_get_colnum( gParse.def_fptr, CASEINSEN, cY, &Ycol, &gParse.status ); if( gParse.status ) { fferror("Could not locate columns indicated for WCS info"); Free_Last_Node(); return( -1 ); } } else { /* Try to find columns used in X/Y expressions */ Xcol = Locate_Col( gParse.Nodes + NodeX ); Ycol = Locate_Col( gParse.Nodes + NodeY ); if( Xcol<0 || Ycol<0 ) { fferror("Found multiple X/Y column references in REGFILTER"); Free_Last_Node(); return( -1 ); } } /* Now, get the WCS info, if it exists, from the indicated columns */ wcs.exists = 0; if( Xcol>0 && Ycol>0 ) { tstat = 0; ffgtcs( gParse.def_fptr, Xcol, Ycol, &wcs.xrefval, &wcs.yrefval, &wcs.xrefpix, &wcs.yrefpix, &wcs.xinc, &wcs.yinc, &wcs.rot, wcs.type, &tstat ); if( tstat==NO_WCS_KEY ) { wcs.exists = 0; } else if( tstat ) { gParse.status = tstat; Free_Last_Node(); return( -1 ); } else { wcs.exists = 1; } } /* Read in Region file */ fits_read_rgnfile( fname, &wcs, &Rgn, &gParse.status ); if( gParse.status ) { Free_Last_Node(); return( -1 ); } that0->value.data.ptr = Rgn; if( OPER(NodeX)==CONST_OP && OPER(NodeY)==CONST_OP ) this->DoOp( this ); } return( n ); } static int New_Vector( int subNode ) { Node *this, *that; int n; n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; that = gParse.Nodes + subNode; this->type = that->type; this->nSubNodes = 1; this->SubNodes[0] = subNode; this->operation = '{'; this->DoOp = Do_Vector; } return( n ); } static int Close_Vec( int vecNode ) { Node *this; int n, nelem=0; this = gParse.Nodes + vecNode; for( n=0; n < this->nSubNodes; n++ ) { if( TYPE( this->SubNodes[n] ) != this->type ) { this->SubNodes[n] = New_Unary( this->type, 0, this->SubNodes[n] ); if( this->SubNodes[n]<0 ) return(-1); } nelem += SIZE(this->SubNodes[n]); } this->value.naxis = 1; this->value.nelem = nelem; this->value.naxes[0] = nelem; return( vecNode ); } static int Locate_Col( Node *this ) /* Locate the TABLE column number of any columns in "this" calculation. */ /* Return ZERO if none found, or negative if more than 1 found. */ { Node *that; int i, col=0, newCol, nfound=0; if( this->nSubNodes==0 && this->operation<=0 && this->operation!=CONST_OP ) return gParse.colData[ - this->operation].colnum; for( i=0; inSubNodes; i++ ) { that = gParse.Nodes + this->SubNodes[i]; if( that->operation>0 ) { newCol = Locate_Col( that ); if( newCol<=0 ) { nfound += -newCol; } else { if( !nfound ) { col = newCol; nfound++; } else if( col != newCol ) { nfound++; } } } else if( that->operation!=CONST_OP ) { /* Found a Column */ newCol = gParse.colData[- that->operation].colnum; if( !nfound ) { col = newCol; nfound++; } else if( col != newCol ) { nfound++; } } } if( nfound!=1 ) return( - nfound ); else return( col ); } static int Test_Dims( int Node1, int Node2 ) { Node *that1, *that2; int valid, i; if( Node1<0 || Node2<0 ) return(0); that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; if( that1->value.nelem==1 || that2->value.nelem==1 ) valid = 1; else if( that1->type==that2->type && that1->value.nelem==that2->value.nelem && that1->value.naxis==that2->value.naxis ) { valid = 1; for( i=0; ivalue.naxis; i++ ) { if( that1->value.naxes[i]!=that2->value.naxes[i] ) valid = 0; } } else valid = 0; return( valid ); } static void Copy_Dims( int Node1, int Node2 ) { Node *that1, *that2; int i; if( Node1<0 || Node2<0 ) return; that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; that1->value.nelem = that2->value.nelem; that1->value.naxis = that2->value.naxis; for( i=0; ivalue.naxis; i++ ) that1->value.naxes[i] = that2->value.naxes[i]; } /********************************************************************/ /* Routines for actually evaluating the expression start here */ /********************************************************************/ void Evaluate_Parser( long firstRow, long nRows ) /***********************************************************************/ /* Reset the parser for processing another batch of data... */ /* firstRow: Row number of the first element to evaluate */ /* nRows: Number of rows to be processed */ /* Initialize each COLUMN node so that its UNDEF and DATA pointers */ /* point to the appropriate column arrays. */ /* Finally, call Evaluate_Node for final node. */ /***********************************************************************/ { int i, column; long offset, rowOffset; gParse.firstRow = firstRow; gParse.nRows = nRows; /* Reset Column Nodes' pointers to point to right data and UNDEF arrays */ rowOffset = firstRow - gParse.firstDataRow; for( i=0; i 0 || OPER(i) == CONST_OP ) continue; column = -OPER(i); offset = gParse.varData[column].nelem * rowOffset; gParse.Nodes[i].value.undef = gParse.varData[column].undef + offset; switch( gParse.Nodes[i].type ) { case BITSTR: gParse.Nodes[i].value.data.strptr = (char**)gParse.varData[column].data + rowOffset; gParse.Nodes[i].value.undef = NULL; break; case STRING: gParse.Nodes[i].value.data.strptr = (char**)gParse.varData[column].data + rowOffset; gParse.Nodes[i].value.undef = gParse.varData[column].undef + rowOffset; break; case BOOLEAN: gParse.Nodes[i].value.data.logptr = (char*)gParse.varData[column].data + offset; break; case LONG: gParse.Nodes[i].value.data.lngptr = (long*)gParse.varData[column].data + offset; break; case DOUBLE: gParse.Nodes[i].value.data.dblptr = (double*)gParse.varData[column].data + offset; break; } } Evaluate_Node( gParse.resultNode ); } static void Evaluate_Node( int thisNode ) /**********************************************************************/ /* Recursively evaluate thisNode's subNodes, then call one of the */ /* Do_ functions pointed to by thisNode's DoOp element. */ /**********************************************************************/ { Node *this; int i; if( gParse.status ) return; this = gParse.Nodes + thisNode; if( this->operation>0 ) { /* <=0 indicate constants and columns */ i = this->nSubNodes; while( i-- ) { Evaluate_Node( this->SubNodes[i] ); if( gParse.status ) return; } this->DoOp( this ); } } static void Allocate_Ptrs( Node *this ) { long elem, row, size; if( this->type==BITSTR || this->type==STRING ) { this->value.data.strptr = (char**)malloc( gParse.nRows * sizeof(char*) ); if( this->value.data.strptr ) { this->value.data.strptr[0] = (char*)malloc( gParse.nRows * (this->value.nelem+2) * sizeof(char) ); if( this->value.data.strptr[0] ) { row = 0; while( (++row)value.data.strptr[row] = this->value.data.strptr[row-1] + this->value.nelem+1; } if( this->type==STRING ) { this->value.undef = this->value.data.strptr[row-1] + this->value.nelem+1; } else { this->value.undef = NULL; /* BITSTRs don't use undef array */ } } else { gParse.status = MEMORY_ALLOCATION; free( this->value.data.strptr ); } } else { gParse.status = MEMORY_ALLOCATION; } } else { elem = this->value.nelem * gParse.nRows; switch( this->type ) { case DOUBLE: size = sizeof( double ); break; case LONG: size = sizeof( long ); break; case BOOLEAN: size = sizeof( char ); break; default: size = 1; break; } this->value.data.ptr = calloc(size+1, elem); if( this->value.data.ptr==NULL ) { gParse.status = MEMORY_ALLOCATION; } else { this->value.undef = (char *)this->value.data.ptr + elem*size; } } } static void Do_Unary( Node *this ) { Node *that; long elem; that = gParse.Nodes + this->SubNodes[0]; if( that->operation==CONST_OP ) { /* Operating on a constant! */ switch( this->operation ) { case DOUBLE: case FLTCAST: if( that->type==LONG ) this->value.data.dbl = (double)that->value.data.lng; else if( that->type==BOOLEAN ) this->value.data.dbl = ( that->value.data.log ? 1.0 : 0.0 ); break; case LONG: case INTCAST: if( that->type==DOUBLE ) this->value.data.lng = (long)that->value.data.dbl; else if( that->type==BOOLEAN ) this->value.data.lng = ( that->value.data.log ? 1L : 0L ); break; case BOOLEAN: if( that->type==DOUBLE ) this->value.data.log = ( that->value.data.dbl != 0.0 ); else if( that->type==LONG ) this->value.data.log = ( that->value.data.lng != 0L ); break; case UMINUS: if( that->type==DOUBLE ) this->value.data.dbl = - that->value.data.dbl; else if( that->type==LONG ) this->value.data.lng = - that->value.data.lng; break; case NOT: if( that->type==BOOLEAN ) this->value.data.log = ( ! that->value.data.log ); else if( that->type==BITSTR ) bitnot( this->value.data.str, that->value.data.str ); break; } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { if( this->type!=BITSTR ) { elem = gParse.nRows; if( this->type!=STRING ) elem *= this->value.nelem; while( elem-- ) this->value.undef[elem] = that->value.undef[elem]; } elem = gParse.nRows * this->value.nelem; switch( this->operation ) { case BOOLEAN: if( that->type==DOUBLE ) while( elem-- ) this->value.data.logptr[elem] = ( that->value.data.dblptr[elem] != 0.0 ); else if( that->type==LONG ) while( elem-- ) this->value.data.logptr[elem] = ( that->value.data.lngptr[elem] != 0L ); break; case DOUBLE: case FLTCAST: if( that->type==LONG ) while( elem-- ) this->value.data.dblptr[elem] = (double)that->value.data.lngptr[elem]; else if( that->type==BOOLEAN ) while( elem-- ) this->value.data.dblptr[elem] = ( that->value.data.logptr[elem] ? 1.0 : 0.0 ); break; case LONG: case INTCAST: if( that->type==DOUBLE ) while( elem-- ) this->value.data.lngptr[elem] = (long)that->value.data.dblptr[elem]; else if( that->type==BOOLEAN ) while( elem-- ) this->value.data.lngptr[elem] = ( that->value.data.logptr[elem] ? 1L : 0L ); break; case UMINUS: if( that->type==DOUBLE ) { while( elem-- ) this->value.data.dblptr[elem] = - that->value.data.dblptr[elem]; } else if( that->type==LONG ) { while( elem-- ) this->value.data.lngptr[elem] = - that->value.data.lngptr[elem]; } break; case NOT: if( that->type==BOOLEAN ) { while( elem-- ) this->value.data.logptr[elem] = ( ! that->value.data.logptr[elem] ); } else if( that->type==BITSTR ) { elem = gParse.nRows; while( elem-- ) bitnot( this->value.data.strptr[elem], that->value.data.strptr[elem] ); } break; } } } if( that->operation>0 ) { free( that->value.data.ptr ); } } static void Do_Offset( Node *this ) { Node *col; long fRow, nRowOverlap, nRowReload, rowOffset; long nelem, elem, offset, nRealElem; int status; col = gParse.Nodes + this->SubNodes[0]; rowOffset = gParse.Nodes[ this->SubNodes[1] ].value.data.lng; Allocate_Ptrs( this ); fRow = gParse.firstRow + rowOffset; if( this->type==STRING || this->type==BITSTR ) nRealElem = 1; else nRealElem = this->value.nelem; nelem = nRealElem; if( fRow < gParse.firstDataRow ) { /* Must fill in data at start of array */ nRowReload = gParse.firstDataRow - fRow; if( nRowReload > gParse.nRows ) nRowReload = gParse.nRows; nRowOverlap = gParse.nRows - nRowReload; offset = 0; /* NULLify any values falling out of bounds */ while( fRow<1 && nRowReload>0 ) { if( this->type == BITSTR ) { nelem = this->value.nelem; this->value.data.strptr[offset][ nelem ] = '\0'; while( nelem-- ) this->value.data.strptr[offset][nelem] = '0'; offset++; } else { while( nelem-- ) this->value.undef[offset++] = 1; } nelem = nRealElem; fRow++; nRowReload--; } } else if( fRow + gParse.nRows > gParse.firstDataRow + gParse.nDataRows ) { /* Must fill in data at end of array */ nRowReload = (fRow+gParse.nRows) - (gParse.firstDataRow+gParse.nDataRows); if( nRowReload>gParse.nRows ) { nRowReload = gParse.nRows; } else { fRow = gParse.firstDataRow + gParse.nDataRows; } nRowOverlap = gParse.nRows - nRowReload; offset = nRowOverlap * nelem; /* NULLify any values falling out of bounds */ elem = gParse.nRows * nelem; while( fRow+nRowReload>gParse.totalRows && nRowReload>0 ) { if( this->type == BITSTR ) { nelem = this->value.nelem; elem--; this->value.data.strptr[elem][ nelem ] = '\0'; while( nelem-- ) this->value.data.strptr[elem][nelem] = '0'; } else { while( nelem-- ) this->value.undef[--elem] = 1; } nelem = nRealElem; nRowReload--; } } else { nRowReload = 0; nRowOverlap = gParse.nRows; offset = 0; } if( nRowReload>0 ) { switch( this->type ) { case BITSTR: case STRING: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.strptr+offset, this->value.undef+offset ); break; case BOOLEAN: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.logptr+offset, this->value.undef+offset ); break; case LONG: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.lngptr+offset, this->value.undef+offset ); break; case DOUBLE: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.dblptr+offset, this->value.undef+offset ); break; } } /* Now copy over the overlapping region, if any */ if( nRowOverlap <= 0 ) return; if( rowOffset>0 ) elem = nRowOverlap * nelem; else elem = gParse.nRows * nelem; offset = nelem * rowOffset; while( nRowOverlap-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( this->type != BITSTR ) this->value.undef[elem] = col->value.undef[elem+offset]; switch( this->type ) { case BITSTR: strcpy( this->value.data.strptr[elem ], col->value.data.strptr[elem+offset] ); break; case STRING: strcpy( this->value.data.strptr[elem ], col->value.data.strptr[elem+offset] ); break; case BOOLEAN: this->value.data.logptr[elem] = col->value.data.logptr[elem+offset]; break; case LONG: this->value.data.lngptr[elem] = col->value.data.lngptr[elem+offset]; break; case DOUBLE: this->value.data.dblptr[elem] = col->value.data.dblptr[elem+offset]; break; } } nelem = nRealElem; } } static void Do_BinOp_bit( Node *this ) { Node *that1, *that2; char *sptr1=NULL, *sptr2=NULL; int const1, const2; long rows; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; const1 = ( that1->operation==CONST_OP ); const2 = ( that2->operation==CONST_OP ); sptr1 = ( const1 ? that1->value.data.str : NULL ); sptr2 = ( const2 ? that2->value.data.str : NULL ); if( const1 && const2 ) { switch( this->operation ) { case NE: this->value.data.log = !bitcmp( sptr1, sptr2 ); break; case EQ: this->value.data.log = bitcmp( sptr1, sptr2 ); break; case GT: case LT: case LTE: case GTE: this->value.data.log = bitlgte( sptr1, this->operation, sptr2 ); break; case '|': bitor( this->value.data.str, sptr1, sptr2 ); break; case '&': bitand( this->value.data.str, sptr1, sptr2 ); break; case '+': strcpy( this->value.data.str, sptr1 ); strcat( this->value.data.str, sptr2 ); break; case ACCUM: this->value.data.lng = 0; while( *sptr1 ) { if ( *sptr1 == '1' ) this->value.data.lng ++; sptr1 ++; } break; } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; switch( this->operation ) { /* BITSTR comparisons */ case NE: case EQ: case GT: case LT: case LTE: case GTE: while( rows-- ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; switch( this->operation ) { case NE: this->value.data.logptr[rows] = !bitcmp( sptr1, sptr2 ); break; case EQ: this->value.data.logptr[rows] = bitcmp( sptr1, sptr2 ); break; case GT: case LT: case LTE: case GTE: this->value.data.logptr[rows] = bitlgte( sptr1, this->operation, sptr2 ); break; } this->value.undef[rows] = 0; } break; /* BITSTR AND/ORs ... no UNDEFS in or out */ case '|': case '&': case '+': while( rows-- ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; if( this->operation=='|' ) bitor( this->value.data.strptr[rows], sptr1, sptr2 ); else if( this->operation=='&' ) bitand( this->value.data.strptr[rows], sptr1, sptr2 ); else { strcpy( this->value.data.strptr[rows], sptr1 ); strcat( this->value.data.strptr[rows], sptr2 ); } } break; /* Accumulate 1 bits */ case ACCUM: { long i, previous, curr; previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.data.strptr[i]; for (curr = 0; *sptr1; sptr1 ++) { if ( *sptr1 == '1' ) curr ++; } previous += curr; this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } } } } if( that1->operation>0 ) { free( that1->value.data.strptr[0] ); free( that1->value.data.strptr ); } if( that2->operation>0 ) { free( that2->value.data.strptr[0] ); free( that2->value.data.strptr ); } } static void Do_BinOp_str( Node *this ) { Node *that1, *that2; char *sptr1, *sptr2, null1=0, null2=0; int const1, const2, val; long rows; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; const1 = ( that1->operation==CONST_OP ); const2 = ( that2->operation==CONST_OP ); sptr1 = ( const1 ? that1->value.data.str : NULL ); sptr2 = ( const2 ? that2->value.data.str : NULL ); if( const1 && const2 ) { /* Result is a constant */ switch( this->operation ) { /* Compare Strings */ case NE: case EQ: val = ( FSTRCMP( sptr1, sptr2 ) == 0 ); this->value.data.log = ( this->operation==EQ ? val : !val ); break; case GT: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) > 0 ); break; case LT: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) < 0 ); break; case GTE: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) >= 0 ); break; case LTE: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) <= 0 ); break; /* Concat Strings */ case '+': strcpy( this->value.data.str, sptr1 ); strcat( this->value.data.str, sptr2 ); break; } this->operation = CONST_OP; } else { /* Not a constant */ Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; switch( this->operation ) { /* Compare Strings */ case NE: case EQ: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) == 0 ); this->value.data.logptr[rows] = ( this->operation==EQ ? val : !val ); } } break; case GT: case LT: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) ); this->value.data.logptr[rows] = ( this->operation==GT ? val>0 : val<0 ); } } break; case GTE: case LTE: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) ); this->value.data.logptr[rows] = ( this->operation==GTE ? val>=0 : val<=0 ); } } break; /* Concat Strings */ case '+': while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; strcpy( this->value.data.strptr[rows], sptr1 ); strcat( this->value.data.strptr[rows], sptr2 ); } } break; } } } if( that1->operation>0 ) { free( that1->value.data.strptr[0] ); free( that1->value.data.strptr ); } if( that2->operation>0 ) { free( that2->value.data.strptr[0] ); free( that2->value.data.strptr ); } } static void Do_BinOp_log( Node *this ) { Node *that1, *that2; int vector1, vector2; char val1=0, val2=0, null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.log; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.log; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case OR: this->value.data.log = (val1 || val2); break; case AND: this->value.data.log = (val1 && val2); break; case EQ: this->value.data.log = ( (val1 && val2) || (!val1 && !val2) ); break; case NE: this->value.data.log = ( (val1 && !val2) || (!val1 && val2) ); break; case ACCUM: this->value.data.lng = val1; break; } this->operation=CONST_OP; } else if (this->operation == ACCUM) { long i, previous, curr; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.logptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { if (this->operation == ACCUM) { long i, previous, curr; previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.logptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } while( rows-- ) { while( nelem-- ) { elem--; if( vector1>1 ) { val1 = that1->value.data.logptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.logptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.logptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.logptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case OR: /* This is more complicated than others to suppress UNDEFs */ /* in those cases where the other argument is DEF && TRUE */ if( !null1 && !null2 ) { this->value.data.logptr[elem] = (val1 || val2); } else if( (null1 && !null2 && val2) || ( !null1 && null2 && val1 ) ) { this->value.data.logptr[elem] = 1; this->value.undef[elem] = 0; } break; case AND: /* This is more complicated than others to suppress UNDEFs */ /* in those cases where the other argument is DEF && FALSE */ if( !null1 && !null2 ) { this->value.data.logptr[elem] = (val1 && val2); } else if( (null1 && !null2 && !val2) || ( !null1 && null2 && !val1 ) ) { this->value.data.logptr[elem] = 0; this->value.undef[elem] = 0; } break; case EQ: this->value.data.logptr[elem] = ( (val1 && val2) || (!val1 && !val2) ); break; case NE: this->value.data.logptr[elem] = ( (val1 && !val2) || (!val1 && val2) ); break; } } nelem = this->value.nelem; } } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } static void Do_BinOp_lng( Node *this ) { Node *that1, *that2; int vector1, vector2; long val1=0, val2=0; char null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.lng; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.lng; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case '~': /* Treat as == for LONGS */ case EQ: this->value.data.log = (val1 == val2); break; case NE: this->value.data.log = (val1 != val2); break; case GT: this->value.data.log = (val1 > val2); break; case LT: this->value.data.log = (val1 < val2); break; case LTE: this->value.data.log = (val1 <= val2); break; case GTE: this->value.data.log = (val1 >= val2); break; case '+': this->value.data.lng = (val1 + val2); break; case '-': this->value.data.lng = (val1 - val2); break; case '*': this->value.data.lng = (val1 * val2); break; case '%': if( val2 ) this->value.data.lng = (val1 % val2); else fferror("Divide by Zero"); break; case '/': if( val2 ) this->value.data.lng = (val1 / val2); else fferror("Divide by Zero"); break; case POWER: this->value.data.lng = (long)pow((double)val1,(double)val2); break; case ACCUM: this->value.data.lng = val1; break; case DIFF: this->value.data.lng = 0; break; } this->operation=CONST_OP; } else if ((this->operation == ACCUM) || (this->operation == DIFF)) { long i, previous, curr; long undef; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.lng; undef = (long) that2->value.undef; if (this->operation == ACCUM) { /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.lngptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } } else { /* Sequential difference for this chunk */ for (i=0; ivalue.data.lngptr[i]; if (that1->value.undef[i] || undef) { /* Either this, or previous, value was undefined */ this->value.data.lngptr[i] = 0; this->value.undef[i] = 1; } else { /* Both defined, we are okay! */ this->value.data.lngptr[i] = curr - previous; this->value.undef[i] = 0; } previous = curr; undef = that1->value.undef[i]; } } /* Store final cumulant for next pass */ that2->value.data.lng = previous; that2->value.undef = (char *) undef; /* XXX evil, but no harm here */ } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); while( rows-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( vector1>1 ) { val1 = that1->value.data.lngptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.lngptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.lngptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.lngptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case '~': /* Treat as == for LONGS */ case EQ: this->value.data.logptr[elem] = (val1 == val2); break; case NE: this->value.data.logptr[elem] = (val1 != val2); break; case GT: this->value.data.logptr[elem] = (val1 > val2); break; case LT: this->value.data.logptr[elem] = (val1 < val2); break; case LTE: this->value.data.logptr[elem] = (val1 <= val2); break; case GTE: this->value.data.logptr[elem] = (val1 >= val2); break; case '+': this->value.data.lngptr[elem] = (val1 + val2); break; case '-': this->value.data.lngptr[elem] = (val1 - val2); break; case '*': this->value.data.lngptr[elem] = (val1 * val2); break; case '%': if( val2 ) this->value.data.lngptr[elem] = (val1 % val2); else { this->value.data.lngptr[elem] = 0; this->value.undef[elem] = 1; } break; case '/': if( val2 ) this->value.data.lngptr[elem] = (val1 / val2); else { this->value.data.lngptr[elem] = 0; this->value.undef[elem] = 1; } break; case POWER: this->value.data.lngptr[elem] = (long)pow((double)val1,(double)val2); break; } } nelem = this->value.nelem; } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } static void Do_BinOp_dbl( Node *this ) { Node *that1, *that2; int vector1, vector2; double val1=0.0, val2=0.0; char null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.dbl; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.dbl; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case '~': this->value.data.log = ( fabs(val1-val2) < APPROX ); break; case EQ: this->value.data.log = (val1 == val2); break; case NE: this->value.data.log = (val1 != val2); break; case GT: this->value.data.log = (val1 > val2); break; case LT: this->value.data.log = (val1 < val2); break; case LTE: this->value.data.log = (val1 <= val2); break; case GTE: this->value.data.log = (val1 >= val2); break; case '+': this->value.data.dbl = (val1 + val2); break; case '-': this->value.data.dbl = (val1 - val2); break; case '*': this->value.data.dbl = (val1 * val2); break; case '%': if( val2 ) this->value.data.dbl = val1 - val2*((int)(val1/val2)); else fferror("Divide by Zero"); break; case '/': if( val2 ) this->value.data.dbl = (val1 / val2); else fferror("Divide by Zero"); break; case POWER: this->value.data.dbl = (double)pow(val1,val2); break; case ACCUM: this->value.data.dbl = val1; break; case DIFF: this->value.data.dbl = 0; break; } this->operation=CONST_OP; } else if ((this->operation == ACCUM) || (this->operation == DIFF)) { long i; long undef; double previous, curr; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.dbl; undef = (long) that2->value.undef; if (this->operation == ACCUM) { /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.dblptr[i]; previous += curr; } this->value.data.dblptr[i] = previous; this->value.undef[i] = 0; } } else { /* Sequential difference for this chunk */ for (i=0; ivalue.data.dblptr[i]; if (that1->value.undef[i] || undef) { /* Either this, or previous, value was undefined */ this->value.data.dblptr[i] = 0; this->value.undef[i] = 1; } else { /* Both defined, we are okay! */ this->value.data.dblptr[i] = curr - previous; this->value.undef[i] = 0; } previous = curr; undef = that1->value.undef[i]; } } /* Store final cumulant for next pass */ that2->value.data.dbl = previous; that2->value.undef = (char *) undef; /* XXX evil, but no harm here */ } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); while( rows-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( vector1>1 ) { val1 = that1->value.data.dblptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.dblptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.dblptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.dblptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case '~': this->value.data.logptr[elem] = ( fabs(val1-val2) < APPROX ); break; case EQ: this->value.data.logptr[elem] = (val1 == val2); break; case NE: this->value.data.logptr[elem] = (val1 != val2); break; case GT: this->value.data.logptr[elem] = (val1 > val2); break; case LT: this->value.data.logptr[elem] = (val1 < val2); break; case LTE: this->value.data.logptr[elem] = (val1 <= val2); break; case GTE: this->value.data.logptr[elem] = (val1 >= val2); break; case '+': this->value.data.dblptr[elem] = (val1 + val2); break; case '-': this->value.data.dblptr[elem] = (val1 - val2); break; case '*': this->value.data.dblptr[elem] = (val1 * val2); break; case '%': if( val2 ) this->value.data.dblptr[elem] = val1 - val2*((int)(val1/val2)); else { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } break; case '/': if( val2 ) this->value.data.dblptr[elem] = (val1 / val2); else { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } break; case POWER: this->value.data.dblptr[elem] = (double)pow(val1,val2); break; } } nelem = this->value.nelem; } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } /* * This Quickselect routine is based on the algorithm described in * "Numerical recipes in C", Second Edition, * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5 * This code by Nicolas Devillard - 1998. Public domain. * http://ndevilla.free.fr/median/median/src/quickselect.c */ #define ELEM_SWAP(a,b) { register long t=(a);(a)=(b);(b)=t; } /* * qselect_median_lng - select the median value of a long array * * This routine selects the median value of the long integer array * arr[]. If there are an even number of elements, the "lower median" * is selected. * * The array arr[] is scrambled, so users must operate on a scratch * array if they wish the values to be preserved. * * long arr[] - array of values * int n - number of elements in arr * * RETURNS: the lower median value of arr[] * */ long qselect_median_lng(long arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) { /* One element only */ return arr[median]; } if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median]; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP #define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; } /* * qselect_median_dbl - select the median value of a double array * * This routine selects the median value of the double array * arr[]. If there are an even number of elements, the "lower median" * is selected. * * The array arr[] is scrambled, so users must operate on a scratch * array if they wish the values to be preserved. * * double arr[] - array of values * int n - number of elements in arr * * RETURNS: the lower median value of arr[] * */ double qselect_median_dbl(double arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) { /* One element only */ return arr[median] ; } if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /* * angsep_calc - compute angular separation between celestial coordinates * * This routine computes the angular separation between to coordinates * on the celestial sphere (i.e. RA and Dec). Note that all units are * in DEGREES, unlike the other trig functions in the calculator. * * double ra1, dec1 - RA and Dec of the first position in degrees * double ra2, dec2 - RA and Dec of the second position in degrees * * RETURNS: (double) angular separation in degrees * */ double angsep_calc(double ra1, double dec1, double ra2, double dec2) { double cd; static double deg = 0; double a, sdec, sra; if (deg == 0) deg = ((double)4)*atan((double)1)/((double)180); /* deg = 1.0; **** UNCOMMENT IF YOU WANT RADIANS */ /* This (commented out) algorithm uses the Low of Cosines, which becomes unstable for angles less than 0.1 arcsec. cd = sin(dec1*deg)*sin(dec2*deg) + cos(dec1*deg)*cos(dec2*deg)*cos((ra1-ra2)*deg); if (cd < (-1)) cd = -1; if (cd > (+1)) cd = +1; return acos(cd)/deg; */ /* The algorithm is the law of Haversines. This algorithm is stable even when the points are close together. The normal Law of Cosines fails for angles around 0.1 arcsec. */ sra = sin( (ra2 - ra1)*deg / 2 ); sdec = sin( (dec2 - dec1)*deg / 2); a = sdec*sdec + cos(dec1*deg)*cos(dec2*deg)*sra*sra; /* Sanity checking to avoid a range error in the sqrt()'s below */ if (a < 0) { a = 0; } if (a > 1) { a = 1; } return 2.0*atan2(sqrt(a), sqrt(1.0 - a)) / deg; } static double ran1() { static double dval = 0.0; double rndVal; if (dval == 0.0) { if( rand()<32768 && rand()<32768 ) dval = 32768.0; else dval = 2147483648.0; } rndVal = (double)rand(); while( rndVal > dval ) dval *= 2.0; return rndVal/dval; } /* Gaussian deviate routine from Numerical Recipes */ static double gasdev() { static int iset = 0; static double gset; double fac, rsq, v1, v2; if (iset == 0) { do { v1 = 2.0*ran1()-1.0; v2 = 2.0*ran1()-1.0; rsq = v1*v1 + v2*v2; } while (rsq >= 1.0 || rsq == 0.0); fac = sqrt(-2.0*log(rsq)/rsq); gset = v1*fac; iset = 1; return v2*fac; } else { iset = 0; return gset; } } /* lgamma function - from Numerical Recipes */ float gammaln(float xx) /* Returns the value ln Gamma[(xx)] for xx > 0. */ { /* Internal arithmetic will be done in double precision, a nicety that you can omit if five-figure accuracy is good enough. */ double x,y,tmp,ser; static double cof[6]={76.18009172947146,-86.50532032941677, 24.01409824083091,-1.231739572450155, 0.1208650973866179e-2,-0.5395239384953e-5}; int j; y=x=xx; tmp=x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.000000000190015; for (j=0;j<=5;j++) ser += cof[j]/++y; return (float) -tmp+log(2.5066282746310005*ser/x); } /* Poisson deviate - derived from Numerical Recipes */ static long poidev(double xm) { static double sq, alxm, g, oldm = -1.0; static double pi = 0; double em, t, y; if (pi == 0) pi = ((double)4)*atan((double)1); if (xm < 20.0) { if (xm != oldm) { oldm = xm; g = exp(-xm); } em = -1; t = 1.0; do { em += 1; t *= ran1(); } while (t > g); } else { if (xm != oldm) { oldm = xm; sq = sqrt(2.0*xm); alxm = log(xm); g = xm*alxm-gammaln( (float) (xm+1.0)); } do { do { y = tan(pi*ran1()); em = sq*y+xm; } while (em < 0.0); em = floor(em); t = 0.9*(1.0+y*y)*exp(em*alxm-gammaln( (float) (em+1.0) )-g); } while (ran1() > t); } /* Return integer version */ return (long int) floor(em+0.5); } static void Do_Func( Node *this ) { Node *theParams[MAXSUBS]; int vector[MAXSUBS], allConst; lval pVals[MAXSUBS]; char pNull[MAXSUBS]; long ival; double dval; int i, valInit; long row, elem, nelem; i = this->nSubNodes; allConst = 1; while( i-- ) { theParams[i] = gParse.Nodes + this->SubNodes[i]; vector[i] = ( theParams[i]->operation!=CONST_OP ); if( vector[i] ) { allConst = 0; vector[i] = theParams[i]->value.nelem; } else { if( theParams[i]->type==DOUBLE ) { pVals[i].data.dbl = theParams[i]->value.data.dbl; } else if( theParams[i]->type==LONG ) { pVals[i].data.lng = theParams[i]->value.data.lng; } else if( theParams[i]->type==BOOLEAN ) { pVals[i].data.log = theParams[i]->value.data.log; } else strcpy(pVals[i].data.str, theParams[i]->value.data.str); pNull[i] = 0; } } if( this->nSubNodes==0 ) allConst = 0; /* These do produce scalars */ /* Random numbers are *never* constant !! */ if( this->operation == poirnd_fct ) allConst = 0; if( this->operation == gasrnd_fct ) allConst = 0; if( this->operation == rnd_fct ) allConst = 0; if( allConst ) { switch( this->operation ) { /* Non-Trig single-argument functions */ case sum_fct: if( theParams[0]->type==BOOLEAN ) this->value.data.lng = ( pVals[0].data.log ? 1 : 0 ); else if( theParams[0]->type==LONG ) this->value.data.lng = pVals[0].data.lng; else if( theParams[0]->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( theParams[0]->type==BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case average_fct: if( theParams[0]->type==LONG ) this->value.data.dbl = pVals[0].data.lng; else if( theParams[0]->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; break; case stddev_fct: this->value.data.dbl = 0; /* Standard deviation of a constant = 0 */ break; case median_fct: if( theParams[0]->type==BOOLEAN ) this->value.data.lng = ( pVals[0].data.log ? 1 : 0 ); else if( theParams[0]->type==LONG ) this->value.data.lng = pVals[0].data.lng; else this->value.data.dbl = pVals[0].data.dbl; break; case poirnd_fct: if( theParams[0]->type==DOUBLE ) this->value.data.lng = poidev(pVals[0].data.dbl); else this->value.data.lng = poidev(pVals[0].data.lng); break; case abs_fct: if( theParams[0]->type==DOUBLE ) { dval = pVals[0].data.dbl; this->value.data.dbl = (dval>0.0 ? dval : -dval); } else { ival = pVals[0].data.lng; this->value.data.lng = (ival> 0 ? ival : -ival); } break; /* Special Null-Handling Functions */ case nonnull_fct: this->value.data.lng = 1; /* Constants are always 1-element and defined */ break; case isnull_fct: /* Constants are always defined */ this->value.data.log = 0; break; case defnull_fct: if( this->type==BOOLEAN ) this->value.data.log = pVals[0].data.log; else if( this->type==LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type==STRING ) strcpy(this->value.data.str,pVals[0].data.str); break; /* Math functions with 1 double argument */ case sin_fct: this->value.data.dbl = sin( pVals[0].data.dbl ); break; case cos_fct: this->value.data.dbl = cos( pVals[0].data.dbl ); break; case tan_fct: this->value.data.dbl = tan( pVals[0].data.dbl ); break; case asin_fct: dval = pVals[0].data.dbl; if( dval<-1.0 || dval>1.0 ) fferror("Out of range argument to arcsin"); else this->value.data.dbl = asin( dval ); break; case acos_fct: dval = pVals[0].data.dbl; if( dval<-1.0 || dval>1.0 ) fferror("Out of range argument to arccos"); else this->value.data.dbl = acos( dval ); break; case atan_fct: this->value.data.dbl = atan( pVals[0].data.dbl ); break; case sinh_fct: this->value.data.dbl = sinh( pVals[0].data.dbl ); break; case cosh_fct: this->value.data.dbl = cosh( pVals[0].data.dbl ); break; case tanh_fct: this->value.data.dbl = tanh( pVals[0].data.dbl ); break; case exp_fct: this->value.data.dbl = exp( pVals[0].data.dbl ); break; case log_fct: dval = pVals[0].data.dbl; if( dval<=0.0 ) fferror("Out of range argument to log"); else this->value.data.dbl = log( dval ); break; case log10_fct: dval = pVals[0].data.dbl; if( dval<=0.0 ) fferror("Out of range argument to log10"); else this->value.data.dbl = log10( dval ); break; case sqrt_fct: dval = pVals[0].data.dbl; if( dval<0.0 ) fferror("Out of range argument to sqrt"); else this->value.data.dbl = sqrt( dval ); break; case ceil_fct: this->value.data.dbl = ceil( pVals[0].data.dbl ); break; case floor_fct: this->value.data.dbl = floor( pVals[0].data.dbl ); break; case round_fct: this->value.data.dbl = floor( pVals[0].data.dbl + 0.5 ); break; /* Two-argument Trig Functions */ case atan2_fct: this->value.data.dbl = atan2( pVals[0].data.dbl, pVals[1].data.dbl ); break; /* Four-argument ANGSEP function */ case angsep_fct: this->value.data.dbl = angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl); /* Min/Max functions taking 1 or 2 arguments */ case min1_fct: /* No constant vectors! */ if( this->type == DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type == LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type == BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case min2_fct: if( this->type == DOUBLE ) this->value.data.dbl = minvalue( pVals[0].data.dbl, pVals[1].data.dbl ); else if( this->type == LONG ) this->value.data.lng = minvalue( pVals[0].data.lng, pVals[1].data.lng ); break; case max1_fct: /* No constant vectors! */ if( this->type == DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type == LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type == BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case max2_fct: if( this->type == DOUBLE ) this->value.data.dbl = maxvalue( pVals[0].data.dbl, pVals[1].data.dbl ); else if( this->type == LONG ) this->value.data.lng = maxvalue( pVals[0].data.lng, pVals[1].data.lng ); break; /* Boolean SAO region Functions... scalar or vector dbls */ case near_fct: this->value.data.log = bnear( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl ); break; case circle_fct: this->value.data.log = circle( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl ); break; case box_fct: this->value.data.log = saobox( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); break; case elps_fct: this->value.data.log = ellipse( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); break; /* C Conditional expression: bool ? expr : expr */ case ifthenelse_fct: switch( this->type ) { case BOOLEAN: this->value.data.log = ( pVals[2].data.log ? pVals[0].data.log : pVals[1].data.log ); break; case LONG: this->value.data.lng = ( pVals[2].data.log ? pVals[0].data.lng : pVals[1].data.lng ); break; case DOUBLE: this->value.data.dbl = ( pVals[2].data.log ? pVals[0].data.dbl : pVals[1].data.dbl ); break; case STRING: strcpy(this->value.data.str, ( pVals[2].data.log ? pVals[0].data.str : pVals[1].data.str ) ); break; } break; /* String functions */ case strmid_fct: cstrmid(this->value.data.str, this->value.nelem, pVals[0].data.str, pVals[0].nelem, pVals[1].data.lng); break; case strpos_fct: { char *res = strstr(pVals[0].data.str, pVals[1].data.str); if (res == NULL) { this->value.data.lng = 0; } else { this->value.data.lng = (res - pVals[0].data.str) + 1; } break; } } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); row = gParse.nRows; elem = row * this->value.nelem; if( !gParse.status ) { switch( this->operation ) { /* Special functions with no arguments */ case row_fct: while( row-- ) { this->value.data.lngptr[row] = gParse.firstRow + row; this->value.undef[row] = 0; } break; case null_fct: if( this->type==LONG ) { while( row-- ) { this->value.data.lngptr[row] = 0; this->value.undef[row] = 1; } } else if( this->type==STRING ) { while( row-- ) { this->value.data.strptr[row][0] = '\0'; this->value.undef[row] = 1; } } break; case rnd_fct: while( elem-- ) { this->value.data.dblptr[elem] = ran1(); this->value.undef[elem] = 0; } break; case gasrnd_fct: while( elem-- ) { this->value.data.dblptr[elem] = gasdev(); this->value.undef[elem] = 0; } break; case poirnd_fct: if( theParams[0]->type==DOUBLE ) { if (theParams[0]->operation == CONST_OP) { while( elem-- ) { this->value.undef[elem] = (pVals[0].data.dbl < 0); if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(pVals[0].data.dbl); } } } else { while( elem-- ) { this->value.undef[elem] = theParams[0]->value.undef[elem]; if (theParams[0]->value.data.dblptr[elem] < 0) this->value.undef[elem] = 1; if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(theParams[0]->value.data.dblptr[elem]); } } /* while */ } /* ! CONST_OP */ } else { /* LONG */ if (theParams[0]->operation == CONST_OP) { while( elem-- ) { this->value.undef[elem] = (pVals[0].data.lng < 0); if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(pVals[0].data.lng); } } } else { while( elem-- ) { this->value.undef[elem] = theParams[0]->value.undef[elem]; if (theParams[0]->value.data.lngptr[elem] < 0) this->value.undef[elem] = 1; if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(theParams[0]->value.data.lngptr[elem]); } } /* while */ } /* ! CONST_OP */ } /* END LONG */ break; /* Non-Trig single-argument functions */ case sum_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==BOOLEAN ) { while( row-- ) { this->value.data.lngptr[row] = 0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.lngptr[row] += ( theParams[0]->value.data.logptr[elem] ? 1 : 0 ); this->value.undef[row] = 0; } } } } else if( theParams[0]->type==LONG ) { while( row-- ) { this->value.data.lngptr[row] = 0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.lngptr[row] += theParams[0]->value.data.lngptr[elem]; this->value.undef[row] = 0; } } } } else if( theParams[0]->type==DOUBLE ){ while( row-- ) { this->value.data.dblptr[row] = 0.0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.dblptr[row] += theParams[0]->value.data.dblptr[elem]; this->value.undef[row] = 0; } } } } else { /* BITSTR */ nelem = theParams[0]->value.nelem; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; this->value.data.lngptr[row] = 0; this->value.undef[row] = 0; while (*sptr1) { if (*sptr1 == '1') this->value.data.lngptr[row] ++; sptr1++; } } } break; case average_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { while( row-- ) { int count = 0; this->value.data.dblptr[row] = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { this->value.data.dblptr[row] += theParams[0]->value.data.lngptr[elem]; count ++; } } if (count == 0) { this->value.undef[row] = 1; } else { this->value.undef[row] = 0; this->value.data.dblptr[row] /= count; } } } else if( theParams[0]->type==DOUBLE ){ while( row-- ) { int count = 0; this->value.data.dblptr[row] = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { this->value.data.dblptr[row] += theParams[0]->value.data.dblptr[elem]; count ++; } } if (count == 0) { this->value.undef[row] = 1; } else { this->value.undef[row] = 0; this->value.data.dblptr[row] /= count; } } } break; case stddev_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { /* Compute the mean value */ while( row-- ) { int count = 0; double sum = 0, sum2 = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { sum += theParams[0]->value.data.lngptr[elem]; count ++; } } if (count > 1) { sum /= count; /* Compute the sum of squared deviations */ nelem = theParams[0]->value.nelem; elem += nelem; /* Reset elem for second pass */ while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { double dx = (theParams[0]->value.data.lngptr[elem] - sum); sum2 += (dx*dx); } } sum2 /= (double)count-1; this->value.undef[row] = 0; this->value.data.dblptr[row] = sqrt(sum2); } else { this->value.undef[row] = 0; /* STDDEV => 0 */ this->value.data.dblptr[row] = 0; } } } else if( theParams[0]->type==DOUBLE ){ /* Compute the mean value */ while( row-- ) { int count = 0; double sum = 0, sum2 = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { sum += theParams[0]->value.data.dblptr[elem]; count ++; } } if (count > 1) { sum /= count; /* Compute the sum of squared deviations */ nelem = theParams[0]->value.nelem; elem += nelem; /* Reset elem for second pass */ while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { double dx = (theParams[0]->value.data.dblptr[elem] - sum); sum2 += (dx*dx); } } sum2 /= (double)count-1; this->value.undef[row] = 0; this->value.data.dblptr[row] = sqrt(sum2); } else { this->value.undef[row] = 0; /* STDDEV => 0 */ this->value.data.dblptr[row] = 0; } } } break; case median_fct: elem = row * theParams[0]->value.nelem; nelem = theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { long *dptr = theParams[0]->value.data.lngptr; char *uptr = theParams[0]->value.undef; long *mptr = (long *) malloc(sizeof(long)*nelem); int irow; /* Allocate temporary storage for this row, since the quickselect function will scramble the contents */ if (mptr == 0) { fferror("Could not allocate temporary memory in median function"); free( this->value.data.ptr ); break; } for (irow=0; irow 0) { this->value.undef[irow] = 0; this->value.data.lngptr[irow] = qselect_median_lng(mptr, nelem1); } else { this->value.undef[irow] = 1; this->value.data.lngptr[irow] = 0; } } free(mptr); } else { double *dptr = theParams[0]->value.data.dblptr; char *uptr = theParams[0]->value.undef; double *mptr = (double *) malloc(sizeof(double)*nelem); int irow; /* Allocate temporary storage for this row, since the quickselect function will scramble the contents */ if (mptr == 0) { fferror("Could not allocate temporary memory in median function"); free( this->value.data.ptr ); break; } for (irow=0; irow 0) { this->value.undef[irow] = 0; this->value.data.dblptr[irow] = qselect_median_dbl(mptr, nelem1); } else { this->value.undef[irow] = 1; this->value.data.dblptr[irow] = 0; } } free(mptr); } break; case abs_fct: if( theParams[0]->type==DOUBLE ) while( elem-- ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = (dval>0.0 ? dval : -dval); this->value.undef[elem] = theParams[0]->value.undef[elem]; } else while( elem-- ) { ival = theParams[0]->value.data.lngptr[elem]; this->value.data.lngptr[elem] = (ival> 0 ? ival : -ival); this->value.undef[elem] = theParams[0]->value.undef[elem]; } break; /* Special Null-Handling Functions */ case nonnull_fct: nelem = theParams[0]->value.nelem; if ( theParams[0]->type==STRING ) nelem = 1; elem = row * nelem; while( row-- ) { int nelem1 = nelem; this->value.undef[row] = 0; /* Initialize to 0 (defined) */ this->value.data.lngptr[row] = 0; while( nelem1-- ) { elem --; if ( theParams[0]->value.undef[elem] == 0 ) this->value.data.lngptr[row] ++; } } break; case isnull_fct: if( theParams[0]->type==STRING ) elem = row; while( elem-- ) { this->value.data.logptr[elem] = theParams[0]->value.undef[elem]; this->value.undef[elem] = 0; } break; case defnull_fct: switch( this->type ) { case BOOLEAN: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.log = theParams[i]->value.data.logptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.log = theParams[i]->value.data.logptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.logptr[elem] = pVals[1].data.log; } else { this->value.undef[elem] = 0; this->value.data.logptr[elem] = pVals[0].data.log; } } } break; case LONG: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.lngptr[elem] = pVals[1].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } } } break; case DOUBLE: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } } } break; case STRING: while( row-- ) { i=2; while( i-- ) if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; strcpy(pVals[i].data.str, theParams[i]->value.data.strptr[row]); } if( pNull[0] ) { this->value.undef[row] = pNull[1]; strcpy(this->value.data.strptr[row],pVals[1].data.str); } else { this->value.undef[elem] = 0; strcpy(this->value.data.strptr[row],pVals[0].data.str); } } } break; /* Math functions with 1 double argument */ case sin_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = sin( theParams[0]->value.data.dblptr[elem] ); } break; case cos_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = cos( theParams[0]->value.data.dblptr[elem] ); } break; case tan_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = tan( theParams[0]->value.data.dblptr[elem] ); } break; case asin_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<-1.0 || dval>1.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = asin( dval ); } break; case acos_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<-1.0 || dval>1.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = acos( dval ); } break; case atan_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = atan( dval ); } break; case sinh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = sinh( theParams[0]->value.data.dblptr[elem] ); } break; case cosh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = cosh( theParams[0]->value.data.dblptr[elem] ); } break; case tanh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = tanh( theParams[0]->value.data.dblptr[elem] ); } break; case exp_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = exp( dval ); } break; case log_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<=0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = log( dval ); } break; case log10_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<=0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = log10( dval ); } break; case sqrt_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = sqrt( dval ); } break; case ceil_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = ceil( theParams[0]->value.data.dblptr[elem] ); } break; case floor_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = floor( theParams[0]->value.data.dblptr[elem] ); } break; case round_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = floor( theParams[0]->value.data.dblptr[elem] + 0.5); } break; /* Two-argument Trig Functions */ case atan2_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1]) ) ) this->value.data.dblptr[elem] = atan2( pVals[0].data.dbl, pVals[1].data.dbl ); } } break; /* Four-argument ANGSEP Function */ case angsep_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=4; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3]) ) ) this->value.data.dblptr[elem] = angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl); } } break; /* Min/Max functions taking 1 or 2 arguments */ case min1_fct: elem = row * theParams[0]->value.nelem; if( this->type==LONG ) { long minVal=0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; minVal = theParams[0]->value.data.lngptr[elem]; } else { minVal = minvalue( minVal, theParams[0]->value.data.lngptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.lngptr[row] = minVal; } } else if( this->type==DOUBLE ) { double minVal=0.0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; minVal = theParams[0]->value.data.dblptr[elem]; } else { minVal = minvalue( minVal, theParams[0]->value.data.dblptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.dblptr[row] = minVal; } } else if( this->type==BITSTR ) { char minVal; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; minVal = '1'; while (*sptr1) { if (*sptr1 == '0') minVal = '0'; sptr1++; } this->value.data.strptr[row][0] = minVal; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } break; case min2_fct: if( this->type==LONG ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.lngptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[1].data.lng; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = minvalue( pVals[0].data.lng, pVals[1].data.lng ); } } } } else if( this->type==DOUBLE ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.dblptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = minvalue( pVals[0].data.dbl, pVals[1].data.dbl ); } } } } break; case max1_fct: elem = row * theParams[0]->value.nelem; if( this->type==LONG ) { long maxVal=0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; maxVal = theParams[0]->value.data.lngptr[elem]; } else { maxVal = maxvalue( maxVal, theParams[0]->value.data.lngptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.lngptr[row] = maxVal; } } else if( this->type==DOUBLE ) { double maxVal=0.0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; maxVal = theParams[0]->value.data.dblptr[elem]; } else { maxVal = maxvalue( maxVal, theParams[0]->value.data.dblptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.dblptr[row] = maxVal; } } else if( this->type==BITSTR ) { char maxVal; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; maxVal = '0'; while (*sptr1) { if (*sptr1 == '1') maxVal = '1'; sptr1++; } this->value.data.strptr[row][0] = maxVal; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } break; case max2_fct: if( this->type==LONG ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.lngptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[1].data.lng; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = maxvalue( pVals[0].data.lng, pVals[1].data.lng ); } } } } else if( this->type==DOUBLE ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.dblptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = maxvalue( pVals[0].data.dbl, pVals[1].data.dbl ); } } } } break; /* Boolean SAO region Functions... scalar or vector dbls */ case near_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=3; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2]) ) ) this->value.data.logptr[elem] = bnear( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl ); } } break; case circle_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=5; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4]) ) ) this->value.data.logptr[elem] = circle( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl ); } } break; case box_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=7; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4] || pNull[5] || pNull[6] ) ) ) this->value.data.logptr[elem] = saobox( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); } } break; case elps_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=7; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4] || pNull[5] || pNull[6] ) ) ) this->value.data.logptr[elem] = ellipse( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); } } break; /* C Conditional expression: bool ? expr : expr */ case ifthenelse_fct: switch( this->type ) { case BOOLEAN: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.log = theParams[i]->value.data.logptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.log = theParams[i]->value.data.logptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.logptr[elem] = pVals[0].data.log; this->value.undef[elem] = pNull[0]; } else { this->value.data.logptr[elem] = pVals[1].data.log; this->value.undef[elem] = pNull[1]; } } } } break; case LONG: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.lngptr[elem] = pVals[0].data.lng; this->value.undef[elem] = pNull[0]; } else { this->value.data.lngptr[elem] = pVals[1].data.lng; this->value.undef[elem] = pNull[1]; } } } } break; case DOUBLE: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.dblptr[elem] = pVals[0].data.dbl; this->value.undef[elem] = pNull[0]; } else { this->value.data.dblptr[elem] = pVals[1].data.dbl; this->value.undef[elem] = pNull[1]; } } } } break; case STRING: while( row-- ) { if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i] ) { strcpy( pVals[i].data.str, theParams[i]->value.data.strptr[row] ); pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[row] = pNull[2]) ) { if( pVals[2].data.log ) { strcpy( this->value.data.strptr[row], pVals[0].data.str ); this->value.undef[row] = pNull[0]; } else { strcpy( this->value.data.strptr[row], pVals[1].data.str ); this->value.undef[row] = pNull[1]; } } else { this->value.data.strptr[row][0] = '\0'; } } break; } break; /* String functions */ case strmid_fct: { int strconst = theParams[0]->operation == CONST_OP; int posconst = theParams[1]->operation == CONST_OP; int lenconst = theParams[2]->operation == CONST_OP; int dest_len = this->value.nelem; int src_len = theParams[0]->value.nelem; while (row--) { int pos; int len; char *str; int undef = 0; if (posconst) { pos = theParams[1]->value.data.lng; } else { pos = theParams[1]->value.data.lngptr[row]; if (theParams[1]->value.undef[row]) undef = 1; } if (strconst) { str = theParams[0]->value.data.str; if (src_len == 0) src_len = strlen(str); } else { str = theParams[0]->value.data.strptr[row]; if (theParams[0]->value.undef[row]) undef = 1; } if (lenconst) { len = dest_len; } else { len = theParams[2]->value.data.lngptr[row]; if (theParams[2]->value.undef[row]) undef = 1; } this->value.data.strptr[row][0] = '\0'; if (pos == 0) undef = 1; if (! undef ) { if (cstrmid(this->value.data.strptr[row], len, str, src_len, pos) < 0) break; } this->value.undef[row] = undef; } } break; /* String functions */ case strpos_fct: { int const1 = theParams[0]->operation == CONST_OP; int const2 = theParams[1]->operation == CONST_OP; while (row--) { char *str1, *str2; int undef = 0; if (const1) { str1 = theParams[0]->value.data.str; } else { str1 = theParams[0]->value.data.strptr[row]; if (theParams[0]->value.undef[row]) undef = 1; } if (const2) { str2 = theParams[1]->value.data.str; } else { str2 = theParams[1]->value.data.strptr[row]; if (theParams[1]->value.undef[row]) undef = 1; } this->value.data.lngptr[row] = 0; if (! undef ) { char *res = strstr(str1, str2); if (res == NULL) { undef = 1; this->value.data.lngptr[row] = 0; } else { this->value.data.lngptr[row] = (res - str1) + 1; } } this->value.undef[row] = undef; } } break; } /* End switch(this->operation) */ } /* End if (!gParse.status) */ } /* End non-constant operations */ i = this->nSubNodes; while( i-- ) { if( theParams[i]->operation>0 ) { /* Currently only numeric params allowed */ free( theParams[i]->value.data.ptr ); } } } static void Do_Deref( Node *this ) { Node *theVar, *theDims[MAXDIMS]; int isConst[MAXDIMS], allConst; long dimVals[MAXDIMS]; int i, nDims; long row, elem, dsize; theVar = gParse.Nodes + this->SubNodes[0]; i = nDims = this->nSubNodes-1; allConst = 1; while( i-- ) { theDims[i] = gParse.Nodes + this->SubNodes[i+1]; isConst[i] = ( theDims[i]->operation==CONST_OP ); if( isConst[i] ) dimVals[i] = theDims[i]->value.data.lng; else allConst = 0; } if( this->type==DOUBLE ) { dsize = sizeof( double ); } else if( this->type==LONG ) { dsize = sizeof( long ); } else if( this->type==BOOLEAN ) { dsize = sizeof( char ); } else dsize = 0; Allocate_Ptrs( this ); if( !gParse.status ) { if( allConst && theVar->value.naxis==nDims ) { /* Dereference completely using constant indices */ elem = 0; i = nDims; while( i-- ) { if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break; elem = theVar->value.naxes[i]*elem + dimVals[i]-1; } if( i<0 ) { for( row=0; rowtype==STRING ) this->value.undef[row] = theVar->value.undef[row]; else if( this->type==BITSTR ) this->value.undef; /* Dummy - BITSTRs do not have undefs */ else this->value.undef[row] = theVar->value.undef[elem]; if( this->type==DOUBLE ) this->value.data.dblptr[row] = theVar->value.data.dblptr[elem]; else if( this->type==LONG ) this->value.data.lngptr[row] = theVar->value.data.lngptr[elem]; else if( this->type==BOOLEAN ) this->value.data.logptr[row] = theVar->value.data.logptr[elem]; else { /* XXX Note, the below expression uses knowledge of the layout of the string format, namely (nelem+1) characters per string, followed by (nelem+1) "undef" values. */ this->value.data.strptr[row][0] = theVar->value.data.strptr[0][elem+row]; this->value.data.strptr[row][1] = 0; /* Null terminate */ } elem += theVar->value.nelem; } } else { fferror("Index out of range"); free( this->value.data.ptr ); } } else if( allConst && nDims==1 ) { /* Reduce dimensions by 1, using a constant index */ if( dimVals[0] < 1 || dimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) { fferror("Index out of range"); free( this->value.data.ptr ); } else if ( this->type == BITSTR || this->type == STRING ) { elem = this->value.nelem * (dimVals[0]-1); for( row=0; rowvalue.undef) this->value.undef[row] = theVar->value.undef[row]; memcpy( (char*)this->value.data.strptr[0] + row*sizeof(char)*(this->value.nelem+1), (char*)theVar->value.data.strptr[0] + elem*sizeof(char), this->value.nelem * sizeof(char) ); /* Null terminate */ this->value.data.strptr[row][this->value.nelem] = 0; elem += theVar->value.nelem+1; } } else { elem = this->value.nelem * (dimVals[0]-1); for( row=0; rowvalue.undef + row*this->value.nelem, theVar->value.undef + elem, this->value.nelem * sizeof(char) ); memcpy( (char*)this->value.data.ptr + row*dsize*this->value.nelem, (char*)theVar->value.data.ptr + elem*dsize, this->value.nelem * dsize ); elem += theVar->value.nelem; } } } else if( theVar->value.naxis==nDims ) { /* Dereference completely using an expression for the indices */ for( row=0; rowvalue.undef[row] ) { fferror("Null encountered as vector index"); free( this->value.data.ptr ); break; } else dimVals[i] = theDims[i]->value.data.lngptr[row]; } } if( gParse.status ) break; elem = 0; i = nDims; while( i-- ) { if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break; elem = theVar->value.naxes[i]*elem + dimVals[i]-1; } if( i<0 ) { elem += row*theVar->value.nelem; if( this->type==STRING ) this->value.undef[row] = theVar->value.undef[row]; else if( this->type==BITSTR ) this->value.undef; /* Dummy - BITSTRs do not have undefs */ else this->value.undef[row] = theVar->value.undef[elem]; if( this->type==DOUBLE ) this->value.data.dblptr[row] = theVar->value.data.dblptr[elem]; else if( this->type==LONG ) this->value.data.lngptr[row] = theVar->value.data.lngptr[elem]; else if( this->type==BOOLEAN ) this->value.data.logptr[row] = theVar->value.data.logptr[elem]; else { /* XXX Note, the below expression uses knowledge of the layout of the string format, namely (nelem+1) characters per string, followed by (nelem+1) "undef" values. */ this->value.data.strptr[row][0] = theVar->value.data.strptr[0][elem+row]; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } else { fferror("Index out of range"); free( this->value.data.ptr ); } } } else { /* Reduce dimensions by 1, using a nonconstant expression */ for( row=0; rowvalue.undef[row] ) { fferror("Null encountered as vector index"); free( this->value.data.ptr ); break; } else dimVals[0] = theDims[0]->value.data.lngptr[row]; if( dimVals[0] < 1 || dimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) { fferror("Index out of range"); free( this->value.data.ptr ); } else if ( this->type == BITSTR || this->type == STRING ) { elem = this->value.nelem * (dimVals[0]-1); elem += row*(theVar->value.nelem+1); if (this->value.undef) this->value.undef[row] = theVar->value.undef[row]; memcpy( (char*)this->value.data.strptr[0] + row*sizeof(char)*(this->value.nelem+1), (char*)theVar->value.data.strptr[0] + elem*sizeof(char), this->value.nelem * sizeof(char) ); /* Null terminate */ this->value.data.strptr[row][this->value.nelem] = 0; } else { elem = this->value.nelem * (dimVals[0]-1); elem += row*theVar->value.nelem; memcpy( this->value.undef + row*this->value.nelem, theVar->value.undef + elem, this->value.nelem * sizeof(char) ); memcpy( (char*)this->value.data.ptr + row*dsize*this->value.nelem, (char*)theVar->value.data.ptr + elem*dsize, this->value.nelem * dsize ); } } } } if( theVar->operation>0 ) { if (theVar->type == STRING || theVar->type == BITSTR) free(theVar->value.data.strptr[0] ); else free( theVar->value.data.ptr ); } for( i=0; ioperation>0 ) { free( theDims[i]->value.data.ptr ); } } static void Do_GTI( Node *this ) { Node *theExpr, *theTimes; double *start, *stop, *times; long elem, nGTI, gti; int ordered; theTimes = gParse.Nodes + this->SubNodes[0]; theExpr = gParse.Nodes + this->SubNodes[1]; nGTI = theTimes->value.nelem; start = theTimes->value.data.dblptr; stop = theTimes->value.data.dblptr + nGTI; ordered = theTimes->type; if( theExpr->operation==CONST_OP ) { this->value.data.log = (Search_GTI( theExpr->value.data.dbl, nGTI, start, stop, ordered )>=0); this->operation = CONST_OP; } else { Allocate_Ptrs( this ); times = theExpr->value.data.dblptr; if( !gParse.status ) { elem = gParse.nRows * this->value.nelem; if( nGTI ) { gti = -1; while( elem-- ) { if( (this->value.undef[elem] = theExpr->value.undef[elem]) ) continue; /* Before searching entire GTI, check the GTI found last time */ if( gti<0 || times[elem]stop[gti] ) { gti = Search_GTI( times[elem], nGTI, start, stop, ordered ); } this->value.data.logptr[elem] = ( gti>=0 ); } } else while( elem-- ) { this->value.data.logptr[elem] = 0; this->value.undef[elem] = 0; } } } if( theExpr->operation>0 ) free( theExpr->value.data.ptr ); } static long Search_GTI( double evtTime, long nGTI, double *start, double *stop, int ordered ) { long gti, step; if( ordered && nGTI>15 ) { /* If time-ordered and lots of GTIs, */ /* use "FAST" Binary search algorithm */ if( evtTime>=start[0] && evtTime<=stop[nGTI-1] ) { gti = step = (nGTI >> 1); while(1) { if( step>1L ) step >>= 1; if( evtTime>stop[gti] ) { if( evtTime>=start[gti+1] ) gti += step; else { gti = -1L; break; } } else if( evtTime=start[gti] && evtTime<=stop[gti] ) break; } return( gti ); } static void Do_REG( Node *this ) { Node *theRegion, *theX, *theY; double Xval=0.0, Yval=0.0; char Xnull=0, Ynull=0; int Xvector, Yvector; long nelem, elem, rows; theRegion = gParse.Nodes + this->SubNodes[0]; theX = gParse.Nodes + this->SubNodes[1]; theY = gParse.Nodes + this->SubNodes[2]; Xvector = ( theX->operation!=CONST_OP ); if( Xvector ) Xvector = theX->value.nelem; else { Xval = theX->value.data.dbl; } Yvector = ( theY->operation!=CONST_OP ); if( Yvector ) Yvector = theY->value.nelem; else { Yval = theY->value.data.dbl; } if( !Xvector && !Yvector ) { this->value.data.log = ( fits_in_region( Xval, Yval, (SAORegion *)theRegion->value.data.ptr ) != 0 ); this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; nelem = this->value.nelem; elem = rows*nelem; while( rows-- ) { while( nelem-- ) { elem--; if( Xvector>1 ) { Xval = theX->value.data.dblptr[elem]; Xnull = theX->value.undef[elem]; } else if( Xvector ) { Xval = theX->value.data.dblptr[rows]; Xnull = theX->value.undef[rows]; } if( Yvector>1 ) { Yval = theY->value.data.dblptr[elem]; Ynull = theY->value.undef[elem]; } else if( Yvector ) { Yval = theY->value.data.dblptr[rows]; Ynull = theY->value.undef[rows]; } this->value.undef[elem] = ( Xnull || Ynull ); if( this->value.undef[elem] ) continue; this->value.data.logptr[elem] = ( fits_in_region( Xval, Yval, (SAORegion *)theRegion->value.data.ptr ) != 0 ); } nelem = this->value.nelem; } } } if( theX->operation>0 ) free( theX->value.data.ptr ); if( theY->operation>0 ) free( theY->value.data.ptr ); } static void Do_Vector( Node *this ) { Node *that; long row, elem, idx, jdx, offset=0; int node; Allocate_Ptrs( this ); if( !gParse.status ) { for( node=0; nodenSubNodes; node++ ) { that = gParse.Nodes + this->SubNodes[node]; if( that->operation == CONST_OP ) { idx = gParse.nRows*this->value.nelem + offset; while( (idx-=this->value.nelem)>=0 ) { this->value.undef[idx] = 0; switch( this->type ) { case BOOLEAN: this->value.data.logptr[idx] = that->value.data.log; break; case LONG: this->value.data.lngptr[idx] = that->value.data.lng; break; case DOUBLE: this->value.data.dblptr[idx] = that->value.data.dbl; break; } } } else { row = gParse.nRows; idx = row * that->value.nelem; while( row-- ) { elem = that->value.nelem; jdx = row*this->value.nelem + offset; while( elem-- ) { this->value.undef[jdx+elem] = that->value.undef[--idx]; switch( this->type ) { case BOOLEAN: this->value.data.logptr[jdx+elem] = that->value.data.logptr[idx]; break; case LONG: this->value.data.lngptr[jdx+elem] = that->value.data.lngptr[idx]; break; case DOUBLE: this->value.data.dblptr[jdx+elem] = that->value.data.dblptr[idx]; break; } } } } offset += that->value.nelem; } } for( node=0; node < this->nSubNodes; node++ ) if( OPER(this->SubNodes[node])>0 ) free( gParse.Nodes[this->SubNodes[node]].value.data.ptr ); } /*****************************************************************************/ /* Utility routines which perform the calculations on bits and SAO regions */ /*****************************************************************************/ static char bitlgte(char *bits1, int oper, char *bits2) { int val1, val2, nextbit; char result; int i, l1, l2, length, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bits1); l2 = strlen(bits2); if (l1 < l2) { length = l2; ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bits1++); stream[i] = '\0'; bits1 = stream; } else if (l2 < l1) { length = l1; ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bits2++); stream[i] = '\0'; bits2 = stream; } else length = l1; val1 = val2 = 0; nextbit = 1; while( length-- ) { chr1 = bits1[length]; chr2 = bits2[length]; if ((chr1 != 'x')&&(chr1 != 'X')&&(chr2 != 'x')&&(chr2 != 'X')) { if (chr1 == '1') val1 += nextbit; if (chr2 == '1') val2 += nextbit; nextbit *= 2; } } result = 0; switch (oper) { case LT: if (val1 < val2) result = 1; break; case LTE: if (val1 <= val2) result = 1; break; case GT: if (val1 > val2) result = 1; break; case GTE: if (val1 >= val2) result = 1; break; } return (result); } static void bitand(char *result,char *bitstrm1,char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while ( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ((chr1 == 'x') || (chr2 == 'x')) *result = 'x'; else if ((chr1 == '1') && (chr2 == '1')) *result = '1'; else *result = '0'; result++; } *result = '\0'; } static void bitor(char *result,char *bitstrm1,char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while ( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ((chr1 == '1') || (chr2 == '1')) *result = '1'; else if ((chr1 == '0') || (chr2 == '0')) *result = '0'; else *result = 'x'; result++; } *result = '\0'; } static void bitnot(char *result,char *bits) { int length; char chr; length = strlen(bits); while( length-- ) { chr = *(bits++); *(result++) = ( chr=='1' ? '0' : ( chr=='0' ? '1' : chr ) ); } *result = '\0'; } static char bitcmp(char *bitstrm1, char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ( ((chr1 == '0') && (chr2 == '1')) || ((chr1 == '1') && (chr2 == '0')) ) return( 0 ); } return( 1 ); } static char bnear(double x, double y, double tolerance) { if (fabs(x - y) < tolerance) return ( 1 ); else return ( 0 ); } static char saobox(double xcen, double ycen, double xwid, double ywid, double rot, double xcol, double ycol) { double x,y,xprime,yprime,xmin,xmax,ymin,ymax,theta; theta = (rot / 180.0) * myPI; xprime = xcol - xcen; yprime = ycol - ycen; x = xprime * cos(theta) + yprime * sin(theta); y = -xprime * sin(theta) + yprime * cos(theta); xmin = - 0.5 * xwid; xmax = 0.5 * xwid; ymin = - 0.5 * ywid; ymax = 0.5 * ywid; if ((x >= xmin) && (x <= xmax) && (y >= ymin) && (y <= ymax)) return ( 1 ); else return ( 0 ); } static char circle(double xcen, double ycen, double rad, double xcol, double ycol) { double r2,dx,dy,dlen; dx = xcol - xcen; dy = ycol - ycen; dx *= dx; dy *= dy; dlen = dx + dy; r2 = rad * rad; if (dlen <= r2) return ( 1 ); else return ( 0 ); } static char ellipse(double xcen, double ycen, double xrad, double yrad, double rot, double xcol, double ycol) { double x,y,xprime,yprime,dx,dy,dlen,theta; theta = (rot / 180.0) * myPI; xprime = xcol - xcen; yprime = ycol - ycen; x = xprime * cos(theta) + yprime * sin(theta); y = -xprime * sin(theta) + yprime * cos(theta); dx = x / xrad; dy = y / yrad; dx *= dx; dy *= dy; dlen = dx + dy; if (dlen <= 1.0) return ( 1 ); else return ( 0 ); } /* * Extract substring */ int cstrmid(char *dest_str, int dest_len, char *src_str, int src_len, int pos) { /* char fill_char = ' '; */ char fill_char = '\0'; if (src_len == 0) { src_len = strlen(src_str); } /* .. if constant */ /* Fill destination with blanks */ if (pos < 0) { fferror("STRMID(S,P,N) P must be 0 or greater"); return -1; } if (pos > src_len || pos == 0) { /* pos==0: blank string requested */ memset(dest_str, fill_char, dest_len); } else if (pos+dest_len > src_len) { /* Copy a subset */ int nsub = src_len-pos+1; int npad = dest_len - nsub; memcpy(dest_str, src_str+pos-1, nsub); /* Fill remaining string with blanks */ memset(dest_str+nsub, fill_char, npad); } else { /* Full string copy */ memcpy(dest_str, src_str+pos-1, dest_len); } dest_str[dest_len] = '\0'; /* Null-terminate */ return 0; } static void fferror(char *s) { char msg[80]; if( !gParse.status ) gParse.status = PARSE_SYNTAX_ERR; strncpy(msg, s, 80); msg[79] = '\0'; ffpmsg(msg); } astropy-0.3/cextern/cfitsio/group.h0000644000175000017500000000360612243255342015621 0ustar oleole#define MAX_HDU_TRACKER 1000 typedef struct _HDUtracker HDUtracker; struct _HDUtracker { int nHDU; char *filename[MAX_HDU_TRACKER]; int position[MAX_HDU_TRACKER]; char *newFilename[MAX_HDU_TRACKER]; int newPosition[MAX_HDU_TRACKER]; }; /* functions used internally in the grouping convention module */ int ffgtdc(int grouptype, int xtensioncol, int extnamecol, int extvercol, int positioncol, int locationcol, int uricol, char *ttype[], char *tform[], int *ncols, int *status); int ffgtgc(fitsfile *gfptr, int *xtensionCol, int *extnameCol, int *extverCol, int *positionCol, int *locationCol, int *uriCol, int *grptype, int *status); int ffgmul(fitsfile *mfptr, int rmopt, int *status); int ffgmf(fitsfile *gfptr, char *xtension, char *extname, int extver, int position, char *location, long *member, int *status); int ffgtrmr(fitsfile *gfptr, HDUtracker *HDU, int *status); int ffgtcpr(fitsfile *infptr, fitsfile *outfptr, int cpopt, HDUtracker *HDU, int *status); int fftsad(fitsfile *mfptr, HDUtracker *HDU, int *newPosition, char *newFileName); int fftsud(fitsfile *mfptr, HDUtracker *HDU, int newPosition, char *newFileName); void prepare_keyvalue(char *keyvalue); int fits_path2url(char *inpath, char *outpath, int *status); int fits_url2path(char *inpath, char *outpath, int *status); int fits_get_cwd(char *cwd, int *status); int fits_get_url(fitsfile *fptr, char *realURL, char *startURL, char *realAccess, char *startAccess, int *iostate, int *status); int fits_clean_url(char *inURL, char *outURL, int *status); int fits_relurl2url(char *refURL, char *relURL, char *absURL, int *status); int fits_url2relurl(char *refURL, char *absURL, char *relURL, int *status); int fits_encode_url(char *inpath, char *outpath, int *status); int fits_unencode_url(char *inpath, char *outpath, int *status); int fits_is_url_absolute(char *url); astropy-0.3/cextern/cfitsio/eval_tab.h0000644000175000017500000000154712243255342016244 0ustar oleoletypedef union { int Node; /* Index of Node */ double dbl; /* real value */ long lng; /* integer value */ char log; /* logical value */ char str[MAX_STRLEN]; /* string value */ } FFSTYPE; #define BOOLEAN 258 #define LONG 259 #define DOUBLE 260 #define STRING 261 #define BITSTR 262 #define FUNCTION 263 #define BFUNCTION 264 #define IFUNCTION 265 #define GTIFILTER 266 #define REGFILTER 267 #define COLUMN 268 #define BCOLUMN 269 #define SCOLUMN 270 #define BITCOL 271 #define ROWREF 272 #define NULLREF 273 #define SNULLREF 274 #define OR 275 #define AND 276 #define EQ 277 #define NE 278 #define GT 279 #define LT 280 #define LTE 281 #define GTE 282 #define POWER 283 #define NOT 284 #define INTCAST 285 #define FLTCAST 286 #define UMINUS 287 #define ACCUM 288 #define DIFF 289 extern FFSTYPE fflval; astropy-0.3/cextern/cfitsio/fitscore.c0000644000175000017500000112202212243255342016271 0ustar oleole/* This file, fitscore.c, contains the core set of FITSIO routines. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ /* Copyright (Unpublished--all rights reserved under the copyright laws of the United States), U.S. Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code. Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this copyright notice and disclaimer of warranty appears in all copies. DISCLAIMER: THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER." */ #include #include #include #include #include #include /* stddef.h is apparently needed to define size_t with some compilers ?? */ #include #include #include "fitsio2.h" #define errmsgsiz 25 #define ESMARKER 27 /* Escape character is used as error stack marker */ #define DelAll 1 /* delete all messages on the error stack */ #define DelMark 2 /* delete newest messages back to and including marker */ #define DelNewest 3 /* delete the newest message from the stack */ #define GetMesg 4 /* pop and return oldest message, ignoring marks */ #define PutMesg 5 /* add a new message to the stack */ #define PutMark 6 /* add a marker to the stack */ #ifdef _REENTRANT /* Fitsio_Lock and Fitsio_Pthread_Status are declared in fitsio2.h. */ pthread_mutex_t Fitsio_Lock; int Fitsio_Pthread_Status = 0; #endif int STREAM_DRIVER = 0; struct lconv *lcxxx; /*--------------------------------------------------------------------------*/ float ffvers(float *version) /* IO - version number */ /* return the current version number of the FITSIO software */ { *version = (float) 3.35; /* 23 May 2013 Previous releases: *version = 3.34 20 Mar 2013 *version = 3.33 14 Feb 2013 *version = 3.32 Oct 2012 *version = 3.31 18 Jul 2012 *version = 3.30 11 Apr 2012 *version = 3.29 22 Sep 2011 *version = 3.28 12 May 2011 *version = 3.27 3 Mar 2011 *version = 3.26 30 Dec 2010 *version = 3.25 9 June 2010 *version = 3.24 26 Jan 2010 *version = 3.23 7 Jan 2010 *version = 3.22 28 Oct 2009 *version = 3.21 24 Sep 2009 *version = 3.20 31 Aug 2009 *version = 3.18 12 May 2009 (beta version) *version = 3.14 18 Mar 2009 *version = 3.13 5 Jan 2009 *version = 3.12 8 Oct 2008 *version = 3.11 19 Sep 2008 *version = 3.10 20 Aug 2008 *version = 3.09 3 Jun 2008 *version = 3.08 15 Apr 2007 (internal release) *version = 3.07 5 Nov 2007 (internal release) *version = 3.06 27 Aug 2007 *version = 3.05 12 Jul 2007 (internal release) *version = 3.03 11 Dec 2006 *version = 3.02 18 Sep 2006 *version = 3.01 May 2006 included in FTOOLS 6.1 release *version = 3.006 20 Feb 2006 *version = 3.005 20 Dec 2005 (beta, in heasoft swift release *version = 3.004 16 Sep 2005 (beta, in heasoft swift release *version = 3.003 28 Jul 2005 (beta, in heasoft swift release *version = 3.002 15 Apr 2005 (beta) *version = 3.001 15 Mar 2005 (beta) released with heasoft 6.0 *version = 3.000 1 Mar 2005 (internal release only) *version = 2.51 2 Dec 2004 *version = 2.50 28 Jul 2004 *version = 2.49 11 Feb 2004 *version = 2.48 28 Jan 2004 *version = 2.470 18 Aug 2003 *version = 2.460 20 May 2003 *version = 2.450 30 Apr 2003 (internal release only) *version = 2.440 8 Jan 2003 *version = 2.430; 4 Nov 2002 *version = 2.420; 19 Jul 2002 *version = 2.410; 22 Apr 2002 used in ftools v5.2 *version = 2.401; 28 Jan 2002 *version = 2.400; 18 Jan 2002 *version = 2.301; 7 Dec 2001 *version = 2.300; 23 Oct 2001 *version = 2.204; 26 Jul 2001 *version = 2.203; 19 Jul 2001 used in ftools v5.1 *version = 2.202; 22 May 2001 *version = 2.201; 15 Mar 2001 *version = 2.200; 26 Jan 2001 *version = 2.100; 26 Sep 2000 *version = 2.037; 6 Jul 2000 *version = 2.036; 1 Feb 2000 *version = 2.035; 7 Dec 1999 (internal release only) *version = 2.034; 23 Nov 1999 *version = 2.033; 17 Sep 1999 *version = 2.032; 25 May 1999 *version = 2.031; 31 Mar 1999 *version = 2.030; 24 Feb 1999 *version = 2.029; 11 Feb 1999 *version = 2.028; 26 Jan 1999 *version = 2.027; 12 Jan 1999 *version = 2.026; 23 Dec 1998 *version = 2.025; 1 Dec 1998 *version = 2.024; 9 Nov 1998 *version = 2.023; 1 Nov 1998 first full release of V2.0 *version = 1.42; 30 Apr 1998 *version = 1.40; 6 Feb 1998 *version = 1.33; 16 Dec 1997 (internal release only) *version = 1.32; 21 Nov 1997 (internal release only) *version = 1.31; 4 Nov 1997 (internal release only) *version = 1.30; 11 Sep 1997 *version = 1.27; 3 Sep 1997 (internal release only) *version = 1.25; 2 Jul 1997 *version = 1.24; 2 May 1997 *version = 1.23; 24 Apr 1997 *version = 1.22; 18 Apr 1997 *version = 1.21; 26 Mar 1997 *version = 1.2; 29 Jan 1997 *version = 1.11; 04 Dec 1996 *version = 1.101; 13 Nov 1996 *version = 1.1; 6 Nov 1996 *version = 1.04; 17 Sep 1996 *version = 1.03; 20 Aug 1996 *version = 1.02; 15 Aug 1996 *version = 1.01; 12 Aug 1996 */ return(*version); } /*--------------------------------------------------------------------------*/ int ffflnm(fitsfile *fptr, /* I - FITS file pointer */ char *filename, /* O - name of the file */ int *status) /* IO - error status */ /* return the name of the FITS file */ { strcpy(filename,(fptr->Fptr)->filename); return(*status); } /*--------------------------------------------------------------------------*/ int ffflmd(fitsfile *fptr, /* I - FITS file pointer */ int *filemode, /* O - open mode of the file */ int *status) /* IO - error status */ /* return the access mode of the FITS file */ { *filemode = (fptr->Fptr)->writemode; return(*status); } /*--------------------------------------------------------------------------*/ void ffgerr(int status, /* I - error status value */ char *errtext) /* O - error message (max 30 char long + null) */ /* Return a short descriptive error message that corresponds to the input error status value. The message may be up to 30 characters long, plus the terminating null character. */ { errtext[0] = '\0'; if (status >= 0 && status < 300) { switch (status) { case 0: strcpy(errtext, "OK - no error"); break; case 1: strcpy(errtext, "non-CFITSIO program error"); break; case 101: strcpy(errtext, "same input and output files"); break; case 103: strcpy(errtext, "attempt to open too many files"); break; case 104: strcpy(errtext, "could not open the named file"); break; case 105: strcpy(errtext, "couldn't create the named file"); break; case 106: strcpy(errtext, "error writing to FITS file"); break; case 107: strcpy(errtext, "tried to move past end of file"); break; case 108: strcpy(errtext, "error reading from FITS file"); break; case 110: strcpy(errtext, "could not close the file"); break; case 111: strcpy(errtext, "array dimensions too big"); break; case 112: strcpy(errtext, "cannot write to readonly file"); break; case 113: strcpy(errtext, "could not allocate memory"); break; case 114: strcpy(errtext, "invalid fitsfile pointer"); break; case 115: strcpy(errtext, "NULL input pointer"); break; case 116: strcpy(errtext, "error seeking file position"); break; case 121: strcpy(errtext, "invalid URL prefix"); break; case 122: strcpy(errtext, "too many I/O drivers"); break; case 123: strcpy(errtext, "I/O driver init failed"); break; case 124: strcpy(errtext, "no I/O driver for this URLtype"); break; case 125: strcpy(errtext, "parse error in input file URL"); break; case 126: strcpy(errtext, "parse error in range list"); break; case 151: strcpy(errtext, "bad argument (shared mem drvr)"); break; case 152: strcpy(errtext, "null ptr arg (shared mem drvr)"); break; case 153: strcpy(errtext, "no free shared memory handles"); break; case 154: strcpy(errtext, "share mem drvr not initialized"); break; case 155: strcpy(errtext, "IPC system error (shared mem)"); break; case 156: strcpy(errtext, "no memory (shared mem drvr)"); break; case 157: strcpy(errtext, "share mem resource deadlock"); break; case 158: strcpy(errtext, "lock file open/create failed"); break; case 159: strcpy(errtext, "can't resize share mem block"); break; case 201: strcpy(errtext, "header already has keywords"); break; case 202: strcpy(errtext, "keyword not found in header"); break; case 203: strcpy(errtext, "keyword number out of bounds"); break; case 204: strcpy(errtext, "keyword value is undefined"); break; case 205: strcpy(errtext, "string missing closing quote"); break; case 206: strcpy(errtext, "error in indexed keyword name"); break; case 207: strcpy(errtext, "illegal character in keyword"); break; case 208: strcpy(errtext, "required keywords out of order"); break; case 209: strcpy(errtext, "keyword value not positive int"); break; case 210: strcpy(errtext, "END keyword not found"); break; case 211: strcpy(errtext, "illegal BITPIX keyword value"); break; case 212: strcpy(errtext, "illegal NAXIS keyword value"); break; case 213: strcpy(errtext, "illegal NAXISn keyword value"); break; case 214: strcpy(errtext, "illegal PCOUNT keyword value"); break; case 215: strcpy(errtext, "illegal GCOUNT keyword value"); break; case 216: strcpy(errtext, "illegal TFIELDS keyword value"); break; case 217: strcpy(errtext, "negative table row size"); break; case 218: strcpy(errtext, "negative number of rows"); break; case 219: strcpy(errtext, "named column not found"); break; case 220: strcpy(errtext, "illegal SIMPLE keyword value"); break; case 221: strcpy(errtext, "first keyword not SIMPLE"); break; case 222: strcpy(errtext, "second keyword not BITPIX"); break; case 223: strcpy(errtext, "third keyword not NAXIS"); break; case 224: strcpy(errtext, "missing NAXISn keywords"); break; case 225: strcpy(errtext, "first keyword not XTENSION"); break; case 226: strcpy(errtext, "CHDU not an ASCII table"); break; case 227: strcpy(errtext, "CHDU not a binary table"); break; case 228: strcpy(errtext, "PCOUNT keyword not found"); break; case 229: strcpy(errtext, "GCOUNT keyword not found"); break; case 230: strcpy(errtext, "TFIELDS keyword not found"); break; case 231: strcpy(errtext, "missing TBCOLn keyword"); break; case 232: strcpy(errtext, "missing TFORMn keyword"); break; case 233: strcpy(errtext, "CHDU not an IMAGE extension"); break; case 234: strcpy(errtext, "illegal TBCOLn keyword value"); break; case 235: strcpy(errtext, "CHDU not a table extension"); break; case 236: strcpy(errtext, "column exceeds width of table"); break; case 237: strcpy(errtext, "more than 1 matching col. name"); break; case 241: strcpy(errtext, "row width not = field widths"); break; case 251: strcpy(errtext, "unknown FITS extension type"); break; case 252: strcpy(errtext, "1st key not SIMPLE or XTENSION"); break; case 253: strcpy(errtext, "END keyword is not blank"); break; case 254: strcpy(errtext, "Header fill area not blank"); break; case 255: strcpy(errtext, "Data fill area invalid"); break; case 261: strcpy(errtext, "illegal TFORM format code"); break; case 262: strcpy(errtext, "unknown TFORM datatype code"); break; case 263: strcpy(errtext, "illegal TDIMn keyword value"); break; case 264: strcpy(errtext, "invalid BINTABLE heap pointer"); break; default: strcpy(errtext, "unknown error status"); break; } } else if (status < 600) { switch(status) { case 301: strcpy(errtext, "illegal HDU number"); break; case 302: strcpy(errtext, "column number < 1 or > tfields"); break; case 304: strcpy(errtext, "negative byte address"); break; case 306: strcpy(errtext, "negative number of elements"); break; case 307: strcpy(errtext, "bad first row number"); break; case 308: strcpy(errtext, "bad first element number"); break; case 309: strcpy(errtext, "not an ASCII (A) column"); break; case 310: strcpy(errtext, "not a logical (L) column"); break; case 311: strcpy(errtext, "bad ASCII table datatype"); break; case 312: strcpy(errtext, "bad binary table datatype"); break; case 314: strcpy(errtext, "null value not defined"); break; case 317: strcpy(errtext, "not a variable length column"); break; case 320: strcpy(errtext, "illegal number of dimensions"); break; case 321: strcpy(errtext, "1st pixel no. > last pixel no."); break; case 322: strcpy(errtext, "BSCALE or TSCALn = 0."); break; case 323: strcpy(errtext, "illegal axis length < 1"); break; case 340: strcpy(errtext, "not group table"); break; case 341: strcpy(errtext, "HDU already member of group"); break; case 342: strcpy(errtext, "group member not found"); break; case 343: strcpy(errtext, "group not found"); break; case 344: strcpy(errtext, "bad group id"); break; case 345: strcpy(errtext, "too many HDUs tracked"); break; case 346: strcpy(errtext, "HDU alread tracked"); break; case 347: strcpy(errtext, "bad Grouping option"); break; case 348: strcpy(errtext, "identical pointers (groups)"); break; case 360: strcpy(errtext, "malloc failed in parser"); break; case 361: strcpy(errtext, "file read error in parser"); break; case 362: strcpy(errtext, "null pointer arg (parser)"); break; case 363: strcpy(errtext, "empty line (parser)"); break; case 364: strcpy(errtext, "cannot unread > 1 line"); break; case 365: strcpy(errtext, "parser too deeply nested"); break; case 366: strcpy(errtext, "file open failed (parser)"); break; case 367: strcpy(errtext, "hit EOF (parser)"); break; case 368: strcpy(errtext, "bad argument (parser)"); break; case 369: strcpy(errtext, "unexpected token (parser)"); break; case 401: strcpy(errtext, "bad int to string conversion"); break; case 402: strcpy(errtext, "bad float to string conversion"); break; case 403: strcpy(errtext, "keyword value not integer"); break; case 404: strcpy(errtext, "keyword value not logical"); break; case 405: strcpy(errtext, "keyword value not floating pt"); break; case 406: strcpy(errtext, "keyword value not double"); break; case 407: strcpy(errtext, "bad string to int conversion"); break; case 408: strcpy(errtext, "bad string to float conversion"); break; case 409: strcpy(errtext, "bad string to double convert"); break; case 410: strcpy(errtext, "illegal datatype code value"); break; case 411: strcpy(errtext, "illegal no. of decimals"); break; case 412: strcpy(errtext, "datatype conversion overflow"); break; case 413: strcpy(errtext, "error compressing image"); break; case 414: strcpy(errtext, "error uncompressing image"); break; case 420: strcpy(errtext, "bad date or time conversion"); break; case 431: strcpy(errtext, "syntax error in expression"); break; case 432: strcpy(errtext, "expression result wrong type"); break; case 433: strcpy(errtext, "vector result too large"); break; case 434: strcpy(errtext, "missing output column"); break; case 435: strcpy(errtext, "bad data in parsed column"); break; case 436: strcpy(errtext, "output extension of wrong type"); break; case 501: strcpy(errtext, "WCS angle too large"); break; case 502: strcpy(errtext, "bad WCS coordinate"); break; case 503: strcpy(errtext, "error in WCS calculation"); break; case 504: strcpy(errtext, "bad WCS projection type"); break; case 505: strcpy(errtext, "WCS keywords not found"); break; default: strcpy(errtext, "unknown error status"); break; } } else { strcpy(errtext, "unknown error status"); } return; } /*--------------------------------------------------------------------------*/ void ffpmsg(const char *err_message) /* put message on to error stack */ { ffxmsg(PutMesg, (char *)err_message); return; } /*--------------------------------------------------------------------------*/ void ffpmrk(void) /* write a marker to the stack. It is then possible to pop only those messages following the marker off of the stack, leaving the previous messages unaffected. The marker is ignored by the ffgmsg routine. */ { char *dummy = 0; ffxmsg(PutMark, dummy); return; } /*--------------------------------------------------------------------------*/ int ffgmsg(char *err_message) /* get oldest message from error stack, ignoring markers */ { ffxmsg(GetMesg, err_message); return(*err_message); } /*--------------------------------------------------------------------------*/ void ffcmsg(void) /* erase all messages in the error stack */ { char *dummy = 0; ffxmsg(DelAll, dummy); return; } /*--------------------------------------------------------------------------*/ void ffcmrk(void) /* erase newest messages in the error stack, stopping if a marker is found. The marker is also erased in this case. */ { char *dummy = 0; ffxmsg(DelMark, dummy); return; } /*--------------------------------------------------------------------------*/ void ffxmsg( int action, char *errmsg) /* general routine to get, put, or clear the error message stack. Use a static array rather than allocating memory as needed for the error messages because it is likely to be more efficient and simpler to implement. Action Code: DelAll 1 delete all messages on the error stack DelMark 2 delete messages back to and including the 1st marker DelNewest 3 delete the newest message from the stack GetMesg 4 pop and return oldest message, ignoring marks PutMesg 5 add a new message to the stack PutMark 6 add a marker to the stack */ { int ii; char markflag; static char *txtbuff[errmsgsiz], *tmpbuff, *msgptr; static char errbuff[errmsgsiz][81]; /* initialize all = \0 */ static int nummsg = 0; FFLOCK; if (action == DelAll) /* clear the whole message stack */ { for (ii = 0; ii < nummsg; ii ++) *txtbuff[ii] = '\0'; nummsg = 0; } else if (action == DelMark) /* clear up to and including first marker */ { while (nummsg > 0) { nummsg--; markflag = *txtbuff[nummsg]; /* store possible marker character */ *txtbuff[nummsg] = '\0'; /* clear the buffer for this msg */ if (markflag == ESMARKER) break; /* found a marker, so quit */ } } else if (action == DelNewest) /* remove newest message from stack */ { if (nummsg > 0) { nummsg--; *txtbuff[nummsg] = '\0'; /* clear the buffer for this msg */ } } else if (action == GetMesg) /* pop and return oldest message from stack */ { /* ignoring markers */ while (nummsg > 0) { strcpy(errmsg, txtbuff[0]); /* copy oldest message to output */ *txtbuff[0] = '\0'; /* clear the buffer for this msg */ nummsg--; for (ii = 0; ii < nummsg; ii++) txtbuff[ii] = txtbuff[ii + 1]; /* shift remaining pointers */ if (errmsg[0] != ESMARKER) { /* quit if this is not a marker */ FFUNLOCK; return; } } errmsg[0] = '\0'; /* no messages in the stack */ } else if (action == PutMesg) /* add new message to stack */ { msgptr = errmsg; while (strlen(msgptr)) { if (nummsg == errmsgsiz) { tmpbuff = txtbuff[0]; /* buffers full; reuse oldest buffer */ *txtbuff[0] = '\0'; /* clear the buffer for this msg */ nummsg--; for (ii = 0; ii < nummsg; ii++) txtbuff[ii] = txtbuff[ii + 1]; /* shift remaining pointers */ txtbuff[nummsg] = tmpbuff; /* set pointer for the new message */ } else { for (ii = 0; ii < errmsgsiz; ii++) { if (*errbuff[ii] == '\0') /* find first empty buffer */ { txtbuff[nummsg] = errbuff[ii]; break; } } } strncat(txtbuff[nummsg], msgptr, 80); nummsg++; msgptr += minvalue(80, strlen(msgptr)); } } else if (action == PutMark) /* put a marker on the stack */ { if (nummsg == errmsgsiz) { tmpbuff = txtbuff[0]; /* buffers full; reuse oldest buffer */ *txtbuff[0] = '\0'; /* clear the buffer for this msg */ nummsg--; for (ii = 0; ii < nummsg; ii++) txtbuff[ii] = txtbuff[ii + 1]; /* shift remaining pointers */ txtbuff[nummsg] = tmpbuff; /* set pointer for the new message */ } else { for (ii = 0; ii < errmsgsiz; ii++) { if (*errbuff[ii] == '\0') /* find first empty buffer */ { txtbuff[nummsg] = errbuff[ii]; break; } } } *txtbuff[nummsg] = ESMARKER; /* write the marker */ *(txtbuff[nummsg] + 1) = '\0'; nummsg++; } FFUNLOCK; return; } /*--------------------------------------------------------------------------*/ int ffpxsz(int datatype) /* return the number of bytes per pixel associated with the datatype */ { if (datatype == TBYTE) return(sizeof(char)); else if (datatype == TUSHORT) return(sizeof(short)); else if (datatype == TSHORT) return(sizeof(short)); else if (datatype == TULONG) return(sizeof(long)); else if (datatype == TLONG) return(sizeof(long)); else if (datatype == TINT) return(sizeof(int)); else if (datatype == TUINT) return(sizeof(int)); else if (datatype == TFLOAT) return(sizeof(float)); else if (datatype == TDOUBLE) return(sizeof(double)); else if (datatype == TLOGICAL) return(sizeof(char)); else return(0); } /*--------------------------------------------------------------------------*/ int fftkey(const char *keyword, /* I - keyword name */ int *status) /* IO - error status */ /* Test that the keyword name conforms to the FITS standard. Must contain only capital letters, digits, minus or underscore chars. Trailing spaces are allowed. If the input status value is less than zero, then the test is modified so that upper or lower case letters are allowed, and no error messages are printed if the keyword is not legal. */ { size_t maxchr, ii; int spaces=0; char msg[81], testchar; if (*status > 0) /* inherit input status value if > 0 */ return(*status); maxchr=strlen(keyword); if (maxchr > 8) maxchr = 8; for (ii = 0; ii < maxchr; ii++) { if (*status == 0) testchar = keyword[ii]; else testchar = toupper(keyword[ii]); if ( (testchar >= 'A' && testchar <= 'Z') || (testchar >= '0' && testchar <= '9') || testchar == '-' || testchar == '_' ) { if (spaces) { if (*status == 0) { /* don't print error message if status < 0 */ sprintf(msg, "Keyword name contains embedded space(s): %.8s", keyword); ffpmsg(msg); } return(*status = BAD_KEYCHAR); } } else if (keyword[ii] == ' ') spaces = 1; else { if (*status == 0) { /* don't print error message if status < 0 */ sprintf(msg, "Character %d in this keyword is illegal: %.8s", (int) (ii+1), keyword); ffpmsg(msg); /* explicitly flag the 2 most common cases */ if (keyword[ii] == 0) ffpmsg(" (This a NULL (0) character)."); else if (keyword[ii] == 9) ffpmsg(" (This an ASCII TAB (9) character)."); } return(*status = BAD_KEYCHAR); } } return(*status); } /*--------------------------------------------------------------------------*/ int fftrec(char *card, /* I - keyword card to test */ int *status) /* IO - error status */ /* Test that the keyword card conforms to the FITS standard. Must contain only printable ASCII characters; */ { size_t ii, maxchr; char msg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); maxchr = strlen(card); for (ii = 8; ii < maxchr; ii++) { if (card[ii] < 32 || card[ii] > 126) { sprintf(msg, "Character %d in this keyword is illegal. Hex Value = %X", (int) (ii+1), (int) card[ii] ); if (card[ii] == 0) strcat(msg, " (NULL char.)"); else if (card[ii] == 9) strcat(msg, " (TAB char.)"); else if (card[ii] == 10) strcat(msg, " (Line Feed char.)"); else if (card[ii] == 11) strcat(msg, " (Vertical Tab)"); else if (card[ii] == 12) strcat(msg, " (Form Feed char.)"); else if (card[ii] == 13) strcat(msg, " (Carriage Return)"); else if (card[ii] == 27) strcat(msg, " (Escape char.)"); else if (card[ii] == 127) strcat(msg, " (Delete char.)"); ffpmsg(msg); strncpy(msg, card, 80); msg[80] = '\0'; ffpmsg(msg); return(*status = BAD_KEYCHAR); } } return(*status); } /*--------------------------------------------------------------------------*/ void ffupch(char *string) /* convert string to upper case, in place. */ { size_t len, ii; len = strlen(string); for (ii = 0; ii < len; ii++) string[ii] = toupper(string[ii]); return; } /*--------------------------------------------------------------------------*/ int ffmkky(const char *keyname, /* I - keyword name */ char *value, /* I - keyword value */ const char *comm, /* I - keyword comment */ char *card, /* O - constructed keyword card */ int *status) /* IO - status value */ /* Make a complete FITS 80-byte keyword card from the input name, value and comment strings. Output card is null terminated without any trailing blanks. */ { size_t namelen, len, ii; char tmpname[FLEN_KEYWORD], *cptr; int tstatus = -1, nblank = 0; if (*status > 0) return(*status); *tmpname = '\0'; *card = '\0'; while(*(keyname + nblank) == ' ') /* skip leading blanks in the name */ nblank++; strncat(tmpname, keyname + nblank, FLEN_KEYWORD - 1); len = strlen(value); namelen = strlen(tmpname); if (namelen) { cptr = tmpname + namelen - 1; while(*cptr == ' ') /* skip trailing blanks */ { *cptr = '\0'; cptr--; } namelen = cptr - tmpname + 1; } if (namelen <= 8 && (fftkey(keyname, &tstatus) <= 0) ) { /* a normal FITS keyword */ strcat(card, tmpname); /* copy keyword name to buffer */ for (ii = namelen; ii < 8; ii++) card[ii] = ' '; /* pad keyword name with spaces */ card[8] = '='; /* append '= ' in columns 9-10 */ card[9] = ' '; card[10] = '\0'; /* terminate the partial string */ namelen = 10; } else { /* use the ESO HIERARCH convention for longer keyword names */ /* check that the name does not contain an '=' (equals sign) */ if (strchr(tmpname, '=') ) { ffpmsg("Illegal keyword name; contains an equals sign (=)"); ffpmsg(tmpname); return(*status = BAD_KEYCHAR); } /* Don't repeat HIERARCH if the keyword already contains it */ if (FSTRNCMP(tmpname, "HIERARCH ", 9) && FSTRNCMP(tmpname, "hierarch ", 9)) strcat(card, "HIERARCH "); else namelen -= 9; /* deleted the string 'HIERARCH ' */ strcat(card, tmpname); if (namelen + 12 + len > 80) { /* save 1 char by not putting a space before the equals sign */ strcat(card, "= "); namelen += 11; } else { strcat(card, " = "); namelen += 12; } } if (len > 0) { if (value[0] == '\'') /* is this a quoted string value? */ { if (namelen > 77) { ffpmsg( "The following keyword + value is too long to fit on a card:"); ffpmsg(keyname); ffpmsg(value); return(*status = BAD_KEYCHAR); } strncat(card, value, 80 - namelen); /* append the value string */ len = minvalue(80, namelen + len); /* restore the closing quote if it got truncated */ if (len == 80) { card[79] = '\''; } if (comm) { if (comm[0] != 0) { if (len < 30) { for (ii = len; ii < 30; ii++) card[ii] = ' '; /* fill with spaces to col 30 */ card[30] = '\0'; len = 30; } } } } else { if (namelen + len > 80) { ffpmsg( "The following keyword + value is too long to fit on a card:"); ffpmsg(keyname); ffpmsg(value); return(*status = BAD_KEYCHAR); } else if (namelen + len < 30) { /* add spaces so field ends at least in col 30 */ strncat(card, " ", 30 - (namelen + len)); } strncat(card, value, 80 - namelen); /* append the value string */ len = minvalue(80, namelen + len); len = maxvalue(30, len); } if (comm) { if ((len < 77) && ( strlen(comm) > 0) ) /* room for a comment? */ { strcat(card, " / "); /* append comment separator */ strncat(card, comm, 77 - len); /* append comment (what fits) */ } } } else { if (namelen == 10) /* This case applies to normal keywords only */ { card[8] = ' '; /* keywords with no value have no '=' */ if (comm) { strncat(card, comm, 80 - namelen); /* append comment (what fits) */ } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffmkey(fitsfile *fptr, /* I - FITS file pointer */ const char *card, /* I - card string value */ int *status) /* IO - error status */ /* replace the previously read card (i.e. starting 80 bytes before the (fptr->Fptr)->nextkey position) with the contents of the input card. */ { char tcard[81]; size_t len, ii; /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); strncpy(tcard,card,80); tcard[80] = '\0'; len = strlen(tcard); /* silently replace any illegal characters with a space */ for (ii=0; ii < len; ii++) if (tcard[ii] < ' ' || tcard[ii] > 126) tcard[ii] = ' '; for (ii=len; ii < 80; ii++) /* fill card with spaces if necessary */ tcard[ii] = ' '; for (ii=0; ii < 8; ii++) /* make sure keyword name is uppercase */ tcard[ii] = toupper(tcard[ii]); fftkey(tcard, status); /* test keyword name contains legal chars */ /* no need to do this any more, since any illegal characters have been removed fftrec(tcard, status); */ /* test rest of keyword for legal chars */ /* move position of keyword to be over written */ ffmbyt(fptr, ((fptr->Fptr)->nextkey) - 80, REPORT_EOF, status); ffpbyt(fptr, 80, tcard, status); /* write the 80 byte card */ return(*status); } /*--------------------------------------------------------------------------*/ int ffkeyn(const char *keyroot, /* I - root string for keyword name */ int value, /* I - index number to be appended to root name */ char *keyname, /* O - output root + index keyword name */ int *status) /* IO - error status */ /* Construct a keyword name string by appending the index number to the root. e.g., if root = "TTYPE" and value = 12 then keyname = "TTYPE12". */ { char suffix[16]; size_t rootlen; keyname[0] = '\0'; /* initialize output name to null */ rootlen = strlen(keyroot); if (rootlen == 0 || rootlen > 7 || value < 0 ) return(*status = 206); sprintf(suffix, "%d", value); /* construct keyword suffix */ if ( strlen(suffix) + rootlen > 8) return(*status = 206); strcpy(keyname, keyroot); /* copy root string to name string */ strcat(keyname, suffix); /* append suffix to the root */ return(*status); } /*--------------------------------------------------------------------------*/ int ffnkey(int value, /* I - index number to be appended to root name */ const char *keyroot, /* I - root string for keyword name */ char *keyname, /* O - output root + index keyword name */ int *status) /* IO - error status */ /* Construct a keyword name string by appending the root string to the index number. e.g., if root = "TTYPE" and value = 12 then keyname = "12TTYPE". */ { size_t rootlen; keyname[0] = '\0'; /* initialize output name to null */ rootlen = strlen(keyroot); if (rootlen == 0 || rootlen > 7 || value < 0 ) return(*status = 206); sprintf(keyname, "%d", value); /* construct keyword prefix */ if (rootlen + strlen(keyname) > 8) return(*status = 206); strcat(keyname, keyroot); /* append root to the prefix */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpsvc(char *card, /* I - FITS header card (nominally 80 bytes long) */ char *value, /* O - value string parsed from the card */ char *comm, /* O - comment string parsed from the card */ int *status) /* IO - error status */ /* ParSe the Value and Comment strings from the input header card string. If the card contains a quoted string value, the returned value string includes the enclosing quote characters. If comm = NULL, don't return the comment string. */ { int jj; size_t ii, cardlen, nblank, valpos; if (*status > 0) return(*status); value[0] = '\0'; if (comm) comm[0] = '\0'; cardlen = strlen(card); /* support for ESO HIERARCH keywords; find the '=' */ if (FSTRNCMP(card, "HIERARCH ", 9) == 0) { valpos = strcspn(card, "="); if (valpos == cardlen) /* no value indicator ??? */ { if (comm != NULL) { if (cardlen > 8) { strcpy(comm, &card[8]); jj=cardlen - 8; for (jj--; jj >= 0; jj--) /* replace trailing blanks with nulls */ { if (comm[jj] == ' ') comm[jj] = '\0'; else break; } } } return(*status); /* no value indicator */ } valpos++; /* point to the position after the '=' */ } else if (cardlen < 9 || FSTRNCMP(card, "COMMENT ", 8) == 0 || /* keywords with no value */ FSTRNCMP(card, "HISTORY ", 8) == 0 || FSTRNCMP(card, "END ", 8) == 0 || FSTRNCMP(card, " ", 8) == 0 || FSTRNCMP(&card[8], "= ", 2) != 0 ) /* no '= ' in cols 9-10 */ { /* no value, so the comment extends from cols 9 - 80 */ if (comm != NULL) { if (cardlen > 8) { strcpy(comm, &card[8]); jj=cardlen - 8; for (jj--; jj >= 0; jj--) /* replace trailing blanks with nulls */ { if (comm[jj] == ' ') comm[jj] = '\0'; else break; } } } return(*status); } else { valpos = 10; /* starting position of the value field */ } nblank = strspn(&card[valpos], " "); /* find number of leading blanks */ if (nblank + valpos == cardlen) { /* the absence of a value string is legal, and simply indicates that the keyword value is undefined. Don't write an error message in this case. */ return(*status); } ii = valpos + nblank; if (card[ii] == '/' ) /* slash indicates start of the comment */ { ii++; } else if (card[ii] == '\'' ) /* is this a quoted string value? */ { value[0] = card[ii]; for (jj=1, ii++; ii < cardlen; ii++, jj++) { if (card[ii] == '\'') /* is this the closing quote? */ { if (card[ii+1] == '\'') /* 2 successive quotes? */ { value[jj] = card[ii]; ii++; jj++; } else { value[jj] = card[ii]; break; /* found the closing quote, so exit this loop */ } } value[jj] = card[ii]; /* copy the next character to the output */ } if (ii == cardlen) { jj = minvalue(jj, 69); /* don't exceed 70 char string length */ value[jj] = '\''; /* close the bad value string */ value[jj+1] = '\0'; /* terminate the bad value string */ ffpmsg("This keyword string value has no closing quote:"); ffpmsg(card); /* May 2008 - modified to not fail on this minor error */ /* return(*status = NO_QUOTE); */ } else { value[jj+1] = '\0'; /* terminate the good value string */ ii++; /* point to the character following the value */ } } else if (card[ii] == '(' ) /* is this a complex value? */ { nblank = strcspn(&card[ii], ")" ); /* find closing ) */ if (nblank == strlen( &card[ii] ) ) { ffpmsg("This complex keyword value has no closing ')':"); ffpmsg(card); return(*status = NO_QUOTE); } nblank++; strncpy(value, &card[ii], nblank); value[nblank] = '\0'; ii = ii + nblank; } else /* an integer, floating point, or logical FITS value string */ { nblank = strcspn(&card[ii], " /"); /* find the end of the token */ strncpy(value, &card[ii], nblank); value[nblank] = '\0'; ii = ii + nblank; } /* now find the comment string, if any */ if (comm) { nblank = strspn(&card[ii], " "); /* find next non-space character */ ii = ii + nblank; if (ii < 80) { if (card[ii] == '/') /* ignore the slash separator */ { ii++; if (card[ii] == ' ') /* also ignore the following space */ ii++; } strcat(comm, &card[ii]); /* copy the remaining characters */ jj=strlen(comm); for (jj--; jj >= 0; jj--) /* replace trailing blanks with nulls */ { if (comm[jj] == ' ') comm[jj] = '\0'; else break; } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgthd(char *tmplt, /* I - input header template string */ char *card, /* O - returned FITS header record */ int *hdtype, /* O - how to interpreter the returned card string */ /* -2 = modify the name of a keyword; the old keyword name is returned starting at address chars[0]; the new name is returned starting at address char[40] (to be consistent with the Fortran version). Both names are null terminated. -1 = card contains the name of a keyword that is to be deleted 0 = append this keyword if it doesn't already exist, or modify the value if the keyword already exists. 1 = append this comment keyword ('HISTORY', 'COMMENT', or blank keyword name) 2 = this is the END keyword; do not write it to the header */ int *status) /* IO - error status */ /* 'Get Template HeaDer' parse a template header line and create a formated character string which is suitable for appending to a FITS header */ { char keyname[FLEN_KEYWORD], value[140], comment[140]; char *tok, *suffix, *loc, tvalue[140]; int len, vlen, more, tstatus; double dval; if (*status > 0) return(*status); card[0] = '\0'; *hdtype = 0; if (!FSTRNCMP(tmplt, " ", 8) ) { /* if first 8 chars of template are blank, then this is a comment */ strncat(card, tmplt, 80); *hdtype = 1; return(*status); } tok = tmplt; /* point to start of template string */ keyname[0] = '\0'; value[0] = '\0'; comment[0] = '\0'; len = strspn(tok, " "); /* no. of spaces before keyword */ tok += len; /* test for pecular case where token is a string of dashes */ if (strncmp(tok, "--------------------", 20) == 0) return(*status = BAD_KEYCHAR); if (tok[0] == '-') /* is there a leading minus sign? */ { /* first token is name of keyword to be deleted or renamed */ *hdtype = -1; tok++; len = strspn(tok, " "); /* no. of spaces before keyword */ tok += len; if (len < 8) /* not a blank name? */ { len = strcspn(tok, " ="); /* length of name */ if (len >= FLEN_KEYWORD) return(*status = BAD_KEYCHAR); strncat(card, tok, len); /* The HIERARCH convention supports non-standard characters in the keyword name, so don't always convert to upper case or abort if there are illegal characters in the name or if the name is greater than 8 characters long. */ if (len < 9) /* this is possibly a normal FITS keyword name */ { ffupch(card); tstatus = 0; if (fftkey(card, &tstatus) > 0) { /* name contained non-standard characters, so reset */ card[0] = '\0'; strncat(card, tok, len); } } tok += len; } /* second token, if present, is the new name for the keyword */ len = strspn(tok, " "); /* no. of spaces before next token */ tok += len; if (tok[0] == '\0' || tok[0] == '=') return(*status); /* no second token */ *hdtype = -2; len = strcspn(tok, " "); /* length of new name */ if (len > 40) /* name has to fit on columns 41-80 of card */ return(*status = BAD_KEYCHAR); /* copy the new name to card + 40; This is awkward, */ /* but is consistent with the way the Fortran FITSIO works */ strcat(card," "); strncpy(&card[40], tok, len+1); /* copy len+1 to get terminator */ /* The HIERARCH convention supports non-standard characters in the keyword name, so don't always convert to upper case or abort if there are illegal characters in the name or if the name is greater than 8 characters long. */ if (len < 9) /* this is possibly a normal FITS keyword name */ { ffupch(&card[40]); tstatus = 0; if (fftkey(&card[40], &tstatus) > 0) { /* name contained non-standard characters, so reset */ strncpy(&card[40], tok, len); } } } else /* no negative sign at beginning of template */ { /* get the keyword name token */ len = strcspn(tok, " ="); /* length of keyword name */ if (len >= FLEN_KEYWORD) return(*status = BAD_KEYCHAR); strncat(keyname, tok, len); /* The HIERARCH convention supports non-standard characters in the keyword name, so don't always convert to upper case or abort if there are illegal characters in the name or if the name is greater than 8 characters long. */ if (len < 9) /* this is possibly a normal FITS keyword name */ { ffupch(keyname); tstatus = 0; if (fftkey(keyname, &tstatus) > 0) { /* name contained non-standard characters, so reset */ keyname[0] = '\0'; strncat(keyname, tok, len); } } if (!FSTRCMP(keyname, "END") ) { strcpy(card, "END"); *hdtype = 2; return(*status); } tok += len; /* move token pointer to end of the keyword */ if (!FSTRCMP(keyname, "COMMENT") || !FSTRCMP(keyname, "HISTORY") || !FSTRCMP(keyname, "HIERARCH") ) { *hdtype = 1; /* simply append COMMENT and HISTORY keywords */ strcpy(card, keyname); strncat(card, tok, 73); return(*status); } /* look for the value token */ len = strspn(tok, " ="); /* spaces or = between name and value */ tok += len; if (*tok == '\'') /* is value enclosed in quotes? */ { more = TRUE; while (more) { tok++; /* temporarily move past the quote char */ len = strcspn(tok, "'"); /* length of quoted string */ tok--; strncat(value, tok, len + 2); tok += len + 1; if (tok[0] != '\'') /* check there is a closing quote */ return(*status = NO_QUOTE); tok++; if (tok[0] != '\'') /* 2 quote chars = literal quote */ more = FALSE; } } else if (*tok == '/' || *tok == '\0') /* There is no value */ { strcat(value, " "); } else /* not a quoted string value */ { len = strcspn(tok, " /"); /* length of value string */ strncat(value, tok, len); if (!( (tok[0] == 'T' || tok[0] == 'F') && (tok[1] == ' ' || tok[1] == '/' || tok[1] == '\0') )) { /* not a logical value */ dval = strtod(value, &suffix); /* try to read value as number */ if (*suffix != '\0' && *suffix != ' ' && *suffix != '/') { /* value not recognized as a number; might be because it */ /* contains a 'd' or 'D' exponent character */ strcpy(tvalue, value); if ((loc = strchr(tvalue, 'D'))) { *loc = 'E'; /* replace D's with E's. */ dval = strtod(tvalue, &suffix); /* read value again */ } else if ((loc = strchr(tvalue, 'd'))) { *loc = 'E'; /* replace d's with E's. */ dval = strtod(tvalue, &suffix); /* read value again */ } else if ((loc = strchr(tvalue, '.'))) { *loc = ','; /* replace period with a comma */ dval = strtod(tvalue, &suffix); /* read value again */ } } if (*suffix != '\0' && *suffix != ' ' && *suffix != '/') { /* value is not a number; must enclose it in quotes */ strcpy(value, "'"); strncat(value, tok, len); strcat(value, "'"); /* the following useless statement stops the compiler warning */ /* that dval is not used anywhere */ if (dval == 0.) len += (int) dval; } else { /* value is a number; convert any 'e' to 'E', or 'd' to 'D' */ loc = strchr(value, 'e'); if (loc) { *loc = 'E'; } else { loc = strchr(value, 'd'); if (loc) { *loc = 'D'; } } } } tok += len; } len = strspn(tok, " /"); /* no. of spaces between value and comment */ tok += len; vlen = strlen(value); if (vlen > 0 && vlen < 10 && value[0] == '\'') { /* pad quoted string with blanks so it is at least 8 chars long */ value[vlen-1] = '\0'; strncat(value, " ", 10 - vlen); strcat(&value[9], "'"); } /* get the comment string */ strncat(comment, tok, 70); /* construct the complete FITS header card */ ffmkky(keyname, value, comment, card, status); } return(*status); } /*--------------------------------------------------------------------------*/ int fits_translate_keyword( char *inrec, /* I - input string */ char *outrec, /* O - output converted string, or */ /* a null string if input does not */ /* match any of the patterns */ char *patterns[][2],/* I - pointer to input / output string */ /* templates */ int npat, /* I - number of templates passed */ int n_value, /* I - base 'n' template value of interest */ int n_offset, /* I - offset to be applied to the 'n' */ /* value in the output string */ int n_range, /* I - controls range of 'n' template */ /* values of interest (-1,0, or +1) */ int *pat_num, /* O - matched pattern number (0 based) or -1 */ int *i, /* O - value of i, if any, else 0 */ int *j, /* O - value of j, if any, else 0 */ int *m, /* O - value of m, if any, else 0 */ int *n, /* O - value of n, if any, else 0 */ int *status) /* IO - error status */ /* Translate a keyword name to a new name, based on a set of patterns. The user passes an array of patterns to be matched. Input pattern number i is pattern[i][0], and output pattern number i is pattern[i][1]. Keywords are matched against the input patterns. If a match is found then the keyword is re-written according to the output pattern. Order is important. The first match is accepted. The fastest match will be made when templates with the same first character are grouped together. Several characters have special meanings: i,j - single digits, preserved in output template n - column number of one or more digits, preserved in output template m - generic number of one or more digits, preserved in output template a - coordinate designator, preserved in output template # - number of one or more digits ? - any character * - only allowed in first character position, to match all keywords; only useful as last pattern in the list i, j, n, and m are returned by the routine. For example, the input pattern "iCTYPn" will match "1CTYP5" (if n_value is 5); the output pattern "CTYPEi" will be re-written as "CTYPE1". Notice that "i" is preserved. The following output patterns are special Special output pattern characters: "-" - do not copy a keyword that matches the corresponding input pattern "+" - copy the input unchanged The inrec string could be just the 8-char keyword name, or the entire 80-char header record. Characters 9 = 80 in the input string simply get appended to the translated keyword name. If n_range = 0, then only keywords with 'n' equal to n_value will be considered as a pattern match. If n_range = +1, then all values of 'n' greater than or equal to n_value will be a match, and if -1, then values of 'n' less than or equal to n_value will match. This routine was written by Craig Markwardt, GSFC */ { int i1 = 0, j1 = 0, n1 = 0, m1 = 0; int fac; char a = ' '; char oldp; char c, s; int ip, ic, pat, pass = 0, firstfail; char *spat; if (*status > 0) return(*status); if ((inrec == 0) || (outrec == 0)) return (*status = NULL_INPUT_PTR); *outrec = '\0'; /* if (*inrec == '\0') return 0; */ if (*inrec == '\0') /* expand to full 8 char blank keyword name */ strcpy(inrec, " "); oldp = '\0'; firstfail = 0; /* ===== Pattern match stage */ for (pat=0; pat < npat; pat++) { spat = patterns[pat][0]; i1 = 0; j1 = 0; m1 = -1; n1 = -1; a = ' '; /* Initialize the place-holders */ pass = 0; /* Pass the wildcard pattern */ if (spat[0] == '*') { pass = 1; break; } /* Optimization: if we have seen this initial pattern character before, then it must have failed, and we can skip the pattern */ if (firstfail && spat[0] == oldp) continue; oldp = spat[0]; /* ip = index of pattern character being matched ic = index of keyname character being matched firstfail = 1 if we fail on the first characteor (0=not) */ for (ip=0, ic=0, firstfail=1; (spat[ip]) && (ic < 8); ip++, ic++, firstfail=0) { c = inrec[ic]; s = spat[ip]; if (s == 'i') { /* Special pattern: 'i' placeholder */ if (isdigit(c)) { i1 = c - '0'; pass = 1;} } else if (s == 'j') { /* Special pattern: 'j' placeholder */ if (isdigit(c)) { j1 = c - '0'; pass = 1;} } else if ((s == 'n')||(s == 'm')||(s == '#')) { /* Special patterns: multi-digit number */ int val = 0; pass = 0; if (isdigit(c)) { pass = 1; /* NOTE, could fail below */ /* Parse decimal number */ while (ic<8 && isdigit(c)) { val = val*10 + (c - '0'); ic++; c = inrec[ic]; } ic--; c = inrec[ic]; if (s == 'n') { /* Is it a column number? */ if ( val >= 1 && val <= 999 && /* Row range check */ (((n_range == 0) && (val == n_value)) || /* Strict equality */ ((n_range == -1) && (val <= n_value)) || /* n <= n_value */ ((n_range == +1) && (val >= n_value))) ) { /* n >= n_value */ n1 = val; } else { pass = 0; } } else if (s == 'm') { /* Generic number */ m1 = val; } } } else if (s == 'a') { /* Special pattern: coordinate designator */ if (isupper(c) || c == ' ') { a = c; pass = 1;} } else if (s == '?') { /* Match any individual character */ pass = 1; } else if (c == s) { /* Match a specific character */ pass = 1; } else { /* FAIL */ pass = 0; } if (!pass) break; } /* Must pass to the end of the keyword. No partial matches allowed */ if (pass && (ic >= 8 || inrec[ic] == ' ')) break; } /* Transfer the pattern-matched numbers to the output parameters */ if (i) { *i = i1; } if (j) { *j = j1; } if (n) { *n = n1; } if (m) { *m = m1; } if (pat_num) { *pat_num = pat; } /* ===== Keyword rewriting and output stage */ spat = patterns[pat][1]; /* Return case: no match, or explicit deletion pattern */ if (pass == 0 || spat[0] == '\0' || spat[0] == '-') return 0; /* A match: we start by copying the input record to the output */ strcpy(outrec, inrec); /* Return case: return the input record unchanged */ if (spat[0] == '+') return 0; /* Final case: a new output pattern */ for (ip=0, ic=0; spat[ip]; ip++, ic++) { s = spat[ip]; if (s == 'i') { outrec[ic] = (i1+'0'); } else if (s == 'j') { outrec[ic] = (j1+'0'); } else if (s == 'n') { if (n1 == -1) { n1 = n_value; } if (n1 > 0) { n1 += n_offset; for (fac = 1; (n1/fac) > 0; fac *= 10); fac /= 10; while(fac > 0) { outrec[ic] = ((n1/fac) % 10) + '0'; fac /= 10; ic ++; } ic--; } } else if (s == 'm' && m1 >= 0) { for (fac = 1; (m1/fac) > 0; fac *= 10); fac /= 10; while(fac > 0) { outrec[ic] = ((m1/fac) % 10) + '0'; fac /= 10; ic ++; } ic --; } else if (s == 'a') { outrec[ic] = a; } else { outrec[ic] = s; } } /* Pad the keyword name with spaces */ for ( ; ic<8; ic++) { outrec[ic] = ' '; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_translate_keywords( fitsfile *infptr, /* I - pointer to input HDU */ fitsfile *outfptr, /* I - pointer to output HDU */ int firstkey, /* I - first HDU record number to start with */ char *patterns[][2],/* I - pointer to input / output keyword templates */ int npat, /* I - number of templates passed */ int n_value, /* I - base 'n' template value of interest */ int n_offset, /* I - offset to be applied to the 'n' */ /* value in the output string */ int n_range, /* I - controls range of 'n' template */ /* values of interest (-1,0, or +1) */ int *status) /* IO - error status */ /* Copy relevant keywords from the table header into the newly created primary array header. Convert names of keywords where appropriate. See fits_translate_keyword() for the definitions. Translation begins at header record number 'firstkey', and continues to the end of the header. This routine was written by Craig Markwardt, GSFC */ { int nrec, nkeys, nmore; char rec[FLEN_CARD]; int i = 0, j = 0, n = 0, m = 0; int pat_num = 0, maxchr, ii; char outrec[FLEN_CARD]; if (*status > 0) return(*status); ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords */ for (nrec = firstkey; nrec <= nkeys; nrec++) { outrec[0] = '\0'; ffgrec(infptr, nrec, rec, status); /* silently overlook any illegal ASCII characters in the value or */ /* comment fields of the record. It is usually not appropriate to */ /* abort the process because of this minor transgression of the FITS rules. */ /* Set the offending character to a blank */ maxchr = strlen(rec); for (ii = 8; ii < maxchr; ii++) { if (rec[ii] < 32 || rec[ii] > 126) rec[ii] = ' '; } fits_translate_keyword(rec, outrec, patterns, npat, n_value, n_offset, n_range, &pat_num, &i, &j, &m, &n, status); if (outrec[0]) { ffprec(outfptr, outrec, status); /* copy the keyword */ rec[8] = 0; outrec[8] = 0; } else { rec[8] = 0; outrec[8] = 0; } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_copy_pixlist2image( fitsfile *infptr, /* I - pointer to input HDU */ fitsfile *outfptr, /* I - pointer to output HDU */ int firstkey, /* I - first HDU record number to start with */ int naxis, /* I - number of axes in the image */ int *colnum, /* I - numbers of the columns to be binned */ int *status) /* IO - error status */ /* Copy relevant keywords from the pixel list table header into a newly created primary array header. Convert names of keywords where appropriate. See fits_translate_pixkeyword() for the definitions. Translation begins at header record number 'firstkey', and continues to the end of the header. */ { int nrec, nkeys, nmore; char rec[FLEN_CARD], outrec[FLEN_CARD]; int pat_num = 0, npat; int iret, jret, nret, mret, lret; char *patterns[][2] = { {"TCTYPn", "CTYPEn" }, {"TCTYna", "CTYPEna" }, {"TCUNIn", "CUNITn" }, {"TCUNna", "CUNITna" }, {"TCRVLn", "CRVALn" }, {"TCRVna", "CRVALna" }, {"TCDLTn", "CDELTn" }, {"TCDEna", "CDELTna" }, {"TCRPXn", "CRPIXn" }, {"TCRPna", "CRPIXna" }, {"TCROTn", "CROTAn" }, {"TPn_ma", "PCn_ma" }, {"TPCn_m", "PCn_ma" }, {"TCn_ma", "CDn_ma" }, {"TCDn_m", "CDn_ma" }, {"TVn_la", "PVn_la" }, {"TPVn_l", "PVn_la" }, {"TSn_la", "PSn_la" }, {"TPSn_l", "PSn_la" }, {"TWCSna", "WCSNAMEa" }, {"TCNAna", "CNAMEna" }, {"TCRDna", "CRDERna" }, {"TCSYna", "CSYERna" }, {"LONPna", "LONPOLEa" }, {"LATPna", "LATPOLEa" }, {"EQUIna", "EQUINOXa" }, {"MJDOBn", "MJD-OBS" }, {"MJDAn", "MJD-AVG" }, {"DAVGn", "DATE-AVG" }, {"RADEna", "RADESYSa" }, {"RFRQna", "RESTFRQa" }, {"RWAVna", "RESTWAVa" }, {"SPECna", "SPECSYSa" }, {"SOBSna", "SSYSOBSa" }, {"SSRCna", "SSYSSRCa" }, /* preserve common keywords */ {"LONPOLEa", "+" }, {"LATPOLEa", "+" }, {"EQUINOXa", "+" }, {"EPOCH", "+" }, {"MJD-????", "+" }, {"DATE????", "+" }, {"TIME????", "+" }, {"RADESYSa", "+" }, {"RADECSYS", "+" }, {"TELESCOP", "+" }, {"INSTRUME", "+" }, {"OBSERVER", "+" }, {"OBJECT", "+" }, /* Delete general table column keywords */ {"XTENSION", "-" }, {"BITPIX", "-" }, {"NAXIS", "-" }, {"NAXISi", "-" }, {"PCOUNT", "-" }, {"GCOUNT", "-" }, {"TFIELDS", "-" }, {"TDIM#", "-" }, {"THEAP", "-" }, {"EXTNAME", "-" }, {"EXTVER", "-" }, {"EXTLEVEL","-" }, {"CHECKSUM","-" }, {"DATASUM", "-" }, {"NAXLEN", "-" }, {"AXLEN#", "-" }, {"CPREF", "-" }, /* Delete table keywords related to other columns */ {"T????#a", "-" }, {"TC??#a", "-" }, {"T??#_#", "-" }, {"TWCS#a", "-" }, {"LONP#a", "-" }, {"LATP#a", "-" }, {"EQUI#a", "-" }, {"MJDOB#", "-" }, {"MJDA#", "-" }, {"RADE#a", "-" }, {"DAVG#", "-" }, {"iCTYP#", "-" }, {"iCTY#a", "-" }, {"iCUNI#", "-" }, {"iCUN#a", "-" }, {"iCRVL#", "-" }, {"iCDLT#", "-" }, {"iCRPX#", "-" }, {"iCTY#a", "-" }, {"iCUN#a", "-" }, {"iCRV#a", "-" }, {"iCDE#a", "-" }, {"iCRP#a", "-" }, {"ijPC#a", "-" }, {"ijCD#a", "-" }, {"iV#_#a", "-" }, {"iS#_#a", "-" }, {"iCRD#a", "-" }, {"iCSY#a", "-" }, {"iCROT#", "-" }, {"WCAX#a", "-" }, {"WCSN#a", "-" }, {"iCNA#a", "-" }, {"*", "+" }}; /* copy all other keywords */ if (*status > 0) return(*status); npat = sizeof(patterns)/sizeof(patterns[0][0])/2; ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords */ for (nrec = firstkey; nrec <= nkeys; nrec++) { outrec[0] = '\0'; ffgrec(infptr, nrec, rec, status); fits_translate_pixkeyword(rec, outrec, patterns, npat, naxis, colnum, &pat_num, &iret, &jret, &nret, &mret, &lret, status); if (outrec[0]) { ffprec(outfptr, outrec, status); /* copy the keyword */ } rec[8] = 0; outrec[8] = 0; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_translate_pixkeyword( char *inrec, /* I - input string */ char *outrec, /* O - output converted string, or */ /* a null string if input does not */ /* match any of the patterns */ char *patterns[][2],/* I - pointer to input / output string */ /* templates */ int npat, /* I - number of templates passed */ int naxis, /* I - number of columns to be binned */ int *colnum, /* I - numbers of the columns to be binned */ int *pat_num, /* O - matched pattern number (0 based) or -1 */ int *i, int *j, int *n, int *m, int *l, int *status) /* IO - error status */ /* Translate a keyword name to a new name, based on a set of patterns. The user passes an array of patterns to be matched. Input pattern number i is pattern[i][0], and output pattern number i is pattern[i][1]. Keywords are matched against the input patterns. If a match is found then the keyword is re-written according to the output pattern. Order is important. The first match is accepted. The fastest match will be made when templates with the same first character are grouped together. Several characters have special meanings: i,j - single digits, preserved in output template n, m - column number of one or more digits, preserved in output template k - generic number of one or more digits, preserved in output template a - coordinate designator, preserved in output template # - number of one or more digits ? - any character * - only allowed in first character position, to match all keywords; only useful as last pattern in the list i, j, n, and m are returned by the routine. For example, the input pattern "iCTYPn" will match "1CTYP5" (if n_value is 5); the output pattern "CTYPEi" will be re-written as "CTYPE1". Notice that "i" is preserved. The following output patterns are special Special output pattern characters: "-" - do not copy a keyword that matches the corresponding input pattern "+" - copy the input unchanged The inrec string could be just the 8-char keyword name, or the entire 80-char header record. Characters 9 = 80 in the input string simply get appended to the translated keyword name. If n_range = 0, then only keywords with 'n' equal to n_value will be considered as a pattern match. If n_range = +1, then all values of 'n' greater than or equal to n_value will be a match, and if -1, then values of 'n' less than or equal to n_value will match. */ { int i1 = 0, j1 = 0, val; int fac, nval, mval, lval; char a = ' '; char oldp; char c, s; int ip, ic, pat, pass = 0, firstfail; char *spat; if (*status > 0) return(*status); if ((inrec == 0) || (outrec == 0)) return (*status = NULL_INPUT_PTR); *outrec = '\0'; if (*inrec == '\0') return 0; oldp = '\0'; firstfail = 0; /* ===== Pattern match stage */ for (pat=0; pat < npat; pat++) { spat = patterns[pat][0]; i1 = 0; j1 = 0; a = ' '; /* Initialize the place-holders */ pass = 0; /* Pass the wildcard pattern */ if (spat[0] == '*') { pass = 1; break; } /* Optimization: if we have seen this initial pattern character before, then it must have failed, and we can skip the pattern */ if (firstfail && spat[0] == oldp) continue; oldp = spat[0]; /* ip = index of pattern character being matched ic = index of keyname character being matched firstfail = 1 if we fail on the first characteor (0=not) */ for (ip=0, ic=0, firstfail=1; (spat[ip]) && (ic < 8); ip++, ic++, firstfail=0) { c = inrec[ic]; s = spat[ip]; if (s == 'i') { /* Special pattern: 'i' placeholder */ if (isdigit(c)) { i1 = c - '0'; pass = 1;} } else if (s == 'j') { /* Special pattern: 'j' placeholder */ if (isdigit(c)) { j1 = c - '0'; pass = 1;} } else if ((s == 'n')||(s == 'm')||(s == 'l')||(s == '#')) { /* Special patterns: multi-digit number */ val = 0; pass = 0; if (isdigit(c)) { pass = 1; /* NOTE, could fail below */ /* Parse decimal number */ while (ic<8 && isdigit(c)) { val = val*10 + (c - '0'); ic++; c = inrec[ic]; } ic--; c = inrec[ic]; if (s == 'n' || s == 'm') { /* Is it a column number? */ if ( val >= 1 && val <= 999) { if (val == colnum[0]) val = 1; else if (val == colnum[1]) val = 2; else if (val == colnum[2]) val = 3; else if (val == colnum[3]) val = 4; else { pass = 0; val = 0; } if (s == 'n') nval = val; else mval = val; } else { pass = 0; } } else if (s == 'l') { /* Generic number */ lval = val; } } } else if (s == 'a') { /* Special pattern: coordinate designator */ if (isupper(c) || c == ' ') { a = c; pass = 1;} } else if (s == '?') { /* Match any individual character */ pass = 1; } else if (c == s) { /* Match a specific character */ pass = 1; } else { /* FAIL */ pass = 0; } if (!pass) break; } /* Must pass to the end of the keyword. No partial matches allowed */ if (pass && (ic >= 8 || inrec[ic] == ' ')) break; } /* Transfer the pattern-matched numbers to the output parameters */ if (i) { *i = i1; } if (j) { *j = j1; } if (n) { *n = nval; } if (m) { *m = mval; } if (l) { *l = lval; } if (pat_num) { *pat_num = pat; } /* ===== Keyword rewriting and output stage */ spat = patterns[pat][1]; /* Return case: no match, or explicit deletion pattern */ if (pass == 0 || spat[0] == '\0' || spat[0] == '-') return 0; /* A match: we start by copying the input record to the output */ strcpy(outrec, inrec); /* Return case: return the input record unchanged */ if (spat[0] == '+') return 0; /* Final case: a new output pattern */ for (ip=0, ic=0; spat[ip]; ip++, ic++) { s = spat[ip]; if (s == 'i') { outrec[ic] = (i1+'0'); } else if (s == 'j') { outrec[ic] = (j1+'0'); } else if (s == 'n' && nval > 0) { for (fac = 1; (nval/fac) > 0; fac *= 10); fac /= 10; while(fac > 0) { outrec[ic] = ((nval/fac) % 10) + '0'; fac /= 10; ic ++; } ic--; } else if (s == 'm' && mval > 0) { for (fac = 1; (mval/fac) > 0; fac *= 10); fac /= 10; while(fac > 0) { outrec[ic] = ((mval/fac) % 10) + '0'; fac /= 10; ic ++; } ic--; } else if (s == 'l' && lval >= 0) { for (fac = 1; (lval/fac) > 0; fac *= 10); fac /= 10; while(fac > 0) { outrec[ic] = ((lval/fac) % 10) + '0'; fac /= 10; ic ++; } ic --; } else if (s == 'a') { outrec[ic] = a; } else { outrec[ic] = s; } } /* Pad the keyword name with spaces */ for ( ; ic<8; ic++) { outrec[ic] = ' '; } return(*status); } /*--------------------------------------------------------------------------*/ int ffasfm(char *tform, /* I - format code from the TFORMn keyword */ int *dtcode, /* O - numerical datatype code */ long *twidth, /* O - width of the field, in chars */ int *decimals, /* O - number of decimal places (F, E, D format) */ int *status) /* IO - error status */ { /* parse the ASCII table TFORM column format to determine the data type, the field width, and number of decimal places (if relevant) */ int ii, datacode; long longval, width; float fwidth; char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG]; if (*status > 0) return(*status); if (dtcode) *dtcode = 0; if (twidth) *twidth = 0; if (decimals) *decimals = 0; ii = 0; while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */ ii++; strcpy(temp, &tform[ii]); /* copy format string */ ffupch(temp); /* make sure it is in upper case */ form = temp; /* point to start of format string */ if (form[0] == 0) { ffpmsg("Error: ASCII table TFORM code is blank"); return(*status = BAD_TFORM); } /*-----------------------------------------------*/ /* determine default datatype code */ /*-----------------------------------------------*/ if (form[0] == 'A') datacode = TSTRING; else if (form[0] == 'I') datacode = TLONG; else if (form[0] == 'F') datacode = TFLOAT; else if (form[0] == 'E') datacode = TFLOAT; else if (form[0] == 'D') datacode = TDOUBLE; else { sprintf(message, "Illegal ASCII table TFORMn datatype: \'%s\'", tform); ffpmsg(message); return(*status = BAD_TFORM_DTYPE); } if (dtcode) *dtcode = datacode; form++; /* point to the start of field width */ if (datacode == TSTRING || datacode == TLONG) { /*-----------------------------------------------*/ /* A or I data formats: */ /*-----------------------------------------------*/ if (ffc2ii(form, &width, status) <= 0) /* read the width field */ { if (width <= 0) { width = 0; *status = BAD_TFORM; } else { /* set to shorter precision if I4 or less */ if (width <= 4 && datacode == TLONG) datacode = TSHORT; } } } else { /*-----------------------------------------------*/ /* F, E or D data formats: */ /*-----------------------------------------------*/ if (ffc2rr(form, &fwidth, status) <= 0) /* read ww.dd width field */ { if (fwidth <= 0.) *status = BAD_TFORM; else { width = (long) fwidth; /* convert from float to long */ if (width > 7 && *temp == 'F') datacode = TDOUBLE; /* type double if >7 digits */ if (width < 10) form = form + 1; /* skip 1 digit */ else form = form + 2; /* skip 2 digits */ if (form[0] == '.') /* should be a decimal point here */ { form++; /* point to start of decimals field */ if (ffc2ii(form, &longval, status) <= 0) /* read decimals */ { if (decimals) *decimals = longval; /* long to short convertion */ if (longval >= width) /* width < no. of decimals */ *status = BAD_TFORM; if (longval > 6 && *temp == 'E') datacode = TDOUBLE; /* type double if >6 digits */ } } } } } if (*status > 0) { *status = BAD_TFORM; sprintf(message,"Illegal ASCII table TFORMn code: \'%s\'", tform); ffpmsg(message); } if (dtcode) *dtcode = datacode; if (twidth) *twidth = width; return(*status); } /*--------------------------------------------------------------------------*/ int ffbnfm(char *tform, /* I - format code from the TFORMn keyword */ int *dtcode, /* O - numerical datatype code */ long *trepeat, /* O - repeat count of the field */ long *twidth, /* O - width of the field, in chars */ int *status) /* IO - error status */ { /* parse the binary table TFORM column format to determine the data type, repeat count, and the field width (if it is an ASCII (A) field) */ size_t ii, nchar; int datacode, variable, iread; long width, repeat; char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG]; if (*status > 0) return(*status); if (dtcode) *dtcode = 0; if (trepeat) *trepeat = 0; if (twidth) *twidth = 0; nchar = strlen(tform); for (ii = 0; ii < nchar; ii++) { if (tform[ii] != ' ') /* find first non-space char */ break; } if (ii == nchar) { ffpmsg("Error: binary table TFORM code is blank (ffbnfm)."); return(*status = BAD_TFORM); } strcpy(temp, &tform[ii]); /* copy format string */ ffupch(temp); /* make sure it is in upper case */ form = temp; /* point to start of format string */ /*-----------------------------------------------*/ /* get the repeat count */ /*-----------------------------------------------*/ ii = 0; while(isdigit((int) form[ii])) ii++; /* look for leading digits in the field */ if (ii == 0) repeat = 1; /* no explicit repeat count */ else sscanf(form,"%ld", &repeat); /* read repeat count */ /*-----------------------------------------------*/ /* determine datatype code */ /*-----------------------------------------------*/ form = form + ii; /* skip over the repeat field */ if (form[0] == 'P' || form[0] == 'Q') { variable = 1; /* this is a variable length column */ /* repeat = 1; */ /* disregard any other repeat value */ form++; /* move to the next data type code char */ } else variable = 0; if (form[0] == 'U') /* internal code to signify unsigned integer */ { datacode = TUSHORT; width = 2; } else if (form[0] == 'I') { datacode = TSHORT; width = 2; } else if (form[0] == 'V') /* internal code to signify unsigned integer */ { datacode = TULONG; width = 4; } else if (form[0] == 'J') { datacode = TLONG; width = 4; } else if (form[0] == 'K') { datacode = TLONGLONG; width = 8; } else if (form[0] == 'E') { datacode = TFLOAT; width = 4; } else if (form[0] == 'D') { datacode = TDOUBLE; width = 8; } else if (form[0] == 'A') { datacode = TSTRING; /* the following code is used to support the non-standard datatype of the form rAw where r = total width of the field and w = width of fixed-length substrings within the field. */ iread = 0; if (form[1] != 0) { if (form[1] == '(' ) /* skip parenthesis around */ form++; /* variable length column width */ iread = sscanf(&form[1],"%ld", &width); } if (iread != 1 || (!variable && (width > repeat)) ) width = repeat; } else if (form[0] == 'L') { datacode = TLOGICAL; width = 1; } else if (form[0] == 'X') { datacode = TBIT; width = 1; } else if (form[0] == 'B') { datacode = TBYTE; width = 1; } else if (form[0] == 'S') /* internal code to signify signed byte */ { datacode = TSBYTE; width = 1; } else if (form[0] == 'C') { datacode = TCOMPLEX; width = 8; } else if (form[0] == 'M') { datacode = TDBLCOMPLEX; width = 16; } else { sprintf(message, "Illegal binary table TFORMn datatype: \'%s\' ", tform); ffpmsg(message); return(*status = BAD_TFORM_DTYPE); } if (variable) datacode = datacode * (-1); /* flag variable cols w/ neg type code */ if (dtcode) *dtcode = datacode; if (trepeat) *trepeat = repeat; if (twidth) *twidth = width; return(*status); } /*--------------------------------------------------------------------------*/ int ffbnfmll(char *tform, /* I - format code from the TFORMn keyword */ int *dtcode, /* O - numerical datatype code */ LONGLONG *trepeat, /* O - repeat count of the field */ long *twidth, /* O - width of the field, in chars */ int *status) /* IO - error status */ { /* parse the binary table TFORM column format to determine the data type, repeat count, and the field width (if it is an ASCII (A) field) */ size_t ii, nchar; int datacode, variable, iread; long width; LONGLONG repeat; char *form, temp[FLEN_VALUE], message[FLEN_ERRMSG]; double drepeat; if (*status > 0) return(*status); if (dtcode) *dtcode = 0; if (trepeat) *trepeat = 0; if (twidth) *twidth = 0; nchar = strlen(tform); for (ii = 0; ii < nchar; ii++) { if (tform[ii] != ' ') /* find first non-space char */ break; } if (ii == nchar) { ffpmsg("Error: binary table TFORM code is blank (ffbnfmll)."); return(*status = BAD_TFORM); } strcpy(temp, &tform[ii]); /* copy format string */ ffupch(temp); /* make sure it is in upper case */ form = temp; /* point to start of format string */ /*-----------------------------------------------*/ /* get the repeat count */ /*-----------------------------------------------*/ ii = 0; while(isdigit((int) form[ii])) ii++; /* look for leading digits in the field */ if (ii == 0) repeat = 1; /* no explicit repeat count */ else { /* read repeat count */ /* print as double, because the string-to-64-bit int conversion */ /* character is platform dependent (%lld, %ld, %I64d) */ sscanf(form,"%lf", &drepeat); repeat = (LONGLONG) (drepeat + 0.1); } /*-----------------------------------------------*/ /* determine datatype code */ /*-----------------------------------------------*/ form = form + ii; /* skip over the repeat field */ if (form[0] == 'P' || form[0] == 'Q') { variable = 1; /* this is a variable length column */ /* repeat = 1; */ /* disregard any other repeat value */ form++; /* move to the next data type code char */ } else variable = 0; if (form[0] == 'U') /* internal code to signify unsigned integer */ { datacode = TUSHORT; width = 2; } else if (form[0] == 'I') { datacode = TSHORT; width = 2; } else if (form[0] == 'V') /* internal code to signify unsigned integer */ { datacode = TULONG; width = 4; } else if (form[0] == 'J') { datacode = TLONG; width = 4; } else if (form[0] == 'K') { datacode = TLONGLONG; width = 8; } else if (form[0] == 'E') { datacode = TFLOAT; width = 4; } else if (form[0] == 'D') { datacode = TDOUBLE; width = 8; } else if (form[0] == 'A') { datacode = TSTRING; /* the following code is used to support the non-standard datatype of the form rAw where r = total width of the field and w = width of fixed-length substrings within the field. */ iread = 0; if (form[1] != 0) { if (form[1] == '(' ) /* skip parenthesis around */ form++; /* variable length column width */ iread = sscanf(&form[1],"%ld", &width); } if (iread != 1 || (!variable && (width > repeat)) ) width = (long) repeat; } else if (form[0] == 'L') { datacode = TLOGICAL; width = 1; } else if (form[0] == 'X') { datacode = TBIT; width = 1; } else if (form[0] == 'B') { datacode = TBYTE; width = 1; } else if (form[0] == 'S') /* internal code to signify signed byte */ { datacode = TSBYTE; width = 1; } else if (form[0] == 'C') { datacode = TCOMPLEX; width = 8; } else if (form[0] == 'M') { datacode = TDBLCOMPLEX; width = 16; } else { sprintf(message, "Illegal binary table TFORMn datatype: \'%s\' ", tform); ffpmsg(message); return(*status = BAD_TFORM_DTYPE); } if (variable) datacode = datacode * (-1); /* flag variable cols w/ neg type code */ if (dtcode) *dtcode = datacode; if (trepeat) *trepeat = repeat; if (twidth) *twidth = width; return(*status); } /*--------------------------------------------------------------------------*/ void ffcfmt(char *tform, /* value of an ASCII table TFORMn keyword */ char *cform) /* equivalent format code in C language syntax */ /* convert the FITS format string for an ASCII Table extension column into the equivalent C format string that can be used in a printf statement, after the values have been read as a double. */ { int ii; cform[0] = '\0'; ii = 0; while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */ ii++; if (tform[ii] == 0) return; /* input format string was blank */ cform[0] = '%'; /* start the format string */ strcpy(&cform[1], &tform[ii + 1]); /* append the width and decimal code */ if (tform[ii] == 'A') strcat(cform, "s"); else if (tform[ii] == 'I') strcat(cform, ".0f"); /* 0 precision to suppress decimal point */ if (tform[ii] == 'F') strcat(cform, "f"); if (tform[ii] == 'E') strcat(cform, "E"); if (tform[ii] == 'D') strcat(cform, "E"); return; } /*--------------------------------------------------------------------------*/ void ffcdsp(char *tform, /* value of an ASCII table TFORMn keyword */ char *cform) /* equivalent format code in C language syntax */ /* convert the FITS TDISPn display format into the equivalent C format suitable for use in a printf statement. */ { int ii; cform[0] = '\0'; ii = 0; while (tform[ii] != 0 && tform[ii] == ' ') /* find first non-blank char */ ii++; if (tform[ii] == 0) { cform[0] = '\0'; return; /* input format string was blank */ } if (strchr(tform+ii, '%')) /* is there a % character in the string?? */ { cform[0] = '\0'; return; /* illegal TFORM string (possibly even harmful) */ } cform[0] = '%'; /* start the format string */ strcpy(&cform[1], &tform[ii + 1]); /* append the width and decimal code */ if (tform[ii] == 'A' || tform[ii] == 'a') strcat(cform, "s"); else if (tform[ii] == 'I' || tform[ii] == 'i') strcat(cform, "d"); else if (tform[ii] == 'O' || tform[ii] == 'o') strcat(cform, "o"); else if (tform[ii] == 'Z' || tform[ii] == 'z') strcat(cform, "X"); else if (tform[ii] == 'F' || tform[ii] == 'f') strcat(cform, "f"); else if (tform[ii] == 'E' || tform[ii] == 'e') strcat(cform, "E"); else if (tform[ii] == 'D' || tform[ii] == 'd') strcat(cform, "E"); else if (tform[ii] == 'G' || tform[ii] == 'g') strcat(cform, "G"); else cform[0] = '\0'; /* unrecognized tform code */ return; } /*--------------------------------------------------------------------------*/ int ffgcno( fitsfile *fptr, /* I - FITS file pionter */ int casesen, /* I - case sensitive string comparison? 0=no */ char *templt, /* I - input name of column (w/wildcards) */ int *colnum, /* O - number of the named column; 1=first col */ int *status) /* IO - error status */ /* Determine the column number corresponding to an input column name. The first column of the table = column 1; This supports the * and ? wild cards in the input template. */ { char colname[FLEN_VALUE]; /* temporary string to hold column name */ ffgcnn(fptr, casesen, templt, colname, colnum, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcnn( fitsfile *fptr, /* I - FITS file pointer */ int casesen, /* I - case sensitive string comparison? 0=no */ char *templt, /* I - input name of column (w/wildcards) */ char *colname, /* O - full column name up to 68 + 1 chars long*/ int *colnum, /* O - number of the named column; 1=first col */ int *status) /* IO - error status */ /* Return the full column name and column number of the next column whose TTYPEn keyword value matches the input template string. The template may contain the * and ? wildcards. Status = 237 is returned if the match is not unique. If so, one may call this routine again with input status=237 to get the next match. A status value of 219 is returned when there are no more matching columns. */ { char errmsg[FLEN_ERRMSG]; int tstatus, ii, founde, foundw, match, exact, unique; long ivalue; tcolumn *colptr; if (*status <= 0) { (fptr->Fptr)->startcol = 0; /* start search with first column */ tstatus = 0; } else if (*status == COL_NOT_UNIQUE) /* start search from previous spot */ { tstatus = COL_NOT_UNIQUE; *status = 0; } else return(*status); /* bad input status value */ colname[0] = 0; /* initialize null return */ *colnum = 0; /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header to get col struct */ return(*status); colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += ((fptr->Fptr)->startcol); /* offset to starting column */ founde = FALSE; /* initialize 'found exact match' flag */ foundw = FALSE; /* initialize 'found wildcard match' flag */ unique = FALSE; for (ii = (fptr->Fptr)->startcol; ii < (fptr->Fptr)->tfield; ii++, colptr++) { ffcmps(templt, colptr->ttype, casesen, &match, &exact); if (match) { if (founde && exact) { /* warning: this is the second exact match we've found */ /*reset pointer to first match so next search starts there */ (fptr->Fptr)->startcol = *colnum; return(*status = COL_NOT_UNIQUE); } else if (founde) /* a wildcard match */ { /* already found exact match so ignore this non-exact match */ } else if (exact) { /* this is the first exact match we have found, so save it. */ strcpy(colname, colptr->ttype); *colnum = ii + 1; founde = TRUE; } else if (foundw) { /* we have already found a wild card match, so not unique */ /* continue searching for other matches */ unique = FALSE; } else { /* this is the first wild card match we've found. save it */ strcpy(colname, colptr->ttype); *colnum = ii + 1; (fptr->Fptr)->startcol = *colnum; foundw = TRUE; unique = TRUE; } } } /* OK, we've checked all the names now see if we got any matches */ if (founde) { if (tstatus == COL_NOT_UNIQUE) /* we did find 1 exact match but */ *status = COL_NOT_UNIQUE; /* there was a previous match too */ } else if (foundw) { /* found one or more wildcard matches; report error if not unique */ if (!unique || tstatus == COL_NOT_UNIQUE) *status = COL_NOT_UNIQUE; } else { /* didn't find a match; check if template is a positive integer */ ffc2ii(templt, &ivalue, &tstatus); if (tstatus == 0 && ivalue <= (fptr->Fptr)->tfield && ivalue > 0) { *colnum = ivalue; colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += (ivalue - 1); /* offset to correct column */ strcpy(colname, colptr->ttype); } else { *status = COL_NOT_FOUND; if (tstatus != COL_NOT_UNIQUE) { sprintf(errmsg, "ffgcnn could not find column: %.45s", templt); ffpmsg(errmsg); } } } (fptr->Fptr)->startcol = *colnum; /* save pointer for next time */ return(*status); } /*--------------------------------------------------------------------------*/ void ffcmps(char *templt, /* I - input template (may have wildcards) */ char *colname, /* I - full column name up to 68 + 1 chars long */ int casesen, /* I - case sensitive string comparison? 1=yes */ int *match, /* O - do template and colname match? 1=yes */ int *exact) /* O - do strings exactly match, or wildcards */ /* compare the template to the string and test if they match. The strings are limited to 68 characters or less (the max. length of a FITS string keyword value. This routine reports whether the two strings match and whether the match is exact or involves wildcards. This algorithm is very similar to the way unix filename wildcards work except that this first treats a wild card as a literal character when looking for a match. If there is no literal match, then it interpretes it as a wild card. So the template 'AB*DE' is considered to be an exact rather than a wild card match to the string 'AB*DE'. The '#' wild card in the template string will match any consecutive string of decimal digits in the colname. */ { int ii, found, t1, s1, wildsearch = 0, tsave = 0, ssave = 0; char temp[FLEN_VALUE], col[FLEN_VALUE]; *match = FALSE; *exact = TRUE; strncpy(temp, templt, FLEN_VALUE); /* copy strings to work area */ strncpy(col, colname, FLEN_VALUE); temp[FLEN_VALUE - 1] = '\0'; /* make sure strings are terminated */ col[FLEN_VALUE - 1] = '\0'; /* truncate trailing non-significant blanks */ for (ii = strlen(temp) - 1; ii >= 0 && temp[ii] == ' '; ii--) temp[ii] = '\0'; for (ii = strlen(col) - 1; ii >= 0 && col[ii] == ' '; ii--) col[ii] = '\0'; if (!casesen) { /* convert both strings to uppercase before comparison */ ffupch(temp); ffupch(col); } if (!FSTRCMP(temp, col) ) { *match = TRUE; /* strings exactly match */ return; } *exact = FALSE; /* strings don't exactly match */ t1 = 0; /* start comparison with 1st char of each string */ s1 = 0; while(1) /* compare corresponding chars in each string */ { if (temp[t1] == '\0' && col[s1] == '\0') { /* completely scanned both strings so they match */ *match = TRUE; return; } else if (temp[t1] == '\0') { if (wildsearch) { /* the previous wildcard search may have been going down a blind alley. Backtrack, and resume the wildcard search with the next character in the string. */ t1 = tsave; s1 = ssave + 1; } else { /* reached end of template string so they don't match */ return; } } else if (col[s1] == '\0') { /* reached end of other string; they match if the next */ /* character in the template string is a '*' wild card */ if (temp[t1] == '*' && temp[t1 + 1] == '\0') { *match = TRUE; } return; } if (temp[t1] == col[s1] || (temp[t1] == '?') ) { s1++; /* corresponding chars in the 2 strings match */ t1++; /* increment both pointers and loop back again */ } else if (temp[t1] == '#' && isdigit((int) col[s1]) ) { s1++; /* corresponding chars in the 2 strings match */ t1++; /* increment both pointers */ /* find the end of the string of digits */ while (isdigit((int) col[s1]) ) s1++; } else if (temp[t1] == '*') { /* save current string locations, in case we need to restart */ wildsearch = 1; tsave = t1; ssave = s1; /* get next char from template and look for it in the col name */ t1++; if (temp[t1] == '\0' || temp[t1] == ' ') { /* reached end of template so strings match */ *match = TRUE; return; } found = FALSE; while (col[s1] && !found) { if (temp[t1] == col[s1]) { t1++; /* found matching characters; incre both pointers */ s1++; /* and loop back to compare next chars */ found = TRUE; } else s1++; /* increment the column name pointer and try again */ } if (!found) { return; /* hit end of column name and failed to find a match */ } } else { if (wildsearch) { /* the previous wildcard search may have been going down a blind alley. Backtrack, and resume the wildcard search with the next character in the string. */ t1 = tsave; s1 = ssave + 1; } else { return; /* strings don't match */ } } } } /*--------------------------------------------------------------------------*/ int ffgtcl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int *typecode, /* O - datatype code (21 = short, etc) */ long *repeat, /* O - repeat count of field */ long *width, /* O - if ASCII, width of field or unit string */ int *status) /* IO - error status */ /* Get Type of table column. Returns the datatype code of the column, as well as the vector repeat count and (if it is an ASCII character column) the width of the field or a unit string within the field. This supports the TFORMn = 'rAw' syntax for specifying arrays of substrings, so if TFORMn = '60A12' then repeat = 60 and width = 12. */ { LONGLONG trepeat, twidth; ffgtclll(fptr, colnum, typecode, &trepeat, &twidth, status); if (*status > 0) return(*status); if (repeat) *repeat= (long) trepeat; if (width) *width = (long) twidth; return(*status); } /*--------------------------------------------------------------------------*/ int ffgtclll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int *typecode, /* O - datatype code (21 = short, etc) */ LONGLONG *repeat, /* O - repeat count of field */ LONGLONG *width, /* O - if ASCII, width of field or unit string */ int *status) /* IO - error status */ /* Get Type of table column. Returns the datatype code of the column, as well as the vector repeat count and (if it is an ASCII character column) the width of the field or a unit string within the field. This supports the TFORMn = 'rAw' syntax for specifying arrays of substrings, so if TFORMn = '60A12' then repeat = 60 and width = 12. */ { tcolumn *colptr; int hdutype, decims; long tmpwidth; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += (colnum - 1); /* offset to correct column */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == ASCII_TBL) { ffasfm(colptr->tform, typecode, &tmpwidth, &decims, status); *width = tmpwidth; if (repeat) *repeat = 1; } else { if (typecode) *typecode = colptr->tdatatype; if (width) *width = colptr->twidth; if (repeat) *repeat = colptr->trepeat; } return(*status); } /*--------------------------------------------------------------------------*/ int ffeqty( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int *typecode, /* O - datatype code (21 = short, etc) */ long *repeat, /* O - repeat count of field */ long *width, /* O - if ASCII, width of field or unit string */ int *status) /* IO - error status */ /* Get the 'equivalent' table column type. This routine is similar to the ffgtcl routine (which returns the physical datatype of the column, as stored in the FITS file) except that if the TSCALn and TZEROn keywords are defined for the column, then it returns the 'equivalent' datatype. Thus, if the column is defined as '1I' (short integer) this routine may return the type as 'TUSHORT' or as 'TFLOAT' depending on the TSCALn and TZEROn values. Returns the datatype code of the column, as well as the vector repeat count and (if it is an ASCII character column) the width of the field or a unit string within the field. This supports the TFORMn = 'rAw' syntax for specifying arrays of substrings, so if TFORMn = '60A12' then repeat = 60 and width = 12. */ { LONGLONG trepeat, twidth; ffeqtyll(fptr, colnum, typecode, &trepeat, &twidth, status); if (repeat) *repeat= (long) trepeat; if (width) *width = (long) twidth; return(*status); } /*--------------------------------------------------------------------------*/ int ffeqtyll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ int *typecode, /* O - datatype code (21 = short, etc) */ LONGLONG *repeat, /* O - repeat count of field */ LONGLONG *width, /* O - if ASCII, width of field or unit string */ int *status) /* IO - error status */ /* Get the 'equivalent' table column type. This routine is similar to the ffgtcl routine (which returns the physical datatype of the column, as stored in the FITS file) except that if the TSCALn and TZEROn keywords are defined for the column, then it returns the 'equivalent' datatype. Thus, if the column is defined as '1I' (short integer) this routine may return the type as 'TUSHORT' or as 'TFLOAT' depending on the TSCALn and TZEROn values. Returns the datatype code of the column, as well as the vector repeat count and (if it is an ASCII character column) the width of the field or a unit string within the field. This supports the TFORMn = 'rAw' syntax for specifying arrays of substrings, so if TFORMn = '60A12' then repeat = 60 and width = 12. */ { tcolumn *colptr; int hdutype, decims, tcode, effcode; double tscale, tzero, min_val, max_val; long lngscale, lngzero = 0, tmpwidth; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += (colnum - 1); /* offset to correct column */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == ASCII_TBL) { ffasfm(colptr->tform, typecode, &tmpwidth, &decims, status); *width = tmpwidth; if (repeat) *repeat = 1; } else { if (typecode) *typecode = colptr->tdatatype; if (width) *width = colptr->twidth; if (repeat) *repeat = colptr->trepeat; } /* return if caller is not interested in the typecode value */ if (!typecode) return(*status); /* check if the tscale and tzero keywords are defined, which might change the effective datatype of the column */ tscale = colptr->tscale; tzero = colptr->tzero; if (tscale == 1.0 && tzero == 0.0) /* no scaling */ return(*status); tcode = abs(*typecode); switch (tcode) { case TBYTE: /* binary table 'rB' column */ min_val = 0.; max_val = 255.0; break; case TSHORT: min_val = -32768.0; max_val = 32767.0; break; case TLONG: min_val = -2147483648.0; max_val = 2147483647.0; break; default: /* don't have to deal with other data types */ return(*status); } if (tscale >= 0.) { min_val = tzero + tscale * min_val; max_val = tzero + tscale * max_val; } else { max_val = tzero + tscale * min_val; min_val = tzero + tscale * max_val; } if (tzero < 2147483648.) /* don't exceed range of 32-bit integer */ lngzero = (long) tzero; lngscale = (long) tscale; if ((tzero != 2147483648.) && /* special value that exceeds integer range */ (lngzero != tzero || lngscale != tscale)) { /* not integers? */ /* floating point scaled values; just decide on required precision */ if (tcode == TBYTE || tcode == TSHORT) effcode = TFLOAT; else effcode = TDOUBLE; /* In all the remaining cases, TSCALn and TZEROn are integers, and not equal to 1 and 0, respectively. */ } else if ((min_val == -128.) && (max_val == 127.)) { effcode = TSBYTE; } else if ((min_val >= -32768.0) && (max_val <= 32767.0)) { effcode = TSHORT; } else if ((min_val >= 0.0) && (max_val <= 65535.0)) { effcode = TUSHORT; } else if ((min_val >= -2147483648.0) && (max_val <= 2147483647.0)) { effcode = TLONG; } else if ((min_val >= 0.0) && (max_val < 4294967296.0)) { effcode = TULONG; } else { /* exceeds the range of a 32-bit integer */ effcode = TDOUBLE; } /* return the effective datatype code (negative if variable length col.) */ if (*typecode < 0) /* variable length array column */ *typecode = -effcode; else *typecode = effcode; return(*status); } /*--------------------------------------------------------------------------*/ int ffgncl( fitsfile *fptr, /* I - FITS file pointer */ int *ncols, /* O - number of columns in the table */ int *status) /* IO - error status */ /* Get the number of columns in the table (= TFIELDS keyword) */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) return(*status = NOT_TABLE); *ncols = (fptr->Fptr)->tfield; return(*status); } /*--------------------------------------------------------------------------*/ int ffgnrw( fitsfile *fptr, /* I - FITS file pointer */ long *nrows, /* O - number of rows in the table */ int *status) /* IO - error status */ /* Get the number of rows in the table (= NAXIS2 keyword) */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) return(*status = NOT_TABLE); /* the NAXIS2 keyword may not be up to date, so use the structure value */ *nrows = (long) (fptr->Fptr)->numrows; return(*status); } /*--------------------------------------------------------------------------*/ int ffgnrwll( fitsfile *fptr, /* I - FITS file pointer */ LONGLONG *nrows, /* O - number of rows in the table */ int *status) /* IO - error status */ /* Get the number of rows in the table (= NAXIS2 keyword) */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) return(*status = NOT_TABLE); /* the NAXIS2 keyword may not be up to date, so use the structure value */ *nrows = (fptr->Fptr)->numrows; return(*status); } /*--------------------------------------------------------------------------*/ int ffgacl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ char *ttype, /* O - TTYPEn keyword value */ long *tbcol, /* O - TBCOLn keyword value */ char *tunit, /* O - TUNITn keyword value */ char *tform, /* O - TFORMn keyword value */ double *tscal, /* O - TSCALn keyword value */ double *tzero, /* O - TZEROn keyword value */ char *tnull, /* O - TNULLn keyword value */ char *tdisp, /* O - TDISPn keyword value */ int *status) /* IO - error status */ /* get ASCII column keyword values */ { char name[FLEN_KEYWORD], comm[FLEN_COMMENT]; tcolumn *colptr; int tstatus; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); /* get what we can from the column structure */ colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += (colnum -1); /* offset to correct column */ if (ttype) strcpy(ttype, colptr->ttype); if (tbcol) *tbcol = (long) ((colptr->tbcol) + 1); /* first col is 1, not 0 */ if (tform) strcpy(tform, colptr->tform); if (tscal) *tscal = colptr->tscale; if (tzero) *tzero = colptr->tzero; if (tnull) strcpy(tnull, colptr->strnull); /* read keywords to get additional parameters */ if (tunit) { ffkeyn("TUNIT", colnum, name, status); tstatus = 0; *tunit = '\0'; ffgkys(fptr, name, tunit, comm, &tstatus); } if (tdisp) { ffkeyn("TDISP", colnum, name, status); tstatus = 0; *tdisp = '\0'; ffgkys(fptr, name, tdisp, comm, &tstatus); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgbcl( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ char *ttype, /* O - TTYPEn keyword value */ char *tunit, /* O - TUNITn keyword value */ char *dtype, /* O - datatype char: I, J, E, D, etc. */ long *repeat, /* O - vector column repeat count */ double *tscal, /* O - TSCALn keyword value */ double *tzero, /* O - TZEROn keyword value */ long *tnull, /* O - TNULLn keyword value integer cols only */ char *tdisp, /* O - TDISPn keyword value */ int *status) /* IO - error status */ /* get BINTABLE column keyword values */ { LONGLONG trepeat, ttnull; if (*status > 0) return(*status); ffgbclll(fptr, colnum, ttype, tunit, dtype, &trepeat, tscal, tzero, &ttnull, tdisp, status); if (repeat) *repeat = (long) trepeat; if (tnull) *tnull = (long) ttnull; return(*status); } /*--------------------------------------------------------------------------*/ int ffgbclll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number */ char *ttype, /* O - TTYPEn keyword value */ char *tunit, /* O - TUNITn keyword value */ char *dtype, /* O - datatype char: I, J, E, D, etc. */ LONGLONG *repeat, /* O - vector column repeat count */ double *tscal, /* O - TSCALn keyword value */ double *tzero, /* O - TZEROn keyword value */ LONGLONG *tnull, /* O - TNULLn keyword value integer cols only */ char *tdisp, /* O - TDISPn keyword value */ int *status) /* IO - error status */ /* get BINTABLE column keyword values */ { char name[FLEN_KEYWORD], comm[FLEN_COMMENT]; tcolumn *colptr; int tstatus; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if (colnum < 1 || colnum > (fptr->Fptr)->tfield) return(*status = BAD_COL_NUM); /* get what we can from the column structure */ colptr = (fptr->Fptr)->tableptr; /* pointer to first column */ colptr += (colnum -1); /* offset to correct column */ if (ttype) strcpy(ttype, colptr->ttype); if (dtype) { if (colptr->tdatatype < 0) /* add the "P" prefix for */ strcpy(dtype, "P"); /* variable length columns */ else dtype[0] = 0; if (abs(colptr->tdatatype) == TBIT) strcat(dtype, "X"); else if (abs(colptr->tdatatype) == TBYTE) strcat(dtype, "B"); else if (abs(colptr->tdatatype) == TLOGICAL) strcat(dtype, "L"); else if (abs(colptr->tdatatype) == TSTRING) strcat(dtype, "A"); else if (abs(colptr->tdatatype) == TSHORT) strcat(dtype, "I"); else if (abs(colptr->tdatatype) == TLONG) strcat(dtype, "J"); else if (abs(colptr->tdatatype) == TLONGLONG) strcat(dtype, "K"); else if (abs(colptr->tdatatype) == TFLOAT) strcat(dtype, "E"); else if (abs(colptr->tdatatype) == TDOUBLE) strcat(dtype, "D"); else if (abs(colptr->tdatatype) == TCOMPLEX) strcat(dtype, "C"); else if (abs(colptr->tdatatype) == TDBLCOMPLEX) strcat(dtype, "M"); } if (repeat) *repeat = colptr->trepeat; if (tscal) *tscal = colptr->tscale; if (tzero) *tzero = colptr->tzero; if (tnull) *tnull = colptr->tnull; /* read keywords to get additional parameters */ if (tunit) { ffkeyn("TUNIT", colnum, name, status); tstatus = 0; *tunit = '\0'; ffgkys(fptr, name, tunit, comm, &tstatus); } if (tdisp) { ffkeyn("TDISP", colnum, name, status); tstatus = 0; *tdisp = '\0'; ffgkys(fptr, name, tdisp, comm, &tstatus); } return(*status); } /*--------------------------------------------------------------------------*/ int ffghdn(fitsfile *fptr, /* I - FITS file pointer */ int *chdunum) /* O - number of the CHDU; 1 = primary array */ /* Return the number of the Current HDU in the FITS file. The primary array is HDU number 1. Note that this is one of the few cfitsio routines that does not return the error status value as the value of the function. */ { *chdunum = (fptr->HDUposition) + 1; return(*chdunum); } /*--------------------------------------------------------------------------*/ int ffghadll(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG *headstart, /* O - byte offset to beginning of CHDU */ LONGLONG *datastart, /* O - byte offset to beginning of next HDU */ LONGLONG *dataend, /* O - byte offset to beginning of next HDU */ int *status) /* IO - error status */ /* Return the address (= byte offset) in the FITS file to the beginning of the current HDU, the beginning of the data unit, and the end of the data unit. */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { if (ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status) > 0) return(*status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if (ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } if (headstart) *headstart = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]; if (datastart) *datastart = (fptr->Fptr)->datastart; if (dataend) *dataend = (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1]; return(*status); } /*--------------------------------------------------------------------------*/ int ffghof(fitsfile *fptr, /* I - FITS file pointer */ OFF_T *headstart, /* O - byte offset to beginning of CHDU */ OFF_T *datastart, /* O - byte offset to beginning of next HDU */ OFF_T *dataend, /* O - byte offset to beginning of next HDU */ int *status) /* IO - error status */ /* Return the address (= byte offset) in the FITS file to the beginning of the current HDU, the beginning of the data unit, and the end of the data unit. */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { if (ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status) > 0) return(*status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if (ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } if (headstart) *headstart = (OFF_T) (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu]; if (datastart) *datastart = (OFF_T) (fptr->Fptr)->datastart; if (dataend) *dataend = (OFF_T) (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1]; return(*status); } /*--------------------------------------------------------------------------*/ int ffghad(fitsfile *fptr, /* I - FITS file pointer */ long *headstart, /* O - byte offset to beginning of CHDU */ long *datastart, /* O - byte offset to beginning of next HDU */ long *dataend, /* O - byte offset to beginning of next HDU */ int *status) /* IO - error status */ /* Return the address (= byte offset) in the FITS file to the beginning of the current HDU, the beginning of the data unit, and the end of the data unit. */ { LONGLONG shead, sdata, edata; if (*status > 0) return(*status); ffghadll(fptr, &shead, &sdata, &edata, status); if (headstart) { if (shead > LONG_MAX) *status = NUM_OVERFLOW; else *headstart = (long) shead; } if (datastart) { if (sdata > LONG_MAX) *status = NUM_OVERFLOW; else *datastart = (long) sdata; } if (dataend) { if (edata > LONG_MAX) *status = NUM_OVERFLOW; else *dataend = (long) edata; } return(*status); } /*--------------------------------------------------------------------------*/ int ffrhdu(fitsfile *fptr, /* I - FITS file pointer */ int *hdutype, /* O - type of HDU */ int *status) /* IO - error status */ /* read the required keywords of the CHDU and initialize the corresponding structure elements that describe the format of the HDU */ { int ii, tstatus; char card[FLEN_CARD]; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char xname[FLEN_VALUE], *xtension, urltype[20]; if (*status > 0) return(*status); if (ffgrec(fptr, 1, card, status) > 0 ) /* get the 80-byte card */ { ffpmsg("Cannot read first keyword in header (ffrhdu)."); return(*status); } strncpy(name,card,8); /* first 8 characters = the keyword name */ name[8] = '\0'; for (ii=7; ii >= 0; ii--) /* replace trailing blanks with nulls */ { if (name[ii] == ' ') name[ii] = '\0'; else break; } if (ffpsvc(card, value, comm, status) > 0) /* parse value and comment */ { ffpmsg("Cannot read value of first keyword in header (ffrhdu):"); ffpmsg(card); return(*status); } if (!strcmp(name, "SIMPLE")) /* this is the primary array */ { ffpinit(fptr, status); /* initialize the primary array */ if (hdutype != NULL) *hdutype = 0; } else if (!strcmp(name, "XTENSION")) /* this is an XTENSION keyword */ { if (ffc2s(value, xname, status) > 0) /* get the value string */ { ffpmsg("Bad value string for XTENSION keyword:"); ffpmsg(value); return(*status); } xtension = xname; while (*xtension == ' ') /* ignore any leading spaces in name */ xtension++; if (!strcmp(xtension, "TABLE")) { ffainit(fptr, status); /* initialize the ASCII table */ if (hdutype != NULL) *hdutype = 1; } else if (!strcmp(xtension, "BINTABLE") || !strcmp(xtension, "A3DTABLE") || !strcmp(xtension, "3DTABLE") ) { ffbinit(fptr, status); /* initialize the binary table */ if (hdutype != NULL) *hdutype = 2; } else { tstatus = 0; ffpinit(fptr, &tstatus); /* probably an IMAGE extension */ if (tstatus == UNKNOWN_EXT && hdutype != NULL) *hdutype = -1; /* don't recognize this extension type */ else { *status = tstatus; if (hdutype != NULL) *hdutype = 0; } } } else /* not the start of a new extension */ { if (card[0] == 0 || card[0] == 10) /* some editors append this character to EOF */ { *status = END_OF_FILE; } else { *status = UNKNOWN_REC; /* found unknown type of record */ ffpmsg ("Extension doesn't start with SIMPLE or XTENSION keyword. (ffrhdu)"); ffpmsg(card); } } /* compare the starting position of the next HDU (if any) with the size */ /* of the whole file to see if this is the last HDU in the file */ if ((fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] < (fptr->Fptr)->logfilesize ) { (fptr->Fptr)->lasthdu = 0; /* no, not the last HDU */ } else { (fptr->Fptr)->lasthdu = 1; /* yes, this is the last HDU */ /* special code for mem:// type files (FITS file in memory) */ /* Allocate enough memory to hold the entire HDU. */ /* Without this code, CFITSIO would repeatedly realloc memory */ /* to incrementally increase the size of the file by 2880 bytes */ /* at a time, until it reached the final size */ ffurlt(fptr, urltype, status); if (!strcmp(urltype,"mem://") || !strcmp(urltype,"memkeep://")) { fftrun(fptr, (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1], status); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffpinit(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* initialize the parameters defining the structure of the primary array or an Image extension */ { int groups, tstatus, simple, bitpix, naxis, extend, nspace; int ttype = 0, bytlen = 0, ii, ntilebins; long pcount, gcount; LONGLONG naxes[999], npix, blank; double bscale, bzero; char comm[FLEN_COMMENT]; tcolumn *colptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->hdutype = IMAGE_HDU; /* primary array or IMAGE extension */ (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize; /* set max size */ groups = 0; tstatus = *status; /* get all the descriptive info about this HDU */ ffgphd(fptr, 999, &simple, &bitpix, &naxis, naxes, &pcount, &gcount, &extend, &bscale, &bzero, &blank, &nspace, status); if (*status == NOT_IMAGE) *status = tstatus; /* ignore 'unknown extension type' error */ else if (*status > 0) return(*status); /* the logical end of the header is 80 bytes before the current position, minus any trailing blank keywords just before the END keyword. */ (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1)); /* the data unit begins at the beginning of the next logical block */ (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1) * 2880; if (naxis > 0 && naxes[0] == 0) /* test for 'random groups' */ { tstatus = 0; ffmaky(fptr, 2, status); /* reset to beginning of header */ if (ffgkyl(fptr, "GROUPS", &groups, comm, &tstatus)) groups = 0; /* GROUPS keyword not found */ } if (bitpix == BYTE_IMG) /* test bitpix and set the datatype code */ { ttype=TBYTE; bytlen=1; } else if (bitpix == SHORT_IMG) { ttype=TSHORT; bytlen=2; } else if (bitpix == LONG_IMG) { ttype=TLONG; bytlen=4; } else if (bitpix == LONGLONG_IMG) { ttype=TLONGLONG; bytlen=8; } else if (bitpix == FLOAT_IMG) { ttype=TFLOAT; bytlen=4; } else if (bitpix == DOUBLE_IMG) { ttype=TDOUBLE; bytlen=8; } /* calculate the size of the primary array */ (fptr->Fptr)->imgdim = naxis; if (naxis == 0) { npix = 0; } else { if (groups) { npix = 1; /* NAXIS1 = 0 is a special flag for 'random groups' */ } else { npix = naxes[0]; } (fptr->Fptr)->imgnaxis[0] = naxes[0]; for (ii=1; ii < naxis; ii++) { npix = npix*naxes[ii]; /* calc number of pixels in the array */ (fptr->Fptr)->imgnaxis[ii] = naxes[ii]; } } /* now we know everything about the array; just fill in the parameters: the next HDU begins in the next logical block after the data */ (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] = (fptr->Fptr)->datastart + ( ((LONGLONG) pcount + npix) * bytlen * gcount + 2879) / 2880 * 2880; /* initialize the fictitious heap starting address (immediately following the array data) and a zero length heap. This is used to find the end of the data when checking the fill values in the last block. */ (fptr->Fptr)->heapstart = (npix + pcount) * bytlen * gcount; (fptr->Fptr)->heapsize = 0; (fptr->Fptr)->compressimg = 0; /* this is not a compressed image */ if (naxis == 0) { (fptr->Fptr)->rowlength = 0; /* rows have zero length */ (fptr->Fptr)->tfield = 0; /* table has no fields */ /* free the tile-compressed image cache, if it exists */ if ((fptr->Fptr)->tilerow) { ntilebins = (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1; for (ii = 0; ii < ntilebins; ii++) { if ((fptr->Fptr)->tiledata[ii]) { free((fptr->Fptr)->tiledata[ii]); } if ((fptr->Fptr)->tilenullarray[ii]) { free((fptr->Fptr)->tilenullarray[ii]); } } free((fptr->Fptr)->tileanynull); free((fptr->Fptr)->tiletype); free((fptr->Fptr)->tiledatasize); free((fptr->Fptr)->tilenullarray); free((fptr->Fptr)->tiledata); free((fptr->Fptr)->tilerow); (fptr->Fptr)->tileanynull = 0; (fptr->Fptr)->tiletype = 0; (fptr->Fptr)->tiledatasize = 0; (fptr->Fptr)->tilenullarray = 0; (fptr->Fptr)->tiledata = 0; (fptr->Fptr)->tilerow = 0; } if ((fptr->Fptr)->tableptr) free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */ (fptr->Fptr)->tableptr = 0; /* set a null table structure pointer */ (fptr->Fptr)->numrows = 0; (fptr->Fptr)->origrows = 0; } else { /* The primary array is actually interpreted as a binary table. There are two columns: the first column contains the group parameters if any. The second column contains the primary array of data as a single vector column element. In the case of 'random grouped' format, each group is stored in a separate row of the table. */ /* the number of rows is equal to the number of groups */ (fptr->Fptr)->numrows = gcount; (fptr->Fptr)->origrows = gcount; (fptr->Fptr)->rowlength = (npix + pcount) * bytlen; /* total size */ (fptr->Fptr)->tfield = 2; /* 2 fields: group params and the image */ /* free the tile-compressed image cache, if it exists */ if ((fptr->Fptr)->tilerow) { ntilebins = (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1; for (ii = 0; ii < ntilebins; ii++) { if ((fptr->Fptr)->tiledata[ii]) { free((fptr->Fptr)->tiledata[ii]); } if ((fptr->Fptr)->tilenullarray[ii]) { free((fptr->Fptr)->tilenullarray[ii]); } } free((fptr->Fptr)->tileanynull); free((fptr->Fptr)->tiletype); free((fptr->Fptr)->tiledatasize); free((fptr->Fptr)->tilenullarray); free((fptr->Fptr)->tiledata); free((fptr->Fptr)->tilerow); (fptr->Fptr)->tileanynull = 0; (fptr->Fptr)->tiletype = 0; (fptr->Fptr)->tiledatasize = 0; (fptr->Fptr)->tilenullarray = 0; (fptr->Fptr)->tiledata = 0; (fptr->Fptr)->tilerow = 0; } if ((fptr->Fptr)->tableptr) free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */ colptr = (tcolumn *) calloc(2, sizeof(tcolumn) ) ; if (!colptr) { ffpmsg ("malloc failed to get memory for FITS array descriptors (ffpinit)"); (fptr->Fptr)->tableptr = 0; /* set a null table structure pointer */ return(*status = ARRAY_TOO_BIG); } /* copy the table structure address to the fitsfile structure */ (fptr->Fptr)->tableptr = colptr; /* the first column represents the group parameters, if any */ colptr->tbcol = 0; colptr->tdatatype = ttype; colptr->twidth = bytlen; colptr->trepeat = (LONGLONG) pcount; colptr->tscale = 1.; colptr->tzero = 0.; colptr->tnull = blank; colptr++; /* increment pointer to the second column */ /* the second column represents the image array */ colptr->tbcol = pcount * bytlen; /* col starts after the group parms */ colptr->tdatatype = ttype; colptr->twidth = bytlen; colptr->trepeat = npix; colptr->tscale = bscale; colptr->tzero = bzero; colptr->tnull = blank; } /* reset next keyword pointer to the start of the header */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ]; return(*status); } /*--------------------------------------------------------------------------*/ int ffainit(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ { /* initialize the parameters defining the structure of an ASCII table */ int ii, nspace, ntilebins; long tfield; LONGLONG pcount, rowlen, nrows, tbcoln; tcolumn *colptr = 0; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char message[FLEN_ERRMSG], errmsg[81]; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->hdutype = ASCII_TBL; /* set that this is an ASCII table */ (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize; /* set max size */ /* get table parameters and test that the header is a valid: */ if (ffgttb(fptr, &rowlen, &nrows, &pcount, &tfield, status) > 0) return(*status); if (pcount != 0) { ffpmsg("PCOUNT keyword not equal to 0 in ASCII table (ffainit)."); sprintf(errmsg, " PCOUNT = %ld", (long) pcount); ffpmsg(errmsg); return(*status = BAD_PCOUNT); } (fptr->Fptr)->rowlength = rowlen; /* store length of a row */ (fptr->Fptr)->tfield = tfield; /* store number of table fields in row */ /* free the tile-compressed image cache, if it exists */ if ((fptr->Fptr)->tilerow) { ntilebins = (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1; for (ii = 0; ii < ntilebins; ii++) { if ((fptr->Fptr)->tiledata[ii]) { free((fptr->Fptr)->tiledata[ii]); } if ((fptr->Fptr)->tilenullarray[ii]) { free((fptr->Fptr)->tilenullarray[ii]); } } free((fptr->Fptr)->tileanynull); free((fptr->Fptr)->tiletype); free((fptr->Fptr)->tiledatasize); free((fptr->Fptr)->tilenullarray); free((fptr->Fptr)->tiledata); free((fptr->Fptr)->tilerow); (fptr->Fptr)->tileanynull = 0; (fptr->Fptr)->tiletype = 0; (fptr->Fptr)->tiledatasize = 0; (fptr->Fptr)->tilenullarray = 0; (fptr->Fptr)->tiledata = 0; (fptr->Fptr)->tilerow = 0; } if ((fptr->Fptr)->tableptr) free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */ /* mem for column structures ; space is initialized = 0 */ if (tfield > 0) { colptr = (tcolumn *) calloc(tfield, sizeof(tcolumn) ); if (!colptr) { ffpmsg ("malloc failed to get memory for FITS table descriptors (ffainit)"); (fptr->Fptr)->tableptr = 0; /* set a null table structure pointer */ return(*status = ARRAY_TOO_BIG); } } /* copy the table structure address to the fitsfile structure */ (fptr->Fptr)->tableptr = colptr; /* initialize the table field parameters */ for (ii = 0; ii < tfield; ii++, colptr++) { colptr->ttype[0] = '\0'; /* null column name */ colptr->tscale = 1.; colptr->tzero = 0.; colptr->strnull[0] = ASCII_NULL_UNDEFINED; /* null value undefined */ colptr->tbcol = -1; /* initialize to illegal value */ colptr->tdatatype = -9999; /* initialize to illegal value */ } /* Initialize the fictitious heap starting address (immediately following the table data) and a zero length heap. This is used to find the end of the table data when checking the fill values in the last block. There is no special data following an ASCII table. */ (fptr->Fptr)->numrows = nrows; (fptr->Fptr)->origrows = nrows; (fptr->Fptr)->heapstart = rowlen * nrows; (fptr->Fptr)->heapsize = 0; (fptr->Fptr)->compressimg = 0; /* this is not a compressed image */ /* now search for the table column keywords and the END keyword */ for (nspace = 0, ii = 8; 1; ii++) /* infinite loop */ { ffgkyn(fptr, ii, name, value, comm, status); /* try to ignore minor syntax errors */ if (*status == NO_QUOTE) { strcat(value, "'"); *status = 0; } else if (*status == BAD_KEYCHAR) { *status = 0; } if (*status == END_OF_FILE) { ffpmsg("END keyword not found in ASCII table header (ffainit)."); return(*status = NO_END); } else if (*status > 0) return(*status); else if (name[0] == 'T') /* keyword starts with 'T' ? */ ffgtbp(fptr, name, value, status); /* test if column keyword */ else if (!FSTRCMP(name, "END")) /* is this the END keyword? */ break; if (!name[0] && !value[0] && !comm[0]) /* a blank keyword? */ nspace++; else nspace = 0; } /* test that all required keywords were found and have legal values */ colptr = (fptr->Fptr)->tableptr; for (ii = 0; ii < tfield; ii++, colptr++) { tbcoln = colptr->tbcol; /* the starting column number (zero based) */ if (colptr->tdatatype == -9999) { ffkeyn("TFORM", ii+1, name, status); /* construct keyword name */ sprintf(message,"Required %s keyword not found (ffainit).", name); ffpmsg(message); return(*status = NO_TFORM); } else if (tbcoln == -1) { ffkeyn("TBCOL", ii+1, name, status); /* construct keyword name */ sprintf(message,"Required %s keyword not found (ffainit).", name); ffpmsg(message); return(*status = NO_TBCOL); } else if ((fptr->Fptr)->rowlength != 0 && (tbcoln < 0 || tbcoln >= (fptr->Fptr)->rowlength ) ) { ffkeyn("TBCOL", ii+1, name, status); /* construct keyword name */ sprintf(message,"Value of %s keyword out of range: %ld (ffainit).", name, (long) tbcoln); ffpmsg(message); return(*status = BAD_TBCOL); } else if ((fptr->Fptr)->rowlength != 0 && tbcoln + colptr->twidth > (fptr->Fptr)->rowlength ) { sprintf(message,"Column %d is too wide to fit in table (ffainit)", ii+1); ffpmsg(message); sprintf(message, " TFORM = %s and NAXIS1 = %ld", colptr->tform, (long) (fptr->Fptr)->rowlength); ffpmsg(message); return(*status = COL_TOO_WIDE); } } /* now we know everything about the table; just fill in the parameters: the 'END' record is 80 bytes before the current position, minus any trailing blank keywords just before the END keyword. */ (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1)); /* the data unit begins at the beginning of the next logical block */ (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1) * 2880; /* the next HDU begins in the next logical block after the data */ (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] = (fptr->Fptr)->datastart + ( ((LONGLONG)rowlen * nrows + 2879) / 2880 * 2880 ); /* reset next keyword pointer to the start of the header */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ]; return(*status); } /*--------------------------------------------------------------------------*/ int ffbinit(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ { /* initialize the parameters defining the structure of a binary table */ int ii, nspace, ntilebins; long tfield; LONGLONG pcount, rowlen, nrows, totalwidth; tcolumn *colptr = 0; char name[FLEN_KEYWORD], value[FLEN_VALUE], comm[FLEN_COMMENT]; char message[FLEN_ERRMSG]; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); (fptr->Fptr)->hdutype = BINARY_TBL; /* set that this is a binary table */ (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize; /* set max size */ /* get table parameters and test that the header is valid: */ if (ffgttb(fptr, &rowlen, &nrows, &pcount, &tfield, status) > 0) return(*status); (fptr->Fptr)->rowlength = rowlen; /* store length of a row */ (fptr->Fptr)->tfield = tfield; /* store number of table fields in row */ /* free the tile-compressed image cache, if it exists */ if ((fptr->Fptr)->tilerow) { ntilebins = (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1; for (ii = 0; ii < ntilebins; ii++) { if ((fptr->Fptr)->tiledata[ii]) { free((fptr->Fptr)->tiledata[ii]); } if ((fptr->Fptr)->tilenullarray[ii]) { free((fptr->Fptr)->tilenullarray[ii]); } } free((fptr->Fptr)->tileanynull); free((fptr->Fptr)->tiletype); free((fptr->Fptr)->tiledatasize); free((fptr->Fptr)->tilenullarray); free((fptr->Fptr)->tiledata); free((fptr->Fptr)->tilerow); (fptr->Fptr)->tileanynull = 0; (fptr->Fptr)->tiletype = 0; (fptr->Fptr)->tiledatasize = 0; (fptr->Fptr)->tilenullarray = 0; (fptr->Fptr)->tiledata = 0; (fptr->Fptr)->tilerow = 0; } if ((fptr->Fptr)->tableptr) free((fptr->Fptr)->tableptr); /* free memory for the old CHDU */ /* mem for column structures ; space is initialized = 0 */ if (tfield > 0) { colptr = (tcolumn *) calloc(tfield, sizeof(tcolumn) ); if (!colptr) { ffpmsg ("malloc failed to get memory for FITS table descriptors (ffbinit)"); (fptr->Fptr)->tableptr = 0; /* set a null table structure pointer */ return(*status = ARRAY_TOO_BIG); } } /* copy the table structure address to the fitsfile structure */ (fptr->Fptr)->tableptr = colptr; /* initialize the table field parameters */ for (ii = 0; ii < tfield; ii++, colptr++) { colptr->ttype[0] = '\0'; /* null column name */ colptr->tscale = 1.; colptr->tzero = 0.; colptr->tnull = NULL_UNDEFINED; /* (integer) null value undefined */ colptr->tdatatype = -9999; /* initialize to illegal value */ colptr->trepeat = 1; colptr->strnull[0] = '\0'; /* for ASCII string columns (TFORM = rA) */ } /* Initialize the heap starting address (immediately following the table data) and the size of the heap. This is used to find the end of the table data when checking the fill values in the last block. */ (fptr->Fptr)->numrows = nrows; (fptr->Fptr)->origrows = nrows; (fptr->Fptr)->heapstart = rowlen * nrows; (fptr->Fptr)->heapsize = pcount; (fptr->Fptr)->compressimg = 0; /* initialize as not a compressed image */ /* now search for the table column keywords and the END keyword */ for (nspace = 0, ii = 8; 1; ii++) /* infinite loop */ { ffgkyn(fptr, ii, name, value, comm, status); /* try to ignore minor syntax errors */ if (*status == NO_QUOTE) { strcat(value, "'"); *status = 0; } else if (*status == BAD_KEYCHAR) { *status = 0; } if (*status == END_OF_FILE) { ffpmsg("END keyword not found in binary table header (ffbinit)."); return(*status = NO_END); } else if (*status > 0) return(*status); else if (name[0] == 'T') /* keyword starts with 'T' ? */ ffgtbp(fptr, name, value, status); /* test if column keyword */ else if (!FSTRCMP(name, "ZIMAGE")) { if (value[0] == 'T') (fptr->Fptr)->compressimg = 1; /* this is a compressed image */ } else if (!FSTRCMP(name, "END")) /* is this the END keyword? */ break; if (!name[0] && !value[0] && !comm[0]) /* a blank keyword? */ nspace++; else nspace = 0; /* reset number of consecutive spaces before END */ } /* test that all the required keywords were found and have legal values */ colptr = (fptr->Fptr)->tableptr; /* set pointer to first column */ for (ii = 0; ii < tfield; ii++, colptr++) { if (colptr->tdatatype == -9999) { ffkeyn("TFORM", ii+1, name, status); /* construct keyword name */ sprintf(message,"Required %s keyword not found (ffbinit).", name); ffpmsg(message); return(*status = NO_TFORM); } } /* now we know everything about the table; just fill in the parameters: the 'END' record is 80 bytes before the current position, minus any trailing blank keywords just before the END keyword. */ (fptr->Fptr)->headend = (fptr->Fptr)->nextkey - (80 * (nspace + 1)); /* the data unit begins at the beginning of the next logical block */ (fptr->Fptr)->datastart = (((fptr->Fptr)->nextkey - 80) / 2880 + 1) * 2880; /* the next HDU begins in the next logical block after the data */ (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] = (fptr->Fptr)->datastart + ( ((fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize + 2879) / 2880 * 2880 ); /* determine the byte offset to the beginning of each column */ ffgtbc(fptr, &totalwidth, status); if (totalwidth != rowlen) { sprintf(message, "NAXIS1 = %ld is not equal to the sum of column widths: %ld", (long) rowlen, (long) totalwidth); ffpmsg(message); *status = BAD_ROW_WIDTH; } /* reset next keyword pointer to the start of the header */ (fptr->Fptr)->nextkey = (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu ]; if ( (fptr->Fptr)->compressimg == 1) /* Is this a compressed image */ imcomp_get_compressed_image_par(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgabc(int tfields, /* I - number of columns in the table */ char **tform, /* I - value of TFORMn keyword for each column */ int space, /* I - number of spaces to leave between cols */ long *rowlen, /* O - total width of a table row */ long *tbcol, /* O - starting byte in row for each column */ int *status) /* IO - error status */ /* calculate the starting byte offset of each column of an ASCII table and the total length of a row, in bytes. The input space value determines how many blank spaces to leave between each column (1 is recommended). */ { int ii, datacode, decims; long width; if (*status > 0) return(*status); *rowlen=0; if (tfields <= 0) return(*status); tbcol[0] = 1; for (ii = 0; ii < tfields; ii++) { tbcol[ii] = *rowlen + 1; /* starting byte in row of column */ ffasfm(tform[ii], &datacode, &width, &decims, status); *rowlen += (width + space); /* total length of row */ } *rowlen -= space; /* don't add space after the last field */ return (*status); } /*--------------------------------------------------------------------------*/ int ffgtbc(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG *totalwidth, /* O - total width of a table row */ int *status) /* IO - error status */ { /* calculate the starting byte offset of each column of a binary table. Use the values of the datatype code and repeat counts in the column structure. Return the total length of a row, in bytes. */ int tfields, ii; LONGLONG nbytes; tcolumn *colptr; char message[FLEN_ERRMSG], *cptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); tfields = (fptr->Fptr)->tfield; colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ *totalwidth = 0; for (ii = 0; ii < tfields; ii++, colptr++) { colptr->tbcol = *totalwidth; /* byte offset in row to this column */ if (colptr->tdatatype == TSTRING) { nbytes = colptr->trepeat; /* one byte per char */ } else if (colptr->tdatatype == TBIT) { nbytes = ( colptr->trepeat + 7) / 8; } else if (colptr->tdatatype > 0) { nbytes = colptr->trepeat * (colptr->tdatatype / 10); } else { cptr = colptr->tform; while (isdigit(*cptr)) cptr++; if (*cptr == 'P') /* this is a 'P' variable length descriptor (neg. tdatatype) */ nbytes = colptr->trepeat * 8; else if (*cptr == 'Q') /* this is a 'Q' variable length descriptor (neg. tdatatype) */ nbytes = colptr->trepeat * 16; else { sprintf(message, "unknown binary table column type: %s", colptr->tform); ffpmsg(message); *status = BAD_TFORM; return(*status); } } *totalwidth = *totalwidth + nbytes; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgtbp(fitsfile *fptr, /* I - FITS file pointer */ char *name, /* I - name of the keyword */ char *value, /* I - value string of the keyword */ int *status) /* IO - error status */ { /* Get TaBle Parameter. The input keyword name begins with the letter T. Test if the keyword is one of the table column definition keywords of an ASCII or binary table. If so, decode it and update the value in the structure. */ int tstatus, datacode, decimals; long width, repeat, nfield, ivalue; LONGLONG jjvalue; double dvalue; char tvalue[FLEN_VALUE], *loc; char message[FLEN_ERRMSG]; tcolumn *colptr; if (*status > 0) return(*status); tstatus = 0; /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); if(!FSTRNCMP(name + 1, "TYPE", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if (ffc2s(value, tvalue, &tstatus) > 0) /* remove quotes */ return(*status); strcpy(colptr->ttype, tvalue); /* copy col name to structure */ } else if(!FSTRNCMP(name + 1, "FORM", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if (ffc2s(value, tvalue, &tstatus) > 0) /* remove quotes */ return(*status); strncpy(colptr->tform, tvalue, 9); /* copy TFORM to structure */ colptr->tform[9] = '\0'; /* make sure it is terminated */ if ((fptr->Fptr)->hdutype == ASCII_TBL) /* ASCII table */ { if (ffasfm(tvalue, &datacode, &width, &decimals, status) > 0) return(*status); /* bad format code */ colptr->tdatatype = TSTRING; /* store datatype code */ colptr->trepeat = 1; /* field repeat count == 1 */ colptr->twidth = width; /* the width of the field, in bytes */ } else /* binary table */ { if (ffbnfm(tvalue, &datacode, &repeat, &width, status) > 0) return(*status); /* bad format code */ colptr->tdatatype = datacode; /* store datatype code */ colptr->trepeat = (LONGLONG) repeat; /* field repeat count */ /* Don't overwrite the unit string width if it was previously */ /* set by a TDIMn keyword and has a legal value */ if (datacode == TSTRING) { if (colptr->twidth == 0 || colptr->twidth > repeat) colptr->twidth = width; /* width of a unit string */ } else { colptr->twidth = width; /* width of a unit value in chars */ } } } else if(!FSTRNCMP(name + 1, "BCOL", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if ((fptr->Fptr)->hdutype == BINARY_TBL) return(*status); /* binary tables don't have TBCOL keywords */ if (ffc2ii(value, &ivalue, status) > 0) { sprintf(message, "Error reading value of %s as an integer: %s", name, value); ffpmsg(message); return(*status); } colptr->tbcol = ivalue - 1; /* convert to zero base */ } else if(!FSTRNCMP(name + 1, "SCAL", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if (ffc2dd(value, &dvalue, &tstatus) > 0) { sprintf(message, "Error reading value of %s as a double: %s", name, value); ffpmsg(message); /* ignore this error, so don't return error status */ return(*status); } colptr->tscale = dvalue; } else if(!FSTRNCMP(name + 1, "ZERO", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if (ffc2dd(value, &dvalue, &tstatus) > 0) { sprintf(message, "Error reading value of %s as a double: %s", name, value); ffpmsg(message); /* ignore this error, so don't return error status */ return(*status); } colptr->tzero = dvalue; } else if(!FSTRNCMP(name + 1, "NULL", 4) ) { /* get the index number */ if( ffc2ii(name + 5, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ if ((fptr->Fptr)->hdutype == ASCII_TBL) /* ASCII table */ { if (ffc2s(value, tvalue, &tstatus) > 0) /* remove quotes */ return(*status); strncpy(colptr->strnull, tvalue, 17); /* copy TNULL string */ colptr->strnull[17] = '\0'; /* terminate the strnull field */ } else /* binary table */ { if (ffc2jj(value, &jjvalue, &tstatus) > 0) { sprintf(message, "Error reading value of %s as an integer: %s", name, value); ffpmsg(message); /* ignore this error, so don't return error status */ return(*status); } colptr->tnull = jjvalue; /* null value for integer column */ } } else if(!FSTRNCMP(name + 1, "DIM", 3) ) { if ((fptr->Fptr)->hdutype == ASCII_TBL) /* ASCII table */ return(*status); /* ASCII tables don't support TDIMn keyword */ /* get the index number */ if( ffc2ii(name + 4, &nfield, &tstatus) > 0) /* read index no. */ return(*status); /* must not be an indexed keyword */ if (nfield < 1 || nfield > (fptr->Fptr)->tfield ) /* out of range */ return(*status); colptr = (fptr->Fptr)->tableptr; /* get pointer to columns */ colptr = colptr + nfield - 1; /* point to the correct column */ /* uninitialized columns have tdatatype set = -9999 */ if (colptr->tdatatype != -9999 && colptr->tdatatype != TSTRING) return(*status); /* this is not an ASCII string column */ loc = strchr(value, '(' ); /* find the opening parenthesis */ if (!loc) return(*status); /* not a proper TDIM keyword */ loc++; width = strtol(loc, &loc, 10); /* read size of first dimension */ if (colptr->trepeat != 1 && colptr->trepeat < width) return(*status); /* string length is greater than column width */ colptr->twidth = width; /* set width of a unit string in chars */ } else if (!FSTRNCMP(name + 1, "HEAP", 4) ) { if ((fptr->Fptr)->hdutype == ASCII_TBL) /* ASCII table */ return(*status); /* ASCII tables don't have a heap */ if (ffc2jj(value, &jjvalue, &tstatus) > 0) { sprintf(message, "Error reading value of %s as an integer: %s", name, value); ffpmsg(message); /* ignore this error, so don't return error status */ return(*status); } (fptr->Fptr)->heapstart = jjvalue; /* starting byte of the heap */ return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffgcprll( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG firstrow, /* I - first row (1 = 1st row of table) */ LONGLONG firstelem, /* I - first element within vector (1 = 1st) */ LONGLONG nelem, /* I - number of elements to read or write */ int writemode, /* I - = 1 if writing data, = 0 if reading data */ /* If = 2, then writing data, but don't modify */ /* the returned values of repeat and incre. */ /* If = -1, then reading data in reverse */ /* direction. */ double *scale, /* O - FITS scaling factor (TSCALn keyword value) */ double *zero, /* O - FITS scaling zero pt (TZEROn keyword value) */ char *tform, /* O - ASCII column format: value of TFORMn keyword */ long *twidth, /* O - width of ASCII column (characters) */ int *tcode, /* O - column datatype code: I*4=41, R*4=42, etc */ int *maxelem, /* O - max number of elements that fit in buffer */ LONGLONG *startpos,/* O - offset in file to starting row & column */ LONGLONG *elemnum, /* O - starting element number ( 0 = 1st element) */ long *incre, /* O - byte offset between elements within a row */ LONGLONG *repeat, /* O - number of elements in a row (vector column) */ LONGLONG *rowlen, /* O - length of a row, in bytes */ int *hdutype, /* O - HDU type: 0, 1, 2 = primary, table, bintable */ LONGLONG *tnull, /* O - null value for integer columns */ char *snull, /* O - null value for ASCII table columns */ int *status) /* IO - error status */ /* Get Column PaRameters, and test starting row and element numbers for validity. This is a workhorse routine that is call by nearly every other routine that reads or writes to FITS files. */ { int nulpos, rangecheck = 1, tstatus = 0; LONGLONG datastart, endpos; long nblock; LONGLONG heapoffset, lrepeat, endrow, nrows, tbcol; char message[81]; tcolumn *colptr; if (fptr->HDUposition != (fptr->Fptr)->curhdu) { /* reset position to the correct HDU if necessary */ ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { /* rescan header if data structure is undefined */ if ( ffrdef(fptr, status) > 0) return(*status); } else if (writemode > 0) { /* Only terminate the header with the END card if */ /* writing to the stdout stream (don't have random access). */ /* Initialize STREAM_DRIVER to be the device number for */ /* writing FITS files directly out to the stdout stream. */ /* This only needs to be done once and is thread safe. */ if (STREAM_DRIVER <= 0 || STREAM_DRIVER > 40) { urltype2driver("stream://", &STREAM_DRIVER); } if (((fptr->Fptr)->driver == STREAM_DRIVER)) { if ((fptr->Fptr)->ENDpos != maxvalue((fptr->Fptr)->headend , (fptr->Fptr)->datastart -2880)) { ffwend(fptr, status); } } } /* Do sanity check of input parameters */ if (firstrow < 1) { if ((fptr->Fptr)->hdutype == IMAGE_HDU) /* Primary Array or IMAGE */ { sprintf(message, "Image group number is less than 1: %.0f", (double) firstrow); ffpmsg(message); return(*status = BAD_ROW_NUM); } else { sprintf(message, "Starting row number is less than 1: %.0f", (double) firstrow); ffpmsg(message); return(*status = BAD_ROW_NUM); } } else if ((fptr->Fptr)->hdutype != ASCII_TBL && firstelem < 1) { sprintf(message, "Starting element number less than 1: %ld", (long) firstelem); ffpmsg(message); return(*status = BAD_ELEM_NUM); } else if (nelem < 0) { sprintf(message, "Tried to read or write less than 0 elements: %.0f", (double) nelem); ffpmsg(message); return(*status = NEG_BYTES); } else if (colnum < 1 || colnum > (fptr->Fptr)->tfield) { sprintf(message, "Specified column number is out of range: %d", colnum); ffpmsg(message); sprintf(message, " There are %d columns in this table.", (fptr->Fptr)->tfield ); ffpmsg(message); return(*status = BAD_COL_NUM); } /* copy relevant parameters from the structure */ *hdutype = (fptr->Fptr)->hdutype; /* image, ASCII table, or BINTABLE */ *rowlen = (fptr->Fptr)->rowlength; /* width of the table, in bytes */ datastart = (fptr->Fptr)->datastart; /* offset in file to start of table */ colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ *scale = colptr->tscale; /* value scaling factor; default = 1.0 */ *zero = colptr->tzero; /* value scaling zeropoint; default = 0.0 */ *tnull = colptr->tnull; /* null value for integer columns */ tbcol = colptr->tbcol; /* offset to start of column within row */ *twidth = colptr->twidth; /* width of a single datum, in bytes */ *incre = colptr->twidth; /* increment between datums, in bytes */ *tcode = colptr->tdatatype; *repeat = colptr->trepeat; strcpy(tform, colptr->tform); /* value of TFORMn keyword */ strcpy(snull, colptr->strnull); /* null value for ASCII table columns */ if (*hdutype == ASCII_TBL && snull[0] == '\0') { /* In ASCII tables, a null value is equivalent to all spaces */ strcpy(snull, " "); /* maximum of 17 spaces */ nulpos = minvalue(17, *twidth); /* truncate to width of column */ snull[nulpos] = '\0'; } /* Special case: interpret writemode = -1 as reading data, but */ /* don't do error check for exceeding the range of pixels */ if (writemode == -1) { writemode = 0; rangecheck = 0; } /* Special case: interprete 'X' column as 'B' */ if (abs(*tcode) == TBIT) { *tcode = *tcode / TBIT * TBYTE; *repeat = (*repeat + 7) / 8; } /* Special case: support the 'rAw' format in BINTABLEs */ if (*hdutype == BINARY_TBL && *tcode == TSTRING) { *repeat = *repeat / *twidth; /* repeat = # of unit strings in field */ } else if (*hdutype == BINARY_TBL && *tcode == -TSTRING) { /* variable length string */ *incre = 1; *twidth = (long) nelem; } if (*hdutype == ASCII_TBL) *elemnum = 0; /* ASCII tables don't have vector elements */ else *elemnum = firstelem - 1; /* interprete complex and double complex as pairs of floats or doubles */ if (abs(*tcode) >= TCOMPLEX) { if (*tcode > 0) *tcode = (*tcode + 1) / 2; else *tcode = (*tcode - 1) / 2; *repeat = *repeat * 2; *twidth = *twidth / 2; *incre = *incre / 2; } /* calculate no. of pixels that fit in buffer */ /* allow for case where floats are 8 bytes long */ if (abs(*tcode) == TFLOAT) *maxelem = DBUFFSIZE / sizeof(float); else if (abs(*tcode) == TDOUBLE) *maxelem = DBUFFSIZE / sizeof(double); else if (abs(*tcode) == TSTRING) { *maxelem = (DBUFFSIZE - 1)/ *twidth; /* leave room for final \0 */ if (*maxelem == 0) { sprintf(message, "ASCII string column is too wide: %ld; max supported width is %d", *twidth, DBUFFSIZE - 1); ffpmsg(message); return(*status = COL_TOO_WIDE); } } else *maxelem = DBUFFSIZE / *twidth; /* calc starting byte position to 1st element of col */ /* (this does not apply to variable length columns) */ *startpos = datastart + ((LONGLONG)(firstrow - 1) * *rowlen) + tbcol; if (*hdutype == IMAGE_HDU && writemode) /* Primary Array or IMAGE */ { /* For primary arrays, set the repeat count greater than the total number of pixels to be written. This prevents an out-of-range error message in cases where the final image array size is not yet known or defined. */ if (*repeat < *elemnum + nelem) *repeat = *elemnum + nelem; } else if (*tcode > 0) /* Fixed length table column */ { if (*elemnum >= *repeat) { sprintf(message, "First element to write is too large: %ld; max allowed value is %ld", (long) ((*elemnum) + 1), (long) *repeat); ffpmsg(message); return(*status = BAD_ELEM_NUM); } /* last row number to be read or written */ endrow = ((*elemnum + nelem - 1) / *repeat) + firstrow; if (writemode) { /* check if we are writing beyond the current end of table */ if ((endrow > (fptr->Fptr)->numrows) && (nelem > 0) ) { /* if there are more HDUs following the current one, or */ /* if there is a data heap, then we must insert space */ /* for the new rows. */ if ( !((fptr->Fptr)->lasthdu) || (fptr->Fptr)->heapsize > 0) { nrows = endrow - ((fptr->Fptr)->numrows); if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0) { sprintf(message, "Failed to add space for %.0f new rows in table.", (double) nrows); ffpmsg(message); return(*status); } } else { /* update heap starting address */ (fptr->Fptr)->heapstart += ((LONGLONG)(endrow - (fptr->Fptr)->numrows) * (fptr->Fptr)->rowlength ); (fptr->Fptr)->numrows = endrow; /* update number of rows */ } } } else /* reading from the file */ { if ( endrow > (fptr->Fptr)->numrows && rangecheck) { if (*hdutype == IMAGE_HDU) /* Primary Array or IMAGE */ { if (firstrow > (fptr->Fptr)->numrows) { sprintf(message, "Attempted to read from group %ld of the HDU,", (long) firstrow); ffpmsg(message); sprintf(message, "however the HDU only contains %ld group(s).", (long) ((fptr->Fptr)->numrows) ); ffpmsg(message); } else { ffpmsg("Attempt to read past end of array:"); sprintf(message, " Image has %ld elements;", (long) *repeat); ffpmsg(message); sprintf(message, " Tried to read %ld elements starting at element %ld.", (long) nelem, (long) firstelem); ffpmsg(message); } } else { ffpmsg("Attempt to read past end of table:"); sprintf(message, " Table has %.0f rows with %.0f elements per row;", (double) ((fptr->Fptr)->numrows), (double) *repeat); ffpmsg(message); sprintf(message, " Tried to read %.0f elements starting at row %.0f, element %.0f.", (double) nelem, (double) firstrow, (double) ((*elemnum) + 1)); ffpmsg(message); } return(*status = BAD_ROW_NUM); } } if (*repeat == 1 && nelem > 1 && writemode != 2) { /* When accessing a scalar column, fool the calling routine into thinking that this is a vector column with very big elements. This allows multiple values (up to the maxelem number of elements that will fit in the buffer) to be read or written with a single routine call, which increases the efficiency. If writemode == 2, then the calling program does not want to have this efficiency trick applied. */ *incre = (long) *rowlen; *repeat = nelem; } } else /* Variable length Binary Table column */ { *tcode *= (-1); if (writemode) /* return next empty heap address for writing */ { *repeat = nelem + *elemnum; /* total no. of elements in the field */ /* first, check if we are overwriting an existing row, and */ /* if so, if the existing space is big enough for the new vector */ if ( firstrow <= (fptr->Fptr)->numrows ) { ffgdesll(fptr, colnum, firstrow, &lrepeat, &heapoffset, &tstatus); if (!tstatus) { if (colptr->tdatatype <= -TCOMPLEX) lrepeat = lrepeat * 2; /* no. of float or double values */ else if (colptr->tdatatype == -TBIT) lrepeat = (lrepeat + 7) / 8; /* convert from bits to bytes */ if (lrepeat >= *repeat) /* enough existing space? */ { *startpos = datastart + heapoffset + (fptr->Fptr)->heapstart; /* write the descriptor into the fixed length part of table */ if (colptr->tdatatype <= -TCOMPLEX) { /* divide repeat count by 2 to get no. of complex values */ ffpdes(fptr, colnum, firstrow, *repeat / 2, heapoffset, status); } else { ffpdes(fptr, colnum, firstrow, *repeat, heapoffset, status); } return(*status); } } } /* Add more rows to the table, if writing beyond the end. */ /* It is necessary to shift the heap down in this case */ if ( firstrow > (fptr->Fptr)->numrows) { nrows = firstrow - ((fptr->Fptr)->numrows); if (ffirow(fptr, (fptr->Fptr)->numrows, nrows, status) > 0) { sprintf(message, "Failed to add space for %.0f new rows in table.", (double) nrows); ffpmsg(message); return(*status); } } /* calculate starting position (for writing new data) in the heap */ *startpos = datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; /* write the descriptor into the fixed length part of table */ if (colptr->tdatatype <= -TCOMPLEX) { /* divide repeat count by 2 to get no. of complex values */ ffpdes(fptr, colnum, firstrow, *repeat / 2, (fptr->Fptr)->heapsize, status); } else { ffpdes(fptr, colnum, firstrow, *repeat, (fptr->Fptr)->heapsize, status); } /* If this is not the last HDU in the file, then check if */ /* extending the heap would overwrite the following header. */ /* If so, then have to insert more blocks. */ if ( !((fptr->Fptr)->lasthdu) ) { endpos = datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize + ( *repeat * (*incre)); if (endpos > (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1]) { /* calc the number of blocks that need to be added */ nblock = (long) (((endpos - 1 - (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] ) / 2880) + 1); if (ffiblk(fptr, nblock, 1, status) > 0) /* insert blocks */ { sprintf(message, "Failed to extend the size of the variable length heap by %ld blocks.", nblock); ffpmsg(message); return(*status); } } } /* increment the address to the next empty heap position */ (fptr->Fptr)->heapsize += ( *repeat * (*incre)); } else /* get the read start position in the heap */ { if ( firstrow > (fptr->Fptr)->numrows) { ffpmsg("Attempt to read past end of table"); sprintf(message, " Table has %.0f rows and tried to read row %.0f.", (double) ((fptr->Fptr)->numrows), (double) firstrow); ffpmsg(message); return(*status = BAD_ROW_NUM); } ffgdesll(fptr, colnum, firstrow, &lrepeat, &heapoffset, status); *repeat = lrepeat; if (colptr->tdatatype <= -TCOMPLEX) *repeat = *repeat * 2; /* no. of float or double values */ else if (colptr->tdatatype == -TBIT) *repeat = (*repeat + 7) / 8; /* convert from bits to bytes */ if (*elemnum >= *repeat) { sprintf(message, "Starting element to read in variable length column is too large: %ld", (long) firstelem); ffpmsg(message); sprintf(message, " This row only contains %ld elements", (long) *repeat); ffpmsg(message); return(*status = BAD_ELEM_NUM); } *startpos = datastart + heapoffset + (fptr->Fptr)->heapstart; } } return(*status); } /*---------------------------------------------------------------------------*/ int fftheap(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG *heapsz, /* O - current size of the heap */ LONGLONG *unused, /* O - no. of unused bytes in the heap */ LONGLONG *overlap, /* O - no. of bytes shared by > 1 descriptors */ int *valid, /* O - are all the heap addresses valid? */ int *status) /* IO - error status */ /* Tests the contents of the binary table variable length array heap. Returns the number of bytes that are currently not pointed to by any of the descriptors, and also the number of bytes that are pointed to by more than one descriptor. It returns valid = FALSE if any of the descriptors point to addresses that are out of the bounds of the heap. */ { int jj, typecode, pixsize; long ii, kk, theapsz, nbytes; LONGLONG repeat, offset, tunused = 0, toverlap = 0; char *buffer, message[81]; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if ( fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header to make sure everything is up to date */ else if ( ffrdef(fptr, status) > 0) return(*status); if (valid) *valid = TRUE; if (heapsz) *heapsz = (fptr->Fptr)->heapsize; if (unused) *unused = 0; if (overlap) *overlap = 0; /* return if this is not a binary table HDU or if the heap is empty */ if ( (fptr->Fptr)->hdutype != BINARY_TBL || (fptr->Fptr)->heapsize == 0 ) return(*status); if ((fptr->Fptr)->heapsize > LONG_MAX) { ffpmsg("Heap is too big to test ( > 2**31 bytes). (fftheap)"); return(*status = MEMORY_ALLOCATION); } theapsz = (long) (fptr->Fptr)->heapsize; buffer = calloc(1, theapsz); /* allocate temp space */ if (!buffer ) { sprintf(message,"Failed to allocate buffer to test the heap"); ffpmsg(message); return(*status = MEMORY_ALLOCATION); } /* loop over all cols */ for (jj = 1; jj <= (fptr->Fptr)->tfield && *status <= 0; jj++) { ffgtcl(fptr, jj, &typecode, NULL, NULL, status); if (typecode > 0) continue; /* ignore fixed length columns */ pixsize = -typecode / 10; for (ii = 1; ii <= (fptr->Fptr)->numrows; ii++) { ffgdesll(fptr, jj, ii, &repeat, &offset, status); if (typecode == -TBIT) nbytes = (long) (repeat + 7) / 8; else nbytes = (long) repeat * pixsize; if (offset < 0 || offset + nbytes > theapsz) { if (valid) *valid = FALSE; /* address out of bounds */ sprintf(message, "Descriptor in row %ld, column %d has invalid heap address", ii, jj); ffpmsg(message); } else { for (kk = 0; kk < nbytes; kk++) buffer[kk + offset]++; /* increment every used byte */ } } } for (kk = 0; kk < theapsz; kk++) { if (buffer[kk] == 0) tunused++; else if (buffer[kk] > 1) toverlap++; } if (heapsz) *heapsz = theapsz; if (unused) *unused = tunused; if (overlap) *overlap = toverlap; free(buffer); return(*status); } /*--------------------------------------------------------------------------*/ int ffcmph(fitsfile *fptr, /* I -FITS file pointer */ int *status) /* IO - error status */ /* compress the binary table heap by reordering the contents heap and recovering any unused space */ { fitsfile *tptr; int jj, typecode, pixsize, valid; long ii, buffsize = 10000, nblock, nbytes; LONGLONG unused, overlap; LONGLONG repeat, offset; char *buffer, *tbuff, comm[FLEN_COMMENT]; char message[81]; LONGLONG pcount; LONGLONG readheapstart, writeheapstart, endpos, t1heapsize, t2heapsize; if (*status > 0) return(*status); /* get information about the current heap */ fftheap(fptr, NULL, &unused, &overlap, &valid, status); if (!valid) return(*status = BAD_HEAP_PTR); /* bad heap pointers */ /* return if this is not a binary table HDU or if the heap is OK as is */ if ( (fptr->Fptr)->hdutype != BINARY_TBL || (fptr->Fptr)->heapsize == 0 || (unused == 0 && overlap == 0) || *status > 0 ) return(*status); /* copy the current HDU to a temporary file in memory */ if (ffinit( &tptr, "mem://tempheapfile", status) ) { sprintf(message,"Failed to create temporary file for the heap"); ffpmsg(message); return(*status); } if ( ffcopy(fptr, tptr, 0, status) ) { sprintf(message,"Failed to create copy of the heap"); ffpmsg(message); ffclos(tptr, status); return(*status); } buffer = (char *) malloc(buffsize); /* allocate initial buffer */ if (!buffer) { sprintf(message,"Failed to allocate buffer to copy the heap"); ffpmsg(message); ffclos(tptr, status); return(*status = MEMORY_ALLOCATION); } readheapstart = (tptr->Fptr)->datastart + (tptr->Fptr)->heapstart; writeheapstart = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart; t1heapsize = (fptr->Fptr)->heapsize; /* save original heap size */ (fptr->Fptr)->heapsize = 0; /* reset heap to zero */ /* loop over all cols */ for (jj = 1; jj <= (fptr->Fptr)->tfield && *status <= 0; jj++) { ffgtcl(tptr, jj, &typecode, NULL, NULL, status); if (typecode > 0) continue; /* ignore fixed length columns */ pixsize = -typecode / 10; /* copy heap data, row by row */ for (ii = 1; ii <= (fptr->Fptr)->numrows; ii++) { ffgdesll(tptr, jj, ii, &repeat, &offset, status); if (typecode == -TBIT) nbytes = (long) (repeat + 7) / 8; else nbytes = (long) repeat * pixsize; /* increase size of buffer if necessary to read whole array */ if (nbytes > buffsize) { tbuff = realloc(buffer, nbytes); if (tbuff) { buffer = tbuff; buffsize = nbytes; } else *status = MEMORY_ALLOCATION; } /* If this is not the last HDU in the file, then check if */ /* extending the heap would overwrite the following header. */ /* If so, then have to insert more blocks. */ if ( !((fptr->Fptr)->lasthdu) ) { endpos = writeheapstart + (fptr->Fptr)->heapsize + nbytes; if (endpos > (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1]) { /* calc the number of blocks that need to be added */ nblock = (long) (((endpos - 1 - (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] ) / 2880) + 1); if (ffiblk(fptr, nblock, 1, status) > 0) /* insert blocks */ { sprintf(message, "Failed to extend the size of the variable length heap by %ld blocks.", nblock); ffpmsg(message); } } } /* read arrray of bytes from temporary copy */ ffmbyt(tptr, readheapstart + offset, REPORT_EOF, status); ffgbyt(tptr, nbytes, buffer, status); /* write arrray of bytes back to original file */ ffmbyt(fptr, writeheapstart + (fptr->Fptr)->heapsize, IGNORE_EOF, status); ffpbyt(fptr, nbytes, buffer, status); /* write descriptor */ ffpdes(fptr, jj, ii, repeat, (fptr->Fptr)->heapsize, status); (fptr->Fptr)->heapsize += nbytes; /* update heapsize */ if (*status > 0) { free(buffer); ffclos(tptr, status); return(*status); } } } free(buffer); ffclos(tptr, status); /* delete any empty blocks at the end of the HDU */ nblock = (long) (( (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] - (writeheapstart + (fptr->Fptr)->heapsize) ) / 2880); if (nblock > 0) { t2heapsize = (fptr->Fptr)->heapsize; /* save new heap size */ (fptr->Fptr)->heapsize = t1heapsize; /* restore original heap size */ ffdblk(fptr, nblock, status); (fptr->Fptr)->heapsize = t2heapsize; /* reset correct heap size */ } /* update the PCOUNT value (size of heap) */ ffmaky(fptr, 2, status); /* reset to beginning of header */ ffgkyjj(fptr, "PCOUNT", &pcount, comm, status); if ((fptr->Fptr)->heapsize != pcount) { ffmkyj(fptr, "PCOUNT", (fptr->Fptr)->heapsize, comm, status); } ffrdef(fptr, status); /* rescan new HDU structure */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgdes(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG rownum, /* I - row number (1 = 1st row of table) */ long *length, /* O - number of elements in the row */ long *heapaddr, /* O - heap pointer to the data */ int *status) /* IO - error status */ /* get (read) the variable length vector descriptor from the table. */ { LONGLONG lengthjj, heapaddrjj; if (ffgdesll(fptr, colnum, rownum, &lengthjj, &heapaddrjj, status) > 0) return(*status); /* convert the temporary 8-byte values to 4-byte values */ /* check for overflow */ if (length) { if (lengthjj > LONG_MAX) *status = NUM_OVERFLOW; else *length = (long) lengthjj; } if (heapaddr) { if (heapaddrjj > LONG_MAX) *status = NUM_OVERFLOW; else *heapaddr = (long) heapaddrjj; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgdesll(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG rownum, /* I - row number (1 = 1st row of table) */ LONGLONG *length, /* O - number of elements in the row */ LONGLONG *heapaddr, /* O - heap pointer to the data */ int *status) /* IO - error status */ /* get (read) the variable length vector descriptor from the binary table. This is similar to ffgdes, except it supports the full 8-byte range of the length and offset values in 'Q' columns, as well as 'P' columns. */ { LONGLONG bytepos; unsigned int descript4[2] = {0,0}; LONGLONG descript8[2] = {0,0}; tcolumn *colptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* offset to the correct column */ if (colptr->tdatatype >= 0) { *status = NOT_VARI_LEN; return(*status); } bytepos = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * (rownum - 1)) + colptr->tbcol; if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P') { /* read 4-byte descriptor */ if (ffgi4b(fptr, bytepos, 2, 4, (INT32BIT *) descript4, status) <= 0) { if (length) *length = (LONGLONG) descript4[0]; /* 1st word is the length */ if (heapaddr) *heapaddr = (LONGLONG) descript4[1]; /* 2nd word is the address */ } } else /* this is for 'Q' columns */ { /* read 8 byte descriptor */ if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0) { if (length) *length = descript8[0]; /* 1st word is the length */ if (heapaddr) *heapaddr = descript8[1]; /* 2nd word is the address */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgdess(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG firstrow, /* I - first row (1 = 1st row of table) */ LONGLONG nrows, /* I - number or rows to read */ long *length, /* O - number of elements in the row */ long *heapaddr, /* O - heap pointer to the data */ int *status) /* IO - error status */ /* get (read) a range of variable length vector descriptors from the table. */ { LONGLONG rowsize, bytepos; long ii; INT32BIT descript4[2] = {0,0}; LONGLONG descript8[2] = {0,0}; tcolumn *colptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* offset to the correct column */ if (colptr->tdatatype >= 0) { *status = NOT_VARI_LEN; return(*status); } rowsize = (fptr->Fptr)->rowlength; bytepos = (fptr->Fptr)->datastart + (rowsize * (firstrow - 1)) + colptr->tbcol; if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P') { /* read 4-byte descriptors */ for (ii = 0; ii < nrows; ii++) { /* read descriptors */ if (ffgi4b(fptr, bytepos, 2, 4, descript4, status) <= 0) { if (length) { *length = (long) descript4[0]; /* 1st word is the length */ length++; } if (heapaddr) { *heapaddr = (long) descript4[1]; /* 2nd word is the address */ heapaddr++; } bytepos += rowsize; } else return(*status); } } else /* this is for 'Q' columns */ { /* read 8-byte descriptors */ for (ii = 0; ii < nrows; ii++) { /* read descriptors */ if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0) { if (length) { if (descript8[0] > LONG_MAX)*status = NUM_OVERFLOW; *length = (long) descript8[0]; /* 1st word is the length */ length++; } if (heapaddr) { if (descript8[1] > LONG_MAX)*status = NUM_OVERFLOW; *heapaddr = (long) descript8[1]; /* 2nd word is the address */ heapaddr++; } bytepos += rowsize; } else return(*status); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgdessll(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG firstrow, /* I - first row (1 = 1st row of table) */ LONGLONG nrows, /* I - number or rows to read */ LONGLONG *length, /* O - number of elements in the row */ LONGLONG *heapaddr, /* O - heap pointer to the data */ int *status) /* IO - error status */ /* get (read) a range of variable length vector descriptors from the table. */ { LONGLONG rowsize, bytepos; long ii; unsigned int descript4[2] = {0,0}; LONGLONG descript8[2] = {0,0}; tcolumn *colptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* offset to the correct column */ if (colptr->tdatatype >= 0) { *status = NOT_VARI_LEN; return(*status); } rowsize = (fptr->Fptr)->rowlength; bytepos = (fptr->Fptr)->datastart + (rowsize * (firstrow - 1)) + colptr->tbcol; if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P') { /* read 4-byte descriptors */ for (ii = 0; ii < nrows; ii++) { /* read descriptors */ if (ffgi4b(fptr, bytepos, 2, 4, (INT32BIT *) descript4, status) <= 0) { if (length) { *length = (LONGLONG) descript4[0]; /* 1st word is the length */ length++; } if (heapaddr) { *heapaddr = (LONGLONG) descript4[1]; /* 2nd word is the address */ heapaddr++; } bytepos += rowsize; } else return(*status); } } else /* this is for 'Q' columns */ { /* read 8-byte descriptors */ for (ii = 0; ii < nrows; ii++) { /* read descriptors */ /* cast to type (long *) even though it is actually (LONGLONG *) */ if (ffgi8b(fptr, bytepos, 2, 8, (long *) descript8, status) <= 0) { if (length) { *length = descript8[0]; /* 1st word is the length */ length++; } if (heapaddr) { *heapaddr = descript8[1]; /* 2nd word is the address */ heapaddr++; } bytepos += rowsize; } else return(*status); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffpdes(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column number (1 = 1st column of table) */ LONGLONG rownum, /* I - row number (1 = 1st row of table) */ LONGLONG length, /* I - number of elements in the row */ LONGLONG heapaddr, /* I - heap pointer to the data */ int *status) /* IO - error status */ /* put (write) the variable length vector descriptor to the table. */ { LONGLONG bytepos; unsigned int descript4[2]; LONGLONG descript8[2]; tcolumn *colptr; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); colptr = (fptr->Fptr)->tableptr; /* point to first column structure */ colptr += (colnum - 1); /* offset to the correct column */ if (colptr->tdatatype >= 0) *status = NOT_VARI_LEN; bytepos = (fptr->Fptr)->datastart + ((fptr->Fptr)->rowlength * (rownum - 1)) + colptr->tbcol; ffmbyt(fptr, bytepos, IGNORE_EOF, status); /* move to element */ if (colptr->tform[0] == 'P' || colptr->tform[1] == 'P') { if (length > UINT_MAX || length < 0 || heapaddr > UINT_MAX || heapaddr < 0) { ffpmsg("P variable length column descriptor is out of range"); *status = NUM_OVERFLOW; return(*status); } descript4[0] = (unsigned int) length; /* 1st word is the length */ descript4[1] = (unsigned int) heapaddr; /* 2nd word is the address */ ffpi4b(fptr, 2, 4, (INT32BIT *) descript4, status); /* write the descriptor */ } else /* this is a 'Q' descriptor column */ { descript8[0] = length; /* 1st word is the length */ descript8[1] = heapaddr; /* 2nd word is the address */ ffpi8b(fptr, 2, 8, (long *) descript8, status); /* write the descriptor */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffchdu(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ { /* close the current HDU. If we have write access to the file, then: - write the END keyword and pad header with blanks if necessary - check the data fill values, and rewrite them if not correct */ char message[FLEN_ERRMSG]; int ii, stdriver, ntilebins; /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* no need to do any further updating of the HDU */ } else if ((fptr->Fptr)->writemode == 1) { urltype2driver("stream://", &stdriver); /* don't rescan header in special case of writing to stdout */ if (((fptr->Fptr)->driver != stdriver)) ffrdef(fptr, status); if ((fptr->Fptr)->heapsize > 0) { ffuptf(fptr, status); /* update the variable length TFORM values */ } ffpdfl(fptr, status); /* insure correct data fill values */ } if ((fptr->Fptr)->open_count == 1) { /* free memory for the CHDU structure only if no other files are using it */ if ((fptr->Fptr)->tableptr) { free((fptr->Fptr)->tableptr); (fptr->Fptr)->tableptr = NULL; /* free the tile-compressed image cache, if it exists */ if ((fptr->Fptr)->tilerow) { ntilebins = (((fptr->Fptr)->znaxis[0] - 1) / ((fptr->Fptr)->tilesize[0])) + 1; for (ii = 0; ii < ntilebins; ii++) { if ((fptr->Fptr)->tiledata[ii]) { free((fptr->Fptr)->tiledata[ii]); } if ((fptr->Fptr)->tilenullarray[ii]) { free((fptr->Fptr)->tilenullarray[ii]); } } free((fptr->Fptr)->tileanynull); free((fptr->Fptr)->tiletype); free((fptr->Fptr)->tiledatasize); free((fptr->Fptr)->tilenullarray); free((fptr->Fptr)->tiledata); free((fptr->Fptr)->tilerow); (fptr->Fptr)->tileanynull = 0; (fptr->Fptr)->tiletype = 0; (fptr->Fptr)->tiledatasize = 0; (fptr->Fptr)->tilenullarray = 0; (fptr->Fptr)->tiledata = 0; (fptr->Fptr)->tilerow = 0; } } } if (*status > 0 && *status != NO_CLOSE_ERROR) { sprintf(message, "Error while closing HDU number %d (ffchdu).", (fptr->Fptr)->curhdu); ffpmsg(message); } return(*status); } /*--------------------------------------------------------------------------*/ int ffuptf(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Update the value of the TFORM keywords for the variable length array columns to make sure they all have the form 1Px(len) or Px(len) where 'len' is the maximum length of the vector in the table (e.g., '1PE(400)') */ { int ii; long tflds; LONGLONG length, addr, maxlen, naxis2, jj; char comment[FLEN_COMMENT], keyname[FLEN_KEYWORD]; char tform[FLEN_VALUE], newform[FLEN_VALUE], lenval[40]; char card[FLEN_CARD]; char message[FLEN_ERRMSG]; char *tmp; ffmaky(fptr, 2, status); /* reset to beginning of header */ ffgkyjj(fptr, "NAXIS2", &naxis2, comment, status); ffgkyj(fptr, "TFIELDS", &tflds, comment, status); for (ii = 1; ii <= tflds; ii++) /* loop over all the columns */ { ffkeyn("TFORM", ii, keyname, status); /* construct name */ if (ffgkys(fptr, keyname, tform, comment, status) > 0) { sprintf(message, "Error while updating variable length vector TFORMn values (ffuptf)."); ffpmsg(message); return(*status); } /* is this a variable array length column ? */ if (tform[0] == 'P' || tform[1] == 'P' || tform[0] == 'Q' || tform[1] == 'Q') { /* get the max length */ maxlen = 0; for (jj=1; jj <= naxis2; jj++) { ffgdesll(fptr, ii, jj, &length, &addr, status); if (length > maxlen) maxlen = length; } /* construct the new keyword value */ strcpy(newform, "'"); tmp = strchr(tform, '('); /* truncate old length, if present */ if (tmp) *tmp = 0; strcat(newform, tform); /* print as double, because the string-to-64-bit */ /* conversion is platform dependent (%lld, %ld, %I64d) */ sprintf(lenval, "(%.0f)", (double) maxlen); strcat(newform,lenval); while(strlen(newform) < 9) strcat(newform," "); /* append spaces 'till length = 8 */ strcat(newform,"'" ); /* append closing parenthesis */ /* would be simpler to just call ffmkyj here, but this */ /* would force linking in all the modkey & putkey routines */ ffmkky(keyname, newform, comment, card, status); /* make new card */ ffmkey(fptr, card, status); /* replace last read keyword */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffrdef(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* ReDEFine the structure of a data unit. This routine re-reads the CHDU header keywords to determine the structure and length of the current data unit. This redefines the start of the next HDU. */ { int dummy, tstatus = 0; LONGLONG naxis2; LONGLONG pcount; char card[FLEN_CARD], comm[FLEN_COMMENT], valstring[FLEN_VALUE]; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->writemode == 1) /* write access to the file? */ { /* don't need to check NAXIS2 and PCOUNT if data hasn't been written */ if ((fptr->Fptr)->datastart != DATA_UNDEFINED) { /* update NAXIS2 keyword if more rows were written to the table */ /* and if the user has not explicitly reset the NAXIS2 value */ if ((fptr->Fptr)->hdutype != IMAGE_HDU) { ffmaky(fptr, 2, status); if (ffgkyjj(fptr, "NAXIS2", &naxis2, comm, &tstatus) > 0) { /* Couldn't read NAXIS2 (odd!); in certain circumstances */ /* this may be normal, so ignore the error. */ naxis2 = (fptr->Fptr)->numrows; } if ((fptr->Fptr)->numrows > naxis2 && (fptr->Fptr)->origrows == naxis2) /* if origrows is not equal to naxis2, then the user must */ /* have manually modified the NAXIS2 keyword value, and */ /* we will assume that the current value is correct. */ { /* would be simpler to just call ffmkyj here, but this */ /* would force linking in all the modkey & putkey routines */ /* print as double because the 64-bit int conversion */ /* is platform dependent (%lld, %ld, %I64 ) */ sprintf(valstring, "%.0f", (double) ((fptr->Fptr)->numrows)); ffmkky("NAXIS2", valstring, comm, card, status); ffmkey(fptr, card, status); } } /* if data has been written to variable length columns in a */ /* binary table, then we may need to update the PCOUNT value */ if ((fptr->Fptr)->heapsize > 0) { ffmaky(fptr, 2, status); ffgkyjj(fptr, "PCOUNT", &pcount, comm, status); if ((fptr->Fptr)->heapsize != pcount) { ffmkyj(fptr, "PCOUNT", (fptr->Fptr)->heapsize, comm, status); } } } if (ffwend(fptr, status) <= 0) /* rewrite END keyword and fill */ { ffrhdu(fptr, &dummy, status); /* re-scan the header keywords */ } } return(*status); } /*--------------------------------------------------------------------------*/ int ffhdef(fitsfile *fptr, /* I - FITS file pointer */ int morekeys, /* I - reserve space for this many keywords */ int *status) /* IO - error status */ /* based on the number of keywords which have already been written, plus the number of keywords to reserve space for, we then can define where the data unit should start (it must start at the beginning of a 2880-byte logical block). This routine will only have any effect if the starting location of the data unit following the header is not already defined. In any case, it is always possible to add more keywords to the header even if the data has already been written. It is just more efficient to reserve the space in advance. */ { LONGLONG delta; if (*status > 0 || morekeys < 1) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { ffrdef(fptr, status); /* ffrdef defines the offset to datastart and the start of */ /* the next HDU based on the number of existing keywords. */ /* We need to increment both of these values based on */ /* the number of new keywords to be added. */ delta = (((fptr->Fptr)->headend + (morekeys * 80)) / 2880 + 1) * 2880 - (fptr->Fptr)->datastart; (fptr->Fptr)->datastart += delta; (fptr->Fptr)->headstart[ (fptr->Fptr)->curhdu + 1] += delta; } return(*status); } /*--------------------------------------------------------------------------*/ int ffwend(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* write the END card and following fill (space chars) in the current header */ { int ii, tstatus; LONGLONG endpos; long nspace; char blankkey[FLEN_CARD], endkey[FLEN_CARD], keyrec[FLEN_CARD] = ""; if (*status > 0) return(*status); endpos = (fptr->Fptr)->headend; /* we assume that the HDUposition == curhdu in all cases */ /* calc the data starting position if not currently defined */ if ((fptr->Fptr)->datastart == DATA_UNDEFINED) (fptr->Fptr)->datastart = ( endpos / 2880 + 1 ) * 2880; /* calculate the number of blank keyword slots in the header */ nspace = (long) (( (fptr->Fptr)->datastart - endpos ) / 80); /* construct a blank and END keyword (80 spaces ) */ strcpy(blankkey, " "); strcat(blankkey, " "); strcpy(endkey, "END "); strcat(endkey, " "); /* check if header is already correctly terminated with END and fill */ tstatus=0; ffmbyt(fptr, endpos, REPORT_EOF, &tstatus); /* move to header end */ for (ii=0; ii < nspace; ii++) { ffgbyt(fptr, 80, keyrec, &tstatus); /* get next keyword */ if (tstatus) break; if (strncmp(keyrec, blankkey, 80) && strncmp(keyrec, endkey, 80)) break; } if (ii == nspace && !tstatus) { /* check if the END keyword exists at the correct position */ endpos=maxvalue( endpos, ( (fptr->Fptr)->datastart - 2880 ) ); ffmbyt(fptr, endpos, REPORT_EOF, &tstatus); /* move to END position */ ffgbyt(fptr, 80, keyrec, &tstatus); /* read the END keyword */ if ( !strncmp(keyrec, endkey, 80) && !tstatus) { /* store this position, for later reference */ (fptr->Fptr)->ENDpos = endpos; return(*status); /* END card was already correct */ } } /* header was not correctly terminated, so write the END and blank fill */ endpos = (fptr->Fptr)->headend; ffmbyt(fptr, endpos, IGNORE_EOF, status); /* move to header end */ for (ii=0; ii < nspace; ii++) ffpbyt(fptr, 80, blankkey, status); /* write the blank keywords */ /* The END keyword must either be placed immediately after the last keyword that was written (as indicated by the headend value), or must be in the first 80 bytes of the 2880-byte FITS record immediately preceeding the data unit, whichever is further in the file. The latter will occur if space has been reserved for more header keywords which have not yet been written. */ endpos=maxvalue( endpos, ( (fptr->Fptr)->datastart - 2880 ) ); ffmbyt(fptr, endpos, REPORT_EOF, status); /* move to END position */ ffpbyt(fptr, 80, endkey, status); /* write the END keyword to header */ /* store this position, for later reference */ (fptr->Fptr)->ENDpos = endpos; if (*status > 0) ffpmsg("Error while writing END card (ffwend)."); return(*status); } /*--------------------------------------------------------------------------*/ int ffpdfl(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Write the Data Unit Fill values if they are not already correct. The fill values are used to fill out the last 2880 byte block of the HDU. Fill the data unit with zeros or blanks depending on the type of HDU from the end of the data to the end of the current FITS 2880 byte block */ { char chfill, fill[2880]; LONGLONG fillstart; int nfill, tstatus, ii; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) return(*status); /* fill has already been correctly written */ if ((fptr->Fptr)->heapstart == 0) return(*status); /* null data unit, so there is no fill */ fillstart = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; nfill = (long) ((fillstart + 2879) / 2880 * 2880 - fillstart); if ((fptr->Fptr)->hdutype == ASCII_TBL) chfill = 32; /* ASCII tables are filled with spaces */ else chfill = 0; /* all other extensions are filled with zeros */ tstatus = 0; if (!nfill) /* no fill bytes; just check that entire table exists */ { fillstart--; nfill = 1; ffmbyt(fptr, fillstart, REPORT_EOF, &tstatus); /* move to last byte */ ffgbyt(fptr, nfill, fill, &tstatus); /* get the last byte */ if (tstatus == 0) return(*status); /* no EOF error, so everything is OK */ } else { ffmbyt(fptr, fillstart, REPORT_EOF, &tstatus); /* move to fill area */ ffgbyt(fptr, nfill, fill, &tstatus); /* get the fill bytes */ if (tstatus == 0) { for (ii = 0; ii < nfill; ii++) { if (fill[ii] != chfill) break; } if (ii == nfill) return(*status); /* all the fill values were correct */ } } /* fill values are incorrect or have not been written, so write them */ memset(fill, chfill, nfill); /* fill the buffer with the fill value */ ffmbyt(fptr, fillstart, IGNORE_EOF, status); /* move to fill area */ ffpbyt(fptr, nfill, fill, status); /* write the fill bytes */ if (*status > 0) ffpmsg("Error writing Data Unit fill bytes (ffpdfl)."); return(*status); } /********************************************************************** ffchfl : Check Header Fill values Check that the header unit is correctly filled with blanks from the END card to the end of the current FITS 2880-byte block Function parameters: fptr Fits file pointer status output error status Translated ftchfl into C by Peter Wilson, Oct. 1997 **********************************************************************/ int ffchfl( fitsfile *fptr, int *status) { int nblank,i,gotend; LONGLONG endpos; char rec[FLEN_CARD]; char *blanks=" "; /* 80 spaces */ if( *status > 0 ) return (*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* calculate the number of blank keyword slots in the header */ endpos=(fptr->Fptr)->headend; nblank=(long) (((fptr->Fptr)->datastart-endpos)/80); /* move the i/o pointer to the end of the header keywords */ ffmbyt(fptr,endpos,TRUE,status); /* find the END card (there may be blank keywords perceeding it) */ gotend=FALSE; for(i=0;i 0 ) { rec[FLEN_CARD - 1] = '\0'; /* make sure string is null terminated */ ffpmsg(rec); return( *status ); } } return( *status ); } /********************************************************************** ffcdfl : Check Data Unit Fill values Check that the data unit is correctly filled with zeros or blanks from the end of the data to the end of the current FITS 2880 byte block Function parameters: fptr Fits file pointer status output error status Translated ftcdfl into C by Peter Wilson, Oct. 1997 **********************************************************************/ int ffcdfl( fitsfile *fptr, int *status) { int nfill,i; LONGLONG filpos; char chfill,chbuff[2880]; if( *status > 0 ) return( *status ); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* check if the data unit is null */ if( (fptr->Fptr)->heapstart==0 ) return( *status ); /* calculate starting position of the fill bytes, if any */ filpos = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; /* calculate the number of fill bytes */ nfill = (long) ((filpos + 2879) / 2880 * 2880 - filpos); if( nfill == 0 ) return( *status ); /* move to the beginning of the fill bytes */ ffmbyt(fptr, filpos, FALSE, status); if( ffgbyt(fptr, nfill, chbuff, status) > 0) { ffpmsg("Error reading data unit fill bytes (ffcdfl)."); return( *status ); } if( (fptr->Fptr)->hdutype==ASCII_TBL ) chfill = 32; /* ASCII tables are filled with spaces */ else chfill = 0; /* all other extensions are filled with zeros */ /* check for all zeros or blanks */ for(i=0;iFptr)->hdutype==ASCII_TBL ) ffpmsg("Warning: remaining bytes following ASCII table data are not filled with blanks."); else ffpmsg("Warning: remaining bytes following data are not filled with zeros."); return( *status ); } } return( *status ); } /*--------------------------------------------------------------------------*/ int ffcrhd(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* CReate Header Data unit: Create, initialize, and move the i/o pointer to a new extension appended to the end of the FITS file. */ { int tstatus = 0; LONGLONG bytepos, *ptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* If the current header is empty, we don't have to do anything */ if ((fptr->Fptr)->headend == (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu] ) return(*status); while (ffmrhd(fptr, 1, 0, &tstatus) == 0); /* move to end of file */ if ((fptr->Fptr)->maxhdu == (fptr->Fptr)->MAXHDU) { /* allocate more space for the headstart array */ ptr = (LONGLONG*) realloc( (fptr->Fptr)->headstart, ((fptr->Fptr)->MAXHDU + 1001) * sizeof(LONGLONG) ); if (ptr == NULL) return (*status = MEMORY_ALLOCATION); else { (fptr->Fptr)->MAXHDU = (fptr->Fptr)->MAXHDU + 1000; (fptr->Fptr)->headstart = ptr; } } if (ffchdu(fptr, status) <= 0) /* close the current HDU */ { bytepos = (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1]; /* last */ ffmbyt(fptr, bytepos, IGNORE_EOF, status); /* move file ptr to it */ (fptr->Fptr)->maxhdu++; /* increment the known number of HDUs */ (fptr->Fptr)->curhdu = (fptr->Fptr)->maxhdu; /* set current HDU loc */ fptr->HDUposition = (fptr->Fptr)->maxhdu; /* set current HDU loc */ (fptr->Fptr)->nextkey = bytepos; /* next keyword = start of header */ (fptr->Fptr)->headend = bytepos; /* end of header */ (fptr->Fptr)->datastart = DATA_UNDEFINED; /* start data unit undefined */ /* any other needed resets */ /* reset the dithering offset that may have been calculated for the */ /* previous HDU back to the requested default value */ (fptr->Fptr)->dither_seed = (fptr->Fptr)->request_dither_seed; } return(*status); } /*--------------------------------------------------------------------------*/ int ffdblk(fitsfile *fptr, /* I - FITS file pointer */ long nblocks, /* I - number of 2880-byte blocks to delete */ int *status) /* IO - error status */ /* Delete the specified number of 2880-byte blocks from the end of the CHDU by shifting all following extensions up this number of blocks. */ { char buffer[2880]; int tstatus, ii; LONGLONG readpos, writepos; if (*status > 0 || nblocks <= 0) return(*status); tstatus = 0; /* pointers to the read and write positions */ readpos = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; readpos = ((readpos + 2879) / 2880) * 2880; /* start of block */ /* the following formula is wrong because the current data unit may have been extended without updating the headstart value of the following HDU. readpos = (fptr->Fptr)->headstart[((fptr->Fptr)->curhdu) + 1]; */ writepos = readpos - ((LONGLONG)nblocks * 2880); while ( !ffmbyt(fptr, readpos, REPORT_EOF, &tstatus) && !ffgbyt(fptr, 2880L, buffer, &tstatus) ) { ffmbyt(fptr, writepos, REPORT_EOF, status); ffpbyt(fptr, 2880L, buffer, status); if (*status > 0) { ffpmsg("Error deleting FITS blocks (ffdblk)"); return(*status); } readpos += 2880; /* increment to next block to transfer */ writepos += 2880; } /* now fill the last nblock blocks with zeros */ memset(buffer, 0, 2880); ffmbyt(fptr, writepos, REPORT_EOF, status); for (ii = 0; ii < nblocks; ii++) ffpbyt(fptr, 2880L, buffer, status); /* move back before the deleted blocks, since they may be deleted */ /* and we do not want to delete the current active buffer */ ffmbyt(fptr, writepos - 1, REPORT_EOF, status); /* truncate the file to the new size, if supported on this device */ fftrun(fptr, writepos, status); /* recalculate the starting location of all subsequent HDUs */ for (ii = (fptr->Fptr)->curhdu; ii <= (fptr->Fptr)->maxhdu; ii++) (fptr->Fptr)->headstart[ii + 1] -= ((LONGLONG)nblocks * 2880); return(*status); } /*--------------------------------------------------------------------------*/ int ffghdt(fitsfile *fptr, /* I - FITS file pointer */ int *exttype, /* O - type of extension, 0, 1, or 2 */ /* for IMAGE_HDU, ASCII_TBL, or BINARY_TBL */ int *status) /* IO - error status */ /* Return the type of the CHDU. This returns the 'logical' type of the HDU, not necessarily the physical type, so in the case of a compressed image stored in a binary table, this will return the type as an Image, not a binary table. */ { if (*status > 0) return(*status); if (fptr->HDUposition == 0 && (fptr->Fptr)->headend == 0) { /* empty primary array is alway an IMAGE_HDU */ *exttype = IMAGE_HDU; } else { /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { /* rescan header if data structure is undefined */ if ( ffrdef(fptr, status) > 0) return(*status); } *exttype = (fptr->Fptr)->hdutype; /* return the type of HDU */ /* check if this is a compressed image */ if ((fptr->Fptr)->compressimg) *exttype = IMAGE_HDU; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_is_reentrant(void) /* Was CFITSIO compiled with the -D_REENTRANT flag? 1 = yes, 0 = no. Note that specifying the -D_REENTRANT flag is required, but may not be sufficient, to ensure that CFITSIO can be safely used in a multi-threaded environoment. */ { #ifdef _REENTRANT return(1); #else return(0); #endif } /*--------------------------------------------------------------------------*/ int fits_is_compressed_image(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Returns TRUE if the CHDU is a compressed image, else returns zero. */ { if (*status > 0) return(0); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { /* rescan header if data structure is undefined */ if ( ffrdef(fptr, status) > 0) return(*status); } /* check if this is a compressed image */ if ((fptr->Fptr)->compressimg) return(1); return(0); } /*--------------------------------------------------------------------------*/ int ffgipr(fitsfile *infptr, /* I - FITS file pointer */ int maxaxis, /* I - max number of axes to return */ int *bitpix, /* O - image data type */ int *naxis, /* O - image dimension (NAXIS value) */ long *naxes, /* O - size of image dimensions */ int *status) /* IO - error status */ /* get the datatype and size of the input image */ { if (*status > 0) return(*status); /* don't return the parameter if a null pointer was given */ if (bitpix) fits_get_img_type(infptr, bitpix, status); /* get BITPIX value */ if (naxis) fits_get_img_dim(infptr, naxis, status); /* get NAXIS value */ if (naxes) fits_get_img_size(infptr, maxaxis, naxes, status); /* get NAXISn values */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgiprll(fitsfile *infptr, /* I - FITS file pointer */ int maxaxis, /* I - max number of axes to return */ int *bitpix, /* O - image data type */ int *naxis, /* O - image dimension (NAXIS value) */ LONGLONG *naxes, /* O - size of image dimensions */ int *status) /* IO - error status */ /* get the datatype and size of the input image */ { if (*status > 0) return(*status); /* don't return the parameter if a null pointer was given */ if (bitpix) fits_get_img_type(infptr, bitpix, status); /* get BITPIX value */ if (naxis) fits_get_img_dim(infptr, naxis, status); /* get NAXIS value */ if (naxes) fits_get_img_sizell(infptr, maxaxis, naxes, status); /* get NAXISn values */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgidt( fitsfile *fptr, /* I - FITS file pointer */ int *imgtype, /* O - image data type */ int *status) /* IO - error status */ /* Get the datatype of the image (= BITPIX keyword for normal image, or ZBITPIX for a compressed image) */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); /* reset to beginning of header */ ffmaky(fptr, 1, status); /* simply move to beginning of header */ if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffgky(fptr, TINT, "BITPIX", imgtype, NULL, status); } else if ((fptr->Fptr)->compressimg) { /* this is a binary table containing a compressed image */ ffgky(fptr, TINT, "ZBITPIX", imgtype, NULL, status); } else { *status = NOT_IMAGE; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgiet( fitsfile *fptr, /* I - FITS file pointer */ int *imgtype, /* O - image data type */ int *status) /* IO - error status */ /* Get the effective datatype of the image (= BITPIX keyword for normal image, or ZBITPIX for a compressed image) */ { int tstatus; long lngscale, lngzero = 0; double bscale, bzero, min_val, max_val; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); /* reset to beginning of header */ ffmaky(fptr, 2, status); /* simply move to beginning of header */ if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffgky(fptr, TINT, "BITPIX", imgtype, NULL, status); } else if ((fptr->Fptr)->compressimg) { /* this is a binary table containing a compressed image */ ffgky(fptr, TINT, "ZBITPIX", imgtype, NULL, status); } else { *status = NOT_IMAGE; return(*status); } /* check if the BSCALE and BZERO keywords are defined, which might change the effective datatype of the image */ tstatus = 0; ffgky(fptr, TDOUBLE, "BSCALE", &bscale, NULL, &tstatus); if (tstatus) bscale = 1.0; tstatus = 0; ffgky(fptr, TDOUBLE, "BZERO", &bzero, NULL, &tstatus); if (tstatus) bzero = 0.0; if (bscale == 1.0 && bzero == 0.0) /* no scaling */ return(*status); switch (*imgtype) { case BYTE_IMG: /* 8-bit image */ min_val = 0.; max_val = 255.0; break; case SHORT_IMG: min_val = -32768.0; max_val = 32767.0; break; case LONG_IMG: min_val = -2147483648.0; max_val = 2147483647.0; break; default: /* don't have to deal with other data types */ return(*status); } if (bscale >= 0.) { min_val = bzero + bscale * min_val; max_val = bzero + bscale * max_val; } else { max_val = bzero + bscale * min_val; min_val = bzero + bscale * max_val; } if (bzero < 2147483648.) /* don't exceed range of 32-bit integer */ lngzero = (long) bzero; lngscale = (long) bscale; if ((bzero != 2147483648.) && /* special value that exceeds integer range */ (lngzero != bzero || lngscale != bscale)) { /* not integers? */ /* floating point scaled values; just decide on required precision */ if (*imgtype == BYTE_IMG || *imgtype == SHORT_IMG) *imgtype = FLOAT_IMG; else *imgtype = DOUBLE_IMG; /* In all the remaining cases, BSCALE and BZERO are integers, and not equal to 1 and 0, respectively. */ } else if ((min_val == -128.) && (max_val == 127.)) { *imgtype = SBYTE_IMG; } else if ((min_val >= -32768.0) && (max_val <= 32767.0)) { *imgtype = SHORT_IMG; } else if ((min_val >= 0.0) && (max_val <= 65535.0)) { *imgtype = USHORT_IMG; } else if ((min_val >= -2147483648.0) && (max_val <= 2147483647.0)) { *imgtype = LONG_IMG; } else if ((min_val >= 0.0) && (max_val < 4294967296.0)) { *imgtype = ULONG_IMG; } else { /* exceeds the range of a 32-bit integer */ *imgtype = DOUBLE_IMG; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgidm( fitsfile *fptr, /* I - FITS file pointer */ int *naxis , /* O - image dimension (NAXIS value) */ int *status) /* IO - error status */ /* Get the dimension of the image (= NAXIS keyword for normal image, or ZNAXIS for a compressed image) These values are cached for faster access. */ { if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { *naxis = (fptr->Fptr)->imgdim; } else if ((fptr->Fptr)->compressimg) { *naxis = (fptr->Fptr)->zndim; } else { *status = NOT_IMAGE; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgisz( fitsfile *fptr, /* I - FITS file pointer */ int nlen, /* I - number of axes to return */ long *naxes, /* O - size of image dimensions */ int *status) /* IO - error status */ /* Get the size of the image dimensions (= NAXISn keywords for normal image, or ZNAXISn for a compressed image) These values are cached for faster access. */ { int ii, naxis; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { naxis = minvalue((fptr->Fptr)->imgdim, nlen); for (ii = 0; ii < naxis; ii++) { naxes[ii] = (long) (fptr->Fptr)->imgnaxis[ii]; } } else if ((fptr->Fptr)->compressimg) { naxis = minvalue( (fptr->Fptr)->zndim, nlen); for (ii = 0; ii < naxis; ii++) { naxes[ii] = (long) (fptr->Fptr)->znaxis[ii]; } } else { *status = NOT_IMAGE; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgiszll( fitsfile *fptr, /* I - FITS file pointer */ int nlen, /* I - number of axes to return */ LONGLONG *naxes, /* O - size of image dimensions */ int *status) /* IO - error status */ /* Get the size of the image dimensions (= NAXISn keywords for normal image, or ZNAXISn for a compressed image) */ { int ii, naxis; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { naxis = minvalue((fptr->Fptr)->imgdim, nlen); for (ii = 0; ii < naxis; ii++) { naxes[ii] = (fptr->Fptr)->imgnaxis[ii]; } } else if ((fptr->Fptr)->compressimg) { naxis = minvalue( (fptr->Fptr)->zndim, nlen); for (ii = 0; ii < naxis; ii++) { naxes[ii] = (fptr->Fptr)->znaxis[ii]; } } else { *status = NOT_IMAGE; } return(*status); }/*--------------------------------------------------------------------------*/ int ffmahd(fitsfile *fptr, /* I - FITS file pointer */ int hdunum, /* I - number of the HDU to move to */ int *exttype, /* O - type of extension, 0, 1, or 2 */ int *status) /* IO - error status */ /* Move to Absolute Header Data unit. Move to the specified HDU and read the header to initialize the table structure. Note that extnum is one based, so the primary array is extnum = 1. */ { int moveto, tstatus; char message[FLEN_ERRMSG]; LONGLONG *ptr; if (*status > 0) return(*status); else if (hdunum < 1 ) return(*status = BAD_HDU_NUM); else if (hdunum >= (fptr->Fptr)->MAXHDU ) { /* allocate more space for the headstart array */ ptr = (LONGLONG*) realloc( (fptr->Fptr)->headstart, (hdunum + 1001) * sizeof(LONGLONG) ); if (ptr == NULL) return (*status = MEMORY_ALLOCATION); else { (fptr->Fptr)->MAXHDU = hdunum + 1000; (fptr->Fptr)->headstart = ptr; } } /* set logical HDU position to the actual position, in case they differ */ fptr->HDUposition = (fptr->Fptr)->curhdu; while( ((fptr->Fptr)->curhdu) + 1 != hdunum) /* at the correct HDU? */ { /* move directly to the extension if we know that it exists, otherwise move to the highest known extension. */ moveto = minvalue(hdunum - 1, ((fptr->Fptr)->maxhdu) + 1); /* test if HDU exists */ if ((fptr->Fptr)->headstart[moveto] < (fptr->Fptr)->logfilesize ) { if (ffchdu(fptr, status) <= 0) /* close out the current HDU */ { if (ffgext(fptr, moveto, exttype, status) > 0) { /* failed to get the requested extension */ tstatus = 0; ffrhdu(fptr, exttype, &tstatus); /* restore the CHDU */ } } } else *status = END_OF_FILE; if (*status > 0) { if (*status != END_OF_FILE) { /* don't clutter up the message stack in the common case of */ /* simply hitting the end of file (often an expected error) */ sprintf(message, "Failed to move to HDU number %d (ffmahd).", hdunum); ffpmsg(message); } return(*status); } } /* return the type of HDU; tile compressed images which are stored */ /* in a binary table will return exttype = IMAGE_HDU, not BINARY_TBL */ if (exttype != NULL) ffghdt(fptr, exttype, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffmrhd(fitsfile *fptr, /* I - FITS file pointer */ int hdumov, /* I - rel. no. of HDUs to move by (+ or -) */ int *exttype, /* O - type of extension, 0, 1, or 2 */ int *status) /* IO - error status */ /* Move a Relative number of Header Data units. Offset to the specified extension and read the header to initialize the HDU structure. */ { int extnum; if (*status > 0) return(*status); extnum = fptr->HDUposition + 1 + hdumov; /* the absolute HDU number */ ffmahd(fptr, extnum, exttype, status); /* move to the HDU */ return(*status); } /*--------------------------------------------------------------------------*/ int ffmnhd(fitsfile *fptr, /* I - FITS file pointer */ int exttype, /* I - desired extension type */ char *hduname, /* I - desired EXTNAME value for the HDU */ int hduver, /* I - desired EXTVERS value for the HDU */ int *status) /* IO - error status */ /* Move to the next HDU with a given extension type (IMAGE_HDU, ASCII_TBL, BINARY_TBL, or ANY_HDU), extension name (EXTNAME or HDUNAME keyword), and EXTVERS keyword values. If hduvers = 0, then move to the first HDU with the given type and name regardless of EXTVERS value. If no matching HDU is found in the file, then the current open HDU will remain unchanged. */ { char extname[FLEN_VALUE]; int ii, hdutype, alttype, extnum, tstatus, match, exact; int slen, putback = 0, chopped = 0; long extver; if (*status > 0) return(*status); extnum = fptr->HDUposition + 1; /* save the current HDU number */ /* This is a kludge to deal with a special case where the user specified a hduname that ended with a # character, which CFITSIO previously interpreted as a flag to mean "don't copy any other HDUs in the file into the virtual file in memory. If the remaining hduname does not end with a # character (meaning that the user originally entered a hduname ending in 2 # characters) then there is the possibility that the # character should be treated literally, if the actual EXTNAME also ends with a #. Setting putback = 1 means that we need to test for this case later on. */ if ((fptr->Fptr)->only_one) { /* if true, name orignally ended with a # */ slen = strlen(hduname); if (hduname[slen - 1] != '#') /* This will fail if real EXTNAME value */ putback = 1; /* ends with 2 # characters. */ } for (ii=1; 1; ii++) /* loop over all HDUs until EOF */ { tstatus = 0; if (ffmahd(fptr, ii, &hdutype, &tstatus)) /* move to next HDU */ { ffmahd(fptr, extnum, 0, status); /* restore original file position */ return(*status = BAD_HDU_NUM); /* couldn't find desired HDU */ } alttype = -1; if (fits_is_compressed_image(fptr, status)) alttype = BINARY_TBL; /* Does this HDU have a matching type? */ if (exttype == ANY_HDU || hdutype == exttype || hdutype == alttype) { ffmaky(fptr, 2, status); /* reset to the 2nd keyword in the header */ if (ffgkys(fptr, "EXTNAME", extname, 0, &tstatus) <= 0) /* get keyword */ { if (putback) { /* more of the kludge */ /* test if the EXTNAME value ends with a #; if so, chop it */ /* off before comparing the strings */ chopped = 0; slen = strlen(extname); if (extname[slen - 1] == '#') { extname[slen - 1] = '\0'; chopped = 1; } } /* see if the strings are an exact match */ ffcmps(extname, hduname, CASEINSEN, &match, &exact); } /* if EXTNAME keyword doesn't exist, or it does not match, then try HDUNAME */ if (tstatus || !exact) { tstatus = 0; if (ffgkys(fptr, "HDUNAME", extname, 0, &tstatus) <= 0) { if (putback) { /* more of the kludge */ chopped = 0; slen = strlen(extname); if (extname[slen - 1] == '#') { extname[slen - 1] = '\0'; /* chop off the # */ chopped = 1; } } /* see if the strings are an exact match */ ffcmps(extname, hduname, CASEINSEN, &match, &exact); } } if (!tstatus && exact) /* found a matching name */ { if (hduver) /* need to check if version numbers match? */ { if (ffgkyj(fptr, "EXTVER", &extver, 0, &tstatus) > 0) extver = 1; /* assume default EXTVER value */ if ( (int) extver == hduver) { if (chopped) { /* The # was literally part of the name, not a flag */ (fptr->Fptr)->only_one = 0; } return(*status); /* found matching name and vers */ } } else { if (chopped) { /* The # was literally part of the name, not a flag */ (fptr->Fptr)->only_one = 0; } return(*status); /* found matching name */ } } /* end of !tstatus && exact */ } /* end of matching HDU type */ } /* end of loop over HDUs */ } /*--------------------------------------------------------------------------*/ int ffthdu(fitsfile *fptr, /* I - FITS file pointer */ int *nhdu, /* O - number of HDUs in the file */ int *status) /* IO - error status */ /* Return the number of HDUs that currently exist in the file. */ { int ii, extnum, tstatus; if (*status > 0) return(*status); extnum = fptr->HDUposition + 1; /* save the current HDU number */ *nhdu = extnum - 1; /* if the CHDU is empty or not completely defined, just return */ if ((fptr->Fptr)->datastart == DATA_UNDEFINED) return(*status); tstatus = 0; /* loop until EOF */ for (ii=extnum; ffmahd(fptr, ii, 0, &tstatus) <= 0; ii++) { *nhdu = ii; } ffmahd(fptr, extnum, 0, status); /* restore orig file position */ return(*status); } /*--------------------------------------------------------------------------*/ int ffgext(fitsfile *fptr, /* I - FITS file pointer */ int hdunum, /* I - no. of HDU to move get (0 based) */ int *exttype, /* O - type of extension, 0, 1, or 2 */ int *status) /* IO - error status */ /* Get Extension. Move to the specified extension and initialize the HDU structure. */ { int xcurhdu, xmaxhdu; LONGLONG xheadend; if (*status > 0) return(*status); if (ffmbyt(fptr, (fptr->Fptr)->headstart[hdunum], REPORT_EOF, status) <= 0) { /* temporarily save current values, in case of error */ xcurhdu = (fptr->Fptr)->curhdu; xmaxhdu = (fptr->Fptr)->maxhdu; xheadend = (fptr->Fptr)->headend; /* set new parameter values */ (fptr->Fptr)->curhdu = hdunum; fptr->HDUposition = hdunum; (fptr->Fptr)->maxhdu = maxvalue((fptr->Fptr)->maxhdu, hdunum); (fptr->Fptr)->headend = (fptr->Fptr)->logfilesize; /* set max size */ if (ffrhdu(fptr, exttype, status) > 0) { /* failed to get the new HDU, so restore previous values */ (fptr->Fptr)->curhdu = xcurhdu; fptr->HDUposition = xcurhdu; (fptr->Fptr)->maxhdu = xmaxhdu; (fptr->Fptr)->headend = xheadend; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffiblk(fitsfile *fptr, /* I - FITS file pointer */ long nblock, /* I - no. of blocks to insert */ int headdata, /* I - insert where? 0=header, 1=data */ /* -1=beginning of file */ int *status) /* IO - error status */ /* insert 2880-byte blocks at the end of the current header or data unit */ { int tstatus, savehdu, typhdu; LONGLONG insertpt, jpoint; long ii, nshift; char charfill; char buff1[2880], buff2[2880]; char *inbuff, *outbuff, *tmpbuff; char card[FLEN_CARD]; if (*status > 0 || nblock <= 0) return(*status); tstatus = *status; if (headdata == 0 || (fptr->Fptr)->hdutype == ASCII_TBL) charfill = 32; /* headers and ASCII tables have space (32) fill */ else charfill = 0; /* images and binary tables have zero fill */ if (headdata == 0) insertpt = (fptr->Fptr)->datastart; /* insert just before data, or */ else if (headdata == -1) { insertpt = 0; strcpy(card, "XTENSION= 'IMAGE ' / IMAGE extension"); } else /* at end of data, */ { insertpt = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; insertpt = ((insertpt + 2879) / 2880) * 2880; /* start of block */ /* the following formula is wrong because the current data unit may have been extended without updating the headstart value of the following HDU. */ /* insertpt = (fptr->Fptr)->headstart[(fptr->Fptr)->curhdu + 1]; */ } inbuff = buff1; /* set pointers to input and output buffers */ outbuff = buff2; memset(outbuff, charfill, 2880); /* initialize buffer with fill */ if (nblock == 1) /* insert one block */ { if (headdata == -1) ffmrec(fptr, 1, card, status); /* change SIMPLE -> XTENSION */ ffmbyt(fptr, insertpt, REPORT_EOF, status); /* move to 1st point */ ffgbyt(fptr, 2880, inbuff, status); /* read first block of bytes */ while (*status <= 0) { ffmbyt(fptr, insertpt, REPORT_EOF, status); /* insert point */ ffpbyt(fptr, 2880, outbuff, status); /* write the output buffer */ if (*status > 0) return(*status); tmpbuff = inbuff; /* swap input and output pointers */ inbuff = outbuff; outbuff = tmpbuff; insertpt += 2880; /* increment insert point by 1 block */ ffmbyt(fptr, insertpt, REPORT_EOF, status); /* move to next block */ ffgbyt(fptr, 2880, inbuff, status); /* read block of bytes */ } *status = tstatus; /* reset status value */ ffmbyt(fptr, insertpt, IGNORE_EOF, status); /* move back to insert pt */ ffpbyt(fptr, 2880, outbuff, status); /* write the final block */ } else /* inserting more than 1 block */ { savehdu = (fptr->Fptr)->curhdu; /* save the current HDU number */ tstatus = *status; while(*status <= 0) /* find the last HDU in file */ ffmrhd(fptr, 1, &typhdu, status); if (*status == END_OF_FILE) { *status = tstatus; } ffmahd(fptr, savehdu + 1, &typhdu, status); /* move back to CHDU */ if (headdata == -1) ffmrec(fptr, 1, card, status); /* NOW change SIMPLE -> XTENSION */ /* number of 2880-byte blocks that have to be shifted down */ nshift = (long) (((fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] - insertpt) / 2880); /* position of last block in file to be shifted */ jpoint = (fptr->Fptr)->headstart[(fptr->Fptr)->maxhdu + 1] - 2880; /* move all the blocks starting at end of file working backwards */ for (ii = 0; ii < nshift; ii++) { /* move to the read start position */ if (ffmbyt(fptr, jpoint, REPORT_EOF, status) > 0) return(*status); ffgbyt(fptr, 2880, inbuff,status); /* read one record */ /* move forward to the write postion */ ffmbyt(fptr, jpoint + ((LONGLONG) nblock * 2880), IGNORE_EOF, status); ffpbyt(fptr, 2880, inbuff, status); /* write the record */ jpoint -= 2880; } /* move back to the write start postion (might be EOF) */ ffmbyt(fptr, insertpt, IGNORE_EOF, status); for (ii = 0; ii < nblock; ii++) /* insert correct fill value */ ffpbyt(fptr, 2880, outbuff, status); } if (headdata == 0) /* update data start address */ (fptr->Fptr)->datastart += ((LONGLONG) nblock * 2880); /* update following HDU addresses */ for (ii = (fptr->Fptr)->curhdu; ii <= (fptr->Fptr)->maxhdu; ii++) (fptr->Fptr)->headstart[ii + 1] += ((LONGLONG) nblock * 2880); return(*status); } /*--------------------------------------------------------------------------*/ int ffgkcl(char *tcard) /* Return the type classification of the input header record TYP_STRUC_KEY: SIMPLE, BITPIX, NAXIS, NAXISn, EXTEND, BLOCKED, GROUPS, PCOUNT, GCOUNT, END XTENSION, TFIELDS, TTYPEn, TBCOLn, TFORMn, THEAP, and the first 4 COMMENT keywords in the primary array that define the FITS format. TYP_CMPRS_KEY: The experimental keywords used in the compressed image format ZIMAGE, ZCMPTYPE, ZNAMEn, ZVALn, ZTILEn, ZBITPIX, ZNAXISn, ZSCALE, ZZERO, ZBLANK, EXTNAME = 'COMPRESSED_IMAGE' ZSIMPLE, ZTENSION, ZEXTEND, ZBLOCKED, ZPCOUNT, ZGCOUNT TYP_SCAL_KEY: BSCALE, BZERO, TSCALn, TZEROn TYP_NULL_KEY: BLANK, TNULLn TYP_DIM_KEY: TDIMn TYP_RANG_KEY: TLMINn, TLMAXn, TDMINn, TDMAXn, DATAMIN, DATAMAX TYP_UNIT_KEY: BUNIT, TUNITn TYP_DISP_KEY: TDISPn TYP_HDUID_KEY: EXTNAME, EXTVER, EXTLEVEL, HDUNAME, HDUVER, HDULEVEL TYP_CKSUM_KEY CHECKSUM, DATASUM TYP_WCS_KEY: Primary array: WCAXES, CTYPEn, CUNITn, CRVALn, CRPIXn, CROTAn, CDELTn CDj_is, PVj_ms, LONPOLEs, LATPOLEs Pixel list: TCTYPn, TCTYns, TCUNIn, TCUNns, TCRVLn, TCRVns, TCRPXn, TCRPks, TCDn_k, TCn_ks, TPVn_m, TPn_ms, TCDLTn, TCROTn Bintable vector: jCTYPn, jCTYns, jCUNIn, jCUNns, jCRVLn, jCRVns, iCRPXn, iCRPns, jiCDn, jiCDns, jPVn_m, jPn_ms, jCDLTn, jCROTn TYP_REFSYS_KEY: EQUINOXs, EPOCH, MJD-OBSs, RADECSYS, RADESYSs TYP_COMM_KEY: COMMENT, HISTORY, (blank keyword) TYP_CONT_KEY: CONTINUE TYP_USER_KEY: all other keywords */ { char card[20], *card1, *card5; card[0] = '\0'; strncat(card, tcard, 8); /* copy the keyword name */ strcat(card, " "); /* append blanks to make at least 8 chars long */ ffupch(card); /* make sure it is in upper case */ card1 = card + 1; /* pointer to 2nd character */ card5 = card + 5; /* pointer to 6th character */ /* the strncmp function is slow, so try to be more efficient */ if (*card == 'Z') { if (FSTRNCMP (card1, "IMAGE ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "CMPTYPE", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "NAME", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_CMPRS_KEY); } else if (FSTRNCMP (card1, "VAL", 3) == 0) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_CMPRS_KEY); } else if (FSTRNCMP (card1, "TILE", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_CMPRS_KEY); } else if (FSTRNCMP (card1, "BITPIX ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "NAXIS", 5) == 0) { if ( ( *(card + 6) >= '0' && *(card + 6) <= '9' ) || (*(card + 6) == ' ') ) return (TYP_CMPRS_KEY); } else if (FSTRNCMP (card1, "SCALE ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "ZERO ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "BLANK ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "SIMPLE ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "TENSION", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "EXTEND ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "BLOCKED", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "PCOUNT ", 7) == 0) return (TYP_CMPRS_KEY); else if (FSTRNCMP (card1, "GCOUNT ", 7) == 0) return (TYP_CMPRS_KEY); } else if (*card == ' ') { return (TYP_COMM_KEY); } else if (*card == 'B') { if (FSTRNCMP (card1, "ITPIX ", 7) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (card1, "LOCKED ", 7) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (card1, "LANK ", 7) == 0) return (TYP_NULL_KEY); if (FSTRNCMP (card1, "SCALE ", 7) == 0) return (TYP_SCAL_KEY); if (FSTRNCMP (card1, "ZERO ", 7) == 0) return (TYP_SCAL_KEY); if (FSTRNCMP (card1, "UNIT ", 7) == 0) return (TYP_UNIT_KEY); } else if (*card == 'C') { if (FSTRNCMP (card1, "OMMENT",6) == 0) { /* new comment string starting Oct 2001 */ if (FSTRNCMP (tcard, "COMMENT and Astrophysics', volume 376, page 3", 47) == 0) return (TYP_STRUC_KEY); /* original COMMENT strings from 1993 - 2001 */ if (FSTRNCMP (tcard, "COMMENT FITS (Flexible Image Transport System", 47) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (tcard, "COMMENT Astrophysics Supplement Series v44/p3", 47) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (tcard, "COMMENT Contact the NASA Science Office of St", 47) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (tcard, "COMMENT FITS Definition document #100 and oth", 47) == 0) return (TYP_STRUC_KEY); if (*(card + 7) == ' ') return (TYP_COMM_KEY); else return (TYP_USER_KEY); } if (FSTRNCMP (card1, "HECKSUM", 7) == 0) return (TYP_CKSUM_KEY); if (FSTRNCMP (card1, "ONTINUE", 7) == 0) return (TYP_CONT_KEY); if (FSTRNCMP (card1, "TYPE",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "UNIT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "RVAL",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "RPIX",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "ROTA",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "RDER",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "SYER",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "DELT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (*card1 == 'D') { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } } else if (*card == 'D') { if (FSTRNCMP (card1, "ATASUM ", 7) == 0) return (TYP_CKSUM_KEY); if (FSTRNCMP (card1, "ATAMIN ", 7) == 0) return (TYP_RANG_KEY); if (FSTRNCMP (card1, "ATAMAX ", 7) == 0) return (TYP_RANG_KEY); if (FSTRNCMP (card1, "ATE-OBS", 7) == 0) return (TYP_REFSYS_KEY); } else if (*card == 'E') { if (FSTRNCMP (card1, "XTEND ", 7) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (card1, "ND ", 7) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (card1, "XTNAME ", 7) == 0) { /* check for special compressed image value */ if (FSTRNCMP(tcard, "EXTNAME = 'COMPRESSED_IMAGE'", 28) == 0) return (TYP_CMPRS_KEY); else return (TYP_HDUID_KEY); } if (FSTRNCMP (card1, "XTVER ", 7) == 0) return (TYP_HDUID_KEY); if (FSTRNCMP (card1, "XTLEVEL", 7) == 0) return (TYP_HDUID_KEY); if (FSTRNCMP (card1, "QUINOX", 6) == 0) return (TYP_REFSYS_KEY); if (FSTRNCMP (card1, "QUI",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_REFSYS_KEY); } if (FSTRNCMP (card1, "POCH ", 7) == 0) return (TYP_REFSYS_KEY); } else if (*card == 'G') { if (FSTRNCMP (card1, "COUNT ", 7) == 0) return (TYP_STRUC_KEY); if (FSTRNCMP (card1, "ROUPS ", 7) == 0) return (TYP_STRUC_KEY); } else if (*card == 'H') { if (FSTRNCMP (card1, "DUNAME ", 7) == 0) return (TYP_HDUID_KEY); if (FSTRNCMP (card1, "DUVER ", 7) == 0) return (TYP_HDUID_KEY); if (FSTRNCMP (card1, "DULEVEL", 7) == 0) return (TYP_HDUID_KEY); if (FSTRNCMP (card1, "ISTORY",6) == 0) { if (*(card + 7) == ' ') return (TYP_COMM_KEY); else return (TYP_USER_KEY); } } else if (*card == 'L') { if (FSTRNCMP (card1, "ONPOLE",6) == 0) return (TYP_WCS_KEY); if (FSTRNCMP (card1, "ATPOLE",6) == 0) return (TYP_WCS_KEY); if (FSTRNCMP (card1, "ONP",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "ATP",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } } else if (*card == 'M') { if (FSTRNCMP (card1, "JD-OBS ", 7) == 0) return (TYP_REFSYS_KEY); if (FSTRNCMP (card1, "JDOB",4) == 0) { if (*(card+5) >= '0' && *(card+5) <= '9') return (TYP_REFSYS_KEY); } } else if (*card == 'N') { if (FSTRNCMP (card1, "AXIS", 4) == 0) { if ((*card5 >= '0' && *card5 <= '9') || (*card5 == ' ')) return (TYP_STRUC_KEY); } } else if (*card == 'P') { if (FSTRNCMP (card1, "COUNT ", 7) == 0) return (TYP_STRUC_KEY); if (*card1 == 'C') { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (*card1 == 'V') { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (*card1 == 'S') { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } } else if (*card == 'R') { if (FSTRNCMP (card1, "ADECSYS", 7) == 0) return (TYP_REFSYS_KEY); if (FSTRNCMP (card1, "ADESYS", 6) == 0) return (TYP_REFSYS_KEY); if (FSTRNCMP (card1, "ADE",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_REFSYS_KEY); } } else if (*card == 'S') { if (FSTRNCMP (card1, "IMPLE ", 7) == 0) return (TYP_STRUC_KEY); } else if (*card == 'T') { if (FSTRNCMP (card1, "TYPE", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_STRUC_KEY); } else if (FSTRNCMP (card1, "FORM", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_STRUC_KEY); } else if (FSTRNCMP (card1, "BCOL", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_STRUC_KEY); } else if (FSTRNCMP (card1, "FIELDS ", 7) == 0) return (TYP_STRUC_KEY); else if (FSTRNCMP (card1, "HEAP ", 7) == 0) return (TYP_STRUC_KEY); else if (FSTRNCMP (card1, "NULL", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_NULL_KEY); } else if (FSTRNCMP (card1, "DIM", 3) == 0) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_DIM_KEY); } else if (FSTRNCMP (card1, "UNIT", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_UNIT_KEY); } else if (FSTRNCMP (card1, "DISP", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_DISP_KEY); } else if (FSTRNCMP (card1, "SCAL", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_SCAL_KEY); } else if (FSTRNCMP (card1, "ZERO", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_SCAL_KEY); } else if (FSTRNCMP (card1, "LMIN", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_RANG_KEY); } else if (FSTRNCMP (card1, "LMAX", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_RANG_KEY); } else if (FSTRNCMP (card1, "DMIN", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_RANG_KEY); } else if (FSTRNCMP (card1, "DMAX", 4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_RANG_KEY); } else if (FSTRNCMP (card1, "CTYP",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CTY",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CUNI",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CUN",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRVL",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRV",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRPX",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRP",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CROT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CDLT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CDE",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRD",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CSY",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "WCS",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "C",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "P",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "V",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "S",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } } else if (*card == 'X') { if (FSTRNCMP (card1, "TENSION", 7) == 0) return (TYP_STRUC_KEY); } else if (*card == 'W') { if (FSTRNCMP (card1, "CSAXES", 6) == 0) return (TYP_WCS_KEY); if (FSTRNCMP (card1, "CSNAME", 6) == 0) return (TYP_WCS_KEY); if (FSTRNCMP (card1, "CAX", 3) == 0) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CSN", 3) == 0) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_WCS_KEY); } } else if (*card >= '0' && *card <= '9') { if (*card1 == 'C') { if (FSTRNCMP (card1, "CTYP",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CTY",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CUNI",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CUN",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRVL",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRV",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRPX",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRP",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CROT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CDLT",4) == 0) { if (*card5 >= '0' && *card5 <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CDE",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CRD",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "CSY",3) == 0) { if (*(card+4) >= '0' && *(card+4) <= '9') return (TYP_WCS_KEY); } } else if (FSTRNCMP (card1, "V",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (FSTRNCMP (card1, "S",1) == 0) { if (*(card + 2) >= '0' && *(card + 2) <= '9') return (TYP_WCS_KEY); } else if (*card1 >= '0' && *card1 <= '9') { /* 2 digits at beginning of keyword */ if ( (*(card + 2) == 'P') && (*(card + 3) == 'C') ) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_WCS_KEY); /* ijPCn keyword */ } else if ( (*(card + 2) == 'C') && (*(card + 3) == 'D') ) { if (*(card + 4) >= '0' && *(card + 4) <= '9') return (TYP_WCS_KEY); /* ijCDn keyword */ } } } return (TYP_USER_KEY); /* by default all others are user keywords */ } /*--------------------------------------------------------------------------*/ int ffdtyp(const char *cval, /* I - formatted string representation of the value */ char *dtype, /* O - datatype code: C, L, F, I, or X */ int *status) /* IO - error status */ /* determine implicit datatype of input string. This assumes that the string conforms to the FITS standard for keyword values, so may not detect all invalid formats. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); else if (cval[0] == '\'') *dtype = 'C'; /* character string starts with a quote */ else if (cval[0] == 'T' || cval[0] == 'F') *dtype = 'L'; /* logical = T or F character */ else if (cval[0] == '(') *dtype = 'X'; /* complex datatype "(1.2, -3.4)" */ else if (strchr(cval,'.')) *dtype = 'F'; /* float usualy contains a decimal point */ else if (strchr(cval,'E') || strchr(cval,'D') ) *dtype = 'F'; /* exponential contains a E or D */ else *dtype = 'I'; /* if none of the above assume it is integer */ return(*status); } /*--------------------------------------------------------------------------*/ int ffinttyp(char *cval, /* I - formatted string representation of the integer */ int *dtype, /* O - datatype code: TBYTE, TSHORT, TUSHORT, etc */ int *negative, /* O - is cval negative? */ int *status) /* IO - error status */ /* determine implicit datatype of input integer string. This assumes that the string conforms to the FITS standard for integer keyword value, so may not detect all invalid formats. */ { int ii, len; char *p; if (*status > 0) /* inherit input status value if > 0 */ return(*status); *dtype = 0; /* initialize to NULL */ p = cval; if (*p == '+') { p++; /* ignore leading + sign */ } else if (*p == '-') { p++; *negative = 1; /* this is a negative number */ } if (*p == '0') { while (*p == '0') p++; /* skip leading zeros */ if (*p == 0) { /* the value is a string of 1 or more zeros */ *dtype = TSBYTE; return(*status); } } len = strlen(p); for (ii = 0; ii < len; ii++) { if (!isdigit(*(p+ii))) { *status = BAD_INTKEY; return(*status); } } /* check for unambiguous cases, based on length of the string */ if (len == 0) { *status = VALUE_UNDEFINED; } else if (len < 3) { *dtype = TSBYTE; } else if (len == 4) { *dtype = TSHORT; } else if (len > 5 && len < 10) { *dtype = TINT; } else if (len > 10 && len < 19) { *dtype = TLONGLONG; } else if (len > 19) { *status = BAD_INTKEY; } else { if (!(*negative)) { /* positive integers */ if (len == 3) { if (strcmp(p,"127") <= 0 ) { *dtype = TSBYTE; } else if (strcmp(p,"255") <= 0 ) { *dtype = TBYTE; } else { *dtype = TSHORT; } } else if (len == 5) { if (strcmp(p,"32767") <= 0 ) { *dtype = TSHORT; } else if (strcmp(p,"65535") <= 0 ) { *dtype = TUSHORT; } else { *dtype = TINT; } } else if (len == 10) { if (strcmp(p,"2147483647") <= 0 ) { *dtype = TINT; } else if (strcmp(p,"4294967295") <= 0 ) { *dtype = TUINT; } else { *dtype = TLONGLONG; } } else if (len == 19) { if (strcmp(p,"9223372036854775807") <= 0 ) { *dtype = TLONGLONG; } else { *status = BAD_INTKEY; } } } else { /* negative integers */ if (len == 3) { if (strcmp(p,"128") <= 0 ) { *dtype = TSBYTE; } else { *dtype = TSHORT; } } else if (len == 5) { if (strcmp(p,"32768") <= 0 ) { *dtype = TSHORT; } else { *dtype = TINT; } } else if (len == 10) { if (strcmp(p,"2147483648") <= 0 ) { *dtype = TINT; } else { *dtype = TLONGLONG; } } else if (len == 19) { if (strcmp(p,"9223372036854775808") <= 0 ) { *dtype = TLONGLONG; } else { *status = BAD_INTKEY; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2x(const char *cval, /* I - formatted string representation of the value */ char *dtype, /* O - datatype code: C, L, F, I or X */ /* Only one of the following will be defined, depending on datatype */ long *ival, /* O - integer value */ int *lval, /* O - logical value */ char *sval, /* O - string value */ double *dval, /* O - double value */ int *status) /* IO - error status */ /* high level routine to convert formatted character string to its intrinsic data type */ { ffdtyp(cval, dtype, status); /* determine the datatype */ if (*dtype == 'I') ffc2ii(cval, ival, status); else if (*dtype == 'F') ffc2dd(cval, dval, status); else if (*dtype == 'L') ffc2ll(cval, lval, status); else ffc2s(cval, sval, status); /* C and X formats */ return(*status); } /*--------------------------------------------------------------------------*/ int ffc2xx(const char *cval, /* I - formatted string representation of the value */ char *dtype, /* O - datatype code: C, L, F, I or X */ /* Only one of the following will be defined, depending on datatype */ LONGLONG *ival, /* O - integer value */ int *lval, /* O - logical value */ char *sval, /* O - string value */ double *dval, /* O - double value */ int *status) /* IO - error status */ /* high level routine to convert formatted character string to its intrinsic data type */ { ffdtyp(cval, dtype, status); /* determine the datatype */ if (*dtype == 'I') ffc2jj(cval, ival, status); else if (*dtype == 'F') ffc2dd(cval, dval, status); else if (*dtype == 'L') ffc2ll(cval, lval, status); else ffc2s(cval, sval, status); /* C and X formats */ return(*status); } /*--------------------------------------------------------------------------*/ int ffc2i(const char *cval, /* I - string representation of the value */ long *ival, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert formatted string to an integer value, doing implicit datatype conversion if necessary. */ { char dtype, sval[81], msg[81]; int lval; double dval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); /* null value string */ /* convert the keyword to its native datatype */ ffc2x(cval, &dtype, ival, &lval, sval, &dval, status); if (dtype == 'X' ) { *status = BAD_INTKEY; } else if (dtype == 'C') { /* try reading the string as a number */ if (ffc2dd(sval, &dval, status) <= 0) { if (dval > (double) LONG_MAX || dval < (double) LONG_MIN) *status = NUM_OVERFLOW; else *ival = (long) dval; } } else if (dtype == 'F') { if (dval > (double) LONG_MAX || dval < (double) LONG_MIN) *status = NUM_OVERFLOW; else *ival = (long) dval; } else if (dtype == 'L') { *ival = (long) lval; } if (*status > 0) { *ival = 0; strcpy(msg,"Error in ffc2i evaluating string as an integer: "); strncat(msg,cval,30); ffpmsg(msg); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2j(const char *cval, /* I - string representation of the value */ LONGLONG *ival, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert formatted string to a LONGLONG integer value, doing implicit datatype conversion if necessary. */ { char dtype, sval[81], msg[81]; int lval; double dval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); /* null value string */ /* convert the keyword to its native datatype */ ffc2xx(cval, &dtype, ival, &lval, sval, &dval, status); if (dtype == 'X' ) { *status = BAD_INTKEY; } else if (dtype == 'C') { /* try reading the string as a number */ if (ffc2dd(sval, &dval, status) <= 0) { if (dval > (double) LONGLONG_MAX || dval < (double) LONGLONG_MIN) *status = NUM_OVERFLOW; else *ival = (LONGLONG) dval; } } else if (dtype == 'F') { if (dval > (double) LONGLONG_MAX || dval < (double) LONGLONG_MIN) *status = NUM_OVERFLOW; else *ival = (LONGLONG) dval; } else if (dtype == 'L') { *ival = (LONGLONG) lval; } if (*status > 0) { *ival = 0; strcpy(msg,"Error in ffc2j evaluating string as a long integer: "); strncat(msg,cval,30); ffpmsg(msg); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2l(const char *cval, /* I - string representation of the value */ int *lval, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert formatted string to a logical value, doing implicit datatype conversion if necessary */ { char dtype, sval[81], msg[81]; long ival; double dval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); /* null value string */ /* convert the keyword to its native datatype */ ffc2x(cval, &dtype, &ival, lval, sval, &dval, status); if (dtype == 'C' || dtype == 'X' ) *status = BAD_LOGICALKEY; if (*status > 0) { *lval = 0; strcpy(msg,"Error in ffc2l evaluating string as a logical: "); strncat(msg,cval,30); ffpmsg(msg); return(*status); } if (dtype == 'I') { if (ival) *lval = 1; else *lval = 0; } else if (dtype == 'F') { if (dval) *lval = 1; else *lval = 0; } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2r(const char *cval, /* I - string representation of the value */ float *fval, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert formatted string to a real float value, doing implicit datatype conversion if necessary */ { char dtype, sval[81], msg[81]; int lval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); /* null value string */ ffdtyp(cval, &dtype, status); /* determine the datatype */ if (dtype == 'I' || dtype == 'F') ffc2rr(cval, fval, status); else if (dtype == 'L') { ffc2ll(cval, &lval, status); *fval = (float) lval; } else if (dtype == 'C') { /* try reading the string as a number */ ffc2s(cval, sval, status); ffc2rr(sval, fval, status); } else *status = BAD_FLOATKEY; if (*status > 0) { *fval = 0.; strcpy(msg,"Error in ffc2r evaluating string as a float: "); strncat(msg,cval,30); ffpmsg(msg); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2d(const char *cval, /* I - string representation of the value */ double *dval, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert formatted string to a double value, doing implicit datatype conversion if necessary */ { char dtype, sval[81], msg[81]; int lval; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == '\0') return(*status = VALUE_UNDEFINED); /* null value string */ ffdtyp(cval, &dtype, status); /* determine the datatype */ if (dtype == 'I' || dtype == 'F') ffc2dd(cval, dval, status); else if (dtype == 'L') { ffc2ll(cval, &lval, status); *dval = (double) lval; } else if (dtype == 'C') { /* try reading the string as a number */ ffc2s(cval, sval, status); ffc2dd(sval, dval, status); } else *status = BAD_DOUBLEKEY; if (*status > 0) { *dval = 0.; strcpy(msg,"Error in ffc2d evaluating string as a double: "); strncat(msg,cval,30); ffpmsg(msg); return(*status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2ii(const char *cval, /* I - string representation of the value */ long *ival, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert null-terminated formatted string to an integer value */ { char *loc, msg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); errno = 0; *ival = 0; *ival = strtol(cval, &loc, 10); /* read the string as an integer */ /* check for read error, or junk following the integer */ if (*loc != '\0' && *loc != ' ' ) *status = BAD_C2I; if (errno == ERANGE) { strcpy(msg,"Range Error in ffc2ii converting string to long int: "); strncat(msg,cval,25); ffpmsg(msg); *status = NUM_OVERFLOW; errno = 0; } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2jj(const char *cval, /* I - string representation of the value */ LONGLONG *ival, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert null-terminated formatted string to an long long integer value */ { char *loc, msg[81]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); errno = 0; *ival = 0; #if defined(_MSC_VER) /* Microsoft Visual C++ 6.0 does not have the strtoll function */ *ival = _atoi64(cval); loc = cval; while (*loc == ' ') loc++; /* skip spaces */ if (*loc == '-') loc++; /* skip minus sign */ if (*loc == '+') loc++; /* skip plus sign */ while (isdigit(*loc)) loc++; /* skip digits */ #elif (USE_LL_SUFFIX == 1) *ival = strtoll(cval, &loc, 10); /* read the string as an integer */ #else *ival = strtol(cval, &loc, 10); /* read the string as an integer */ #endif /* check for read error, or junk following the integer */ if (*loc != '\0' && *loc != ' ' ) *status = BAD_C2I; if (errno == ERANGE) { strcpy(msg,"Range Error in ffc2jj converting string to longlong int: "); strncat(msg,cval,25); ffpmsg(msg); *status = NUM_OVERFLOW; errno = 0; } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2ll(const char *cval, /* I - string representation of the value: T or F */ int *lval, /* O - numerical value of the input string: 1 or 0 */ int *status) /* IO - error status */ /* convert null-terminated formatted string to a logical value */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (cval[0] == 'T') *lval = 1; else *lval = 0; /* any character besides T is considered false */ return(*status); } /*--------------------------------------------------------------------------*/ int ffc2s(const char *instr, /* I - null terminated quoted input string */ char *outstr, /* O - null terminated output string without quotes */ int *status) /* IO - error status */ /* convert an input quoted string to an unquoted string by removing the leading and trailing quote character. Also, replace any pairs of single quote characters with just a single quote character (FITS used a pair of single quotes to represent a literal quote character within the string). */ { int jj; size_t len, ii; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (instr[0] != '\'') { if (instr[0] == '\0') { outstr[0] = '\0'; return(*status = VALUE_UNDEFINED); /* null value string */ } else { strcpy(outstr, instr); /* no leading quote, so return input string */ return(*status); } } len = strlen(instr); for (ii=1, jj=0; ii < len; ii++, jj++) { if (instr[ii] == '\'') /* is this the closing quote? */ { if (instr[ii+1] == '\'') /* 2 successive quotes? */ ii++; /* copy only one of the quotes */ else break; /* found the closing quote, so exit this loop */ } outstr[jj] = instr[ii]; /* copy the next character to the output */ } outstr[jj] = '\0'; /* terminate the output string */ if (ii == len) { ffpmsg("This string value has no closing quote (ffc2s):"); ffpmsg(instr); return(*status = 205); } for (jj--; jj >= 0; jj--) /* replace trailing blanks with nulls */ { if (outstr[jj] == ' ') outstr[jj] = 0; else break; } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2rr(const char *cval, /* I - string representation of the value */ float *fval, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert null-terminated formatted string to a float value */ { char *loc, msg[81], tval[73]; struct lconv *lcc = 0; static char decimalpt = 0; short *sptr, iret; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ decimalpt = *(lcc->decimal_point); } errno = 0; *fval = 0.; if (strchr(cval, 'D') || decimalpt == ',') { /* strtod expects a comma, not a period, as the decimal point */ strcpy(tval, cval); /* The C language does not support a 'D'; replace with 'E' */ if (loc = strchr(tval, 'D')) *loc = 'E'; if (decimalpt == ',') { /* strtod expects a comma, not a period, as the decimal point */ if (loc = strchr(tval, '.')) *loc = ','; } *fval = (float) strtod(tval, &loc); /* read the string as an float */ } else { *fval = (float) strtod(cval, &loc); } /* check for read error, or junk following the value */ if (*loc != '\0' && *loc != ' ' ) { strcpy(msg,"Error in ffc2rr converting string to float: "); strncat(msg,cval,30); ffpmsg(msg); *status = BAD_C2F; } sptr = (short *) fval; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif iret = fnan(*sptr); /* if iret == 1, then the float value is a NaN */ if (errno == ERANGE || (iret == 1) ) { strcpy(msg,"Error in ffc2rr converting string to float: "); strncat(msg,cval,30); ffpmsg(msg); *fval = 0.; *status = NUM_OVERFLOW; errno = 0; } return(*status); } /*--------------------------------------------------------------------------*/ int ffc2dd(const char *cval, /* I - string representation of the value */ double *dval, /* O - numerical value of the input string */ int *status) /* IO - error status */ /* convert null-terminated formatted string to a double value */ { char *loc, msg[81], tval[73]; struct lconv *lcc = 0; static char decimalpt = 0; short *sptr, iret; if (*status > 0) /* inherit input status value if > 0 */ return(*status); if (!decimalpt) { /* only do this once for efficiency */ lcc = localeconv(); /* set structure containing local decimal point symbol */ decimalpt = *(lcc->decimal_point); } errno = 0; *dval = 0.; if (strchr(cval, 'D') || decimalpt == ',') { /* need to modify a temporary copy of the string before parsing it */ strcpy(tval, cval); /* The C language does not support a 'D'; replace with 'E' */ if (loc = strchr(tval, 'D')) *loc = 'E'; if (decimalpt == ',') { /* strtod expects a comma, not a period, as the decimal point */ if (loc = strchr(tval, '.')) *loc = ','; } *dval = strtod(tval, &loc); /* read the string as an double */ } else { *dval = strtod(cval, &loc); } /* check for read error, or junk following the value */ if (*loc != '\0' && *loc != ' ' ) { strcpy(msg,"Error in ffc2dd converting string to double: "); strncat(msg,cval,30); ffpmsg(msg); *status = BAD_C2D; } sptr = (short *) dval; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif iret = dnan(*sptr); /* if iret == 1, then the double value is a NaN */ if (errno == ERANGE || (iret == 1) ) { strcpy(msg,"Error in ffc2dd converting string to double: "); strncat(msg,cval,30); ffpmsg(msg); *dval = 0.; *status = NUM_OVERFLOW; errno = 0; } return(*status); } astropy-0.3/cextern/cfitsio/putcolj.c0000644000175000017500000021062312243255342016137 0ustar oleole/* This file, putcolj.c, contains routines that write data elements to */ /* a FITS image or table, with long datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ long *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; long nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TLONG, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpclj(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ long *array, /* I - array of values that are written */ long nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; long nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TLONG, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnj(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2dj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3dj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3dj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TLONG, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpclj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpclj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TLONG, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpclj(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ long *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpclj(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ long *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TLONG && LONGSIZE == 32) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TLONG): if (writeraw) { /* write raw input bytes without conversion */ ffpi4b(fptr, ntodo, incre, (INT32BIT *) &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffi4fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); } break; case (TLONGLONG): fflongfi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffi4fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffi4fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TFLOAT): ffi4fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffi4fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffi4fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclj).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ long *array, /* I - array of values to write */ long nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpclj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood + 1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpclj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpclj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fi1(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fi2(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fi4(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (INT32BIT) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int fflongfi8(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fr4(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fr8(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffi4fstr(long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } /* ======================================================================== */ /* the following routines support the 'long long' data type */ /* ======================================================================== */ /*--------------------------------------------------------------------------*/ int ffpprjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ LONGLONG *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } row=maxvalue(1,group); ffpcljj(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ LONGLONG *array, /* I - array of values that are written */ LONGLONG nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } row=maxvalue(1,group); ffpcnjj(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2djj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3djj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3djj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ LONGLONG *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcljj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcljj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ LONGLONG *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ ffpmsg("writing to compressed image is not supported"); return(*status = DATA_COMPRESSION_ERR); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcljj(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpjj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ LONGLONG *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcljj(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcljj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ LONGLONG *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TLONGLONG) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TLONGLONG): if (writeraw) { /* write raw input bytes without conversion */ ffpi8b(fptr, ntodo, incre, (long *) &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffi8fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); } break; case (TLONG): ffi8fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TBYTE): ffi8fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffi8fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TFLOAT): ffi8fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffi8fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffi8fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclj).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnjj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ LONGLONG *array, /* I - array of values to write */ LONGLONG nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcljj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcljj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcljj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fi1(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fi2(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fi4(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < INT32_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (input[ii] > INT32_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else output[ii] = (INT32BIT) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fi8(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fr4(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fr8(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffi8fstr(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/imcompress.c0000644000175000017500000130510612243255342016642 0ustar oleole# include # include # include # include # include # include # include "fitsio2.h" #define NULL_VALUE -2147483647 /* value used to represent undefined pixels */ #define ZERO_VALUE -2147483646 /* value used to represent zero-valued pixels */ /* nearest integer function */ # define NINT(x) ((x >= 0.) ? (int) (x + 0.5) : (int) (x - 0.5)) /* special quantize level value indicates that floating point image pixels */ /* should not be quantized and instead losslessly compressed (with GZIP) */ #define NO_QUANTIZE 9999 /* string array for storing the individual column compression stats */ char results[999][60]; float trans_ratio[999]; float *fits_rand_value = 0; int imcomp_write_nocompress_tile(fitsfile *outfptr, long row, int datatype, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int *status); int imcomp_convert_tile_tshort(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, double actual_bzero, int *intlength, int *status); int imcomp_convert_tile_tushort(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status); int imcomp_convert_tile_tint(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status); int imcomp_convert_tile_tuint(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status); int imcomp_convert_tile_tbyte(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status); int imcomp_convert_tile_tsbyte(fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status); int imcomp_convert_tile_tfloat(fitsfile *outfptr, long row, void *tiledata, long tilelen, long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero,int *status); int imcomp_convert_tile_tdouble(fitsfile *outfptr, long row, void *tiledata, long tilelen, long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero, int *status); static int unquantize_i1r4(long row, unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int unquantize_i2r4(long row, short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int unquantize_i4r4(long row, INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int unquantize_i1r8(long row, unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int unquantize_i2r8(long row, short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int unquantize_i4r8(long row, INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - which subtractive dither method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status); /* IO - error status */ static int imcomp_float2nan(float *indata, long tilelen, int *outdata, float nullflagval, int *status); static int imcomp_double2nan(double *indata, long tilelen, LONGLONG *outdata, double nullflagval, int *status); static int fits_read_write_compressed_img(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be returned */ LONGLONG *infpixel, /* I - 'bottom left corner' of the subsection */ LONGLONG *inlpixel, /* I - 'top right corner' of the subsection */ long *ininc, /* I - increment to be applied in each dimension */ int nullcheck, /* I - 0 for no null checking */ /* 1: set undefined pixels = nullval */ void *nullval, /* I - value for undefined pixels */ int *anynul, /* O - set to 1 if any values are null; else 0 */ fitsfile *outfptr, /* I - FITS file pointer */ int *status); static int fits_shuffle_8bytes(char *heap, LONGLONG length, int *status); static int fits_shuffle_4bytes(char *heap, LONGLONG length, int *status); static int fits_shuffle_2bytes(char *heap, LONGLONG length, int *status); static int fits_gzip_heap(fitsfile *infptr, fitsfile *outfptr, int *status); static int fits_unshuffle_8bytes(char *heap, LONGLONG length, int *status); static int fits_unshuffle_4bytes(char *heap, LONGLONG length, int *status); static int fits_unshuffle_2bytes(char *heap, LONGLONG length, int *status); static int fits_gunzip_heap(fitsfile *infptr, fitsfile *outfptr, int *status); /* only used for diagnoitic purposes */ /* int fits_get_case(int *c1, int*c2, int*c3); */ /*---------------------------------------------------------------------------*/ int fits_init_randoms(void) { /* initialize an array of random numbers */ int ii; double a = 16807.0; double m = 2147483647.0; double temp, seed; FFLOCK; if (fits_rand_value) { FFUNLOCK; return(0); /* array is already initialized */ } /* allocate array for the random number sequence */ /* THIS MEMORY IS NEVER FREED */ fits_rand_value = calloc(N_RANDOM, sizeof(float)); if (!fits_rand_value) { FFUNLOCK; return(MEMORY_ALLOCATION); } /* We need a portable algorithm that anyone can use to generate this exact same sequence of random number. The C 'rand' function is not suitable because it is not available to Fortran or Java programmers. Instead, use a well known simple algorithm published here: "Random number generators: good ones are hard to find", Communications of the ACM, Volume 31 , Issue 10 (October 1988) Pages: 1192 - 1201 */ /* initialize the random numbers */ seed = 1; for (ii = 0; ii < N_RANDOM; ii++) { temp = a * seed; seed = temp -m * ((int) (temp / m) ); fits_rand_value[ii] = (float) (seed / m); } FFUNLOCK; /* IMPORTANT NOTE: the 10000th seed value must have the value 1043618065 if the algorithm has been implemented correctly */ if ( (int) seed != 1043618065) { ffpmsg("fits_init_randoms generated incorrect random number sequence"); return(1); } else { return(0); } } /*--------------------------------------------------------------------------*/ void bz_internal_error(int errcode) { /* external function declared by the bzip2 code in bzlib_private.h */ ffpmsg("bzip2 returned an internal error"); ffpmsg("This should never happen"); return; } /*--------------------------------------------------------------------------*/ int fits_set_compression_type(fitsfile *fptr, /* I - FITS file pointer */ int ctype, /* image compression type code; */ /* allowed values: RICE_1, GZIP_1, GZIP_2, PLIO_1, */ /* HCOMPRESS_1, BZIP2_1, and NOCOMPRESS */ int *status) /* IO - error status */ { /* This routine specifies the image compression algorithm that should be used when writing a FITS image. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ if (ctype != RICE_1 && ctype != GZIP_1 && ctype != GZIP_2 && ctype != PLIO_1 && ctype != HCOMPRESS_1 && ctype != BZIP2_1 && ctype != NOCOMPRESS) { ffpmsg("unknown compression algorithm (fits_set_compression_type)"); *status = DATA_COMPRESSION_ERR; } else { (fptr->Fptr)->request_compress_type = ctype; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_tile_dim(fitsfile *fptr, /* I - FITS file pointer */ int ndim, /* number of dimensions in the compressed image */ long *dims, /* size of image compression tile in each dimension */ /* default tile size = (NAXIS1, 1, 1, ...) */ int *status) /* IO - error status */ { /* This routine specifies the size (dimension) of the image compression tiles that should be used when writing a FITS image. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ int ii; if (ndim < 0 || ndim > MAX_COMPRESS_DIM) { *status = BAD_DIMEN; ffpmsg("illegal number of tile dimensions (fits_set_tile_dim)"); return(*status); } for (ii = 0; ii < ndim; ii++) { (fptr->Fptr)->request_tilesize[ii] = dims[ii]; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_quantize_level(fitsfile *fptr, /* I - FITS file pointer */ float qlevel, /* floating point quantization level */ int *status) /* IO - error status */ { /* This routine specifies the value of the quantization level, q, that should be used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ if (qlevel == 0.) { /* this means don't quantize the floating point values. Instead, */ /* the floating point values will be losslessly compressed */ (fptr->Fptr)->request_quantize_level = NO_QUANTIZE; } else { (fptr->Fptr)->request_quantize_level = qlevel; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_quantize_method(fitsfile *fptr, /* I - FITS file pointer */ int method, /* quantization method */ int *status) /* IO - error status */ { /* This routine specifies what type of dithering (randomization) should be performed when quantizing floating point images to integer prior to compression. A value of -1 means do no dithering. A value of 0 means use the default SUBTRACTIVE_DITHER_1 (which is equivalent to dither = 1). A value of 2 means use SUBTRACTIVE_DITHER_2. */ if (method < -1 || method > 2) { ffpmsg("illegal dithering value (fits_set_quantize_method)"); *status = DATA_COMPRESSION_ERR; } else { if (method == 0) method = 1; (fptr->Fptr)->request_quantize_method = method; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_quantize_dither(fitsfile *fptr, /* I - FITS file pointer */ int dither, /* dither type */ int *status) /* IO - error status */ { /* the name of this routine has changed. This is kept here only for backwards compatibility for any software that may be calling the old routine. */ fits_set_quantize_method(fptr, dither, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_dither_seed(fitsfile *fptr, /* I - FITS file pointer */ int seed, /* random dithering seed value (1 to 10000) */ int *status) /* IO - error status */ { /* This routine specifies the value of the offset that should be applied when calculating the random dithering when quantizing floating point iamges. A random offset should be applied to each image to avoid quantization effects when taking the difference of 2 images, or co-adding a set of images. Without this random offset, the corresponding pixel in every image will have exactly the same dithering. offset = 0 means use the default random dithering based on system time offset = negative means randomly chose dithering based on 1st tile checksum offset = [1 - 10000] means use that particular dithering pattern */ /* if positive, ensure that the value is in the range 1 to 10000 */ if (seed > 10000) { ffpmsg("illegal dithering seed value (fits_set_dither_seed)"); *status = DATA_COMPRESSION_ERR; } else { (fptr->Fptr)->request_dither_seed = seed; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_dither_offset(fitsfile *fptr, /* I - FITS file pointer */ int offset, /* random dithering offset value (1 to 10000) */ int *status) /* IO - error status */ { /* The name of this routine has changed. This is kept just for backwards compatibility with any software that calls the old name */ fits_set_dither_seed(fptr, offset, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_noise_bits(fitsfile *fptr, /* I - FITS file pointer */ int noisebits, /* noise_bits parameter value */ /* (default = 4) */ int *status) /* IO - error status */ { /* ******************************************************************** ******************************************************************** THIS ROUTINE IS PROVIDED ONLY FOR BACKWARDS COMPATIBILITY; ALL NEW SOFTWARE SHOULD CALL fits_set_quantize_level INSTEAD ******************************************************************** ******************************************************************** This routine specifies the value of the noice_bits parameter that should be used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. Feb 2008: the "noisebits" parameter has been replaced with the more general "quantize level" parameter. */ float qlevel; if (noisebits < 1 || noisebits > 16) { *status = DATA_COMPRESSION_ERR; ffpmsg("illegal number of noise bits (fits_set_noise_bits)"); return(*status); } qlevel = (float) pow (2., (double)noisebits); fits_set_quantize_level(fptr, qlevel, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_hcomp_scale(fitsfile *fptr, /* I - FITS file pointer */ float scale, /* hcompress scale parameter value */ /* (default = 0.) */ int *status) /* IO - error status */ { /* This routine specifies the value of the hcompress scale parameter. */ (fptr->Fptr)->request_hcomp_scale = scale; return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_hcomp_smooth(fitsfile *fptr, /* I - FITS file pointer */ int smooth, /* hcompress smooth parameter value */ /* if scale > 1 and smooth != 0, then */ /* the image will be smoothed when it is */ /* decompressed to remove some of the */ /* 'blockiness' in the image produced */ /* by the lossy compression */ int *status) /* IO - error status */ { /* This routine specifies the value of the hcompress scale parameter. */ (fptr->Fptr)->request_hcomp_smooth = smooth; return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_lossy_int(fitsfile *fptr, /* I - FITS file pointer */ int lossy_int, /* I - True (!= 0) or False (0) */ int *status) /* IO - error status */ { /* This routine specifies whether images with integer pixel values should quantized and compressed the same way float images are compressed. The default is to not do this, and instead apply a lossless compression algorithm to integer images. */ (fptr->Fptr)->request_lossy_int_compress = lossy_int; return(*status); } /*--------------------------------------------------------------------------*/ int fits_set_huge_hdu(fitsfile *fptr, /* I - FITS file pointer */ int huge, /* I - True (!= 0) or False (0) */ int *status) /* IO - error status */ { /* This routine specifies whether the HDU that is being compressed is so large (i.e., > 4 GB) that the 'Q' type variable length array columns should be used rather than the normal 'P' type. The allows the heap pointers to be stored as 64-bit quantities, rather than just 32-bits. */ (fptr->Fptr)->request_huge_hdu = huge; return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_compression_type(fitsfile *fptr, /* I - FITS file pointer */ int *ctype, /* image compression type code; */ /* allowed values: */ /* RICE_1, GZIP_1, GZIP_2, PLIO_1, HCOMPRESS_1, BZIP2_1 */ int *status) /* IO - error status */ { /* This routine returns the image compression algorithm that should be used when writing a FITS image. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ *ctype = (fptr->Fptr)->request_compress_type; if (*ctype != RICE_1 && *ctype != GZIP_1 && *ctype != GZIP_2 && *ctype != PLIO_1 && *ctype != HCOMPRESS_1 && *ctype != BZIP2_1 && *ctype != NOCOMPRESS) { ffpmsg("unknown compression algorithm (fits_get_compression_type)"); *status = DATA_COMPRESSION_ERR; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_tile_dim(fitsfile *fptr, /* I - FITS file pointer */ int ndim, /* number of dimensions in the compressed image */ long *dims, /* size of image compression tile in each dimension */ /* default tile size = (NAXIS1, 1, 1, ...) */ int *status) /* IO - error status */ { /* This routine returns the size (dimension) of the image compression tiles that should be used when writing a FITS image. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ int ii; if (ndim < 0 || ndim > MAX_COMPRESS_DIM) { *status = BAD_DIMEN; ffpmsg("illegal number of tile dimensions (fits_get_tile_dim)"); return(*status); } for (ii = 0; ii < ndim; ii++) { dims[ii] = (fptr->Fptr)->request_tilesize[ii]; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_unset_compression_param( fitsfile *fptr, int *status) { int ii; (fptr->Fptr)->compress_type = 0; (fptr->Fptr)->quantize_level = 0; (fptr->Fptr)->quantize_method = 0; (fptr->Fptr)->dither_seed = 0; (fptr->Fptr)->hcomp_scale = 0; for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { (fptr->Fptr)->tilesize[ii] = 0; } } /*--------------------------------------------------------------------------*/ int fits_unset_compression_request( fitsfile *fptr, int *status) { int ii; (fptr->Fptr)->request_compress_type = 0; (fptr->Fptr)->request_quantize_level = 0; (fptr->Fptr)->request_quantize_method = 0; (fptr->Fptr)->request_dither_seed = 0; (fptr->Fptr)->request_hcomp_scale = 0; (fptr->Fptr)->request_lossy_int_compress = 0; (fptr->Fptr)->request_huge_hdu = 0; for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { (fptr->Fptr)->request_tilesize[ii] = 0; } } /*--------------------------------------------------------------------------*/ int fits_set_compression_pref( fitsfile *infptr, fitsfile *outfptr, int *status) { /* Set the preference for various compression options, based on keywords in the input file that provide guidance about how the HDU should be compressed when written to the output file. */ int ii, naxis, nkeys, comptype, lossyintvalue, hsmooth; int ivalue, tstatus; long tiledim[6]= {1,1,1,1,1,1}; char card[FLEN_CARD], value[FLEN_VALUE]; double qvalue, hscale; LONGLONG datastart, dataend; if (*status > 0) return(*status); /* check the size of the HDU that is to be compressed */ fits_get_hduaddrll(infptr, NULL, &datastart, &dataend, status); if ( (LONGLONG)(dataend - datastart) > UINT32_MAX) { /* use 64-bit '1Q' variable length columns instead of '1P' columns */ /* for large files, in case the heap size becomes larger than 2**32 bytes*/ fits_set_huge_hdu(outfptr, 1, status); } fits_get_hdrspace(infptr, &nkeys, NULL, status); /* look for a image compression directive keywords (begin with 'FZ') */ for (ii = 2; ii <= nkeys; ii++) { fits_read_record(infptr, ii, card, status); if (!strncmp(card, "FZ", 2) ){ /* get the keyword value string */ fits_parse_value(card, value, NULL, status); if (!strncmp(card+2, "ALGOR", 5) ) { /* set the desired compression algorithm */ /* allowed values: RICE_1, GZIP_1, GZIP_2, PLIO_1, */ /* HCOMPRESS_1, BZIP2_1, and NOCOMPRESS */ if (!strncasecmp(value, "'RICE_1", 7) ) { comptype = RICE_1; } else if (!strncasecmp(value, "'GZIP_1", 7) ) { comptype = GZIP_1; } else if (!strncasecmp(value, "'GZIP_2", 7) ) { comptype = GZIP_2; } else if (!strncasecmp(value, "'PLIO_1", 7) ) { comptype = PLIO_1; } else if (!strncasecmp(value, "'HCOMPRESS_1", 12) ) { comptype = HCOMPRESS_1; } else if (!strncasecmp(value, "'NONE", 5) ) { comptype = NOCOMPRESS; } else { ffpmsg("Unknown FZALGOR keyword compression algorithm:"); ffpmsg(value); return(*status = DATA_COMPRESSION_ERR); } fits_set_compression_type (outfptr, comptype, status); } else if (!strncmp(card+2, "TILE ", 6) ) { tstatus = 0; if (!strncasecmp(value, "'row", 4) ) { tiledim[0] = -1; } else if (!strncasecmp(value, "'whole", 6) ) { tiledim[0] = -1; tiledim[1] = -1; tiledim[2] = -1; } else { ffdtdm(infptr, value, 0,6, &naxis, tiledim, status); } /* set the desired tile size */ fits_set_tile_dim (outfptr, 6, tiledim, status); } else if (!strncmp(card+2, "QVALUE", 6) ) { /* set the desired Q quantization value */ qvalue = atof(value); fits_set_quantize_level (outfptr, (float) qvalue, status); } else if (!strncmp(card+2, "QMETHD", 6) ) { if (!strncasecmp(value, "'no_dither", 10) ) { ivalue = -1; /* just quantize, with no dithering */ } else if (!strncasecmp(value, "'subtractive_dither_1", 21) ) { ivalue = SUBTRACTIVE_DITHER_1; /* use subtractive dithering */ } else if (!strncasecmp(value, "'subtractive_dither_2", 21) ) { ivalue = SUBTRACTIVE_DITHER_2; /* dither, except preserve zero-valued pixels */ } else { ffpmsg("Unknown value for FZQUANT keyword: (set_compression_pref)"); ffpmsg(value); return(*status = DATA_COMPRESSION_ERR); } fits_set_quantize_method(outfptr, ivalue, status); } else if (!strncmp(card+2, "DTHRSD", 6) ) { if (!strncasecmp(value, "'checksum", 9) ) { ivalue = -1; /* use checksum of first tile */ } else if (!strncasecmp(value, "'clock", 6) ) { ivalue = 0; /* set dithering seed based on system clock */ } else { /* read integer value */ if (*value == '\'') ivalue = (int) atol(value+1); /* allow for leading quote character */ else ivalue = (int) atol(value+1); if (ivalue < 1 || ivalue > 10000) { ffpmsg("Invalid value for FZDTHRSD keyword: (set_compression_pref)"); ffpmsg(value); return(*status = DATA_COMPRESSION_ERR); } } /* set the desired dithering */ fits_set_dither_seed(outfptr, ivalue, status); } else if (!strncmp(card+2, "INT2F", 5) ) { /* set whether to convert integers to float then use lossy compression */ if (!strcasecmp(value, "t") ) { fits_set_lossy_int (outfptr, 1, status); } else if (!strcasecmp(value, "f") ) { fits_set_lossy_int (outfptr, 0, status); } else { ffpmsg("Unknown value for FZINT2F keyword: (set_compression_pref)"); ffpmsg(value); return(*status = DATA_COMPRESSION_ERR); } } else if (!strncmp(card+2, "HSCALE ", 6) ) { /* set the desired Hcompress scale value */ hscale = atof(value); fits_set_hcomp_scale (outfptr, hscale, status); } } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_noise_bits(fitsfile *fptr, /* I - FITS file pointer */ int *noisebits, /* noise_bits parameter value */ /* (default = 4) */ int *status) /* IO - error status */ { /* ******************************************************************** ******************************************************************** THIS ROUTINE IS PROVIDED ONLY FOR BACKWARDS COMPATIBILITY; ALL NEW SOFTWARE SHOULD CALL fits_set_quantize_level INSTEAD ******************************************************************** ******************************************************************** This routine returns the value of the noice_bits parameter that should be used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. Feb 2008: code changed to use the more general "quantize level" parameter rather than the "noise bits" parameter. If quantize level is greater than zero, then the previous noisebits parameter is approximately given by noise bits = natural logarithm (quantize level) / natural log (2) This result is rounded to the nearest integer. */ double qlevel; qlevel = (fptr->Fptr)->request_quantize_level; if (qlevel > 0. && qlevel < 65537. ) *noisebits = (int) ((log(qlevel) / log(2.0)) + 0.5); else *noisebits = 0; return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_quantize_level(fitsfile *fptr, /* I - FITS file pointer */ float *qlevel, /* quantize level parameter value */ int *status) /* IO - error status */ { /* This routine returns the value of the noice_bits parameter that should be used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ if ((fptr->Fptr)->request_quantize_level == NO_QUANTIZE) { *qlevel = 0; } else { *qlevel = (fptr->Fptr)->request_quantize_level; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_dither_seed(fitsfile *fptr, /* I - FITS file pointer */ int *offset, /* dithering offset parameter value */ int *status) /* IO - error status */ { /* This routine returns the value of the dithering offset parameter that is used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ *offset = (fptr->Fptr)->request_dither_seed; return(*status); }/*--------------------------------------------------------------------------*/ int fits_get_hcomp_scale(fitsfile *fptr, /* I - FITS file pointer */ float *scale, /* Hcompress scale parameter value */ int *status) /* IO - error status */ { /* This routine returns the value of the noice_bits parameter that should be used when compressing floating point images. The image is divided into tiles, and each tile is compressed and stored in a row of at variable length binary table column. */ *scale = (fptr->Fptr)->request_hcomp_scale; return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_hcomp_smooth(fitsfile *fptr, /* I - FITS file pointer */ int *smooth, /* Hcompress smooth parameter value */ int *status) /* IO - error status */ { *smooth = (fptr->Fptr)->request_hcomp_smooth; return(*status); } /*--------------------------------------------------------------------------*/ int fits_img_compress(fitsfile *infptr, /* pointer to image to be compressed */ fitsfile *outfptr, /* empty HDU for output compressed image */ int *status) /* IO - error status */ /* This routine initializes the output table, copies all the keywords, and loops through the input image, compressing the data and writing the compressed tiles to the output table. This is a high level routine that is called by the fpack and funpack FITS compression utilities. */ { int bitpix, naxis; long naxes[MAX_COMPRESS_DIM]; /* int c1, c2, c3; */ if (*status > 0) return(*status); /* get datatype and size of input image */ if (fits_get_img_param(infptr, MAX_COMPRESS_DIM, &bitpix, &naxis, naxes, status) > 0) return(*status); if (naxis < 1 || naxis > MAX_COMPRESS_DIM) { ffpmsg("Image cannot be compressed: NAXIS out of range"); return(*status = BAD_NAXIS); } /* create a new empty HDU in the output file now, before setting the */ /* compression preferences. This HDU will become a binary table that */ /* contains the compressed image. If necessary, create a dummy primary */ /* array, which much precede the binary table extension. */ ffcrhd(outfptr, status); /* this does nothing if the output file is empty */ if ((outfptr->Fptr)->curhdu == 0) /* have to create dummy primary array */ { ffcrim(outfptr, 16, 0, NULL, status); ffcrhd(outfptr, status); } else { /* unset any compress parameter preferences that may have been set when closing the previous HDU in the output file */ fits_unset_compression_param(outfptr, status); } /* set any compress parameter preferences as given in the input file */ fits_set_compression_pref(infptr, outfptr, status); /* special case: the quantization level is not given by a keyword in */ /* the HDU header, so we have to explicitly copy the requested value */ /* to the actual value */ if ( (outfptr->Fptr)->request_quantize_level != 0.) (outfptr->Fptr)->quantize_level = (outfptr->Fptr)->request_quantize_level; /* if requested, treat integer images same as a float image. */ /* Then the pixels will be quantized (lossy algorithm) to achieve */ /* higher amounts of compression than with lossless algorithms */ if ( (outfptr->Fptr)->request_lossy_int_compress != 0 && bitpix > 0) bitpix = FLOAT_IMG; /* compress integer images as if float */ /* initialize output table */ if (imcomp_init_table(outfptr, bitpix, naxis, naxes, 0, status) > 0) return (*status); /* Copy the image header keywords to the table header. */ if (imcomp_copy_img2comp(infptr, outfptr, status) > 0) return (*status); /* turn off any intensity scaling (defined by BSCALE and BZERO */ /* keywords) so that unscaled values will be read by CFITSIO */ /* (except if quantizing an int image, same as a float image) */ if ( (outfptr->Fptr)->request_lossy_int_compress == 0 && bitpix > 0) ffpscl(infptr, 1.0, 0.0, status); /* force a rescan of the output file keywords, so that */ /* the compression parameters will be copied to the internal */ /* fitsfile structure used by CFITSIO */ ffrdef(outfptr, status); /* turn off any intensity scaling (defined by BSCALE and BZERO */ /* keywords) so that unscaled values will be written by CFITSIO */ /* (except if quantizing an int image, same as a float image) */ if ( (outfptr->Fptr)->request_lossy_int_compress == 0 && bitpix > 0) ffpscl(outfptr, 1.0, 0.0, status); /* Read each image tile, compress, and write to a table row. */ imcomp_compress_image (infptr, outfptr, status); /* force another rescan of the output file keywords, to */ /* update PCOUNT and TFORMn = '1PB(iii)' keyword values. */ ffrdef(outfptr, status); /* unset any previously set compress parameter preferences */ fits_unset_compression_request(outfptr, status); /* fits_get_case(&c1, &c2, &c3); printf("c1, c2, c3 = %d, %d, %d\n", c1, c2, c3); */ return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_init_table(fitsfile *outfptr, int inbitpix, int naxis, long *naxes, int writebitpix, /* write the ZBITPIX, ZNAXIS, and ZNAXES keyword? */ int *status) /* create a BINTABLE extension for the output compressed image. */ { char keyname[FLEN_KEYWORD], zcmptype[12]; int ii, remain, ncols, bitpix; long nrows; char *ttype[] = {"COMPRESSED_DATA", "ZSCALE", "ZZERO"}; char *tform[3]; char tf0[4], tf1[4], tf2[4]; char *tunit[] = {"\0", "\0", "\0" }; char comm[FLEN_COMMENT]; long actual_tilesize[MAX_COMPRESS_DIM]; /* Actual size to use for tiles */ if (*status > 0) return(*status); /* check for special case of losslessly compressing floating point */ /* images. Only compression algorithm that supports this is GZIP */ if ( (outfptr->Fptr)->request_quantize_level == NO_QUANTIZE) { if (((outfptr->Fptr)->request_compress_type != GZIP_1) && ((outfptr->Fptr)->request_compress_type != GZIP_2)) { ffpmsg("Lossless compression of floating point images must use GZIP (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } } /* set default compression parameter values, if undefined */ if ( (outfptr->Fptr)->request_compress_type == 0) { /* use RICE_1 by default */ (outfptr->Fptr)->request_compress_type = RICE_1; } if (inbitpix < 0 && (outfptr->Fptr)->request_quantize_level != NO_QUANTIZE) { /* set defaults for quantizing floating point images */ if ( (outfptr->Fptr)->request_quantize_method == 0) { /* set default dithering method */ (outfptr->Fptr)->request_quantize_method = SUBTRACTIVE_DITHER_1; } if ( (outfptr->Fptr)->request_quantize_level == 0) { if ((outfptr->Fptr)->request_quantize_method == NO_DITHER) { /* must use finer quantization if no dithering is done */ (outfptr->Fptr)->request_quantize_level = 16; } else { (outfptr->Fptr)->request_quantize_level = 4; } } } /* test for the 2 special cases that represent unsigned integers */ if (inbitpix == USHORT_IMG) bitpix = SHORT_IMG; else if (inbitpix == ULONG_IMG) bitpix = LONG_IMG; else if (inbitpix == SBYTE_IMG) bitpix = BYTE_IMG; else bitpix = inbitpix; /* reset default tile dimensions too if required */ memcpy(actual_tilesize, outfptr->Fptr->request_tilesize, MAX_COMPRESS_DIM * sizeof(long)); if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1) { if (naxis < 2 ) { ffpmsg("Hcompress cannot be used with 1-dimensional images (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } else if (naxes[0] < 4 || naxes[1] < 4) { ffpmsg("Hcompress minimum image dimension is 4 pixels (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } if ((actual_tilesize[0] <= 0) && (actual_tilesize[1] == -1) ){ /* compress the whole image as a single tile */ actual_tilesize[0] = naxes[0]; actual_tilesize[1] = naxes[1]; for (ii = 2; ii < naxis; ii++) { /* set all higher tile dimensions = 1 */ actual_tilesize[ii] = 1; } } else if ((actual_tilesize[0] <= 0) && (actual_tilesize[1] == 0 || actual_tilesize[1] == 1) ){ /* The Hcompress algorithm is inherently 2D in nature, so the row by row tiling that is used for other compression algorithms is not appropriate. If the image has less than 30 rows, then the entire image will be compressed as a single tile. Otherwise the tiles will consist of 16 rows of the image. This keeps the tiles to a reasonable size, and it also includes enough rows to allow good compression efficiency. If the last tile of the image happens to contain less than 4 rows, then find another tile size with between 14 and 30 rows (preferably even), so that the last tile has at least 4 rows */ /* 1st tile dimension is the row length of the image */ actual_tilesize[0] = naxes[0]; if (naxes[1] <= 30) { /* use whole image if it is small */ actual_tilesize[1] = naxes[1]; } else { /* look for another good tile dimension */ if (naxes[1] % 16 == 0 || naxes[1] % 16 > 3) { actual_tilesize[1] = 16; } else if (naxes[1] % 24 == 0 || naxes[1] % 24 > 3) { actual_tilesize[1] = 24; } else if (naxes[1] % 20 == 0 || naxes[1] % 20 > 3) { actual_tilesize[1] = 20; } else if (naxes[1] % 30 == 0 || naxes[1] % 30 > 3) { actual_tilesize[1] = 30; } else if (naxes[1] % 28 == 0 || naxes[1] % 28 > 3) { actual_tilesize[1] = 28; } else if (naxes[1] % 26 == 0 || naxes[1] % 26 > 3) { actual_tilesize[1] = 26; } else if (naxes[1] % 22 == 0 || naxes[1] % 22 > 3) { actual_tilesize[1] = 22; } else if (naxes[1] % 18 == 0 || naxes[1] % 18 > 3) { actual_tilesize[1] = 18; } else if (naxes[1] % 14 == 0 || naxes[1] % 14 > 3) { actual_tilesize[1] = 14; } else { actual_tilesize[1] = 17; } } } else if (actual_tilesize[0] < 4 || actual_tilesize[1] < 4) { /* user-specified tile size is too small */ ffpmsg("Hcompress minimum tile dimension is 4 pixels (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } /* check if requested tile size causes the last tile to to have less than 4 pixels */ remain = naxes[0] % (actual_tilesize[0]); /* 1st dimension */ if (remain > 0 && remain < 4) { (actual_tilesize[0])++; /* try increasing tile size by 1 */ remain = naxes[0] % (actual_tilesize[0]); if (remain > 0 && remain < 4) { ffpmsg("Last tile along 1st dimension has less than 4 pixels (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } } remain = naxes[1] % (actual_tilesize[1]); /* 2nd dimension */ if (remain > 0 && remain < 4) { (actual_tilesize[1])++; /* try increasing tile size by 1 */ remain = naxes[1] % (actual_tilesize[1]); if (remain > 0 && remain < 4) { ffpmsg("Last tile along 2nd dimension has less than 4 pixels (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } } } /* end, if HCOMPRESS_1 */ for (ii = 0; ii < naxis; ii++) { if (ii == 0) { /* first axis is different */ if (actual_tilesize[ii] <= 0) { actual_tilesize[ii] = naxes[ii]; } } else { if (actual_tilesize[ii] < 0) { actual_tilesize[ii] = naxes[ii]; /* negative value maean use whole length */ } else if (actual_tilesize[ii] == 0) { actual_tilesize[ii] = 1; /* zero value means use default value = 1 */ } } } /* ---- set up array of TFORM strings -------------------------------*/ if ( (outfptr->Fptr)->request_huge_hdu != 0) { strcpy(tf0, "1QB"); } else { strcpy(tf0, "1PB"); } strcpy(tf1, "1D"); strcpy(tf2, "1D"); tform[0] = tf0; tform[1] = tf1; tform[2] = tf2; /* calculate number of rows in output table */ nrows = 1; for (ii = 0; ii < naxis; ii++) { nrows = nrows * ((naxes[ii] - 1)/ (actual_tilesize[ii]) + 1); } /* determine the default number of columns in the output table */ if (bitpix < 0 && (outfptr->Fptr)->request_quantize_level != NO_QUANTIZE) ncols = 3; /* quantized and scaled floating point image */ else ncols = 1; /* default table has just one 'COMPRESSED_DATA' column */ if ((outfptr->Fptr)->request_compress_type == RICE_1) { strcpy(zcmptype, "RICE_1"); } else if ((outfptr->Fptr)->request_compress_type == GZIP_1) { strcpy(zcmptype, "GZIP_1"); } else if ((outfptr->Fptr)->request_compress_type == GZIP_2) { strcpy(zcmptype, "GZIP_2"); } else if ((outfptr->Fptr)->request_compress_type == BZIP2_1) { strcpy(zcmptype, "BZIP2_1"); } else if ((outfptr->Fptr)->request_compress_type == PLIO_1) { strcpy(zcmptype, "PLIO_1"); /* the PLIO compression algorithm outputs short integers, not bytes */ if ( (outfptr->Fptr)->request_huge_hdu != 0) { strcpy(tform[0], "1QI"); } else { strcpy(tform[0], "1PI"); } } else if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1) { strcpy(zcmptype, "HCOMPRESS_1"); } else if ((outfptr->Fptr)->request_compress_type == NOCOMPRESS) { strcpy(zcmptype, "NOCOMPRESS"); } else { ffpmsg("unknown compression type (imcomp_init_table)"); return(*status = DATA_COMPRESSION_ERR); } /* create the bintable extension to contain the compressed image */ ffcrtb(outfptr, BINARY_TBL, nrows, ncols, ttype, tform, tunit, 0, status); /* Add standard header keywords. */ ffpkyl (outfptr, "ZIMAGE", 1, "extension contains compressed image", status); if (writebitpix) { /* write the keywords defining the datatype and dimensions of */ /* the uncompressed image. If not, these keywords will be */ /* copied later from the input uncompressed image */ ffpkyj (outfptr, "ZBITPIX", bitpix, "data type of original image", status); ffpkyj (outfptr, "ZNAXIS", naxis, "dimension of original image", status); for (ii = 0; ii < naxis; ii++) { sprintf (keyname, "ZNAXIS%d", ii+1); ffpkyj (outfptr, keyname, naxes[ii], "length of original image axis", status); } } for (ii = 0; ii < naxis; ii++) { sprintf (keyname, "ZTILE%d", ii+1); ffpkyj (outfptr, keyname, actual_tilesize[ii], "size of tiles to be compressed", status); } if (bitpix < 0) { if ((outfptr->Fptr)->request_quantize_level == NO_QUANTIZE) { ffpkys(outfptr, "ZQUANTIZ", "NONE", "Lossless compression without quantization", status); } else { /* Unless dithering has been specifically turned off by setting */ /* request_quantize_method = -1, use dithering by default */ /* when quantizing floating point images. */ if ( (outfptr->Fptr)->request_quantize_method == 0) (outfptr->Fptr)->request_quantize_method = SUBTRACTIVE_DITHER_1; if ((outfptr->Fptr)->request_quantize_method == SUBTRACTIVE_DITHER_1) { ffpkys(outfptr, "ZQUANTIZ", "SUBTRACTIVE_DITHER_1", "Pixel Quantization Algorithm", status); /* also write the associated ZDITHER0 keyword with a default value */ /* which may get updated later. */ ffpky(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->request_dither_seed), "dithering offset when quantizing floats", status); } else if ((outfptr->Fptr)->request_quantize_method == SUBTRACTIVE_DITHER_2) { ffpkys(outfptr, "ZQUANTIZ", "SUBTRACTIVE_DITHER_2", "Pixel Quantization Algorithm", status); /* also write the associated ZDITHER0 keyword with a default value */ /* which may get updated later. */ ffpky(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->request_dither_seed), "dithering offset when quantizing floats", status); if (!strcmp(zcmptype, "RICE_1")) { /* when using this new dithering method, change the compression type */ /* to an alias, so that old versions of funpack will not be able to */ /* created a corrupted uncompressed image. */ /* ******* can remove this cludge after about June 2015, after most old versions of fpack are gone */ strcpy(zcmptype, "RICE_ONE"); } } else if ((outfptr->Fptr)->request_quantize_method == NO_DITHER) { ffpkys(outfptr, "ZQUANTIZ", "NO_DITHER", "No dithering during quantization", status); } } } ffpkys (outfptr, "ZCMPTYPE", zcmptype, "compression algorithm", status); /* write any algorithm-specific keywords */ if ((outfptr->Fptr)->request_compress_type == RICE_1) { ffpkys (outfptr, "ZNAME1", "BLOCKSIZE", "compression block size", status); /* for now at least, the block size is always 32 */ ffpkyj (outfptr, "ZVAL1", 32, "pixels per block", status); ffpkys (outfptr, "ZNAME2", "BYTEPIX", "bytes per pixel (1, 2, 4, or 8)", status); if (bitpix == BYTE_IMG) ffpkyj (outfptr, "ZVAL2", 1, "bytes per pixel (1, 2, 4, or 8)", status); else if (bitpix == SHORT_IMG) ffpkyj (outfptr, "ZVAL2", 2, "bytes per pixel (1, 2, 4, or 8)", status); else ffpkyj (outfptr, "ZVAL2", 4, "bytes per pixel (1, 2, 4, or 8)", status); } else if ((outfptr->Fptr)->request_compress_type == HCOMPRESS_1) { ffpkys (outfptr, "ZNAME1", "SCALE", "HCOMPRESS scale factor", status); ffpkye (outfptr, "ZVAL1", (outfptr->Fptr)->request_hcomp_scale, 7, "HCOMPRESS scale factor", status); ffpkys (outfptr, "ZNAME2", "SMOOTH", "HCOMPRESS smooth option", status); ffpkyj (outfptr, "ZVAL2", (long) (outfptr->Fptr)->request_hcomp_smooth, "HCOMPRESS smooth option", status); } /* Write the BSCALE and BZERO keywords, if an unsigned integer image */ if (inbitpix == USHORT_IMG) { strcpy(comm, "offset data range to that of unsigned short"); ffpkyg(outfptr, "BZERO", 32768., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(outfptr, "BSCALE", 1.0, 0, comm, status); } else if (inbitpix == SBYTE_IMG) { strcpy(comm, "offset data range to that of signed byte"); ffpkyg(outfptr, "BZERO", -128., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(outfptr, "BSCALE", 1.0, 0, comm, status); } else if (inbitpix == ULONG_IMG) { strcpy(comm, "offset data range to that of unsigned long"); ffpkyg(outfptr, "BZERO", 2147483648., 0, comm, status); strcpy(comm, "default scaling factor"); ffpkyg(outfptr, "BSCALE", 1.0, 0, comm, status); } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize) /* This function returns the maximum number of bytes in a compressed image line. nx = maximum number of pixels in a tile blocksize is only relevant for RICE compression */ { if (comptype == RICE_1) { if (zbitpix == 16) return (sizeof(short) * nx + nx / blocksize + 2 + 4); else return (sizeof(float) * nx + nx / blocksize + 2 + 4); } else if ((comptype == GZIP_1) || (comptype == GZIP_2)) { /* gzip usually compressed by at least a factor of 2 for I*4 images */ /* and somewhat less for I*2 images */ /* If this size turns out to be too small, then the gzip */ /* compression routine will allocate more space as required */ /* to be on the safe size, allocate buffer same size as input */ if (zbitpix == 16) return(nx * 2); else if (zbitpix == 8) return(nx); else return(nx * 4); } else if (comptype == BZIP2_1) { /* To guarantee that the compressed data will fit, allocate an output buffer of size 1% larger than the uncompressed data, plus 600 bytes */ return((int) (nx * 1.01 * zbitpix / 8. + 601.)); } else if (comptype == HCOMPRESS_1) { /* Imperical evidence suggests in the worst case, the compressed stream could be up to 10% larger than the original image. Add 26 byte overhead, only significant for very small tiles Possible improvement: may need to allow a larger size for 32-bit images */ if (zbitpix == 16 || zbitpix == 8) return( (int) (nx * 2.2 + 26)); /* will be compressing 16-bit int array */ else return( (int) (nx * 4.4 + 26)); /* will be compressing 32-bit int array */ } else return(nx * sizeof(int)); } /*--------------------------------------------------------------------------*/ int imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr, int *status) /* This routine does the following: - reads an image one tile at a time - if it is a float or double image, then it tries to quantize the pixels into scaled integers. - it then compressess the integer pixels, or if the it was not possible to quantize the floating point pixels, then it losslessly compresses them with gzip - writes the compressed byte stream to the output FITS file */ { double *tiledata; int anynul, gotnulls = 0, datatype; long ii, row; int naxis; double dummy = 0., dblnull = DOUBLENULLVALUE; float fltnull = FLOATNULLVALUE; long maxtilelen, tilelen, incre[] = {1, 1, 1, 1, 1, 1}; long naxes[MAX_COMPRESS_DIM], fpixel[MAX_COMPRESS_DIM]; long lpixel[MAX_COMPRESS_DIM], tile[MAX_COMPRESS_DIM]; long tilesize[MAX_COMPRESS_DIM]; long i0, i1, i2, i3, i4, i5; char card[FLEN_CARD]; if (*status > 0) return(*status); maxtilelen = (outfptr->Fptr)->maxtilelen; /* Allocate buffer to hold 1 tile of data; size depends on which compression algorithm is used: Rice and GZIP will compress byte, short, or int arrays without conversion. PLIO requires 4-byte int values, so byte and short arrays must be converted to int. HCompress internally converts byte or short values to ints, and converts int values to 8-byte longlong integers. */ if ((outfptr->Fptr)->zbitpix == FLOAT_IMG) { datatype = TFLOAT; if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1) { /* need twice as much scratch space (8 bytes per pixel) */ tiledata = (double*) malloc (maxtilelen * 2 *sizeof (float)); } else { tiledata = (double*) malloc (maxtilelen * sizeof (float)); } } else if ((outfptr->Fptr)->zbitpix == DOUBLE_IMG) { datatype = TDOUBLE; tiledata = (double*) malloc (maxtilelen * sizeof (double)); } else if ((outfptr->Fptr)->zbitpix == SHORT_IMG) { datatype = TSHORT; if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 || (outfptr->Fptr)->compress_type == NOCOMPRESS) { /* only need buffer of I*2 pixels for gzip, bzip2, and Rice */ tiledata = (double*) malloc (maxtilelen * sizeof (short)); } else { /* need buffer of I*4 pixels for Hcompress and PLIO */ tiledata = (double*) malloc (maxtilelen * sizeof (int)); } } else if ((outfptr->Fptr)->zbitpix == BYTE_IMG) { datatype = TBYTE; if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == BZIP2_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2) { /* only need buffer of I*1 pixels for gzip, bzip2, and Rice */ tiledata = (double*) malloc (maxtilelen); } else { /* need buffer of I*4 pixels for Hcompress and PLIO */ tiledata = (double*) malloc (maxtilelen * sizeof (int)); } } else if ((outfptr->Fptr)->zbitpix == LONG_IMG) { datatype = TINT; if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1) { /* need twice as much scratch space (8 bytes per pixel) */ tiledata = (double*) malloc (maxtilelen * 2 * sizeof (int)); } else { /* only need buffer of I*4 pixels for gzip, bzip2, Rice, and PLIO */ tiledata = (double*) malloc (maxtilelen * sizeof (int)); } } else { ffpmsg("Bad image datatype. (imcomp_compress_image)"); return (*status = MEMORY_ALLOCATION); } if (tiledata == NULL) { ffpmsg("Out of memory. (imcomp_compress_image)"); return (*status = MEMORY_ALLOCATION); } /* calculate size of tile in each dimension */ naxis = (outfptr->Fptr)->zndim; for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { if (ii < naxis) { naxes[ii] = (outfptr->Fptr)->znaxis[ii]; tilesize[ii] = (outfptr->Fptr)->tilesize[ii]; } else { naxes[ii] = 1; tilesize[ii] = 1; } } row = 1; /* set up big loop over up to 6 dimensions */ for (i5 = 1; i5 <= naxes[5]; i5 += tilesize[5]) { fpixel[5] = i5; lpixel[5] = minvalue(i5 + tilesize[5] - 1, naxes[5]); tile[5] = lpixel[5] - fpixel[5] + 1; for (i4 = 1; i4 <= naxes[4]; i4 += tilesize[4]) { fpixel[4] = i4; lpixel[4] = minvalue(i4 + tilesize[4] - 1, naxes[4]); tile[4] = lpixel[4] - fpixel[4] + 1; for (i3 = 1; i3 <= naxes[3]; i3 += tilesize[3]) { fpixel[3] = i3; lpixel[3] = minvalue(i3 + tilesize[3] - 1, naxes[3]); tile[3] = lpixel[3] - fpixel[3] + 1; for (i2 = 1; i2 <= naxes[2]; i2 += tilesize[2]) { fpixel[2] = i2; lpixel[2] = minvalue(i2 + tilesize[2] - 1, naxes[2]); tile[2] = lpixel[2] - fpixel[2] + 1; for (i1 = 1; i1 <= naxes[1]; i1 += tilesize[1]) { fpixel[1] = i1; lpixel[1] = minvalue(i1 + tilesize[1] - 1, naxes[1]); tile[1] = lpixel[1] - fpixel[1] + 1; for (i0 = 1; i0 <= naxes[0]; i0 += tilesize[0]) { fpixel[0] = i0; lpixel[0] = minvalue(i0 + tilesize[0] - 1, naxes[0]); tile[0] = lpixel[0] - fpixel[0] + 1; /* number of pixels in this tile */ tilelen = tile[0]; for (ii = 1; ii < naxis; ii++) { tilelen *= tile[ii]; } /* read next tile of data from image */ anynul = 0; if (datatype == TFLOAT) { ffgsve(infptr, 1, naxis, naxes, fpixel, lpixel, incre, FLOATNULLVALUE, (float *) tiledata, &anynul, status); } else if (datatype == TDOUBLE) { ffgsvd(infptr, 1, naxis, naxes, fpixel, lpixel, incre, DOUBLENULLVALUE, tiledata, &anynul, status); } else if (datatype == TINT) { ffgsvk(infptr, 1, naxis, naxes, fpixel, lpixel, incre, 0, (int *) tiledata, &anynul, status); } else if (datatype == TSHORT) { ffgsvi(infptr, 1, naxis, naxes, fpixel, lpixel, incre, 0, (short *) tiledata, &anynul, status); } else if (datatype == TBYTE) { ffgsvb(infptr, 1, naxis, naxes, fpixel, lpixel, incre, 0, (unsigned char *) tiledata, &anynul, status); } else { ffpmsg("Error bad datatype of image tile to compress"); free(tiledata); return (*status); } /* now compress the tile, and write to row of binary table */ /* NOTE: we don't have to worry about the presence of null values in the array if it is an integer array: the null value is simply encoded in the compressed array just like any other pixel value. If it is a floating point array, then we need to check for null only if the anynul parameter returned a true value when reading the tile */ if (anynul && datatype == TFLOAT) { imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen, tile[0], tile[1], 1, &fltnull, status); } else if (anynul && datatype == TDOUBLE) { imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen, tile[0], tile[1], 1, &dblnull, status); } else { imcomp_compress_tile(outfptr, row, datatype, tiledata, tilelen, tile[0], tile[1], 0, &dummy, status); } /* set flag if we found any null values */ if (anynul) gotnulls = 1; /* check for any error in the previous operations */ if (*status > 0) { ffpmsg("Error writing compressed image to table"); free(tiledata); return (*status); } row++; } } } } } } free (tiledata); /* finished with this buffer */ /* insert ZBLANK keyword if necessary; only for TFLOAT or TDOUBLE images */ if (gotnulls) { ffgcrd(outfptr, "ZCMPTYPE", card, status); ffikyj(outfptr, "ZBLANK", COMPRESS_NULL_VALUE, "null value in the compressed integer array", status); } return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_compress_tile (fitsfile *outfptr, long row, /* tile number = row in the binary table that holds the compressed data */ int datatype, void *tiledata, long tilelen, long tilenx, long tileny, int nullcheck, void *nullflagval, int *status) /* This is the main compression routine. This routine does the following to the input tile of pixels: - if it is a float or double image, then it quantizes the pixels - compresses the integer pixel values - writes the compressed byte stream to the FITS file. If the tile cannot be quantized than the raw float or double values are losslessly compressed with gzip and then written to the output table. This input array may be modified by this routine. If the array is of type TINT or TFLOAT, and the compression type is HCOMPRESS, then it must have been allocated to be twice as large (8 bytes per pixel) to provide scratch space. Note that this routine does not fully support the implicit datatype conversion that is supported when writing to normal FITS images. The datatype of the input array must have the same datatype (either signed or unsigned) as the output (compressed) FITS image in some cases. */ { int *idata; /* quantized integer data */ int cn_zblank, zbitpix, nullval; int flag = 1; /* true by default; only = 0 if float data couldn't be quantized */ int intlength; /* size of integers to be compressed */ double scale, zero, actual_bzero; long ii; size_t clen; /* size of cbuf */ short *cbuf; /* compressed data */ int nelem = 0; /* number of bytes */ int tilecol; size_t gzip_nelem = 0; unsigned int bzlen; int ihcompscale; float hcompscale; double noise2, noise3, noise5; double bscale[1] = {1.}, bzero[1] = {0.}; /* scaling parameters */ long hcomp_len; LONGLONG *lldata; if (*status > 0) return(*status); /* check for special case of losslessly compressing floating point */ /* images. Only compression algorithm that supports this is GZIP */ if ( (outfptr->Fptr)->quantize_level == NO_QUANTIZE) { if (((outfptr->Fptr)->compress_type != GZIP_1) && ((outfptr->Fptr)->compress_type != GZIP_2)) { ffpmsg("Lossless compression of floating point images must use GZIP (imcomp_compress_tile)"); return(*status = DATA_COMPRESSION_ERR); } } /* free the previously saved tile if the input tile is for the same row */ if ((outfptr->Fptr)->tilerow) { /* has the tile cache been allocated? */ /* calculate the column bin of the compressed tile */ tilecol = (row - 1) % ((long)(((outfptr->Fptr)->znaxis[0] - 1) / ((outfptr->Fptr)->tilesize[0])) + 1); if ((outfptr->Fptr)->tilerow[tilecol] == row) { if (((outfptr->Fptr)->tiledata)[tilecol]) { free(((outfptr->Fptr)->tiledata)[tilecol]); } if (((outfptr->Fptr)->tilenullarray)[tilecol]) { free(((outfptr->Fptr)->tilenullarray)[tilecol]); } ((outfptr->Fptr)->tiledata)[tilecol] = 0; ((outfptr->Fptr)->tilenullarray)[tilecol] = 0; (outfptr->Fptr)->tilerow[tilecol] = 0; (outfptr->Fptr)->tiledatasize[tilecol] = 0; (outfptr->Fptr)->tiletype[tilecol] = 0; (outfptr->Fptr)->tileanynull[tilecol] = 0; } } if ( (outfptr->Fptr)->compress_type == NOCOMPRESS) { /* Special case when using NOCOMPRESS for diagnostic purposes in fpack */ if (imcomp_write_nocompress_tile(outfptr, row, datatype, tiledata, tilelen, nullcheck, nullflagval, status) > 0) { return(*status); } return(*status); } /* =========================================================================== */ /* initialize various parameters */ idata = (int *) tiledata; /* may overwrite the input tiledata in place */ /* zbitpix is the BITPIX keyword value in the uncompressed FITS image */ zbitpix = (outfptr->Fptr)->zbitpix; /* if the tile/image has an integer datatype, see if a null value has */ /* been defined (with the BLANK keyword in a normal FITS image). */ /* If so, and if the input tile array also contains null pixels, */ /* (represented by pixels that have a value = nullflagval) then */ /* any pixels whose value = nullflagval, must be set to the value = nullval */ /* before the pixel array is compressed. These null pixel values must */ /* not be inverse scaled by the BSCALE/BZERO values, if present. */ cn_zblank = (outfptr->Fptr)->cn_zblank; nullval = (outfptr->Fptr)->zblank; if (zbitpix > 0 && cn_zblank != -1) /* If the integer image has no defined null */ nullcheck = 0; /* value, then don't bother checking input array for nulls. */ /* if the BSCALE and BZERO keywords exist, then the input values must */ /* be inverse scaled by this factor, before the values are compressed. */ /* (The program may have turned off scaling, which over rides the keywords) */ scale = (outfptr->Fptr)->cn_bscale; zero = (outfptr->Fptr)->cn_bzero; actual_bzero = (outfptr->Fptr)->cn_actual_bzero; /* =========================================================================== */ /* prepare the tile of pixel values for compression */ if (datatype == TSHORT) { imcomp_convert_tile_tshort(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, actual_bzero, &intlength, status); } else if (datatype == TUSHORT) { imcomp_convert_tile_tushort(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, status); } else if (datatype == TBYTE) { imcomp_convert_tile_tbyte(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, status); } else if (datatype == TSBYTE) { imcomp_convert_tile_tsbyte(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, status); } else if (datatype == TINT) { imcomp_convert_tile_tint(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, status); } else if (datatype == TUINT) { imcomp_convert_tile_tuint(outfptr, tiledata, tilelen, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, status); } else if (datatype == TLONG && sizeof(long) == 8) { ffpmsg("Integer*8 Long datatype is not supported when writing to compressed images"); return(*status = BAD_DATATYPE); } else if (datatype == TULONG && sizeof(long) == 8) { ffpmsg("Unsigned integer*8 datatype is not supported when writing to compressed images"); return(*status = BAD_DATATYPE); } else if (datatype == TFLOAT) { imcomp_convert_tile_tfloat(outfptr, row, tiledata, tilelen, tilenx, tileny, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, &flag, bscale, bzero, status); } else if (datatype == TDOUBLE) { imcomp_convert_tile_tdouble(outfptr, row, tiledata, tilelen, tilenx, tileny, nullcheck, nullflagval, nullval, zbitpix, scale, zero, &intlength, &flag, bscale, bzero, status); } else { ffpmsg("unsupported image datatype (imcomp_compress_tile)"); return(*status = BAD_DATATYPE); } if (*status > 0) return(*status); /* return if error occurs */ /* =========================================================================== */ if (flag) /* now compress the integer data array */ { /* allocate buffer for the compressed tile bytes */ clen = (outfptr->Fptr)->maxelem; cbuf = (short *) calloc (clen, sizeof (unsigned char)); if (cbuf == NULL) { ffpmsg("Memory allocation failure. (imcomp_compress_tile)"); return (*status = MEMORY_ALLOCATION); } /* =========================================================================== */ if ( (outfptr->Fptr)->compress_type == RICE_1) { if (intlength == 2) { nelem = fits_rcomp_short ((short *)idata, tilelen, (unsigned char *) cbuf, clen, (outfptr->Fptr)->rice_blocksize); } else if (intlength == 1) { nelem = fits_rcomp_byte ((signed char *)idata, tilelen, (unsigned char *) cbuf, clen, (outfptr->Fptr)->rice_blocksize); } else { nelem = fits_rcomp (idata, tilelen, (unsigned char *) cbuf, clen, (outfptr->Fptr)->rice_blocksize); } if (nelem < 0) /* data compression error condition */ { free (cbuf); ffpmsg("error Rice compressing image tile (imcomp_compress_tile)"); return (*status = DATA_COMPRESSION_ERR); } /* Write the compressed byte stream. */ ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1, nelem, (unsigned char *) cbuf, status); } /* =========================================================================== */ else if ( (outfptr->Fptr)->compress_type == PLIO_1) { for (ii = 0; ii < tilelen; ii++) { if (idata[ii] < 0 || idata[ii] > 16777215) { /* plio algorithn only supports positive 24 bit ints */ ffpmsg("data out of range for PLIO compression (0 - 2**24)"); return(*status = DATA_COMPRESSION_ERR); } } nelem = pl_p2li (idata, 1, cbuf, tilelen); if (nelem < 0) /* data compression error condition */ { free (cbuf); ffpmsg("error PLIO compressing image tile (imcomp_compress_tile)"); return (*status = DATA_COMPRESSION_ERR); } /* Write the compressed byte stream. */ ffpcli(outfptr, (outfptr->Fptr)->cn_compressed, row, 1, nelem, cbuf, status); } /* =========================================================================== */ else if ( ((outfptr->Fptr)->compress_type == GZIP_1) || ((outfptr->Fptr)->compress_type == GZIP_2) ) { if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE && datatype == TFLOAT) { /* Special case of losslessly compressing floating point pixels with GZIP */ /* In this case we compress the input tile array directly */ #if BYTESWAPPED ffswap4((int*) tiledata, tilelen); #endif if ( (outfptr->Fptr)->compress_type == GZIP_2 ) fits_shuffle_4bytes((char *) tiledata, tilelen, status); compress2mem_from_mem((char *) tiledata, tilelen * sizeof(float), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE && datatype == TDOUBLE) { /* Special case of losslessly compressing double pixels with GZIP */ /* In this case we compress the input tile array directly */ #if BYTESWAPPED ffswap8((double *) tiledata, tilelen); #endif if ( (outfptr->Fptr)->compress_type == GZIP_2 ) fits_shuffle_8bytes((char *) tiledata, tilelen, status); compress2mem_from_mem((char *) tiledata, tilelen * sizeof(double), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } else { /* compress the integer idata array */ #if BYTESWAPPED if (intlength == 2) ffswap2((short *) idata, tilelen); else if (intlength == 4) ffswap4(idata, tilelen); #endif if (intlength == 2) { if ( (outfptr->Fptr)->compress_type == GZIP_2 ) fits_shuffle_2bytes((char *) tiledata, tilelen, status); compress2mem_from_mem((char *) idata, tilelen * sizeof(short), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } else if (intlength == 1) { compress2mem_from_mem((char *) idata, tilelen * sizeof(unsigned char), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } else { if ( (outfptr->Fptr)->compress_type == GZIP_2 ) fits_shuffle_4bytes((char *) tiledata, tilelen, status); compress2mem_from_mem((char *) idata, tilelen * sizeof(int), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } } /* Write the compressed byte stream. */ ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1, gzip_nelem, (unsigned char *) cbuf, status); /* =========================================================================== */ } else if ( (outfptr->Fptr)->compress_type == BZIP2_1) { #if BYTESWAPPED if (intlength == 2) ffswap2((short *) idata, tilelen); else if (intlength == 4) ffswap4(idata, tilelen); #endif bzlen = (unsigned int) clen; /* call bzip2 with blocksize = 900K, verbosity = 0, and default workfactor */ /* bzip2 is not supported in the public release. This is only for test purposes. if (BZ2_bzBuffToBuffCompress( (char *) cbuf, &bzlen, (char *) idata, (unsigned int) (tilelen * intlength), 9, 0, 0) ) */ { ffpmsg("bzip2 compression error"); return(*status = DATA_COMPRESSION_ERR); } /* Write the compressed byte stream. */ ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1, bzlen, (unsigned char *) cbuf, status); /* =========================================================================== */ } else if ( (outfptr->Fptr)->compress_type == HCOMPRESS_1) { /* if hcompscale is positive, then we have to multiply the value by the RMS background noise to get the absolute scale value. If negative, then it gives the absolute scale value directly. */ hcompscale = (outfptr->Fptr)->hcomp_scale; if (hcompscale > 0.) { fits_img_stats_int(idata, tilenx, tileny, nullcheck, nullval, 0,0,0,0,0,0,&noise2,&noise3,&noise5,status); /* use the minimum of the 3 noise estimates */ if (noise2 != 0. && noise2 < noise3) noise3 = noise2; if (noise5 != 0. && noise5 < noise3) noise3 = noise5; hcompscale = (float) (hcompscale * noise3); } else if (hcompscale < 0.) { hcompscale = hcompscale * -1.0F; } ihcompscale = (int) (hcompscale + 0.5); hcomp_len = clen; /* allocated size of the buffer */ if (zbitpix == BYTE_IMG || zbitpix == SHORT_IMG) { fits_hcompress(idata, tilenx, tileny, ihcompscale, (char *) cbuf, &hcomp_len, status); } else { /* have to convert idata to an I*8 array, in place */ /* idata must have been allocated large enough to do this */ lldata = (LONGLONG *) idata; for (ii = tilelen - 1; ii >= 0; ii--) { lldata[ii] = idata[ii]; } fits_hcompress64(lldata, tilenx, tileny, ihcompscale, (char *) cbuf, &hcomp_len, status); } /* Write the compressed byte stream. */ ffpclb(outfptr, (outfptr->Fptr)->cn_compressed, row, 1, hcomp_len, (unsigned char *) cbuf, status); } /* =========================================================================== */ if ((outfptr->Fptr)->cn_zscale > 0) { /* write the linear scaling parameters for this tile */ ffpcld (outfptr, (outfptr->Fptr)->cn_zscale, row, 1, 1, bscale, status); ffpcld (outfptr, (outfptr->Fptr)->cn_zzero, row, 1, 1, bzero, status); } free(cbuf); /* finished with this buffer */ /* =========================================================================== */ } else { /* if flag == 0., floating point data couldn't be quantized */ /* losslessly compress the data with gzip. */ /* if gzip2 compressed data column doesn't exist, create it */ if ((outfptr->Fptr)->cn_gzip_data < 1) { if ( (outfptr->Fptr)->request_huge_hdu != 0) { fits_insert_col(outfptr, 999, "GZIP_COMPRESSED_DATA", "1QB", status); } else { fits_insert_col(outfptr, 999, "GZIP_COMPRESSED_DATA", "1PB", status); } if (*status <= 0) /* save the number of this column */ ffgcno(outfptr, CASEINSEN, "GZIP_COMPRESSED_DATA", &(outfptr->Fptr)->cn_gzip_data, status); } if (datatype == TFLOAT) { /* allocate buffer for the compressed tile bytes */ /* make it 10% larger than the original uncompressed data */ clen = tilelen * sizeof(float) * 1.1; cbuf = (short *) calloc (clen, sizeof (unsigned char)); if (cbuf == NULL) { ffpmsg("Memory allocation error. (imcomp_compress_tile)"); return (*status = MEMORY_ALLOCATION); } /* convert null values to NaNs in place, if necessary */ if (nullcheck == 1) { imcomp_float2nan((float *) tiledata, tilelen, (int *) tiledata, *(float *) (nullflagval), status); } #if BYTESWAPPED ffswap4((int*) tiledata, tilelen); #endif compress2mem_from_mem((char *) tiledata, tilelen * sizeof(float), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } else if (datatype == TDOUBLE) { /* allocate buffer for the compressed tile bytes */ /* make it 10% larger than the original uncompressed data */ clen = tilelen * sizeof(double) * 1.1; cbuf = (short *) calloc (clen, sizeof (unsigned char)); if (cbuf == NULL) { ffpmsg("Memory allocation error. (imcomp_compress_tile)"); return (*status = MEMORY_ALLOCATION); } /* convert null values to NaNs in place, if necessary */ if (nullcheck == 1) { imcomp_double2nan((double *) tiledata, tilelen, (LONGLONG *) tiledata, *(double *) (nullflagval), status); } #if BYTESWAPPED ffswap8((double*) tiledata, tilelen); #endif compress2mem_from_mem((char *) tiledata, tilelen * sizeof(double), (char **) &cbuf, &clen, realloc, &gzip_nelem, status); } /* Write the compressed byte stream. */ ffpclb(outfptr, (outfptr->Fptr)->cn_gzip_data, row, 1, gzip_nelem, (unsigned char *) cbuf, status); free(cbuf); /* finished with this buffer */ } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_write_nocompress_tile(fitsfile *outfptr, long row, int datatype, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int *status) { char coltype[4]; /* Write the uncompressed image tile pixels to the tile-compressed image file. */ /* This is a special case when using NOCOMPRESS for diagnostic purposes in fpack. */ /* Currently, this only supports a limited number of data types and */ /* does not fully support null-valued pixels in the image. */ if ((outfptr->Fptr)->cn_uncompressed < 1) { /* uncompressed data column doesn't exist, so append new column to table */ if (datatype == TSHORT) { strcpy(coltype, "1PI"); } else if (datatype == TINT) { strcpy(coltype, "1PJ"); } else if (datatype == TFLOAT) { strcpy(coltype, "1PE"); } else { ffpmsg("NOCOMPRESSION option only supported for int*2, int*4, and float*4 images"); return(*status = DATA_COMPRESSION_ERR); } fits_insert_col(outfptr, 999, "UNCOMPRESSED_DATA", coltype, status); /* create column */ } fits_get_colnum(outfptr, CASEINSEN, "UNCOMPRESSED_DATA", &(outfptr->Fptr)->cn_uncompressed, status); /* save col. num. */ fits_write_col(outfptr, datatype, (outfptr->Fptr)->cn_uncompressed, row, 1, tilelen, tiledata, status); /* write the tile data */ return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tshort( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, double actual_bzero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input integer*2 tile array in place to 4 or 8-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ short *sbuff; int flagval, *idata; long ii; /* We only support writing this integer*2 tile data to a FITS image with BITPIX = 16 and with BZERO = 0 and BSCALE = 1. */ if (zbitpix != SHORT_IMG || scale != 1.0 || zero != 0.0) { ffpmsg("Datatype conversion/scaling is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } sbuff = (short *) tiledata; idata = (int *) tiledata; if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) { /* don't have to convert to int if using gzip, bzip2 or Rice compression */ *intlength = 2; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(short *) (nullflagval); if (flagval != nullval) { for (ii = tilelen - 1; ii >= 0; ii--) { if (sbuff[ii] == (short) flagval) sbuff[ii] = (short) nullval; } } } } else if ((outfptr->Fptr)->compress_type == HCOMPRESS_1) { /* have to convert to int if using HCOMPRESS */ *intlength = 4; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(short *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (sbuff[ii] == (short) flagval) idata[ii] = nullval; else idata[ii] = (int) sbuff[ii]; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = (int) sbuff[ii]; } } else { /* have to convert to int if using PLIO */ *intlength = 4; if (zero == 0. && actual_bzero == 32768.) { /* Here we are compressing unsigned 16-bit integers that have */ /* been offset by -32768 using the standard FITS convention. */ /* Since PLIO cannot deal with negative values, we must apply */ /* the shift of 32786 to the values to make them all positive. */ /* The inverse negative shift will be applied in */ /* imcomp_decompress_tile when reading the compressed tile. */ if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(short *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (sbuff[ii] == (short) flagval) idata[ii] = nullval; else idata[ii] = (int) sbuff[ii] + 32768; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = (int) sbuff[ii] + 32768; } } else { /* This is not an unsigned 16-bit integer array, so process normally */ if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(short *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (sbuff[ii] == (short) flagval) idata[ii] = nullval; else idata[ii] = (int) sbuff[ii]; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = (int) sbuff[ii]; } } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tushort( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input unsigned integer*2 tile array in place to 4 or 8-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ unsigned short *usbuff; short *sbuff; int flagval, *idata; long ii; /* datatype of input array is unsigned short. We only support writing this datatype to a FITS image with BITPIX = 16 and with BZERO = 0 and BSCALE = 32768. */ if (zbitpix != SHORT_IMG || scale != 1.0 || zero != 32768.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } usbuff = (unsigned short *) tiledata; sbuff = (short *) tiledata; idata = (int *) tiledata; if ((outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1) { /* don't have to convert to int if using gzip, bzip2, or Rice compression */ *intlength = 2; /* offset the unsigned value by -32768 to a signed short value. */ /* It is more efficient to do this by just flipping the most significant of the 16 bits */ if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(unsigned short *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (usbuff[ii] == (unsigned short) flagval) sbuff[ii] = (short) nullval; else usbuff[ii] = (usbuff[ii]) ^ 0x8000; } } else { /* just offset the pixel values by 32768 (by flipping the MSB */ for (ii = tilelen - 1; ii >= 0; ii--) usbuff[ii] = (usbuff[ii]) ^ 0x8000; } } else { /* have to convert to int if using HCOMPRESS or PLIO */ *intlength = 4; if (nullcheck == 1) { /* offset the pixel values by 32768, and */ /* reset pixels equal to flagval to nullval */ flagval = *(unsigned short *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (usbuff[ii] == (unsigned short) flagval) idata[ii] = nullval; else idata[ii] = ((int) usbuff[ii]) - 32768; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = ((int) usbuff[ii]) - 32768; } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tint( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input integer tile array in place to 4 or 8-byte ints for compression, */ /* If needed, do null value substitution. */ int flagval, *idata; long ii; /* datatype of input array is int. We only support writing this datatype to a FITS image with BITPIX = 32 and with BZERO = 0 and BSCALE = 1. */ if (zbitpix != LONG_IMG || scale != 1.0 || zero != 0.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } idata = (int *) tiledata; *intlength = 4; if (nullcheck == 1) { /* no datatype conversion is required for any of the compression algorithms, except possibly for HCOMPRESS (to I*8), which is handled later. Just reset pixels equal to flagval to the FITS null value */ flagval = *(int *) (nullflagval); if (flagval != nullval) { for (ii = tilelen - 1; ii >= 0; ii--) { if (idata[ii] == flagval) idata[ii] = nullval; } } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tuint( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input unsigned integer tile array in place to 4 or 8-byte ints for compression, */ /* If needed, do null value substitution. */ int flagval, *idata; unsigned int *uintbuff, uintflagval; long ii; /* datatype of input array is unsigned int. We only support writing this datatype to a FITS image with BITPIX = 32 and with BZERO = 0 and BSCALE = 2147483648. */ if (zbitpix != LONG_IMG || scale != 1.0 || zero != 2147483648.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } *intlength = 4; idata = (int *) tiledata; uintbuff = (unsigned int *) tiledata; /* offset the unsigned value by -2147483648 to a signed int value. */ /* It is more efficient to do this by just flipping the most significant of the 32 bits */ if (nullcheck == 1) { /* reset pixels equal to flagval to nullval and */ /* offset the other pixel values (by flipping the MSB) */ uintflagval = *(unsigned int *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (uintbuff[ii] == uintflagval) idata[ii] = nullval; else uintbuff[ii] = (uintbuff[ii]) ^ 0x80000000; } } else { /* just offset the pixel values (by flipping the MSB) */ for (ii = tilelen - 1; ii >= 0; ii--) uintbuff[ii] = (uintbuff[ii]) ^ 0x80000000; } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tbyte( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input unsigned integer*1 tile array in place to 4 or 8-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ int flagval, *idata; long ii; unsigned char *usbbuff; /* datatype of input array is unsigned byte. We only support writing this datatype to a FITS image with BITPIX = 8 and with BZERO = 0 and BSCALE = 1. */ if (zbitpix != BYTE_IMG || scale != 1.0 || zero != 0.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } idata = (int *) tiledata; usbbuff = (unsigned char *) tiledata; if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) { /* don't have to convert to int if using gzip, bzip2, or Rice compression */ *intlength = 1; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(unsigned char *) (nullflagval); if (flagval != nullval) { for (ii = tilelen - 1; ii >= 0; ii--) { if (usbbuff[ii] == (unsigned char) flagval) usbbuff[ii] = (unsigned char) nullval; } } } } else { /* have to convert to int if using HCOMPRESS or PLIO */ *intlength = 4; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(unsigned char *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (usbbuff[ii] == (unsigned char) flagval) idata[ii] = nullval; else idata[ii] = (int) usbbuff[ii]; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = (int) usbbuff[ii]; } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tsbyte( fitsfile *outfptr, void *tiledata, long tilelen, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input integer*1 tile array in place to 4 or 8-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ int flagval, *idata; long ii; signed char *sbbuff; /* datatype of input array is signed byte. We only support writing this datatype to a FITS image with BITPIX = 8 and with BZERO = 0 and BSCALE = -128. */ if (zbitpix != BYTE_IMG|| scale != 1.0 || zero != -128.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } idata = (int *) tiledata; sbbuff = (signed char *) tiledata; if ( (outfptr->Fptr)->compress_type == RICE_1 || (outfptr->Fptr)->compress_type == GZIP_1 || (outfptr->Fptr)->compress_type == GZIP_2 || (outfptr->Fptr)->compress_type == BZIP2_1 ) { /* don't have to convert to int if using gzip, bzip2 or Rice compression */ *intlength = 1; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ /* offset the other pixel values (by flipping the MSB) */ flagval = *(signed char *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (sbbuff[ii] == (signed char) flagval) sbbuff[ii] = (signed char) nullval; else sbbuff[ii] = (sbbuff[ii]) ^ 0x80; } } else { /* just offset the pixel values (by flipping the MSB) */ for (ii = tilelen - 1; ii >= 0; ii--) sbbuff[ii] = (sbbuff[ii]) ^ 0x80; } } else { /* have to convert to int if using HCOMPRESS or PLIO */ *intlength = 4; if (nullcheck == 1) { /* reset pixels equal to flagval to the FITS null value, prior to compression */ flagval = *(signed char *) (nullflagval); for (ii = tilelen - 1; ii >= 0; ii--) { if (sbbuff[ii] == (signed char) flagval) idata[ii] = nullval; else idata[ii] = ((int) sbbuff[ii]) + 128; } } else { /* just do the data type conversion to int */ for (ii = tilelen - 1; ii >= 0; ii--) idata[ii] = ((int) sbbuff[ii]) + 128; } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tfloat( fitsfile *outfptr, long row, void *tiledata, long tilelen, long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input float tile array in place to 4 or 8-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ int flagval, *idata; long irow, ii; float floatnull; unsigned char *usbbuff; unsigned long dithersum; int iminval = 0, imaxval = 0; /* min and max quantized integers */ /* datatype of input array is double. We only support writing this datatype to a FITS image with BITPIX = -64 or -32, except we also support the special case where BITPIX = 32 and BZERO = 0 and BSCALE = 1. */ if ((zbitpix != LONG_IMG && zbitpix != DOUBLE_IMG && zbitpix != FLOAT_IMG) || scale != 1.0 || zero != 0.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } *intlength = 4; idata = (int *) tiledata; /* if the tile-compressed table contains zscale and zzero columns */ /* then scale and quantize the input floating point data. */ if ((outfptr->Fptr)->cn_zscale > 0) { /* quantize the float values into integers */ if (nullcheck == 1) floatnull = *(float *) (nullflagval); else floatnull = FLOATNULLVALUE; /* NaNs are represented by this, by default */ if ((outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 || (outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) { /* see if the dithering offset value needs to be initialized */ if ((outfptr->Fptr)->request_dither_seed == 0 && (outfptr->Fptr)->dither_seed == 0) { /* This means randomly choose the dithering offset based on the system time. */ /* The offset will have a value between 1 and 10000, inclusive. */ /* The time function returns an integer value that is incremented each second. */ /* The clock function returns the elapsed CPU time, in integer CLOCKS_PER_SEC units. */ /* The CPU time returned by clock is typically (on linux PC) only good to 0.01 sec */ /* Summing the 2 quantities may help avoid cases where 2 executions of the program */ /* (perhaps in a multithreaded environoment) end up with exactly the same dither seed */ /* value. The sum is incremented by the current HDU number in the file to provide */ /* further randomization. This randomization is desireable if multiple compressed */ /* images will be summed (or differenced). In such cases, the benefits of dithering */ /* may be lost if all the images use exactly the same sequence of random numbers when */ /* calculating the dithering offsets. */ (outfptr->Fptr)->dither_seed = (( (int)time(NULL) + ( (int) clock() / (int) (CLOCKS_PER_SEC / 100)) + (outfptr->Fptr)->curhdu) % 10000) + 1; /* update the header keyword with this new value */ fits_update_key(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->dither_seed), NULL, status); } else if ((outfptr->Fptr)->request_dither_seed < 0 && (outfptr->Fptr)->dither_seed < 0) { /* this means randomly choose the dithering offset based on some hash function */ /* of the first input tile of data to be quantized and compressed. This ensures that */ /* the same offset value is used for a given image every time it is compressed. */ usbbuff = (unsigned char *) tiledata; dithersum = 0; for (ii = 0; ii < 4 * tilelen; ii++) { dithersum += usbbuff[ii]; /* doesn't matter if there is an integer overflow */ } (outfptr->Fptr)->dither_seed = ((int) (dithersum % 10000)) + 1; /* update the header keyword with this new value */ fits_update_key(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->dither_seed), NULL, status); } /* subtract 1 to convert from 1-based to 0-based element number */ irow = row + (outfptr->Fptr)->dither_seed - 1; /* dither the quantized values */ } else if ((outfptr->Fptr)->quantize_method == -1) { irow = 0; /* do not dither the quantized values */ } else { ffpmsg("Unknown dithering method."); ffpmsg("May need to install a newer version of CFITSIO."); return(*status = DATA_COMPRESSION_ERR); } *flag = fits_quantize_float (irow, (float *) tiledata, tilenx, tileny, nullcheck, floatnull, (outfptr->Fptr)->quantize_level, (outfptr->Fptr)->quantize_method, idata, bscale, bzero, &iminval, &imaxval); if (*flag > 1) return(*status = *flag); } else if ((outfptr->Fptr)->quantize_level != NO_QUANTIZE) { /* if floating point pixels are not being losslessly compressed, then */ /* input float data is implicitly converted (truncated) to integers */ if ((scale != 1. || zero != 0.)) /* must scale the values */ imcomp_nullscalefloats((float *) tiledata, tilelen, idata, scale, zero, nullcheck, *(float *) (nullflagval), nullval, status); else imcomp_nullfloats((float *) tiledata, tilelen, idata, nullcheck, *(float *) (nullflagval), nullval, status); } else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE) { /* just convert null values to NaNs in place, if necessary, then do lossless gzip compression */ if (nullcheck == 1) { imcomp_float2nan((float *) tiledata, tilelen, (int *) tiledata, *(float *) (nullflagval), status); } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_convert_tile_tdouble( fitsfile *outfptr, long row, void *tiledata, long tilelen, long tilenx, long tileny, int nullcheck, void *nullflagval, int nullval, int zbitpix, double scale, double zero, int *intlength, int *flag, double *bscale, double *bzero, int *status) { /* Prepare the input tile array of pixels for compression. /* Convert input double tile array in place to 4-byte ints for compression, */ /* If needed, convert 4 or 8-byte ints and do null value substitution. */ /* Note that the calling routine must have allocated the input array big enough */ /* to be able to do this. */ int flagval, *idata; long irow, ii; double doublenull; unsigned char *usbbuff; unsigned long dithersum; int iminval = 0, imaxval = 0; /* min and max quantized integers */ /* datatype of input array is double. We only support writing this datatype to a FITS image with BITPIX = -64 or -32, except we also support the special case where BITPIX = 32 and BZERO = 0 and BSCALE = 1. */ if ((zbitpix != LONG_IMG && zbitpix != DOUBLE_IMG && zbitpix != FLOAT_IMG) || scale != 1.0 || zero != 0.) { ffpmsg("Implicit datatype conversion is not supported when writing to compressed images"); return(*status = DATA_COMPRESSION_ERR); } *intlength = 4; idata = (int *) tiledata; /* if the tile-compressed table contains zscale and zzero columns */ /* then scale and quantize the input floating point data. */ /* Otherwise, just truncate the floats to integers. */ if ((outfptr->Fptr)->cn_zscale > 0) { if (nullcheck == 1) doublenull = *(double *) (nullflagval); else doublenull = DOUBLENULLVALUE; /* quantize the double values into integers */ if ((outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 || (outfptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) { /* see if the dithering offset value needs to be initialized (see above) */ if ((outfptr->Fptr)->request_dither_seed == 0 && (outfptr->Fptr)->dither_seed == 0) { (outfptr->Fptr)->dither_seed = (( (int)time(NULL) + ( (int) clock() / (int) (CLOCKS_PER_SEC / 100)) + (outfptr->Fptr)->curhdu) % 10000) + 1; /* update the header keyword with this new value */ fits_update_key(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->dither_seed), NULL, status); } else if ((outfptr->Fptr)->request_dither_seed < 0 && (outfptr->Fptr)->dither_seed < 0) { usbbuff = (unsigned char *) tiledata; dithersum = 0; for (ii = 0; ii < 8 * tilelen; ii++) { dithersum += usbbuff[ii]; } (outfptr->Fptr)->dither_seed = ((int) (dithersum % 10000)) + 1; /* update the header keyword with this new value */ fits_update_key(outfptr, TINT, "ZDITHER0", &((outfptr->Fptr)->dither_seed), NULL, status); } irow = row + (outfptr->Fptr)->dither_seed - 1; /* dither the quantized values */ } else if ((outfptr->Fptr)->quantize_method == -1) { irow = 0; /* do not dither the quantized values */ } else { ffpmsg("Unknown subtractive dithering method."); ffpmsg("May need to install a newer version of CFITSIO."); return(*status = DATA_COMPRESSION_ERR); } *flag = fits_quantize_double (irow, (double *) tiledata, tilenx, tileny, nullcheck, doublenull, (outfptr->Fptr)->quantize_level, (outfptr->Fptr)->quantize_method, idata, bscale, bzero, &iminval, &imaxval); if (*flag > 1) return(*status = *flag); } else if ((outfptr->Fptr)->quantize_level != NO_QUANTIZE) { /* if floating point pixels are not being losslessly compressed, then */ /* input float data is implicitly converted (truncated) to integers */ if ((scale != 1. || zero != 0.)) /* must scale the values */ imcomp_nullscaledoubles((double *) tiledata, tilelen, idata, scale, zero, nullcheck, *(double *) (nullflagval), nullval, status); else imcomp_nulldoubles((double *) tiledata, tilelen, idata, nullcheck, *(double *) (nullflagval), nullval, status); } else if ((outfptr->Fptr)->quantize_level == NO_QUANTIZE) { /* just convert null values to NaNs in place, if necessary, then do lossless gzip compression */ if (nullcheck == 1) { imcomp_double2nan((double *) tiledata, tilelen, (LONGLONG *) tiledata, *(double *) (nullflagval), status); } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullscale( int *idata, long tilelen, int nullflagval, int nullval, double scale, double zero, int *status) /* do null value substitution AND scaling of the integer array. If array value = nullflagval, then set the value to nullval. Otherwise, inverse scale the integer value. */ { long ii; double dvalue; for (ii=0; ii < tilelen; ii++) { if (idata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = (idata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullvalues( int *idata, long tilelen, int nullflagval, int nullval, int *status) /* do null value substitution. If array value = nullflagval, then set the value to nullval. */ { long ii; for (ii=0; ii < tilelen; ii++) { if (idata[ii] == nullflagval) idata[ii] = nullval; } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_scalevalues( int *idata, long tilelen, double scale, double zero, int *status) /* do inverse scaling the integer values. */ { long ii; double dvalue; for (ii=0; ii < tilelen; ii++) { dvalue = (idata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullscalei2( short *idata, long tilelen, short nullflagval, short nullval, double scale, double zero, int *status) /* do null value substitution AND scaling of the integer array. If array value = nullflagval, then set the value to nullval. Otherwise, inverse scale the integer value. */ { long ii; double dvalue; for (ii=0; ii < tilelen; ii++) { if (idata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = (idata[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; idata[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; idata[ii] = SHRT_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullvaluesi2( short *idata, long tilelen, short nullflagval, short nullval, int *status) /* do null value substitution. If array value = nullflagval, then set the value to nullval. */ { long ii; for (ii=0; ii < tilelen; ii++) { if (idata[ii] == nullflagval) idata[ii] = nullval; } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_scalevaluesi2( short *idata, long tilelen, double scale, double zero, int *status) /* do inverse scaling the integer values. */ { long ii; double dvalue; for (ii=0; ii < tilelen; ii++) { dvalue = (idata[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; idata[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; idata[ii] = SHRT_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullfloats( float *fdata, long tilelen, int *idata, int nullcheck, float nullflagval, int nullval, int *status) /* do null value substitution of the float array. If array value = nullflagval, then set the output value to FLOATNULLVALUE. */ { long ii; double dvalue; if (nullcheck == 1) /* must check for null values */ { for (ii=0; ii < tilelen; ii++) { if (fdata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = fdata[ii]; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } } else /* don't have to worry about null values */ { for (ii=0; ii < tilelen; ii++) { dvalue = fdata[ii]; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullscalefloats( float *fdata, long tilelen, int *idata, double scale, double zero, int nullcheck, float nullflagval, int nullval, int *status) /* do null value substitution of the float array. If array value = nullflagval, then set the output value to FLOATNULLVALUE. Otherwise, inverse scale the integer value. */ { long ii; double dvalue; if (nullcheck == 1) /* must check for null values */ { for (ii=0; ii < tilelen; ii++) { if (fdata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = (fdata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } } else /* don't have to worry about null values */ { for (ii=0; ii < tilelen; ii++) { dvalue = (fdata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nulldoubles( double *fdata, long tilelen, int *idata, int nullcheck, double nullflagval, int nullval, int *status) /* do null value substitution of the float array. If array value = nullflagval, then set the output value to FLOATNULLVALUE. Otherwise, inverse scale the integer value. */ { long ii; double dvalue; if (nullcheck == 1) /* must check for null values */ { for (ii=0; ii < tilelen; ii++) { if (fdata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = fdata[ii]; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } } else /* don't have to worry about null values */ { for (ii=0; ii < tilelen; ii++) { dvalue = fdata[ii]; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int imcomp_nullscaledoubles( double *fdata, long tilelen, int *idata, double scale, double zero, int nullcheck, double nullflagval, int nullval, int *status) /* do null value substitution of the float array. If array value = nullflagval, then set the output value to FLOATNULLVALUE. Otherwise, inverse scale the integer value. */ { long ii; double dvalue; if (nullcheck == 1) /* must check for null values */ { for (ii=0; ii < tilelen; ii++) { if (fdata[ii] == nullflagval) idata[ii] = nullval; else { dvalue = (fdata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } } else /* don't have to worry about null values */ { for (ii=0; ii < tilelen; ii++) { dvalue = (fdata[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; idata[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; idata[ii] = INT32_MAX; } else { if (dvalue >= 0.) idata[ii] = (int) (dvalue + .5); else idata[ii] = (int) (dvalue - .5); } } } return(*status); } /*---------------------------------------------------------------------------*/ int fits_write_compressed_img(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be written */ long *infpixel, /* I - 'bottom left corner' of the subsection */ long *inlpixel, /* I - 'top right corner' of the subsection */ int nullcheck, /* I - 0 for no null checking */ /* 1: pixels that are = nullval will be */ /* written with the FITS null pixel value */ /* (floating point arrays only) */ void *array, /* I - array of values to be written */ void *nullval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write a section of a compressed image. */ { int tiledim[MAX_COMPRESS_DIM]; long naxis[MAX_COMPRESS_DIM]; long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM]; long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM]; long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM]; long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp; long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM]; long i5, i4, i3, i2, i1, i0, irow; int ii, ndim, pixlen, tilenul; int tstatus, buffpixsiz; void *buffer; char *bnullarray = 0, card[FLEN_CARD]; if (*status > 0) return(*status); if (!fits_is_compressed_image(fptr, status) ) { ffpmsg("CHDU is not a compressed image (fits_write_compressed_img)"); return(*status = DATA_COMPRESSION_ERR); } /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); /* ===================================================================== */ if (datatype == TSHORT || datatype == TUSHORT) { pixlen = sizeof(short); } else if (datatype == TINT || datatype == TUINT) { pixlen = sizeof(int); } else if (datatype == TBYTE || datatype == TSBYTE) { pixlen = 1; } else if (datatype == TLONG || datatype == TULONG) { pixlen = sizeof(long); } else if (datatype == TFLOAT) { pixlen = sizeof(float); } else if (datatype == TDOUBLE) { pixlen = sizeof(double); } else { ffpmsg("unsupported datatype for compressing image"); return(*status = BAD_DATATYPE); } /* ===================================================================== */ /* allocate scratch space for processing one tile of the image */ buffpixsiz = pixlen; /* this is the minimum pixel size */ if ( (fptr->Fptr)->compress_type == HCOMPRESS_1) { /* need 4 or 8 bytes per pixel */ if ((fptr->Fptr)->zbitpix == BYTE_IMG || (fptr->Fptr)->zbitpix == SHORT_IMG ) buffpixsiz = maxvalue(buffpixsiz, 4); else buffpixsiz = 8; } else if ( (fptr->Fptr)->compress_type == PLIO_1) { /* need 4 bytes per pixel */ buffpixsiz = maxvalue(buffpixsiz, 4); } else if ( (fptr->Fptr)->compress_type == RICE_1 || (fptr->Fptr)->compress_type == GZIP_1 || (fptr->Fptr)->compress_type == GZIP_2 || (fptr->Fptr)->compress_type == BZIP2_1) { /* need 1, 2, or 4 bytes per pixel */ if ((fptr->Fptr)->zbitpix == BYTE_IMG) buffpixsiz = maxvalue(buffpixsiz, 1); else if ((fptr->Fptr)->zbitpix == SHORT_IMG) buffpixsiz = maxvalue(buffpixsiz, 2); else buffpixsiz = maxvalue(buffpixsiz, 4); } else { ffpmsg("unsupported image compression algorithm"); return(*status = BAD_DATATYPE); } /* cast to double to force alignment on 8-byte addresses */ buffer = (double *) calloc ((fptr->Fptr)->maxtilelen, buffpixsiz); if (buffer == NULL) { ffpmsg("Out of memory (fits_write_compress_img)"); return (*status = MEMORY_ALLOCATION); } /* ===================================================================== */ /* initialize all the arrays */ for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { naxis[ii] = 1; tiledim[ii] = 1; tilesize[ii] = 1; ftile[ii] = 1; ltile[ii] = 1; rowdim[ii] = 1; } ndim = (fptr->Fptr)->zndim; ntemp = 1; for (ii = 0; ii < ndim; ii++) { fpixel[ii] = infpixel[ii]; lpixel[ii] = inlpixel[ii]; /* calc number of tiles in each dimension, and tile containing */ /* the first and last pixel we want to read in each dimension */ naxis[ii] = (fptr->Fptr)->znaxis[ii]; if (fpixel[ii] < 1) { free(buffer); return(*status = BAD_PIX_NUM); } tilesize[ii] = (fptr->Fptr)->tilesize[ii]; tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1; ftile[ii] = (fpixel[ii] - 1) / tilesize[ii] + 1; ltile[ii] = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, tiledim[ii]); rowdim[ii] = ntemp; /* total tiles in each dimension */ ntemp *= tiledim[ii]; } /* support up to 6 dimensions for now */ /* tfpixel and tlpixel are the first and last image pixels */ /* along each dimension of the compression tile */ for (i5 = ftile[5]; i5 <= ltile[5]; i5++) { tfpixel[5] = (i5 - 1) * tilesize[5] + 1; tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, naxis[5]); thistilesize[5] = tlpixel[5] - tfpixel[5] + 1; offset[5] = (i5 - 1) * rowdim[5]; for (i4 = ftile[4]; i4 <= ltile[4]; i4++) { tfpixel[4] = (i4 - 1) * tilesize[4] + 1; tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, naxis[4]); thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1); offset[4] = (i4 - 1) * rowdim[4] + offset[5]; for (i3 = ftile[3]; i3 <= ltile[3]; i3++) { tfpixel[3] = (i3 - 1) * tilesize[3] + 1; tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, naxis[3]); thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1); offset[3] = (i3 - 1) * rowdim[3] + offset[4]; for (i2 = ftile[2]; i2 <= ltile[2]; i2++) { tfpixel[2] = (i2 - 1) * tilesize[2] + 1; tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, naxis[2]); thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1); offset[2] = (i2 - 1) * rowdim[2] + offset[3]; for (i1 = ftile[1]; i1 <= ltile[1]; i1++) { tfpixel[1] = (i1 - 1) * tilesize[1] + 1; tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, naxis[1]); thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1); offset[1] = (i1 - 1) * rowdim[1] + offset[2]; for (i0 = ftile[0]; i0 <= ltile[0]; i0++) { tfpixel[0] = (i0 - 1) * tilesize[0] + 1; tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, naxis[0]); thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1); /* calculate row of table containing this tile */ irow = i0 + offset[1]; /* read and uncompress this row (tile) of the table */ /* also do type conversion and undefined pixel substitution */ /* at this point */ imcomp_decompress_tile(fptr, irow, thistilesize[0], datatype, nullcheck, nullval, buffer, bnullarray, &tilenul, status); if (*status == NO_COMPRESSED_TILE) { /* tile doesn't exist, so initialize to zero */ memset(buffer, 0, pixlen * thistilesize[0]); *status = 0; } /* copy the intersecting pixels to this tile from the input */ imcomp_merge_overlap(buffer, pixlen, ndim, tfpixel, tlpixel, bnullarray, array, fpixel, lpixel, nullcheck, status); /* compress the tile again, and write it back to the FITS file */ imcomp_compress_tile (fptr, irow, datatype, buffer, thistilesize[0], tlpixel[0] - tfpixel[0] + 1, tlpixel[1] - tfpixel[1] + 1, nullcheck, nullval, status); } } } } } } free(buffer); if ((fptr->Fptr)->zbitpix < 0 && nullcheck != 0) { /* This is a floating point FITS image with possible null values. It is too messy to test if any null values are actually written, so just assume so. We need to make sure that the ZBLANK keyword is present in the compressed image header. If it is not there then we need to insert the keyword. */ tstatus = 0; ffgcrd(fptr, "ZBLANK", card, &tstatus); if (tstatus) { /* have to insert the ZBLANK keyword */ ffgcrd(fptr, "ZCMPTYPE", card, status); ffikyj(fptr, "ZBLANK", COMPRESS_NULL_VALUE, "null value in the compressed integer array", status); /* set this value into the internal structure; it is used if */ /* the program reads back the values from the array */ (fptr->Fptr)->zblank = COMPRESS_NULL_VALUE; (fptr->Fptr)->cn_zblank = -1; /* flag for a constant ZBLANK */ } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_write_compressed_pixels(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be written */ LONGLONG fpixel, /* I - 'first pixel to write */ LONGLONG npixel, /* I - number of pixels to write */ int nullcheck, /* I - 0 for no null checking */ /* 1: pixels that are = nullval will be */ /* written with the FITS null pixel value */ /* (floating point arrays only) */ void *array, /* I - array of values to write */ void *nullval, /* I - value used to represent undefined pixels*/ int *status) /* IO - error status */ /* Write a consecutive set of pixels to a compressed image. This routine interpretes the n-dimensional image as a long one-dimensional array. This is actually a rather inconvenient way to write compressed images in general, and could be rather inefficient if the requested pixels to be written are located in many different image compression tiles. The general strategy used here is to write the requested pixels in blocks that correspond to rectangular image sections. */ { int naxis, ii, bytesperpixel; long naxes[MAX_COMPRESS_DIM], nread; LONGLONG tfirst, tlast, last0, last1, dimsize[MAX_COMPRESS_DIM]; long nplane, firstcoord[MAX_COMPRESS_DIM], lastcoord[MAX_COMPRESS_DIM]; char *arrayptr; if (*status > 0) return(*status); arrayptr = (char *) array; /* get size of array pixels, in bytes */ bytesperpixel = ffpxsz(datatype); for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { naxes[ii] = 1; firstcoord[ii] = 0; lastcoord[ii] = 0; } /* determine the dimensions of the image to be written */ ffgidm(fptr, &naxis, status); ffgisz(fptr, MAX_COMPRESS_DIM, naxes, status); /* calc the cumulative number of pixels in each successive dimension */ dimsize[0] = 1; for (ii = 1; ii < MAX_COMPRESS_DIM; ii++) dimsize[ii] = dimsize[ii - 1] * naxes[ii - 1]; /* determine the coordinate of the first and last pixel in the image */ /* Use zero based indexes here */ tfirst = fpixel - 1; tlast = tfirst + npixel - 1; for (ii = naxis - 1; ii >= 0; ii--) { firstcoord[ii] = (long) (tfirst / dimsize[ii]); lastcoord[ii] = (long) (tlast / dimsize[ii]); tfirst = tfirst - firstcoord[ii] * dimsize[ii]; tlast = tlast - lastcoord[ii] * dimsize[ii]; } /* to simplify things, treat 1-D, 2-D, and 3-D images as separate cases */ if (naxis == 1) { /* Simple: just write the requested range of pixels */ firstcoord[0] = firstcoord[0] + 1; lastcoord[0] = lastcoord[0] + 1; fits_write_compressed_img(fptr, datatype, firstcoord, lastcoord, nullcheck, array, nullval, status); return(*status); } else if (naxis == 2) { nplane = 0; /* write 1st (and only) plane of the image */ fits_write_compressed_img_plane(fptr, datatype, bytesperpixel, nplane, firstcoord, lastcoord, naxes, nullcheck, array, nullval, &nread, status); } else if (naxis == 3) { /* test for special case: writing an integral number of planes */ if (firstcoord[0] == 0 && firstcoord[1] == 0 && lastcoord[0] == naxes[0] - 1 && lastcoord[1] == naxes[1] - 1) { for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { /* convert from zero base to 1 base */ (firstcoord[ii])++; (lastcoord[ii])++; } /* we can write the contiguous block of pixels in one go */ fits_write_compressed_img(fptr, datatype, firstcoord, lastcoord, nullcheck, array, nullval, status); return(*status); } /* save last coordinate in temporary variables */ last0 = lastcoord[0]; last1 = lastcoord[1]; if (firstcoord[2] < lastcoord[2]) { /* we will write up to the last pixel in all but the last plane */ lastcoord[0] = naxes[0] - 1; lastcoord[1] = naxes[1] - 1; } /* write one plane of the cube at a time, for simplicity */ for (nplane = firstcoord[2]; nplane <= lastcoord[2]; nplane++) { if (nplane == lastcoord[2]) { lastcoord[0] = (long) last0; lastcoord[1] = (long) last1; } fits_write_compressed_img_plane(fptr, datatype, bytesperpixel, nplane, firstcoord, lastcoord, naxes, nullcheck, arrayptr, nullval, &nread, status); /* for all subsequent planes, we start with the first pixel */ firstcoord[0] = 0; firstcoord[1] = 0; /* increment pointers to next elements to be written */ arrayptr = arrayptr + nread * bytesperpixel; } } else { ffpmsg("only 1D, 2D, or 3D images are currently supported"); return(*status = DATA_COMPRESSION_ERR); } return(*status); } /*--------------------------------------------------------------------------*/ int fits_write_compressed_img_plane(fitsfile *fptr, /* I - FITS file */ int datatype, /* I - datatype of the array to be written */ int bytesperpixel, /* I - number of bytes per pixel in array */ long nplane, /* I - which plane of the cube to write */ long *firstcoord, /* I coordinate of first pixel to write */ long *lastcoord, /* I coordinate of last pixel to write */ long *naxes, /* I size of each image dimension */ int nullcheck, /* I - 0 for no null checking */ /* 1: pixels that are = nullval will be */ /* written with the FITS null pixel value */ /* (floating point arrays only) */ void *array, /* I - array of values that are written */ void *nullval, /* I - value for undefined pixels */ long *nread, /* O - total number of pixels written */ int *status) /* IO - error status */ /* in general we have to write the first partial row of the image, followed by the middle complete rows, followed by the last partial row of the image. If the first or last rows are complete, then write them at the same time as all the middle rows. */ { /* bottom left coord. and top right coord. */ long blc[MAX_COMPRESS_DIM], trc[MAX_COMPRESS_DIM]; char *arrayptr; *nread = 0; arrayptr = (char *) array; blc[2] = nplane + 1; trc[2] = nplane + 1; if (firstcoord[0] != 0) { /* have to read a partial first row */ blc[0] = firstcoord[0] + 1; blc[1] = firstcoord[1] + 1; trc[1] = blc[1]; if (lastcoord[1] == firstcoord[1]) trc[0] = lastcoord[0] + 1; /* 1st and last pixels in same row */ else trc[0] = naxes[0]; /* read entire rest of the row */ fits_write_compressed_img(fptr, datatype, blc, trc, nullcheck, arrayptr, nullval, status); *nread = *nread + trc[0] - blc[0] + 1; if (lastcoord[1] == firstcoord[1]) { return(*status); /* finished */ } /* set starting coord to beginning of next line */ firstcoord[0] = 0; firstcoord[1] += 1; arrayptr = arrayptr + (trc[0] - blc[0] + 1) * bytesperpixel; } /* write contiguous complete rows of the image, if any */ blc[0] = 1; blc[1] = firstcoord[1] + 1; trc[0] = naxes[0]; if (lastcoord[0] + 1 == naxes[0]) { /* can write the last complete row, too */ trc[1] = lastcoord[1] + 1; } else { /* last row is incomplete; have to read it separately */ trc[1] = lastcoord[1]; } if (trc[1] >= blc[1]) /* must have at least one whole line to read */ { fits_write_compressed_img(fptr, datatype, blc, trc, nullcheck, arrayptr, nullval, status); *nread = *nread + (trc[1] - blc[1] + 1) * naxes[0]; if (lastcoord[1] + 1 == trc[1]) return(*status); /* finished */ /* increment pointers for the last partial row */ arrayptr = arrayptr + (trc[1] - blc[1] + 1) * naxes[0] * bytesperpixel; } if (trc[1] == lastcoord[1] + 1) return(*status); /* all done */ /* set starting and ending coord to last line */ trc[0] = lastcoord[0] + 1; trc[1] = lastcoord[1] + 1; blc[1] = trc[1]; fits_write_compressed_img(fptr, datatype, blc, trc, nullcheck, arrayptr, nullval, status); *nread = *nread + trc[0] - blc[0] + 1; return(*status); } /* ######################################################################## */ /* ### Image Decompression Routines ### */ /* ######################################################################## */ /*--------------------------------------------------------------------------*/ int fits_img_decompress (fitsfile *infptr, /* image (bintable) to uncompress */ fitsfile *outfptr, /* empty HDU for output uncompressed image */ int *status) /* IO - error status */ /* This routine decompresses the whole image and writes it to the output file. */ { int ii, datatype = 0; int nullcheck, anynul; LONGLONG fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM]; long inc[MAX_COMPRESS_DIM]; long imgsize; float *nulladdr, fnulval; double dnulval; if (fits_img_decompress_header(infptr, outfptr, status) > 0) { return (*status); } /* force a rescan of the output header keywords, then reset the scaling */ /* in case the BSCALE and BZERO keywords are present, so that the */ /* decompressed values won't be scaled when written to the output image */ ffrdef(outfptr, status); ffpscl(outfptr, 1.0, 0.0, status); ffpscl(infptr, 1.0, 0.0, status); /* initialize; no null checking is needed for integer images */ nullcheck = 0; nulladdr = &fnulval; /* determine datatype for image */ if ((infptr->Fptr)->zbitpix == BYTE_IMG) { datatype = TBYTE; } else if ((infptr->Fptr)->zbitpix == SHORT_IMG) { datatype = TSHORT; } else if ((infptr->Fptr)->zbitpix == LONG_IMG) { datatype = TINT; } else if ((infptr->Fptr)->zbitpix == FLOAT_IMG) { /* In the case of float images we must check for NaNs */ nullcheck = 1; fnulval = FLOATNULLVALUE; nulladdr = &fnulval; datatype = TFLOAT; } else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG) { /* In the case of double images we must check for NaNs */ nullcheck = 1; dnulval = DOUBLENULLVALUE; nulladdr = (float *) &dnulval; datatype = TDOUBLE; } /* calculate size of the image (in pixels) */ imgsize = 1; for (ii = 0; ii < (infptr->Fptr)->zndim; ii++) { imgsize *= (infptr->Fptr)->znaxis[ii]; fpixel[ii] = 1; /* Set first and last pixel to */ lpixel[ii] = (infptr->Fptr)->znaxis[ii]; /* include the entire image. */ inc[ii] = 1; } /* uncompress the input image and write to output image, one tile at a time */ fits_read_write_compressed_img(infptr, datatype, fpixel, lpixel, inc, nullcheck, nulladdr, &anynul, outfptr, status); return (*status); } /*--------------------------------------------------------------------------*/ int fits_decompress_img (fitsfile *infptr, /* image (bintable) to uncompress */ fitsfile *outfptr, /* empty HDU for output uncompressed image */ int *status) /* IO - error status */ /* THIS IS AN OBSOLETE ROUTINE. USE fits_img_decompress instead!!! This routine decompresses the whole image and writes it to the output file. */ { double *data; int ii, datatype = 0, byte_per_pix = 0; int nullcheck, anynul; LONGLONG fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM]; long inc[MAX_COMPRESS_DIM]; long imgsize, memsize; float *nulladdr, fnulval; double dnulval; if (*status > 0) return(*status); if (!fits_is_compressed_image(infptr, status) ) { ffpmsg("CHDU is not a compressed image (fits_decompress_img)"); return(*status = DATA_DECOMPRESSION_ERR); } /* create an empty output image with the correct dimensions */ if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, (infptr->Fptr)->znaxis, status) > 0) { ffpmsg("error creating output decompressed image HDU"); return (*status); } /* Copy the table header to the image header. */ if (imcomp_copy_imheader(infptr, outfptr, status) > 0) { ffpmsg("error copying header of compressed image"); return (*status); } /* force a rescan of the output header keywords, then reset the scaling */ /* in case the BSCALE and BZERO keywords are present, so that the */ /* decompressed values won't be scaled when written to the output image */ ffrdef(outfptr, status); ffpscl(outfptr, 1.0, 0.0, status); ffpscl(infptr, 1.0, 0.0, status); /* initialize; no null checking is needed for integer images */ nullcheck = 0; nulladdr = &fnulval; /* determine datatype for image */ if ((infptr->Fptr)->zbitpix == BYTE_IMG) { datatype = TBYTE; byte_per_pix = 1; } else if ((infptr->Fptr)->zbitpix == SHORT_IMG) { datatype = TSHORT; byte_per_pix = sizeof(short); } else if ((infptr->Fptr)->zbitpix == LONG_IMG) { datatype = TINT; byte_per_pix = sizeof(int); } else if ((infptr->Fptr)->zbitpix == FLOAT_IMG) { /* In the case of float images we must check for NaNs */ nullcheck = 1; fnulval = FLOATNULLVALUE; nulladdr = &fnulval; datatype = TFLOAT; byte_per_pix = sizeof(float); } else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG) { /* In the case of double images we must check for NaNs */ nullcheck = 1; dnulval = DOUBLENULLVALUE; nulladdr = (float *) &dnulval; datatype = TDOUBLE; byte_per_pix = sizeof(double); } /* calculate size of the image (in pixels) */ imgsize = 1; for (ii = 0; ii < (infptr->Fptr)->zndim; ii++) { imgsize *= (infptr->Fptr)->znaxis[ii]; fpixel[ii] = 1; /* Set first and last pixel to */ lpixel[ii] = (infptr->Fptr)->znaxis[ii]; /* include the entire image. */ inc[ii] = 1; } /* Calc equivalent number of double pixels same size as whole the image. */ /* We use double datatype to force the memory to be aligned properly */ memsize = ((imgsize * byte_per_pix) - 1) / sizeof(double) + 1; /* allocate memory for the image */ data = (double*) calloc (memsize, sizeof(double)); if (!data) { ffpmsg("Couldn't allocate memory for the uncompressed image"); return(*status = MEMORY_ALLOCATION); } /* uncompress the entire image into memory */ /* This routine should be enhanced sometime to only need enough */ /* memory to uncompress one tile at a time. */ fits_read_compressed_img(infptr, datatype, fpixel, lpixel, inc, nullcheck, nulladdr, data, NULL, &anynul, status); /* write the image to the output file */ if (anynul) fits_write_imgnull(outfptr, datatype, 1, imgsize, data, nulladdr, status); else fits_write_img(outfptr, datatype, 1, imgsize, data, status); free(data); return (*status); } /*--------------------------------------------------------------------------*/ int fits_img_decompress_header(fitsfile *infptr, /* image (bintable) to uncompress */ fitsfile *outfptr, /* empty HDU for output uncompressed image */ int *status) /* IO - error status */ /* This routine reads the header of the input tile compressed image and converts it to that of a standard uncompress FITS image. */ { int writeprime = 0; int hdupos, inhdupos, numkeys; int nullprime = 0, copyprime = 0, norec = 0, tstatus; char card[FLEN_CARD]; int ii, datatype = 0, naxis, bitpix; long naxes[MAX_COMPRESS_DIM]; if (*status > 0) return(*status); else if (*status == -1) { *status = 0; writeprime = 1; } if (!fits_is_compressed_image(infptr, status) ) { ffpmsg("CHDU is not a compressed image (fits_img_decompress)"); return(*status = DATA_DECOMPRESSION_ERR); } /* get information about the state of the output file; does it already */ /* contain any keywords and HDUs? */ fits_get_hdu_num(infptr, &inhdupos); /* Get the current output HDU position */ fits_get_hdu_num(outfptr, &hdupos); /* Get the current output HDU position */ fits_get_hdrspace(outfptr, &numkeys, 0, status); /* Was the input compressed HDU originally the primary array image? */ tstatus = 0; if (!fits_read_card(infptr, "ZSIMPLE", card, &tstatus)) { /* yes, input HDU was a primary array (not an IMAGE extension) */ /* Now determine if we can uncompress it into the primary array of */ /* the output file. This is only possible if the output file */ /* currently only contains a null primary array, with no addition */ /* header keywords and with no following extension in the FITS file. */ if (hdupos == 1) { /* are we positioned at the primary array? */ if (numkeys == 0) { /* primary HDU is completely empty */ nullprime = 1; } else { fits_get_img_param(outfptr, MAX_COMPRESS_DIM, &bitpix, &naxis, naxes, status); if (naxis == 0) { /* is this a null image? */ nullprime = 1; if (inhdupos == 2) /* must be at the first extension */ copyprime = 1; } } } } if (nullprime) { /* We will delete the existing keywords in the null primary array and uncompress the input image into the primary array of the output. Some of these keywords may be added back to the uncompressed image header later. */ for (ii = numkeys; ii > 0; ii--) fits_delete_record(outfptr, ii, status); } else { /* if the ZTENSION keyword doesn't exist, then we have to write the required keywords manually */ tstatus = 0; if (fits_read_card(infptr, "ZTENSION", card, &tstatus)) { /* create an empty output image with the correct dimensions */ if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, (infptr->Fptr)->znaxis, status) > 0) { ffpmsg("error creating output decompressed image HDU"); return (*status); } norec = 1; /* the required keywords have already been written */ } else { /* the input compressed image does have ZTENSION keyword */ if (writeprime) { /* convert the image extension to a primary array */ /* have to write the required keywords manually */ /* create an empty output image with the correct dimensions */ if (ffcrim(outfptr, (infptr->Fptr)->zbitpix, (infptr->Fptr)->zndim, (infptr->Fptr)->znaxis, status) > 0) { ffpmsg("error creating output decompressed image HDU"); return (*status); } norec = 1; /* the required keywords have already been written */ } else { /* write the input compressed image to an image extension */ if (numkeys == 0) { /* the output file is currently completely empty */ /* In this case, the input is a compressed IMAGE extension. */ /* Since the uncompressed output file is currently completely empty, */ /* we need to write a null primary array before uncompressing the */ /* image extension */ ffcrim(outfptr, 8, 0, naxes, status); /* naxes is not used */ /* now create the empty extension to uncompress into */ if (fits_create_hdu(outfptr, status) > 0) { ffpmsg("error creating output decompressed image HDU"); return (*status); } } else { /* just create a new empty extension, then copy all the required */ /* keywords into it. */ fits_create_hdu(outfptr, status); } } } } if (*status > 0) { ffpmsg("error creating output decompressed image HDU"); return (*status); } /* Copy the table header to the image header. */ if (imcomp_copy_comp2img(infptr, outfptr, norec, status) > 0) { ffpmsg("error copying header keywords from compressed image"); } if (copyprime) { /* append any unexpected keywords from the primary array. This includes any keywords except SIMPLE, BITPIX, NAXIS, EXTEND, COMMENT, HISTORY, CHECKSUM, and DATASUM. */ fits_movabs_hdu(infptr, 1, NULL, status); /* move to primary array */ /* do this so that any new keywords get written before any blank keywords that may have been appended by imcomp_copy_comp2img */ fits_set_hdustruc(outfptr, status); if (imcomp_copy_prime2img(infptr, outfptr, status) > 0) { ffpmsg("error copying primary keywords from compressed file"); } fits_movabs_hdu(infptr, 2, NULL, status); /* move back to where we were */ } return (*status); } /*---------------------------------------------------------------------------*/ int fits_read_compressed_img(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be returned */ LONGLONG *infpixel, /* I - 'bottom left corner' of the subsection */ LONGLONG *inlpixel, /* I - 'top right corner' of the subsection */ long *ininc, /* I - increment to be applied in each dimension */ int nullcheck, /* I - 0 for no null checking */ /* 1: set undefined pixels = nullval */ /* 2: set nullarray=1 for undefined pixels */ void *nullval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - array of flags = 1 if nullcheck = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a section of a compressed image; Note: lpixel may be larger than the size of the uncompressed image. Only the pixels within the image will be returned. */ { long naxis[MAX_COMPRESS_DIM], tiledim[MAX_COMPRESS_DIM]; long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM]; long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM]; long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM]; long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp; long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM]; long inc[MAX_COMPRESS_DIM]; long i5, i4, i3, i2, i1, i0, irow; int ii, ndim, pixlen, tilenul; void *buffer; char *bnullarray = 0; double testnullval = 0.; if (*status > 0) return(*status); if (!fits_is_compressed_image(fptr, status) ) { ffpmsg("CHDU is not a compressed image (fits_read_compressed_img)"); return(*status = DATA_DECOMPRESSION_ERR); } /* get temporary space for uncompressing one image tile */ if (datatype == TSHORT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (short)); pixlen = sizeof(short); if (nullval) testnullval = *(short *) nullval; } else if (datatype == TINT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (int)); pixlen = sizeof(int); if (nullval) testnullval = *(int *) nullval; } else if (datatype == TLONG) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (long)); pixlen = sizeof(long); if (nullval) testnullval = *(long *) nullval; } else if (datatype == TFLOAT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (float)); pixlen = sizeof(float); if (nullval) testnullval = *(float *) nullval; } else if (datatype == TDOUBLE) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (double)); pixlen = sizeof(double); if (nullval) testnullval = *(double *) nullval; } else if (datatype == TUSHORT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned short)); pixlen = sizeof(short); if (nullval) testnullval = *(unsigned short *) nullval; } else if (datatype == TUINT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned int)); pixlen = sizeof(int); if (nullval) testnullval = *(unsigned int *) nullval; } else if (datatype == TULONG) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned long)); pixlen = sizeof(long); if (nullval) testnullval = *(unsigned long *) nullval; } else if (datatype == TBYTE || datatype == TSBYTE) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (char)); pixlen = 1; if (nullval) testnullval = *(unsigned char *) nullval; } else { ffpmsg("unsupported datatype for uncompressing image"); return(*status = BAD_DATATYPE); } /* If nullcheck ==1 and nullval == 0, then this means that the */ /* calling routine does not want to check for null pixels in the array */ if (nullcheck == 1 && testnullval == 0.) nullcheck = 0; if (buffer == NULL) { ffpmsg("Out of memory (fits_read_compress_img)"); return (*status = MEMORY_ALLOCATION); } /* allocate memory for a null flag array, if needed */ if (nullcheck == 2) { bnullarray = calloc ((fptr->Fptr)->maxtilelen, sizeof (char)); if (bnullarray == NULL) { ffpmsg("Out of memory (fits_read_compress_img)"); free(buffer); return (*status = MEMORY_ALLOCATION); } } /* initialize all the arrays */ for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { naxis[ii] = 1; tiledim[ii] = 1; tilesize[ii] = 1; ftile[ii] = 1; ltile[ii] = 1; rowdim[ii] = 1; } ndim = (fptr->Fptr)->zndim; ntemp = 1; for (ii = 0; ii < ndim; ii++) { /* support for mirror-reversed image sections */ if (infpixel[ii] <= inlpixel[ii]) { fpixel[ii] = (long) infpixel[ii]; lpixel[ii] = (long) inlpixel[ii]; inc[ii] = ininc[ii]; } else { fpixel[ii] = (long) inlpixel[ii]; lpixel[ii] = (long) infpixel[ii]; inc[ii] = -ininc[ii]; } /* calc number of tiles in each dimension, and tile containing */ /* the first and last pixel we want to read in each dimension */ naxis[ii] = (fptr->Fptr)->znaxis[ii]; if (fpixel[ii] < 1) { if (nullcheck == 2) { free(bnullarray); } free(buffer); return(*status = BAD_PIX_NUM); } tilesize[ii] = (fptr->Fptr)->tilesize[ii]; tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1; ftile[ii] = (fpixel[ii] - 1) / tilesize[ii] + 1; ltile[ii] = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, tiledim[ii]); rowdim[ii] = ntemp; /* total tiles in each dimension */ ntemp *= tiledim[ii]; } if (anynul) *anynul = 0; /* initialize */ /* support up to 6 dimensions for now */ /* tfpixel and tlpixel are the first and last image pixels */ /* along each dimension of the compression tile */ for (i5 = ftile[5]; i5 <= ltile[5]; i5++) { tfpixel[5] = (i5 - 1) * tilesize[5] + 1; tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, naxis[5]); thistilesize[5] = tlpixel[5] - tfpixel[5] + 1; offset[5] = (i5 - 1) * rowdim[5]; for (i4 = ftile[4]; i4 <= ltile[4]; i4++) { tfpixel[4] = (i4 - 1) * tilesize[4] + 1; tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, naxis[4]); thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1); offset[4] = (i4 - 1) * rowdim[4] + offset[5]; for (i3 = ftile[3]; i3 <= ltile[3]; i3++) { tfpixel[3] = (i3 - 1) * tilesize[3] + 1; tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, naxis[3]); thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1); offset[3] = (i3 - 1) * rowdim[3] + offset[4]; for (i2 = ftile[2]; i2 <= ltile[2]; i2++) { tfpixel[2] = (i2 - 1) * tilesize[2] + 1; tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, naxis[2]); thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1); offset[2] = (i2 - 1) * rowdim[2] + offset[3]; for (i1 = ftile[1]; i1 <= ltile[1]; i1++) { tfpixel[1] = (i1 - 1) * tilesize[1] + 1; tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, naxis[1]); thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1); offset[1] = (i1 - 1) * rowdim[1] + offset[2]; for (i0 = ftile[0]; i0 <= ltile[0]; i0++) { tfpixel[0] = (i0 - 1) * tilesize[0] + 1; tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, naxis[0]); thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1); /* calculate row of table containing this tile */ irow = i0 + offset[1]; /* printf("row %d, %d %d, %d %d, %d %d; %d\n", irow, tfpixel[0],tlpixel[0],tfpixel[1],tlpixel[1],tfpixel[2],tlpixel[2], thistilesize[0]); */ /* test if there are any intersecting pixels in this tile and the output image */ if (imcomp_test_overlap(ndim, tfpixel, tlpixel, fpixel, lpixel, inc, status)) { /* read and uncompress this row (tile) of the table */ /* also do type conversion and undefined pixel substitution */ /* at this point */ imcomp_decompress_tile(fptr, irow, thistilesize[0], datatype, nullcheck, nullval, buffer, bnullarray, &tilenul, status); if (tilenul && anynul) *anynul = 1; /* there are null pixels */ /* printf(" pixlen=%d, ndim=%d, %d %d %d, %d %d %d, %d %d %d\n", pixlen, ndim, fpixel[0],lpixel[0],inc[0],fpixel[1],lpixel[1],inc[1], fpixel[2],lpixel[2],inc[2]); */ /* copy the intersecting pixels from this tile to the output */ imcomp_copy_overlap(buffer, pixlen, ndim, tfpixel, tlpixel, bnullarray, array, fpixel, lpixel, inc, nullcheck, nullarray, status); } } } } } } } if (nullcheck == 2) { free(bnullarray); } free(buffer); return(*status); } /*---------------------------------------------------------------------------*/ int fits_read_write_compressed_img(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be returned */ LONGLONG *infpixel, /* I - 'bottom left corner' of the subsection */ LONGLONG *inlpixel, /* I - 'top right corner' of the subsection */ long *ininc, /* I - increment to be applied in each dimension */ int nullcheck, /* I - 0 for no null checking */ /* 1: set undefined pixels = nullval */ void *nullval, /* I - value for undefined pixels */ int *anynul, /* O - set to 1 if any values are null; else 0 */ fitsfile *outfptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* This is similar to fits_read_compressed_img, except that it writes the pixels to the output image, on a tile by tile basis instead of returning the array. */ { long naxis[MAX_COMPRESS_DIM], tiledim[MAX_COMPRESS_DIM]; long tilesize[MAX_COMPRESS_DIM], thistilesize[MAX_COMPRESS_DIM]; long ftile[MAX_COMPRESS_DIM], ltile[MAX_COMPRESS_DIM]; long tfpixel[MAX_COMPRESS_DIM], tlpixel[MAX_COMPRESS_DIM]; long rowdim[MAX_COMPRESS_DIM], offset[MAX_COMPRESS_DIM],ntemp; long fpixel[MAX_COMPRESS_DIM], lpixel[MAX_COMPRESS_DIM]; long inc[MAX_COMPRESS_DIM]; long i5, i4, i3, i2, i1, i0, irow; int ii, ndim, pixlen, tilenul; void *buffer; char *bnullarray = 0; double testnullval = 0.; LONGLONG firstelem; if (*status > 0) return(*status); if (!fits_is_compressed_image(fptr, status) ) { ffpmsg("CHDU is not a compressed image (fits_read_compressed_img)"); return(*status = DATA_DECOMPRESSION_ERR); } /* get temporary space for uncompressing one image tile */ if (datatype == TSHORT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (short)); pixlen = sizeof(short); if (nullval) testnullval = *(short *) nullval; } else if (datatype == TINT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (int)); pixlen = sizeof(int); if (nullval) testnullval = *(int *) nullval; } else if (datatype == TLONG) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (long)); pixlen = sizeof(long); if (nullval) testnullval = *(long *) nullval; } else if (datatype == TFLOAT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (float)); pixlen = sizeof(float); if (nullval) testnullval = *(float *) nullval; } else if (datatype == TDOUBLE) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (double)); pixlen = sizeof(double); if (nullval) testnullval = *(double *) nullval; } else if (datatype == TUSHORT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned short)); pixlen = sizeof(short); if (nullval) testnullval = *(unsigned short *) nullval; } else if (datatype == TUINT) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned int)); pixlen = sizeof(int); if (nullval) testnullval = *(unsigned int *) nullval; } else if (datatype == TULONG) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (unsigned long)); pixlen = sizeof(long); if (nullval) testnullval = *(unsigned long *) nullval; } else if (datatype == TBYTE || datatype == TSBYTE) { buffer = malloc ((fptr->Fptr)->maxtilelen * sizeof (char)); pixlen = 1; if (nullval) testnullval = *(unsigned char *) nullval; } else { ffpmsg("unsupported datatype for uncompressing image"); return(*status = BAD_DATATYPE); } /* If nullcheck ==1 and nullval == 0, then this means that the */ /* calling routine does not want to check for null pixels in the array */ if (nullcheck == 1 && testnullval == 0.) nullcheck = 0; if (buffer == NULL) { ffpmsg("Out of memory (fits_read_compress_img)"); return (*status = MEMORY_ALLOCATION); } /* initialize all the arrays */ for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { naxis[ii] = 1; tiledim[ii] = 1; tilesize[ii] = 1; ftile[ii] = 1; ltile[ii] = 1; rowdim[ii] = 1; } ndim = (fptr->Fptr)->zndim; ntemp = 1; for (ii = 0; ii < ndim; ii++) { /* support for mirror-reversed image sections */ if (infpixel[ii] <= inlpixel[ii]) { fpixel[ii] = (long) infpixel[ii]; lpixel[ii] = (long) inlpixel[ii]; inc[ii] = ininc[ii]; } else { fpixel[ii] = (long) inlpixel[ii]; lpixel[ii] = (long) infpixel[ii]; inc[ii] = -ininc[ii]; } /* calc number of tiles in each dimension, and tile containing */ /* the first and last pixel we want to read in each dimension */ naxis[ii] = (fptr->Fptr)->znaxis[ii]; if (fpixel[ii] < 1) { free(buffer); return(*status = BAD_PIX_NUM); } tilesize[ii] = (fptr->Fptr)->tilesize[ii]; tiledim[ii] = (naxis[ii] - 1) / tilesize[ii] + 1; ftile[ii] = (fpixel[ii] - 1) / tilesize[ii] + 1; ltile[ii] = minvalue((lpixel[ii] - 1) / tilesize[ii] + 1, tiledim[ii]); rowdim[ii] = ntemp; /* total tiles in each dimension */ ntemp *= tiledim[ii]; } if (anynul) *anynul = 0; /* initialize */ firstelem = 1; /* support up to 6 dimensions for now */ /* tfpixel and tlpixel are the first and last image pixels */ /* along each dimension of the compression tile */ for (i5 = ftile[5]; i5 <= ltile[5]; i5++) { tfpixel[5] = (i5 - 1) * tilesize[5] + 1; tlpixel[5] = minvalue(tfpixel[5] + tilesize[5] - 1, naxis[5]); thistilesize[5] = tlpixel[5] - tfpixel[5] + 1; offset[5] = (i5 - 1) * rowdim[5]; for (i4 = ftile[4]; i4 <= ltile[4]; i4++) { tfpixel[4] = (i4 - 1) * tilesize[4] + 1; tlpixel[4] = minvalue(tfpixel[4] + tilesize[4] - 1, naxis[4]); thistilesize[4] = thistilesize[5] * (tlpixel[4] - tfpixel[4] + 1); offset[4] = (i4 - 1) * rowdim[4] + offset[5]; for (i3 = ftile[3]; i3 <= ltile[3]; i3++) { tfpixel[3] = (i3 - 1) * tilesize[3] + 1; tlpixel[3] = minvalue(tfpixel[3] + tilesize[3] - 1, naxis[3]); thistilesize[3] = thistilesize[4] * (tlpixel[3] - tfpixel[3] + 1); offset[3] = (i3 - 1) * rowdim[3] + offset[4]; for (i2 = ftile[2]; i2 <= ltile[2]; i2++) { tfpixel[2] = (i2 - 1) * tilesize[2] + 1; tlpixel[2] = minvalue(tfpixel[2] + tilesize[2] - 1, naxis[2]); thistilesize[2] = thistilesize[3] * (tlpixel[2] - tfpixel[2] + 1); offset[2] = (i2 - 1) * rowdim[2] + offset[3]; for (i1 = ftile[1]; i1 <= ltile[1]; i1++) { tfpixel[1] = (i1 - 1) * tilesize[1] + 1; tlpixel[1] = minvalue(tfpixel[1] + tilesize[1] - 1, naxis[1]); thistilesize[1] = thistilesize[2] * (tlpixel[1] - tfpixel[1] + 1); offset[1] = (i1 - 1) * rowdim[1] + offset[2]; for (i0 = ftile[0]; i0 <= ltile[0]; i0++) { tfpixel[0] = (i0 - 1) * tilesize[0] + 1; tlpixel[0] = minvalue(tfpixel[0] + tilesize[0] - 1, naxis[0]); thistilesize[0] = thistilesize[1] * (tlpixel[0] - tfpixel[0] + 1); /* calculate row of table containing this tile */ irow = i0 + offset[1]; /* read and uncompress this row (tile) of the table */ /* also do type conversion and undefined pixel substitution */ /* at this point */ imcomp_decompress_tile(fptr, irow, thistilesize[0], datatype, nullcheck, nullval, buffer, bnullarray, &tilenul, status); /* write the image to the output file */ if (tilenul && anynul) { /* this assumes that the tiled pixels are in the same order as in the uncompressed FITS image. This is not necessarily the case, but it almost alway is in practice. Note that null checking is not performed for integer images, so this could only be a problem for tile compressed floating point images that use an unconventional tiling pattern. */ fits_write_imgnull(outfptr, datatype, firstelem, thistilesize[0], buffer, nullval, status); } else { fits_write_subset(outfptr, datatype, tfpixel, tlpixel, buffer, status); } firstelem += thistilesize[0]; } } } } } } free(buffer); return(*status); } /*--------------------------------------------------------------------------*/ int fits_read_compressed_pixels(fitsfile *fptr, /* I - FITS file pointer */ int datatype, /* I - datatype of the array to be returned */ LONGLONG fpixel, /* I - 'first pixel to read */ LONGLONG npixel, /* I - number of pixels to read */ int nullcheck, /* I - 0 for no null checking */ /* 1: set undefined pixels = nullval */ /* 2: set nullarray=1 for undefined pixels */ void *nullval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - array of flags = 1 if nullcheck = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a consecutive set of pixels from a compressed image. This routine interpretes the n-dimensional image as a long one-dimensional array. This is actually a rather inconvenient way to read compressed images in general, and could be rather inefficient if the requested pixels to be read are located in many different image compression tiles. The general strategy used here is to read the requested pixels in blocks that correspond to rectangular image sections. */ { int naxis, ii, bytesperpixel, planenul; long naxes[MAX_COMPRESS_DIM], nread; long nplane, inc[MAX_COMPRESS_DIM]; LONGLONG tfirst, tlast, last0, last1, dimsize[MAX_COMPRESS_DIM]; LONGLONG firstcoord[MAX_COMPRESS_DIM], lastcoord[MAX_COMPRESS_DIM]; char *arrayptr, *nullarrayptr; if (*status > 0) return(*status); arrayptr = (char *) array; nullarrayptr = nullarray; /* get size of array pixels, in bytes */ bytesperpixel = ffpxsz(datatype); for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { naxes[ii] = 1; firstcoord[ii] = 0; lastcoord[ii] = 0; inc[ii] = 1; } /* determine the dimensions of the image to be read */ ffgidm(fptr, &naxis, status); ffgisz(fptr, MAX_COMPRESS_DIM, naxes, status); /* calc the cumulative number of pixels in each successive dimension */ dimsize[0] = 1; for (ii = 1; ii < MAX_COMPRESS_DIM; ii++) dimsize[ii] = dimsize[ii - 1] * naxes[ii - 1]; /* determine the coordinate of the first and last pixel in the image */ /* Use zero based indexes here */ tfirst = fpixel - 1; tlast = tfirst + npixel - 1; for (ii = naxis - 1; ii >= 0; ii--) { firstcoord[ii] = tfirst / dimsize[ii]; lastcoord[ii] = tlast / dimsize[ii]; tfirst = tfirst - firstcoord[ii] * dimsize[ii]; tlast = tlast - lastcoord[ii] * dimsize[ii]; } /* to simplify things, treat 1-D, 2-D, and 3-D images as separate cases */ if (naxis == 1) { /* Simple: just read the requested range of pixels */ firstcoord[0] = firstcoord[0] + 1; lastcoord[0] = lastcoord[0] + 1; fits_read_compressed_img(fptr, datatype, firstcoord, lastcoord, inc, nullcheck, nullval, array, nullarray, anynul, status); return(*status); } else if (naxis == 2) { nplane = 0; /* read 1st (and only) plane of the image */ fits_read_compressed_img_plane(fptr, datatype, bytesperpixel, nplane, firstcoord, lastcoord, inc, naxes, nullcheck, nullval, array, nullarray, anynul, &nread, status); } else if (naxis == 3) { /* test for special case: reading an integral number of planes */ if (firstcoord[0] == 0 && firstcoord[1] == 0 && lastcoord[0] == naxes[0] - 1 && lastcoord[1] == naxes[1] - 1) { for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { /* convert from zero base to 1 base */ (firstcoord[ii])++; (lastcoord[ii])++; } /* we can read the contiguous block of pixels in one go */ fits_read_compressed_img(fptr, datatype, firstcoord, lastcoord, inc, nullcheck, nullval, array, nullarray, anynul, status); return(*status); } if (anynul) *anynul = 0; /* initialize */ /* save last coordinate in temporary variables */ last0 = lastcoord[0]; last1 = lastcoord[1]; if (firstcoord[2] < lastcoord[2]) { /* we will read up to the last pixel in all but the last plane */ lastcoord[0] = naxes[0] - 1; lastcoord[1] = naxes[1] - 1; } /* read one plane of the cube at a time, for simplicity */ for (nplane = (long) firstcoord[2]; nplane <= lastcoord[2]; nplane++) { if (nplane == lastcoord[2]) { lastcoord[0] = last0; lastcoord[1] = last1; } fits_read_compressed_img_plane(fptr, datatype, bytesperpixel, nplane, firstcoord, lastcoord, inc, naxes, nullcheck, nullval, arrayptr, nullarrayptr, &planenul, &nread, status); if (planenul && anynul) *anynul = 1; /* there are null pixels */ /* for all subsequent planes, we start with the first pixel */ firstcoord[0] = 0; firstcoord[1] = 0; /* increment pointers to next elements to be read */ arrayptr = arrayptr + nread * bytesperpixel; if (nullarrayptr && (nullcheck == 2) ) nullarrayptr = nullarrayptr + nread; } } else { ffpmsg("only 1D, 2D, or 3D images are currently supported"); return(*status = DATA_DECOMPRESSION_ERR); } return(*status); } /*--------------------------------------------------------------------------*/ int fits_read_compressed_img_plane(fitsfile *fptr, /* I - FITS file */ int datatype, /* I - datatype of the array to be returned */ int bytesperpixel, /* I - number of bytes per pixel in array */ long nplane, /* I - which plane of the cube to read */ LONGLONG *firstcoord, /* coordinate of first pixel to read */ LONGLONG *lastcoord, /* coordinate of last pixel to read */ long *inc, /* increment of pixels to read */ long *naxes, /* size of each image dimension */ int nullcheck, /* I - 0 for no null checking */ /* 1: set undefined pixels = nullval */ /* 2: set nullarray=1 for undefined pixels */ void *nullval, /* I - value for undefined pixels */ void *array, /* O - array of values that are returned */ char *nullarray, /* O - array of flags = 1 if nullcheck = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ long *nread, /* O - total number of pixels read and returned*/ int *status) /* IO - error status */ /* in general we have to read the first partial row of the image, followed by the middle complete rows, followed by the last partial row of the image. If the first or last rows are complete, then read them at the same time as all the middle rows. */ { /* bottom left coord. and top right coord. */ LONGLONG blc[MAX_COMPRESS_DIM], trc[MAX_COMPRESS_DIM]; char *arrayptr, *nullarrayptr; int tnull; if (anynul) *anynul = 0; *nread = 0; arrayptr = (char *) array; nullarrayptr = nullarray; blc[2] = nplane + 1; trc[2] = nplane + 1; if (firstcoord[0] != 0) { /* have to read a partial first row */ blc[0] = firstcoord[0] + 1; blc[1] = firstcoord[1] + 1; trc[1] = blc[1]; if (lastcoord[1] == firstcoord[1]) trc[0] = lastcoord[0] + 1; /* 1st and last pixels in same row */ else trc[0] = naxes[0]; /* read entire rest of the row */ fits_read_compressed_img(fptr, datatype, blc, trc, inc, nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status); *nread = *nread + (long) (trc[0] - blc[0] + 1); if (tnull && anynul) *anynul = 1; /* there are null pixels */ if (lastcoord[1] == firstcoord[1]) { return(*status); /* finished */ } /* set starting coord to beginning of next line */ firstcoord[0] = 0; firstcoord[1] += 1; arrayptr = arrayptr + (trc[0] - blc[0] + 1) * bytesperpixel; if (nullarrayptr && (nullcheck == 2) ) nullarrayptr = nullarrayptr + (trc[0] - blc[0] + 1); } /* read contiguous complete rows of the image, if any */ blc[0] = 1; blc[1] = firstcoord[1] + 1; trc[0] = naxes[0]; if (lastcoord[0] + 1 == naxes[0]) { /* can read the last complete row, too */ trc[1] = lastcoord[1] + 1; } else { /* last row is incomplete; have to read it separately */ trc[1] = lastcoord[1]; } if (trc[1] >= blc[1]) /* must have at least one whole line to read */ { fits_read_compressed_img(fptr, datatype, blc, trc, inc, nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status); *nread = *nread + (long) ((trc[1] - blc[1] + 1) * naxes[0]); if (tnull && anynul) *anynul = 1; if (lastcoord[1] + 1 == trc[1]) return(*status); /* finished */ /* increment pointers for the last partial row */ arrayptr = arrayptr + (trc[1] - blc[1] + 1) * naxes[0] * bytesperpixel; if (nullarrayptr && (nullcheck == 2) ) nullarrayptr = nullarrayptr + (trc[1] - blc[1] + 1) * naxes[0]; } if (trc[1] == lastcoord[1] + 1) return(*status); /* all done */ /* set starting and ending coord to last line */ trc[0] = lastcoord[0] + 1; trc[1] = lastcoord[1] + 1; blc[1] = trc[1]; fits_read_compressed_img(fptr, datatype, blc, trc, inc, nullcheck, nullval, arrayptr, nullarrayptr, &tnull, status); if (tnull && anynul) *anynul = 1; *nread = *nread + (long) (trc[0] - blc[0] + 1); return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_get_compressed_image_par(fitsfile *infptr, int *status) /* This routine reads keywords from a BINTABLE extension containing a compressed image. */ { char keyword[FLEN_KEYWORD]; char value[FLEN_VALUE]; int ii, tstatus, doffset; long expect_nrows, maxtilelen; if (*status > 0) return(*status); /* Copy relevant header keyword values to structure */ if (ffgky (infptr, TSTRING, "ZCMPTYPE", value, NULL, status) > 0) { ffpmsg("required ZCMPTYPE compression keyword not found in"); ffpmsg(" imcomp_get_compressed_image_par"); return(*status); } (infptr->Fptr)->zcmptype[0] = '\0'; strncat((infptr->Fptr)->zcmptype, value, 11); if (!FSTRCMP(value, "RICE_1") || !FSTRCMP(value, "RICE_ONE") ) (infptr->Fptr)->compress_type = RICE_1; else if (!FSTRCMP(value, "HCOMPRESS_1") ) (infptr->Fptr)->compress_type = HCOMPRESS_1; else if (!FSTRCMP(value, "GZIP_1") ) (infptr->Fptr)->compress_type = GZIP_1; else if (!FSTRCMP(value, "GZIP_2") ) (infptr->Fptr)->compress_type = GZIP_2; else if (!FSTRCMP(value, "BZIP2_1") ) (infptr->Fptr)->compress_type = BZIP2_1; else if (!FSTRCMP(value, "PLIO_1") ) (infptr->Fptr)->compress_type = PLIO_1; else if (!FSTRCMP(value, "NOCOMPRESS") ) (infptr->Fptr)->compress_type = NOCOMPRESS; else { ffpmsg("Unknown image compression type:"); ffpmsg(value); return (*status = DATA_DECOMPRESSION_ERR); } /* get the floating point to integer quantization type, if present. */ /* FITS files produced before 2009 will not have this keyword */ tstatus = 0; if (ffgky(infptr, TSTRING, "ZQUANTIZ", value, NULL, &tstatus) > 0) { (infptr->Fptr)->quantize_method = 0; } else { if (!FSTRCMP(value, "NONE") ) { (infptr->Fptr)->quantize_level = NO_QUANTIZE; } else if (!FSTRCMP(value, "SUBTRACTIVE_DITHER_1") ) (infptr->Fptr)->quantize_method = SUBTRACTIVE_DITHER_1; else if (!FSTRCMP(value, "SUBTRACTIVE_DITHER_2") ) (infptr->Fptr)->quantize_method = SUBTRACTIVE_DITHER_2; else if (!FSTRCMP(value, "NO_DITHER") ) (infptr->Fptr)->quantize_method = NO_DITHER; else (infptr->Fptr)->quantize_method = 0; } /* get the floating point quantization dithering offset, if present. */ /* FITS files produced before October 2009 will not have this keyword */ tstatus = 0; if (ffgky(infptr, TINT, "ZDITHER0", &doffset, NULL, &tstatus) > 0) { /* by default start with 1st element of random sequence */ (infptr->Fptr)->dither_seed = 1; } else { (infptr->Fptr)->dither_seed = doffset; } if (ffgky (infptr, TINT, "ZBITPIX", &(infptr->Fptr)->zbitpix, NULL, status) > 0) { ffpmsg("required ZBITPIX compression keyword not found"); return(*status); } if (ffgky (infptr,TINT, "ZNAXIS", &(infptr->Fptr)->zndim, NULL, status) > 0) { ffpmsg("required ZNAXIS compression keyword not found"); return(*status); } if ((infptr->Fptr)->zndim < 1) { ffpmsg("Compressed image has no data (ZNAXIS < 1)"); return (*status = BAD_NAXIS); } if ((infptr->Fptr)->zndim > MAX_COMPRESS_DIM) { ffpmsg("Compressed image has too many dimensions"); return(*status = BAD_NAXIS); } expect_nrows = 1; maxtilelen = 1; for (ii = 0; ii < (infptr->Fptr)->zndim; ii++) { /* get image size */ sprintf (keyword, "ZNAXIS%d", ii+1); ffgky (infptr, TLONG,keyword, &(infptr->Fptr)->znaxis[ii],NULL,status); if (*status > 0) { ffpmsg("required ZNAXISn compression keyword not found"); return(*status); } /* get compression tile size */ sprintf (keyword, "ZTILE%d", ii+1); /* set default tile size in case keywords are not present */ if (ii == 0) (infptr->Fptr)->tilesize[0] = (infptr->Fptr)->znaxis[0]; else (infptr->Fptr)->tilesize[ii] = 1; tstatus = 0; ffgky (infptr, TLONG, keyword, &(infptr->Fptr)->tilesize[ii], NULL, &tstatus); expect_nrows *= (((infptr->Fptr)->znaxis[ii] - 1) / (infptr->Fptr)->tilesize[ii]+ 1); maxtilelen *= (infptr->Fptr)->tilesize[ii]; } /* check number of rows */ if (expect_nrows != (infptr->Fptr)->numrows) { ffpmsg( "number of table rows != the number of tiles in compressed image"); return (*status = DATA_DECOMPRESSION_ERR); } /* read any algorithm specific parameters */ if ((infptr->Fptr)->compress_type == RICE_1 ) { if (ffgky(infptr, TINT,"ZVAL1", &(infptr->Fptr)->rice_blocksize, NULL, status) > 0) { ffpmsg("required ZVAL1 compression keyword not found"); return(*status); } tstatus = 0; if (ffgky(infptr, TINT,"ZVAL2", &(infptr->Fptr)->rice_bytepix, NULL, &tstatus) > 0) { (infptr->Fptr)->rice_bytepix = 4; /* default value */ } if ((infptr->Fptr)->rice_blocksize < 16 && (infptr->Fptr)->rice_bytepix > 8) { /* values are reversed */ tstatus = (infptr->Fptr)->rice_bytepix; (infptr->Fptr)->rice_bytepix = (infptr->Fptr)->rice_blocksize; (infptr->Fptr)->rice_blocksize = tstatus; } } else if ((infptr->Fptr)->compress_type == HCOMPRESS_1 ) { if (ffgky(infptr, TFLOAT,"ZVAL1", &(infptr->Fptr)->hcomp_scale, NULL, status) > 0) { ffpmsg("required ZVAL1 compression keyword not found"); return(*status); } tstatus = 0; ffgky(infptr, TINT,"ZVAL2", &(infptr->Fptr)->hcomp_smooth, NULL, &tstatus); } /* store number of pixels in each compression tile, */ /* and max size of the compressed tile buffer */ (infptr->Fptr)->maxtilelen = maxtilelen; (infptr->Fptr)->maxelem = imcomp_calc_max_elem ((infptr->Fptr)->compress_type, maxtilelen, (infptr->Fptr)->zbitpix, (infptr->Fptr)->rice_blocksize); /* Get Column numbers. */ if (ffgcno(infptr, CASEINSEN, "COMPRESSED_DATA", &(infptr->Fptr)->cn_compressed, status) > 0) { ffpmsg("couldn't find COMPRESSED_DATA column (fits_get_compressed_img_par)"); return(*status = DATA_DECOMPRESSION_ERR); } ffpmrk(); /* put mark on message stack; erase any messages after this */ tstatus = 0; ffgcno(infptr,CASEINSEN, "UNCOMPRESSED_DATA", &(infptr->Fptr)->cn_uncompressed, &tstatus); tstatus = 0; ffgcno(infptr,CASEINSEN, "GZIP_COMPRESSED_DATA", &(infptr->Fptr)->cn_gzip_data, &tstatus); tstatus = 0; if (ffgcno(infptr, CASEINSEN, "ZSCALE", &(infptr->Fptr)->cn_zscale, &tstatus) > 0) { /* CMPSCALE column doesn't exist; see if there is a keyword */ tstatus = 0; if (ffgky(infptr, TDOUBLE, "ZSCALE", &(infptr->Fptr)->zscale, NULL, &tstatus) <= 0) (infptr->Fptr)->cn_zscale = -1; /* flag for a constant ZSCALE */ } tstatus = 0; if (ffgcno(infptr, CASEINSEN, "ZZERO", &(infptr->Fptr)->cn_zzero, &tstatus) > 0) { /* CMPZERO column doesn't exist; see if there is a keyword */ tstatus = 0; if (ffgky(infptr, TDOUBLE, "ZZERO", &(infptr->Fptr)->zzero, NULL, &tstatus) <= 0) (infptr->Fptr)->cn_zzero = -1; /* flag for a constant ZZERO */ } tstatus = 0; if (ffgcno(infptr, CASEINSEN, "ZBLANK", &(infptr->Fptr)->cn_zblank, &tstatus) > 0) { /* ZBLANK column doesn't exist; see if there is a keyword */ tstatus = 0; if (ffgky(infptr, TINT, "ZBLANK", &(infptr->Fptr)->zblank, NULL, &tstatus) <= 0) { (infptr->Fptr)->cn_zblank = -1; /* flag for a constant ZBLANK */ } else { /* ZBLANK keyword doesn't exist; see if there is a BLANK keyword */ tstatus = 0; if (ffgky(infptr, TINT, "BLANK", &(infptr->Fptr)->zblank, NULL, &tstatus) <= 0) (infptr->Fptr)->cn_zblank = -1; /* flag for a constant ZBLANK */ } } /* read the conventional BSCALE and BZERO scaling keywords, if present */ tstatus = 0; if (ffgky (infptr, TDOUBLE, "BSCALE", &(infptr->Fptr)->cn_bscale, NULL, &tstatus) > 0) { (infptr->Fptr)->cn_bscale = 1.0; } tstatus = 0; if (ffgky (infptr, TDOUBLE, "BZERO", &(infptr->Fptr)->cn_bzero, NULL, &tstatus) > 0) { (infptr->Fptr)->cn_bzero = 0.0; (infptr->Fptr)->cn_actual_bzero = 0.0; } else { (infptr->Fptr)->cn_actual_bzero = (infptr->Fptr)->cn_bzero; } ffcmrk(); /* clear any spurious error messages, back to the mark */ return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr, int *status) /* This routine reads the header keywords from the input image and copies them to the output image; the manditory structural keywords and the checksum keywords are not copied. If the DATE keyword is copied, then it is updated with the current date and time. */ { int nkeys, ii, keyclass; char card[FLEN_CARD]; /* a header record */ if (*status > 0) return(*status); ffghsp(infptr, &nkeys, NULL, status); /* get number of keywords in image */ for (ii = 5; ii <= nkeys; ii++) /* skip the first 4 keywords */ { ffgrec(infptr, ii, card, status); keyclass = ffgkcl(card); /* Get the type/class of keyword */ /* don't copy structural keywords or checksum keywords */ if ((keyclass <= TYP_CMPRS_KEY) || (keyclass == TYP_CKSUM_KEY)) continue; if (FSTRNCMP(card, "DATE ", 5) == 0) /* write current date */ { ffpdat(outfptr, status); } else if (FSTRNCMP(card, "EXTNAME ", 8) == 0) { /* don't copy default EXTNAME keyword from a compressed image */ if (FSTRNCMP(card, "EXTNAME = 'COMPRESSED_IMAGE'", 28)) { /* if EXTNAME keyword already exists, overwrite it */ /* otherwise append a new EXTNAME keyword */ ffucrd(outfptr, "EXTNAME", card, status); } } else { /* just copy the keyword to the output header */ ffprec (outfptr, card, status); } if (*status > 0) return (*status); } return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status) /* This routine copies the header keywords from the uncompressed input image and to the compressed image (in a binary table) */ { char card[FLEN_CARD], card2[FLEN_CARD]; /* a header record */ int nkeys, nmore, ii, jj, tstatus, bitpix; /* tile compressed image keyword translation table */ /* INPUT OUTPUT */ /* 01234567 01234567 */ char *patterns[][2] = {{"SIMPLE", "ZSIMPLE" }, {"XTENSION", "ZTENSION" }, {"BITPIX", "ZBITPIX" }, {"NAXIS", "ZNAXIS" }, {"NAXISm", "ZNAXISm" }, {"EXTEND", "ZEXTEND" }, {"BLOCKED", "ZBLOCKED"}, {"PCOUNT", "ZPCOUNT" }, {"GCOUNT", "ZGCOUNT" }, {"CHECKSUM","ZHECKSUM"}, /* save original checksums */ {"DATASUM", "ZDATASUM"}, {"*", "+" }}; /* copy all other keywords */ int npat; if (*status > 0) return(*status); /* write a default EXTNAME keyword if it doesn't exist in input file*/ fits_read_card(infptr, "EXTNAME", card, status); if (*status) { *status = 0; strcpy(card, "EXTNAME = 'COMPRESSED_IMAGE'"); fits_write_record(outfptr, card, status); } /* copy all the keywords from the input file to the output */ npat = sizeof(patterns)/sizeof(patterns[0][0])/2; fits_translate_keywords(infptr, outfptr, 1, patterns, npat, 0, 0, 0, status); if ( (outfptr->Fptr)->request_lossy_int_compress != 0) { /* request was made to compress integer images as if they had float pixels. */ /* If input image has positive bitpix value, then reset the output ZBITPIX */ /* value to -32. */ fits_read_key(infptr, TINT, "BITPIX", &bitpix, NULL, status); if (*status <= 0 && bitpix > 0) { fits_modify_key_lng(outfptr, "ZBITPIX", -32, NULL, status); /* also delete the BSCALE, BZERO, and BLANK keywords */ tstatus = 0; fits_delete_key(outfptr, "BSCALE", &tstatus); tstatus = 0; fits_delete_key(outfptr, "BZERO", &tstatus); tstatus = 0; fits_delete_key(outfptr, "BLANK", &tstatus); } } /* For compatibility with software that uses an older version of CFITSIO, we must make certain that the new ZQUANTIZ keyword, if it exists, must occur after the other peudo-required keywords (e.g., ZSIMPLE, ZBITPIX, etc.). Do this by trying to delete the keyword. If that succeeds (and thus the keyword did exist) then rewrite the keyword at the end of header. In principle this should not be necessary once all software has upgraded to a newer version of CFITSIO (version number greater than 3.181, newer than August 2009). Do the same for the new ZDITHER0 keyword. */ tstatus = 0; if (fits_read_card(outfptr, "ZQUANTIZ", card, &tstatus) == 0) { fits_delete_key(outfptr, "ZQUANTIZ", status); /* rewrite the deleted keyword at the end of the header */ fits_write_record(outfptr, card, status); /* write some associated HISTORY keywords */ fits_parse_value(card, card2, NULL, status); if (strncasecmp(card2, "'NONE", 5) ) { /* the value is not 'NONE' */ fits_write_history(outfptr, "Image was compressed by CFITSIO using scaled integer quantization:", status); sprintf(card2, " q = %f / quantized level scaling parameter", (outfptr->Fptr)->request_quantize_level); fits_write_history(outfptr, card2, status); fits_write_history(outfptr, card+10, status); } } tstatus = 0; if (fits_read_card(outfptr, "ZDITHER0", card, &tstatus) == 0) { fits_delete_key(outfptr, "ZDITHER0", status); /* rewrite the deleted keyword at the end of the header */ fits_write_record(outfptr, card, status); } ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords in image */ nmore = nmore / 36; /* how many completely empty header blocks are there? */ /* preserve the same number of spare header blocks in the output header */ for (jj = 0; jj < nmore; jj++) for (ii = 0; ii < 36; ii++) fits_write_record(outfptr, " ", status); return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr, int norec, int *status) /* This routine copies the header keywords from the compressed input image and to the uncompressed image (in a binary table) */ { char card[FLEN_CARD]; /* a header record */ char *patterns[40][2]; char negative[] = "-"; int ii,jj, npat, nreq, nsp, tstatus = 0; int nkeys, nmore; /* tile compressed image keyword translation table */ /* INPUT OUTPUT */ /* 01234567 01234567 */ /* only translate these if required keywords not already written */ char *reqkeys[][2] = { {"ZSIMPLE", "SIMPLE" }, {"ZTENSION", "XTENSION"}, {"ZBITPIX", "BITPIX" }, {"ZNAXIS", "NAXIS" }, {"ZNAXISm", "NAXISm" }, {"ZEXTEND", "EXTEND" }, {"ZBLOCKED", "BLOCKED"}, {"ZPCOUNT", "PCOUNT" }, {"ZGCOUNT", "GCOUNT" }, {"ZHECKSUM", "CHECKSUM"}, /* restore original checksums */ {"ZDATASUM", "DATASUM"}}; /* other special keywords */ char *spkeys[][2] = { {"XTENSION", "-" }, {"BITPIX", "-" }, {"NAXIS", "-" }, {"NAXISm", "-" }, {"PCOUNT", "-" }, {"GCOUNT", "-" }, {"TFIELDS", "-" }, {"TTYPEm", "-" }, {"TFORMm", "-" }, {"ZIMAGE", "-" }, {"ZQUANTIZ", "-" }, {"ZDITHER0", "-" }, {"ZTILEm", "-" }, {"ZCMPTYPE", "-" }, {"ZBLANK", "-" }, {"ZNAMEm", "-" }, {"ZVALm", "-" }, {"CHECKSUM","-" }, /* delete checksums */ {"DATASUM", "-" }, {"EXTNAME", "+" }, /* we may change this, below */ {"*", "+" }}; if (*status > 0) return(*status); nreq = sizeof(reqkeys)/sizeof(reqkeys[0][0])/2; nsp = sizeof(spkeys)/sizeof(spkeys[0][0])/2; /* construct translation patterns */ for (ii = 0; ii < nreq; ii++) { patterns[ii][0] = reqkeys[ii][0]; if (norec) patterns[ii][1] = negative; else patterns[ii][1] = reqkeys[ii][1]; } for (ii = 0; ii < nsp; ii++) { patterns[ii+nreq][0] = spkeys[ii][0]; patterns[ii+nreq][1] = spkeys[ii][1]; } npat = nreq + nsp; /* see if the EXTNAME keyword should be copied or not */ fits_read_card(infptr, "EXTNAME", card, &tstatus); if (tstatus == 0) { if (!strncmp(card, "EXTNAME = 'COMPRESSED_IMAGE'", 28)) patterns[npat-2][1] = negative; } /* translate and copy the keywords from the input file to the output */ fits_translate_keywords(infptr, outfptr, 1, patterns, npat, 0, 0, 0, status); ffghsp(infptr, &nkeys, &nmore, status); /* get number of keywords in image */ nmore = nmore / 36; /* how many completely empty header blocks are there? */ /* preserve the same number of spare header blocks in the output header */ for (jj = 0; jj < nmore; jj++) for (ii = 0; ii < 36; ii++) fits_write_record(outfptr, " ", status); return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status) /* This routine copies any unexpected keywords from the primary array of the compressed input image into the header of the uncompressed image (which is the primary array of the output file). */ { int nsp; /* keywords that will not be copied */ char *spkeys[][2] = { {"SIMPLE", "-" }, {"BITPIX", "-" }, {"NAXIS", "-" }, {"NAXISm", "-" }, {"PCOUNT", "-" }, {"EXTEND", "-" }, {"GCOUNT", "-" }, {"CHECKSUM","-" }, {"DATASUM", "-" }, {"EXTNAME", "-" }, {"HISTORY", "-" }, {"COMMENT", "-" }, {"*", "+" }}; if (*status > 0) return(*status); nsp = sizeof(spkeys)/sizeof(spkeys[0][0])/2; /* translate and copy the keywords from the input file to the output */ fits_translate_keywords(infptr, outfptr, 1, spkeys, nsp, 0, 0, 0, status); return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_decompress_tile (fitsfile *infptr, int nrow, /* I - row of table to read and uncompress */ int tilelen, /* I - number of pixels in the tile */ int datatype, /* I - datatype to be returned in 'buffer' */ int nullcheck, /* I - 0 for no null checking */ void *nulval, /* I - value to be used for undefined pixels */ void *buffer, /* O - buffer for returned decompressed values */ char *bnullarray, /* O - buffer for returned null flags */ int *anynul, /* O - any null values returned? */ int *status) /* This routine decompresses one tile of the image */ { int *idata = 0; int tiledatatype, pixlen; /* uncompressed integer data */ size_t idatalen, tilebytesize; int ii, tnull; /* value in the data which represents nulls */ unsigned char *cbuf; /* compressed data */ unsigned char charnull = 0; short snull = 0; int blocksize, ntilebins, tilecol; float fnulval=0; float *tempfloat = 0; double dnulval=0; double bscale, bzero, actual_bzero, dummy = 0; /* scaling parameters */ long nelem = 0, offset = 0, tilesize; /* number of bytes */ int smooth, nx, ny, scale; /* hcompress parameters */ if (*status > 0) return(*status); /* **************************************************************** */ /* allocate pointers to array of cached uncompressed tiles, if not already done */ if ((infptr->Fptr)->tilerow == 0) { /* calculate number of column bins of compressed tile */ ntilebins = (((infptr->Fptr)->znaxis[0] - 1) / ((infptr->Fptr)->tilesize[0])) + 1; if ((infptr->Fptr)->znaxis[0] != (infptr->Fptr)->tilesize[0] || (infptr->Fptr)->tilesize[1] != 1 ) { /* don't cache the tile if only single row of the image */ (infptr->Fptr)->tilerow = (int *) calloc (ntilebins, sizeof(int)); (infptr->Fptr)->tiledata = (void**) calloc (ntilebins, sizeof(void*)); (infptr->Fptr)->tilenullarray = (void **) calloc (ntilebins, sizeof(char*)); (infptr->Fptr)->tiledatasize = (long *) calloc (ntilebins, sizeof(long)); (infptr->Fptr)->tiletype = (int *) calloc (ntilebins, sizeof(int)); (infptr->Fptr)->tileanynull = (int *) calloc (ntilebins, sizeof(int)); } } /* **************************************************************** */ /* check if this tile was cached; if so, just copy it out */ if ((infptr->Fptr)->tilerow) { /* calculate the column bin of the compressed tile */ tilecol = (nrow - 1) % ((long)(((infptr->Fptr)->znaxis[0] - 1) / ((infptr->Fptr)->tilesize[0])) + 1); if (nrow == (infptr->Fptr)->tilerow[tilecol] && datatype == (infptr->Fptr)->tiletype[tilecol] ) { memcpy(buffer, ((infptr->Fptr)->tiledata)[tilecol], (infptr->Fptr)->tiledatasize[tilecol]); if (nullcheck == 2) memcpy(bnullarray, (infptr->Fptr)->tilenullarray[tilecol], tilelen); *anynul = (infptr->Fptr)->tileanynull[tilecol]; return(*status); } } /* **************************************************************** */ /* get length of the compressed byte stream */ ffgdes (infptr, (infptr->Fptr)->cn_compressed, nrow, &nelem, &offset, status); /* EOF error here indicates that this tile has not yet been written */ if (*status == END_OF_FILE) return(*status = NO_COMPRESSED_TILE); /* **************************************************************** */ if (nelem == 0) /* special case: tile was not compressed normally */ { if ((infptr->Fptr)->cn_uncompressed >= 1 ) { /* This option of writing the uncompressed floating point data */ /* to the tile compressed file was used until about May 2011. */ /* This was replaced by the more efficient option of gzipping the */ /* floating point data before writing it to the tile-compressed file */ /* no compressed data, so simply read the uncompressed data */ /* directly from the UNCOMPRESSED_DATA column */ ffgdes (infptr, (infptr->Fptr)->cn_uncompressed, nrow, &nelem, &offset, status); if (nelem == 0 && offset == 0) /* this should never happen */ return (*status = NO_COMPRESSED_TILE); if (nullcheck <= 1) { /* set any null values in the array = nulval */ fits_read_col(infptr, datatype, (infptr->Fptr)->cn_uncompressed, nrow, 1, nelem, nulval, buffer, anynul, status); } else { /* set the bnullarray = 1 for any null values in the array */ fits_read_colnull(infptr, datatype, (infptr->Fptr)->cn_uncompressed, nrow, 1, nelem, buffer, bnullarray, anynul, status); } } else if ((infptr->Fptr)->cn_gzip_data >= 1) { /* This is the newer option, that was introduced in May 2011 */ /* floating point data was not quantized, so read the losslessly */ /* compressed data from the GZIP_COMPRESSED_DATA column */ ffgdes (infptr, (infptr->Fptr)->cn_gzip_data, nrow, &nelem, &offset, status); if (nelem == 0 && offset == 0) /* this should never happen */ return (*status = NO_COMPRESSED_TILE); /* allocate memory for the compressed tile of data */ cbuf = (unsigned char *) malloc (nelem); if (cbuf == NULL) { ffpmsg("error allocating memory for gzipped tile (imcomp_decompress_tile)"); return (*status = MEMORY_ALLOCATION); } /* read array of compressed bytes */ if (fits_read_col(infptr, TBYTE, (infptr->Fptr)->cn_gzip_data, nrow, 1, nelem, &charnull, cbuf, NULL, status) > 0) { ffpmsg("error reading compressed byte stream from binary table"); free (cbuf); return (*status); } /* size of the returned (uncompressed) data buffer, in bytes */ if ((infptr->Fptr)->zbitpix == FLOAT_IMG) { idatalen = tilelen * sizeof(float); } else if ((infptr->Fptr)->zbitpix == DOUBLE_IMG) { idatalen = tilelen * sizeof(double); } else { /* this should never happen! */ ffpmsg("incompatible data type in gzipped floating-point tile-compressed image"); free (cbuf); return (*status = DATA_DECOMPRESSION_ERR); } if (datatype == TDOUBLE && (infptr->Fptr)->zbitpix == FLOAT_IMG) { /* have to allocat a temporary buffer for the uncompressed data in the */ /* case where a gzipped "float" tile is returned as a "double" array */ tempfloat = (float*) malloc (idatalen); if (tempfloat == NULL) { ffpmsg("Memory allocation failure for tempfloat. (imcomp_decompress_tile)"); free (cbuf); return (*status = MEMORY_ALLOCATION); } /* uncompress the data into temp buffer */ if (uncompress2mem_from_mem ((char *)cbuf, nelem, (char **) &tempfloat, &idatalen, NULL, &tilebytesize, status)) { ffpmsg("failed to gunzip the image tile"); free (tempfloat); free (cbuf); return (*status); } } else { /* uncompress the data directly into the output buffer in all other cases */ if (uncompress2mem_from_mem ((char *)cbuf, nelem, (char **) &buffer, &idatalen, NULL, &tilebytesize, status)) { ffpmsg("failed to gunzip the image tile"); free (cbuf); return (*status); } } free(cbuf); /* do byte swapping and null value substitution for the tile of pixels */ if (tilebytesize == 4 * tilelen) { /* float pixels */ #if BYTESWAPPED if (tempfloat) ffswap4((int *) tempfloat, tilelen); else ffswap4((int *) buffer, tilelen); #endif if (datatype == TFLOAT) { if (nulval) { fnulval = *(float *) nulval; } fffr4r4((float *) buffer, (long) tilelen, 1., 0., nullcheck, fnulval, bnullarray, anynul, (float *) buffer, status); } else if (datatype == TDOUBLE) { if (nulval) { dnulval = *(double *) nulval; } /* note that the R*4 data are in the tempfloat array in this case */ fffr4r8((float *) tempfloat, (long) tilelen, 1., 0., nullcheck, dnulval, bnullarray, anynul, (double *) buffer, status); free(tempfloat); } else { ffpmsg("implicit data type conversion is not supported for gzipped image tiles"); return (*status = DATA_DECOMPRESSION_ERR); } } else if (tilebytesize == 8 * tilelen) { /* double pixels */ #if BYTESWAPPED ffswap8((double *) buffer, tilelen); #endif if (datatype == TFLOAT) { if (nulval) { fnulval = *(float *) nulval; } fffr8r4((double *) buffer, (long) tilelen, 1., 0., nullcheck, fnulval, bnullarray, anynul, (float *) buffer, status); } else if (datatype == TDOUBLE) { if (nulval) { dnulval = *(double *) nulval; } fffr8r8((double *) buffer, (long) tilelen, 1., 0., nullcheck, dnulval, bnullarray, anynul, (double *) buffer, status); } else { ffpmsg("implicit data type conversion is not supported in tile-compressed images"); return (*status = DATA_DECOMPRESSION_ERR); } } else { ffpmsg("error: uncompressed tile has wrong size"); return (*status = DATA_DECOMPRESSION_ERR); } /* end of special case of losslessly gzipping a floating-point image tile */ } else { /* this should never happen */ *status = NO_COMPRESSED_TILE; } return(*status); } /* **************************************************************** */ /* deal with the normal case of a compressed tile of pixels */ if (nullcheck == 2) { for (ii = 0; ii < tilelen; ii++) /* initialize the null flage array */ bnullarray[ii] = 0; } if (anynul) *anynul = 0; /* get linear scaling and offset values, if they exist */ actual_bzero = (infptr->Fptr)->cn_actual_bzero; if ((infptr->Fptr)->cn_zscale == 0) { /* set default scaling, if scaling is not defined */ bscale = 1.; bzero = 0.; } else if ((infptr->Fptr)->cn_zscale == -1) { bscale = (infptr->Fptr)->zscale; bzero = (infptr->Fptr)->zzero; } else { /* read the linear scale and offset values for this row */ ffgcvd (infptr, (infptr->Fptr)->cn_zscale, nrow, 1, 1, 0., &bscale, NULL, status); ffgcvd (infptr, (infptr->Fptr)->cn_zzero, nrow, 1, 1, 0., &bzero, NULL, status); if (*status > 0) { ffpmsg("error reading scaling factor and offset for compressed tile"); return (*status); } /* test if floating-point FITS image also has non-default BSCALE and */ /* BZERO keywords. If so, we have to combine the 2 linear scaling factors. */ if ( ((infptr->Fptr)->zbitpix == FLOAT_IMG || (infptr->Fptr)->zbitpix == DOUBLE_IMG ) && ((infptr->Fptr)->cn_bscale != 1.0 || (infptr->Fptr)->cn_bzero != 0.0 ) ) { bscale = bscale * (infptr->Fptr)->cn_bscale; bzero = bzero * (infptr->Fptr)->cn_bscale + (infptr->Fptr)->cn_bzero; } } if (bscale == 1.0 && bzero == 0.0 ) { /* if no other scaling has been specified, try using the values given by the BSCALE and BZERO keywords, if any */ bscale = (infptr->Fptr)->cn_bscale; bzero = (infptr->Fptr)->cn_bzero; } /* ************************************************************* */ /* get the value used to represent nulls in the int array */ if ((infptr->Fptr)->cn_zblank == 0) { nullcheck = 0; /* no null value; don't check for nulls */ } else if ((infptr->Fptr)->cn_zblank == -1) { tnull = (infptr->Fptr)->zblank; /* use the the ZBLANK keyword */ } else { /* read the null value for this row */ ffgcvk (infptr, (infptr->Fptr)->cn_zblank, nrow, 1, 1, 0, &tnull, NULL, status); if (*status > 0) { ffpmsg("error reading null value for compressed tile"); return (*status); } } /* ************************************************************* */ /* allocate memory for the uncompressed array of tile integers */ /* The size depends on the datatype and the compression type. */ if ((infptr->Fptr)->compress_type == HCOMPRESS_1 && ((infptr->Fptr)->zbitpix != BYTE_IMG && (infptr->Fptr)->zbitpix != SHORT_IMG) ) { idatalen = tilelen * sizeof(LONGLONG); /* 8 bytes per pixel */ } else if ( (infptr->Fptr)->compress_type == RICE_1 && (infptr->Fptr)->zbitpix == BYTE_IMG && (infptr->Fptr)->rice_bytepix == 1) { idatalen = tilelen * sizeof(char); /* 1 byte per pixel */ } else if ( ( (infptr->Fptr)->compress_type == GZIP_1 || (infptr->Fptr)->compress_type == GZIP_2 || (infptr->Fptr)->compress_type == BZIP2_1 ) && (infptr->Fptr)->zbitpix == BYTE_IMG ) { idatalen = tilelen * sizeof(char); /* 1 byte per pixel */ } else if ( (infptr->Fptr)->compress_type == RICE_1 && (infptr->Fptr)->zbitpix == SHORT_IMG && (infptr->Fptr)->rice_bytepix == 2) { idatalen = tilelen * sizeof(short); /* 2 bytes per pixel */ } else if ( ( (infptr->Fptr)->compress_type == GZIP_1 || (infptr->Fptr)->compress_type == GZIP_2 || (infptr->Fptr)->compress_type == BZIP2_1 ) && (infptr->Fptr)->zbitpix == SHORT_IMG ) { idatalen = tilelen * sizeof(short); /* 2 bytes per pixel */ } else if ( ( (infptr->Fptr)->compress_type == GZIP_1 || (infptr->Fptr)->compress_type == GZIP_2 || (infptr->Fptr)->compress_type == BZIP2_1 ) && (infptr->Fptr)->zbitpix == DOUBLE_IMG ) { idatalen = tilelen * sizeof(double); /* 8 bytes per pixel */ } else { idatalen = tilelen * sizeof(int); /* all other cases have int pixels */ } idata = (int*) malloc (idatalen); if (idata == NULL) { ffpmsg("Memory allocation failure for idata. (imcomp_decompress_tile)"); return (*status = MEMORY_ALLOCATION); } /* ************************************************************* */ /* allocate memory for the compressed bytes */ if ((infptr->Fptr)->compress_type == PLIO_1) { cbuf = (unsigned char *) malloc (nelem * sizeof (short)); } else { cbuf = (unsigned char *) malloc (nelem); } if (cbuf == NULL) { ffpmsg("Out of memory for cbuf. (imcomp_decompress_tile)"); free(idata); return (*status = MEMORY_ALLOCATION); } /* ************************************************************* */ /* read the compressed bytes from the FITS file */ if ((infptr->Fptr)->compress_type == PLIO_1) { fits_read_col(infptr, TSHORT, (infptr->Fptr)->cn_compressed, nrow, 1, nelem, &snull, (short *) cbuf, NULL, status); } else { fits_read_col(infptr, TBYTE, (infptr->Fptr)->cn_compressed, nrow, 1, nelem, &charnull, cbuf, NULL, status); } if (*status > 0) { ffpmsg("error reading compressed byte stream from binary table"); free (cbuf); free(idata); return (*status); } /* ************************************************************* */ /* call the algorithm-specific code to uncompress the tile */ if ((infptr->Fptr)->compress_type == RICE_1) { blocksize = (infptr->Fptr)->rice_blocksize; if ((infptr->Fptr)->rice_bytepix == 1 ) { *status = fits_rdecomp_byte (cbuf, nelem, (unsigned char *)idata, tilelen, blocksize); tiledatatype = TBYTE; } else if ((infptr->Fptr)->rice_bytepix == 2 ) { *status = fits_rdecomp_short (cbuf, nelem, (unsigned short *)idata, tilelen, blocksize); tiledatatype = TSHORT; } else { *status = fits_rdecomp (cbuf, nelem, (unsigned int *)idata, tilelen, blocksize); tiledatatype = TINT; } /* ************************************************************* */ } else if ((infptr->Fptr)->compress_type == HCOMPRESS_1) { smooth = (infptr->Fptr)->hcomp_smooth; if ( ((infptr->Fptr)->zbitpix == BYTE_IMG || (infptr->Fptr)->zbitpix == SHORT_IMG)) { *status = fits_hdecompress(cbuf, smooth, idata, &nx, &ny, &scale, status); } else { /* zbitpix = LONG_IMG (32) */ /* idata must have been allocated twice as large for this to work */ *status = fits_hdecompress64(cbuf, smooth, (LONGLONG *) idata, &nx, &ny, &scale, status); } tiledatatype = TINT; /* ************************************************************* */ } else if ((infptr->Fptr)->compress_type == PLIO_1) { pl_l2pi ((short *) cbuf, 1, idata, tilelen); /* uncompress the data */ tiledatatype = TINT; /* ************************************************************* */ } else if ( ((infptr->Fptr)->compress_type == GZIP_1) || ((infptr->Fptr)->compress_type == GZIP_2) ) { uncompress2mem_from_mem ((char *)cbuf, nelem, (char **) &idata, &idatalen, realloc, &tilebytesize, status); /* determine the data type of the uncompressed array, and */ /* do byte unshuffling and unswapping if needed */ if (tilebytesize == (size_t) (tilelen * 2)) { /* this is a short I*2 array */ tiledatatype = TSHORT; if ( (infptr->Fptr)->compress_type == GZIP_2 ) fits_unshuffle_2bytes((char *) idata, tilelen, status); #if BYTESWAPPED ffswap2((short *) idata, tilelen); #endif } else if (tilebytesize == (size_t) (tilelen * 4)) { /* this is a int I*4 array (or maybe R*4) */ tiledatatype = TINT; if ( (infptr->Fptr)->compress_type == GZIP_2 ) fits_unshuffle_4bytes((char *) idata, tilelen, status); #if BYTESWAPPED ffswap4(idata, tilelen); #endif } else if (tilebytesize == (size_t) (tilelen * 8)) { /* this is a R*8 double array */ tiledatatype = TDOUBLE; if ( (infptr->Fptr)->compress_type == GZIP_2 ) fits_unshuffle_8bytes((char *) idata, tilelen, status); #if BYTESWAPPED ffswap8((double *) idata, tilelen); #endif } else if (tilebytesize == (size_t) tilelen) { /* this is an unsigned char I*1 array */ tiledatatype = TBYTE; } else { ffpmsg("error: uncompressed tile has wrong size"); free(idata); return (*status = DATA_DECOMPRESSION_ERR); } /* ************************************************************* */ } else if ((infptr->Fptr)->compress_type == BZIP2_1) { /* BZIP2 is not supported in the public release; this is only for test purposes if (BZ2_bzBuffToBuffDecompress ((char *) idata, &idatalen, (char *)cbuf, (unsigned int) nelem, 0, 0) ) */ { ffpmsg("bzip2 decompression error"); free(idata); free (cbuf); return (*status = DATA_DECOMPRESSION_ERR); } if ((infptr->Fptr)->zbitpix == BYTE_IMG) { tiledatatype = TBYTE; } else if ((infptr->Fptr)->zbitpix == SHORT_IMG) { tiledatatype = TSHORT; #if BYTESWAPPED ffswap2((short *) idata, tilelen); #endif } else { tiledatatype = TINT; #if BYTESWAPPED ffswap4(idata, tilelen); #endif } /* ************************************************************* */ } else { ffpmsg("unknown compression algorithm"); free(idata); return (*status = DATA_DECOMPRESSION_ERR); } free(cbuf); if (*status) { /* error uncompressing the tile */ free(idata); return (*status); } /* ************************************************************* */ /* copy the uncompressed tile data to the output buffer, doing */ /* null checking, datatype conversion and linear scaling, if necessary */ if (nulval == 0) nulval = &dummy; /* set address to dummy value */ if (datatype == TSHORT) { pixlen = sizeof(short); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4i2((float *) idata, tilelen, bscale, bzero, nullcheck, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); } else { fffr8i2((double *) idata, tilelen, bscale, bzero, nullcheck, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); } } else if (tiledatatype == TINT) if ((infptr->Fptr)->compress_type == PLIO_1 && bzero == 0. && actual_bzero == 32768.) { /* special case where unsigned 16-bit integers have been */ /* offset by +32768 when using PLIO */ fffi4i2(idata, tilelen, bscale, -32768., nullcheck, tnull, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); } else { fffi4i2(idata, tilelen, bscale, bzero, nullcheck, tnull, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); /* Hcompress is a special case: ignore any numerical overflow errors that may have occurred during the integer*4 to integer*2 convertion. Overflows can happen when a lossy Hcompress algorithm is invoked (with a non-zero scale factor). The fffi4i2 routine clips the returned values to be within the legal I*2 range, so all we need to is to reset the error status to zero. */ if ((infptr->Fptr)->compress_type == HCOMPRESS_1) { if (*status == NUM_OVERFLOW) *status = 0; } } else if (tiledatatype == TSHORT) fffi2i2((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); else if (tiledatatype == TBYTE) fffi1i2((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(short *) nulval, bnullarray, anynul, (short *) buffer, status); } else if (datatype == TINT) { pixlen = sizeof(int); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4int((float *) idata, tilelen, bscale, bzero, nullcheck, *(int *) nulval, bnullarray, anynul, (int *) buffer, status); } else { fffr8int((double *) idata, tilelen, bscale, bzero, nullcheck, *(int *) nulval, bnullarray, anynul, (int *) buffer, status); } } else if (tiledatatype == TINT) fffi4int(idata, (long) tilelen, bscale, bzero, nullcheck, tnull, *(int *) nulval, bnullarray, anynul, (int *) buffer, status); else if (tiledatatype == TSHORT) fffi2int((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(int *) nulval, bnullarray, anynul, (int *) buffer, status); else if (tiledatatype == TBYTE) fffi1int((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(int *) nulval, bnullarray, anynul, (int *) buffer, status); } else if (datatype == TLONG) { pixlen = sizeof(long); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4i4((float *) idata, tilelen, bscale, bzero, nullcheck, *(long *) nulval, bnullarray, anynul, (long *) buffer, status); } else { fffr8i4((double *) idata, tilelen, bscale, bzero, nullcheck, *(long *) nulval, bnullarray, anynul, (long *) buffer, status); } } else if (tiledatatype == TINT) fffi4i4(idata, tilelen, bscale, bzero, nullcheck, tnull, *(long *) nulval, bnullarray, anynul, (long *) buffer, status); else if (tiledatatype == TSHORT) fffi2i4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(long *) nulval, bnullarray, anynul, (long *) buffer, status); else if (tiledatatype == TBYTE) fffi1i4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(long *) nulval, bnullarray, anynul, (long *) buffer, status); } else if (datatype == TFLOAT) { pixlen = sizeof(float); if (nulval) { fnulval = *(float *) nulval; } if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4r4((float *) idata, tilelen, bscale, bzero, nullcheck, fnulval, bnullarray, anynul, (float *) buffer, status); } else { fffr8r4((double *) idata, tilelen, bscale, bzero, nullcheck, fnulval, bnullarray, anynul, (float *) buffer, status); } } else if ((infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 || (infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) { /* use the new dithering algorithm (introduced in July 2009) */ if (tiledatatype == TINT) unquantize_i4r4(nrow + (infptr->Fptr)->dither_seed - 1, idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, tnull, fnulval, bnullarray, anynul, (float *) buffer, status); else if (tiledatatype == TSHORT) unquantize_i2r4(nrow + (infptr->Fptr)->dither_seed - 1, (short *)idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (short) tnull, fnulval, bnullarray, anynul, (float *) buffer, status); else if (tiledatatype == TBYTE) unquantize_i1r4(nrow + (infptr->Fptr)->dither_seed - 1, (unsigned char *)idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (unsigned char) tnull, fnulval, bnullarray, anynul, (float *) buffer, status); } else { /* use the old "round to nearest level" quantization algorithm */ if (tiledatatype == TINT) fffi4r4(idata, tilelen, bscale, bzero, nullcheck, tnull, fnulval, bnullarray, anynul, (float *) buffer, status); else if (tiledatatype == TSHORT) fffi2r4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, fnulval, bnullarray, anynul, (float *) buffer, status); else if (tiledatatype == TBYTE) fffi1r4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, fnulval, bnullarray, anynul, (float *) buffer, status); } } else if (datatype == TDOUBLE) { pixlen = sizeof(double); if (nulval) { dnulval = *(double *) nulval; } if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4r8((float *) idata, tilelen, bscale, bzero, nullcheck, dnulval, bnullarray, anynul, (double *) buffer, status); } else { fffr8r8((double *) idata, tilelen, bscale, bzero, nullcheck, dnulval, bnullarray, anynul, (double *) buffer, status); } } else if ((infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_1 || (infptr->Fptr)->quantize_method == SUBTRACTIVE_DITHER_2) { /* use the new dithering algorithm (introduced in July 2009) */ if (tiledatatype == TINT) unquantize_i4r8(nrow + (infptr->Fptr)->dither_seed - 1, idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, tnull, dnulval, bnullarray, anynul, (double *) buffer, status); else if (tiledatatype == TSHORT) unquantize_i2r8(nrow + (infptr->Fptr)->dither_seed - 1, (short *)idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (short) tnull, dnulval, bnullarray, anynul, (double *) buffer, status); else if (tiledatatype == TBYTE) unquantize_i1r8(nrow + (infptr->Fptr)->dither_seed - 1, (unsigned char *)idata, tilelen, bscale, bzero, (infptr->Fptr)->quantize_method, nullcheck, (unsigned char) tnull, dnulval, bnullarray, anynul, (double *) buffer, status); } else { /* use the old "round to nearest level" quantization algorithm */ if (tiledatatype == TINT) fffi4r8(idata, tilelen, bscale, bzero, nullcheck, tnull, dnulval, bnullarray, anynul, (double *) buffer, status); else if (tiledatatype == TSHORT) fffi2r8((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, dnulval, bnullarray, anynul, (double *) buffer, status); else if (tiledatatype == TBYTE) fffi1r8((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, dnulval, bnullarray, anynul, (double *) buffer, status); } } else if (datatype == TBYTE) { pixlen = sizeof(char); if (tiledatatype == TINT) fffi4i1(idata, tilelen, bscale, bzero, nullcheck, tnull, *(unsigned char *) nulval, bnullarray, anynul, (unsigned char *) buffer, status); else if (tiledatatype == TSHORT) fffi2i1((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(unsigned char *) nulval, bnullarray, anynul, (unsigned char *) buffer, status); else if (tiledatatype == TBYTE) fffi1i1((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(unsigned char *) nulval, bnullarray, anynul, (unsigned char *) buffer, status); } else if (datatype == TSBYTE) { pixlen = sizeof(char); if (tiledatatype == TINT) fffi4s1(idata, tilelen, bscale, bzero, nullcheck, tnull, *(signed char *) nulval, bnullarray, anynul, (signed char *) buffer, status); else if (tiledatatype == TSHORT) fffi2s1((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(signed char *) nulval, bnullarray, anynul, (signed char *) buffer, status); else if (tiledatatype == TBYTE) fffi1s1((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(signed char *) nulval, bnullarray, anynul, (signed char *) buffer, status); } else if (datatype == TUSHORT) { pixlen = sizeof(short); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4u2((float *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned short *) nulval, bnullarray, anynul, (unsigned short *) buffer, status); } else { fffr8u2((double *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned short *) nulval, bnullarray, anynul, (unsigned short *) buffer, status); } } else if (tiledatatype == TINT) fffi4u2(idata, tilelen, bscale, bzero, nullcheck, tnull, *(unsigned short *) nulval, bnullarray, anynul, (unsigned short *) buffer, status); else if (tiledatatype == TSHORT) fffi2u2((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(unsigned short *) nulval, bnullarray, anynul, (unsigned short *) buffer, status); else if (tiledatatype == TBYTE) fffi1u2((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(unsigned short *) nulval, bnullarray, anynul, (unsigned short *) buffer, status); } else if (datatype == TUINT) { pixlen = sizeof(int); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4uint((float *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned int *) nulval, bnullarray, anynul, (unsigned int *) buffer, status); } else { fffr8uint((double *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned int *) nulval, bnullarray, anynul, (unsigned int *) buffer, status); } } else if (tiledatatype == TINT) fffi4uint(idata, tilelen, bscale, bzero, nullcheck, tnull, *(unsigned int *) nulval, bnullarray, anynul, (unsigned int *) buffer, status); else if (tiledatatype == TSHORT) fffi2uint((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(unsigned int *) nulval, bnullarray, anynul, (unsigned int *) buffer, status); else if (tiledatatype == TBYTE) fffi1uint((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(unsigned int *) nulval, bnullarray, anynul, (unsigned int *) buffer, status); } else if (datatype == TULONG) { pixlen = sizeof(long); if ((infptr->Fptr)->quantize_level == NO_QUANTIZE) { /* the floating point pixels were losselessly compressed with GZIP */ /* Just have to copy the values to the output array */ if (tiledatatype == TINT) { fffr4u4((float *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned long *) nulval, bnullarray, anynul, (unsigned long *) buffer, status); } else { fffr8u4((double *) idata, tilelen, bscale, bzero, nullcheck, *(unsigned long *) nulval, bnullarray, anynul, (unsigned long *) buffer, status); } } else if (tiledatatype == TINT) fffi4u4(idata, tilelen, bscale, bzero, nullcheck, tnull, *(unsigned long *) nulval, bnullarray, anynul, (unsigned long *) buffer, status); else if (tiledatatype == TSHORT) fffi2u4((short *)idata, tilelen, bscale, bzero, nullcheck, (short) tnull, *(unsigned long *) nulval, bnullarray, anynul, (unsigned long *) buffer, status); else if (tiledatatype == TBYTE) fffi1u4((unsigned char *)idata, tilelen, bscale, bzero, nullcheck, (unsigned char) tnull, *(unsigned long *) nulval, bnullarray, anynul, (unsigned long *) buffer, status); } else *status = BAD_DATATYPE; free(idata); /* don't need the uncompressed tile any more */ /* **************************************************************** */ /* cache the tile, in case the application wants it again */ /* Don't cache the tile if tile is a single row of the image; it is less likely that the cache will be used in this cases, so it is not worth the time and the memory overheads. */ if ((infptr->Fptr)->tilerow) { /* make sure cache has been allocated */ if ((infptr->Fptr)->znaxis[0] != (infptr->Fptr)->tilesize[0] || (infptr->Fptr)->tilesize[1] != 1 ) { tilesize = pixlen * tilelen; /* check that tile size/type has not changed */ if (tilesize != (infptr->Fptr)->tiledatasize[tilecol] || datatype != (infptr->Fptr)->tiletype[tilecol] ) { if (((infptr->Fptr)->tiledata)[tilecol]) { free(((infptr->Fptr)->tiledata)[tilecol]); } if (((infptr->Fptr)->tilenullarray)[tilecol]) { free(((infptr->Fptr)->tilenullarray)[tilecol]); } ((infptr->Fptr)->tilenullarray)[tilecol] = 0; ((infptr->Fptr)->tilerow)[tilecol] = 0; ((infptr->Fptr)->tiledatasize)[tilecol] = 0; ((infptr->Fptr)->tiletype)[tilecol] = 0; /* allocate new array(s) */ ((infptr->Fptr)->tiledata)[tilecol] = malloc(tilesize); if (((infptr->Fptr)->tiledata)[tilecol] == 0) return (*status); if (nullcheck == 2) { /* also need array of null pixel flags */ (infptr->Fptr)->tilenullarray[tilecol] = malloc(tilelen); if ((infptr->Fptr)->tilenullarray[tilecol] == 0) return (*status); } (infptr->Fptr)->tiledatasize[tilecol] = tilesize; (infptr->Fptr)->tiletype[tilecol] = datatype; } /* copy the tile array(s) into cache buffer */ memcpy((infptr->Fptr)->tiledata[tilecol], buffer, tilesize); if (nullcheck == 2) { if ((infptr->Fptr)->tilenullarray == 0) { (infptr->Fptr)->tilenullarray[tilecol] = malloc(tilelen); } memcpy((infptr->Fptr)->tilenullarray[tilecol], bnullarray, tilelen); } (infptr->Fptr)->tilerow[tilecol] = nrow; (infptr->Fptr)->tileanynull[tilecol] = *anynul; } } return (*status); } /*--------------------------------------------------------------------------*/ int imcomp_test_overlap ( int ndim, /* I - number of dimension in the tile and image */ long *tfpixel, /* I - first pixel number in each dim. of the tile */ long *tlpixel, /* I - last pixel number in each dim. of the tile */ long *fpixel, /* I - first pixel number in each dim. of the image */ long *lpixel, /* I - last pixel number in each dim. of the image */ long *ininc, /* I - increment to be applied in each image dimen. */ int *status) /* test if there are any intersecting pixels between this tile and the section of the image defined by fixel, lpixel, ininc. */ { long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* output image, allowing for inc factor */ long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* tile, array; inc factor is not relevant */ long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */ /* allowing for inc factor */ long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */ /* allowing for inc factor */ long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */ /* allowing for inc factor */ long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */ int ii; long tf, tl; if (*status > 0) return(*status); /* ------------------------------------------------------------ */ /* calc amount of overlap in each dimension; if there is zero */ /* overlap in any dimension then just return */ /* ------------------------------------------------------------ */ for (ii = 0; ii < ndim; ii++) { if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii]) return(0); /* there are no overlapping pixels */ inc[ii] = ininc[ii]; /* calc dimensions of the output image section */ imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1; if (imgdim[ii] < 1) { *status = NEG_AXIS; return(0); } /* calc dimensions of the tile */ tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1; if (tiledim[ii] < 1) { *status = NEG_AXIS; return(0); } if (ii > 0) tiledim[ii] *= tiledim[ii - 1]; /* product of dimensions */ /* first and last pixels in image that overlap with the tile, 0 base */ tf = tfpixel[ii] - 1; tl = tlpixel[ii] - 1; /* skip this plane if it falls in the cracks of the subsampled image */ while ((tf-(fpixel[ii] - 1)) % labs(inc[ii])) { tf++; if (tf > tl) return(0); /* no overlapping pixels */ } while ((tl-(fpixel[ii] - 1)) % labs(inc[ii])) { tl--; if (tf > tl) return(0); /* no overlapping pixels */ } imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0); imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) , imgdim[ii] - 1); /* first pixel in the tile that overlaps with the image (0 base) */ tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0); while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii])) { (tilefpix[ii])++; if (tilefpix[ii] >= tiledim[ii]) return(0); /* no overlapping pixels */ } if (ii > 0) imgdim[ii] *= imgdim[ii - 1]; /* product of dimensions */ } return(1); /* there appears to be intersecting pixels */ } /*--------------------------------------------------------------------------*/ int imcomp_copy_overlap ( char *tile, /* I - multi dimensional array of tile pixels */ int pixlen, /* I - number of bytes in each tile or image pixel */ int ndim, /* I - number of dimension in the tile and image */ long *tfpixel, /* I - first pixel number in each dim. of the tile */ long *tlpixel, /* I - last pixel number in each dim. of the tile */ char *bnullarray, /* I - array of null flags; used if nullcheck = 2 */ char *image, /* O - multi dimensional output image */ long *fpixel, /* I - first pixel number in each dim. of the image */ long *lpixel, /* I - last pixel number in each dim. of the image */ long *ininc, /* I - increment to be applied in each image dimen. */ int nullcheck, /* I - 0, 1: do nothing; 2: set nullarray for nulls */ char *nullarray, int *status) /* copy the intersecting pixels from a decompressed tile to the output image. Both the tile and the image must have the same number of dimensions. */ { long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* output image, allowing for inc factor */ long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* tile, array; inc factor is not relevant */ long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */ /* allowing for inc factor */ long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */ /* allowing for inc factor */ long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */ /* allowing for inc factor */ long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */ long i1, i2, i3, i4; /* offset along each axis of the image */ long it1, it2, it3, it4; long im1, im2, im3, im4; /* offset to image pixel, allowing for inc */ long ipos, tf, tl; long t2, t3, t4; /* offset along each axis of the tile */ long tilepix, imgpix, tilepixbyte, imgpixbyte; int ii, overlap_bytes, overlap_flags; if (*status > 0) return(*status); for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { /* set default values for higher dimensions */ inc[ii] = 1; imgdim[ii] = 1; tiledim[ii] = 1; imgfpix[ii] = 0; imglpix[ii] = 0; tilefpix[ii] = 0; } /* ------------------------------------------------------------ */ /* calc amount of overlap in each dimension; if there is zero */ /* overlap in any dimension then just return */ /* ------------------------------------------------------------ */ for (ii = 0; ii < ndim; ii++) { if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii]) return(*status); /* there are no overlapping pixels */ inc[ii] = ininc[ii]; /* calc dimensions of the output image section */ imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1; if (imgdim[ii] < 1) return(*status = NEG_AXIS); /* calc dimensions of the tile */ tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1; if (tiledim[ii] < 1) return(*status = NEG_AXIS); if (ii > 0) tiledim[ii] *= tiledim[ii - 1]; /* product of dimensions */ /* first and last pixels in image that overlap with the tile, 0 base */ tf = tfpixel[ii] - 1; tl = tlpixel[ii] - 1; /* skip this plane if it falls in the cracks of the subsampled image */ while ((tf-(fpixel[ii] - 1)) % labs(inc[ii])) { tf++; if (tf > tl) return(*status); /* no overlapping pixels */ } while ((tl-(fpixel[ii] - 1)) % labs(inc[ii])) { tl--; if (tf > tl) return(*status); /* no overlapping pixels */ } imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0); imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) , imgdim[ii] - 1); /* first pixel in the tile that overlaps with the image (0 base) */ tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0); while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii])) { (tilefpix[ii])++; if (tilefpix[ii] >= tiledim[ii]) return(*status); /* no overlapping pixels */ } /* printf("ii tfpixel, tlpixel %d %d %d \n",ii, tfpixel[ii], tlpixel[ii]); printf("ii, tf, tl, imgfpix,imglpix, tilefpix %d %d %d %d %d %d\n",ii, tf,tl,imgfpix[ii], imglpix[ii],tilefpix[ii]); */ if (ii > 0) imgdim[ii] *= imgdim[ii - 1]; /* product of dimensions */ } /* ---------------------------------------------------------------- */ /* calc number of pixels in each row (first dimension) that overlap */ /* multiply by pixlen to get number of bytes to copy in each loop */ /* ---------------------------------------------------------------- */ if (inc[0] != 1) overlap_flags = 1; /* can only copy 1 pixel at a time */ else overlap_flags = imglpix[0] - imgfpix[0] + 1; /* can copy whole row */ overlap_bytes = overlap_flags * pixlen; /* support up to 5 dimensions for now */ for (i4 = 0, it4=0; i4 <= imglpix[4] - imgfpix[4]; i4++, it4++) { /* increment plane if it falls in the cracks of the subsampled image */ while (ndim > 4 && (tfpixel[4] + tilefpix[4] - fpixel[4] + it4) % labs(inc[4]) != 0) it4++; /* offset to start of hypercube */ if (inc[4] > 0) im4 = (i4 + imgfpix[4]) * imgdim[3]; else im4 = imgdim[4] - (i4 + 1 + imgfpix[4]) * imgdim[3]; t4 = (tilefpix[4] + it4) * tiledim[3]; for (i3 = 0, it3=0; i3 <= imglpix[3] - imgfpix[3]; i3++, it3++) { /* increment plane if it falls in the cracks of the subsampled image */ while (ndim > 3 && (tfpixel[3] + tilefpix[3] - fpixel[3] + it3) % labs(inc[3]) != 0) it3++; /* offset to start of cube */ if (inc[3] > 0) im3 = (i3 + imgfpix[3]) * imgdim[2] + im4; else im3 = imgdim[3] - (i3 + 1 + imgfpix[3]) * imgdim[2] + im4; t3 = (tilefpix[3] + it3) * tiledim[2] + t4; /* loop through planes of the image */ for (i2 = 0, it2=0; i2 <= imglpix[2] - imgfpix[2]; i2++, it2++) { /* incre plane if it falls in the cracks of the subsampled image */ while (ndim > 2 && (tfpixel[2] + tilefpix[2] - fpixel[2] + it2) % labs(inc[2]) != 0) it2++; /* offset to start of plane */ if (inc[2] > 0) im2 = (i2 + imgfpix[2]) * imgdim[1] + im3; else im2 = imgdim[2] - (i2 + 1 + imgfpix[2]) * imgdim[1] + im3; t2 = (tilefpix[2] + it2) * tiledim[1] + t3; /* loop through rows of the image */ for (i1 = 0, it1=0; i1 <= imglpix[1] - imgfpix[1]; i1++, it1++) { /* incre row if it falls in the cracks of the subsampled image */ while (ndim > 1 && (tfpixel[1] + tilefpix[1] - fpixel[1] + it1) % labs(inc[1]) != 0) it1++; /* calc position of first pixel in tile to be copied */ tilepix = tilefpix[0] + (tilefpix[1] + it1) * tiledim[0] + t2; /* offset to start of row */ if (inc[1] > 0) im1 = (i1 + imgfpix[1]) * imgdim[0] + im2; else im1 = imgdim[1] - (i1 + 1 + imgfpix[1]) * imgdim[0] + im2; /* printf("inc = %d %d %d %d\n",inc[0],inc[1],inc[2],inc[3]); printf("im1,im2,im3,im4 = %d %d %d %d\n",im1,im2,im3,im4); */ /* offset to byte within the row */ if (inc[0] > 0) imgpix = imgfpix[0] + im1; else imgpix = imgdim[0] - 1 - imgfpix[0] + im1; /* printf("tilefpix0,1, imgfpix1, it1, inc1, t2= %d %d %d %d %d %d\n", tilefpix[0],tilefpix[1],imgfpix[1],it1,inc[1], t2); printf("i1, it1, tilepix, imgpix %d %d %d %d \n", i1, it1, tilepix, imgpix); */ /* loop over pixels along one row of the image */ for (ipos = imgfpix[0]; ipos <= imglpix[0]; ipos += overlap_flags) { if (nullcheck == 2) { /* copy overlapping null flags from tile to image */ memcpy(nullarray + imgpix, bnullarray + tilepix, overlap_flags); } /* convert from image pixel to byte offset */ tilepixbyte = tilepix * pixlen; imgpixbyte = imgpix * pixlen; /* printf(" tilepix, tilepixbyte, imgpix, imgpixbyte= %d %d %d %d\n", tilepix, tilepixbyte, imgpix, imgpixbyte); */ /* copy overlapping row of pixels from tile to image */ memcpy(image + imgpixbyte, tile + tilepixbyte, overlap_bytes); tilepix += (overlap_flags * labs(inc[0])); if (inc[0] > 0) imgpix += overlap_flags; else imgpix -= overlap_flags; } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int imcomp_merge_overlap ( char *tile, /* O - multi dimensional array of tile pixels */ int pixlen, /* I - number of bytes in each tile or image pixel */ int ndim, /* I - number of dimension in the tile and image */ long *tfpixel, /* I - first pixel number in each dim. of the tile */ long *tlpixel, /* I - last pixel number in each dim. of the tile */ char *bnullarray, /* I - array of null flags; used if nullcheck = 2 */ char *image, /* I - multi dimensional output image */ long *fpixel, /* I - first pixel number in each dim. of the image */ long *lpixel, /* I - last pixel number in each dim. of the image */ int nullcheck, /* I - 0, 1: do nothing; 2: set nullarray for nulls */ int *status) /* Similar to imcomp_copy_overlap, except it copies the overlapping pixels from the 'image' to the 'tile'. */ { long imgdim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* output image, allowing for inc factor */ long tiledim[MAX_COMPRESS_DIM]; /* product of preceding dimensions in the */ /* tile, array; inc factor is not relevant */ long imgfpix[MAX_COMPRESS_DIM]; /* 1st img pix overlapping tile: 0 base, */ /* allowing for inc factor */ long imglpix[MAX_COMPRESS_DIM]; /* last img pix overlapping tile 0 base, */ /* allowing for inc factor */ long tilefpix[MAX_COMPRESS_DIM]; /* 1st tile pix overlapping img 0 base, */ /* allowing for inc factor */ long inc[MAX_COMPRESS_DIM]; /* local copy of input ininc */ long i1, i2, i3, i4; /* offset along each axis of the image */ long it1, it2, it3, it4; long im1, im2, im3, im4; /* offset to image pixel, allowing for inc */ long ipos, tf, tl; long t2, t3, t4; /* offset along each axis of the tile */ long tilepix, imgpix, tilepixbyte, imgpixbyte; int ii, overlap_bytes, overlap_flags; if (*status > 0) return(*status); for (ii = 0; ii < MAX_COMPRESS_DIM; ii++) { /* set default values for higher dimensions */ inc[ii] = 1; imgdim[ii] = 1; tiledim[ii] = 1; imgfpix[ii] = 0; imglpix[ii] = 0; tilefpix[ii] = 0; } /* ------------------------------------------------------------ */ /* calc amount of overlap in each dimension; if there is zero */ /* overlap in any dimension then just return */ /* ------------------------------------------------------------ */ for (ii = 0; ii < ndim; ii++) { if (tlpixel[ii] < fpixel[ii] || tfpixel[ii] > lpixel[ii]) return(*status); /* there are no overlapping pixels */ /* calc dimensions of the output image section */ imgdim[ii] = (lpixel[ii] - fpixel[ii]) / labs(inc[ii]) + 1; if (imgdim[ii] < 1) return(*status = NEG_AXIS); /* calc dimensions of the tile */ tiledim[ii] = tlpixel[ii] - tfpixel[ii] + 1; if (tiledim[ii] < 1) return(*status = NEG_AXIS); if (ii > 0) tiledim[ii] *= tiledim[ii - 1]; /* product of dimensions */ /* first and last pixels in image that overlap with the tile, 0 base */ tf = tfpixel[ii] - 1; tl = tlpixel[ii] - 1; /* skip this plane if it falls in the cracks of the subsampled image */ while ((tf-(fpixel[ii] - 1)) % labs(inc[ii])) { tf++; if (tf > tl) return(*status); /* no overlapping pixels */ } while ((tl-(fpixel[ii] - 1)) % labs(inc[ii])) { tl--; if (tf > tl) return(*status); /* no overlapping pixels */ } imgfpix[ii] = maxvalue((tf - fpixel[ii] +1) / labs(inc[ii]) , 0); imglpix[ii] = minvalue((tl - fpixel[ii] +1) / labs(inc[ii]) , imgdim[ii] - 1); /* first pixel in the tile that overlaps with the image (0 base) */ tilefpix[ii] = maxvalue(fpixel[ii] - tfpixel[ii], 0); while ((tfpixel[ii] + tilefpix[ii] - fpixel[ii]) % labs(inc[ii])) { (tilefpix[ii])++; if (tilefpix[ii] >= tiledim[ii]) return(*status); /* no overlapping pixels */ } /* printf("ii tfpixel, tlpixel %d %d %d \n",ii, tfpixel[ii], tlpixel[ii]); printf("ii, tf, tl, imgfpix,imglpix, tilefpix %d %d %d %d %d %d\n",ii, tf,tl,imgfpix[ii], imglpix[ii],tilefpix[ii]); */ if (ii > 0) imgdim[ii] *= imgdim[ii - 1]; /* product of dimensions */ } /* ---------------------------------------------------------------- */ /* calc number of pixels in each row (first dimension) that overlap */ /* multiply by pixlen to get number of bytes to copy in each loop */ /* ---------------------------------------------------------------- */ if (inc[0] != 1) overlap_flags = 1; /* can only copy 1 pixel at a time */ else overlap_flags = imglpix[0] - imgfpix[0] + 1; /* can copy whole row */ overlap_bytes = overlap_flags * pixlen; /* support up to 5 dimensions for now */ for (i4 = 0, it4=0; i4 <= imglpix[4] - imgfpix[4]; i4++, it4++) { /* increment plane if it falls in the cracks of the subsampled image */ while (ndim > 4 && (tfpixel[4] + tilefpix[4] - fpixel[4] + it4) % labs(inc[4]) != 0) it4++; /* offset to start of hypercube */ if (inc[4] > 0) im4 = (i4 + imgfpix[4]) * imgdim[3]; else im4 = imgdim[4] - (i4 + 1 + imgfpix[4]) * imgdim[3]; t4 = (tilefpix[4] + it4) * tiledim[3]; for (i3 = 0, it3=0; i3 <= imglpix[3] - imgfpix[3]; i3++, it3++) { /* increment plane if it falls in the cracks of the subsampled image */ while (ndim > 3 && (tfpixel[3] + tilefpix[3] - fpixel[3] + it3) % labs(inc[3]) != 0) it3++; /* offset to start of cube */ if (inc[3] > 0) im3 = (i3 + imgfpix[3]) * imgdim[2] + im4; else im3 = imgdim[3] - (i3 + 1 + imgfpix[3]) * imgdim[2] + im4; t3 = (tilefpix[3] + it3) * tiledim[2] + t4; /* loop through planes of the image */ for (i2 = 0, it2=0; i2 <= imglpix[2] - imgfpix[2]; i2++, it2++) { /* incre plane if it falls in the cracks of the subsampled image */ while (ndim > 2 && (tfpixel[2] + tilefpix[2] - fpixel[2] + it2) % labs(inc[2]) != 0) it2++; /* offset to start of plane */ if (inc[2] > 0) im2 = (i2 + imgfpix[2]) * imgdim[1] + im3; else im2 = imgdim[2] - (i2 + 1 + imgfpix[2]) * imgdim[1] + im3; t2 = (tilefpix[2] + it2) * tiledim[1] + t3; /* loop through rows of the image */ for (i1 = 0, it1=0; i1 <= imglpix[1] - imgfpix[1]; i1++, it1++) { /* incre row if it falls in the cracks of the subsampled image */ while (ndim > 1 && (tfpixel[1] + tilefpix[1] - fpixel[1] + it1) % labs(inc[1]) != 0) it1++; /* calc position of first pixel in tile to be copied */ tilepix = tilefpix[0] + (tilefpix[1] + it1) * tiledim[0] + t2; /* offset to start of row */ if (inc[1] > 0) im1 = (i1 + imgfpix[1]) * imgdim[0] + im2; else im1 = imgdim[1] - (i1 + 1 + imgfpix[1]) * imgdim[0] + im2; /* printf("inc = %d %d %d %d\n",inc[0],inc[1],inc[2],inc[3]); printf("im1,im2,im3,im4 = %d %d %d %d\n",im1,im2,im3,im4); */ /* offset to byte within the row */ if (inc[0] > 0) imgpix = imgfpix[0] + im1; else imgpix = imgdim[0] - 1 - imgfpix[0] + im1; /* printf("tilefpix0,1, imgfpix1, it1, inc1, t2= %d %d %d %d %d %d\n", tilefpix[0],tilefpix[1],imgfpix[1],it1,inc[1], t2); printf("i1, it1, tilepix, imgpix %d %d %d %d \n", i1, it1, tilepix, imgpix); */ /* loop over pixels along one row of the image */ for (ipos = imgfpix[0]; ipos <= imglpix[0]; ipos += overlap_flags) { /* convert from image pixel to byte offset */ tilepixbyte = tilepix * pixlen; imgpixbyte = imgpix * pixlen; /* printf(" tilepix, tilepixbyte, imgpix, imgpixbyte= %d %d %d %d\n", tilepix, tilepixbyte, imgpix, imgpixbyte); */ /* copy overlapping row of pixels from image to tile */ memcpy(tile + tilepixbyte, image + imgpixbyte, overlap_bytes); tilepix += (overlap_flags * labs(inc[0])); if (inc[0] > 0) imgpix += overlap_flags; else imgpix -= overlap_flags; } } } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i1r4(long row, /* tile number = row number in table */ unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize byte values into the scaled floating point values */ { long ii; int nextrand, iseed; if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i2r4(long row, /* seed for random values */ short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize short integer values into the scaled floating point values */ { long ii; int nextrand, iseed; if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i4r4(long row, /* tile number = row number in table */ INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize int integer values into the scaled floating point values */ { long ii; int nextrand, iseed; if (fits_rand_value == 0) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (float) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i1r8(long row, /* tile number = row number in table */ unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize byte values into the scaled floating point values */ { long ii; int nextrand, iseed; if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i2r8(long row, /* tile number = row number in table */ short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize short integer values into the scaled floating point values */ { long ii; int nextrand, iseed; if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int unquantize_i4r8(long row, /* tile number = row number in table */ INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int dither_method, /* I - dithering method to use */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ double nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ double *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Unquantize int integer values into the scaled floating point values */ { long ii; int nextrand, iseed; if (fits_rand_value == 0) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); if (nullcheck == 0) /* no null checking required */ { for (ii = 0; ii < ntodo; ii++) { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else /* must check for null values */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (dither_method == SUBTRACTIVE_DITHER_2 && input[ii] == ZERO_VALUE) output[ii] = 0.0; else output[ii] = (double) (((double) input[ii] - fits_rand_value[nextrand] + 0.5) * scale + zero); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } return(*status); } /*--------------------------------------------------------------------------*/ static int imcomp_float2nan(float *indata, long tilelen, int *outdata, float nullflagval, int *status) /* convert pixels that are equal to nullflag to NaNs. Note that indata and outdata point to the same location. */ { int ii; for (ii = 0; ii < tilelen; ii++) { if (indata[ii] == nullflagval) outdata[ii] = -1; /* integer -1 has the same bit pattern as a real*4 NaN */ } return(*status); } /*--------------------------------------------------------------------------*/ static int imcomp_double2nan(double *indata, long tilelen, LONGLONG *outdata, double nullflagval, int *status) /* convert pixels that are equal to nullflag to NaNs. Note that indata and outdata point to the same location. */ { int ii; for (ii = 0; ii < tilelen; ii++) { if (indata[ii] == nullflagval) outdata[ii] = -1; /* integer -1 has the same bit pattern as a real*8 NaN */ } return(*status); } /*--------------------------------------------------------------------------*/ int fits_compress_table_gzip(fitsfile *infptr, fitsfile *outfptr, int *status) /* Transpose the elements in the input table columns from row-major order into column-major order, then compress each column with gzip. Write to the output table (which may be the same as the input table). For example, a table with 10000 rows and 2 '1I' columns will be transformed into a 1 row table with 2 '10000I' columns. */ { LONGLONG nrows, incolwidth[999], inrepeat[999], outcolstart[1000], outbytespan[999]; LONGLONG headstart, datastart, dataend, startbyte, jj, kk, naxis1; long repeat, width, pcount; int ii, ncols, coltype, hdutype, ltrue = 1; char *buffer, *cptr, keyname[9], tform[40], colcode[999], colname[999][50]; char comm[FLEN_COMMENT], *compressed_data; size_t dlen, datasize; float cratio[999]; if (*status > 0) return(*status); fits_get_hdu_type(infptr, &hdutype, status); if (hdutype != BINARY_TBL) { *status = NOT_BTABLE; return(*status); } fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); if (*status > 0) return(*status); if (nrows < 1 || ncols < 1) { /* just copy the HDU if the table has 0 columns or rows */ if (infptr != outfptr) { /* copy input header to the output */ fits_copy_hdu (infptr, outfptr, 0, status); } return(*status); } /* allocate space for the transposed table */ buffer = calloc((size_t) naxis1, (size_t) nrows); if (!buffer) { ffpmsg("Could not allocate buffer for transformed table"); *status = MEMORY_ALLOCATION; return(*status); } if (infptr != outfptr) { /* copy input header to the output */ fits_copy_header(infptr, outfptr, status); } outcolstart[0] = 0; /* do initial setup for each column */ for (ii = 0; ii < ncols; ii++) { /* get the column name */ fits_make_keyn("TTYPE", ii+1, keyname, status); fits_read_key(outfptr, TSTRING, keyname, colname[ii], comm, status); /* get the column type, repeat count, and unit width */ fits_make_keyn("TFORM", ii+1, keyname, status); fits_read_key(outfptr, TSTRING, keyname, tform, comm, status); /* preserve the original TFORM value and comment string */ keyname[0] = 'Z'; fits_write_key(outfptr, TSTRING, keyname, tform, comm, status); keyname[0] = 'T'; fits_binary_tform(tform, &coltype, &repeat, &width, status); /* BIT columns are a difficult case */ /* round up to a multiple of 8 bits */ /* if (coltype == TBIT) { repeat = (repeat + 7) / 8 * 8; } */ cptr = tform; while(isdigit(*cptr)) cptr++; colcode[ii] = *cptr; /* save the column type code */ /* all columns are now VLAs */ fits_modify_key_str(outfptr, keyname, "1PB", "&", status); if (coltype == TBIT) { repeat = (repeat + 7) / 8; /* convert from bits to bytes */ } else if (coltype == TSTRING) { width = 1; /* ignore the optional 'w' in 'rAw' format */ } else if (coltype < 0) { /* pointer to variable length array */ width = 8; if (colcode[ii] == 'Q') width = 16; /* this is a 'Q' not a 'P' column */ repeat = 1; } inrepeat[ii] = repeat; /* width (in bytes) of each element and field in the INPUT row-major table */ incolwidth[ii] = repeat * width; /* starting offset of each field in the OUTPUT column-major table */ outcolstart[ii + 1] = outcolstart[ii] + incolwidth[ii] * nrows; /* length of each sequence of bytes, after sorting them in signicant order */ outbytespan[ii] = (incolwidth[ii] * nrows) / width; } /* the transformed table has only 1 row */ /* output table width 8 bytes per column */ fits_modify_key_lng(outfptr, "NAXIS2", 1, "&", status); fits_modify_key_lng(outfptr, "NAXIS1", ncols * 8, "&", status); /* move to the start of the input table */ fits_get_hduaddrll(infptr, &headstart, &datastart, &dataend, status); ffmbyt(infptr, datastart, 0, status); /* now transpose the table into an array in memory */ for (jj = 0; jj < nrows; jj++) { /* loop over rows */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { kk = 0; cptr = buffer + (outcolstart[ii] + (jj * incolwidth[ii])); /* addr to copy to */ startbyte = (infptr->Fptr)->bytepos; /* save the starting byte location */ ffgbyt(infptr, incolwidth[ii], cptr, status); /* copy all the bytes */ if (incolwidth[ii] >= MINDIRECT) { /* have to explicitly move to next byte */ ffmbyt(infptr, startbyte + incolwidth[ii], 0, status); } } } } fits_set_hdustruc(outfptr, status); /* now compress each column with GZIP and write out to output table */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { datasize = (size_t) (outcolstart[ii + 1] - outcolstart[ii]); /* allocate memory for the compressed data */ compressed_data = malloc(datasize); if (!compressed_data) { ffpmsg("data memory allocation error"); return(-1); } /* gzip compress the data */ compress2mem_from_mem(buffer + outcolstart[ii], datasize, &compressed_data, &datasize, realloc, &dlen, status); /* write the compressed data to the output column */ fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status); /* turn off any data scaling, first */ fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, dlen, compressed_data, status); cratio[ii] = (float) datasize / (float) dlen; free(compressed_data); /* don't need the compressed data any more */ fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "GZIP_1", "compression algorithm for column", status); sprintf(results[ii]," %3d %10.10s %6d%c %6.2f", ii+1, colname[ii], (int) inrepeat[ii],colcode[ii],cratio[ii]); trans_ratio[ii] = cratio[ii]; } else { /* zero length vector column; not compressed */ sprintf(results[ii]," %3d %10.10s %6d%c ", ii+1, colname[ii], (int) inrepeat[ii],colcode[ii]); } } fits_write_key(outfptr, TLOGICAL, "ZTABLE", <rue, "this is a compressed table", status); fits_write_key(outfptr, TLONGLONG, "ZTILELEN", &nrows, "number of rows in each tile", status); /* save the original PCOUNT value */ fits_read_key(infptr, TLONG, "PCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONG, "ZPCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS1", &naxis1, "original rows width", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS2", &nrows, "original number of rows", status); fits_set_hdustruc(outfptr, status); /* copy the heap from input to output file */ fits_gzip_heap(infptr, outfptr, status); free(buffer); return(*status); } /*--------------------------------------------------------------------------*/ int fits_compress_table_rice(fitsfile *infptr, fitsfile *outfptr, int *status) /* Transpose the elements in the input table columns from row-major order into column-major order, and write to the output table (which may be the same as the input table). For example, a table with 10000 rows and 2 '1I' columns will be transformed into a 1 row table with 2 '10000I' columns. Integer columns are then compressed with Rice; all other columns compressed with GZIP. In addition, the bytes in the floating point numeric data values (columns with TFORM = E, and D) are shuffled so that the most significant byte of every element occurs first in the array, followed by the next most significant byte, and so on to the least significant byte. Thus, if you have 3 4-byte numeric values, the bytes 012301230123 get shuffled to 000111222333 */ { LONGLONG nrows, incolwidth[999], inrepeat[999], outcolstart[1000], outbytespan[999]; LONGLONG headstart, datastart, dataend, startbyte, jj, kk, naxis1; long repeat, width, pcount; int ii, ncols, coltype, hdutype, ltrue = 1, print_report = 0; char *buffer, *cptr, keyname[9], tform[40], colcode[999], tempstring[20]; char comm[FLEN_COMMENT], *compressed_data; float cratio[999]; size_t dlen, datasize; if (*status == -999) { /* special flag that means print out diagnostics */ print_report = 1; *status = 0; } if (*status > 0) return(*status); fits_get_hdu_type(infptr, &hdutype, status); if (hdutype != BINARY_TBL) { *status = NOT_BTABLE; return(*status); } fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); if (*status > 0) return(*status); if (nrows < 1 || ncols < 1) { /* just copy the HDU if the table has 0 columns or rows */ if (infptr != outfptr) { /* copy input header to the output */ fits_copy_hdu (infptr, outfptr, 0, status); } return(*status); } /* allocate space for the transposed table */ buffer = calloc((size_t) naxis1, (size_t) nrows); if (!buffer) { ffpmsg("Could not allocate buffer for transformed table"); *status = MEMORY_ALLOCATION; return(*status); } if (infptr != outfptr) { /* copy input header to the output */ fits_copy_header(infptr, outfptr, status); } outcolstart[0] = 0; for (ii = 0; ii < ncols; ii++) { /* get the column type, repeat count, and unit width */ fits_make_keyn("TFORM", ii+1, keyname, status); fits_read_key(outfptr, TSTRING, keyname, tform, comm, status); /* preserve the original TFORM value and comment string */ keyname[0] = 'Z'; fits_write_key(outfptr, TSTRING, keyname, tform, comm, status); keyname[0] = 'T'; fits_binary_tform(tform, &coltype, &repeat, &width, status); /* BIT columns are a difficult case */ /* round up to a multiple of 8 bits */ /* if (coltype == TBIT) { repeat = (repeat + 7) / 8 * 8; } */ cptr = tform; while(isdigit(*cptr)) cptr++; colcode[ii] = *cptr; /* save the column type code */ /* all columns are now VLAs */ fits_modify_key_str(outfptr, keyname, "1PB", "&", status); if (coltype == TBIT) { repeat = (repeat + 7) / 8; /* convert from bits to bytes */ } else if (coltype == TSTRING) { width = 1; /* ignore the optional 'w' in 'rAw' format */ } else if (coltype < 0) { /* pointer to variable length array */ width = 8; if (colcode[ii] == 'Q') width = 16; /* this is a 'Q' not a 'P' column */ repeat = 1; } inrepeat[ii] = repeat; /* width (in bytes) of each element and field in the INPUT row-major table */ incolwidth[ii] = repeat * width; /* starting offset of each field in the OUTPUT column-major table */ outcolstart[ii + 1] = outcolstart[ii] + incolwidth[ii] * nrows; /* length of each sequence of bytes, after sorting them in signicant order */ outbytespan[ii] = (incolwidth[ii] * nrows) / width; } /* the transformed table has only 1 row */ /* output table width 8 bytes per column */ fits_modify_key_lng(outfptr, "NAXIS2", 1, "&", status); fits_modify_key_lng(outfptr, "NAXIS1", ncols * 8, "&", status); /* move to the start of the input table */ fits_get_hduaddrll(infptr, &headstart, &datastart, &dataend, status); ffmbyt(infptr, datastart, 0, status); for (jj = 0; jj < nrows; jj++) { /* loop over rows */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { kk = 0; switch (colcode[ii]) { /* separate the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */ case 'E': while(kk < incolwidth[ii]) { cptr = buffer + (outcolstart[ii] + (jj * inrepeat[ii]) + kk/4); ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ kk += 4; } break; case 'D': case 'K': while(kk < incolwidth[ii]) { cptr = buffer + (outcolstart[ii] + (jj * inrepeat[ii]) + kk/8); ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ kk += 8; } break; default: /* don't bother separating the bytes for other column types */ cptr = buffer + (outcolstart[ii] + (jj * incolwidth[ii])); /* addr to copy to */ startbyte = (infptr->Fptr)->bytepos; /* save the starting byte location */ ffgbyt(infptr, incolwidth[ii], cptr, status); /* copy all the bytes */ if (incolwidth[ii] >= MINDIRECT) { /* have to explicitly move to next byte */ ffmbyt(infptr, startbyte + incolwidth[ii], 0, status); } } } } } fits_set_hdustruc(outfptr, status); for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { datasize = (size_t) (outcolstart[ii + 1] - outcolstart[ii]); /* allocate memory for the compressed data */ compressed_data = malloc(datasize*2); if (!compressed_data) { ffpmsg("data memory allocation error"); return(-1); } switch (colcode[ii]) { case 'I': #if BYTESWAPPED ffswap2((short *) (buffer + outcolstart[ii]), datasize / 2); #endif dlen = fits_rcomp_short ((short *)(buffer + outcolstart[ii]), datasize / 2, (unsigned char *) compressed_data, datasize * 2, 32); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "RICE_1", "compression algorithm for column", status); break; case 'J': #if BYTESWAPPED ffswap4((int *) (buffer + outcolstart[ii]), datasize / 4); #endif dlen = fits_rcomp ((int *)(buffer + outcolstart[ii]), datasize / 4, (unsigned char *) compressed_data, datasize * 2, 32); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "RICE_1", "compression algorithm for column", status); break; case 'B': dlen = fits_rcomp_byte ((signed char *)(buffer + outcolstart[ii]), datasize, (unsigned char *) compressed_data, datasize * 2, 32); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "RICE_1", "compression algorithm for column", status); break; default: /* gzip compress the data */ compress2mem_from_mem(buffer + outcolstart[ii], datasize, &compressed_data, &datasize, realloc, &dlen, status); fits_make_keyn("ZCTYP", ii+1, keyname, status); switch (colcode[ii]) { case 'E': case 'D': case 'K': fits_write_key(outfptr, TSTRING, keyname, "GZIP_2", "compression algorithm for column", status); break; default: fits_write_key(outfptr, TSTRING, keyname, "GZIP_1", "compression algorithm for column", status); } } /* end of switch block */ if (dlen != 0) cratio[ii] = (float) datasize / (float) dlen; /* compression ratio of the column */ /* write the compressed data to the output column */ fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status); /* turn off any data scaling, first */ fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, dlen, compressed_data, status); free(compressed_data); /* don't need the compressed data any more */ /* printf(" %c %5.2f\n",colcode[ii],cratio[ii]); */ if (colcode[ii] == 'I' || colcode[ii] == 'J' || colcode[ii] == 'B') sprintf(tempstring," %6.2f\n",cratio[ii]); else sprintf(tempstring," \n"); strcat(results[ii],tempstring); } } /* end of loop over ncols */ if (print_report) { printf(" Compression Ratios: Gzip Shuf Rice\n"); for (ii = 0; ii < ncols; ii++) { printf("%s", results[ii]); } } fits_write_key(outfptr, TLOGICAL, "ZTABLE", <rue, "this is a compressed table", status); fits_write_key(outfptr, TLONGLONG, "ZTILELEN", &nrows, "number of rows in each tile", status); /* save the original PCOUNT value */ fits_read_key(infptr, TLONG, "PCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONG, "ZPCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS1", &naxis1, "original rows width", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS2", &nrows, "original number of rows", status); free(buffer); fits_gzip_heap(infptr, outfptr, status); fits_set_hdustruc(outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_compress_table_shuffle(fitsfile *infptr, fitsfile *outfptr, int *status) /* Compress the input FITS binary table using the 'fast' method, which consists of (a) transposing the rows and columns, and (b) shuffling the bytes for the I, J, K, E, and D columns so that the most significant byte of every element occurs first in the array, followed by the next most significant byte, and so on to the least significant byte. Thus, if you have 3 4-byte numeric values, the bytes 012301230123 get shuffled to 000111222333 Finally, (c) compress each column of bytes with gzip and copy to the output table. */ { LONGLONG nrows, incolwidth[999], inrepeat[999], outcolstart[1000], outbytespan[999]; LONGLONG headstart, datastart, dataend, startbyte, jj, kk, naxis1; long repeat, width, pcount; int ii, ncols, coltype, hdutype, ltrue = 1; char *buffer, *cptr, keyname[9], tform[40], colcode[999]; char comm[FLEN_COMMENT], *compressed_data, tempstring[20]; size_t dlen, datasize; float cratio[999]; if (*status > 0) return(*status); fits_get_hdu_type(infptr, &hdutype, status); if (hdutype != BINARY_TBL) { *status = NOT_BTABLE; return(*status); } fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); if (*status > 0) return(*status); if (nrows < 1 || ncols < 1) { /* just copy the HDU if the table has 0 columns or rows */ if (infptr != outfptr) { /* copy input header to the output */ fits_copy_hdu (infptr, outfptr, 0, status); } return(*status); } /* allocate space for the transposed table */ buffer = calloc((size_t) naxis1, (size_t) nrows); if (!buffer) { ffpmsg("Could not allocate buffer for transformed table"); *status = MEMORY_ALLOCATION; return(*status); } if (infptr != outfptr) { /* copy input header to the output */ fits_copy_header(infptr, outfptr, status); } fits_write_key_log(outfptr, "ZTABLE", 1, "extension contains compressed binary table", status); fits_write_key(outfptr, TLONGLONG, "ZTILELEN", &nrows, "number of rows in each tile", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS1", &naxis1, "original rows width", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS2", &nrows, "original number of rows", status); /* save the original PCOUNT value */ fits_read_key(infptr, TLONG, "PCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONG, "ZPCOUNT", &pcount, comm, status); /* reset the PCOUNT keyword to zero */ pcount = 0; fits_modify_key_lng(outfptr, "PCOUNT", pcount, NULL, status); outcolstart[0] = 0; for (ii = 0; ii < ncols; ii++) { /* get the column type, repeat count, and unit width */ fits_make_keyn("TFORM", ii+1, keyname, status); fits_read_key(outfptr, TSTRING, keyname, tform, comm, status); /* preserve the original TFORM value and comment string */ keyname[0] = 'Z'; fits_write_key(outfptr, TSTRING, keyname, tform, comm, status); keyname[0] = 'T'; /* all columns are now VLAs */ fits_modify_key_str(outfptr, keyname, "1PB", "&", status); fits_binary_tform(tform, &coltype, &repeat, &width, status); cptr = tform; while(isdigit(*cptr)) cptr++; colcode[ii] = *cptr; /* save the column type code */ if (coltype == TBIT) { repeat = (repeat + 7) / 8; /* convert from bits to bytes */ } else if (coltype == TSTRING) { width = 1; /* ignore the optional 'w' in 'rAw' format */ } else if (coltype < 0) { /* pointer to variable length array */ width = 8; if (colcode[ii] == 'Q') width = 16; /* this is a 'Q' not a 'P' column */ repeat = 1; } inrepeat[ii] = repeat; /* width (in bytes) of each element and field in the INPUT row-major table */ incolwidth[ii] = repeat * width; /* starting offset of each field in the OUTPUT column-major table */ outcolstart[ii + 1] = outcolstart[ii] + incolwidth[ii] * nrows; /* length of each sequence of bytes, after sorting them in signicant order */ outbytespan[ii] = (incolwidth[ii] * nrows) / width; } /* the transformed table has only 1 row */ /* output table width 8 bytes per column */ fits_modify_key_lng(outfptr, "NAXIS2", 1, "&", status); fits_modify_key_lng(outfptr, "NAXIS1", ncols * 8, "&", status); /* move to the start of the input table */ fits_get_hduaddrll(infptr, &headstart, &datastart, &dataend, status); ffmbyt(infptr, datastart, 0, status); for (jj = 0; jj < nrows; jj++) { /* loop over rows */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { kk = 0; switch (colcode[ii]) { /* separate the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */ case 'I': while(kk < incolwidth[ii]) { cptr = buffer + (outcolstart[ii] + (jj * inrepeat[ii]) + kk/2); ffgbyt(infptr, 1, cptr, status); /* copy 1st byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 2nd byte */ kk += 2; } break; case 'J': case 'E': while(kk < incolwidth[ii]) { cptr = buffer + (outcolstart[ii] + (jj * inrepeat[ii]) + kk/4); ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ kk += 4; } break; case 'D': case 'K': while(kk < incolwidth[ii]) { cptr = buffer + (outcolstart[ii] + (jj * inrepeat[ii]) + kk/8); ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ cptr += outbytespan[ii]; ffgbyt(infptr, 1, cptr, status); /* copy 1 byte */ kk += 8; } break; default: /* don't bother separating the bytes for other column types */ cptr = buffer + (outcolstart[ii] + (jj * incolwidth[ii])); /* addr to copy to */ startbyte = (infptr->Fptr)->bytepos; /* save the starting byte location */ ffgbyt(infptr, incolwidth[ii], cptr, status); /* copy all the bytes */ if (incolwidth[ii] >= MINDIRECT) { /* have to explicitly move to next byte */ ffmbyt(infptr, startbyte + incolwidth[ii], 0, status); } } } } } fits_set_hdustruc(outfptr, status); /* now compress each column */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { /* write the compression type code for this column */ switch (colcode[ii]) { case 'I': case 'J': case 'K': case 'E': case 'D': fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "GZIP_2", "compression algorithm for column", status); break; default: fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "GZIP_1", "compression algorithm for column", status); } datasize = (size_t) (outcolstart[ii + 1] - outcolstart[ii]); /* allocate memory for the compressed data */ compressed_data = malloc(datasize); if (!compressed_data) { ffpmsg("data memory allocation error"); return(-1); } /* gzip compress the data */ compress2mem_from_mem(buffer + outcolstart[ii], datasize, &compressed_data, &datasize, realloc, &dlen, status); /* write the compressed data to the output column */ fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status); /* turn off any data scaling, first */ fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, dlen, compressed_data, status); cratio[ii] = (float) datasize / (float) dlen; free(compressed_data); /* don't need the compressed data any more */ sprintf(tempstring," %6.2f",cratio[ii]); strcat(results[ii],tempstring); } } free(buffer); /* shuffle and compress the input heap and append to the output file */ fits_gzip_heap(infptr, outfptr, status); fits_set_hdustruc(outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_compress_table_best(fitsfile *infptr, fitsfile *outfptr, int *status) /* Compress the input FITS binary table using the 'best' compression method, i.e, whichever method produces the highest compression for each column. First, transpose the rows and columns in the table, then, depending on the data type of the column, try the different compression methods to see which one produces the highest amount of compression. */ { LONGLONG nrows, incolwidth[999], inrepeat[999], outcolstart[1000], outbytespan[999]; LONGLONG headstart, datastart, dataend, startbyte, jj, naxis1; long repeat, width, pcount; int ii, ncols, coltype, hdutype, ltrue = 1; char *buffer, *cptr, keyname[9], tform[40], colcode[999]; char comm[FLEN_COMMENT]; char *gzip1_data = 0, *gzip2_data = 0, *rice_data = 0; size_t gzip1_len, gzip2_len, rice_len, datasize, buffsize; if (*status > 0) return(*status); fits_get_hdu_type(infptr, &hdutype, status); if (hdutype != BINARY_TBL) { *status = NOT_BTABLE; return(*status); } fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); if (*status > 0) return(*status); if (nrows < 1 || ncols < 1) { /* just copy the HDU if the table has 0 columns or rows */ if (infptr != outfptr) { /* copy input header to the output */ fits_copy_hdu (infptr, outfptr, 0, status); } return(*status); } /* allocate space for the transposed table */ buffer = calloc((size_t) naxis1, (size_t) nrows); if (!buffer) { ffpmsg("Could not allocate buffer for transformed table"); *status = MEMORY_ALLOCATION; return(*status); } if (infptr != outfptr) { /* copy input header to the output */ fits_copy_header(infptr, outfptr, status); } fits_write_key_log(outfptr, "ZTABLE", 1, "extension contains compressed binary table", status); fits_write_key(outfptr, TLONGLONG, "ZTILELEN", &nrows, "number of rows in each tile", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS1", &naxis1, "original rows width", status); fits_write_key(outfptr, TLONGLONG, "ZNAXIS2", &nrows, "original number of rows", status); /* save the original PCOUNT value */ fits_read_key(infptr, TLONG, "PCOUNT", &pcount, comm, status); fits_write_key(outfptr, TLONG, "ZPCOUNT", &pcount, comm, status); /* reset the PCOUNT keyword to zero */ pcount = 0; fits_modify_key_lng(outfptr, "PCOUNT", pcount, NULL, status); /* Modify the TFORMn keywords; all columns become variable-length arrays. */ /* Save the original TFORMn values in the corresponding ZFORMn keyword. */ outcolstart[0] = 0; for (ii = 0; ii < ncols; ii++) { /* get the column type, repeat count, and unit width */ fits_make_keyn("TFORM", ii+1, keyname, status); fits_read_key(outfptr, TSTRING, keyname, tform, comm, status); /* preserve the original TFORM value and comment string */ keyname[0] = 'Z'; fits_write_key(outfptr, TSTRING, keyname, tform, comm, status); keyname[0] = 'T'; /* all columns are now VLAs */ fits_modify_key_str(outfptr, keyname, "1PB", "&", status); fits_binary_tform(tform, &coltype, &repeat, &width, status); cptr = tform; while(isdigit(*cptr)) cptr++; colcode[ii] = *cptr; /* save the column type code */ /* deal with special cases */ if (coltype == TBIT) { repeat = (repeat + 7) / 8; /* convert from bits to bytes */ } else if (coltype == TSTRING) { width = 1; /* ignore the optional 'w' in 'rAw' format */ } else if (coltype < 0) { /* pointer to variable length array */ repeat = 1; if (colcode[ii] == 'Q') width = 16; /* this is a 'Q' column */ else width = 8; /* this is a 'P' column */ } inrepeat[ii] = repeat; /* width (in bytes) of each element and field in the INPUT row-major table */ incolwidth[ii] = repeat * width; /* starting offset of each field in the OUTPUT column-major table */ outcolstart[ii + 1] = outcolstart[ii] + incolwidth[ii] * nrows; /* length of each sequence of bytes, after sorting them in signicant order */ outbytespan[ii] = (incolwidth[ii] * nrows) / width; } /* the transformed table has only 1 row */ /* output table width 8 bytes per column */ fits_modify_key_lng(outfptr, "NAXIS2", 1, "&", status); fits_modify_key_lng(outfptr, "NAXIS1", ncols * 8, "&", status); /* move to the start of the input table */ fits_get_hduaddrll(infptr, &headstart, &datastart, &dataend, status); ffmbyt(infptr, datastart, 0, status); /* now transpose the rows and columns in the table into an array in memory */ for (jj = 0; jj < nrows; jj++) { /* loop over rows */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { cptr = buffer + (outcolstart[ii] + (jj * incolwidth[ii])); /* output address */ startbyte = (infptr->Fptr)->bytepos; /* save the starting byte location */ ffgbyt(infptr, incolwidth[ii], cptr, status); /* copy the column element */ if (incolwidth[ii] >= MINDIRECT) { /* have to explicitly move to next byte */ ffmbyt(infptr, startbyte + incolwidth[ii], 0, status); } } } } fits_set_hdustruc(outfptr, status); /* reinitialize internal pointers */ /* Now compress each column. Depending on the column data type, try */ /* all the various available compression algorithms, then choose the one */ /* that gives the most compression. */ for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (inrepeat[ii] > 0) { datasize = (size_t) (outcolstart[ii + 1] - outcolstart[ii]); /* allocate memory for the gzip compressed data */ gzip1_data = malloc(datasize); if (!gzip1_data) { ffpmsg("data memory allocation error"); return(-1); } buffsize = datasize; /* First, simply compress the bytes with gzip (GZIP_1 algorithm code). */ /* This algorithm can be applied to every type of column. */ compress2mem_from_mem(buffer + outcolstart[ii], datasize, &gzip1_data, &buffsize, realloc, &gzip1_len, status); /* depending on the data type, try other compression methods */ switch (colcode[ii]) { case 'I': /* 2-byte Integer columns */ /************* first, try rice compression *****************/ rice_data = malloc(datasize * 2); /* memory for the compressed bytes */ if (!rice_data) { ffpmsg("data memory allocation error"); return(-1); } #if BYTESWAPPED /* have to swap the bytes on little endian machines */ ffswap2((short *) (buffer + outcolstart[ii]), datasize / 2); #endif rice_len = fits_rcomp_short ((short *)(buffer + outcolstart[ii]), datasize / 2, (unsigned char *) rice_data, datasize * 2, 32); #if BYTESWAPPED /* un-swap the bytes, to restore the original order */ ffswap2((short *) (buffer + outcolstart[ii]), datasize / 2); #endif /************* Second, try shuffled gzip compression *****************/ fits_shuffle_2bytes(buffer + outcolstart[ii], datasize / 2, status); /* allocate memory for the shuffled gzip compressed data */ gzip2_data = malloc(datasize); if (!gzip2_data) { ffpmsg("data memory allocation error"); return(-1); } buffsize = datasize; compress2mem_from_mem(buffer + outcolstart[ii], datasize, &gzip2_data, &buffsize, realloc, &gzip2_len, status); break; case 'J': /* 4-byte Integer columns */ /************* first, try rice compression *****************/ rice_data = malloc(datasize * 2); /* memory for the compressed bytes */ if (!rice_data) { ffpmsg("data memory allocation error"); return(-1); } #if BYTESWAPPED /* have to swap the bytes on little endian machines */ ffswap4((int *) (buffer + outcolstart[ii]), datasize / 4); #endif rice_len = fits_rcomp ((int *)(buffer + outcolstart[ii]), datasize / 4, (unsigned char *) rice_data, datasize * 2, 32); #if BYTESWAPPED /* un-swap the bytes, to restore the original order */ ffswap4((int *) (buffer + outcolstart[ii]), datasize / 4); #endif /************* Second, try shuffled gzip compression *****************/ fits_shuffle_4bytes(buffer + outcolstart[ii], datasize / 4, status); /* allocate memory for the shuffled gzip compressed data */ gzip2_data = malloc(datasize); if (!gzip2_data) { ffpmsg("data memory allocation error"); return(-1); } buffsize = datasize; compress2mem_from_mem(buffer + outcolstart[ii], datasize, &gzip2_data, &buffsize, realloc, &gzip2_len, status); break; case 'E': /* 4-byte floating-point */ /************* try shuffled gzip compression *****************/ fits_shuffle_4bytes(buffer + outcolstart[ii], datasize / 4, status); /* allocate memory for the gzip compressed data */ gzip2_data = malloc(datasize); if (!gzip2_data) { ffpmsg("data memory allocation error"); return(-1); } buffsize = datasize; compress2mem_from_mem(buffer + outcolstart[ii], datasize, &gzip2_data, &buffsize, realloc, &gzip2_len, status); rice_len = 100 * datasize; /* rice is not applicable to R*4 data */ break; case 'K': case 'D': /* 8-byte floating-point or integers */ /************* try shuffled gzip compression *****************/ fits_shuffle_8bytes(buffer + outcolstart[ii], datasize / 8, status); /* allocate memory for the gzip compressed data */ gzip2_data = malloc(datasize); if (!gzip2_data) { ffpmsg("data memory allocation error"); return(-1); } buffsize = datasize; compress2mem_from_mem(buffer + outcolstart[ii], datasize, &gzip2_data, &buffsize, realloc, &gzip2_len, status); rice_len = 100 * datasize; /* rice is not applicable to R*8 or I*8 data */ break; default: /* L, X, B, A, C, M, P, Q type columns: no other compression options */ rice_len = 100 * datasize; /* rice is not applicable */ gzip2_len = 100 * datasize; /* shuffled-gzip is not applicable */ } /* end of switch block */ /* now write the compressed bytes from the best algorithm */ fits_set_tscale(outfptr, ii + 1, 1.0, 0.0, status); /* turn off any data scaling, first */ if (gzip1_len <= gzip2_len && gzip1_len <= rice_len) { fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, gzip1_len, gzip1_data, status); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "GZIP_1", "compression algorithm for column", status); } else if (gzip2_len <= gzip1_len && gzip2_len <= rice_len) { fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, gzip2_len, gzip2_data, status); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "GZIP_2", "compression algorithm for column", status); } else { fits_write_col(outfptr, TBYTE, ii + 1, 1, 1, rice_len, rice_data, status); fits_make_keyn("ZCTYP", ii+1, keyname, status); fits_write_key(outfptr, TSTRING, keyname, "RICE_1", "compression algorithm for column", status); } /* free the temporary memory */ if (gzip1_data) free(gzip1_data); if (gzip2_data) free(gzip2_data); gzip1_data = 0; gzip2_data = 0; } } free(buffer); /* shuffle and compress the input heap and append to the output file */ fits_gzip_heap(infptr, outfptr, status); fits_set_hdustruc(outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status) /* Uncompress the table that was compressed with fits_compress_table_fast or fits_compress_table_best. */ { LONGLONG nrows, rmajor_colwidth[999], rmajor_colstart[1000], cmajor_colstart[1000]; LONGLONG cmajor_repeat[999], rmajor_repeat[999], cmajor_bytespan[999], kk; LONGLONG headstart, datastart, dataend; long repeat, width, vla_repeat; int ncols, coltype, hdutype, anynull, tstatus, zctype[999]; char *buffer, *transbuffer, *cptr, keyname[9], tform[40], colcode[999]; long pcount, zheapptr, naxis1, naxis2, ii, jj; char *ptr, comm[FLEN_COMMENT], zvalue[FLEN_VALUE]; size_t dlen, fullsize; /**** do initial sanity checks *****/ if (*status > 0) return(*status); fits_get_hdu_type(infptr, &hdutype, status); if (hdutype != BINARY_TBL) { *status = NOT_BTABLE; return(*status); } fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); if (nrows != 1 || (ncols < 1)) { /* just copy the HDU if the table does not have 1 row and more than 0 columns */ if (infptr != outfptr) { fits_copy_hdu (infptr, outfptr, 0, status); } return(*status); } /**** get size of the uncompressed table */ fits_read_key(infptr, TLONG, "ZNAXIS1", &naxis1, comm, status); if (*status > 0) { ffpmsg("Could not find the required ZNAXIS1 keyword"); *status = 1; return(*status); } fits_read_key(infptr, TLONG, "ZNAXIS2", &naxis2, comm, status); if (*status > 0) { ffpmsg("Could not find the required ZNAXIS2 keyword"); *status = 1; return(*status); } fits_read_key(infptr, TLONG, "ZPCOUNT", &pcount, comm, status); if (*status > 0) { ffpmsg("Could not find the required ZPCOUNT keyword"); *status = 1; return(*status); } tstatus = 0; fits_read_key(infptr, TLONG, "ZHEAPPTR", &zheapptr, comm, &tstatus); if (tstatus > 0) { zheapptr = 0; /* uncompressed table has no heap */ } /**** recreate the uncompressed table header keywords ****/ fits_copy_header(infptr, outfptr, status); /* reset the NAXISn keywords to what they were in the original uncompressed table */ fits_modify_key_lng(outfptr, "NAXIS1", naxis1, "&", status); fits_modify_key_lng(outfptr, "NAXIS2", naxis2, "&", status); fits_modify_key_lng(outfptr, "PCOUNT", pcount, "&", status); fits_delete_key(outfptr, "ZTABLE", status); fits_delete_key(outfptr, "ZNAXIS1", status); fits_delete_key(outfptr, "ZNAXIS2", status); fits_delete_key(outfptr, "ZPCOUNT", status); fits_delete_key(outfptr, "ZTILELEN", status); tstatus = 0; fits_delete_key(outfptr, "ZHEAPPTR", &tstatus); /**** get the compression method that was used for each column ****/ for (ii = 0; ii < ncols; ii++) { /* construct the ZCTYPn keyword name then read the keyword */ fits_make_keyn("ZCTYP", ii+1, keyname, status); tstatus = 0; fits_read_key(infptr, TSTRING, keyname, zvalue, NULL, &tstatus); if (tstatus) { zctype[ii] = GZIP_2; } else { if (!strcmp(zvalue, "GZIP_2")) { zctype[ii] = GZIP_2; } else if (!strcmp(zvalue, "GZIP_1")) { zctype[ii] = GZIP_1; } else if (!strcmp(zvalue, "RICE_1")) { zctype[ii] = RICE_1; } else { ffpmsg("Unrecognized ZCTYPn keyword compression code:"); ffpmsg(zvalue); *status = DATA_DECOMPRESSION_ERR; return(*status); } /* delete this keyword from the uncompressed header */ fits_delete_key(outfptr, keyname, status); } } /**** allocate space for the full transposed and untransposed table ****/ fullsize = naxis1 * naxis2; transbuffer = malloc(fullsize); if (!transbuffer) { ffpmsg("Could not allocate buffer for shuffled table"); *status = MEMORY_ALLOCATION; return(*status); } buffer = malloc(fullsize); if (!buffer) { ffpmsg("Could not allocate buffer for unshuffled table"); *status = MEMORY_ALLOCATION; return(*status); } /*** loop over each column: read and uncompress the bytes ****/ rmajor_colstart[0] = 0; cmajor_colstart[0] = 0; for (ii = 0; ii < ncols; ii++) { /* get the original column type, repeat count, and unit width */ fits_make_keyn("ZFORM", ii+1, keyname, status); fits_read_key(infptr, TSTRING, keyname, tform, comm, status); /* restore the original TFORM value and comment */ keyname[0] = 'T'; fits_modify_key_str(outfptr, keyname, tform, comm, status); /* now delete the ZFORM keyword */ keyname[0] = 'Z'; fits_delete_key(outfptr, keyname, status); cptr = tform; while(isdigit(*cptr)) cptr++; colcode[ii] = *cptr; /* save the column type code */ fits_binary_tform(tform, &coltype, &repeat, &width, status); /* deal with special cases */ if (coltype == TBIT) { repeat = (repeat + 7) / 8 ; /* convert from bits to bytes */ } else if (coltype == TSTRING) { width = 1; } else if (coltype < 0) { /* pointer to variable length array */ if (colcode[ii] == 'P') width = 8; /* this is a 'P' column */ else width = 16; /* this is a 'Q' not a 'P' column */ } rmajor_repeat[ii] = repeat; cmajor_repeat[ii] = repeat * naxis2; /* width (in bytes) of each field in the row-major table */ rmajor_colwidth[ii] = rmajor_repeat[ii] * width; /* starting offset of each field in the column-major table */ cmajor_colstart[ii + 1] = cmajor_colstart[ii] + rmajor_colwidth[ii] * naxis2; /* length of each sequence of bytes, after sorting them in signicant order */ cmajor_bytespan[ii] = (rmajor_colwidth[ii] * naxis2) / width; /* starting offset of each field in the row-major table */ rmajor_colstart[ii + 1] = rmajor_colstart[ii] + rmajor_colwidth[ii]; if (rmajor_repeat[ii] > 0) { /* read compressed bytes from input table */ fits_read_descript(infptr, ii + 1, 1, &vla_repeat, NULL, status); /* allocate memory and read in the compressed bytes */ ptr = malloc(vla_repeat); if (!ptr) { ffpmsg("Could not allocate buffer for compressed bytes"); *status = MEMORY_ALLOCATION; return(*status); } fits_set_tscale(infptr, ii + 1, 1.0, 0.0, status); /* turn off any data scaling, first */ fits_read_col_byt(infptr, ii + 1, 1, 1, vla_repeat, 0, (unsigned char *) ptr, &anynull, status); cptr = transbuffer + cmajor_colstart[ii]; fullsize = (size_t) (cmajor_colstart[ii+1] - cmajor_colstart[ii]); switch (colcode[ii]) { /* separate the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */ case 'I': if (zctype[ii] == RICE_1) { dlen = fits_rdecomp_short((unsigned char *)ptr, vla_repeat, (unsigned short *)cptr, fullsize / 2, 32); #if BYTESWAPPED ffswap2((short *) cptr, fullsize / 2); #endif } else { /* gunzip the data into the correct location */ uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status); } break; case 'J': if (zctype[ii] == RICE_1) { dlen = fits_rdecomp ((unsigned char *) ptr, vla_repeat, (unsigned int *)cptr, fullsize / 4, 32); #if BYTESWAPPED ffswap4((int *) cptr, fullsize / 4); #endif } else { /* gunzip the data into the correct location */ uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status); } break; case 'B': if (zctype[ii] == RICE_1) { dlen = fits_rdecomp_byte ((unsigned char *) ptr, vla_repeat, (unsigned char *)cptr, fullsize, 32); } else { /* gunzip the data into the correct location */ uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status); } break; default: /* gunzip the data into the correct location in the full table buffer */ uncompress2mem_from_mem(ptr, vla_repeat, &cptr, &fullsize, realloc, &dlen, status); } /* end of switch block */ free(ptr); } } /* now transpose the rows and columns (from transbuffer to buffer) */ ptr = transbuffer; for (ii = 0; ii < ncols; ii++) { /* loop over columns */ if (rmajor_repeat[ii] > 0) { if ((zctype[ii] == GZIP_2)) { /* need to unshuffle the bytes */ switch (colcode[ii]) { /* recombine the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */ case 'I': /* get the 1st byte of each I*2 value */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols])); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 2; } } /* get the 2nd byte of each I*2 value */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 2; } } break; case 'J': case 'E': /* get the 1st byte of each 4-byte value */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols])); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 4; } } /* get the 2nd byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 4; } } /* get the 3rd byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 2); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 4; } } /* get the 4th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 3); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 4; } } break; case 'D': case 'K': /* get the 1st byte of each 8-byte value */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols])); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 2nd byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 1); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 3rd byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 2); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 4th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 3); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 5th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 4); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 6th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 5); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 7th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 6); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } /* get the 8th byte */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + (jj * rmajor_colstart[ncols]) + 7); for (kk = 0; kk < rmajor_repeat[ii]; kk++) { *cptr = *ptr; /* copy 1 byte */ ptr++; cptr += 8; } } break; default: /* should never get here */ ffpmsg("Error: unexpected use of GZIP_2 to compress a column"); *status = DATA_DECOMPRESSION_ERR; return(*status); } /* end of switch */ } else { /* not GZIP_2, so just transpose the bytes */ for (jj = 0; jj < naxis2; jj++) { /* loop over number of rows in the output table */ cptr = buffer + (rmajor_colstart[ii] + jj * rmajor_colstart[ncols]); /* addr to copy to */ memcpy(cptr, ptr, (size_t) rmajor_colwidth[ii]); ptr += (rmajor_colwidth[ii]); } } } } /* end of ncols loop */ /* copy the buffer of data to the output data unit */ fits_get_hduaddrll(outfptr, &headstart, &datastart, &dataend, status); ffmbyt(outfptr, datastart, 1, status); ffpbyt(outfptr, naxis1 * naxis2, buffer, status); free(buffer); free(transbuffer); /* reset internal table structure parameters */ fits_set_hdustruc(outfptr, status); /* unshuffle the heap, if it exists */ fits_gunzip_heap(infptr, outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_gzip_datablocks(fitsfile *fptr, size_t *size, int *status) /* GZIP compress all the data blocks in the binary table HDU. Store the size of the compressed byte stream in the PCOUNT keyword. Save the original PCOUNT value in the ZPCOUNT keyword. */ { long headstart, datastart, dataend; char *ptr, *cptr, *iptr; size_t dlen, datasize, ii; /* allocate memory for the data and the compressed data */ fits_get_hduaddr(fptr, &headstart, &datastart, &dataend, status); datasize = dataend - datastart; ptr = malloc(datasize); cptr = malloc(datasize); if (!ptr || !cptr) { ffpmsg("data memory allocation error in fits_gzip_datablocks\n"); return(-1); } /* copy the data into memory */ ffmbyt(fptr,datastart, REPORT_EOF, status); iptr = ptr; for (ii = 0; ii < datasize; ii+= 2880) { ffgbyt(fptr, 2880, iptr, status); iptr += 2880; } /* gzip compress the data */ compress2mem_from_mem(ptr, datasize, &cptr, &datasize, realloc, &dlen, status); *size = dlen; free(cptr); /* don't need the compressed data any more */ free(ptr); /* don't need the original data any more */ return(*status); } /*--------------------------------------------------------------------------*/ static int fits_gzip_heap(fitsfile *infptr, fitsfile *outfptr, int *status) /* Compress the binary table heap in the input file and write it to the output file. First, shuffle the bytes for the numeric arrays in the heap, so that the bytes are sorted in order of decreasing significance. Then gzip the entire heap as a single block of data. Then append this compressed heap to the end of any existing data in the output file heap. */ { LONGLONG datastart, dataend, nrows, naxis1, heapsize, length, offset, pcount, jj; int coltype, ncols, ii; char *heap, *compheap, card[FLEN_CARD]; size_t theapsize, compsize; if (*status > 0) return(*status); /* insert a set of COMMENT keyword to indicate that this is a compressed table */ fits_read_card(outfptr, "TFIELDS", card, status); fits_insert_card(outfptr, "COMMENT [FPACK] This is a compressed binary table generated by fpack.", status); fits_insert_card(outfptr, "COMMENT [FPACK] It can be uncompressed using funpack.", status); fits_insert_card(outfptr, "COMMENT [FPACK] fpack and funpack are available from the HEASARC Web site.", status); /* get the size of the heap (value of PCOUNT keyword) */ fits_read_key(infptr, TLONGLONG, "PCOUNT", &heapsize, NULL, status); /* return if there is no heap */ if (*status != 0 || heapsize == 0) return(*status); /* allocate memory for the heap and compressed heap */ heap = malloc((size_t) heapsize); if (!heap) { ffpmsg("Could not allocate buffer for the heap (fits_gzip_heap"); *status = MEMORY_ALLOCATION; return(*status); } compheap = malloc((size_t) heapsize); if (!compheap) { ffpmsg("Could not allocate buffer for compressed heap (fits_gzip_heap"); free(heap); *status = MEMORY_ALLOCATION; return(*status); } fits_get_hduaddrll(infptr, NULL, &datastart, NULL, status); fits_get_num_rowsll(infptr, &nrows, status); fits_get_num_cols(infptr, &ncols, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); /* move to start of the heap and copy the heap into memory */ ffmbyt(infptr, datastart + (nrows * naxis1), REPORT_EOF, status); ffgbyt(infptr, heapsize, heap, status); /* shuffle the bytes for the numeric columns */ for (ii = 1; ii <= ncols; ii++) { fits_get_coltype(infptr, ii, &coltype, NULL, NULL, status); if (coltype >= 0) continue; /* only interested in variable length columns */ coltype = coltype * (-1); switch (coltype) { /* shuffle the bytes for the 2-byte, 4-byte, and 8-byte numeric columns */ case TSHORT: for (jj = 1; jj <= nrows; jj++) { fits_read_descriptll(infptr, ii, jj, &length, &offset, status); fits_shuffle_2bytes(heap + offset, length, status); } break; case TLONG: case TFLOAT: for (jj = 1; jj <= nrows; jj++) { fits_read_descriptll(infptr, ii, jj, &length, &offset, status); fits_shuffle_4bytes(heap + offset, length, status); } break; case TDOUBLE: case TLONGLONG: for (jj = 1; jj <= nrows; jj++) { fits_read_descriptll(infptr, ii, jj, &length, &offset, status); fits_shuffle_8bytes(heap + offset, length, status); } break; default: /* don't have to do anything for other column types */ break; } /* end of switch block */ } /* gzip compress the shuffled heap */ theapsize = (size_t) heapsize; compress2mem_from_mem(heap, (size_t) heapsize, &compheap, &theapsize, realloc, &compsize, status); free(heap); /* don't need the uncompresse heap any more */ /* update the internal pointers */ fits_set_hdustruc(outfptr, status); /* save offset to the start of the compressed heap, relative to the start of the main data table in the ZHEAPPTR keyword, and update PCOUNT to the new extended heap size */ fits_read_key(outfptr, TLONGLONG, "PCOUNT", &pcount, NULL, status); fits_get_num_rowsll(outfptr, &nrows, status); fits_read_key(outfptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); fits_write_key_lng(outfptr, "ZHEAPPTR", (LONGLONG) ((nrows * naxis1) + pcount), "byte offset to compressed heap", status); fits_modify_key_lng(outfptr, "PCOUNT", pcount + compsize, NULL, status); /* now append the compressed heap to the heap in the output file */ dataend = (outfptr->Fptr)->datastart + (outfptr->Fptr)->heapstart + (outfptr->Fptr)->heapsize; ffmbyt(outfptr, dataend, IGNORE_EOF, status); ffpbyt(outfptr, compsize, compheap, status); free(compheap); /* also update the internal pointer to the heap size */ (outfptr->Fptr)->heapsize = (outfptr->Fptr)->heapsize + compsize; /* update the internal pointers again */ fits_set_hdustruc(outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_shuffle_2bytes(char *heap, LONGLONG length, int *status) /* shuffle the bytes in an array of 2-byte integers in the heap */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = malloc((size_t) (length * 2)); heapptr = heap; cptr = ptr; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; heapptr++; *(cptr + length) = *heapptr; heapptr++; cptr++; } memcpy(heap, ptr, (size_t) (length * 2)); free(ptr); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_shuffle_4bytes(char *heap, LONGLONG length, int *status) /* shuffle the bytes in an array of 4-byte integers or floats */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = malloc((size_t) (length * 4)); if (!ptr) { ffpmsg("malloc failed\n"); return(*status); } heapptr = heap; cptr = ptr; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; heapptr++; *(cptr + length) = *heapptr; heapptr++; *(cptr + (length * 2)) = *heapptr; heapptr++; *(cptr + (length * 3)) = *heapptr; heapptr++; cptr++; } memcpy(heap, ptr, (size_t) (length * 4)); free(ptr); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_shuffle_8bytes(char *heap, LONGLONG length, int *status) /* shuffle the bytes in an array of 8-byte integers or doubles in the heap */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = calloc(1, (size_t) (length * 8)); heapptr = heap; /* for some bizarre reason this loop fails to compile under OpenSolaris using the proprietary SunStudioExpress C compiler; use the following equivalent loop instead. cptr = ptr; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; heapptr++; *(cptr + length) = *heapptr; heapptr++; *(cptr + (length * 2)) = *heapptr; heapptr++; *(cptr + (length * 3)) = *heapptr; heapptr++; *(cptr + (length * 4)) = *heapptr; heapptr++; *(cptr + (length * 5)) = *heapptr; heapptr++; *(cptr + (length * 6)) = *heapptr; heapptr++; *(cptr + (length * 7)) = *heapptr; heapptr++; cptr++; } */ for (ii = 0; ii < length; ii++) { cptr = ptr + ii; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; cptr += length; *cptr = *heapptr; heapptr++; } memcpy(heap, ptr, (size_t) (length * 8)); free(ptr); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_gunzip_heap(fitsfile *infptr, fitsfile *outfptr, int *status) /* inverse of the fits_gzip_heap function: uncompress and unshuffle the heap in the input file and write it to the output file */ { LONGLONG datastart, nrows, naxis1, length, offset, pcount, jj; LONGLONG zpcount, zheapptr, cheapsize; int coltype, ncols, ii; char *heap, *compheap; size_t arraysize, theapsize; if (*status > 0) return(*status); /* first, delete any COMMENT keywords written by fits_gzip_heap */ while (*status == 0) { fits_delete_str(outfptr, "COMMENT [FPACK]", status); } if (*status == KEY_NO_EXIST) *status = 0; /* ZPCOUNT = size of original uncompressed heap */ fits_read_key(infptr, TLONGLONG, "ZPCOUNT", &zpcount, NULL, status); /* just return if there is no heap */ if (*status != 0 || zpcount == 0) return(*status); fits_get_num_rowsll(infptr, &nrows, status); fits_read_key(infptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); /* ZHEAPPTR = offset to the start of the compressed heap */ fits_read_key(infptr, TLONGLONG, "ZHEAPPTR", &zheapptr, NULL, status); /* PCOUNT = total size of the compressed 2D table plus the compressed heap */ fits_read_key(infptr, TLONGLONG, "PCOUNT", &pcount, NULL, status); /* size of the compressed heap */ cheapsize = pcount - (zheapptr - (naxis1 * nrows)); /* allocate memory for the heap and uncompressed heap */ arraysize = (size_t) zpcount; heap = malloc(arraysize); if (!heap) { ffpmsg("Could not allocate buffer for the heap (fits_gunzip_heap"); *status = MEMORY_ALLOCATION; return(*status); } compheap = malloc((size_t) cheapsize); if (!compheap) { ffpmsg("Could not allocate buffer for compressed heap (fits_gunzip_heap"); free(heap); *status = MEMORY_ALLOCATION; return(*status); } fits_get_hduaddrll(infptr, NULL, &datastart, NULL, status); /* read the compressed heap into memory */ ffmbyt(infptr, datastart + zheapptr, REPORT_EOF, status); ffgbyt(infptr, cheapsize, compheap, status); /* uncompress the heap */ theapsize = (size_t) zpcount; uncompress2mem_from_mem(compheap, (size_t) cheapsize, &heap, &arraysize, realloc, &theapsize, status); free(compheap); /* don't need the compressed heap any more */ if (theapsize != zpcount) { /* something is wrong */ ffpmsg("uncompressed heap size != to ZPCOUNT"); free(heap); *status = MEMORY_ALLOCATION; return(*status); } /* get dimensions of the uncompressed table */ fits_get_num_rowsll(outfptr, &nrows, status); fits_read_key(outfptr, TLONGLONG, "NAXIS1", &naxis1, NULL, status); fits_get_num_cols(outfptr, &ncols, status); for (ii = ncols; ii > 0; ii--) { fits_get_coltype(outfptr, ii, &coltype, NULL, NULL, status); if (coltype >= 0) continue; /* only interested in variable length columns */ coltype = coltype * (-1); switch (coltype) { /* recombine the byte planes for the 2-byte, 4-byte, and 8-byte numeric columns */ case TSHORT: for (jj = nrows; jj > 0; jj--) { fits_read_descriptll(outfptr, ii, jj, &length, &offset, status); fits_unshuffle_2bytes(heap + offset, length, status); } break; case TLONG: case TFLOAT: for (jj = nrows; jj > 0; jj--) { fits_read_descriptll(outfptr, ii, jj, &length, &offset, status); fits_unshuffle_4bytes(heap + offset, length, status); } break; case TDOUBLE: case TLONGLONG: for (jj = nrows; jj > 0; jj--) { fits_read_descriptll(outfptr, ii, jj, &length, &offset, status); fits_unshuffle_8bytes(heap + offset, length, status); } break; default: /* don't need to recombine bytes for other column types */ break; } /* end of switch block */ } /* copy the unshuffled heap back to the output file */ fits_get_hduaddrll(outfptr, NULL, &datastart, NULL, status); ffmbyt(outfptr, datastart + (nrows * naxis1), IGNORE_EOF, status); ffpbyt(outfptr, zpcount, heap, status); free(heap); /* also update the internal pointer to the heap size */ (outfptr->Fptr)->heapsize = zpcount; /* update the internal pointers again */ fits_set_hdustruc(outfptr, status); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_unshuffle_2bytes(char *heap, LONGLONG length, int *status) /* unshuffle the bytes in an array of 2-byte integers */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = malloc((size_t) (length * 2)); heapptr = heap + (2 * length) - 1; cptr = ptr + (2 * length) - 1; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; cptr--; *cptr = *(heapptr - length); cptr--; heapptr--; } memcpy(heap, ptr, (size_t) (length * 2)); free(ptr); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_unshuffle_4bytes(char *heap, LONGLONG length, int *status) /* unshuffle the bytes in an array of 4-byte integers or floats */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = malloc((size_t) (length * 4)); heapptr = heap + (4 * length) -1; cptr = ptr + (4 * length) -1; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; cptr--; *cptr = *(heapptr - length); cptr--; *cptr = *(heapptr - (2 * length)); cptr--; *cptr = *(heapptr - (3 * length)); cptr--; heapptr--; } memcpy(heap, ptr, (size_t) (length * 4)); free(ptr); return(*status); } /*--------------------------------------------------------------------------*/ static int fits_unshuffle_8bytes(char *heap, LONGLONG length, int *status) /* unshuffle the bytes in an array of 8-byte integers or doubles */ { LONGLONG ii; char *ptr, *cptr, *heapptr; ptr = malloc((size_t) (length * 8)); heapptr = heap + (8 * length) - 1; cptr = ptr + (8 * length) -1; for (ii = 0; ii < length; ii++) { *cptr = *heapptr; cptr--; *cptr = *(heapptr - length); cptr--; *cptr = *(heapptr - (2 * length)); cptr--; *cptr = *(heapptr - (3 * length)); cptr--; *cptr = *(heapptr - (4 * length)); cptr--; *cptr = *(heapptr - (5 * length)); cptr--; *cptr = *(heapptr - (6 * length)); cptr--; *cptr = *(heapptr - (7 * length)); cptr--; heapptr--; } memcpy(heap, ptr, (size_t) (length * 8)); free(ptr); return(*status); } astropy-0.3/cextern/cfitsio/putcolk.c0000644000175000017500000010556112243255342016144 0ustar oleole/* This file, putcolk.c, contains routines that write data elements to */ /* a FITS image or table, with 'int' datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; int nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TINT, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpclk(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *array, /* I - array of values that are written */ int nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; int nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TINT, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnk(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2dk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3dk(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3dk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TINT, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpclk(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpclk(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ int *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TINT, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpclk(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ int *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpclk(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpclk( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* call the 'short' or 'long' version of this routine, if possible */ if (sizeof(int) == sizeof(short)) ffpcli(fptr, colnum, firstrow, firstelem, nelem, (short *) array, status); else if (sizeof(int) == sizeof(long)) ffpclj(fptr, colnum, firstrow, firstelem, nelem, (long *) array, status); else { /* This is a special case: sizeof(int) is not equal to sizeof(short) or sizeof(long). This occurs on Alpha OSF systems where short = 2 bytes, int = 4 bytes, and long = 8 bytes. */ buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TLONG) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TLONG): if (writeraw) { /* write raw input bytes without conversion */ ffpi4b(fptr, ntodo, incre, (INT32BIT *) &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffintfi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); } break; case (TLONGLONG): ffintfi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffintfi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffintfi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TFLOAT): ffintfr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffintfr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffintfstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpclk).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } } /* end of Dec ALPHA special case */ return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnk( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ int *array, /* I - array of values to write */ int nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpclk(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpclk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpclk(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfi1(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfi2(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < SHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfi4(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { memcpy(output, input, ntodo * sizeof(int) ); } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfi8(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfr4(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfr8(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffintfstr(int *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/crc32.h0000644000175000017500000007355012243255342015406 0ustar oleole/* crc32.h -- tables for rapid CRC calculation * Generated automatically by crc32.c */ local const unsigned long FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, 0x2d02ef8dUL #ifdef BYFOUR }, { 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, 0x9324fd72UL }, { 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, 0xbe9834edUL }, { 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, 0xde0506f1UL }, { 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, 0x8def022dUL }, { 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, 0x72fd2493UL }, { 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, 0xed3498beUL }, { 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, 0xf10605deUL #endif } }; astropy-0.3/cextern/cfitsio/histo.c0000644000175000017500000022162312243255342015607 0ustar oleole/* Globally defined histogram parameters */ #include #include #include #include #include "fitsio2.h" typedef struct { /* Structure holding all the histogramming information */ union { /* the iterator work functions (ffwritehist, ffcalchist) */ char *b; /* need to do their job... passed via *userPointer. */ short *i; int *j; float *r; double *d; } hist; fitsfile *tblptr; int haxis, hcolnum[4], himagetype; long haxis1, haxis2, haxis3, haxis4; float amin1, amin2, amin3, amin4; float maxbin1, maxbin2, maxbin3, maxbin4; float binsize1, binsize2, binsize3, binsize4; int wtrecip, wtcolnum; float weight; char *rowselector; } histType; /*--------------------------------------------------------------------------*/ int ffbins(char *binspec, /* I - binning specification */ int *imagetype, /* O - image type, TINT or TSHORT */ int *histaxis, /* O - no. of axes in the histogram */ char colname[4][FLEN_VALUE], /* column name for axis */ double *minin, /* minimum value for each axis */ double *maxin, /* maximum value for each axis */ double *binsizein, /* size of bins on each axis */ char minname[4][FLEN_VALUE], /* keyword name for min */ char maxname[4][FLEN_VALUE], /* keyword name for max */ char binname[4][FLEN_VALUE], /* keyword name for binsize */ double *wt, /* weighting factor */ char *wtname, /* keyword or column name for weight */ int *recip, /* the reciprocal of the weight? */ int *status) { /* Parse the input binning specification string, returning the binning parameters. Supports up to 4 dimensions. The binspec string has one of these forms: bin binsize - 2D histogram with binsize on each axis bin xcol - 1D histogram on column xcol bin (xcol, ycol) = binsize - 2D histogram with binsize on each axis bin x=min:max:size, y=min:max:size, z..., t... bin x=:max, y=::size bin x=size, y=min::size most other reasonable combinations are supported. */ int ii, slen, defaulttype; char *ptr, tmpname[30], *file_expr = NULL; double dummy; if (*status > 0) return(*status); /* set the default values */ *histaxis = 2; *imagetype = TINT; defaulttype = 1; *wt = 1.; *recip = 0; *wtname = '\0'; /* set default values */ for (ii = 0; ii < 4; ii++) { *colname[ii] = '\0'; *minname[ii] = '\0'; *maxname[ii] = '\0'; *binname[ii] = '\0'; minin[ii] = DOUBLENULLVALUE; /* undefined values */ maxin[ii] = DOUBLENULLVALUE; binsizein[ii] = DOUBLENULLVALUE; } ptr = binspec + 3; /* skip over 'bin' */ if (*ptr == 'i' ) /* bini */ { *imagetype = TSHORT; defaulttype = 0; ptr++; } else if (*ptr == 'j' ) /* binj; same as default */ { defaulttype = 0; ptr ++; } else if (*ptr == 'r' ) /* binr */ { *imagetype = TFLOAT; defaulttype = 0; ptr ++; } else if (*ptr == 'd' ) /* bind */ { *imagetype = TDOUBLE; defaulttype = 0; ptr ++; } else if (*ptr == 'b' ) /* binb */ { *imagetype = TBYTE; defaulttype = 0; ptr ++; } if (*ptr == '\0') /* use all defaults for other parameters */ return(*status); else if (*ptr != ' ') /* must be at least one blank */ { ffpmsg("binning specification syntax error:"); ffpmsg(binspec); return(*status = URL_PARSE_ERROR); } while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr == '\0') /* no other parameters; use defaults */ return(*status); /* Check if need to import expression from a file */ if( *ptr=='@' ) { if( ffimport_file( ptr+1, &file_expr, status ) ) return(*status); ptr = file_expr; while (*ptr == ' ') ptr++; /* skip leading white space... again */ } if (*ptr == '(' ) { /* this must be the opening parenthesis around a list of column */ /* names, optionally followed by a '=' and the binning spec. */ for (ii = 0; ii < 4; ii++) { ptr++; /* skip over the '(', ',', or ' ') */ while (*ptr == ' ') /* skip over blanks */ ptr++; slen = strcspn(ptr, " ,)"); strncat(colname[ii], ptr, slen); /* copy 1st column name */ ptr += slen; while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr == ')' ) /* end of the list of names */ { *histaxis = ii + 1; break; } } if (ii == 4) /* too many names in the list , or missing ')' */ { ffpmsg( "binning specification has too many column names or is missing closing ')':"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status = URL_PARSE_ERROR); } ptr++; /* skip over the closing parenthesis */ while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr == '\0') { if( file_expr ) free( file_expr ); return(*status); /* parsed the entire string */ } else if (*ptr != '=') /* must be an equals sign now*/ { ffpmsg("illegal binning specification in URL:"); ffpmsg(" an equals sign '=' must follow the column names"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status = URL_PARSE_ERROR); } ptr++; /* skip over the equals sign */ while (*ptr == ' ') /* skip over blanks */ ptr++; /* get the single range specification for all the columns */ ffbinr(&ptr, tmpname, minin, maxin, binsizein, minname[0], maxname[0], binname[0], status); if (*status > 0) { ffpmsg("illegal binning specification in URL:"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status); } for (ii = 1; ii < *histaxis; ii++) { minin[ii] = minin[0]; maxin[ii] = maxin[0]; binsizein[ii] = binsizein[0]; strcpy(minname[ii], minname[0]); strcpy(maxname[ii], maxname[0]); strcpy(binname[ii], binname[0]); } while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr == ';') goto getweight; /* a weighting factor is specified */ if (*ptr != '\0') /* must have reached end of string */ { ffpmsg("illegal syntax after binning range specification in URL:"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status = URL_PARSE_ERROR); } return(*status); } /* end of case with list of column names in ( ) */ /* if we've reached this point, then the binning specification */ /* must be of the form: XCOL = min:max:binsize, YCOL = ... */ /* where the column name followed by '=' are optional. */ /* If the column name is not specified, then use the default name */ for (ii = 0; ii < 4; ii++) /* allow up to 4 histogram dimensions */ { ffbinr(&ptr, colname[ii], &minin[ii], &maxin[ii], &binsizein[ii], minname[ii], maxname[ii], binname[ii], status); if (*status > 0) { ffpmsg("illegal syntax in binning range specification in URL:"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status); } if (*ptr == '\0' || *ptr == ';') break; /* reached the end of the string */ if (*ptr == ' ') { while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr == '\0' || *ptr == ';') break; /* reached the end of the string */ if (*ptr == ',') ptr++; /* comma separates the next column specification */ } else if (*ptr == ',') { ptr++; /* comma separates the next column specification */ } else { ffpmsg("illegal characters following binning specification in URL:"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status = URL_PARSE_ERROR); } } if (ii == 4) { /* there are yet more characters in the string */ ffpmsg("illegal binning specification in URL:"); ffpmsg("apparently greater than 4 histogram dimensions"); ffpmsg(binspec); return(*status = URL_PARSE_ERROR); } else *histaxis = ii + 1; /* special case: if a single number was entered it should be */ /* interpreted as the binning factor for the default X and Y axes */ if (*histaxis == 1 && *colname[0] == '\0' && minin[0] == DOUBLENULLVALUE && maxin[0] == DOUBLENULLVALUE) { *histaxis = 2; binsizein[1] = binsizein[0]; } getweight: if (*ptr == ';') /* looks like a weighting factor is given */ { ptr++; while (*ptr == ' ') /* skip over blanks */ ptr++; recip = 0; if (*ptr == '/') { *recip = 1; /* the reciprocal of the weight is entered */ ptr++; while (*ptr == ' ') /* skip over blanks */ ptr++; } /* parse the weight as though it were a binrange. */ /* either a column name or a numerical value will be returned */ ffbinr(&ptr, wtname, &dummy, &dummy, wt, tmpname, tmpname, tmpname, status); if (*status > 0) { ffpmsg("illegal binning weight specification in URL:"); ffpmsg(binspec); if( file_expr ) free( file_expr ); return(*status); } /* creat a float datatype histogram by default, if weight */ /* factor is not = 1.0 */ if ( (defaulttype && *wt != 1.0) || (defaulttype && *wtname) ) *imagetype = TFLOAT; } while (*ptr == ' ') /* skip over blanks */ ptr++; if (*ptr != '\0') /* should have reached the end of string */ { ffpmsg("illegal syntax after binning weight specification in URL:"); ffpmsg(binspec); *status = URL_PARSE_ERROR; } if( file_expr ) free( file_expr ); return(*status); } /*--------------------------------------------------------------------------*/ int ffbinr(char **ptr, char *colname, double *minin, double *maxin, double *binsizein, char *minname, char *maxname, char *binname, int *status) /* Parse the input binning range specification string, returning the column name, histogram min and max values, and bin size. */ { int slen, isanumber; char token[FLEN_VALUE]; if (*status > 0) return(*status); slen = fits_get_token(ptr, " ,=:;", token, &isanumber); /* get 1st token */ if (slen == 0 && (**ptr == '\0' || **ptr == ',' || **ptr == ';') ) return(*status); /* a null range string */ if (!isanumber && **ptr != ':') { /* this looks like the column name */ if (token[0] == '#' && isdigit((int) token[1]) ) { /* omit the leading '#' in the column number */ strcpy(colname, token+1); } else strcpy(colname, token); while (**ptr == ' ') /* skip over blanks */ (*ptr)++; if (**ptr != '=') return(*status); /* reached the end */ (*ptr)++; /* skip over the = sign */ while (**ptr == ' ') /* skip over blanks */ (*ptr)++; slen = fits_get_token(ptr, " ,:;", token, &isanumber); /* get token */ } if (**ptr != ':') { /* this is the first token, and since it is not followed by */ /* a ':' this must be the binsize token */ if (!isanumber) strcpy(binname, token); else *binsizein = strtod(token, NULL); return(*status); /* reached the end */ } else { /* the token contains the min value */ if (slen) { if (!isanumber) strcpy(minname, token); else *minin = strtod(token, NULL); } } (*ptr)++; /* skip the colon between the min and max values */ slen = fits_get_token(ptr, " ,:;", token, &isanumber); /* get token */ /* the token contains the max value */ if (slen) { if (!isanumber) strcpy(maxname, token); else *maxin = strtod(token, NULL); } if (**ptr != ':') return(*status); /* reached the end; no binsize token */ (*ptr)++; /* skip the colon between the max and binsize values */ slen = fits_get_token(ptr, " ,:;", token, &isanumber); /* get token */ /* the token contains the binsize value */ if (slen) { if (!isanumber) strcpy(binname, token); else *binsizein = strtod(token, NULL); } return(*status); } /*--------------------------------------------------------------------------*/ int ffhist2(fitsfile **fptr, /* IO - pointer to table with X and Y cols; */ /* on output, points to histogram image */ char *outfile, /* I - name for the output histogram file */ int imagetype, /* I - datatype for image: TINT, TSHORT, etc */ int naxis, /* I - number of axes in the histogram image */ char colname[4][FLEN_VALUE], /* I - column names */ double *minin, /* I - minimum histogram value, for each axis */ double *maxin, /* I - maximum histogram value, for each axis */ double *binsizein, /* I - bin size along each axis */ char minname[4][FLEN_VALUE], /* I - optional keywords for min */ char maxname[4][FLEN_VALUE], /* I - optional keywords for max */ char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */ double weightin, /* I - binning weighting factor */ char wtcol[FLEN_VALUE], /* I - optional keyword or col for weight*/ int recip, /* I - use reciprocal of the weight? */ char *selectrow, /* I - optional array (length = no. of */ /* rows in the table). If the element is true */ /* then the corresponding row of the table will*/ /* be included in the histogram, otherwise the */ /* row will be skipped. Ingnored if *selectrow*/ /* is equal to NULL. */ int *status) { fitsfile *histptr; int bitpix, colnum[4], wtcolnum; long haxes[4]; float amin[4], amax[4], binsize[4], weight; if (*status > 0) return(*status); if (naxis > 4) { ffpmsg("histogram has more than 4 dimensions"); return(*status = BAD_DIMEN); } /* reset position to the correct HDU if necessary */ if ((*fptr)->HDUposition != ((*fptr)->Fptr)->curhdu) ffmahd(*fptr, ((*fptr)->HDUposition) + 1, NULL, status); if (imagetype == TBYTE) bitpix = BYTE_IMG; else if (imagetype == TSHORT) bitpix = SHORT_IMG; else if (imagetype == TINT) bitpix = LONG_IMG; else if (imagetype == TFLOAT) bitpix = FLOAT_IMG; else if (imagetype == TDOUBLE) bitpix = DOUBLE_IMG; else return(*status = BAD_DATATYPE); /* Calculate the binning parameters: */ /* columm numbers, axes length, min values, max values, and binsizes. */ if (fits_calc_binning( *fptr, naxis, colname, minin, maxin, binsizein, minname, maxname, binname, colnum, haxes, amin, amax, binsize, status) > 0) { ffpmsg("failed to determine binning parameters"); return(*status); } /* get the histogramming weighting factor, if any */ if (*wtcol) { /* first, look for a keyword with the weight value */ if (ffgky(*fptr, TFLOAT, wtcol, &weight, NULL, status) ) { /* not a keyword, so look for column with this name */ *status = 0; /* get the column number in the table */ if (ffgcno(*fptr, CASEINSEN, wtcol, &wtcolnum, status) > 0) { ffpmsg( "keyword or column for histogram weights doesn't exist: "); ffpmsg(wtcol); return(*status); } weight = FLOATNULLVALUE; } } else weight = (float) weightin; if (weight <= 0. && weight != FLOATNULLVALUE) { ffpmsg("Illegal histogramming weighting factor <= 0."); return(*status = URL_PARSE_ERROR); } if (recip && weight != FLOATNULLVALUE) /* take reciprocal of weight */ weight = (float) (1.0 / weight); /* size of histogram is now known, so create temp output file */ if (fits_create_file(&histptr, outfile, status) > 0) { ffpmsg("failed to create temp output file for histogram"); return(*status); } /* create output FITS image HDU */ if (ffcrim(histptr, bitpix, naxis, haxes, status) > 0) { ffpmsg("failed to create output histogram FITS image"); return(*status); } /* copy header keywords, converting pixel list WCS keywords to image WCS form */ if (fits_copy_pixlist2image(*fptr, histptr, 9, naxis, colnum, status) > 0) { ffpmsg("failed to copy pixel list keywords to new histogram header"); return(*status); } /* if the table columns have no WCS keywords, then write default keywords */ fits_write_keys_histo(*fptr, histptr, naxis, colnum, status); /* update the WCS keywords for the ref. pixel location, and pixel size */ fits_rebin_wcs(histptr, naxis, amin, binsize, status); /* now compute the output image by binning the column values */ if (fits_make_hist(*fptr, histptr, bitpix, naxis, haxes, colnum, amin, amax, binsize, weight, wtcolnum, recip, selectrow, status) > 0) { ffpmsg("failed to calculate new histogram values"); return(*status); } /* finally, close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = histptr; return(*status); } /*--------------------------------------------------------------------------*/ int ffhist(fitsfile **fptr, /* IO - pointer to table with X and Y cols; */ /* on output, points to histogram image */ char *outfile, /* I - name for the output histogram file */ int imagetype, /* I - datatype for image: TINT, TSHORT, etc */ int naxis, /* I - number of axes in the histogram image */ char colname[4][FLEN_VALUE], /* I - column names */ double *minin, /* I - minimum histogram value, for each axis */ double *maxin, /* I - maximum histogram value, for each axis */ double *binsizein, /* I - bin size along each axis */ char minname[4][FLEN_VALUE], /* I - optional keywords for min */ char maxname[4][FLEN_VALUE], /* I - optional keywords for max */ char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */ double weightin, /* I - binning weighting factor */ char wtcol[FLEN_VALUE], /* I - optional keyword or col for weight*/ int recip, /* I - use reciprocal of the weight? */ char *selectrow, /* I - optional array (length = no. of */ /* rows in the table). If the element is true */ /* then the corresponding row of the table will*/ /* be included in the histogram, otherwise the */ /* row will be skipped. Ingnored if *selectrow*/ /* is equal to NULL. */ int *status) { int ii, datatype, repeat, imin, imax, ibin, bitpix, tstatus, use_datamax = 0; long haxes[4]; fitsfile *histptr; char errmsg[FLEN_ERRMSG], keyname[FLEN_KEYWORD], card[FLEN_CARD]; tcolumn *colptr; iteratorCol imagepars[1]; int n_cols = 1, nkeys; long offset = 0; long n_per_loop = -1; /* force whole array to be passed at one time */ histType histData; /* Structure holding histogram info for iterator */ float amin[4], amax[4], binsize[4], maxbin[4]; float datamin = FLOATNULLVALUE, datamax = FLOATNULLVALUE; char svalue[FLEN_VALUE]; double dvalue; char cpref[4][FLEN_VALUE]; char *cptr; if (*status > 0) return(*status); if (naxis > 4) { ffpmsg("histogram has more than 4 dimensions"); return(*status = BAD_DIMEN); } /* reset position to the correct HDU if necessary */ if ((*fptr)->HDUposition != ((*fptr)->Fptr)->curhdu) ffmahd(*fptr, ((*fptr)->HDUposition) + 1, NULL, status); histData.tblptr = *fptr; histData.himagetype = imagetype; histData.haxis = naxis; histData.rowselector = selectrow; if (imagetype == TBYTE) bitpix = BYTE_IMG; else if (imagetype == TSHORT) bitpix = SHORT_IMG; else if (imagetype == TINT) bitpix = LONG_IMG; else if (imagetype == TFLOAT) bitpix = FLOAT_IMG; else if (imagetype == TDOUBLE) bitpix = DOUBLE_IMG; else return(*status = BAD_DATATYPE); /* The CPREF keyword, if it exists, gives the preferred columns. */ /* Otherwise, assume "X", "Y", "Z", and "T" */ tstatus = 0; ffgky(*fptr, TSTRING, "CPREF", cpref[0], NULL, &tstatus); if (!tstatus) { /* Preferred column names are given; separate them */ cptr = cpref[0]; /* the first preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[1], cptr); cptr = cpref[1]; /* the second preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[2], cptr); cptr = cpref[2]; /* the third preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[3], cptr); } } } } for (ii = 0; ii < naxis; ii++) { /* get the min, max, and binsize values from keywords, if specified */ if (*minname[ii]) { if (ffgky(*fptr, TDOUBLE, minname[ii], &minin[ii], NULL, status) ) { ffpmsg("error reading histogramming minimum keyword"); ffpmsg(minname[ii]); return(*status); } } if (*maxname[ii]) { if (ffgky(*fptr, TDOUBLE, maxname[ii], &maxin[ii], NULL, status) ) { ffpmsg("error reading histogramming maximum keyword"); ffpmsg(maxname[ii]); return(*status); } } if (*binname[ii]) { if (ffgky(*fptr, TDOUBLE, binname[ii], &binsizein[ii], NULL, status) ) { ffpmsg("error reading histogramming binsize keyword"); ffpmsg(binname[ii]); return(*status); } } if (binsizein[ii] == 0.) { ffpmsg("error: histogram binsize = 0"); return(*status = ZERO_SCALE); } if (*colname[ii] == '\0') { strcpy(colname[ii], cpref[ii]); /* try using the preferred column */ if (*colname[ii] == '\0') { if (ii == 0) strcpy(colname[ii], "X"); else if (ii == 1) strcpy(colname[ii], "Y"); else if (ii == 2) strcpy(colname[ii], "Z"); else if (ii == 3) strcpy(colname[ii], "T"); } } /* get the column number in the table */ if (ffgcno(*fptr, CASEINSEN, colname[ii], histData.hcolnum+ii, status) > 0) { strcpy(errmsg, "column for histogram axis doesn't exist: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } colptr = ((*fptr)->Fptr)->tableptr; colptr += (histData.hcolnum[ii] - 1); repeat = (int) colptr->trepeat; /* vector repeat factor of the column */ if (repeat > 1) { strcpy(errmsg, "Can't bin a vector column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status = BAD_DATATYPE); } /* get the datatype of the column */ fits_get_coltype(*fptr, histData.hcolnum[ii], &datatype, NULL, NULL, status); if (datatype < 0 || datatype == TSTRING) { strcpy(errmsg, "Inappropriate datatype; can't bin this column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status = BAD_DATATYPE); } /* use TLMINn and TLMAXn keyword values if min and max were not given */ /* else use actual data min and max if TLMINn and TLMAXn don't exist */ if (minin[ii] == DOUBLENULLVALUE) { ffkeyn("TLMIN", histData.hcolnum[ii], keyname, status); if (ffgky(*fptr, TFLOAT, keyname, amin+ii, NULL, status) > 0) { /* use actual data minimum value for the histogram minimum */ *status = 0; if (fits_get_col_minmax(*fptr, histData.hcolnum[ii], amin+ii, &datamax, status) > 0) { strcpy(errmsg, "Error calculating datamin and datamax for column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } } } else { amin[ii] = (float) minin[ii]; } if (maxin[ii] == DOUBLENULLVALUE) { ffkeyn("TLMAX", histData.hcolnum[ii], keyname, status); if (ffgky(*fptr, TFLOAT, keyname, &amax[ii], NULL, status) > 0) { *status = 0; if(datamax != FLOATNULLVALUE) /* already computed max value */ { amax[ii] = datamax; } else { /* use actual data maximum value for the histogram maximum */ if (fits_get_col_minmax(*fptr, histData.hcolnum[ii], &datamin, &amax[ii], status) > 0) { strcpy(errmsg, "Error calculating datamin and datamax for column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } } } use_datamax = 1; /* flag that the max was determined by the data values */ /* and not specifically set by the calling program */ } else { amax[ii] = (float) maxin[ii]; } /* use TDBINn keyword or else 1 if bin size is not given */ if (binsizein[ii] == DOUBLENULLVALUE) { tstatus = 0; ffkeyn("TDBIN", histData.hcolnum[ii], keyname, &tstatus); if (ffgky(*fptr, TDOUBLE, keyname, binsizein + ii, NULL, &tstatus) > 0) { /* make at least 10 bins */ binsizein[ii] = (amax[ii] - amin[ii]) / 10. ; if (binsizein[ii] > 1.) binsizein[ii] = 1.; /* use default bin size */ } } if ( (amin[ii] > amax[ii] && binsizein[ii] > 0. ) || (amin[ii] < amax[ii] && binsizein[ii] < 0. ) ) binsize[ii] = (float) -binsizein[ii]; /* reverse the sign of binsize */ else binsize[ii] = (float) binsizein[ii]; /* binsize has the correct sign */ ibin = (int) binsize[ii]; imin = (int) amin[ii]; imax = (int) amax[ii]; /* Determine the range and number of bins in the histogram. This */ /* depends on whether the input columns are integer or floats, so */ /* treat each case separately. */ if (datatype <= TLONG && (float) imin == amin[ii] && (float) imax == amax[ii] && (float) ibin == binsize[ii] ) { /* This is an integer column and integer limits were entered. */ /* Shift the lower and upper histogramming limits by 0.5, so that */ /* the values fall in the center of the bin, not on the edge. */ haxes[ii] = (imax - imin) / ibin + 1; /* last bin may only */ /* be partially full */ maxbin[ii] = (float) (haxes[ii] + 1.); /* add 1. instead of .5 to avoid roundoff */ if (amin[ii] < amax[ii]) { amin[ii] = (float) (amin[ii] - 0.5); amax[ii] = (float) (amax[ii] + 0.5); } else { amin[ii] = (float) (amin[ii] + 0.5); amax[ii] = (float) (amax[ii] - 0.5); } } else if (use_datamax) { /* Either the column datatype and/or the limits are floating point, */ /* and the histogram limits are being defined by the min and max */ /* values of the array. Add 1 to the number of histogram bins to */ /* make sure that pixels that are equal to the maximum or are */ /* in the last partial bin are included. */ maxbin[ii] = (amax[ii] - amin[ii]) / binsize[ii]; haxes[ii] = (long) (maxbin[ii] + 1); } else { /* float datatype column and/or limits, and the maximum value to */ /* include in the histogram is specified by the calling program. */ /* The lower limit is inclusive, but upper limit is exclusive */ maxbin[ii] = (amax[ii] - amin[ii]) / binsize[ii]; haxes[ii] = (long) maxbin[ii]; if (amin[ii] < amax[ii]) { if (amin[ii] + (haxes[ii] * binsize[ii]) < amax[ii]) haxes[ii]++; /* need to include another partial bin */ } else { if (amin[ii] + (haxes[ii] * binsize[ii]) > amax[ii]) haxes[ii]++; /* need to include another partial bin */ } } } /* get the histogramming weighting factor */ if (*wtcol) { /* first, look for a keyword with the weight value */ if (ffgky(*fptr, TFLOAT, wtcol, &histData.weight, NULL, status) ) { /* not a keyword, so look for column with this name */ *status = 0; /* get the column number in the table */ if (ffgcno(*fptr, CASEINSEN, wtcol, &histData.wtcolnum, status) > 0) { ffpmsg( "keyword or column for histogram weights doesn't exist: "); ffpmsg(wtcol); return(*status); } histData.weight = FLOATNULLVALUE; } } else histData.weight = (float) weightin; if (histData.weight <= 0. && histData.weight != FLOATNULLVALUE) { ffpmsg("Illegal histogramming weighting factor <= 0."); return(*status = URL_PARSE_ERROR); } if (recip && histData.weight != FLOATNULLVALUE) /* take reciprocal of weight */ histData.weight = (float) (1.0 / histData.weight); histData.wtrecip = recip; /* size of histogram is now known, so create temp output file */ if (ffinit(&histptr, outfile, status) > 0) { ffpmsg("failed to create temp output file for histogram"); return(*status); } if (ffcrim(histptr, bitpix, histData.haxis, haxes, status) > 0) { ffpmsg("failed to create primary array histogram in temp file"); ffclos(histptr, status); return(*status); } /* copy all non-structural keywords from the table to the image */ fits_get_hdrspace(*fptr, &nkeys, NULL, status); for (ii = 1; ii <= nkeys; ii++) { fits_read_record(*fptr, ii, card, status); if (fits_get_keyclass(card) >= 120) fits_write_record(histptr, card, status); } /* Set global variables with histogram parameter values. */ /* Use separate scalar variables rather than arrays because */ /* it is more efficient when computing the histogram. */ histData.amin1 = amin[0]; histData.maxbin1 = maxbin[0]; histData.binsize1 = binsize[0]; histData.haxis1 = haxes[0]; if (histData.haxis > 1) { histData.amin2 = amin[1]; histData.maxbin2 = maxbin[1]; histData.binsize2 = binsize[1]; histData.haxis2 = haxes[1]; if (histData.haxis > 2) { histData.amin3 = amin[2]; histData.maxbin3 = maxbin[2]; histData.binsize3 = binsize[2]; histData.haxis3 = haxes[2]; if (histData.haxis > 3) { histData.amin4 = amin[3]; histData.maxbin4 = maxbin[3]; histData.binsize4 = binsize[3]; histData.haxis4 = haxes[3]; } } } /* define parameters of image for the iterator function */ fits_iter_set_file(imagepars, histptr); /* pointer to image */ fits_iter_set_datatype(imagepars, imagetype); /* image datatype */ fits_iter_set_iotype(imagepars, OutputCol); /* image is output */ /* call the iterator function to write out the histogram image */ if (fits_iterate_data(n_cols, imagepars, offset, n_per_loop, ffwritehisto, (void*)&histData, status) ) return(*status); /* write the World Coordinate System (WCS) keywords */ /* create default values if WCS keywords are not present in the table */ for (ii = 0; ii < histData.haxis; ii++) { /* CTYPEn */ tstatus = 0; ffkeyn("TCTYP", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus); if (tstatus) { /* just use column name as the type */ tstatus = 0; ffkeyn("TTYPE", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus); } if (!tstatus) { ffkeyn("CTYPE", ii + 1, keyname, &tstatus); ffpky(histptr, TSTRING, keyname, svalue, "Coordinate Type", &tstatus); } else tstatus = 0; /* CUNITn */ ffkeyn("TCUNI", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus); if (tstatus) { /* use the column units */ tstatus = 0; ffkeyn("TUNIT", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TSTRING, keyname, svalue, NULL, &tstatus); } if (!tstatus) { ffkeyn("CUNIT", ii + 1, keyname, &tstatus); ffpky(histptr, TSTRING, keyname, svalue, "Coordinate Units", &tstatus); } else tstatus = 0; /* CRPIXn - Reference Pixel */ ffkeyn("TCRPX", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (tstatus) { dvalue = 1.0; /* choose first pixel in new image as ref. pix. */ tstatus = 0; } else { /* calculate locate of the ref. pix. in the new image */ dvalue = (dvalue - amin[ii]) / binsize[ii] + .5; } ffkeyn("CRPIX", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Reference Pixel", &tstatus); /* CRVALn - Value at the location of the reference pixel */ ffkeyn("TCRVL", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (tstatus) { /* calculate value at ref. pix. location (at center of 1st pixel) */ dvalue = amin[ii] + binsize[ii]/2.; tstatus = 0; } ffkeyn("CRVAL", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Reference Value", &tstatus); /* CDELTn - unit size of pixels */ ffkeyn("TCDLT", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (tstatus) { dvalue = 1.0; /* use default pixel size */ tstatus = 0; } dvalue = dvalue * binsize[ii]; ffkeyn("CDELT", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Pixel size", &tstatus); /* CROTAn - Rotation angle (degrees CCW) */ /* There should only be a CROTA2 keyword, and only for 2+ D images */ if (ii == 1) { ffkeyn("TCROT", histData.hcolnum[ii], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus && dvalue != 0.) /* only write keyword if angle != 0 */ { ffkeyn("CROTA", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Rotation angle", &tstatus); } else { /* didn't find CROTA for the 2nd axis, so look for one */ /* on the first axis */ tstatus = 0; ffkeyn("TCROT", histData.hcolnum[0], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus && dvalue != 0.) /* only write keyword if angle != 0 */ { dvalue *= -1.; /* negate the value, because mirror image */ ffkeyn("CROTA", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Rotation angle", &tstatus); } } } } /* convert any TPn_k keywords to PCi_j; the value remains unchanged */ /* also convert any TCn_k to CDi_j; the value is modified by n binning size */ /* This is a bit of a kludge, and only works for 2D WCS */ if (histData.haxis == 2) { /* PC1_1 */ tstatus = 0; ffkeyn("TP", histData.hcolnum[0], card, &tstatus); strcat(card,"_"); ffkeyn(card, histData.hcolnum[0], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) ffpky(histptr, TDOUBLE, "PC1_1", &dvalue, card, &tstatus); tstatus = 0; keyname[1] = 'C'; ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) { dvalue *= binsize[0]; ffpky(histptr, TDOUBLE, "CD1_1", &dvalue, card, &tstatus); } /* PC1_2 */ tstatus = 0; ffkeyn("TP", histData.hcolnum[0], card, &tstatus); strcat(card,"_"); ffkeyn(card, histData.hcolnum[1], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) ffpky(histptr, TDOUBLE, "PC1_2", &dvalue, card, &tstatus); tstatus = 0; keyname[1] = 'C'; ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) { dvalue *= binsize[0]; ffpky(histptr, TDOUBLE, "CD1_2", &dvalue, card, &tstatus); } /* PC2_1 */ tstatus = 0; ffkeyn("TP", histData.hcolnum[1], card, &tstatus); strcat(card,"_"); ffkeyn(card, histData.hcolnum[0], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) ffpky(histptr, TDOUBLE, "PC2_1", &dvalue, card, &tstatus); tstatus = 0; keyname[1] = 'C'; ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) { dvalue *= binsize[1]; ffpky(histptr, TDOUBLE, "CD2_1", &dvalue, card, &tstatus); } /* PC2_2 */ tstatus = 0; ffkeyn("TP", histData.hcolnum[1], card, &tstatus); strcat(card,"_"); ffkeyn(card, histData.hcolnum[1], keyname, &tstatus); ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) ffpky(histptr, TDOUBLE, "PC2_2", &dvalue, card, &tstatus); tstatus = 0; keyname[1] = 'C'; ffgky(*fptr, TDOUBLE, keyname, &dvalue, card, &tstatus); if (!tstatus) { dvalue *= binsize[1]; ffpky(histptr, TDOUBLE, "CD2_2", &dvalue, card, &tstatus); } } /* finally, close the original file and return ptr to the new image */ ffclos(*fptr, status); *fptr = histptr; return(*status); } /*--------------------------------------------------------------------------*/ int fits_calc_binning( fitsfile *fptr, /* IO - pointer to table to be binned ; */ int naxis, /* I - number of axes/columns in the binned image */ char colname[4][FLEN_VALUE], /* I - optional column names */ double *minin, /* I - optional lower bound value for each axis */ double *maxin, /* I - optional upper bound value, for each axis */ double *binsizein, /* I - optional bin size along each axis */ char minname[4][FLEN_VALUE], /* I - optional keywords for min */ char maxname[4][FLEN_VALUE], /* I - optional keywords for max */ char binname[4][FLEN_VALUE], /* I - optional keywords for binsize */ /* The returned parameters for each axis of the n-dimensional histogram are */ int *colnum, /* O - column numbers, to be binned */ long *haxes, /* O - number of bins in each histogram axis */ float *amin, /* O - lower bound of the histogram axes */ float *amax, /* O - upper bound of the histogram axes */ float *binsize, /* O - width of histogram bins/pixels on each axis */ int *status) /*_ Calculate the actual binning parameters, based on various user input options. */ { tcolumn *colptr; char *cptr, cpref[4][FLEN_VALUE]; char errmsg[FLEN_ERRMSG], keyname[FLEN_KEYWORD]; int tstatus, ii; int datatype, repeat, imin, imax, ibin, use_datamax = 0; float datamin, datamax; /* check inputs */ if (*status > 0) return(*status); if (naxis > 4) { ffpmsg("histograms with more than 4 dimensions are not supported"); return(*status = BAD_DIMEN); } /* reset position to the correct HDU if necessary */ if ((fptr)->HDUposition != ((fptr)->Fptr)->curhdu) ffmahd(fptr, ((fptr)->HDUposition) + 1, NULL, status); /* ============================================================= */ /* The CPREF keyword, if it exists, gives the preferred columns. */ /* Otherwise, assume "X", "Y", "Z", and "T" */ *cpref[0] = '\0'; *cpref[1] = '\0'; *cpref[2] = '\0'; *cpref[3] = '\0'; tstatus = 0; ffgky(fptr, TSTRING, "CPREF", cpref[0], NULL, &tstatus); if (!tstatus) { /* Preferred column names are given; separate them */ cptr = cpref[0]; /* the first preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[1], cptr); cptr = cpref[1]; /* the second preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[2], cptr); cptr = cpref[2]; /* the third preferred axis... */ while (*cptr != ',' && *cptr != '\0') cptr++; if (*cptr != '\0') { *cptr = '\0'; cptr++; while (*cptr == ' ') cptr++; strcpy(cpref[3], cptr); } } } } /* ============================================================= */ /* Main Loop for calculating parameters for each column */ for (ii = 0; ii < naxis; ii++) { /* =========================================================== */ /* Determine column Number, based on, in order of priority, 1 input column name, or 2 name given by CPREF keyword, or 3 assume X, Y, Z and T for the name */ if (*colname[ii] == '\0') { strcpy(colname[ii], cpref[ii]); /* try using the preferred column */ if (*colname[ii] == '\0') { if (ii == 0) strcpy(colname[ii], "X"); else if (ii == 1) strcpy(colname[ii], "Y"); else if (ii == 2) strcpy(colname[ii], "Z"); else if (ii == 3) strcpy(colname[ii], "T"); } } /* get the column number in the table */ if (ffgcno(fptr, CASEINSEN, colname[ii], colnum+ii, status) > 0) { strcpy(errmsg, "column for histogram axis doesn't exist: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } /* ================================================================ */ /* check tha column is not a vector or a string */ colptr = ((fptr)->Fptr)->tableptr; colptr += (colnum[ii] - 1); repeat = (int) colptr->trepeat; /* vector repeat factor of the column */ if (repeat > 1) { strcpy(errmsg, "Can't bin a vector column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status = BAD_DATATYPE); } /* get the datatype of the column */ fits_get_coltype(fptr, colnum[ii], &datatype, NULL, NULL, status); if (datatype < 0 || datatype == TSTRING) { strcpy(errmsg, "Inappropriate datatype; can't bin this column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status = BAD_DATATYPE); } /* ================================================================ */ /* get the minimum value */ datamin = FLOATNULLVALUE; datamax = FLOATNULLVALUE; if (*minname[ii]) { if (ffgky(fptr, TDOUBLE, minname[ii], &minin[ii], NULL, status) ) { ffpmsg("error reading histogramming minimum keyword"); ffpmsg(minname[ii]); return(*status); } } if (minin[ii] != DOUBLENULLVALUE) { amin[ii] = (float) minin[ii]; } else { ffkeyn("TLMIN", colnum[ii], keyname, status); if (ffgky(fptr, TFLOAT, keyname, amin+ii, NULL, status) > 0) { /* use actual data minimum value for the histogram minimum */ *status = 0; if (fits_get_col_minmax(fptr, colnum[ii], amin+ii, &datamax, status) > 0) { strcpy(errmsg, "Error calculating datamin and datamax for column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } } } /* ================================================================ */ /* get the maximum value */ if (*maxname[ii]) { if (ffgky(fptr, TDOUBLE, maxname[ii], &maxin[ii], NULL, status) ) { ffpmsg("error reading histogramming maximum keyword"); ffpmsg(maxname[ii]); return(*status); } } if (maxin[ii] != DOUBLENULLVALUE) { amax[ii] = (float) maxin[ii]; } else { ffkeyn("TLMAX", colnum[ii], keyname, status); if (ffgky(fptr, TFLOAT, keyname, &amax[ii], NULL, status) > 0) { *status = 0; if(datamax != FLOATNULLVALUE) /* already computed max value */ { amax[ii] = datamax; } else { /* use actual data maximum value for the histogram maximum */ if (fits_get_col_minmax(fptr, colnum[ii], &datamin, &amax[ii], status) > 0) { strcpy(errmsg, "Error calculating datamin and datamax for column: "); strcat(errmsg, colname[ii]); ffpmsg(errmsg); return(*status); } } } use_datamax = 1; /* flag that the max was determined by the data values */ /* and not specifically set by the calling program */ } /* ================================================================ */ /* determine binning size and range */ if (*binname[ii]) { if (ffgky(fptr, TDOUBLE, binname[ii], &binsizein[ii], NULL, status) ) { ffpmsg("error reading histogramming binsize keyword"); ffpmsg(binname[ii]); return(*status); } } if (binsizein[ii] == 0.) { ffpmsg("error: histogram binsize = 0"); return(*status = ZERO_SCALE); } /* use TDBINn keyword or else 1 if bin size is not given */ if (binsizein[ii] != DOUBLENULLVALUE) { binsize[ii] = (float) binsizein[ii]; } else { tstatus = 0; ffkeyn("TDBIN", colnum[ii], keyname, &tstatus); if (ffgky(fptr, TDOUBLE, keyname, binsizein + ii, NULL, &tstatus) > 0) { /* make at least 10 bins */ binsize[ii] = (amax[ii] - amin[ii]) / 10.F ; if (binsize[ii] > 1.) binsize[ii] = 1.; /* use default bin size */ } } /* ================================================================ */ /* if the min is greater than the max, make the binsize negative */ if ( (amin[ii] > amax[ii] && binsize[ii] > 0. ) || (amin[ii] < amax[ii] && binsize[ii] < 0. ) ) binsize[ii] = -binsize[ii]; /* reverse the sign of binsize */ ibin = (int) binsize[ii]; imin = (int) amin[ii]; imax = (int) amax[ii]; /* Determine the range and number of bins in the histogram. This */ /* depends on whether the input columns are integer or floats, so */ /* treat each case separately. */ if (datatype <= TLONG && (float) imin == amin[ii] && (float) imax == amax[ii] && (float) ibin == binsize[ii] ) { /* This is an integer column and integer limits were entered. */ /* Shift the lower and upper histogramming limits by 0.5, so that */ /* the values fall in the center of the bin, not on the edge. */ haxes[ii] = (imax - imin) / ibin + 1; /* last bin may only */ /* be partially full */ if (amin[ii] < amax[ii]) { amin[ii] = (float) (amin[ii] - 0.5); amax[ii] = (float) (amax[ii] + 0.5); } else { amin[ii] = (float) (amin[ii] + 0.5); amax[ii] = (float) (amax[ii] - 0.5); } } else if (use_datamax) { /* Either the column datatype and/or the limits are floating point, */ /* and the histogram limits are being defined by the min and max */ /* values of the array. Add 1 to the number of histogram bins to */ /* make sure that pixels that are equal to the maximum or are */ /* in the last partial bin are included. */ haxes[ii] = (long) (((amax[ii] - amin[ii]) / binsize[ii]) + 1.); } else { /* float datatype column and/or limits, and the maximum value to */ /* include in the histogram is specified by the calling program. */ /* The lower limit is inclusive, but upper limit is exclusive */ haxes[ii] = (long) ((amax[ii] - amin[ii]) / binsize[ii]); if (amin[ii] < amax[ii]) { if (amin[ii] + (haxes[ii] * binsize[ii]) < amax[ii]) haxes[ii]++; /* need to include another partial bin */ } else { if (amin[ii] + (haxes[ii] * binsize[ii]) > amax[ii]) haxes[ii]++; /* need to include another partial bin */ } } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_write_keys_histo( fitsfile *fptr, /* I - pointer to table to be binned */ fitsfile *histptr, /* I - pointer to output histogram image HDU */ int naxis, /* I - number of axes in the histogram image */ int *colnum, /* I - column numbers (array length = naxis) */ int *status) { /* Write default WCS keywords in the output histogram image header */ /* if the keywords do not already exist. */ int ii, tstatus; char keyname[FLEN_KEYWORD], svalue[FLEN_VALUE]; double dvalue; if (*status > 0) return(*status); for (ii = 0; ii < naxis; ii++) { /* CTYPEn */ tstatus = 0; ffkeyn("CTYPE", ii+1, keyname, &tstatus); ffgky(histptr, TSTRING, keyname, svalue, NULL, &tstatus); if (!tstatus) continue; /* keyword already exists, so skip to next axis */ /* use column name as the axis name */ tstatus = 0; ffkeyn("TTYPE", colnum[ii], keyname, &tstatus); ffgky(fptr, TSTRING, keyname, svalue, NULL, &tstatus); if (!tstatus) { ffkeyn("CTYPE", ii + 1, keyname, &tstatus); ffpky(histptr, TSTRING, keyname, svalue, "Coordinate Type", &tstatus); } /* CUNITn, use the column units */ tstatus = 0; ffkeyn("TUNIT", colnum[ii], keyname, &tstatus); ffgky(fptr, TSTRING, keyname, svalue, NULL, &tstatus); if (!tstatus) { ffkeyn("CUNIT", ii + 1, keyname, &tstatus); ffpky(histptr, TSTRING, keyname, svalue, "Coordinate Units", &tstatus); } /* CRPIXn - Reference Pixel choose first pixel in new image as ref. pix. */ dvalue = 1.0; tstatus = 0; ffkeyn("CRPIX", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Reference Pixel", &tstatus); /* CRVALn - Value at the location of the reference pixel */ dvalue = 1.0; tstatus = 0; ffkeyn("CRVAL", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Reference Value", &tstatus); /* CDELTn - unit size of pixels */ dvalue = 1.0; tstatus = 0; dvalue = 1.; ffkeyn("CDELT", ii + 1, keyname, &tstatus); ffpky(histptr, TDOUBLE, keyname, &dvalue, "Pixel size", &tstatus); } return(*status); } /*--------------------------------------------------------------------------*/ int fits_rebin_wcs( fitsfile *fptr, /* I - pointer to table to be binned */ int naxis, /* I - number of axes in the histogram image */ float *amin, /* I - first pixel include in each axis */ float *binsize, /* I - binning factor for each axis */ int *status) { /* Update the WCS keywords that define the location of the reference */ /* pixel, and the pixel size, along each axis. */ int ii, jj, tstatus, reset ; char keyname[FLEN_KEYWORD], svalue[FLEN_VALUE]; double dvalue; if (*status > 0) return(*status); for (ii = 0; ii < naxis; ii++) { reset = 0; /* flag to reset the reference pixel */ tstatus = 0; ffkeyn("CRVAL", ii + 1, keyname, &tstatus); /* get previous (pre-binning) value */ ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus && dvalue == 1.0) reset = 1; tstatus = 0; /* CRPIXn - update location of the ref. pix. in the binned image */ ffkeyn("CRPIX", ii + 1, keyname, &tstatus); /* get previous (pre-binning) value */ ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus) { if (dvalue != 1.0) reset = 0; /* updated value to give pixel location after binning */ dvalue = (dvalue - amin[ii]) / ((double) binsize[ii]) + .5; fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus); } else { reset = 0; } /* CDELTn - update unit size of pixels */ tstatus = 0; ffkeyn("CDELT", ii + 1, keyname, &tstatus); /* get previous (pre-binning) value */ ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus) { if (dvalue != 1.0) reset = 0; /* updated to give post-binning value */ dvalue = dvalue * binsize[ii]; fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus); } else { /* no CDELTn keyword, so look for a CDij keywords */ reset = 0; for (jj = 0; jj < naxis; jj++) { tstatus = 0; ffkeyn("CD", jj + 1, svalue, &tstatus); strcat(svalue,"_"); ffkeyn(svalue, ii + 1, keyname, &tstatus); /* get previous (pre-binning) value */ ffgky(fptr, TDOUBLE, keyname, &dvalue, NULL, &tstatus); if (!tstatus) { /* updated to give post-binning value */ dvalue = dvalue * binsize[ii]; fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus); } } } if (reset) { /* the original CRPIX, CRVAL, and CDELT keywords were all = 1.0 */ /* In this special case, reset the reference pixel to be the */ /* first pixel in the array (instead of possibly far off the array) */ dvalue = 1.0; ffkeyn("CRPIX", ii + 1, keyname, &tstatus); fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus); ffkeyn("CRVAL", ii + 1, keyname, &tstatus); dvalue = amin[ii] + (binsize[ii] / 2.0); fits_modify_key_dbl(fptr, keyname, dvalue, -14, NULL, &tstatus); } } return(*status); } /*--------------------------------------------------------------------------*/ int fits_make_hist(fitsfile *fptr, /* IO - pointer to table with X and Y cols; */ fitsfile *histptr, /* I - pointer to output FITS image */ int bitpix, /* I - datatype for image: 16, 32, -32, etc */ int naxis, /* I - number of axes in the histogram image */ long *naxes, /* I - size of axes in the histogram image */ int *colnum, /* I - column numbers (array length = naxis) */ float *amin, /* I - minimum histogram value, for each axis */ float *amax, /* I - maximum histogram value, for each axis */ float *binsize, /* I - bin size along each axis */ float weight, /* I - binning weighting factor */ int wtcolnum, /* I - optional keyword or col for weight*/ int recip, /* I - use reciprocal of the weight? */ char *selectrow, /* I - optional array (length = no. of */ /* rows in the table). If the element is true */ /* then the corresponding row of the table will*/ /* be included in the histogram, otherwise the */ /* row will be skipped. Ingnored if *selectrow*/ /* is equal to NULL. */ int *status) { int ii, imagetype, datatype; int n_cols = 1; long imin, imax, ibin; long offset = 0; long n_per_loop = -1; /* force whole array to be passed at one time */ float taxes[4], tmin[4], tmax[4], tbin[4], maxbin[4]; histType histData; /* Structure holding histogram info for iterator */ iteratorCol imagepars[1]; /* check inputs */ if (*status > 0) return(*status); if (naxis > 4) { ffpmsg("histogram has more than 4 dimensions"); return(*status = BAD_DIMEN); } if (bitpix == BYTE_IMG) imagetype = TBYTE; else if (bitpix == SHORT_IMG) imagetype = TSHORT; else if (bitpix == LONG_IMG) imagetype = TINT; else if (bitpix == FLOAT_IMG) imagetype = TFLOAT; else if (bitpix == DOUBLE_IMG) imagetype = TDOUBLE; else return(*status = BAD_DATATYPE); /* reset position to the correct HDU if necessary */ if ((fptr)->HDUposition != ((fptr)->Fptr)->curhdu) ffmahd(fptr, ((fptr)->HDUposition) + 1, NULL, status); histData.weight = weight; histData.wtcolnum = wtcolnum; histData.wtrecip = recip; histData.tblptr = fptr; histData.himagetype = imagetype; histData.haxis = naxis; histData.rowselector = selectrow; for (ii = 0; ii < naxis; ii++) { taxes[ii] = (float) naxes[ii]; tmin[ii] = amin[ii]; tmax[ii] = amax[ii]; if ( (amin[ii] > amax[ii] && binsize[ii] > 0. ) || (amin[ii] < amax[ii] && binsize[ii] < 0. ) ) tbin[ii] = -binsize[ii]; /* reverse the sign of binsize */ else tbin[ii] = binsize[ii]; /* binsize has the correct sign */ imin = (long) tmin[ii]; imax = (long) tmax[ii]; ibin = (long) tbin[ii]; /* get the datatype of the column */ fits_get_coltype(fptr, colnum[ii], &datatype, NULL, NULL, status); if (datatype <= TLONG && (float) imin == tmin[ii] && (float) imax == tmax[ii] && (float) ibin == tbin[ii] ) { /* This is an integer column and integer limits were entered. */ /* Shift the lower and upper histogramming limits by 0.5, so that */ /* the values fall in the center of the bin, not on the edge. */ maxbin[ii] = (taxes[ii] + 1.F); /* add 1. instead of .5 to avoid roundoff */ if (tmin[ii] < tmax[ii]) { tmin[ii] = tmin[ii] - 0.5F; tmax[ii] = tmax[ii] + 0.5F; } else { tmin[ii] = tmin[ii] + 0.5F; tmax[ii] = tmax[ii] - 0.5F; } } else { /* not an integer column with integer limits */ maxbin[ii] = (tmax[ii] - tmin[ii]) / tbin[ii]; } } /* Set global variables with histogram parameter values. */ /* Use separate scalar variables rather than arrays because */ /* it is more efficient when computing the histogram. */ histData.hcolnum[0] = colnum[0]; histData.amin1 = tmin[0]; histData.maxbin1 = maxbin[0]; histData.binsize1 = tbin[0]; histData.haxis1 = (long) taxes[0]; if (histData.haxis > 1) { histData.hcolnum[1] = colnum[1]; histData.amin2 = tmin[1]; histData.maxbin2 = maxbin[1]; histData.binsize2 = tbin[1]; histData.haxis2 = (long) taxes[1]; if (histData.haxis > 2) { histData.hcolnum[2] = colnum[2]; histData.amin3 = tmin[2]; histData.maxbin3 = maxbin[2]; histData.binsize3 = tbin[2]; histData.haxis3 = (long) taxes[2]; if (histData.haxis > 3) { histData.hcolnum[3] = colnum[3]; histData.amin4 = tmin[3]; histData.maxbin4 = maxbin[3]; histData.binsize4 = tbin[3]; histData.haxis4 = (long) taxes[3]; } } } /* define parameters of image for the iterator function */ fits_iter_set_file(imagepars, histptr); /* pointer to image */ fits_iter_set_datatype(imagepars, imagetype); /* image datatype */ fits_iter_set_iotype(imagepars, OutputCol); /* image is output */ /* call the iterator function to write out the histogram image */ fits_iterate_data(n_cols, imagepars, offset, n_per_loop, ffwritehisto, (void*)&histData, status); return(*status); } /*--------------------------------------------------------------------------*/ int fits_get_col_minmax(fitsfile *fptr, int colnum, float *datamin, float *datamax, int *status) /* Simple utility routine to compute the min and max value in a column */ { int anynul; long nrows, ntodo, firstrow, ii; float array[1000], nulval; ffgky(fptr, TLONG, "NAXIS2", &nrows, NULL, status); /* no. of rows */ firstrow = 1; nulval = FLOATNULLVALUE; *datamin = 9.0E36F; *datamax = -9.0E36F; while(nrows) { ntodo = minvalue(nrows, 100); ffgcv(fptr, TFLOAT, colnum, firstrow, 1, ntodo, &nulval, array, &anynul, status); for (ii = 0; ii < ntodo; ii++) { if (array[ii] != nulval) { *datamin = minvalue(*datamin, array[ii]); *datamax = maxvalue(*datamax, array[ii]); } } nrows -= ntodo; firstrow += ntodo; } return(*status); } /*--------------------------------------------------------------------------*/ int ffwritehisto(long totaln, long pixoffset, long firstn, long nvalues, int narrays, iteratorCol *imagepars, void *userPointer) /* Interator work function that writes out the histogram. The histogram values are calculated by another work function, ffcalchisto. This work function only gets called once, and totaln = nvalues. */ { iteratorCol colpars[5]; int ii, status = 0, ncols; long rows_per_loop = 0, offset = 0; histType *histData; histData = (histType *)userPointer; /* store pointer to the histogram array, and initialize to zero */ switch( histData->himagetype ) { case TBYTE: histData->hist.b = (char * ) fits_iter_get_array(imagepars); break; case TSHORT: histData->hist.i = (short * ) fits_iter_get_array(imagepars); break; case TINT: histData->hist.j = (int * ) fits_iter_get_array(imagepars); break; case TFLOAT: histData->hist.r = (float * ) fits_iter_get_array(imagepars); break; case TDOUBLE: histData->hist.d = (double *) fits_iter_get_array(imagepars); break; } /* set the column parameters for the iterator function */ for (ii = 0; ii < histData->haxis; ii++) { fits_iter_set_by_num(&colpars[ii], histData->tblptr, histData->hcolnum[ii], TFLOAT, InputCol); } ncols = histData->haxis; if (histData->weight == FLOATNULLVALUE) { fits_iter_set_by_num(&colpars[histData->haxis], histData->tblptr, histData->wtcolnum, TFLOAT, InputCol); ncols = histData->haxis + 1; } /* call iterator function to calc the histogram pixel values */ /* must lock this call in multithreaded environoments because */ /* the ffcalchist work routine uses static vaiables that would */ /* get clobbered if multiple threads were running at the same time */ FFLOCK; fits_iterate_data(ncols, colpars, offset, rows_per_loop, ffcalchist, (void*)histData, &status); FFUNLOCK; return(status); } /*--------------------------------------------------------------------------*/ int ffcalchist(long totalrows, long offset, long firstrow, long nrows, int ncols, iteratorCol *colpars, void *userPointer) /* Interator work function that calculates values for the 2D histogram. */ { long ii, ipix, iaxisbin; float pix, axisbin; static float *col1, *col2, *col3, *col4; /* static to preserve values */ static float *wtcol; static long incr2, incr3, incr4; static histType histData; static char *rowselect; /* Initialization procedures: execute on the first call */ if (firstrow == 1) { /* Copy input histogram data to static local variable so we */ /* don't have to constantly dereference it. */ histData = *(histType*)userPointer; rowselect = histData.rowselector; /* assign the input array pointers to local pointers */ col1 = (float *) fits_iter_get_array(&colpars[0]); if (histData.haxis > 1) { col2 = (float *) fits_iter_get_array(&colpars[1]); incr2 = histData.haxis1; if (histData.haxis > 2) { col3 = (float *) fits_iter_get_array(&colpars[2]); incr3 = incr2 * histData.haxis2; if (histData.haxis > 3) { col4 = (float *) fits_iter_get_array(&colpars[3]); incr4 = incr3 * histData.haxis3; } } } if (ncols > histData.haxis) /* then weights are give in a column */ { wtcol = (float *) fits_iter_get_array(&colpars[histData.haxis]); } } /* end of Initialization procedures */ /* Main loop: increment the histogram at position of each event */ for (ii = 1; ii <= nrows; ii++) { if (rowselect) /* if a row selector array is supplied... */ { if (*rowselect) { rowselect++; /* this row is included in the histogram */ } else { rowselect++; /* this row is excluded from the histogram */ continue; } } if (col1[ii] == FLOATNULLVALUE) /* test for null value */ continue; pix = (col1[ii] - histData.amin1) / histData.binsize1; ipix = (long) (pix + 1.); /* add 1 because the 1st pixel is the null value */ /* test if bin is within range */ if (ipix < 1 || ipix > histData.haxis1 || pix > histData.maxbin1) continue; if (histData.haxis > 1) { if (col2[ii] == FLOATNULLVALUE) continue; axisbin = (col2[ii] - histData.amin2) / histData.binsize2; iaxisbin = (long) axisbin; if (axisbin < 0. || iaxisbin >= histData.haxis2 || axisbin > histData.maxbin2) continue; ipix += (iaxisbin * incr2); if (histData.haxis > 2) { if (col3[ii] == FLOATNULLVALUE) continue; axisbin = (col3[ii] - histData.amin3) / histData.binsize3; iaxisbin = (long) axisbin; if (axisbin < 0. || iaxisbin >= histData.haxis3 || axisbin > histData.maxbin3) continue; ipix += (iaxisbin * incr3); if (histData.haxis > 3) { if (col4[ii] == FLOATNULLVALUE) continue; axisbin = (col4[ii] - histData.amin4) / histData.binsize4; iaxisbin = (long) axisbin; if (axisbin < 0. || iaxisbin >= histData.haxis4 || axisbin > histData.maxbin4) continue; ipix += (iaxisbin * incr4); } /* end of haxis > 3 case */ } /* end of haxis > 2 case */ } /* end of haxis > 1 case */ /* increment the histogram pixel */ if (histData.weight != FLOATNULLVALUE) /* constant weight factor */ { if (histData.himagetype == TINT) histData.hist.j[ipix] += (int) histData.weight; else if (histData.himagetype == TSHORT) histData.hist.i[ipix] += (short) histData.weight; else if (histData.himagetype == TFLOAT) histData.hist.r[ipix] += histData.weight; else if (histData.himagetype == TDOUBLE) histData.hist.d[ipix] += histData.weight; else if (histData.himagetype == TBYTE) histData.hist.b[ipix] += (char) histData.weight; } else if (histData.wtrecip) /* use reciprocal of the weight */ { if (histData.himagetype == TINT) histData.hist.j[ipix] += (int) (1./wtcol[ii]); else if (histData.himagetype == TSHORT) histData.hist.i[ipix] += (short) (1./wtcol[ii]); else if (histData.himagetype == TFLOAT) histData.hist.r[ipix] += (float) (1./wtcol[ii]); else if (histData.himagetype == TDOUBLE) histData.hist.d[ipix] += 1./wtcol[ii]; else if (histData.himagetype == TBYTE) histData.hist.b[ipix] += (char) (1./wtcol[ii]); } else /* no weights */ { if (histData.himagetype == TINT) histData.hist.j[ipix] += (int) wtcol[ii]; else if (histData.himagetype == TSHORT) histData.hist.i[ipix] += (short) wtcol[ii]; else if (histData.himagetype == TFLOAT) histData.hist.r[ipix] += wtcol[ii]; else if (histData.himagetype == TDOUBLE) histData.hist.d[ipix] += wtcol[ii]; else if (histData.himagetype == TBYTE) histData.hist.b[ipix] += (char) wtcol[ii]; } } /* end of main loop over all rows */ return(0); } astropy-0.3/cextern/cfitsio/editcol.c0000644000175000017500000024527112243255342016111 0ustar oleole/* This file, editcol.c, contains the set of FITSIO routines that */ /* insert or delete rows or columns in a table or resize an image */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffrsim(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ long *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* resize an existing primary array or IMAGE extension. */ { LONGLONG tnaxes[99]; int ii; if (*status > 0) return(*status); for (ii = 0; (ii < naxis) && (ii < 99); ii++) tnaxes[ii] = naxes[ii]; ffrsimll(fptr, bitpix, naxis, tnaxes, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffrsimll(fitsfile *fptr, /* I - FITS file pointer */ int bitpix, /* I - bits per pixel */ int naxis, /* I - number of axes in the array */ LONGLONG *naxes, /* I - size of each axis */ int *status) /* IO - error status */ /* resize an existing primary array or IMAGE extension. */ { int ii, simple, obitpix, onaxis, extend, nmodify; long nblocks, longval; long pcount, gcount, longbitpix; LONGLONG onaxes[99], newsize, oldsize; char comment[FLEN_COMMENT], keyname[FLEN_KEYWORD], message[FLEN_ERRMSG]; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); /* get current image size parameters */ if (ffghprll(fptr, 99, &simple, &obitpix, &onaxis, onaxes, &pcount, &gcount, &extend, status) > 0) return(*status); longbitpix = bitpix; /* test for the 2 special cases that represent unsigned integers */ if (longbitpix == USHORT_IMG) longbitpix = SHORT_IMG; else if (longbitpix == ULONG_IMG) longbitpix = LONG_IMG; /* test that the new values are legal */ if (longbitpix != BYTE_IMG && longbitpix != SHORT_IMG && longbitpix != LONG_IMG && longbitpix != LONGLONG_IMG && longbitpix != FLOAT_IMG && longbitpix != DOUBLE_IMG) { sprintf(message, "Illegal value for BITPIX keyword: %d", bitpix); ffpmsg(message); return(*status = BAD_BITPIX); } if (naxis < 0 || naxis > 999) { sprintf(message, "Illegal value for NAXIS keyword: %d", naxis); ffpmsg(message); return(*status = BAD_NAXIS); } if (naxis == 0) newsize = 0; else newsize = 1; for (ii = 0; ii < naxis; ii++) { if (naxes[ii] < 0) { sprintf(message, "Illegal value for NAXIS%d keyword: %.0f", ii + 1, (double) (naxes[ii])); ffpmsg(message); return(*status = BAD_NAXES); } newsize *= naxes[ii]; /* compute new image size, in pixels */ } /* compute size of old image, in bytes */ if (onaxis == 0) oldsize = 0; else { oldsize = 1; for (ii = 0; ii < onaxis; ii++) oldsize *= onaxes[ii]; oldsize = (oldsize + pcount) * gcount * (abs(obitpix) / 8); } oldsize = (oldsize + 2879) / 2880; /* old size, in blocks */ newsize = (newsize + pcount) * gcount * (abs(longbitpix) / 8); newsize = (newsize + 2879) / 2880; /* new size, in blocks */ if (newsize > oldsize) /* have to insert new blocks for image */ { nblocks = (long) (newsize - oldsize); if (ffiblk(fptr, nblocks, 1, status) > 0) return(*status); } else if (oldsize > newsize) /* have to delete blocks from image */ { nblocks = (long) (oldsize - newsize); if (ffdblk(fptr, nblocks, status) > 0) return(*status); } /* now update the header keywords */ strcpy(comment,"&"); /* special value to leave comments unchanged */ if (longbitpix != obitpix) { /* update BITPIX value */ ffmkyj(fptr, "BITPIX", longbitpix, comment, status); } if (naxis != onaxis) { /* update NAXIS value */ longval = naxis; ffmkyj(fptr, "NAXIS", longval, comment, status); } /* modify the existing NAXISn keywords */ nmodify = minvalue(naxis, onaxis); for (ii = 0; ii < nmodify; ii++) { ffkeyn("NAXIS", ii+1, keyname, status); ffmkyj(fptr, keyname, naxes[ii], comment, status); } if (naxis > onaxis) /* insert additional NAXISn keywords */ { strcpy(comment,"length of data axis"); for (ii = onaxis; ii < naxis; ii++) { ffkeyn("NAXIS", ii+1, keyname, status); ffikyj(fptr, keyname, naxes[ii], comment, status); } } else if (onaxis > naxis) /* delete old NAXISn keywords */ { for (ii = naxis; ii < onaxis; ii++) { ffkeyn("NAXIS", ii+1, keyname, status); ffdkey(fptr, keyname, status); } } /* Update the BSCALE and BZERO keywords, if an unsigned integer image */ if (bitpix == USHORT_IMG) { strcpy(comment, "offset data range to that of unsigned short"); ffukyg(fptr, "BZERO", 32768., 0, comment, status); strcpy(comment, "default scaling factor"); ffukyg(fptr, "BSCALE", 1.0, 0, comment, status); } else if (bitpix == ULONG_IMG) { strcpy(comment, "offset data range to that of unsigned long"); ffukyg(fptr, "BZERO", 2147483648., 0, comment, status); strcpy(comment, "default scaling factor"); ffukyg(fptr, "BSCALE", 1.0, 0, comment, status); } /* re-read the header, to make sure structures are updated */ ffrdef(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffirow(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstrow, /* I - insert space AFTER this row */ /* 0 = insert space at beginning of table */ LONGLONG nrows, /* I - number of rows to insert */ int *status) /* IO - error status */ /* insert NROWS blank rows immediated after row firstrow (1 = first row). Set firstrow = 0 to insert space at the beginning of the table. */ { int tstatus; LONGLONG naxis1, naxis2; LONGLONG datasize, firstbyte, nshift, nbytes; LONGLONG freespace; long nblock; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only add rows to TABLE or BINTABLE extension (ffirow)"); return(*status = NOT_TABLE); } if (nrows < 0 ) return(*status = NEG_BYTES); else if (nrows == 0) return(*status); /* no op, so just return */ /* get the current size of the table */ /* use internal structure since NAXIS2 keyword may not be up to date */ naxis1 = (fptr->Fptr)->rowlength; naxis2 = (fptr->Fptr)->numrows; if (firstrow > naxis2) { ffpmsg( "Insert position greater than the number of rows in the table (ffirow)"); return(*status = BAD_ROW_NUM); } else if (firstrow < 0) { ffpmsg("Insert position is less than 0 (ffirow)"); return(*status = BAD_ROW_NUM); } /* current data size */ datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize; nshift = naxis1 * nrows; /* no. of bytes to add to table */ if ( (freespace - nshift) < 0) /* not enough existing space? */ { nblock = (long) ((nshift - freespace + 2879) / 2880); /* number of blocks */ ffiblk(fptr, nblock, 1, status); /* insert the blocks */ } firstbyte = naxis1 * firstrow; /* relative insert position */ nbytes = datasize - firstbyte; /* no. of bytes to shift down */ firstbyte += ((fptr->Fptr)->datastart); /* absolute insert position */ ffshft(fptr, firstbyte, nbytes, nshift, status); /* shift rows and heap */ /* update the heap starting address */ (fptr->Fptr)->heapstart += nshift; /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (fptr->Fptr)->heapstart, "&", &tstatus); /* update the NAXIS2 keyword */ ffmkyj(fptr, "NAXIS2", naxis2 + nrows, "&", status); ((fptr->Fptr)->numrows) += nrows; ((fptr->Fptr)->origrows) += nrows; return(*status); } /*--------------------------------------------------------------------------*/ int ffdrow(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstrow, /* I - first row to delete (1 = first) */ LONGLONG nrows, /* I - number of rows to delete */ int *status) /* IO - error status */ /* delete NROWS rows from table starting with firstrow (1 = first row of table). */ { int tstatus; LONGLONG naxis1, naxis2; LONGLONG datasize, firstbyte, nbytes, nshift; LONGLONG freespace; long nblock; char comm[FLEN_COMMENT]; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only delete rows in TABLE or BINTABLE extension (ffdrow)"); return(*status = NOT_TABLE); } if (nrows < 0 ) return(*status = NEG_BYTES); else if (nrows == 0) return(*status); /* no op, so just return */ ffgkyjj(fptr, "NAXIS1", &naxis1, comm, status); /* get the current */ /* ffgkyj(fptr, "NAXIS2", &naxis2, comm, status);*/ /* size of the table */ /* the NAXIS2 keyword may not be up to date, so use the structure value */ naxis2 = (fptr->Fptr)->numrows; if (firstrow > naxis2) { ffpmsg( "Delete position greater than the number of rows in the table (ffdrow)"); return(*status = BAD_ROW_NUM); } else if (firstrow < 1) { ffpmsg("Delete position is less than 1 (ffdrow)"); return(*status = BAD_ROW_NUM); } else if (firstrow + nrows - 1 > naxis2) { ffpmsg("No. of rows to delete exceeds size of table (ffdrow)"); return(*status = BAD_ROW_NUM); } nshift = naxis1 * nrows; /* no. of bytes to delete from table */ /* cur size of data */ datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; firstbyte = naxis1 * (firstrow + nrows - 1); /* relative del pos */ nbytes = datasize - firstbyte; /* no. of bytes to shift up */ firstbyte += ((fptr->Fptr)->datastart); /* absolute delete position */ ffshft(fptr, firstbyte, nbytes, nshift * (-1), status); /* shift data */ freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize; nblock = (long) ((nshift + freespace) / 2880); /* number of blocks */ /* delete integral number blocks */ if (nblock > 0) ffdblk(fptr, nblock, status); /* update the heap starting address */ (fptr->Fptr)->heapstart -= nshift; /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (long)(fptr->Fptr)->heapstart, "&", &tstatus); /* update the NAXIS2 keyword */ ffmkyj(fptr, "NAXIS2", naxis2 - nrows, "&", status); ((fptr->Fptr)->numrows) -= nrows; ((fptr->Fptr)->origrows) -= nrows; /* Update the heap data, if any. This will remove any orphaned data */ /* that was only pointed to by the rows that have been deleted */ ffcmph(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffdrrg(fitsfile *fptr, /* I - FITS file pointer to table */ char *ranges, /* I - ranges of rows to delete (1 = first) */ int *status) /* IO - error status */ /* delete the ranges of rows from the table (1 = first row of table). The 'ranges' parameter typically looks like: '10-20, 30 - 40, 55' or '50-' and gives a list of rows or row ranges separated by commas. */ { char *cptr; int nranges, nranges2, ii; long *minrow, *maxrow, nrows, *rowarray, jj, kk; LONGLONG naxis2; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only delete rows in TABLE or BINTABLE extension (ffdrrg)"); return(*status = NOT_TABLE); } /* the NAXIS2 keyword may not be up to date, so use the structure value */ naxis2 = (fptr->Fptr)->numrows; /* find how many ranges were specified ( = no. of commas in string + 1) */ cptr = ranges; for (nranges = 1; (cptr = strchr(cptr, ',')); nranges++) cptr++; minrow = calloc(nranges, sizeof(long)); maxrow = calloc(nranges, sizeof(long)); if (!minrow || !maxrow) { *status = MEMORY_ALLOCATION; ffpmsg("failed to allocate memory for row ranges (ffdrrg)"); if (maxrow) free(maxrow); if (minrow) free(minrow); return(*status); } /* parse range list into array of range min and max values */ ffrwrg(ranges, naxis2, nranges, &nranges2, minrow, maxrow, status); if (*status > 0 || nranges2 == 0) { free(maxrow); free(minrow); return(*status); } /* determine total number or rows to delete */ nrows = 0; for (ii = 0; ii < nranges2; ii++) { nrows = nrows + maxrow[ii] - minrow[ii] + 1; } rowarray = calloc(nrows, sizeof(long)); if (!rowarray) { *status = MEMORY_ALLOCATION; ffpmsg("failed to allocate memory for row array (ffdrrg)"); return(*status); } for (kk = 0, ii = 0; ii < nranges2; ii++) { for (jj = minrow[ii]; jj <= maxrow[ii]; jj++) { rowarray[kk] = jj; kk++; } } /* delete the rows */ ffdrws(fptr, rowarray, nrows, status); free(rowarray); free(maxrow); free(minrow); return(*status); } /*--------------------------------------------------------------------------*/ int ffdrws(fitsfile *fptr, /* I - FITS file pointer */ long *rownum, /* I - list of rows to delete (1 = first) */ long nrows, /* I - number of rows to delete */ int *status) /* IO - error status */ /* delete the list of rows from the table (1 = first row of table). */ { LONGLONG naxis1, naxis2, insertpos, nextrowpos; long ii, nextrow; char comm[FLEN_COMMENT]; unsigned char *buffer; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only delete rows in TABLE or BINTABLE extension (ffdrws)"); return(*status = NOT_TABLE); } if (nrows < 0 ) return(*status = NEG_BYTES); else if (nrows == 0) return(*status); /* no op, so just return */ ffgkyjj(fptr, "NAXIS1", &naxis1, comm, status); /* row width */ ffgkyjj(fptr, "NAXIS2", &naxis2, comm, status); /* number of rows */ /* check that input row list is in ascending order */ for (ii = 1; ii < nrows; ii++) { if (rownum[ii - 1] >= rownum[ii]) { ffpmsg("row numbers are not in increasing order (ffdrws)"); return(*status = BAD_ROW_NUM); } } if (rownum[0] < 1) { ffpmsg("first row to delete is less than 1 (ffdrws)"); return(*status = BAD_ROW_NUM); } else if (rownum[nrows - 1] > naxis2) { ffpmsg("last row to delete exceeds size of table (ffdrws)"); return(*status = BAD_ROW_NUM); } buffer = (unsigned char *) malloc( (size_t) naxis1); /* buffer for one row */ if (!buffer) { ffpmsg("malloc failed (ffdrws)"); return(*status = MEMORY_ALLOCATION); } /* byte location to start of first row to delete, and the next row */ insertpos = (fptr->Fptr)->datastart + ((rownum[0] - 1) * naxis1); nextrowpos = insertpos + naxis1; nextrow = rownum[0] + 1; /* work through the list of rows to delete */ for (ii = 1; ii < nrows; nextrow++, nextrowpos += naxis1) { if (nextrow < rownum[ii]) { /* keep this row, so copy it to the new position */ ffmbyt(fptr, nextrowpos, REPORT_EOF, status); ffgbyt(fptr, naxis1, buffer, status); /* read the bytes */ ffmbyt(fptr, insertpos, IGNORE_EOF, status); ffpbyt(fptr, naxis1, buffer, status); /* write the bytes */ if (*status > 0) { ffpmsg("error while copying good rows in table (ffdrws)"); free(buffer); return(*status); } insertpos += naxis1; } else { /* skip over this row since it is in the list */ ii++; } } /* finished with all the rows to delete; copy remaining rows */ while(nextrow <= naxis2) { ffmbyt(fptr, nextrowpos, REPORT_EOF, status); ffgbyt(fptr, naxis1, buffer, status); /* read the bytes */ ffmbyt(fptr, insertpos, IGNORE_EOF, status); ffpbyt(fptr, naxis1, buffer, status); /* write the bytes */ if (*status > 0) { ffpmsg("failed to copy remaining rows in table (ffdrws)"); free(buffer); return(*status); } insertpos += naxis1; nextrowpos += naxis1; nextrow++; } free(buffer); /* now delete the empty rows at the end of the table */ ffdrow(fptr, naxis2 - nrows + 1, nrows, status); /* Update the heap data, if any. This will remove any orphaned data */ /* that was only pointed to by the rows that have been deleted */ ffcmph(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffdrwsll(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG *rownum, /* I - list of rows to delete (1 = first) */ LONGLONG nrows, /* I - number of rows to delete */ int *status) /* IO - error status */ /* delete the list of rows from the table (1 = first row of table). */ { LONGLONG insertpos, nextrowpos; LONGLONG naxis1, naxis2, ii, nextrow; char comm[FLEN_COMMENT]; unsigned char *buffer; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only delete rows in TABLE or BINTABLE extension (ffdrws)"); return(*status = NOT_TABLE); } if (nrows < 0 ) return(*status = NEG_BYTES); else if (nrows == 0) return(*status); /* no op, so just return */ ffgkyjj(fptr, "NAXIS1", &naxis1, comm, status); /* row width */ ffgkyjj(fptr, "NAXIS2", &naxis2, comm, status); /* number of rows */ /* check that input row list is in ascending order */ for (ii = 1; ii < nrows; ii++) { if (rownum[ii - 1] >= rownum[ii]) { ffpmsg("row numbers are not in increasing order (ffdrws)"); return(*status = BAD_ROW_NUM); } } if (rownum[0] < 1) { ffpmsg("first row to delete is less than 1 (ffdrws)"); return(*status = BAD_ROW_NUM); } else if (rownum[nrows - 1] > naxis2) { ffpmsg("last row to delete exceeds size of table (ffdrws)"); return(*status = BAD_ROW_NUM); } buffer = (unsigned char *) malloc( (size_t) naxis1); /* buffer for one row */ if (!buffer) { ffpmsg("malloc failed (ffdrwsll)"); return(*status = MEMORY_ALLOCATION); } /* byte location to start of first row to delete, and the next row */ insertpos = (fptr->Fptr)->datastart + ((rownum[0] - 1) * naxis1); nextrowpos = insertpos + naxis1; nextrow = rownum[0] + 1; /* work through the list of rows to delete */ for (ii = 1; ii < nrows; nextrow++, nextrowpos += naxis1) { if (nextrow < rownum[ii]) { /* keep this row, so copy it to the new position */ ffmbyt(fptr, nextrowpos, REPORT_EOF, status); ffgbyt(fptr, naxis1, buffer, status); /* read the bytes */ ffmbyt(fptr, insertpos, IGNORE_EOF, status); ffpbyt(fptr, naxis1, buffer, status); /* write the bytes */ if (*status > 0) { ffpmsg("error while copying good rows in table (ffdrws)"); free(buffer); return(*status); } insertpos += naxis1; } else { /* skip over this row since it is in the list */ ii++; } } /* finished with all the rows to delete; copy remaining rows */ while(nextrow <= naxis2) { ffmbyt(fptr, nextrowpos, REPORT_EOF, status); ffgbyt(fptr, naxis1, buffer, status); /* read the bytes */ ffmbyt(fptr, insertpos, IGNORE_EOF, status); ffpbyt(fptr, naxis1, buffer, status); /* write the bytes */ if (*status > 0) { ffpmsg("failed to copy remaining rows in table (ffdrws)"); free(buffer); return(*status); } insertpos += naxis1; nextrowpos += naxis1; nextrow++; } free(buffer); /* now delete the empty rows at the end of the table */ ffdrow(fptr, naxis2 - nrows + 1, nrows, status); /* Update the heap data, if any. This will remove any orphaned data */ /* that was only pointed to by the rows that have been deleted */ ffcmph(fptr, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffrwrg( char *rowlist, /* I - list of rows and row ranges */ LONGLONG maxrows, /* I - number of rows in the table */ int maxranges, /* I - max number of ranges to be returned */ int *numranges, /* O - number ranges returned */ long *minrow, /* O - first row in each range */ long *maxrow, /* O - last row in each range */ int *status) /* IO - status value */ { /* parse the input list of row ranges, returning the number of ranges, and the min and max row value in each range. The only characters allowed in the input rowlist are decimal digits, minus sign, and comma (and non-significant spaces) Example: list = "10-20, 30-35,50" would return numranges = 3, minrow[] = {10, 30, 50}, maxrow[] = {20, 35, 50} error is returned if min value of range is > max value of range or if the ranges are not monotonically increasing. */ char *next; long minval, maxval; if (*status > 0) return(*status); if (maxrows <= 0 ) { *status = RANGE_PARSE_ERROR; ffpmsg("Input maximum range value is <= 0 (fits_parse_ranges)"); return(*status); } next = rowlist; *numranges = 0; while (*next == ' ')next++; /* skip spaces */ while (*next != '\0') { /* find min value of next range; *next must be '-' or a digit */ if (*next == '-') { minval = 1; /* implied minrow value = 1 */ } else if ( isdigit((int) *next) ) { minval = strtol(next, &next, 10); } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } while (*next == ' ')next++; /* skip spaces */ /* find max value of next range; *next must be '-', or ',' */ if (*next == '-') { next++; while (*next == ' ')next++; /* skip spaces */ if ( isdigit((int) *next) ) { maxval = strtol(next, &next, 10); } else if (*next == ',' || *next == '\0') { maxval = (long) maxrows; /* implied max value */ } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } } else if (*next == ',' || *next == '\0') { maxval = minval; /* only a single integer in this range */ } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } if (*numranges + 1 > maxranges) { *status = RANGE_PARSE_ERROR; ffpmsg("Overflowed maximum number of ranges (fits_parse_ranges)"); return(*status); } if (minval < 1 ) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list: row number < 1"); ffpmsg(rowlist); return(*status); } if (maxval < minval) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list: min > max"); ffpmsg(rowlist); return(*status); } if (*numranges > 0) { if (minval <= maxrow[(*numranges) - 1]) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list. Range minimum is"); ffpmsg(" less than or equal to previous range maximum"); ffpmsg(rowlist); return(*status); } } if (minval <= maxrows) { /* ignore range if greater than maxrows */ if (maxval > maxrows) maxval = (long) maxrows; minrow[*numranges] = minval; maxrow[*numranges] = maxval; (*numranges)++; } while (*next == ' ')next++; /* skip spaces */ if (*next == ',') { next++; while (*next == ' ')next++; /* skip more spaces */ } } if (*numranges == 0) { /* a null string was entered */ minrow[0] = 1; maxrow[0] = (long) maxrows; *numranges = 1; } return(*status); } /*--------------------------------------------------------------------------*/ int ffrwrgll( char *rowlist, /* I - list of rows and row ranges */ LONGLONG maxrows, /* I - number of rows in the list */ int maxranges, /* I - max number of ranges to be returned */ int *numranges, /* O - number ranges returned */ LONGLONG *minrow, /* O - first row in each range */ LONGLONG *maxrow, /* O - last row in each range */ int *status) /* IO - status value */ { /* parse the input list of row ranges, returning the number of ranges, and the min and max row value in each range. The only characters allowed in the input rowlist are decimal digits, minus sign, and comma (and non-significant spaces) Example: list = "10-20, 30-35,50" would return numranges = 3, minrow[] = {10, 30, 50}, maxrow[] = {20, 35, 50} error is returned if min value of range is > max value of range or if the ranges are not monotonically increasing. */ char *next; LONGLONG minval, maxval; double dvalue; if (*status > 0) return(*status); if (maxrows <= 0 ) { *status = RANGE_PARSE_ERROR; ffpmsg("Input maximum range value is <= 0 (fits_parse_ranges)"); return(*status); } next = rowlist; *numranges = 0; while (*next == ' ')next++; /* skip spaces */ while (*next != '\0') { /* find min value of next range; *next must be '-' or a digit */ if (*next == '-') { minval = 1; /* implied minrow value = 1 */ } else if ( isdigit((int) *next) ) { /* read as a double, because the string to LONGLONG function */ /* is platform dependent (strtoll, strtol, _atoI64) */ dvalue = strtod(next, &next); minval = (LONGLONG) (dvalue + 0.1); } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } while (*next == ' ')next++; /* skip spaces */ /* find max value of next range; *next must be '-', or ',' */ if (*next == '-') { next++; while (*next == ' ')next++; /* skip spaces */ if ( isdigit((int) *next) ) { /* read as a double, because the string to LONGLONG function */ /* is platform dependent (strtoll, strtol, _atoI64) */ dvalue = strtod(next, &next); maxval = (LONGLONG) (dvalue + 0.1); } else if (*next == ',' || *next == '\0') { maxval = maxrows; /* implied max value */ } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } } else if (*next == ',' || *next == '\0') { maxval = minval; /* only a single integer in this range */ } else { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list:"); ffpmsg(rowlist); return(*status); } if (*numranges + 1 > maxranges) { *status = RANGE_PARSE_ERROR; ffpmsg("Overflowed maximum number of ranges (fits_parse_ranges)"); return(*status); } if (minval < 1 ) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list: row number < 1"); ffpmsg(rowlist); return(*status); } if (maxval < minval) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list: min > max"); ffpmsg(rowlist); return(*status); } if (*numranges > 0) { if (minval <= maxrow[(*numranges) - 1]) { *status = RANGE_PARSE_ERROR; ffpmsg("Syntax error in this row range list. Range minimum is"); ffpmsg(" less than or equal to previous range maximum"); ffpmsg(rowlist); return(*status); } } if (minval <= maxrows) { /* ignore range if greater than maxrows */ if (maxval > maxrows) maxval = maxrows; minrow[*numranges] = minval; maxrow[*numranges] = maxval; (*numranges)++; } while (*next == ' ')next++; /* skip spaces */ if (*next == ',') { next++; while (*next == ' ')next++; /* skip more spaces */ } } if (*numranges == 0) { /* a null string was entered */ minrow[0] = 1; maxrow[0] = maxrows; *numranges = 1; } return(*status); } /*--------------------------------------------------------------------------*/ int fficol(fitsfile *fptr, /* I - FITS file pointer */ int numcol, /* I - position for new col. (1 = 1st) */ char *ttype, /* I - name of column (TTYPE keyword) */ char *tform, /* I - format of column (TFORM keyword) */ int *status) /* IO - error status */ /* Insert a new column into an existing table at position numcol. If numcol is greater than the number of existing columns in the table then the new column will be appended as the last column in the table. */ { char *name, *format; name = ttype; format = tform; fficls(fptr, numcol, 1, &name, &format, status); return(*status); } /*--------------------------------------------------------------------------*/ int fficls(fitsfile *fptr, /* I - FITS file pointer */ int fstcol, /* I - position for first new col. (1 = 1st) */ int ncols, /* I - number of columns to insert */ char **ttype, /* I - array of column names(TTYPE keywords) */ char **tform, /* I - array of formats of column (TFORM) */ int *status) /* IO - error status */ /* Insert 1 or more new columns into an existing table at position numcol. If fstcol is greater than the number of existing columns in the table then the new column will be appended as the last column in the table. */ { int colnum, datacode, decims, tfields, tstatus, ii; LONGLONG datasize, firstbyte, nbytes, nadd, naxis1, naxis2, freespace; LONGLONG tbcol, firstcol, delbyte; long nblock, width, repeat; char tfm[FLEN_VALUE], keyname[FLEN_KEYWORD], comm[FLEN_COMMENT], *cptr; tcolumn *colptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg("Can only add columns to TABLE or BINTABLE extension (fficol)"); return(*status = NOT_TABLE); } /* is the column number valid? */ tfields = (fptr->Fptr)->tfield; if (fstcol < 1 ) return(*status = BAD_COL_NUM); else if (fstcol > tfields) colnum = tfields + 1; /* append as last column */ else colnum = fstcol; /* parse the tform value and calc number of bytes to add to each row */ delbyte = 0; for (ii = 0; ii < ncols; ii++) { strcpy(tfm, tform[ii]); ffupch(tfm); /* make sure format is in upper case */ if ((fptr->Fptr)->hdutype == ASCII_TBL) { ffasfm(tfm, &datacode, &width, &decims, status); delbyte += width + 1; /* add one space between the columns */ } else { ffbnfm(tfm, &datacode, &repeat, &width, status); if (datacode < 0) { /* variable length array column */ if (strchr(tfm, 'Q')) delbyte += 16; else delbyte += 8; } else if (datacode == 1) /* bit column; round up */ delbyte += (repeat + 7) / 8; /* to multiple of 8 bits */ else if (datacode == 16) /* ASCII string column */ delbyte += repeat; else /* numerical data type */ delbyte += (datacode / 10) * repeat; } } if (*status > 0) return(*status); /* get the current size of the table */ /* use internal structure since NAXIS2 keyword may not be up to date */ naxis1 = (fptr->Fptr)->rowlength; naxis2 = (fptr->Fptr)->numrows; /* current size of data */ datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize; nadd = delbyte * naxis2; /* no. of bytes to add to table */ if ( (freespace - nadd) < 0) /* not enough existing space? */ { nblock = (long) ((nadd - freespace + 2879) / 2880); /* number of blocks */ if (ffiblk(fptr, nblock, 1, status) > 0) /* insert the blocks */ return(*status); } /* shift heap down (if it exists) */ if ((fptr->Fptr)->heapsize > 0) { nbytes = (fptr->Fptr)->heapsize; /* no. of bytes to shift down */ /* absolute heap pos */ firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart; if (ffshft(fptr, firstbyte, nbytes, nadd, status) > 0) /* move heap */ return(*status); } /* update the heap starting address */ (fptr->Fptr)->heapstart += nadd; /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (fptr->Fptr)->heapstart, "&", &tstatus); /* calculate byte position in the row where to insert the new column */ if (colnum > tfields) firstcol = naxis1; else { colptr = (fptr->Fptr)->tableptr; colptr += (colnum - 1); firstcol = colptr->tbcol; } /* insert delbyte bytes in every row, at byte position firstcol */ ffcins(fptr, naxis1, naxis2, delbyte, firstcol, status); if ((fptr->Fptr)->hdutype == ASCII_TBL) { /* adjust the TBCOL values of the existing columns */ for(ii = 0; ii < tfields; ii++) { ffkeyn("TBCOL", ii + 1, keyname, status); ffgkyjj(fptr, keyname, &tbcol, comm, status); if (tbcol > firstcol) { tbcol += delbyte; ffmkyj(fptr, keyname, tbcol, "&", status); } } } /* update the mandatory keywords */ ffmkyj(fptr, "TFIELDS", tfields + ncols, "&", status); ffmkyj(fptr, "NAXIS1", naxis1 + delbyte, "&", status); /* increment the index value on any existing column keywords */ if(colnum <= tfields) ffkshf(fptr, colnum, tfields, ncols, status); /* add the required keywords for the new columns */ for (ii = 0; ii < ncols; ii++, colnum++) { strcpy(comm, "label for field"); ffkeyn("TTYPE", colnum, keyname, status); ffpkys(fptr, keyname, ttype[ii], comm, status); strcpy(comm, "format of field"); strcpy(tfm, tform[ii]); ffupch(tfm); /* make sure format is in upper case */ ffkeyn("TFORM", colnum, keyname, status); if (abs(datacode) == TSBYTE) { /* Replace the 'S' with an 'B' in the TFORMn code */ cptr = tfm; while (*cptr != 'S') cptr++; *cptr = 'B'; ffpkys(fptr, keyname, tfm, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", colnum, keyname, status); strcpy(comm, "offset for signed bytes"); ffpkyg(fptr, keyname, -128., 0, comm, status); ffkeyn("TSCAL", colnum, keyname, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, keyname, 1., 0, comm, status); } else if (abs(datacode) == TUSHORT) { /* Replace the 'U' with an 'I' in the TFORMn code */ cptr = tfm; while (*cptr != 'U') cptr++; *cptr = 'I'; ffpkys(fptr, keyname, tfm, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", colnum, keyname, status); strcpy(comm, "offset for unsigned integers"); ffpkyg(fptr, keyname, 32768., 0, comm, status); ffkeyn("TSCAL", colnum, keyname, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, keyname, 1., 0, comm, status); } else if (abs(datacode) == TULONG) { /* Replace the 'V' with an 'J' in the TFORMn code */ cptr = tfm; while (*cptr != 'V') cptr++; *cptr = 'J'; ffpkys(fptr, keyname, tfm, comm, status); /* write the TZEROn and TSCALn keywords */ ffkeyn("TZERO", colnum, keyname, status); strcpy(comm, "offset for unsigned integers"); ffpkyg(fptr, keyname, 2147483648., 0, comm, status); ffkeyn("TSCAL", colnum, keyname, status); strcpy(comm, "data are not scaled"); ffpkyg(fptr, keyname, 1., 0, comm, status); } else { ffpkys(fptr, keyname, tfm, comm, status); } if ((fptr->Fptr)->hdutype == ASCII_TBL) /* write the TBCOL keyword */ { if (colnum == tfields + 1) tbcol = firstcol + 2; /* allow space between preceding col */ else tbcol = firstcol + 1; strcpy(comm, "beginning column of field"); ffkeyn("TBCOL", colnum, keyname, status); ffpkyj(fptr, keyname, tbcol, comm, status); /* increment the column starting position for the next column */ ffasfm(tfm, &datacode, &width, &decims, status); firstcol += width + 1; /* add one space between the columns */ } } ffrdef(fptr, status); /* initialize the new table structure */ return(*status); } /*--------------------------------------------------------------------------*/ int ffmvec(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - position of col to be modified */ LONGLONG newveclen, /* I - new vector length of column (TFORM) */ int *status) /* IO - error status */ /* Modify the vector length of a column in a binary table, larger or smaller. E.g., change a column from TFORMn = '1E' to '20E'. */ { int datacode, tfields, tstatus; LONGLONG datasize, size, firstbyte, nbytes, nadd, ndelete; LONGLONG naxis1, naxis2, firstcol, freespace; LONGLONG width, delbyte, repeat; long nblock; char tfm[FLEN_VALUE], keyname[FLEN_KEYWORD], tcode[2]; tcolumn *colptr; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype != BINARY_TBL) { ffpmsg( "Can only change vector length of a column in BINTABLE extension (ffmvec)"); return(*status = NOT_TABLE); } /* is the column number valid? */ tfields = (fptr->Fptr)->tfield; if (colnum < 1 || colnum > tfields) return(*status = BAD_COL_NUM); /* look up the current vector length and element width */ colptr = (fptr->Fptr)->tableptr; colptr += (colnum - 1); datacode = colptr->tdatatype; /* datatype of the column */ repeat = colptr->trepeat; /* field repeat count */ width = colptr->twidth; /* width of a single element in chars */ if (datacode < 0) { ffpmsg( "Can't modify vector length of variable length column (ffmvec)"); return(*status = BAD_TFORM); } if (repeat == newveclen) return(*status); /* column already has the desired vector length */ if (datacode == TSTRING) width = 1; /* width was equal to width of unit string */ naxis1 = (fptr->Fptr)->rowlength; /* current width of the table */ naxis2 = (fptr->Fptr)->numrows; delbyte = (newveclen - repeat) * width; /* no. of bytes to insert */ if (datacode == TBIT) /* BIT column is a special case */ delbyte = ((newveclen + 7) / 8) - ((repeat + 7) / 8); if (delbyte > 0) /* insert space for more elements */ { /* current size of data */ datasize = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; freespace = ( ( (datasize + 2879) / 2880) * 2880) - datasize; nadd = (LONGLONG)delbyte * naxis2; /* no. of bytes to add to table */ if ( (freespace - nadd) < 0) /* not enough existing space? */ { nblock = (long) ((nadd - freespace + 2879) / 2880); /* number of blocks */ if (ffiblk(fptr, nblock, 1, status) > 0) /* insert the blocks */ return(*status); } /* shift heap down (if it exists) */ if ((fptr->Fptr)->heapsize > 0) { nbytes = (fptr->Fptr)->heapsize; /* no. of bytes to shift down */ /* absolute heap pos */ firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart; if (ffshft(fptr, firstbyte, nbytes, nadd, status) > 0) /* move heap */ return(*status); } /* update the heap starting address */ (fptr->Fptr)->heapstart += nadd; /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (fptr->Fptr)->heapstart, "&", &tstatus); firstcol = colptr->tbcol + (repeat * width); /* insert position */ /* insert delbyte bytes in every row, at byte position firstcol */ ffcins(fptr, naxis1, naxis2, delbyte, firstcol, status); } else if (delbyte < 0) { /* current size of table */ size = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; freespace = ((size + 2879) / 2880) * 2880 - size - ((LONGLONG)delbyte * naxis2); nblock = (long) (freespace / 2880); /* number of empty blocks to delete */ firstcol = colptr->tbcol + (newveclen * width); /* delete position */ /* delete elements from the vector */ ffcdel(fptr, naxis1, naxis2, -delbyte, firstcol, status); /* abs heap pos */ firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart; ndelete = (LONGLONG)delbyte * naxis2; /* size of shift (negative) */ /* shift heap up (if it exists) */ if ((fptr->Fptr)->heapsize > 0) { nbytes = (fptr->Fptr)->heapsize; /* no. of bytes to shift up */ if (ffshft(fptr, firstbyte, nbytes, ndelete, status) > 0) return(*status); } /* delete the empty blocks at the end of the HDU */ if (nblock > 0) ffdblk(fptr, nblock, status); /* update the heap starting address */ (fptr->Fptr)->heapstart += ndelete; /* ndelete is negative */ /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (fptr->Fptr)->heapstart, "&", &tstatus); } /* construct the new TFORM keyword for the column */ if (datacode == TBIT) strcpy(tcode,"X"); else if (datacode == TBYTE) strcpy(tcode,"B"); else if (datacode == TLOGICAL) strcpy(tcode,"L"); else if (datacode == TSTRING) strcpy(tcode,"A"); else if (datacode == TSHORT) strcpy(tcode,"I"); else if (datacode == TLONG) strcpy(tcode,"J"); else if (datacode == TLONGLONG) strcpy(tcode,"K"); else if (datacode == TFLOAT) strcpy(tcode,"E"); else if (datacode == TDOUBLE) strcpy(tcode,"D"); else if (datacode == TCOMPLEX) strcpy(tcode,"C"); else if (datacode == TDBLCOMPLEX) strcpy(tcode,"M"); /* write as a double value because the LONGLONG conversion */ /* character in sprintf is platform dependent ( %lld, %ld, %I64d ) */ sprintf(tfm,"%.0f%s",(double) newveclen, tcode); ffkeyn("TFORM", colnum, keyname, status); /* Keyword name */ ffmkys(fptr, keyname, tfm, "&", status); /* modify TFORM keyword */ ffmkyj(fptr, "NAXIS1", naxis1 + delbyte, "&", status); /* modify NAXIS1 */ ffrdef(fptr, status); /* reinitialize the new table structure */ return(*status); } /*--------------------------------------------------------------------------*/ int ffcpcl(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int incol, /* I - number of input column */ int outcol, /* I - number for output column */ int create_col, /* I - create new col if TRUE, else overwrite */ int *status) /* IO - error status */ /* copy a column from infptr and insert it in the outfptr table. */ { int tstatus, colnum, typecode, anynull; long tfields, repeat, width, nrows, outrows; long inloop, outloop, maxloop, ndone, ntodo, npixels; long firstrow, firstelem, ii; char keyname[FLEN_KEYWORD], ttype[FLEN_VALUE], tform[FLEN_VALUE]; char ttype_comm[FLEN_COMMENT],tform_comm[FLEN_COMMENT]; char *lvalues = 0, nullflag, **strarray = 0; char nulstr[] = {'\5', '\0'}; /* unique null string value */ double dnull = 0.l, *dvalues = 0; float fnull = 0., *fvalues = 0; if (*status > 0) return(*status); if (infptr->HDUposition != (infptr->Fptr)->curhdu) { ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status); } else if ((infptr->Fptr)->datastart == DATA_UNDEFINED) ffrdef(infptr, status); /* rescan header */ if (outfptr->HDUposition != (outfptr->Fptr)->curhdu) { ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status); } else if ((outfptr->Fptr)->datastart == DATA_UNDEFINED) ffrdef(outfptr, status); /* rescan header */ if (*status > 0) return(*status); if ((infptr->Fptr)->hdutype == IMAGE_HDU || (outfptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg ("Can not copy columns to or from IMAGE HDUs (ffcpcl)"); return(*status = NOT_TABLE); } if ( (infptr->Fptr)->hdutype == BINARY_TBL && (outfptr->Fptr)->hdutype == ASCII_TBL) { ffpmsg ("Copying from Binary table to ASCII table is not supported (ffcpcl)"); return(*status = NOT_BTABLE); } /* get the datatype and vector repeat length of the column */ ffgtcl(infptr, incol, &typecode, &repeat, &width, status); if (typecode < 0) { ffpmsg("Variable-length columns are not supported (ffcpcl)"); return(*status = BAD_TFORM); } if (create_col) /* insert new column in output table? */ { tstatus = 0; ffkeyn("TTYPE", incol, keyname, &tstatus); ffgkys(infptr, keyname, ttype, ttype_comm, &tstatus); ffkeyn("TFORM", incol, keyname, &tstatus); if (ffgkys(infptr, keyname, tform, tform_comm, &tstatus) ) { ffpmsg ("Could not find TTYPE and TFORM keywords in input table (ffcpcl)"); return(*status = NO_TFORM); } if ((infptr->Fptr)->hdutype == ASCII_TBL && (outfptr->Fptr)->hdutype == BINARY_TBL) { /* convert from ASCII table to BINARY table format string */ if (typecode == TSTRING) ffnkey(width, "A", tform, status); else if (typecode == TLONG) strcpy(tform, "1J"); else if (typecode == TSHORT) strcpy(tform, "1I"); else if (typecode == TFLOAT) strcpy(tform,"1E"); else if (typecode == TDOUBLE) strcpy(tform,"1D"); } if (ffgkyj(outfptr, "TFIELDS", &tfields, 0, &tstatus)) { ffpmsg ("Could not read TFIELDS keyword in output table (ffcpcl)"); return(*status = NO_TFIELDS); } colnum = minvalue((int) tfields + 1, outcol); /* output col. number */ /* create the empty column */ if (fficol(outfptr, colnum, ttype, tform, status) > 0) { ffpmsg ("Could not append new column to output file (ffcpcl)"); return(*status); } /* copy the comment strings from the input file for TTYPE and TFORM */ tstatus = 0; ffkeyn("TTYPE", colnum, keyname, &tstatus); ffmcom(outfptr, keyname, ttype_comm, &tstatus); ffkeyn("TFORM", colnum, keyname, &tstatus); ffmcom(outfptr, keyname, tform_comm, &tstatus); /* copy other column-related keywords if they exist */ ffcpky(infptr, outfptr, incol, colnum, "TUNIT", status); ffcpky(infptr, outfptr, incol, colnum, "TSCAL", status); ffcpky(infptr, outfptr, incol, colnum, "TZERO", status); ffcpky(infptr, outfptr, incol, colnum, "TDISP", status); ffcpky(infptr, outfptr, incol, colnum, "TLMIN", status); ffcpky(infptr, outfptr, incol, colnum, "TLMAX", status); ffcpky(infptr, outfptr, incol, colnum, "TDIM", status); /* WCS keywords */ ffcpky(infptr, outfptr, incol, colnum, "TCTYP", status); ffcpky(infptr, outfptr, incol, colnum, "TCUNI", status); ffcpky(infptr, outfptr, incol, colnum, "TCRVL", status); ffcpky(infptr, outfptr, incol, colnum, "TCRPX", status); ffcpky(infptr, outfptr, incol, colnum, "TCDLT", status); ffcpky(infptr, outfptr, incol, colnum, "TCROT", status); if ((infptr->Fptr)->hdutype == ASCII_TBL && (outfptr->Fptr)->hdutype == BINARY_TBL) { /* binary tables only have TNULLn keyword for integer columns */ if (typecode == TLONG || typecode == TSHORT) { /* check if null string is defined; replace with integer */ ffkeyn("TNULL", incol, keyname, &tstatus); if (ffgkys(infptr, keyname, ttype, 0, &tstatus) <= 0) { ffkeyn("TNULL", colnum, keyname, &tstatus); if (typecode == TLONG) ffpkyj(outfptr, keyname, -9999999L, "Null value", status); else ffpkyj(outfptr, keyname, -32768L, "Null value", status); } } } else { ffcpky(infptr, outfptr, incol, colnum, "TNULL", status); } /* rescan header to recognize the new keywords */ if (ffrdef(outfptr, status) ) return(*status); } else { colnum = outcol; } ffgkyj(infptr, "NAXIS2", &nrows, 0, status); /* no. of input rows */ ffgkyj(outfptr, "NAXIS2", &outrows, 0, status); /* no. of output rows */ nrows = minvalue(nrows, outrows); if (typecode == TBIT) repeat = (repeat + 7) / 8; /* convert from bits to bytes */ else if (typecode == TSTRING && (infptr->Fptr)->hdutype == BINARY_TBL) repeat = repeat / width; /* convert from chars to unit strings */ /* get optimum number of rows to copy at one time */ ffgrsz(infptr, &inloop, status); ffgrsz(outfptr, &outloop, status); /* adjust optimum number, since 2 tables are open at once */ maxloop = minvalue(inloop, outloop); /* smallest of the 2 tables */ maxloop = maxvalue(1, maxloop / 2); /* at least 1 row */ maxloop = minvalue(maxloop, nrows); /* max = nrows to be copied */ maxloop *= repeat; /* mult by no of elements in a row */ /* allocate memory for arrays */ if (typecode == TLOGICAL) { lvalues = (char *) calloc(maxloop, sizeof(char) ); if (!lvalues) { ffpmsg ("malloc failed to get memory for logicals (ffcpcl)"); return(*status = ARRAY_TOO_BIG); } } else if (typecode == TSTRING) { /* allocate array of pointers */ strarray = (char **) calloc(maxloop, sizeof(strarray)); /* allocate space for each string */ for (ii = 0; ii < maxloop; ii++) strarray[ii] = (char *) calloc(width+1, sizeof(char)); } else if (typecode == TCOMPLEX) { fvalues = (float *) calloc(maxloop * 2, sizeof(float) ); if (!fvalues) { ffpmsg ("malloc failed to get memory for complex (ffcpcl)"); return(*status = ARRAY_TOO_BIG); } fnull = 0.; } else if (typecode == TDBLCOMPLEX) { dvalues = (double *) calloc(maxloop * 2, sizeof(double) ); if (!dvalues) { ffpmsg ("malloc failed to get memory for dbl complex (ffcpcl)"); return(*status = ARRAY_TOO_BIG); } dnull = 0.; } else /* numerical datatype; read them all as doubles */ { dvalues = (double *) calloc(maxloop, sizeof(double) ); if (!dvalues) { ffpmsg ("malloc failed to get memory for doubles (ffcpcl)"); return(*status = ARRAY_TOO_BIG); } dnull = -9.99991999E31; /* use an unlikely value for nulls */ } npixels = nrows * repeat; /* total no. of pixels to copy */ ntodo = minvalue(npixels, maxloop); /* no. to copy per iteration */ ndone = 0; /* total no. of pixels that have been copied */ while (ntodo) /* iterate through the table */ { firstrow = ndone / repeat + 1; firstelem = ndone - ((firstrow - 1) * repeat) + 1; /* read from input table */ if (typecode == TLOGICAL) ffgcl(infptr, incol, firstrow, firstelem, ntodo, lvalues, status); else if (typecode == TSTRING) ffgcvs(infptr, incol, firstrow, firstelem, ntodo, nulstr, strarray, &anynull, status); else if (typecode == TCOMPLEX) ffgcvc(infptr, incol, firstrow, firstelem, ntodo, fnull, fvalues, &anynull, status); else if (typecode == TDBLCOMPLEX) ffgcvm(infptr, incol, firstrow, firstelem, ntodo, dnull, dvalues, &anynull, status); else /* all numerical types */ ffgcvd(infptr, incol, firstrow, firstelem, ntodo, dnull, dvalues, &anynull, status); if (*status > 0) { ffpmsg("Error reading input copy of column (ffcpcl)"); break; } /* write to output table */ if (typecode == TLOGICAL) { nullflag = 2; ffpcnl(outfptr, colnum, firstrow, firstelem, ntodo, lvalues, nullflag, status); } else if (typecode == TSTRING) { if (anynull) ffpcns(outfptr, colnum, firstrow, firstelem, ntodo, strarray, nulstr, status); else ffpcls(outfptr, colnum, firstrow, firstelem, ntodo, strarray, status); } else if (typecode == TCOMPLEX) { /* doesn't support writing nulls */ ffpclc(outfptr, colnum, firstrow, firstelem, ntodo, fvalues, status); } else if (typecode == TDBLCOMPLEX) { /* doesn't support writing nulls */ ffpclm(outfptr, colnum, firstrow, firstelem, ntodo, dvalues, status); } else /* all other numerical types */ { if (anynull) ffpcnd(outfptr, colnum, firstrow, firstelem, ntodo, dvalues, dnull, status); else ffpcld(outfptr, colnum, firstrow, firstelem, ntodo, dvalues, status); } if (*status > 0) { ffpmsg("Error writing output copy of column (ffcpcl)"); break; } npixels -= ntodo; ndone += ntodo; ntodo = minvalue(npixels, maxloop); } /* free the previously allocated memory */ if (typecode == TLOGICAL) { free(lvalues); } else if (typecode == TSTRING) { for (ii = 0; ii < maxloop; ii++) free(strarray[ii]); free(strarray); } else { free(dvalues); } return(*status); } /*--------------------------------------------------------------------------*/ int ffcprw(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ LONGLONG firstrow, /* I - number of first row to copy (1 based) */ LONGLONG nrows, /* I - number of rows to copy */ int *status) /* IO - error status */ /* copy consecutive set of rows from infptr and append it in the outfptr table. */ { LONGLONG innaxis1, innaxis2, outnaxis1, outnaxis2, ii, jj; unsigned char *buffer; if (*status > 0) return(*status); if (infptr->HDUposition != (infptr->Fptr)->curhdu) { ffmahd(infptr, (infptr->HDUposition) + 1, NULL, status); } else if ((infptr->Fptr)->datastart == DATA_UNDEFINED) ffrdef(infptr, status); /* rescan header */ if (outfptr->HDUposition != (outfptr->Fptr)->curhdu) { ffmahd(outfptr, (outfptr->HDUposition) + 1, NULL, status); } else if ((outfptr->Fptr)->datastart == DATA_UNDEFINED) ffrdef(outfptr, status); /* rescan header */ if (*status > 0) return(*status); if ((infptr->Fptr)->hdutype == IMAGE_HDU || (outfptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg ("Can not copy rows to or from IMAGE HDUs (ffcprw)"); return(*status = NOT_TABLE); } if ( ((infptr->Fptr)->hdutype == BINARY_TBL && (outfptr->Fptr)->hdutype == ASCII_TBL) || ((infptr->Fptr)->hdutype == ASCII_TBL && (outfptr->Fptr)->hdutype == BINARY_TBL) ) { ffpmsg ("Copying rows between Binary and ASCII tables is not supported (ffcprw)"); return(*status = NOT_BTABLE); } ffgkyjj(infptr, "NAXIS1", &innaxis1, 0, status); /* width of input rows */ ffgkyjj(infptr, "NAXIS2", &innaxis2, 0, status); /* no. of input rows */ ffgkyjj(outfptr, "NAXIS1", &outnaxis1, 0, status); /* width of output rows */ ffgkyjj(outfptr, "NAXIS2", &outnaxis2, 0, status); /* no. of output rows */ if (*status > 0) return(*status); if (outnaxis1 > innaxis1) { ffpmsg ("Input and output tables do not have same width (ffcprw)"); return(*status = BAD_ROW_WIDTH); } if (firstrow + nrows - 1 > innaxis2) { ffpmsg ("Not enough rows in input table to copy (ffcprw)"); return(*status = BAD_ROW_NUM); } /* allocate buffer to hold 1 row of data */ buffer = malloc( (size_t) innaxis1); if (!buffer) { ffpmsg ("Unable to allocate memory (ffcprw)"); return(*status = MEMORY_ALLOCATION); } /* copy the rows, 1 at a time */ jj = outnaxis2 + 1; for (ii = firstrow; ii < firstrow + nrows; ii++) { fits_read_tblbytes (infptr, ii, 1, innaxis1, buffer, status); fits_write_tblbytes(outfptr, jj, 1, innaxis1, buffer, status); jj++; } outnaxis2 += nrows; fits_update_key(outfptr, TLONGLONG, "NAXIS2", &outnaxis2, 0, status); free(buffer); return(*status); } /*--------------------------------------------------------------------------*/ int ffcpky(fitsfile *infptr, /* I - FITS file pointer to input file */ fitsfile *outfptr, /* I - FITS file pointer to output file */ int incol, /* I - input index number */ int outcol, /* I - output index number */ char *rootname, /* I - root name of the keyword to be copied */ int *status) /* IO - error status */ /* copy an indexed keyword from infptr to outfptr. */ { int tstatus = 0; char keyname[FLEN_KEYWORD]; char value[FLEN_VALUE], comment[FLEN_COMMENT], card[FLEN_CARD]; ffkeyn(rootname, incol, keyname, &tstatus); if (ffgkey(infptr, keyname, value, comment, &tstatus) <= 0) { ffkeyn(rootname, outcol, keyname, &tstatus); ffmkky(keyname, value, comment, card, status); ffprec(outfptr, card, status); } return(*status); } /*--------------------------------------------------------------------------*/ int ffdcol(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - column to delete (1 = 1st) */ int *status) /* IO - error status */ /* Delete a column from a table. */ { int ii, tstatus; LONGLONG firstbyte, size, ndelete, nbytes, naxis1, naxis2, firstcol, delbyte, freespace; LONGLONG tbcol; long nblock, nspace; char keyname[FLEN_KEYWORD], comm[FLEN_COMMENT]; tcolumn *colptr, *nextcol; if (*status > 0) return(*status); if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->hdutype == IMAGE_HDU) { ffpmsg ("Can only delete column from TABLE or BINTABLE extension (ffdcol)"); return(*status = NOT_TABLE); } if (colnum < 1 || colnum > (fptr->Fptr)->tfield ) return(*status = BAD_COL_NUM); colptr = (fptr->Fptr)->tableptr; colptr += (colnum - 1); firstcol = colptr->tbcol; /* starting byte position of the column */ /* use column width to determine how many bytes to delete in each row */ if ((fptr->Fptr)->hdutype == ASCII_TBL) { delbyte = colptr->twidth; /* width of ASCII column */ if (colnum < (fptr->Fptr)->tfield) /* check for space between next column */ { nextcol = colptr + 1; nspace = (long) ((nextcol->tbcol) - (colptr->tbcol) - delbyte); if (nspace > 0) delbyte++; } else if (colnum > 1) /* check for space between last 2 columns */ { nextcol = colptr - 1; nspace = (long) ((colptr->tbcol) - (nextcol->tbcol) - (nextcol->twidth)); if (nspace > 0) { delbyte++; firstcol--; /* delete the leading space */ } } } else /* a binary table */ { if (colnum < (fptr->Fptr)->tfield) { nextcol = colptr + 1; delbyte = (nextcol->tbcol) - (colptr->tbcol); } else { delbyte = ((fptr->Fptr)->rowlength) - (colptr->tbcol); } } naxis1 = (fptr->Fptr)->rowlength; /* current width of the table */ naxis2 = (fptr->Fptr)->numrows; /* current size of table */ size = (fptr->Fptr)->heapstart + (fptr->Fptr)->heapsize; freespace = ((LONGLONG)delbyte * naxis2) + ((size + 2879) / 2880) * 2880 - size; nblock = (long) (freespace / 2880); /* number of empty blocks to delete */ ffcdel(fptr, naxis1, naxis2, delbyte, firstcol, status); /* delete col */ /* absolute heap position */ firstbyte = (fptr->Fptr)->datastart + (fptr->Fptr)->heapstart; ndelete = (LONGLONG)delbyte * naxis2; /* size of shift */ /* shift heap up (if it exists) */ if ((fptr->Fptr)->heapsize > 0) { nbytes = (fptr->Fptr)->heapsize; /* no. of bytes to shift up */ if (ffshft(fptr, firstbyte, nbytes, -ndelete, status) > 0) /* mv heap */ return(*status); } /* delete the empty blocks at the end of the HDU */ if (nblock > 0) ffdblk(fptr, nblock, status); /* update the heap starting address */ (fptr->Fptr)->heapstart -= ndelete; /* update the THEAP keyword if it exists */ tstatus = 0; ffmkyj(fptr, "THEAP", (long)(fptr->Fptr)->heapstart, "&", &tstatus); if ((fptr->Fptr)->hdutype == ASCII_TBL) { /* adjust the TBCOL values of the remaining columns */ for (ii = 1; ii <= (fptr->Fptr)->tfield; ii++) { ffkeyn("TBCOL", ii, keyname, status); ffgkyjj(fptr, keyname, &tbcol, comm, status); if (tbcol > firstcol) { tbcol = tbcol - delbyte; ffmkyj(fptr, keyname, tbcol, "&", status); } } } /* update the mandatory keywords */ ffmkyj(fptr, "TFIELDS", ((fptr->Fptr)->tfield) - 1, "&", status); ffmkyj(fptr, "NAXIS1", naxis1 - delbyte, "&", status); /* delete the index keywords starting with 'T' associated with the deleted column and subtract 1 from index of all higher keywords */ ffkshf(fptr, colnum, (fptr->Fptr)->tfield, -1, status); ffrdef(fptr, status); /* initialize the new table structure */ return(*status); } /*--------------------------------------------------------------------------*/ int ffcins(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis1, /* I - width of the table, in bytes */ LONGLONG naxis2, /* I - number of rows in the table */ LONGLONG ninsert, /* I - number of bytes to insert in each row */ LONGLONG bytepos, /* I - rel. position in row to insert bytes */ int *status) /* IO - error status */ /* Insert 'ninsert' bytes into each row of the table at position 'bytepos'. */ { unsigned char buffer[10000], cfill; LONGLONG newlen, fbyte, nbytes, irow, nseg, ii; if (*status > 0) return(*status); if (naxis2 == 0) return(*status); /* just return if there are 0 rows in the table */ /* select appropriate fill value */ if ((fptr->Fptr)->hdutype == ASCII_TBL) cfill = 32; /* ASCII tables use blank fill */ else cfill = 0; /* primary array and binary tables use zero fill */ newlen = naxis1 + ninsert; if (newlen <= 10000) { /******************************************************************* CASE #1: optimal case where whole new row fits in the work buffer *******************************************************************/ for (ii = 0; ii < ninsert; ii++) buffer[ii] = cfill; /* initialize buffer with fill value */ /* first move the trailing bytes (if any) in the last row */ fbyte = bytepos + 1; nbytes = naxis1 - bytepos; ffgtbb(fptr, naxis2, fbyte, nbytes, &buffer[ninsert], status); (fptr->Fptr)->rowlength = newlen; /* new row length */ /* write the row (with leading fill bytes) in the new place */ nbytes += ninsert; ffptbb(fptr, naxis2, fbyte, nbytes, buffer, status); (fptr->Fptr)->rowlength = naxis1; /* reset to orig. value */ /* now move the rest of the rows */ for (irow = naxis2 - 1; irow > 0; irow--) { /* read the row to be shifted (work backwards thru the table) */ ffgtbb(fptr, irow, fbyte, naxis1, &buffer[ninsert], status); (fptr->Fptr)->rowlength = newlen; /* new row length */ /* write the row (with the leading fill bytes) in the new place */ ffptbb(fptr, irow, fbyte, newlen, buffer, status); (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ } } else { /***************************************************************** CASE #2: whole row doesn't fit in work buffer; move row in pieces ****************************************************************** first copy the data, then go back and write fill into the new column start by copying the trailing bytes (if any) in the last row. */ nbytes = naxis1 - bytepos; nseg = (nbytes + 9999) / 10000; fbyte = (nseg - 1) * 10000 + bytepos + 1; nbytes = naxis1 - fbyte + 1; for (ii = 0; ii < nseg; ii++) { ffgtbb(fptr, naxis2, fbyte, nbytes, buffer, status); (fptr->Fptr)->rowlength = newlen; /* new row length */ ffptbb(fptr, naxis2, fbyte + ninsert, nbytes, buffer, status); (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ fbyte -= 10000; nbytes = 10000; } /* now move the rest of the rows */ nseg = (naxis1 + 9999) / 10000; for (irow = naxis2 - 1; irow > 0; irow--) { fbyte = (nseg - 1) * 10000 + bytepos + 1; nbytes = naxis1 - (nseg - 1) * 10000; for (ii = 0; ii < nseg; ii++) { /* read the row to be shifted (work backwards thru the table) */ ffgtbb(fptr, irow, fbyte, nbytes, buffer, status); (fptr->Fptr)->rowlength = newlen; /* new row length */ /* write the row in the new place */ ffptbb(fptr, irow, fbyte + ninsert, nbytes, buffer, status); (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ fbyte -= 10000; nbytes = 10000; } } /* now write the fill values into the new column */ nbytes = minvalue(ninsert, 10000); memset(buffer, cfill, (size_t) nbytes); /* initialize with fill value */ nseg = (ninsert + 9999) / 10000; (fptr->Fptr)->rowlength = newlen; /* new row length */ for (irow = 1; irow <= naxis2; irow++) { fbyte = bytepos + 1; nbytes = ninsert - ((nseg - 1) * 10000); for (ii = 0; ii < nseg; ii++) { ffptbb(fptr, irow, fbyte, nbytes, buffer, status); fbyte += nbytes; nbytes = 10000; } } (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ } return(*status); } /*--------------------------------------------------------------------------*/ int ffcdel(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG naxis1, /* I - width of the table, in bytes */ LONGLONG naxis2, /* I - number of rows in the table */ LONGLONG ndelete, /* I - number of bytes to delete in each row */ LONGLONG bytepos, /* I - rel. position in row to delete bytes */ int *status) /* IO - error status */ /* delete 'ndelete' bytes from each row of the table at position 'bytepos'. */ { unsigned char buffer[10000]; LONGLONG i1, i2, ii, irow, nseg; LONGLONG newlen, remain, nbytes; if (*status > 0) return(*status); if (naxis2 == 0) return(*status); /* just return if there are 0 rows in the table */ newlen = naxis1 - ndelete; if (newlen <= 10000) { /******************************************************************* CASE #1: optimal case where whole new row fits in the work buffer *******************************************************************/ i1 = bytepos + 1; i2 = i1 + ndelete; for (irow = 1; irow < naxis2; irow++) { ffgtbb(fptr, irow, i2, newlen, buffer, status); /* read row */ (fptr->Fptr)->rowlength = newlen; /* new row length */ ffptbb(fptr, irow, i1, newlen, buffer, status); /* write row */ (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ } /* now do the last row */ remain = naxis1 - (bytepos + ndelete); if (remain > 0) { ffgtbb(fptr, naxis2, i2, remain, buffer, status); /* read row */ (fptr->Fptr)->rowlength = newlen; /* new row length */ ffptbb(fptr, naxis2, i1, remain, buffer, status); /* write row */ (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ } } else { /***************************************************************** CASE #2: whole row doesn't fit in work buffer; move row in pieces ******************************************************************/ nseg = (newlen + 9999) / 10000; for (irow = 1; irow < naxis2; irow++) { i1 = bytepos + 1; i2 = i1 + ndelete; nbytes = newlen - (nseg - 1) * 10000; for (ii = 0; ii < nseg; ii++) { ffgtbb(fptr, irow, i2, nbytes, buffer, status); /* read bytes */ (fptr->Fptr)->rowlength = newlen; /* new row length */ ffptbb(fptr, irow, i1, nbytes, buffer, status); /* rewrite bytes */ (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ i1 += nbytes; i2 += nbytes; nbytes = 10000; } } /* now do the last row */ remain = naxis1 - (bytepos + ndelete); if (remain > 0) { nseg = (remain + 9999) / 10000; i1 = bytepos + 1; i2 = i1 + ndelete; nbytes = remain - (nseg - 1) * 10000; for (ii = 0; ii < nseg; ii++) { ffgtbb(fptr, naxis2, i2, nbytes, buffer, status); (fptr->Fptr)->rowlength = newlen; /* new row length */ ffptbb(fptr, naxis2, i1, nbytes, buffer, status); /* write row */ (fptr->Fptr)->rowlength = naxis1; /* reset to orig value */ i1 += nbytes; i2 += nbytes; nbytes = 10000; } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffkshf(fitsfile *fptr, /* I - FITS file pointer */ int colmin, /* I - starting col. to be incremented; 1 = 1st */ int colmax, /* I - last column to be incremented */ int incre, /* I - shift index number by this amount */ int *status) /* IO - error status */ /* shift the index value on any existing column keywords This routine will modify the name of any keyword that begins with 'T' and has an index number in the range COLMIN - COLMAX, inclusive. if incre is positive, then the index values will be incremented. if incre is negative, then the kewords with index = COLMIN will be deleted and the index of higher numbered keywords will be decremented. */ { int nkeys, nmore, nrec, tstatus, i1; long ivalue; char rec[FLEN_CARD], q[FLEN_KEYWORD], newkey[FLEN_KEYWORD]; ffghsp(fptr, &nkeys, &nmore, status); /* get number of keywords */ /* go thru header starting with the 9th keyword looking for 'TxxxxNNN' */ for (nrec = 9; nrec <= nkeys; nrec++) { ffgrec(fptr, nrec, rec, status); if (rec[0] == 'T') { i1 = 0; strncpy(q, &rec[1], 4); if (!strncmp(q, "BCOL", 4) || !strncmp(q, "FORM", 4) || !strncmp(q, "TYPE", 4) || !strncmp(q, "SCAL", 4) || !strncmp(q, "UNIT", 4) || !strncmp(q, "NULL", 4) || !strncmp(q, "ZERO", 4) || !strncmp(q, "DISP", 4) || !strncmp(q, "LMIN", 4) || !strncmp(q, "LMAX", 4) || !strncmp(q, "DMIN", 4) || !strncmp(q, "DMAX", 4) || !strncmp(q, "CTYP", 4) || !strncmp(q, "CRPX", 4) || !strncmp(q, "CRVL", 4) || !strncmp(q, "CDLT", 4) || !strncmp(q, "CROT", 4) || !strncmp(q, "CUNI", 4) ) i1 = 5; else if (!strncmp(rec, "TDIM", 4) ) i1 = 4; if (i1) { /* try reading the index number suffix */ q[0] = '\0'; strncat(q, &rec[i1], 8 - i1); tstatus = 0; ffc2ii(q, &ivalue, &tstatus); if (tstatus == 0 && ivalue >= colmin && ivalue <= colmax) { if (incre <= 0 && ivalue == colmin) { ffdrec(fptr, nrec, status); /* delete keyword */ nkeys = nkeys - 1; nrec = nrec - 1; } else { ivalue = ivalue + incre; q[0] = '\0'; strncat(q, rec, i1); ffkeyn(q, ivalue, newkey, status); strncpy(rec, " ", 8); /* erase old keyword name */ i1 = strlen(newkey); strncpy(rec, newkey, i1); /* overwrite new keyword name */ ffmrec(fptr, nrec, rec, status); /* modify the record */ } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffshft(fitsfile *fptr, /* I - FITS file pointer */ LONGLONG firstbyte, /* I - position of first byte in block to shift */ LONGLONG nbytes, /* I - size of block of bytes to shift */ LONGLONG nshift, /* I - size of shift in bytes (+ or -) */ int *status) /* IO - error status */ /* Shift block of bytes by nshift bytes (positive or negative). A positive nshift value moves the block down further in the file, while a negative value shifts the block towards the beginning of the file. */ { #define shftbuffsize 100000 long ntomov; LONGLONG ptr, ntodo; char buffer[shftbuffsize]; if (*status > 0) return(*status); ntodo = nbytes; /* total number of bytes to shift */ if (nshift > 0) /* start at the end of the block and work backwards */ ptr = firstbyte + nbytes; else /* start at the beginning of the block working forwards */ ptr = firstbyte; while (ntodo) { /* number of bytes to move at one time */ ntomov = (long) (minvalue(ntodo, shftbuffsize)); if (nshift > 0) /* if moving block down ... */ ptr -= ntomov; /* move to position and read the bytes to be moved */ ffmbyt(fptr, ptr, REPORT_EOF, status); ffgbyt(fptr, ntomov, buffer, status); /* move by shift amount and write the bytes */ ffmbyt(fptr, ptr + nshift, IGNORE_EOF, status); if (ffpbyt(fptr, ntomov, buffer, status) > 0) { ffpmsg("Error while shifting block (ffshft)"); return(*status); } ntodo -= ntomov; if (nshift < 0) /* if moving block up ... */ ptr += ntomov; } /* now overwrite the old data with fill */ if ((fptr->Fptr)->hdutype == ASCII_TBL) memset(buffer, 32, shftbuffsize); /* fill ASCII tables with spaces */ else memset(buffer, 0, shftbuffsize); /* fill other HDUs with zeros */ if (nshift < 0) { ntodo = -nshift; /* point to the end of the shifted block */ ptr = firstbyte + nbytes + nshift; } else { ntodo = nshift; /* point to original beginning of the block */ ptr = firstbyte; } ffmbyt(fptr, ptr, REPORT_EOF, status); while (ntodo) { ntomov = (long) (minvalue(ntodo, shftbuffsize)); ffpbyt(fptr, ntomov, buffer, status); ntodo -= ntomov; } return(*status); } astropy-0.3/cextern/cfitsio/quantize.c0000644000175000017500000034726012243255342016327 0ustar oleole/* The following code is based on algorithms written by Richard White at STScI and made available for use in CFITSIO in July 1999 and updated in January 2008. */ # include # include # include # include # include #include "fitsio2.h" /* nearest integer function */ # define NINT(x) ((x >= 0.) ? (int) (x + 0.5) : (int) (x - 0.5)) #define NULL_VALUE -2147483647 /* value used to represent undefined pixels */ #define ZERO_VALUE -2147483646 /* value used to represent zero-valued pixels */ #define N_RESERVED_VALUES 10 /* number of reserved values, starting with */ /* and including NULL_VALUE. These values */ /* may not be used to represent the quantized */ /* and scaled floating point pixel values */ /* If lossy Hcompression is used, and the */ /* array contains null values, then it is also */ /* possible for the compressed values to slightly */ /* exceed the range of the actual (lossless) values */ /* so we must reserve a little more space */ /* more than this many standard deviations from the mean is an outlier */ # define SIGMA_CLIP 5. # define NITER 3 /* number of sigma-clipping iterations */ static int FnMeanSigma_short(short *array, long npix, int nullcheck, short nullvalue, long *ngoodpix, double *mean, double *sigma, int *status); static int FnMeanSigma_int(int *array, long npix, int nullcheck, int nullvalue, long *ngoodpix, double *mean, double *sigma, int *status); static int FnMeanSigma_float(float *array, long npix, int nullcheck, float nullvalue, long *ngoodpix, double *mean, double *sigma, int *status); static int FnMeanSigma_double(double *array, long npix, int nullcheck, double nullvalue, long *ngoodpix, double *mean, double *sigma, int *status); static int FnNoise5_short(short *array, long nx, long ny, int nullcheck, short nullvalue, long *ngood, short *minval, short *maxval, double *n2, double *n3, double *n5, int *status); static int FnNoise5_int(int *array, long nx, long ny, int nullcheck, int nullvalue, long *ngood, int *minval, int *maxval, double *n2, double *n3, double *n5, int *status); static int FnNoise5_float(float *array, long nx, long ny, int nullcheck, float nullvalue, long *ngood, float *minval, float *maxval, double *n2, double *n3, double *n5, int *status); static int FnNoise5_double(double *array, long nx, long ny, int nullcheck, double nullvalue, long *ngood, double *minval, double *maxval, double *n2, double *n3, double *n5, int *status); static int FnNoise3_short(short *array, long nx, long ny, int nullcheck, short nullvalue, long *ngood, short *minval, short *maxval, double *noise, int *status); static int FnNoise3_int(int *array, long nx, long ny, int nullcheck, int nullvalue, long *ngood, int *minval, int *maxval, double *noise, int *status); static int FnNoise3_float(float *array, long nx, long ny, int nullcheck, float nullvalue, long *ngood, float *minval, float *maxval, double *noise, int *status); static int FnNoise3_double(double *array, long nx, long ny, int nullcheck, double nullvalue, long *ngood, double *minval, double *maxval, double *noise, int *status); static int FnNoise1_short(short *array, long nx, long ny, int nullcheck, short nullvalue, double *noise, int *status); static int FnNoise1_int(int *array, long nx, long ny, int nullcheck, int nullvalue, double *noise, int *status); static int FnNoise1_float(float *array, long nx, long ny, int nullcheck, float nullvalue, double *noise, int *status); static int FnNoise1_double(double *array, long nx, long ny, int nullcheck, double nullvalue, double *noise, int *status); static int FnCompare_short (const void *, const void *); static int FnCompare_int (const void *, const void *); static int FnCompare_float (const void *, const void *); static int FnCompare_double (const void *, const void *); static float quick_select_float(float arr[], int n); static short quick_select_short(short arr[], int n); static int quick_select_int(int arr[], int n); static LONGLONG quick_select_longlong(LONGLONG arr[], int n); static double quick_select_double(double arr[], int n); /*---------------------------------------------------------------------------*/ int fits_quantize_float (long row, float fdata[], long nxpix, long nypix, int nullcheck, float in_null_value, float qlevel, int dither_method, int idata[], double *bscale, double *bzero, int *iminval, int *imaxval) { /* arguments: long row i: if positive, used to calculate random dithering seed value (this is only used when dithering the quantized values) float fdata[] i: array of image pixels to be compressed long nxpix i: number of pixels in each row of fdata long nypix i: number of rows in fdata nullcheck i: check for nullvalues in fdata? float in_null_value i: value used to represent undefined pixels in fdata float qlevel i: quantization level int dither_method i; which dithering method to use int idata[] o: values of fdata after applying bzero and bscale double bscale o: scale factor double bzero o: zero offset int iminval o: minimum quantized value that is returned int imaxval o: maximum quantized value that is returned The function value will be one if the input fdata were copied to idata; in this case the parameters bscale and bzero can be used to convert back to nearly the original floating point values: fdata ~= idata * bscale + bzero. If the function value is zero, the data were not copied to idata. */ int status, anynulls = 0, iseed; long i, nx, ngood = 0; double stdev, noise2, noise3, noise5; /* MAD 2nd, 3rd, and 5th order noise values */ float minval = 0., maxval = 0.; /* min & max of fdata */ double delta; /* bscale, 1 in idata = delta in fdata */ double zeropt; /* bzero */ double temp; int nextrand = 0; extern float *fits_rand_value; /* this is defined in imcompress.c */ LONGLONG iqfactor; nx = nxpix * nypix; if (nx <= 1) { *bscale = 1.; *bzero = 0.; return (0); } if (qlevel >= 0.) { /* estimate background noise using MAD pixel differences */ FnNoise5_float(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood, &minval, &maxval, &noise2, &noise3, &noise5, &status); if (nullcheck && ngood == 0) { /* special case of an image filled with Nulls */ /* set parameters to dummy values, which are not used */ minval = 0.; maxval = 1.; stdev = 1; } else { /* use the minimum of noise2, noise3, and noise5 as the best noise value */ stdev = noise3; if (noise2 != 0. && noise2 < stdev) stdev = noise2; if (noise5 != 0. && noise5 < stdev) stdev = noise5; } if (qlevel == 0.) delta = stdev / 4.; /* default quantization */ else delta = stdev / qlevel; if (delta == 0.) return (0); /* don't quantize */ } else { /* negative value represents the absolute quantization level */ delta = -qlevel; /* only nned to calculate the min and max values */ FnNoise3_float(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood, &minval, &maxval, 0, &status); } /* check that the range of quantized levels is not > range of int */ if ((maxval - minval) / delta > 2. * 2147483647. - N_RESERVED_VALUES ) return (0); /* don't quantize */ if (row > 0) { /* we need to dither the quantized values */ if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500.); } if (ngood == nx) { /* don't have to check for nulls */ /* return all positive values, if possible since some */ /* compression algorithms either only work for positive integers, */ /* or are more efficient. */ if (dither_method == SUBTRACTIVE_DITHER_2) { /* shift the range to be close to the value used to represent zeros */ zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES); } else if ((maxval - minval) / delta < 2147483647. - N_RESERVED_VALUES ) { zeropt = minval; /* fudge the zero point so it is an integer multiple of delta */ /* This helps to ensure the same scaling will be performed if the */ /* file undergoes multiple fpack/funpack cycles */ iqfactor = (LONGLONG) (zeropt/delta + 0.5); zeropt = iqfactor * delta; } else { /* center the quantized levels around zero */ zeropt = (minval + maxval) / 2.; } if (row > 0) { /* dither the values when quantizing */ for (i = 0; i < nx; i++) { if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) { idata[i] = ZERO_VALUE; } else { idata[i] = NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5); } nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else { /* do not dither the values */ for (i = 0; i < nx; i++) { idata[i] = NINT ((fdata[i] - zeropt) / delta); } } } else { /* data contains null values; shift the range to be */ /* close to the value used to represent null values */ zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES); if (row > 0) { /* dither the values */ for (i = 0; i < nx; i++) { if (fdata[i] != in_null_value) { if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) { idata[i] = ZERO_VALUE; } else { idata[i] = NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5); } } else { idata[i] = NULL_VALUE; } /* increment the random number index, regardless */ nextrand++; if (nextrand == N_RANDOM) { iseed++; if (iseed == N_RANDOM) iseed = 0; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else { /* do not dither the values */ for (i = 0; i < nx; i++) { if (fdata[i] != in_null_value) { idata[i] = NINT((fdata[i] - zeropt) / delta); } else { idata[i] = NULL_VALUE; } } } } /* calc min and max values */ temp = (minval - zeropt) / delta; *iminval = NINT (temp); temp = (maxval - zeropt) / delta; *imaxval = NINT (temp); *bscale = delta; *bzero = zeropt; return (1); /* yes, data have been quantized */ } /*---------------------------------------------------------------------------*/ int fits_quantize_double (long row, double fdata[], long nxpix, long nypix, int nullcheck, double in_null_value, float qlevel, int dither_method, int idata[], double *bscale, double *bzero, int *iminval, int *imaxval) { /* arguments: long row i: tile number = row number in the binary table double fdata[] i: array of image pixels to be compressed long nxpix i: number of pixels in each row of fdata long nypix i: number of rows in fdata nullcheck i: check for nullvalues in fdata? double in_null_value i: value used to represent undefined pixels in fdata float qlevel i: quantization level int dither_method i; which dithering method to use int idata[] o: values of fdata after applying bzero and bscale double bscale o: scale factor double bzero o: zero offset int iminval o: minimum quantized value that is returned int imaxval o: maximum quantized value that is returned The function value will be one if the input fdata were copied to idata; in this case the parameters bscale and bzero can be used to convert back to nearly the original floating point values: fdata ~= idata * bscale + bzero. If the function value is zero, the data were not copied to idata. */ int status, anynulls = 0, iseed; long i, nx, ngood = 0; double stdev, noise2, noise3, noise5; /* MAD 2nd, 3rd, and 5th order noise values */ double minval = 0., maxval = 0.; /* min & max of fdata */ double delta; /* bscale, 1 in idata = delta in fdata */ double zeropt; /* bzero */ double temp; int nextrand = 0; extern float *fits_rand_value; LONGLONG iqfactor; nx = nxpix * nypix; if (nx <= 1) { *bscale = 1.; *bzero = 0.; return (0); } if (qlevel >= 0.) { /* estimate background noise using MAD pixel differences */ FnNoise5_double(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood, &minval, &maxval, &noise2, &noise3, &noise5, &status); if (nullcheck && ngood == 0) { /* special case of an image filled with Nulls */ /* set parameters to dummy values, which are not used */ minval = 0.; maxval = 1.; stdev = 1; } else { /* use the minimum of noise2, noise3, and noise5 as the best noise value */ stdev = noise3; if (noise2 != 0. && noise2 < stdev) stdev = noise2; if (noise5 != 0. && noise5 < stdev) stdev = noise5; } if (qlevel == 0.) delta = stdev / 4.; /* default quantization */ else delta = stdev / qlevel; if (delta == 0.) return (0); /* don't quantize */ } else { /* negative value represents the absolute quantization level */ delta = -qlevel; /* only nned to calculate the min and max values */ FnNoise3_double(fdata, nxpix, nypix, nullcheck, in_null_value, &ngood, &minval, &maxval, 0, &status); } /* check that the range of quantized levels is not > range of int */ if ((maxval - minval) / delta > 2. * 2147483647. - N_RESERVED_VALUES ) return (0); /* don't quantize */ if (row > 0) { /* we need to dither the quantized values */ if (!fits_rand_value) if (fits_init_randoms()) return(MEMORY_ALLOCATION); /* initialize the index to the next random number in the list */ iseed = (int) ((row - 1) % N_RANDOM); nextrand = (int) (fits_rand_value[iseed] * 500); } if (ngood == nx) { /* don't have to check for nulls */ /* return all positive values, if possible since some */ /* compression algorithms either only work for positive integers, */ /* or are more efficient. */ if (dither_method == SUBTRACTIVE_DITHER_2) { /* shift the range to be close to the value used to represent zeros */ zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES); } else if ((maxval - minval) / delta < 2147483647. - N_RESERVED_VALUES ) { zeropt = minval; /* fudge the zero point so it is an integer multiple of delta */ /* This helps to ensure the same scaling will be performed if the */ /* file undergoes multiple fpack/funpack cycles */ iqfactor = (LONGLONG) (zeropt/delta + 0.5); zeropt = iqfactor * delta; } else { /* center the quantized levels around zero */ zeropt = (minval + maxval) / 2.; } if (row > 0) { /* dither the values when quantizing */ for (i = 0; i < nx; i++) { if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) { idata[i] = ZERO_VALUE; } else { idata[i] = NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5); } nextrand++; if (nextrand == N_RANDOM) { iseed++; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else { /* do not dither the values */ for (i = 0; i < nx; i++) { idata[i] = NINT ((fdata[i] - zeropt) / delta); } } } else { /* data contains null values; shift the range to be */ /* close to the value used to represent null values */ zeropt = minval - delta * (NULL_VALUE + N_RESERVED_VALUES); if (row > 0) { /* dither the values */ for (i = 0; i < nx; i++) { if (fdata[i] != in_null_value) { if (dither_method == SUBTRACTIVE_DITHER_2 && fdata[i] == 0.0) { idata[i] = ZERO_VALUE; } else { idata[i] = NINT((((double) fdata[i] - zeropt) / delta) + fits_rand_value[nextrand] - 0.5); } } else { idata[i] = NULL_VALUE; } /* increment the random number index, regardless */ nextrand++; if (nextrand == N_RANDOM) { iseed++; nextrand = (int) (fits_rand_value[iseed] * 500); } } } else { /* do not dither the values */ for (i = 0; i < nx; i++) { if (fdata[i] != in_null_value) idata[i] = NINT((fdata[i] - zeropt) / delta); else idata[i] = NULL_VALUE; } } } /* calc min and max values */ temp = (minval - zeropt) / delta; *iminval = NINT (temp); temp = (maxval - zeropt) / delta; *imaxval = NINT (temp); *bscale = delta; *bzero = zeropt; return (1); /* yes, data have been quantized */ } /*--------------------------------------------------------------------------*/ int fits_img_stats_short(short *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ /* (if this is a 3D image, then ny should be the */ /* product of the no. of rows times the no. of planes) */ int nullcheck, /* check for null values, if true */ short nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters (if the pointer is not null) */ long *ngoodpix, /* number of non-null pixels in the image */ short *minvalue, /* returned minimum non-null value in the array */ short *maxvalue, /* returned maximum non-null value in the array */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ double *noise1, /* 1st order estimate of noise in image background level */ double *noise2, /* 2nd order estimate of noise in image background level */ double *noise3, /* 3rd order estimate of noise in image background level */ double *noise5, /* 5th order estimate of noise in image background level */ int *status) /* error status */ /* Compute statistics of the input short integer image. */ { long ngood; short minval, maxval; double xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.; /* need to calculate mean and/or sigma and/or limits? */ if (mean || sigma ) { FnMeanSigma_short(array, nx * ny, nullcheck, nullvalue, &ngood, &xmean, &xsigma, status); if (ngoodpix) *ngoodpix = ngood; if (mean) *mean = xmean; if (sigma) *sigma = xsigma; } if (noise1) { FnNoise1_short(array, nx, ny, nullcheck, nullvalue, &xnoise, status); *noise1 = xnoise; } if (minvalue || maxvalue || noise3) { FnNoise5_short(array, nx, ny, nullcheck, nullvalue, &ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status); if (ngoodpix) *ngoodpix = ngood; if (minvalue) *minvalue= minval; if (maxvalue) *maxvalue = maxval; if (noise2) *noise2 = xnoise2; if (noise3) *noise3 = xnoise3; if (noise5) *noise5 = xnoise5; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_img_stats_int(int *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ /* (if this is a 3D image, then ny should be the */ /* product of the no. of rows times the no. of planes) */ int nullcheck, /* check for null values, if true */ int nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters (if the pointer is not null) */ long *ngoodpix, /* number of non-null pixels in the image */ int *minvalue, /* returned minimum non-null value in the array */ int *maxvalue, /* returned maximum non-null value in the array */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ double *noise1, /* 1st order estimate of noise in image background level */ double *noise2, /* 2nd order estimate of noise in image background level */ double *noise3, /* 3rd order estimate of noise in image background level */ double *noise5, /* 5th order estimate of noise in image background level */ int *status) /* error status */ /* Compute statistics of the input integer image. */ { long ngood; int minval, maxval; double xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.; /* need to calculate mean and/or sigma and/or limits? */ if (mean || sigma ) { FnMeanSigma_int(array, nx * ny, nullcheck, nullvalue, &ngood, &xmean, &xsigma, status); if (ngoodpix) *ngoodpix = ngood; if (mean) *mean = xmean; if (sigma) *sigma = xsigma; } if (noise1) { FnNoise1_int(array, nx, ny, nullcheck, nullvalue, &xnoise, status); *noise1 = xnoise; } if (minvalue || maxvalue || noise3) { FnNoise5_int(array, nx, ny, nullcheck, nullvalue, &ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status); if (ngoodpix) *ngoodpix = ngood; if (minvalue) *minvalue= minval; if (maxvalue) *maxvalue = maxval; if (noise2) *noise2 = xnoise2; if (noise3) *noise3 = xnoise3; if (noise5) *noise5 = xnoise5; } return(*status); } /*--------------------------------------------------------------------------*/ int fits_img_stats_float(float *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ /* (if this is a 3D image, then ny should be the */ /* product of the no. of rows times the no. of planes) */ int nullcheck, /* check for null values, if true */ float nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters (if the pointer is not null) */ long *ngoodpix, /* number of non-null pixels in the image */ float *minvalue, /* returned minimum non-null value in the array */ float *maxvalue, /* returned maximum non-null value in the array */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ double *noise1, /* 1st order estimate of noise in image background level */ double *noise2, /* 2nd order estimate of noise in image background level */ double *noise3, /* 3rd order estimate of noise in image background level */ double *noise5, /* 5th order estimate of noise in image background level */ int *status) /* error status */ /* Compute statistics of the input float image. */ { long ngood; float minval, maxval; double xmean = 0., xsigma = 0., xnoise = 0., xnoise2 = 0., xnoise3 = 0., xnoise5 = 0.; /* need to calculate mean and/or sigma and/or limits? */ if (mean || sigma ) { FnMeanSigma_float(array, nx * ny, nullcheck, nullvalue, &ngood, &xmean, &xsigma, status); if (ngoodpix) *ngoodpix = ngood; if (mean) *mean = xmean; if (sigma) *sigma = xsigma; } if (noise1) { FnNoise1_float(array, nx, ny, nullcheck, nullvalue, &xnoise, status); *noise1 = xnoise; } if (minvalue || maxvalue || noise3) { FnNoise5_float(array, nx, ny, nullcheck, nullvalue, &ngood, &minval, &maxval, &xnoise2, &xnoise3, &xnoise5, status); if (ngoodpix) *ngoodpix = ngood; if (minvalue) *minvalue= minval; if (maxvalue) *maxvalue = maxval; if (noise2) *noise2 = xnoise2; if (noise3) *noise3 = xnoise3; if (noise5) *noise5 = xnoise5; } return(*status); } /*--------------------------------------------------------------------------*/ static int FnMeanSigma_short (short *array, /* 2 dimensional array of image pixels */ long npix, /* number of pixels in the image */ int nullcheck, /* check for null values, if true */ short nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngoodpix, /* number of non-null pixels in the image */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Compute mean and RMS sigma of the non-null pixels in the input array. */ { long ii, ngood = 0; short *value; double sum = 0., sum2 = 0., xtemp; value = array; if (nullcheck) { for (ii = 0; ii < npix; ii++, value++) { if (*value != nullvalue) { ngood++; xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } } else { ngood = npix; for (ii = 0; ii < npix; ii++, value++) { xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } if (ngood > 1) { if (ngoodpix) *ngoodpix = ngood; xtemp = sum / ngood; if (mean) *mean = xtemp; if (sigma) *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp)); } else if (ngood == 1){ if (ngoodpix) *ngoodpix = 1; if (mean) *mean = sum; if (sigma) *sigma = 0.0; } else { if (ngoodpix) *ngoodpix = 0; if (mean) *mean = 0.; if (sigma) *sigma = 0.; } return(*status); } /*--------------------------------------------------------------------------*/ static int FnMeanSigma_int (int *array, /* 2 dimensional array of image pixels */ long npix, /* number of pixels in the image */ int nullcheck, /* check for null values, if true */ int nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngoodpix, /* number of non-null pixels in the image */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Compute mean and RMS sigma of the non-null pixels in the input array. */ { long ii, ngood = 0; int *value; double sum = 0., sum2 = 0., xtemp; value = array; if (nullcheck) { for (ii = 0; ii < npix; ii++, value++) { if (*value != nullvalue) { ngood++; xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } } else { ngood = npix; for (ii = 0; ii < npix; ii++, value++) { xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } if (ngood > 1) { if (ngoodpix) *ngoodpix = ngood; xtemp = sum / ngood; if (mean) *mean = xtemp; if (sigma) *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp)); } else if (ngood == 1){ if (ngoodpix) *ngoodpix = 1; if (mean) *mean = sum; if (sigma) *sigma = 0.0; } else { if (ngoodpix) *ngoodpix = 0; if (mean) *mean = 0.; if (sigma) *sigma = 0.; } return(*status); } /*--------------------------------------------------------------------------*/ static int FnMeanSigma_float (float *array, /* 2 dimensional array of image pixels */ long npix, /* number of pixels in the image */ int nullcheck, /* check for null values, if true */ float nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngoodpix, /* number of non-null pixels in the image */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Compute mean and RMS sigma of the non-null pixels in the input array. */ { long ii, ngood = 0; float *value; double sum = 0., sum2 = 0., xtemp; value = array; if (nullcheck) { for (ii = 0; ii < npix; ii++, value++) { if (*value != nullvalue) { ngood++; xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } } else { ngood = npix; for (ii = 0; ii < npix; ii++, value++) { xtemp = (double) *value; sum += xtemp; sum2 += (xtemp * xtemp); } } if (ngood > 1) { if (ngoodpix) *ngoodpix = ngood; xtemp = sum / ngood; if (mean) *mean = xtemp; if (sigma) *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp)); } else if (ngood == 1){ if (ngoodpix) *ngoodpix = 1; if (mean) *mean = sum; if (sigma) *sigma = 0.0; } else { if (ngoodpix) *ngoodpix = 0; if (mean) *mean = 0.; if (sigma) *sigma = 0.; } return(*status); } /*--------------------------------------------------------------------------*/ static int FnMeanSigma_double (double *array, /* 2 dimensional array of image pixels */ long npix, /* number of pixels in the image */ int nullcheck, /* check for null values, if true */ double nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngoodpix, /* number of non-null pixels in the image */ double *mean, /* returned mean value of all non-null pixels */ double *sigma, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Compute mean and RMS sigma of the non-null pixels in the input array. */ { long ii, ngood = 0; double *value; double sum = 0., sum2 = 0., xtemp; value = array; if (nullcheck) { for (ii = 0; ii < npix; ii++, value++) { if (*value != nullvalue) { ngood++; xtemp = *value; sum += xtemp; sum2 += (xtemp * xtemp); } } } else { ngood = npix; for (ii = 0; ii < npix; ii++, value++) { xtemp = *value; sum += xtemp; sum2 += (xtemp * xtemp); } } if (ngood > 1) { if (ngoodpix) *ngoodpix = ngood; xtemp = sum / ngood; if (mean) *mean = xtemp; if (sigma) *sigma = sqrt((sum2 / ngood) - (xtemp * xtemp)); } else if (ngood == 1){ if (ngoodpix) *ngoodpix = 1; if (mean) *mean = sum; if (sigma) *sigma = 0.0; } else { if (ngoodpix) *ngoodpix = 0; if (mean) *mean = 0.; if (sigma) *sigma = 0.; } return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise5_short (short *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ short nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ short *minval, /* minimum non-null value */ short *maxval, /* maximum non-null value */ double *noise2, /* returned 2nd order MAD of all non-null pixels */ double *noise3, /* returned 3rd order MAD of all non-null pixels */ double *noise5, /* returned 5th order MAD of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 2nd, 3rd and 5th order Median Absolute Differences. The noise in the background of the image is calculated using the MAD algorithms developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) 3rd order: noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0; int *differences2, *differences3, *differences5; short *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9; short xminval = SHRT_MAX, xmaxval = SHRT_MIN; int do_range = 0; double *diffs2, *diffs3, *diffs5; double xnoise2 = 0, xnoise3 = 0, xnoise5 = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 9 pixels */ if (nx < 9) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise2) *noise2 = 0.; if (noise3) *noise3 = 0.; if (noise5) *noise5 = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences2 = calloc(nx, sizeof(int)); if (!differences2) { *status = MEMORY_ALLOCATION; return(*status); } differences3 = calloc(nx, sizeof(int)); if (!differences3) { free(differences2); *status = MEMORY_ALLOCATION; return(*status); } differences5 = calloc(nx, sizeof(int)); if (!differences5) { free(differences2); free(differences3); *status = MEMORY_ALLOCATION; return(*status); } diffs2 = calloc(ny, sizeof(double)); if (!diffs2) { free(differences2); free(differences3); free(differences5); *status = MEMORY_ALLOCATION; return(*status); } diffs3 = calloc(ny, sizeof(double)); if (!diffs3) { free(differences2); free(differences3); free(differences5); free(diffs2); *status = MEMORY_ALLOCATION; return(*status); } diffs5 = calloc(ny, sizeof(double)); if (!diffs5) { free(differences2); free(differences3); free(differences5); free(diffs2); free(diffs3); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* find the 5th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* find the 6th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v6 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v6 < xminval) xminval = v6; if (v6 > xmaxval) xmaxval = v6; } /* find the 7th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v7 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v7 < xminval) xminval = v7; if (v7 > xmaxval) xmaxval = v7; } /* find the 8th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v8 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v8 < xminval) xminval = v8; if (v8 > xmaxval) xmaxval = v8; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; nvals2 = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v9 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v9 < xminval) xminval = v9; if (v9 > xmaxval) xmaxval = v9; } /* construct array of absolute differences */ if (!(v5 == v6 && v6 == v7) ) { differences2[nvals2] = abs((int) v5 - (int) v7); nvals2++; } if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) { differences3[nvals] = abs((2 * (int) v5) - (int) v3 - (int) v7); differences5[nvals] = abs((6 * (int) v5) - (4 * (int) v3) - (4 * (int) v7) + (int) v1 + (int) v9); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; v5 = v6; v6 = v7; v7 = v8; v8 = v9; } /* end of loop over pixels in the row */ /* compute the median diffs */ /* Note that there are 8 more pixel values than there are diffs values. */ ngoodpix += (nvals + 8); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { if (nvals2 == 1) { diffs2[nrows2] = differences2[0]; nrows2++; } diffs3[nrows] = differences3[0]; diffs5[nrows] = differences5[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ if (nvals2 > 1) { diffs2[nrows2] = quick_select_int(differences2, nvals); nrows2++; } diffs3[nrows] = quick_select_int(differences3, nvals); diffs5[nrows] = quick_select_int(differences5, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise3 = 0; xnoise5 = 0; } else if (nrows == 1) { xnoise3 = diffs3[0]; xnoise5 = diffs5[0]; } else { qsort(diffs3, nrows, sizeof(double), FnCompare_double); qsort(diffs5, nrows, sizeof(double), FnCompare_double); xnoise3 = (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.; xnoise5 = (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.; } if (nrows2 == 0) { xnoise2 = 0; } else if (nrows2 == 1) { xnoise2 = diffs2[0]; } else { qsort(diffs2, nrows2, sizeof(double), FnCompare_double); xnoise2 = (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.; } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise2) *noise2 = 1.0483579 * xnoise2; if (noise3) *noise3 = 0.6052697 * xnoise3; if (noise5) *noise5 = 0.1772048 * xnoise5; free(diffs5); free(diffs3); free(diffs2); free(differences5); free(differences3); free(differences2); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise5_int (int *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ int nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ int *minval, /* minimum non-null value */ int *maxval, /* maximum non-null value */ double *noise2, /* returned 2nd order MAD of all non-null pixels */ double *noise3, /* returned 3rd order MAD of all non-null pixels */ double *noise5, /* returned 5th order MAD of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 2nd, 3rd and 5th order Median Absolute Differences. The noise in the background of the image is calculated using the MAD algorithms developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) 3rd order: noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0; LONGLONG *differences2, *differences3, *differences5, tdiff; int *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9; int xminval = INT_MAX, xmaxval = INT_MIN; int do_range = 0; double *diffs2, *diffs3, *diffs5; double xnoise2 = 0, xnoise3 = 0, xnoise5 = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 9 pixels */ if (nx < 9) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise2) *noise2 = 0.; if (noise3) *noise3 = 0.; if (noise5) *noise5 = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences2 = calloc(nx, sizeof(LONGLONG)); if (!differences2) { *status = MEMORY_ALLOCATION; return(*status); } differences3 = calloc(nx, sizeof(LONGLONG)); if (!differences3) { free(differences2); *status = MEMORY_ALLOCATION; return(*status); } differences5 = calloc(nx, sizeof(LONGLONG)); if (!differences5) { free(differences2); free(differences3); *status = MEMORY_ALLOCATION; return(*status); } diffs2 = calloc(ny, sizeof(double)); if (!diffs2) { free(differences2); free(differences3); free(differences5); *status = MEMORY_ALLOCATION; return(*status); } diffs3 = calloc(ny, sizeof(double)); if (!diffs3) { free(differences2); free(differences3); free(differences5); free(diffs2); *status = MEMORY_ALLOCATION; return(*status); } diffs5 = calloc(ny, sizeof(double)); if (!diffs5) { free(differences2); free(differences3); free(differences5); free(diffs2); free(diffs3); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* find the 5th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* find the 6th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v6 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v6 < xminval) xminval = v6; if (v6 > xmaxval) xmaxval = v6; } /* find the 7th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v7 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v7 < xminval) xminval = v7; if (v7 > xmaxval) xmaxval = v7; } /* find the 8th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v8 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v8 < xminval) xminval = v8; if (v8 > xmaxval) xmaxval = v8; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; nvals2 = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v9 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v9 < xminval) xminval = v9; if (v9 > xmaxval) xmaxval = v9; } /* construct array of absolute differences */ if (!(v5 == v6 && v6 == v7) ) { tdiff = (LONGLONG) v5 - (LONGLONG) v7; if (tdiff < 0) differences2[nvals2] = -1 * tdiff; else differences2[nvals2] = tdiff; nvals2++; } if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) { tdiff = (2 * (LONGLONG) v5) - (LONGLONG) v3 - (LONGLONG) v7; if (tdiff < 0) differences3[nvals] = -1 * tdiff; else differences3[nvals] = tdiff; tdiff = (6 * (LONGLONG) v5) - (4 * (LONGLONG) v3) - (4 * (LONGLONG) v7) + (LONGLONG) v1 + (LONGLONG) v9; if (tdiff < 0) differences5[nvals] = -1 * tdiff; else differences5[nvals] = tdiff; nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; v5 = v6; v6 = v7; v7 = v8; v8 = v9; } /* end of loop over pixels in the row */ /* compute the median diffs */ /* Note that there are 8 more pixel values than there are diffs values. */ ngoodpix += (nvals + 8); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { if (nvals2 == 1) { diffs2[nrows2] = (double) differences2[0]; nrows2++; } diffs3[nrows] = (double) differences3[0]; diffs5[nrows] = (double) differences5[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ if (nvals2 > 1) { diffs2[nrows2] = (double) quick_select_longlong(differences2, nvals); nrows2++; } diffs3[nrows] = (double) quick_select_longlong(differences3, nvals); diffs5[nrows] = (double) quick_select_longlong(differences5, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise3 = 0; xnoise5 = 0; } else if (nrows == 1) { xnoise3 = diffs3[0]; xnoise5 = diffs5[0]; } else { qsort(diffs3, nrows, sizeof(double), FnCompare_double); qsort(diffs5, nrows, sizeof(double), FnCompare_double); xnoise3 = (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.; xnoise5 = (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.; } if (nrows2 == 0) { xnoise2 = 0; } else if (nrows2 == 1) { xnoise2 = diffs2[0]; } else { qsort(diffs2, nrows2, sizeof(double), FnCompare_double); xnoise2 = (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.; } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise2) *noise2 = 1.0483579 * xnoise2; if (noise3) *noise3 = 0.6052697 * xnoise3; if (noise5) *noise5 = 0.1772048 * xnoise5; free(diffs5); free(diffs3); free(diffs2); free(differences5); free(differences3); free(differences2); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise5_float (float *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ float nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ float *minval, /* minimum non-null value */ float *maxval, /* maximum non-null value */ double *noise2, /* returned 2nd order MAD of all non-null pixels */ double *noise3, /* returned 3rd order MAD of all non-null pixels */ double *noise5, /* returned 5th order MAD of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 2nd, 3rd and 5th order Median Absolute Differences. The noise in the background of the image is calculated using the MAD algorithms developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) 3rd order: noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0; float *differences2, *differences3, *differences5; float *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9; float xminval = FLT_MAX, xmaxval = -FLT_MAX; int do_range = 0; double *diffs2, *diffs3, *diffs5; double xnoise2 = 0, xnoise3 = 0, xnoise5 = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 9 pixels */ if (nx < 9) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise2) *noise2 = 0.; if (noise3) *noise3 = 0.; if (noise5) *noise5 = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences2 = calloc(nx, sizeof(float)); if (!differences2) { *status = MEMORY_ALLOCATION; return(*status); } differences3 = calloc(nx, sizeof(float)); if (!differences3) { free(differences2); *status = MEMORY_ALLOCATION; return(*status); } differences5 = calloc(nx, sizeof(float)); if (!differences5) { free(differences2); free(differences3); *status = MEMORY_ALLOCATION; return(*status); } diffs2 = calloc(ny, sizeof(double)); if (!diffs2) { free(differences2); free(differences3); free(differences5); *status = MEMORY_ALLOCATION; return(*status); } diffs3 = calloc(ny, sizeof(double)); if (!diffs3) { free(differences2); free(differences3); free(differences5); free(diffs2); *status = MEMORY_ALLOCATION; return(*status); } diffs5 = calloc(ny, sizeof(double)); if (!diffs5) { free(differences2); free(differences3); free(differences5); free(diffs2); free(diffs3); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* find the 5th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* find the 6th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v6 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v6 < xminval) xminval = v6; if (v6 > xmaxval) xmaxval = v6; } /* find the 7th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v7 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v7 < xminval) xminval = v7; if (v7 > xmaxval) xmaxval = v7; } /* find the 8th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v8 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v8 < xminval) xminval = v8; if (v8 > xmaxval) xmaxval = v8; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; nvals2 = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v9 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v9 < xminval) xminval = v9; if (v9 > xmaxval) xmaxval = v9; } /* construct array of absolute differences */ if (!(v5 == v6 && v6 == v7) ) { differences2[nvals2] = (float) fabs(v5 - v7); nvals2++; } if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) { differences3[nvals] = (float) fabs((2 * v5) - v3 - v7); differences5[nvals] = (float) fabs((6 * v5) - (4 * v3) - (4 * v7) + v1 + v9); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; v5 = v6; v6 = v7; v7 = v8; v8 = v9; } /* end of loop over pixels in the row */ /* compute the median diffs */ /* Note that there are 8 more pixel values than there are diffs values. */ ngoodpix += (nvals + 8); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { if (nvals2 == 1) { diffs2[nrows2] = differences2[0]; nrows2++; } diffs3[nrows] = differences3[0]; diffs5[nrows] = differences5[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ if (nvals2 > 1) { diffs2[nrows2] = quick_select_float(differences2, nvals); nrows2++; } diffs3[nrows] = quick_select_float(differences3, nvals); diffs5[nrows] = quick_select_float(differences5, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise3 = 0; xnoise5 = 0; } else if (nrows == 1) { xnoise3 = diffs3[0]; xnoise5 = diffs5[0]; } else { qsort(diffs3, nrows, sizeof(double), FnCompare_double); qsort(diffs5, nrows, sizeof(double), FnCompare_double); xnoise3 = (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.; xnoise5 = (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.; } if (nrows2 == 0) { xnoise2 = 0; } else if (nrows2 == 1) { xnoise2 = diffs2[0]; } else { qsort(diffs2, nrows2, sizeof(double), FnCompare_double); xnoise2 = (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.; } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise2) *noise2 = 1.0483579 * xnoise2; if (noise3) *noise3 = 0.6052697 * xnoise3; if (noise5) *noise5 = 0.1772048 * xnoise5; free(diffs5); free(diffs3); free(diffs2); free(differences5); free(differences3); free(differences2); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise5_double (double *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ double nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ double *minval, /* minimum non-null value */ double *maxval, /* maximum non-null value */ double *noise2, /* returned 2nd order MAD of all non-null pixels */ double *noise3, /* returned 3rd order MAD of all non-null pixels */ double *noise5, /* returned 5th order MAD of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 2nd, 3rd and 5th order Median Absolute Differences. The noise in the background of the image is calculated using the MAD algorithms developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) 3rd order: noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nrows2 = 0, nvals, nvals2, ngoodpix = 0; double *differences2, *differences3, *differences5; double *rowpix, v1, v2, v3, v4, v5, v6, v7, v8, v9; double xminval = DBL_MAX, xmaxval = -DBL_MAX; int do_range = 0; double *diffs2, *diffs3, *diffs5; double xnoise2 = 0, xnoise3 = 0, xnoise5 = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 9 pixels */ if (nx < 9) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise2) *noise2 = 0.; if (noise3) *noise3 = 0.; if (noise5) *noise5 = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences2 = calloc(nx, sizeof(double)); if (!differences2) { *status = MEMORY_ALLOCATION; return(*status); } differences3 = calloc(nx, sizeof(double)); if (!differences3) { free(differences2); *status = MEMORY_ALLOCATION; return(*status); } differences5 = calloc(nx, sizeof(double)); if (!differences5) { free(differences2); free(differences3); *status = MEMORY_ALLOCATION; return(*status); } diffs2 = calloc(ny, sizeof(double)); if (!diffs2) { free(differences2); free(differences3); free(differences5); *status = MEMORY_ALLOCATION; return(*status); } diffs3 = calloc(ny, sizeof(double)); if (!diffs3) { free(differences2); free(differences3); free(differences5); free(diffs2); *status = MEMORY_ALLOCATION; return(*status); } diffs5 = calloc(ny, sizeof(double)); if (!diffs5) { free(differences2); free(differences3); free(differences5); free(diffs2); free(diffs3); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* find the 5th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* find the 6th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v6 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v6 < xminval) xminval = v6; if (v6 > xmaxval) xmaxval = v6; } /* find the 7th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v7 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v7 < xminval) xminval = v7; if (v7 > xmaxval) xmaxval = v7; } /* find the 8th valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v8 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v8 < xminval) xminval = v8; if (v8 > xmaxval) xmaxval = v8; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; nvals2 = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v9 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v9 < xminval) xminval = v9; if (v9 > xmaxval) xmaxval = v9; } /* construct array of absolute differences */ if (!(v5 == v6 && v6 == v7) ) { differences2[nvals2] = fabs(v5 - v7); nvals2++; } if (!(v3 == v4 && v4 == v5 && v5 == v6 && v6 == v7) ) { differences3[nvals] = fabs((2 * v5) - v3 - v7); differences5[nvals] = fabs((6 * v5) - (4 * v3) - (4 * v7) + v1 + v9); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; v5 = v6; v6 = v7; v7 = v8; v8 = v9; } /* end of loop over pixels in the row */ /* compute the median diffs */ /* Note that there are 8 more pixel values than there are diffs values. */ ngoodpix += (nvals + 8); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { if (nvals2 == 1) { diffs2[nrows2] = differences2[0]; nrows2++; } diffs3[nrows] = differences3[0]; diffs5[nrows] = differences5[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ if (nvals2 > 1) { diffs2[nrows2] = quick_select_double(differences2, nvals); nrows2++; } diffs3[nrows] = quick_select_double(differences3, nvals); diffs5[nrows] = quick_select_double(differences5, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise3 = 0; xnoise5 = 0; } else if (nrows == 1) { xnoise3 = diffs3[0]; xnoise5 = diffs5[0]; } else { qsort(diffs3, nrows, sizeof(double), FnCompare_double); qsort(diffs5, nrows, sizeof(double), FnCompare_double); xnoise3 = (diffs3[(nrows - 1)/2] + diffs3[nrows/2]) / 2.; xnoise5 = (diffs5[(nrows - 1)/2] + diffs5[nrows/2]) / 2.; } if (nrows2 == 0) { xnoise2 = 0; } else if (nrows2 == 1) { xnoise2 = diffs2[0]; } else { qsort(diffs2, nrows2, sizeof(double), FnCompare_double); xnoise2 = (diffs2[(nrows2 - 1)/2] + diffs2[nrows2/2]) / 2.; } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise2) *noise2 = 1.0483579 * xnoise2; if (noise3) *noise3 = 0.6052697 * xnoise3; if (noise5) *noise5 = 0.1772048 * xnoise5; free(diffs5); free(diffs3); free(diffs2); free(differences5); free(differences3); free(differences2); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise3_short (short *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ short nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ short *minval, /* minimum non-null value */ short *maxval, /* maximum non-null value */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 3rd order differences. The noise in the background of the image is calculated using the 3rd order algorithm developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nvals, ngoodpix = 0; short *differences, *rowpix, v1, v2, v3, v4, v5; short xminval = SHRT_MAX, xmaxval = SHRT_MIN, do_range = 0; double *diffs, xnoise = 0, sigma; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 5 pixels */ if (nx < 5) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise) *noise = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(short)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* construct array of 3rd order absolute differences */ if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) { differences[nvals] = abs((2 * v3) - v1 - v5); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; } /* end of loop over pixels in the row */ /* compute the 3rd order diffs */ /* Note that there are 4 more pixel values than there are diffs values. */ ngoodpix += (nvals + 4); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { diffs[nrows] = differences[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ diffs[nrows] = quick_select_short(differences, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; FnMeanSigma_double(diffs, nrows, 0, 0.0, 0, &xnoise, &sigma, status); /* do a 4.5 sigma rejection of outliers */ jj = 0; sigma = 4.5 * sigma; for (ii = 0; ii < nrows; ii++) { if ( fabs(diffs[ii] - xnoise) <= sigma) { if (jj != ii) diffs[jj] = diffs[ii]; jj++; } } if (ii != jj) FnMeanSigma_double(diffs, jj, 0, 0.0, 0, &xnoise, &sigma, status); } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise) *noise = 0.6052697 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise3_int (int *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ int nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ int *minval, /* minimum non-null value */ int *maxval, /* maximum non-null value */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the background noise in the input image using 3rd order differences. The noise in the background of the image is calculated using the 3rd order algorithm developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nvals, ngoodpix = 0; int *differences, *rowpix, v1, v2, v3, v4, v5; int xminval = INT_MAX, xmaxval = INT_MIN, do_range = 0; double *diffs, xnoise = 0, sigma; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 5 pixels */ if (nx < 5) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise) *noise = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(int)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* construct array of 3rd order absolute differences */ if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) { differences[nvals] = abs((2 * v3) - v1 - v5); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; } /* end of loop over pixels in the row */ /* compute the 3rd order diffs */ /* Note that there are 4 more pixel values than there are diffs values. */ ngoodpix += (nvals + 4); if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { diffs[nrows] = differences[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ diffs[nrows] = quick_select_int(differences, nvals); } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; FnMeanSigma_double(diffs, nrows, 0, 0.0, 0, &xnoise, &sigma, status); /* do a 4.5 sigma rejection of outliers */ jj = 0; sigma = 4.5 * sigma; for (ii = 0; ii < nrows; ii++) { if ( fabs(diffs[ii] - xnoise) <= sigma) { if (jj != ii) diffs[jj] = diffs[ii]; jj++; } } if (ii != jj) FnMeanSigma_double(diffs, jj, 0, 0.0, 0, &xnoise, &sigma, status); } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise) *noise = 0.6052697 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise3_float (float *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ float nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ float *minval, /* minimum non-null value */ float *maxval, /* maximum non-null value */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 3rd order differences. The noise in the background of the image is calculated using the 3rd order algorithm developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nvals, ngoodpix = 0; float *differences, *rowpix, v1, v2, v3, v4, v5; float xminval = FLT_MAX, xmaxval = -FLT_MAX; int do_range = 0; double *diffs, xnoise = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 5 pixels to calc noise, so just calc min, max, ngood */ if (nx < 5) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise) *noise = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ if (noise) { differences = calloc(nx, sizeof(float)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) { ii++; } if (ii == nx) break; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* construct array of 3rd order absolute differences */ if (noise) { if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) { differences[nvals] = (float) fabs((2. * v3) - v1 - v5); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } } else { /* just increment the number of non-null pixels */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; } /* end of loop over pixels in the row */ /* compute the 3rd order diffs */ /* Note that there are 4 more pixel values than there are diffs values. */ ngoodpix += (nvals + 4); if (noise) { if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { diffs[nrows] = differences[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ diffs[nrows] = quick_select_float(differences, nvals); } } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (noise) { if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise) { *noise = 0.6052697 * xnoise; free(diffs); free(differences); } return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise3_double (double *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ double nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ long *ngood, /* number of good, non-null pixels? */ double *minval, /* minimum non-null value */ double *maxval, /* maximum non-null value */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the median and background noise in the input image using 3rd order differences. The noise in the background of the image is calculated using the 3rd order algorithm developed for deriving the signal to noise ratio in spectra (see issue #42 of the ST-ECF newsletter, http://www.stecf.org/documents/newsletter/) noise = 1.482602 / sqrt(6) * median (abs(2*flux(i) - flux(i-2) - flux(i+2))) The returned estimates are the median of the values that are computed for each row of the image. */ { long ii, jj, nrows = 0, nvals, ngoodpix = 0; double *differences, *rowpix, v1, v2, v3, v4, v5; double xminval = DBL_MAX, xmaxval = -DBL_MAX; int do_range = 0; double *diffs, xnoise = 0; if (nx < 5) { /* treat entire array as an image with a single row */ nx = nx * ny; ny = 1; } /* rows must have at least 5 pixels */ if (nx < 5) { for (ii = 0; ii < nx; ii++) { if (nullcheck && array[ii] == nullvalue) continue; else { if (array[ii] < xminval) xminval = array[ii]; if (array[ii] > xmaxval) xmaxval = array[ii]; ngoodpix++; } } if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (ngood) *ngood = ngoodpix; if (noise) *noise = 0.; return(*status); } /* do we need to compute the min and max value? */ if (minval || maxval) do_range = 1; /* allocate arrays used to compute the median and noise estimates */ if (noise) { differences = calloc(nx, sizeof(double)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v1 < xminval) xminval = v1; if (v1 > xmaxval) xmaxval = v1; } /***** find the 2nd valid pixel in row (which we will skip over) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v2 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v2 < xminval) xminval = v2; if (v2 > xmaxval) xmaxval = v2; } /***** find the 3rd valid pixel in row */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v3 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v3 < xminval) xminval = v3; if (v3 > xmaxval) xmaxval = v3; } /* find the 4nd valid pixel in row (to be skipped) */ ii++; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v4 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v4 < xminval) xminval = v4; if (v4 > xmaxval) xmaxval = v4; } /* now populate the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ v5 = rowpix[ii]; /* store the good pixel value */ if (do_range) { if (v5 < xminval) xminval = v5; if (v5 > xmaxval) xmaxval = v5; } /* construct array of 3rd order absolute differences */ if (noise) { if (!(v1 == v2 && v2 == v3 && v3 == v4 && v4 == v5)) { differences[nvals] = fabs((2. * v3) - v1 - v5); nvals++; } else { /* ignore constant background regions */ ngoodpix++; } } else { /* just increment the number of non-null pixels */ ngoodpix++; } /* shift over 1 pixel */ v1 = v2; v2 = v3; v3 = v4; v4 = v5; } /* end of loop over pixels in the row */ /* compute the 3rd order diffs */ /* Note that there are 4 more pixel values than there are diffs values. */ ngoodpix += (nvals + 4); if (noise) { if (nvals == 0) { continue; /* cannot compute medians on this row */ } else if (nvals == 1) { diffs[nrows] = differences[0]; } else { /* quick_select returns the median MUCH faster than using qsort */ diffs[nrows] = quick_select_double(differences, nvals); } } nrows++; } /* end of loop over rows */ /* compute median of the values for each row */ if (noise) { if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } } if (ngood) *ngood = ngoodpix; if (minval) *minval = xminval; if (maxval) *maxval = xmaxval; if (noise) { *noise = 0.6052697 * xnoise; free(diffs); free(differences); } return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise1_short (short *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ short nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the background noise in the input image using sigma of 1st order differences. noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1]) The returned estimate is the median of the values that are computed for each row of the image. */ { int iter; long ii, jj, kk, nrows = 0, nvals; short *differences, *rowpix, v1; double *diffs, xnoise, mean, stdev; /* rows must have at least 3 pixels to estimate noise */ if (nx < 3) { *noise = 0; return(*status); } /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(short)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ /* now continue populating the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ /* construct array of 1st order differences */ differences[nvals] = v1 - rowpix[ii]; nvals++; /* shift over 1 pixel */ v1 = rowpix[ii]; } /* end of loop over pixels in the row */ if (nvals < 2) continue; else { FnMeanSigma_short(differences, nvals, 0, 0, 0, &mean, &stdev, status); if (stdev > 0.) { for (iter = 0; iter < NITER; iter++) { kk = 0; for (ii = 0; ii < nvals; ii++) { if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) { if (kk < ii) differences[kk] = differences[ii]; kk++; } } if (kk == nvals) break; nvals = kk; FnMeanSigma_short(differences, nvals, 0, 0, 0, &mean, &stdev, status); } } diffs[nrows] = stdev; nrows++; } } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } *noise = .70710678 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise1_int (int *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ int nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the background noise in the input image using sigma of 1st order differences. noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1]) The returned estimate is the median of the values that are computed for each row of the image. */ { int iter; long ii, jj, kk, nrows = 0, nvals; int *differences, *rowpix, v1; double *diffs, xnoise, mean, stdev; /* rows must have at least 3 pixels to estimate noise */ if (nx < 3) { *noise = 0; return(*status); } /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(int)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ /* now continue populating the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ /* construct array of 1st order differences */ differences[nvals] = v1 - rowpix[ii]; nvals++; /* shift over 1 pixel */ v1 = rowpix[ii]; } /* end of loop over pixels in the row */ if (nvals < 2) continue; else { FnMeanSigma_int(differences, nvals, 0, 0, 0, &mean, &stdev, status); if (stdev > 0.) { for (iter = 0; iter < NITER; iter++) { kk = 0; for (ii = 0; ii < nvals; ii++) { if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) { if (kk < ii) differences[kk] = differences[ii]; kk++; } } if (kk == nvals) break; nvals = kk; FnMeanSigma_int(differences, nvals, 0, 0, 0, &mean, &stdev, status); } } diffs[nrows] = stdev; nrows++; } } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } *noise = .70710678 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise1_float (float *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ float nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the background noise in the input image using sigma of 1st order differences. noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1]) The returned estimate is the median of the values that are computed for each row of the image. */ { int iter; long ii, jj, kk, nrows = 0, nvals; float *differences, *rowpix, v1; double *diffs, xnoise, mean, stdev; /* rows must have at least 3 pixels to estimate noise */ if (nx < 3) { *noise = 0; return(*status); } /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(float)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ /* now continue populating the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ /* construct array of 1st order differences */ differences[nvals] = v1 - rowpix[ii]; nvals++; /* shift over 1 pixel */ v1 = rowpix[ii]; } /* end of loop over pixels in the row */ if (nvals < 2) continue; else { FnMeanSigma_float(differences, nvals, 0, 0, 0, &mean, &stdev, status); if (stdev > 0.) { for (iter = 0; iter < NITER; iter++) { kk = 0; for (ii = 0; ii < nvals; ii++) { if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) { if (kk < ii) differences[kk] = differences[ii]; kk++; } } if (kk == nvals) break; nvals = kk; FnMeanSigma_float(differences, nvals, 0, 0, 0, &mean, &stdev, status); } } diffs[nrows] = stdev; nrows++; } } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } *noise = .70710678 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnNoise1_double (double *array, /* 2 dimensional array of image pixels */ long nx, /* number of pixels in each row of the image */ long ny, /* number of rows in the image */ int nullcheck, /* check for null values, if true */ double nullvalue, /* value of null pixels, if nullcheck is true */ /* returned parameters */ double *noise, /* returned R.M.S. value of all non-null pixels */ int *status) /* error status */ /* Estimate the background noise in the input image using sigma of 1st order differences. noise = 1.0 / sqrt(2) * rms of (flux[i] - flux[i-1]) The returned estimate is the median of the values that are computed for each row of the image. */ { int iter; long ii, jj, kk, nrows = 0, nvals; double *differences, *rowpix, v1; double *diffs, xnoise, mean, stdev; /* rows must have at least 3 pixels to estimate noise */ if (nx < 3) { *noise = 0; return(*status); } /* allocate arrays used to compute the median and noise estimates */ differences = calloc(nx, sizeof(double)); if (!differences) { *status = MEMORY_ALLOCATION; return(*status); } diffs = calloc(ny, sizeof(double)); if (!diffs) { free(differences); *status = MEMORY_ALLOCATION; return(*status); } /* loop over each row of the image */ for (jj=0; jj < ny; jj++) { rowpix = array + (jj * nx); /* point to first pixel in the row */ /***** find the first valid pixel in row */ ii = 0; if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) continue; /* hit end of row */ v1 = rowpix[ii]; /* store the good pixel value */ /* now continue populating the differences arrays */ /* for the remaining pixels in the row */ nvals = 0; for (ii++; ii < nx; ii++) { /* find the next valid pixel in row */ if (nullcheck) while (ii < nx && rowpix[ii] == nullvalue) ii++; if (ii == nx) break; /* hit end of row */ /* construct array of 1st order differences */ differences[nvals] = v1 - rowpix[ii]; nvals++; /* shift over 1 pixel */ v1 = rowpix[ii]; } /* end of loop over pixels in the row */ if (nvals < 2) continue; else { FnMeanSigma_double(differences, nvals, 0, 0, 0, &mean, &stdev, status); if (stdev > 0.) { for (iter = 0; iter < NITER; iter++) { kk = 0; for (ii = 0; ii < nvals; ii++) { if (fabs (differences[ii] - mean) < SIGMA_CLIP * stdev) { if (kk < ii) differences[kk] = differences[ii]; kk++; } } if (kk == nvals) break; nvals = kk; FnMeanSigma_double(differences, nvals, 0, 0, 0, &mean, &stdev, status); } } diffs[nrows] = stdev; nrows++; } } /* end of loop over rows */ /* compute median of the values for each row */ if (nrows == 0) { xnoise = 0; } else if (nrows == 1) { xnoise = diffs[0]; } else { qsort(diffs, nrows, sizeof(double), FnCompare_double); xnoise = (diffs[(nrows - 1)/2] + diffs[nrows/2]) / 2.; } *noise = .70710678 * xnoise; free(diffs); free(differences); return(*status); } /*--------------------------------------------------------------------------*/ static int FnCompare_short(const void *v1, const void *v2) { const short *i1 = v1; const short *i2 = v2; if (*i1 < *i2) return(-1); else if (*i1 > *i2) return(1); else return(0); } /*--------------------------------------------------------------------------*/ static int FnCompare_int(const void *v1, const void *v2) { const int *i1 = v1; const int *i2 = v2; if (*i1 < *i2) return(-1); else if (*i1 > *i2) return(1); else return(0); } /*--------------------------------------------------------------------------*/ static int FnCompare_float(const void *v1, const void *v2) { const float *i1 = v1; const float *i2 = v2; if (*i1 < *i2) return(-1); else if (*i1 > *i2) return(1); else return(0); } /*--------------------------------------------------------------------------*/ static int FnCompare_double(const void *v1, const void *v2) { const double *i1 = v1; const double *i2 = v2; if (*i1 < *i2) return(-1); else if (*i1 > *i2) return(1); else return(0); } /*--------------------------------------------------------------------------*/ /* * These Quickselect routines are based on the algorithm described in * "Numerical recipes in C", Second Edition, * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5 * This code by Nicolas Devillard - 1998. Public domain. */ /*--------------------------------------------------------------------------*/ #define ELEM_SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; } static float quick_select_float(float arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) /* One element only */ return arr[median] ; if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /*--------------------------------------------------------------------------*/ #define ELEM_SWAP(a,b) { register short t=(a);(a)=(b);(b)=t; } static short quick_select_short(short arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) /* One element only */ return arr[median] ; if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /*--------------------------------------------------------------------------*/ #define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; } static int quick_select_int(int arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) /* One element only */ return arr[median] ; if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /*--------------------------------------------------------------------------*/ #define ELEM_SWAP(a,b) { register LONGLONG t=(a);(a)=(b);(b)=t; } static LONGLONG quick_select_longlong(LONGLONG arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) /* One element only */ return arr[median] ; if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /*--------------------------------------------------------------------------*/ #define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; } static double quick_select_double(double arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) /* One element only */ return arr[median] ; if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP astropy-0.3/cextern/cfitsio/checksum.c0000644000175000017500000004226412243255342016265 0ustar oleole/* This file, checksum.c, contains the checksum-related routines in the */ /* FITSIO library. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" /*------------------------------------------------------------------------*/ int ffcsum(fitsfile *fptr, /* I - FITS file pointer */ long nrec, /* I - number of 2880-byte blocks to sum */ unsigned long *sum, /* IO - accumulated checksum */ int *status) /* IO - error status */ /* Calculate a 32-bit 1's complement checksum of the FITS 2880-byte blocks. This routine is based on the C algorithm developed by Rob Seaman at NOAO that was presented at the 1994 ADASS conference, published in the Astronomical Society of the Pacific Conference Series. This uses a 32-bit 1's complement checksum in which the overflow bits are permuted back into the sum and therefore all bit positions are sampled evenly. */ { long ii, jj; unsigned short sbuf[1440]; unsigned long hi, lo, hicarry, locarry; if (*status > 0) return(*status); /* Sum the specified number of FITS 2880-byte records. This assumes that the FITSIO file pointer points to the start of the records to be summed. Read each FITS block as 1440 short values (do byte swapping if needed). */ for (jj = 0; jj < nrec; jj++) { ffgbyt(fptr, 2880, sbuf, status); #if BYTESWAPPED ffswap2( (short *)sbuf, 1440); /* reverse order of bytes in each value */ #endif hi = (*sum >> 16); lo = *sum & 0xFFFF; for (ii = 0; ii < 1440; ii += 2) { hi += sbuf[ii]; lo += sbuf[ii+1]; } hicarry = hi >> 16; /* fold carry bits in */ locarry = lo >> 16; while (hicarry | locarry) { hi = (hi & 0xFFFF) + locarry; lo = (lo & 0xFFFF) + hicarry; hicarry = hi >> 16; locarry = lo >> 16; } *sum = (hi << 16) + lo; } return(*status); } /*-------------------------------------------------------------------------*/ void ffesum(unsigned long sum, /* I - accumulated checksum */ int complm, /* I - = 1 to encode complement of the sum */ char *ascii) /* O - 16-char ASCII encoded checksum */ /* encode the 32 bit checksum by converting every 2 bits of each byte into an ASCII character (32 bit word encoded as 16 character string). Only ASCII letters and digits are used to encode the values (no ASCII punctuation characters). If complm=TRUE, then the complement of the sum will be encoded. This routine is based on the C algorithm developed by Rob Seaman at NOAO that was presented at the 1994 ADASS conference, published in the Astronomical Society of the Pacific Conference Series. */ { unsigned int exclude[13] = { 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60 }; unsigned long mask[4] = { 0xff000000, 0xff0000, 0xff00, 0xff }; int offset = 0x30; /* ASCII 0 (zero) */ unsigned long value; int byte, quotient, remainder, ch[4], check, ii, jj, kk; char asc[32]; if (complm) value = 0xFFFFFFFF - sum; /* complement each bit of the value */ else value = sum; for (ii = 0; ii < 4; ii++) { byte = (value & mask[ii]) >> (24 - (8 * ii)); quotient = byte / 4 + offset; remainder = byte % 4; for (jj = 0; jj < 4; jj++) ch[jj] = quotient; ch[0] += remainder; for (check = 1; check;) /* avoid ASCII punctuation */ for (check = 0, kk = 0; kk < 13; kk++) for (jj = 0; jj < 4; jj += 2) if ((unsigned char) ch[jj] == exclude[kk] || (unsigned char) ch[jj+1] == exclude[kk]) { ch[jj]++; ch[jj+1]--; check++; } for (jj = 0; jj < 4; jj++) /* assign the bytes */ asc[4*jj+ii] = ch[jj]; } for (ii = 0; ii < 16; ii++) /* shift the bytes 1 to the right */ ascii[ii] = asc[(ii+15)%16]; ascii[16] = '\0'; } /*-------------------------------------------------------------------------*/ unsigned long ffdsum(char *ascii, /* I - 16-char ASCII encoded checksum */ int complm, /* I - =1 to decode complement of the */ unsigned long *sum) /* O - 32-bit checksum */ /* decode the 16-char ASCII encoded checksum into an unsigned 32-bit long. If complm=TRUE, then the complement of the sum will be decoded. This routine is based on the C algorithm developed by Rob Seaman at NOAO that was presented at the 1994 ADASS conference, published in the Astronomical Society of the Pacific Conference Series. */ { char cbuf[16]; unsigned long hi = 0, lo = 0, hicarry, locarry; int ii; /* remove the permuted FITS byte alignment and the ASCII 0 offset */ for (ii = 0; ii < 16; ii++) { cbuf[ii] = ascii[(ii+1)%16]; cbuf[ii] -= 0x30; } for (ii = 0; ii < 16; ii += 4) { hi += (cbuf[ii] << 8) + cbuf[ii+1]; lo += (cbuf[ii+2] << 8) + cbuf[ii+3]; } hicarry = hi >> 16; locarry = lo >> 16; while (hicarry || locarry) { hi = (hi & 0xFFFF) + locarry; lo = (lo & 0xFFFF) + hicarry; hicarry = hi >> 16; locarry = lo >> 16; } *sum = (hi << 16) + lo; if (complm) *sum = 0xFFFFFFFF - *sum; /* complement each bit of the value */ return(*sum); } /*------------------------------------------------------------------------*/ int ffpcks(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Create or update the checksum keywords in the CHDU. These keywords provide a checksum verification of the FITS HDU based on the ASCII coded 1's complement checksum algorithm developed by Rob Seaman at NOAO. */ { char datestr[20], checksum[FLEN_VALUE], datasum[FLEN_VALUE]; char comm[FLEN_COMMENT], chkcomm[FLEN_COMMENT], datacomm[FLEN_COMMENT]; int tstatus; long nrec; LONGLONG headstart, datastart, dataend; unsigned long dsum, olddsum, sum; double tdouble; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* generate current date string and construct the keyword comments */ ffgstm(datestr, NULL, status); strcpy(chkcomm, "HDU checksum updated "); strcat(chkcomm, datestr); strcpy(datacomm, "data unit checksum updated "); strcat(datacomm, datestr); /* write the CHECKSUM keyword if it does not exist */ tstatus = *status; if (ffgkys(fptr, "CHECKSUM", checksum, comm, status) == KEY_NO_EXIST) { *status = tstatus; strcpy(checksum, "0000000000000000"); ffpkys(fptr, "CHECKSUM", checksum, chkcomm, status); } /* write the DATASUM keyword if it does not exist */ tstatus = *status; if (ffgkys(fptr, "DATASUM", datasum, comm, status) == KEY_NO_EXIST) { *status = tstatus; olddsum = 0; ffpkys(fptr, "DATASUM", " 0", datacomm, status); /* set the CHECKSUM keyword as undefined, if it isn't already */ if (strcmp(checksum, "0000000000000000") ) { strcpy(checksum, "0000000000000000"); ffmkys(fptr, "CHECKSUM", checksum, chkcomm, status); } } else { /* decode the datasum into an unsigned long variable */ /* olddsum = strtoul(datasum, 0, 10); doesn't work on SUN OS */ tdouble = atof(datasum); olddsum = (unsigned long) tdouble; } /* close header: rewrite END keyword and following blank fill */ /* and re-read the required keywords to determine the structure */ if (ffrdef(fptr, status) > 0) return(*status); if ((fptr->Fptr)->heapsize > 0) ffuptf(fptr, status); /* update the variable length TFORM values */ /* write the correct data fill values, if they are not already correct */ if (ffpdfl(fptr, status) > 0) return(*status); /* calc size of data unit, in FITS 2880-byte blocks */ if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0) return(*status); nrec = (long) ((dataend - datastart) / 2880); dsum = 0; if (nrec > 0) { /* accumulate the 32-bit 1's complement checksum */ ffmbyt(fptr, datastart, REPORT_EOF, status); if (ffcsum(fptr, nrec, &dsum, status) > 0) return(*status); } if (dsum != olddsum) { /* update the DATASUM keyword with the correct value */ sprintf(datasum, "%lu", dsum); ffmkys(fptr, "DATASUM", datasum, datacomm, status); /* set the CHECKSUM keyword as undefined, if it isn't already */ if (strcmp(checksum, "0000000000000000") ) { strcpy(checksum, "0000000000000000"); ffmkys(fptr, "CHECKSUM", checksum, chkcomm, status); } } if (strcmp(checksum, "0000000000000000") ) { /* check if CHECKSUM is still OK; move to the start of the header */ ffmbyt(fptr, headstart, REPORT_EOF, status); /* accumulate the header checksum into the previous data checksum */ nrec = (long) ((datastart - headstart) / 2880); sum = dsum; if (ffcsum(fptr, nrec, &sum, status) > 0) return(*status); if (sum == 0 || sum == 0xFFFFFFFF) return(*status); /* CHECKSUM is correct */ /* Zero the CHECKSUM and recompute the new value */ ffmkys(fptr, "CHECKSUM", "0000000000000000", chkcomm, status); } /* move to the start of the header */ ffmbyt(fptr, headstart, REPORT_EOF, status); /* accumulate the header checksum into the previous data checksum */ nrec = (long) ((datastart - headstart) / 2880); sum = dsum; if (ffcsum(fptr, nrec, &sum, status) > 0) return(*status); /* encode the COMPLEMENT of the checksum into a 16-character string */ ffesum(sum, TRUE, checksum); /* update the CHECKSUM keyword value with the new string */ ffmkys(fptr, "CHECKSUM", checksum, "&", status); return(*status); } /*------------------------------------------------------------------------*/ int ffupck(fitsfile *fptr, /* I - FITS file pointer */ int *status) /* IO - error status */ /* Update the CHECKSUM keyword value. This assumes that the DATASUM keyword exists and has the correct value. */ { char datestr[20], chkcomm[FLEN_COMMENT], comm[FLEN_COMMENT]; char checksum[FLEN_VALUE], datasum[FLEN_VALUE]; int tstatus; long nrec; LONGLONG headstart, datastart, dataend; unsigned long sum, dsum; double tdouble; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* generate current date string and construct the keyword comments */ ffgstm(datestr, NULL, status); strcpy(chkcomm, "HDU checksum updated "); strcat(chkcomm, datestr); /* get the DATASUM keyword and convert it to a unsigned long */ if (ffgkys(fptr, "DATASUM", datasum, comm, status) == KEY_NO_EXIST) { ffpmsg("DATASUM keyword not found (ffupck"); return(*status); } tdouble = atof(datasum); /* read as a double as a workaround */ dsum = (unsigned long) tdouble; /* get size of the HDU */ if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0) return(*status); /* get the checksum keyword, if it exists */ tstatus = *status; if (ffgkys(fptr, "CHECKSUM", checksum, comm, status) == KEY_NO_EXIST) { *status = tstatus; strcpy(checksum, "0000000000000000"); ffpkys(fptr, "CHECKSUM", checksum, chkcomm, status); } else { /* check if CHECKSUM is still OK */ /* rewrite END keyword and following blank fill */ if (ffwend(fptr, status) > 0) return(*status); /* move to the start of the header */ ffmbyt(fptr, headstart, REPORT_EOF, status); /* accumulate the header checksum into the previous data checksum */ nrec = (long) ((datastart - headstart) / 2880); sum = dsum; if (ffcsum(fptr, nrec, &sum, status) > 0) return(*status); if (sum == 0 || sum == 0xFFFFFFFF) return(*status); /* CHECKSUM is already correct */ /* Zero the CHECKSUM and recompute the new value */ ffmkys(fptr, "CHECKSUM", "0000000000000000", chkcomm, status); } /* move to the start of the header */ ffmbyt(fptr, headstart, REPORT_EOF, status); /* accumulate the header checksum into the previous data checksum */ nrec = (long) ((datastart - headstart) / 2880); sum = dsum; if (ffcsum(fptr, nrec, &sum, status) > 0) return(*status); /* encode the COMPLEMENT of the checksum into a 16-character string */ ffesum(sum, TRUE, checksum); /* update the CHECKSUM keyword value with the new string */ ffmkys(fptr, "CHECKSUM", checksum, "&", status); return(*status); } /*------------------------------------------------------------------------*/ int ffvcks(fitsfile *fptr, /* I - FITS file pointer */ int *datastatus, /* O - data checksum status */ int *hdustatus, /* O - hdu checksum status */ /* 1 verification is correct */ /* 0 checksum keyword is not present */ /* -1 verification not correct */ int *status) /* IO - error status */ /* Verify the HDU by comparing the value of the computed checksums against the values of the DATASUM and CHECKSUM keywords if they are present. */ { int tstatus; double tdouble; unsigned long datasum, hdusum, olddatasum; char chksum[FLEN_VALUE], comm[FLEN_COMMENT]; if (*status > 0) /* inherit input status value if > 0 */ return(*status); *datastatus = -1; *hdustatus = -1; tstatus = *status; if (ffgkys(fptr, "CHECKSUM", chksum, comm, status) == KEY_NO_EXIST) { *hdustatus = 0; /* CHECKSUM keyword does not exist */ *status = tstatus; } if (chksum[0] == '\0') *hdustatus = 0; /* all blank checksum means it is undefined */ if (ffgkys(fptr, "DATASUM", chksum, comm, status) == KEY_NO_EXIST) { *datastatus = 0; /* DATASUM keyword does not exist */ *status = tstatus; } if (chksum[0] == '\0') *datastatus = 0; /* all blank checksum means it is undefined */ if ( *status > 0 || (!(*hdustatus) && !(*datastatus)) ) return(*status); /* return if neither keywords exist */ /* convert string to unsigned long */ /* olddatasum = strtoul(chksum, 0, 10); doesn't work w/ gcc on SUN OS */ /* sscanf(chksum, "%u", &olddatasum); doesn't work w/ cc on VAX/VMS */ tdouble = atof(chksum); /* read as a double as a workaround */ olddatasum = (unsigned long) tdouble; /* calculate the data checksum and the HDU checksum */ if (ffgcks(fptr, &datasum, &hdusum, status) > 0) return(*status); if (*datastatus) if (datasum == olddatasum) *datastatus = 1; if (*hdustatus) if (hdusum == 0 || hdusum == 0xFFFFFFFF) *hdustatus = 1; return(*status); } /*------------------------------------------------------------------------*/ int ffgcks(fitsfile *fptr, /* I - FITS file pointer */ unsigned long *datasum, /* O - data checksum */ unsigned long *hdusum, /* O - hdu checksum */ int *status) /* IO - error status */ /* calculate the checksums of the data unit and the total HDU */ { long nrec; LONGLONG headstart, datastart, dataend; if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* get size of the HDU */ if (ffghadll(fptr, &headstart, &datastart, &dataend, status) > 0) return(*status); nrec = (long) ((dataend - datastart) / 2880); *datasum = 0; if (nrec > 0) { /* accumulate the 32-bit 1's complement checksum */ ffmbyt(fptr, datastart, REPORT_EOF, status); if (ffcsum(fptr, nrec, datasum, status) > 0) return(*status); } /* move to the start of the header and calc. size of header */ ffmbyt(fptr, headstart, REPORT_EOF, status); nrec = (long) ((datastart - headstart) / 2880); /* accumulate the header checksum into the previous data checksum */ *hdusum = *datasum; ffcsum(fptr, nrec, hdusum, status); return(*status); } astropy-0.3/cextern/cfitsio/putcole.c0000644000175000017500000011305112243255342016127 0ustar oleole/* This file, putcole.c, contains routines that write data elements to */ /* a FITS image or table, with float datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppre( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ float *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine cannot be called directly by users to write to large arrays with > 2**31 pixels (although CFITSIO can do so by passing the firstelem thru a LONGLONG sized global variable) */ { long row; float nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TFLOAT, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcle(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppne( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ float *array, /* I - array of values that are written */ float nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. This routine cannot be called directly by users to write to large arrays with > 2**31 pixels (although CFITSIO can do so by passing the firstelem thru a LONGLONG sized global variable) */ { long row; float nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TFLOAT, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcne(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2de(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ float *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine does not support writing to large images with more than 2**31 pixels. */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3de(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3de(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ float *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). This routine does not support writing to large images with more than 2**31 pixels. */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TFLOAT, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcle(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcle(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpsse(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ float *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TFLOAT, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcle(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpe( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ float *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcle(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcle( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ float *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise, we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TFLOAT) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TFLOAT): if (writeraw) { /* write raw input bytes without conversion */ ffpr4b(fptr, ntodo, incre, &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffr4fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); } break; case (TLONGLONG): ffr4fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffr4fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffr4fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TLONG): ffr4fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TDOUBLE): ffr4fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffr4fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcle).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpclc( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ float *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of complex values to a column in the current FITS HDU. Each complex number if interpreted as a pair of float values. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column if necessary, but normally complex values should only be written to a binary table with TFORMn = 'rC' where r is an optional repeat count. The TSCALn and TZERO keywords should not be used with complex numbers because mathmatically the scaling should only be applied to the real (first) component of the complex value. */ { /* simply multiply the number of elements by 2, and call ffpcle */ ffpcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcne( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ float *array, /* I - array of values to write */ float nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ if (abs(tcode) >= TCOMPLEX) { /* treat complex columns as pairs of numbers */ repeat *= 2; } /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcle(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ /* call ffpcluc, not ffpclu, in case we are writing to a complex ('C') binary table column */ if (ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcle(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcle(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fi1(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fi2(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fi4(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else output[ii] = (INT32BIT) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fi8(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (long) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fr4(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { memcpy(output, input, ntodo * sizeof(float) ); /* copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fr8(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffr4fstr(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/grparser.c0000644000175000017500000013315212243255342016305 0ustar oleole/* T E M P L A T E P A R S E R ============================= by Jerzy.Borkowski@obs.unige.ch Integral Science Data Center ch. d'Ecogia 16 1290 Versoix Switzerland 14-Oct-98: initial release 16-Oct-98: code cleanup, #include included, now gcc -Wall prints no warnings during compilation. Bugfix: now one can specify additional columns in group HDU. Autoindexing also works in this situation (colunms are number from 7 however). 17-Oct-98: bugfix: complex keywords were incorrectly written (was TCOMPLEX should be TDBLCOMPLEX). 20-Oct-98: bugfix: parser was writing EXTNAME twice, when first HDU in template is defined with XTENSION IMAGE then parser creates now dummy PHDU, SIMPLE T is now allowed only at most once and in first HDU only. WARNING: one should not define EXTNAME keyword for GROUP HDUs, as they have them already defined by parser (EXTNAME = GROUPING). Parser accepts EXTNAME oin GROUP HDU definition, but in this case multiple EXTNAME keywords will present in HDU header. 23-Oct-98: bugfix: unnecessary space was written to FITS file for blank keywords. 24-Oct-98: syntax change: empty lines and lines with only whitespaces are written to FITS files as blank keywords (if inside group/hdu definition). Previously lines had to have at least 8 spaces. Please note, that due to pecularities of CFITSIO if the last keyword(s) defined for given HDU are blank keywords consisting of only 80 spaces, then (some of) those keywords may be silently deleted by CFITSIO. 13-Nov-98: bugfix: parser was writing GRPNAME twice. Parser still creates GRPNAME keywords for GROUP HDU's which do not specify them. However, values (of form DEFAULT_GROUP_XXX) are assigned not necessarily in order HDUs appear in template file, but rather in order parser completes their creation in FITS file. Also, when including files, if fopen fails, parser tries to open file with a name = directory_of_top_level file + name of file to be included, as long as name of file to be included does not specify absolute pathname. 16-Nov-98: bugfix to bugfix from 13-Nov-98 19-Nov-98: EXTVER keyword is now automatically assigned value by parser. 17-Dev-98: 2 new things added: 1st: CFITSIO_INCLUDE_FILES environment variable can contain a colon separated list of directories to look for when looking for template include files (and master template also). 2nd: it is now possible to append template to nonempty FITS. file. fitsfile *ff no longer needs to point to an empty FITS file with 0 HDUs in it. All data written by parser will simple be appended at the end of file. 22-Jan-99: changes to parser: when in append mode parser initially scans all existing HDUs to built a list of already used EXTNAME/EXTVERs 22-Jan-99: Bruce O'Neel, bugfix : TLONG should always reference long type variable on OSF/Alpha and on 64-bit archs in general 20-Jun-2002 Wm Pence, added support for the HIERARCH keyword convention in which keyword names can effectively be longer than 8 characters. Example: HIERARCH LongKeywordName = 'value' / comment 30-Jan-2003 Wm Pence, bugfix: ngp_read_xtension was testing for "ASCIITABLE" instead of "TABLE" as the XTENSION value of an ASCII table, and it did not allow for optional trailing spaces in the "IMAGE" or "TABLE" string. 16-Dec-2003 James Peachey: ngp_keyword_all_write was modified to apply comments from the template file to the output file in the case of reserved keywords (e.g. tform#, ttype# etcetera). */ #include #include #ifdef sparc #include #include #endif #include #include "fitsio2.h" #include "grparser.h" NGP_RAW_LINE ngp_curline = { NULL, NULL, NULL, NGP_TTYPE_UNKNOWN, NULL, NGP_FORMAT_OK, 0 }; NGP_RAW_LINE ngp_prevline = { NULL, NULL, NULL, NGP_TTYPE_UNKNOWN, NULL, NGP_FORMAT_OK, 0 }; int ngp_inclevel = 0; /* number of included files, 1 - means mean file */ int ngp_grplevel = 0; /* group nesting level, 0 - means no grouping */ FILE *ngp_fp[NGP_MAX_INCLUDE]; /* stack of included file handles */ int ngp_keyidx = NGP_TOKEN_UNKNOWN; /* index of token in current line */ NGP_TOKEN ngp_linkey; /* keyword after line analyze */ char ngp_master_dir[NGP_MAX_FNAME]; /* directory of top level include file */ NGP_TKDEF ngp_tkdef[] = /* tokens recognized by parser */ { { "\\INCLUDE", NGP_TOKEN_INCLUDE }, { "\\GROUP", NGP_TOKEN_GROUP }, { "\\END", NGP_TOKEN_END }, { "XTENSION", NGP_TOKEN_XTENSION }, { "SIMPLE", NGP_TOKEN_SIMPLE }, { NULL, NGP_TOKEN_UNKNOWN } }; int master_grp_idx = 1; /* current unnamed group in object */ int ngp_extver_tab_size = 0; NGP_EXTVER_TAB *ngp_extver_tab = NULL; int ngp_get_extver(char *extname, int *version) { NGP_EXTVER_TAB *p; char *p2; int i; if ((NULL == extname) || (NULL == version)) return(NGP_BAD_ARG); if ((NULL == ngp_extver_tab) && (ngp_extver_tab_size > 0)) return(NGP_BAD_ARG); if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG); for (i=0; i 0)) return(NGP_BAD_ARG); if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG); for (i=0; i ngp_extver_tab[i].version) ngp_extver_tab[i].version = version; return(NGP_OK); } } if (NULL == ngp_extver_tab) { p = (NGP_EXTVER_TAB *)ngp_alloc(sizeof(NGP_EXTVER_TAB)); } else { p = (NGP_EXTVER_TAB *)ngp_realloc(ngp_extver_tab, (ngp_extver_tab_size + 1) * sizeof(NGP_EXTVER_TAB)); } if (NULL == p) return(NGP_NO_MEMORY); p2 = ngp_alloc(strlen(extname) + 1); if (NULL == p2) { ngp_free(p); return(NGP_NO_MEMORY); } strcpy(p2, extname); ngp_extver_tab = p; ngp_extver_tab[ngp_extver_tab_size].extname = p2; ngp_extver_tab[ngp_extver_tab_size].version = version; ngp_extver_tab_size++; return(NGP_OK); } int ngp_delete_extver_tab(void) { int i; if ((NULL == ngp_extver_tab) && (ngp_extver_tab_size > 0)) return(NGP_BAD_ARG); if ((NULL != ngp_extver_tab) && (ngp_extver_tab_size <= 0)) return(NGP_BAD_ARG); if ((NULL == ngp_extver_tab) && (0 == ngp_extver_tab_size)) return(NGP_OK); for (i=0; i= 'a') && (c1 <= 'z')) c1 += ('A' - 'a'); c2 = *p2; if ((c2 >= 'a') && (c2 <= 'z')) c2 += ('A' - 'a'); if (c1 < c2) return(-1); if (c1 > c2) return(1); if (0 == c1) return(0); p1++; p2++; } } int ngp_strcasencmp(char *p1, char *p2, int n) { char c1, c2; int ii; for (ii=0;ii= 'a') && (c1 <= 'z')) c1 += ('A' - 'a'); c2 = *p2; if ((c2 >= 'a') && (c2 <= 'z')) c2 += ('A' - 'a'); if (c1 < c2) return(-1); if (c1 > c2) return(1); if (0 == c1) return(0); p1++; p2++; } return(0); } /* read one line from file */ int ngp_line_from_file(FILE *fp, char **p) { int c, r, llen, allocsize, alen; char *p2; if (NULL == fp) return(NGP_NUL_PTR); /* check for stupid args */ if (NULL == p) return(NGP_NUL_PTR); /* more foolproof checks */ r = NGP_OK; /* initialize stuff, reset err code */ llen = 0; /* 0 characters read so far */ *p = (char *)ngp_alloc(1); /* preallocate 1 byte */ allocsize = 1; /* signal that we have allocated 1 byte */ if (NULL == *p) return(NGP_NO_MEMORY); /* if this failed, system is in dire straits */ for (;;) { c = getc(fp); /* get next character */ if ('\r' == c) continue; /* carriage return character ? Just ignore it */ if (EOF == c) /* EOF signalled ? */ { if (ferror(fp)) r = NGP_READ_ERR; /* was it real error or simply EOF ? */ if (0 == llen) return(NGP_EOF); /* signal EOF only if 0 characters read so far */ break; } if ('\n' == c) break; /* end of line character ? */ llen++; /* we have new character, make room for it */ alen = ((llen + NGP_ALLOCCHUNK) / NGP_ALLOCCHUNK) * NGP_ALLOCCHUNK; if (alen > allocsize) { p2 = (char *)ngp_realloc(*p, alen); /* realloc buffer, if there is need */ if (NULL == p2) { r = NGP_NO_MEMORY; break; } *p = p2; allocsize = alen; } (*p)[llen - 1] = c; /* copy character to buffer */ } llen++; /* place for terminating \0 */ if (llen != allocsize) { p2 = (char *)ngp_realloc(*p, llen); if (NULL == p2) r = NGP_NO_MEMORY; else { *p = p2; (*p)[llen - 1] = 0; /* copy \0 to buffer */ } } else { (*p)[llen - 1] = 0; /* necessary when line read was empty */ } if ((NGP_EOF != r) && (NGP_OK != r)) /* in case of errors free resources */ { ngp_free(*p); *p = NULL; } return(r); /* return status code */ } /* free current line structure */ int ngp_free_line(void) { if (NULL != ngp_curline.line) { ngp_free(ngp_curline.line); ngp_curline.line = NULL; ngp_curline.name = NULL; ngp_curline.value = NULL; ngp_curline.comment = NULL; ngp_curline.type = NGP_TTYPE_UNKNOWN; ngp_curline.format = NGP_FORMAT_OK; ngp_curline.flags = 0; } return(NGP_OK); } /* free cached line structure */ int ngp_free_prevline(void) { if (NULL != ngp_prevline.line) { ngp_free(ngp_prevline.line); ngp_prevline.line = NULL; ngp_prevline.name = NULL; ngp_prevline.value = NULL; ngp_prevline.comment = NULL; ngp_prevline.type = NGP_TTYPE_UNKNOWN; ngp_prevline.format = NGP_FORMAT_OK; ngp_prevline.flags = 0; } return(NGP_OK); } /* read one line */ int ngp_read_line_buffered(FILE *fp) { ngp_free_line(); /* first free current line (if any) */ if (NULL != ngp_prevline.line) /* if cached, return cached line */ { ngp_curline = ngp_prevline; ngp_prevline.line = NULL; ngp_prevline.name = NULL; ngp_prevline.value = NULL; ngp_prevline.comment = NULL; ngp_prevline.type = NGP_TTYPE_UNKNOWN; ngp_prevline.format = NGP_FORMAT_OK; ngp_prevline.flags = 0; ngp_curline.flags = NGP_LINE_REREAD; return(NGP_OK); } ngp_curline.flags = 0; /* if not cached really read line from file */ return(ngp_line_from_file(fp, &(ngp_curline.line))); } /* unread line */ int ngp_unread_line(void) { if (NULL == ngp_curline.line) /* nothing to unread */ return(NGP_EMPTY_CURLINE); if (NULL != ngp_prevline.line) /* we cannot unread line twice */ return(NGP_UNREAD_QUEUE_FULL); ngp_prevline = ngp_curline; ngp_curline.line = NULL; return(NGP_OK); } /* a first guess line decomposition */ int ngp_extract_tokens(NGP_RAW_LINE *cl) { char *p, *s; int cl_flags, i; p = cl->line; /* start from beginning of line */ if (NULL == p) return(NGP_NUL_PTR); cl->name = cl->value = cl->comment = NULL; cl->type = NGP_TTYPE_UNKNOWN; cl->format = NGP_FORMAT_OK; cl_flags = 0; for (i=0;; i++) /* if 8 spaces at beginning then line is comment */ { if ((0 == *p) || ('\n' == *p)) { /* if line has only blanks -> write blank keyword */ cl->line[0] = 0; /* create empty name (0 length string) */ cl->comment = cl->name = cl->line; cl->type = NGP_TTYPE_RAW; /* signal write unformatted to FITS file */ return(NGP_OK); } if ((' ' != *p) && ('\t' != *p)) break; if (i >= 7) { cl->comment = p + 1; for (s = cl->comment;; s++) /* filter out any EOS characters in comment */ { if ('\n' == *s) *s = 0; if (0 == *s) break; } cl->line[0] = 0; /* create empty name (0 length string) */ cl->name = cl->line; cl->type = NGP_TTYPE_RAW; return(NGP_OK); } p++; } cl->name = p; for (;;) /* we need to find 1st whitespace */ { if ((0 == *p) || ('\n' == *p)) { *p = 0; break; } /* from Richard Mathar, 2002-05-03, add 10 lines: if upper/lowercase HIERARCH followed also by an equal sign... */ if( strncasecmp("HIERARCH",p,strlen("HIERARCH")) == 0 ) { char * const eqsi=strchr(p,'=') ; if( eqsi ) { cl_flags |= NGP_FOUND_EQUAL_SIGN ; p=eqsi ; break ; } } if ((' ' == *p) || ('\t' == *p)) break; if ('=' == *p) { cl_flags |= NGP_FOUND_EQUAL_SIGN; break; } p++; } if (*p) *(p++) = 0; /* found end of keyname so terminate string with zero */ if ((!ngp_strcasecmp("HISTORY", cl->name)) || (!ngp_strcasecmp("COMMENT", cl->name)) || (!ngp_strcasecmp("CONTINUE", cl->name))) { cl->comment = p; for (s = cl->comment;; s++) /* filter out any EOS characters in comment */ { if ('\n' == *s) *s = 0; if (0 == *s) break; } cl->type = NGP_TTYPE_RAW; return(NGP_OK); } if (!ngp_strcasecmp("\\INCLUDE", cl->name)) { for (;; p++) if ((' ' != *p) && ('\t' != *p)) break; /* skip whitespace */ cl->value = p; for (s = cl->value;; s++) /* filter out any EOS characters */ { if ('\n' == *s) *s = 0; if (0 == *s) break; } cl->type = NGP_TTYPE_UNKNOWN; return(NGP_OK); } for (;; p++) { if ((0 == *p) || ('\n' == *p)) return(NGP_OK); /* test if at end of string */ if ((' ' == *p) || ('\t' == *p)) continue; /* skip whitespace */ if (cl_flags & NGP_FOUND_EQUAL_SIGN) break; if ('=' != *p) break; /* ignore initial equal sign */ cl_flags |= NGP_FOUND_EQUAL_SIGN; } if ('/' == *p) /* no value specified, comment only */ { p++; if ((' ' == *p) || ('\t' == *p)) p++; cl->comment = p; for (s = cl->comment;; s++) /* filter out any EOS characters in comment */ { if ('\n' == *s) *s = 0; if (0 == *s) break; } return(NGP_OK); } if ('\'' == *p) /* we have found string within quotes */ { cl->value = s = ++p; /* set pointer to beginning of that string */ cl->type = NGP_TTYPE_STRING; /* signal that it is of string type */ for (;;) /* analyze it */ { if ((0 == *p) || ('\n' == *p)) /* end of line -> end of string */ { *s = 0; return(NGP_OK); } if ('\'' == *p) /* we have found doublequote */ { if ((0 == p[1]) || ('\n' == p[1]))/* doublequote is the last character in line */ { *s = 0; return(NGP_OK); } if (('\t' == p[1]) || (' ' == p[1])) /* duoblequote was string terminator */ { *s = 0; p++; break; } if ('\'' == p[1]) p++; /* doublequote is inside string, convert "" -> " */ } *(s++) = *(p++); /* compact string in place, necess. by "" -> " conversion */ } } else /* regular token */ { cl->value = p; /* set pointer to token */ cl->type = NGP_TTYPE_UNKNOWN; /* we dont know type at the moment */ for (;; p++) /* we need to find 1st whitespace */ { if ((0 == *p) || ('\n' == *p)) { *p = 0; return(NGP_OK); } if ((' ' == *p) || ('\t' == *p)) break; } if (*p) *(p++) = 0; /* found so terminate string with zero */ } for (;; p++) { if ((0 == *p) || ('\n' == *p)) return(NGP_OK); /* test if at end of string */ if ((' ' != *p) && ('\t' != *p)) break; /* skip whitespace */ } if ('/' == *p) /* no value specified, comment only */ { p++; if ((' ' == *p) || ('\t' == *p)) p++; cl->comment = p; for (s = cl->comment;; s++) /* filter out any EOS characters in comment */ { if ('\n' == *s) *s = 0; if (0 == *s) break; } return(NGP_OK); } cl->format = NGP_FORMAT_ERROR; return(NGP_OK); /* too many tokens ... */ } /* try to open include file. If open fails and fname does not specify absolute pathname, try to open fname in any directory specified in CFITSIO_INCLUDE_FILES environment variable. Finally try to open fname relative to ngp_master_dir, which is directory of top level include file */ int ngp_include_file(char *fname) /* try to open include file */ { char *p, *p2, *cp, *envar, envfiles[NGP_MAX_ENVFILES]; if (NULL == fname) return(NGP_NUL_PTR); if (ngp_inclevel >= NGP_MAX_INCLUDE) /* too many include files */ return(NGP_INC_NESTING); if (NULL == (ngp_fp[ngp_inclevel] = fopen(fname, "r"))) { /* if simple open failed .. */ envar = getenv("CFITSIO_INCLUDE_FILES"); /* scan env. variable, and retry to open */ if (NULL != envar) /* is env. variable defined ? */ { strncpy(envfiles, envar, NGP_MAX_ENVFILES - 1); envfiles[NGP_MAX_ENVFILES - 1] = 0; /* copy search path to local variable, env. is fragile */ for (p2 = strtok(envfiles, ":"); NULL != p2; p2 = strtok(NULL, ":")) { cp = (char *)ngp_alloc(strlen(fname) + strlen(p2) + 2); if (NULL == cp) return(NGP_NO_MEMORY); strcpy(cp, p2); #ifdef MSDOS strcat(cp, "\\"); /* abs. pathname for MSDOS */ #else strcat(cp, "/"); /* and for unix */ #endif strcat(cp, fname); ngp_fp[ngp_inclevel] = fopen(cp, "r"); ngp_free(cp); if (NULL != ngp_fp[ngp_inclevel]) break; } } if (NULL == ngp_fp[ngp_inclevel]) /* finally try to open relative to top level */ { #ifdef MSDOS if ('\\' == fname[0]) return(NGP_ERR_FOPEN); /* abs. pathname for MSDOS, does not support C:\\PATH */ #else if ('/' == fname[0]) return(NGP_ERR_FOPEN); /* and for unix */ #endif if (0 == ngp_master_dir[0]) return(NGP_ERR_FOPEN); p = ngp_alloc(strlen(fname) + strlen(ngp_master_dir) + 1); if (NULL == p) return(NGP_NO_MEMORY); strcpy(p, ngp_master_dir); /* construct composite pathname */ strcat(p, fname); /* comp = master + fname */ ngp_fp[ngp_inclevel] = fopen(p, "r");/* try to open composite */ ngp_free(p); /* we don't need buffer anymore */ if (NULL == ngp_fp[ngp_inclevel]) return(NGP_ERR_FOPEN); /* fail if error */ } } ngp_inclevel++; return(NGP_OK); } /* read line in the intelligent way. All \INCLUDE directives are handled, empty and comment line skipped. If this function returns NGP_OK, than decomposed line (name, type, value in proper type and comment) are stored in ngp_linkey structure. ignore_blank_lines parameter is zero when parser is inside GROUP or HDU definition. Nonzero otherwise. */ int ngp_read_line(int ignore_blank_lines) { int r, nc, savec; unsigned k; if (ngp_inclevel <= 0) /* do some sanity checking first */ { ngp_keyidx = NGP_TOKEN_EOF; /* no parents, so report error */ return(NGP_OK); } if (ngp_inclevel > NGP_MAX_INCLUDE) return(NGP_INC_NESTING); if (NULL == ngp_fp[ngp_inclevel - 1]) return(NGP_NUL_PTR); for (;;) { switch (r = ngp_read_line_buffered(ngp_fp[ngp_inclevel - 1])) { case NGP_EOF: ngp_inclevel--; /* end of file, revert to parent */ if (ngp_fp[ngp_inclevel]) /* we can close old file */ fclose(ngp_fp[ngp_inclevel]); ngp_fp[ngp_inclevel] = NULL; if (ngp_inclevel <= 0) { ngp_keyidx = NGP_TOKEN_EOF; /* no parents, so report error */ return(NGP_OK); } continue; case NGP_OK: if (ngp_curline.flags & NGP_LINE_REREAD) return(r); break; default: return(r); } switch (ngp_curline.line[0]) { case 0: if (0 == ignore_blank_lines) break; /* ignore empty lines if told so */ case '#': continue; /* ignore comment lines */ } r = ngp_extract_tokens(&ngp_curline); /* analyse line, extract tokens and comment */ if (NGP_OK != r) return(r); if (NULL == ngp_curline.name) continue; /* skip lines consisting only of whitespaces */ for (k = 0; k < strlen(ngp_curline.name); k++) { if ((ngp_curline.name[k] >= 'a') && (ngp_curline.name[k] <= 'z')) ngp_curline.name[k] += 'A' - 'a'; /* force keyword to be upper case */ if (k == 7) break; /* only first 8 chars are required to be upper case */ } for (k=0;; k++) /* find index of keyword in keyword table */ { if (NGP_TOKEN_UNKNOWN == ngp_tkdef[k].code) break; if (0 == strcmp(ngp_curline.name, ngp_tkdef[k].name)) break; } ngp_keyidx = ngp_tkdef[k].code; /* save this index, grammar parser will need this */ if (NGP_TOKEN_INCLUDE == ngp_keyidx) /* if this is \INCLUDE keyword, try to include file */ { if (NGP_OK != (r = ngp_include_file(ngp_curline.value))) return(r); continue; /* and read next line */ } ngp_linkey.type = NGP_TTYPE_UNKNOWN; /* now, get the keyword type, it's a long story ... */ if (NULL != ngp_curline.value) /* if no value given signal it */ { if (NGP_TTYPE_STRING == ngp_curline.type) /* string type test */ { ngp_linkey.type = NGP_TTYPE_STRING; ngp_linkey.value.s = ngp_curline.value; } if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* bool type test */ { if ((!ngp_strcasecmp("T", ngp_curline.value)) || (!ngp_strcasecmp("F", ngp_curline.value))) { ngp_linkey.type = NGP_TTYPE_BOOL; ngp_linkey.value.b = (ngp_strcasecmp("T", ngp_curline.value) ? 0 : 1); } } if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* complex type test */ { if (2 == sscanf(ngp_curline.value, "(%lg,%lg)%n", &(ngp_linkey.value.c.re), &(ngp_linkey.value.c.im), &nc)) { if ((' ' == ngp_curline.value[nc]) || ('\t' == ngp_curline.value[nc]) || ('\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc])) { ngp_linkey.type = NGP_TTYPE_COMPLEX; } } } if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* real type test */ { if (strchr(ngp_curline.value, '.') && (1 == sscanf(ngp_curline.value, "%lg%n", &(ngp_linkey.value.d), &nc))) { if ('D' == ngp_curline.value[nc]) { /* test if template used a 'D' rather than an 'E' as the exponent character (added by WDP in 12/2010) */ savec = nc; ngp_curline.value[nc] = 'E'; sscanf(ngp_curline.value, "%lg%n", &(ngp_linkey.value.d), &nc); if ((' ' == ngp_curline.value[nc]) || ('\t' == ngp_curline.value[nc]) || ('\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc])) { ngp_linkey.type = NGP_TTYPE_REAL; } else { /* no, this is not a real value */ ngp_curline.value[savec] = 'D'; /* restore the original D character */ } } else { if ((' ' == ngp_curline.value[nc]) || ('\t' == ngp_curline.value[nc]) || ('\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc])) { ngp_linkey.type = NGP_TTYPE_REAL; } } } } if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* integer type test */ { if (1 == sscanf(ngp_curline.value, "%d%n", &(ngp_linkey.value.i), &nc)) { if ((' ' == ngp_curline.value[nc]) || ('\t' == ngp_curline.value[nc]) || ('\n' == ngp_curline.value[nc]) || (0 == ngp_curline.value[nc])) { ngp_linkey.type = NGP_TTYPE_INT; } } } if (NGP_TTYPE_UNKNOWN == ngp_linkey.type) /* force string type */ { ngp_linkey.type = NGP_TTYPE_STRING; ngp_linkey.value.s = ngp_curline.value; } } else { if (NGP_TTYPE_RAW == ngp_curline.type) ngp_linkey.type = NGP_TTYPE_RAW; else ngp_linkey.type = NGP_TTYPE_NULL; } if (NULL != ngp_curline.comment) { strncpy(ngp_linkey.comment, ngp_curline.comment, NGP_MAX_COMMENT); /* store comment */ ngp_linkey.comment[NGP_MAX_COMMENT - 1] = 0; } else { ngp_linkey.comment[0] = 0; } strncpy(ngp_linkey.name, ngp_curline.name, NGP_MAX_NAME); /* and keyword's name */ ngp_linkey.name[NGP_MAX_NAME - 1] = 0; if (strlen(ngp_linkey.name) > FLEN_KEYWORD) /* WDP: 20-Jun-2002: mod to support HIERARCH */ { return(NGP_BAD_ARG); /* cfitsio does not allow names > 8 chars */ } return(NGP_OK); /* we have valid non empty line, so return success */ } } /* check whether keyword can be written as is */ int ngp_keyword_is_write(NGP_TOKEN *ngp_tok) { int i, j, l, spc; /* indexed variables not to write */ static char *nm[] = { "NAXIS", "TFORM", "TTYPE", NULL } ; /* non indexed variables not allowed to write */ static char *nmni[] = { "SIMPLE", "XTENSION", "BITPIX", "NAXIS", "PCOUNT", "GCOUNT", "TFIELDS", "THEAP", "EXTEND", "EXTVER", NULL } ; if (NULL == ngp_tok) return(NGP_NUL_PTR); for (j = 0; ; j++) /* first check non indexed */ { if (NULL == nmni[j]) break; if (0 == strcmp(nmni[j], ngp_tok->name)) return(NGP_BAD_ARG); } for (j = 0; ; j++) /* now check indexed */ { if (NULL == nm[j]) return(NGP_OK); l = strlen(nm[j]); if ((l < 1) || (l > 5)) continue; if (0 == strncmp(nm[j], ngp_tok->name, l)) break; } if ((ngp_tok->name[l] < '1') || (ngp_tok->name[l] > '9')) return(NGP_OK); spc = 0; for (i = l + 1; i < 8; i++) { if (spc) { if (' ' != ngp_tok->name[i]) return(NGP_OK); } else { if ((ngp_tok->name[i] >= '0') || (ngp_tok->name[i] <= '9')) continue; if (' ' == ngp_tok->name[i]) { spc = 1; continue; } if (0 == ngp_tok->name[i]) break; return(NGP_OK); } } return(NGP_BAD_ARG); } /* write (almost) all keywords from given HDU to disk */ int ngp_keyword_all_write(NGP_HDU *ngph, fitsfile *ffp, int mode) { int i, r, ib; char buf[200]; long l; if (NULL == ngph) return(NGP_NUL_PTR); if (NULL == ffp) return(NGP_NUL_PTR); r = NGP_OK; for (i=0; itokcnt; i++) { r = ngp_keyword_is_write(&(ngph->tok[i])); if ((NGP_REALLY_ALL & mode) || (NGP_OK == r)) { switch (ngph->tok[i].type) { case NGP_TTYPE_BOOL: ib = ngph->tok[i].value.b; fits_write_key(ffp, TLOGICAL, ngph->tok[i].name, &ib, ngph->tok[i].comment, &r); break; case NGP_TTYPE_STRING: fits_write_key_longstr(ffp, ngph->tok[i].name, ngph->tok[i].value.s, ngph->tok[i].comment, &r); break; case NGP_TTYPE_INT: l = ngph->tok[i].value.i; /* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */ fits_write_key(ffp, TLONG, ngph->tok[i].name, &l, ngph->tok[i].comment, &r); break; case NGP_TTYPE_REAL: fits_write_key(ffp, TDOUBLE, ngph->tok[i].name, &(ngph->tok[i].value.d), ngph->tok[i].comment, &r); break; case NGP_TTYPE_COMPLEX: fits_write_key(ffp, TDBLCOMPLEX, ngph->tok[i].name, &(ngph->tok[i].value.c), ngph->tok[i].comment, &r); break; case NGP_TTYPE_NULL: fits_write_key_null(ffp, ngph->tok[i].name, ngph->tok[i].comment, &r); break; case NGP_TTYPE_RAW: if (0 == strcmp("HISTORY", ngph->tok[i].name)) { fits_write_history(ffp, ngph->tok[i].comment, &r); break; } if (0 == strcmp("COMMENT", ngph->tok[i].name)) { fits_write_comment(ffp, ngph->tok[i].comment, &r); break; } sprintf(buf, "%-8.8s%s", ngph->tok[i].name, ngph->tok[i].comment); fits_write_record(ffp, buf, &r); break; } } else if (NGP_BAD_ARG == r) /* enhancement 10 dec 2003, James Peachey: template comments replace defaults */ { r = NGP_OK; /* update comments of special keywords like TFORM */ if (ngph->tok[i].comment && *ngph->tok[i].comment) /* do not update with a blank comment */ { fits_modify_comment(ffp, ngph->tok[i].name, ngph->tok[i].comment, &r); } } else /* other problem, typically a blank token */ { r = NGP_OK; /* skip this token, but continue */ } if (r) return(r); } fits_set_hdustruc(ffp, &r); /* resync cfitsio */ return(r); } /* init HDU structure */ int ngp_hdu_init(NGP_HDU *ngph) { if (NULL == ngph) return(NGP_NUL_PTR); ngph->tok = NULL; ngph->tokcnt = 0; return(NGP_OK); } /* clear HDU structure */ int ngp_hdu_clear(NGP_HDU *ngph) { int i; if (NULL == ngph) return(NGP_NUL_PTR); for (i=0; itokcnt; i++) { if (NGP_TTYPE_STRING == ngph->tok[i].type) if (NULL != ngph->tok[i].value.s) { ngp_free(ngph->tok[i].value.s); ngph->tok[i].value.s = NULL; } } if (NULL != ngph->tok) ngp_free(ngph->tok); ngph->tok = NULL; ngph->tokcnt = 0; return(NGP_OK); } /* insert new token to HDU structure */ int ngp_hdu_insert_token(NGP_HDU *ngph, NGP_TOKEN *newtok) { NGP_TOKEN *tkp; if (NULL == ngph) return(NGP_NUL_PTR); if (NULL == newtok) return(NGP_NUL_PTR); if (0 == ngph->tokcnt) tkp = (NGP_TOKEN *)ngp_alloc((ngph->tokcnt + 1) * sizeof(NGP_TOKEN)); else tkp = (NGP_TOKEN *)ngp_realloc(ngph->tok, (ngph->tokcnt + 1) * sizeof(NGP_TOKEN)); if (NULL == tkp) return(NGP_NO_MEMORY); ngph->tok = tkp; ngph->tok[ngph->tokcnt] = *newtok; if (NGP_TTYPE_STRING == newtok->type) { if (NULL != newtok->value.s) { ngph->tok[ngph->tokcnt].value.s = (char *)ngp_alloc(1 + strlen(newtok->value.s)); if (NULL == ngph->tok[ngph->tokcnt].value.s) return(NGP_NO_MEMORY); strcpy(ngph->tok[ngph->tokcnt].value.s, newtok->value.s); } } ngph->tokcnt++; return(NGP_OK); } int ngp_append_columns(fitsfile *ff, NGP_HDU *ngph, int aftercol) { int r, i, j, exitflg, ngph_i; char *my_tform, *my_ttype; char ngph_ctmp; if (NULL == ff) return(NGP_NUL_PTR); if (NULL == ngph) return(NGP_NUL_PTR); if (0 == ngph->tokcnt) return(NGP_OK); /* nothing to do ! */ r = NGP_OK; exitflg = 0; for (j=aftercol; jtok[i].name, "TFORM%d%c", &ngph_i, &ngph_ctmp)) { if ((NGP_TTYPE_STRING == ngph->tok[i].type) && (ngph_i == (j + 1))) { my_tform = ngph->tok[i].value.s; } } else if (1 == sscanf(ngph->tok[i].name, "TTYPE%d%c", &ngph_i, &ngph_ctmp)) { if ((NGP_TTYPE_STRING == ngph->tok[i].type) && (ngph_i == (j + 1))) { my_ttype = ngph->tok[i].value.s; } } if ((NULL != my_tform) && (my_ttype[0])) break; if (i < (ngph->tokcnt - 1)) continue; exitflg = 1; break; } if ((NGP_OK == r) && (NULL != my_tform)) fits_insert_col(ff, j + 1, my_ttype, my_tform, &r); if ((NGP_OK != r) || exitflg) break; } return(r); } /* read complete HDU */ int ngp_read_xtension(fitsfile *ff, int parent_hn, int simple_mode) { int r, exflg, l, my_hn, tmp0, incrementor_index, i, j; int ngph_dim, ngph_bitpix, ngph_node_type, my_version; char incrementor_name[NGP_MAX_STRING], ngph_ctmp; char *ngph_extname = 0; long ngph_size[NGP_MAX_ARRAY_DIM]; NGP_HDU ngph; long lv; incrementor_name[0] = 0; /* signal no keyword+'#' found yet */ incrementor_index = 0; if (NGP_OK != (r = ngp_hdu_init(&ngph))) return(r); if (NGP_OK != (r = ngp_read_line(0))) return(r); /* EOF always means error here */ switch (NGP_XTENSION_SIMPLE & simple_mode) { case 0: if (NGP_TOKEN_XTENSION != ngp_keyidx) return(NGP_TOKEN_NOT_EXPECT); break; default: if (NGP_TOKEN_SIMPLE != ngp_keyidx) return(NGP_TOKEN_NOT_EXPECT); break; } if (NGP_OK != (r = ngp_hdu_insert_token(&ngph, &ngp_linkey))) return(r); for (;;) { if (NGP_OK != (r = ngp_read_line(0))) return(r); /* EOF always means error here */ exflg = 0; switch (ngp_keyidx) { case NGP_TOKEN_SIMPLE: r = NGP_TOKEN_NOT_EXPECT; break; case NGP_TOKEN_END: case NGP_TOKEN_XTENSION: case NGP_TOKEN_GROUP: r = ngp_unread_line(); /* WARNING - not break here .... */ case NGP_TOKEN_EOF: exflg = 1; break; default: l = strlen(ngp_linkey.name); if ((l >= 2) && (l <= 6)) { if ('#' == ngp_linkey.name[l - 1]) { if (0 == incrementor_name[0]) { memcpy(incrementor_name, ngp_linkey.name, l - 1); incrementor_name[l - 1] = 0; } if (((l - 1) == (int)strlen(incrementor_name)) && (0 == memcmp(incrementor_name, ngp_linkey.name, l - 1))) { incrementor_index++; } sprintf(ngp_linkey.name + l - 1, "%d", incrementor_index); } } r = ngp_hdu_insert_token(&ngph, &ngp_linkey); break; } if ((NGP_OK != r) || exflg) break; } if (NGP_OK == r) { /* we should scan keywords, and calculate HDU's */ /* structure ourselves .... */ ngph_node_type = NGP_NODE_INVALID; /* init variables */ ngph_bitpix = 0; ngph_extname = NULL; for (i=0; i=1) && (j <= NGP_MAX_ARRAY_DIM)) { ngph_size[j - 1] = ngph.tok[i].value.i; } } } switch (ngph_node_type) { case NGP_NODE_IMAGE: if (NGP_XTENSION_FIRST == ((NGP_XTENSION_FIRST | NGP_XTENSION_SIMPLE) & simple_mode)) { /* if caller signals that this is 1st HDU in file */ /* and it is IMAGE defined with XTENSION, then we */ /* need create dummy Primary HDU */ fits_create_img(ff, 16, 0, NULL, &r); } /* create image */ fits_create_img(ff, ngph_bitpix, ngph_dim, ngph_size, &r); /* update keywords */ if (NGP_OK == r) r = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY); break; case NGP_NODE_ATABLE: case NGP_NODE_BTABLE: /* create table, 0 rows and 0 columns for the moment */ fits_create_tbl(ff, ((NGP_NODE_ATABLE == ngph_node_type) ? ASCII_TBL : BINARY_TBL), 0, 0, NULL, NULL, NULL, NULL, &r); if (NGP_OK != r) break; /* add columns ... */ r = ngp_append_columns(ff, &ngph, 0); if (NGP_OK != r) break; /* add remaining keywords */ r = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY); if (NGP_OK != r) break; /* if requested add rows */ if (ngph_size[1] > 0) fits_insert_rows(ff, 0, ngph_size[1], &r); break; default: r = NGP_BAD_ARG; break; } } if ((NGP_OK == r) && (NULL != ngph_extname)) { r = ngp_get_extver(ngph_extname, &my_version); /* write correct ext version number */ lv = my_version; /* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */ fits_write_key(ff, TLONG, "EXTVER", &lv, "auto assigned by template parser", &r); } if (NGP_OK == r) { if (parent_hn > 0) { fits_get_hdu_num(ff, &my_hn); fits_movabs_hdu(ff, parent_hn, &tmp0, &r); /* link us to parent */ fits_add_group_member(ff, NULL, my_hn, &r); fits_movabs_hdu(ff, my_hn, &tmp0, &r); if (NGP_OK != r) return(r); } } if (NGP_OK != r) /* in case of error - delete hdu */ { tmp0 = 0; fits_delete_hdu(ff, NULL, &tmp0); } ngp_hdu_clear(&ngph); return(r); } /* read complete GROUP */ int ngp_read_group(fitsfile *ff, char *grpname, int parent_hn) { int r, exitflg, l, my_hn, tmp0, incrementor_index; char grnm[NGP_MAX_STRING]; /* keyword holding group name */ char incrementor_name[NGP_MAX_STRING]; NGP_HDU ngph; incrementor_name[0] = 0; /* signal no keyword+'#' found yet */ incrementor_index = 6; /* first 6 cols are used by group */ ngp_grplevel++; if (NGP_OK != (r = ngp_hdu_init(&ngph))) return(r); r = NGP_OK; if (NGP_OK != (r = fits_create_group(ff, grpname, GT_ID_ALL_URI, &r))) return(r); fits_get_hdu_num(ff, &my_hn); if (parent_hn > 0) { fits_movabs_hdu(ff, parent_hn, &tmp0, &r); /* link us to parent */ fits_add_group_member(ff, NULL, my_hn, &r); fits_movabs_hdu(ff, my_hn, &tmp0, &r); if (NGP_OK != r) return(r); } for (exitflg = 0; 0 == exitflg;) { if (NGP_OK != (r = ngp_read_line(0))) break; /* EOF always means error here */ switch (ngp_keyidx) { case NGP_TOKEN_SIMPLE: case NGP_TOKEN_EOF: r = NGP_TOKEN_NOT_EXPECT; break; case NGP_TOKEN_END: ngp_grplevel--; exitflg = 1; break; case NGP_TOKEN_GROUP: if (NGP_TTYPE_STRING == ngp_linkey.type) { strncpy(grnm, ngp_linkey.value.s, NGP_MAX_STRING); } else { sprintf(grnm, "DEFAULT_GROUP_%d", master_grp_idx++); } grnm[NGP_MAX_STRING - 1] = 0; r = ngp_read_group(ff, grnm, my_hn); break; /* we can have many subsequent GROUP defs */ case NGP_TOKEN_XTENSION: r = ngp_unread_line(); if (NGP_OK != r) break; r = ngp_read_xtension(ff, my_hn, 0); break; /* we can have many subsequent HDU defs */ default: l = strlen(ngp_linkey.name); if ((l >= 2) && (l <= 6)) { if ('#' == ngp_linkey.name[l - 1]) { if (0 == incrementor_name[0]) { memcpy(incrementor_name, ngp_linkey.name, l - 1); incrementor_name[l - 1] = 0; } if (((l - 1) == (int)strlen(incrementor_name)) && (0 == memcmp(incrementor_name, ngp_linkey.name, l - 1))) { incrementor_index++; } sprintf(ngp_linkey.name + l - 1, "%d", incrementor_index); } } r = ngp_hdu_insert_token(&ngph, &ngp_linkey); break; /* here we can add keyword */ } if (NGP_OK != r) break; } fits_movabs_hdu(ff, my_hn, &tmp0, &r); /* back to our HDU */ if (NGP_OK == r) /* create additional columns, if requested */ r = ngp_append_columns(ff, &ngph, 6); if (NGP_OK == r) /* and write keywords */ r = ngp_keyword_all_write(&ngph, ff, NGP_NON_SYSTEM_ONLY); if (NGP_OK != r) /* delete group in case of error */ { tmp0 = 0; fits_remove_group(ff, OPT_RM_GPT, &tmp0); } ngp_hdu_clear(&ngph); /* we are done with this HDU, so delete it */ return(r); } /* top level API functions */ /* read whole template. ff should point to the opened empty fits file. */ int fits_execute_template(fitsfile *ff, char *ngp_template, int *status) { int r, exit_flg, first_extension, i, my_hn, tmp0, keys_exist, more_keys, used_ver; char grnm[NGP_MAX_STRING], used_name[NGP_MAX_STRING]; long luv; if (NULL == status) return(NGP_NUL_PTR); if (NGP_OK != *status) return(*status); if ((NULL == ff) || (NULL == ngp_template)) { *status = NGP_NUL_PTR; return(*status); } ngp_inclevel = 0; /* initialize things, not all should be zero */ ngp_grplevel = 0; master_grp_idx = 1; exit_flg = 0; ngp_master_dir[0] = 0; /* this should be before 1st call to ngp_include_file */ first_extension = 1; /* we need to create PHDU */ if (NGP_OK != (r = ngp_delete_extver_tab())) { *status = r; return(r); } fits_get_hdu_num(ff, &my_hn); /* our HDU position */ if (my_hn <= 1) /* check whether we really need to create PHDU */ { fits_movabs_hdu(ff, 1, &tmp0, status); fits_get_hdrspace(ff, &keys_exist, &more_keys, status); fits_movabs_hdu(ff, my_hn, &tmp0, status); if (NGP_OK != *status) return(*status); /* error here means file is corrupted */ if (keys_exist > 0) first_extension = 0; /* if keywords exist assume PHDU already exist */ } else { first_extension = 0; /* PHDU (followed by 1+ extensions) exist */ for (i = 2; i<= my_hn; i++) { *status = NGP_OK; fits_movabs_hdu(ff, 1, &tmp0, status); if (NGP_OK != *status) break; fits_read_key(ff, TSTRING, "EXTNAME", used_name, NULL, status); if (NGP_OK != *status) continue; fits_read_key(ff, TLONG, "EXTVER", &luv, NULL, status); used_ver = luv; /* bugfix - 22-Jan-99, BO - nonalignment of OSF/Alpha */ if (VALUE_UNDEFINED == *status) { used_ver = 1; *status = NGP_OK; } if (NGP_OK == *status) *status = ngp_set_extver(used_name, used_ver); } fits_movabs_hdu(ff, my_hn, &tmp0, status); } if (NGP_OK != *status) return(*status); if (NGP_OK != (*status = ngp_include_file(ngp_template))) return(*status); for (i = strlen(ngp_template) - 1; i >= 0; i--) /* strlen is > 0, otherwise fopen failed */ { #ifdef MSDOS if ('\\' == ngp_template[i]) break; #else if ('/' == ngp_template[i]) break; #endif } i++; if (i > (NGP_MAX_FNAME - 1)) i = NGP_MAX_FNAME - 1; if (i > 0) { memcpy(ngp_master_dir, ngp_template, i); ngp_master_dir[i] = 0; } for (;;) { if (NGP_OK != (r = ngp_read_line(1))) break; /* EOF always means error here */ switch (ngp_keyidx) { case NGP_TOKEN_SIMPLE: if (0 == first_extension) /* simple only allowed in first HDU */ { r = NGP_TOKEN_NOT_EXPECT; break; } if (NGP_OK != (r = ngp_unread_line())) break; r = ngp_read_xtension(ff, 0, NGP_XTENSION_SIMPLE | NGP_XTENSION_FIRST); first_extension = 0; break; case NGP_TOKEN_XTENSION: if (NGP_OK != (r = ngp_unread_line())) break; r = ngp_read_xtension(ff, 0, (first_extension ? NGP_XTENSION_FIRST : 0)); first_extension = 0; break; case NGP_TOKEN_GROUP: if (NGP_TTYPE_STRING == ngp_linkey.type) { strncpy(grnm, ngp_linkey.value.s, NGP_MAX_STRING); } else { sprintf(grnm, "DEFAULT_GROUP_%d", master_grp_idx++); } grnm[NGP_MAX_STRING - 1] = 0; r = ngp_read_group(ff, grnm, 0); first_extension = 0; break; case NGP_TOKEN_EOF: exit_flg = 1; break; default: r = NGP_TOKEN_NOT_EXPECT; break; } if (exit_flg || (NGP_OK != r)) break; } /* all top level HDUs up to faulty one are left intact in case of i/o error. It is up to the caller to call fits_close_file or fits_delete_file when this function returns error. */ ngp_free_line(); /* deallocate last line (if any) */ ngp_free_prevline(); /* deallocate cached line (if any) */ ngp_delete_extver_tab(); /* delete extver table (if present), error ignored */ *status = r; return(r); } astropy-0.3/cextern/cfitsio/getcolb.c0000644000175000017500000022531412243255342016101 0ustar oleole/* This file, getcolb.c, contains routines that read data elements from */ /* a FITS image or table, with unsigned char (unsigned byte) data type. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned char nulval, /* I - value for undefined pixels */ unsigned char *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; unsigned char nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TBYTE, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclb(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned char *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TBYTE, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclb(fptr, 2, row, firstelem, nelem, 1, 2, 0, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2db(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned char nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3db(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3db(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned char nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; LONGLONG narray, nfits; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}; LONGLONG lpixel[3]; unsigned char nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TBYTE, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgclb(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgclb(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned char nulval, /* I - value to set undefined pixels */ unsigned char *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii, i0, i1, i2, i3, i4, i5, i6, i7, i8, row, rstr, rstp, rinc; long str[9], stp[9], incr[9], dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; unsigned char nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvb is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TBYTE, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvb: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgclb(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned char *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; unsigned char nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvb is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TBYTE, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvb: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclb(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpb( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ unsigned char *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclb(fptr, 1, row, firstelem, nelem, 1, 1, 0, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned char nulval, /* I - value for null pixels */ unsigned char *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfb(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned char *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { unsigned char dummy = 0; ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgclb( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ unsigned char nulval, /* I - value for null pixels if nultyp = 1 */ unsigned char *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre, ntodo; long ii, xwidth; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; union u_tag { char charval; unsigned char ucharval; } u; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status); maxelem = maxelem2; /* special case */ if (tcode == TLOGICAL && elemincre == 1) { u.ucharval = nulval; ffgcll(fptr, colnum, firstrow, firstelem, nelem, nultyp, u.charval, (char *) array, nularray, anynul, status); return(*status); } if (strchr(tform,'A') != NULL) { if (*status == BAD_ELEM_NUM) { /* ignore this error message */ *status = 0; ffcmsg(); /* clear error stack */ } /* interpret a 'A' ASCII column as a 'B' byte column ('8A' == '8B') */ /* This is an undocumented 'feature' in CFITSIO */ /* we have to reset some of the values returned by ffgcpr */ tcode = TBYTE; incre = 1; /* each element is 1 byte wide */ repeat = twidth; /* total no. of chars in the col */ twidth = 1; /* width of each element */ scale = 1.0; /* no scaling */ zero = 0.0; tnull = NULL_UNDEFINED; /* don't test for nulls */ maxelem = DBUFFSIZE; } if (*status > 0) return(*status); incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING && hdutype == ASCII_TBL) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default, check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TBYTE) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, &array[next], status); if (convert) fffi1i1(&array[next], ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2i1((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4i1((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8i1( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4i1((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8i1((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); /* interpret the string as an ASCII formated number */ fffstri1((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read bytes from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclb).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclb).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgextn( fitsfile *fptr, /* I - FITS file pointer */ LONGLONG offset, /* I - byte offset from start of extension data */ LONGLONG nelem, /* I - number of elements to read */ void *buffer, /* I - stream of bytes to read */ int *status) /* IO - error status */ /* Read a stream of bytes from the current FITS HDU. This primative routine is mainly for reading non-standard "conforming" extensions and should not be used for standard IMAGE, TABLE or BINTABLE extensions. */ { if (*status > 0) /* inherit input status value if > 0 */ return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); /* rescan header if data structure is undefined */ else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) if ( ffrdef(fptr, status) > 0) return(*status); /* move to write position */ ffmbyt(fptr, (fptr->Fptr)->datastart+ offset, IGNORE_EOF, status); /* read the buffer */ ffgbyt(fptr, nelem, buffer, status); return(*status); } /*--------------------------------------------------------------------------*/ int fffi1i1(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { /* this routine is normally not called in this case */ memcpy(output, input, ntodo ); } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2i1(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4i1(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8i1(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4i1(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { /* use redundant boolean logic in following statement */ /* to suppress irritating Borland compiler warning message */ if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8i1(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char nullval,/* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output,/* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstri1(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ unsigned char nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned char *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/fits_hcompress.c0000644000175000017500000013365012243255342017513 0ustar oleole/* ######################################################################### These routines to apply the H-compress compression algorithm to a 2-D Fits image were written by R. White at the STScI and were obtained from the STScI at http://www.stsci.edu/software/hcompress.html This source file is a concatination of the following sources files in the original distribution htrans.c digitize.c encode.c qwrite.c doencode.c bit_output.c qtree_encode.c The following modifications have been made to the original code: - commented out redundant "include" statements - added the noutchar global variable - changed all the 'extern' declarations to 'static', since all the routines are in the same source file - changed the first parameter in encode (and in lower level routines from a file stream to a char array - modifid the encode routine to return the size of the compressed array of bytes - changed calls to printf and perror to call the CFITSIO ffpmsg routine - modified the mywrite routine, and lower level byte writing routines, to copy the output bytes to a char array, instead of writing them to a file stream - replace "exit" statements with "return" statements - changed the function declarations to the more modern ANSI C style ############################################################################ */ #include #include #include #include #include "fitsio2.h" static long noutchar; static long noutmax; static int htrans(int a[],int nx,int ny); static void digitize(int a[], int nx, int ny, int scale); static int encode(char *outfile, long *nlen, int a[], int nx, int ny, int scale); static void shuffle(int a[], int n, int n2, int tmp[]); static int htrans64(LONGLONG a[],int nx,int ny); static void digitize64(LONGLONG a[], int nx, int ny, int scale); static int encode64(char *outfile, long *nlen, LONGLONG a[], int nx, int ny, int scale); static void shuffle64(LONGLONG a[], int n, int n2, LONGLONG tmp[]); static void writeint(char *outfile, int a); static void writelonglong(char *outfile, LONGLONG a); static int doencode(char *outfile, int a[], int nx, int ny, unsigned char nbitplanes[3]); static int doencode64(char *outfile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3]); static int qwrite(char *file, char buffer[], int n); static int qtree_encode(char *outfile, int a[], int n, int nqx, int nqy, int nbitplanes); static int qtree_encode64(char *outfile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes); static void start_outputing_bits(void); static void done_outputing_bits(char *outfile); static void output_nbits(char *outfile, int bits, int n); static void qtree_onebit(int a[], int n, int nx, int ny, unsigned char b[], int bit); static void qtree_onebit64(LONGLONG a[], int n, int nx, int ny, unsigned char b[], int bit); static void qtree_reduce(unsigned char a[], int n, int nx, int ny, unsigned char b[]); static int bufcopy(unsigned char a[], int n, unsigned char buffer[], int *b, int bmax); static void write_bdirect(char *outfile, int a[], int n,int nqx, int nqy, unsigned char scratch[], int bit); static void write_bdirect64(char *outfile, LONGLONG a[], int n,int nqx, int nqy, unsigned char scratch[], int bit); /* #define output_nybble(outfile,c) output_nbits(outfile,c,4) */ static void output_nybble(char *outfile, int bits); static void output_nnybble(char *outfile, int n, unsigned char array[]); #define output_huffman(outfile,c) output_nbits(outfile,code[c],ncode[c]) /* ---------------------------------------------------------------------- */ int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status) { /* compress the input image using the H-compress algorithm a - input image array nx - size of X axis of image ny - size of Y axis of image scale - quantization scale factor. Larger values results in more (lossy) compression scale = 0 does lossless compression output - pre-allocated array to hold the output compressed stream of bytes nbyts - input value = size of the output buffer; returned value = size of the compressed byte stream, in bytes NOTE: the nx and ny dimensions as defined within this code are reversed from the usual FITS notation. ny is the fastest varying dimension, which is usually considered the X axis in the FITS image display */ int stat; if (*status > 0) return(*status); /* H-transform */ stat = htrans(a, nx, ny); if (stat) { *status = stat; return(*status); } /* digitize */ digitize(a, nx, ny, scale); /* encode and write to output array */ FFLOCK; noutmax = *nbytes; /* input value is the allocated size of the array */ *nbytes = 0; /* reset */ stat = encode(output, nbytes, a, nx, ny, scale); FFUNLOCK; *status = stat; return(*status); } /* ---------------------------------------------------------------------- */ int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status) { /* compress the input image using the H-compress algorithm a - input image array nx - size of X axis of image ny - size of Y axis of image scale - quantization scale factor. Larger values results in more (lossy) compression scale = 0 does lossless compression output - pre-allocated array to hold the output compressed stream of bytes nbyts - size of the compressed byte stream, in bytes NOTE: the nx and ny dimensions as defined within this code are reversed from the usual FITS notation. ny is the fastest varying dimension, which is usually considered the X axis in the FITS image display */ int stat; if (*status > 0) return(*status); /* H-transform */ stat = htrans64(a, nx, ny); if (stat) { *status = stat; return(*status); } /* digitize */ digitize64(a, nx, ny, scale); /* encode and write to output array */ FFLOCK; noutmax = *nbytes; /* input value is the allocated size of the array */ *nbytes = 0; /* reset */ stat = encode64(output, nbytes, a, nx, ny, scale); FFUNLOCK; *status = stat; return(*status); } /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* htrans.c H-transform of NX x NY integer image * * Programmer: R. White Date: 11 May 1992 */ /* ######################################################################### */ static int htrans(int a[],int nx,int ny) { int nmax, log2n, h0, hx, hy, hc, nxtop, nytop, i, j, k; int oddx, oddy; int shift, mask, mask2, prnd, prnd2, nrnd2; int s10, s00; int *tmp; /* * log2n is log2 of max(nx,ny) rounded up to next power of 2 */ nmax = (nx>ny) ? nx : ny; log2n = (int) (log((float) nmax)/log(2.0)+0.5); if ( nmax > (1<> shift; hx = (a[s10+1] + a[s10] - a[s00+1] - a[s00]) >> shift; hy = (a[s10+1] - a[s10] + a[s00+1] - a[s00]) >> shift; hc = (a[s10+1] - a[s10] - a[s00+1] + a[s00]) >> shift; /* * Throw away the 2 bottom bits of h0, bottom bit of hx,hy. * To get rounding to be same for positive and negative * numbers, nrnd2 = prnd2 - 1. */ a[s10+1] = hc; a[s10 ] = ( (hx>=0) ? (hx+prnd) : hx ) & mask ; a[s00+1] = ( (hy>=0) ? (hy+prnd) : hy ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 2; s10 += 2; } if (oddy) { /* * do last element in row if row length is odd * s00+1, s10+1 are off edge */ h0 = (a[s10] + a[s00]) << (1-shift); hx = (a[s10] - a[s00]) << (1-shift); a[s10 ] = ( (hx>=0) ? (hx+prnd) : hx ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 1; s10 += 1; } } if (oddx) { /* * do last row if column length is odd * s10, s10+1 are off edge */ s00 = i*ny; for (j = 0; j=0) ? (hy+prnd) : hy ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 2; } if (oddy) { /* * do corner element if both row and column lengths are odd * s00+1, s10, s10+1 are off edge */ h0 = a[s00] << (2-shift); a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; } } /* * now shuffle in each dimension to group coefficients by order */ for (i = 0; i>1; nytop = (nytop+1)>>1; /* * divisor doubles after first reduction */ shift = 1; /* * masks, rounding values double after each iteration */ mask = mask2; prnd = prnd2; mask2 = mask2 << 1; prnd2 = prnd2 << 1; nrnd2 = prnd2 - 1; } free(tmp); return(0); } /* ######################################################################### */ static int htrans64(LONGLONG a[],int nx,int ny) { int nmax, log2n, nxtop, nytop, i, j, k; int oddx, oddy; int shift; int s10, s00; LONGLONG h0, hx, hy, hc, prnd, prnd2, nrnd2, mask, mask2; LONGLONG *tmp; /* * log2n is log2 of max(nx,ny) rounded up to next power of 2 */ nmax = (nx>ny) ? nx : ny; log2n = (int) (log((float) nmax)/log(2.0)+0.5); if ( nmax > (1<> shift; hx = (a[s10+1] + a[s10] - a[s00+1] - a[s00]) >> shift; hy = (a[s10+1] - a[s10] + a[s00+1] - a[s00]) >> shift; hc = (a[s10+1] - a[s10] - a[s00+1] + a[s00]) >> shift; /* * Throw away the 2 bottom bits of h0, bottom bit of hx,hy. * To get rounding to be same for positive and negative * numbers, nrnd2 = prnd2 - 1. */ a[s10+1] = hc; a[s10 ] = ( (hx>=0) ? (hx+prnd) : hx ) & mask ; a[s00+1] = ( (hy>=0) ? (hy+prnd) : hy ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 2; s10 += 2; } if (oddy) { /* * do last element in row if row length is odd * s00+1, s10+1 are off edge */ h0 = (a[s10] + a[s00]) << (1-shift); hx = (a[s10] - a[s00]) << (1-shift); a[s10 ] = ( (hx>=0) ? (hx+prnd) : hx ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 1; s10 += 1; } } if (oddx) { /* * do last row if column length is odd * s10, s10+1 are off edge */ s00 = i*ny; for (j = 0; j=0) ? (hy+prnd) : hy ) & mask ; a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; s00 += 2; } if (oddy) { /* * do corner element if both row and column lengths are odd * s00+1, s10, s10+1 are off edge */ h0 = a[s00] << (2-shift); a[s00 ] = ( (h0>=0) ? (h0+prnd2) : (h0+nrnd2) ) & mask2; } } /* * now shuffle in each dimension to group coefficients by order */ for (i = 0; i>1; nytop = (nytop+1)>>1; /* * divisor doubles after first reduction */ shift = 1; /* * masks, rounding values double after each iteration */ mask = mask2; prnd = prnd2; mask2 = mask2 << 1; prnd2 = prnd2 << 1; nrnd2 = prnd2 - 1; } free(tmp); return(0); } /* ######################################################################### */ static void shuffle(int a[], int n, int n2, int tmp[]) { /* int a[]; array to shuffle int n; number of elements to shuffle int n2; second dimension int tmp[]; scratch storage */ int i; int *p1, *p2, *pt; /* * copy odd elements to tmp */ pt = tmp; p1 = &a[n2]; for (i=1; i < n; i += 2) { *pt = *p1; pt += 1; p1 += (n2+n2); } /* * compress even elements into first half of A */ p1 = &a[n2]; p2 = &a[n2+n2]; for (i=2; i0) ? (*p+d) : (*p-d))/scale; } /* ######################################################################### */ static void digitize64(LONGLONG a[], int nx, int ny, int scale) { LONGLONG d, *p, scale64; /* * round to multiple of scale */ if (scale <= 1) return; d=(scale+1)/2-1; scale64 = scale; /* use a 64-bit int for efficiency in the big loop */ for (p=a; p <= &a[nx*ny-1]; p++) *p = ((*p>0) ? (*p+d) : (*p-d))/scale64; } /* ######################################################################### */ /* ######################################################################### */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* encode.c encode H-transform and write to outfile * * Programmer: R. White Date: 2 February 1994 */ static char code_magic[2] = { (char)0xDD, (char)0x99 }; /* ######################################################################### */ static int encode(char *outfile, long *nlength, int a[], int nx, int ny, int scale) { /* FILE *outfile; - change outfile to a char array */ /* long * nlength returned length (in bytes) of the encoded array) int a[]; input H-transform array (nx,ny) int nx,ny; size of H-transform array int scale; scale factor for digitization */ int nel, nx2, ny2, i, j, k, q, vmax[3], nsign, bits_to_go; unsigned char nbitplanes[3]; unsigned char *signbits; int stat; noutchar = 0; /* initialize the number of compressed bytes that have been written */ nel = nx*ny; /* * write magic value */ qwrite(outfile, code_magic, sizeof(code_magic)); writeint(outfile, nx); /* size of image */ writeint(outfile, ny); writeint(outfile, scale); /* scale factor for digitization */ /* * write first value of A (sum of all pixels -- the only value * which does not compress well) */ writelonglong(outfile, (LONGLONG) a[0]); a[0] = 0; /* * allocate array for sign bits and save values, 8 per byte */ signbits = (unsigned char *) malloc((nel+7)/8); if (signbits == (unsigned char *) NULL) { ffpmsg("encode: insufficient memory"); return(DATA_COMPRESSION_ERR); } nsign = 0; bits_to_go = 8; signbits[0] = 0; for (i=0; i 0) { /* * positive element, put zero at end of buffer */ signbits[nsign] <<= 1; bits_to_go -= 1; } else if (a[i] < 0) { /* * negative element, shift in a one */ signbits[nsign] <<= 1; signbits[nsign] |= 1; bits_to_go -= 1; /* * replace a by absolute value */ a[i] = -a[i]; } if (bits_to_go == 0) { /* * filled up this byte, go to the next one */ bits_to_go = 8; nsign += 1; signbits[nsign] = 0; } } if (bits_to_go != 8) { /* * some bits in last element * move bits in last byte to bottom and increment nsign */ signbits[nsign] <<= bits_to_go; nsign += 1; } /* * calculate number of bit planes for 3 quadrants * * quadrant 0=bottom left, 1=bottom right or top left, 2=top right, */ for (q=0; q<3; q++) { vmax[q] = 0; } /* * get maximum absolute value in each quadrant */ nx2 = (nx+1)/2; ny2 = (ny+1)/2; j=0; /* column counter */ k=0; /* row counter */ for (i=0; i=ny2) + (k>=nx2); if (vmax[q] < a[i]) vmax[q] = a[i]; if (++j >= ny) { j = 0; k += 1; } } /* * now calculate number of bits for each quadrant */ /* this is a more efficient way to do this, */ for (q = 0; q < 3; q++) { for (nbitplanes[q] = 0; vmax[q]>0; vmax[q] = vmax[q]>>1, nbitplanes[q]++) ; } /* for (q = 0; q < 3; q++) { nbitplanes[q] = (int) (log((float) (vmax[q]+1))/log(2.0)+0.5); if ( (vmax[q]+1) > (1< 0) { if ( 0 == qwrite(outfile, (char *) signbits, nsign)) { free(signbits); *nlength = noutchar; ffpmsg("encode: output buffer too small"); return(DATA_COMPRESSION_ERR); } } free(signbits); *nlength = noutchar; if (noutchar >= noutmax) { ffpmsg("encode: output buffer too small"); return(DATA_COMPRESSION_ERR); } return(stat); } /* ######################################################################### */ static int encode64(char *outfile, long *nlength, LONGLONG a[], int nx, int ny, int scale) { /* FILE *outfile; - change outfile to a char array */ /* long * nlength returned length (in bytes) of the encoded array) LONGLONG a[]; input H-transform array (nx,ny) int nx,ny; size of H-transform array int scale; scale factor for digitization */ int nel, nx2, ny2, i, j, k, q, nsign, bits_to_go; LONGLONG vmax[3]; unsigned char nbitplanes[3]; unsigned char *signbits; int stat; noutchar = 0; /* initialize the number of compressed bytes that have been written */ nel = nx*ny; /* * write magic value */ qwrite(outfile, code_magic, sizeof(code_magic)); writeint(outfile, nx); /* size of image */ writeint(outfile, ny); writeint(outfile, scale); /* scale factor for digitization */ /* * write first value of A (sum of all pixels -- the only value * which does not compress well) */ writelonglong(outfile, a[0]); a[0] = 0; /* * allocate array for sign bits and save values, 8 per byte */ signbits = (unsigned char *) malloc((nel+7)/8); if (signbits == (unsigned char *) NULL) { ffpmsg("encode64: insufficient memory"); return(DATA_COMPRESSION_ERR); } nsign = 0; bits_to_go = 8; signbits[0] = 0; for (i=0; i 0) { /* * positive element, put zero at end of buffer */ signbits[nsign] <<= 1; bits_to_go -= 1; } else if (a[i] < 0) { /* * negative element, shift in a one */ signbits[nsign] <<= 1; signbits[nsign] |= 1; bits_to_go -= 1; /* * replace a by absolute value */ a[i] = -a[i]; } if (bits_to_go == 0) { /* * filled up this byte, go to the next one */ bits_to_go = 8; nsign += 1; signbits[nsign] = 0; } } if (bits_to_go != 8) { /* * some bits in last element * move bits in last byte to bottom and increment nsign */ signbits[nsign] <<= bits_to_go; nsign += 1; } /* * calculate number of bit planes for 3 quadrants * * quadrant 0=bottom left, 1=bottom right or top left, 2=top right, */ for (q=0; q<3; q++) { vmax[q] = 0; } /* * get maximum absolute value in each quadrant */ nx2 = (nx+1)/2; ny2 = (ny+1)/2; j=0; /* column counter */ k=0; /* row counter */ for (i=0; i=ny2) + (k>=nx2); if (vmax[q] < a[i]) vmax[q] = a[i]; if (++j >= ny) { j = 0; k += 1; } } /* * now calculate number of bits for each quadrant */ /* this is a more efficient way to do this, */ for (q = 0; q < 3; q++) { for (nbitplanes[q] = 0; vmax[q]>0; vmax[q] = vmax[q]>>1, nbitplanes[q]++) ; } /* for (q = 0; q < 3; q++) { nbitplanes[q] = log((float) (vmax[q]+1))/log(2.0)+0.5; if ( (vmax[q]+1) > (((LONGLONG) 1)< 0) { if ( 0 == qwrite(outfile, (char *) signbits, nsign)) { free(signbits); *nlength = noutchar; ffpmsg("encode: output buffer too small"); return(DATA_COMPRESSION_ERR); } } free(signbits); *nlength = noutchar; if (noutchar >= noutmax) { ffpmsg("encode64: output buffer too small"); return(DATA_COMPRESSION_ERR); } return(stat); } /* ######################################################################### */ /* ######################################################################### */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* qwrite.c Write binary data * * Programmer: R. White Date: 11 March 1991 */ /* ######################################################################### */ static void writeint(char *outfile, int a) { int i; unsigned char b[4]; /* Write integer A one byte at a time to outfile. * * This is portable from Vax to Sun since it eliminates the * need for byte-swapping. */ for (i=3; i>=0; i--) { b[i] = a & 0x000000ff; a >>= 8; } for (i=0; i<4; i++) qwrite(outfile, (char *) &b[i],1); } /* ######################################################################### */ static void writelonglong(char *outfile, LONGLONG a) { int i; unsigned char b[8]; /* Write integer A one byte at a time to outfile. * * This is portable from Vax to Sun since it eliminates the * need for byte-swapping. */ for (i=7; i>=0; i--) { b[i] = (unsigned char) (a & 0x000000ff); a >>= 8; } for (i=0; i<8; i++) qwrite(outfile, (char *) &b[i],1); } /* ######################################################################### */ static int qwrite(char *file, char buffer[], int n){ /* * write n bytes from buffer into file * returns number of bytes read (=n) if successful, <=0 if not */ if (noutchar + n > noutmax) return(0); /* buffer overflow */ memcpy(&file[noutchar], buffer, n); noutchar += n; return(n); } /* ######################################################################### */ /* ######################################################################### */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* doencode.c Encode 2-D array and write stream of characters on outfile * * This version assumes that A is positive. * * Programmer: R. White Date: 7 May 1991 */ /* ######################################################################### */ static int doencode(char *outfile, int a[], int nx, int ny, unsigned char nbitplanes[3]) { /* char *outfile; output data stream int a[]; Array of values to encode int nx,ny; Array dimensions [nx][ny] unsigned char nbitplanes[3]; Number of bit planes in quadrants */ int nx2, ny2, stat; nx2 = (nx+1)/2; ny2 = (ny+1)/2; /* * Initialize bit output */ start_outputing_bits(); /* * write out the bit planes for each quadrant */ stat = qtree_encode(outfile, &a[0], ny, nx2, ny2, nbitplanes[0]); if (!stat) stat = qtree_encode(outfile, &a[ny2], ny, nx2, ny/2, nbitplanes[1]); if (!stat) stat = qtree_encode(outfile, &a[ny*nx2], ny, nx/2, ny2, nbitplanes[1]); if (!stat) stat = qtree_encode(outfile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]); /* * Add zero as an EOF symbol */ output_nybble(outfile, 0); done_outputing_bits(outfile); return(stat); } /* ######################################################################### */ static int doencode64(char *outfile, LONGLONG a[], int nx, int ny, unsigned char nbitplanes[3]) { /* char *outfile; output data stream LONGLONG a[]; Array of values to encode int nx,ny; Array dimensions [nx][ny] unsigned char nbitplanes[3]; Number of bit planes in quadrants */ int nx2, ny2, stat; nx2 = (nx+1)/2; ny2 = (ny+1)/2; /* * Initialize bit output */ start_outputing_bits(); /* * write out the bit planes for each quadrant */ stat = qtree_encode64(outfile, &a[0], ny, nx2, ny2, nbitplanes[0]); if (!stat) stat = qtree_encode64(outfile, &a[ny2], ny, nx2, ny/2, nbitplanes[1]); if (!stat) stat = qtree_encode64(outfile, &a[ny*nx2], ny, nx/2, ny2, nbitplanes[1]); if (!stat) stat = qtree_encode64(outfile, &a[ny*nx2+ny2], ny, nx/2, ny/2, nbitplanes[2]); /* * Add zero as an EOF symbol */ output_nybble(outfile, 0); done_outputing_bits(outfile); return(stat); } /* ######################################################################### */ /* ######################################################################### */ /* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. */ /* BIT OUTPUT ROUTINES */ static LONGLONG bitcount; /* THE BIT BUFFER */ static int buffer2; /* Bits buffered for output */ static int bits_to_go2; /* Number of bits free in buffer */ /* ######################################################################### */ /* INITIALIZE FOR BIT OUTPUT */ static void start_outputing_bits(void) { buffer2 = 0; /* Buffer is empty to start */ bits_to_go2 = 8; /* with */ bitcount = 0; } /* ######################################################################### */ /* OUTPUT N BITS (N must be <= 8) */ static void output_nbits(char *outfile, int bits, int n) { /* AND mask for the right-most n bits */ static int mask[9] = {0, 1, 3, 7, 15, 31, 63, 127, 255}; /* * insert bits at end of buffer */ buffer2 <<= n; /* buffer2 |= ( bits & ((1<>(-bits_to_go2)) & 0xff); if (noutchar < noutmax) noutchar++; bits_to_go2 += 8; } bitcount += n; } /* ######################################################################### */ /* OUTPUT a 4 bit nybble */ static void output_nybble(char *outfile, int bits) { /* * insert 4 bits at end of buffer */ buffer2 = (buffer2<<4) | ( bits & 15 ); bits_to_go2 -= 4; if (bits_to_go2 <= 0) { /* * buffer2 full, put out top 8 bits */ outfile[noutchar] = ((buffer2>>(-bits_to_go2)) & 0xff); if (noutchar < noutmax) noutchar++; bits_to_go2 += 8; } bitcount += 4; } /* ############################################################################ */ /* OUTPUT array of 4 BITS */ static void output_nnybble(char *outfile, int n, unsigned char array[]) { /* pack the 4 lower bits in each element of the array into the outfile array */ int ii, jj, kk = 0, shift; if (n == 1) { output_nybble(outfile, (int) array[0]); return; } /* forcing byte alignment doesn;t help, and even makes it go slightly slower if (bits_to_go2 != 8) output_nbits(outfile, kk, bits_to_go2); */ if (bits_to_go2 <= 4) { /* just room for 1 nybble; write it out separately */ output_nybble(outfile, array[0]); kk++; /* index to next array element */ if (n == 2) /* only 1 more nybble to write out */ { output_nybble(outfile, (int) array[1]); return; } } /* bits_to_go2 is now in the range 5 - 8 */ shift = 8 - bits_to_go2; /* now write out pairs of nybbles; this does not affect value of bits_to_go2 */ jj = (n - kk) / 2; if (bits_to_go2 == 8) { /* special case if nybbles are aligned on byte boundary */ /* this actually seems to make very little differnece in speed */ buffer2 = 0; for (ii = 0; ii < jj; ii++) { outfile[noutchar] = ((array[kk] & 15)<<4) | (array[kk+1] & 15); kk += 2; noutchar++; } } else { for (ii = 0; ii < jj; ii++) { buffer2 = (buffer2<<8) | ((array[kk] & 15)<<4) | (array[kk+1] & 15); kk += 2; /* buffer2 full, put out top 8 bits */ outfile[noutchar] = ((buffer2>>shift) & 0xff); noutchar++; } } bitcount += (8 * (ii - 1)); /* write out last odd nybble, if present */ if (kk != n) output_nybble(outfile, (int) array[n - 1]); return; } /* ######################################################################### */ /* FLUSH OUT THE LAST BITS */ static void done_outputing_bits(char *outfile) { if(bits_to_go2 < 8) { /* putc(buffer2<nqy) ? nqx : nqy; log2n = (int) (log((float) nqmax)/log(2.0)+0.5); if (nqmax > (1<= 0; bit--) { /* * initial bit buffer */ b = 0; bitbuffer = 0; bits_to_go3 = 0; /* * on first pass copy A to scratch array */ qtree_onebit(a,n,nqx,nqy,scratch,bit); nx = (nqx+1)>>1; ny = (nqy+1)>>1; /* * copy non-zero values to output buffer, which will be written * in reverse order */ if (bufcopy(scratch,nx*ny,buffer,&b,bmax)) { /* * quadtree is expanding data, * change warning code and just fill buffer with bit-map */ write_bdirect(outfile,a,n,nqx,nqy,scratch,bit); goto bitplane_done; } /* * do log2n reductions */ for (k = 1; k>1; ny = (ny+1)>>1; if (bufcopy(scratch,nx*ny,buffer,&b,bmax)) { write_bdirect(outfile,a,n,nqx,nqy,scratch,bit); goto bitplane_done; } } /* * OK, we've got the code in buffer * Write quadtree warning code, then write buffer in reverse order */ output_nybble(outfile,0xF); if (b==0) { if (bits_to_go3>0) { /* * put out the last few bits */ output_nbits(outfile, bitbuffer & ((1<0) { /* * put out the last few bits */ output_nbits(outfile, bitbuffer & ((1<=0; i--) { output_nbits(outfile,buffer[i],8); } } bitplane_done: ; } free(buffer); free(scratch); return(0); } /* ######################################################################### */ static int qtree_encode64(char *outfile, LONGLONG a[], int n, int nqx, int nqy, int nbitplanes) { /* LONGLONG a[]; int n; physical dimension of row in a int nqx; length of row int nqy; length of column (<=n) int nbitplanes; number of bit planes to output */ int log2n, i, k, bit, b, nqmax, nqx2, nqy2, nx, ny; int bmax; /* this potentially needs to be made a 64-bit int to support large arrays */ unsigned char *scratch, *buffer; /* * log2n is log2 of max(nqx,nqy) rounded up to next power of 2 */ nqmax = (nqx>nqy) ? nqx : nqy; log2n = (int) (log((float) nqmax)/log(2.0)+0.5); if (nqmax > (1<= 0; bit--) { /* * initial bit buffer */ b = 0; bitbuffer = 0; bits_to_go3 = 0; /* * on first pass copy A to scratch array */ qtree_onebit64(a,n,nqx,nqy,scratch,bit); nx = (nqx+1)>>1; ny = (nqy+1)>>1; /* * copy non-zero values to output buffer, which will be written * in reverse order */ if (bufcopy(scratch,nx*ny,buffer,&b,bmax)) { /* * quadtree is expanding data, * change warning code and just fill buffer with bit-map */ write_bdirect64(outfile,a,n,nqx,nqy,scratch,bit); goto bitplane_done; } /* * do log2n reductions */ for (k = 1; k>1; ny = (ny+1)>>1; if (bufcopy(scratch,nx*ny,buffer,&b,bmax)) { write_bdirect64(outfile,a,n,nqx,nqy,scratch,bit); goto bitplane_done; } } /* * OK, we've got the code in buffer * Write quadtree warning code, then write buffer in reverse order */ output_nybble(outfile,0xF); if (b==0) { if (bits_to_go3>0) { /* * put out the last few bits */ output_nbits(outfile, bitbuffer & ((1<0) { /* * put out the last few bits */ output_nbits(outfile, bitbuffer & ((1<=0; i--) { output_nbits(outfile,buffer[i],8); } } bitplane_done: ; } free(buffer); free(scratch); return(0); } /* ######################################################################### */ /* * copy non-zero codes from array to buffer */ static int bufcopy(unsigned char a[], int n, unsigned char buffer[], int *b, int bmax) { int i; for (i = 0; i < n; i++) { if (a[i] != 0) { /* * add Huffman code for a[i] to buffer */ bitbuffer |= code[a[i]] << bits_to_go3; bits_to_go3 += ncode[a[i]]; if (bits_to_go3 >= 8) { buffer[*b] = bitbuffer & 0xFF; *b += 1; /* * return warning code if we fill buffer */ if (*b >= bmax) return(1); bitbuffer >>= 8; bits_to_go3 -= 8; } } } return(0); } /* ######################################################################### */ /* * Do first quadtree reduction step on bit BIT of array A. * Results put into B. * */ static void qtree_onebit(int a[], int n, int nx, int ny, unsigned char b[], int bit) { int i, j, k; int b0, b1, b2, b3; int s10, s00; /* * use selected bit to get amount to shift */ b0 = 1<> bit; k += 1; s00 += 2; s10 += 2; } if (j < ny) { /* * row size is odd, do last element in row * s00+1,s10+1 are off edge */ b[k] = ( ((a[s10 ]<<1) & b1) | ((a[s00 ]<<3) & b3) ) >> bit; k += 1; } } if (i < nx) { /* * column size is odd, do last row * s10,s10+1 are off edge */ s00 = n*i; for (j = 0; j> bit; k += 1; s00 += 2; } if (j < ny) { /* * both row and column size are odd, do corner element * s00+1, s10, s10+1 are off edge */ b[k] = ( ((a[s00 ]<<3) & b3) ) >> bit; k += 1; } } } /* ######################################################################### */ /* * Do first quadtree reduction step on bit BIT of array A. * Results put into B. * */ static void qtree_onebit64(LONGLONG a[], int n, int nx, int ny, unsigned char b[], int bit) { int i, j, k; LONGLONG b0, b1, b2, b3; int s10, s00; /* * use selected bit to get amount to shift */ b0 = ((LONGLONG) 1)<> bit); k += 1; s00 += 2; s10 += 2; } if (j < ny) { /* * row size is odd, do last element in row * s00+1,s10+1 are off edge */ b[k] = (unsigned char) (( ((a[s10 ]<<1) & b1) | ((a[s00 ]<<3) & b3) ) >> bit); k += 1; } } if (i < nx) { /* * column size is odd, do last row * s10,s10+1 are off edge */ s00 = n*i; for (j = 0; j> bit); k += 1; s00 += 2; } if (j < ny) { /* * both row and column size are odd, do corner element * s00+1, s10, s10+1 are off edge */ b[k] = (unsigned char) (( ((a[s00 ]<<3) & b3) ) >> bit); k += 1; } } } /* ######################################################################### */ /* * do one quadtree reduction step on array a * results put into b (which may be the same as a) */ static void qtree_reduce(unsigned char a[], int n, int nx, int ny, unsigned char b[]) { int i, j, k; int s10, s00; k = 0; /* k is index of b[i/2,j/2] */ for (i = 0; i #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ int nulval, /* I - value for undefined pixels */ int *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; int nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TINT, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclk(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ int *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TINT, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclk(fptr, 2, row, firstelem, nelem, 1, 2, 0L, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2dk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ int nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3dk(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3dk(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ int nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3]; int nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TINT, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgclk(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgclk(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ int nulval, /* I - value to set undefined pixels */ int *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; int nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TINT, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsvk: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgclk(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ int *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; long nulval = 0; int hdutype, anyf; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TINT, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclk(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpk( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ int *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclk(fptr, 1, row, firstelem, nelem, 1, 1, 0L, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ int nulval, /* I - value for null pixels */ int *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfk(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ int *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { int dummy = 0; ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgclk( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ int nulval, /* I - value for null pixels if nultyp = 1 */ int *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power, dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); /* call the 'short' or 'long' version of this routine, if possible */ if (sizeof(int) == sizeof(short)) ffgcli(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp, (short) nulval, (short *) array, nularray, anynul, status); else if (sizeof(int) == sizeof(long)) ffgclj(fptr, colnum, firstrow, firstelem, nelem, elemincre, nultyp, (long) nulval, (long *) array, nularray, anynul, status); else { /* This is a special case: sizeof(int) is not equal to sizeof(short) or sizeof(long). This occurs on Alpha OSF systems where short = 2 bytes, int = 4 bytes, and long = 8 bytes. */ buffer = cbuff; power = 1.; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TLONG) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next], status); if (convert) fffi4int((INT32BIT *) &array[next], ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8int( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1int((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2int((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4int((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8int((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstrint((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclk).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclk).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } } /* end of DEC Alpha special case */ return(*status); } /*--------------------------------------------------------------------------*/ int fffi1int(unsigned char *input,/* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (int) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2int(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (int) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4int(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (int) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8int(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < INT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > INT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < INT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > INT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4int(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (zero > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8int(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (zero > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (int) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstrint(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ int nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ int *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT_MAX; } else output[ii] = (long) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/inffast.c0000644000175000017500000003217712243255342016117 0ustar oleole/* inffast.c -- fast decoding * Copyright (C) 1995-2008, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifndef ASMINF /* Allow machine dependent optimization for post-increment or pre-increment. Based on testing to date, Pre-increment preferred for: - PowerPC G3 (Adler) - MIPS R5000 (Randers-Pehrson) Post-increment preferred for: - none No measurable difference: - Pentium III (Anderson) - M68060 (Nikl) */ #ifdef POSTINC # define OFF 0 # define PUP(a) *(a)++ #else # define OFF 1 # define PUP(a) *++(a) #endif /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state->mode == LEN strm->avail_in >= 6 strm->avail_out >= 258 start >= strm->avail_out state->bits < 8 On return, state->mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm->avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ void ZLIB_INTERNAL inflate_fast(strm, start) z_streamp strm; unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; unsigned char FAR *in; /* local strm->next_in */ unsigned char FAR *last; /* while in < last, enough input available */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ #ifdef INFLATE_STRICT unsigned dmax; /* maximum distance from zlib header */ #endif unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ unsigned long hold; /* local strm->hold */ unsigned bits; /* local strm->bits */ code const FAR *lcode; /* local strm->lencode */ code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ code here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ unsigned dist; /* match distance */ unsigned char FAR *from; /* where to copy match from */ /* copy state to local variables */ state = (struct inflate_state FAR *)strm->state; in = strm->next_in - OFF; last = in + (strm->avail_in - 5); out = strm->next_out - OFF; beg = out - (start - strm->avail_out); end = out + (strm->avail_out - 257); #ifdef INFLATE_STRICT dmax = state->dmax; #endif wsize = state->wsize; whave = state->whave; wnext = state->wnext; window = state->window; hold = state->hold; bits = state->bits; lcode = state->lencode; dcode = state->distcode; lmask = (1U << state->lenbits) - 1; dmask = (1U << state->distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ do { if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } here = lcode[hold & lmask]; dolen: op = (unsigned)(here.bits); hold >>= op; bits -= op; op = (unsigned)(here.op); if (op == 0) { /* literal */ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); PUP(out) = (unsigned char)(here.val); } else if (op & 16) { /* length base */ len = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } len += (unsigned)hold & ((1U << op) - 1); hold >>= op; bits -= op; } Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; hold += (unsigned long)(PUP(in)) << bits; bits += 8; } here = dcode[hold & dmask]; dodist: op = (unsigned)(here.bits); hold >>= op; bits -= op; op = (unsigned)(here.op); if (op & 16) { /* distance base */ dist = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; bits += 8; } } dist += (unsigned)hold & ((1U << op) - 1); #ifdef INFLATE_STRICT if (dist > dmax) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #endif hold >>= op; bits -= op; Tracevv((stderr, "inflate: distance %u\n", dist)); op = (unsigned)(out - beg); /* max distance in output */ if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { if (state->sane) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR if (len <= op - whave) { do { PUP(out) = 0; } while (--len); continue; } len -= op - whave; do { PUP(out) = 0; } while (--op > whave); if (op == 0) { from = out - dist; do { PUP(out) = PUP(from); } while (--len); continue; } #endif } from = window - OFF; if (wnext == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } else if (wnext < op) { /* wrap around window */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = window - OFF; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } } else { /* contiguous in window */ from += wnext - op; if (op < len) { /* some from window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = out - dist; /* rest from output */ } } while (len > 2) { PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } else { from = out - dist; /* copy direct from output */ do { /* minimum length is three */ PUP(out) = PUP(from); PUP(out) = PUP(from); PUP(out) = PUP(from); len -= 3; } while (len > 2); if (len) { PUP(out) = PUP(from); if (len > 1) PUP(out) = PUP(from); } } } else if ((op & 64) == 0) { /* 2nd level distance code */ here = dcode[here.val + (hold & ((1U << op) - 1))]; goto dodist; } else { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } } else if ((op & 64) == 0) { /* 2nd level length code */ here = lcode[here.val + (hold & ((1U << op) - 1))]; goto dolen; } else if (op & 32) { /* end-of-block */ Tracevv((stderr, "inflate: end of block\n")); state->mode = TYPE; break; } else { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } } while (in < last && out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; in -= len; bits -= len << 3; hold &= (1U << bits) - 1; /* update state and return */ strm->next_in = in + OFF; strm->next_out = out + OFF; strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); strm->avail_out = (unsigned)(out < end ? 257 + (end - out) : 257 - (out - end)); state->hold = hold; state->bits = bits; return; } /* inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - Using bit fields for code structure - Different op definition to avoid & for extra bits (do & for table bits) - Three separate decoding do-loops for direct, window, and wnext == 0 - Special case for distance > 1 copies to do overlapped load and store copy - Explicit branch predictions (based on measured branch probabilities) - Deferring match copy and interspersed it with decoding subsequent codes - Swapping literal/length else - Swapping window/direct else - Larger unrolled copy loops (three is about right) - Moving len -= 3 statement into middle of loop */ #endif /* !ASMINF */ astropy-0.3/cextern/cfitsio/zlib.h0000644000175000017500000023331412243255342015426 0ustar oleole/* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.5, April 19th, 2010 Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef ZLIB_H #define ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.2.5" #define ZLIB_VERNUM 0x1250 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 #define ZLIB_VER_REVISION 5 #define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough, or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The compressed data format used by default by the in-memory functions is the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped around a deflate stream, which is itself documented in RFC 1951. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. This library can optionally read and write gzip streams in memory as well. The zlib format was designed to be compact and fast for use in memory and on communications channels. The gzip format was designed for single- file compression on file systems, has a larger header than zlib to maintain directory information, and uses a different, slower check method than zlib. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total nb of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLong total_out; /* total nb of bytes output so far */ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: binary or text */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* gzip header information passed to and from zlib routines. See RFC 1952 for more details on the meanings of these fields. */ typedef struct gz_header_s { int text; /* true if compressed data believed to be text */ uLong time; /* modification time */ int xflags; /* extra flags (not used when writing a gzip file) */ int os; /* operating system */ Bytef *extra; /* pointer to extra field or Z_NULL if none */ uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ uInt extra_max; /* space at extra (only when reading header) */ Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ uInt name_max; /* space at name (only when reading header) */ Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ uInt comm_max; /* space at comment (only when reading header) */ int hcrc; /* true if there was or will be a header crc */ int done; /* true when done reading gzip header (not used when writing a gzip file) */ } gz_header; typedef gz_header FAR *gz_headerp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 #define Z_BLOCK 5 #define Z_TREES 6 /* Allowed flush values; see deflate() and inflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_RLE 3 #define Z_FIXED 4 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_TEXT 1 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ #define Z_UNKNOWN 2 /* Possible values of the data_type field (though see inflate()) */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to decide how much data to accumulate before producing output, in order to maximize compression. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. This completes the current deflate block and follows it with an empty stored block that is three bits plus filler bits to the next byte, followed by four bytes (00 00 ff ff). If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the output buffer, but the output is not aligned to a byte boundary. All of the input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. This completes the current deflate block and follows it with an empty fixed codes block that is 10 bits long. This assures that enough bytes are output in order for the decompressor to finish the block before the empty fixed code block. If flush is set to Z_BLOCK, a deflate block is completed and emitted, as for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to seven bits of the current block are held to be written as the next byte after the next deflate block is completed. In this case, the decompressor may not be provided enough bits at this point in order to complete decompression of the data provided so far to the compressor. It may need to wait for the next block to be emitted. This is for advanced applications that need to control the emission of deflate blocks. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that avail_out is greater than six to avoid repeated flush markers due to avail_out == 0 on return. If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least the value returned by deflateBound (see below). If deflate does not return Z_STREAM_END, then it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update strm->data_type if it can make a good guess about the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing. */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much output as possible to the output buffer. Z_BLOCK requests that inflate() stop if and when it gets to the next deflate block boundary. When decoding the zlib or gzip format, this will cause inflate() to return immediately after the header and before the first block. When doing a raw inflate, inflate() will go ahead and process the first block, and will return when it gets to the end of that block, or when it runs out of data. The Z_BLOCK option assists in appending to or combining deflate streams. Also to assist in this, on return inflate() will set strm->data_type to the number of unused bits in the last byte taken from strm->next_in, plus 64 if inflate() is currently decoding the last block in the deflate stream, plus 128 if inflate() returned immediately after decoding an end-of-block code or decoding the complete header up to just before the first byte of the deflate stream. The end-of-block will not be indicated until all of the uncompressed data from that block has been written to strm->next_out. The number of unused bits may in general be greater than seven, except when bit 7 of data_type is set, in which case the number of unused bits will be less than eight. data_type is set as noted here every time inflate() returns for all flush options, and so can be used to determine the amount of currently consumed input in bits. The Z_TREES option behaves as Z_BLOCK does, but it also returns when the end of each deflate block header is reached, before any actual data in that block is decoded. This allows the caller to determine the length of the deflate block header for later use in random access within a deflate block. 256 is added to the value of strm->data_type when inflate() returns immediately after reaching the end of the deflate block header. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH is never required, but can be used to inform inflate that a faster approach may be used for the single inflate() call. In this implementation, inflate() always flushes as much output as possible to the output buffer, and always uses the faster approach on the first call. So the only effect of the flush parameter in this implementation is on the return value of inflate(), as noted below, or when it returns early because Z_BLOCK or Z_TREES is used. If a preset dictionary is needed after this call (see inflateSetDictionary below), inflate sets strm->adler to the adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() can decompress and check either zlib-wrapped or gzip-wrapped deflate data. The header type is detected automatically, if requested when initializing with inflateInit2(). Any information contained in the gzip header is not retained, so applications that need that information should instead use raw inflate, see inflateInit2() below, or inflateBack() and perform their own processing of the gzip header and trailer. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect check value), Z_STREAM_ERROR if the stream structure was inconsistent (for example next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and inflate() can be called again with more input and more output space to continue decompressing. If Z_DATA_ERROR is returned, the application may then call inflateSync() to look for a good compression block if a partial recovery of the data is desired. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value. windowBits can also be greater than 15 for optional gzip encoding. Add 16 to windowBits to write a simple gzip header and trailer around the compressed data instead of a zlib wrapper. The gzip header will have no file name, no extra data, no comment, no modification time (set to zero), no header crc, and the operating system will be set to 255 (unknown). If a gzip stream is being written, strm->adler is a crc32 instead of an adler32. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no string match), or Z_RLE to limit match distances to one (run-length encoding). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size provided in deflateInit or deflateInit2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. In addition, the current implementation of deflate will use at most the window size minus 262 bytes of the provided dictionary. Upon return of this function, strm->adler is set to the adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) If a raw deflate was requested, then the adler32 value is not computed and strm->adler is not set. deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)); /* Fine tune deflate's internal compression parameters. This should only be used by someone who understands the algorithm used by zlib's deflate for searching for the best matching string, and even then only by the most fanatic optimizer trying to squeeze out the last compressed bit for their specific input data. Read the deflate.c source code for the meaning of the max_lazy, good_length, nice_length, and max_chain parameters. deflateTune() can be called after deflateInit() or deflateInit2(), and returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. */ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); /* deflateBound() returns an upper bound on the compressed size after deflation of sourceLen bytes. It must be called after deflateInit() or deflateInit2(), and after deflateSetHeader(), if used. This would be used to allocate an output buffer for deflation in a single pass, and so would be called before deflate(). */ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); /* deflatePrime() inserts bits in the deflate output stream. The intent is that this function is used to start off the deflate output with the bits leftover from a previous deflate stream when appending to it. As such, this function can only be used for raw deflate, and must be used before the first deflate() call after a deflateInit2() or deflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the output. deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); /* deflateSetHeader() provides gzip header information for when a gzip stream is requested by deflateInit2(). deflateSetHeader() may be called after deflateInit2() or deflateReset() and before the first call of deflate(). The text, time, os, extra field, name, and comment information in the provided gz_header structure are written to the gzip header (xflag is ignored -- the extra flags are set according to the compression level). The caller must assure that, if not Z_NULL, name and comment are terminated with a zero byte, and that if extra is not Z_NULL, that extra_len bytes are available there. If hcrc is true, a gzip header crc is included. Note that the current versions of the command-line version of gzip (up through version 1.3.x) do not support header crc's, and will report that it is a "multi-part gzip file" and give up. If deflateSetHeader is not used, the default gzip header has text false, the time set to zero, and os set to 255, with no extra, name, or comment fields. The gzip header is returned to the default state by deflateReset(). deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be zero to request that inflate use the window size in the zlib header of the compressed stream. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller, or Z_STREAM_ERROR if the parameters are invalid, such as a null pointer to the structure. msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from possibly reading the zlib header if present: actual decompression will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unused and unchanged.) The current implementation of inflateInit2() does not process any header information -- that is deferred until inflate() is called. */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate, if that call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the adler32 value returned by that call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). For raw inflate, this function can be called immediately after inflateInit2() or inflateReset() and before any call of inflate() to set the dictionary. The application must insure that the dictionary that was used for compression is provided. inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when randomly accessing a large stream. The first pass through the stream can periodically record the inflate state, allowing restarting inflate at those points when randomly accessing the stream. inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being Z_NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL). */ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); /* This function is the same as inflateReset, but it also permits changing the wrap and window size requests. The windowBits parameter is interpreted the same as it is for inflateInit2. inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being Z_NULL), or if the windowBits parameter is invalid. */ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); /* This function inserts bits in the inflate input stream. The intent is that this function is used to start inflating at a bit position in the middle of a byte. The provided bits will be used before any bytes are used from next_in. This function should only be used with raw inflate, and should be used before the first inflate() call after inflateInit2() or inflateReset(). bits must be less than or equal to 16, and that many of the least significant bits of value will be inserted in the input. If bits is negative, then the input stream bit buffer is emptied. Then inflatePrime() can be called again to put bits in the buffer. This is used to clear out bits leftover after feeding inflate a block description prior to feeding inflate codes. inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); /* This function returns two values, one in the lower 16 bits of the return value, and the other in the remaining upper bits, obtained by shifting the return value down 16 bits. If the upper value is -1 and the lower value is zero, then inflate() is currently decoding information outside of a block. If the upper value is -1 and the lower value is non-zero, then inflate is in the middle of a stored block, with the lower value equaling the number of bytes from the input remaining to copy. If the upper value is not -1, then it is the number of bits back from the current bit position in the input of the code (literal or length/distance pair) currently being processed. In that case the lower value is the number of bytes already emitted for that code. A code is being processed if inflate is waiting for more input to complete decoding of the code, or if it has completed decoding but is waiting for more output space to write the literal or match data. inflateMark() is used to mark locations in the input data for random access, which may be at bit positions, and to note those cases where the output of a code may span boundaries of random access blocks. The current location in the input stream can be determined from avail_in and data_type as noted in the description for the Z_BLOCK flush parameter for inflate. inflateMark returns the value noted above or -1 << 16 if the provided source stream state was inconsistent. */ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); /* inflateGetHeader() requests that gzip header information be stored in the provided gz_header structure. inflateGetHeader() may be called after inflateInit2() or inflateReset(), and before the first call of inflate(). As inflate() processes the gzip stream, head->done is zero until the header is completed, at which time head->done is set to one. If a zlib stream is being decoded, then head->done is set to -1 to indicate that there will be no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be used to force inflate() to return immediately after header processing is complete and before any actual data is decompressed. The text, time, xflags, and os fields are filled in with the gzip header contents. hcrc is set to true if there is a header CRC. (The header CRC was valid if done is set to one.) If extra is not Z_NULL, then extra_max contains the maximum number of bytes to write to extra. Once done is true, extra_len contains the actual extra field length, and extra contains the extra field, or that field truncated if extra_max is less than extra_len. If name is not Z_NULL, then up to name_max characters are written there, terminated with a zero unless the length is greater than name_max. If comment is not Z_NULL, then up to comm_max characters are written there, terminated with a zero unless the length is greater than comm_max. When any of extra, name, or comment are not Z_NULL and the respective field is not present in the header, then that field is set to Z_NULL to signal its absence. This allows the use of deflateSetHeader() with the returned structure to duplicate the header. However if those fields are set to allocated memory, then the application will need to save those pointers elsewhere so that they can be eventually freed. If inflateGetHeader is not used, then the header information is simply discarded. The header is always checked for validity, including the header CRC if present. inflateReset() will reset the process to discard the header information. The application would need to call inflateGetHeader() again to retrieve the header from the next gzip stream. inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent. */ /* ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, unsigned char FAR *window)); Initialize the internal stream state for decompression using inflateBack() calls. The fields zalloc, zfree and opaque in strm must be initialized before the call. If zalloc and zfree are Z_NULL, then the default library- derived memory allocation routines are used. windowBits is the base two logarithm of the window size, in the range 8..15. window is a caller supplied buffer of that size. Except for special applications where it is assured that deflate was used with small window sizes, windowBits must be 15 and a 32K byte window must be supplied to be able to decompress general deflate streams. See inflateBack() for the usage of these routines. inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of the paramaters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back interface for input and output. This is more efficient than inflate() for file i/o applications in that it avoids copying between the output and the sliding window by simply making the window itself the output buffer. This function trusts the application to not change the output buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the allocated state. A raw deflate stream is one with no zlib or gzip header or trailer. This routine would normally be used in a utility that reads zip or gzip files and writes out uncompressed files. The utility would decode the header and process the trailer on its own, hence this routine expects only the raw deflate stream to decompress. This is different from the normal behavior of inflate(), which expects either a zlib or gzip header and trailer around the deflate stream. inflateBack() uses two subroutines supplied by the caller that are then called by inflateBack() for input and output. inflateBack() calls those routines until it reads a complete deflate stream and writes out all of the uncompressed data, or until it encounters an error. The function's parameters and return types are defined above in the in_func and out_func typedefs. inflateBack() will call in(in_desc, &buf) which should return the number of bytes of provided input, and a pointer to that input in buf. If there is no input available, in() must return zero--buf is ignored in that case--and inflateBack() will return a buffer error. inflateBack() will call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() should return zero on success, or non-zero on failure. If out() returns non-zero, inflateBack() will return with an error. Neither in() nor out() are permitted to change the contents of the window provided to inflateBackInit(), which is also the buffer that out() uses to write from. The length written by out() will be at most the window size. Any non-zero amount of input may be provided by in(). For convenience, inflateBack() can be provided input on the first call by setting strm->next_in and strm->avail_in. If that input is exhausted, then in() will be called. Therefore strm->next_in must be initialized before calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in must also be initialized, and then if strm->avail_in is not zero, input will initially be taken from strm->next_in[0 .. strm->avail_in - 1]. The in_desc and out_desc parameters of inflateBack() is passed as the first parameter of in() and out() respectively when they are called. These descriptors can be optionally used to pass any information that the caller- supplied in() and out() functions need to do their job. On return, inflateBack() will set strm->next_in and strm->avail_in to pass back any unused input that was provided by the last in() call. The return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR if in() or out() returned an error, Z_DATA_ERROR if there was a format error in the deflate stream (in which case strm->msg is set to indicate the nature of the error), or Z_STREAM_ERROR if the stream was not properly initialized. In the case of Z_BUF_ERROR, an input or output error can be distinguished using strm->next_in which will be Z_NULL only if in() returned an error. If strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning non-zero. (in() will always be called before out(), so strm->next_in is assured to be defined if out() returns non-zero.) Note that inflateBack() cannot return Z_OK. */ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); /* All memory allocated by inflateBackInit() is freed. inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream state was inconsistent. */ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); /* Return flags indicating compile-time options. Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: 1.0: size of uInt 3.2: size of uLong 5.4: size of voidpf (pointer) 7.6: size of z_off_t Compiler, assembler, and debug options: 8: DEBUG 9: ASMV or ASMINF -- use ASM code 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention 11: 0 (reserved) One-time table building (smaller code, but not thread-safe if true): 12: BUILDFIXED -- build static block decoding tables when needed 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed 14,15: 0 (reserved) Library content (indicates missing functionality): 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking deflate code when not needed) 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect and decode gzip streams (to avoid linking crc code) 18-19: 0 (reserved) Operation variations (changes in library functionality): 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate 21: FASTEST -- deflate algorithm with only one, lowest compression level 22,23: 0 (reserved) The sprintf variant used by gzprintf (zero is best): 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! 26: 0 = returns value, 1 = void -- 1 means inferred string length returned Remainder: 27-31: 0 (reserved) */ /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least the value returned by compressBound(sourceLen). Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); /* compressBound() returns an upper bound on the compressed size after compress() or compress2() on sourceLen bytes. It would be used before a compress() or compress2() call to allocate the destination buffer. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the uncompressed buffer. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. */ /* gzip file access functions */ /* This library supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio, using the functions that start with "gz". The gzip format is different from the zlib format. gzip is a gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. */ typedef voidp gzFile; /* opaque gzip file descriptor */ /* ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression as in "wb9F". (See the description of deflateInit2 for more information about the strategy parameter.) Also "a" can be used instead of "w" to request that the gzip stream that will be written be appended to the file. "+" will result in an error, since reading and writing to the same gzip file is not supported. gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. gzopen returns NULL if the file could not be opened, if there was insufficient memory to allocate the gzFile state, or if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). errno can be checked to determine if the reason gzopen failed was that the file could not be opened. */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (if the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, mode);. The duplicated descriptor should be saved to avoid a leak, since gzdopen does not close fd if it fails. gzdopen returns NULL if there was insufficient memory to allocate the gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not provided, or '+' was provided), or if fd is -1. The file descriptor is not used until the next gz* read, write, seek, or close operation, so gzdopen will not detect if fd is invalid (unless fd is -1). */ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); /* Set the internal buffer size used by this library's functions. The default buffer size is 8192 bytes. This function must be called after gzopen() or gzdopen(), and before any other calls that read or write the file. The buffer memory allocation is always deferred to the first read or write. Two buffers are allocated, either both of the specified size when writing, or one of the specified size and the other twice that size when reading. A larger buffer size of, for example, 64K or 128K bytes will noticeably increase the speed of decompression (reading). The new buffer size also affects the maximum length for gzprintf(). gzbuffer() returns 0 on success, or -1 on failure, such as being called too late. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. After reaching the end of a gzip stream in the input, gzread will continue to read, looking for another gzip stream, or failing that, reading the rest of the input file directly without decompression. The entire input file will be read if gzread is called until it returns less than the requested len. gzread returns the number of uncompressed bytes actually read, less than len for end of file, or -1 for error. */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes written or 0 in case of error. */ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the arguments to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written, or 0 in case of error. The number of uncompressed bytes written is limited to 8191, or one less than the buffer size given to gzbuffer(). The caller should assure that this limit is not exceeded. If it is exceeded, then gzprintf() will return an error (0) with nothing written. In this case, there may also be a buffer overflow with unpredictable consequences, which is possible only if zlib was compiled with the insecure functions sprintf() or vsprintf() because the secure snprintf() or vsnprintf() functions were not available. This can be determined using zlibCompileFlags(). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. If any characters are read or if len == 1, the string is terminated with a null character. If no characters are read due to an end-of-file or len < 1, then the buffer is left untouched. gzgets returns buf which is a null-terminated string, or it returns NULL for end-of-file or in case of error. If there was an error, the contents at buf are indeterminate. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); /* Push one character back onto the stream to be read as the first character on the next read. At least one character of push-back is allowed. gzungetc() returns the character pushed, or -1 on failure. gzungetc() will fail if c is -1, and may fail if a character has been pushed but not read yet. If gzungetc is used immediately after gzopen or gzdopen, at least the output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush is only permitted when writing. If the flush parameter is Z_FINISH, the remaining data is written and the gzip stream is completed in the output. If gzwrite() is called again, a new gzip stream will be started in the output. gzread() is able to read such concatented gzip streams. gzflush should be called only when strictly necessary because it will degrade compression if called too often. */ /* ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ /* ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream, and is zero when starting, even if appending or reading a gzip stream from the middle of a file using gzdopen(). gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ /* ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); Returns the current offset in the file being read or written. This offset includes the count of bytes that precede the gzip stream, for example when appending or when using gzdopen() for reading. When reading, the offset does not include as yet unused buffered input. This information can be used for a progress indicator. On error, gzoffset() returns -1. */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns true (1) if the end-of-file indicator has been set while reading, false (0) otherwise. Note that the end-of-file indicator is set only if the read tried to go past the end of the input, but came up short. Therefore, just like feof(), gzeof() may return false even if there is no more data to read, in the event that the last read request was for the exact number of bytes remaining in the input file. This will happen if the input file size is an exact multiple of the buffer size. If gzeof() returns true, then the read functions will return no more data, unless the end-of-file indicator is reset by gzclearerr() and the input file has grown since the previous end of file was detected. */ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); /* Returns true (1) if file is being copied directly while reading, or false (0) if file is a gzip stream being decompressed. This state can change from false to true while reading the input file if the end of a gzip stream is reached, but is followed by data that is not another gzip stream. If the input file is empty, gzdirect() will return true, since the input does not contain a gzip stream. If gzdirect() is used immediately after gzopen() or gzdopen() it will cause buffers to be allocated to allow reading the file to determine if it is a gzip file. Therefore if gzbuffer() is used, it should be called before gzdirect(). */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates the (de)compression state. Note that once file is closed, you cannot call gzerror with file, since its structures have been deallocated. gzclose must not be called more than once on the same file, just as free must not be called more than once on the same allocation. gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a file operation error, or Z_OK on success. */ ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); /* Same as gzclose(), but gzclose_r() is only for use when reading, and gzclose_w() is only for use when writing or appending. The advantage to using these instead of gzclose() is that they avoid linking in zlib compression or decompression code that is not used when only reading or only writing respectively. If gzclose() is used, then both compression and decompression code will be included the application when linking to a static zlib library. */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. The application must not modify the returned string. Future calls to this function may invalidate the previously returned string. If file is closed, then the string previously returned by gzerror will no longer be available. gzerror() should be used to distinguish errors from end-of-file for those functions above that do not distinguish those cases in their return values. */ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); /* Clears the error and end-of-file flags for file. This is analogous to the clearerr() function in stdio. This is useful for continuing to read a gzip file that is being written concurrently. */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is Z_NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ /* ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, z_off_t len2)); Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running CRC-32 with the bytes buf[0..len-1] and return the updated CRC-32. If buf is Z_NULL, this function returns the required initial value for the for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ /* ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); Combine two CRC-32 check values into one. For two sequences of bytes, seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and len2. */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) #define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if * both are true, the application gets the *64 functions, and the regular * functions are changed to 64 bits) -- in case these are set on systems * without large file support, _LFS64_LARGEFILE must also be true */ #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); #endif #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0 # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 # ifdef _LARGEFILE64_SOURCE ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); # endif #else ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); #endif /* hack for buggy compilers */ #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; #endif /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); #ifdef __cplusplus } #endif #endif /* ZLIB_H */ astropy-0.3/cextern/cfitsio/wcsutil.c0000644000175000017500000004060112243255342016146 0ustar oleole#include #include "fitsio2.h" #define D2R 0.01745329252 #define TWOPI 6.28318530717959 /*--------------------------------------------------------------------------*/ int ffwldp(double xpix, double ypix, double xref, double yref, double xrefpix, double yrefpix, double xinc, double yinc, double rot, char *type, double *xpos, double *ypos, int *status) /* This routine is based on the classic AIPS WCS routine. It converts from pixel location to RA,Dec for 9 projective geometries: "-CAR", "-SIN", "-TAN", "-ARC", "-NCP", "-GLS", "-MER", "-AIT" and "-STG". */ /*-----------------------------------------------------------------------*/ /* routine to determine accurate position for pixel coordinates */ /* returns 0 if successful otherwise: */ /* 501 = angle too large for projection; */ /* does: -CAR, -SIN, -TAN, -ARC, -NCP, -GLS, -MER, -AIT -STG projections*/ /* Input: */ /* f xpix x pixel number (RA or long without rotation) */ /* f ypiy y pixel number (dec or lat without rotation) */ /* d xref x reference coordinate value (deg) */ /* d yref y reference coordinate value (deg) */ /* f xrefpix x reference pixel */ /* f yrefpix y reference pixel */ /* f xinc x coordinate increment (deg) */ /* f yinc y coordinate increment (deg) */ /* f rot rotation (deg) (from N through E) */ /* c *type projection type code e.g. "-SIN"; */ /* Output: */ /* d *xpos x (RA) coordinate (deg) */ /* d *ypos y (dec) coordinate (deg) */ /*-----------------------------------------------------------------------*/ {double cosr, sinr, dx, dy, dz, temp, x, y, z; double sins, coss, dect, rat, dt, l, m, mg, da, dd, cos0, sin0; double dec0, ra0; double geo1, geo2, geo3; double deps = 1.0e-5; char *cptr; if (*status > 0) return(*status); /* Offset from ref pixel */ dx = (xpix-xrefpix) * xinc; dy = (ypix-yrefpix) * yinc; /* Take out rotation */ cosr = cos(rot * D2R); sinr = sin(rot * D2R); if (rot != 0.0) { temp = dx * cosr - dy * sinr; dy = dy * cosr + dx * sinr; dx = temp; } /* convert to radians */ ra0 = xref * D2R; dec0 = yref * D2R; l = dx * D2R; m = dy * D2R; sins = l*l + m*m; cos0 = cos(dec0); sin0 = sin(dec0); if (*type != '-') { /* unrecognized projection code */ return(*status = 504); } cptr = type + 1; if (*cptr == 'C') { /* linear -CAR */ if (*(cptr + 1) != 'A' || *(cptr + 2) != 'R') { return(*status = 504); } rat = ra0 + l; dect = dec0 + m; } else if (*cptr == 'T') { /* -TAN */ if (*(cptr + 1) != 'A' || *(cptr + 2) != 'N') { return(*status = 504); } x = cos0*cos(ra0) - l*sin(ra0) - m*cos(ra0)*sin0; y = cos0*sin(ra0) + l*cos(ra0) - m*sin(ra0)*sin0; z = sin0 + m* cos0; rat = atan2( y, x ); dect = atan ( z / sqrt(x*x+y*y) ); } else if (*cptr == 'S') { if (*(cptr + 1) == 'I' && *(cptr + 2) == 'N') { /* -SIN */ if (sins>1.0) return(*status = 501); coss = sqrt (1.0 - sins); dt = sin0 * coss + cos0 * m; if ((dt>1.0) || (dt<-1.0)) return(*status = 501); dect = asin (dt); rat = cos0 * coss - sin0 * m; if ((rat==0.0) && (l==0.0)) return(*status = 501); rat = atan2 (l, rat) + ra0; } else if (*(cptr + 1) == 'T' && *(cptr + 2) == 'G') { /* -STG Sterographic*/ dz = (4.0 - sins) / (4.0 + sins); if (fabs(dz)>1.0) return(*status = 501); dect = dz * sin0 + m * cos0 * (1.0+dz) / 2.0; if (fabs(dect)>1.0) return(*status = 501); dect = asin (dect); rat = cos(dect); if (fabs(rat)1.0) return(*status = 501); rat = asin (rat); mg = 1.0 + sin(dect) * sin0 + cos(dect) * cos0 * cos(rat); if (fabs(mg)deps) rat = TWOPI /2.0 - rat; rat = ra0 + rat; } else { return(*status = 504); } } else if (*cptr == 'A') { if (*(cptr + 1) == 'R' && *(cptr + 2) == 'C') { /* ARC */ if (sins>=TWOPI*TWOPI/4.0) return(*status = 501); sins = sqrt(sins); coss = cos (sins); if (sins!=0.0) sins = sin (sins) / sins; else sins = 1.0; dt = m * cos0 * sins + sin0 * coss; if ((dt>1.0) || (dt<-1.0)) return(*status = 501); dect = asin (dt); da = coss - dt * sin0; dt = l * sins * cos0; if ((da==0.0) && (dt==0.0)) return(*status = 501); rat = ra0 + atan2 (dt, da); } else if (*(cptr + 1) == 'I' && *(cptr + 2) == 'T') { /* -AIT Aitoff */ dt = yinc*cosr + xinc*sinr; if (dt==0.0) dt = 1.0; dt = dt * D2R; dy = yref * D2R; dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) - sin(dy)/sqrt((1.0+cos(dy))/2.0); if (dx==0.0) dx = 1.0; geo2 = dt / dx; dt = xinc*cosr - yinc* sinr; if (dt==0.0) dt = 1.0; dt = dt * D2R; dx = 2.0 * cos(dy) * sin(dt/2.0); if (dx==0.0) dx = 1.0; geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx; geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0); rat = ra0; dect = dec0; if ((l != 0.0) || (m != 0.0)) { dz = 4.0 - l*l/(4.0*geo1*geo1) - ((m+geo3)/geo2)*((m+geo3)/geo2) ; if ((dz>4.0) || (dz<2.0)) return(*status = 501); dz = 0.5 * sqrt (dz); dd = (m+geo3) * dz / geo2; if (fabs(dd)>1.0) return(*status = 501); dd = asin (dd); if (fabs(cos(dd))1.0) return(*status = 501); da = asin (da); rat = ra0 + 2.0 * da; dect = dd; } } else { return(*status = 504); } } else if (*cptr == 'N') { /* -NCP North celestial pole*/ if (*(cptr + 1) != 'C' || *(cptr + 2) != 'P') { return(*status = 504); } dect = cos0 - m * sin0; if (dect==0.0) return(*status = 501); rat = ra0 + atan2 (l, dect); dt = cos (rat-ra0); if (dt==0.0) return(*status = 501); dect = dect / dt; if ((dect>1.0) || (dect<-1.0)) return(*status = 501); dect = acos (dect); if (dec0<0.0) dect = -dect; } else if (*cptr == 'G') { /* -GLS global sinusoid */ if (*(cptr + 1) != 'L' || *(cptr + 2) != 'S') { return(*status = 504); } dect = dec0 + m; if (fabs(dect)>TWOPI/4.0) return(*status = 501); coss = cos (dect); if (fabs(l)>TWOPI*coss/2.0) return(*status = 501); rat = ra0; if (coss>deps) rat = rat + l / coss; } else if (*cptr == 'M') { /* -MER mercator*/ if (*(cptr + 1) != 'E' || *(cptr + 2) != 'R') { return(*status = 504); } dt = yinc * cosr + xinc * sinr; if (dt==0.0) dt = 1.0; dy = (yref/2.0 + 45.0) * D2R; dx = dy + dt / 2.0 * D2R; dy = log (tan (dy)); dx = log (tan (dx)); geo2 = dt * D2R / (dx - dy); geo3 = geo2 * dy; geo1 = cos (yref*D2R); if (geo1<=0.0) geo1 = 1.0; rat = l / geo1 + ra0; if (fabs(rat - ra0) > TWOPI) return(*status = 501); dt = 0.0; if (geo2!=0.0) dt = (m + geo3) / geo2; dt = exp (dt); dect = 2.0 * atan (dt) - TWOPI / 4.0; } else { return(*status = 504); } /* correct for RA rollover */ if (rat-ra0>TWOPI/2.0) rat = rat - TWOPI; if (rat-ra0<-TWOPI/2.0) rat = rat + TWOPI; if (rat < 0.0) rat += TWOPI; /* convert to degrees */ *xpos = rat / D2R; *ypos = dect / D2R; return(*status); } /*--------------------------------------------------------------------------*/ int ffxypx(double xpos, double ypos, double xref, double yref, double xrefpix, double yrefpix, double xinc, double yinc, double rot, char *type, double *xpix, double *ypix, int *status) /* This routine is based on the classic AIPS WCS routine. It converts from RA,Dec to pixel location to for 9 projective geometries: "-CAR", "-SIN", "-TAN", "-ARC", "-NCP", "-GLS", "-MER", "-AIT" and "-STG". */ /*-----------------------------------------------------------------------*/ /* routine to determine accurate pixel coordinates for an RA and Dec */ /* returns 0 if successful otherwise: */ /* 501 = angle too large for projection; */ /* 502 = bad values */ /* does: -SIN, -TAN, -ARC, -NCP, -GLS, -MER, -AIT projections */ /* anything else is linear */ /* Input: */ /* d xpos x (RA) coordinate (deg) */ /* d ypos y (dec) coordinate (deg) */ /* d xref x reference coordinate value (deg) */ /* d yref y reference coordinate value (deg) */ /* f xrefpix x reference pixel */ /* f yrefpix y reference pixel */ /* f xinc x coordinate increment (deg) */ /* f yinc y coordinate increment (deg) */ /* f rot rotation (deg) (from N through E) */ /* c *type projection type code e.g. "-SIN"; */ /* Output: */ /* f *xpix x pixel number (RA or long without rotation) */ /* f *ypiy y pixel number (dec or lat without rotation) */ /*-----------------------------------------------------------------------*/ { double dx, dy, dz, r, ra0, dec0, ra, dec, coss, sins, dt, da, dd, sint; double l, m, geo1, geo2, geo3, sinr, cosr, cos0, sin0; double deps=1.0e-5; char *cptr; if (*type != '-') { /* unrecognized projection code */ return(*status = 504); } cptr = type + 1; dt = (xpos - xref); if (dt > 180) xpos -= 360; if (dt < -180) xpos += 360; /* NOTE: changing input argument xpos is OK (call-by-value in C!) */ /* default values - linear */ dx = xpos - xref; dy = ypos - yref; /* Correct for rotation */ r = rot * D2R; cosr = cos (r); sinr = sin (r); dz = dx*cosr + dy*sinr; dy = dy*cosr - dx*sinr; dx = dz; /* check axis increments - bail out if either 0 */ if ((xinc==0.0) || (yinc==0.0)) {*xpix=0.0; *ypix=0.0; return(*status = 502);} /* convert to pixels */ *xpix = dx / xinc + xrefpix; *ypix = dy / yinc + yrefpix; if (*cptr == 'C') { /* linear -CAR */ if (*(cptr + 1) != 'A' || *(cptr + 2) != 'R') { return(*status = 504); } return(*status); /* done if linear */ } /* Non linear position */ ra0 = xref * D2R; dec0 = yref * D2R; ra = xpos * D2R; dec = ypos * D2R; /* compute direction cosine */ coss = cos (dec); sins = sin (dec); cos0 = cos (dec0); sin0 = sin (dec0); l = sin(ra-ra0) * coss; sint = sins * sin0 + coss * cos0 * cos(ra-ra0); /* process by case */ if (*cptr == 'T') { /* -TAN tan */ if (*(cptr + 1) != 'A' || *(cptr + 2) != 'N') { return(*status = 504); } if (sint<=0.0) return(*status = 501); if( cos0<0.001 ) { /* Do a first order expansion around pole */ m = (coss * cos(ra-ra0)) / (sins * sin0); m = (-m + cos0 * (1.0 + m*m)) / sin0; } else { m = ( sins/sint - sin0 ) / cos0; } if( fabs(sin(ra0)) < 0.3 ) { l = coss*sin(ra)/sint - cos0*sin(ra0) + m*sin(ra0)*sin0; l /= cos(ra0); } else { l = coss*cos(ra)/sint - cos0*cos(ra0) + m*cos(ra0)*sin0; l /= -sin(ra0); } } else if (*cptr == 'S') { if (*(cptr + 1) == 'I' && *(cptr + 2) == 'N') { /* -SIN */ if (sint<0.0) return(*status = 501); m = sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0); } else if (*(cptr + 1) == 'T' && *(cptr + 2) == 'G') { /* -STG Sterographic*/ da = ra - ra0; if (fabs(dec)>TWOPI/4.0) return(*status = 501); dd = 1.0 + sins * sin(dec0) + coss * cos(dec0) * cos(da); if (fabs(dd)1.0) m = 1.0; m = acos (m); if (m!=0) m = m / sin(m); else m = 1.0; l = l * m; m = (sins * cos(dec0) - coss * sin(dec0) * cos(ra-ra0)) * m; } else if (*(cptr + 1) == 'I' && *(cptr + 2) == 'T') { /* -AIT Aitoff */ da = (ra - ra0) / 2.0; if (fabs(da)>TWOPI/4.0) return(*status = 501); dt = yinc*cosr + xinc*sinr; if (dt==0.0) dt = 1.0; dt = dt * D2R; dy = yref * D2R; dx = sin(dy+dt)/sqrt((1.0+cos(dy+dt))/2.0) - sin(dy)/sqrt((1.0+cos(dy))/2.0); if (dx==0.0) dx = 1.0; geo2 = dt / dx; dt = xinc*cosr - yinc* sinr; if (dt==0.0) dt = 1.0; dt = dt * D2R; dx = 2.0 * cos(dy) * sin(dt/2.0); if (dx==0.0) dx = 1.0; geo1 = dt * sqrt((1.0+cos(dy)*cos(dt/2.0))/2.0) / dx; geo3 = geo2 * sin(dy) / sqrt((1.0+cos(dy))/2.0); dt = sqrt ((1.0 + cos(dec) * cos(da))/2.0); if (fabs(dt)TWOPI/4.0) return(*status = 501); if (fabs(dec0)>TWOPI/4.0) return(*status = 501); m = dec - dec0; l = dt * coss; } else if (*cptr == 'M') { /* -MER mercator*/ if (*(cptr + 1) != 'E' || *(cptr + 2) != 'R') { return(*status = 504); } dt = yinc * cosr + xinc * sinr; if (dt==0.0) dt = 1.0; dy = (yref/2.0 + 45.0) * D2R; dx = dy + dt / 2.0 * D2R; dy = log (tan (dy)); dx = log (tan (dx)); geo2 = dt * D2R / (dx - dy); geo3 = geo2 * dy; geo1 = cos (yref*D2R); if (geo1<=0.0) geo1 = 1.0; dt = ra - ra0; l = geo1 * dt; dt = dec / 2.0 + TWOPI / 8.0; dt = tan (dt); if (dt= 33) && !defined(NO_VIZ) # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) #else # define ZLIB_INTERNAL #endif #include "zlib.h" #ifdef STDC # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) # include # endif # include # include #endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ typedef unsigned char uch; typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS #endif /* default windowBits for decompression. MAX_WBITS is for compression only */ #if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* default memLevel */ #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ /* target dependencies */ #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) # define OS_CODE 0x00 # if defined(__TURBOC__) || defined(__BORLANDC__) # if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) /* Allow compilation with ANSI keywords only enabled */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else # include # endif # else /* MSC or DJGPP */ # include # endif #endif #ifdef AMIGA # define OS_CODE 0x01 #endif #if defined(VAXC) || defined(VMS) # define OS_CODE 0x02 # define F_OPEN(name, mode) \ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif #ifdef OS2 # define OS_CODE 0x06 # ifdef M_I86 # include # endif #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ # else # ifndef fdopen # define fdopen(fd,mode) NULL /* No fdopen() */ # endif # endif #endif #ifdef TOPS20 # define OS_CODE 0x0a #endif #ifdef WIN32 # ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ # define OS_CODE 0x0b # endif #endif #ifdef __50SERIES /* Prime/PRIMOS */ # define OS_CODE 0x0f #endif #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX # if defined(_WIN32_WCE) # define fdopen(fd,mode) NULL /* No fdopen() */ # ifndef _PTRDIFF_T_DEFINED typedef int ptrdiff_t; # define _PTRDIFF_T_DEFINED # endif # else # define fdopen(fd,type) _fdopen(fd,type) # endif #endif #if defined(__BORLANDC__) #pragma warn -8004 #pragma warn -8008 #pragma warn -8066 #endif /* provide prototypes for these when building zlib without LFS */ #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif /* common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ #endif #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) #endif /* functions */ #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #if defined(__CYGWIN__) # ifndef HAVE_VSNPRINTF # define HAVE_VSNPRINTF # endif #endif #ifndef HAVE_VSNPRINTF # ifdef MSDOS /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), but for now we just assume it doesn't. */ # define NO_vsnprintf # endif # ifdef __TURBOC__ # define NO_vsnprintf # endif # ifdef WIN32 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ # if !defined(vsnprintf) && !defined(NO_vsnprintf) # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) # define vsnprintf _vsnprintf # endif # endif # endif # ifdef __SASC # define NO_vsnprintf # endif #endif #ifdef VMS # define NO_vsnprintf #endif #if defined(pyr) # define NO_MEMCPY #endif #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) /* Use our own functions for small and medium model with MSC <= 5.0. * You may have to use the same strategy for Borland C (untested). * The __SC__ check is for Symantec. */ # define NO_MEMCPY #endif #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) # define HAVE_MEMCPY #endif #ifdef HAVE_MEMCPY # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # define zmemcpy _fmemcpy # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else # define zmemcpy memcpy # define zmemcmp memcmp # define zmemzero(dest, len) memset(dest, 0, len) # endif #else void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); #endif /* Diagnostic functions */ #ifdef DEBUG # include extern int ZLIB_INTERNAL z_verbose; extern void ZLIB_INTERNAL z_error OF((char *m)); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} # define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} #else # define Assert(cond,msg) # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) #endif voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #endif /* ZUTIL_H */ astropy-0.3/cextern/cfitsio/getcoluj.c0000644000175000017500000021643712243255342016304 0ustar oleole/* This file, getcoluj.c, contains routines that read data elements from */ /* a FITS image or table, with unsigned long data type. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvuj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned long nulval, /* I - value for undefined pixels */ unsigned long *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; unsigned long nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TULONG, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluj(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfuj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned long *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TULONG, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluj(fptr, 2, row, firstelem, nelem, 1, 2, 0L, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2duj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned long nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3duj(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3duj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned long nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3]; unsigned long nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TULONG, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcluj(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcluj(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvuj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned long nulval, /* I - value to set undefined pixels */ unsigned long *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; unsigned long nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvuj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TULONG, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvuj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcluj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfuj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned long *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; unsigned long nulval = 0; int hdutype, anyf; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvj is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TULONG, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvj: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcluj(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpuj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ unsigned long *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcluj(fptr, 1, row, firstelem, nelem, 1, 1, 0L, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvuj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned long nulval, /* I - value for null pixels */ unsigned long *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfuj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned long *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { unsigned long dummy = 0; ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcluj(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ unsigned long nulval, /* I - value for null pixels if nultyp = 1 */ unsigned long *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int nulcheck; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ if (tcode == TLONG) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) &array[next], status); fffi4u4((INT32BIT *) &array[next], ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8u4( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1u4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2u4((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4u4((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8u4((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstru4((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgcluj).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgcluj).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1u4(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (unsigned long) input[ii]; /* copy input */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (unsigned long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2u4(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4u4(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; Process the array of data in reverse order, to handle the case where the input data is 4-bytes and the output is 8-bytes and the conversion is being done in place in the same array. */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 2147483648.) { /* Instead of adding 2147483648, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = ntodo - 1; ii >= 0; ii--) output[ii] = ( *(unsigned int *) &input[ii] ) ^ 0x80000000; } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned long) input[ii]; /* copy input */ } } else /* must scale the data */ { for (ii = ntodo - 1; ii >= 0; ii--) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 2147483648.) { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = ( *(unsigned int *) &input[ii] ) ^ 0x80000000; } } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned long) input[ii]; /* copy input */ } } else /* must scale the data */ { for (ii = ntodo - 1; ii >= 0; ii--) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8u4(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > ULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > ULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4u4(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8u4(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstru4(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ unsigned long nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned long *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DULONG_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DULONG_MAX) { *status = OVERFLOW_ERR; output[ii] = ULONG_MAX; } else output[ii] = (unsigned long) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/inftrees.c0000644000175000017500000003271112243255342016276 0ustar oleole/* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #define MAXBITS 15 const char inflate_copyright[] = " inflate 1.2.5 Copyright 1995-2010 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* Build a set of tables to decode the provided canonical Huffman code. The code lengths are lens[0..codes-1]. The result starts at *table, whose indices are 0..2^bits-1. work is a writable array of at least lens shorts, which is used as a work area. type is the type of code to be generated, CODES, LENS, or DISTS. On return, zero is success, -1 is an invalid code, and +1 means that ENOUGH isn't enough. table on return points to the next available entry's address. bits is the requested root table index bits, and on return it is the actual root table index bits. It will differ if the request is greater than the longest code or if it is less than the shortest code. */ int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) codetype type; unsigned short FAR *lens; unsigned codes; code FAR * FAR *table; unsigned FAR *bits; unsigned short FAR *work; { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ unsigned min, max; /* minimum and maximum code lengths */ unsigned root; /* number of index bits for root table */ unsigned curr; /* number of index bits for current table */ unsigned drop; /* code bits to drop for sub-table */ int left; /* number of prefix codes available */ unsigned used; /* code entries in table used */ unsigned huff; /* Huffman code */ unsigned incr; /* for incrementing code, index */ unsigned fill; /* index for replicating entries */ unsigned low; /* low bits for current root entry */ unsigned mask; /* mask for low root bits */ code here; /* table entry for duplication */ code FAR *next; /* next available space in table */ const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *extra; /* extra bits table to use */ int end; /* use base and extra for symbol > end */ unsigned short count[MAXBITS+1]; /* number of codes of each length */ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64}; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) count[len] = 0; for (sym = 0; sym < codes; sym++) count[lens[sym]]++; /* bound code lengths, force root to be within code lengths */ root = *bits; for (max = MAXBITS; max >= 1; max--) if (count[max] != 0) break; if (root > max) root = max; if (max == 0) { /* no symbols to code at all */ here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)1; here.val = (unsigned short)0; *(*table)++ = here; /* make a table to force an error */ *(*table)++ = here; *bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) if (count[min] != 0) break; if (root < min) root = min; /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) return -1; /* over-subscribed */ } if (left > 0 && (type == CODES || max != 1)) return -1; /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count[len]; /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ switch (type) { case CODES: base = extra = work; /* dummy value--not used */ end = 19; break; case LENS: base = lbase; base -= 257; extra = lext; extra -= 257; end = 256; break; default: /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize state for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = *table; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = (unsigned)(-1); /* trigger new sub-table when len > root */ used = 1U << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type == LENS && used >= ENOUGH_LENS) || (type == DISTS && used >= ENOUGH_DISTS)) return 1; /* process all codes and make table entries */ for (;;) { /* create table entry */ here.bits = (unsigned char)(len - drop); if ((int)(work[sym]) < end) { here.op = (unsigned char)0; here.val = work[sym]; } else if ((int)(work[sym]) > end) { here.op = (unsigned char)(extra[work[sym]]); here.val = base[work[sym]]; } else { here.op = (unsigned char)(32 + 64); /* end of block */ here.val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1U << (len - drop); fill = 1U << curr; min = fill; /* save offset to next table */ do { fill -= incr; next[(huff >> drop) + fill] = here; } while (fill != 0); /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; /* go to next symbol, update count, len */ sym++; if (--(count[len]) == 0) { if (len == max) break; len = lens[work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) != low) { /* if first time, transition to sub-tables */ if (drop == 0) drop = root; /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = (int)(1 << curr); while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) break; curr++; left <<= 1; } /* check for enough space */ used += 1U << curr; if ((type == LENS && used >= ENOUGH_LENS) || (type == DISTS && used >= ENOUGH_DISTS)) return 1; /* point entry in root table to sub-table */ low = huff & mask; (*table)[low].op = (unsigned char)curr; (*table)[low].bits = (unsigned char)root; (*table)[low].val = (unsigned short)(next - *table); } } /* Fill in rest of table for incomplete codes. This loop is similar to the loop above in incrementing huff for table indices. It is assumed that len is equal to curr + drop, so there is no loop needed to increment through high index bits. When the current sub-table is filled, the loop drops back to the root table to fill in any remaining entries there. */ here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)(len - drop); here.val = (unsigned short)0; while (huff != 0) { /* when done with sub-table, drop back to root table */ if (drop != 0 && (huff & mask) != low) { drop = 0; len = root; next = *table; here.bits = (unsigned char)len; } /* put invalid code marker in table */ next[huff >> drop] = here; /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; } /* set return parameters */ *table += used; *bits = root; return 0; } astropy-0.3/cextern/cfitsio/eval.y0000644000175000017500000053306212243255342015441 0ustar oleole%{ /************************************************************************/ /* */ /* CFITSIO Lexical Parser */ /* */ /* This file is one of 3 files containing code which parses an */ /* arithmetic expression and evaluates it in the context of an input */ /* FITS file table extension. The CFITSIO lexical parser is divided */ /* into the following 3 parts/files: the CFITSIO "front-end", */ /* eval_f.c, contains the interface between the user/CFITSIO and the */ /* real core of the parser; the FLEX interpreter, eval_l.c, takes the */ /* input string and parses it into tokens and identifies the FITS */ /* information required to evaluate the expression (ie, keywords and */ /* columns); and, the BISON grammar and evaluation routines, eval_y.c, */ /* receives the FLEX output and determines and performs the actual */ /* operations. The files eval_l.c and eval_y.c are produced from */ /* running flex and bison on the files eval.l and eval.y, respectively. */ /* (flex and bison are available from any GNU archive: see www.gnu.org) */ /* */ /* The grammar rules, rather than evaluating the expression in situ, */ /* builds a tree, or Nodal, structure mapping out the order of */ /* operations and expression dependencies. This "compilation" process */ /* allows for much faster processing of multiple rows. This technique */ /* was developed by Uwe Lammers of the XMM Science Analysis System, */ /* although the CFITSIO implementation is entirely code original. */ /* */ /* */ /* Modification History: */ /* */ /* Kent Blackburn c1992 Original parser code developed for the */ /* FTOOLS software package, in particular, */ /* the fselect task. */ /* Kent Blackburn c1995 BIT column support added */ /* Peter D Wilson Feb 1998 Vector column support added */ /* Peter D Wilson May 1998 Ported to CFITSIO library. User */ /* interface routines written, in essence */ /* making fselect, fcalc, and maketime */ /* capabilities available to all tools */ /* via single function calls. */ /* Peter D Wilson Jun 1998 Major rewrite of parser core, so as to */ /* create a run-time evaluation tree, */ /* inspired by the work of Uwe Lammers, */ /* resulting in a speed increase of */ /* 10-100 times. */ /* Peter D Wilson Jul 1998 gtifilter(a,b,c,d) function added */ /* Peter D Wilson Aug 1998 regfilter(a,b,c,d) function added */ /* Peter D Wilson Jul 1999 Make parser fitsfile-independent, */ /* allowing a purely vector-based usage */ /* Craig B Markwardt Jun 2004 Add MEDIAN() function */ /* Craig B Markwardt Jun 2004 Add SUM(), and MIN/MAX() for bit arrays */ /* Craig B Markwardt Jun 2004 Allow subscripting of nX bit arrays */ /* Craig B Markwardt Jun 2004 Implement statistical functions */ /* NVALID(), AVERAGE(), and STDDEV() */ /* for integer and floating point vectors */ /* Craig B Markwardt Jun 2004 Use NULL values for range errors instead*/ /* of throwing a parse error */ /* Craig B Markwardt Oct 2004 Add ACCUM() and SEQDIFF() functions */ /* Craig B Markwardt Feb 2005 Add ANGSEP() function */ /* Craig B Markwardt Aug 2005 CIRCLE, BOX, ELLIPSE, NEAR and REGFILTER*/ /* functions now accept vector arguments */ /* Craig B Markwardt Sum 2006 Add RANDOMN() and RANDOMP() functions */ /* Craig B Markwardt Mar 2007 Allow arguments to RANDOM and RANDOMN to*/ /* determine the output dimensions */ /* Craig B Markwardt Aug 2009 Add substring STRMID() and string search*/ /* STRSTR() functions; more overflow checks*/ /* */ /************************************************************************/ #define APPROX 1.0e-7 #include "eval_defs.h" #include "region.h" #include #include #ifndef alloca #define alloca malloc #endif /* Shrink the initial stack depth to keep local data <32K (mac limit) */ /* yacc will allocate more space if needed, though. */ #define YYINITDEPTH 100 /***************************************************************/ /* Replace Bison's BACKUP macro with one that fixes a bug -- */ /* must update state after popping the stack -- and allows */ /* popping multiple terms at one time. */ /***************************************************************/ #define YYNEWBACKUP(token, value) \ do \ if (yychar == YYEMPTY ) \ { yychar = (token); \ memcpy( &yylval, &(value), sizeof(value) ); \ yychar1 = YYTRANSLATE (yychar); \ while (yylen--) YYPOPSTACK; \ yystate = *yyssp; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) /***************************************************************/ /* Useful macros for accessing/testing Nodes */ /***************************************************************/ #define TEST(a) if( (a)<0 ) YYERROR #define SIZE(a) gParse.Nodes[ a ].value.nelem #define TYPE(a) gParse.Nodes[ a ].type #define OPER(a) gParse.Nodes[ a ].operation #define PROMOTE(a,b) if( TYPE(a) > TYPE(b) ) \ b = New_Unary( TYPE(a), 0, b ); \ else if( TYPE(a) < TYPE(b) ) \ a = New_Unary( TYPE(b), 0, a ); /***** Internal functions *****/ #ifdef __cplusplus extern "C" { #endif static int Alloc_Node ( void ); static void Free_Last_Node( void ); static void Evaluate_Node ( int thisNode ); static int New_Const ( int returnType, void *value, long len ); static int New_Column( int ColNum ); static int New_Offset( int ColNum, int offset ); static int New_Unary ( int returnType, int Op, int Node1 ); static int New_BinOp ( int returnType, int Node1, int Op, int Node2 ); static int New_Func ( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7 ); static int New_FuncSize( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7, int Size); static int New_Deref ( int Var, int nDim, int Dim1, int Dim2, int Dim3, int Dim4, int Dim5 ); static int New_GTI ( char *fname, int Node1, char *start, char *stop ); static int New_REG ( char *fname, int NodeX, int NodeY, char *colNames ); static int New_Vector( int subNode ); static int Close_Vec ( int vecNode ); static int Locate_Col( Node *this ); static int Test_Dims ( int Node1, int Node2 ); static void Copy_Dims ( int Node1, int Node2 ); static void Allocate_Ptrs( Node *this ); static void Do_Unary ( Node *this ); static void Do_Offset ( Node *this ); static void Do_BinOp_bit ( Node *this ); static void Do_BinOp_str ( Node *this ); static void Do_BinOp_log ( Node *this ); static void Do_BinOp_lng ( Node *this ); static void Do_BinOp_dbl ( Node *this ); static void Do_Func ( Node *this ); static void Do_Deref ( Node *this ); static void Do_GTI ( Node *this ); static void Do_REG ( Node *this ); static void Do_Vector ( Node *this ); static long Search_GTI ( double evtTime, long nGTI, double *start, double *stop, int ordered ); static char saobox (double xcen, double ycen, double xwid, double ywid, double rot, double xcol, double ycol); static char ellipse(double xcen, double ycen, double xrad, double yrad, double rot, double xcol, double ycol); static char circle (double xcen, double ycen, double rad, double xcol, double ycol); static char bnear (double x, double y, double tolerance); static char bitcmp (char *bitstrm1, char *bitstrm2); static char bitlgte(char *bits1, int oper, char *bits2); static void bitand(char *result, char *bitstrm1, char *bitstrm2); static void bitor (char *result, char *bitstrm1, char *bitstrm2); static void bitnot(char *result, char *bits); static int cstrmid(char *dest_str, int dest_len, char *src_str, int src_len, int pos); static void yyerror(char *msg); #ifdef __cplusplus } #endif %} %union { int Node; /* Index of Node */ double dbl; /* real value */ long lng; /* integer value */ char log; /* logical value */ char str[MAX_STRLEN]; /* string value */ } %token BOOLEAN /* First 3 must be in order of */ %token LONG /* increasing promotion for later use */ %token DOUBLE %token STRING %token BITSTR %token FUNCTION %token BFUNCTION /* Bit function */ %token IFUNCTION /* Integer function */ %token GTIFILTER %token REGFILTER %token COLUMN %token BCOLUMN %token SCOLUMN %token BITCOL %token ROWREF %token NULLREF %token SNULLREF %type expr %type bexpr %type sexpr %type bits %type vector %type bvector %left ',' '=' ':' '{' '}' %right '?' %left OR %left AND %left EQ NE '~' %left GT LT LTE GTE %left '+' '-' '%' %left '*' '/' %left '|' '&' %right POWER %left NOT %left INTCAST FLTCAST %left UMINUS %left '[' %right ACCUM DIFF %% lines: /* nothing ; was | lines line */ | lines line ; line: '\n' {} | expr '\n' { if( $1<0 ) { yyerror("Couldn't build node structure: out of memory?"); YYERROR; } gParse.resultNode = $1; } | bexpr '\n' { if( $1<0 ) { yyerror("Couldn't build node structure: out of memory?"); YYERROR; } gParse.resultNode = $1; } | sexpr '\n' { if( $1<0 ) { yyerror("Couldn't build node structure: out of memory?"); YYERROR; } gParse.resultNode = $1; } | bits '\n' { if( $1<0 ) { yyerror("Couldn't build node structure: out of memory?"); YYERROR; } gParse.resultNode = $1; } | error '\n' { yyerrok; } ; bvector: '{' bexpr { $$ = New_Vector( $2 ); TEST($$); } | bvector ',' bexpr { if( gParse.Nodes[$1].nSubNodes >= MAXSUBS ) { $1 = Close_Vec( $1 ); TEST($1); $$ = New_Vector( $1 ); TEST($$); } else { $$ = $1; } gParse.Nodes[$$].SubNodes[ gParse.Nodes[$$].nSubNodes++ ] = $3; } ; vector: '{' expr { $$ = New_Vector( $2 ); TEST($$); } | vector ',' expr { if( TYPE($1) < TYPE($3) ) TYPE($1) = TYPE($3); if( gParse.Nodes[$1].nSubNodes >= MAXSUBS ) { $1 = Close_Vec( $1 ); TEST($1); $$ = New_Vector( $1 ); TEST($$); } else { $$ = $1; } gParse.Nodes[$$].SubNodes[ gParse.Nodes[$$].nSubNodes++ ] = $3; } | vector ',' bexpr { if( gParse.Nodes[$1].nSubNodes >= MAXSUBS ) { $1 = Close_Vec( $1 ); TEST($1); $$ = New_Vector( $1 ); TEST($$); } else { $$ = $1; } gParse.Nodes[$$].SubNodes[ gParse.Nodes[$$].nSubNodes++ ] = $3; } | bvector ',' expr { TYPE($1) = TYPE($3); if( gParse.Nodes[$1].nSubNodes >= MAXSUBS ) { $1 = Close_Vec( $1 ); TEST($1); $$ = New_Vector( $1 ); TEST($$); } else { $$ = $1; } gParse.Nodes[$$].SubNodes[ gParse.Nodes[$$].nSubNodes++ ] = $3; } ; expr: vector '}' { $$ = Close_Vec( $1 ); TEST($$); } ; bexpr: bvector '}' { $$ = Close_Vec( $1 ); TEST($$); } ; bits: BITSTR { $$ = New_Const( BITSTR, $1, strlen($1)+1 ); TEST($$); SIZE($$) = strlen($1); } | BITCOL { $$ = New_Column( $1 ); TEST($$); } | BITCOL '{' expr '}' { if( TYPE($3) != LONG || OPER($3) != CONST_OP ) { yyerror("Offset argument must be a constant integer"); YYERROR; } $$ = New_Offset( $1, $3 ); TEST($$); } | bits '&' bits { $$ = New_BinOp( BITSTR, $1, '&', $3 ); TEST($$); SIZE($$) = ( SIZE($1)>SIZE($3) ? SIZE($1) : SIZE($3) ); } | bits '|' bits { $$ = New_BinOp( BITSTR, $1, '|', $3 ); TEST($$); SIZE($$) = ( SIZE($1)>SIZE($3) ? SIZE($1) : SIZE($3) ); } | bits '+' bits { if (SIZE($1)+SIZE($3) >= MAX_STRLEN) { yyerror("Combined bit string size exceeds " MAX_STRLEN_S " bits"); YYERROR; } $$ = New_BinOp( BITSTR, $1, '+', $3 ); TEST($$); SIZE($$) = SIZE($1) + SIZE($3); } | bits '[' expr ']' { $$ = New_Deref( $1, 1, $3, 0, 0, 0, 0 ); TEST($$); } | bits '[' expr ',' expr ']' { $$ = New_Deref( $1, 2, $3, $5, 0, 0, 0 ); TEST($$); } | bits '[' expr ',' expr ',' expr ']' { $$ = New_Deref( $1, 3, $3, $5, $7, 0, 0 ); TEST($$); } | bits '[' expr ',' expr ',' expr ',' expr ']' { $$ = New_Deref( $1, 4, $3, $5, $7, $9, 0 ); TEST($$); } | bits '[' expr ',' expr ',' expr ',' expr ',' expr ']' { $$ = New_Deref( $1, 5, $3, $5, $7, $9, $11 ); TEST($$); } | NOT bits { $$ = New_Unary( BITSTR, NOT, $2 ); TEST($$); } | '(' bits ')' { $$ = $2; } ; expr: LONG { $$ = New_Const( LONG, &($1), sizeof(long) ); TEST($$); } | DOUBLE { $$ = New_Const( DOUBLE, &($1), sizeof(double) ); TEST($$); } | COLUMN { $$ = New_Column( $1 ); TEST($$); } | COLUMN '{' expr '}' { if( TYPE($3) != LONG || OPER($3) != CONST_OP ) { yyerror("Offset argument must be a constant integer"); YYERROR; } $$ = New_Offset( $1, $3 ); TEST($$); } | ROWREF { $$ = New_Func( LONG, row_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); } | NULLREF { $$ = New_Func( LONG, null_fct, 0, 0, 0, 0, 0, 0, 0, 0 ); } | expr '%' expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, '%', $3 ); TEST($$); } | expr '+' expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, '+', $3 ); TEST($$); } | expr '-' expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, '-', $3 ); TEST($$); } | expr '*' expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, '*', $3 ); TEST($$); } | expr '/' expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, '/', $3 ); TEST($$); } | expr POWER expr { PROMOTE($1,$3); $$ = New_BinOp( TYPE($1), $1, POWER, $3 ); TEST($$); } | '+' expr %prec UMINUS { $$ = $2; } | '-' expr %prec UMINUS { $$ = New_Unary( TYPE($2), UMINUS, $2 ); TEST($$); } | '(' expr ')' { $$ = $2; } | expr '*' bexpr { $3 = New_Unary( TYPE($1), 0, $3 ); $$ = New_BinOp( TYPE($1), $1, '*', $3 ); TEST($$); } | bexpr '*' expr { $1 = New_Unary( TYPE($3), 0, $1 ); $$ = New_BinOp( TYPE($3), $1, '*', $3 ); TEST($$); } | bexpr '?' expr ':' expr { PROMOTE($3,$5); if( ! Test_Dims($3,$5) ) { yyerror("Incompatible dimensions in '?:' arguments"); YYERROR; } $$ = New_Func( 0, ifthenelse_fct, 3, $3, $5, $1, 0, 0, 0, 0 ); TEST($$); if( SIZE($3)=SIZE($4) && Test_Dims( $2, $4 ) ) { PROMOTE($2,$4); $$ = New_Func( 0, defnull_fct, 2, $2, $4, 0, 0, 0, 0, 0 ); TEST($$); } else { yyerror("Dimensions of DEFNULL arguments " "are not compatible"); YYERROR; } } else if (FSTRCMP($1,"ARCTAN2(") == 0) { if( TYPE($2) != DOUBLE ) $2 = New_Unary( DOUBLE, 0, $2 ); if( TYPE($4) != DOUBLE ) $4 = New_Unary( DOUBLE, 0, $4 ); if( Test_Dims( $2, $4 ) ) { $$ = New_Func( 0, atan2_fct, 2, $2, $4, 0, 0, 0, 0, 0 ); TEST($$); if( SIZE($2)=SIZE($4) && Test_Dims( $2, $4 ) ) { $$ = New_Func( 0, defnull_fct, 2, $2, $4, 0, 0, 0, 0, 0 ); TEST($$); } else { yyerror("Dimensions of DEFNULL arguments are not compatible"); YYERROR; } } else { yyerror("Boolean Function(expr,expr) not supported"); YYERROR; } } | BFUNCTION expr ',' expr ',' expr ')' { if( TYPE($2) != DOUBLE ) $2 = New_Unary( DOUBLE, 0, $2 ); if( TYPE($4) != DOUBLE ) $4 = New_Unary( DOUBLE, 0, $4 ); if( TYPE($6) != DOUBLE ) $6 = New_Unary( DOUBLE, 0, $6 ); if( ! (Test_Dims( $2, $4 ) && Test_Dims( $4, $6 ) ) ) { yyerror("Dimensions of NEAR arguments " "are not compatible"); YYERROR; } else { if (FSTRCMP($1,"NEAR(") == 0) { $$ = New_Func( BOOLEAN, near_fct, 3, $2, $4, $6, 0, 0, 0, 0 ); } else { yyerror("Boolean Function not supported"); YYERROR; } TEST($$); if( SIZE($$)= MAX_STRLEN) { yyerror("Combined string size exceeds " MAX_STRLEN_S " characters"); YYERROR; } $$ = New_BinOp( STRING, $1, '+', $3 ); TEST($$); SIZE($$) = SIZE($1) + SIZE($3); } | bexpr '?' sexpr ':' sexpr { int outSize; if( SIZE($1)!=1 ) { yyerror("Cannot have a vector string column"); YYERROR; } /* Since the output can be calculated now, as a constant scalar, we must precalculate the output size, in order to avoid an overflow. */ outSize = SIZE($3); if (SIZE($5) > outSize) outSize = SIZE($5); $$ = New_FuncSize( 0, ifthenelse_fct, 3, $3, $5, $1, 0, 0, 0, 0, outSize); TEST($$); if( SIZE($3) outSize) outSize = SIZE($4); $$ = New_FuncSize( 0, defnull_fct, 2, $2, $4, 0, 0, 0, 0, 0, outSize ); TEST($$); if( SIZE($4)>SIZE($2) ) SIZE($$) = SIZE($4); } else { yyerror("Function(string,string) not supported"); YYERROR; } } | FUNCTION sexpr ',' expr ',' expr ')' { if (FSTRCMP($1,"STRMID(") == 0) { int len; if( TYPE($4) != LONG || SIZE($4) != 1 || TYPE($6) != LONG || SIZE($6) != 1) { yyerror("When using STRMID(S,P,N), P and N must be integers (and not vector columns)"); YYERROR; } if (OPER($6) == CONST_OP) { /* Constant value: use that directly */ len = (gParse.Nodes[$6].value.data.lng); } else { /* Variable value: use the maximum possible (from $2) */ len = SIZE($2); } if (len <= 0 || len >= MAX_STRLEN) { yyerror("STRMID(S,P,N), N must be 1-" MAX_STRLEN_S); YYERROR; } $$ = New_FuncSize( 0, strmid_fct, 3, $2, $4,$6,0,0,0,0,len); TEST($$); } else { yyerror("Function(string,expr,expr) not supported"); YYERROR; } } ; %% /*************************************************************************/ /* Start of "New" routines which build the expression Nodal structure */ /*************************************************************************/ static int Alloc_Node( void ) { /* Use this for allocation to guarantee *Nodes */ Node *newNodePtr; /* survives on failure, making it still valid */ /* while working our way out of this error */ if( gParse.nNodes == gParse.nNodesAlloc ) { if( gParse.Nodes ) { gParse.nNodesAlloc += gParse.nNodesAlloc; newNodePtr = (Node *)realloc( gParse.Nodes, sizeof(Node)*gParse.nNodesAlloc ); } else { gParse.nNodesAlloc = 100; newNodePtr = (Node *)malloc ( sizeof(Node)*gParse.nNodesAlloc ); } if( newNodePtr ) { gParse.Nodes = newNodePtr; } else { gParse.status = MEMORY_ALLOCATION; return( -1 ); } } return ( gParse.nNodes++ ); } static void Free_Last_Node( void ) { if( gParse.nNodes ) gParse.nNodes--; } static int New_Const( int returnType, void *value, long len ) { Node *this; int n; n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = CONST_OP; /* Flag a constant */ this->DoOp = NULL; this->nSubNodes = 0; this->type = returnType; memcpy( &(this->value.data), value, len ); this->value.undef = NULL; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } return(n); } static int New_Column( int ColNum ) { Node *this; int n, i; n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = -ColNum; this->DoOp = NULL; this->nSubNodes = 0; this->type = gParse.varData[ColNum].type; this->value.nelem = gParse.varData[ColNum].nelem; this->value.naxis = gParse.varData[ColNum].naxis; for( i=0; ivalue.naxes[i] = gParse.varData[ColNum].naxes[i]; } return(n); } static int New_Offset( int ColNum, int offsetNode ) { Node *this; int n, i, colNode; colNode = New_Column( ColNum ); if( colNode<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = '{'; this->DoOp = Do_Offset; this->nSubNodes = 2; this->SubNodes[0] = colNode; this->SubNodes[1] = offsetNode; this->type = gParse.varData[ColNum].type; this->value.nelem = gParse.varData[ColNum].nelem; this->value.naxis = gParse.varData[ColNum].naxis; for( i=0; ivalue.naxes[i] = gParse.varData[ColNum].naxes[i]; } return(n); } static int New_Unary( int returnType, int Op, int Node1 ) { Node *this, *that; int i,n; if( Node1<0 ) return(-1); that = gParse.Nodes + Node1; if( !Op ) Op = returnType; if( (Op==DOUBLE || Op==FLTCAST) && that->type==DOUBLE ) return( Node1 ); if( (Op==LONG || Op==INTCAST) && that->type==LONG ) return( Node1 ); if( (Op==BOOLEAN ) && that->type==BOOLEAN ) return( Node1 ); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = Op; this->DoOp = Do_Unary; this->nSubNodes = 1; this->SubNodes[0] = Node1; this->type = returnType; that = gParse.Nodes + Node1; /* Reset in case .Nodes mv'd */ this->value.nelem = that->value.nelem; this->value.naxis = that->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that->value.naxes[i]; if( that->operation==CONST_OP ) this->DoOp( this ); } return( n ); } static int New_BinOp( int returnType, int Node1, int Op, int Node2 ) { Node *this,*that1,*that2; int n,i,constant; if( Node1<0 || Node2<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = Op; this->nSubNodes = 2; this->SubNodes[0]= Node1; this->SubNodes[1]= Node2; this->type = returnType; that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; constant = (that1->operation==CONST_OP && that2->operation==CONST_OP); if( that1->type!=STRING && that1->type!=BITSTR ) if( !Test_Dims( Node1, Node2 ) ) { Free_Last_Node(); yyerror("Array sizes/dims do not match for binary operator"); return(-1); } if( that1->value.nelem == 1 ) that1 = that2; this->value.nelem = that1->value.nelem; this->value.naxis = that1->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that1->value.naxes[i]; if ( Op == ACCUM && that1->type == BITSTR ) { /* ACCUM is rank-reducing on bit strings */ this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } /* Both subnodes should be of same time */ switch( that1->type ) { case BITSTR: this->DoOp = Do_BinOp_bit; break; case STRING: this->DoOp = Do_BinOp_str; break; case BOOLEAN: this->DoOp = Do_BinOp_log; break; case LONG: this->DoOp = Do_BinOp_lng; break; case DOUBLE: this->DoOp = Do_BinOp_dbl; break; } if( constant ) this->DoOp( this ); } return( n ); } static int New_Func( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7 ) { return New_FuncSize(returnType, Op, nNodes, Node1, Node2, Node3, Node4, Node5, Node6, Node7, 0); } static int New_FuncSize( int returnType, funcOp Op, int nNodes, int Node1, int Node2, int Node3, int Node4, int Node5, int Node6, int Node7, int Size ) /* If returnType==0 , use Node1's type and vector sizes as returnType, */ /* else return a single value of type returnType */ { Node *this, *that; int i,n,constant; if( Node1<0 || Node2<0 || Node3<0 || Node4<0 || Node5<0 || Node6<0 || Node7<0 ) return(-1); n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->operation = (int)Op; this->DoOp = Do_Func; this->nSubNodes = nNodes; this->SubNodes[0] = Node1; this->SubNodes[1] = Node2; this->SubNodes[2] = Node3; this->SubNodes[3] = Node4; this->SubNodes[4] = Node5; this->SubNodes[5] = Node6; this->SubNodes[6] = Node7; i = constant = nNodes; /* Functions with zero params are not const */ if (Op == poirnd_fct) constant = 0; /* Nor is Poisson deviate */ while( i-- ) constant = ( constant && OPER(this->SubNodes[i]) == CONST_OP ); if( returnType ) { this->type = returnType; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } else { that = gParse.Nodes + Node1; this->type = that->type; this->value.nelem = that->value.nelem; this->value.naxis = that->value.naxis; for( i=0; ivalue.naxis; i++ ) this->value.naxes[i] = that->value.naxes[i]; } /* Force explicit size before evaluating */ if (Size > 0) this->value.nelem = Size; if( constant ) this->DoOp( this ); } return( n ); } static int New_Deref( int Var, int nDim, int Dim1, int Dim2, int Dim3, int Dim4, int Dim5 ) { int n, idx, constant; long elem=0; Node *this, *theVar, *theDim[MAXDIMS]; if( Var<0 || Dim1<0 || Dim2<0 || Dim3<0 || Dim4<0 || Dim5<0 ) return(-1); theVar = gParse.Nodes + Var; if( theVar->operation==CONST_OP || theVar->value.nelem==1 ) { yyerror("Cannot index a scalar value"); return(-1); } n = Alloc_Node(); if( n>=0 ) { this = gParse.Nodes + n; this->nSubNodes = nDim+1; theVar = gParse.Nodes + (this->SubNodes[0]=Var); theDim[0] = gParse.Nodes + (this->SubNodes[1]=Dim1); theDim[1] = gParse.Nodes + (this->SubNodes[2]=Dim2); theDim[2] = gParse.Nodes + (this->SubNodes[3]=Dim3); theDim[3] = gParse.Nodes + (this->SubNodes[4]=Dim4); theDim[4] = gParse.Nodes + (this->SubNodes[5]=Dim5); constant = theVar->operation==CONST_OP; for( idx=0; idxoperation==CONST_OP); for( idx=0; idxvalue.nelem>1 ) { Free_Last_Node(); yyerror("Cannot use an array as an index value"); return(-1); } else if( theDim[idx]->type!=LONG ) { Free_Last_Node(); yyerror("Index value must be an integer type"); return(-1); } this->operation = '['; this->DoOp = Do_Deref; this->type = theVar->type; if( theVar->value.naxis == nDim ) { /* All dimensions specified */ this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; } else if( nDim==1 ) { /* Dereference only one dimension */ elem=1; this->value.naxis = theVar->value.naxis-1; for( idx=0; idxvalue.naxis; idx++ ) { elem *= ( this->value.naxes[idx] = theVar->value.naxes[idx] ); } this->value.nelem = elem; } else { Free_Last_Node(); yyerror("Must specify just one or all indices for vector"); return(-1); } if( constant ) this->DoOp( this ); } return(n); } extern int yyGetVariable( char *varName, YYSTYPE *varVal ); static int New_GTI( char *fname, int Node1, char *start, char *stop ) { fitsfile *fptr; Node *this, *that0, *that1; int type,i,n, startCol, stopCol, Node0; int hdutype, hdunum, evthdu, samefile, extvers, movetotype, tstat; char extname[100]; long nrows; double timeZeroI[2], timeZeroF[2], dt, timeSpan; char xcol[20], xexpr[20]; YYSTYPE colVal; if( Node1==-99 ) { type = yyGetVariable( "TIME", &colVal ); if( type==COLUMN ) { Node1 = New_Column( (int)colVal.lng ); } else { yyerror("Could not build TIME column for GTIFILTER"); return(-1); } } Node1 = New_Unary( DOUBLE, 0, Node1 ); Node0 = Alloc_Node(); /* This will hold the START/STOP times */ if( Node1<0 || Node0<0 ) return(-1); /* Record current HDU number in case we need to move within this file */ fptr = gParse.def_fptr; ffghdn( fptr, &evthdu ); /* Look for TIMEZERO keywords in current extension */ tstat = 0; if( ffgkyd( fptr, "TIMEZERO", timeZeroI, NULL, &tstat ) ) { tstat = 0; if( ffgkyd( fptr, "TIMEZERI", timeZeroI, NULL, &tstat ) ) { timeZeroI[0] = timeZeroF[0] = 0.0; } else if( ffgkyd( fptr, "TIMEZERF", timeZeroF, NULL, &tstat ) ) { timeZeroF[0] = 0.0; } } else { timeZeroF[0] = 0.0; } /* Resolve filename parameter */ switch( fname[0] ) { case '\0': samefile = 1; hdunum = 1; break; case '[': samefile = 1; i = 1; while( fname[i] != '\0' && fname[i] != ']' ) i++; if( fname[i] ) { fname[i] = '\0'; fname++; ffexts( fname, &hdunum, extname, &extvers, &movetotype, xcol, xexpr, &gParse.status ); if( *extname ) { ffmnhd( fptr, movetotype, extname, extvers, &gParse.status ); ffghdn( fptr, &hdunum ); } else if( hdunum ) { ffmahd( fptr, ++hdunum, &hdutype, &gParse.status ); } else if( !gParse.status ) { yyerror("Cannot use primary array for GTI filter"); return( -1 ); } } else { yyerror("File extension specifier lacks closing ']'"); return( -1 ); } break; case '+': samefile = 1; hdunum = atoi( fname ) + 1; if( hdunum>1 ) ffmahd( fptr, hdunum, &hdutype, &gParse.status ); else { yyerror("Cannot use primary array for GTI filter"); return( -1 ); } break; default: samefile = 0; if( ! ffopen( &fptr, fname, READONLY, &gParse.status ) ) ffghdn( fptr, &hdunum ); break; } if( gParse.status ) return(-1); /* If at primary, search for GTI extension */ if( hdunum==1 ) { while( 1 ) { hdunum++; if( ffmahd( fptr, hdunum, &hdutype, &gParse.status ) ) break; if( hdutype==IMAGE_HDU ) continue; tstat = 0; if( ffgkys( fptr, "EXTNAME", extname, NULL, &tstat ) ) continue; ffupch( extname ); if( strstr( extname, "GTI" ) ) break; } if( gParse.status ) { if( gParse.status==END_OF_FILE ) yyerror("GTI extension not found in this file"); return(-1); } } /* Locate START/STOP Columns */ ffgcno( fptr, CASEINSEN, start, &startCol, &gParse.status ); ffgcno( fptr, CASEINSEN, stop, &stopCol, &gParse.status ); if( gParse.status ) return(-1); /* Look for TIMEZERO keywords in GTI extension */ tstat = 0; if( ffgkyd( fptr, "TIMEZERO", timeZeroI+1, NULL, &tstat ) ) { tstat = 0; if( ffgkyd( fptr, "TIMEZERI", timeZeroI+1, NULL, &tstat ) ) { timeZeroI[1] = timeZeroF[1] = 0.0; } else if( ffgkyd( fptr, "TIMEZERF", timeZeroF+1, NULL, &tstat ) ) { timeZeroF[1] = 0.0; } } else { timeZeroF[1] = 0.0; } n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; this->nSubNodes = 2; this->SubNodes[1] = Node1; this->operation = (int)gtifilt_fct; this->DoOp = Do_GTI; this->type = BOOLEAN; that1 = gParse.Nodes + Node1; this->value.nelem = that1->value.nelem; this->value.naxis = that1->value.naxis; for( i=0; i < that1->value.naxis; i++ ) this->value.naxes[i] = that1->value.naxes[i]; /* Init START/STOP node to be treated as a "constant" */ this->SubNodes[0] = Node0; that0 = gParse.Nodes + Node0; that0->operation = CONST_OP; that0->DoOp = NULL; that0->value.data.ptr= NULL; /* Read in START/STOP times */ if( ffgkyj( fptr, "NAXIS2", &nrows, NULL, &gParse.status ) ) return(-1); that0->value.nelem = nrows; if( nrows ) { that0->value.data.dblptr = (double*)malloc( 2*nrows*sizeof(double) ); if( !that0->value.data.dblptr ) { gParse.status = MEMORY_ALLOCATION; return(-1); } ffgcvd( fptr, startCol, 1L, 1L, nrows, 0.0, that0->value.data.dblptr, &i, &gParse.status ); ffgcvd( fptr, stopCol, 1L, 1L, nrows, 0.0, that0->value.data.dblptr+nrows, &i, &gParse.status ); if( gParse.status ) { free( that0->value.data.dblptr ); return(-1); } /* Test for fully time-ordered GTI... both START && STOP */ that0->type = 1; /* Assume yes */ i = nrows; while( --i ) if( that0->value.data.dblptr[i-1] >= that0->value.data.dblptr[i] || that0->value.data.dblptr[i-1+nrows] >= that0->value.data.dblptr[i+nrows] ) { that0->type = 0; break; } /* Handle TIMEZERO offset, if any */ dt = (timeZeroI[1] - timeZeroI[0]) + (timeZeroF[1] - timeZeroF[0]); timeSpan = that0->value.data.dblptr[nrows+nrows-1] - that0->value.data.dblptr[0]; if( fabs( dt / timeSpan ) > 1e-12 ) { for( i=0; i<(nrows+nrows); i++ ) that0->value.data.dblptr[i] += dt; } } if( OPER(Node1)==CONST_OP ) this->DoOp( this ); } if( samefile ) ffmahd( fptr, evthdu, &hdutype, &gParse.status ); else ffclos( fptr, &gParse.status ); return( n ); } static int New_REG( char *fname, int NodeX, int NodeY, char *colNames ) { Node *this, *that0; int type, n, Node0; int Xcol, Ycol, tstat; WCSdata wcs; SAORegion *Rgn; char *cX, *cY; YYSTYPE colVal; if( NodeX==-99 ) { type = yyGetVariable( "X", &colVal ); if( type==COLUMN ) { NodeX = New_Column( (int)colVal.lng ); } else { yyerror("Could not build X column for REGFILTER"); return(-1); } } if( NodeY==-99 ) { type = yyGetVariable( "Y", &colVal ); if( type==COLUMN ) { NodeY = New_Column( (int)colVal.lng ); } else { yyerror("Could not build Y column for REGFILTER"); return(-1); } } NodeX = New_Unary( DOUBLE, 0, NodeX ); NodeY = New_Unary( DOUBLE, 0, NodeY ); Node0 = Alloc_Node(); /* This will hold the Region Data */ if( NodeX<0 || NodeY<0 || Node0<0 ) return(-1); if( ! (Test_Dims( NodeX, NodeY ) ) ) { yyerror("Dimensions of REGFILTER arguments are not compatible"); return (-1); } n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; this->nSubNodes = 3; this->SubNodes[0] = Node0; this->SubNodes[1] = NodeX; this->SubNodes[2] = NodeY; this->operation = (int)regfilt_fct; this->DoOp = Do_REG; this->type = BOOLEAN; this->value.nelem = 1; this->value.naxis = 1; this->value.naxes[0] = 1; Copy_Dims(n, NodeX); if( SIZE(NodeX)operation = CONST_OP; that0->DoOp = NULL; /* Identify what columns to use for WCS information */ Xcol = Ycol = 0; if( *colNames ) { /* Use the column names in this string for WCS info */ while( *colNames==' ' ) colNames++; cX = cY = colNames; while( *cY && *cY!=' ' && *cY!=',' ) cY++; if( *cY ) *(cY++) = '\0'; while( *cY==' ' ) cY++; if( !*cY ) { yyerror("Could not extract valid pair of column names from REGFILTER"); Free_Last_Node(); return( -1 ); } fits_get_colnum( gParse.def_fptr, CASEINSEN, cX, &Xcol, &gParse.status ); fits_get_colnum( gParse.def_fptr, CASEINSEN, cY, &Ycol, &gParse.status ); if( gParse.status ) { yyerror("Could not locate columns indicated for WCS info"); Free_Last_Node(); return( -1 ); } } else { /* Try to find columns used in X/Y expressions */ Xcol = Locate_Col( gParse.Nodes + NodeX ); Ycol = Locate_Col( gParse.Nodes + NodeY ); if( Xcol<0 || Ycol<0 ) { yyerror("Found multiple X/Y column references in REGFILTER"); Free_Last_Node(); return( -1 ); } } /* Now, get the WCS info, if it exists, from the indicated columns */ wcs.exists = 0; if( Xcol>0 && Ycol>0 ) { tstat = 0; ffgtcs( gParse.def_fptr, Xcol, Ycol, &wcs.xrefval, &wcs.yrefval, &wcs.xrefpix, &wcs.yrefpix, &wcs.xinc, &wcs.yinc, &wcs.rot, wcs.type, &tstat ); if( tstat==NO_WCS_KEY ) { wcs.exists = 0; } else if( tstat ) { gParse.status = tstat; Free_Last_Node(); return( -1 ); } else { wcs.exists = 1; } } /* Read in Region file */ fits_read_rgnfile( fname, &wcs, &Rgn, &gParse.status ); if( gParse.status ) { Free_Last_Node(); return( -1 ); } that0->value.data.ptr = Rgn; if( OPER(NodeX)==CONST_OP && OPER(NodeY)==CONST_OP ) this->DoOp( this ); } return( n ); } static int New_Vector( int subNode ) { Node *this, *that; int n; n = Alloc_Node(); if( n >= 0 ) { this = gParse.Nodes + n; that = gParse.Nodes + subNode; this->type = that->type; this->nSubNodes = 1; this->SubNodes[0] = subNode; this->operation = '{'; this->DoOp = Do_Vector; } return( n ); } static int Close_Vec( int vecNode ) { Node *this; int n, nelem=0; this = gParse.Nodes + vecNode; for( n=0; n < this->nSubNodes; n++ ) { if( TYPE( this->SubNodes[n] ) != this->type ) { this->SubNodes[n] = New_Unary( this->type, 0, this->SubNodes[n] ); if( this->SubNodes[n]<0 ) return(-1); } nelem += SIZE(this->SubNodes[n]); } this->value.naxis = 1; this->value.nelem = nelem; this->value.naxes[0] = nelem; return( vecNode ); } static int Locate_Col( Node *this ) /* Locate the TABLE column number of any columns in "this" calculation. */ /* Return ZERO if none found, or negative if more than 1 found. */ { Node *that; int i, col=0, newCol, nfound=0; if( this->nSubNodes==0 && this->operation<=0 && this->operation!=CONST_OP ) return gParse.colData[ - this->operation].colnum; for( i=0; inSubNodes; i++ ) { that = gParse.Nodes + this->SubNodes[i]; if( that->operation>0 ) { newCol = Locate_Col( that ); if( newCol<=0 ) { nfound += -newCol; } else { if( !nfound ) { col = newCol; nfound++; } else if( col != newCol ) { nfound++; } } } else if( that->operation!=CONST_OP ) { /* Found a Column */ newCol = gParse.colData[- that->operation].colnum; if( !nfound ) { col = newCol; nfound++; } else if( col != newCol ) { nfound++; } } } if( nfound!=1 ) return( - nfound ); else return( col ); } static int Test_Dims( int Node1, int Node2 ) { Node *that1, *that2; int valid, i; if( Node1<0 || Node2<0 ) return(0); that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; if( that1->value.nelem==1 || that2->value.nelem==1 ) valid = 1; else if( that1->type==that2->type && that1->value.nelem==that2->value.nelem && that1->value.naxis==that2->value.naxis ) { valid = 1; for( i=0; ivalue.naxis; i++ ) { if( that1->value.naxes[i]!=that2->value.naxes[i] ) valid = 0; } } else valid = 0; return( valid ); } static void Copy_Dims( int Node1, int Node2 ) { Node *that1, *that2; int i; if( Node1<0 || Node2<0 ) return; that1 = gParse.Nodes + Node1; that2 = gParse.Nodes + Node2; that1->value.nelem = that2->value.nelem; that1->value.naxis = that2->value.naxis; for( i=0; ivalue.naxis; i++ ) that1->value.naxes[i] = that2->value.naxes[i]; } /********************************************************************/ /* Routines for actually evaluating the expression start here */ /********************************************************************/ void Evaluate_Parser( long firstRow, long nRows ) /***********************************************************************/ /* Reset the parser for processing another batch of data... */ /* firstRow: Row number of the first element to evaluate */ /* nRows: Number of rows to be processed */ /* Initialize each COLUMN node so that its UNDEF and DATA pointers */ /* point to the appropriate column arrays. */ /* Finally, call Evaluate_Node for final node. */ /***********************************************************************/ { int i, column; long offset, rowOffset; gParse.firstRow = firstRow; gParse.nRows = nRows; /* Reset Column Nodes' pointers to point to right data and UNDEF arrays */ rowOffset = firstRow - gParse.firstDataRow; for( i=0; i 0 || OPER(i) == CONST_OP ) continue; column = -OPER(i); offset = gParse.varData[column].nelem * rowOffset; gParse.Nodes[i].value.undef = gParse.varData[column].undef + offset; switch( gParse.Nodes[i].type ) { case BITSTR: gParse.Nodes[i].value.data.strptr = (char**)gParse.varData[column].data + rowOffset; gParse.Nodes[i].value.undef = NULL; break; case STRING: gParse.Nodes[i].value.data.strptr = (char**)gParse.varData[column].data + rowOffset; gParse.Nodes[i].value.undef = gParse.varData[column].undef + rowOffset; break; case BOOLEAN: gParse.Nodes[i].value.data.logptr = (char*)gParse.varData[column].data + offset; break; case LONG: gParse.Nodes[i].value.data.lngptr = (long*)gParse.varData[column].data + offset; break; case DOUBLE: gParse.Nodes[i].value.data.dblptr = (double*)gParse.varData[column].data + offset; break; } } Evaluate_Node( gParse.resultNode ); } static void Evaluate_Node( int thisNode ) /**********************************************************************/ /* Recursively evaluate thisNode's subNodes, then call one of the */ /* Do_ functions pointed to by thisNode's DoOp element. */ /**********************************************************************/ { Node *this; int i; if( gParse.status ) return; this = gParse.Nodes + thisNode; if( this->operation>0 ) { /* <=0 indicate constants and columns */ i = this->nSubNodes; while( i-- ) { Evaluate_Node( this->SubNodes[i] ); if( gParse.status ) return; } this->DoOp( this ); } } static void Allocate_Ptrs( Node *this ) { long elem, row, size; if( this->type==BITSTR || this->type==STRING ) { this->value.data.strptr = (char**)malloc( gParse.nRows * sizeof(char*) ); if( this->value.data.strptr ) { this->value.data.strptr[0] = (char*)malloc( gParse.nRows * (this->value.nelem+2) * sizeof(char) ); if( this->value.data.strptr[0] ) { row = 0; while( (++row)value.data.strptr[row] = this->value.data.strptr[row-1] + this->value.nelem+1; } if( this->type==STRING ) { this->value.undef = this->value.data.strptr[row-1] + this->value.nelem+1; } else { this->value.undef = NULL; /* BITSTRs don't use undef array */ } } else { gParse.status = MEMORY_ALLOCATION; free( this->value.data.strptr ); } } else { gParse.status = MEMORY_ALLOCATION; } } else { elem = this->value.nelem * gParse.nRows; switch( this->type ) { case DOUBLE: size = sizeof( double ); break; case LONG: size = sizeof( long ); break; case BOOLEAN: size = sizeof( char ); break; default: size = 1; break; } this->value.data.ptr = calloc(size+1, elem); if( this->value.data.ptr==NULL ) { gParse.status = MEMORY_ALLOCATION; } else { this->value.undef = (char *)this->value.data.ptr + elem*size; } } } static void Do_Unary( Node *this ) { Node *that; long elem; that = gParse.Nodes + this->SubNodes[0]; if( that->operation==CONST_OP ) { /* Operating on a constant! */ switch( this->operation ) { case DOUBLE: case FLTCAST: if( that->type==LONG ) this->value.data.dbl = (double)that->value.data.lng; else if( that->type==BOOLEAN ) this->value.data.dbl = ( that->value.data.log ? 1.0 : 0.0 ); break; case LONG: case INTCAST: if( that->type==DOUBLE ) this->value.data.lng = (long)that->value.data.dbl; else if( that->type==BOOLEAN ) this->value.data.lng = ( that->value.data.log ? 1L : 0L ); break; case BOOLEAN: if( that->type==DOUBLE ) this->value.data.log = ( that->value.data.dbl != 0.0 ); else if( that->type==LONG ) this->value.data.log = ( that->value.data.lng != 0L ); break; case UMINUS: if( that->type==DOUBLE ) this->value.data.dbl = - that->value.data.dbl; else if( that->type==LONG ) this->value.data.lng = - that->value.data.lng; break; case NOT: if( that->type==BOOLEAN ) this->value.data.log = ( ! that->value.data.log ); else if( that->type==BITSTR ) bitnot( this->value.data.str, that->value.data.str ); break; } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { if( this->type!=BITSTR ) { elem = gParse.nRows; if( this->type!=STRING ) elem *= this->value.nelem; while( elem-- ) this->value.undef[elem] = that->value.undef[elem]; } elem = gParse.nRows * this->value.nelem; switch( this->operation ) { case BOOLEAN: if( that->type==DOUBLE ) while( elem-- ) this->value.data.logptr[elem] = ( that->value.data.dblptr[elem] != 0.0 ); else if( that->type==LONG ) while( elem-- ) this->value.data.logptr[elem] = ( that->value.data.lngptr[elem] != 0L ); break; case DOUBLE: case FLTCAST: if( that->type==LONG ) while( elem-- ) this->value.data.dblptr[elem] = (double)that->value.data.lngptr[elem]; else if( that->type==BOOLEAN ) while( elem-- ) this->value.data.dblptr[elem] = ( that->value.data.logptr[elem] ? 1.0 : 0.0 ); break; case LONG: case INTCAST: if( that->type==DOUBLE ) while( elem-- ) this->value.data.lngptr[elem] = (long)that->value.data.dblptr[elem]; else if( that->type==BOOLEAN ) while( elem-- ) this->value.data.lngptr[elem] = ( that->value.data.logptr[elem] ? 1L : 0L ); break; case UMINUS: if( that->type==DOUBLE ) { while( elem-- ) this->value.data.dblptr[elem] = - that->value.data.dblptr[elem]; } else if( that->type==LONG ) { while( elem-- ) this->value.data.lngptr[elem] = - that->value.data.lngptr[elem]; } break; case NOT: if( that->type==BOOLEAN ) { while( elem-- ) this->value.data.logptr[elem] = ( ! that->value.data.logptr[elem] ); } else if( that->type==BITSTR ) { elem = gParse.nRows; while( elem-- ) bitnot( this->value.data.strptr[elem], that->value.data.strptr[elem] ); } break; } } } if( that->operation>0 ) { free( that->value.data.ptr ); } } static void Do_Offset( Node *this ) { Node *col; long fRow, nRowOverlap, nRowReload, rowOffset; long nelem, elem, offset, nRealElem; int status; col = gParse.Nodes + this->SubNodes[0]; rowOffset = gParse.Nodes[ this->SubNodes[1] ].value.data.lng; Allocate_Ptrs( this ); fRow = gParse.firstRow + rowOffset; if( this->type==STRING || this->type==BITSTR ) nRealElem = 1; else nRealElem = this->value.nelem; nelem = nRealElem; if( fRow < gParse.firstDataRow ) { /* Must fill in data at start of array */ nRowReload = gParse.firstDataRow - fRow; if( nRowReload > gParse.nRows ) nRowReload = gParse.nRows; nRowOverlap = gParse.nRows - nRowReload; offset = 0; /* NULLify any values falling out of bounds */ while( fRow<1 && nRowReload>0 ) { if( this->type == BITSTR ) { nelem = this->value.nelem; this->value.data.strptr[offset][ nelem ] = '\0'; while( nelem-- ) this->value.data.strptr[offset][nelem] = '0'; offset++; } else { while( nelem-- ) this->value.undef[offset++] = 1; } nelem = nRealElem; fRow++; nRowReload--; } } else if( fRow + gParse.nRows > gParse.firstDataRow + gParse.nDataRows ) { /* Must fill in data at end of array */ nRowReload = (fRow+gParse.nRows) - (gParse.firstDataRow+gParse.nDataRows); if( nRowReload>gParse.nRows ) { nRowReload = gParse.nRows; } else { fRow = gParse.firstDataRow + gParse.nDataRows; } nRowOverlap = gParse.nRows - nRowReload; offset = nRowOverlap * nelem; /* NULLify any values falling out of bounds */ elem = gParse.nRows * nelem; while( fRow+nRowReload>gParse.totalRows && nRowReload>0 ) { if( this->type == BITSTR ) { nelem = this->value.nelem; elem--; this->value.data.strptr[elem][ nelem ] = '\0'; while( nelem-- ) this->value.data.strptr[elem][nelem] = '0'; } else { while( nelem-- ) this->value.undef[--elem] = 1; } nelem = nRealElem; nRowReload--; } } else { nRowReload = 0; nRowOverlap = gParse.nRows; offset = 0; } if( nRowReload>0 ) { switch( this->type ) { case BITSTR: case STRING: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.strptr+offset, this->value.undef+offset ); break; case BOOLEAN: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.logptr+offset, this->value.undef+offset ); break; case LONG: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.lngptr+offset, this->value.undef+offset ); break; case DOUBLE: status = (*gParse.loadData)( -col->operation, fRow, nRowReload, this->value.data.dblptr+offset, this->value.undef+offset ); break; } } /* Now copy over the overlapping region, if any */ if( nRowOverlap <= 0 ) return; if( rowOffset>0 ) elem = nRowOverlap * nelem; else elem = gParse.nRows * nelem; offset = nelem * rowOffset; while( nRowOverlap-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( this->type != BITSTR ) this->value.undef[elem] = col->value.undef[elem+offset]; switch( this->type ) { case BITSTR: strcpy( this->value.data.strptr[elem ], col->value.data.strptr[elem+offset] ); break; case STRING: strcpy( this->value.data.strptr[elem ], col->value.data.strptr[elem+offset] ); break; case BOOLEAN: this->value.data.logptr[elem] = col->value.data.logptr[elem+offset]; break; case LONG: this->value.data.lngptr[elem] = col->value.data.lngptr[elem+offset]; break; case DOUBLE: this->value.data.dblptr[elem] = col->value.data.dblptr[elem+offset]; break; } } nelem = nRealElem; } } static void Do_BinOp_bit( Node *this ) { Node *that1, *that2; char *sptr1=NULL, *sptr2=NULL; int const1, const2; long rows; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; const1 = ( that1->operation==CONST_OP ); const2 = ( that2->operation==CONST_OP ); sptr1 = ( const1 ? that1->value.data.str : NULL ); sptr2 = ( const2 ? that2->value.data.str : NULL ); if( const1 && const2 ) { switch( this->operation ) { case NE: this->value.data.log = !bitcmp( sptr1, sptr2 ); break; case EQ: this->value.data.log = bitcmp( sptr1, sptr2 ); break; case GT: case LT: case LTE: case GTE: this->value.data.log = bitlgte( sptr1, this->operation, sptr2 ); break; case '|': bitor( this->value.data.str, sptr1, sptr2 ); break; case '&': bitand( this->value.data.str, sptr1, sptr2 ); break; case '+': strcpy( this->value.data.str, sptr1 ); strcat( this->value.data.str, sptr2 ); break; case ACCUM: this->value.data.lng = 0; while( *sptr1 ) { if ( *sptr1 == '1' ) this->value.data.lng ++; sptr1 ++; } break; } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; switch( this->operation ) { /* BITSTR comparisons */ case NE: case EQ: case GT: case LT: case LTE: case GTE: while( rows-- ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; switch( this->operation ) { case NE: this->value.data.logptr[rows] = !bitcmp( sptr1, sptr2 ); break; case EQ: this->value.data.logptr[rows] = bitcmp( sptr1, sptr2 ); break; case GT: case LT: case LTE: case GTE: this->value.data.logptr[rows] = bitlgte( sptr1, this->operation, sptr2 ); break; } this->value.undef[rows] = 0; } break; /* BITSTR AND/ORs ... no UNDEFS in or out */ case '|': case '&': case '+': while( rows-- ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; if( this->operation=='|' ) bitor( this->value.data.strptr[rows], sptr1, sptr2 ); else if( this->operation=='&' ) bitand( this->value.data.strptr[rows], sptr1, sptr2 ); else { strcpy( this->value.data.strptr[rows], sptr1 ); strcat( this->value.data.strptr[rows], sptr2 ); } } break; /* Accumulate 1 bits */ case ACCUM: { long i, previous, curr; previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.data.strptr[i]; for (curr = 0; *sptr1; sptr1 ++) { if ( *sptr1 == '1' ) curr ++; } previous += curr; this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } } } } if( that1->operation>0 ) { free( that1->value.data.strptr[0] ); free( that1->value.data.strptr ); } if( that2->operation>0 ) { free( that2->value.data.strptr[0] ); free( that2->value.data.strptr ); } } static void Do_BinOp_str( Node *this ) { Node *that1, *that2; char *sptr1, *sptr2, null1=0, null2=0; int const1, const2, val; long rows; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; const1 = ( that1->operation==CONST_OP ); const2 = ( that2->operation==CONST_OP ); sptr1 = ( const1 ? that1->value.data.str : NULL ); sptr2 = ( const2 ? that2->value.data.str : NULL ); if( const1 && const2 ) { /* Result is a constant */ switch( this->operation ) { /* Compare Strings */ case NE: case EQ: val = ( FSTRCMP( sptr1, sptr2 ) == 0 ); this->value.data.log = ( this->operation==EQ ? val : !val ); break; case GT: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) > 0 ); break; case LT: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) < 0 ); break; case GTE: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) >= 0 ); break; case LTE: this->value.data.log = ( FSTRCMP( sptr1, sptr2 ) <= 0 ); break; /* Concat Strings */ case '+': strcpy( this->value.data.str, sptr1 ); strcat( this->value.data.str, sptr2 ); break; } this->operation = CONST_OP; } else { /* Not a constant */ Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; switch( this->operation ) { /* Compare Strings */ case NE: case EQ: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) == 0 ); this->value.data.logptr[rows] = ( this->operation==EQ ? val : !val ); } } break; case GT: case LT: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) ); this->value.data.logptr[rows] = ( this->operation==GT ? val>0 : val<0 ); } } break; case GTE: case LTE: while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; val = ( FSTRCMP( sptr1, sptr2 ) ); this->value.data.logptr[rows] = ( this->operation==GTE ? val>=0 : val<=0 ); } } break; /* Concat Strings */ case '+': while( rows-- ) { if( !const1 ) null1 = that1->value.undef[rows]; if( !const2 ) null2 = that2->value.undef[rows]; this->value.undef[rows] = (null1 || null2); if( ! this->value.undef[rows] ) { if( !const1 ) sptr1 = that1->value.data.strptr[rows]; if( !const2 ) sptr2 = that2->value.data.strptr[rows]; strcpy( this->value.data.strptr[rows], sptr1 ); strcat( this->value.data.strptr[rows], sptr2 ); } } break; } } } if( that1->operation>0 ) { free( that1->value.data.strptr[0] ); free( that1->value.data.strptr ); } if( that2->operation>0 ) { free( that2->value.data.strptr[0] ); free( that2->value.data.strptr ); } } static void Do_BinOp_log( Node *this ) { Node *that1, *that2; int vector1, vector2; char val1=0, val2=0, null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.log; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.log; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case OR: this->value.data.log = (val1 || val2); break; case AND: this->value.data.log = (val1 && val2); break; case EQ: this->value.data.log = ( (val1 && val2) || (!val1 && !val2) ); break; case NE: this->value.data.log = ( (val1 && !val2) || (!val1 && val2) ); break; case ACCUM: this->value.data.lng = val1; break; } this->operation=CONST_OP; } else if (this->operation == ACCUM) { long i, previous, curr; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.logptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { if (this->operation == ACCUM) { long i, previous, curr; previous = that2->value.data.lng; /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.logptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } /* Store final cumulant for next pass */ that2->value.data.lng = previous; } while( rows-- ) { while( nelem-- ) { elem--; if( vector1>1 ) { val1 = that1->value.data.logptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.logptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.logptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.logptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case OR: /* This is more complicated than others to suppress UNDEFs */ /* in those cases where the other argument is DEF && TRUE */ if( !null1 && !null2 ) { this->value.data.logptr[elem] = (val1 || val2); } else if( (null1 && !null2 && val2) || ( !null1 && null2 && val1 ) ) { this->value.data.logptr[elem] = 1; this->value.undef[elem] = 0; } break; case AND: /* This is more complicated than others to suppress UNDEFs */ /* in those cases where the other argument is DEF && FALSE */ if( !null1 && !null2 ) { this->value.data.logptr[elem] = (val1 && val2); } else if( (null1 && !null2 && !val2) || ( !null1 && null2 && !val1 ) ) { this->value.data.logptr[elem] = 0; this->value.undef[elem] = 0; } break; case EQ: this->value.data.logptr[elem] = ( (val1 && val2) || (!val1 && !val2) ); break; case NE: this->value.data.logptr[elem] = ( (val1 && !val2) || (!val1 && val2) ); break; } } nelem = this->value.nelem; } } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } static void Do_BinOp_lng( Node *this ) { Node *that1, *that2; int vector1, vector2; long val1=0, val2=0; char null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.lng; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.lng; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case '~': /* Treat as == for LONGS */ case EQ: this->value.data.log = (val1 == val2); break; case NE: this->value.data.log = (val1 != val2); break; case GT: this->value.data.log = (val1 > val2); break; case LT: this->value.data.log = (val1 < val2); break; case LTE: this->value.data.log = (val1 <= val2); break; case GTE: this->value.data.log = (val1 >= val2); break; case '+': this->value.data.lng = (val1 + val2); break; case '-': this->value.data.lng = (val1 - val2); break; case '*': this->value.data.lng = (val1 * val2); break; case '%': if( val2 ) this->value.data.lng = (val1 % val2); else yyerror("Divide by Zero"); break; case '/': if( val2 ) this->value.data.lng = (val1 / val2); else yyerror("Divide by Zero"); break; case POWER: this->value.data.lng = (long)pow((double)val1,(double)val2); break; case ACCUM: this->value.data.lng = val1; break; case DIFF: this->value.data.lng = 0; break; } this->operation=CONST_OP; } else if ((this->operation == ACCUM) || (this->operation == DIFF)) { long i, previous, curr; long undef; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.lng; undef = (long) that2->value.undef; if (this->operation == ACCUM) { /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.lngptr[i]; previous += curr; } this->value.data.lngptr[i] = previous; this->value.undef[i] = 0; } } else { /* Sequential difference for this chunk */ for (i=0; ivalue.data.lngptr[i]; if (that1->value.undef[i] || undef) { /* Either this, or previous, value was undefined */ this->value.data.lngptr[i] = 0; this->value.undef[i] = 1; } else { /* Both defined, we are okay! */ this->value.data.lngptr[i] = curr - previous; this->value.undef[i] = 0; } previous = curr; undef = that1->value.undef[i]; } } /* Store final cumulant for next pass */ that2->value.data.lng = previous; that2->value.undef = (char *) undef; /* XXX evil, but no harm here */ } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); while( rows-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( vector1>1 ) { val1 = that1->value.data.lngptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.lngptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.lngptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.lngptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case '~': /* Treat as == for LONGS */ case EQ: this->value.data.logptr[elem] = (val1 == val2); break; case NE: this->value.data.logptr[elem] = (val1 != val2); break; case GT: this->value.data.logptr[elem] = (val1 > val2); break; case LT: this->value.data.logptr[elem] = (val1 < val2); break; case LTE: this->value.data.logptr[elem] = (val1 <= val2); break; case GTE: this->value.data.logptr[elem] = (val1 >= val2); break; case '+': this->value.data.lngptr[elem] = (val1 + val2); break; case '-': this->value.data.lngptr[elem] = (val1 - val2); break; case '*': this->value.data.lngptr[elem] = (val1 * val2); break; case '%': if( val2 ) this->value.data.lngptr[elem] = (val1 % val2); else { this->value.data.lngptr[elem] = 0; this->value.undef[elem] = 1; } break; case '/': if( val2 ) this->value.data.lngptr[elem] = (val1 / val2); else { this->value.data.lngptr[elem] = 0; this->value.undef[elem] = 1; } break; case POWER: this->value.data.lngptr[elem] = (long)pow((double)val1,(double)val2); break; } } nelem = this->value.nelem; } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } static void Do_BinOp_dbl( Node *this ) { Node *that1, *that2; int vector1, vector2; double val1=0.0, val2=0.0; char null1=0, null2=0; long rows, nelem, elem; that1 = gParse.Nodes + this->SubNodes[0]; that2 = gParse.Nodes + this->SubNodes[1]; vector1 = ( that1->operation!=CONST_OP ); if( vector1 ) vector1 = that1->value.nelem; else { val1 = that1->value.data.dbl; } vector2 = ( that2->operation!=CONST_OP ); if( vector2 ) vector2 = that2->value.nelem; else { val2 = that2->value.data.dbl; } if( !vector1 && !vector2 ) { /* Result is a constant */ switch( this->operation ) { case '~': this->value.data.log = ( fabs(val1-val2) < APPROX ); break; case EQ: this->value.data.log = (val1 == val2); break; case NE: this->value.data.log = (val1 != val2); break; case GT: this->value.data.log = (val1 > val2); break; case LT: this->value.data.log = (val1 < val2); break; case LTE: this->value.data.log = (val1 <= val2); break; case GTE: this->value.data.log = (val1 >= val2); break; case '+': this->value.data.dbl = (val1 + val2); break; case '-': this->value.data.dbl = (val1 - val2); break; case '*': this->value.data.dbl = (val1 * val2); break; case '%': if( val2 ) this->value.data.dbl = val1 - val2*((int)(val1/val2)); else yyerror("Divide by Zero"); break; case '/': if( val2 ) this->value.data.dbl = (val1 / val2); else yyerror("Divide by Zero"); break; case POWER: this->value.data.dbl = (double)pow(val1,val2); break; case ACCUM: this->value.data.dbl = val1; break; case DIFF: this->value.data.dbl = 0; break; } this->operation=CONST_OP; } else if ((this->operation == ACCUM) || (this->operation == DIFF)) { long i; long undef; double previous, curr; rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); if( !gParse.status ) { previous = that2->value.data.dbl; undef = (long) that2->value.undef; if (this->operation == ACCUM) { /* Cumulative sum of this chunk */ for (i=0; ivalue.undef[i]) { curr = that1->value.data.dblptr[i]; previous += curr; } this->value.data.dblptr[i] = previous; this->value.undef[i] = 0; } } else { /* Sequential difference for this chunk */ for (i=0; ivalue.data.dblptr[i]; if (that1->value.undef[i] || undef) { /* Either this, or previous, value was undefined */ this->value.data.dblptr[i] = 0; this->value.undef[i] = 1; } else { /* Both defined, we are okay! */ this->value.data.dblptr[i] = curr - previous; this->value.undef[i] = 0; } previous = curr; undef = that1->value.undef[i]; } } /* Store final cumulant for next pass */ that2->value.data.dbl = previous; that2->value.undef = (char *) undef; /* XXX evil, but no harm here */ } } else { rows = gParse.nRows; nelem = this->value.nelem; elem = this->value.nelem * rows; Allocate_Ptrs( this ); while( rows-- && !gParse.status ) { while( nelem-- && !gParse.status ) { elem--; if( vector1>1 ) { val1 = that1->value.data.dblptr[elem]; null1 = that1->value.undef[elem]; } else if( vector1 ) { val1 = that1->value.data.dblptr[rows]; null1 = that1->value.undef[rows]; } if( vector2>1 ) { val2 = that2->value.data.dblptr[elem]; null2 = that2->value.undef[elem]; } else if( vector2 ) { val2 = that2->value.data.dblptr[rows]; null2 = that2->value.undef[rows]; } this->value.undef[elem] = (null1 || null2); switch( this->operation ) { case '~': this->value.data.logptr[elem] = ( fabs(val1-val2) < APPROX ); break; case EQ: this->value.data.logptr[elem] = (val1 == val2); break; case NE: this->value.data.logptr[elem] = (val1 != val2); break; case GT: this->value.data.logptr[elem] = (val1 > val2); break; case LT: this->value.data.logptr[elem] = (val1 < val2); break; case LTE: this->value.data.logptr[elem] = (val1 <= val2); break; case GTE: this->value.data.logptr[elem] = (val1 >= val2); break; case '+': this->value.data.dblptr[elem] = (val1 + val2); break; case '-': this->value.data.dblptr[elem] = (val1 - val2); break; case '*': this->value.data.dblptr[elem] = (val1 * val2); break; case '%': if( val2 ) this->value.data.dblptr[elem] = val1 - val2*((int)(val1/val2)); else { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } break; case '/': if( val2 ) this->value.data.dblptr[elem] = (val1 / val2); else { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } break; case POWER: this->value.data.dblptr[elem] = (double)pow(val1,val2); break; } } nelem = this->value.nelem; } } if( that1->operation>0 ) { free( that1->value.data.ptr ); } if( that2->operation>0 ) { free( that2->value.data.ptr ); } } /* * This Quickselect routine is based on the algorithm described in * "Numerical recipes in C", Second Edition, * Cambridge University Press, 1992, Section 8.5, ISBN 0-521-43108-5 * This code by Nicolas Devillard - 1998. Public domain. * http://ndevilla.free.fr/median/median/src/quickselect.c */ #define ELEM_SWAP(a,b) { register long t=(a);(a)=(b);(b)=t; } /* * qselect_median_lng - select the median value of a long array * * This routine selects the median value of the long integer array * arr[]. If there are an even number of elements, the "lower median" * is selected. * * The array arr[] is scrambled, so users must operate on a scratch * array if they wish the values to be preserved. * * long arr[] - array of values * int n - number of elements in arr * * RETURNS: the lower median value of arr[] * */ long qselect_median_lng(long arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) { /* One element only */ return arr[median]; } if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median]; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP #define ELEM_SWAP(a,b) { register double t=(a);(a)=(b);(b)=t; } /* * qselect_median_dbl - select the median value of a double array * * This routine selects the median value of the double array * arr[]. If there are an even number of elements, the "lower median" * is selected. * * The array arr[] is scrambled, so users must operate on a scratch * array if they wish the values to be preserved. * * double arr[] - array of values * int n - number of elements in arr * * RETURNS: the lower median value of arr[] * */ double qselect_median_dbl(double arr[], int n) { int low, high ; int median; int middle, ll, hh; low = 0 ; high = n-1 ; median = (low + high) / 2; for (;;) { if (high <= low) { /* One element only */ return arr[median] ; } if (high == low + 1) { /* Two elements only */ if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; return arr[median] ; } /* Find median of low, middle and high items; swap into position low */ middle = (low + high) / 2; if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ; if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ; if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ; /* Swap low item (now in position middle) into position (low+1) */ ELEM_SWAP(arr[middle], arr[low+1]) ; /* Nibble from each end towards middle, swapping items when stuck */ ll = low + 1; hh = high; for (;;) { do ll++; while (arr[low] > arr[ll]) ; do hh--; while (arr[hh] > arr[low]) ; if (hh < ll) break; ELEM_SWAP(arr[ll], arr[hh]) ; } /* Swap middle item (in position low) back into correct position */ ELEM_SWAP(arr[low], arr[hh]) ; /* Re-set active partition */ if (hh <= median) low = ll; if (hh >= median) high = hh - 1; } } #undef ELEM_SWAP /* * angsep_calc - compute angular separation between celestial coordinates * * This routine computes the angular separation between to coordinates * on the celestial sphere (i.e. RA and Dec). Note that all units are * in DEGREES, unlike the other trig functions in the calculator. * * double ra1, dec1 - RA and Dec of the first position in degrees * double ra2, dec2 - RA and Dec of the second position in degrees * * RETURNS: (double) angular separation in degrees * */ double angsep_calc(double ra1, double dec1, double ra2, double dec2) { double cd; static double deg = 0; double a, sdec, sra; if (deg == 0) deg = ((double)4)*atan((double)1)/((double)180); /* deg = 1.0; **** UNCOMMENT IF YOU WANT RADIANS */ /* This (commented out) algorithm uses the Low of Cosines, which becomes unstable for angles less than 0.1 arcsec. cd = sin(dec1*deg)*sin(dec2*deg) + cos(dec1*deg)*cos(dec2*deg)*cos((ra1-ra2)*deg); if (cd < (-1)) cd = -1; if (cd > (+1)) cd = +1; return acos(cd)/deg; */ /* The algorithm is the law of Haversines. This algorithm is stable even when the points are close together. The normal Law of Cosines fails for angles around 0.1 arcsec. */ sra = sin( (ra2 - ra1)*deg / 2 ); sdec = sin( (dec2 - dec1)*deg / 2); a = sdec*sdec + cos(dec1*deg)*cos(dec2*deg)*sra*sra; /* Sanity checking to avoid a range error in the sqrt()'s below */ if (a < 0) { a = 0; } if (a > 1) { a = 1; } return 2.0*atan2(sqrt(a), sqrt(1.0 - a)) / deg; } static double ran1() { static double dval = 0.0; double rndVal; if (dval == 0.0) { if( rand()<32768 && rand()<32768 ) dval = 32768.0; else dval = 2147483648.0; } rndVal = (double)rand(); while( rndVal > dval ) dval *= 2.0; return rndVal/dval; } /* Gaussian deviate routine from Numerical Recipes */ static double gasdev() { static int iset = 0; static double gset; double fac, rsq, v1, v2; if (iset == 0) { do { v1 = 2.0*ran1()-1.0; v2 = 2.0*ran1()-1.0; rsq = v1*v1 + v2*v2; } while (rsq >= 1.0 || rsq == 0.0); fac = sqrt(-2.0*log(rsq)/rsq); gset = v1*fac; iset = 1; return v2*fac; } else { iset = 0; return gset; } } /* lgamma function - from Numerical Recipes */ float gammaln(float xx) /* Returns the value ln Gamma[(xx)] for xx > 0. */ { /* Internal arithmetic will be done in double precision, a nicety that you can omit if five-figure accuracy is good enough. */ double x,y,tmp,ser; static double cof[6]={76.18009172947146,-86.50532032941677, 24.01409824083091,-1.231739572450155, 0.1208650973866179e-2,-0.5395239384953e-5}; int j; y=x=xx; tmp=x+5.5; tmp -= (x+0.5)*log(tmp); ser=1.000000000190015; for (j=0;j<=5;j++) ser += cof[j]/++y; return (float) -tmp+log(2.5066282746310005*ser/x); } /* Poisson deviate - derived from Numerical Recipes */ static long poidev(double xm) { static double sq, alxm, g, oldm = -1.0; static double pi = 0; double em, t, y; if (pi == 0) pi = ((double)4)*atan((double)1); if (xm < 20.0) { if (xm != oldm) { oldm = xm; g = exp(-xm); } em = -1; t = 1.0; do { em += 1; t *= ran1(); } while (t > g); } else { if (xm != oldm) { oldm = xm; sq = sqrt(2.0*xm); alxm = log(xm); g = xm*alxm-gammaln( (float) (xm+1.0)); } do { do { y = tan(pi*ran1()); em = sq*y+xm; } while (em < 0.0); em = floor(em); t = 0.9*(1.0+y*y)*exp(em*alxm-gammaln( (float) (em+1.0) )-g); } while (ran1() > t); } /* Return integer version */ return (long int) floor(em+0.5); } static void Do_Func( Node *this ) { Node *theParams[MAXSUBS]; int vector[MAXSUBS], allConst; lval pVals[MAXSUBS]; char pNull[MAXSUBS]; long ival; double dval; int i, valInit; long row, elem, nelem; i = this->nSubNodes; allConst = 1; while( i-- ) { theParams[i] = gParse.Nodes + this->SubNodes[i]; vector[i] = ( theParams[i]->operation!=CONST_OP ); if( vector[i] ) { allConst = 0; vector[i] = theParams[i]->value.nelem; } else { if( theParams[i]->type==DOUBLE ) { pVals[i].data.dbl = theParams[i]->value.data.dbl; } else if( theParams[i]->type==LONG ) { pVals[i].data.lng = theParams[i]->value.data.lng; } else if( theParams[i]->type==BOOLEAN ) { pVals[i].data.log = theParams[i]->value.data.log; } else strcpy(pVals[i].data.str, theParams[i]->value.data.str); pNull[i] = 0; } } if( this->nSubNodes==0 ) allConst = 0; /* These do produce scalars */ /* Random numbers are *never* constant !! */ if( this->operation == poirnd_fct ) allConst = 0; if( this->operation == gasrnd_fct ) allConst = 0; if( this->operation == rnd_fct ) allConst = 0; if( allConst ) { switch( this->operation ) { /* Non-Trig single-argument functions */ case sum_fct: if( theParams[0]->type==BOOLEAN ) this->value.data.lng = ( pVals[0].data.log ? 1 : 0 ); else if( theParams[0]->type==LONG ) this->value.data.lng = pVals[0].data.lng; else if( theParams[0]->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( theParams[0]->type==BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case average_fct: if( theParams[0]->type==LONG ) this->value.data.dbl = pVals[0].data.lng; else if( theParams[0]->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; break; case stddev_fct: this->value.data.dbl = 0; /* Standard deviation of a constant = 0 */ break; case median_fct: if( theParams[0]->type==BOOLEAN ) this->value.data.lng = ( pVals[0].data.log ? 1 : 0 ); else if( theParams[0]->type==LONG ) this->value.data.lng = pVals[0].data.lng; else this->value.data.dbl = pVals[0].data.dbl; break; case poirnd_fct: if( theParams[0]->type==DOUBLE ) this->value.data.lng = poidev(pVals[0].data.dbl); else this->value.data.lng = poidev(pVals[0].data.lng); break; case abs_fct: if( theParams[0]->type==DOUBLE ) { dval = pVals[0].data.dbl; this->value.data.dbl = (dval>0.0 ? dval : -dval); } else { ival = pVals[0].data.lng; this->value.data.lng = (ival> 0 ? ival : -ival); } break; /* Special Null-Handling Functions */ case nonnull_fct: this->value.data.lng = 1; /* Constants are always 1-element and defined */ break; case isnull_fct: /* Constants are always defined */ this->value.data.log = 0; break; case defnull_fct: if( this->type==BOOLEAN ) this->value.data.log = pVals[0].data.log; else if( this->type==LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type==DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type==STRING ) strcpy(this->value.data.str,pVals[0].data.str); break; /* Math functions with 1 double argument */ case sin_fct: this->value.data.dbl = sin( pVals[0].data.dbl ); break; case cos_fct: this->value.data.dbl = cos( pVals[0].data.dbl ); break; case tan_fct: this->value.data.dbl = tan( pVals[0].data.dbl ); break; case asin_fct: dval = pVals[0].data.dbl; if( dval<-1.0 || dval>1.0 ) yyerror("Out of range argument to arcsin"); else this->value.data.dbl = asin( dval ); break; case acos_fct: dval = pVals[0].data.dbl; if( dval<-1.0 || dval>1.0 ) yyerror("Out of range argument to arccos"); else this->value.data.dbl = acos( dval ); break; case atan_fct: this->value.data.dbl = atan( pVals[0].data.dbl ); break; case sinh_fct: this->value.data.dbl = sinh( pVals[0].data.dbl ); break; case cosh_fct: this->value.data.dbl = cosh( pVals[0].data.dbl ); break; case tanh_fct: this->value.data.dbl = tanh( pVals[0].data.dbl ); break; case exp_fct: this->value.data.dbl = exp( pVals[0].data.dbl ); break; case log_fct: dval = pVals[0].data.dbl; if( dval<=0.0 ) yyerror("Out of range argument to log"); else this->value.data.dbl = log( dval ); break; case log10_fct: dval = pVals[0].data.dbl; if( dval<=0.0 ) yyerror("Out of range argument to log10"); else this->value.data.dbl = log10( dval ); break; case sqrt_fct: dval = pVals[0].data.dbl; if( dval<0.0 ) yyerror("Out of range argument to sqrt"); else this->value.data.dbl = sqrt( dval ); break; case ceil_fct: this->value.data.dbl = ceil( pVals[0].data.dbl ); break; case floor_fct: this->value.data.dbl = floor( pVals[0].data.dbl ); break; case round_fct: this->value.data.dbl = floor( pVals[0].data.dbl + 0.5 ); break; /* Two-argument Trig Functions */ case atan2_fct: this->value.data.dbl = atan2( pVals[0].data.dbl, pVals[1].data.dbl ); break; /* Four-argument ANGSEP function */ case angsep_fct: this->value.data.dbl = angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl); /* Min/Max functions taking 1 or 2 arguments */ case min1_fct: /* No constant vectors! */ if( this->type == DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type == LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type == BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case min2_fct: if( this->type == DOUBLE ) this->value.data.dbl = minvalue( pVals[0].data.dbl, pVals[1].data.dbl ); else if( this->type == LONG ) this->value.data.lng = minvalue( pVals[0].data.lng, pVals[1].data.lng ); break; case max1_fct: /* No constant vectors! */ if( this->type == DOUBLE ) this->value.data.dbl = pVals[0].data.dbl; else if( this->type == LONG ) this->value.data.lng = pVals[0].data.lng; else if( this->type == BITSTR ) strcpy(this->value.data.str, pVals[0].data.str); break; case max2_fct: if( this->type == DOUBLE ) this->value.data.dbl = maxvalue( pVals[0].data.dbl, pVals[1].data.dbl ); else if( this->type == LONG ) this->value.data.lng = maxvalue( pVals[0].data.lng, pVals[1].data.lng ); break; /* Boolean SAO region Functions... scalar or vector dbls */ case near_fct: this->value.data.log = bnear( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl ); break; case circle_fct: this->value.data.log = circle( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl ); break; case box_fct: this->value.data.log = saobox( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); break; case elps_fct: this->value.data.log = ellipse( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); break; /* C Conditional expression: bool ? expr : expr */ case ifthenelse_fct: switch( this->type ) { case BOOLEAN: this->value.data.log = ( pVals[2].data.log ? pVals[0].data.log : pVals[1].data.log ); break; case LONG: this->value.data.lng = ( pVals[2].data.log ? pVals[0].data.lng : pVals[1].data.lng ); break; case DOUBLE: this->value.data.dbl = ( pVals[2].data.log ? pVals[0].data.dbl : pVals[1].data.dbl ); break; case STRING: strcpy(this->value.data.str, ( pVals[2].data.log ? pVals[0].data.str : pVals[1].data.str ) ); break; } break; /* String functions */ case strmid_fct: cstrmid(this->value.data.str, this->value.nelem, pVals[0].data.str, pVals[0].nelem, pVals[1].data.lng); break; case strpos_fct: { char *res = strstr(pVals[0].data.str, pVals[1].data.str); if (res == NULL) { this->value.data.lng = 0; } else { this->value.data.lng = (res - pVals[0].data.str) + 1; } break; } } this->operation = CONST_OP; } else { Allocate_Ptrs( this ); row = gParse.nRows; elem = row * this->value.nelem; if( !gParse.status ) { switch( this->operation ) { /* Special functions with no arguments */ case row_fct: while( row-- ) { this->value.data.lngptr[row] = gParse.firstRow + row; this->value.undef[row] = 0; } break; case null_fct: if( this->type==LONG ) { while( row-- ) { this->value.data.lngptr[row] = 0; this->value.undef[row] = 1; } } else if( this->type==STRING ) { while( row-- ) { this->value.data.strptr[row][0] = '\0'; this->value.undef[row] = 1; } } break; case rnd_fct: while( elem-- ) { this->value.data.dblptr[elem] = ran1(); this->value.undef[elem] = 0; } break; case gasrnd_fct: while( elem-- ) { this->value.data.dblptr[elem] = gasdev(); this->value.undef[elem] = 0; } break; case poirnd_fct: if( theParams[0]->type==DOUBLE ) { if (theParams[0]->operation == CONST_OP) { while( elem-- ) { this->value.undef[elem] = (pVals[0].data.dbl < 0); if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(pVals[0].data.dbl); } } } else { while( elem-- ) { this->value.undef[elem] = theParams[0]->value.undef[elem]; if (theParams[0]->value.data.dblptr[elem] < 0) this->value.undef[elem] = 1; if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(theParams[0]->value.data.dblptr[elem]); } } /* while */ } /* ! CONST_OP */ } else { /* LONG */ if (theParams[0]->operation == CONST_OP) { while( elem-- ) { this->value.undef[elem] = (pVals[0].data.lng < 0); if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(pVals[0].data.lng); } } } else { while( elem-- ) { this->value.undef[elem] = theParams[0]->value.undef[elem]; if (theParams[0]->value.data.lngptr[elem] < 0) this->value.undef[elem] = 1; if (! this->value.undef[elem]) { this->value.data.lngptr[elem] = poidev(theParams[0]->value.data.lngptr[elem]); } } /* while */ } /* ! CONST_OP */ } /* END LONG */ break; /* Non-Trig single-argument functions */ case sum_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==BOOLEAN ) { while( row-- ) { this->value.data.lngptr[row] = 0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.lngptr[row] += ( theParams[0]->value.data.logptr[elem] ? 1 : 0 ); this->value.undef[row] = 0; } } } } else if( theParams[0]->type==LONG ) { while( row-- ) { this->value.data.lngptr[row] = 0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.lngptr[row] += theParams[0]->value.data.lngptr[elem]; this->value.undef[row] = 0; } } } } else if( theParams[0]->type==DOUBLE ){ while( row-- ) { this->value.data.dblptr[row] = 0.0; /* Default is UNDEF until a defined value is found */ this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( ! theParams[0]->value.undef[elem] ) { this->value.data.dblptr[row] += theParams[0]->value.data.dblptr[elem]; this->value.undef[row] = 0; } } } } else { /* BITSTR */ nelem = theParams[0]->value.nelem; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; this->value.data.lngptr[row] = 0; this->value.undef[row] = 0; while (*sptr1) { if (*sptr1 == '1') this->value.data.lngptr[row] ++; sptr1++; } } } break; case average_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { while( row-- ) { int count = 0; this->value.data.dblptr[row] = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { this->value.data.dblptr[row] += theParams[0]->value.data.lngptr[elem]; count ++; } } if (count == 0) { this->value.undef[row] = 1; } else { this->value.undef[row] = 0; this->value.data.dblptr[row] /= count; } } } else if( theParams[0]->type==DOUBLE ){ while( row-- ) { int count = 0; this->value.data.dblptr[row] = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { this->value.data.dblptr[row] += theParams[0]->value.data.dblptr[elem]; count ++; } } if (count == 0) { this->value.undef[row] = 1; } else { this->value.undef[row] = 0; this->value.data.dblptr[row] /= count; } } } break; case stddev_fct: elem = row * theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { /* Compute the mean value */ while( row-- ) { int count = 0; double sum = 0, sum2 = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { sum += theParams[0]->value.data.lngptr[elem]; count ++; } } if (count > 1) { sum /= count; /* Compute the sum of squared deviations */ nelem = theParams[0]->value.nelem; elem += nelem; /* Reset elem for second pass */ while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { double dx = (theParams[0]->value.data.lngptr[elem] - sum); sum2 += (dx*dx); } } sum2 /= (double)count-1; this->value.undef[row] = 0; this->value.data.dblptr[row] = sqrt(sum2); } else { this->value.undef[row] = 0; /* STDDEV => 0 */ this->value.data.dblptr[row] = 0; } } } else if( theParams[0]->type==DOUBLE ){ /* Compute the mean value */ while( row-- ) { int count = 0; double sum = 0, sum2 = 0; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { sum += theParams[0]->value.data.dblptr[elem]; count ++; } } if (count > 1) { sum /= count; /* Compute the sum of squared deviations */ nelem = theParams[0]->value.nelem; elem += nelem; /* Reset elem for second pass */ while( nelem-- ) { elem--; if (theParams[0]->value.undef[elem] == 0) { double dx = (theParams[0]->value.data.dblptr[elem] - sum); sum2 += (dx*dx); } } sum2 /= (double)count-1; this->value.undef[row] = 0; this->value.data.dblptr[row] = sqrt(sum2); } else { this->value.undef[row] = 0; /* STDDEV => 0 */ this->value.data.dblptr[row] = 0; } } } break; case median_fct: elem = row * theParams[0]->value.nelem; nelem = theParams[0]->value.nelem; if( theParams[0]->type==LONG ) { long *dptr = theParams[0]->value.data.lngptr; char *uptr = theParams[0]->value.undef; long *mptr = (long *) malloc(sizeof(long)*nelem); int irow; /* Allocate temporary storage for this row, since the quickselect function will scramble the contents */ if (mptr == 0) { yyerror("Could not allocate temporary memory in median function"); free( this->value.data.ptr ); break; } for (irow=0; irow 0) { this->value.undef[irow] = 0; this->value.data.lngptr[irow] = qselect_median_lng(mptr, nelem1); } else { this->value.undef[irow] = 1; this->value.data.lngptr[irow] = 0; } } free(mptr); } else { double *dptr = theParams[0]->value.data.dblptr; char *uptr = theParams[0]->value.undef; double *mptr = (double *) malloc(sizeof(double)*nelem); int irow; /* Allocate temporary storage for this row, since the quickselect function will scramble the contents */ if (mptr == 0) { yyerror("Could not allocate temporary memory in median function"); free( this->value.data.ptr ); break; } for (irow=0; irow 0) { this->value.undef[irow] = 0; this->value.data.dblptr[irow] = qselect_median_dbl(mptr, nelem1); } else { this->value.undef[irow] = 1; this->value.data.dblptr[irow] = 0; } } free(mptr); } break; case abs_fct: if( theParams[0]->type==DOUBLE ) while( elem-- ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = (dval>0.0 ? dval : -dval); this->value.undef[elem] = theParams[0]->value.undef[elem]; } else while( elem-- ) { ival = theParams[0]->value.data.lngptr[elem]; this->value.data.lngptr[elem] = (ival> 0 ? ival : -ival); this->value.undef[elem] = theParams[0]->value.undef[elem]; } break; /* Special Null-Handling Functions */ case nonnull_fct: nelem = theParams[0]->value.nelem; if ( theParams[0]->type==STRING ) nelem = 1; elem = row * nelem; while( row-- ) { int nelem1 = nelem; this->value.undef[row] = 0; /* Initialize to 0 (defined) */ this->value.data.lngptr[row] = 0; while( nelem1-- ) { elem --; if ( theParams[0]->value.undef[elem] == 0 ) this->value.data.lngptr[row] ++; } } break; case isnull_fct: if( theParams[0]->type==STRING ) elem = row; while( elem-- ) { this->value.data.logptr[elem] = theParams[0]->value.undef[elem]; this->value.undef[elem] = 0; } break; case defnull_fct: switch( this->type ) { case BOOLEAN: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.log = theParams[i]->value.data.logptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.log = theParams[i]->value.data.logptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.logptr[elem] = pVals[1].data.log; } else { this->value.undef[elem] = 0; this->value.data.logptr[elem] = pVals[0].data.log; } } } break; case LONG: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.lngptr[elem] = pVals[1].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } } } break; case DOUBLE: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pNull[i] = theParams[i]->value.undef[elem]; pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; } else if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; } if( pNull[0] ) { this->value.undef[elem] = pNull[1]; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } } } break; case STRING: while( row-- ) { i=2; while( i-- ) if( vector[i] ) { pNull[i] = theParams[i]->value.undef[row]; strcpy(pVals[i].data.str, theParams[i]->value.data.strptr[row]); } if( pNull[0] ) { this->value.undef[row] = pNull[1]; strcpy(this->value.data.strptr[row],pVals[1].data.str); } else { this->value.undef[elem] = 0; strcpy(this->value.data.strptr[row],pVals[0].data.str); } } } break; /* Math functions with 1 double argument */ case sin_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = sin( theParams[0]->value.data.dblptr[elem] ); } break; case cos_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = cos( theParams[0]->value.data.dblptr[elem] ); } break; case tan_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = tan( theParams[0]->value.data.dblptr[elem] ); } break; case asin_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<-1.0 || dval>1.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = asin( dval ); } break; case acos_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<-1.0 || dval>1.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = acos( dval ); } break; case atan_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = atan( dval ); } break; case sinh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = sinh( theParams[0]->value.data.dblptr[elem] ); } break; case cosh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = cosh( theParams[0]->value.data.dblptr[elem] ); } break; case tanh_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = tanh( theParams[0]->value.data.dblptr[elem] ); } break; case exp_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; this->value.data.dblptr[elem] = exp( dval ); } break; case log_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<=0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = log( dval ); } break; case log10_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<=0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = log10( dval ); } break; case sqrt_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { dval = theParams[0]->value.data.dblptr[elem]; if( dval<0.0 ) { this->value.data.dblptr[elem] = 0.0; this->value.undef[elem] = 1; } else this->value.data.dblptr[elem] = sqrt( dval ); } break; case ceil_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = ceil( theParams[0]->value.data.dblptr[elem] ); } break; case floor_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = floor( theParams[0]->value.data.dblptr[elem] ); } break; case round_fct: while( elem-- ) if( !(this->value.undef[elem] = theParams[0]->value.undef[elem]) ) { this->value.data.dblptr[elem] = floor( theParams[0]->value.data.dblptr[elem] + 0.5); } break; /* Two-argument Trig Functions */ case atan2_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1]) ) ) this->value.data.dblptr[elem] = atan2( pVals[0].data.dbl, pVals[1].data.dbl ); } } break; /* Four-argument ANGSEP Function */ case angsep_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=4; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3]) ) ) this->value.data.dblptr[elem] = angsep_calc(pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl); } } break; /* Min/Max functions taking 1 or 2 arguments */ case min1_fct: elem = row * theParams[0]->value.nelem; if( this->type==LONG ) { long minVal=0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; minVal = theParams[0]->value.data.lngptr[elem]; } else { minVal = minvalue( minVal, theParams[0]->value.data.lngptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.lngptr[row] = minVal; } } else if( this->type==DOUBLE ) { double minVal=0.0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; minVal = theParams[0]->value.data.dblptr[elem]; } else { minVal = minvalue( minVal, theParams[0]->value.data.dblptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.dblptr[row] = minVal; } } else if( this->type==BITSTR ) { char minVal; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; minVal = '1'; while (*sptr1) { if (*sptr1 == '0') minVal = '0'; sptr1++; } this->value.data.strptr[row][0] = minVal; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } break; case min2_fct: if( this->type==LONG ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.lngptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[1].data.lng; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = minvalue( pVals[0].data.lng, pVals[1].data.lng ); } } } } else if( this->type==DOUBLE ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.dblptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = minvalue( pVals[0].data.dbl, pVals[1].data.dbl ); } } } } break; case max1_fct: elem = row * theParams[0]->value.nelem; if( this->type==LONG ) { long maxVal=0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; maxVal = theParams[0]->value.data.lngptr[elem]; } else { maxVal = maxvalue( maxVal, theParams[0]->value.data.lngptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.lngptr[row] = maxVal; } } else if( this->type==DOUBLE ) { double maxVal=0.0; while( row-- ) { valInit = 1; this->value.undef[row] = 1; nelem = theParams[0]->value.nelem; while( nelem-- ) { elem--; if ( !theParams[0]->value.undef[elem] ) { if ( valInit ) { valInit = 0; maxVal = theParams[0]->value.data.dblptr[elem]; } else { maxVal = maxvalue( maxVal, theParams[0]->value.data.dblptr[elem] ); } this->value.undef[row] = 0; } } this->value.data.dblptr[row] = maxVal; } } else if( this->type==BITSTR ) { char maxVal; while( row-- ) { char *sptr1 = theParams[0]->value.data.strptr[row]; maxVal = '0'; while (*sptr1) { if (*sptr1 == '1') maxVal = '1'; sptr1++; } this->value.data.strptr[row][0] = maxVal; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } break; case max2_fct: if( this->type==LONG ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.lngptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[1].data.lng; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = pVals[0].data.lng; } else { this->value.undef[elem] = 0; this->value.data.lngptr[elem] = maxvalue( pVals[0].data.lng, pVals[1].data.lng ); } } } } else if( this->type==DOUBLE ) { while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( pNull[0] && pNull[1] ) { this->value.undef[elem] = 1; this->value.data.dblptr[elem] = 0; } else if (pNull[0]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[1].data.dbl; } else if (pNull[1]) { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = pVals[0].data.dbl; } else { this->value.undef[elem] = 0; this->value.data.dblptr[elem] = maxvalue( pVals[0].data.dbl, pVals[1].data.dbl ); } } } } break; /* Boolean SAO region Functions... scalar or vector dbls */ case near_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=3; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2]) ) ) this->value.data.logptr[elem] = bnear( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl ); } } break; case circle_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=5; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4]) ) ) this->value.data.logptr[elem] = circle( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl ); } } break; case box_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=7; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4] || pNull[5] || pNull[6] ) ) ) this->value.data.logptr[elem] = saobox( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); } } break; case elps_fct: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; i=7; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = (pNull[0] || pNull[1] || pNull[2] || pNull[3] || pNull[4] || pNull[5] || pNull[6] ) ) ) this->value.data.logptr[elem] = ellipse( pVals[0].data.dbl, pVals[1].data.dbl, pVals[2].data.dbl, pVals[3].data.dbl, pVals[4].data.dbl, pVals[5].data.dbl, pVals[6].data.dbl ); } } break; /* C Conditional expression: bool ? expr : expr */ case ifthenelse_fct: switch( this->type ) { case BOOLEAN: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.log = theParams[i]->value.data.logptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.log = theParams[i]->value.data.logptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.logptr[elem] = pVals[0].data.log; this->value.undef[elem] = pNull[0]; } else { this->value.data.logptr[elem] = pVals[1].data.log; this->value.undef[elem] = pNull[1]; } } } } break; case LONG: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.lng = theParams[i]->value.data.lngptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.lngptr[elem] = pVals[0].data.lng; this->value.undef[elem] = pNull[0]; } else { this->value.data.lngptr[elem] = pVals[1].data.lng; this->value.undef[elem] = pNull[1]; } } } } break; case DOUBLE: while( row-- ) { nelem = this->value.nelem; while( nelem-- ) { elem--; if( vector[2]>1 ) { pVals[2].data.log = theParams[2]->value.data.logptr[elem]; pNull[2] = theParams[2]->value.undef[elem]; } else if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i]>1 ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[elem]; pNull[i] = theParams[i]->value.undef[elem]; } else if( vector[i] ) { pVals[i].data.dbl = theParams[i]->value.data.dblptr[row]; pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[elem] = pNull[2]) ) { if( pVals[2].data.log ) { this->value.data.dblptr[elem] = pVals[0].data.dbl; this->value.undef[elem] = pNull[0]; } else { this->value.data.dblptr[elem] = pVals[1].data.dbl; this->value.undef[elem] = pNull[1]; } } } } break; case STRING: while( row-- ) { if( vector[2] ) { pVals[2].data.log = theParams[2]->value.data.logptr[row]; pNull[2] = theParams[2]->value.undef[row]; } i=2; while( i-- ) if( vector[i] ) { strcpy( pVals[i].data.str, theParams[i]->value.data.strptr[row] ); pNull[i] = theParams[i]->value.undef[row]; } if( !(this->value.undef[row] = pNull[2]) ) { if( pVals[2].data.log ) { strcpy( this->value.data.strptr[row], pVals[0].data.str ); this->value.undef[row] = pNull[0]; } else { strcpy( this->value.data.strptr[row], pVals[1].data.str ); this->value.undef[row] = pNull[1]; } } else { this->value.data.strptr[row][0] = '\0'; } } break; } break; /* String functions */ case strmid_fct: { int strconst = theParams[0]->operation == CONST_OP; int posconst = theParams[1]->operation == CONST_OP; int lenconst = theParams[2]->operation == CONST_OP; int dest_len = this->value.nelem; int src_len = theParams[0]->value.nelem; while (row--) { int pos; int len; char *str; int undef = 0; if (posconst) { pos = theParams[1]->value.data.lng; } else { pos = theParams[1]->value.data.lngptr[row]; if (theParams[1]->value.undef[row]) undef = 1; } if (strconst) { str = theParams[0]->value.data.str; if (src_len == 0) src_len = strlen(str); } else { str = theParams[0]->value.data.strptr[row]; if (theParams[0]->value.undef[row]) undef = 1; } if (lenconst) { len = dest_len; } else { len = theParams[2]->value.data.lngptr[row]; if (theParams[2]->value.undef[row]) undef = 1; } this->value.data.strptr[row][0] = '\0'; if (pos == 0) undef = 1; if (! undef ) { if (cstrmid(this->value.data.strptr[row], len, str, src_len, pos) < 0) break; } this->value.undef[row] = undef; } } break; /* String functions */ case strpos_fct: { int const1 = theParams[0]->operation == CONST_OP; int const2 = theParams[1]->operation == CONST_OP; while (row--) { char *str1, *str2; int undef = 0; if (const1) { str1 = theParams[0]->value.data.str; } else { str1 = theParams[0]->value.data.strptr[row]; if (theParams[0]->value.undef[row]) undef = 1; } if (const2) { str2 = theParams[1]->value.data.str; } else { str2 = theParams[1]->value.data.strptr[row]; if (theParams[1]->value.undef[row]) undef = 1; } this->value.data.lngptr[row] = 0; if (! undef ) { char *res = strstr(str1, str2); if (res == NULL) { undef = 1; this->value.data.lngptr[row] = 0; } else { this->value.data.lngptr[row] = (res - str1) + 1; } } this->value.undef[row] = undef; } } break; } /* End switch(this->operation) */ } /* End if (!gParse.status) */ } /* End non-constant operations */ i = this->nSubNodes; while( i-- ) { if( theParams[i]->operation>0 ) { /* Currently only numeric params allowed */ free( theParams[i]->value.data.ptr ); } } } static void Do_Deref( Node *this ) { Node *theVar, *theDims[MAXDIMS]; int isConst[MAXDIMS], allConst; long dimVals[MAXDIMS]; int i, nDims; long row, elem, dsize; theVar = gParse.Nodes + this->SubNodes[0]; i = nDims = this->nSubNodes-1; allConst = 1; while( i-- ) { theDims[i] = gParse.Nodes + this->SubNodes[i+1]; isConst[i] = ( theDims[i]->operation==CONST_OP ); if( isConst[i] ) dimVals[i] = theDims[i]->value.data.lng; else allConst = 0; } if( this->type==DOUBLE ) { dsize = sizeof( double ); } else if( this->type==LONG ) { dsize = sizeof( long ); } else if( this->type==BOOLEAN ) { dsize = sizeof( char ); } else dsize = 0; Allocate_Ptrs( this ); if( !gParse.status ) { if( allConst && theVar->value.naxis==nDims ) { /* Dereference completely using constant indices */ elem = 0; i = nDims; while( i-- ) { if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break; elem = theVar->value.naxes[i]*elem + dimVals[i]-1; } if( i<0 ) { for( row=0; rowtype==STRING ) this->value.undef[row] = theVar->value.undef[row]; else if( this->type==BITSTR ) this->value.undef; /* Dummy - BITSTRs do not have undefs */ else this->value.undef[row] = theVar->value.undef[elem]; if( this->type==DOUBLE ) this->value.data.dblptr[row] = theVar->value.data.dblptr[elem]; else if( this->type==LONG ) this->value.data.lngptr[row] = theVar->value.data.lngptr[elem]; else if( this->type==BOOLEAN ) this->value.data.logptr[row] = theVar->value.data.logptr[elem]; else { /* XXX Note, the below expression uses knowledge of the layout of the string format, namely (nelem+1) characters per string, followed by (nelem+1) "undef" values. */ this->value.data.strptr[row][0] = theVar->value.data.strptr[0][elem+row]; this->value.data.strptr[row][1] = 0; /* Null terminate */ } elem += theVar->value.nelem; } } else { yyerror("Index out of range"); free( this->value.data.ptr ); } } else if( allConst && nDims==1 ) { /* Reduce dimensions by 1, using a constant index */ if( dimVals[0] < 1 || dimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) { yyerror("Index out of range"); free( this->value.data.ptr ); } else if ( this->type == BITSTR || this->type == STRING ) { elem = this->value.nelem * (dimVals[0]-1); for( row=0; rowvalue.undef) this->value.undef[row] = theVar->value.undef[row]; memcpy( (char*)this->value.data.strptr[0] + row*sizeof(char)*(this->value.nelem+1), (char*)theVar->value.data.strptr[0] + elem*sizeof(char), this->value.nelem * sizeof(char) ); /* Null terminate */ this->value.data.strptr[row][this->value.nelem] = 0; elem += theVar->value.nelem+1; } } else { elem = this->value.nelem * (dimVals[0]-1); for( row=0; rowvalue.undef + row*this->value.nelem, theVar->value.undef + elem, this->value.nelem * sizeof(char) ); memcpy( (char*)this->value.data.ptr + row*dsize*this->value.nelem, (char*)theVar->value.data.ptr + elem*dsize, this->value.nelem * dsize ); elem += theVar->value.nelem; } } } else if( theVar->value.naxis==nDims ) { /* Dereference completely using an expression for the indices */ for( row=0; rowvalue.undef[row] ) { yyerror("Null encountered as vector index"); free( this->value.data.ptr ); break; } else dimVals[i] = theDims[i]->value.data.lngptr[row]; } } if( gParse.status ) break; elem = 0; i = nDims; while( i-- ) { if( dimVals[i]<1 || dimVals[i]>theVar->value.naxes[i] ) break; elem = theVar->value.naxes[i]*elem + dimVals[i]-1; } if( i<0 ) { elem += row*theVar->value.nelem; if( this->type==STRING ) this->value.undef[row] = theVar->value.undef[row]; else if( this->type==BITSTR ) this->value.undef; /* Dummy - BITSTRs do not have undefs */ else this->value.undef[row] = theVar->value.undef[elem]; if( this->type==DOUBLE ) this->value.data.dblptr[row] = theVar->value.data.dblptr[elem]; else if( this->type==LONG ) this->value.data.lngptr[row] = theVar->value.data.lngptr[elem]; else if( this->type==BOOLEAN ) this->value.data.logptr[row] = theVar->value.data.logptr[elem]; else { /* XXX Note, the below expression uses knowledge of the layout of the string format, namely (nelem+1) characters per string, followed by (nelem+1) "undef" values. */ this->value.data.strptr[row][0] = theVar->value.data.strptr[0][elem+row]; this->value.data.strptr[row][1] = 0; /* Null terminate */ } } else { yyerror("Index out of range"); free( this->value.data.ptr ); } } } else { /* Reduce dimensions by 1, using a nonconstant expression */ for( row=0; rowvalue.undef[row] ) { yyerror("Null encountered as vector index"); free( this->value.data.ptr ); break; } else dimVals[0] = theDims[0]->value.data.lngptr[row]; if( dimVals[0] < 1 || dimVals[0] > theVar->value.naxes[ theVar->value.naxis-1 ] ) { yyerror("Index out of range"); free( this->value.data.ptr ); } else if ( this->type == BITSTR || this->type == STRING ) { elem = this->value.nelem * (dimVals[0]-1); elem += row*(theVar->value.nelem+1); if (this->value.undef) this->value.undef[row] = theVar->value.undef[row]; memcpy( (char*)this->value.data.strptr[0] + row*sizeof(char)*(this->value.nelem+1), (char*)theVar->value.data.strptr[0] + elem*sizeof(char), this->value.nelem * sizeof(char) ); /* Null terminate */ this->value.data.strptr[row][this->value.nelem] = 0; } else { elem = this->value.nelem * (dimVals[0]-1); elem += row*theVar->value.nelem; memcpy( this->value.undef + row*this->value.nelem, theVar->value.undef + elem, this->value.nelem * sizeof(char) ); memcpy( (char*)this->value.data.ptr + row*dsize*this->value.nelem, (char*)theVar->value.data.ptr + elem*dsize, this->value.nelem * dsize ); } } } } if( theVar->operation>0 ) { if (theVar->type == STRING || theVar->type == BITSTR) free(theVar->value.data.strptr[0] ); else free( theVar->value.data.ptr ); } for( i=0; ioperation>0 ) { free( theDims[i]->value.data.ptr ); } } static void Do_GTI( Node *this ) { Node *theExpr, *theTimes; double *start, *stop, *times; long elem, nGTI, gti; int ordered; theTimes = gParse.Nodes + this->SubNodes[0]; theExpr = gParse.Nodes + this->SubNodes[1]; nGTI = theTimes->value.nelem; start = theTimes->value.data.dblptr; stop = theTimes->value.data.dblptr + nGTI; ordered = theTimes->type; if( theExpr->operation==CONST_OP ) { this->value.data.log = (Search_GTI( theExpr->value.data.dbl, nGTI, start, stop, ordered )>=0); this->operation = CONST_OP; } else { Allocate_Ptrs( this ); times = theExpr->value.data.dblptr; if( !gParse.status ) { elem = gParse.nRows * this->value.nelem; if( nGTI ) { gti = -1; while( elem-- ) { if( (this->value.undef[elem] = theExpr->value.undef[elem]) ) continue; /* Before searching entire GTI, check the GTI found last time */ if( gti<0 || times[elem]stop[gti] ) { gti = Search_GTI( times[elem], nGTI, start, stop, ordered ); } this->value.data.logptr[elem] = ( gti>=0 ); } } else while( elem-- ) { this->value.data.logptr[elem] = 0; this->value.undef[elem] = 0; } } } if( theExpr->operation>0 ) free( theExpr->value.data.ptr ); } static long Search_GTI( double evtTime, long nGTI, double *start, double *stop, int ordered ) { long gti, step; if( ordered && nGTI>15 ) { /* If time-ordered and lots of GTIs, */ /* use "FAST" Binary search algorithm */ if( evtTime>=start[0] && evtTime<=stop[nGTI-1] ) { gti = step = (nGTI >> 1); while(1) { if( step>1L ) step >>= 1; if( evtTime>stop[gti] ) { if( evtTime>=start[gti+1] ) gti += step; else { gti = -1L; break; } } else if( evtTime=start[gti] && evtTime<=stop[gti] ) break; } return( gti ); } static void Do_REG( Node *this ) { Node *theRegion, *theX, *theY; double Xval=0.0, Yval=0.0; char Xnull=0, Ynull=0; int Xvector, Yvector; long nelem, elem, rows; theRegion = gParse.Nodes + this->SubNodes[0]; theX = gParse.Nodes + this->SubNodes[1]; theY = gParse.Nodes + this->SubNodes[2]; Xvector = ( theX->operation!=CONST_OP ); if( Xvector ) Xvector = theX->value.nelem; else { Xval = theX->value.data.dbl; } Yvector = ( theY->operation!=CONST_OP ); if( Yvector ) Yvector = theY->value.nelem; else { Yval = theY->value.data.dbl; } if( !Xvector && !Yvector ) { this->value.data.log = ( fits_in_region( Xval, Yval, (SAORegion *)theRegion->value.data.ptr ) != 0 ); this->operation = CONST_OP; } else { Allocate_Ptrs( this ); if( !gParse.status ) { rows = gParse.nRows; nelem = this->value.nelem; elem = rows*nelem; while( rows-- ) { while( nelem-- ) { elem--; if( Xvector>1 ) { Xval = theX->value.data.dblptr[elem]; Xnull = theX->value.undef[elem]; } else if( Xvector ) { Xval = theX->value.data.dblptr[rows]; Xnull = theX->value.undef[rows]; } if( Yvector>1 ) { Yval = theY->value.data.dblptr[elem]; Ynull = theY->value.undef[elem]; } else if( Yvector ) { Yval = theY->value.data.dblptr[rows]; Ynull = theY->value.undef[rows]; } this->value.undef[elem] = ( Xnull || Ynull ); if( this->value.undef[elem] ) continue; this->value.data.logptr[elem] = ( fits_in_region( Xval, Yval, (SAORegion *)theRegion->value.data.ptr ) != 0 ); } nelem = this->value.nelem; } } } if( theX->operation>0 ) free( theX->value.data.ptr ); if( theY->operation>0 ) free( theY->value.data.ptr ); } static void Do_Vector( Node *this ) { Node *that; long row, elem, idx, jdx, offset=0; int node; Allocate_Ptrs( this ); if( !gParse.status ) { for( node=0; nodenSubNodes; node++ ) { that = gParse.Nodes + this->SubNodes[node]; if( that->operation == CONST_OP ) { idx = gParse.nRows*this->value.nelem + offset; while( (idx-=this->value.nelem)>=0 ) { this->value.undef[idx] = 0; switch( this->type ) { case BOOLEAN: this->value.data.logptr[idx] = that->value.data.log; break; case LONG: this->value.data.lngptr[idx] = that->value.data.lng; break; case DOUBLE: this->value.data.dblptr[idx] = that->value.data.dbl; break; } } } else { row = gParse.nRows; idx = row * that->value.nelem; while( row-- ) { elem = that->value.nelem; jdx = row*this->value.nelem + offset; while( elem-- ) { this->value.undef[jdx+elem] = that->value.undef[--idx]; switch( this->type ) { case BOOLEAN: this->value.data.logptr[jdx+elem] = that->value.data.logptr[idx]; break; case LONG: this->value.data.lngptr[jdx+elem] = that->value.data.lngptr[idx]; break; case DOUBLE: this->value.data.dblptr[jdx+elem] = that->value.data.dblptr[idx]; break; } } } } offset += that->value.nelem; } } for( node=0; node < this->nSubNodes; node++ ) if( OPER(this->SubNodes[node])>0 ) free( gParse.Nodes[this->SubNodes[node]].value.data.ptr ); } /*****************************************************************************/ /* Utility routines which perform the calculations on bits and SAO regions */ /*****************************************************************************/ static char bitlgte(char *bits1, int oper, char *bits2) { int val1, val2, nextbit; char result; int i, l1, l2, length, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bits1); l2 = strlen(bits2); if (l1 < l2) { length = l2; ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bits1++); stream[i] = '\0'; bits1 = stream; } else if (l2 < l1) { length = l1; ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bits2++); stream[i] = '\0'; bits2 = stream; } else length = l1; val1 = val2 = 0; nextbit = 1; while( length-- ) { chr1 = bits1[length]; chr2 = bits2[length]; if ((chr1 != 'x')&&(chr1 != 'X')&&(chr2 != 'x')&&(chr2 != 'X')) { if (chr1 == '1') val1 += nextbit; if (chr2 == '1') val2 += nextbit; nextbit *= 2; } } result = 0; switch (oper) { case LT: if (val1 < val2) result = 1; break; case LTE: if (val1 <= val2) result = 1; break; case GT: if (val1 > val2) result = 1; break; case GTE: if (val1 >= val2) result = 1; break; } return (result); } static void bitand(char *result,char *bitstrm1,char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while ( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ((chr1 == 'x') || (chr2 == 'x')) *result = 'x'; else if ((chr1 == '1') && (chr2 == '1')) *result = '1'; else *result = '0'; result++; } *result = '\0'; } static void bitor(char *result,char *bitstrm1,char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while ( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ((chr1 == '1') || (chr2 == '1')) *result = '1'; else if ((chr1 == '0') || (chr2 == '0')) *result = '0'; else *result = 'x'; result++; } *result = '\0'; } static void bitnot(char *result,char *bits) { int length; char chr; length = strlen(bits); while( length-- ) { chr = *(bits++); *(result++) = ( chr=='1' ? '0' : ( chr=='0' ? '1' : chr ) ); } *result = '\0'; } static char bitcmp(char *bitstrm1, char *bitstrm2) { int i, l1, l2, ldiff; char stream[256]; char chr1, chr2; l1 = strlen(bitstrm1); l2 = strlen(bitstrm2); if (l1 < l2) { ldiff = l2 - l1; i=0; while( ldiff-- ) stream[i++] = '0'; while( l1-- ) stream[i++] = *(bitstrm1++); stream[i] = '\0'; bitstrm1 = stream; } else if (l2 < l1) { ldiff = l1 - l2; i=0; while( ldiff-- ) stream[i++] = '0'; while( l2-- ) stream[i++] = *(bitstrm2++); stream[i] = '\0'; bitstrm2 = stream; } while( (chr1 = *(bitstrm1++)) ) { chr2 = *(bitstrm2++); if ( ((chr1 == '0') && (chr2 == '1')) || ((chr1 == '1') && (chr2 == '0')) ) return( 0 ); } return( 1 ); } static char bnear(double x, double y, double tolerance) { if (fabs(x - y) < tolerance) return ( 1 ); else return ( 0 ); } static char saobox(double xcen, double ycen, double xwid, double ywid, double rot, double xcol, double ycol) { double x,y,xprime,yprime,xmin,xmax,ymin,ymax,theta; theta = (rot / 180.0) * myPI; xprime = xcol - xcen; yprime = ycol - ycen; x = xprime * cos(theta) + yprime * sin(theta); y = -xprime * sin(theta) + yprime * cos(theta); xmin = - 0.5 * xwid; xmax = 0.5 * xwid; ymin = - 0.5 * ywid; ymax = 0.5 * ywid; if ((x >= xmin) && (x <= xmax) && (y >= ymin) && (y <= ymax)) return ( 1 ); else return ( 0 ); } static char circle(double xcen, double ycen, double rad, double xcol, double ycol) { double r2,dx,dy,dlen; dx = xcol - xcen; dy = ycol - ycen; dx *= dx; dy *= dy; dlen = dx + dy; r2 = rad * rad; if (dlen <= r2) return ( 1 ); else return ( 0 ); } static char ellipse(double xcen, double ycen, double xrad, double yrad, double rot, double xcol, double ycol) { double x,y,xprime,yprime,dx,dy,dlen,theta; theta = (rot / 180.0) * myPI; xprime = xcol - xcen; yprime = ycol - ycen; x = xprime * cos(theta) + yprime * sin(theta); y = -xprime * sin(theta) + yprime * cos(theta); dx = x / xrad; dy = y / yrad; dx *= dx; dy *= dy; dlen = dx + dy; if (dlen <= 1.0) return ( 1 ); else return ( 0 ); } /* * Extract substring */ int cstrmid(char *dest_str, int dest_len, char *src_str, int src_len, int pos) { /* char fill_char = ' '; */ char fill_char = '\0'; if (src_len == 0) { src_len = strlen(src_str); } /* .. if constant */ /* Fill destination with blanks */ if (pos < 0) { yyerror("STRMID(S,P,N) P must be 0 or greater"); return -1; } if (pos > src_len || pos == 0) { /* pos==0: blank string requested */ memset(dest_str, fill_char, dest_len); } else if (pos+dest_len > src_len) { /* Copy a subset */ int nsub = src_len-pos+1; int npad = dest_len - nsub; memcpy(dest_str, src_str+pos-1, nsub); /* Fill remaining string with blanks */ memset(dest_str+nsub, fill_char, npad); } else { /* Full string copy */ memcpy(dest_str, src_str+pos-1, dest_len); } dest_str[dest_len] = '\0'; /* Null-terminate */ return 0; } static void yyerror(char *s) { char msg[80]; if( !gParse.status ) gParse.status = PARSE_SYNTAX_ERR; strncpy(msg, s, 80); msg[79] = '\0'; ffpmsg(msg); } astropy-0.3/cextern/cfitsio/drvrfile.c0000644000175000017500000006622412243255342016302 0ustar oleole/* This file, drvrfile.c contains driver routines for disk files. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include "fitsio2.h" #if defined(unix) || defined(__unix__) || defined(__unix) #include /* needed in file_openfile */ #ifdef REPLACE_LINKS #include #include #endif #endif #ifdef HAVE_FTRUNCATE #if defined(unix) || defined(__unix__) || defined(__unix) #include /* needed for getcwd prototype on unix machines */ #endif #endif #define IO_SEEK 0 /* last file I/O operation was a seek */ #define IO_READ 1 /* last file I/O operation was a read */ #define IO_WRITE 2 /* last file I/O operation was a write */ static char file_outfile[FLEN_FILENAME]; typedef struct /* structure containing disk file structure */ { FILE *fileptr; LONGLONG currentpos; int last_io_op; } diskdriver; static diskdriver handleTable[NMAXFILES]; /* allocate diskfile handle tables */ /*--------------------------------------------------------------------------*/ int file_init(void) { int ii; for (ii = 0; ii < NMAXFILES; ii++) /* initialize all empty slots in table */ { handleTable[ii].fileptr = 0; } return(0); } /*--------------------------------------------------------------------------*/ int file_setoptions(int options) { /* do something with the options argument, to stop compiler warning */ options = 0; return(options); } /*--------------------------------------------------------------------------*/ int file_getoptions(int *options) { *options = 0; return(0); } /*--------------------------------------------------------------------------*/ int file_getversion(int *version) { *version = 10; return(0); } /*--------------------------------------------------------------------------*/ int file_shutdown(void) { return(0); } /*--------------------------------------------------------------------------*/ int file_open(char *filename, int rwmode, int *handle) { FILE *diskfile; int copyhandle, ii, status; char recbuf[2880]; size_t nread; /* if an output filename has been specified as part of the input file, as in "inputfile.fits(outputfile.fit)" then we have to create the output file, copy the input to it, then reopen the the new copy. */ if (*file_outfile) { /* open the original file, with readonly access */ status = file_openfile(filename, READONLY, &diskfile); if (status) { file_outfile[0] = '\0'; return(status); } /* create the output file */ status = file_create(file_outfile,handle); if (status) { ffpmsg("Unable to create output file for copy of input file:"); ffpmsg(file_outfile); file_outfile[0] = '\0'; return(status); } /* copy the file from input to output */ while(0 != (nread = fread(recbuf,1,2880, diskfile))) { status = file_write(*handle, recbuf, nread); if (status) { file_outfile[0] = '\0'; return(status); } } /* close both files */ fclose(diskfile); copyhandle = *handle; file_close(*handle); *handle = copyhandle; /* reuse the old file handle */ /* reopen the new copy, with correct rwmode */ status = file_openfile(file_outfile, rwmode, &diskfile); file_outfile[0] = '\0'; } else { *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in table */ { if (handleTable[ii].fileptr == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ /*open the file */ status = file_openfile(filename, rwmode, &diskfile); } handleTable[*handle].fileptr = diskfile; handleTable[*handle].currentpos = 0; handleTable[*handle].last_io_op = IO_SEEK; return(status); } /*--------------------------------------------------------------------------*/ int file_openfile(char *filename, int rwmode, FILE **diskfile) /* lowest level routine to physically open a disk file */ { char mode[4]; #if defined(unix) || defined(__unix__) || defined(__unix) char tempname[1024], *cptr, user[80]; struct passwd *pwd; int ii = 0; #if defined(REPLACE_LINKS) struct stat stbuf; int success = 0; size_t n; FILE *f1, *f2; char buf[BUFSIZ]; #endif #endif if (rwmode == READWRITE) { strcpy(mode, "r+b"); /* open existing file with read-write */ } else { strcpy(mode, "rb"); /* open existing file readonly */ } #if MACHINE == ALPHAVMS || MACHINE == VAXVMS /* specify VMS record structure: fixed format, 2880 byte records */ /* but force stream mode access to enable random I/O access */ *diskfile = fopen(filename, mode, "rfm=fix", "mrs=2880", "ctx=stm"); #elif defined(unix) || defined(__unix__) || defined(__unix) /* support the ~user/file.fits or ~/file.fits filenames in UNIX */ if (*filename == '~') { if (filename[1] == '/') { cptr = getenv("HOME"); if (cptr) { if (strlen(cptr) + strlen(filename+1) > 1023) return(FILE_NOT_OPENED); strcpy(tempname, cptr); strcat(tempname, filename+1); } else { if (strlen(filename) > 1023) return(FILE_NOT_OPENED); strcpy(tempname, filename); } } else { /* copy user name */ cptr = filename+1; while (*cptr && (*cptr != '/')) { user[ii] = *cptr; cptr++; ii++; } user[ii] = '\0'; /* get structure that includes name of user's home directory */ pwd = getpwnam(user); /* copy user's home directory */ if (strlen(pwd->pw_dir) + strlen(cptr) > 1023) return(FILE_NOT_OPENED); strcpy(tempname, pwd->pw_dir); strcat(tempname, cptr); } *diskfile = fopen(tempname, mode); } else { /* don't need to expand the input file name */ *diskfile = fopen(filename, mode); #if defined(REPLACE_LINKS) if (!(*diskfile) && (rwmode == READWRITE)) { /* failed to open file with READWRITE privilege. Test if */ /* the file we are trying to open is a soft link to a file that */ /* doesn't have write privilege. */ lstat(filename, &stbuf); if ((stbuf.st_mode & S_IFMT) == S_IFLNK) /* is this a soft link? */ { if ((f1 = fopen(filename, "rb")) != 0) /* try opening READONLY */ { if (strlen(filename) + 7 > 1023) return(FILE_NOT_OPENED); strcpy(tempname, filename); strcat(tempname, ".TmxFil"); if ((f2 = fopen(tempname, "wb")) != 0) /* create temp file */ { success = 1; while ((n = fread(buf, 1, BUFSIZ, f1)) > 0) { /* copy linked file to local temporary file */ if (fwrite(buf, 1, n, f2) != n) { success = 0; break; } } fclose(f2); } fclose(f1); if (success) { /* delete link and rename temp file to previous link name */ remove(filename); rename(tempname, filename); /* try once again to open the file with write access */ *diskfile = fopen(filename, mode); } else remove(tempname); /* clean up the failed copy */ } } } #endif } #else /* other non-UNIX machines */ *diskfile = fopen(filename, mode); #endif if (!(*diskfile)) /* couldn't open file */ { return(FILE_NOT_OPENED); } return(0); } /*--------------------------------------------------------------------------*/ int file_create(char *filename, int *handle) { FILE *diskfile; int ii; char mode[4]; #if defined(BUILD_HERA) /* special code to verify that the path to the file to be created */ /* is within the users data directory on Hera */ int status = 0, rootlen, rootlen2, slen; char *cpos; char cwd[FLEN_FILENAME], absURL[FLEN_FILENAME]; /* note that "/heradata/users/" is actually "/.hera_mountpnt/hera_users/" */ char rootstring[]="/.hera_mountpnt/hera_users/"; char rootstring2[]="/heradata/users/"; char username[FLEN_FILENAME], userroot[FLEN_FILENAME], userroot2[FLEN_FILENAME]; /* Get the current working directory */ fits_get_cwd(cwd, &status); slen = strlen(cwd); if (cwd[slen-1] != '/') strcat(cwd,"/"); /* make sure the CWD ends with slash */ /* printf("CWD = %s\n", cwd); */ /* check that CWD string matches the rootstring */ rootlen = strlen(rootstring); if (strncmp(rootstring, cwd, rootlen)) { ffpmsg("invalid CWD: does not match Hera data directory"); /* ffpmsg(rootstring); */ return(FILE_NOT_CREATED); } else { /* get the user name from CWD (it follows the root string) */ strcpy(username, cwd+rootlen); cpos=strchr(username, '/'); if (!cpos) { ffpmsg("invalid CWD: not equal to Hera data directory + username"); /* ffpmsg(cwd); */ return(FILE_NOT_CREATED); } else { *(cpos+1) = '\0'; /* truncate user name string */ /* construct full user root name */ strcpy(userroot, rootstring); strcat(userroot, username); rootlen = strlen(userroot); /* construct alternate full user root name */ strcpy(userroot2, rootstring2); strcat(userroot2, username); rootlen2 = strlen(userroot2); /* convert the input filename to absolute path relative to the CWD */ fits_relurl2url(cwd, filename, absURL, &status); /* printf("username = %s\n", username); printf("userroot = %s\n", userroot); printf("filename = %s\n", filename); printf("ABS = %s\n", absURL); */ /* check that CWD string matches the rootstring or alternate root string */ if ( strncmp(userroot, absURL, rootlen) && strncmp(userroot2, absURL, rootlen2) ) { ffpmsg("invalid filename: path not within user directory"); /* ffpmsg(absURL); ffpmsg(userroot); */ return(FILE_NOT_CREATED); } } } /* if we got here, then the input filename appears to be valid */ #endif *handle = -1; for (ii = 0; ii < NMAXFILES; ii++) /* find empty slot in table */ { if (handleTable[ii].fileptr == 0) { *handle = ii; break; } } if (*handle == -1) return(TOO_MANY_FILES); /* too many files opened */ strcpy(mode, "w+b"); /* create new file with read-write */ diskfile = fopen(filename, "r"); /* does file already exist? */ if (diskfile) { fclose(diskfile); /* close file and exit with error */ return(FILE_NOT_CREATED); } #if MACHINE == ALPHAVMS || MACHINE == VAXVMS /* specify VMS record structure: fixed format, 2880 byte records */ /* but force stream mode access to enable random I/O access */ diskfile = fopen(filename, mode, "rfm=fix", "mrs=2880", "ctx=stm"); #else diskfile = fopen(filename, mode); #endif if (!(diskfile)) /* couldn't create file */ { return(FILE_NOT_CREATED); } handleTable[ii].fileptr = diskfile; handleTable[ii].currentpos = 0; handleTable[ii].last_io_op = IO_SEEK; return(0); } /*--------------------------------------------------------------------------*/ int file_truncate(int handle, LONGLONG filesize) /* truncate the diskfile to a new smaller size */ { #ifdef HAVE_FTRUNCATE int fdesc; fdesc = fileno(handleTable[handle].fileptr); ftruncate(fdesc, (OFF_T) filesize); file_seek(handle, filesize); handleTable[handle].currentpos = filesize; handleTable[handle].last_io_op = IO_SEEK; #endif return(0); } /*--------------------------------------------------------------------------*/ int file_size(int handle, LONGLONG *filesize) /* return the size of the file in bytes */ { OFF_T position1,position2; FILE *diskfile; diskfile = handleTable[handle].fileptr; #if defined(_MSC_VER) && (_MSC_VER >= 1400) /* call the VISUAL C++ version of the routines which support */ /* Large Files (> 2GB) if they are supported (since VC 8.0) */ position1 = _ftelli64(diskfile); /* save current postion */ if (position1 < 0) return(SEEK_ERROR); if (_fseeki64(diskfile, 0, 2) != 0) /* seek to end of file */ return(SEEK_ERROR); position2 = _ftelli64(diskfile); /* get file size */ if (position2 < 0) return(SEEK_ERROR); if (_fseeki64(diskfile, position1, 0) != 0) /* seek back to original pos */ return(SEEK_ERROR); #elif _FILE_OFFSET_BITS - 0 == 64 && !defined(__MINGW32__) /* call the newer ftello and fseeko routines , which support */ /* Large Files (> 2GB) if they are supported. */ position1 = ftello(diskfile); /* save current postion */ if (position1 < 0) return(SEEK_ERROR); if (fseeko(diskfile, 0, 2) != 0) /* seek to end of file */ return(SEEK_ERROR); position2 = ftello(diskfile); /* get file size */ if (position2 < 0) return(SEEK_ERROR); if (fseeko(diskfile, position1, 0) != 0) /* seek back to original pos */ return(SEEK_ERROR); #else position1 = ftell(diskfile); /* save current postion */ if (position1 < 0) return(SEEK_ERROR); if (fseek(diskfile, 0, 2) != 0) /* seek to end of file */ return(SEEK_ERROR); position2 = ftell(diskfile); /* get file size */ if (position2 < 0) return(SEEK_ERROR); if (fseek(diskfile, position1, 0) != 0) /* seek back to original pos */ return(SEEK_ERROR); #endif *filesize = (LONGLONG) position2; return(0); } /*--------------------------------------------------------------------------*/ int file_close(int handle) /* close the file */ { if (fclose(handleTable[handle].fileptr) ) return(FILE_NOT_CLOSED); handleTable[handle].fileptr = 0; return(0); } /*--------------------------------------------------------------------------*/ int file_remove(char *filename) /* delete the file from disk */ { remove(filename); return(0); } /*--------------------------------------------------------------------------*/ int file_flush(int handle) /* flush the file */ { if (fflush(handleTable[handle].fileptr) ) return(WRITE_ERROR); /* The flush operation is not supposed to move the internal */ /* file pointer, but it does on some Windows-95 compilers and */ /* perhaps others, so seek to original position to be sure. */ /* This seek will do no harm on other systems. */ #if MACHINE == IBMPC if (file_seek(handle, handleTable[handle].currentpos)) return(SEEK_ERROR); #endif return(0); } /*--------------------------------------------------------------------------*/ int file_seek(int handle, LONGLONG offset) /* seek to position relative to start of the file */ { #if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Microsoft visual studio C++ */ /* _fseeki64 supported beginning with version 8.0 */ if (_fseeki64(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0) return(SEEK_ERROR); #elif _FILE_OFFSET_BITS - 0 == 64 && !defined(__MINGW32__) if (fseeko(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0) return(SEEK_ERROR); #else if (fseek(handleTable[handle].fileptr, (OFF_T) offset, 0) != 0) return(SEEK_ERROR); #endif handleTable[handle].currentpos = offset; return(0); } /*--------------------------------------------------------------------------*/ int file_read(int hdl, void *buffer, long nbytes) /* read bytes from the current position in the file */ { long nread; char *cptr; if (handleTable[hdl].last_io_op == IO_WRITE) { if (file_seek(hdl, handleTable[hdl].currentpos)) return(SEEK_ERROR); } nread = (long) fread(buffer, 1, nbytes, handleTable[hdl].fileptr); if (nread == 1) { cptr = (char *) buffer; /* some editors will add a single end-of-file character to a file */ /* Ignore it if the character is a zero, 10, or 32 */ if (*cptr == 0 || *cptr == 10 || *cptr == 32) return(END_OF_FILE); else return(READ_ERROR); } else if (nread != nbytes) { return(READ_ERROR); } handleTable[hdl].currentpos += nbytes; handleTable[hdl].last_io_op = IO_READ; return(0); } /*--------------------------------------------------------------------------*/ int file_write(int hdl, void *buffer, long nbytes) /* write bytes at the current position in the file */ { if (handleTable[hdl].last_io_op == IO_READ) { if (file_seek(hdl, handleTable[hdl].currentpos)) return(SEEK_ERROR); } if((long) fwrite(buffer, 1, nbytes, handleTable[hdl].fileptr) != nbytes) return(WRITE_ERROR); handleTable[hdl].currentpos += nbytes; handleTable[hdl].last_io_op = IO_WRITE; return(0); } /*--------------------------------------------------------------------------*/ int file_compress_open(char *filename, int rwmode, int *hdl) /* This routine opens the compressed diskfile by creating a new uncompressed file then opening it. The input file name (the name of the compressed file) gets replaced with the name of the uncompressed file, which is initially stored in the global file_outfile string. file_outfile then gets set to a null string. */ { FILE *indiskfile, *outdiskfile; int status; char *cptr; /* open the compressed disk file */ status = file_openfile(filename, READONLY, &indiskfile); if (status) { ffpmsg("failed to open compressed disk file (file_compress_open)"); ffpmsg(filename); return(status); } /* name of the output uncompressed file is stored in the */ /* global variable called 'file_outfile'. */ cptr = file_outfile; if (*cptr == '!') { /* clobber any existing file with the same name */ cptr++; remove(cptr); } else { outdiskfile = fopen(file_outfile, "r"); /* does file already exist? */ if (outdiskfile) { ffpmsg("uncompressed file already exists: (file_compress_open)"); ffpmsg(file_outfile); fclose(outdiskfile); /* close file and exit with error */ file_outfile[0] = '\0'; return(FILE_NOT_CREATED); } } outdiskfile = fopen(cptr, "w+b"); /* create new file */ if (!outdiskfile) { ffpmsg("could not create uncompressed file: (file_compress_open)"); ffpmsg(file_outfile); file_outfile[0] = '\0'; return(FILE_NOT_CREATED); } /* uncompress file into another file */ uncompress2file(filename, indiskfile, outdiskfile, &status); fclose(indiskfile); fclose(outdiskfile); if (status) { ffpmsg("error in file_compress_open: failed to uncompressed file:"); ffpmsg(filename); ffpmsg(" into new output file:"); ffpmsg(file_outfile); file_outfile[0] = '\0'; return(status); } strcpy(filename, cptr); /* switch the names */ file_outfile[0] = '\0'; status = file_open(filename, rwmode, hdl); return(status); } /*--------------------------------------------------------------------------*/ int file_is_compressed(char *filename) /* I - FITS file name */ /* Test if the disk file is compressed. Returns 1 if compressed, 0 if not. This may modify the filename string by appending a compression suffex. */ { FILE *diskfile; unsigned char buffer[2]; char tmpfilename[FLEN_FILENAME]; /* Open file. Try various suffix combinations */ if (file_openfile(filename, 0, &diskfile)) { if (strlen(filename) > FLEN_FILENAME - 1) return(0); strcpy(tmpfilename,filename); strcat(filename,".gz"); if (file_openfile(filename, 0, &diskfile)) { strcpy(filename, tmpfilename); strcat(filename,".Z"); if (file_openfile(filename, 0, &diskfile)) { strcpy(filename, tmpfilename); strcat(filename,".z"); /* it's often lower case on CDROMs */ if (file_openfile(filename, 0, &diskfile)) { strcpy(filename, tmpfilename); strcat(filename,".zip"); if (file_openfile(filename, 0, &diskfile)) { strcpy(filename, tmpfilename); strcat(filename,"-z"); /* VMS suffix */ if (file_openfile(filename, 0, &diskfile)) { strcpy(filename, tmpfilename); strcat(filename,"-gz"); /* VMS suffix */ if (file_openfile(filename, 0, &diskfile)) { strcpy(filename,tmpfilename); /* restore original name */ return(0); /* file not found */ } } } } } } } if (fread(buffer, 1, 2, diskfile) != 2) /* read 2 bytes */ { fclose(diskfile); /* error reading file so just return */ return(0); } fclose(diskfile); /* see if the 2 bytes have the magic values for a compressed file */ if ( (memcmp(buffer, "\037\213", 2) == 0) || /* GZIP */ (memcmp(buffer, "\120\113", 2) == 0) || /* PKZIP */ (memcmp(buffer, "\037\036", 2) == 0) || /* PACK */ (memcmp(buffer, "\037\235", 2) == 0) || /* LZW */ (memcmp(buffer, "\037\240", 2) == 0) ) /* LZH */ { return(1); /* this is a compressed file */ } else { return(0); /* not a compressed file */ } } /*--------------------------------------------------------------------------*/ int file_checkfile (char *urltype, char *infile, char *outfile) { /* special case: if file:// driver, check if the file is compressed */ if ( file_is_compressed(infile) ) { /* if output file has been specified, save the name for future use: */ /* This is the name of the uncompressed file to be created on disk. */ if (strlen(outfile)) { if (!strncmp(outfile, "mem:", 4) ) { /* uncompress the file in memory, with READ and WRITE access */ strcpy(urltype, "compressmem://"); /* use special driver */ *file_outfile = '\0'; } else { strcpy(urltype, "compressfile://"); /* use special driver */ /* don't copy the "file://" prefix, if present. */ if (!strncmp(outfile, "file://", 7) ) strcpy(file_outfile,outfile+7); else strcpy(file_outfile,outfile); } } else { /* uncompress the file in memory */ strcpy(urltype, "compress://"); /* use special driver */ *file_outfile = '\0'; /* no output file was specified */ } } else /* an ordinary, uncompressed FITS file on disk */ { /* save the output file name for later use when opening the file. */ /* In this case, the file to be opened will be opened READONLY, */ /* and copied to this newly created output file. The original file */ /* will be closed, and the copy will be opened by CFITSIO for */ /* subsequent processing (possibly with READWRITE access). */ if (strlen(outfile)) { file_outfile[0] = '\0'; strncat(file_outfile,outfile,FLEN_FILENAME-1); } } return 0; } /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ /**** driver routines for stream//: device (stdin or stdout) ********/ /*--------------------------------------------------------------------------*/ int stream_open(char *filename, int rwmode, int *handle) { /* read from stdin */ if (filename) rwmode = 1; /* dummy statement to suppress unused parameter compiler warning */ *handle = 1; /* 1 = stdin */ return(0); } /*--------------------------------------------------------------------------*/ int stream_create(char *filename, int *handle) { /* write to stdout */ if (filename) /* dummy statement to suppress unused parameter compiler warning */ *handle = 2; else *handle = 2; /* 2 = stdout */ return(0); } /*--------------------------------------------------------------------------*/ int stream_size(int handle, LONGLONG *filesize) /* return the size of the file in bytes */ { handle = 0; /* suppress unused parameter compiler warning */ /* this operation is not supported in a stream; return large value */ *filesize = LONG_MAX; return(0); } /*--------------------------------------------------------------------------*/ int stream_close(int handle) /* don't have to close stdin or stdout */ { handle = 0; /* suppress unused parameter compiler warning */ return(0); } /*--------------------------------------------------------------------------*/ int stream_flush(int handle) /* flush the file */ { if (handle == 2) fflush(stdout); return(0); } /*--------------------------------------------------------------------------*/ int stream_seek(int handle, LONGLONG offset) /* seeking is not allowed in a stream */ { offset = handle; /* suppress unused parameter compiler warning */ return(1); } /*--------------------------------------------------------------------------*/ int stream_read(int hdl, void *buffer, long nbytes) /* reading from stdin stream */ { long nread; if (hdl != 1) return(1); /* can only read from stdin */ nread = (long) fread(buffer, 1, nbytes, stdin); if (nread != nbytes) { /* return(READ_ERROR); */ return(END_OF_FILE); } return(0); } /*--------------------------------------------------------------------------*/ int stream_write(int hdl, void *buffer, long nbytes) /* write bytes at the current position in the file */ { if (hdl != 2) return(1); /* can only write to stdout */ if((long) fwrite(buffer, 1, nbytes, stdout) != nbytes) return(WRITE_ERROR); return(0); } astropy-0.3/cextern/cfitsio/fitsio2.h0000644000175000017500000016305012243255342016044 0ustar oleole#ifndef _FITSIO2_H #define _FITSIO2_H #include "fitsio.h" /* Threading support using POSIX threads programming interface (supplied by Bruce O'Neel) All threaded programs MUST have the -D_REENTRANT on the compile line and must link with -lpthread. This means that when one builds cfitsio for threads you must have -D_REENTRANT on the gcc or cc command line. */ #ifdef _REENTRANT #include /* #include not needed any more */ extern pthread_mutex_t Fitsio_Lock; extern int Fitsio_Pthread_Status; #define FFLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_lock(&lockname)) #define FFUNLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_unlock(&lockname)) #define FFLOCK FFLOCK1(Fitsio_Lock) #define FFUNLOCK FFUNLOCK1(Fitsio_Lock) #else #define FFLOCK #define FFUNLOCK #endif /* If REPLACE_LINKS is defined, then whenever CFITSIO fails to open a file with write access because it is a soft link to a file that only has read access, then CFITSIO will attempt to replace the link with a local copy of the file, with write access. This feature was originally added to support the ftools in the Hera environment, where many of the user's data file are soft links. */ #if defined(BUILD_HERA) #define REPLACE_LINKS 1 #endif #define USE_LARGE_VALUE -99 /* flag used when writing images */ #define DBUFFSIZE 28800 /* size of data buffer in bytes */ #define NMAXFILES 300 /* maximum number of FITS files that can be opened */ /* CFITSIO will allocate (NMAXFILES * 80) bytes of memory */ #define MINDIRECT 8640 /* minimum size for direct reads and writes */ /* MINDIRECT must have a value >= 8640 */ /* it is useful to identify certain specific types of machines */ #define NATIVE 0 /* machine that uses non-byteswapped IEEE formats */ #define OTHERTYPE 1 /* any other type of machine */ #define VAXVMS 3 /* uses an odd floating point format */ #define ALPHAVMS 4 /* uses an odd floating point format */ #define IBMPC 5 /* used in drvrfile.c to work around a bug on PCs */ #define CRAY 6 /* requires a special NaN test algorithm */ #define GFLOAT 1 /* used for VMS */ #define IEEEFLOAT 2 /* used for VMS */ /* ======================================================================= */ /* The following logic is used to determine the type machine, */ /* whether the bytes are swapped, and the number of bits in a long value */ /* ======================================================================= */ /* The following platforms have sizeof(long) == 8 */ /* This block of code should match a similar block in fitsio.h */ /* and the block of code at the beginning of f77_wrap.h */ #if defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) ) /* old Dec Alpha platforms running OSF */ #define BYTESWAPPED TRUE #define LONGSIZE 64 #elif defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__)) /* SUN Solaris7 in 64-bit mode */ #define BYTESWAPPED FALSE #define MACHINE NATIVE #define LONGSIZE 64 /* IBM System z mainframe support */ #elif defined(__s390x__) #define BYTESWAPPED FALSE #define LONGSIZE 64 #elif defined(__s390__) #define BYTESWAPPED FALSE #define LONGSIZE 32 #elif defined(__ia64__) || defined(__x86_64__) /* Intel itanium 64-bit PC, or AMD opteron 64-bit PC */ #define BYTESWAPPED TRUE #define LONGSIZE 64 #elif defined(_SX) /* Nec SuperUx */ #define BYTESWAPPED FALSE #define MACHINE NATIVE #define LONGSIZE 64 #elif defined(__powerpc64__) || defined(__64BIT__) /* IBM 64-bit AIX powerpc*/ /* could also test for __ppc64__ or __PPC64 */ #define BYTESWAPPED FALSE #define MACHINE NATIVE #define LONGSIZE 64 #elif defined(_MIPS_SZLONG) # if defined(MIPSEL) # define BYTESWAPPED TRUE # else # define BYTESWAPPED FALSE # define MACHINE NATIVE # endif # if _MIPS_SZLONG == 32 # define LONGSIZE 32 # elif _MIPS_SZLONG == 64 # define LONGSIZE 64 # else # error "can't handle long size given by _MIPS_SZLONG" # endif /* ============================================================== */ /* the following are all 32-bit byteswapped platforms */ #elif defined(vax) && defined(VMS) #define MACHINE VAXVMS #define BYTESWAPPED TRUE #elif defined(__alpha) && defined(__VMS) #if (__D_FLOAT == TRUE) /* this float option is the same as for VAX/VMS machines. */ #define MACHINE VAXVMS #define BYTESWAPPED TRUE #elif (__G_FLOAT == TRUE) /* G_FLOAT is the default for ALPHA VMS systems */ #define MACHINE ALPHAVMS #define BYTESWAPPED TRUE #define FLOATTYPE GFLOAT #elif (__IEEE_FLOAT == TRUE) #define MACHINE ALPHAVMS #define BYTESWAPPED TRUE #define FLOATTYPE IEEEFLOAT #endif /* end of alpha VMS case */ #elif defined(ultrix) && defined(unix) /* old Dec ultrix machines */ #define BYTESWAPPED TRUE #elif defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) \ || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TURBOC__) \ || defined(_NI_mswin_) || defined(__EMX__) /* generic 32-bit IBM PC */ #define MACHINE IBMPC #define BYTESWAPPED TRUE #elif defined(__arm__) /* This assumes all ARM are little endian. In the future, it might be */ /* necessary to use "if defined(__ARMEL__)" to distinguish little from big. */ /* (__ARMEL__ would be defined on little-endian, but not on big-endian). */ #define BYTESWAPPED TRUE #elif defined(__tile__) /* 64-core 8x8-architecture Tile64 platform */ #define BYTESWAPPED TRUE #elif defined(__sh__) /* SuperH CPU can be used in both little and big endian modes */ #if defined(__LITTLE_ENDIAN__) #define BYTESWAPPED TRUE #else #define BYTESWAPPED FALSE #endif #else /* assume all other machine uses the same IEEE formats as used in FITS files */ /* e.g., Macs fall into this category */ #define MACHINE NATIVE #define BYTESWAPPED FALSE #endif #ifndef MACHINE #define MACHINE OTHERTYPE #endif /* assume longs are 4 bytes long, unless previously set otherwise */ #ifndef LONGSIZE #define LONGSIZE 32 #endif /* end of block that determine long size and byte swapping */ /* ==================================================================== */ #define IGNORE_EOF 1 #define REPORT_EOF 0 #define DATA_UNDEFINED -1 #define NULL_UNDEFINED 1234554321 #define ASCII_NULL_UNDEFINED 1 /* indicate no defined null value */ #define maxvalue(A,B) ((A) > (B) ? (A) : (B)) #define minvalue(A,B) ((A) < (B) ? (A) : (B)) /* faster string comparison macros */ #define FSTRCMP(a,b) ((a)[0]<(b)[0]? -1:(a)[0]>(b)[0]?1:strcmp((a),(b))) #define FSTRNCMP(a,b,n) ((a)[0]<(b)[0]?-1:(a)[0]>(b)[0]?1:strncmp((a),(b),(n))) #if defined(__VMS) || defined(VMS) #define FNANMASK 0xFFFF /* mask all bits */ #define DNANMASK 0xFFFF /* mask all bits */ #else #define FNANMASK 0x7F80 /* mask bits 1 - 8; all set on NaNs */ /* all 0 on underflow or 0. */ #define DNANMASK 0x7FF0 /* mask bits 1 - 11; all set on NaNs */ /* all 0 on underflow or 0. */ #endif #if MACHINE == CRAY /* Cray machines: the large negative integer corresponds to the 3 most sig digits set to 1. If these 3 bits are set in a floating point number (64 bits), then it represents a reserved value (i.e., a NaN) */ #define fnan(L) ( (L) >= 0xE000000000000000 ? 1 : 0) ) #else /* these functions work for both big and little endian machines */ /* that use the IEEE floating point format for internal numbers */ /* These functions tests whether the float value is a reserved IEEE */ /* value such as a Not-a-Number (NaN), or underflow, overflow, or */ /* infinity. The functions returns 1 if the value is a NaN, overflow */ /* or infinity; it returns 2 if the value is an denormalized underflow */ /* value; otherwise it returns 0. fnan tests floats, dnan tests doubles */ #define fnan(L) \ ( (L & FNANMASK) == FNANMASK ? 1 : (L & FNANMASK) == 0 ? 2 : 0) #define dnan(L) \ ( (L & DNANMASK) == DNANMASK ? 1 : (L & DNANMASK) == 0 ? 2 : 0) #endif #define DSCHAR_MAX 127.49 /* max double value that fits in an signed char */ #define DSCHAR_MIN -128.49 /* min double value that fits in an signed char */ #define DUCHAR_MAX 255.49 /* max double value that fits in an unsigned char */ #define DUCHAR_MIN -0.49 /* min double value that fits in an unsigned char */ #define DUSHRT_MAX 65535.49 /* max double value that fits in a unsigned short*/ #define DUSHRT_MIN -0.49 /* min double value that fits in an unsigned short */ #define DSHRT_MAX 32767.49 /* max double value that fits in a short */ #define DSHRT_MIN -32768.49 /* min double value that fits in a short */ #if LONGSIZE == 32 # define DLONG_MAX 2147483647.49 /* max double value that fits in a long */ # define DLONG_MIN -2147483648.49 /* min double value that fits in a long */ # define DULONG_MAX 4294967295.49 /* max double that fits in a unsigned long */ #else # define DLONG_MAX 9.2233720368547752E18 /* max double value long */ # define DLONG_MIN -9.2233720368547752E18 /* min double value long */ # define DULONG_MAX 1.84467440737095504E19 /* max double value ulong */ #endif #define DULONG_MIN -0.49 /* min double value that fits in an unsigned long */ #define DLONGLONG_MAX 9.2233720368547755807E18 /* max double value longlong */ #define DLONGLONG_MIN -9.2233720368547755808E18 /* min double value longlong */ #define DUINT_MAX 4294967295.49 /* max dbl that fits in a unsigned 4-byte int */ #define DUINT_MIN -0.49 /* min dbl that fits in an unsigned 4-byte int */ #define DINT_MAX 2147483647.49 /* max double value that fits in a 4-byte int */ #define DINT_MIN -2147483648.49 /* min double value that fits in a 4-byte int */ #ifndef UINT32_MAX #define UINT32_MAX 4294967295U /* max unsigned 32-bit integer */ #endif #ifndef INT32_MAX #define INT32_MAX 2147483647 /* max 32-bit integer */ #endif #ifndef INT32_MIN #define INT32_MIN (-INT32_MAX -1) /* min 32-bit integer */ #endif #define COMPRESS_NULL_VALUE -2147483647 #define N_RANDOM 10000 /* DO NOT CHANGE THIS; used when quantizing real numbers */ int ffgnky(fitsfile *fptr, char *card, int *status); void ffcfmt(char *tform, char *cform); void ffcdsp(char *tform, char *cform); void ffswap2(short *values, long nvalues); void ffswap4(INT32BIT *values, long nvalues); void ffswap8(double *values, long nvalues); int ffi2c(LONGLONG ival, char *cval, int *status); int ffl2c(int lval, char *cval, int *status); int ffs2c(const char *instr, char *outstr, int *status); int ffr2f(float fval, int decim, char *cval, int *status); int ffr2e(float fval, int decim, char *cval, int *status); int ffd2f(double dval, int decim, char *cval, int *status); int ffd2e(double dval, int decim, char *cval, int *status); int ffc2ii(const char *cval, long *ival, int *status); int ffc2jj(const char *cval, LONGLONG *ival, int *status); int ffc2ll(const char *cval, int *lval, int *status); int ffc2rr(const char *cval, float *fval, int *status); int ffc2dd(const char *cval, double *dval, int *status); int ffc2x(const char *cval, char *dtype, long *ival, int *lval, char *sval, double *dval, int *status); int ffc2xx(const char *cval, char *dtype, LONGLONG *ival, int *lval, char *sval, double *dval, int *status); int ffc2s(const char *instr, char *outstr, int *status); int ffc2i(const char *cval, long *ival, int *status); int ffc2j(const char *cval, LONGLONG *ival, int *status); int ffc2r(const char *cval, float *fval, int *status); int ffc2d(const char *cval, double *dval, int *status); int ffc2l(const char *cval, int *lval, int *status); void ffxmsg(int action, char *err_message); int ffgcnt(fitsfile *fptr, char *value, int *status); int ffgtkn(fitsfile *fptr, int numkey, char *keyname, long *value, int *status); int ffgtknjj(fitsfile *fptr, int numkey, char *keyname, LONGLONG *value, int *status); int fftkyn(fitsfile *fptr, int numkey, char *keyname, char *value, int *status); int ffgphd(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis, LONGLONG naxes[], long *pcount, long *gcount, int *extend, double *bscale, double *bzero, LONGLONG *blank, int *nspace, int *status); int ffgttb(fitsfile *fptr, LONGLONG *rowlen, LONGLONG *nrows, LONGLONG *pcount, long *tfield, int *status); int ffmkey(fitsfile *fptr, const char *card, int *status); /* ffmbyt has been moved to fitsio.h */ int ffgbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status); int ffpbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status); int ffgbytoff(fitsfile *fptr, long gsize, long ngroups, long offset, void *buffer, int *status); int ffpbytoff(fitsfile *fptr, long gsize, long ngroups, long offset, void *buffer, int *status); int ffldrc(fitsfile *fptr, long record, int err_mode, int *status); int ffwhbf(fitsfile *fptr, int *nbuff); int ffbfeof(fitsfile *fptr, int *status); int ffbfwt(FITSfile *Fptr, int nbuff, int *status); int ffpxsz(int datatype); int ffourl(char *url, char *urltype, char *outfile, char *tmplfile, char *compspec, int *status); int ffparsecompspec(fitsfile *fptr, char *compspec, int *status); int ffoptplt(fitsfile *fptr, const char *tempname, int *status); int fits_is_this_a_copy(char *urltype); int fits_store_Fptr(FITSfile *Fptr, int *status); int fits_clear_Fptr(FITSfile *Fptr, int *status); int fits_already_open(fitsfile **fptr, char *url, char *urltype, char *infile, char *extspec, char *rowfilter, char *binspec, char *colspec, int mode,int *isopen, int *status); int ffedit_columns(fitsfile **fptr, char *outfile, char *expr, int *status); int fits_get_col_minmax(fitsfile *fptr, int colnum, float *datamin, float *datamax, int *status); int ffwritehisto(long totaln, long offset, long firstn, long nvalues, int narrays, iteratorCol *imagepars, void *userPointer); int ffcalchist(long totalrows, long offset, long firstrow, long nrows, int ncols, iteratorCol *colpars, void *userPointer); int ffrhdu(fitsfile *fptr, int *hdutype, int *status); int ffpinit(fitsfile *fptr, int *status); int ffainit(fitsfile *fptr, int *status); int ffbinit(fitsfile *fptr, int *status); int ffchdu(fitsfile *fptr, int *status); int ffwend(fitsfile *fptr, int *status); int ffpdfl(fitsfile *fptr, int *status); int ffuptf(fitsfile *fptr, int *status); int ffdblk(fitsfile *fptr, long nblocks, int *status); int ffgext(fitsfile *fptr, int moveto, int *exttype, int *status); int ffgtbc(fitsfile *fptr, LONGLONG *totalwidth, int *status); int ffgtbp(fitsfile *fptr, char *name, char *value, int *status); int ffiblk(fitsfile *fptr, long nblock, int headdata, int *status); int ffshft(fitsfile *fptr, LONGLONG firstbyte, LONGLONG nbytes, LONGLONG nshift, int *status); int ffgcprll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int writemode, double *scale, double *zero, char *tform, long *twidth, int *tcode, int *maxelem, LONGLONG *startpos, LONGLONG *elemnum, long *incre, LONGLONG *repeat, LONGLONG *rowlen, int *hdutype, LONGLONG *tnull, char *snull, int *status); int ffflushx(FITSfile *fptr); int ffseek(FITSfile *fptr, LONGLONG position); int ffread(FITSfile *fptr, long nbytes, void *buffer, int *status); int ffwrite(FITSfile *fptr, long nbytes, void *buffer, int *status); int fftrun(fitsfile *fptr, LONGLONG filesize, int *status); int ffpcluc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int *status); int ffgcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int nultyp, char nulval, char *array, char *nularray, int *anynul, int *status); int ffgcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int nultyp, char *nulval, char **array, char *nularray, int *anynul, int *status); int ffgcls2(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, int nultyp, char *nulval, char **array, char *nularray, int *anynul, int *status); int ffgclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, unsigned char nulval, unsigned char *array, char *nularray, int *anynul, int *status); int ffgclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, signed char nulval, signed char *array, char *nularray, int *anynul, int *status); int ffgclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, unsigned short nulval, unsigned short *array, char *nularray, int *anynul, int *status); int ffgcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, short nulval, short *array, char *nularray, int *anynul, int *status); int ffgcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, unsigned long nulval, unsigned long *array, char *nularray, int *anynul, int *status); int ffgcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, LONGLONG nulval, LONGLONG *array, char *nularray, int *anynul, int *status); int ffgclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, long nulval, long *array, char *nularray, int *anynul, int *status); int ffgcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, unsigned int nulval, unsigned int *array, char *nularray, int *anynul, int *status); int ffgclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, int nulval, int *array, char *nularray, int *anynul, int *status); int ffgcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, float nulval, float *array, char *nularray, int *anynul, int *status); int ffgcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem, LONGLONG nelem, long elemincre, int nultyp, double nulval, double *array, char *nularray, int *anynul, int *status); int ffpi1b(fitsfile *fptr, long nelem, long incre, unsigned char *buffer, int *status); int ffpi2b(fitsfile *fptr, long nelem, long incre, short *buffer, int *status); int ffpi4b(fitsfile *fptr, long nelem, long incre, INT32BIT *buffer, int *status); int ffpi8b(fitsfile *fptr, long nelem, long incre, long *buffer, int *status); int ffpr4b(fitsfile *fptr, long nelem, long incre, float *buffer, int *status); int ffpr8b(fitsfile *fptr, long nelem, long incre, double *buffer, int *status); int ffgi1b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, unsigned char *buffer, int *status); int ffgi2b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, short *buffer, int *status); int ffgi4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, INT32BIT *buffer, int *status); int ffgi8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, long *buffer, int *status); int ffgr4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, float *buffer, int *status); int ffgr8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, double *buffer, int *status); int ffcins(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes, LONGLONG bytepos, int *status); int ffcdel(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes, LONGLONG bytepos, int *status); int ffkshf(fitsfile *fptr, int firstcol, int tfields, int nshift, int *status); int fffi1i1(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffi2i1(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffi4i1(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffi8i1(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffr4i1(float *input, long ntodo, double scale, double zero, int nullcheck, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffr8i1(double *input, long ntodo, double scale, double zero, int nullcheck, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffstri1(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, unsigned char nullval, char *nullarray, int *anynull, unsigned char *output, int *status); int fffi1s1(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffi2s1(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffi4s1(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffi8s1(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffr4s1(float *input, long ntodo, double scale, double zero, int nullcheck, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffr8s1(double *input, long ntodo, double scale, double zero, int nullcheck, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffstrs1(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, signed char nullval, char *nullarray, int *anynull, signed char *output, int *status); int fffi1u2(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffi2u2(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffi4u2(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffi8u2(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffr4u2(float *input, long ntodo, double scale, double zero, int nullcheck, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffr8u2(double *input, long ntodo, double scale, double zero, int nullcheck, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffstru2(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, unsigned short nullval, char *nullarray, int *anynull, unsigned short *output, int *status); int fffi1i2(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffi2i2(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffi4i2(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffi8i2(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffr4i2(float *input, long ntodo, double scale, double zero, int nullcheck, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffr8i2(double *input, long ntodo, double scale, double zero, int nullcheck, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffstri2(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, short nullval, char *nullarray, int *anynull, short *output, int *status); int fffi1u4(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffi2u4(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffi4u4(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffi8u4(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffr4u4(float *input, long ntodo, double scale, double zero, int nullcheck, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffr8u4(double *input, long ntodo, double scale, double zero, int nullcheck, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffstru4(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, unsigned long nullval, char *nullarray, int *anynull, unsigned long *output, int *status); int fffi1i4(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffi2i4(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffi4i4(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffi8i4(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffr4i4(float *input, long ntodo, double scale, double zero, int nullcheck, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffr8i4(double *input, long ntodo, double scale, double zero, int nullcheck, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffstri4(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, long nullval, char *nullarray, int *anynull, long *output, int *status); int fffi1int(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffi2int(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffi4int(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffi8int(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffr4int(float *input, long ntodo, double scale, double zero, int nullcheck, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffr8int(double *input, long ntodo, double scale, double zero, int nullcheck, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffstrint(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, int nullval, char *nullarray, int *anynull, int *output, int *status); int fffi1uint(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffi2uint(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffi4uint(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffi8uint(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffr4uint(float *input, long ntodo, double scale, double zero, int nullcheck, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffr8uint(double *input, long ntodo, double scale, double zero, int nullcheck, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffstruint(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, unsigned int nullval, char *nullarray, int *anynull, unsigned int *output, int *status); int fffi1i8(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffi2i8(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffi4i8(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffi8i8(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffr4i8(float *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffr8i8(double *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffstri8(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output, int *status); int fffi1r4(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffi2r4(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffi4r4(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffi8r4(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffr4r4(float *input, long ntodo, double scale, double zero, int nullcheck, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffr8r4(double *input, long ntodo, double scale, double zero, int nullcheck, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffstrr4(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, float nullval, char *nullarray, int *anynull, float *output, int *status); int fffi1r8(unsigned char *input, long ntodo, double scale, double zero, int nullcheck, unsigned char tnull, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffi2r8(short *input, long ntodo, double scale, double zero, int nullcheck, short tnull, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffi4r8(INT32BIT *input, long ntodo, double scale, double zero, int nullcheck, INT32BIT tnull, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffi8r8(LONGLONG *input, long ntodo, double scale, double zero, int nullcheck, LONGLONG tnull, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffr4r8(float *input, long ntodo, double scale, double zero, int nullcheck, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffr8r8(double *input, long ntodo, double scale, double zero, int nullcheck, double nullval, char *nullarray, int *anynull, double *output, int *status); int fffstrr8(char *input, long ntodo, double scale, double zero, long twidth, double power, int nullcheck, char *snull, double nullval, char *nullarray, int *anynull, double *output, int *status); int ffi1fi1(unsigned char *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffs1fi1(signed char *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffu2fi1(unsigned short *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffi2fi1(short *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffu4fi1(unsigned long *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffi4fi1(long *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffi8fi1(LONGLONG *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffuintfi1(unsigned int *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffintfi1(int *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffr4fi1(float *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffr8fi1(double *array, long ntodo, double scale, double zero, unsigned char *buffer, int *status); int ffi1fi2(unsigned char *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffs1fi2(signed char *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffu2fi2(unsigned short *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffi2fi2(short *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffu4fi2(unsigned long *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffi4fi2(long *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffi8fi2(LONGLONG *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffuintfi2(unsigned int *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffintfi2(int *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffr4fi2(float *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffr8fi2(double *array, long ntodo, double scale, double zero, short *buffer, int *status); int ffi1fi4(unsigned char *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffs1fi4(signed char *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffu2fi4(unsigned short *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffi2fi4(short *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffu4fi4(unsigned long *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffi4fi4(long *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffi8fi4(LONGLONG *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffuintfi4(unsigned int *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffintfi4(int *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffr4fi4(float *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int ffr8fi4(double *array, long ntodo, double scale, double zero, INT32BIT *buffer, int *status); int fflongfi8(long *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffi8fi8(LONGLONG *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffi2fi8(short *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffi1fi8(unsigned char *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffs1fi8(signed char *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffr4fi8(float *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffr8fi8(double *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffintfi8(int *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffu2fi8(unsigned short *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffu4fi8(unsigned long *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffuintfi8(unsigned int *array, long ntodo, double scale, double zero, LONGLONG *buffer, int *status); int ffi1fr4(unsigned char *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffs1fr4(signed char *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffu2fr4(unsigned short *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffi2fr4(short *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffu4fr4(unsigned long *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffi4fr4(long *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffi8fr4(LONGLONG *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffuintfr4(unsigned int *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffintfr4(int *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffr4fr4(float *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffr8fr4(double *array, long ntodo, double scale, double zero, float *buffer, int *status); int ffi1fr8(unsigned char *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffs1fr8(signed char *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffu2fr8(unsigned short *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffi2fr8(short *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffu4fr8(unsigned long *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffi4fr8(long *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffi8fr8(LONGLONG *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffuintfr8(unsigned int *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffintfr8(int *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffr4fr8(float *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffr8fr8(double *array, long ntodo, double scale, double zero, double *buffer, int *status); int ffi1fstr(unsigned char *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffs1fstr(signed char *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffu2fstr(unsigned short *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffi2fstr(short *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffu4fstr(unsigned long *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffi4fstr(long *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffi8fstr(LONGLONG *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffintfstr(int *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffuintfstr(unsigned int *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffr4fstr(float *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); int ffr8fstr(double *input, long ntodo, double scale, double zero, char *cform, long twidth, char *output, int *status); /* the following 4 routines are VMS macros used on VAX or Alpha VMS */ void ieevpd(double *inarray, double *outarray, long *nvals); void ieevud(double *inarray, double *outarray, long *nvals); void ieevpr(float *inarray, float *outarray, long *nvals); void ieevur(float *inarray, float *outarray, long *nvals); /* routines related to the lexical parser */ int ffselect_table(fitsfile **fptr, char *outfile, char *expr, int *status); int ffiprs( fitsfile *fptr, int compressed, char *expr, int maxdim, int *datatype, long *nelem, int *naxis, long *naxes, int *status ); void ffcprs( void ); int ffcvtn( int inputType, void *input, char *undef, long ntodo, int outputType, void *nulval, void *output, int *anynull, int *status ); int parse_data( long totalrows, long offset, long firstrow, long nrows, int nCols, iteratorCol *colData, void *userPtr ); int uncompress_hkdata( fitsfile *fptr, long ntimes, double *times, int *status ); int ffffrw_work( long totalrows, long offset, long firstrow, long nrows, int nCols, iteratorCol *colData, void *userPtr ); int fits_translate_pixkeyword(char *inrec, char *outrec,char *patterns[][2], int npat, int naxis, int *colnum, int *pat_num, int *i, int *j, int *n, int *m, int *l, int *status); /* image compression routines */ int fits_write_compressed_img(fitsfile *fptr, int datatype, long *fpixel, long *lpixel, int nullcheck, void *array, void *nulval, int *status); int fits_write_compressed_pixels(fitsfile *fptr, int datatype, LONGLONG fpixel, LONGLONG npixels, int nullcheck, void *array, void *nulval, int *status); int fits_write_compressed_img_plane(fitsfile *fptr, int datatype, int bytesperpixel, long nplane, long *firstcoord, long *lastcoord, long *naxes, int nullcheck, void *array, void *nullval, long *nread, int *status); int imcomp_init_table(fitsfile *outfptr, int bitpix, int naxis,long *naxes, int writebitpix, int *status); int imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize); int imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr, int *status); int imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status); int imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr, int norec, int *status); int imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status); int imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr, int *status); int imcomp_compress_tile (fitsfile *outfptr, long row, int datatype, void *tiledata, long tilelen, long nx, long ny, int nullcheck, void *nullval, int *status); int imcomp_nullscale(int *idata, long tilelen, int nullflagval, int nullval, double scale, double zero, int * status); int imcomp_nullvalues(int *idata, long tilelen, int nullflagval, int nullval, int * status); int imcomp_scalevalues(int *idata, long tilelen, double scale, double zero, int * status); int imcomp_nullscalefloats(float *fdata, long tilelen, int *idata, double scale, double zero, int nullcheck, float nullflagval, int nullval, int *status); int imcomp_nullfloats(float *fdata, long tilelen, int *idata, int nullcheck, float nullflagval, int nullval, int *status); int imcomp_nullscaledoubles(double *fdata, long tilelen, int *idata, double scale, double zero, int nullcheck, double nullflagval, int nullval, int *status); int imcomp_nulldoubles(double *fdata, long tilelen, int *idata, int nullcheck, double nullflagval, int nullval, int *status); /* image decompression routines */ int fits_read_compressed_img(fitsfile *fptr, int datatype, LONGLONG *fpixel,LONGLONG *lpixel,long *inc, int nullcheck, void *nulval, void *array, char *nullarray, int *anynul, int *status); int fits_read_compressed_pixels(fitsfile *fptr, int datatype, LONGLONG fpixel, LONGLONG npixels, int nullcheck, void *nulval, void *array, char *nullarray, int *anynul, int *status); int fits_read_compressed_img_plane(fitsfile *fptr, int datatype, int bytesperpixel, long nplane, LONGLONG *firstcoord, LONGLONG *lastcoord, long *inc, long *naxes, int nullcheck, void *nullval, void *array, char *nullarray, int *anynul, long *nread, int *status); int imcomp_get_compressed_image_par(fitsfile *infptr, int *status); int imcomp_decompress_tile (fitsfile *infptr, int nrow, int tilesize, int datatype, int nullcheck, void *nulval, void *buffer, char *bnullarray, int *anynul, int *status); int imcomp_copy_overlap (char *tile, int pixlen, int ndim, long *tfpixel, long *tlpixel, char *bnullarray, char *image, long *fpixel, long *lpixel, long *inc, int nullcheck, char *nullarray, int *status); int imcomp_test_overlap (int ndim, long *tfpixel, long *tlpixel, long *fpixel, long *lpixel, long *inc, int *status); int imcomp_merge_overlap (char *tile, int pixlen, int ndim, long *tfpixel, long *tlpixel, char *bnullarray, char *image, long *fpixel, long *lpixel, int nullcheck, int *status); int imcomp_decompress_img(fitsfile *infptr, fitsfile *outfptr, int datatype, int *status); int fits_quantize_float (long row, float fdata[], long nx, long ny, int nullcheck, float in_null_value, float quantize_level, int dither_method, int idata[], double *bscale, double *bzero, int *iminval, int *imaxval); int fits_quantize_double (long row, double fdata[], long nx, long ny, int nullcheck, double in_null_value, float quantize_level, int dither_method, int idata[], double *bscale, double *bzero, int *iminval, int *imaxval); int fits_rcomp(int a[], int nx, unsigned char *c, int clen,int nblock); int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen,int nblock); int fits_rcomp_byte(signed char a[], int nx, unsigned char *c, int clen,int nblock); int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock); int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock); int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock); int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); int fits_init_randoms(void); int fits_unset_compression_param( fitsfile *fptr, int *status); int fits_unset_compression_request( fitsfile *fptr, int *status); int fitsio_init_lock(void); /* general driver routines */ int urltype2driver(char *urltype, int *driver); int fits_register_driver( char *prefix, int (*init)(void), int (*fitsshutdown)(void), int (*setoptions)(int option), int (*getoptions)(int *options), int (*getversion)(int *version), int (*checkfile) (char *urltype, char *infile, char *outfile), int (*fitsopen)(char *filename, int rwmode, int *driverhandle), int (*fitscreate)(char *filename, int *driverhandle), int (*fitstruncate)(int driverhandle, LONGLONG filesize), int (*fitsclose)(int driverhandle), int (*fremove)(char *filename), int (*size)(int driverhandle, LONGLONG *size), int (*flush)(int driverhandle), int (*seek)(int driverhandle, LONGLONG offset), int (*fitsread) (int driverhandle, void *buffer, long nbytes), int (*fitswrite)(int driverhandle, void *buffer, long nbytes)); /* file driver I/O routines */ int file_init(void); int file_setoptions(int options); int file_getoptions(int *options); int file_getversion(int *version); int file_shutdown(void); int file_checkfile(char *urltype, char *infile, char *outfile); int file_open(char *filename, int rwmode, int *driverhandle); int file_compress_open(char *filename, int rwmode, int *hdl); int file_openfile(char *filename, int rwmode, FILE **diskfile); int file_create(char *filename, int *driverhandle); int file_truncate(int driverhandle, LONGLONG filesize); int file_size(int driverhandle, LONGLONG *filesize); int file_close(int driverhandle); int file_remove(char *filename); int file_flush(int driverhandle); int file_seek(int driverhandle, LONGLONG offset); int file_read (int driverhandle, void *buffer, long nbytes); int file_write(int driverhandle, void *buffer, long nbytes); int file_is_compressed(char *filename); /* stream driver I/O routines */ int stream_open(char *filename, int rwmode, int *driverhandle); int stream_create(char *filename, int *driverhandle); int stream_size(int driverhandle, LONGLONG *filesize); int stream_close(int driverhandle); int stream_flush(int driverhandle); int stream_seek(int driverhandle, LONGLONG offset); int stream_read (int driverhandle, void *buffer, long nbytes); int stream_write(int driverhandle, void *buffer, long nbytes); /* memory driver I/O routines */ int mem_init(void); int mem_setoptions(int options); int mem_getoptions(int *options); int mem_getversion(int *version); int mem_shutdown(void); int mem_create(char *filename, int *handle); int mem_create_comp(char *filename, int *handle); int mem_openmem(void **buffptr, size_t *buffsize, size_t deltasize, void *(*memrealloc)(void *p, size_t newsize), int *handle); int mem_createmem(size_t memsize, int *handle); int stdin_checkfile(char *urltype, char *infile, char *outfile); int stdin_open(char *filename, int rwmode, int *handle); int stdin2mem(int hd); int stdin2file(int hd); int stdout_close(int handle); int mem_compress_openrw(char *filename, int rwmode, int *hdl); int mem_compress_open(char *filename, int rwmode, int *hdl); int mem_compress_stdin_open(char *filename, int rwmode, int *hdl); int mem_iraf_open(char *filename, int rwmode, int *hdl); int mem_rawfile_open(char *filename, int rwmode, int *hdl); int mem_size(int handle, LONGLONG *filesize); int mem_truncate(int handle, LONGLONG filesize); int mem_close_free(int handle); int mem_close_keep(int handle); int mem_close_comp(int handle); int mem_seek(int handle, LONGLONG offset); int mem_read(int hdl, void *buffer, long nbytes); int mem_write(int hdl, void *buffer, long nbytes); int mem_uncompress2mem(char *filename, FILE *diskfile, int hdl); int iraf2mem(char *filename, char **buffptr, size_t *buffsize, size_t *filesize, int *status); /* root driver I/O routines */ int root_init(void); int root_setoptions(int options); int root_getoptions(int *options); int root_getversion(int *version); int root_shutdown(void); int root_open(char *filename, int rwmode, int *driverhandle); int root_create(char *filename, int *driverhandle); int root_close(int driverhandle); int root_flush(int driverhandle); int root_seek(int driverhandle, LONGLONG offset); int root_read (int driverhandle, void *buffer, long nbytes); int root_write(int driverhandle, void *buffer, long nbytes); int root_size(int handle, LONGLONG *filesize); /* http driver I/O routines */ int http_checkfile(char *urltype, char *infile, char *outfile); int http_open(char *filename, int rwmode, int *driverhandle); int http_file_open(char *filename, int rwmode, int *driverhandle); int http_compress_open(char *filename, int rwmode, int *driverhandle); /* ftp driver I/O routines */ int ftp_checkfile(char *urltype, char *infile, char *outfile); int ftp_open(char *filename, int rwmode, int *driverhandle); int ftp_file_open(char *filename, int rwmode, int *driverhandle); int ftp_compress_open(char *filename, int rwmode, int *driverhandle); int uncompress2mem(char *filename, FILE *diskfile, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int uncompress2mem_from_mem( char *inmemptr, size_t inmemsize, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int uncompress2file(char *filename, FILE *indiskfile, FILE *outdiskfile, int *status); int compress2mem_from_mem( char *inmemptr, size_t inmemsize, char **buffptr, size_t *buffsize, void *(*mem_realloc)(void *p, size_t newsize), size_t *filesize, int *status); int compress2file_from_mem( char *inmemptr, size_t inmemsize, FILE *outdiskfile, size_t *filesize, /* O - size of file, in bytes */ int *status); #ifdef HAVE_GSIFTP /* prototypes for gsiftp driver I/O routines */ #include "drvrgsiftp.h" #endif #ifdef HAVE_SHMEM_SERVICES /* prototypes for shared memory driver I/O routines */ #include "drvrsmem.h" #endif #if defined(vms) || defined(__vms) || defined(WIN32) || defined(__WIN32__) || (defined(macintosh) && !defined(TARGET_API_MAC_CARBON)) /* A hack for nonunix machines, which lack strcasecmp and strncasecmp */ int strcasecmp (const char *s1, const char *s2 ); int strncasecmp(const char *s1, const char *s2, size_t n); #endif /* end of the entire "ifndef _FITSIO2_H" block */ #endif astropy-0.3/cextern/cfitsio/zutil.c0000644000175000017500000001620012243255342015621 0ustar oleole/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2005, 2010 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; const char * ZEXPORT zlibVersion() { return ZLIB_VERSION; } uLong ZEXPORT zlibCompileFlags() { uLong flags; flags = 0; switch ((int)(sizeof(uInt))) { case 2: break; case 4: flags += 1; break; case 8: flags += 2; break; default: flags += 3; } switch ((int)(sizeof(uLong))) { case 2: break; case 4: flags += 1 << 2; break; case 8: flags += 2 << 2; break; default: flags += 3 << 2; } switch ((int)(sizeof(voidpf))) { case 2: break; case 4: flags += 1 << 4; break; case 8: flags += 2 << 4; break; default: flags += 3 << 4; } switch ((int)(sizeof(z_off_t))) { case 2: break; case 4: flags += 1 << 6; break; case 8: flags += 2 << 6; break; default: flags += 3 << 6; } #ifdef DEBUG flags += 1 << 8; #endif #if defined(ASMV) || defined(ASMINF) flags += 1 << 9; #endif #ifdef ZLIB_WINAPI flags += 1 << 10; #endif #ifdef BUILDFIXED flags += 1 << 12; #endif #ifdef DYNAMIC_CRC_TABLE flags += 1 << 13; #endif #ifdef NO_GZCOMPRESS flags += 1L << 16; #endif #ifdef NO_GZIP flags += 1L << 17; #endif #ifdef PKZIP_BUG_WORKAROUND flags += 1L << 20; #endif #ifdef FASTEST flags += 1L << 21; #endif #ifdef STDC # ifdef NO_vsnprintf flags += 1L << 25; # ifdef HAS_vsprintf_void flags += 1L << 26; # endif # else # ifdef HAS_vsnprintf_void flags += 1L << 26; # endif # endif #else flags += 1L << 24; # ifdef NO_snprintf flags += 1L << 25; # ifdef HAS_sprintf_void flags += 1L << 26; # endif # else # ifdef HAS_snprintf_void flags += 1L << 26; # endif # endif #endif return flags; } #ifdef DEBUG # ifndef verbose # define verbose 0 # endif int ZLIB_INTERNAL z_verbose = verbose; void ZLIB_INTERNAL z_error (m) char *m; { fprintf(stderr, "%s\n", m); exit(1); } #endif /* exported to allow conversion of error code to string for compress() and * uncompress() */ const char * ZEXPORT zError(err) int err; { return ERR_MSG(err); } #if defined(_WIN32_WCE) /* The Microsoft C Run-Time Library for Windows CE doesn't have * errno. We define it as a global variable to simplify porting. * Its value is always 0 and should not be used. */ int errno = 0; #endif #ifndef HAVE_MEMCPY void ZLIB_INTERNAL zmemcpy(dest, source, len) Bytef* dest; const Bytef* source; uInt len; { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } int ZLIB_INTERNAL zmemcmp(s1, s2, len) const Bytef* s1; const Bytef* s2; uInt len; { uInt j; for (j = 0; j < len; j++) { if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; } return 0; } void ZLIB_INTERNAL zmemzero(dest, len) Bytef* dest; uInt len; { if (len == 0) return; do { *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } #endif #ifdef SYS16BIT #ifdef __TURBOC__ /* Turbo C in 16-bit mode */ # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes * and farmalloc(64K) returns a pointer with an offset of 8, so we * must fix the pointer. Warning: the pointer must be put back to its * original form in order to free it, use zcfree(). */ #define MAX_PTR 10 /* 10*64K = 640K */ local int next_ptr = 0; typedef struct ptr_table_s { voidpf org_ptr; voidpf new_ptr; } ptr_table; local ptr_table table[MAX_PTR]; /* This table is used to remember the original form of pointers * to large buffers (64K). Such pointers are normalized with a zero offset. * Since MSDOS is not a preemptive multitasking OS, this table is not * protected from concurrent access. This hack doesn't work anyway on * a protected system like OS/2. Use Microsoft C instead. */ voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) { voidpf buf = opaque; /* just to make some compilers happy */ ulg bsize = (ulg)items*size; /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ if (bsize < 65520L) { buf = farmalloc(bsize); if (*(ush*)&buf != 0) return buf; } else { buf = farmalloc(bsize + 16L); } if (buf == NULL || next_ptr >= MAX_PTR) return NULL; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; *(ush*)&buf = 0; table[next_ptr++].new_ptr = buf; return buf; } void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { int n; if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; } /* Find the original pointer */ for (n = 0; n < next_ptr; n++) { if (ptr != table[n].new_ptr) continue; farfree(table[n].org_ptr); while (++n < next_ptr) { table[n-1] = table[n]; } next_ptr--; return; } ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } #endif /* __TURBOC__ */ #ifdef M_I86 /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) { if (opaque) opaque = 0; /* to make compiler happy */ return _halloc((long)items, size); } void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) { if (opaque) opaque = 0; /* to make compiler happy */ _hfree(ptr); } #endif /* M_I86 */ #endif /* SYS16BIT */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC extern voidp malloc OF((uInt size)); extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; { if (opaque) items += size - size; /* make compiler happy */ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : (voidpf)calloc(items, size); } void ZLIB_INTERNAL zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { free(ptr); if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */ astropy-0.3/cextern/cfitsio/getcolui.c0000644000175000017500000021673612243255342016305 0ustar oleole/* This file, getcolui.c, contains routines that read data elements from */ /* a FITS image or table, with unsigned short datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpvui( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned short nulval, /* I - value for undefined pixels */ unsigned short *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; unsigned short nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TUSHORT, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclui(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfui( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned short *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TUSHORT, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclui(fptr, 2, row, firstelem, nelem, 1, 2, 0, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2dui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned short nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3dui(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3dui(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ unsigned short nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}, nfits, narray; LONGLONG lpixel[3]; unsigned short nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TUSHORT, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgclui(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgclui(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsvui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned short nulval, /* I - value to set undefined pixels */ unsigned short *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; unsigned short nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvui is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TUSHORT, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvui: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclui(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ unsigned short *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; unsigned short nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsvi is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TUSHORT, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsvi: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgclui(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpui( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ unsigned short *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgclui(fptr, 1, row, firstelem, nelem, 1, 1, 0, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned short nulval, /* I - value for null pixels */ unsigned short *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfui(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ unsigned short *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { unsigned short dummy = 0; ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgclui( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ unsigned short nulval, /* I - value for null pixels if nultyp = 1 */ unsigned short *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int nulcheck; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 0, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ if (tcode == TSHORT) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) &array[next], status); fffi2u2((short *) &array[next], ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8u2( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1u2((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4u2((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, (float *) buffer, status); fffr4u2((float *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8u2((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstru2((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgclui).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgclui).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1u2(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (unsigned short) input[ii]; /* copy input */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (unsigned short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2u2(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 32768.) { /* Instead of adding 32768, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(unsigned short *) &input[ii] ) ^ 0x8000; } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned short) input[ii]; /* copy input */ } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 32768.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = ( *(unsigned short *) &input[ii] ) ^ 0x8000; } } else if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else output[ii] = (unsigned short) input[ii]; /* copy input */ } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4u2(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > USHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > USHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8u2(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > USHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { if (input[ii] < 0) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > USHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4u2(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8u2(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; double dvalue; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else { if (input[ii] < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) input[ii]; } } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ { if (zero < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (zero > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) zero; } } else { dvalue = input[ii] * scale + zero; if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstru2(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ unsigned short nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ unsigned short *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); dvalue = dvalue * scale + zero; /* apply the scaling */ if (dvalue < DUSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = USHRT_MAX; } else output[ii] = (unsigned short) dvalue; } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/deflate.c0000644000175000017500000020460712243255342016070 0ustar oleole/* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process depends on being able to identify portions * of the input text which are identical to earlier input (within a * sliding window trailing behind the input currently being processed). * * The most straightforward technique turns out to be the fastest for * most input files: try all possible matches and select the longest. * The key feature of this algorithm is that insertions into the string * dictionary are very simple and thus fast, and deletions are avoided * completely. Insertions are performed at each input character, whereas * string matches are performed only when the previous match ends. So it * is preferable to spend more time in matches to allow very fast string * insertions and avoid deletions. The matching algorithm for small * strings is inspired from that of Rabin & Karp. A brute force approach * is used to find longer strings when a small match has been found. * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze * (by Leonid Broukhis). * A previous version of this file used a more sophisticated algorithm * (by Fiala and Greene) which is guaranteed to run in linear amortized * time, but has a larger average cost, uses more memory and is patented. * However the F&G algorithm may be faster for some highly redundant * files if the parameter max_chain_length (described below) is too large. * * ACKNOWLEDGEMENTS * * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and * I found it in 'freeze' written by Leonid Broukhis. * Thanks to many people for bug reports and testing. * * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". * Available in http://www.ietf.org/rfc/rfc1951.txt * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. * * Fiala,E.R., and Greene,D.H. * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 * */ #include "deflate.h" const char deflate_copyright[] = " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* =========================================================================== * Function prototypes. */ typedef enum { need_more, /* block not completed, need more input or more output */ block_done, /* block flush performed */ finish_started, /* finish started, need only more output at next deflate */ finish_done /* finish done, accept no more input or output */ } block_state; typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); #ifndef FASTEST local block_state deflate_slow OF((deflate_state *s, int flush)); #endif local block_state deflate_rle OF((deflate_state *s, int flush)); local block_state deflate_huff OF((deflate_state *s, int flush)); local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif #ifdef DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif /* =========================================================================== * Local data */ #define NIL 0 /* Tail of hash chains */ #ifndef TOO_FAR # define TOO_FAR 4096 #endif /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ typedef struct config_s { ush good_length; /* reduce lazy search above this match length */ ush max_lazy; /* do not perform lazy search above this match length */ ush nice_length; /* quit search above this match length */ ush max_chain; compress_func func; } config; #ifdef FASTEST local const config configuration_table[2] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ #else local const config configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ /* 2 */ {4, 5, 16, 8, deflate_fast}, /* 3 */ {4, 6, 32, 32, deflate_fast}, /* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ /* 5 */ {8, 16, 32, 32, deflate_slow}, /* 6 */ {8, 16, 128, 128, deflate_slow}, /* 7 */ {8, 32, 128, 256, deflate_slow}, /* 8 */ {32, 128, 258, 1024, deflate_slow}, /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ #endif /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ #define EQUAL 0 /* result of memcmp for equal strings */ #ifndef NO_DUMMY_DECL struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ #endif /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== * Insert string str in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. * IN assertion: all calls to to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #else #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #endif /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; int level; const char *version; int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; const char *version; int stream_size; { deflate_state *s; int wrap = 1; static const char my_version[] = ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average * output size for (length,distance) codes is <= 24 bits. */ if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } #ifdef GZIP else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } #endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; s->wrap = wrap; s->gzhead = Z_NULL; s->w_bits = windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; s->hash_bits = memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); s->high_water = 0; /* nothing written to s->window yet */ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); s->pending_buf = (uchf *) overlay; s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { s->status = FINISH_STATE; strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; s->level = level; s->strategy = strategy; s->method = (Byte)method; return deflateReset(strm); } /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { deflate_state *s; uInt length = dictLength; uInt n; IPos hash_head = 0; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || strm->state->wrap == 2 || (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) return Z_STREAM_ERROR; s = strm->state; if (s->wrap) strm->adler = adler32(strm->adler, dictionary, dictLength); if (length < MIN_MATCH) return Z_OK; if (length > s->w_size) { length = s->w_size; dictionary += dictLength - length; /* use the tail of the dictionary */ } zmemcpy(s->window, dictionary, length); s->strstart = length; s->block_start = (long)length; /* Insert all strings in the hash table (except for the last two bytes). * s->lookahead stays null, so s->ins_h will be recomputed at the next * call of fill_window. */ s->ins_h = s->window[0]; UPDATE_HASH(s, s->ins_h, s->window[1]); for (n = 0; n <= length - MIN_MATCH; n++) { INSERT_STRING(s, n, hash_head); } if (hash_head) hash_head = 0; /* to make compiler happy */ return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateReset (strm) z_streamp strm; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { return Z_STREAM_ERROR; } strm->total_in = strm->total_out = 0; strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ strm->data_type = Z_UNKNOWN; s = (deflate_state *)strm->state; s->pending = 0; s->pending_out = s->pending_buf; if (s->wrap < 0) { s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } s->status = s->wrap ? INIT_STATE : BUSY_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : #endif adler32(0L, Z_NULL, 0); s->last_flush = Z_NO_FLUSH; _tr_init(s); lm_init(s); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateSetHeader (strm, head) z_streamp strm; gz_headerp head; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm->state->wrap != 2) return Z_STREAM_ERROR; strm->state->gzhead = head; return Z_OK; } /* ========================================================================= */ int ZEXPORT deflatePrime (strm, bits, value) z_streamp strm; int bits; int value; { if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; strm->state->bi_valid = bits; strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; int level; int strategy; { deflate_state *s; compress_func func; int err = Z_OK; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; #ifdef FASTEST if (level != 0) level = 1; #else if (level == Z_DEFAULT_COMPRESSION) level = 6; #endif if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return Z_STREAM_ERROR; } func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_BLOCK); } if (s->level != level) { s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; s->nice_match = configuration_table[level].nice_length; s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; return err; } /* ========================================================================= */ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) z_streamp strm; int good_length; int max_lazy; int nice_length; int max_chain; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; s->good_match = good_length; s->max_lazy_match = max_lazy; s->nice_match = nice_length; s->max_chain_length = max_chain; return Z_OK; } /* ========================================================================= * For the default windowBits of 15 and memLevel of 8, this function returns * a close to exact, as well as small, upper bound on the compressed size. * They are coded as constants here for a reason--if the #define's are * changed, then this function needs to be changed as well. The return * value for 15 and 8 only works for those exact settings. * * For any setting other than those defaults for windowBits and memLevel, * the value returned is a conservative worst case for the maximum expansion * resulting from using fixed blocks instead of stored blocks, which deflate * can emit on compressed data for some combinations of the parameters. * * This function could be more sophisticated to provide closer upper bounds for * every combination of windowBits and memLevel. But even the conservative * upper bound of about 14% expansion does not seem onerous for output buffer * allocation. */ uLong ZEXPORT deflateBound(strm, sourceLen) z_streamp strm; uLong sourceLen; { deflate_state *s; uLong complen, wraplen; Bytef *str; /* conservative upper bound for compressed data */ complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; /* if can't get parameters, return conservative bound plus zlib wrapper */ if (strm == Z_NULL || strm->state == Z_NULL) return complen + 6; /* compute wrapper length */ s = strm->state; switch (s->wrap) { case 0: /* raw deflate */ wraplen = 0; break; case 1: /* zlib wrapper */ wraplen = 6 + (s->strstart ? 4 : 0); break; case 2: /* gzip wrapper */ wraplen = 18; if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ if (s->gzhead->extra != Z_NULL) wraplen += 2 + s->gzhead->extra_len; str = s->gzhead->name; if (str != Z_NULL) do { wraplen++; } while (*str++); str = s->gzhead->comment; if (str != Z_NULL) do { wraplen++; } while (*str++); if (s->gzhead->hcrc) wraplen += 2; } break; default: /* for compiler happiness */ wraplen = 6; } /* if not default parameters, return conservative bound */ if (s->w_bits != 15 || s->hash_bits != 8 + 7) return complen + wraplen; /* default settings: return tight bound for that case */ return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ local void putShortMSB (s, b) deflate_state *s; uInt b; { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; { unsigned len = strm->state->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; zmemcpy(strm->next_out, strm->state->pending_out, len); strm->next_out += len; strm->state->pending_out += len; strm->total_out += len; strm->avail_out -= len; strm->state->pending -= len; if (strm->state->pending == 0) { strm->state->pending_out = strm->state->pending_buf; } } /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; int flush; { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || flush > Z_BLOCK || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; /* Write the header */ if (s->status == INIT_STATE) { #ifdef GZIP if (s->wrap == 2) { strm->adler = crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (s->gzhead == Z_NULL) { put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s->status = BUSY_STATE; } else { put_byte(s, (s->gzhead->text ? 1 : 0) + (s->gzhead->hcrc ? 2 : 0) + (s->gzhead->extra == Z_NULL ? 0 : 4) + (s->gzhead->name == Z_NULL ? 0 : 8) + (s->gzhead->comment == Z_NULL ? 0 : 16) ); put_byte(s, (Byte)(s->gzhead->time & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); put_byte(s, s->gzhead->os & 0xff); if (s->gzhead->extra != Z_NULL) { put_byte(s, s->gzhead->extra_len & 0xff); put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); } if (s->gzhead->hcrc) strm->adler = crc32(strm->adler, s->pending_buf, s->pending); s->gzindex = 0; s->status = EXTRA_STATE; } } else #endif { uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; uInt level_flags; if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) level_flags = 0; else if (s->level < 6) level_flags = 1; else if (s->level == 6) level_flags = 2; else level_flags = 3; header |= (level_flags << 6); if (s->strstart != 0) header |= PRESET_DICT; header += 31 - (header % 31); s->status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s->strstart != 0) { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } strm->adler = adler32(0L, Z_NULL, 0); } } #ifdef GZIP if (s->status == EXTRA_STATE) { if (s->gzhead->extra != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) break; } put_byte(s, s->gzhead->extra[s->gzindex]); s->gzindex++; } if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (s->gzindex == s->gzhead->extra_len) { s->gzindex = 0; s->status = NAME_STATE; } } else s->status = NAME_STATE; } if (s->status == NAME_STATE) { if (s->gzhead->name != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->name[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) { s->gzindex = 0; s->status = COMMENT_STATE; } } else s->status = COMMENT_STATE; } if (s->status == COMMENT_STATE) { if (s->gzhead->comment != Z_NULL) { uInt beg = s->pending; /* start of bytes to update crc */ int val; do { if (s->pending == s->pending_buf_size) { if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); flush_pending(strm); beg = s->pending; if (s->pending == s->pending_buf_size) { val = 1; break; } } val = s->gzhead->comment[s->gzindex++]; put_byte(s, val); } while (val != 0); if (s->gzhead->hcrc && s->pending > beg) strm->adler = crc32(strm->adler, s->pending_buf + beg, s->pending - beg); if (val == 0) s->status = HCRC_STATE; } else s->status = HCRC_STATE; } if (s->status == HCRC_STATE) { if (s->gzhead->hcrc) { if (s->pending + 2 > s->pending_buf_size) flush_pending(strm); if (s->pending + 2 <= s->pending_buf_size) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); strm->adler = crc32(0L, Z_NULL, 0); s->status = BUSY_STATE; } } else s->status = BUSY_STATE; } #endif /* Flush as much pending output as possible */ if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s->last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm->avail_in == 0 && flush <= old_flush && flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s->status == FINISH_STATE && strm->avail_in != 0) { ERR_RETURN(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : (s->strategy == Z_RLE ? deflate_rle(s, flush) : (*(configuration_table[s->level].func))(s, flush)); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; } if (bstate == need_more || bstate == finish_started) { if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate == block_done) { if (flush == Z_PARTIAL_FLUSH) { _tr_align(s); } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ _tr_stored_block(s, (char*)0, 0L, 0); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush == Z_FULL_FLUSH) { CLEAR_HASH(s); /* forget history */ if (s->lookahead == 0) { s->strstart = 0; s->block_start = 0L; } } } flush_pending(strm); if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; if (s->wrap <= 0) return Z_STREAM_END; /* Write the trailer */ #ifdef GZIP if (s->wrap == 2) { put_byte(s, (Byte)(strm->adler & 0xff)); put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); put_byte(s, (Byte)(strm->total_in & 0xff)); put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); } else #endif { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ return s->pending != 0 ? Z_OK : Z_STREAM_END; } /* ========================================================================= */ int ZEXPORT deflateEnd (strm) z_streamp strm; { int status; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; status = strm->state->status; if (status != INIT_STATE && status != EXTRA_STATE && status != NAME_STATE && status != COMMENT_STATE && status != HCRC_STATE && status != BUSY_STATE && status != FINISH_STATE) { return Z_STREAM_ERROR; } /* Deallocate in reverse order of allocations: */ TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->prev); TRY_FREE(strm, strm->state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; } /* ========================================================================= * Copy the source state to the destination state. * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ int ZEXPORT deflateCopy (dest, source) z_streamp dest; z_streamp source; { #ifdef MAXSEG_64K return Z_STREAM_ERROR; #else deflate_state *ds; deflate_state *ss; ushf *overlay; if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } ss = source->state; zmemcpy(dest, source, sizeof(z_stream)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; zmemcpy(ds, ss, sizeof(deflate_state)); ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); ds->pending_buf = (uchf *) overlay; if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { deflateEnd (dest); return Z_MEM_ERROR; } /* following zmemcpy do not work for 16-bit MSDOS */ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; ds->bl_desc.dyn_tree = ds->bl_tree; return Z_OK; #endif /* MAXSEG_64K */ } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ local int read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; { unsigned len = strm->avail_in; if (len > size) len = size; if (len == 0) return 0; strm->avail_in -= len; if (strm->state->wrap == 1) { strm->adler = adler32(strm->adler, strm->next_in, len); } #ifdef GZIP else if (strm->state->wrap == 2) { strm->adler = crc32(strm->adler, strm->next_in, len); } #endif zmemcpy(buf, strm->next_in, len); strm->next_in += len; strm->total_in += len; return (int)len; } /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ local void lm_init (s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; CLEAR_HASH(s); /* Set the default configuration parameters: */ s->max_lazy_match = configuration_table[s->level].max_lazy; s->good_match = configuration_table[s->level].good_length; s->nice_match = configuration_table[s->level].nice_length; s->max_chain_length = configuration_table[s->level].max_chain; s->strstart = 0; s->block_start = 0L; s->lookahead = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; #ifndef FASTEST #ifdef ASMV match_init(); /* initialize the asm code */ #endif #endif } #ifndef FASTEST /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ #ifndef ASMV /* For 80x86 and 680x0, an optimized version will be provided in match.asm or * match.S. The code will be functionally equivalent. */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ int best_len = s->prev_length; /* best match length so far */ int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ Posf *prev = s->prev; uInt wmask = s->w_mask; #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. * Try with and without -DUNALIGNED_OK to check. */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; register ush scan_end = *(ushf*)(scan+best_len-1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; register Byte scan_end1 = scan[best_len-1]; register Byte scan_end = scan[best_len]; #endif /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s->prev_length >= s->good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if (*(ushf*)(match+best_len-1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at * strstart+3, +5, ... up to strstart+257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ /* Here, scan <= window+strstart+257 */ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); if (*scan == *match) scan++; len = (MAX_MATCH - 1) - (int)(strend-scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ if (match[best_len] != scan_end || match[best_len-1] != scan_end1 || *match != *scan || *++match != scan[1]) continue; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match++; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; #endif /* UNALIGNED_OK */ if (len > best_len) { s->match_start = cur_match; best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK scan_end = *(ushf*)(scan+best_len-1); #else scan_end1 = scan[best_len-1]; scan_end = scan[best_len]; #endif } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } #endif /* ASMV */ #else /* FASTEST */ /* --------------------------------------------------------------------------- * Optimized version for FASTEST only */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ register Bytef *strend = s->window + s->strstart + MAX_MATCH; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Return failure if the match length is less than 2: */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match += 2; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); if (len < MIN_MATCH) return MIN_MATCH - 1; s->match_start = cur_match; return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; } #endif /* FASTEST */ #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. */ local void check_match(s, start, match, length) deflate_state *s; IPos start, match; int length; { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, s->window + start, length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); do { fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); } while (--length != 0); z_error("invalid match"); } if (z_verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } #else # define check_match(s, start, match, length) #endif /* DEBUG */ /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ local void fill_window(s) deflate_state *s; { register unsigned n, m; register Posf *p; unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); /* Deal with !@#$% 64K limit: */ if (sizeof(int) <= 2) { if (more == 0 && s->strstart == 0 && s->lookahead == 0) { more = wsize; } else if (more == (unsigned)(-1)) { /* Very unlikely, but possible on 16 bit machine if * strstart == 0 && lookahead == 1 (input done a byte at time) */ more--; } } /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s->strstart >= wsize+MAX_DIST(s)) { zmemcpy(s->window, s->window+wsize, (unsigned)wsize); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s->hash_size; p = &s->head[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); } while (--n); n = wsize; #ifndef FASTEST p = &s->prev[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); #endif more += wsize; } if (s->strm->avail_in == 0) return; /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ Assert(more >= 2, "more < 2"); n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); s->lookahead += n; /* Initialize the hash value now that we have some input: */ if (s->lookahead >= MIN_MATCH) { s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ if (s->high_water < s->window_size) { ulg curr = s->strstart + (ulg)(s->lookahead); ulg init; if (s->high_water < curr) { /* Previous high water mark below current data -- zero WIN_INIT * bytes or up to end of window, whichever is less. */ init = s->window_size - curr; if (init > WIN_INIT) init = WIN_INIT; zmemzero(s->window + curr, (unsigned)init); s->high_water = curr + init; } else if (s->high_water < (ulg)curr + WIN_INIT) { /* High water mark at or above current data, but below current data * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up * to end of window, whichever is less. */ init = (ulg)curr + WIN_INIT - s->high_water; if (init > s->window_size - s->high_water) init = s->window_size - s->high_water; zmemzero(s->window + s->high_water, (unsigned)init); s->high_water += init; } } } /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. */ #define FLUSH_BLOCK_ONLY(s, last) { \ _tr_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ (charf *)Z_NULL), \ (ulg)((long)s->strstart - s->block_start), \ (last)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ } /* Same but force premature exit if necessary. */ #define FLUSH_BLOCK(s, last) { \ FLUSH_BLOCK_ONLY(s, last); \ if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ local block_state deflate_stored(s, flush) deflate_state *s; int flush; { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ ulg max_block_size = 0xffff; ulg max_start; if (max_block_size > s->pending_buf_size - 5) { max_block_size = s->pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s->lookahead <= 1) { Assert(s->strstart < s->w_size+MAX_DIST(s) || s->block_start >= (long)s->w_size, "slide too late"); fill_window(s); if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; if (s->lookahead == 0) break; /* flush the current block */ } Assert(s->block_start >= 0L, "block gone"); s->strstart += s->lookahead; s->lookahead = 0; /* Emit a stored block if pending_buf will be full: */ max_start = s->block_start + max_block_size; if (s->strstart == 0 || (ulg)s->strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s->lookahead = (uInt)(s->strstart - max_start); s->strstart = (uInt)max_start; FLUSH_BLOCK(s, 0); } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { FLUSH_BLOCK(s, 0); } } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ local block_state deflate_fast(s, flush) deflate_state *s; int flush; { IPos hash_head; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s->match_length = longest_match (s, hash_head); /* longest_match() sets match_start */ } if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->match_start, s->match_length); _tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ #ifndef FASTEST if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) { s->match_length--; /* string at strstart already in table */ do { s->strstart++; INSERT_STRING(s, s->strstart, hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); s->strstart++; } else #endif { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } #ifndef FASTEST /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ local block_state deflate_slow(s, flush) deflate_state *s; int flush; { IPos hash_head; /* head of hash chain */ int bflush; /* set if current block must be flushed */ /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = NIL; if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. */ s->prev_length = s->match_length, s->prev_match = s->match_start; s->match_length = MIN_MATCH-1; if (hash_head != NIL && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s->match_length = longest_match (s, hash_head); /* longest_match() sets match_start */ if (s->match_length <= 5 && (s->strategy == Z_FILTERED #if TOO_FAR <= 32767 || (s->match_length == MIN_MATCH && s->strstart - s->match_start > TOO_FAR) #endif )) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s->match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ check_match(s, s->strstart-1, s->prev_match, s->prev_length); _tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s->lookahead -= s->prev_length-1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { INSERT_STRING(s, s->strstart, hash_head); } } while (--s->prev_length != 0); s->match_available = 0; s->match_length = MIN_MATCH-1; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } else if (s->match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } s->strstart++; s->lookahead--; if (s->strm->avail_out == 0) return need_more; } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s->match_available = 1; s->strstart++; s->lookahead--; } } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); s->match_available = 0; } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } #endif /* FASTEST */ /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ local block_state deflate_rle(s, flush) deflate_state *s; int flush; { int bflush; /* set if current block must be flushed */ uInt prev; /* byte at distance one to match */ Bytef *scan, *strend; /* scan goes up to strend for length of run */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest encodable run. */ if (s->lookahead < MAX_MATCH) { fill_window(s); if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* See how many times the previous byte repeats */ s->match_length = 0; if (s->lookahead >= MIN_MATCH && s->strstart > 0) { scan = s->window + s->strstart - 1; prev = *scan; if (prev == *++scan && prev == *++scan && prev == *++scan) { strend = s->window + s->strstart + MAX_MATCH; do { } while (prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && prev == *++scan && scan < strend); s->match_length = MAX_MATCH - (int)(strend - scan); if (s->match_length > s->lookahead) s->match_length = s->lookahead; } } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->strstart - 1, s->match_length); _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; s->strstart += s->match_length; s->match_length = 0; } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } /* =========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ local block_state deflate_huff(s, flush) deflate_state *s; int flush; { int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s->lookahead == 0) { fill_window(s); if (s->lookahead == 0) { if (flush == Z_NO_FLUSH) return need_more; break; /* flush the current block */ } } /* Output a literal byte */ s->match_length = 0; Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } astropy-0.3/cextern/cfitsio/drvrsmem.c0000644000175000017500000011306612243255342016321 0ustar oleole/* S H A R E D M E M O R Y D R I V E R ======================================= by Jerzy.Borkowski@obs.unige.ch 09-Mar-98 : initial version 1.0 released 23-Mar-98 : shared_malloc now accepts new handle as an argument 23-Mar-98 : shmem://0, shmem://1, etc changed to shmem://h0, etc due to bug in url parser. 10-Apr-98 : code cleanup 13-May-99 : delayed initialization added, global table deleted on exit when no shmem segments remain, and last process terminates */ #ifdef HAVE_SHMEM_SERVICES #include "fitsio2.h" /* drvrsmem.h is included by it */ #include #include #include #include #include #include #include #if defined(unix) || defined(__unix__) || defined(__unix) #include #endif static int shared_kbase = 0; /* base for shared memory handles */ static int shared_maxseg = 0; /* max number of shared memory blocks */ static int shared_range = 0; /* max number of tried entries */ static int shared_fd = SHARED_INVALID; /* handle of global access lock file */ static int shared_gt_h = SHARED_INVALID; /* handle of global table segment */ static SHARED_LTAB *shared_lt = NULL; /* local table pointer */ static SHARED_GTAB *shared_gt = NULL; /* global table pointer */ static int shared_create_mode = 0666; /* permission flags for created objects */ static int shared_debug = 1; /* simple debugging tool, set to 0 to disable messages */ static int shared_init_called = 0; /* flag whether shared_init() has been called, used for delayed init */ /* static support routines prototypes */ static int shared_clear_entry(int idx); /* unconditionally clear entry */ static int shared_destroy_entry(int idx); /* unconditionally destroy sema & shseg and clear entry */ static int shared_mux(int idx, int mode); /* obtain exclusive access to specified segment */ static int shared_demux(int idx, int mode); /* free exclusive access to specified segment */ static int shared_process_count(int sem); /* valid only for time of invocation */ static int shared_delta_process(int sem, int delta); /* change number of processes hanging on segment */ static int shared_attach_process(int sem); static int shared_detach_process(int sem); static int shared_get_free_entry(int newhandle); /* get free entry in shared_key, or -1, entry is set rw locked */ static int shared_get_hash(long size, int idx);/* return hash value for malloc */ static long shared_adjust_size(long size); /* size must be >= 0 !!! */ static int shared_check_locked_index(int idx); /* verify that given idx is valid */ static int shared_map(int idx); /* map all tables for given idx, check for validity */ static int shared_validate(int idx, int mode); /* use intrnally inside crit.sect !!! */ /* support routines - initialization */ static int shared_clear_entry(int idx) /* unconditionally clear entry */ { if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); shared_gt[idx].key = SHARED_INVALID; /* clear entries in global table */ shared_gt[idx].handle = SHARED_INVALID; shared_gt[idx].sem = SHARED_INVALID; shared_gt[idx].semkey = SHARED_INVALID; shared_gt[idx].nprocdebug = 0; shared_gt[idx].size = 0; shared_gt[idx].attr = 0; return(SHARED_OK); } static int shared_destroy_entry(int idx) /* unconditionally destroy sema & shseg and clear entry */ { int r, r2; union semun filler; if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); r2 = r = SHARED_OK; filler.val = 0; /* this is to make cc happy (warning otherwise) */ if (SHARED_INVALID != shared_gt[idx].sem) r = semctl(shared_gt[idx].sem, 0, IPC_RMID, filler); /* destroy semaphore */ if (SHARED_INVALID != shared_gt[idx].handle) r2 = shmctl(shared_gt[idx].handle, IPC_RMID, 0); /* destroy shared memory segment */ if (SHARED_OK == r) r = r2; /* accumulate error code in r, free r2 */ r2 = shared_clear_entry(idx); return((SHARED_OK == r) ? r2 : r); } void shared_cleanup(void) /* this must (should) be called during exit/abort */ { int i, j, r, oktodelete, filelocked, segmentspresent; flock_t flk; struct shmid_ds ds; if (shared_debug) printf("shared_cleanup:"); if (NULL != shared_lt) { if (shared_debug) printf(" deleting segments:"); for (i=0; i>\n"); return; } int shared_init(int debug_msgs) /* initialize shared memory stuff, you have to call this routine once */ { int i; char buf[1000], *p; mode_t oldumask; shared_init_called = 1; /* tell everybody no need to call us for the 2nd time */ shared_debug = debug_msgs; /* set required debug mode */ if (shared_debug) printf("shared_init:"); shared_kbase = 0; /* adapt to current env. settings */ if (NULL != (p = getenv(SHARED_ENV_KEYBASE))) shared_kbase = atoi(p); if (0 == shared_kbase) shared_kbase = SHARED_KEYBASE; if (shared_debug) printf(" keybase=%d", shared_kbase); shared_maxseg = 0; if (NULL != (p = getenv(SHARED_ENV_MAXSEG))) shared_maxseg = atoi(p); if (0 == shared_maxseg) shared_maxseg = SHARED_MAXSEG; if (shared_debug) printf(" maxseg=%d", shared_maxseg); shared_range = 3 * shared_maxseg; if (SHARED_INVALID == shared_fd) /* create rw locking file (this file is never deleted) */ { if (shared_debug) printf(" lockfileinit="); sprintf(buf, "%s.%d.%d", SHARED_FDNAME, shared_kbase, shared_maxseg); oldumask = umask(0); shared_fd = open(buf, O_TRUNC | O_EXCL | O_CREAT | O_RDWR, shared_create_mode); umask(oldumask); if (SHARED_INVALID == shared_fd) /* or just open rw locking file, in case it already exists */ { shared_fd = open(buf, O_TRUNC | O_RDWR, shared_create_mode); if (SHARED_INVALID == shared_fd) return(SHARED_NOFILE); if (shared_debug) printf("slave"); } else { if (shared_debug) printf("master"); } } if (SHARED_INVALID == shared_gt_h) /* global table not attached, try to create it in shared memory */ { if (shared_debug) printf(" globalsharedtableinit="); shared_gt_h = shmget(shared_kbase, shared_maxseg * sizeof(SHARED_GTAB), IPC_CREAT | IPC_EXCL | shared_create_mode); /* try open as a master */ if (SHARED_INVALID == shared_gt_h) /* if failed, try to open as a slave */ { shared_gt_h = shmget(shared_kbase, shared_maxseg * sizeof(SHARED_GTAB), shared_create_mode); if (SHARED_INVALID == shared_gt_h) return(SHARED_IPCERR); /* means deleted ID residing in system, shared mem unusable ... */ shared_gt = (SHARED_GTAB *)shmat(shared_gt_h, 0, 0); /* attach segment */ if (((SHARED_GTAB *)SHARED_INVALID) == shared_gt) return(SHARED_IPCERR); if (shared_debug) printf("slave"); } else { shared_gt = (SHARED_GTAB *)shmat(shared_gt_h, 0, 0); /* attach segment */ if (((SHARED_GTAB *)SHARED_INVALID) == shared_gt) return(SHARED_IPCERR); for (i=0; i>\n"); return(SHARED_OK); } int shared_recover(int id) /* try to recover dormant segments after applic crash */ { int i, r, r2; if (NULL == shared_gt) return(SHARED_NOTINIT); /* not initialized */ if (NULL == shared_lt) return(SHARED_NOTINIT); /* not initialized */ r = SHARED_OK; for (i=0; i r2) || (0 == r2)) { if (shared_debug) printf("Bogus handle=%d nproc=%d sema=%d:", i, shared_gt[i].nprocdebug, r2); r = shared_destroy_entry(i); if (shared_debug) { printf("%s", r ? "error couldn't clear handle" : "handle cleared"); } } shared_demux(i, SHARED_RDWRITE); } return(r); /* table full */ } /* API routines - mutexes and locking */ static int shared_mux(int idx, int mode) /* obtain exclusive access to specified segment */ { flock_t flk; int r; if (0 == shared_init_called) /* delayed initialization */ { if (SHARED_OK != (r = shared_init(0))) return(r); } if (SHARED_INVALID == shared_fd) return(SHARED_NOTINIT); if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); flk.l_type = ((mode & SHARED_RDWRITE) ? F_WRLCK : F_RDLCK); flk.l_whence = 0; flk.l_start = idx; flk.l_len = 1; if (shared_debug) printf(" [mux (%d): ", idx); if (-1 == fcntl(shared_fd, ((mode & SHARED_NOWAIT) ? F_SETLK : F_SETLKW), &flk)) { switch (errno) { case EAGAIN: ; case EACCES: if (shared_debug) printf("again]"); return(SHARED_AGAIN); default: if (shared_debug) printf("err]"); return(SHARED_IPCERR); } } if (shared_debug) printf("ok]"); return(SHARED_OK); } static int shared_demux(int idx, int mode) /* free exclusive access to specified segment */ { flock_t flk; if (SHARED_INVALID == shared_fd) return(SHARED_NOTINIT); if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); flk.l_type = F_UNLCK; flk.l_whence = 0; flk.l_start = idx; flk.l_len = 1; if (shared_debug) printf(" [demux (%d): ", idx); if (-1 == fcntl(shared_fd, F_SETLKW, &flk)) { switch (errno) { case EAGAIN: ; case EACCES: if (shared_debug) printf("again]"); return(SHARED_AGAIN); default: if (shared_debug) printf("err]"); return(SHARED_IPCERR); } } if (shared_debug) printf("mode=%d ok]", mode); return(SHARED_OK); } static int shared_process_count(int sem) /* valid only for time of invocation */ { union semun su; su.val = 0; /* to force compiler not to give warning messages */ return(semctl(sem, 0, GETVAL, su)); /* su is unused here */ } static int shared_delta_process(int sem, int delta) /* change number of processes hanging on segment */ { struct sembuf sb; if (SHARED_INVALID == sem) return(SHARED_BADARG); /* semaphore not attached */ sb.sem_num = 0; sb.sem_op = delta; sb.sem_flg = SEM_UNDO; return((-1 == semop(sem, &sb, 1)) ? SHARED_IPCERR : SHARED_OK); } static int shared_attach_process(int sem) { if (shared_debug) printf(" [attach process]"); return(shared_delta_process(sem, 1)); } static int shared_detach_process(int sem) { if (shared_debug) printf(" [detach process]"); return(shared_delta_process(sem, -1)); } /* API routines - hashing and searching */ static int shared_get_free_entry(int newhandle) /* get newhandle, or -1, entry is set rw locked */ { if (NULL == shared_gt) return(-1); /* not initialized */ if (NULL == shared_lt) return(-1); /* not initialized */ if (newhandle < 0) return(-1); if (newhandle >= shared_maxseg) return(-1); if (shared_lt[newhandle].tcnt) return(-1); /* somebody (we) is using it */ if (shared_mux(newhandle, SHARED_NOWAIT | SHARED_RDWRITE)) return(-1); /* used by others */ if (SHARED_INVALID == shared_gt[newhandle].key) return(newhandle); /* we have found free slot, lock it and return index */ shared_demux(newhandle, SHARED_RDWRITE); if (shared_debug) printf("[free_entry - ERROR - entry unusable]"); return(-1); /* table full */ } static int shared_get_hash(long size, int idx) /* return hash value for malloc */ { static int counter = 0; int hash; hash = (counter + size * idx) % shared_range; counter = (counter + 1) % shared_range; return(hash); } static long shared_adjust_size(long size) /* size must be >= 0 !!! */ { return(((size + sizeof(BLKHEAD) + SHARED_GRANUL - 1) / SHARED_GRANUL) * SHARED_GRANUL); } /* API routines - core : malloc/realloc/free/attach/detach/lock/unlock */ int shared_malloc(long size, int mode, int newhandle) /* return idx or SHARED_INVALID */ { int h, i, r, idx, key; union semun filler; BLKHEAD *bp; if (0 == shared_init_called) /* delayed initialization */ { if (SHARED_OK != (r = shared_init(0))) return(r); } if (shared_debug) printf("malloc (size = %ld, mode = %d):", size, mode); if (size < 0) return(SHARED_INVALID); if (-1 == (idx = shared_get_free_entry(newhandle))) return(SHARED_INVALID); if (shared_debug) printf(" idx=%d", idx); for (i = 0; ; i++) { if (i >= shared_range) /* table full, signal error & exit */ { shared_demux(idx, SHARED_RDWRITE); return(SHARED_INVALID); } key = shared_kbase + ((i + shared_get_hash(size, idx)) % shared_range); if (shared_debug) printf(" key=%d", key); h = shmget(key, shared_adjust_size(size), IPC_CREAT | IPC_EXCL | shared_create_mode); if (shared_debug) printf(" handle=%d", h); if (SHARED_INVALID == h) continue; /* segment already accupied */ bp = (BLKHEAD *)shmat(h, 0, 0); /* try attach */ if (shared_debug) printf(" p=%p", bp); if (((BLKHEAD *)SHARED_INVALID) == bp) /* cannot attach, delete segment, try with another key */ { shmctl(h, IPC_RMID, 0); continue; } /* now create semaphor counting number of processes attached */ if (SHARED_INVALID == (shared_gt[idx].sem = semget(key, 1, IPC_CREAT | IPC_EXCL | shared_create_mode))) { shmdt((void *)bp); /* cannot create segment, delete everything */ shmctl(h, IPC_RMID, 0); continue; /* try with another key */ } if (shared_debug) printf(" sem=%d", shared_gt[idx].sem); if (shared_attach_process(shared_gt[idx].sem)) /* try attach process */ { semctl(shared_gt[idx].sem, 0, IPC_RMID, filler); /* destroy semaphore */ shmdt((char *)bp); /* detach shared mem segment */ shmctl(h, IPC_RMID, 0); /* destroy shared mem segment */ continue; /* try with another key */ } bp->s.tflag = BLOCK_SHARED; /* fill in data in segment's header (this is really not necessary) */ bp->s.ID[0] = SHARED_ID_0; bp->s.ID[1] = SHARED_ID_1; bp->s.handle = idx; /* used in yorick */ if (mode & SHARED_RESIZE) { if (shmdt((char *)bp)) r = SHARED_IPCERR; /* if segment is resizable, then detach segment */ shared_lt[idx].p = NULL; } else { shared_lt[idx].p = bp; } shared_lt[idx].tcnt = 1; /* one thread using segment */ shared_lt[idx].lkcnt = 0; /* no locks at the moment */ shared_lt[idx].seekpos = 0L; /* r/w pointer positioned at beg of block */ shared_gt[idx].handle = h; /* fill in data in global table */ shared_gt[idx].size = size; shared_gt[idx].attr = mode; shared_gt[idx].semkey = key; shared_gt[idx].key = key; shared_gt[idx].nprocdebug = 0; break; } shared_demux(idx, SHARED_RDWRITE); /* hope this will not fail */ return(idx); } int shared_attach(int idx) { int r, r2; if (SHARED_OK != (r = shared_mux(idx, SHARED_RDWRITE | SHARED_WAIT))) return(r); if (SHARED_OK != (r = shared_map(idx))) { shared_demux(idx, SHARED_RDWRITE); return(r); } if (shared_attach_process(shared_gt[idx].sem)) /* try attach process */ { shmdt((char *)(shared_lt[idx].p)); /* cannot attach process, detach everything */ shared_lt[idx].p = NULL; shared_demux(idx, SHARED_RDWRITE); return(SHARED_BADARG); } shared_lt[idx].tcnt++; /* one more thread is using segment */ if (shared_gt[idx].attr & SHARED_RESIZE) /* if resizeable, detach and return special pointer */ { if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* if segment is resizable, then detach segment */ shared_lt[idx].p = NULL; } shared_lt[idx].seekpos = 0L; /* r/w pointer positioned at beg of block */ r2 = shared_demux(idx, SHARED_RDWRITE); return(r ? r : r2); } static int shared_check_locked_index(int idx) /* verify that given idx is valid */ { int r; if (0 == shared_init_called) /* delayed initialization */ { if (SHARED_OK != (r = shared_init(0))) return(r); } if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); if (NULL == shared_lt[idx].p) return(SHARED_BADARG); /* NULL pointer, not attached ?? */ if (0 == shared_lt[idx].lkcnt) return(SHARED_BADARG); /* not locked ?? */ if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag)) /* invalid data in segment */ return(SHARED_BADARG); return(SHARED_OK); } static int shared_map(int idx) /* map all tables for given idx, check for validity */ { int h; /* have to obtain excl. access before calling shared_map */ BLKHEAD *bp; if ((idx < 0) || (idx >= shared_maxseg)) return(SHARED_BADARG); if (SHARED_INVALID == shared_gt[idx].key) return(SHARED_BADARG); if (SHARED_INVALID == (h = shmget(shared_gt[idx].key, 1, shared_create_mode))) return(SHARED_BADARG); if (((BLKHEAD *)SHARED_INVALID) == (bp = (BLKHEAD *)shmat(h, 0, 0))) return(SHARED_BADARG); if ((SHARED_ID_0 != bp->s.ID[0]) || (SHARED_ID_1 != bp->s.ID[1]) || (BLOCK_SHARED != bp->s.tflag) || (h != shared_gt[idx].handle)) { shmdt((char *)bp); /* invalid segment, detach everything */ return(SHARED_BADARG); } if (shared_gt[idx].sem != semget(shared_gt[idx].semkey, 1, shared_create_mode)) /* check if sema is still there */ { shmdt((char *)bp); /* cannot attach semaphore, detach everything */ return(SHARED_BADARG); } shared_lt[idx].p = bp; /* store pointer to shmem data */ return(SHARED_OK); } static int shared_validate(int idx, int mode) /* use intrnally inside crit.sect !!! */ { int r; if (SHARED_OK != (r = shared_mux(idx, mode))) return(r); /* idx checked by shared_mux */ if (NULL == shared_lt[idx].p) if (SHARED_OK != (r = shared_map(idx))) { shared_demux(idx, mode); return(r); } if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag)) { shared_demux(idx, mode); return(r); } return(SHARED_OK); } SHARED_P shared_realloc(int idx, long newsize) /* realloc shared memory segment */ { int h, key, i, r; BLKHEAD *bp; long transfersize; r = SHARED_OK; if (newsize < 0) return(NULL); if (shared_check_locked_index(idx)) return(NULL); if (0 == (shared_gt[idx].attr & SHARED_RESIZE)) return(NULL); if (-1 != shared_lt[idx].lkcnt) return(NULL); /* check for RW lock */ if (shared_adjust_size(shared_gt[idx].size) == shared_adjust_size(newsize)) { shared_gt[idx].size = newsize; return((SHARED_P)((shared_lt[idx].p) + 1)); } for (i = 0; ; i++) { if (i >= shared_range) return(NULL); /* table full, signal error & exit */ key = shared_kbase + ((i + shared_get_hash(newsize, idx)) % shared_range); h = shmget(key, shared_adjust_size(newsize), IPC_CREAT | IPC_EXCL | shared_create_mode); if (SHARED_INVALID == h) continue; /* segment already accupied */ bp = (BLKHEAD *)shmat(h, 0, 0); /* try attach */ if (((BLKHEAD *)SHARED_INVALID) == bp) /* cannot attach, delete segment, try with another key */ { shmctl(h, IPC_RMID, 0); continue; } *bp = *(shared_lt[idx].p); /* copy header, then data */ transfersize = ((newsize < shared_gt[idx].size) ? newsize : shared_gt[idx].size); if (transfersize > 0) memcpy((void *)(bp + 1), (void *)((shared_lt[idx].p) + 1), transfersize); if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* try to detach old segment */ if (shmctl(shared_gt[idx].handle, IPC_RMID, 0)) if (SHARED_OK == r) r = SHARED_IPCERR; /* destroy old shared memory segment */ shared_gt[idx].size = newsize; /* signal new size */ shared_gt[idx].handle = h; /* signal new handle */ shared_gt[idx].key = key; /* signal new key */ shared_lt[idx].p = bp; break; } return((SHARED_P)(bp + 1)); } int shared_free(int idx) /* detach segment, if last process & !PERSIST, destroy segment */ { int cnt, r, r2; if (SHARED_OK != (r = shared_validate(idx, SHARED_RDWRITE | SHARED_WAIT))) return(r); if (SHARED_OK != (r = shared_detach_process(shared_gt[idx].sem))) /* update number of processes using segment */ { shared_demux(idx, SHARED_RDWRITE); return(r); } shared_lt[idx].tcnt--; /* update number of threads using segment */ if (shared_lt[idx].tcnt > 0) return(shared_demux(idx, SHARED_RDWRITE)); /* if more threads are using segment we are done */ if (shmdt((char *)(shared_lt[idx].p))) /* if, we are the last thread, try to detach segment */ { shared_demux(idx, SHARED_RDWRITE); return(SHARED_IPCERR); } shared_lt[idx].p = NULL; /* clear entry in local table */ shared_lt[idx].seekpos = 0L; /* r/w pointer positioned at beg of block */ if (-1 == (cnt = shared_process_count(shared_gt[idx].sem))) /* get number of processes hanging on segment */ { shared_demux(idx, SHARED_RDWRITE); return(SHARED_IPCERR); } if ((0 == cnt) && (0 == (shared_gt[idx].attr & SHARED_PERSIST))) r = shared_destroy_entry(idx); /* no procs on seg, destroy it */ r2 = shared_demux(idx, SHARED_RDWRITE); return(r ? r : r2); } SHARED_P shared_lock(int idx, int mode) /* lock given segment for exclusive access */ { int r; if (shared_mux(idx, mode)) return(NULL); /* idx checked by shared_mux */ if (0 != shared_lt[idx].lkcnt) /* are we already locked ?? */ if (SHARED_OK != (r = shared_map(idx))) { shared_demux(idx, mode); return(NULL); } if (NULL == shared_lt[idx].p) /* stupid pointer ?? */ if (SHARED_OK != (r = shared_map(idx))) { shared_demux(idx, mode); return(NULL); } if ((SHARED_ID_0 != (shared_lt[idx].p)->s.ID[0]) || (SHARED_ID_1 != (shared_lt[idx].p)->s.ID[1]) || (BLOCK_SHARED != (shared_lt[idx].p)->s.tflag)) { shared_demux(idx, mode); return(NULL); } if (mode & SHARED_RDWRITE) { shared_lt[idx].lkcnt = -1; shared_gt[idx].nprocdebug++; } else shared_lt[idx].lkcnt++; shared_lt[idx].seekpos = 0L; /* r/w pointer positioned at beg of block */ return((SHARED_P)((shared_lt[idx].p) + 1)); } int shared_unlock(int idx) /* unlock given segment, assumes seg is locked !! */ { int r, r2, mode; if (SHARED_OK != (r = shared_check_locked_index(idx))) return(r); if (shared_lt[idx].lkcnt > 0) { shared_lt[idx].lkcnt--; /* unlock read lock */ mode = SHARED_RDONLY; } else { shared_lt[idx].lkcnt = 0; /* unlock write lock */ shared_gt[idx].nprocdebug--; mode = SHARED_RDWRITE; } if (0 == shared_lt[idx].lkcnt) if (shared_gt[idx].attr & SHARED_RESIZE) { if (shmdt((char *)(shared_lt[idx].p))) r = SHARED_IPCERR; /* segment is resizable, then detach segment */ shared_lt[idx].p = NULL; /* signal detachment in local table */ } r2 = shared_demux(idx, mode); /* unlock segment, rest is only parameter checking */ return(r ? r : r2); } /* API routines - support and info routines */ int shared_attr(int idx) /* get the attributes of the shared memory segment */ { int r; if (shared_check_locked_index(idx)) return(SHARED_INVALID); r = shared_gt[idx].attr; return(r); } int shared_set_attr(int idx, int newattr) /* get the attributes of the shared memory segment */ { int r; if (shared_check_locked_index(idx)) return(SHARED_INVALID); if (-1 != shared_lt[idx].lkcnt) return(SHARED_INVALID); /* ADDED - check for RW lock */ r = shared_gt[idx].attr; shared_gt[idx].attr = newattr; return(r); } int shared_set_debug(int mode) /* set/reset debug mode */ { int r = shared_debug; shared_debug = mode; return(r); } int shared_set_createmode(int mode) /* set/reset debug mode */ { int r = shared_create_mode; shared_create_mode = mode; return(r); } int shared_list(int id) { int i, r; if (NULL == shared_gt) return(SHARED_NOTINIT); /* not initialized */ if (NULL == shared_lt) return(SHARED_NOTINIT); /* not initialized */ if (shared_debug) printf("shared_list:"); r = SHARED_OK; printf(" Idx Key Nproc Size Flags\n"); printf("==============================================\n"); for (i=0; i= SHARED_ERRBASE) { printf(" cannot clear PERSIST attribute"); } if (shared_free(i)) { printf(" delete failed\n"); } else { printf(" deleted\n"); } } if (shared_debug) printf(" done\n"); return(r); /* table full */ } /************************* CFITSIO DRIVER FUNCTIONS ***************************/ int smem_init(void) { return(0); } int smem_shutdown(void) { if (shared_init_called) shared_cleanup(); return(0); } int smem_setoptions(int option) { option = 0; return(0); } int smem_getoptions(int *options) { if (NULL == options) return(SHARED_NULPTR); *options = 0; return(0); } int smem_getversion(int *version) { if (NULL == version) return(SHARED_NULPTR); *version = 10; return(0); } int smem_open(char *filename, int rwmode, int *driverhandle) { int h, nitems, r; DAL_SHM_SEGHEAD *sp; if (NULL == filename) return(SHARED_NULPTR); if (NULL == driverhandle) return(SHARED_NULPTR); nitems = sscanf(filename, "h%d", &h); if (1 != nitems) return(SHARED_BADARG); if (SHARED_OK != (r = shared_attach(h))) return(r); if (NULL == (sp = (DAL_SHM_SEGHEAD *)shared_lock(h, ((READWRITE == rwmode) ? SHARED_RDWRITE : SHARED_RDONLY)))) { shared_free(h); return(SHARED_BADARG); } if ((h != sp->h) || (DAL_SHM_SEGHEAD_ID != sp->ID)) { shared_unlock(h); shared_free(h); return(SHARED_BADARG); } *driverhandle = h; return(0); } int smem_create(char *filename, int *driverhandle) { DAL_SHM_SEGHEAD *sp; int h, sz, nitems; if (NULL == filename) return(SHARED_NULPTR); /* currently ignored */ if (NULL == driverhandle) return(SHARED_NULPTR); nitems = sscanf(filename, "h%d", &h); if (1 != nitems) return(SHARED_BADARG); if (SHARED_INVALID == (h = shared_malloc(sz = 2880 + sizeof(DAL_SHM_SEGHEAD), SHARED_RESIZE | SHARED_PERSIST, h))) return(SHARED_NOMEM); if (NULL == (sp = (DAL_SHM_SEGHEAD *)shared_lock(h, SHARED_RDWRITE))) { shared_free(h); return(SHARED_BADARG); } sp->ID = DAL_SHM_SEGHEAD_ID; sp->h = h; sp->size = sz; sp->nodeidx = -1; *driverhandle = h; return(0); } int smem_close(int driverhandle) { int r; if (SHARED_OK != (r = shared_unlock(driverhandle))) return(r); return(shared_free(driverhandle)); } int smem_remove(char *filename) { int nitems, h, r; if (NULL == filename) return(SHARED_NULPTR); nitems = sscanf(filename, "h%d", &h); if (1 != nitems) return(SHARED_BADARG); if (0 == shared_check_locked_index(h)) /* are we locked ? */ { if (-1 != shared_lt[h].lkcnt) /* are we locked RO ? */ { if (SHARED_OK != (r = shared_unlock(h))) return(r); /* yes, so relock in RW */ if (NULL == shared_lock(h, SHARED_RDWRITE)) return(SHARED_BADARG); } } else /* not locked */ { if (SHARED_OK != (r = smem_open(filename, READWRITE, &h))) return(r); /* so open in RW mode */ } shared_set_attr(h, SHARED_RESIZE); /* delete PERSIST attribute */ return(smem_close(h)); /* detach segment (this will delete it) */ } int smem_size(int driverhandle, LONGLONG *size) { if (NULL == size) return(SHARED_NULPTR); if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); *size = (LONGLONG) (shared_gt[driverhandle].size - sizeof(DAL_SHM_SEGHEAD)); return(0); } int smem_flush(int driverhandle) { if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); return(0); } int smem_seek(int driverhandle, LONGLONG offset) { if (offset < 0) return(SHARED_BADARG); if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); shared_lt[driverhandle].seekpos = offset; return(0); } int smem_read(int driverhandle, void *buffer, long nbytes) { if (NULL == buffer) return(SHARED_NULPTR); if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); if (nbytes < 0) return(SHARED_BADARG); if ((shared_lt[driverhandle].seekpos + nbytes) > shared_gt[driverhandle].size) return(SHARED_BADARG); /* read beyond EOF */ memcpy(buffer, ((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[driverhandle].p + 1)) + 1)) + shared_lt[driverhandle].seekpos, nbytes); shared_lt[driverhandle].seekpos += nbytes; return(0); } int smem_write(int driverhandle, void *buffer, long nbytes) { if (NULL == buffer) return(SHARED_NULPTR); if (shared_check_locked_index(driverhandle)) return(SHARED_INVALID); if (-1 != shared_lt[driverhandle].lkcnt) return(SHARED_INVALID); /* are we locked RW ? */ if (nbytes < 0) return(SHARED_BADARG); if ((unsigned long)(shared_lt[driverhandle].seekpos + nbytes) > (unsigned long)(shared_gt[driverhandle].size - sizeof(DAL_SHM_SEGHEAD))) { /* need to realloc shmem */ if (NULL == shared_realloc(driverhandle, shared_lt[driverhandle].seekpos + nbytes + sizeof(DAL_SHM_SEGHEAD))) return(SHARED_NOMEM); } memcpy(((char *)(((DAL_SHM_SEGHEAD *)(shared_lt[driverhandle].p + 1)) + 1)) + shared_lt[driverhandle].seekpos, buffer, nbytes); shared_lt[driverhandle].seekpos += nbytes; return(0); } #endif astropy-0.3/cextern/cfitsio/region.h0000644000175000017500000000415512243255342015750 0ustar oleole/***************************************************************/ /* REGION STUFF */ /***************************************************************/ #include "fitsio.h" #define myPI 3.1415926535897932385 #define RadToDeg 180.0/myPI typedef struct { int exists; double xrefval, yrefval; double xrefpix, yrefpix; double xinc, yinc; double rot; char type[6]; } WCSdata; typedef enum { point_rgn, line_rgn, circle_rgn, annulus_rgn, ellipse_rgn, elliptannulus_rgn, box_rgn, boxannulus_rgn, rectangle_rgn, diamond_rgn, sector_rgn, poly_rgn, panda_rgn, epanda_rgn, bpanda_rgn } shapeType; typedef enum { pixel_fmt, degree_fmt, hhmmss_fmt } coordFmt; typedef struct { char sign; /* Include or exclude? */ shapeType shape; /* Shape of this region */ int comp; /* Component number for this region */ double xmin,xmax; /* bounding box */ double ymin,ymax; union { /* Parameters - In pixels */ /**** Generic Shape Data ****/ struct { double p[11]; /* Region parameters */ double sinT, cosT; /* For rotated shapes */ double a, b; /* Extra scratch area */ } gen; /**** Polygon Data ****/ struct { int nPts; /* Number of Polygon pts */ double *Pts; /* Polygon points */ } poly; } param; } RgnShape; typedef struct { int nShapes; RgnShape *Shapes; WCSdata wcs; } SAORegion; /* SAO region file routines */ int fits_read_rgnfile( const char *filename, WCSdata *wcs, SAORegion **Rgn, int *status ); int fits_in_region( double X, double Y, SAORegion *Rgn ); void fits_free_region( SAORegion *Rgn ); void fits_set_region_components ( SAORegion *Rgn ); void fits_setup_shape ( RgnShape *shape); int fits_read_fits_region ( fitsfile *fptr, WCSdata * wcs, SAORegion **Rgn, int *status); int fits_read_ascii_region ( const char *filename, WCSdata * wcs, SAORegion **Rgn, int *status); astropy-0.3/cextern/cfitsio/inflate.c0000644000175000017500000014661712243255342016114 0ustar oleole/* inflate.c -- zlib decompression * Copyright (C) 1995-2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * Change history: * * 1.2.beta0 24 Nov 2002 * - First version -- complete rewrite of inflate to simplify code, avoid * creation of window when not needed, minimize use of window when it is * needed, make inffast.c even faster, implement gzip decoding, and to * improve code readability and style over the previous zlib inflate code * * 1.2.beta1 25 Nov 2002 * - Use pointers for available input and output checking in inffast.c * - Remove input and output counters in inffast.c * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 * - Remove unnecessary second byte pull from length extra in inffast.c * - Unroll direct copy to three copies per loop in inffast.c * * 1.2.beta2 4 Dec 2002 * - Change external routine names to reduce potential conflicts * - Correct filename to inffixed.h for fixed tables in inflate.c * - Make hbuf[] unsigned char to match parameter type in inflate.c * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) * to avoid negation problem on Alphas (64 bit) in inflate.c * * 1.2.beta3 22 Dec 2002 * - Add comments on state->bits assertion in inffast.c * - Add comments on op field in inftrees.h * - Fix bug in reuse of allocated window after inflateReset() * - Remove bit fields--back to byte structure for speed * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths * - Change post-increments to pre-increments in inflate_fast(), PPC biased? * - Add compile time option, POSTINC, to use post-increments instead (Intel?) * - Make MATCH copy in inflate() much faster for when inflate_fast() not used * - Use local copies of stream next and avail values, as well as local bit * buffer and bit count in inflate()--for speed when inflate_fast() not used * * 1.2.beta4 1 Jan 2003 * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings * - Move a comment on output buffer sizes from inffast.c to inflate.c * - Add comments in inffast.c to introduce the inflate_fast() routine * - Rearrange window copies in inflate_fast() for speed and simplification * - Unroll last copy for window match in inflate_fast() * - Use local copies of window variables in inflate_fast() for speed * - Pull out common wnext == 0 case for speed in inflate_fast() * - Make op and len in inflate_fast() unsigned for consistency * - Add FAR to lcode and dcode declarations in inflate_fast() * - Simplified bad distance check in inflate_fast() * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new * source file infback.c to provide a call-back interface to inflate for * programs like gzip and unzip -- uses window as output buffer to avoid * window copying * * 1.2.beta5 1 Jan 2003 * - Improved inflateBack() interface to allow the caller to provide initial * input in strm. * - Fixed stored blocks bug in inflateBack() * * 1.2.beta6 4 Jan 2003 * - Added comments in inffast.c on effectiveness of POSTINC * - Typecasting all around to reduce compiler warnings * - Changed loops from while (1) or do {} while (1) to for (;;), again to * make compilers happy * - Changed type of window in inflateBackInit() to unsigned char * * * 1.2.beta7 27 Jan 2003 * - Changed many types to unsigned or unsigned short to avoid warnings * - Added inflateCopy() function * * 1.2.0 9 Mar 2003 * - Changed inflateBack() interface to provide separate opaque descriptors * for the in() and out() functions * - Changed inflateBack() argument and in_func typedef to swap the length * and buffer address return values for the input function * - Check next_in and next_out for Z_NULL on entry to inflate() * * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ #include "zutil.h" #include "inftrees.h" #include "inflate.h" #include "inffast.h" #ifdef MAKEFIXED # ifndef BUILDFIXED # define BUILDFIXED # endif #endif /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); local int updatewindow OF((z_streamp strm, unsigned out)); #ifdef BUILDFIXED void makefixed OF((void)); #endif local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateReset(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; strm->total_in = strm->total_out = state->total = 0; strm->msg = Z_NULL; strm->adler = 1; /* to support ill-conceived Java test suite */ state->mode = HEAD; state->last = 0; state->havedict = 0; state->dmax = 32768U; state->head = Z_NULL; state->wsize = 0; state->whave = 0; state->wnext = 0; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; state->sane = 1; state->back = -1; Tracev((stderr, "inflate: reset\n")); return Z_OK; } int ZEXPORT inflateReset2(strm, windowBits) z_streamp strm; int windowBits; { int wrap; struct inflate_state FAR *state; /* get the state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; #ifdef GUNZIP if (windowBits < 48) windowBits &= 15; #endif } /* set number of window bits, free window if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) return Z_STREAM_ERROR; if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { ZFREE(strm, state->window); state->window = Z_NULL; } /* update state and reset the rest of it */ state->wrap = wrap; state->wbits = (unsigned)windowBits; return inflateReset(strm); } int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) z_streamp strm; int windowBits; const char *version; int stream_size; { int ret; struct inflate_state FAR *state; if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != (int)(sizeof(z_stream))) return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state FAR *) ZALLOC(strm, 1, sizeof(struct inflate_state)); if (state == Z_NULL) return Z_MEM_ERROR; Tracev((stderr, "inflate: allocated\n")); strm->state = (struct internal_state FAR *)state; state->window = Z_NULL; ret = inflateReset2(strm, windowBits); if (ret != Z_OK) { ZFREE(strm, state); strm->state = Z_NULL; } return ret; } int ZEXPORT inflateInit_(strm, version, stream_size) z_streamp strm; const char *version; int stream_size; { return inflateInit2_(strm, DEF_WBITS, version, stream_size); } int ZEXPORT inflatePrime(strm, bits, value) z_streamp strm; int bits; int value; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (bits < 0) { state->hold = 0; state->bits = 0; return Z_OK; } if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; state->hold += value << state->bits; state->bits += bits; return Z_OK; } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ local void fixedtables(state) struct inflate_state FAR *state; { #ifdef BUILDFIXED static int virgin = 1; static code *lenfix, *distfix; static code fixed[544]; /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { unsigned sym, bits; static code *next; /* literal/length table */ sym = 0; while (sym < 144) state->lens[sym++] = 8; while (sym < 256) state->lens[sym++] = 9; while (sym < 280) state->lens[sym++] = 7; while (sym < 288) state->lens[sym++] = 8; next = fixed; lenfix = next; bits = 9; inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); /* distance table */ sym = 0; while (sym < 32) state->lens[sym++] = 5; distfix = next; bits = 5; inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); /* do this just once */ virgin = 0; } #else /* !BUILDFIXED */ # include "inffixed.h" #endif /* BUILDFIXED */ state->lencode = lenfix; state->lenbits = 9; state->distcode = distfix; state->distbits = 5; } #ifdef MAKEFIXED #include /* Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also defines BUILDFIXED, so the tables are built on the fly. makefixed() writes those tables to stdout, which would be piped to inffixed.h. A small program can simply call makefixed to do this: void makefixed(void); int main(void) { makefixed(); return 0; } Then that can be linked with zlib built with MAKEFIXED defined and run: a.out > inffixed.h */ void makefixed() { unsigned low, size; struct inflate_state state; fixedtables(&state); puts(" /* inffixed.h -- table for decoding fixed codes"); puts(" * Generated automatically by makefixed()."); puts(" */"); puts(""); puts(" /* WARNING: this file should *not* be used by applications."); puts(" It is part of the implementation of this library and is"); puts(" subject to change. Applications should only use zlib.h."); puts(" */"); puts(""); size = 1U << 9; printf(" static const code lenfix[%u] = {", size); low = 0; for (;;) { if ((low % 7) == 0) printf("\n "); printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, state.lencode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); size = 1U << 5; printf("\n static const code distfix[%u] = {", size); low = 0; for (;;) { if ((low % 6) == 0) printf("\n "); printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, state.distcode[low].val); if (++low == size) break; putchar(','); } puts("\n };"); } #endif /* MAKEFIXED */ /* Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ local int updatewindow(strm, out) z_streamp strm; unsigned out; { struct inflate_state FAR *state; unsigned copy, dist; state = (struct inflate_state FAR *)strm->state; /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { state->window = (unsigned char FAR *) ZALLOC(strm, 1U << state->wbits, sizeof(unsigned char)); if (state->window == Z_NULL) return 1; } /* if window not in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U << state->wbits; state->wnext = 0; state->whave = 0; } /* copy state->wsize or less output bytes into the circular window */ copy = out - strm->avail_out; if (copy >= state->wsize) { zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); state->wnext = 0; state->whave = state->wsize; } else { dist = state->wsize - state->wnext; if (dist > copy) dist = copy; zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, strm->next_out - copy, copy); state->wnext = copy; state->whave = state->wsize; } else { state->wnext += dist; if (state->wnext == state->wsize) state->wnext = 0; if (state->whave < state->wsize) state->whave += dist; } } return 0; } /* Macros for inflate(): */ /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP # define UPDATE(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else # define UPDATE(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ #ifdef GUNZIP # define CRC2(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ check = crc32(check, hbuf, 2); \ } while (0) # define CRC4(check, word) \ do { \ hbuf[0] = (unsigned char)(word); \ hbuf[1] = (unsigned char)((word) >> 8); \ hbuf[2] = (unsigned char)((word) >> 16); \ hbuf[3] = (unsigned char)((word) >> 24); \ check = crc32(check, hbuf, 4); \ } while (0) #endif /* Load registers with state in inflate() for speed */ #define LOAD() \ do { \ put = strm->next_out; \ left = strm->avail_out; \ next = strm->next_in; \ have = strm->avail_in; \ hold = state->hold; \ bits = state->bits; \ } while (0) /* Restore state from registers in inflate() */ #define RESTORE() \ do { \ strm->next_out = put; \ strm->avail_out = left; \ strm->next_in = next; \ strm->avail_in = have; \ state->hold = hold; \ state->bits = bits; \ } while (0) /* Clear the input bit accumulator */ #define INITBITS() \ do { \ hold = 0; \ bits = 0; \ } while (0) /* Get a byte of input into the bit accumulator, or return from inflate() if there is no input available. */ #define PULLBYTE() \ do { \ if (have == 0) goto inf_leave; \ have--; \ hold += (unsigned long)(*next++) << bits; \ bits += 8; \ } while (0) /* Assure that there are at least n bits in the bit accumulator. If there is not enough available input to do that, then return from inflate(). */ #define NEEDBITS(n) \ do { \ while (bits < (unsigned)(n)) \ PULLBYTE(); \ } while (0) /* Return the low n bits of the bit accumulator (n < 16) */ #define BITS(n) \ ((unsigned)hold & ((1U << (n)) - 1)) /* Remove n bits from the bit accumulator */ #define DROPBITS(n) \ do { \ hold >>= (n); \ bits -= (unsigned)(n); \ } while (0) /* Remove zero to seven bits as needed to go to a byte boundary */ #define BYTEBITS() \ do { \ hold >>= bits & 7; \ bits -= bits & 7; \ } while (0) /* Reverse the bytes in a 32-bit value */ #define REVERSE(q) \ ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) /* inflate() uses a state machine to process as much input data and generate as much output data as possible before returning. The state machine is structured roughly as follows: for (;;) switch (state) { ... case STATEn: if (not enough input data or output space to make progress) return; ... make progress ... state = STATEm; break; ... } so when inflate() is called again, the same case is attempted again, and if the appropriate resources are provided, the machine proceeds to the next state. The NEEDBITS() macro is usually the way the state evaluates whether it can proceed or should return. NEEDBITS() does the return if the requested bits are not available. The typical use of the BITS macros is: NEEDBITS(n); ... do something with BITS(n) ... DROPBITS(n); where NEEDBITS(n) either returns from inflate() if there isn't enough input left to load n bits into the accumulator, or it continues. BITS(n) gives the low n bits in the accumulator. When done, DROPBITS(n) drops the low n bits off the accumulator. INITBITS() clears the accumulator and sets the number of available bits to zero. BYTEBITS() discards just enough bits to put the accumulator on a byte boundary. After BYTEBITS() and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return if there is no input available. The decoding of variable length codes uses PULLBYTE() directly in order to pull just enough bytes to decode the next code, and no more. Some states loop until they get enough input, making sure that enough state information is maintained to continue the loop where it left off if NEEDBITS() returns in the loop. For example, want, need, and keep would all have to actually be part of the saved state in case NEEDBITS() returns: case STATEw: while (want < need) { NEEDBITS(n); keep[want++] = BITS(n); DROPBITS(n); } state = STATEx; case STATEx: As shown above, if the next state is also the next case, then the break is omitted. A state may also return if there is not enough output space available to complete that state. Those states are copying stored data, writing a literal byte, and copying a matching string. When returning, a "goto inf_leave" is used to update the total counters, update the check value, and determine whether any progress has been made during that inflate() call in order to return the proper return code. Progress is defined as a change in either strm->avail_in or strm->avail_out. When there is a window, goto inf_leave will update the window with the last output written. If a goto inf_leave occurs in the middle of decompression and there is no window currently, goto inf_leave will create one and copy output to the window for the next call of inflate(). In this implementation, the flush parameter of inflate() only affects the return code (per zlib.h). inflate() always writes as much as possible to strm->next_out, given the space available and the provided input--the effect documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers the allocation of and copying into a sliding window until necessary, which provides the effect documented in zlib.h for Z_FINISH when the entire input stream available. So the only thing the flush parameter actually does is: when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it will return Z_BUF_ERROR if it has not reached the end of the stream. */ int ZEXPORT inflate(strm, flush) z_streamp strm; int flush; { struct inflate_state FAR *state; unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned in, out; /* save starting available input and output */ unsigned copy; /* number of stored or match bytes to copy */ unsigned char FAR *from; /* where to copy match bytes from */ code here; /* current decoding table entry */ code last; /* parent table entry */ unsigned len; /* length to copy for repeats, bits to drop */ int ret; /* return code */ #ifdef GUNZIP unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ #endif static const unsigned short order[19] = /* permutation of code lengths */ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0)) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ LOAD(); in = have; out = left; ret = Z_OK; for (;;) switch (state->mode) { case HEAD: if (state->wrap == 0) { state->mode = TYPEDO; break; } NEEDBITS(16); #ifdef GUNZIP if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ state->check = crc32(0L, Z_NULL, 0); CRC2(state->check, hold); INITBITS(); state->mode = FLAGS; break; } state->flags = 0; /* expect zlib header */ if (state->head != Z_NULL) state->head->done = -1; if (!(state->wrap & 1) || /* check if zlib header allowed */ #else if ( #endif ((BITS(8) << 8) + (hold >> 8)) % 31) { strm->msg = (char *)"incorrect header check"; state->mode = BAD; break; } if (BITS(4) != Z_DEFLATED) { strm->msg = (char *)"unknown compression method"; state->mode = BAD; break; } DROPBITS(4); len = BITS(4) + 8; if (state->wbits == 0) state->wbits = len; else if (len > state->wbits) { strm->msg = (char *)"invalid window size"; state->mode = BAD; break; } state->dmax = 1U << len; Tracev((stderr, "inflate: zlib header ok\n")); strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = hold & 0x200 ? DICTID : TYPE; INITBITS(); break; #ifdef GUNZIP case FLAGS: NEEDBITS(16); state->flags = (int)(hold); if ((state->flags & 0xff) != Z_DEFLATED) { strm->msg = (char *)"unknown compression method"; state->mode = BAD; break; } if (state->flags & 0xe000) { strm->msg = (char *)"unknown header flags set"; state->mode = BAD; break; } if (state->head != Z_NULL) state->head->text = (int)((hold >> 8) & 1); if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = TIME; case TIME: NEEDBITS(32); if (state->head != Z_NULL) state->head->time = hold; if (state->flags & 0x0200) CRC4(state->check, hold); INITBITS(); state->mode = OS; case OS: NEEDBITS(16); if (state->head != Z_NULL) { state->head->xflags = (int)(hold & 0xff); state->head->os = (int)(hold >> 8); } if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); state->length = (unsigned)(hold); if (state->head != Z_NULL) state->head->extra_len = (unsigned)hold; if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); } else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; case EXTRA: if (state->flags & 0x0400) { copy = state->length; if (copy > have) copy = have; if (copy) { if (state->head != Z_NULL && state->head->extra != Z_NULL) { len = state->head->extra_len - state->length; zmemcpy(state->head->extra + len, next, len + copy > state->head->extra_max ? state->head->extra_max - len : copy); } if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; state->length -= copy; } if (state->length) goto inf_leave; } state->length = 0; state->mode = NAME; case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max) state->head->name[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; copy = 0; do { len = (unsigned)(next[copy++]); if (state->head != Z_NULL && state->head->comment != Z_NULL && state->length < state->head->comm_max) state->head->comment[state->length++] = len; } while (len && copy < have); if (state->flags & 0x0200) state->check = crc32(state->check, next, copy); have -= copy; next += copy; if (len) goto inf_leave; } else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); if (hold != (state->check & 0xffff)) { strm->msg = (char *)"header crc mismatch"; state->mode = BAD; break; } INITBITS(); } if (state->head != Z_NULL) { state->head->hcrc = (int)((state->flags >> 9) & 1); state->head->done = 1; } strm->adler = state->check = crc32(0L, Z_NULL, 0); state->mode = TYPE; break; #endif case DICTID: NEEDBITS(32); strm->adler = state->check = REVERSE(hold); INITBITS(); state->mode = DICT; case DICT: if (state->havedict == 0) { RESTORE(); return Z_NEED_DICT; } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; case TYPE: if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; case TYPEDO: if (state->last) { BYTEBITS(); state->mode = CHECK; break; } NEEDBITS(3); state->last = BITS(1); DROPBITS(1); switch (BITS(2)) { case 0: /* stored block */ Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); state->mode = STORED; break; case 1: /* fixed block */ fixedtables(state); Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); state->mode = LEN_; /* decode codes */ if (flush == Z_TREES) { DROPBITS(2); goto inf_leave; } break; case 2: /* dynamic block */ Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); state->mode = TABLE; break; case 3: strm->msg = (char *)"invalid block type"; state->mode = BAD; } DROPBITS(2); break; case STORED: BYTEBITS(); /* go to byte boundary */ NEEDBITS(32); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = (char *)"invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; Tracev((stderr, "inflate: stored length %u\n", state->length)); INITBITS(); state->mode = COPY_; if (flush == Z_TREES) goto inf_leave; case COPY_: state->mode = COPY; case COPY: copy = state->length; if (copy) { if (copy > have) copy = have; if (copy > left) copy = left; if (copy == 0) goto inf_leave; zmemcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; break; } Tracev((stderr, "inflate: stored end\n")); state->mode = TYPE; break; case TABLE: NEEDBITS(14); state->nlen = BITS(5) + 257; DROPBITS(5); state->ndist = BITS(5) + 1; DROPBITS(5); state->ncode = BITS(4) + 4; DROPBITS(4); #ifndef PKZIP_BUG_WORKAROUND if (state->nlen > 286 || state->ndist > 30) { strm->msg = (char *)"too many length or distance symbols"; state->mode = BAD; break; } #endif Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); state->lens[order[state->have++]] = (unsigned short)BITS(3); DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; state->mode = BAD; break; } Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.val < 16) { NEEDBITS(here.bits); DROPBITS(here.bits); state->lens[state->have++] = here.val; } else { if (here.val == 16) { NEEDBITS(here.bits + 2); DROPBITS(here.bits); if (state->have == 0) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } len = state->lens[state->have - 1]; copy = 3 + BITS(2); DROPBITS(2); } else if (here.val == 17) { NEEDBITS(here.bits + 3); DROPBITS(here.bits); len = 0; copy = 3 + BITS(3); DROPBITS(3); } else { NEEDBITS(here.bits + 7); DROPBITS(here.bits); len = 0; copy = 11 + BITS(7); DROPBITS(7); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } /* handle error breaks in while */ if (state->mode == BAD) break; /* check for end-of-block code (better have one) */ if (state->lens[256] == 0) { strm->msg = (char *)"invalid code -- missing end-of-block"; state->mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; state->lencode = (code const FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; state->mode = BAD; break; } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN_; if (flush == Z_TREES) goto inf_leave; case LEN_: state->mode = LEN; case LEN: if (have >= 6 && left >= 258) { RESTORE(); inflate_fast(strm, out); LOAD(); if (state->mode == TYPE) state->back = -1; break; } state->back = 0; for (;;) { here = state->lencode[BITS(state->lenbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if (here.op && (here.op & 0xf0) == 0) { last = here; for (;;) { here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); state->back += last.bits; } DROPBITS(here.bits); state->back += here.bits; state->length = (unsigned)here.val; if ((int)(here.op) == 0) { Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); state->mode = LIT; break; } if (here.op & 32) { Tracevv((stderr, "inflate: end of block\n")); state->back = -1; state->mode = TYPE; break; } if (here.op & 64) { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } state->extra = (unsigned)(here.op) & 15; state->mode = LENEXT; case LENEXT: if (state->extra) { NEEDBITS(state->extra); state->length += BITS(state->extra); DROPBITS(state->extra); state->back += state->extra; } Tracevv((stderr, "inflate: length %u\n", state->length)); state->was = state->length; state->mode = DIST; case DIST: for (;;) { here = state->distcode[BITS(state->distbits)]; if ((unsigned)(here.bits) <= bits) break; PULLBYTE(); } if ((here.op & 0xf0) == 0) { last = here; for (;;) { here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; PULLBYTE(); } DROPBITS(last.bits); state->back += last.bits; } DROPBITS(here.bits); state->back += here.bits; if (here.op & 64) { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; state->mode = DISTEXT; case DISTEXT: if (state->extra) { NEEDBITS(state->extra); state->offset += BITS(state->extra); DROPBITS(state->extra); state->back += state->extra; } #ifdef INFLATE_STRICT if (state->offset > state->dmax) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #endif Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; case MATCH: if (left == 0) goto inf_leave; copy = out - left; if (state->offset > copy) { /* copy from window */ copy = state->offset - copy; if (copy > state->whave) { if (state->sane) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; } #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR Trace((stderr, "inflate.c too far\n")); copy -= state->whave; if (copy > state->length) copy = state->length; if (copy > left) copy = left; left -= copy; state->length -= copy; do { *put++ = 0; } while (--copy); if (state->length == 0) state->mode = LEN; break; #endif } if (copy > state->wnext) { copy -= state->wnext; from = state->window + (state->wsize - copy); } else from = state->window + (state->wnext - copy); if (copy > state->length) copy = state->length; } else { /* copy from output */ from = put - state->offset; copy = state->length; } if (copy > left) copy = left; left -= copy; state->length -= copy; do { *put++ = *from++; } while (--copy); if (state->length == 0) state->mode = LEN; break; case LIT: if (left == 0) goto inf_leave; *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; case CHECK: if (state->wrap) { NEEDBITS(32); out -= left; strm->total_out += out; state->total += out; if (out) strm->adler = state->check = UPDATE(state->check, put - out, out); out = left; if (( #ifdef GUNZIP state->flags ? hold : #endif REVERSE(hold)) != state->check) { strm->msg = (char *)"incorrect data check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: check matches trailer\n")); } #ifdef GUNZIP state->mode = LENGTH; case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); if (hold != (state->total & 0xffffffffUL)) { strm->msg = (char *)"incorrect length check"; state->mode = BAD; break; } INITBITS(); Tracev((stderr, "inflate: length matches trailer\n")); } #endif state->mode = DONE; case DONE: ret = Z_STREAM_END; goto inf_leave; case BAD: ret = Z_DATA_ERROR; goto inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: default: return Z_STREAM_ERROR; } /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the window state. Note: a memory error from inflate() is non-recoverable. */ inf_leave: RESTORE(); if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) if (updatewindow(strm, out)) { state->mode = MEM; return Z_MEM_ERROR; } in -= strm->avail_in; out -= strm->avail_out; strm->total_in += in; strm->total_out += out; state->total += out; if (state->wrap && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); strm->data_type = state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ret = Z_BUF_ERROR; return ret; } int ZEXPORT inflateEnd(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->window != Z_NULL) ZFREE(strm, state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; unsigned long id; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (state->wrap != 0 && state->mode != DICT) return Z_STREAM_ERROR; /* check for correct dictionary id */ if (state->mode == DICT) { id = adler32(0L, Z_NULL, 0); id = adler32(id, dictionary, dictLength); if (id != state->check) return Z_DATA_ERROR; } /* copy dictionary to window */ if (updatewindow(strm, strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } if (dictLength > state->wsize) { zmemcpy(state->window, dictionary + dictLength - state->wsize, state->wsize); state->whave = state->wsize; } else { zmemcpy(state->window + state->wsize - dictLength, dictionary, dictLength); state->whave = dictLength; } state->havedict = 1; Tracev((stderr, "inflate: dictionary set\n")); return Z_OK; } int ZEXPORT inflateGetHeader(strm, head) z_streamp strm; gz_headerp head; { struct inflate_state FAR *state; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; /* save header structure */ state->head = head; head->done = 0; return Z_OK; } /* Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found or when out of input. When called, *have is the number of pattern bytes found in order so far, in 0..3. On return *have is updated to the new state. If on return *have equals four, then the pattern was found and the return value is how many bytes were read including the last byte of the pattern. If *have is less than four, then the pattern has not been found yet and the return value is len. In the latter case, syncsearch() can be called again with more data and the *have state. *have is initialized to zero for the first call. */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; unsigned char FAR *buf; unsigned len; { unsigned got; unsigned next; got = *have; next = 0; while (next < len && got < 4) { if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) got++; else if (buf[next]) got = 0; else got = 4 - got; next++; } *have = got; return next; } int ZEXPORT inflateSync(strm) z_streamp strm; { unsigned len; /* number of bytes to look at or looked at */ unsigned long in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; /* check parameters */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; state->hold <<= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { buf[len++] = (unsigned char)(state->hold); state->hold >>= 8; state->bits -= 8; } state->have = 0; syncsearch(&(state->have), buf, len); } /* search available input */ len = syncsearch(&(state->have), strm->next_in, strm->avail_in); strm->avail_in -= len; strm->next_in += len; strm->total_in += len; /* return no joy or set up to restart inflate() on a new block */ if (state->have != 4) return Z_DATA_ERROR; in = strm->total_in; out = strm->total_out; inflateReset(strm); strm->total_in = in; strm->total_out = out; state->mode = TYPE; return Z_OK; } /* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ int ZEXPORT inflateSyncPoint(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; } int ZEXPORT inflateCopy(dest, source) z_streamp dest; z_streamp source; { struct inflate_state FAR *state; struct inflate_state FAR *copy; unsigned char FAR *window; unsigned wsize; /* check input */ if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)source->state; /* allocate space */ copy = (struct inflate_state FAR *) ZALLOC(source, 1, sizeof(struct inflate_state)); if (copy == Z_NULL) return Z_MEM_ERROR; window = Z_NULL; if (state->window != Z_NULL) { window = (unsigned char FAR *) ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); if (window == Z_NULL) { ZFREE(source, copy); return Z_MEM_ERROR; } } /* copy state */ zmemcpy(dest, source, sizeof(z_stream)); zmemcpy(copy, state, sizeof(struct inflate_state)); if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { copy->lencode = copy->codes + (state->lencode - state->codes); copy->distcode = copy->codes + (state->distcode - state->codes); } copy->next = copy->codes + (state->next - state->codes); if (window != Z_NULL) { wsize = 1U << state->wbits; zmemcpy(window, state->window, wsize); } copy->window = window; dest->state = (struct internal_state FAR *)copy; return Z_OK; } int ZEXPORT inflateUndermine(strm, subvert) z_streamp strm; int subvert; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; state->sane = !subvert; #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR return Z_OK; #else state->sane = 1; return Z_DATA_ERROR; #endif } long ZEXPORT inflateMark(strm) z_streamp strm; { struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : (state->mode == MATCH ? state->was - state->length : 0)); } astropy-0.3/cextern/cfitsio/putcoluj.c0000644000175000017500000010316112243255342016322 0ustar oleole/* This file, putcoluj.c, contains routines that write data elements to */ /* a FITS image or table, with unsigned long datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffppruj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned long *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; unsigned long nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TULONG, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcluj(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnuj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned long *array, /* I - array of values that are written */ unsigned long nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; unsigned long nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TULONG, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnuj(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2duj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ unsigned long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3duj(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3duj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ unsigned long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TULONG, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcluj(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcluj(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssuj(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ unsigned long *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TULONG, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcluj(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpuj( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ unsigned long *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcluj(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcluj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned long *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem, hdutype; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TLONG): ffu4fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TLONGLONG): ffu4fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffu4fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffu4fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TFLOAT): ffu4fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TDOUBLE): ffu4fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffu4fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcluj).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnuj( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ unsigned long *array, /* I - array of values to write */ unsigned long nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcluj(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (ffpclu(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcluj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcluj(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpclu(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fi1(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > UCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fi2(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > SHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fi4(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 2147483648. && sizeof(long) == 4) { /* Instead of subtracting 2147483648, it is more efficient */ /* to just flip the sign bit with the XOR operator */ for (ii = 0; ii < ntodo; ii++) output[ii] = ( *(long *) &input[ii] ) ^ 0x80000000; } else if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] > INT32_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else output[ii] = input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fi8(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = input[ii]; } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fr4(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fr8(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (double) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffu4fstr(unsigned long *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, (double) input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/eval.l0000644000175000017500000003743012243255342015422 0ustar oleole%{ /************************************************************************/ /* */ /* CFITSIO Lexical Parser */ /* */ /* This file is one of 3 files containing code which parses an */ /* arithmetic expression and evaluates it in the context of an input */ /* FITS file table extension. The CFITSIO lexical parser is divided */ /* into the following 3 parts/files: the CFITSIO "front-end", */ /* eval_f.c, contains the interface between the user/CFITSIO and the */ /* real core of the parser; the FLEX interpreter, eval_l.c, takes the */ /* input string and parses it into tokens and identifies the FITS */ /* information required to evaluate the expression (ie, keywords and */ /* columns); and, the BISON grammar and evaluation routines, eval_y.c, */ /* receives the FLEX output and determines and performs the actual */ /* operations. The files eval_l.c and eval_y.c are produced from */ /* running flex and bison on the files eval.l and eval.y, respectively. */ /* (flex and bison are available from any GNU archive: see www.gnu.org) */ /* */ /* The grammar rules, rather than evaluating the expression in situ, */ /* builds a tree, or Nodal, structure mapping out the order of */ /* operations and expression dependencies. This "compilation" process */ /* allows for much faster processing of multiple rows. This technique */ /* was developed by Uwe Lammers of the XMM Science Analysis System, */ /* although the CFITSIO implementation is entirely code original. */ /* */ /* */ /* Modification History: */ /* */ /* Kent Blackburn c1992 Original parser code developed for the */ /* FTOOLS software package, in particular, */ /* the fselect task. */ /* Kent Blackburn c1995 BIT column support added */ /* Peter D Wilson Feb 1998 Vector column support added */ /* Peter D Wilson May 1998 Ported to CFITSIO library. User */ /* interface routines written, in essence */ /* making fselect, fcalc, and maketime */ /* capabilities available to all tools */ /* via single function calls. */ /* Peter D Wilson Jun 1998 Major rewrite of parser core, so as to */ /* create a run-time evaluation tree, */ /* inspired by the work of Uwe Lammers, */ /* resulting in a speed increase of */ /* 10-100 times. */ /* Peter D Wilson Jul 1998 gtifilter(a,b,c,d) function added */ /* Peter D Wilson Aug 1998 regfilter(a,b,c,d) function added */ /* Peter D Wilson Jul 1999 Make parser fitsfile-independent, */ /* allowing a purely vector-based usage */ /* */ /************************************************************************/ #include #include #include #ifdef sparc #include #else #include #endif #include "eval_defs.h" ParseData gParse; /* Global structure holding all parser information */ /***** Internal functions *****/ int yyGetVariable( char *varName, YYSTYPE *varVal ); static int find_variable( char *varName ); static int expr_read( char *buf, int nbytes ); /***** Definitions *****/ #define YY_NO_UNPUT /* Don't include YYUNPUT function */ #define YY_NEVER_INTERACTIVE 1 #define MAXCHR 256 #define MAXBIT 128 #define OCT_0 "000" #define OCT_1 "001" #define OCT_2 "010" #define OCT_3 "011" #define OCT_4 "100" #define OCT_5 "101" #define OCT_6 "110" #define OCT_7 "111" #define OCT_X "xxx" #define HEX_0 "0000" #define HEX_1 "0001" #define HEX_2 "0010" #define HEX_3 "0011" #define HEX_4 "0100" #define HEX_5 "0101" #define HEX_6 "0110" #define HEX_7 "0111" #define HEX_8 "1000" #define HEX_9 "1001" #define HEX_A "1010" #define HEX_B "1011" #define HEX_C "1100" #define HEX_D "1101" #define HEX_E "1110" #define HEX_F "1111" #define HEX_X "xxxx" /* MJT - 13 June 1996 read from buffer instead of stdin (as per old ftools.skel) */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( (result = expr_read( (char *) buf, max_size )) < 0 ) \ YY_FATAL_ERROR( "read() in flex scanner failed" ); %} bit ([bB][01xX]+) oct ([oO][01234567xX]+) hex ([hH][0123456789aAbBcCdDeEfFxX]+) integer [0-9]+ boolean (t|f|T|F) real ([0-9]*"."[0-9]+)|([0-9]*"."*[0-9]+[eEdD][+-]?[0-9]+)|([0-9]*".") constant ("#"[a-zA-Z0-9_]+)|("#""$"[^\n]*"$") string ([\"][^\"\n]*[\"])|([\'][^\'\n]*[\']) variable ([a-zA-Z_][a-zA-Z0-9_]*)|("$"[^$\n]*"$") function [a-zA-Z][a-zA-Z0-9]+"(" intcast ("(int)"|"(INT)") fltcast ("(float)"|"(FLOAT)"|"(double)"|"(DOUBLE)") power ("^"|"**") not ("!"|".not."|".NOT."|"not."|"NOT.") or ("||"|".or."|".OR."|"or."|"OR.") and ("&&"|".and."|".AND."|"and."|"AND.") equal ("=="|".eq."|".EQ."|"eq."|"EQ.") not_equal ("!="|".ne."|".NE."|"ne."|"NE.") greater (">"|".gt."|".GT."|"gt."|"GT.") lesser ("<"|".lt."|".LT."|"lt."|"LT.") greater_eq (">="|"=>"|".ge."|".GE."|"ge."|"GE.") lesser_eq ("<="|"=<"|".le."|".LE."|"le."|"LE.") nl \n %% [ \t]+ ; {bit} { int len; len = strlen(yytext); while (yytext[len] == ' ') len--; len = len - 1; strncpy(yylval.str,&yytext[1],len); yylval.str[len] = '\0'; return( BITSTR ); } {oct} { int len; char tmpstring[256]; char bitstring[256]; len = strlen(yytext); if (len >= 256) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"Bit string exceeds maximum length: '"); strncat(errMsg, &(yytext[0]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { while (yytext[len] == ' ') len--; len = len - 1; strncpy(tmpstring,&yytext[1],len); } tmpstring[len] = '\0'; bitstring[0] = '\0'; len = 0; while ( tmpstring[len] != '\0') { switch ( tmpstring[len] ) { case '0': strcat(bitstring,OCT_0); break; case '1': strcat(bitstring,OCT_1); break; case '2': strcat(bitstring,OCT_2); break; case '3': strcat(bitstring,OCT_3); break; case '4': strcat(bitstring,OCT_4); break; case '5': strcat(bitstring,OCT_5); break; case '6': strcat(bitstring,OCT_6); break; case '7': strcat(bitstring,OCT_7); break; case 'x': case 'X': strcat(bitstring,OCT_X); break; } len++; } strcpy( yylval.str, bitstring ); return( BITSTR ); } {hex} { int len; char tmpstring[256]; char bitstring[256]; len = strlen(yytext); if (len >= 256) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"Hex string exceeds maximum length: '"); strncat(errMsg, &(yytext[0]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { while (yytext[len] == ' ') len--; len = len - 1; strncpy(tmpstring,&yytext[1],len); } tmpstring[len] = '\0'; bitstring[0] = '\0'; len = 0; while ( tmpstring[len] != '\0') { switch ( tmpstring[len] ) { case '0': strcat(bitstring,HEX_0); break; case '1': strcat(bitstring,HEX_1); break; case '2': strcat(bitstring,HEX_2); break; case '3': strcat(bitstring,HEX_3); break; case '4': strcat(bitstring,HEX_4); break; case '5': strcat(bitstring,HEX_5); break; case '6': strcat(bitstring,HEX_6); break; case '7': strcat(bitstring,HEX_7); break; case '8': strcat(bitstring,HEX_8); break; case '9': strcat(bitstring,HEX_9); break; case 'a': case 'A': strcat(bitstring,HEX_A); break; case 'b': case 'B': strcat(bitstring,HEX_B); break; case 'c': case 'C': strcat(bitstring,HEX_C); break; case 'd': case 'D': strcat(bitstring,HEX_D); break; case 'e': case 'E': strcat(bitstring,HEX_E); break; case 'f': case 'F': strcat(bitstring,HEX_F); break; case 'x': case 'X': strcat(bitstring,HEX_X); break; } len++; } strcpy( yylval.str, bitstring ); return( BITSTR ); } {integer} { yylval.lng = atol(yytext); return( LONG ); } {boolean} { if ((yytext[0] == 't') || (yytext[0] == 'T')) yylval.log = 1; else yylval.log = 0; return( BOOLEAN ); } {real} { yylval.dbl = atof(yytext); return( DOUBLE ); } {constant} { if( !strcasecmp(yytext,"#PI") ) { yylval.dbl = (double)(4) * atan((double)(1)); return( DOUBLE ); } else if( !strcasecmp(yytext,"#E") ) { yylval.dbl = exp((double)(1)); return( DOUBLE ); } else if( !strcasecmp(yytext,"#DEG") ) { yylval.dbl = ((double)4)*atan((double)1)/((double)180); return( DOUBLE ); } else if( !strcasecmp(yytext,"#ROW") ) { return( ROWREF ); } else if( !strcasecmp(yytext,"#NULL") ) { return( NULLREF ); } else if( !strcasecmp(yytext,"#SNULL") ) { return( SNULLREF ); } else { int len; if (yytext[1] == '$') { len = strlen(yytext) - 3; yylval.str[0] = '#'; strncpy(yylval.str+1,&yytext[2],len); yylval.str[len+1] = '\0'; yytext = yylval.str; } return( (*gParse.getData)(yytext, &yylval) ); } } {string} { int len; len = strlen(yytext) - 2; if (len >= MAX_STRLEN) { char errMsg[100]; gParse.status = PARSE_SYNTAX_ERR; strcpy (errMsg,"String exceeds maximum length: '"); strncat(errMsg, &(yytext[1]), 20); strcat (errMsg,"...'"); ffpmsg (errMsg); len = 0; } else { strncpy(yylval.str,&yytext[1],len); } yylval.str[len] = '\0'; return( STRING ); } {variable} { int len,type; if (yytext[0] == '$') { len = strlen(yytext) - 2; strncpy(yylval.str,&yytext[1],len); yylval.str[len] = '\0'; yytext = yylval.str; } type = yyGetVariable(yytext, &yylval); return( type ); } {function} { char *fname; int len=0; fname = &yylval.str[0]; while( (fname[len]=toupper(yytext[len])) ) len++; if( FSTRCMP(fname,"BOX(")==0 || FSTRCMP(fname,"CIRCLE(")==0 || FSTRCMP(fname,"ELLIPSE(")==0 || FSTRCMP(fname,"NEAR(")==0 || FSTRCMP(fname,"ISNULL(")==0 ) /* Return type is always boolean */ return( BFUNCTION ); else if( FSTRCMP(fname,"GTIFILTER(")==0 ) return( GTIFILTER ); else if( FSTRCMP(fname,"REGFILTER(")==0 ) return( REGFILTER ); else if( FSTRCMP(fname,"STRSTR(")==0 ) return( IFUNCTION ); /* Returns integer */ else return( FUNCTION ); } {intcast} { return( INTCAST ); } {fltcast} { return( FLTCAST ); } {power} { return( POWER ); } {not} { return( NOT ); } {or} { return( OR ); } {and} { return( AND ); } {equal} { return( EQ ); } {not_equal} { return( NE ); } {greater} { return( GT ); } {lesser} { return( LT ); } {greater_eq} { return( GTE ); } {lesser_eq} { return( LTE ); } {nl} { return( '\n' ); } . { return( yytext[0] ); } %% int yywrap() { /* MJT -- 13 June 1996 Supplied for compatibility with pre-2.5.1 versions of flex which do not recognize %option noyywrap */ return(1); } /* expr_read is lifted from old ftools.skel. Now we can use any version of flex with no .skel file necessary! MJT - 13 June 1996 keep a memory of how many bytes have been read previously, so that an unlimited-sized buffer can be supported. PDW - 28 Feb 1998 */ static int expr_read(char *buf, int nbytes) { int n; n = 0; if( !gParse.is_eobuf ) { do { buf[n++] = gParse.expr[gParse.index++]; } while ((nlng = varNum; } return( type ); } static int find_variable(char *varName) { int i; if( gParse.nCols ) for( i=0; i c2) return(1); if (c1 == 0) return(0); s1++; s2++; } } int strncasecmp(const char *s1, const char *s2, size_t n) { char c1, c2; for (; n-- ;) { c1 = toupper( *s1 ); c2 = toupper( *s2 ); if (c1 < c2) return(-1); if (c1 > c2) return(1); if (c1 == 0) return(0); s1++; s2++; } return(0); } #endif astropy-0.3/cextern/cfitsio/getcole.c0000644000175000017500000020327112243255342016102 0ustar oleole/* This file, getcole.c, contains routines that read data elements from */ /* a FITS image or table, with float datatype */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffgpve( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float nulval, /* I - value for undefined pixels */ float *array, /* O - array of values that are returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Undefined elements will be set equal to NULVAL, unless NULVAL=0 in which case no checking for undefined values will be performed. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; char cdummy; int nullcheck = 1; float nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_read_compressed_pixels(fptr, TFLOAT, firstelem, nelem, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcle(fptr, 2, row, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgpfe( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float *array, /* O - array of values that are returned */ char *nularray, /* O - array of null pixel flags */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any undefined pixels in the returned array will be set = 0 and the corresponding nularray value will be set = 1. ANYNUL is returned with a value of .true. if any pixels are undefined. */ { long row; int nullcheck = 2; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_read_compressed_pixels(fptr, TFLOAT, firstelem, nelem, nullcheck, NULL, array, nularray, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcle(fptr, 2, row, firstelem, nelem, 1, 2, 0.F, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg2de(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ float nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ float *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { /* call the 3D reading routine, with the 3rd dimension = 1 */ ffg3de(fptr, group, nulval, ncols, naxis2, naxis1, naxis2, 1, array, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffg3de(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ float nulval, /* set undefined pixels equal to this */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ float *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an entire 3-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). Any null values in the array will be set equal to the value of nulval, unless nulval = 0 in which case no null checking will be performed. */ { long tablerow, ii, jj; LONGLONG narray, nfits; char cdummy; int nullcheck = 1; long inc[] = {1,1,1}; LONGLONG fpixel[] = {1,1,1}; LONGLONG lpixel[3]; float nullvalue; if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = ncols; lpixel[1] = nrows; lpixel[2] = naxis3; nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TFLOAT, fpixel, lpixel, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so read all at once */ ffgcle(fptr, 2, tablerow, 1, naxis1 * naxis2 * naxis3, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to read */ narray = 0; /* next pixel in output array to be filled */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* reading naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffgcle(fptr, 2, tablerow, nfits, naxis1, 1, 1, nulval, &array[narray], &cdummy, anynul, status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsve(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ float nulval, /* I - value to set undefined pixels */ float *array, /* O - array to be filled and returned */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dir[9]; long nelem, nultyp, ninc, numcol; LONGLONG felem, dsize[10], blcll[9], trcll[9]; int hdutype, anyf; char ldummy, msg[FLEN_ERRMSG]; int nullcheck = 1; float nullvalue; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsve is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } nullvalue = nulval; /* set local variable */ fits_read_compressed_img(fptr, TFLOAT, blcll, trcll, inc, nullcheck, &nullvalue, array, NULL, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 1; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; dir[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { if (hdutype == IMAGE_HDU) { dir[ii] = -1; } else { sprintf(msg, "ffgsve: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; dsize[ii] = dsize[ii] * dir[ii]; } dsize[naxis] = dsize[naxis] * dir[naxis]; if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0]*dir[0] - str[0]*dir[0]) / inc[0] + 1; ninc = incr[0] * dir[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]*dir[8]; i8 <= stp[8]*dir[8]; i8 += incr[8]) { for (i7 = str[7]*dir[7]; i7 <= stp[7]*dir[7]; i7 += incr[7]) { for (i6 = str[6]*dir[6]; i6 <= stp[6]*dir[6]; i6 += incr[6]) { for (i5 = str[5]*dir[5]; i5 <= stp[5]*dir[5]; i5 += incr[5]) { for (i4 = str[4]*dir[4]; i4 <= stp[4]*dir[4]; i4 += incr[4]) { for (i3 = str[3]*dir[3]; i3 <= stp[3]*dir[3]; i3 += incr[3]) { for (i2 = str[2]*dir[2]; i2 <= stp[2]*dir[2]; i2 += incr[2]) { for (i1 = str[1]*dir[1]; i1 <= stp[1]*dir[1]; i1 += incr[1]) { felem=str[0] + (i1 - dir[1]) * dsize[1] + (i2 - dir[2]) * dsize[2] + (i3 - dir[3]) * dsize[3] + (i4 - dir[4]) * dsize[4] + (i5 - dir[5]) * dsize[5] + (i6 - dir[6]) * dsize[6] + (i7 - dir[7]) * dsize[7] + (i8 - dir[8]) * dsize[8]; if ( ffgcle(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &ldummy, &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffgsfe(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of the column to read (1 = 1st) */ int naxis, /* I - number of dimensions in the FITS array */ long *naxes, /* I - size of each dimension */ long *blc, /* I - 'bottom left corner' of the subsection */ long *trc, /* I - 'top right corner' of the subsection */ long *inc, /* I - increment to be applied in each dimension */ float *array, /* O - array to be filled and returned */ char *flagval, /* O - set to 1 if corresponding value is null */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read a subsection of data values from an image or a table column. This routine is set up to handle a maximum of nine dimensions. */ { long ii,i0, i1,i2,i3,i4,i5,i6,i7,i8,row,rstr,rstp,rinc; long str[9],stp[9],incr[9],dsize[10]; LONGLONG blcll[9], trcll[9]; long felem, nelem, nultyp, ninc, numcol; int hdutype, anyf; float nulval = 0; char msg[FLEN_ERRMSG]; int nullcheck = 2; if (naxis < 1 || naxis > 9) { sprintf(msg, "NAXIS = %d in call to ffgsve is out of range", naxis); ffpmsg(msg); return(*status = BAD_DIMEN); } if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ for (ii=0; ii < naxis; ii++) { blcll[ii] = blc[ii]; trcll[ii] = trc[ii]; } fits_read_compressed_img(fptr, TFLOAT, blcll, trcll, inc, nullcheck, NULL, array, flagval, anynul, status); return(*status); } /* if this is a primary array, then the input COLNUM parameter should be interpreted as the row number, and we will alway read the image data from column 2 (any group parameters are in column 1). */ if (ffghdt(fptr, &hdutype, status) > 0) return(*status); if (hdutype == IMAGE_HDU) { /* this is a primary array, or image extension */ if (colnum == 0) { rstr = 1; rstp = 1; } else { rstr = colnum; rstp = colnum; } rinc = 1; numcol = 2; } else { /* this is a table, so the row info is in the (naxis+1) elements */ rstr = blc[naxis]; rstp = trc[naxis]; rinc = inc[naxis]; numcol = colnum; } nultyp = 2; if (anynul) *anynul = FALSE; i0 = 0; for (ii = 0; ii < 9; ii++) { str[ii] = 1; stp[ii] = 1; incr[ii] = 1; dsize[ii] = 1; } for (ii = 0; ii < naxis; ii++) { if (trc[ii] < blc[ii]) { sprintf(msg, "ffgsve: illegal range specified for axis %ld", ii + 1); ffpmsg(msg); return(*status = BAD_PIX_NUM); } str[ii] = blc[ii]; stp[ii] = trc[ii]; incr[ii] = inc[ii]; dsize[ii + 1] = dsize[ii] * naxes[ii]; } if (naxis == 1 && naxes[0] == 1) { /* This is not a vector column, so read all the rows at once */ nelem = (rstp - rstr) / rinc + 1; ninc = rinc; rstp = rstr; } else { /* have to read each row individually, in all dimensions */ nelem = (stp[0] - str[0]) / inc[0] + 1; ninc = incr[0]; } for (row = rstr; row <= rstp; row += rinc) { for (i8 = str[8]; i8 <= stp[8]; i8 += incr[8]) { for (i7 = str[7]; i7 <= stp[7]; i7 += incr[7]) { for (i6 = str[6]; i6 <= stp[6]; i6 += incr[6]) { for (i5 = str[5]; i5 <= stp[5]; i5 += incr[5]) { for (i4 = str[4]; i4 <= stp[4]; i4 += incr[4]) { for (i3 = str[3]; i3 <= stp[3]; i3 += incr[3]) { for (i2 = str[2]; i2 <= stp[2]; i2 += incr[2]) { for (i1 = str[1]; i1 <= stp[1]; i1 += incr[1]) { felem=str[0] + (i1 - 1) * dsize[1] + (i2 - 1) * dsize[2] + (i3 - 1) * dsize[3] + (i4 - 1) * dsize[4] + (i5 - 1) * dsize[5] + (i6 - 1) * dsize[6] + (i7 - 1) * dsize[7] + (i8 - 1) * dsize[8]; if ( ffgcle(fptr, numcol, row, felem, nelem, ninc, nultyp, nulval, &array[i0], &flagval[i0], &anyf, status) > 0) return(*status); if (anyf && anynul) *anynul = TRUE; i0 += nelem; } } } } } } } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffggpe( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to read (1 = 1st group) */ long firstelem, /* I - first vector element to read (1 = 1st) */ long nelem, /* I - number of values to read */ float *array, /* O - array of values that are returned */ int *status) /* IO - error status */ /* Read an array of group parameters from the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being read). */ { long row; int idummy; char cdummy; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffgcle(fptr, 1, row, firstelem, nelem, 1, 1, 0.F, array, &cdummy, &idummy, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcve(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float nulval, /* I - value for null pixels */ float *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. */ { char cdummy; ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcvc(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float nulval, /* I - value for null pixels */ float *array, /* O - array of values that are read */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Any undefined pixels will be set equal to the value of 'nulval' unless nulval = 0 in which case no checks for undefined pixels will be made. TSCAL and ZERO should not be used with complex values. */ { char cdummy; /* a complex value is interpreted as a pair of float values, thus */ /* need to multiply the first element and number of elements by 2 */ ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem *2, 1, 1, nulval, array, &cdummy, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfe(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. */ { float dummy = 0; ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 2, dummy, array, nularray, anynul, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcfc(fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ float *array, /* O - array of values that are read */ char *nularray, /* O - array of flags: 1 if null pixel; else 0 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. Automatic datatype conversion will be performed if the datatype of the column does not match the datatype of the array parameter. The output values will be scaled by the FITS TSCALn and TZEROn values if these values have been defined. Nularray will be set = 1 if the corresponding array pixel is undefined, otherwise nularray will = 0. TSCAL and ZERO should not be used with complex values. */ { long ii, jj; float dummy = 0; char *carray; /* a complex value is interpreted as a pair of float values, thus */ /* need to multiply the first element and number of elements by 2 */ /* allocate temporary array */ carray = (char *) calloc( (size_t) (nelem * 2), 1); ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, 1, 2, dummy, array, carray, anynul, status); for (ii = 0, jj = 0; jj < nelem; ii += 2, jj++) { if (carray[ii] || carray[ii + 1]) nularray[jj] = 1; else nularray[jj] = 0; } free(carray); return(*status); } /*--------------------------------------------------------------------------*/ int ffgcle( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to read (1 = 1st col) */ LONGLONG firstrow, /* I - first row to read (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to read (1 = 1st) */ LONGLONG nelem, /* I - number of values to read */ long elemincre, /* I - pixel increment; e.g., 2 = every other */ int nultyp, /* I - null value handling code: */ /* 1: set undefined pixels = nulval */ /* 2: set nularray=1 for undefined pixels */ float nulval, /* I - value for null pixels if nultyp = 1 */ float *array, /* O - array of values that are read */ char *nularray, /* O - array of flags = 1 if nultyp = 2 */ int *anynul, /* O - set to 1 if any values are null; else 0 */ int *status) /* IO - error status */ /* Read an array of values from a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer be a virtual column in a 1 or more grouped FITS primary array or image extension. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The output array of values will be converted from the datatype of the column and will be scaled by the FITS TSCALn and TZEROn values if necessary. */ { double scale, zero, power = 1., dtemp; int tcode, maxelem2, hdutype, xcode, decimals; long twidth, incre; long ii, xwidth, ntodo; int convert, nulcheck, readcheck = 0; LONGLONG repeat, startpos, elemnum, readptr, tnull; LONGLONG rowlen, rownum, remain, next, rowincre, maxelem; char tform[20]; char message[81]; char snull[20]; /* the FITS null value if reading from ASCII table */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; if (anynul) *anynul = 0; if (nultyp == 2) memset(nularray, 0, (size_t) nelem); /* initialize nullarray */ /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (elemincre < 0) readcheck = -1; /* don't do range checking in this case */ if ( ffgcprll( fptr, colnum, firstrow, firstelem, nelem, readcheck, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0 ) return(*status); maxelem = maxelem2; incre *= elemincre; /* multiply incre to just get every nth pixel */ if (tcode == TSTRING) /* setup for ASCII tables */ { /* get the number of implied decimal places if no explicit decmal point */ ffasfm(tform, &xcode, &xwidth, &decimals, status); for(ii = 0; ii < decimals; ii++) power *= 10.; } /*------------------------------------------------------------------*/ /* Decide whether to check for null values in the input FITS file: */ /*------------------------------------------------------------------*/ nulcheck = nultyp; /* by default check for null values in the FITS file */ if (nultyp == 1 && nulval == 0) nulcheck = 0; /* calling routine does not want to check for nulls */ else if (tcode%10 == 1 && /* if reading an integer column, and */ tnull == NULL_UNDEFINED) /* if a null value is not defined, */ nulcheck = 0; /* then do not check for null values. */ else if (tcode == TSHORT && (tnull > SHRT_MAX || tnull < SHRT_MIN) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TBYTE && (tnull > 255 || tnull < 0) ) nulcheck = 0; /* Impossible null value */ else if (tcode == TSTRING && snull[0] == ASCII_NULL_UNDEFINED) nulcheck = 0; /*----------------------------------------------------------------------*/ /* If FITS column and output data array have same datatype, then we do */ /* not need to use a temporary buffer to store intermediate datatype. */ /*----------------------------------------------------------------------*/ convert = 1; if (tcode == TFLOAT) /* Special Case: */ { /* no type convertion required, so read */ maxelem = nelem; /* data directly into output buffer. */ if (nulcheck == 0 && scale == 1. && zero == 0.) convert = 0; /* no need to scale data or find nulls */ } /*---------------------------------------------------------------------*/ /* Now read the pixels from the FITS column. If the column does not */ /* have the same datatype as the output array, then we have to read */ /* the raw values into a temporary buffer (of limited size). In */ /* the case of a vector colum read only 1 vector of values at a time */ /* then skip to the next row if more values need to be read. */ /* After reading the raw values, then call the fffXXYY routine to (1) */ /* test for undefined values, (2) convert the datatype if necessary, */ /* and (3) scale the values by the FITS TSCALn and TZEROn linear */ /* scaling parameters. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to read */ next = 0; /* next element in array to be read */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to read at one time to the number that will fit in the buffer or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); if (elemincre >= 0) { ntodo = (long) minvalue(ntodo, ((repeat - elemnum - 1)/elemincre +1)); } else { ntodo = (long) minvalue(ntodo, (elemnum/(-elemincre) +1)); } readptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * (incre / elemincre)); switch (tcode) { case (TFLOAT): ffgr4b(fptr, readptr, ntodo, incre, &array[next], status); if (convert) fffr4r4(&array[next], ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TBYTE): ffgi1b(fptr, readptr, ntodo, incre, (unsigned char *) buffer, status); fffi1r4((unsigned char *) buffer, ntodo, scale, zero, nulcheck, (unsigned char) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TSHORT): ffgi2b(fptr, readptr, ntodo, incre, (short *) buffer, status); fffi2r4((short *) buffer, ntodo, scale, zero, nulcheck, (short) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONG): ffgi4b(fptr, readptr, ntodo, incre, (INT32BIT *) buffer, status); fffi4r4((INT32BIT *) buffer, ntodo, scale, zero, nulcheck, (INT32BIT) tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TLONGLONG): ffgi8b(fptr, readptr, ntodo, incre, (long *) buffer, status); fffi8r4( (LONGLONG *) buffer, ntodo, scale, zero, nulcheck, tnull, nulval, &nularray[next], anynul, &array[next], status); break; case (TDOUBLE): ffgr8b(fptr, readptr, ntodo, incre, (double *) buffer, status); fffr8r4((double *) buffer, ntodo, scale, zero, nulcheck, nulval, &nularray[next], anynul, &array[next], status); break; case (TSTRING): ffmbyt(fptr, readptr, REPORT_EOF, status); if (incre == twidth) /* contiguous bytes */ ffgbyt(fptr, ntodo * twidth, buffer, status); else ffgbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); fffstrr4((char *) buffer, ntodo, scale, zero, twidth, power, nulcheck, snull, nulval, &nularray[next], anynul, &array[next], status); break; default: /* error trap for invalid column format */ sprintf(message, "Cannot read numbers from column %d which has format %s", colnum, tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous read operation */ { dtemp = (double) next; if (hdutype > 0) sprintf(message, "Error reading elements %.0f thru %.0f from column %d (ffgcle).", dtemp+1., dtemp+ntodo, colnum); else sprintf(message, "Error reading elements %.0f thru %.0f from image (ffgcle).", dtemp+1., dtemp+ntodo); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum = elemnum + (ntodo * elemincre); if (elemnum >= repeat) /* completed a row; start on later row */ { rowincre = elemnum / repeat; rownum += rowincre; elemnum = elemnum - (rowincre * repeat); } else if (elemnum < 0) /* completed a row; start on a previous row */ { rowincre = (-elemnum - 1) / repeat + 1; rownum -= rowincre; elemnum = (rowincre * repeat) + elemnum; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while reading FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int fffi1r4(unsigned char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ unsigned char tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (( (double) input[ii] ) * scale + zero); } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (float) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = (float) (( (double) input[ii] ) * scale + zero); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi2r4(short *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ short tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (input[ii] * scale + zero); } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (float) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = (float) (input[ii] * scale + zero); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi4r4(INT32BIT *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ INT32BIT tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (input[ii] * scale + zero); } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (float) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = (float) (input[ii] * scale + zero); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffi8r4(LONGLONG *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ LONGLONG tnull, /* I - value of FITS TNULLn keyword if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to tnull. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (input[ii] * scale + zero); } } } else /* must check for null values */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else output[ii] = (float) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { if (input[ii] == tnull) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else { output[ii] = (float) (input[ii] * scale + zero); } } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr4r4(float *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { memcpy(output, input, ntodo * sizeof(float) ); } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (input[ii] * scale + zero); } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr++; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else { nullarray[ii] = 1; /* explicitly set value in case output contains a NaN */ output[ii] = FLOATNULLVALUE; } } else /* it's an underflow */ output[ii] = 0; } else output[ii] = input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 2) { if (0 != (iret = fnan(*sptr) ) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else { nullarray[ii] = 1; /* explicitly set value in case output contains a NaN */ output[ii] = FLOATNULLVALUE; } } else /* it's an underflow */ output[ii] = (float) zero; } else output[ii] = (float) (input[ii] * scale + zero); } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffr8r4(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do datatype conversion and scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to NaN. If nullcheck = 0, then no checking for nulls is performed and any null values will be transformed just like any other pixel. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { long ii; short *sptr, iret; if (nullcheck == 0) /* no null checking required */ { if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; /* copy input to output */ } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++) { output[ii] = (float) (input[ii] * scale + zero); } } } else /* must check for null values */ { sptr = (short *) input; #if BYTESWAPPED && MACHINE != VAXVMS && MACHINE != ALPHAVMS sptr += 3; /* point to MSBs */ #endif if (scale == 1. && zero == 0.) /* no scaling */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = 0; } else output[ii] = (float) input[ii]; } } else /* must scale the data */ { for (ii = 0; ii < ntodo; ii++, sptr += 4) { if (0 != (iret = dnan(*sptr)) ) /* test for NaN or underflow */ { if (iret == 1) /* is it a NaN? */ { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } else /* it's an underflow */ output[ii] = (float) zero; } else output[ii] = (float) (input[ii] * scale + zero); } } } return(*status); } /*--------------------------------------------------------------------------*/ int fffstrr4(char *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ long twidth, /* I - width of each substring of chars */ double implipower, /* I - power of 10 of implied decimal */ int nullcheck, /* I - null checking code; 0 = don't check */ /* 1:set null pixels = nullval */ /* 2: if null pixel, set nullarray = 1 */ char *snull, /* I - value of FITS null string, if any */ float nullval, /* I - set null pixels, if nullcheck = 1 */ char *nullarray, /* I - bad pixel array, if nullcheck = 2 */ int *anynull, /* O - set to 1 if any pixels are null */ float *output, /* O - array of converted pixels */ int *status) /* IO - error status */ /* Copy input to output following reading of the input from a FITS file. Check for null values and do scaling if required. The nullcheck code value determines how any null values in the input array are treated. A null value is an input pixel that is equal to snull. If nullcheck= 0, then no special checking for nulls is performed. If nullcheck = 1, then the output pixel will be set = nullval if the corresponding input pixel is null. If nullcheck = 2, then if the pixel is null then the corresponding value of nullarray will be set to 1; the value of nullarray for non-null pixels will = 0. The anynull parameter will be set = 1 if any of the returned pixels are null, otherwise anynull will be returned with a value = 0; */ { int nullen; long ii; double dvalue; char *cstring, message[81]; char *cptr, *tpos; char tempstore, chrzero = '0'; double val, power; int exponent, sign, esign, decpt; nullen = strlen(snull); cptr = input; /* pointer to start of input string */ for (ii = 0; ii < ntodo; ii++) { cstring = cptr; /* temporarily insert a null terminator at end of the string */ tpos = cptr + twidth; tempstore = *tpos; *tpos = 0; /* check if null value is defined, and if the */ /* column string is identical to the null string */ if (snull[0] != ASCII_NULL_UNDEFINED && !strncmp(snull, cptr, nullen) ) { if (nullcheck) { *anynull = 1; if (nullcheck == 1) output[ii] = nullval; else nullarray[ii] = 1; } cptr += twidth; } else { /* value is not the null value, so decode it */ /* remove any embedded blank characters from the string */ decpt = 0; sign = 1; val = 0.; power = 1.; exponent = 0; esign = 1; while (*cptr == ' ') /* skip leading blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for leading sign */ { if (*cptr == '-') sign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and value */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } if (*cptr == '.' || *cptr == ',') /* check for decimal point */ { decpt = 1; /* set flag to show there was a decimal point */ cptr++; while (*cptr == ' ') /* skip any blanks */ cptr++; while (*cptr >= '0' && *cptr <= '9') { val = val * 10. + *cptr - chrzero; /* accumulate the value */ power = power * 10.; cptr++; while (*cptr == ' ') /* skip embedded blanks in the value */ cptr++; } } if (*cptr == 'E' || *cptr == 'D') /* check for exponent */ { cptr++; while (*cptr == ' ') /* skip blanks */ cptr++; if (*cptr == '-' || *cptr == '+') /* check for exponent sign */ { if (*cptr == '-') esign = -1; cptr++; while (*cptr == ' ') /* skip blanks between sign and exp */ cptr++; } while (*cptr >= '0' && *cptr <= '9') { exponent = exponent * 10 + *cptr - chrzero; /* accumulate exp */ cptr++; while (*cptr == ' ') /* skip embedded blanks */ cptr++; } } if (*cptr != 0) /* should end up at the null terminator */ { sprintf(message, "Cannot read number from ASCII table"); ffpmsg(message); sprintf(message, "Column field = %s.", cstring); ffpmsg(message); /* restore the char that was overwritten by the null */ *tpos = tempstore; return(*status = BAD_C2D); } if (!decpt) /* if no explicit decimal, use implied */ power = implipower; dvalue = (sign * val / power) * pow(10., (double) (esign * exponent)); output[ii] = (float) (dvalue * scale + zero); /* apply the scaling */ } /* restore the char that was overwritten by the null */ *tpos = tempstore; } return(*status); } astropy-0.3/cextern/cfitsio/putcold.c0000644000175000017500000011176512243255342016140 0ustar oleole/* This file, putcold.c, contains routines that write data elements to */ /* a FITS image or table, with double datatype. */ /* The FITSIO software was written by William Pence at the High Energy */ /* Astrophysic Science Archive Research Center (HEASARC) at the NASA */ /* Goddard Space Flight Center. */ #include #include #include #include "fitsio2.h" /*--------------------------------------------------------------------------*/ int ffpprd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ double *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; double nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_pixels(fptr, TDOUBLE, firstelem, nelem, 0, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcld(fptr, 2, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffppnd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG firstelem, /* I - first vector element to write(1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ double *array, /* I - array of values that are written */ double nulval, /* I - undefined pixel value */ int *status) /* IO - error status */ /* Write an array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). Any array values that are equal to the value of nulval will be replaced with the null pixel value that is appropriate for this column. */ { long row; double nullvalue; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ nullvalue = nulval; /* set local variable */ fits_write_compressed_pixels(fptr, TDOUBLE, firstelem, nelem, 1, array, &nullvalue, status); return(*status); } row=maxvalue(1,group); ffpcnd(fptr, 2, row, firstelem, nelem, array, nulval, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp2dd(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ double *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 2-D array of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { /* call the 3D writing routine, with the 3rd dimension = 1 */ ffp3dd(fptr, group, ncols, naxis2, naxis1, naxis2, 1, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffp3dd(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ LONGLONG ncols, /* I - number of pixels in each row of array */ LONGLONG nrows, /* I - number of rows in each plane of array */ LONGLONG naxis1, /* I - FITS image NAXIS1 value */ LONGLONG naxis2, /* I - FITS image NAXIS2 value */ LONGLONG naxis3, /* I - FITS image NAXIS3 value */ double *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write an entire 3-D cube of values to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow, ii, jj; long fpixel[3]= {1,1,1}, lpixel[3]; LONGLONG nfits, narray; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ lpixel[0] = (long) ncols; lpixel[1] = (long) nrows; lpixel[2] = (long) naxis3; fits_write_compressed_img(fptr, TDOUBLE, fpixel, lpixel, 0, array, NULL, status); return(*status); } tablerow=maxvalue(1,group); if (ncols == naxis1 && nrows == naxis2) /* arrays have same size? */ { /* all the image pixels are contiguous, so write all at once */ ffpcld(fptr, 2, tablerow, 1L, naxis1 * naxis2 * naxis3, array, status); return(*status); } if (ncols < naxis1 || nrows < naxis2) return(*status = BAD_DIMEN); nfits = 1; /* next pixel in FITS image to write to */ narray = 0; /* next pixel in input array to be written */ /* loop over naxis3 planes in the data cube */ for (jj = 0; jj < naxis3; jj++) { /* loop over the naxis2 rows in the FITS image, */ /* writing naxis1 pixels to each row */ for (ii = 0; ii < naxis2; ii++) { if (ffpcld(fptr, 2, tablerow, nfits, naxis1,&array[narray],status) > 0) return(*status); nfits += naxis1; narray += ncols; } narray += (nrows - naxis2) * ncols; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpssd(fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long naxis, /* I - number of data axes in array */ long *naxes, /* I - size of each FITS axis */ long *fpixel, /* I - 1st pixel in each axis to write (1=1st) */ long *lpixel, /* I - last pixel in each axis to write */ double *array, /* I - array to be written */ int *status) /* IO - error status */ /* Write a subsection of pixels to the primary array or image. A subsection is defined to be any contiguous rectangular array of pixels within the n-dimensional FITS data file. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long tablerow; LONGLONG fpix[7], dimen[7], astart, pstart; LONGLONG off2, off3, off4, off5, off6, off7; LONGLONG st10, st20, st30, st40, st50, st60, st70; LONGLONG st1, st2, st3, st4, st5, st6, st7; long ii, i1, i2, i3, i4, i5, i6, i7, irange[7]; if (*status > 0) return(*status); if (fits_is_compressed_image(fptr, status)) { /* this is a compressed image in a binary table */ fits_write_compressed_img(fptr, TDOUBLE, fpixel, lpixel, 0, array, NULL, status); return(*status); } if (naxis < 1 || naxis > 7) return(*status = BAD_DIMEN); tablerow=maxvalue(1,group); /* calculate the size and number of loops to perform in each dimension */ for (ii = 0; ii < 7; ii++) { fpix[ii]=1; irange[ii]=1; dimen[ii]=1; } for (ii = 0; ii < naxis; ii++) { fpix[ii]=fpixel[ii]; irange[ii]=lpixel[ii]-fpixel[ii]+1; dimen[ii]=naxes[ii]; } i1=irange[0]; /* compute the pixel offset between each dimension */ off2 = dimen[0]; off3 = off2 * dimen[1]; off4 = off3 * dimen[2]; off5 = off4 * dimen[3]; off6 = off5 * dimen[4]; off7 = off6 * dimen[5]; st10 = fpix[0]; st20 = (fpix[1] - 1) * off2; st30 = (fpix[2] - 1) * off3; st40 = (fpix[3] - 1) * off4; st50 = (fpix[4] - 1) * off5; st60 = (fpix[5] - 1) * off6; st70 = (fpix[6] - 1) * off7; /* store the initial offset in each dimension */ st1 = st10; st2 = st20; st3 = st30; st4 = st40; st5 = st50; st6 = st60; st7 = st70; astart = 0; for (i7 = 0; i7 < irange[6]; i7++) { for (i6 = 0; i6 < irange[5]; i6++) { for (i5 = 0; i5 < irange[4]; i5++) { for (i4 = 0; i4 < irange[3]; i4++) { for (i3 = 0; i3 < irange[2]; i3++) { pstart = st1 + st2 + st3 + st4 + st5 + st6 + st7; for (i2 = 0; i2 < irange[1]; i2++) { if (ffpcld(fptr, 2, tablerow, pstart, i1, &array[astart], status) > 0) return(*status); astart += i1; pstart += off2; } st2 = st20; st3 = st3+off3; } st3 = st30; st4 = st4+off4; } st4 = st40; st5 = st5+off5; } st5 = st50; st6 = st6+off6; } st6 = st60; st7 = st7+off7; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpgpd( fitsfile *fptr, /* I - FITS file pointer */ long group, /* I - group to write(1 = 1st group) */ long firstelem, /* I - first vector element to write(1 = 1st) */ long nelem, /* I - number of values to write */ double *array, /* I - array of values that are written */ int *status) /* IO - error status */ /* Write an array of group parameters to the primary array. Data conversion and scaling will be performed if necessary (e.g, if the datatype of the FITS array is not the same as the array being written). */ { long row; /* the primary array is represented as a binary table: each group of the primary array is a row in the table, where the first column contains the group parameters and the second column contains the image itself. */ row=maxvalue(1,group); ffpcld(fptr, 1L, row, firstelem, nelem, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcld( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ double *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of values to a column in the current FITS HDU. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary. */ { int tcode, maxelem2, hdutype, writeraw; long twidth, incre; long ntodo; LONGLONG repeat, startpos, elemnum, wrtptr, rowlen, rownum, remain, next, tnull, maxelem; double scale, zero; char tform[20], cform[20]; char message[FLEN_ERRMSG]; char snull[20]; /* the FITS null value */ double cbuff[DBUFFSIZE / sizeof(double)]; /* align cbuff on word boundary */ void *buffer; if (*status > 0) /* inherit input status value if > 0 */ return(*status); buffer = cbuff; /*---------------------------------------------------*/ /* Check input and get parameters about the column: */ /*---------------------------------------------------*/ if (ffgcprll( fptr, colnum, firstrow, firstelem, nelem, 1, &scale, &zero, tform, &twidth, &tcode, &maxelem2, &startpos, &elemnum, &incre, &repeat, &rowlen, &hdutype, &tnull, snull, status) > 0) return(*status); maxelem = maxelem2; if (tcode == TSTRING) ffcfmt(tform, cform); /* derive C format for writing strings */ /* if there is no scaling and the native machine format is not byteswapped, then we can simply write the raw data bytes into the FITS file if the datatype of the FITS column is the same as the input values. Otherwise, we must convert the raw values into the scaled and/or machine dependent format in a temporary buffer that has been allocated for this purpose. */ if (scale == 1. && zero == 0. && MACHINE == NATIVE && tcode == TDOUBLE) { writeraw = 1; maxelem = nelem; /* we can write the entire array at one time */ } else writeraw = 0; /*---------------------------------------------------------------------*/ /* Now write the pixels to the FITS column. */ /* First call the ffXXfYY routine to (1) convert the datatype */ /* if necessary, and (2) scale the values by the FITS TSCALn and */ /* TZEROn linear scaling parameters into a temporary buffer. */ /*---------------------------------------------------------------------*/ remain = nelem; /* remaining number of values to write */ next = 0; /* next element in array to be written */ rownum = 0; /* row number, relative to firstrow */ while (remain) { /* limit the number of pixels to process a one time to the number that will fit in the buffer space or to the number of pixels that remain in the current vector, which ever is smaller. */ ntodo = (long) minvalue(remain, maxelem); ntodo = (long) minvalue(ntodo, (repeat - elemnum)); wrtptr = startpos + ((LONGLONG)rownum * rowlen) + (elemnum * incre); ffmbyt(fptr, wrtptr, IGNORE_EOF, status); /* move to write position */ switch (tcode) { case (TDOUBLE): if (writeraw) { /* write raw input bytes without conversion */ ffpr8b(fptr, ntodo, incre, &array[next], status); } else { /* convert the raw data before writing to FITS file */ ffr8fr8(&array[next], ntodo, scale, zero, (double *) buffer, status); ffpr8b(fptr, ntodo, incre, (double *) buffer, status); } break; case (TLONGLONG): ffr8fi8(&array[next], ntodo, scale, zero, (LONGLONG *) buffer, status); ffpi8b(fptr, ntodo, incre, (long *) buffer, status); break; case (TBYTE): ffr8fi1(&array[next], ntodo, scale, zero, (unsigned char *) buffer, status); ffpi1b(fptr, ntodo, incre, (unsigned char *) buffer, status); break; case (TSHORT): ffr8fi2(&array[next], ntodo, scale, zero, (short *) buffer, status); ffpi2b(fptr, ntodo, incre, (short *) buffer, status); break; case (TLONG): ffr8fi4(&array[next], ntodo, scale, zero, (INT32BIT *) buffer, status); ffpi4b(fptr, ntodo, incre, (INT32BIT *) buffer, status); break; case (TFLOAT): ffr8fr4(&array[next], ntodo, scale, zero, (float *) buffer, status); ffpr4b(fptr, ntodo, incre, (float *) buffer, status); break; case (TSTRING): /* numerical column in an ASCII table */ if (cform[1] != 's') /* "%s" format is a string */ { ffr8fstr(&array[next], ntodo, scale, zero, cform, twidth, (char *) buffer, status); if (incre == twidth) /* contiguous bytes */ ffpbyt(fptr, ntodo * twidth, buffer, status); else ffpbytoff(fptr, twidth, ntodo, incre - twidth, buffer, status); break; } /* can't write to string column, so fall thru to default: */ default: /* error trap */ sprintf(message, "Cannot write numbers to column %d which has format %s", colnum,tform); ffpmsg(message); if (hdutype == ASCII_TBL) return(*status = BAD_ATABLE_FORMAT); else return(*status = BAD_BTABLE_FORMAT); } /* End of switch block */ /*-------------------------*/ /* Check for fatal error */ /*-------------------------*/ if (*status > 0) /* test for error during previous write operation */ { sprintf(message, "Error writing elements %.0f thru %.0f of input data array (ffpcld).", (double) (next+1), (double) (next+ntodo)); ffpmsg(message); return(*status); } /*--------------------------------------------*/ /* increment the counters for the next loop */ /*--------------------------------------------*/ remain -= ntodo; if (remain) { next += ntodo; elemnum += ntodo; if (elemnum == repeat) /* completed a row; start on next row */ { elemnum = 0; rownum++; } } } /* End of main while Loop */ /*--------------------------------*/ /* check for numerical overflow */ /*--------------------------------*/ if (*status == OVERFLOW_ERR) { ffpmsg( "Numerical overflow during type conversion while writing FITS data."); *status = NUM_OVERFLOW; } return(*status); } /*--------------------------------------------------------------------------*/ int ffpclm( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ double *array, /* I - array of values to write */ int *status) /* IO - error status */ /* Write an array of double complex values to a column in the current FITS HDU. Each complex number if interpreted as a pair of float values. The column number may refer to a real column in an ASCII or binary table, or it may refer to a virtual column in a 1 or more grouped FITS primary array. FITSIO treats a primary array as a binary table with 2 vector columns: the first column contains the group parameters (often with length = 0) and the second column contains the array of image pixels. Each row of the table represents a group in the case of multigroup FITS images. The input array of values will be converted to the datatype of the column if necessary, but normally complex values should only be written to a binary table with TFORMn = 'rM' where r is an optional repeat count. The TSCALn and TZERO keywords should not be used with complex numbers because mathmatically the scaling should only be applied to the real (first) component of the complex value. */ { /* simply multiply the number of elements by 2, and call ffpcld */ ffpcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2, array, status); return(*status); } /*--------------------------------------------------------------------------*/ int ffpcnd( fitsfile *fptr, /* I - FITS file pointer */ int colnum, /* I - number of column to write (1 = 1st col) */ LONGLONG firstrow, /* I - first row to write (1 = 1st row) */ LONGLONG firstelem, /* I - first vector element to write (1 = 1st) */ LONGLONG nelem, /* I - number of values to write */ double *array, /* I - array of values to write */ double nulvalue, /* I - value used to flag undefined pixels */ int *status) /* IO - error status */ /* Write an array of elements to the specified column of a table. Any input pixels equal to the value of nulvalue will be replaced by the appropriate null value in the output FITS file. The input array of values will be converted to the datatype of the column and will be inverse-scaled by the FITS TSCALn and TZEROn values if necessary */ { tcolumn *colptr; long ngood = 0, nbad = 0, ii; LONGLONG repeat, first, fstelm, fstrow; int tcode, overflow = 0; if (*status > 0) return(*status); /* reset position to the correct HDU if necessary */ if (fptr->HDUposition != (fptr->Fptr)->curhdu) { ffmahd(fptr, (fptr->HDUposition) + 1, NULL, status); } else if ((fptr->Fptr)->datastart == DATA_UNDEFINED) { if ( ffrdef(fptr, status) > 0) /* rescan header */ return(*status); } colptr = (fptr->Fptr)->tableptr; /* point to first column */ colptr += (colnum - 1); /* offset to correct column structure */ tcode = colptr->tdatatype; if (tcode > 0) repeat = colptr->trepeat; /* repeat count for this column */ else repeat = firstelem -1 + nelem; /* variable length arrays */ if (abs(tcode) >= TCOMPLEX) { /* treat complex columns as pairs of numbers */ repeat *= 2; } /* if variable length array, first write the whole input vector, then go back and fill in the nulls */ if (tcode < 0) { if (ffpcld(fptr, colnum, firstrow, firstelem, nelem, array, status) > 0) { if (*status == NUM_OVERFLOW) { /* ignore overflows, which are possibly the null pixel values */ /* overflow = 1; */ *status = 0; } else { return(*status); } } } /* absolute element number in the column */ first = (firstrow - 1) * repeat + firstelem; for (ii = 0; ii < nelem; ii++) { if (array[ii] != nulvalue) /* is this a good pixel? */ { if (nbad) /* write previous string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ /* call ffpcluc, not ffpclu, in case we are writing to a complex ('C') binary table column */ if (ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status) > 0) return(*status); nbad=0; } ngood = ngood +1; /* the consecutive number of good pixels */ } else { if (ngood) /* write previous string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ if (ffpcld(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status) > 0) { if (*status == NUM_OVERFLOW) { overflow = 1; *status = 0; } else { return(*status); } } } ngood=0; } nbad = nbad +1; /* the consecutive number of bad pixels */ } } /* finished loop; now just write the last set of pixels */ if (ngood) /* write last string of good pixels */ { fstelm = ii - ngood + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ if (tcode > 0) { /* variable length arrays have already been written */ ffpcld(fptr, colnum, fstrow, fstelm, ngood, &array[ii-ngood], status); } } else if (nbad) /* write last string of bad pixels */ { fstelm = ii - nbad + first; /* absolute element number */ fstrow = (fstelm - 1) / repeat + 1; /* starting row number */ fstelm = fstelm - (fstrow - 1) * repeat; /* relative number */ ffpcluc(fptr, colnum, fstrow, fstelm, nbad, status); } if (*status <= 0) { if (overflow) { *status = NUM_OVERFLOW; } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fi1(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ unsigned char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (input[ii] > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DUCHAR_MIN) { *status = OVERFLOW_ERR; output[ii] = 0; } else if (dvalue > DUCHAR_MAX) { *status = OVERFLOW_ERR; output[ii] = UCHAR_MAX; } else output[ii] = (unsigned char) (dvalue + .5); } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fi2(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ short *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (input[ii] > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else output[ii] = (short) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DSHRT_MIN) { *status = OVERFLOW_ERR; output[ii] = SHRT_MIN; } else if (dvalue > DSHRT_MAX) { *status = OVERFLOW_ERR; output[ii] = SHRT_MAX; } else { if (dvalue >= 0) output[ii] = (short) (dvalue + .5); else output[ii] = (short) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fi4(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ INT32BIT *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (input[ii] > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else output[ii] = (INT32BIT) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DINT_MIN) { *status = OVERFLOW_ERR; output[ii] = INT32_MIN; } else if (dvalue > DINT_MAX) { *status = OVERFLOW_ERR; output[ii] = INT32_MAX; } else { if (dvalue >= 0) output[ii] = (INT32BIT) (dvalue + .5); else output[ii] = (INT32BIT) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fi8(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ LONGLONG *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; double dvalue; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { if (input[ii] < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (input[ii] > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else output[ii] = (LONGLONG) input[ii]; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; if (dvalue < DLONGLONG_MIN) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MIN; } else if (dvalue > DLONGLONG_MAX) { *status = OVERFLOW_ERR; output[ii] = LONGLONG_MAX; } else { if (dvalue >= 0) output[ii] = (LONGLONG) (dvalue + .5); else output[ii] = (LONGLONG) (dvalue - .5); } } } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fr4(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ float *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) input[ii]; } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (float) ((input[ii] - zero) / scale); } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fr8(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ double *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do datatype conversion and scaling if required. */ { long ii; if (scale == 1. && zero == 0.) { memcpy(output, input, ntodo * sizeof(double) ); /* copy input to output */ } else { for (ii = 0; ii < ntodo; ii++) output[ii] = (input[ii] - zero) / scale; } return(*status); } /*--------------------------------------------------------------------------*/ int ffr8fstr(double *input, /* I - array of values to be converted */ long ntodo, /* I - number of elements in the array */ double scale, /* I - FITS TSCALn or BSCALE value */ double zero, /* I - FITS TZEROn or BZERO value */ char *cform, /* I - format for output string values */ long twidth, /* I - width of each field, in chars */ char *output, /* O - output array of converted values */ int *status) /* IO - error status */ /* Copy input to output prior to writing output to a FITS file. Do scaling if required. */ { long ii; double dvalue; char *cptr; cptr = output; if (scale == 1. && zero == 0.) { for (ii = 0; ii < ntodo; ii++) { sprintf(output, cform, input[ii]); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } else { for (ii = 0; ii < ntodo; ii++) { dvalue = (input[ii] - zero) / scale; sprintf(output, cform, dvalue); output += twidth; if (*output) /* if this char != \0, then overflow occurred */ *status = OVERFLOW_ERR; } } /* replace any commas with periods (e.g., in French locale) */ while ((cptr = strchr(cptr, ','))) *cptr = '.'; return(*status); } astropy-0.3/cextern/cfitsio/inftrees.h0000644000175000017500000000556012243255342016305 0ustar oleole/* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-2005, 2010 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* Structure for decoding tables. Each entry provides either the information needed to do the operation requested by the code that indexed that table entry, or it provides a pointer to another table that indexes more bits of the code. op indicates whether the entry is a pointer to another table, a literal, a length or distance, an end-of-block, or an invalid code. For a table pointer, the low four bits of op is the number of index bits of that table. For a length or distance, the low four bits of op is the number of extra bits to get after the code. bits is the number of bits in this code or part of the code to drop off of the bit buffer. val is the actual byte to output in the case of a literal, the base length or distance, or the offset from the current table to the next table. Each entry is four bytes. */ typedef struct { unsigned char op; /* operation, extra bits, table bits */ unsigned char bits; /* bits in this part of the code */ unsigned short val; /* offset in table or code value */ } code; /* op values as set by inflate_table(): 00000000 - literal 0000tttt - table link, tttt != 0 is the number of table index bits 0001eeee - length or distance, eeee is the number of extra bits 01100000 - end of block 01000000 - invalid code */ /* Maximum size of the dynamic table. The maximum number of code structures is 1444, which is the sum of 852 for literal/length codes and 592 for distance codes. These values were found by exhaustive searches using the program examples/enough.c found in the zlib distribtution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes returns returns 852, and "enough 30 6 15" for distance codes returns 592. The initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ #define ENOUGH_LENS 852 #define ENOUGH_DISTS 592 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) /* Type of code to build for inflate_table() */ typedef enum { CODES, LENS, DISTS } codetype; int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, unsigned codes, code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)); astropy-0.3/cextern/trim_wcslib.sh0000755000175000017500000000042512243255342015525 0ustar oleole#!/bin/sh # This script should be run every time wcslib is updated. # This removes extra large files from wcslib that aren't needed. rm -rf wcslib/C/test rm -rf wcslib/doxygen rm -rf wcslib/Fortran rm -rf wcslib/html rm -rf wcslib/pgsbox rm -rf wcslib/utils rm wcslib/*.pdf astropy-0.3/setup.cfg0000644000175000017500000000104312243255342013016 0ustar oleole[build_sphinx] source-dir = docs build-dir = docs/_build all_files = 1 [upload_docs] upload-dir = docs/_build/html show-response = 1 [pytest] minversion = 2.3.3 norecursedirs = "build" "docs[\/]_build" "astropy[\/]extern" "astropy[\/]utils[\/]compat" doctest_plus = enabled doctest_norecursedirs = "astropy[\/]sphinx" [bdist_dmg] background = .dmg_background.png # Note: The SVG source file for the DMG background image is located in the # repository at https://github.com/astropy/astropy-logo [bdist_wininst] bitmap = .wininst_background.bmp astropy-0.3/docs/0000755000175000017500000000000012243263747012137 5ustar oleoleastropy-0.3/docs/rtd-pip-requirements0000644000175000017500000000003712243255342016152 0ustar oleolenumpy>=1.5.0 matplotlib Cython astropy-0.3/docs/wcs/0000755000175000017500000000000012243263747012733 5ustar oleoleastropy-0.3/docs/wcs/examples/0000755000175000017500000000000012243263747014551 5ustar oleoleastropy-0.3/docs/wcs/examples/from_file.py0000644000175000017500000000245112243255342017057 0ustar oleole# Load the WCS information from a fits header, and use it # to convert pixel coordinates to world coordinates. from __future__ import division # confidence high import numpy from astropy import wcs from astropy.io import fits import sys def load_wcs_from_file(filename): # Load the FITS hdulist using astropy.io.fits hdulist = fits.open(sys.argv[-1]) # Parse the WCS keywords in the primary HDU w = wcs.WCS(hdulist[0].header) # Print out the "name" of the WCS, as defined in the FITS header print w.wcs.name # Print out all of the settings that were parsed from the header w.wcs.print_contents() # Some pixel coordinates of interest. pixcrd = numpy.array([[0,0],[24,38],[45,98]], numpy.float_) # Convert pixel coordinates to world coordinates # The second argument is "origin" -- in this case we're declaring we # have 1-based (Fortran-like) coordinates. world = w.wcs_pix2world(pixcrd, 1) print world # Convert the same coordinates back to pixel coordinates. pixcrd2 = w.wcs_world2pix(world, 1) print pixcrd2 # These should be the same as the original pixel coordinates, modulo # some floating-point error. assert numpy.max(numpy.abs(pixcrd - pixcrd2)) < 1e-6 if __name__ == '__main__': load_wcs_from_file(sys.argv[-1]) astropy-0.3/docs/wcs/examples/programmatic.py0000644000175000017500000000241312243255342017600 0ustar oleole# Set the WCS information manually by setting properties of the WCS # object. from __future__ import division # confidence high import numpy from astropy import wcs from astropy.io import fits import sys # Create a new WCS object. The number of axes must be set # from the start w = wcs.WCS(naxis=2) # Set up an "Airy's zenithal" projection # Vector properties may be set with Python lists, or Numpy arrays w.wcs.crpix = [-234.75, 8.3393] w.wcs.cdelt = numpy.array([-0.066667, 0.066667]) w.wcs.crval = [0, -90] w.wcs.ctype = ["RA---AIR", "DEC--AIR"] w.wcs.set_pv([(2, 1, 45.0)]) # Some pixel coordinates of interest. pixcrd = numpy.array([[0,0],[24,38],[45,98]], numpy.float_) # Convert pixel coordinates to world coordinates world = w.wcs_pix2world(pixcrd, 1) print world # Convert the same coordinates back to pixel coordinates. pixcrd2 = w.wcs_world2pix(world, 1) print pixcrd2 # These should be the same as the original pixel coordinates, modulo # some floating-point error. assert numpy.max(numpy.abs(pixcrd - pixcrd2)) < 1e-6 # Now, write out the WCS object as a FITS header header = w.to_header() # header is an astropy.io.fits.Header object. We can use it to create a new # PrimaryHDU and write it to a file. hdu = fits.PrimaryHDU(header=header) hdu.writeto('test.fits') astropy-0.3/docs/wcs/history.rst0000644000175000017500000000545012243255342015162 0ustar oleoleastropy.wcs History =================== `astropy.wcs` began life as `pywcs`. Earlier version numbers refer to that package. pywcs Version 1.11 ------------------ - Updated to wcslib version 4.8, which gives much more detailed error messages. - Added functions get_pc() and get_cdelt(). These provide a way to always get the canonical representation of the linear transformation matrix, whether the header specified it in PC, CD or CROTA form. - Long-running process will now release the Python GIL to better support Python multithreading. - The dimensions of the `~astropy.wcs.Wcsprm.cd` and `~astropy.wcs.Wcsprm.pc` matrices were always returned as 2x2. They now are sized according to naxis. - Supports Python 3.x - Builds on Microsoft Windows without severely patching wcslib. - Lots of new unit tests - `pywcs` will now run without `pyfits`, though the SIP and distortion lookup table functionality is unavailable. - Setting `~astropy.wcs.Wcsprm.cunit` will now verify that the values are valid unit strings. pywcs Version 1.10 ------------------ - Adds a `UnitConversion` class, which gives access to wcslib's unit conversion functionality. Given two convertible unit strings, pywcs can convert arrays of values from one to the other. - Now uses wcslib 4.7 - Changes to some wcs values would not always calculate secondary values. pywcs Version 1.9 ----------------- - Support binary image arrays and pixel list format WCS by presenting a way to call wcslib's `wcsbth()` - Updated underlying wcslib to version 4.5, which fixes the following: - Fixed the interpretation of VELREF when translating AIPS-convention spectral types. Such translation is now handled by a new special- purpose function, spcaips(). The wcsprm struct has been augmented with an entry for velref which is filled by wcspih() and wcsbth(). Previously, selection by VELREF of the radio or optical velocity convention for type VELO was not properly handled. Bugs ```` - The `~astropy.wcs.Wcsprm.pc` member is now available with a default raw `~astropy.wcs.Wcsprm` object. - Make properties that return arrays read-only, since modifying a (mutable) array could result in secondary values not being recomputed based on those changes. - `float` properties can now be set using `int` values pywcs Version 1.3a1 ------------------- Earlier versions of pywcs had two versions of every conversion method:: X(...) -- treats the origin of pixel coordinates at (0, 0) X_fits(...) -- treats the origin of pixel coordinates at (1, 1) From version 1.3 onwards, there is only one method for each conversion, with an 'origin' argument: - 0: places the origin at (0, 0), which is the C/Numpy convention. - 1: places the origin at (1, 1), which is the Fortran/FITS convention. astropy-0.3/docs/wcs/relax.rst0000644000175000017500000003543212243255342014577 0ustar oleole.. include:: references.txt .. _relax: Relax constants =============== The `relax` keyword argument controls the handling of non-standard FITS WCS keywords. Note that the default value of `relax` is `True` for reading (to accept all non standard keywords), and `False` for writing (to write out only standard keywords), in accordance with `Postel's prescription `_: “Be liberal in what you accept, and conservative in what you send.†.. _relaxread: Header-reading relaxation constants ----------------------------------- `~astropy.wcs.WCS`, `~astropy.wcs.Wcsprm` and `~astropy.wcs.find_all_wcs` have a *relax* argument, which may be either `True`, `False` or an `int`. - If `True`, (default), all non-standard WCS extensions recognized by the parser will be handled. - If `False`, none of the extensions (even those in the errata) will be handled. Non-conformant keywords will be handled in the same way as non-WCS keywords in the header, i.e. by simply ignoring them. - If an `int`, is is a bit field to provide fine-grained control over what non-standard WCS keywords to accept. The flag bits are subject to change in future and should be set by using the constants beginning with ``WCSHDR_`` in the `astropy.wcs` module. For example, to accept ``CD00i00j`` and ``PC00i00j`` use:: relax = astropy.wcs.WCSHDR_CD00i00j | astropy.wcs.WCSHDR_PC00i00j The parser always treats ``EPOCH`` as subordinate to ``EQUINOXa`` if both are present, and ``VSOURCEa`` is always subordinate to ``ZSOURCEa``. Likewise, ``VELREF`` is subordinate to the formalism of WCS Paper III. The flag bits are: - `WCSHDR_none`: Don't accept any extensions (not even those in the errata). Treat non-conformant keywords in the same way as non-WCS keywords in the header, i.e. simply ignore them. (This is equivalent to passing `False`) - `WCSHDR_all`: Accept all extensions recognized by the parser. (This is equivalent to the default behavior or passing `True`). - `WCSHDR_CROTAia`: Accept ``CROTAia``, ``iCROTna``, ``TCROTna`` - `WCSHDR_EPOCHa`: Accept ``EPOCHa``. - `WCSHDR_VELREFa`: Accept ``VELREFa``. The constructor always recognizes the AIPS-convention keywords, ``CROTAn``, ``EPOCH``, and ``VELREF`` for the primary representation ``(a = ' ')`` but alternates are non-standard. The constructor accepts ``EPOCHa`` and ``VELREFa`` only if `WCSHDR_AUXIMG` is also enabled. - `WCSHDR_CD00i00j`: Accept ``CD00i00j``. - `WCSHDR_PC00i00j`: Accept ``PC00i00j``. - `WCSHDR_PROJPn`: Accept ``PROJPn``. These appeared in early drafts of WCS Paper I+II (before they were split) and are equivalent to ``CDi_ja``, ``PCi_ja``, and ``PVi_ma`` for the primary representation ``(a = ' ')``. ``PROJPn`` is equivalent to ``PVi_ma`` with ``m`` = ``n`` <= 9, and is associated exclusively with the latitude axis. - `WCSHDR_RADECSYS`: Accept ``RADECSYS``. This appeared in early drafts of WCS Paper I+II and was subsequently replaced by ``RADESYSa``. The construtor accepts ``RADECSYS`` only if `WCSHDR_AUXIMG` is also enabled. - `WCSHDR_VSOURCE`: Accept ``VSOURCEa`` or ``VSOUna``. This appeared in early drafts of WCS Paper III and was subsequently dropped in favour of ``ZSOURCEa`` and ``ZSOUna``. The constructor accepts ``VSOURCEa`` only if `WCSHDR_AUXIMG` is also enabled. - `WCSHDR_DOBSn`: Allow ``DOBSn``, the column-specific analogue of ``DATE-OBS``. By an oversight this was never formally defined in the standard. - `WCSHDR_LONGKEY`: Accept long forms of the alternate binary table and pixel list WCS keywords, i.e. with "a" non- blank. Specifically:: jCRPXna TCRPXna : jCRPXn jCRPna TCRPXn TCRPna CRPIXja - TPCn_ka : - ijPCna - TPn_ka PCi_ja - TCDn_ka : - ijCDna - TCn_ka CDi_ja iCDLTna TCDLTna : iCDLTn iCDEna TCDLTn TCDEna CDELTia iCUNIna TCUNIna : iCUNIn iCUNna TCUNIn TCUNna CUNITia iCTYPna TCTYPna : iCTYPn iCTYna TCTYPn TCTYna CTYPEia iCRVLna TCRVLna : iCRVLn iCRVna TCRVLn TCRVna CRVALia iPVn_ma TPVn_ma : - iVn_ma - TVn_ma PVi_ma iPSn_ma TPSn_ma : - iSn_ma - TSn_ma PSi_ma where the primary and standard alternate forms together with the image-header equivalent are shown rightwards of the colon. The long form of these keywords could be described as quasi- standard. ``TPCn_ka``, ``iPVn_ma``, and ``TPVn_ma`` appeared by mistake in the examples in WCS Paper II and subsequently these and also ``TCDn_ka``, ``iPSn_ma`` and ``TPSn_ma`` were legitimized by the errata to the WCS papers. Strictly speaking, the other long forms are non-standard and in fact have never appeared in any draft of the WCS papers nor in the errata. However, as natural extensions of the primary form they are unlikely to be written with any other intention. Thus it should be safe to accept them provided, of course, that the resulting keyword does not exceed the 8-character limit. If ``WCSHDR_CNAMn`` is enabled then also accept:: iCNAMna TCNAMna : --- iCNAna --- TCNAna CNAMEia iCRDEna TCRDEna : --- iCRDna --- TCRDna CRDERia iCSYEna TCSYEna : --- iCSYna --- TCSYna CSYERia Note that ``CNAMEia``, ``CRDERia``, ``CSYERia``, and their variants are not used by `astropy.wcs` but are stored as auxiliary information. - `WCSHDR_CNAMn`: Accept ``iCNAMn``, ``iCRDEn``, ``iCSYEn``, ``TCNAMn``, ``TCRDEn``, and ``TCSYEn``, i.e. with ``a`` blank. While non-standard, these are the obvious analogues of ``iCTYPn``, ``TCTYPn``, etc. - `WCSHDR_AUXIMG`: Allow the image-header form of an auxiliary WCS keyword with representation-wide scope to provide a default value for all images. This default may be overridden by the column-specific form of the keyword. For example, a keyword like ``EQUINOXa`` would apply to all image arrays in a binary table, or all pixel list columns with alternate representation ``a`` unless overridden by ``EQUIna``. Specifically the keywords are:: LATPOLEa for LATPna LONPOLEa for LONPna RESTFREQ for RFRQna RESTFRQa for RFRQna RESTWAVa for RWAVna whose keyvalues are actually used by WCSLIB, and also keywords that provide auxiliary information that is simply stored in the wcsprm struct:: EPOCH - ... (No column-specific form.) EPOCHa - ... Only if WCSHDR_EPOCHa is set. EQUINOXa for EQUIna RADESYSa for RADEna RADECSYS for RADEna ... Only if WCSHDR_RADECSYS is set. SPECSYSa for SPECna SSYSOBSa for SOBSna SSYSSRCa for SSRCna VELOSYSa for VSYSna VELANGLa for VANGna VELREF - ... (No column-specific form.) VELREFa - ... Only if WCSHDR_VELREFa is set. VSOURCEa for VSOUna ... Only if WCSHDR_VSOURCE is set. WCSNAMEa for WCSNna ... Or TWCSna (see below). ZSOURCEa for ZSOUna DATE-AVG for DAVGn DATE-OBS for DOBSn MJD-AVG for MJDAn MJD-OBS for MJDOBn OBSGEO-X for OBSGXn OBSGEO-Y for OBSGYn OBSGEO-Z for OBSGZn where the image-header keywords on the left provide default values for the column specific keywords on the right. Keywords in the last group, such as ``MJD-OBS``, apply to all alternate representations, so ``MJD-OBS`` would provide a default value for all images in the header. This auxiliary inheritance mechanism applies to binary table image arrays and pixel lists alike. Most of these keywords have no default value, the exceptions being ``LONPOLEa`` and ``LATPOLEa``, and also ``RADESYSa`` and ``EQUINOXa`` which provide defaults for each other. Thus the only potential difficulty in using `WCSHDR_AUXIMG` is that of erroneously inheriting one of these four keywords. Unlike `WCSHDR_ALLIMG`, the existence of one (or all) of these auxiliary WCS image header keywords will not by itself cause a `~astropy.wcs.Wcsprm` object to be created for alternate representation ``a``. This is because they do not provide sufficient information to create a non-trivial coordinate representation when used in conjunction with the default values of those keywords, such as ``CTYPEia``, that are parameterized by axis number. - `WCSHDR_ALLIMG`: Allow the image-header form of *all* image header WCS keywords to provide a default value for all image arrays in a binary table (n.b. not pixel list). This default may be overridden by the column-specific form of the keyword. For example, a keyword like ``CRPIXja`` would apply to all image arrays in a binary table with alternate representation ``a`` unless overridden by ``jCRPna``. Specifically the keywords are those listed above for `WCSHDR_AUXIMG` plus:: WCSAXESa for WCAXna which defines the coordinate dimensionality, and the following keywords which are parameterized by axis number:: CRPIXja for jCRPna PCi_ja for ijPCna CDi_ja for ijCDna CDELTia for iCDEna CROTAi for iCROTn CROTAia - ... Only if WCSHDR_CROTAia is set. CUNITia for iCUNna CTYPEia for iCTYna CRVALia for iCRVna PVi_ma for iVn_ma PSi_ma for iSn_ma CNAMEia for iCNAna CRDERia for iCRDna CSYERia for iCSYna where the image-header keywords on the left provide default values for the column specific keywords on the right. This full inheritance mechanism only applies to binary table image arrays, not pixel lists, because in the latter case there is no well-defined association between coordinate axis number and column number. Note that ``CNAMEia``, ``CRDERia``, ``CSYERia``, and their variants are not used by pywcs but are stored in the `~astropy.wcs.Wcsprm` object as auxiliary information. Note especially that at least one `~astropy.wcs.Wcsprm` object will be returned for each ``a`` found in one of the image header keywords listed above: - If the image header keywords for ``a`` **are not** inherited by a binary table, then the struct will not be associated with any particular table column number and it is up to the user to provide an association. - If the image header keywords for ``a`` **are** inherited by a binary table image array, then those keywords are considered to be "exhausted" and do not result in a separate `~astropy.wcs.Wcsprm` object. .. _relaxwrite: Header-writing relaxation constants ----------------------------------- `~astropy.wcs.WCS.to_header` and `~astropy.wcs.WCS.to_header_string` has a *relax* argument which may be either `True`, `False` or an `int`. - If `True`, write all recognized extensions. - If `False` (default), write all extensions that are considered to be safe and recommended, equivalent to `WCSHDO_safe` (described below). - If an `int`, is is a bit field to provide fine-grained control over what non-standard WCS keywords to accept. The flag bits are subject to change in future and should be set by using the constants beginning with ``WCSHDO_`` in the `astropy.wcs` module. The flag bits are: - `WCSHDO_none`: Don't use any extensions. - `WCSHDO_all`: Write all recognized extensions, equivalent to setting each flag bit. - `WCSHDO_safe`: Write all extensions that are considered to be safe and recommended. - `WCSHDO_DOBSn`: Write ``DOBSn``, the column-specific analogue of ``DATE-OBS`` for use in binary tables and pixel lists. WCS Paper III introduced ``DATE-AVG`` and ``DAVGn`` but by an oversight ``DOBSn`` (the obvious analogy) was never formally defined by the standard. The alternative to using ``DOBSn`` is to write ``DATE-OBS`` which applies to the whole table. This usage is considered to be safe and is recommended. - `WCSHDO_TPCn_ka`: WCS Paper I defined - ``TPn_ka`` and ``TCn_ka`` for pixel lists but WCS Paper II uses ``TPCn_ka`` in one example and subsequently the errata for the WCS papers legitimized the use of - ``TPCn_ka`` and ``TCDn_ka`` for pixel lists provided that the keyword does not exceed eight characters. This usage is considered to be safe and is recommended because of the non-mnemonic terseness of the shorter forms. - `WCSHDO_PVn_ma`: WCS Paper I defined - ``iVn_ma`` and ``iSn_ma`` for bintables and - ``TVn_ma`` and ``TSn_ma`` for pixel lists but WCS Paper II uses ``iPVn_ma`` and ``TPVn_ma`` in the examples and subsequently the errata for the WCS papers legitimized the use of - ``iPVn_ma`` and ``iPSn_ma`` for bintables and - ``TPVn_ma`` and ``TPSn_ma`` for pixel lists provided that the keyword does not exceed eight characters. This usage is considered to be safe and is recommended because of the non-mnemonic terseness of the shorter forms. - `WCSHDO_CRPXna`: For historical reasons WCS Paper I defined - ``jCRPXn``, ``iCDLTn``, ``iCUNIn``, ``iCTYPn``, and ``iCRVLn`` for bintables and - ``TCRPXn``, ``TCDLTn``, ``TCUNIn``, ``TCTYPn``, and ``TCRVLn`` for pixel lists for use without an alternate version specifier. However, because of the eight-character keyword constraint, in order to accommodate column numbers greater than 99 WCS Paper I also defined - ``jCRPna``, ``iCDEna``, ``iCUNna``, ``iCTYna`` and ``iCRVna`` for bintables and - ``TCRPna``, ``TCDEna``, ``TCUNna``, ``TCTYna`` and ``TCRVna`` for pixel lists for use with an alternate version specifier (the ``a``). Like the ``PC``, ``CD``, ``PV``, and ``PS`` keywords there is an obvious tendency to confuse these two forms for column numbers up to 99. It is very unlikely that any parser would reject keywords in the first set with a non-blank alternate version specifier so this usage is considered to be safe and is recommended. - `WCSHDO_CNAMna`: WCS Papers I and III defined - ``iCNAna``, ``iCRDna``, and ``iCSYna`` for bintables and - ``TCNAna``, ``TCRDna``, and ``TCSYna`` for pixel lists By analogy with the above, the long forms would be - ``iCNAMna``, ``iCRDEna``, and ``iCSYEna`` for bintables and - ``TCNAMna``, ``TCRDEna``, and ``TCSYEna`` for pixel lists Note that these keywords provide auxiliary information only, none of them are needed to compute world coordinates. This usage is potentially unsafe and is not recommended at this time. - `WCSHDO_WCSNna`: Write ``WCSNna`` instead of ``TWCSna`` for pixel lists. While the constructor treats ``WCSNna`` and ``TWCSna`` as equivalent, other parsers may not. Consequently, this usage is potentially unsafe and is not recommended at this time. - `WCSHDO_SIP`: Write out Simple Imaging Polynomial (SIP) keywords. astropy-0.3/docs/wcs/references.txt0000644000175000017500000000050012243255342015600 0ustar oleole.. _wcslib: http://www.atnf.csiro.au/~mcalabre/WCS/ .. _pyfits: http://www.stsci.edu/resources/software_hardware/pyfits .. _Paper IV: http://www.atnf.csiro.au/people/mcalabre/WCS/index.html .. _SIP: http://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf .. _ds9: http://hea-www.harvard.edu/RD/ds9/ astropy-0.3/docs/wcs/index.rst0000644000175000017500000001027712243255342014573 0ustar oleole.. _astropy-wcs: *************************************** World Coordinate System (`astropy.wcs`) *************************************** .. _wcslib: http://www.atnf.csiro.au/~mcalabre/WCS/ .. _Paper IV: http://www.atnf.csiro.au/people/mcalabre/WCS/index.html .. _SIP: http://irsa.ipac.caltech.edu/data/SPITZER/docs/files/spitzer/shupeADASS.pdf .. _ds9: http://hea-www.harvard.edu/RD/ds9/ Introduction ============ `astropy.wcs` contains utilities for managing World Coordinate System (WCS) transformations in FITS files. These transformations map the pixel locations in an image to their real-world units, such as their position on the sky sphere. It is at its base a wrapper around Mark Calabretta's `wcslib`_, but also adds support for the Simple Imaging Polynomial (`SIP`_) convention and table lookup distortions as defined in WCS `Paper IV`_. Each of these transformations can be used independently or together in a standard pipeline. Getting Started =============== The basic workflow is as follows: 1. ``from astropy import wcs`` 2. Call the `~astropy.wcs.wcs.WCS` constructor with an `astropy.io.fits` header and/or hdulist object. 3. Optionally, if the FITS file uses any deprecated or non-standard features, you may need to call one of the `~astropy.wcs.wcs.WCS.fix` methods on the object. 4. Use one of the following transformation methods: - `~astropy.wcs.wcs.WCS.all_pix2world`: Perform all three transformations from pixel to world coordinates. - `~astropy.wcs.wcs.WCS.wcs_pix2world`: Perform just the core WCS transformation from pixel to world coordinates. - `~astropy.wcs.wcs.WCS.wcs_world2pix`: Perform just the core WCS transformation from world to pixel coordinates. - `~astropy.wcs.wcs.WCS.sip_pix2foc`: Convert from pixel to focal plane coordinates using the `SIP`_ polynomial coefficients. - `~astropy.wcs.wcs.WCS.sip_foc2pix`: Convert from focal plane to pixel coordinates using the `SIP`_ polynomial coefficients. - `~astropy.wcs.wcs.WCS.p4_pix2foc`: Convert from pixel to focal plane coordinates using the table lookup distortion method described in `Paper IV`_. - `~astropy.wcs.wcs.WCS.det2im`: Convert from detector coordinates to image coordinates. Commonly used for narrow column correction. Using `astropy.wcs` =================== Loading WCS information from a FITS file ---------------------------------------- This example loads a FITS file (supplied on the commandline) and uses the WCS cards in its primary header to transform. .. literalinclude:: examples/from_file.py :language: python Building a WCS structure programmatically ----------------------------------------- This example, rather than starting from a FITS header, sets WCS values programmatically, uses those settings to transform some points, and then saves those settings to a new FITS header. .. literalinclude:: examples/programmatic.py :language: python Validating the WCS keywords in a FITS file ------------------------------------------ `astropy` includes a commandline tool, `wcslint` to check the WCS keywords in a FITS file:: > wcslint invalid.fits HDU 1: WCS key ' ': - RADECSYS= 'ICRS ' / Astrometric system RADECSYS is non-standard, use RADESYSa. - The WCS transformation has more axes (2) than the image it is associated with (0) - 'celfix' made the change 'PV1_5 : Unrecognized coordinate transformation parameter'. HDU 2: WCS key ' ': - The WCS transformation has more axes (3) than the image it is associated with (0) - 'celfix' made the change 'In CUNIT2 : Mismatched units type 'length': have 'Hz', want 'm''. - 'unitfix' made the change 'Changed units: 'HZ ' -> 'Hz''. Other information ================= .. toctree:: :maxdepth: 1 relax history See Also ======== - `wcslib`_ Reference/API ============= .. automodapi:: astropy.wcs Acknowledgments and Licenses ============================ wcslib is licenced under the `GNU Lesser General Public License `_. astropy-0.3/docs/_pkgtemplate.rst0000644000175000017500000000470712243255342015345 0ustar oleole**************************************************** A description of the package (`astropy.packagename`) **************************************************** When creating a new subpackage's docuementation, this file should be copied to a file "index.rst" in a directory corresponding to the name of the package. E.g., ``docs/packagename/index.rst``. And don't forget to delete this paragraph. Introduction ============ Include general content that might be useful for understanding the package here, as well as general scientific or mathematical background that might be necessary for the "big-picture" of this package. Getting Started =============== Short tutorial-like examples of how to do common-tasks - should be fairly quick, with any more detailed examples in the next section. Using `packagename` =================== .. THIS SECTION SHOULD BE EITHER This section is for the detailed documentation. For simpler packages, this should either by paragraphs or sub-divided into sub-sections like: Sub-topic 1 ----------- Content if needed A Complex example ----------------- Content if needed Sub-sub topic 1 ^^^^^^^^^^^^^^^^ Content if needed (note the use of ^^^^ at this level). Sub-sub-sub topic 1 """"""""""""""""""" Content if needed (note the use of """"" at this level). This is probably the deepest level that is practical. However, just in case, the next levels of detail should use the +, :, and ~ characters respectively. .. OR IF MORE COMPLICATED, For more complicated packages that require multiple documents, this should just be a table of contents referencing those documents: .. toctree:: subdoc1 subdoc2 subdoc3 Either a toctree or sub-sections should be used, *not* both. For example, if your toctree looks like the above example, this document should be ``docs/packagename/index.rst``, and the other documents should be ``docs/packagename/subdoc1.rst``, ``docs/packagename/subdoc2.rst``, and ``docs/packagename/subdoc3.rst``. In the "more complicated" case of using ``subdoc.rst`` files, each of those should likewise use the section character header order of ``* = - ^ " + : ~``. See Also (optional) =================== Include here any references to related packages, articles, or texts. Reference/API ============= .. automodapi:: packagename Acknowledgments and Licenses (optional) ======================================= Any acknowledgements or licenses needed for this package - remove the section if none are necessary. astropy-0.3/docs/io/0000755000175000017500000000000012243263747012546 5ustar oleoleastropy-0.3/docs/io/ascii/0000755000175000017500000000000012243263747013636 5ustar oleoleastropy-0.3/docs/io/ascii/extension_classes.rst0000644000175000017500000000402112243255342020106 0ustar oleole.. include:: references.txt .. _extension_reader_classes: Extension Reader classes ------------------------ The following classes extend the base :class:`~astropy.io.ascii.core.BaseReader` functionality to handle reading and writing different table formats. Some, such as the :class:`~astropy.io.ascii.Basic` Reader class are fairly general and include a number of configurable attributes. Others such as :class:`~astropy.io.ascii.Cds` or :class:`~astropy.io.ascii.Daophot` are specialized to read certain well-defined but idiosyncratic formats. * :class:`~astropy.io.ascii.latex.AASTex`: AASTeX `deluxetable` used for AAS journals * :class:`~astropy.io.ascii.basic.Basic`: basic table with customizable delimiters and header configurations * :class:`~astropy.io.ascii.cds.Cds`: `CDS format table `_ (also Vizier and ApJ machine readable tables) * :class:`~astropy.io.ascii.basic.CommentedHeader`: column names given in a line that begins with the comment character * :class:`~astropy.io.ascii.daophot.Daophot`: table from the IRAF DAOphot package * :class:`~astropy.io.ascii.fixedwidth.FixedWidth`: table with fixed-width columns (see also :ref:`fixed_width_gallery`) * :class:`~astropy.io.ascii.fixedwidth.FixedWidthNoHeader`: table with fixed-width columns and no header * :class:`~astropy.io.ascii.fixedwidth.FixedWidthTwoLine`: table with fixed-width columns and a two-line header * :class:`~astropy.io.ascii.ipac.Ipac`: `IPAC format table `_ * :class:`~astropy.io.ascii.latex.Latex`: LaTeX table with datavalue in the `tabular` environment * :class:`~astropy.io.ascii.basic.NoHeader`: basic table with no header where columns are auto-named * :class:`~astropy.io.ascii.basic.Rdb`: tab-separated values with an extra line after the column definition line * :class:`~astropy.io.ascii.sextractor.SExtractor`: `SExtractor format table `_ * :class:`~astropy.io.ascii.basic.Tab`: tab-separated values astropy-0.3/docs/io/ascii/write.rst0000644000175000017500000001774612243255342015531 0ustar oleole.. include:: references.txt .. _astropy.io.ascii_write: Writing tables -------------- :mod:`astropy.io.ascii` is able to write ASCII tables out to a file or file-like object using the same class structure and basic user interface as for reading tables. The |write| function provides a way to write a data table as a formatted ASCII table. For example:: >>> import numpy as np >>> from astropy.io import ascii >>> x = np.array([1, 2, 3]) >>> y = x ** 2 >>> ascii.write([x, y], 'values.dat', names=['x', 'y']) The ``values.dat`` file will then contain:: x y 1 1 2 4 3 9 Most of the input table :ref:`supported_formats` for reading are also available for writing. This provides a great deal of flexibility in the format for writing. The example below writes the data as a LaTeX table, using the option to send the output to ``sys.stdout`` instead of a file:: >>> ascii.write(data, format='latex') # doctest: +SKIP \begin{table} \begin{tabular}{cc} x & y \\ 1 & 1 \\ 2 & 4 \\ 3 & 9 \\ \end{tabular} \end{table} Input data format ^^^^^^^^^^^^^^^^^ The input `table` argument to |write| can be any value that is supported for initializing a |Table| object. This is documented in detail in the :ref:`construct_table` section and includes creating a table with a list of columns, a dictionary of columns, or from `numpy` arrays (either structured or homogeneous). The sections below show a few examples. Table or NumPy structured array """"""""""""""""""""""""""""""" An AstroPy |Table| object or a NumPy `structured array`_ (or record array) can serve as input to the |write| function. :: >>> from astropy.io import ascii >>> from astropy.table import Table >>> data = Table({'a': [1, 2, 3], ... 'b': [4.0, 5.0, 6.0]}, ... names=['a', 'b']) >>> ascii.write(data) a b 1 4.0 2 5.0 3 6.0 >>> data = np.array([(1, 2., 'Hello'), (2, 3., "World")], ... dtype=('i4,f4,a10')) >>> ascii.write(data) f0 f1 f2 1 2.0 Hello 2 3.0 World The output of :mod:`astropy.io.ascii.read` is a |Table| or NumPy array data object that can be an input to the |write| function. :: >>> data = ascii.read('t/daophot.dat', format='daophot') # doctest: +SKIP >>> ascii.write(data, 'space_delimited_table.dat') # doctest: +SKIP List of lists """"""""""""" A list of Python lists (or any iterable object) can be used as input:: >>> x = [1, 2, 3] >>> y = [4, 5.2, 6.1] >>> z = ['hello', 'world', '!!!'] >>> data = [x, y, z] >>> ascii.write(data) col0 col1 col2 1 4.0 hello 2 5.2 world 3 6.1 !!! The `data` object does not contain information about the column names so |Table| has chosen them automatically. To specify the names, provide the `names` keyword argument. This example also shows excluding one of the columns from the output:: >>> ascii.write(data, names=['x', 'y', 'z'], exclude_names=['y']) x z 1 hello 2 world 3 !!! Dict of lists """"""""""""" A dictionary containing iterable objects can serve as input to |write|. Each dict key is taken as the column name while the value must be an iterable object containing the corresponding column values. Since a Python dictionary is not ordered the output column order will be unpredictable unless the ``names`` argument is provided. :: >>> data = {'x': [1, 2, 3], ... 'y': [4, 5.2, 6.1], ... 'z': ['hello', 'world', '!!!']} >>> ascii.write(data, names=['x', 'y', 'z']) x y z 1 4.0 hello 2 5.2 world 3 6.1 !!! .. _io_ascii_write_parameters: Parameters for ``write()`` ^^^^^^^^^^^^^^^^^^^^^^^^^^ The |write| function accepts a number of parameters that specify the detailed output table format. Each of the :ref:`supported_formats` is handled by a corresponding Writer class that can define different defaults, so the descriptions below sometimes mention "typical" default values. This refers to the :class:`~astropy.io.ascii.Basic` writer and other similar Writer classes. Some output format Writer classes, e.g. :class:`~astropy.io.ascii.Latex` or :class:`~astropy.io.ascii.AASTex` accept additional keywords, that can customize the output further. See the documentation of these classes for details. **output** : output specifier There are two ways to specify the output for the write operation: - Name of a file (string) - File-like object (from open(), StringIO, etc) **table** : input table Any value that is supported for initializing a |Table| object (see :ref:`construct_table`). **format** : output format (default='basic') This specifies the format of the ASCII table to be written, for example if it is a basic character delimited table, fixed format table, or a CDS-compatible table, etc. The value of this parameter must be one of the :ref:`supported_formats`. **delimiter** : column delimiter string A one-character string used to separate fields which typically defaults to the space character. Other common values might be "," or "|" or "\\t". **comment** : string defining a comment line in table For the :class:`~astropy.io.ascii.Basic` Writer this defaults to "#". Which and how comments are written depends on the format chosen (e.g. :class:`~astropy.io.ascii.CommentedHeader` puts the comment symbol in the line with the column names). **formats**: dict of data type converters For each key (column name) use the given value to convert the column data to a string. If the format value is string-like then it is used as a Python format statement, e.g. '%0.2f' % value. If it is a callable function then that function is called with a single argument containing the column value to be converted. Example:: astropy.io.ascii.write(table, sys.stdout, formats={'XCENTER': '%12.1f', 'YCENTER': lambda x: round(x, 1)}, **names**: list of names corresponding to each data column Define the complete list of names for each data column. This will override names determined from the data table (if available). If not supplied then use names from the data table or auto-generated names. **include_names**: list of names to include in output From the list of column names found from the data table or the ``names`` parameter, select for output only columns within this list. If not supplied then include all names. **exclude_names**: list of names to exclude from output Exclude these names from the list of output columns. This is applied *after* the ``include_names`` filtering. If not specified then no columns are excluded. **fill_values**: fill value specifier of lists This can be used to fill missing values in the table or replace values with special meaning. The syntax is the same as used on input. See the :ref:`replace_bad_or_missing_values` section for more information on the syntax. When writing a table, all values are converted to strings, before any value is replaced. Thus, you need to provide the string representation (stripped of whitespace) for each value. Example:: astropy.io.ascii.write(table, fill_values = [('nan', 'no data'), ('-999.0', 'no data')]) **fill_include_names**: list of column names, which are affected by ``fill_values``. If not supplied, then ``fill_values`` can affect all columns. **fill_exclude_names**: list of column names, which are not affected by ``fill_values``. If not supplied, then ``fill_values`` can affect all columns. **Writer** : Writer class (*deprecated* in favor of ``format``) This specifies the top-level format of the ASCII table to be written, for example if it is a basic character delimited table, fixed format table, or a CDS-compatible table, etc. The value of this parameter must be a Writer class. For basic usage this means one of the built-in :ref:`extension_reader_classes`. Note: Reader classes and Writer classes are synonymous, in other words Reader classes can also write, but for historical reasons they are often called Reader classes. astropy-0.3/docs/io/ascii/base_classes.rst0000644000175000017500000000226312243255342017012 0ustar oleole.. include:: references.txt .. _base_class_elements: Base class elements ---------------------------- The key elements in :mod:`astropy.io.ascii` are: * :class:`~astropy.io.ascii.core.Column`: Internal storage of column properties and data () * :class:`Reader `: Base class to handle reading and writing tables. * :class:`Inputter `: Get the lines from the table input. * :class:`Splitter `: Split the lines into string column values. * :class:`Header `: Initialize output columns based on the table header or user input. * :class:`Data `: Populate column data from the table. * :class:`Outputter `: Convert column data to the specified output format, e.g. `numpy` structured array. Each of these elements is an inheritable class with attributes that control the corresponding functionality. In this way the large number of tweakable parameters is modularized into managable groups. Where it makes sense these attributes are actually functions that make it easy to handle special cases. astropy-0.3/docs/io/ascii/references.txt0000644000175000017500000000035412243255342016512 0ustar oleole.. |read| replace:: :func:`~astropy.io.ascii.ui.read` .. |write| replace:: :func:`~astropy.io.ascii.ui.write` .. |Table| replace:: :class:`~astropy.table.Table` .. _structured array: http://docs.scipy.org/doc/numpy/user/basics.rec.html astropy-0.3/docs/io/ascii/index.rst0000644000175000017500000001654612243255342015503 0ustar oleole.. include:: references.txt .. _io-ascii: ********************************* ASCII Tables (`astropy.io.ascii`) ********************************* Introduction ============ `astropy.io.ascii` provides methods for reading and writing a wide range of ASCII data table formats via built-in :ref:`extension_reader_classes`. The emphasis is on flexibility and ease of use. The following shows a few of the ASCII formats that are available, while the section on `Supported formats`_ contains the full list. * :class:`~astropy.io.ascii.basic.Basic`: basic table with customizable delimiters and header configurations * :class:`~astropy.io.ascii.cds.Cds`: `CDS format table `_ (also Vizier and ApJ machine readable tables) * :class:`~astropy.io.ascii.daophot.Daophot`: table from the IRAF DAOphot package * :class:`~astropy.io.ascii.fixedwidth.FixedWidth`: table with fixed-width columns (see also :ref:`fixed_width_gallery`) * :class:`~astropy.io.ascii.ipac.Ipac`: `IPAC format table `_ * :class:`~astropy.io.ascii.latex.Latex`: LaTeX table with datavalue in the `tabular` environment * :class:`~astropy.io.ascii.basic.Rdb`: tab-separated values with an extra line after the column definition line * :class:`~astropy.io.ascii.sextractor.SExtractor`: `SExtractor format table `_ The :mod:`astropy.io.ascii` package is built on a modular and extensible class structure with independent :ref:`base_class_elements` so that new formats can be easily accommodated. .. note:: It is also possible to use the functionality from :mod:`astropy.io.ascii` through a higher-level interface in the :mod:`astropy.table` package. See :ref:`table_io` for more details. Getting Started =============== Reading Tables -------------- The majority of commonly encountered ASCII tables can be easily read with the |read| function. Assume you have a file named ``sources.dat`` with the following contents:: obsid redshift X Y object 3102 0.32 4167 4085 Q1250+568-A 877 0.22 4378 3892 "Source 82" This table can be read with the following:: >>> from astropy.io import ascii >>> data = ascii.read("sources.dat") # doctest: +SKIP >>> print data # doctest: +SKIP obsid redshift X Y object ----- -------- ---- ---- ----------- 3102 0.32 4167 4085 Q1250+568-A 877 0.22 4378 3892 Source 82 The first argument to the |read| function can be the name of a file, a string representation of a table, or a list of table lines. By default |read| will try to `guess the table format <#guess-table-format>`_ by trying all the `supported formats`_. If this does not work (for unusually formatted tables) then one needs give astropy.io.ascii additional hints about the format, for example:: >>> lines = ['objID & osrcid & xsrcid ', ... '----------------------- & ----------------- & -------------', ... ' 277955213 & S000.7044P00.7513 & XS04861B6_005', ... ' 889974380 & S002.9051P14.7003 & XS03957B7_004'] >>> data = ascii.read(lines, data_start=2, delimiter='&') >>> print(data) objID osrcid xsrcid --------- ----------------- ------------- 277955213 S000.7044P00.7513 XS04861B6_005 889974380 S002.9051P14.7003 XS03957B7_004 If the format of a file is known (e.g. it is a fixed width table or an IPAC table), then it is more efficient and reliable to provide a value for the ``format`` argument from one of the values in the `supported formats`_. For example:: >>> data = ascii.read(lines, format='fixed_width_two_line', delimiter='&') Writing Tables -------------- The |write| function provides a way to write a data table as a formatted ASCII table. For example the following writes a table as a simple space-delimited file:: >>> import numpy as np >>> from astropy.table import Table >>> x = np.array([1, 2, 3]) >>> y = x ** 2 >>> data = Table([x, y], names=['x', 'y']) >>> ascii.write(data, 'values.dat') The ``values.dat`` file will then contain:: x y 1 1 2 4 3 9 All of the input Reader formats supported by `astropy.io.ascii` for reading are also supported for writing. This provides a great deal of flexibility in the format for writing. The example below writes the data as a LaTeX table, using the option to send the output to ``sys.stdout`` instead of a file:: >>> import sys >>> ascii.write(data, sys.stdout, format='latex') \begin{table} \begin{tabular}{cc} x & y \\ 1 & 1 \\ 2 & 4 \\ 3 & 9 \\ \end{tabular} \end{table} .. _supported_formats: Supported formats ================= A full list of the supported ``format`` values and corresponding format types for ASCII tables is given below. The ``Write`` column indicates which formats support write functionality. ========================= ===== ============================================================================================ Format Write Description ========================= ===== ============================================================================================ ``aastex`` Yes :class:`~astropy.io.ascii.latex.AASTex`: AASTeX deluxetable used for AAS journals ``basic`` Yes :class:`~astropy.io.ascii.basic.Basic`: Basic table with custom delimiters ``cds`` :class:`~astropy.io.ascii.cds.Cds`: CDS format table ``commented_header`` Yes :class:`~astropy.io.ascii.basic.CommentedHeader`: Column names in a commented line ``daophot`` :class:`~astropy.io.ascii.daophot.Daophot`: IRAF DAOphot format table ``fixed_width`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidth`: Fixed width ``fixed_width_no_header`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidthNoHeader`: Fixed width with no header ``fixed_width_two_line`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidthTwoLine`: Fixed width with second header line ``ipac`` Yes :class:`~astropy.io.ascii.ipac.Ipac`: IPAC format table ``latex`` Yes :class:`~astropy.io.ascii.latex.Latex`: LaTeX table ``no_header`` Yes :class:`~astropy.io.ascii.basic.NoHeader`: Basic table with no headers ``rdb`` Yes :class:`~astropy.io.ascii.basic.Rdb`: Tab-separated with a type definition header line ``sextractor`` :class:`~astropy.io.ascii.sextractor.SExtractor`: SExtractor format table ``tab`` Yes :class:`~astropy.io.ascii.basic.Tab`: Basic table with tab-separated values ========================= ===== ============================================================================================ Using `io.ascii` ================ The details of using `astropy.io.ascii` are provided in the following sections: Reading tables --------------- .. toctree:: :maxdepth: 2 read Writing tables --------------- .. toctree:: :maxdepth: 2 write Fixed-width Gallery -------------------- .. toctree:: :maxdepth: 2 fixed_width_gallery Base class elements ------------------- .. toctree:: :maxdepth: 2 base_classes Extension Reader classes ------------------------ .. toctree:: :maxdepth: 2 extension_classes Reference/API ============= .. automodapi:: astropy.io.ascii astropy-0.3/docs/io/ascii/toc.txt0000644000175000017500000000014312243255342015152 0ustar oleole.. toctree:: :maxdepth: 2 read write base_classes fixed_width_gallery ascii_api astropy-0.3/docs/io/ascii/fixed_width_gallery.rst0000644000175000017500000002541112243255342020400 0ustar oleole.. include:: references.txt .. _fixed_width_gallery: Fixed-width Gallery ------------------- Fixed-width tables are those where each column has the same width for every row in the table. This is commonly used to make tables easy to read for humans or FORTRAN codes. It also reduces issues with quoting and special characters, for example:: Col1 Col2 Col3 Col4 ---- --------- ---- ---- 1.2 "hello" 1 a 2.4 's worlds 2 2 There are a number of common variations in the formatting of fixed-width tables which :mod:`astropy.io.ascii` can read and write. The most signicant difference is whether there is no header line (:class:`~astropy.io.ascii.FixedWidthNoHeader`), one header line (:class:`~astropy.io.ascii.FixedWidth`), or two header lines (:class:`~astropy.io.ascii.FixedWidthTwoLine`). Next, there are variations in the delimiter character, whether the delimiter appears on either end ("bookends"), and padding around the delimiter. Details are available in the class API documentation, but the easiest way to understand all the options and their interactions is by example. Reading ^^^^^^^ FixedWidth """""""""" **Nice, typical fixed format table** :: >>> from astropy.io import ascii >>> table = """ ... # comment (with blank line above) ... | Col1 | Col2 | ... | 1.2 | "hello" | ... | 2.4 |'s worlds| ... """ >>> ascii.read(table, format='fixed_width') array([(1.2, '"hello"'), (2.4, "'s worlds")], dtype=[('Col1', '>> table = """ ... # comment (with blank line above) ... | Col1 | Col2 | ... | 1.2 | "hello" | ... | 2.4 |'s worlds| ... """ >>> ascii.read(table, format='fixed_width', names=('name1', 'name2'))
array([(1.2, '"hello"'), (2.4, "'s worlds")], dtype=[('name1', '>> table = """ ... Col1 | Col2 | ... 1.2 "hello" ... 2.4 sdf's worlds ... """ >>> ascii.read(table, format='fixed_width')
array([(1.2, '"hel'), (2.4, "df's wo")], dtype=[('Col1', '>> table = """ ... || Name || Phone || TCP|| ... | John | 555-1234 |192.168.1.10X| ... | Mary | 555-2134 |192.168.1.12X| ... | Bob | 555-4527 | 192.168.1.9X| ... """ >>> ascii.read(table, format='fixed_width')
array([('John', '555-1234', '192.168.1.10'), ('Mary', '555-2134', '192.168.1.12'), ('Bob', '555-4527', '192.168.1.9')], dtype=[('Name', 'S4'), ('Phone', 'S8'), ('TCP', 'S12')]) **Table with space delimiter** :: >>> table = """ ... Name --Phone- ----TCP----- ... John 555-1234 192.168.1.10 ... Mary 555-2134 192.168.1.12 ... Bob 555-4527 192.168.1.9 ... """ >>> ascii.read(table, format='fixed_width', delimiter=' ')
array([('John', '555-1234', '192.168.1.10'), ('Mary', '555-2134', '192.168.1.12'), ('Bob', '555-4527', '192.168.1.9')], dtype=[('Name', 'S4'), ('--Phone-', 'S8'), ('----TCP-----', 'S12')]) **Table with no header row and auto-column naming.** Use header_start and data_start keywords to indicate no header line. :: >>> table = """ ... | John | 555-1234 |192.168.1.10| ... | Mary | 555-2134 |192.168.1.12| ... | Bob | 555-4527 | 192.168.1.9| ... """ >>> ascii.read(table, format='fixed_width', ... header_start=None, data_start=0)
array([('John', '555-1234', '192.168.1.10'), ('Mary', '555-2134', '192.168.1.12'), ('Bob', '555-4527', '192.168.1.9')], dtype=[('col1', 'S4'), ('col2', 'S8'), ('col3', 'S12')]) **Table with no header row and with col names provided.** Second and third rows also have hanging spaces after final "|". Use header_start and data_start keywords to indicate no header line. :: >>> table = ["| John | 555-1234 |192.168.1.10|", ... "| Mary | 555-2134 |192.168.1.12| ", ... "| Bob | 555-4527 | 192.168.1.9| "] >>> ascii.read(table, format='fixed_width', ... header_start=None, data_start=0, ... names=('Name', 'Phone', 'TCP'))
array([('John', '555-1234', '192.168.1.10'), ('Mary', '555-2134', '192.168.1.12'), ('Bob', '555-4527', '192.168.1.9')], dtype=[('Name', '|S4'), ('Phone', '|S8'), ('TCP', '|S12')]) FixedWidthNoHeader """""""""""""""""" **Table with no header row and auto-column naming. Use the FixedWidthNoHeader convenience class.** :: >>> table = """ ... | John | 555-1234 |192.168.1.10| ... | Mary | 555-2134 |192.168.1.12| ... | Bob | 555-4527 | 192.168.1.9| ... """ >>> ascii.read(table, format='fixed_width_no_header')
array([('John', '555-1234', '192.168.1.10'), ('Mary', '555-2134', '192.168.1.12'), ('Bob', '555-4527', '192.168.1.9')], dtype=[('col1', 'S4'), ('col2', 'S8'), ('col3', 'S12')]) **Table with no delimiter with column start and end values specified.** This uses the col_starts and col_ends keywords. Note that the col_ends values are inclusive so a position range of 0 to 5 will select the first 6 characters. :: >>> table = """ ... # 5 9 17 18 28 <== Column start / end indexes ... # | | || | <== Column separation positions ... John 555- 1234 192.168.1.10 ... Mary 555- 2134 192.168.1.12 ... Bob 555- 4527 192.168.1.9 ... """ >>> ascii.read(table, format='fixed_width_no_header', ... names=('Name', 'Phone', 'TCP'), ... col_starts=(0, 9, 18), ... col_ends=(5, 17, 28), ... )
array([('John', '555- 1234', '192.168.1.'), ('Mary', '555- 2134', '192.168.1.'), ('Bob', '555- 4527', '192.168.1')], dtype=[('Name', 'S4'), ('Phone', 'S9'), ('TCP', 'S10')]) FixedWidthTwoLine """"""""""""""""" **Typical fixed format table with two header lines with some cruft** :: >>> table = """ ... Col1 Col2 ... ---- --------- ... 1.2xx"hello" ... 2.4 's worlds ... """ >>> ascii.read(table, format='fixed_width_two_line')
array([(1.2, '"hello"'), (2.4, "'s worlds")], dtype=[('Col1', '>> table = """ ... ======= =========== ... Col1 Col2 ... ======= =========== ... 1.2 "hello" ... 2.4 's worlds ... ======= =========== ... """ >>> ascii.read(table, format='fixed_width_two_line', ... header_start=1, position_line=2, data_end=-1)
array([(1.2, '"hello"'), (2.4, "'s worlds")], dtype=[('Col1', '>> table = """ ... +------+----------+ ... | Col1 | Col2 | ... +------|----------+ ... | 1.2 | "hello" | ... | 2.4 | 's worlds| ... +------+----------+ ... """ >>> ascii.read(table, format='fixed_width_two_line', delimiter='+', ... header_start=1, position_line=0, data_start=3, data_end=-1)
array([(1.2, '"hello"'), (2.4, "'s worlds")], dtype=[('Col1', '>> table = """ ... | Col1 | Col2 | Col3 | Col4 | ... | 1.2 | "hello" | 1 | a | ... | 2.4 | 's worlds | 2 | 2 | ... """ >>> dat = ascii.read(table, format='fixed_width') **Write a table as a normal fixed width table.** :: >>> ascii.write(dat, format='fixed_width') | Col1 | Col2 | Col3 | Col4 | | 1.2 | "hello" | 1 | a | | 2.4 | 's worlds | 2 | 2 | **Write a table as a fixed width table with no padding.** :: >>> ascii.write(dat, format='fixed_width', delimiter_pad=None) |Col1| Col2|Col3|Col4| | 1.2| "hello"| 1| a| | 2.4|'s worlds| 2| 2| **Write a table as a fixed width table with no bookend.** :: >>> ascii.write(dat, format='fixed_width', bookend=False) Col1 | Col2 | Col3 | Col4 1.2 | "hello" | 1 | a 2.4 | 's worlds | 2 | 2 **Write a table as a fixed width table with no delimiter.** :: >>> ascii.write(dat, format='fixed_width', bookend=False, delimiter=None) Col1 Col2 Col3 Col4 1.2 "hello" 1 a 2.4 's worlds 2 2 **Write a table as a fixed width table with no delimiter and formatting.** :: >>> ascii.write(dat, format='fixed_width', ... formats={'Col1': '%-8.3f', 'Col2': '%-15s'}) | Col1 | Col2 | Col3 | Col4 | | 1.200 | "hello" | 1 | a | | 2.400 | 's worlds | 2 | 2 | FixedWidthNoHeader """""""""""""""""" **Write a table as a normal fixed width table.** :: >>> ascii.write(dat, format='fixed_width_no_header') | 1.2 | "hello" | 1 | a | | 2.4 | 's worlds | 2 | 2 | **Write a table as a fixed width table with no padding.** :: >>> ascii.write(dat, format='fixed_width_no_header', delimiter_pad=None) |1.2| "hello"|1|a| |2.4|'s worlds|2|2| **Write a table as a fixed width table with no bookend.** :: >>> ascii.write(dat, format='fixed_width_no_header', bookend=False) 1.2 | "hello" | 1 | a 2.4 | 's worlds | 2 | 2 **Write a table as a fixed width table with no delimiter.** :: >>> ascii.write(dat, format='fixed_width_no_header', bookend=False, ... delimiter=None) 1.2 "hello" 1 a 2.4 's worlds 2 2 FixedWidthTwoLine """"""""""""""""" **Write a table as a normal fixed width table.** :: >>> ascii.write(dat, format='fixed_width_two_line') Col1 Col2 Col3 Col4 ---- --------- ---- ---- 1.2 "hello" 1 a 2.4 's worlds 2 2 **Write a table as a fixed width table with space padding and '=' position_char.** :: >>> ascii.write(dat, format='fixed_width_two_line', ... delimiter_pad=' ', position_char='=') Col1 Col2 Col3 Col4 ==== ========= ==== ==== 1.2 "hello" 1 a 2.4 's worlds 2 2 **Write a table as a fixed width table with no bookend.** :: >>> ascii.write(dat, format='fixed_width_two_line', bookend=True, delimiter='|') |Col1| Col2|Col3|Col4| |----|---------|----|----| | 1.2| "hello"| 1| a| | 2.4|'s worlds| 2| 2| astropy-0.3/docs/io/ascii/read.rst0000644000175000017500000004152412243255342015301 0ustar oleole.. include:: references.txt .. _astropy.io.ascii_read: Reading tables -------------- The majority of commonly encountered ASCII tables can be easily read with the |read| function:: >>> from astropy.io import ascii >>> data = ascii.read(table) # doctest: +SKIP where ``table`` is the name of a file, a string representation of a table, or a list of table lines. By default |read| will try to `guess the table format <#guess-table-format>`_ by trying all the supported formats. If this does not work (for unusually formatted tables) then one needs give `astropy.io.ascii` additional hints about the format, for example:: >>> data = astropy.io.ascii.read('t/nls1_stackinfo.dbout', data_start=2, delimiter='|') # doctest: +SKIP >>> data = astropy.io.ascii.read('t/simple.txt', quotechar="'") # doctest: +SKIP >>> data = astropy.io.ascii.read('t/simple4.txt', format='no_header', delimiter='|') # doctest: +SKIP The |read| function accepts a number of parameters that specify the detailed table format. Different formats can define different defaults, so the descriptions below sometimes mention "typical" default values. This refers to the :class:`~astropy.io.ascii.Basic` format reader and other similar character-separated formats. .. _io_ascii_read_parameters: Parameters for ``read()`` ^^^^^^^^^^^^^^^^^^^^^^^^^ **table** : input table There are four ways to specify the table to be read: - Name of a file (string) - Single string containing all table lines separated by newlines - File-like object with a callable read() method - List of strings where each list element is a table line The first two options are distinguished by the presence of a newline in the string. This assumes that valid file names will not normally contain a newline. **format** : file format (default='basic') This specifies the top-level format of the ASCII table, for example if it is a basic character delimited table, fixed format table, or a CDS-compatible table, etc. The value of this parameter must be one of the :ref:`supported_formats`. **guess**: try to guess table format (default=True) If set to True then |read| will try to guess the table format by cycling through a number of possible table format permutations and attempting to read the table in each case. See the `Guess table format`_ section for further details. **delimiter** : column delimiter string A one-character string used to separate fields which typically defaults to the space character. Other common values might be "\\s" (whitespace), "," or "|" or "\\t" (tab). A value of "\\s" allows any combination of the tab and space characters to delimit columns. **comment** : regular expression defining a comment line in table If the ``comment`` regular expression matches the beginning of a table line then that line will be discarded from header or data processing. For the ``basic`` format this defaults to "\\s*#" (any whitespace followed by #). **quotechar** : one-character string to quote fields containing special characters This specifies the quote character and will typically be either the single or double quote character. This is can be useful for reading text fields with spaces in a space-delimited table. The default is typically the double quote. **header_start** : line index for the header line not counting comment lines This specifies in the line index where the header line will be found. Comment lines are not included in this count and the counting starts from 0 (first non-comment line has index=0). If set to None this indicates that there is no header line and the column names will be auto-generated. The default is dependent on the format. **data_start**: line index for the start of data not counting comment lines This specifies in the line index where the data lines begin where the counting starts from 0 and does not include comment lines. The default is dependent on the format. **data_end**: line index for the end of data (can be negative to count from end) If this is not None then it allows for excluding lines at the end that are not valid data lines. A negative value means to count from the end, so -1 would exclude the last line, -2 the last two lines, and so on. **converters**: dict of data type converters See the `Converters`_ section for more information. **names**: list of names corresponding to each data column Define the complete list of names for each data column. This will override names found in the header (if it exists). If not supplied then use names from the header or auto-generated names if there is no header. **include_names**: list of names to include in output From the list of column names found from the header or the ``names`` parameter, select for output only columns within this list. If not supplied then include all names. **exclude_names**: list of names to exclude from output Exclude these names from the list of output columns. This is applied *after* the ``include_names`` filtering. If not specified then no columns are excluded. **fill_values**: fill value specifier of lists This can be used to fill missing values in the table or replace strings with special meaning. See the `Bad or missing values`_ section for more information and examples. The default is that any blank table values are treated as missing. **fill_include_names**: list of column names, which are affected by ``fill_values``. If not supplied, then ``fill_values`` can affect all columns. **fill_exclude_names**: list of column names, which are not affected by ``fill_values``. If not supplied, then ``fill_values`` can affect all columns. **Outputter**: Outputter class This converts the raw data tables value into the output object that gets returned by |read|. The default is :class:`~astropy.io.ascii.core.TableOutputter`, which returns a :class:`~astropy.table.Table` object. **Inputter**: Inputter class This is generally not specified. **data_Splitter**: Splitter class to split data columns **header_Splitter**: Splitter class to split header columns **Reader** : Reader class (*deprecated* in favor of ``format``) This specifies the top-level format of the ASCII table, for example if it is a basic character delimited table, fixed format table, or a CDS-compatible table, etc. The value of this parameter must be a Reader class. For basic usage this means one of the built-in :ref:`extension_reader_classes`. .. _replace_bad_or_missing_values: Bad or missing values ^^^^^^^^^^^^^^^^^^^^^ ASCII data tables can contain bad or missing values. A common case is when a table contains blank entries with no available data, for example:: day,precip,type Mon,1.5,rain Tues,, # <-- Weather station down Wed,1.1,snow By default |read| will interpret blank entries as being bad/missing and output a masked Table with those entries masked out by setting the corresponding mask value set to ``True``. If you have read the above table into a variable ``dat``, you would see the output below, where the ``--`` values indicate missing data:: >>> print dat # doctest: +SKIP day precip type ---- ------ ---- Mon 1.5 rain Tues -- -- Wed 1.1 snow If you want to replace the masked (missing) values with particular values, set the masked column ``fill_value`` attribute and then get the "filled" version of the table. This looks like the following:: >>> dat['precip'].fill_value = -99.9 # doctest: +SKIP >>> dat['type'].fill_value = '' # doctest: +SKIP >>> print dat.filled() # doctest: +SKIP day precip type ---- ------ ---- Mon 1.5 rain Tues -99.9 Wed 1.1 snow ASCII tables may also have other indicators of bad or missing data. For example a table may contain string values that are not a valid representation of a number, e.g. ``"..."``, or a table may have special values like ``-999`` that are chosen to indicate missing data. The |read| function has a flexible system to accommodate these cases by replacing string values in the input data before they are converted. This is done with the ``fill_values`` argument which replaces ```` with ```` before the type conversion is done:: fill_values = | [, , ...] = (, , , , ...) Within the ```` tuple the ```` and ```` values must be strings. These two values are then followed by zero or more column names. If column names are included the replacement is limited to those columns listed. If no columns are specified then the replacement is done in every column, subject to filtering by ``fill_include_names`` and ``fill_exclude_names`` (see below). The ``fill_values`` parameter in |read| takes a single ```` or a list of ```` tuples. If several ```` apply to a single occurrence of ```` then the first one determines the ```` value. For instance the following will replace an empty data value in the ``x`` or ``y`` columns with "1e38" while empty values in any other column will get "-999":: >>> ascii.read(table, fill_values=[('', '1e38', 'x', 'y'), ('', '-999')]) # doctest: +SKIP The following shows an example where string information needs to be exchanged before the conversion to float values happens. Here ``no_rain`` and ``no_snow`` is replaced by ``0.0``:: >>> table = ['day rain snow', # column names ... #--- ------- -------- ... 'Mon 3.2 no_snow', ... 'Tue no_rain 1.1', ... 'Wed 0.3 no_snow'] >>> print(ascii.read(table, fill_values=[('no_rain', '0.0'), ('no_snow', '0.0')])) day rain snow --- ---- ---- Mon 3.2 -- Tue -- 1.1 Wed 0.3 -- Sometimes these rules apply only to specific columns in the table. Columns can be selected with ``fill_include_names`` or excluded with ``fill_exclude_names``. Also, column names can be given directly with fill_values:: >>> asciidata = ['text,no1,no2', 'text1,1,1.',',2,'] >>> print ascii.read(asciidata, fill_values = ('', 'nan','no1','no2'), delimiter = ',') text no1 no2 ----- --- --- text1 1 1.0 2 -- Here, the empty value ``''`` in column ``no2`` is replaced by ``nan``, but the ``text`` column remains unaltered. If any table elements match the fill specification then |read| returns a masked `~astropy.table.Table` object with the corresponding elements masked out. .. note:: The default in |read| is ``fill_values=('','0')``. This marks blank entries as being missing for any data type (int, float, or string). If ``fill_values`` is explicitly set in the call to |read| then the default behavior of marking blank entries as missing no longer applies. For instance setting ``fill_values=None`` will disable this auto-masking without setting any other fill values. This can be useful for a string column where one of values happens to be ``""``. Guess table format ^^^^^^^^^^^^^^^^^^ If the ``guess`` parameter in |read| is set to True (which is the default) then |read| will try to guess the table format by cycling through a number of possible table format permutations and attempting to read the table in each case. The first format which succeeds and will be used to read the table. To succeed the table must be successfully parsed by the Reader and satisfy the following column requirements: * At least two table columns * No column names are a float or int number * No column names begin or end with space, comma, tab, single quote, double quote, or a vertical bar (|). These requirements reduce the chance for a false positive where a table is successfully parsed with the wrong format. A common situation is a table with numeric columns but no header row, and in this case ``astropy.io.ascii`` will auto-assign column names because of the restriction on column names that look like a number. The order of guessing is shown by this Python code, where ``Reader`` is the class which actually implements reading the different file formats:: for Reader in (Rdb, Tab, Cds, Daophot, SExtractor, Ipac): read(Reader=Reader) for Reader in (CommentedHeader, Basic, NoHeader): for delimiter in ("|", ",", " ", "\\s"): for quotechar in ('"', "'"): read(Reader=Reader, delimiter=delimiter, quotechar=quotechar) Note that the :class:`~astropy.io.ascii.FixedWidth` derived-readers are not included in the default guess sequence (this causes problems), so to read such tables one must explicitly specify the format with the ``format`` keyword. If none of the guesses succeed in reading the table (subject to the column requirements) a final try is made using just the user-supplied parameters but without checking the column requirements. In this way a table with only one column or column names that look like a number can still be successfully read. The guessing process respects any values of the Reader, delimiter, and quotechar parameters that were supplied to the read() function. Any guesses that would conflict are skipped. For example the call:: >>> data = ascii.read(table, Reader=ascii.NoHeader, quotechar="'") would only try the four delimiter possibilities, skipping all the conflicting Reader and quotechar combinations. Guessing can be disabled in two ways:: import astropy.io.ascii data = astropy.io.ascii.read(table) # guessing enabled by default data = astropy.io.ascii.read(table, guess=False) # disable for this call astropy.io.ascii.set_guess(False) # set default to False globally data = astropy.io.ascii.read(table) # guessing disabled Converters ^^^^^^^^^^ :mod:`astropy.io.ascii` converts the raw string values from the table into numeric data types by using converter functions such as the Python ``int`` and ``float`` functions. For example ``int("5.0")`` will fail while float("5.0") will succeed and return 5.0 as a Python float. The default converters are:: default_converters = [astropy.io.ascii.convert_numpy(numpy.int), astropy.io.ascii.convert_numpy(numpy.float), astropy.io.ascii.convert_numpy(numpy.str)] These take advantage of the :func:`~astropy.io.ascii.core.convert_numpy` function which returns a 2-element tuple ``(converter_func, converter_type)`` as described in the previous section. The type provided to :func:`~astropy.io.ascii.core.convert_numpy` must be a valid `numpy type `_, for example ``numpy.int``, ``numpy.uint``, ``numpy.int8``, ``numpy.int64``, ``numpy.float``, ``numpy.float64``, ``numpy.str``. The default converters for each column can be overridden with the ``converters`` keyword:: >>> import numpy as np >>> converters = {'col1': [ascii.convert_numpy(np.uint)], ... 'col2': [ascii.convert_numpy(np.float32)]} >>> ascii.read('file.dat', converters=converters) # doctest: +SKIP Advanced customization ^^^^^^^^^^^^^^^^^^^^^^ Here we provide a few examples that demonstrate how to extend the base functionality to handle special cases. To go beyond these simple examples the best reference is to read the code for the existing :ref:`extension_reader_classes`. **Define a custom reader functionally** :: def read_rdb_table(table): reader = astropy.io.ascii.Basic() reader.header.splitter.delimiter = '\t' reader.data.splitter.delimiter = '\t' reader.header.splitter.process_line = None reader.data.splitter.process_line = None reader.data.start_line = 2 return reader.read(table) **Define custom readers by class inheritance** :: # Note: Tab and Rdb are already included in astropy.io.ascii for convenience. class Tab(astropy.io.ascii.Basic): def __init__(self): astropy.io.ascii.Basic.__init__(self) self.header.splitter.delimiter = '\t' self.data.splitter.delimiter = '\t' # Don't strip line whitespace since that includes tabs self.header.splitter.process_line = None self.data.splitter.process_line = None # Don't strip data value spaces since that is significant in TSV tables self.data.splitter.process_val = None self.data.splitter.skipinitialspace = False class Rdb(astropy.io.ascii.Tab): def __init__(self): astropy.io.ascii.Tab.__init__(self) self.data.start_line = 2 **Create a custom splitter.process_val function** :: # The default process_val() normally just strips whitespace. # In addition have it replace empty fields with -999. def process_val(x): """Custom splitter process_val function: Remove whitespace at the beginning or end of value and substitute -999 for any blank entries.""" x = x.strip() if x == '': x = '-999' return x # Create an RDB reader and override the splitter.process_val function rdb_reader = astropy.io.ascii.get_reader(Reader=astropy.io.ascii.Rdb) rdb_reader.data.splitter.process_val = process_val astropy-0.3/docs/io/fits/0000755000175000017500000000000012243263747013513 5ustar oleoleastropy-0.3/docs/io/fits/appendix/0000755000175000017500000000000012243263747015323 5ustar oleoleastropy-0.3/docs/io/fits/appendix/history.rst0000644000175000017500000035453412243255342017564 0ustar oleoleastropy.io.fits History ======================= Prior to its inclusion in Astropy, the `astropy.io.fits` package was a stand- alone package called `PyFITS`_. Though for the time being active development is continuing on PyFITS, that development is also being merged into Astropy. This page documents the release history of PyFITS prior to its merge into Astropy. .. contents:: PyFITS Changelog :depth: 2 :local: 3.2 (unreleased) ---------------- Highlights ^^^^^^^^^^ - Rewrote CFITSIO-based backend for handling tile compression of FITS files. It now uses a standard CFITSIO instead of heavily modified pieces of CFITSIO as before. PyFITS ships with its own copy of CFITSIO v3.35 which supports the latest version of the Tiled Image Convention (v2.3), but system packagers may choose instead to strip this out in favor of a system-installed version of CFITSIO. Earlier versions may work, but nothing earlier than 3.28 has been tested yet. (#169) - Added support for reading and writing tables using the Q format for columns. The Q format is identical to the P format (variable-length arrays) except that it uses 64-bit integers for the data descriptors, allowing more than 4 GB of variable-length array data in a single table. (#160) - Added initial support for table columns containing pseudo-unsigned integers. This is currently enabled by using the ``uint=True`` option when opening files; any table columns with the correct BZERO value will be interpreted and returned as arrays of unsigned integers. - Some refactoring of the table and ``FITS_rec`` modules in order to better separate the details of the FITS binary and ASCII table data structures from the HDU data structures that encapsulate them. Most of these changes should not be apparent to users (but see API Changes below). API Changes ^^^^^^^^^^^ - The ``pyfits.new_table`` function is marked "pending deprecation". This does not mean it will be removed outright or that its functionality has changed. It will likely be replaced in the future for a function with similar, if not subtly different functionality. A better, if not slightly more verbose approach is to use ``pyfits.FITS_rec.from_columns`` to create a new ``FITS_rec`` table--this has the same interface as ``pyfits.new_table``. The difference is that it returns a plan ``FITS_rec`` array, and not an HDU instance. This ``FITS_rec`` object can then be used as the data argument in the constructors for ``BinTableHDU`` (for binary tables) or ``TableHDU`` (for ASCII tables). This is analogous to creating an ``ImageHDU`` by passing in an image array. ``pyfits.FITS_rec.from_columns`` is just a simpler way of creating a FITS-compatible recarray from a FITS column specification. - The ``updateHeader``, ``updateHeaderData``, and ``updateCompressedData`` methods of the ``CompDataHDU`` class are pending deprecation and moved to internal methods. The operation of these methods depended too much on internal state to be used safely by users; instead they are invoked automatically in the appropriate places when reading/writing compressed image HDUs. - The ``CompDataHDU.compData`` attribute is pending deprecation in favor of the clearer and more PEP-8 compatible ``CompDataHDU.compressed_data``. - The constructor for ``CompDataHDU`` has been changed to accept new keyword arguments. The new keyword arguments are essentially the same, but are in underscore_separated format rather than camelCase format. The old arguments are still pending deprecation. - The internal attributes of HDU classes ``_hdrLoc``, ``_datLoc``, and ``_datSpan`` have been replaced with ``_header_offset``, ``_data_offset``, and ``_data_size`` respectively. The old attribute names are still pending deprecation. This should only be of interest to advanced users who have created their own HDU subclasses. - The following previously deprecated functions and methods have been removed entirely: ``createCard``, ``createCardFromString``, ``upperKey``, ``ColDefs.data``, ``setExtensionNameCaseSensitive``, ``_File.getfile``, ``_TableBaseHDU.get_coldefs``, ``Header.has_key``, ``Header.ascardlist``. If you run your code with a previous version of PyFITS (>= 3.0, < 3.2) with the ``python -Wd`` argument, warnings for all deprecated interfaces still in use will be displayed. - Interfaces that were pending deprecation are now fully deprecated. These include: ``create_card``, ``create_card_from_string``, ``upper_key``, ``Header.get_history``, and ``Header.get_comment``. - The ``.name`` attribute on HDUs is now directly tied to the HDU's header, so that if ``.header['EXTNAME']`` changes so does ``.name`` and vice-versa. - The ``pyfits.file.PYTHON_MODES`` constant dict was renamed to ``pyfits.file.PYFITS_MODES`` which better reflects its purpose. This is rarely used by client code, however. Support for the old name will be removed by PyFITS 3.4. Other Changes and Additions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - The new compression code also adds support for the ZQUANTIZ and ZDITHER0 keywords added in more recent versions of this FITS Tile Compression spec. This includes support for lossless compression with GZIP. (#198) By default no dithering is used, but the ``SUBTRACTIVE_DITHER_1`` and ``SUBTRACTIVE_DITHER_2`` methods can be enabled by passing the correct constants to the ``quantize_method`` argument to the ``CompImageHDU`` constuctor. A seed can be manually specified, or automatically generated using either the system clock or checksum-based methods via the ``dither_seed`` argument. See the documentation for ``CompImageHDU`` for more details. (#198) (spacetelescope/PYFITS#32) - Images compressed with the Tile Compression standard can now be larger than 4 GB through support of the Q format. (#159) - All HDUs now have a ``.ver`` ``.level`` attribute that returns the value of the EXTVAL and EXTLEVEL keywords from that HDU's header, if the exist. This was added for consistency with the ``.name`` attribute which returns the EXTNAME value from the header. - Then ``Column`` and ``ColDefs`` classes have new ``.dtype`` attributes which give the Numpy dtype for the column data in the first case, and the full Numpy compound dtype for each table row in the latter case. - There was an issue where new tables created defaulted the values in all string columns to '0.0'. Now string columns are filled with empty strings by default--this seems a less surprising default, but it may cause differences with tables created with older versions of PyFITS. Bug Fixes ^^^^^^^^^ - Binary tables containing compressed images may, optionally, contain other columns unrelated to the tile compression convention. Although this is an uncommon use case, it is permitted by the standard. (#159) - Reworked some of the file I/O routines to allow simpler, more consistent mapping between OS-level file modes ('rb', 'wb', 'ab', etc.) and the more "PyFITS-specific" modes used by PyFITS like "readonly" and "update". That is, if reading a FITS file from an open file object, it doesn't matter as much what "mode" it was opened in so long as it has the right capabilities (read/write/etc.) Also works around bugs in the Python io module in 2.6+ with regard to file modes. (spacetelescope/PyFITS#33) 3.1.3 (unreleased) ------------------ - Disallowed assigning NaN and Inf floating point values as header values, since the FITS standard does not define a way to represent them in. Because this is undefined, the previous behavior did not make sense and produced invalid FITS files. (spacetelescope/PyFITS#11) - Added a workaround for a bug in 64-bit OSX that could cause truncation when writing files greater than 2^32 bytes in size. (spacetelescope/PyFITS#28) - Fixed a long-standing issue where writing binary tables did not correctly write the TFORMn keywords for variable-length array columns (they ommitted the max array length parameter of the format). This was thought fixed in v3.1.2, but it was only fixed there for compressed image HDUs and not for binary tables in general. 3.0.12 (unreleased) ------------------- - Disallowed assigning NaN and Inf floating point values as header values, since the FITS standard does not define a way to represent them in. Because this is undefined, the previous behavior did not make sense and produced invalid FITS files. (Backported from 3.1.3) - Added a workaround for a bug in 64-bit OSX that could cause truncation when writing files greater than 2^32 bytes in size. (Backported from 3.1.3) - Fixed a long-standing issue where writing binary tables did not correctly write the TFORMn keywords for variable-length array columns (they ommitted the max array length parameter of the format). This was thought fixed in v3.1.2, but it was only fixed there for compressed image HDUs and not for binary tables in general. (Backported from 3.1.3) 3.1.3 (unreleased) ------------------ - Disallowed assigning NaN and Inf floating point values as header values, since the FITS standard does not define a way to represent them in. Because this is undefined, the previous behavior did not make sense and produced invalid FITS files. (spacetelescope/PyFITS#11) 3.0.12 (unreleased) ------------------- - Disallowed assigning NaN and Inf floating point values as header values, since the FITS standard does not define a way to represent them in. Because this is undefined, the previous behavior did not make sense and produced invalid FITS files. (Backported from 3.1.3) - Added a workaround for a bug in 64-bit OSX that could cause truncation when writing files greater than 2^32 bytes in size. (Backported from 3.1.3) 3.1.2 (2013-04-22) ------------------ - When an error occurs opening a file in fitsdiff the exception message will now at least mention which file had the error. (#168) - Fixed support for opening gzipped FITS files by filename in a writeable mode (PyFITS has supported writing to gzip files for some time now, but only enabled it when GzipFile objects were passed to ``pyfits.open()`` due to some legacy code preventing full gzip support. (#195) - Added a more helpful error message in the case of malformatted FITS files that contain non-float NULL values in an ASCII table but are missing the required TNULLn keywords in the header. (#197) - Fixed an (apparently long-standing) issue where writing compressed images did not correctly write the TFORMn keywords for variable-length array columns (they omitted the max array length parameter of the format). (#199) - Slightly refactored how tables containing variable-length array columns are handled to add two improvements: Fixes an issue where accessing the data after a call to the `pyfits.getdata` convenience function caused an exception, and allows the VLA data to be read from an existing mmap of the FITS file. (#200) - Fixed a bug that could occur when opening a table containing multi-dimensional columns (i.e. via the TDIMn keyword) and then writing it out to a new file. (#201) - Added use of the console_scripts entry point to install the fitsdiff and fitscheck scripts, which if nothing else provides better Windows support. The generated scripts now override the ones explicitly defined in the scripts/ directory (which were just trivial stubs to begin with). (#202) - Fixed a bug on Python 3 where attempting to open a non-existent file on Python 3 caused a seemingly unrelated traceback. (#203) - Fixed a bug in fitsdiff that reported two header keywords containing NaN as value as different. (#204) - Fixed an issue in the tests that caused some tests to fail if pyfits is installed with read-only permissions. (#208) - Fixed a bug where instantiating a ``BinTableHDU`` from a numpy array containing boolean fields converted all the values to ``False``. (#215) - Fixed an issue where passing an array of integers into the constructor of ``Column()`` when the column type is floats of the same byte width caused the column array to become garbled. (#218) - Fixed inconsistent behavior in creating CONTINUE cards from byte strings versus Unicode strings in Python 2--CONTINUE cards can now be created properly from Unicode strings (so long as they are convertible to ASCII). (spacetelescope/PyFITS#1) - Fixed a couple cases where creating a new table using TDIMn in some of the columns could caused a crash. (spacetelescope/PyFITS#3) - Fixed a bug in parsing HIERARCH keywords that do not have a space after the first equals sign (before the value). (spacetelescope/PyFITS#5) - Prevented extra leading whitespace on HIERARCH keywords from being treated as part of the keyword. (spacetelescope/PyFITS#6) - Fixed a bug where HIERARCH keywords containing lower-case letters was mistakenly marked as invalid during header validation. (spacetelescope/PyFITS#7) - Fixed an issue that was ancillary to (spacetelescope/PyFITS#7) where the ``Header.index()`` method did not work correctly with HIERARCH keywords containing lower-case letters. 3.0.11 (2013-04-17) ------------------- - Fixed support for opening gzipped FITS files by filename in a writeable mode (PyFITS has supported writing to gzip files for some time now, but only enabled it when GzipFile objects were passed to ``pyfits.open()`` due to some legacy code preventing full gzip support. Backported from 3.1.2. (#195) - Added a more helpful error message in the case of malformatted FITS files that contain non-float NULL values in an ASCII table but are missing the required TNULLn keywords in the header. Backported from 3.1.2. (#197) - Fixed an (apparently long-standing) issue where writing compressed images did not correctly write the TFORMn keywords for variable-length array columns (they ommitted the max array length parameter of the format). Backported from 3.1.2. (#199) - Slightly refactored how tables containing variable-length array columns are handled to add two improvements: Fixes an issue where accessing the data after a call to the `pyfits.getdata` convenience function caused an exception, and allows the VLA data to be read from an existing mmap of the FITS file. Backported from 3.1.2. (#200) - Fixed a bug that could occur when opening a table containing multi-dimensional columns (i.e. via the TDIMn keyword) and then writing it out to a new file. Backported from 3.1.2. (#201) - Fixed a bug on Python 3 where attempting to open a non-existent file on Python 3 caused a seemingly unrelated traceback. Backported from 3.1.2. (#203) - Fixed a bug in fitsdiff that reported two header keywords containing NaN as value as different. Backported from 3.1.2. (#204) - Fixed an issue in the tests that caused some tests to fail if pyfits is installed with read-only permissions. Backported from 3.1.2. (#208) - Fixed a bug where instantiating a ``BinTableHDU`` from a numpy array containing boolean fields converted all the values to ``False``. Backported from 3.1.2. (#215) - Fixed an issue where passing an array of integers into the constructor of ``Column()`` when the column type is floats of the same byte width caused the column array to become garbled. Backported from 3.1.2. (#218) - Fixed a couple cases where creating a new table using TDIMn in some of the columns could caused a crash. Backported from 3.1.2. (spacetelescope/PyFITS#3) 3.1.1 (2013-01-02) ------------------ This is a bug fix release for the 3.1.x series. Bug Fixes ^^^^^^^^^ - Improved handling of scaled images and pseudo-unsigned integer images in compressed image HDUs. They now work more transparently like normal image HDUs with support for the ``do_not_scale_image_data`` and ``uint`` options, as well as ``scale_back`` and ``save_backup``. The ``.scale()`` method works better too. (#88) - Permits non-string values for the EXTNAME keyword when reading in a file, rather than throwing an exception due to the malformatting. Added verification for the format of the EXTNAME keyword when writing. (#96) - Added support for EXTNAME and EXTVER in PRIMARY HDUs. That is, if EXTNAME is specified in the header, it will also be reflected in the ``.name`` attribute and in ``pyfits.info()``. These keywords used to be verboten in PRIMARY HDUs, but the latest version of the FITS standard allows them. (#151) - HCOMPRESS can again be used to compress data cubes (and higher-dimensional arrays) so long as the tile size is effectively 2-dimensional. In fact, PyFITS will automatically use compatible tile sizes even if they're not explicitly specified. (#171) - Added support for the optional ``endcard`` parameter in the ``Header.fromtextfile()`` and ``Header.totextfile()`` methods. Although ``endcard=False`` was a reasonable default assumption, there are still text dumps of FITS headers that include the END card, so this should have been more flexible. (#176) - Fixed a crash when running fitsdiff on two empty (that is, zero row) tables. (#178) - Fixed an issue where opening files containing random groups HDUs in update mode could cause an unnecessary rewrite of the file even if none of the data is modified. (#179) - Fixed a bug that could caused a deadlock in the filesystem on OSX if PyFITS is used with Numpy 1.7 in some cases. (#180) - Fixed a crash when generating diff reports from diffs using the ``ignore_comments`` options. (#181) - Fixed some bugs with WCS Paper IV record-valued keyword cards: - Cards that looked kind of like RVKCs but were not intended to be were over-permissively treated as such--commentary keywords like COMMENT and HISTORY were particularly affected. (#183) - Looking up a card in a header by its standard FITS keyword only should always return the raw value of that card. That way cards containing values that happen to valid RVKCs but were not intended to be will still be treated like normal cards. (#184) - Looking up a RVKC in a header with only part of the field-specifier (for example "DP1.AXIS" instead of "DP1.AXIS.1") was implicitly treated as a wildcard lookup. (#184) - Fixed a crash when diffing two FITS files where at least one contains a compressed image HDU which was not recognized as an image instead of a table. (#187) - Fixed bugs in the backwards compatibility layer for the ``CardList.index`` and ``CardList.count`` methods. (#190) - Improved ``__repr__`` and text file representation of cards with long values that are split into CONTINUE cards. (#193) - Fixed a crash when trying to assign a long (> 72 character) value to blank ('') keywords. This also changed how blank keywords are represented--there are still exactly 8 spaces before any commentary content can begin; this *may* affect the exact display of header cards that assumed there could be fewer spaces in a blank keyword card before the content begins. However, the current approach is more in line with the requirements of the FITS standard. (#194) 3.0.10 (2013-01-02) ------------------- - Improved handling of scaled images and pseudo-unsigned integer images in compressed image HDUs. They now work more transparently like normal image HDUs with support for the ``do_not_scale_image_data`` and ``uint`` options, as well as ``scale_back`` and ``save_backup``. The ``.scale()`` method works better too. Backported from 3.1.1. (#88) - Permits non-string values for the EXTNAME keyword when reading in a file, rather than throwing an exception due to the malformatting. Added verification for the format of the EXTNAME keyword when writing. Backported from 3.1.1. (#96) - Added support for EXTNAME and EXTVER in PRIMARY HDUs. That is, if EXTNAME is specified in the header, it will also be reflected in the ``.name`` attribute and in ``pyfits.info()``. These keywords used to be verbotten in PRIMARY HDUs, but the latest version of the FITS standard allows them. Backported from 3.1.1. (#151) - HCOMPRESS can again be used to compress data cubes (and higher-dimensional arrays) so long as the tile size is effectively 2-dimensional. In fact, PyFITS will not automatically use compatible tile sizes even if they're not explicitly specified. Backported from 3.1.1. (#171) - Fixed a bug when writing out files containing zero-width table columns, where the TFIELDS keyword would be updated incorrectly, leaving the table largely unreadable. Backported from 3.1.0. (#174) - Fixed an issue where opening files containing random groups HDUs in update mode could cause an unnecessary rewrite of the file even if none of the data is modified. Backported from 3.1.1. (#179) - Fixed a bug that could caused a deadlock in the filesystem on OSX if PyFITS is used with Numpy 1.7 in some cases. Backported from 3.1.1. (#180) 3.1 (2012-08-08) ---------------- Highlights ^^^^^^^^^^ - The ``Header`` object has been significantly reworked, and ``CardList`` objects are now deprecated (their functionality folded into the ``Header`` class). See API Changes below for more details. - Memory maps are now used by default to access HDU data. See API Changes below for more details. - Now includes a new version of the ``fitsdiff`` program for comparing two FITS files, and a new FITS comparison API used by ``fitsdiff``. See New Features below. API Changes ^^^^^^^^^^^ - The ``Header`` class has been rewritten, and the ``CardList`` class is deprecated. Most of the basic details of working with FITS headers are unchanged, and will not be noticed by most users. But there are differences in some areas that will be of interest to advanced users, and to application developers. For full details of the changes, see the "Header Interface Transition Guide" section in the PyFITS documentation. See ticket #64 on the PyFITS Trac for further details and background. Some highlights are listed below: * The Header class now fully implements the Python dict interface, and can be used interchangeably with a dict, where the keys are header keywords. * New keywords can be added to the header using normal keyword assignment (previously it was necessary to use ``Header.update`` to add new keywords). For example:: >>> header['NAXIS'] = 2 will update the existing 'FOO' keyword if it already exists, or add a new one if it doesn't exist, just like a dict. * It is possible to assign both a value and a comment at the same time using a tuple:: >>> header['NAXIS'] = (2, 'Number of axes') * To add/update a new card and ensure it's added in a specific location, use ``Header.set()``:: >>> header.set('NAXIS', 2, 'Number of axes', after='BITPIX') This works the same as the old ``Header.update()``. ``Header.update()`` still works in the old way too, but is deprecated. * Although ``Card`` objects still exist, it generally is not necessary to work with them directly. ``Header.ascardlist()``/``Header.ascard`` are deprecated and should not be used. To directly access the ``Card`` objects in a header, use ``Header.cards``. * To access card comments, it is still possible to either go through the card itself, or through ``Header.comments``. For example:: >>> header.cards['NAXIS'].comment Number of axes >>> header.comments['NAXIS'] Number of axes * ``Card`` objects can now be used interchangeably with ``(keyword, value, comment)`` 3-tuples. They still have ``.value`` and ``.comment`` attributes as well. The ``.key`` attribute has been renamed to ``.keyword`` for consistency, though ``.key`` is still supported (but deprecated). - Memory mapping is now used by default to access HDU data. That is, ``pyfits.open()`` uses ``memmap=True`` as the default. This provides better performance in the majority of use cases--there are only some I/O intensive applications where it might not be desirable. Enabling mmap by default also enabled finding and fixing a large number of bugs in PyFITS' handling of memory-mapped data (most of these bug fixes were backported to PyFITS 3.0.5). (#85) * A new ``pyfits.USE_MEMMAP`` global variable was added. Set ``pyfits.USE_MEMMAP = False`` to change the default memmap setting for opening files. This is especially useful for controlling the behavior in applications where pyfits is deeply embedded. * Likewise, a new ``PYFITS_USE_MEMMAP`` environment variable is supported. Set ``PYFITS_USE_MEMMAP = 0`` in your environment to change the default behavior. - The ``size()`` method on HDU objects is now a ``.size`` property--this returns the size in bytes of the data portion of the HDU, and in most cases is equivalent to ``hdu.data.nbytes`` (#83) - ``BinTableHDU.tdump`` and ``BinTableHDU.tcreate`` are deprecated--use ``BinTableHDU.dump`` and ``BinTableHDU.load`` instead. The new methods output the table data in a slightly different format from previous versions, which places quotes around each value. This format is compatible with data dumps from previous versions of PyFITS, but not vice-versa due to a parsing bug in older versions. - Likewise the ``pyfits.tdump`` and ``pyfits.tcreate`` convenience function versions of these methods have been renamed ``pyfits.tabledump`` and ``pyfits.tableload``. The old deprecated, but currently retained for backwards compatibility. (r1125) - A new global variable ``pyfits.EXTENSION_NAME_CASE_SENSITIVE`` was added. This serves as a replacement for ``pyfits.setExtensionNameCaseSensitive`` which is not deprecated and may be removed in a future version. To enable case-sensitivity of extension names (i.e. treat 'sci' as distict from 'SCI') set ``pyfits.EXTENSION_NAME_CASE_SENSITIVE = True``. The default is ``False``. (r1139) - A new global configuration variable ``pyfits.STRIP_HEADER_WHITESPACE`` was added. By default, if a string value in a header contains trailing whitespace, that whitespace is automatically removed when the value is read. Now if you set ``pyfits.STRIP_HEADER_WHITESPACE = False`` all whitespace is preserved. (#146) - The old ``classExtensions`` extension mechanism (which was deprecated in PyFITS 3.0) is removed outright. To our knowledge it was no longer used anywhere. (r1309) - Warning messages from PyFITS issued through the Python warnings API are now output to stderr instead of stdout, as is the default. PyFITS no longer modifies the default behavior of the warnings module with respect to which stream it outputs to. (r1319) - The ``checksum`` argument to ``pyfits.open()`` now accepts a value of 'remove', which causes any existing CHECKSUM/DATASUM keywords to be ignored, and removed when the file is saved. New Features ^^^^^^^^^^^^ - Added support for the proposed "FITS" extension HDU type. See http://listmgr.cv.nrao.edu/pipermail/fitsbits/2002-April/001094.html. FITS HDUs contain an entire FITS file embedded in their data section. `FitsHDU` objects work like other HDU types in PyFITS. Their ``.data`` attribute returns the raw data array. However, they have a special ``.hdulist`` attribute which processes the data as a FITS file and returns it as an in-memory HDUList object. FitsHDU objects also support a ``FitsHDU.fromhdulist()`` classmethod which returns a new `FitsHDU` object that embeds the supplied HDUList. (#80) - Added a new ``.is_image`` attribute on HDU objects, which is True if the HDU data is an 'image' as opposed to a table or something else. Here the meaning of 'image' is fairly loose, and mostly just means a Primary or Image extension HDU, or possibly a compressed image HDU (#71) - Added an ``HDUList.fromstring`` classmethod which can parse a FITS file already in memory and instantiate and ``HDUList`` object from it. This could be useful for integrating PyFITS with other libraries that work on FITS file, such as CFITSIO. It may also be useful in streaming applications. The name is a slight misnomer, in that it actually accepts any Python object that implements the buffer interface, which includes ``bytes``, ``bytearray``, ``memoryview``, ``numpy.ndarray``, etc. (#90) - Added a new ``pyfits.diff`` module which contains facilities for comparing FITS files. One can use the ``pyfits.diff.FITSDiff`` class to compare two FITS files in their entirety. There is also a ``pyfits.diff.HeaderDiff`` class for just comparing two FITS headers, and other similar interfaces. See the PyFITS Documentation for more details on this interface. The ``pyfits.diff`` module powers the new ``fitsdiff`` program installed with PyFITS. After installing PyFITS, run ``fitsdiff --help`` for usage details. - ``pyfits.open()`` now accepts a ``scale_back`` argument. If set to ``True``, this automatically scales the data using the original BZERO and BSCALE parameters the file had when it was first opened, if any, as well as the original BITPIX. For example, if the original BITPIX were 16, this would be equivalent to calling ``hdu.scale('int16', 'old')`` just before calling ``flush()`` or ``close()`` on the file. This option applies to all HDUs in the file. (#120) - ``pyfits.open()`` now accepts a ``save_backup`` argument. If set to ``True``, this automatically saves a backup of the original file before flushing any changes to it (this of course only applies to update and append mode). This may be especially useful when working with scaled image data. (#121) Changes in Behavior ^^^^^^^^^^^^^^^^^^^ - Warnings from PyFITS are not output to stderr by default, instead of stdout as it has been for some time. This is contrary to most users' expectations and makes it more difficult for them to separate output from PyFITS from the desired output for their scripts. (r1319) Bug Fixes ^^^^^^^^^ - Fixed ``pyfits.tcreate()`` (now ``pyfits.tableload()``) to be more robust when encountering blank lines in a column definition file (#14) - Fixed a fairly rare crash that could occur in the handling of CONTINUE cards when using Numpy 1.4 or lower (though 1.4 is the oldest version supported by PyFITS). (r1330) - Fixed ``_BaseHDU.fromstring`` to actually correctly instantiate an HDU object from a string/buffer containing the header and data of that HDU. This allowed for the implementation of ``HDUList.fromstring`` described above. (#90) - Fixed a rare corner case where, in some use cases, (mildly, recoverably) malformatted float values in headers were not properly returned as floats. (#137) - Fixed a corollary to the previous bug where float values with a leading zero before the decimal point had the leading zero unnecessarily removed when saving changes to the file (eg. "0.001" would be written back as ".001" even if no changes were otherwise made to the file). (#137) - When opening a file containing CHECKSUM and/or DATASUM keywords in update mode, the CHECKSUM/DATASUM are updated and preserved even if the file was opened with checksum=False. This change in behavior prevents checksums from being unintentionally removed. (#148) - Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it was not restoring the image to its original BSCALE and BZERO values. (#162) - Fixed a bug when writing out files containing zero-width table columns, where the TFIELDS keyword would be updated incorrectly, leaving the table largely unreadable. This fix will be backported to the 3.0.x series in version 3.0.10. (#174) 3.0.9 (2012-08-06) ------------------ This is a bug fix release for the 3.0.x series. Bug Fixes ^^^^^^^^^ - Fixed ``Header.values()``/``Header.itervalues()`` and ``Header.items()``/ ``Header.iteritems()`` to correctly return the different values for duplicate keywords (particularly commentary keywords like HISTORY and COMMENT). This makes the old Header implementation slightly more compatible with the new implementation in PyFITS 3.1. (#127) .. note:: This fix did not change the existing behavior from earlier PyFITS versions where ``Header.keys()`` returns all keywords in the header with duplicates removed. PyFITS 3.1 changes that behavior, so that ``Header.keys()`` includes duplicates. - Fixed a bug where ``ImageHDU.scale(option='old')`` wasn't working at all--it was not restoring the image to its original BSCALE and BZERO values. (#162) - Fixed a bug where opening a file containing compressed image HDUs in 'update' mode and then immediately closing it without making any changes caused the file to be rewritten unncessarily. (#167) - Fixed two memory leaks that could occur when writing compressed image data, or in some cases when opening files containing compressed image HDUs in 'update' mode. (#168) 3.0.8 (2012-06-04) ------------------ Changes in Behavior ^^^^^^^^^^^^^^^^^^^ - Prior to this release, image data sections did not work with scaled data--that is, images with non-trivial BSCALE and/or BZERO values. Previously, in order to read such images in sections, it was necessary to manually apply the BSCALE+BZERO to each section. It's worth noting that sections *did* support pseudo-unsigned ints (flakily). This change just extends that support for general BSCALE+BZERO values. Bug Fixes ^^^^^^^^^ - Fixed a bug that prevented updates to values in boolean table columns from being saved. This turned out to be a symptom of a deeper problem that could prevent other table updates from being saved as well. (#139) - Fixed a corner case in which a keyword comment ending with the string "END" could, in some circumstances, cause headers (and the rest of the file after that point) to be misread. (#142) - Fixed support for scaled image data and psuedo-unsigned ints in image data sections (``hdu.section``). Previously this was not supported at all. At some point support was supposedly added, but it was buggy and incomplete. Now the feature seems to work much better. (#143) - Fixed the documentation to point out that image data sections *do* support non-contiguous slices (and have for a long time). The documentation was never updated to reflect this, and misinformed users that only contiguous slices were supported, leading to some confusion. (#144) - Fixed a bug where creating an ``HDUList`` object containing multiple PRIMARY HDUs caused an infinite recursion when validating the object prior to writing to a file. (#145) - Fixed a rare but serious case where saving an update to a file that previously had a CHECKSUM and/or DATASUM keyword, but removed the checksum in saving, could cause the file to be slightly corrupted and unreadable. (#147) - Fixed problems with reading "non-standard" FITS files with primary headers containing SIMPLE = F. PyFITS has never made many guarantees as to how such files are handled. But it should at least be possible to read their headers, and the data if possible. Saving changes to such a file should not try to prepend an unwanted valid PRIMARY HDU. (#157) - Fixed a bug where opening an image with ``disable_image_compression = True`` caused compression to be disabled for all subsequent ``pyfits.open()`` calls. (r1651) 3.0.7 (2012-04-10) ------------------ Changes in Behavior ^^^^^^^^^^^^^^^^^^^ - Slices of GroupData objects now return new GroupData objects instead of extended multi-row _Group objects. This is analogous to how PyFITS 3.0 fixed FITS_rec slicing, and should have been fixed for GroupData at the same time. The old behavior caused bugs where functions internal to Numpy expected that slicing an ndarray would return a new ndarray. As this is a rare usecase with a rare feature most users are unlikely to be affected by this change. - The previously internal _Group object for representing individual group records in a GroupData object are renamed Group and are now a public interface. However, there's almost no good reason to create Group objects directly, so it shouldn't be considered a "new feature". - An annoyance from PyFITS 3.0.6 was fixed, where the value of the EXTEND keyword was always being set to F if there are not actually any extension HDUs. It was unnecessary to modify this value. Bug Fixes ^^^^^^^^^ - Fixed GroupData objects to return new GroupData objects when sliced instead of _Group record objects. See "Changes in behavior" above for more details. - Fixed slicing of Group objects--previously it was not possible to slice slice them at all. - Made it possible to assign `np.bool_` objects as header values. (#123) - Fixed overly strict handling of the EXTEND keyword; see "Changes in behavior" above. (#124) - Fixed many cases where an HDU's header would be marked as "modified" by PyFITS and rewritten, even when no changes to the header are necessary. (#125) - Fixed a bug where the values of the PTYPEn keywords in a random groups HDU were forced to be all lower-case when saving the file. (#130) - Removed an unnecessary inline import in `ExtensionHDU.__setattr__` that was causing some slowdown when opening files containing a large number of extensions, plus a few other small (but not insignificant) performance improvements thanks to Julian Taylor. (#133) - Fixed a regression where header blocks containing invalid end-of-header padding (i.e. null bytes instead of spaces) couldn't be parsed by PyFITS. Such headers can be parsed again, but a warning is raised, as such headers are not valid FITS. (#136) - Fixed a memory leak where table data in random groups HDUs weren't being garbage collected. (#138) 3.0.6 (2012-02-29) ------------------ Highlights ^^^^^^^^^^ The main reason for this release is to fix an issue that was introduced in PyFITS 3.0.5 where merely opening a file containing scaled data (that is, with non-trivial BSCALE and BZERO keywords) in 'update' mode would cause the data to be automatically rescaled--possibly converting the data from ints to floats--as soon as the file is closed, even if the application did not touch the data. Now PyFITS will only rescale the data in an extension when the data is actually accessed by the application. So opening a file in 'update' mode in order to modify the header or append new extensions will not cause any change to the data in existing extensions. This release also fixes a few Windows-specific bugs found through more extensive Windows testing, and other miscellaneous bugs. Bug Fixes ^^^^^^^^^ - More accurate error messages when opening files containing invalid header cards. (#109) - Fixed a possible reference cycle/memory leak that was caught through more extensive testing on Windows. (#112) - Fixed 'ostream' mode to open the underlying file in 'wb' mode instead of 'w' mode. (#112) - Fixed a Windows-only issue where trying to save updates to a resized FITS file could result in a crash due to there being open mmaps on that file. (#112) - Fixed a crash when trying to create a FITS table (i.e. with new_table()) from a Numpy array containing bool fields. (#113) - Fixed a bug where manually initializing an ``HDUList`` with a list of of HDUs wouldn't set the correct EXTEND keyword value on the primary HDU. (#114) - Fixed a crash that could occur when trying to deepcopy a Header in Python < 2.7. (#115) - Fixed an issue where merely opening a scaled image in 'update' mode would cause the data to be converted to floats when the file is closed. (#119) 3.0.5 (2012-01-30) ------------------ - Fixed a crash that could occur when accessing image sections of files opened with memmap=True. (r1211) - Fixed the inconsistency in the behavior of files opened in 'readonly' mode when memmap=True vs. when memmap=False. In the latter case, although changes to array data were not saved to disk, it was possible to update the array data in memory. On the other hand with memmap=True, 'readonly' mode prevented even in-memory modification to the data. This is what 'copyonwrite' mode was for, but difference in behavior was confusing. Now 'readonly' is equivalent to 'copyonwrite' when using memmap. If the old behavior of denying changes to the array data is necessary, a new 'denywrite' mode may be used, though it is only applicable to files opened with memmap. (r1275) - Fixed an issue where files opened with memmap=True would return image data as a raw numpy.memmap object, which can cause some unexpected behaviors--instead memmap object is viewed as a numpy.ndarray. (r1285) - Fixed an issue in Python 3 where a workaround for a bug in Numpy on Python 3 interacted badly with some other software, namely to vo.table package (and possibly others). (r1320, r1337, and #110) - Fixed buggy behavior in the handling of SIGINTs (i.e. Ctrl-C keyboard interrupts) while flushing changes to a FITS file. PyFITS already prevented SIGINTs from causing an incomplete flush, but did not clean up the signal handlers properly afterwards, or reraise the keyboard interrupt once the flush was complete. (r1321) - Fixed a crash that could occur in Python 3 when opening files with checksum checking enabled. (r1336) - Fixed a small bug that could cause a crash in the `StreamingHDU` interface when using Numpy below version 1.5. - Fixed a crash that could occur when creating a new `CompImageHDU` from an array of big-endian data. (#104) - Fixed a crash when opening a file with extra zero padding at the end. Though FITS files should not have such padding, it's not explicitly forbidden by the format either, and PyFITS shouldn't stumble over it. (#106) - Fixed a major slowdown in opening tables containing large columns of string values. (#111) 3.0.4 (2011-11-22) ------------------ - Fixed a crash when writing HCOMPRESS compressed images that could happen on Python 2.5 and 2.6. (r1217) - Fixed a crash when slicing an table in a file opened in 'readonly' mode with memmap=True. (r1230) - Writing changes to a file or writing to a new file verifies the output in 'fix' mode by default instead of 'exception'--that is, PyFITS will automatically fix common FITS format errors rather than raising an exception. (r1243) - Fixed a bug where convenience functions such as getval() and getheader() crashed when specifying just 'PRIMARY' as the extension to use (r1263). - Fixed a bug that prevented passing keyword arguments (beyond the standard data and header arguments) as positional arguments to the constructors of extension HDU classes. - Fixed some tests that were failing on Windows--in this case the tests themselves failed to close some temp files and Windows refused to delete them while there were still open handles on them. (r1295) - Fixed an issue with floating point formatting in header values on Python 2.5 for Windows (and possibly other platforms). The exponent was zero-padded to 3 digits; although the FITS standard makes no specification on this, the formatting is now normalized to always pad the exponent to two digits. (r1295) - Fixed a bug where long commentary cards (such as HISTORY and COMMENT) were broken into multiple CONTINUE cards. However, commentary cards are not expected to be found in CONTINUE cards. Instead these long cards are broken into multiple commentary cards. (#97) - GZIP/ZIP-compressed FITS files can be detected and opened regardless of their filename extension. (#99) - Fixed a serious bug where opening scaled images in 'update' mode and then closing the file without touching the data would cause the file to be corrupted. (#101) 3.0.3 (2011-10-05) ------------------ - Fixed several small bugs involving corner cases in record-valued keyword cards (#70) - In some cases HDU creation failed if the first keyword value in the header was not a string value (#89) - Fixed a crash when trying to compute the HDU checksum when the data array contains an odd number of bytes (#91) - Disabled an unnecessary warning that was displayed on opening compressed HDUs with disable_image_compression = True (#92) - Fixed a typo in code for handling HCOMPRESS compressed images. 3.0.2 (2011-09-23) ------------------ - The ``BinTableHDU.tcreate`` method and by extension the ``pyfits.tcreate`` function don't get tripped up by blank lines anymore (#14) - The presence, value, and position of the EXTEND keyword in Primary HDUs is verified when reading/writing a FITS file (#32) - Improved documentation (in warning messages as well as in the handbook) that PyFITS uses zero-based indexing (as one would expect for C/Python code, but contrary to the PyFITS standard which was written with FORTRAN in mind) (#68) - Fixed a bug where updating a header card comment could cause the value to be lost if it had not already been read from the card image string. - Fixed a related bug where changes made directly to Card object in a header (i.e. assigning directly to card.value or card.comment) would not propagate when flushing changes to the file (#69) [Note: This and the bug above it were originally reported as being fixed in version 3.0.1, but the fix was never included in the release.] - Improved file handling, particularly in Python 3 which had a few small file I/O-related bugs (#76) - Fixed a bug where updating a FITS file would sometimes cause it to lose its original file permissions (#79) - Fixed the handling of TDIMn keywords; 3.0 added support for them, but got the axis order backards (they were treated as though they were row-major) (#82) - Fixed a crash when a FITS file containing scaled data is opened and immediately written to a new file without explicitly viewing the data first (#84) - Fixed a bug where creating a table with columns named either 'names' or 'formats' resulted in an infinite recursion (#86) 3.0.1 (2011-09-12) ------------------ - Fixed a bug where updating a header card comment could cause the value to be lost if it had not already been read from the card image string. - Changed ``_TableBaseHDU.data`` so that if the data contain an empty table a ``FITS_rec`` object with zero rows is returned rather than ``None``. - The ``.key`` attribute of ``RecordValuedKeywordCards`` now returns the full keyword+field-specifier value, instead of just the plain keyword (#46) - Fixed a related bug where changes made directly to Card object in a header (i.e. assigning directly to card.value or card.comment) would not propagate when flushing changes to the file (#69) - Fixed a bug where writing a table with zero rows could fail in some cases (#72) - Miscellanous small bug fixes that were causing some tests to fail, particularly on Python 3 (#74, #75) - Fixed a bug where creating a table column from an array in non-native byte order would not preserve the byte order, thus interpreting the column array using the wrong byte order (#77) 3.0.0 (2011-08-23) -------------------- - Contains major changes, bumping the version to 3.0 - Large amounts of refactoring and reorganization of the code; tried to preserve public API backwards-compatibility with older versions (private API has many changes and is not guaranteed to be backwards-compatible). There are a few small public API changes to be aware of: * The pyfits.rec module has been removed completely. If your version of numpy does not have the numpy.core.records module it is too old to be used with PyFITS. * The ``Header.ascardlist()`` method is deprecated--use the ``.ascard`` attribute instead. * ``Card`` instances have a new ``.cardimage`` attribute that should be used rather than ``.ascardimage()``, which may become deprecated. * The ``Card.fromstring()`` method is now a classmethod. It returns a new ``Card`` instance rather than modifying an existing instance. * The ``req_cards()`` method on HDU instances has changed: The ``pos`` argument is not longer a string. It is either an integer value (meaning the card's position must match that value) or it can be a function that takes the card's position as it's argument, and returns True if the position is valid. Likewise, the ``test`` argument no longer takes a string, but instead a function that validates the card's value and returns True or False. * The ``get_coldefs()`` method of table HDUs is deprecated. Use the ``.columns`` attribute instead. * The ``ColDefs.data`` attribute is deprecated--use ``ColDefs.columns`` instead (though in general you shouldn't mess with it directly--it might become internal at some point). * ``FITS_record`` objects take ``start`` and ``end`` as arguments instead of ``startColumn`` and ``endColumn`` (these are rarely created manually, so it's unlikely that this change will affect anyone). * ``BinTableHDU.tcreate()`` is now a classmethod, and returns a new ``BinTableHDU`` instance. * Use ``ExtensionHDU`` and ``NonstandardExtHDU`` for making new extension HDU classes. They are now public interfaces, wheres previously they were private and prefixed with underscores. * Possibly others--please report if you find any changes that cause difficulties. - Calls to deprecated functions will display a Deprecation warning. However, in Python 2.7 and up Deprecation warnings are ignored by default, so run Python with the `-Wd` option to see if you're using any deprecated functions. If we get close to actually removing any functions, we might make the Deprecation warnings display by default. - Added basic Python 3 support - Added support for multi-dimensional columns in tables as specified by the TDIMn keywords (#47) - Fixed a major memory leak that occurred when creating new tables with the ``new_table()`` function (#49) be padded with zero-bytes) vs ASCII tables (where strings are padded with spaces) (#15) - Fixed a bug in which the case of Random Access Group parameters names was not preserved when writing (#41) - Added support for binary table fields with zero width (#42) - Added support for wider integer types in ASCII tables; although this is non- standard, some GEIS images require it (#45) - Fixed a bug that caused the index_of() method of HDULists to crash when the HDUList object is created from scratch (#48) - Fixed the behavior of string padding in binary tables (where strings should be padded with nulls instead of spaces) - Fixed a rare issue that caused excessive memory usage when computing checksums using a non-standard block size (see r818) - Add support for forced uint data in image sections (#53) - Fixed an issue where variable-length array columns were not extended when creating a new table with more rows than the original (#54) - Fixed tuple and list-based indexing of FITS_rec objects (#55) - Fixed an issue where BZERO and BSCALE keywords were appended to headers in the wrong location (#56) - ``FITS_record`` objects (table rows) have full slicing support, including stepping, etc. (#59) - Fixed a bug where updating multiple files simultaneously (such as when running parallel processes) could lead to a race condition with mktemp() (#61) - Fixed a bug where compressed image headers were not in the order expected by the funpack utility (#62) 2.4.0 (2011-01-10) -------------------- The following enhancements were added: - Checksum support now correctly conforms to the FITS standard. pyfits supports reading and writing both the old checksums and new standard-compliant checksums. The `fitscheck` command-line utility is provided to verify and update checksums. - Added a new optional keyword argument ``do_not_scale_image_data`` to the ``pyfits.open`` convenience function. When this argument is provided as True, and an ImageHDU is read that contains scaled data, the data is not automatically scaled when it is read. This option may be used when opening a fits file for update, when you only want to update some header data. Without the use of this argument, if the header updates required the size of the fits file to change, then when writing the updated information, the data would be read, scaled, and written back out in its scaled format (usually with a different data type) instead of in its non-scaled format. - Added a new optional keyword argument ``disable_image_compression`` to the ``pyfits.open`` function. When ``True``, any compressed image HDU's will be read in like they are binary table HDU's. - Added a ``verify`` keyword argument to the ``pyfits.append`` function. When ``False``, ``append`` will assume the existing FITS file is already valid and simply append new content to the end of the file, resulting in a large speed up appending to large files. - Added HDU methods ``update_ext_name`` and ``update_ext_version`` for updating the name and version of an HDU. - Added HDU method ``filebytes`` to calculate the number of bytes that will be written to the file associated with the HDU. - Enhanced the section class to allow reading non-contiguous image data. Previously, the section class could only be used to read contiguous data. (CNSHD781626) - Added method ``HDUList.fileinfo()`` that returns a dictionary with information about the location of header and data in the file associated with the HDU. The following bugs were fixed: - Reading in some malformed FITS headers would cause a ``NameError`` exception, rather than information about the cause of the error. - pyfits can now handle non-compliant ``CONTINUE`` cards produced by Java FITS. - ``BinTable`` columns with ``TSCALn`` are now byte-swapped correctly. - Ensure that floating-point card values are no longer than 20 characters. - Updated ``flush`` so that when the data has changed in an HDU for a file opened in update mode, the header will be updated to match the changed data before writing out the HDU. - Allow ``HIERARCH`` cards to contain a keyword and value whose total character length is 69 characters. Previous length was limited at 68 characters. - Calls to ``FITS_rec['columnName']`` now return an ``ndarray``. exactly the same as a call to ``FITS_rec.field('columnName')`` or ``FITS_rec.columnName``. Previously, ``FITS_rec['columnName']`` returned a much less useful ``fits_record`` object. (CNSHD789053) - Corrected the ``append`` convenience function to eliminate the reading of the HDU data from the file that is being appended to. (CNSHD794738) - Eliminated common symbols between the pyfitsComp module and the cfitsio and zlib libraries. These can cause problems on systems that use both PyFITS and cfitsio or zlib. (CNSHD795046) 2.3.1 (2010-06-03) -------------------- The following bugs were fixed: - Replaced code in the Compressed Image HDU extension which was covered under a GNU General Public License with code that is covered under a BSD License. This change allows the distribution of pyfits under a BSD License. 2.3 (2010-05-11) ------------------ The following enhancements were made: - Completely eliminate support for numarray. - Rework pyfits documentation to use Sphinx. - Support python 2.6 and future division. - Added a new method to get the file name associated with an HDUList object. The method HDUList.filename() returns the name of an associated file. It returns None if no file is associated with the HDUList. - Support the python 2.5 'with' statement when opening fits files. (CNSHD766308) It is now possible to use the following construct: >>> from __future__ import with_statement import pyfits >>> with pyfits.open("input.fits") as hdul: ... #process hdul >>> - Extended the support for reading unsigned integer 16 values from an ImageHDU to include unsigned integer 32 and unsigned integer 64 values. ImageHDU data is considered to be unsigned integer 16 when the data type is signed integer 16 and BZERO is equal to 2**15 (32784) and BSCALE is equal to 1. ImageHDU data is considered to be unsigned integer 32 when the data type is signed integer 32 and BZERO is equal to 2**31 and BSCALE is equal to 1. ImageHDU data is considered to be unsigned integer 64 when the data type is signed integer 64 and BZERO is equal to 2**63 and BSCALE is equal to 1. An optional keyword argument (uint) was added to the open convenience function for this purpose. Supplying a value of True for this argument will cause data of any of these types to be read in and scaled into the appropriate unsigned integer array (uint16, uint32, or uint64) instead of into the normal float 32 or float 64 array. If an HDU associated with a file that was opened with the 'int' option and containing unsigned integer 16, 32, or 64 data is written to a file, the data will be reverse scaled into a signed integer 16, 32, or 64 array and written out to the file along with the appropriate BSCALE/BZERO header cards. Note that for backward compatibility, the 'uint16' keyword argument will still be accepted in the open function when handling unsigned integer 16 conversion. - Provided the capability to access the data for a column of a fits table by indexing the table using the column name. This is consistent with Record Arrays in numpy (array with fields). (CNSHD763378) The following example will illustrate this: >>> import pyfits >>> hdul = pyfits.open('input.fits') >>> table = hdul[1].data >>> table.names ['c1','c2','c3','c4'] >>> print table.field('c2') # this is the data for column 2 ['abc' 'xy'] >>> print table['c2'] # this is also the data for column 2 array(['abc', 'xy '], dtype='|S3') >>> print table[1] # this is the data for row 1 (2, 'xy', 6.6999997138977054, True) - Provided capabilities to create a BinaryTableHDU directly from a numpy Record Array (array with fields). The new capabilities include table creation, writing a numpy Record Array directly to a fits file using the pyfits.writeto and pyfits.append convenience functions. Reading the data for a BinaryTableHDU from a fits file directly into a numpy Record Array using the pyfits.getdata convenience function. (CNSHD749034) Thanks to Erin Sheldon at Brookhaven National Laboratory for help with this. The following should illustrate these new capabilities: >>> import pyfits >>> import numpy >>> t=numpy.zeros(5,dtype=[('x','f4'),('y','2i4')]) \ ... # Create a numpy Record Array with fields >>> hdu = pyfits.BinTableHDU(t) \ ... # Create a Binary Table HDU directly from the Record Array >>> print hdu.data [(0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32))] >>> hdu.writeto('test1.fits',clobber=True) \ ... # Write the HDU to a file >>> pyfits.info('test1.fits') Filename: test1.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 4 () uint8 1 BinTableHDU 12 5R x 2C [E, 2J] >>> pyfits.writeto('test.fits', t, clobber=True) \ ... # Write the Record Array directly to a file >>> pyfits.append('test.fits', t) \ ... # Append another Record Array to the file >>> pyfits.info('test.fits') Filename: test.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 4 () uint8 1 BinTableHDU 12 5R x 2C [E, 2J] 2 BinTableHDU 12 5R x 2C [E, 2J] >>> d=pyfits.getdata('test.fits',ext=1) \ ... # Get the first extension from the file as a FITS_rec >>> print type(d) >>> print d [(0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32)) (0.0, array([0, 0], dtype=int32))] >>> d=pyfits.getdata('test.fits',ext=1,view=numpy.ndarray) \ ... # Get the first extension from the file as a numpy Record Array >>> print type(d) >>> print d [(0.0, [0, 0]) (0.0, [0, 0]) (0.0, [0, 0]) (0.0, [0, 0]) (0.0, [0, 0])] >>> print d.dtype [('x', '>f4'), ('y', '>i4', 2)] >>> d=pyfits.getdata('test.fits',ext=1,upper=True, ... view=pyfits.FITS_rec) \ ... # Force the Record Array field names to be in upper case regardless of how they are stored in the file >>> print d.dtype [('X', '>f4'), ('Y', '>i4', 2)] - Provided support for writing fits data to file-like objects that do not support the random access methods seek() and tell(). Most pyfits functions or methods will treat these file-like objects as an empty file that cannot be read, only written. It is also expected that the file-like object is in a writable condition (ie. opened) when passed into a pyfits function or method. The following methods and functions will allow writing to a non-random access file-like object: HDUList.writeto(), HDUList.flush(), pyfits.writeto(), and pyfits.append(). The pyfits.open() convenience function may be used to create an HDUList object that is associated with the provided file-like object. (CNSHD770036) An illustration of the new capabilities follows. In this example fits data is written to standard output which is associated with a file opened in write-only mode: >>> import pyfits >>> import numpy as np >>> import sys >>> >>> hdu = pyfits.PrimaryHDU(np.arange(100,dtype=np.int32)) >>> hdul = pyfits.HDUList() >>> hdul.append(hdu) >>> tmpfile = open('tmpfile.py','w') >>> sys.stdout = tmpfile >>> hdul.writeto(sys.stdout, clobber=True) >>> sys.stdout = sys.__stdout__ >>> tmpfile.close() >>> pyfits.info('tmpfile.py') Filename: tmpfile.py No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 5 (100,) int32 >>> - Provided support for slicing a FITS_record object. The FITS_record object represents the data from a row of a table. Pyfits now supports the slice syntax to retrieve values from the row. The following illustrates this new syntax: >>> hdul = pyfits.open('table.fits') >>> row = hdul[1].data[0] >>> row ('clear', 'nicmos', 1, 30, 'clear', 'idno= 100') >>> a, b, c, d, e = row[0:5] >>> a 'clear' >>> b 'nicmos' >>> c 1 >>> d 30 >>> e 'clear' >>> - Allow the assignment of a row value for a pyfits table using a tuple or a list as input. The following example illustrates this new feature: >>> c1=pyfits.Column(name='target',format='10A') >>> c2=pyfits.Column(name='counts',format='J',unit='DN') >>> c3=pyfits.Column(name='notes',format='A10') >>> c4=pyfits.Column(name='spectrum',format='5E') >>> c5=pyfits.Column(name='flag',format='L') >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5]) >>> >>> tbhdu=pyfits.new_table(coldefs, nrows = 5) >>> >>> # Assigning data to a table's row using a tuple >>> tbhdu.data[2] = ('NGC1',312,'A Note', ... num.array([1.1,2.2,3.3,4.4,5.5],dtype=num.float32), ... True) >>> >>> # Assigning data to a tables row using a list >>> tbhdu.data[3] = ['JIM1','33','A Note', ... num.array([1.,2.,3.,4.,5.],dtype=num.float32),True] - Allow the creation of a Variable Length Format (P format) column from a list of data. The following example illustrates this new feature: >>> a = [num.array([7.2e-20,7.3e-20]),num.array([0.0]), ... num.array([0.0])] >>> acol = pyfits.Column(name='testa',format='PD()',array=a) >>> acol.array _VLF([[ 7.20000000e-20 7.30000000e-20], [ 0.], [ 0.]], dtype=object) >>> - Allow the assignment of multiple rows in a table using the slice syntax. The following example illustrates this new feature: >>> counts = num.array([312,334,308,317]) >>> names = num.array(['NGC1','NGC2','NGC3','NCG4']) >>> c1=pyfits.Column(name='target',format='10A',array=names) >>> c2=pyfits.Column(name='counts',format='J',unit='DN', ... array=counts) >>> c3=pyfits.Column(name='notes',format='A10') >>> c4=pyfits.Column(name='spectrum',format='5E') >>> c5=pyfits.Column(name='flag',format='L',array=[1,0,1,1]) >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5]) >>> >>> tbhdu1=pyfits.new_table(coldefs) >>> >>> counts = num.array([112,134,108,117]) >>> names = num.array(['NGC5','NGC6','NGC7','NCG8']) >>> c1=pyfits.Column(name='target',format='10A',array=names) >>> c2=pyfits.Column(name='counts',format='J',unit='DN', ... array=counts) >>> c3=pyfits.Column(name='notes',format='A10') >>> c4=pyfits.Column(name='spectrum',format='5E') >>> c5=pyfits.Column(name='flag',format='L',array=[0,1,0,0]) >>> coldefs=pyfits.ColDefs([c1,c2,c3,c4,c5]) >>> >>> tbhdu=pyfits.new_table(coldefs) >>> tbhdu.data[0][3] = num.array([1.,2.,3.,4.,5.], ... dtype=num.float32) >>> >>> tbhdu2=pyfits.new_table(tbhdu1.data, nrows=9) >>> >>> # Assign the 4 rows from the second table to rows 5 thru ... 8 of the new table. Note that the last row of the new ... table will still be initialized to the default values. >>> tbhdu2.data[4:] = tbhdu.data >>> >>> print tbhdu2.data [ ('NGC1', 312, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), True) ('NGC2', 334, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), False) ('NGC3', 308, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), True) ('NCG4', 317, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), True) ('NGC5', 112, '0.0', array([ 1., 2., 3., 4., 5.], dtype=float32), False) ('NGC6', 134, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), True) ('NGC7', 108, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), False) ('NCG8', 117, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), False) ('0.0', 0, '0.0', array([ 0., 0., 0., 0., 0.], dtype=float32), False)] >>> The following bugs were fixed: - Corrected bugs in HDUList.append and HDUList.insert to correctly handle the situation where you want to insert or append a Primary HDU as something other than the first HDU in an HDUList and the situation where you want to insert or append an Extension HDU as the first HDU in an HDUList. - Corrected a bug involving scaled images (both compressed and not compressed) that include a BLANK, or ZBLANK card in the header. When the image values match the BLANK or ZBLANK value, the value should be replaced with NaN after scaling. Instead, pyfits was scaling the BLANK or ZBLANK value and returning it. (CNSHD766129) - Corrected a byteswapping bug that occurs when writing certain column data. (CNSHD763307) - Corrected a bug that occurs when creating a column from a chararray when one or more elements are shorter than the specified format length. The bug wrote nulls instead of spaces to the file. (CNSHD695419) - Corrected a bug in the HDU verification software to ensure that the header contains no NAXISn cards where n > NAXIS. - Corrected a bug involving reading and writing compressed image data. When written, the header keyword card ZTENSION will always have the value 'IMAGE' and when read, if the ZTENSION value is not 'IMAGE' the user will receive a warning, but the data will still be treated as image data. - Corrected a bug that restricted the ability to create a custom HDU class and use it with pyfits. The bug fix will allow something like this: >>> import pyfits >>> class MyPrimaryHDU(pyfits.PrimaryHDU): ... def __init__(self, data=None, header=None): ... pyfits.PrimaryHDU.__init__(self, data, header) ... def _summary(self): ... """ ... Reimplement a method of the class. ... """ ... s = pyfits.PrimaryHDU._summary(self) ... # change the behavior to suit me. ... s1 = 'MyPRIMARY ' + s[11:] ... return s1 ... >>> hdul=pyfits.open("pix.fits", ... classExtensions={pyfits.PrimaryHDU: MyPrimaryHDU}) >>> hdul.info() Filename: pix.fits No. Name Type Cards Dimensions Format 0 MyPRIMARY MyPrimaryHDU 59 (512, 512) int16 >>> - Modified ColDefs.add_col so that instead of returning a new ColDefs object with the column added to the end, it simply appends the new column to the current ColDefs object in place. (CNSHD768778) - Corrected a bug in ColDefs.del_col which raised a KeyError exception when deleting a column from a ColDefs object. - Modified the open convenience function so that when a file is opened in readonly mode and the file contains no HDU's an IOError is raised. - Modified _TableBaseHDU to ensure that all locations where data is referenced in the object actually reference the same ndarray, instead of copies of the array. - Corrected a bug in the Column class that failed to initialize data when the data is a boolean array. (CNSHD779136) - Corrected a bug that caused an exception to be raised when creating a variable length format column from character data (PA format). - Modified installation code so that when installing on Windows, when a C++ compiler compatable with the Python binary is not found, the installation completes with a warning that all optional extension modules failed to build. Previously, an Error was issued and the installation stopped. 2.2.2 (2009-10-12) -------------------- Updates described in this release are only supported in the NUMPY version of pyfits. The following bugs were fixed: - Corrected a bug that caused an exception to be raised when creating a CompImageHDU using an initial header that does not match the image data in terms of the number of axis. 2.2.1 (2009-10-06) -------------------- Updates described in this release are only supported in the NUMPY version of pyfits. The following bugs were fixed: - Corrected a bug that prevented the opening of a fits file where a header contained a CHECKSUM card but no DATASUM card. - Corrected a bug that caused NULLs to be written instead of blanks when an ASCII table was created using a numpy chararray in which the original data contained trailing blanks. (CNSHD695419) 2.2 (2009-09-23) ------------------ Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Provide support for the FITS Checksum Keyword Convention. (CNSHD754301) - Adding the checksum=True keyword argument to the open convenience function will cause checksums to be verified on file open: >>> hdul=pyfits.open('in.fits', checksum=True) - On output, CHECKSUM and DATASUM cards may be output to all HDU's in a fits file by using the keyword argument checksum=True in calls to the writeto convenience function, the HDUList.writeto method, the writeto methods of all of the HDU classes, and the append convenience function: >>> hdul.writeto('out.fits', checksum=True) - Implemented a new insert method to the HDUList class that allows for the insertion of a HDU into a HDUList at a given index: >>> hdul.insert(2,hdu) - Provided the capability to handle Unicode input for file names. - Provided support for integer division required by Python 3.0. The following bugs were fixed: - Corrected a bug that caused an index out of bounds exception to be raised when iterating over the rows of a binary table HDU using the syntax "for row in tbhdu.data: ". (CNSHD748609) - Corrected a bug that prevented the use of the writeto convenience function for writing table data to a file. (CNSHD749024) - Modified the code to raise an IOError exception with the comment "Header missing END card." when pyfits can't find a valid END card for a header when opening a file. - This change addressed a problem with a non-standard fits file that contained several new-line characters at the end of each header and at the end of the file. However, since some people want to be able to open these non-standard files anyway, an option was added to the open convenience function to allow these files to be opened without exception: >>> pyfits.open('infile.fits',ignore_missing_end=True) - Corrected a bug that prevented the use of StringIO objects as fits files when reading and writing table data. Previously, only image data was supported. (CNSHD753698) - Corrected a bug that caused a bus error to be generated when compressing image data using GZIP_1 under the Solaris operating system. - Corrected bugs that prevented pyfits from properly reading Random Groups HDU's using numpy. (CNSHD756570) - Corrected a bug that can occur when writing a fits file. (CNSHD757508) - If no default SIGINT signal handler has not been assigned, before the write, a TypeError exception is raised in the _File.flush() method when attempting to return the signal handler to its previous state. Notably this occurred when using mod_python. The code was changed to use SIG_DFL when no old handler was defined. - Corrected a bug in CompImageHDU that prevented rescaling the image data using hdu.scale(option='old'). 2.1.1 (2009-04-22) ------------------- Updates described in this release are only supported in the NUMPY version of pyfits. The following bugs were fixed: - Corrected a bug that caused an exception to be raised when closing a file opened for append, where an HDU was appended to the file, after data was accessed from the file. This exception was only raised when running on a Windows platform. - Updated the installation scripts, compression source code, and benchmark test scripts to properly install, build, and execute on a Windows platform. 2.1 (2009-04-14) ------------------ Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Added new tdump and tcreate capabilities to pyfits. - The new tdump convenience function allows the contents of a binary table HDU to be dumped to a set of three files in ASCII format. One file will contain column definitions, the second will contain header parameters, and the third will contain header data. - The new tcreate convenience function allows the creation of a binary table HDU from the three files dumped by the tdump convenience function. - The primary use for the tdump/tcreate methods are to allow editing in a standard text editor of the binary table data and parameters. - Added support for case sensitive values of the EXTNAME card in an extension header. (CNSHD745784) - By default, pyfits converts the value of EXTNAME cards to upper case when reading from a file. A new convenience function (setExtensionNameCaseSensitive) was implemented to allow a user to circumvent this behavior so that the EXTNAME value remains in the same case as it is in the file. - With the following function call, pyfits will maintain the case of all characters in the EXTNAME card values of all extension HDU's during the entire python session, or until another call to the function is made: >>> import pyfits >>> pyfits.setExtensionNameCaseSensitive() - The following function call will return pyfits to its default (all upper case) behavior: >>> pyfits.setExtensionNameCaseSensitive(False) - Added support for reading and writing FITS files in which the value of the first card in the header is 'SIMPLE=F'. In this case, the pyfits open function returns an HDUList object that contains a single HDU of the new type _NonstandardHDU. The header for this HDU is like a normal header (with the exception that the first card contains SIMPLE=F instead of SIMPLE=T). Like normal HDU's the reading of the data is delayed until actually requested. The data is read from the file into a string starting from the first byte after the header END card and continuing till the end of the file. When written, the header is written, followed by the data string. No attempt is made to pad the data string so that it fills into a standard 2880 byte FITS block. (CNSHD744730) - Added support for FITS files containing extensions with unknown XTENSION card values. (CNSHD744730) Standard FITS files support extension HDU's of types TABLE, IMAGE, BINTABLE, and A3DTABLE. Accessing a nonstandard extension from a FITS file will now create a _NonstandardExtHDU object. Accessing the data of this object will cause the data to be read from the file into a string. If the HDU is written back to a file the string data is written after the Header and padded to fill a standard 2880 byte FITS block. The following bugs were fixed: - Extensive changes were made to the tiled image compression code to support the latest enhancements made in CFITSIO version 3.13 to support this convention. - Eliminated a memory leak in the tiled image compression code. - Corrected a bug in the FITS_record.__setitem__ method which raised a NameError exception when attempting to set a value in a FITS_record object. (CNSHD745844) - Corrected a bug that caused a TypeError exception to be raised when reading fits files containing large table HDU's (>2Gig). (CNSHD745522) - Corrected a bug that caused a TypeError exception to be raised for all calls to the warnings module when running under Python 2.6. The formatwarning method in the warnings module was changed in Python 2.6 to include a new argument. (CNSHD746592) - Corrected the behavior of the membership (in) operator in the Header class to check against header card keywords instead of card values. (CNSHD744730) - Corrected the behavior of iteration on a Header object. The new behavior iterates over the unique card keywords instead of the card values. 2.0.1 (2009-02-03) -------------------- Updates described in this release are only supported in the NUMPY version of pyfits. The following bugs were fixed: - Eliminated a memory leak when reading Table HDU's from a fits file. (CNSHD741877) 2.0 (2009-01-30) ------------------ Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Provide initial support for an image compression convention known as the "Tiled Image Compression Convention" `[1]`_. - The principle used in this convention is to first divide the n-dimensional image into a rectangular grid of subimages or "tiles". Each tile is then compressed as a continuous block of data, and the resulting compressed byte stream is stored in a row of a variable length column in a FITS binary table. Several commonly used algorithms for compressing image tiles are supported. These include, GZIP, RICE, H-Compress and IRAF pixel list (PLIO). - Support for compressed image data is provided using the optional "pyfitsComp" module contained in a C shared library (pyfitsCompmodule.so). - The header of a compressed image HDU appears to the user like any image header. The actual header stored in the FITS file is that of a binary table HDU with a set of special keywords, defined by the convention, to describe the structure of the compressed image. The conversion between binary table HDU header and image HDU header is all performed behind the scenes. Since the HDU is actually a binary table, it may not appear as a primary HDU in a FITS file. - The data of a compressed image HDU appears to the user as standard uncompressed image data. The actual data is stored in the fits file as Binary Table data containing at least one column (COMPRESSED_DATA). Each row of this variable-length column contains the byte stream that was generated as a result of compressing the corresponding image tile. Several optional columns may also appear. These include, UNCOMPRESSED_DATA to hold the uncompressed pixel values for tiles that cannot be compressed, ZSCALE and ZZERO to hold the linear scale factor and zero point offset which may be needed to transform the raw uncompressed values back to the original image pixel values, and ZBLANK to hold the integer value used to represent undefined pixels (if any) in the image. - To create a compressed image HDU from scratch, simply construct a CompImageHDU object from an uncompressed image data array and its associated image header. From there, the HDU can be treated just like any image HDU: >>> hdu=pyfits.CompImageHDU(imageData,imageHeader) >>> hdu.writeto('compressed_image.fits') - The signature for the CompImageHDU initializer method describes the possible options for constructing a CompImageHDU object:: def __init__(self, data=None, header=None, name=None, compressionType='RICE_1', tileSize=None, hcompScale=0., hcompSmooth=0, quantizeLevel=16.): """ data: data of the image header: header to be associated with the image name: the EXTNAME value; if this value is None, then the name from the input image header will be used; if there is no name in the input image header then the default name 'COMPRESSED_IMAGE' is used compressionType: compression algorithm 'RICE_1', 'PLIO_1', 'GZIP_1', 'HCOMPRESS_1' tileSize: compression tile sizes default treats each row of image as a tile hcompScale: HCOMPRESS scale parameter hcompSmooth: HCOMPRESS smooth parameter quantizeLevel: floating point quantization level; """ - Added two new convenience functions. The setval function allows the setting of the value of a single header card in a fits file. The delval function allows the deletion of a single header card in a fits file. - A modification was made to allow the reading of data from a fits file containing a Table HDU that has duplicate field names. It is normally a requirement that the field names in a Table HDU be unique. Prior to this change a ValueError was raised, when the data was accessed, to indicate that the HDU contained duplicate field names. Now, a warning is issued and the field names are made unique in the internal record array. This will not change the TTYPEn header card values. You will be able to get the data from all fields using the field name, including the first field containing the name that is duplicated. To access the data of the other fields with the duplicated names you will need to use the field number instead of the field name. (CNSHD737193) - An enhancement was made to allow the reading of unsigned integer 16 values from an ImageHDU when the data is signed integer 16 and BZERO is equal to 32784 and BSCALE is equal to 1 (the standard way for scaling unsigned integer 16 data). A new optional keyword argument (uint16) was added to the open convenience function. Supplying a value of True for this argument will cause data of this type to be read in and scaled into an unsigned integer 16 array, instead of a float 32 array. If a HDU associated with a file that was opened with the uint16 option and containing unsigned integer 16 data is written to a file, the data will be reverse scaled into an integer 16 array and written out to the file and the BSCALE/BZERO header cards will be written with the values 1 and 32768 respectively. (CHSHD736064) Reference the following example: >>> import pyfits >>> hdul=pyfits.open('o4sp040b0_raw.fits',uint16=1) >>> hdul[1].data array([[1507, 1509, 1505, ..., 1498, 1500, 1487], [1508, 1507, 1509, ..., 1498, 1505, 1490], [1505, 1507, 1505, ..., 1499, 1504, 1491], ..., [1505, 1506, 1507, ..., 1497, 1502, 1487], [1507, 1507, 1504, ..., 1495, 1499, 1486], [1515, 1507, 1504, ..., 1492, 1498, 1487]], dtype=uint16) >>> hdul.writeto('tmp.fits') >>> hdul1=pyfits.open('tmp.fits',uint16=1) >>> hdul1[1].data array([[1507, 1509, 1505, ..., 1498, 1500, 1487], [1508, 1507, 1509, ..., 1498, 1505, 1490], [1505, 1507, 1505, ..., 1499, 1504, 1491], ..., [1505, 1506, 1507, ..., 1497, 1502, 1487], [1507, 1507, 1504, ..., 1495, 1499, 1486], [1515, 1507, 1504, ..., 1492, 1498, 1487]], dtype=uint16) >>> hdul1=pyfits.open('tmp.fits') >>> hdul1[1].data array([[ 1507., 1509., 1505., ..., 1498., 1500., 1487.], [ 1508., 1507., 1509., ..., 1498., 1505., 1490.], [ 1505., 1507., 1505., ..., 1499., 1504., 1491.], ..., [ 1505., 1506., 1507., ..., 1497., 1502., 1487.], [ 1507., 1507., 1504., ..., 1495., 1499., 1486.], [ 1515., 1507., 1504., ..., 1492., 1498., 1487.]], dtype=float32) - Enhanced the message generated when a ValueError exception is raised when attempting to access a header card with an unparsable value. The message now includes the Card name. The following bugs were fixed: - Corrected a bug that occurs when appending a binary table HDU to a fits file. Data was not being byteswapped on little endian machines. (CNSHD737243) - Corrected a bug that occurs when trying to write an ImageHDU that is missing the required PCOUNT card in the header. An UnboundLocalError exception complaining that the local variable 'insert_pos' was referenced before assignment was being raised in the method _ValidHDU.req_cards. The code was modified so that it would properly issue a more meaningful ValueError exception with a description of what required card is missing in the header. - Eliminated a redundant warning message about the PCOUNT card when validating an ImageHDU header with a PCOUNT card that is missing or has a value other than 0. .. _[1]: http://fits.gsfc.nasa.gov/registry/tilecompression.html 1.4.1 (2008-11-04) -------------------- Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Enhanced the way import errors are reported to provide more information. The following bugs were fixed: - Corrected a bug that occurs when a card value is a string and contains a colon but is not a record-valued keyword card. - Corrected a bug where pyfits fails to properly handle a record-valued keyword card with values using exponential notation and trailing blanks. 1.4 (2008-07-07) ------------------ Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Added support for file objects and file like objects. - All convenience functions and class methods that take a file name will now also accept a file object or file like object. File like objects supported are StringIO and GzipFile objects. Other file like objects will work only if they implement all of the standard file object methods. - For the most part, file or file like objects may be either opened or closed at function call. An opened object must be opened with the proper mode depending on the function or method called. Whenever possible, if the object is opened before the method is called, it will remain open after the call. This will not be possible when writing a HDUList that has been resized or when writing to a GzipFile object regardless of whether it is resized. If the object is closed at the time of the function call, only the name from the object is used, not the object itself. The pyfits code will extract the file name used by the object and use that to create an underlying file object on which the function will be performed. - Added support for record-valued keyword cards as introduced in the "FITS WCS Paper IV proposal for representing a more general distortion model". - Record-valued keyword cards are string-valued cards where the string is interpreted as a definition giving a record field name, and its floating point value. In a FITS header they have the following syntax:: keyword= 'field-specifier: float' where keyword is a standard eight-character FITS keyword name, float is the standard FITS ASCII representation of a floating point number, and these are separated by a colon followed by a single blank. The grammar for field-specifier is:: field-specifier: field field-specifier.field field: identifier identifier.index where identifier is a sequence of letters (upper or lower case), underscores, and digits of which the first character must not be a digit, and index is a sequence of digits. No blank characters may occur in the field-specifier. The index is provided primarily for defining array elements though it need not be used for that purpose. Multiple record-valued keywords of the same name but differing values may be present in a FITS header. The field-specifier may be viewed as part of the keyword name. Some examples follow:: DP1 = 'NAXIS: 2' DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' DP1 = 'NAUX: 2' DP1 = 'AUX.1.COEFF.0: 0' DP1 = 'AUX.1.POWER.0: 1' DP1 = 'AUX.1.COEFF.1: 0.00048828125' DP1 = 'AUX.1.POWER.1: 1' - As with standard header cards, the value of a record-valued keyword card can be accessed using either the index of the card in a HDU's header or via the keyword name. When accessing using the keyword name, the user may specify just the card keyword or the card keyword followed by a period followed by the field-specifier. Note that while the card keyword is case insensitive, the field-specifier is not. Thus, hdu['abc.def'], hdu['ABC.def'], or hdu['aBc.def'] are all equivalent but hdu['ABC.DEF'] is not. - When accessed using the card index of the HDU's header the value returned will be the entire string value of the card. For example: >>> print hdr[10] NAXIS: 2 >>> print hdr[11] AXIS.1: 1 - When accessed using the keyword name exclusive of the field-specifier, the entire string value of the header card with the lowest index having that keyword name will be returned. For example: >>> print hdr['DP1'] NAXIS: 2 - When accessing using the keyword name and the field-specifier, the value returned will be the floating point value associated with the record-valued keyword card. For example: >>> print hdr['DP1.NAXIS'] 2.0 - Any attempt to access a non-existent record-valued keyword card value will cause an exception to be raised (IndexError exception for index access or KeyError for keyword name access). - Updating the value of a record-valued keyword card can also be accomplished using either index or keyword name. For example: >>> print hdr['DP1.NAXIS'] 2.0 >>> hdr['DP1.NAXIS'] = 3.0 >>> print hdr['DP1.NAXIS'] 3.0 - Adding a new record-valued keyword card to an existing header is accomplished using the Header.update() method just like any other card. For example: >>> hdr.update('DP1', 'AXIS.3: 1', 'a comment', after='DP1.AXIS.2') - Deleting a record-valued keyword card from an existing header is accomplished using the standard list deletion syntax just like any other card. For example: >>> del hdr['DP1.AXIS.1'] - In addition to accessing record-valued keyword cards individually using a card index or keyword name, cards can be accessed in groups using a set of special pattern matching keys. This access is made available via the standard list indexing operator providing a keyword name string that contains one or more of the special pattern matching keys. Instead of returning a value, a CardList object will be returned containing shared instances of the Cards in the header that match the given keyword specification. - There are three special pattern matching keys. The first key '*' will match any string of zero or more characters within the current level of the field-specifier. The second key '?' will match a single character. The third key '...' must appear at the end of the keyword name string and will match all keywords that match the preceding pattern down all levels of the field-specifier. All combinations of ?, \*, and ... are permitted (though ... is only permitted at the end). Some examples follow: >>> cl=hdr['DP1.AXIS.*'] >>> print cl DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' >>> cl=hdr['DP1.*'] >>> print cl DP1 = 'NAXIS: 2' DP1 = 'NAUX: 2' >>> cl=hdr['DP1.AUX...'] >>> print cl DP1 = 'AUX.1.COEFF.0: 0' DP1 = 'AUX.1.POWER.0: 1' DP1 = 'AUX.1.COEFF.1: 0.00048828125' DP1 = 'AUX.1.POWER.1: 1' >>> cl=hdr['DP?.NAXIS'] >>> print cl DP1 = 'NAXIS: 2' DP2 = 'NAXIS: 2' DP3 = 'NAXIS: 2' >>> cl=hdr['DP1.A*S.*'] >>> print cl DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' - The use of the special pattern matching keys for adding or updating header cards in an existing header is not allowed. However, the deletion of cards from the header using the special keys is allowed. For example: >>> del hdr['DP3.A*...'] - As noted above, accessing pyfits Header object using the special pattern matching keys will return a CardList object. This CardList object can itself be searched in order to further refine the list of Cards. For example: >>> cl=hdr['DP1...'] >>> print cl DP1 = 'NAXIS: 2' DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' DP1 = 'NAUX: 2' DP1 = 'AUX.1.COEFF.1: 0.000488' DP1 = 'AUX.2.COEFF.2: 0.00097656' >>> cl1=cl['*.*AUX...'] >>> print cl1 DP1 = 'NAUX: 2' DP1 = 'AUX.1.COEFF.1: 0.000488' DP1 = 'AUX.2.COEFF.2: 0.00097656' - The CardList keys() method will allow the retrieval of all of the key values in the CardList. For example: >>> cl=hdr['DP1.AXIS.*'] >>> print cl DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' >>> cl.keys() ['DP1.AXIS.1', 'DP1.AXIS.2'] - The CardList values() method will allow the retrieval of all of the values in the CardList. For example: >>> cl=hdr['DP1.AXIS.*'] >>> print cl DP1 = 'AXIS.1: 1' DP1 = 'AXIS.2: 2' >>> cl.values() [1.0, 2.0] - Individual cards can be retrieved from the list using standard list indexing. For example: >>> cl=hdr['DP1.AXIS.*'] >>> c=cl[0] >>> print c DP1 = 'AXIS.1: 1' >>> c=cl['DP1.AXIS.2'] >>> print c DP1 = 'AXIS.2: 2' - Individual card values can be retrieved from the list using the value attribute of the card. For example: >>> cl=hdr['DP1.AXIS.*'] >>> cl[0].value 1.0 - The cards in the CardList are shared instances of the cards in the source header. Therefore, modifying a card in the CardList also modifies it in the source header. However, making an addition or a deletion to the CardList will not affect the source header. For example: >>> hdr['DP1.AXIS.1'] 1.0 >>> cl=hdr['DP1.AXIS.*'] >>> cl[0].value = 4.0 >>> hdr['DP1.AXIS.1'] 4.0 >>> del cl[0] >>> print cl['DP1.AXIS.1'] Traceback (most recent call last): File "", line 1, in File "NP_pyfits.py", line 977, in __getitem__ return self.ascard[key].value File "NP_pyfits.py", line 1258, in __getitem__ _key = self.index_of(key) File "NP_pyfits.py", line 1403, in index_of raise KeyError, 'Keyword %s not found.' % `key` KeyError: "Keyword 'DP1.AXIS.1' not found." >>> hdr['DP1.AXIS.1'] 4.0 - A FITS header consists of card images. In pyfits each card image is manifested by a Card object. A pyfits Header object contains a list of Card objects in the form of a CardList object. A record-valued keyword card image is represented in pyfits by a RecordValuedKeywordCard object. This object inherits from a Card object and has all of the methods and attributes of a Card object. - A new RecordValuedKeywordCard object is created with the RecordValuedKeywordCard constructor: RecordValuedKeywordCard(key, value, comment). The key and value arguments may be specified in two ways. The key value may be given as the 8 character keyword only, in which case the value must be a character string containing the field-specifier, a colon followed by a space, followed by the actual value. The second option is to provide the key as a string containing the keyword and field-specifier, in which case the value must be the actual floating point value. For example: >>> c1 = pyfits.RecordValuedKeywordCard('DP1', 'NAXIS: 2', 'Number of variables') >>> c2 = pyfits.RecordValuedKeywordCard('DP1.AXIS.1', 1.0, 'Axis number') - RecordValuedKeywordCards have attributes .key, .field_specifier, .value, and .comment. Both .value and .comment can be changed but not .key or .field_specifier. The constructor will extract the field-specifier from the input key or value, whichever is appropriate. The .key attribute is the 8 character keyword. - Just like standard Cards, a RecordValuedKeywordCard may be constructed from a string using the fromstring() method or verified using the verify() method. For example: >>> c1 = pyfits.RecordValuedKeywordCard().fromstring( "DP1 = 'NAXIS: 2' / Number of independent variables") >>> c2 = pyfits.RecordValuedKeywordCard().fromstring( "DP1 = 'AXIS.1: X' / Axis number") >>> print c1; print c2 DP1 = 'NAXIS: 2' / Number of independent variables DP1 = 'AXIS.1: X' / Axis number >>> c2.verify() Output verification result: Card image is not FITS standard (unparsable value string). - A standard card that meets the criteria of a RecordValuedKeywordCard may be turned into a RecordValuedKeywordCard using the class method coerce. If the card object does not meet the required criteria then the original card object is just returned. >>> c1 = pyfits.Card('DP1','AUX: 1','comment') >>> c2 = pyfits.RecordValuedKeywordCard.coerce(c1) >>> print type(c2) <'pyfits.NP_pyfits.RecordValuedKeywordCard'> - Two other card creation methods are also available as RecordVauedKeywordCard class methods. These are createCard() which will create the appropriate card object (Card or RecordValuedKeywordCard) given input key, value, and comment, and createCardFromString which will create the appropriate card object given an input string. These two methods are also available as convenience functions: >>> c1 = pyfits.RecordValuedKeywordCard.createCard('DP1','AUX: 1','comment) or >>> c1 = pyfits.createCard('DP1','AUX: 1','comment) >>> print type(c1) <'pyfits.NP_pyfits.RecordValuedKeywordCard'> >>> c1 = pyfits.RecordValuedKeywordCard.createCard('DP1','AUX 1','comment) or >>> c1 = pyfits.createCard('DP1','AUX 1','comment) >>> print type(c1) <'pyfits.NP_pyfits.Card'> >>> c1 = pyfits.RecordValuedKeywordCard.createCardFromString \ ("DP1 = 'AUX: 1.0' / comment") or >>> c1 = pyfits.createCardFromString("DP1 = 'AUX: 1.0' / comment") >>> print type(c1) <'pyfits.NP_pyfits.RecordValuedKeywordCard'> The following bugs were fixed: - Corrected a bug that occurs when writing a HDU out to a file. During the write, any Keyboard Interrupts are trapped so that the write completes before the interrupt is handled. Unfortunately, the Keyboard Interrupt was not properly reinstated after the write completed. This was fixed. (CNSHD711138) - Corrected a bug when using ipython, where temporary files created with the tempFile.NamedTemporaryFile method are not automatically removed. This can happen for instance when opening a Gzipped fits file or when open a fits file over the internet. The files will now be removed. (CNSHD718307) - Corrected a bug in the append convenience function's call to the writeto convenience function. The classExtensions argument must be passed as a keyword argument. - Corrected a bug that occurs when retrieving variable length character arrays from binary table HDUs (PA() format) and using slicing to obtain rows of data containing variable length arrays. The code issued a TypeError exception. The data can now be accessed with no exceptions. (CNSHD718749) - Corrected a bug that occurs when retrieving data from a fits file opened in memory map mode when the file contains multiple image extensions or ASCII table or binary table HDUs. The code issued a TypeError exception. The data can now be accessed with no exceptions. (CNSHD707426) - Corrected a bug that occurs when attempting to get a subset of data from a Binary Table HDU and then use the data to create a new Binary Table HDU object. A TypeError exception was raised. The data can now be subsetted and used to create a new HDU. (CNSHD723761) - Corrected a bug that occurs when attempting to scale an Image HDU back to its original data type using the _ImageBaseHDU.scale method. The code was not resetting the BITPIX header card back to the original data type. This has been corrected. - Changed the code to issue a KeyError exception instead of a NameError exception when accessing a non-existent field in a table. 1.3 (2008-02-22) ------------------ Updates described in this release are only supported in the NUMPY version of pyfits. The following enhancements were made: - Provided support for a new extension to pyfits called *stpyfits*. - The *stpyfits* module is a wrapper around pyfits. It provides all of the features and functions of pyfits along with some STScI specific features. Currently, the only new feature supported by stpyfits is the ability to read and write fits files that contain image data quality extensions with constant data value arrays. See stpyfits `[2]`_ for more details on stpyfits. - Added a new feature to allow trailing HDUs to be deleted from a fits file without actually reading the data from the file. - This supports a JWST requirement to delete a trailing HDU from a file whose primary Image HDU is too large to be read on a 32 bit machine. - Updated pyfits to use the warnings module to issue warnings. All warnings will still be issued to stdout, exactly as they were before, however, you may now suppress warnings with the -Wignore command line option. For example, to run a script that will ignore warnings use the following command line syntax: python -Wignore yourscript.py - Updated the open convenience function to allow the input of an already opened file object in place of a file name when opening a fits file. - Updated the writeto convenience function to allow it to accept the output_verify option. - In this way, the user can use the argument output_verify='fix' to allow pyfits to correct any errors it encounters in the provided header before writing the data to the file. - Updated the verification code to provide additional detail with a VerifyError exception. - Added the capability to create a binary table HDU directly from a numpy.ndarray. This may be done using either the new_table convenience function or the BinTableHDU constructor. The following performance improvements were made: - Modified the import logic to dramatically decrease the time it takes to import pyfits. - Modified the code to provide performance improvements when copying and examining header cards. The following bugs were fixed: - Corrected a bug that occurs when reading the data from a fits file that includes BZERO/BSCALE scaling. When the data is read in from the file, pyfits automatically scales the data using the BZERO/BSCALE values in the header. In the previous release, pyfits created a 32 bit floating point array to hold the scaled data. This could cause a problem when the value of BZERO is so large that the scaled value will not fit into the float 32. For this release, when the input data is 32 bit integer, a 64 bit floating point array is used for the scaled data. - Corrected a bug that caused an exception to be raised when attempting to scale image data using the ImageHDU.scale method. - Corrected a bug in the new_table convenience function that occurred when a binary table was created using a ColDefs object as input and supplying an nrows argument for a number of rows that is greater than the number of rows present in the input ColDefs object. The previous version of pyfits failed to allocate the necessary memory for the additional rows. - Corrected a bug in the new_table convenience function that caused an exception to be thrown when creating an ASCII table. - Corrected a bug in the new_table convenience function that will allow the input of a ColDefs object that was read from a file as a binary table with a data value equal to None. - Corrected a bug in the construction of ASCII tables from Column objects that are created with noncontinuous start columns. - Corrected bugs in a number of areas that would sometimes cause a failure to improperly raise an exception when an error occurred. - Corrected a bug where attempting to open a non-existent fits file on a windows platform using a drive letter in the file specification caused a misleading IOError exception to be raised. .. _[2]: http://stsdas.stsci.edu/stsci_python_sphinxdocs_2.13/tools/stpyfits.html 1.1 (2007-06-15) ------------------ - Modified to use either NUMPY or NUMARRAY. - New file writing modes have been provided to allow streaming data to extensions without requiring the whole output extension image in memory. See documentation on StreamingHDU. - Improvements to minimize byteswapping and memory usage by byteswapping in place. - Now supports ':' characters in filenames. - Handles keyboard interrupts during long operations. - Preserves the byte order of the input image arrays. 1.0.1 (2006-03-24) -------------------- The changes to PyFITS were primarily to improve the docstrings and to reclassify some public functions and variables as private. Readgeis and fitsdiff which were distributed with PyFITS in previous releases were moved to pytools. This release of PyFITS is v1.0.1. The next release of PyFITS will support both numarray and numpy (and will be available separately from stsci_python, as are all the python packages contained within stsci_python). An alpha release for PyFITS numpy support will be made around the time of this stsci_python release. - Updated docstrings for public functions. - Made some previously public functions private. 1.0 (2005-11-01) ------------------ Major Changes since v0.9.6: - Added support for the HIERARCH convention - Added support for iteration and slicing for HDU lists - PyFITS now uses the standard setup.py installation script - Add utility functions at the module level, they include: - getheader - getdata - getval - writeto - append - update - info Minor changes since v0.9.6: - Fix a bug to make single-column ASCII table work. - Fix a bug so a new table constructed from an existing table with X-formatted columns will work. - Fix a problem in verifying HDUList right after the open statement. - Verify that elements in an HDUList, besides the first one, are ExtensionHDU. - Add output verification in methods flush() and close(). - Modify the the design of the open() function to remove the output_verify argument. - Remove the groups argument in GroupsHDU's contructor. - Redesign the column definition class to make its column components more accessible. Also to make it conducive for higher level functionalities, e.g. combining two column definitions. - Replace the Boolean class with the Python Boolean type. The old TRUE/FALSE will still work. - Convert classes to the new style. - Better format when printing card or card list. - Add the optional argument clobber to all writeto() functions and methods. - If adding a blank card, will not use existing blank card's space. PyFITS Version 1.0 REQUIRES Python 2.3 or later. 0.9.6 (2004-11-11) -------------------- Major changes since v0.9.3: - Support for variable length array tables. - Support for writing ASCII table extensions. - Support for random groups, both reading and writing. Some minor changes: - Support for numbers with leading zeros in an ASCII table extension. - Changed scaled columns' data type from Float32 to Float64 to preserve precision. - Made Column constructor more flexible in accepting format specification. 0.9.3 (2004-07-02) -------------------- Changes since v0.9.0: - Lazy instanciation of full Headers/Cards for all HDU's when the file is opened. At the open, only extracts vital info (e.g. NAXIS's) from the header parts. This change will speed up the performance if the user only needs to access one extension in a multi-extension FITS file. - Support the X format (bit flags) columns, both reading and writing, in a binary table. At the user interface, they are converted to Boolean arrays for easy manipulation. For example, if the column's TFORM is "11X", internally the data is stored in 2 bytes, but the user will see, at each row of this column, a Boolean array of 11 elements. - Fix a bug such that when a table extension has no data, it will not try to scale the data when updating/writing the HDU list. 0.9 (2004-04-27) ------------------ Changes since v0.8.0: - Rewriting of the Card class to separate the parsing and verification of header cards - Restructure the keyword indexing scheme which speed up certain applications (update large number of new keywords and reading a header with larger numbers of cards) by a factor of 30 or more - Change the default to be lenient FITS standard checking on input and strict FITS standard checking on output - Support CONTINUE cards, both reading and writing - Verification can now be performed at any of the HDUList, HDU, and Card levels - Support (contiguous) subsection (attribute .section) of images to reduce memory usage for large images 0.8.0 (2003-08-19) -------------------- **NOTE:** This version will only work with numarray Version 0.6. In addition, earlier versions of PyFITS will not work with numarray 0.6. Therefore, both must be updated simultaneously. Changes since 0.7.6: - Compatible with numarray 0.6/records 2.0 - For binary tables, now it is possible to update the original array if a scaled field is updated. - Support of complex columns - Modify the __getitem__ method in FITS_rec. In order to make sure the scaled quantities are also viewing the same data as the original FITS_rec, all fields need to be "touched" when __getitem__ is called. - Add a new attribute mmobject for HDUList, and close the memmap object when close HDUList object. Earlier version does not close memmap object and can cause memory lockup. - Enable 'update' as a legitimate memmap mode. - Do not print message when closing an HDUList object which is not created from reading a FITS file. Such message is confusing. - remove the internal attribute "closed" and related method (__getattr__ in HDUList). It is redundant. 0.7.6 (2002-11-22) **NOTE:** This version will only work with numarray Version 0.4. Changes since 0.7.5: - Change x*=n to numarray.multiply(x, n, x) where n is a floating number, in order to make pyfits to work under Python 2.2. (2 occurrences) - Modify the "update" method in the Header class to use the "fixed-format" card even if the card already exists. This is to avoid the mis-alignment as shown below: After running drizzle on ACS images it creates a CD matrix whose elements have very many digits, *e.g.*: CD1_1 = 1.1187596304411E-05 / partial of first axis coordinate w.r.t. x CD1_2 = -8.502767249350019E-06 / partial of first axis coordinate w.r.t. y with pyfits, an "update" on these header items and write in new values which has fewer digits, *e.g.*: CD1_1 = 1.0963011E-05 / partial of first axis coordinate w.r.t. x CD1_2 = -8.527229E-06 / partial of first axis coordinate w.r.t. y - Change some internal variables to make their appearance more consistent: old name new name __octalRegex _octalRegex __readblock() _readblock() __formatter() _formatter(). __value_RE _value_RE __numr _numr __comment_RE _comment_RE __keywd_RE _keywd_RE __number_RE _number_RE. tmpName() _tmpName() dimShape _dimShape ErrList _ErrList - Move up the module description. Move the copyright statement to the bottom and assign to the variable __credits__. - change the following line: self.__dict__ = input.__dict__ to self.__setstate__(input.__getstate__()) in order for pyfits to run under numarray 0.4. - edit _readblock to add the (optional) firstblock argument and raise IOError if the the first 8 characters in the first block is not 'SIMPLE ' or 'XTENSION'. Edit the function open to check for IOError to skip the last null filled block(s). Edit readHDU to add the firstblock argument. 0.7.5 (2002-08-16) -------------------- Changes since v0.7.3: - Memory mapping now works for readonly mode, both for images and binary tables. Usage: pyfits.open('filename', memmap=1) - Edit the field method in FITS_rec class to make the column scaling for numbers use less temporary memory. (does not work under 2.2, due to Python "bug" of array \*=) - Delete bscale/bzero in the ImageBaseHDU constructor. - Update bitpix in BaseImageHDU.__getattr__ after deleting bscale/bzero. (bug fix) - In BaseImageHDU.__getattr__ point self.data to raw_data if float and if not memmap. (bug fix). - Change the function get_tbdata() to private: _get_tbdata(). 0.7.3 (2002-07-12) -------------------- Changes since v0.7.2: - It will scale all integer image data to Float32, if BSCALE/BZERO != 1/0. It will also expunge the BSCALE/BZERO keywords. - Add the scale() method for ImageBaseHDU, so data can be scaled just before being written to the file. It has the following arguments: type: destination data type (string), e.g. Int32, Float32, UInt8, etc. option: scaling scheme. if 'old', use the old BSCALE/BZERO values. if 'minmax', use the data range to fit into the full range of specified integer type. Float destination data type will not be scaled for this option. bscale/bzero: user specifiable BSCALE/BZERO values. They overwrite the "option". - Deal with data area resizing in 'update' mode. - Make the data scaling (both input and output) faster and use less memory. - Bug fix to make column name change takes effect for field. - Bug fix to avoid exception if the key is not present in the header already. This affects (fixes) add_history(), add_comment(), and add_blank(). - Bug fix in __getattr__() in Card class. The change made in 0.7.2 to rstrip the comment must be string type to avoid exception. 0.7.2.1 (2002-06-25) ---------------------- A couple of bugs were addressed in this version. - Fix a bug in _add_commentary(). Due to a change in index_of() during version 0.6.5.5, _add_commentary needs to be modified to avoid exception if the key is not present in the header already. This affects (fixes) add_history(), add_comment(), and add_blank(). - Fix a bug in __getattr__() in Card class. The change made in 0.7.2 to rstrip the comment must be string type to avoid exception. 0.7.2 (2002-06-19) -------------------- The two major improvements from Version 0.6.2 are: - support reading tables with "scaled" columns (e.g. tscal/tzero, Boolean, and ASCII tables) - a prototype output verification. This version of PyFITS requires numarray version 0.3.4. Other changes include: - Implement the new HDU hierarchy proposed earlier this year. This in turn reduces some of the redundant methods common to several HDU classes. - Add 3 new methods to the Header class: add_history, add_comment, and add_blank. - The table attributes _columns are now .columns and the attributes in ColDefs are now all without the underscores. So, a user can get a list of column names by: hdu.columns.names. - The "fill" argument in the new_table method now has a new meaning:
If set to true (=1), it will fill the entire new table with zeros/blanks. Otherwise (=0), just the extra rows/cells are filled with zeros/blanks. Fill values other than zero/blank are now not possible. - Add the argument output_verify to the open method and writeto method. Not in the flush or close methods yet, due to possible complication. - A new copy method for tables, the copy is totally independent from the table it copies from. - The tostring() call in writeHDUdata takes up extra space to store the string object. Use tofile() instead, to save space. - Make changes from _byteswap to _byteorder, following corresponding changes in numarray and recarray. - Insert(update) EXTEND in PrimaryHDU only when header is None. - Strip the trailing blanks for the comment value of a card. - Add seek(0) right after the __buildin__.open(0), because for the 'ab+' mode, the pointer is at the end after open in Linux, but it is at the beginning in Solaris. - Add checking of data against header, update header keywords (NAXIS's, BITPIX) when they don't agree with the data. - change version to __version__. There are also many other minor internal bug fixes and technical changes. 0.6.2 (2002-02-12) -------------------- This version requires numarray version 0.2. Things not yet supported but are part of future development: - Verification and/or correction of FITS objects being written to disk so that they are legal FITS. This is being added now and should be available in about a month. Currently, one may construct FITS headers that are inconsistent with the data and write such FITS objects to disk. Future versions will provide options to either a) correct discrepancies and warn, b) correct discrepancies silently, c) throw a Python exception, or d) write illegal FITS (for test purposes!). - Support for ascii tables or random groups format. Support for ASCII tables will be done soon (~1 month). When random group support is added is uncertain. - Support for memory mapping FITS data (to reduce memory demands). We expect to provide this capability in about 3 months. - Support for columns in binary tables having scaled values (e.g. BSCALE or BZERO) or boolean values. Currently booleans are stored as Int8 arrays and users must explicitly convert them into a boolean array. Likewise, scaled columns must be copied with scaling and offset by testing for those attributes explicitly. Future versions will produce such copies automatically. - Support for tables with TNULL values. This awaits an enhancement to numarray to support mask arrays (planned). (At least a couple of months off). .. _PyFITS: http://www.stsci.edu/resources/software_hardware/pyfits astropy-0.3/docs/io/fits/appendix/faq.rst0000644000175000017500000011211612243255342016616 0ustar oleolePyFITS FAQ ---------- .. contents:: General Questions ^^^^^^^^^^^^^^^^^ What is PyFITS? """"""""""""""" PyFITS_ is a library written in, and for use with the Python_ programming language for reading, writing, and manipulating FITS_ formatted files. It includes a high-level interface to FITS headers with the ability for high and low-level manipulation of headers, and it supports reading image and table data as Numpy_ arrays. It also supports more obscure and non-standard formats found in some FITS files. PyFITS includes two command-line utilities for working with FITS files: fitscheck, which can verify and write FITS checksums; and fitsdiff, which can analyze and display the differences between two FITS files. Although PyFITS is written mostly in Python, it includes an optional module written in C that's required to read/write compressed image data. However, the rest of PyFITS functions without this extension module. .. _PyFITS: http://www.stsci.edu/institute/software_hardware/pyfits .. _Python: http://www.python.org .. _FITS: http://fits.gsfc.nasa.gov/ .. _Numpy: http://numpy.scipy.org/ What is the development status of PyFITS? """"""""""""""""""""""""""""""""""""""""" PyFITS is written and maintained by the Science Software Branch at the `Space Telescope Science Institute`_, and is licensed by AURA_ under a `3-clause BSD license`_ (see `LICENSE.txt`_ in the PyFITS source code). PyFITS' current primary developer and active maintainer is `Erik Bray`_, though patch submissions are welcome from anyone. It has a `Trac site`_ where the source code can be browsed, and where bug reports may be submitted. The source code resides primarily in an `SVN repository`_ which allows anonymous checkouts, though a `Git mirror`_ also exists. PyFITS also has a `GitHub site`_. The current stable release series is 3.0.x. Each 3.0.x release tries to contain only bug fixes, and to not introduce any significant behavioral or API changes (though this isn't guaranteed to be perfect). The upcoming 3.1 release will contain new features and some API changes, though will try maintain as much backwards-compatibility as possible. After the 3.1 release there may be further 3.0.x releases for bug fixes only where possible. Older versions of PyFITS (2.4 and earlier) are no longer actively supported. PyFITS is also included as a major component of upcoming Astropy_ project as the :mod:`astropy.io.fits` module. The goal is for Astropy to eventually serve as a drop-in replacement for PyFITS. However, for the time being PyFITS will still be released as an independent product as well, until such time that the Astropy project proves successful and widely-adopted. .. _Space Telescope Science Institute: http://www.stsci.edu/ .. _AURA: http://www.aura-astronomy.org/ .. _3-clause BSD license: http://en.wikipedia.org/wiki/BSD_licenses#3-clause_license_.28.22New_BSD_License.22_or_.22Modified_BSD_License.22.29 .. _LICENSE.txt: https://trac.assembla.com/pyfits/browser/trunk/LICENSE.txt .. _Erik Bray: mailto:embray@stsci.edu .. _Trac site: https://trac.assembla.com/pyfits/ .. _SVN repository: https://subversion.assembla.com/svn/pyfits/ .. _Git mirror: git://github.com/spacetelescope/PyFITS.git .. _GitHub site: https://github.com/spacetelescope/PyFITS Build and Installation Questions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Is PyFITS available on Windows? """"""""""""""""""""""""""""""" Yes--the majority of PyFITS is pure Python, and can be installed and used on any platform that supports Python (>=2.5). However, PyFITS includes an optional C extension module for reading/writing compressed image HDUs. As most Windows systems are not configured to compile C source code, binary installers are also available for Windows. Though PyFITS can also be installed from source even on Windows systems without a compiler by disabling the compression module. See `How do I install PyFITS from source on Windows?`_ for more details. Where is the Windows installer for version X of PyFITS on version Y of Python? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Every official PyFITS build for Windows is eventually uploaded to PyPI_. This includes builds for every major Python release from 2.5.x and up, except for 3.0 as there is no official Numpy release for Python 3.0 on Windows. The one binary module included in these builds was linked with Numpy 1.6.1, though it should work with other recent Numpy versions. Sometimes the Windows binary installers don't go up immediately after every PyFITS release. But if they appear missing they should go up within another business day or two. This has gotten better with recent releases thanks to some automation. .. _PyPI: http://pypi.python.org/pypi/pyfits Why is the PyFITS installation failing on Windows? """""""""""""""""""""""""""""""""""""""""""""""""" The most likely cause of installation failure on Windows is if building/ installing from source fails due to the lack of a compiler for the optional C extension module. Such a failure would produce an error that looks something like:: building 'pyfits.compression' extension error: Unable to find vcvarsall.bat Your best bet in cases like this is to install from one of the binary executable installers available for Windows on PyPI. However, there are still cases where you may need to install from source: For example, it's difficult to use the binary installers with virtualenv. See `How do I install PyFITS from source on Windows?`_ for more detailed instructions on building on Windows. See below for a few answers to other specific questions about Windows installation. For other installation errors not mentioned by this FAQ, please contact help@stsci.edu with a description of the problem. On Windows Vista or later why can't the installer find Python in the registry? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" This is a common issue with Windows installers for Python packages that do not support the new User Access Control (UAC) framework added in Windows Vista and later. In particular, when a Python is installed "for all users" (as opposed to for a single user) it adds entries for that Python installation under the ``HKEY_LOCAL_MACHINE`` (HKLM) hierarchy and *not* under the ``HKEY_CURRENT_USER`` (HKCU) hierarchy. However, depending on your UAC settings, if the PyFITS installer is not executed with elevated privileges it will not be able to check in HKLM for the required information about your Python installation. In short: If you encounter this problem it's because you need the appropriate entries in the Windows registry for Python. You can download `this script`__ and execute it with the same Python as the one you want to install PyFITS into. For example to add the missing registry entries to your Python 2.7:: C:\>C:\Python27\python.exe C:\Path\To\Downloads\win_register_python.py __ https://gist.github.com/embray/6042780#file-win_register_python-py How do I install PyFITS from source on Windows? """"""""""""""""""""""""""""""""""""""""""""""" There are a few options for building/installing PyFITS from source on Windows. First of all, as mentioned elsewhere, most of PyFITS is pure-Python. Only the C extension module for reading/writing compressed images needs to be compiled. If you don't need compressed image support, PyFITS can be installed without it. In future releases this will hopefully be even easier, but for now it's necessary to edit one file in order to disable the extension module. Locate the `setup.cfg`_ file at the root of the PyFITS source code. This is the file that describes what needs to be installed for PyFITS. Find the line that reads ``[extension=pyfits.compression]``. This is the section that lists what needs to be compiled for the extension module. Comment out every line in the extension section by prepending it with a ``#`` character (stopping at the ``[build_ext]`` line). It should look like this:: ... scripts = scripts/fitscheck #[extension=pyfits.compression] #sources = # src/compress.c # src/fits_hcompress.c # src/fits_hdecompress.c # src/fitsio.c # src/pliocomp.c # src/compressionmodule.c # src/quantize.c # src/ricecomp.c # src/zlib.c # src/inffast.c # src/inftrees.c # src/trees.c #include_dirs = numpy # Squelch a handful of warnings (which actually cause pip to break in tox and # other environments due to gcc outputting non-ASCII characters in some # terminals; see python issue6135) #extra_compile_args = # -Wno-unused-function # -Wno-strict-prototypes [build_ext] ... With these lines properly commented out, rerun ``python setup.py install``, and it should skip building/installing the compression module. PyFITS will work fine with out it, but will issue warnings when encountering a compressed image that it can't read. If you do need to compile the compression module, this can still be done on Windows with just a little extra work. By default, Python tries to compile extension modules with the same compiler that Python itself was compiled with. To check what compiler Python was built with, the easiest way is to run:: python -c "import platform; print platform.python_compiler()" For the official builds of recent Python versions this should be something like:: MSC v.1500 32 bit (Intel) For unofficial Windows distributions of Python, such as ActiveState, EPD, or Cygwin, your mileage may vary. As it so happens, MSC v.15xx is the compiler version included with Visual C++ 2008. Luckily, Microsoft distributes a free version of this as `Visual C++ Express Edition`_. So for building Python extension modules on Windows this is one of the simpler routes. Just install the free VC++ 2008. It should install a link to the Start Menu at All Programs->Microsoft Visual C++ Express Edition->Visual Studio Tools->Visual Studio 2008 Command Prompt. If you run that link, it should launch a command prompt with reasonable environment variables set up for using Visual C++. Then change directories to your copy of the PyFITS source code and re-run ``python setup.py install``. You may also need to comment out the ``extra_compile_args`` option in the ``setup.cfg`` file (its value is the two lines under it after the equal sign). Though the need to manually disable this option for MSC will be fixed in a future PyFITS version. Another option is to use gcc through `MinGW`_, which is in fact how the PyFITS releases for Windows are currently built. This article provides a good overview of how to set this up: http://seewhatever.de/blog/?p=217 .. _setup.cfg: https://trac.assembla.com/pyfits/browser/trunk/setup.cfg .. _Visual C++ Express Edition: http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express .. _MinGW: http://www.mingw.org/ Is PyFITS available for Mac OSX? """""""""""""""""""""""""""""""" Yes, but there is no binary package specifically for OSX (such as a .dmg, for example). For OSX just download, build, and install the source package. This is generally easier on OSX than it is on Windows, thanks to the more developer-friendly environment. The only major problem with building on OSX seems to occur for some users of 10.7 Lion, with misconfigured systems. See the next question for details on that. To build PyFITS without the optional compression module, follow the instructions in `How do I install PyFITS from source on Windows?`_. Why is the PyFITS installation failing on OSX Lion (10.7)? """""""""""""""""""""""""""""""""""""""""""""""""""""""""" There is a common problem that affects all Python packages with C extension modules (not just PyFITS) for some users of OSX 10.7. What usually occurs is that when building the package several errors will be output, ending with something like:: unable to execute gcc-4.2: No such file or directory error: command 'gcc-4.2' failed with exit status 1 There are a few other errors like it that can occur. The problem is that when you build a C extension, by default it will try to use the same compiler that your Python was built with. In this case, since you're using the 32-bit universal build of Python it's trying to use the older gcc-4.2 and is trying to build with PPC support, which is no longer supported in Xcode. In this case the best solution is to install the x86-64 build of Python for OSX (http://www.python.org/ftp/python/2.7.2/python-2.7.2-macosx10.6.dmg for 2.7.2). In fact, this is the build version officially supported for use on Lion. Other, unofficial Python builds such as from `MacPorts`_ may also work. .. _MacPorts: http://astrofrog.github.com/macports-python/ How do I find out what version of PyFITS I have installed? """""""""""""""""""""""""""""""""""""""""""""""""""""""""" To output the PyFITS version from the command line, run:: $ python -c 'import pyfits; print(pyfits.__version__)' When PyFITS is installed with stsci_python, it is also possible to check the installed SVN revision by importing ``pyfits.svn_version``. Then use ``dir(pyfits.svn_version)`` to view a list of available attributes. A feature like this will be available soon in standalone versions of PyFITS as well. How do I run the tests for PyFITS? """""""""""""""""""""""""""""""""" Currently the best way to run the PyFITS tests is to download the source code, either from a source release or from version control, and to run the tests out of the source. It is not necessary to install PyFITS to run the tests out of the source code. The PyFITS tests require `nose`_ to run. nose can be installed on any Python version using pip or easy_install. See the nose documentation for more details. With nose installed, it is simple to run the tests on Python 2.x:: $ python setup.py nosetests If PyFITS has not already been built, this will build it automatically, then run the tests. This does not cause PyFITS to be installed. On Python 3.x the situation is a little more complicated. This is due to the fact that PyFITS' source code is not Python 3-compatible out of the box, but has to be run through the 2to3 converter. Normally when you build/install PyFITS on Python 3.x, the 2to3 conversion is performed automatically. Unfortunately, nose does not know to use the 2to3'd source code, and will instead try to import and test the unconverted source code. To work around this, it is necessary to first build PyFITS (which will run the source through 2to3):: $ python setup.py build Then run the ``nosetests`` command, but pointing it to the ``build`` tree where the 2to3'd source code and tests reside, using the ``-w`` switch:: $ python setup.py nosetests -w build/lib.linux-x86_64-3.2 where the exact path of the ``build/lib.*`` directory will vary depending on your platform and Python version. .. _nose: http://readthedocs.org/docs/nose/en/latest/ How can I build a copy of the PyFITS documentation for my own use? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" First of all, it's worth pointing out that the documentation for the latest version of PyFITS can always be downloaded in `PDF form `_ or browsed online in `HTML `_. There are also plans to make the docs for older versions of PyFITS, as well as up-to-date development docs available online. Otherwise, to build your own version of the docs either for offline use, or to build the development version of the docs there are a few requirements. The most import requirement is `Sphinx`_, which is the toolkit used to generate the documentation. Use ``pip install sphinx`` or ``easy_install sphinx`` to install Sphinx. Using pip or easy_install will install the correct versions of Sphinx's basic dependencies, which include docutils, Jinja2, and Pygments. Next, the docs require STScI's custom Sphinx theme, `stsci.sphinxext`_. It's a simple pure-Python package and can be installed with pip or easy_install. The next requirement is `numpydoc`_, which is not normally installed with Numpy itself. Install it with pip or easy_install. Numpy is also required, though it is of course a requirement of PyFITS itself. Finally, it is necessary to have `matplotlib`_, specifically for matplotlib.sphinxext. This is perhaps the most onerous requirement if you do not already have it installed. Please refer to the matplotlib documentation for details on downloading and installing matplotlib. It is also necessary to install PyFITS itself in order to generate the API documentation. For this reason, it is a good idea to install Sphinx and PyFITS into a `virtualenv`_ in order to build the development version of the docs (see below). With all the requirements installed, change directories into the `docs/` directory in the PyFITS source code, and run:: $ make html to build the HTML docs, which will be output to `build/html`. To build the docs in other formats, please refer to the Sphinx documentation. To summarize, assuming that you already have Numpy and Matplotlib on your Python installation, perform the following steps from within the PyFITS source code:: $ virtualenv --system-site-packages pyfits-docs $ source pyfits-docs/bin/activate $ pip install sphinx $ pip install numpydoc $ pip install stsci.sphinxext $ python setup.py install pyfits $ cd docs/ $ make html .. _Sphinx: http://sphinx.pocoo.org/ .. _stsci.sphinxext: http://pypi.python.org/pypi/stsci.sphinxext .. _numpydoc: http://pypi.python.org/pypi/numpydoc .. _matplotlib: http://matplotlib.sourceforge.net/ .. _virtualenv: http://pypi.python.org/pypi/virtualenv Usage Questions ^^^^^^^^^^^^^^^ Something didn't work as I expected. Did I do something wrong? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Possibly. But if you followed the documentation and things still did not work as expected, it is entirely possible that there is a mistake in the documentation, a bug in the code, or both. So feel free to report it as a bug. There are also many, many corner cases in FITS files, with new ones discovered almost every week. PyFITS is always improving, but does not support all cases perfectly. There are some features of the FITS format (scaled data, for example) that are difficult to support correctly and can sometimes cause unexpected behavior. For the most common cases, however, such as reading and updating FITS headers, images, and tables, PyFITS should be very stable and well-tested. Before every PyFITS release it is ensured that all its tests pass on a variety of platforms, and those tests cover the majority of use-cases (until new corner cases are discovered). PyFITS crashed and output a long string of code. What do I do? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" This listing of code is what is knows as a `stack trace`_ (or in Python parlance a "traceback"). When an unhandled exception occurs in the code, causing the program to end, this is a way of displaying where the exception occurred and the path through the code that led to it. As PyFITS is meant to be used as a piece in other software projects, some exceptions raised by PyFITS are by design. For example, one of the most common exceptions is a `KeyError` when an attempt is made to read the value of a non-existent keyword in a header:: >>> import pyfits >>> h = pyfits.Header() >>> h['NAXIS'] Traceback (most recent call last): File "", line 1, in File "/path/to/pyfits/header.py", line 125, in __getitem__ return self._cards[self._cardindex(key)].value File "/path/to/pyfits/header.py", line 1535, in _cardindex raise KeyError("Keyword %r not found." % keyword) KeyError: "Keyword 'NAXIS' not found." This indicates that something was looking for a keyword called "NAXIS" that does not exist. If an error like this occurs in some other software that uses PyFITS, it may indicate a bug in that software, in that it expected to find a keyword that didn't exist in a file. Most "expected" exceptions will output a message at the end of the traceback giving some idea of why the exception occurred and what to do about it. The more vague and mysterious the error message in an exception appears, the more likely that it was caused by a bug in PyFITS. So if you're getting an exception and you really don't know why or what to do about it, feel free to report it as a bug. .. _stack trace: http://en.wikipedia.org/wiki/Stack_trace Why does opening a file work in CFITSIO, ds9, etc. but not in PyFITS? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" As mentioned elsewhere in this FAQ, there are many unusual corner cases when dealing with FITS files. It's possible that a file should work, but isn't support due to a bug. Sometimes it's even possible for a file to work in an older version of PyFITS, but not a newer version due to a regression that isn't tested for yet. Another problem with the FITS format is that, as old as it is, there are many conventions that appear in files from certain sources that do not meet the FITS standard. And yet they are so common-place that it is necessary to support them in any FITS readers. CONTINUE cards are one such example. There are non-standard conventions supported by PyFITS that are not supported by CFITSIO and vice-versa. You may have hit one of those cases. If PyFITS is having trouble opening a file, a good way to rule out whether not the problem is with PyFITS is to run the file through the `fitsverify`_. For smaller files you can even use the `online FITS verifier`_. These use CFITSIO under the hood, and should give a good indication of whether or not there is something erroneous about the file. If the file is malformatted, fitsverify will output errors and warnings. If fitsverify confirms no problems with a file, and PyFITS is still having trouble opening it (especially if it produces a traceback) then it's likely there is a bug in PyFITS. .. _fitsverify: http://heasarc.gsfc.nasa.gov/docs/software/ftools/fitsverify/ .. _online FITS verifier: http://fits.gsfc.nasa.gov/fits_verify.html How do I turn off the warning messages PyFITS keeps outputting to my console? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" PyFITS uses Python's built-in `warnings`_ subsystem for informing about exceptional conditions in the code that are recoverable, but that the user may want to be informed of. One of the most common warnings in PyFITS occurs when updating a header value in such a way that the comment must be truncated to preserve space:: Card is too long, comment is truncated. Any console output generated by PyFITS can be assumed to be from the warnings subsystem. Fortunately there are two easy ways to quiet these warnings: 1. Using the `-W option`_ to the ``python`` executable. Just start Python like:: $ python -Wignore or for short:: $ python -Wi and all warning output will be silenced. 2. Warnings can be silenced programatically from anywhere within a script. For example, to disable all warnings in a script, add something like:: import warnings warnings.filterwarnings('ignore') Another option, instead of ``ignore`` is ``once``, which causes any warning to be output only once within the session, rather than repeatedly (such as in a loop). There are many more ways to filter warnings with ``-W`` and the warnings module. For example, it is possible to silence only specific warning messages. Please refer to the Python documentation for more details, or ask at help@stsci.edu. .. _warnings: http://docs.python.org/library/warnings.html .. _-W option: http://docs.python.org/using/cmdline.html#cmdoption-W How can I check if my code is using deprecated PyFITS features? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" PyFITS 3.0 included a major reworking of the code and some of the APIs. Most of the differences are just renaming functions to use a more consistent naming scheme. For example the ``createCard()`` function was renamed to ``create_card()`` for consistency with a ``lower_case_underscore`` naming scheme for functions. There are a few other functions and attributes that were deprecated either because they were renamed to something simpler or more consistent, or because they were redundant or replaced. Eventually all deprecated features will be removed in future PyFITS versions (though there will be significant warnings in advance). It is best to check whether your code is using deprecated features sooner rather than later. On Python 2.5, all deprecation warnings are displayed by default, so you may have already discovered them. However, on Python 2.6 and up, deprecation warnings are *not* displayed by default. To show all deprecation warnings, start Python like:: $ python -Wd Most deprecation issues can be fixed with a simple find/replace. The warnings displayed will let you know how to replace the old interface. If you have a lot of old code that was written for older versions of PyFITS it would be worth doing this. PyFITS 3.1 introduces a significant rewrite of the Header interface, and contains even more deprecations. What convention does PyFITS use for indexing, such as of image coordinates? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" All arrays and sequences in PyFITS use a zero-based indexing scheme. For example, the first keyword in a header is ``header[0]``, not ``header[1]``. This is in accordance with Python itself, as well as C, on which PyFITS is based. This may come as a surprise to veteran FITS users coming from IRAF, where 1-based indexing is typically used, due to its origins in FORTRAN. Likewise, the top-left pixel in an N x N array is ``data[0,0]``. The indices for 2-dimensional arrays are row-major order, in that the first index is the row number, and the second index is the column number. Or put in terms of axes, the first axis is the y-axis, and the second axis is the x-axis. This is the opposite of column-major order, which is used by FORTRAN and hence FITS. For example, the second index refers to the axis specified by NAXIS1 in the FITS header. In general, for N-dimensional arrays, row-major orders means that the right-most axis is the one that varies the fastest while moving over the array data linearly. For example, the 3-dimensional array:: [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] is represented linearly in row-major order as:: [1, 2, 3, 4, 5, 6, 7, 8] Since 2 immediately follows 1, you can see that the right-most (or inner-most) axis is the one that varies the fastest. The discrepancy in axis-ordering may take some getting used to, but it is a necessary evil. Since most other Python and C software assumes row-major ordering, trying to enforce column-major ordering in arrays returned by PyFITS is likely to cause more difficulties than it's worth. How do I open a very large image that won't fit in memory? """""""""""""""""""""""""""""""""""""""""""""""""""""""""" Prior to PyFITS 3.1, when the data portion of an HDU is accessed, the data is read into memory in its entirety. For example:: >>> hdul = pyfits.open('myimage.fits') >>> hdul[0].data ... reads the entire image array from disk into memory. For very large images or tables this is clearly undesirable, if not impossible given the available resources. However, ``pyfits.open()`` has an option to access the data portion of an HDU by memory mapping using `mmap`_. What this means is that accessing the data as in the example above only reads portions of the data into memory on demand. For example, if I request just a slice of the image, such as ``hdul[0].data[100:200]``, then just rows 100-200 will be read into memory. This happens transparently, as though the entire image were already in memory. This works the same way for tables. For most cases this is your best bet for working with large files. To use memory mapping, just add the ``memmap=True`` argument to ``pyfits.open()``. In PyFITS 3.1, the mmap support is improved enough that ``memmap=True`` is the default for all ``pyfits.open()`` calls. The default can also be controlled through an environment variable called ``PYFITS_USE_MEMMAP``. Setting this to ``0`` will disable mmap by default. Unfortunately, memory mapping does not currently work as well with scaled image data, where BSCALE and BZERO factors need to be applied to the data to yield physical values. Currently this requires enough memory to hold the entire array, though this is an area that will see improvement in the future. An alternative, which currently only works for image data (that is, non-tables) is the sections interface. It is largely replaced by the better support for memmap, but may still be useful on systems with more limited virtual-memory space, such as on 32-bit systems. Support for scaled image data is flakey with sections too, though that will be fixed. See `the PyFITS documentation `_ for more details on working with sections. .. _mmap: http://en.wikipedia.org/wiki/Mmap How can I create a very large FITS file from scratch? """"""""""""""""""""""""""""""""""""""""""""""""""""" This is a very common issue, but unfortunately PyFITS does not come with any built-in facilities for creating large files (larger than will fit in memory) from scratch (though it may in the future). Normally to create a single image FITS file one would do something like:: >> data = numpy.zeros((40000, 40000), dtype=numpy.float64) >> hdu = pyfits.PrimaryHDU(data=data) >> hdu.writeto('large.fits') However, a 40000 x 40000 array of doubles is nearly twelve gigabytes! Most systems won't be able to create that in memory just to write out to disk. In order to create such a large file efficiently requires a little extra work, and a few assumptions. First, it is helpful to anticipate about how large (as in, how many keywords) the header will have in it. FITS headers must be written in 2880 byte blocks--large enough for 36 keywords per block (including the END keyword in the final block). Typical headers have somewhere between 1 and 4 blocks, though sometimes more. Since the first thing we write to a FITS file is the header, we want to write enough header blocks so that there is plenty of padding in which to add new keywords without having to resize the whole file. Say you want the header to use 4 blocks by default. Then, excluding the END card which PyFITS will add automatically, create the header and pad it out to 36 * 4 cards like so:: >>> data = numpy.zeros((100, 100), dtype=numpy.float64) # This is a stub array that we'll be using the initialize the HDU; its # exact size is irrelevant, as long as it has the desired number of # dimensions >>> hdu = pyfits.PrimaryHDU(data=data) >>> header = hdu.header >>> while len(header) < (36 * 4 - 1): ... header.append() # Adds a blank card to the end Now adjust the NAXISn keywords to the desired size of the array, and write *only* the header out to a file. Using the ``hdu.writeto()`` method will cause PyFITS to "helpfully" reset the NAXISn keywords to match the size of the dummy array:: >>> header['NAXIS1'] = 40000 >>> header['NAXIS2'] = 40000 >>> header.tofile('large.fits') Finally, we need to grow out the end of the file to match the length of the data (plus the length of the header). This can be done very efficiently on most systems by seeking past the end of the file and writing a single byte, like so:: >>> with open('large.fits', 'rb+') as fobj: ... fobj.seek(len(header.tostring()) + (40000 * 40000 * 8) - 1) ... # The -1 is to account for the final byte that we are about to ... # write ... fobj.write('\0') On modern operating systems this will cause the file (past the header) to be filled with zeros out to the ~12GB needed to hold a 40000 x 40000 image. On filesystems that support sparse file creation (most Linux filesystems, but not HFS+) this is a very fast, efficient operation. On other systems your mileage may vary. This isn't the only way to build up a large file, but probably one of the safest. This method can also be used to create large multi-extension FITS files, with a little care. For creating very large tables, this method may also be used. Though it can be difficult to determine ahead of time how many rows a table will need. In general, use of PyFITS is discouraged for the creation and manipulation of large tables. The FITS format itself is not designed for efficient on-disk or in-memory manipulation of table structures. For large, heavy-duty table data it might be better too look into using `HDF5`_ through the `PyTables`_ library. PyTables makes use of Numpy under the hood, and can be used to write binary table data to disk in the same format required by FITS. It is then possible to serialize your table to the FITS format for distribution. At some point this FAQ might provide an example of how to do this. .. _HDF5: http://www.hdfgroup.org/HDF5/ .. _PyTables: http://www.pytables.org/moin How do I create a multi-extension FITS file from scratch? """"""""""""""""""""""""""""""""""""""""""""""""""""""""" When you open a FITS file with ``pyfits.open()``, a ``pyfits.HDUList`` object is returned, which holds all the HDUs in the file. This ``HDUList`` class is a subclass of Python's builtin ``list``, and can be created from scratch and used as such:: >>> new_hdul = pyfits.HDUList() >>> new_hdul.append(pyfits.ImageHDU()) >>> new_hdul.append(pyfits.ImageHDU()) >>> new_hdul.writeto('test.fits') That will create a new multi-extension FITS file with two empty IMAGE extensions (a default PRIMARY HDU is prepended automatically if one was not provided manually). Why is an image containing integer data being converted unexpectedly to floats? """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" If the header for your image contains non-trivial values for the optional BSCALE and/or BZERO keywords (that is, BSCALE != 1 and/or BZERO != 0), then the raw data in the file must be rescaled to its physical values according to the formula:: physical_value = BZERO + BSCALE * array_value As BZERO and BSCALE are floating point values, the resulting value must be a float as well. If the original values were 16-bit integers, the resulting values are single-precision (32-bit) floats. If the original values were 32-bit integers the resulting values are double-precision (64-bit floats). This automatic scaling can easily catch you of guard if you're not expecting it, because it doesn't happen until the data portion of the HDU is accessed (to allow things like updating the header without rescaling the data). For example:: >>> hdul = pyfits.open('scaled.fits') >>> image = hdul['SCI', 1] >>> image.header['BITPIX'] 32 >>> image.header['BSCALE'] 2.0 >>> data = image.data # Read the data into memory >>> data.dtype dtype('float64') # Got float64 despite BITPIX = 32 (32-bit int) >>> image.header['BITPIX'] # The BITPIX will automatically update too -64 >>> 'BSCALE' in image.header # And the BSCALE keyword removed False The reason for this is that once a user accesses the data they may also manipulate it and perform calculations on it. If the data were forced to remain as integers, a great deal of precision is lost. So it is best to err on the side of not losing data, at the cost of causing some confusion at first. If the data must be returned to integers before saving, use the ``scale()`` method:: >>> image.scale('int32') >>> image.header['BITPIX'] 32 To prevent rescaling from occurring at all (good for updating headers--even if you don't intend for the code to access the data, it's good to err on the side of caution here), use the ``do_not_scale_image_data`` argument when opening the file:: >>> hdul = pyfits.open('scaled.fits', do_not_scale_image_data=True) >>> image = hdul['SCI', 1] >>> image.data.dtype dtype('int32') Why am I losing precision when I assign floating point values in the header? """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" The FITS standard allows two formats for storing floating-point numbers in a header value. The "fixed" format requires the ASCII representation of the number to be in bytes 11 through 30 of the header card, and to be right-justified. This leaves a standard number of characters for any comment string. The fixed format is not wide enough to represent the full range of values that can be stored in a 64-bit float with full precision. So FITS also supports a "free" format in which the ASCII representation can be stored anywhere, using the full 70 bytes of the card (after the keyword). Currently PyFITS only supports writing fixed format (it can read both formats), so all floating point values assigned to a header are stored in the fixed format. There are plans to add support for more flexible formatting. In the meantime it is possible to add or update cards by manually formatting the card image:: >>> c = pyfits.Card.fromstring('FOO = 1234567890.123456789') >>> h = pyfits.Header() >>> h.append(c) >>> h FOO = 1234567890.123456789 As long as you don't assign new values to 'FOO' via ``h['FOO'] = 123``, PyFITS will maintain the header value exactly as you formatted it. astropy-0.3/docs/io/fits/api/0000755000175000017500000000000012243263747014264 5ustar oleoleastropy-0.3/docs/io/fits/api/verification.rst0000644000175000017500000000544212243255342017475 0ustar oleole.. currentmodule:: astropy.io.fits .. _verify: Verification options -------------------- There are 5 options for the ``output_verify`` argument of the following methods of :class:`HDUList`: :meth:`~HDUList.close`, :meth:`~HDUList.writeto`, and :meth:`~HDUList.flush`, or the :meth:`~_BaseHDU.writeto` method on any HDU object. In these cases, the verification option is passed to a :meth:`verify` call within these methods. exception ^^^^^^^^^ This option will raise an exception if any FITS standard is violated. This is the default option for output (i.e. when :meth:`~HDUList.writeto`, :meth:`~HDUList.close`, or :meth:`~HDUList.flush` is called. If a user wants to overwrite this default on output, the other options listed below can be used. ignore ^^^^^^ This option will ignore any FITS standard violation. On output, it will write the HDU List content to the output FITS file, whether or not it is conforming to FITS standard. The ``ignore`` option is useful in these situations, for example: 1. An input FITS file with non-standard is read and the user wants to copy or write out after some modification to an output file. The non-standard will be preserved in such output file. 2. A user wants to create a non-standard FITS file on purpose, possibly for testing purpose. No warning message will be printed out. This is like a silent warn (see below) option. fix ^^^ This option will try to fix any FITS standard violations. It is not always possible to fix such violations. In general, there are two kinds of FITS standard violation: fixable and not fixable. For example, if a keyword has a floating number with an exponential notation in lower case 'e' (e.g. 1.23e11) instead of the upper case 'E' as required by the FITS standard, it's a fixable violation. On the other hand, a keyword name like ``P.I.`` is not fixable, since it will not know what to use to replace the disallowed periods. If a violation is fixable, this option will print out a message noting it is fixed. If it is not fixable, it will throw an exception. The principle behind the fixing is do no harm. For example, it is plausible to 'fix' a :class:`Card` with a keyword name like ``P.I.`` by deleting it, but Astropy will not take such action to hurt the integrity of the data. Not all fixes may be the "correct" fix, but at least Astropy will try to make the fix in such a way that it will not throw off other FITS readers. silentfix ^^^^^^^^^ Same as fix, but will not print out informative messages. This may be useful in a large script where the user does not want excessive harmless messages. If the violation is not fixable, it will still throw an exception. warn ^^^^ This option is the same as the ignore option but will send warning messages. It will not try to fix any FITS standard violations whether fixable or not. astropy-0.3/docs/io/fits/api/hdulists.rst0000644000175000017500000000031312243255342016642 0ustar oleole.. currentmodule:: astropy.io.fits HDU Lists --------- .. inheritance-diagram:: HDUList :class:`HDUList` ^^^^^^^^^^^^^^^^ .. autoclass:: HDUList :members: :undoc-members: :show-inheritance: astropy-0.3/docs/io/fits/api/tables.rst0000644000175000017500000000174012243255342016262 0ustar oleole.. currentmodule:: astropy.io.fits .. _tables: Tables ------ :class:`BinTableHDU` ^^^^^^^^^^^^^^^^^^^^ .. autoclass:: BinTableHDU :members: :inherited-members: :show-inheritance: :class:`TableHDU` ^^^^^^^^^^^^^^^^^ .. autoclass:: TableHDU :members: :inherited-members: :show-inheritance: :class:`Column` ^^^^^^^^^^^^^^^ .. autoclass:: Column :members: :inherited-members: :show-inheritance: :class:`ColDefs` ^^^^^^^^^^^^^^^^ .. autoclass:: ColDefs :members: :inherited-members: :show-inheritance: :class:`FITS_rec` ^^^^^^^^^^^^^^^^^ .. autoclass:: FITS_rec :members: :show-inheritance: :class:`FITS_record` ^^^^^^^^^^^^^^^^^^^^ .. autoclass:: FITS_record :members: :inherited-members: :show-inheritance: Table Functions ^^^^^^^^^^^^^^^ :func:`new_table` """"""""""""""""" .. autofunction:: new_table :func:`tabledump` """"""""""""""""" .. autofunction:: tabledump :func:`tableload` """"""""""""""""" .. autofunction:: tableload astropy-0.3/docs/io/fits/api/hdus.rst0000644000175000017500000000151712243255342015755 0ustar oleole.. currentmodule:: astropy.io.fits Header Data Units ----------------- The :class:`ImageHDU` and :class:`CompImageHDU` classes are discussed in the section on :ref:`Images`. The :class:`TableHDU` and :class:`BinTableHDU` classes are discussed in the section on :ref:`Tables`. :class:`PrimaryHDU` ^^^^^^^^^^^^^^^^^^^ .. autoclass:: PrimaryHDU :members: :inherited-members: :show-inheritance: :class:`GroupsHDU` ^^^^^^^^^^^^^^^^^^ .. autoclass:: GroupsHDU :members: :inherited-members: :show-inheritance: :class:`GroupData` ^^^^^^^^^^^^^^^^^^ .. autoclass:: GroupData :members: :show-inheritance: :class:`Group` ^^^^^^^^^^^^^^ .. autoclass:: GroupData :members: :show-inheritance: :class:`StreamingHDU` ^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: StreamingHDU :members: :inherited-members: :show-inheritance: astropy-0.3/docs/io/fits/api/images.rst0000644000175000017500000000043712243255342016257 0ustar oleole.. currentmodule:: astropy.io.fits .. _images: Images ------ `ImageHDU` ^^^^^^^^^^ .. autoclass:: ImageHDU :members: :inherited-members: :show-inheritance: `CompImageHDU` ^^^^^^^^^^^^^^ .. autoclass:: CompImageHDU :members: :inherited-members: :show-inheritance: astropy-0.3/docs/io/fits/api/cards.rst0000644000175000017500000000106712243255342016106 0ustar oleole.. currentmodule:: astropy.io.fits Cards ----- :class:`Card` ^^^^^^^^^^^^^ .. autoclass:: Card :members: :inherited-members: :undoc-members: :show-inheritance: Deprecated Interfaces ^^^^^^^^^^^^^^^^^^^^^ The following classes and functions are deprecated as of the PyFITS 3.1 header refactoring, though they are currently still available for backwards-compatibility. .. autoclass:: CardList :members: :undoc-members: :show-inheritance: .. autofunction:: create_card .. autofunction:: create_card_from_string .. autofunction:: upper_key astropy-0.3/docs/io/fits/api/headers.rst0000644000175000017500000000027112243255342016421 0ustar oleole.. currentmodule:: astropy.io.fits Headers ------- :class:`Header` ^^^^^^^^^^^^^^^ .. autoclass:: Header :members: :inherited-members: :undoc-members: :show-inheritance: astropy-0.3/docs/io/fits/api/files.rst0000644000175000017500000000124712243255342016114 0ustar oleole.. currentmodule:: astropy.io.fits File Handling and Convenience Functions --------------------------------------- :func:`open` ^^^^^^^^^^^^ .. autofunction:: open :func:`writeto` ^^^^^^^^^^^^^^^ .. autofunction:: writeto :func:`info` ^^^^^^^^^^^^ .. autofunction:: info :func:`append` ^^^^^^^^^^^^^^ .. autofunction:: append :func:`update` ^^^^^^^^^^^^^^ .. autofunction:: update :func:`getdata` ^^^^^^^^^^^^^^^ .. autofunction:: getdata :func:`getheader` ^^^^^^^^^^^^^^^^^ .. autofunction:: getheader :func:`getval` ^^^^^^^^^^^^^^ .. autofunction:: getval :func:`setval` ^^^^^^^^^^^^^^ .. autofunction:: setval :func:`delval` ^^^^^^^^^^^^^^ .. autofunction:: delval astropy-0.3/docs/io/fits/api/diff.rst0000644000175000017500000000151512243255342015720 0ustar oleoleDiffers ------- .. automodule:: astropy.io.fits.diff .. currentmodule:: astropy.io.fits :class:`FITSDiff` ^^^^^^^^^^^^^^^^^ .. autoclass:: FITSDiff :members: :inherited-members: :show-inheritance: :class:`HDUDiff` ^^^^^^^^^^^^^^^^ .. autoclass:: HDUDiff :members: :inherited-members: :show-inheritance: :class:`HeaderDiff` ^^^^^^^^^^^^^^^^^^^ .. autoclass:: HeaderDiff :members: :inherited-members: :show-inheritance: :class:`ImageDataDiff` ^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: ImageDataDiff :members: :inherited-members: :show-inheritance: :class:`RawDataDiff` ^^^^^^^^^^^^^^^^^^^^ .. autoclass:: RawDataDiff :members: :inherited-members: :show-inheritance: :class:`TableDataDiff` ^^^^^^^^^^^^^^^^^^^^^^ .. autoclass:: TableDataDiff :members: :inherited-members: :show-inheritance: astropy-0.3/docs/io/fits/images/0000755000175000017500000000000012243263747014760 5ustar oleoleastropy-0.3/docs/io/fits/images/Red.jpg0000644000175000017500000010347712243255342016200 0ustar oleoleÿØÿàJFIFHHÿáExifMM*ÿÛCÿÀ è"ÿÄ ÿÄT!1A"Qaq#$2‘ð3BR¡±ÁÑ4Cbr‚á %DS’ñcs¢²ÂÒ5Ttƒâ&“Ud£„ÿÚ?ø<ªœ>”ÑQ5ª®µ7Ûhîªó_àyøÉ×>ÿdµS£O«¶vÿÓëeÙcy壻5w ·áùõÑ­¦­½®Îß´{‡³»Hþ´ìÔ3›ø|vvN„ìz5gÄû7–ûn}šuS~¬ ²ýŸçíÒòÑ]R§RñÔaØ£­|yŒàÊ`:Èž5Â`Ø&иò«'ø“Ç•b€² Þž‚yÜKÜÒµ#fI&ÆÓ'‘ÈÚ æÌÆ,ݸ"Ïh’fy›˲;ôseÛZk«êvZ'ísÈ_ö´sèõã?Œ¹øröèš’ª­Ž¾Á£²žëóçíÑکΓö{ôqôE^¿e9Ÿó}Ùèg«±´ŸúGÀû£F›§ÚŸÓê_º›þWç¡R²”瑱]Š<Ýuþ|ý×ÑQëÅÞÿvWO£}z7âüòñ›hÓ:T¨ “¡Zö) WþèÇo`Цèšk²`P"æóœÉ“;ý‰QOÖ4)'bÝcöE#ÂÒ hõ"­»Wû|½—ð÷hï Ÿ&¯ žÈ¿8œ¹Àè(iLWccÃ9ðøû×MUqfÙõ{ïTÅ­ŸgÑú#IZê®—²‚S®£ÔÎU¿(¾BݳÚfi¢.”Ø5ÎÝýi$çŸÒ(Ù´çiчIßb®ÁŽñ)T{ rÎâ’ Ý©‰lMU˜#2>À wŽdbáJ¡Ä–v3qÙË3Ìöˆñ§I¢^¶&$ìl%Ïv‰¤‰å¶×q<ôí¢4Òã­;}o¸“ñhå}$1mYtÝ\R²*P±*ôr´w‹A`4ª8kJ•Œ§ NDfAn/¹äUR”ÑÂlŠÆë13œç<§”_Aë§gokø;»ç·àf4EtI §ì‘oÃòå£K¯9|eËß·FmUÓµT‰ˆZ«Ù"tÅê1îþ~ìôqO¯¶rú¾Ï­Ÿ.Ï¿Ný+öáÑLvªœïñwövôe¾|¶7>ÙŸ‰Ñ¯£ÔŒþ3çãËÙ¡{Þ"¯V±Ö'ÖÊÆl&v¦d‚-àÏjë×±öþSà-–‰Mê«gooÙooooó±6ª]Òî Ç>Âgß·öÏm'@뢶õ€"‹Éì‹Ï( “™rér\ ÀwH{˜ˆåÎÇ"NfÓ˜ñÛ§(ÈøþALúãÔìµwèv‚q[5z–}¯·Õ÷ôÓŽ©ÚØúoÃÙ”xf4.šk«¯ÿÇÛíË,ù}ú7´âkÙ>¿›¯Ôîø˜åá}.Yù¾ÜïŸ/n “ª`M«0k=k®"(°±±æ ÔSÖëîþkçGáO¼üR_Õêvý/ÙÑÔ'¯×Gý®ý¥*©ë^ÝÓÿPÇiÐê÷œ8ªªö­]ÞÂjüê©f¾ygîÎó ÉÒžÅo6‰­½­ÝE9öÝ;ªªöIùÞ¥­{G©oŒù”&škÙŒ¶9ïÙœËDÐ*ÚSg»bö°=ý¿4m:vjõyÆÇoÇÙ¡¬Ó¡:kMJ+¯m/Ö~©QúïV|#ùèeTìo*¿’¯òü¶cîúÑ¡)×V×Z¾¿(¤}ñßÞ9Ω³U5 ŽÇš4Ôc,‰ýáqapbúJnÍ<‡ç=ÈžWÊs¶¹ £@eXKÑ”Ÿ÷Ñì&/rbI:J#IQ§M=þÍ“W!œZ;o7#E/…¨ô×K¼¨ˆV3æ"l;L ž±Ã’ØR€+ØHšO8<£–Q”ä Ë@Òá¨P$S¼å*ˆæD˜cË­}#ÜÒÕã݈bÂ&›s°Î3‹U6"Æ;Y˜3§83ÔÕAd|ÚÍÔB„Ú"/Ò#dÓéÔ©U[|ûý_xî;W‘ÜÊ›;Ÿ7×9]ÒVPöò;=š%A´Å¼ÖÅ*¥¦—UUj‹ø{{²Ñª“Úª‰úC,½‘ߦÚ[jrÛ˜ýœ½ ¢(§…5šüäÄEãg¶vb$z¼Ç°ò¦ÇÖØ¯ì¿W—áNøj¸™îì>9zÜþÈ磮qTXu²'ñ™¿v„µÅñf8.1€³}¹Áõ…\-\a–áš¼R¸2®¼úÈq-xW.ŸCîÛH*z±§>ý«jÁŠëE¨ ÜrϘ‰ì¿k^¶ßÁV-Ùøåö/g«·ót}ß}ýÆü´[ršjQ[•»»¦{…í¤þ±â‰âU6àÙðÍ›5I¶ïÌï•V<úùú±†?gH«Ò9×'Ù|ˆæ+lÜa˜ @ öX ÿªÕ«Ô§÷£¿#£Íé‹}xçû=º4¾Í[ý3µïêŽÎÞsvŠØžD >ú­àDâ9iÄxWp ÄÅÀä9[˜ sïÓž›PæýÛýÿ††Ôƒz[l_l ØNS6«¿>[1} 6¦­ž¬ácؾ_ÜkM#»¯ÿolƈ_èý:%Tviµ&-·9ƒ¦c>\Çl(Õ¶ß<ÿ)‘àyZú7WÕíu'´SúM’ ÝùÇvÐ<³SVÅÃÿU§ìœ¹wèu)íW_n”{;{yh½ÞÍTuãÝñ´wÉç¡ûŠ*o¼¥dk¬~§ß|Çà|4a¢®eN¦ÈˆÓ$Øûs‚s‚ ŸÛ;\'­_põ¢â~Üû§–‹M ­º¶-úËÏÝü¯§lÕMUÕUtniš/ŸZßË·GéZªj¬7ÔõúÕßíÏãÆUÓ¥djY²µ£G¯B~im×ûò ½Ùå£T'UuaTöR#Ø9¤žZN1n¥UQOïG>UOæ{=º!«5wE?ç·ìHç'˜”é5N«4調Pª6#õ³”r÷‘2g#¥Å !WMï×X$hl|ÀJDÝyI½àÛ·d*¯ðòƒ¼Y$4y/{Õ'tFêÄ ÌöxÅZ¤k†TòÙݘ¹çrg²DÜrÐ –ÎW\+ ú<ïíZç3y°í 4ìÕVÍuœv‚(Ý­5Q×Ýâ7ÖÎ2îí÷éÒI¶¨W³Aù ͽXå9ƒã˜Ñ§TokÙ¦´ª®„¶·‰ª‚ÒUF>~ÄÎÔÌØÛKv©kkH«XªÄuKTµºeÔ×Z¨)ÅÑY_êÊ®‘óÖÇpá·ÿ•¶hO1A:PÓcÔž¿ë-˜«Â{û{´eF©Šº›{cÃþÞV÷“ÏNª¥Ïû?ܸöø_œŸ~œ§fž­C¾ßø-YdEÌ’OìI?ö‹rµ­¢xeêe³LúÑ_†[2ÄÆf=¶Ó¡J Óµ_¯¡Ûíý¾ÈÐg[{_Oalÿ‹ß—Ç%¶ªšiVš¨ú¿n×ú_-9ScµŠ<2Ÿ²2ütvÿP{Çå žcoø¿o·A¯ëwçßž“a¥4[-Å!_½Srš£Škº[s¸_« gûœ}ºEú¿o_¿¶3ìÎ/¡®Ð¥µ4)ŠÄmÞà›ˆ#™Ï«lÆŒl9íð~ZXYœ-æ½KãE5Ó n¨¡-éU\æ;L‚3I¼ ï&Ÿâü;o¢‘j¥ ·ZÞÃdÓV£¾E%aU·2‚ %×ÏÁq™Ù̘Ùêö}±ÏíÏ¿¿A‡YÎÏ8özš²ƒ³#-‹Áª¡öí; vriÇ«DýsÙ•â{².úÕ½à^ùØ_óÏNé }ßÖvã¡IfNÆ`çžôÇgòöhÅ4´ãªv>½ã?vÜû ]•hæìp»UZ*ÿ«Ý÷èWèÔQO®Iÿ7­õggÄLhõ4‡µm}3—:>ØÚ$û{Á<žž{¯_éÜóðÿ N„iµŒÏdDg76ÏžÔut›EèZjêVôZʈ¬¯Æ~ØÑ¥¦š4'U mQ`s(ž`ò3È3Ê^Q‹šœõ(;ËÌB¢dI³ïÙ¾‰)U-¦& ×G<ùÜçkˆÌi8ß tµ;ÇšQ°Ú¿žÙ6ÊH5Dy¹ ñª5ïèVÜ•(Oçg˜¸ŽFE¯x¼èÚÁ“¡uq è¯Î¨¥ ÉÎ2ÈÚ1ÞH½Äief” 'Fí:å:ó§{h‰çœÜ‰6"gLÙ«XWà•=gÆm¤è¦Ù5VM^)Tw¬r€ÔôòH˜¶:ÇÕ+¿|Ь°õR!Э¢ÓHöçˆ`XänL›bÚ¨­%V©µ&­îÙŽÞ踹7;³«WS5éá Qʲ=` A&ùey‰(Ô†Û7`mîŽòÀîdr½¨3{*Ï2Ø­«w"Ê=pH¼A´œÀ‰˜¹3h)4TF¨¤«µ^ëÀD›gØ#°jFš—ÙõhðêŽ_~¿F¥Å $¥Þy[–ÍÀå”@#2pǃ ÆpŒFœ+Æ“ÂUJº°,x‚)¹Zet µ‰¨šAî#qìHk5ãÔa˜]e)Àð$Bt¬¹[qc…ª}Pj‚ly˜*›ŸðèäTRý¿n‹Q¤ÑMUŠöÈR±o5þÁ}ð›Ù§U©Çߣ)ܪ½}ƒ±Gø^·¾{½úuENé¨U·jþµŒþ×Òì‰û´ãº6i1ëíûë}¿èm¢«×¦¯¡² ÿ1=¿w¿F '=8ŠÛ2jšÄÍ€$ÐdH0¸ˆ·xªf*‰ƒÔ°A÷;Ñ[uvýƒòÓji¢Ÿ¡¿°Iû¾3‘q³±DÎÞÙ™ð«ííåíÑH¦)“IØV$˜¶cØ>ÞSW\ìo‡?lÄ{{tÊýtgˆt…Œ£€áʤŠk‚¢ê¨Nït˜ ÜÁ‹DÄÓ:d.Ÿ¾NÚõòÆ›` êæ=ªØÒ©ï \|-ª¦á“ä᫹3Â2ì·)Ú¦­š¨û­ïøðƒ£›ÖôŠ6jÇïNRg¸÷û´] }4¾þ>¬LÌežŽ7MµDEbGSžyÒMö‘kLI›ÂtÔ­ ÄѼoóÒg¡:¶¥*®ªKWjÂÖ7˜Ø4m»UE4U]j·C÷…þÏWjÑ–„¤ÝÕ š˜ï|âI“$îŠuaoLO)úM0ÔF—ŽTiÄ­†$8:±Ý(~Ìx Ø %Ù1g^Ží‚Hb(yÅÖÉe•NI‹Á"ð^táÃwޱ©E-ݾëçz¾Ésøç¡¬ØºÛáÑÂÔ ×R£wA’ª[™ŽF"ß%p­\|¢Ôn[…ñJÀ!#š¼í ™"æäFZmF ü—uŸ\ð}zÅð¬_Q:ÔŒY _ØÅð}Ó|Uo)-½E_™G p®Ám ‰‘:cz°º—uYTJŠÁ¸²AQÏ.Ì»§¸åmNÕôœ¾&U¡*U;a3çQI!¾pNG·Ø3ç¦çô/®ÉôNù}oõmŽ;åRÖÝ[¯Ç0¬7Y²õj«)aËœ/Âܹ.Ù¼f8î^PÎ4¿\P»Õ×D•¼çÍgæ`žîB9Ê4£:fÍò*QˆRx’”"¶ê)ü$g$Lås:cupý’¢jovð‘·]d¹d9^c9‹€t®šzÇn½½¾I÷ZDþ]—ìUIÍu§Mr…_+n¾a nÚÑFÅt¿û+ vÛÙÜŠpÞ¥P“ëV'/oi$nFyÓ º-Ó¨Ò¡ØØKÔë@ï¿¿.ÎzO³˜ì7·„e _¬N]Ì iÚ=L·»ÀýúF¦žÌìÐ6`\eHìÒmøðQqW›¤÷R wA¿*AÓ&t=ÒcLÖ¥­YÛ¢Þ&‘ì°$ä_AzÊU5FݬÿÂñ9v[»AøSiÅ}£²ÿW³!Ù£+¥é5ŠOlÅ€Öžà"ݓѪª’sˆÌÛÖ¾„Òv˜þ_¢ªúßú´ejª)i³<Íäˆÿ5„DÀÏžz¹ÑÔûþ">#C9õg»·ìÐ<ý_òíƒáùèMU:ýŸØõ}Ÿ”Ï·Eoÿcþ/þºuJÞ‹Öcg>q`oÙŸ=®Ze~ŽúIƺ7ŰŒo^šVÁzôSóÈçpck+³Œ¯¦GùCü§:BùHbßÖŽ’5¡ö·k%~r½cÅ.ýÊêÉC~²Ï9pêE,I33¦®ÓO[­wøìËGªªªªÚª?Uxvøå¡ óöþ4誸?Wb¡ŸÖ·úò£épîHj,6…ÄwÎùß·>S¡t§^ÖÍ?Ú;½Ú>¦J{.R[͵iÒ·™>ùçöŸ$™¤îª$E®BL›iÎm7›L±d›DäÐ †j¢±ê’FQ99†XB VV¥²‹¦‰ë9%ºž`ZF`M yÚ0¼¥>NsZ~‰B½J#ÍòŽ~ À$OѪÀŽ.¢‘ÛCxcÎÖœ Žß¸ŽÃ[êå4ÓºoR±^é½{´ŽõY2àJ&8YçÖ™¶–¦ú˜²ˆ5m‰áè±lñeƒ€¶ígÌ"ÝwV³HÜírë µ.Qß9UU–W®²iHna ýã°F|ö´¾ãUê |C OUppæ °lU³ñÓ´œªëY Ppº! a†LÙúpÚ!¦Êü—újèË ½iÕ=zÖ/“Ö§tÍjž4ïGÖö‹ºÔŒUgHù ­œlçXᥱfÍë3þÉtÁ=%ô¥ˆë·HºÁÒ>F©{ìyÞ´PÛVØ%ƒaX3ìAàx¹Á36Õ£™àšè9 iÏXúN×,Xá ±ýbÖ7Ý!c­q‡Í—ÅC¡¬x÷ö‡ûßqAÓ®'yÚeóø ßKGHëGZå¬ZŸ­8½_Ö QU,;kˆ¥Ââž5½'?Üž\Õç/S5wÅqo&`Í•YÍjî«AOè©ùçñqn;;tÏ«1ÀpÌcjʼ1‰Ûf›UZ:I&§H Ýüy 5v\Ig|]É‘–·ëu%8YtÍe›QÇ¿pÕEYU¸@´âu­Åe9ÌœŠk¸—Dý*ž†Üôì—FºÑÿƒ/HÈôZ·HG zuM-rs†¹Æê§•Cq†ù{ɸΛ1‘MòÖ÷®R\PT'NÊjì-Τ‡øâgdscÊDöÔR¢á:©Ø“ Zâ.Geç”Ç>Í!ëUêѱëïJt'?Hdr“ij1 …Û¨®å3oœÝ $s˜½ù‹heH3^M5íáÉ£;v´z¤ÌÈ÷Úþ0سz©©A;½Ò]C˜=âÝ“oÊD_m °±bS¤=–›r·¼‹Vל«éóûçã.z@ÙôÂyÏ›ƒ”Óîä'öI>¶¨Õvë"ª€ïë;ÚÙºCdúBàÊGo=¨“ »‘µ]JT¥{q;ØÉ_áÏ3£é½QµXªˆWÖ­%h¯)Ý*w Û¾ÄB-6Ð'&*iƒÉ6=À|‚¿ ˜ƒç™¼LåÊgG¶©á§œçüyGòï˜ÐZŸ²»ÿ>ßÏD –ÌÔ˜‰Èd&bò;Dv¥¯X_©×ü)ÊsŸÏA¸¡IúÏ?û½ñ÷è×W×¾_Ëß˳ïÐΫº¹ìÓáxÛu»çÃ@èNšh¢­»×WRŽèû9üfb(¬å4QFó•«Iµ'󪪭[¤;ÿ)ŽýQš˜C‡­\6U†%…b˜?fà‚³WÍV ß ¸.š¹FVîëqe&¦ìn:‡×Nš·_`ç÷ÇeÃõÇùŽŠçGû†„Õ´ßÖ¼ý ¢;úÓ;Sìs¡týXñ¢cǺÇBÓNŸL l[÷rëÍüyhú‰Ó]]Z9ex0O,§»I6µUVÓºr“™ƒ0mìïÎ×ÌèE(ciz›úÂÿlò]p|7e1EH¥]Â!E•RÎÄ v ùç¥ËÔÕñWˆ·£ZÕT›„ îÎôJ¼å9Lƒi±ÎŠjÊXEKâX2ޱMïÑ[×(ª’Û£¿(739ƒ|¯¡v†R‚Åžýgª“ÑH"%,ºëîLe$D“H9 ižõ_Rº)£U5óÖ릪+ú«°Î-Æ<³ô\yUûümw ü–ë -ÙÃ7¬Á|FD_kïH8¦¸×«±Œm…+ôy€1Õ=\Q††á|Áã…Ø…ÎÝ¿ïÊ./Œ<žÿ)Ó>ÃTQî)Z•ïԪس±šËg íG¥ø‘ÈÌŠlŠÉ=šèPÇÿ4Ǹò @½…ÃÊIT³fTГ¥©Ý7 RÞÄŸ0± öó¸ŒálÍÛ·•ìÍjí[p•I€2>ÕÏÛ¦RèKu¨%jÖ±5° mæaoáÚØÛÀîÖ 1d žþ™k€&dÆoéÝ]xÆz]ÖÝré ³ú5‡]qWúåSf̶°µÝc 8]…¸xãrp¶‹Vx9vO¡_ÃàúÅVùû¦þˆ+t›ŠÜ̪ÀF +S`;š`ç1ŠV¾²q.Ü®“%⮜,¦,ŠËN–á·ë·¹á]ºž3ÉRŽéëZðÌ7 ÀÐrƒõ\?Y˥ᩣº 5%²è-Çq—Äñ;˜˜ÎãLiŽt—¯8Τê¿GØÖ¸ãô}©NTsƒjÚx¢Éj[UUâ ïÿªhøo—¾™Áñ×ÚtÂ/S¾ÒtmÎòÙ‘ÈeždìÎPMiVùòSº·kWæØ8˜ã“uÏlÀ{Èš´©c-¨Âœ(ÍÞ¸v“•ÓX(¤Y›‘2Áœ…®¯Ì©K¤ÅùŒ®cß1ü¤è CMKÖ”õÁYÊM¬n$÷e¢ÔšËТuíÍCÇÌìövß+_HÇ}ÖØÎNì’" wX{ ˜šQ§­Xêd÷ÞúXœ ×gB®þîáÍyõ²ŸÿËŸãÝ3Ý¢jª…R"ßaå÷g¡ñêr¿?Àè×6:»Ì­”神†Ž,ˆ¬ Ú/‘Á‚'í¿wìºxCÀ7w›\d Ú"3µû,;¦S®†iíõ-@5õ‡·—«µËFC]å&+÷Óãßâ4“l+qMFÄ‘˜Œ‰±,æDä;ôi$ÛmÚ+‚>øŠAˆ¨™°çßB.鈡ëœéˆ"GÑÏìŽrBm«««M"½ŽWðìïû§NÙ£NÂumõöç`™Ê߉öé.Ý¿[fí{‡‰ÎßA‹'VIÓFÛge"æ¼ÍṎOE…§,ò6‚ UlÍÓÚn,ËH&ô¥M^¹$ Æ`À2Dø Ì‚8QWRº÷ ¢Göó`¾í'Ñx±8¢”ojâ?V~pÄÁ-ÉåØ&4É8U7Q7Õ((^’‘mZvTmÏžYÌÇi°¿ÓÂ:Íe <]5»ÅVŽ\ÀŽSÎr‘I[M}áu+'Z«Q²¢dî·ƒçùÜHÈ´žÈÛ½B×þ…×è/_z*ÖýIaÿ‹ã¬ø6²j_ÊALCWÀp¼ pÑ¿FL°$io‡/Z1f/Œc= x*¦ñU®Í×h‡UœEfêîö•€˜Hv.Žq0ÈA3L‰ÔµMøqFòç^ƒí‰Ÿw®zW+_glÁ¢;çt5ãR𪑥!»>Œ2/%á‘l§A“gˆêó¬a›ÑÃbŽÜ±ßTí-ó¦¥%Û»%êð•Hu^†?ÙÑ “C‡x³„RÄk‹’©O~¬Ì«ýÅí¿Dx"r:G¸N—k®Ð¥_C”T%-Ñ$LDäçßJ;ÀƒWUÒšUŠüìPM3äÿKûYlŒNšH îÌGy¤O¼XyiÛ½ºÔ»ëìZ™’ ûÉ1£°Ìè^ˆ1æýDN2ñªF¬1Š’ª)•#kz‰þètðl©#ŽÚÂpùUÖ]eVYo9]jyÕ´e6°3ÌßÄ6çbªö]Ñêãã3œZb4b·‰Øêe˜ˆþ+sðӎ骙¶prÙ=úuøÇG([†RŠÛoM †ŽÌàú£¾ ‚3Ñk¹—W$P@0bN@@ìµ9^ì °±'Ô uQìw÷蔽-´REˆæc¸Fpîf4Sz¾rŸÝ'íþ_§7\5ýo£®wïËf"çÊêúþ¿® X{íøöhŽí ©¯ÆÑøø{o–Ž“´ó¨oº¢œâmê÷ÌEûm¢wôú´Ó·l¦ù÷Ž_g»Bt^ÆÕ=æmø~GýtmTV mdE®a!ÞmøÜÆrJ z%æ‚ AÈž@&"¨–<¬U4íUG_®~lL“•ÉÒ–é*zŽ2ݺM¥Æ Ü, ìQ&|wî7Æ=«‡¥®F_ŽPšÕ‰¯ˆ8ÃiÖUƒ•°|!ŽÙr–è%‡áI ŸïnƒSg¸Žu7^QÄÙy‰*®Â)7¢Ãv’Q9vMó‚ožˆb̬¥ š§y]ÇŒžì‰ $s±] ôy©½.k¯ôi‹ëK^޵³WÉz—Ò.)æµU®7º!»”ÎÏu­Ô³g­Ð|†Oÿ“ÿgßJ¾¿ü’úSèÿYµ·U:FÕŒS×-SYLæñ©.ZºH¡p÷W-œ3vÑÓ2¾cý¡‡ÈÎ?èX1M\­âjáJ8I%ž,©ImÊ)5ßÉ€˜õ…©èo¢­‚:¹¬(Ô³~—:GEbF…P6OGZ…ûZ¤ãñý^Ê:OJ[ÑXIŠŽVb¯œYY üôGlE¦w2"EJQ«jŽUu;ïáx磆¥CÇvøÜøål¤w ßf“Öëõ-í4ößßùhÛ†÷¨gÌßÀÍ?i2{£–‰ýªÆÄÎTevg3µñɪ‘Ck3î¶wž¯ÝË.z*”üÕÕÔÛð‘×ìø¶ˆàÍ?PQ{ßÝêç:r¦”ý*žÊg.Þ°ÑçMš§Ãpîw»mR­Ï™]Ò¿¯C3ÝøèËš©Ù^Öýï·óÓ¿[ü?†ˆ¥Á¦#bÓœóþ-¿ýø¿úèº2Yr©Žvª"=‘?–‹ÜSW[nâz›3o³—-9ÂÓõ¾Ãÿv„¶¦•ªÛëÍ;n¾wÖçí‹óÑkQOWgç:ÄWÙêåÏã- lœÓWð©·nSñkw礊 jSv]dg)”ŧg9‹‰ÎcK¶‡Ó4o(Û·S—oº~Î|ô¸a¬ÓN™¤gºŠ7=þ‡?Êù bíåtÒÑw5úôЕņ`9Œ órß<#äÓaèÇQze[£-c££qKs«} '‡¬pwíµqÛvxâ˸(áX‹‚ÍÛÆsÀ¾'”Eÿüw t¢.°GL[ÐÕ£Ôèx‰MÊ¥Ê;à¸@ ÜA3x6Ê,:§Ð¶%Œ»b¿ö¢,*|®ÇÇ|¢¬·@2ó+9#…væíå¦ßêgɽÉ{JØŠ{ Ù1T9SÌ$£ª”Ä x‡.Ý;Ï´ÜÅän=} jJØ. ž«Ø/‚:ÕuðM8]pëb¤®‰ÃœãåÓ£èeä–9Xƒ¥¥§Éi‡‡3*[RªÆ„PIëUQáÉ< ë¸#"Ñ y‘õ£ ð]\o¬š¸ÇJŒWIL3Ém’Ö4Cl›Å*¢½ªIÅü٠Ȭ<9éäóãXZµáØ;KüAÚ¬Û2M%QE¢¡ÂÈ1DvÃÆXÌÌΆk÷BšÁ†¸v.ÁÊ5ºV)Iêr®ôRQ±\z Œ¹i®Îµ%βî¶ë5T…Ík4RùäMîfŽ˜Ó`â—§DïR¿i™ íÌç`õYL1ˆB’75ïhm*Èók„€×ºöµ 2.‡»I“7»ÍÞöµ †×Ìò“Ï,Æ™ƒT«gb8n)Ž0k`©0EÆ#€¸Ud“ÅÎõÃ%ø0ÝÈjêaàg'ºÒ(ZíŽU¬Î%ŒÔцŽ!ˆ*ñ3V¤Õ‚[żÃ î4h/qp3¦¶kbmZÔÉ0EÞÝ;;›$sŒÉÈ )ŽMZèBª tÖ>f»yИó03½ûÄ\g¤f-ˆaø}nfƒZ÷æ ÎΤ_%c‰€¼yPñG8fÉÊ›°ð$ŠmŒ¬ °ñSÏ”£@êQº-jzœmÆòºTxAõ¯&De–vŽn‚jÔ•Pt#°kÍPQ™î&÷’yævs¡\ –%¸z¢› ï™§Gš*î x9ú1Ø{¤~££ {ùô£¨ôƒ‰7h0 ]ÖVŸÒ!bÇX1#UõX¸V®Ž:UÀ$›üOU±^%ãÞˆõŒÔô|ú“‡,à‡“XzÅý#БªÝô9«Ý*ô!¬ì0]sèÓ¤]Öü3Æ5/u…ãxÃ*x×Ç^°«¶Ç°·Î0Ù–VÁ>}ŒSå!N‡ÿh|=ü¶qœg^úMƵãYµ±Î°ë^=¿Ä5¿vëzÿÖU—…ß8Z262ià˜8| ÓÏ;äª5ÑFÆÊ£d€.~Ì¢ý¹Úš•lö­ó›;¾Wý¸Ø GߤRíª­JÕ®‹Ù-Þv?leã:t£jªCfz @6¿dDíxXêór߈"ªbbý‘˜ ¶÷·|‚˜5“Å‹À&&v {{s´h}3ô»{²Ðmž¾cc–É晞ü½ÅìõhÙçÝŸåÛ=Òt õŸWFÿ¼|}Mê~ÏÙ¤XÚ‹e7Œù{}Ýó¤…4í5;'¯]6Þ|ׯ݃¡è7 }1Ù±ÍFšSŠ?ÚzüˆŸ1áÛ—q “Ì9Üûþ#¿D"¶Ô€˜˜›äGh™ˆœ¦ùŽp{^SÁŒ;h§1Î3#»³¾ d´ªšÉ1;?þÛüxhC*8§t<¬ ŠþŽÑ™ã–C³+‹imn†ãõDrfdƒpl=ó=™]°| ÊÕ#M5ºüÝ Í@{æýÚmGÉä¿ÒÇʇ¥ÍUè?¢ \SZµÿ^q„êîS´pÚsJ×.\¾rÝ£FlÚ·©óçLpIÅO䟌üœºV×¾Žúbg€¶×¾‹±ìSW±ü–2‹¦']0gnp×ÌPÇ— /o‡'ç7«×MU釦þ‘>M‹t+­X­¥ÑGø¢ZÇ«Øf–%†¥‚ªèo•²%»gMuŸoé^D>œ@‘¦º`} §âí×os«Ž]=SvQ\¶KÏyô.ô¸áZð­ÙHyÙ1Ù±:¡Ñ¶ªab^!…a-±%&›b¯”0 gp¹Üþ•Š7mýªÌäd§Lõ‹!¨-ªÀ0íJtëY'ªM‰ëF‚K`n•á %(b…h Þ^‹‚/Yu_V±×…á¸Z¯žŒ’¸^ñ"óÀ ¿3|Æ$i¸º•ÐêXŽ'ƒ¬ó|Õƒ,+â5cŠS Ö>pƒ,Z8rxN(Cy/÷ÿ‡¶SSõEmrÇhÕÜ*¬ª• èÆÕó:ʪ¿Üp½E>‡& 多z—‰ ¤8pé²ô+»^…ID”Fî¬ÜC¦ÎšÛ<¹.}+`xó^'[¯ÝUÄ·Qt’ܤr‹ ¦-´dÀ‹Ÿ¡Ïè•ùlôaý#ô…Ò¶µbÚ嬺ÂëS0^臡Vú«‚êþ¬ãmµã ë—HúÕ­©Š—i…á(&ìàí)ã@ùFš©d)ªŸZ>TŸÓe‚ü²õçCx¯jÇGø~#jþ?ƒë ­p§Áøì')y¥u馟ꞪkP“„kpȆø‘«8Gâ—å¬0Öý)kŠx¾ ëÖfóª`j:ÅUýxØÈt#(¼ç$ÿ–#g.n‚Ò—£ís¢LƒôI"}YÚöÄ{´sBén/¶kÿwo 'gâöÑu:On)Û;ù¯þÞóïÓ”¬¥4ì²õþŸ,òç”w‘hrMN¸§G®bùíåý\­“´·'ÕÛ¬vüý8„¹«dˆÙ­›LÄç36ûò“mL(v‰¢GR;&bù{¿f“‡ñ¤í¦;û žÎd“s³Á¤Ú-èr6Ô¦I ÏᑘåaLgvÂØŠ•¡•T‘O×Pu¢s˜ËÙ•ãKþ‡"’”&iUm³Èï,ds€Lò›ÆDIÓÐß“OFØóÚõŸ_u{\pÍXÖŽð´±8ÜCkŒâ‹;Y»6íõWÉÄ8u‰µâßÓð,g´§«?'¿’ÏI'ê‹­wÆp¼SC|\ãÚÙ¬X«6¸§”1ænŹž(Ö0óéœßæûFÛRã¤zµ+£½jègVÂðYÆüN2º˜34u«q…­åGÅnå£PãôÒÎKá5Mï­¦¼`OSÁЏ•oÊ«¿s‡µY©IT®KãÑäGñä†@RAÈé’5;Äu‰ÚI9S­º[¦ønwn¸XóoÇénÈ" ÎdȧMüè›äçëšõ°IÎ÷Éå©IÒJ%>a}û™‰_¼‘#ÓN¾M˜nŠŒ<‘åÓKaŠíÂN’lUF$8E˃Îâû3 6§Wº/mƒÛVLÔJºÜ”UÒu$µ÷öäMòçž—Wš”qM^}ƒ×JÍp§;”Üá®ÊJ¤!Tb¸nKƒn œã-5˧^ð}]èÉ%aá“ì+tšt¤Qv®=…µ[Œp³àõÇ”š<8da^~ƒ%„À‘§Œúý„»y¿YÕ$z+§ôVš|+f…RFåÀ^H'¶âO=P®ftÖ`ÅVx’Ƭ9 ¦ôXùÄw ?ûhhÛÅ%ÒÍ[ÕB •u-ÔYA%XC(¿»èžÉ¼JEmŽ‘°Ý&w¶…Uóƒ$_"yfÒ 9%Uö¡¾õ:ÖO Q“¾9Iå6‚F–]j…k>]´ðå^­üÚ»£çÛw“̈µ²˜Þÿ’?@3ÿIOýô5©,ugé-'½jë–?^/N¬Ú–*¡&LõÔ*kæžÓ\Ö1R×f„5†®; ]å~ŸHçô:ëÏô{à-:h×mj§Zÿ¬MõsèÏU5{ 5}Msr–÷Ö•÷¤¶fè4¿ƒ8Þ²È?Ùøq§OiéGÃ\ãÃÅ_;Ö\H:Uû÷+o]â ¬;$œÛ‘åŒañ3¤‡H(TX1¨À°•p¤WuôÌJcnÏpwÀÀæf ¢Ã-wÖΓ‡Ixs:îÛˆÆu=¯©æä]·ÂÓX”uZ—‚åÖÒGõ@ÈòƒaÛQ†›*²©¬í¢cnS•VIَܦÓQFÂB¯6¢µz™Z×ÞL›ó˜$¸ëíÉuINìIÊ9œ„ó7#+ K(QQ`Y¥Em·4pµª8•WõèeMÈÎ&H:u¿Rß½rËŸÆZ»F „ÜÔ¥S±Ë²;}†ÇBÚêÿÄGtGÇlhŽ#Ò(ݯ·>]¢}»?Ft{Šoµ;VËž_û4nŸ\};{G…þïÌ×5mÑO}VŽ]_lþ6Ñ53UR×™H×YQT7¿=º«qLw÷ÜöÛBåü…:<þ†õe&ÖÄ™1ü9Eö½nýÙÚ¨QM½œÎVãñÑ„)mM@Ww¿·×ú"ß`?KCjõº½–ÞeùÇg>Þz=C4*¦/ï9ÞùŽþÝ%™“Ôªˆ$‚&3íXò›rñëJ"Ý¶Í l)ŸW.SñËÛxžf-6*ª„ª"ü·@G~Ð$íe™‘ÌI¼aL\bŠ,œ@Ø Mïq;9DÌÞ/¦ÞtUѯS:ha’ÎÒP¹ßh×raö—&xÓíÀü˜zÓ4)Œ*ëÕl1³¥–-Ë&‰b£ô[*ƒö$[p…çúg…]šnN·tÔ¶®êØ=UµŽ0åxŸö[§~N(ïød¶hè‘ÅÀ<¤ˆ“¦‘ëIõ¯©]ÃúYðª¸Ã”f׋UÓ­Îý‚[C†j`q#—þ_yÒs¢[Â1½pA¥k*ëAÛUPÍU”-$³t_,ݘ$xœýÔèO¢W`Š.‘ÃØ/‡´I%0µÀw:ÇŠñ0ºà8]ÏÔYDÉþÐ’f=Cè‹QWÄj­í JͪKxõtÝ¢ÕZ‘Þ¶GÏÒ]º¼FAæ7«Sõ-½i†@”ñUM%–*â©%sÈ DRMŒŒÆ¯G厖hélÑ]Ee Áª“qÎb'Äi†5›a‚OZµWkVñ™¡4¸¥Qã$ âÜÁñ#M8ùCk2ØŽ[%œâhaÍJ—-Òv²J©^á²\A ¹nÛÒÝ6fËÐÄØˆ3§Š_(ÝaÀð-WUž J.›*×.ëp×€ØÅWzô1|‹…æ­\plÅ£(ˆx³ÒÊÃQþ.³ö¬Û”›2S fIVæ¹°2׸fm}4õȧ}´ÖµŸÕ%M³u]I”g'·"ꮪbÚÇŠù=›‚ÕÍ $«¼Q%·,0´³YwïGè­[6ñë¸ÈöHÉMõ»Wz<Áðêp,? W­lAž¹bRAú®•t‹„*A»%êrص œúþâlD4+^õɵo\¿N±A­Üh^gÌÜ#,ât¨à2ë6ÑçIz«†¥«o5{\ØêÊšØÕv¨»wÀYúCWnãú½Â˜‡TI76k;[¬C­í8:; ¤‰Ííx3kZÑ¥IuÝ»V‡u KuALŒÍàd ‘{f#)m,8T˯oc¬Í•™œ­Öç"dÞÝ£AÐ5V6U¡ZM”­C`G9HŽÙ'Kƨ±p³ÆlT#[5V·I¢BÊñA®ü¬¹çèã;˜ ˜:{/ýŸ(×ÑËòÁzdéS5“Qp—ý꫌$êÁ馹ãoŽãx÷Å3ÕTp‡É•8P8äúâx?¥gú^]ÿI¶¬ê×E:—ÑηôV5^0%0¬QG ¥·I}S|jsQÕìX¸l5‹Q]ƒÀë5Dà8‰Ãê,qó#¯Z²áŽ&åuZªƒÊܪ*ADVIËU?0¹Xú#»Z"$ÌŒ)¬-Ü=e@]®Ój&Š…x¥RFyíu•Á‘Ò¡[eÔ­zß":åB(¢J)‘È󹽤 6dÍ›¾]öôùê ¶x©”{P\Xð£2-S‘$|A’¸~#ümÃÕ\¥¹TùÜ®ffyöM³Ò¢Ñ';M”ØQK"–v¦ [ˆ˜¢Æˆ.“C³±µDuëLÊW0L^âñ—dýI:j‚:™TûdŸqPG-Ü©M[]J;9OÙl¾9áÉÙÀíƒp2M‰›Û!÷´Þ§T} ">—®*godhJõSÆ“W|{—¶nz7ËÔö}“Û>ÎùÑVÊÙeÝáÙ ­•áA›A7̃‘¼­{vN}X™ûyÏãÏNo†×Ó¬_â6¼l2å¡ÔÑMI×TM~kcßÁç¡ÎpU7;úèW¬b‚‘ÞÉ6“À¿q¾€ÓM; lw×lþßË··GÛSO O_·ï}ýÚHµ¥¥4þ¯–Q?—d2¦««ô;¡®6Í'ˆÖR•KçMÅÍ® ŽqÜ.X­¼£üBœ¶õå)¸$lL~@ጕ‰öÓ0tU«›üsQ¶ªïÔv•h ›^(o¥º(n‘é\HdÜ@í:zÑ–ª-„âÏÝbêb&+‚°UÆ$‹fPbŸ¦p>I-ËV¥³‹| L§¦:ˬ'ÝiÕqöÎ1îu“Vú.`š¼¦:®´`Ý%ôž®0ÝbÅ_.[°þ¦án°G6Y¿ôìÉâM´ó»]uÞ…¨xïm%w;ݺèì0Nä+ÞNdM é„ð}qAÖ(Ú¼M'U2©tœ?OYŠªš\8_]fîv¹å yÜeêGÉE£gϰÜkUTÞcJµnš ‡xËDHn‹èoj8–Þ‡[·ßmFÀÕýcÂõ]Æ>“ÄÜ'ƒwÆ]y/‹@y‡«#èßÙp8¶CôüºÖ#ÕŽ‹p¤˜àÌ‹PŽéF©$Â¥IQ-YÊá‡èÍf#²Iž›I©OÚaŠP±¡*]¯‘ÜoŠ)ZÆ2ýèç ‰±ë&»'[ZÛ&hÃÚŠL×JÉo’Oõ;àIŠb‘‘“¦—ô“®éSKµš¸H$¶éG‹9WæZï¥ë\"äp²Ø¼àžÓ4ó‹å Ó=*1MŠ¢TbÕVu¯ TÇ .ô(-ÄÂÛf œ‰Óççå ÓÆå|+YUaèm–MXâ·+þ½ÂáÁÄ‚g´‘´|ôÇÚâ¯áÕAIzQ(Ù ‘¸&fäå€4oUõÖ&ïqÄð7øªt¹wŠRý¾RÔ5 ¸_rxb}#ô¾uM΄­¬¿Õ,1ã,=U[TÿZ‡Ko N)&F< ù ÓapH›ŸÖ.’u鲕֋-òT<à9Ĭ’ÏÒt’.Q]» ü6ê ,‹;Y5[ÄiDZú3X¶læS­u<ôî &ÜIœÌ X—Œ s^®ë^$ÍÎ!Š`Ì5ƒW±6Ã{Š`lŽÈ’ÕÇý¾„ã°Œ_-Ãßìø6³ÕÌG Å×pÆ8’‹p®wZ°|/ ǵ}î¯1Æ·aÂñÊb®ÑTªù!¸ 1pŠ ËV®œÙ”s6"tô¯ KZYàø“­NÝâã ]¸Ãq% ÎÝbŽ‘úëˆ$qN yD̘+_5Ö§Ïh…|*H“J†íVE¢i‰€‚ A³dAŒæp¾1­®ktæ–‹¬†ù ƒŠ“TO L¸FÇôPrËÚdi…ãîY?`Ù6iq!÷”iÆ=3ŠtÑT[$†¸Yr׆hå·éa™‹5Põ›è÷RúPÖ=Jwª‰.Ñ'œbî^*£Ÿ,³cœCÖeÇAz òúpûéè_EZõ‡?ÁÙPWj‚˜{f­wñ=Òªº­w/]|+qŒí£RÜL‰ì±GzJéd?[r*Fš«…*)#d·ˆ”7 ò¸2dÈrÌkNµcîqJÓf¢Š)ÙYX«jAq0n$X؋ډ°TZ½iWαZH©]eP–ä­ÉÂëpþ—‘ÈŽGžÒt Ò¦¨˜ªië¿F»ÒV ë I8Ö­KÅGVµ—k…³Ä7ok‚L1 KÅCŒCŒôIãŸ2Ãí}5óÄ1Œ}õx‰~•jЪøU[ÑQ`ŽeAáAÓyc4éŒÜ»Q›÷4¤Õ­%¦ ‘òuBU)´[õgÒio{s¼œ¿Ñö«¶ÅÿImž¾¥÷Å+“¸A~ò$U•Çf›¥…'­º§¨ø¦¬±gªÇVzDáT8sÆ,•Å º–óŒaŠ‡Ë 1-UjÛ^ fîqÁaý:qþæ¬ Ê5·tul@(«ýbr‹æÊêƒV\%huÅ4qÆpE¤1,9éŒ)ÀFއ؊ªÐ⩞PF‹„d‹–ä›HõHç'*þ¶kf1ˆ­ãÓ‹âñ\]»¦®íGî’hQãŸ.‰ô¬P6nKן§GeŽ˜ù†±âQUZÕª¡*6Ue$ó"ùÈŽÃMë}|+F^£àÈîœ×ˆáÛäš:jë‡(yé-y³³(ÎÀâ­ai…¸QËKªêÝ_z‘Þç3eHñ‰¶šç¬´£Gb𨮳lÉÿÏÛy·¶H'¿käõx'QY¬yÄ÷¾f2µ€9÷@R0ΚŽÀLõ˜"PŸ£Ê&ñ„mš“m]PœžÊ¾Ü½¹éSj¶ l_Çþßn„¸Äœ¸¥ë—îRIº;Åw»”’0ÚŽþ連z›_ë™ü~Þyhºjú7Ø·ÙöÇóíÓ•}oýZ5ÂŽB¿ØËÂöñŸfŽŸÜ3j?ùÎSÖ«×êEïð{/ B‘U£/s?gòÐÚکמ¦|¦ãò9+¤ŠQò]u‚c8¸¼É" ÚMû&ËtµF)ZŠë°Y"fw1æÄFœ¦ª©þFÿòÇw-ÙÙQ5Rº'©eR¼E¿?~’Xs ¤”Qõi€ØÞð É%ÈHª>ɹ¼àL[½YøuBµ¥Aó»¿œ‚Ìo ÌÈ™Ë1™uV+UCURíºMª÷ Ÿ2W=‚=h3êƒ:z×òMù0k—L•bØ®ÑÖ©š—äõ5·^Þ>yäXj“¶ç~ýöáËkñàf ð39i¶ß.Þ’µyÞ¸jŸDÚ¨põ/ ­LGPpÌOU0´uhë Ô„_b¼kFíÎ*Ûqž·ÀLŒ=ŠU†¶s‰VJºÞ¿QÅ  — ’¡; PÞî3’322ï߆ðæíg‰f…·­¥6é©R…ìG úíÏ/¥·Ú»«T?l¦$ýf‹=r©~»Ê" ¬ºè [^öžBFŽâÝâI"] üÝ ï¢‚’ªºIÌ­ÄÉ&øøl_­ý¼~ÅØ¢®»‚h)n—UÑPOÌXŒïz³"ñ¦©ë®¢b,ܼx¥†!.jTI%݈ *€Fp{ÏaâíÕÚ –¯aÝ ¾æ7qœeœßì奣éMJÖ½ZÖ:¿ƒk§õkZ5a彎àkyYpœ=^5O¼†á €KÖá%”ó ×½tG¥NzGéY5{ÕLG]µZÞ'‚ôk…áº—Ñæ ¿y¾àXàˆ¸Œ+ h\pX9Ÿÿ¡³k68’H9ãÄURœ/s°£tA «7ˆ¸ñµaá ¾nÙÃGN•MZ¡uZ…¥+Þ7ö0"àå ÜÆ˜ïhÄT²tÔ+®…co¬’_þgÁÒ½R†¤‚u)zÙªEFj’I‰ ˆ€D‘$è t»¨×M \Ž¥<é‹m\flcÀ½¹ª¤jSÍ(U/7úß=þ"=£ìÐ:¿Eúýn½ß¢SúV¦ÑÛêÑZˆÉ˜·a3µkIû–ã/ãü*ÐzjužÝ9~ÈûyèêÿCø¿éÓ±EmëÛ¤ÀÊ£øy \ä ô2švúÞ¦ÇЛ§g³¶Óm(/ñ ê”-OšOa>ô‘&ð`FbâI碋cZ•Ò­5u·X Ò s'ô²f9IíÌJ¨¥Ê‹Ò… p¨§¼·4¬Bó ÊG`Ñ/Ò¢ÉÕęڃ7¼=°{Èh¶Õq‹š+Xrœ²6çÊc2t½4ûl ÚÕ­ÕECœ’æýò;TtÌýà(‡ Ö|×_ b’Ï1ÃÚœ!Ö,šDî<’}$zS‘ÁåÊn›k©ºû­Ýê¾±ê"®†jK8.ËZX7`‚­–k€<8Ƹ|¼²jå£3$FYFž…ôý ½(tCòuׯ“ޤ­ªÌ:4éaGIX[eVKÇš`Ønåq³š¶=3fÏÐ_@ÃÁ}޲­­+»@¦éAE”k†ê¢¶é$|ïž!§ ¹Zr:bÌÄÚ>xádP‰ótnÔáwI;ÙáØ®QakHÌ1j®”sQNªö7~¿5÷22æ ÈÛD,½HP,B› ªüýÃÌ›ŽGIüÄØ¼¤aôõ¢¬ÓFõmê¦\C><0á3Úí:fPé÷ÕZŸ-‚âk5XµUµT$²ÉR¹]Šå – s2#•´Ù]OùfbXÆOhÓ„µ;mq„¼«…:W$7莛úŽí£¦Ètuò·Õl]êz¿±Çµeæ¿­ÎÛYMYÄGˆ±A†®þŠÔYŸÆÌA´ß<ôò¬À±Ì# ÕŒoU¶®ºÕuµƒÆžb¸ž=«ØñS Þ±b†ñÃŒ5©Å#†¬Ça¹i¡+|£ªxÞ¬CÀUjp¶ÏñE|ë¶š`àøfüSP ^æLÜi©ÊôÙŠ Q‡â;xkeUÛG|7HªªïåoV i9‰ä¾Ön˜± Q•-Õy°š8ÊÂÙývúãÌŠA'h•ɰϋk2î)¬ÕT'¼“\_k#ˆ˜å[g–•Eß¿v²”·1³ºŸÔ‘—8ò#Ù"tbŠé¥jÞWX¢ƒJJ‘<ˆ‚ DI&EÉдMz²|ïPÌ|vÉ>¦LÕî§)Ó\Ð-±A‚Uœã{hË+Ìç}2†µNŒY½J¦æ•|ÞïrUISóyr i æ&tˆÖÞݶ Õ²¸[‰Ç]ï)4-×(p(~(úg$Þ iMvñt\­‰9GwC—Nœ£BФ‰ Œ›‡€$ó7CPµÆ¦Ú±‚W‡¶I!:hGtëç–pP˜áO ó¼ˆ0}'è w®AŠc ã\*ÇŒy¼tJ^Kôv~޳§BÂÄ÷é馦|™k³<=¶¬&³Õ+l‘NžuUH´$.º‰âç”,XoÈ]©¦#‰à.™¦Ÿ͆"–TÄ]⊡¾(´úK¡âIúÃLKÓoÈën7­x¶‚"í«¬qež6ßyAñHª‹¨3ôfÞTÏŒ‘ò>ZùÑ>!«ÚÎXRͰÞ-[sºØH-¹‰Ýs&O8 i¯Ï…Ñ[·!)Tk ªQYUŽå®%ó1wØ#Ü4§°Âœãtbx¬=ªíVE¶&õÒ꣈okÀÐp³g ­èòå蜄ž|†2ª/˜—XcöÕïß(—ªXMÌØÕ¹Î2àœ…ÇÛ£‰µÀ—KܾrÕU^.©D¤«²±ß‚¹ìúa¶r:`¼qƒ„ÚMhn©âBF²n”Úü²=½ÖåŽêƒý^ÁµWqŽêê¨ë ų‚bœv'€ªÁfè”5‡ßÉŽ±FλÁľˆLR)««×6Ίòï÷eËîÐ[´s³j9ìvð¸Ú²/6ß/ãü)Ó¥ÿC«ãé`î¬/â(E¶:wJ¥°õª.›ª[“(+h™çÌ@¾ƒ"¥uL‘16&äA¼Dþ]ÊqŸímþ5{3Ñô׎®Ä‚/Öñ=šH³jÝ顳ÄÕ Ö¡ÝÖ}mîWæ/‹ÅŸ ÁÔQfûê6ÑÞ žÆ÷u›÷wÞݺn×É¡ŽŠ±lÖÅzeÁuÇ[õQ¿D½"6Õ-]ÕØfé×HÊa ÿáúø¯”qg ñr°’‚ ù‘–wÒ/ÛH7‰£RÈÒ‚ÉQ]huÑæïÝ Å®9wg‰ªÝº”,ÅœP¢I$Þ§ ‡;ÝÒ>}ÇŸôgVž}Ã)4ÅÚ{­âi+±_š3¹Ÿ '´ÎÙõRén¢ªÅ;o8D*ÂBmÙlö çCÔçrÿk.¯^¨ÞïÕµ³ÿÖGK¾ ¥Mµ¥Ù¸ÃX••¸<Àç˜3›™åÜ#iÐßí­]UÞŠàÀŽg¿¶$G=2=Táhj{ìOÕ,SccV(ÛnÕ-X0§pƒŒWYÒõ}¬=»Écú‰ vÇÞ©B8¡KÔtåPè»§)˜_ÁÉ-æl ß--z¹­” É6 6átÙdœ*x\i]ï¤.½€tÆÈdc˜íÓèkäeŠ£Ó¶/ÑΨaz¿ŠêNÛǰl?]V`Èb.–m€b¾IŒ8CÊþTÄœ¬Ù4wÇ;ÉÃà-‡ý>ôÐ;Ý@W£ý_Ã5«Qµß^|›âXã]IV¬V½M¥5èrpçX¥¢Hb‹Œ>¶¨Ÿ&R’…J+;2’•û€j3\GV»×\AÍ(75b•4r’M©Âˆ ¯¾¤¹ª®b‘IÙ™Ú’šµÓÇCýô«ÚÑ«¸¹o‡¼]V‡W±•V¡Ó'Xªx‚)²nÉÅ&º·Ä›¸¥ò­uaâªT×] >Súzè'Vú5ÖΓµG[5:ÖS`x[|W uÂùV˜“v|BÌ‘ôwO]ñ%–cŸ·Ào”OFÏú7×íwÕ¥™ãÌ1ŒÄÄ™ùçJ¤é'®_ÉíÕ…u–@ì€{IÓDñ¬Y$”ÄЭeÂëê(ZJ¾|Å„‘Ù‰&#Aµ?W5WÖ'kk¾·¹Õ ¤Î¬Yæ… gUf¨ø0 á·ë æï‚<¤DÒz¾ ¢ô+_ö½>ŽhpŽE^Û^2¹‚f HÒ¿¬8"#Zëµ­˜ÃÒª†´5UÒ*¡H6k ˜ìa]`h¥*U¹xÕófá«•O~’¬UiÄK’€¯«<&C;€N•öÇ¡Ò#¶ƒþcãË”€=Y#zjêÕLÑŸÇÙÛ}·ù>Û}â>9w5}_ø†‰YjìBbsð31Î2‘‘žþSM….ç×3>ÿ£ü^Ý:¦ž®µòÙñ#jgjLå¤Ú)íz©ìX{¾;bo¤³=òƒåMº»Ê'Ì…U!!a&dÜ›{F›IÑ—G¨cø–†¤Ý%P¡5¤§šÞßò°˜$E¯ŸÑçÈGä‡tÆîõƒÝaÚ²ÁLa‚XÚ‹:ßc,ÐÜJíørÛÒ¥“K ‡•Í·WåòUÕaþŽÍeè­_ù>à}/tÒ›{{‹¦É¦«ô½¬X.°¥SE°U±7‡ˆ×4¹I5–OAd0|pò)>15ãSªÁŸbMšák5G~ýÍz–I²ª’ÜE€Ù‰7ƒ$Θ–°¸Ã*ëÉtTáo4µŠR™pŒØ ¶Ä^ç=2«8bÅd7Ël6‘¹[Ì÷ñahðïðÒÜ÷a©*­õ š¤šÕ¨´$¤Ÿž˜´Ú'9$ S5«x;ìoÃpæ>“‰b®¸<=ÒlŠ«)<>ýwŽ6k‘'ŒÊ3¶–ç ±ì Ùâ´Bj™ND¨'çÐ\ÅLý¶‘r3ÌQ6uQKz–®O]ÞïB2|þÖ‘®qÅ”^ˆ¯©JÆ÷ÎÚŸÌ÷O¿KF®ëƒÝ½iléÎÙ«ñ°Ñú-^MsÀ¿½¼¥Á¼{ÖôæSs:ÛZ•Ú¬P|Œ¨¦¸Üî”>xH3<ï @루ãU¾§}K]á´¶Iß\yîÐO>CÛ ÄiE*ƒARUÊ))ZЪ^uT¶¸}üþ”oË+UœÖùµjlT=ßû.Þ¨öä&ã<â¶«U Í5ìUGëÕ*zÐ9Çi1e£nÅMè P°‚¯^ÃçG#&ý ß69ÖÝiSZd$n+77€fäA°3¶S§i¾¤&Ò¸ZºÎïb7g#|ùöŒã1¢<¾òª¨ú…w´u‡¿îüwè+rÿvÍ’4;yŠ,çrŠ)îwJñKnPn‚?¤—yÝô~Ž’5f¦•¶­TÒx³Æ²‹fë,’Í–ImÈAþô7ý-` ‚EV¯VòŸ;Rš,Ÿ™óß;?í§ÛßÜ4 â{ ×A W]‰¬› \ó٤ƾÖ!A Š&×ÎäåÝöÁ6i°Ú–ñ¥7ʬˆÝ$«Š+p©DÑ÷tx‹sÓ7a½$k†€ëV †bØÕ8.²`8¦«ãx[E¡®?«˜ÊíÖŰ—ÍÑ :œŒ=“Î O§1Ãñp×4ÔoˆâéÒíLUŽ(íTÖyˆ#ºvý«G‚ä%Ð3ài•©eÞ"ê¦cº•~¬;YþÙ5Ý1Yÿ“ËåÙ ‡.]ðìǬ2¼AÓr~O;b}ãË/†aø^ÙÈ`¦)F‰âípŒe³ M»Ä_„áÜÈú9|Ä¿°{z þ‘M`jå£Cbx~®n]` aøþåT˜5róÊ< K‡Z¶u<»ã§)Èz»ƒIŸ’µMVÊ,“Åœ´-Û×Ç.RIXõ_£pdI϶G=2.ò´ÄuÛ Û_§c Y4nùÎù6¡`ït²üzÜ3hjèóy²ÄO,üóù@ôÀÕ—HbºÝ«˜~¿ºÒ‹Å˜båâÉkZ,p¸Àž½Cnë„t¦po8í¨œCðOå0áÍxî+‹¶`Šu¦1U[6Þ­ú6%æNáuÇ.š—<`’÷9‰6>bâ®0x»ÊFÓõ аJ`‰äAÉÕ£í#K'F½!jn âZÞóXz.kÒkl{Pñ=M`ßYñMpÕEu[ߢÕ>X¯ª¹tës–óŽÁ²ƒˆaðLÔu+RõÇ]ãE¦…c5»ÅJ)-´xéZ5á–lÙÆ† åËf¯ qŽÁ‰ÎD6!âî°WºnGEÖéj9ô§þ}ÀKþôç†-¥è¼ ‘Û­˜Ê+&ñãjY’Õº•+rYEcçåa1€{ìtª©Õëeò¿v€¨Ö“~¼³ÿ/ÄiÕÓ³T€™êWà?ˆÁxÏpÑ}j{6‡»â>Ý¥Åwù½å»r”U—‡·Ii¢oÔøÏ)ÑiÕM5mϯïíðo~’!¸F`‰‘ Ýk\^-ijÀ—jÙL"¡!8¢Ì‘NDƒkÈ`§¿Ñ_òaÃúzÿÄ}{y‰êkv]°GY`:ÿaº§†cÚ»Áb+>cª¸ãÌe4ô‹èüf­jƒ6žšÃÊ€Ÿ'Àûuþˆî:#Æú.ÆM ŠØ9I<'-·J–rBï.Ê)ìæÉÑéqÔAn÷WWáîhí¢å/ÕL"ñ àfMîl,HÓáoåàøn¶âH6M‡UQHɉ°›w‚ƒPÓ‡Éíªºm(ØBµ|ú2’±”"ÆcÙy0{d*¢6+4}u¯*ƒ1|çÛ–Z_ت߈ÚÜmŠÉû=¶ ÆÕ½àöimAÅÍ!µŸON—h6I³„“U5–ã‰XÊûÿ=poúv34Æ/ðW‰¨³æŠC¤w¦ºUp’ʦû„ •ÆYÄZt•g…¸¢ª1h[« ©B*ÔŠÛ¥RõóÓrDG=¢m¦Éj>²b,R¡þ¢M[5(¼YÚ…Vkç².ØfmÀ:n–Ò~±b僊”k‚ùÕM “IpѪj¬óÜý*#;rtô/£ž˜ñ\WÑN½aÚ­< Ê­¨r¢»¤‚¤ïÂú!rÚH6¼Xg¦1é'¤“¯X‹¯'4ê.—•Ó’ŠŸ4iXZÒlI/laÒ¶¾jwM¯€ôAÒ>²à§¬©¿Æq‡Ý2ãúÄïmÀºÃ[£…êàc†ÏÛWøw›E›ÏïâÌx_®,kIãÆÍk–ŒÖUÖóÅ7RA/@\ۻȚy£J> õà ÆèQÁ® ÑÂ/M'i¤²+ý!‡¥Ü“ ‹d$ =öùLêv¯üÛô)ÒÏÈI÷K_&BùJô3Žêæ%¬ØßJ˜ …ëÞ)ƒj³•µ÷ŸôYˆ¿8FÓpõ™ÕÇŒÃçß>pä1 ŸJ1lh°Y‰Åâ8jŠª£¶~|°UÖä¢WA¿hm$ÌÉ=aa¦Ö:­:¶’ )±]yH‹Ù¼ûh뵪+iôh”Á3(ˆça ÊuiÙ§ÃÛ~ÿažÓÛ¤jÉzN^Ù&£1—2bÝ™èâÿCø¿éÐVª*§²ÿotDâ¹ìòIŸù{~Ý¡uöm@ÛÞߪw[¯wòÏž“N`§“|›C´]›­~iWûçĤEá­Ͷ¦tžÂ^3O£y]ë×Ë3ßêAðŸÙ¶›WÐßI¯u7À±¬3Uª,~ΕV)¬’@£éÈD:o£ŸyÓíú$?¤¯¡Kg¬˜'I:ûˆjÖ+¬ú¸é•cv–!è¥$Eôqµ¸ÈÍÍê iægËçú@RéO[õÇÕ¬mTÝ(ô7®š¯ÑÑ·GõsXµgUÝ8é‹Yño8­z×gúÔåeAŠ®\a­0¼ UƒFm2ÿÏIƒ‡Úþb*#MtÕM{á^ÔÑ>#ñíðÑÄTU»’•JlÑõè°ƒqáO,Áέ-¾PoÃRµ*ʵ§$®V0E'‘#¼è[GËR;¯1»mßÏ*W˜€3Ÿ¼Äe6ÅÔ­¶ÅUõÌÂR<€$Ì“5\NcAÕÄMÎîmDH gqÌ=—ÈgÏB˜o&ídÊB†hïÜïE%7[é1½ý/ÄSÙ|†“M_bÎ[ðÈ¢²éÏYTÒUMÕ÷(7ˆrÈIyõ°ê š1C¾®ÆÈKt|ðq{™&r3û3£MNÖÕh×·>d;Ì¡üüsí–CJf¤ÁàŠŠ‰AóÊH-×°Ö ø<ÅÖìí—ŠÂ(®Û¢sX® û"G·–†-ŠV¶i/)[8MÍ•²©OŸÜrËŸ3µ7ƒ¡ <=ËgõðŽkX¤m튱…Ì·#…2HÈÇ2gJ»·cÓUaE¾mJ7›”RH‰ú7µìMùM¦6·,“V´Tpí¸ÃÓU2o·md ]1Û"ü‰‹H/ñÌ' Yj0B Oz ª’;Õ¹Aw?kÅö¤ØZF”‡od.kÛ… æy›Ú3¶slk‡o¨U¼"®VýPþÏou´ˆEëp`Ö`V>áÌò4ó&t8®ÚšNÕq ™9“{Þ>·1ždZ_AÀtÞŠÛ×¶ ç~wûÁ’ &­-øN$­ m~²ë©ù-lÀïç¦lÔýbaK§Ôª¥TlH®ž|ö€ï˜‘êÎb6§UÕŒQÃÚÅ[ºpÊ£CõXnUt“hóÿÕ´W1uÃÌq¼à­_Åu”MÚGrÙ’[JÞiÐ"ë ô‚åØ&™Ì›ˆ&N \Túº­©jª› ê©$ŒïÉ<4W$‚De1IŒ/ M&ÕÒéeQ¥aÖÄÔó+ Ôn7Æä‹Þâæ'–›#‚c-QO 8rÛ¼ "®°\Q j@vÚ fIF™=¦¼.ª ¥SȦÐmBŠ ¯L"ºâÖlÚǸ‹vè6¬ô ÷Põ§ Çu_a«XãýE1W!$XaíUhà,‚D·âÝ5pñŸ1éÒLNšWÒö+IÖ&ïÎ"c®š­¬x«O5ºa¼UÏÀ¬Šàºâ°ÙzIf;m–š…ˆãHÒóhå*—aR[³Z»åRjŠkÊ·ÙÓ¶¼D3yÏd™¥u–ûÃ1|[ÆQYö(D»dž*®ñ "áJðÿÙÓœþ"ÝÚ4ê¶ÌŽÀƒ±m$ÄÁ»HÏa°µÙM:iª‰ÛýÑðŸZNRâ–µÑÂu÷juá@wÖ$ö Å®IžM·Ä+m^Õ5įc=àÈ$ß‘f4¿aÕTETÖ/þ«f?×·LÕ«úñ¹áTÜì¨ÐÖ+pš«$³¨;(o‚Î8c¶¸› ˆævKVúBÂ×n*ÄO¢„·’á‘…l¯ w<¢÷Œ²‹œ¹ªÃÅâ. R¥8z‰·¥Eón•]½–n´qTðÃ6‚&Ñh¤ð÷x“‚ôµÁYKÑJˆ½P9žñ•ÄfÝΤëF ˆV²8cœU…:Ï‚*áMéij„8?ÑOÙáfG™ƒô…¨ZÙtuª#¯…à-µK^àoR×x£•¼–ñÎ Ž¡Š±âÄpÇnÜáï6nÙ²6þÎ>O¹×M}|Í’xO“±%qG8êNܽ¥Ê¬Ž’¥àFY.ÏqÅbðnô¦ÆzYÅÂ[`/«·§ý–QEÞ é,×ÖWߥq]äfI¸$ 'I˜³4u‰q‚c^±á.kŠ!‹jÞ jãNß²ÃñÌUâÍ›†œ.',žm3—ïÏ”`BCVµóñ¡ýXÁ±Ñ«°|2„÷ Ubª0õÞ¾ÃË´]묌Â&$‡ÆÓµv°UvÏ mÜ0WpóH­'‚_sÊ?L"âã9"Ùƒ¤½+¼2NÓZÎ j<ê©oQæúî]5;Y Dšþ´J*¢Û}jÉÞO¬åµÌˆ˜‹ÞtLJQ£gxšÛµ¶ëSæ·²>f/µ–vœ´ƒt6©=»s튳Ñ&);3á¢)êÿß"ÿ—gឌŠTÕ¢© ýI9Üy| þLbMÚ0rÙTª¥ÊD¬˜óWI|ú.sžYÔ$D‰Aµ|Kc)’dxÅ»Hºt|‡bº\‘h3Œx›˜#Iæî“¡»Zp’–[UU]ZÙ¦KšÕ)H /” …DôF"F“ Uª€²ÔVÕ¤f®°%¾U “˜.¹CfEøÀ $ó奀¨ `ÅZ¹Zµ–~“}Šc +Ã,©+¯¿. Ù™¸¥Ue©YòŠIÐá҉쨲øU$[¬árá\p²àävv¯1 8q¹ØPPyÅ ˜æ ó©ìÚ–d­NêÙ¦´¦‰¤J€e5‡ßy¾ZRpçf…"ƒj,>ɲ;2í"ejyI¦ß¯\íÿ…ñØ`O¶ïªý³Ê¤ÔSžv Çx¹¸‰¶Y0®!UIš6Õµ¡OÇã£9wÄímõç¯GÌ™ÿ9åWg¸èuÃņÓÚ­3Ô§(úY À¶`Ù¡*bj)´½M ÈÞóR=äߺ9hJkØ¢¹Oç{ÿ/qì£p£m“þÆOÍvøÀ½‰#=#Ü>Qaµ]{Äëÿ~߈Î#H¾>¦Þ•¼W­æç-›ígÏf;ïi‚Rx‹ö”ñ„Ú „Ú € È‹ØØ“Ý:“Ê@G¼^ ±Ï+LúG(²±ÝÖ>¾…¢Ü½ú>Š›USµËkb{@«òÊmÛž€Òª” ªcç{ ¾ßn™S£îŒuë¦`o«]à˜¦¸ã/Ãlh³ìAÒÄdÅ‹>!Ë©"‚yM£HnÔ¼oPœŒYÙ+«šÅëœ=Ú;§mH$zkÈiãb'JŽÝ¶Ba;YH&EV¹“=â@'F}»«ÔÝóµ^豟õ±å8Ýj] ›Ã!Sµ_΀A€D@±19èkWÅwýUbDV',Œ=† Ý-Œ1U™!EuW»w{´³’:ݶl#(K®­oi¥¬ù²ŽÝi×TùÞ7áþºe'*Ê•+­ék[¬((¥ •„Fâú$ =öʘ7L+:j¹YâJ²ò2{8šKR’*­eæ$9ÌUœ´Ÿ}òˆv†Ç ^ƒB×~†6£fjbQtÌ!ÀŹâ› Eï"xßég]%vó Uõ «¹H+vjüúûˆ¹ÈÚÚa¼oYq#ˆ¬áÐÃý*âžl”Íä9d$›IÌd4­bx‡Èao+VŠå‹P*£*ú+¸\Œ¸w;“ŸtŽ«ôq¯½)k«GèËVñ zÖœw tá¶€°âµ™ÞÁšø–*ƒ“Ÿkw¯ ’r"2ÐmkÇz8[Õ—º¬Ó\Ð×—8Sö8í:Âéø[l-!‡ªŽ7«‹³Ãµg…¥Ó–øËGŒÞ3~ŃøP )­S]ejp»¡¾YPwéÝ„ ùŠç‘Ù’4¸ah ÑÚw £*ìV¤ŒÐ0GxÏ,Å»t¡ãÎ7ŽkNšýJ)Oc0=A>ïäyiDp¥^ªžߌýŸ”cÄS¡.%*9ôŠh “ó¤rŽÌÄ›‘kDUÕÛúöŸãí:¸«©V×<ö|;û3ä4,¶¥J…#¨rÞˆœˆ¹6íû’…U'½M:ö¨¯gþ©ƒËðï±ÐMªMªõ |LóËÝߤšuSµ³·°Ÿ×ø·o+{ôãJj¡I¦¸PªoŸ‡vdg2t•Ö¢Í[•N²¤S\‚6vNfâ ŽW‹‘q¥—Å—lîµ·‹bT•MÊ©#*ª”…¡kæA¼€Lç¥}ÂÆšê^µ—ZºÕÞ ”Wz²¹XHì.mLÆo*©MªyÑšc¾ŸçÛžB-&ÕÕH%¼¤úŠxHˆøŸx¾„.ª¸’›Ågn®bÞjÀçË.ù‚9èÚ4šj“Q?±;ß©¿‡†„( Øl™Û [£#/d EâMôE;&ÉŸ­í¾¢î“°^Rkæ/LöÎqi$ÇpæeÇ :õ«‰räÇ)ˆˆ9NÍ»dèï”wMª÷´%êe £¨ÊŽpA¹ ÙæÈú|ÏðÎr‹lu»xœÁ¾wœÌq"«±¢ÝÁWŸ 9“" Ägޱ'ÑUjç^YçyµˆŒ¦ÑÊ4¯8¤7€\r¨ÕÿtÒ|ä2Vªª?¶y_¿ì«ü—ËÝØgF–qÕªŽYÈùÜ­L˜íÂAç¡‘TUW}ãÙÒÙ§)«g`ø{ÈøöéÉ«kjÑñÝìÏ¿=Qj–ëUíÊÿGÇ-ª—TýšÞ}ï²úU5P6j£b¿œ>ßÏòË- ¢˜&õ’lr&× ‘r³‘\{€·¢V©Ý ’$‘|¦ó"â"û:£ºß¹/^Ö6 ÉPfsÈò噹´Dh4l·¿<dDØö ¶DåÌ¡Y;¾-Ù¡;[UM^߈Ñú«xwu ¿ö=ù¦ˆZšÃJb¸Ìsk› `vÁ3)ZäRck+‹&Að“ÊG¸–ü3~© Ô`d-™$`žDõ@µç=©M¥öòó}™sû¾ýìíH¬øÅ¼cGSú” œ…¦MÉì>îök"£#‘Iª`MùÆÖVÎÚ!g[TaïªÊ7DLîg?»8§\B)¤¥NQÞÑ»S©½ÝBª¦7ííöe}QBÝÕU1Wøqs0Mä‚iËœÕÛ—|S[Òö¹*A2"AžÉ9ZÃF©\ö{<³ç?v@hºjDS^ò…vÌîsÌ{vÿyÎö÷èn6¦s¢ ˆ3pdÄOÝŸ.ö¨ú¿`ÑáÏùŽŠ«fª“¦¬ùWïÏ—‡p©:SqÁNÙ îã«2mùf6fàrÑÄTUev©ë:ô_•_ÄdÏ|÷’8¢¥QUtQEN÷ñëZùMÏ= hµê4º+Vk2(ÝX …Çd 39;8€ClÕX¡ÞóÑ“QT¾hì­+žbAïµÁ‹JùEJL'^Õ{šy™HO¶37˜åAiLR—lÓFòŒ ölÀ6Ïk°d£ÊËg†·T,¢¨¨‹Ä÷É¢›¤rAºü9âLÍòÆgN2*¨¶Ê+†"â¸M%ÕY²!s¿\!•¢ñ6"b4š©5Ôá·Š"³ÝÒŠ5y‡¼ÃÂÕŸü§o½_Òš»j¼3˜œfЪµé­ËÆ›äèHíùÉ‘ÍÄÇ2&Ó¬LÎaîÖl¾Í5eÄ\ç36'°9ºi²¥Î×q6‰›œÏJƒª[©UuÓx>§09 ¦Æ&ðL‘¤ …)ufÞ¼ÿ‹ößò¾‚U‡¨oÜI{½kó™ Ý.ÎÝ*H “Þ »¯IÎv¾‘·Nã?ßhÃ(¥ï­`İ?½«ÈÚt­FÏW³íŽn}ýúsfªhÚ<†ÎþzHSWwð{âÞìû¼têÕô;¯ÙcÏìçìÐ…jëQE>§Z}¦‘ŸxðægGmDzsÙÌÇå¢7]XÛ¾^¯/³íÑίÛÿ‡þÝ]ÏX¦:™Š­ìŠ}ÄwƒÌ,9Ùˆ Voô¿úÏ¿¼èhwS²*’avö#8æ;­¡;^—´gç:ü€¿¶>;ôU=,UHý_â~ùûí§T·4Z­‹äF~?l÷hU S´iúÇùf}üôgyÝöÿ-:ªªwtSMùÓ]{Û+ôó÷{ti?ÑOïùŽŽ8MÏ žÌ‹Å\„ÿå’m";vA¬(¬MQ®µ·[•·«oZî¾p‚?ú¯Ï-I}›‚i4˜±¸<üi7Î& ´wˆ²÷1Èv›A± Á9LÅ´å Љ2> ¦ÓâEï`s™ÐEHÚÛdÐ À™"/amÌŽhª¦¦:õÅWúhšQzªÛä}‘û½º±M(ï©]-ö÷wÃÝnn¿þ×–‘ÜNÏêöùgÿÖÑáùèÿWqé{?±õ¹å³Îf"û:2T¦ª}ß}¯âtI¨S÷F’+×C…h©/9E'­B~f$ ä¬úÀЧ÷>§šîû;L[B*¥N½\þø>Þz/ˆZš¨«xhçññÙÝmßT)³³3»ƒÚ Ï+Ïe»ÌoMiV“€:õzƒ?:TˆœÌ“Ýí_iSg«P僗”:tÍ'>EúXmø]—ÝÓIp`͈=Ĥ¼pá$Rt’Ë6`šMÙ"T;¦¨¥%7›ç²…ЧM;íîÚÛß7ZwY Qú@ÇnBEÀQpéÇEâ‹V“d™6/YUS`ÚAƒr¼CF Î9ÀÖé-€¤ ë3»L7Ój§,È·;ò ³][=|óó³´÷‘ƒÄœ7ß××êǯ«Ý}©?ÒÙª­¨ŠçéÝ ~Î~@ÕUUU7}þîøÏ-"Ÿ[Ýqù8:Þ­óø9~7Ãý]º6ÈøË;_Ô’g²a7#ÂÙösЇ Z·®´êÝŠÓ!:þ>uô…kõªÿ‹òÐgÓ1}ŒÿÌsñ¿†µÃ¶ŒgTLw÷’E‡#4ß!} ¸ÜŸ©ùy{4áuUFA÷U>ûhN³¶R½Š+¯×¸)eÛ—g}ýœQ™§yO^ù~?D~9FíuvcâgNéÚ¦M=O°}¿fŽóÚcË86ý˜Š­Ëèûôjš€¶~>íV[Õ´>–b‹ž¯dlÆf|&^AÑj¦®Ê;§«_â@?ÊtOô¿D Õžî¶]³Ë«Ù1¡ZGTsëþ|òçáîy©õ©!InEŽd‚ e£Äå£4ÕMUmDóöO,ÇÄiÈÙõrúóÛñnZ6¦îEN7Þ¹çΟ3Ý=ùóØ4"ª…GžWŸ¢E™2E0G( çÞyŽB®`Ɖ¯×sêþ}œ¼9ûtFýÞó?ø¿g÷´Š«êý£þÝ ¯1áø:§‡›nûç/oÇã§uU6}ú1Jçc«Eç볫GÛÝ£´§Ãoëá¤,¥® ™Q­q–ù&“5ŽÐ@][gx¥)ÆÇ×ïøË¾ÃNùuc»³ìÑ Ñ³_¯×Ÿ«”ÀXvÿ-3‡Fš¡Ñ–²j¶»c:ã®ïõSYð|3Õ,5¾áúÄé*¡ÃëÔá…ñd†lžGéÙöœ6º©Ò²Û´¼Î÷ÌТûÝÒVþàzP¼ü^<)WPsC¯½SÍ[´ó¹“FÕ L’e©ªº1)®ƒ;ºê0HBåDrî33aUJ¯)%O{™æ¦åLIµ„H‹H‰Q µ©VåJÝ©ç[T¢e%Vkn~yDÅ¢l`é$©:&áõ._«Rª-BAdƒ¡Â% Èâ£Ó!œ7µÄÓa½T¨šµW”(fUVOtD‰ÈœôM(¨·§W>o{4NP"‡+‘r|c@ÕX±D3ç³<»Îv‘0dççŽ*F W˜ÊÄf?jgj<4YÛº¶ÌåýŸ^óùe .s§j&O¿«ñ:vmI·‡/æ{t“Óš#«_ŒxñíqÅUÔ‡ïÐ:þ"ŽÌ³îöèÑ_èÕGˆÚð’xs쾈_ÖÄö~¹‰ýÿˆŸn…Ó³³³QåëÛŸÇ…íܨ ‰ŽÒj¿`™¦Þ$ÉîŽZ+†Ú+¯—+ϰxDŸn„UI¹$}¾ám’•Iš9+žñ|_N½'…¢«ìÏìçµ{Ç©Ùöp)wÖ™½æ{9Eâ,`DÑÝ­ªz´gqãìáã{i‘:BwÑeOµuŸE¸>¹µJLÕ5²Ž’êÛõÖé>†æn[Vÿ«­ðò×Rž/VΩ1y/YbLãÝŠ©9‰¿òÈèÞåÕ,ò7®;Àˆ ±xýO µ³NÔHþ;cGoPä6¶·F›G;öü{4ïhlõ¾Ÿò˳.z5Ä'UUúþßë_ñÑʶ~ãøèë”iÙØAñ‹9\s¼ ÁÐ> ~ßÙÿvŽèÕ5U¿úÙÉÚ;ÓBÑõoþîþøŸ·D"ŒMt›äc*Gpç9žÎZ4Û«U«õvý†©Ï?ç§|=5SÕ«þûI«ñÑúj4Uµþqñß7夦'ŠQ‰;F¤ÑE„’LvÔÍ……‰3–Y‚&#FUÙšgö¢r垆}áü4Uj; [#û½ÚžÕUM¤Ûœœû\Ÿ`ÎPD@®©”ê0;¬gÞmÛ1?Žc˜¾:õ¶!Œ¿S|–…àÔ:Q$RU,/ÃàøSY·mv¸kfm©ŒÁšNáÕl k;`ÛB¿4½Kz`ÑÃ,ù ΗeõWñK%5M,nk6vº\äÂÛó™Ä;À:W«]4„(óT‚{fF]œ£¾yi0ˆ*Ó_*èÙ'õF|-îÌDé«Ê•4úóãxû²¸ïÒ1j’®Ê-B?;·^ë{p?w—ò«8Sj£µ^óìÎ øöiÙª¬¼>Ù .±#´š„÷Óod÷ËAèÈøþI]×u>ïå ÿµV^ËýÐ-ƒ§?ºÿýZ=¢)ëSÕ¯ìøˆñðîç:<Ü4@K„»ã$Ûë÷ˆæ9"tIv ©Û?¼=ùhFœ«ghÓÛñùû´ŠýoØÈÌ,ýú:‹®"®Â-È‹‰‹Gf\|µNÕgïíä~ÿhö肹ânNYš¿Šn}n_lòѾWo÷ÌvÉú7üô_žÌõæsü"gâf4wkjó<²Œôwz;èåËþãð2ѯãÛû#NhFƒèTšf‘ü‡á£æ¡ëvÿ¯~‹Ù£‡‰üƉªºÝÕ;$MTŸx´ÎÔÈ'Aé5SNGcâ9ø}úšT§#Ô¾Ø?ý‡ÛÙ–·§j¢v/ótwwóøƒO·Of­¥ÝpSËuø÷‘Ÿ†ŠQmškª“¶·f÷•ã³·¶t}W8©j–ĺ˜rj§þ­]ÌåQÏ‘#+öu«5>;&ŸðÉRŠïÝß?‡+ç¤b˜€«Ÿ¾«Ìø ½ó–‰©I§hä<}½¹F‚ñcêxü´,­Qµ aüÇ¿-mÕRó_«ãô´‘z»U9Y‹eY³YUTlÍW\R©%þëðíø®cºtj}ktwòÑP,`…¸*µp…î9ɳé¿R;O•,‚7]­m) ’j`¾„eªG§J}4Nd j·¡¬À ê•28SA§#y&‹?. ,ŒdÛ–c9£Nã%—!Bt ˜ ¦˜ƒ´õ?*bhn«ý–ŒôRË ©ù€èÜáÚ†(,rYPäÊÏf=ŒcCRÊOSI$<ÁSOZ¨ÀÅëÚ& zP²6ˆºÕ$&+Òh­NACÍ1äq n½©NG èR‚eD ˜˜ziñ§"h!£N´¹.vî%ºt]häXLR‰¤ÔÉAÚ„^«’{M1îÿ¦¦ ‘­ÚšØvöëNç ö±T§Æ“BD!BiRÉA Cq¦´šw°ö5¡í/a-bŸ} i(*z‹Ð™‘¸Ú“PR%Š=À~4âQŸRôxîkA:oZO&oƒ1Ž÷r#4Ofœ6SÊ”—=ÍMm¦•º¯Q+$Ú] ™HP'dµK6Kˆ#l~âéÞ6¤ŒDâPÕ$ÅÜ…í³B.Ÿi¯$±›UPt¤¸)@ÉcÚPH‚£½!Ì“àæ3Ì_Hš'D“v =¨GÔ:TZÉ)hÚ›&Rr£åïó)éøÕ¦dƸ¶´º #ü©",dúh)° -Aó Pà m uíM J*õ½Rr& @I<äh'TàP7åB:ÒAzÕ)!ˆµŒ~öêvƒõ5 !íéYÉP3OïªDŽr A~´—#j¥V’f6Fâ÷£‚í*š—(Ñ4×$'u4›!dN{^ö¢0n¹Ks­6‰âéjL¡jRu vùPWì´×"aõ:Ñ(@vüéq>çCcB-ôïM ;oSRÐt h´äqÀn+Ö‡ìlní¯ZR(CÛhZNG* ™ ƒoc¯Æ”9&¡¤•I“B.‚ÿ_(nd{qÜâ }RÎHmpɇ^š§çS¥gú 8qÞÒŠµ. ³i=ŒcƒX Üj•ŒæT¶_Äo¸Ð·¨èM²Î‹ŠÅ‹Üaš?qC‘€w€üµ©M'êS¬¤EÍ~ÌDÂçIõ+KC@ùÞº-Úª¢dâÖîîå(ýÎBx \âBjµ‹ƒº¶ô+>2ÐNõ¥S€î‡—b¦©JtczúÒLr“w4 [¥TÂ)!…€ÛAS˜Q’°„>•IBÈÀvH×€k´(zŽÕ-J4¥»lœ'£&>ä‘7v´#B•AéUÛ '’o~û;B^ËÐŒü>&“3€9¨€VçÓЭ@ÓÚ„M—:ôªªúÀIWZ‘© ñªKb^‡¥ •ª>7¨ÁÕ i‰Šª%5¸tïTвõ2Sö± 7µÄjpüTœ¦Cq˜àÐë¸^²¾ÞÕ'F­.î{ÊüG”ñL–bò°˜à»úšÒáb¡ž­ëb”m¿Ç¶§M?sŸ[ÒºNÀK”¯D§"H@…K€’Y(¥ŽDD½r‚z_ ŸQÁ«Òݨ– µ ¸7¢ÑÊ,ÏA``RÜ}j`,ò(à$Ø(î”< صû"…¸¦ÒJ •ÜàžZÁ t{ÜŸEÍ[P±ÃçвN;blA»nçu$Q±Šµ\õ.6놄T×ük)û}ʯ,t8²îÜÀB­‡P”›ôƒGâ§™ãc7Ñ;ÕÖ^L,ãæwž7ö¯?™Ãærñspâ —& ¦ÌøÞÕ&&½7~’Öº©©¾ì¯µ|GÈ‹7ŒsûAÍs|$Ð;öÈìtlîÚTîÆÕ„«)]“­¢Üüÿ£ <$§v§òZU‹3KXØÁã mÝ"†ƒtÔsX^UKÖÕ­ôä à2ÝÉ? ™_¸ÆÉÆ1OþÜñìnö®i*¿­^¸îÊøeÚîŠkþN#Èñs—ú¯§¥izö¸9uÛ»'?‘ ^Â>´ú\•‹m3¥CäÊ–$V¹T\ŽÕrJ_±U̽ʯjÕ¹ÊcK~‚Ð.:ü´®¤e¦öB5ô«Ù*$uê#qFÜÐÔ!¾$d¬ÚQÖA¥ rˆ\‚ÔúCc©¶“ØZ§$1M©±&8´FÕpúÀþú„ä§—q¾§¯z´HõëIŽÝ)¡5‘E`¡ =ª”›T{ N–«Ì…DŒ?©1Ÿð¡†AHr¥é œ_)“ÆNÜŒw#›p5•õ«(õ:unzÚk¡Éü¿™ò©ÿsÌä?&cs$®/q:).$Ÿg£ÇZÔWƒo+˶÷Ýg/ÔÁ÷ÿ:è<ñÄ’TúZœ:Ô¿bJh”&Úm†•A@º ÔG[ê!mQ"ì„’;ÐRlµ3vª_¡ÿ “‚ä8$³xapn¯Ñ*[dJLÐÅʼnñ£‡Ô ‡JRà˜†ŸBì|Bê— Þ”ú’ßRÔ|@|dÝP\÷Ó¥RK“>î„À{‹#‘"d„¤®T ô¬íîÍ•±”(8¼qšÜyÞ]Ü–²Ô¾GÜû}Í~@ðäBÞ+˜™~÷88ºBCA!?Hì/Ö›jgÜ•ô=í¯ÝNÁq±ŒÞ'ÊäãîÛ.cK›!pA¿j¨Šôõy®šj“ö‰3’¾%:Ûi´9íÿ¯¦}~88/ò Ž_Èòü’!$Ù3;(3‚(â{ݸûmmšÐt® ¼Ës“²—ž0‘C”ò~Vy¸áÈO(å¦lÙŒt›½ù¾­®zª•yüM`§‰ÇThÔ´Ò—Ðè¹Oÿã²~Ë'ÑËŒDy m¸›ˆCtìkЪ­hšøgßÉùm[a¯ãü”!ã³3ûl&<”-hþ‘s\»x“m±èž7ÆøÖmŸ/qÝxÃK\P wbºt¯K¯/'™çlÚßeP¿Ïéýœ˜7ŠÈËš\7 ïs!$“µl>5ɶÆ×WþÇ_Ý]J~¿ÉÏäø·<|iþ`Î3#þ ¹#Ü·¶ïÛ §0È!Þ›wí «;Õ(sÉßìîŒ')#›"0€w§­LGm•Œ{_´„ïM—W$r„ÕP ¸‚îew­ú|}*­ÉjÌaÚ4*ƒZ‡Á¬'ò#ÈZ: µ8‚ +oJJx‚2·=h„ÿ \‚õš# s¿Q¸ooSG!HÖ个÷õ¦ÞlŽˆ—0Ü‚ÀØÒu‘Ï# [þbl:Љp% D µƇÀ ÔQ(i_Ò†@4A2/Z§ÔÔÈv€]tD ±‘íc縆€5$ØSBLŒi±2$ÄÊaŠhèåÚµí;\¨4,Š­D¡n×mQn£JXèT°_½TÉ!íQ,b*uü);€Žß•RíhM-SÔ¯˜í è)$cIT¡”ŸRxásŽžºR!¶Ñ¥‹‚OÖZKEœ[Üét¥2M¡¹MZ:ï¸<Î_!äYüŸ,ÆŒ¼¹9dn.jJI ‰;@@ÕéZìòÜ£øûæÓœó?äã±¹IqÛ(ýµpq_Aè+’ÖM4ÍÒJÒkIÊærXïýÖ@d¨ç8¡;œQHìNµ½vÙ¨lå¶Š÷JXO¯Çìs\ž4Pâ¶GJ_+œâø@Dmˆ;–ê§áXÏÐêp– nSÈùœÎ#„Ÿ.SÇâ8» HD-%UÛ5nn‹Vä*Ü$ÞÓès†/p«BëzÑ)œhxlRÙÆÑ?×±¤ªÊ««´çˆC!†a¶F¸‡)íZuö&ØèU”Ü„M•œ3Jñ’¼[×½)Ä–E!kÀsJÿ…ê’#b¿… ’òÆ{Q%"BÁŽÐùÖà±°ôÏò¤²Í\$V‘uuÊ©q¦cžF…uZ`±Èœ,)±ÖÔ¤k(è>4ÅR•–!b‹¯ZLpboU×û ¤7+D€“JCKRÈlh„ŸJM`^D¤mé§j$=„›…WA@ð Òˆ)d[oÞ¤Ju yè9¬&À*Rí`@Vý»S”$Mw@¥j[sIdXÄÞ{)þtÕeI“¼4½M\n> ÖmÖåÅ/ð¬ßK˜ƒc¡cr†”ÜšïYW€rޝćÍaòP²a‰#&ÊÝÑ¿Û;ƒ\Ó¨$^µ«Sò3nÕàÞç¹èó9<žOhÁŽi¤–¤ZŠËر‘Ÿ>k¾§+ÜA$ÚµüäÏñUp(ù.â³ÐÛ›…*®›3¶ª¿©é%Üóõ^ë\Ö–äíU„Tsœ´®ÇT‡2G0^Ä¡¸ùÚ‹W¹-±ï»‚Ý:Ðð²ɧˆàUaÖMäÓŒ—£…ƒpþ¢VGªM:'Äì³Ã(ÌÆ…þ IF‹ÖŸs_© “ÉÛxß/ãŲ|k˜ãYÿ%•‘N/—¼É q0´c¶0Û#йÎTJº»,B6µèõÙÙñoèã¹ìQ‹#ᣘQN‰ñ•me'ž¬ÚžN;0ƒþØ â‰LÕL Ž(âcÛ3}©w°=G¸:4 =o[ÕEsìÂ×néW>¾Ä2ÉD&†F3qxW5wÓÚã^Ö§m‰×QzõºÛ/2U¬ËÛQêÊ}¥ÞŸÂ°²íxà»ZÓ<•ó1dcÝ =©½¦ÉZ4þ…RêÙ]L¹™íJCEïjuC”m •‚9Âç&©¥v~¥‘ 0X'»¤xXb7­Ã·aÖ••ž éµ;c0Q{¤{œ÷¸¹Î¹&äÕÖo#„¢iM,û‘›'¥&9”HØ:šHB¨©Õ)¤ŸÂ¤¦ò kÚ¨Iƒ](k8”zR*id"tøëNBÕE‚¥ôì(ã€ÇQ[AzA" Š*@6Eÿ*¤Á§#†©64ð8"÷£¨b‚K•jBHš8É7ÓQO¹zËø˜êE—¸¬Û’Mˆ0äsUGÊ¡2 ,LW´5ú÷ ü(íÄô&s‹qä` Œ_ó¬Ü‰,ñY¶"ÄéëMÝp‹ío–I“3ÜÓ ësRTƒ«f¡ãN_·í0«þ©©è•7¾dšÒÉ4ßÀÇðÙA¨èœ I»k9qîkØÓ\~COºÖ“²÷õ¢·AjàÒÅàN\Ķ&—¾W[j/åZRÒŒ¬¡çƒ–Ìš ù£¼ú '¨DíQ™É¥hªØ‰.(4*[Qܬ€µÍ*Š4 ¦ÕsŒ“ 9.q»žàÁpºÒO"jÐÅŠd“Ù øŸÆ¦ù®KI'KÜl9Y¹qpµ]$Œs\@¹)jKcˆ‚ÿu¤g'‹bmýµip+¸‡¥TqVpÙ—&AŒXé×]*ªñ“6—C?/%ÙMx$ƒßUNõ½1²U3²2æ›þ2?¡x•Á«õÈ´8¯`J|kW³ìíJÈ-_t¾" Ü–Ng!ìŒ×ovÖ.D¶¥,Ù]þ‡O[V[nꛉŒž&­{6-mö·ÅºOÿ_?_©W”ûsä¼_'“ÇóRceã’Ù {~¦¸^éЂ"Ä\Vzü­wJÕs<³C¤«r°Gƒr“Dfld± ½ÎB€7½U·Õ8º§NT‡•ñsâ|d\‡;þß!–¼gö£Ä 2§ôµßûlÕÿ«ôëž½îÛxëÒ_EêuÒº«KþDûøªág«ùtHä%|Ò8Êò^ç¸ë­w9‰g›Zö¨K‚ŽãåN¹B|ºÎ¿JIÃŽ£l5½ CHéM1´ ·Êp"«J}·ÙhAmO…8À £­Òˆ›³Ûvåh/±zŠ%„ ±°¦¥ ‡½B¢¤T@ä"O@Øßò¤‚•AÀJß Mh„ š÷ ðÛ~kQ2‘‘—"aDÀãÔÐÅÇܵD›8Øíh°íd«F2já4¹Àm;N  ˺Fêߦpßjü—'Ç1üü\ãÊ»80ûOl ’š5Å t‹'’öëÙU[FR—-Áåq2œiqÃZðÇpUOFïµÁŸW|ôâÑò9Eù~ãb-)±ŠK“é±:YSf¹m¾Ÿ¹½õÝ%Ûë×Ðìø¿Áù8ìŠ(Øw›åÒ×$šæ¶Ô¹Pt×M¬ùÉÛIâüüv6>œìg¶NÖìBû¥êt])_u]}þ>§JÔÓž=Iøá—ßÚɉF´i ý$Ÿ€]k–û*¡«WÇ»}±ÁéÞ‰ö¯í·ËdsÞ5‘æçbº &ä‡$2ÉpQXÙñ9Oy=¿ë×G -+¢sÓ·<'õ<[šð|©xÇlw7Ý{Œl`•!£ñ½v«¾Î¾·kt<לñ¬ÈˆdÑ9¥æÍxºé×JÑìS&OKR™ÊdqRcI²ì?RP)+’«œ™‹}Ú:Ø×DâdÎɦiñ˜ŠÜIúJ†_±Ca¥:>¦;+j5øè‹œFåE%‚V|°iª£K ËÈÕ“rqšàé±\H7RÓµ ©YÊ“«^+ŸB¿!)ÌÈ›0ÆÈ[+ËÛ m `Sfµ½­•TœÛ//üÿ Ð h±²…v%*N;B‚”sXFÀïÒ{¦”øDa¸!–Xñà{6´îÿÜÛqß^õ¤¶ ,×v ¹çl€‡'¸€3_«ük)ެ&T`%ºêA§™5mDHæ¼´pzÚ‡J7ŠâC“œÂâZ•?sÙäêÖ¹gÞ¿õ³íÆ7ÝüÎ+Ǽ†6äK‹±¸þ@±®|Xñ©ö&ntw&3« ¿IAìøžz5²ß§óóö>gW—äùû{»V\óÇK/ú¾žç¯}ëÿ¨?ößÅ¢çü~´ÒÀá™\^Gä”ß2& c‰6éÒ‡vài.PÚ´¤•îëM$ÿ ¦¤8 X%$†GÖ˜…DQZ†+M¢PàMO})ÃAÑÆ×åSaˆ€ÒŸ(Eü$Ç7NéL¥@æ´ƒý¯HH–6© ¡¤Ä²ä»+ý+ëI!·®.òÐ56¡µÔ˜guöÛíÏ’ýÊò¼ ðì3ŸËr’{8xÛƒ79’\@¤ž•0Û„*뵜Ìj¹ò¼ïòhá~w4˜ùXÌ”9žôN,sDPv¸téYöY¸6²Z§» '°Ãä¼÷5àÎñ\üVãðØâƒÈˆºòh€‰.O_ZÃmééÚúg§«fëkípÒÌqò8¶x›sòãÉÍÉ‘ð½Ï(‡h½ÃK•­yûlùFšëÒÜã, ?#“ &.‹½ÌÛ¡²]ÀiZk¥\wZ$›6“í¬ü|I­šîÅÂ=ÙŒ´Ë6T`ã¨`Üë‡ZæÙz©írŽÕY—ЛŽo'ô»Ý"ý 1¨µìk‘n²á)5ZSäì¸Þ+3;ùymc}¢»±÷çÚQ­kI²èãUùݬ»­ôëþ=κxôK —p|o˜å¸Gãr\{¿aŽ<œ‹Ú LÎR ‰Ð”ú{ÕøÞj²üwQ˜—ê̼üÛ'ù(øôô\’øÇCÇó<3â“)_ÇtÍ2À äs•ÃøW·âéQze¬AånÛë|+9“Ë|ÏÀ ²åÜ~‚à÷¹AyhQ \[«Û±ËÁ–©tLñO(áð°¢pÙô0¾BGìÜ#­Zµ{G-»žÆÎ$áÈ…ÜNÆŸÑ îåÁ²xç¶ŠÞ¤úöJÓƒÛÏ$°G5µS‚lÌlœ—à fýÛE‚.QVÔ1c·\Œ§9ˆzÿWo…)$˜‘³çñiK4$ŽæL!‹ÿT#ÙäÿI=ûT^ñ_b´iï·jçß©4\.L®Iæ8p6 A‚)+¦¾`þÞ¥ÜWäà屆Ç{Ià¿g.$ûOþ§}ôá~ÑÏ+Ê:Y¹ÂçqøR?k _¬ó%ÃQvê×JßÂó*ôþ´—w9p—OcÊ­iâïÛ²[P«Z*¤ŸsûŸw±ôÝûyÃ}Æñ¹8LïÛàC2;î‘bÞˆ“ék¿Õý=~•¯KÈ·ãjn{”#åßÈ·ãÕXÊs3ÃâÞ‰ôgå·Ýܸ¿ùO!ûwcOÎcXIëÓÔb.+ÅÑge,÷¶ëK6äó—o#Jé”a_RƒåIK-Œp$¨µ[‘¤÷©‘«ÐÚ¯Z’£ ô½9B:zP˜„½ê…#¥ȇð¦œ2c a¿…K*H[tô¤‚BàkUÏ"ùT§Q­&ƒ¬/KÒjŸ[J²=‚÷·j†R$cnºŠbRòY†1«‡À €y4qcWE»šYt6qqËœ._g$arz¯ÛäòæÈæq2ã—ŒHÝï{e¸†Ë—]B Ó­;²[ºI´òvð¶þIÍñ<´|hÈÇÃ~ì®Yò5²o™¤ÿQÜáôêšë­tvÞee/û¯_|;ÙËè˼¯7/ã¹.ܘÇ“,Rä8ÄÑ"FwÙö .©­x;]í^ÖñÉïéºSZVG¹Årÿ3ãÇãVc*ºWÆÒÔ#ý#OBt®}Ž’£Ó%U[2^àøLžW&G‰ÞZÔl0þ§m詬éGfàÝì„“G¤øÇÚŽk•ÉËšÑkj8Щõ¬—‰{8ýºÝDºÑãÿj°¸Ù£ÂÌÂ÷rGÄÔpjŽàšë¯‡ZÝRÉÏT/ÈíVêñÑö'„ácý1b±‘ %è ‚Š+­ø´O…uÛe×%ÜÏá²°äãg„¾ |.uˆÔ8hýªvjÓ0×DZuÛº%8øêy÷–q9¾3ÀµÜtRÆÃ#ŒÑ´î%ÛŽà6ý$é¥rþ]ÚÙ1nªÿ$íÛ«NÚýÑ)eüuN•_µ#å^8þW‘.œìÆÞZ2ˆÜ$êÚ#¥wxÞ;Ùy³Ç©ây>B×H\®‡Éñëš»¶(.jÓq%¼r^BÛ±ME”¤YƒèO²~ ?Þ¾‹ñ(qX9™\"‹wèȇF¶ÿ#4cÿ¨}.¸½_ Æñé¦Ö¿ûK>gròüŸ"«[J%¹ž?ÏóÏ©èŸö+þžs_b°qyîIÑO­oí hÜÓ+B¹Ó-¶´¢7ú ®?ÅHûTó/øG¹dõÎËY¶áU% _[^çÉÎæ9nG*Yg|“͸Ë+йäÿ—áj󩦩% ’Ü»!ò[ò:ÎÎÄ‚HCcw^ÛRõ­uUãÐÏ¿^§4¬IÅrÌœ¤qAÈ;{ñ›íâe:îl`Ú'KGôÿ§áZkÖ“mu5¶Õ±}Ë+‡ý?èÊ’WÂçZâ×õ­ZèsQw)EWÈ ‚j™-(Um~•£pÔ^ÊÂéwXƒa?Q¨¢1$;Å¢4¨5ÓçGh›ÄÿÝJÀº~tà'"[ÒÊ5ïTº¥>¢cšÇ¹Á>¥H]RÕ\’ÔÕ,´–PZŠPRàõªlJmùÔÈ QD²¡±º% 2fG`äøPøZþ>È858üY2$h`ýZ ͤ+<äôïñxÜcEþóœõPÖ¦„'~µUí\òrY·ÁïÞ)ÅñÜ\ÉŸµÑÅ·kCäxz".µ~G•]:ÔC³_B¼/Û¶ýÓØ²þ=Í7ùî_ Þ¹E¸ÄûÏk$ÿmÎØ‹µ¶­xÚ¼‹­n³ƒè·Ò¶i$y3å1òÙ³3-ïöö—BXÝÅÎEh ¸ î*å½›sÑa¼/Çàå¹Ì}ŘÒ9¦@ÂNÖˆÕ§Ou«8L‹íUM,Áõ¯ˆø§Ç–å`âcâEŠƒ$“ɻBnJŽŸ} ©J>êÕU.m&Ê,ݧ¡è^=L¤‡ny #ƒƒJ(êMx»<ŠÚÎ^}x=íZ-=#Æx(Ë}ˆbMÄ9n@§¢½„iµú¼ŽOŠÁ‡Š%ž0»Br†ºíZ®NJÞσÏù¸¢ƒ*F0˜ØUˆâ5èS^.Ú'xX=ZYög'š}ßòLnW‹ ‘¾Ü"ÊA1 n@¹Z°ó¼ªì¢Uœ.}½>FÞ.›Ò;&cßÔðÏ3™îâããà”3&ÿûeÍÙîHJ»k*AW¥_rUnçÿ¦y{ök×6J[ˆö ŽJn?:?Õ36m§Zpá±÷®è#Ž Û’„þ‘üÖ­{‘k)Ą̀Ÿ6QÔ*lšeë²±Ttµf™ªCT‚ºS‘@K”%$Êl ,HT-é®ùÓJhm)ÕL€mS–Pä¿zp…#À¤õ²Q <Àí›È7Ñ/j™ÁN£ §Æ˜‡€Z—±&Øðjq’Á  äF$iÔkY_Œª¯ ¼è1æÈL ­7Ý>=+:ÏR¯j©:ãwåcº%t¥Àµ¡»¯`uZvã&Kžoàq‰Ÿ/!—ñ§ÆatÍk6sõm؈ôJ«[î˜ö"šñÛ'nçøw’ñ™¾A™7 ™‡ˆÁÇbÈ‹?2+ÜQ¾ÓKcv¥y:´þNûÞùŸ·û>‡vÝzÕiJôû²y?;̽ï’áÛUHþKXv’š‰9ì £.S’×É”FCIi ÿuiJ® {Qîj&ã¡Ë‡7—œ†¸µ¡¬néZ,ÚâÕÑ«e(æÌÏñÞëíYgÒXÙLƒ–ƒ‹€ x‹Ù÷'Ýíî8‹}=GM+O/ÈNýµ¯Ûˆ—üú`츽¨¸Õ(ºï³¥rÎMZyÂ<—œäÜ’Èž=Ç!‘Î:5~¦‚ ¬·¯:´†óŸŒ׺„ú÷[Ìq²Œ1N?kˆÒÂëlwúA_Ò4¯+ÏØ¶YU?µ#·CµjìÿäÏœü§Êçɑ؜s‰Ç‹ècýHz’·§¡5…Áäy6­¹äó.a¹OÈIå?î)hÓJéi¦sQMe"nƹ~gÜÈÂÆ|â:Yåk~˜bj))nºÖÕ×kÏj˜RÌ­zÕMº¼|ÍÎ;OÆ’\yË&”÷.ÝÁÝ:ŠîÓ©Ó)æ>æïò•þØÄÿN[ÉùÝ®,…@“cŸ,„‡A !‡²VÜqÔçPÎ$Ì3óÀݱ±q¿âꨣ$ÝôG¥øaÇwŽòÑ™!àDçâJÛÈë{v+qõ ÍUµ}Gƒ²ŸŽËÚÛû>_Î×ÉV§.Ëýú® Ëø¼ˆyŒ‰r¡dÛ\#ˆmeÆ£ã­yWwåÌ/àö<7I}Þï,禀º0ÿr6~‡íÚJÞâ¹áDZÕkqëðp™“ l­sZ>•`þ),…¬ã ÞÁàdc7íé þ4ø0nrÎ×ÇxÌn)ÌøM2JÐè"¹þÌãý_ ÙÖív¼{õÕ­UìO<$¿vί˜Éñü˜±_ÃÆsyŒ¸üì©%io¸X‰'ǧj[)LF~?“µìW¬Z]—_Žž†/‡²ÛÅfˆ\ãÎbln?ÒâA „¨tV²¯×±>ÄÚPkyÂÃ,äÞïùhœ²ÊÍ’ÄX€±®{\Irkù×U¼ÇöÚ{§Ù£—ò«ýË2½Ï4æxx22÷Â" ô´kÓú¾&±VµžQ6J«í9GýºÈ[ô9KTZÚükEDÌ»Ú9œ¬WÀ÷{a@*ö÷¨áJ:é— ¡Ÿ8™ÈàX–cÐv>•›”v%V£“6GÈÒBÙ})ò…¤#è‡J:”–,^ÁQjYS“WÉèLÚšlH•“JX ¾žYjF6” } ?*RÌ ‹ó¡°‚ì@55 mÁ½ÄaÌßèa¾¨H¡D˜^ØÁé\ b›‰ŽV>-¾é•À«Å•¤€+-Š®˜;–Å<Çóðÿ¾äà2çC1W:G I_Szó®ì’¯©J®ïÈÜœ§7ÏJ÷:ÎÆµCZC@ôÖ¡ZÐ[I³˜ÉädšW€âÝÃkÈ?ÓÔ|(Tœ²Ý£‚X9ÛX­Œoßî~ãêÜæbˆÕ5­~ÕVŽuܯ'¯ý¾äÄíçbtnŸÑœXd²5ÎßKµ×ñ¯:×ì}ë•Äž¯ ª>è}?‡Äóøþ+Äyo#Ä;®x¸ç8™½Öîl›\ÕÙuÖëjèÝK½u½«ý\ûzžšS¹©éôýx=[ļ£ŽÆ–>6l†å’Ö½ZÔ%Ò’âKPGáQMÔ×·²{¿N¯’ž»l×Þ—lcŸC£äy,L-¯ÇÊ cÜ ý-·Ä[níª•l6c®Ö¶rs^AæØ¸O# ƒés£p!× {V;|ªkÃçÛ’é®÷ö^ç›ùg—cdEûS;=¸}ÉÉßq¸ ¸®MòEg ¬òlíø¦Édð¿1òœ†、n'EÈ4©zõW ,óm·eŸqä¼×4ÿqÀG²G~¶ ú²¨µëUw0°bµ«,˜Ø899ùVBç*î˜Ù§ækMZí(/z¤åô:¼ üŽ –™í0b#Ük€°Äë^®•e^px[·.‹'åjý ¹A¢„A[»däTžN?’—(ÄŸU_Š,Iµ—Bn?‰£;ÚTJ¢/rRõj^ ¬’= üÁþ2ì¬~CK,gbÊC+ckšs†¹Ìr¹m©»õoÙ¯¹rŸ'>ºëµªíY^œ3ŒåŸ™Ì<äM(.·a'é »z×#·vY­-Úðe‡ÌØŸ ØÑ½>®¨ÓÓ╲žØfvi^WEÁÓø§û©‘ч%Üz§ 4õ󎼙lkªù………7ÅÏŽ#dðem>ËØÓ"ÂíÍ~â74è~¯… ©g•þ¥½›;{T%oëøÉšse…ì/w¼ç«¥{ƒÚbkv´^ê ¢Y+‚ÛŸ쮪ªñŸC 8$Ä8‡ßl›Àéò¥]¸\”è•fÀäùžC6wær¹–r„/pjnq¹εжZö›dÁ¤“÷3ÙËå{cq%®ÕÆí$М£:Ö¢ï%ÖƒPÉcQÆhÔ5Ír'ê¸í¥m]m§dçÔ‹^/ÚÖ <ïfG=¬ÜJu¬•šUÃ9>G‚…¨NŸÊ¶­ÓY'¶Ðæ3q=· ºêÔ5“¢¶Œ36o¨#¬š;ùR‚«ö•\ TvïO¹AªàŒ‹Ô±@d–Yw¼ 5ªUè=(‚¤`ËJ ôéHÚª@IþRÂo‡¥Äs­©äCÚ›QÉ(‘^—éS#dÍòX6æœH»Òö.<±Ùá õþên¯‚¿"` #­K…¡¡5-–aX\Hµ‘o~‡¥êiqqÆéǺ hýI¯Éj$,¥3¨â8ég™ZÇ^zèµ6m³:¤—'²ý¿ðžgÇŸ*݉°çòc½œv‡ ¹ÈGUNÕͶîªzzÆïÆü¶ÇOs¢û¯åXù܆7Ç¡ã¸X†,3Eg¾öÙÏÜÐ7BíE®%³½÷rŸ©éùu­l¨£íQŒ||úžuœxìœ ¢ït屑¿hiŒ5®ÿp¼ÙߤÙ*ì¬ì£ƒ’޵«î™ÄrrómØ $8ÓZ¥æ³—¸®M°dÅ™ÈEû¡ŽZÖãÈç½?¡ZAŽÕ)ÃNŒ5¡xo“aaÈ2s"Øÿvu/kv•:Ö¹¯U3èmKÚap}UöËî÷äÜ/ÿóV~ÿƒdn‘¼bÈÙ}í…Œ{_ƒ˜Ö *~ºu%¹­{+5^ŸÏ²G¥¯Ìzªóž“ŸÓÞLÌÿ2gŽù拇Cƒ.;‡ Ód½†í.&Usƒ…ÈÕæy%µoî×ÊK‡ñô=~~­ú¢Îo r~ôs¼c_6G—“/ÉÉak_w¥² €ÔB®%}´¾W.añô6Š^¸|bW>Ù9o+û«Ér0‰xÜŒ,<§ØHÇG ¡-qAó·Öö˯jlΛR‡0yŸ?åy¡¯{Kä'éÚ¤¸~ƒJªhŽ89öí­’œþܧ4`›"vãã9à:bw9€vZéz] á{kL›‡ÇàíŸ÷žãØçÊæÍ6 l•ׯWYàãݾ8Y9Ï!ó¬\fI‹‚æ†0‘ô”$Ü ®”ºt9&snO=ç|Ç/4ù쎵«ZÕ“ sƒäºc½î%u$Þ¶F/œ’¶FC¸Ù;U¨ˆ2³nÆ’ZZõ4•1êÓ‡Á6Ê÷:^3;'Fgb¶\g2HæµícÚàæ®Ž ÖÊW:Œ2°høÿ‘·€å ÊÊÄ‹‘†µãuöŸ°î rv÷ ¥txÛU-œÉ;“p×)®œ¯ÐŸ•Ï>UÈr^U>$X?»ïØQ²h‹Ü»[?KB£ ÖÉÞ½ßMö/ÈݹsƘ< Óv+…‘ÍëW§Rp/"·ÁÇrØÛß ÁOƲÙWW^­ŠÕî9¼œf+š.A×AøT2ŒùãØÍ¤Üh•Kˆ4­¤ªA*áIph¤; aun·íN4þ4 }× pWBE6(‘iM €Z œ†žÇ0_ÆŽ¢x%o¢t¤Ø‹¸‘Ç<›œ°AðJ"ÍɯÆä–™X6›O¡þu¿n0y÷ÛY†SÉŸsƒ€Üп.õ_3jl«ã‚‘í;HøV0újÝdMä{Rˆ´šœl’í ³‰³M$§æU¯ƒ½ðãó9\vs’<8~SãoÔƒNú›WWãÖûnáu~‡™äyW¦¶è¥ô\OÈôh¹¼K‘à¸YãŸåý¶gDÖÒØ]îFŽ7ßu+VëG+ühÛ³µ~O¶WDZÕñŸw¼ƒ…ð|ï·Ü#™ ˽’ó8-$¹¨ wc¦•âï¯zí\u^çÐø>mµQ¬zOX8?ÜäKŽ’”ÒA@/D®/Ç„lö)29Wù$dŽ Ð!ÚÚ4¥WlqÁ½“Ê1r7.ÒQ5ïzÑÖum#‘>2áê†ãçQÚi30hGXÑ.8ØZl©Öý´µ;Õ4g®ÖVƒwˆóžCŠ”daLXí¥¤BŽ­)Ò¢!àÓ¹CGSÅ}Ûä°&9‘¹¾èmÙ0÷#qè¢Öô¥Wz¹FËepš˜:Ïû½Çrðbóئ=¯ýîkd%!^ÐØ’â-i]½ÖKeeu-¤ªÕOö= ˾æø_7ÃŽ4–BÆŒ~Aò>f̬V´1Ä´n?JŠö<¾6ÍV¤qš¾¿OØóußÉ¥Õ§ }˧DZã^Qæ¼|ÛN,Oý¬Mö™,¦îc,Ñô Q^%ÕZЬ¯uÖ[™8·ùY!ÒcÞ­[F·øT­i™~K(RsÜ·•äe4Fé5Q;¯¥k«cõ9,¾C"G•6]kjÖ åAMò<¼‡zzUD-ðIÅè RhÍó$Ìp:wµƒkŒC ·aßñ¤“hNŸý¦‰c%¯ÈŠJÖW,æSÉ\.ƒ™ÿsõîPB›G®«Z׎'$ÚÉ<`ÊbKšç† {œæ‚@¿e©­{œ{:ÖYéþ1”Ïø7NÖÈ˱;RSµªéO±û_kVª]NÏÅ8ü®W0·o¸ø™¾Eu½»6Ë©¯e/Üý‘ôZ,9=wÀ¡ÏÁ\d%¡ÒHÛÔëFʪ©7Ó§¾É/B×öcš{•Šèà™Â5…Kõ5¾Š¾×f±Ñûg”ºþæO•ý‘Çl9îF5Ó¹Ïjïz(kƒl7w¡R«—”c³KrÛÃ>|å¼2<¹¤Ão¹.âÛ Tü+ºš­jÍTžöªYVÇËq€¾ÀZBíq6hÓñ¨µ]q««9_ ƒ“‘–i°pöÆçC ‘î ,`æÞ×Óã캴Wšý:˜ù©jýêT§ë•Ãú’Ãäy8í<|°µ…Qˆþã^‚ò­Zvü¡äÛÅ­¬¯Ÿô3<˜brRFüví•í&GBå½ÿ¾¹·Y^Ø:üujÕJ<ÿ”Â’]»Fä^ÕË ZJ¶šyŽdq\v#&T Ì÷($ß$%„•¨6— uük}šûjœ Ñ²\qìsÀÚÿ#\§PÛ‹iéV›Ú™.”àâ”Âÿp5¯±ö‡6á44šX~£ÕaëëG Ç·µZR…$숹 &ÇÖŽ”<3[ŠÃs§fð­PR¡6c³ƒß~Üxg™.KùÌirpY…Üá{#s³ŒgÙ/Þ¡ÍkÿXJ÷µ¥™§gä’^íÔä¼§Åæl’<`2`ˆ!ÑÏ$’Q޵Éä8ñ‚ü^Ÿçù8<Ø`ka, dáéû–¸-~ˆ½k‰Úq{ 4û—ù1%‚X$"M[¯ZÆÉõ= ¾ïck‹/Èt^é±Ù¢‰ÎN{Ò8='“ ÖŽc[. È’«Ô¯ZŽ WÈsÙîmØ7­[Rä©I‰Ï1Ÿ§TBÝoM$E½Êƒ ‚­±]*–1Èy#\®v– S^¤±Ìä¦ikšHsz¯^ôš'¯%Ø|ŽH³c\ Ô…¿ãT–8sÔ¯79$Ð:•—|Φk+{2î—r=¥Ê’«w©ÍasCœ"íõùUòS±ãp|â0@ .•ÍìkY•Áž}dÎt~ãöµ†Ý(IÈpˆKJ¸‰{õôŸ&Ê Ÿ¢ÿU4Ñɯ+˜>k©¡Á 4òt82ɵI'Cü©,¸&1'qÇøæ^o$ƒIå•“JÉšÐæ±‘ /y}m¥{~?‹³eWo6˜ý#w™«[nøUßùG›ä·)¹F'èÇüQÃ_«Ëª·t3ÓµëØÚêu+Ë?*ã³kl×5Çé”­Éî«»F.šåžo“ÖÓàúÄ0e價ÅŽ3m—(G)c‘ÄDûHGêqP[¢&œþw‰dû©úúÁô_ù~MwR"zN'Ùõ>’ñ_å¼;+ŽÀŸ*O#:?w*<d8ˆåØç ;Sôׇ};ôÚ.¦¶ôÉöµkÙUØ×ugã“ê_ñÎ7‹ÅÌå¦`Çgû¾Û€i."ê·Ò¾‹íI*£ÆÝmÊS™<ÃîoŒø>Ìþ7.7âHKg“ÜÇÈCO@àSêµyþCÕfëdêýQéi×4å?™ñÿ=Áð¾-Ës\w-.TÿúX³Äí¾ÉkÃVF‹U)x¾E5ÚÕ¼ÛkûöWü+êv?@*Øü©Ç¡R7ùPH¯Úrƒst¢DØ€éM‡Ì !¸ \1« JmhaDep‰T*†ôSj–ß6I9“½ñ9óbcØí6_Mvv¼™^Ê'Ú¿õëíœ~A·/l0°ÍI.Y\áö5ïx>L(uOÔóöÿç­œ¾=}¾#÷;½¿lñ2>ÑͳŠg)ãùŽÏ“ 1¸ùóÅ8Úc/uåj¡·jŸ-OܲÏCU+oÓ Éþ¿á¾[…/îæ$4=îM­^¶; NµE psDN"k%QÏÒî–QWÜß<âÄš\LA#w¹ý.·ÎÆ”–ÍþK;Fµ˜Gpc@q&ÇÖª×]=z¯2ÅÃãfr9ÐàáýsNí‘5Î ¸€>u•{™µ’YdÙ‘åÂD9cj;úƒÖ³³œÒjˆf”B@Œ“ݧUNõ‚»†»9îKÛS{Õ$Ò!òXã³°N^ìö9ð1¯³íÛÛ¡þ¤'¸¥“ $xù»ÜT¦¨tC­ Êú{œñ¼9¨ïëJÕ€®ÉèC4eÆÄ]qr4^õ*Y«i`¨âýÅÙ=*êK”Gî’…ê}iò‰‰Do” Ýoñ §X!tÅ ¶Ý馠ÍÕþèm@íÄÙ4©m%Ðgï&$]¨õ¥’hæŸ-ÑÂÀé's¶µ¡î(­iÜcÛ“Kþ2 V1Ù #~–4ZADr¦•´$²sÛ¹¼#.y‡ºKŸøß_D)6¯lèÒÞ§ó¢2KeŒL’6(;eo 0s·¹ÃéÀ¸§é Qò &vMÁî|ßœÁ$x˜™2E†ŽkbrƹÛöƒr@:]kÊó<—Å£ñw5›|²z¿ÿbr08×E„Ž{v°ï( ¯:›oVz·ÝV³ñó48¿ºù¼¾·šm×±’9CWr¸ ±õµg]¶âÜ95³MÊç•y·5ÜœRæBÌítSn"@ÂJ9ÁÀ¡ê…}k%^ä’’6y—nÊsõö<{Ì3%v!ˆÄ1̾ácþ‘k¤…^µôZ·MU^$øÿ*ŸþÎë1ýž+Ì5¸îq¨rnµ“JªÊg¨|_É1øLœ¯ÝñíäÙ•DÉ$’3¯Éšc ’Ãý%ZF¢ž»Ùpt5­KuœFeCèðl`x)äXù9œN)Ï,äήq‰Bç0êkÖ¿ßWj©…/ÛÜðõù·í¼)p½ýês¼‡È)ü‹XŠ×$d»ê}ÏèêQ/^uµÛ·¹,•6§h“Ï9-ïtŽ—8ºåÊIïzÆ[RÎÚ¨p°dº×ª\Œp  „=44ƒ‘\|i€üéà™øS”XZ@)ùÓD–ØÚRKF—@™¤tKR–Ci$}7ÿZüË$ä¹ÙŽ,‘ðŒ9X¼„ÌÆŽh6¸¹°Èç‚é쬌 …=*õëÏtJ\úAÕ£GäO1éñÐý#ÿ¨œ7Šçpù C€Ækš‡kA»t5Ӧεn¾¥º/ÆqßöÛ…ÇšgáÆÇý.c“§EE¯“²*¤òÞ„ø?1~äâcÅÉLèÀG¸–úŠñ~äURN2Ê;æ¢4Ÿ©¿JÑ OÆ ¤§ww§"rjAßj­O#•&¶^ñÌ;€UéëZU(2Øþï™o-‘•)—)û¤`ž‚±¶ro­v$½ Se™Z wÁ)5 ¡`‰³¼’R·ûrK±+])‹'æ)D$øÓBϦV××!»\tpøT]NQ­-Y‹p&Îè¤;Š‘eèj×Pœ—}üi¥®ÜïëMt$Å~L¦GãmÍiÜö”úT¯Æµ¯ªÁ†È뜔2 {^ŽT|EûVMdè«ÁY±Êóµ¢ä§kÐ §€Ç{¯h{¶]`µëJ,‘k$±‘Ïàvgs’ÁiyÉBæÿŠmj{j•š\M¶k*¡ öo~’H骎ÕpÊÃdìÈnËâܺ;µláps´ß= Ù|“¤*óõõ/zˆÂFë É2Ü_¹Vö½Lê=’oúGꩪ‰f/ ¢“aS}ºRËœW#µèm¹õŸJÉ×bdE4- Ô ^þ´œÆ Á#Ç·*¡h!ÎÝúŽ«áIñžIo2`Œ)šçúZª (Hº¢¯.þ«’xcöe „4¡B:^šikk8“µàùÜÖ4:8ÃÄ{šZ¥·îëÕþW Füie3ºãyüÙãŠBZÛ”`kA+bø˜:Û~‡¢ð^G<{[<ª@q`q(T좹³ýúíuáô3yžkþFGìuœ-¡Òõ¥i;6w¼/r§5—Åùó9àfc¾Y¥æ² ¥nÇ0Eµš‡CÖ½UV¯lÃYàäݽlŠÛ¯Yøàùïž ™Òûq’Ð룿ò¾„ö¬ìÓGŸZº¸0p¤“‡ Ík›!ÀVàëYöçDÎO©~âqñøœ“ýªÊÍñì+âöMÊOÈÅy’ENac±\>€âFÂè„׿±Z­K–×=>?²¯JV©éN‰Ê¬©kSûbiîMpnCȆÆç™,`$Ý ø \w!~Fð3Égã¹rx¼–C“ògr1¥¥@[)mßfÔrßcžoËåŠ9qÝ×&SKçŽÈÅ%6n­¾•èÛT% ñ»›»måd󉹧ĕ»¢œ"•! 9¤-eVÒhÙ¤ÜúÃ|áÒ±áч næ‰ ‚A )ô¨Bk7O»Ò·n­Ù‡“ärLà ^üKŽ#e@äv¿H.Ûq¢ú×]îÚTñå*&û—ü¸ƒ:G9ÒF„KJ‚S¢WÔ3¯[pbòì i×½4³õ˜ž†¡,/A·È…Ý©ÈÆÚš)éN0LÀV¤mPµºrˆœˆ(µg.JèJ×~´û—1ž nkˆ¹A Jzôª­±g²¿rfïûwÆ.níT­‰]5§Û ÂîTçŠs¼— •^<îXÚ$é´<¨j‹)NµÕâÚúìy<ß/^½µ‹å}OWÎÅÍû‡“Šè冄FIËËAysZç!;ZI½Í}•ãÛlYÄÿ(ùüýµ«ìªi)—éóøýOç9g¿ß…– rB¢Õò7Êhúýᦸ9 œ‡K)sºÝz_µc'§_D yþ¤6h‚Ÿ2_ŽK‹Þ“hä–YZðÄ»©5.`uisÀZö9í©ªøÚŽ _¹.@Žv¸= Ù÷áî)÷H”A]¹RíÛQ $ð>ÅUÂy·1Âq| ÇÏícòÁ­Î‹kOºÆ .p$n­m]÷­]V¹9¶xôµ•Ÿ+ƒ|‡JíÄÙ5¬’œ=ÎRev¼¨” VK‚S#XÐA¹ÒŒ÷2´™!²}.þT:š&ò)(&ÒœEœôKЧêLg$y|“¥nÓm Nã­`«™õ3Ÿ’ò;+,šÝ/z–‹«„Féë´"j*° 1ª ‡áV’ŽÛvéSá ®B(LPMGT7¾´2ž8' ‚ ÓêcÁ­ƒšBʤLêxÎdlj*¼ »*”°¨iµ™:ìs#Úsƒ€ õ/ªZ£µ­^M.5̘M# q#Pu·jÃ9ƒ¥*µE–E™›\tjk5û¦ò Ðfö:wY;=Ìg8®ñ¸¶Ût¸:Ö”Ôß%Yº¤×<š‡Íâñ8¼“@f.`VÈ$lŽ>ÛŒd=ª\ÒKJ¥«jÒü|{û¡Q]¥ŒýLN[¸Á¾c½áÎ8·`;“é-q_u×S¢Lá¾ågöæ~>§3ÊùT¡ŒŽ-Œÿ 1 9î\íV®Ï*ÕèEuí´|z™^iÌÏËr¹‹ò#Ì“$6YgƈÀÇ9íixöÐ":Æ×7ëZn½¶Û¹òý«U4¥JÅqÏÏ©/Šr`ár.˃ÞÈžÂ4°½Í.qÜ ‹¿:îñR­lÜÏO×רàòv§tª”>OOVryûñ³Ý¤dD9£°?ÒSó¯;jí´†‹wS8y&zÄÀÀ¥ÛÈQþ­H¬nÓáA¶ºµ—œœákœ^·:üj*½Í©?.ˆ¡ÈTÒ©8+Ó4ÚÔÐÀ-ýôÉ”‡D½P¿Ry¡lqE,n<}C«\5йcx!ö§f$½É⢄К|Ã6iãd6V稔êz nÍó“™RµÍpkE“‹#±òŽÃ´mŒ¤"´”ükNë' åüu²î®_Ðé0¹œœÎ:QÉtM @Õ;I¹Uµu­Öµ`ómãV›½_¹ÊòÛÁ÷¬ÜB7¨“´]/\7]`õ44ÔOÇÌÁ˜Ý5]Mc “ÐMÀ£RPoZF©Éa²º3µÖî*¹D´Ó&3ÝN½«8=õ:¥(h§ .È%¨§çG,’3!ÕoÔiùÓæI›˜árn4¤Ò_$Ã5γôéëU‚Zgir*mj–c¤˜2ëÿÛéQÔ*ß9'sîJƒÞšàÐß:)íBXÉx<¥dˆÌOZ8’7<êoëIá‹.]~U=JCA"ã½<&ÄòÞc0¸¬i2²$³1ái{ÜñkTšÃnÚj¬Ý¤ŽzoµÅrAŸ“ÆÉìçFb›_iáßþ¡ÐúV”Ù[©YDß[¦H¸ëÚ´ƒ)hs´ö¦ÑMÁ#²ÜëGr¤³I±OZ‰f¦.kÚA%; ©èfÔ#k“p sˆ¤zÕ¥ÆYÔð>^þ/"9ÈÞXT‡[­«}7üwN&/‘Núµ1+¡¹‘Ã,N™ò -Ú€jª°®ÛqÒ9/1ƒŠ1ûµÛýÆä–´ÈÐæ¦ÝÉq[V•­}Ⱦû»¥Ò“æS¾ÿp¸vµIÔ-b›ŒHíW9‰9ÎO›ÉÉÝ$²»ë¹µ¾U£´¬Ž´í·Åä²$…£’ žàª/pIøÁãê¤FMŸá9¯)çñx> ù¹Ï.s1šÍÏtli{ÃZ5F‚k¿Ã¯}•W2pù´pûs+§&Ÿ“y‹àñòbøþ¸Ü›Ëñ²†CƒãlciDZZŽ$8Aíߺ”V­+޲yút=Ž—µ›Äüacý á‹Äí2Hß©Çõ‰Û½xw²}2{µ«O’Ä0¯êmП…fÜt6JVL^^MÒ–ƒ¥’…X4¡‹#ŽŽª‚ÈæÞ÷{ÕÿPÂôÂX#é@Àl½)ˆW±¤Ð@æ´šzÕ¦6‚¥ªÖ•ˆB@Q×JND¨¨;Ð2VIµÖ:tZ*¥Ød.{Ili©Y3²ènàòÓã0¶FàCÜÈÖõ¥mhƒŽÚÓ´¼˜¹ù2¾S#œ\IU%I¬Û·S¯]RE IQùR™6BŠRÇn)t%|Ε۩þ $Lƒüµ¤.ЇöëùTÖL–) è7x)eªíýD^u?Näwî@¨nžƒÒ¥ ä^òzU©%Îãbir awRi,ÀÍÔ¸† Á}?§Æ¹ÊÕO‰«D®²“¥KÈÀ·_Ƥ·B;_´ßs|ƒìïšñŸqüW`æøi üsæ³E…¥»œÇ(u®+Æ[ëÛ1”þŽOWÃòV†ÛS)¦½šöþŒŸ;ó.KϼŸ’ól°ò´òeç˜Ø˜f•ÅïsXÀÐIÐ Uø¾:Ñ­QpŽ'å¿tDô9àtÜŽ'ÄŸò¤9 S¨&AåI¼–cÂÀ¨jX~>H‰,·-hAÔÌÝ.ÃÉ–·sœ„þ&š%ÓÈy—X‡ŸÆ¯¹v²é棑»v¥¯ªSïLÍj·Í ü®‰»àð\^ԶЈ‡©=j“¬,䗮ͿA˜ÙYŒ£k·í{€F7p Ü·Jn^KTXvq8(sq7Œä²°„Ñeˆ$tC"à 71Ö$••—k:+Y^Çwö—î_?ö—'’ò®Ã÷Ù¸\9”À3µò7qú]±C]~µ®»Z¿tšißøîÝWÝ /òq9>wI9vç8’^íosQoS›_¡RnhDéX<3è°=ù%¬NGƧ€YFcÉwZ´h°gH)špDâOƘ ?… ­“óï@6!{š(@¢¤›$JUi€ç<¾çû~# ø-EˆC­8Hå-õ¥ Ò'ýì€j{…R±¹Á¥/¹7õ¦¸+—,‰SZLÀ•t©nF=T©¡ ;Šý'û|ª`·ªY°ËcM ¡ô"–JI (Z\‹¨”¢ë@@Kú (BÜzÕd[”)øR|@›á…’1¤™¸!²¥ÈµLH>ÜåB*|‡ º­8c•ÔßáS‘À±àWúhrK’úö ad’k ìചȤi?•IERîÔN„€B@mµKU!uÌsƒ”_¸¢‘˸ܠ=h†MŽ÷’I=ñ¥ÚK‡ÉktFBb(Õú#MoZD¼w4³È_–ÑúMѳ”h“"vSä(>"”ˆ/ã:h1Ù4EÁĂـ:—®‡Š¦ŽW÷[$p±ÙR#‰Ú»¤x–…¹JÍ).{xÁ¡“bc#÷$k¤BXö9‹ô<)¸ Ú´²I%ŸŽ ¨Ü¿Œ•\ÒFíÀ ß󬚆mW*Z$kÄaµe* *ÜûäJÔ ëK‚”YÜI…ZàÑ$T‘ÁmóøÐ€Œß¥ ªÐ˜4QLÌ–0­6®Hôµ\™  G ʈR1Xôõ4ð!tPšè6¿ ˜Ú@¯NZ nšRäM…SÖ”„‡q7¤TÈVëøÓ”ÇÔuÔQÀº„>ä]¡Ü4èi64¤$m7RºÐY@¢RP6œhcšX rmr•jj€w¢'€JRÄ£Jp9õ°¢},ºü)|‰lDúÒ I£ä;h Þ7*lꉯ Tõ¢CoGnP‰¥6ÚFà_qÔ SC¶x ¾­LëšKÐa÷*”Û„…5ùR€L’0\à§O(ã%üŒC„±Jö>@ç1ÞÛÃÀÚš¨"õn°cÝÜܸɳ22ÖË!s"±µlÐ4 Sk6Uj—BƲc¼JÅW-ˆÔzkE[Y#bMC-Nü‰vK4…Å­ fòI mƒBôª›}Lꔸ€ésÐw¬í&•XºÄõüê84‚žL–7ùÕÁX’„®Uëë¥Ò Ä’~4Mi ZéT¿K-ÜE!Ì’/mŧQcTƒw¤(BAòªH–&µiIJ¢ ü©Ç¨²%'­T$:4ݵÅëÚ hNi )„¢P!Z†õÜò(*V ¥…>Aà#B Ik€7]=)öú‘×°ÓçJ+|{ÐRb´ù$ZiøÔ±‰ÛUZ¿=t¦/˜•i&6+Pò |h¨1u£–%4°)¥!éAX4Ù"Z”„’cL1ò1²†öä ÓñÓ&ôšµÄŒzn!ºw¡¢…ð¥9®Cë@AÒxïã—ÉOÌòOÁÍÇ~-{'pÕ®*6®€÷®}·µZ…†4ºœûÃCÝ´}+ô‚Uªk[$Å \S®ªmZu#+’ÄM  GCØj”òKiõ Ïú—òô¤ÞG–°Iìí²5-7a! oB•6ÆœÖz𠉆).ù\¥À(Ø.ãÖÕi(Áƒna’6Ê >½ÍE‹«ÀÉ7 »¢Ú¦Jªœ•å˜ ifºæ« à¦÷*Ñ–0ëzjDÀSJzSàb¤0XÒÎ$ŸZ¾Dø¡ª…">•(O¨‚"Æ‚„.i¡4--­)À‰¤8qíó¦]J0ƒ0†—y ¨°  9ÎãœèGÉXÑbq;šògë-ÚŒ'ôƒqÞ³§v{½qò:·½2–´øSÝòëÓЫ¡«˜9 : ¡C PRÀµùS÷*Q‘‰m~´˜…bMˆ ºRÈÂQ lØR¡A?M‹¨®tüª[½E…nõbB±©…{RYä––´5…2ݥЈõ§À0ô b#J\ /.4!¤9Ÿ= V u.åòyyó³#2S4­Ž8CȈâ`ú@Ñ  mÏ$º†¦2Rñ\Óm Y´Ÿ°êÚYÉ}¹8r1Œïõ5Ä~Ej;,›Ì•k§ˆ6k,ÑaZIÎê/wp=ÅþU.É3eR´“Xk@"³åa³·U(µHpS‘ÊnVŽˆ“NKiI-SlAAD—}M L‡AV³\XÔ¦1v¤ Mi¨ŽD½¨ 8J*QTþTDr)ëÒ€ND¡I¡€—½?NAðüh „¥"U¡ÈÄ¿*Qè9Íj™"øÒÈ ¥P¨tµ”„Å`Rœ¹hHMÈ‚ôüi[’BšÛ²RÈ ÇJ r…B@Å@‚:þt‡"éÛÖ˜²"iRª'°ê¨Eà:ÒA%SáN2  zRíb$hÜ>hù„¢hÂ=&ˆ,Çb®¹ÓµKcÎzEÀ×ãZ! díWèAèR¡²ì§¯WÏÓµÁ¡!"«¤^µQ’¤au–i°‘/jId©³‚Þœ’‡ÌøŸ+ß q¸’ÈË·;i¸5ïDT-(ŸÿÙastropy-0.3/docs/io/fits/images/Green.jpg0000644000175000017500000010104312243255342016511 0ustar oleoleÿØÿàJFIFHHÿáExifMM*ÿÛCÿÀ è"ÿÄ ÿÄX!1AQa"#q$23‘¡Áð4BC±Ñá%DRSñ TbEcrst‚ƒd’¢²&56e“”Òu£³ÄâÿÚ?üÅBQ&xFa˜ÛdáØvìì¨3Ê´æ$EPú!íÿNp Õô°v6bäO‡ä?ÖÅXÀˆ!ÛÛo׈?pxr²ž³ìĽ{¾xp{c­]ãàÔ÷Ô|,³ T³×'Ë&®\ùZÀ–Mn=Ϥ뮴ÑUý[8“!¼…ÎwY4žL—xò²ò=À|¨ªkæ`fø†™Ú¾€ Ä¾ÏÒÞ38E´¦BÕõÊ• š;1ÃCMžá¦˜ @rË…lGÙë¶9kݧ”bÅ0l !§0­ÅEp»Ûaâ}O€æ>ÏÃ;{ÑØÚ/ú7È~ aF_Z/ì†Å}ÿ•u·b„ã!ÆŠv ìãó×Ù[B!þ¥³ùÈ=ÏaÇmüpm|êÕ×.÷¥.Mh‹€ØöÄ™B1R¼ž¶(E¢Úzœƒ>nz…$§‡n`Û!µ–ZûF¢â6î †ÕcLJpîöXbq0êÄ#®¹ 8Ž|„ZÂ:‘€0“õø?»Ç½@È¿Úq h<+Ü𲸠Œ²Ë0@6#Î&†zÕ¸8ü@âÉ‚ ,baŒ¹yp×:ø5” "A…ô€Eò0 ¥iP¨ ¹›؈r¨ð¥@•ÑózÖŘ@—Ô83xż<+î|ëdç’8=GìÆ´ŠÎ¼G,¨:½¸ÂˆD¶ WÏãá¥l´ÙT É-D'“v€AMˆÎ.^ƒ]]Û[3 pDá\ê4¥4 ÇžVDƒ‹±Ô3²z³WŽCâ5oó 6àˆrØ{ûûìË)éû•¯/Èr±k®ù|å§v¾64ͪ€^¯F`Ê™{[¸¬XBÕˆ[Ùúû3°v¡‡­² Á“þ™é›[´ÿ/þ{fÔQuô=óáÀs°#ãm‡;Ä9»ðÖÂû=FÏç={ôð°b‡v³Œ3¦ZiNBã`‰€dX±ˆåíι¾lÁÈ9XòÉŽ(¶vöü)ãÇëA".¬5Ùzó=Ïá­]ì8͈ÁîÁÛ¿WŽYi`°uêQ„6ôÀ,86èу?yse½n¶ÌYЭïÏÚÒÞvŸø)ñðÉ»³ zŽ61ßîÿZ:5¹Ú-ãÙO³>_.Úw2µ¦}ŸëžÞ6ôQË 퇧›µF¹8äÂâ<2±°ˆÃÖ œ?Uë½â!ïxd `|‚!Ë¿‡d:á\òÓó±°=l1§7øfÜFÂw¢`˜ÍÃØ,ßZiYŸžYû3«Û‰¡/{„ìÉJãûÑ+­ßŸ°B$ñEÈ­ ¦´ðãOêyQ0ÆÏ–Ç _ƒfà×&±Q AL"?ÁW 1ãò-aÌaÕû@?!gdgÙfA {DýçÝÆ­X4w~û%0½œH²<6Ä;øæ9rÔÇ–Ž®´1mèÏøøó ^ËHO Öx ä¸?Æc÷xaÐ}¡WäL:W'Ζq!68mÄåÖ_ZkÇV³êy`#¯D3ýAÆÊBïÆÇ /Ùˆ‡kë˜[6j2§šTIÎ,æ23®§ÐyX\8Y€ÔÆ–nðvf:åPü©•ƒ±P‡c¯ ×*Ðtã@Ó0°V¦X‰b”ë 4“É3“ÆÝ‰¡@ [6c›]ÛZ8{(c¶Áò×Ù˜eHYŃ’£H >»G–kýÀÿÿ-r²,»ˆØàŒ²»SM4½ÃßL²{"ˆ½£`±¡–CÜÜó£ÒÅFÁÕg×?ˆw7+ÀÄŠ- Û ¿`çâ}–C¥³´kßÝða°b|!¬9¾c­_»åìXÒ´ÖšˆÙÝ-â› ’Î$(Õ`Éï ²³g°Ñ›¼›'5AÒ¦<äÛÊ]ÕB•ƒæb¦VlÙfmŸž|,d0Ä9ÆÂ`B¹~ á͆Éú±mmçÉÜÐj03ñ¯¹˜Ýž¦Ô,\ðcר5ÒÊ F@Þ€Ž]ͯ´³µåš¡™.M¹£É“¥)6cˆi¿~}u}(–hÃŒ"þ˜ˆ»hß‹ËfÅ×X3Á‡!ooá]lâÙxD* Üó |…º`",ÂÁ˜ äô±o A±M±n÷ ŸWk##a}BìyþnÆå¼b"Á«?Éôàg}€ï¯ãð±±Bd1lýà}a£¶Ë0~ZébÂa‹eè>á¯ù«—ΣŠv›'…Ÿ>Zs±”1Góüšœ8ñÒÂÃÙŠ»{>Z´nn:Ùfê\Iñ!8¨ã¹ö×O€÷X(¡Þ„k«q Û…_;{}|#éƒéŇ›ûùYiD¸ÇAþóZsm=‚öpN–(L¢ƒn x+›…{^,±:SA1: !)eGb’I£ŠpØp‚…" FžÖ #mž¯{kïÏŸ; :ÐìêÞØ;8À;9‹lT?=ð¯ÌPú0?ð‡ ž}'°Æ}(‚º°>yÐ+ùçoCÐlBÙ¬á^ñ­xë PÐa5pÿ|Ü»ùXa L -²ÀÑ×çgßÜP+ÅÁøÑ½™·øÛŸ{Ϧ :i—~ðku¶£Äк ÜsæXYç†=¶Ï¯pwk𲂒{Yƒ¿1 ßfùÑ€l¸”@Ÿf ØŒl8®Îun?³ñxpqhÅq|/ü¾¬Å”†‡ªXíi÷‚ïG ôjsëeÅKŽ8c&@>»*Ô€à {…w÷hN‡dóÈ }Õ»jû³Ï†BA/ÛRf4ö8[pëDN8>ƒÁ¬äz2R¨2DæÂ`â›f7³‹¸=4¨Úk#/¨!,½ˆ#‚ s}騵;ûîK©.O½¥h„üB”ì¦,ãŠ4TœN æTúà…xW3/ì7|¹a¦Y1:açC&&%4¼–jo**Á@¨ål·3–Y‡Šˆ6µÛzè ¨i›wYJ1Â/x?Œ)á“åžô²`ŒÂF3S°Ç†ú§j³ÐyçðKVf†{bù»0ŽY8 yÔÈ̈Èc‡ãÂg«þbâÚøÒÅDIQÍ!€+ÝÖs÷ƒÙ’£(aÌ  7&P“ÔG;7ˆ˜ r‚àPifâÁëÃ4jzzy¨ælI…ˆFhBj‚±L202"b,IÅ0 MÓvÔy½( 2‚ qŒÀç­=ãbL„`†(Êl@Ƚ—úƒñ…èÂÉÌ„4ù÷׎ð˜È½1ˆv §eP‡·KØ †1ŠÅãáN Ú3q¯pØ¡ ˜ƒ-±ä Ü‚¾4·£hÇaÀxè<ýÖˆŽvPíTzã–OM_ç—p~ÞЃ³á³Ò¡ùdþѱ;cÀ=ÿÛ‹¸?+ã`€}¤a­ÇãNzFXBWl!`{øéÆ­np7Pûó¦£Zr ×!ˆ6ÇeûØ4×=]›Ç¦Wfï™?\J<¢`8qŒÏV’8â5«YÑ™ž–ô“Ñ…áèÙziuáJ$G”& rØU$6®…rwN©*º5‰(ÜÁë2â„ ‡üŽú×­Þ?•Ž0Ѐ@c¨9"P6O—Ëh9‘¢õo±â-ÊŸÒÆÅ;Pu6>xÎ\)èv¡‹f(? {~{˜l|D™°>cQ£ó§²ÆÂSú!íÉèÂ!Üùk•ŽDrà¯PB “y4‰ª(ËÔy*k*P £XÏ¿ù³WI²xQ«Œbƒ×1¾¨?•›0ê,áKRS js!†Q…Ø7…C¹¹5h-Xœ!Û,ÜaŒþÐÈ5)„uÐuâÒÑó’ìÆ˜fØÆí†ʵ q XƒKt¦ ¤‡_*`‡`GÏu›",bÙØƒb(=?õU¨qp®~æ{zc9H',6ã妌Q Ôx…‘¨Jaqlšú!eQ£S?Ds if£öÉ$aq¨3PjáVйPhÖLdƒ!ðËç²sL½û:7Èrø }Àž-®¨€sðÓŽ¡Ÿ,ÆÆ 0’VÑ1љҾ¸;À@k— $ëÄÛqýçó{ªÏ— r·B(Åš<ÇW‹4á`CgãûöYßþ[t"ŠG7vÌi@­ˆ„v€]¿O—·b~£6¹ÿÏÂÁŽâhOf|ÃQçÌ+›húX}Xb¬Ÿ¸Gò£~”±õ_—u”ÅÄ/y ÕÓÀmÑŠ _üŽþ{ümÜ>~ïÖÀ:Î.â¥\G1ðñlÇ;Hä3É„•\kR%š d%€„¸0¸g)Þ<­$¿}$^Ëü°^É‚ùŠèûH♪=z£N© yê¡Jœÿ}×^(aëu«ìí~xeaÄpÅÔO÷Mpã]r±1zc·ü±üG6ørça˜lÎ5§:qø÷ØÂa0¶5ÃÒʼ„;²øf#c¡.=­˜~[ˆröYØÄ ^ÆÉ¤Ùbb?ø__x÷ØP ¢"ý:7ÑÝÙÄ(ÔkHI•i{CYظókϹí,CwÌ9( cN€ŸMWT¬-b`Ì5aló ­5•ËQ*J¥9:ø haìrÔC1 :æ–¤¹»b$†m”&Tq+ÀjÙ¢!Æ™ÉH¹£ ;ÂxÍ Hq©a)LÁBi†œi¢”ÄœƒÎÁ†¹kPKº3¾&\5Ý)r¯?ý˜Ãx ¹Çô…äµÝo’©j‰ÁTf¢ŸÉ£?òb}ósÿLò¢MˆµA&@Q{!÷ ?~Ì">̆£KGMK»EA˜Ç0aqj “+,”ÉàÙÛÅÀ·«‡ÌCFlìÀiP´cRòÒØ€Z6|šÍÑFÆ;1Š`)öê4z×.yT4 ¸bŠ" À$”#kÀC1àöY—­ Ü2Ùq«ða ˆ‡‘D1ö‘mÞ¿‹üå­ºt;‚ ÿ`C´ õà7ÀHI&ë£í %œ ¨öLjѵvk!„ÎÐÈŒ#Ä ‰šº×»Ý¥_…žb(É0˜Ä#Œ£‹0‡²7±Pÿ({G:’ÃÐmTúŸ:8{X5oÓ ·'Íù6¿ÖؾUàÙ{t£¿1±T.-;Þ¾•9Ùf0Ã[uŒzr¯ëîñ$œ¥I$“2“)4ëM4ÑÁ#ŸäíÎËæò©„žh²I9Lj ”©z©zôj(jUéNÜ×§?dÕ¥R FÈÎ"ÍÊ2ƒaúåax ‹· Ø€àb…‡l94CùXíˆ^ h:çnEG>ÐgöB´ z¬ÔtzÛÿ wÀíßʃcË.>ÆØ`nƒ…ß­” pÆ=X<*Ãá“ò²’Sˆ…æ.ýû"ýî4o >$@ǰ wÂ˃ê!ÝïM¥õÂIÑ‘f|iÝñNl8SÓFw´þ[%Kb$¨à‹³Û0§4¬ê||^ÖUܹÓé¢Ò¤Ò´æ—¿R|1°€M;¸¶T«Ît0¢í’)™IcR›£N¨MRQ…$öø)œü¬mß”’ZsLâ\r“ $^öOŒyêžìødŽº»S Èz7¿%^é…à»Ý"¢ò_÷2ìJ%{Ôª|jâT Õr™¹Êù)L°¢ó5ˆÝvýû;>µ_66iÒB{°TÛp‚[vd(.¥ÚŽ_/–ÊÁ ƒɉÓoJ‚d l«ËÁ¿÷…³ôõrõ€Èñ–Fq©b0öÆ»yÃSznñzp´<6΀¾¼3­5ÏP΢=Á!»3"哳(K%QÐU4•ŠN+ öŽ´ +¨Ðlë0Q½£X hãí`À|Ö´ B‚>VÖwÑšx¯£¾—.-îK*ÎÔIg¥ˆ¥·&ÿ!T‹6" )Ch7Þ>ÒH;ü|úúÞÙõäM(‚ðÎ&‹æ1&—–t)p§'(8%°øy-2aFŠO¾T´ f™mè˜!J¬¤¾g¶¨¥©pŨˆ·T€"ak@Ûï=¼R…0M礦›ª–ªPthÉ8ÐT¨Ýßxrq[hÒ˜¨§õç³Ói~ê"Q²Øf¼9ñö·— צU¢Éßþ–CñäïÊÀˆ¸¢ˆ"xZœt)á‹oCFüsø …³ÔêÅT­s¯Ž t³!ˆŽ†l?=ˆ‚(a%¶=”Ì´È®¶ô0Ä\p[u gÂɃÝ͵g·´x€<¸Cƒqù­à†Ç?¯=F Üœq–nÕ:íÝÌ@€×PÖ݆!Ç06£Ôu†¼tPY1EÕ† ½=ßÁ쳫{nfȈB=Žt¨xÔ5³’T¯,aYéžbÎid¦ï¨•já€#K,Â&3ábš ŸøªWðÎÖ²î!„„§¤6ÜÓŒ 444×Jfï[Y’‰Ecq`&1'Õ„œÜé¨UÇ;h^‰HºR«åvçó©j ”Iœ¾qºh—{•¯òYÛáV¡;ëIU)N;ãT2¥Ö½ú¿ çW–wxä1vQ¨ŸÍW#“Éw2J•ŒÁb•‚B!Fž_º¦H¥C¤ÜÑãÊÙòr¹tJÎIØÑÆw\48ÑÈ@2À³ÑÂí^¥²5G®&2…TiNF˜QœRShx‘ÿ p𭞦žk<7aQØŠN4£#ŒÎÅèî4ÈAÃ' æC’Þ¥äËWâÆ1Ì !)ev§šV*Œ|>íÍÙÄX3qµK=›D©h Æ4X»uí@×Á¸éA ÚR€MaXª’G&X躄ÔYþ¥ú€Ù†R™ä’%S8÷%¸ \µyƒ˜Á¸.Žë­…ihôþJ­ ÇKT@t Ráo$Æ"P âúhíBµ9‰TÇ p¼]¨„ïq~ö¥*Á€­*}+1ïËñ {ìQi†36Jí0Ç©£pÊ”kûd†IÉ»ˆa˜ÌÈÃY3+Z€Îв±D?j®!ê•þ¦ˆ*»*f0ÃÌTa‡œqÆœqÌdq˜Çk{i«pgdq 1ÂT\7<,Š"À¼ÞË&f})˜ç•ŠÀ!ɇˆkÏ[íÇÞ²˜\G‰ ^qlÙTsÏežbö+g³@™|s§0°",ãÏ`\kPâÔöû9X1E°" †¢i£ˆ×*ØqÅö|GÝú|½‚&bðf®mO‹½mÈ›g!ëúa´e><,¨¶‚(bïÓáÝã\¬>×Ò }ˆß0ÐD|3ãnáÃèÃÝ2jçÌt÷{, cjbôø~Cýlp 8!°80öoQñ~þú°ØÌ:…6( Ü:‡M2±°Ãµ~¸wÑéó—æº"̈Ì]ˆè8aFÊŸ†\u²¤ÉÌ>Œê ™ÕǸ‡¾@i´žZ=Aýd ÝÇÞá•­RSÎ/h˜6 ÷4ï ¿çP´êS+<²ÉPÛqì€Ç snÀ8^i„2õDÃi¡7>ÑÄYÀGïÿ {Æ tK SáÇg^¨[×xð¨;»d+eÓe†š#à¦(íÆôYœ)GwÐíaG "uª9|´á2gæâF­˜d@"ìô<„!@uÕ[;& Ua¥œ\œn.ìøæín£L‹§à"9gËÃ(_,TqÊQ\“³×_¬-âükíü¬˜j;5 €qÐAûšÀ¤cl0Ø­Aôôxx½Š#Æ1Ú¥=µ«×¿-2ÖÄB_m1u6ûœ:¼>ia>È¿X a«×»ÛÏÂÅE³ö¡~ùqÊÆª…{¶îh›¶”¨Ô±g„oß‘˜üæ5²XfÈk¨T;üs±±}¯Ÿà·¡†Y¶¨ù€ëÿ-¹²Æï΂ÚÿÊÙÓ@Ϻ¹5Ž!Úgê>•åᦖãÃü?ù†Ê«CFýH¿]â㓵uväaPCÖÙõ”‡v¿#K*†a 9‡/Èr+$ˆŽØÀ y>†LÚV¼Äm1”KáÙ‡ ºŽÀe {Ý®¶µeÒ²Š QÂbðÄumN/øVÁ‘0™'nm·d½@y‹jÍVæÏm¹pþŒwîmÑú>θ÷Œ»£4&r¢íÏË@w‘צ»kG<<óÅ?Õ%S%¢µˆ›q^Ì£ü¹³ ”¢9R©"”3(¥WkJÂTnôH¼`œR™V–'£þŒÑ^yºƒ'åÍ @d¸Ñ/ÉÓL˜‰"Cå ºªP4£×ˆ[H]ž†ÐJ‚¦$ eнF8%¯{7u*U*RÙ€8g´yýÜ…Þ’JeeTÂ)"¶“Æfä””§w:kÛõ3€V¤|ÈUy2Ñèb椉Ê)® iéÆ ¦(¬d¦”)ÿq9B‡gÜÒ Ú.f`kkn‡dŸF£õÞ¿Ó ýÐă¦é•긙Ø&ò*œMÖMVî ÛvW6•6BèÙ˜/Ÿ÷·¡u±]s¢–ÊæäïëÕ22‰0¢’›¼J)¦ñç”ʬ9Ž)¾—jP#„ä ‰Aƒ°J»\_RÛ¶êPÐ+Ê´Ö먖’z‚õÓÛ ‡e…ëÈ!²¥^Ð`LR¨Z×õ#`ðgÕûµÎÖ5Ò’ÆR,.©â–›¶¯bx`Hù¦¿…A­d]¢!9ZÈá‹cÈ€Çñ#Aù¸h>’£Ýeצ]4X$îFLص)ƒM,©ªGBvç»)ªª+7>9V‰&Æ4S1œD´…ëŒXL°¤„¥BPœp¡ª¥MÀ]è j²{XŠÈ„v"ì¶àlħî ƒxföލ)BtÐ+Š ÚýDc\l óqÔ* L²ÐL8™l©L’–,oÞÁ#H¿n,p¿½(ƒ‹<%dÀµQ,!Fú$”Z`í‡{× ­Ñ„83Ú$Y1’1À[Œ`;f@c|ð j³.TYÑ PŽ_«¡!¹sù2”­Z‚rŒõrfhV"Ì Y<öW+R¬g¤Ñ*kW#ý¢‚\ ¿ðôÈ–©?¥‹ç7™L•^œú0˜,,Uоi§yÂãpÿ¢„_p¨8bl#H‹h¸€ÞÏVÍÜ]Ç6×6àˆÅ§—‹ó6ÅÍÆ7Mà™dáþȡ—E‘AQv'ØsÈ[¼20Yg™c>Å@±9*8ìÐ],H 0õ¸g¯!oÖ¶ñíP§ÌGª“÷LãµüCÃ/ t:í] GÁ²y»wÛ¢ :òÌ8râþ#­ýçÏðØ÷ †p~çbºŸå÷Xè†'`àôÏ?o³›ØPìÄ`„#׌XÏTþ×ﱉ“ÂpÌa¹µºt0•Ïôô®z‡çb‹&\Z£•GçðçeBÞŒãëðp16q·½Œ„(à…ŒzS¼=t‚ŽE3¼7&}5»Óé"9É*ÐyJL±D±r'¨÷”ª‚W2!¼ÍƒqÔko %_»Ózú;£iÄ–9?GrhPÈæ²¦sä¦+í¯ö 2¤·¢dC«V³÷áyEŸ5ÃÑQ3é²)¬Æy3R™J¥æìaŸ»溂ž³zÝRîÉÑï´~ö¶“¸½\´†Â¶ô^I]ÏN¸åEÀ›U/Ý}BŽÇwusD©ÀQ£q¥¦ƒ®,ª$’ûœj¹ùp”Åó+Ó+ £ThöÄJ“ïó5K’5Œ x 3œ„ËÏl #” ¾lI’¼R»!Ç ÝCåN ß•¯ÉØŸÎ'’Ãæ×ŠNY>M7lO»ÛÙ²¹öæ§ (ÏQÙï"ÈæK€*Áiu×»ªöÜu2ÛrÕt‹4Ù"ËÝ2JI©¼³àéië”!º©W»’)çÂÚRÒ‹z0K&EÒ…Ä9êñ¢"a#2Dtå)óR¥d”@¼S®Yº¥l·1m|œ ø‡¦Î€á2w4"({(Õ­Q iF¯5)Dºóɇ?ƒ +oš&\ɆUQ¦Ù1«æ–aXs—ŠÌ$.8¦ó¦«Ô(Ãl²d‚âH‘)ÁˆyÆîÉ‹qÁʇ՞•Ë*‹VÖ ]¨ˆE%Ò.=ЦïʬÀüÜl´‚Ê’­J–cU÷ñâá ƒ×:fÙ÷½‡*B ]æ^yŠ”aTb“Š0”¥£xbE3öû¬ï9” °áõû#J)þ°5mCQCPð›óI–oC¦™´%vEç–\òl­YL&Š’®,“”ã`ðašA¥v¤ ÏŽU9 ·+1Ì&†NÌTÛûìð¾â¡ó]mRº1€IÐXÚ¿lWûÿž5 YZ5ið_[ˆÂ‹Es@ 0ÓrByÿâ€j‹ñqk9£¸óIÛ*eª“žœÜ3 3²4£JÈ8T™RQïf´ƒ|Ždš2š1¥Á3yNq¤”ÌEÅê-^@ oÔ÷öZý7.çÑÀ»‡xï y’ÛþªC9ŸÉ’NïYå—… ?0½w¦R@Š’åjÓ ß#¢Û¬ýßo¯?JOíSº=tt¦îß…·^éÊ”§?É  èŠ”D¹T´I†9ª˜Æ(“¦P""±`Ä!$Š!Š`ò¦B?€¥¬ù?ýªß ::©"ÔåE¬‘˜ jN8_Ý0å¾#X‘ЭCûB_J[)Bï4zŽºF­B¼,ÑPÂðÀ5ʨÐ9|åâèaˆF(z€ã˜OG§äùkb6‹¦@ÜiíæÙ~vö×Ù‹¨9š³ qíbÅÆÍË—+Øz£¶‚/ÝóM;xÈF¯«åòÜ<,=–ô…‡¹ßžcdÛ0• fW­ßÇ/ën„[Q0¿f"" ìî#à5v:ÄÂ`‹í #þ¬=Ž"óZXÈÂŒvXBz’9Ml8NŒ¸vDmÚ³¨‹eàÙ»…XaÔ8ŸyÜ-NípáŒÁôZ0ã_Ï„f4­cp¨0æàÙD"í—L-XFô†m\½Ÿ.€²Š1ëÀ"4ƒ¸ÔDB¢#›¾Ò  ,6£ƒ' ,(Ù>¾:Úa+*£€È hÓ0aãų÷5Ö¤®\z“ -›´ÃŒ.ù0ÓN÷Ï]ñôcè‚õM¦+ïLºq+»Ý™YSwÅó4³™©ªŽ!)® Ë|å\Í&ð è±"Aû@@j6ú½ÐçÑû¤+Ótç÷š]pe³)Õ˜o‰,ÐÏ‘©8*¬ÿ)LÓ~Ïmós>?¬Àleõ½Š.ŸGó €®ôJϸ“ËÍ&N 2NŒ¥"T¬ÿ(ºy¯›©J›ymðQ°­¯Žd¼= \õ¦K¥÷ceóÍP©D¹)ép*¡¸‘DÀ5Ý,¢!áÆAr.û×4˜¬*}0Œ¢°“KeµT«uýÜŒvó¥9ñw͘gtsôO¿wªi g8 ˜;M×uÂ0£Jìc)`Qãˆço¥÷èµ%ºë¥ÒyõÓ%tö°×ÊSàª-0HO)BŽTC' õÄ·¡9h0’Ýĉ¥˜EœŒTP’wîøÉœ¿ˆE€E€dSމîÒT²ìLe&ÌåJ0ËS-R«³4¡íˆ\êé·®ÜsFÂ.-@ b¾’nÕçè²æ’eÙAxQ§ÞUw¤%àª:r…)±Aë·ÅRM/òoìŧÑÔéóÔ¹ÄÖñI•ÞI¼º*_e•º¥KŒ4 ñ>•jø¾ptÑr‹çzc=t;´…ZóSÃy ,T•4^ûè!!9*†Öì ù€6Η¦æ]+•.NjÒ›6ƒòUhvXß»î9¦T–¯ÀC¾Ñæ@je3)œg¤ãqñ‡´sY€@Äñ֌֎M:¾]Öï¢)b”Éwƒ1Cu+·sO}ñJq­xˆRk4. –ž4³‰£šbš*N,ÒUaœqÊjR¹;;åGßkÐd"qøÌ,‘,ã)˜þyÅžYˆƒ[+^CÎE‚‚<`ëƒâ•‘`Ý@ Ê*Q‚¨Ñ2( ÁÌÅêc±½†L9‡³VäÒ¨OXð±{ T|±Mb4xvN(ᇥ16)q›ýß߸ˆs«ZC$–„qŸDؽF(Ñ$òk§ ØxÛî?У¡‰wÒÚô\¾‰b»¨é.r®W ’Þø7=Â÷K 'åQý»!ª;·y¦öRð”eò9…´ïö†ÿdõúInÅæž“v“œ’’ä1ªò°šºRF4ÑDÌNßÉrµ;Ÿìzyv?þ_.·ça]è½²Ûåx¦j'Kæ3¸ª1zõc*^i¬ÞÐNàDg”“¤>œïð’ÊeÓié§“-Vý¥{/&§F ÃW``âÁQ¶QŸ^•ó’¥’ùÂñR2”ÞO”Ìí$•”w›ÉÕÛÊ©Z_ÜÃýÿéÕrõÇÊÔœYÐvâ?ßw•aqlÂÑÕJ¡>`( 0î ¾¹…2 è•‘BG“ŒuÃÍ€ÛZñqï6 `Ÿ,9nþT%Ã+v0×Vifä –`áÝžvcÃC:wTGÛŸÎVðD™ˆöJPsvmhãGñE»Q°ÛÇ/ž6-û8Eóƒ6šˆrã[yÍÚvË ËÙãî²H}0ûtñêþ˜á¶£‡–M£‹üieÀa…œd8#‚H˜f!¤ãnv ó®Tg&/³þÈ|ldDeX2Ë!xÓ‹P)•»²&ÆBÀܘ9S·1áaCD42¢!Wî|³­2 ¬8€vº 9S¿6á¯l| Pµ?ðÃk§>6ZY/°Ê 5Ðt¥C¾œÆ® Ó›³ƒ/µÔðËæž5i*2ጠ4È ÿãÏ ziáNckìJ•L#&pzàràgΠÀÌÐk˜ë¿ú赊:-º7t¦—vï]¨’í–I’ûÂd£ ñÍ7‘r=P§zM’!ãûAÂÚŠã&B¹PRÀ9leb+ØTIfac¦+·ýåZª»Ò”ÎÛ;¢ÛŠš"÷D·(óI€ã±{cJ'J}( #ƺ~mÑ$²M,-TÅ[`”¡‚ûSpÍ ½}Ü3 bëð‘ºv°´Æ.N`‹`¢…QÅ}c" T¥ÇG` [ ý1úK’^û³+’¥q‘vÊ»jf¥*8£M’à§#Éb)N›R”é2=[6ùŸÒÔS%7f_vRM CwåIWyãP—pòªóNÆ\(W¡@)J‘N䋈‹;ˆˆ[çïJ7®Py š«J‰lœ¤¨äòÔ˜¥6qPç…@( iPaa¶¼3ÐR°cQª¶ÍëâTMUʢ €G¼3kMî Ž}!^ ÉïÊ`(“ ,Ü$²¾ýBåߺ¥J—ëŠÖ;ˆj{‚¶IÑD”Õ¨ÌY+Å#^Ša6XQ+ÎTj¢T»„áR›uÊQ¸"Ë'liÒùJ¹q¡ {b§Íñsñ«po áDËï,æ]=2ZLkD€Ó&=)*•n Ÿ·ByÄ(…/ýÍøÕëœæÄàGÄVÀ}Ž#ƽã^"ÔÎÑáN0™˜ Âà i@àîÎN!Ðl•bpóh±cÈÚ¸‹Mžž6 YLQÂ8 £dz “V¯›‡0µ(•L¦¡.Uƒ3 25PÚ›½îøøçƒjž 4lÇ[}ÅþÏ~—búßÞ‹zlTL‰ÑLæ·nꨙŒEËQ¨$‰äð°O¿¥» •'ßQ¤Þÿnr—ùý¾‡h×ö’+ú{]y|t¢C!.í!\l©3Ð%˜ª\AéWm)q™Ä¥( \>`d[RŽà1Ëæ#ùBéäLÐ(T•SIY³F2M(â•$4§b¨•V ïÅ€­L“#š¤Ø[8L•½H 7y4¢C°w *gçmYLåçaÆÀKm ½RØ +—ƒçžnZ>Zx×D´÷Ë6Xg©(DXH?‚]B¨F•›æ7jc/$³Ö%ÝŒËÂ5±tz…4zwñLŽ_eFG³`ÄÃøÏ>°‘ϨBYƒ±‰q˜] ï×=+®BÎ1³MÛ˨îýÜ´Ïæ¶#a‹i†ûé—΂ˆ6G!÷çOhÈPÁœdôȲӿ²Þ†(Yâá@ÿcN~,JÛ²]ÕNh÷1~yZô'þ˺T»·³¤›Ã{§½^ ·s¥åÜ ¼b¯D›¤¾”Mœ'&{5\x§—…Ε«‘© îK™t‹ÉÙe€ïíòTz¥…m”pŠÅ‹Ñ÷|jsç^v§$JT*š¦>dR¨Ñ˜iJ—/4”¦Q[¾>âqÉâ î„3­¾¬ýfWZW8–Íï¤èÂÐjTð(*œ¥+°% âù°ïI™#ê!¦aöIã)=ê”ÝÉZ2–Ê”•,ò?•§›ß’·¢@D•’›öXmoˆØy†¢ú-Ñ}Ö@„¹êóp€˜æ¥ƒ’Œªb@ÀmÕ#»W\­¬:¾Ief@¡|Ä€qwbC I+±Ç ò§pUêI½7(Ÿ¤J–IIÆ2Í'²Ÿ°õ ÙÄt~-ó’ùÞ%¢ð#Ji>P;Ň(5ð’þ|œƒÉQ欔yÝ4v¥¾Sý*úZ“Í“]Äs¿»7f‘Æxàî½èp áP?²Ó}P2§·äWH])M(>YvN29ÜÓQß[Ã8[ã·—T.â>ÊŽ"¿QŽo»Í':Ð4 -¡@ H°äííÈ@]îWFWÊú˜¡]ß”/˜C&”ª_;^/šÈnÒAKŽqâO›~ð>xÔÍ…Ú×eѺªº2–¬™¢œ˜šn½¥©;vÞŠšˆ²%©ÃëIª" « ¨þ”/Ìd)± €ýÁB•ó‰5yJŠ$ò”…A;¾ë!T4ÜÅ`ÔeøCx'ÐDiÀ™2—.3Œck__‚9)Ϙ 05¾†ô¢PoF=%¤P²é¤R‰™lvh”1f‡ Xäy :í¡OûJP®q"òÈ.i{†X³§;ª±=ò¼ ¼µ5ÚŒíÕDy^J•v¤úòCþ÷õÁjƒ€ƒ©¥¥Ã ò!S¾KÓ.óe@›v4Ð7¶íÉqlÝõ¦Me7z@–`¶¦UDl¢(“Nјƒwz{x®©Gç¦$p‰f*°X1À4\¨eËA i^%D]uòé]á¹éTF¹)S4©g…RE[Öî®Z¥NB–B•7ž£ÏË”Î^!kšô+¹&Ã%Yq‘§œßkÙw¬½39„åÉFhlµ1'ÝÉJ·t¡1M»ø?^Î_F—Úu¥‰ÖÍ’]YùÅKc9Q²ù‘óÑ:L• £v\y¤(R•R]Ü)à.³zCèúçË“KR^e&%¿RiŽ"åÈÂO4–/S*BºjŽ`¡J© &qXf¿1|Q{n‚)¤ÍIË—/ƒ ±$²@¤«Ä¡úøk½* ÆÙòòt -µÉŽŒ+¡Â _ŸÖ´¥³ÌöTl¸Ã£Iܶ —©µ«ˆQ¨Þäþdb¥;f@l°`ìÓgj—üƒëõPfúÚ¡J‚@–(FÈìö„²lõ åGîjõ*(a×°eJ¨˘0ø³Â\"%ì´c[}âÞÇüšÓ¾‘.»„ºH”É’ ”s»·&¼…G/TB HTМ`B~ä¥B}é+=*TX-û=vÏç-{´ñ²xv¶yèü>_ú[¦B¾‘øð|ôÒ´·b˵ÃîyePæÏÎÇCµOnÃ7á_œënbÝ3æù;Ó½ý–0²á2BàÈkA¨ZÖ¼‚¬¸ 66‚2…©MD|_M4p±fÁ³}O´,..9×>çøYQK)4DÃ|Š£õ†‚:û³Ò¶,¸j"k8½iÄ,²öYQpDÎÃÙˆµäu³ªqöB&¦Ðû¸ƒðî -'—lA 홫}Aµ¦y ®‹• —“åO5LcGS°M4¬ó®bPr¥· Ê”]T²ò]s”Ó®ýÍQËÊ챞Jtà‘*¥˜Ô@\j4¶¿…UïKr U:@©1s„ªTKff Ê”ÍUŒyÂpÿ‰R;àð`£Û=_Køª(ŽHž=Ø’¢É:CÊLQ /ØpWÎsq}x ¨9á=z¥% ¦”’)ÔDY¡D¯Û‘Vó\Ýé— =¤¼(¢–Jå%£+yßÅ–V ¥iM%9$JÄ“”nÀ•2”î+V4 ]OÝB#é ò³§Wbo+2O-›ÊÑͪVQÝ€‚‚;Ó Šfðrµ¨.ÿH’Ίú8éb{ÑÒ«´I³R–oª¬7ûÆ3D{êç’–KÆkäQ÷Æß<üº }蛥;·#˜£ºs)ê[×Ä©§iå¸&šdüõ õ‘N#½¥R@ˆ;âÔÖ×…æžÉ$¦WyŠ%†\hn©{ø„Ê8?«½)º]“]Ôçok.˜Âœã¥*‰$ÓŠRiþqæ®îó{bn“úU–ÏR•%Q:@érSAaå©4Ò•oÁŒFüH'MçI€9Y†2º[é&í-2TŽ?(˜AåÑ™êqJ8>ptÀáŸÉ´ùõ~/â„ÊÏQa«9…IDù¥“æ¾uìp Ò¯‘H&׊g ¤’EG« Ç™˜Å%5¿×žÁ£°qpõU×[1¸ò5è^Á *1zæ”4ªŠMØ'$—L©2]ÝüôC7qÈr×J]8B&‰2ØÊ‚3;C¢½V) N lôªÎÏl‹<½*ffÁ‘šcdf.0W1#N#­ j½]¹y»â3w¤‘í”TqÇŠ%x£AP íÜP‡6 ¶GEÝ-®èÈ»Ï+šÈîíè»ó‰>òËf§Ts”²¤sd#¾$Kæ Óy˜ï …Ö®C.j5³5ô†q}#1jõå˜|˜SqΩy#÷ õ]g0«4˜× ±JI“AåE¥L¾û )Ãõqp8¨Ž@ _ÝÜã&ª¶FÏÀíG÷¸T© Îwzð略’îu$Tæ#†t™Vèg“VKÑ4e§oˆf»ñéü¤™"TJ2F´|¹˜¼¼EàSÕt a6d¨š»å⨕ÉMB•£BGl;Îô•Nù¹î~a¸ƒrµL*©bòÁ Æ@oj,䔤ÿwäù;Pl+Ë|/åxM¯4áz©©¥ØŒ³°^¨¤xòåýji»§ õg×ùÅÆøÍbM*¢62M}³ÍsRšiÎã¥8PX@3Eá–à "¼EM€œ%ÌÐc•RUb›|íÔ¥3ª=Fœk щU¦${ÔfLi.vnÀ˜ÔsÇ1ÊÙæòÉÌ„ ØŽ=û`r˨õÓÇF g™ô›,Bkm‚81{7ˆN:ð A¦Q ÐÙ3¨%¶ÁÍ@g ?ð§ŠšY5€~ñØk¨°s@ÉÆ>»†ÐƒxÑŇÛo(=Y𓊤ÒŠNN!¢nE¨#MÖ¿ »Y41Si½õÌxó÷ë•”CÙ®Å=Þöýx؈€z”tó[ù*=Õëw¿…¸1AÄ ¤‹Ž¯eáŧÔjÖ/ëÈtøŸÄtwpÔD4}(^œ±`€6Øv)Às wQ½º¸—*T¬6a'z2,³ÕÄ6¹ê Ë…‘)“¬D"'A³uõ­Gql *ùUõ£òÑ#8=µ÷rÒÝ"á2)p7PÒªìà?<ìü”˜Ì&3`0—€ ƒÑÅ;»WƒŽ£Pœ]S„É&õ±“6bƒ7¨Æ ÔQj½´Ô»ëf ö‹—),˜}b¢’œ Šø8ô¨¸0Ó˜£] tQ|/L¢i1!"©mГî^Ëì²R´d÷])Kˆž½~î¥88(ßw!ó Õ¬¿¤‡J„OæÒÛ©$t."d2Ù’Q0xצbMwäiÓyU,ÑHùšÅhÁrI“ÆaLò-âò âK:ˆ­ö)êd¬—îå#:VRTË?h¨öO2&¨ó=ËÄ@Ô¡à\ àQ‡@te>€‹°6¹t}lšëÞ_'MN¯AŸA'51Éæ*–™z§ÒWŽBu)R©J.ÉA»í°ºéïÉÆ ¬ù'(-•%Ò|S—¥J MH#üí2j ÇpÈ-÷?èñô›»*]"º7é}7÷£¢¨%J¦ÜbM›Êg>^òj‰t¦v†k!˜'™]´m2Xù¸½)äù}«i÷I+:'éÞUxz.H­=Ù•Ü[žŒé4†ó^KÚ¹½ºCÖž|ÿx™MͲń#YæC“ÔîgôÏ¿—J &—"ûÎÐE ûÕ<@©*5Ò‚¤íÒf†zˆ7„é%{¾æ±ÄaÀBÔwJßJÅyÒ¬Z¶äÞ‹¯wﮬ eRJ…É=B§né…³ˆèÔ£±]ôéFò&ò‰ÄF¾l|~oƒˆqªÊ(®Ú¸)’j!•h"”ˆëÝb—ÌWÍRÉ䇮$³¦F½)@QGo䣷}éª5z0V¶œ »w~P¬:ôï‚R¥F“0=)JÞRæçœå*îàÃÎŽ6©:CéÊW)%d¢ì–IŒ4 ÝÍŠRiÆöänä°¸;S^`9ûtÍ4‚ˆT­6qØØV"S”ì!ÌD(üG<íV ÈÅc ÆG¶ÛQšhbd,LýÔq­Sœœ”ñâaFqžÀ}ÕB¾,4NÖšÝyŒDšL&™Ž‚3qcHcá*ÂwÞÅëÆ¼Eò¾®äòi&Qåiai _$V‚c*=BTKÓ ^•buˆÜV'P™P”ì;â%Ì!›æÙ*—˜¶ðLJQ7Ü”îIêe€€‘)Q¹.ónÁ2_¬¬£¾cP¬ Aé´É'’diš ³S)Š7; ßwà#ž´p¶÷ú?Ëe‘ÊȘL—„b¥,¸” hœ#ûÀ»n¯¹ÓF 8Zì›J&DͧH€ä§¬Ro“Y¢"OßyP~¬ £Æ×ôS2 ‘U0©¸¡bA¦ª)Wlö@" .9†™0VÓ®–€“¤pðD£W‰®a€ˆ÷¨¹õÚžJNXXÀ$ž%sËŒ¢M4Kýã×ÂÕä=ÐR@ø"ñǰ‚ö=ˆ”5ïãA¥DÒþŽúA&áÞ„k¦÷zM{ä¨b1dzz¸ï#F­´”+@ÓÓ©òPˆùâ=ö¨*ÏPuŸÍ é:g{ºIŠïI®²i½ãpI.´®[-»²hW¬ÆHdd©ý—*K¼ 9@èÃ/ãhãèö¡ÃLQ£°+däåÜœ?! Aí–¯­Ù‰Å2£á6à4Ø €Â€§qǃSZeG P)HGÃpÛo„WÿA¹|¡S41%/(ÃnV`…ÁÈÖµ.âÕ´hèaŠ#!„*/ÔÎŒ5чÃZÐ}ƒDÄgd0@i]ŸÞößÈÐCÄ=ÖCÚµc£×&n|ì"À„è`ŒÛq€ÃJlÀ›1ÈÜß`Cö¿Ù…¹ Eç·§ùƒß­»Õv|røÙBhb0߯Åü|AÞ‚ü\\`,­èl}9S‡>4–I‘¥^v!a†^£„H ˆWÀG® 5ω1ÌA»FfT³iÿ݆Y ÆÑÝÙšBa𪀭肱ÿ”"qÅžž: æ£0¸·mÕ†›_`¿aÌ\xˆú›.,0F莃5sÔ8åi\–ê(PiP—ÙŽB 瘅F¢!A † ÚÝt/u§÷ÒFMùW4–Ýt$š¶ò/—¥ß’Q^£|mãëJƒsfj;½¶ÌSˆz)—ß‹•ÑÜÂUy.û[+GzЧ@I© K&V3‰¸àªU)”€8½­b>“Þít=xz¹gƒ£Ž‘W ¼"Üò8’gÓ ,°INóÊ©J—yus„hüÅp“Ãöp[%À²jªZl*ãÙ.<#<ÜÒ ‰+¶>¢Éwp t ={á È–¨M5U®,ÝÔ )W¨Bx“J¸pÈ€Z­šADfÁp6ÝDM8jø×P®VE°R¥q*-Áñâ³wÅ–ã BD½b…Ô¡5Uû7Ë(ƒ6Êß4:Iéj믈 •Ë& d’T£+Lºjh Š $y–î›zKÜ4h6ÍÇô Y¯[/L1ËSvÙ"`ei"ç±ßðôïªôÝðéFa4ØNb½ˆ DnÀ.8ÂmjKæÿ¦Mžç3ùª¥qíGÔÆ¬y¾nÀ!•]óÄC;GŽQ™=-¡)‹€RDi*`9áÃÀÅ(Öb™ÿZå7Ì¥ÊRËSLN,ÃT‚ï¬ïxÅ)·s°7„”ƒ,šÒŒ5â8 _xNŒ‚6 P©R‚a0 ;Dà{qjfîß=*HeÄ™Í"LQ+vp‹Œ^´óð+欜¹íutow&W–ð¨/o|S+L+U‰Š»/%ì‹ÍÄï­*f3Ô3·ÐrzK5»ª ”@r¸ãJPAêq†’)GÎÏ<‚_59w°ÖÎ×Wè—|Ž!Tòc%VŽM*F•ir¼Yr¥Æ’ ¶J•x¸- é3èq/!ÉT؉\’`…*©áƬJïëÀœb¯!¦J3GúãÑÀEíò¢ôt 7òŒîa!‡aÅ:$ã…„V(OÝ2¦~×¶g½wMD²Rõ’ãIŽ P(ã ìRKC±¥(¢¼? 7to1½Ì&Rk¸¡,µtWrv•b¥/d§ Ù¤”q¼Ý•J¨!Ƭ""6–˺U›J‰YuKe)ŒÅÜÒw£JX",:á+X5µqÒÔ+̶¥‘ +Ô¥0Õ§$‰f*Çe¸fùæZ¸ÛÞé èT q °Â7õUn˜;¶z€Ù‹¥Œæ7Vï]›Ì|êEx‰¼¡4 ‘ÍtÒBjˆ'ò É‚V¦h™BErpóáÿH + ]^¸Ó8#ËŸ³-? #DKÙmŒ œ„jï›óò8DkJçbK‹ «…G˜?ô²ÄÊÅ$`¢a˜^´¤©L8¥a'ðzˆ°³€5‘LTëw ÏÏ´Ø:±×ÒCñå”À°î žC“ñ¦cî¯hP(&6#4pâ˶|„YòfzÔ-hÜ©4fL’ãÀ“ŒQxx UYÀD+LëZw[íOÑÿ¡«§8-q×’P²cvS\©Ò{¥ %òÙZ¥]"›'Qäæ¡2Fzi¤®W;¥äDŒ7íʯlûÓ'EË!W¸.’A*8©PPJÊÞ¦($‰©åœ)÷QJ¥;ùåD;bYÚId)ÆìL%éKšÀ¼ ÚuGKŸ ÉsÛÍ·`RÀ ©Gµ&º^|¤ó!7΢$;O½/_ ?{~çª:i[%’“³&¸jà<7«[|]ËÚuÐ<«Í-ƒv'ÉeN&ºÉÉíÀÜUyË…D?œòú„ÀèÕ¤ØÏSéáPžÔàû‚8Ö´£QëhÁ—ªb|‚̓lM‚# 6˜f€ƒh«¸pø6Å|Ô¦¢ŒÃ#F.‰ÎáÊ¢Ú÷ŽVY>4ñy¯¬Âã$\ÞÖŒÍÞÂ,, Ú88±v M±(†ÎcÝ“qÌYó ( ‚ΠC«g7gçúp²¢/*²à$ÂÉ6‰`ÛÆn×ùͧ~n9¶rt="-/rHl1†Þ!„ãÂáUWaaÌF̧ßXÕ#=¨†8#4åíÛëÔdÏLõ =£#1‚,l!~¶<3D4ÂG0â"õÊÈÖLF“ £‹‚8ËíIàkë‚V¡®TÌSH¥iM,ä2"¥0ÆQE“‚V.ºŽÜ*œß^ZÂÍ$(Ã/c€£v"ì_²ÓŽM«°×“0¦4 6¢ÙÃ1Ì®6»º 4>¤ˆ¼ûY°õÁ±qM§7×:÷¬«ºµ<@–„@[#Ä82g õº%JbP¯lØã2Ũ ý_Wâ•ÚþìôIxïÇ")-Òš^ œé åš2N˜•I¥è$;±GÍf‡’?²…/ž8, ÅÆ]Va5ég%ÏJD¤Z Z£D* p•ëÁ‡÷¯6à ÆÚC¡»Ú®Cx$¡,N%x)Î$ó@RÎMÆí?üVêâ;Ö¬í—Ô›vMTxî ªU&ÊÒÍ' eêÎ@¼R*54†j*å“… ·?*L”ï‰#Z+|üeþOòueÿZú5èÞ÷ô18º’I¼æQ}WßYZ œùÍ8åç\Œ%‚xÊ–Í|–4ÑPË768‹°³ÛôÑ_F}Þ ±wo ì›Hà»ÉƒÊ¢ŒòˆLiªÍ%”cãòÛ³UÄD}ÿ?>”ô}޽2 ŒºmwTjQ»sY)»Ú „ЩŠbP€çóT³Dê7/Û¸ƒ7wçòõ]»‘ÑçéSy.ÝàŸ-À]*»KÐ)Á!9,È„b}â@S&U/S¼na@n6ùçÓ¥Ø1!*ˆ„`.2d¶TiJ‹X¤“ü¦AͺªfΔaùƒzM˜K¦ˆó‰8Ç.<#Gµc³jÕÁÅø ; ­.‹®¼’ø$¼Þ9‚©|‹·6ž£[+•Œæha© ÆÜH•o ÷•S@·ÍÈ• ÚžU391†Âda°_›a¨(iŠïW¨jq A§RÉ|Ô´i:xbÿ+d  Jr¢»!¨( %­( LÆÔU÷]0»DÍ®‰+¯M5ª#8¼r@jP=ä¸ Þ¡å€mX^¶£*G–£û*ü²ÈF®éö‚'„ÇÂÔ2ðæö"Ÿø=ôüA¾tÇèl†ÄþÍxþìÄ/ÀƒûGº”ç«Û¥ÂÞˆ³{k®MÎÆCF=h)®zñmAÅûûÜ /kуa€?¯ä"Ï[NîêcW(ð¶àÅÄ€‘õ8ƹ<}Ì ^Ø \ôêg¨JRâFY¬a1¹x½êr×ÙœNýAgßA0_p‚ÛªËHBdå)Dz±6p¼œÜN)K#œ3?™÷ÞMŸ£Š~ŽÊ®´{¢2ï?E7ÁMüW8-;¯Òã’ÞBw3ägÍ–yÍò• ”é>¤°7V³ö}møêé¦V±LêfzƒŽLB…ËÔA/0G )¦1=–CñÓX^‚ˆ©D F &PJÔœäýˆàï7xg@£Õ­2º ¡RN1Û ¶{»!¼v7w>ë^—¶óÝu ‰I"3éK(ØÌ7²4@\ÐBµÈ[€RÉ®j ÅåžK®ì„LÊj«s@J•D%(ÓNõyë'L”y-ÎŒÓh0¶ ©nصõäêBµðÖ°øQ™'0ØÀG®QƒÚãN#ŽÙ?»Ù`Ç>0Ø`ªø‘ö½®Ÿ˜ÐX7q8ÝÙÔˆéÞ,á2¥2¤É—õ/!2¨”„µFãÛ‚uÞRÜÕ¬ÏB #ÀK§e+20Š!–˜F V¬>¡Ï–t±ÊIŒÈDøWlmÓ°×°d:jÎ#›*”‘41•dQ‘œq,i¥>>Šê9èúe2!4à X»<1oUAfg®y°ŽöM½D•LA ƒpý³35›>YqRÍñÌØaN× ˸GF~u²XæDXad¸ëà ϗu™Ælʼn€v1‘v{Ùeï|¨ îãd¾W]Pv»¸°uCµ¯Ïëg¤ë×M·4D–­dÔå[¹$ƒ‚h*;‚!÷¡S“ƒ=¬®ÔªRBcfsRV±( )“šqF%8£ð@…øÛ½UÃJæ#Zæh·Î㈒†ì@Nõ¿õŸAÍó-Òì“YŵXN£¶@ï®Y½Iç™Ð õ`g ›k@ÌÄ@3« ´eËYžÜó‹bJ5D¨0JaJPœÀk µ5¶š»=7ô—vdsK³ ½“™¢òHf·^w*FgšÏ®ääâšÊWPyÔ­W“‘¬`_C/˜ e+ãxWJçW¬¹bÃf¨&Ê,åspU/J•g`v¡¼ƒŽLÐB–äªú_ 4i%K&æîwaIÓ Rb' Ë÷\z:T«wG €è #]ãÑ/Òþó(^r[Ñ>•žÍÀÉ´ r$‹')PL“¬!9àwQWo3 ùýZÖßHîoÓVe„Ry,Þj†ïá+0”`œJªVŒÈQxo U%H«ê~v †­[n«£ôú™Èné©PœRÔ¥éâØE#þNÌ@BÀ(Ò›©ô¤^«»ºÎc Þf–n*Å qIqAn ç‚ã·tÌ•K~ø‹¶ éŠð¦šÎåj& ¥w€DJ³PN7à RR”нy3ê7U4€`.ÿH±Is…q]HeËÊÇ4 ™‰“bži/ ó·…*RŠXþxÌà Â6ù‚8!뤌ÜHª›ó, >/•›º2éŸ3›3%¾ §Ò‰¤¹s&jÓ([0$IK>Dz#Ó©TªB£ý °ÈÖ (KÞ–»¥= ÞN‘äó‰õȒ̯”hQ„Úpt"ÅFÈ$M•KS¨R•,«÷Å™ë˜Z…¼ÝÞ.‚›ÄK"LJ¬4QFª-íl¥‚R#ç*·]ÝÖ3a?zDÅ,9\gL‰WZ3ÀãM9ê{®½Ã®V¬NêÄ1e—áOËÙdæD#V·å¬]C«<ÔŽ¼|ÁëCÃh=Ÿ-ï°á**Ò,Ji£LwxÛ°ÀP<Û“ØEÅ 1 4ׯíãÜÞ<í(La€…¼8€ƒ]<-=»PíÌ"ŠÃ‡a¡Wñb,úåöçû<:#—ôŽ®ößUÜÙŠ~Œy/$‡¤ ô¶é!ŸHE$Àõ¨n´õdá:«ÁÒ0îÛåÛ¹ÈÒyú!˜Ì2—€[ö³ý‘×O¢ëÃ$™Ç#h (¹!*Ấ)Gn¸ö[ª— ƒ EØmIjê{Ÿ-˜M•#@«ÍU"7î…À;T‘«ø¿¥¯á£é1,——x&J“ÀV•fÆHèiU òäâAg 84ig°LföäºË°â>9 •žWÀ}³‡ß0Ëѯ€Zv†!+kcÀEŸZ>L!£ê#k&ì}^#‰ŒS,4@^&(úõÚs¦ áfÇ{¦3õËMã+?ÐŒ®È¬'`°ƒ8°û-[75ap¨ˆïö0µop×Gjédd+:-¸aŒ#Œ 2ïÔ85„Dx²¨"Td1ÇÄáMÛ£3û}ÙÙr%',SGjs°ÎsRª5÷uäkæ®Õ8‡Ã2P…YC{qÀåí… 8C,òÖ ôÔ-(2c,1)1¼M: ¦Ê8J*€oAª¬è <󳬄鲨–G*ƒÉÇ(8RœÜ ¢zrõÀ"â Ú˜Ú4@yJvL„IÊ1Jí_ÔVº ÷Y¤«¢‹²ƒ®a ]C ÈõÖ 9ÛÝ“("gy6$³£QÙQGv=»Uë–®.,V££rÏ^Iz‰\ MYçÏT€¤Å P§ë!¹ù¦]ÖAwPTÆW-D¦1\“8°È<ã¦ê/@q~v%™‘$4Ñ@Vø« 8i‡]jþ<ÙÚщÍå1a†z±ÅŒÑƸ¼‡ˆUèáãjáLàÃÄ"šUc˜U‚Ôúy"¸8¸ãd$â„Pi¸FšWm»S>ðCgD…Âqsšº4XFI€I¸G÷¸¶`Ôwj;§°Âœa—”˜¤Øk *4¸Æ¤íÿž°7Z­“>VÔw^ûMT¦@tG¦0qNØLYG T¥˜v3œîv÷ó uroÉ©îù%ÍN#‰J£S@ Ó°‹Åõû¸¿›oI¨Ó“Z%z¯pÍÌRø‰g õ&dƳñà,-Þ½FÝëãv‹¸÷š!º÷‚D¾s3_Òà…dá(!U-NLªîn2ÆÝRE»¬¢5”ôåòfÿÄžd+%‹ÌÑšqÛa*qú÷j#º*TßSÌB•µ3%<ù$öZ¨c)6í0J¤…†”B¢Š4£±ƒƒ…Õ\<(âÖû•Óܤz_Ñ—I?G[Å}:5ºÝ9tB„&]!O:UÉßɬ–êÈÎé|¹RëŸ1•‚¹ i’…ˆÿ»koËÉý‰äùäņßÖßIÆät‘ÕRyi‡bÄ]¶àj¬<‚Eé»UÃJeËä”<Ø‹‹l¬Sv#1ô£eNZej‰@Gµ®h9‹¾œƵ 5Ác#\¹s×Àyˆñ±ÇÔ jï¥"¯°=ö2ãïø‹q†("„G*׿Áœ,³ÿ¨Â>êkï±ÐNͯ‹^°aa|øg­¥ªIÌE-òl ‰R p楩l#Wc¨t8_ºnºfÚf6p”®̃1§¦e9‡wË*Û|}zJUs„µ¢´ÒSBnî½fŸ„iEv>|ƒyf|ØZš·ì³û+þ™=‘+KuV½=ç¼ñ©F`a0 ÔâSœBê¨Ô|>áP¦&þÔÏ¥Î>§·^Y7*k-$óbߨÅ-V3vÄÿá”V­Ë+~þ”÷’äLdÝ#¹’¥ä«OuÕ)¿Wžb©`+›ßuç¨8òLr…ԲɚDkQÖxϸU­ó²rapÄ1BÁp?psÍê5î6!<£KÆ-ˆ?Œ±¥)8h ®T 'b, ¡8 :íã,;#C1­‘ÅiØ øD ùƒÐuïæQè”^ï !ŽfPÔ¬ )±Àý3Ðj°Ù ³Ë„aÚŒ˜ÀÀÅ»\€HýsÍ»ø Ôð˱KúáO×.© Ø èì!@V6W3Á‹u‰aÄt?ÏÇ­‚ÍàÚÏg³dç'ŽX”ÈÑöe% ßZ[ùÆ +Ï*و咥0%ÝTÄvŠl_½¯bsîßU¨>CÄryäÅQe.Œ#8C 81p‰$¡­‹‹çOvïßI<¼Ã šK¥Smø£‹ ã (‡ß§`ãJò¥™ï5ì»èÎ:+<qežiDãU0<<ã[<Ä-TLo,a‰œb&>b âï_¯ Ú:¦fA¢Co¯òƒÛ§*YÃN¼ò‹òå«ÙÒ^¸È`¸´9!ñnbÒBC ¥ÆlxŒ°&êÀ=ì w4¦km0â@™ð8[0zÛFÝ Ç1#„ó6¿NÐ5fm{Åø=5–,عz…ÀªlJŠ-yòüU””`Ns&Þ÷a¦øÀ/˜ÒÌ÷ªé£&bY2ÁM1+³40U{v8R­>B̉.t)NŽP]ÔÓûCJ(¯_@N ¨\Ä_@k?¢LAf˜ Ž4˜NôÐ Iƒ‚0àc÷Ö ã3…´UÓËI’)BlE…ˆa™öØA€ÄòÔ+ RÖªYÒb 8óVu`Ãði&ï@Iç7ÕR ]ú•Ò©<åÛµ;@šn€™ÑF H$5à‚àÀ¥Re ·ýø^JߥµhRyEoJ/S|ª±ÁAŠz‘NO%@ïBªXêþ§ÇKb5—ˆÔc0“«#üœ-³1Í-)eØ.À'¬­R]á‘­lô£Ú ׉TP„ÒÍG¬( (ÊšŠRƒˆ<„îáä½á>æ±e¼]ϼ—žjT½Þ‰zõ76Zjµ23f‚IJ°•zö@J‰€Jüá=QﺄÀ9Á&Êá%>q—ë#Nn)Fš$fF_€hùZ¡¾Å\&æ–£8ÀÆõ¢Î"Þ5qfÙ ]T!³\u~êTy>Y3…šL‚ ê¸;óËÙ­ÄE˜÷ãnQT«­{Ã; ¶{³¦`6–[\D¡ ‹jÍø€éoB숋g«eùèÎã“YiAX‚‘ÐY¸iL¹óåi\•T!\I§—×8¡& Å4á'ýx%¥…mqÝ)ï“N€SÀñ–Q©±ªn)ÀsqàÕh¤G1fpkm.†:C½ýNPΤsUhÖâÊÓ–²^¿Éû©kÎÈCŽPîÛÒ¬ •𠾚_ÉDûé¶K1½Û"l|™4ÅJu‡KP.ä¡DÌõÒTK&²¥>M—,X¬7Ï?_MÎßzH¾ç© ÒØ8•XP`Ó±;‡#= ®o­²„Þ`jµqªUöûAŒ‘ŹÔ3ög«+_šxº¦ýÌí£m-!T`)k¯JQ™²qå¯0q«Yzõªv6%Ï$fƒ>t¨ u¨ u²€8£†q€”ðzx…â.â` £eZÎ2ËBtbYÅ)&C @娪îçƒ:”™mÝfbæêVÔGØ8[¾¼?Z¶ompzy¾÷éß{‘w&»¬‹¤2’¦¾ðJŒß- @v1(^±:…)R¥Sçh÷:oã]Õ*õ›Æòyqõ  º5B™{€ `5&SÆ6=ŒÆ¼†¾ÀQ›7³œJ%.¡´2°ç¯iÌs´qLÊÔög†yúžB,<‚¯ú è¦Áµ´'l=ÙëWΣý‚%@§´€^£À†¼Þ¥$îô˜¥8¥‹©ºáG@qYÀãÇ+@£™tëÁR ¯/èà<,ȤüCapwjäÃ* EØ0ÐPв#ë±é !øñä> b= Ø„Y¾Àsâ4kpc4:”x3‚™hâÎ —啇»1@à 8€5t£÷éªäj!6(1€c ë†+âƒçáÃ@ã«úy„Qõ¡ÛMûÀ¡\™ÝøX÷zuQCUÿúUÌ?¯h{«ÒD#L‡ f4Ø»jK4âRõOŽ'ºùª~È)m%¾ÒÙ¤¬eМQP@V åS뀎Ź@tÒÒ‹¼ TD¹BXà@ii 0Ò{%Fœœ;b ª¯5§šƒ;qœ  ™¦ZTQR q0ÚðóÓKJK¸Ó#Õ3Š–ËfÈɧšoÅ ÅüßspHÒu¾×€€…§s+‘}%ò LÙ)ÊJ§eb𰳑͵Š$ÂDÙð|ÊV©R” 74‹"—þÏk@/5߆A1™™H­BؘŒ”nøù‰èæ 7¤Œã¾06@õ¤o‡J… ¼aO²‰aF”’Õ/TWï.ª‘Uø;Õ‚ÕÏM×òm~ïUà½ÓIÄ®ñÎoI&“¹¬‚LEÝ@©TÁ¸©±CHœÔ̇t[æB —”?ÒÒ‡fdH®íó>|Œùœñ]ÜM'¹ð‚˜ÄÍKÏZµføNç/U$’pmWp f»ÖQÒ›ÌqE SijeŠ,h%k:°Gÿ½pËW²ÃU ì$E†)£v/¶8¬Riç ¥RL´j} W}!ÄÌa×ÈÜéZ‡à6¤TìŇ³ŠYøGmÇac0}__Ãð³ÐgdÑ´1 /¨µ‹‡«ÿæá_ˇÃ;BˆÓþaø ½ Q}”¤öÚ|…~uXˆ²Q V˜ò£-Q#zÔŠŠõä(qà"5lšÍÁ[êá阳…GÅÄ” -(î¼&øêÝΕs 6€ià™Í¥—)Â:4Æš èÑ•çFš$¯Q]ëvJ˜Xhô ÚÔKyfòEgIç±ù.1LN 3‘ŒqX!3ByØ ÿ ›‹ÛCÈzE›^žr4ªM0é4 ¤ãiRh%4ÐÞcì”& [2߸Unÿ†T)Ti{&@.K%1ÇŸäb@TîžrÔ÷¸=¹±ðǯ¶=s•Ñó÷äî ˜b‚!€"+©˜ #^ú@êðBÜ!Ø1àÈ#€rÓGÈ[@âK:ľ† 0ëÆûuì¿`°?S@¾0ˆD"ÙÙÐjÙµl¬¬Ù„xÙ¢ Æq|³×¼[›bSíÓuàõ4ÿà ãí{:“:ˆ€‹¯ì óÑ©PÌ8ê"u*xtt:° 9ºÔ?ö0¥°`†&ın&Ö¢?"ú· )\¤’Cxë–ç„ã^ Ù{Ü-R¸Ã¢ÚŽÚ‘Þ €¾Ä®ÔµgñÖ ífë.®ßØÈÞ=Ãßâ63.¤[:çìåÃ=Â*bˆ!ôùãOˆp±±Da{EÃÔp÷°½åè6ì14¦Ã{SQaˆ\ìâ‡kgo`¿ãù§)í³±K„³ÁàC@ÙëPzqм-/—«Ç9)ñDiqâ¹f6£•håùÚì_UÒ”Q‘-0ä"yF– âËc (GιØyûiÛÑ6V­|jãŒÃq6Œ7Ã[>bã\ņÐuqD1 P‹¼Uù?ænü¬8¦&VÈÆ€³0 Ò¡•t²CTBx_n8ëðæ²XÌ„òÇ:€sáÀ^^ W°@èaˆX`wì±sæñn Ã"ßcV2>? >´®– Fì†ÔQúà=ÿ˜pÌ-Øâ«óí=‚<Ÿ_‡‹ð³ÿókûèÅôŽéè—Ó_G¿Hî‰L@—¥ЧÞ;ƒ5œKO¤Ò¹ø¦]¿.”Í÷„³@Ê<ÍÞ™d h_M=-^núJ¿]._…ˆVß[ûxæ—²õ/• I&Blþr°ù”ÕrT±:yl­*µJsFˆE Ó+U0EÚ`èÌ>.Wíwsv·b:.Ê ½9Ržðð±¥ œ0ë›øfï S‹ë¨9l1C›.ÝüsqógôÓ# „a†´h:0ñgDh Øj`û¿ˆÔ:¸;èâV¢e0Œg(Ë b¿^j~xx)Š3£ æ¢Í•_ˆF1Ð^¡ÃúP}º½›ÍŠ(‡üã¥yûžÉõ±Ö ‡{. ÀB?æó§¿•€Xbu¢§mj½`„pÀ0 Ž€ âíóñ·ž-­ª7Ï/ ùçcÌ:#ºÑxäÿþÍçK(H‡‡ªÄü=Õ·b†(f(6#õƒãùþYeeÉV[dh÷kÄD+ág‘ž¨„®Ú3u*~ʃ  ¸òvk5TqC‡}pËA‡*¾€ !][ B^ ÍþC¼[yê ͦoùÐl£kj'‹Çç¿å¬hQ1qƒøÿ%õËúXž0ÇbrÊ•¦C«¶bô „çx"禵 èîËÚQ½A‚”wàâßÔ@–ôF1;Ugàgó­¹µÎצ=íNûÅìÐ9Ž^ÖnV/xˆ x©VÈÆ´  ƶ0¡ÚÞB&Ë ™¡ÈC>#Ò§§RIG’qaÁ;«‹„i¤Ã€=ùkF² ‹‚(«þíÆƒAæÍM¼Ž h б†@ÎÁÍž¼[à6ô&|v<3çøde0D˜!‹¶ÄGß0îãŸádѳÖôÛÐÓGË_g AÇC ðï™Ð@p1¢àÚkA<ŰjüüiOcŠŠ(zºŽÆÇ„=x!æÍ¡k{íè¶bˆ¸bÏHý¹éÝÈËc†‹Ä¾À cŸÍèâÙ{Ætd·ÇüpgιRø¶¦uL‰¢Ž( í°×¾”®OQÖÏ2ÅJàe>,QE÷x5àv¢DkZPiiHn&«2$F 1Cw€Ã‰ªœeTB´×' ‰Á0Ô¨š< .j`ä ƒˆÒ¼†Í†MU¨;f‡´€uåüTxPÓ™AŠåR¢U"LÆiF”°°8¢‰TVDvïçAAA©ž¡d ›:R0ªŒÕdbï –QÆš”¬W8üB9|Dfó„d§N„­ñq'+Œ2´ b]úy:jHž£Î’ªL£ÌÄD_Þ¥ÄZ˜Ó’» xû\Åèu<@_!6R1œ½Œ1rö µóàÌ-3A1Á¦90Žœ& ~-jÖhy¦P€6[øUÇ1 °ˆ»Ú8°È@ÀÙz]ÿ›^úþ-["ÙÙ…ý´îô@2wnC`e·µP»ß˜³SPÌ,gùáÏñø¿ãø˜\0€D5ü>hü3¨X¼0‡ªãNê¶¹sÏŸ;{dJ/hj]›Í“Q»ôÏ[*!ŠgÏãJ÷‚1-Ÿ&±„E fA¾¼×€¾ÅÙÝ¿Zw,{ÃþÇðv\½ÜE©`™ }s¢9ÓO‹è8N:‚,A€sùñ×»6·±¢Šëÿɧ><ø¿±–§2ð¶$aÔ|ñ@k»±ƒÛ7_&ŠïR5êP)W¥hÎÜ’¼©p&ÝÄ0F**J;ø{X¯Ì¦ER©±§'@QIÑÙ$$¯PFpÐ#ÎÁ‡éµÍݼ~~6ðÄâ8xÖÆBXìuF¯À=Õl›ßÊÎ2I¤2¹Ì¶e4³˜%¦‚ŽbPšæþzvÉÙ‡'ÒŽ ¦Äa–ØÇϹåÇ.aí‹uBY·¸lqj6cË®ürvÈ8þ–½:8º}Þ›«~”_[ô¾êÞ¹¬V]9i¯(!¼JJÝ åÂ%Н©£Xõ\!«=6¢a8ì8v‰Åì`0Ü\"š¸ø"ê³}?ä–tQîùGé†öU¥(Ùˆq­)g´DšL& n¼Ø6¬Y_XÝò:`'x æ0Ø\&+@!™ÙëNþ°P`ÌcLŸ4ö‰c0 ,ÓÐHQ€Ù{8¾`3²'- Ä.ÞWœqeãäò¼à #þ(E–y˜0ê!E!&@lqCüÆõ¦¸¹°P9»QÁ"á0–,ÌàÅ ‡`,<€C¼YªÑõëáᇼx¸äÀþì˜-Z Õ &ø×0a¨ƒ0¾ahÁÑ•ذS:w‹þYX‘Ùx³|ž¬Ï¯é«Ûƒ³HtÑ´þ¿¯;X‡ˆ¹`ucïn៲ˆ£ˆOÿiƒo\âÍ™ª5ËÆÅŒ1mlÄ=áìˆû‡Ù­l`æFÏ ?püƒøØ¨vvvb=:kóÝZrí0ä-ìpu¸"ô¤z8oÿ0ƒ ¡Q÷{¶FDÕƒ!`ýŸ<ì.¤fAÙ ÷µbnCžo;PjÎÙ;ã­½µµV êþÝÝõ¥œD‚=Î)|+•¼’—ÊÁq†ÌI$AR‚ÂÈ,µR‘ͨ¢Xˆ3[ìÄ  5}_çç[¶\1fBèù°pzØPâíl Î”?Ÿ{Xˆ6(jùxRŸÖœ†6µãóáníÏ[íþ€ÚpË[ ŒŽ&‡»@ ójþX1a}¯wÆÞ†0Ùh`zNÌÍZ3Óñ y zƯϳeŒC¥ÏÅôãý-È`‹0ðëhâÏ]8xä(¢ ¸jïOÄu¯?È1ub»ÏoÀAóÎÆR(z Úøˆ‡ÆÞ†!‚-¯åæß<ÞºXõqБd”NÁE•;,ÄkÏ.êè#Ì;¾#c ˆbÚl€ò×?×ò·>Çü¿ YÑ8쀆L/Ç—Í, ãã20 µñü+ÇŽvPœáf6£¦Á”ðÇ–¼_P”̯TÞx¹4Âl¼ÙŠò%r¹< L(’Ž*W&–§“ÊЀ£!=ËS£GË=ÎO2NZèÏ!HŠ³Ý–‹ïájââô–%['99f(*Ü;tê%òýÜÝæ‚üÝòÈl´‰€ìÇ õ ðøsæÖF+b4¸òÛ/®î Å‹Sx‹p 2,Y±0úlêãâÙT9ÙBÒGªiñCF8À¼Zû†Ÿ—„uAƒCµ˜>÷çòÖh3!à×Ýn8„ .€S¸h>ïÇ…^?±,Ø+üÑeá_Á‚•ù+n»ò…‰j¿&°@#Ë–ƒÃ_~‚¶„¾áüÝ∱qã¦aÆšçŸ ·¤!øäÜ­Ûz8‚(™ÝòðÓÀ_ÙÆÜÉö¦T@xi^>Ö{Èĸ«QË€iLǶÁÚ‡j1üxè?ˆxØB‡Ú>¯M2«QêÜ,VôFöÄC‹ŽµüìfÈl»ƒ¾n>Ægùwk"†*ˆˆé@oo·KÄi Ó?ïðËçÛ÷5½bñ9{ÿKb\axA›ô…ޱ{pÃË{=úgMFÆCË5[Ü5ãÇ›XÂöögŸ_=L½µ~:Ž ‡ÒêÿEOo²–îÌqz !ÞÌ!ï°!‰Ø8¾–*Ë!Z:}zS—鯅‚{Á—_­Þkù÷¹‘D\fhÿúCâãÿŠÂd}8q ;p‡V0€_¨"Ü}¿5`ñý,|PG [[#Âvmr¨Qš—uG C 9õ;ÃÃ^ïÆË‹(ÃaꫨÆ>},ìðœ6â3ì˦\õîðÒ–{J"m˜L%ÿ)ÿ-C>-c;d¸¢„vË€zÜ1jÕn Ÿ²tSˈøŽOÕZI¥¹bnA« äáÂÌJW‹ìhX GZø?³Ä+£fµÎ »3ŽyðpÈ)˜s|¬ž#¡È;üxäÖ*Eê4lƒó°"Ù…ÄGØ<{¬=‘ w»ÀkÜü,r³Óœ©IÒôÆ£Fq§ªw£ /ùž)ÓïCø;e["Ûô„D;Ù¹écÜ('aožmî·ÿÙastropy-0.3/docs/io/fits/images/Blue.jpg0000644000175000017500000010535012243255342016345 0ustar oleoleÿØÿàJFIFHHÿáExifMM*ÿÛCÿÀ è"ÿÄ ÿÄX!1A"Qa#2q‘$3B¡±ðCRbÁÑ 4Sr‚áñ%Dc’¢ÂÒ5Tsƒ²â&Edt“£Ãò„”³ÿÚ?ü!UJ4ÖŠ‰­¿Zœmôx_UÜôž4u×ÏÎ'jªªŸW=ÿòøxdsž›$âÓä+9{ªËøóÛ}óà>ÿã¶íêsI¯~tñïj3Ëìä>î›c½;µ g?gçÃÂvÎçvº½§Ý9}ùŸvÉT¯Ðäo@§z'? ïíuýýv•ÛîVœ~¶¾Ã×7XñåâÌ¥‡'y l¶k+PãçV/¬7ÅÑí×èa›Þsè=6ЬieLAÖc¬øùçg˜" h¢JiUÒAñ˜üf“æ3Ï-°‹zžR¥G#@ÝîÁ¤ƒ¡ƒ$ë'Æ ÎÛîÞù§_?Ü5öt÷í²õUSÄþÁ ?½?~͵S­'îøìì·áÔþ|5Û;¢äþßÝ—á|å?þßs?*³éîϮۣJÊ'ƪ…w(¯‡] }žYì8\LøxÏvz@ËÆ CÕÙº¿Gøûc>º{g-…t½m@ªŠ¬ÐŸIõ¸Yæ œ³ÌôÎ'jWݪx#sû_¼'®ÂÐÖ^ïeî’w2ÎOÙÊ©ÏÂs×=ŒhŸvšýF;ý>ΟwÃdÐOVnÒ`é™óˆŠgã&NC=‡3X OœÌLú±œO«ö¾ÉÙ²uo)ç»÷Éé—ÃîÙ©ÖèÑ™ Ô'†2X'Àä FD™AÛ5#UÀQUDq9uwµƒQ Aš†@FÛÒŽê5çêR ÓÑ÷TòŸa1œežÆÕHÞÞ;ßøÌ~}û £vS»èÇíç”éøùiã¶©"TÞªžä—û$j“øuÛäÙSMGz³¿×»ï?køGLçcj¶–ÈPâ…Ò©5IP"˜a¬‚ ̃‘Ï2?ºØtÖöªNìê2Ð{¦‘ãº=¤j“­šÞ 4×è¼ zø ÷o c5SYÐÞ}Tƒ­©:o| §(;’»Ü(ûp) AŒ²«?/oŽÂ}®üéùÓ§³¯¿b\ÓWw>ÿxø@îçÓËøÛáKqF?ßÿ†»!Üx7ó<ç/Ù‚7cÀýä®ÿìýûNõ^9úŸ™ðð:í¸^@ M&€:eå–ôœ³>@ÏwmõkÜiÿ›Ç¯·§»eÛwYÑWÛ?tÎ_¾#dÁåšòµà2ð&2æLHD‘1õh×UTS¿¿ët˦¾>>^ÜŠÕ4oMPh×#ŸÝùó†Jª·«§õ7Oþﻤ†ÄUµþ¦Qçáçûão©‚¼³ ûÎÃÑõÇÛÿñˆú?ë¥ð§øìÆïîÕä#?ßüGùmõTïcóîÒ=š±Cr܈Ìz2@œç§Q2:‘¡#b7³¯túþŽ¿»ó1ÓÙ'ë5?OOg¿må© NÿÛ9Õ×­?g¤DOM]mÁUSèÄ£W¥û©ûÁ$yô‘–ZSý³ø ²º?JÍQ: @cÜ e©A“iªª{Û‡/ðljÛ.øœ°ªª÷­Çq5~µT•õÓ_†¹ÎÛ7¥>5oF‰U ½¥á}úø†pâ’UŸÒši$xå»LûúF¦z””th¦½ØI “¥`éCWˆë–G¢¼¥[Õî„ÿcÃ!ìñü˜Ûå©Ý¨÷FFçûߟ-ŠfíË*PªaCZyoï’ƒÕXÁË8 œ÷u3·x•èÎñ dg b#»Vc(wM^÷x§¿ÒïÞóógc”gKZ{Çtðwsõi3–G(#2"'@6Ýû_ðë>Hž™é:å±ÛÅIüáPʃ4 é½ú|ýÞ¬ë‘$Ž©/Nå NdæLd4:ë"`A#S²Õ5R·Š1@ý'ÖçÞÞˆÒ ÆBsÜÈ›«¶¬Þª©Rˆ¯„‡sÇÖ?˦͕#ÃmÃÜý'~ƒ ŸgðÙ:×t£xÜH‘¨òœË®±½žôe±Û½L9bñ5QUÃYº™pV«ôe3õs=&6û—mOzš¨«¦_õL/¼·Q½.•„»ÿ¤­>©*|Ö$DAñ €YÔBŠ“E)£rŽ*”VšcŠªªø÷z{ü´Û'¼Ò‰û úšh}‘ç®S–ÉÔ¥ôÊ&¢I“#¤ˆ™Þ™“ü4tÞZ¨*;𙜎žY’4ʤÆÍõ,=n_v~Üú~è;ÖƒÝÌ}XñýŸ-”­|Çs§ëyŸÙÙé­úìÆËx°³yÁ³âmjÞp™«Í+fUÂÖ¯N³~e¯*åÃÓô? [3·[ |ˆ:|§ß¯±nZU_²‚3ð²G›ªšùdÄj¨ÀÑ1ïÝ:ì†ïsyô'GØð>9û`ç”g²áJSQÉ«,¿gß>C<¶r¾=³Ü5 ™†íÛ´I©Lðx‹,#Œ¹Ìí4$ær8–›½êÁ¦4:k»¤ï=™À9h}‰û†È¶®—TŠc=c<ÎyôŒæs9&5Û•¦’`Wáùšv%EP˜€¤éÐÉ‚Nf5#?xMdj99þ“—\òÏa}7¯žŸ±ìøôðüv_¿Pèûÿݶ•+ºë‡ð#t>·«CÖWìì îÕ»ÐýÇ?ŽŸž©R­ ú‘ýïâ2Ø–Õº}é¿3øÏøÛJSMÐÝÏzsÐ#ûÓëx™AÛz¸Nk®¤ç‡=¤qH9~ÔŒý²|6KŒw>ßç¤ï{§Nž{b•·«¯¼œë¯Â;Þ>=6'†Öš¨ïÔ?ÞüÆyGœž»-óZu7âR«jë¡n~¨ýÇÙ¶¬éÍnçêýûßg]v#’köi_‘Ö3éùÓmëb+â×ÃÈÍJ‚|½j~òdë ›&ÕHUFý14g¬U—¿ÃÇmVc¸bª '@*ˆ2fAƒ3ìàŠiÒ‚5,ÙZÑ¡Ný ú%¸Sýy/†ºl5)Õ[º)è"=Êtÿ)=62»z hrƒ’Dh5dñ‘³£Kb—&ô‰ÐÍGI˜#\ó‚Y´‰"KózŽ¡Jª•­ÜU'1ЀAœô3T³ÓºÙ(¿¦ÚxA#ú}|sË?•ag[êÝUKt€§s4g„ ‚uÊ‘à`˜ËjÆå½K…·hÜõ78~‹MÏ¿ÂsÓ`ÓoÌoÕêWD“Gõ¾ß³÷m†¶Û„ŠkŒŽš™’ Ž„éº$vu±7AäSUþñ˜*#¼~ø0 ÁÝŒ¶ ²{Í{´~„fcòG¿¦ÈºoïvšÒ®ºõÓU~¹ëò:|6I…i5n›UyRw;»gðŠª† 9FP»2®Ü£Z@äÁÅ"Í)*vf)AÎUf' Èg¬HÊSHiÜõ¿÷ø“×aj§ÿé§¿ÙŸY?¾§vžíCÙ_´~ïðÙEùÝÛ}Ê*OvŸïÿ ³ð×ñضÔð骪ýxÃí>~>èÛt—MÑߨx³$Ìäz`Ì»¡"ÕÕ4¸R‹…`XÁ¦¬ã<΂I;Ð gžÅÔ™ÞŠcÙ¤þí?~ÈÑ2{ƒOâ<¶¾¿ú¿¾ŠG™õ„Lê4ñÓ×Xœ¼3Ù*…I¢Ùnm|×N k})¯ n|á¬ÿ©Çß¶­û£ûç¿çÝÏ©ðÖ3Ûîï3Nííôê§îø~*î5ñ£îþRt¤Ùj–u¸ªe^4%Æ*«™Ç¡œÈ§Ü`4Q~ë#©*zÎ@‚&tÞ Äèv;æúÖMÊ´pÅ-IJý*), ªð}+}%Õ'˜sèÏ`Ü Ñ»á_ÆYýúùùì ïU»Ö=Û)»®î¦73×÷åùÏmPþ”œùxiÜv“å·Å¸õªßßÎYëËøë²"šZKà3ª3S-Ð;ó9Ìe—”ÀêB®M9gI$gÆ"7iŸPdµÙF´Ó1W©¿ëçû>ŸfÚ.ÐeUFÈH=A1"ÎYu'‹êSMó?kÿŒüFÊ©IPï[ã‰ÝèÓ(ã1|iÙdÊšî§ßûs=´=vÙ­»äèÞ;°OV"¬òÏ{3¦~ÀØämjPŸz­ÊÀâîJÿÅœ~sЦ”éF„êM]ú=ü/ÇóîØÊX‡Ìû´J”ÿi`<AP˦B‘©êèÍ…oë¡þæf@ ƒ Gx 2$ÉlM8a’Ôn¢hß¡/SÇôß«°%“ZTSB¾‡ƒ¿EÅû9W—„îç®Ï¹E(I.-Ž*•¦ Ð©9Àým«³í¥>bÝE)ѹEjpèÑ_K>?wïílàæv¶—&µ¼b1(­';¨Yd•æ•@¢Ý|Ì×úfFì‰ÈìùÚÂL¬t-Uâ¥q æ·Ñ­¢M“Nf}9+È™tå+³ɨµUP(ÉMøˆé‰õ§{8Ó(ÛF̤É!VîáŸJ h2×Ú7r ¿,ˆ¬k_ïêxYe¼b‰'Lµž›ÝjIý!‘5ç°#\ò¬k1NCe]F „qd„¢NFtëÔ dÀ×IÙ®¤]TÏw*izHÇþ?€Ÿ~ÛTʦMS& fziLä)#©ñ"Ne±d‚É ­$µ ,š¥ð•),L,†_EbLA“—ŒÊt²Eõ ¿ã*¢¡&Épš¢V[ÁC,šôˆ9nÀ¼ëÜý¨§ûÞ_yþ; ¢{¦Šj­:÷ÈR±ýWûøÙä†Ú }ZF1ÿ/ñÏÏbÙ«Áúr+¹DGDií#@FrUUM[Ûþ¿Çó¯Ý± ¶ÝjDó2N‚g0 ê’=r×cPmNíRE–„Ið ß ¼ÆÆN» çWÜâ¶õ[Äu¢&¤xuËÄÂûƒÄýßÃa8UYÿþ;²5SE+ê2ÖzÒr903ÛN=;´wþkËû:øôñÎ6#x}žâ™L/¿ï¯†ÂRåÖùÝNŸo§_S¬Ä{üv~²"½ÑTEdQ¡yQe+É ’#Œs>=R&aÛaKî]ª7Ëb¶§J¥¿Ê®*.š¨3äŸ7ú;–ΠÇ&ñ¤u Z3MTƒGìkÖOü6Ö§”ÕP#|ïÿ²á{õËó¡×Óô¯ïw=ôû²ýã¦ÄÕU;Ôw7?>ó§†CÒ…TÕ»Pÿ„eñ«óåe§t Ø®7zç¥DÏ‘óøm­4Ïô!NTe¨“}}]NšõÛjTwV” ÏÔîøë;Ó—ùž€´“[МwjWÈ’#î9þÑË©ÙÉõ¹:jmJ ×] %ǯwôßï{3ÛNF¦µoSIQ2x¥ Æc8ÌkÐM¤«áöÌÙrtñ}")7ˆO„H9’z‚&c.šlçggE¼=¶ÖÐ:[„9bTX”•¨=\ ÒLĘ0 =6|½«EVÔ§oA¤Ua­90gÛ3žÖ.—›ºô¿A¿ºæádxƒANs¬ó"s0GtvCò4ÅòÏÛµâ×;$`ç°< •Öõi¼_¶_ßZß³*¸_³öW._çG8a×úãFƒç¦ÞÂLO5ãl#S–+ÜØY7VÁ¼$.««q[4Ñçÿð®þ®P‰Tv›kíÖ¾ ôŠD“ ñ¦DÌ“'JFq3´‰ 0úÛeâ/ÅM UÞª”Ì*’i*ùº £I3PÌFÝ©ònÄÖ|‹Ä—L ÂûóÆŸj«}òÕm~~kíÎ-­î¬EÆÞ¿ÍW;c‡%ã7ŒOd š['(„é£ÒQ½ßÓ. ^ϳeoè½jmí&ŠÒƒYB#- ÎRuŒ#@ÎÔ‹mÄ€­A™Ž¹ׯHŸXÌ“¦ÈÜÑáÕU* ÍÆÇ¹ÓígŸÇO»¦í+šsÓOîeá–›"éVbf:jD ÌÅ9ÔVšªäýTÆéÄ™&2ÜÆï–YjvÕzªôY~·à>>v§`ÑRšÒ5*˜+©é)NI2H8’zùˆŒ² ìJÊUYª7ëÝôŸÖë¦q:xe岩«9Ҵξ[Çðéá¶Pý.ï—ï}ߙ؊ªª‘ÖtÔåç°­Žð®cìü;ßã±irÓLO]=nºï}ŸºvOvº¢œ½¾?åîÙo¥R×:ºjü7 G†÷ž[6ñóîÐ|»ÙýÔìj NtH ú™H:§*N}33 Ìlªµf=ωá3ïÛM¶Kö¦wOÆDOïë³­âöõªÞ®â÷BLLަs É“”žo¸›âªø·k»ûÒj"nnV~åUd£ÇpáÚ‘.Ì™3–ÑJiïw³øz_φ›P®ª·ª4þŠ(ϧŽ]tÙ½iÞÿGÇ«O­á"#{/Ᲊ/Aß*O‡•BuÐw§ílY[v4™œô)$åáîÔù•JuïnÓùåðÙ(I=ÍÕh[ѵi…} øÏ_¼ûv=uUQ§ì~¿OtÌìð-©[ƒÑ×î9p?Àÿª-o«D«CU¡/YÈô\(œée1¯ªsïç´ªÖÒ¥­{Š'é¨[¹Dî±f&|£i |1Äéœ*™WúÃäc0DÎ}<3JíØ)4UumZ§„ÞºRHñU9ñÁàÇÑgRIªŸ “̲•5mvº¢Á³µV)¿_ŒQKAõ(·]ÈÊYnÓž³æ3|/o§£o|éU™¬ 5¬š_T9AÌ}Ý4÷mdâw]›7½Û]áK Õ°nâêÙÈxéÚN•us] P]dB÷[c£6Rô‰¸ävôŸä“ü ¸7äÕÙm“ÛþJŠâlbC®iÃ-‰®7E]!ÁBùv 9gšZÉ/´fõgSÁ(.Ð.»µ,EÚ²·+R+Þ=uŠ(k†Ø%fµÙ®ãƒddÎZÚ´w<›=ÑÈ<[fÅ=¬â§·;EÄo¬ý¡_š^;AÃN.¡ØÄwãÏ–On¡pà:t]^å3ôû€Œ¤uåë±›WdÖ{;5,ŽÙ?²¨ºòÚà—+pÀ"^®ß€¸æCP`²zz@Ó#jrñ‡¯´xvVʬéExU"Ý#ý1Æ\gñ&EPFgÒÏ“ ì[PÅ}²U‹ïõÿ:‡’mUjéZð(6|D®¹˜ <ˆëÁ(:0Uë´ SxÃ+¨Ú‹Î.¸9mmUeÖX¶ãôÛs¼¤æ7¤g4™2¢1GcøÅ·flûnG âû'¹âäpÝ¡›cÏæš8ÉͱÅá¾ùØ7¦Ú/ß66ç92I HÐÎÜèá4誔R&„UÝZiOéÇQ™ê ž†vjxÜ&²‰ÕFç«¿ñ§Ç¦yÆË.ÙT'Ã=î/ŠIè¯ùuØJ鿆Q$ýˆ¨ sÿ€ƒï?¬uùD鮄TPzzÏ4 T¤ƒé×ý‚ öŸÖƒ(®ê©Z•ïñ-¬+Sö ƒ×Rc-­º†TIMÚêIdêêxKzÎìiœÁ×-2“*«{½§êNƒüZ{1øìZÜŸ+¿œÆq§A×(éá³”ʪü€øþgîÙN4ÓE[ùÖ{”ygþ?w¼´QYÊÈ¢g+*“j(OëUU_D‡Ÿð˜óاVÇŒní&ª°¹Z®­ïÙ¸ ,ÑûUù'È8ý-«œÀ˜Ì–{­ ¯†Â´¢ƒëÑ)ݾ¯Cðˆð2¹Z§Pw…S–D‰éã”në”k°¼wsF}Úòµ².“ëÚ4 ä“#Ú{ÞÑ9ìz^¶ìt3DÇ·Ë#¶©§OÔîeìõ]ÏmJtÖ{´{³ƒîÒ|¶pQ:ªâîÿWQóž÷Þ:{uÙÅ»5«ÔÓÒ}WO„Áü6–Zíu>4¬QR¤)%5ëoÞ!Uà?.4ÌIž¦Dm'}ÔÅ5"•tV¥iñJUK^šŸ·iöÁ¸ŽêñS'*Ð1É7à)Å)ï+%ɘëâGM­ÌGØ­Ó#p­ÅÊÍ[K̲AÐUÊK$¹DóçO0z ¶aËKW*ªÖðÁg**"Š| IHúe–_ƒ 2H‰02êvîì#€~LÔö#Ú’ø»ãŒ=Û…œ[e˜e¨:·õŸ à]b¼p³†ÿ5¹µ–ì囯d¾/ÍÑÖœyhºö¯nÃ6üLéŠm°}…ŽÃj0amµò9ƒÅÖbùµ³~m×ÎNHwÜóù".€9GÚîíÖ•ã=QEyìÀp´Ì®" ²Gt¦YGSv¥4¬•[µ¦¥R3ý/¬…Zú¾øë=†¸¥‡/ nÔГ•“ͲNRâ#ÅŒÈn´ý’D#í6“ÜkMÕ¹åœPwÔ±9qšxß„ÃÛ—ú!QÚ.+r~»0 Fe«H€êI›.Óñn.²¹aˆ±rMŸð8YNëN• Êë 4jéÜó™2ÈmÍø•£Fv´¨ýW(,íÚŽm‰¥Â)4–ë ·;ÌK è8x=o Õ݃¦Ð¼a> {ˆoUàü<éWl6•Ñd¬mWš+>¤¹{o0‡ô³ç]ªÄ­¿9Ôk¢’¤•;â‘@Žé§<ã.™dNº·¶¸Q4;<5딘8ßM¡Ec=ÒLä#YóØÍC;lÞPš-‘rªkqªG8éÓ¯ÃhíáÐfðÐSÜšRÝÈNìå Ôõ3®S³:oh©•vß· ®jSS—³=c¬e¶Ž¦µ(î¡Y¨åã(‰ÿŠf v 'šP@º$H&"Y#( æ<ЩÇzOÃ^‘?­ãžzg¶é'J.(UÅ™U £6µ #§Ä^C©©ç5i1ÿ¥©ýþS>[bªÅU ºeáÐôÏÝ®ÈÇ©Ò?qÙ.\nwxše¤ëŸÙ×_ݲùT:ùø¿aÖFšÛšIô}@“'!1ã–^™ŒÒ½I×ANS*"¯Eåöv\SÄhcú¾¾Ãþ#ó;JUîÑNFŒú϶2üzG–Úpû߯å”O†½uÛziªTξ½Ó_ÏñE5*«»HN½Î“îýo?Âv9>Ou:¸”oë¸ô>^¯¼ûöTÎþí)¸¿¹Ý>r^²W®•7Ä'HÔ˜'=D€'(ÍáÚ”Ô*™Ï¼=õió’F]weœ¢ª,»ÃrºøjÒTHôôþ€’'ÀæD‰&Lm!©eÚ5©GœZ¸Ù?KTd" ˜“LÀbµeúuoŠL$Tžkf" f):D“Q/±ÚÔ £ýB¥EoU¡P Qe{¢±Ðƒ˜G”eã…Ù ÎKÑ}UjE'.(œe¨:g™ÎHëNÊq®eÙuï²laÙ¦ÚýŠ,¸–ÃÛ"¯îJÝ,6ËE±vh`v6$Kkiµâ›“îñx¼ÜbzçµÚ]X.ŽZ]ê*ÙSA®±ºJ’$q‘é0H'>‘—7^œ²yôj(Þ£‰ß k‘2'Q@Š£]¤6›kk]ÂW¤šïj^6Mï!ŒÝú;Ÿ£/wÌÄIÝ›ñ&¥+%å£;o-V%Áìxµ¼KŒé¯fÏ>"ZÕÌ6Éáшä"DU]ò‰sˆ°5ÙM×Ê~º>„øõX:eÈ3i±Ü‘UV¦…“s‡ø<ÊJz"ž™Ìi×Ä´&–e£•(Nƒ¿é@LkÓ!—†ìxw‡„ý¾éªš~¯‡¯¾¿ÏIûöùª5V¥4úû‰Ïø}½?Àìâò×p·%A~€YÛ¤ÅvÖ*"I•:>B 4èlˆúpÖdlÌÞªQu•YUÖX…U_H²±¤àfA¶´!Mn÷E,£0NrsNdfÔ}XͱßtQûåÒ ‡_fÚ(¶î»ô{`é—ëxõÙ$=u½´ÿͲÑÝRŠê*nG…êà`O@¼·ÕWû™ #ñëá±¢=mwzûöA§ ÛÌÕ§«PȈ'È@Þ ðÙ}íi÷ŸÏÃó;$‹qÍ’f3rÓÃ#ᑤæEUÕ»Ó¿ëñË÷øl‡áU$ùåPüô÷ç¦ÊÁe›Lƒ)¦ eLÄÌŒ²3áœí¯wÕ¤ïå§]|ÏO»á¶v szŸ39~ïàÏgV¦ªw²˜˜Ñò ÉññÎdg¦qêkIËî¦O´O”‚—¦ç4wûã۔ѳøåêj®¥»•ÿWðüûô;<·U½Uw­s5(Ìù¾ÁžÎìÆžà$údf3™öðÊb~ÎÓkM¹Â”‘LWDI£ÐÎpA1sŸI½§,›$nÞ½«-ú8yΞ€xÇ¿ö"ϵ[ø4¦š­ß’7¤áq”z³øÎ¡ÉÕþ¶ÃæëhܪŽâŠNj'ŒA"dS1&Hˆ;fÑxl’¯êq@‰Þ¬ÇA–@‰FTÈ$ Fî³+ÃvtÍû6Êoºú9C…º®¡ ùsžY Æ‘&DË ØVÿKŒQyEUSY4Ñ]P¨kÓ_»R3óÛvŠ¥Qr’*×ËŽ' i[ÃL ‚>Õ™…ð‰Ä6zÖ©F¬ÖÑGŽn=m€úéÒH†g.½Üéy²Ý˜ÜUZöÏÒáG /p¥ ®Š•ád“¯P &dÌb¶êÕUÉ—&ñ "ºÓ(åŸõð@1œFG!¨™&¸_¯J0ÁLìœEÝ’hÙgRIG+7DÜ,[ÔI'¬ÎƒLâk#ti±³·wù2«Z—MN/4ª/W•ùptÈ‚Oµ´5½m™‚î¹áÌW!\‘˜4“Fd ‘Ö$Ož_Ü©sI­Z*ƒ5L(éÇÎ<¹Ò6g¼c'09ìöÑj8v–0K­Cn0/äÛ?qÆÿ¶p󓈗½@É–ùˆq5ù¶ŒR±rµžÌÆÆÝn$ÂÖ WךtHŽ¢³«›‹ƒ(yÄWq4›ÐdpÒJ}m}Ië2G^›F¶2V€œïúõ¦Ï<ÀÈG™Œê§‰ÛSÄÍV·¼­ªWËj¢Ûb¼Ý!+[U‚^’Ï`ÿ ®nIfÎïŸÌ‘ôxhk¾Îñ{âô\í·Z1 K*…¶Ôí¤:hí)Tø'6®š¸fñ£ÆA~ÆšŸÛŽBp·g÷:t$ÉJÛ"’®ÖX¤·$Úƒ<ÁÌÓ"uÙ±õ÷g•.†-µßZc!rÀøMëZQh’8¥½k¡ŠnWªªZîf“üÒâ’÷ÌAQ¦Á]ã^\¼.‚—›¥j¹]ejßZ¸*ý«3—Ž„xg;Å%·ï'9»©1iðé–Q—†Íԯɾ°a1–³×8ˆ>ž›'Ý¥¿{¿áï¯Ï?ðÛTÔÞ&“™ ´#(#]$xÏáŸVªÆç÷<¼´Ù¾§ÏÐsöêf<):fvÒ”ûÔSWsÙ#ÝùËeùAKX˜¦ Si®šõÖë²Õ'OÚφzxé¶®• òܽT«¾Õ*Üú'(ð•ý:¡òýû$0ß¹IÞ#¨ÈDff|rÎgY;/OÛ÷˶´ î˜¤ëO÷vÓ—·÷Ó±j}Ÿ¼l3mÚ·jêõ5Ë»þ]:lfå>yþ;-KF›µÕ#~Fåé}ñçõÙjh§=߬ÔWá¦'-„¥@ò‚Qé7©ò4’D‰ð2#®Æ#(·3’uŸª&¢4â ™ÙúÖÕ.ç:«ýL€ýùOÝ×®Öݚܚi“MÔŸs…ýŸÀFÃ9‘ÕoÔNš’Wƒ^uPš$‚|É>¶²#(‚d;¯³’¿h§²Ú{M[ b:pUù+ËŒ;ŠÓ`µVkƒ\6ñ—Ç ¯ËÖ¶»›‚ÍãÆDòÀÔií_Ý;=º×‡ÝXÝ1sKV¯S¡âU&é^e1\ HÿÄ zjdI€ÓÙn Á¸Žÿyºâ[µÑáEw9Fd £—–TºmSªjÝPpÅtVRÈhÒ1œI#hû„Ôam¡J¨åèXzòô¢Ÿ¨ËBjÙ$Ÿ²NÛº¸¨…™Õ¨¢Ö®9Må9>œÊ¦jædȤg#)€*‹…Õ4鮆…s†’mÉãò28úVQ©ÌLÀ²SKÄ]WRyÖ=%t);±½þ?ÚߨÒ‰­RTÕG~„‚f¿Òú-ÏΑµÙÃW,LÞ¥PVh—¤) ØædÒbï?¶OäùvYòÂØëÛ6˜¿6Ãn°æÆ6v ܽ²ákPr¹µâ´\7¦ãse^= °£àmõ‡®!…¿Ð¿•ò;ü™ûì2ñˆðÎ ÂÏ*ÖÔïU_¯6t9[[Ï5‡N#´ZßmMñ¥ž7ˆ0[Í/ÿœçÊy;Ö%í[b,Szuˆ¯—ëûûâöíÏõÕúËáòËô3&Y2óy È奬F¤ÒM=Å{™uϬ~tdQR¤š&>³xúBªÂ 8žá®Â¹J§O뺨ŸˆJ# DÀLsÎc#°ÎªoTÒc† ÜÞ˯ڵ1å–YÈ Îƒ¶ƒz:"$èdå‘’`O†Â¨®{µë9üv%œ÷w¿PxiÝÙw ƒ¡»V@Fà G”ú¹â4œÆ­ÛJF‘¬T<üêð:Af:lŸé??«¶9qûwý;jãr>ϯåáVʹF¢#18ÔÄÒrÐçã±Ô¶Z©ÝõëÓ‰XákägòvVádÏ|hFä~Ícm*mJunouõ÷r#Ͻ#Ùã÷9ÆgÌþ=’àtýê_¿c“õ_r#¦¾Ì¼=úg²É§U5I‰ÿWó÷m½ToÕN÷©Zg)þ×ïÚAiµOèEP W¨¤÷ïòœó2g)m¹“EêF‡•ú†å) #3½»âd¤Ÿ²F]Cònù6ö¥òœí v؆Sö.fÓ‡,µ:FÝK—A;‡.z»fÍ5nßœzõé?AdíÒì>H߲ިq_e¥²°9ÅXÿsÃ×û#;Ê.˜›õã‹kæHßY ]ͼn²Ï‘™˜ƒß÷n×ï˜Ó°Åû+¿`¶›`œ%tIæ®ÔÉD¬Êº%|r},ƒ¦˜žâ„¼xôÒ9ù‘ó„¸:ûÙª·û³<@öùtsmpéò¥2’Å¢r§¦A‚ïCŽU¯.ÝžoE"|:u?eökA¶=Çý£Zû=mŠ•wBmx†àîßÊdÝÈàò຺¶l'¦°»9ã‹×e–·ö[wlBØÙGטpò',…1=4ê4ÿã&¾3í1®Dàu|ÇfÒ¶¾Ð9%Â,°h»š¿›<Èú5x"$ç®Ó~É.¸—´.ÏœömÚgNìØI†*[¼íG5IFªã¬OÌ,Šï–TžMÓ Úm§¦2==òjì.Õ`Â(®È—·ã\mj­þ¯+xh½Ñ;ZI!Å|P~ò§<³s âsóv¾aü¤>Nu[{@Ħãxÿ@(é7nW⤫õZ¢Œ¾]cÄiœå Ôvó;´œ;„,øVßndÛè­«p©:Ñ¿òð"ÅÎÒ©4é:Ls¢XvŠªI©÷ÖYBÕªgêºËœµÐˆ#Ã/Wkz¬:»&‰·qÅJ}%uë*œ¹~ ô.³ž[†¬¨á:VQÈÍzÂé1"#z2™~Å[lé:±¿ç8­Ev²J$Ù$Vàp¹}]Œò?vÓp¢m«RhHIO¤ ‘F{«îI‘ÒGH:Twj]”ÕI³ÞkyU”âz$ TÊóåIPÚ yvµ¦èš\Ϥ˜4ITÉU6k"I"}Ò`Ž\/eDwj ÿÓdxB?AÞœúìÆU/`LñAÌSë Á˜ Àœó‚Aƒ«Ç ½l›6“À©D¨eJªÊO–V"ºäÒ ¨“'_íÖDw\6rÝk²Å5éVQ$¸Afä—-]4s4)2‡–±ÝÚ0§ŠÖ¾â ®’\$€Ê’3#9‘·êwù?”ï³_’– ·aNÕ/ˆ!~uˆÝ¸Áín õÍ…£ 4É{®)á}# [9`øÙšþ›‘p?èìö÷{åÇü°'\QØ$Â÷›®R¾Ñl[p[•îœK1Rf‚†*\µÚ®µÔMW’Ì•ÕUW3UŠ«•U9ß”F#7nÒ1ˆgue»[ïΨwcPzF ¬°úðoê‚õ“Æ”–/˜}=€È¹E“ªž6õ‡.ŸôxyÉé³-»v" H¤LÁÐ`ÀÎ`€G\ö!Å5U^õ3F^$ÇO†ª£ö²wøì–÷Ù«¸t:Ä ›jÞû^í?vßýš“¯ã×ýù鶈¸î™#PƒÐÒr¤‚™‚1æ~ôzÙŒùõØ}ÑïŸ?ÏOóÛæË–®§­"Fb<$‚¤ 3õF¦6ÛaÖû;çõ½ÀI?ž¹m†õS¾9î&'ÐÿgÏïøìXYW)ý0\yäFzHÝ‚{9*ƒ`€§¦ªjÒ|2ÈL h¥1QÞ&‰LîG‡xÆÃ÷ìôŠc{{×¢zþ~?¿dY·£ÖRƒû'áã×?‡³i­»ª”¢š¨Š?]N$þ~í¦v¶Õ(¥ µIU·ôÏ‹åÒŸÉñëè?ÉW± OŠÞ^;@µb^ƒíhÜ/\šÞ®Š»Yˆ7¿6ý!ÍÍ qÎæí— Äü㜽ìCäÁÛF7ÀØÃ`ÞÇ’ÆG?æ/ݽ»º3ks ó7 9Ç9]C †sÏÿÞÜHÚˆí;â«Gd׎ÅcR}š^¯VlcwYK;4n|Z¢ã(].å«^dð³2÷=ñ¦<í³—;oÁœKoðúËâÇVö«µ)ª‰Ë‘@Û*O&ñèú wAuì˳;çh7ÜB½ºìþ´)·¶Û¥: Ô·Oô§P3$“¦B õÿe >Ôñõò†+TéhOæ hSÄÉ,Ž|»€»ž¥Ä ü ‰&Ÿ\û0þOü!q^ìëà,Bÿ¦–î&¸’hF2Y'0wº5ÈžôaòMÀÖ7a&˜/5Ãa$T­Ï ]$RVH@,ܘ2 Éœò/ØÏ°¾Ã®¬ž`ÛÞUÍ©×76׈IDä*ÝöþŽÛšú@93ÐI0 Û»YmÚÏɧ³”UìÍŽ9igÆ(»O`º8/ÇX=ªÜâë¾×7&xcæÁüËwгbÍócËL3ŠqF(×c:†ŽîV’\£V|YºüqÉš£ßžžÝ>O÷Õ{B®åŠï<¶ùÁfÉã¥擺?‚ó‘Aº̵ÌÀë&š¤‘Sv¡Ù÷g=Z°ó;-m–Å ðœ"êµ ¤P @ú#–¦| ä3ÏjF»…*1píåK,åeKŽ)<_Kœ¿ÿfö å´‡ÙïXÓ~f›× ZšþŠàã–ù‰2;Æ­ ms6Á¶žÍÓ©µÖ¶•¼ -Ì,’ȺIU{¿ë nŠ}€ˆÒ$gWbÜbÙ§›%JÐTð–Pæ39z¹A“e”ë§.c4—Bར®P(=!(‰XÇN­r‘1œƒ–‘çWw¨CwqN/qe(úßA¤nýÙFÀ]›­ÅQn„“ô¹¢À¡:ë'¬š1¸iS;²Ô ÂÔ¶ §RÉô)Ü9OQÒ;»HØÛž·M;­R[•wh B/¯@êñ0E2èG¿ŸÉ—òJìãåmM·â  {L~é[ `äK–å÷‚ÅŽ18¦Âi†ñ._>0Íëý"âÂÝpü¢È­tù á‹;qn²âæÚÞÂN#Ì´RôÕ«8¤¬yšín¹0ÒÎL_ [ˆÛó#nV»sç)'Ï2 Ã¥.Kq]?YX‰˜Ks˜cW c"gxǵ±=¦ÕbYê´£†Ôª[›²4œ¤ N€èL‘·;©w¦üU7ËŠr8vøà•´¶R­<9uW7.­bhƒþ„ݦfߤnãZÌëY‰N¢’˜+tâHÌzeägÚvЬý%)¯ÑÐ(­X£L²ž§<ÿvƹ\µ&;Ñ)½Dïw§øøú²vÏ͛֕¯T¨©¯ >UEO4ª*Ó<Â!=Ý“jvŒeHòûÉþ?6Ö¦DE œý&gMc÷ìŸxÕûióˆËóœl¿Ô€Ÿíåøws~Âð¨Þ™ª4Ôiþï¿îÙŸ\}¼½ãÙŸáüAFjçwoHé»ñŸß–Î)¢£´ÖRž\4¸•ñCŠG…èt—´<¶ ÆŸßýÕmõt;má^C/P‚Oðó¤G‰«d·yj…þɨå—t>:LIÔÕáÕDÖ7¼€êIË_ €“S©×{ºSÓ.!ËÿtLJ_»mEO*¦$îyúÃÏÇg*™äžéŽ€ý LM@DÌH?÷:(ß»J›Ÿ£;¾íïÏäìæÍ:G “¨¼Aú£§xÎF’s޹‰ ¤–{-×J”)2¿ÕÐÈ9x@H‘”õ;w·b—ØP©˜»1ŒP«¤TæJÅT™´)AÊ´Ìd] ÎdÀÛØ»ÿöÙe™Vká W/8YÕ¹l4IýÖà‹e‘_rå¹Q†K’9Ú œç¥gaùZc|Ù%ß²Z1š¨`úÖùáËvw_ô[§_6ðxüƒ8nÑÈœó&j>pö‘ÛXßÜÜ]™\9>YWÕ4/vè¥Æb‹†ë\ ZõÇ„N¿@;[ß&ÞÅXöƒÚogŸ>.¶ÁØ•ÛePÉeÔ-­é¬ÙîF $ž±Q·ë7³Å;.ÀÆ8³NÎ;-Ãx$TÁØáNϪO]C¬Ðp¼¹]Ï6×>L‰ÿHwŽÓÌ7‰¬žÿx/oekéK}æ#Mâ8iBŸ² ¸™réà1©u3ÛÝ€ölޤŊˆ¾cµ,²I*¯Ò(ŠRL€Ôä`òÈ*ìüAØæÃv´Ý_Z'U|¢\:U8j€ DœÀˆ2@È}¡·–}­aûRxÑݮԢ¸iº”¬ÐP’\ÊéÔy9ˆ.#¦šSÏŸå!ùHa~Õ;;Ãxg¹Æhœ7€‘³:Åi:YÁüè5eW(6ù‰Û–¬ÙË/ ÎÞ[cÅq7h¸7`3‰ø? ´ÿëÚÜ5ä?í7ª·èbý܇-/ɳÒ=²ÜiÚ§h]Ûï1&jÎý„ÒjÏ[Z‘W™s ²åDœ €| 4ù“ˆq`wzß©E±9­bkÞªJŽ@Ì9dÈË#‘œ¦Àì§³¼yÛF*þjá›ÄNhE%^&šÅ&6ĈúBïžæ6jÔÃÇÏÆAÛº{ ¼%Ø[+­âÛuĸcׂ߳¾]^¤…ÁgJºAÊ5 ‹C–Á§,àòd a:vã,ÚÝŸ_T¶T(ßw–ž”vzå9ûÀƒ-,p®%Ä6«¥ÖÚ‹g‹a– T»6rÕNƒm¹+±]Vî)ºÚK,§©œùæà«fwJ«¥·)Ñ98ç)ªªòtQ®YeúÙxølB5S˃Wêd ò«§Ÿ¾Ž»&ßÔõ2ßÓÝHŸ÷yÎËå¦ZiåìðÛb7Nq§ÝŸøì-<Û³ÝݤÏö¤gÎ~¶C¡§c9FÛÞ ¬gÐþ†6^•h©:êïšýæšuëøõÛꑯæî=I©5™£†x²”úÚçLùé˜=´ÓNèžuå¯ßü<|vÊ´Ó»Gõ½¿gOÇbhUÍ ä31©'R5ï @«¡$@·ºdÏv¢Í'‰V…%/­ŸîìëצD[1AåÃu¥´+J(^!#ÓŽOÐä 2ÞŒ¶¾{=Ãew6uâ,õGi¨‚)5¥Ñ*KdP( 3uÍ™:îÎs·«8Eºöœfû]°íÂËu²°VÕsE» ­ê|èIyÈ|Ô[TÙ¡në"ȳ&& 2ûì·\3Û7m} vÑ}ì×á»KûÃêÔ¶'³v•Úr·dQÇ÷g®kxÁöÇVuéÑ^òÈXФnŸ5qÖ%YežzT–àñwë “®¼5~&NÕ† Y³«£vw4^VʵR]õõ‘jª©¥Ë•Ã×nãP,ºˆÐ{ ò.ÅŸaLAmÅ=¥â¥IeZ7¡m¹»ÓD½ [¡Æ†ÿJoôMÓ$ "¹xó´Ër}¦Zû;˜I'ŸºO !üìí º6¾m,ÐÅK¢yiµ€y¦‘ôù¾MPvïÇ»=Ãlãûãò€F¼^‚L ‰"®M°¨ ŒIhÛ{,ªÈ ³·k|š»Wkj­5ï)§bGÓÉB<^;¨•úŒòês|ú;µ~Þë»´ªÏ…WËÝ $­5‘âО¨q³9g#=AÞ™3ä¾)¸¨ÂãŒPk~Kù±EG‹9Z-8ô—¸M»„\žRc›og½”áçò‹výdíï…p=›¢;7À¸QVŠ.x\…¬:˜,T¸#æ¶ÒZwŽ`ƒ0NÞ/ßûN¼¸r¶ «^aôëP¬ó\%fWr¸ry®½s·$c†wôï€=¸,CÞ*ˆÒ˜*ˆHŽ#¯†qºD¦]Ÿö5ÚjGÜpF‹SÂ8=Ö0Æ/Ðly[¡¯-Ç]`—ÑÉúLóq‘ëáÓÝ™à‹—c6×·‹)Q¶(†•IÊåNT;IÑœ6ý¹‚é¯R|M9dT§c¢ÁZÒ²ñh§r¾¸*š¯Ñtš] #Ë–Ö_ø.O#!·4ZÕ¦é¡èX6lä„ëZ¿K©Ñr”ÁuŸP4VG¶ß#[öW±ÛmEÝ›¤ðÕŸ:Ã×F²­Ñ+{ߣÕþŽ¿4y–ÑY‹Íˆ¾GÍÄU>f|©p¾&gÛ5áÎ"·`ü#ZÜ«Š[Qåp™â !ÊL‡DÚÊ{Ûs›ËKšX¬Þ•ªy‡›£9å‹UU žbWH‘á:ôËe0Õ•óšStƒ¤ß}šH¬®[¿ W–ˆê÷IµÃcÀn-©q¸0^¢iTƒþÛxw³‚ uîÁO¬6°âÌ2ÒÒñûT×µ¾¸$ªww|×.í ­Ô šXZ5—¬çþû¤7Î×ßi”v?rmƒÀ,Ôí´|C‡¼ÅwÛ…áš~uRØÝnÔÅ]¯ó™¨lzó° ù¼ ‡ aUçØû8½P–­WJ0¸­|ãYš`÷k ïæ£ÕÕAæ®Zò¤g‘#@2ÚøíS°Œ‚Û°ïhN1Wý¶0Å\[ƒö_Ìük‚T·ðZÔÉõÙÅÇw>\}0åHÏ9yÿ‹0êøšòå[¦M…A‘(µÃ1ÎŒæ]ƒŸx‰×*&÷ÙsDiUÍi’Ùn*‰Q¤¥è§ãÍDU—‘sýÖÖ½5ŸZ¨ß¢…nP颌À2" ©½ÄÏœT¦â”ªØPxm×WÓ’’B ç%¨Îf2 C\,²Í¨NªE%è÷ÏD÷þ1»ú N·Ž/ -ö¸{ª}W«åù ™ jTn÷(’žÿOµŸùm-ÅXIæVËÍܘ\«½áË6$F»s¤]r¨Ý † òn\µæÚGC`ç3 ô½ø×öÿw_gO~ÄS½»çÒ|?3þ[77¤RÀt¬G>~}:g–Î5w»¼?fºýãÝ;oJ•åñ܈ü þuÏa×âU>{Þ^ùËÛ? •I³¶Ôn½§z@4™™"­ÑœHÊDkÔœ]õiQ=ì‰{×®`5œ¶AwtWY4`e©ÖÓß»=2ТíÓ…+Jš» Ðç¤÷uϼ: óÝÈlf{ý?WÌ~Ö˦ã)”½1Ÿÿ,úì}Ko @Á3VbIÐ’|¦þ×j;ÓM>½{¹ÿ»îˆñÓÙµ³‚l¬V¼#Îýµp§Ö„•U.ö„è  ãr6ìK&Àtá¦p+;ÃWòמRêéxÏ’"Wb²-Ð [:s™Ï ¯ÛƒÎÑm8ÓüáIÕŽ‹ËWn-·5x®Ý]$=;…xÐ¥9äOvfbvæü_Ú]ýdVf…|ª(’J†ÍIªIŒ‡‡þ+_ZLgERµT3Hß+q@ƒþ® <Á9å”H‘á‹S׳[V+¡%k¯Â…u.Z¦Æ—@ Ê"N{z-òzùHãÂ+í"ÃÂXs´þϱÊi/Ú5†ê«vï mlî BÇŒQ·\.V+ qqç$aóæVìºíÅxÎåwízï×·ÉV­ ªß–­ej‹3”KY#<ŽGfV«]Ó°9²]Z´£šàúhôÜ«OÑÿü×/÷ež{_†áu»î´fšÆìx¸Ž±‘MᡃÐïT23â&šræ‹w ·.(n(¡³™„59ω$g$mEâ nü {ó¿IV=4Ï# Ær*19x‡Õ+ÜÜõÝËÿ#\µüõdQëTÛWLú†} û>¬F¾sÇXÓfǃ¼@ê™ÿ›üIÛwÓŠQâ®kओtxŠqx)$>¡»®nÍ”·K¹¼jøŒõ>]6Bš¾Î{™}ß|ŽÎ•:õ3O¯_í~ÖÅq]ôþç{ÝŸÛ>í¾(9þÁœ¨ÝŽéë;+O3U^º{‘žgüüOfÇÖØ²N©×l\¬WFðÁZ ÖFŠŒéˆ˜D 51äDä ÈÕHõþÙÓ]*ò.›,©R…ŠèûZ–zeü~;=&ÝhÖ¥U  #†( ÷ý.÷ôt þ¢dA÷í%Âô´Qý!ÒkÖ]ÃñuýþìÎ×n²Ý/sRmžPŠ`Šœ"ÙqÝTš‘©|„Ï^†vô²NÊqö%²Ýq&n­›aï›ëŽ­<Áà RxÞW~ø á·úÀwÉOôÚþTý¸0ǘ®ÉdÃÜçfø.Ì–·\œZÒ`qö„"úê_3jÜÝ]\Ÿ¡ÝÞ³æïœ:O!b´˜ß9©¯ÏU8»8–÷">mp90ÌgA¦Õ¨$Õ‚FªÕ¡eƒœ‘¨£ãæ d3™ÓâÚ-Ì7‰qþpQgU³tl÷'/QhýƒUäZÊí6rÕ›–Ç2ÊgÎÝ)Ù†?ÃV{šx†óoIa‡_üël³•–¸6iË)ÅE¿.I.Û52]Ä mú.ù!|­0wÊ3 Ú¾N*,{GìÚœ¿GX•¼5½›÷Í®mö¬bÆëa¸6¹`\[8çZ3.ƒü-ìÜÇÚ½Ùÿ`¿+»V=ù;ÒîÙiÂý–öfÑl5ƒ;Aʱû‰]šïU^þ¹ÝÝZžqîdì–S¼5Ý1WŸ.nÛû8¾9{ìÛÞØ]±+þЯxk5dÿµ–,Ü1¾áÈ]³K`mɽhñ˜9–cn}ùDü¦ûDÇ,k¿^{Å]“`lqŒ;´\X¼µØ]ºÍ—bñPݹ4‚vËÛ™·âŒIzb“¥­ª?{n®”¸Ë,å$SQW mý89é­B#hu»ãNÒNyp»5³Ù~’k\”WštÁ$VÉÀµ-ˇ?jz‚`Ìî›—àŒe‘”1àdȈBW%*V]ekߤoÖ¢¾–$e§ßžÏM\[éd¥½^k©è$ƒÂÿxdj ‰"@Å—š­ïQ¥KYYÕ*ÔÍI ºáôÒ#-í@“”ÆÝ„¯wÜ.»kæMªìŽØ\mJ¸hÍûfŽÛ½`±dñ»†î‰rÜ^4~5‘¤‡…,:âLTÒ㉋G<Îø£Ï›Ñá;Vfà82Ù»Sô—„otI'jÔÛ®—+•ÊÊŠéWUúŽ(Y²<ª*ð³C‚V-¦dÒs$ŒöïÏ“…¶Èî߇± Å R«4Ó¡º^—‰<ÇvK3ô02S˜=ö„ÏÚ1~+¶*£UÞ9T ³Ë¹%™YÄH忈ˆ­öGr]iÍ`ÑJ¼\;Bu"ª®’s*ñå#9k5ÔfDEÎz’VJ¢¯ÌSÁ(¬«°©ÝNPIðR×{^$Ã÷7fåHJðåÖ¢´ÑUR‘ /¹iŒö·¦ª™UM#Xîk”ÓŸß_q/’ª¤jS}#E ¥è÷}/¦þ£½{Çݰµ5òN¿hþ4ì¥jnÒ¥4„«ßÞÜQD¼©Ò|g]·o§÷ÿu;iJ#]úôò~î{ôoövË#M\Þðþ¯¿ùü<þ$µ˜ª;„÷@ñ:k{3ÚcbmlPo©BÔŽE4ÄÈá¢jïU©Î3{ÙÈn›~ ¹5ºµÑÊ×W¢ êŠƒÄÿ­HÈäÇ]¡w;-Ý­kÒ¥‹âIqµz!ú~ P×?yWEÅ2¸Ñ©Šrg)óÝ˨œç4‘bŒ¦šôáú¤NsÔe»¨üfUaÂn.…Rî_[¸Š™ˆ¨™ƒ1e¡¤ïjNÝ×òWù8à¬qÚ¦ý­^î˜s0Mg¸ï0hK«IP28â9<žy÷F¤;ß=kØ{>Ò;)ìƒÛ1og=¢üØÏ°ooEFŠ5ÀŽÍâÇ˾^\5vÕÈ“N¤ÔFÃ;ùVöƒkì|—û;YƒÇûD~ÂëÛ?g-–]%/ØžÍlà ó'-‡òðÑœ°ÿw‚-Ãwn-n¬–º×â¾€7Qx(£PZ†•5ëH$s‚b¦•1Uã‹SÇ)Ù3M>œ¯ 7y7b¹GA:œ„–ÐkÃ6ù¶º·nÔGª²¶R$ˆò˜¨fù4š¬Ò¥)Ön(JÉë߀òðÚlò¦ª0I庂ÙDU;´ñ–ã*HpŠw¾Œ~Œ9<ç#˜ð±ð‡mwüu¢å…îK5X6Y èMeR $¸`¿O+¨ÒrÈ^Øå}Ú& »©‰mJµ7 ƒ[kÂ_:Ú+ @òÔ†¿þ ƒ”dNÝ1Ù/˃ãLi…pïn›(½‰ËGßö‡‰Ðº¬£ë%Ì\™"Ë–ô–Ícè|{#B$˜õå+ò½ùöÃØÎ(ìZ÷nU½»ÛÕÇ—v˜öës¿\¯ákiYƒps·-­MÑÀ8,¾fQˆÛÄ.Ù{bÁwfˆ2ÁØnáüÌ`Óæ¦· ²°³›{b—ÐËvÜÓOi0œçnW峺V^ÜMvƪªkD¬ I,ª'ÓúP4厓ÐNÕ¾,í:átN†ê?Ü¡®ç ~—þÄç¯ø©‡7'ô,¦ò¯®3¦R:yt)˜fV¥Zº+TÏDffˆ¯@|¤“³µ½Ã*i¨«^æâ’hM^¹DÄAÊcÎ35i«ÕÏÒ÷cóã$û#k7 7pô'M`ÑÝ£"$h8Ò3öˆ$ÁHé{†S¢ð½k$êŠÁ£…Á*$¦e""û:6-ÃEXY[\Kßç¡úPwÅK‚Ô·T!É!¨æˆ/C¢ œM«[[oØ•fÜ.\¹r ,’GŒ òáq˜´DÉ÷íß½ŽGeÇɵI¸tèE§ œÖ]Á@𥍠†{ ƒ¬ìë°N4Å8ºòŸ;s…ð‰xð*ä¾j«—f8š¶æ jî÷ÎZÑ^ž :~8 »ÊBÇpxË,µ#-é:=|ñÙnWÑèŸÃö¿³¶ÔWX\¹¡ÎMZ7µAËiQ 2’ÐD2 Ît»_ë}çd²yW…Cïš¿º}þÍ^Z!̵ñA'ÂI&yæbdlæ‹^J*ÜT'Z½Êõ•h×Ä‚j=$ê5š`ësõ7+Q¾…PŒœd`¼LtÊOèW䩨Ÿf÷ç‚Ø¯ÞoX·g¸©¶egm¶9uÚ=vuÿš«Ý~r›]-v»ÙŒFÍ™/ƒHÞ9Ž=ùEvnñ…ÍÚÉöPÇ |Ô²VJèQ7–´y§ë8E½ÕeÕ ÃRÕÓZ¿¦æ3$’`ð6!­Šéœ&ï 6÷Z_ðþzAÚÉHHp\Ï*‡b9ÌŽC]¨ûŪèÅzé»™­ß'Ó.ñõ€3&ÎÖ~ý…7ŠÑM&rš “óãX"@ÝÛÒ¼7‹ªÀˆ!™SË$mhÖ°S…Âåxè¢9ŽoÍèeœÎDű±º\ëugpµk¹ž!J~‘i ¢‘Ðe?WÆ6®.˜¹ët«(­B²uª’¿¢PIrºÔ2éLÓ´]Æ"vn$jYE »‚„ó-3×\α‘$ÀKÎ"´³jþµ …n— rº 颴’9„X—I $‚‚v€ºpY:Þ[Š¥UŸÒ@ä×B~ÉÓe‘ªæQàÑÆ«í¡Å”ê'OÕ7dx#–éÒÝ å^ç´Aâ¯YÒ:À1ý¬òjmp©[É÷k©S Î^>¨"#Ã8$¡wqB¦âªÀîŽtQ–DÏ¡È  mõwljԚ”T­ #5øß¥Ëé}ó>ÈÏwi³9an(‹ UÒ«ÒKŠBƒ3Þ. ä#H’#-iÅN.öe˜6®ªÓQZÜý¬ÕT}!q¤u1!n»£Æ‡"ŠÁ ©ÃTI”AËÕŒ³ûQ®Y|ñ4jQUY*+­.ú> ÿèž?»W[£»}MèUŽIšU¤’hÖá.oÀDó.=0- :€D»NÐÄ­îÜÜBI¸´$®êž‡D„tˆ>cC˜Ù‘tê禪÷w+ßôŸ¥Î“ÀB}ÃÛ[>Újô4ïX;ùqxªî9ÿ-6±í­ÔªÚ‘âTßÍU#?Z;ÛÄÁÏ,òÌ-ë ¦ësî"¦º³¢° !¼™èuöùǧ=“|œ{Aí³+;Œ'„®—\GÚÐn˜jäÙª.[[Ø`®]î·WäÕ«QΈx KÌU·—µµÅIâªì×C6r´“ BNR ¯ŽZi& 1=…òzÅ‹áÌi…]ØpŸÞBMÖMÊßE½-R ®ºÀÌò´ä@&tËoWÖìVýˆ]-»°ÚX¨ÂÖÚ뎩·Þa‰¿›®Öo`ºÝË|®—AÛ6lÞs¿NªÝóq·˜·úE€>NÝ»|—qN ÂXáÆíFÝÚí¤]/Í;*Q|d¦=ã|ÔúéË7muwóhi3‰=ã9ÆßªÏû:ì¹ö ÁΞÓn¢ÒÞš®t3r’m”Uê¨B¼ÈT‡QËÀ¨‚ Î 3y}òÒìçäÚ•] ö}ŒìòìERÇ8A@é•Âì…ź ‘d½ŠZ¶º¶tnôÓoŸT ~nÚË;í·œÚ¾Ç=¨Ý›ÿ5`À¡^-ï­ÏÛùóÚLÞ÷p»(Íš4;yuY×àp•æ–à ‚ns%Ö“µ¬pšÁml¥ýâ/VtÛжnªÉ*Õd–(ÒƒÞ0mý? sÈÕVo–eóµewïp}4qbtXžìæ~Ìý¼¶Ñ5÷W­/ÒV:â‚dUÌ÷¢b2òÙv.-4XÜHá2sèN’$™× EYí|à·”ª¯‘ô)ªâšÜ+Â?EoÆ>¯]tžî»vwg*žß{7ªv{qíæÓƒñ%Šç…ïv–kRÿ†ï+7Zíi|Ý/év§EƒGœ‘^±·\)€vãs‹nöì_bíK« ³µYíÁ§íZ¼!ºäf9¨AÌ‘ €6.ÅÚ·ixf¬7lK¨pÞt­ÂÔÕ%R 0Q÷Íåó†W.rÌõÒ49ê‡cÿÊ?Ú&$º,Ÿhx¢×|mˆ‹.´-„¹CyjÂäÙëvëòa»˜ K3αç¦N§º®ÿÊcˆèpÏ v‹îŒ00EÓdX8ஓ®žüäY ¿§pé³W;¥ŸÒùÓU5DAެìÿùMqŽ ³.պɽYËbݵeúÁ$–ŒËt4“¥9ŒçC£Æ ùhâü]aù§VEŸ5Æ-=rVM°T<)8^—Ë–ÍÇ*ær!Ö6ó›¶LL×ß0Ý­×TÜv»Ç8¢WD˜*ábƒçÈÜPt[;‘ÎrO ÓÖàH“HcîМ¿Â–Ü1q`–¯|æ£VÜU€åRÀ]~eË–œÏ8/A9íåh ×± ³*&º*W‰Jü#½™“I9ôœÀJ¤é½²ý‰ö¼¯g×+ðqƒÚc¦÷ì9t±ÛÛÜ.—‹R¸vòý «1^Ì峇N¬Nrgõ‘óûÂÞ)Ën½kòeűá¼];7ÁŠö^Ãgbå¬m^ºW1l,ÿ/i¶¶pá³V³ôÇ€Áƒ$ˆ1eXÖ®ÏÜãë]&ø5E6•(äóo}:ãý;®]ò…´¼Y'¦|+‰¹\{s»*²ÊÖäÕUn ʨ¬‘ÇôÆf',äÈÃhB=ÖTÕ¤GãL öJg>‡#íüþië ھǩ^ç×o»Ôøo‡æ>ý•§ƒžœL¿_HGOg¿bé]œçX£Þ~>;…TÓY§-üý‘ïóÙå“áë_°x=cLö™áÇ.)xA:Nç ¹ç™ý“¯O/»Ýïäºù7[»Y¹ã^ÕÞ[°n%ÃýаKc»hÛ~Á×ÞÏÃ;ŠïXa[ãË»wW.Ña·7†ðƒFpõ~ÿÿ··îcùðßfËöw‹n¶7+aŠSNÌ›†å%ƒFh:wË‘Ñnâ0\ ùj\àÛ+4—nÆÞ±©›–Ži¢©© È ¸AÃp@ÝÌÒLɪNgoç‘ò“´­jÄ·%Е4¹tªˆÉU?n€Þ‘,µÛŠžÕÁQÊ{›ˆÖ­”"§^ ‰<ç FDg^¯Àý¯bT˜\š·Ã‰6°¶áºU•Uj ѽ>¶[îÕ[š¤B«&’¡«TUX+ô‚gúU2b ~Îgn•Á˜ÿ§‡ÑIóúk®Æ›¥*«ÃKšåÍ­N[ µ$ÁÈFÑüK7‡.¸+S¸²Cs4U’‘ã #=":÷vྠís3ìoc«gxï>½cWݧ_ì//-K6ÖÈZpß#m€Õ«RƒÙå™ç´‰;x½ÚR–ë³w•5¬rLÕY½ ¹IÝB>š8òZ;tIž¹$eµfAÅ£Ûn6åkË?ják"ƒ¤‘Y5x°á©úT“ÔyfgoÔ§Ê“ ½ù9\ûí;äÉŒû@ìÖÑòšù=–W.Ö/}ªØlØC\ì¸VÞ·j‹Ú_`;Šakspñ˜ÃoóÏo¤06û…Âߘ÷Ý¡bBÁ\1fºº²[«YE^²•¹Ýp8d9¢ŒŒøÒDƒ·.âVèÒáÅI×¾½ÊÔËÇOwÏjLJVêšnQV™gŸðÙ'máÈÄÐÆy™ &@&NpA9Á ¿ôwý;þ¥ÿ§ûöû•ÝªŠ© éž^ߨˆ‘±HÔÚLÿ˜ßœµÞû3î•£ww/_‹žœ.çݯ]¤Î*±(ÞÛómÑrðî´95p•ÆqéØð¿Õy^Ÿâvy´¹¡7qzõõŒÿçM»oäßÛßÒÌÚ±Jȶ¾©Ë>f’‹ð–M#Âú9Ý>c0`LÇïù~Z]…?ÂÖÌþùp·v£Š:cX) þžVÆ‚ ôŽ< ³ôÒ"œêy»ü¹ÿ)«µ³¶Ùq‚W[jE.åÛ|4VMßEÛ®w÷O*¸33 LFßš?–½ï±Up¯c–ÞÉZ?·Ü­¸]ÛŽÚ15ÁÓ¾kãw×%Ö]0š®¶µµØ-¡›FnÙOÏ„ÿ@ óVì­º—ÛÔފºŒ§¼#]7¢'=ÙÒ;³ìÏkM‹ßFk4Nu¦c\à£31GÚZ»çM«J×JÔ¬µq”L€’¢  1©# :läöúµ.(áUÁáŽøLBªqHÊ`Nr bIˆhR•¼4Ö w£ÿ(I ÿކˆØÑòJŸôM`ϰe½¹ ×Ý´®×o¸ºMâÈîn3G˜sÄQ4”áq§ôÊý/¯M¦Vû(tßy•Z‰ï¬’ +ÂÏ‚‡Ïó Ì2®Új4«Q˜ ˆHz~?™>3ˆ:˜ª¥*Õ¥Vñú’%jI·þé‘=NQQ’{[:Y–tRwÑ0U¤€8ªþÆŸ²Li$t®8ráÇ"Ó[Åa@JuÀáÍ`¹‚|:~ÌϾMVu€õ²•³ÝM&ÍÕúäÀôü4ÝI:ýô±®*pÞ»G*浸2Ø,>¸(/T¶þ‹™ég ’E»^.lÅoouïªG Dø¼$ÓJ 3©åâH%kÅ6–jV‹æ¸5àQ%SúG„×ýºchî/ÅV…ÖB£Š• «B%U‘#Юây(‰:Ôí]>¼q7É^ªÅ~æ<ü¾ìöŽ›‡CVüUºcÿ(ðËÚ|²Øð?ï㳓W›®Nõb5Ïÿ7Ï.¾ïhÚNƒŠj Õq¯®ç½ëu5}Ÿhõµ9‚\­.סM駉@õÔ'ðXF yõÚüÁ÷¥iµÐ¬Ð(=ôòÖ|7Gö¢Œg—Dáô0«®@â[»º-¥ÒI¿ZßÁUÒM`ñù!¹v %ä’uÈNÑìw‡ívÛÅ0E¢éÀ¡HEÉ$úqÆ»S9g™vko…ikq¬·¡*ÛrŠÖiPqTI$Œ.?£äìÔbH3ð;ƒÅ“߬ª48Ž%*’¤¢G.9ŒâtÏ¡9ºS Þ°º6™Ñ\ЗZ›Ùñ¸¡è"<£Nƒ1Z–Ë£š-Šâ6oåÙ5Ebëô.GF­¤‰À ìõìGhÅxfå‚ovûn1·ÒýU.‹„R`Á¢­…ÐCô~mÓW.ÙÌÁçNBFÍݶYZ[iÂ*Y­%ÃllÕW—6pÞUDz]šæ­§›'”¯ˆLŒ A22$޳ ”®ö—{¦bw¦s×_g–’f~ÎÎiÜiïI¿¬oižyHûüü¶—áû¥[V¶WlL ÖL#Eiq\%ë€<©‚`€ ú¹eµµ‡.3?¥&ôMt"»p¿Ö…TâúßÑÒDÏ\Æs=Õòdí#´NÈqVÄØNìê›ÿÔÖ‡–÷åQ'ëqÛ±ã£ônmÙnd<‚fDÆ^àvÇÙ–.ù]Üp^!]þ¶bŠ,ÊÜnµ¼ZÛo7ŽÏðå{’ïX±{p Ý»ù¶ÜõãÁÎ}:ávüÌv‹¸µÅVDb„ÒtS¡e#»ÂX¬€à@=s‘ArÊïS§U¨ «¿é7Æï ÒŸÐw¤||Ï]´·¯OÓQªŠ¯˜øú½s‘´¤\ï&wÆùO†C#'ÃI$tœïqtáfTo¬µjþ’ºã1—ü1¯XÝÛdÖE¶å’¨ú_®åý öl熔QàÄî-tSEt1Y6Ô(ª0“¥VFxÈ,!×ц\˜‰ˆ±³E¹­nœo=l½©´V—yUzêEDïNgw(ˆ±¬ýâ7‹6Rø²Ö×VácYe)P?GpÏÐò€†²å³Ñ29 fϹv]Úµ¯ XnÔ&›k$KŠ‹ÔŽÕù­Û‹5©«åÅÆÖíÛ›s²Í›¶L²Ÿ›Á·Á-ì ¶´áGÊÜÔæ$éÃÚ¨ËIZžp¡‚Ìî ±Ô¼@5M;Ž;\wB¶¶ä§ƒsn›&¨$íû”â=}› äêwޤÆR6Šü¤»GÄ]°ãû¾?»^mx“ãDš]®^Ïì«áÖÜ[Öº l|²°mrúÂYý9øçÇýáÛù0^lØ;v»rĶ›ýÏ]pÛ[?fé¦j«q[Æ >}ˆùÆîÃ.lœåœ€À g·ö€ŠØ[­i„Þ6`ªN£ IP b· 0 žr4g Ñë+‚ûÖ|>–£Š«‚ÞHª\T`ý<žeÓlà@Î@bµÅH¤¢µ¯MçÒV{ã¯N]â2ÝÞQ9ÈŠ¶¾ DnñS[„¦ýj}W?èÿŸf͵ á篿ÏmÅ&šgôb?áØš{¿õÈÏøx~ívoT=S—Ç÷œéŸ³ÂôŸ»ò3ýÛ8Ršjr[.iºN£2«giI]33#"f*s‚xâ ”ô2òÔÌVG»;ÕÛ}ú‚)Ö ç,£Rz1Ö#kE\Qv½ Ù›ú’¼ÖÝUVUFi})exQ+8?ÒùVíó‚EG§M­v¸«ØnJØq |µ|ª<j¬d¸%f.(@Yà€A™#@:›v»Š1v}ojåj×bÕ4 5â«Êª¸æ ¢$ßoÚ ƒó×Í)'K‡J§¸¢¨áTQAe× R<Õ-}9é9Çx¨W‰´âsÇ¿¾&µ'»™]wºL?zM÷ª«všÒîeQíö9õ‘¦êªÛðÔŠõè9ÂL|#wõ†¸©ZM4pëï×;ýßEøü ÷æ]ãj‰ßiœƒ$‘œŠiÒ"L”j Ý[…O7Õ!I’iÏM@ÞOÚiQ«Öâ÷þݼÿ{Ø'øìR·ôƒYRk£êÈI’XœâŸ©½6Sº·Ð=M}/†[Õêm«ÝßÝMXL¬‘?ÕˆD ˆé„áå(½ßß?Wõ?ì£SîýÃ1³)|¢ÖóUuñ®“õ“å¯áá®›7¶Xò{¡E„œd`ƒ˜Ô#© æfÜ•eAH9Àž¤2u÷Áé#`KÊ›iX‘Ó@iÿ <`øÞ-SGaBx‚'|ƒ‘™ž²Fö±f„:”ÞyÞè§r|@ÿ '/vÒš›Ð7©þ·ýž_œ½û87hUQ³0‹5kvBM­6†«=|åÅSÝfÍ©]w;ÇJªÝ&51·ÎE(ƒÏ2QÒt‘Ybí>¦°`ó¨Ò~ŠèÏu˜Ô Λꢯ[*?g<¼;ßÀyk%UIN¼â‰qPsï ¤L ³Ëg6ËRÚª4Ý wëúÊHÏO N†t:?5¹šVî×ÃÓ¿øæzkfÒË]édÛQUUîLî„ÒñJ1ûö¸,õX²IDk>ƒ¿ZyK©)‚gÛ#8«-ºw±®Ýì³áÛÕvaˆTÃ¸Ž•+°8X”ÇZñ€bI’`“b¡ˆpõÕªÏx’µ¢…Zr¼$UXbÏ= hHNÖ]¿´Ì9†° H ]­ ß>.ÞÔhÊ»£d3àr\ÿsm™ “ kJ;íªðµš¥Y<Ä«SBªR‚<@KEG¦@¯”c.¹µUŠûE¹_.âîùÐ.³Â<)Ì€’f'Ió"(ÜYpshJŒ:ʵh¯Ñ_]4T»› µÕŠ™ž >¢º:˜=sÏ27AZ-ÕŠ©´ñ§‰Ã­_4g(Ù“œfI;Vx™¿ít äÑ îæFQ2fOAËjåÅeCW†¢??wðAçe9…½w?H¢„Ç /Køû¼‚A>Yåá Lˆ³ÃI=ôÓ¬ÕE~uyÌÏ¿#²+T¹$ÝÙÊ}¿jO¬DŒºë–˧U;Û»û‰þ¿ç/™|v*·:Îí`nWêqO…^ïÇiu±ÃÄVmpßZ…§qIdAÞ>®Brƒ& ™Úë˜ï[­õÛ(­dÕMÒÉ"8ª¤=4¯‘ƒÉÝˤSx–ñ~YÝN.J(²•+ÅßQR¢ªé¤“¨#®³2ÐåÝ„Ô “¯ YG\²Ê#0"6Q«ªS‰Iõ²FŸ™øŒö=gŠ:Sˆ¡ï×Ö?Eøù|Í踪š¤™ýŒÕö鯷ÙìØ*ý\÷Ìtô_ ùìjn=4>Ý)~ËrÉÕ¸w7úõøå_– “r³h5W9 ÌÏ–ôÁÌÌe¬É‘náJéNšª*&‘%0Hôiu(G†FDû\Pxî˜ÞŠ4ÌëÖw“?w÷vÒ§Ê=îÕXhÌôž÷‰Ã;‹„ÚJœJÔË9ë'P'RdÄ—‰ o†] | ûjw¼æ|5É¡-íjÜÊdÒ—îÙÖ<6-5 I¹>’¯Ç*~á=rϦÁW_7HÞ«*$‘êtˆ<ªÌê×½ÞŸ÷ÿ)ëûúm÷¿Õ?þ;[ˆv·Œ{í[vãÙÕ“´þÌñ•—`·7KcÝžÙv´=upEóëSàíÖŠSqInÍÝ¢žþí@ÕEBŒ1eïblEq1eUãâ[¦,Å&ØÅ•¥’·ëÓÇ+“ÆV«cV¶ËkwNSô6,(äHÑžÍ,êÉ*ÙÓï=ßã¶•Uþg9ye—Þ=Ûn’›µsñüû?> ÅSW ÓFµ纣uŸÏGðùJ\Ši¯‰B4#ÜUSé{•f†´Œö{O¼M:E4QöëLQýo·ã~ùm§TšaEÜ®´ÆSéV޹Ǟ~{LYãä}t¼[Hþ?èÓ¦Ò£ÚU¶èL"(<«5ÂC\ó¬È22’ .œe„*´Ù)Böê‹ý :UÒ\/D%Ë„B'én]U%ç‰ÔNgFw[Þ,sNü­ûš-ráÂ(ص£Çç-Z³æO9O¸dkžÑméàL[²Ór³âíWW6Ê/wk>°ÝIb?j} œºjîG'Ÿ­žºöOÈ»åIÚ§ÈÚå{qÁ·ÄÎ*ÄÝšb~ËíW' ÞÈã¶a•ÖøÇœp~kº '6ÎÏx¨¾Òå#06äûëÕŸ¨òûZÅu–UeTr⾓Ó8r€4é˜L6‡µ4pèÜ(Çpe>Ðf'=wŽ÷]´ZåSwu ýRŸvð ø€ ÷AÊ¿¸­J•,§ÛîõœýѦŸá´QÅ3áâ=¿ãã° ÕUGöÏLüþéÙ'}~Ç£9½àIÛÝÝé—úߎ_åÓm•p*ÕP1$Œ³'C'=Ñ¿ûIj›·‚d“ ™ÈNšÉÔA9ègef­íì£óåî×Ï]—Qj–ïUïÒýœ£óÓdê§wÇ긟‡ÝžÚÔ×pnÕEtWõ‡ßýÞ¿ÃM6% •Iýÿïkã"5ûãgÖøqH…ï L§œ žbQÓÖØ^j¥›ïU_~(úÏÚþƒ–»7WP¢©#¤~>G¦À®æ—¾¨$Tjd GLòÊ51 ·ª¨Õû?óGßù…Üïz:ÏÄü4øéþ[Š¥ÝwÏw!»ûYõÞœ€ˆ™NË7Sx j¤Ï¯AîÓÈm­*¯êš<õ=²ËÄøl-Js´ïè@ð"3ûRH«Ï^‡LoU»½ëŸleíÛz–û4ÎçßÓ_-œ8•ÞËàg_vÅ{ÌKC¡b<³ˆó׬ æª×G‹@I^áX¥ ª”7˜:êuˆ×dSžÜª¬û9œŒžô˜«ÌAñÙMÇ>­KÓ5ôïtó5uüøìÝMxÕ×sNšôŸÃ@6]Z–Ü«‹B›çê¢w~Ö'XëmŠ”Ýïzñêté:uøxl.)wZi(­ÈᬚkH3ŒÈÔ‰ÖDÆdU’iU•±»®w¿qû†Å5ªŽïwôc ý” ŽRƒ–£¯í“½¯«9k¦sÓoªÝª¤é«^•üuéìò±èÓJ{ôúû›©Ç¾­>Í•F…(Szš·ÏÛ£wÏÛùòÔ­Ât¥QRôÑEnkÏÛßË='3×c-íœUVí%jê«ìpΚ/ö#-uüv™î6yr®«=a4J§–MEÒ'…’À9ýië¡‚'06k[[©úµ;ü Ÿªöoiãçå³R«qVí&©>’ŒÆQýß#—„íl4­Ý› XoVzPµj¤ª+$’N’ƒÀn¿.y­ÝÝÙÐR&chÍJR'vr¨ïÏõ°=¹ÿ öÛƒQ΀ L™"tË­ZfF‘‘œ´ErMb¨2'X»9t¨fb2ÎiFÙýºuü|þ?‹‚ôÒ¡ǨÏÃ:ÿ»]–ß4÷rËÛœu×Ï_?=µÝ+Ѽdˆ×3P«þ©#ÌŒó[|áåz‰îW ž½DSð¨I`ëVÂñ<¾ÿðÛUOŠi£r¿Jk¯‹’°2'¯Ãß±ióYúÝ?WÏdS©¤'¹™ žÿB`Hêµ#b( 8n²L› ¥kpÂ+Wâ5)H ÐDM<ÌΣLˆ$›Éܜα–Äð„nïg®ŸãáÓß¶µ/»Hä`ž e¯x’c¥$ÆéBš·†ó éõ >ÿµêkÓS™ÛZª˜ïÿÍþ[MYWS)ÔúÑ>]&Gö½çb÷)¥5+¥Æâðùaõ¼.kÿù^›Á¢ŸÖ¯§OúrgñÛd7wöáÒ<ôœãeÑRš’?Úÿ”~c?i؇u g_«1ÞØÆ•SÄÞ[¿@4ïPŸ¢ñøþü¶.iþÇêz//»ÄÆ[ •öDI=ǽ~=ãú¢©ïÁK>Y:“;û‡ÖÌäRNS¡'ûIS¿]ýÍߎsíÖ –AµOÔ¢œ·«Î‚?­é»Ò2ÎB33>ºaº°ÕU4væÞååݳWæ÷È>E.T AfAvî[z~º8†›Þ%½ÞÓE'/+Y³QnÍ.( 5I#(¡ÀÊ¡–c2DˆˆÉã Ü.–ES¼¥Æ*+Å”ëL¨‰Žn@5:O\¤÷G×·A³»ÓµV­©3l^*ªŠ§omèP`‡äѨ˒9e—@®¸¨w®¸ôt …uœº‰dgŸìlÍÄ é®¯Ò ú)‘ã½$ïf}¢ eÈÑ»_¤«O^G‡óüå´IE TWù¨÷ã„CñölÕUUUTæ7üþq®›6H§Öøf?‰ÙÀw½\õü?vÙï}žæùŸnYþí‚¥TƧ?ÎzþNÎ%¨oZÉÕ•išS¯_Úüøùg³vå?ÖU÷ìj-é§û:HÐ @uä^i'^÷ØÏûSðÈšì¥-$v £ $Œg¤ ftØ¢’ æ+Î#§x“Vg.’`OC·Í÷xœ5+Ü¢¿·œ¥¯ŽŸ¿? ¾Q:©âS㦾ÿߤlž÷wv?3;&¶õ š{ÿ`û^;·-"¡3ç;Ç3¦ìE9eÒ~;܆T‘™5¾^>¬FQ§·brwÞÏvtJ4|ÁT4öÀlª€uEt)0O`YÌ éíÓc5Ãäýnæ] å¡&™9NrDe&åÓ¤wEz÷ôøètëìø+Ý××ýǯçÛ¶iª‡uoA3Ÿ‰žšé>ñ–ca—»›ºw»óã‘Óbáï “âõúÏ­>‡ßåð°íÜŠÀ‚z–~ʳöÒt;aaC±Þî»Ð=o÷§C3ãðI‡íΟ¾¿žÎ¾ý”ôOÿ¿êìŽûOþá°Õ¡DŒêÓÄxŸ-•§zr÷ΞÿÏïÙW•L§ ÏŸ­°Ô¯NçtU3áOÝœi–Îv[ûƒw•2jù6ËqK+‚\VÊ…d NžQŸ†b¾BúéLú9 )ÔUÔ"AŒŽFD{QàQÒ|³÷ ‹MMÚÿn~:xÿ†ÓÜ=jÀïì8‰ö#Äð¥Ïæ¢÷ [Ú¹û~#tžk°|°p€µóCèŒÞý;R×ÔµqJÊš)ô%SÂ¥U¸¼$ÄHqÁ?J\Ì»¹ìéM[îëÝû~¿OEê{<þ>=µMå4Ö¥;ÛôGqMÓ $=?çŽZOL9V….’¡¹Å™pŒ“ÀÌNF¨×0$™—ì¾oZ«Sb­i*8«VŽª¶È 〠$dªb5"Àco·%i·¸¶Ü9‡Ë•”Z„øéò)C„ 2IúV\ßÑ']àÚ=îïR¥ ×XN±é#ëU™øeá³S‡JSÞQOSŠ ¿t }ÿ“ Üå4ðé§öçÄzñðûóÙ‰ã†ÊefzÔ@Ž›ÙG>ý£+SE[æjË]=žÏðÓl%Íý½r5“–ìLG{IÛG(QÓ$r=i=ALƽ:ÇR2fÊ"}û+NîîíG§¯—_ϳ<¼”J*®'¡ÝaÊÁ˜wˆÈIÌ™Ôç9ÉÈ5%*«R>Cm•g4i®~~sÙ/¢4¦Š½TÀö’AÏ8ë@èHUº×¤ƒŸQþ)“_»ð/{zžíæ=¾áÏnym³ÊØV¥4·BèŠTÕl¡:oP|ºŽ ›²‚--­•ÂñM¥š¢§ ©Ü?9U_¢ÜW,ê;݃HQ ‚Ê$ä#ÁÇ:hó'áù¿a©_½»M9H°ÿ§Ûo•Cžï ÁëuðÓ¡ŒõÞë×-ENéÊ*×?V>í°½Cvï·½ÿ(ƒ§Ã®Úñ詵l2þÎî†#IÏ/³Ôtë¶•sg‡ùöìC­ÝÚ)¦Öñ=ð×aÖ˜ÿGÇÙõ¼2ˆÞËÆ#øm²oû¿ólš®Œ cP¤õ$‰ž™ÌüràÔ;¦A‰)O„FQ“y¥ûtéø~èü? =Ú¿«ýqÏ]vjã¥U=Újø ÷’~ÂSQ¢­ïêõÏœçÓg÷Î)uR5&Š(î$’~^‹\§Î~ì·¨´±4ÃCœFS'2»nù1¶ÿcû¿»déV¦Cº3ò H÷z€qð:.šÕ(_lëìããìåôáï×ö+ïü?>ß•_qmÛ>mqÄܵZ­ºU‘U;]šÚ…žÒÄrmÛ@inn͘9uÊgfÔÞ[•sZâÞÖÖpnõT¦HõŽZÀ‰™1>¤-v¦´’¹¬`T³wk¢<#—T¸#I× |2.‰Ü¨Ý®šET!G£ @ÿ«Ãøì*÷–h9SõÓô„'×X21S'RK#‡•+ݧ×ËÏ?Æ<ÇžÍÜÒ5ÐB‹p{Ëo×Ââæ)§ðüùGœ)˽_¯u Œ‰þàÎYt¼«BSÃÿÈýÛ7Ö½2«_à|ö!GwCÄ€u&’sˆŸ9Ÿ‚œÀÿe÷Õ°ßµVžìÿgù;kÇýø¿øìóÆ<´ÇYþ÷«ãêýñ°M—ÑNí~Œ³þÍCPF@gç=vI»qÝÌÆ`‘©;¹3ˆŸ9Ÿ‚Èr´$Ož±Ÿ¯ÓÇ\ÿ½±©Ê‘?ðøé¶¼¸ý¿»þ²Q¡©ª“ïËÀ蹘ƒ$b6Ó†YMOµèu9³:5˜Èç¶7;þ¾zz¹i§­ù;az©Þ'ûZøåñ÷~ÊÝ–Gí÷d察»N¾ý¶ÓÕÿ|ÇŒŸoñÙ.;³¿œë»÷DÏæf6ÂÕ;ªH ŒÆB<=Nºœç/îì‡)`E˜&zÁ 9“‡]6-Æž¾ÿÙUøí§§üîm÷öÿáÿå±m&™¤D€ýÛ6ìG/M5nïü)øõ×.§l ˜¨S”DTüÕüDAòŽ› ïšOwõhïÿz®šeçœøõÅ*<§ÖâSúœ1§Çá–Úð«Õ5iGÀí†íÈ=h¤sëQÏ®yæge6˜Šý½ÿ/ðëîÙÄzŸ©§ïuþ>Ùoª­ßiÙ¿Tû¿²í·i¿¹èÆáñΟñóØ."]E@{¿ê8TκªÞá¦#ÔüV>üF¥“ªiõ;žß‡îüv-:x‰ý?ìˆÞ×ö£/oÚ64µšŒÐDE‰Î™ÐƒÞÖ@#8òÊyƒEfµ"ªÀ ’d“=I`y?¢¶í&ªNút&7¼8½ØÎ<#ã;3UvOyR¨îV’Ô§è•àŽñø~Ðx°R±ï~¯¿J|»´ç>9œ´Èë³b„Tò8Ÿg¬Nî³ø9ô¬ìÕR“NñÐ{}þ:FÄ/XÜXxx=“A"^E1P é)Ë8ŒòNyNÊR½©LŠëÓ ŸýÛ8]µ,åÊÌ›*ÍšÊ,£fjº.•I(ú‡+–í˪gxeŸfÃróëÈöDyú£d8INµN“"?¾>í¿ÿÙastropy-0.3/docs/io/fits/index.rst0000644000175000017500000005360412243255342015354 0ustar oleole.. currentmodule:: astropy.io.fits ************************************** FITS File handling (`astropy.io.fits`) ************************************** Introduction ============ The :mod:`astropy.io.fits` package provides access to FITS files. FITS (Flexible Image Transport System) is a portable file standard widely used in the astronomy community to store images and tables. Getting Started =============== This section provides a quick introduction of using :mod:`astropy.io.fits`. The goal is to demonstrate the package's basic features without getting into too much detail. If you are a first time user or have never used Astropy or PyFITS, this is where you should start. Reading and Updating Existing FITS Files ---------------------------------------- Opening a FITS file ^^^^^^^^^^^^^^^^^^^ Once the `astropy.io.fits` package is loaded using the standard convention\ [#f1]_, we can open an existing FITS file:: >>> from astropy.io import fits >>> hdulist = fits.open('input.fits') The :func:`open` function has several optional arguments which will be discussed in a later chapter. The default mode, as in the above example, is "readonly". The open function returns an object called an :class:`HDUList` which is a Python list-like collection of HDU objects. An HDU (Header Data Unit) is the highest level component of the FITS file structure. So, after the above open call, ``hdulist[0]`` is the primary HDU, ``hdulist[1]``, if any, is the first extension HDU, etc. It should be noted that Astropy is using zero-based indexing when referring to HDUs and header cards, though the FITS standard (which was designed with FORTRAN in mind) uses one-based indexing. The :class:`HDUList` has a useful method :meth:`HDUList.info`, which summarizes the content of the opened FITS file: >>> hdulist.info() Filename: test1.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 220 () int16 1 SCI ImageHDU 61 (800, 800) float32 2 SCI ImageHDU 61 (800, 800) float32 3 SCI ImageHDU 61 (800, 800) float32 4 SCI ImageHDU 61 (800, 800) float32 After you are done with the opened file, close it with the :meth:`HDUList.close` method: >>> hdulist.close() The headers will still be accessible after the HDUList is closed. The data may or may not be accessible depending on whether the data are touched and if they are memory-mapped, see later chapters for detail. Working with large files """""""""""""""""""""""" The :func:`open` function supports a ``memmap=True`` argument that allows the array data of each HDU to be accessed with mmap, rather than being read into memory all at once. This is particularly useful for working with very large arrays that cannot fit entirely into physical memory. This has minimal impact on smaller files as well, though some operations, such as reading the array data sequentially, may incur some additional overhead. On 32-bit systems arrays larger than 2-3 GB cannot be mmap'd (which is fine, because by that point you're likely to run out of physical memory anyways), but 64-bit systems are much less limited in this respect. Working With a FITS Header ^^^^^^^^^^^^^^^^^^^^^^^^^^ As mentioned earlier, each element of an :class:`HDUList` is an HDU object with attributes of header and data, which can be used to access the header keywords and the data. For those unfamiliar with FITS headers, they consist of a list of "cards", where a card contains a keyword, a value, and a comment. The keyword and comment must both be strings, whereas the value can be a string or an integer, float, or complex number. Keywords are usually unique within a header, except in a few special cases. The header attribute is a Header instance, another Astropy object. To get the value associated with a header keyword, simply do (a la Python dicts): >>> hdulist[0].header['targname'] 'NGC121' to get the value of the keyword targname, which is a string 'NGC121'. Although keyword names are always in upper case inside the FITS file, specifying a keyword name with Astropy is case-insensitive, for the user's convenience. If the specified keyword name does not exist, it will raise a :exc:`KeyError` exception. We can also get the keyword value by indexing (a la Python lists):: >>> hdulist[0].header[27] 96 This example returns the 28th (like Python lists, it is 0-indexed) keyword's value--an integer--96. Similarly, it is easy to update a keyword's value in Astropy, either through keyword name or index:: >>> prihdr = hdulist[0].header >>> prihdr['targname'] = 'NGC121-a' >>> prihdr[27] = 99 It is also possible to update both the value and comment associated with a keyword by assigning them as a tuple:: >>> prihdr = hdulist[0].header >>> prihdr['targname'] = ('NGC121-a', 'the observation target') >>> prihdr['targname'] 'NGC121-a' >>> prihdr.comments['targname'] 'the observation target' Like a dict, one may also use the above syntax to add a new keyword/value pair (and optionally a comment as well). In this case the new card is appended to the end of the header (unless it's a commentary keyword such as COMMENT or HISTORY, in which case it is appended after the last card with that keyword). Another way to either update an existing card or append a new one is to use the :meth:`Header.set` method:: >>> prihdr.set('observer', 'Edwin Hubble') Comment or history records are added like normal cards, though in their case a new card is always created, rather than updating an existing HISTORY or COMMENT card:: >>> prihdr['history'] = 'I updated this file 2/26/09' >>> prihdr['comment'] = 'Edwin Hubble really knew his stuff' >>> prihdr['comment'] = 'I like using HST observations' >>> prihdr['comment'] Edwin Hubble really knew his stuff I like using HST observations Note: Be careful not to confuse COMMENT cards with the comment value for normal cards. To updating existing COMMENT or HISTORY cards, reference them by index:: >>> prihdr['history'][0] = 'I updated this file on 2/26/09' >>> prihdr['history'] I updated this file on 2/26/09 To see the entire header as it appears in the FITS file (with the END card and padding stripped), simply enter the header object by itself, or print repr(header):: >>> header SIMPLE = T / file does conform to FITS standard BITPIX = 16 / number of bits per data pixel NAXIS = 0 / number of data axes ...all cards are shown... >>> print repr(header) ...identical... It's also possible to view a slice of the header:: >>> header[:2] SIMPLE = T / file does conform to FITS standard BITPIX = 16 / number of bits per data pixel Only the first two cards are shown above. To get a list of all keywords, use the :meth:`Header.keys` method just as you would with a dict:: >>> prihdr.keys() ['SIMPLE', 'BITPIX', 'NAXIS', ...] Working With Image Data ^^^^^^^^^^^^^^^^^^^^^^^ If an HDU's data is an image, the data attribute of the HDU object will return a numpy ndarray object. Refer to the numpy documentation for details on manipulating these numerical arrays. :: >>> scidata = hdulist[1].data Here, scidata points to the data object in the second HDU (the first HDU, ``hdulist[0]``, being the primary HDU) in ``hdulist``, which corresponds to the 'SCI' extension. Alternatively, you can access the extension by its extension name (specified in the EXTNAME keyword):: >>> scidata = hdulist['SCI'].data If there is more than one extension with the same EXTNAME, EXTVER's value needs to be specified as the second argument, e.g.:: >>> scidata = hdulist['sci',2].data The returned numpy object has many attributes and methods for a user to get information about the array, e.g.:: >>> scidata.shape (800, 800) >>> scidata.dtype.name 'float32' Since image data is a numpy object, we can slice it, view it, and perform mathematical operations on it. To see the pixel value at x=5, y=2:: >>> print scidata[1, 4] Note that, like C (and unlike FORTRAN), Python is 0-indexed and the indices have the slowest axis first and fast axis last, i.e. for a 2-D image, the fast axis (X-axis) which corresponds to the FITS NAXIS1 keyword, is the second index. Similarly, the 1-indexed sub-section of x=11 to 20 (inclusive) and y=31 to 40 (inclusive) would be given in Python as:: >>> scidata[30:40, 10:20] To update the value of a pixel or a sub-section:: >>> scidata[30:40, 10:20] = scidata[1, 4] = 999 This example changes the values of both the pixel \[1, 4] and the sub-section \[30:40, 10:20] to the new value of 999. See the `Numpy documentation`_ for more details on Python-style array indexing and slicing. The next example of array manipulation is to convert the image data from counts to flux:: >>> photflam = hdulist[1].header['photflam'] >>> exptime = prihdr['exptime'] >>> scidata *= photflam / exptime This example performs the math on the array in-place, thereby keeping the memory usage to a minimum. If at this point you want to preserve all the changes you made and write it to a new file, you can use the :meth:`HDUList.writeto` method (see below). .. _Numpy documentation: http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html Working With Table Data ^^^^^^^^^^^^^^^^^^^^^^^ If you are familiar with the record array in numpy, you will find the table data is basically a record array with some extra properties. But familiarity with record arrays is not a prerequisite for this Guide. Like images, the data portion of a FITS table extension is in the ``.data`` attribute:: >>> hdulist = fits.open('table.fits') >>> tbdata = hdulist[1].data # assuming the first extension is a table To see the first row of the table:: >>> print tbdata[0] (1, 'abc', 3.7000002861022949, 0) Each row in the table is a :class:`FITS_rec` object which looks like a (Python) tuple containing elements of heterogeneous data types. In this example: an integer, a string, a floating point number, and a Boolean value. So the table data are just an array of such records. More commonly, a user is likely to access the data in a column-wise way. This is accomplished by using the :meth:`~FITS_rec.field` method. To get the first column (or field) of the table, use:: >>> tbdata.field(0) array([1, 2]) A numpy object with the data type of the specified field is returned. Like header keywords, a field can be referred either by index, as above, or by name:: >>> tbdata.field('id') array([1, 2]) But how do we know what field names we've got? First, let's introduce another attribute of the table HDU: the :attr:`~HDUList.columns` attribute:: >>> cols = hdulist[1].columns This attribute is a :class:`ColDefs` (column definitions) object. If we use the :meth:`ColDefs.info` method:: >>> cols.info() name: ['c1', 'c2', 'c3', 'c4'] format: ['1J', '3A', '1E', '1L'] unit: ['', '', '', ''] null: [-2147483647, '', '', ''] bscale: ['', '', 3, ''] bzero: ['', '', 0.40000000000000002, ''] disp: ['I11', 'A3', 'G15.7', 'L6'] start: ['', '', '', ''] dim: ['', '', '', ''] it will show all its attributes, such as names, formats, bscales, bzeros, etc. We can also get these properties individually, e.g.:: >>> cols.names ['ID', 'name', 'mag', 'flag'] returns a (Python) list of field names. Since each field is a numpy object, we'll have the entire arsenal of numpy tools to use. We can reassign (update) the values:: >>> tbdata.field('flag')[:] = 0 Save File Changes ^^^^^^^^^^^^^^^^^ As mentioned earlier, after a user opened a file, made a few changes to either header or data, the user can use :meth:`HDUList.writeto` to save the changes. This takes the version of headers and data in memory and writes them to a new FITS file on disk. Subsequent operations can be performed to the data in memory and written out to yet another different file, all without recopying the original data to (more) memory. :: >>> hdulist.writeto('newimage.fits') will write the current content of ``hdulist`` to a new disk file newfile.fits. If a file was opened with the update mode, the :meth:`HDUList.flush` method can also be used to write all the changes made since :func:`open`, back to the original file. The :meth:`~HDUList.close` method will do the same for a FITS file opened with update mode:: >>> f = fits.open('original.fits', mode='update') ... # making changes in data and/or header >>> f.flush() # changes are written back to original.fits Creating a New FITS File ------------------------ Creating a New Image File ^^^^^^^^^^^^^^^^^^^^^^^^^ So far we have demonstrated how to read and update an existing FITS file. But how about creating a new FITS file from scratch? Such tasks are very easy in Astropy for an image HDU. We'll first demonstrate how to create a FITS file consisting only the primary HDU with image data. First, we create a numpy object for the data part:: >>> import numpy as np >>> n = np.arange(100.0) # a simple sequence of floats from 0.0 to 99.9 Next, we create a :class:`PrimaryHDU` object to encapsulate the data:: >>> hdu = fits.PrimaryHDU(n) We then create a HDUList to contain the newly created primary HDU, and write to a new file:: >>> hdulist = fits.HDUList([hdu]) >>> hdulist.writeto('new.fits') That's it! In fact, Astropy even provides a shortcut for the last two lines to accomplish the same behavior:: >>> hdu.writeto('new.fits') Creating a New Table File ^^^^^^^^^^^^^^^^^^^^^^^^^ To create a table HDU is a little more involved than image HDU, because a table's structure needs more information. First of all, tables can only be an extension HDU, not a primary. There are two kinds of FITS table extensions: ASCII and binary. We'll use binary table examples here. To create a table from scratch, we need to define columns first, by constructing the :class:`Column` objects and their data. Suppose we have two columns, the first containing strings, and the second containing floating point numbers:: >>> from astropy.io import fits >>> import numpy as np >>> a1 = np.array(['NGC1001', 'NGC1002', 'NGC1003']) >>> a2 = np.array([11.1, 12.3, 15.2]) >>> col1 = fits.Column(name='target', format='20A', array=a1) >>> col2 = fits.Column(name='V_mag', format='E', array=a2) Next, create a :class:`ColDefs` (column-definitions) object for all columns:: >>> cols = fits.ColDefs([col1, col2]) Now, create a new binary table HDU object by using the :func:`new_table()` function:: >>> tbhdu = fits.new_table(cols) This function returns (in this case) a :class:`BinTableHDU`. Of course, you can do this more concisely:: >>> from astropy.io import fits >>> tbhdu = fits.new_table( ... fits.ColDefs([fits.Column(name='target', format='20A', array=a1), ... fits.Column(name='V_mag', format='E', array=a2)])) Now you may write this new table HDU directly to a FITS file like so:: >>> hdu = fits.PrimaryHDU(n) This shortcut will automatically create a minimal primary HDU with no data and prepend it to the table HDU to create a valid FITS file. If you require additional data or header keywords in the primary HDU you may still create a :class:`PrimaryHDU` object and build up the FITS file manually using an :class:`HDUList`. For example, first create a new :class:`Header` object to encapsulate any keywords you want to include in the primary HDU, then as before create a :class:`PrimaryHDU`:: >>> prihdr = fits.Header() >>> prihdr['COMMENT'] = "Here's some commentary about this FITS file." >>> prihdu = fits.PrimaryHDU(header=prihdr) When we create a new primary HDU with a custom header this will automatically include any additional header keywords that are *required* by the FITS format (keywords such as ``SIMPLE`` and ``NAXIS`` for example). We then create a HDUList containing both the primary HDU and the newly created table extension, and write to a new file:: >>> thdulist = fits.HDUList([prihdu, tbhdu]) >>> thdulist.writeto('table.fits') Alternatively, you can append the table to the HDU list we already created in the image file section:: >>> hdulist.append(tbhdu) >>> hdulist.writeto('image_and_table.fits') So far, we have covered the most basic features of `astropy.io.fits`. In the following chapters we'll show more advanced examples and explain options in each class and method. Convenience Functions --------------------- `astropy.io.fits` also provides several high level ("convenience") functions. Such a convenience function is a "canned" operation to achieve one simple task. By using these "convenience" functions, a user does not have to worry about opening or closing a file, all the housekeeping is done implicitly. The first of these functions is :func:`getheader`, to get the header of an HDU. Here are several examples of getting the header. Only the file name is required for this function. The rest of the arguments are optional and flexible to specify which HDU the user wants to get:: >>> from astropy.io.fits import getheader >>> getheader('in.fits') # get default HDU (=0), i.e. primary HDU's header >>> getheader('in.fits', 0) # get primary HDU's header >>> getheader('in.fits', 2) # the second extension # the HDU with EXTNAME='sci' (if there is only 1) >>> getheader('in.fits', 'sci') # the HDU with EXTNAME='sci' and EXTVER=2 >>> getheader('in.fits', 'sci', 2) >>> getheader('in.fits', ('sci', 2)) # use a tuple to do the same >>> getheader('in.fits', ext=2) # the second extension # the 'sci' extension, if there is only 1 >>> getheader('in.fits', extname='sci') # the HDU with EXTNAME='sci' and EXTVER=2 >>> getheader('in.fits', extname='sci', extver=2) # ambiguous specifications will raise an exception, DON'T DO IT!! >>> getheader('in.fits', ext=('sci',1), extname='err', extver=2) After you get the header, you can access the information in it, such as getting and modifying a keyword value:: >>> from astropy.io.fits import getheader >>> hdr = getheader('in.fits', 1) # get first extension's header >>> filter = hdr['filter'] # get the value of the keyword "filter' >>> val = hdr[10] # get the 11th keyword's value >>> hdr['filter'] = 'FW555' # change the keyword value For the header keywords, the header is like a dictionary, as well as a list. The user can access the keywords either by name or by numeric index, as explained earlier in this chapter. If a user only needs to read one keyword, the :func:`getval` function can further simplify to just one call, instead of two as shown in the above examples:: >>> from astropy.io.fits import getval >>> flt = getval('in.fits', 'filter', 1) # get 1st extension's keyword # FILTER's value >>> val = getval('in.fits', 10, 'sci', 2) # get the 2nd sci extension's # 11th keyword's value The function :func:`getdata` gets the data of an HDU. Similar to :func:`getheader`, it only requires the input FITS file name while the extension is specified through the optional arguments. It does have one extra optional argument header. If header is set to True, this function will return both data and header, otherwise only data is returned:: >>> from astropy.io.fits import getdata >>> dat = getdata('in.fits', 'sci', 3) # get 3rd sci extension's data ... # get 1st extension's data and header >>> data, hdr = getdata('in.fits', 1, header=True) The functions introduced above are for reading. The next few functions demonstrate convenience functions for writing:: >>> fits.writeto('out.fits', data, header) The :func:`writeto` function uses the provided data and an optional header to write to an output FITS file. :: >>> fits.append('out.fits', data, header) The :func:`append` function will use the provided data and the optional header to append to an existing FITS file. If the specified output file does not exist, it will create one. :: >>> from astropy.io.fits import update >>> update(file, dat, hdr, 'sci') # update the 'sci' extension >>> update(file, dat, 3) # update the 3rd extension >>> update(file, dat, hdr, 3) # update the 3rd extension >>> update(file, dat, 'sci', 2) # update the 2nd SCI extension >>> update(file, dat, 3, header=hdr) # update the 3rd extension >>> update(file, dat, header=hdr, ext=5) # update the 5th extension The :func:`update` function will update the specified extension with the input data/header. The 3rd argument can be the header associated with the data. If the 3rd argument is not a header, it (and other positional arguments) are assumed to be the extension specification(s). Header and extension specs can also be keyword arguments. Finally, the :func:`info` function will print out information of the specified FITS file:: >>> fits.info('test0.fits') Filename: test0.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 138 () Int16 1 SCI ImageHDU 61 (400, 400) Int16 2 SCI ImageHDU 61 (400, 400) Int16 3 SCI ImageHDU 61 (400, 400) Int16 4 SCI ImageHDU 61 (400, 400) Int16 Using `io.fits` =============== .. toctree:: :maxdepth: 2 usage/headers usage/image usage/table usage/verification usage/unfamiliar usage/scripts usage/misc usage/examples Other Information ================= .. toctree:: :maxdepth: 1 appendix/faq appendix/history Reference/API ============= .. toctree:: :maxdepth: 3 api/files.rst api/hdulists.rst api/hdus.rst api/headers.rst api/cards.rst api/tables.rst api/images.rst api/diff.rst api/verification.rst .. rubric:: Footnotes .. [#f1] For legacy code only that already depends on PyFITS, it's acceptable to continue using "from astropy.io import fits as pyfits". astropy-0.3/docs/io/fits/usage/0000755000175000017500000000000012243263747014617 5ustar oleoleastropy-0.3/docs/io/fits/usage/verification.rst0000644000175000017500000003116112243255342020025 0ustar oleole.. currentmodule:: astropy.io.fits Verification ------------ Astropy has built in a flexible scheme to verify FITS data being conforming to the FITS standard. The basic verification philosophy in Astropy is to be tolerant in input and strict in output. When Astropy reads a FITS file which is not conforming to FITS standard, it will not raise an error and exit. It will try to make the best educated interpretation and only gives up when the offending data is accessed and no unambiguous interpretation can be reached. On the other hand, when writing to an output FITS file, the content to be written must be strictly compliant to the FITS standard by default. This default behavior can be overwritten by several other options, so the user will not be held up because of a minor standard violation. FITS Standard ^^^^^^^^^^^^^ Since FITS standard is a "loose" standard, there are many places the violation can occur and to enforce them all will be almost impossible. It is not uncommon for major observatories to generate data products which are not 100% FITS compliant. Some observatories have also developed their own sub-standard (dialect?) and some of these become so prevalent that they become de facto standards. Examples include the long string value and the use of the CONTINUE card. The violation of the standard can happen at different levels of the data structure. Astropy's verification scheme is developed on these hierarchical levels. Here are the 3 Astropy verification levels: 1. The HDU List 2. Each HDU 3. Each Card in the HDU Header These three levels correspond to the three categories of PyFITS objects: :class:`HDUList`, any HDU (e.g. :class:`PrimaryHDU`, :class:`ImageHDU`, etc.), and :class:`Card`. They are the only objects having the ``verify()`` method. Most other classes in astropy.io.fits do not have a ``verify()`` method. If ``verify()`` is called at the HDU List level, it verifies standard compliance at all three levels, but a call of ``verify()`` at the Card level will only check the compliance of that Card. Since Astropy is tolerant when reading a FITS file, no ``verify()`` is called on input. On output, ``verify()`` is called with the most restrictive option as the default. Verification Options ^^^^^^^^^^^^^^^^^^^^ There are 5 options for all verify(option) calls in Astropy. In addition, they available for the ``output_verify`` argument of the following methods: ``close()``, ``writeto()``, and ``flush()``. In these cases, they are passed to a ``verify()`` call within these methods. The 5 options are: **exception** This option will raise an exception, if any FITS standard is violated. This is the default option for output (i.e. when ``writeto()``, ``close()``, or ``flush()`` is called. If a user wants to overwrite this default on output, the other options listed below can be used. **ignore** This option will ignore any FITS standard violation. On output, it will write the HDU List content to the output FITS file, whether or not it is conforming to the FITS standard. The ignore option is useful in the following situations: 1. An input FITS file with non-standard formatting is read and the user wants to copy or write out to an output file. The non-standard formatting will be preserved in the output file. 2. A user wants to create a non-standard FITS file on purpose, possibly for testing or consistency. No warning message will be printed out. This is like a silent warning option (see below). **fix** This option will try to fix any FITS standard violations. It is not always possible to fix such violations. In general, there are two kinds of FITS standard violations: fixable and non-fixable. For example, if a keyword has a floating number with an exponential notation in lower case 'e' (e.g. 1.23e11) instead of the upper case 'E' as required by the FITS standard, it is a fixable violation. On the other hand, a keyword name like 'P.I.' is not fixable, since it will not know what to use to replace the disallowed periods. If a violation is fixable, this option will print out a message noting it is fixed. If it is not fixable, it will throw an exception. The principle behind fixing is to do no harm. For example, it is plausible to 'fix' a Card with a keyword name like 'P.I.' by deleting it, but Astropy will not take such action to hurt the integrity of the data. Not all fixes may be the "correct" fix, but at least Astropy will try to make the fix in such a way that it will not throw off other FITS readers. **silentfix** Same as fix, but will not print out informative messages. This may be useful in a large script where the user does not want excessive harmless messages. If the violation is not fixable, it will still throw an exception. **warn** This option is the same as the ignore option but will send warning messages. It will not try to fix any FITS standard violations whether fixable or not. Verifications at Different Data Object Levels ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We'll examine what Astropy's verification does at the three different levels: Verification at HDUList """"""""""""""""""""""" At the HDU List level, the verification is only for two simple cases: 1. Verify that the first HDU in the HDU list is a Primary HDU. This is a fixable case. The fix is to insert a minimal Primary HDU into the HDU list. 2. Verify second or later HDU in the HDU list is not a Primary HDU. Violation will not be fixable. Verification at Each HDU """""""""""""""""""""""" For each HDU, the mandatory keywords, their locations in the header, and their values will be verified. Each FITS HDU has a fixed set of required keywords in a fixed order. For example, the Primary HDU's header must at least have the following keywords: .. parsed-literal:: SIMPLE = T / BITPIX = 8 / NAXIS = 0 If any of the mandatory keywords are missing or in the wrong order, the fix option will fix them: >>> hdu.header # has a 'bad' header SIMPLE = T / NAXIS = 0 BITPIX = 8 / >>> hdu.verify('fix') # fix it Output verification result: 'BITPIX' card at the wrong place (card 2). Fixed by moving it to the right place (card 1). >>> h.header # voila! SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 Verification at Each Card """"""""""""""""""""""""" The lowest level, the Card, also has the most complicated verification possibilities. Here is a lit of fixable and not fixable Cards: Fixable Cards: 1. floating point numbers with lower case 'e' or 'd' 2. the equal sign is before column 9 in the card image 3. string value without enclosing quotes 4. missing equal sign before column 9 in the card image 5. space between numbers and E or D in floating point values 6. unparsable values will be "fixed" as a string Here are some examples of fixable cards: >>> hdu.header[4:] # has a bunch of fixable cards FIX1 = 2.1e23 FIX2= 2 FIX3 = string value without quotes FIX4 2 FIX5 = 2.4 e 03 FIX6 = '2 10 ' # can still access the values before the fix >>> hdu.header[5] 2 >>> hdu.header['fix4'] 2 >>> hdu.header['fix5'] 2400.0 >>> hdu.verify('silentfix') >>> hdu.header[4:] FIX1 = 2.1E23 FIX2 = 2 FIX3 = 'string value without quotes' FIX4 = 2 FIX5 = 2.4E03 FIX6 = '2 10 ' Unfixable Cards: 1. illegal characters in keyword name We'll summarize the verification with a "life-cycle" example: >>> h = fits.PrimaryHDU() # create a PrimaryHDU # Try to add an non-standard FITS keyword 'P.I.' (FITS does no allow '.' # in the keyword), if using the update() method - doesn't work! >>> h['P.I.'] = 'Hubble' ValueError: Illegal keyword name 'P.I.' # Have to do it the hard way (so a user will not do this by accident) # First, create a card image and give verbatim card content (including # the proper spacing, but no need to add the trailing blanks) >>> c = fits.Card.fromstring("P.I. = 'Hubble'") # then append it to the header >>> h.header.append(c) # Now if we try to write to a FITS file, the default output verification # will not take it. >>> h.writeto('pi.fits') Output verification result: HDU 0: Card 4: Unfixable error: Illegal keyword name 'P.I.' ...... raise VerifyError VerifyError # Must set the output_verify argument to 'ignore', to force writing a # non-standard FITS file >>> h.writeto('pi.fits', output_verify='ignore') # Now reading a non-standard FITS file # astropy.io.fits is magnanimous in reading non-standard FITS files >>> hdus = fits.open('pi.fits') >>> hdus[0].header SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 / number of array dimensions EXTEND = T P.I. = 'Hubble' # even when you try to access the offending keyword, it does NOT complain >>> hdus[0].header['p.i.'] 'Hubble' # But if you want to make sure if there is anything wrong/non-standard, # use the verify() method >>> hdus.verify() Output verification result: HDU 0: Card 4: Unfixable error: Illegal keyword name 'P.I.' Verification using the FITS Checksum Keyword Convention ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The North American FITS committee has reviewed the FITS Checksum Keyword Convention for possible adoption as a FITS Standard. This convention provides an integrity check on information contained in FITS HDUs. The convention consists of two header keyword cards: CHECKSUM and DATASUM. The CHECKSUM keyword is defined as an ASCII character string whose value forces the 32-bit 1's complement checksum accumulated over all the 2880-byte FITS logical records in the HDU to equal negative zero. The DATASUM keyword is defined as a character string containing the unsigned integer value of the 32-bit 1's complement checksum of the data records in the HDU. Verifying the the accumulated checksum is still equal to negative zero provides a fairly reliable way to determine that the HDU has not been modified by subsequent data processing operations or corrupted while copying or storing the file on physical media. In order to avoid any impact on performance, by default Astropy will not verify HDU checksums when a file is opened or generate checksum values when a file is written. In fact, CHECKSUM and DATASUM cards are automatically removed from HDU headers when a file is opened, and any CHECKSUM or DATASUM cards are stripped from headers when a HDU is written to a file. In order to verify the checksum values for HDUs when opening a file, the user must supply the checksum keyword argument in the call to the open convenience function with a value of True. When this is done, any checksum verification failure will cause a warning to be issued (via the warnings module). If checksum verification is requested in the open, and no CHECKSUM or DATASUM cards exist in the HDU header, the file will open without comment. Similarly, in order to output the CHECKSUM and DATASUM cards in an HDU header when writing to a file, the user must supply the checksum keyword argument with a value of True in the call to the writeto function. It is possible to write only the DATASUM card to the header by supplying the checksum keyword argument with a value of 'datasum'. Here are some examples: >>> # Open the file pix.fits verifying the checksum values for all HDUs >>> hdul = fits.open('pix.fits', checksum=True) >>> >>> # Open the file in.fits where checksum verification fails for the >>> # primary HDU >>> hdul = fits.open('in.fits', checksum=True) Warning: Checksum verification failed for HDU #0. >>> >>> # Create file out.fits containing an HDU constructed from data and >>> # header containing both CHECKSUM and DATASUM cards. >>> fits.writeto('out.fits', data, header, checksum=True) >>> >>> # Create file out.fits containing all the HDUs in the HDULIST >>> # hdul with each HDU header containing only the DATASUM card >>> hdul.writeto('out.fits', checksum='datasum') >>> >>> # Create file out.fits containing the HDU hdu with both CHECKSUM >>> # and DATASUM cards in the header >>> hdu.writeto('out.fits', checksum=True) >>> >>> # Append a new HDU constructed from array data to the end of >>> # the file existingfile.fits with only the appended HDU >>> # containing both CHECKSUM and DATASUM cards. >>> fits.append('existingfile.fits', data, checksum=True) astropy-0.3/docs/io/fits/usage/image.rst0000644000175000017500000002043712243255342016431 0ustar oleole.. currentmodule:: astropy.io.fits Image Data ---------- In this chapter, we'll discuss the data component in an image HDU. Image Data as an Array ^^^^^^^^^^^^^^^^^^^^^^ A FITS primary HDU or an image extension HDU may contain image data. The following discussions apply to both of these HDU classes. In Astropy, for most cases, it is just a simple numpy array, having the shape specified by the NAXIS keywords and the data type specified by the BITPIX keyword - unless the data is scaled, see next section. Here is a quick cross reference between allowed BITPIX values in FITS images and the numpy data types: .. parsed-literal:: **BITPIX** **Numpy Data Type** 8 numpy.uint8 (note it is UNsigned integer) 16 numpy.int16 32 numpy.int32 -32 numpy.float32 -64 numpy.float64 To recap the fact that in numpy the arrays are 0-indexed and the axes are ordered from slow to fast. So, if a FITS image has NAXIS1=300 and NAXIS2=400, the numpy array of its data will have the shape of (400, 300). Here is a summary of reading and updating image data values: >>> f = fits.open('image.fits') # open a FITS file >>> scidata = f[1].data # assume the first extension is an image >>> print scidata[1,4] # get the pixel value at x=5, y=2 >>> scidata[30:40, 10:20] # get values of the subsection # from x=11 to 20, y=31 to 40 (inclusive) >>> scidata[1,4] = 999 # update a pixel value >>> scidata[30:40, 10:20] = 0 # update values of a subsection >>> scidata[3] = scidata[2] # copy the 3rd row to the 4th row Here are some more complicated examples by using the concept of the "mask array". The first example is to change all negative pixel values in scidata to zero. The second one is to take logarithm of the pixel values which are positive: >>> scidata[scidata<0] = 0 >>> scidata[scidata>0] = numpy.log(scidata[scidata>0]) These examples show the concise nature of numpy array operations. Scaled Data ^^^^^^^^^^^ Sometimes an image is scaled, i.e. the data stored in the file is not the image's physical (true) values, but linearly transformed according to the equation: .. parsed-literal:: physical value = BSCALE\*(storage value) + BZERO BSCALE and BZERO are stored as keywords of the same names in the header of the same HDU. The most common use of scaled image is to store unsigned 16-bit integer data because FITS standard does not allow it. In this case, the stored data is signed 16-bit integer (BITPIX=16) with BZERO=32768 (2\*\*15), BSCALE=1. Reading Scaled Image Data """"""""""""""""""""""""" Images are scaled only when either of the BSCALE/BZERO keywords are present in the header and either of their values is not the default value (BSCALE=1, BZERO=0). For unscaled data, the data attribute of an HDU in Astropy is a numpy array of the same data type as specified by the BITPIX keyword. For scaled image, the .data attribute will be the physical data, i.e. already transformed from the storage data and may not be the same data type as prescribed in BITPIX. This means an extra step of copying is needed and thus the corresponding memory requirement. This also means that the advantage of memory mapping is reduced for scaled data. For floating point storage data, the scaled data will have the same data type. For integer data type, the scaled data will always be single precision floating point (numpy.float32). Here is an example of what happens to such a file, before and after the data is touched >>> f = fits.open('scaled_uint16.fits') >>> hdu = f[1] >>> print hdu.header['bitpix'], hdu.header['bzero'] 16 32768 >>> print hdu.data # once data is touched, it is scaled [ 11. 12. 13. 14. 15.] >>> hdu.data.dtype.name 'float32' >>> print hdu.header['bitpix'] # BITPIX is also updated -32 # BZERO and BSCALE are removed after the scaling >>> print hdu.header['bzero'] KeyError: "Keyword 'bzero' not found." .. warning:: An important caveat to be aware of when dealing with scaled data in PyFITS, is that when accessing the data via the .data attribute, the data is automatically scaled with the BZERO and BSCALE parameters. If the file was opened in "update" mode, it will be saved with the rescaled data. This surprising behavior is a compromise to err on the side of not losing data: If some floating point calculations were made on the data, rescaling it when saving could result in a loss of information. To prevent this automatic scaling, open the file with the ``do_not_scale_image_data=True`` argument to ``fits.open()``. This is especially useful for updating some header values, while ensuring that the data is not modified. One may also manually reapply scale parameters by using ``hdu.scale()`` (see below). Alternately, one may open files with the ``scale_back=True`` argument. This assures that the original scaling is preserved when saving. Writing Scaled Image Data """"""""""""""""""""""""" With the extra processing and memory requirement, we discourage users to use scaled data as much as possible. However, Astropy does provide ways to write scaled data with the scale(type, option, bscale, bzero) method. Here are a few examples: >>> # scale the data to Int16 with user specified bscale/bzero >>> hdu.scale('int16', bzero=32768) >>> # scale the data to Int32 with the min/max of the data range >>> hdu.scale('int32', 'minmax') >>> # scale the data, using the original BSCALE/BZERO >>> hdu.scale('int32', 'old') The first example above shows how to store an unsigned short integer array. Great caution must be exercised when using the :meth:`~ImageHDU.scale` method. The :attr:`~ImageHDU.data` attribute of an image HDU, after the :meth:`~ImageHDU.scale` call, will become the storage values, not the physical values. So, only call :meth:`~ImageHDU.scale` just before writing out to FITS files, i.e. calls of :meth:`~HDUList.writeto`, :meth:`~HDUList.flush`, or :meth:`~HDUList.close`. No further use of the data should be exercised. Here is an example of what happens to the :attr:`~ImageHDU.data` attribute after the :meth:`~ImageHDU.scale` call: >>> hdu = fits.PrimaryHDU(numpy.array([0., 1, 2, 3])) >>> print hdu.data [ 0. 1. 2. 3.] >>> hdu.scale('int16', bzero=32768) >>> print hdu.data # now the data has storage values [-32768 -32767 -32766 -32765] >>> hdu.writeto('new.fits') .. _data-sections: Data Sections ^^^^^^^^^^^^^ When a FITS image HDU's .data is accessed, either the whole data is copied into memory (in cases of NOT using memory mapping or if the data is scaled) or a virtual memory space equivalent to the data size is allocated (in the case of memory mapping of non-scaled data). If there are several very large image HDUs being accessed at the same time, the system may run out of memory. If a user does not need the entire image(s) at the same time, e.g. processing images(s) ten rows at a time, the :attr:`~ImageHDU.section` attribute of an HDU can be used to alleviate such memory problems. With PyFITS' improved support for memory-mapping, the sections feature is not as necessary as it used to be for handling very large images. However, if the image's data is scaled with non-trivial BSCALE/BZERO values, accessing the data in sections may still be necessary under the current implementation. Memmap is also insufficient for loading images large than ~4 GB on a 32-bit system--in such cases it may be necessary to use sections. Here is an example of getting the median image from 3 input images of the size 5000x5000: >>> f1 = fits.open('file1.fits') >>> f2 = fits.open('file2.fits') >>> f3 = fits.open('file3.fits') >>> output = numpy.zeros(5000 * 5000) >>> for i in range(50): ... j = i * 100 ... k = j + 100 ... x1 = f1[1].section[j:k,:] ... x2 = f2[1].section[j:k,:] ... x3 = f3[1].section[j:k,:] ... # use scipy.stsci.image's median function ... output[j:k] = image.median([x1, x2, x3]) Data in each :attr:`~ImageHDU.section` does not need to be contiguous for memory savings to be possible. PyFITS will do its best to join together discontiguous sections of the array while reading as little as possible into memory. Sections cannot be assigned to. Any modifications made to a data section are not saved back to the original file. astropy-0.3/docs/io/fits/usage/examples.rst0000644000175000017500000000332212243255342017157 0ustar oleoleExamples -------- Converting a 3-color image (JPG) to separate FITS images ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. figure:: ../images/Hs-2009-14-a-web.jpg :scale: 100 % :align: center :alt: Starting image .. container:: figures .. figure:: ../images/Red.jpg :scale: 50 :alt: Red color information Red color information .. figure:: ../images/Green.jpg :scale: 50 :alt: Green color information Green color information .. figure:: ../images/Blue.jpg :scale: 50 :alt: Blue color information Blue color information :: #!/usr/bin/env python import numpy import Image from astropy.io import fits #get the image and color information image = Image.open('hs-2009-14-a-web.jpg') #image.show() xsize, ysize = image.size r, g, b = image.split() rdata = r.getdata() # data is now an array of length ysize\*xsize gdata = g.getdata() bdata = b.getdata() # create numpy arrays npr = numpy.reshape(rdata, (ysize, xsize)) npg = numpy.reshape(gdata, (ysize, xsize)) npb = numpy.reshape(bdata, (ysize, xsize)) # write out the fits images, the data numbers are still JUST the RGB # scalings; don't use for science red = fits.PrimaryHDU(data=npr) red.header['LATOBS'] = "32:11:56" # add spurious header info red.header['LONGOBS'] = "110:56" red.writeto('red.fits') green = fits.PrimaryHDU(data=npg) green.header['LATOBS'] = "32:11:56" green.header['LONGOBS'] = "110:56" green.writeto('green.fits') blue = fits.PrimaryHDU(data=npb) blue.header['LATOBS'] = "32:11:56" blue.header['LONGOBS'] = "110:56" blue.writeto('blue.fits') astropy-0.3/docs/io/fits/usage/table.rst0000644000175000017500000003172612243255342016441 0ustar oleole.. currentmodule:: astropy.io.fits Table Data ---------- In this chapter, we'll discuss the data component in a table HDU. A table will always be in an extension HDU, never in a primary HDU. There are two kinds of table in the FITS standard: binary tables and ASCII tables. Binary tables are more economical in storage and faster in data access and manipulation. ASCII tables store the data in a "human readable" form and therefore takes up more storage space as well as more processing time since the ASCII text need to be parsed back into numerical values. Table Data as a Record Array ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ What is a Record Array? """"""""""""""""""""""" A record array is an array which contains records (i.e. rows) of heterogeneous data types. Record arrays are available through the records module in the numpy library. Here is a simple example of record array: >>> from numpy import rec >>> bright = rec.array([(1,'Sirius', -1.45, 'A1V'), ... (2,'Canopus', -0.73, 'F0Ib'), ... (3,'Rigil Kent', -0.1, 'G2V')], ... formats='int16,a20,float32,a10', ... names='order,name,mag,Sp') In this example, there are 3 records (rows) and 4 fields (columns). The first field is a short integer, second a character string (of length 20), third a floating point number, and fourth a character string (of length 10). Each record has the same (heterogeneous) data structure. Metadata of a Table """"""""""""""""""" The data in a FITS table HDU is basically a record array, with added attributes. The metadata, i.e. information about the table data, are stored in the header. For example, the keyword TFORM1 contains the format of the first field, TTYPE2 the name of the second field, etc. NAXIS2 gives the number of records(rows) and TFIELDS gives the number of fields (columns). For FITS tables, the maximum number of fields is 999. The data type specified in TFORM is represented by letter codes for binary tables and a FORTRAN-like format string for ASCII tables. Note that this is different from the format specifications when constructing a record array. Reading a FITS Table """""""""""""""""""" Like images, the .data attribute of a table HDU contains the data of the table. To recap, the simple example in the Quick Tutorial: >>> f = fits.open('bright_stars.fits') # open a FITS file >>> tbdata = f[1].data # assume the first extension is a table >>> print tbdata[:2] # show the first two rows [(1, 'Sirius', -1.4500000476837158, 'A1V'), (2, 'Canopus', -0.73000001907348633, 'F0Ib')] >>> print tbdata.field('mag') # show the values in field "mag" [-1.45000005 -0.73000002 -0.1 ] >>> print tbdata.field(1) # field can be referred by index too ['Sirius' 'Canopus' 'Rigil Kent'] >>> scidata[1,4] = 999 # update a pixel value >>> scidata[30:40, 10:20] = 0 # update values of a subsection >>> scidata[3] = scidata[2] # copy the 3rd row to the 4th row Note that in Astropy, when using the ``field()`` method, it is 0-indexed while the suffixes in header keywords, such as TFORM is 1-indexed. So, ``tbdata.field(0)`` is the data in the column with the name specified in TTYPE1 and format in TFORM1. **Warning:** The FITS format allows table columns with a zero-width data format, such as '0D'. This is probably intended as a space-saving measure on files in which that column contains no data. In such files, the zero-width columns are omitted when accessing the table data, so the indexes of fields might change when using the ``field()`` method. For this reason, if you expect to encounter files containing zero-width columns it is recommended to access fields by name rather than by index. Table Operations ^^^^^^^^^^^^^^^^ Selecting Records in a Table """""""""""""""""""""""""""" Like image data, we can use the same "mask array" idea to pick out desired records from a table and make a new table out of it. In the next example, assuming the table's second field having the name 'magnitude', an output table containing all the records of magnitude > 5 from the input table is generated: >>> from astropy.io import fits >>> t = fits.open('table.fits') >>> tbdata = t[1].data >>> mask = tbdata.field('magnitude') > 5 >>> newtbdata = tbdata[mask] >>> hdu = fits.BinTableHDU(newtbdata) >>> hdu.writeto('newtable.fits') Merging Tables """""""""""""" Merging different tables is straightforward in Astropy. Simply merge the column definitions of the input tables: >>> t1 = fits.open('table1.fits') >>> t2 = fits.open('table2.fits') # the column attribute is the column definitions >>> t = t1[1].columns + t2[1].columns >>> hdu = fits.new_table(t) >>> hdu.writeto('newtable.fits') The number of fields in the output table will be the sum of numbers of fields of the input tables. Users have to make sure the input tables don't share any common field names. The number of records in the output table will be the largest number of records of all input tables. The expanded slots for the originally shorter table(s) will be zero (or blank) filled. Appending Tables """""""""""""""" Appending one table after another is slightly trickier, since the two tables may have different field attributes. Here are two examples. The first is to append by field indices, the second one is to append by field names. In both cases, the output table will inherit column attributes (name, format, etc.) of the first table. >>> t1 = fits.open('table1.fits') >>> t2 = fits.open('table2.fits') # one way to find the number of records >>> nrows1 = t1[1].data.shape[0] # another way to find the number of records >>> nrows2 = t2[1].header['naxis2'] # total number of rows in the table to be generated >>> nrows = nrows1 + nrows2 >>> hdu = fits.new_table(t1[1].columns, nrows=nrows) # first case, append by the order of fields >>> for i in range(len(t1[1].columns)): ... hdu.data.field(i)[nrows1:]=t2[1].data.field(i) # or, second case, append by the field names >>> for name in t1[1].columns.names: ... hdu.data.field(name)[nrows1:]=t2[1].data.field(name) # write the new table to a FITS file >>> hdu.writeto('newtable.fits') Scaled Data in Tables ^^^^^^^^^^^^^^^^^^^^^ A table field's data, like an image, can also be scaled. Scaling in a table has a more generalized meaning than in images. In images, the physical data is a simple linear transformation from the storage data. The table fields do have such construct too, where BSCALE and BZERO are stored in the header as TSCALn and TZEROn. In addition, Boolean columns and ASCII tables' numeric fields are also generalized "scaled" fields, but without TSCAL and TZERO. All scaled fields, like the image case, will take extra memory space as well as processing. So, if high performance is desired, try to minimize the use of scaled fields. All the scalings are done for the user, so the user only sees the physical data. Thus, this no need to worry about scaling back and forth between the physical and storage column values. Creating a FITS Table ^^^^^^^^^^^^^^^^^^^^^ Column Creation """"""""""""""" To create a table from scratch, it is necessary to create individual columns first. A :class:`Column` constructor needs the minimal information of column name and format. Here is a summary of all allowed formats for a binary table: .. parsed-literal:: **FITS format code Description 8-bit bytes** L logical (Boolean) 1 X bit \* B Unsigned byte 1 I 16-bit integer 2 J 32-bit integer 4 K 64-bit integer 4 A character 1 E single precision floating point 4 D double precision floating point 8 C single precision complex 8 M double precision complex 16 P array descriptor 8 We'll concentrate on binary tables in this chapter. ASCII tables will be discussed in a later chapter. The less frequently used X format (bit array) and P format (used in variable length tables) will also be discussed in a later chapter. Besides the required name and format arguments in constructing a :class:`Column`, there are many optional arguments which can be used in creating a column. Here is a list of these arguments and their corresponding header keywords and descriptions: .. parsed-literal:: **Argument Corresponding Description** **in Column() header keyword** name TTYPE column name format TFORM column format unit TUNIT unit null TNULL null value (only for B, I, and J) bscale TSCAL scaling factor for data bzero TZERO zero point for data scaling disp TDISP display format dim TDIM multi-dimensional array spec start TBCOL starting position for ASCII table array the data of the column Here are a few Columns using various combination of these arguments: >>> import numpy as np >>> from fits import Column >>> counts = np.array([312, 334, 308, 317]) >>> names = np.array(['NGC1', 'NGC2', 'NGC3', 'NGC4']) >>> c1 = Column(name='target', format='10A', array=names) >>> c2 = Column(name='counts', format='J', unit='DN', array=counts) >>> c3 = Column(name='notes', format='A10') >>> c4 = Column(name='spectrum', format='1000E') >>> c5 = Column(name='flag', format='L', array=[1, 0, 1, 1]) In this example, formats are specified with the FITS letter codes. When there is a number (>1) preceding a (numeric type) letter code, it means each cell in that field is a one-dimensional array. In the case of column c4, each cell is an array (a numpy array) of 1000 elements. For character string fields, the number be to the *left* of the letter 'A' when creating binary tables, and should be to the *right* when creating ASCII tables. However, as this is a common confusion both formats are understood when creating binary tables (note, however, that upon writing to a file the correct format will be written in the header). So, for columns c1 and c3, they both have 10 characters in each of their cells. For numeric data type, the dimension number must be before the letter code, not after. After the columns are constructed, the :func:`new_table` function can be used to construct a table HDU. We can either go through the column definition object: >>> coldefs = fits.ColDefs([c1, c2, c3, c4, c5]) >>> tbhdu = fits.new_table(coldefs) or directly use the :func:`new_table` function: >>> tbhdu = fits.new_table([c1, c2, c3, c4, c5]) A look of the newly created HDU's header will show that relevant keywords are properly populated: >>> tbhdu.header XTENSION = 'BINTABLE' / binary table extension BITPIX = 8 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 4025 / length of dimension 1 NAXIS2 = 4 / length of dimension 2 PCOUNT = 0 / number of group parameters GCOUNT = 1 / number of groups TFIELDS = 5 / number of table fields TTYPE1 = 'target ' TFORM1 = '10A ' TTYPE2 = 'counts ' TFORM2 = 'J ' TUNIT2 = 'DN ' TTYPE3 = 'notes ' TFORM3 = '10A ' TTYPE4 = 'spectrum' TFORM4 = '1000E ' TTYPE5 = 'flag ' TFORM5 = 'L ' **Warning:** It should be noted that when creating a new table with :func:`new_table`, an in-memory copy of all of the input column arrays is created. This is because it is not guaranteed that the columns are arranged contiguously in memory in row-major order (in fact, they are most likely not), so they have to be combined into a new array. However, if the array data *is* already contiguous in memory, such as in an existing record array, a kludge can be used to create a new table HDU without any copying. First, create the Columns as before, but without using the ``array=`` argument: >>> c1 = Column(name='target', format='10A') ... Then call :func:`new_table`: >>> tbhdu = fits.new_table([c1, c2, c3, c4, c5]) This will create a new table HDU as before, with the correct column definitions, but an empty data section. Now simply assign your array directly to the HDU's data attribute: >>> tbhdu.data = mydata In a future version of Astropy table creation will be simplified and this process won't be necessary. astropy-0.3/docs/io/fits/usage/scripts.rst0000644000175000017500000000134512243255342017033 0ustar oleoleExecutable Scripts ------------------ Astropy installs a couple of useful utility programs on your system that are built with Astropy. fitscheck ^^^^^^^^^ .. automodule:: astropy.io.fits.scripts.fitscheck With Astropy installed, please run ``fitscheck --help`` to see the full program usage documentation. fitsdiff ^^^^^^^^ .. currentmodule:: astropy.io.fits fitsdiff provides a thin command-line wrapper around the :class:`FITSDiff` interface--it outputs the report from a :class:`FITSDiff` of two FITS files, and like common diff-like commands returns a 0 status code if no differences were found, and 1 if differences were found: With Astropy installed, please run ``fitscheck --help`` to see the full program usage documentation. astropy-0.3/docs/io/fits/usage/unfamiliar.rst0000644000175000017500000005136012243255342017475 0ustar oleole.. currentmodule:: astropy.io.fits Less Familiar Objects --------------------- In this chapter, we'll discuss less frequently used FITS data structures. They include ASCII tables, variable length tables, and random access group FITS files. ASCII Tables ^^^^^^^^^^^^ FITS standard supports both binary and ASCII tables. In ASCII tables, all the data are stored in a human readable text form, so it takes up more space and extra processing to parse the text for numeric data. In Astropy, the interface for ASCII tables and binary tables is basically the same, i.e. the data is in the ``.data`` attribute and the ``field()`` method is used to refer to the columns and returns a numpy array. When reading the table, Astropy will automatically detect what kind of table it is. >>> from astropy.io import fits >>> hdus = fits.open('ascii_table.fits') >>> hdus[1].data[:1] FITS_rec( ... [(10.123000144958496, 37)], ... dtype=[('a', '>f4'),('b','>i4')]) >>> hdus[1].data.field('a') array([ 10.12300014, 5.19999981, 15.60999966, 0. , 345. ], dtype=float32) >>> hdus[1].data.formats ['E10.4', 'I5'] Note that the formats in the record array refer to the raw data which are ASCII strings (therefore 'a11' and 'a5'), but the .formats attribute of data retains the original format specifications ('E10.4' and 'I5'). Creating an ASCII Table """"""""""""""""""""""" Creating an ASCII table from scratch is similar to creating a binary table. The difference is in the Column definitions. The columns/fields in an ASCII table are more limited than in a binary table. It does not allow more than one numerical value in a cell. Also, it only supports a subset of what allowed in a binary table, namely character strings, integer, and (single and double precision) floating point numbers. Boolean and complex numbers are not allowed. The format syntax (the values of the TFORM keywords) is different from that of a binary table, they are: .. parsed-literal:: Aw Character string Iw (Decimal) Integer Fw.d Single precision real Ew.d Single precision real, in exponential notation Dw.d Double precision real, in exponential notation where, w is the width, and d the number of digits after the decimal point. The syntax difference between ASCII and binary tables can be confusing. For example, a field of 3-character string is specified '3A' in a binary table and as 'A3' in an ASCII table. The other difference is the need to specify the table type when using either :meth:`ColDef` or :func:`new_table`. The default value for tbtype is ``BinTableHDU``. >>> # Define the columns >>> import numpy as np >>> from astropy.io import fits >>> a1 = np.array(['abcd', 'def']) >>> r1 = np.array([11., 12.]) >>> c1 = fits.Column(name='abc', format='A3', array=a1) >>> c2 = fits.Column(name='def', format='E', array=r1, ... bscale=2.3, bzero=0.6) >>> c3 = fits.Column(name='t1', format='I', array=[91, 92, 93]) # Create the table >>> x = fits.ColDefs([c1, c2, c3], tbtype='TableHDU') >>> hdu = fits.new_table(x, tbtype='TableHDU') # Or, simply, >>> hdu = fits.new_table([c1, c2, c3], tbtype='TableHDU') >>> hdu.writeto('ascii.fits') >>> hdu.data FITS_rec([('abcd', 11.0, 91), ('def', 12.0, 92), ('', 0.0, 93)], dtype=[('abc', '|S3'), ('def', '|S14'), ('t1', '|S10')]) Variable Length Array Tables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The FITS standard also supports variable length array tables. The basic idea is that sometimes it is desirable to have tables with cells in the same field (column) that have the same data type but have different lengths/dimensions. Compared with the standard table data structure, the variable length table can save storage space if there is a large dynamic range of data lengths in different cells. A variable length array table can have one or more fields (columns) which are variable length. The rest of the fields (columns) in the same table can still be regular, fixed-length ones. Astropy will automatically detect what kind of field it is during reading; no special action is needed from the user. The data type specification (i.e. the value of the TFORM keyword) uses an extra letter 'P' and the format is .. parsed-literal:: rPt(max) where r is 0, 1, or absent, t is one of the letter code for regular table data type (L, B, X, I, J, etc. currently, the X format is not supported for variable length array field in Astropy), and max is the maximum number of elements. So, for a variable length field of int32, The corresponding format spec is, e.g. 'PJ(100)'. >>> f = fits.open('variable_length_table.fits') >>> print f[1].header['tform5'] 1PI(20) >>> print f[1].data.field(4)[:3] [array([1], dtype=int16) array([88, 2], dtype=int16) array([ 1, 88, 3], dtype=int16)] The above example shows a variable length array field of data type int16 and its first row has one element, second row has 2 elements etc. Accessing variable length fields is almost identical to regular fields, except that operations on the whole filed are usually not possible. A user has to process the field row by row. Creating a Variable Length Array Table """""""""""""""""""""""""""""""""""""" Creating a variable length table is almost identical to creating a regular table. The only difference is in the creation of field definitions which are variable length arrays. First, the data type specification will need the 'P' letter, and secondly, the field data must be an objects array (as included in the numpy module). Here is an example of creating a table with two fields, one is regular and the other variable length array. >>> from astropy.io import fits >>> import numpy as np >>> c1 = fits.Column(name='var', format='PJ()', ... array=np.array([[45., 56] [11, 12, 13]], ... dtype=np.object)) >>> c2 = fits.Column(name='xyz', format='2I', array=[[11, 3], [12, 4]]) # the rest is the same as a regular table. # Create the table HDU >>> tbhdu = fits.new_table([c1, c2]) >>> print tbhdu.data FITS_rec([(array([45, 56]), array([11, 3], dtype=int16)), (array([11, 12, 13]), array([12, 4], dtype=int16))], dtype=[('var', '>> tbhdu.writeto('var_table.fits') >>> hdu = fits.open('var_table.fits') # Note that heap info is taken care of (PCOUNT) when written to FITS file. >>> hdu[1].header XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 12 / length of dimension 1 NAXIS2 = 2 / length of dimension 2 PCOUNT = 20 / number of group parameters GCOUNT = 1 / number of groups TFIELDS = 2 / number of table fields TTYPE1 = 'var ' TFORM1 = 'PJ(3) ' TTYPE2 = 'xyz ' TFORM2 = '2I ' Random Access Groups ^^^^^^^^^^^^^^^^^^^^ Another less familiar data structure supported by the FITS standard is the random access group. This convention was established before the binary table extension was introduced. In most cases its use can now be superseded by the binary table. It is mostly used in radio interferometry. Like Primary HDUs, a Random Access Group HDU is always the first HDU of a FITS file. Its data has one or more groups. Each group may have any number (including 0) of parameters, together with an image. The parameters and the image have the same data type. All groups in the same HDU have the same data structure, i.e. same data type (specified by the keyword BITPIX, as in image HDU), same number of parameters (specified by PCOUNT), and the same size and shape (specified by NAXISn keywords) of the image data. The number of groups is specified by GCOUNT and the keyword NAXIS1 is always 0. Thus the total data size for a Random Access Group HDU is .. parsed-literal:: \|BITPIX\| \* GCOUNT \* (PCOUNT + NAXIS2 \* NAXIS3 \* ... \* NAXISn) Header and Summary """""""""""""""""" Accessing the header of a Random Access Group HDU is no different from any other HDU. Just use the .header attribute. The content of the HDU can similarly be summarized by using the :meth:`HDUList.info` method: >>> f = fits.open('random_group.fits') >>> print f[0].header['groups'] True >>> print f[0].header['gcount'] 7956 >>> print f[0].header['pcount'] 6 >>> f.info() Filename: random_group.fits No. Name Type Cards Dimensions Format 0 AN GroupsHDU 158 (3, 4, 1, 1, 1) Float32 7956 Groups 6 Parameters Data: Group Parameters """""""""""""""""""""" The data part of a random access group HDU is, like other HDUs, in the ``.data`` attribute. It includes both parameter(s) and image array(s). 1. show the data in 100th group, including parameters and data >>> print f[0].data[99] (-8.1987486677035799e-06, 1.2010923615889215e-05, -1.011189139244005e-05, 258.0, 2445728., 0.10, array([[[[[ 12.4308672 , 0.56860745, 3.99993873], [ 12.74043655, 0.31398511, 3.99993873], [ 0. , 0. , 3.99993873], [ 0. , 0. , 3.99993873]]]]], dtype=float32)) The data first lists all the parameters, then the image array, for the specified group(s). As a reminder, the image data in this file has the shape of (1,1,1,4,3) in Python or C convention, or (3,4,1,1,1) in IRAF or FORTRAN convention. To access the parameters, first find out what the parameter names are, with the .parnames attribute: >>> f[0].data.parnames # get the parameter names ['uu--', 'vv--', 'ww--', 'baseline', 'date', 'date'] The group parameter can be accessed by the :meth:`~GroupData.par` method. Like the table :meth:`~FITS_rec.field` method, the argument can be either index or name: >>> print f[0].data.par(0)[99] # Access group parameter by name or by index -8.1987486677035799e-06 >>> print f[0].data.par('uu--')[99] -8.1987486677035799e-06 Note that the parameter name 'date' appears twice. This is a feature in the random access group, and it means to add the values together. Thus: >>> # Duplicate group parameter name 'date' for 5th and 6th parameters >>> print f[0].data.par(4)[99] 2445728.0 >>> print f[0].data.par(5)[99] 0.10 # When accessed by name, it adds the values together if the name is shared # by more than one parameter >>> print f[0].data.par('date')[99] 2445728.10 The :meth`~GroupData.par` is a method for either the entire data object or one data item (a group). So there are two possible ways to get a group parameter for a certain group, this is similar to the situation in table data (with its :meth:`~FITS_rec.field` method): >>> # Access group parameter by selecting the row (group) number last >>> print f[0].data.par(0)[99] -8.1987486677035799e-06 # Access group parameter by selecting the row (group) number first >>> print f[0].data[99].par(0) -8.1987486677035799e-06 On the other hand, to modify a group parameter, we can either assign the new value directly (if accessing the row/group number last) or use the :meth:`~GroupData.setpar` method (if accessing the row/group number first). The method :meth:`~GroupData.setpar` is also needed for updating by name if the parameter is shared by more than one parameters: >>> # Update group parameter when selecting the row (group) number last >>> f[0].data.par(0)[99] = 99. >>> # Update group parameter when selecting the row (group) number first >>> f[0].data[99].setpar(0, 99.) # or setpar('uu--', 99.) >>> # Update group parameter by name when the name is shared by more than # one parameters, the new value must be a tuple of constants or sequences >>> f[0].data[99].setpar('date', (2445729., 0.3)) >>> f[0].data[:3].setpar('date', (2445729., [0.11, 0.22, 0.33])) >>> f[0].data[:3].par('date') array([ 2445729.11 , 2445729.22 , 2445729.33000001]) Data: Image Data """""""""""""""" The image array of the data portion is accessible by the :attr:`~GroupData.data` attribute of the data object. A numpy array is returned: >>> print f[0].data.data[99] array([[[[[ 12.4308672 , 0.56860745, 3.99993873], [ 12.74043655, 0.31398511, 3.99993873], [ 0. , 0. , 3.99993873], [ 0. , 0. , 3.99993873]]]]], type=float32) Creating a Random Access Group HDU """""""""""""""""""""""""""""""""" To create a random access group HDU from scratch, use :meth:`GroupData` to encapsulate the data into the group data structure, and use :meth:`GroupsHDU` to create the HDU itself: >>> # Create the image arrays. The first dimension is the number of groups. >>> imdata = numpy.arange(100.0, shape=(10, 1, 1, 2, 5)) # Next, create the group parameter data, we'll have two parameters. # Note that the size of each parameter's data is also the number of groups. # A parameter's data can also be a numeric constant. >>> pdata1 = numpy.arange(10) + 0.1 >>> pdata2 = 42 # Create the group data object, put parameter names and parameter data # in lists assigned to their corresponding arguments. # If the data type (bitpix) is not specified, the data type of the image # will be used. >>> x = fits.GroupData(imdata, parnames=['abc', 'xyz'], ... pardata=[pdata1, pdata2], bitpix=-32) # Now, create the GroupsHDU and write to a FITS file. >>> hdu = fits.GroupsHDU(x) >>> hdu.writeto('test_group.fits') >>> hdu.header SIMPLE = T / conforms to FITS standard BITPIX = -32 / array data type NAXIS = 5 / number of array dimensions NAXIS1 = 0 NAXIS2 = 5 NAXIS3 = 2 NAXIS4 = 1 NAXIS5 = 1 EXTEND = T GROUPS = T / has groups PCOUNT = 2 / number of parameters GCOUNT = 10 / number of groups PTYPE1 = 'abc ' PTYPE2 = 'xyz ' >>> print hdu.data[:2] FITS_rec[ (0.10000000149011612, 42.0, array([[[[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.]]]], dtype=float32)), (1.1000000238418579, 42.0, array([[[[ 10., 11., 12., 13., 14.], [ 15., 16., 17., 18., 19.]]]], dtype=float32)) ] Compressed Image Data ^^^^^^^^^^^^^^^^^^^^^ A general technique has been developed for storing compressed image data in FITS binary tables. The principle used in this convention is to first divide the n-dimensional image into a rectangular grid of sub images or 'tiles'. Each tile is then compressed as a continuous block of data, and the resulting compressed byte stream is stored in a row of a variable length column in a FITS binary table. Several commonly used algorithms for compressing image tiles are supported. These include, Gzip, Rice, IRAF Pixel List (PLIO), and Hcompress. For more details, reference "A FITS Image Compression Proposal" from: http://www.adass.org/adass/proceedings/adass99/P2-42/ and "Registered FITS Convention, Tiled Image Compression Convention": http://fits.gsfc.nasa.gov/registry/tilecompression.html Compressed image data is accessed, in Astropy, using the optional "astropy.io.fits.compression" module contained in a C shared library (compression.so). If an attempt is made to access an HDU containing compressed image data when the compression module is not available, the user is notified of the problem and the HDU is treated like a standard binary table HDU. This notification will only be made the first time compressed image data is encountered. In this way, the compression module is not required in order for Astropy to work. Header and Summary """""""""""""""""" In Astropy, the header of a compressed image HDU appears to the user like any image header. The actual header stored in the FITS file is that of a binary table HDU with a set of special keywords, defined by the convention, to describe the structure of the compressed image. The conversion between binary table HDU header and image HDU header is all performed behind the scenes. Since the HDU is actually a binary table, it may not appear as a primary HDU in a FITS file. The content of the HDU header may be accessed using the ``.header`` attribute: >>> f = fits.open('compressed_image.fits') >>> print f[1].header XTENSION= 'IMAGE ' / extension type BITPIX = 16 / array data type NAXIS = 2 / number of array dimensions NAXIS1 = 512 / length of data axis NAXIS2 = 512 / length of data axis PCOUNT = 0 / number of parameters GCOUNT = 1 / one data group (required keyword) EXTNAME = 'COMPRESSED' / name of this binary table extension The contents of the corresponding binary table HDU may be accessed using the hidden ``._header`` attribute. However, all user interface with the HDU header should be accomplished through the image header (the ``.header`` attribute). >>> f = fits.open('compressed_image.fits') >>> print f[1]._header XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 8 / width of table in bytes NAXIS2 = 512 / number of rows in table PCOUNT = 157260 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 1 / number of fields in each row TTYPE1 = 'COMPRESSED_DATA' / label for field 1 TFORM1 = '1PB(384)' / data format of field: variable length array ZIMAGE = T / extension contains compressed image ZBITPIX = 16 / data type of original image ZNAXIS = 2 / dimension of original image ZNAXIS1 = 512 / length of original image axis ZNAXIS2 = 512 / length of original image axis ZTILE1 = 512 / size of tiles to be compressed ZTILE2 = 1 / size of tiles to be compressed ZCMPTYPE= 'RICE_1 ' / compression algorithm ZNAME1 = 'BLOCKSIZE' / compression block size ZVAL1 = 32 / pixels per block EXTNAME = 'COMPRESSED' / name of this binary table extension The contents of the HDU can be summarized by using either the :func:`info` convenience function or method: >>> fits.info('compressed_image.fits') Filename: compressed_image.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 6 () int16 1 COMPRESSED CompImageHDU 52 (512, 512) int16 >>> >>> f = fits.open('compressed_image.fits') >>> f.info() Filename: compressed_image.fits No. Name Type Cards Dimensions Format 0 PRIMARY PrimaryHDU 6 () int16 1 COMPRESSED CompImageHDU 52 (512, 512) int16 >>> Data """" As with the header, the data of a compressed image HDU appears to the user as standard uncompressed image data. The actual data is stored in the fits file as Binary Table data containing at least one column (COMPRESSED_DATA). Each row of this variable-length column contains the byte stream that was generated as a result of compressing the corresponding image tile. Several optional columns may also appear. These include, UNCOMPRESSED_DATA to hold the uncompressed pixel values for tiles that cannot be compressed, ZSCALE and ZZERO to hold the linear scale factor and zero point offset which may be needed to transform the raw uncompressed values back to the original image pixel values, and ZBLANK to hold the integer value used to represent undefined pixels (if any) in the image. The content of the HDU data may be accessed using the ``.data`` attribute: >>> f = fits.open('compressed_image.fits') >>> f[1].data array([[38, 43, 35, ..., 45, 43, 41], [36, 41, 37, ..., 42, 41, 39], [38, 45, 37, ..., 42, 35, 43], ..., [49, 52, 49, ..., 41, 35, 39], [57, 52, 49, ..., 40, 41, 43], [53, 57, 57, ..., 39, 35, 45]], dtype=int16) Creating a Compressed Image HDU """"""""""""""""""""""""""""""" To create a compressed image HDU from scratch, simply construct a :class:`CompImageHDU` object from an uncompressed image data array and its associated image header. From there, the HDU can be treated just like any other image HDU. >>> hdu = fits.CompImageHDU(imageData, imageHeader) >>> hdu.writeto('compressed_image.fits') >>> The API documentation for the :class:`CompImageHDU` initializer method describes the possible options for constructing a :class:`CompImageHDU` object. astropy-0.3/docs/io/fits/usage/misc.rst0000644000175000017500000000310312243255342016271 0ustar oleole.. currentmodule:: astropy.io.fits Miscellaneous Features ---------------------- This section describes some of the miscellaneous features of `astropy.io.fits`. Differs ^^^^^^^ The :mod:`astropy.io.fits.diff` module contains several facilities for generating and reporting the differences between two FITS files, or two components of a FITS file. The :class:`FITSDiff` class can be used to generate and represent the differences between either two FITS files on disk, or two existing :class:`HDUList` objects (or some combination thereof). Likewise, the :class:`HeaderDiff` class can be used to find the differences just between two :class:`Header` objects. Other available differs include :class:`HDUDiff`, :class:`ImageDataDiff`, :class:`TableDataDiff`, and :class:`RawDataDiff`. Each of these classes are instantiated with two instances of the objects that they diff. The returned diff instance has a number of attributes starting with ``.diff_`` that describe differences between the two objects. For example the :class:`HeaderDiff` class cam be used to find the differences between two :class:`Header` objects like so:: >>> from astropy.io import fits >>> header1 = fits.Header([('KEY_A', 1), ('KEY_B', 2)]) >>> header2 = fits.Header([('KEY_A', 3), ('KEY_C', 4)]) >>> diff = fits.diff.HeaderDiff(header1, header2) >>> diff.identical False >>> diff.diff_keywords (['KEY_B'], ['KEY_C']) >>> diff.diff_keyword_values defaultdict( at ...>, {'KEY_A': [(1, 3)]}) See the API documentation for details on the different differ classes. astropy-0.3/docs/io/fits/usage/headers.rst0000644000175000017500000003660012243255342016761 0ustar oleole.. currentmodule:: astropy.io.fits FITS Headers ------------ In the next three chapters, more detailed information as well as examples will be explained for manipulating the header, the image data, and the table data respectively. Header of an HDU ^^^^^^^^^^^^^^^^ Every HDU normally has two components: header and data. In Astropy these two components are accessed through the two attributes of the HDU, :attr:`~_BaseHDU.header` and :attr:`~_BaseHDU.data`. While an HDU may have empty data, i.e. the .data attribute is None, any HDU will always have a header. When an HDU is created with a constructor, e.g. ``hdu = PrimaryHDU(data, header)``, the user may supply the header value from an existing HDU's header and the data value from a numpy array. If the defaults (``None``) are used, the new HDU will have the minimal required keywords for an HDU of that type: >>> hdu = fits.PrimaryHDU() >>> hdu.header # show the all of the header cards SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 / number of array dimensions EXTEND = T A user can use any header and any data to construct a new HDU. Astropy will strip the required keywords from the input header first and then add back the required keywords compatible to the new HDU. So, a user can use a table HDU's header to construct an image HDU and vice versa. The constructor will also ensure the data type and dimension information in the header agree with the data. The Header Attribute ^^^^^^^^^^^^^^^^^^^^ Value Access, Updating, and Creating """""""""""""""""""""""""""""""""""" As shown in the Quick Tutorial, keyword values can be accessed via keyword name or index of an HDU's header attribute. Here is a quick summary: >>> hdulist = fits.open('input.fits') # open a FITS file >>> prihdr = hdulist[0].header # the primary HDU header >>> print prihdr[3] # get the 4th keyword's value 10 >>> prihdr[3] = 20 # change its value >>> prihdr['DARKCORR'] # get the value of the keyword 'darkcorr' 'OMIT' >>> prihdr['darkcorr'] = 'PERFORM' # change darkcorr's value Keyword names are case-insensitive except in a few special cases (see the sections on HIERARCH card and record-valued cards). Thus, ``prihdr['abc']``, ``prihdr['ABC']``, or ``prihdr['aBc']`` are all equivalent. Like with python :class:`dict`\s, new keywords can also be added to the header using assignment syntax: >>> 'DARKCORR' in header # Check for existence False >>> header['DARKCORR'] = 'OMIT' # Add a new DARKCORR keyword You can also add a new value *and* comment by assigning them as a tuple: >>> header['DARKCORR'] = ('OMIT', 'Dark Image Subtraction') .. note:: An important point to note when adding new keywords to a header is that by default they are not appended *immediately* to the end of the file. Rather, they are appended to the last non-commentary keyword. This is in order to support the common use case of always having all HISTORY keywords grouped together at the end of a header. A new non-commentary keyword will be added at the end of the existing keywords, but before any HISTORY/COMMENT keywords at the end of the header. There are a couple of ways to override this functionality: * Use the :meth:`Header.append` method with the ``end=True`` argument: >>> header.append(('DARKCORR', 'OMIT', 'Dark Image Subtraction'), end=True) This forces the new keyword to be added at the actual end of the header. * The :meth:`Header.insert` method will always insert a new keyword exactly where you ask for it: >>> header.insert(20, ('DARKCORR', 'OMIT', 'Dark Image Subtraction')) This inserts the DARKCORR keyword before the 20th keyword in the header no matter what it is. A keyword (and its corresponding card) can be deleted using the same index/name syntax: >>> del prihdr[3] # delete the 2nd keyword >>> del prihdr['abc'] # get the value of the keyword 'abc' Note that, like a regular Python list, the indexing updates after each delete, so if ``del prihdr[3]`` is done two times in a row, the 4th and 5th keywords are removed from the original header. Likewise, ``del prihdr[-1]`` will delete the last card in the header. It is also possible to delete an entire range of cards using the slice syntax: >>> del prihdr[3:5] The method :meth:`Header.set` is another way to update they value or comment associated with an existing keyword, or to create a new keyword. Most of its functionality can be duplicated with the dict-like syntax shown above. But in some cases it might be more clear. It also has the advantage of allowing one to either move cards within the header, or specify the location of a new card relative to existing cards: >>> prihdr.set('target', 'NGC1234', 'target name') >>> # place the next new keyword before the 'target' keyword >>> prihdr.set('newkey', 666, before='target') # comment is optional >>> # place the next new keyword after the 21st keyword >>> prihdr.set('newkey2', 42.0, 'another new key', after=20) In FITS headers, each keyword may also have a comment associated with it explaining its purpose. The comments associated with each keyword are accessed through the :attr:`~Header.comments` attribute: >>> header['NAXIS'] 2 >>> header.comments['NAXIS'] the number of image axes >>> header.comments['NAXIS'] = 'The number of image axes' # Update Comments can be accessed in all the same ways that values are accessed, whether by keyword name or card index. Slices are also possible. The only difference is that you go through ``header.comments`` instead of just ``header`` by itself. COMMENT, HISTORY, and Blank Keywords """""""""""""""""""""""""""""""""""" Most keywords in a FITS header have unique names. If there are more than two cards sharing the same name, it is the first one accessed when referred by name. The duplicates can only be accessed by numeric indexing. There are three special keywords (their associated cards are sometimes referred to as commentary cards), which commonly appear in FITS headers more than once. They are (1) blank keyword, (2) HISTORY, and (3) COMMENT. Unlike other keywords, when accessing these keywords they are returned as a list: >>> prihdr['HISTORY'] I updated this file on 02/03/2011 I updated this file on 02/04/2011 .... These lists can be sliced like any other list. For example, to display just the last HISTORY entry, use ``prihdr['history'][-1]``. Existing commentary cards can also be updated by using the appropriate index number for that card. New commentary cards can be added like any other card by using the dict-like keyword assignment syntax, or by using the :meth:`Header.set` method. However, unlike with other keywords, a new commentary card is always added and appended to the last commentary card with the same keyword, rather than to the end of the header. Here is an example: >>> hdu.header['HISTORY'] = 'history 1' >>> hdu.header[''] = 'blank 1' >>> hdu.header['COMMENT'] = 'comment 1' >>> hdu.header['HISTORY'] = 'history 2' >>> hdu.header[''] = 'blank 2' >>> hdu.header['COMMENT'] = 'comment 2' and the part in the modified header becomes: .. parsed-literal:: HISTORY history 1 HISTORY history 2 blank 1 blank 2 COMMENT comment 1 COMMENT comment 2 Users can also directly control exactly where in the header to add a new commentary card by using the :meth:`Header.insert` method. .. note:: Ironically, there is no comment in a commentary card, only a string value. Card Images ^^^^^^^^^^^ A FITS header consists of card images. A card image in a FITS header consists of a keyword name, a value, and optionally a comment. Physically, it takes 80 columns (bytes)--without carriage return--in a FITS file's storage format. In Astropy, each card image is manifested by a :class:`Card` object. There are also special kinds of cards: commentary cards (see above) and card images taking more than one 80-column card image. The latter will be discussed later. Most of the time the details of dealing with cards are handled by the :class:`Header` object, and it is not necessary to directly manipulate cards. In fact, most :class:`Header` methods that accept a ``(keyword, value)`` or ``(keyword, value, comment)`` tuple as an argument can also take a :class:`Card` object as an argument. :class:`Card` objects are just wrappers around such tuples that provide the logic for parsing and formatting individual cards in a header. But there's usually nothing gained by manually using a :class:`Card` object, except to examine how a card might appear in a header before actually adding it to the header. A new Card object is created with the :class:`Card` constructor: ``Card(key, value, comment)``. For example: >>> c1 = fits.Card('TEMP', 80.0, 'temperature, floating value') >>> c2 = fits.Card('DETECTOR', 1) # comment is optional >>> c3 = fits.Card('MIR_REVR', True, ... 'mirror reversed? Boolean value') >>> c4 = fits.Card('ABC', 2+3j, 'complex value') >>> c5 = fits.Card('OBSERVER', 'Hubble', 'string value') >>> print c1; print c2; print c3; print c4; print c5 # show the card images TEMP = 80.0 / temperature, floating value DETECTOR= 1 / MIR_REVR= T / mirror reversed? Boolean value ABC = (2.0, 3.0) / complex value OBSERVER= 'Hubble ' / string value Cards have the attributes ``.keyword``, ``.value``, and ``.comment``. Both ``.value`` and ``.comment`` can be changed but not the ``.keyword`` attribute. The :meth:`Card` constructor will check if the arguments given are conforming to the FITS standard and has a fixed card image format. If the user wants to create a card with a customized format or even a card which is not conforming to the FITS standard (e.g. for testing purposes), the :meth:`Card.fromstring` class method can be used. Cards can be verified with :meth:`Card.verify`. The non-standard card ``c2`` in the example below is flagged by such verification. More about verification in Astropy will be discussed in a later chapter. >>> c1 = fits.Card.fromstring('ABC = 3.456D023') >>> c2 = fits.Card.fromstring("P.I. ='Hubble'") >>> print c1; print c2 ABC = 3.456D023 P.I. ='Hubble' >>> c2.verify() Output verification result: Unfixable error: Illegal keyword name 'P.I.' A list of the :class:`Card` objects underlying a :class:`Header` object can be accessed with the :attr:`Header.cards` attribute. This list is only meant for observing, and should not be directly manipulated. In fact, it is only a copy--modifications to it will not affect the header it came from. Use the methods provided by the :class:`Header` class instead. CONTINUE Cards ^^^^^^^^^^^^^^ The fact that the FITS standard only allows up to 8 characters for the keyword name and 80 characters to contain the keyword, the value, and the comment is restrictive for certain applications. To allow long string values for keywords, a proposal was made in: http://legacy.gsfc.nasa.gov/docs/heasarc/ofwg/docs/ofwg_recomm/r13.html by using the CONTINUE keyword after the regular 80-column containing the keyword. Astropy does support this convention, even though it is not a FITS standard. The examples below show the use of CONTINUE is automatic for long string values. >>> header = fits.Header() >>> header['abc'] = 'abcdefg' * 20 >>> header ABC = 'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&' CONTINUE 'efgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga&' CONTINUE 'bcdefg&' >>> header['abc'] 'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefg' >>> # both value and comments are long >>> header['abc'] = ('abcdefg' * 10, 'abcdefg' * 10) >>> header ABC = 'abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&' CONTINUE 'efg&' CONTINUE '&' / abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga CONTINUE '&' / bcdefg Note that when a CONTINUE card is used, at the end of each 80-characters card image, an ampersand is present. The ampersand is not part of the string value. Also, there is no "=" at the 9th column after CONTINUE. In the first example, the entire 240 characters is treated by Astropy as a single card. So, if it is the nth card in a header, the (n+1)th card refers to the next keyword, not the next CONTINUE card. As such, CONTINUE cards are transparently handled by Astropy as a single logical card, and it's generally not necessary to worry about the details of the format. Keywords that resolve to a set of CONTINUE cards can be accessed and updated just like regular keywords. HIERARCH Cards ^^^^^^^^^^^^^^ For keywords longer than 8 characters, there is a convention originated at ESO to facilitate such use. It uses a special keyword HIERARCH with the actual long keyword following. Astropy supports this convention as well. If a keyword contains more than 8 characters Astropy will automatically use a HIERARCH card, but will also issue a warning in case this is in error. However, one may explicitly request a HIERARCH card by prepending the keyword with 'HIERARCH ' (just as it would appear in the header). For example, ``header['HIERARCH abcdefghi']`` will create the keyword ``abcdefghi`` without displaying a warning. Once created, HIERARCH keywords can be accessed like any other: ``header['abcdefghi']``, without prepending 'HIERARCH' to the keyword. HIEARARCH keywords also differ from normal FITS keywords in that they are case-sensitive. Examples follow: >>> c = fits.Card('abcdefghi', 10) Keyword name 'abcdefghi' is greater than 8 characters; a HIERARCH card will be created. >>> print c HIERARCH abcdefghi = 10 >>> c = fits.Card('hierarch abcdefghi', 10) >>> print c HIERARCH abcdefghi = 10 >>> h = fits.PrimaryHDU() >>> h.header['hierarch abcdefghi'] = 99 >>> h.header['abcdefghi'] 99 >>> h.header['abcdefghi'] = 10 >>> h.header['abcdefghi'] 10 >>> h.header['ABCDEFGHI'] Traceback (most recent call last): File "", line 1, in File "astropy/io/fits/header.py", line 121, in __getitem__ return self._cards[self._cardindex(key)].value File "astropy/io/fits/header.py", line 1106, in _cardindex raise KeyError("Keyword %r not found." % keyword) KeyError: "Keyword 'ABCDEFGI.' not found." >>> h.header SIMPLE = T / conforms to FITS standard BITPIX = 8 / array data type NAXIS = 0 / number of array dimensions EXTEND = T HIERARCH abcdefghi = 1000 .. note:: A final point to keep in mind about the :class:`Header` class is that much of its design is intended to abstract away quirks about the FITS format. This is why, for example, it will automatically created CONTINUE and HIERARCH cards. The Header is just a data structure, and as user you shouldn't have to worry about how it ultimately gets serialized to a header in a FITS file. Though there are some areas where it's almost impossible to hide away the quirks of the FITS format, Astropy tries to make it so that you have to think about it as little as possible. If there are any areas where you have concern yourself unnecessarily about how the header is constructed, then let help@stsci.edu know, as there are probably areas where this can be improved on even more. astropy-0.3/docs/io/registry.rst0000644000175000017500000000765212243255342015152 0ustar oleole.. _io_registry: ************************************ I/O Registry (`astropy.io.registry`) ************************************ .. note:: The I/O registry is only meant to be used directly by users who want to define their own custom readers/writers. Users who want to find out more about what built-in formats are supported by :class:`~astropy.table.table.Table` by default should see :ref:`table_io`. No built-in formats are currently defined for :class:`~astropy.nddata.nddata.NDData`, but this will be added in future). Introduction ============ The I/O registry is a sub-module used to define the readers/writers available for the :class:`~astropy.table.table.Table` and :class:`~astropy.nddata.nddata.NDData` classes. Using `io.registry` =================== The following example demonstrates how to create a reader for the :class:`~astropy.table.table.Table` class. First, we can create a highly simplistic FITS reader which just reads the data as a structured array:: from astropy.table import Table def fits_table_reader(filename, hdu=1): from astropy.io import fits data = fits.open(filename)[hdu].data return Table(data) and then register it:: from astropy.io import registry registry.register_reader('fits', Table, fits_table_reader) Reader functions can take any arguments except ``format`` (since this is reserved for :func:`~astropy.io.registry.read`) and should return an instance of the class specified as the second argument of ``register_reader`` (:class:`~astropy.table.table.Table` in the above case.) We can then read in a FITS table with:: t = Table.read('catalog.fits', format='fits') In practice, it would be nice to have the ``read`` method automatically identify that this file was a FITS file, so we can construct a function that can recognize FITS files, which we refer to here as an *identifier* function. An identifier function should take a first argument that should be a string which indicates whether the identifier is being called from ``read`` or ``write``, and should then accept arbitrary number of positional and keyword arguments via ``*args`` and ``**kwargs``, which are the arguments passed to ``Table.read``. We can write a simplistic function that only looks at filenames (but in practice, this function could even look at the first few bytes of the file for example). The only requirement is that it return a boolean indicating whether the input matches that expected for the format:: def fits_identify(origin, *args, **kwargs): return isinstance(args[0], basestring) and \ args[0].lower().split('.')[-1] in ['fits', 'fit'] .. note:: Identifier functions should be prepared for arbitrary input - in particular, the first argument may not be a filename or file object, so it should not assume that this is the case. We then register this identifier function:: registry.register_identifier('fits', Table, fits_identify) And we can then do:: t = Table.read('catalog.fits') If multiple formats match the current input, then an exception is raised, and similarly if no format matches the current input. In that case, the format should be explicitly given with the ``format=`` keyword argument. Similarly, it is possible to create custom writers. To go with our simplistic FITS reader above, we can write a simplistic FITS writer:: def fits_table_writer(table, filename, clobber=False): import numpy as np from astropy.io import fits fits.writeto(filename, np.array(table), clobber=clobber) We then register the writer:: io_registry.register_writer('fits', Table, fits_table_writer) And we can then write the file out to a FITS file:: t.write('catalog_new.fits', format='fits') If we have registered the identifier as above, we can simply do:: t.write('catalog_new.fits') Reference/API ============= .. automodapi:: astropy.io.registry astropy-0.3/docs/io/votable/0000755000175000017500000000000012243263747014202 5ustar oleoleastropy-0.3/docs/io/votable/.gitignore0000644000175000017500000000003412243255342016157 0ustar oleolewarnings.rst exceptions.rst astropy-0.3/docs/io/votable/references.txt0000644000175000017500000000356412243255342017064 0ustar oleole.. _BINARY: http://www.ivoa.net/Documents/PR/VOTable/VOTable-20040322.html#ToC27 .. _BINARY2: http://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html#sec:BIN2 .. _COOSYS: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC19 .. _DESCRIPTION: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC19 .. _FIELD: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC24 .. _FIELDref: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC31 .. _FITS: http://fits.gsfc.nasa.gov/fits_documentation.html .. _GROUP: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC31 .. _ID: http://www.w3.org/TR/REC-xml/#id .. _INFO: http://www.ivoa.net/Documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#ToC19 .. _LINK: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC22 .. _multidimensional arrays: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC12 .. _numerical accuracy: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC26 .. _PARAM: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC24 .. _PARAMref: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC31 .. _RESOURCE: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC21 .. _TABLE: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC23 .. _TABLEDATA: http://www.ivoa.net/Documents/PR/VOTable/VOTable-20040322.html#ToC25 .. _unified content descriptor: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC28 .. _unique type: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC29 .. _units: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC27 .. _VALUES: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC30 .. _VOTABLE: http://www.ivoa.net/Documents/PR/VOTable/VOTable-20040322.html#ToC9 astropy-0.3/docs/io/votable/index.rst0000644000175000017500000003256012243255342016041 0ustar oleole.. doctest_skip .. include:: references.txt .. _astropy-io-votable: ******************************************* VOTable XML handling (`astropy.io.votable`) ******************************************* Introduction ============ The `astropy.io.votable` subpackage converts VOTable XML files to and from Numpy record arrays. Getting Started =============== Reading a VOTable file ---------------------- To read in a VOTable file, pass a file path to `~astropy.io.votable.parse`:: from astropy.io.votable import parse votable = parse("votable.xml") ``votable`` is a `~astropy.io.votable.tree.VOTableFile` object, which can be used to retrieve and manipulate the data and save it back out to disk. VOTable files are made up of nested ``RESOURCE`` elements, each of which may contain one or more ``TABLE`` elements. The ``TABLE`` elements contain the arrays of data. To get at the ``TABLE`` elements, one can write a loop over the resources in the ``VOTABLE`` file:: for resource in votable.resources: for table in resource.tables: # ... do something with the table ... pass However, if the nested structure of the resources is not important, one can use `~astropy.io.votable.tree.VOTableFile.iter_tables` to return a flat list of all tables:: for table in votable.iter_tables(): # ... do something with the table ... pass Finally, if there is expected to be only one table in the file, it might be simplest to just use `~astropy.io.votable.tree.VOTableFile.get_first_table`:: table = votable.get_first_table() Even easier, there is a convenience method to parse a VOTable file and return the first table all in one step:: from astropy.io.votable import parse_single_table table = parse_single_table("votable.xml") From a `~astropy.io.votable.tree.Table` object, one can get the data itself in the ``array`` member variable:: data = table.array This data is a Numpy record array. The columns get their names from both the ``ID`` and ``name`` attributes of the ``FIELD`` elements in the ``VOTABLE`` file. For example, suppose we had a ``FIELD`` specified as follows: .. code-block:: xml representing the ICRS declination of the center of the image. This column of data can be extracted from the record array using:: >>> table.array['dec_targ'] array([17.15153360566, 17.15153360566, 17.15153360566, 17.1516686826, 17.1516686826, 17.1516686826, 17.1536197136, 17.1536197136, 17.1536197136, 17.15375479055, 17.15375479055, 17.15375479055, 17.1553884541, 17.15539736932, 17.15539752176, 17.25736014763, # ... 17.2765703], dtype=object) or equivalently:: >>> table.array['Dec'] array([17.15153360566, 17.15153360566, 17.15153360566, 17.1516686826, 17.1516686826, 17.1516686826, 17.1536197136, 17.1536197136, 17.1536197136, 17.15375479055, 17.15375479055, 17.15375479055, 17.1553884541, 17.15539736932, 17.15539752176, 17.25736014763, # ... 17.2765703], dtype=object) Building a new table from scratch --------------------------------- It is also possible to build a new table, define some field datatypes and populate it with data:: from astropy.io.votable.tree import VOTableFile, Resource, Table, Field # Create a new VOTable file... votable = VOTableFile() # ...with one resource... resource = Resource() votable.resources.append(resource) # ... with one table table = Table(votable) resource.tables.append(table) # Define some fields table.fields.extend([ Field(votable, name="filename", datatype="char", arraysize="*"), Field(votable, name="matrix", datatype="double", arraysize="2x2")]) # Now, use those field definitions to create the numpy record arrays, with # the given number of rows table.create_arrays(2) # Now table.array can be filled with data table.array[0] = ('test1.xml', [[1, 0], [0, 1]]) table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]]) # Now write the whole thing to a file. # Note, we have to use the top-level votable file object votable.to_xml("new_votable.xml") Outputting a VOTable file ------------------------- To save a VOTable file, simply call the `~astropy.io.votable.tree.VOTableFile.to_xml` method. It accepts either a string or Unicode path, or a Python file-like object:: votable.to_xml('output.xml') There are a number of data storage formats supported by `astropy.io.votable`. The ``TABLEDATA`` format is XML-based and stores values as strings representing numbers. The ``BINARY`` format is more compact, and stores numbers in base64-encoded binary. VOTable version 1.3 adds the ``BINARY2`` format, which allows for masking of any data type, including integers and bit fields which can not be masked in the older ``BINARY`` format. The storage format can be set on a per-table basis using the `~astropy.io.votable.tree.Table.format` attribute, or globally using the `~astropy.io.votable.tree.VOTableFile.set_all_tables_format` method:: votable.get_first_table().format = 'binary' votable.set_all_tables_format('binary') votable.to_xml('binary.xml') Using `io.votable` ================== Standard compliance ------------------- `astropy.io.votable.table` supports the `VOTable Format Definition Version 1.1 `_, `Version 1.2 `_, and the `Version 1.3 proposed recommendation `_. Some flexibility is provided to support the 1.0 draft version and other non-standard usage in the wild. To support these cases, set the keyword argument ``pedantic`` to ``False`` when parsing. .. note:: Each warning and VOTABLE-specific exception emitted has a number and is documented in more detail in :ref:`warnings` and :ref:`exceptions`. Output always conforms to the 1.1, 1.2 or 1.3 spec, depending on the input. .. _pedantic-mode: Pedantic mode ^^^^^^^^^^^^^ Many VOTABLE files in the wild do not conform to the VOTABLE specification. If reading one of these files causes exceptions, you may turn off pedantic mode in `astropy.io.votable` by passing ``pedantic=False`` to the `~astropy.io.votable.parse` or `~astropy.io.votable.parse_single_table` functions:: from astropy.io.votable import parse votable = parse("votable.xml", pedantic=False) Note, however, that it is good practice to report these errors to the author of the application that generated the VOTABLE file to bring the file into compliance with the specification. Even with ``pedantic`` turned off, many warnings may still be omitted. These warnings are all of the type `~astropy.io.votable.exceptions.VOTableSpecWarning` and can be turned off using the standard Python `warnings` module. Missing values -------------- Any value in the table may be "missing". `astropy.io.votable` stores a Numpy masked array in each `~astropy.io.votable.tree.Table` instance. This behaves like an ordinary Numpy masked array, except for variable-length fields. For those fields, the datatype of the column is "object" and another Numpy masked array is stored there. Therefore, operations on variable length columns will not work -- this is simply because variable length columns are not directly supported by Numpy masked arrays. Datatype mappings ----------------- The datatype specified by a ``FIELD`` element is mapped to a Numpy type according to the following table: ================================ ======================================================================== VOTABLE type Numpy type ================================ ======================================================================== boolean b1 -------------------------------- ------------------------------------------------------------------------ bit b1 -------------------------------- ------------------------------------------------------------------------ unsignedByte u1 -------------------------------- ------------------------------------------------------------------------ char (*variable length*) O - In Python 2.x, a `str` object; in 3.x, a `bytes` object. -------------------------------- ------------------------------------------------------------------------ char (*fixed length*) S -------------------------------- ------------------------------------------------------------------------ unicodeChar (*variable length*) O - In Python 2.x, a `unicode` object, in utf-16; in 3.x a `str` object -------------------------------- ------------------------------------------------------------------------ unicodeChar (*fixed length*) U -------------------------------- ------------------------------------------------------------------------ short i2 -------------------------------- ------------------------------------------------------------------------ int i4 -------------------------------- ------------------------------------------------------------------------ long i8 -------------------------------- ------------------------------------------------------------------------ float f4 -------------------------------- ------------------------------------------------------------------------ double f8 -------------------------------- ------------------------------------------------------------------------ floatComplex c8 -------------------------------- ------------------------------------------------------------------------ doubleComplex c16 ================================ ======================================================================== If the field is a fixed size array, the data is stored as a Numpy fixed-size array. If the field is a variable size array (that is ``arraysize`` contains a '*'), the cell will contain a Python list of Numpy values. Each value may be either an array or scalar depending on the ``arraysize`` specifier. Examining field types --------------------- To look up more information about a field in a table, one can use the `~astropy.io.votable.tree.Table.get_field_by_id` method, which returns the `~astropy.io.votable.tree.Field` object with the given ID. For example:: >>> field = table.get_field_by_id('Dec') >>> field.datatype 'char' >>> field.unit 'deg' .. note:: Field descriptors should not be mutated. To change the set of columns, convert the Table to an `astropy.table.Table`, make the changes, and then convert it back. Converting to/from an `astropy.table.Table` ------------------------------------------- The VOTable standard does not map conceptually to an `astropy.table.Table`. However, a single table within the `VOTable` file may be converted to and from an `astropy.table.Table`:: from astropy.io.votable import parse_single_table table = parse_single_table("votable.xml").to_table() As a convenience, there is also a function to create an entire VOTable file with just a single table:: from astropy.io.votable import from_table, writeto votable = from_table(table) writeto(votable, "output.xml") .. note:: By default, `to_table` will use the `ID` attribute from the files to create the column names for the `Table` object. However, it may be that you want to use the `name` attributes instead. For this, set the `use_names_over_ids` keyword to `True`. Note that since field `names` are not guaranteed to be unique in the VOTable specification, but column names are required to be unique in Numpy structured arrays (and thus `astropy.table.Table` objects), the names may be renamed by appending numbers to the end in some cases. Performance considerations -------------------------- File reads will be moderately faster if the ``TABLE`` element includes an nrows_ attribute. If the number of rows is not specified, the record array must be resized repeatedly during load. .. _nrows: http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html#ToC10 See Also ======== - `VOTable Format Definition Version 1.1 `_ - `VOTable Format Definition Version 1.2 `_ - `VOTable Format Definition Version 1.3, Proposed Recommendatation `_ Reference/API ============= .. automodapi:: astropy.io.votable :no-inheritance-diagram: :skip: VOWarning :skip: VOTableChangeWarning :skip: VOTableSpecWarning :skip: UnimplementedWarning :skip: IOWarning :skip: VOTableSpecError .. automodapi:: astropy.io.votable.tree :no-inheritance-diagram: .. automodapi:: astropy.io.votable.converters :no-inheritance-diagram: .. automodapi:: astropy.io.votable.ucd :no-inheritance-diagram: .. automodapi:: astropy.io.votable.util :no-inheritance-diagram: .. automodapi:: astropy.io.votable.validator :no-inheritance-diagram: .. automodapi:: astropy.io.votable.xmlutil :no-inheritance-diagram: astropy.io.votable.exceptions Module ------------------------------------ .. toctree:: :maxdepth: 1 api_exceptions.rst astropy-0.3/docs/io/votable/api_exceptions.rst0000644000175000017500000000132512243255342017737 0ustar oleole.. include:: references.txt `astropy.io.votable.exceptions` =============================== .. contents:: .. automodule:: astropy.io.votable.exceptions Exception utilities ------------------- .. currentmodule:: astropy.io.votable.exceptions .. autofunction:: warn_or_raise .. autofunction:: vo_raise .. autofunction:: vo_reraise .. autofunction:: vo_warn .. autofunction:: parse_vowarning .. autoclass:: VOWarning :show-inheritance: .. autoclass:: VOTableChangeWarning :show-inheritance: .. autoclass:: VOTableSpecWarning :show-inheritance: .. autoclass:: UnimplementedWarning :show-inheritance: .. autoclass:: IOWarning :show-inheritance: .. autoclass:: VOTableSpecError :show-inheritance: astropy-0.3/docs/io/unified.rst0000644000175000017500000003066212243255342014722 0ustar oleole.. doctest_skip .. _table_io: Unified file read/write interface =================================== Astropy provides a unified interface for reading and writing data in different formats. For many common cases this will simplify the process of file I/O and reduce the need to master the separate details of all the I/O packages within Astropy. This functionality is still in active development and the number of supported formats will be increasing. For details on the implementation see :ref:`io_registry`. Getting started with Table I/O ------------------------------ The :class:`~astropy.table.table.Table` class includes two methods, :meth:`~astropy.table.table.Table.read` and :meth:`~astropy.table.table.Table.write`, that make it possible to read from and write to files. A number of formats are automatically supported (see `Built-in table readers/writers`_) and new file formats and extensions can be registered with the :class:`~astropy.table.table.Table` class (see :ref:`io_registry`). To use this interface, first import the :class:`~astropy.table.table.Table` class, then simply call the :class:`~astropy.table.table.Table` :meth:`~astropy.table.table.Table.read` method with the name of the file and the file format, for instance ``'ascii.daophot'``:: >>> from astropy.table import Table >>> t = Table.read('photometry.dat', format='ascii.daophot') For certain file formats, the format can be automatically detected, for example from the filename extension:: >>> t = Table.read('table.tex') Similarly, for writing, the format can be explicitly specified:: >>> t.write(filename, format='latex') As for the :meth:`~astropy.table.table.Table.read` method, the format may be automatically identified in some cases. Any additional arguments specified will depend on the format. For examples of this see the section `Built-in table readers/writers`_. This section also provides the full list of choices for the ``format`` argument. .. _built_in_readers_writers: Built-in table readers/writers ------------------------------ The full list of built-in readers and writers is shown in the table below: =========================== ==== ===== ============= ========== Format Read Write Auto-identify Deprecated =========================== ==== ===== ============= ========== aastex Yes Yes No Yes ascii Yes Yes No ascii.aastex Yes Yes No ascii.basic Yes Yes No ascii.cds Yes No No ascii.commented_header Yes Yes No ascii.daophot Yes No No ascii.fixed_width Yes Yes No ascii.fixed_width_no_header Yes Yes No ascii.fixed_width_two_line Yes Yes No ascii.ipac Yes Yes No ascii.latex Yes Yes Yes ascii.no_header Yes Yes No ascii.rdb Yes Yes Yes ascii.sextractor Yes No No ascii.tab Yes Yes No cds Yes No No Yes daophot Yes No No Yes fits Yes Yes Yes hdf5 Yes Yes Yes ipac Yes Yes No Yes latex Yes Yes No Yes rdb Yes Yes No Yes votable Yes Yes Yes =========================== ==== ===== ============= ========== Deprecated format names like ``aastex`` will be removed in a future version. Use the full name (e.g. ``ascii.aastex``) instead. .. _table_io_ascii: ASCII formats ^^^^^^^^^^^^^^ The :meth:`~astropy.table.table.Table.read` and :meth:`~astropy.table.table.Table.write` methods can be used to read and write formats supported by `astropy.io.ascii`. Use ``format='ascii'`` in order to interface to the generic :func:`~astropy.io.ascii.ui.read` and :func:`~astropy.io.ascii.ui.write` functions from `astropy.io.ascii`. When reading a table this means that all supported ASCII table formats will be tried in order to successfully parse the input. For example:: >>> t = Table.read('astropy/io/ascii/tests/t/latex1.tex', format='ascii') >>> print t cola colb colc ---- ---- ---- a 1 2 b 3 4 When writing a table with ``format='ascii'`` the output is a basic character-delimited file with a single header line containing the column names. All additional arguments are passed to the `astropy.io.ascii` :func:`~astropy.io.ascii.ui.read` and :func:`~astropy.io.ascii.ui.write` functions. Further details are available in the sections on :ref:`io_ascii_read_parameters` and :ref:`io_ascii_write_parameters`. For example, to change column delimiter and the output format for the ``colc`` column use:: >>> t.write(sys.stdout, format='ascii', delimiter='|', formats={'colc': '%0.2f'}) cola|colb|colc a|1|2.00 b|3|4.00 A full list of the supported ``format`` values and corresponding format types for ASCII tables is given below. The ``Suffix`` column indicates the filename suffix where the format will be auto-detected, while the ``Write`` column indicates which support write functionality. =============================== ====== ===== ============================================================================================ Format Suffix Write Description =============================== ====== ===== ============================================================================================ ``ascii`` Yes ASCII table in any supported format (uses guessing) ``ascii.aastex`` Yes :class:`~astropy.io.ascii.latex.AASTex`: AASTeX deluxetable used for AAS journals ``ascii.basic`` Yes :class:`~astropy.io.ascii.basic.Basic`: Basic table with custom delimiters ``ascii.cds`` :class:`~astropy.io.ascii.cds.Cds`: CDS format table ``ascii.commented_header`` Yes :class:`~astropy.io.ascii.basic.CommentedHeader`: Column names in a commented line ``ascii.daophot`` :class:`~astropy.io.ascii.daophot.Daophot`: IRAF DAOphot format table ``ascii.fixed_width`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidth`: Fixed width ``ascii.fixed_width_no_header`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidthNoHeader`: Fixed width with no header ``ascii.fixed_width_two_line`` Yes :class:`~astropy.io.ascii.fixedwidth.FixedWidthTwoLine`: Fixed width with second header line ``ascii.ipac`` Yes :class:`~astropy.io.ascii.ipac.Ipac`: IPAC format table ``ascii.latex`` .tex Yes :class:`~astropy.io.ascii.latex.Latex`: LaTeX table ``ascii.no_header`` Yes :class:`~astropy.io.ascii.basic.NoHeader`: Basic table with no headers ``ascii.rdb`` .rdb Yes :class:`~astropy.io.ascii.basic.Rdb`: Tab-separated with a type definition header line ``ascii.sextractor`` :class:`~astropy.io.ascii.sextractor.SExtractor`: SExtractor format table ``ascii.tab`` Yes :class:`~astropy.io.ascii.basic.Tab`: Basic table with tab-separated values =============================== ====== ===== ============================================================================================ .. note:: When specifying a specific ASCII table format using the unified interface, the format name is prefixed with ``ascii.`` in order to identify the format as ASCII-based. Compare the table above to the `astropy.io.ascii` list of :ref:`supported_formats`. Therefore the following are equivalent:: >>> dat = ascii.read('file.dat', format='daophot') >>> dat = Table.read('file.dat', format='ascii.daophot') For compatibility with astropy version 0.2 and earlier, the following format values are also allowed in ``Table.read()``: ``daophot``, ``ipac``, ``latex``, and ``rdb``. .. _table_io_fits: FITS ^^^^ Reading/writing from/to `FITS `_ files is supported with ``format='fits'``. In most cases, existing FITS files should be automatically identified as such based on the header of the file, but if not, or if writing to disk, then the format should be explicitly specified. If a FITS table file only contains a single table, then it can be read in with:: >>> t = Table.read('data.fits') If more that one table are present in the file, the first table found will be read in and a warning will be emitted:: >>> t = Table.read('data.fits') WARNING: hdu= was not specified but multiple tables are present, reading in first available table (hdu=1) [astropy.io.fits.connect] To write to a new file:: >>> t.write('new_table.fits') At this time, the ``meta`` attribute of the :class:`~astropy.table.table.Table` class is simply an ordered dictionary and does not fully represent the structure of a FITS header (for example, keyword comments are dropped). This is likely to change in a future release. .. _table_io_hdf5: HDF5 ^^^^^^^^ Reading/writing from/to `HDF5 `_ files is supported with ``format='hdf5'`` (this requires `h5py `_ to be installed). However, the ``.hdf5`` file extension is automatically recognized when writing files, and HDF5 files are automatically identified (even with a different extension) when reading in (using the first few bytes of the file to identify the format), so in most cases you will not need to explicitly specify ``format='hdf5'``. Since HDF5 files can contain multiple tables, the full path to the table should be specified via the ``path=`` argument when reading and writing. For example, to read a table called ``data`` from an HDF5 file named ``observations.hdf5``, you can do:: >>> t = Table.read('observations.hdf5', path='data') To read a table nested in a group in the HDF5 file, you can do:: >>> t = Table.read('observations.hdf5', path='group/data') To write a table to a new file, the path should also be specified:: >>> t.write('new_file.hdf5', path='updated_data') It is also possible to write a table to an existing file using ``append=True``:: >>> t.write('observations.hdf5', path='updated_data', append=True) Finally, when writing to HDF5 files, the ``compression=`` argument can be used to ensure that the data is compressed on disk:: >>> t.write('new_file.hdf5', path='updated_data', compression=True) As with other formats, the ``overwrite=True`` argument is supported for overwriting existing files. .. _table_io_votable: VO Tables ^^^^^^^^^^^ Reading/writing from/to `VO table `_ files is supported with ``format='votable'``. In most cases, existing VO tables should be automatically identified as such based on the header of the file, but if not, or if writing to disk, then the format should be explicitly specified. If a VO table file only contains a single table, then it can be read in with:: >>> t = Table.read('aj285677t3_votable.xml') If more that one table are present in the file, an error will be raised, unless the table ID is specified via the ``table_id=`` argument:: >>> t = Table.read('catalog.xml') Traceback (most recent call last): File "", line 1, in File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/astropy/table/table.py", line 1559, in read table = reader(*args, **kwargs) File "/Volumes/Raptor/Library/Python/2.7/lib/python/site-packages/astropy/io/votable/connect.py", line 44, in read_table_votable raise ValueError("Multiple tables found: table id should be set via the id= argument. The available tables are " + ', '.join(tables.keys())) ValueError: Multiple tables found: table id should be set via the table_id= argument. The available tables are twomass, spitzer >>> t = Table.read('catalog.xml', table_id='twomass') To write to a new file, the ID of the table should also be specified (unless ``t.meta['ID']`` is defined):: >>> t.write('new_catalog.xml', table_id='updated_table', format='votable') When writing, the ``compression=True`` argument can be used to force compression of the data on disk, and the ``overwrite=True`` argument can be used to overwrite an existing file. astropy-0.3/docs/io/misc.rst0000644000175000017500000000140712243255342014225 0ustar oleole********************************************** Miscellaneous Input/Output (`astropy.io.misc`) ********************************************** The `astropy.io.misc` module contains miscellaneous input/output routines that do not fit elsewhere, and are often used by other Astropy sub-packages. For example, `astropy.io.misc.hdf5` contains functions to read/write :class:`~astropy.table.table.Table` objects from/to HDF5 files, but these should not be imported directly by users. Instead, users can access this functionality via the :class:`~astropy.table.table.Table` class itself (see :ref:`table_io`). Routines that are intended to be used directly by users are listed in the `astropy.io.misc` section. .. automodapi:: astropy.io.misc .. automodapi:: astropy.io.misc.hdf5 astropy-0.3/docs/vo/0000755000175000017500000000000012243263747012563 5ustar oleoleastropy-0.3/docs/vo/client.rst0000644000175000017500000004654312243255342014577 0ustar oleoleUsing `astropy.vo.client` ========================= This subpackage contains modules supporting VO client-side operations. .. _vo-sec-client-vos: General VO Services Access -------------------------- `astropy.vo.client.vos_catalog` contains common utilities for accessing simple VO services. .. _vo-sec-vos-config: Configurable Items ^^^^^^^^^^^^^^^^^^ These parameters are set via :ref:`astropy_config`: * ``astropy.io.votable.table.PEDANTIC`` * ``astropy.utils.data.REMOTE_TIMEOUT`` * ``astropy.vo.client.vos_catalog.BASEURL`` Examples ^^^^^^^^ >>> from astropy.vo.client import vos_catalog Get all catalogs from a database named ``'conesearch_good'`` (this contains cone search services that cleanly passed daily validations; also see :ref:`Cone Search Examples `): >>> my_db = vos_catalog.get_remote_catalog_db('conesearch_good') Downloading http://stsdas.stsci.edu/astrolib/vo_databases/conesearch_good.json |============================================| 56/ 56k (100.00%) 00s >>> my_db >>> print(my_db) Guide Star Catalog 2.3 1 SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1 SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2 # ... USNO-A2 Catalogue 1 USNO-A2.0 1 If you get timeout error, you need to use a custom timeout as follows: >>> from astropy.utils.data import REMOTE_TIMEOUT >>> with REMOTE_TIMEOUT.set_temp(30): ... my_db = vos_catalog.get_remote_catalog_db('conesearch_good') Find catalog names containing ``'usno*a2'``: >>> my_db.list_catalogs(pattern='usno*a2') [u'The USNO-A2.0 Catalogue (Monet+ 1998) 1', u'USNO-A2 Catalogue 1'] Get information for a catalog titled ``'USNO-A2 Catalogue 1'``: >>> my_cat = my_db.get_catalog('USNO-A2 Catalogue 1') >>> my_cat >>> print(my_cat) title: USNO-A2 Catalogue url: http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2& >>> print(my_cat.dumps()) { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#University#Research#Amateur#", # ... "version": "", "waveband": "#Optical#" } >>> my_cat.keys() [u'validate_network_error', u'capabilityClass', u'updated', # ... u'identifier', u'validate_xmllint'] >>> my_cat['url'] u'http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&' >>> my_cat['maxRadius'] 1.0 One can also get information for a catalog using its URL. If a URL yields multiple catalogs (this can happen when the service provider re-register the URL with a different title), only the first match is returned: >>> my_cat2 = my_db.get_catalog_by_url( ... 'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&') >>> print(my_cat2.dumps()) { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#Research#", # ... "version": "15-Sep-1999", "waveband": "#Optical#" } To see validation warnings generated by :ref:`vo-sec-validator-validate` for the catalog above: >>> for w in my_cat2['validate_warnings']: ... print(w) /.../vo.xml:13:0: W22: The DEFINITIONS element is deprecated in VOTable 1.1... To get all the matching catalogs by URL: >>> matched_cats = [cat for key, cat in my_db.get_catalogs_by_url( ... 'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&')] >>> for c in matched_cats: ... print(str(c)) title: The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) url: http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out& To get all catalogs in the database: >>> all_cats = [cat for key, cat in my_db.get_catalogs()] By default, pedantic is ``False``: >>> from astropy.io.votable.table import PEDANTIC >>> PEDANTIC() False To call a given VO service; In this case, a Cone Search (also see :ref:`Cone Search Examples `): >>> from astropy import coordinates as coord >>> from astropy import units as u >>> c = coord.ICRS.from_name('47 Tuc') >>> c >>> sr = 0.5 * u.degree >>> sr >>> result = vos_catalog.call_vo_service( ... 'conesearch_good', ... kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr}, ... catalog_db='The PMM USNO-A1.0 Catalogue (Monet 1997) 1') Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... WARNING: W03: ... Implictly generating an ID from a name 'RA(ICRS)'... WARNING: W03: ... Implictly generating an ID from a name 'DE(ICRS)'... >>> result To repeat the above and suppress *all* the screen outputs (not recommended): >>> import warnings >>> with warnings.catch_warnings(): ... warnings.simplefilter('ignore') ... result = vos_catalog.call_vo_service( ... 'conesearch_good', ... kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr}, ... catalog_db='The PMM USNO-A1.0 Catalogue (Monet 1997) 1', ... verbose=False) .. _vo-sec-client-scs: Simple Cone Search ------------------ `astropy.vo.client.conesearch` supports VO Simple Cone Search capabilities. Available databases are generated on the server-side hosted by STScI using :ref:`vo-sec-validator-validate`. The database used is controlled by ``astropy.vo.client.conesearch.CONESEARCH_DBNAME``, which can be changed in :ref:`vo-sec-scs-config` below. Here are the available options: #. ``'conesearch_good'`` Default. Passed validation without critical warnings and exceptions. #. ``'conesearch_warn'`` Has critical warnings but no exceptions. Use at your own risk. #. ``'conesearch_exception'`` Has some exceptions. *Never* use this. #. ``'conesearch_error'`` Has network connection error. *Never* use this. In the default setting, it searches the good Cone Search services one by one, stops at the first one that gives non-zero match(es), and returns the result. Since the list of services are extracted from a Python dictionary, the search order might differ from call to call. There are also functions, both synchronously and asynchronously, available to return *all* the Cone Search query results. However, this is not recommended unless one knows what one is getting into, as it could potentially take up significant run time and computing resources. :ref:`vo-sec-scs-examples` below show how to use non-default search behaviors, where the user has more control of which catalog(s) to search, et cetera. .. note:: Most services currently fail to parse when ``pedantic=True``. .. warning:: When Cone Search returns warnings, user should decide whether the results are reliable by inspecting the warning codes in `astropy.io.votable.exceptions`. .. _vo-sec-scs-config: Configurable Items ^^^^^^^^^^^^^^^^^^ These parameters are set via :ref:`astropy_config`: * ``astropy.utils.data.REMOTE_TIMEOUT`` * ``astropy.vo.client.conesearch.CONESEARCH_DBNAME`` Also depends on :ref:`General VO Services Access Configurable Items `. .. _vo-sec-scs-examples: Examples ^^^^^^^^ >>> from astropy.vo.client import conesearch Shows a sorted list of Cone Search services to be searched (to inspect them in detail, see :ref:`vo-sec-client-vos`): >>> conesearch.list_catalogs() [u'Guide Star Catalog 2.3 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 4', u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 1', u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 2', u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1', u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1', u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1', u'The PMM USNO-A1.0 Catalogue (Monet 1997) 1', u'The USNO-A2.0 Catalogue (Monet+ 1998) 1', u'Two Micron All Sky Survey (2MASS) 1', u'Two Micron All Sky Survey (2MASS) 2', u'USNO-A2 Catalogue 1', u'USNO-A2.0 1'] Select a catalog to search: >>> my_catname = 'The PMM USNO-A1.0 Catalogue (Monet 1997) 1' By default, pedantic is ``False``: >>> from astropy.io.votable.table import PEDANTIC >>> PEDANTIC() False Perform Cone Search in the selected catalog above for 0.5 degree radius around 47 Tucanae with minimum verbosity, if supported. The ``catalog_db`` keyword gives control over which catalog(s) to use. If running this for the first time, a copy of the catalogs database will be downloaded to local cache. To run this again without using cached data, set ``cache=False``: >>> from astropy import coordinates as coord >>> from astropy import units as u >>> c = coord.ICRS.from_name('47 Tuc') >>> c >>> sr = 0.5 * u.degree >>> sr >>> result = conesearch.conesearch(c, sr, catalog_db=my_catname) Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... To run the command above using custom timeout of 30 seconds for each Cone Search service query: >>> from astropy.utils.data import REMOTE_TIMEOUT >>> with REMOTE_TIMEOUT.set_temp(30): ... result = conesearch.conesearch(c, sr, catalog_db=my_catname) To suppress *all* the screen outputs (not recommended): >>> import warnings >>> with warnings.catch_warnings(): ... warnings.simplefilter('ignore') ... result = conesearch.conesearch(c, sr, catalog_db=my_catname, ... verbose=False) Extract Numpy array containing the matched objects. See `numpy` for available operations: >>> cone_arr = result.array.data >>> cone_arr array([(0.499298, 4.403473, -72.124045, '0150-00088188'), (0.499075, 4.403906, -72.122762, '0150-00088198'), (0.499528, 4.404531, -72.045198, '0150-00088210'), ..., (0.4988, 7.641731, -72.113156, '0150-00225965'), (0.499554, 7.645489, -72.103167, '0150-00226134'), (0.499917, 7.6474, -72.0876, '0150-00226223')], dtype=[('_r', '>> cone_arr.dtype.names ('_r', '_RAJ2000', '_DEJ2000', 'USNO-A1.0') >>> cone_arr.size 36184 >>> ra_list = cone_arr['_RAJ2000'] >>> ra_list array([ 4.403473, 4.403906, 4.404531, ..., 7.641731, 7.645489, 7.6474 ]) >>> cone_arr[0] # First row (0.499298, 4.403473, -72.124045, '0150-00088188') >>> cone_arr[-1] # Last row (0.499917, 7.6474, -72.0876, '0150-00226223') >>> cone_arr[:10] # First 10 rows array([(0.499298, 4.403473, -72.124045, '0150-00088188'), (0.499075, 4.403906, -72.122762, '0150-00088198'), (0.499528, 4.404531, -72.045198, '0150-00088210'), (0.497252, 4.406078, -72.095045, '0150-00088245'), (0.499739, 4.406462, -72.139545, '0150-00088254'), (0.496312, 4.410623, -72.110492, '0150-00088372'), (0.49473, 4.415053, -72.071217, '0150-00088494'), (0.494171, 4.415939, -72.087512, '0150-00088517'), (0.493722, 4.417678, -72.0972, '0150-00088572'), (0.495147, 4.418262, -72.047142, '0150-00088595')], dtype=[('_r', '>> import numpy as np >>> sep = cone_arr['_r'] >>> i_sorted = np.argsort(sep) >>> cone_arr[i_sorted] array([(0.081971, 5.917787, -72.006075, '0150-00145335'), (0.083181, 6.020339, -72.164623, '0150-00149799'), (0.089166, 5.732798, -72.077698, '0150-00137181'), ..., (0.499981, 7.024962, -72.477503, '0150-00198745'), (0.499987, 6.423773, -71.597364, '0150-00168596'), (0.499989, 6.899589, -72.5043, '0150-00192872')], dtype=[('_r', '>> from astropy import units as u >>> ra_field = result.get_field_by_id('_RAJ2000') >>> ra_field.title u'Right ascension (FK5, Equinox=J2000.0) (computed by VizieR, ...)' >>> ra_field.unit Unit("deg") >>> ra_field.unit.to(u.arcsec) * ra_list array([ 15852.5028, 15854.0616, 15856.3116, ..., 27510.2316, 27523.7604, 27530.64 ]) Perform the same Cone Search as above but asynchronously using `~astropy.vo.client.conesearch.AsyncConeSearch`. Queries to individual Cone Search services are still governed by ``astropy.utils.data.REMOTE_TIMEOUT``. Cone Search is forced to run in silent mode asynchronously, but warnings are still controlled by :py:mod:`warnings`: >>> async_search = conesearch.AsyncConeSearch(c, sr, catalog_db=my_catname) Check asynchronous search status: >>> async_search.running() True >>> async_search.done() False Get search results after a 30-second wait (not to be confused with ``astropy.utils.data.REMOTE_TIMEOUT`` that governs individual Cone Search queries). If search is still not done after 30 seconds, ``TimeoutError`` is raised. Otherwise, Cone Search result is returned and can be manipulated as above. If no ``timeout`` keyword given, it waits until completion: >>> async_result = async_search.get(timeout=30) >>> cone_arr = async_result.array.data >>> cone_arr.size 36184 Estimate the execution time and the number of objects for the Cone Search service URL from above. The prediction naively assumes a linear model, which might not be accurate for some cases. It also uses the normal :func:`~astropy.vo.client.conesearch.conesearch`, not the asynchronous version. This example uses a custom timeout of 30 seconds and runs silently (except for warnings): >>> result.url u'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out&' >>> with REMOTE_TIMEOUT.set_temp(30): ... t_est, n_est = conesearch.predict_search( ... result.url, c, sr, verbose=False, plot=True) WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... # ... >>> t_est # Predicted execution time 19.272144977377838 >>> n_est # Predicted number of objects 37340 .. image:: images/client_predict_search_t.png :width: 450px :alt: Example plot from conesearch.predict_search() for t_est .. image:: images/client_predict_search_n.png :width: 450px :alt: Example plot from conesearch.predict_search() for n_est For debugging purpose, one can obtain the actual execution time and number of objects, and compare them with the predicted values above. The INFO message shown in controlled by `astropy.logger`. Keep in mind that running this for every prediction would defeat the purpose of the prediction itself: >>> t_real, tab = conesearch.conesearch_timer( ... c, sr, catalog_db=result.url, verbose=False) INFO: conesearch_timer took 11.5103080273 s on AVERAGE for 1 call(s). [...] >>> t_real # Actual execution time 11.510308027267456 >>> tab.array.size # Actual number of objects 36184 One can also search in a list of catalogs instead of a single one. In this example, we look for all catalogs containing ``'guide*star'`` in their titles and only perform Cone Search using those services. The first catalog in the list to successfully return non-zero result is used. Therefore, the order of catalog names given in ``catalog_db`` is important: >>> gsc_cats = conesearch.list_catalogs(pattern='guide*star') >>> gsc_cats [u'Guide Star Catalog 2.3 1', u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1', u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1', u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1'] >>> gsc_result = conesearch.conesearch(c, sr, catalog_db=gsc_cats) Trying http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& WARNING: W25: ... failed with: timed out [...] Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... >>> gsc_result.array.size 2997 >>> gsc_result.url u'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out&' To repeat the Cone Search above with the services listed in a different order: >>> gsc_cats_reordered = [gsc_cats[i] for i in (3, 1, 2, 0)] >>> gsc_cats_reordered [u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1', u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1', u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1', u'Guide Star Catalog 2.3 1'] >>> gsc_result = conesearch.conesearch(c, sr, catalog_db=gsc_cats_reordered) Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... >>> gsc_result.array.size 2997 >>> gsc_result.url u'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out&' To obtain results from *all* the services above: >>> all_gsc_results = conesearch.search_all(c, sr, catalog_db=gsc_cats) Trying http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& WARNING: W25: ... failed with: [...] Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... Trying http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out& Downloading ... WARNING: W22: ... The DEFINITIONS element is deprecated in VOTable 1.1... >>> all_gsc_results {u'http://.../220/out&': , u'http://.../254/out&': , u'http://.../255/out&': } >>> for url, tab in all_gsc_results.items(): ... print('{0} has {1} results'.format(url[-17:], tab.array.size)) source=I/254/out& has 2998 results source=I/255/out& has 2997 results source=I/220/out& has 2997 results To repeat the above asynchronously: >>> async_search_all = conesearch.AsyncSearchAll(c, sr, catalog_db=gsc_cats) >>> async_search_all.running() True >>> async_search_all.done() False >>> all_gsc_results = async_search_all.get() If one is unable to obtain any results using the default Cone Search database, ``'conesearch_good'``, that only contains sites that cleanly passed validation, one can use :ref:`astropy_config` to use another database, ``'conesearch_warn'``, containing sites with validation warnings. One should use these sites with caution: >>> conesearch.CONESEARCH_DBNAME.set('conesearch_warn') >>> conesearch.list_catalogs() Downloading http://stsdas.stsci.edu/astrolib/vo_databases/conesearch_warn.json |===========================================| 87k/ 87k (100.00%) 00s [u'2MASS All-Sky Catalog of Point Sources (Cutri+ 2003) 1', u'2MASS All-Sky Point Source Catalog 1', u'Data release 7 of Sloan Digital Sky Survey catalogs 1', u'Data release 7 of Sloan Digital Sky Survey catalogs 2', u'Data release 7 of Sloan Digital Sky Survey catalogs 3', u'Data release 7 of Sloan Digital Sky Survey catalogs 4', u'Data release 7 of Sloan Digital Sky Survey catalogs 5', u'Data release 7 of Sloan Digital Sky Survey catalogs 6', u'The 2MASS All-Sky Catalog 1', u'The 2MASS All-Sky Catalog 2', u'The USNO-B1.0 Catalog (Monet+ 2003) 1', u'The USNO-B1.0 Catalog 1', u'USNO-A V2.0, A Catalog of Astrometric Standards 1', u'USNO-B1 Catalogue 1'] astropy-0.3/docs/vo/conesearch.rst0000644000175000017500000001247212243255342015425 0ustar oleole.. _astropy_conesearch: VO Simple Cone Search ===================== Astropy offers Simple Cone Search Version 1.03 as defined in IVOA Recommendation (February 22, 2008). Cone Search queries an area encompassed by a given radius centered on a given RA and DEC and returns all the objects found within the area in the given catalog. .. _vo-sec-default-scs-services: Default Cone Search Services ---------------------------- Currently, the default Cone Search services used are a subset of those found in the STScI VAO Registry. They were hand-picked to represent commonly used catalogs below: * 2MASS All-Sky * HST Guide Star Catalog * SDSS Data Release 7 * SDSS-III Data Release 8 * USNO A1 * USNO A2 * USNO B1 This subset undergoes daily validations hosted by STScI using :ref:`vo-sec-validator-validate`. Those that pass without critical warnings or exceptions are used by :ref:`vo-sec-client-scs` by default. They are controlled by ``astropy.vo.client.conesearch.CONESEARCH_DBNAME``: #. ``'conesearch_good'`` Default. Passed validation without critical warnings and exceptions. #. ``'conesearch_warn'`` Has critical warnings but no exceptions. Use at your own risk. #. ``'conesearch_exception'`` Has some exceptions. *Never* use this. #. ``'conesearch_error'`` Has network connection error. *Never* use this. If you are a Cone Search service provider and would like to include your service in the list above, please open a `GitHub issue on Astropy `_. Caching ------- Caching of downloaded contents is controlled by `astropy.utils.data`. To *not* use cached data, some functions in this package have a ``cache`` keyword that can be set to ``False``. Getting Started --------------- This section only contains minimal examples showing how to perform basic Cone Search. >>> from astropy.vo.client import conesearch List the available Cone Search catalogs: >>> conesearch.list_catalogs() [u'Guide Star Catalog 2.3 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 4', u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 1', u'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 2', u'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1', u'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1', u'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1', u'The PMM USNO-A1.0 Catalogue (Monet 1997) 1', u'The USNO-A2.0 Catalogue (Monet+ 1998) 1', u'Two Micron All Sky Survey (2MASS) 1', u'Two Micron All Sky Survey (2MASS) 2', u'USNO-A2 Catalogue 1', u'USNO-A2.0 1'] Select a 2MASS catalog from the list above that is to be searched: >>> my_catname = 'Two Micron All Sky Survey (2MASS) 1' Query the selected 2MASS catalog around M31 with a 0.1-degree search radius: >>> from astropy.coordinates import ICRS >>> from astropy import units as u >>> c = ICRS.from_name('M31') >>> c.ra, c.dec (, ) >>> result = conesearch.conesearch(c, 0.1 * u.degree, catalog_db=my_catname) Trying http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&... Downloading ... WARNING: W06: ... UCD has invalid character '?' in '??' [...] WARNING: W50: ... Invalid unit string 'yyyy-mm-dd' [...] WARNING: W50: ... Invalid unit string 'Julian days' [...] >>> result >>> result.url u'http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&DSATAB=twomass_psc&' Get the number of matches and returned column names: >>> result.array.size 2008 >>> result.array.dtype.names ('cx', 'cy', 'cz', 'htmID', 'ra', 'dec', ..., 'coadd_key', 'coadd') Extract RA and DEC of the matches: >>> result.array['ra'] masked_array(data = [10.620983 10.672264 10.651166 ..., 10.805599], mask = [False False False ..., False], fill_value = 1e+20) >>> result.array['dec'] masked_array(data = [41.192303 41.19426 41.19445 ..., 41.262123], mask = [False False False ..., False], fill_value = 1e+20) Using `astropy.vo` ------------------ This package has four main components across two subpackages: .. toctree:: :maxdepth: 2 client validator They are designed to be used in a work flow as illustrated below: .. image:: images/astropy_vo_flowchart.png :width: 500px :alt: VO work flow The one that a typical user needs is the :ref:`vo-sec-client-scs` component (see :ref:`Cone Search Examples `). See Also -------- - `NVO Directory `_ - `Simple Cone Search Version 1.03, IVOA Recommendation (22 February 2008) `_ - `STScI VAO Registry `_ - `STScI VO Databases `_ Reference/API ------------- .. automodapi:: astropy.vo.client.vos_catalog :no-inheritance-diagram: .. automodapi:: astropy.vo.client.conesearch :no-inheritance-diagram: .. automodapi:: astropy.vo.client.async :no-inheritance-diagram: .. automodapi:: astropy.vo.validator.validate :no-inheritance-diagram: .. automodapi:: astropy.vo.validator.inspect :no-inheritance-diagram: astropy-0.3/docs/vo/images/0000755000175000017500000000000012243263747014030 5ustar oleoleastropy-0.3/docs/vo/images/client_predict_search_n.png0000644000175000017500000010552412243255342021367 0ustar oleole‰PNG  IHDR,dóò¥(sBIT|dˆ pHYsaa¨?§i IDATxœìÝy\TõþÇñ÷ È*ê€k¦áŽ&näÚu!ÑÈ-7*R¯bi.™z¯¦–Š˜Ýô—šÚ½jŠ]Òº–šZ’© ¶Š•[¦åZ×Òk¦(p~“ã€+83ðz>ó ùžïùžÏ óæ{¾ç˜ Ã0NÈìè /N‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´,œ€Ó"°pZN‹ÀÀiX8- §E`à´ E`Y¸p¡Ìf³üüüì¶íܹSaaaòóó“ÅbQ=tøðá\ÇyóÍ7$///U­ZU“'OVFF†]¿Ó§O«_¿~*S¦Œ|}}Õ¢E mÚ´)×17lØ æÍ›Ë××WeÊ”QTT”Μ9sw/("\>°üòË/5j”î»ï>™L&›mû÷ïW›6m”‘‘¡åË—kÑ¢E:pà€Z¶l©³gÏÚô:uªFŒ¡ž={jýúõ2dˆ¦M›¦¡C‡ÚôKOOWÛ¶m•˜˜¨Ù³gkõêÕ*W®œÂÃõeË›¾›7oÖc=¦ *hõêÕš5k–6lØ ¶mÛêÊ•+ó†…ˆÉ0 ÃÑEÜÎ;ËÝÝ]¥J•Ò|  .X·=ñÄÚ¼y³~úé'/^\’tìØ1Õ¨QC#GŽTll¬$)55U÷ß¿úõë§·Þz˺ÿ«¯¾ªñãÇkÏž=ª]»¶$iÞ¼yzþùçõÕW_©iÓ¦’¤ÌÌLÕ¯__Å‹Wrr²uÿ&MšèÒ¥Kúî»ïd6ggï¾úJ?ü°æÍ›§Aƒì›¸8—ža‰×Ö­[5wî\]Ÿ»222´víZõèÑÃV$©råÊ ÕÊ•+­m JOOWTT”ÍQQQ2 C«V­²¶­\¹RAAAÖ°"InnnêÝ»·¶mÛ¦'NHÊžùÙ±c‡úôéc +’Ô¼ysÕ¬YÓæørç²åÔ©S1b„bccuß}÷Ùmÿé§ŸtùòeÕ«WÏn[pp°~üñGëiY{öì±¶_«|ùò*]º´öîÝkmÛ³gOžcJ²öÍ3¯¾9ÛäÍÝÑÜ©¡C‡ªN:yžV•šš*Iò÷÷·Ûæïï/Ã0ô믿ª\¹rJMM•§§§¼½½íúZ,ëX’”–––ç˜×÷fÇ¿vÌë={VŸ~ú©s­ ÎïÒ¥K:räˆ}ôQ•.]ÚÑå¸,— ,|ðÖ®]«ï¾ûÎѥܱë/p­O?ýT½{÷¾‡Õ  ÄÇÇ«W¯^Ž.Ãe¹\`ùí·ßôüóÏë…^P¹råtîÜ9I²žÞuþüy¹»»+ @RöŒÈõÒÒÒd2™d±X$IJOO×åË—åååe×·qãÆÖçyŽ™³ýÚ¯yõÍÙž›*UªHÊþdzØÎgĈš9s¦£Ë@øþ8?¾GÎï‘óã{äܾÿþ{õîÝÛúÙwÆåËÙ³guúôiMŸ>]Ó§O·Ûn±XÔµkW-_¾\ÞÞÞÚµk—]ŸÝ»w«Fòððôç:“]»v©I“&Ö~'OžTjjªêÖ­km ÎsLIÖ¾9_wíÚ¥ððp»¾×Žy½œÐT»vm5jÔ(Ï~p¬R¥Jñýqb|œß#çÇ÷Èùñ=r ×ÿA·ÇåÝW¨PA‰‰‰JJJ²>õè£ÊËËKIIIš2eŠÜÜÜÔ¹sg­X±B¿ýö›uÿcÇŽ)11QÝ»w·¶…‡‡ËËËKqqq6ÇŠ‹‹“ÉdR×®]­mݺuÓþýûµmÛ6k[FF†âããÕ¬Y3•/_^’T±bE5iÒDñññÊÊʲöMNNÖlŽ w.7Ãâéé©Ö­[Ûµ/^¼XnnnjÕª•µ-&&F7V§N4vìX]ºtI'NTÙ²eõ÷¿ÿÝÚÏb±hüøñš0a‚üýýÕ®];mß¾]1110`€‚‚‚¬}û÷ﯹsç*""B±±±*S¦ŒæÍ›§ƒjÆ 65½öÚkj×®"""4xð`>}ZcÇŽUpp°Ý%”Øs¹–¼˜L&»…ìµjÕRRR’Š+¦ž={***J5kÖÔ–-[ìÖ¼ôÒKš9s¦>øà=ú裚;w®Æ§¹sçÚôóððÐÆªaÆ©K—.:uê”Ö­[§–-[Úômݺµ>ùä8qB]ºtÑ /¼ ¶mÛjãÆ*V¬XÁ¼@!âr3,yY¼x±/^l×Þ¨Q#}öÙg·4ưaÃ4lذ›ö+[¶¬Ýécy SXXØ-õ…k‰ŒŒtt ¸¾?Îï‘óã{äüø¡(0×ß"·sçN…„„(%%……t.ŠÏtù£Ðœ ð)4§„UÔ… ]Š8???Õ¨QÃÑe€BˆÀâÂ<¨š5k:º @’tàÀB Èw–3³¯Úµk;¸U9wñe¦K!P»vmr PbÑ=§E`à´,œ€Ó"°pZÀɪJ•*Ž.À!,(T¦N*³Ù,³Ù¬ÜõxÎL&“£Kp Ã0´páBëókÿûn‡À‚Bcýúõ:zô¨úõë§€€-Y²DW¯^utY¸ ÜÐ’%KtäÈ‘\·9rDK–,¹·ÝÀ‚ $IT¯^½tæÌ­Zµ*×¾?ÿü³^xáÕ¨QCÞÞÞ*^¼¸BBB4~üxIRRR’Ìf³Ž;¦#GŽXO33›ÍŠŠŠ’$k{ÎóëµiÓFf³íØÕ«W5cÆ µoß^åÊ•“‡‡‡üýý¦O>ù$¿Þ €BƒÀ‚jݺµú÷ïoZŽ9¢þýû«uëÖŽ)ì:§NÒêÕ«U«V-5kÖÌ"æÏŸo×wÇŽª_¿¾æÌ™£J•*iĈ:t¨J—.­éÓ§K’ªT©¢èèh•,YR%K–Ô¤I“¬nݺٌw£SÆ®ß–ššª—^zI™™™ŠŒŒÔ¸qã¡={ö¨S§NÖЀlîŽ.Î-00P‹-RÿþýµhÑ"ZÃJÎsg°xñbedd¨_¿~’¤úõë«AƒÚ´i“>l]8åÊEDDèüùózÿý÷a3ΩS§$I<ð€¢££µxñb™ÍfMœ81_êô÷÷×/¿ü¢Ò¥KÛ´OŸ>]­ZµÒرcÕ§OyyyåËñ…Wzzº.^¼(‹ÅÂzKj–Bì÷ß×þýûóe¬¿ýíoŠˆˆÐÀ5þ|EGG+--Miiiw=vPP|||îxÿœÅönnnúë_ÿjmŠŠÒðáõ`ÁM›6M’´fÍ=zTO?ý´]X‘¤råÊÝq·ÂÃÃÃ.¬H’ŸŸŸžyæ½ð ڱc‡þò—¿h×uþüy=Zñï¼£Ké骨 116¿„ÀRˆíß¿_!!!ù:æŽ;$I;wη1SRRÔ¨Q£;ÞÓ¦M:tèÂÃÃU¡Bk{¯^½4zôhÅÅÅé•W^‘›››’““%I:t¸ëºïÔÞ½{õúë¯kË–-:yò¤._¾l³ý—_~qPeg—••¥N=¦ÝÛ¶i\f¦jJúÏ‘#êÛ·¯$ZP(X ±   ¥¤¤äËXÿýïc3Ãrß}÷åËØAAAwµÎ:•œÿYçð÷÷W§N´bÅ ­Y³F]»vÕ¹sç$)×YŽ{!99Y<òˆ²²²Ô¶m[uíÚU%J”ÙlÖ7ß|£>úHééé© àü6mڤϿúJë%µû£í IOJŠ™0A½{÷¶»à àê,…˜Ï]Í\ä8räˆF¥åË—+00PíÚµsš5,×^ ,22R‘‘‘¹ö›?¾ºvíªR¥JI’Ξ={×ÇÎù…`F®Û¯Ÿ9‘¤)S¦èÊ•+úꫯԸqc›m³gÏÖG}t×u ¯¯¿þZþîî ËÈÐl Ó#Ú¤ºÚ«'%-?vLgÏžUÙ²e]&¯,¸¡ÜØç¶ßQrîµòÐC©Aƒ¹öYµj•Ö¯_¯ãÇ«yóæ’¤uëÖéé§Ÿ¾éønnnÊÊÊÊu›Åb‘”=ût½ßÿ]{÷îµk?pà€Ê—/oV$)11ñ¦õŠ¶Ò¥Kë|f¦&êEMÑkú‡F«®öêGIžÅŠÉÏÏÏÑ%ùŽÀ‚Ú¼ys®¡$'´lÞ¼Ù¡eÁ‚2™Lš7ožzè¡\û”.]Z±±±Z¸p¡Æ¯ÀÀ@-[¶LݺuS÷îÝmúžо}û”‘‘!wwÛ???Õ®][[¶lÑO?ý¤jÕªY·;V/^´»jK… ôÅ_hÿþý6§Âýç?ÿÑêÕ«ïø} öü1MɘªQŠÑ(M×fIÿpsÓS‘‘òöövt‰@¾#°à†®_r­ÀÀ@‡†•¤¤$+Àµ,4kVvXyñEéÕW +Àõ,2{¶4b„4z´KXrC`p/¯ì™•×^#¬yqwtEÕÀŽ®p~̰pZjGŽ‘ÙlVTT”£KÀpÉÀòí·ßª}ûöªT©’<<<äë뫇zH ,°éׯ_?™Íf»G:uìÆ¼zõªbbb(///Õ®][sæÌÉõø‡R÷îÝe±Xäçç§öíÛë›o¾Éµï{ï½§ ÈÛÛ[+VÔÈ‘#uñâÅ»ë÷öÚÇ;ï¼#Ó'›®;18ç߯±cÇQ:n‘K®a9þ¼êÔ©£gžyF•*UÒÅ‹µlÙ2=÷Üs:}ú´^~ùek_ooo%&&Úìïíím7æ!C¯)S¦¨qãÆJHHÐðáÃuáÂ7ÎÚïÌ™3jÙ²¥´xñbyzzêÕW_U›6m´}ûvÕ¬YÓÚ÷ÝwßUŸ>}4`ÀÍš5K?üðƒÆŒ£ï¿ÿ^ ðÎ=&“IÑÑѹnkР*V¬¨ýû÷«dÉ’¹î À½‘!¹»ä§.Àñ\òG§uëÖjݺµM[»víôÓO?iþüù6ÅÍÍMMš4¹áx{÷îÕ¢E‹4mÚ4ýýï—$µjÕJ©©©š2eŠ $‹Å"IzýõוššªäädUªTI’ô—¿üEÕªUÓĉõÞ{ïI’2335zôh=úè£ú׿þe­ÛÏÏO½zõRBB‚ÂÃÃóç )â&NœxÃí׆Èk†!Ã0 ¢$¬æÍ“â㥥\þf à&\ò”°¼ä„Škå| ½ÑÓU«VÉ0 »uQQQºté’ÍlÈÊ•+õÈ#XÊ$ùùù©{÷îZ³f²²²$IÉÉÉ:yò¤Ý˜={öTñâŵråÊÛ¸m¹­aÉ9]L’ªT©b=…¬J•*Ž*PH½õ–4t¨Ô¬Yö%ŒÜ>—œaÉa†233õÛo¿éÃ?Ôºuë4}út›>—.]R¹råtöìYÝwß}êÚµ«&OžlnöìÙ£²e˪lÙ²6ûKÊžÉëСCêÑ£‡]-ÁÁÁÖíÕ«Wמ={$IõêÕ³éW¬X1Y·ãÞ¸öô¯èèh­ZµJß}÷FŒ¡R¥JI’õ+ùáŸÿ”† ɾ1äŒÜg¸S.X¬ùóçKÊ>õkÚ´i6l˜u{HHˆš4i¢zõêÉd2)))I±±±Ú¸q£¶oß.___IRjjªüýýíÆ÷õõ•‡‡‡RSS%I¿þú« ÃȵoN[jjªªW¯nÝ'·¾‹…ÅÞùÄ0 ÅÄÄØÍ U©RE}ûöÍuŸèèh>|ØX*W®|/J!ÿü§4x°4|¸ôÿGXî†K–—_~YÔùóçµzõj7N/^Ô¤I“$É&¼HÒÃ?¬† ªS§NZ¸p¡†oݵýÏ©ÈÈÈ[ãĉìG^¼¼¤\.šfcß>éòå¼·W¨ýÈË¥KÒ÷ßßÙ¾·"&&Æ®­M›6y Ò¿þõgXyã ÂJQ±lÙ2-[¶Ì¦íܹsª¦pqéÀR©R%ëZ’ÐÐP™ÍfM™2EÔ}÷Ý—ë>:tÅbÑ×_mm Ðwß}g×÷âÅ‹ºråŠ$eÏŒ˜L&¥¥¥ÙõÍiËé›ó5--ÍîT³´´4ëö™9s¦5jtÓ~7ò¯I¹|ž·ªSGú㌷á–¹t`¹^HHˆ²²²tüøñ<‹d¿?88Xï¿ÿ¾N:¥råÊYÛwïÞ-Iª[·®¤ìË!W¯^]»ví²s÷îÝòññQÕªU­cJÒ®]»dí—‘‘¡ýû÷«W¯^wø*oÏsÏI]ºä½ýV._~ó–©ZUJI¹³}p%mÚHS¦H/½DXòK¡ ,[¶l‘›››ªW¯žgŸ5kÖèܹsjÞ¼¹µ­k×®š0a‚–,Y¢_|ÑÚ'›ËwëÖM3gÎÔÏ?ÿ¬ûï¿_’tá­X±B]ºt‘Ùœ}áµfÍš©B… Š‹‹ÓOÐŋս{÷|{Ý7’§\Ýì”±›ñö–îr¢—P±¢tÍÝä— ,C‡U©R¥Ô¬Y3ùûû+55U+V¬Ð;ï¼£_|Q:zô¨  ˆˆÕ¨QC†ahË–-zýõ×U·n]=ûì³ÖñrnB-777=ôÐCZ¿~½,X ©S§Ú¬#5j”þýï«cÇŽš}úhРAzê©§tðàA3FíÛ·Wûöíïå[†ë¸¹¹Iºñå®àx.XBBBôöÛoë­·ÞÒÿþ÷?•(QB 4P||¼ž~úiIR‰%äã㣩S§êĉ2™L Ô°aÃôÒK/ÙÝí~Þ¼yªX±¢Þ|óM^zäiÑ"GW 7PdÅÇK}ûJQQÙ÷Zà|,@0›Í µi›4i’Ìf³6oÞì ªnON½[¶lqt)P Þ}7;¬ôí+-XÀ}VgÅ&\–Ùl¶y¸»»«L™2 Óûï¿ïèòd2™ìžç<îTnApû–.•þú×ì°²p!apfÜ8.Íd2)::Z’”••¥ƒjÅŠÚ´i“RRRôüÃÁþéùçŸWdd¤*UªtWãÜMàd‡•>}² ap~ÜÃ0tùòeyyy9Ýæ‰'Ú<ÿòË/ÕªU+ýßÿýŸžþyU®\ÙA•Ù P@@€£Ë€"í·ß¤¿ý°¸~LqC†ahîܹªZ¹²|||T¾tiMž|Ãcfee‰‰‰Æ¼yóŒ?þظzõêMë¼&“É0›Íví_~ù¥a6› 777ãèÑ£†aFtt´a2™ŒR¥J?üðƒÝ>}ûö5L&“1þ|›öŒŒ £[·n†Ùl6¾ùækû»ï¾k˜L&£U«VFzzºµ=--ͨU«–a2™ŒÐÐP›±rjؼy³µíÌ™3F‰% cëÖ­vuýè#½-阤$íÿòKõèÚÕn"Çž={tá÷ßÕûºöÞÊžaHNNÎóx§NR“FªaC‡ªcÇŽª]£†~øá‡|zEÙ ÃPLLŒ&Mš¤‰'ªW¯^zä‘G$I#FŒ°[¿2xð`Õ¬YÓ¦-55UñññjÙ²¥\w~777M›6M†ahéÒ¥ÖöÅ‹K’^ýuyxxXÛ-‹ÍLÌÍ,Y²D.\ÐÈ‘#õ—¿üÅn{¹råny¬·ÞzKzã7ìÖÊ4oÞ\]»vÕš5kôÛo¿IÊž]9pà€}ôQuìØÑ¦ÿСCU§N<ÿmÜ+œVœ8qBï½ÿ¾f†úÿÑVI’gF†:ýµvìØ¡ÆÛíçïï/I:"©á5íG¯Ûž›~}úèç={´Q±<Ð IDATR¨ah§¤>Ç«[çÎÚ³¿u=F~ÈYÃa2™d±XÔ¢E =óÌ3zúé§íú6oÞÜ®mûöíÊÊÊÒÕ«W5iÒ$»íYYY’²×™äعs§|||Ô¤I»þ·s*UNèëСÃ-ï“—¯¾úJ’ôÙgŸåz¯—ÿþ÷¿Ö+©5lØP;wî¼a½­ZµÒ¾}ûîº.€»A`)Ž9¢,ÃP«ëÚs>¦þøã¹–š5kªÙCiÜ7ߨnf¦jH:!i˜Ù¬ûË–µÎdäv¼„Ï>Ó;’rz„Húgf¦Z<¨Ï?ÿ\­Z]_Í1™LÊÌ̼åþ%K–´kKMM•”òš52™Lºxñ¢õùùóçóœý¸Q»Þ¹sç$I¥K—¾å}ò’ó:bccóìc2™¬3,çÏŸ—”w½·ó:ÀÙ|ø¡TµªÔ°áÍûpnœVÊl2éúkSåü ¾zõêyî»äÝwõ{Ù²ª%©Z±bªl2i_ñâúÏŠrwÏ=ïæ\ªþuí þøúË/¿ÜîK(P9!æoû›²²²r}dffjãÆ6ûä|à¿^ÎBþ[QªT)IÒÙ³gïâüY“ÉdÒÿþ÷¿¾Ž–-[ZûߨÞÛyàL–/—ž|RzûmGW ?XŠ€ *è©'ŸÔ877½-鸲װ twW‹¦MõÐCå¹oÍš5µÿǵ8.N=GŽÔì¹suèèÑ\O­ÊQ«V-y+¦5×µ¯þãkýú×GÇjÚ´iž—ÎKHHˆ~ÿýw}ýõ×vÛ’’’nyœœ÷qݺu·Ôßd2å¹®¤yóæ2 ã–_GHHˆ¤¼ëÍí´2pvË—K‘‘ÒSOI\€‹#°ÿZ°@>þ¸ž•TYR„¤ -´â£nz#HõíÛW¯½öšlÈ‹¿¿¿žþøc›¾sæÌÑ÷ßït7 €É +O>)-YÂ}V€Â‚5,EDñâŵüÃoû>,wjúôéòððÐsæhÊåËòpwW¯Þ½5ûÍ7 ì˜wcΜ9:xð Æ§øøx…††ªdÉ’JMMÕ·ß~«íÛ·ëÝwßµ^u,22Rï¿ÿ¾V¯^­ºuëªK—.ºzõª>üðC5iÒD¼¥ãhéÒ¥êÙ³§Zµj¥:¨nݺJOO×Î;õóÏ?ÛŒ¦÷Þ{O –ÙlVëÖ­Õ²eKÕªUK‹-Rÿþý¤Ž;ªzõêÊÌÌÔáǵeËùûûÛ,¤ûí·Õ®];uíÚUÝ»wWµjÕôí·ßjÓ¦M WBBBþ¾ÑP@>øàϰòÎ;„ 0!°1UªT±¹»{A)V¬˜^ýuEGGëøñãªP¡ÂMgf ’ÉdºálŸŸŸ6oÞ¬ùóçkéÒ¥zçwtñâEùûûëÁÔ”)SÔ¶m[›}–/_®ØØXÅÅÅiîܹºï¾ûÔ¿M˜0A^^^·\C‡¬³;7nTBB‚|}}U·n]9Ò¦ï¬Y³d2™´qãF­\¹R†a(::Úº.¥W¯^ª_¿¾f̘¡ÄÄD}ôÑGrssÓ< :Ø]9­E‹Úºu«^~ùeëiiÍš5ÓæÍ›• O?ýôÖÞ`p ?Ì>ì‰'˜Y #“ÁœÎÎ;¢””5jÔè®û‰‡­O)33{f%ëÁÁïÈüÁ5piÜË—°Rüh—FP 7®ÀiX8- §E`Nqã$®m =,S+¾ÿþ{G—€"Œ ÚGI={JݺIYYÜg(j,.ÌÏÏO’Ô»woWüùïòÓGIÙaåÝw +@QD`qa5jÔÐtáÂG—‚"ÎÏÏO5jÔpt ™Õ«³ÃÊãg‡•bÅ]G °¸8>$ £5k²OëÒEZº”°e,ºNeÍ©Gì°²la(ê\2°|ûí·jß¾½*Uª$ùúúꡇÒ‚ ìúîܹSaaaòóó“ÅbQ=tøðá\Ç}óÍ7$///U­ZU“'OVFF†]¿Ó§O«_¿~*S¦Œ|}}Õ¢E mÚ´)×17lØ æÍ›Ë××WeÊ”QTT”Μ9swo…˜§§ôÄ„Ù\2°œ?^uêÔÑôéÓ•””¤U«V©^½zzî¹ç4uêTk¿ýû÷«M›6ÊÈÈÐòå˵hÑ"8p@-[¶ÔÙ³gmÆœ:uªFŒ¡ž={jýúõ2dˆ¦M›¦¡C‡ÚôKOOWÛ¶m•˜˜¨Ù³gkõêÕ*W®œÂÃõeË›¾›7oÖc=¦ *hõêÕš5k–6lØ ¶mÛêÊ•+÷àÂÚ·—âã +þ`"­Zµ2*W®l}a”-[Ö¸pႵíèÑ£†‡‡‡1fÌkÛÙ³g ///cРA6ãM›6Í0›Íƾ}û¬msçÎ5L&“‘œœlmËÈÈ0|ðA£iÓ¦6û7nÜØ¨[·®‘™™imûòË/ “Éd¼õÖ[y¾Ž””C’‘’’r¯΄ÏtùÃ%gXòb±X¬ÿ‘‘¡µkתG*^¼¸µ½råÊ ÕÊ•+­m JOOWTT”ÍxQQQ2 C«V­²¶­\¹RAAAjÚ´©µÍÍÍM½{÷Ö¶mÛtâÄ IÒ/¿ü¢;v¨OŸ>2›ÿ|››7o®š5kÚ@î\:°†¡ŒŒ ;wNo¿ý¶Ö­[§Q£FI’~úé']¾|YõêÕ³Û/88X?þø£õ´¬={öXÛ¯U¾|y•.]Z{÷îµ¶íÙ³'Ï1%Yû挙WßœíòæÒeðàÁòðð¿¿¿ ¤)S¦hذa’¤ÔÔTI’¿¿¿Ý~þþþ2 C¿þú«µ¯§§§¼½½íúZ,ëX’”–––ç˜×÷fÇ¿vLŠ¢\®kv\ú>,/¿ü²¨óçÏkõêÕ7nœ.^¼¨I“&9º´›2™L7í3bÄ•*Uʦ-22R‘‘‘U÷ĺuÒ¨QÒ† R… Ž®¸{Ë–-Ó²eËlÚÎ;ç j —,•*UR¥J•$I¡¡¡2›Íš2eŠž{î9HÊž¹^ZZšL&“uÍK@@€ÒÓÓuùòeyyyÙõmܸ±õy@@@žcæl¿ök^}s¶ßÈÌ™3Õ¨Q£›öÀ•¬['uí*…‡K·ðëp ¹ýQyçÎ qPE…‡KŸv½eee騱cªV­š¼½½µk×.»~»wïV5äáá!éÏu&×÷=yò¤RSSU·n]k[pppžcJ²öÍùšWßkÇ ¨HHºuË+Ë—Kü*€<ªÀ²e˹¹¹©zõêrwwWçεbÅ ýöÛoÖ>ÇŽSbb¢ºwïnm ————âââlÆ‹‹‹“ÉdR×®]­mݺuÓþýûµmÛ6k[FF†âããÕ¬Y3•/_^’T±bE5iÒDñññÊÊʲöMNNÖlŽ@Q=³Ò¾=aÀ­sÉS†ªR¥J©Y³fÖì+V¬Ð;ï¼£_|ÑzºULLŒ7n¬N:iìØ±ºté’&Nœ¨²eËêïÿ»u<‹Å¢ñãÇk„ ò÷÷W»ví´}ûvÅÄÄhÀ€ ²öíß¿¿æÎ«ˆˆÅÆÆªL™2š7ož<¨ 6ØÔùÚk¯©]»vŠˆˆÐàÁƒuúôi;VÁÁÁv—P 0ûôÓ?ÃÊVÜß掼ýöÛF‹- ‹Åb¸¹¹‹Å 5Þ}÷]»¾)))FXX˜áëëk”,YÒèÞ½»qèС\Ç={¶Q«V-ÃÓÓÓ 4bbbŒŒŒ »~§N2úöíkÞÞÞF‹-Œ7æ:ægŸ}f4oÞÜðöö6Œ~ýúgΜ¹áëã&C€ÂäóÏ ÃÓÓ0:w6ŒË—] pïð™.˜ Ã0š`+gVJJ ‹î.ïÂéµ×¤ $OOGWÜ;|¦Ë.yJp~~Ò”)Ž®€«*T‹î.N‹ÀÀiX@¾øï]€ÂˆÀîÚ† RõêÒš5Ž®@aC`weésg©uk©];GW °!°€;¶qcvXiÓFZ¹RòòrtE  ¸#9a¥uk €‚C`·mÓ¦ì°Òª•´ja@Á!°€Ûrê”Ô¥ aÀ½áîè€k)WNzÿ}©m[ €‚G`·­cGGW ¨à”0N‹ÀÀiX8- ÈÕ¶mÒùóŽ®@QG`v¶l‘BC¥˜GW ¨#°[¶H:HÍšIS¦8ºEXmÝšVš6•Ö¬‘||]€¢ŽÀ$e‡•Ç#¬p. Ï?Ï+MšV8 E\V–4|8a€srwtÀ±ÌfiíZ©D É××ÑÕ€- P… Ž®rÇ)aœ€Ó"°pZŠˆ¯¾’>þØÑUÀí!°P|õ•ôè£ÒÌ™’a8º¸u ¹ääì°Ò ´r¥d29º"¸u ±äd©}{©~}é“O¤âÅ]Ü …Ô×_gϬԯ/­[GXàš,B_=³ÌÌ ×F` úôÓì°²näççèjàÎX(„&L6l ¬p} !“Iòòrtp÷,œ€Ó"°pZ\ÔŽRÿþÒÕ«Ž® ŽK–Ï>ûL‘‘‘ªZµª<<\.\иqã¬ýΜ9£–-[* @‹/–§§§^}õUµiÓFÛ·oWÍš5­}ß}÷]õéÓG ЬY³ôÃ?h̘1úþûï•Pï  (HI‘¤  ìû­péb…šá‚N:e×vùòeãþûï7¬m}ûö5üüün:Þž={ ³ÙlÄÆÆÚ´8Ððññ1ÒÒÒ¬m£G6<==cÇŽYÛþ÷¿ÿeÊ”1ž|òIk[FF†Q¡B#<<ÜfÌ¥K—&“ÉX·n]žõ¤¤¤’Œ”””›Ö(Zvì0ŒR¥ £iSÃ8wÎÑÕ¸>Óå—<%¬lÙ²vmžžžªU«–~þùg›vÃ0l¾æfÕªU2 CQQQ6íQQQºté’ÍlÈÊ•+õÈ#¨R¥JÖ6???uïÞ]kÖ¬QVV–$)99Y'Ož´³gÏž*^¼¸V®\y‹¯€l;wfŸV«VöÌJÉ’Ž® žK–Üœ?^;vìЃ>hÓ~éÒ%•+WNîîîªT©’† ¦_ýզϞ={T¶lY» ,IÚ»w¯u¬C‡©^½zvǶnÏS’]ßbÅŠ)((Ⱥ€[±sgöi`5jV-.¹†%7C‡Õ¥K—ôòË/[ÛBBBÔ¤IÕ«WO&“IIIIŠÕƵ}ûvùúúJ’RSSåïïo7¦¯¯¯<<<”šš*Iúõ×_eF®}sÚRSSU½zuë>¹õµX,:vìØÝ¿h@‘Q¬˜Ô¢…OXP´ŠÀ2aÂ-]ºTsæÌQÆ ­íÆ ³é÷ðëaÆêÔ©“.\¨áÇßëRoˈ#TªT)›¶ÈÈHEFF:¨"€£Kk×:º yY¶l™–-[fÓvîÜ9US¸¸|`‰‰‰ÑÔ©S5mÚ4 2ä¦ý;tè ‹Å¢¯¿þÚÚ ï¾ûήïÅ‹uåÊHÊž1™LJKK³ë›Ó–Ó7çkZZšÝ©fiiiÖí72sæL5jÔè¦ýàX¹ýQyçÎ qPE…‡K¯a‰‰‰±>ÆŽ{Ëû]¿?88XgΜѩS§lÚwïÞ-Iª[·®¤ìË!W¯^]»ví²s÷îÝòññQÕªU­cJ²ë›‘‘¡ýû÷[Ç7— ,¯¼òŠbbb4~üxM˜0á–÷[³fÎ;§æÍ›[Ûºví*“ɤ%K–Øô‹‹“ÂÃímݺuÓ¦M›l®Fvá­X±B]ºt‘Ùœý–6kÖL*TP\\œÍ˜|ð.^¼¨îÝ»ßÎËŠ$—<%lÆŒŠŽŽVxx¸:vì¨ääd›íÍš5ÓÑ£G5`ÀEDD¨F2 C[¶lÑ믿®ºuëêÙgŸµö¯S§ŽžyæEGGËÍÍM=ôÖ¯_¯ hêÔ©6ëHF¥ÿûßêØ±£&Ož,ÅÆÆêÊ•+š4i’µŸÙlÖ?þñõéÓGƒ ÒSO=¥ƒj̘1jß¾½Ú·o_àïÀõddHî.ùÛ †Kþ/qíÚµ2™LJHH°»c¼ÉdRff¦J”(!M:U'NœÉdR`` † ¦—^zÉîn÷óæÍSÅŠõæ›oêäÉ“ªR¥ŠfÏž­¡C‡Úô+]º´¶nݪQ£F©oß¾ÊÈÈP‹-”””ds—{IêÕ«—ÜÜÜ«¸¸8¨oß¾š:ujÁ¼1—öÝwRD„ôÁR.WЀ"ÉdÜ莊pˆœZ))),º€"â»ï¤¶m¥À@é³Ï$‹ÅѸ[|¦Ë.»†€Âb×. ä…À€íÚ%=òˆôÀ„È É™Y©\™°y!°à‡g‡•J•¤ $GWΉÀ€Tª$ LX€›qÉËàêÜݥɓ]8?fX8- §E`à´, '$Ãptàº,}û¤ ¤7Þpt%àº,€}û¤ÐP©|yé¯ut5àº,ä³}û¤GÉ+7J¥K;º"p]òÑ÷ßg‡•²e +,ä“ï¿Ï> Œ°ù‡À@>¸rEêÐáϰR¦Œ£+€ÂÁÝÑPxxHK–HµkV ?XÈ'­Z9º(|8% €Ó"°pZN‹ÀÀm8p@:vÌÑU@ÑA`à8 µi# âèJ è °p Ⱦ)d©RÒÛo;º(:,ÜÄÁƒÙa¥dIiÓ&©\9GWE€8x0û4°%²ÃJùòޮРyÈ™Y)QBJL$¬€#XÈÃĉ’Ÿ3+àHîŽ.gµ`ôÛo„p$ y(^<ûpN à´,œ€Ó"°Š´C‡¤¸8GWÈ ‹îEÖ¡CÙ7…ôö–ž|2û+À¹0Ã(’ʾ)¤—Wö}V+àœ,€"çðáì°âá‘}ûŠ] /@‘røpöi`RRaœPd9’=³R¬3+à*,€"㫯þœY¹ÿ~GW¸÷4°:tHŸ|ò‰RSSïåa$EFJ»vVÀ•X`yñÅ5fÌëóO>ùDµjÕR§NT£F íÙ³§  @ž¼¼]àvX`Yµj•jÕªe}>aÂ…„„hõêÕªZµª&L˜pÇcöÙgŠŒŒTÕªUåáá!‹Å¢Ç{L_|ñ…]ß;w*,,L~~~²X,êÑ£‡>œë¸o¾ù¦‚‚‚äå奪U«jòäÉÊÈȰëwúôiõë×OeÊ”‘¯¯¯Z´h¡M›6å:æ† Ô¼ysùúúªL™2ŠŠŠÒ™3gîøµEI–ãÇ«fÍš’¤3gÎè›o¾ÑäɓթS'½ôÒKÚºuë½`Áû¬uÛ_|¡ºuëæëñΟ?¯;vèÁ”$ýôÓOº|ù²êÕ«g×788X?þø£õ´¬œ Ûô+_¾¼J—.­½{÷ZÛöìٓ瘒¬}sÆÌ«/€üwìXö}V¶o—.\pt5€üà^P9R¥J•Rrr²š6mªgžyƺíÂ… êׯ_¾oèСºté’^~ùeI²^:Ùßßß®¯¿¿¿ ÃЯ¿þªråÊ)55Užžžòöö¶ëk±Xl.Ü–––ç˜×÷fÇçÒοŽ˾ƒ½”}SÈJ•Z ŸX`1™Lêß¿¿ú÷ïo·íŸÿüg¾k„ Zºt©æÌ™£† æëØÅd2ݴψ#TªT)›¶ÈÈHEFFTYà’ŽÏžY1Œì›B>ð€£+PÔ,[¶LË–-³i;ǹ©ù¢À‹ÙlVrr²š4ib·mÇŽjÚ´©233ïú8111š:uª¦M›¦!C†XÛ$eψ\/--M&“ɺŽ& @éééº|ù²u͵}7nl3n^c^{Ü›?gûÌœ9S5ºi?(ÊŽÏžYÉÊ"¬pœÜþ¨¼sçN…„„8¨¢ÂãžÞé>‡aù2NLLŒõ1vìX›mÕªU“···víÚe·ßîÝ»U£F yxxHúsÉõ}Ož<©ÔÔT›õ6ÁÁÁyŽ)ÉÚ7çk^}ó{ E?ÿœ=³BX€ÂË!e÷îÝ*Y²ä]ñÊ+¯(&&FãÇÏõ&”îîîêܹ³V¬X¡ß~ûÍÚ~ìØ1%&&ª{÷îÖ¶ððpyyy)..ÎfŒ¸¸8™L&uíÚÕÚÖ­[7íß¿_Û¶m³¶edd(>>^Íš5Sùòå%I+VT“&M¯¬¬,kßääd8pÀæø€;ãæ&U¯ž½f…°…S¾ž6kÖ,Íœ9Óº>£[·nòôô´é“žž®'N¨gÏžw|œ3f(::ZáááêØ±£’““m¶7kÖLRö LãÆÕ©S';V—.]ÒĉU¶lYýýï·ö·X,Öàãïï¯víÚiûö튉‰Ñ€díÛ¿Í;WŠU™2e4oÞ<Ýn ÉK/½$???Í;WÓ§OW… 4nÜ8ëUÇrxxxhãÆzñÅ5lØ0ýþûïjذ¡Ö­[§–-[Úômݺµ>ùäMœ8Q]ºt‘:wî¬×_]ÅŠ»ã×&#¿”\§M›6zë­·T»v킾PËY •’’¢{ÅgºüQ`W KJJ*¨¡¶èþÿٻ󸪪ýÿãï*â"¦×[˱D-sÀJѲ,4M.ŠYjš–SÃMÅÌ!ë:4Xj^•1­,2E»*™C9d_3%KQÇ$nJ IDAT4ÑDÖï~œ<†rç¯çãÁCX{í½?‡õ@Λµ×ÞóæÍÓ¤I“rÝöÚk¯)""ÂY§1éé®®à*N ,³gÏÎñÐÃl•+WÖìÙ³uj@rì˜Ô¸±´n«+¸‚Ó. ûé§ŸÔ¨Q£\·Ý}÷Ýú¿ÿû?gPD;–õœ•´4©n]WWp§Í°”,YR.\ÈuÛ… l·> 7ÇÿVââ¤;îpuEWpZ`iР¢££sݶlÙ2ùûû;ëÔ€B.;¬\¼˜õPH _N»$lذaêÓ§¼½½5xð`U«VMÇ×| ¨¨(-\¸ÐY§b‰‰Yaå?²fVî¼ÓÕ\Éi¥W¯^úñÇ5yòdÍ;×Öîéé©W_}U}úôqÖ©…Tj*a`ÏiE’&Nœ¨þýûëË/¿Trr²üüüÔ±cGÕ¨QÙ§RåÊIO=%=þ8aÅ©E’jÖ¬©§Ÿ~ÚÙ§‹4j”««¸§-º—¤´´4½ÿþûêÙ³§:tè Ÿ~úI’ôñÇëСCÎ<5€"Ài3,§NRëÖ­õÃ?èöÛo×Ñ£G•šš*IZ·nÖ¬Y£?üÐY§P8m†e̘1úã?´gÏž³)­ZµÒ×_í¬S("œX>ùäMš4I 4ȱí¶ÛnÓÑ£Guj€›;uJº|ÙÕU §–sçÎéöÛoÏu[zzº<<œº|঒’¤V­¤aÃ\]  0pZj°Z­ŠÏuÛŽ;T·n]g঒’¤¶m¥³g¥‘#]]  0pZ`éÓ§^{í5}ñŲX,¶ö½{÷êÍ7ßTß¾}uj€Ê+gÎd=²NWW( œv—°1cÆhË–-z衇të­·J’ºté¢ÄÄDuêÔIÇwÖ©næäÉ?ÃÊÆ„@Þ9-°”*UJŸ~ú©–-[¦O>ùDIIIòóóÓ#<¢ž={²†Š‰ì°’’’5³ÂÁ€áÔ'Ý{xx¨gÏžêÙ³§3Opc!!ÒéÓ„ÀÍqj``Ö,©D  àæ84°´iÓFsæÌQ½zõÔ¦M»Åöe±XT®\9µhÑB#FŒ···#K¸‰\Ç@ž9t!‰1ÆîscŒ233sýÈÈÈÐñãÇ5aÂ=õÔSŽ,@áЖ¸¸¸\?¿ž… jèСŽ,@áò[u¨[·n®.€rê¢ûôôt-[¶Lqqq:}ú´|}}ÕºukõèÑC%JdºvíÚZ°`3Ë8Ù©SÒo¿I»º@Qã´ÀrêÔ)uìØQ»wï–···|||”’’¢ùóçëÍ7ßTll¬*W®ì¬Ó È©SR»vÒ¥KÒþý’§§«+%N»$ìùçŸWBB‚V®\©sçÎé·ß~SjjªV¬X¡„„1ÂY§S§¤öí¥ÄDiåJ Àñœ6òvíZM›6MÁÁÁ¶6OOOuíÚUÉÉÉ3fŒ³N (§Og…•ãÇ¥¥»ïvuE€¢Èi3,ÆÝ}ß^õë×·»2 p9}:ë20 ÀÙœXÚµk§ 6äºmãÆjÓ¦³N p¢«gV6l ¬œË¡—„¥¤¤Ø>7nœºuë¦+W®¨gÏžªR¥Š’’’ôÑG)::Z+W®tä©dÖ¬¬;‚mÜÈSìÎg1¼6ËÃ#ï6‹EŽ:u‘²k×.5iÒD;wîÔ½÷ÞëêrÀNzºôë¯RÍš®®Üïéá3,ãÆËs_‹ÅâÈS H‰„@Áqh`™0a‚# ˜sÚ¢û«¥¥¥)11Qiiiq:E„SË–-[ôÀ¨\¹rª^½ºÊ•+§V­ZiëÖ­Î<-€"ÂiŽŒW»víT¥J :TU«VURR’V®\©víÚiãÆjÑ¢…³Nȇ3g¤ÈHiĉ%‡WrZ`7nœš6mªØØXy{{ÛÚ'Ož¬Ž;jܸqŠuÖé7éÌ©CéÈé‰'¤ÛnsuE€âÌi—„ÅÇÇkìØ±vaE’¼½½5fÌmÛ¶ÍY§ܤ«Ãʆ „€ë9-°dddÈËË+×m¥J•â,àfΜ‘‚‚²ÂÊW_I¹º"œX6l¨÷Þ{/×msçÎU£|þ&<þ¼ÆŒ£   ùùùÉÃÃCááá9úõë×O9>îºë®}¯\¹¢ððpY­V•.]Zõë××;3ëù>¬®]»ÊÇÇGåË—WPPvïÞkß>úH7–···ªW¯®çŸ^.\È×ëG:{6+¬>œV7vuEdqÚ–—^zI?þ¸š7o®>}ú¨jÕª:qâ„¢££¯Õ«Wçëø§NÒ¼yóÔ¸qckþüù×|¥···6nܘ£í¯† ¢E‹iÒ¤IjÚ´©>ÿüs >\©©©z饗lý’““õàƒÊ××W ,———¦L™¢Ö­[ëÛo¿U:ul}/^¬¾}ûjàÀš5k–þïÿþOcÇŽÕôùçŸçë{ŽpölÖe`?ÿLX¸!ãD‹/6ÿøÇ?ŒÅb±}üóŸÿ4K–,qèyN:e,‹ ϱ-44Ô”/_þo±oß>ãááa¦Nj×þôÓO›2eʘ””[ÛèÑ£———9zô¨­íܹsÆÏÏÏ<ùä“¶¶ôôtS­Z5Ó©S'»c.Y²ÄX,³nݺ\kÙ¹s§‘dvîÜù·u@~mÙbLõêÆìÚåêJ há=c8õ9,½zõÒ¯¿þªýû÷kóæÍÚ¿¿Ž=ª‡žÇ“§í×ë·zõjcÔ¿»öþýûëâÅ‹v³!111jÛ¶­n»j5jùòåÕµkW­]»V™™™’²n¦¤}K–,©zõêÙ¶€«•.íê ÈSKdd¤RRR$eÝ5¬mÛ¶úé§ŸœyÊš4i¢Ù³gkåʕڼy³ ¤ÈÈHÝÿýv ßOŸ>­J•*åØ¿lÙ²*Uª”NŸ>-I:s挌1¹öÍnËî›ýon}}||lß¹sè¢{«ÕªæÍ›«Y³fjÚ´©Ý6cŒââ┚šêÈSþ­aÆÙ}}ÿý÷ëž{îÑ#<¢ùóçkøðáZÏ1b„n¹å»¶‡_R€ü‰ŽŽVtt´]ÛÙ³g]TMÑâÐÀ2bÄÅÇÇëí·ßÖÑ£G%IC‡U‡Ô²eKGž*_~øaùøøè›o¾±µùúúêûï¿ÏÑ÷Â… º|ù²|}}%eÍŒX,–\gG²Û²ûfÿ›’’’ãR³””Ûök™9s¦î½÷Þxep…Üþ¨¼k×.5iÒÄE½$lĈú裔 cÇŽI’*W®¬>úHAAA’¤‘#GjΜ9úí·ßyêö×øþþþJNNVRR’]ûÞ½{%I 4”u;äZµjiÏž=9޹wï^•)SFwÜq‡í˜’rôMOO×?þh;&ä&**J ¹nKHHPTTTžuîœÔ³§tÃà¶XPíÚµma%""BV«õo‘VÖ¯—¸2PØ84°|÷ÝwúöÛoõí·ßêÓO?•$µlÙRÍš5Óý÷ß/I¶g”Üã€þ2D¿üò‹$Éb±hùòåZ¾|¹,‹Ž9¢ *¨L™2zýõו˜˜(‹Å"«ÕªaÆéå—_Îñ´û÷Þ{OÕ«W×Ûo¿­'N¨fÍšš={¶ž}öY»~•+WÖ×_­Q£F)44TéééjÙ²¥âââìžr/I½{÷–§§§¦NªÈÈHùúú*44T¯¿þz¾_?€¢ÏjµêÃ?T³fÍÔ¶m[%''ßPXéÔéϰrß}ίG³˜¿{êb>dÏ0;vL›6mÒwß}'oooµoß^>ú¨Ý þ”½@kçÎ,º Ù³gÛîh—§KÁ²ÃÊ?H_~)ý寀À{:ÇpêsX$)((H3fÌÐöíÛ%I¯¾úª|}}õÊ+¯8ûÔPèíØ±C#GŽÔ?ÿùOÅÅÅ)<<üš ñ³¥¦J=DX N ,·ß~»J•*eפˆˆ%&&:óÔPè={VÁÁÁòööÖW_}¥ÀÀ@Ûš–ë…ÉÏOŠ%¬ ?§–„„Õ«WORÖ“V­Z©\¹rY'öpúäZÆ…„„(11QŸ~ú©m}ÜÕ ñ¯ZÊ–•V¯–þÿ½O(Ôºèþz<==WP§€Bí½÷ÞÓ矮÷ß_>ø Ý¶ìвiÓ¦<-¾ 0+°ÀÈ›]»vé…^ÐsÏ=§gžy&×>V«•°(¸. ÜÈï¿ÿ®=zÈßß_o¼ñ†«ËÀå˜a7aŒÑÀ•œœ¬ØØXyyy]·zºT‚ÿÅE3,à&Þÿ}-_¾\ºãŽ;®Û÷üy©}{iΜ*!°€ؽ{·FŒ¡¡C‡ª[·n×í{þ¼Ô¹³´k—Ô¸q€‹XÀÅÎ;§=z¨AƒzóÍ7¯Û÷Â…¬°²{·ôÅR@@ €‹põ3¸1FO?ý´’’’´nݺë®[¹pAzøá¬™  ¸ °€ Í;WK—.ÕÒ¥KU«V­köËžYÉ+-[`‘¸—„€‹|÷Ýw>|¸¬=z\³_f¦Ô¥‹´s§ôùç„@ñB`HMMU=T¿~}ýç?ÿ¹n_©_?iÝ:éþû ¦>Ü—„@3Æè™gžQbb¢víÚ¥Ò¥Kÿí>}û@a¸! °ùóç+::ZÑÑѪ]»¶«ËÀ­qI ={öè¹çžÓ3Ï<£ž={ººÜ ÈùóçÕ£GÕ­[W3fÌpu9 \À£ÁƒëرcÚ¹s§¼½½sôùãéòeé–[\P nŠÀ ""B‹-ÒâÅ‹U§NÛÿøCzì1)=]Ú°A²X\P$nˆÀN¶wï^ :TT¯^½rl¿x1+¬lÝšuëb b 8Qöº•ÚµkkÖ¬Y9¶_¼˜õPÈì°Òª• ŠÀ1ÃNbŒÑ!Cô믿jÇŽ9Ö­\V>ûŒ°@n,à$‘‘‘úïÿ«ÿþ÷¿ªW¯žÝ¶«/ûôS)0ÐEEàæ¸$ œ`ÿþýzöÙg5`ÀõéÓ'Çö^¶lÉ +­[|}p° .¨{÷îºóÎ;5{öì\ûŒ/}ña€¿C`€›¥„„„íC‡Õ‘#GÔ«W/•)S&×}«V•xÀÉPXà&*,,Ì.´DEE)22R5kÖTHHˆëŠ ˆ °ÀM²Z­Šˆˆ°…–~øAƒ RµjÕôÙgŸÉjµººD =îùZúõë§_~ùEZ¿~=aa†òÉjµª|ùòJHHлᆱ»îºK’”––u'0pó,O|ð>ùä5J .TBB‚ÒÒ¤®]¥‡–Μqu…^\ù°mÛ6 :TAAAzã7ôË/¿(4ôyzÆhÛ¶2Z»Vòñqu•^̰ÀMúùçŸõðÃË××WK–,‘ÅbQµjVyzÆhÓ&OÍ{BíÛ»ºJ 7 ܤ—^zIgÏžUtt´|}}uéRÖe`Û¶•Qdäef~áê(ô¸$ n·ß~«˜˜½øâ‹jÓ¦.]’ºu“¾úJZ³F ª*)ÔÕePè1Ã7èüùóêÕ«—î¹çMœ8Q’´r¥´~}vXqq!̰À zî¹ç”˜˜¨uëÖ©dÉ’’¤^½¤fͤZµ\\E nÀ²eË´`Á-X°@µþ’N+8—„@ýòË/zúé§Õ£G…†²>€‚@`€<ÈÈÈPß¾}U±bE½ÿþû²X,®. €b¡P–óçÏk̘1 ’ŸŸŸ<<<žkß]»v©}ûö*_¾¼|||Ô­[79r$×¾o¿ý¶êÕ«§Ò¥KëŽ;îÐĉ•žžž£ßÉ“'Õ¯_?ùùù©lÙ²jÙ²¥6lØë1ׯ_¯€€•-[V~~~êß¿¿’““oþÅp‰)S¦hË–-Z´h‘|x$¦P–S§NiÞ¼yºr劂ƒƒ%)׿vþøãjݺµÒÓÓµ|ùrEDDèàÁƒzðÁuêÔ)»¾¯¿þºFŒ¡'žxB±±±2dˆ&Ož¬gŸ}֮ߥK—Ô®];mܸQ³gÏÖš5ktë­·ªS§NÚ¼y³]ßM›6顇RµjÕ´fÍÍš5KëׯW»vítùòeW8˶mÛ4a½øâ8mÛö øñ ™BîÔ©SÆb±˜ðððÛºwïnªT©bRSSmm¿üò‹)Uª”;v¬Ý1J—.m d·ÿäÉ“‡‡‡ùá‡lmï¾û®±X,&>>ÞÖ–žžnî¾ûnÓ¼ys»ý›6mj4h`222lm[·n5‹ÅÌ™3皯içÎF’Ù¹sg¾œé÷ß75kÖ4Í›?h}4Ô*eÌU?þ\ïé£Pΰ\Í“k{zzº>ùäuëÖMåÊ•³µß~ûíjÓ¦bbblmŸþ¹.]º¤þýûÛ£ÿþ2ÆhõêÕ¶¶˜˜Õ«WOÍ›7·µyzzªOŸ>Ú¾}»%IÇŽÓŽ;Ô·o_yxüùmP:uìÎÀ}=ûì³JNþ]*¬Ó_xhõjéªàd…>°\ËÏ?ÿ¬´´45lØ0Ç6:tÈvYÖ¾}ûlíW«Zµª*W®¬ýû÷ÛÚöíÛwÍcJ²õÍ>æµúfoà¾/^¬E‹–ªnÝï´iSYÅÄH=äêª(^Šl`9}ú´$©R¥J9¶UªTIÆ9sÆÖ×ËËKÞÞÞ9úúøøØŽ%I)))×<æÕçý»ó_}LîçðáÃ4è9ÝvÛíÝ{›V­’~ØÕUPüðàHÉË-QGŒ¡[n¹Å®-$$D!!!Î* €².)íÕ+T™™‹uâÄ}ZµJêÜÙÕUÜYtt´¢££íÚΞ=ë¢jŠ–"X|}}%e͈üUJJŠ,‹íÖ¤¾¾¾ºté’ÒÒÒTºté}›6mjwÜkóêóþÝù³·_ÏÌ™3uï½÷þm?ŽõÚk¯éÛoåç×Fóç[ôÈ#®®àîrû£ò®]»Ô¤IUTtÙKÂî¼óNy{{kÏž=9¶íÝ»Wµk×V©R¥$ý¹Îä¯}Oœ8¡Ó§O«Aƒ¶6ÿkS’­oö¿×ê{õ1¸¯¿þZ“&MÒ„ ¡JHð"¬àbE6°”(QB>ú¨V­Z¥óçÏÛÚ=ª7ªk×®¶¶N:©téÒŠŒŒ´;Fdd¤,‹üq[[pp°~üñGmß¾ÝÖ–žž®E‹©E‹ªZµª$©zõêjÖ¬™-Z¤ÌÌL[ßøøx®-]ºT®.\@‘fµZ¡Ãôâ‹ÙEU«VÕ±cÇ!«ÕêêÀuXyÙ¡¥}ûöÚ³g|}}EX à.aŠ…üQ¿þú«$iúôé„ fXy‰‰‰êÝ»·*Uª¤ 6(<<\ ®. ä@‘’‘!sõ×êÖ­›ÎŸ?¯ØØXµiÓF #´PXRh¨ô ¶3FÛ¶mSdd¤š4i"éÏ5-„Ü@‘V>úH Èjûúë¯5cÆ =÷Üs ±ëŸZ6mÚä‚j@^±è@¡—‘!õë—V–,‘zôNŸ>­^½zéÐ[o½•ë~V«•Å÷¸9fXjRÿþRt´´xqVX1Æ(,,Lüñ‡–,Y¢%øÛ …¿ÅZRXXVPY²Dzòɬö·ß~[k֬њ5kôÏþÓµE€|a†@¡5t¨´h‘}XÙµk—F­#FèÑGum ߘaPhuï.þVRSSõä“OªAƒš:uªk‹A`PhµmûççÆ û¬ÂÂÂÔ«W/W—ˆÀ P»xñ¢zöì©5jhöìÙ®.8—„pk™™Rr²të­¹o9r¤<¨íÛ·«lÙ²[p:fX¸­ÌLià@) @JK˹}åÊ•š3gŽfΜ)ÿ‚/83,ÜRvXY°@Z¸P*]Ú~{BB‚  'žxBO?ý´kŠNÇ ·“™)=ýôŸa¥OûíW®\QHHˆ|||4oÞüPŠŒ”úöÍÙç‹/¾Ð´iÓôÆo¨yóæ^#(X\ÀmÌž-ÍŸŸu)Ø¿þ•s{bb¢úöí«Ž;jäÈ‘_ (p̰pJuêH?œs[FF†úöí+OOO-\¸Pü½€â€ÀÀm”-›{X‘¤iÓ¦iÆ úòË/U¥J•‚- ¸ ¢àö¶lÙ¢qãÆé•W^Q»ví\](@n-%%E!!! Ðøñã]](`nË£°°0]¸pAK–,Q‰\Å @qC`P Œ‘6lÈ[ßwÞyGü±,X Ûn»Í¹…·D`P`Œ‘ž}Vjß^Ú¿ÿú}wïÞ­Q£Fé¹çžS—.] ¦@àv, DvX™3Gš7Oºûî¬ö¨¨(%$$ØõMMMÕ“O>©ZµjÉßß¿à‹«‰[ IDATnƒÀÀ錑†Í +óçKü¹-00Paaa¶ÐbŒÑ!CtìØ1U¨PAíÛ·wMÑÀ-X8UvXyャ™•«ÃŠ$Y­VEDDØBËÂ… µhÑ"Y­VEGGËjµº¤nà¸å§1F6ìϰòÔS¹÷Ë-={öÔwß}§ªU«êÓO?%¬fX8ÏöíÒûïKsç^;¬d«X±¢Ž?®K—.iÁ‚„ ©–¸¸8yxxäú±}ûv»¾ëׯW@@€Ê–-+???õïß_ÉÉÉ9ŽyåÊ…‡‡ËjµªtéÒª_¿¾Þyç\ÏøðauíÚU>>>*_¾¼‚‚‚´{÷n§¼VÀÝ4o.ýø£4pàõû]¾|Y?ü°µhÑ"½ñÆ9â€â©È–lS¦LQ||¼ÝÇÝÙ·)’´iÓ&=ôÐCªV­šÖ¬Y£Y³fiýúõj×®._¾lw¬!C†hêÔ©6l˜bcc¬áÇkÊ”)vý’““õàƒêСCZ°`–-[¦´´4µnÝZ,× ¸Z­Z×ßnŒQïÞ½õÍ7ßhñâÅêÝ»·ÝšPÌ™"nãÆÆb±˜•+W^·_Ó¦MMƒ LFF†­mëÖ­Æb±˜9sæØÚöíÛg<<<ÌÔ©Síöúé§M™2eLJJŠ­môèÑÆËËË=zÔÖvîÜ9ãççgž|òÉkÖ²sçN#Éìܹ3ϯ(¬Fe$™ÿüç?víGŽ1mÚ´1GŽqMaäïé£ØÌ°cdŒÉuÛ±cÇ´cÇõíÛW~KT§NÅÄÄØÚV¯^-cŒú÷ïowŒþýûëâÅ‹úüóÏmm111jÛ¶­ÝºË—/¯®]»jíÚµÊÌÌtÔË ¥¥K—êÍ7ßÔðáÃõüóÏÛmË^ˆ¿iÓ&UÜA± ,ƒVÉ’%U±bEuêÔI[¶l±mÛ·oŸ$©aÆ9öó÷÷·mÏî[¥JU©R%G?IÚÿÿß}ñâE>|øšÇÌÞWÛ¶mShh¨z÷î­3fäÚÇjµ*44´€+î¤È;V .ÔÖ­[5g·Öc=¦¦M›êÃ?”Åbq^ P+òÏaiÔ¨‘5jdûºY³fzì±ÇäïﯱcÇ*((È…Õ]߈#tË-·Øµ…„„($$ÄEöŒ‘FŽ”f̪U“ž|òï÷9sæŒ:w+*&&F^^^Î/'‹ŽŽVtt´]ÛÙ³g]TMÑRäKnÊ–-«Ç{L³fÍÒ¥K—äëë+IJIIÉÑ7%%E•+W¶}íëë«ï¿ÿ>G¿ .èòå˶cùøøÈb±\ó˜ÙǺž™3gêÞ{ïÍû  1Ò¨QYaåwòV._¾¬'žxB'OžÔ¶mÛì~¶(Ìrû£ò®]»Ô¤IUTtùKÂþŽÅbQƒ $I{öìɱ}ïÞ½¶íRÖú“ääd%%%åè'ÉÖ×ÛÛ[µjÕºæ1Ë”)£;î¸Ãa¯(HÙaå?ÿÉ +Ï>›—}Œ¬¯¿þZ111ªS§Žó …^± ,çÏŸWLLŒî¹ç•*UJÕ«WW³fÍ´hÑ"»;wÅÇÇëàÁƒêÚµ«­íñÇ—ÅbQTT”Ý1###U¦LuêÔÉÖ¬ 6è·ß~³µ¥¦¦jÕªUêÒ¥‹ÝÉ€ÂÂiôè +’4mÚ4EDDhþüùjÕª•s‹EF‘¿$¬_¿~ºãŽ;tß}÷©B… :|ø°Þ|óM%&&*""ÂÖoÚ´iêСƒºwï®ÁƒëäÉ“zñÅåïïow ã»îºK Ðøñãåéé©ûî»O±±±š7ož^ýu»5'£FÒÿû_uîÜY'NT©R¥4uêT]¾|Y&L(ÈoàÆHcÆHo½%½ývÞÃÊòåËõÒK/éÕW_Õ¿þõ/ç Š”"XêÖ­«¥K—júôéºxñ¢|}}õàƒjÁ‚v×ê³Ï>Ó¸qãÔ¥K•)SF>ú¨¦OŸ®’%KÚó½÷ÞSõêÕõöÛoëĉªY³¦fÏž­gÿòî­råÊúúë¯5jÔ(…††*==]-[¶T\\—àPJM•>ýTš=[:4oûÄÇÇë_ÿú—BBBîÜ@‘c1×zš"\&{ÖÎ;Yt·“–&•.·¾GŽQóæÍU§N­_¿^¥óº#EïéƒEnH^3ÇÙ³gÕ¹sgU¨PA111„pSŠü%a Þ•+WôÄOèĉÚ¶m›üüü\](¤,Ê£!C†hóæÍŠUݺu]](Ä,júôéš?¾"##ÕºukW— 9Ö°°cŒôê«ÒêÕ7¾ïŠ+4vìX½òÊ+ u|q Ø!°°1FzåiÒ$)!áÆöýæ›oÔ·o_=ù䓚8q¢SêÅ€¤?ÃÊ”)Y†1"ïû&$$¨K—.º÷Þ{)þkŽÁ» 2Fú÷¿ÿ +/¼÷}ÿýwuîÜYåÊ•ÓêÕ«¹}1p(ÝÅ\vX™ùD³gÏÎu!>€£X€b <\ ¾ñÐbŒÑ›o¾©ž={ªR¥Júæ›oÔ¹sg»5-ÎD`Џ‰¥ ¤€ÉÓ3ïûeddhذa¶»mÛ¶MuêÔ‘”s!>€³X€"lâĬÛOž,½ôRÞ÷ûã?ÔµkW½ÿþûêׯŸâââT³fM»>Ù¡eÓ¦M®àO,ºЍ×^Ë +¯¿~caåäÉ“zôÑGµÿ~­Y³F?üð5ûZ­Vnk œŠÀA¯½&'Mš$½ürÞ÷;xð zè!]¸pA›6mR“&MœW$@pIPÄ̘ñgXy啼ï·eËÈËËKñññ„à˜aŠ˜N²þ}þù¼ï³råJõîÝ[-Z´PLLŒ|||œSÀ b†(bê׿±°2cÆ uïÞ]ÁÁÁúâ‹/+À­X€b*##C#FŒÐ /¼ 1cÆhñâÅòòòruYv¸$ (†.^¼¨Þ½{ëã?Ö{ï½§Áƒ»º$€\X€b&99Y]ºtÑž={ôñÇë‘GquI×D` ©ÄD©ZµÛçСCz衇tîÜ9ÅÅÅ©iÓ¦Î)ÀAXÃBS§JõêIÇŽå}ŸøøxÈÓÓSñññ„P(X€BfÚ´¬'×?ÿ¼T½zÞö‰‰‰Q›6mT¯^=mÙ²E5kÖtn‘B` ‘7Þ^|Q?^š0!oû¼ýöÛêÖ­›ºté¢/¿üR¾¾¾N­À‘,@!ñÆÒرYO±ÿkX‰ŠŠRBB‚][ff¦FŽ©çž{N;vTtt´J—.]`õ8(¦OÏ +¯¾šûÌJ`` ÂÂÂl¡%--MO>ù¤þóŸÿ¨víÚš3gŽ<<øq…ï`7÷ÙgÒ˜1Ò¿ÿ-…‡KKÎ>V«U Óîݻվ}{­]»VþþþŠ•Õj-ðºÛn®cGiåJ)88÷°’­|ùòºï¾ûÔ¢E y{{«AƒZ±baj̰nÎÓSêÚõÚaåÀ4hn»í6½ýöÛ Òï¿ÿ®·Þz‹° = Pc«‡zHwÝu—>þøc½üòËúßÿþ§ .(..Nááá9â6 ¹xñ¢æÏŸ/uìØQIIIZ¸p¡Ô§O=Z ´­i!´€ÂŒÀ‰‰‰zõÕWuûí·ëé§ŸVíÚµ§;wªoß¾JLLTXX˜"""l—]½ŸÐ + à&6lŒ±oÛ½{·þõ¯©Fš9s¦zõ꥟~úI111 ”åÿ/lÙ´i“]XÉ–Z6mÚT@¯À±¸KàfΔž^úøc©sç ­]»V3gÎÔ¦M›T£F M:U PÅŠsÝ?44ôšÇ¶Z­,¾…3,Nvþüy1BÕ«W—···î¹ç-]ºÔÕe¡€åö$úlãÇŸÖóÏKÏ?IGŽÌVݺu¬ôôt-_¾\‡Ò /¼pͰP”1Ãâd]»vÕŽ;4mÚ4Õ©SG‹/VHHˆ233âêòP@²ŸDÿ×˶Æ?­‰}Õ°ágš??D/þ¡îÝ»kÉ’%jÖ¬™ë p̰8ÑgŸ}¦õë×kΜ98p 5wî\uèÐA£GVff¦«KÄU®7 ’ ¨¨¨›>ö_Àc4`Àwš8ÑWÒ4=ÚGC† Ö‘#G+W!°8QLLŒÊ—/¯îݻ۵÷ïß_Ç×7ß|ã¢Ê›ìY¿†–„„………)00ð†Ž—‘‘¡'Nèûï¿×_|¡Í›7«yóæjÕª•ªV¤ˆˆÆªXñ½ûnýöÛ¯š:uªþùÏ:ð~\æDûöíSýúõåáaŸ ýýý%Iû÷ïW@@€+JC.®žɾt+;¬d‘‘¡ääd%%%éĉJJJ²}üõëääd™¿Üö«B… *S¦–Nž|A­ZÅkÆòôäï×B`q¢Ó§O«V­Z9Ú+UªdÛ÷bµZõî»ïª}ûöjÒ¤‰6mÚ¤Zµj©K—.× !·Þz«ªV­ª[o½UuëÖµûúꤤ$………é­·öiÞ¼—õë¯9oE €?XÜØˆ#tË-·Øµ…„„°XßɬV«µlÙ2ùûû«ZµjjܸqŽRµjUU©REÞÞÞy:î_gkZ¶ŒÈu!>(|¢££m×vöìYUS´XœÈ××7×Y”””Ûöë™9s¦î½÷^§Ô†kKJJRóæÍ5~üx…‡‡kúôéù +Rî— €Â)·?*ïÚµKMš4qQEEÏ;QÆ uàÀwÛ»w¯$©Aƒ®( ×qu° ´»³W~ð$z€›C`q¢àà`?^+V¬°kŒŒTõêÕÕ¼ysU†ÜüÝ,H~BKhhè5gP¬VëuŸTPœqI˜uêÔI:tÐàÁƒuîÜ9Ýy犎ŽVll¬/^,‹Åâêq•¼Ì‚ÜÈe[QQÒƒJwÜáØ:Š‹“­ZµJ¯¼òŠÆ§””Õ¯__}ô‘zôèáêÒð×›å°Z­7VæÌ‘† ‘^{Mú÷¿P@1E`q²²eËjæÌ™š9s¦«KAyÿý¬°2|¸ôÊ+®® pc à@| œVf̸ê ,€ƒ|ð4hôÜs„G!°0wnVX6Lš9“°à( Ÿ23¥eˤ¡C¥Y³+ŽÄ¢{ Ÿ<<¤O>‘¼¼+ŽF` tiWWP4qI·E`à¶,ÜÈ£ˆˆ¬ç« àX€<ˆˆžzJúé'ÉWWP|X€¿‘VžyFzçn] P,Àu,XVž~Zz÷ݬg® àðö ¸†ÈHiÀià@é½÷+®À[0 QQRXXÖìÊœ9„Wám OϬËÀÞŸ°àJ%\]àŽúôÉú€kñ·cn‹ÀÀmX¸- ·E`à¶,Ü€Û"°p[n‹ÀÀmX¸- ·E`à¶,Ü€Û"°p[n‹ÀÀmX¸- ·E`à¶,Ü€Û"°p[n«H–¸¸8yxxäú±}ûöýׯ_¯€€•-[V~~~êß¿¿’““sô»råŠÂÃÃeµZUºtiÕ¯__ï¼óN®5>|X]»v•Ê—/¯   íÞ½Ûá¯/::ÚÕ%à:÷ǹ?ÆÈý1F(Št`É6eÊÅÇÇÛ}Ü}÷Ýv}6mÚ¤‡zHÕªUÓš5k4kÖ,­_¿^íÚµÓåË—íú2DS§NÕ°aëàà` >\S¦L±ë—œœ¬|P‡Ò‚ ´lÙ2¥¥¥©uëÖ:xð Ó_7œ‹_îñqŒ‘ûcŒÜc„â „« (µk×V³fÍ®ÛgôèѪW¯žV¬X!¬W³fMÝÿýŠˆˆÐ Aƒ$Iû÷ïWDD„&Ož¬‘#GJ’Zµj¥Ó§OkÒ¤I4h|||$IÓ§O×éÓ§¯Ûn»M’ôÀèÎ;ïÔ¸qãôÑG9ë%EB±˜a1ÆÈsÍíÇŽÓŽ;Ô·o_[X‘¤€€Õ©SG111¶¶Õ«WË£þýûÛ£ÿþºxñ¢>ÿüs[[LLŒÚ¶mk +’T¾|yuíÚUk×®Uff¦#^Pd‹À2xð`•,YR+VT§N´eË»íûöí“$5lØ0Ǿþþþ¶íÙ}«T©¢*Uªäè'eÍÀHÒÅ‹uøðák3{;€k+Ò—„ùøøhìØ± T¥J•tèÐ!½ùæ›jݺµ>ýôSI’NŸ>-IªT©RŽcTªTɶ=»onýÊ–-«R¥JÙúž9sFƘk3ûXµjÕʱ=--M’tàÀ}É(@gÏžÕ®]»\]®ñqŒ‘ûcŒÜcäÞ²ßË]¼xÑÅ•n…&°ÄÅÅ©mÛ¶yêûÝwß©aÆjÔ¨‘5jdkoÖ¬™{ì1ùûûkìØ±¶ÀânŽ9"IêÓ§‹+ÁßiÒ¤‰«KÀu0>î1rŒ‘ûcŒÜ_BB‚î¿ÿ~W—QhšÀR¯^=ÍŸ??O}¯^3òWeË–Õc=¦Y³féÒ¥Kòòò’¯¯¯$)%%%Gÿ””U®\Ùöµ¯¯¯¾ÿþûý.\¸ Ë—/ÛŽåãã#‹ÅrÍcf+7;vÔ¢E‹dµZåíí}W w•––¦#GލcÇŽ®.¥P+4¥jÕª sè1-‹$©Aƒ’¤={ö¨S§Nv}öîÝkÛ.e­?Yºt©’’’të­·Úõ»úXÞÞÞªU«–öìÙ“ã¼{÷îU™2etÇwäZWåʕջwï|¼2¸ƒ–-[ºº„B¯X,º¿Úùóç£{î¹G¥J•’$U¯^]Íš5Ó¢E‹ìîܯƒªk×®¶¶Ç\‹EQQQvÇŒŒT™2eìOpp°6lØ ß~ûÍÖ–ššªU«V©K—.vw$“ç„ &¸ºgéׯŸöìÙ£ .())Iqqq0`€¥š5kÚúÖ®][3fÌÐ÷ß/___ÅÇÇë™gžQ54gÎyzzJ’üüütìØ1Íš5KÞÞÞºråŠæÍ›§Ù³g+<<\íÛ··³qãÆŠŠŠÒêÕ«õüCGŽÑ!Ctüøq-^¼øš—„øÿL6yòdÓ¨Q#S®\9ãééiªT©bºuëfvìØ‘kÿ/¿üÒoooãëëkúõëg’““sô»r劙0a‚©Q£†ñòò2õêÕ3ï¼óN®ÇüùçŸMpp°©X±¢)Y²¤ñòò2¥J•276}ôQž^GRR’ 5•+W6eÊ”1櫯¾Êû7y’ššj†nþñ˜Ò¥KçyŒ~ýõW3|øpÓªU+S±bEc±XLdddT\üÜì-]ºÔ<öØc¦zõê¦dÉ’¦råʦk×®fß¾}Puñr³ckÍ­·ÞjJ”(aÊ—/oxà³råʨºx¹Ù1ú«W^yÅX,Ó A'TY¼Ýì-X°ÀX,–\?’’’  òâ#¿?G«W¯6­Zµ2*T°½—|ÿý÷XqáV¤‹;éСƒñññ1sçÎ5qqqfàÀÆb±˜%K–\w¿´´4Ó Asûí·›%K–˜õë×›ÇÜ”,YÒlÚ´©€ª/nvŒ6nÜhüüüLPPéÕ«—±X,&**ª€ª.^nvŒš7on}ôQa¾þúk³lÙ2Ó°aCS¾|y³ÿþª¾x¸Ù1Z¶l™yñÅͪU«ÌÖ­[ÍÚµkÍ£>j,‹Y´hQU_<Üì]m÷îݦtéÒ¦jÕªÆßß߉ÕO7;FÙ%**Ê|óÍ7vW®\) ê‹‡üüM™2Åxzzš¡C‡š/¾øÂ|ýõ׿ƒ> °\¥|úé§Æb±äHÞAAA¦zõê&##ãšû¾ûî»Æb±˜øøx[[zzº¹ûî»MóæÍVsq“Ÿ1ÊÌÌ´}¾cÇ‹“ägŒNž<™£-99Ùx{{›§žzÊáµWù£Üddd˜š5kšV­Z9²ÌbÍctåÊÓ¸qc3bÄÓºuk‹ƒågŒ²ËÎ;]f±–Ÿ1Ú±c‡ñôô4Ó§Owv™E «¾ @LLŒÊ—/¯îݻ۵÷ïß_Ç×7ß|sÝ}ëÕ«§æÍ›ÛÚ<==Õ§Omß¾]‰‰‰N«»8ÉÏeßmN’Œ1N«±¸ËÏùùùåh«\¹²þñØÝù“Ÿ1ʇ‡‡*T¨àÈ‹=GŒÑÔ©SuöìYMš4‰ÿóœÀcd²þ í¬‹½üŒÑ;ï¼£Ò¥KkذaÎ.³H!°€}ûö©~ýú9î æïï/IÚ¿ÿu÷mذaŽö¼ì‹¼ËÏ¡`8zŒ>¬„„Ý}÷Ý«±¸sÄeff*==]ÉÉÉš2eŠ8 çŸÞ)õGù£~øA¯¿þºæÌ™£²eË:­ÎâÌ?G;wV‰%äëë«nݺñ;ÌÁò3F›7oVýúõµ|ùrÕ­[W%J”Ðm·Ý¦—^zIW®\qjÝ…Y¡yKavúôiÕªU+G{¥J•lÛ¯%%%ÅÖïF÷EÞågŒP09Fééé Sùòåy3ì@Ž£‡~X±±±’²žgµ`Á=þøãŽ-´ËÏedd(,,LݺuËñÌ28N~ƨzõêš8q¢Z´h¡òåËkïÞ½š:uªZ´h¡­[·ÚÞP#ò3FÇŽÓ©S§ô /hÚ´iª_¿¾¾úê+…‡‡ë×_Õ¢E‹œVwaF`P¬dffjÀ€Úºu«V¬X¡êÕ«»º$\åwÞѹsçtêÔ)-Z´H¡¡¡JKKsøƒƒqãf̘¡ŸþYŸ|ò‰«KÁ5tèÐA:t°}ݼys=òÈ#ªW¯žÆ§˜˜V)ëwPjjª.\¨Ç{L’Ô¢E ?^Ó¦MSxx¸î¼óNWé~¸$¬øúúæš¶SRRlÛ¯·ov¿Ýy—Ÿ1BÁpÄc4pà@-^¼X ,P—.]^gqæˆ1ªU«–î½÷^iáÂ…êÒ¥‹žþy¥§§;¼ÞâèfÇèèÑ£7nœÆ¯%JèìÙ³:{ö¬ÒÓÓ•‘‘¡ßÿ]iiiN­½¸pôU«ªM›6ŠwH}Èÿû:‹Å¢Ž;ÚµgÏZ~÷Ýw¬´è °€† êÀÊÌÌ´kß»w¯$©Aƒ×Ü×ßß_{öìÉÑž—}‘wù#ŒüŽ‘1FO=õ”"##õᇪwïÞN«µ¸rÆÏQ“&M”ššÊe™r³ctøða¥¥¥é¹çžS¥J•l[·nÕäã㣗_~ÙéõÎú}tõ b?ù£FIÊy“žì¯§ÜX @pp°ÎŸ?¯+VصGFFªzõêvwËmßüQÛ·o·µ¥§§kÑ¢EjÑ¢…ªV­ê´º‹“üŒ F~Æ({f%22RsçÎUhh¨³Ë-–œñs´yófùøøäz§7ܸ›£{î¹Gqqqv7nT£FT³fMÅÅÅéÙgŸ-ˆ—Pä9úçèøñãúꫯàÈ2‹µüŒÑOÜT«VÍxyy™Æ›¥K—ÚõéׯŸñðð0¿üò‹]{RR’ 5¾¾¾ÆÛÛÛ´lÙÒ|õÕWY~±Ÿ1²X,¶»Ïá87;FV«Õn\®þ¨Yóÿµwï1U×Ç_çx8iàÎáªéú!KX­¢#åÒ„<^â¨Y’ k+[5ø£e±t¼Œ¶Æ†ÎÅ*¥,*È.gÖ(éx+r3†ÙE³‹•å´‡X…¾¿?œg’©èWz>6þàÍçû¹|—×>ßËÿ.ô2†µ³ý­ZµÊp¹\Fll¬a³ÙŒøøxcæÌ™Æ{ï½w¡—0ìËïºSñâÈ¡q¶ß£òòr###Ã5j”a³ÙŒ±cÇ÷ÜsñÍ7ß\è% {çòsŒÅ‹ÉÉɆÝn7ÒÓÓgžyæBNÿ’c1 Þ,Àœ¸‡€iX˜€iX˜€iX˜¦¾¾^V«U?ýôS¨–““£ÜÜÜ‹2Ÿ»ï¾[EEEÿØnëÖ­²Z­Ú¾}ûÍ% *##CÕÕÕC6 œíbO`~Ï>ûìE·µµU¯¾úª¾øâ‹‹2þ©l6›žzê)•••©´´TIII{J0ì±ÃÃDww÷õžž®ôôô!ëÿtªªªäv»•‘‘qÁÇ>Ç#‡Ã¡ššš‹=øO °À%èÉ'Ÿ”ÕjU{{»æÌ™#‡Ã¡´´4IÒ®]»T\\¬qãÆÉn·Ëétª¸¸Xûöí‹ègçΚ2eŠ¢££5vìXUVVêØ±cíN½$ìt—_ýðòZ­zñÅCµ¯¿þZ·ß~»œN§l6›œN§n¹å}öÙgƒ®ñÀÚ¼y³,Xñµ}ûöiÆŒЉ‰QBB‚xàýñÇöÓÒÒ¢¼¼<ÅÅÅiÔ¨Qš:uª|>_D»wÞyG×\sFŽ© &¨¶¶6tžOfµZuçwjݺuêëët €sG`€KØÜ¹s•™™)¯×«çŸ^’tðàA¹\.ÕÕÕiÛ¶mzá…ÔÝÝ­ììlutt„Žýꫯ”——§ÞÞ^566ª¾¾^{÷îÕòåË#ƱX,²X,g<¯mûûû5cÆ íß¿_k×®ÕŽ;´aÃåä䨫«kÐ>6mÚ$Ã0”ŸŸV?r䈲³³õÝwßiýúõjjjR__Ÿz衈>^~ùe¹Ýn%''«±±Q^¯W)))r»Ýa¡¥¹¹YGãÆ“×ëÕêÕ«õÖ[o饗^pÝÓ¦MÓo¿ý¦ÖÖÖ3>'€³Ã=,p »ï¾û´dÉ’°šÇã‘Çã }Þßß/·Û­1cƨ¡¡A?ü°¤ã—[Ùív½ÿþûr8’¤üü|¹\.ýüóÏa}†ñ¯Ë ‡Ö?þ¨5kÖhþüù¡ú¬Y³þñض¶69%''‡ÕkjjÔÑÑ¡;vèÊ+¯”t|¨¨¨H µëîîVyy¹æÍ›§W^y%TÏËËÓäÉ“UYY©;wJ’–-[¦´´4y½^1B’”››Úµ:ÕÕW_-IúôÓOuóÍ7ŸÉ©œ%vXàvr09áèÑ£Z²d‰ÒÒÒ%›Í¦˜˜uuu…]¶eËåçç‡ÂŠt|gdîܹ2 ã¼Ì/))IãÇתU«T[[«ööö3¾ŒêСCJLLŒ¨oÙ²E™™™¡°rÂÉH:~Ã~gg§.\¨`0úèëë“ÛíÖ®]»ÔÓÓ£?ÿüSmmm*** …IŠŽŽVAAÁ€çâļ:tFkœ=vXàæt:#j ,ÐöíÛUYY©¬¬,ÅÆÆJ’ ÔÓÓj ÕÎÖˆ#äóùTUU¥+VÈï÷+66VwÝu—ª««Csû7:::4qâĈú©ó>räˆ$é¶Ûn°‹Å¢@ Ã0d†"Ú T\XFºººôî»ïjåÊ•zôÑGCõcÇŽé÷ßkët:CÿÔŸì×_ýÇql¶ã>NÝ-9zôhDÛÔÔTÕ××K’¾ÿþ{566jéÒ¥ú믿´~ýúÓŽ‘’’¢¶¶¶ˆz||üÍ;>>^’ôÜsÏ)33sÀ1ÕÛÛ+‹Å"¿ßñõj'5f̘ÓÎp~pI #½½½2 CQQQaõ 6èï¿ÿ«åææª¥¥E@ TëïïWSSÓ?Þ¯rùå—K’öìÙV÷z½ƒ—ššªÇ{L×^{­¾üòËAÛº\.uvvêðáÃóÞ½{·öïßVíµ×Â>Ÿ2eŠF­½{÷êúë¯ð#**J111š4i’Þ~ûmƒÁÐñÝÝÝÚ´iÓ€çâÄ{a&Mš4èçŽF”••¥êêjÅÅÅ)--M}ô‘êêê4zôè°û1žxâ y½^MŸ>]Ë–-Stt´Ö®]ºLêT'×®¸â MžŸON§S7ÝtÓ kœ;vXà4Øc†ßxã Ýpà *//Waa¡Z[[ÕÜܬ¸¸¸°c®ºê*µ´´Èn·kþüùZ´h‘&Nœ¨¥K—Fô=ÐxºñƵxñbéÀjhhk“’’¢””ÕÔÔhæÌ™r»ÝjjjÒÊ•+UUU5èSSS•——ÑgRR’¶mÛ¦ &¨¬¬LóæÍ“ÅbÑš5k"æXRR"ŸÏ'¿ß¯²²2åääèÞ{ïUkk«¦Njçv»µqãFýòË/*,,Ôƒ>¨Ù³gëŽ;îP\\\XŸýýýzýõ×UZZv“>`hXŒóõ(γ?þXÙÙÙúüóÏ/øÛîûúú”••¥ÄÄD577‡ê7nÔ¢E‹ôí·ßF}ˆ”ïŸsñ¯³ãð£<RÔbŸï^¿îu¯×½^÷ºefggg!Ë2Àw¨bM ÌÕ(3 ˆèÛC¨¼)#1=ÖÝm¨Ymxž}»T ˜¾*aèØàm¿ž§ëë‘ù@DKnÙÂŽŒPÅD!""""¢»Ûw˜DDDDDÄŽ ;2DDDDDDìÈ;2DDDDDD·×=·F™¢(P.KDDDDÄŽÌ=FHWâˆEÂHLKÌE"""""vdî~‰«Bã!¸¶¸á^me.Ý÷™™»?Бó!¸¶6Áaw0‰ˆˆˆˆîCKö°ÿwW®„2³4£ÄtbÈÜ#""""bG¦²P’I(3Kð`þ ö'""""ºŸUü™ï®\‰Ã_áçε“2DáΜ¤R)H“¦§§‘º™˜ªM¨©©µÖ “ÉÄ@DDDDt¿wd¾»r%>›˜‚4-”ÊŒaF¸íË $ D/Fa1[`6›QSSEQ`1[0ñŤ+×pŠÑ}Û‘Ñubæž‹Ùè|,ïö×§¦ T-M'ñuÑ/¢p>â„ ˆ_‰Cº¢.Ó¬(s«*Ñ‹Q8ÀÎ Ñ}Ù‘™ß‰ªÔ½~ø§¯Ô½ÏdŽ¢()„/MãÈýÉk2Ì«,jg¦‚R©¢£p>î„Åbn¶u6(7$®%˜Nh1·®¶"z1 ×*WYÓÌdYFðt­m­åu¸ øßó£ë`×mËpéK ­»ZŽ„½¯h,ŠÇœ!õSÀòŇ-z!Šÿ¾³ÿo¶¤ýùŽøÐ´­©ìébóQ——¿ìBâZCdžÐq C÷y±8-6K]KM§Râ~§äKóRÒ%‘(/¿“v•.³ó‘NŽ!OË@ ®áÞêVëU£gG1)M"•L©õéƒV¸ä†i…)+ë7Õ#x6¨«ïMÕ&x÷yµœÁô×ÓH)êþÄ®WVÞTê< Gˆ]ˆ©Ç›š_' ƹØùS(MÒÛJ£uxh<9©Î|°ÙlhÜÖ¨ÿô(¦¿™†œ”¡(JVù•eÁ3A$®&`L°o²Ã¹Ù™}[€ï=äk²V>Œ„¿Øñ‹1Zò1Z&‹Êÿ’êÏb¿Ï÷ý-`ô£ˆÇã@à´;álp–že¦Ñý߉kÕRԣĎŒ®Ÿ”!ÐV*SÒ¯XV`FÁäUudD¾™„Pm‚ T¶##]‘`ª6ÁR­vbä›2BŸ„²VOSnª (3 ¤+êÖו|,EQ ]½·^È)'eD>·°èÛaw •JÝÙø|# U¡V:EQDÇŽÛ¥v/–÷Û‘æåä÷ÝšZšÔˆè³Îz'œmN­8€çYÚˆLhÙÑˤR)ÿDàt­»Z³÷·ZMãŽýyë×.XÌõû[@øó0†N¡ã厊ç™,Ë…Ðþb{¦‘{ :9T0ÎÅI“BiPôú—jÇÀ- q-¡}o©± îá:¤fRœ dý~øä0j­µhÝÕŠTJÝÆl6g]ÿBŸ„`®6C¾&gí£Pø‹¿#e`±éoD¡øWâ÷ù¾ýxI9‰Ž;RR<6Á,h¯š0š妑ýß ×*bGưµ?hT;1WÕ‘e~gaÞHŒ@€*Aý[BÒU bˆÄtrR†4)å]zzzŽ L\ž(XD/D‰DÔæFrš[š1tlÐÿj¿ZÁèÈ»-¤n¤8@âj³öMvÝq´ï§À ÖŠhÚÖ¤]h í;דþCý˜žž† p>îÄè™Q<öuºŸé©ûL¥Ry·M_Ü»zº0t|Hý¾Z@ËS-ð½åÓFPþõ¯åÑJÝHaïíEàtÊŒ‚¦íM8úÛ£Ú¶‰D­»Zù4k­Þ缺4_¸ï\#6±/b°Ùl‹J¿…ùغ»þ÷üpos#r>ù¦Œ®ý]Hͨ¿$© HÛz·6¾ ”ŽÏQDΫǶ­·¡ñǺÆ@:Ñ QÄb1]Ã)u#…7à}Á ‹%s*Ž\Ss•÷bi^,î‹*óóï^¦ïLÏÛw±ó%gÙ)#]råwúø±K1xÚ<º´ïmŸ¾]ÀÄ• DÆ#“2,«,hÚÞË–¼e¶iGSÖöÉd¡±PÖ>rI§IúŽºý‘¹tX868à¿äÏ4:\™’Éç£Nøùsîψ\a²˜-y÷W¬ìúÞÿŽNßÛ>­,‰s±rb$M Ÿyâª#Dé´Z®v¤ÓœõN­ÊÕy“¯ÉhÛÝ– ßf'ÂãaÝõ/ñuÒ—ÜÛÜ%…½ØñÓÂãaÄ.ÅÔóRëpmq.…~_4ý‹ÔÅâ_,ÿ¤_¡ïã—âhÞÑ ,LËM¨¯¯G,ƒÃî0”ÅÊO¡ô1Z>–êZ•º‘‚ï=Ü[ÜÚñFÏŽ"™H¢µ­U«g[Ç;2º‘˜ž¡Ï8/íNØôÒÞÑUn*HL'¸š@òF2ïvæfX×Ya6›µÑ™|'Wðl­O·ÂjµªwÀ®&t‡ôÝØBÛ@àt‚I@Ç~õnËðÉá¬ã¥/R©”Z!ÎÐÚÒZtß +ʽ޽8÷Ñ9¸¶¸º‘BäÏÀgú ÿ}£6¬Ð¶ÐêiEüR£ÁQÔÙ꺑BìbÌP^ìܵ0õ)@cS#:Ú;à;¢6Z[Za1[pýúu$“I4ºKÎïx<®Mƒ)7ýæcú",MJjçjî"89—/v 5“Âðña„ÆBÚE´`{n_Úï>Ñÿ.ó*3‚cA$ ­»ƒuµU›Þ8U~8S¦S±íƽÜ2?ò»µú¢ž¡SC}‚k«ËÐù2¿ì,&]ò±=lS/®ßÈÚE5v1ë:«á©.ñËq´ìn©Ê„‘?Œ p&O›'o™Õ¶7™0zfÃ'‡Q³¦F÷YðLþ)ié4±<`¸ZDìÏ187;µ)»öõö‚e<=ò’ïüô½ãCJIÁRmÍnÓ¾Úõ!!ÃÜEQ ®áÙí)ë|/§,‰³‘rR,MŠ¥A¡óA¾&Cº"!x:ˆR°=hƒëG%N^pcoþˆn35ó´Š…¿Ñ3£˜NL£å©y#JÓ ÃeÀÈï ¥¡:ÃHü‹æ±ô+ð½,«éšššL™\eÉÕ)”%ÖS¹Êg±ý/յʴ„æíÍ95¢ÝŒŽÇãð>ãÍ]'–YÇÑ·OÙ>5…îÖÇ<éGøÏQÊœXòH%央#,´Î‹y…`]gÕV2Sn/|MV§Q-D«Xò¶©êRЮ'\êÝ–&Ôo®Ï:‘Ó “ÉW½ ‰ÉDéá¨ÊT8²,ô¤»ct[Y–1||G¢ÎV§…ÑÈœ\ùßÐÿz?L+L0­0¡ý¥v ŸÖ^㟌£çÕ˜L&ˆ¢ˆÎ¥uŠ qW,ýÒwWçò*gþ™Ôü‹_2Ö‘w=žÿwóãa2™`³Ù¿˜ù>v)»Ý¾èpTª –º}¡¸—›g©T ñx®ÍåÑrõnp45”ßóÓ|)Ò%½m½ ±?g:þñX\ËK#Ü?r«Ôå€ógÁF›n{¨£ rRÎúLÊs3iáùÔ²£ñx½¯ôbàÐ’7’êÝë\ ¢/%„χáÞêι?³Ù Ï3x÷yÑñrÜÛ܈Åb…ôwßE :^î@ûþvUFÿ8Zöù^Nžг‘rR(MŒ¤A¡0§o¸¥fRð¾à…÷9/’rÁ?xY,°¬² ôi¸¥žCáóa(Jæúú$›Õ–sÚÑ<Ì[ÿ¤RˆÅbpo[0¢´àXùÊ€ÑßçK#uF¡øÉÿB¿/ö}:LU™N© ÚçFò¯”2¿0}Œì©¯UV«Îz'†O #x6ˆæíÍY7}SÇGdt„*S_}…[»6æíwE„A€’RO<ëƒV˜«Í0U› ]‘`6›Õyåsw’É$Ó ­s“¯¡Öú´úp|h,Kî-îœQ¡mÓ¡ùÃä ‡Ì¥¸„P$¤»“~¡h)áEç>:‡Þ×{Ññ‹Ø¶¡ÿõþœ™BÛ¦ï`ÛÖÙJ·tƒ«ÎQ—ónOú{k­5–ե͹×M[©TúiùSmÑôåÊ?ù¦±9Ô…~·0Ž Œœk« ‰¯HÝL¡îáºE‡c±e0çÅÐÀö…ÂZnž¥ãâÏŸ³|Ëïùi¾é2?/‡NÁõ#¤I )¤´›F˜“¾¶ž)qû¹´0²…åpðø ìëíðìö 5“BèãF~7¢N}™g">à™ šw4ë¦9ÍߟÉdÒˆkD¸·¸1rz$÷ÝÙ¹i-C'‡´ÙK9ßËͳBq6RN ¥‰‘4(faÁåjœ¶+O-Oµ x6ˆþ7ûaªV¢éº8ñõÜðç¼y;æ¥äa¾úG\e¬ž_XJù}®ô/Vg‹±ü/öûbß§ŸNͤ`ZnÒ:7óŸ#.”¥”ù|çl±ýߎk•ý;ÂçÃkDu4½‚u±#“õKsµSÿ ÿö}}gFùF‚’Ì3­k‰Ÿ‘W‹HÊIˆ¢ÛC6m…Aÿ"å†zrÅ.Ä Š"‰DÑ9ÜV«U;¡Âã…>Ì·­P­†CNf¦™¤WIß½:5„¦M¨[W,$IÂÐñ¡²ÂáÚâR/.sϸ475C–åœ9žoÛtÇ"~%®=lh8jÔß~õ÷¯tåÂï¥IIkØÍŸú“®¼•›J晚CܱxL›fRéô˺ÈäÉ¿ù‚£G ~—ÞßÂx¤ÃiL˜ˆ«ï;²ÙlÚÈÐbÂQ‰2¸ð¥‘íóÅ}1y–Þ‡÷9oÞiZ…ò{~šW:]tå|Kµ—'¿Túyt;ÍOùu¾¼óQ§ÖhvlpÀ\ßœˆM 8¦6ˆ6:–뜊48eïåäY±8+'FÒ¤P ³ÅbQëÅE<Ùj±XtÓŒ¢‘¨VÏK“R7Sè³_÷›þ7ûáÞêÎÿ©ÁFc:ý×9¯ ÅÊ€ÑßçKÿbuF±ø§oºåËÿb¿O&“EÓWLOOká–¯©Ï|É?£e¾Pù,´ÿÛu­ œÀú Ó‰iDcÑ»ºÎ¤»Ãwõë*u¸yêï_!þÉ0’_ΛBñÉpî¿—4B¶‡ÔN‰ôµ„ÄÕD楜‚ó*3“ Þ¡¨ÊTB¶‡ówdR7R¾”ÔU¾ÒwŪômY–‹nkZa‚µÖª® 67l9ɾ ]¥N#IÝP‡u„#ëÎO"ѳ£Ú”sµYÛ6}w$½âQÁm-´<Ý‚=ÏîQìpå½`>`AÓÏšÐÑÞ¡¥OúXé‘ †'Ð} ©T ò72ú^ïÓ~_÷PÌf3|ïø´»Y}¯ôéó§™,&ýæc¾‘¹\ùg[ol´jþp}ä|ŽõŽœñÐîJ­·#v!†x<ÇGE±Ø2¸0Šm_,î‹É³ô´†àÇAmå|>¬îÿF ‘HD?µ@þ)?…Ò§Øþoǵ*|>Œd2‰æŸ5£i{Bc¡‚ G-nD&Gg&=2#˜Õ©ZŸ}t.ï$Kµ¹âK/§++çf'Bã!Ä/Çuw¬«­ˆÇã¨k`ªRWrnv}P2|>Œ‘Ó#ÀŒúð]º²X,°¯·«+àT©wzòm MÛ›8@ÿ¡~˜Ìj¥œ¶µX,pmqaäÌÜoÍØívuÕµ"áH_TÒï²À Ð÷J~þäϵs7òÁˆv¥å©ÔÕÕUÀW_å݆üCèúUœ.'’×’ªxžöä|Nfá{eN¼¿èÀÚ﯅rS}ˆÑ³Û£­Z2ôþZwµbåÊ•¨Y]ï3ÞÌóËÃ'°÷ù½è{­Öuêªf‘ÏÕ Gü²~ˆ{1é·0[ŸÎý`Óö&ÿÔî¨ÙÖÛÔù¿Xk­êC²7S°Ù2¿[­C¾Á†Ðù,«,YŽÅ„c1epa:u¼ÜQ4Í Å}±e¾ùgÍýxTíì*ê;-ìv;¬Z þ6Wš/öÜ,ıÁÐXH÷ìb-³Fe¥Ér ù©f„ÆBjchîMÛ3wcƒgƒ@´ÔÒ:tdíOQNÔ›G3j^ÙÖÛÔiR黽‘‚g‚™ï œ'FÊjÉyf Î…ÊI±4)–FÂìÚâÂèÙQô¿®žûÖ­pÿ8ó\Rïk½ºã¦ÿ~ω|S}î1u3“Ù÷ÖyÓkçF¡´ÎòMaîZ­.‡¬Ü,ž‡ÅŽß¸­¡ñ†ôªcé0*F~_(ý‹ÖEâ_4ÿ ü¾Ø÷?jÄèGÕº}î=2óG$ 埑òS,} í)®UºwpI „#auq‡¹gŸœ›œ äŽGËÌÎÎÎjw8ÊîZ̨ϜüÛ÷×Âþ³çûÝüåOŸÁ²Ê AÐw„*µs“þo)”¾C]ð¼Ø[pxY’Ô—†™-fXW[¡Ì(Z…#T ˜þf®—±¡ºëø¨Ë#ßëkÙ[âÁ4/Ì÷– e½¯ê^L“»}DÄsØ‘)Ø™€¿„?ƒX#ê¦+-–ÑŽ  ­Æ/Ç!MJÚ*fæfXk­°=d+ým¿DD%š¸¤ÎIïx©ƒ‰ADDTAU•ÞÛüifB•PÖ¨K¥˜V˜àØä€c£ûCú‰¹Üî·ÏÔåÇ«LhÞÖ̼"""ª°ÊŽÈ¤ÍÉ›I`F]¹¢’ÏÂ(3 |oöÂóBWI+ŸÑ·Çw–d¯sK3 f³¶üq%¥ßúJDDDDDìÈT¼3#TaI¦•Õov!t6éË æ Ñ}hi¦–-¡ôZéÒ•8b‘°ú’DoØ&"""""vdîhGF¨63爈ˆˆˆîcU÷Z€…*P8CDDDDt?û“€ˆˆˆˆˆî5Y#2ë """"¢{®#Ã版ˆˆˆènÇ©eDDDDDÄŽ ÑRËšZû4ÈT!""""¢{«#c®µ3Uˆˆˆˆˆè®Æ©eDDDDDÄŽ ;2DDDDDDìÈ;2DDDDDDìȱ#CDDDDDìȱ#CDDDDDÄŽ ±#CDDDDDÄŽ ;2DDDDDÄŽ ;2DDDDDDìÈ;2DDDDDDìȱ#CDDDDDÄŽ ±#CDDDDDÄŽ ;2DDDDDtvdûÁcØÓ¶GûÛèØˆFw£öïÇ~ðhßùÞñÜ_ó“Í…Ê øž¶=ØøïñC×±§mîóÇœe}¶Ñ±8Ȼϻvb£ccÖoÝYŸ¡¹©;wíÄž¶=عkgV¼¦U9ÞÐÂþm2|rñKqž½K”KY&™K›ÖåÖ©ùêª{1­s]ù6*'=*Y§,õuhaüò…}1çšÑcÜî6Û ·¿î¾ÛKYçÝ í’:2æj3ŽÕþÀ½Í­ýÛ\mí»b¬«­0U›Ê øÑÁ£h{º Š¢ çÕísÏ3´<Õ¢ ÃÑÁ£0›Õ°ùùsî/‰ ~9žþ£ƒGáÞæ.)^iÝ¿êFÝÃu8ñþ <ŠïŸÈŠw©û,Eû‹íZØ¿M ô)*K•KY&™K›ÖåÖ©ùêª{1­s]ù6*'=*Y§,õuhaüò…}1çšÑcÜî6Û ·¿î¾ÛKYçÝ íªR6ö<ãYÔ÷ õ¿Ñ¿¨À{Ÿó"8D÷n5±gÔŽÊá·gm+šv4!p*€àÙ Ü[õ'îÐñ!4ý¤ ß*–¸ÊM5bMÅãMDTÉ:5_]u?¥Ëã·ÔǨtŠˆu^‰™¦íM¥}?øÞö!‰ q-Þî^Ôo® WÅ.ÆÐöL¼ÏyñKqô½ÖTò5®-.´¿Ø^0ô]¿ìÂ^ï^u¤eF ƒ ù;>g‚ð¿ç×udb±ÄæÌKØô4´à™ bbZÏ6W¼s ž bøø0A€|SFó¶f´<ÝRô¸þc~N ®a]m…°B(ºEQÐòtKVç®XJͯtÜ[žnfÔt_X.Š…-_ºæÇá{Û‡äÍ$0¤fRð>ã…k‹++LÊ ‰é¤I M;šàÙí1¼á4+ÝñžR8€¢(øKô/†ËY)ùœWó·X/¬«­¹¯³‹H_£eÓèuh¾\uÆÞ}{a]cEûþv-lñËq¸žp¡çÕž¬øº>¨×ŒœW¥^ƒ–ª u·´ò•?¡J@÷n]Úùû8Àôô´îzVn]a$ Œ\ Œæ§‘º'ßuÛH^UªÞ/µmfhûÊâ²²˜sÛH\…%ahxÞ¼Øóìô¿Ù‘Í#Zæ/œ“ÙÑÙçf':÷w¢û•n .Ü‘P__†5àÈ;GPÿH}Á;f³mÏ´áÈÛGt£2þc~t¾Ü‰À™ÊƤãçÞæÖ]PsÅ;Wºõ½Ö‡?øbˆäÍ$šŸlª $9+3A ¾7¨þnµˆÄt"ç\÷Ðx}=}ÚvÒ¤„Ÿ?ùsÕ\›]†ÃPj~¥ã>ÆÐðAÀž6}¹(¶|éšOìb 6› Þ¼Úɶÿûñ¡õCX×YµýN´¸&®&ðó'q•¨ ûÛÆhš ÏütŠÅbZãwøäpIåÌh>—{þI׺~¨};!µIZã½Ür^Jæ+kGbà͘Wen^´h‡ô¬TpZU¾2_è|/õ8å¦K®ºÅÈ9—/ìFÊO¡²ª{|îØ/ Øóìtü¢žÝ~ë0b±öxö aK\ ®’ÎÙ\e>W”BéTnY,TOúÎH¸#ç#Øß¹~ð!¬µêñú^éC,ƒu‡5gz,&}”M£×¡¬òûîQ<öƒÇÐóŠÚPU‘Ï#®HZc§ÿõ~tìÒ³ ãgäúP¨^3r^•z Zª6ÔÝÐN(Tþšv4e¥çi”› ßÌ]O•XWI#×£ùi¤îÉU g%ëýRÛfF¶/Z µÛqn©“—tÕ2Ç&‡6:b[oÃäÕÉ‚Û'“I$¤0ôìÉy:—ö}íÀ  Ì(ŇvŸö ¦¦þ÷üÚÝ)Kµâjñ®&<6÷ÜkÔ0™«Íp7¸1rj¤àï†O£þñz-.bç£ÎœûŸ¿µÖІ't•‹‘0”›_…Ê…‘°•¢å©]c:Ýy\ˆè¶s=áÒâ*®Qÿx}Vç¡Ø6FÒÌhxÀn·«å{»á´-5ŸËͧbñõ×#x&¨»€6lmXt9/% ÅÁõ¸K¾‘S#hÚÑTñ:ªÔã”›.•¬‹K-?…ÊêücÛ×Û‘¼–Ôò̾^ý4)••¿•>JM'#a-Tf }g$ܾ÷|hx¢AkD¦o*_‹I_#eÓèuh!¡Z€ía"5áóa4<Ñ€ééiÄãêó«Á± Öˆ½çÂRìZy§Û å”?£ñ5RW”’·+ßsÕ…FÂYÉz¿Ô딑íÓn[̹m$ß–tD&ý€=U0SxûþÿîGWgš[šÑñbêëë gøÔ0žhÀø'㇠WtU€÷/º;» !x6ï>ï]UyÅ/Ç!_“u«¤É7墵ø•xVšåš÷¿Gý&ývÖ5VŒ2^RÊÍ/]¹ôåÂHØJ¡ÜTà{LJX,¦›r(ß” ¦S®cÛÆHš Oúä_l9ZLZ:ÄýÅî_u£ý@;„*Ó>rxÑå¼”4,TÖìv;¦¯NCº"ÁZkEðlCÃC¯£J=N¹éRî9W‰òS¨¬Î?vúŠ£}6÷oE)ï©ôyPj: k¡2Sè;£õôÂm*U'–[6^‡r©¯¯Gè|M;š0>>ïó^Ä¿ˆ#ô÷“±½ IDATI6› ¡ñú__Üó¥¶Kî¤Ba½[Ú ¥–?£ñ5RW”’åÔåÈU:o*Xï—z2²}±²X¬¬”{nÉ·ª»é¤­¯¯Ç‰N ûånìõîEËÓ-E§–Åãq$ ô¿Ñ»vbàÍuس@ÌÜ[Ý>9Œ7`{ئ»›p·pouëîšÝa('¿n·½/í…œ”148¤U0—¬+–f·;êÄðña(ŠéªÚñw5¸¡õ©ÖìÆî}î~®'îµ40ÎJÅ¥ÔzåvÔCKynßu/ÄW‰8:xT½ðŸ*þÌÊÀ›è:Ðèüe'¦¯Nç}ž`¾öÛ1==õ°v)ºt/IزA’$Ýg± 1ìy¶ð{llël¾Öÿn:1{ÿ ¶“¾–`{ÈVrJÍ/Cq/¶RÄ.ÆàÜìÌÜ%És±^˜NÒ×lël%mc$ÍŒ†§b娂iYjº Uêô²Àé§hÝÑZ‘r^É4tmV§} ŸFÓSMKRG•zœrÓå^*?·+ï†ó X™É÷ázzÁ6¾w|ßù°˜ô5R6^‡rIOò½ãÓî »žpaòÊ$†Žz¶ï~q×´Š•¿*ý´ÿd2yÇÓànÌ«JÇ¥ÔëÔbÚrFÊÊRžÛwUGf£c#ú^éSUuÈæâ?æGËŽ­g³Ùд£ ¾÷æVd)TaÚíøKô/°ÙÊ¿˜E/F—$Úv·aüÓqmî fÔÌ/ôÀ Î}Ž|Aâj˜N üi8çþço']•0þÉ8Úv·•†RóËhÜ‹…Íl6CQ(7ltl,Øq­­­UW™»XÇ‚9· Fbz.Ý®&ù4’•ÞŶ1’fFÃSŠ|éa$-Ëe4î­nÄþÃÄå Ø7Ù+RÎ+™†ÎÍN$¯%QSSq•¸¨:ªP¹,å8å¦ËRÔCKU~›¿¥Ôwú<(Tf }g$ÜÞg¼ˆ|ÑžHÞL"x6ˆ¦mMK’¾FʦÑëPNU€ý;†Ãõ„Ú°±o²C¨0x| [Ê®+)ß1v¶ìDhûÓg%¥O®´Éµ]pL]&ÚRm2£ i[“¡èæ/«(®a¶˜1|rö vtèÔVÒ1´ür‘0”’_FË…‘°NàÏ¡Z€¥Ú‚þ7úóIJW$t¿Ò ùš k­6› ƒÇQSSƒ£ƒG!ÖˆØè؈¶ÝêËU%Iʹ´²‘mŒ¤™‘ð:·r)”å,¿l$ŸŒÄ#]?öƒÇÐöL[ÎÑÏrÊy9i˜¯¬@sS3º~Ý¥Ý1*¤P™/V.s'_^—“.¹öUn]¬åÁe‹+y0’¿ùÒ:oz–Bå¥Ô²X¨Ì«CK^þvF÷oÖk*•¾F˦ÑëP.Ã'‡1t|£ÁQí³îƒÝ®HÚjP…ʟѲa4K9FsS3¼Ïé—ß^ª6ÔÝÒN(Tþõeã½=½°˜-°®³Â¼bÞ±vÂZk]T=U, Œì»”6E©uO)׺JÕû¥¶Í m_©vÛbÏíBçkÙ¢o‹ŽEßëcdºÍ{žÝ³ôo/¾]Ç!""ºT1 ˆè~ä{ÛÇ£Ž¢/©»WŽCDDt¿ù“€îgóßÔ;ÙÃR·¡{OðlCdžàÚêúV‡ˆˆè~éeDDDDDtÏሠ±#CDDDDDÄŽ ;2DDDDDÄŽ ;2DDDDDDìÈ;2DDDDDDìȱ#CDDDDDìȱ#CDDDDDÄŽ ±#CDDDDDÄŽ ;2DDDDDÄŽ ;2DDDDDDìȱ#CDDDDDìȱ#CDDDDD”Ï2³³³³e°råJ¦ ÝÕ8"CDDDDD÷œª…ÌÎÎ2Uˆˆˆˆˆè®Æ"""""bG†ˆˆˆˆˆˆ""""""vdˆˆˆˆˆˆ""""""vdˆˆˆˆˆˆØ‘!"""""vdˆˆˆˆˆˆØ‘!"""""bG†ˆˆˆˆˆØ‘!"""""bG†ˆˆˆˆˆˆ"""""bG†ˆˆˆˆˆˆ""""""vdˆˆˆˆˆè~Vu'î·ù‘¸œÐþ->$Â÷hÿÝ5Šøé8L«LðJ^ísiLBô­(¦/NC¨ ÜTP³¡Ž}X·Xµíz—÷B\'jÿNKXj-yRFGª#¦õ~$¾HÀûw/,Z †9½ùš %©@\'ÂþœŽ}Ýöò¤ EQrÆ&NM r0’3|Zد$Ðu«ëž(TÞç½<>ˆ£¾£hÝÕzW„iÙ2 ³[ýÿ¾`v¶´ß {½€÷ ÷•âÛ‡Ï{_Pàð€ssåÂCDDDt¿»£#2ž¸Ö'2÷ [÷}ãû°¬¶À;‘éÄ„†1ôCHN'Ñmƒ'îA[´ É«I ýÇÂÃYÇHÿi¦ bæ³y]99.#ñ…Ú™ˆ½Ëæ…ûéø¦®_»¸œ@𿂈‰ê¶7ˆ9ŸV·£.oø†ý^0xlÊMÃ'‡ïù$•·áOdÒØo_?tý¯ªšþWÕ'¾f…CDDDtOvd¤/%tÐ*ØŸ·kÿ=Õo?.¡¦¾0Íý{LB¨'¤vzޏaz@ýÂô€ î#j'(Ô‚4&œ/:‹†ÉñBfô$v<¦Ë-ãq›¬ø™xÅÓÎÕíºg UO_ìØÑþRû=‚( Ðþà;bü7oÖZÀµe.ﶨÿxÓØï»tAúRbíDDDDt';2©)øßõÃYïÄÚï¯Eø‚~ĤîguV jàTHe¾›8>º§ê2‹·ÔŽŽ` nuûëEfA·ëõâ׫™mâ§âpþRí(×LünÂx<•LÀ…*¡bé׿¢_í(Ìß)³Z­X¶l–-[«53ÂÕº«Ë–/ƒõÁÌg¡ñœ›׈E»CÃC™ü°ÕiûrÖ;áyÖqˆeË–©yŸ@ã¶FX°h¿¯[_§M!«³Õaû~ÄþC×A}§5z!ŠÆmEu¶:ˆkDxžõ ‘Hd»ÎV‡Æ­ê¶&“ Û!ËrE˦îNñš?å«u`Z8ëÕ[,€«¡´ýÇ€úMúÏìvõs#ÂÂXûýµpÖ;á×Ôk*"""¢ÛÕ‘ ‡Ðº«+¿·½‡záÞæÆÔ?¦ é7\8žVGE”¤‚‰Ós‡0™Ô=ó"}®Þ¥^øüHZúóôv¥HD¨y¸õ/ÔkŸÅŽÄŒýøùUDíÄT ppÞÖLœ˜˜€ ¨§Žý™ç}Fmm­vw?4Â]?Dìb ÀÄÄâWâØÙºSëÌLÄ3·Èçxv{ýŸÌHYãOüCf³‰DÑX'O`øøpÖïuóHüC£¿ÅD|]¿ìÂà{ƒpü»ò7²î·ñ+q}÷(Î…ÎAQÿD_OŸö½s³³èß|³³ê³-½¯džGù,¬>ÃÒÿzf»£>À¶GÊÏi°¬Ò&Ö¨Ÿ v0õ)¸·ºÑûZ/V~o%Zwµ"4bEDDDd¤##ËrÁ¿\wŠ»vÁjµ¢ÑÝ¡JÀ¹ÎiSÊÄ5bÎãØŸËL/‹S;˜€m«M·’T˜G¾aÁv%ˆÂÑæ€I4iÏíHŸH¥ü£‰‹ ø×ûÑ¿²á·Ã°¬³ ùƒfˆõâ¢2%½_ÿz?0S|{“É÷6ujÿ=¿ö¹ï=]º€ ¶¶ŽMjǵi{“ºÏ«Óx[|ÛC6ˆkÔ‘-b™Uø|¸è_ñtÜÛÿ±ÌgƒÇ–§wR)7Õ’®h êçF‰kDtì‚$I8÷Ñ9UݰZ­Y#]DDDDìÈ,°råÊ‚ß]ùݬßôõôaòê$zúzpø7‡³îŒçbyÐëãs‡%¤)ÄßÃö”¾#“ž:†|ýeÁvFݦǧaý±ûÓó:Vïå•7ˆð\ò ãzÜ>7ä+2†ÜC¿^T¦¤÷ë¹ä1¼®\ËS-jx/Æ´¿ÿ˜žÝ™ŽLìÏj\â_ÄQ·¾uëë˜NÀ¼ÊŒÄµDÖ>­«­YŸ8 ¡ZMßÁcƒø‰û'Xù½•ðú †/ò¹:Ä!Öd:y¢˜ùÿpDŸfæjsvö*JÅO€–ÀðIõ¡~µ#xv/nŸBµúl>ìêçåpnvâðo£§¯“W'u#SDDDD÷«‚Íäëÿ¼^ò¯§¦¦à?æ‡ïº;»Ñ´½ žgú_ïGãÖFCáX¶l’É$\[\Ò¦¦¥§œåSÿ¨úìQb:“oé‡üÀY_ZǯSËýô2ß;€÷¹ÅŸTî-@ä‚þ³ÈõsCkIB×Au*fãO!Î…æMÑEÖ\DDDÄŽÌRîÜYï„Ðëÿ¼Žþ¾~„χ±víÚ<-ÊÌCÿ²¦•€u«U[U,ø|©oÔù@©oRî P—)ž¿@@Q) KBܬo:ž™·,ó»Åú—NKÚ;hruÂòþîc „ß.Þ0OO/Sn*Ö:6i:ÉkIŒœR;Pò72|ïøJZ*yàMõy–Ôä¤: ÖðD᥽z_íª€ÉÉIm4(p:@}§ýÅ;·TsËSÀøÇ@,Vú eàØŒœÎü»ýEõÁþÐÜ*e¡1õßí/ÛßÚµk>F_?®ÿó:üƒþ’;zDDDDßvËÌÎÎÎjKÛæe©$I’tKÏ'Çeøê|á¹úŒtVBô­(¦/NC0«Ó©j6ÔÀ±Ï‘·ã·ù‘¸¬v4A€¥ÖOÜŸÕ‡ÔµlÛmh|¿1çö >¤¾¤2×~”¤‚ÔÍ,ë,°í°Á¹ß©MEó‰>È×dm”ÆR£OßÔÍÜ>7Æ1yznÊ\`Y¥ßN¾&£ëV‘‡¼o–³ y-‰çŸ{¾#ÙSåFÏŒ¢ïÕ>Ä.Æ`­µÂ¼ÊŒö}íhÞÑ @]9~9®ÅÏZkÕ­&Öüd³ö NòZ‚ À½Õþÿî‡åKÁßG/DÑýJ7¢ŽÂb¶@¾)«+sýºW[’yþoS©TÎÏ*-•V~èé:^ÎÝQ€ØŸš@\ Dç¸ÔÙ€žW€æó:žç½/Í=䯇ßÐ/ó\î9BDDDDw¨#CDDDDD´Xßa;2DDDDDDìȱ#CDDDDDìȱ#CDDDDDTPÕ½ø|ïtAPÛP Ç‹ˆvõE—§&9ÉÚ~¾Ä•„î]-Ñ#QÄÞ‰3€2£3@͆ØvØP×R—žÄùÂo„1ýù4`V °n±Âþ´&«I ·<)CQê;j”¤‚T2ËCØŸ³Ãñ¬CÏ…Û{âž¼ßÉÓ2 â£"\¯¸ nÑ»¼âºÌK?s¥ƒ<)£#ÕQðxiÒØ¼wùT~—Ïü|7ˆð„=€Iÿ}:L¹ŽU çf'"ŸFP[[‹‰¿NÀ´Â¤û"ŸGPÿh=Âçõ/9=ß[>5¯çxŸó¢µ¥5ïñú_ïÇþ_ìÇßþú7Ô­¯Ë»]9ûžniRÂôÕiÔ?®·¸FÔ> }—J¥Ðý«n„ÆBZþ@ýæzôþºW[fýv§W!ÅÒrèý!øû`úÚ40£Ï»Ï[p¿áóaì}i/A€¢(8üÆa-nÅŒœï]ŸZ( E}“­OµÂÕàº+êA£y}7H—·ÎîNô¾Ò[ÒïæŸ@&?z^éAóöf^ÍK=ßÞèGä|#§Gx-åµ”èž6;;;;{ýúõÙëׯÏÞkzÐ3ÛƒžÙžÐ>ûê÷_ÍÍöTõÌþíÿü­èöÚwU=ÚÿöߟÍö gvꦴϮÿõúìášÃ³'~”ýÛôö‡×ž½þ÷L:~TÃrî…sºíOW|ÞòtˬíaÛì¿þï¿2éÛ×3 `öoýÛK¯B ¥å¿þï¿fÌžûè\VÜ{úò—›©LÍ Õ‚ö»s›ª…Ù©L OûþöÙúÇëg¯ÿóº.gÍ«ÌwMXJ^ß Ìvvw–ü»\eý¨ÿè]Ï»]ýãõ³'þÏ ^Ky-%º§Ý3Sˤ/%tè2´­u›ÎýN`xH}mìmð®îÌÖØÛ1ÕÄM™;/–õÔw×gß=O ô‹ éÝ&XÌܲn ‹‘»Žó¶‹ŸŒ—ŸXË×ÏÅeˆ¾…óÅâap¼à(žcB=j\ÝGÜ0= Þ2=`‚ûˆê A“òî#þ»8B/‡ E¥ë@¤/¥’¢/T hÛ݆À©|G|E·…Ðw¨#ˆb&¿EQÄÈ#x{£gG³~EQSSƒúÇëÕ‘‚[•Û÷bNд­I7ÂÒµ¿ ‚ ܱô*ÄHZÚ¶Áµ%s޶¿Ø®Þ…|ÏŸw¿oÀZkÕ~çÚ₵֊7ŠÆÑ÷¶#ŒÀò@æ|6­0áÄà‰œéx§”’×ß6-Oµ‚gƒ¼%YÂuSþFFäóÜÛܼ–òZJtO»«;2©)øßõÃYïÄÚï¯EøBØðo­Û­Zå;+<ľ¢_­üf*(ùª 如ðÁ0pc^õ¼­cú©3á7ÂZƒPl³+ÕWœp½U|Jj&¥k\.†euæü: ×ëÅïzµø6Ñ·¢jøÌú ˆõ"³ ÛNSØŸ±gÒìPƒE¾ÆÚ﯅³Þ ÿ»~¤n»úë‡ý;öþ×^Dcтۼ5€†'tr-NkD4<Ñ€#oÉ>Æ1?¼Ïzá}Æ‹äµ$F~7R±}/– ÙçËruR®i[·#½ æW‘´4­0aâ’¾¼UÅÏ‘àXõ›ô &»ÝŽàX°h]O¸rÆÑò€‰¯ºÏ†Þ‚Ãî€s³»CÃCú:`³Ë–-CÇËðîó±ÉQ1zFßáÖï§ÿõþŠæu±ýGcQ4nm„³^ý¾n}FNäŽËKj\L+LX¶l™öýÈ©‘Ì169ÐüdsvjFmXåKÃfæÊ‡`*)žáH»ŽMX­Vt¼Ô‘7ϳµãkµ¢÷Õìip•Èó|áXLy0rÝ œ  áñCÓy-½¿¯¥DìÈ”!4Bë®V¬üÞJôê…{›Sÿ˜Bh,dxº9¬¥W^ss]C=!ô®ìÅPï†!_’³ï¬|®^¤-ë1ýùUD«x/;•†ò•L8ÍVsåîð¥ãZk)˜néíækô5ÂúDfÎoà?Hœ/œ7¡±¦þ1÷V7z_ëÅÊï­Dë®V„ÆCEï¤Fa6›ÑüdsÁJ;üyŽõùï Ùl6„ÿÎʯàÙ šÖŒ¦Mª Vfßà}Á‹ñÇájpaäôR©ÔM¯"eßHZ.ù\=_¼ÏåFFš”`Y¥/«bi²ðÉðçaØl6CÁ9=‚=ÿ¹#Œ |>Œ‘F°Ç³Gß`{¾häôúûú½…uû_Þ¯m3zf{½{1úûQ„χq.toÀ÷–¯"ymdÿ‘óØÖÛŽ„Eѹ¿?òçºNd:.¡ó!øÞò¡mw›î;wíĉáŸ#z! ³ÙœÕq œ ó—ˆ^ˆÂöM—¥xsæUf4íh*)ž­-­¨ß\è…(\ .m„.7ÿ1?º~Ù…ÐX¡BèëéÃÐûCÏó|á(§<”rÝ ž áµ”×R"vdJÔu° V«îFUÎ}tN׈¥ílEæÓ¿Î—¸˜€½þõ~í®Þ| Ý º»~Ò'B!øþ·#ÛF€ym%9·ÿ2oüøô¡ÿõ#üvÖ[áýÊ ±^,?!oÁ}Aín­‘¡p£ŠÆUX°Ý‚ÆrS )s‘š†~:Y’ _H׈è:ØI’pî£sª4ºaµZÑu°«àïF>Áä•IìôìÌ»]2™,x×Îb¶ ™Lê¯{«X˜L&´<Õ‚àƒH$‹Þw%ô¾Ò‹£þ£ˆ_‰ãçM?ÇÊ•+ÑÚÒZpjÁR¦WÁŽ€Á´ÌŠã«½pÿØŽ—;ò—×›JÖ+ArÖ ¥ÄQט~}îmnXTÖ­pos£ïÕ¾¬mÝ[ÜÚ0g½ñ+™i/}¯ö¡i{“V×Y,4mo‚ï_EòÚÈþ½û¼º»þ­O©wÌs`Õ׫#]¾·|P}QáÞæF-3ä×ïóúÎfCCƒ–ŽM]:ãÜì„³Þ ‹Å‚Ðù&þ:¡93Ïd2‰x<Üüƒ~-üiMÛ›`µêósàíŠçy¡p-¥^7S©‚ _ ×ÒûþZJÄŽŒA}=}˜¼:‰ž¾þñ•…òU@Z}`ή)Ä "<—<ð\òä\»­®­ž¨öçìYwLâˆ#üZ8{ÿJyAõ~é…m‡z÷Wú£Ttø¾ÿz?|u>$/'aû‰ ­j…e}åV-*W%š€ÉbBK°Eû^I*v#%ævnvâðo£§¯“W'Ñ×ÓWp{Wƒ ‡þûPÁç?ÌfsÁ†­œ”a6ëïÄ ¿? ï3™Æ™g·G»“»Ø}çL÷ªÒ¯ìž6_'ðÙŸ>SŸ9@£’$ÝöôrnvêþÊIË…7“`‡ §[µ ­¤QE)ÚI)Çùbc°­ÓÞØÖÙ»˜}ÏA×ð‹]Œ!8Ô¥Óøø¸nšÌbòÚÈþeYFÇKplR§39]μ X‹Ùb(-rvv ¤C1áóa„#aþÍaŒ<žuGÙHAìb Žwä±W‹Yùÿ"^ñ‡Æ…󥑄6 žÞ.o^oö½”^ IDATÑôÛÌÅTúXÊyWV’$tT§H4þ´‚ à\hÞÔ ÑØÅåÄû'`[gCó“ÍYÇiß׎ñOÆsNeJ|Àø'ãºw• ŸFg·:¿þ_gw'&¯Lêê¥î;ïEon ‹tEÊJëºì ]úå…s£*™^…”’–à;âÃøø8F>–Ï«¯æ‰{‹‘ Ýg‘ ¸·~> }_;BŸ„rÆqôì(L+LÚsDö ö¬©Qñ+qØ7ØK:·ììY§Ðx¨èûjŒæµ‘ý2÷Vwæ!ð[(= Ò¢ë`×’M[é=Ø‹É+“ºÑ £é(®>†ûÇnøÞÖ>&®&²òÓö°­`<ËÉóBá0¯›3ê*w¼–òZZε”ˆ£wëðúqýŸ×Ñß×ðù0Ö®]k¬â=#!|Hm5ý¶ ¦5&C¿ ¿=¯Ñ4ÿ3¨«€'NOhºó…LCAlµ%ƒÏuóT£oE‘ø4¡[Ž2oœ_pj+¤DÞŽÜ•ùbÝjÕ.ÁçƒH}£¦Oê›”6—ØÕíÊz‘W.umuE—Ó\»v-ÂçÃèïëÇõ^‡P]§T¦ê4¤ééi$o&³îŠvîïDsS³®ášH$Ðüd3:Ù©k<øûáy:ûEcžÝêÔ ß{¾²÷·Aþ#7Ìf³nž¾ô¥„àƒÚ´ œü¬ · †æÆW2½ )%-ýƒ~øÞö¡ó@'¢3žùÏ 869t£í/¶Cš”´†nh,iRÒ–nÎ{Ww‹ íûÛÑÚÒªKCéK {Ÿß‹Ã‡µçÚ_nGðLP»S.})!x&ˆÎ%•ÑÎü!»¥vŒt 䵑ýÛ²©wóç:0C§†JŽCðLqµ®”eC'‡ræqE®›¨´o ”ÏeË–Áó¬¦Zk-jV×èö j+Ó¥ó³ý…L™©Tž G9塨u3 C¨àØä0>^Ky-%ºÛ-ƒú‚1ȲZaÜMoÎuGaþ¼Þœo#ž›Ë]³¹ÎÚpðÄûÿŸú¦Þ¹ tájFò5Y{qøõ0瘾<­>œTRR°>j…ó€3焺·W«ŸÕ££(ðìöd=(¿Ñ¼6²ÿ‰KØÙ¶‰élÙà°;0ph5«k G!®³â’UfN ïÕ>íù¤žƒ=hÜÖXR:ä*+ù¶=3ŠŸüô'¨¼£QX°§wŸÓXW[¡( ޾{TkÜ/[¶ íûÛ‘RRˆÇãˆ_ŽÃûœ7ë},•ÈóBá(·<ºnv¼ÜÔÍTÖóo¼–òZJÄŽ ѽ~Q\¶ Ýè}¥÷[7ëƒVøøu/–%"º—U1 ˆˆˆ¾ýøfw"ú¶ù“€ˆˆÚ”Cÿ1ÿâ–ÿ'"¢Û‚SˈˆˆˆˆèžÃ"""""bG†ˆˆˆˆˆˆ"""""¢îéUËr®}ŸT€* ¶¡ŽÚšó§&9ÉÚ~¾Ä•„¶ö}¾5åÓäI©Ž¢ëÒ§'ná {“>ü´uá ­gï‰{л¼âºL8rÅÅH¸Ò¤±yë×W[¿¾Ô¸@ôH±wbÀ ÔwŽÌ5j`ÛaC]KÏB""""*Ù=ÿ°ï2u­ë£V´FÔ—‘Ig$Œ<9eFA“¿ u»ê n¯}·¼WëÈÀPý¤ÏÕå*¾\ªE?:ntÝ.}<°ý̆æÓÙ/ \xÜ|û\¸]®¸ Wø`¡žÄGD´[`zÀ„Ô7) ÿÇ0Õ·';_q.:.á×Ãý"Ïÿx´ªÉ—d ÿÇ0Ì›Ñ:ÖʳˆˆˆˆJvÏL-“¾”²Þ¬œu›ÎýN`xH}2ô;W·ñ—„9YúÒœñßÅz9Tv8_,~LÇ Žâi9&!Ô£†Ã}Ä ÓêЊéÜGÜ€POÒ˜´è¸ÄÞŽA¨´N XÖ[Pß]Ÿsû®]|×ÝÛ™Ôüïúá¬wbí÷×"|!lø·ÖísS£f€Ø±XÁmûWô«…ƒÆ:'½Ë{á<`°#SØŸ±kÿ  cbp¢¬ôp½^¼£åzµø6Ñ·¢Á¬ï`€X/B0 ºíùª 如ðÁ0pc^‡ëyGÎјð…0Ö~-œõNøßõ#u#ų”ˆˆˆˆîŽLh<„Ö]­Xù½•è=Ô ÷67¦þ1…ИñÑ Ý³$w4>¾FXŸÈ#”–þ<½Ýbâ’ÞW¨'„Þ•½jBøÕ0äKrî¼ aêSpou£÷µ^¬üÞJ´îjEh<ij•ˆˆˆˆ–¶##ËrÁ¿|wÙ»vÁjµ¢ÑÝ¡JÀ¹ÎiSÊÄ5biX‘ù_妒õuâbþõ~ø×û™â»Koë_ï/=A–M&XÖÍuf€¡ŸA–ä;’éJr.=„< ¶[D\º2ÿ˜¤O$„:CðýoF¶9Š‚¸FD×Á.H’„sƒP% ÑݫՊ®ƒ]L^DO_ÿæ0œ›åbÞ4¦ôT)]cyƒÏ%<—<†ÖnKoë¹ä)+8&‹ -Á-,JRÁ°{)ùöOÒÒCÉ×ÓÉŸn¥Æ¥®­ž¨öçìY#@ñ?Ä~­ðtAçf'ÿæ0zúz0yu}=}ÿƒý¡ñZ[Ô)†¾w|èùu¦¦¦xÖÑÒtd,X ÿåYâYEmÕªs¡s?mÔM52J:=·mt çBB/-ýsâfM¿mÊ„ócÉÐÔ¶JrìSW6S’JÖóC‰HB›R–Þn1qé]Þ«©±Œµk×ëÄœ‘>¤NYjúmLkL†~~;|[âV×V§.}‡X·Zµå£ƒÏ‘úFíh¤¾I!¸/@]ŠzáK1ËŠË üÏ ®33qzBëd:_ÐÿvíÚµŸ£¿¯×ÿyþAuÕ:"úÿÙ;ÿØ&®tïs¤ñ*¼²T ¤L¶à ûÒ+<^a¿ËªØ¥Z’—Ju.\5VwÕ¤pÕ&´*˜¬Š“VmÒ¾bªr1h[•ZV…¦+Ø8U³LªrqвMª¶b"ŠìˆVq´ Øj#÷‰Çžø×8? ç#Y‰gžóûñ™óÌyÎ9AAd²¨Ä”e‚\gž6Ÿ:Ý>µ°ß¼Å ñ%QÝ^xèƒ!ô½Ú‡øh\D›–kËÿ)®º…,!ÄGâH&•øøµJ<™'Öç“Kɤò—/l×Î. ÿi€öÀÊBq*{¦Œž8äÏdDŽF0z}œ‘Cò^æ fØ÷Ù³Œ˜™–Ez[B¬?†ÑoFÁq’ãI$’ ›ˆDð¾`AAÄ¢7d‚ ‚ ‚ €~ &AAA2AAA!CAAA† AAA2AAA!CAA±(” ëAzWÂè—£€àÀ[ÎAØ&À¶Ûƒ =HS¾œqîJEásWf&r<‚Á÷I 9™&ó3,»,°z­€ D|$}¿:}F̧{>Åðùa–Ð 7èŽ3V‹òˆ¬žGcYkÁÐðzoøåìŽã T ˆÇrÀåt¡ñ¥FØmöYµQYpðòk`Lù_ÜÈ#ÀèmÀ±ú•ë¡L£?)^öiã•ú_8H&Žw•8çZ&_þ õ 8õá)œ žDížÚEóûÍW· Mrñ0èM12ûÇ&¤‰Ú~·}ðh`^eFÍΚEÙ7ä{n¤èúžPô&™T>¶'€Úg—3w@Z6p¨Ù™Ž/‘ý_¸ yO¹îØ´¼¤N»(Öæíï¶c ]ç»hÔJ9`Œ1666ÆÆÆÆØ£Â•·®°¬cuû6]î›=7Yׯz÷öjå)ò'7ždw&cŒMÜ™`'7œdØ•CW²Ó(1L*Oѯ¢êµ±¿±s;óë3iÁ Æ:Vv°,€‹d´Û?;¹î$c?—g› KéJ&©ëŽMõÚÅO.2ŽãÊÁÎüñÌ¬Ú `ìà!å3=ùé×&þ¡|ï½”-hM_‹ÞbŒ«HËõ^R¾GoͽL¡ü/8Žc˜ûI÷¢ú çªÛ…¨ÓyXôF_e÷Ôö‹³íç«-ïWß﹑¢q?cŽÍŒÝÑ>SÜO1f\^<Ž“!åÚ×K_óîf̲N‰'E 5[®X›;6;fý,%ˆ‡•‡ÞµLþN†ÿ€_;ÓCøÕ0 úD5LkÒ‡€ ÛˆûŬY•p@‘wwðB™©1¬0À}Ü Â/˳ 3xl\þ‰ôi÷¦õ&89´…2Îwêמ}=é·}Ç$Xv[€%%Æ9‡xvxи¿˜þÝ÷ïˆý»oímY¸¶¥¿7¾¤ü ýWúÚ;ÿ*Ór®mÊ÷wþßÜË,­Ø6ÚÐørãCñ›_è:ð°è µ=µýÃBø2<t}˜Vd;õ<þ,}­ûc z‡O ÿ~}ñ¥ˆÿÇÀ—pïp§ã8à‡üL GxH×È$î&:‚èQõx¤«Z—é]å;WÁwòYáÅÃ"\G]ê÷Èш"oÔÀ;xpFN#7Ó0ñÛq$ï%!5KÀÝ´¼½ÞŽÚËZ—ë.+„­ŠkšüWC燀»ÀàéAˆ/ˆ3Šs.©ÞY­ü3 „N‡îK»–C7´×¸Γ=—ÇÚk6›r}®eJ~ ö…!nÁ¯âÁó<ì6;:ÏvfÉù›ý0­0Á´Â„Zo-¬ë­(++CYYøU<¬–ôwѡ胸E̺fµX±¿q?ÿgþf¿z-%gµXáÙîÏó0 ðìð §õüjžÊ}«Å ~ßï|ˆÅãUX#¨q X-VÔî©Uã~uàAè¦M×[Q³³FÕŸ–Ã-Yñk×éé–*mk]o…¯.[n||\Ï`0ÀµÍ•%Cm_:CÃCðìðÀ´Â¤¶»u½UuÍlw~¯Õ‡%eªœžxÔnו¶Î¸VŠþ k¸œ.˜V˜”>e»Ò€¤égæC? ñÎQÀµೇ0­b?èˆdrJ3ŒŽ¤«Óä–(.gÖõúòÖ}¡ÎÍN˜Lé®ÒU UWAtˆ!q7A£Yâ‘æ¡q-ë ÷2ïn/ã8ŽU®®dÖ‹ÞŠfɵ-oS\¾6œÔo1ù”«XÛò¶Y…é¨L»‹ÊìÌÖ3ìJë6ö·Üí264ÆåŠ|Ge»rèJ–»Z©qÎ…k™2%?¡Þs?åÖL‘ûèEëEï%E¦í­ Wª Å`º[W1÷2%éï¥^€qœú{ä*·¯3i·‚Ž`‡R·å`Ñh”EoEÊ‘ÕF¹Ú¦Ôk(‹Þв¯‡¾V¯5¾Ô¨¸-JWÔt¯}uM“7óJ3»£è˜m£MëZä»öÕ5æ}Ö›Ó}b®tc!ëÀƒÒM›¦ôfêZG°#í⪳]Sé`{.*®SÑ(3¬7Ü[Tê_¨§¶ŸeÛW®®dXåêJõÚµ¯®iúÔï¯~oº¾/ö\dÞÝÞ’âÉ××ÏHÿ¦éÇq÷M?r=7ŒËk|‰Í*ŽÀëJ<Ñh¶œs+c纛˜(½«[ÍÚÞiËá¦e׬²²’qǼ»½êïŽ %ŠÅþþf?:?ìÄèè(¼ÏzÑ{©â1¯|r<9õºD_üEå¹ir3 ã<äD·¯[}»#.Cþ\Fø`–§,¨ù¨ÈØÀd1A|A„tLB|$©MBíM2¥Æ9woGÓ‘&î¥ßIýÒ}Õ–7÷“@Ó+íy/{jŸãÒ 1çR¦$=>¬ÌˆXÖZÔ·o–µ þÏ Þi{µ^åíhð=eÑ­eµüÔ+DËj‹º°z.±¬µ(oY‘~UŒ¨î ˜*++a®ÎĽØð"Foâcï åp N?‰ù×Q\ ½ÿ›Í†Ž#YiÍ—n,4xPz£iÓ)½©\]‰‘ïG|/ˆ†ú†’Ú5•®Ùl†g»G™mæùôll=¦¶ŸeÛŽŽF¾¯Î‡ê]Õpmve¬÷íöáÅÿyg?<‹ö·Úa0püèq4¾ÒXRÈæJ¦ÿgPi—¿ú^qÓ‰Æ`\nDì§´›EÊ`1êµÌÿçcEv¼©ì¾PôΜ~róOñÔ.Uö'ìðîöªy·m´Á´ÂôÈêÀƒÒ›\mÊ/WÚKþ>ío¯·]Séò+µþ8¡S!¸œ.ÝzDm?ó¶ïx§\…ò 9uúžr?…e-CèTÚ×»Û ”+î}Ýw#öC Cß iÚHOýDûp”7dñŸ¦µÇOÊõ¹–™ –uD®FªŽF¨Lëyßå>4½Ü”óa<—º±Pu€ôÔösÔö¾ßùàÝíÅÀ_:ÂÙÿ>‹d2 ÿüðÕ)[ò›L&¸Ÿt£çb‚ï1üÍ0jŸ­-9ž©óýÜ7ó˜Ð®Ý£lûíÿPëÍWåSû,ðoÿè:4½\8ÞîóÝ9g85ÆN_¡ÿ ¡û|7Ì+ͼ€ï9âQᡘ‘áy^ÝÅ£7Ü ŽãàyÚ£N½ÊÓ^}ˆ/+bò^±¾ì7FÛ:ÑõLz¿vû>Ž"9žDìªV>6SÝÃRr3 Ó²¤‰xÆLÆ ü9kO?S6’HÜ-ò¬mF¾Wv@K×k¶±"n*á9z¡Õ;² Y–áoöƒ_ÅÃó´Ç¡7Ü«îÒÊçÚµ€ bšÅþšÅæìÌÏ0çVgÎEê©óUN®=ÉÆn¦Ë}íÈ5ÖÆµe-†ï}­7÷™0óŸ#Sj˜ìÜ®slb,½"ðëίՅúÑ/¢9ËšZÌfÓ™œ÷fçlû«çÈìdèä¼µq¾½ü-k»"1ví«ôǼraœ#Qˆ‹Ÿ\TëóÜGç”ßå1VYYÉz/õæ^ì+ÿbÛe‘¯q¹‘±Ÿ;×}nN6H]+º(|ª?©ÞUÍÎu+åi{«M¹o6³‰LÌ‹^,4°mTú>h½Á\-öË¿ØÿÚWטq¹Qm[½ºEm?ÓóRÀ÷7ª¬˜Íf€9íÔ þ̘ÑhÌ[ïzâI…·m°© úg¢3é{æû¹‘ºîܪ=Gææ·ŒUV2vò}}q86)çΤˢ„ÏŒódˆ1ŽcìæÍÂù¼"]af³9o»;·:Ù™?žaŒ eZC&“›yzŒèQvî·çX‡¹ƒu¬V>çž:Ç¢‘܃û›=7Ù¹'ù“kO²Ž•ŠüÍKù{¤RÂ\yë ;÷Ô9Ö±ºƒ\§È¶-oSò$eçéäÚ“ìäÚ“ª!ÓÆµ±“kOÎ*ÎéXÖZT£³¬µhî!c×ËZ 3¯43óJ3ó>ëUA÷Ë™˜P¾çúLßèÊÊ Ã±Yù{å‹’9’)uPêØäPëÓ±Ù¡´e?ÈŒËÌl6³ºçê˜e%˹"]QÚ¨\|téдWõo«s¶áôk¹Ú:sg#÷Snf6›Õö¯{¾ŽE§¶îI¥ŸÚ!)3óJ³FŸææÆÂÓËZÆÎ}ôàõFý ¯³0ïn/3›Í̸Üȯ²â+Ö®™;V9·:W‘N÷ZäZ^ɧGÔö3£zW5«\]É*WW2£1ݤv–ˤþ…ú,£µ”x:‚ªcYkÑì¤ULÿôêÂ|êcJ›W*:áØœ}ÿ\·bÌ8·*F‰c“Ö-ÇÅOÒ×Çî(»å9·*òŽÍJ|Î_+†v1÷7jvnÓ3¦!ˆG‘²©z6Dæ^å±iz¾W|ÊÿQ@tˆê"m¦c§!âÑ£¬¬LuK-Ø'>ýìS<õôS»3FÏùE€°F@èx®m.ª ‚(@9U±˜0™€è-ÅgY›¨N‚ òö™+LˆÞŠ¢¯¯Þ]^2b òw2UA!CÂ@ó@–|&±ïcðÿâ„,!ÄGâH&•“ÒùµÚÓsã#q4%šrÊù†}j©ôø <|’0¤ãY”±cßIJÂ劳eI øÕé|ä*‹ž|¥/ˈ`ôú(¸ É{I˜7˜aßg‡°MÐÈδ,9Áà{ƒÀäÔÉó“€yƒ–]X½VúeAAy(û‹[D4<߀Ú=µ€–²€°I@í€rM¾ £ë™.$'“¨Uú'=XÎ%¯Þ[Ò¢2Ðéè„ü¥²C”ŸùµÕÒv4Ým**—J,¿µ æ|MV™¦§›/Îér¹Ê¢7_R³„p ~#o†$~LàìoÎ"v=×!ÄÃâ¬Ë"½-!üj¾¯|àŸPŒ°ø8Îþæ,ŒëŒ¨½\K¿L‚ ‚ ¢ ‹ÆµLþN†ÿ€?ëzüÇ8¾€{‡»`xa‡q¿Lݾn$~HèJ×uHÿaTâkbÉåþÓ0¯„gnĽTî†a…2µbXa€û¸R·á@òeyÖe<6®‚S0­7ÁqÈ‘SÞÀO{êAA‹ÇIÜM t"Ñ!¢êñ*HW³O£î¾Ð çf§®™$aç”kÔ$0xz° lûÒvÅPhÖgœ´,ix@§!SØž·©_¥6 C§fv¦ƒëí↖ëâ2‘£gÔÀ;xpFN#7›²ÄoÇ‘¼—„Ô,w3 ®z{ÎÙ骄ªÇ« :D„N„¸› _.AA2 p_µ{j±ì±ehik{‡Ñ[Q„/g¿íï¹ÐSt6Fg®%¹{ eô=¶¦×œtÿ¾±þ—§”»Ùô5B)R×Sr³)K*®p Œ–e-ètvBzCBüF<·>\#z+ ÷v7ZÞlÁ²Ç–¡vO-Â}aúAA!óàñ7û!FðŸƒèÚÑä˜páWñð7û!Ë2z/õ‚+çàq{ üÍ~ú%AA!óàh ´bäö­t逸¥°«Vø/a«‚ / 7¦”«”f°¼‡ï†¾>]û¹¥d}7|3*¯Ád€·Ç«æ%9žÄY÷Y$â÷ßuJ­d>K'½•Zk¾ˆ¶lY3@Ç!½)Ì«¸EDÇ‘Z¹=‚Ö@+ý’ ‚ ‚ ÈypD£Q^ ø^Pqòvê>ßêÕºã}ŸvwJmÁœÔ._z™¾Ã˜^LkL¨ý¤V5œâßÄÑýL÷}¯{a£b ÆGrÏ¢¤® ›„9) oãá9îAƒÜ€†o`{.½ÎFîÏ¿°?ÜF­Wq; ¾Dàõ¢Ñ(ý’ ‚ ‚ Èypð<¯îPÕîÇqð<íѸi ™ ݨޡߑÏO…/‡fà\ˆðËó¿ƒß£úýt9ä¿Èº\Ûæû>eg³äx2kýPl ¦º”¥äfS––%-š™Ó{–3Ó²HoKˆõÇ0úÍ(8ŽCr<‰D2a“ñ€ÞÁçmw‚ ‚ ‚Xt†L&¡ã!¸¶¹¨ ‚ ‚ â£|±fœNz'‚ ‚ ˆG—¢* ‚ ‚ ‚ ‚ ‚ ‚ 2d‚ ‚ ‚ È!‚ ‚ ‚ ‚ ‚ ‚ ˆûKùbÎ|®sQ’ãI$Æ0­5Áö‚ öß)f}<„æ¬sV2‰}SÏŒ€Èñß&äd˜Ḭ̀ì²ÀêµfåG¾œqKEþ3XŠç’ë|–Rʪ)S Ò»F¿ŒÜrÂ6¶Ý6ÃŒê† ‚ ‚ $‹ö™ŽNÈ_*[1§]”š%„a€;䆽.=Ào)k›ÔÔjâjYÒ¢Ö¥·%„_ Ã÷•O=@3~#޳¿9 ã:#j/kæÒä7òðöxaXa@âÇÎþæ,b×cprA<,Ì·&/e-Y×K-kª ¦Õ&x{¼0­QÚVþLFWuìÏÛá:ê*¹n‚ ‚ âA³h\ËäïdøèH‹ûÓÃðëNÃu(=¨<6®‚S0­7ÁqÈ‘·ËrÚ˜8î†a…`Xa€û¸„!_žû³oò•5ÖCøU%OÕ'ªU#„í‚&\©uþ~:ˇ ‚ ‚ C&‰» „N„ :DT=^骤/ÜdBýŸ«àŠÊ·/mWŒ‚æôà>~;Žä½$¤f ¸›–µ×Û³fc"G#JZF­á¼ƒgä4rsZGyÊ*½+©×x'Ÿm5³1¥Ô HW%T=^Ñ!"t"„ÄÝýš‚ ‚ ˆGÛ ÷…Q»§Ë[†–¶¸w¸½Eør¸xà_€? ¨ƒxñqFyH­ ÂhYÖ‚Ng'¤7$ÄoijdSî^ÓוL+%7g(«š§Õóã*¾FôVîín´¼Ù‚e-CížZ„ûÂô«"‚ ‚ æyYìŸZo“®œƒa©!뺿ÙÎ;1:: ï³^ô^ê…¸E¿!\DâvÉd“ª?¨Vݼ¦»Ch}Hù2™}ßyȉn_·z_þ\†ü¹ŒðÁ0,OYPóQ 0ur<9U°|ž&7+kÑ< XݤàWñð7ûáoöCê—:‚ÇíÙlFíîZ´n¡_AA1/Ìˌ̲eË ~~µìW9õZ1r{Ö:Žt”dÄ@Ãw °ì²ä?Ë<=˜¾‡ï†¾¾œæœµÎ _ÄÛ ¶¬™–á‹ÃÞL»¹¥\ÇÏNIN“›²XY‹æ©Åê&âG:h `äöZ­ôë"‚ ‚ —!3vg¬è'Ñh×¾T\•¼¥»*¹Ž¸ÔA¼ô¦èXºÑt·)÷€ÞÆÃs܃¹ ß6ÀöœM½'÷§ÝÄ„ÊÖÊñ‘Ü3Q©ë¦ǫ̂ȸ;-À]}k{ •5•Vüûø¬Ú2_Ýdî £Ö«¸ß "ðzÑh”~]AAÄâ2dL+L…?y¶xæy^Ý «7Ü ŽãàyÚ£º0Érñ5&“âkÊLNr<‰Èiý ìÃ/§¦–%-HÄÓ–i ž GýέHö}v5½ØÕ˜&ÎØ@LuóJÉ¿>½?ö÷ia®Ç`ZgšUYÅ—§®ßK"ÖË Û¹­]Ïtͨn@–eø›ýàWñð<íÇqè ÷ª»Ëñ&örê=Çq0U*[OÇGâhJ4©2¡õ!ÄþC÷ 0­ÉÞž:d eÅÿ)Žäxüj¶l°ï³käó “bèã! 4äÌŸš÷ïcš³]‚ ‚ âQᑜ‘ñ ûÔO ~Ÿ¾–aÞŇãˆý]1&ÿk0o|Óãiú± ®×]ˆ}CÏö r<¢‘ç7ð9ç°î²æÍßô¼AA2òw2üÒ³âKbÑ0ö½éÙ“ÁÓÆKätøEÚ™i _žó²¹¹4ßýü¿“I« ‚ ‚ 2d#‰» „N„ :DT=^骔ü¿í*n ¼‘–þxâkŠA’ü)‰¡? éÏG2¡þÏ•ssV¾ö¥íŠ¡Ô¬5ʤ«ª¯‚è:Bân‚4œ ‚ ‚ Cf¡î £vO-–=¶ -m-pïp#z+ŠðåðŒâ‹ Ä`^g†c¯C½6x|P_à_€? (FLñ€8ÿå¿FôVîín´¼Ù‚e-CížZ„û¤éAAÄCÅ‚[ìÇ ÞçÊ9–4×üÍ~t~؉ÑÑQxŸõ¢÷R/Ä-³7"F`¯³ÃÀ l .Cþ\F\ŽÃ$˜r?×c­ŸZÌ/ ÓjÜGÝàü¬ò’Š0™_Ž_ÅÃß쇿Ù©_Bèt·f³µ»kÑr¸…´ž ‚ ‚Xô,¸™eË–üüjÙ¯²Â´Z1r{Ö:Žt̉ƒ_€Ñ¾QO Ûn›z+ߢ`jQþ šÆšàºÿ>ŽNw'¤·¥Ye'¯ï†O·ù)nÑq¤ÖFn 5ÐJOAA!3ŒÝ+ú™N4Eàõ‚ïw*ïìÝ©ä¿ÈˆßŽ#XDpU}èSï Ÿ.¾è `¯·ƒ_«ÌÄHoJsVGMw›ŠÊ„û¨õ*nvÁ÷‚¼@4%'‚ ‚ È™L+L…?¦l—.žçÕ»zýà8ž§=ª›•,—¾“WäÃj{jÑðCƒú±=§ÌÊÄG㺨sÑjödRÚ];ºtÉ…_Ök²,Ãß쿊‡çi8ŽCo¸WݹçyÒx‚ ‚ ‚ ™…ˆè:ÂØ1´·¶Cê—PUUUZ$ `|püíÀßþ|ƶÌ'Š/ú—ÏËê4–]ÝÉËŸë3¼¤cÚYžªª*HýÚ[Û1vg ¡SÊÎmAAñ°Q€1ÆÔEö¹f<;²,C„¬ë!K±oCƒã8˜*Mð û‚Hü”€e§ž<9å€_«R™+žäx‰{ ˜V›`Ùe¸_–(á‚|ñŸâê,ɬ­óĽÜA7ú^íC|tjóƒrÀ´\+ÿ)ÿ/þ¢å$‚ ‚ 2d‚ ‚ ‚ 0ÿDU@AA2AAAdÈAAA!CAA2AAAdÈAAA¤œª@?ù΋A9P鬄ý%;x›rˆæÐÇChÈ’Ï$ö}LsLäxƒï “@r2 Læ fXvY`õZ³òëAzWÂè—£€àÀ[ÎAØ&À¶Ûƒ`Pó‰#™LPοIŽ'‘OÀ´ÖÛ 6Øg×”sº¼oØ—÷^|4$~×aø-P4W=ÄGâhJ4L/…|YFäh£×GÁUpHÞK¼Á û>;„mBÞvâ7ððI>À ½ŸÊS®´‚ ‚ ˆ…#S"-e-a“€ÚZe}AF×3]HN&Qª†uµ ¼zoI‹jÈHoK¿†ï+ø' ~#޳¿9 ã:#j/kæäM«MðöxaZ£´›ü™Œ®ê.ØŸ·ÃuÔ¥Êw::!)ül*Íf á@à¹a¯³”Ï{ï «¶ Ãå€Oò!$†4FZ®zh_ÚŽ¦»MEÓKå“ßÈÃÛã…a…‰8û›³ˆ]ÁuÈñ°˜³Àò[ jÎ×d·eFýAA‹ r-˃ü ÿ}ƒ\a‡q¿Lݾn$~Hè ç:”64 ‚«àT#LëMprd…‹õÅ~U1@ªOT«F Û§ò¢ƒL¹áÿžye-\oM•eˆ‹@|©xì{íÅÛᲜ6¶Ž»aX¡L­Và>î„aÈ—å¼q ÿiáWºŠâ?à‡üL?‚ ‚ 2d‰» „N„ :DT=^骤;¬°SPòƒ§ ʶ/mW ‰æô`?~;Žä½$¤f ¸›1د·gÏÆ¼«ä‹«àÀ;ùlå°¨™É[ÞÉ´ÁÅUp³ª;ÓÊ´15þÃ8\oOßõFq™Èш’?£ÖÈÞÁƒ3r9•rÀö¼-]gm†N MOº*¡êñ*ˆ¡!$î&è‡AAA†ÌÂ$ÜFížZ,{lZÚZàÞáFôVáËaÝqhÖƒ\•nL­ ÂhYÖ‚Ng'¤7$ÄoijdS.X¦Õ³püøÃ€jĈ¯ˆ³ªÃø÷é|㜵ZÖJSÁzKÉeâ z lM¯Ÿéþ}7bý…Û&|9Œè­(ÜÛÝhy³Ë[†Ú=µ÷…é‡BAA†ÌÜÇ ~r½Y÷7û!„Ðú0™ÜyÈ™þ2 ÈŸË #øÏAtíè2²ŸŸŠ†“(Á5A´ÿ¯vHÇ$O h¸ÙÞÁϼòï=ûz”,qœ.·2½-+7M.“%@uwuÚà›:ŸîD\Ž6JWñð7û!Ë2z/õ‚+çàq{ üÍ´¦† ‚ ‚ ™9dÙ²e?¿Zö«¬0­VŒÜA 5€Ž#·Ìbžá–rwÒ Ž7ððÝðÁw×s¯8k¾ˆ¶lY³Ã‡!½)eÇŸœYV¾k€e— ÿY.ê WˆÐú‚Ö Æ¿‡å) j¿¨…iýÜmQ´¬Éüu“Þ¯z?9žÄY÷Y$âú\ÆÄ-":Žt ÐÀÈí´Z©× ‚ ‚ Cfî»3Vô3h4ŠÀëß *.DÞ™»žO»,¥¶`ÎGj§®,cÇÆÃs܃¹ ß6Àö\z‡ÜŸv6)îR™î\¥â:âR÷Ò›’fƧ|7|hø¡ ?4 æBMÖ:–Ù"lœ*ëH®§ê$¦5&Ô~R«ñoâè~¦»hÚá¾0j½ŠËað½ ¯F©× ‚ ‚ Cfî0­0þäØVšçyu—ªÞp/8ŽƒçiƵH/òù)Ùrh ‚å—ÓFSË’Í,i ž GýέHÏ8ˆ/+3GÉ{IÄú²×|tnëD×3]Ó6˜ _›Šg<‰ÈéÈ‚lWû>»šÇékb1Õ¥,%—~ ê÷«Óíõ9§‹Ÿ,Ëð7+®…ž§=à8½á —Cž§^ƒ ‚ ‚ ™…ƒè:ÂØ1´·¶Cê—PUU¥Ïˆ¹ CjS\¿ªß¯†a•AW8éXÆ®h“@Ïï{4ÆÌÐù!Õ8÷¦ÝÞx'¯nwÜSߣYó9Aì¯1ÍÖÎy˼WTw86° ÛEØ.¨WO}?*õ“ø1¡®ËqreŠ™ kµèÖÔUUUú%´·¶cìÎB§”]ì‚ ‚ ˆ…ˆYÈ@‘eBz€œyb|ê„úÔÂ~ó3Ä—DÕµjèƒ!ô½Ú§œz?eŒ˜–kë6þS\s f¬?†ÑoFÁq’ãI$’ ›ˆÄœ‹ñcý1HïJýr¨P®™×š!5îm!Kñ‘8’I%¯™§Ù}0„îÿPܬø<|W}åsÝ ÞÏE®zË”/”žÚŸÉˆ`ôú(8#‡ä½$Ḭ̀ï³g1©ôòå­kg†ÿ¤œ›3ýðÍémNAA!CAA1'kAAAdÈAAA!CAAA† AAAdÈAAA!CAAA†Ìœ#nÁ¯âQVVq‹ö°ÄÌë™÷‰š^i‚Ýf‡¸E„Ýf‡ÝfGþuëëTÜeee‰»‰¬tÅ-"Ê–d§ ]ç»àrºT9q‹ˆÎ³%•­ëã.¸¶¹”xJ>}¿ó!Ü.)žàÑ "W#3ªÛ²²2ø›ý ¢­#ƒ‘’òd]oE×Ç]sš‡™Öå\Ñþn;jvÖÌK¥~ ö'¦~OØ!õKåM&“F¿Å-"š^išu¼ ùЫ‚ýÀù.X-Vµâ¡°g;a2™òþ.‹é@çj_g]o…ÕbEðh°pš:ÃèÑ¿…&SŒ¦WšÔçÛ‚hm<„Õb…èaµXQ³³±b÷¥YlmL‹ÆcccclllŒú8xè KÕžëÞÝ^fYgaÿ˜P¯Z ûúo_kdF#ÀªwUçLÛ¼Òœîk™c“ƒE£QõZ4eŽMÖøR£®25îodŽÍ6v'­ÿ˜`î§Ü̸ÜXRý`œQÝÎ&ì|¡7OÕ¿­f½—zHÚó…c³ƒùã™9/côV”qœWï¥^ÆUp,z+š7L.ÝŸ‹x:ó¡W…0¬î¹ºYJŸTÿB}ÞßF1˜øÇ ©ÓTßh äNWg=ú·ÐdfûÜ»ï: ³-.~r‘`?¹¨\ø™1ÛF³m´Í{³XÛ˜ dÈÜ'C†ã8vðµiÜŸ•ëÓ óJ3«{®Ž`ÁŽ¢mï¥^†rhŒ˜Ìå`{.,Oï¥^Æq\Î8ÆîŒéêÜÉyøÒ»3ÆPŽyé_jd–uÍ5Ë:KAÃ[Î$^báÿUc½áÞ‚ù,¦ÿ˜Èº?66ưÊÊʼƒg=aôèßB“YŒ†Œž¶H½,œ˜˜Ð¼°C9æ½Y¬mL‹ r-»Opéê´©Þ%ŠË™u½5K>ô~¶6¼øŸ/"2XØ­è£ïÀ¹Õ žç³îñ«x8·:qüèñ¢q¸¶ºrÆaZaÒLÅG#ðl÷¨®gÓÝ^Rno¡Ó¡,»ba ¹dºåår™k»‚ Àåt¡vO-ö5ätÿ›Iܼ—„¯Î×6A@ûÛí꽡᡼.hgµñg†ËtéSež°£æ™ÈßÉëRÅ'ìM/7å-£ÝfϪ Ïö5hÚÍ`0 vO­z­ûB7œ›0™Ly]ÿRך^iBþØŸ°ƒçy|záÓ‚õÞs¹Ž'šk6› =—{fõ[›i¼ztS-ëËJY K W›|í8½žš^nRÚm©_BèDž˜V˜Pë­~)ìn9Ó:×£ï…t.Ÿ+h®ú˜éo½&“ .§kV:`XjÀÐ!m]ÎŒSo=ú·Ðdòº•¦úÔm.ø~çC2™Ìëæ7Ó>n&èm ÷v78ŽÃÙÏâñ8z.ôÀû¬wÞû˜ÅÒÆA®e4#SÒuçV';×}Nó†(ß¡è­(3.7²ÊÕ•—´éoŒŒËß¼Ôï­/êV,ŽL:Žt°ÆýiÙ3<“å"—ïMéLžë>Ç8Žc7¿½Écìæ·7ÇqiwÆØÉÐIEææ”ÌÍ›ª‹^!ôÄÊ“ÙlNÇ?%—ér•+ï?¹ÈŒF£:Å?6¦ÌnuéÐÈpǾJ×AÝóuêl\¾º¬¬¬dõ{ëù©¼Bo±¨ùŸ˜˜`ÇiÞ^F£QæüµS®ú·Õ¬í¶¢oëhôÔ±ÙÁ,k-ëž«à4ºz[ÊUpùf3kÜßÈÜOº™c“ƒUÿ¶š]ùâʬãÕ«›©²¦\Sê÷Ö«õ^¬Sa-kÓ.¦Î­Nf6§õáÊWv®ûܼÔy)ú®wF&_}è­OÇfGÑO©3G3ÑÞK½ k{«M÷s W=i/4™\äêSÍfsV?3}Ülõ Pûõ^êeæ•ffYgÉí1O}Ìbhc‚xH<ȹ†LêÁ`^©<8ŽcÞg½ê€"ßÔvo¸7k½ÌtCå…,8•®'Ž‚ü¬ (2¼ºB:Â:69²Ö UïªfŽMé›mƒ-KÆ»Û[ÔÑw*OÓ× TïªÎòµÎ•÷éáê÷Ökœ¹ò g°f4Ããg}ÍäØäPç>:ǪwU3ìZäš:ðÌX¤ŒÔ@¦Ø ºþ…zÝîùâ)æº2ýÀ¹Î1”ƒûèܬâÕ«›jY÷ÖëÒ¥\eά§ƒ¯)ùR×¥M¥9}Æ\Õy)ú^Š!“«>ôÖç,`9ó9pnu2÷“î’ÒÏFOÚ M&zûÔ¹èãæ‚\m‘2²R}ܵÈ5ÆUpY/ æ£Y mLäZ6SW±"n¹ðÕùû!†+_\AÝsuè>ß «Ý YÎ?½îrºÐöVº?îFðxîuŒF#’÷’yãˆÇa4 æ­XšøâqÕ5FÜ"Bt‰ªëÕ|„¼>Ëj‹æšeµƒ×ÕïÃß gÉ•BÑüè‰[uÓ[ÉgÉ ÿ}¸hü=—{4;àôõõ!1™(˜=t}Ô…Á냰ÿ«áËÅw•sms¡ç‚âjÐ}¾í­í0¯4£û|·ßù.xw¥]. CX-@]ù1-7i\)1Yä7TÁe¹ª$“Ipù[ƒAó½fW ªwVãPó¡YÅ[ªnšŒ&]ºT¬žPžvßL¹›¦ò;u^о—äî•£>fÓO̺.QüÍ~8ÎuŸÓF¾0zÒ^h2¹ÐÛ§Îg7Û¶ØÿÊ~¸w¸a·ÙUÛêÕ8tàм÷1‹¡ âa œª`†JNé ‰„¦ãKÞKª÷ò‘êìkŸ­Å¿ýïC×ù®‚ëš^iÂÀÀ^üÏáp8²ãÛ$"r#ÿ:šááa¸6ö)7‰ÖUöšgj0::Š+_\Q×N”••!9™œ×°‹ßnZÞh™óx]Û\Š ¡Æ[ƒÿó›ÿƒÆý9}ÓS¸·¹ñNÛ;HÜM@–ekTï¬F÷ùn4îmÔ¨§ŒêÕóV/B¥€øOqíà÷§¸.tú@f1´1A,vʦzˆÇÿJÕ € 9 õ 8ûñYČ߷4ËÊÊx=° Ü‰fê::R]Ђ ‚ ´F†x(øô§šƒc±ºÏw÷Û7ïi›V˜¸›Ph³Ùl‹¾>åïd2b‚ ‚XÐЮeÄCu­ã?ŽÃn³ƒ«à¡vw-Ú[Ûç=m×fþå_ÿ‰É÷7³ÃC BA1ÏkAAA‹r-#‚ ‚ ‚ ‚ ‚ ‚ 2d‚ ‚ ‚ ¦A‹ýg@û»íè@×ù.„,!ľQNæ8¦J’ãI ¨tVÂþ’¼ }<„æ,ùLbßÇàÿ%½uoäxƒï “@r2 Læ fXvY`õZ³òëAzWÂè—£€àÀ[ÎAØ&À¶Ûƒ`„,!ÄGâH&“~-äx‰ñLkM°½`ƒýwv5Þ\ò¾a_Þ{ñÑ8øM<\‡]à·ðhYÒ~5ŸÎkŽzˆÄÑ”h*˜^ ù²ŒÈÑF¯‚«à¼—„yƒö}vÛlf;ñxø$`ÐÞOå)WZAAÄ‚ûÏq‹ˆ†çÔí~[ÊZÂ&µÊ5ù‚Œ®gºœL¢:T ëž´Ñ‘K^½·¤E5d¤·%„_ Ã÷•üŠ¿ÇÙßœ…qµ—µaSò¦Õ&x{¼0­QÚRþLFWuìÏÛá:šÞR·ÓÑ ùKàgSi6KÂwÈ {½ |Þ{¿]µ]þx(|’!1¤1ÒrÕCûÒv4Ým*š^*ŸüFÞ/ + Hü˜ÀÙßœEìz ®C.ˆ‡EmÝN¥–ßZPs¾&«m3ëŸ ‚ ‚X¸kYäïdødhã?Æ1ðåÜ;Üà ;ˆûE`èöu#ñCBWº®CiCcðØ ¸ N5bÀ´ÞÇ!GV¸X_ áW¤úDµjÄ€°}*/zŒ´ ¹áÿžy.\oM•eˆ‹@|©xì{íÅÛæ²œ6¶Ž»aX¡L­Và>®´K8†|YÎÇðŸ†~%¬«(þ~ÈßÉô£ ‚ ‚ Cfa’¸›@èD¢CDÕãU®JY2ݺáÜìÔ5s%ìÔüàéÁ‚²íK•óNÄæô`?~;Žä½$¤f ¸›1د·gÏÆ¼«ä•«àÀ;ùlå°¨™É[“iƒ‹«àfUŸ¦•é:ÿa®·‹§ïz£¸LähDÉŸQkäïàÁ9œJ9`{>}X¥Ô&aèÔPÑô¤«ª¯‚è:Bân‚~,AAdÈÿ 'Q‚k‚hÿ_íŽIžÐp³¼ƒŸyåÞzöõ(Yâ8]nez)ZVnš\&K€êîê´Á7 t>݉¸/l”®âáoöC–eô^êWÎÁãö@ø›iM AA2÷‘Ö@+Fn Ð@Ç‘ˆ[ ¶Ã CX-@݃yulmÌuóxønøà»á˹œµÎ _ÄÛ ¶¬Ù‡á‹ÃÞ”²ãOά.¾k€e— ÿY.ê WˆÐú‚Ö Æ¿‡å) j¿¨…iýÜm"Q´¬Éüu“Þ¯z?9žÄY÷Y$âú\ÆÄ-":Žt ÐÀÈí´Z©'!‚ ‚ CæþFx=€à{AÅ]È[Ø]¨û|7ªwVëŽ?ö}Úe)µs>R;ue;6žã4È hø¶¶çÒk<äþ´ë”°I1®2ݹJÅuÄ¥î¥7%ÍŒO)ønøÐðC~h@Í…š¬u,³EØ8UÖ‘ÜeM]OÕI.LkL¨ý¤V5 ãßÄÑýLwÑ´Ã}aÔz7Äà{A^ ROBAA†ÌýƒçyuGªÞp/8ŽƒçiÆHcÈ\èFõý†Œ|~*|94HÁòËiCªeI‹f–À´ÆOУ~çV¤gÄ—•Ù¤ä½$b}Ùk>:·u¢ë™®‚iLˆ¯MÅ3žDätdA¶›}Ÿ]ÍãôµG±˜êR–’ËÛþ[xT¿ŸnOù/rN?Y–áoVÜ =O{ÀqzÃnˆŸÉˆ`ôú(8#‡ä½$Ḭ̀ï³g1©ôòå­kg†ÿ¤œ›3ýðÍL= ‚ ‚ ÈYTk„އàÚæ¢Ê ‚ ‚ ˆL9U>èdw‚ ‚ ‚X8Ђ ‚ ‚ È!‚ ‚ ‚ C† ‚ ‚ ‚ ‚ ‚ ‚ È!‚ ‚ ‚¸ÏЮe%ï¼”ñ‘8šMyÏ@úxÍYç§dû>¦ž#£ç,•”\ÖY6ãI ¨tVÂþ’]s†Ìý¦fg zþÜ£–ƒ16«øÊÊ€ƒ‡”ÿ[@*:q £·Çf@êO_ø+`^ •&dpo_L+ô¥›ŠN†_]n9ûÀàÿhóIûÛÀþW¯ÿX×çN§P9*+¡¿†¥Ú00ð%àØ”“¯®îW»*ç.™W™Q³³æ¾‡ÐÌ´þSm}ðÐrxaåía¤X]t} O¤ûŽd°=Ô> ¸œ¥è3àp(}D)Ü}È•^)}Íbý­±¸¡™ð ûÀoà5ß3?)³0—XwY5†¿ÏŽ£Hzùò5=ΆXÜÇÝþx¡ a胡Vo]ç»`Û`›÷t¤~À÷\úÿÌë€rOꤠ7 ÄF«¿Ó¿q¹bþ·rË„/ÃÏÎC&§>œú{ºôrÀÈðï¾ì0R?`6ÏÝÀb.ÚíÅÿ|/þç‹xçíwHøÅÊB@Ó+À;G®³@¸Oé?®|ŒÆ€šgJÕg ûÂÂׇûÝ×A!3ÇÈßÉðð—F|Mœuº®CswরC€¸_&n_7?$¨a§0™€Ð)À²¨ñêÇq@ýóʾóƒìû-oÞgó‡ *Çf ô!€_JË7WÔ=t S;Ä|¾ ]ign K3§”þàaåaêküütA!ó𓸛@èD¢CDÕãU®JºÃ¶,ix`æ†LûÒvÅjç´LÂNAùg<=˜³ÌV‹eee(++ƒèPÒ·ˆY×Ô‡{_↥X-VX×[á«ó!‹¥ëãp L+Làyµ{j1~o|A¶yãËŠXäªþ0-¯+yÿ´Y©€_™?lè4Ðð; áy`ü' ëO¥ç9ô>`Û¨¼Ý Îm}èm7ù;®m.kk–`·Ù<Te¬«úÿàõAEW¦®Í&|¦¾ò«x|Ù’2Ôî©ÕÈX×[Q³³¦&˜V˜Ðr¸%{À:¥Óü*<ÏÃn³£ólç¼ê^×ǀݦ¸êØŸPÞîgÍNþÊ}ž>½ 5Š=ÛÑ¡Äc]¯Ä©y¹²Eq¹izhا ÀËÊJ˧¦.-Vx¶{Àó< <;<ˆÇã%µi*.a—ÓÓ “×v¤I¿k›KÓ¯Üïvzç(àÚªÔ}ÖË@ìýí‘rÉ VþO}×Û–¹èü C‡l@çÙÏ–·•~Éåj÷(zPV¦M.úš’ôñE'íOÂ¥ï <;”z­õf¿äé<«-kûÛúÛQº*¡êñ*ˆ¡!$îÒK=‚x˜`Œ1666ÆÆÆÆØ£Ho¸—yw{Çq¬ru% ´XôV4§ì™MgX@@s=PÐ%ÇS¯ŸÙtF½ÖVÑVRzzâdŒ1öô½sOËÀ›¯õ^êU¯_ì¹Èc,2£ÑÈzýŒ1Æ:‚ŠL9X4eÑ[Q†r¨á¦ãØì(úÑËÁCŒåH‚ʽéŒ)÷:‚úâ7¯œj¯·”pg:Ó÷ÜO2vófþ<°Ÿ«\­ü˜`Œ«P”RŽTúÑ[Œ—+ñMü#ûþL(¥Ýz/õ2Ë: ›˜˜Pô´óŒ*w2t² ÍExÛFÀê÷Ö«×.ö\dÞÝÞ¬°šòL]ëvdé4WÁ©ý WÁ1ìLç™yÑÕ‹Ÿ0ÆqŒ}=”¾V÷¼VÆ,kÓíëܪ|WÛëcû3úŠ?*a¾þ[¶îÛ6*ÿ×ïÍ£›EÐÔå­(ûzèkõZãK3jÓ\qq—u­þ…úÖNÆåŒ5¾¤ó÷££=òõC3 {®[Ñ¡›ß*ßo~«|¿øIZædhJææ”ÌMÆŒF}:Pj_SŠ>N×k³Y ÏcW¾PdÎuk/F£’—T¿m^™£‡è­( ¼`•••Œã8æÝíUŸYA,^C&•ÿ|Ÿ‰Lä,T;µºçêØ•/®M'Ó°8¹î¤ú™‰!ÓÆµ©áÛ¸y2d2ïm=3kCƱÙÁ0³Ù¬ _÷\úP°¬³0̲֢޷¬µä5dæ’R ö³r/ÐZš!31¡üŸX^‹0æÝ]8纕dæÀ`,-ÝQ pE¦z×Ü2³j·ŸÓúâ~Ê]Ô™møŽ#ŠÑe4Õ³ûI·f`’ kY—.Oåêʬk)¶m´eJ¶ ¶yÑSÇ&m»åþM2VÿBú{ã~ÆP^¬k{'G<{gý Èª·Ô5çVçŒÚT­ÛŸ _KÅÿ Ú åyú =äh¼ýÐ ÂæÒ¡ê]Êuµ~6dËxÿ?{çÛÔ•æýo¤ ݼ ¯l£\ ¤8‚ G°ÂÙ²Šï’Uã^µI©†dZ©ÉÀŠx:«b` T%N*j§U‰é¨SµAC • 6£†¸LœjRl´L“ªb4E8‚ÊŽ(Š­‚°5tß?N|íëßvœÐç#Y¶ï=÷üþõœûœçìÈO)¸¯ÉTãêuçëìÚô½ô}²¶VÛvÉýÙ½W.ØçÃÕ¿^Ûvµ±ÅËÊJ±³«“fƒñ˜òÄX-[±bEf¥€ø³ÜŒI©(zßé…áÊ–—å¦þ;½Lµ,_øMå~FOoœŸ;˜ @©PÆåi0'5ι<ß²£{Ú÷  ÁqÞ]½7' «OÞc¦(¥_ÉcòÖ$|·|IuÚûw/ª7VKqP¬T p?0/õnü›Ü¬])WƵ_Ž©šIùdÖ™\£ò½‘‡)ü)Ró‹ÏK)¼Y«vù–)ô²Ì×¢þ/F9)©ó3e_’GyãÙTuH½pÆ·ifQ¦n\9?}M^õq¥|lŽªêÅ—ýl±Kiõý W‡ …€ðLaå*Ô ÐlÒ@½Aƒ¯D©'¥Ê)AKŸ'F™¾7wJý~?l§m°¾oEWgš¶7AÿŠ>åd(Q“É…Òñ c^ò%p+6À/¦ ælƒJ6Ü£îy Ûý7ö­Ýœÿ³­-À±?{0½ðju†‰Ê€ëKÀ×–8™+\˜®¹ÇÃtصڅ+³ß¶üÎKNp‡Ûÿ¸ ~ ’èæ‹™ù^©T¢áÙ8/9a}ß ïM/Z_nSšÔÔ»>¶dëj"Í/SSÌ‚–rVf()"3‹ÓŽçZ¦K±œ„ZÀëÿòXjeYH_3ßiÐïÌoÍÝ׈ ¶lp\t buLGLÐïÒÓl HY\”«”y?Ãó<Œ‡06ÂíqÃö‘ /4B¡P@¿Ký.=T*Õ‚¦ÃuÀÝ»¹ Römv4f>[ÃwÑ'•´f—&sM˜"3±ÕÕTh6ià¹æAàù ¨  E}›êõjxÿîE(Û(ÿ{±&~©8v”mf­Ù\Øó}ïÿþ@çë™Ýû„qÐq@~ÝüÐÕÉ6»æ²ù6gÏÿúo³¦`ç0iȧܜ_8¥Ieü†û\™ëóÐÖÖç%'<×<ÿû8&ÆR›7X]¹W¯W'Õiߤܪ‘å¨###ú|¨èuU³ ðÞJX éž­9ž2òåì9HÑ®ïg,*Å(ÓÌy¶ðåÔ¾h|’7ü}üö%`ÚÏŒ(Ì¥< y6UòÞb×cm:Ùo²ðüÈÔ×Ìg}ÔlJ(]#¬­¸F²?ïóù`;mƒí´ ¡P-/¶`Ø5œdȆ ˆÇ²Z7·²aúÞ4,=¸GݨªªZðx¸Oä>û¾ÌlNÒ7胻—ù×ôAÊÖ¤WÓlÐÌr>àgÀùgJwÑ×ïSSSÒÄaìú¼·¼hy‘Ù16¼j˜T½Ü p7ï-ï’*ï`hé½É·(¸ÞÔ±ƒ×j²·bû˜­(&¢ßÅ„HëG…Ç¡l9pÁÁVCC ÷'Ÿr«¬¬”Õ—tǨjZ$A0”Ô7çú<4?ß,Ý×lÐ@µ.õ¢ƒ÷¦KÏä-6‹Ó¿[í<ÜÉžû!ØÏÛYýø1ëûV´hŸ—ú×y˜©Mxcõqà“Ôu$½à9;‰›0œ_Ü6•k™žg _Nº­@ûAöö5øc\ßú=°g7Ðw,vXd.å¡XÉT¦‚Aö¶ÂònáeÙ~ˆÕ¡¨¥;ß÷ìgÜÛ]ÃÞY7³CEà.3)=}Í|ÖÇÎÀãRœå´Ÿ™àoØ—ÛóUUUpºaé±`úÞ4l§l$ÄÄıÙ>¸5õµ³žmÊ—6û¯ïû×÷'=—Ê(Šâ?Ýû*ú¤ë¦R“ØWÑ'ûÄ ˆþºOtµtÖ¿¾_n@`}¿Ø·ºOì[Ý'^xù‚èÿ_öÍî«lcw)Û8ÝLYKBM¿iŠmü¼<,Ö?S/r在^¯µ[´â×c_Ë 1‰Š• Q±R!6ý¦IÚHŽÙÍä‰î‹²z Û€ °ßñ×vO»…mUo`›§¥ ¦9úÒY?¶äíf9(•…²è=Ž“»O›Ž á_p0Ë>s!×rv Kç5›4bï±^Y}‰ è³ö‰Òó½Çz‹ò¼´á÷ÕÝIVÈRmPoÙÑ"VTTˆŠ• Ñt$ÙpÆ¥Ï.‰ÚZ­¶v‹V¼ðé…yí_.|Ê6ck·0«bñÖ¦’êlŠ:qã[ö\ÅjQ¬ÿõ¬1€Ùg¢Öý)ÈDœÁŽãÒ^Ë¥Lsõ+ÕµÅ*§hÛª†}´µìoU+×òèÿ@++Yÿ£Ýë²=›®Ïþ)®m’[Q”Út ³þ×ÌÀHûþì›ý ék ©éúË”iˆå›æéÜ-M¦Ë ‚xr(™d¤³”J%‰vA< }>„ç_xÓ÷¦“ú®èþ m­n›2‹ À6êŸ;/ÃDñ¸BªeA'ƒèwd /ŠïŠcÇÇ0õ͸r‘‡Tlª@;¨¶ªÒ–¿‰‡Þ­Êä÷£qJV>u|“>Lý0í­ìA~ /]b‡ †Ãat½Ñ×—”ÐÖia>b–TC…:ž¯<¨¬¬ÄÄ·²ƒ$…:vœçš‡™&N8¸Ð~Ñëq+«G³^5 µ¥5ç´åâÇØøöìÛÏWtvuJ‡­¦£zc5LÝ&4¿Ø\´vi=n…V«EÍæš9•W<‡:0ðɦ~˜;Φ¸dŠsª<²_´£ëp¸rÇ3€Ûãž—ü,Ë»xF=°_´S_I}%AD^И DôÐʳµgcu}v›žYjoüéFV÷Ò½¸ƒ3¯¾sU4Á$;ørúÛi±¯¢O<ûëäg£îûÖö‰Óÿˆ•ùm'‹ËðÞa™û³µg¥¸H~t]•®}mû:«û´÷þ)Š^¼ êÿ_¿,méò!zh¶ð¢ñìº_|tï‘(Š¢øèÞ#±;Dôj×Õ´åd‚I¼ð›Ô‡í%ƱP:»:E¤8.Ýõ–-¢zƒZ|ôÓ£¸ïL"ñÆ·òú£P(DbÓ‹M)îX]‘î뢶V+úý±ºä÷ûEm­Vlßßž[šòô€ØÙÕ™Õߦß4‰Ã—‡‹Ú&s ;[¹ê®ØqN•G …BlÛÕ¶ ùYøa¶ZñìŸÎR_I}%AD^jÙ<àûÞãacNnUÛT À àÐ;¾Îé9]—Nú=~b\9~sleN¹Q m—6yuq$×k.@Ó‡MP®‹­^ªž›K.oâÜy?ñžYËÝ;³i™ÆNŒAØŸ=5{³¯ û®øà2±´6œl@Ù*¶\X¶ª '.“ ¾+¾´~xÿì…ë+§¤áûÞ7¯uËqÞ»§p IDAT¦mM²7,ƃF¶ÒžWΡmWç°ž´fõÛuÅ…žÞØvð|¬.ñ<û§v;q CŸÍ»™Þòè¶ê¨ƒÉ3B¡øÕü¢çgº~1øcžk4lk ¾’úJ‚ ˆ¼ A¦H„„aûÐA+ ê©*¸¯ç~’¸j»JœÆOgtkYnaƒcwl þDäaîn7ð nÛ]ƒÖ+ru ÷»ni’Ë×'On„7èŽgŸÜ„g² ó\P®ŽMBwCÐ;î­ìnÆŽ±ø)äàµ<8's'Q h^ÑÄò¬×‰SÙÏ q_w£ê©*Z¶m?½žq—\·–1•³êÉj1¶lÐ<­ÁžÿÙƒ±ñ±Œ~;~ õÏÔË)¿Öð¨¦'Ÿœ?"#зé¡ÛªƒJ¥‚å¨Eº7á€P' ¤¤ÆnùDxàÜj45êÔhjdÏIöóö˜›Í5h~©¾ï}’Ší´ B ý/ËQ T*t[uÐÿA/©ï$’-¾Ñtvê€aŸ5›kÀó<†‡¤ûéâœ*Ò¹/4?¥ø`ñ+[^†’’’9õ‹ŽAê·Ôçd1“úJê+ ‚ H)"®Zw¶bůVÀÜkFöøïøáºâÊÙ™Žóõ@þƒÛ¬.´Ëä‚y…õp¿åFð»`’[ß5¶ ¦\;3Û?ž7<ÒÀ,攇Á[±x*TŠ¢•”ÖJeÆ|‹º‹§ÑÚÕ31pÇ;Í\6®+.øïøÑð\Ìo›±âW+к³®WÑÒdØkÀÈ_F «×Á~ÑŽp8Ë`0ä‚B¡@óKÍ' îknÔlL¿z«V«áþ[f½P?>€±Ë×\—]èz£ g°Ã-SíGÂà }6÷¨îa;q ÖãV™›ßíüΞ; ÷¨c×Ç P(à¼â”üÔïÒÃ=êN»ç%¶S6¶oÉå‚ëŠ Æ×øx  øFã`¿h‡¥Ç‚±ëcP­Uáࡃ²û©âœ*þéÜšŸÑç\£.X[Ѷ«mÎý¢sЙõm õ•ÔWA SDŒÝF¨T*464‚+å0|yXRà×ðùy¶<ö3ºy;žÀ7Ø6Ú`Ûhf’¯ïªý™|_úàêtÁú/Vطٸ¹k$4ë ƒÖuVXþ¯în¨žUÁpÛ^Ëž‘ç>'‹Çå¤*‘+YÓÊ%¸KšM±IÌ 0ð‚¾`æ‰ÖÆn#|>†/ƒ+åÐØÐ•J•´ú]æ7Íè·õÃ{Ë‹ß6ý+V¬@kKkF5 ~ Sëš¼5‰ßé—Ö](ʸb¬T( …2ƯP?žk€JÅ&Cªu*4lkÀ±Ç2†ÕóVš¶7IíM©T¢i{¬ï[en¶5 Z{[eûÐÃnCÑê™õ„ Ûââ?ûf¦øJù±µAR´¼·¼óÞ§å?­–©bY[e òíÃá0œ_8Ѽ½™úJê+‹ÚWA‚ ‘iÐ7õ`ò‡I˜zLè{¯oNj)ñ*ÑWø²ýwzè¿Ó§´3WÝV ý˜šW5I+jÞK^¸ßv'û),ª†ï P¿¨ø¾ðeUïÈ„m£ Öj+B7CP?¯Fë_[¡ÜX¼Y³¦5’>Ï LY†g‹t?Šà\Ã9„ƒ¹©AuúÞ냩DŽÉ&ÑcêIŽciþ³$}›»\ýëU¶æ¢Õ5ÕðùÒ 3ºzzßé͸_F¡P¤œF †‚P(2¯êGâõZ5¼σ²åe¸à¸€©©)„Ê÷ªè¶êÐy°ÍMÍ2A$ ù¥ft¾Þ™uR[¨ŽAw±ô:Ѿ·=cX‡;á¸äˆ½]ú™ )ñ‚RçáN8˜ð²ö 1ðÉô;Øá|Š• D"ƒA”””Àò®%ïzfØk€sÐ)MÒwp~î,(¾¹PŒ8šŸÅìÝ7¸R.§ÃH©¯¤¾’ "%`‡¶!dt.&0‰]ŸO¦÷ò´êÙ½uö ’ºÀÄ™ Œ¼6ÂNrž`ãuæ x?(Ví>êF`4€©›Sà8Ž& CU«‚pXH¹ÁTvZu9»V±¾›‚Le#ÓiÐg&àø/¦:À?ÍC]Ÿ÷iÕ2žøœ*ßâÝçtZõçq§U+r;­:]ÜìÛíðþ™­ZEcÆ2Ï•±ëcè8Ü©©)( „î‡ÐôbÌ]f`™Ü­å¨ÎÏðÞò²}3Ì’ùM³l" Ô ð\ó@[Ë6e'Z©²_´ã÷m¿—Ú}â=ëq+;õlaŸ!÷ Ù9ú16>†=ûöÀó•»÷îFè~@¾I ¯ÐqHþ橤¤]0¿i–® œ@ÏÛ=loN$ý.}ÒF~ûy;zÞêa'•G"0u›Ð¸­ÂÛ>´Áü¶eåeP(r A¹*u(Ô ðMú0õô[´²<5¿e†í#T•*ðkx( œ' Áƒð\ó a[CnBÏëœã¢ë*Þqªm*`pèß K÷Œ‡t¶AAA‚ÌãFøA¶m´ªžª‚ûº;ÉcÐú-õ9½¹2/3C8\¸ cYnaÂP·PÔtª¶«Ø`üô¸tÝ}ݪ§ª hØ>´!ü L•‚ ‚ ‚ Af©âq¡ug+Vüj̽f4lk€ÿŽ®+®$·ÎAgÎoc–*üÚØÞ˜Àõ@,®¸à¿ãGÃs 0¿mÆŠ_­@ëÎV¸F\TI‚ ‚ d– Æn#T*Á•r¾<,©”ñk’7‡Ãa8¿p¢y{sZ?mmÒ§ßbÏÏÌS—Ç~FFäBÎÆn#|>†/ƒ+åÐØÐ•Jc·‘Z AA±$øE[-ë1õ¥@ï;½0¼b@Ùò²Œî]qAµV•J•Öþ»˜1ó2sÞqâ7ñÒÆü¨jYÑyûÉ)¸´Î„:šM¨7¨qðµƒè1õÀü¦™Z AA±èü¢ßÈøý~˜Ž˜`}ßÊÔ¨Z2«Q9.:д½)gÿã-BÔÚY± ÜŠ©“¥3Áìq¡µ…©ÛYß·ÂtÄ¿ßO-† ‚ ‚ Af±áy^²Ô5ìÇqh|¡Q¦^%dhÚÖ´àñtÈ}Š}›=«ßÅÙt•š]šØuŸÆn¦V×øB#8ŽÃ°+NÝŽ§sg‚ ‚ d–‚V€í” Ó÷¦aé±À=êFUU•tßíqƒ+åP³¹fÁãæ>áÎÙ­ïËÌæ“}ƒ>¸{™M4¡lML®ªª îQ7,=Lß›†í³àFAAK :3Ó¤ßç“öÃtê@øaÖ“V™›Ú†àd‘Û4ϯgo-ô^}Vwz¯g&0òÚ‚S,ÿQ (WÊË x?(©©Yy+‚÷ƒ’!e…Ümøa:`SÛ¸ÉTÈ8Žƒ²R)m쯨«€°_¿™O›^‚ ‚ ‚ Aæ @µNÛIt[u”AA±È”RäxOAAKÚ#CAA 2AAA$ÈAAA CAA 2AAA Y-˃tgÆD NÑîHfÌù xº=Iç»Ä¸ÎŒIçOªx%Š¥@e}%jö×€×ð‹–oÍÛ›áüÂ)¥CÅ9ùWRtv±ß=& êPø&©ív-òàÊË[ì~<ö‹€õ8™‰]3¼ ´¶ÈÝ…Ã@×€ë ó+ò]×Öæ#@6‹ågëG€ç+ b5 ª”ß÷þ˜µ~žwÜ2‘2?"ìczhÞžú9ËQààkÀoêù•PÇÒ ý6@ß–Ú]Íf`üo,^îÑü㘶¨Ñð++‰o²åògÀs ÐÖÆžIWŸªn[³³©*ÖT y{ó‚?¿ØdÊûE ë0kw«[]€ùÍâÆÃzÐjYÝÌ5~¿4òê{‹Ð×,VÞvpêãSè·ö£ugkÑÛY®éê8 |ÂòõI¬w ]¾»ìÙ·®/]à8‘Hú]zXÞµÌ[[ˆŽ3gÛÇf€©ûìÛð*`Ø'÷×= ì9Àú»Hè{7yîR 7OZ¿&Š¢(NOO‹ÓÓÓ"‘™³µgEL¢ ¦¤{½å½9¹‹^?[{6ù^©)çð²ùyû³Ûb/×+šJMâ?ÝXÔ|ÓÖjEb´¾Í@;»Ø'Ñ»T×zßEŽÅÛÿˆs÷º(jkEÑï]óûÙµöýòç[vˆ¢zƒ(>ú).¿{X87¾Í?Þ‰T¬NHCqËFªüè·eŽ»z»ŸoXQ+E¥¢XY™úþðeV™ªB.qH•6QE…‚]oz1õs‰ù©>-DÝŽ>«­Õ.Êó‹M¦üW(D±mWní¨XñÈ'~¿4òí{çÚ×,VÞs'žm˜—v–Oºžäz·Ðåí«+g§ú_׋ Ï7Ì{[xôû?|9Ù©'nœ¿#Š\yÌÝðeöß§ønž¤~TËÒàûÞãac~«Ñ¯ sW×U¼7UÛT À àÐ;¾þE–¥áU¶"adÿ]W€ž^Àîø¸U<Ø?ކ>]wœš¶ÉW÷ÙJG1°¼ûoÜ ¡åeöíLáÏØ8PQÁV’lø9ÿ9Øý 09ÉV¡1Å!sW´íbåf=I}ÙãL(ð«)W滯™/L=&hžÖ ý@;â„皇§üìxëÂÐàЂ„­Þè¶Æþ·ïgß¶b׎ý‘ilDÝé¶²ÿÇþX|7™06>Vg'’ GøA¶m´ªžª‚ûº;çgÍËÌ.ÈX–³W›B·PÔ4©¶«Ø`üôxÊ4W««QRR‚’’Zaöõ¨tMšl¸ Ô ([^†ju5ª7VCߦG ˆåÇ›f(W)ÁóמçQVV†ÆmÎêæZ®Q¿TëTÐÕë \¥d~=×·Ç-ó_·U'뺬³¯Ég Ë¥ŒªÕÕ8Ø~ㇱۘµËQÖGê¶ú?°E¸”uþœ¼Î[Žfð«hÝÉÔ˜JJbõ[¨cÿ;°{eËÙÿ|ÂÈæÆía×k6³¸t˜[Û´ôЃ_ã$.²Ùê|ª2\(Ê–ß%,¸¥ØØá¼hT[5v½Øn2á¾îFÕSU´lÚ~°ôÁñªeîa±eG‹ÈqœX¹¶R4õ˜Dÿ^ªeù¨„¥R‹WK+–j™(Š¢øSìÞ…ç/䥞’êÚðåaéú%ç¥Yµ'¿¨P(Äa×°(Š¢ØgícnJ!úý~ÑÇ/¢iÕo´[´Y?«RýSwï•¿VU¬Ì¬²´{/s“ègý3¢xÁ!ŠOu%QÍ)߸¢Zf:Âüð'VñŠbåZöýè˳†góOg4M½ï°°ÏÄî5<+Š·ogxGÒù ߇¥³r­\-01Ïó!Ÿº=|yXToP‹f+ÌÙ³’»~[V••¹>¯yZ#wïÝ-]»ä¼$¶ìhIzV–žÙk}Ö¾¤vÏ•sÒXÁ•3õ›³gç­=§j3‰×.8䪣·ÿÁþ_ú,®ÜÞÅöƒqý꟒UžŠ¡²&ËÏ;~ñÆÄ éZûþö‚Ê5•_Ç%]ÛýêîE-«Åèk Ãr)£\ý*v>öÛfëòíÙº|[+*’óõÒgLí2:¦MO³~­ï½Ì~EÕnÛ“æéØø½ŸK¹¸©¬dþŠ"S-TI*7@¼ê¾*úý~©Ï͵Î/Dæª8|™¹é}'N¥±\ÞO‰"ûÏ•ßM6üwü¢éˆI¬¬¬9Ž[v´Hs¼¥§¢ø„2Ñø§û<úéQŠÊÖ)RÛ®6ñê_¯f '^°èßÐ/} dz¹^éù^nž™ø{Ïœó  ÝÂtL+**dÏ·íj“*¹zƒZ ª×«cºÐëÕEÛ#“K¢ÝÂm-Ûã"›°”fž°tv17‰LÅjæ7ljbËËò=7¹NÊ*V³¸E? E‚›â–k~hkYxõ¿N1±˜FQŶWس~a‚Ì£Gì·z=ûÿõ+‹L}>qÈ&ȰEŠäý2sdæT·ÿkSñzÙÈU÷>ÏçûÞcB—B¡&Í Ï6È£è³ê ±ôT®­Lºm÷š§5I‚’f“fÞuè3]ÓÖ&ï‡jz‘]Ïœ—¢Ø{l~™ø¼‹^«¦¾ r•ò÷Ÿ™¯Eý_¬²ZŒ¾f.‚L¦2ÊW)šMÉu¹eGr?§­MÞ;¶{o¬¯ÍÇ/@^ù„‘‹›h=ÿYœ¶U±º"¥’KÇí'ÌE©&YxOÕ%úU,7ùpõ¯WŶ]ml±¿²Rììê\Róÿ'ÆjÙŠ+2;(ÄŸåfzL=@)ÐûN/ ¯P¶¼,¯0õßéeªey«mâÑêi•©–q¯2sßÔ1þ7¦§Ã¯–ë>ÙNÙ¤ßÞ›^€B¡®Åÿ^RYŠÅ%fy,Ás#+ë6öq2+2§NŽAfK¥Ê£Îì’[[â×$Ä­<ÿ¸å“g€ßýàI¶€vî ³0×S1ãá^§—±ý?¿kej<çΦ·2?Sì8èêÞw˜e$ëIÀ°{nõ*Ÿº~FOoœŸ;˜ @©PÆ•c0'•™¹<ß²£{Ú÷  ÁqÞ]½7' «OÞ‡§(¥_ÉcòÖ$|·|IíÞûw/ª7VKqP¬T p?°¨}ÿø7¬œeúèkç`\» 2Ë<®QùÞ¶Lmm.Äç§Ö¬ŽP¾åÊE#¼,óµ¨ÿ‹]V‹Ñ×»Œ ïM á¹õðÊÔuÞ÷ƒ\2Â3ùûJEaaäâÆþ)ÐÜÔüS;‹ß'RºüjUÚyÉRìŸRaìfê– m½8º‹^-0ö]†ÁÄ è¶¤‹+û´¾ üû0ó°…èüJås7ÿ¸ µ…‡×º“m¬5¾!Ÿ\\_¾¶ÄIÔÜ&­-lƒážlBµ:ƒ6Oqè8xËíEÀuÀÝ»¹ Römv4f¶gï»è“JZ³K“¹&Ì‘™Øªa*4›4ð\ó ðƒ|•CРп¢‡¾Mõz5¼÷" Å­Ò„–̤¦}ðŸ @ ¼©>pù¾»VRÂ,ŒXÞ• ÅÂv*vÞÊîÝÀóMYâæœ[xæn&„¹®ÄVÇÎ}ÂlÊ' eæ·€®N¶ÊZÈh€Ù¯ÿ÷ÿ:_Ïìn>ãpö ð¯ÿÆ&´s™,æS·_8¥Á5~Ã}®Ìõyhkkƒó’žkŒÿ}c)ÝÅ,ˆ®`ª×«“Ú½oRnÉÆrÔ‚‘‘ }>´híY³ ðÞJøo±ëQF¾dmX:ói-d£\3çÇÒ)«íkrÃæƒbå£z}r]öM¦©óÞÄ '{ÛïÉϯŒí*K¹¸˜æ{”ܰž(¾ “O_Ìyˆõ$02 9bBŒù­˜ðÞ°5yC¾ç:»¥Xn2Î}>ØNÛ`;mC(BË‹-v '~Z*Õ²¸‰¸í” Ó÷¦aé±À=êFUUÕ‚ÇÃ}"÷Æäû2³y<ß î^æ_ÓM([“^uN³A3ÛÑù€Ÿç_RÏ–£¯§¦¦¤Îaìú¼·¼hy‘-»^5ÌN&¼Ü p7ï-ï’)kÝV ó Ð<+0H¸›èv¾ž¬ªb¿ÈV%áãc¶‚˜î ·|0¾ûݸ™.N·öýs5/Ô±!—§G¿#ÅjÛ.6A°~4·ðD‘Y®É(ÐÍcÊ–³×øSS@hêDùÔíÊÊJY›J7PFUÓ"‘‚Á ¤â:×ç ùùfé¾fƒªu©f¼7½Xz&o±ÙŽþ•ت[çáN&ðÜÁ~ÞÎVø~ Âú¾uÑMÔ¶bjd¾ïgû½ïÙÿÎÃò ¢k$&À œO‘+™úE0È/â.ŠI®åZ(K©¬²¯Éu +”Lí¬XöÎÖe_lñ*•éêÎÀãRœEÆŸ™ºRüኩür]ɧe#7%%ÌúTªØ¡ÐÅf)÷Oñ –Ö,ÏÆ¾Æ®³õý¸¾l?6£åäºÂþGM5ÓM&ªªªàuÃÒcÁô½iØNÙ–¬åoµ,·£æ>¢¾×³MùÒfÿõýbÿúþdË#)܉¢(ÞøÓ ±¯¢Oºn*5‰}}²O¼Ñ€èÿ¨ûD·QKgýëûåÖ÷‹}«ûľÕ}â…—/ˆþÿ;ƒòªû*Û´\Ê6ÇE7 cÖBNÓošdŒêŸ©¹rNT¯W‹Ú-Zñ뱯¬Õ˜DÅJ…¨X©›~Ó$m’ÆìFéD÷Å@»%¶!_»%»û ŽYƒ[bÆ.8’Ýõ¾ÃîIõkÙæÅ«îÜâá¯Z½ IDATÕocVafFó´ü“¸á?jU)7ͦôq+4?.}»®^Ï ¤²¤ÝÂîq\nyªÝÂŒDó4×xEÃÉ5éÒ–-ü ŽÔù¹Öía×°´q^³I#ö땵©¨Á€>kŸXQQ!=ß{¬·(ÏK›o_Ýd…,ÕÆç–-bEE…¨X©MG’‹\úì’¨­ÕJak·hÅ Ÿ^˜·þW»En #ݵh{Ñlе—xKy¢ÈŒ}hžfÏÕÿšYð‰úµ¸Ôÿ³°¤ÞÀü™¾—§!ˆ8£Ç¥½–K¹æêWªk‹UV Ý×2†å’‡©þçÒΊ…©‡ÕÃúgØæü¨%1í¹Ñš³±ºªyZû¬üú53¨Ð¾_¾á;]{Ê'Œlnvïõ¿–µÍ¯ÿ·#+iÊ$Ÿþ)?æk³ÿ£GìªO¢%±«eùÍÏ«Mµù¾8nrû.uJfÉÆ½R©AKó›lCeß{l=AäÃÐçCxþ…ç1}o:©îÍÐÖjáö¸)³â ư8w^®]@ŸŽCìMKøåÅB@ªe±Ä1vºg€ß61K@‘ ÊUJ„ÃaŒŒŒ åÅZ¤"ˆ_CƒÌàB”@p\L­ÖG¡¿UÆ·‡©T C)eA,}Z[’M˜D&ÔkÕ¨zª üJCŸ%ovMuÒõ„w‚2Ž žª×¡ÙÞD®L­;KåÍ|Ðð3(Ãq,¿m')O R-#ˆ"ÉÊN¦3m(L‚ ‚ d‚ ‚ ‚ø…@{d‚ ‚ ‚ A† ‚ ŠAànో³Ï磂#‚X h³ÿaSÛ¸ÉeŽã ¬T"Š¥@e}%jö×€×°Sž'ÎOÀÓíIr/ào`üÙ(ý;9†ñ÷Çc'Ï›* ~Qê–êä Âhîwݘº6(¸•T[UÐìРLU&Å;8D$ÂNKæ×óˆ„"‡ÂP®WBóª5¨‘¥3ѽޫO{/8"_ËC÷¦|ó23øµ±¯SåCp2ˆŽpGÆð¤‰ÅÆŽaê›)på"#¨ØTš}5PmU¥-'~½[”ÉïGã”*¬|êø&}˜úa Ú-Zì°µH$Ó›&4oo–¹¯ÞX S· Í/6ç†ç+:»:¥ÃL±·B«Õ¢fsM^ñ·µààkqãÛ¨ÞXýX¶ËBòt¾±_´£ëp¸rÇ3ÈhÙ~Ñëq«t¢9ÀîlmiõãcسoOÖº0Ÿù’o=CǸF\)ÛKô É3°}lf€©ûSÀ K¿aŸAæŸ{Ô=ö€ã8D"ô½Û¡N(º›=»÷ eG‹,ÿçŠå] <£Ø/Úi,¡±„ ˆè@Ì"zhåÙÚ³±ƒ‡>»ÍÏ,5‰7þt#«{é^ÜÁ™Wß¹*š`’|9ýí´ØWÑ'žýuò³Q÷}kûÄéÄÊü¶“Åexï°üÀ«Ú³R\$?º®J×¾¶}Õ}Ú{ÿÅ /^õÿ¯_–¶tù= 4[xÑxö?Ý/>º÷ˆNuï‘Ø¿‰"zµëjÚr2Á$^øMêCäãXøÁY"âOÎE±ßÖ/o|+¯M¿i‡/ç±³«³àûi)›=²}ûcÛ& ÍÓùD¡Pˆm»Úr«?¯wŠÚZ­è÷ÇÚ¾ßïµµÚ”å’kYÏG¾äUÏþ)Š•••â×ÿûuÆöòè§G"Y\£nL=±6ê¿ã¹rNr7|yXäÊ9ÑÇ_t7~z$V¬®¯º¯ñÀI­xöOgi,¡±„ ˆHµl>T ¾÷Áxؘ“[Õ6„ƒ08ô„ï†szN×¥“~ŸWÎß[yRnTBÛ¥M^= Àõ[álú° Êu±Õ9Õs³qÉe¥?Î÷oᙵ н3›–`ìÄ„ýÙãP³7ûª®ïŠ.KkÃÉ”­bËae«ÊÐp²à2¹à»’^Äûg/\‡\9%ÅxØß÷sW+iy™ÙYv~îLZy×mÕ-‰:>6>†ŠŠ h·hÙjøÏg[]Jy% _ÍguçºâBOoì;x>æžçyØ?µã؉cú|è±ÌÛÇlµ:—·7ê jY\Û÷·3?>²I׎ýñT•*Én«ªJŽýñXÑÝ”-/ƒá:ueÜþ„çš Ûh,¡±„ ˆH)áaØ>´AÐ ¨zª î빟’­Ú®’:ßñÓã™U –[Xçßë ƒ?y»Û Ä$[³»­Wäê îwY¼¸r|}òdIxS€îxö Lx&6HråÜœòN¹:6†î† ;š=|Ý[ÙÝŒcñSÈfàµ<8's'Q h^ÑÄò¬×‰SÙÏ×p_w£ê©*Z¶m?–!3³".¦‡ Ô ())±[>ѱµ@¥RAW¯CëÎVöPRR’¤ƒ68Öl®Ïó’üÛi„:!ù¹tÍÓ6þ`€áB÷C°ÿÙžœ7j45¨Ù\•J…Žò‰ý¼5šuj6× ù¥fÙà=pn v_SËQ‹¼®ÎæIÇ¡ö’Ò–-éòtàŒ<Üsy‡›Ž\üε<Ž?†úgêeBŒT¿×ð¨¦''fy¾MÏ&á*•,_'¼éó%Kyd*Ó|ë™sЙ“S¶¼ ßÉÛ&WšÜ9¯8¡Ý,ŸŒk48¯8‹îtõ:x¾òdÝã“˸át ~K}NEi,¡±„ H!òÂ5âBëÎV¬øÕ ˜{ÍhØÖÿ?\W\9û!Ó὞ÿæÖ¨®¯Ëä‚y…õp¿åFð»`òÊÒ56QT®ƒ™íŸÏià sÊÃà­X<*EÑÊFJk¥2c¾EÝÅÓhm„Ꙙγ㿌f.×üwühx®æ·ÍXñ«hÝÙ*éøçʱ?ƒb¥M/6ŶÑä Ží” ]otÁårÁ5â‚ùˆç>>—ҽ㢯wbìúÔëÕ8xè Ì~—îQwÊpR•¿ós'šÓŒ¦›À•s8uêT’³Ö–Vhë´»>]½N¶j=48„ßíüΞ; ÷¨c×Ç P(¤ áÐàöö`è³!¸GÝv ãØ‰c°·&å‰ý¢– Æ®AµV%¥-[R¥Õ~ÑŽßÿ÷ïaÿÔ÷¨öOíø½þ÷rá(‡pS‘ß¹”‡ûš5ÓOöÕj5ÜK~~à“»Œp]qÁuÙ…®7º0p† TÕêê”aæR™Ê4ßz6ö {ãWžk¬o2¼Û#ã›ôA¹RÞð<|“¾¢»ÕZ•TFs7œƒÎ¬och,¡±„ H!òÂØm„J¥BcC#¸Rׇ%Õ~ ŸŸgËå«¥‰¾ À¶ÑÛF›´ZO}W}ìÏ àûÒW§ ֱ¾ÍÄ-æDB³þ¸ðe]g…åÿZà>á†êY · àµ|áùpîc“WŽãrRÈ•¬iåÜų hr4Åé`à…}Á̉5<ŒÝFø|> _WÊ¡±¡*•*i…[¶zY'@Ð P*•pº0ñíDÊ•vYYœ°¢a[T*6HªTª´žúúz”-goxj6×À{«pû%;žk–eeehy¹Î/œäƒs(‚×ë~fBÛ&Áèy« Ûd§ËÛ>´Á°Û ÝoÚÞ$µ%¥R‰¦íM°¾oMŠOÃÖ)m‚V¥-SR ‘G±<]7›§ëXžö¼Õ“W¸sõ;B¡PÆl¥B‰P(”ïçâêÌlŽ8–1¬\Ê#[™æÃÔÔ”å…MÍo™ÑðlƒLµ+ò0 'Ä7Ž“õ·ÅrüJ–O¾»¾9ápÎ/œI†?h,¡±„ dæD©“?LÂÔcBß{}9«ä¤ë€¥þP‘ÜSò›xè¿ÓCÿ>¥¹ê¶jèÇôмªIZ1ò^òÂý¶;ÙÿHaQ5|o€úE5¤¿ðeU_È„m£ Öj+B7CP?¯Fë_[¡ÜX¼Y³¦5’>Ï LY†g‹t?Šà\Ã9„ƒ¹½æêô½×S “?L¢Ç”~ÂêuÃíq£ï½>Œüe$§•7ïM/ÔkÕ²kªJUêImÜ*rÔV¡œ;s†Wb“Sý®YKB§mrçS;Æ¿GÍ¿Õ$­43ž÷ÄûÎ+NI I¨022"SCÉ%m™â.ÜÄx©×ª1þÍøœó4¿sA¡P¤œ¬F †‚P(’W¥÷ߨתáý»7kܳ•G¶2Íkâ‰dSÓØmDW† Ž ò¾ œ“¬QŇ/ËMtòšJ˜ÈwÜpýÅÕZ•$xÒXBcI¶±„ H!rÂï÷ÃtÄëûVöÚ·¥ð×¾[±•ì¨ÙÌtt9‡Î.¶×&þÓÙÕ‰É[“I{ø5<Ü£n4<Û뉘’f“&)îÆn£¤2¡Ù¤a*a º®>ÿ‰yº8¤"U¼¼·¼ÐlÒÌ9ïŠíwû¾vŒ|9’¤Ò°ƒ$G¾I:K?’â Þ Î÷,å‘­Ló¡bu‚sŸ [OZ122û§vémˆù­ØY9 [à¹î‘=ã¹îAÃÖ†¢»€À}–ljoRò7ƒ4mË]¡±„Æ‚ A†ÈA+Àvʆé{Ó°ôXàu£ªª*·gÐw/›ü5}Є²5e9=ç>7aœœÿí” @'¤MØS_àëyÉD¥s·S¦§;v| ¯2sœiÓ¼W,ÄxNx–d¹¨žSIƒ¤s·áYþ„ KºÔº.]ÒAf©¨n«ÎjN´ªª îQ7,=Lß›†í³F”w}ª ­ÕâØñÌû { p:¥ÉOàn /#Q+ˆD"ƒ())å]KZ·¶mÐïH>¸M¿‹©ªX?Š %%%Ðÿ¹­TU¢bulóvçáN8˜ð²z 1ðÉ€äwçáN8.906>;±ù™MŠSMÌ3‘))…ƒCí,Ogß4ø¾÷Á9èDçáÎ9×Çbû­ÛªCçÁN475Ë„™@ €æ—šÑùzgJÁÏ1è¬iEãо·=cX¹”G¶2ͧžÕhj0uw*§|°²ÁzŠÎÃû&&\ÇïßißßߤOj®+.ø&}’©æbºß-VÆB­Pð¸áö¸Á•r9 Jc %ñK¤ìp1ƒ¬ÊÅÄ#‘àâóÉVãRžÆ<«?]QWa¿ ½Ÿ83‘×FØIųH¢¥œàý t³û¨ѦnN±§¡‘0Tµ*‡…”(e§1—Ï®‚®¯€ð¦ SIÈtÚñÄ™ 8þ‹½çŸæ¡¿®Ïû4fO4N•oñîs:ùó¸Ó˜¹Æœ.nöívxÿÌV¢1c™ç"°¤:©` žáyh·h1äBcS#<_yP±ºªJ•äÖü–¶l’½²\‰c<&mjêÙs’´}hƒùm3ÊÊË P(0ä‚r•2e|Çÿ6Ý3º¤óI¢÷@ó´îQ7 û p\t@µZ…H$‚þûe“2ûy;zÞê‘ö˜ºMhÜ[ý87€ž·{Ø^Hú]zÙÆñ\Ò–)‰ÏÇŸìǤ“»Û¶ËNiÏ%Ütäëw.Väìí°·²SØÁÌödÄÇÆÇ°gßx¾ò`÷ÞÝÝ!À7éƒáÕä3OJJJÐÙÕ ó›æœË#[™æZÏ¢ùd|#ù …±ÛˆST¿Ãá0þÏÿù?)ýàÊ9™ÙZ÷¨{05ÈH$‚¾w“÷¨˱Û÷¨;ouãø>¤ãPÂðž´fíi,ùe%A‚ 2ñD`ØmÀ¹óçü1H™A>0””ÀtÄ´xÖ‘~TÕ* œ ‡:`}ߺ¤ÏÕƒ¨þ—j }6„MMÁþ¨Ö©`;i[r¶A,%HµŒ S†‡Ðº3¶šà¸èH©úEÙP®R"ü ,0©Ñh/2Ë€!ÇŒÝF(•JIpq{ÜÐÖj—t>6¿ÔŒþ“ýsb¦öGB ADfè A<¦ø¾÷aϾ=LÀ•sLм½–‹´á™ rž€oo†÷¦á™0«GG-‹§àAìùŸ=ÇqàÊ9 œÎâYŠÚŒMA‚ AAADjHµŒ ‚ ‚ d‚ ‚ ‚ H!‚ ‚ ‚H ”² ,ïZàõÀ~ÑžÖž}”àdᎴ6ê'ÎOÀÓíI²oOàV@²óŸ‹­û¨»¤³B ¨¬¯DÍþ™‚ ‚ ‚xœ Íþ Ô 0¼bLßhà»ÆnK<ØÊ²Ü‚ŽYÝ™KØÁsªZZ=­ò{ËÌ’ “ÍŸl~ú}°¿dGd&‚&[ªwVSAA¤Z–ß÷>' Áƒð\ó a[CnBÏëœã¢ë*ÞYªm*`pèß,gAAA‚ÌãDøA¶m´ªžª‚ûº;ÉcÐú-õ9½¹2/3C8\¸ cYÎÎqº…¢¦Sµ}ö †`üô¸tÝ}ݪ§ª hØ>´-éÓ³ ‚ ‚ d~ñ¸F\hÝÙŠ¿Zs¯ Ûà¿ã‡ëŠ+É­sЙóÛ˜¥ ¿6¶7&p=ˇ+.øïøÑð\Ìo›±âW+к³®U‚ ‚ ‚™¥‚±Û•J…ƆFp¥†/K*eüšäðápÎ/œhÞÞœÖOÛF›ô)„À7Øó3ó”ð屟‘‡¹³†‡±ÛŸÏ‡áËÃàJ9464B¥RÁØm¤CAA, ~ÑVËzL=@)ÐûN/ ¯P¶¼,£{×_\P­UA¥R¥u£ÿ.fA̼̜wœøM¼´1?ªZVtÄ~r .­3¡N€f“ê j|í zL=0¿i¦VCAA,:¿è72~¿¦#&Xß·25ª–ÌjTŽ‹4moÊÙÿxKc…µvVl·bêdéL0»F\hmaêvÖ÷­01Áï÷S‹!‚ ‚ HYlxž—,u »†Áq_h”©WÉ™Aš¶5-x<]rߣbßfÏêÆwq6]¥€f—&vÝ烱›©Õ5¾ÐŽã0ìŠS·ãéÜ‚ ‚ ‚™%… `;eÃô½iXz,pºQUU%Ýw{ÜàJ9Ôl®Yð¸¹O¸svëû2³ùdß î^æ_ÓM([S§«ªª‚{Ô KÓ÷¦a;Å,¸AAÄRƒÄÌ4é÷ù¤ý0‡:~†õ¤UæÆ¦¶!8D$Â6ÍóëÙ[ ½WŸÕÞ«ÇÄ™ Œ¼6‚à˔ʕò2ÞJjjVÞŠàý d@Y!w~FǃØÔ6n22Žã ¬TJû+ê* ìÀoæÓ¦— ‚ ‚ HyP­SÁvÒÝVeAAA,2¥”¹A'ÞAAÄÒöÈAAA‚ AAA 2AAA$ÈAAA‚ AAAÄCVËò Ý™1Q‚“At„;ÒŸs~žnOÒù.ñn¤3cÒù“*^IgÆ„"@)PY_‰šý5à5ü¢å[óöf8¿pJéEqNþ•”]ìw ˆz'Ô¾I`ê@»…]‹<¸rÀò»ý"`=Dfb× ¯­-rwá0ÐõàºÂüŠaýá“X?º|wسo\_ºÀq"‘ô»ô°¼k™·yMt<8Ø>fõ}ê>û6¼ öÉýu{°~1úÞMž ÃÍb÷¢(Šâôô´8==-™9[{V4Á$š`Jº×[Þ›“»èõ³µg“r/›Ÿ·?»-ör½¢©Ô$ÞøÓEÍ7m­V FëÛ\D±³‹}½Ku­÷Qä8Q¼ý8w¯‹¢¶VýþØ5¿Ÿ]kß/¾e‡(ª7ˆâ£Ÿâò»‡…sãÛüãHÅê„4ä·|ÜžŶ],ÌøüÈ'~íEQ»E§ïÅ®=úIžEÅÊÜã¦X)Š(ÅÊÊÔ÷‡/³rËTeÔØýLù’ªNˆ¢(*ìzÓ‹©ŸKLw¦z·m ú¬¶V»(Ï/6™ò_¡`õ:—ú\¬xä¿_™òb1û¤Å*#ŽãDbó óÒóIד\?º|£}zåì Vÿëz±áù†yŸ×<ú‰ý¾œìÆÔ7o¸#Š\yÌÝðeöß§øn³ÿ#Õ²4ø¾÷Áxؘ×3ÂëœÃÕuïÀMÕ6„ƒ08ô„eix•­ ØÙ× §°;>îEÏöOc'€¡Ïc×ç¦mòU{ãA¶2Q ,ïÄ~ç·|Q*Û)@½hn),~Ö,.ÑÕS€åÍÙSùå Ç»_&'ÙêR"æ£@ËËéŸ**Ø*•íc?ç—\9ж‹•¯õ$õy3¡À¯¦|xYJ}Ò|aê1Aó´íÚ©ÀŸ <׊];öGö63êN·•ý?öÇâ»É„ñ°q^Ïb$A&Žðƒ0lÚ hT=U÷uwÎÏš—™!.\±,g¯"…n¡¨iRmW±3Àøéñ”i®VW£¤¤%%%´ÂìëL!éš4pŒ¸ Ô ([^†ju5ª7VCߦG ˆåÇ›f(W)ÁóמçQVV†ÆmÎêLåZ®Q¿TëTÐÕë \¥d~=×·Ç-ó_·U'맺¬‡>)Ÿ11—²¬VWã`ûAŒÿmÆncÖö\l,GY_ªÛ èÿÀõR¶sò¶a9šÁ¯z u'Sc*)‰µ¡Žýï8Àî•-gÿó #›·‡]¯ÙÌâÒq`nmPÐ ÐÿA~ ’¸Èfk©Êp¡([L|—°0—b£ˆó  MPÕhØõb»É„ûºUOUAÐ °}hCøAñÕñªeîa±eG‹ÈqœX¹¶R4õ˜Dÿ^ªeù¨„¥R‹WK+–j™(Š¢øSìÞ…ç/ä¥v’êÚðåaéú%ç¥Yµ'¿¨P(Äa×°(Š¢ØgícnJ!úý~ÑÇ/¢iÕj´[´Y?¹’ôZ󟢸{¯ü5¨befU¤Ý{åêQ?ëŸÅ Q|ô¨x*)‰*ùÆ­P5˜éiv¯ÏZÜøåCÔïÞwXØgb÷žÅÛ·3¼¦þ§(V®eß±òmx6?UŠhøþ;,]•kåꃉiχ|ÚÀðåaQ½A->š­XgÎJîúmýYUQæú¼æi@ܽw·tí’󒨲£%éYYzf¯õYû’ú®œ“Æ®œ©Õœ8;oí>UÝM¼vÁ!W1½ýöÿÒgqåöSS’úß?%«CeM–Ÿwüâ‰Òµöýí•k*¿8ŽNßÉ›µIDATKº¶ûÕÝK®¬–JŸTȘ˜KYæêW±ó»ß6[çoÏÖùÛ¢XQ‘Ü^úŒ©gFÇÈéi–Ï}ïeö+ªž›X¾š§cãUô~.aä⦲’ù+ŠL%±P5&©Üñªûªè÷û¥¾9×¶±e˜«:àðeæ¦÷8•ÆryUÃäÊ‹ï&þ;~ÑtÄ$VVVŠlj-;Z¤9cÚê“!ÈDãŸîóè§G)*G§”©m»ÚÄ«½š5œxÁ¢C¿ô)Déåz¥ç{¹ydâï=svζv Ó ­¨¨=ß¶«Mª”ê j€¨^¯ŽíeX¯.Ú™\¼v <´µl‹l"Ršy"ÒÙÅÜ$«™ß'Š-/'ësç2€W¬fq‹~Š7Ä­IƒøÿÛ;ÿØ&®´ß#¥Òd®l+[)Žh…£ò 綯b_¸jò.W‹Sª%i‘6)½"ÞÞUqà X;YµN¨ZV…´-¦Ú.a¥‚Í«¦qW°qª¦ŒÑ²uÐe7F[Ô‰JeG-Š­„­%ÒÜ?N<ãÉøglÀ´ÏGŠ’ŒÏ9sΜÏ™çÇ¿Ôú´å¨ßr™{÷ØßÆõìÿ/C¬ÏrMàç}òb&Š¢Øõ*K‰/Ȱà µ½L)‚LIcà_òØK×·F¡:õE~ä]&ti4iÓlý¹U±È¤¾k|Z¾Ÿºuuªk©ùÁôŒI%(™6š¸n|®kæ&µ=TÛKìzî¶Å#ÃFIo»Ôµæçš—Õ¯Rûþ+÷µTþ•ÔW•2'•"ÈäêËb™raÚ¨~æ;vªçCs“ÚÆl÷yN.&/@97SF!i4Qlþ{^ÊÑ¿º5ºŒBH!cÉî°A¦ù9õa^¦±¶4¯r¥)†ËŸ_»vu±—uu¢£ÏQRûü`¼–­\¹2w‚j@¼¯t£0èª#oýU;jVÔU¦íºM¡ZV´ZÑF=:ƒ Õ²²s'íÕ£¦teáé¿1ýýå{|ÏiôwøF Ñh¤ké? 2y¸’ë"{ËD,ÎÒ(úº‹ýðSÌëËéßóxe0ñÌìRzQÒ¯]R·Úâë¶b‹ZNZM‘õËÓvËzM^ÃtÞ_îdjØw—vOÅŒÄ Âÿ©ѹ(´mZ?Å R…)åû;;ÐÝÓx<ß9Zš[0sc-Íj{=M­|úUzÌÞœ…pSPÍῇѰ¡Aªƒf•ÑÛÑGºFL_S{Ô3®üciã"Æ<¶å~æ3µ§TÖ¢îO±ýÊ¥*üDîk©ü+­¯*iN*w_>*Â7˜G8…ºy]æ±!|«T•ŒÇÄBñyeêÃBË($÷#fKÕøïLí,ÝNdYê÷k Y÷9•8eÂÙÔpÀyß’9¡V­J˜L²ëåNSœ:°¦&Ÿ6âÀo`Ð5˜QM¹P~0‚ÌüwóEßi$çÜ'Ýèsô¡m{l¯Ú2.ày¤ûÎ’êß{§÷´Kô¦<è¥ æ|u~Á„/_yM@èzŽÉ? ´lÊVWöÓùKàüOæöu9:ºRÿÜ*¾n–¦2zc¿—ê½R¿p¸üÏ@g3ìÞÏìŒ96<ßÏ¡kéFnù‚ À\“ƒÌ^Æl~xÏÿ‹/Âÿ‰Çáë~­ÔÕ^xðß×jµ°þÜ ÿ'~¸Oº¾Fç/;Kº'ãÓF„®†*jÜBû`n¸ü¹ìV½ªJéýqy.·¾ª´9éÇ´&€m'0pøÁÞW!eäKÓ²˜ 1aæ?þÐs ³­Íú‡ŽáëÀøÇÊ‹” »½dý¼­@Ë•¦P“xÞ÷ÀwÁÝ\o¸`Ûe+© ~0‚Œvµ¶èïèõz89á<ääáy߃ÖZ¡Ñh`Ûeƒm— †bŽÛË@`-G ¤¼Û¼hËí^¸ H=mÚeÊý$,Éù40¦&¯ýVy*a1[`{Õ[— ÆõF„ÿF<O;U‰WÌf¥g/ðV UˆFo“ŸåkUUÌ#ÈÐQåâY.<§å8*»wÏ·å©›¿ô2‡ßaFîÏW¿ž½@ë ™ë7þ)ðâ`>¢ôðV(#G™pèx=wº³bþê— ‡>{k¶#l8ó!ðßÿmhKÙ,3üöK‹fºÁ}¡”ú}èêê‚ÿ?‚W‚˜þû4fB3Ó¥;,HL×Uóƒ0«ôP3ôÎ&''1þéø#÷¦@øæ’ƒ›ìzŠÉÏ㙤–“ûxd”£_s·GeõUÅÍI®‰‚rµ·q½ú™f³ŒðÒ '{˜,.¯œã/O…¤Ø[9~Š9æp/¿ SÌØx”û÷ `r÷ÉBÌÀaù0ϺEm¼Ê®§(WšœûPA€ç<xÇÑñR&*GRË…¼–¥mÄ=§=˜ÿnCƒCà§xÔ××?ôzðÇ ø…Ïr»³ÆðGX~m¿oCÍÚìªs¦§M‹“Üüɼ[N½þ›››“sèjá›at¼Ä\ÉØ_³/nˆފ"z+ŠðÍÊ92kÙ8틃´1‹² ¬ãuµ Š÷{ -¤doÚ·—^çoå¿[·1—ÄÙêÖ³¯´Wé±Û„oÞ³Åׯe ;ëìP¶‡ðн^žÃN°X­FSžMÌÙ©ê$oÛ|¸ß_~ûÔ¬`¯ççæ€x ê*ÅŒºº:ÅØË¶¦TÓ’É$b±˜¤ [ê÷ ýùvésÓÓ&žÌ|€¾F4Êîgö&ÛÅØ^•OÓ‡L็÷œ—=sßÇà>é~ä®g{252á+ù™õŽCÊ_`R`FÏehÇUL­"c‡éå¤Ð~].•ÒW•:'º&.—\ã±\Ø÷,>ó‚|æÿ4Ó³ø>IóÜxŸ©+¥WÌ”WàR1Ï[þ2 ISUż¯@L-7•<¥ óîã¬ÍBט·¿ÐUÀ}2mÎÛÇ„ÍT?.±ÿS®šË™&õõõà§x aþ»yxN{Ê&ĤøÑ{-ËÆ×)÷)ƒïõÌ(_2ö_J<µþ”ÚSH†t¢(ŠÿøÃ?Ä݈tÝUíGt#ŠŸt§©ÿSé—¦My:;µþ”ÒÀúSâÈšqd͈xþ—çÅÈ_#ù¯øËÌ¹š³¥ €±èù¦ím ÏDÍÏ5‹\-'×Eó&³øeèK¥ƒ7\¢f•FÔ¬Òˆm¿h“ŒŸ±h½4}90o’ òÍ›ò§?ï[t°IvpÞ§Nwämö™dtÚÄŒ /ó…Õ딇yq˜ÇÓ3ÊŸ¥Æ«)oI©º™6f¯[¾öPË6±’=”ã–S¿TÛ¥*˜›Š«Ÿy3ÒMµ}¡ýiÞÄœ-dòP–úŒã”é3=ùÊ?ïË|ßÅPè˜LH†ó¦&ñÈðÅØK9 qˆ:Núþ‘á#eù¾dTûÚn•²LÍ;;DN'jViD×j'$Ÿ|ü‰hn2Ke›7™Åó`óôÒç<ÛµÔ¸2m”ÇUº§)OJ§~Ï<'ŸVa,ÈDšÓŽã²^+¤_ Í+ÓµJè«Jš“–³&ÒÖ™þ/d<– × {^›ŸcÆù)ObæMJ'8gFågÚôŒÒ{œ*¯Ÿ1+=û”ßÙÆ]1eäK³{ÏbþMl ù×e8cÉÒ'ÅÌc…äñ ŒýïÝcÿgúYêIìòç¬SíyùóLÆ÷åISè^ºÜT- 2’ïz­V ‚ *‡7™äÈ»Ì0ž 㟎ãùžÇüwóªu e›an2ƒòÔXAÀ¾8{Nù&Œ(?½Ù›–Äj‹LjAT8Î~ðíÅ6Рʉvµ‰D“““èx©ƒ³‚P1>Æ‚`¦ˆFß…Ìj¾Dæe­,¸ðAÀÜDm’jj‚¨|:;”Ѭ ¢\×QÿT=ô«ôÿXmÄš)‚õLx†Ž ~D4¬âß3F®ˆÎ;¡Aj›u+s<Ãq¬½='¨M²AªeQryÉÊÓæq+ó‡P7‚ ‚ H!‚ ‚ ‚x$ AAA$ÈA/Ñ[ÑǮ΂ PÇAü!cÿ‡„ÇèAôÛ pmÉx¨êšëи¯z K—¦·…mY?‹ÍÅ€$ oÒ£åÍè7ë1ðÄôëäÍ™Ú!6Co¢7gyÒ&璀бæ®Í«å¼›„n£{aØbÈÚOúzØxP£üïîcn˜Íf4>Û¨úìA•Y Þ ^ôêWËã8`9Ý {/xá>æ–¢~,fgG§<&§CèÞÛ±Ý3ñ Ú%W?d"4Bïþ^&Òs#Ì ˜ûvæMf)(ã臣ðüÑ,s·ç€vÿö½vE~üîýÝà8Éd#GG`Ùl){šîÝÝèØÙ¡hÿR::„àTÞ ^š¿iþ&¢‚¡€˜‰TÐÊ3Mgä@AÍ‚gV»ÄüáyÓKŸ¥μüöeÑ—"ðåüÿ›Gt#♟©¿›J?²nDœÿ§Üç_ûY]&öL(T5‘ê"åÑwYºö¥ç˼é³~ö/Q<ÿÒy)@h䯎ek‡T0Ð|å¥êyê™Sâ½ïî±`RßÝOmdAD/÷]ÎÚO.¸Äó¿Èni— ÑÑçûm~^ìÚÕ%êÖèįÿYÞ RKËEQlûE›8qq¢ìÏz¦²t™¥ ÑhÄ®]]…'{Ý!š›Ìb$"·H$"š›ÌbϾž¢ÚâA·K¡e§Æb]]øå_¿\ŒÍ!"-Û½ÿº'PÔ5•Æ5(‹È7‘«å¤t'D®–#ßDÊžæÞÝuktâeþrƒ7šÅ38Có7ÍßAT0¤Zö Ô¾à<ä,(­a›–`ðÙ|HÜJô½–¾éïéãÓàj9蟕OÁ´´0÷™Õ'y“Q~ÃN[ÛÞkƒöIù¤Ð°u±.…œð§¥ ÿ)¼üÆzhy{ñ^€Ðñ,ûòסqOþfá’€€‹Ý«õ„5«ÙÑ\ÍêXOXWÂ¥ìj)áÿ #p0PЭ89!|UšŠ‹V«…ç´ÆõF´w<ø7Þ ^´liyèo?v™ùˆÇãЯÑçM¸Àà‘Ax}^èõrz½^ïG^ Æø§ãe»xþÈN« y{c|Ú¨¨kϾ–ÇûéÚðï†a¨3HéZ¶´ÀPgÀðï†Ëž¦fE ì¯ÚÑ{°·,suìû‚W‚°n³ÒüMó7A 2e"q'Ï{XÌÔ?Uþjáѯ Û ÒB0ýÁtδC+†ØBÔ//±ocHÞM‚ïç´È¯»ÑyI©jÁeõâj9è›Õ7Ë›´Ë¿™J,È 6WË•¶y_#/Æñ[q´¼“¿ü–ÃùÓ„Ž…Xý4ÊMèÍzpN‘N¢0½j’Ûì™ÓùãfðWyÔ?U‹ÙÏ{$î$–Ý&=û{0ý·i„®Êu=;ŠFS#,›-h45bè!õføœWNól#Úw´g]œ-›-¨ªª‚³ß©ºÖ{°ö½v4>Û½^ñ1ysš¡uk+,fV† ðžó*òÏX6[*@™Ê˜ªRú½žÍX×\õÊF!yg«ïR† £ù¹f…#=Skõh~®'Ž©þ'ï&aë²±M¸Á è»™ðLöv)¡Ï‹¹/ðù bjVÔ`æºr4oj.È‹'Íß4A‚ÌcK`2€ÎW:±ò§+1pdÖmVD¾‰ p)Pp }â«ÅÚ¦ôŽ®V`´yüa±ë1õ)×¶©Õ®+Áþâ>ümPZ--%µaì¦\OAS¶¾‘îµN›³ÝRéÒiu·Âðœ¬íûµÑ©Ü}¸@䛬[­xk+º¯tJöÅ`ibm¼ÊÚy|lÝönŒ<~ŠÇD`ÃLJá>æ–¾3>6Ž—_ygΞ?Å#t5F£ÚðI ÷Ÿõš÷‚CƒC] Á°Î€Hi‚SA7Áy„¦CppàÅ/J›ÛT¶]6ðS¼¢œLez/xñ«_ÿ Þ¼à§xx?òâW¶_)„”BꕉbòÎT_Uû\áѸ!ûfßh4‚ÿ›úû£…³Ï‰À¥èûmF?dUƒ±!c™¥öy1÷¡k!ètºeµàöœÚ_“md„YÚUʱ§×é!Ì eO†u©J«ýcþ¼ochþ¦ù› d[œýN ´Z[ÁUs˜¸8!©)è×ê‹Ël…ügònRõqôZž x60ãÚ¥4÷5Ëÿ,ÂgŽÜÿæ†w›H;XJÆó_æ!œûI7†þÛøã< ?7Àþµz³~ù yðïemŽã RK(”¼÷Ê-I—Î@›¯MÞ0,£/Œ"&ÄrojÖêáìwBL\œWÍ¡ÕÚ ƒÁ :mϹ¹©]4гò¢m{›ôliµZ´moƒû¤¼©<<ë6«"»ç=ì»íE·u‹5+˜*‡ÅlAø¦¬~bßkW¼èü%;5Î&0åcøaX·Yax’m< O`ÝfÅàáÁ¢êUjÞ…Çsž`k5ZÄãqu½·Za0(ë0||8gY»Ïçææ¤ç®XÀús«Bµ+y7É'¤9ŽSÌqåJúU¬„[BIsu"‘€ÿÏ~´oo§ù›æïeÍßA Sñ º1ûí,\ƒ.Œ¼;’Wm#ßb ÍÍõ¬­ß¨‡íº ¶ë¶Œ~æº` Ù`zͤ:½ ÿ¯Î?¹¼ªÚ¿²Ãø’‘mþ,äU¥È…gƒî7â7â0>oDççÐn(Ÿ§®¼÷šÌÞæP£­A‡¿Cú<Oâ¬õ,±ÂT,›-yw®Af¿Å «ðÍsJ€ÑjX{L_›†ÿ’_R²l¶`rrR¡"2}mÆuƲ´]ú xÊ‹—T·X ½û{Ñø,Sg²´X²nâ !S½ëŒ˜¾6]T½JÍ»4MÎûŒÅcÐhÔ§ÒKíoŒëŒÿ=œ·î³Ï“Éä²üX:û¨ájpÞw^9þj9ÉUzé‚`¹Ò¤6¯™žÃbçêÀ_0¬3H‚'Íß4;A‚LʼnDàzÃ÷I7{ݱüWÐÑ›ò+ï” ÏlôÞÉl̪7éÑz¢vÁû?í0í’u„…)ù„ÒÐÄçtu€biy·EZø·xʼna1Ø®Û`¿e‡ý–ící*=èR1<³x¯³™ï5u=Õ&7ôOjÑùq§´‰ÝˆÁ·Ã—·ìÀdLÅ}Ò ×.D"‘‚ëžROJ· °í”U„ø)3×g‰qjûŽvø/ù1qqB¡²”îŠø‡Š¥É‚ÐõPÖÏÃá0Z6•Ï`ÿaöy!‚áR†Ž!|=ŒñÇQSS£uÄn+Ç^ìvŒ¹/sÀ}Yð)e®ö]ð¡m{Íß4/{þ&‚™ŠG¯×K^N&à8­/´*^MŠpa1m5 XΉv¿¼<1 8eÒ>©E«»UÞ ¬–vË~ùô<:©ÖÝ2 ïoβk´5°¼¾˜O<‰Ð¡Šì£Æ½R—ê®GƒQI%!•.k_oÖ£í÷òÆFø‹qÃ'œýL]¥õ…Vp‡‰@š‹¾ð…~øa˜ž1IÆ×¦&„ÃaÕbÛÒ,ošMM*U+g¿³ì*“ŸMºÕ*Bß/-¿Lõß Ã´ÑTr]ËwÏÞL~6‰hT=v¢·¢˜ülRK¢ßFUu0>mÌ_÷‡Øçº5:Äî¾AvŸpcrrÞ¼ÒÛÃr¬ë«dã•"x5ëkÙÓ@ô6kã¥oRŠ«}c>´mk£ù›æïeÏßA óXa1[à9íÁüwó?Å£¾¾¾°EpL„h·ý¾ 5kk ú<Í uðÿÚ¯X g.ÌH‹«e¬J¡oÖKî2ý»ý áб¢_D®A³Þó‹ä­&x=;ŠÁ·™F2 Û.›Ê¨Û{΋ÁÃ’]«ß…Öm­ª²ø)¾ kT‘Ýg®Ïàå®—‹Â¸ÞˆFS#† C·F‡‚~­ž÷<xk5µ5Ðh4÷C»Z›±L€¹Hþݰ¹»ç@"J{!õÊF±yçóî0ohîcnIŽ«æ`ßkWˆ‡¦CèÞÛàAìÞ³ñÛqD£Q³쯩cžTUUÁÑçÀÀ›eésYû![;9«~CáìwbÐ5_“Ãÿä'?ɘWË)ÜÖòS<º÷w³y)™ÄÈQµJ¹Ò8ûà§ø¢U|ÓÇmïÁ^$î&à>áÎ;Ñüýãž¿ ‚ A† ‚Hd\o¸w¤û€¡Á€ÑÓ£ !¡÷`/Ü'ÝW#‹¡áß0þñ8MËÎÇð¤žžŠ ØJAd¦šš€ âÑ ]­EäëˆÅd2=ºÊ<ŒûÆÑ½·Óצù&‚š5àƒ<ÌMæŠnÇöí8uâTIB ŠìNñ˜Aod‚ Õ|{;Â7ÂH,$о½]ŸçQû>†îÿÛééip®–ÃèéQ)O%FÉ› ‚d‚ ‚ ‚¨|ÈkAAA$ÈAAA CAA±òZ¶ †Ž!8„÷‚7«oý±Ùz½YýåÏœ›A°?¨òµŸNôfTŠ9PˆßýT:U܃x¨êšëи¯Qo€ ‚ ‚ 'ÈØX6[`ÕŽÎWXP½Qó(„+ÌmçÒ [C+†Ð{§7oº*ÏÐd@g°SùÙ’ “/Ÿ|y c¼;¼H.$ÑæiCÃ+ Ô¡AAÄc©–eAøJ€óZHˆ}CðJÖmÖ„ž×-%×¥¥¯|ÁÙ Û °° €ÏæCâ–äÎyÈIq‚ ‚ d7wð¼çÅlAýSõà¯òª4¾1š75ôæjà‰X-_ZÁbJXú-e½OÃöÅx ÀôÓÒuþ*ú§êa1[àyÏSÑ‘¼ ‚ ‚ d~ô&è|¥+ºG`ÝfEä›—ª´þ1Áoc*ý:Ù6&z5*·Ã¥"ßD`ÝjÅÀ[XùÓ•è|¥É=$AA 2•‚³ß ƒÁ€Vk+¸j'$•2ýZµ!|"‘€ÿÏ~´ooÏš§gƒGúYÑkQùû èÆWÈ&ï&•BÎZ=œýN‚€‰‹àª9´Z[a0àìwÒˆ!‚ ‚ *‚ÿ ^°<•4†oIEND®B`‚astropy-0.3/docs/vo/images/validator_html_1.png0000644000175000017500000006677012243255342017777 0ustar oleole‰PNG  IHDR•‘{pbKGDÿÿÿ ½§“ pHYs  šœtIMEÝ94[o® IDATxÚìÝ|Õ½7ðo4ÔMt‡‹º«Øf)ôaSè‹]ĺ ø¼²‘*»bK¢¶$Ð{Mb[I´W´’DK¨WMð¡$X5 ¯ ½˜+fÃf£ ‰’¥€Y 4wV¤»#¤çY6›ÙÙÝü ÄÏûµ/^Ù™3gÎ93a¾9çÌL‚Ëåb BºM€h Ñ¢%€QöM™à-‚ 8Þ€h),†aÇìm6g¯-É9O9¬-Vã"“i²b‰–ú¾UmÛk5.6ë´:uˆ^ü³¼¯ž8QèHk¸väìuª”*rhéꉉHp»…¾Ñ˜:=ñ†‰îsî¡L}˜å 1‹gÞÒÕ'n³ußo˜Â»y3½59Í7M™Òs¤[¡PŒÐT+¯×ë8îèííõžó›Ä*•JuŠšeYœ%ˆ–b •Z»z½< }‚Ð'0}ÌNï#"2h”înúÞHLN§³ýãvNÁ) ¥R)§àºu9Ž9t³tª[0~€h)ÖP©ˆh¶anpWO“gü$ ð…dÔª…g·DÀä<él?Ôn¸ÕÀ0Œý˜ÝqÌAÒó™ú&‘iÿ¸]G˜¾¹b˜·ä•˜DbÚ¶§{›­Û÷¯­»ÚÚ™óR3¹ÏðC™ÌÔ°¯{›­»ÁÖݰ¯ÿC}Ä$’iŽÆüì¶):Ûí®Ùå^¯·ýãvÃíîzŽeXÍT §à„>ÁÙ딂IuŠºýãv¯×e†<Ï×l®‰!Vs:KÖ– ûquuô†86lïhgY–.ijÓöýí Ñl[±¡ÂyÒ}α¶jÃ^ §ÓYö\Yà’á*Õpâhj7háGNp³ Z£èÛ<¦Êå4é£ ã[´]4R¨d?Î3 Iw¨ äíY‰ú„ã§DÄŸs3I,Ã0ñ¨÷Œ—I$÷€`H òegÔª™5ÕÃØÃä8æ`“X.‰£ ÄŸã­»­q˜pN "¡Ops¤ÎL&CA§.ýÓ/y7ßöA] šÛ†:­.úÐ0βæI ˜ºë†Òª*•ªà©‚‘(Õp#çÌ06K”m>ú u 2ŒÿhiÊé­]=öS<“H‚?˜èómÍ D”ÈP"3ô }%ú²$_ö ]ܯ‚a •ûÉa ˜§*¥ÊÙëäݼã¸#¸Ëª··W7K×u¸+d´Ô¾¿½­­Í{ÎK‰¤ž¬¶dXj^«!"éë‚§ ‚‘÷+oýözç)'§à´s´þÜ|Ë{ÔGª•y‰™MfCî%ø¯ÿ²ue½½½ Ãæßnœ{Ç\"b¯e‰Èëõ' "º@EÅE5oÖôöö2ILÆòŒŠ—+Ú÷·Ï¾m¶Çã‘Mo÷~åÍûe^ýöz¡O0/5Wn¬”8Î̇3ÛÞoS§¨sÉõ7K`&ÒWñ¼(…n‡:4MLõ lÕÌ™U›ªLKLm{Ûøs|ÑãEÞ>oSC“Ãá "ÍLMúâtYïBÕ¦ª¢'‹|e;ÔÞ¶·Í{Ϋ™©I¿;ÝMJ¥jßßÞÑÑ‘ýól­×¿¸>÷Ñ\Žã¼ÞH{‘‰éËΙpÍ®ð±6¨ñF»ÝNDM&áÎ1ùÁŠ®F²6—òï8Ø‘•íï%ªx¥"ÿ±|Õ‚uëjkiãÝ<7‰3/5s×sÁ§y™90Ûí¶î²n"ËÓ_€aŽ–®ž8±¸¦µ~¯}ð¿Û†ã"ÖýA)WidÜô½)=ÝÝŠ¤!LÂ9ÁÙëtžrº¿r¯U$+ÔSÕ …Bêd ¾"6ílÊ|(S­VÓržrúÿ—þ°™€ˆê·×3,SðxWðÖn© ÌÓ´ØÄ]Ïy½Þúíõõo×gfd†Ë¤?8éÌËÍk~·Ù¸ÈèýÊÛöQµîi}ÛlïY/M€ˆ2³3ííM©šTïWÞŽ;"4Ôƒ?HD='zˆ(Ýœ^_P±¡‚ˆ2329çr¹Ünwº)=š6·Ûíæ%æ˜êتN§“ˆÇ¹äJWúú-õ ËîPOUG•ˆÈ~Øž±"ƒMdëêêß®ÏÎÊ> |iX¶ñíÆÚ-µÊ[”þ¯Mo7efeF8÷¢7ø¼%WOϚ̹M[ªlµGþü0Ì7ïvòg"}û›ì»kìiïÐøäæÝþP‰™ÀHA’"YADê©jé9áBؽðgx¯×KH¥VE“Àû•×qÜa\`¤ Ä&³úùzJ6™•®%,ËõFçqgT{Iô]xžg“Ycš1š<Ï×¾Y[¹¹2U“*íÚ0?ì<'þ4_ÿ§ú²ß–±É,›Ìæ¯Î¯ÝZ+]±Zv·?W̲¬J¥*|ªpð:`($Îú‘Ô€òödYý|½ý`¤ÈÞ8/DJ©X–Õh4ö}Ë;vhµÚX÷ß!Ž&MÈÂGߌ^¯×n·iÑ2è íöömîo–!ÖHZ«™©éøÈ‘Û;ìRÃF`ZhbY–&áVƒoa¸4DºY:ÞÍ~uýñ†a8Á¾%&‘ééî¾iÊ ‘bšö’—Ø}´Ã¾»¶õÝf†a†e†6üÇ0ŒàˆH=M­HR°I¬ã˜C¡P8NùFåÜn·³×)OÁWµÌ‡2mm6ë.+§äL‹L²ÿˆC&º©8…oŒÀÿ9ìk›•?ÃûÇ>!š½¨Tªæw›K~[RðëÍ MÙoËdSÈRÿfjT£Òµ*U—ؽç_®Nñ½wO5yðëýÝ?_}}í–Äù{eíÉŸã# dÊÀRéféê¶Ö'ÞsÞÔ©±î%ÖC,ïý Ÿ&d¢oF©`U›ªdÇ1\›û›eˆ5ò7lÍ–ãB£ã¸ÃK^)L€eØþÿ¥ú¢HCÔßYj“À£ 0ÌÑ%’"IÑs¤û¦ïõLÂi‡àºŽyK^AÎÉsf’òPI¡à܇ᤠ¼›w«T*Ítx1 c?d¾ˆ¨c‡J¥r:áþ“U«Õjµšˆl-¶š-5O š€Ibˆˆwû†$x7ïï¨ÙZc^fNšJÈápÔ¼Yå^Œ‹ŒÆEFi’Åláy^Ö,Á ¤ÈÆ~ÌÍ‹ó¤7Æté–Æ§dËÇÒ•Ï?‚#ÍñÎ ¾¹Mgú;:ìÒPÈPê;ðÜ·§? ݹRÚ6°TÒÞY†í²w9Ž94ÔƒÓ^â8ÄýRÒ>¦f”6É}$7x,d›û›e(5ê?[nQqI\×á.ûAû%y]càQˆItOH$…BÑs¤Û¾»Ö}ôb_úîZùç½ÍC/PË+y[Je)~ •T nXî‰ÓLבã¤ÃyÊé{Ø&Ã(&)–úJô]43BDKÞ¯¼Ž£ßÍÉÌÅ9ï CD<χKÀ&³êµu·•.×ëmÛÛ6 K ‘¥ äýÊkÛk‹°—?NgãÎFi Å>JýK7…NÀqe¬üùJÇQ‡´ÿCôÇ\Ï™ï3äHõ’2”z­Ò¤­yj×ëåOó¥¿-•Ò§NOU(¯V‘ó¤³t­oyàPHLõ lÕà>Y{jfFê?°¾ßŸR7SG¡h´3µû;ìv»n–.޽Äzˆk.M¸ÂÇÔŒÒ8cÓ{MÒm¾4aËÆLcªQ8Ú9Ú¶¶6ûq»vV<½ÔNƒAaF¸oi`À$õ01 IÃa²<¸$EÜpõô¸ÏðüÀ¾%é˜#*I×Ã|ƒµÅj?l÷$©'«ív»R¥dY§Ói˜o÷þÛ^[Ýö:ê#ngYj‘¢íLmÕ«U”H¹ä' "óRsýöú²ue¬‚ÕjµÒxÇqÆEƺ·ë¨8§ÕjÇáö"…,5¯ÕÒL×Ô½U'ud,ÏHMM¥DêîêN@D5U5EÏŒ÷7“Äd?”-›ºÔÞÑ>×0Wš*^ýFuÁ¯ ¦|oŠpNP*•Ù+²¥›ÂjÞ¨É|8sâĉÊÉÊÜU¹¾‰)¨º¶:/'¯ôùRõTuî#¹m´‘ýpÿPHLõ lÕ̇äSwÍKÍMï4•½XFDš™ãc„#®NQW¼Zá=çÕh|)Kå‹¡gi¬{­Ü$.ðâÓ^b:ĵ+x¢ \³„,|¬§å>Kã{¯V@l«ÕjÕÓÔ!Ëš%Ö“6$Ý,u—Õ?q>V‘OƒÈ‚2@ô\.W ¡M¹Ý7E{_NÇŸ6ØÓÊMR0L$!=Å;îgyS }‚ïß‹nš2E³ cˆ¡’Ð'T¬+Ê~¬D6–$q8Ö«‚S¨'«ý¦d™ÞÓ½Æ4£4BCWµ¡Ê´Ä4Öþ¾›¥¯ÍRñrEZZZ”O/ÃQ€Ë3Z ˜ˆè€­U¥T }òPäÝ]}ÃD"jµ63Iñ÷*EŽ–ˆÈû•×~Øî8îîS$+Ô)jÍtM䛜 z]»šv5¬.@SÀå%1Ž-üCrL"7R,ìÜw€ˆ¸á€ Æ&³º9:ÝÎ ˆžô¤D™‘xŒõxh«ß–±‰¬e‰ —Øû–$}ä>ç¦>b’˜¸g)EIᜠݚw¨$ô /–d?Z®o ¤Ä¸·S$)"fä‹È$2¤`˜!V"½áÑÄäŠø7M$&‘FvnXw¤Ÿo´î¬wíÂQ€èÅ;w¹‘n²s³w´Ùœgœ4ä÷¥¢¥ñ-ù½ÄoH=™D†ô'@Ì®@DHDèrˆ-aÊ3@8‰@´¯D"êx¿ R‚Ëåâ8 Fâ- Z@´€h Ñ¢%DKˆ–-¢%DKˆ–- Z@´€h Ñ¢%@´€h Ñ¢%DKˆ–- Z‚8$ ”ªI/Ͱìh¬U.Ó3à%1Â:Ë–ú­õK*«*³³²#瘕½ùµÍKÊ+ÊssrƒSò§ùúíõÖÝÖŽŽg¯Ó}ÎMD …B=Y­Õj æ¥f–eã¨ÕH—ü+÷ZC=Y]ðDšgÎç\.—FCSƒ,qÚ‚41"ÇÃ$1²x,x®Ï]9äD Õˆˆ˜$¦pM¡Çãc4r%ƒ¬$šéšøÒ ËŽF¡.£Y £vÆ\."Ä¥/NW*•KZv·8O:#lR¿½^8'.1/5s¸Ä¶×6%uʆW7Pß Ñ’pN(-.­›í8êˆ)¡’À7Ð ó–2Ê”-©z³*BúÚ7keK²Vd~µ¶XççºÏ¸£/¢ý°]gÐÅ0 {ÉG”x^ ütÙ»ÆÁ¹5.+ˆ–hЈ!8ªðãOóMï4.Q*•é‹Óý_N§Ål‘u))ŠâÒâÎO:=g=.—ëÀ¾ùåËéÜgÜéætºCņ·ä#nÂÀÏø0.+ˆ–dR5©úÛõKì‡ííûÛC&uðä¸Ýz•434]]]EO¥ÎLe“YŽãtste¿+ëlïTLR Øï!{Ù‹eÑWl¸JîýÊkÝe-y®$3#S7G§R©X–MHHH˜ÀqœN«ËÎÊ®ÛZS$,Ú».PÕï« ó l2›0!A¥RY°ØöÚ¢ÜKÜuñL¶Ü~Ø.+y<•"òz½U›«,XÔÓÔR‘X–UOS[°Tm®òz½1µ›÷+oÙïÊ ó Ç%$$pg˜o¨ØP÷1 ¹žçKž+1è}{IHH°µÙd«n{]vV¶tnû+•™‘Y·½.òyž¯x¹"}IºZ­î?F×s:­Îò€¥ä¹k‹5¸YFáîËøÎ„¸k0V :‘¹rc¥l“œGsB¦ÔÎÒÊRvvuú×öœè‘­e¦»»;Ü~›ßm–¥WLRˆçc˜“5,%Ïq×Å_[ˆ^‡7¾E_)þ4_P(žaÆC]§³«3ã!y0]PXÀŸæÍÙt©ó“NÇÓlmîj’=¶4nÊÉÊê׫{zz<O÷‘îò—ÊU“TÞ¯¼y¿Ì“N…OJGªçDOqiqà ‚ äå HoûÀ&c•DÚ¼ÙÚ¼î…u¦{L²NÓQÇ™0Æk•(grÈ®: ÃxÎö?4²Ù*Ÿc<ä!ûßP9Y9èN].—,[ÙèÞè”<ò`_p3ìã#…k åQÅòŒÛŸ1õ*ÖW]¢L<2k¾OÞòæû̲4ëÖ¯‹<¡J6÷eÛ[Û‚c©!ŽÄ‘R©ìéé NYþR¹,eõëÕƒ¦éü¤zŸìnÐpfõx<ÁÓž†~¦ oš¡×ಉ ÙI#Bí–þÞŽš7käÚ i4‚0àÙ\Òà~ N#ËdtJNDííEOûïèIHHHH¸úÚ«ƒû†=¢ ,|r`ü4¢Ÿ“tiëâ×´³I^©§ ]¼•LÉÚ’À¯†Û ò>­3üÐ _òl‰J¥ ^^÷vìO‚̇3=Áê·×Æa«VþÇJÛ^ÏËË̲¬nŽî²ø{lüÕзV÷‘îpÄ¿3D© Ñot©ú–†Xr×ç®(ǹ|%œ¥ö¿Ôe·Œ1ILpÁ·†˜*>*u‰2±¼Ï/T¥DQŒ|€ä%N$Ù,~GÞa¦™ó;:¢ÿ­‰<Ç<œÀNµ¬U¡Ÿ‰ªP(´³´e”W”‡»“tlö- ¥FcD ¯B“=¾ˆˆzNôˆ¢X]S-[žÿxˆ›Ýä7T]؂߭Ç0ÊPJî9ëÑL×Ätå ¾l ýÚ#ËH™š¢’çÉdÔê2œ•Eù€‰‘n»KIIÊu=ÊŠ„üc d¥¢Jþè9Ñùy ’´…içËÑÒPjp™ÄQ¨ÓÒüè(ß’:}àsðú¨ýP{ä=¶µµÉ¯+3µq\â.ùú×ÛÛe¶fksà̧˥q<Õ%–aGa/œb˜ß8¾¬ºEÕ¾¯=x–LË{-s sŽØ†J/ÉãG´F£#†h)cy†l4­êµ*þ4ßô^“ìòÁiiò‡'Ex‰¤f‹|R‘~¾>ŽJÆ]òÚ­µ²Žæw›iF6ÙwUž~1Šš‡¼IÞÙ댜É©KÍ$å • ^.Ûj¬‰³xߤV«ë¶×¹>wm{k[á“…æefí,mð-cn·»è™¢H±‘ Ç/M,2\5¸dbzºqð’‚—”W”‡ž?Ô-Ÿ?Ä$1ÒˆXHÁw«Åú,ï¡—\özðhQð-W#1'»·ŸÞE% U”e2ju‰2qÚyô| ]~KÔöò˜{aÚÈÅW‘•øøE~XQωÙ ’ôpqiqgW§ç¬ÇårØw ÿñüà^zÍtM¸'µŒ\Ƀ_6bºÇ$=i°ÕÖwå¬YÒ£ »tÏ~cÆõ¹k,÷-¹\.ù Ñ)çÑœV[«ËåÏ‹.—«ûHwÃŽ†âg‹õóôRÌ!Û—B¡ÈXžQYUy`ß×ç.éAŽÝGºóËÑÛÀ¼L>7H3Cs ý€ô(£(q”õþLJƈ˜£%ù“~ ÷fÙãk±ß7¤˜¤è>2Ô{Œã(y /VÉhIÅà[ÇZ’a©‹éžAºvbªÔºõëb*OùKå—dÌ(¦*«*cmçûŠLöÒàÑØ8q”õþLJ.×h)d?GLsZ÷´FsGqàÖC•â+¹ësWä¢ÿqàV IDATcVM;›²ÊJ_’n¸Ý°yÓæ¦M©3S‰(ï—yùå«TªÀ¥/NWNV®q}Ésñ÷0ÅÙ·dÝjWNåÒ®S(9ëÖ®ø2±¨Êˆ¨þ›EU&ýLDN_öóÆÌi–[ÊŠ×tµô¼9½e9™š ‹ª,sZEÑÒ:çQ>8“ÉðÛã’B¡ "ê‹gÛÚ-µ‚ ˜—™£Lßôv“þv½Á‘zšZ»¾n{]4k‡1+AX†%"†aˆHèˆÈÚbµÛíþq@|¹,³êµª¡4r<Ñïôv´8ŒK4DdX¢nÛi÷~å#Ÿ²¦L"2.Ó”5eJ?ó'½¦ÚÞ“îü—Mŵ™ •bÍ5Žƒ¾XgýÏëí{ç®M+Þ‘™ÿ²I=“Î Á™„L†_'W.] ÇQÇÊÿX©˜¤È\žGM;›ô·êY–2}Ç¡ÍLMàÍLý°=šµÃ˜•9ñ§ùͯm&"ƒÞ@(/'¯|CyÈ}ÓŒ½½½ííq7v<#qÖív"2,Õ‘q©¦iS{Ûv‡ñáÔXóQkUD¤PrÒDTûb“HÅõ™ÒKŸž;¿·îE[Áæt"²ì4­Ð–ùv¤[Ü?ü˜I„dãC·¤”“•;U·¨âÈÄö‘Í´È}z·ÛÍ)¸À%œ‚ë=ÓÍÚa̪rCåwÝ9ñ†‰D”óhŽ1ÍXò\‰~¾Þ 7„Ü—f††ˆ:öwè´ºøZ;ž¾%ë–õt•j'E<ÊÉœuKǰûö‡n‘†Mô…Ìttij{Ûq_mg©¬[ìuÚöH#kQ&¸|ØwàÀ¾ÛÞÚ¦™ª™{ÇÜÀ›Ú¢×ÛÛËMâ.»º§ÎLužpv~ÒÙÓÓSñr…Ãá¨xµ¢ì…2é^96™UÝ¢ªÚÜ?ô¦š¤""g¯3î=ÆÜ·ä8È÷ãͼ_ù–è«›6µ;¼J=ÔwŸá­[xë–Ð}e…o˜kŸokz¥­¶Øª˜ÄšѧçèâNpùÒÍÑIÿZ–Y zCÞê¼ÀûÚFˆB¡àÝz"x7¯œ¤Œfí0g5¤™ÝD”÷‹¼’gK8޳,µtîê9ÑS»¥veöJ­VwgÒP£%©©þ[ý+¶Ëí™O†|XÝüÓ#¡óa96û·Æìßv¾~SÇæb+§æ AmQ& ó ë_\džJ¥’?Ã8Œv†Ö~pÀ<$ûA»fº&šµ#”UÝö:ÞÍggeQÓ;M¹är—µ"+/7ϺË*EKÎ3N"R)Uq·pŒ#qȺݮž¥*®Ï ü¨§«¬[ãzâÑÀhM·Hã°»ÕÓ9õÌÙF* —Uj$"§Ý!ä“'l{má‚’Èt³tv{ —oÓSÛm‡Cúêp8Ú>h³,µD³v$²òz½« *7ô?Á+x‰Hº»KºWŽˆì‡ìD¤£»…cë[jÏ!¸½¦¬´Tý€Í´B[ñ릮6§lùàQm ×ÑâÐ.R³ £žÉe<®/0Õ™kLYZÅdN8'8ò-Ž’í"*XT“¶T£ž©"¢–­íD¤™¯Î$\2€q èé"E’B§Õ1IŒÃá¨z­ªíƒ¶mõÛú»[¶öß´o·Û¥¯–e!¢óóÊÜ•^¯7𶸛ç®Ê­x¥"ýGéëž[GD?õxJJJÖª,)qäµD”P¸¦Pz²ö³’¬yfe™Å?$g\h¬ÝRkZbªß^ODþ ìÖ«R©Ò¨œËåÃ(~¶X¶dÝŠ†Œ©å¢GžÒsVÌH)/´AújV®«.mõ¯•} t`OwÎí•få:³r´Äõ¹§òñæ¬Y•æÉë2¦–çß]]ý‚oÛòÇ›sæUš'¯3O.Ï_XÝÚÔ2“pÉ./ÁbQ«kªõ·ë¥Ç,) Óݦfks`‚—ûù»\.†aªkª£ß¼»»Û|Ÿ™Ib˜$Æ|Ÿ¹çDOà¶‘×Qá“…Ã’•(Š])))OPÒÓÓ“¶0I©TVn¬ô/O™š¸ßA[8X‚Ëåâ¸Ð³³KÖ–=]„(à’… qÁÖkûþöñÚ†Ö]Öô¥÷œèá®çâná+p.|c>Yè8îhÜÙ8^+XôtQá“…!C¥è%âDøÆâ8nˆoœãlm¶¡g‚¾%DKˆ–- Z@´€h Ñ¢%DK€h Ñ¢%DKˆ–- Z@´€h - Z@´0#¯.Y[‚6¸Tp!¾ ¢¥¢§‹ÐF—*TÂ…x,£‰@´€h Ñ¢%DKˆ–- Z@´ˆ–- Z@´€h Ñ¢%DKˆ–Ñ¢%DKˆ–.ÓhÉÖF–¥^îzoÂ^¥òZðÚÚ.}ew’ã(Ž)ŒsΓNËR ›Ì²É¬e©ÅyÒ!1ÏóÜõ\ãÛñm9q„µüi>}Iz„Õ-ªš7j·ªØPayÀ¸D7GW²¶d\EKU¿§¹^è£Ê l«•+[ÏÒškà/yeî1ñU¯yñ[ã˜÷+¯áƒý°½úêê7ªí‡í£Áë {ù+}¾T¢N_’Çæ‘G^»2w¥í}[C}ƒi±éÁŸ>Øu°ËE•<_RþRyàŽŠ×—>_ÊŸæÇh£»\.1Œâg‹ƒv~"R¢+ÿqlyÃ1ç£X5"Wá“`\y!^·~ué–¾vé&¢ò—ÊCæà9ëa’˜ê׫ãÛ3“Ä0IŒù>sωžp9¸\.†aªkª£ßœˆŸ9ñ %éìê”…P===i Ó(‘”JeåÆÊËâé” .—‹ãBÏ–/Y[RôtÑ7®‹3Âü$Œ¾À(– qÁÖkûþö±\Së.kúÒ{Nôp×sc°…¯À¹[ …éÞpY)|²ÐqÜѸ³q,²èé¢Â' G9TŠ^"N£HD1tlä_ˆÞ&Û8Ž»o«½ÈÖfËÅCßR¨Iö5BH„Þ&€ñ}K1†Pá#ô6ŒSè[Š(86’ºším€ñ}KñŠÜÛ„®&DKã<оa¢%ˆ!lÂÄ&DK0xÌ„° `¼À,ïÁÄ=eóÁÆô-CœaïøAØ€h b›0± Ñ 3 6!f@´4Ö£™K6¡« Ñ l@´±‡M˜Ø€h ™6 Z‚á ›3 ZBØ)lBW¢%@Ø€h b›0± Ñ 3&6 Z‚¡„Mèjˆ]‚Ëåâ8.互µ%h Ë]Ñ3k"¬-y¶Mßè åÓEƒ¦Iz0¦IG0Ì],…Þ&€±§dm .Ä#ÝÂÑ$ÃHÜ7t /DK›B…Mˆ™-!lŠ6¡« à¢+Л|Ÿ|ˆÆ_Б#—lï§OÓ±cßÄf?y’NÁCù°eï—ö„DKgØÎe6}ø!=ø ÍœIÓ¦ÑwÐ/~A}4";zõUÒéF©R'NÐ Xò 4oÞ°åvY±‚þó?GðPF>¬Ñï=¸‘Gó„DK0Ì1Óx ›iî\:x~ücúÅ/è¶Û¨¥…ª«Gd_ßÿ>Ýÿ(Õë÷¿§»ï£¹3ÃuXƒy4OÌ[‚ða“?< 6Ñå0±é7¿¡©Siÿ~úÖ·|KÊÊè‹/Fd_K—ÒÒ¥8wÆ›‘;¬8a.è[‚(¦ËzbÓñã¤Ñô‡J’û·þŸ¥åËI¥"Ž£´4zÿýþU¯¾Jf3:DwÝE'Òý½ó-X@==r{æÊÌ$"zóMZ¼¸ù‘#”™I7ßLÉÉ4c½ðBT;=uÊ·*)‰¾ó2›éÜ9y¥ÊËéÍ7éÜ9Z°€, eËúW>LÿþïÄq¤VÓ‹/ö/ïê¢ÌLš2…’“é;ß¡G!·{ðÜdMññÇ”–FGÓ§ÓÆQe¡Fj¡}ˆ¨±‘t:R(èÖ[©©)ì¡|°"—9ì°FØ{¬,˹µ•.¤‰éÆéÇ?¦înyû‡;¸0Â籄Mþ)dØ$K6FLŸNï¾K´x1]ôçÁ‘#ôÃÒÌ™ôÒK””Do¼AF#íÝK?ü!ѧŸÒ{ïÑ'ŸÐÏ~F«V‘BA³gS[UWÓOørøÇ?èw¿£Ü\"¢¿ýöîõ-·ÛI¯§o›ž{Žnº‰Ž¥O>‰j§÷ÝG‚@ÿýߤTÒgŸÑŸÿL‚@IIЭדVKgÎÐÊ•DD×\ã[îñÅBYY”›Kõõ´z5M™B÷ÞKDtð ]{-=ÿ<ýÛ¿Ñ_ÿJ%%tø0µ´DÊ-ЧŸÒ®]ô—¿ÐêÕTXHõõôŸÿIW\A«V ’y„…[¹}vï¦{ï¥%Kè¹çèôizôQúúkš5+D™o»-ÒÁŠ\æ@‡5òÞcmäÀœ[[Éh¤yóèµ×èÿ ßü† úøcR*ûOÅ¿þ5ôÁ€‘ær¹Ä0ŠŸ-Â!ä3FìÛ'^½H$&'‹F£øÌ3â±cýkï½WLM¿þÚ÷õ_ÿçÍM&ß×ü|‘Hܶm@†‹˜šÚÿõ‰D»]E±¸X¼æßr“I¼ùfñË/C)ÂNÿñ‘HüïWa¡xÝu–H¥}çþl§Mò“Л77‹Dâ¡Cas“‘2óÍþ%÷ß/Þx£Ø×7Hæáj¡¦‘Êwˆ?øøÏú¾~ô‘H$¦§‡.v„ƒ¹AeàÏ1í}ÐFÌyÁñ»ßÁ÷µ»[üÖ·ÄÕ«ã9¸0ŽàB”F¾æÒhh×®þ%íÙC·Ý†ÿN-Á7¸«iÔÂ&½žžy†>ü>ÿœNœ M›hÝ:š9“fÌ "*.¦}û(+‹º»©¯>ûŒ¶n¥—_$Ï3hölzâ :v,Ä0œä™ghÿ~ZµŠNœ ¾>úë_©ªÊ·*ÂNNzòIúË_èÂòz©ºšÁ71HF£!‡6n¤>ê¿Û.œ+¯¤éÓéµ×èèQêë£;¨¤$æÜ&L ¼<êꢾ>ª«£òrZµŠ®¾zÌÃÕ(BM#”G¥ÆFzé%úúk:uŠzH>TÍÁ´A‰°÷!6r~>íÞMÏ>KgÏ’ÓI?LgÏÒcá?€1÷ÄÁX¹n„üêWâ7öïåŠ+D“I(×_?¤8iˆ aïCläk®†cà ÑŒ°)ò›èrx Zñ˜ aÓXöÓŸÒ‚h@´£þ¡‡MhºÑ7sfè[ó-ÁH…J0”° 'Œ"MÇŽ‡öŒ\ÍÈk‡ec°ÖÃ-YTe5ÏÙd kž³YTe—cýÛ[N÷æ±U<ðºþMîñ?”2ÊÏèxõUÒé|?Ÿ8A|0`í /мyã¡ñ#W3pí°ìb Ö`\(zª(}qºJ¥JHH(zªhà±rÖ]Öpùð<Ï]Ï5¾Ý¼Ê¸Èœ¹m¯Í0ßÀ²,˲†ùÛ^[¸œw6ôŽã8ŽK_’Þu°+0µÅjÐX–å8.óáLþtÿµ˜?ͧ/IO˜ ºEUóFMàV*,X—èæèJÖ–ŒtƒÓû–J3ê¬[ì£" ô ï‰ çûß§ûï÷ýüûßÓÝwÏ㹚kÇk­Æ…õ/®çݼy©9äÚ¬Y­¶VÿG»>ìEðùRuŠ:}Iº¼/ ¶Æ~H~qtuÌ5Îe™ÆÛê·Ñ\ã\ÇQGȜݼ۸ÈXýFuëžÖòŠrÇqÇlÃlçI§?êºó®;™$f[ý¶êÚj÷i÷Ü;æÒÅ7­Ì]i{ßÖPß`Zlzð§úÃ,þ4_ò|IùKå;*^[\ú|i`°50oéRËKc6šéF[º”–.ÿç^äjŽ×Fø†\ø&ñ^|÷†W7¯U)U½aðL¾òV¼ZQYQ)[Îó|Þ/óÊ_*0óÁÀåuÛë¨jjkT*éfénºé¦ºíuOgž™‘éÿÙ@ƒÞ0eÊ”š­5« ˆ¨è颔”k“•&¥/LW§ª+6UäæäQÓΦ¬‡²Ò—¤n7lÞ´¹igSêÌT"Êûe^þcùÒÞýÒ§+'+׿¸¾ä¹ìaþ¾%i¨®îw¶lm•å–²‚´š®½ÎÀN_öóÆÌi–[ÊŠ×tµ9/{ÊÕW,®ñG—í{UYãæv¶5Ï]ÌvQÿ†‘³õû“ÞŠ_4fϬ°ÜR–=³¢"§QÊ“ˆê_±YTeþµÈùtµ9 ÕXn)ËÖVÕ½ÜO2š¡ÒXîøñ¿E.ÊO|¢ è¯õ}mh  èÍ7}_?ÿœ,ð½áõÍ7iñb"¢òrzóM:wŽ,  hÙ²þܦÿwâ8R«éÅÃîôÕWÉlŽ”¸µ•.¤‰éÆéÇ?¦îî¶ väefÒÍ7Sr2͘A/¼0 «C‡è®»hâDú¯ÿ¼šþµ‘sîê¢ÌLš2…’“é;ß¡G!·{8EäüCÖ+r»ÖkÐþŸÿ!­– ºõVjl¤ü|zòIߪS§hùrR©()‰¾ó2›éܹ5£üGúræ8JK£÷ßG4£ vK­ æeòª‚üí,m`¸ØÁ¢Hò½GÜ÷Ct½. é…Ö}¾¯m´™›¤P‰ˆh™›ê¶×IßA`–ˆ†!"¡O "k‹Õn·KÁ–<2[–YõZÕˆ¶ÕˆŒÄY·Úí9sg,|ÃB‰Túp=ÚëZ Lµ½'Ýù/›Šk3*Åšjy"bY*ø½ÙqÈY³ÎFDüioEN“v‘:=Ë7áÀº¥Ã¾ß™û;cáf ÃКêv~Ðl}kïÚܵ¿7óé´âúÌìµiÞ>"¢²¦L"2.Ó”5eJ?GÎÇq_ó@ “ľaÉý­±c—ݺ5ŠQ¼á AÆSè3j!ãÔ©ôá‡ôÎ;¾¯Û¶Ñž=T[{ñLµÒÿû4mÑßþæ»Tëõ¤ÕÒUWÑÊ•´r%edø{-ÿ½÷Š©©¾vŠ4ožh2áu§Í;_‰¨ðÉÂÀ%Y+²¶½µ­ÕÖºí­mÚ[µ”H­{ZCn«œ¬ÌZ‘5`ÑyQ3]S¸¦0\æÍÖfŤ‹}K“Íï6Z<‰r²²ÕÖ_ Í þv}`JýízJô]}:?éT*•Ò†9戢X\Zœµ*+Ü^zzzˆ¨rcåȽUwDæ-éÒÔþî5õLŽˆø^_Gt{‹C·HÃ&’¸M—¦¶ôФÿ\×±Û±&£†ú¨ø­L–ë=u‹4þ˜eI·HÓ¾ËM¶í-Ç ‹S¸ëÙAK9{ÛqÝby¬[ÚcèXº$³‚¾á%ºóNú?ÿ‡úúèÓOéÔ)úÍohÛ6úàºãjn¦ý(Ú|’’è®»úã~@'OÆœøüyzÿ}züqºêª‹¿!j_IÝVéë¯û“1 ?Oï½G¿ü%]{mèb\uÝ{o<6hÎÿ;55ÑÉ“tþr„a\¦éhq¨§«Rç˜É¥˜ÄȾºÝÞh²u»½ %MÉÏ'¨ }ƺ… ©°öí£?¦éÓiÚ4Òëé½÷hòd:~Ü7Žk®ì&&R__̉yžúúèæ›$¾ùfêì|Û?$½~À™Àótþ|¤·+q¾Ç>rÎõõ”‘Aj5ét””ä‹á.Î9†c1hþ!ëý —Òí¦ýKþº\ÿׄª¯§¼<²X(!t:ÊϧåËãiŸÀòñ mÚD›7_ú¿¬`ÜaYÖ´Ä´yÓæh;ŽÒçK«_¯A¸8Ê,ô <ÏsGD+sVêoÕû£1cšÑxÒ˜÷‹¼.{WØÞ“9:é_Ë2‹AoÈ['EKÙ?Ïvö:KŸ/]¿n=¥-HËx(cÀó&4³›ˆò~‘Wòl Çq–¥–®Ã]='zj·Ô®Ì^©ÕjuÚQz8HÌÿ“*&±î^ù}zî^>ÊpD¡`uóSL„«ÏŸöV=Õ¢ž¡rr6þ¾=ý纀PFÙ M¶ Eˆ2ÇQ<…‚ .¢Ÿ±nölºî:jn¦ŽZ¸ÐwÍÞ¹“&O¦+¯íwŸ%%}ù倅_~é[Yj*µ´ X’œL QͰŽUäœõ+2›û§uwGÛ屈;ÿ!ºî:ºâ úâ‹ ¿ø¢ÿèÌ™C~HŸN{öPe%edPr2ÝsÏÚGʼ¤„~ýkü²Â(S*•ü™þ‹£ã˜ƒúHvÜúuëׯ[ßùIgêÌTûa»é1“,Zÿâú(wg˜oL\ôtQþãùŽcNÁ©nQÓŒ!ïã«Û^Ç»y©©é¦ÜGr9ŽËZ‘•—›gÝe•¢%ç'©”ª1-éæ§´·÷zÉ? åõRû®ãº´”¨6_¤qt8ÕÓ¹þ™ðUä6Ã×›k×µm.¶êæ«U_Ö¾Ëîõ¥ýz½Ô¾Ë®Ñ§D“­.-ŶóxÖi/<—Cñ4óS‚Ë0x0$ûáÑ(“.Ãï¾K¾?ß3ž}–®»ŽæÌ =Òô­oÑ… #R˜k®!†ví¢§žò-ñxhÏžw¢…síµòØîê«I«¥;¨°0ž®ˆÕŒó?ÿI'OÒØ¿äÏÎc1”ü‡üg8͞훚-9r„:;é;ßì†èþûé¾û(9™öî•GK±–ÿškH§óíýI0ܼ_yë·×koÕ†¾"ÏÒÙíýW1í­Úfks`‚;wf<”‘½"[=UMD)“Sd3©Û÷·§LN‰²0¶½6Ít¬ëKê@jïhoÙÝ"Û;y½Þ‚Õ;úžé¼D$œèâ½rD$M×ÎÑŽ\KÆ|Oœùqƒ ÐsímG×~§ímÇsÐGæÇ Ñlžñ¸žw EæÛö®®ýÎöGÝËíEK}7 6nhïØëÈß`b“Ùì5FõtUÉÏëÉßÈ”fÔµ·8Úw9J¨q»)ó1C4Ùfúë_©*êÛh#W3\ÎW^IÓ§Ók¯ÑÑ£Ô×G;vPIÉp‹!æ?DkÖЇÒOJ{öÐöíd6Ó7ú~gNzòIúË_èÂòz©ºš!Ä›†ã(q1íÛGYYÔÝM}}ôÙg´u+½ü2~q!‚º­uÒ‡ˆìv»ÿg"ÊÎÊ®Û^gÛk«©­™{ÇÜÞS½%O‡> ÍKÌmµùÝÄqœ1Íø!"õdµ1Í(Ý7WðXAË{-ÙYÙÖ]Vë.kæÃ™-»[ +¸¾%=]äï:*ûm™u—ÕÖf«©­1.2¶}ÐV¼¶8°oɺËjÛk+û]ÙÆ;sÉ‘ö8à7ò™5–eÿœq¡±vKmãÎÆ‚Â"2-òutY[¬J¥rDGåbî[R©¹²¦Œšu¶ª'šÜn¯BÁjæ§ä¿lR©£‰ãTlÙ»õëÚªÖ¶¹Ïð ê¦*´ij"rä7?o5?jøÿíÝXTu¾ð÷(äœÔšãjÎdµLe9”ݘt“iue¬î Y+ˆmPvmS°nBÝk­2ÈVx½ص7¼OȰ×·µ†ž²awk¡Ÿ å^‡²ëàjÌdÆ•<÷†aø¥ ï×ããÜs¾Ÿïsà|øžDFk ¯ÄfËKžµ¤>o`LÔ)Ç)‹V[\ÇœÚišÜ×ã;¦‚„=»6¥<ßR–S빇I?Û{³}êzcÉS–gî-PéÈ G;]Ì}=¹4Ç’·¤R¥Œ‰Qºh˜_²†”0uN’ Î0ël g/yÎg¿øÞx£ÇliáB,[†§Ÿ†Ó‰+¯Ä7ß fcRSqäL&üö·Þ‰Š;qÛmýŒvï½Ø¾¾$)1©©!• ÞÍ ‘_y ¸á˜2EE}x÷c(ûb ñhÁ”•aíZü÷ãºë°n6mòN¤]»ð»ßy·3™™HN¤¯íEEV¯Æïö¥ˆœ~ãR‹û^OoþƒÙü3Ï3h.§+ý±ô––e˜2zVôÛ–·»g!Þl)1>ýñts•9À«•I{,M©T½\Tº½@ÔÍQÅ%Å·Z{½]P7MWôRQ^~žËåR©T†Y¿–4|ÐPôR‘ë„Kw½Î´Ö”öXš_u¶ÆÊŠÊÆFßMQů'/I¾çÞ{ÔÕÅ[Š=7E(«(K]š:¤®hmmõܽÕi©#I<ï4ñ« ÉOFðÑÍKrÔá‡ÐÔ„ðpDFöóFìÎ~üMM8q˜©»Ñ£{zp#3˜í?÷ñ{âvãÝwqç5 mmÈ̄Ӊûï÷m0yrHùh?Ú¯Px§£ˆÎ¡¬5Y%[Kª÷VÇÍ¡]ÈÎÉÎZ“Õ¿T)tÌ–ÎkÂDDÃÊ©Sˆ‹ƒR‰Ÿü-- ÃæÍø§âÀÐ…JÅ¡þ{´C-ÈËÊ/Æl©Ò‘É„‰ˆ†Öe—áØ1|ü1¾ý—_Ž3z|?']L8·tž&"ž.¿sæpˆ¨³Q""""fKtûö[|ù%‡a:Ô·—, ÿ=Ò×ùikÃ8p€‡³%¢âå—¡ï×+ËÞx+WÀë¯cõjïÂÿú¯.OHy|ú)-Ÿÿ<"Ççë¯Úò¥Kñè£Ám°öÈ ¶9ôõUn.D7Ü€™3C=¨:R´û7 ¸á̘+ð—¿ Ó#$”½LÄl‰h$¹é&,ZÔŸ‚_|šhlÄŸþä]øá‡¨¬ôßòÈTVòK,Ï™W^Á/9hÑÚ`í‘!jó :|Ï>‹gŸÅñã8r¤ãó?ÿƒiÓðÚk¸í6<ú(bcÑЀY³ðÖ[Ãñ e/]Xx—7]è.ÆïC©¦&<ðfÌÀž=¾GðÖ­CM ÆŒáñB4pn‰.tÛ·ûþfíË/#>MMøç†(B«Åƃ_c¯µ8€€FQDL öï÷.okÃÂ…ÈÌì²¥Ñèýƒž°}„˜ˆ"¦MÖ-!…õøòK$'cÊŒ›oÆsÏ@a!¶olj˜;sç"11¤PÕÕÐë¡RaÆ ïÃí‘o¾ñ6cÜ8üô§ˆÇ‰ýisc#’“qíµ??ý)V¬€ËÕÿ½ÿ>î¼&`òdÜ?ô.ÿÝï°j,_޹sQXê€äçãôiìØáÿ¶‚ØXÌžÝK¥cøÙg¸ûnL˜€ÿ÷Ký!ºÈpn‰.t_}…÷ÞóýêÿÖ[øâ ¤¤ - f3V¯Æµ×â¾û¼ñFÄÆ@d$î¾»o AjùòKÜ~;¦OÇ‹/bÜ8lÛ£gÛoÇ¥—⡇€›nÂÒ¥p»±x1ΜÁ¯í »o>þ«W#+ f3}£Faùò^°Ùk®Áúõ¸òJ8àý3ºÑшŠÂ±cX¶ ÆŽí=Ô;ïà¾û°`Ö¯ÇÑ£Xµ 'OâÖ[û0h¡ï‘_ý n7þó?¡Vãȼù&Üîþ´ùÓOqÙeÈÏÇO~‚/¾€É„¦&ÔÖzÛ¼GÝS%£?ÿ9¶nÅ?à·¿…Á€>‚Z_üß?F|<®¹:]¨ÕÞ½¸ã\sM°ü¬§J;Æð“Oð/ÿ‚åË¡RáÍ7ý— îÒïo ¢‘«µµUîAîÚ\™h¤Ë͕ǎõ~‘!òÿèýxæŒé»H«Åœ9xûíþwÿôiïqƒP*3Æ~ÔoIð!êÓBÄ+qD¾±c»üå™°0´·÷¡ø¨Q^Å~æŒwU¯µ|û-Ün¼ú*JK»Dè¼ñ˜1X³‰‰¸õV,YÒe3Q„Réûxå•ðàŠ+‚…u:qêT° =o¡Ó‰övh4]Vyš1è{D¡€ÙŒôt$$@¡€^Œ <ð@ŸÛ ÀlFR´Zèõ7'O€$õ¹Gž§Lé²pÊ|þyÿ»ùå3G„R©J…°®?Ìý–ôº[C?Bˆ.J¼Ë›¨ç¶3güïþö[ïù)”y&Üî.ÿ‰ë®ÃGaÇŽ.ÅOœðffß}ãÇ÷vüx(þmî_ =kïRÄÓŒ¡0s&þò9‚×_ÇĉHJž=ýÕýWÄÇÃfCY¶lANŽÙ{äÙØoíwßy—÷ógð(Ìš…wßÅ©SCXé !DÌ–ˆ¨÷ó7àåeß>„…õx_°ß<Š^ªª`+05mmؿ˖aÅŠ.¯½v»aíô×¶ßz ‚€›oî%쥗"* »w^{É%Þ‹A¡´pÜ8èt]ºßÒ2 ™•P\q-ž=P*½·‡÷©Í?þˆC‡¼÷2{¼ùf?{4v,t:ìÛç[ÒÖ†wßÅÏ~6 ¦¥áÛo±~½ÿòテÝ>8•âBÄl‰ˆzqß}˜:«V¡ª GŽ ¹Ï=‡mÛ°|y°k:ËÍÅ_ÿŠ”<ˆöv9‚Š lÚä][Xˆª*lßµ›6!"÷ßï½r <ééhlD{;*+QXˆåËq饽‡}öY|ð–/Ç×_£½_|’ï*mmز~è} *x¨U«P]_ÄÉ“øæ<ôÿ5 Áâp`Í|ü1NŸ†$aǸݘ>½Ïm=Ó¦aëV8€övìÞ “©KE}êQFÞyk×âøq8X²Çã‰'ÔÓÄD<ü0Ö®EJ ¬V8°ÙPXˆ[nÁÇZ¥ƒx„]„øL]\ÏÄMžÜeíý÷Ë·ßÞ·€v»øðƒ Ÿó¨Ó”o*|±°óƹëróòózJÅ.®lI¥5[EDD$I’µÎZ´¹¨ûªä¤dÓ:SÜ‚8ÃlCrRrõîj÷ wYEYà8ßKE/e¬Êð[ît:ÓO/ØPЧªýdçdGDDXj,qóãâæÇUï®–Ú¥¢W‹B©¨foMÒIq â ò <=ËÓOÏx"C£ÑtÞ8n~œú*õ††nÀÃX>AS¿Ê T¢f»ÍuÌ©½^“²Î9[Àú†}Ã#•…–TNìØÞ”Tér¸ j“”äXêkí-ÍN¥RÐÍT§®5j¦ŠÁ+J~ÚàùØXç(ͱ؛ª‰b¯³;Á+ê*~y”Ëå6¿d­td†R¶s«‚ §C*ɵ4Ô6»]’rœ ½Yö¼1}N óKVóKV•ú£@¥< p’Ê_°Ô×6»\’J%ègG¤möýfP]Z_órCK‹38ìβ|kCm³Û-énÖ$å#£5þ{skƒû¢æG¤mˆkù»³$Çbÿ¨E5Q™ºÎ¨Ÿ¯ q`‰ˆè¼S©TÐxmùÎr·ÛŸè?Q”™‘ukTrRòƒÉö»êº?×¥,OAøÙÏáˆ[YU™¶2­×ŠÜn· (•Jîv7K­Åf³••Èü’“K¶–˜ÖÕõ¸°‡°TØ´:UÚ”¯·æ-1þ5Eœ$~©-'X*lÉ9ÞÇyTj¨µ§ß–šúHª£Å‘—Ÿ·á… bæÆ$=”ä™m ©¢pDN÷^ÊH,Ý´Ö$Šb„ƦÆÃ_.ßY¾,uYTTÔM& ~¶œ!QWórCÚs°TØ”JÁðKoÏ-6c¢>aõÙ[šRè1U*Áu¬ËiÙïcgÁ+ j ôO9D!õycêóF‡Íi~µ¡4×"jEÃ|mÿJ©T‚«¥?Jzî]aøžÄÁ!"¢!<Ï6ôô¼˜Z­vóMì·£~7\oxaÆ6|þÉç¹Kè²s²3žÌ°ÿÝ.ªDÍÕcŒÑs)­OUVU:]NÏ4RÍkÒV¤‰¢˜²4%=-ݲÏâÉ–Ç4jÍHÍ–Œ‰:óF«õ– ›aA„ïšW;”*·ìl=¦nvDý>›$=ã$ õûz~eQЊtÑõµvHggPüB  ‘=ÑèÄ”<£eg½ÃæÀ|mˆ{À¯”>&º·9å¨$LêÛ=Õú»tö‡všè{H¡ß†`pˆˆhÐYß³ê¦éŸnÕÛl¾³^ÔŒ¨·-owÞ`žq^ÒCI©KSµ×÷ó. A<ÙO}C}í;µžø¡W$IRæêÌêݾ—gJn €ç™'÷ÙËž›Ç£fÕ{‡<[ÒhEí­š’uu®gL¢ïV²¨˜K…M}½J;]ÓðžÝRч74&¬2dîµå%UÆ?¦÷<dãà%©¬¨ìøÚf³y>&$&x¦sTãTú(½rœÒn·—l-©ûsÝ.ó®€qâÄ/K[&I’ç±8Q1F¿m´Wi;/ R5…B‘õLVÇ›µ³s²³J¥Òú5/7o劕žP¡Täñ̳Ï$$&tÌ6ï4–ï,]k®2è¸EÝRkQ«ÕCwU.ììÔ˜D]i–E¥;¿õ'mƒ±(ÃRž_@{«:{[|¦±$Ä€ÚébîëÉ¥9–¼%•*•`LŒÒEÃóÊ¢î‚WÔ%ÔD1~yTK‹Ë²Ó=ðFú·9JS³³¡%ßÚiªŒÒ„È™©ë%OYž¹· Þ·ÔS)Q#ü)¥<ßR–S빇I?[J3DPð§$ó u%ëê\ÇœJ¥ ¹^ÓŸßqpˆˆ¨O-^ÔñµùfóÌdY ›¦+z©(/?Ïår©T*Ã,ÃÛ–·»g!Þl)1>ýñts•99)yàU{uz·Sà E/¹N¸t×ëLkMi¥õ©›¶ÆÊŠÊÆFß+Š_)N^’|Ͻ÷¨'ª‹·{nÏPVQ–º4uè\ÑÚÚÚÓ­[¦u¦ìœì‹íÌŒ)SMRf¿žÀïF"":¿ÎÁ‰8ó©LK­¥þƒú‘;J–}–¸{ã}Xœ$Ñâ±Xô”ź×Þø£~¯Ý´¤ÒÞäˆ_eà°ÑÅ kM–½Ù^½·zäv!;';kMV?R¥Ð…ñ@‘ŽI%OÕ¸ŽIJ¥ ½Y•UžÐùŠ!ÑLÅ!ý{´ç€µÎ:ÔU0[BÇk¬‰ˆˆˆºã•8""""fKDDDDÌ–ˆˆˆˆ˜-1[""""b¶DDDDÄl‰ˆˆˆˆÙ³%""""fKDDDDÄl‰ˆˆˆˆÙ³%""""fKDDDDÌ–ˆˆˆˆ˜-1[""""b¶DDDDÄl‰ˆˆˆˆ˜-1["""",aÁW›Ö™8FDDDç OÄ# [ÊÎÉæ¯T‰'âáŒòJ³%""""fKDDDDÌ–ˆˆˆˆ˜-1[""""b¶DDDDÄl‰ˆˆˆˆÙ³%""""b¶DDDDÄl‰ˆˆˆˆÙ³%""""fKDDDDÌ–ˆˆˆˆ˜-1[""""b¶DDDDDÌ–ˆˆˆˆ˜-1[""""b¶DDDDÄl)t …3ûié×¼Òì§%…Â9‡¢z/ìFÞÞ ‘Ã…Âi}ÏÛ°Žâ$)a±d·Ÿÿžƒ#§O»¸×Ý7¬ö/99&ãa¼°0ÁqÈdc§Ó)N«ß¨î_ñàYë<êŒ[§Wh®Ö”m+ë\ªhsQÂâ„ÎKô3õ¦u&fK#ÕûV1m…páµêžXgÉÖ öäg®‚j¢Ò0Ûû1e©ò}«ø¾U,Ü Xë`0HÒ÷þ¡{aïb¢‹™ô½d˜c°5ÙvlÛ±cÛ[“Í`4HRßïyùyÚmÜ‚¸~¾qðµËÒ–Y÷[÷˜÷ÄÎ}ðá?mìÈ¢Lù¦Â ;W”».7/?ÏyÔ9<Ç<Œ‡]p†h¶j䩬’âø>jÔÞ3DC;U¸Ãà4W ÉK8ND4"½ZÔÜÜ|ð˃کZú›õ×Þpmé«¥i¥LwŠ^.*.*î_ñà_[³·&å¡”¸q†Y†ÒWKköÖDNþxzƦsEqóãÔW©7lÜ`Z?g˜Fêܒ纀i¤¹ZR„;#§K–}gÏ”P(œŸ¢ën"§{³Ý´Ç¤H¤w 㥸ùR£­÷Š:>Zj¡Ÿ))š«%Óú^~q^‘¥ú(o¨‚çý/Í/Û¹UA†€Ãä$I%…Â)Š’a¶Ôhƒ§¢¼|·çúT÷–,å]uÉK$FR„;5)9©Ë m‚V ì°XEIî4DKžËdþ]ÐH‚ %'I’„úfK‚ iµReUVúµï¸ãž{3Ì{³ÑÙ×ÓS²|Jþ¼QŽžÕ†°Öƒ{‰Óã¸õ°±­×ï—^Ç híÞÂΑ;G ÞY"DOÄCÆ“—d<™0Œ ¾J²4¥ßŃo|íçŸ|®V«=ÉÆÊU+eYÎÍËMYžÒSg>  xKñyáîFðÜRì| Üûµ> ìßxSN}Hhiqw\ *ß.ÅÜ©ô^!= Ó:I;UR(œŠKœW^é`³…4¹dÙØùèHÐ…ñè|sŒ¿ Yö#vA§Pbç‡Z¶OC=KYô* žGOóõTʲ± Nês3jö"v%pÚû/æ.Xöw*{W§_M®€ŽÉ!Ý´.¡zœÓ¨Ù ¿ËpyùnÅ%NÅ%Λ"öfì*µÚ^âô4=-ÞÁ>9AŽ^Ë~Ä/€0¾KKmh;µ·ƒª{ {ŠÜëÞ$¢á£¥¥Eœ(ž—ª#§G:¾v|þÉç‡.ÚTd·Û‹^.*x®Àó¬œ0^Ð\­))õ]zÓLÔp´8†á0þ?ˆat#­ ¹3IEND®B`‚astropy-0.3/docs/vo/images/astropy_vo_flowchart.png0000644000175000017500000004713112243255342021012 0ustar oleole‰PNG  IHDR3¿ã$ksRGB®ÎégAMA± üa cHRMz&€„ú€èu0ê`:˜pœºQ<M×IDATx^íßËvGuþóý_ú‡ô$9Hß XBEHŠ’ bJs I)öÀBŠÚ"6Ô)†R[ ©Š% "¥ ÔPH¢¯±ÑDcßI¶Ùn÷™5³¯™=?>û ¼yžÙkÖ|Öšk_÷Ü÷ó<ÿï®»îzúé§oá‚ `&ð{¿÷{ó7c~8ðî»ïFÎc$ Ðßêêïÿþïÿš €@ •n¨âÄäÎX@5˜õð”±Æúê&àtãÙgŸ½yóæÉ4ÑŸ“¹è†À¬«8³njÊB PŽÀ¤ î:9%Îì$@n‡º!0ë*ά›š²”#€3+Çš™ 1àÌÆ¨3«„@8³<\‰ ŒKg6níY9ÎÀ™gH@K83úH'€3KgÇ€öàÌè @ Î,wBÀ™Ñ€€–ÎLË“h€83£ t8³tvÜ @€33zÐÀ™iy €gfô Ng–ÎŽ;!HÎ̶+°€À°Ê;3£ÍÖ¥Ùýâ°µcá€@"ÎÌü¿½Îå‘ •@Ig%A×:37{Vì‡:&`uf~MD†:n–bÎ,(A+ºðxlšš¶ F Å™í¾;€¥€» Ð42ÎliËV¸VŽmþîUÎìªy›î"’‡–¢ÙŸG‰ŽDsW=—qŽb¿~ôj՜΀b vfGém7~Ô»™QJårØuŠ»§z±<@ Ú™ÙÏÆŽÞ}8:r³˜'¿ÚzäѤ×!ƒ@g–v ewfÉJµš‘ÉÑ`Ä„À€¬Îlõ21¨•ÛASuô&…ÿí‰ó Xu– ÖÙñŸœ©@„3;2gÛS´à{Ž~³5}×¢˜’‰F+9ë…€@ÓÎì¼€XdJH›P€ÀâœÙÊ3í¾dô¸(³ >zÂrïÕeÈM g|Có¼‡Ë]âCÝHqfËÅÛ? ›pòüäά›Fd!À™M*dy Ñ“6 P˜€É™ù?Uvæ€ÊÙÿ1µ µàã‚l ”tfÛN¬üÐî‹FÏí²À™Í#çÌ<)³¼jLðp«S±ä²X£0v pfnÞ£N¬¾T¡•bœM£‘ ø ˜œÙVþvßFô¿`M;ôò;³eb«WÏ+iqLÇ@veœ™D‚Œr¥T83{«00°:³ 2fm=œßÀmóö¼\ög;‘à ™@1g–,AÆWŒiJåqfÓ·h@±"œÙ‘2z¦L8ñò8³ÜŲc< PÒ™M´ýj®HÚÑב²¿ï¹Ê K ΙÅFg< Ð7òάož¬€ÎŒ€Ò àÌÒÙq' =83úH'€3KgÇ€pfô  %€3Óò$ ÎÌè@ Î,wBàÌŒ€´pfZžDƒ À™=¤À™¥³ãN@œ™Ñ€€–ÎLË“h€83£ t8³tvÜ @€33zÐÀ™iy €gfô Ng–ÎŽ;!pfF@Z83-O¢AàÌŒ€Ò àÌÒÙq' ÎÌè@@Kg¦åI4@œ™Ñ€@:œY:;î„ À™=h àÌ´<‰@€33zH'€3KgÇ€83£ -œ™–'Ñ pfF@épfé츀gfô  %€3Óò$ ÎÌè@ Î,wBàÌŒ€´pfZžDƒ À™=¤À™¥³ãN@œ™Ñ€€–ÎLË“h€83£ t8³tvÜ @€33zÐÀ™iy €gfô Ng–ÎŽ;!pfF@Z83-O¢AàÌŒ€Ò àÌÒÙq' ÎÌè@@Kg¦åI4@œ™Ñ€@:œY:;î„ À™=h àÌ´<‰@€33zH'€3KgÇ€83£ -œ™–'Ñ pfF@épfé츀gfô  %€3Óòl.Ú]wÝåz€«N®:Íu ;œ™Ñ€@:œY:».ît ÐÅ:ú\Õi´®8³F GÚ¨‚άŠ2\—„k€7¸j%0mÏ›7o^× ÌœB@ïÌ8Ü®óX›¬ °$ z›g–¢»݃3«Õ•½™—j{vÔ°m,EïÌ8>m£òd96Õ>UI¿*Ÿ±«zÁêqf8³ Ú®÷)³8³š;•Ü ùÅôù·9pf½?#ëÙլ'ªí9x“—_>άæmEnÈE@%ÙÂ8ååÏÀ™åÚ¢Š¸ªíy¾OˆEg¦hb@ 5*ÉƉR.WBÀ5À¯¸j% Úž•4Û8iàÌZ{¢’/T’-Œ3Žìö´RœY­®ìͼTÛ³§Žmb-83ÅSŽh€J²…qšPL’\À™áÌØrYœYÍJn€€ðÅ4ÎL.Êmęլ'ªíÙVOv-άæmEnÈE@%ÙÂ8èé€Kp ðK®Z ¨¶ç€}í’qf¹ž|Ä…@ÍT’-Œs­2{œY­®ìͼTÛ3­7¸+™Î¬æ§'¹A •d ã$«7^Hg†3»°ýz:‹3«¹SÉ ¾˜Æ™õúl0® gV³ž¨¶§±¦"€3«y[‘rPI¶0ŽJÔˆS’Î,×UÄUmÏ’Å\ŽÎLÑþÄ€@kT’-Œƒ"·HÀ5Àë\µPmÏ;³éœqf­=QÉ *ÉÆiZI‡MgV«+{3/Õö¶½¯Z8ÎLñ”#Z# ’laœ«DyÏÀ™áÌÎô÷îÈâÌjîTrƒ„/¦qfƒ?ZŠ9³[ޝ«vô”ÑröÕÿ^•Ø<¯j{Þäå—3»|ï.  ’laœòòÇŒç ÔàÌ®òC+g¶5jlìßRµ=Ï÷ ¢àÌ.ß;$ ¨$['J¹\ ׯ¹&ß³j>J+’ÅïL²Jé(Ãò‰Í3ª¶g%Í6N8³ ŠL Ë ¨$[gÙíi¥—;3çB®²D8³ž:¹ªµdqf¾D`j@ÀB@訞}ë:©k.Ÿ“¸ý•;³å‡Óv÷ÅêÓkó˜]·ç±bGqfãxÉÙžj›_ÒZ#OŠ3³<ÅÞ¨$[gd!nwí—;³#Çsô˼;f rfž) hŠj{¶ÛŸfŽ3+°;˜ÕPI¶0N£:xÚ…™ÅoY+Ë›ó˜Xg¶kæ,A²Jƒj{Þäå—3˺/J ¨$[§¼ü1ãy®^-ry2÷õíüÓ`ÿׯLwí~wõEÿÿ)Bë7“¨¶çù>!BœY¥NÒ‚@V*ÉƉR.WB °3[Úµòظٱ­Æ¬ “ЙÍ•ôdÓ\ªíYI³“FgV¾ÿ˜ˆ" ’laœqd·§•^îÌÍÇ”$XfE ³H ¨$[gÍíl™—;3gk<k¶S»nûÝ¥ùÛýîvÀÊ™­’ñO‘Ï“M‘UÛ³³¦­9YœYîn³Ç?z™e0ìÈXt±ãô´àeV”0‹‘J²…qê—K2ܨǙùOÔ‚GnA{·•¬à±Ü´UWæL²ATÛ“Î/L gæÑãiýÝýà9¬^m¡£#èeXË1µçÑkÿ–gRKKJ»¯ð‚çð š1¨kþ—’»«ðÄ\k+RF°–×Ó+\þ<…ì7jôj˜J²…q kÓIsfi}>ø]ªí)i‚Ø TíÌŽ“W¯ŽŽ‹=ÎlûØ;šËãc‚nf×-•Âb ‚‰%83 Ø]#e§œâèudp½v§¾+ÊžÄ,KÞ–Ï“O„ ÉÃF%ÙÂ8vÙbd=pf’ý˜)ˆj{ÖÓoƒdÒ€3ó;˱ÊîÓ4hhŽÎx,‡(þ1As¶œÚèÿNÆÜzEÙ”ÙLœ‡\ïv.;ª²¿mv-uBb ³ìž>z|² «$[gÍíl™8³ä=XàFÕöì¬ië_NÕÎÌòÄõ?´‚OSÿ±–ß!Y¢Ágj¬³ žÃífuôEŸó83‹áH«Ý®`!¶Ó%$™`Fƒþ>˜˜R»ÅUy•d ãÔ/—dxáçÌb;œñŽ€j{Òù… 4ãÌŒo~Ÿ”Qì !8r~îë <›±8•4´zä½PÄNá±ÁÙÏ@ð·Ö‘7Šj¤yiFΫ”ŒÇ„Q"•d ãÖ>¦“àÌ,j߬ڞ’V!ˆ@íÎÌòˆÚsdŒ¢¨ACŒ<3ÛÚ‘à¤çÀ¶FÁèßÖYÝrd‚GkÛmЄm3´Ø²ÕD~7`„๲eÆ3¡ _ÜÍ<ÖÜXÎíT—Vï|z–ÒÈg©_²UÒïâ ¢¹-Óî®Z ¨¶ggM[ÿrpfFµ6? /qfGÖÇó”=JØâTŽÂž„à1"“š6Ʋ^¡3ó·V¬­ô&8à|¶ÌEVI¶0NýrI†»Ÿ3«Õ–×+ªíIç&Å™©6Äôh\F›Äæ/nǸoÍ_<аÍ08Ò8õy¼ÊßCfj Á96æ2ÛËÿzn_21ÖîhØnÅcÁ&´–¤C,]dÉÍR}ÿ•d ãÖ>¦“àÌìüfÌAµ=%­B;œÙÒåìZ Ï€­C:z®ïÙZí°£MåŸèÈn\0±¥]…õ;3?X£[YÙ)Ë»y8KÀQµ{Ó•ÿÞvšgÀQ_mmýnX‰Ž«$[Ç.[Œ¬‡ÎL²3QmÏzúmLªvfÛg›ÿÉïÛŽîÝGí>ûç/–±bZ¬ßç cî:ªe|¿3Ûž ns N±{¶u'»vóÈÚîÜL/H +„#Ë«Rp•d ã ¢¹-g¦Ú’9⨶ggM[ÿrjwf9š5-æ‘+Š=3K›»  % ’laœúå’ w?gös®Z ¨¶'_˜ÎÌú¼‹rfQƒ­0:*ÉÆ)¬}L'!à V[B^?WmOI«ÄN ‹3ërCLfË¿´Õ;P]r`Q}PI¶0Ž]¶YœYÍ‚ ÚžõôÛ ™à̬Û*Ö™Yã2WPI¶0Î šÛÙ2qfWl_뜪íÙYÓÖ¿œ™µÅž¨$[§~¹$C>gÖ–¨¶'_˜Î¬­F¶ÐPI¶0Naíc: ×?㪕€j{JZ… vYœY­]J^€Ào¨$[Ç.[Œ¬‡Î¬fMQmÏzúmLpf5o+rƒ@.*ÉÆDs;[&Î,×UÄUmÏΚ¶þåàÌíO ´F@%ÙÂ8õË%î~άµÞ(_Õö¤ó À™ ´KY*f*ÉÆ)¬}L'!À™Yͪ¢Úž’V!ˆÎ¬æmEnÈE@%ÙÂ8vÙbd=\¼ÌU+Õö¬§ßÉ$‹3«µKÉ ø •d ã ¢¹-gæ×”ÿøÇß|ûúÒ—¾ôÐæúû¿ÿûyÀ~ð­B©¶ggM[ÿrpfÚ@4´A@%ÙÂ8õË%î~άŽ/’¥³VÎf9÷õ±}ìï|§Û·Þzë¿}Ýwß}ŸÚ\ŸøÄ'æ·ß~»»åïxLJ>ô!ä±Çûßÿýß3‰«¶'_˜ÎìLÛs/Z% ’laœÂÚÇtœ™-­˜³VÎf9÷õå/ù»ßýî³I×÷¾÷½G}Ô¹çž{œK[5w¥8ªí)i‚Ø àÌ¢úœÁè„€J²…qì²ÅÈz ëÌþå_þÅw­ØsÏ=çìÙ o_/¾øâOß¾~ñÖ5ÿïÿýßÿÍÃÜ-ÓîZ57ÝŸýÙŸ}å+_1Z4Õö¬§ßÉ$‹3{‰ ¨›€J²…qÑÜΖé îNg÷o|ãpéÃþðç?ÿù§Ÿ~zu.æÕøCg³Üį¾úêo¼‘Vqw£»Ýq¡\Àɨ=óÌ3ÿðÿàÞ*u |üãwîп<ÕöL[w%À™‰÷-á Еd ã$«7^H`gæÞšt†Ì½±èÞ¬üìg?»2dÏ?ÿüy+æ/âÒ¨¹éœEs¾Ð¹ÃÉ¢9¿¸+;ªíyaƒ95ά‰Ç(IB@L@%ÙÂ8cJpë«îÞ™9OöÑ~ô=ïy3dîÅå ™sHîÝÉW^y¥|ݤnj—€óˆÎ¢9¿ø|`ëÏTÛ³üŸg&~àMPI¶0ÎàZÜèò;vf³'sç_2wBöóŸÿüò’¹ƒ4—†KÆY´¯~õ«[¦Úž—¯t´pfMáÔ¨?›<™31û·ëþ;Ìß>5çɶþL²=GkéË׋3K|°qš&€3»\|{J`ù ô†üÙìÉÜ7:óàƒº}á~;FëžlåÏÜߌê©ÙFX άéÇ+ÉC ‘Îl}/¹Æå'œÞÿþ÷;ö“Н§žzj:'›<Ùô«öÝ߸tûÂ]î»%Ñ1V²8³Š÷#©AoÀ™ñ0ÈA`éÏÞõ®w¹S(çrêÙrßÿþ÷¿ð…/8ã¸ôd“3û‹¿ø‹É–¹ëOÿôOsÀ!&Œpfõˆ™@ œ™Q"–@`ògO<ñ„û³Üν÷½ïýÜç>w¡EsÆë‹_ü¢3dî—ø»?vé~µÄò÷“¹TÝÙl˦|ë[ßJX8·@@BgVîYÈL¨‡ÎL" ñpþìG?ú‘ó@ßüæ7݇·œE{ßûÞ玬ÜÁU™02÷[0ÜŸ0ºï¾ûV†lúCãÓgüÝ!ÙÊ™Ýu×]WÀ™•‘f@]pfWiîhó¾þúëî³îor;'ôØc¹#+wpå®~ðƒî½Î¯}íkB£æ¦pŸosasFp2d«ß‚áÆ¸d\J.±©îxle˦ÿ}ôÑGG+ë­„@gæþž P3œY%=©A8³“¹}&05÷!0wd5_G]½ãnI³b+þ83²¹œY k#ÔJE²¿88³þj:òŠÐº‘«_ÏÚqfõÔ¢ÞLP«zksuf8³«+ÀüJh’&±R àÌRÉtj5RµãÖŠ3‹ãÅèº  uu×g”ìpf£TúÌ:Q«3ôú¾gÖw}G[Z7ZÅë\/άκԕjUW=jÊgVS5Èå,´î,AîWÀ™)(öµê½ÂéëÙ¥³ãÎú uõÕdÄŒpf#V=vͨU,±qÆãÌÆ©õ+EëF¨rýkÄ™Õ_£ë3D­®¯A­àÌj­ y¥@ëR¨qšÎLM´Çx¨UUÕ¬ g¦áH”: uuÔaô,pf£w€eý¨•…Ò˜cpfcÖ½×U£u½V¶­uáÌÚª×5Ù¢V×poaVœY U"G+´ÎJŠq9 àÌrÒí%6jÕK%õëÀ™é™ñ:hÝuì™ù·pftC˜jf4êœÙ¨•ïsÝh]ŸummU8³Ö*vE¾¨ÕÔÛ˜gÖFÈÒF­³qbT^8³¼|ûˆŽZõQÇ«À™å JÌ« uW‘gÞ%œý&€Z…:g6jåû\7Z×g][[άµŠ]‘/juõ6æÄ™µQ'²´@ëlœ•—Î,/ß>¢£V}Ô1Ç*pf9¨ó*hÝUä™—w3é8¨U¯‘FãÌFªvÿkEëú¯q +ä̬…*]#juuêgVomÈ,žZÏŒ;ôpfz¦ýED­ú«©jE83IâÔ@­«¡ ä€3£ÂP«0£QGàÌF­|ŸëFëú¬kk«Â™µV±+òE­® ÞÆœ8³6êD–6h£òÀ™ååÛGtÔª:æXÎ,Ub^E­»Š<ó. àÌè‡0Ô*ÌhÔ8³Q+ßçºÑº>ëÚÚªpf­UìŠ|Q«+¨·1'ά:‘¥ZgãĨ¼pfyùöµê£Ž9V3ËA•˜W@ë®"ϼ¼›IÄ@­âx4g6Rµû_+Z×[X!gf-TéêQ««+Pïü8³zkCfñкxfÜ¡'€3Ó3í/"jÕ_MU+™©H§h] U œ=&€Z…:g6jåû\7Z×g][[άµŠ]‘/juõ6æÄ™µQ'²´@ëlœ•—Î,/ß>¢£V}Ô1Ç*pf9¨ó*hÝUä™wIgF?„  VaF£ŽÀ™Zù>×ÖõY×ÖV…3k­bWä‹Z]A½9qfmÔ‰,mÐ:'Få%€3ËË·è¨Uu̱ œYªÄ¼ŠZwyæåÝLz ŽjÇk¤Ñ8³‘ªÝÿZѺþkÜ 93k¡JWçˆZ]]zçÇ™Õ[2‹'€ÖÅ3ã=œ™žiQ«þjªZÎLE’85@ëj¨9àÌè0Ô*ÌhÔ8³Q+ßçºÑº>ëÚÚªpf­UìŠ|Q«+¨·1'ά:‘¥ZgãĨ¼pfyùöµê£Ž9V3ËA•˜W@ë®"ϼK83ú!Lµ 3uÎlÔÊ÷¹n´®Ïº¶¶*œYk»"_Ôê êm̉3k£Ndi#€ÖÙ81*/œY^¾}DG­ú¨cŽUàÌrP%æUк«È3/ïfÒqP«8^#Æ™Tíþ׊Öõ_ãVÈ™Y Uº:GÔêê Ô;?άÞÚY<´.žwè àÌôLû‹ˆZõWSÕŠpf*’Ä©ZWCÈgF„  VaF£ŽÀ™Zù>×ÖõY×ÖV…3k­bWä‹Z]A½9qfmÔ‰,mÐ:'Få%€3ËË·è¨Uu̱ œYªÄ¼ŠZwyæ]À™Ña¨U˜Ñ¨#pf£V¾Ïu£u}ÖµµUáÌZ«Øù¢VWPocNœYu"K´ÎƉQy àÌòòm4úK/½´:Ymt!¤›Î,7aâ—$€3+I›¹ŽàÌè/¼ðÂ]wÝõÈ#LmV«Çüþûïwß…&83:¡'8³žªÙîZpfíÖ.oæõWåšc{¹¯ç˜èMÀ™5U.’ À™Ñ"5À™ÕP…spc·ÝvÛÊ™¹¯p`Vcµ®Ë gv{fÖÀ™é™1žÎ,žÙ0wlÍ80¦øÖ…â̬¤×œY Uê?GœYÿ5N^áêØŒ³d’߈3븸. g6`Ñ+\2ά¢T”ÒòØŒ³Š SM*8³jJA"83DBœ&€3;°ëó±f]×9}q8³tvÜYœY}51#œÙˆUZótlÆY´qãÌÆ©õ+Å™Påú׈3«¿FgèŽÍnܸÁd^\†Z§Ç™ÕZòJ!€3K¡Æ=j835Ñ·â¹_ÓºûËÀøb \u²T}È 8³!ËÞí¢qfÝ–¶©…á̲”‹í«((Õ|3ÌÈÎŒ`5¼Ð"ø ´øRg&|Hý6”ÃúW­¦¦¿yóf–Útdg†Å¬ÙYn“Zܧ8³,­†3«Õ•½™—ÊLdiÖ‚ª`6ªž5÷9¹A³à·õRg–åIˆ3«YTf"Kë´TgVó–!7´K@¥Q%µg–…6άæmÜâFÍÒ¦Š *˜8³š· ¹A ]*Rè¥5ÎÌJ*jœÃú+®Z ´¸Q£Ú¯ä`LœY»O>2‡@ÍTu‰®ÞÒ¢2–$5άVWöf^-nÔ¨ö+9X³Eýáh¼æç1¹A`" Ò¨Ktg¦ÄŽ3Ù)û©âX*ÕkÔ™ÕÜçä4úRœw3³<ôpf5+‚ÊLdiÖ‚ª`âÌjÞ2äv ¨4ª¤6ãÌ²ÐÆ™Õ¼[ܨYÚTTgVó–!7´K@¥Q ½´ÆÀ™YIEsXÉU+7jTû•¬‚‰3k÷ÉG標€J£.ÑU>g¦ÄŽ3«Õ•½™W‹UÙÒX*˜:³šûœÜ FŸ33écêí`8³šAe&²´NkAU0qf5orƒ@»TUR›qfYhãÌjÞÆ-nÔ,mªª‚‰3«yËÚ% Ò(…^Zcà̬¤¢ÆáÌjÞÆ-nÔ¨ö+9XgVó–!7´K@¥Q—è*Ÿ3Sbw­ð:W­ZܨÊî”ÆRÁÄ™µûä#sÔL@¥QRá ãÌ, mœY­®ìͼZܨYÚTT³QgVsŸ“ ШàãÌO§M œYÍŠ 2YZ§µ *˜8³š· ¹A ]**©Í8³,´…Îì–ƒëÌ>q!coŸ²ˆ½«Îñ-nÔ,mªª‚‰3«s³Z' Ò(…^Zcà̬¤¢ÆpfÉV)íÆ´»êÜÒ-nÔ¨ö+9XgVçf!+´N@¥Q—è*? ÄîZá5Ñ5Y¢m°ù(-vž£€þ8iwÅæVf|‹UÙÒX*˜8³ÖŸä: ¨4J*œü@IœoÏUÀ™9“æ–JÞUÆiÅÎÒâF½¢‹Msª`6êÌb{ñ€@a*2 ¢hïfŠ@þn˜2ÎìÈœm?™6ï„Õ·–;Äs×r¢å0ÏIžçHÏ“ÃnžòmÜâFÍÒ¦Š *˜83yŸpT¥ÐKk œ™•TÔ¸«œÙÑ Ìï‡îº¢à]³3³{¾#·;—ß ¦òy$©ÅÕ~%«`âÌxˆB9¨4ê]åsfJì×:³Us¯œÍÖèìZŸÝ»–Ÿx †ÝéÙ'Úz5áŽmq£*»SKg&ìpBA3•FI…“Ï™•ĹøœÙ«¢kr3GÁüßîZ±Üb¼+*vꣀÁ‰¢`·¸Q¯èbÓœ*˜:³¨Æc0 Pž€J£L‚(Ä»™"›Ï™©ú/Ù™­Þ7œó±œïõßå7RGA¶__Írôîª i‹5K›*‚ª`âÌTíM@`I@¥Q ½´ÆÀ™YIEsXU{Ãb¤–smÍnÀ3w}U0½`ÎÌ¢Ú¯ä`•êáÌTŠA@gVò)ÐÌ\W9³¥Á::îÚºœ´»VïxZ‚¬ôb{‹ÖÉ“ÊL4ÓŽ9UÁÄ™%?M=ŸvHŽÙú±Ÿ£H[/äÓ¸í>$¡vƒ¨4*§Ž®csf–…vgvä±ü}¯ºk×™%l¹e>8³,í˜3¨JõpfiO¦2[&-· ï*àÌ ¯ªon’*Ê©£8³"t]+üBtM]» 68-¿µ¼v4fg9o0NÚÔnÒÕ–8'Ѷ¸Q‹´mÊ$*˜:³“­xþö#}8¹é°˜¢éØ“ÏMR¥Q)ú˜zgf©ä¼÷ÉÙò¿å¿WÝ4l×cÍ_Œ½k7KÙ‡­ïšBÏûžßÙâFÍÒ¦Š *˜8³´®ÎýTKËêò» `)0ÅåË$›¤J£zi3³’ŠWÀ™í™]C³{.ud×VŽmšhŽ`÷…«ç„-–Ë2&Y5ZܨQíWr° fµÎì™gžqïÚì"Umóí«Ïùr/û7ûüÝ£W>»¯ëV/ŸŽÆlcîîGÏC÷H”–ºÜãGr´Üó:6E¬@yds©“[\áÝ•VO9v#9Èö9²l! ó¨5[b;@¥Q—èê-Õ*cIª¹T’Ð…Ü$ÐâFUu¦<Ž fµúó¯ÿú¯wÜqÇg>ó™^xaEïü6?yÒìqf[+p4×ÑK&±³Øµ£f«éVF0è`üÙnƒï¦q…Ý™íÎu䕪¶5v~·êÉ<ËlÎ<¯1<‚ó%Ý?@¥QrñôäÌ, íó’}²¹ÝC Åš¥MAU0«ufîÀì¶Ûnsé¹ÿÞÿýîmÆv~›ï)ÙÏ{f[³û¤ú§£S«#ãq9ží\£ç Èvå#ý ƒ3n]éÑW‚J›yy‹%Oœ,eT+zŽÊ¶.×e\cõÑ•F)ôÒgf%5î¼d'w!7 ´¸Q£Ú¯ä`Ìj™ƒùîw¿Û¥7_ùÈG¾õ­o¹¯gÚæ–Ç¡ç‰tB[ç9ß2š»…Z͵›í®Õ8J{…‡¡eF ã8gòÜ®åL&[‡[¦`!V,lÓÖTuÏ•F]¢«¼›©ÄžI²Ït'÷ΖOYþ 4“]n«Õ{:«Øö\áÈNYžå7ãïfñø¹–“>i 9节3®hûÜvWÌ!ÖÖìZ:K5Ö²{öæ7O~,Û -Ü‚,k<³ÑpfJsÓt,­dŸiJîÝhq£V»T0k>3»÷Þ{WîÍ}åÉ'Ÿ”ls˳pwÌUÎÌxLâ9:²œåø}OÐá̶VÞÓEsMƒÝ˜àhqf êÍ»™ зH$S•‰€ÊL„û`€*˜5;³å»™wÞyçã?>öü6_>çvÏ±ŽŽ‹fç±õ(Q'A“ätHÁ·®üG8G œ7èÌüÚbaÌ!èH<<õÝÞeÉd÷3Xýà]F›žà³uTS•F•”sœYÚë+\µhq£fiSEPÌj™û €7n¸ôÜ~øá%³óÛ|zü¬6ÊîÆlGÅ\N¸Ñ’ê”ù³çž{n—Ãùm>?ضÿØ}Ê.‡9$¿3óLt”ÌÑn²[ÀUª»'1F&G~hëW“ÙˆÕ±ŸÇ›z<ß¶vÛ8Gõ ž]Yj·;&ˆtk"=qÓ‹Üë!ÐâFj¿’ƒU0‡ufõlÕØSŠØñõ¬”L†" Ò¨Kt•w3•Ø]+üœ«V-nTewJc©`6êÌjíñ”¼&§e¼3j°1&à ƒ€J£¤ÂÆ™YÚ8³L³Åš¥MAU0qfªöNŽc1[«7¤’çâF# Ò(…^Zcà̬¤¢ÆáÌŠíº„‰ZܨQíWr° &Î,¡“µ·Ä:3íìDƒ@&*ºDWy7S‰g–iI¶¸Q•Ý)¥‚‰3“ô6A •FI…“w3Kâ|{.œYÍêÐâF½¢‹Msª`6êÌ~ÆÔM@¥Q&A âÝLÈß ã°ÖÝ«Cg×âFÍÒ¦Š *˜8³¡÷$‹‡@6*Rè¥5ÎÌJ*jÎ,Û.nq£Fµ_ÉÁ*˜83AgØPiÔ%ºÊçÌ”Øqf5ëC‹UÙÒX*˜8³š· ¹A ]*’ 'Ÿ3+‰sñ9³vû¸ûÌ[ܨWt±iNLœY÷ûŽBà*2 ¢hïfŠ@ò9³Kö\Ò¤-nÔ,mªª‚Ù¨3{™ ¨›€J£zi3³’Šç°ÖÝ«Cg×âFj¿’ƒU0qfCïIlTu‰®ò93%vœ™—ýçþç7ß¾þîïþë±Ç›ÇüøÇ?nÛ7ª²;¥±T0qfÂ' 0Pi”T8ùœYIœ‹Ï™±1f?øÁœÍrîëCúÐ;Þñ·OÞóž÷üñÛ×<ð©½ëž{î™ÇÜzë­î®|àù—ù¥/}é¿þë¿Îàmq£^ÑŦ9U0qfgZš{!#*2 ¢hïfŠ@n>g6ø>yâ‰'œûØÇ>öÎw¾óöÛow6˹¯G}ô{ßûÞ³©×W¿úÕOúÓ÷ÝwßýÑ9¯æŒÚ_ÿõ_å+_qÎ/Šv‹5K›*‚ª`âÌ¢z˜Á€€‘€J£zi3³’Š7ì»™îýÇ?ÿó?wcwß}·³b_þò—¿ûÝïî:±ýèG/¼u¹w*úöåþrÀ«o]¿øÅ/æ/¾øâ‹ÓHwÍ¡žyægÔ|ðAgþœósÿugiF‹ÖâFj¿’ƒU0uf/qAuPiÔ%ºÊçÌ”Ø]+ÔÝ«âì¾ño¸7%!sï?~ö³ŸÝ=sVì'?ù‰{•ãŒ×Ö¯½öšû‰LjiÔœtgi΢}ô£uíùçŸ÷¬°Åz†XÖ{U0qfâ=I8@à-*Ê*¤«àœ™e¡=ˆ3sçaCæì‘ÄŠù+45w`æNÔVmWšZܨYÚTTgÆcÈA@¥Q ½´ÆÀ™YIEëÞ™9OæN§Üù·'dι÷ÝÛ‘QÄ$ƒKs^piÑþðÿС­v{‹UÂ'GLœYŽg1!•FåÐÏ£˜8³,´;vf³'s§SËM†ì•W^É42èdÑ\J.[÷.çÊŸµ¸Q#”®‚Ù¨3›? É? : ¨4ªœªþú×8³,´Ö:{ôLVßùÎw¦s²•'sŸ÷rŸÜã7² <Ô}¦ÍùÅÙŸýã?þ£#ÐâF=‡!ãÝ*˜8³3{“{!#*Ê(£›Ð8³,´;sfîýGžìäÇù³Ðßýå/¹ôg-nÔ2 fQÁÄ™ñd…rPiT‚<&ß‚3KFç»ñÎ;ïtï M'4M_O?ýôÇ?þq÷3Ûs²&<Ù²H³?s¿bÍýÒ ÷Vl–ÚT¥z8³¦…‚ä!P-•F•”vœY.ÚÏ=÷Üô §FýÙäÉœ‰ùüç??w‰s3î½Ëæ<ÙÖŸMŸËUû‘âªTgVíƒÄ Ð4•F•ÔuœYFÚî‡WŸpj¢¿—žlr0S—´îÉVþÌU§ÎÏÆeìÈ ¡Uª×¨3s?hÂÔL@¥Qäó0$Î,/íÕ'œþéŸþ©æ~ê©§æs²åÏ]º.iúœ,oÇŽ®R=œYÍÊ@nh—€J£J*=άíÙŸ¹?"ä~Qþý÷ßÿõ¯½žFÿþ÷¿ÿ…/|á½ï}ïôÞåÒ“Mçd->5KÔ•9?Ý}F‹=ær®g“  °KgvRœ;¿}ògîçÝoguÅÈY´O~ò“îWQ\µ&Cöþ÷¿ßeò‰O|ÂýÉË­'›JÒâS³ófªfy*Õk±ÇpfWióBÀN@¥Q%E—3³’´ßœkògî— :‹öéOÚýz0÷S΢ýÇü‡½ÕÎŒt†ì‹_ü¢û-“!s|iÈܧ¯¶Ÿ'kñ©Yº®£Î§R½{ gvFˆ¸e¨4ª¤ÆãÌJÒþí\¿úկܟåvhú=õ΢Ý}÷Ý®ï{ßûÜ{î(KhÔœûÚ×¾öàƒ~ðƒtnÌ]î‡FW¿Ù³þð‡îïx8ã¸%ÒâS󚺎7«JõZì±7n¸´¹ š ¸ßúÔÜããÌ.~–:‹öòË/;‹6µÎc=æÞëtGYK£æLÕ?ÿó?ÿû[×·¿ýmwä¶{ýÏÿüÏ4Æ]ŸûÜç–Vìž{îùÔ§>õ裺ƒºå ÙdÈÜOŒ¾þúë->5/®ë0Óì̦"¯6ÿÛ.÷kÝ›Ó/;äê@CªŒ3«¥Xî°jiÑ–FÍ™ªøÃî£iîrÂ1¿:y×»Þå>%vë­·N_q‡aÓw=ðÀGVlŠ|óæMw’ìþ¾¤eý83 ¥1ÇàÌܱwϰ1WäÞ»pýìþ;æòû^µÛ§ I4άÆb9ÃäÞëtÎi>KÛÝ3O<ñ„û”˜ñž³bî¤Í™¿„ß3«±KêÈ gVGÈâ,'ŒwÜq‡ëg÷ß‘<;=÷C`AgÖ@;LFmú-µÎ«M—û¨þÖ®¹—ógìÜø4+¶‚‚3k K.Jgvx¦xøá‡ç·#Ü¿ÅÑ 8³Z£ŽÅ™ZùðºqfaFŒ¨žÀ|`6™3ŽÍª¯Xç âÌ:/°dy83 Æ.ƒà̺,ëh‹Z˜MæŒc³Ñz ªõâ̪*G¥ÉàÌ*-LiáÌ*()œ"°:0ãØìMnVÀ™)(ögÖ{…Óׇ3KgÇuؘqlVGeÆÍg6níí+Ç™ÙY6g6ZÅ;[ït`vçw>ôÐCŸùÌg\?»ÿº¿ûÝïæÓfÕº¡åàÌ*Öe©âÌ.C_ýÄ8³êKD‚>î·=õÔSóˆ¥Ö¹o=÷Üsàƒ@y8³òÌÛ›gÖ^ÍJeŒ3+EšyJ@ëJPfŽœYˆßÿõ¯Q+ºàˆÎŒÞè‰Z×S5Û] άÝڕ˵*Ǻµ™pf­UŒ|}Ð:ú£8³ªP{¨Uíº.?œÙuì™YO­Ó3%b<œY<³ñî@­Æ«¹uÅ83+)Ƶ@­k¡Jýçˆ3ë¿ÆçWˆZgØkœY¯•s]hݘu¯mÕ8³Ú*Rc>¨UU©#'œYu ´NÑ(çàÌÎñãnÔjŒ:§¬g–B{j%€ÖÕZ™±ò™Uï´Õ¢ViÜF¸ g6B•ÇY#Z7N­k^)άæêÔ’jUK%êËgV_MÈ(Z—ÎŽ;upf:–ýFB­ú­íÙ•áÌÎäþš u5UcÜ\pfãÖÞ¾rÔÊÎj´‘8³Ñ*Þ÷zѺ¾ëÛÊêpf­TêÊê˜c8³T‰y´î*òÌ»$€3£ÂP«0£QGàÌF­|ŸëFëú¬kk«Â™µV±+òE­® ÞÆœ8³6êD–6h£òÀ™ååÛGtÔª:æXÎ,Ub^E­»Š<óòn&=GµŠã5ÒhœÙHÕî­h]ÿ5na…œ™µP¥«sD­®®@½óãÌê­ ™Å@ëâ™q‡žÎLÏ´¿ˆ¨U5U­g¦"Iœ u5Tpfô@˜jf4êœÙ¨•ïsÝh]ŸummU8³Ö*vE¾¨ÕÔÛ˜gÖFÈÒF­³qbT^8³¼|ûˆŽZõQÇ«À™å JÌ« uW‘gÞ%œý&€Z…:g6jåû\7Z×g][[άµŠ]‘/juõ6æÄ™µQ'²´@ëlœ•—Î,/ß>¢£V}Ô1Ç*pf9¨ó*hÝUä™—w3é8¨U¯‘FãÌFªvÿkEëú¯q +ä̬…*]#juuêgVomÈ,žZÏŒ;ôpfz¦ýED­ú«©jE83IâÔ@­«¡ ä€3£ÂP«0£QGàÌF­|ŸëFëú¬kk«Â™µV±+òE­® ÞÆœ8³6êD–6h£òÀ™ååÛGtÔª:æXÎ,Ub^E­»Š<ó. àÌè‡0Ô*ÌhÔ8³Q+ßçºÑº>ëÚÚªpf­UìŠ|Q«+¨·1'ά:‘¥ZgãĨ¼pfyùöµê£Ž9V3ËA•˜W@ë®"ϼ¼›IÄ@­âx4g6Rµû_+Z×[X!gf-TéêQ««+Pïü8³zkCfñкxfÜ¡'€3Ó3í/"jÕ_MU+™©H§h] U œ=&€Z…:g6jåû\7Z×g][[άµŠÉ÷É'Ÿüä'?ùÌ3ÏL³ÍjõÒK/=òÈ#?þx‘,˜¤8³ŠDŠf833*f$€3Ë·ÝЯ¾úêwÜášã®»îº÷Þ{Ý?ܧÜvÛm/¼ðB»K#s-œ™–'Ñ®%€3»–?³Ï§!ϾuÝBGÒK?ü°k‰íõÐC 3œÍОƒ=U³ÝµpfÖní²gîÌVÎ̤¹ã´ì3A;pfíÔŠLÃpfaFŒÈOg–Ÿq³3¸Ï“­œ™;Hkv5$ž…Î, V‚^Dgvx¦ý83ÂGà#ùÈlÎܰ °"€3£%z"€3멚í®gÖníJdþÔSOÍÎŒÉ,A¼µ9pf­UŒ|}pfôG pf5T¡êî¿ÿ~×%îð¬ê,Iî"8³‹À3m8³,X Ig l¼áîwd¸ß”áÏÆ[:+À™…1¢8³vjÕs¦zg¶ý¾Ý_¾À! ¨>58²3Cë.l`¦†€‘€JëJ:A½3ã5GÉú1Ò¨öéÈÎLÅ0­‚ÜX´¸O³8³7¸ º L;ÿæÍ›ióŒÜ™Õ]d²ƒÞPiÝI©ŒºgFãB`DBG5ý‘(ÝÙnôu툭Ú!Е֔¸¨ÛqfMµÉB@D@¥VÂ8QÊUÃ`·vQ5ä" Ò¨’šƒ3ËÕ Ä…@ÍTj%ŒSRø$sáÌjîprƒÀD@¥QÑ0ÉâÌ~ÅÔM@¥VÂ8Fͪg˜[{ÝE&;@àW**©<83#P©•0NIá“Ì…3qç°æÖ¨4J"Æ 8³ÖºŒ|!   R+a£fÕ3 g¦èDb@ /•F•TœYÞž :ê$ R+aœ’Â'™ gVgo“–T% cœ=  ¨ÔJǨYõ Ù¸sXskTURy²8³_rAuP©•0NIá“ÌåÖ^w‘Éø¥J£$¢a ‚3£q!0"•Z ã5«ža8³wkn€J£J*άµ.#_(¨ÔJ§¤ðIæÂ™):‘ÈK@¥QÑ0Á™åí ¢C N*µÆ1jV=Ãpfuö6YA`I@¥Q%•gFC`D*µÆ))|’¹pf#îÖÜ•FIDÃ$‹3{ ¨›€J­„qŒšUÏ0·öº‹Lv€Àë**©<83#P©•0NIá“Ì…3qç°æÖ¨4J"Æ 8³ÖºŒ|!   R+a£fÕ3 g¦èDb@ /•F•TœYÞž :ê$ R+aœ’Â'™ gVgo“–T% c,Îì5.@ n*µÆ1jV=ÃÜÚë.2ÙA¯©4ª¤òàÌh\ŒH@¥VÂ8%…O2ÎlÄÚ[# Ò(‰hƒàÌZë2ò…€‚€J­„qŒšUÏ0œ™¢‰¼TURypfy{‚訓€J­„qJ Ÿd.œY½MVXPi”D4ŒApfô0F$ R+a£fÕ3 g6âÎaÍ­PiTIåÉâÌ^å‚ê& R+aœ’Â'™Ë­½î"“ ðªJ£$¢a ‚3£q!0"•Z ã5«ža8³wkn€J£J*Ï@Îì–[ni­£ªÈ×q›Ñ-ÿ}”œeÌöÞ|ÕI˧ôù˜¸Õ©ÔJ§¤ðIæªÁ™em’vAl«ýžiû†=v½™°Ç6Ã4^¥QÑ0Å™UÕ(iíuÕ]œYÖêd ž¯(¹ÓV©•0ŽQ³êv¹3ËÝ$ùÚ;_äÎl4ì ëM¸%_K¨4ª¤òàÌòõC'‘c÷Xìx‡)á–Nà/#7•Z ã”>É\8³ ·aî3 ^% M¸%_/©4J"Æ YœÙ/껦F©/¯2ŠE;Þ!H¸¥pçRÌÍD¥VÂ8Fͪg˜[û¹"Ÿ½;w“œÍïŠû 0)0ÅäçLXoÂ-ù–¬Ò¨’ÊÓ’3›Š½¼¶µÜàùâl V¾Í3ËÜs–1Ë =Íjÿ–ùiÓùÁ.sÛÍs•RpÌj€¿¦Èó˜Ý½½›£'+KÌ™'ZvàÜ„Á>?¯b*µÆ))|’¹Î;³dM[µÍªsbeÍÒÒž}Üw«ÛP–m²ä(ÔjúŸ»²y”’eoÚõ|wû{V::Vü„=}TÂÝÈG‚…¶x—]sŒÎì(`²DŸ#Ûz%ÎÙþX-0ö |Z—¿mæXéSi”D4ŒAÚpf»•î@ÿn·tä®Í2Þ•Þ®È.¿xôœö?¿©Úõײ(‹¥Ʊ¬×2QÐYZäÒ¢ŒÁmÍ_ãêbEj¯R+a£fÕ3ìŒ3;¯i¯ïyŽåÅøà´{ã8Ã4O»1-šiÙ›Á8B‰;SI+›¼X ê ª4ª¤ò´çÌfË¿»å¶¯xŽöspçø_TŸÖ–—&É–h×2žÜc~°»£΂»­Qð`·È[Ëà–„8ø™û»q7f‚«j}€J­„qJ Ÿd.•3KÓ´«œ™ËÖoøŽ”s›°åTZ»Šn%hKÞ.Á½æ7…–µµ(6ÿxË#àH`ýÏ;ûbcË$à¨4J"Æ Í8³UÓì:°Ý1W9³• Y¼¿g'[:;Í™ÁzœEÅ;¹v•F•TœYtÑ-´:=Žžƒ*&`i€ŠÓÿMj*µÆ))|’¹†rfhZU›zUŽÝÿ­*á`2G+ Þ Ò(‰hƒàÌ‚e]°<˜—M=7ÔMÀÒu¯àÍìTj%ŒcÔ¬z† ëÌêoïî3ìÏ™M%Ëñ@¥Q%•gÖýfØ! R+aœ’Â'™«gÆ@ÇT% cœYÇ ÉÒ pH@¥VÂ8FͪgÎŒ ú ¨4ª¤òdqf?ã‚ê& R+aœ’Â'™Ë­½î"“ ð3•FIDÃgFãB`D*µÆ1jV=Ãpf#îÖÜ•F•TœYk]F¾PP©•0NIá“Ì…3St"1 —€J£$¢a ‚3ËÛD‡@Tj%ŒcÔ¬z†áÌêìm²‚À’€J£J*ÎŒ†ÀˆTj%ŒSRø$sáÌFÜ9¬¹5*’ˆ†1Hgö2 P7•Z ã5«žaníu™ì —UURypf4.F$ R+aœ’Â'™ g6âÎaÍ­Pi”D4ŒApf­uùB@A@¥VÂ8FͪgÎLщĀ@^**©<8³¼=AtÔI@¥VÂ8%…O2άÎÞ&+, ¨4J"Æ YœÙK\€@ÝTj%ŒcÔ¬z†¹µ×]d²ƒ^RiTIåÁ™Ñ¸‘€J­„qJ Ÿd.œÙˆ;‡5·F@¥QÑ0Á™µÖeä •Z ã5«ža83E'y ¨4ª¤òàÌòöÑ!P'•Z ã”>É\8³:{›¬ °$ Ò(‰hƒàÌèaŒH@¥VÂ8FͪgÎlÄÚ[# Ò¨’ʓřý” ¨›€J­„qJ Ÿd.·öº‹Lv€ÀOU% cœ  ¨ÔJǨYõ Ù¸sXskTURypf­uùB@A@¥VÂ8%…O2ÎLщĀ@^*’ˆ†1Î,oOuP©•0ŽQ³ê†3«³·É K**©<83z#P©•0NIá“Ì…3qç°æÖ¨4J"Æ YœÙO¸ º ¨ÔJǨYõ sk¯»ÈdüD¥Q%•gFãB`D*µÆ))|’¹pf#îÖÜ•FIDÃgÖZ—‘/Tj%ŒcÔ¬z†áÌH ä% Ò¨’ʃ3ËÛD‡@Tj%ŒSRø$sáÌêìm²‚À’€J£$¢a ’Å™½ÈÔM@¥VÂ8Fͪg˜[{ÝE&;@àE•F•T½3»qㆠÊÔLàöÛoö­ë¤Ü¨TÏÅ9™IùÛѺš;œÜ 0Pi]I…Ñ;³)ûIô¹ Ê œ”›‘ZWyo“–Nj]ÉÛs9³çŸžž€*'àöéI¹Á™¡u•79éAÀ8¯u'¥2êö\Î,* CÀ™5Z8Ò†ª%€3«¶4$àÌ()BMÀ™5U.’…@epf•„t æ àÌš/! €À…pfÂgj@ K8³.ËÊ¢ PˆÎ¬h¦†!€3¦Ô,àÌ2@%$ 04œÙÐågñ8Igv ·CXÀ™Ñ€@:œY:;î„ °GgF_@épfé츀Ό€´pfZžDƒ À™=¤À™¥³ãN@œ™Ñ€€–ÎLË“h€83£ t8³tvÜ @€33zÐÀ™iy €gfô Ng–ÎŽ;!pfF@Z83-O¢AàÌŒ€Ò àÌÒÙq' ÎÌè@@Kg¦åI4@œ™Ñ€@:œY:;î„ À™=h àÌ´<‰@€33zH'€3KgÇ€ügf7nÜp"Ë@ÀNàþàž}ë:)°è9#!¾ ̺zË$¬“ÈrAˆ"pÒ™¡?Q´ Œ@à7ÎìùçŸaµ¬pº!qfè°(„‚š&àôðÿ 4„°1ÍŒPIEND®B`‚astropy-0.3/docs/vo/images/validator_html_2.png0000644000175000017500000015606212243255342017772 0ustar oleole‰PNG  IHDR Oî°H—bKGDÿÿÿ ½§“ pHYs  šœtIMEÝ;Hù™ IDATxÚìÝlõ?þ§+ç4ƒœv¢ä´S%_yP8e ©²K¨ð–œðBªb“Sc“JØÀ ›r*N¯¢vZP‰MÕÄ•ÆT±Q!v¤†8U;ˆ5jÀFvÑ^t‰2VeVMäY5QfÔXÚïãýmÏzí$Î>’{~¾çý~ÏdçµïeSSSqÊADDDDDDDDD%è[Ì""""""""¢ÒÆ !Q‰cˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*qKfNcÓ4aš&KŒˆˆˆˆˆˆˆˆ A˜uÆ“œ+_j…¯ž‰ <>-ª²ôˆˆˆˆˆˆˆˆJE¹y¥ oµÊZãÝOr˜½K)±ÚyÁÑ ›kQ»Zaé•í¼Šà‰Ô d‡±!Æ“œI §oþÄŽŸ "ðP=|^KŽˆˆˆˆˆˆˆ¨ÄȲ y¥Œ‘£¨´ÅQ<‹ñ$g|â’ÛV¬€9E :jQ ²[f©•(YQ E5ÇÛ3žäÌ‚ o[±`Æb0§aPÈi4IDDDDDDDT”k€zZ…zZ…a7,‘‰ùï\HŒ(϶¡Ó”'P¶e]GfÒrYÇØ&?&ÊÊ€”£¬ zYÙ-]-lLÂÛV¬À»cgñˆÿvè1²pã"´†a@TFa\±*»X!ÂívC©T Š"DDDDDDDT’´KÜn7DA„Õ ®¹1q’;«îÄ×_£ÊSu}O| À2 û`“¦ ¬r¡ûhM÷*Pd Þ7ö#öÝ»+ÙÁE­¬ r<~KÖ‹iIxÛŠøxâLÓ È™Ó¦Õ’ðŒs¨i‚‹Åàr¹ ¬U ¯–¡T*PϨ~„vN㈈ˆˆˆˆˆJ’Ó!.e€išVÐì:QO«(++CYYöüñ$³¸…ó± À5 tÉ*\@9`š>±f>=UÀ½Õ9w½•û¸Ý’0 T£º¼Ûÿ½¼ÛO]¸¡\X”y•µsB_…àßè‡ ˆœ‰@=c°iZK¡\@è‹|ðA^ÃþèDDDDDDDT:ô‹:ä•ÉxˆËå‚Ó!­’ýÜ‘ «õàÙ ˆ^2¡ÅtùwV݉©¿O]—4Ø–²KÄdÌÊ@XM†Í €Ô6–·ú xEµ$L  å€ ïþå,Þ;›üwì,¿Æ3¿= ˆ]Òe¼BÃ0ú"ÿ½~H«$ˆ‚ÏZ$—sÚLhY(• B_„æÝï^×u ôÌ;­š¦¡ë¥®ëZÐêiþjÿ‚+Y]¶蛆Ч!”••|¼Þ×{‹jZl9¦•å5ë÷ž—{²–/öu,v,4Ÿ ¹ö%_ž’/ó-ïbòn¡ël¡õ0³¾;¾ækÀðÑaôìîAÏ+=+lýM’GDDDDDK‘®ëÐ4 Ú9 ªªB»¤Ar%ƒq’K‚vÉZ¯Ó it]_”´ÜYu'výá$úŽaï;‡1x4ˆÁ#C°8s[Ì¡v½¸œ8¯ ¡<ùŽ¢}AØ ¯ua¸Ò…ˆËZµ#8— „Â!O #x|ÁÃ}:ýâõ‰ºŽá£‡çßž/ ŒLêØ3›0Ò»—˜61yÞjѧ_‰A¨!‚^zF…X!Bª€k€~EGðÃ`V—gs¦?¹9mB=£¢j}áýÞMÓ„:s=Kæ¡Ó1þɸÝï¾>¯ï†l Xß|ÀDQ­AºeYFûóí×ý:ÛR¬ï×#ÏçSÞ7kY,v=þ`1=†ögÛa˜úßê‡ààóú­/åúJDDDDT M³‚L.—áËgÚťƖÁð`L[ïú±X Ú9-í¡óùNtÿº;ï¹:žë@×Ës7ºDC‡~o•ª1ùÅ8¾þ߯!Ë×ï½X=§CY#¡õ O©ˆD­†o-›¬4ô½×‡Î‡ D×zÀ4 ˜&¼gLÔŸRQµ€y¢ë:ŸAY[ß]>»+´~IƒÕ ­º~ù2¯ áíÿ^gÏ[-ÍÔ@Ütò¨fšb– vÓÍE+àó*d· -ªAéP'Õ¼c"F£Qø6ø0ñÍĬAÂЧ!Œ[“Ÿ”Êj xËj¥’hEÔþ|{Þm+"|ûÞìCçsÉëù*„ñSÖ¹=ë=¨ûA]ÚÃ8q¡OC‡Ãhyº%-÷¾º­?m…$I0 géÈ¥˜:˜«¾Ï•çs]{Quþ0üÞ0"‘ˆ•žôcÏu¿ä¬;óÈ—\å8øË0Zš[Òú½¿ëEÛ³miy”ÏÄ™ ŒŽ[MþWJ¨ßZi•”·ÎÖo«ÏÚ>‹!x"˜uŒ\ ¹Ÿæ#òe Û€e€¸LDuu5Âá°œkýÍGDDDDDK•P.8›Àuæó803d›™Þ²¯ëå.¨“*fíÚøh££!hu„ßD<GYY¾þ߯Ób3}oôá©ÿzjQ»:†Ðód5jªðqwF>Sá_낲FB׉>ì ïÖÍ禭îȦ `ü.ã•Õh_À<‰|†RYEQÒÊB’eH©Ók@è‹1Ä.é@9àv˨Zïs¼Þ0 D¾#Ó THPV+}BÝ–†ù o[±»>ÆÐ©HAûéÑÅmÙa^±ºkç5Ä.ÇònçZnMfâr¹ìV…ù‚*#ÇGÐôx“UP×í¼–öÒ™hE4Û¶0td‚( }‡ÕJ&Wå©}¨Ò*+4tdCG‡ÐÔØ4ç±Ón´s¶·nÇÉ÷O"°9ã²ñÏÆÿåcÜýÝ»aüÖ;-4µ4!òeÃ#èòTÁ¸l üEØQY<öÄc€ »¨«¯C{[;z_ïµŽÝØÉ%ajj ±X uµu—w$Aý–ú¢ò/³ß°¨“ª¸œ : œ)¿gÛaL|gÁA6æ^ÏËÞïÃôý×áZéÂȉhšf{þ" eµI²ŠC‡æŸŽbê`f>͵½ÓkŸo?ü§ÃV°òY+=‡ü ˆÀCG÷KjÝ)&_òñÜå±O“cz„¿CY«8´E¾‰ ñÉFˆå";Œ¡£ChinÉ[gííEÃG‡1xpî5î´e#GGÐÔÜTÔý4º®Ã4M¸Ýn{™´R‚~Iw´þfÉ#""""¢¥H–e» ±Ó–zš6Ó` GO£? @Ó4Œ~8j/«¹¿p>äOø«dl!×ÌÆ-O·à©ÿz +þuÅ¢ c¦ O½2ŽÞ#a6Êè|ÂzW žaç‰N`­Œä„3ÞfzÐfŽLXLž†=¦Ã»±zÎmCŸå@àA+†2öI‘ ;ÿæZþ" Ax¨¸f­ÏTð˜„S.`gÓ÷0r°cŸ…ÿ˜úâ÷£Žé±´¡°L°ƒ®åVÓZe­·ÛmEůÍÝß]¿¤[]k—²"¼­qÙ€:©"pÀŠÊ/Q½)½ðÅå¢]éEQD :mR+<åÉ~]·f* Ô ÞV×u ¾3ˆýýûíÊ$.áß4÷˜†úECBÏîˆËEˆËE´ý¼ ƒ‡í‡Í臣Øõò.ˆ¢Y–Ññ|GaA‡Œ®‘ –3e•³üD«ü"_: ’îË¿_êuˆ¢ǃÈÉõá/Ãðz½E§c¡ê`¡ÛÏvíó-3Ã0‰Dxp¦Œ–þj?B‘£òNÍóÅÈ—Ävžõ„?KþÇ Gì²t¢öÁZ뛾e€£?9¦ê\ÛðmðAéYËÔ<_ÔÌç~*DâÛG»[Aìås­¿òˆˆˆˆˆhI g>ë'z¥Í&±MÞ¡ˆ–Æw£õ~ãÝèÅðŸ‡k6õ÷)Œü~§ýwf€0u–ã¯Ï^ÀŠ]±(yâ*7!ˆÆO›Ø{P…zÑêfíY)£r­ßj=8-X?‰aF6:†ƒhÿE{AÛ V:R§×cÉ—oã²C¨ßVªµUÀ2+r?ðÎÀ¼ÒذºtÎŒ)ØPß`ÝèåηMí"g"O »­}ÏþßÙœ–ÄzuRµƒ&©ÝA•Ô¼b&Ç0¼”ÞB( Û]#:ÿ²yÊ/58ës'c¿Äñ2¯#‘NQ1™€zFµêç²âÓ±u0•Óíó]{1e–8FëOZó>tg+ïÔ<_è|I«çkdH&¾™@äËȼ&à¸^ ½Ÿ %IA@4µËE¿dèd=- ¡\˜õËx©BšuX¶Ì`ßðñáù½#¬’ì@`B"@øõÙ (++ƒ÷‹š]?¯EíÆ*H€ËÐ/A O½¶Òr Ám½¨lÅHt(Ÿi`6½ðy"Š"$—„èyÊù–ˆBò}:ñ.lš¦½|Îõ312Ã0ìXK®Þ[ßšWn–[3ã\ø¿³ˆ|8ˆØé”nuæþù Q 8ÑdR=§B;¯Áœ6aN[­Q\+]DÁj Sž xîÊ$4.PO«ÖlÀ€Õ½<=•ˆ²Ï¶­¸\„R©X3-_³ düTrì?»õT¹Õmθl`ìÔ˜£tdÒ4 ÃLJín–® —½m¢…TbÖÏY·•$4>Þˆ§ž~Ê:7²Ó5ÛMQÿÃz´·µÛù“8`}#Qs v>¿Óê{QG÷îäL@Uëªàr¹Ðû{küB휆ë3»F“™å˜óFÌS~žõÎZY?JßÏ73hh¾Ùd½ë½F$oƒoAÒQlÌ̧¹¶ŸëÚ‹)³D·ì‘Fì¶ííçØ7W·Úbòe.Þ{¼Gd2iqí¤Î¢ÐûiÞÏçõë8׬cާu¿žkýÌ#""""¢[…išÙ˜\Kù}÷š[Hš¦Ù¯ ö§{ ßá…v:¼hçlÚ\az¡£~¨Þ ó›‡!Ln‡úÞ÷`èÖûåžÍÌŒá4¼’ç./Ô3ªÕÕ;¥DÑ3/8Dä›HZVeµ‚H$·ì†XnÍJêßäŸsvŸ±Sc8|ä00m ¤ß°µÁ¢y×{Ñ÷û> ÜjÕ”o[¨ßZ¡#CèÙÓÑ%ÂëõÚÝn%IB`s‡Îìë’àõz­Ù™çHGâfxkÀ¤è~©üè`Ú œþ£Õ]Q4>Úˆªª* 8;q6ï¶0Ð7€Î;áø»ƒP! åñ–œã†Â!|Ïÿ={R”o@û/Ûqû¿ÝóŠ5!AË“-öL¼o é‰&¬X±îÕn´þ¸59~Û2àÀàlf;ºÝ e­5ûñø'Vð&òMz×Èbò/³›Ï=aAýÖzŒ¼7‚žW{ì€Fàþ€£z©T*èý}¯5ï'¹_æu؇ O!­”²ˆÅ¤£˜:˜™Oí¿hŸ3Ïg»öbë|Ã0üÁ°H6±ÂºåeÖ}såy±÷æl||ž¦M>S,§uÖ©ùÜOóQ÷`†ß¶ên9à÷úÓZWε>í9w󈈈ˆˆèV`FZŒF×uûÝGvËö;‹(ˆi­Í®‡DOÐÁãÖXó‰à`ø½A|=ñõâœôšÈ‰Ç HaH.Ó .Eýh;”-èZ%Ã]!cÒT­Þ±Ó˜§Ð\ФH’„êûˆœ C=3a§p¹$ø7&c0¾^„¾#x|89{qʰVs­÷nð"òEÁã‡!THW+YF–MMMÅ{®–ÂM[ÑÍoÿÛíðþð„ÿô:>ÿËÇVº bvÁ—'ÿ-„9m¢wO'Zžíšµ¼ªªŽá’\PV+0§M»â 墣ÔÒ§–¦%£ïõ>Ôn™}LA^Ý,yÞûZ/jjjPµ¾ŠyBDDDDD7ŒaÖ?«¨“*„ òJXf})o^1¡T*PÏ«p¯t4ÎàB˜ˆLàΪ;ÑÑ{ Ý­°†1K4É¥ë-hÝÑeóÉO2tÑ£~¸e€™ÒBÐ…˜)Aþáç0 âö=uˆB‡5›™ÌÄ4ylÉ× MÓù*„Àæ:{YyÑGÍhQ˜X&bZÖëEQ4®lDä›ÔIÕžíØµÜyµŒÀýë^Ùiá´<ÓÂë %‘ç_NÀ˜6nÚ!ë!QéE‚ @‹jp¯v§µ”e†a@‹já†ÄLªè_(0caÓÌrÂÚZHw5c✊íG^·âZÓ ØÂøËÁ%[Ÿ…ašÖøþ.·Œªuéq³â»§šbWbÀ´5sèBŽ=hN›è}µ -?íœs:n""""""""ºuu=ߊÖg;u7f<É‘o-èÑÊ­Yr—kÎBšÙ-Ûã QéÑT²ÛyÀñ$g¾µàG,„r,JWãêMA==Á’#"""""""*1êé êCõ¦€ã}Orfa»/"sfŠiõLáñ1h—´ŸvšˆˆˆˆˆˆˆˆnRåÖ¬ÌÞj?”µpÔÝ`<ɉ%$*\,1""""""""‚y%æ(HÈx’3K&HHDDDDDDDDD‹ã[Ì""""""""¢ÒfO/ÂÞØDDDDDDDDD¥)91m$""""""""*IìnLDDDDDDDDTâ$$""""""""*qvwãðG#Ì """"""""¢T655I’˜DDDDDDDDD%ˆÝ‰ˆˆˆˆˆˆˆˆJƒ„DDDDDDDDD%ŽAB""""""""¢Ç !Q‰cˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*q •8 ‰ˆˆˆˆˆˆˆˆJƒ„DDDDDDDDD%ŽAB""""""""¢Ç !Q‰cˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*q •8 ‰ˆˆˆˆˆˆˆˆJƒ„DDDDDDDDD%ŽAB""""""""¢Ç !Q‰cˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*q •¸$,++Kû>>\Ðz*Mí?o·ë„´J‚qÙ`¦Ü‚¶6Øå\µ¾ ¸Æ.\¸óçØÈ±Y÷kûBWèño7:þp où¥þ‚÷ï:¾ŽÅº®êûªÓÒ”¯Þ.DzöüfÏœÇÙ³wÏ¢íïÄJãÙ³g㮕®dYTöﮕ®ø…¿]Èy¾ÚÔÆÄk¬qt}5÷פcêïSq"""""""ZEµ$ì{«/ïºþ·ú]b\.\.WÖrÓ4ñXóc7´kop4ˆñÆí¿ë·ÕC’¤E9×ÀÛØñËiËA€ iËv´íÀÀàÀ‚ï³§±óÅNÄ.Åûÿg?ŒËöõîÄ.ÅÐÞÑž}¾ÁŒ¼7AÐ÷FŸ£klùqK²^1ѽ§›7)Ñ")*H8øÎ`ÞuCG† ë:sø&æñx°ÿöã뉯ÿgº®C×uLý} Ïüô™´mÍ+&Â_„s§æþ´íhûCïâÂß.,JZ÷îÞ›öwËã-y·-&=ÆeÛ¶=mÙžßìñÆ? ìùÍž´uÛ¶†a,ØþK!#ÇGB…€–§­rh}¦Õ0OÓö×/êöùvuï‚¢(Ž®³~k}Zв÷÷½ç94ßîÆŸÿõóô.©B¼úÞê´eûz÷åÝ‹ÔݺÏȹïÉàÉxó“Íñʵ•VÊrÄÝ«ÝñúÖÏzþ¯'¾Ž7ÿ¸9îYç‰ ‚`ç‡ç.O¼ñÑÆø¾Þ}ñ«ÿ¸ZT =G±®^½š•žÏÿúù¼Ê ØîÆ™ÝÚAˆÇÿé|ÿBÒ³ÿö§mëÝèÍÚÆ»Ñ›¶Íþ¾ý ¶¿7:(·–UVV¦íã^í¶¶/O¯»6æ=Ï\j®-*¯ˆˆˆˆˆˆˆÈ™y·$Ììjܸ­M7ͺÍÍʸl ak<€þ·ú1yf昢ç£úÓ®}u[겺ÜGƒ¸Ûw7úßìGä›LÓ`µ¼‹|ÁàÁAloݎșȼÓw=ΑJ×uììØ™¶¬rm%|÷ønHù Jû»ú¾j`Ùâœk䃑´¿kªÍÚ&sÙÈ{# ¶ÿRH£{¥F“³_ƒÝÙívÛÛÆàÁA 8Рàò¨ÙT3k] """"""¢…1¿ á5X/þ)ê·Õ£q[cÚ²ðgaLD&®ë¹VºàZ™=®žËå²×e®¯«¯ÃП҃‚ dÏ7rl4>’¶¬ýívÐÎÞo¥+kl·bÒ8ŸsJZ%Y?’„+V¤Í"\s ‚ïoX% ~˜~nŸwñ‚•¡p(íoÏZOÖ6J¥’wŸb÷_ i¬ßZÀ«²kOp èÚÓe×Ñú-Özã²§ž~ Ðñ\ªÖW\™é±ÆøÔ&""""""Zó þÓaÄb1ûo—Ë…ºë ­’PszËŸë=‰~Q‡~1{,ăìu©ë0úÁ¨ý·P!àÝ¡wat]Çç¡ÏQYYi¯96‚á£Ãöß‘¯’­÷޳ö»¨Ã0 \¸pÇþ| ÍO6§ô Mã|ÎQ¨Ø¥˜õ“R®€Ь}¨Êjå†UÒÈ—é-$sµJ4M¿~);˜ë^åλO±û/…4výªË¾'vvìDÙ¿”Ù-O+×V¢ëW]€öŽvDÏGáYçA×ήy•Gf°2‹A;§ñÉMDDDDDD´Àæ$ìïOüÕo«·»6=šÞåxà›:2»DïÚ¹ [ì¿}^ŸôÈyýåÉ_'ÕIhZ2€!Ë2ê¶Ô¡¯¿Užªù'òzœ#Ø¥vürßܰI#ÔI5ío×*ע˼bæÍû|ËR÷)vÿ¥Fi•„P(„Žç:àÝèEee%¼½èØÙÐ_CVIÃë¿{°¿?° ÐÎihin,Ë([VY–ÑÒÜ2kÐ/µë²]Ϋ|r-°‚ƒ„š7( S IDAT¦e¡–¬ßVŸ`ˆF£>>|Óf@挽;~¹eeei?ýçciÛŒ}’ìòX}oµýûöÖíøö·¿²eePuÕ¡ó…N„> •ÆëqŽx<Žx<Ž«ÿ¸ŠÇ>Fó“ÍiëG?E÷¯»oH¥vµ° Ý¬3 Çžvž”}ŠÝ©¤Q’$t½Ü…Ч!¨ªŠÐ§!t½ÔI’€kÀSÍV7ãg~ò üÕ~hç4TùªÐÿV?¢Ñ(A@4Eÿ[ý¨òUå Š¢˜¶ƒªDDDDDDD4·‚ƒ„™-]+]ÔÒ‚µ¦Ozp½»"³{­ÑKÉ®—û^Ù—ÝÚi˜œœÄÈ{#èÞÕ»¿{7üÕ~¨§ç×êzœ#A\.Â_íG_žùé3³–ýõ’Ì `-¤Ä¤vY_Ìî ÓÓëLjÙ»ÿ­Æ®_w!òMîÕnôü¦Ðùb§=±É¾ßîƒqÙÀ¾ßî³Îu)†Î;s+WëÕBƒªDDDDDDD4·‚ƒ„™¿Ø¥XV˻̖†CG† ëúM™™““dN’ó'eŸªõU8{ö,Þzm϶¡öáZx7x³Ž;þÉ8ßÌ+×ã¹ÔnNöNžŸ¼!eä^ Š]Œ-Ú¹|Ò'ÊÈìê ê™ôe©©»ÿROãDd;wYãî}?ÄåVKÀ‘ãÖ3A´þ¤¬gZ'ÖgÊ5^㓈ˆˆˆˆˆèVUP0ôi‘o"…Ÿe:{6ä›…÷.oÚß]¿êJ›<$ßO*QѰµ=¯ô`øè0Bát]ÇÉàÉ´í&''çÝ-x1Îa\ž}ŒÁp8½+vfPòzÉ PEÎDí\µ¥Fs¯2—Õþ vÁö_êi|ªù)`h|´u[êìå‰Ö·.—˿˒­S[ç¦Ê ` ä52ŸÜDDDDDDD ¬  aæ$‚ ämm—Ù%0sßÅ–yþñññœÛ5=ž>ÑJ{G;Òº9— Œ¡ó…N(Jz+&µ½¯÷bâˉô®‘×6ÁH‚9mœÆbÎ1›j@ËÓ-ŽÓŽ«ë:z^é±[„%¤v+¿ž÷¥Ÿ7-Ú¹mL ††? £ëå.àš•ß]/w¥cér¹Ð¸­qÁöÕ27sLÏ›!¹ô¾Ö‹ñOÆár¹ì®Ä iÁÀkÉú›fv¶Ë:#à¸?À§6Ñb˜ššŠOMMÅçôÏxÜårÅØ?{öîÉ»ùÇc§m þõÄ×öúÌuÇFŽ¥í?×ú¹TßWu ¡Bˆ»Vºâ®•®ômïÍÞ@ܵÒ*„¬å³¥3q”ç8žË¿zõjÁi,æ³ñnôfí›YÆöOyzù¥J¤7ñ“+M©ë uáoÒ¯_âñæß¾ØôìïÛŸç‚„ìºp`àÀ‚ïï¤îßè4æ*£Ä½ràÙÛ7?Ùloßo÷Åãñx|ßo÷ÙËšŸlÎyÜÚ‡kÓÒ²¿oœˆˆˆˆˆˆˆžã á»|7+xpáÂ…Y÷q¯v§mß¶£-yâEæJo¾@ßÔÔT¼æÁšY·O Ð͖μû BüØŸÍ+Åœc6™AÂ|?n·;~2x2%r˜¾\yïTíÒƒE'ß_ÜôìêÞ5ç~{~“?H^ÌþNëþLc¾ò©y°&çú »°M FºVºâþ–ý,¹zõjÚvB…¿ú«|j-ÇAÂÌ MÍý5sîÓ¶£-+ØdŸx‘ƒ„ñ¸„«¾¯zÎÖ€ ÇFŽÅmŒW®­´ƒ.—+îÝà7ÿ¸9þîßÍj¥wòý“ñŽñÚÔZû%ÎUn?ªï­ŽwììÈqšÆbÏ‘ÏÇcÇ;žëˆ×sûÔq¹µ}ý}Ÿˆˆˆèfþ|TVV†@M`Á?ßGƒ>>ŒáãÃKösâ|ô½Ñg³ëå®´uš€½®ïôÏ”Uë«ìuÆecÉ僄DDDT2Ì+&Æ?ÇS-O¡÷µ^fÝ2F?]ð`^C}®}×>\RyY½©Úþ}üÔxrÅ5`ü“äßcŸŒÙ¿— D¾Š¼¼—‹Kîº$$""¢[šËåB<GüŸqìûí>{yÏïz˜9DDDtKÙñó¥uÁ×ç°Už*¸\.éÀÐW!˜¦iÿ<LþþQò÷êêêzñxñxº®´ƒ„DDDT–­ÿÝ A“““Ì"""º¥D¾‰duÍEÓ4´>Ó yŒ²eeVIhøQÔÓª½MYYb±XÚ߉Ÿá£Ã9»ÜÊkd”••¡akƒ½¬åé{[MÓì庮£óùNTyª Š"DQDÕú*t¾Ð ÃH瀞Ú}6x"Ÿ×‡²eehjiÊ{ƒö~>¯¯à€™ÿ^? ‹a"2 Ùª°æÁëóä™Iè­ãŽ'[úï³öUO«¨ÛRå¢(ÚרÈjõ9×5¦­ Âwµ^’$´ÿ¼=-˜˜«»±“ý$$""¢’”øv˜ˆˆˆèVø\SÿÃz@ç‹ÙA¶Tš¦Áçóáõß¿Žèù(0 Ä.Å0th¾ïúÒ…ù$‚`@²ªªÖñÞª.8jý^¹¶²,ô‹:|>ºÝÈ7˜¦ Ó4ù*‚î]ݸû»wçÓ/v%†ºÿ¨Cø‹00?}‡ÆcMªï­ÆÇù¸àñùru9N\WíCµðnðH¶4;•lqØd©Nª96‚É3“v ÄX,†ÑFñpíÃ9»‡Ïu±+1<ðýþÌZ‹Å°÷Õ½èyÕY/™ÙögˆˆˆJÃ5 ÷µ^ûZýÖzæ Ý2zv÷å@4ÅÞ={ón×Ùщh4 ·ÛÏCŸ#þÏ8NO°Fíí¬.«©_ª&º°ÆãqH’” ’Ê’Å.Y­ïô‹:&ÏLj7×ÚëÛ;Úí^7bjj SŸBíÃÖ6‘¯"èÞÓøi ú¾j\øÛ\½z]¿êÊÚäð‘Ãx¤ñÖ¶'ß?9¯ñ> ³×%ºžM«ÐívC^cC=ë<8ùþILý} ñxW¯^ű‘cöq÷¾²·ðkœšŸlÆÕ\Å?°tva³ìÏ !ÝÒb±˜Õ½â_ʰýgÛõ?¬Ç¾½û˜9DDDtËPîPðÌOžtïé¶»Áf9>À &Þí»eÿR†Øëƒ'‚ŽÎØlÑ&''¡išHK´h?5Žà‡Éc¥Î¾¤™Óf֪IJÄxƒ…ˆˆˆèVѵ³ B…óŠi·Ì½õ©ãΦ¦¦Æþ=8Dp4AÐö‹6kÙGÁ´‰=÷²Òàr¹Òº+«“1ýRvS¨ìVz9MÃî¢Ø€(ΆaQíÖ’“““84À꾌eÉ–†ãŸÛ]ª p_ò:[ÖŠ¿Üða˜Wr|†Í±l®kLͳ´ë›vv]³íÏ !- •••ö‡)í\rÐkíœfÀr¯vçü ÇqáoPû« ËП†ìV…DDDD· i•„Žç:ýoöçÜÆ½Òú¼T}ouZâÔÛ,_ªî Øë‡þ4„É3“ðnôÂ_í‡P! 8Äèè(Às—Ò*)+ ±X,mB‘ÔÖpÒÊì1…òÙ¿*;°·óÅè}­·¨üLír¼÷U«k°¿Új)(¯‘­ÏžÓÀÞß%» §ÎlÜÿN² >þËLjÿÓêr<ë5” 7¬þ0HHDDDKBíCÉqlšžhBðDÁA4=‘œÕ®aKCÞýå52 °ÇÖé³_NdmgN›>>œõ“kðl"""¢›MÛ³m9¿8µ?Sm±>S2ŽžWz¬Ï8×€‰/'г»ÊÉÖ|©½42?7‰ËETo´bC‡¬®Á‰.ÅÕ÷V#z>ŠÈWVwÚÔV‡@úØÐímíÐuúEÛÿ{{ÎmœÊœ|ÿ$*×V¶ÿl;Þ˜w^¦N^’˜”%uY"ˆ˜X—èŠlK´î+·¾¸6Lí¿l¿i냄DDD´$tíì²?ðŽ~8оÿøþýÐú†Ú½Úmsž$IhÛÑfÿ½ãùYÛ˜WL<\ûpÖO¾1cˆˆˆˆn&¢(¢§;ÿL·=Ý=vm;pÛÿ» eÿR†;¿s'vür‡=Ñl5w~çNkœç²2{Yb\Bûï™ Yj < }ÒèúU—†þ·ú±bÅ ¬ø×9fUè¹ËƒŽóº~i•„àûA¸ÝÖçÆÇþó1>rx^ÇòßëŸuYê,Ï@²+r‚蜶òï¶ÿw[Þ±o Ñ’ ­’0š@Û³mÖ·ÃåÊʵ•h{¶ ¡‰´n,ù´=Ûfh96bÏRGDDDt«hz¢ ž»Ž,Ëv0°f+NC±fSz ÉÔ *ìÿŸýh~²B…AP}o5NŽœ¼iëMÙÔÔT@ÚEæÒõR:_èäFDDDDDDDt0ü½^Ø’ˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*q •8 ‰ˆˆˆˆˆˆˆˆJƒ„DDDDDDDDD%ŽAB""""""""¢Ç !Q‰+›ššŠ€$I³nØõRs‹ˆˆˆˆˆˆˆˆèT^ÈÆ/t2Ljˆˆˆˆˆˆˆ®“®—ºÐôB3b ¼4€Næ­Ý‰ˆˆˆˆˆˆˆˆJƒ„DDDDDDDDD%ŽAB""""""""¢Ç !Q‰cˆˆˆˆˆˆˆˆ¨Ä1HHDDDDDDDDTâ$$""""""""*qå q¹õÏúÑô ÿ¬Û…FUÈ•.ÈŠ4ë²… _4ðÔwz±ëÏM¨ºGλl19Í—B·¥ùØ=†¡WÇpXk_°:u#Ü,é¸î'Ô/uþÝ"ã“0cäµ€ï!eQÒ¿XÏ4'&N©èi Ú7„ Ê=n´v ­‘òæu*×JžêJ4=çÏ›þ¾_1òNõ?ö¡é¥À‚ߣêWÔ/£ˆE¼õ@× ô½Dxtà­©D˯dÑÞføõªP¿ŒÂ¼bÀµR‚o³‚Æçª!Jâ¬é(tßbò](—Åã†÷ êõâì唪£¿!­.«a ‡BäS«¾ 3eÚð¤J‘Ï‹Bòeb\Ãàî Ô/4€²AFã/¨ª–ç¼ÿsÙõÇ&Tm’‹Ê÷±CéCýF¦—[‚²Þ…†Ÿú¡xå¢î‹y=ËÔãë•G=͇¢ï[eÙÇ6.O}§þ-´¾VWP½,4?3·*D(w¹Õ§Ïè¡WÆ ‰!vÅ€«B„§Ú¦ÈžëÿÜ&""¢›WÏî>Œ"üE±+1¸ÝnÔo  ëWmV%?7 ¢û¥^D¾Q‹Åàr ðßW=/w¢j½²¤®¹üzž¬»ñpÖK_®e !|\…k¥˜Dɵ즩|#Mp¹]¼ ob7Ký¹™ëñÍhäÍ1ˆ"Z_©Ê‘7Cè~ú0zþÜ”XÌçÜõ ©:ºÃS£ ù…˜W€ñ£Ð&MHkòïxÔƒÚÇ}Ö1&u ìGç bßX+Ä噑 x$A°þmÚÈP˜Y…¡¬sÁÿ#o…rnc@gý Dh{­0¸;ˆÎúAô[ìÛàž ü[<Ok1èßäƒw½‚»¿ûŽ ¥ÙúÌÞÔ˜þÙÝÀ_íÅí·‡FÐþó–%sÍ $îaäÍ0bçuÈk%4¿Tkw}ItzÕêò™*uÙa­ÝênøSë%'x( 3f@Y'£ñg]MŒË@䔊¶~߬Ëú^"2ªB›ÔÁênÒ²3ö-ufZb— ô¼ßÅ#A?g`pO¡S“0/Yݺ|›*í®8Nò%í<3­ÆŽªØûôaì ¶du}ézâ0bçLôŒ6Y/†ªŽ_!rj¦i@¹KFãóκtÕ?ë‡PF‹æO›Ö¬s|ªå"<^7šžóg½8ÉÏBŽ—óEØáõNŒk|)õ ®•{óæAf‹¯\Ë3ë“ü+¤æI¾tÌu úEƒ/´»WÉë\hÝ] ùiQêCÎü.ྞë¾qz¼ÌV*‘Ϭ`‰,§·tqr?ÏUÇs=çŠm½åô¾JˆNêPÖÏÿ%Z¹kfx†s±ìÀÆ¡”µêš}úÝ8‚‡&4HèDøž rZk4Y‘àÙ #üžjWÄUbA×–j>û›ï ­‘Pÿl5ú;‚ÐN뵘y+ Á%¢é¹Ü-X¢œçËÌ' AHn/Tˆ‹ð©Ãy¾Ç.é\ʢ܋Y¯[-ü[=¾‚¡iÝÇuÍ@øõÏ.\ëèBó3µ.-Á5süi¾ QÊçóUÙŸ¡ä¬sîk§÷Óã%„Ž«ØÛ|ž{eøX•V·œÜÏsÕñÙži¸æð(ø¾_”½Ï ÁÐy×uí¼•wÒÊŒ êEáS*ª·Zõ6°Åƒð‰ŒË9ÎUĵÎED¡x²ƒÊŠG†zzöÿ¨Cªö¶…Ê·ïBå{ÚñD>Õœåk"}§Tx6U:oå¾@e”+_ü)`pW†nÀÐ î BÿCs·‚¾FÓš4)=èúÑa¨9ò¢Ð|W6ÈŠ 881ëÿ¿…ÞóÍËbêñbåQàQÌi`üHúÿYÁCaký6óºTL~fW¿hÕ”'ï©Ç3ë4UGoÛ0\+Eø·²•>Íñ9ìƒq+X˜k¬Á™ÏêiOý׸VºÐôhí’º¾ûN_€Î?4Ø/(’Û…ö@Â'T«ìVF¹º¦äì®Rt 6ÙãòxîU°ý»½xu íoÔ¥m'd,«ðÖ¤¿,åZÖ’2è¾r ðl´º³Œ}0ÿ–dA¨Ò® ú_¦ž?7¦´®Óös’/9-[= §u Î|pO|ˆ|5@ÇPfºÂ£jSÚk¢8ü»Œ|ÊAʸ®\i;ü»1":›ìYž{l÷g—…“ü,äx™œ^ïáWÇ ¸ÄœõgÞAðõgÎüsXŽ…äI®t8 ¬|¦¡öIü3ݺݳ>ä{â8¹¯ß7NŸ°«ï~ú0¼5 ÚzÓïçÁ=AG÷ó\u|¶ç\Ãÿ×㨬2[:}NEÂêÝCèøc“ó±Ó®%_Üû~is¼õcìP˜ü[QS¡ùÞúJ-ºš‡ÐÛ63]gݨ}Ò—¿´ƒûb¾y9ßz¼˜y¤¬—¡¬“<A ¥%ãø¡<åœcIÎU/瓟¹Ž+@ëoj³ZåSS÷u»%t¾]Ïñ‰ˆˆhVº®cûwÂsW%¶fÿÊþåöäç‹Õn ÿyÿ’pAƒ„Þ%í¥[™ù §Gç×5ÇWãI¸[ßæJ„NL¦ð;מõ!4|b­»kæ\vøwc‰ :©§5ÕÔXFZ”¬ LèÔ$|›+sv¿Zˆ|©ÞæÁÈ;!LœÒì.–£‡"ðnRì1žB£“ðoö@,GÚ7åžM ÆŽD¤Ì"ã“ðmö¤½XˆËs”…Ãüt|¼œ^oâ¹êOp>­ sÕ‡ùç¤ Éã\épBÙ(cä`.· ¾%ç Ž Zм¯Þ7NXÝv½Õ :ßnÈ®[Nîçž¹ô¼ß4¯ºç䜡ã*zÛFм3±B@oǺŸHP  áö´¾V›5þWÖËøL8sâŒÑCa(ëd» ¬â•á®”<Î ÎëZ“t?13f¢óÏ ¶o1ù^¨À£>Ô>™tWÎïCGÑe4K¾LŒkè~bþ-•¨Ùf›F†ÐýÄ:Þn@Õ&e–`^2¸¯xÿƒ Zÿ½C/¡êHJ¿Ló IDATüó]¾CBï©LœÒWùBÃØ‘‚G"h{£þŒ`•ÓûâFÔ÷ÅÊ#¨ÙæEÿ® 4U‡¬HPÃÔ3:ZS[T½,$?3k\Â'Tôýr.IL >“÷=ï7Ó€vÞDð:ëÐöFÃuBˆˆ¨h™­æ—1Kå•Â0P÷O!‹axd8ç6Ÿÿõêd½¯à{ÿþŽ íGÝ–@é Q!ä\lγÿµk¥c™36{'ô‘ ˜¼Vͺ¬ïÅ ‚ï„Pÿ¬ž{ˆÖòöÚ˜fú1s}Ûo^2àrK‹–/U÷Èp¯–0z(„ªMuÐNëP¿ÒÐözmZFÞ Ù-5 .Yi‹Å Geá4?/gº^ïlç˜\õÇiþ9)G§y’7tô×cð×ãúý8úwár‹¨ÿIuúí Xо¯Þ7…¤%:©Û­àæs?òÌÈEYWx0Çé9_»YAÝ3Vy Ðû̺Z£ó ˜øBÊï}Jþ—q˜kÜ3ŽÑƒ!TU'ê—ÔotÔ?ë‡q9¹¯o³‚‘7Cv@¡˜kuJp‰0cÙnÆL+ÅœÁ¬®ÿ< õ«ºþX_ØÌ¨sì[L¾ç“¯¦Ë-@YŸ?_]n ZTw|ž¢ÊhŽ|é~¯;-˜UU]=j¢ÿ… zF ¸Y´Z=SžûÅä{Õ&ÙþÂF?g ³~C/ᨥàû¢˜¼,¸_§<òoó ÿ×AEÐô ?‚‡¬ÙÌ«·*yêÝìõr>ù™ë¸UÕ2´I ƒ»ƒð¥”U1õ8q|Å ø·(èÜ2€¾‚ðm^:‹Àí)­×àlü,3e1„µO!üY'ƒPåÉ3Ü=U3ÿ Ûjá¯nÀöŸw•hpÅ.™9–éÉÁ¥óWá©VÒZ:åZ6v$‚À£>4ü<Ù TלS$¬+à…l>Û<z3ŒVÚ0@¨áÿAUÚK†¿¦µ?^¼™ø\.ÑQY8ÍO§ÇË÷Råäzg;GVíŸÎ¼ùÕ©…,G§y’3¯A”D´ì ewZDÇЛaô¿„¼¦°®—Å”_1÷õBÏ[£@¹Ã5ïû¹ØgÆ|ºÅ9=§6©Ã›õo©‚ ˆØûôaô´¦‰ÀVOήt©/ãÊ=2$YÂÞ§£f›Ï¦$ZàæëZ˜(s­Ž_ì=n¨‘ìñ×ÔˆåwúÂk@WËaD>UÑ1ØTØlÖö-&ßó Zcüyî),øáÛ¤`ìxÄú&yÙâÔGÇùrF‡7Ç ìÊ#¿/~–å…Êwiÿ+Ð=Ÿû¢˜¼,¨_Ç<’V‰ðnR0v(‚¦gý;w³âòâºá’ŸùÈke„3fé^Ègç#oŽñ-ˆˆˆ–œc=ÆLXD‰„㟄1<²þjçñÿ&/ö¾Ú¿¤®÷º …\ˬ¥`쮄†„NLÂS]9û‹ü‰êZ=ç2Ó4r¼è†¿ÕT"t|ÆEcÎ.ÇóåßæÁà«c{ocG"ð?T™ÖµÒ·¹j8j}“¾HMŠ=Õ•È(‹ËÙeá4?/gž;¼^OueÞú“Êí– }“þ’~oÂQZÈrtš'¹ÒáôÒ^´<Z» Ah ‹)¿bîë…8^®nÆ…ÜÏNëx¾gÚ|ºÅ9=§¼NFø¸Š¦gýö½áÛ¬ c°ÉšÄgØjuV_·(Ù(cpw]›š€kV°Ò³Áš9:ÓÿÏÞûÇFUìÿÿϾSÌ™üdO‚Éî $,ÁwØF¾±UŒ]ÀØEŒl­¹´@B+ÞТFŠÜ( ‘¶¡Õ(í%js…–|,-‰Ðö¡åFdkäÒ½¶æã½Ô¼1,¹Û¼%=Í[Ó9¹’ì÷Ùíþ:»;çìn[èëA6egÏ™3óz½fΜי×Lû¿p(D9 s~Yø˜í‡üÐnhP—„ÂÐohýv Õ žXgÖ»1:!®Å&„çfSîázôBa‰ÓÜŒGÞí…ðŸFç[ƒ1k N·• ˜0J«áï2r±-VøÖÀöíl‹ÍÕ‹s:ë¼ß‘‘ܵŸ¹ahëØuM** ¡]dض¥íxeƳم–ýè|ËÉ›<ãPy³òLÆØ÷c ºÊf_3úuŽå*‚ âv£`U !Wü”>µŸábÿIxJܦN¼4׊¥·U•gÔIèX®bd ÷z' ˆP£4P  ¾²å»…zÞ„þ+Þ(*–4£òE7*^q#02†Éq³{¢Q–¸à?= û œ.F/v¡MEå>†/´coyªvöTÅ与‘óWP{´4;òrªpÝï@ÛÁLŽsÔnö&”a¯·õ[:á­.„îBûUGà; #4öVÊÉ /ºQa4VNÔ…¬”ït£©º[ÌjÓE˜yMu‰¡SÈ»­¾Wûqehlúw+uÄÆ<1N´é´ðšqž­Eè?6‚¦gzP¹_Ô§ëM?ì‹U”n‹¼Õk¬éÆÈ@•/¹Á*ŒDœV6»-fU¼mÈž›‰Ü'Ç5‘ï-@›Ô1:@Ç(vµïz“‡}¹ ìn‡KEM“¾º~Œý0÷æ"Øì &Ç5 ž `èìhìL6 :’•‹w{!Ú_÷Ã÷rJ6†Ö$<=Œ‘KT7yR¶KßË}(^_e‘‚É5ôÁø¸†Ú?Wedï»òÁ½Ñ…µNØ«ÐÕ1Ô{CçË$Ó.¢wÙµ"KY;žIMßWž(€oáz>†mCÑ£ÉïéìÒŠ<ãóå:0r~C¨|-¶¼VdßýÎ ”… œ+U0EÁظÇ(F¿C݇ô0DAÄ4¥OÕ`à³!Ô5섲PÁàP$ŹØ1½)IýfØ2BY¨ GÛ‰N }9‚3=­ä$LFõA|ûýØ[.Þbwí5L÷VEAÛË~LÞÔà¼Ïº®ªÄ nzÔ¦ó~GÌßQÔ¶xà{è:äò\…vÔTŽ]ž6©º¨†æþjtö çÏ$ƒéµÙõ{6»à«kÈŇ䨆æO«Ñsd‡D¸¤Âà\n?$‘“œ+U4öT¡ó­A´TwO˪±'V²ò”ÍϨ̲õuºÄΚíýhy¦Ê"ÏæB¸V=ïGœ…UûÜÐ'uô0„ž#®ûØóal™“ÙO6õ(#“d婸 èA×~qÍÔµWÀi2¤1ý™j×’˜Ê/Eiϲ6ž¬O³‚ì5 Ö:ÐØ_ƒî#~´í€þ+‡²ˆÁµj)šû+øÇZvöÃfª¤wˆmp¹\E×›ƒ°/QDˆü“Æo(‹7 íõþ”ë‹ÉÒRÝó}èì(†Î†vÉ‘Ý 4öT¢íõ~´ì;Õ®]Šš&OÌ ÝpXbבAtÅ…H—¿äŽ™ùo²çf"wÿ©QøOBÉK)8]vT¾VŒÒ­E1õˆ?>žè]d=ÏÀéRÑýÁ Úö÷‹t1/Esæ3®dåRú\ØBý'F0ØÛrž;PÛâÝÜ@öüW m¿hÏP\÷Ùqè㪵¹Wîó`äóÚˆö­( ÎûlØsÔ ÷F¹·ïÑí"Þ©eY;žIE x6ŠM·<])gîËØ¥yFç«(€c©˜½ë²U÷ÚÐß>‚ž÷'1ù+‡m!ƒsU¢ ‚ ‚ úÿ:h:tM‡ŽÆŽw^Û‰Æ7Å3ŠkE|ï·¡é-&'uØl6¸.ÄE¿ùÙ‡³MÞÄÄDT5õCzãÁFÔ¨Ÿ‘BU8šâd¨×¶Á³Ù…ŠÝî”i‘‰MÍçrÌF»ž©ü‚ ‚ ‚ æ"Qu Š‘:v¢žd;MþTߥ©4‚ÈĦæs9‚ ‚ ‚ ‚¸3ùAAAAAÌoæäLÂLÖð"bn’ívMýAAAAdšIHAAAAórAAAAÄ<‡œ„AAAA1Ï!'!AAAAAÌsÈIHAAAA󜼉‰‰ ¨ªšòÀƃ$-‚ ‚ ‚ ‚ ‚¸É7spýz’AAAAÄ Ñx°UªH9 ó`'êI¶ÓP¸1AAAAAÌsÈIHAAAAórAAAAÄ<‡œ„AAAA1Ï!'!AAAAAÌsÈIHAAAAórAAAAÄ<'+N¼< õûyÚãúΫéÓ²Áؘ(×à¥Ôió•ÆƒG^ž†¼<bÒ¾“Ù|.mL¶ÉgöXÙvF̼M[8Ô{8òh(pqt÷Ÿ;8TlŒëppTlá2>¾æ9ÑOì}9± È|reóõûyBþE«8 Õm GiÇð×0,{Û‡rùNËîPºCUEþÎ{9êpð_Ì×-™\Ã4¿xJ"×r,á¨ÝÉ¡ýlœŸÿPT(ŽUUŽÒ @jÙFÔ{8*6ò”÷ãte΄úý¢Ìáû’‘ÞÍÈd솰sv·øTl仑Ù-²ó”pøÞ8O/ëèO|;5Û>Í0Wäg¶š±QK÷1u•Ñ«ÿ‚u•– ýà7ãkò_Æ8ªžá¦íˬ<ãgŒÃ½–gí~ßwp‡ì1/$—2Ž+ßÑ=ž ‚˜;ô÷Ã]\U-B^Þ2¨jJËjpå»À[çIø¤WCÛ ž6-ôô¶E ÜkS§ÍGº{†×uÔ70\TqyP¥ÖŸ‚˃*j_`–ín6Ê1SyR›š6Ùr„ö8ÙÎpîöÅÀ¦r-á¡»íC`µ[ƒ~ 8~”á²_Es ~é ¤è:(Š‚¶Ä<¸†ûŽè>¤z»b˜>4ÿxúŠW}Ÿˆº56 %q°Ôâ†N#|GÕh@>p¼]ä_ûƒïà7‡fšJ®a^×àp­¾P]Þ`èéŠÜ‰e\Öy58ìÀÅ~ÇÛl*ø!u9¢õÕú.Ãð·"£ºÈ”9ZŽÚ$P¾1ù1²2á¿îG8F¿N~Äpò#†Ñï·'²ûBÅñŠ ½uqŒ¥–uôÇó¨õöi–¹ ?³íÔŒZÁL]Óµ¡ð§øaë2ª®f˜œÔÑ}Îøz]§]×Q³™¶/+òŒ>þÌÇâš«=®Œf.ûI ð¬r¿ü…ŠVCàºèOeœ´A1Lj<ë‹qò£f\þâ Z}Í\àw)ÆnŒÝ‘uοsaåeéÓæ###bä[»“d!ƒ»83»›rÌTžÔ¦æ†M¶¾Ë Fùã×Q5ÀŠNI ‘ô½—Ú¸*ÒúÎcÆÎ1"||ãAÇcù†áDŒ‰§$6„'/OCÓ!}úÿÑaucc@Uelè‡{-OùÆØLÙjws¸Ä1ìnnw÷i‘ŸQ¨I鎂•µ»EVü,þ ÀîæØû O]F‡KU¥˜%0<¸×Š4§Ó8DS6$×ÈîÆnUÏDìØá׎Æ? Cr,áh~Ç8äÑlhpó;˜ÖI²öŸ§}F×WFw²6*‹Œle®e¦Î«¡°ÞP¸ž»X¾_Ê¥-¨qöü‹£f¾Ïa³)hn2~85rø´àp­PP»°Û´wð9{3×a_dÂѺ (߬ é­ô³’ZÞç°-TÐüv¢ìK€º†žÓºôì¹F;s¸î ÙÒñÇ‹ï£?d&âû“å?7lAV&ýg9ŠV¦>à¼(~XAwondN'ÐØÀ0ð™nz¦••öy;ÊÏl;5c£V0WW«˜Ñ rÐÿW=¡_»!î¹5۲צÌÊÓ¶0·mÜf ýç=”As[ø†u‡Þ¯²æ$lëúÏs´ánJ>PúT$ì&Y8Z|Ú´3íà¿$ºÎ}¢BQ€u':!Œ'=gEH”ç1ã´¢Bñ¦Ö?À£Î9E öù€gÍÌ“ü¡R„âÿÐX¾€px­~Dƒ®‹7Ög>fÐu‘–ÛåAÕÛ•éÿG˼b ‡@ÌJº<(BbÜ«ý×t¼éËæð;"¬äd;ÃØM`]TH÷I@Y˜øð©ý,ÌÕÛj_`˜¼©£û¿bóí:%f¹$ mëF¿:»š[ºNëØQÃñt%Gí³ }ý ŽÅÀÓ•É×üJG¼ÝÝ ŠÄZRÍoGBÇô[±:[÷¸› 8÷‰[ë?ÏE8_†í±ç,è$IûÉDŸÑõ•ѬÊ:Üdd+{-™:ݳ„Ñ/]üT…Ã.B¯†G²SÞlØBw/°©œ£x‚ª­Qý̈Ù' $e< |¦£|³ø^µèéÕ­‡ùý&ù±Hñƒ Ú;DÈæ˜äÌÿæ&†É_u´Ný€ì¿ ÂâX’ ReQ}yåêÿ,äØY[ïñýéÊÌÂ0×CŽO;³^æëYF&#ÿ\+ b+Å} ²‹ä'þ†¸§ƒÙö™-9Ï´ü¬´Sµ*3u5Â÷Ä‹ÏÐK(£µ#Íʨfn‰qMì}]ôSñ¡Æ2öeIžqùŽ»öð;ÏŠ=†~ \v<Ïa[{ï"‚ ˆ9Áôý*€Ïïƒm‘ U[½ä$L…ºP¬/Sº(Ý ¢u]„$‘p…pèBøŸFÉ.~Éïb?ƒ²PAÃ!ƒ‡¹¸ éžÿâð>û@Ÿæ^û@çÿ¨}ú»>½}ÿg…÷+Óá!3uŽ¡|m©å MÅL„‹ŸŠ0°Ò2!Ãh¹¹‹…¼Ãÿ–ùЗ:ª¶UψôŠ@óŸŠV¥Ñ½DÙÀ÷ž(—»¨øƒ8g|\Ghíƀʭ@gG¢Ã+ü`ZàŠ×(ðåquŽ’Ç8ÉËØÙÅà)aÖåtÒqø†ªgÄÃYë{¡rŸ·è$Œ³±½u¸ Šk¸×ŠðšèĦƒöE úú#òëëg™¿•¸e¢ýXÔgt}et'k£2ÈÊVöZ2u®CQ€Ë~†ŠÂfº{\Ë4äY)o¦¶Ðw^¬EèyTè<Úá0>®Ã¹T>¯°.+·²È_ƒWYòîÒ¤>V9ÞÎ`·;ž×ðûß‹™˜UϤž¥ê¼W¼¤j9’ÚaqýÇÔ²³/=pKÌÆ±*WMvíæpݧ "nݾ¡!qý^ǺÇMn¤õ€^óœx‰å-³^æ\ëYF&““:T›qß6~SÏžìŒl*d'cã±¶Ðô–n(‡ðìu³í3rž ùYi§26jU&fêOõvÇ? ½øüˆaòWñ*~v¹Y­\+”„õº»:0ëQÖ¾¬È3>ßßÿ^CW‡ŽãQQ°2{öþmÙj÷bÇz%‚ æyw-CÞ]˰ì?×aph}Ÿ‡c‰ãެkÖÖ$ôn@ÌiQaôC³”_´“Ý ”—‰ÙKуjÂà§ÿ¡z¥„s¯öYÌø9Våëÿ›Q´³1™ÜŒ(~Xï`·‹ë¬Ì¢îß³¢®ÿ;ðW³¡ý˜ÿÏúðÀX8¡6¸g7æ-Wœ÷Ã_#ßê8Ó“|“ïúØï®åâoôlS׊ lÖÀÆüo™qˆ×ô1 õÇØ:2m?!ñpÍóí'}Æ×WFw™Ú¨iÙJ^K¦ÎýçÅ5™+û’õé<9·…»vs”<ª ï|æë—µŸ΃ðºSE«€¥KtvpÔî4Ÿÿ7_åv“¸Êà`ðˆ=]§ttuè8ó±ŠŠÍÆç5¾ÁÐÕÁQÿ:GÛ‡YÚ(EÛ´"WÎÅÌÖÉÉã8Šî^áp9ü¶Õưãy ë¼Â!Θ8÷w¿Óp¼MMXs¬é-MoEúce¡pª;Öm!×z–‘‰,™È.i¹n%w(Ítw.·VÿLå<[ò3ÛNemt&m/L[{ÜŒÞ' €úþ–‘UogØ÷jì8gô{­>5#û2#Ïø|u]D(ì¨Õ`»Gq,g"ûð¹ë€ï(ÇêG4œëQ³ºæ)AÄOб'‘¾ùêëãðíÄêG6á\Ïq”–yÈI˜ EIòƒÅQáÙnѨ‹„“-•§ï3±ó›·Œ¥L+)eúR„ùÞ¯@½(^ p8—аVO‰:ãçX•ïäM»bInÐ×ÃPÿ:GÓaŽ}¯ê°ÛìÙ—~ñh™²Õþ‰ãè1‡¸‹ÕéugxH„ƒ†q¯Ÿmžõ WF…ðdgTXôÄšX¾8šÿÌàû€ÃnWPñ¤ù2†Z°Y#O¢h&oêp,2ÖY:âßÊG;Ì­¶Y}ÕWFw™Ú¨iÙJ^K¦Îã7u´Ú%›]Â2/¯E[sýU›¯c·+Ó¡eé?Ö½¦Ä„ÇyË€£ïëÓ®f¯}•-ô$íÔSxJ„.÷# 8*6'ÙÁÔ¾´ÑQ¿Ïø˜¥‹SËnüÇÐyh ÈdmÓŠ\9J½#.úYÂf û9¼O(Øû =ô«xú6•‹9C_†®±!¹@¿Œ|-f¼úŽq¸×2˶m='up¥‰Í¦@›LÌÊÓ(_÷Z†ÑQQ¯èU2±ÇpþE«€ŠÍ îb`×Ë¥e A„ËîZóýZð %Ë­*ˆº_yá.®À®—ÉI8“Œ ÚnŠ]*zz9JÖ(1 ù¥¬l‹ø/pŒŒ`z§8ïz†®SÎÅB:Åkfþ«Ø)–åˆYN¾£ ¾£À•ïZŽpìÛ£ÁéTÂÛÌÒuJ NëÄnêaDÕ6 åˆxéêàP*(¾þ æYÀ÷>P÷šÈ{Ï>Ìê#³'ÑG‚Înë,©ÞÜgbVë+£»LmÔ´l³(›Mw=°ç%ó.¹¶…iÇÍ \+ŒËçY/v¨ÅoéÛJxí«øY'Ó¿‡\Í bíì¶Û~Lnãö4ŽW§¨Ú ´¼ŸÚ]÷CÛ1ñÀìZnìÐèévmôb¡ûlä¸TmÓ¬\󽆾³½Œv/ýAGùƈª*ÛÝ*6mÑP±E8S+·)†3…¢îbÀî³´k¶Ef›-³=›vp¥‘Iá}À¨Á§£ßEfŒg*»d„—«(6¹Ë·™ö™‰œç¢üRµSÍD&²uµŠU9bö¶ ñ  ë´X&EÍp²¤y&Ãåk Gë*›íÞ½V¼´±…D1_9÷Õ9 ã^[ˆ–#íwdÝògúj ³?òg„ôŸ} 㿈ÁðCXÒúY þ5–6-ü@×A,N½s7›NÛ÷ªŽî^~ÿ@8SçXÁ³FȨՂÜâ)X ´úÚOèýŽ3+ ®‹u&ã.¨ÙÆÐtHCÏi†¶ŽÄL¨}ASZ.f´Õ>«ÎjC2²1ïñЧýœ<ÌÔ³FœcëRë"¦š5`µýdR_ÝeËFee›­öˆ0塯C3&L:¤sm aR…ïy‘¡ý„†½u@ó;‰Çõ í ú›XûªðAÅð¸½/‹eß4'+áhž’-ÿ6Î …G;ƒ¡3bôª˜ ˜ UŽÂ}¯jð>‘xìž—Ú;4ì}U¬­㬼4â(߬L¯£eØ6ÍÊõ7áÌø\ÇÅ~5©ÍºCÛÒ IDATV(è9+ a»,-úúU”z5è·€Ÿþ%'ûŠÍâ~T€cp=³d 9 ù””‰·Œaß ›^§6ëî¶¾«æDvákÔK,ÄÏÎK‡tûÌDÎs@~™´SCͰ‘­« üÑÏ>˜öY³áé*ÑïLÞÔQ½-ûm+•<“:>G_Ðd³Ý^r#‚ L<»‡f¹3ÇॸV,%'a¦¸–+ð_‡„èh•qZ¸dëç¨Û/-Morè¿ê8Ô;ÉËÓP×  ñ ÃàXü»<Ê¡e”6ýú(îÓZèM?Ü)  |®£®A™•s¢ëd†º =iX÷8"r;h,7C§S!Gå6&Öc»™Aâ‰8Z-›÷ ±®ZÁ  °è¿ÀÑ–d5ç½â¡tï«ãã:j¶'–ÝáÊÿ  ç¿txŸTb¹¶ZFËDk|ƒ¡ç,G‘›£±A<€Œ‹Yx]lZg<¤¡Ô ì …#µ¼Ã3o™’í'›õ•Ñ]¦6jV¶Ù¸Öô5›ŠŠ8ÜŽÚÄ5µI`d„£ÿ<0x)y;™)[Heû+ã>;ž×0: T?Ãà°‹rtæè9­#TÑ}N„cïyÑØ‰Pó,îZ þfÊÙ* —LÏ«=u¯DÊÛô‡® ‘z.[ÆQ¹ð<Æà\h¿]§8úÏÉ=ì‹c%4C&Qv­ïªØU«áz¨®fp,¿Zs8ìqëà`V®¥Oq |&îÊBÄìšê\Œé>¯õÏ ë¼ŠÜ™é\"dÔþò(êëxÂúiIU¯0l*×Ðw^ìnÖ¬èºO':"ÂiáuêdeRû,à{_AéS‡C³÷íçXºTAuÔú¿™ÈnlÄwL”£ó£ÔÇÇ:y…“Z¶}fÒžæ‚ü2m§ñ6Zº!³>F¶®FýkM5‡·Lô¢/ÿQGg»š+ß(Ɖ-GtØ)(}"y=ÒÙ—yÆç«ë@ÿY¡«CMJÆý{ýÛB ¨AY(œ³m'8†¾L½Æ4AAÌ$õša[ÈPTXe¡‚@`m':1ôåÎô´Þ‘uþ™¼Xë{ Ú¯Àj·†Ò’¦@Í61KdÇsO>%Ö­»ø©j¼™Fh&bO¯Ø%8Úad”¦$ôPSø`ìΞGCKجce]¼¢Bàò*”|`S9ǦòÐn¬_¨R›®Úq¬{\CéSâAåLšŽd¡lÇ?dð>ì}•cÝプB»¯&¡f»ØùØnW’:"ÊCkíÜ™ùY%™9–Ã_1¸W»öˆÅ¸wíŽuú »žœž|JÃŽç8¼ª6glªýd©¾2ºËÔFÍÊ6׊vL3®v¼ú ›¶pôô&™™xk–l!…í×<\2Ù±“cµG”CÉéÐÞ O²ÑGõ6@Q”¤3³‰ó^à›¯„SuÇN!·;9œÎPzÔZx‡Þ`Üvý)¢›@8Ù©¢vwúk1&œ’I ;‹~¸ì¨²ó}ÀQ³]”%Õ¦4VävV6Ò±Ú­Å||DdïY/fñ8»j£tÊD¹Ž·‰á{_–ÓWÅF1‹§a?ŸQ[Ø´E›þ@Ïé1ßÍÈ„Ý øý ®åÀ¦JŽM•"Œ|ð ;³9ÙµŸ•á OWs ÍM ß o1}|ÜÇÿ¹¹ö™ sA~™¶ÓxÍÙºõ¯“¡Ý¡W{4ì¨á°ÙD¶›‰1Yƒ°fRÎ`—±/+òŒÎwÝãú/­>õû3 ëZÁÐÓ TláXíÖ°«–ƒå fºÄ AAd ׊ôôúQ±eV»7aWm=X¾‚‹þ“¨Øè½#ëœ7115Í«ÆÆƒ¨?P?3…ÊÓP÷šbzÍ+ç½5Û³îQqgPõŒp6³«Û\ØXQ!‡mà¿0÷ì–ÚÔÌ2—m ‚ ‚ ˆÜÓx°UªH9 ó`'êI¶ÓäßI• \eRiÄíÍàXT¼«CG«O“vg†šÐŒ1‡]„­=Ê1ò­Ž‹Ÿª·M;#²Ãíf AAAÄC>‰€¸ÝXíÖ ,TPý¬‚Ú·}&víkø)Š‚ÂsýªôNƒw¿¥ù}Á[u²‚ ‚ ‚ b¶˜“NÂèŹ âN·îÞðÌ<š¡ywió¶ [ ‚ ‚ ‚ f šIHĜ⛯è%AAAAÌ4ä$$bNQ´Šd@AAA3Í‚ ‚ ‚ ‚ b~CNB‚ ‚ ‚ ‚ ‚˜ç“ ‚ ‚ ‚ ‚ æ9yAPÕÔ›4l$iAAAAĈ©KêÔ“Ä‚ ‚ ‚ ‚ fˆÆƒ¨:PE‚È;QO²†Â ‚ ‚ ‚ ‚ bžCNB‚ ‚ ‚ ‚ ‚˜ç“ ‚ ‚ ‚ ‚ æ9ä$$‚ ‚ ‚ ‚ ˆy9 ‚ ‚ ‚ ‚ bžCNB‚ ‚ ‚ ‚ ‚˜ç“ ‚ ‚ ‚ ‚ æ9Yqæåi¨ßÏÓ×w\MŸ– ÆÆD¹/¥N›ëäJ>·ss¥GY;žMnGžëÈê}x¨ØÂ¡ÞÑ·@C‹£»w~·ý™lsõû9J7p8<íyþ @Q¡Ð“ªŠóìËùvè3f¢fä¾^ôG½‡£b#O©‡šç„Þ÷¾œ}yÝ*6r°»Å§b#ÇØÔu¨«§„Ã÷ÀyzÙDâû›Á!QîpŸäppTlášûréü(ZÅÁX¨ìK8JË8†¿ÎÜVr]×™è›JË8T•¿çÃã¨z†›¶³2?ž1÷ZžµqHßyÀ],ê›—’KÇ•ïh|BAÌ ê÷7£tC Ž"äå-Cýþfƒû™îâ ¨ª8FU PZVƒ+ßn»úÎèLÂ'½ÚNð´iÙ §°-Rà^›:m®“+ùÜÎeÌ•/ª¨}ÍiYߎ6|§Ðr„ö8ÙÎpîöÅÀ¦r-á¡v>µý™•? MåS¸ ¬ójpØ‹ý*Ž·3ØT ðÉ9}ŸYy‡©Þ®àò ŠËƒ*Zßeþ(rshšC„]§EQÐÖ¤Ž+ð_÷#£ß'?b8ùÃè÷€ÛÜx×õ Ç?d(*öÖqV»5è·€ãG.ûU4·0à7‘>—åÒügàé?j(^ô}"ÊÞØ ìoh(3[Éu]gªoª®f˜œÔÑ}Î8¯®Ó€®ë¨ÙÎLÛŽ™FæcqÍÕ WF3—ÿ¤xÖ Ù_þBE«!pxÀ-ï¨%‚ ˆÜ>‡´C›œDùFoŠû™Ïúbœü¨—¿8ƒV_3×xÀ]бc·U}óïTEv÷r”—¥O»cø À‚ùQî\éÑ]|{Ú513m¢õ]U|÷¬aøÝÿÑÑ£h#yçÎ#2>úž¢¸œù˜Ý-Ò*6’~rÕ÷Y•·Ã¹®»pÝËðÀCzzjªcíéô_u´¾«bן4ôý•¡4Ký ïpýºŽkÿ­Ây¯H+ºaÙjh?ÆP»;»u ŸSû"Pô˜ æ¿ÀRϕöìSÐüNä\7€ªJ†¾³lNË¥åGùf¾£Qe_ Ô<Ç2¶•\×u¦ú¦Š'›MA{;7<¦³ƒÃ¾X§¦lǪLãó-zá÷¿×Ñ(pe&ÿªJˆµcw1òe:O3ì}™úh‚ b¶ŸC®DÝë»’ÜÏ*bÇ×ÜÅ…X¶l5:O÷cïË5·M}³:“Ð÷àt†BñVrø/D~Ë˯'›ÞÒcÂâÓÂÇÖïç¨ß ßX ¡h•|hÿø\GyÔÀ*:­û´¸†Q(C鎂•‘WǃC€§D„Ä0&„dgÕîæ(p‰ò³»EXIü[×±1 ª26̽V—N>{_‰„· ÿC¾¼áór8–ë+Làj(ÄRǹ‹cõ¬ŒF$+w²ð£ôxݦ’Ÿ=$»^:ÆnUÏDìÔáਪäYµƒTv-sý™¶ ÙúÈä#+¿TmBFFéú/1BðÿMüu.fY· 3íJÙ6–NofìÄLßÙü¦ó3Ó×'¹F“K29ËöÙ/’vér¬ª³›†G÷Z‘æt‡¾[íûÌèÙŒ¼SQtÈL´Ó¶® jwv»‚öŽìÍüì?ËQü°2íç½@ñà º{yNê N'ÐØÀ0ð™nz6VËû6›‚æ&cS6¨¹”Ëø¸û¢ÜØJîë:3}•Û€þ¿ê ³ûÆnˆ±@Ͷì•̬Lm sûpb³…þs‹L ‚ ˆÛ[ø†v›Ýϲæ$lëúÏs´¡xJ>PúT$”æò xÂŽ…ˆO›~`?ø/ÇC¡}Ь{<ѱgôðÛsV„%y3Nó> ( 4´ŸÅ€¬:¾1<¬~Dƒ®‹7¿g>fÐu‘&»VÊáwDøÄÉv†±›Àº¸ð•Š-þ1Kéò ?q¯ô_‘V>Ã#B>?Uá\l®¼m'DXÏñõˆ=$ÖË _Ça!&Ã#ÉõšÒ‘lPn3Äë6•üÌèÁ c7€‚"±þSóÛ‘p/ýVví YÝe®?6!SÙ|ÌèÏȶdu”®ÿЧ»ØTÎQ¼FAÕÖìÛDÊvõ›äÇ2v(c'¦ì®è9Ë#ù%éëeñný÷Ó•éÃÓõ_2v']~‹zkëF¿:»š[ºNëØQÃñt%Gí³ }ý ŽÅ¡úþl­íÞÓ%ôlVÞ©\ö8§û0ð™ŽòÍâ{ÕV §W7¾–üp­LÌʵRÈ=uä'þ…ئ*·ÿÄ 2Ù™ÒsL.Å*hï!ÓccÙ³•™¨kfú6'§šm ¸%BícûÑ€ãCelÇ’Lãòvíá16œ•ûSè·ÀU`Çó¶E±÷W‚ ‚¸-˜¾Ÿ°ãù}°-²¡j«÷öªÃÄÄDpbb"˜ŽCoJú0t­˜ ÿIûfX¤ÿKìqu¯M%œk”f·O§¢’§þ7´-š –o68¿!6­|óT°ü©ÓªŸ Úí±ÇnùýôSèœ?Lm‹¦‚Sÿ›¾iùw0øÓO"ÿ3G•?"¸ç¥©”²5’ÏÒ¥±ò6S^Y}Uo2ŠÎ/ ]+beiTÆdu1*w²óÒãõ˜N~²z0S0•Û¦‚6ÛTpâroFu—¹þ¬ÙDšúÈæ#-¿$¶%##Ùº‡9×/~ó>‘Xþ¬ÚDŠv!ó±ÒÆdú#Y™±;Ù¾^¶­ÿ‹¨0,|0QGfò’Ñ‘™{•½¹îKì‰à¹Oupòÿf§ï3Ó&ÌÊ;æzÿåºößÁ`É£SAE™š¾ÿNß—ßÇÿóJ¨_‰ï­¾`vÚFþDpϾDýïÙ7DþDöêšD'ÀDðPÓ”TÎôˆcŸ̩Ê0—äòÏ+ÁàÒåSÓ×µ/ž Vn› ~óUf¶2uÍDßVìǵb*XøàTBZñÃæî aÛÉ–LÅøþhEþFçÚO/ ‚ ˆ8Ì5ú—“Â×uMê X÷ÚΔ¿‡?öÅöàåÁ3ÒyÏ•OÖÖ$ônˆ}«]Tz;ù#GôZ#fòcQ§±»ò21›*š`PMðÜöŸŽûXÊ´šm íÇ4ø/0xÖ‹´®Ž’Ç8¡·õ× ¯“ªF䯷8Ú:€ë?Ä®Q3:‘Iñà |Ç»]Ô¹`¥5y›-¯Œ¾úÏÞ2€)±o~KÖ'¾Ù¶j'f½òñzL+?I=XÁAÈG½gìÀ î2ן-›HWiÛ2¡?Ã6!£#“ý×®Ý%*è;ÏrjÉøæ+5g/dú#Y™µ;™¾^†î^`Çó¿­@µ1ìx^Ã:/pñSÆÄ¿û†ãmjêµÌLÚLù­êÍ»>nvÓrñ7z¦¼k…½fhg2zÎDÞMoéhz+R.e¡‚‹Ÿ²éûo˜ö®û”éuÏŠVK—*èìà¨ÝÉf¬mdͶ¢àIBOª·+†É8—[+û\“K \eð0øÄÌë®S:º:tœùXEÅfk¶’ëºÎ†ýTogØ÷ª†ÀUç½Àð×Àè÷:Z}jF¶cF¦ñù꺘=½£Vƒí³#ÿð¹ë€ï(ÇêG4œëQ³¶þ(AÄ?{-š$’Ù⛯Îи>ßÑN¬~dÎõGi™ç¶©CÖœ„Š’ä‹ñ×{bšº˜œÔS>Üô}&v|ó–±”iîµâA£­ƒÃ³žáÊ(0ò­Ž“‘ÎäM»b©µâ8zLÇ¡îbuz}•!xÓeëa¨£é0ǾWuØí öìK¿P³jKL3S^}ßÔÑ~ h?–l!nó6£rËb¨Û4ò“ՃƓÈ;v`Tw™ëÏ–M¤«l>fôgd[222Û]ÿAGÕf%ç6‘ŒðÚQ¹@¦?’‘•»³Ú×ѰŸÃû„‚½¯°Ðƒ¯Š§ÿ¨aS¹ØEuèË(X–t$[~«zK&oÆRë S;“Ñs&ò;ô[ÀÈ×b·_ß1÷ÚHÅ‘º×”˜ðLopô}}Úq’‰Œm6Údbº6 Ø)Y·­˜þâǰ %n\R´*ùyv»2*Ã\•‹§ð”ˆó÷# 8*63Ó¶2uÍ«rªÚì{U¬ËÙø&;±ç•[“SÙŽ™åë^Ë0:*ê½±J&÷§pþE«€ŠÍ îb`×Ë¥e´ñAD:–ݵ,æûµà5Ê,Q´ª ê~æ…»¸»^nœŸNÂl36n0`»)s©èéå(Y£Äl2`”|µop»:8”… Ê£ÞˆÚ)–ËÑuJ ÂêÄn2‘ð0yà;Êà; \ùŽ¡åǾ=œÎØ·³RÝ Ê›làì]ìyiæhü9ݦ“Ÿ¬¬`O"ï\ØQÝe®?[6‘®>²ùdª?™Åû„× –s›HFÞ]r‹¡%̲–hcÙêÌØ]6ísôå#çUU¶»UlÚ¢¡b  ß*·)IgËXÑ‘lù³¥7YrÙ÷eCÞÑNw1`w0lÚ¢¡f[dvxíµøYOaÂŽ“Ld\x0j°þåèw‘šÙ´­húÏ‹¿Å&w—ö¬;>Ëîà~;ÈÅéª6-ï'¾±•™¨ël´‡(yLA[ÐøÐu(ߘ8ž5‹™&ÃåëxGë+›ýœ{-ÐrÄüË"‚ ˆùȹ¯Î‘æ(îµ…h9Ò~[•9¦¯–°€¿QZhðÌyd¶ÿE„oyJÒ ºÏõ¯±´i€9n:¤¡ç4C[P¾1vv†g¸f«…rè: ä'>Ф¢`%Ðêch?¡cô;ldIåcøàAy(/†¾½^`R¯fœm‹ŒÄ ÐB “é1•ü¬èAÚY´A<¨i?'/Í–Õ]æú³fiê#›O¦ú“‘‘YŒÂŒsbIÚ••p.Ù6–¶?Böû"«}½áCë =gÅÃtØ®JË€¾~¥^ ú-à§©iålÆîdË?Óa¹ìû2’w*6‹p÷úƒëðÐÕ>¨ ùDÛÛû²¥n|33{ËöíÑ08"-†¾ÔÑú®š“º†¯QH,q¥–eÏ‹ í'4ì­ƒ¡lúÎÆîp<×ä26C§áèU`ébż­`fê:[m¥f;ÃÓUö¾*fiWoË~_’J¦É³ZsÕÏ ^r#‚ $ž·B³×ˆ¹ÇॸV,%'aÒAÒrþ Ààxx)Zeœ.ÙºÇ9êö‹ÁJÓ›ú¯:5Ä@òò4Ô5(h<È08Œë(z˜5J ã¼W<€ì}•c|\GÍöؼë0ô<¤aÝ㈔ã`úr€÷  ýP°(,ú/p´H”IQ!Gå6&Ö{º™9á Ò’ÊÇ3å•¡±‰¡¨ˆÃíá¨}A žµI`d„£ÿ<0x)uãe’Œª­@Ëaožµ ##€ïƒØ‡ÙdzL'?Y=X¡ñ †ž³EnŽÆ!Ÿ±q1믳+{v¬î2ן-›H§Ù|2ÕŸŒŒÌ’Ê®³iÉÚ•L(™•6&£7YLÙd_ß}:ñ5œ^ìõÏ ë¼ŠÜb–ªs‰ûGÈW ¨¯ãhkg)ålÊî$ËoEo™Ë¾/Œy§t~½Â°©\Cßyñ‚grRÇžUC‡qͳ »j5øØôïVd\û,à{_AéS‡C³÷íçXºTAõ³Ù©ëظ°/@Ì2àðœ‹ÎRëhTU8ðûTìx^Ãè(Pý ƒÃ.Îë:ÍÑsZ™©5×ä²lGåVÀó˜8^ûè:ÅÑNÞ)m+¥0#uMÖÿçªo S¾Q¬ØrD‡m‘‚Ò'’×%íX‘i|¾ºôŸú:Ô¤dÜÏÕà°-Š ”…ÂAÛv‚cèKgzææ“AÄü¢ûtܽþútZÅfoè~Ö ÛB†¢ÂB( ãh;щ¡/Gp¦§õöªp¶v7–Ù9óâ§±;Ú%K Ÿw¨i*h_,v—+|p*xù‹Ô×Þ³o*XxÿTÂîtñiÑ´ú";Tqy0²ë›¢LKM³_ˆ‰ÿ;|FŸ÷Ïÿ—x\õ³SA× QGEõŒÞ….•|¬–×ÌnÂ?ý î|!¢e¡Øi/zGi£2&Û1ÓèºSSB6[rY%Óc:ùÉêÁÊîÆÁ`0xíZ0X¹Uìä¶£ÊmÙµƒT6œîú³eéô"›¬üRé.ŒÌÔ]ÆN²eÉÚ•dÚ˜ŒÞÌÈÄŒÝÉöõ2;e~3Ú]Ù&ò³ÛÅNÃÿ¼ žìùDïàl$g³v'S~+ɵ„:OM…vÉ}c*+}Ÿ=›•wº6äZ!ú;ï“SAeaìÎÑ1uþß`PQû;+\»’ÕBñ)ÿÃTð§%gµ®ÓŸü‰ m‘ÐEë»AúÉîPncáÄÃå©Üš½]as%—Ãoƒ%EúHeáT°xÍTðd§¹Ý‚ö2“uMÖ~rÑ7ÅuRýniwcI™&ä—/v]7ÚaÜ ';ƒÁâ‡CrÁDÐf› zŸ˜ ^ôÓN¦A´»ñÜØÝQ;ÇÂÇœìl ?\´Ù” € Íf zŸ( ^ôŸ¼ív7Λ˜˜€šæcãÁFÔ¨ŸÇe^ž†º×”˜µ†dpÞËQ³ 1k0¥·óYdÃAAAó—Æƒ¨:PE‚È;QO²&ÿNªLà*“J#î ÝRÝ ‚ ‚ ‚ ‚ ²C>‰€ ø-Íï HDAAAAÜ9ÌI'aô‚Û1äÝ¥‘AAA1o ™„aÀ7_‘ ‚ ‚ ‚ ˆù9 €¢U$‚ ‚ ‚ ‚ æÿA" ‚ ‚ ‚ ‚ ˆù 9 ‚ ‚ ‚ ‚ bžCNB‚ ‚ ‚ ‚ ‚˜çäMLL@USoÔÐx°‘¤EAAAAw ¦6.©?PO#‚ ‚ ‚ ‚˜!6¢ê@ "tìD=Év 7&‚ ‚ ‚ ‚ ˆy9 ‚ ‚ ‚ ‚ bžCNB‚ ‚ ‚ ‚ ‚˜ç“ ‚ ‚ ‚ ‚ æ9ä$$‚ ‚ ‚ ‚ ˆy9 ‚ ‚ ‚ ‚ bžCNB‚ ‚ ‚ ‚ ‚˜çdÅI˜—§¡~?O{\ßy p5}Z6å¼”:Í,9޼< yyÚŒ*«~?·tÍ\Éx>#kóñvGº˜½v`µï·õ¼< y 4¨÷pxJ8|ïœgfÙ"•] 9Ô{8òhp88*¶p ;.‡G€Š-‘²¸8º{ejFE«8 Õy GiÇðׯå¨yNØÔÞ—Sëͬ,“åSŸŸLú'™Og—ñ=QûY¤«÷$ÊÃwTüvå»8Ù\J7p¨ªó^Žúü—äå«?˜?ç»›§lG2ú’µ3¶â¿ŠãT•£tG ©‡´[+ö%#Óøóãp¯å©h¬rû‘Q;õ+yJ]ËöÉfi~ð”Dú)ÇŽÚÚÏÆcÒ ‘1²þhðà^+Ú­Ù6aæÜ\÷?©úŠøûòlŒ+ÌèÎ?¸‹9²ªzÆø8C9›8׬Ndûx+mÆÒx÷†Ð#»[|*6rŒÝ‹Ë´3r*-úÅoÆùð_Æ„NÌÚ­Y™ÎÄýÎ]²ç¼\ÊxÂØŠ˜ô÷Ã]\U-B^Þ2¨jJËjpå»9 ³Á“^ m'xÚ´lÐÓ Ø)p¯Mf†î^ áuõ —U\To %çJÆ„y[$]Ü^ú S½]mþ Ç?d(*öÖqV»5è·€ãG.ûU4·0à7‘>Û´á°-N¶3œûD…}1°©\3tŠÈê ùÏÀÓÔP¼ èûDÔ¹±AècÈà†s ë ( Ú:tpÌ¡cÐ IDATjV–©ò ß?¢ï#Óõ‹K·‚lþž’ðCQ¬íø?åž¼©ãÊhÜ`ÿs›MAÁÊXÇáêG4 8Þ.dSûƒïà7‡f`jŠ¢ óTbzÿ_ÜJ^7}ÉÚ€[ \Öy58ìÀÅ~ÇÛl*ø!µ.fÃnÍÚ—lˆÏçÌÇ¢|«=Z‚ÐXåÎ$ãv0¨¢õ]†áo¢$}ƒ{4KÃë Õjco0ôôвÄ;ÎZŽÚ$P¾1µÞl›±Ô–[D~×þ;Ê6þ;Òö²Õw›’ӿŘ!zŒ¯ûbk~³2ÍõýΈk×Bù·¤öÇ\£9ù'|]פ?×®]n©3uÞíòÉêLBß{€Ó [Éá¿ù-ÚÒô–žî>¶~?GýþÐ4æŠVÉOñ忟ë(ßÈ Ó†GC¬|ï%† ®Š´¾óâoÓ!}º|ñ¡:µ»9 \¢¬ìn1•:þMC²éØFéþ1%=<½ñMã×:é®›LƲe6"\Þ½¯D¦™ÿ#ônH„„C'<%Æ¡R«¡0ÃPØ€»X^¿²å»T=±!‡ƒ£ª’KÕM6=úÍwxÚ}ôTñh»3Ò…[œ~ã)!ëp>á0yÆ„ 8¡žá0§Ó8ÌSFÖcc@Ueì”y÷ÚÈqé~O…L;É_ÖfŒúŽd8@cÃÀgzB›‹Ö]ªö"ÛRÙr²6Þò¾˜ñÕÜd\—Ò²¸7èfíi‰q_o¦«q“åü Év±ÜLL#Œë°/’¿oµàp­PP»°Û´w$Ú˜YYÊæ;ð”C_ÆÎÖJÖ2¸×Š™ƒÑ:×QRÂbe³PAóÛ‰²q,êzNë oÆ]ËÂtâ1í¯ÿ¯:*·²Œô%kælE\gô‡Ìe>Sv;yÙfÇéþhþþhf¼,s¹1SvÚAÑý¡kþÈg´ïTïILsÝ—¼,iÉOlÓÿÏÏæ¹¹íd±r/œiÝ } x7Xuà‘ÖÝ›ZÇæÎ5§³}¼™6c…þ³Å+pÞe÷Å+iådr΢¼œ•ÛÄ8 ~vߨ 1>¯Ù–½’™•i¶îwIó·…þs‹fîÝØÂ »Cõ•5'a[О£õ¨SòÒ§"ÓÙ“…¼Ä§MþK"téÜ'*ELÕ7rÞôœa žÇŒÓŠ ›M‰ ±òp(Šÿ@¬ƒù€g(õveº.F¡`‡ßS†O¶3ŒÝÖINÙŽgx$4Ý]Î}"BúÏ ‘꺩dœI™}ÇD9·3\üT…s±ø¾ú ºœù˜áÌÇ º.Ò¢õ6v(zH¬G>ßaS¸‡Gäd”®Üc7€‚"±>JóÛ‘p= YÓD(•€ÁA†mwFº°b‹a‘‘u¸mŽ~tv14·0tÖ±£†ãéJŽÚgúú‹§+×]I'ëŠ-þ õ]†¼Á½ Еû=Óv ›¿Œ­õ©ðn ,‡Ì·ÙvΖ“µqÿáŠ즵´=õ=þ¡q_oµw÷›Ê9Š×(¨Ú*ßþâuPü ‚ö5–&`l øLGùfñ½j+ÐÓ›885#K3ùJó›äÇî5 ú¯:†¿ôg£ÿÐá^ xeðG9Âÿ‡)OËf=À’øõ*Ê¢ú°8*·²˜ã®Ó¢ý•>‘™\emÀŒ­x7ˆ >]™p¯™°ÛœÙjÈÞÆÆ€]{xL}¬Ú,ÝÍÝãï/éÆËé®#;fÊV;\½H°3ëö˜¥~ÑÿYÈá´Òü2!EŸµ÷U!ígÑ&EAÅÆì›ëþ'­\-Þ syïJ¦;ý–¦$ËòѤÎÏ̹fub¦7Óf¬Êyä€k¥ãu¥è³…Y9ÕlcÀ-±ä@l_-:ÖøPc»µ$ÓÞïŒÎ \v<Ïa[dn LÌ0Óú `Çóû`[dCÕVïY×l…»VÄNÏþf84…÷/æÃ‰ Ý>œšŠ C³-2[ªkˆM+ß<,ÿCê4ï“SÁ’G#ßm¶©àž—¦‚ÈL‰.ß<,|pÊ|˜ã¿#S’Ï|œ~Jt|zù¦’Ö?åõM^WæÜdú^ºt*!d²üSAÛ¢©˜)åFz«Þª_ÜÔs׊D½Y•uå¶© Í6ež`eÊ||zøûOÿa…_+ÞîŒò·b‹²²&‚®ûÛB|O¸½žü¿ì:"¸ç¥äzK÷{2dÛéüSغQß‘²ýü;1<ÖÈVŒÚ‹l;±e£2*Jò #YKÛ“D_o¶ŸëyxŸ˜2 I1£ƒ^m˜÷’ÅSÁÊmSÁo¾JóÏ+±¡'ñaEfdi&_Ù>:\—t+¡@Óá-oGÂÅEè8ztíZÄ•…S‰í;…l¦¦’·‘p;¼üET¨ÿ³É—f•«¬ ˜±•ãu&‚…NI…NͶݚ “ÉËÈæe"!$ݪÍÒýÑZˆ¶Ìx9ÝudÇLµƒ§û•’G§‚Š2j› {4Ó/†—¼Xºt*ÁÌ´¡‹þȸ˜ÚM/~*§?ÙssÝÿ¤“ç™k÷ÂlèȬî\÷M‹N,cñâßH…™sÍêÄLo¦ÍXîo“Ü»÷ìK/'3¶fÅv]+bûôpš‘ndì6[2ÍæýÎè\ûâ©àåÁôþ ž½pcÓûb{ðòà™;2Ô8«áÆñÓ³‹ C^z‹Ó¢½bg&°»ò²ÄÙÁ ŠÆƒ,ÆÃÛ±á‚iÞõ Ó§ÃJ&'uԽƠä+Ó!oþÀ»^ΫÜxÃyoh×ã»4üþ÷âuÉè¨ùúûÿ–¼þY»n†eN˜Ž*wy™(k*½õŸ¼eoë¢Þ°”¬„fZnÿq £ð„l1:*fK9——ý,ñZF¶h$K ¶(+k‘Ü[Âå¡Ù@Q³å\+ Ú«¤¬‹Và;&vž3Ú•+ÝïIßXK¶™ü¥l]R_Ñð[ÖúG3í`&lÙ”=IôõfÛø®Ý%*è;ÏbÊ`E. p•á¢_E]ƒ×  ë”ŽÒÐ}:öØö®û¸BuY,]ª 3Ãð¶lçûÍWªÔÇ N'`_¬`à’(ÛÀ%Žâ‡…Ž÷ŠM|¡‹ƒ—"³µ²Ã”<ª ó”˜¥5𙎪¡Æ²r•µÙãº{Ïk8ܤàø_TŒü]Ç:odÆç"ª¡­ýö³[³yUoW¦ííò*j_T°£6q÷ÓlÙ켿?fi¼œî:2÷™LÚAÓ[:òîrZöŸ†þ\ü”Áá°n™Úçbüä$¦7%0Ëà%‘Gypѯâ¢_…wƒH3Z†Ãʹ3ÑÿµïèçQÌܽKböU*Ýíy‘aèK{_÷íg`ï+C_êPÒ„€ËžkE'fúx3m&×c„L°j»ÕÛFþ®Ooà3ü50ú½Žªm,#»5#Ó™ºß…;ó± ×r1ã½ïlf³Ü2¡K¤êÓÎᛯÎàÌÇ­p-wbõ#›ÐwÖGÖ5?[)J’,†w:ì‰iê"1@’ßÌû>;yËXÊ´’Q¶¡/ÅÀ³ð~ê=@ñ``€Ã¹”aò¦OIúNµöOGé8Ô À]¬N¯)ðÀC"ÜÅ,“7u8ìŠaý³uÝLˬÚÌ•;Zoã7u´Ú%»˸ÜãIÊ’UÇÊç¢^­ï©†Ž #»3Š-ÊÊ:UÛ4 ¼e^Ö}= õ¯s4æØ÷ª»]Áž} {_–û=ï.-Áño¦¤Ë_º’úŠfüÇpÅL·Ùv`Õ–íve:”"“>GÖž¢mÇl¿þƒŽªÍÖÚk2xJOhí¼@€ÁýGÃŽŠÍ,fÐY÷šã-޾¯#p•M¯ÕcF–fò•%¼nN®ð¬ŽÝi‡KT(gX—ÐSÂpýºŽšgcõ´tqjÙ„õ“lɪ­ {ë8œË…œ£C™3•k:=®a?‡÷ {_ß•…*žþ£†Måb—Ê¡/£èsÈnsa«»pÜ„q¯e2ªˆzÁ’-›ï÷Çl—Ó]Gæ>“I;¨Þ® ö¾<òµØa×wŒÃ½–Y¶ÇLlŒs ÔË1òw࢟M;%Ͳc'Gñƒ@[;‹jà ž»vs\eŸ;“ýO|ûÎd\aUGÉÆ„²º«yWÐôÐrXäUò¨‚ÊmJÚµÏeÏÍD'²÷%™6“‰œm6Údbº6 Øeçùɪœª¶û^ë“6¾ÉÄ®÷ù@åÖä}`*»µ"Ó™ºß…ó/ZTlfp»^æ(-3ÿâbÙ]Ëb¾_ ^#¯^–)ZU¥//ÜÅØõr#JË<ä$œ)ÆÆ :®›¢SKEO/GÉ%fA|£´‚•b†„ÿÇÈHd%ïz†®SÎÅB:ų&ºN‰Ž§þ@¤AËn_Î1è¸)I럭ëfrnÒNŠrGëÍfSà]ìyÉ|([n{’²XLþ’Äaù M*ØT©áL¾š°†Œ‘ÝaÅee ²²Vï|G|G+ß1´áØ·GƒÓ)d’î÷do×dÛAºüeë!«¯hÂŽ•âbk4™v`Õ–=ëž^ˆ·‰ ²Óv³]·é‡À'¸VX›É!£§¨Ú ´¼yh¯oÓô–ަ·™áÁ©YYšÉ×êCS2⦤måQ†®S‡F¾ÕÑüf$Ÿâµ ¾xÔz„‰N­ž^ñàfäXé>9ΈòÍÀŽZ ¯µÏæN®F6 {Üè:Ê7FÚAU%`»[Ŧ-*¶ú- r›’t6ÂlÙm:²•—Ë%š–k¶lv¾ß³5^Nw™ûL&í úaÛ] Ø ›¶h¨ÙÆàYoÍ­ÚXxÚЗ@_¿x(·Êè÷:¼/)†þ-GR÷5²çÎVÿ“é¸ÂªŽdf¦Ó]ý†=û€À ªMl¢å)áRº–97[:Iu_’i3™È¹ð>`Ô`Vñèw‘ÙÓ™bUNPò˜‚¶ ñ ±^qùFsãótN¿t2ûpD¦ï;’qî«säÅ›aÜk Ñr¤ýެ[þL_-a㣴Р,ú¡ƒÿ"6Hö 1}ÞY þ5–6-üÐÒA,кs7›NÛ÷ªŽî^žÁ$Ú¨®#a {Û‰ÄÐûb#qrÁ”bOIòú[¹®‘Œ¥Ï53xX#ÊØšFoåeÀÐס7/ Ì]C¶ÜÞ b £ýl.LSVGa|GlÚ¢áÌDZƒzC»KbïfmQVÖ™`ÅF V­>†ö:F¿ã@\è®ÑïÉÞþɶƒtùËÖ#Y?‘Œ@¨?ÄQò˜bi‚l;²e»Úó"Cû {ë€æwëÕw6²a¶íÉlï;oÍAh¤ƒ±1ÌG¯ŠYo€xÀéê»ëÉfïË\ Nß4)K“ùÊ’ë0¡âµâoÓ›¸nn‡k}{tt‹ì»Œ³³—Ú;4ì}ð½· Á  éGùfŽ%Æ×VUá$î?§£rk’z𔫔 ˜8εBAÏYñ°¶çÒ2 ¯_E©Wƒ~ øé_ꜳ۔d1¯ÑQ1Ã(c›¥ûcÊßS9|ÌŒ—®#sŸÉf;¨Ø,ôV€cp=³d–lì7ádø\ÇÅ~5c{XºX1ÜŒkøëØ>$“sg¢ÿ‘ÅÌ¸ÂªŽ’Î3©;Æ0½‘àðˆØ÷¢_®<éε¢Ùût›É°¿õ–1ìÛ£!`p:#¶1ô¥ŽÖw³3æÈÄvk¶3<]%Æ“7uToËþ8(•Ls~¿KÂà%!7+„f¹3ÇॸV,%'aÆÅrþ Àà\­2N —lÝãuûÙôËþ«ŽC ± 1/OC]ƒ‚ƃ ƒCb‹ùè5ŌҦ’2ì:­…•lúæ¤,T0𹎺¹Fê}h?¬ þ m'«Ú ´ÖÑø&àYË02ø>HTÖ½Æð@¯†u#¦þV¯k$cÙsãeœŠº =Å•û`¢Þ›ŠŠ8ÜŽÚÄÍI›FF8úσ—XÒkË–»ñ †ž³EnŽÆq±q1[¬³+yþ²:Šq¾ÇÀÂŽÂ.›“Û]2{7k‹²²ÎYYrTncbmº[‘ٞР7ÝïIíI²¤Ë_¦©ú @ØÎ`h@í¦sóœ‹Î¬9¸dÛŒ-ÙUÁJà¸OÅŽç5ŒŽÕÏ08ìâÜ®Ó=§õé·šÙ¶'3m\¶‘ÕÁ²e•[Ïc Î%€ö+ÐuŠ£ÿ\dàÛ}N„âíyÑøA£æY†]µü žyYšÍ7㇦,Q೯úÏéøÿÛ{ÿØ*ªüÿÿÙwÊfΦ¾s'ÁäÞ $-ÑOh#‰­`ìU -²VŒ´`b+nhA£E7k©FZØ­F¡kÔ–Í -y ­‰Ðö¡e#ÒnÖ¥5ú–nÖ•šÅ´D6”¬¤Ó¼ÝÜ3YIæûǹ·÷×ÌÜ3sçö}=67.§3gÎyý8çÌ™ó:§pµ·}B¤8«£d’4é[° h{GÅî: W'€š†ÀR`øK õGÀk·÷‘þ3 v_ÍÊUÆdmÚ~ǰ¾LCQPLŠæ-ºïü€Ù M<.lp>Ø­nóŠ­®gD¶(iÛ,õòýcâH>Õx9Õsdú™tüÀtÂée†­úωyNíÑ•?Æ1ô©°%'jË€ðÉØ‰ûÄEÓ*ç/ïù Ãî_k¨­ÁÌ~ª'ÄDVâDKb?'{ïl´?f×ÇOöˆ:NÆ^÷]Nt×´Ÿ£t-ƒ¢ˆ¾¨å ÇóÏ%oga6ö¹×NdûYŸ)ß”^{[· hOAùc‡Â+töräæ*¨Ù•ZN2þ‘ŽíVlm|ëÛ:|K”o„ÔøÐÌnÝÈ4Óý]Ó~_PTÈ äˆ ÚŽãbÿËÓ½³¿$‘J_‡áËa(*,„’£`bâ:ŽwaäóQœîm»=+íÕéÆ2'Â^ø$þd'«´È}[B†™8e©puhæD«gÔ7„ŒÂ{CI§4%¦Åž49m)ñ4=`ʸ0½ÕéÆSÿ§é)Šø•¬ ßü-¹þ¡aÔì'ÈÙ]9ñ¬ð^Qw¿?dÔ7„’ž/û\3ËÞkw²¯‡£§EEò5;¹ëúuÃxþ¹¨~•q’UâIÕ‰ÏrRîñqèz24srœß/N³Ë_VGfÏ‹œ¸xú#k»3Ó…[”•µY9ÍìxæÒל˺fWÈÈ_Ö£"ê{¢Xª¿§:ù/•¤Ê_¦víDÜédÙâôÁ’u!£í#îDI7þ"ë©lÙÊ®"v9í3"Ǫ'“OPskOVé²us|ºo zSœ’‘•’2Š '»âýJÉ ™ê/r:¨¢$·©dé6_©èÓ@&ÿÈ©®f' –<JjÌ|µl£h;‘=eäÞ%|ÕñiÕ&×8•«Œ 8¹.rÂmÅãÑúùýâôØo.ÆÉ.ÃTvóÅn­N všWÒiÙât`«S•Bý£³þÑÉxYæ92c&·~`åïù+EßëÖ¶Ý´…V?³±¯Ì)¥Çþ§ {Ê(¼7dëk÷dïÍtûãä”X'ã ¯û1YÝÅöEù+EeûFÙ{êÄI#ã3^0>nÇrįâñqý{¹òÈú‡Ûm·ìþîêtcI™fº¿;Ù%NÍöùD}¾Q¶1dÚŸÑéÆsºñÉ®6£øBÃçS †Ïç3Ê6–OÞ¶§gMMM ¦˜jo>ÐŒ¦ýM³2q™•¥¡ñUÅñ¾MywsÔnGÜ1fi‘iÈîH_A1ÇËAÄ£ù@3ª÷W“ 2@×.4‘lgȾ*3q…I¥Ä\Ø"Aú"‚ ‚ ‚ ˆùJ6‰€ ‚ ‚ æ?¥øûAAÞ3/' eŽ'‚ ‚ ˆÛ‘¬Ÿi)ÇÊ4^&‚ Âkh%!AAAÌ#¾ú‚& ‚ ‚˜}h’ ‚ ‚ æEkHAAÌ>ÿE" ‚ ‚ ‚ ‚ ˆÅ MAAAAÄ"‡& ‚ ‚ ‚ ‚ b‘“555e€ªÚoÜ| ™¤EAAAA·!Ž.iÚßD#‚ ‚ ‚ ‚˜%š4£z5 "tèBÉv 7&‚ ‚ ‚ ‚ ˆEMAAAAÄ"‡& ‚ ‚ ‚ ‚ b‘C“„AAAA±È¡IB‚ ‚ ‚ ‚ ‚XäÐ$!AAAAA,rh’ ‚ ‚ ‚ ‚ 9žLfeihÚËS^ט¸’:Í &'E¹†?³OsJóŽ@€#+KCV–6«ÊjÚË]=3S2^ÌÈÚ¼WvçV÷™zNÄþMK´y[ÏD]$–[½“£´„£ý]€óôôîvþ;<TnáPïäÈZ¢!à¨|‚cxdî}äÒ(PùD´lù=})lIB]Ek8 ×y9GùfŽK_š—£öaS{^²×›SYZåkë1¿t‘•C¦äëTRm‰¤ÆþÔ;9*·pSqÚN žŠ E}T•£|ÇÄ„we÷ÊvÝØ˜Œ$ÞÏGp-O«ï’Òßñröºõb 4üP¾‰CU…îòîæhÚÏÁtßGX]›–¦ð §í¢S¿”–DåXÎQ÷<‡öƒý}¥¸µ<†€`1cBÕO§ÎÏͽ™ö;_Mì3Ý·O^ù³;įr Çä5ïïu*SWýš¤ÍÏW95ír‰¼[Úµ²ò,ß,|?™çÃþàÔ>Ê>ÓýJÿ9áãª*䧪Âf.M彩×ïȇQ¾©@²²V iïa ߟDå–Z°; Àî(@å–ݘ¼6¹8' ey´LCÇqž2Í zûßRÁµöiNèéöýVGÓ>†‹Ã*.« BÉ™’1áÞ:ûýüáUÛ”¥‹šŠ¨ÃŸU{Ÿ¡¨ØÓÈq_Çädr½ëžcóÂ;Þ jÐoÇŽ0\Tq¸•?‰ô¹¦õm_p²“áìÇ*üË€­šé„ˆ¬ÿxêWŠ×ý‹:7ïú1yyâèþP'`9`v*K»|ý"®~ é®_ÄÊÁkù:}~*œø`¢<ÛÞa¸ôW (È¡iîÛ©‰+Àú2 ?pa@űNŸ L|çMÙ½´]§6&ë‰ùœþH”ïÁR —Ǽkâô×Ê0<ƒÉnóe Ô~xða ÈŽu ÝÕ=ÇÐþ{à>»sÒ&ö'iÛa ŸpjNÙ÷[ ÐÖ¶ñ×zûDY¸… ºº±¿[Oήÿ¥%8Ý«âd7ÃôÀƒó”åvro¦ýßLO±¿Òu³×·óàÃcß'?`8ùÃØ·@°ÔZGnîu*S×ýš„ÍÏg9µ¾ hÓ@Åû<ȳ¦†azZGÏYó¼ºOº®£vslŸndŸÉ~eZJ79_ü³Š¶v†‰«¢m–Ð%¹÷šNhÓÓ¨ØRfãûÁ‡+1öíN~І“´aìÛË–Vƒó6355eLMM©8øÚAË¿SFã«¡”y˜]'{¯SJ 5;B)Ӝи/dSÆ\Ñøª»çgJÆqüÇXT8‘iºv—Žî3ò ]×7ˆ{/þyþÖ3QVz7 ßÒQòHhÎ}Á¬ŒßüÍ0=eÔ7˜—ïìÇsï#‰ÝJèÿD]¶Èõf:ð/ Ûäur²KäßöŽø¯™\ÜÈR&ßL¶¿Nä ù:ÕƒW峺þ«/Dú±ŽÔϳj§½)òý_fÊž Û•µ1Ù¼Ìò¹~]¤z3síÙÅa‘~ò2ã3éäiž!ùþë߆ϯ×tËî•Úù„ÛrÜîÿ+9Í®,SSÂW"eJ¬Gɺ‘{W(¾_ýaäÞ2ÚÚSô÷îÍ´ÿËÚÆlôí‡ZEYÆÿSæDm«{Ê4Ý~ÍI?0Ÿä$k#ŽäDZmP IDATùÑ6•=²ô ÿ2wïãNe?ýŠ™SÆ¡ÖÛïýóàkqú_Fþ'æºÆ¥~ŒÆWŸOJ?ÔÚh0Æÿqa&mü FÛ;ÒùχŸ§+ Ûßòò¡e«8ÏGÿ }iyCO ‡‰M‹\Û´—£ioxùõ Ekä—&ó¡?鍨ÂLÓ.&‡¶¿›ú1qE¤õŸÿm9¨Ï”/1”§îEŽ‚|QVv‡Xžø…Äj¹YúàXrYnßüºùìsªçZÉX¶ÌfDÊ»çåèòøKá¯ÀÃ#"Ô„1ñ+-1¥š¸E ‡¤‹åõ+[îÉk@õÓQ 8ª«¸TÝdÓc¿ÌGÂb—¸'Úâä$P]¿,>¸6¾ü2ºO•WϱÓu?ÇÜ»äWLzQO'ö`Ö.X‘—4ïcúTOò§X;°“¬ÛÙ©•ÿ¶¾Çáó)8Üb^—òÍ +*$ü2R—æåæí¸ÿUË þ%,Ûer+1Ítpã†ÿRù>©ã8GþJu/~¿‚ÎÉ6æT–²ùf§rðZ¾^<ß­šQtoØ—þ™B¶í”¸wì»Ì”=¶;yùr2oÏÁÕávå*—Sʶmvc ™v±õ=_Ž‚Ão&·å@ã>†ÞSzÒŠ•Ãoa¦µ¿š+¼±C;ŸÈdû¥Þ™œ–uYöÔsÞ TW™ç7ò9P¶ À’˜Ä%"­§Ï¾ÜÎîͬÿK¯TqÑ9eà Gñ òîŽ)óÝ@ñJJ™:»×™LÓíW¤ûy''éµòò\Tmþ¨'­î›¼&ÆÂµÛ½kÃÊ>ÓýŠÏþ?·hõ1» œDñ…È»;/Æ÷óPü@!zúT]<›$ì8 œãh;"BË”l ü±èr{«˜Ä´™ÁáQ`ð3ÚqöcŠ"Â÷0dõža¥˜§>Ÿ‚Á!3aÁ¡( ‡â'1 ”>$Ê_³C™©‹Y¸Ø¡·ÄRç“ “7õKÒ͸4‘P€³‹†sBÆfØ=×NÆé”¹ý¨(ç±N† Ÿ¨È[&þýàÃt8ýÃét]¤ÅêmòPt¿ØG#rÀ/–ž_•“QªrO^ ŠÄþ-‡ßŒ†kèè04M„¯\þf(Xem‹•Op mïˆõc Á5€þogºO•WϱÒu"=gé›:êv1OmTÍ·4y):0e4î‹O«Ø2*·O+{4d”¬‹þÛç õ¿ ÈŽ.宨2 W‡œ‡Bþ'º”úôG©—r'¦W<²¬¿íó>Wæ^+}çæ†’Â*+¾¥¡¸¥ðfz«Ù®_Â’ùü•Ézs+ëªí!Ãç ™†¾¸ ILüûú÷"t¥pµù³íÙSFýo¬ë(«ûTùxö ]›…ñ"{JZÞ^ÕÓ‰›µ ¶¾ñŸäðX3;0“¬ËØ©YÅ:ÉLÖ2~)ÛŽ;õß³"²!Ó0':øæ²ð7`JôËBFÕöñÕÖ¡9ß\އI 3s"K'ùʶ¿‘º¤úÅ…¤9C&äëäùi…‚ÚùàÄßÇÿ!B§%d\¿î¾:öÑÞSFáêTH×\Û®“5™¼ÌìNQâý?»5Óß7— £ø¡—ñqgm‘“¶-Q>Ò÷fÛ·¡P¼ž_Ê•–JøDºö £ãÄpâÜÜ‘O(É?òW†âÆïfòÈ¿'d?,ÿˆÍØáäÞLû*yžîu׹ё•M×7¤–©“{ÊÔU¿&ÙÌg9ÉÚ”Í_ÿI3ó ûôJö^÷+‰÷ú—…Œ‹ÃÆm …ÏïpcdèoHN¯oxÞ@6T¸q¶§_üc¾|†¿.ü“`®ò‹ýrËî*6‹Õ@±†šô%aàp¬Ù¦•m`Ø]¯s±™ìô´ŽÆWU´ÿ^„Å•o_†ëvÉ}Ék~ƒ£ãpõ;=îOccÎë?øQW³úw÷è¹i–9)„#¶ÜwØëmàP¶â oÌ¡’ É_¼Ü–{ð¼x†Yè‹WŒ‰Uù÷ý½,®ÞVvWü€‚ö£€ß/dX°ÊîSåãÕs¬t·2áZde‚’,ïÄ/~K¼­§´›µ )à·Üµ}Nl|6ìTÖ/eÛq§þ»ûEŽ’u úÏ9ïuPL\ab+0»?ÔÑ}BÇéTTn‹^Ûyœ#ÿázEk€Ü\]'8êžwøŒ×ù~õ…óCLœÈ!òõêùn}°å -oDý]ÉQpá†@À];ÕÓì|Vá7¨>†ÏjX_\ø„1±ÄÏ®áX‡ŠÚš…e»NóªÙ¡Ì¦¡ëbEÜÎ: ¾;UTnIÏn­ôç÷+8Ý­"/ÏY[ä¤mK§]ÌÔø5i¥kv(ëNì!ámX㘞úâón:ÈÁu ñU{{®AÈaÏË@cƒ¸¶åÇÈç:”g¤ÉÞ;þoæ_±äÝåNÆéê(S¸‘©Ó~ÅI?0_å”Iy {chxEÃü»K_cßêhkWÓ²O§}ðlô+‘{'®íG8|XÃÙ^Õ“ýƒÅ;A¸Á³IBËÎÚexgÀŸœ¦.“yvXýŸŠ›Ê63Û´’Q¶‘ÏEØIá½âÅ¡ø!`hˆ#/—aú¦ŽÒ’Ô Vݯ9ŽÕqpŸ‚`±:³Â}÷‹P§LßÔð+¦õ÷ê¹é–Yõ9+w¬ÞnÜÔÑyèÝöÁ³Ñ¯Dò/ZTnc»_â(ßìÍxd!°âg+âþ=nŒÓL×,ãóù MO›øþ4üK}‹s’Ðk&o˜4®7EÃkGoGÉCJܦùfi«ßRƒç9FGÃ{€@¬0ìþ‹}ײŤa*º? fÓþhC${ì:ÿÑÄÀ–*–õ÷ê¹éÜké6åŽÕ›Ï§ lPÿç ·l¹ýeq5ØýÑbÂò9@›V°µJÃéìø¯aVv§Þ ´ah?\þš¡õmކz yyâ~YݧÊÇ«çÈÐqT¬D(Ýü7«¯‚^ÕSÖÌt‘Šsâ¿ÅÅî—26îÖNK7½}_ —xã—^×mæt£‚ü•îi2:È˪·­ïE_À#{î$~íž±Ùð€Ù©,ä+KâDºI«æ%ä)ùzõ|·å‹}áþÃÖ'4Ông¦íPªvjì;[¢¾P]øîP±õ •Oˆ‰‹ªíŠíJŹ°Ý”m³Gyåç‹ ðcõšŽÝʾˆz5æHçÞÒÑ>pn¾/aÏ™èuéŽ_Ó±CŸpjnuYA8ò¹XALð‰ïÄdïSÕÉù·ÒÑzHÇ7Sg"šö3Ô7ß1¨>q`Li OÊ× ™{çÊÿÓíÛÝê¨ð`Ìḏ¯ü•öùÈÞë•Líú'ýÀ|•“,nå%(è84¿tŸ*¶8 §šô“íƒ3ݯ$\ ´¾íÝxd!pö‹³4K7ÇÞ“±¯ÇL| ù+ói’ÐîiIG˜¥…;ØØAÿQ„jÄÄL;æ3@SBø‚YZdP7p^l"ûü‹l&­á=}"Ô‘I´-º(ÙɃ­¤ e F: ³ð“Òëú»y®™Œ¥ïu2¸yH”±-…Þ*6#_†¿9\ -[î²Mb ¥ýà,”SVGÚˆÕ[ŸÐD8Ä–Ôv;QÝÖÎÐy\ÇØ×ØÂ¤uŸ*ŸL<ÇŒþ3âDºƒ-æ/?V/‚^ÕSÖRé"‘‰ Uòˆ·BY—²Sÿ­¡ó¸†=Àá·˜©^"!²~éuÝfÊrÎÝÍL““0}©»"VüâåªûP¸Z1•Íž—Dxzóëeé0_YÜ„×HÉ!Sòõèù^ú`å6Ñ_7íçÞÀ·Sù+ôž/Q›.ß ô¨(/Ó ß®¯Î;ÛµÅÃ¼ÆÆÄ §tíÖk¤Û6“6TöÞúß0tžÐ°ç ýÝ„C@®-9*¶),Oüê¥&ù„ {p¥ãŸÄáПt\PMë\¸¸0˜œ÷úR UÛÔî`IáŒE·¹4*Ng5ËÃŒT÷ΆÿËâ¤ow«£²Í õ&&ØÌ*Þ‰ `äsm羽ÜëF¦éö+výÀ|•“,éØh톧ªE6}SGÍvïÛîT}ð\ô+ß ¹-& ÖÐ,ÝS¶¹ õ-˜˜˜D^^ ìû“ù|mï4Ò$¡e#w—‚ÁóÀðˆx±/Zcž)Ùú_r4î ï#ò:‡þo÷Å7 YY÷)h>À0<"^*b&IÌÒf‰ëvŸÒÂF63©¡ä(ú“ŽÆ}rKÙF±ZÁJ °8ÏÑq<ùºê'ÅWÒæ×Òµ ££@ûï“'4_e¸¯OÃú_"®þnŸk&cÙ{elGã~†ÞûÊ} YoÍ- EEÁRŽºçDªM££ç€áϘå³eËÝüC Gó>ñŒÉbEYW·uþ²:Š›(|—E& »Å¾)VvWTÈQµ‰ý•nE¿ì—†;UYݧÊÇ«ç¤âÈû"tÁò”4+[ñ¨ž2ö`×Â.†Ã'j7ÅvíG¼e@×î&¸dm\ÆNÍü·`p¬]ÅÎg5Œ5O3üâÞîS½§ô™/­²~éuÝœ´²:X±‚£êI ô†¼å€öo ûC޳ÑwÏYÖWÿ‚ù jí.†Ýu‡Äd¹¬,æ+‹›U2rÈ”|ÝXÿ2ÃÖ ýçÊ79k§Ú~ǰ¾LCQPL å-eêü€Ù Ml^Ù®nóŠ­®gD'X½X ˜.²m›Y*{oÁ* í»ë4\jjKá/ÖC¿É^·’ãW/í0•Oèºs{p£ãòÇ8†>ãg%'jK€ð‰ÀrJle¿yË’ÿÖ´Ÿ£t-ƒ¢¹·äxþ9%é:³¾FæÞÙð³ëã'„\œôínuT· hOAùc‡Â+Göräæ*¨Ùe/SÙ{ÝÈÔ‹~Ū˜¯r€žSÉ“g‘´È>ŒéØhÅñ^Ûú¶ßRååúb3ûtÛg²_iÚÏáËŠ ”1Ûq\ì=zºwaïEIÌ/zN $øêÕ™´Êmea߯Bû{(¬‡^o û~3rsý¨ÙUµ°*ìÕéÆ2'Â^ø$þä*«´È}[B†™8 ªpuȸøgûg×7„ŒÂ{CI'I%¦Åž¤9%*–²GEy. Æ_ouºñÔ¿ÄIyŠ"~%ëBÆ7K®(d5»Äi¦v׆a\4ŒÂ{EÝýþQßJz¾ìsÍd,{¯Ýɾf\ŽžrÉ×ìd²ë× ãùç¢úUrÄ \‰'U'>ËI¹ÇÇ £êÉÐ̉¹~¿8)Í.Y™=/r:öé¬í®fWÈÈ_®³"l/öÔ0YݧÊÇ«çØé:rаã©=¬§Œ=صq'¦eO¾¥"¶wŒ¸Ó)Ýø‚¬§²S3ÿõ·È)9V=™|ª›Œ_ʶãNêæøtß:8ô¦8¡6"+%'d?2NvÅ·ßJNÈT‘“F%¹-H%K·ùJ.ï9dJ¾NŸïètN>˜t’ã½!WíÔW—Âú÷Eõ_±-d|sÙ0Nv‰<OZŸ/¶k&7y%"™=eäß²4hFÓþ¦Y™¸ÌÊÒÐøªâxo§¼»9j·#n2³4‚È4dw¤ ‚ ‚0ƒÿüü¿5zSÅž—IADjš4£z5 "tèBÉv†ìÛ©2W˜TAÌ…-¤ ‚ bq3ü™ØR€ÔáAA³I6‰€ ‚ Où)Åß—ˆˆÅɃkðûzSAp-Ƀ ‚ ˆùżœ$”9Úœ ‚ ˆùIÖÏ4êç ‚lŸ ‚ ˆ­$$‚ ÂS¾ú‚&B‚ ‚ b¡A“„AAxJÑ’AAA,4þ‹D@AAAA‹š$$‚ ‚ ‚ ‚ ˆEMAAAAÄ"'kjjÊUµßd¼ù@3I‹ ‚ ‚ ‚ ‚ nC\Ò´¿‰$FAAA1K4hFõþjDè:Ð…&’í nLAAAA‹š$$‚ ‚ ‚ ‚ ˆEMAAAAÄ"‡& ‚ ‚ ‚ ‚ b‘C“„AAAA±È¡IB‚ ‚ ‚ ‚ ‚XäÐ$!AAAAA,r<™$ÌÊÒд—§¼®ÿ0q%ušLNŠr fŸæUݼºo¾)½Ì™5à8²²4dei®íi6ëã$¯tŸë¦®™¶©ù\ÿÚg„-íyÉü™—FÊ'8Ô;9²–h(Èçèé£ÎÇK;ˆÕÙá·€ÒUò,ç¨{žCû!þÙë`òP¹…ƒÝ!~•[8&¯Í®ÿ¤ò¡Áó@Q¡¨‹ªr”o☘°—eìO½SÔËÎGSÙzZ}¶§soZrZ"äTZÂÑþ.Àyj¹Æþý~xD”;Ò6•Op Ì­Ÿ ÁbÆ„ŒªŸNß/fSg]Ek8‹úvùfŽK_¦ï³mÛM{E}#c»¾MVNå›E»‡ŸÌóá?Œ ½;µk§2M¼ž1ŽàZîYûÙNزª ù©ª°…Ë_SJAÈÓ´÷0Ê7Õ"(BVÖ 4í=|[×wVW>Z¦¡ã8O™æ½}€o©‚àZû´T\VQ÷sü|·÷Í2¥—¹¦§Ø÷[Mû.«¸8¬º¶§ùjé>×M]o'›rRÎîEQÐq¦/]­osør€“ g?Vá_l­Ð’^X ot¶ï· ­áâ Šæ×zû€¢ ›Ô‘½Žÿæû8ùÃÉƾ‚¥Üt’(SþcçCW€õe~à€Šc >˜øÎ>¿šÊL;ØöÃ¥¿Šúkš;[w‹S»½7m9ýYű÷Š =÷qLNÚË5öWº.zMÇûÀƒA ú-àØaƒ‡[ð“HŸ+†?ÖÿRƒ’œîUq²›aúàÁ‡ã'•æ«ÎÿxêWŠ×ý‡}{ŸèGFÒóÙ¶mÑÚ4P±Åþ:'rª©a˜žÖÑsÖ<¯îS€®ë¨ÝÁÛµ™Æ^ú#ñÌK5\K_þÓPºAÈþâŸU´µ3L\î ÊOÔADëÛЦ§Q±¥lQÔ7ûv­XOGÅæÔi©»{¾ÛûLù À’y*èù\6FGŨ¼îygu›MÛI—tŸë¦®·{Ûa79¥ÿ[GÛ;*vÿZCÿÊîm{‡A™‹.}ˆáçÿ­càžÒ~¼Òâš±ïÒ“eѽÉõwbënq"ãôîõFN—4ïcúTw¼â©õ=ŸOÁáó6 |?ÒŒ|”mBü‡%"-VžóUg7nèð/ÍŒ̶m;l åå´¨Ú üQOZÝ7yM´aµÛ½+™S™úr2kã>_øÿÜ¢—^‚ ‚Èè$aÇ `àGÛR§dåECq"a‰á ‰i3ŽGÁÏ€cá=E!0‰f/W½gDHTé#æieJNòKŽöƒ4Õì°~yO ³¸0¨Â·TAþJÅþeÿšXu01!êtá¿©¸4š0ÙzTìc¹.o™÷Н|‚cpH¬rº8,BS‚kýßH©«²zK„sœìd˜¼ ¬O§±{f¬õžá8ö¾µÞ/Š4Ÿ8û±ÿ8ÇEœ ‡UÔìPâô(#÷¹¶'²±žÌ¡V3÷&øg:~rixða º.V1œþˆA×EZ¤lv6%c;éÔ߉vxCŸê¨Ø&þ]ý$ÐÛ§Û†©õô[+8ŠRPýdz~*+{§˜ùÁä5  Hì•vøÍhh¤~Ëœñ“äO ~ž\e?1kvÝèßüU&Š«€±oíËâ¥~ì|¨l“(ïSUé…IN\ÿ ø™{[w¡['2NÄɽ^É)š_xbmDR;;±JKv…®‡þ’ ý–fÒ%±l`ìïó_gÅ«tžáÜf¡àn}`.lÛ™-:“SívÜ[Ä÷³¢ã­µ˸°;[™&ä;9 ì®çqþ剄ÿ6qØù,‡o©\LA‹ÏÂÕ±ÿKdÐð3ÜW¤aà Cí3ÑP³p³4%¸ð  )JbøÅ `ßAŽž˜m-zÿ?޲G0s¯YZÕ“@× ±2)v"òdEb9+·pàÐ?`ÿòÙô[E.FCAJK ò–=}Ñû}9ˆ õÉ#Ÿë¨AAõÓ±uI2eU¶öwYÜ`,øÃ/~¡aà,Cå6ùgâVj½·àð/UÐ?sÝ:†+ì¿R‹3æz´«Û\ÛŽÙXú§ÏÞ?Ó©k˱*æÂ'1¶½.¾lvþ/c;éÔ߉VtˆÈˆÍü·õmÝš‡³÷Ÿ{–mTľKKÒ÷SÙ;Å̪Ÿ¶zi˜Í¬À‹„Fº‘sÖÏäfhìÂ"eu¦iÀî9òïQPi¿°>‹wIDAT³¯—ÕuÓÓ:TŸbêS7nêˆ eK,‹—ú±ó¡‘ÑŽ}«cý/ãu 5~‘¯}†CQ”mvoëntëDƉ8¹7-9™—žD½ÁãžÓò†Ž–7’CCO÷ª¨Ü"V»åå*ÒÏqí/?Ùë|†_Ï_©˜®þ‰—ç|ÕÙ±N†òÇ8v>«Ïb&l¶þ†¢5î}`.lÛјΡœŠÖ]wç¨{>Z†îHZù(k×ndj–¯¢Çþ ¢`•G~p¯™‚þËé% ‚ 2:I˜žRT ü“»•mŠécw›ÅJTƒâsÀ±vf›V»¡ó¨†Áó ¥"ƒ#Ž’GreÜó2GïYUäåÙ_;p(Û ñ…>f€^²!ùKnR¨O:X¼ ?  ý(à÷‹ç¬r§çÈ3šß+ù®~?€‹ê_æ™2zü‹ØÄ;î:&îí<î Ï‰íØ¼¼Éú„kÿtY×Á¿ˆrľH—MÒvÒ©¿´ïY´Vúè<.&”"{&­rstˆ銰ûEŽ’u úÏ1Ïü4-Ù;ðƒÁóB†f!ºnÚ¸¯¾P=kß’tçbÅìô´ýd¼ìuNË’ ý$ÒÓì|Vá7¨>†ÏjX_PçøùÏ5ëP“öKz9Ïš‰í˜[÷L·“Žœ,íÆ"\±f‡bzxTÞ]îÊîV¦V“*‰é±ã¨ú„lö¼ 46„?Ìâù\‡¢ÌäW‡‡ÄêçîutŸÐqú#5þÓ¸m»fCÃ+&®0äÝ \úRL2¶µ«iÙµ™&æ«ë"b`gßñ“éÈ?rïÄU ýǃk8Û«Îih?A„§Ø¼³ÄœMZ]îùð'§©KÅWY»IÇþOÅ©le›™mZp­xÉé8ÁQºáò0úW'»ä!@ë!Ç:T©S,oÜÔÑy蓎ìÍÚ ËI ‹ç¸mã¼ 7¶²ÙÈÊÀ‘ÏÅÊ@«9e®+¼3Ù?pìk ¥}YfC?cß鍨Í«º ðÝ¡bë*Ÿô[@ÕvóUα/çÁbÀ`Øú„†ÚíÑ•ÃNmÝneel†ì½éÈÉŠsâ¿ÅO”/Ý N‹–=9Ü­¿$NèúÌÓiÚÏPßL|Ç ú€ÀrqøN¬,$ååÕÛ€Ö÷’'æe|`®l[·r €’Gtœš_ºO[’ÛS§8‘©ùùbïãX}y¹MEp-Ðú¶wáÞAsÍÙ/Î’ˆ:I˜¸î-ÓƒoΣá…üGžUZ’bÐ~hz•¥LD(eËA ½§:N$‡°š1qE¼TV<ªàð[òƒ‹ŠÍÀÈ—á/¡,ÿõ/S0š0ð4 _“ùê[° hkgè<®cìkla–z1C×Å’‰/ŽŽŸ)©÷Ò‡„Nã®ãÑ6/™mÛ±Ó—[ŸÈt]KåhKU6›rb;në/ë{fõ7ÕÇObߦÂÕæzÜó’Ÿn~=>Ý4Ì8M?••½l{aEÙ&1©¡ý`rì¤ó*lÏÔf~6ô'Tkû¼®l3CC½†‰ 6³5ÀÄ„Ø/²íÕ¶,žëÇćòW*è=#^ò#r/ß ô¨(/Ó ß®/'ïÊm"Ľi?ÇðæÊÖÝèVVÆéÜ륜"Ïh:(¶^°Z¥jEý Ç5ìi„©\ûÏÄŸp<a®ŒE·7¸4*N¼½0¨Î{MNÂtÒpì »Lqî˜;Û–%Û®ÝÁðTµ†=¯ˆ•Ï5Û½·5;™ZN|މ·™è7ñÁVöÐ8‚ ˆ…@Áš±0' óïR0x^l€­d‡7N6I‹”lý/9÷†÷ÄyCÿ·Žƒûâ YY÷)h>ÀÄÆÚ7tTÄ„'˜¥EÈ»[¼üìy…ãÆ µ;R@JËD8FÝ‹ây±mV4·0qK9ꞃEmå8 f?pŠ­' h=¤£ùu t-Ãè¨%’¥¨£j;{ÓÝŠ®) à,õb6Þ(ö,X ç9:Ž;¦¬Þ÷3Üw¿†ò2 >^Óú7µæD¹9DÎÛq"׿4êÚ¸Ÿ¡÷~ ë‰hÙ$—Í̦dm'úËøž]ýé9+BEë_0ŸXªÝŰ»NÃà‹û»å3²²O·½h~¡÷ GQ£yŸáä ±z®«›9nãd&EÝÚlùcCŸêhܧ@ÉAœ¯å-ÃÌfõ²×ÕíÚßSPþÇ¡ðŠ¹†½¹¹ jvÙ—Åký˜ùPÛïÖ—i( ŠUœyË…n:?à@¶@S#GG§œÝտ̰µBCÿ9q³S[w£[[ù‘ì½éÈiòFÔ>´›ÀÐGûQa']Ø_?™¨ª˜|;Ö®bç³ÆÆ€š§~q_÷)ŽÞSzÜj(/üÅ Mû9J×2( 0ü%Ðrãùç”8˜¯:[±‚£êI ôq½öo ûC޳ò“r±>P¢;Û¶ =§’'Ï"i‘ýÓ±íŠ-bÏÀÖ·uø–*(ßh]—TvíF¦‰ùê:0pFèë`Kü$žù7íçðåE… JŽ˜ í8.öØ<Ý;?÷˜$‚ æ=§úã«3i•ÛÊn¿ OMMSSSF*¾vÐòoÀ”Ñøj(eú…O #÷®LÀ”eZ侃-!ÿ,d {Ê(\2.þÙþÙõ !£ðÞør˜¥ÅÒÖ.òðûCRu‹”Óì—J&ׯÆóÏEë¤ä„ŒÂÕ!£q_ȱ,C!èÙ2|¾¡(!£d]ÈøæoÖ÷'R³+dä¯ —Cò=ÝkØêÊ*ï©FÅã¢veIõL'z¿0h…÷ŠküËBÆ¡7 £þ7Bvrk|5”¤+«ºÍ•íØååÔ'dm*ݺ^6Œ’uñ6ðÕ :3±)YÛI§þ2¾—ªþ±”=2”œ²¸<ô†¡(!£j{HªLÇOee/Û^Ø•q|Ü0ªž ¾¥¡[H¬£L—26kçg²þ˜(ƒññ°æˆ_Åã!ãú÷rm…—ú1ó!Ã0Œ¯.‰òù|á6Ñ2*¶…Œo.ÆÉ.‘Oýoäí1¥¨[[wC*Û•[ö^·ršùeO¾¥B?mï¦r±³+3ß­x<ìSáòT=2.ÁªÿKjã6Fe”¿RÔu¡èìЛ†QòH´RrBFñC!ãd—üØ5Ö¼ 9ÉŽÜØvl?c÷w'víT¦IùeOù÷„Œ¶volþd—a?– ¦ Ÿ/d”m  ‚ ˆÇÁ×ãô¿ŒüOÌu[þXþìî[¨¿¬©©)ÔŸ›4£iÓ¬L\feih|UIÚÓ+ywsÔnGÜþffiÄíIQ!‡o)0xÞ]/&ÛYì~BíéŒì‡ ‚ ‚˜¯4hFõþjDè:Ð…&’í Ù·Se&®0©4báSû GÙ&¢¥ÝŽáý«Ž Ÿ¨µ§Û•Åî'ÔNÎÈ~‚ ‚ ‚Xìd“ˆ…ÈôÀîçÅyŠ¢ p5pv@•>9 ‚ ‚ ‚ ‚ˆ2/' c7ì&3zú"+whAAAADºü‰€ ‚ ‚ ‚ ‚ 74IHAAAA‹š$$‚ ‚ ‚ ‚ ˆEMAAAAÄ"‡& ‚ ‚ ‚ ‚ b‘“555e€ªÚŸ(Ü| ™¤EAAAA·!ÙN.nÚßD#‚ ‚ ‚ ‚˜%š4£z5 "tèBÉv 7&‚ ‚ ‚ ‚ ˆEMAAAAÄ"‡& ‚ ‚ ‚ ‚ b‘C“„AAAA±È¡IB‚ ‚ ‚ ‚ ‚XäÐ$!AAAAA,rh’ ‚ ‚ ‚ ‚ 9žLfeihÚËS^ט¸’:Í &'E¹†?³O›ïdJ> ¹Œ™Ò£¬Ï% цç;²z¿4 T>Á¡ÞÉ‘µDCA>GOßííûM{9²²´yóœ¬,Íú·$ùþÁó@Q¡Ð—ªr”o☘ð^Þó¥íðº³aƒNÊœNýÌîµÊωݘ٥z'Gån+»Úg„ÍïyÉ{»™¼Tná`wˆ_åŽÉkæ×¦U×%¢®¥%íïœ;óÙÄösxD”;ÒÆ•Op ̹t}­á`,\öåå›9.}™¾­dº®fíqù&Ž@€§ô9Y9•oæPUüdžÿ`Œ£úiîØvœÊ4ñzÆ8‚k¹gãªþs@°XÔ7++,—Í—¿¦ñAÄBäð[(-©†ª!kÉ –Q÷|´4W×-fu%á£e:Žó”i^ÐÛø–*®µO›ïdJ> ¹Œ™ÒãÅauϱy-ë…h÷ ­osør€“ g?Vá_l­Ð’^“ïÏ6‡Õ¤ßÉÿQUÛ”¸k'®ëË4üÀ…Ç:|*0ñÉ{¡Úàl´ÑNí&BÍeÆ&ÛÞa¸ôW (È¡™Œ 9º?EAÇ XNœ¸ÿæû8ùÃÉƾ‚¥ŸårøwÀS¿ÒP¼èÿX”½yŸ°Ó‘‘ôl%Óu5ïëm¨Øâ¯ÔÔ0LOëè9kžW÷)@×uÔî`ŽmÇLc¯?ý‘x惥.¥/ÿi (Ý dñÏ*ÚÚ&®÷å'j ‚ ˆùþ߶ PÑÖÞŒ‹ƒ§ÑüZ=zûP¬éXe¯[dß®Êìéã¨Øœ:í¶á'KG¹3¥Ç`ñ´kbv|¢íUþ»ô!†Ÿÿ·ŽóEkÉ{ôi棽}¢ÓMœ<êép 8ý»C¤Un!=-df£vk7´|Áb ÿn†ûî×ÐÛÇP[“h³€þomï¨Øýk ýd(÷¨]o? \½ªcü*òîiE÷0¬ø:2Ô½èm]#÷Ô½Ý/V‚ žg¶×'rùk`g†ú‡ßŠÞP]ÅІÍk¹´¾ÍQ±MAû‘˜²¯jŸaiÛJ¦ëjçÑrù½î‰¯T> ø| :;¹é5]'8üË”–À‘í¸•ib¾E«~ñ g€‚üôä_]ñv,fX±BC×)†=/Q[N±¸þýWPïTcúø"®ÊÃ}÷oE÷‡¨­©ttÝBÀÓ•„íïyyáP¼Uƒç£‹„’µ¼¡Ç-óOL‹\Û´—£io8Üa‰†¢5ò¡üG`èO:*b"±i=§Ä3Ì–þ—oâ(XéJKD c"¬FvåPÝ‹ù¢ü솑ø•rr¨®ŠK®×¥’Ïž—£á —þ._ÞÈýÍ8ËÍõaâJ8ÄR׋ãõ`UF3¬ÊmÎb–ž¨[;ù9уÕóR1y ¨~:j§Gu÷ÔììZæù³m²õ‘ÉGV~v>!#£T퀸 Bü‹øoÞ2æ¹M8ñ+);•ÐÇà—‹„Ê5¿ÎçãÕsìô™8qØqȽËlu­Èwì»Ôò±“·lû‡ßÂŒÿ8é³dÊç¤OLeË2í‚LdûE'ý§ŒìÌÚh'ú‘AHÛE÷†}âŸÉöÝqœ#¥‚º¿_Aç ï¾.œá(~@™™€¼»âôôñŒÔòò€æ} CŸêŽåßú‡Ï§àp‹ù“¨™”Ë:üK3c+™¯ë,ùÊ j;0ðG=iußä51¶©Ýî]ÉœÊÔ—“Ù—-Ÿ/ünÑË6AÄB#vâ/Bþ=ùá~æ†ãëÕ$aÇ `àGÛЧdåECO. ¡%†$¦Í¼ä?Ž…CûXÿËä‰=³—†Þ3"Œ§ôó´²G%'y`®ý 05áp‡K£ÀƒkÐuñ¥ôôG º.Òd÷9ô–78ÙÉ0yXŸîQùÇàX¥tqX„k×ú¿‘R>—F…|.|¢"o™³òva0ÇÞ7×WdàVt¿Ø_&òœ€_„d\µÖ«íD²I¹¨[;ù9󫉗k@A‘Ø/éð›Ñð(ý–·v`Uw™çÏ…MÈÔG6'ú3³-Y¥j¿éé¶Vp?¤ úIïmÂÖ¯~’üA^—FEûª(ÀÙEáÀ9!'ùxõÙ¶¢ç,0}SGÝ®äÉ…²M"í©ªÔa|©Ú1ûë8ôžáQÿ±è³ÜèÏIŸ(cË2í‚•LdÛGm¬ì\ö³Npb7vL\ÿ øYÒDûЧ:*¶‰W? ôöéæÏra+£òW%g•¿ û63uæ'þkbkWîÁó+ÈdW~Ï3¹¯VÐyB„L[õnle6êšž¾É©v;n‰PûxÿΚj,c;®dšïä$°»žÇÙpºíuì½W€Ïrø–Æ‚ ˆ…Ëà§#á¾5Ï“ëæSSSÆÔÔ”‘Šƒ¯´ü0eä¯ Æ¢i_]éÇþ]ã«¡¤{ÍÒüþŠIýŸaø–†ŒŠm&÷ï‹O«Ø2*·O«Ù2üþøkµŠü®_ßóxÈð- ¡ÿK]Ž”üÇ0®_ùŸþ(¦üÙSFýoB¶²5“Onn¼¼”WV_5;„Œbó3 ÃÈ_/K³2ZÕŬÜV÷›¥'ê1•üdõप¶‡ Ÿ/dLý+óv`Vw™çÏ™M¤¨l>Òò³°-ÉÖ=ÂÙñ·²Éå÷Ô&lüBæwO }T<²lscóJÙ^yõ }&RòHÈ@ö”©¼ýA”˜2 W'ëJ¦½q¢+'}–cýIæ/kËNÚ…¤6Xò^'ÏpÔß¿ò¬}7Ksj7qùüG”aü†Q².d(Jhf<13ÎxS\ÿÍå°~¾ÿnk7¼óõ†dÕ7_ñ¬®ò¦Œƒ-!©:œî×(Šy™íÊ0ŸäòÍeÃȽ+4ó\ÿ²Qµ=d|õEz¶2uMGßnì'eÈ(\JJ+~ÀY_±¯dª(æý½ù›Ýë_2.AiqðµƒÆ8ý/#ÿs]ãR¿©©¯ŒÜ\¿‘O®'×ÍÇŸg{–mŠÿ \Tþš÷OŽØ½9œäÇbncw›ÅjªX CMúr7p8ÖÎlÓj·3tÕ0xž¡tƒHë>ÁQòˆ‚@ <óûñÌÈ^+vå0û‚ØüGÇ àêwñ{ºŒEeRü€‚ö£€ß/ê\°Ê¼–WF_瀲ÍSâ¿”–lHþìÖNa¢Ç”ò“Ôƒ«/ç…|Ô;gÁLê.óü¹²‰Tõ‘¶-ú3õ 9l¿v¿ÈQ²NAÿ9–Q›°â«/TǶšJ3vbÒæv—ÏÇ«çÈ´“×"+²”$y÷ô;ŸÕpèMªaç³Ö—>a`LñóŸk8Ö¡ÚïæÐþdú,7ús’¿Œ-§Ó·ÉÞë´í‘©›×¾”´25 »iyCGËÑ2(9 .|ÂfÆ:säߣÌì{V´ÈÍUÐu‚£îy扭dº®Vp‹PÊšŠé3yw¹+û|“KA>0q…apˆapH¬$ïþPG÷ §?RQ¹Í­dº®sa?5;^Ñ0q…!ïnàÒ—ÀØ·:ÚÚÕ´lljLóÕu±’ygß**·x#ÿȽWö#>¬ál¯êÙþ£A‰c¢8–H2çåíÄôô4úúÓ¾n¾âÙ$¡¢XüÁåþršº˜žÖmþýŸŠÒÊ63Û´àZ10ï8ÁQºáò0úW'»¢‚é›:~ÅU9ê~Íq䨎ƒû‹Õ™ýHî»_„_Í”­—¡é·-‡8^Ñá÷+¨oH½±±êKNsR^}ݸ©£ó(ÐyÔjãjçlfå–ÅT·)ä'«7ܰw&ìÀ¬î2ÏŸ+›HUÙ|œèÏ̶ddä´ýºúŽêmJÆmŠÈ^KŽ|'…>ììÄI>^=G¦­h?>°Ä$Ôxß^޲ ö¼ÌÂ/Œ*žú•†­âôÑ‘Ïc&Ô<Ò•lŸåFNò—±åtú6Ù{<ÃmïuûžŽÝD&ô[Àè—â´ßö£ÁµÑòG&D_UâÂ3Ë6GÞÓg&NÒ±ŸO6œ®Mþ¥Šç>×þý3¢ÏäƒKŠÖXßç÷+3á¡2ÌW¹”–¥%⾉ †àÃûösTncŽme6êšnåT½hxEìËÙü:§§gUOZ·{v¶ãF¦fù×2Œ‰zŬⶽ¢ù­*·1‹Ý/q”o¦´‚ðž?[÷ïqcœ„’‰ ²ýß1\<‰‚ü¼´®›Ïüÿ|'œ+n'6)IEND®B`‚astropy-0.3/docs/vo/images/client_predict_search_t.png0000644000175000017500000006755212243255342021405 0ustar oleole‰PNG  IHDR,dóò¥(sBIT|dˆ pHYsaa¨?§i IDATxœìÝ{|uãÇñ÷õݰÍa6r*ÚbæL ·Ã²iK£2BÉ)Š(ŠÜ™;ŠºCNw‘›DÉ&JS3:È)g¢rÌaƶë÷Çî}æ»9ìt}÷Ýëùx|ù^×çºöÞá¾ííó¹®Ë0MÓ8!›Õ +N‹ÂÀiQX8- §Eaà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,܆V­ZÉfã¯OÈ/ü?.·É0 «#@¡Aaà´(,œ…œÜ÷߯®]»êÎ;ïT±bÅäëë«-X° øE‹©yóæòöö–———êÖ­«7ß|SIIIçôóó“¿¿¿.]º¤aÆ©J•*òððP@@€þùÏf™eË–-êÒ¥‹*T¨ bÅŠ©J•*zî¹çtüøq‡±»wïV·nÝT©R%)RDÅ‹W`` zôè¡Ó§O;Œ_¸p¡BBBTºtiyzzªV­Z?~¼®\¹â0vÉ’% —ŸŸŸŠ+¦%J(88XS§NUjjªÃøÈÈHÙl6íß¿_“&MRݺuååå¥û˜Ó§OëÕW_U:uT¼xqyzzªN:2dˆ.]ºäpΔ”M˜0AòððP•*U4|øðLó²Ï0MÓ´: s3gÎT¿~ýT¤HuèÐAºpႾýö[•*UJëׯ—$½üòËš4i’Ê•+§.]º¨xñâZµj•~ýõW5oÞ\_}õ•Š)b?¯¿¿¿®^½*|X 6TË–-U´hQýòË/Љ‰ÑŽ;T¥JIiÝoܸQ]ºtQ\\œÂÂÂT¼xq­X±B¿þú«ž~úiÍ;77  p3NiÇŽ¦»»»Y¾|ysçÎûOœ8aš¦i~óÍ7¦afµjÕÌ¿þú˾?99ÙìСƒi†9~üø ÇÞ}÷ݦaf—.]Ì””ûöS§N™åÊ•3½½½Í«W¯Ú·ïÞ½Û,R¤ˆY¿~}óäÉ“εyóf³X±bfXX˜}ÛÔ©SMÃ0Ì>øÀ!wRR’yùòeûû9s昆a˜=zô0“““3ŒŽŽ6 Ã0§L™’aûÑ£GΛššjöîÝÛ4 ÃŒ‹‹Ë°¯G¦a¦ŸŸŸùÇ8Û¤IÓ0 3::Úaß¹sç2ämÙ²¥i†Ù¬Y3óâÅ‹öí—/_6k×®mº¹¹™Çw8 {XNêý÷ßWJJŠÞxã Õ¨QÃaùòå%IsæÌ‘$7NeË–µïwssÓôéÓe³Ùôá‡:o†¦Nšá½¾¾¾êСƒþþûoíÙ³'C–ääd½ýöÛ*S¦L†ó4iÒDaaaZ±b….\¸ IöeQ™ÝM«hÑ¢*V¬˜ýýÔ©SU¼xqMŸ>]nnnÆ2D•*Ur˜1¹óÎ;3ý|,IZ·nÃ~I9r¤Ê•+—aÛÖ­[§¦M›êÅ_t8¦T©Rò¦{ë­·äååe_¬X1uëÖM©©©JHHÈôãnŸû͇¬'Ã0Ô¶mÛŽÛ¶m› ÃÐ<à°ï®»îR@@€öìÙ£¿ÿþ[¥J•²ï«P¡‚*UªäpLÅŠ%IgΜ±oûî»ï$¥¯¿þÚá˜ßÿ]©©©Ú³g‚‚‚Ô±cG3F PLLŒZ·n­&Mš¨víÚŽ»té’~üñGU¨PA“&MÊôó³ÙlÚµkW†m§NÒ¤I“ôÅ_hÿþýט;v,Ós5iÒÄa[\\œ$Ýôë|-Ã0Ô¨Q#‡í*T”ñkÈ 8©³gÏJR†Y“Ìœ;wNRÚìHfÒgDÎ;—¡°d6k É>ã’’’bßvêÔ)IÒĉ³Ìa†.^¼(IªZµª¾ýö[7N+W®Ô¢E‹$I•+WÖðáÃÕ¿Iÿÿ‹ý‰'4nܸž;ÝÙ³gÕ¨Q#>þ–Î;kÖ,·k¿ÎçÃ5,च4i"Ó4µzõêŽ ’išŠ‰‰qØwìØ1íÞ½[þþþfW²›eãÆ·}¬ÍfSPP†®… J’>ÿüsIR‰%T»vmýòË/·¼Œ*ýÚš°°0‡}±±±·/}™ØÍ¾ÎkPXÀIõë×OîîîzõÕWµ{÷n‡ý'Nœ”vK`IŠŠŠÊ0K’’¢AƒÉ4M=óÌ39Ê2`À)RDC† Ñ‘#Gö§¦¦jË–-ö÷ ö¥j×J_~uílÏСCuåÊ=óÌ3JLLt8æÒ¥Kúé§ŸìïÓ¯±¹¾ íܹS¯¿þúm~fi…¯iÓ¦úöÛo5eʇýçÎËr‰ ï±$ œTÍš5õÞ{ïé¹çžSƒ Ô¡CU«VM/^T\\œ¼¼¼£&Mšhøðázë­·T§NuéÒE^^^Z½zµvìØ¡æÍ›kذa9ʨٳg«W¯^ªQ£†Úµk§jÕª)%%EÐÆåëë«_ýU’4þ|͘1C-[¶T­Zµäåå¥ýû÷kéÒ¥òðð°ßÍK’zöì©­[·ê½÷ÞÓ=÷Ü£víÚ©bÅŠºxñ¢vîÜ©M›6éé§ŸÖ{ï½g?eÊõïß_±±±ªZµª<¨¥K—ª]»vúôÓOoûóûè£ÔªU+ :T ,P‹-T¤HíÞ½Ûþ|—ôç°H’É#Ì ßPXÀ‰õîÝ[uêÔQtt´6lØ ¥K—ªtéÒjРúôéc7qâDÝ{z6mšæÏŸ¯«W¯ªZµj?~¼^|ñÅ ]”2¿Ýðµû2Ûß½{wÕ¯__“'OVll¬–/_.777Ý}÷ÝjÛ¶­ºuëfa/V›6mRRR’Ê—/¯°°09RõêÕËpîiÓ¦©M›6ú÷¿ÿ­+VèôéÓ*^¼¸ªU«¦~ýúe˜!òóóÓ† 4bÄ­\¹R¦iªfÍšš2eŠzè¡L KVŸÓµçLHHÐ[o½¥eË–iÚ´i²Ùl P¿~ýtÇwÜÒ¹nöq·'ÝpZ\Ã’ ëÖ­SDD„î¹ç-ZT>>>jÓ¦¾ýöÛ ã"##e³Ù^µjÕ²(9P°°$,fΜ©¿þúKÆ SíÚµuîÜ9MžH/n…%—œ;wNñññª]»v†í‰‰‰*_¾¼ÜÝÝU¹re 8ð–Žv\Ã’Kú÷ï¯ÄÄD½úê«ömÁÁÁjܸ±êÕ«'Ã0´aÃMœ8Qëׯ×?ü âÅ‹gz®“'OjíÚµòóóãz€*11QÔÃ?¬²eËZ§à2‘c£F2 Ã0§OŸ~Ó±«V­2 Ã0§L™’å˜>úȔċ/^¼xñâÅË^}ôQnþêYè0Ã’CcÇŽÕøñã5aÂ=ÿüó7ß¶m[ùøøhË–-YŽñ÷÷—”öäåš5kæZVä®^xAS¦L±:²À÷Çùñ=r~|œß#ç¶sçN=ùä“ößí=–;v¬ý5bĈ[>μÉø’¤š5k*(((G‘wJ—.Í÷ljñýq~|œß#çÇ÷¨`HÿÝÙÃE÷Ùôúë¯kìØ±5j”^{íµ[>nÅŠ:{ö¬š4i’‡é×À K6LžúH5kÖ´8 «ô§ø2Óò…ÅÔ¬Y“ ¹à’¸è€Ó¢°pZN‹ÂÀiQX8- àäüüüäïïou KPXàRÆ/›Í&›Í¦={öäø|ÎR ð:€%(,p¦ijÖ¬Yö÷×þ9'( Ö¡°Àe|ùå—:tè"##U¦LÍ›7OW¯^µ:r€Â‚š7ož<˜é¾ƒjÞ¼yùèfΜ)IêÛ·¯ºw﮿þúKË–-ËtìÑ£G5hÐ ÈÓÓS%J”Ppp°F%IÚ°aƒl6›>¬ƒÚ—™Ùl6õìÙS’ìÛÓß_¯U«V²Ù2þOìêÕ«š}Z§OŸÎñ¹kÔ¨!//¯lŸ~±½›››ž~úiûöž={jðàÁš9s¦&L˜ IZ±b…:¤nݺ9”I*_¾|¶sÜŠ¢E‹:”I*Y²¤žyæ 4HñññúÇ?þ‘§9 ‹ Ûµk—‚ƒƒsõœñññ’¤G}4×ιuëVeûø˜˜íß¿_<òˆ*V¬hßÞ½{w 6LsçÎÕ믿.777ÅÅÅI’Ú¶m›ãÜÙµcÇMš4I7nÔ‰'tùòå û;fQ2çCaqa5jÔÐÖ­[så\¿ÿþ»ÆŽ›a†¥R¥J¹rî5jäèøôëTzôè‘a»¯¯¯Ú·o¯¥K—jÅŠ ÓÙ³g%)ÓYŽü§x@©©©jݺµÂÂÂTªT)Ùl6mÛ¶MË—/WRR’%Ùœ…Å…yyyåhæ"ÝÁƒõÒK/iñâÅòóóÓƒ>è4×°\{'°ˆˆEDDd:nÆŒ SéÒ¥%I'OžÌñÇN¿˜iš™î¿~æD’Þxã ]¹rEß}÷5j”aß;ï¼£åË—ç8€+¡°à†2»À>³ ñ­’þ¬•† ªAƒ™ŽY¶l™¾üòK9rDMš4‘$­^½Zݺu»éùÝÜÜ”šššé>Ii³O×»té’vìØá°}Ïž=ªP¡‚CY‘¤ØØØ›æ(l(,¸¡¯¿þ:ÓR’^Z¾þúkK ËÌ™3e†Þ{ï=5lØ0Ó1eË–Õĉ5kÖ,5J~~~Z¸p¡:vì¨N:e{âÄ U¨PÁþ¾L™2úõ×_•œœ,w÷Œÿs)Y²¤jÖ¬©7jß¾}ªZµª}߈#tñâE‡ÛW¬XQß~û­víÚ•a)Üÿû_}þùçÙþ:¸* nèúëB®åççgiYÙ°aƒöîÝ«zõêeYV$é™gžÑĉ5{ölEEEiñâÅz衇ԥK…„„¨Q£F2MS?ÿü³bbb2,å U||¼Ú¶m«fÍšÉÍÍM 4Pûöí%I/¿ü²"##Õ´iSuíÚUžžžZ¿~½.^¼¨úõëëÇÌeРAÚ´i“š5k¦Ç\>>>Úºu«bbbôØceù K€ÂŠÂ‚kÖ¬Y2 C½{÷¾á¸ªU«*$$D6lÐêÕ«Õ®];mß¾]'NÔêÕ«õÍ7ߨX±b ÔÈ‘#3;jÔ(={V+V¬Pll¬RSSÕ£G{ayúé§•ššªèèh͘1C¾¾¾zì±Ç4~üxuîÜÙa†¥sçÎúä“O4qâDÍ™3G^^^jܸ±¾üòK>|8ÓkXnô`JWg˜Y]1 Ë$$$(88ø¦·û½Õq@^âç€Ìñwdî°Y²Baà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,œ…€Ó¢°pZ¸´ƒÊf³©gÏžVG@6PXP`Ùl¶¾æÏŸ/Ã0$Éþßt‘‘‘²Ùl:|ø°Ñp‹Ü­ä„aŠŠŠÊt_ƒ tçwj×®]òööÎôX87 ¼Ñ£GßpõêÕ3Ýnš¦LÓÌ‹HÈ%, ƒKËì–ôåb’äïïo_BæïïoULd ×.ÿŠŠŠÒ²eËôã?ê…^PéÒ¥%Éþ_8 4Ó45vìX‡¥]þþþêÑ£G¦ÇDEEéÀöÂR¥J•üˆ €l °¸¸ãÇÓ^YñðjÕºñ9~ýUº|9ëý+¦½²’˜(íÜ™½coÅØ±c¶µjÕ*Ë€‚ƒÂââ>ø@Êä÷y»Zµ¤;n|Žðð´Ò’•¨(i̘¬÷ïß/gïØ›1 C)))Ù?œ…ÅÅ=û¬Ô¡CÖû=Ãr#÷Ü#mÝš½cP¸QX\\n,¹ºÙ’±›ñô”‚‚rvNÜÖ…’›››$ñ'GaA¡T¦LIÒ±cÇ,N€aI ¥ÐÐPEGG«wïÞêØ±£<==åãã£þýû[ ×`†…ÒC=¤É“'K’&Ož¬Ñ£GÛßÀy0Â+55õ¦cüüü²7dÈ 2$·c 1ÃÀiQX8- §Eaà´(,œ…€Ó¢°pZN‹ÂÀiQX8- §Eaà´(,Ù°nÝ:EDDèž{îQÑ¢Eåãã£6mÚèÛo¿u› ÐÐP•,YR>>>êܹ³8`Aj à¡°dÃÌ™3uâÄ 6L_}õ•æÏŸ¯ÄÄD…„„(66Ö>n×®]jÕª•’““µxñbÍž=[{öìQóæÍuòäI ?ä5›Í¦ ÛÆŒ#›Í¦¯¿þÚ¢T·'=ïÆ­Ž 1w«DÓ¦MS¹rå2l{衇T­Z5M˜0Áþ‹êèÑ£åéé©•+WªD‰’¤àà`(::Z'NÌ÷ì®Äf³9¼÷ññQýúõÕ§OuíÚÕ¢di ÃpxŸþÊ.›Í¦–-[f(Æ®ŒÂ’ ×—I*V¬˜uôèQIRrr²V®\©ÈÈH{Y‘¤*Uª($$DŸ}ö…%†¡¨¨(IRjjªöîÝ«¥K—*&&F[·nÕ[o½eqÂÿ7`ÀEDD¨råÊ9:ON @ACaÉ%çÎS||¼BCC%IûöíÓåË—U¯^=‡±uëÖÕºuëtåÊ-Z4¿£f‹išº|ù²<<<œîæÑ£Ggx¿yófµhÑBÿú׿4`ÀU©RÅ¢d•)SFeÊ”±:@Â5,¹¤ÿþJLLÔ«¯¾*I:uê”$É×××a¬¯¯¯LÓÔ™3gò5cv˜¦©éÓ§ëž*Uäåå¥ eËjܸqJNN¶:Z–š6mªºuë*55Uñññ’2^?òᇪQ£F*^¼¸üýýíÇ]ºtIo¾ù¦4h %J¨dÉ’jÚ´©>ùä“L?Ε+Wôú믫jÕªòððÐ=÷Ü£W^yE‰‰‰™Ž¿Ñ5!»víR¯^½äçç'y{{«iÓ¦š:uª$iîܹö%p6lÍf³¿ÆŽ›á\[¶lQ—.]T¡B+VLUªTÑsÏ=§ãÇgškëÖ­zä‘GT²dIy{{ëÁÔ¦M›nòUḚ̀ä‚×^{M ,дiÓtï½÷æÚy_xá•.]:öˆˆEDDdûœЮ]»t÷Ýw«V­Z7?aÂ5JOI'éûÓ§õú˜1:rø°fΚ•íùÅ4Í ïß|óM}óÍ7 W›6mtúôiIÒÙ³gõÀhûöíjÖ¬™ú÷ï/Ó4µjÕ*uëÖM;vìÐ믿žá¼?þ¸>ÿüsU«VMTRR’æÍ›§íÛ·ßVÆU«V)<<\W¯^Õ#<¢îÝ»+))Ißÿ½¦M›¦ÁƒëÞ{ïUTT”ÆŽ+???EFFÚoÕª•ýϳgÏVß¾}åíí­°°0UªTIûöíÓܹsµbÅ ÅÅÅeX’¶yóf…††*99Y:uRµjÕ´mÛ6…††ªeË–·õyP˜-\¸P .̰íìÙ³¥q1&rd̘1¦aæ›o¾™aû®]»LÃ0Ì÷ßßᘗ^zÉ´ÙlfRRR¦çܺu«)Éܺuë ?ö­Ž3MÓ<þ¼Ù¥S'S’ýÒ¢…yüøñSÒËË*™æ5¯©’i†yàÀ~ÌÔÔT366Ö|ï½÷ÌU«V™W¯^½iÎÛa†i³Ù¶oÞ¼Ù´Ùl¦›››yèÐ!Ó4M3**Ê4 Ã,]º´¹{÷n‡czôèa†aΘ1#Ãöääd³cÇŽ¦Íf3·mÛfßþñÇ›†a˜-Z´Èð}<}ú´h†a†„„d8Wz†¯¿þÚ¾í¯¿þ2K•*ezyy™›6mrÈuâÄ ‡Ïùúó¦Û½{·Y¤H³~ýúæÉ“'¾&ÅŠ3ÃÂÂìÛRSSÍÀÀ@Óf³™+W®Ì0~Ú´iö¯ïµy3s;?‡&ü™;X–cÇŽµ¿FŒ‘a_ÕªUåé驟~úÉḟþYùzýʳ}úhíòåúPÒaIK$íÚ¼YÃÂf!ÒýòË/:é’ž¼nû“J›aˆ‹‹ËòãýñÇj¤ ìß_íÚµSÍ€íÞ½;—>£4¦ijìØ±3fŒF­îÝ»ë”6Cuýõ+ýúõSõêÕ3l;uê”>úè#5oÞ\}úôɰÏÍÍM&LišZ°`}ûœ9s$I“&MÊð}ôññÉ0s3óæÍÓùóç5dÈýãÿpØ_¾|ù[>×û￯ääd½ýöÛ×Ê4iÒDaaaZ±b….\¸ )mveÏž=zøá‡Õ®]» ãû÷ï¯Zµjeù³_X–M¯¿þºÆŽ«Q£Féµ×^sØïîî®G}TK—.Õ[o½e¿SØáÇ«_|1ß²?~\Ÿ,Z¤wLS½þ·­²¤bÉÉztËÅÇÇ«Q£FÇ¥_sPÒµ Ý]·?3‘O=¥£¿ü¢õ’BLS ’ž:rD}T¿ìÚåpKâœH¿†Ã0 ùøø¨iÓ¦zæ™gÔ­[7‡±Mš4qØöÃ?(55UW¯^Õ˜1cö§¦¦JJ»Î$]BB‚¼¼¼Ô¸qc‡ñ·³”*½ôµmÛö–ÉÊwß}')íÁ¦™=ëå÷ß·ßIíÞ{ïUBB ó¶hÑB¿þúkŽs¦—Òs IDATä…%&Ož¬¨¨(=òÈ#j×®ÃLÃý÷ß/)íéF©}ûö1b„5zôh•+W._ ËÁƒ•jšjqÝöô_Sûí·L KõêÕuƹm›ê¤¤(@ÒqIm6ÝU®œ}&#³·fÝ:Í—”>"XÒ¿SRÔrï^}óÍ7jÑâú4Ùc†RRRny¼···Ã¶ô$ÄÅÅe9kd†.^¼hîܹ,g?nTä®—¾¶µlÙ²·|LVÒ?Ý.Û0 û ˹sç$e÷v>€¼BaɆ•+WÊ0 ­Y³Fk֬ɰïÚ_ µaýüòËêÒ¥‹ÜÝÝÕºukEGGçëímýüüd3 m4MÕ½f{ú¿ÁW«V-Ëcç}ü±B[µRàñãò/RD‡““U²D ­ZºTîî™ÿø¤ßªþuÛüï¿ÇŽËÖç‘WÒKÌСC}ËǤÿ½ô ùoEúMNž<é°Tívy{{Ë0 ;w.ón4^Ê:ïí|y…kX²!66V)))JMMux]ÿ¯ýAAAZ·n.\¸ ³gÏêÓO?Íp+ÝüP±bE=ѵ«Fº¹éCIG”v K_ww5½ï>5lØ0Ëc«W¯®]¿ý¦9sçªË!zgútí?t(Ó¥UéU¬H­¸nûçÿûoýú×WkÝwß}YÞn8+ÁÁÁºté’¶lÙâ°oÆ ·|žô¯ãêÕ«oi¼aY^WÒ¤I™¦yËŸGpp°¤¬óf¶¬ ¿QX ‰fÎÔÃ=¦Þ’ªH —T£iS-]¾ü¦‚ôòòR=ôÏþSýúõs¸Õòõ|}}õl¿~czMÒ&IÑ’ú¹¹©C»v·t;åütÇw¨{÷îŠ×?ÿùÏLÇ?~\‡¶¿ïÙ³§$iذaJJJ²o?}út¦×4e¥G*Uª”Þ~ûmmÞ¼Ùaÿ‰'2¼/S¦L–ÏS0`€Š)¢!C†èÈ‘#ûSSS3¬¦M›*00Pk×®ÕªU«2Œ6mšvîÜét …K ‰%Jhñ§ŸÞösX²+::ZE‹ÕÛÓ¦éË—UÔÝ]ÝŸ|Rï¼ûnž}Ìœ˜6mšöîÝ«‘#Gê£>RHHˆ¼½½uêÔ)mß¾]?üðƒ>þøcû]Ç"""´hÑ"}þùçªS§Ž:tè «W¯êÓO?UãÆµwïÞ[ú¸eʔт Ô¥KµhÑBmÛ¶U:u”””¤„„=z4ùBCCõÉ'Ÿ(<<\uëÖ•ÍfSË–-Õ¼ysjöìÙêÕ«—jÔ¨¡víÚ©ZµjJIIÑ´qãFùúúf¸þÃ?Ôƒ>¨°°0uêÔIU«VÕöíÛ£GyÄaÉ#À9œ9sFK–,Ñ_ý¥F©uëÖ¹zCÀ™PX ÿ|Y’V¤HMš4IQQQ:räˆ*V¬xÓ™™¼dÆ g J–,©¯¿þZ3fÌЂ 4þ|]¼xQ¾¾¾ª]»¶Þxã µnÝ:Ã1‹/Öĉ5wî\MŸ>]•*UR¯^½ôÚk¯ÉÃÃã–3´mÛÖ>»³~ýz­Y³FÅ‹W:u4dÈ c§N*Ã0´~ýz}öÙg2MSQQQjÞ¼¹$©{÷îª_¿¾&Ož¬ØØX-_¾\nnnºûî»Õ¶m[‡;§5mÚT›6mÒ«¯¾j_–vÿý÷ë믿֚5k´víÚ[ûòÍš5kÞ¹³UÊfÓ™”5½ï>­Z³ÆÒ¿k¼b˜ø@üPºï>ÉÃCÚº•²\Â`‘Å‹¥Þ½¥'Ÿ”ââ¤êÕ­N8–„X¤S'iåJ©];«“΋‹¸»SV€›¡°pZN‹Â‡Ö¬‘®\±:PpQXò@R’Ô¿¿Ô¦ O¬r‚»„ä²ýûÓùË/ÒûïKO=eu" à¢°ä¢Ï>“zö”Ê”‘¾ûN ²:P°±$ \¹" ’öl•ÐP)!²äfXrÁ³ÏJ,½óŽ4`€dV'\… ¼ü²Ô¯ŸÔ¸±ÕI×BaÈ5jXpM\ÃÀiQX8- À-HI‘6n´:PøPXnâøñ´[?ø tì˜Õi€Â…Âp11Ò½÷J»vIk×JwÞiu" p¡°d"%E7.mf¥Niûv©U+«S…·5¸ÎŸJÝ»Kë×KQQÒ¨Q’››Õ©€Â‰ÂpË—Óþxé’ôå—i3,¬Ca¸†‡‡-5m*Uªdu€ëtébué¸è€Ó¢°pZPèœ9#íÝku ·‚ •~‚‚¤§Ÿ–LÓê4n†Â Ó”¦M“š5“î¸CZ¸P2 «S¸ pyçÎI]»JJýúIß|#ùùY À­à¶ÆÀ¥mß.…‡§=½~É©sg«¸̰—µe‹tÿýRÉ’RBe(ˆ(,ÀeKãÇK›7KU«Z@v°$ ¸,wwéÅ­N '˜aà´(,œ…h¿ý&]¹bu y… ¬?–4¢£­N ¯PX@“˜(=û¬ôä“R§NÒ AV'W¸K(PöîM{äîÝÒÌ™Ò3ÏH†au*y…P`,^œöl•K—¤¸8©woÊ àê(, @˜4Izüq©m[)>^ª_ßêDòKÂ@о½T¢„ôÜs̪… …5k¦½., à´(,œ…8¬NÀÙPX€å’“¥#¤êÕ¥´: gÂE÷ÀRÇŽIO\jÔHúä©J«Sp–<6pàÀ ï›5k¦{ï½Wí۷׬Y³4xðà,}á…Tºté Û"""‘'YÈŽ³g¥^½¤Ï>“^|QzóMfVPø,\¸P .̰íìÙ³¥q- ´mÛV>>>Ú²eË ÇM™2EAAAù” €ÛwèPÚÃÏœ‘–-“{ÌêD€52ûGå„„[”Èup ‹E¸à î¼SjÛVJH ¬Ḛ̀X`ÅŠ:{ö¬š4iburÄÝ]š6Íê\…%V¯^­‹/êüùó’¤;vhÉ’%’¤víÚéÏ?ÿTŸ>}®€€™¦©7jÒ¤IªS§Žz÷îme|ÀéQXràùçŸ×¡C‡$I†ahñâÅZ¼x± ÃÐTªT)yyyiüøñ:~ü¸ ߟŸ¨W^y…§Ý7AaÉÜt̲eËò! yç©hÑ´ä7.ºYÚ±#í¹*£FY@aEa™š7/­¬¸¹¥=g¬@a\º”VP"#¥'ž¾ÿ^ªQÃêT +®av»wK]ºHûöIs椕°3,@’´j•Ô°¡tõjÚ¬ e€3 °IÒ=÷H]»JññR:V§€4, ’¤š5¥Y³¬N1ÃÀiQX8- …ÈÅ‹V'€ÛCa X¾\òó“¾ùÆê$pë(,¸¸«W¥—^’¤fͤڵ­N·Ž»„àÂŽI»Uñ?Hÿú—ô ’aX n…µzµôÔS’——´i“tÿýV'€ÛÇ’0\PT”Ô¶mZIÙ¶² à¢°à‚Ê”‘&N”>ÿ<íÏPP±$ 4hÕ w0ÃÀiQX8- TR’Õ ïQX(`RS¥ ¤  éüy«Ó@Þ¢°P€œ<)µk'%uîœöŒpeÜ% €âÛoÓžZŸ””öPȇ¶:ä=fXpr¦)EGK-[Jþþi‚¤¬(,(,8±óç¥Ç“† “^|QЉ‘îºËêT\~IØ‘#G¯ßÿ]’T©R%5lØP•+W¶87çá!ÙlÒŠRûöV§€üç’…%))IsæÌÑŒ3´}ûöLÇÔ«WO}úôÑ3Ï<#|NÀ­)RDZ¶Ìê`—[¶hÑ"襗^R@@€Þÿ}mÚ´I»wïÖîÝ»µiÓ&½ÿþû Ôˆ# E‹Y@&\n†eÀ€zùå—Õ·o_•*UÊa@@€š5k¦gŸ}Vÿý·fΜ©Aƒ©k×®¤p#.WX~ûí7y{{ßÒØR¥JéÅ_TïÞ½ó8Y3Í´‡Aº¹YœË- »Õ²’ÓcÈ çÏKÒK/Yœ“Ë–k%&&êܹs¶Í›7OÇ×W_}eQ*Òüô“Ô°¡ôÅÒý÷[œ“K–®]»êå—_¶¿ŽŽVÏž=­‡~XË—/·0 °2MiÖ,é¾ûÒn[Ÿö{€#—., jݺµýý»ï¾«§žzJÿý·ºvíªI“&Y˜P]¼(õè!õé#=õ”'U¯nu*p^.]XþøãÝõ¿Çïß¿_GŽÑ AƒT¢D EFFêÇ´8! 0ÙµKjÜXúôSé?ÿ‘fÌ<=­NÎÍåîv­bÅŠéìÙ³’¤ï¾ûNÅ‹WPP$ÉÓÓS—/_¶2 1M©dI釤Zµ¬NƒK–zõêé½÷ÞÓÝwß­éÓ§«yóæ2 C’täÈU¨PÁ℀¤fMé»ï¤ÿýU¸.]X^{í5uèÐA«V­’»»»Ö®]kß·víZûl ù…²·Ç¥ K›6m´cÇÅÇÇ+88Xö}Íš5S½zõ,Làf\º°HRõêÕU=“Û¯ôíÛׂ4WgšÌ¢@nr¹»„ýþûïùr ×Û·/í7Z\‡Ë–êÕ«kĈ·TBŽ?®‘#GªFù àÊ–.•‚‚¤S§ÒîÈ.·$lÙ²e4h&Ož¬–-[*44TuêÔQ¹rå$Iþù§~ùå­_¿^6lPµjÕôé§ŸZœPP]¹" .M*uî,}ø¡äímu*p.WXBCCõóÏ?kñâÅúàƒ4jÔ(¥¦¦fc³ÙÔ¬Y3Í;WO<ñ„ÜÜÜ,J (È’\Ú¶MzçiÀ®_€Üær…E’ÜÜÜôÄOè‰'žÐÙ³gµ}ûvû±Š+ªAƒòññ±8%  [¹Rzúi©T)é›oÒž`È}.YX®UºtiµjÕÊê³gôHóæIüä—»è€ü0dˆ´|9eòšËϰ¸Vò3,œ…€,˜¦Õ 2±~½Ôª•tþ¼ÕI p+4…%11QÇŽÓÕ«W­Žpb))ÒØ±ÒƒJEŠHIIV'€ÂÍå KLLŒî¿ÿ~•(QBUªTÑÏ?ÿ,I4hþûßÿZœàLþøCzä‘´Â%­]+•-ku*(Ü\º°ÄÄÄèᇖišzõÕWe^³ùŽ;îМ9s,Lp&7J÷Þ+ýô“´n]Zaqs³:À¥ ËèÑ£¦¸¸8=:þ{ï½W %8‹ÔTéÍ7¥©zuiûv©uk«SÒ¹taIHHгÏ>+#“›åûøøèôéÓ¤8“ÔTiÍiÄ髯¤Š­N¸–K?8²H‘"JIIÉtßéÓ§åííÏ‰ÎÆÝ=­¨)bu@f\z†¥aÆš?~¦û>ûì35iÒ$Ÿœeœ—KϰŒ9R?ü°RRRôÔSOI’¶mÛ¦ è?ÿùbbb,NàF\º°„††jÞ¼y+-X õë'ýë_’‡‡Õ©9áÒ…eëÖ­úè£Ô™uP(;&ÅÄH JO|¸¶lÙ"www=ðÀŠŽŽ–¿¿ÿm\ °qé%a PÅŠµjÕ*íÝ»Wû÷ïwxeÇÉ“'5sæL]½zU;v””v‹äëíÚµK­ZµRrr²/^¬Ù³gkÏž=jÞ¼¹Nž<™£Ï £ÄDé¹ç¤­NÈ/.=Ãò믿jÉ’%jÓ¦M®ž×ÏÏOgΜ‘$:u*ËëdF-OOO­\¹R%J”$+ @ÑÑÑš8qb®æW¶gôøãÒîÝR‹V§ä—ža©\¹r¦3¹É4ÍL·'''kåÊ•êܹ³½¬HR•*U¢Ï>û,Os€+ù牢 ¥K—¤-[¤nݬNÈ/.]XFŒ¡èèh%%%åûÇÞ·oŸ._¾¬zõê9ì«[·®~ûí7]¹r%ßs@A’”$  uí*µm+ÅÇK™üß*À…¹ô’°„„íß¿_Õ«WWhhh¦w {çwòäcŸ:uJ’äëëë°Ï××W¦iêÌ™3*_¾|ž||(èöïO[öóÏÒôéiO®ÏãIs€réÂ2}útûŸçÌ™“阼*,¹á…^pxðeDD„""",JùgÅ éÌióf)8Øê4pc .ÔÂ… 3l;{ö¬Ei\‹K–ÔÔTË>v™2e$I§OŸvØwúôi†!ŸžcÊ”) Ê“|àì ’zõ’J–´: Ü\fÿ¨œ `þÅ%Ç\ú+U­ZUžžžúé§ŸöýüóÏ PÑ¢E-HƒaPV–<ãîî®G}TK—.Õ… ìÛ>¬ØØXuêÔÉÂt@ÁàrKÂüýýµlÙ2Õ¯__þþþ2 ÃáÖÃéÛ ÃÈöÃ#W¯^­‹/êüùó’¤;vhÉ’%’¤víÚÉÓÓScÇŽU£FÔ¾}{1B‰‰‰=z´Ê•+§_|1gŸ(P¸\aiÙ²¥Jþo AË–-o86'ÏhyþùçuèÐ!ûy/^¬Å‹Ë0 8p@UªTQ`` 6lØ —_~Y]ºt‘»»»Z·n­èèhû5.PX;&½úªôî»,ýdÍå Ëܹs3ýsn;pàÀ- Òºuëò,Dk×JO>)+&>,Õ®mu"€³rékXæÏŸoÊõNŸ>­ùóççs"(ÜRR¤×^“Ú´I»Uñ¶m”À¹ta‰ŒŒÔ¾}û2Ý·ÿ~õìÙ3Ÿ@áuü¸*M˜ ½ñ†ôÅÒwX àì\nIØ­ºråŠl6—îkà4bb¤nÝÒnU¼~½Ôª•Õ‰…Ë–C‡éСCö;ƒ%$$èòåËÆ$%%iÖ¬YªR¥Š P1Miܸ´¥_ HåË[P¸\a™3gŽÆgÿüóÏg9vÊ”)ù 5Ã>ûL*UJrs³:   q¹Âòøã«N:ö?O˜0AÕªUË0¦X±bª[·®üüü,H…Õ •Ë–Zµj©V­Z’¤Ù³g«}ûö*[¶¬Å©d‡Ë–kEFFZ@p›,@ŽÅťݮ€ÜFad›iJo¿-5o.­Z%%%Yàj(,€l9{VêÔI:T‘æÍK+,ÿùeàœ\z†Åßß_†ñíÝyXUe£þñ{#8dŠ‚8ä9¤ÐÄ!m°šhY*æS ffišú¾Ne­È´£©½¦&ƒ¡æcy4ÍÙʱ2%5+çG†õûƒ#?·€¡°÷^°¿ŸëâJž½ÖæÞ<1ܬõ¬e‘ac‹ERú‚|‹ÅÂicLËjµ*,,L‘‘‘6GŒ3Æs#$Dzúi©zõ\ÀŽ ta±Z­™Æ’’’¯%Jdù8˜…¯¯¯"##¦™3gªZµj6e%·§½Z,”€ùèÂåø¥K—¤6mÚ86Ü£[¥¥qãÆ Òü‘'e€üÂ%×°”,YRÿþ÷¿îì(ð¶mÛ¦S§N)66Vï½÷eàR\²°H’———~ùågÇ€»:yò¤úöí+mذAáááÙ.Ä¿Sr²ôÑGÒåËöÍ€=¹daIMMÕÌ™3õÐC9; dË0 uëÖM×®]ÓªU«˜±¦åŸJËñã’Õ*½û®ôÝwŽÉ €=è5,Íš5˸*Ø-))):tèΜ9£Ï>ûÌIÉàŸEDD(!!A³fÍRýúõ%Ù.ÄÏn-ËÊ•RÏžé—)Þ´IjÒÄÁÁÈCú‹a2 Ciiio… V›6m´jÕ*õë×ÏÙ KGŽQxx¸^~ùe………Ù)íÙCYäúK||ü]¿u/0“ÔÔT…„„¨bÅŠš1cF–ÛøúúÚ]9yRêÚUÚ¼Y7N:Tr+Ð’¸ —ýq¶bÅ Õ©SÇÙ1 “ÿùŸÿÑæÍ›­%JähŸþý¥Ã‡¥øxéßÿ¦¬ Žy„åÊ•+Z¶l™Ž;&uèÐA¥K—–$íÚµKƒÖ¦M›T¥J''[{÷îÕ;ï¼£!C†è™gžÉñ~Ÿ}&¹»K>>v €¸ÂrìØ15mÚTÇÏ5j”6mÚ¤åË—kذaòôôÔǬ81)غyó¦zöì©5jhìØ±÷´o… v €“¸ÂòÎ;ïèìÙ³úè£T¿~}%&&*<<\ÁÁÁ:pà€úöí«ˆˆ•*UÊÙQÀƘ1c´ÿ~mß¾]E‹uvL¡À–¸¸8…‡‡kÈ!c5jÔP³fÍôÆohêÔ©NLYÛºu«"""®€€gÇÀ4 ܲ̿ÿþ[O<ñ„ÍXãÆ%I:urF$¸«+W®è•W^QÆ 5|øð,·9sFš5ËÁÁ0w„%55Uîî¶/ëÖû9½Ú8Ò°aÃtâÄ ­X±"Ó÷/)ýRÅ]ºH7oJíÚIeÊ8!$NRà ‹$:tÈæ‡~JJŠ$éàÁƒ™¶½u÷hp†µk×ê³Ï>Ó”)ST³fM›ÇÒÒ¤O>I¿äOH_}EY¸žYXBCC³ïÙ³§Íû‹E©©©H™?^½zõÒ³Ï>«7ÞxÃæ±sç¤é›o¤aä÷ßO¿l1®¦Àýø‹ŒŒtvÈ‘·ÞzKIIIŠŒŒ”ÛmwzܶMêÜYº|9½°´iãÄ8Y+,Ù]3Y´h‘bcc5{ölU®\9cüòeé¹ç¤š5¥ùó%îo pu®°€Ùýõ×_zýõ×Õ¡CõèÑÃæ±%¤Õ«¥Ç“ vR@L„Âd†^{í5*THŸþ¹,K¦m5rB0LŠÂ¥+VhÙ²eòññqvL¯ÀÝ8ÌêèÑ£8p zõꥶmÛ:;ù… --M½zõ’···z÷ž¬ï¿wv"ò 8À§Ÿ~ª„„uê´ZÏ>û ÆŽuv"ò ØÙ4|øXÕ®½]&ÔÔ+¯H_íìTä,º;JNNVÇŽ£%m×±cÕ+uïîìTä°£NVèàÁU­ê¦o¾±¨vmg' á”0°“ɓֲeT¯Þ/úé§b”î…ìàÚµkúì³vªQ£¿¶o÷WñâÎN@þÄ)a`#FŒÐ±c¿k÷î7åáááì8ä[ÈcqqqúôÓO5iÒ$Õæ<0r…SÂà>ÅÄÄ(11ÑfìâÅ‹ U“&Mäéééœ` ¸OV«UmÛN×¾}¿gŒ 4HçΓÅbQ`` óÂP@PXà>ܼ)Mœè«½{#Ô¡Ã2%&&jéÒ¥ŠŽŽVåÊ•5wî\ùúú:;&ùkXà%&J]ºH{öHS¦HmÚ´U—.]ôóÏ?«L™2Z¹r%e€<¸˗KÒ©SÒúõ×U²äl½òJOmß¾]/^ÔÌ™3õÈ#8;&…r 9Yú׿¤ví¤zõ.ªyó¡zñÅò QZZšüüü´fÍMž<9ÓB|pÿ(,o½uSÿó?iªTi¢âãKiåÊ9zã7¯"EŠè›o¾QË–-©°°0J y„ÂÙ0 CÛ¶mÓ«¯¾ª˜?Æ3zì±õZºt©Ž;¦×^{MááኌŒÌX³âëëKi ±èîpþüyÅÆÆjæÌ™Ú»w¯ªT©¢áÃ{«W¯^ª\¹rÆv 6eå–[¥%!!Å÷ä…”~4eãÆš9s¦-Z¤ÔÔTµmÛVü±Z¶l©B… eÚ'$$$Ûçóõõ¥¬(, ´˜˜Y­Ö,ËCbb¢V¬X¡ëׯë‹/¾Ð/¿ü¢êÕ«+<<\¡¡¡*W®œã;‹WóæÍ³|lëÖ­züñÇœp-V«Uaaa6§n¥¥¥)66VC‡ÕùóçU¨P!wTïÞ ô¯Õ•ÅbqnhÂâ jÖ¬™Í˜ŸŸŸ“Ò®ãöEðZ»v­¦OŸ®'N¨F5j”‚‚zjÀ/!µo/=ú¨³S€[(,R£F ަNâëë«wß}WO=õ”ÜÝÝåå奯¿þZÁÁÁڸѢæÍ¥´4iÍÊ fÃeÄ0 †áì€KJNNÖðáÃU®\9ݸqCóæÍSûö‘^VjÖ”~øAjÑÂÙIÀ(,Ò¯_?yxxÈÓÓS­[·ÖæÍ› pcÇŽÕÎ;U¡BÅÇÇkÔ¨‰jÞüªF’FŒÖ­“*TpvJN ³³Ò¥Kkذa²Z­òòòÒáÇ5aÂêÛo¿UPP³#ÚæÍ›õþûïË××W‹-R¥J¾úë¯'tìØ5EGÿ­®€™Y ÎSr¸+W®¨N:òôôÔž={2=¾{÷n5hÐ@M›6U©R¥lëÚµ«ºvíꨨ@¾véÒ%ùùùéÒ¥KÚµk—ªW¯.IZµJòô<®Q£B²¼ñ#÷jÞ¼yš7ožÍØ… ´iÓ&íÚµKõë×wR²ü#,NP¼xqµk×NŸ~ú©nܸ¡"EŠd¹Ý¤I“øŸÈ…·ÞzK§OŸÖš5k2ÊŠ$µn-I•¹= ÏdõGå[„FîPXœŒû=ö±páBÅÄÄ(**JÏ<óL–Ûp7zÌE÷N””¤%K–( @… vv À9qâ„úöí«Ž;*$$ÄÙq@.p„ÅÎBCCUµjU5lØP%K–Ô‘#G4aÂýù矊ŒŒtv< ÀIKKSoÊݽ¾¦OŸÎQLò9 ‹Õ¬YSóçÏ×øñãuíÚ5y{{«iÓ¦ŠŠŠâœFÀ†£„„OôðÃåUªÔƒÎŽr‰Âbg#FŒÐˆ#œ(ð Cz÷Ýš8±“Ê–=­¸¸åÆI¯ä{ùÞåËÒ«¯¦hÁ‚JòöþJ¿ü,OOg§y¿?È×öî•6”–,I‘»{ÅÇûËÓ3ëK…€ü‡Â ßÚ·Ozüq)9ù’’“ëj„Fò÷÷wv,‡(,ò-??)<¦  G4`ÀgGyŒÂ 3ôý÷=•’rYÑÑÑrc•=‹îä[³fÍÒÒ¥KµxñbU¨PÁÙq€ðçHùÒ¯¿þªªwïÞ vv`'¦öë¯é—-¾]rr²zô衇zH“&MrN0à¦5¾T¿¾4fŒíøØ±cµk×.ÅÆÆêÁ¹›=…€éܸ!½ù¦ôòËÒ /H£GÿÿÇ6oÞ¬>ø@£GVãÆ8‹î˜Ê‘#R§Né÷X™6MêÛW²XÒ»té’zöì©&MšhäȑΠ‚ÂÀ4–,‘zõ’¼½¥ï¿O?ìvo½õ–Μ9£uëÖÉÝo_¸N ` ÿùÔ¡ƒÔ¢…´{wæ²²páBÅÄÄhÊ”)ªZµªsB‡ãO”L¡mÛôÿöë÷ÿO»åĉêÛ·¯:vì¨W^yÅñá€ÓPX˜B¥JÒodOKKSHHˆxàMŸ>]–;Û (Ð(,LmâĉЋ‹Óºuëäåååì8ÀÁXÃÀ´~üñG9RƒV‹-œ8…€Ãüüsη½v횺wï®ZµjéÃ?´_(`jv—’"½óŽT»¶´qcÎö>|¸>¬¹sçªH‘"ö L‹ÂÀ®þüSjÙRŠˆ>ø@zúiÛÇcbb”˜˜h3¶zõjMž}týúu¥¥¥)22R¾¾¾ÍÌ…ËÈs:IK—Jï½—¾v¥P¡»oïëë«Y³f©eË–úí·ßT§NÅÆÆRV…@ÞëÖ-ý&Ï>›³íOŸ>­Aƒé·ß~“$M™2…²$qJ;èØ1çeeíÚµª[·®6mÚ¤:uê(>>^ááá™â×Daà7nÜÐ!C¤êÕ«ë¿þë¿´|ùrY­ÖŒ5-”@aàpPãÆ5uêT5J6kVn_ˆOiÀµQXÜ3ÃŽ¿Ÿý M›6M 4ÐÍ›7µmÛ6Õ¨Q#Ë«Ý*- yäK,ºpOΟ—zõ’vî”~ùEzàœíwæÌõîÝ[Ë—/W¿~ý4aÂ=ðÀªW¯^¶ûøúú²øGac;vH;K.H119/+k×®Õ+¯¼¢ääd-[¶LmÛ¶µoPP`pJ€dÒÔ©ÒSOI>>Òž=RN:Çí ëëÔ©£½{÷RVÀ=¡°¸«‹¥.]¤¤~ý¤ï¾“rr–ÖÁƒÕ¤IM:UŸ|ò‰V­Z¥ *Ø=/(X8% @¶þþ[zúiéÔ)iáÂôû«üÃ04}út ÊÙ¶·/¬_ºt©ÚµkgßpÀ%p„@®Ü¸qCC‡µYXOYy…Âà®bbb²½Ûüúõëõè£jòäÉ,¬vAa\ÜÕ«RRRö[­V………Ù”Ã0ôá‡*((HÚ¶m›,77¾¥€¼Åo€ ;xPzüqé­·²ßÆ××W‘‘‘¥åÌ™3jÕª•F¥®]»ê§Ÿ~R@@€ãB—¢{ÀEÍ™#õí+U©" r÷mo•–öíÛëøñãºté’f̘¡>}ú8&,pYÀÅ\»& $͘!õè!M›&=øàÝ÷¹råŠ>þøcýøã’¤E‹饗^r@Zàê8% p!¿þ*=ñ„#Íœ)ÍžýÏeåûï¿W½zõ¥G}T6lÐgŸ}–íB|€¼Da\ĺuRƒé‹ì·m“^}5ý>+Ù¹yó¦F¥§Ÿ~Z%J”P½zõ´zõjÚ¬i°' à"jÕ’ºv•vî”{ìîÛîÝ»W?þ¸Æ¯!C†ÈÓÓSóæÍ“¯¯¯¤Ì ñì…¸ˆJ•¤éÓ¥’%³ß&55UãÇWÆ •ššªíÛ·ËÏÏOQQQeå–[¥%!!Á¾Á€KcÑ=IÒ‘#G¢Í›7kèС3fŒŠ-ªzõêe»¯¯o¦"—(,€‹3 C³fÍÒÛo¿-%$$¨iӦΎ ‰S€åâÅ{Ûþ¯¿þÒ‹/¾¨>}ú¨k×®úñÇ)+ÀT(,@±r¥T­š´bEζ_´h‘üýýµsçN­X±B3fÌP‰%ìàQX€|.%E1BjÓ&ý+O=u÷íÏŸ?¯=z¨S§N Ô¾}ûô /8&,À=b ýñGú¥Š·l‘>þX2Dr»ËŸ!Ö®]«^½z)))I±±±êÖ­›,w» €“q„ȧ֬‘¤#G¤øxé_ÿʾ¬\½zU PPPj×®­½{÷ª{÷î”`z ŠˆZ·–ê×—öì‘~û-&Û8.]ºTU«VÕ¬Y³4eÊ­^½Z•+Wvl`€ûDaò¡*U¤±cÓÚûøHV«5Ó]ç“““5`À«|ùòÚ³gú÷ï/·»3`2¬aò¡îÝmß¿u×ù°°0EFFêêÕ«êܹ³8 ÁƒkܸqrwçËä?ü¾¾¾úðÃÕ¼ys8qBZ¾|9Wù…Èç’’’´xñb}ùå—Z¿~½<<<”œœ¬o¿ýV-[¶tv<€\ádvÀ¤®]Ëþ±””­^½Z=zôP¹r墔”}ôÑGjܸ±âãã‘íB|€ü‚˜LZš4nœT«–tú´íc?þø£† ¢Ê•+«uëÖÚµk—F¥ÄÄDEEEiÕªUš={¶¬VkÆšJ ÈÏ(,€‰œ=+µm+ .uë&•.-ýñÇ?~¼êÖ­«zõêéË/¿TçεcÇ8p@#GŽ”a î}}}%Ù.ħ´€üŠ5,€IlÝ*ué"%%I ^ÓÕ« õÜséëR .¬öíÛ+""BAAAòðð°Ù7!!Á¦¬Ür«´$$$dz ? °#«Õšei8z4Q£FÒÂ…T£ÆEÕ¯ÿžBB¾ÐÕ«WeµZ5sæLuìØQžžžÙ>HHH¶ùúúRV@¾EaàÖï< rèÐïz≣ºp¡™Šÿ\¾%è¦Q£F©{÷îzøá‡À(,€ÜycGM:U“'OÑÕ«SU¢Ä+ -¥ž=7«aƲX,ÎŽ ` ÀŽ’““uøðaíÛ·Oû÷ïW‘"Eäçç§«W¯Êb±èùçŸ×믗Q«V³2­K…Èp·u&‰‰‰JHHÈv­HjjªŽ9’QLöï߯}ûöéçŸVrr²$©lÙ²òóóSëÖ­µxñb­X±BmÚ´±çKÈ÷(,ÀÿÉnIbbbÆxZZš~ÿý÷LÅäСCº~ýº$©téÒò÷÷×ÓO?­×_]~~~òóó“OÆsÅÇÇ+<<\~~~,ˆ¸ ðn_g2kÖ,¹»»+..NcÇŽU@@€:wî¬èÊ•+’¤%JÈßß_ 6THHˆüýýåçç§òåËÛ¬A1 )%ŶøÜ¹¦…Ò5 p___?^5jÔPjjª$©hÑ¢GM:wîœQL*Uªô‹ã“’¤~ý¤K—’téR˜¢¢²¾±#¥ kÜéÞÎ’’’4hÐ U¬XQÅŠS@@€æÏŸïìX¸‹úõë«OŸ>’¤yóæéÊ•+Ú±c‡¢¢¢4tèPµnÝZ•+WþDz²¿Ô¨‘´d‰T¡Ân›²rËí7v@fa±³:hçÎ7nœ}ôQÍ™3G]»vUZZšºvíêìxÈÂï¿ÿ®Ÿþ9cI“&MîùèGLLú‘•ªU¥;¥ZµžÉv[nì=ްØÑÊ•+µnÝ:M›6M}úô‘ÕjÕŒ3Ô²eKýë_ÿRZZš³#â·¯3±Z­§l%&&æhÿ«W¥Þ½¥ÐPéå—¥íÛ¥Zµì @£°ØÑ’%KT¢D uêÔÉf¼W¯^:yò¤¶mÛæ¤dÈÊ‹â%Ûu&ÿTZ–š4‘æÍ“¢¢¤ÈHé쟠 £°ØÑ¾}ûT»vm¹¹Ù~šëÔ©#IÚ¿¿3b! Y.~Ïé:“¢E¥R¥Òª„†Ú/'€+a ‹={VÕ«WÏ4îåå•ñ8Ì#»›BJ9[gR©’´qc‡pq4hJ•*e3ÖµkWë˜Ì¼yó4oÞ<›± .8)MÁBa±#ooï,¢œ;w.ãñ»™4i’êׯo—lÈ;YýQy÷îÝjР“¬a±£ºuëêàÁƒ™®¶wï^I’¿¿¿3b!¸°€cQXì(88XIIIZ´h‘Íxtt´*V¬¨Æ;)îGb¢ôÄé7‚€cpJ˜µnÝZ-[¶T¿~ýtéÒ%U«VMóæÍÓš5k4gΜ¼S:Ìcùr)$$ý*`•*9; €ëà‹-^¼X={öÔèÑ£õÜsÏiÇŽúꫯX8ŸO$'KC‡JíÚIV«´{·Ô¨‘³S¸ްØYñâÅ5iÒ$Mš4ÉÙQpŽ—ºt‘vì>ùDzûm‰ƒbŽEa²°j•Ô£Gúê7nL_»Çã”0 gÎHK{öPVœ‰#,@zôºwç0gã Ê €óQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…€iQX˜…ÅŽâããåææ–åÛöíÛ¹4oÞ>>*^¼¸ž|òIÅÅÅÙ3ºKJJJÒ AƒT±bE+VL9š£'NhРA²Z­*Uª”ÜÜÜã€Ä®ç~çhÁ‚jß¾½*Uª¤Â… ËÇÇG/½ô’öïßï€Ô®å~çhíÚµ Tùòååáá¡’%KªiÓ¦Z¼x±R»–û£;½óÎ;rssS:uìÒµÝïEGGËÍÍ-Ë·S§N9 ¹ëÈí×ѲeËdµZåéé©¢E‹ªvíÚš>}ºçs¢eË–FéÒ¥3fñññFŸ>} ‹ÅbÌ;÷®û]¿~Ýð÷÷7ªT©bÌ;×X·nѾ}{ÃÃÃÃHHHpPz×p¿s´aÃÃÇÇÇ 2ºuëfX,#&&ÆA©]ËýÎQãÆ_|шŒŒ46mÚd,X°À¨[·®Q¢D cÿþýJïîwŽ,X` >ÜX¼x±±eËcÅŠÆ‹/¾hX,#66ÖAé]ÃýÎÑíöìÙc-ZÔ(_¾¼Q§N;¦uM÷;GQQQ?ƒ¶mÛf󖜜ì ô®!7_GF¡B…Œþýû«W¯66mÚdLŸ>ÝøüóÏ<¢°8À·ß~kX,㫯¾² 2*V¬h¤¦¦f»ïgŸ}fX,cëÖ­c)))†ŸŸŸÑ¸qc»ev5¹™£´´´Œïܹ“Âb'¹™£S§Ne;}ú´Q¬X1ãÕW_Íó¬®*7s”•ÔÔTã‘G1žy晼ŒéÒòbŽ’““zõêƒ 2),y,7st«°ìÚµËÞ1]ZnæhçÎF¡B…ŒñãÇÛ;fÂ)a°dÉ•(QB:u²ïÕ«—Nž<©mÛ¶ÝußZµj©qãÆc… R=´}ûvýùçŸvËíJr3G‹%ãß×°°›ÜÌ‘O¦±2eÊ衇Ò‰'ò<««ÊÍeÅÍÍM%K–Ìˈ.//æè£>Ò… ôþûïó=ÏòbŽŒô?HÛ+¢ËËÍM:UE‹Õ€ì³@¡°8À¾}ûT»vm¹¹Ù[sèIDAT~ºo÷{·óè÷íÛ—åM(s²/r.7sÇÈë9:räˆåçç—g]]^ÌQZZšRRRtúôiEDDèàÁƒzûí·í’×åvŽ8 >ø@Ó¦MSñâÅí–Ó•åÅ×Q›6mäîî.oooÖëÙAnæhãÆª]»¶.\¨š5kÊÝÝ]•+WÖˆ#”œœl×ÜùW s€³gϪzõê™Æ½¼¼2Ïιsç2¶»×}‘s¹™#8F^ÎQJJŠÂÂÂT¢D ~ÎCy1GÏ?ÿ¼Ö¬Y#I*V¬˜¢¢¢Ô¾}û¼ êÂr3G©©© ÓK/½¤Ö­[Û-£«ËÍU¬XQcÆŒQ“&MT¢D íÝ»W}ô‘š4i¢-[¶p„<’›9úã?tæÌ wî\ÆãwÛ÷Öv÷º/r.7sÇÈ‹92 C}úôÑœ9s¥¶mÛæyNW–sT½zuÕ¯__AAAš={¶Ú¶m«·ß~[)))yž×Ýï;vL£GÖ{ï½'www]¸pA.\PJJŠRSSuñâE]¿~Ý®Ù]E^ÿ<*_¾¼š5k¦­[·æI>äþ÷:‹Å¢V­ZÙŒß:jùÃ?äaÒ‚ƒÂâuëÖÕÁƒ•––f3¾wï^I’¿¿¶ûÖ©SG?ýôS¦ñœì‹œËÍÁ1r;G†aèÕW_Utt´fÍš¥îÝ»Û-««²Ç×Qƒ tùòeNËÌ#÷;GGŽÑõë×õÖ[oÉËË+ãmË–-:xð J—.­‘#GÚ=¿+°×Ï£Û/ƒÜÉÍ=öØc’2_¤çÖûÌSÖ(,¬¤¤$-Z´Èf<::Z+V´¹XVû:tHÛ·oÏKIIQll¬š4i¢òåËÛ-·+ÉÍÁ1r3G·Ž¬DGGkÆŒ ±w\—d¯£7ªtéÒY^é ÷î~ç( @ñññ6o6lÐc=¦GyDñññzóÍ7ñ ¼¼þ::yò¤Ö¯_¯'žx"/cº´ÜÌQÇŽe†þ÷ÿ×f|åÊ•rssS£Fì’9ßsÖõ”]MPPáååeÌœ9Óˆ‹‹ËòCaaa†»»»qìØ±Œ±7nØÜ8ríÚµFpp°Q¸pacãÆÎx)ÖýΑaÆÂ… … ãÆ3,‹Ñ¿ÿŒ1äû£þýû‹ÅèÝ»·±uëVãûï¿ÏxÛ½{·3^Ju¿sÔ©S'ãý÷ß7V®\i|÷ÝwÆ¢E‹Œ¶mۋŘ6mš3^J•›ïuw²Z­†¿¿¿½#»œû£6mÚüqÆÍ§M›f<üðÆ§§'7ÉÍc÷;GÉÉÉFƒ ooocÆŒFBB‚ñÞ{ïîîîÆ€œñRò ‹ƒ$%%4*T¨`)RĨW¯ž1þ|›mBCC 777ã÷ß·ÿûï¿ÃÛÛÛ(V¬˜ñä“Oëׯwd|—›9²X,onnn6ÿFÞ¹ß9òõõµ™—ÛßyäG¿Œí~ç(""ÂhРQ²dIÃÝÝÝ(S¦ŒñÜsÏ+W®tôK(ðró½îNÜ8Ò>îwŽhÔ®]Ûxà www£bÅŠÆ+¯¼büú믎~ ^n¾ŽÎ;g¼þúëFùòåÂ… µjÕ2>ùäGÆÏw,†Á…˜kX˜…€iQX˜…€iQX˜…€iQX6¢££åææ¦cÇŽeŒªY³fNÉÓ£Gµk×î·‹—›››6nÜh·,)))ª]»¶Æg·°åîìóûüóÏòq·lÙ¢yóæiß¾}Nùøwrwwר±cÕ«W/…††ª\¹rÎŽGX €¸zõªÝž»V­ZªU«–Ýž?;cÆŒQ«V­T»vm‡ììtèÐA^^^š8q¢³£€K °@>ôßÿýßrssÓž={ôÒK/ÉËËKÕ«W—$íØ±CÁÁÁª\¹² .,oooëСC™žgëÖ­zê©§T¬X1U¬XQ#GŽTrrr¦íî<%,»Ó¯åææ¦˜˜˜Œ±ŸþYíÛ·—···ÜÝÝåíí­gžyF?þøã]_ãÑ£GµvíZuëÖ-Óc‡RëÖ­U¼xqùøø¨_¿~º|ùr–ϳnÝ:µhÑBžžžzàôôÓO+...ÓvË–-SݺuU´hQU«VM“'OÎø<ßÎÍÍM/¿ü²"##•ššz××È= äc;vT@@€–/_®/¾øB’tüøq5hÐ@Ó§OWBB‚fÍš¥«W¯ÊjµêìÙ³û8p@-Z´ÐÍ›7µ`ÁEGGëàÁƒzÿý÷3}‹Å"‹Å’ã\·¶MKKSëÖ­õË/¿è?ÿù6mÚ¤/¿üRºxñâ]Ÿã›o¾‘azöÙgmÆÿþûoY­VýöÛoŠŠŠÒÂ… •ššªþýûgzŽØØXµjÕJå˗ׂ ´|ùrU¨PA­Zµ²)-«V­R‡T¹re-_¾\S¦LÑ’%K4{öì,_wóæÍuæÌmÙ²%ÇŸÀýa äc¯½öš† f3Ö¡CuèÐ!ãý´´4µjÕJ=ôæÎ«HJ?ݪpáÂZ½zµ¼¼¼$IÏ>û¬4h 'NØ<§a÷TXnù믿ôûï¿kêÔ©êÒ¥KÆøóÏ?ÿûîÚµK^^^*_¾¼ÍøÄ‰uöìYmÚ´I>ú¨¤ô#@íÚµÓñãÇ3¶»zõª¨N:iΜ9ã-Z´P“&M4räHmݺU’4zôhU¯^]Ë—/W¡B…$IÍš5Ë8ju'IÒÎ;Õ´iÓœ|*÷‰#,Ý^LnIJJÒ°aÃT½zuyxxÈÝÝ]Å‹×Å‹mN Û°aƒž}öÙŒ²"¥騱£ ÃÈ“|åÊ•S•*U¡É“'kÏž=9>êäÉ“*[¶l¦ñ 6( £¬Ür{!’ÒìŸ?^={öTJJJÆ[jjªZµj¥;vèÚµkºråŠvíÚ¥víÚe”I*V¬˜^xá…,?·rø@§OŸVÉ’%ÕµkW7.#Û½8{ö¬jÖ¬™iüÎÜÿý·$éÅ_Ìòy,‹Î;'Ã0d†|||2m“ÕÀ±(,P€\¼xQß~û­>üðCýûßÿÎONNÖ… l¶õööÎø¥þv§NúÇãîžþããΣ%III™¶­Zµª¢££%IGŽÑ‚ ôî»ïêúõ늊ŠÊöcT¨PA»víÊ4^¦L™å.S¦Œ$iæÌ™ Èòc”-[V7oÞ”ÅbÑéÓ§3=žÕØí롇Ê6? opJ 7oÞ”aòðð°ÿòË/uãÆ ›±fÍšiݺu:wî\ÆXZZš.\øëU*Uª$Iúé§ŸlÆ—/_~×ýªV­ªáÇë±ÇÓþýûïºmƒ tþüyýõ×_™rÿðÃúå—_lÆ¿úê+›÷Ÿzê)•*UJTýúõ³|óððPñâÅÕ°aC-]ºT)))û_½zUß|óM–Ÿ‹[÷…iذá]_ ÷8ˆ5j¤qãÆÉÓÓSÕ«W×wß}§éÓ§«T©R6ë1Þyç-_¾\AAA=z´Š+¦ÿüç?§IÝéö1___5iÒDï¿ÿ¾¼½½U¥JÅÅÅe* ?ýô“†ª:¨V­Z²X,Š×?ü #FÜõµ¼ð 4hÖ¯_¯îÝ»gŒ4H‘‘‘zþùçõÁ¨lÙ²š;wn¦Ë$?øàƒš2eŠBCCuîÜ9ËËËKçϟמ={túôiMžüðC3殯±jÕªjÑ¢E¦ç,W®œT­Z5õêÕK:u’ÅbÑÔ©S3eìÞ½»âââtúôiõêÕKêÝ»·¶lÙ¢§Ÿ~:c»V­Zé믿Öü¡¶mÛêÍ7ßT›6mÔ¹sgyzzÚ55U5RÙ²eµjÕªŒñ¯¿þZ!!!:|øp¦K.ò…`jÝ»w×µk×´xñb»~œ¾}ûªeË–ªP¡‚NŸ>­éÓ§kíÚµZ³fš7o.IJIIQ½zõÔ³gÏL÷¿Ø…I/½ô’¾ÿþ{>}ZE‹Uƒ 4räH9;¸4 ÓbÑ=Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Ó¢°0- Óúô\§RÁ¹gIEND®B`‚astropy-0.3/docs/vo/images/validator_html_3.png0000644000175000017500000012775612243255342020003 0ustar oleole‰PNG  IHDRÌ‹ÓdÄSbKGDÿÿÿ ½§“ pHYs  šœtIMEÝ;"ý¸} IDATxÚì½lUºÿÿî*•fªä«™ª½ò ²Ê v…½tUXm|éÕÆÐu>EÛd‹ÔzER¸ZRX± Ú”Õ’¶h!]ôZÚ-%©D7î%.¢¬ƒ(µÑ§`#JmU'ÚVˆVë¦êŒn#Í÷‰'þ9ÿHHáyItFÏΞEçÿ,DÿY‘Üv–“ æÉÔì2êÌh˜¸hDz•«)0õ,¦¶³tN[Ï‚¯7œe媂ðGá¼Ó:´«Æ‹ƒÚŒéœ×ZWÙyišéâõá%¥ úi¸ŽªÛUU¿ßú\V U žµÖ£ ew"µ¨Ç|s#ÚûBȼ}/V]˜2qè©Þ&/¼^s  ¢ó‘NÃYbX´oi¿’‡ªª½BðhmüôV2îy²§h¿ãûµ<Ç¿_"ŸF0|x=OõÔ\gŠ¢ |"Œî'ºçœ©ëÀðáaË:—ÂŽL¬dPr|KJ‡Ì‹Ô)42"ÞiY-5&li¼M^³*4IP®(èx¨c®|뽈ŒG²Æ?ù‚ é[ þMþ²Ê^*3²?AüLÜh— àYëoƒÏ¶ X=_Rþ%úŒRõ/¥;ò³ú=y&‰¶-mÀR€]Ê¢©© ñx·Ç–þJÙ•|ìÚGº 殪DëæVŒŸ‡šRóúš’²³Ð:­bàÀüüfYÆŽ!%§,£ÄóÙ–å0/[¾}ç<™,of?ÏŸ²Ö®j'eÈe¤¦SEïã8ˆ«EpgF›‹u`¡ã! @EcFQÎr:ºdu/Á° zž4f#‡GòòKw†ªjWðXö@É´s䎮øçÿ„oƒê´ŠègQÀ©Oáö_Þnn£°º$Ï$1ƒËé‚:­"þEÜ–.ØöàÒ¿.ZZ[ÐÓ݃׌A*ÐÏñ˜ššB*•B‹¿¥l}'“Isù¸Rùåê1ÝÙK’áÄÏv¦Áóú{¢ꌊ‘C#Ÿ›µåDn6-󹲟K׃[Á!t"Y–Í0þEâ*Ñ\©¼ÕØ`®œJÝo·î•ÚüèÎÎFy† #üa¾>[í%Óvª‘K1œ·9Žö²bñ/âW‹¶—ˆ“_'ÑþP;Ø:£ï"x,ˆÎŽÎ¢6kÞϲ;6†‘Ã#pÜìȺ:V|)2-~%a•€øgqx×{Í­nîµnKOG’‹µÏ× j*øzN·Ót°ÌñAV0xhš¦AX% ó¡ÎŠÚ{%¶l§Îv줔LJÉÀª=(WHç$„ކ B…s¾{ÊÜR˜@ÊŒPã:<4d\Ä#(U~+ÆŽaRžDûÖŒù¤lÛìÃNýKê¿”ü,~WcÂæp8ælrŸ¥¶Ò_™ýT!û,•~nÌúí\uäõWvdg¥¶EÛæ6Œ5¢Éd]w}oýgYç0O]º„ÝGèð "ŸÅlÿiŠ<ïáö”’Êr–™¥Œé$s @\-š'gh×KŸë¬\QŒíKAʾW6ޏóýÚgÌX4­oÊ^.i`Í•eYøš|'äòËQ7gØŠ¢€m`³f–vïU#‡Fppè \N—YF;{¦”Ë ‚ÿDÿ ý`X° ,ºÿØ‘##¦Ž4޾}}`Y‚ `×Î]U-©×L~˃™‘Ð,ý±†þ’gìM}w.³,ËÂét"ùÅÜïñ3q¸ÝîªËQ+,÷~«ºWª3UU‘L&á»gVGKèV,³¥ïL™Ï‡\Ò÷9×:ÿln‚™Œ'M]ÚÁßp†–Þ;¼–ÎAÖý0¢£JJÉ»& Zä¶§ö-íH&“ØóÜìq?RÓ)#âShàýVBädþþ‚éq‡Î‡;Ñõxzžê“ñxááìh¢À£ç©t?Ù ¦ŽÁØûc·÷JtfUg;vb%;2°*s:°£Î¨èz¬ ]¿ïBJI!ô~È^ŸçÁ¯àþ$ \7ÚPädš¦empŠÎ‚[^ìê°hÿ£ªˆÇãðoʉçäUÌì>_Lþvú «úÛÑ¿Õó¥~Oë­››ü0 c^·£¿rl>W>vÒ/µ%ªXUJvvt#Š"¼M^ŒAèxm›ÛJæ³ÿ,+ÂÌÔ1¸tþ< ß=>HT¨æäÓ,ÃfOngʼVvÒȵáCCp¯u£ó¡N¨3*†1úߣƒqæ²g2бÚ¶´emÈLeÙ¬(¨p³ÿ?FŽ\I/6_h+§½Wª3«:Û±+™Ø‘e™™œ èRCF£‡GÍöì©}k;BÇCè©l½19O÷Åò…Ù¨ÝﻊNËÑa±þGXa¯ŸÏµrž/$ÿR}F©ú—Ò©çKýž~ŸKQÁ.eM':ó=/+ý•cóÅÚl©ôsÛ Ýþª”ìJé&û7"'#‚±rø=öŸåía®¸z—¾9›~–í4k—%h©"Û!æy³°J@JIA8oušoô2 ƒäWIhÓ†bâ§ã²,—Üc'Š¢©œÈ¸õKÅîeêr(©¹åÙô[ÎéØð‘a´ni…kµ X H’„áCÕ÷Ágtb³{ÛZÛ (JA-»7íÀ&Ï%Í—lëaöÓåç¿9ŸÕ s—&$ÓÈ\2OwÚUmnÏsÎÒP<7—†j-¿¼Î¬ˆþ2jËhxÎséôrë‘.'˰H$óÂN§鮦µ°Á܈‹û‹Õ½¥Óèú}WÑ(ƒ•¾3e^k¹dÙùÍøz‰¯Hž)¿-$™2Q.û½¿òšÎ™gƒ‡²´D<Ð càÍÀríÚÎö€<›SQ{¯Dg¥ê\ÊNìÈÄJ¥ÊÌó¼Ñ/Vq+ÏóYËó±hÌìç¥ êUý/õg=ÓÿR?üýÅßó™AY}¨|E.8&”²»Ï“©>£TýÓÁbú/õ|*•*)_†a099i–[¹b웵£?»6oeŸVéÛnÓŒ=vúsÀØÖ!®1)O"}¯ýiùŸÆ®3–i.}sÉFú6céñ£‘ÂÍk%œ·ίtA‚|Qžûx À[ÁacÆU7§0çmNëeìo%ãT‰ô,¿.Û©S¥ä½l ±Q4Nì˜]ŒæGÕêXs“{ädÄV9òf²²Œ±ãcæR4WÏ™÷¦gué7D-ïåy´?ØŽíl7òF~¹ŠvÌ+y´þ¶=Ý=¦|Òy¥#ÛÍ¿nÆî»¡ª*”Ë ö¾°×|Þu« Çaàõsv¾÷¹½E—†ª‘_®‹­4ÒŸs­½è{æ2WôdžµË%.÷Z7â§ãH&“ð¬óÔ¤ÕÚ`®œJÝ_ªîÕè,½u%ôaÈ<©Å¼¿Ä³…–ö«‘K)ÜwºF‘œH½®6+qvl¶reÂsÆ‘Ÿ‘Ogëyˆ}ËŠîÅNÇ:‘±OÜ"½tÏì£Â'¦ݪÓ*É„©/EQŸû½Üö^‰ÎJÕ¹””’I)Ø)³Çí1òÇÜ’¹èÌÈçúìßLο3~O·ù‚Œp4 ßz#:ìý•×ÜêÑõû.´m6V:î„ëVWÉò—ÊŸeY¸Ýn„އæìöºQ;6PêùRò/Õg”ª)ý—z¾Ôï€ñwädÄHZE4ÍÞÂe¡?;öc%ŸRéWsBM)Ù•Ò DNFJ¥ÐöÛ6´nnEøDØòåÒùî?ë*}*í4§#Í glq8õÁ?‹Îˆùz®æGÊe.ã„ÇÃH~Ìš‰«D$“I8Ø:ãívïzoÉ&"'#=: Ì›ðÓ†Îó<ÜkÝÆ×uÆì¨Ø½Ðº¹Á£Aô¿Ø–3z¹ƒçyø6ø0zlöYއÛí6Nù(QŽtç•> 3ÀÞçöâw÷ÿ˜1&£ïŒšQ·ö­íp¹\@p>q¾è½0<8ŒÞ?õÂëó"u%¦žAçƒ÷1çžËüö[o£çéÜò³[ ]5^fè|¨Ó<Ñaø­a¶°|ùr8V9Ðõp×Ü~Ï¥ÀÛ#ocÇ£;°÷ù½W§hD?5Yòë쥡jä—«ÇÀƒ…_hÝÜŠÐû!3Bà\ë4ödÙ@l—e®ªp:çžË­‡9ñ[çDødü >¯ƒª¦ÕØ`®œzžê))s«ºWkóm¿mÃØ‡cƤJ3΄u»Ý׈–Ï’yµm³Ô¶Œð‰pÖ‹›Õb×fí’'“¥@ÛÖ6„O„AwöLÜÖÍsÑ¥ÐñPóó4=;{òÒÓ4 Á£A#H1cèʹÖil/HG¯¢q„Ž…æ~·h'vlµlÙ¨³•”’I)Ø)³oƒcÇÇÐÿ‚ÑöÅ5"ü÷Îíßóüž¬|ÓÿNŸu«\5ÞKQ¯ª`9þÛÒf£ê¦Sq•™«cÞ´«¥uX*ÿ–M-‡Í2¤O¹H—ÁÊ윂ಖù«Å®Ãœé'¿NBšÌS3¸b£ç­Îò¿þCQ&‰3ÆžÁž?ö0‚ ~ÔÕ"…ÌíLSQ¹V° ì ý5‚(—ôAì…Xè¯Ñ0ŽU¬cѶ©tEñ¡úsš u5Ìo?Ör¯²6£aà¥=è|¬·¬7m ‚ ‚ ¢Z~R³”fœc8Î<Ö­–¤¿ôBAA7¦Ã<ë43u˜—íMë}Bú6AZ#‚ ‚ ŒÚmɘGÒg Jç’ˆG#ÆÇ,l|q‹ ‚ ‚ ~43SÏ‘¶‚ ‚ ˆ§îF($SÇE” ‚ ‚ ˆ…ç'$‚ ‚ ‚(NPì– ‚ ‚ ,fzŽ ‚ ‚ C[2‚ ‚ ‚f‚ ‚ ‚¨Œ:ˆ"IAAD–LMMé<Ï“$‚ ‚ ¢´%ƒ ‚ ‚ Èa&‚ ‚ r˜ ‚ ‚ ‚f‚ ‚ ‚ ‡™ ‚ ‚ Èa&‚ ‚ r˜ ‚ ‚ ‚f‚ ‚ ‚ ‡™ ‚ ‚ Èa&‚ ‚ ‚f‚ ‚ ‚ ‡™ ‚ ‚ Èa&‚ ‚ r˜ ‚ ‚ ‚f‚ ‚ ‚ ‡™ ‚ ‚ Èa&‚ ‚ r˜ ‚ ‚ âÇ@ÝÛ„~´>æE`§×ò¾Ø¸¡‘ƒ ò–×jrYÅö_  ïÝ\w E¯Í'våRî½De ï‹ øJ£rOÍlêû`±”c1´;HgŒ¾A2:TJ…£‘G`§Þâ¼”¾ú4[yŸ”0ò\Ò×2˜zN·{}EËÒ&ôgý›ãX8›Øí-úÌÀÃŽÁÿ°ÏùjÞF¥¯dHg&‘º¢µEV1¸+ŒøÉ €{}#:÷úÀ ¬yÏØk1D?’ ™„vU·‚‡wƒˆögšÀò¬e9Ê}¶*¹×rœ4Ý+¢e«`­õ”É®¡6x2lY:-côõ’§ {OëÔÿ°§êþ¢¹$¢2Fö…!}•ˆ·qhß郫I(Ùþ Ñ÷N®õBUrI 4‡üu ÚŒQ~§Û¶Ç<ÝBUí¢¢¾Ü†/”Œú;Æ?9áD°4?muØþ‹x75¢ëå–²ì²\yæÞÏ0,Äu´?å-i?vûèà_#Î¥ ¥TC.Mt>ãƒà¬L¿uµîÌ÷¶æu€…®Õ‚øq Ü 6«ƒ(tm±Ð €späÕ.b‹ý,f;^Œ„DÀÖ³èú«¨B¯Ç°¿cB(5HÎg?·È’‚½í£p7‹ØõlpK@¹¨A°˜ø¶8áÈÌòEÃ/DÑ{ß^tmÈ5ȱ$†Eäh»}×Êu‡xï&'BoÆ Þ£ª@ï}#t¿ì î £·uáNÓÙz> ߦFø÷5ƒ[Åcò[Ã/F;)¡?Ü ÖÂ')çÙjå®ÎÚ ñ¨„‘磽ǞwÚóœ&SO98VÏá·x:÷ûüàV0HM*ˆ“°û¾áŠƒåÊE–ì¾Î;Dt: ¾Ãîû‡ñêÇ%ÎBuu¬ª²÷±7búSþ‡.€á¤.*¾GÏ}#xõ㎒–q˜’ÈûIx68K^«ˆë¨é `^nbþmêÇ\Ž…޽-Y²óü¬±“ÒªÝEŽKÀ Ð=ÐfÖ×c#ŠÎ9xSâ„F=þaD%àkwåØ^ÚUöaèOaÄ>’àÙP»Hý°Ô5ç<q˜Ã‡b˜¼¨àÕÈœã%ÜÚŠÞAŒŠ¡åc=ë¿rnàsÝ)@tÎÖíh~Ý2)çÙZÈ=ýŒÿ!7zý#øC½ï´YÞŸ7aJ*ØBëï½<›9YàÝìBì„«jýØ•‹)“×ü¦ó!ÞêÀvÏ"Ç%´=Ê—%›ZØ{ðõ8š69ѹonUÄÕ$µƒrÚE%صㅒ‘ç Ç"|8VÐaI‚sðy^;å¨DžY÷×9°ýˆœÐV¥ÃìÝìBV8ãNÎ;Dlÿå"Ç’%e_‡yl(†ÐëqLN*W èxÎg.¤CìÁWŒeñ,Cθ6*÷˜K²i%¥®(oMÏF8^â'%ìòX^|6ŒØ¸„É  ÃÂy§öeÍ^̲Ìá£I¤&ôÐ q-傊‘ÈÏ-}yÖ7¢ëµÛrÉÍ'°Ó‹È1 û5fR9Ë{ÚG‘’5ôÌäðóÄÇ' i*œ· hÖÞ²Wëc^0 :4+ã"e“â2Ÿ@:=9kìt>ãÍk$väYNzÅ¢hvꛈÊz6 ékÜ þ‡ÜEe ,t=×~ìȯ=Ú•I±r”ªƒ"«ì r›]‚os ëC?óaÅäm·]—j7vÓË^$?“ŒÁIÈŽ€ØiÏ¥l¼P?WmTÏn»ÂŒñŸÉ âÚÊñ¶Ù-l“©‚ƒ¦c5–G<¾GøH¢¦³¢Ç%8ï²¢”‚ÈÃy‡€è‡’9Øe:vvê–IYÏÖHîéz´>Ù„¡]aÈß*eEÒ‚âàêYž)¼²Q =Ù• “þoýÜýéÿgjŠ+Sî©+ øâ¼´‹ù´ã“ÑRÀ·Ù‰Ð¡TEÍÚb£È*’ŸJf[“ a™òd6˶j ñY2+—²^ú M"þ¡„Î|ØõVPìÝ„rY`l9H‡ÙûCó/÷š™Þá8’§etýÕ‡]Cm``÷ýAÈI%oÞ—í€Ç?L€©cáùµhy :Ÿõ¡/@×_ýH)zïBUsg‚qH_Í–e¤ ŽU ” *z~3„ÄéIžmF_0€Î皡Δ'—‚³Ÿ{E0õ,ÂG’Ùúeñq Í[œæßãÁä…º_ö£o$Nà°ûþaHg”Ò:;’Dò³Ùz)›tFAÏ}Àª¡û ?ºß𪆞ûòuaGžå¦—ëÐØ©¯tÆXdêìz« ]/ø?‘Ì“g9²ŸRò³«ÇrdRÌŽK±ÿ‘ ’''Ðõ\3úÞ  ûe?ĵ<´«Ú¼ÚCžÍÙl×vÛÝô2#.û;BpÞ!Àû[W¶mÙhÏ¥lܪOÃu›@Ùí ¼³Qÿ£A¨ŠZ±­Ë Ùñ+r&²a·¾M†Ýz7‰ˆOB.Wu-Y¾s“œù,a99iùlì#c²$:Ë_Y(öl­än:¶ÍFzÉÓ²=¹šA ÎõöW?k¤£BrñlÁ0,FúÂPª¢bèOa0 ïÆÒ«c¡7ãh»¹q½÷"Q@åÊݹN@øpá·–ão¹í¢RYVcÇó%#ßV·ÌõŒßöm©y椫\V1ÔÎj5±ãÙßdIÁ@÷¸,¼›+[½-kÈ0@ïßÛÌÆÊ¯àÐó›AÄKðms™Ñ§Báûb!ý]#mæž(ç]"vürÃ/EÐóF‹eI#Ç%¸›³;ŽBײ^X¹8e„üãJðn3fÆ z‡Û²žúÓ´ ÿÝö¹Y÷ÆÒW9r)6Óónr"|4™µ´™5bﬣ5òRLÐ ˜rr­oA×úIŒ¾AÏP‹µÎêK—mô¥8ŽÅ®‘p-? IDAT€©sþª°.ìȳœôr±[ß¹<òí§R ÙOIùÙÔc92)T;$¿áÈïWÖ 6ŸöP ;íºœvc·ŸˆKØß1 ÷ÝÙíyäŰ­ö\ÊÆ­ú¹¶ŸöÛÒUnDÚn?•<-uÀä9»ïíÄî^ËësƒØÀÓ†cãαô šP|›ˆ!z4_'•ÖÕFô??ÎÄ­`J©+*w†!Þ*ØÚ2a÷Ùªä^(ʼʈ*WREWb³ìöåªÉ‹¼íG¤k¡£brD»FZ±¿#ˆÐ!ck DZØõV+ø›ÙN›îfÂ*òÅÙ½«­Ãè f¿ä\®Ü»þêÇžmA <ž6Ú¨g½þ‡<ÅWÇl´‹JeY©ϧŒÄµ<«yŒI¢¥Ã“á0Çá\'Ü{^Ê.+‘gÁtëXtí÷ç­ÖVcÇ™Ïr½oµV´¹l‡ÙÓ,f @éð¥Ëž ά+XÖ¸;‘´Âu >>®šK^}%‚ð‘$&'²£Qò·2Œ]3…ëf ¾ðnl,¸DU ¹4ou"|8†ÄIÙ\†?’„{½hæ— 9ÕeÏ <Í""6¢©vÊ–ŒNÀ³Ñ™ÕÈØÀ³1G6åi;½B‘ ›õ5ó(`?áñò±ýØ”Ÿ=–#ãBå°C:ºÂ98xšEˆÞ®©=TÙ®í¶»éÀàÎ0œëEô¾ÕVÀ¶l´ç2úŒBôÐY‘íÙÉ3r\ÂÀÓ!´?ãÏ1x:„½ÛF±g¤ `Œ¸¥]/ûáÛⲘ˜z»FZód>‡x«`nÝ«x„ÇóæŠê:Ÿ¨ÀÞm!¤RzGZköl5r·†Ês’ m-s4V¶ ¤jYÈ%•±w[ÞMNs%müp {·Ñý–žõ¢…c;7AÝ€û=ÿ1ˆ‘}ì9ÚV±Ü…5<¢Hœ”J>“>j¬_2JG™GúÂ%‚ÈCŠË˜<§ í/þ¢Î»»,Gž¹éªW5ÄOõáx6˯Föýt3ä‹BC1ôÜ7l8úl_*3Â\xg‰Vá~nEe3¯Ø'4M…û—åµÁ?…:Cû^8ïÁÖ×{üÃдœº˜¦R*8?orqÝi FãGbp­oü­é+ݯÍmꊂða¥2'ÐfÙR)Õ–.ìÊÓnz#K6ëk•G%²»ò³¥G›2)V;ìz«Õxÿ•(FúÂàV°hý}ZõÌ‹=TÛ®í¶›rÊ29¡À»ÉYÜfJ´çrúŒ‚Ñ›[Ëwlìæ9¼/ ÷múd€ý‡°§s½oƒô…±\ë¾K,>0iq#ÏG1~8WÓ\„^:£`òœ‚ÖǼP§‘µJ:3×jêj{làX¤RZþADZ»Þÿ…ôÅ$ö¼ÓZÞö%ž­FîŘ[ªfòìÚjªcc>k‡ªtTB.C;ÃÝŽ,ÇÎÕÔyrƒ;Ãðœ´ïä“`áÃÉšÈݵ^0ƒÊ=÷`ø…0¼›:ËnÕȲl;^ ù6;1ÒFøp^c;FдY,Ú§ÛÙC^Ž< ¥ëj O(܆gcgMì8¾è6¶˜õnÆà³ax6”§d¤®TfHñãœMbV¬Ðµð‘$|[éEähM`تÊSŽ<‹·}ÑœÕÃZö5Î;ED*ª_íæ:û¹ÄN$¡ª>s¹UUkΦFË,"Ç“h}¢©ä5Ìä¿­›ìàinDäø:.«`W²˜|[œ¾AäýÂG’ðnjÌ:›Ñ³Á ).3¬¥óR8›óu1]@6åi;½B2·Y_çúÆ¢ö“Õ€<¤¯³;¬øû [6UK=Ú•I¡rØ­CV§ãäѱׇðá˜Ña—á0W£¿jÚu-Ò+´£¬öl·Ï(Ò§U´th3Oqµ€ø '½fÛðlÑ÷N+vß â`¬ËÞo“ˆÐ:#ûÂØs<\7ö/‹ët<›ÿ¡’¡a„d;Ìó¹DÝ´QÄПÂP.¨æ~XYRüLFÇŸ}yŽ]<*a×H[y<°ùl-åž®Gð¥(ÜëŲϚm}Øð‘†Ÿä+7çˆg.5WºEÈŽ\ÞŒ`f’ŒËp¬*¯^ª DNHo㪒»rY-¸ü/O(pØX-ÎkU¶mÛv¼€2ʳö?Â`_©”ZÁv"T%Ïb¤O½ªº_-B2*A\]ÙQ£5w˜<âãÜD°Œ1Û(tÍÈ1>ð¸qÐuðåR) ðD㳞ð"ð”R\Fꊚ5«*t ÜͳG$q× ˆŸ”Ê:E¡ýb'†ÐsßÚþØG#Ô¤†Èñz^k©‰¼‘‡¸NÀàsQ¤&4oÉÞCÔþdzü#èm†¿Ã n•qêtFA|\2÷2åʩڞð¢ÇŸ,© »ò´›^¡2Û­oÛc^ôÏÏ#¯SØìDðõF_ŽÁÙ$@ŠËÊvFŠÙO-õhG&ÅÊa§гaÍ›צ÷QÇf'â¼ØCQ›³Ù®í÷RöÓ³jvÚ³]/Ö§Urä˜Ý<;žóawû0züÃh}Ôh©I á#±Y‡›ÅÈóѬ%rKçëq/övŒ"6.šqп¿£¹ ƒäȧCHDeó÷JW‹ËŽ>ÊçóZz©o«¡qìÝDû¬.G^ˆÀÑÈÃ÷àÜ£=£ˆKh} ¾ž—3&š\Vd-×6ì>[ÜS“Š‘î  ¤4$£FÛå ºþ¯¿øý¹ö¶šÛÀBpòèÚëÇÀÓ!Hçdø¶xÀ9ÃŽ%=–ÌŠ²U¢#»rñ?ìÆÐŸÂx| Í[ÜI’"‚ ‚ ~”,™ššÒyž'IAADh3AAAÃLAAä0AA9ÌAAA3AAAÃLAAä0AA9ÌAAA3AAAÃLAA9ÌAAA3AAAÃLAA7†Ã,}+çy’è Ê]¥ê×óTX–˲5•K"™À’¥KH @¹²ž¯4‹ÙAñw˜É–,±4Ä5"EYAÑãö€çy°, o“‘h¤ª4y^Eìtþõ%KHßm*ø•*XV…oƒ ùÂÜ=áq@\£‚mPѶY…ªVW¿ž§zв©%ëZÿ ýð5ûæU® ¥¿ï «ú)Š‚ý/îÇùoÎCÍQàBË凮ù‚ ïzï¶~V¶ô½L –”çì·Ýß~%_ö$AUU¶À6°àWòè}¶·ê²AÜpóbBp{w Š¢@UU´niEÛýmÕ9)«i"g`—gkœ«ó ªÊ³Öp Ó¶©è}’…:Í‚ã½ÏW7H¶njEä“ì @èDþ~²Öy"u%ÔÂÍ c¾Ê« ¢ŸFÉ–)¾»|8øÆÁò'úO÷ u9…©KSH|™@ðHÃo “ÁAs&·,ËæE%ÒQ…=ûö€çyð+yŒËŠJt>Ò ~%¶E`[ dT†çys0RUš¦ApdN’$ÁåtÙ.¿Ó Hù°d‰‚Ñ£€|hld€¥@ï³,ø•ƽí²ˆ~6ëT_&/jè|Èøw×ïY„Ž£ª²xå…6£!v:f\¸D?‰š³•ÌÒò†p³¶Eÿ_û/@°, q8—¾…þ q&×ZX–…oƒÏŒ~–Ò­ÅÊ’N³ó‘N° ÆêrY±e/Š¢ Ð0ÊÂóèz¼ËVýX–…ë.`yËèVÏY•%A\#‚çy š÷vTŒRÏ-¤nÓ²¾Ýs{ž¬•Ë ||`X° ,|Í>HßJ¶ÊRLÖVi–j+•êÏÊ–ŠÉÚª,é뮵.¶ Šb–]WBäd¢(f] ´°gߣ{¼ Î[e§;rh}Ïõm`!ºŸèÆà›ƒ4ÂAs&±x ŸÇ>·Ž,) ºëÆî»ÍkÛÿk;&/Lâü7ç1õÝ´i »wí.™Ÿô­¶Å²eË:Â??øg¶3£©H~´ï0¯¤ ±/Ç*ñ¸ ip­Î¿7~p¯³(Ûª* –þ{ü‡îÓ8Žƒk­Ë¶Ì†q>aüîßà‡rYÁŽ?ìÀØ»cPU‘#àWð¶ô÷À¶Ðñ`TU… èyºÇ–n‹ÚA‰²úpBV!®ѳ«Ç–½lïØ¸ô¯KP¾S²¶°XÕOUUã·:ãÿ3'lVÏ•*K×Ã]PòyÞÛ‘ =·Ðº-&kMÓàköá|â<ÔiÞ&/{}HYÛM3·­T£?+[²#ëBe€¾çú0rh¯¾ü*‚Gƒ¶Ëãrº ëzö„|½š¦!Ÿ›Ø¨¸ÿ—e©T b£ˆ@»‘ŽÛíFü«¸eY‚ n(¦¦¦ôRœMœÕ”¾§Ÿ»ö?׌yVgF×u]¿ö?×túÙÄYóþS‘Szcc£n—©ï¦ôæ_7ëÝOvëÕðö°®·þöšÞ÷gãÏï5ýÅýºþèc×ròÓu‡ãš~êã¹kŽU×ôƒ3þ¿ãák:Ã\Ó«åàßêþ{ýº®ëzߟûôއ;lÉ,-ïKÿº”]î©)uÐßþûÛ¦.ìèojjJ §mäÔǧtÇ*GIÝZêÌ¢,é4 ågU÷ôo¹õ.U¿J³*K!™K»íÈN»-ôÜBëÖŽ¬Í{¾<«3õLEu(ªÇŒ4K¶•ëÏJÖVeI_O§y6‘]‡Jyô±Gõ]»w麮ëï½ûžî^ç.[G™œÿæ¼Q¿ï¦Ì´Î&ìÙ AÄ‚ìaff—&ëmFL^™ÜþËÛÍeÓ»s7R©”ítù•<öìÛSõÒŸÓiD†ãq °•…tш8»Vg¼å~h¹OE÷“,¼ëç.¾ÃbÿKÆKÀÔW//ÿF?Ÿ„ëÙû—íÊ,wÿ$Ïóx/øßÄò›–Ãåt™l+RWRæóÀ­àÌkVºµÔ™²ÊϪ“ë=_X•¥Ìæ³Uú\µºMo9ÈÜvP©Àè‘QcËB‹Û½Æ¶JêPNš…lf>ôgGÖ¶íw¦z; l xĈTѺ¥µªô˜zÆüo:r­]ÕÌëA?¾·—þ+F„ûÒÔiÕü«ä„MÓª*‹s5fd@\8ÆÖ gÆV¾Àªp»ž?f?ëmIÊe¾»X8o­^6ÂÍÄFሇÿÕ2kÙÔ‚ðxê”ŠŽ‡:ØVz 6í,¤ÓO]IÕÄ(U–BùYÕÝá0~“/Èß»í’Ùb¤Zݦ·ä¾sPJ·l]þQkŠ¢àwí¿Ã«/¿ uZÅ©ð)[+YÏGšß—¬³úº­êòx×{¡¤$Î$<D`K ºþJÀq’_Ím=‹Çãpßæ¦– ˆ§Ãœ9HV{dÛÀ¢}k;vüa‡9ÈdŒµ|nìø˜ù"‘¢(ØûÜÞ¼$$I‚¸F,£,Sp+f”;è§ÄÙ=̽;U¤¦×Ø21þ”ËÀÞU¶²U•%£½ÏõÂ}‡ÛŒ®U*3岂±cƾR,P0LéèÏóp¯scð€Á80µ·²ì”%ßà›ƒf~VugX´þ¶=O÷@VëÀر±yk4Veáyî;²e¶ù¾tËq0“=¹Ñ4 ˜™ˆ\ö¿²ß~ŠÈz>Ò\L²®–ÖÍ­ØþèvˆbVÿ¤ªªÅ.ÔÏëÏÚlÇîgwCV!Ë2ö¿´uÒKÄÓa^¶lYÖ_Úq-öö{)SÏÀå2Þ÷x=ˆÇãÖ–«ØöX–ÅM?½ Ïáàß²AR5ç&Ê„¸Úp” ©‰ê€ôËä{Ÿ×þPËg1óüÜ ’J·üLÅM?UÑÔt=ŠªË’v˜3OǨFf°÷…½XþoËÁ²,Fdùd¥¿·ßzC‡†À²,ä 2úÿÒ_µÑY•&''Á6°H&“YùYÕýàa7ýô&ðÿÆ#t"d«~–ޱÅsVey{èm Ïó¶&&Õ–³R¾Ýò+yt<Ü×/\c ‚ ØõÌ.Üî½ÂOÕÛu("ëùHs±Éº[ˆ~ÍÛŽ±lÙ2üü?fæú{;ýYÿ_úÁ­äŒ­8¿p¡uK«­U,‚ ˆ…%SSS:}YŒX $’ üÜõsz›ž ‚ ˆEÅOHAAA3AAATmÉ ‚ ‚  (ÂLAAä0ÿx¾•@+AA?‡¹ç©´ljɺÖÿB?|Í>€:­"ÐÛÀ‚_É£wg/€ì/Œ-Y²¤àÇÂãa,Y²{öí1¯%’‰¬û=wz8“Èú­¹Ï±,;÷Õ±Eˆ¸F¬èã/•–M"™À’¥Kl?×vø•|YÏÆ¹°m6ñloÕe!‚ ‚Xœ³ª¢uS+"ŸD².g~ºçéhª†©ï¦p>q¡ã! ¾1h¦ÿyìs ®ðÇBÇBp¯s#t,TÐéRUí[Úñ@Çe9kæß´J–S¾»|8øÆÁò'YO÷ u9…©KSH|™@ðH0ïœ_‚ ‚ ˆÛa–$à©ছàý•ÚŒf~üבõ¡Ž¡CCØõì.°¬Mì~¢ƒ‡me3zl»žÝ…ègQ(— G[ýýYŸr­5‘“ˆböÇí3ê­ª*:é¿’ÛÀ"°-`:ýéhéðÈ0„›° ,úÿj|è`àå‚–e!®çäÀãö‘÷ÖÄ™\klø6øÌ(t:¯=ûö€çyð+yŒ›×ºw=Þç­Î²Ó94‚¾çúÀ6°Á°‰7KÛ„·Ék| ñ:5x‚ ‚ «Ã|" ljn¹xsx¸X øïñ#<6œ¬O#à8®µ.Ȳ íªÏm3 §Ó‰ä×¥\é[ ðßë7¢ÌÇCï  Öì+^´õ^hš†X|nB<D`«ñõ«íÿµ“&qþ›ó˜ún Ú´†Ý»vg¥þ0Œó ãwÿ?”Ë vüaÆÞ5>?ù8~ÅÜ~åXŽ •JÁõ }¶— ‚ ˆEä0ON+8`­¸Í“åû7úþ$ \ÏÞ¿ÌÔÏF~¯g;Læu BÇB拃þ ~Ã1ÌHG6ö!_ºt JJAç#öœæLgÑîKu-Ncðh­[Z ‘\™ÜþËÛM'üîßÜT*•õ¼p³õožçñ^ð= ¾9ˆå7-‡Ëé2#ôV¤®¤Ìç€[Á™×2'€ák3ZÕj/V÷JIëž©gÌȵ]›HãXå€ó6'„U’g’Ôú ‚ ‚X$ó¥)`÷àÈ0ð³[€õ^`hÐtÅFሇÿÃaL=ƒÄ× 3™d2Yrß«:­bü“qìîÛ%K—ànÿÝЮj”ïTò<îǺ1rxdÞªî]ï…’R8“@ðh-FTӱ˜º4U¶#Þ²©áñ0Ô)uØŠ”r+80ÓO]I™×J‘u:HIÊ­{¥‚Žã²öÇãq¸os—|6q&®G»pÓOoBøÃ0^}ùÕ¹í"AAß»ÃÜÀwßJÀÿ8èÜnþìßèGïs½pßáÎ:®­}k;v÷톪Žäþ—ö£óAëhpèý+Ð¯ëæŸÿÿø1zl4ß¹VU ‚sµ3ëZ¡S7ª¡us+¶?ºb£q±%m`Ѿµ;þ°Ãtbå ²ñbšÊecÇŒýËX  ¶öaó<÷:7•ðoðÛ*®LÊ‘M¡º§ÓÄLvú™H’”u¿i¶c÷³»¡N«eÙ°‰‡J¯Üý›»Á¯à‘ø2á‘ax›¼Ôò ‚ ‚XDs&|À±1àüù,‡9ótŒ4¯î°üß–ã–ŸÝß_ÉíÁcAst¦Ó–y¼\úå›nº É3IŒ¾3ç¤.[¶,ë/óŠJÏal úI4oKÂÁÁƒ`ê¸\ÆÉ¯ñx¼dz{_Ø‹åÿ¶,ËbäÐHÖ±j,ËâvÏíÀ ò"Áo¿õ6† eYÈdôÿ¥ÞÕ]¬îË–-ÃÏñs`fNæYNº¦bâÜD^zýé·’3¶£üÂ…Ö-­¶"ìò¿dìynA OADÙ,™ššÒéËpAAQ˜ºùuÇ-¾¸¦ë$}‚ ‚ âGî0“SLAAÜàü„D@AAä0AA9ÌAAA3AAAÃLAAä0AA9ÌAAA3AAAÃLAAä0AAA3AAAÃLAAä0AA9ÌAAA3AAAÃLAAä0AZ©c IDATA9Ì9HßJàyž$ú"‘L`É’%E׈`YÖòžÅfK‰dK–.¹¡m¾’:ô<Õ–eÁ²,Ùç õ­ צ‹í.¶²Ì— ë—Šåw#Ž9ÄÌa¶Ó Ä5"EYÆíq{Àó}^ór.”-ýXÊ©( ö¿¸ç¿9UUç-Ÿž§zв©%ëZÿ ýð5ûê´Š@{l ~%Þ½`˜é0óß‹Ñ>ÈvÖvø•|Ùh¥Ï-4•–3°-~¥1æø6ø _oȾ¼ÒçæÃ­ú¥bùÝ(cN¥v¦ª*Û2úÈg{ÉK½ÑæÅ„à0öîEªªhÝÒŠ¶ûÛªk,«i"§c™íÅFÀ¹8Ÿ`¡ª,­›Zù${ò:‚£ßp¨Ÿî¦j˜ún çç:ÂàƒPUªªaÌϧsOÆw—ß8¸`ÏÝ(õs®vâ|Âpì·U÷ÏcŸë«uŽãôî'º³Ò¶*§U~Vå<ûåYÝy«Sgê½ãáóžjÚƒU*Ñ{)[J—õíá·uÇ*‡ÎÔ3ú‹û_´Îìu©gæäô¿Fþg¿Ž€_aoÏÙöŽíèz¸ Š¢@¾"Û*g©ü¬lþŽоµê´ MÓjÒ¬êP‰ÞíÚRøÃ0Î'Œòø7ø­3[ øïñ#<D>€ã8¸Öº Ë2´«<·yæÚÓY²m,&û,Õ6í¤™+Ϫì̆þ ÙÙbÁŽn‹¶• ÛC-ˆŸŽÃ½Î]“´*±]«6]Ísš¦A¹œ/ëùè“­ÊbÇŸXìcN%ȲŒT*±QD Ýhn·ñ¯âÙý!E˜‹Í¦ÒÏ]ûŸkfD$=“¼ö?×túÙÄÙ¹N$?‚S2Bñëf½ûÉîªf oëzëo¯é}6þü÷çG»–“Ÿ®;×ôSë¶#Ì•ðècê»vïÒu]×ß{÷=ݽΈ OMMéÌHÒ©OéŽUŽšÎxÏ~yÖŒž¤õg•_!Û¨V·#SS:ê ¿ý÷·M{²e#d–NÛªœvò+ZÎ"ùUÚ¬Ò¬JžºM—õÒ¿.•e»ÿvP÷ßë×u]×ûþܧw<Üa¬´|s>ÏNÎ&ÎfG¼oû,Ö6K¥YLžµ´³tÝ­ìl1E˜íè¶Pæ£=”3æ8ýÔǧja¶Ò_ɱµF:²c/µì“íÔ¡äo‹xÌ©TGé>rê»)³_Éí#‰@„¹lÃìß:@›1"n“W&·ÿòv° ,Øwÿæn¤R)Ûéò+yìÙ·ƒoVU>§ÓØÃ­,¤‹FÄÙµ:coòu å>ÝO²ð®Ÿ_y¶<Ѻ¥unÏ`¾ÍË­àÌkÕ0zd®µ.° ,n÷ÞÌäȹÌüj¡Û<]ó<Þ ¾‡Á7±ü¦åp9]f$³ä>¹œ:Ø)ç|äWi{°“fEûmè¶Üý…þ~„? ׳÷/3õŒÙŽÌˆÖUmîú bŸÅÚ¦Ý4såYK;Ë­{!;[l”Òm¡:ÌG{°Åu å¾t?Ù]³—§kÝ—×zœž>y>XLcN¥¤ûB¦ž1W±ìö‘ÄÂð½½ôçXá0"Ü—¦ N«æ_%oª[ö.kKÆEÃiׇ±õÂéÌ(ÿS…Û ôüqþeã]ï…’R8“@ðh-¬!-£Ô•TYƒ[Ç\îü]ûïðê˯BVq*|*¯³´Ê¯PšµÔm&-›ZCRÑñP‡­o ÉÌn9k_¥í¡Ò4Ë-g-áfb£ˆðGaÄ?‹Ãá0 ‚¦žAâë„yo2™„óV§ez‹Í>‹µÍjÒ¬•-˜ãX#ìè¶–m¬ê@Æàv»ÑóÇžšÊ W¹6«]Õlõ啎 Ý'WíØ/ò1§â¾SÀq’_ÍmS‹Çãpßæq:Ì™o¯Wû;ÛÀ¢}k;vüa‡iÔò£GF-Ÿ;>†Øé˜ÙÙì}n¯ÅJ#IÄ5be˜:€[1;(Þ D?Õ ÎîaîÝ©"5 ¼Æ ̨ˆªÎþ»Š²¤iÝÜŠín‡Ø(šÏó<÷:7õyûJ­òã8˜AÖ‘Hš¦3³Îu`ÿ+ûóžËÊ/GÖ‡¨ÃܾÎ*tk9°\V0vÌØK†¥F„aJϼyž‡ûŽl™Ù)gµù ¼2—_¥íÁªÕDOJÙR¥ø7úÑû\/Üw¸ç¢VÚ·¶cwßn¨ª1íi?:ì,=^döY¨mVšfUv6úSU5£?Ëïç‹õ/¥ž«T·å¶éùª_ïÎ^¤¦Sx­p^•ž«\Èv«`ÆçFŽŒØêËmM”+|®–¶[u°m‘9ÕØYûƒíØýìn¨Ó*dY6úȇ:ÉS],”³‡9÷/ý6g©·o‹íé¹víšþècšo¡:V9ô]Ïì²,Ë?Þù‡qc¼Yݾµ=ï¤;{®siºëš¾ë™k³{³÷$S:ÃLé sMg˜k:Ç]Ëú-÷¯Ú²˜ûòfß/úfü¯›mŸ ¦ãáã8Ýá˜Ûë¹ë™]:SÏè‡Cßµ{WÞž[«SÒ{U†1÷]UªÛR§y4ÝÕd¼Q?›×©ˆ½}„g¿(©|E1‚é¶[*Ú©ñÚGÔjuÆ´†R x´$e¡­¶d­Ú~5Ú&½õPòýê$è$•J5$Lkk¦®„Jm“[e±«2ŨTqTOÔ kD:ß?>‰cçøW¼_’ññ¹Îõë|ùòu4Mû8øqÚ¾;ùäVµ£J³®°j¶[ÊoæÊçRêŸfç¦iûÍQŸ…ö³tí—Íع¤»Îgs}É´ß\2µí\eÈ÷|(¤|‰ú·Z­šÍfKY9cösù®’1su†ŠG+æ\$ݵ<³÷ËwUŽB®Éfý2›U@–ú{N¾ýlrrRóïö×ÈÄï%hi°Äb1w¸!ZƒŸb‹o ”k +ƒè.Õþçv |1€ö?·³2ˆîR?bÍ/åš‚PXŸ«Û~¢ÞǼ¬¢»ØÀgÆò‚Dtwâ3Ñ<‹F£ðü/ƾƒóA'ºßë†Ãá`Å1`&""""ºûpJæ{GärüÆ€ˆˆˆè.˜^j@å¶Ê¤çZÞlw³þ)uBEÀ€(J%xõ@a<,KÒß ÁóAX,4¿Þl<—X'3ñÚòGʺJÚ–Îìý„IkË.5ŽõŽ‚kÏV¢nBá,˲_ƒtû³Û!•J9íèëYöÌè¯(8/DDDDK3`VUTm«ÂÀ§IOϼ•nÃË ˆ«qľa$4‚þsýhÿs»±ø—ƒ_EH{#•þÞ~¸7ºÑßÛŸ6èRUþ~ìªÞ•S°f<&TöœxóâøŸçþ!ëåŒ_Gl4†ÐW!ôœîAç_:Y¡DDDtÌ‘ðR°jÊ|®?íëzÎô,èm<={ǧoßyèéí1Öê¬ýM-Æ®Ža䛾!>GScSRÁ‚ éÛ}[}P®)Øÿâ~ô} ß®sà“H%Óó•‡õ‘÷4víÙ…êÝÕPU²,£á冔×(Š‚úçëÑôêt>D±Hû—ÓMÓôojY—=Ñhãããp”9ðëé¸Ýn ýsÈ4/P÷|Z´B^#£ù`3o"BDDDK,`^ïžÜr+J}U€7õÑRßS>œ?^ÏáÛ¦.ÇoÄõ×/›NƺÂ:ý¼‰îÞnl~l³>’ºÙ‹ž³=IÛE±>ùðŸ£æ¹ìïÑ>3XÌöGuU;ªÐsF?~ß_ûà\ç„Ãá€:¡¢ëdÞzû-H’!ê_ªG÷™äûÞ7ÿ±Ùȯkƒ (P„Ãa¨zà›Íú¾Š¢`膌òÖ=W—òA¢þùz=ÏOW%}0Q'Ô´|Ëž¯™m‡sêÿÀÀ'‡ë!{x“"""Z*óØPb6¸Ë“‚`ßS>? 7“ç/[WÜù½™0Ï›èïí7~8èÛêÓÃé¨ú<äÑÑQ(ã jöf4Ï ³ýQ]`G=§õ ±çLªvTéUr} °é'›Œ |Ë“[0>>ž´¿|¿œô·$I8Ûsí'Ú±rÕJ¸œ.c„ÞÌøõqc°•ØŒçf~ ô€<>/¸Ùç*{¾mo]a5F®³í öÕv8tB^-#|)̳Ÿˆˆˆ–HÀ<ššÓÀ×{€Žv# t”9ü{C_ Á÷„0˲ ë +B_‡ŒdÂápÆy¯ê„ŠóŸžGÓ¡&X–Y°Å·ñqÿžTJ’„úçëÑõnׂÝó¸ʸ‚Ð¥zÎô °CÕ´—رÑXÎxå¶JÏ¡ÆTTÿº:«‘R[‰ ŒôǯÏe’´:HšIr-{¾dY†ÍfKšw>44÷ƒîŒû†.…P·¯«Ö¬B𣠎9:=]„ˆˆˆè¶ÌÅx¡¸þö1`“€šZc³ï)<÷Ãî¤åÚü;ýh:ÔUÕÉÖÿlEÍnóÑàþ¿öÃ^b‡vS3¾_øÐÝÛ\«*:NvÀ¹Î™ô\ºU7 Qõtj÷ÕÂQæ€c½>%A øwú±ÿÅýF½Õ˜fB¹¦ ¯WŸ¿ŒeŠÕ`d$)`ž¹:FÂÑÖ£€•÷­ÄÚ¯…w«7ãô‰žÞcôÌ mæòr‰u”W­Z…ð¥0ºß›R—/_žô˜¹E¾ë0vpñÓ‹)SŽ·‡u….—¾rE¹§CCCÓ;üæa¬¼o%„è:Ù•´¬š›Ê7SH >õ—Sè8Ù!¢W£hy£eÁ›{®²/_¾<ô05]çIAz\Å•]II¯åØJmút”‡\¨ÚQ•Õ{ôÛ(š6C–ežñDDD”3K,Óxg8""""¢ôŠ67¹ãš¦±ö‰ˆˆˆè˜ÑîG¬"""""ÌDDDDD ˜‰ˆˆˆˆ01`&""""bÀLDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDD ˜‰ˆˆˆˆ01`&""""bÀ³sSQ´¾ÕŠ‘oF ªêm9§‰ˆˆîŠ€y)‘í2ú>胢(PUU;ª°ýÙí…ë€È•äç±¥£Lÿ7x_NÝ×¹ ¨ª@ù=€ž=gzæ­ÎÊ)‡§ /7tÿ¹~´´¶¯ºUî(”ë ’îã×Ç"@¾_fe-dÀ\î.‡"e$tæh©$IJ%ôë3¶«ªŠš½5J%ˆbÀž@Ê(×l’$o"C¶'¿ÙG"¸œ®¬óït‘«@ô*`±(è>D¿ÊʬÀ27†ß«hyS¤ì{à5©Tÿ¿·ÀÅ/PP^Œ%2BáPÊó¡K!¸6¸ „€w«7ëÀ–7ZÐßÛÁϱÿ…ýhy£%éëöŠG*ô@º·¾m¾‚úƒY»+×x·z!ŠD±€w³‘Ë‘¤ý\\ì Àáp î…º¬úKÛ‘6Ȳ !ëü|0)Íš½5Åú7Ê5%c^}ô5àèe¤¬ób&Ÿ|f:žY>ç:7@×C.` )S2Ìö3ËËàÐ ë$ Ç:x…%""Ì ƒCƒørðKÓ×(Š‚úçëÑôj“ñ\íoj1vu #ߌ ö} ñ‰8š›2/r9Q,°|ùrô÷öãã¿}œü†Wþ:œ}À¼ˆ\Q1ø?€}µCC*"W׺[Áæªðmìvót†>ÜQP^ü;ýèz·+åù]{v¡zw5TU…,ËÆ¨q&’$¡ùp3¶ø¶E@MuMÒvß6zÎô çL¶?½}Þ:ØìvÇãðnöb$4uB…§Âƒ@u iŸC¡ëdŽ9š4Ò>WQ®)Øÿâ~ô}ÐUU1ðɤiV;¡N¨p¬w ¡±!«¼ÔV×F¿…ò½ïfoA}7ß|f:žY>ÍÎMUUõmEúÿgüfûeÊKÝsuPÑëQ^a‰ˆèî‹Å´L†CÀ̯)BÚý&˜ÔÿþjX³Z­š¦iÚä“m84l¼þÂÀ­¬¬LËVìû˜¶ùg›µú?Ôk…8Õ©iU¿šÔýQø~>©½ÕªiûžŸÔF¿Õ´²u“Ú䤦 ‡4 ˆÍ‘M³Û'µ Ÿ”•¤:sot'Õk,Óh‰6»ðÉ;ڞsÚM©mûoMsotkVÇ̦Ý3•av»§¼ö«aͺš´ßÌã'¶™õ—X,¦¡Ú©ÿ>esv^²©³™yIoôÛÑ”×åÛwóͧÙñÌòivnæ»-c;Ì*Ã\iÝIe³(¾õUoŸŠÆ®6ýd“ñ•ø–'·`||<ët¥R ͯ7£ýD{Aùs:õ9ÌCC@`§@ä;}ÄÙµN`½Šæ&!L¸ TþREý<Ï_9ÊÆÜbàÖ|Ó[£Å`+±Ïecÿ¾ýØ÷Û}hûÿÚ’~X¦ÿÈË÷”oAÛºOwëÓJŠ6y6S&‰ÜÚfÖ_$IÂÙž³h?ÑŽ•«VÂåt!x>˜2ž®ÎæÊËØ˜~¼ts{óí»ùæÓìxfù\fyI×?‰ˆˆî·íGö}~Cl4uB5ùü*?0¯Ã­ p¬×§^ }®Ò]ÿ[Å¢à—ž7‹EAhÆ,‹ÀÿVáv ¿Ÿß:òû“§e$D_Ï:(éüK'"ßEÐöÚPóë4Ô§Nåè~¯^;° í®( žñ?ƒ£GŽBPq!x!)˜NiÛ[Û2õ—Êm•žB©¨þu5{)Ç]gfy±ßš½×¾›O>ÍŽg–ÏÅ>oÓõO""¢{.`NÌsœ=ß1¢XÀ¿Óý/î7Þ`£W£è>Ýmº_ß¹>ã‡RŠ¢àðÁÃ)£¢‘HŽõŽòX‹[‰þ·çàâgq8ÖÑ«š&AÓ$ ‡ô‘3M“àrê¯=ðªŠñ  íÿM?k^fòý‡O§—Ì“$ în´ÓGÔÛŽµÁ·5óˆ°¢(Ø_¿G–‡š¡ÿÃþ¬—ã›ÏvÇãÀÔ­Àë&ÐúNkÁýE¹¦ ¯WŸŒeŠ«Õš´¢ÎÚO´uf–Q,Põ«*4¼ÜuBn}½}õÝ|óiv<³|.³¼H’÷ÃÉý“ˆˆèž ˜—/_žôH®Bl*ß”ö×öfŽ·‡u….—¾êC¹§Ui=ÍMÍØ¿oAížY–ÑøJ#6y6A^#ÃQ–ý‡ ³þrøÍÃXyßJ!Ðu² éLÚwll ¢X u–)/Ç;ô~µjÍ*H÷Ièÿ°¿ ¾›o>3Ï,Ÿùž›fû™ååTÇ)´kƒ$I)ˆˆˆîT–X,¦ñ}t· …CxÀõ4Mc>‰ˆˆ(/?b1`&""""Ê §d™à3æ{GärüÆ€ˆˆˆè.˜^j@å¶Ê¤çZÞlw³ N¨øÅR©„¯ê7ÔH,q%„€ÅbIú;!x>‹Å‚æ×›çBáPÒëË)GèR(i[:³÷BLßÁn r¬wäuó—|$ê&Á²Ì’õ~ÛŸÝ©TÊi@_:°gFŸ˜q“•|óBDDD´4fUEÕ¶ª¤›r@ÿ‡ýƺà /7 ®Æû>†‘ÐúÏõ£ýÏíÆÍ3¾ü(BÚjô÷öýÑþÞþ´A—ªªðïðcWõ®œ‚5ã1¡²çÀû˜Çÿ|<÷Y/7`üÚ8b£1„¾ ¡çtOÊ:ÆDDDDwvÀ‰/5«VÁó¨ñ©øôM0n?½hÌ';ÐøZ#„ÐGëWö“íY¦»·¯5ââ¡\K?Úê{ʇð?à VÔ À1ëÎ'ÀõVU5{k •JÅ=#èOŒ–vvuB¾_†(hy[¿‰EÛ‘6Ȳ !ëI7)w—ë#ïiFXC—BpmÐo4áÝê5F¡Çj~½’$A*•Ðw®oAË^÷BœÿáÌ9Ý®“]8tðD±€,ËzŸ8‘¹Ox*<ú]ønò„'""¢¥0¶Uk×'Úçj€e€ï ‚çƒzõÙl6\\ˆF£ˆßˆ£üÁr# §Ó‰ð×™ÜÈå®\¹ßÏ}ú(ó¹þ´¯ë9Ó³ w"ó<îA<ÇàÐô‚žÞvµ¿©ÅØÕ1Œ|3‚Ø÷1Ä'âhjlJJ#øQ#!}»o«Ê5û_ܾôÛ+|2©dz¾òàР>òžÆ®=»P½»ªªB–e4¼ÜòEQPÿ|=š^·(iàrº išþïM-ë²ç#b||Ž2~=·Û¡™æꞯCë‘VÈkd4lžóCÑí ˜×;€'·ÜŠRßFàM}´Ô÷”çϟ׃ÃóAø¶é£Ëñqýõ˦“±®°N?o¢»·›Û¬¤nö¢çlOÒvQ¬ÏC>ü§Ã¨y®&ëbÌ ³ýQ]ÕŽ*ôœÑß÷×>8×9áp8 N¨è:Ù…·Þ~ ’$Aú—êÑ}¦;iÿæ?6ùumpEŠ€p8 uB|YÜ¿[Q ýÏQÞºçêR>HÔ?_¯çù骤&ꄚö‘oÙó5³íÃápN}"à`àødãããp=äB`O€g?-‘€yl (±ÜÀƒåIA°ï)‚Ÿ›Éó—­+nüÞL˜ŒçMô÷ö?ômõéáŒtÔ }òèè˜äF2 IDAT(”q5{³ šg‹Ùþ¨.°#€žÓzÐØs¦U;ªô*¹>Øô“MF¾åÉ-OÚ_¾_Nú[’$œí9‹öíX¹j%\N—1Bofüú¸±?ØJlÆs3?z@ŸŠÜìs•=_‰¶·®°#×Ùö‰ûj;œ:!¯–¾æÙODDDK$`MÍÀéNàÇkÇ=@G»:Êþ=ˆ¡/†à{B˜eY†u…¡¯CF2áp8ã¼WuBÅùOÏ£éP,Ë,ØâÛ‚ø8‚O *%IBýóõèz·kÁŠîyÜe\AèR=gzØ¡jÚKì€Øh,ç@¼r[%‚çƒPc*ª]ÕH©­ÄFúã×Çç2IZ$ÍŠ$¹–=_²,Ãf³%Í;‚ûAwÆ}C—B¨ÛW‡UkV!øQGž.BDDDtÛæb¼P\Žû°I@M­±Ù÷”€ûawÒrmþ~4j‚ªêdë¶¢f·ùhpÿ_ûa/±C»©ß/|èîíN ®U';à\çLz.ݪ…¨zº µûjá(sÀ±^Ÿ’ Šü;ýØÿâ~#ˆ^ê?L3¡\SÐ׫Ï_Æ2EÈj¶$Ipot£ý˜þA¥íX|[}YåväR7éÊžHSÉéωD’^oô‰Ý~4½ÖuBE4Õûį3C°åÉ-J$„¾ ¡³«ž Ï|"""ZBóL[½@o02’0Ï\#áhëQÀÊûVbí×»՛qúDOo1zfÐ6sy¹Ä:Ê«V­BøRÝïM©Ë—/OzÌ\"ßu˜;¸øéÅ”) ÇÛú —K_¹¢ÜSŽ¡¡¡Œé~ó0VÞ·BtìJZVMM囀)¤ŒŸúË)tœì€Ñ«Q´¼Ñ²àÍ=WÙ—/_Žz˜š®ó¤ =®âÊ¿®¤¤×òF l¥6}:ÊC.Tí¨Êj„=úmÍ›!Ë2Ïx"""Ê™%‹i¼3QzE Ž›ÜqMÓXûDDDDtÌ Š‰ˆˆˆè÷#Vf"""""ÌDDDDD ˜‰ˆˆˆˆ01`&""""bÀLDDDDÄ€™ˆˆˆˆˆ3f"""""bÀLDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDD ˜‰ˆˆˆˆ01`ž%r9I’X£w Çz„°X,‹Ò¶™Žw/ãy4·†— „€‚•q\{ˆíNtGÌ¡p(cÇv¬w@Q”EÉôög·C*•`YfIÉg¹»’$AO… :VÀÙ†ÈP45÷· QhÛׇÀú6ÔlhCç›úñ¢—4líD`}Ž6ØÖ™6\%‹Å2oÁCär_~9ïm½…çqOÎÇ»ÛÍU/‹}-„¹úgâ"„€(ðnö"x>˜uºŠ¢ õ­VŒ|3UUyå.Ù5½á¥H¥D±@ÍÞšyé×ù^{¢Ìͯ7Oÿ½Ìr[ëšíÎv§»,`^j¼yqüÏÇSž—í2ú>胢(PUU;ª°ýÙíK.³!ú]<ùÍûšþ†-¯–Ð~(e<Žã_Õ¡%XÞ0‚§C°Ù­hì¨Bçå:tFêPñ”ÍÕý—]UUýBS¤ÿ)Ê ?»È³ìª—LýSUU¨1õ¿¯Çög·gývüú8PÈ÷Ëì@ ¨ùõf \ÀHh±ïcð=å»ëúuÏ™64ÛèöÌåîr}T)͈oâ“$IJ%ôëKzó¬Ù[c|ª ì dÖ½Pç8Sž—$ÉxCUUñx²=ù 6‰Àåte]6‡Ãåª%ªb»Ü‚ÁsŒ7ûj XO‡øƒBR©Àöç*<†(î·òħâìÖ‚ò’ͧY×{p8¨{¡.i[ÍÞˆb}ä]¹¦Ô¶€>êðô¶•$ãx€>Ò¸©|0…¬GÂûÎõ¥ÔG`OÍ›3—ÿR.§Ë™™ß¹úY!ý3±ogW'äûeˆb–·[ \SàÝê…(žI\ŽdU/ùžGfeŸóMÎ$Ÿ™ŽW°e@å¶J4¾ÒˆÖ7[3¾\×C®´u6W;õ²Á!¼[½ÆÈ½Ù¹’oe;Â5»>³i‡¹ò™ïõÓLÛ;mhy½EOSlz{VeŸ«_ç[gfí—oŸ7AJd„¡œÏ‡Ål3ž ºOw7ç/M¶ûÒowºKæÁ¡ÁŒ_¯(Š‚úçëÑôj“ñ\íoj1vu #ßèŸjãq456”—ÈåD±ÀòåËÑßÛÿöqòW\EøëpÖéÙ×IGäŸc°Ù%„/Eý.ÙaƒrMEü† ûjZöéo€Ž ¢á1@4¢ °¾ »Ö¶`èý((/Ù8tðºNváè‘£)Ÿ¨ëœP'T8Ö;ÐÐØPpÛÖV×F¿…ò½ïfoÖ#éT>Q‰èX¡K·.j7õQÀÎ@Æ}wUï‚§ê„þA))ŸYô³|ûgð£àô¨ÌVâñ8¼›½ @Pá©ð PȪ^ò=ÌÊ>—Lù4;Þ|¾ñ|–y„9›¾4»`מ]¨Þ] UU!Ë2^nÈú\)¤Îri¿lÒœ+Ÿ…\?]N4MK ÆÆÆà~ØsÙçj£Bê̬ýòéó þ~t½Û•sÛæÛéêºuÏסõH+ä52š6g=øÁv¿³Û–€X,¦e2Öd~MÒî7ùäþ÷WÚÕjÕ4MÓ&˜Ôháaãõ.heeeZ6Òo¦Ø÷1móÏ6kõ¨× q¡gX{ë×gµ÷[/hï·^Ðí~_;Ûö¥v¼écmt$¦UÙßÒ&c“ZýÏNiš¦i£ßÄ4ÙÑYy™Ôw¼¯úãm>˜ÕubÛphX³®°&mK´õ…O.höÕö¬Û8Ýñí7úíh^m4×ñöývŸÖøJ£¦išvöƒ³š{£;c}Äb±”ò%ŽkÖÏ éŸ‰}ÍÊo¤y«²®—Î#³²çÔ§¾Jí/éŽWhÿœý\¶éÎUgsµCºzIôy³s%ß:Ëæú™M}¦k‡tù,ôú™ÎÈ7#¯óùöëŒûÍ:®YûåÛçg¶ƒ{£Ûü<¼íK{Õÿ®^³Ûíš·Ÿí~´;Ý>‹2‡Yßú µHŸšc×õQØM?Ùd|²åÉ-Ÿ—cJ¥š_oFû‰ö‚Ò‘×É»:ŽÈ?xžvbüjccã°—Ù`]¡O±V–óú§Òø8¬+fçE æO-î§¡©Ô)+`+±ésB 06¦·ß|Ï) ì  óÝN@×»]ðïôgÜ'Q–™å3ò™E?+¤¦+÷éný+ÅbMžM)í0Ÿç‘YÙ3É”ÏtÇ›Oããã°Ùló’ÖìvHW/¦}~j~ê,×öË9Í),Øõ3Ñs}”oÙóÙϬý éó‰vp”9044”>°fNw0›Îf_m‡óA'äÕ2—Âl÷»¤Ýé.Ÿ’‘{‰]áAPÇ|¯ë×6)ù,“ |7ޱ«ãl¥VD†¢¤Rë È×Ó«_D.)ö9ò²¸u<;ÈIÔíøõñ”‹(Êmµ »]/côêÜ+˜¥9×6ÏãħâøÇzz³›Ž‘(ËÌòÚÏòÝOQ<ãG…:¡âBðBJ;äZ×ù–½Ð|.´‹ð<êY´ÓÕ‹Ùl6e_ˆ:Ë5ÍĶ…¸~J¥ìv;†¾š·~ï~fí—oŸOúzÞŸüõüRj‡™ÓÒMA ] ¡n_V­Y…àGA=rƒCƒl÷»¤Ýé. ˜gžÀ…NnÅþ~ìq¿ÑÉ¢W£ú²ÈGâ“Þ̼ôëÃàçƒÆ‰pøàá”_ûF"8Ö;rȧ>"d“ôÑdÇFá/¢p¬ÓOï':߀ªê«gt»ï'ÏG¹¤—KPÑùÎÜ›Ë ÊK¡Úé£íí'ÚyžIp²¾ðŠbª_U¡áå¨*pèëíK¹˜JT›¯fw j÷Ö½ÑÕ¶$Ip?ìFÛ;m€¶cm÷³|÷‹ÇãÀÔ­ êM õÖô#:Sæ6²~³3){¡ù\0·úÊá?FýKõ rI’àÞè6ú|Û±¶”>Ÿ×‡ïy®³|Ó,äúi¦î·uhxµÁXi¨ûLwAý:›ýÒ] ÌÚ/ß>?“ï> |:°dÛÁÌ–'·@*‘ú*„ήNx* ÿÐÉv_úíNwXÀ¼|ùò¤G"8ÍgE8Þ~ÖV¸\ú/bË=å)_—Ì•z˜šÎ O‡Øµg„Xµfl’ Çÿ+yù95®âÊ¿®äTIr™ ŽzàætË@Œ0üM^H6+jjCÃÿê€g›Þ.Äo-ûzp´¡¶¼ÖVÔµz ÎK¾u èÓ(D±@8FË-)€CM‡ðSÏOQî.ÏêxÇ;ôº]µf¤û$ôØŸ2rQý\5\¹ ËrVÇôg„¿g5ºœpªãÚO¶ë+¥ØeX‹¬÷³|ö“e¯4b“gä52eŽ´#:éê%ß¶5+{!ùÌëƒp†2! V ´¾ÝŠî÷ºçåÍ~ÎzùË)tœì€ѫє>Ÿ«…¨³BÒÌ·_›9ðÚxñ`í×bå}+ÑßÛ_P¿Îf¿¹®fí—OŸŸÝg¦,µv0ý6ŠæƒÍ)×T¶ûÝÝîtûYb±˜Æ;‹ÝÝBáp=pÇübWQ¬¼o%b£1H¥¹÷ÍÁϱŷ%§_ß-îå²Ó½‰}žíN´~Ä* ¥¦í6øžðå,+×cÍöíð>æ½gêë^.;Ý›ØçÙîlwZlE¬ZJD±€½Ä޾þÜn”ŸŠ£ò—•ûn Îè~ïÞ™Kv/—îMìól÷™ín6}7¡ùÂ)DDDDD&8%ƒˆˆˆˆˆ3-´P8Ë2 +‚õ¹¸uda-uŽõ!ØVDÄ€™ÌßÐgÞ±)±ìNâï™ÛçÚ'q‡0³!i¿bïf/‚çƒKº^Ò…YÕKåKìW³·Æx®ü‘ò¤ãÏa±XÐüzsNyI¼~v9ÌÊ·P¢W£ð<îY´ý³OÜËyY¨24¼Ô©T‚(IçÆBô—Èå¾ürQË=×¹ÉþBD ˜—’Y?2˜y³—h4j<÷åà—@ÒÞ&é&1j‡V¡ÆTÔÿ¾ÛŸÝŽ‹wXÕeQ/y”/±>f4…r=y¢þÞ~¸7ºµG³ÍKÏ™ž%SoÊ ?»¸hûÑ«ùõf \ÀHh±ïc)7wºúËR:7‰ˆ3͉/5«VÝÞ|,*·U¢ñ•F´¾i~ç¢Ù£Ö³GIEAÀ€$I$ u/ÔÛ‡áXï€$Iè8Ö±$Ë—PñH?Do?|Û’„îÞn4¾Öˆ‹_\ÌiMO¹D6–8šsÕ§rMw«¢xzt=r9blŸëf!ùî×w®.§+)o=4lN±Åž OR©ªŠš½5Æèe`O à_©›õAhy»R©©TBß¹¾¬Êž(GgW'äûeˆb–·ó¿±ÉÌ‘MIÊ>/‰ý\\ì Àáp$•o!ê³í6´¼®×™ÛŸÞ¾ ýÌ´Þ.…àÚ ßøÁ»Õ›tkáÐ¥\N—1 žËèmºsóv´ƒ§Â£ßýí&߉0ðaØV ¬] œhž«YÙòTx0ðYa#̵յ€ÑoG¡|¯À»Ù›´­î¹:(Š‚èõäÛ<'Þ”f?ÀåtAÓ4ýߛڢ”Ϸ͇ž3=è9Óc€þuñ•+Wàû¹Oe>ןõñý;ýèz·+åù|Ë7W}Æãqx7{1:¡ÂSáA :ôfžn$<ßý*Ÿ¨Dt,ŠÐ¥[ÇM}ÄnæëœP'T8Ö;ÐÐØ0]†ßÔbìêF¾ÑG/ãq456Ô'Ìú`¢œÊ5õÏ×£éÕ¦¬Êžü(8=Òzë¼…öOEÉ=/‡B×É.=r4itt¾ëS¹¦`ll î‡Ý)ù^¨~ffמ]¨Þ] UU!Ë2^žîK»ªwÁ¿ÓuBÕoaœƒtçæBµƒY©{¾­GZ!¯‘Ñ|°™7Ù º“Åb1 °®LÓMû…OÓzÞ×´Oo k4ë «ñh|¥1y{’’K·ÍfKÚ–NºmáaÍjµšfö~3ó4ùä@ýv4e¿X,¦ÐýçÂ'RÊ’/³zÉ»|ÿÖ4÷F·VñhERúoµ¾¥mþÙfMÓ4­þõZÕŽª¬ó2ùäæÞèNûš\åRŸÃ_ kÖÖŒù,d¿}¿ÝgôÕ³œÕÜÝIeŸ™Oûj{R é\¸ •••å]/f}pf;団?Ì.{bßtéæÝgóÈKb¿D; ‡¦·-D}Ž|32ç5dÁûÙ¬ã¦ë󉾔ïõ%—ss1Ûaä›­þwõšÝn×ü»ý|ß$ºñÆ%…JlÀ7ð`9°,õ%¹ÌA.dŸÙÆÇÇa³Ù (Ú˜þõæýrjÚ×lj5¼m%¶E¯úœÊ·Lÿµ¾ûÁ䑵þÞ~cÄҷՇʪJýëÓe™“ÅŽ2‡1?º ²d¨ÏîÓÝh:؄ȕ[_uOe—n¾ûvôi¯7£ëÝ.øwú“¶ÏÌg"ïc×õþ²é'›’^k-².HœÙ€"ýƹ”Ý,Ý|’ím QŸ‰óEUÕ´7{XÌ~–®Ï'ž+ôú2×¹y»ÚÁ¾ÚçƒNÈ«e„/…ù¾It┌BÆ€¦fàt'ðãµÀã £}Idmàâ<šÿ¢]%¿iÆoL¿ÉÛívú/ãSÞxo½%æ&ÞàŒtg®ò1ã±ØåKz³|¯^;ô¡äü§çÑt¨ –elñmAüFÁ¿g¿ºˆßŸ~ZFÎŒI}*Š‚güÏàè‘£P'T\^H ÆÒµc!û€çqâSq üc=½ÉÓ1fç3‘w{‰Þ_b£1¨ªñH¼6Ÿ>aÖÍdSöÅ’k^Û¢>¥R v»C_ Í[Éw¿t}>ñ\¦ëK>çæBµƒ™Ð¥êöÕaÕšU~ÄÑ#G184È÷M"Ì÷ b¼P\Žû°I@Mí‚2it?<¹ ôõöáðŸ£þ¥úŒ#V«ƒŸëñ®Ó]I£4U¿ªBÃË úˆ÷­t#?î‡Ýh?¦8h;ÖfšÇ9óšÊg¦ÿ¯ý°—Ø¡ÝÔŒ‡ï>t÷f›]ß/|ø´ð•HÌê3S·Þ¸o­ï¤þÐÑf³SÉe¾û%Ôì®AíÞZ¸7ºSFbùl?ÑnÌýÅþ~ìq¿LD¯Fõ=åÙ'Ìú ™lʾXòÍËBÔ'Ôý¶ ¯6@Q¨ªŠî3Ý ÞÏìv;P„¤`Q’$¸7&÷ùD_Jœmï´¥½¾äsn.T;˜ÙòäH%B_…ÐÙÕ OÅí_‘ˆ0ß~[½@o02’ù"<Ç/ÎgnŸ½sÂòåË“‰`רo¥@ëÛ­è~¯;ãZ–7ZPùËJýµ³¾¢<Þq°jÍ*H÷IèÿpúGq§:N¡íX$I‚Õj—*̪^r(Ÿ™žÞž”3ªž®2–—Ë”—ÄkrY–ËÌ\õ)Ë2_iÄ&Ï&Èkd8ÊiG«Ÿ«†ë!—±Öw¾û#t;ýN]ô©¢X £åéÕ%Ž·‡u….—¾òA¹§¼à)+f}p.Ù”}±’—…¨Ï¯€çÖþx-VÞ·Òèï ÙÏD±À¡¦Cø©ç§(w—O÷ù¿œBÇÉ!½MêK§:N¡ýd;$I‚l—sžŠ2ûܼíý6ŠæƒÍ)çÝy,±XLKÌ#"JP+ï[‰Øh R©~…CxÀõ4McÑ¢ü|[|[¸ÊÝ6a.èã†eîÑ®í6øžðÁ2Ñ¢~`»¦k)·Ÿh‡÷1/+…ˆn®’Q޲- f?tš·yÓ÷Z ØKìèëïceÐmŸŠ£ò—•ûn Îè~¯›•BD· §d™à” """""ÌDDDDD ˜‰ˆˆˆˆ01`&""""bÀLDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDD ˜‰ˆˆˆˆ0Ý£sär’$±Fo³…h¶íÒ¨—B ‡`Yf¹«ÚÖ±Þ!,ËmÍG(ºíy "¢Û0gófàX(‹’éíÏn‡T*¥¼ù‡Â!”»Ë!I„ðTx0pq  cI’ŠÁÏSŸ·,S¹<ýwÀ¯ÂbI.¿jÒòL(V ~S®Ù[c胢(PUU;ª°ýÙí…ë€È•Yo˜Ñ[ÛÊôƒçðåÔ}UU$=ªž¶¢zwá底(”ë diiQn(¸øÙE–¯ÀëÝes¹»\ÿZ4͈¯ÅbAóëÍ$ R©„¾s}3J5{k •JÅ=¨jæغêàügÊó’$A¾_6ÒŽÇãírÒk"‘\NWÖes:ÈU z°XtŸ¢ßeeV`€›@ÃïU´¼)LÓ‰Fž3qÔ<'òÎKBÅ#ü|ý½ýðmóelh;ÒY–!„€c½ƒŸfµ-ß¶ ] ÁåtA Ôì­ÉjôL¹¦À»Õ Q, м›½ˆ\ޤ³³«òý2D±@ËÛ-¦ÛÌÒì;×—Rÿ=4lλ^@‘ô˜ùíL¾}>ßv„c½’$¡ãXGVi€¢(øzš’„ºê²j#!6•o¦¦ë!›²›Õu¾æ:^!}׬|Ðòv ¤ÒÔ4ó¹žÑ]0 füZTQÔ?_¦W›ŒçjS‹±«cùf±ïcˆOÄÑÔØTP^"—#ÅË—/Go?>þÛÇÉo¢qá¯ÃÙÌë€ÈƒÿØW[14¤"rp­»õùŸ*|Û»Ý<öc*Ü­(w矗ß6zÎô çL¶?½=c;(×ìq?ú>胪ªødR‰”q[!m»«zü;ýP'ô.ÙˆÇãðnöb$4uB…§Âƒ@u åuÁ‚ é}Æ·ÕgºÍ,ÍÊ'*‹"t)¤ï|è9ÓƒÀÎ@Aõ¢ªªñ¨þu5ªvTÜçó>ǪkQ÷\EAôz4ë4k«k£ßŽBù^w³7«6RUUO³hº2•=S]ç+›ºÎµïš•/Q?ʵÔ4‰ˆè‹Å´L†CÀ̯)BÚý&˜ÔÿþjX³Z­š¦iÚä“m84l¼þÂÀ­¬¬LËFºãÍû>¦mþÙf­þõZ!NujZÕ¯&µCÔ¾ŸOjoµjÚ¾ç'µÑo5­lݤ69©iÃ!Mæ®KûêIíø”•évø·¦¹7ºµŠG+Rê!]½Äb1 EÐNý÷)£-²Ù–oÛÆb1 €–è[>¹`ÚVs–÷«aͺšrÌÑoG笛tÛÌÒÜ÷Û}Zã+š¦iÚÙÎjîî‚ê%¹ïœÒÊÖ•û/DŸ/´Ò¥™Èg¦ºLWŸ™ÒLWölê:×ë“Ùñ¢ÎÌÒœëÝ^‹2‡YßúÚ²ˆOé#6c×Ç›~²ÉøzwË“[0>>>/Ç”J%4¿ÞŒöí¥ãtês˜‡†€ÀNÈwúˆ³kÀþzÍMÂ|6úzñqÀ¿{ž*t™þc-ßS¾ìêB’p¶ç,ÚO´c媕p9]žfÜ–oÛŽ_7Ò[‰-ëôºOwõAÿ:|“Gÿê{¶Ä´›tÒm3K3°3€Îw;]ïvÁ¿Ó?/õ ‡ŒQÓD-dŸŸÏv3­çlÚ(%M“²Z×¹o¡úî\iÑï¶ýèÏ^¢ÏaˆÆ N¨Æc¾±Ÿít€9æu¸$ŽõúÔ‹¡Ïõ@zà"°ë+°X<àÒóm±(ÍšeÑzDEõnd ¬sÑý^7¼v ë×Wn«Dð|jLŸ&ØÈj[>AF¢-AH&Š¢àÿ38zä(Ô ‚ :2¥éy܃øTÿ@O¯>£ÐzQ'TTþ²GÿÏѤ9Ò‹Õç mû­ùEѫѼÚH‰œÏ÷Bú`>Ç+¤ÎÒˆˆ0O3æffóC¥L#1þ~ìq¿ñæ½E÷éî¬ò‘Õš™—¾s}Æ…EÁჇSFa#‘ë9ä°¶’[Ö#ÀÅÏâp¬¢W4M‚¦Ié#Rš&Á5ã÷;‘ËÀù’ì—o^ò¯)èëÕç‡b€"ÀjµfÜ–/I’à~ضwÚmÇÚ²ÿp3u+ع ´¾Ó:?˜2¤Y³»µ{káÞè6FU ©—]{vÁ·Õ‡€?0o}¾vh?ÖžS;ˆbª_U¡áå¨*pèëí˺>m60•p›•½Ð>h·Û"}Nv¡uMßMW¾BÌu=#"¢;4`^¾|yÒ#œfúåø\Ž·‡u….— B”{Ê%Ó2åãPv IDAT‡¦¦óñqìÚ³ B¬Z³ 6Ɇãÿ•¼\“Wqå_Wrª$Ç:=P€Š Ž,ãܶc*Ü'ÿد¼˜:&ípøÍÃXyßJ!Ðu² éÌj[¾m{ªãÚO¶ë+—ØeX‹2@²,£ñ•Flòl‚¼F†£¬ðÙ¤éßéGøëpÒèr!õÒó{Ðq¢#i¥ŒBû|!íÐv¬ ’$¥¡fiïÐÏ›UkVAºOBÿ‡ýY×§T*¡ú¹j¸rA–å¬ÊnV×Ùø‡šá§žŸ¢Ü]^p]gê»s•/_s]ψˆhé°Äb1wq£…4øù ¶ø¶@¹¶4׌V+ï[‰Øh R)Ϻsú.-ޱ hA‚Ðk Ba}¹¶öíð>æ]²ym{§ ¾'| –éŽë»DD´8ŠX´âSqTþ²cßÁù Ýïu/É|Šb{‰}ý}l4º£ú.-NÉ """"2Á)DDDDD ˜i¡…Â!X–YX¬ÏÅ­# ëh©s¬w@Á¶""Ìdþ†>sy±Ä2T‰¿gnŸkŸÄÝÃÌ„¤ýм›½ß-m¡ë%]P˜U½äP¾Ä~5{kŒçÊ)O:nð|‹ͯ7ç”—Äëg—ì| %z5 ÏãžEÛo1ûĽœ—…*CÃK J%ˆb‘tn,D‰\ŽàËÁ/µÜs›ì/DÄ€y)™uã™7{‰F£Æs_~ ¥¿YAÒMb&Ô­B©¨ÿ}=¶?»ˢ^ò(_býÝh4 åzòaý½ýpot£¿·?§¼ôœéY2õ¦ÜPpñ³‹‹¶ݹš_oÆÀÅŒ„Fû>–rs§»¡¿,¥s“ˆ0Ól‘ðR°jÕíÍÇ2ýVï4¢õMó»å͵ž=J¢( þ$I‚$I¨{¡ÎØ684Çz$IBDZŽ%Y¾„ŠG*0øù ú{ûáÛ– t÷v£ñµF\üâbNëíÊ%²±üØ|˜«>•k ¼[½ÅÓ£ë‘Ëcû\7 Éw¿¾s}I·ô€Àžš6'Ø‹bO…'©ÎTUEÍÞcô2°'PðëÌú ´¼Ý©T‚T*¡ï\_VeO”£³«òý2D±@ËÛ-yçqæÈ¦$eŸ—Ä~® .öàp8’Ê·õÙöNZ^×ëLíOo_Ð~fZo—BpmÐo,ãÝêMºuyèR.§ËÏeô6ݹy;ÚÁSáÑï.y“oD ˜ ø0l«Ö®N´ÏÕ,‰ly*<ø¬°æÚêZÀè·£P¾WàÝìMÚV÷\EAôzòm‚oJ³àrº išþïMmQÊçÛæCÏ™ôœé1@ÿºøÊ•+ðýܧ2ŸëÏúøþ~t½Û•ò|¾å›«>ãñ8¼›½ @Pá©ð PHz3O7žï~•OT":EèÒ­€ã¦>b7óNˆÎuN¨*ëhhl˜.Ãoj1vu #ß裗ñ‰8š› êf}0QNåš‚úçëÑôjSVeO~œiÝê›—þ©(¹çåÐÁCè:Ù…£GŽ&ŽÎw}*׌Áýpê­GªŸ™ÙµgªwWCUUȲŒ†—§ûÒ®ê]ðïôCPõ[²ç ݹ¹Pí`Ö_ꞯCë‘VÈkd4læ pˆîd±XL£¬+Ó4@Ó~áÓ´ž÷5íßÓ›†CÃͺÂj<_iLÞ^„¤äÒíc³Ù’¶¥“nÛphX³Z­¦ÙŸ½ßÌ Ùoßo÷}õìg5÷FwRÙgæÓ¾ÚžÔ_†CÃF:.heeey׋YœÙFùæè³ËžØ7]ºy÷Ù<ò’Ø/Ñáém QŸ#ߌÌy Yð~6ë¸éú|¢/å{}ÉåÜ\ÌvùfD«ÿ]½f·Û5ÿn?ß7‰î@¼qI¡ÆÆ€°Á §ò-Ó­ï~0yd­¿·ß±ômõ¡²ªRÿútYæ$E±€£ÌaÌ.¨,ê³ût7š6!råÖWÝSÙ¥›ï~}ÆëÍèz· þþ¤í3ó™ÈûØu½¿lúɦ¤×Z‹¬ Òg¶ H¿éH.e7K7…äÅpkÛBÔgâ|QUÕ˜Rq»úYº>Ÿx®ÐëË\çæíjûj;œ:!¯–¾æû&шS2 5ššÓÀ×{€Žö%‘µ‹ðr(Ÿ™þ¿öÃ^b‡vS3¾_øÐÝ›ý­}¿ðaàÓÂW"1«Ïx<LÝzã¾ ´¾“úCG›ÍL%–ùî—P³»µ{káÞèN‰Mä³ýD»1÷W øwú±ÿÅýF0½Õô”gŸ0ëƒf²)ûbÉ7/ QŸP÷Û:4¼ÚEQ ª*ºÏt/x?³Ûí@’‚EI’àÞ˜Üç})q>´½Ó–öú’Ϲ¹Pí`fË“[ •H}BgW'<· G"bÀ|ûmõ½}ÀÈHæ‹ð¿8Ÿ¹}ö:Ì Ë—/Oz$‚]c¿•­o·¢û½îŒh!ZÞhAå/+õ×ÎúŠòxÇqÀª5« Ý'¡ÿÃéÅê8…¶cm$ V«u^ª0«zÉ¡|fzz{RV̨zºÊX^.S^¯ÉeY.3sÕ§,Ëh|¥›<› ¯‘á(s¤9¬~®®‡\ÆZßùîgŒÐíô#üu8etЧJˆbp8Œ–7¦W—8Þ~ÖV¸\úÊåžò‚§¬˜õÁ¹dSöÅRH^¢>¼vžGÝçÿr '; „@ôj4©/ê8…ö“í$ ²]Îy*Êìsóv´CôÛ(š6§œ[Dtç±Äb1-1OŒˆ(AQ¬¼o%b£1H¥ú5"á×Ð4D‹fðóAlñmá*DtÛp„¹ –¹Dw¸¶wÚà{ÂgËD‹úíšb¬¥Ü~¢ÞǼ¬"ºm¸JF!8ʶ$˜ýÐiÞæMßkuZ,`/±£¯¿•A·E|*ŽÊ_Vbì»18t¢û½nV Ý6œ’ADDDDd‚S2ˆˆˆˆˆ01`&""""bÀLDDDDÄ€™ˆˆˆˆˆ3f"""""ÌDDDDD ˜‰ˆˆˆˆ0f"""""ÌDDDDD ˜‰ˆˆˆˆ01`&""""bÀLDDDDtÌ‘ËH’ĽË8Ö; „€ÅbÉ»ÝCá,Ë, ž×;¥.Å|.Vݵs(š3`šX)в(™ÞþìvH¥Òœoð ¿o€T*A lv{AÇ 8ÛЦæáþ ~Áv¹G›ñ<™~‘ ´íëC`}j6´¡óÍ‚Ë.„0ØÄÿ:¸ûrðË%ÑîÙ÷så%z5 Ïãžy=^¾i.vesþÞÉîöòÑíWt'fÚû˜þ~<óì3)Û¼výöcp`PL®˜Èe6D¿‹Ãáž~N¹¦êÛVÛ‘º´û¶ BãøWuˆßPq ª ²ÃïWÞùQU¡p<ôTUeÎ’rCÁÅÏ..ù4‰ˆˆhé™—)åîr}ÔsÖˆobä§ùõfH’©TBß¹¾¤à¯fo1ØÈ*¬{¡Îÿp¦Rµãè‘£p¬w¤Ò䯾#‘\ÎìV‡Ãåª%ªb»Ü‚ÁsŒ7ûj)ãÇàé0ð@@*Øþ\‚§ÃyçÅŒY]üc‡#éõͯ7C¹¦À»Õ Q, м›½ˆ\ŽÔî08¤`‘$ Ç:r*CÒß·ÒÎÔ—Ìò"„À¦òMÀr•o;ÒY–!„€c½ƒŸf•f"¯]ï—!ŠZÞn)è\ ] ÁåtA Ôì­™—éfmdvnšåŬìfišm3k""¢;&`4ýÚEAýóõhzµÉx®ö7µ»:†‘oFû>†øDMMyçC¹¦`ll ‘Ë8z ð’¾þVã*Â_‡³NÓ¾NÂØØ8"ÿƒÍ.!|)ŠèwqÈ›ñšw;jœmhû}‰x_¹¦"~C…}µ -ûôÀDZAB4<–w^²®‡Yuíy܃x<ŽÁ¡[ÆM §·Äãqx7{1:¡ÂSáA :Pp»×V×¢î¹:(Š‚èõè‚–/S^TUÕ·éÿÏæC™rMÁþ÷£ïƒ>¨ªŠO •H9¥ü(ˆ‘Þ·}[}+»ªwÁ¿ÓuBE<Ï©¾\N4MË©ÌÎÍlò’®ìfiε-S;˜•ˆˆhÞÄb1-“áа ókŠv¿É&õ¿¿Ö¬V«¦iš6ùä@ ¯¿0pA+++Ó²‘îx#ߌh´úßÕk“““Úä“ZÕ¯ª4ÿn¿–¯ =ÃÚ[¿>«½ßzA{¿õ‚vh÷ûÚÙ¶/µãMk“?hÚè7zýžŸÔíx_;ú»5MÓ´Ñ‘˜VeK›ŒMjõ?;¥?÷MLó—Õ •k]kš¦í{~ŸÖØÔ¨iš¦ýà¬æÞèNŸöWÚu…5ëöO——X,¦Ð}ëÂ'R^“M?›™v¦òÍ•—l¶¥‹Å4A;õß§Œcf›f"¯£ßŽÎKûå[ŸË7Gšfçf¦¼ÌUv³43/C;-´EYVNßúººˆOé#Rc×õ‘ÖM?ÙdLØòäŒç}ë +àÐé_“ Ô¿Tþsýy§)¯“1vu‘*ð<íÄøÕ8ÆÆÆa/³Aòz}´K*üÁƒÁs᤼«@Ëy}Ä6~#ëŠÅ¯kì çt çLªvTÛºOwõAÿŠ}“GŸfPˆñëz&V‚°•ؼ|óM’$œí9‹öíX¹j%\N‚烹õûåy)ßBÔ§Yšfçf¶y™]v³4ͶÍG;ê¶­Ãl/±ë#Ü£1¨ªñ(dõY–@5I ½L‚òÝ8Æ®ŽCvH°•ZŠBv¤YlÆœf©TÀºB òõôWÝ‘K d§ý¶Ô·çq”q¡K!ôœéA`‡Ä+Š‚güÏàè‘£P'T\^H DEQn+q$‚¨D[&‚¬ŒÁâ¬ãÄoÌ_@œk r[%‚çƒPc*ª]Àž@Áiæ#ßúÌ7M³s3ß¼˜¥™éZ©ˆˆˆ–TÀœ˜«™íÝU>Aðì¼øwúÑôÿ47õm­o¶Â÷”o:hDŒf—O=¶Iz îØ(#üEŽuv¨ŠŠhDÏ»ª¨è|kå[ËŒ}½;œè|kªªÏiî>vÞμóR¨ª§«P»¯Ž2‡qÜx<LÝ hn­ï´¦;v;P„é9ÐH’÷Ãn´k´kË.¨Zm‡Õj5~ÔÕuºkþ‚N› ˜ÒûX6”k úzõy³X¦÷«ÕZPšùJÔgÛ;m9Õg¾mdvn曳4ͶeÓDDDK*`^¾|yÒ#Øä» Áñöã°®°ÂårArO9†††²ÊÇ=LMç)áhëQDǢò¾•úsmG§ƒí¸Š+ÿº’S%ýÿíh[ç¹Ç¿¾¸pΰáœâ i¤E*É¥òÒ9ë¨ÔtÔJ{é•ײÚËÀ’¨ìtÔNné쬬Ž«^¶Äw¬/tµS¶Ø4±ã\îVzg§´W ¤“<’‹–™$œ#âà#šÀ{ÿ89Ç>¶tôãHŽ“>¶ôê}ßç}žç}Ï«ç¼ç}íέê-f—ÛTâC<2``wAç:¾\ ‡ÐÁ¦¥É{Ÿ¢À¡ãñ!ôüà(¼/¸ [Ê•"K©º€`kgÿzÖ°Ãn·£÷½ØæÝûÃv8ά“þ¾~<å} d=:Š¡÷‡ ŠbÁžçqø×‡Ñôb¼oQwòéEÜ "´'„úÇëa·¶TâàoâÁo?žç1~lc³\f©ö=:Š‘c#Ev›\µõI£™Ìúf©²˜•i––ÏAQiª$IbtBAÜ;D¿ˆb‡‡å=Æï7Y‚ ¢Rü©€ Ö?ò5ñ¹8`äƒø¶ûH‚ ‚X#ªI±þÉÜΠéÅ&Ì5×&>œ Y‚ b %AAa-É ‚ ‚ š0•&>GÕU¤‚|„žŸ÷¬ÚŹ٠žçQUEºú¦‘¼˜ÄݸÃK}Óz¿%hÂL”{PªªÒ;ÏóúöcÚûåé¹òh§¿iiyëªåákô­ÛÑ4YWÚ+ÛÞðDâ_ÆõteAA0_ËCÜ âÀ›ô´è¹(¼/xž‡(Šhy©¥$ûè'í婯Ð2½O{õä4¦?™FUUÞ(J_í¯´ëŸ5<Ñ`Ð]®2óù™öý\¶XË kêr Þ§½k–o­üZC–e DâB°w|òb‘hdÍôy7l{·ÆbúßÝЋs³3ça]¥øõý`ÛõÖ¾\ýÖŠœc3ŒÍÁÝAˆDð<ßs>ÃÿŠ¢ ¸{Ùõè—,§ÝïþBæ{jùa/©TJÿ,ÕÈzŒá˜¥ˆª(’‚îŸu£å'-˜=;{ªOrCïiÚBmK¿òßèAFÉ@º*!O`êÌF~?ÜšüMèzµ Š¢ ÂãñW_]笯ˆ6x=^´ín3¤Mš‚{«S§Š;²]Û—8•JA¾.Tf>? Ÿ ¯»Ë7eœýììšå[kÒ×Ó@uiG¦¯¥>ï!¸üýï^éÄúï·ÁÝÁ¥±y®M.$âêļá±é¦=oô }- 銄øù8ÂÇÃúžô¥¦E"I#ÊD"ÁØþnÆ1ÆX,cr~=1Tcõg9ò›vhðkþQ³©È+ó­”I’$h 0A˜ ¬s_§ž‰F˜c“ƒ ‚Àº_ï^Õ–|u®¬k¥,‘h„q5œþž«áX$Ñßþa”y¶{X"‘Pó}]œ¹òÙ'W}Å”¹² Œ1æØä`'Â'ªÁ¤«RÁrv¾ÚÉ"ŸGØð{ìs_§Awfešù™ÿy?‹Åc9m‘-¯¹|Bº*±ÆgWÃ1®†cÏ4²Ä…Ä’®9ŽqÇèÿ[É795É\º ²vXÿ¯úõ¶…ö„WÃ1Ï“ƒÎYhOˆ uãj8Ø`‹‹‹%ûµ™œù|1v>Æ\[\Œã8Öøl#ÓÆëRõRªmµ<ýûÕ± N`“S“yeÑò¹¶¸X`W€9ÃRn][éVô’­¯™éŒ1ÆÜ[ݪ²Ô•Ï_JñA³ñÚ̱ó1æzÔŸŽ…ö„²ê{tl”Ù6ÚWñCƒ‡ò–i–väwG˜ÍfcÇ1Ç&‹|±<.•*g%ìPè5h¥ï ‚`ÐÅð{ìñ™FKifrzžô°ž(úºz?Cærðçià…&à‘G€F€=íëB,¯Ç‹ÙϬE˜;B€+ÿ¸ùª _£ÏÖµ§ ²,#uÝx<4_Ëg}@½«Œ1õï-–½â[Àø±q¸uéQÕÌÍ ¶,4èr¹0÷÷987:!Ô hïj7,á°‚Y}s ö)N^LâÒ¥Kð?ïW£\g rù_ð#|2Œðɰaɉ•2­ŒÿiõäÙ(‡¿dó‰L&_£Ož,¨‘¿`(˜7^j¾¦g›šO-ùÃ-5šl ¢9Ê‚çf'zz{–ÚðÓÌ_žGâBÒU ™… úzû,ùu¾H.Úv·!´+EQ`·ÛÑóF%½X±íò[ÔÝûºÑ÷f_A²@ÿ[ý?6Ž#ï1ÜÕ¨„®KíVõRŒÎuY®¥8fö+U/fãµ™ÚBm´ ,(Èd2YåþË4q5¯ÿ9Þ2s¥É×dì}m/NtŠ¢`öÓYˆubÙlT¬œ•°CÁw¿8÷V·~=J§Óp:œÔ¾åv»qîoçJNË'g×¾. ¾3ûÃv ¼5@‡SQ„¹ lr00öC?caã¯1í×›yáj8Öû‹Þ‚"ËóD¬³¥Åâ±¼¿ˆÍ"$‹7våWVå“$‰Ð#^3ŸÎõ‹ßL­Ýží;Sƒ÷¦í‹Åc¬ùGÍ Õj4+]ßr]端2Q æÞêf‹7 Qí×}÷þnÖ¼³¹ð(Ö×jTÊó¤Ç`§|ešùÙâEæÞê.:b“b|"v>¶*òWˆ Åäë|µSïo“M2÷V·¡íËå´m´|~¹ÿÌÌÎ0‡Ãay¨0k_¶þ›MŸšœåÒg±}SóåØùÜ}a¹,+#X±øRZ%t]‰þg5Âl¦³¼>Q&û™õM3;äëÓZW^#ÌÊÌ[_5ØèF v+—ÿ#g%ìPh„Yº*1›ÍÆf>1\¤«’aã8®ä´‚oœ_H°î×»™Ífc]oôt.±Êü¤ Ÿ0Yß\Œ^ ‰0g³C¡敘•™Ïî:_3vèׇrÞU)G$·YrÙÈÊX`v­ ´Xç«Y¯Gå^Üïn^ç«L¨X 5Àffgh 3…ˆ-RËÿÖ\Lÿý1 ˆ@{GE«4ìêm-ä-àô©Ó8øïÑýó9ŽÓ£±ãÇÇ ‘‘æ5£ç5 {§\-âàþž#ï«»F ½?d*c1ë6ÍÖÛöõ÷AQÔèÑàoѾ«©Ë) ½3¤Ë8~l|U¶\õ5¿Ô\TM/4AN˘þdSÿ5[ ìÓ_þú1qªô£¥ËQ¦ÿ‡~ÌþÕún*f>‘Éd€Û€­ÎÜß\•_à6 [)•šO£}W;:^é€{«{UtI“säƒ}=#_Ë#ÐÀÞ×öêÛ}¥.§0q|¢b~ 6› ¨†Òõ¹Õ¨OMN«z)'…È’+òZi]Wºÿ™ŸVÉe¿RôbÖ7Íì åzw(ë8_ŠmÍÒäk2NŸR×/ã5úZè]½R£ÿf>XÌu¸Pÿìùy¾[VødØp­:ðæ¤ÒúÏÕzì  ï—}PÔݶ;ˆö—Û-¥™±ã_v@¬?ÇØø¼ž»¿u'E˜ïG‰¼Ì\Oßêkð–ÿj]±på+òyĘïΓêZÄ'ÚSÉž'=«žž6Û%#v>¦?u½òéérF–Gšw6«këÖ½¿[_ï¥?¥Ïqúß‚×;fѵV_ 5 ®‡Ôhö×Å·¡ÿWýÌÿ¼ŸvXhOÈ6<2œwͦY„9_™ùülyT£ÑH3ŸèýE/ãj8f³ÙXo_oÖúB{BLf³Ù,çÓäÀŽ Y¥Ïî×»sî’ѹ¯SRß¶Ñfxö k˜5?á8N_k¨É¯ï’ñL£AN+z)g„ÙL³s%t]‰þWêø™Og…ìÀP.ûåë›fvXž¯{wÖW²Ž×&eæJ“®J̳ݣåî­î²D6K•³k˜C/ßÙ‘ƒã˜k‹Ë°ÓÊë‘öL&g`W@¿þõöõ?4Ü?IDATZNËá'ŒTI’ÄîÆICq/1qr¡œž:M¿´ï!dYƃß~Ò âuœ‹ÏÅñÝúïB½>Q(Ñ/¢ØáßA;&ßHè¡?+˜eKãûŠ–—ZàÜèÔ·¹#î †Þ‚ÿY¿>Y&¢È×Ômèê]õù`İMAЄ™( š¯{´£ ³QìzȆ'Ê^f%ä$îè´–‡­Î†ÓS§IQ"™Û4½Ø„ù¯æáÚâÂć¤â -É ‚ ‚ h— ‚ ‚ ‚  3AAAЄ™ ‚ ‚ hÂLAA4a&‚ ‚ š0AAM˜ ‚ ‚ ‚&ÌAAAf‚ ‚ ‚  3AAA4a&‚ ‚ š0AAM˜ ‚ ‚ ‚&ÌAAAf‚ ‚ ‚  3AAA|C'ÌÉ‹Iˆ¢H½Ïpnv‚çyTUU•l÷ø\UTU\Ö{Å×£œke#‚ ‚¸o'Ìñ¹xÎ Óò‰•,Ëk"tËOZ n³^à§?™V'yµí-k}¥–¹Ö:+¤ÿÞËÜïí#‚ î‘ óz÷݇áßgŸàîâÀþP¢€ƒÿ~ÐR]v‡€ÔWÃgò5unß(Æ’]ú«á_ú÷Fú§!§3>ß…ÃÓ!ÌžšÃôñ¸%yEQ'°ÕêÿV|SoÊ8ûÙÙu_&AA÷鄹ÁÝ F=WD|µÈÏÀÛEâ§Ïœ6LþÚ_i‡¸A_Ë#¸;XаëߺàzÔµêóÔå濚GûËíê÷^íÂÔ™)Ãw’É$ê]õ·Íé _–!§´Ø#z&‰ôWiØ6Š@µyÞéãsî÷‚çq–=LŸ+Y3Ìt=û?³p:Æ Þ€|M†ï9øZ|-_£É‹IKv€è¹(œ›EGß?ZT ïï”Ï—ÌdáyÛ¶·QTT~è!Øívð<çf'¢_D *S“ul| ö‡ìàkyþÖúJüË8ê]õàky´¿Ò^–åf62ë›f²˜µÝ¬L³43;AÄ=3aŽž‹šÞ¶Y–ѽ¯}oöéŸuü´ó—瑸€tUBf!ƒ¾Þ¾²60yÉ8ùS2 æþ>Wp~Û&óói$ÿ6Á&bîËR_e`w úwÚÝ#hw aègÓÐæûò5™› lîT'>ÎÇD¤ææK–¥PVêÚû´™LÑsw&·€ð©0‚­Ad2ø}HÄPx=^CAËvïu kOdYFêzª¢íË'K)QyùšŒ½¯íÅéNCQÌ~: ±N,ªÌé¿L#W}ÛÿœßR_i µ!Ѐ²  “É¥¯zW=cEÙȬo"K¶¶›•™+-ŸÌÚGAeC’$–X<ÆäÿN5²æ[¼±¨¾?cÇ1Æ[¼±È°X<¦fv†9VÙêcŒ1ÛF~o˜1ÆXhOH¯¯TfÂ1vèåIvbp†œaý»N°É¡îû˜-Þ`ìÊUÒÕEÖ¿ó;òúÇŒ1Æ®$$Öl;Ä¥EÖý̨úÙ‰G˜UŠÕ5cŒuîëd½}½Œ1Æ&?šdî­îìeŸ1®†+ØþÙd‘$‰`šoÍ|:“ÕVùülyÙùÚgæùÒ²!IC5ØèFõ: -S“õÊ?®”Å~¥ê3oûr”iÖ7óÉ’«ífeæ­/‚ ¢Ò¬Éf¾öÎíêj s[HÍ_W#­Û¾¿M_°ã_v N[ªkâà þvâ5 ÅÕp–ʳo²cþrÉ¿Éð¾äBúróóiØøZÀ¾Y­GÜÀ#¸ß‹è™9C½<Çãð'jÄ6s3®fíu ÁA„‡á“a4ïl^ÒÙñ Ô?¦ÞbßæU—X!}]µ¡¶„P'T¼}åFEL†'1òÁü΃¨wÕcú“éâ|ç!{YÚW }š•iÖ7 •eeÛÍÊ4K+‡‚ Â*wí¡?[Mp_‘ ,(úËêî^ñ¹¸º6w»/ëZç¢ätˆ¿Jcþrv§a‡ä¹ìÎ,Û‚-[Ó,nàÁÕðHþ}éVwòKv—í®èÛû´rZFüË8Â'ÃîT'ñ²,ãÇãÈ;G ,(˜™žY5å«‹Û‰C›Di¶Ô&Yy'‹+êÉÜ,ß„¸Ø6@Ó M˜þdФ ôrÁÝAËe–B©ú,µL³¾Yª,feæ òÙ ‚ ÖÕ„Y[«YŽÝøZÖö¾¶W¿0¦.§0q|¢ 9´(èJY´÷ò5D°ÕxqM&“pnv!§:D5bìÜjÇÜÿ¦àÜdƒ"+H%UÙYÁØ¡Y4<çÐóúvº0vhŠ¢®ižxÿ,|;]%Ëb•æ—šÑÑ٧éכÉd€Ûw&4·€ÁwWOvl6 Kk ó Š"ÜßscäýÀÐûC…Mª6ÚÀqœþP×øññòM:¸­úX!È×dœ>¥®›Åªpg©ÌRÑô9ôîPQú,ÕFf}³TYÌÊ4K+ÄA±®&ÌßúÖ· /mbSê.Ã#Ãàj8Ô×׃çy4xpîܹ‚äøîãßn/ɤ‘N§ñÈ??‚ï<üx<tuv'Û—þïRQJ²;8·ª·˜]n;P ˆñÈd€ÝaCèøþQp5B›ô|>DCÇãCèùÁQx_pÁ·³Þ’,¥ê‚­AœýëYÃr »ÝŽÞ_ôb›wìÛát8³Nvúûúñ”÷)4¸ ’eôè(†Þ‚(ŠOpxžÇá_FÓ‹Mðz¼E- ɧqƒˆÐžê¯‡Ý^ØR‰ƒ¿9ˆ¿ý xžÇø±qŒýqÌr™¥Úoôè(FŽ@EØmvpÕÖ'f62뛥ÊbV¦YZ>;AD¥©’$‰Ñ }qïý"Šþ¯É$ AA¬ÿD* ˆõ|MF|N=ôfäƒø¶ûH‚ ‚X#ªI±þÉÜΠéÅ&Ì5×&>œ Y‚ b %AAa-É ‚ ‚ š0•&>GÕU¤‚ü¥Dz~Þ³jççf'xžGUéŠX"y1‰»qg˜ú­õ>MЄ™È5¸TUé†çy}û1íýòô\y´Óß´´¼uÕòð5úÖí‰hš¬+ß•mox¢ñ/ãzº²  ‚¯å!nqàÍzZô\^<ÏCE´¼ÔR’}ô“öòÔWP™+ì¯>m€7ˆàky´¿Ò^p}Ë¿ÛðDƒA¯ÓŸL£ªª oòæóAíû¹ì´–ÏÔå¼O{×,ßZù¼†,Ë<4ˆÄ…„a_ùäÅ$"ÑÈšéónØö®Œ/eì›wCgÎÍΜ‡|•âó÷ƒÝ×[ûrõi+rŽýqÌ0nkwUßäyøžóÎPÁÝË®c¿<`9í~÷š0¯%+:ÇòÃ^R©”þY$ª‘õ Ã!1 JU+P$Ý?ëFËOZ0{vöTŸå†ßÓ>´…Ú–.Xoô £d ]•ˆ'0uf #¿nMþ&t½ÚEQFáñxŠ«/‹®sÖgѹêx{³gg‘ˆ' ]•àÿWÁmÐö,N¥R¯/¤S§¦àÞêÆÔ©©U2šù`ødxÝø„|SÆÙÏήY¾µ&}= T—vœúZêóþž×¶oÞ+}…Xÿ}:¸;¸4n/õɅD\˜7<Ö`8 µç¤¯¥!]‘?GøxXß˾Դo,’$1¢L$ŒíïfLcŒÅâ1 ç×cñC5V–#O±i‡±æ5›Š¼2ßJ™$IbÖ ‚À:÷uêi‘h„969˜ ¬ûõîUmÉWçʺVʉFWÃé﹎E¢ýýèF™g»‡% 5ß×Å™+Ÿ}rÕWl™šòÕg³ÙØÌ§3%µ¡óÕNù<†ßfû: zulr°á Õ`ÒU©`ô?ïg±x,§²å5#—¿HW%Öøl#ãj8ÆÕp¬ñ™F–¸X²Ç1Žãý+ù&§&™ëQ—A¶À®ëÿU¿Þ¶Ðžãj8æyÒcÐÙââ" í 1¡N`\ Ç»lqq±dŸ7“3ŸŸÆÎǘk‹‹qÇŸmdÚX^ª^Jµ­–§ÿ`¿:NÔ lrj2¯,Z>× ì 0‡Ãa_Ê­ëJõM+:ËÖÍôÉcî­nÕ~YêÊçK¥ø§Ù8of£Øùs=êb\ ÇB{BYm1:6ÊlmŒ«áØ¡ÁCyË4K;ò»#Ìf³1Žã˜c“ƒE>X³J•³v(ôÚµòº)‚AÃï ³Æg-¥™ÉéyÒÃN|x¢èëñ½E˜ËÁŸ§š€G>ö´¯ ±¼/f?³aîu®üã ä«2|>CZמ.ȲŒÔuãñÐ|-Ÿõõ®z0ÆÔ¿·XöŠoãÇÆázÔ¥GN373hزtÒ ËåÂÜßçàÜè„P' ½«Ý°„ÃÒ-k“ú*aùšŒùùy¸¿ç.I^ÿ ~„O†>6,GI^LâÒ¥Kð?ïW£Ìg¦ .3ÐÀøŸVO^ýrøR6Éd2ð5úÔÉ‚¯Ç‹`(˜7^j¾¦g›šO-ùÊ-5šl "6Ê‚çf'zz{–ÚðÓÌ_žGâ‚iÌ,dÐ×ÛgÉçóEúsѶ» ¡]!(Š»ÝŽž7z,éÅŠm—߆îÞ×¾7û ’úßêÇø±qyçˆá®F%t]‰¾iUgÅèP—ŸåZ¦cfÛRuf6Λ٨-Ô†@kÊ‚‚L&“UÞé¿L/EíŸóç-3Wš|MÆÞ×öâôG§¡( f?…X'–ÍFÅÊY ;|·ñ‹spouë×±t: §Ã‰`@íwn·çþv®ä´|rvíëÂà;ƒ°?lÇÀ[÷Õ¡Vÿàxi "CüIEND®B`‚astropy-0.3/docs/vo/index.rst0000644000175000017500000000156612243255342014424 0ustar oleole.. _astropy_vo: ******************************************* Virtual Observatory Access (``astropy.vo``) ******************************************* .. module:: astropy.vo Introduction ============ The ``astropy.vo`` subpackage handles simple access for Virtual Observatory (VO) services. Current services include: .. toctree:: :maxdepth: 1 conesearch There are two third-party Python packages related to ``astropy.vo``: * `PyVO `_ provides further functionality to discover and query VO services. Its user guide contains a `good introduction `_ to how the VO works. * `Astroquery `_ is an Astropy affiliated package that provides simply access to specific astronomical web services, many of which do not support the VO protocol. astropy-0.3/docs/vo/validator.rst0000644000175000017500000003320612243255342015276 0ustar oleoleUsing `astropy.vo.validator` ============================ VO services validator is used by STScI to support :ref:`vo-sec-client-scs`. Currently, only Cone Search services are supported. A typical user should not need the validator. However, this could be used by VO service providers to validate their services. Currently, any service to be validated has to be registered in STScI VAO Registry. .. _vo-sec-validator-validate: Validation for Simple Cone Search --------------------------------- `astropy.vo.validator.validate` validates VO services. Currently, only Cone Search validation is done using :func:`~astropy.vo.validator.validate.check_conesearch_sites`, which utilizes underlying `astropy.io.votable.validator` library. A master list of all available Cone Search services is obtained from ``astropy.vo.validator.validate.CS_MSTR_LIST``, which is a URL query to STScI VAO Registry by default. However, by default, only the ones in ``astropy.vo.validator.validate.CS_URLS`` are validated (also see :ref:`vo-sec-default-scs-services`), while the rest are skipped. There are also options to validate a user-defined list of services or all of them. All Cone Search queries are done using RA, DEC, and SR given by ```` XML tag in the registry, and maximum verbosity. In an uncommon case where ```` is not defined for a service, it uses a default search for ``RA=0&DEC=0&SR=1``. The results are separated into 4 groups below. Each group is stored as a JSON database: #. ``conesearch_good.json`` Passed validation without critical warnings and exceptions. This database residing in ``astropy.vo.client.vos_catalog.BASEURL`` is the one used by :ref:`vo-sec-client-scs` by default. #. ``conesearch_warn.json`` Has critical warnings but no exceptions. Users can manually set ``astropy.vo.client.conesearch.CONESEARCH_DBNAME`` to use this at their own risk. #. ``conesearch_exception.json`` Has some exceptions. *Never* use this. For informational purpose only. #. ``conesearch_error.json`` Has network connection error. *Never* use this. For informational purpose only. HTML pages summarizing the validation results are stored in ``'results'`` sub-directory, which also contains downloaded XML files from individual Cone Search queries. Warnings and Exceptions ^^^^^^^^^^^^^^^^^^^^^^^ A subset of `astropy.io.votable.exceptions` that is considered non-critical is defined by ``astropy.vo.validator.validate.NONCRIT_WARNINGS``, which will not be flagged as bad by the validator. However, this does not change the behavior of ``astropy.io.votable.table.PEDANTIC``, which still needs to be set to ``False`` for them not to be thrown out by :func:`~astropy.vo.client.conesearch.conesearch`. Despite being listed as non-critical, user is responsible to check whether the results are reliable; They should not be used blindly. Some `units recognized by VizieR `_ are considered invalid by Cone Search standards. As a result, they will give the warning ``'W50'``, which is non-critical by default. User can also modify ``astropy.vo.validator.validate.NONCRIT_WARNINGS`` to include or exclude any warnings or exceptions, as desired. However, this should be done with caution. Adding exceptions to non-critical list is not recommended. Building the Database ^^^^^^^^^^^^^^^^^^^^^ Each Cone Search service is a catalog in the JSON database, which is represented by a nested dictionary:: { "__version__": 1, "catalogs": { "catalog 1": { "some key": "some value", # ... }, "catalog 2": { "some key": "some value", # ... }, # ... } } In the master registry, there are duplicate catalog titles with different access URLs, duplicate access URLs with different titles, duplicate catalogs with slightly different descriptions, etc. A Cone Search service is really defined by its access URL regardless of title, description, etc. The validator ensures each access URL is unique across all the output databases. However, for user-friendly catalog listing, its title will be the catalog key, not the access URL. In the case of two different access URLs sharing the same title, each URL will have its own database entry, with a sequence number appended to their titles (e.g., 'Title 1' and 'Title 2'). For consistency, even if the title does not repeat, it will still be renamed to 'Title 1'. In the case of the same access URL appearing multiple times in the registry, the validator will store the first catalog with that access URL and throw out the rest. However, it will keep count of the number of duplicates thrown out in the ``'duplicatesIgnored'`` dictionary key of the catalog kept in the database. All the existing catalog tags will be copied over as dictionary keys, except ``'accessURL'`` that is renamed to ``'url'`` for simplicity. In addition, new keys named ``'validate_xxx'`` are added; ``'xxx'`` will be the original attribute names of `astropy.io.votable.validator.result.Result`. Configurable Items ^^^^^^^^^^^^^^^^^^ These parameters are set via :ref:`astropy_config`: * ``astropy.utils.data.REMOTE_TIMEOUT`` * ``astropy.vo.validator.validate.CS_MSTR_LIST`` * ``astropy.vo.validator.validate.CS_URLS`` * ``astropy.vo.validator.validate.NONCRIT_WARNINGS`` Also depends on properties in :ref:`Simple Cone Search Configurable Items `. .. _vo-sec-validate-examples: Examples ^^^^^^^^ >>> from astropy.vo.validator import validate Validate default Cone Search sites with multiprocessing and write results in the current directory. Reading the master registry can be slow, so setting timeout to at least 30 seconds is recommended: >>> from astropy.utils.data import REMOTE_TIMEOUT >>> with REMOTE_TIMEOUT.set_temp(30): ... validate.check_conesearch_sites() Downloading http://vao.stsci.edu/directory/NVORegInt.asmx/... WARNING: W20: None:2:0: W20: No version number specified in file... # ... INFO: Only 31/11144 site(s) are validated [astropy.vo.server.validate] Downloading http://nvo.stsci.edu/vor10/getRecord.aspx?... # ... INFO: warn: 15 catalog(s) [astropy.vo.server.validate] INFO: good: 15 catalog(s) [astropy.vo.server.validate] INFO: nerr: 1 catalog(s) [astropy.vo.server.validate] INFO: excp: 0 catalog(s) [astropy.vo.server.validate] INFO: total: 31 catalog(s) [astropy.vo.server.validate] INFO: Validation of 31 site(s) took 129.094 s [astropy.vo.server.validate] From the master registry, select Cone Search access URLs hosted by ``'stsci.edu'``: >>> import numpy as np >>> from astropy.io.votable import parse_single_table >>> from astropy.utils.data import get_readable_fileobj >>> with REMOTE_TIMEOUT.set_temp(30): ... with get_readable_fileobj(validate.CS_MSTR_LIST(), ... encoding='binary') as fd: ... tab_all = parse_single_table(fd) Downloading http://vao.stsci.edu/directory/NVORegInt.asmx/... |===========================================| 23M/ 23M (100.00%) 00s WARNING: W20: None:2:0: W20: No version number specified in file... # ... >>> arr = tab_all.array.data[ ... np.where(tab_all.array['capabilityClass'] == b'ConeSearch')] >>> urls = [s for s in arr['accessURL'] if b'stsci.edu' in s] >>> urls ['http://archive.stsci.edu/hst/search.php?sci_data_set_name=Y*&', 'http://archive.stsci.edu/tues/search.php?', 'http://archive.stsci.edu/hst/search.php?sci_data_set_name=J*&', 'http://archive.stsci.edu/hut/search.php?', ..., 'http://archive.stsci.edu/kepler/kepler_fov/search.php?', 'http://archive.stsci.edu/kepler/confirmed_planets/search.php?'] Validate only the URLs found above without verbose outputs (except warnings that are controlled by :py:mod:`warnings`) or multiprocessing, and write results in ``'subset'`` sub-directory instead of the current directory: >>> with REMOTE_TIMEOUT.set_temp(30): ... validate.check_conesearch_sites( ... destdir='./subset', verbose=False, parallel=False, url_list=urls) WARNING: W49: ... Empty cell illegal for integer fields... # ... Add ``'W24'`` from `astropy.io.votable.exceptions` to the list of non-critical warnings to be ignored and re-run default validation. This is *not* recommended unless you know exactly what you are doing: >>> validate.NONCRIT_WARNINGS.set(validate.NONCRIT_WARNINGS() + ['W24']) >>> with REMOTE_TIMEOUT.set_temp(30): ... validate.check_conesearch_sites() Reset the list of ignored warnings back to default value. Validate *all* Cone Search services in the master registry (this will take a while) and write results in ``'all'`` sub-directory: >>> validate.NONCRIT_WARNINGS.set(validate.NONCRIT_WARNINGS.defaultvalue) >>> with REMOTE_TIMEOUT.set_temp(30): ... validate.check_conesearch_sites(destdir='./all', url_list=None) To look at the HTML pages of the validation results in the current directory using Firefox browser (images shown are from STScI server but your own results should look similar):: firefox results/index.html .. image:: images/validator_html_1.png :width: 600px :alt: Main HTML page of validation results When you click on 'All tests' from the page above, you will see all the Cone Search services validated with a summary of validation results: .. image:: images/validator_html_2.png :width: 600px :alt: All tests HTML page When you click on any of the listed URLs from above, you will see detailed validation warnings and exceptions for the selected URL: .. image:: images/validator_html_3.png :width: 600px :alt: Detailed validation warnings HTML page When you click on the URL on top of the page above, you will see the actual VO Table returned by the Cone Search query: .. image:: images/validator_html_4.png :width: 600px :alt: VOTABLE XML page .. _vo-sec-validator-inspect: Inspection of Validation Results -------------------------------- `~astropy.vo.validator.inspect` inspects results from :ref:`vo-sec-validator-validate`. It reads in JSON databases residing in ``astropy.vo.client.vos_catalog.BASEURL``, which can be changed to point to a different location. Configurable Items ^^^^^^^^^^^^^^^^^^ This parameter is set via :ref:`astropy_config`: * ``astropy.vo.client.vos_catalog.BASEURL`` Examples ^^^^^^^^ Load Cone Search validation results from ``astropy.vo.client.vos_catalog.BASEURL`` (by default, the one used by :ref:`vo-sec-client-scs`): >>> from astropy.vo.validator import inspect >>> r = inspect.ConeSearchResults() Downloading .../conesearch_good.json |============================================| 56/ 56k (100.00%) 00s Downloading .../conesearch_warn.json |============================================| 94/ 94k (100.00%) 00s Downloading .../conesearch_exception.json |============================================| 45/ 45 (100.00%) 00s Downloading .../conesearch_error.json |============================================| 1/ 1k (100.00%) 00s Print tally. In this example, there are 15 Cone Search services that passed validation with non-critical warnings, 15 with critical warnings, none with exceptions, and 1 with network error: >>> r.tally() good: 15 catalog(s) warn: 15 catalog(s) exception: 0 catalog(s) error: 1 catalog(s) total: 31 catalog(s) Print a list of good Cone Search catalogs, each with title, access URL, warning codes collected, and individual warnings: >>> r.list_cats('good') Guide Star Catalog 2.3 1 http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& W48,W50 .../vo.xml:136:0: W50: Invalid unit string 'pixel' .../vo.xml:155:0: W48: Unknown attribute 'nrows' on TABLEDATA # ... USNO-A2 Catalogue 1 http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2& W17,W42,W21 .../vo.xml:4:0: W21: vo.table is designed for VOTable version 1.1 and 1.2... .../vo.xml:4:0: W42: No XML namespace specified .../vo.xml:15:15: W17: VOTABLE element contains more than one DESCRIPTION... List Cone Search catalogs with warnings, excluding warnings that were ignored in ``astropy.vo.validator.validate.NONCRIT_WARNINGS``, and writes the output to a file named ``'warn_cats.txt'`` in the current directory. This is useful to see why the services failed validations: >>> with open('warn_cats.txt', 'w') as fout: ... r.list_cats('warn', fout=fout, ignore_noncrit=True) List the titles of all good Cone Search catalogs: >>> r.catkeys['good'] [u'Guide Star Catalog 2.3 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2', u'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3', ..., u'USNO-A2 Catalogue 1'] Print the details of catalog titled ``'USNO-A2 Catalogue 1'``: >>> r.print_cat('USNO-A2 Catalogue 1') { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#University#Research#Amateur#", # ... "version": "", "waveband": "#Optical#" } Found in good Load Cone Search validation results from a local directory named ``'subset'``. This is useful if you ran your own :ref:`vo-sec-validator-validate` and wish to inspect the output databases. This example reads in validation of STScI Cone Search services done in :ref:`Validation for Simple Cone Search Examples `: >>> from astropy.vo.client.vos_catalog import BASEURL >>> with BASEURL.set_temp('./subset/'): >>> r = inspect.ConeSearchResults() >>> r.tally() good: 21 catalog(s) warn: 7 catalog(s) exception: 0 catalog(s) error: 0 catalog(s) total: 28 catalog(s) >>> r.catkeys['good'] [u'Advanced Camera for Surveys 1', u'Berkeley Extreme and Far-UV Spectrometer 1', u'Copernicus Satellite 1', u'Extreme Ultraviolet Explorer 1', ..., u'Wisconsin Ultraviolet Photo-Polarimeter Experiment 1'] astropy-0.3/docs/stats/0000755000175000017500000000000012243263747013275 5ustar oleoleastropy-0.3/docs/stats/index.rst0000644000175000017500000000235112243255342015127 0ustar oleole.. _tools: *************************************** Astrostatistics Tools (`astropy.stats`) *************************************** Introduction ============ The `astropy.stats` package holds statistical functions or algorithms used in astronomy and astropy. Getting Started =============== The current tools are fairly self-contained, and include relevant examples in their docstrings. For example, see `~astropy.tools.misc.sigma_clip`. .. NOTE TO FUTURE DEVS: When this subpackage gets more populated, it will be .. wise to add a section of the form shown below. Be sure to move this file .. to docs/tools/index.rst and update docs/index.rst to tools/index when .. that happens. .. Using packagename .. ----------------- .. For more complicated packages that require multiple documents, this .. should just be a table of contents referencing those documents: .. .. toctree:: .. packagename/subdoc1 .. packagename/subdoc2 .. packagename/subdoc3 See Also ======== * :mod:`scipy.stats` This scipy package contains a variety of useful statistical functions and classes. The functionality in `astropy.stats` is intended to supplement this, *not* replace it. Reference/API ============= .. automodapi:: astropy.stats astropy-0.3/docs/logging.rst0000644000175000017500000001123112243255342014305 0ustar oleole************** Logging system ************** Overview ======== The Astropy logging system is designed to give users flexibility in deciding which log messages to show, to capture them, and to send them to a file. All messages printed by Astropy routines should use the built-in logging facility (normal ``print()`` calls should only be done by routines that are explicitly requested to print output). Messages can have one of several levels: * DEBUG: Detailed information, typically of interest only when diagnosing problems. * INFO: An message conveying information about the current task, and confirming that things are working as expected * WARNING: An indication that something unexpected happened, and that user action may be required. * ERROR: indicates a more serious issue, including exceptions By default, only WARNING and ERROR messages are displayed, and are sent to a log file located at ``~/.astropy/astropy.log`` (if the file is writeable). Configuring the logging system ============================== First, import the logger:: from astropy import log The threshold level (defined above) for messages can be set with e.g.:: log.setLevel('INFO') Color (enabled by default) can be disabled with:: log.setColor(False) Warnings from ``warnings.warn`` can be logged with:: log.enable_warnings_logging() which can be disabled with:: log.disable_warnings_logging() and exceptions can be included in the log with:: log.set_exception_logging() which can be disabled with:: log.disable_exception_logging() It is also possible to set these settings from the Astropy configuration file, which also allows an overall log file to be specified. See `Using the configuration file`_ for more information. Context managers ================ In some cases, you may want to capture the log messages, for example to check whether a specific message was output, or to log the messages from a specific section of code to a file. Both of these are possible using context managers. To add the log messages to a list, first import the logger if you have not already done so:: from astropy import log then enclose the code in which you want to log the messages to a list in a ``with`` statement:: with log.log_to_list() as log_list: # your code here In the above example, once the block of code has executed, ``log_list`` will be a Python list containing all the Astropy logging messages that were raised. Note that messages continue to be output as normal. Similarly, you can output the log messages of a specific section of code to a file using:: with log.log_to_file('myfile.log'): # your code here which will add all the messages to ``myfile.log`` (this is in addition to the overall log file mentioned in `Using the configuration file`_). While these context managers will include all the messages emitted by the logger (using the global level set by ``log.setLevel``), it is possible to filter a subset of these using ``filter_level=``, and specifying one of ``'DEBUG'``, ``'INFO'``, ``'WARN'``, ``'ERROR'``. Note that if ``filter_level`` is a lower level than that set via ``setLevel``, only messages with the level set by ``setLevel`` or higher will be included (i.e. ``filter_level`` is only filtering a subset of the messages normally emitted by the logger). Similarly, it is possible to filter a subset of the messages by origin by specifying ``filter_origin=`` followed by a string. If the origin of a message starts with that string, the message will be included in the context manager. For example, ``filter_origin='astropy.wcs'`` will include only messages emitted in the ``astropy.wcs`` sub-package. Using the configuration file ============================ Options for the logger can be set in the ``[config.logging_helper]`` section of the Astropy configuration file:: [config.logging_helper] # Threshold for the logging messages. Logging messages that are less severe # than this level will be ignored. The levels are 'DEBUG', 'INFO', 'WARNING', # 'ERROR' log_level = 'INFO' # Whether to use color for the level names use_color = True # Whether to log warnings.warn calls log_warnings = False # Whether to log exceptions before raising them log_exceptions = False # Whether to always log messages to a log file log_to_file = True # The file to log messages to log_file_path = '~/.astropy/astropy.log' # Threshold for logging messages to log_file_path log_file_level = 'INFO' # Format for log file entries log_file_format = '%(asctime)s, %(origin)s, %(levelname)s, %(message)s' Reference/API ============= .. automodapi:: astropy.logger :no-inheritance-diagram: astropy-0.3/docs/getting_started.rst0000644000175000017500000000472112243255342016054 0ustar oleole**************************** Getting Started with Astropy **************************** Importing Astropy ================= In order to encourage consistency amongst users in importing and using Astropy functionality, we have put together the following guidelines. Since most of the functionality in Astropy resides in sub-packages, importing astropy as:: >>> import astropy is not very useful. Instead, it is best to import the desired sub-package with the syntax:: >>> from astropy import subpackage # doctest: +SKIP For example, to access the FITS-related functionality, you can import `astropy.io.fits` with:: >>> from astropy.io import fits >>> hdulist = fits.open('data.fits') # doctest: +SKIP In specific cases, we have recommended shortcuts in the documentation for specific sub-packages, for example:: >>> from astropy import units as u >>> from astropy import coordinates as coord >>> coord.ICRS(ra=10.68458, dec=41.26917, unit=(u.degree, u.degree)) Finally, in some cases, most of the required functionality is contained in a single class (or a few classes). In those cases, the class can be directly imported:: >>> from astropy.cosmology import WMAP7 >>> from astropy.table import Table >>> from astropy.wcs import WCS Note that for clarity, and to avoid any issues, we recommend to **never** import any Astropy functionality using ``*``, for example:: >>> from astropy.io.fits import * # NOT recommended Some components of Astropy started off as standalone packages (e.g. PyFITS, PyWCS), so in cases where Astropy needs to be used as a drop-in replacement, the following syntax is also acceptable:: >>> from astropy.io import fits as pyfits Getting started with subpackages ================================ Because different subpackages have very different functionality, further suggestions for getting started are in the documentation for the subpackages, which you can reach by browsing the sections listed in the :ref:`user-docs`. Or, if you want to dive right in, you can either look at docstrings for particular a package or object, or access their documentation using the `~astropy.utils.misc.find_api_page` function. For example, doing this:: >>> from astropy import find_api_page >>> from astropy.units import Quantity >>> find_api_page(Quantity) # doctest: +SKIP Will bring up the documentation for the `~astropy.units.quantity.Quantity` class in your browser. astropy-0.3/docs/units/0000755000175000017500000000000012243263747013301 5ustar oleoleastropy-0.3/docs/units/equivalencies.rst0000644000175000017500000003240412243255342016663 0ustar oleole.. |quantity| replace:: :class:`~astropy.units.quantity.Quantity` .. _unit_equivalencies: Equivalencies ============= The unit module has machinery for supporting equivalences between different units in certain contexts. Namely when equations can uniquely relate a value in one unit to a different unit. A good example is the equivalence between wavelength, frequency and energy for specifying a wavelength of radiation. Normally these units are not convertible, but when understood as representing light, they are convertible in certain contexts. This will describe how to use the equivalencies included in `astropy.units` and then describe how to define new equivalencies. Equivalencies are used by passing a list of equivalency pairs to the `equivalencies` keyword argument of :meth:`Quantity.to `, :meth:`Unit.to ` or :meth:`Unit.get_converter ` methods. Alternatively, if a larger piece of code needs the same equivalencies, one can set them for a :ref:`given context `. Built-in equivalencies ---------------------- Parallax Units ^^^^^^^^^^^^^^ :func:`~astropy.units.equivalencies.parallax` is a function that returns an equivalency list to handle conversions between angles and length. Length and angles are not normally convertible, so :meth:`~astropy.units.core.UnitBase.to` raises an exception:: >>> from astropy import units as u >>> (8.0 * u.arcsec).to(u.parsec) Traceback (most recent call last): ... UnitsError: 'arcsec' (angle) and 'pc' (length) are not convertible However, when passing the result of :func:`~astropy.units.equivalencies.parallax` as the third argument to the :meth:`~astropy.units.core.UnitBase.to` method, angles can be converted into units of length (and vice versa). >>> (8.0 * u.arcsec).to(u.parsec, equivalencies=u.parallax()) >>> u.AU.to(u.arcminute, equivalencies=u.parallax()) 3437.7467707580054 Angles as Dimensionless Units ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Angles are treated as a physically distinct type, which usually helps to avoid mistakes. For units such as rotational energy, however, it is not very handy. (Indeed, this double-sidedness underlies why radian went from `supplementary to derived unit `__.) The function :func:`~astropy.units.equivalencies.dimensionless_angles` provides the required equivalency list that helps convert between angles and dimensionless units. It is somewhat different from all others in that it allows an arbitrary change in the number of powers to which radian is raised (i.e., including zero and thus dimensionless). For instance, normally the following raise exceptions:: >>> from astropy import units as u >>> u.degree.to('') Traceback (most recent call last): ... UnitsError: 'deg' (angle) and '' (dimensionless) are not convertible >>> (u.kg * u.m**2 * (u.cycle / u.s)**2).to(u.J) Traceback (most recent call last): ... UnitsError: 'cycle2 kg m2 / s2' and 'J' (energy) are not convertible But when passing we pass the proper conversion function, :func:`~astropy.units.equivalencies.dimensionless_angles`, it works. >>> u.deg.to('', equivalencies=u.dimensionless_angles()) 0.01745329... >>> (0.5e38 * u.kg * u.m**2 * (u.cycle / u.s)**2).to(u.J, ... equivalencies=u.dimensionless_angles()) >>> import numpy as np >>> np.exp((1j*0.125*u.cycle).to('', equivalencies=u.dimensionless_angles())) The example with complex numbers is also one may well be doing a fair number of similar calculations. For such situations, there is the option to :ref:`set default equivalencies `. Spectral Units ^^^^^^^^^^^^^^ :func:`~astropy.units.equivalencies.spectral` is a function that returns an equivalency list to handle conversions between wavelength, frequency and energy. As mentioned above with parallax units, we simply pass the proper conversion function (in this case :meth:`~astropy.units.equivalencies.spectral`) as the third argument to the :meth:`~astropy.units.core.UnitBase.to` method and wavelength, frequency and energy can be converted. :func:`~astropy.units.equivalencies.spectral` is a function that returns an equivalency list to handle conversions between wavelength, frequency, energy, and wave number. As mentioned above with parallax units, we simply pass a list of equivalencies (in this case, the result of :func:`~astropy.units.equivalencies.spectral`) as the third argument to the :meth:`~astropy.units.core.UnitBase.to` method and wavelength, frequency and energy can be converted. >>> ([1000, 2000] * u.nm).to(u.Hz, equivalencies=u.spectral()) >>> ([1000, 2000] * u.nm).to(u.eV, equivalencies=u.spectral()) These equivalencies even work with non-base units:: >>> # Inches to calories >>> from astropy.units import imperial >>> imperial.inch.to(imperial.Cal, equivalencies=u.spectral()) 1.8691807591...e-27 Spectral (Doppler) equivalencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Spectral equivalencies allow you to convert between wavelength, frequency, energy, and wave number but not to velocity, which is frequently the quantity of interest. It is fairly straightforward to define the equivalency, but note that there are different `conventions `__. In these conventions :math:`f_0` is the rest frequency, :math:`f` is the observed frequency, :math:`V` is the velocity, and :math:`c` is the speed of light: * Radio :math:`V = c \frac{f_0 - f}{f_0} ; f(V) = f_0 ( 1 - V/c )` * Optical :math:`V = c \frac{f_0 - f}{f } ; f(V) = f_0 ( 1 + V/c )^{-1}` * Relativistic :math:`V = c \frac{f_0^2 - f^2}{f_0^2 + f^2} ; f(V) = f_0 \frac{\left(1 - (V/c)^2\right)^{1/2}}{(1+V/c)}` These three conventions are implemented in :mod:`astropy.units.equivalencies` as :func:`~astropy.units.equivalencies.doppler_optical`, :func:`~astropy.units.equivalencies.doppler_radio`, and :func:`~astropy.units.equivalencies.doppler_relativistic`. Example use:: >>> restfreq = 115.27120 * u.GHz # rest frequency of 12 CO 1-0 in GHz >>> freq_to_vel = u.doppler_radio(restfreq) >>> (116e9 * u.Hz).to(u.km / u.s, equivalencies=freq_to_vel) Spectral Flux Density Units ^^^^^^^^^^^^^^^^^^^^^^^^^^^ There is also support for spectral flux density units. Their use is more complex, since it is necessary to also supply the location in the spectrum for which the conversions will be done, and the units of those spectral locations. The function that handles these unit conversions is :func:`~astropy.units.equivalencies.spectral_density`. This function takes as its arguments the |quantity| for the spectral location. For example:: >>> (1.0 * u.Jy).to(u.erg / u.cm**2 / u.s / u.Hz, ... equivalencies=u.spectral_density(3500 * u.AA)) >>> (1.0 * u.Jy).to(u.erg / u.cm**2 / u.s / u.micron, ... equivalencies=u.spectral_density(3500 * u.AA)) Brightness Temperature / Flux Density Equivalency ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ There is an equivalency for brightness temperature and flux density. This equivalency is often referred to as "Antenna Gain" since, at a given frequency, telescope brightness sensitivity is unrelated to aperture size, but flux density sensitivity is, so this equivalency is only dependent on the aperture size. See `Tools of Radio Astronomy `__ for details. The `~astropy.units.equivalencies.brightness_temperature` equivalency requires the beam area and frequency as arguments. Example:: >>> import numpy as np >>> omega_B = np.pi * (50 * u.arcsec)**2 >>> freq = 5 * u.GHz >>> u.Jy.to(u.K, equivalencies=u.brightness_temperature(omega_B, freq)) 7.052588858... Writing new equivalencies ------------------------- An equivalence list is just a list of tuples, where each tuple has 4 elements:: (from_unit, to_unit, forward, backward) `from_unit` and `to_unit` are the equivalent units. `forward` and `backward` are functions that convert values between those units. For example, until 1964 the metric liter was defined as the volume of 1kg of water at 4°C at 760mm mercury pressure. Volumes and masses are not normally directly convertible, but if we hold the constants in the 1964 definition of the liter as true, we could build an equivalency for them:: >>> liters_water = [ ... (u.l, u.g, lambda x: 1000.0 * x, lambda x: x / 1000.0) ... ] >>> u.l.to(u.kg, 1, equivalencies=liters_water) 1.0 Note that the equivalency can be used with any other compatible units:: >>> from astropy.units import imperial >>> imperial.gallon.to(imperial.pound, 1, equivalencies=liters_water) 8.345404463333525 And it also works in the other direction:: >>> imperial.lb.to(imperial.pint, 1, equivalencies=liters_water) 0.9586114172355458 A slightly more complicated example: Spectral Doppler Equivalencies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We show how to define an equivalency using the radio convention for CO 1-0. This function is already defined in :func:`~astropy.units.equivalencies.doppler_radio`, but this example is illustrative:: >>> from astropy.constants import si >>> restfreq = 115.27120 # rest frequency of 12 CO 1-0 in GHz >>> freq_to_vel = [(u.GHz, u.km/u.s, ... lambda x: (restfreq-x) / restfreq * si.c.to('km/s').value, ... lambda x: (1-x/si.c.to('km/s').value) * restfreq )] >>> u.Hz.to(u.km / u.s, 116e9, equivalencies=freq_to_vel) -1895.432192... >>> (116e9 * u.Hz).to(u.km / u.s, equivalencies=freq_to_vel) Note that once this is defined for GHz and km/s, it will work for all other units of frequency and velocity. ``x`` is converted from the input frequency unit (e.g., Hz) to GHz before being passed to ``lambda x:``. Similarly, the return value is assumed to be in units of ``km/s``, which is why the ``.value`` of ``c`` is used instead of the constant. Displaying available equivalencies ---------------------------------- The :meth:`~astropy.units.core.Unit.find_equivalent_units` method also understands equivalencies. For example, without passing equivalencies, there are three compatible units for `Hz` in the standard set:: >>> u.Hz.find_equivalent_units() Primary name | Unit definition | Aliases [ Bq | 1 / s | becquerel , Ci | 2.7027e-11 / s | curie , Hz | 1 / s | Hertz, hertz , ] However, when passing the spectral equivalency, you can see there are all kinds of things that ``Hz`` can be converted to:: >>> u.Hz.find_equivalent_units(equivalencies=u.spectral()) Primary name | Unit definition | Aliases [ AU | 1.49598e+11 m | au , Angstrom | 1e-10 m | AA, angstrom , Bq | 1 / s | becquerel , Ci | 2.7027e-11 / s | curie , Hz | 1 / s | Hertz, hertz , J | kg m2 / s2 | Joule, joule , Ry | 2.17987e-18 kg m2 / s2 | rydberg , cm | 0.01 m | centimeter , eV | 1.60218e-19 kg m2 / s2 | electronvolt , erg | 1e-07 kg m2 / s2 | , k | 100 / m | Kayser, kayser , lyr | 9.46073e+15 m | lightyear , m | irreducible | meter , micron | 1e-06 m | , pc | 3.08568e+16 m | parsec , solRad | 6.95508e+08 m | R_sun, Rsun , ] .. _equivalency-context: Using equivalencies in larger pieces of code -------------------------------------------- Sometimes one has an involved calculation where one is regularly switching back between equivalent units. For these cases, one can set equivalencies that will by default be used, in a way similar to which one can :ref:`enable other units `. For instance, to enable radian to be treated as a dimensionless unit, simply do:: >>> import astropy.units as u >>> u.set_enabled_equivalencies(u.dimensionless_angles()) >>> u.deg.to('') 0.01745329... Here, any list of equivalencies could be used, or one could add, e.g., :func:`~astropy.units.equivalencies.spectral` and :func:`~astropy.units.equivalencies.spectral_density` (since these return lists, they should indeed be combined by adding them together). The disadvantage of the above approach is that you may forget to turn the default off (done by giving an empty argument). To automate this, a context manager is provided:: >>> import astropy.units as u >>> with u.set_enabled_equivalencies(u.dimensionless_angles()): ... phase = 0.5 * u.cycle ... c = np.exp(1j*phase) >>> c astropy-0.3/docs/units/format.rst0000644000175000017500000001727212243255342015324 0ustar oleole.. _astropy-units-format: String representations of units =============================== .. |quantity| replace:: :class:`~astropy.units.quantity.Quantity` .. |unit| replace:: :class:`~astropy.units.core.UnitBase` Converting units to string representations ------------------------------------------ You can control the way that |quantity| and |unit| objects are rendered as strings using the new `Format String Syntax `__. New-style format strings use the ``"{}".format()`` syntax. Most of the format speficiers are simliar to the old ``%``-style formatting, so things like ``0.003f`` still work, just in the form ``"{:0.003f}".format()``. For quantities, format specifiers, like ``0.003f`` will be applied to the |quantity| value, without affecting the unit. Specifiers like ``20s``, which would only apply to a string, will be applied to the whole string representation of the |quantity|. This means you can do:: >>> from astropy import units as u >>> import numpy as np >>> q = 10 * u.km >>> q >>> "{0}".format(q) '10 km' >>> "{0:+0.03f}".format(q) '+10.000 km' >>> "{0:20s}".format(q) '10 km ' To format both the value and the unit separately, you can access the |quantity| class attributes within new-style format strings:: >>> q = 10 * u.km >>> q >>> "{0.value:0.003f} in {0.unit:s}".format(q) # doctest: +SKIP '10.000 in km' Because Numpy arrays don't accept most format specifiers, using specifiers like ``0.003f`` will not work when applied to a Numpy array or non-scalar |quantity|. Use :func:`numpy.array_str` instead. For example:: >>> q = np.linspace(0,1,10) * u.m >>> "{0} {1}".format(np.array_str(q.value, precision=1), q.unit) '[ 0. 0.1 0.2 0.3 0.4 0.6 0.7 0.8 0.9 1. ] m' Examine the numpy documentation for more examples with :func:`numpy.array_str`. Units, or the unit part of a quantity, can also be formatted in a number of different styles. By default, the string format used is referred to as the "generic" format, which is based on syntax of the FITS standard's format for representing units, but supports all of the units defined within the `astropy.units` framework, including user-defined units. The format specifier (and `~astropy.units.core.UnitBase.to_string`) functions also take an optional parameter to select a different format, including ``"latex"``, ``"unicode"``, ``"cds"``, and others, defined below. >>> "{0.value:0.003f} in {0.unit:latex}".format(q) # doctest: +SKIP '10.000 in $\\mathrm{km}$' >>> fluxunit = u.erg / (u.cm ** 2 * u.s) >>> "{0}".format(fluxunit) u'erg / (cm2 s)' >>> print("{0:console}".format(fluxunit)) erg ------ s cm^2 >>> "{0:latex}".format(fluxunit) u'$\\mathrm{\\frac{erg}{s\\,cm^{2}}}$' >>> "{0:>20s}".format(fluxunit) u' erg / (cm2 s)' The `~astropy.units.core.UnitBase.to_string` method is an alternative way to format units as strings, and is the underlying implementation of the `format`-style usage:: >>> fluxunit = u.erg / (u.cm ** 2 * u.s) >>> fluxunit.to_string('latex') u'$\\mathrm{\\frac{erg}{s\\,cm^{2}}}$' Creating units from strings --------------------------- Units can also be created from strings in a number of different formats using the `~astropy.units.core.Unit` class:: >>> from astropy import units as u >>> u.Unit("m") Unit("m") >>> u.Unit("erg / (s cm2)") Unit("erg / (cm2 s)") >>> u.Unit("erg.s-1.cm-2", format="cds") Unit("erg / (cm2 s)") .. note:: Creating units from strings requires the use of a specialized parser for the unit language, which results in a performance penalty if units are created using strings. Thus, it is much faster to use unit objects directly (e.g., ``unit = u.degree / u.minute``) instead of via string parsing (``unit = u.Unit('deg/min')``). This parser is very useful, however, if your unit definitions are coming from a file format such as FITS or VOTable. Built-in formats ---------------- `astropy.units` includes support for parsing and writing the following formats: - ``"fits"``: This is the format defined in the Units section of the `FITS Standard `__. Unlike the "generic" string format, this will only accept or generate units defined in the FITS standard. - ``"vounit"``: The `proposed IVOA standard `__ for representing units in the VO. Again, based on the FITS syntax, but the collection of supported units is different. - ``"cds"``: `Standards for astronomical catalogues from Centre de Données astronomiques de Strasbourg `__: This is the standard used by `Vizier tables `__, as well as what is used by VOTable versions 1.2 and earlier. .. These are to-be-implemented - OGIP Units: A standard for storing units in `OGIP FITS files `_. `astropy.units` is also able to write, but not read, units in the following formats: - ``"latex"``: Writes units out using LaTeX math syntax using the `IAU Style Manual `__ recommendations for unit presentation. This format is automatically used when printing a unit in the IPython notebook:: >>> fluxunit # doctest: +SKIP .. math:: \mathrm{\frac{erg}{s\,cm^{2}}} - ``"console"``: Writes a multi-line representation of the unit useful for display in a text console:: >>> print fluxunit.to_string('console') erg ------ s cm^2 - ``"unicode"``: Same as ``"console"``, except uses Unicode characters:: >>> print u.Ry.decompose().to_string('unicode') # doctest: +SKIP m² kg 2.1798721×10-¹⸠───── s² Unrecognized Units ------------------ Since many files in found in the wild have unit strings that do not correspond to any given standard, `astropy.units` also has a consistent way to store and pass around unit strings that did not parse. Normally, passing an unrecognized unit string raises an exception:: >>> u.Unit("m/s/s") # The FITS standard only allows one '/' Traceback (most recent call last): ... ValueError: 'm/s/s' did not parse as unit format 'generic': Syntax error parsing unit string 'm/s/s' However, the `~astropy.units.core.Unit` constructor has the keyword argument `parse_strict` that can take one of three values to control this behavior: - ``'raise'``: (default) raise a ValueError exception. - ``'warn'``: emit a Warning, and return an `~astropy.units.core.UnrecognizedUnit` instance. - ``'silent'``: return an `~astropy.units.core.UnrecognizedUnit` instance. So, for example, one can do:: >>> x = u.Unit("m/s/s", parse_strict="warn") WARNING: UnitsWarning: 'm/s/s' did not parse as unit format 'generic': Syntax error parsing unit string 'm/s/s' [astropy.units.core] This `~astropy.units.core.UnrecognizedUnit` object remembers the original string it was created with, so it can be written back out, but any meaningful operations on it, such as converting to another unit or composing with other units, will fail. >>> x.to_string() 'm/s/s' >>> x.to(u.km / u.s / u.s) Traceback (most recent call last): ... ValueError: The unit 'm/s/s' is unrecognized. It can not be converted to other units. >>> x / u.m Traceback (most recent call last): ... ValueError: The unit 'm/s/s' is unrecognized, so all arithmetic operations with it are invalid. astropy-0.3/docs/units/conversion.rst0000644000175000017500000000364212243255342016215 0ustar oleoleLow-level unit conversion ========================= Conversion of quantities from one unit to another is handled using the `Quantity.to ` method. This page describes some low-level features for handling unit conversion that are rarely required in user code. There are two ways of handling conversions between units. Direct Conversion ----------------- In this case, given a source and destination unit, the value(s) in the new units is(are) returned. >>> from astropy import units as u >>> u.pc.to(u.m, 3.26) 1.0059308915583043e+17 This converts 3.26 parsecs to meters. Arrays are permitted as arguments. >>> u.h.to(u.s, [1, 2, 5, 10.1]) array([ 3600., 7200., 18000., 36360.]) Obtaining a Conversion Function ------------------------------- Finally, one may obtain a function that can be used to convert to the new unit. Normally this may seem like overkill when all one needs to do is multiply by a scale factor, but there are cases when the transformation between units may not be as simple as a single scale factor, for example when a custom equivalency table is in use. Conversion to different units involves obtaining a conversion function and then applying it to the value, or values to be converted. >>> cms = u.cm / u.s >>> cms_to_kmph = cms.get_converter(u.km / u.hour) >>> cms_to_kmph(100.) 3.6000000000000005 >>> cms_to_kmph([1000, 2000]) array([ 36., 72.]) Incompatible Conversions ------------------------ If you attempt to convert to a incompatible unit, an exception will result: >>> cms.to(u.km) Traceback (most recent call last): ... UnitsError: 'cm / s' (speed) and 'km' (length) are not convertible You can check whether a particular conversion is possible using the `~astropy.units.core.UnitBase.is_equivalent` method:: >>> u.m.is_equivalent(u.pc) True >>> u.m.is_equivalent("second") False >>> (u.m ** 3).is_equivalent(u.l) True astropy-0.3/docs/units/quantity.rst0000644000175000017500000001742512243255342015712 0ustar oleoleQuantity ======== .. |quantity| replace:: :class:`~astropy.units.quantity.Quantity` The |quantity| object is meant to represent a value that has some unit associated with the number. Creating Quantity instances --------------------------- |quantity| objects are created through multiplication or division with :class:`~astropy.units.core.Unit` objects. For example, to create a |quantity| to represent 15 m/s: >>> import astropy.units as u >>> 15 * u.m / u.s or 1.14/s: >>> 1.14 / u.s You can also create instances using the |quantity| constructor directly, by specifying a value and unit: >>> u.Quantity(15, u.m / u.s) |quantity| objects can also be created automatically from Numpy arrays or Python sequences: >>> [1, 2, 3] * u.m >>> import numpy as np >>> np.array([1, 2, 3]) * u.m |quantity| objects can also be created from sequences of |quantity| objects, as long as all of their units are equivalent, and will automatically convert to Numpy arrays. >>> qlst = [60 * u.s, 1 * u.min] >>> u.Quantity(qlst, u.minute) Finally, the current unit and value can be accessed via the `~astropy.units.quantity.Quantity.unit` and `~astropy.units.quantity.Quantity.value` attributes: >>> q = 2.3 * u.m / u.s >>> q.unit Unit("m / s") >>> q.value 2.3 Converting to different units ----------------------------- |quantity| objects can be converted to different units using the :meth:`~astropy.units.quantity.Quantity.to` method:: >>> q = 2.3 * u.m / u.s >>> q.to(u.km / u.h) For convenience, the `~astropy.units.quantity.Quantity.si` and `~astropy.units.quantity.Quantity.cgs` attributes can be used to convert the |quantity| to base S.I. or c.g.s units: >>> q = 2.4 * u.m / u.s >>> q.si >>> q.cgs Arithmetic ---------- Addition and Subtraction ~~~~~~~~~~~~~~~~~~~~~~~~ Addition or subtraction between |quantity| objects is supported when their units are equivalent. When the units are equal, the resulting object has the same unit: >>> 11 * u.s + 30 * u.s >>> 30 * u.s - 11 * u.s If the units are equivalent, but not equal (e.g. kilometer and meter), the resulting object **has units of the object on the left**: >>> 1100.1 * u.m + 13.5 * u.km >>> 13.5 * u.km + 1100.1 * u.m >>> 1100.1 * u.m - 13.5 * u.km >>> 13.5 * u.km - 1100.1 * u.m Addition and subtraction is not supported between |quantity| objects and basic numeric types: >>> 13.5 * u.km + 19.412 Traceback (most recent call last): ... UnitsError: Can only apply 'add' function to dimensionless quantities when other argument is not a quantity except for dimensionless quantities (see `Dimensionless quantities`_). Multiplication and Division ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Multiplication and division is supported between |quantity| objects with any units, and with numeric types. For these operations between objects with equivalent units, the **resulting object has composite units**: >>> 1.1 * u.m * 140.3 * u.cm >>> 140.3 * u.cm * 1.1 * u.m >>> 1. * u.m / (20. * u.cm) >>> 20. * u.cm / (1. * u.m) For multiplication, you can change how to represent the resulting object by using the :meth:`~astropy.units.quantity.Quantity.to` method: >>> (1.1 * u.m * 140.3 * u.cm).to(u.m**2) >>> (1.1 * u.m * 140.3 * u.cm).to(u.cm**2) For division, if the units are equivalent, you may want to make the resulting object dimensionless by reducing the units. To do this, use the :meth:`~astropy.units.quantity.Quantity.decompose()` method: >>> (20. * u.cm / (1. * u.m)).decompose() This method is also useful for more complicated arithmetic: >>> 15. * u.kg * 32. * u.cm * 15 * u.m / (11. * u.s * 1914.15 * u.ms) >>> (15. * u.kg * 32. * u.cm * 15 * u.m / (11. * u.s * 1914.15 * u.ms)).decompose() Numpy functions --------------- |quantity| objects are actually full Numpy arrays (the |quantity| object class inherits from and extends the `numpy.ndarray` class), and we have tried to ensure that most Numpy functions behave properly with units: >>> q = np.array([1., 2., 3., 4.]) * u.m / u.s >>> np.mean(q) >>> np.std(q) including functions that only accept specific units such as angles:: >>> q = 30. * u.deg >>> np.sin(q) or dimensionless quantities:: >>> nu = 3 * u.GHz >>> T = 30 * u.K >>> np.exp(-h * nu / (k_B * T)) # doctest: +SKIP (see `Dimensionless quantities`_ for more details). Dimensionless quantities ------------------------ Dimensionless quantities have the characteristic that if they are added or subtracted from a Python scalar or unitless `~numpy.ndarray`, or if they are passed to a Numpy function that takes dimensionless quantities, the units are simplified so that the quantity is dimensionless and scale-free. For example:: >>> 1. + 1. * u.m / u.km which is different from:: >>> 1. + (1. * u.m / u.km).value 2.0 In the latter case, the result is ``2.0`` because the unit of ``(1. * u.m / u.km)`` is not scale-free by default:: >>> q = (1. * u.m / u.km) >>> q.unit Unit("m / km") >>> q.unit.decompose() Unit(dimensionless with a scale of 0.001) However, when combining with a non-quantity object, the unit is automatically decomposed to be scale-free, giving the expected result. This also occurs when passing dimensionless quantities to functions that take dimensionless quantities:: >>> nu = 3 * u.GHz >>> T = 30 * u.K >>> np.exp(- h * nu / (k_B * T)) # doctest: +SKIP The result is independent from the units the different quantities were specified in:: >>> nu = 3.e9 * u.Hz >>> T = 30 * u.K >>> np.exp(- h * nu / (k_B * T)) # doctest: +SKIP Converting to plain Python scalars or Numpy arrays -------------------------------------------------- Converting |quantity| objects does not work for non-dimensionless quantities:: >>> float(3. * u.m) Traceback (most recent call last): ... TypeError: Only dimensionless scalar quantities can be converted to Python scalars Instead, only dimensionless values can be converted to plain Python scalars:: >>> float(3. * u.m / (4. * u.m)) 0.75 Note that scaled dimensionless quantities such as ``m / km`` also do not work:: >>> float(3. * u.m / (4. * u.km)) Traceback (most recent call last): ... TypeError: Only dimensionless scalar quantities can be converted to Python scalars If you want to simplify e.g. dimensionless quantities to their true dimensionless value, then you can make use of the :meth:`~astropy.units.quantity.Quantity.decompose` method: >>> q = 3. * u.m / (4. * u.km) >>> q >>> q.decompose() >>> float(q.decompose()) 0.00075 Similarly, `int` and `long` work, but only for dimensionless unscaled quantities:: >>> int(6. * u.m / (2. * u.m)) 3 Since |quantity| objects are actual Numpy arrays, we are not able to ensure that only dimensionless quantities are converted to Numpy arrays:: >>> np.array([1, 2, 3] * u.m) array([1, 2, 3]) astropy-0.3/docs/units/combining_and_defining.rst0000644000175000017500000000306312243255342020457 0ustar oleoleCombining and defining units ============================ Units and quantities can be combined together using the regular Python numeric operators. For example:: >>> from astropy import units as u >>> fluxunit = u.erg / (u.cm ** 2 * u.s) >>> fluxunit Unit("erg / (cm2 s)") >>> 52.0 * fluxunit >>> 52.0 * fluxunit / u.s Users are free to define new units, either fundamental or compound using the `~astropy.units.core.def_unit` function. For example:: >>> bakers_fortnight = u.def_unit('bakers_fortnight', 13 * u.day) The addition of a string gives the new unit a name that will show up when the unit is printed. Creating a new fundamental unit is simple:: >>> titter = u.def_unit('titter') >>> chuckle = u.def_unit('chuckle', 5 * titter) >>> laugh = u.def_unit('laugh', 4 * chuckle) >>> guffaw = u.def_unit('guffaw', 3 * laugh) >>> rofl = u.def_unit('rofl', 4 * guffaw) >>> death_by_laughing = u.def_unit('death_by_laughing', 10 * rofl) >>> rofl.to(titter, 1) 240.0 By default, custom units are not searched by methods such as `~astropy.units.core.UnitBase.find_equivalent_units`. However, they can be enabled by calling `~astropy.units.core.add_enabled_units`:: >>> kmph = u.def_unit('kmph', u.km / u.h) >>> (u.m / u.s).find_equivalent_units() [] >>> u.add_enabled_units([kmph]) >>> (u.m / u.s).find_equivalent_units() Primary name | Unit definition | Aliases [ kmph | 0.277778 m / s | , ] astropy-0.3/docs/units/standard_units.rst0000644000175000017500000001212412243255342017045 0ustar oleoleStandard units ============== Standard units are defined in the `astropy.units` package as object instances. All units are defined in term of basic 'irreducible' units. The irreducible units include: - Length (meter) - Time (second) - Mass (kilogram) - Current (ampere) - Temperature (Kelvin) - Angular distance (radian) - Solid angle (steradian) - Luminous intensity (candela) - Stellar magnitude (mag) - Amount of substance (mole) - Photon count (photon) (There are also some more obscure base units required by the FITS standard that are no longer recommended for use.) Units that involve combinations of fundamental units are instances of `~astropy.units.core.CompositeUnit`. In most cases, one does not need to worry about the various kinds of unit classes unless one wants to design a more complex case. There are many units already predefined in the module. One may use the `~astropy.units.core.UnitBase.find_equivalent_units` method to list all the existing predefined units of a given type:: >>> from astropy import units as u >>> u.g.find_equivalent_units() Primary name | Unit definition | Aliases [ M_e | 9.10938e-31 kg | , M_p | 1.67262e-27 kg | , g | 0.001 kg | gram , kg | irreducible | kilogram , solMass | 1.9891e+30 kg | M_sun, Msun , t | 1000 kg | tonne , u | 1.66054e-27 kg | Da, Dalton , ] The dimensionless unit ---------------------- In addition to these units, `astropy.units` includes the concept of the dimensionless unit, used to indicate quantities that don't have a physical dimension. This is distinct in concept from a unit that is equal to `None`: that indicates that no unit was specified in the data or by the user. For convenience, there is a unit that is both dimensionless and unscaled: the `~astropy.units.core.dimensionless_unscaled` object:: >>> from astropy import units as u >>> u.dimensionless_unscaled Unit(dimensionless) Dimensionless quantities are often defined as products or ratios of quantities that are not dimensionless, but whose dimensions cancel out when their powers are multiplied. For example:: >>> u.m / u.m Unit(dimensionless) For compatibility with the supported unit string formats, this is equivalent to ``Unit('')`` and ``Unit(1)``, though using ``u.dimensionless_unscaled`` in Python code is preferred for readability:: >>> u.dimensionless_unscaled == u.Unit('') True >>> u.dimensionless_unscaled == u.Unit(1) True Note that in many cases, a dimensionless unit may also have a scale. For example:: >>> (u.km / u.m).decompose() Unit(dimensionless with a scale of 1000.0) >>> (u.km / u.m).decompose() == u.dimensionless_unscaled False To determine if a unit is dimensionless (but regardless of the scale), use the `~astropy.units.core.UnitBase.physical_type` property:: >>> (u.km / u.m).physical_type u'dimensionless' >>> # This also has a scale, so it is not the same as u.dimensionless_unscaled >>> (u.km / u.m) == u.dimensionless_unscaled False >>> # However, (u.m / u.m) has a scale of 1.0, so it is the same >>> (u.m / u.m) == u.dimensionless_unscaled True .. _enabling-other-units: Enabling other units -------------------- By default, only the "default" units are searched by `~astropy.units.core.UnitBase.find_equivalent_units` and similar methods that do searching. This includes SI, CGS and astrophysical units. However, one may wish to enable the imperial or other user-defined units. For example, to enable Imperial units, simply do:: >>> from astropy.units import imperial >>> imperial.enable() # doctest: +SKIP >>> u.m.find_equivalent_units() # doctest: +SKIP Primary name | Unit definition | Aliases [ AU | 1.49598e+11 m | au , Angstrom | 1e-10 m | AA, angstrom , cm | 0.01 m | centimeter , ft | 0.3048 m | foot , inch | 0.0254 m | , lyr | 9.46073e+15 m | lightyear , m | irreducible | meter , mi | 1609.34 m | mile , micron | 1e-06 m | , nmi | 1852 m | nauticalmile, NM , pc | 3.08568e+16 m | parsec , solRad | 6.95508e+08 m | R_sun , yd | 0.9144 m | yard , ] This may also be used with the ``with`` statement, to temporarily enable additional units:: >>> from astropy import units as u >>> from astropy.units import imperial >>> with imperial.enable(): ... u.m.find_equivalent_units() # doctest: +SKIP ... To enable just specific units, use `~astropy.units.add_enabled_units`:: >>> from astropy import units as u >>> from astropy.units import imperial >>> with u.add_enabled_units_context([imperial.knot]): ... u.m.find_equivalent_units() # doctest: +SKIP ... astropy-0.3/docs/units/decomposing_and_composing.rst0000644000175000017500000000544312243255342021240 0ustar oleoleDecomposing and composing units =============================== Reducing a unit to its irreducible parts ---------------------------------------- A unit or quantity can be decomposed into its irreducible parts using the `Unit.decompose ` or `Quantity.decompose ` methods:: >>> from astropy import units as u >>> u.Ry Unit("Ry") >>> u.Ry.decompose() Unit("2.17987e-18 kg m2 / s2") You can limit the selection of units that you want to decompose to using the `bases` keyword argument:: >>> u.Ry.decompose(bases=[u.m, u.N]) Unit("2.17987e-18 m N") This is also useful to decompose to a particular system. For example, to decompose the Rydberg unit in terms of CGS units:: >>> u.Ry.decompose(bases=u.cgs.bases) Unit("2.17987e-11 cm2 g / s2") Automatically composing a unit into more complex units ------------------------------------------------------ Conversely, a unit may be recomposed back into more complex units using the `~astropy.units.core.UnitBase.compose` method. Since there may be multiple equally good results, a list is always returned:: >>> x = u.Ry.decompose() >>> x.compose() [Unit("Ry"), Unit("2.17987e-18 J"), Unit("2.17987e-11 erg"), Unit("13.6057 eV")] Some other interesting examples:: >>> (u.s ** -1).compose() # doctest: +SKIP [Unit("Bq"), Unit("Hz"), Unit("3.7e+10 Ci")] Composition can be combined with :ref:`unit_equivalencies`:: >>> (u.s ** -1).compose(equivalencies=u.spectral()) # doctest: +SKIP [Unit("m"), Unit("Hz"), Unit("J"), Unit("Bq"), Unit("3.24078e-17 pc"), Unit("1.057e-16 lyr"), Unit("6.68459e-12 AU"), Unit("1.4378e-09 solRad"), Unit("0.01 k"), Unit("100 cm"), Unit("1e+06 micron"), Unit("1e+07 erg"), Unit("1e+10 Angstrom"), Unit("3.7e+10 Ci"), Unit("4.58743e+17 Ry"), Unit("6.24151e+18 eV")] Obviously a name doesn't exist for every arbitrary derived unit imaginable. In that case, the system will do its best to reduce the unit to the fewest possible symbols:: >>> (u.cd * u.sr * u.V * u.s).compose() [Unit("lm Wb")] Converting between systems -------------------------- Built on top of this functionality is a convenience method to convert between unit systems. >>> u.Pa.to_system(u.cgs) [Unit("10 Ba")] There is also a shorthand for this which only returns the first of many possible matches:: >>> u.Pa.cgs Unit("10 Ba") This is equivalent to decomposing into the new system and then composing into the most complex units possible, though `~astropy.units.core.UnitBase.to_system` adds some extra logic to return the results sorted in the most useful order:: >>> u.Pa.decompose(bases=u.cgs.bases) Unit("10 g / (cm s2)") >>> _.compose(units=u.cgs) [Unit("10 Ba")] astropy-0.3/docs/units/index.rst0000644000175000017500000001233712243255342015140 0ustar oleole.. _astropy-units: ************************************** Units and Quantities (`astropy.units`) ************************************** .. |quantity| replace:: :class:`~astropy.units.quantity.Quantity` .. currentmodule:: astropy.units Introduction ============ `astropy.units` handles defining and converting between physical units, and performing arithmetic with physical quantities (numbers with associated units). Getting Started =============== Most users of the `astropy.units` package will work with "quantities": the combination of a value and a unit. The easiest way to create a |quantity| is to simply multiply or divide a value by one of the built-in units. It works with scalars, sequences and Numpy arrays:: >>> from astropy import units as u >>> 42.0 * u.meter >>> [1., 2., 3.] * u.m >>> import numpy as np >>> np.array([1., 2., 3.]) * u.m You can get the unit and value from a |quantity| using the unit and value members:: >>> q = 42.0 * u.meter >>> q.value 42.0 >>> q.unit Unit("m") From this simple building block, it's easy to start combining quantities with different units:: >>> 15.1 * u.meter / (32.0 * u.second) >>> 3.0 * u.kilometer / (130.51 * u.meter / u.second) >>> (3.0 * u.kilometer / (130.51 * u.meter / u.second)).decompose() Unit conversion is done using the :meth:`~astropy.units.quantity.Quantity.to` method, which returns a new |quantity| in the given unit:: >>> x = 1.0 * u.parsec >>> x.to(u.km) It is also possible to work directly with units at a lower level, for example, to create custom units:: >>> from astropy.units import imperial >>> cms = u.cm / u.s >>> # ...and then use some imperial units >>> mph = imperial.mile / u.hour >>> # And do some conversions >>> q = 42.0 * cms >>> q.to(mph) Units that "cancel out" become a special unit called the "dimensionless unit": >>> u.m / u.m Unit(dimensionless) `astropy.units` is able to match compound units against the units it already knows about:: >>> (u.s ** -1).compose() # doctest: +SKIP [Unit("Bq"), Unit("Hz"), Unit("3.7e+10 Ci")] And it can convert between unit systems, such as SI or CGS:: >>> (1.0 * u.Pa).cgs `astropy.units` also handles equivalencies, such as that between wavelength and frequency. To use that feature, equivalence objects are passed to the :meth:`~astropy.units.quantity.Quantity.to` conversion method. For instance, a conversion from wavelength to frequency doesn't normally work: >>> (1000 * u.nm).to(u.Hz) Traceback (most recent call last): ... UnitsError: 'nm' (length) and 'Hz' (frequency) are not convertible but by passing an equivalency list, in this case ``spectral()``, it does: >>> (1000 * u.nm).to(u.Hz, equivalencies=u.spectral()) Quantities and units can be printed nicely to strings using the `Format String Syntax `_, the preferred string formatting syntax in recent versions of python. Format specifiers (like ``0.03f``) in new-style format strings will used to format the quantity value:: >>> q = 15.1 * u.meter / (32.0 * u.second) >>> q >>> "{0:0.03f}".format(q) '0.472 m / s' The value and unit can also be formatted separately. Format specifiers used on units can be used to choose the unit formatter:: >>> q = 15.1 * u.meter / (32.0 * u.second) >>> q >>> "{0.value:0.03f} {0.unit:FITS}".format(q) '0.472 m s-1' Using `astropy.units` ===================== .. toctree:: :maxdepth: 2 quantity standard_units combining_and_defining decomposing_and_composing format equivalencies conversion See Also ======== - `FITS Standard `_ for units in FITS. - The `proposed IVOA standard `_ for representing units in the VO. - OGIP Units: A standard for storing units in `OGIP FITS files `_. - `Standards for astronomical catalogues units `_. - `IAU Style Manual `_. - `A table of astronomical unit equivalencies `_ Reference/API ============= .. automodapi:: astropy.units.quantity .. automodapi:: astropy.units .. automodapi:: astropy.units.format .. automodapi:: astropy.units.si .. automodapi:: astropy.units.cgs .. automodapi:: astropy.units.astrophys .. automodapi:: astropy.units.imperial .. automodapi:: astropy.units.cds .. automodapi:: astropy.units.equivalencies Acknowledgments =============== This code is adapted from the `pynbody `__ units module written by Andrew Pontzen, who has granted the Astropy project permission to use the code under a BSD license. astropy-0.3/docs/Makefile0000644000175000017500000001116412243255342013572 0ustar oleole# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest #This is needed with git because git doesn't create a dir if it's empty $(shell [ -d "_static" ] || mkdir -p _static) help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR) -rm -rf api html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/Astropy" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." make -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." astropy-0.3/docs/overview.rst0000644000175000017500000000602212243255342014527 0ustar oleole******** Overview ******** Here we describe a broad overview of the Astropy project and its parts. Astropy Project Concept ======================= The "Astropy Project" is distinct from the `astropy` package. The Astropy Project is a process intended to facilitate communication and interoperability of python packages/codes in astronomy and astrophysics. The project thus encompasses the `astropy` core package (which provides a common framework), all "affiliated packages" (described below in `Affiliated Packages`), and a general community aimed at bringing resources together and not duplicating efforts. `astropy` Core Package ====================== The `astropy` package (alternatively known as the "core" package) contains various classes, utilities, and a packaging framework intended to provide commonly-used astronomy tools. It is divided into a variety of sub-packages, which are documented in the remainder of this documentation (see :ref:`user-docs` for documentation of these components). The core also provides this documentation, and a variety of utilities that simplify starting other python astronomy/astrophysics packages. As described in the following section, these simplify the process of creating affiliated packages. Affiliated Packages =================== The Astropy project includes the concept of "affiliated packages." An affiliated package is an astronomy-related python package that is not part of the `astropy` core source code, but has requested to be included in the general community effort of the Astropy project. Such a package may be a candidate for eventual inclusion in the main `astropy` package (although this is not required). Until then, however, it is a separate package, and may not be in the `astropy` namespace. If you are interested in starting an affiliated package, or have a package you are interested in making more compatible with astropy, the `astropy` core package includes a variety of features that simplify and homogenize package management. Astropy provides a `package template `_ that provides a common way to organize packages, to make your life simpler. You can use this template either with a new package you are starting or an existing package to make it more compatible with Astropy and the affiliated package installer. See the `usage instructions in the template `_ for further details. Further information about affiliated packages is available at http://affiliated.astropy.org along with the current list of endorsed packages. Community ========= Aside from the actual code, Astropy is also a community of astronomy-associated users and developers that agree that sharing utilities is healthy for the community and the science it produces. This community is of course central to accomplishing anything with the code itself. We follow the `Python Software Foundation Code of Conduct `_ and welcome anyone who wishes to contribute to the project. astropy-0.3/docs/config/0000755000175000017500000000000012243263747013404 5ustar oleoleastropy-0.3/docs/config/index.rst0000644000175000017500000002564112243255342015245 0ustar oleole.. doctest_skip .. _astropy_config: *************************************** Configuration system (`astropy.config`) *************************************** Introduction ============ The astropy configuration system is designed to give users control of various parameters used in astropy or affiliated packages without delving into the source code to make those changes. Getting Started =============== The Astropy configuration options are most easily set by modifying the configuration file. It will be automatically generated with all the default values the first time you import Astropy. You can find the exact location by doing:: from astropy.config import get_config_dir print get_config_dir() And you should see the location of your configuration directory. The standard scheme generally puts your configuration directory in ``$HOME/.astropy/config``, but if you've set the environment variable `XDG_CONFIG_HOME` and the ``$XDG_CONFIG_HOME/astropy`` directory exists, it will instead be there. Once you've found the configuration file, open it with your favorite editor. It should have all of the sections you might want, with descriptions and the type of the value that is accepted. Feel free to edit this as you wish, and any of these changes will be reflected when you next start Astropy. Or, if you want to see your changes immediately in your current Astropy session, just do:: from astropy.config import reload_config reload_config() .. note:: If for whatever reason your ``$HOME/.astropy`` directory is not accessible (i.e., you have astropy running somehow as root but you are not the root user), the best solution is to set the `XDG_CONFIG_HOME` and `XDG_CACHE_HOME` environment variables pointing to directories, and create an ``astropy`` directory inside each of those. Both the configuration and data download systems will then use those directories and never try to access the ``$HOME/.astropy`` directory. Using `config` ============== Accessing Values ---------------- The value of a configuration object can be accessed by calling the object as a function. For instance to get the default URL for astropy remote data do:: >>> from astropy.utils.data import DATAURL >>> DATAURL() 'http://data.astropy.org/' To interactively see more information about a configuration object there are two options:: >>> DATAURL >>> print DATAURL ConfigurationItem: dataurl cfgtype='string' defaultvalue='http://data.astropy.org/' description='URL for astropy remote data site.' module=astropy.utils.data value='http://data.astropy.org/' Changing Values at Run-time --------------------------- The configuration system is most conveniently used by modifying configuration files as described above. Values can also, however, be modified in an active python session using the :meth:`~astropy.config.configuration.ConfigurationItem.set` method. A run-time `ConfigurationItem` object can be used to make these changes. These items are found in the same module as the configuration section they are in, and usually have the same name as in the configuration files, but in all caps. For example, if there is a part of your configuration file that looks like:: [utils.data] # URL for astropy remote data site. dataurl = http://data.astropy.org/ # Time to wait for remote data query (in seconds). remote_timeout = 3.0 You should be able to modify the values at run-time this way:: >>> from astropy.utils.data import DATAURL, REMOTE_TIMEOUT >>> DATAURL() 'http://data.astropy.org/' >>> DATAURL.set('http://astropydata.mywebsite.com') >>> DATAURL() 'http://astropydata.mywebsite.com' >>> REMOTE_TIMEOUT() 3.0 >>> REMOTE_TIMEOUT.set(4.5) >>> REMOTE_TIMEOUT() 4.5 Note that this will *not* permanently change these values in the configuration files - just for the current session. To change the configuration files, after you've made your changes, you can do:: >>> DATAURL.save() >>> REMOTE_TIMEOUT.save() Or to save all modifications to configuration items in `astropy.utils.data` (which includes the changes made above), do:: >>> from astropy.config import save_config >>> save_config('astropy.utils.data') Reloading Configuration ----------------------- Instead of modifying the variables in python, you can also modify the configuration files and then reload them. For example, if you modify the configuration file to say:: [utils.data] # URL for astropy remote data site. dataurl = http://myotherdata.mywebsite.com/ # Time to wait for remote data query (in seconds). remote_timeout = 6.3 And then run the following commands:: >>> DATAURL.reload() >>> REMOTE_TIMEOUT.reload() This should update the variables with the values from the configuration file:: >>> DATAURL() 'http://myotherdata.mywebsite.com/' >>> REMOTE_TIMEOUT() 6.3 Or if you want to reload all astropy configuration at once, use the `~astropy.config.configuration.reload_config` function:: >>> config.reload_config('astropy') Developer Usage --------------- Configuration items should be used wherever an option or setting is needed that is either tied to a system configuration or should persist across sessions of astropy or an affiliated package. Admittedly, this is only a guideline, as the precise cases where a configuration item is preferred over, say, a keyword option for a function is somewhat personal preference. It is the preferred form of persistent configuration, however, and astropy packages must all use it (and it is recommended for affiliated packages). The Reference guide below describes the full interface for a `ConfigurationItem` - this is a guide for *typical* developer usage. In almost all cases, a configuration item should be defined and used in the following manner:: """ This is the docstring at the beginning of a module """ from astropy.config import ConfigurationItem SOME_SETTING = ConfigurationItem('some_setting', 1, 'A description.') ANOTHER_SETTING = ConfigurationItem('another_set', 'a string val', 'A longer description of what this does.') ... implementation ... def some_func(): #to get the value of these options, I might do: something = SOME_SETTING() + 2 return ANOTHER_SETTING() + ' Also, I added text.' It is highly recommended that any configuration items be placed at the top of a module like this, as they can then be easily found when viewing the source code and the automated tools to generate the default configuration files can also locate these items. Item Types and Validation ^^^^^^^^^^^^^^^^^^^^^^^^^ If not otherwise specified, a `ConfigurationItem` gets its type from the type of the `defaultvalue` it is given when it is created. The item can only be set to be an object of this type. Hence:: SOME_SETTING = ConfigurationItem('some_setting', 1, 'A description.') SOME_SETTING.set(1.2) will fail, because ``1.2`` is a float and ``1`` is an int. Note that if you want the configuration item to be limited to a particular set of specific options, you should pass in a list as the `defaultvalue` option. The first entry in the list will be taken as the default, and the list as a whole gives all the valid options. For example:: AN_OPTION = ConfigurationItem('an_option', ['a', 'b', 'c'], "This option can be 'a', 'b', or 'c'") AN_OPTION.set('b') # succeeds AN_OPTION.set('c') # succeeds AN_OPTION.set('d') # fails! AN_OPTION.set(6) # fails! Finally, a ConfigurationItem can be explicitly give a type via the `cfgtype` option:: AN_INT_SETTING = ConfigurationItem('an_int_setting', 1, 'A description.', cfgtype='integer') AN_INT_SETTING.set(3) # works fine AN_INT_SETTING.set(4.2) #fails! If the default value's type doesn't match `cfgtype`, the `ConfigurationItem` cannot be created:: >>> AN_INT_SETTING = ConfigurationItem('an_int_setting', 4.2, 'A description.', cfgtype='integer') VdtTypeError: the value "4.2" is of the wrong type. hence the default behavior (of automatically determining `cfgtype`) is usually what you want. The main exception is when you want your configuration item to be a list. The default behavior will treat that as a list of *options* unless you explicitly tell it that the `ConfigurationItem` itself is supposed to be a list:: >>> A_LIST_SETTING = ConfigurationItem(a_list_setting', [1, 2, 3], 'A description.') >>> A_LIST_SETTING() 1 >>> A_LIST_SETTING = ConfigurationItem(a_list_setting', [1, 2, 3], 'A description.', cfgtype='list') >>> A_LIST_SETTING() [1, 2, 3] Details of all the valid `cfgtype` items can be found in the `validation section of the configobj manual `_. We simply list the valid values here for quick reference: * 'integer' * 'float' * 'boolean' * 'string' * 'ip_addr' * 'list' * 'tuple' * 'int_list' * 'float_list' * 'bool_list' * 'string_list' * 'ip_addr_list' * 'mixed_list' * 'option' * 'pass' Usage Tips ^^^^^^^^^^ There are a couple important gotchas to remember about using configuration items in your code. First, it is tempting to do something like:: SOME_SETTING = ConfigurationItem('SOME_SETTING' ,1 ,'A description.') def some_func(): return SOME_SETTING + 2 # WRONG, you wanted SOME_SETTING() + 2 but this is incorrect, because ``SOME_SETTING`` instead of ``SOME_SETTING()`` will yield a `ConfigurationItem` object, instead of the *value* of that item (an integer, in this case). The second point to keep in mind is that `ConfigurationItem` objects can be changed at runtime by users. So you always read their values instead of just storing their initial value to some other variable (or used as a default for a function). For example, the following will work, but is incorrect usage:: SOME_SETTING = ConfigurationItem('SOME_SETTING',1,'A description.') def some_func(val=SOME_SETTING()): return val + 2 This works fine as long as the user doesn't change its value during runtime, but if they do, the function won't know about the change:: >>> some_func() 3 >>> SOME_SETTING.set(3) >>> some_func() # naively should return 5, because 3 + 2 = 5 3 There are two ways around this. The typical/intended way is:: def some_func(): """ The `SOME_SETTING` configuration item influences this output """ return SOME_SETTING() + 2 Or, if the option needs to be available as a function parameter:: def some_func(val=None): """ If not specified, `val` is set by the `SOME_SETTING` configuration item. """ return (SOME_SETTING() if val is None else val) + 2 See Also ======== :doc:`/logging` (overview of `astropy.logger`) Reference/API ============= .. automodapi:: astropy.config :no-inheritance-diagram: astropy-0.3/docs/coordinates/0000755000175000017500000000000012243263747014451 5ustar oleoleastropy-0.3/docs/coordinates/creating.rst0000644000175000017500000000661112243255342016773 0ustar oleoleCreating Coordinate Objects --------------------------- Creating new coordinate objects is of course crucial to using `~astropy.coordinates`. The typical way to create a new coordinate object is to directly initialize your preferred coordinate system using standard python class creation, using the name of the class representing that system and a number for the two angles. For example:: >>> from astropy.coordinates import ICRS, FK4, Galactic >>> import astropy.units as u >>> ICRS(187.70592, 12.39112, unit=(u.degree, u.degree)) >>> FK4(187.07317, 12.66715, unit=(u.degree, u.degree)) >>> Galactic(283.77763, 74.49108, unit=(u.degree, u.degree)) Note that if you do not provide units explicitly, this will fail:: >>> ICRS(23, 1) Traceback (most recent call last): ... UnitsError: No unit was specified While the above example uses python numerical types, you can also provide strings to create coordinates. If the `unit` parameter is ``(None, None)`` (the default), strings will be interpreted using the `Angle` class' parsing scheme, and has a guiding principal of being able to interpret any *unambiguous* string specifying an angle. For the exact rules for how each string is parsed, see the `~astropy.coordinates.angles.Angle` documentation. Some examples:: >>> ICRS("3h36m29.7888s -41d08m15.162342s", unit=(None, None)) >>> ICRS("3h36m29.7888s -41d08m15.162342s") >>> ICRS("14.12412 hours", "-41:08:15.162342 degrees") >>> ICRS("14.12412 -41:08:15.162342") Traceback (most recent call last): ... UnitsError: No unit specified You can also directly specify the units for both to resolve ambiguities in parsing the angle strings:: >>> ICRS("14.12412 -41:08:15.162342", unit=(u.hour, u.degree)) >>> ICRS("54:7:26.832 -41:08:15.162342", unit=(u.degree, u.degree)) >>> ICRS('3 4 5 +6 7 8', unit=(u.hour, u.degree)) >>> ICRS('3h4m5s +6d7m8s', unit=(u.hour, u.degree)) It's also possible to create coordinates using lists or `numpy` arrays. The same unit rules apply as for scalar angles.:: >>> ICRS([187.70592, 123.45678], [12.39112, 9.87654], unit=(u.degree, u.degree)) >>> ICRS([187.70592, 123.45678], [12.39112, 9.87654]) Traceback (most recent call last): ... UnitsError: No unit was specified .. warning:: If you try to create an angle using a tuple for each angle instead of a list or `numpy` array, it will be interpreted aa ``(hours, minutes, seconds)`` or ``(degrees, arcmin, arcsec)``. So if you actually want multiple coordinates from a tuple, convert it to a list or array. One final way to create coordinates is to copy them from an already existing coordinate object:: >>> i1 = ICRS(187.70592, 12.39112, unit=(u.degree, u.degree)) >>> i2 = ICRS(i1) >>> i1 >>> i2 astropy-0.3/docs/coordinates/sgr-example.rst0000644000175000017500000002500012243255342017414 0ustar oleole.. _sgr-example: Example: Defining a new spherical coordinate system --------------------------------------------------- This document describes in detail how to subclass and define a custom spherical coordinate system, as mentioned in :doc:`designing` and the docstring for `~astropy.coordinates.coordsystems.SphericalCoordinatesBase`. In this example, we will define a coordinate system defined by the plane of orbit of the Sagittarius Dwarf Galaxy (hereafter Sgr; as defined in Majewski et al. 2003). The Sgr coordinate system is often referred to in terms of two angular coordinates, :math:`\Lambda,B`. We'll start by using a template to generate a descriptive docstring for our subclass. Then we'll add some glue to the default initializer to recognize that we want to call the coordinates `Lambda` and `Beta`. Then we have to define the transformation from this coordinate system to some other built-in system, in this case we will use spherical Galactic Coordinates as defined in `~astropy.coordinates.builtin_systems.Galactic`. The first step is to create a new class for our coordinates, let's call it `SgrCoordinates` and make it a subclass of `~astropy.coordinates.coordsystems.SphericalCoordinatesBase`:: import astropy.coordinates as coord class SgrCoordinates(coord.SphericalCoordinatesBase): """ A spherical coordinate system defined by the orbit of the Sagittarius dwarf galaxy, as described in http://adsabs.harvard.edu/abs/2003ApJ...599.1082M and further explained in http://www.astro.virginia.edu/~srm4n/Sgr/. """ We can use some convenience variables defined at the superclass level to generate a descriptive docstring for our subclass:: __doc__ = __doc__.format(params=coord.SphericalCoordinatesBase. \ _init_docstring_param_templ.format(lonnm='Lambda', latnm='Beta')) This may look scary, but let's break down what it is doing. `__doc__` is a class attribute defined in the superclass, `~astropy.coordinates.coordsystems.SphericalCoordinatesBase`, and is just a string with a placeholder for a docstring specific to this subclass. We specify that extra, descriptive text by using `format()` with the `params` keyword. `params` expects a string describing the variable names of our current coordinate system. We can generate this from a template as well by formatting another class attribute and telling it what we want to name our coordinates (in this case, Lambda and Beta). The template string is defined as a class attribute `~astropy.coordinates.coordsystems.SphericalCoordinatesBase._init_docstring_param_templ`, and expects the name of the longitude-equivalent (Lambda) and latitude-equivalent (Beta) coordinates:: coord.SphericalCoordinatesBase._init_docstring_param_templ .format(lonnm='Lambda', latnm='Beta') If this looks strange or complicated, just remember that we're just doing this to help the user (this will provide them with a nice docstring if they look at the help for this class). **The bottom line:** if you want to define a custom spherical coordinate system with two angular coordinates, copy and paste the below line into the class definition and change `'Lambda'` to the name of your longitude coordinate, and `'Beta'` to the name of your latitude coordinate.:: __doc__ = __doc__.format(params=coord.SphericalCoordinatesBase. \ _init_docstring_param_templ.format(lonnm='Lambda', latnm='Beta')) Next we can define our subclass' initializer, `__init__()`. We start by calling `__init__()` on the superclass. Then, we add a catch to see if the user passed in another `~astropy.coordinates.coordsystems.SphericalCoordinatesBase` object in. If so, we can just transform those coordinates to `SgrCoordinates` and copy the attributes directly. Otherwise, we have to tell our subclass how to parse the arguments and keyword arguments that the user passed in. We do this with the `_initialize_latlon()` classmethod. This convenience function accepts the name of the longitude coordinate, the name of the latitude coordinate, and the arguments and keyword arguments passed to this initializer. This function will handle parsing the args and kwargs to validate and sanitize the input from the user.:: def __init__(self, *args, **kwargs): super(SgrCoordinates, self).__init__() if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], coord.SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._lonangle = newcoord._lonangle self._latangle = newcoord._latangle self._distance = newcoord._distance else: super(SgrCoordinates, self). _initialize_latlon('Lambda', 'Beta', args, kwargs) Next we have to tell the class what to use for the longitude and latitude when doing coordinate transformations with other coordinate systems. We do that by defining properties of the class -- in this case `Lambda` and `Beta` -- that reference the internal names for the longitude and latitude:: @property def Lambda(self): return self._lonangle @property def Beta(self): return self._latangle Finally, we customize the default string formatting by specifying the string names of the longitude and latitude, as well as the default numerical representation (degree minute second for longitude and degree minute second for latitude):: # strings used for making __repr__ work _repr_lon_name = 'Lambda' _repr_lat_name = 'Beta' # Default format for to_string _default_string_style = 'dmsdms' Now our coordinate system is set up! You can now create `SgrCoordinates` objects by passing any valid specifiers accepted by `~astropy.coordinates.coordsystems.SphericalCoordinatesBase`, but you won't be able to transform to and from any other coordinate systems because we haven't yet defined how to do that. We will define the coordinate transformation as a function that accepts a `~astropy.coordinates.builtin_systems.Galactic` object and returns an `SgrCoordinates` object. We could alternatively define the transformation by specifying a transformation matrix ( `~astropy.coordinates.transformations.static_transform_matrix`), but in this case the transformation is from a left-handed coordinate system to a right- handed system, so we need more control over the transformation. We'll start by constructing the rotation matrix, using the helper function `astropy.coordinates.angles.rotation_matrix` :: # Define the Euler angles (from Law & Majewski 2010) phi = np.radians(180+3.75) theta = np.radians(90-13.46) psi = np.radians(180+14.111534) # Generate the rotation matrix using the x-convention (see Goldstein) D = rotation_matrix(phi, "z", unit=u.radian) C = rotation_matrix(theta, "x", unit=u.radian) B = rotation_matrix(psi, "z", unit=u.radian) sgr_matrix = np.array(B.dot(C).dot(D)) This is done at the module level, since it will be used by both the transformation from Sgr to Galactic as well as the inverse from Galactic to Sgr. Now we can define our first transformation function:: # Galactic to Sgr coordinates @transformations.transform_function(coord.Galactic, SgrCoordinates) def galactic_to_sgr(galactic_coord): """ Compute the transformation from Galactic spherical to heliocentric Sgr coordinates. """ l = np.atleast_1d(galactic_coord.l.radian) b = np.atleast_1d(galactic_coord.b.radian) X = cos(b)*cos(l) Y = cos(b)*sin(l) Z = sin(b) # Calculate X,Y,Z,distance in the Sgr system Xs, Ys, Zs = sgr_matrix.dot(np.array([X, Y, Z])) Zs = -Zs # Calculate the angular coordinates lambda,beta Lambda = np.degrees(np.arctan2(Ys,Xs)) Lambda[Lambda < 0] = Lambda[Lambda < 0] + 360 Beta = np.degrees(np.arcsin(Zs/np.sqrt(Xs*Xs+Ys*Ys+Zs*Zs))) return SgrCoordinates(Lambda, Beta, distance=galactic_coord.distance, unit=(u.degree, u.degree)) The decorator `@transformations.transform_function(coord.Galactic, SgrCoordinates)` registers this function with the `Coordinates` subpackage as a transformation. Inside the function, we simply follow the same procedure as detailed by David Law's `transformation code `. Note that in this case, both coordinate systems are heliocentric, so we can simply copy any distance from the `~astropy.coordinates.builtin_systems.Galactic` object. We then register the inverse transformation by using the Transpose of the rotation matrix:: @transformations.transform_function(SgrCoordinates, coord.Galactic) def sgr_to_galactic(sgr_coord): """ Compute the transformation from heliocentric Sgr coordinates to spherical Galactic. """ L = np.atleast_1d(sgr_coord.Lambda.radian) B = np.atleast_1d(sgr_coord.Beta.radian) Xs = cos(B)*cos(L) Ys = cos(B)*sin(L) Zs = sin(B) Zs = -Zs X, Y, Z = sgr_matrix.T.dot(np.array([Xs, Ys, Zs])) l = np.degrees(np.arctan2(Y,X)) b = np.degrees(np.arcsin(Z/np.sqrt(X*X+Y*Y+Z*Z))) if l<0: l += 360 return coord.Galactic(l, b, distance=sgr_coord.distance, unit=(u.degree, u.degree)) Now that we've registered these transformations between `SgrCoordinates` and `~astropy.coordinates.builtin_systems.Galactic`, we can transform between *any* coordinate system and `SgrCoordinates` (as long as the other system has a path to transform to `~astropy.coordinates.builtin_systems.Galactic`). For example, to transform from ICRS coordinates to `SgrCoordinates`, we simply:: >>> from astropy import units as u >>> import astropy.coordinates as coord >>> icrs = coord.ICRS(280.161732, 11.91934, unit=(u.degree,u.degree)) >>> icrs.transform_to(SgrCoordinates) # doctest: +SKIP The complete code for the above example is included below for reference. See Also ======== * Majewski et al. 2003, "A Two Micron All Sky Survey View of the Sagittarius Dwarf Galaxy. I. Morphology of the Sagittarius Core and Tidal Arms", http://arxiv.org/abs/astro-ph/0304198 * Law & Majewski 2010, "The Sagittarius Dwarf Galaxy: A Model for Evolution in a Triaxial Milky Way Halo", http://arxiv.org/abs/1003.1132 * David Law's Sgr info page http://www.astro.virginia.edu/~srm4n/Sgr/ Complete Code for Example ========================= .. literalinclude:: sgr-example.py :linenos: :language: python astropy-0.3/docs/coordinates/transforming.rst0000644000175000017500000000576312243255342017717 0ustar oleoleTransforming Between Systems ---------------------------- `astropy.coordinates` supports a rich system for transforming coordinates from one system to another. The key concept is that a registry of all the transformations is used to determine which coordinates can convert to others. When you ask for a transformation, the registry (or "transformation graph") is searched for the shortest path from your starting coordinate to your target, and it applies all of the transformations in that path in series. This allows only the simplest transformations to be defined, and the package will automatically determine how to combine those transformations to get from one system to another. As described above, there are two ways of transforming coordinates. Coordinates that have an alias (created with `~astropy.coordinates.transformations.coordinate_alias`) can be converted by simply using attribute style access to any other coordinate system:: >>> from astropy import units as u >>> from astropy.coordinates import Galactic, ICRS >>> gc = Galactic(l=0, b=45, unit=(u.degree, u.degree)) >>> gc.fk5 >>> ic = ICRS(ra=0, dec=45, unit=(u.degree, u.degree)) >>> ic.fk5 While this appears to be simple attribute-style access, it is actually just syntactic sugar for the `transform_to` method:: >>> from astropy.coordinates import FK5 >>> gc.transform_to(FK5) >>> ic.transform_to(FK5) The full list of supported coordinate systems and transformations is in the `astropy.coordinates` API documentation below. Additionally, some coordinate systems support precessing the coordinate to produce a new coordinate in the same system but at a different equinox. Note that these systems have a default equinox they start with if you don't specify one:: >>> from astropy.time import Time >>> fk5c = FK5('02h31m49.09s +89d15m50.8s') >>> fk5c.equinox
array([(1, 2.0, 'x'), (4, 5.0, 'y')], dtype=[('a', '>> Table([t['c'], t['a']])
array([('x', 1), ('y', 4)], dtype=[('c', 'S1'), ('a', '>> Table([t['a']**2, t['b'] + 10])
array([(1, 12.0), (16, 15.0)], dtype=[('a', '>> a = (1, 4) >>> b = np.array([[2, 3], [5, 6]]) # vector column >>> c = Column(['x', 'y'], name='axis') >>> arr = (a, b, c) >>> Table(arr) # Data column named "c" has a name "axis" that table
array([(1, [2, 3], 'x'), (4, [5, 6], 'y')], dtype=[('col0', '>> data = [{'a': 5, 'b': 10}, {'a': 15, 'b': 20}] >>> Table(data)
array([(5, 10), (15, 20)], dtype=[('a', '>> t = Table([{'a': 5, 'b': 10}, {'a': 15, 'b': 30, 'c': 50}]) Traceback (most recent call last): ... ValueError: Row 0 has no value for column c Row input """"""""" You can make a new table from a single row of an existing table:: >>> a = [1, 4] >>> b = [2.0, 5.0] >>> t = Table([a, b], names=('a', 'b')) >>> t2 = Table(t[1]) Remember that a |Row| has effectively a zero length compared to the newly created |Table| which has a length of one. This is similar to the difference between a scalar ``1`` (length 0) and an array like ``np.array([1])`` with length 1. Dictionary input """""""""""""""" A dictionary of column data can be used to initialize a |Table|. >>> arr = {'a': [1, 4], ... 'b': [2.0, 5.0], ... 'c': ['x', 'y']} >>> >>> Table(arr)
array([(1, 'x', 2.0), (4, 'y', 5.0)], dtype=[('a', '>> Table(arr, names=('a', 'b', 'c'), dtype=('f4', 'i4', 'S2'))
array([(1.0, 2, 'x'), (4.0, 5, 'y')], dtype=[('a', '>> arr = {'a': (1, 4), ... 'b': np.array([[2, 3], [5, 6]]), ... 'c': Column(['x', 'y'], name='axis')} >>> Table(arr, names=('a', 'b', 'c'))
array([(1, [2, 3], 'x'), (4, [5, 6], 'y')], dtype=[('a', '>> Table(arr, names=('a_new', 'b_new', 'c_new')) Traceback (most recent call last): ... KeyError: 'a_new' NumPy structured array """""""""""""""""""""" The structured array is the standard mechanism in `numpy` for storing heterogenous table data. Most scientific I/O packages that read table files (e.g. `PyFITS `_, `vo.table `_, `asciitable `_) will return the table in an object that is based on the structured array. A structured array can be created using:: >>> arr = np.array([(1, 2.0, 'x'), ... (4, 5.0, 'y')], ... dtype=[('a', 'i8'), ('b', 'f8'), ('c', 'S2')]) From ``arr`` it is simple to create the corresponding |Table| object:: >>> Table(arr)
array([(1, 2.0, 'x'), (4, 5.0, 'y')], dtype=[('a', '>> table = Table(arr) >>> print table a b c --- --- --- 1 2.0 x 4 5.0 y **New column names** The column names can be changed from the original values by providing the ``names`` argument:: >>> Table(arr, names=('a_new', 'b_new', 'c_new'))
array([(1, 2.0, 'x'), (4, 5.0, 'y')], dtype=[('a_new', '>> Table(arr, dtype=('f4', 'i4', 'S4'))
array([(1.0, 2, 'x'), (4.0, 5, 'y')], dtype=[('a', '>> Table(arr, names=('a_new', 'b_new', 'c_new'), dtype=('f4', 'i4', 'S4'))
array([(1.0, 2, 'x'), (4.0, 5, 'y')], dtype=[('a_new', '`` where ```` is the column number. **Basic example with automatic column names** :: >>> arr = np.array([[1, 2, 3], ... [4, 5, 6]]) >>> Table(arr)
array([(1, 2, 3), (4, 5, 6)], dtype=[('col0', '>> Table(arr, names=('a_new', 'b_new', 'c_new'), dtype=('f4', 'i4', 'S4'))
array([(1.0, 2, '3'), (4.0, 5, '6')], dtype=[('a_new', '>> t = Table(arr, copy=False) **Python arrays versus `numpy` arrays as input** There is a slightly subtle issue that is important to understand in the way that |Table| objects are created. Any data input that looks like a Python list (including a tuple) is considered to be a list of columns. In contrast an homogeneous `numpy` array input is interpreted as a list of rows:: >>> arr = [[1, 2, 3], ... [4, 5, 6]] >>> np_arr = np.array(arr) >>> Table(arr) # Two columns, three rows
array([(1, 4), (2, 5), (3, 6)], dtype=[('col0', '>> Table(np_arr) # Three columns, two rows
array([(1, 2, 3), (4, 5, 6)], dtype=[('col0', '>> arr = [[1, 2.0, 'string'], # list of rows ... [2, 3.0, 'values']] >>> col_arr = zip(*arr) # transpose to a list of columns >>> col_arr [(1, 2), (2.0, 3.0), ('string', 'values')] >>> t = Table(col_arr) Table columns """"""""""""" A new table can be created by selecting a subset of columns in an existing table:: >>> t = Table(names=('a', 'b', 'c')) >>> t2 = t['c', 'b', 'a'] # Makes a copy of the data >>> print t2 c b a --- --- --- An alternate way to use the ``columns`` attribute (explained in the `TableColumns`_ section) to initialize a new table. This let's you choose columns by their numerical index or name and supports slicing syntax:: >>> Table(t.columns[0:2])
array([], dtype=[('a', '>> Table([t.columns[0], t.columns['c']])
array([], dtype=[('a', '". If provided the ``dtype`` list overrides the base column types and must match the length of ``names``. **dict-like** The keys of the ``data`` object define the base column names. The corresponding values can be Column objects, numpy arrays, or list-like objects. The ``names`` list (optional) can be used to select particular fields and/or reorder the base names. The ``dtype`` list (optional) must match the length of ``names`` and is used to override the existing or default data types. **list-like** Each item in the ``data`` list provides a column of data values and can be a Column object, numpy array, or list-like object. The ``names`` list defines the name of each column. The names will be auto-generated if not provided (either from the ``names`` argument or by Column objects). If provided the ``names`` argument must match the number of items in the ``data`` list. The optional ``dtype`` list will override the existing or default data types and must match ``names`` in length. **list-of-dicts** Similar to Python's builtin ``csv.DictReader``, each item in the ``data`` list provides a row of data values and must be a dict. The key values in each dict define the column names and each row must have identical column names. The ``names`` argument may be supplied to specify colum ordering. If it is not provided, the column order will default to alphabetical. The ``dtype`` list may be specified, and must correspond to the order of output columns. If any row's keys do no match the rest of the rows, a ValueError will be thrown. **None** Initialize a zero-length table. If ``names`` and optionally ``dtype`` are provided then the corresponding columns are created. names """"" The ``names`` argument provides a way to specify the table column names or override the existing ones. By default the column names are either taken from existing names (for ``ndarray`` or ``Table`` input) or auto-generated as ``col``. If ``names`` is provided then it must be a list with the same length as the number of columns. Any list elements with value ``None`` fall back to the default name. In the case where ``data`` is provided as dict of columns, the ``names`` argument can be supplied to specify the order of columns. The ``names`` list must then contain each of the keys in the ``data`` dict. If ``names`` is not supplied then the order of columns in the output table is not determinate. dtype """"" The ``dtype`` argument provides a way to specify the table column data types or override the existing types. By default the types are either taken from existing types (for ``ndarray`` or ``Table`` input) or auto-generated by the ``numpy.array()`` routine. If ``dtype`` is provided then it must be a list with the same length as the number of columns. The values must be valid ``numpy.dtype`` initializers or ``None``. Any list elements with value ``None`` fall back to the default type. In the case where `data` is provided as dict of columns, the ``dtype`` argument must be accompanied by a corresponding ``names`` argument in order to uniquely specify the column ordering. meta """" The ``meta`` argument is simply an object that contains meta-data associated with the table. It is recommended that this object be a dict or OrderedDict_, but the only firm requirement is that it can be copied with the standard library ``copy.deepcopy()`` routine. By default ``meta`` is an empty OrderedDict_. copy """" By default the input ``data`` are copied into a new internal ``np.ndarray`` object in the Table object. In the case where ``data`` is either an ``np.ndarray`` object or an existing ``Table``, it is possible to use a reference to the existing data by setting ``copy=False``. This has the advantage of reducing memory use and being faster. However one should take care because any modifications to the new Table data will also be seen in the original input data. See the `Copy versus Reference`_ section for more information. .. _copy_versus_reference: Copy versus Reference ^^^^^^^^^^^^^^^^^^^^^ Normally when a new |Table| object is created, the input data are *copied* into a new internal array object. This ensures that if the new table elements are modified then the original data will not be affected. However, when creating a table from a numpy ndarray object (structured or homogeneous), it is possible to disable copying so that instead a memory reference to the original data is used. This has the advantage of being faster and using less memory. However, caution must be exercised because the new table data and original data will be linked, as shown below:: >>> arr = np.array([(1, 2.0, 'x'), ... (4, 5.0, 'y')], ... dtype=[('a', 'i8'), ('b', 'f8'), ('c', 'S2')]) >>> arr['a'] # column "a" of the input array array([1, 4]) >>> t = Table(arr, copy=False) >>> t['a'][1] = 99 >>> arr['a'] # arr['a'] got changed when we modified t['a'] array([ 1, 99]) Note that when referencing the data it is not possible to change the data types since that operation requires making a copy of the data. In this case an error occurs:: >>> t = Table(arr, copy=False, dtype=('f4', 'i4', 'S4')) Traceback (most recent call last): ... ValueError: Cannot specify dtype when copy=False Another caveat in using referenced data is that you cannot add new row to the table. This generates an error because of conflict between the two references to the same underlying memory. Internally, adding a row may involve moving the data to a new memory location which would corrupt the input data object. `numpy` does not allow this:: >>> t.add_row([1, 2, 3]) Traceback (most recent call last): File "", line 1, in File "astropy/table/table.py", line 760, in add_row self._data.resize((newlen,), refcheck=False) ValueError: cannot resize this array: it does not own its data Column and TableColumns classes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ There are two classes, |Column| and |TableColumns|, that are useful when constructing new tables. Column """""" A |Column| object can be created as follows, where in all cases the column ``name`` should be provided as a keyword argument and one can optionally provide these values: ``data`` : list, ndarray or None Column data values ``dtype`` : numpy.dtype compatible value Data type for column ``description`` : str Full description of column ``unit`` : str Physical unit ``format`` : str or function `Format specifier`_ for outputting column values ``meta`` : dict Meta-data associated with the column Initialization options '''''''''''''''''''''' The column data values, shape, and data type are specified in one of two ways: **Provide a ``data`` value but not a ``length`` or ``shape``** Examples:: col = Column([1, 2], name='a') # shape=(2,) col = Column([[1, 2], [3, 4]], name='a') # shape=(2, 2) col = Column([1, 2], name='a', dtype=float) col = Column(np.array([1, 2]), name='a') col = Column(['hello', 'world'], name='a') The ``dtype`` argument can be any value which is an acceptable fixed-size data-type initializer for the numpy.dtype() method. See ``_. Examples include: - Python non-string type (float, int, bool) - Numpy non-string type (e.g. np.float32, np.int64, np.bool) - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15') If no ``dtype`` value is provide then the type is inferred using ``np.array(data)``. When ``data`` is provided then the ``shape`` and ``length`` arguments are ignored. **Provide ``length`` and optionally ``shape``, but not ``data``** Examples:: col = Column(name='a', length=5) col = Column(name='a', dtype=int, length=10, shape=(3,4)) The default ``dtype`` is ``np.float64``. The ``shape`` argument is the array shape of a single cell in the column. The default ``shape`` is () which means a single value in each element. .. note:: After setting the type for a column, that type cannot be changed. If data values of a different type are assigned to the column then they will be cast to the existing column type. .. _table_format_string: Format specifier '''''''''''''''' The format specifier controls the output of column values when a table or column is printed or written to an ASCII table. The format specifier can be either a "old-style" or "new-style" format string or a function: **Old-style** This corresponds to syntax like ``"%.4f" % value`` as documented in `String formatting operations `_. ``"%.4f"`` to print four digits after the decimal in float format, or ``"%6d"`` to print an integer in a 6-character wide field. **New-style** This corresponds to syntax like ``"{:.4f}".format(value)`` as documented in `format string syntax `_. ``"{:.4f}"`` to print four digits after the decimal in float format, or ``"{:6d}"`` to print an integer in a 6-character wide field. Note that in either case any Python format string that formats exactly one value is valid, so ``{:.4f} angstroms`` or ``Value: %12.2f`` would both work. **Function** The greatest flexibility can be achieved by setting a formatting function. This function must accept a single argument (the value) and return a string. In the following example this is used to make a LaTeX ready output:: >>> t = Table([[1,2],[1.234e9,2.34e-12]], names = ('a','b')) >>> def latex_exp(value): ... val = '{:8.2}'.format(value) ... mant, exp = val.split('e') ... # remove leading zeros ... exp = exp[0] + exp[1:].lstrip('0') ... return '$ {0} \\times 10^{{ {1} }}$' .format(mant, exp) >>> t['b'].format = latex_exp >>> t['a'].format = '{0:.4f}' >>> import sys >>> t.write(sys.stdout, format='latex') \begin{table} \begin{tabular}{cc} a & b \\ 1.0000 & $ 1.2 \times 10^{ +9 }$ \\ 2.0000 & $ 2.3 \times 10^{ -12 }$ \\ \end{tabular} \end{table} TableColumns """""""""""" Each |Table| object has an attribute ``columns`` which is an ordered dictionary that stores all of the |Column| objects in the table (see also the `Column`_ section). Technically the ``columns`` attribute is a |TableColumns| object, which is an enhanced ordered dictionary that provides easier ways to select multiple columns. There are a few key points to remember: - A |Table| can be initialized from a |TableColumns| object (copy is always True). - Selecting multiple columns from a |TableColumns| object returns another |TableColumns| object. - Select one column from a |TableColumns| object returns a |Column|. So now look at the ways to select columns from a |TableColumns| object: **Select columns by name** :: >>> t = Table(names=('a', 'b', 'c', 'd')) >>> t.columns['d', 'c', 'b'] **Select columns by index slicing** :: >>> t.columns[0:2] # Select first two columns >>> t.columns[::-1] # Reverse column order **Select column by index or name** :: >>> t.columns[1] # Choose columns by index array([], dtype=float64) >>> t.columns['b'] # Choose column by name array([], dtype=float64) astropy-0.3/docs/table/table_repr_html.png0000644000175000017500000002207612243255342017076 0ustar oleole‰PNG  IHDRY»H—3 oFFs¸&žò pHYs  ÒÝ~ü vpAg =Ýh#ÆIDATxÚíÝypÖÕ½?pŸ„%!#VÃb‹"”67]liQh*´*^Ë"u™jÕ uú+2µ´•jÙÚ°Ú£ØB-\ðRQ¡‹Šì‘Є%`X’<¿?ÎíÌs‡ MeKò¼^d¾sžï–óœ0ãÛÏ9'F£Ñè@ÜHÐoÄ‚wÄ‚wÄ‚wÄ‚wÄ‚wÄ‚wÄ‚wÄ‚wé‚xF£ÑèÁƒ¸lÙÆ78°iÓ¦M%%åååå••¥¥¥¥O<ѺuëÖ͚Ş_PPPP\üÝï~÷»üã;ï¼óNqñUW]uURÒ¨Q£FÝtÓĉ'Þzk$‰ü_Ïzÿý÷ßøá?ÿùÏÞ³ç›ßüæ7-ª/eõêÕ«W¯8pàÀ‹ŠŠŠŠŠZµjÕªU+BõQ­ª‹‹‹‹óò.\¸pèÐÐòî»ï¾ûÐC¡=ü¬k¿Xzzzz³f-[¶l™œ|î3Oœ8qâôé!C† ¹þú§Ÿ~úé~ýÎvfEEEEuõ Aƒ-X‘‘‘‘’²yóæÍ=ô‡?üáwßýÊ+¯¼²uëK/½ôÒßþv¶;„«BŒhðp¹Ô*ÌÌÌÌlÞ<6Ì ñVh?ϼ*vJïo~ó›ßlÞܽ{÷î/½Ô´iÓ¦'Þpà 7¼ôR¨¶»¼]0gΜ9¹¹?þøã99Ÿþô§?ݶíÙÎܰaÆŠ‹‹‹ËË'L˜0áÖ[¯½öÚk[¶ W7nÜç>—ŸŸŸ¿~ýÅxÏJ;VSSS^šþINNNNNu‚¡¥}ûöíÛ·OŽá  ~¹Dk †º¹sçÎ<8Lï u|£GýûßחΪªªªª© ÇM›6mš˜ûiRRRR£FaòňíÖ¬Y³fÏž:tøÉOJJJJŽ¿4¿õîÝ»wïÞ=þüùó燖‚‚‚‚‚‚Ý1ü!Ô/—( +îÝ|óÍ7·ióÉO~ò“­Z=òÈ#dg‡ú»S§NªªªûÕ³gÏž™™©©©©M›¾ð /üå/¡‚ïðáÇOž -••••ÕÕau†1D®¾úꫯ¾:------´dddddd\Ã@ýr‰bÁ0Ù6¶%----))F¯¸âøñãÇOŸ®û•’’’Ò¸ñ‚ ÜqÇâÅ‹oÙ’’’’òì³;vìø“ŸÄN¦ŽDζéÈÇ÷¥/}éK;‡­]Î6qjãÅ‚ gÉ¢ÑÖxíµû÷ïߟ—·k×®]>ZRRRòÄ}úôéÓ¡Cˆ›7oÞ¼Ià €º)A|ÌŽKHHˆD:tèÐ!5µY³fÍ7^ºtéÒ÷ßÏÉÉÉéÐáÂ× ^qE˜j½{÷îÝeeÕÕÕÕ—6HMLLLüçZŠ5555ÿ\c€ú¨V±à”—9räÈ©S¡%lyÚÃÏúÛa}ÃðsÇŽ;Ž í›7oÞ\RÚcÏß¾}ûöÇ׬Y³fïÞÒ?~üŸÿ¼bÅŠ;väååååä\Œ÷|óÍ7ßÜ»·S§N~ö³ÒÒÒÒKµåH•••••Ž/^¼xñâòòòòòòS§Nú稠¾hT›“Ú´iÓæÇ?ŽméÞ½{÷—^Šm kÞÕÇ.èÕ«W¯éÓÏlÿ¾ð…9sÎüí****ªªFŒ1bÉ’={öì9z4++++-möìÙ³ss 0 k׆7P®¹æšk®¹fܸqãÆ›4iÒ¤I“òòòòòòÂð“'Ož³ªêĉ'>ñ‰!C† ùÿxúé§Ÿ>Û™ÕÕ/¿øàԩÇn×îÿ^§¯}û~ýúõ+.þË_þò—sO¡­,...Žf;bÄ»ï¾ûnh?/WgÕÔTUUU…ãÄĦM›6ý411)))éàÁM›6mº±]QÑš5kÖLŸÞ¡C‡'N””””¾|<ÿ"}ú„è0¶ ®ù±`ØR#ìçûá‡o½õÖ[gžóá‡o¾ùæ›mÚdgggÇVÉ…€,‡Ý~c¯:vlß¾}ûÎöÜH$1111×Íí5"‘„„„„-:tèÐ!D¢a/æ¶msrrr.Fµ`UÕ©S§N=º{÷îÝa+Àç_Ä‚!ž»é¦‡~øáµk'L˜0a×®×^{íµcÇöîÝ»wóæÙ³gÏ~÷Ý9sæÌ¹ùæÇüñØk[·îÑ£GnÞ}Æ?>Ä‘«V=òÈ#„`1¬¯w¡º`îÜ^½zõ:³ýw¿û¾ð…pûİÍÈŸþ4bĈÇŽíÙ³gOjjVVVÖm·Íž={v§N ``P—E¢ÑúºÆß™öìY¹råÊE‹ú÷ïßÿÁ‹‹‹‹ëæÖõå=h¨5Ô_lÖ¬.]ºtiÛ¶OŸ>}†]±bÅŠºðVÓ¦µoß¾ý©S‡:dð]lÿjÓ.®†ô¿ áiPÕ‚UU'OžÎ"A@¼ @Ü @Ü @Ü @Ü @Ü ÂETUUUUU‰¡O€º@,qG,qG,Hœ*.....6lذaÃ222222[¶lÙ²eËÜÜÜÜÜÜíÛ·oß¾ýÂ>wêÔ©S§NMKKKKKkÕªU«V­Æ?~üøh4FëBÏäçççççwëÖ­[·n5jÔ¨QÛ¶mÛ¶mûÌ3Ï<óÌ3§OŸ>}ú´ñõ]¤î„pw$‰œu„ñ‹_üâ¿øú믿þúë™™™™™™ÙÙÙÙÙÙ;wîܹsç¦M›6mÚÔ£G=z~¼§„µ7nܸqãÐÒ¤I“&MšôêÕ«W¯^ÿûßÿþ÷¿WWWWWWÏš5kÖ¬Y£F5jÔåê“ßþö·¿ýíoïºë®»îº+99999ùÖ[o½õÖ[7lذaÆ?üðÃ? áàĉ'NœøñžÔª‰S¡BðŽ;î¸ãŽ;V¯^½zõê%K–,Y²dÕªU«V­ ç„p0Ävê¹3f̘1cƺuëÖ­[7}úôéÓ§‡öiÓ¦M›6íòöÉüãÿøÇáxîܹsçÎ]ºtéÒ¥Kßzë­·Þz+„›¡Ýø€úNE wpŸ³f-„}¯¼òÊ+¯¼j·nݺuëÖ7nܸñÈ‘#GŽ g†i³a:í¿û”3«ËËËËËËSRRRRRŽ;vìØ±+¯¼òÊ+¯ çTTTTTT\¼=‹Ïý¶M›6mÚ´ieeeeeeYYYYYYx· û .P-Hœ=zôèÑ£‡:tèÐ÷ßÿý÷ßúè£>އ>|øðÐ'}ûöíÛ·o˜L}ß}÷Ýwß}ÆÔwbAâÔ¼yóæÍ›öÞ¾}ûöíÛ÷íÛ·oß¾°oìšz±usçoòäÉ“'OÞ²eË–-[RSSSSS'Mš4iÒ¤{î¹çž{î¹¼}rï½÷Þ{ï½a#”¬¬¬¬¬¬+V¬X±"Ô0N˜0a„ O>ùä“O>iü@}g[îà¾$_Ô¯í5ô ¨€¸#€¸#€¸#€¸#€¸#€¸‰F£ÑhTGÐw$‰DôÃåâߨËé¶‹N…ð±¾D`—æm²P÷™D qG,qG,qG,qG,qG,qG,qG,qG,qG,ÿãäÉ“'OžlÕªU«V­.ì×®]»víÚœœœœœœ&Mš4iÒ$55555õî»ï¾ûî»|øðáÃSRRRRRZ¶lÙ²e˧žzê©§žª©©©©©ñ=µ!$®•–––––.Z´hÑ¢E¹¹¹¹¹¹‡>|øð…º¸Ûm·ÝvÛm·eggggg””””””„˜¯6w ñßÖ­[·nÝZXXXXX¸jÕªU«V-X°`Á‚3gΜ9s¦ï¨ ± qmçÎ;wî áZZZZZZÚ…½ÿš5kÖ¬YSUUUUUõüóÏ?ÿüó]»víÚµë¤I“&Mš´bÅŠ+Vœû>¡pÞ¼yóæÍ WuéÒ¥K—.½zõêÕ«×O<ñÄOäçççççŸÏÛ._¾|ùòåW]uÕUW]µwïÞ½{÷†ömÛ¶mÛ¶íÊ+¯¼òÊ+×­[·nÝ:#ê»H4F£:‚8¸#‘Häßá!üºîºë®»îºÚ_uî§|ôÑG}ôÑ¡C‡:”•••••ûé‹/¾øâ‹/þò—¿üå/êÏö”PcØ¡C‡:”•••••….|&)å+_ùÊW¾rìØ±cÇŽOŸ<öØc=öØÆ7nÜøÚk¯½öÚk}úôéÓ§ÏСC‡úýïÿûßÿþ…íyàÒk¤ àâi#´„•'Ož}:Äm=zôèÑ£G¨¤ 놉Àç¾ClxfüZÂ&$çÿ¶IIIIII!\¿~ýúõëóòòòòòü‹ „jA¸ˆÂš€ßøÆ7¾ño„(0m™™™™™™µ¿O›6mÚ´iöÓ{ûõëׯ_¿ðihéÞ½{÷îÝÏÿÃ6)Ï<óÌ3Ï<3xðàÁƒ‡iÅŸýìg?ûÙÏ6kÖ¬Y³f¾Y¨ïÔþÀE´téÒ¥K—¾ñÆo¼ñƳÏ>ûì³Ï†•·!öªY³fÍš5+œZÂj}÷Þ{ï½÷Þ;~üøñãLJ5÷íÛ·oß¾)S¦L™2eĈ#FŒ8Ÿ· ÁåèÑ£GÝ¿ÿþýû/^¼xñâÅa›”±cÇŽ;Öw ƒjA¸ˆÂf !ÂëÙ³gÏž=Ïvfì!˜ëÛ·oß¾}c÷GÁâC=ôÐCµk×®]»v‰‰‰‰‰‰<ðÀ<®:Ÿ·1cÆŒ36ćgÏž={öìo¼ñÆo4hРAƒ 0`Àß/Ô_v ¥áîK²nýÚuWŸIÄwÄ‚wÄ‚wÄ‚wÄ‚wìJÃÜ‘H$Ñ—‹[ .k¤ hØ.v8ÂÇú]š·È@Ýg1ı ı ı ı ı ı ı ı ı ü/«V­ZµjUbbbbbâ…ºçsÏ=÷ÜsÏEÎ"77777·6÷9~üøñãLJ>|øð””””””–-[¶lÙò©§žzê©§jjjjjj|ƒ@m4ÒìÛ·oß¾}wÞyçwÞya#¶mÛ¶mÛ¶mäÈ‘#GŽ|â‰'žxâ‰ØO›7oÞ¼yóÚÜ'Ä[·nݺukaaaaaá±cÇŽ;‚Ŭ¬¬¬¬¬ûï¿ÿþûï÷mç¦Z®¨¨¨¨¨¨2dÈ!C† 6lذ {ÿ÷Þ{ï½÷Þ»å–[n¹å–®1ºuëÖ­[·öíÛ·oßþÜw1å¼yóæÍ›7iÒ¤I“&uéÒ¥K—.½zõêÕ«WˆóóóóóóÏç=ÇŒ3f̘¯~õ«_ýêWÏüôóŸÿüç?ÿùqãÆ7Θ€úN,W<öØc=öØ'>ñ‰O|â¶Ú.F£Ñ NŸ>}úôéÉÉÉÉÉÉIIIIII 0`Àž={öìÙsîûìß¿ÿþýeeeeee7ß|óÍ7ßûihÙ²eË–-[Îçmïºë®»îºkùòåË—/?räÈ‘#GBûîÝ»wïÞýÆo¼ñÆa ³1õX¸êïÞ|óÍ7ß|sÚ´iÓ¦M ëý]¨ûôÑG}ôQG=zôè0í7D-Z´hÑ¢ÅàÁƒijÝ'¬*ŽÃU±Ÿ¦¦¦¦¦¦–—————ŸÏÛÞtÓM7ÝtS˜Œ¼dÉ’%K–„ö_ÿú׿þõ¯?÷¹Ï}îsŸ UŠFÔwbAâTX¡//////oΜ9sæÌ Á\l‚¶ÊÊÊÊÊÊ÷”Ø­[·nݺu! Õ‚íÚµk׮݋/¾øâ‹/®_¿~ýúõEEEEEEg»OlxfüZÂ&$çÓ'! 5ƒ¿ûÝï~÷»ß…>™;wîܹsÃÚˆF4 bAâÔÆ7nÜXZZZZZªäBôÖ»wïÞ½{‡sBË”)S¦L™òñž²iÓ¦M›6…éÃg~[™â³ݧM›6mÚ´ û‡7?ówéÞ½{÷îÝÏ¿gB,vdþãÿøÇ?þñÀ¸ãŽ;î¸ã#†È¹§.B=Ü‘H$òoð°kðu×]wÝu×ÕæÚs?eÇŽ;vìw›8qâĉGŒ1bĈ£G=ztìØ±cÇŽ­®®®®®~õÕW_}õÕpÕ¬Y³fÍš¶@IKKKKK ía Ä5¾üòË/¿ür¸Oÿþýû÷ï>=÷Úˆµï“°™IÃ&$3f̘1cÆÅëyàRR-QX‰oÙ²eË–-[´hÑ¢E‹Ú¶mÛ¶mÛììììììôôôôôô°¾aìUaºqˆäbÛŸ}öÙgŸ}6ì\¦!÷èÑ£G¹¹¹¹¹¹áª õæ¡f0¼ƒéÃÐð¨è¡áîKR³V¿*ãjÿ¶¡b1L ~÷Ýwß}÷ÝÚoÆ¢Zê¾Fº******ÂÄä©S§N:uÔ¨Q£Fº°»3uIÄÀÿ((((((ÓœÃ$åxàÐ3Ðð˜èGÃÜ&ëà,T @Ü @Ü @ܱþ wpÛ?÷²òo Ôet ›í5.ýÛ d î3‰âŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽX¸öÜsÏ=÷Üs‘³ÈÍÍÍÍÍ=ÿ§lÙ²eË–-ýû÷ïß¿rrrrrr‹-Z´h1tèСC‡׿>k×®]»vmNNNNNN“&Mš4i’šššššz÷Ýwß}÷Ý=`À€ôìÙ³gÏž;vìØ±cGaaaaaa‡ 6lذsßçðáǾí¶Ûn»í¶ììììì좢¢¢¢¢‚‚‚‚‚‚’’’’’’áÇ>Üw ÔF$F£QAÜ‘H$ò/Fx¨¼»ï¾ûî»ï¾oûÛßþö·C{£F5jtþOùàƒ>øàƒk¯½öÚk¯=qâĉ'Bµ`ø4„zŸùÌg>ó™ÏTUUUUUí)¯¾úꫯ¾IJ²²²²²Ø7üÛßþö·¿ý­OŸ>}úô©¬¬¬¬¬üxoûú믿þúë·ß~ûí·ßÛ^SSSSS"Îð¬Þ½{÷îÝû|z¸¼T §BhõÞ{ï½÷Þ{Ó§OŸ>}zì’’’’’’B}ßž={öìÙs>OéСC‡:vìØ±cÇýèG?úÑÊËËËËË:tèС©S§N:µ_¿~ýúõ;÷}n½õÖ[o½uóæÍ›7o>3²üë_ÿú׿þõ†n¸á†ÎçmÃSNÅQæ!C† >ýÔ§>õ©O}Êø€úNE wpŸ³fíØ±cÇŽûò—¿üå/yÔ¨Q£Fºçž{î¹çž0]÷ÑG}ôÑGÄßwÞyçwÞ wûwŸ,_¾|ùòå!jŒmoÖ¬Y³fÍ6lذaÆPQXûß.¬$8yòäÉ“'ÏŸ?þüùË–-[¶lY¯^½zõêõñúäLO?ýôÓO?½dÉ’%K–¼ýöÛo¿ývZZZZZÚùô<PøOwîà>p*¬ÖwõÕW_}õÕ{÷îÝ»wo¨ûûwŸRQQQQQÑ©S§N:=zôèÑyyyyyy¡/ïÛ·oß¾}«W¯^½zõ¹ß*Lã}þùçŸþù^xá…^ÓŠŸ|òÉ'Ÿ|²uëÖ­[·¾P}2sæÌ™3gŽ7nܸqëÖ­[·n]VVVVVÖÅîyàÒðŸî4ÜÁ}ÎpjÓ¦M›6m p÷ßÿý÷ßûiiiiiiiFFFFFF8>[èvî§„zî]»víÚõ̵CbXßðÜk†Õý¾þõ¯ýë_Ïš5kÖ¬Y³233333/TŸ¡¶1ì’¼råÊ•+W†Õ/ìS€Ë«‘. >… ¼?üðÃ?|ôèÑ£GŽ1bĈáxìØ±cÇŽýÚ×¾öµ¯}­6UxgVlß¾}ûöíCåݘ1cÆŒsòäÉ“'ONš4iÒ¤I}ûöíÛ·oìU!ò +ú…I»K—.]ºté1ÊbÄ^Û­[·nݺ}¼·Ý¸qãÆ¿õ­o}ë[ßš;wîܹsÿÝ@¨/l9BœêÒ¥K—.]Âz|‹-Z´hQÛ¶mÛ¶m›žžžžž>oÞ¼yóæÏS7nܸqã?ýéOúÓŸÖ¯_¿~ýú07lܪêÂÊ€±W…éÆ8pà@hY»víÚµkÃzˆ={öìÙ³çugq>o›ŸŸŸŸŸ‚Ñ;ï¼óÎ;ïL:C˜\lü@}g¢ wp_’©¬õk¬>Õ‚wÄ‚wÄ‚wÄ‚wÄ‚wìJÃÜ‘H$Ñ—‹[ . @Ü1‰âŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽXâŽXâÎÿ|;ÈóƒñüIEND®B`‚astropy-0.3/docs/table/masking.rst0000644000175000017500000001330512243255342015403 0ustar oleole.. include:: references.txt Masking and missing values -------------------------- The `astropy.table` package provides support for masking and missing values in a table by wrapping the `numpy.ma` masked array package. This allows handling tables with missing or invalid entries in much the same manner as for standard (unmasked) tables. It is useful to be familiar with the `masked array `_ documentation when using masked tables within `astropy.table`. In a nutshell, the concept is to define a boolean mask that mirrors the structure of the table data array. Wherever a mask value is ``True``, the corresponding entry is considered to be missing or invalid. Operations involving column or row access and slicing are unchanged. The key difference is that arithmetic or reduction operations involving columns or column slices follow the rules for `operations on masked arrays `_. .. Note:: Reduction operations like `numpy.sum` or `numpy.mean` follow the convention of ignoring masked (invalid) values. This differs from the behavior of the floating point ``NaN``, for which the sum of an array including one or more ``NaN's`` will result in ``NaN``. See ``_ for a very interesting discussion of different strategies for handling missing data in the context of `numpy`. Table creation ^^^^^^^^^^^^^^^ A masked table can be created in several ways: **Create a new table object and specify masked=True** :: >>> from astropy.table import Table, Column, MaskedColumn >>> t = Table([(1, 2), (3, 4)], names=('a', 'b'), masked=True) >>> t
masked_array(data = [(1, 3) (2, 4)], mask = [(False, False) (False, False)], fill_value = (999999, 999999), dtype = [('a', ' Notice the table attributes ``mask`` and ``fill_value`` that are available for a masked table. **Create a table with one or more columns as a MaskedColumn object** >>> a = MaskedColumn([1, 2], name='a') >>> b = Column([3, 4], name='b') >>> t = Table([a, b]) The |MaskedColumn| is the masked analog of the |Column| class and provides the interface for creating and manipulating a column of masked data. The |MaskedColumn| class inherits from `numpy.ma.MaskedArray`, in contrast to |Column| which inherits from `numpy.ndarray`. This distinction is the main reason there are different classes for these two cases. **Create a table with one or more columns as a numpy MaskedArray** >>> from numpy import ma # masked array package >>> a = ma.array([1, 2]) >>> b = [3, 4] >>> t = Table([a, b], names=('a', 'b')) **Add a MaskedColumn object to an existing table** >>> t = Table([[1, 2]], names=['a']) >>> b = MaskedColumn([3, 4], mask=[True, False]) >>> t['b'] = b INFO: Upgrading Table to masked Table [astropy.table.table] Note the INFO message because the underlying type of the table is modified in this operation. **Add a new row to an existing table and specify a mask argument** >>> a = Column([1, 2], name='a') >>> b = Column([3, 4], name='b') >>> t = Table([a, b]) >>> t.add_row([3, 6], mask=[True, False]) INFO: Upgrading Table to masked Table [astropy.table.table] **Convert an existing table to a masked table** >>> t = Table([[1, 2], ['x', 'y']]) # standard (unmasked) table >>> t = Table(t, masked=True) # convert to masked table Table access ^^^^^^^^^^^^ Nearly all the of standard methods for accessing and modifying data columns, rows, and individual elements also apply to masked tables. There are two minor differences for the |Row| object that is obtained by indexing a single row of a table: - For standard tables, two such rows can be compared for equality, but in masked tables this comparison will produce an exception. - For standard tables a |Row| object provides a view of the underlying table data so that it is possible to modify a table by modifying the row values. In masked tables this is a copy so that modifying the |Row| object has no effect on the original table data. Both of these differences are due to issues in the underlying `numpy.ma.MaskedArray` implementation. Masking and filling ^^^^^^^^^^^^^^^^^^^^ Both the |Table| and |MaskedColumn| classes provide attributes and methods to support manipulating tables with missing or invalid data. Mask """" The actual mask for the table as a whole or a single column can be viewed and modified via the ``mask`` attribute:: >>> t = Table([(1, 2), (3, 4)], names=('a', 'b'), masked=True) >>> t['a'].mask = [False, True] # Modify column mask (boolean array) >>> t['b'].mask = [True, False] # Modify column mask (boolean array) >>> print(t) a b --- --- 1 -- -- 4 Masked entries are shown as ``--`` when the table is printed. Filling """"""" The entries which are masked (i.e. missing or invalid) can be replaced with specified fill values. In this case the |MaskedColumn| or masked |Table| will be converted to a standard |Column| or table. Each column in a masked table has a ``fill_value`` attribute that specifies the default fill value for that column. To perform the actual replacement operation the ``filled()`` method is called. This takes an optional argument which can override the default column ``fill_value`` attribute. :: >>> t['a'].fill_value = -99 >>> t['b'].fill_value = 33 >>> print t.filled() a b --- --- 1 33 -99 4 >>> print t['a'].filled() a --- 1 -99 >>> print t['a'].filled(999) a --- 1 999 >>> print t.filled(1000) a b ---- ---- 1 1000 1000 4 astropy-0.3/docs/table/modify_table.rst0000644000175000017500000001164512243255342016415 0ustar oleole.. _modify_table: .. include:: references.txt Modifying a table ----------------- The data values within a |Table| object can be modified in much the same manner as for `numpy` structured arrays by accessing columns or rows of data and assigning values appropriately. A key enhancement provided by the |Table| class is the ability to easily modify the structure of the table: one can add or remove columns, and add new rows of data. Quick overview ^^^^^^^^^^^^^^ The code below shows the basics of modifying a table and its data. **Make a table** :: >>> from astropy.table import Table >>> import numpy as np >>> arr = np.arange(15).reshape(5, 3) >>> t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}}) **Modify data values** :: >>> t['a'] = [1, -2, 3, -4, 5] # Set all column values >>> t['a'][2] = 30 # Set row 2 of column 'a' >>> t[1] = (8, 9, 10) # Set all row values >>> t[1]['b'] = -9 # Set column 'b' of row 1 >>> t[0:3]['c'] = 100 # Set column 'c' of rows 0, 1, 2 **Add a column or columns** A single column can be added to a table using syntax like adding a dict value. The value on the right hand side can be a list or array of the correct size, or a scalar value that will be broadcast:: >>> t['d1'] = np.arange(5) >>> t['d2'] = [1, 2, 3, 4, 5] >>> t['d3'] = 6 # all 5 rows set to 6 For more explicit control the :meth:`~astropy.table.table.Table.add_column` and :meth:`~astropy.table.table.Table.add_columns` methods can be used to add one or multiple columns to a table. In both cases the new columns must be specified as |Column| or |MaskedColumn| objects with the ``name`` defined:: >>> from astropy.table import Column >>> aa = Column(np.arange(5), name='aa') >>> t.add_column(aa, index=0) # Insert before the first table column # Make a new table with the same number of rows and add columns to original table >>> t2 = Table(np.arange(25).reshape(5, 5), names=('e', 'f', 'g', 'h', 'i')) >>> t.add_columns(t2.columns.values()) Finally, columns can also be added from :class:`~astropy.units.quantity.Quantity` objects, which automatically sets the ``.unit`` attribute on the column: >>> from astropy import units as u >>> t['d'] = [1, 2, 3, 4, 5] * u.m >>> t['d'] array([1, 2, 3, 4, 5]) **Remove columns** :: >>> t.remove_column('f') >>> t.remove_columns(['aa', 'd1', 'd2', 'd3', 'e']) >>> del t['g'] >>> del t['h', 'i'] >>> t.keep_columns(['a', 'b']) **Rename columns** :: >>> t.rename_column('a', 'a_new') >>> t['b'].name = 'b_new' **Add a row of data** :: >>> t.add_row([-8, -9]) **Remove rows** :: >>> t.remove_row(0) >>> t.remove_rows(slice(4, 5)) >>> t.remove_rows([1, 2]) **Sort by one more more columns** :: >>> t.sort('b_new') >>> t.sort(['a_new', 'b_new']) **Reverse table rows** :: >>> t.reverse() **Modify meta-data** :: >>> t.meta['key'] = 'value' **Select or reorder columns** A new table with a subset or reordered list of columns can be created as shown in the following example:: >>> t = Table(arr, names=('a', 'b', 'c')) >>> t_acb = t['a', 'c', 'b'] Another way to do the same thing is to provide a list or tuple as the item as shown below:: >>> new_order = ['a', 'c', 'b'] # List or tuple >>> t_acb = t[new_order] Caveats ^^^^^^^ Modifying the table data and properties is fairly straightforward. There are only a few things to keep in mind: - The data type for a column cannot be changed in place. In order to do this you must make a copy of the table with the column type changed appropriately. - Adding or removing a column will generate a new copy in memory of all the data. If the table is very large this may be slow. - Adding a row *may* require a new copy in memory of the table data. This depends on the detailed layout of Python objects in memory and cannot be reliably controlled. In some cases it may be possible to build a table row by row in less than O(N**2) time but you cannot count on it. Another subtlety to keep in mind are cases where the return value of an operation results in a new table in memory versus a view of the existing table data. As an example, imagine trying to set two table elements using column selection with ``t['a', 'c']`` in combination with row index selection:: >>> t = Table([[1, 2], [3, 4], [5, 6]], names=('a', 'b', 'c')) >>> t['a', 'c'][1] = (100, 100) >>> print t a b c --- --- --- 1 3 5 2 4 6 This might be surprising because the data values did not change and there was no error. In fact what happened is that ``t['a', 'c']`` created a new temporary table in memory as a *copy* of the original and then updated row 1 of the copy. The original ``t`` table was unaffected and the new temporary table disappeared once the statement was complete. The takeaway is to pay attention to how certain operations are performed one step at a time. astropy-0.3/docs/table/operations.rst0000644000175000017500000006411612243255342016143 0ustar oleole.. include:: references.txt .. |join| replace:: :func:`~astropy.table.operations.join` .. _table_operations: Table operations ----------------- In this section we describe higher-level operations that can be used to generate a new table from one or more input tables. This includes: ======================= .. list-table:: :header-rows: 1 :widths: 28 52 20 * - Documentation - Description - Function * - `Grouped operations`_ - Group tables and columns by keys - `~astropy.table.table.Table.group_by` * - `Stack vertically`_ - Concatenate input tables along rows - `~astropy.table.operations.vstack` * - `Stack horizontally`_ - Concatenate input tables along columns - `~astropy.table.operations.hstack` * - `Join`_ - Database-style join of two tables - `~astropy.table.operations.join` .. _grouped-operations: Grouped operations ^^^^^^^^^^^^^^^^^^ Sometimes in a table or table column there are natural groups within the dataset for which it makes sense to compute some derived values. A simple example is a list of objects with photometry from various observing runs:: >>> from astropy.table import Table >>> obs = Table.read("""name obs_date mag_b mag_v ... M31 2012-01-02 17.0 17.5 ... M31 2012-01-02 17.1 17.4 ... M101 2012-01-02 15.1 13.5 ... M82 2012-02-14 16.2 14.5 ... M31 2012-02-14 16.9 17.3 ... M82 2012-02-14 15.2 15.5 ... M101 2012-02-14 15.0 13.6 ... M82 2012-03-26 15.7 16.5 ... M101 2012-03-26 15.1 13.5 ... M101 2012-03-26 14.8 14.3 ... """, format='ascii') Table groups ~~~~~~~~~~~~~~ Now suppose we want the mean magnitudes for each object. We first group the data by the ``name`` column with the :func:`~astropy.table.table.Table.group_by` method. This returns a new table sorted by ``name`` which has a ``groups`` property specifying the unique values of ``name`` and the corresponding table rows:: >>> obs_by_name = obs.group_by('name') >>> print obs_by_name # doctest: +SKIP name obs_date mag_b mag_v ---- ---------- ----- ----- M101 2012-01-02 15.1 13.5 << First group (index=0, key='M101') M101 2012-02-14 15.0 13.6 M101 2012-03-26 15.1 13.5 M101 2012-03-26 14.8 14.3 M31 2012-01-02 17.0 17.5 << Second group (index=4, key='M31') M31 2012-01-02 17.1 17.4 M31 2012-02-14 16.9 17.3 M82 2012-02-14 16.2 14.5 << Third group (index=7, key='M83') M82 2012-02-14 15.2 15.5 M82 2012-03-26 15.7 16.5 << End of groups (index=10) >>> print obs_by_name.groups.keys name ---- M101 M31 M82 >>> print obs_by_name.groups.indices [ 0 4 7 10] The ``groups`` property is the portal to all grouped operations with tables and columns. It defines how the table is grouped via an array of the unique row key values and the indices of the group boundaries for those key values. The groups here correspond to the row slices ``0:4``, ``4:7``, and ``7:10`` in the ``obs_by_name`` table. The initial argument (``keys``) for the `~astropy.table.table.Table.group_by` function can take a number of input data types: - Single string value with a table column name (as shown above) - List of string values with table column names - Another `Table` or `Table` column with same length as table - Numpy structured array with same length as table - Numpy homogeneous array with same length as table In all cases the corresponding row elements are considered as a tuple of values which form a key value that is used to sort the original table and generate the required groups. As an example, to get the average magnitudes for each object on each observing night, we would first group the table on both ``name`` and ``obs_date`` as follows:: >>> print obs.group_by(['name', 'obs_date']).groups.keys name obs_date ---- ---------- M101 2012-01-02 M101 2012-02-14 M101 2012-03-26 M31 2012-01-02 M31 2012-02-14 M82 2012-02-14 M82 2012-03-26 Manipulating groups ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Once you have applied grouping to a table then you can easily access the individual groups or subsets of groups. In all cases this returns a new grouped table. For instance to get the sub-table which corresponds to the second group (index=1) do:: >>> print obs_by_name.groups[1] name obs_date mag_b mag_v ---- ---------- ----- ----- M31 2012-01-02 17.0 17.5 M31 2012-01-02 17.1 17.4 M31 2012-02-14 16.9 17.3 To get the first and second groups together use a slice:: >>> groups01 = obs_by_name.groups[0:2] >>> print groups01 name obs_date mag_b mag_v ---- ---------- ----- ----- M101 2012-01-02 15.1 13.5 M101 2012-02-14 15.0 13.6 M101 2012-03-26 15.1 13.5 M101 2012-03-26 14.8 14.3 M31 2012-01-02 17.0 17.5 M31 2012-01-02 17.1 17.4 M31 2012-02-14 16.9 17.3 >>> print groups01.groups.keys name ---- M101 M31 You can also supply a numpy array of indices or a boolean mask to select particular groups, e.g.:: >>> mask = obs_by_name.groups.keys == 'M101' >>> print obs_by_name.groups[mask] name obs_date mag_b mag_v ---- ---------- ----- ----- M101 2012-01-02 15.1 13.5 M101 2012-02-14 15.0 13.6 M101 2012-03-26 15.1 13.5 M101 2012-03-26 14.8 14.3 One can iterate over the group sub-tables and corresponding keys with:: >>> from itertools import izip >>> for key, group in izip(obs_by_name.groups.keys, obs_by_name.groups): ... print('****** {0} *******'.format(key['name'])) ... print group ... print ... ****** M101 ******* name obs_date mag_b mag_v ---- ---------- ----- ----- M101 2012-01-02 15.1 13.5 M101 2012-02-14 15.0 13.6 M101 2012-03-26 15.1 13.5 M101 2012-03-26 14.8 14.3 ****** M31 ******* name obs_date mag_b mag_v ---- ---------- ----- ----- M31 2012-01-02 17.0 17.5 M31 2012-01-02 17.1 17.4 M31 2012-02-14 16.9 17.3 ****** M82 ******* name obs_date mag_b mag_v ---- ---------- ----- ----- M82 2012-02-14 16.2 14.5 M82 2012-02-14 15.2 15.5 M82 2012-03-26 15.7 16.5 Column Groups ~~~~~~~~~~~~~~ Like `Table` objects, `Column` objects can also be grouped for subsequent manipulation with grouped operations. This can apply both to columns within a `Table` or bare `Column` objects. As for `Table`, the grouping is generated with the `group_by()` method. The difference here is that there is no option of providing one or more column names since that doesn't make sense for a `Column`. Examples:: >>> from astropy.table import Column >>> import numpy as np >>> c = Column([1, 2, 3, 4, 5, 6], name='a') >>> key_vals = np.array(['foo', 'bar', 'foo', 'foo', 'qux', 'qux']) >>> cg = c.group_by(key_vals) >>> for key, group in izip(cg.groups.keys, cg.groups): ... print('****** {0} *******'.format(key)) ... print group ... print ... ****** bar ******* a --- 2 ****** foo ******* a --- 1 3 4 ****** qux ******* a --- 5 6 Aggregation ~~~~~~~~~~~~~~ Aggregation is the process of applying a specified reduction function to the values within each group for each non-key column. This function must accept a numpy array as the first argument and return a single scalar value. Common function examples are `numpy.sum`, `numpy.mean`, and `numpy.std`. For the example grouped table ``obs_by_name`` from above we compute the group means with the `~astropy.table.groups.TableGroups.aggregate` method:: >>> obs_mean = obs_by_name.groups.aggregate(np.mean) # doctest: +SKIP WARNING: Cannot aggregate column 'obs_date' [astropy.table.groups] >>> print obs_mean # doctest: +SKIP name mag_b mag_v ---- ----- ------ M101 15.0 13.725 M31 17.0 17.4 M82 15.7 15.5 It seems the magnitude values were successfully averaged, but what about the WARNING? Since the ``obs_date`` column is a string-type array, the `numpy.mean` function failed and raised an exception. Any time this happens then ``~astropy.table.groups.TableGroups.aggregate` will issue a warning and then drop that column from the output result. Note that the ``name`` column is one of the ``keys`` used to determine the grouping so it is automatically ignored from aggregation. From a grouped table it is possible to select one or more columns on which to perform the aggregation:: >>> print obs_by_name['mag_b'].groups.aggregate(np.mean) mag_b ----- 15.0 17.0 15.7 >>> print obs_by_name['name', 'mag_v', 'mag_b'].groups.aggregate(np.mean) name mag_v mag_b ---- ------ ----- M101 13.725 15.0 M31 17.4 17.0 M82 15.5 15.7 A single column of data can be aggregated as well:: >>> c = Column([1, 2, 3, 4, 5, 6], name='a') >>> key_vals = np.array(['foo', 'bar', 'foo', 'foo', 'qux', 'qux']) >>> cg = c.group_by(key_vals) >>> cg_sums = cg.groups.aggregate(np.sum) >>> for key, cg_sum in izip(cg.groups.keys, cg_sums): ... print 'Sum for {0} = {1}'.format(key, cg_sum) ... Sum for bar = 2 Sum for foo = 8 Sum for qux = 11 Filtering ~~~~~~~~~~ Table groups can be filtered by means of the `~astropy.table.groups.TableGroups.filter` method. This is done by supplying a function which is called for each group. The function which is passed to this method must accept two arguments: - ``table`` : `Table` object - ``key_colnames`` : list of columns in ``table`` used as keys for grouping It must then return either `True` or `False`. As an example, the following will select all table groups with only positive values in the non-key columns:: >>> def all_positive(table, key_colnames): ... colnames = [name for name in table.colnames if name not in key_colnames] ... for colname in colnames: ... if np.any(table[colname] < 0): ... return False ... return True An example of using this function is:: >>> t = Table.read(""" a b c ... -2 7.0 0 ... -2 5.0 1 ... 1 3.0 -5 ... 1 -2.0 -6 ... 1 1.0 7 ... 0 0.0 4 ... 3 3.0 5 ... 3 -2.0 6 ... 3 1.0 7""", format='ascii') >>> tg = t.group_by('a') >>> t_positive = tg.groups.filter(all_positive) >>> for group in t_positive.groups: ... print group ... print ... a b c --- --- --- -2 7.0 0 -2 5.0 1 a b c --- --- --- 0 0.0 4 As can be seen only the groups with ``a == -2`` and ``a == 0`` have all positive values in the non-key columns, so those are the ones that are selected. Likewise a grouped column can be filtered with the `~astropy.table.groups.ColumnGroups.filter`, method but in this case the filtering function takes only a single argument which is the column group. It still must return either `True` or `False`. For example:: def all_positive(column): if np.any(column < 0): return False return True .. _stack-vertically: Stack vertically ^^^^^^^^^^^^^^^^^^^^ The |Table| class supports stacking tables vertically with the `~astropy.table.operations.vstack` function. This process is also commonly known as concatenating or appending tables in the row direction. It corresponds roughly to the `numpy.vstack` function. For example, suppose one has two tables of observations with several column names in common:: >>> from astropy.table import Table, vstack >>> obs1 = Table.read("""name obs_date mag_b logLx ... M31 2012-01-02 17.0 42.5 ... M82 2012-10-29 16.2 43.5 ... M101 2012-10-31 15.1 44.5""", format='ascii') >>> obs2 = Table.read("""name obs_date logLx ... NGC3516 2011-11-11 42.1 ... M31 1999-01-05 43.1 ... M82 2012-10-30 45.0""", format='ascii') Now we can stack these two tables:: >>> print vstack([obs1, obs2]) name obs_date mag_b logLx ------- ---------- ----- ----- M31 2012-01-02 17.0 42.5 M82 2012-10-29 16.2 43.5 M101 2012-10-31 15.1 44.5 NGC3516 2011-11-11 -- 42.1 M31 1999-01-05 -- 43.1 M82 2012-10-30 -- 45.0 Notice that the ``obs2`` table is missing the ``mag_b`` column, so in the stacked output table those values are marked as missing. This is the default behavior and corresponds to ``join_type='outer'``. There are two other allowed values for the ``join_type`` argument, ``'inner'`` and ``'exact'``:: >>> print vstack([obs1, obs2], join_type='inner') name obs_date logLx ------- ---------- ----- M31 2012-01-02 42.5 M82 2012-10-29 43.5 M101 2012-10-31 44.5 NGC3516 2011-11-11 42.1 M31 1999-01-05 43.1 M82 2012-10-30 45.0 >>> print vstack([obs1, obs2], join_type='exact') Traceback (most recent call last): ... TableMergeError: Inconsistent columns in input arrays (use 'inner' or 'outer' join_type to allow non-matching columns) In the case of ``join_type='inner'``, only the common columns (the intersection) are present in the output table. When ``join_type='exact'`` is specified then `~astropy.table.operations.vstack` requires that all the input tables have exactly the same column names. More than two tables can be stacked by supplying a list of table objects:: >>> obs3 = Table.read("""name obs_date mag_b logLx ... M45 2012-02-03 15.0 40.5""", format='ascii') >>> print vstack([obs1, obs2, obs3]) name obs_date mag_b logLx ------- ---------- ----- ----- M31 2012-01-02 17.0 42.5 M82 2012-10-29 16.2 43.5 M101 2012-10-31 15.1 44.5 NGC3516 2011-11-11 -- 42.1 M31 1999-01-05 -- 43.1 M82 2012-10-30 -- 45.0 M45 2012-02-03 15.0 40.5 See also the sections on `Merging metadata`_ and `Merging column attributes`_ for details on how these characteristics of the input tables are merged in the single output table. Note also that you can use a single table row instead of a full table as one of the inputs. .. _stack-horizontally: Stack horizontally ^^^^^^^^^^^^^^^^^^^^^ The |Table| class supports stacking tables horizontally (in the column-wise direction) with the `~astropy.table.operations.hstack` function. It corresponds roughly to the `numpy.hstack` function. For example, suppose one has the following two tables:: >>> from astropy.table import Table, hstack >>> t1 = Table.read("""a b c ... 1 foo 1.4 ... 2 bar 2.1 ... 3 baz 2.8""", format='ascii') >>> t2 = Table.read("""d e ... ham eggs ... spam toast""", format='ascii') Now we can stack these two tables horizontally:: >>> print hstack([t1, t2]) a b c d e --- --- --- ---- ----- 1 foo 1.4 ham eggs 2 bar 2.1 spam toast 3 baz 2.8 -- -- As with `~astropy.table.operations.vstack`, there is an optional ``join_type`` argument that can take values ``'inner'``, ``'exact'``, and ``'outer'``. The default is ``'outer'``, which effectively takes the union of available rows and masks out any missing values. This is illustrated in the example above. The other options give the intersection of rows, where ``'exact'`` requires that all tables have exactly the same number of rows:: >>> print hstack([t1, t2], join_type='inner') a b c d e --- --- --- ---- ----- 1 foo 1.4 ham eggs 2 bar 2.1 spam toast >>> print hstack([t1, t2], join_type='exact') Traceback (most recent call last): ... TableMergeError: Inconsistent number of rows in input arrays (use 'inner' or 'outer' join_type to allow non-matching rows) More than two tables can be stacked by supplying a list of table objects. The example below also illustrates the behavior when there is a conflict in the input column names (see the section on `Column renaming`_ for details):: >>> t3 = Table.read("""a b ... M45 2012-02-03""", format='ascii') >>> print hstack([t1, t2, t3]) a_1 b_1 c d e a_3 b_3 --- --- --- ---- ----- --- ---------- 1 foo 1.4 ham eggs M45 2012-02-03 2 bar 2.1 spam toast -- -- 3 baz 2.8 -- -- -- -- The metadata from the input tables is merged by the process described in the `Merging metadata`_ section. Note also that you can use a single table row instead of a full table as one of the inputs. .. _table-join: Join ^^^^^^^^^^^^^^ The |Table| class supports the `database join `_ operation. This provides a flexible and powerful way to combine tables based on the values in one or more key columns. For example, suppose one has two tables of observations, the first with B and V magnitudes and the second with X-ray luminosities of an overlapping (but not identical) sample:: >>> from astropy.table import Table, join >>> optical = Table.read("""name obs_date mag_b mag_v ... M31 2012-01-02 17.0 16.0 ... M82 2012-10-29 16.2 15.2 ... M101 2012-10-31 15.1 15.5""", format='ascii') >>> xray = Table.read(""" name obs_date logLx ... NGC3516 2011-11-11 42.1 ... M31 1999-01-05 43.1 ... M82 2012-10-29 45.0""", format='ascii') The |join| method allows one to merge these two tables into a single table based on matching values in the "key columns". By default the key columns are the set of columns that are common to both tables. In this case the key columns are ``name`` and ``obs_date``. We can find all the observations of the same object on the same date as follows:: >>> opt_xray = join(optical, xray) >>> print opt_xray name obs_date mag_b mag_v logLx ---- ---------- ----- ----- ----- M82 2012-10-29 16.2 15.2 45.0 We can perform the match only by ``name`` by providing the ``keys`` argument, which can be either a single column name or a list of column names:: >>> print join(optical, xray, keys='name') name obs_date_1 mag_b mag_v obs_date_2 logLx ---- ---------- ----- ----- ---------- ----- M31 2012-01-02 17.0 16.0 1999-01-05 43.1 M82 2012-10-29 16.2 15.2 2012-10-29 45.0 This output table has all observations that have both optical and X-ray data for an object (M31 and M82). Notice that since the ``obs_date`` column occurs in both tables it has been split into two columns, ``obs_date_1`` and ``obs_date_2``. The values are taken from the "left" (``optical``) and "right" (``xray``) tables, respectively. The table joins so far are known as "inner" joins and represent the strict intersection of the two tables on the key columns. If one wants to make a new table which has *every* row from the left table and includes matching values from the right table when available, this is known as a left join:: >>> print join(optical, xray, join_type='left') name obs_date mag_b mag_v logLx ---- ---------- ----- ----- ----- M101 2012-10-31 15.1 15.5 -- M31 2012-01-02 17.0 16.0 -- M82 2012-10-29 16.2 15.2 45.0 Two of the observations do not have X-ray data, as indicated by the "--" in the table. When there are any missing values the output will be a masked table. You might be surprised that there is no X-ray data for M31 in the output. Remember that the default matching key includes both ``name`` and ``obs_date``. Specifying the key as only the ``name`` column gives:: >>> print join(optical, xray, join_type='left', keys='name') name obs_date_1 mag_b mag_v obs_date_2 logLx ---- ---------- ----- ----- ---------- ----- M101 2012-10-31 15.1 15.5 -- -- M31 2012-01-02 17.0 16.0 1999-01-05 43.1 M82 2012-10-29 16.2 15.2 2012-10-29 45.0 Likewise one can construct a new table with every row of the right table and matching left values (when available) using ``join_type='right'``. Finally, to make a table with the union of rows from both tables do an "outer" join:: >>> print join(optical, xray, join_type='outer') name obs_date mag_b mag_v logLx ------- ---------- ----- ----- ----- M101 2012-10-31 15.1 15.5 -- M31 1999-01-05 -- -- 43.1 M31 2012-01-02 17.0 16.0 -- M82 2012-10-29 16.2 15.2 45.0 NGC3516 2011-11-11 -- -- 42.1 Identical keys ~~~~~~~~~~~~~~ The |Table| join operation works even if there are multiple rows with identical key values. For example the following tables have multiple rows for the key column ``x``:: >>> from astropy.table import Table, join >>> left = Table([[0, 1, 1, 2], ['L1', 'L2', 'L3', 'L4']], names=('key', 'L')) >>> right = Table([[1, 1, 2, 4], ['R1', 'R2', 'R3', 'R4']], names=('key', 'R')) >>> print left key L --- --- 0 L1 1 L2 1 L3 2 L4 >>> print right key R --- --- 1 R1 1 R2 2 R3 4 R4 Doing an outer join on these tables shows that what is really happening is a `Cartesian product `_. For each matching key, every combination of the left and right tables is represented. When there is no match in either the left or right table, the corresponding column values are designated as missing. >>> print join(left, right, join_type='outer') key L R --- --- --- 0 L1 -- 1 L2 R1 1 L2 R2 1 L3 R1 1 L3 R2 2 L4 R3 4 -- R4 .. note:: The output table is sorted on the key columns, but when there are rows with identical keys the output order in the non-key columns is not guaranteed to be identical across installations. In the example above the order within the four rows with ``key == 1`` can vary. An inner join is the same but only returns rows where there is a key match in both the left and right tables:: >>> print join(left, right, join_type='inner') key L R --- --- --- 1 L2 R1 1 L2 R2 1 L3 R1 1 L3 R2 2 L4 R3 Conflicts in the input table names are handled by the process described in the section on `Column renaming`_. See also the sections on `Merging metadata`_ and `Merging column attributes`_ for details on how these characteristics of the input tables are merged in the single output table. Merging details ^^^^^^^^^^^^^^^^^^^^ When combining two or more tables there is the need to merge certain characteristics in the inputs and potentially resolve conflicts. This section describes the process. Column renaming ~~~~~~~~~~~~~~~~~ In cases where the input tables have conflicting column names, there is a mechanism to generate unique output column names. There are two keyword arguments that control the renaming behavior: ``table_names`` Two-element list of strings that provide a name for the tables being joined. By default this is ``['1', '2', ...]``, where the numbers correspond to the input tables. ``uniq_col_name`` String format specifier with a default value of ``'{col_name}_{table_name}'``. This is most easily understood by example using the ``optical`` and ``xray`` tables in the |join| example defined previously:: >>> print join(optical, xray, keys='name', ... table_names=['OPTICAL', 'XRAY'], ... uniq_col_name='{table_name}_{col_name}') name OPTICAL_obs_date mag_b mag_v XRAY_obs_date logLx ---- ---------------- ----- ----- ------------- ----- M31 2012-01-02 17.0 16.0 1999-01-05 43.1 M82 2012-10-29 16.2 15.2 2012-10-29 45.0 Merging metadata ~~~~~~~~~~~~~~~~~~~ |Table| objects can have associated metadata: - ``Table.meta``: table-level metadata as an ordered dictionary - ``Column.meta``: per-column metadata as an ordered dictionary The table operations described here handle the task of merging the metadata in the input tables into a single output structure. Because the metadata can be arbitrarily complex there is no unique way to do the merge. The current implementation uses a simple recursive algorithm with four rules: - `dict` elements are merged by keys - Conflicting `list` or `tuple` elements are concatenated - Conflicting `dict` elements are merged by recursively calling the merge function - Conflicting elements that are not both `list`, `tuple`, or `dict` will follow the following rules: - If both metadata values are identical, the output is set to this value - If one of the conflicting metadata values is `None`, the other value is picked - If both metadata values are different and neither is `None`, the one for the last table in the list is picked By default, a warning is emitted in the last case (both metadata values are not `None`). The warning can be silenced or made into an exception using the ``metadata_conflicts`` argument to :func:`~astropy.table.operations.hstack`, :func:`~astropy.table.operations.vstack`, or :func:`~astropy.table.operations.join`. The ``metadata_conflicts`` option can be set to: - ``'silent'`` - no warning is emitted, the value for the last table is silently picked - ``'warn'`` - a warning is emitted, the value for the last table is picked - ``'error'`` - an exception is raised Merging column attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In addition to the table and column ``meta`` attributes, the column attributes ``unit``, ``format``, and ``description`` are merged by going through the input tables in order and taking the first value which is defined (i.e. is not None). For example:: >>> from astropy.table import Column, Table, vstack >>> col1 = Column([1], name='a') >>> col2 = Column([2], name='a', unit='cm') >>> col3 = Column([3], name='a', unit='m') >>> t1 = Table([col1]) >>> t2 = Table([col2]) >>> t3 = Table([col3]) >>> out = vstack([t1, t2, t3]) WARNING: MergeConflictWarning: In merged column 'a' the 'unit' attribute does not match (cm != m). Using m for merged output [astropy.table.operations] >>> out['a'].unit Unit("m") The rules for merging are as for `Merging metadata`_, and the ``metadata_conflicts`` option also controls the merging of column attributes. astropy-0.3/docs/table/references.txt0000644000175000017500000000062012243255342016076 0ustar oleole.. |Row| replace:: :class:`~astropy.table.table.Row` .. |Table| replace:: :class:`~astropy.table.table.Table` .. |Column| replace:: :class:`~astropy.table.table.Column` .. |MaskedColumn| replace:: :class:`~astropy.table.table.MaskedColumn` .. |TableColumns| replace:: :class:`~astropy.table.table.TableColumns` .. _OrderedDict: http://docs.python.org/library/collections.html#collections.OrderedDict astropy-0.3/docs/table/index.rst0000644000175000017500000001323312243255342015061 0ustar oleole.. include:: references.txt .. _astropy-table: ***************************** Data Tables (`astropy.table`) ***************************** Introduction ============ `astropy.table` provides functionality for storing and manipulating heterogeneous tables of data in a way that is familiar to `numpy` users. A few notable features of this package are: * Initialize a table from a wide variety of input data structures and types. * Modify a table by adding or removing columns, changing column names, or adding new rows of data. * Handle tables containing missing values. * Include table and column metadata as flexible data structures. * Specify a description, units and output formatting for columns. * Interactively scroll through long tables similar to using ``more``. * Create a new table by selecting rows or columns from a table. * Perform :ref:`table_operations` like database joins and concatenation. * Manipulate multidimensional columns. * Methods for :ref:`read_write_tables` to files Currently `astropy.table` is used when reading an ASCII table using `astropy.io.ascii`. Future releases of AstroPy are expected to use the |Table| class for other subpackages such as `astropy.io.votable` and `astropy.io.fits`. Getting Started =============== The basic workflow for creating a table, accessing table elements, and modifying the table is shown below. These examples show a very simple case, while the full `astropy.table` documentation is available from the :ref:`using_astropy_table` section. First create a simple table with three columns of data named ``a``, ``b``, and ``c``. These columns have integer, float, and string values respectively:: >>> from astropy.table import Table >>> a = [1, 4, 5] >>> b = [2.0, 5.0, 8.2] >>> c = ['x', 'y', 'z'] >>> t = Table([a, b, c], names=('a', 'b', 'c'), meta={'name': 'first table'}) There are a few ways to examine the table. You can get detailed information about the table values and column definitions as follows:: >>> t
array([(1, 2.0, 'x'), (4, 5.0, 'y'), (5, 8.2, 'z')], dtype=[('a', '>> print(t) a b c --- --- --- 1 2.0 x 4 5.0 y 5 8.2 z For a long table you can scroll up and down through the table one page at time:: >>> t.more() # doctest: +SKIP You can also display it as an HTML-formatted table in the browser:: >>> t.show_in_browser() # doctest: +SKIP or as an interactive (searchable & sortable) javascript table:: >>> t.show_in_browser(jsviewer=True) # doctest: +SKIP Now examine some high-level information about the table:: >>> t.colnames ['a', 'b', 'c'] >>> len(t) 3 >>> t.meta {'name': 'first table'} Access the data by column or row using familiar `numpy` structured array syntax:: >>> t['a'] # Column 'a' array([1, 4, 5]) >>> t['a'][1] # Row 1 of column 'a' 4 >>> t[1] # Row obj for with row 1 values >>> t[1]['a'] # Column 'a' of row 1 4 One can retrieve a subset of a table by rows (using a slice) or columns (using column names), where the subset is returned as a new table:: >>> print(t[0:2]) # Table object with rows 0 and 1 a b c --- --- --- 1 2.0 x 4 5.0 y >>> print(t['a', 'c']) # Table with cols 'a', 'c' a c --- --- 1 x 4 y 5 z Modifying table values in place is flexible and works as one would expect:: >>> t['a'] = [-1, -2, -3] # Set all column values >>> t['a'][2] = 30 # Set row 2 of column 'a' >>> t[1] = (8, 9.0, "W") # Set all row values >>> t[1]['b'] = -9 # Set column 'b' of row 1 >>> t[0:2]['b'] = 100.0 # Set column 'b' of rows 0 and 1 >>> print(t) a b c --- ----- --- -1 100.0 x 8 100.0 W 30 8.2 z Add, remove, and rename columns with the following:: >>> t['d'] = [1, 2, 3] >>> del t['c'] >>> t.rename_column('a', 'A') >>> t.colnames ['A', 'b', 'd'] Adding a new row of data to the table is as follows:: >>> t.add_row([-8, -9, 10]) >>> len(t) 4 Lastly, one can create a table with support for missing values, for example by setting ``masked=True``:: >>> t = Table([a, b, c], names=('a', 'b', 'c'), masked=True) >>> t['a'].mask = [True, True, False] >>> t
masked_array(data = [(--, 2.0, 'x') (--, 5.0, 'y') (5, 8.2, 'z')], mask = [(True, False, False) (True, False, False) (False, False, False)], fill_value = (999999, 1e+20, 'N'), dtype = [('a', '>> print(t) a b c --- --- --- -- 2.0 x -- 5.0 y 5 8.2 z .. _using_astropy_table: Using `table` ============= The details of using `astropy.table` are provided in the following sections: Construct table --------------- .. toctree:: :maxdepth: 2 construct_table.rst Access table --------------- .. toctree:: :maxdepth: 2 access_table.rst Modify table --------------- .. toctree:: :maxdepth: 2 modify_table.rst Table operations ----------------- .. toctree:: :maxdepth: 2 operations.rst Masking --------------- .. toctree:: :maxdepth: 2 masking.rst I/O with tables ---------------- .. toctree:: :maxdepth: 2 io.rst Reference/API ============= .. automodapi:: astropy.table astropy-0.3/docs/table/access_table.rst0000644000175000017500000003405112243255362016365 0ustar oleole.. _access_table: .. include:: references.txt Accessing a table ----------------- Accessing the table properties and data is straightforward and is generally consistent with the basic interface for `numpy` structured arrays. Quick overview ^^^^^^^^^^^^^^ For the impatient, the code below shows the basics of accessing table data. Where relevant there is a comment about what sort of object. Except where noted, the table access returns objects that can be modified in order to update table data or properties. In cases where is returned and how the data contained in that object relate to the original table data (i.e. whether it is a copy or reference, see :ref:`copy_versus_reference`). **Make table** :: from astropy.table import Table import numpy as np arr = np.arange(15).reshape(5, 3) t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}}) **Table properties** :: t.columns # Dict of table columns t.colnames # List of column names t.meta # Dict of meta-data len(t) # Number of table rows **Access table data** :: t['a'] # Column 'a' t['a'][1] # Row 1 of column 'a' t[1] # Row obj for with row 1 values t[1]['a'] # Column 'a' of row 1 t[2:5] # Table object with rows 2:5 t[[1, 3, 4]] # Table object with rows 1, 3, 4 (copy) t[np.array([1, 3, 4])] # Table object with rows 1, 3, 4 (copy) t['a', 'c'] # Table with cols 'a', 'c' (copy) dat = np.array(t) # Copy table data to numpy structured array object **Print table or column** :: print t # Print formatted version of table to the screen t.pprint() # Same as above t.pprint(show_unit=True) # Show column unit t.pprint(show_name=False) # Do not show column names t.pprint(max_lines=-1, max_width=-1) # Print full table no matter how long / wide it is t.more() # Interactively scroll through table like Unix "more" print t['a'] # Formatted column values t['a'].pprint() # Same as above, with same options as Table.pprint() t['a'].more() # Interactively scroll through column lines = t.pformat() # Formatted table as a list of lines (same options as pprint) lines = t['a'].pformat() # Formatted column valuues as a list Details ^^^^^^^ For all the following examples it is assumed that the table has been created as below:: >>> from astropy.table import Table, Column >>> import numpy as np >>> arr = np.arange(15).reshape(5, 3) >>> t = Table(arr, names=('a', 'b', 'c'), meta={'keywords': {'key1': 'val1'}}) >>> t['a'].format = "%6.3f" # print as a float with 3 digits after decimal point >>> t['a'].unit = 'm sec^-1' >>> t['a'].description = 'unladen swallow velocity' >>> print t a b c ------ --- --- 0.000 1 2 3.000 4 5 6.000 7 8 9.000 10 11 12.000 13 14 Accessing properties """""""""""""""""""" The code below shows accessing the table columns as a |TableColumns| object, getting the column names, table meta-data, and number of table rows. The table meta-data is simply an ordered dictionary (OrderedDict_) by default. :: >>> t.columns >>> t.colnames ['a', 'b', 'c'] >>> t.meta # Dict of meta-data {'keywords': {'key1': 'val1'}} >>> len(t) 5 Accessing data """""""""""""" As expected one can access a table column by name and get an element from that column with a numerical index:: >>> t['a'] # Column 'a' array([ 0, 3, 6, 9, 12]) >>> t['a'][1] # Row 1 of column 'a' 3 When a table column is printed, either with ``print`` or via the ``str()`` built-in function, it is formatted according to the ``format`` attribute (see :ref:`table_format_string`):: >>> print(t['a']) a ------ 0.000 3.000 6.000 9.000 12.000 Likewise a table row and a column from that row can be selected:: >>> t[1] # Row object corresponding to row 1 >>> t[1]['a'] # Column 'a' of row 1 3 A |Row| object has the same columns and meta-data as its parent table:: >>> t[1].columns >>> t[1].colnames ['a', 'b', 'c'] Slicing a table returns a new table object which references to the original data within the slice region (See :ref:`copy_versus_reference`). The table meta-data and column definitions are copied. :: >>> t[2:5] # Table object with rows 2:5 (reference)
array([(6, 7, 8), (9, 10, 11), (12, 13, 14)], dtype=[('a', '>> print t[[1, 3, 4]] # Table object with rows 1, 3, 4 (copy) a b c ------ --- --- 3.000 4 5 9.000 10 11 12.000 13 14 >>> print t[np.array([1, 3, 4])] # Table object with rows 1, 3, 4 (copy) a b c ------ --- --- 3.000 4 5 9.000 10 11 12.000 13 14 >>> print t['a', 'c'] # or t[['a', 'c']] or t[('a', 'c')] ... # Table with cols 'a', 'c' (copy) a c ------ --- 0.000 2 3.000 5 6.000 8 9.000 11 12.000 14 Finally, one can access the underlying table data as a native `numpy` structured array by creating a copy or reference with ``np.array``:: >>> data = np.array(t) # copy of data in t as a structured array >>> data = np.array(t, copy=False) # reference to data in t Formatted printing """""""""""""""""" The values in a table or column can be printed or retrieved as a formatted table using one of several methods: - `print` statement (Python 2) or `print()` function (Python 3). - Table :func:`~astropy.table.table.Table.more` or Column :func:`~astropy.table.table.Column.more` methods to interactively scroll through table values. - Table :func:`~astropy.table.table.Table.pprint` or Column :func:`~astropy.table.table.Column.pprint` methods to print a formatted version of the table to the screen. - Table :func:`~astropy.table.table.Table.pformat` or Column :func:`~astropy.table.table.Column.pformat` methods to return the formatted table or column as a list of fixed-width strings. This could be used as a quick way to save a table. These methods use :ref:`table_format_string` if available and strive to make the output readable. By default, table and column printing will not print the table larger than the available interactive screen size. If the screen size cannot be determined (in a non-interactive environment or on Windows) then a default size of 25 rows by 80 columns is used. If a table is too large then rows and/or columns are cut from the middle so it fits. For example:: >>> arr = np.arange(3000).reshape(100, 30) # 100 rows x 30 columns array >>> t = Table(arr) >>> print t col0 col1 col2 col3 col4 col5 col6 ... col24 col25 col26 col27 col28 col29 ---- ---- ---- ---- ---- ---- ---- ... ----- ----- ----- ----- ----- ----- 0 1 2 3 4 5 6 ... 24 25 26 27 28 29 30 31 32 33 34 35 36 ... 54 55 56 57 58 59 60 61 62 63 64 65 66 ... 84 85 86 87 88 89 90 91 92 93 94 95 96 ... 114 115 116 117 118 119 120 121 122 123 124 125 126 ... 144 145 146 147 148 149 150 151 152 153 154 155 156 ... 174 175 176 177 178 179 180 181 182 183 184 185 186 ... 204 205 206 207 208 209 210 211 212 213 214 215 216 ... 234 235 236 237 238 239 240 241 242 243 244 245 246 ... 264 265 266 267 268 269 ... ... ... ... ... ... ... ... ... ... ... ... ... ... 2760 2761 2762 2763 2764 2765 2766 ... 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 ... 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 ... 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 ... 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 ... 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 ... 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 ... 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 ... 2994 2995 2996 2997 2998 2999 more() method ''''''''''''' In order to browse all rows of a table or column use the Table :func:`~astropy.table.table.Table.more` or Column :func:`~astropy.table.table.Column.more` methods. These let you interactively scroll through the rows much like the linux ``more`` command. Once part of the table or column is displayed the supported navigation keys are: | **f, space** : forward one page | **b** : back one page | **r** : refresh same page | **n** : next row | **p** : previous row | **<** : go to beginning | **>** : go to end | **q** : quit browsing | **h** : print this help pprint() method ''''''''''''''' In order to fully control the print output use the Table :func:`~astropy.table.table.Table.pprint` or Column :func:`~astropy.table.table.Column.pprint` methods. These have keyword arguments ``max_lines``, ``max_width``, ``show_name``, ``show_unit`` with meaning as shown below:: >>> arr = np.arange(3000, dtype=float).reshape(100, 30) >>> t = Table(arr) >>> t['col0'].format = '%e' >>> t['col1'].format = '%.6f' >>> t['col0'].unit = 'km**2' >>> t['col29'].unit = 'kg sec m**-2' >>> t.pprint(max_lines=8, max_width=40) col0 col1 ... col29 ------------ ----------- ... ------ 0.000000e+00 1.000000 ... 29.0 3.000000e+01 31.000000 ... 59.0 6.000000e+01 61.000000 ... 89.0 ... ... ... ... 2.940000e+03 2941.000000 ... 2969.0 2.970000e+03 2971.000000 ... 2999.0 >>> t.pprint(max_lines=8, max_width=40, show_unit=True) col0 ... col29 km2 ... kg sec m**-2 ------------ ... ------------ 0.000000e+00 ... 29.0 3.000000e+01 ... 59.0 ... ... ... 2.940000e+03 ... 2969.0 2.970000e+03 ... 2999.0 >>> t.pprint(max_lines=8, max_width=40, show_name=False) 0.000000e+00 1.000000 ... 29.0 3.000000e+01 31.000000 ... 59.0 6.000000e+01 61.000000 ... 89.0 9.000000e+01 91.000000 ... 119.0 ... ... ... ... 2.910000e+03 2911.000000 ... 2939.0 2.940000e+03 2941.000000 ... 2969.0 2.970000e+03 2971.000000 ... 2999.0 In order to force printing all values regardless of the output length or width set ``max_lines`` or ``max_width`` to ``-1``, respectively. For the wide table in this example one sees 6 lines of wrapped output like the following:: >>> t.pprint(max_lines=6, max_width=-1) # doctest: +SKIP col0 col1 col2 col3 col4 col5 col6 col7 col8 col 9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 ------------ ----------- ------ ------ ------ ------ ------ ------ ------ ---- -- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ----- - ------ ------ ------ ------ ------ ------ ------ ------ ------ 0.000000e+00 1.000000 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9 .0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20. 0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 3.000000e+01 31.000000 32.0 33.0 34.0 35.0 36.0 37.0 38.0 39 .0 40.0 41.0 42.0 43.0 44.0 45.0 46.0 47.0 48.0 49.0 50. 0 51.0 52.0 53.0 54.0 55.0 56.0 57.0 58.0 59.0 ... ... ... ... ... ... ... ... ... . .. ... ... ... ... ... ... ... ... ... ... .. . ... ... ... ... ... ... ... ... ... 2.970000e+03 2971.000000 2972.0 2973.0 2974.0 2975.0 2976.0 2977.0 2978.0 2979 .0 2980.0 2981.0 2982.0 2983.0 2984.0 2985.0 2986.0 2987.0 2988.0 2989.0 2990. 0 2991.0 2992.0 2993.0 2994.0 2995.0 2996.0 2997.0 2998.0 2999.0 For columns the syntax and behavior of :func:`~astropy.table.table.Column.pprint` is the same except that there is no ``max_width`` keyword argument:: >>> t['col3'].pprint(max_lines=8) col3 ------ 3.0 33.0 63.0 ... 2943.0 2973.0 pformat() method '''''''''''''''' In order to get the formatted output for manipulation or writing to a file use the Table :func:`~astropy.table.table.Table.pformat` or Column :func:`~astropy.table.table.Column.pformat` methods. These behave just as for :func:`~astropy.table.table.Table.pprint` but return a list corresponding to each formatted line in the :func:`~astropy.table.table.Table.pprint` output. >>> lines = t['col3'].pformat(max_lines=8) >>> lines [' col3 ', '------', ' 3.0', ' 33.0', ' 63.0', ' ...', '2943.0', '2973.0'] Multidimensional columns '''''''''''''''''''''''' If a column has more than one dimension then each element of the column is itself an array. In the example below there are 3 rows, each of which is a ``2 x 2`` array. The formatted output for such a column shows only the first and last value of each row element and indicates the array dimensions in the column name header:: >>> from astropy.table import Table, Column >>> import numpy as np >>> t = Table() >>> arr = [ np.array([[ 1, 2], ... [10, 20]]), ... np.array([[ 3, 4], ... [30, 40]]), ... np.array([[ 5, 6], ... [50, 60]]) ] >>> t['a'] = arr >>> t['a'].shape (3, 2, 2) >>> t.pprint() a [2,2] ------- 1 .. 20 3 .. 40 5 .. 60 In order to see all the data values for a multidimensional column use the column representation. This uses the standard `numpy` mechanism for printing any array:: >>> t['a'] array([[[ 1, 2], [10, 20]], [[ 3, 4], [30, 40]], [[ 5, 6], [50, 60]]]) astropy-0.3/docs/table/io.rst0000644000175000017500000000404312243255342014360 0ustar oleole.. doctest_skip .. _read_write_tables: Reading and writing Table objects =================================== Astropy provides a unified interface for reading and writing data in different formats. For many common cases this will simplify the process of file I/O and reduce the need to master the separate details of all the I/O packages within Astropy. For details and examples of using this interface see the :ref:`table_io` section. Getting started ---------------- The :class:`~astropy.table.table.Table` class includes two methods, :meth:`~astropy.table.table.Table.read` and :meth:`~astropy.table.table.Table.write`, that make it possible to read from and write to files. A number of formats are automatically supported (see :ref:`built_in_readers_writers`) and new file formats and extensions can be registered with the :class:`~astropy.table.table.Table` class (see :ref:`io_registry`). To use this interface, first import the :class:`~astropy.table.table.Table` class, then simply call the :class:`~astropy.table.table.Table` :meth:`~astropy.table.table.Table.read` method with the name of the file and the file format, for instance ``'ascii.daophot'``:: >>> from astropy.table import Table >>> t = Table.read('photometry.dat', format='ascii.daophot') For certain file formats, the format can be automatically detected, for example from the filename extension:: >>> t = Table.read('table.tex') Similarly, for writing, the format can be explicitly specified:: >>> t.write(filename, format='latex') As for the :meth:`~astropy.table.table.Table.read` method, the format may be automatically identified in some cases. Any additional arguments specified will depend on the format. For examples of this see the section :ref:`built_in_readers_writers`. This section also provides the full list of choices for the ``format`` argument. Supported formats ------------------ The :ref:`table_io` has built-in support for the following data file formats: * :ref:`table_io_ascii` * :ref:`table_io_hdf5` * :ref:`table_io_fits` * :ref:`table_io_votable` astropy-0.3/docs/known_issues.rst0000644000175000017500000001156012243255342015413 0ustar oleole============ Known Issues ============ While most bugs and issues are managed using the `astropy issue tracker `_, this document lists issues that are too difficult to fix, may require some intervention from the user to workaround, or are due to bugs in other projects or packages. Some docstrings can not be displayed in IPython < 0.13.2 -------------------------------------------------------- Displaying long docstrings that contain Unicode characters may fail on some platforms in the IPython console (prior to IPython version 0.13.2):: In [1]: import astropy.units as u In [2]: u.Angstrom? ERROR: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 184: ordinal not in range(128) [IPython.core.page] This can be worked around by changing the default encoding to `utf-8` by adding the following to your `sitecustomize.py` file:: import sys sys.setdefaultencoding('utf-8') Note that in general, `this is not recommended `_, because it can hide other Unicode encoding bugs in your application. However, in general if your application does not deal with text processing and you just want docstrings to work, this may be acceptable. The IPython issue: https://github.com/ipython/ipython/pull/2738 Floating point precision issues on Python 2.6 on Microsoft Windows ------------------------------------------------------------------ When converting floating point numbers to strings on Python 2.6 on a Microsoft Windows platform, some of the requested precision may be lost. The easiest workaround is to install Python 2.7. The Python issue: http://bugs.python.org/issue7117 Failing logging tests when running the tests in IPython ------------------------------------------------------- When running the Astropy tests using ``astropy.test()`` in an IPython interpreter some of the tests in the ``astropy/tests/test_logger.py`` fail. This is due to mutually incompatible behaviors in IPython and py.test, and is not due to a problem with the test itself or the feature being tested. See: https://github.com/astropy/astropy/issues/717 mmap support for ``astropy.io.fits`` on GNU Hurd ------------------------------------------------ On Hurd and possibly other platforms ``flush()`` on memory-mapped files is not implemented, so writing changes to a mmap'd FITS file may not be reliable and is thus disabled. Attempting to open a FITS file in writeable mode with mmap will result in a warning (and mmap will be disabled on the file automatically). See: https://github.com/astropy/astropy/issues/968 Crash on upgrading from Astropy 0.2 to a newer version ------------------------------------------------------ It is possible for installation of a new version of Astropy, or upgrading of an existing installation to crash due to not having permissions on the ``~/.astropy/`` directory (in your home directory) or some file or subdirectory in that directory. In particular this can occur if you installed Astropy as the root user (such as with ``sudo``) at any point. This can manifest in several ways, but the most common is a traceback ending with ``ImportError: cannot import name config``. To resolve this issue either run ``sudo chown -R ~/.astropy`` or, if you don't need anything in it you can blow it away with ``sudo rm -rf ~/.astropy``. See for example: https://github.com/astropy/astropy/issues/987 Color printing on Windows ------------------------- Colored printing of log messages and other colored text does work in Windows but only when running in the IPython console. Colors are not currently supported in the basic Python command-line interpreter on Windows. Table sorting can silently fail on MacOS X or Windows with Python 3 and Numpy < 1.6.2 ------------------------------------------------------------------------------------- In Python 3, prior to Numpy 1.6.2, there was a bug (in Numpy) that caused sorting of structured arrays to silently fail under certain circumstances (for example if the Table contains string columns) on MacOS X, Windows, and possibly other platforms other than Linux. Since ``Table.sort`` relies on Numpy to internally sort the data, it is also affected by this bug. If you are using Python 3, and need the sorting functionality for tables, we recommend updating to a more recent version of Numpy. Anaconda users should upgrade with ``conda``, not ``pip`` --------------------------------------------------------- Upgrading Astropy in the anaconda python distribution using ``pip`` can result in a corrupted install with a mix of files from the old version and the new version. Anaconda users should update with ``conda update astropy``. There may be a brief delay between the release of Astropy on PyPI and its release via the `conda` package manager; users can check the availability of new versions with ``conda search astropy``. astropy-0.3/docs/credits.rst0000644000175000017500000000353612243255342014325 0ustar oleole******************* Authors and Credits ******************* Astropy Project Coordinators ============================ * Perry Greenfield * Thomas Robitaille * Erik Tollerud Core Package Contributors ========================= * Tom Aldcroft * Kyle Barbary * Geert Barentsen * Paul Barrett * Andreas Baumbach * Chris Beaumont * Daniel Bell * Larry Bradley * Gustavo Bragança * Erik M. Bray * Eli Bressert * Alex Conley * Jean Connelly * Simon Conseil * Matt Craig * Steven Crawford * Neil Crighton * Matt Davis * Christoph Deil * Nadia Dencheva * Axel Donath * Michael Droettboom * Zach Edwards * Thomas Erben * Henry Ferguson * Ryan Fox * Adam Ginsburg * Perry Greenfield * Frédéric Grollier * Hans Moritz Günther * Alex Hagen * Emma Hogan * Chris Hanley * JC Hsu * Marten van Kerkwijk * Wolfgang Kerzendorf * Kacper Kowalik * Roban Kramer * Pey Lian Lim * Stuart Mumford * Demitri Muna * Prasanth Nair * Miruna Oprescu * Madhura Parikh * Sergio Pascual * Adrian Price-Whelan * Thomas Robitaille * Alex Rudy * Joseph Ryan * David Shiga * David Shupe * Leo Singer * James Taylor * Jeff Taylor * Víctor Terrón * Erik Tollerud * James Turner * Miguel de Val-Borro * Benjamin Alan Weaver * Julien Woillez * Victor Zabalza Other Credits ============= * Andrew Pontzen and the `pynbody `_ team (For code that grew into :mod:`astropy.units`) * Everyone on `astropy-dev `_ and the `astropy mailing list `_ for contributing to many discussions and decisions! (If you have contributed to the Astropy project and your name is missing, please send an email to the coordinators, or `open a pull request for this page `_ in the `astropy repository `_) astropy-0.3/docs/index.rst0000644000175000017500000000661612243255342014001 0ustar oleole.. Astropy documentation master file, created by sphinx-quickstart on Tue Jul 26 02:59:34 2011. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. :tocdepth: 2 .. the "raw" directive below is used to hide the title in favor of just the logo being visible .. raw:: html ################################## Astropy Core Package Documentation ################################## .. image:: astropy_banner_96.png :width: 485px :height: 96px :target: http://www.astropy.org/ Welcome to the `astropy` documentation! `astropy` is a community-driven package intended to contain much of the core functionality and some common tools needed for performing astronomy and astrophysics with Python. .. _user-docs: ****************** User Documentation ****************** :doc:`whatsnew/0.3` ------------------- **Astropy at a glance** .. toctree:: :maxdepth: 1 overview install getting_started **Core data structures and transformations** .. toctree:: :maxdepth: 1 constants/index units/index nddata/index table/index time/index coordinates/index wcs/index modeling/index **Connecting up: Files and I/O** .. toctree:: :maxdepth: 1 io/unified io/fits/index io/ascii/index io/votable/index io/misc **Astronomy computations and utilities** .. toctree:: :maxdepth: 1 convolution/index cosmology/index stats/index vo/index **Nuts and bolts of Astropy** .. toctree:: :maxdepth: 1 config/index io/registry logging warnings utils/index **Astropy project details** .. toctree:: :maxdepth: 1 stability whatsnew/index known_issues credits license *********************** Getting help *********************** If you want to get help or discuss issues with other Astropy users, you can sign up for the `astropy mailing list `_. Alternatively, the `astropy-dev mailing list`_ is where you should go to discuss more technical aspects of Astropy with the developers. *********************** Reporting issues *********************** If you have come across something that you believe is a bug, please open a ticket in the Astropy `issue tracker `_, and we will look into it promptly. Please try to include an example that demonstrates the issue and will allow the developers to reproduce and fix the problem. If you are seeing a crash then frequently it will help to include the full Python stack trace as well as information about your operating system (e.g. MacOSX version or Linux version). .. _developer-docs: *********************** Developer Documentation *********************** The developer documentation contains instructions for how to contribute to Astropy or affiliated packages, as well as coding, documentation, and testing guidelines. For the guiding vision of this process and the project as a whole, see :doc:`development/vision`. .. toctree:: :maxdepth: 1 development/workflow/index development/codeguide development/docguide development/testguide development/scripts development/building development/ccython development/releasing changelog ****************** Indices and Tables ****************** * :ref:`genindex` * :ref:`modindex` * :ref:`search` astropy-0.3/docs/astropy_banner_96.png0000644000175000017500000006432412243255342016212 0ustar oleole‰PNG  IHDRå`#:j½gAMA± üasRGB®ÎébKGDÿÿÿ ½§“ pHYs × ×B(›x vpAg `rüg»IDATxÚíwœ$EÙÇ¿Õ3»{·w{9çãà@‘³dQ‰ fE@A@AYD%‰¯‚=X $A2‚ä;sÞ0ÓõþñÔ3]ÓÓ3;»·Ô~î3׳=Õ•»~õÄ2ü‡’½¹Ý$ÆO^1á×7ukRJ)¥”RJ©¸6[²7êWc‹Á`Ü_‹¥<½]š/Æy4ðC—z %SÈ B,ÖÀ|cS·8¥”RJ)¥ÿEÚ,AÙþš2ã l±„ä€!ÀB 0´’!OK7 ÐBÀZ²äèKž5_k@@Æ•2Ë䍿ôMÝ#)¥”RJ)ý/ÐfÊöWîK´ƒÈåf[€î ÖÐl ŒÆ0 zu@ ò@+°X ÌÇò0˜¼ƒa¦K')×7yf£Ì›º—Rhllìð3MMM›ºÚ)¥”RJíRvSWÀÞà¾äPH„ã€ÒÐ@wö>J–ݰìŒDuŶC›‹Èøð,oÏO’å, €f`8r„¬½Až2gnê^KÉ#Uc$Q¸©+—RJ)¥ÔÚdœ²ý¥ÿ`ÈR‡%,½ý£0 Œ"2ØŠôÁò1T\œëÁt»TŸ×g"n\ó] ü¸ƒ€g°´’B2ј9kSõÞÿ6•ã”Sn8¥”RúO§Êö:âÐ*`\%'ûu Ç cåhC×@A¼Ü~; Â…‡ˆ@Û«Š÷=ôÊ ¼û·`¹Ë ,Æqåaa[˜³7v/þo“Ê5ÀÕÀDñ óÀµÀASSSÊ5§”RJ›=m4ñµý…û-ÂyŠYV-m|8 8Èb±ˆžW̰dÁ͸g«ÜLd!Ÿƒ†ƒ¡aÌ¿ÝeÆóȸò ÷[Wg×`ø-°Š€ÐA4`¯sÎÆêÉ”ˆ$%=/½ðÍ£9sÊ›íDJ)¥”R% Ö?‹öÉ^Cuh'ƒ!äXò¼‚å/X%$CHÎñÅ!YBLìCU†Šy×¾çÃ×ËR!¬+M«+׬»†XrXF`ù–7Ϻ­EHàDÛØŸoê¡üŸ¤~G"¸œ»æÝï¹M]Á”RJ)¥ŽÐe{µ|<àéÃÈóO,÷bÙî»”½[°WÉ'¥ GNt­œïÄíM¥(YwÍt*ó”RJ)¥ML ”í•Dà ªòÀVÔðWB%dOÆ¡ÀL «çŠ‹¸ÞþÀP »”ºtŽ?àhèY ¨÷±÷¬œó XÞÄr †¼Ó‹5=³Wnêaý¯'”!µ²N)¥”þK¨ËAÙ^!Ÿ‚m´rdžø6–a9KÞ\€%ÂŽqÄqP^»V΃•³D|ýá]@ì">ж§K€íÖÈëæÀºMƒˆ×-°Üå{®-QÝC°—oê¡ýï$gaeÛ¹ÜRJ)¥”6/êRC/{9Ï"1¸”;ÞËo€}užÈxË·Å^ÊÀf×ÀÉo@ϰv1´­\³üÞ0¬jÛ ,äZ ;ì*°K*-ï~]³DzÌK-0œN mÔ8Oiƒ_kÿvW5òJ)¥”Rú¦.[Èì¥øð8¯áÃW0üèŽ%ç€Z}ƒ“Ëï ¤™¬p¾µ­pÂë0`K05©c]i^ú#)ÈKxø¤Ëß[ ÊŸA$å@¹¤/êI{Ï&ôT1>ìçvǽ£}\-U°fbb:?\®MøÍT”×úÔ¥½<ººÝ)¥ÔU´ÞÀh‚¿\fœ“ÐÀ]öp!AÚ玻”²`sÞ2P -­Ð£óŒßV-„n½ ¦›<’o…¹ïÛMðÖå°b5tÏ@·`›!\D³³Hj°ÜF _¡CàóÅoEl->Äòx+`œëó¡@½4˜` ãûm÷iõòê`$,úÆË«ØØÆÕi«c° ˜LÞæ{ù”p²Un2^v¢<(x È455µË)w²âä÷íX`?×'}]ÿÏþ…„u]Y®­ cïƒZ/$ÈÎG\}Ü8h¿‡øg/ìLw–bVobÅgJ6Õ‚]9àÜ œqJŠÖ íð5à Ȼ"F8q±b×r¯bÔ3F+BÐò½`ÁpúS°ÍæE¤­¢mŒˆºW̃÷þ¯ÿfü²Y¨貚—Tƒ8Ç|)†‹ÉЇuÚÐË^‚/t@9Yøû /ˆ.†×Çæ(‰a{@˰ï90v7¹gcX Ö­}½†Â^'Â.0ý xý>xçZh  ÁHÚˆü ‡ŠI/´ð‚1í ìCÄk¤¹,¿»ÿ-à2d³&ô…æ3¹Š>Ö7ìPÀ÷òêZ‘S¦úÈFi2p9Ðjdj™à˜õ¹kà?Ö¸$çc®/F¤7•6mÈâçÈÂkc.>ý­ø0‰îvƒë§žë iY#©‹J¢NþAÂæ6¥”Ö‡:å^ ä!ìVjÈ[ËÑÖò°µô±–¼µd­ÅZ‹q6ú'ô>ôÀ®;|Gl]OCÇ%{k{à1Ba5õ0~_8þjì7§`þ9ä,Ð ¬‰û4«?³Á‚±ü†ò&+÷ÂvtËMMMþ© òXà&dáû.²8hÔ*¼²Þ5û"€è‰èúK ت4pÒEh ð,p6xúÖéåê¢Ïk¶@¸÷W‘\¹BŸšÝ5ç}*鈵ù2ÐZ©L¹X^>Ðö‰•{3Xµ.nÔ2Þ§Îåñž÷\¹MO/„“äЫƒŸw{}¼¥Ëç ÷= zSý¸û4èïòäî©”`Xÿ|ŠbIFñˆƒX8xÙÔ÷#RA”ãá¶ÿÌÅÀ— ^oŒqã Èm]Ymˆê¤0~)¥ÔUÔaP¿„¢‚5ËÉ žq‚ ¹×„Ô™¼ ɘkBŒ a“}¬÷É-ÀÔƒyö»˜e³±AqÆàÄ×îOå AÀÙÌ q0nl+X[µ¦ôCŒ ±6$°!92†üо`óX£¶ ÔØØè/}.ôM„CÖÓ¤uAÊq->(ùà¦Ï€,*_®«fxuRmbÕ¼³Ë˯OÑt!_b¢€¢à‘C¸Î'³8W¥õ‹ƒñêå×QÿΔù^žíÉ0‚X^~?ªŸtðkàkX UÄù3‘³¼µâå…à=‡©’4îñ1÷ËÓ>VÉÀgÅzøŽ³_ç¾ÞØüx 0­Ïkˆ¨þãˆþgw=ø 2¿µoZÎûYü /hƒ«[½1¨4t¼º‚´­Çx÷@ô÷*!I)¥.£rx!#A­²µ|ÂZ~o-Çg8™hu-çÛáO 63»pö¹»\‹ÜZ`ãëP¶Æ@`?xþ°/d±ÊÃrQÀ¬‹þ•Ãr¤]Ä)à$ !„ßk·›u19¸ˆŒu‘õAXÛ8è¡ß0ÐsÈA'-øí-ΚßMÀ֔ГµnþæÁÿXŠ9jƒ—ÈÑ™Þ@””…¥)®SR=“BË„^>!¿^ª×=9LEU6¾¥xIDvDd¿ZóŠY™‡ˆNúI`{×/~èP_m‘$ÈÅÒà=ŸC8܇‘ùÕY`ö×:dsò,¾uîþ“ˆØ}ä´®¿™‰¼c&2ÉLä-dS÷C`à8`‘âGàëëµ%ÌÚ—/!›‡Ÿóç@GݲÆÚ"¤}¼û÷ûe¤”RWRÕ ~ÂRf2òaÈÞ„ÜMH—hËŠ«;¢6¬Å†uذ›\mF8Ô΂zn¶÷ì3çÃŒ7Á¬µW\‰&½Š]¶f6ßZ©î>ÇŒ ¹K ¯öð»ÉE8ѵŠeÿD¤¯ŒWPX-÷Y? J¾Þ[¯:ö?zÓ¾ÈOïãNÈ·ÀËÛW™Idù=“H«ºGë}¯EDê×PjðåsµZ÷$.™Ø=ÿÌlÿãsšQáè³=Žîr//0­wÏêWÊÖ6Bý‘Dzobý¬yûcWWä½ô¾Z!ç]ך§“j,G_F€qW÷÷,àXD§ü„»—{tô!š»!pb úˆ«[30Ñ—vþÄÂW“·»«êßÇ‘¬é(i¿ŽˆÅAæò ^y)¥Ô¥TýË  y²­ ù³ émCò6$è´ÈÚ }0f&‹ ¶ÄØ!˜<˜| &׌ɷal? £0Á8ŒŽa ÆÖv ¬¶J;ÿäÖ‰YQ;N>Xü˘Ý΀åÓ1ÁÀbѸÿ‰ÄæÆXrƲ yÎr|L¦’ÀËãTT?Ö©\.Æ3{+àkßã€ó§‰@/ ˜—ßVÀg½rË‘.ò§iïĮڪø?Dº=²¸N@t{?¦{eµ"`ñ*¢ŸN¢5.ÿeî³á4ýrã3DĸXûh>ÖåÝQÒ6E€£žÜ0•c^ÌñÊYØËÑ §ØF©Õ¸²Î¢gMÕ—€/ óàADoë»$ùc¤soDôۓ΃K8Qg€XÓï„l*tuƒ¡™X$5ðûj9ðidÞvC8æÏ"bc­w9nù/ˆ•}àÆâ8w?Hx¦]òÒkþŸö~~€Hz‘Z^§ÔåT(‡ç£ËºÁ’§–?aâ€'c"C'ªþ˜¾Œ;»n9vù|ìüiØ…S`Ý\0­2õk‡B¦´.®œ?»dvÕ"l¾cÀ .Í?Ip™[Šé1ûúÍØ?í ¯m©Ñ€µcD_Û>}¦a¶e%ØÚò‚Ñè ÀÝ;›áXò…ßÈ3òR|1˜Qñ®rAG\¢¶CÀøràž¦¦¦‡®ãjd±<˜G$õÔ_¬?+·Ü<p4IsGó¿‰! ¨´1Žù)Ò§#\U-X_B€Öç(Õ êJ`8À¾S¡Îúü©ˆžq×Wþg‚ËóªXYÕÖq‘þT7RÚ×÷ zÔmˆ|Šw¾Šˆ[µÏ ¯@ñ¥þ˜) ¿Ž¸Ãèúûÿnñr7/vBDÔqK÷,2ŸvA€\ëÐQݲ֯±{ø¯ýÛ–Áô,räüÂ2Y‹©ŽýæÙ{á“ò.[·¾ZœRÜD†`F9éÁìwöùŸazªPF‘˜à X®ÃЊ…ð®)}È‹¡¬œç³Èõ¢gÖ¼´Ã„g•jÿ9àÙ bc_÷Y‹ˆ–§AVæ¾ê·_Gô…ÅÓ¤¸UxYžâÝ+ä2ÁJt±¬ÆÇ¾ ‹nll,7G Ôݸe¸ö볈¨s‰×ÏaÌz]Õ ¾Vá’·#Úðøï•º0MF¤kH(¿N1@Û±HŽëŽuÃØ ³s´-ô]¾ÈЪ­ùÄ*;rb 0ƒˆÕÏ"2¤;e›ðœoðõ4"!ÂõÓß«m„RB]Žô~þ³»VK=¥”:C¶ðÛèžZFZ>Šˆ•3ªngôS]¶j[1û]{#·Ádë„KU£+ek Á¶"+i/O#ÿ™>Caça°ãǰ‡|óâ½Øg/†|=¦×HÈÍÇ[+"j›‹é3ûè0á`̈mì—Ì„¾Ã “õ6òŸµ!Æd°û2浟E§OÙŠï§‚ÍvÈŽ"VµÓÖÇ9¨"nÄ_@c`¦"ÙÛóˆ|F‹†ÙåNÀ€•[”kÛ©o¿ø ­K,®´n|W¡pŒÕÁz›¿o*Q!mSSÓ†7êXdîô8Õº½@®-I~á:Ž_ñòÔk¼ÎßEDýEù'ÄìÖM’Îö%Ф·+ „ñ3W÷ŽrË%QÂ:ªgõÖG?Ѝ4>ŠYT¦~ ’·ò‘¨Ïëd›BäU«ëD__hkªONiCPYrx6‘«†:,7`©CÎA÷ŸHšü †a×Ö`ÏÁ|ô\Ìw?€“~г#dj±¡øJ©øØƒ L€ 0&{&(Ü7Æx²=‹ C¬ `øÖ˜c€9ÿ=Ìv'bçÍÂÚ!@¯„º9ïœVà‘›€ûÁ+pÑhxwA×L¤_CÌà-ోW‚RIo®ç+[Ç\ÐuWÐæ'¢ïRTÄ+ûGÊMg‰â_C©ŽQ»rLÂïqZRæ¾r…!^ÊÉZ©u‹-]p@Æ&¢¸[Õ™D!=‹³BlkíŸI…OIgË?}¦!úN7 ï":gHV'ä—¦O–)¿CÔY JxîwmE$4;iRåf½gtÎ>ˆ?‚¸~)—[U›bq¸qÏ+ãò,‘ê!Õ'§´Á¨üd Ñ`™šË…„ìHHñ¹@.Htƒ`$vÁ\Ìð½0¼ŒùìOaè–N",ïQdÓãVãžä¥58î!fø6ðµß`Ný3fÝ,ls-K¹m¦G=ö­k±·}nûÖ<»l&˜ :f½®{7böŶÎ[Gʼn%pð³!tSžYõ8‰©•<Vqp\Ïëû*Ïòîõ¦»ñÊŠ“>óalÞøâèYÀþŒ€³ï/[¨—/’VÀò?ÿa¤"ỌjÑ^h_9r¿iß,öl<0Dª‹L¥ü6=wÄŸMHsxìïMEZþ[ˆ¹‚¢nZL€+‡½”bƒ¯"ÆXaëæå(ïž/ºN¹ä”6%‚rx&2ÍW8}™eg,8ÀÍà[Z'éù!ØE³0G_gý³åîò¶…¡ šD+oùì¸fëÖ†ÞÇ9Aûi}—<…›%SƒÙëÓð‹ÅôŠE”`¡½SÓ€}áZló‡˜^#±óÞ¿Þ‚µy1úÒ#ÖJþÖbú ƒþL–3°=nÙ2”=\?™à—å¦ °R—ˆØw1‹»œ\€„,;æH †rê ê×ÎË·æöBÜC|Ž·¥xsà×9ÎÙÿ'’úc_ÿ¡ÊÃ=€ö©TËPýh‘®>‰¼ßüq{RÿoˆæÃ^D!@7 9 ó¬Ìôê·¦óÁÕGßàK77E|±ýv¶Gšn÷±(×NM ¼RÚ ” ì|ˆhiókÁfÚã–C×O‡+XWÃ)'ˆ¤•ëôõÊ㟠1“˜ÀO"z¶Ëל¤1×FÕQyá Qâµ^'ø¯ «\Ë—KÕ‡Cþ^µImüO!]œ_@µ(^8þÑÓoéþN Ÿ íjFì^Eòê Fo&<ï—7 ºlâñÐ:ûî Îʳ¬•nßžòò9Ékk5ܲöG#Qà–§Ù»ë¥”Ò¡’E8< y4ÐE–Ïa9ÄrP['O¦vM+¦{Ìo`v<:S­ y½pÆéŽiY]µ ;:vÚØ^ÁÎx»t!vÍ2°¹‚Ø[º8S[ȈyL¿áðõë1£?…]>‚~¥ŠÜB[_·R ê±[±¹–HŒmÕìÌ陇Ãì~vùR`@yßhé/í³}±„ä+½Þ @åbJ— –¯“ñÚEˆnp,‘aOüðŠr¥é€H½[\õu…b‘¹ºéäÀ9ÙLBt›Ql½úŸ ÎÚëb}P-iú>DVíI±ÃA¬âõxËŽŠù5ÏJKBdÆÖg6UÂ4ï{?"ßåâN,|Õùû{ïçcwA7ƒ‰”`uí‹®ïÕ¢b奔R—S©¸Rd$ÐE-†ób)’'v¦võ*Lïmáœ{1C·@ÔÃb­ÕSš‚@,Æ–/€©ob§þ¦=÷0¬©\›üjBL¿0æì6ûÂ6{À ‘˜ ã@3”òlÄÄ™ #õè={Úo0??»ìyq¿ Ës —bzŽÆ¾x+æÐ/ÁvûD¢r×kCÉ{ǃàoW@ïºö[º`ŒÃ29€Þ„§bƒ›Š–9Â1Da: áBw¡ØuF¹P?Ô£–ÛÕ»û¯"¾×E7Òr´,u—ÓŰ?\â H`‘€»P+z¶ƒ.9›šŠ62¨w‘Õz9ÐXä•ÕYWœ9îš4tÞ Özlâ1Ð~ð {!r©Ê[Skß4!’…Ñ÷ÿ XÛë?UÁìFdX6 à©è:¥@E JøuýBÆiO&d‚Ç%'s‚Ôc›s˜î#á[w•ä YcÂô·±wþ.ž€½âãØ¿|;ùaLk€©ë‰é9Ó{8¦Ç@LMì²ÙØþû«S°…ß]ˆö–“,‹Û’”㌲¬€yÀHøâµ° ¬m”ׇkExõü€)¢B ÅnZ—µ/Â)C/BÆôÊ•YÁ*@"½‰ÝØÈ0È¥èÓ¨œ­óÙ¯yÕ;NÒ Á<ŽBŒTÄçviZ(=J0Dô|·!¢ÆÏ-v…ºýrÌ%mk=É ãÿ­!E;ÄÁÆÒ®ôÊ-q.tÔc=ÛÔÕäïšk©Î7=ãÚz¯wO ¾B¨(ÂÖ¾8Æûþwd6å’SÚÐTŒ4ª .¹–sŠ\{Ãhö†5«á›÷`F|DÐ?›À…«´8Qö¼±ÿw!ö°MW`[[0CFc ÃtëW@~>äæJŽp&¨Åôˆ<S7û·ë±NÀÞw ¬]^ˆ¾…ñ¬¦ý¨\[ïŽ9é&˜?‚áå´m)¦×@xþJ윩‘nYEãÈÁ¦ÿÌç`W¬3 ’ÁÎ×,Ûºk~#êþ2gêŽBÎÓ½‘è,e?<£/Ööï©ÐÌçH§ÉæÿÚ¹4áƒl<`ˆÏÕo‰X߃ˆq;ºW‘¦E¿td³KW5(ù}^M]6&ù\mRô²%|ÝAdðõq$Æ{âüЉ®kˆÜÃ@æfR¿¥”Ò¡(‡_A—ñŒã½Ž#d»Dã®"?äعó0_»³Õ®|&ð8Uõ~®ûÄØïŽÃ>~¦ïpÌ€>³Zg@Û,Ñé†y91´Þ'„°Uô¿m3 ¿Ó¯/¦ßXìß+NÂΙ,:à0f¡­nW‡vÍ, G]pL7ì2`Òkɽg éø]EãW.v¤W¶îû–ç\n\4xÁ³ˆVUû¹”KÎ!–¶7 Q×öBb.ïDä÷Ù)ñgÌ ÜFuú"Ä0GëÅÇ4ú‹š¿™hC‚n·<1úÚÍ}ÎB¢s½J#º«wúº!Ðp™—"?|9½Hmø•{ö m´‡•£oC€ý”žŒôßJÚFÑÆÇÇÿ»§>³œ²=çÅä›Ißôñî5“š/¢v ¾NÄÓ)+wœ0äh‰Bš¦”ÒF¡eæyÏg1ä@A"hQƒm^Žéߎø˜lÄ•Ú@^0.;ûô¯1£ÇB~´ÍM>eÉ €ÌhÈŒŒ}FIüljcõ±Ð<Ó³;„½±—†;µ˜52—rË»€Ùá`ìê™@Ïd Í/ÅÔ÷žóìÒ……Ó8À壯q¿þ˜á`›§íV9º—|úºk!»˜ÛH8ÓñD‡~@1 H8Â3NøGˆ˜Z#9ùu—Q‚ß´/6_…ø‰„{¸‰(,¤od×;kÜäƒÈXšßÿ·¼šÈ ©Üfd »®¡‘¯˜4t4»ÝL í†{ß+×'gYpOp߃2ÏÔŸòîÝï——ê“SÚMÎaøG~ÙSÞ½ÆÄÖƒaþ:8éNÌÀ‘N<]lÔUäE³àŠS°Sà ÍÓ Ì•ú:C$,ç²ÅØ3°³fag{Ÿ™3±óæBK+£$Äeh¢û a_pÊß@ÄçßF‚A$ñ«âS†3©Â…¥JÚÔ_%ÒqYNy}¿Žç–ˆÌ¦`Þ‰rv¨&@ôÖ_èM¼Ò·b ïÞ|"£ÇjH ¾þäÝûœ»Æ}–5Ïýù âBöÏX}RJiƒSž‚ Œ%$d0–F5DJ+Ó»|6f¯S`ïÃ"}­ãJ­µˆ«—Âõgcg>‡é;Zæ”±YÈ Ã.^ƒ3³Ç©˜¯ßˆùéÓ˜&c®såK˜óîÁy ô‡5»p>˜A õ€yfÀ8ìã·ÀóJ îX¦xÙÛnÑZåó‚~d$dÆôw¼½µÞAúô^¯’EwôéS,u( »ø9’σU.x9â5ˆ‹.XmÌ•e8g]<dKs-©\ê¥KÒmæë»{Áz¶£PÆfÊq+Nñê›d=–(6yUØáµHÿÇŸ÷Ë›lœÂMÁ);Ôú 'ò›Ðдw¤×6•ˆú’ Q Å7|~¬k¥&dlRÑuJ•ÄÅ@HÅ‹û 7¾Ïk1e`érøøç1µõŽ?&€Íý¿Æ¾òg̨1Ð<½Ô!#è¶vö̧ÎCO†-¶Ãdk) £i-|dì!¬ýfê;ðÜŸ±¿ru˜AÜØjh™<øsì®bú¼ðÕ.Ï¡£0;|ûÞý˜ž} ¿¼´‡,bb²b­w/ª—Ä5أݫ_S;º„{¤aãܤЭï@Â]—·!Òö@­ÌIEZwŸ‹nì&JÁGÛ—AÎнŸÊþ²ÕH6ÛÕ$¢ãûźLŸôˆÔC1ϹJ~ÄÞ¨äeg$¢[§©sêEDo«Ïl*ÒuhGœ³!²©(œ!^åÙÈjðõr^÷DoüŽbuJ1¦S«kKë:]§´Q)(üqnÊ%Ûd.¹vå,ÌnGÀ{Dbë~º•^{{û0#Æ Ç ¨Á¶õ‡%s0ܧ_…¿3dj\¬k뎶.r—ÁÔ÷Æì°/œvæšw1? ;k.¶¥²ƒ!¿ºÁ¾þ–¦Ùq›Q½t¦¼”RZo “#$Ñ÷$ä çœ$Î5}债C¿‚©ï…¸t†Tê‡lW-…?ü@„Em  ŲoÀ4φË_Âp X§‡Æ;=Ê?®QcZƒ;eÊÀ˜`Îø9æŠg0=bç-€ìÈ· ùÖóÉ-W0»¸3QSF¯Ü"P²l:´U0þìÞÛ9”´@BZ‹7'Å9!Ñ‹ ¼Eî ÿ¦‚ ¡*uÑ©&ðB"%,ô>מð#á0  ò¤w„ï5$P ìËY-ãõªo(´Y‰°][´žÿ^¡ü!r&ò‘D››’6%Œ{á¿àîù’ß~!ð×Xßm ò#×îÝ9嬪Þï¾Á×$÷ý@`kŠí4@bÇ+©Wz"TJ²Á]~®°ÐîŠè®âVÈÔb[ç`†ÛºÃWâ|\èD»ÿxûêó˜ñ£ ufiÉ5C°Ógc.}³í‘¡X!L&E'@á鬋†rÒÆ`vÚ{åã˜?\½ïjÌV[ Ÿ4åUhYu=ˆG`È–"v¶åÄÎîfËZ ­éu޳“ß3™Ê¦UÅ÷Z½KJ]Ž[Ñ´>']l0ÛNI9„‰tË4¹‰·ý+¢  !1!=ë9êÛ)V7Eýã.—‰»ãœ¥nD v‚S%`ÞDÇü6ÄGVÛ¢ÓÌoÛeˆ”d…÷\R›|)Æ•È&/‚Õ7üâ èÇ$ßh3¸Ê#µÆ‰®ow¿w†‹Ï Ûå?#V$Ÿ.w¿åð¡.ýZÄu RJi£R~Ÿ+Þ+fu7÷†%9Øý,Ì îÍŽNO²ÖqÉ+—Àƒ× ŸÒšÀ%g‡agÌÆ|õ˜}džžsì8ÆD*9®Q,ªé;Nû æ´k°|€é¹væ}ص«‹Ý™|ÊfäµÏ‡e¸ZÄ­ëH:‘ª¤Ne ÆðUKÄ×JÍD!ˉeðîù®O÷·–üD]G©jGH÷óˆô ˆ/´Îh𤳓¸µþŸðî'чI¿;ÐÔÈz¬àÎeüjÝ2Ñ Ëàî“—!%ßÈë_Ïcÿõ*¦ÛhÈ·ÄÀ©šç `v…{µ€ìS œ CÈÖaNüæœ[±“?tÜk0ÍWù¬Iag±m`ºõ)£OvuȇbÊT>xˆÿ™Q¤"p¹¹ëb¢#ë|°ñ9Ò£ÿdåÍæ¦&-Yïí€DÉú1Åq©«ÞýÇ †Tz­»×†¸m½œCyœŸ«'¾ö{åÛÀþDâo¿íÊÅÿÃ]“¬€5í*g" üo¡®¾aSS“Ö1€R¢(x#“ºï¨uºï(軌å±îsˆ@ÇÛÿ„x?‚¸—ù€ìsɪ“ÿ ð>¥‡jÉ×Í\ªçX‡ ¹«¡E¯A6ª5ÚSã¶IDK슈±µîþ&÷>¯=)¥´ÑÉå,!»z`a‹$­K0ƒ€±‰r(X!;.9ßÏ=€ÜÊRË ÆÎó™[0‡û7w}ÒøÖX¬YÌ‘_À|ã Š’©ð~åBgè¸PžÄ6Y¢Õƒ-(Ã^­^ê 3_θKÿevÑÆ‡w¢ ™$¹ éÂzqèx`§ÆÆÆmÅæDDT÷2~y/ß³ˆëf / å‘Ž~ޏ¬\ƒp§cë~;@‚_싈!¯¦˜ô¢Woµ´ Ë¥¶çñX»|RŽqwÄpç2à¨ÆÆÆC€Ï gO¿F$¶\_÷«“WžºèÜL$ ™ê•̽ü‹ˆxútäÀ’!Àó"ˆ{Pø€\ƒl¨~êõag¸äÏ „6Š>) Î ÷k\>…HvrÈVùIä¸Oí£éw½´Ú~ßàKõì݈æÀJä*ôGªONicSÖ¹B…H€?êOñ"Ô`×­ÀŒœ}¸T¾¿®Õù³àå[¡¡r«bËm«EõÛÅ51Þºa½{Õ‚µð„ !ÈÂñßÀ˜6èÖÃ5Ês¯RjË9 ¦I†*ÓM^Õþ[B¶®T„­u[¹X– Š’Lº`ÍÕÆΤ$¦/½á„}NÒÄ®!âÂñIdÁRý›oÁ«€¬‹¾¦³]ruÒò.C‚+¨‹Ž‚„rk#³NxâK­ÇìõB¶i¾H08úý:/ï|;îP÷çSšÓ߸èÜ|7Öº±Øá*ƒÆÆÆM⟣Óí‘÷Ñïkm·?ž{"¢×¤ NÒ1žªGÎ"[ѯ ³¿³nPmˆâqd“s8k=l®Ù·{ØQ‡h÷刚Dë½>ú]{?ŠpÌ[#§œõGæ­úp?…H_Ö·¼”Rê4ž˜z,–nž(;&ºî'¦ ;~F¬®­·²û@5k:v2˜ì È犹ΠvÉR̾_‚!ÿ}0v—dUkä3ÖB}¦ÎÙ%AÑü©ea.YÔl³¢‰0(jkÒ&aáL'o­ä •qÜòTåžÃã‹rÑ…ñÈŽ]ÅÆq@ö£{å\ºîDÇ9ªhRÿÎ £7ÏË£š.Ö´ÃS¼ò9n_¬®"Ôdƒ7‰Ê4Ð¥Uî¯È^Ž(¶÷}ˆî*ëµü×`6”r–>0kÙqQ/ˆtí³-ÂŽY§nŒŽuW ®íÑtª×vè˜û1ÆýÍ™>«s¥Íç+ÞØu†´³(ÿ8˜h.h›2$ëó5Ý—‘QÑ›÷EDúR«¯'ךAL:ïv÷uýü1¯Ô79è‚òRJ©Sx¡‡T6òªŽqÈhyRÏ-VÒï¼î´‹ë€½Aœ/¶ßSÓ­àþTˆK Ü£y…s—}Kéj(Î]wïýfcéÞ{Cà,ßZÖÐ  æåã9»èeÌ›ç ÆÊ€{¤X@Èûz/pÃy‹³rÇ =ž$ÊTÒÎoÞÓ/‹è ÷& 9XmK]Ðç Á+^¦ôüäBWP|vr‘c™÷»O (µ@|ÍË+‘8Ù –Ø*õ7šOàÊVC¨Œ×Ž]ºb¹’bj‚ rÂÑ!WWCñ&"¾ÊÆ>J7=¾}Â%N$fmÝ )AxŒè$¥]ñù㈅s/¼Íš™X´! ÉË#ˆÞ_Ç#D6 ÐÖà _wEøº‘HØ(<K›RJOÏ9ÒÓs–y©±TCCôt 8…ðÁ[ʹ–d€³ÀÈqªd°¿» f(yú'=UKp1Å«¬ËÇj}W,†7šD+Ú¶2™»mk!טR=zV-…9oº-å@9t×7Y…åXJjõ¢÷j!æøb‘d­Æ>º8ÿ ‰‘=(8Žbî ?g¨¥e¼ƒè…¿£é P!@û\|ÒGÓh[ ²ÿÑ.÷ҵʅMAñueú©¼»´¹?ÑQ}&¡ÌÐK›Ôo]½€+`½‡Dv»›âÍŽß×ñöÅïùýœE6Uû"@¸¾€¬ô>Âmþ„("Ø!×ù"É88ÉÍqÈÆëzÄ7ûI"Ýw êópDZRT¿.àZunN" ”2‚He÷Â2¨d%¥”6 ù]c¸:ï“—éÚHôtœš×ÊÁ ª[/ù¼öб%y¨»’]¾þz%\uvÅâØŒÐá÷E]­âœ÷;o`Ÿ{ S?òk¥Øeó1»ž„é?Ðeåe5Ÿ¥‹±ï¾Šé6BòI6òÒïÿ.ˆ²Ë/ç Ì‘8Ð`9Q¬.¾Ê)«…î7‰\A4Ʋꞕ³¾—ø'X`_‹œóü`6Å®8$Ô˱ÆÅ™3½æÈiRÕåi?=‚ˆMÕ¥¨R?ù}¥#°ŸÎ–ñµrpq®Tû­K¬tc ¨íZ†Ä8oDDõ~_—k_R?ÏDtÕEBuú!&××?[Ïz¾96ô~¯_‡#"â+ ½1<Ñãúˆ·#R‹'èz@.då®jðåݽ~šTtÒ¦"ÿÀ‰N9éT¨0/KQ¿a%™üW.…¹A]„ëbºÙ@¸Îžˆopi&BË—cW…Ø×&•ç{À¬*ªrÍ>ùe´6ÃwÀ ·:™Kêvv;êê£èeqš1E–=uËJæ”Õüù‚èú¡âlÊ,Ìÿ@bøÀý¦ à„ør :>~ÑÛ6!€ÿw}ÑaçÚ©ê3#V»Û#áïA6ôê’M¨_€è¶Fšì€͈TŠ2ýô"bi}>ØÄR¾Ÿ2ÈFå=à*‹-Ÿr}ú€ë/ý<€ˆnõ$¡õæ®Ú…kÛCˆA×'ñëìvæqcô0p²§ßqáa™2;CšW­ëÏcnüwˆÚ#‰‹×ë,¤÷D¤BÊ©v) 'ˆ°G,ϵïf‰àSÑuJ›”²Þ¬­˜2t–]™„h*jmŮӣ7„KJ-¯Ãñª¿o’/oa˜=¶Ã>ú;Ì²ÅØ‹oÀ å@Q ¹S¥!±Ï!‡¡DßzîoØ¿ü³Ý0h›ð‘¥¡Ø}¿ä|•k~ë ˜oKZš Ò‹Ú£á‘â>½Ÿñ 'H5¸ö­E€î=d>¬w?WA¾ÞZ9ϗݧ2W' bâZ$XÉLßBæ6DÜa¾n nU#|ý‹è8ˇñ¬ÐS.9¥MI&üdaá~ q¨7šø“‚=óÐL̰‘ÑÉP›<óìÉã1½ƒ] Ö[LÂZlÍZÌoç`“°•&–ÇÔIØC·Áì0 ‚Vì‚Řãá¿Âì~€XgëÙȺTr™òÙ†!&“ÁN~ Nž€8Ãb ¡2‹ÚÛ;o)æ“§ÁÅ×a25Åy¡zé%pæÁØ9obºu A¬DF6AB@”#û÷î[ ?.ÿ)œp*¦Ï€0›Å²²ú¿‹Çm2ì”wàâ¯aëÁ˜µ<$‰‚ž0m)u2ÆZe’ü²'¿‹}äMÌÞ# u6í®†¦½ã!bœ ;¸…¶ŒëNÁV¾L>°žâ¹NÎ_ð+ÕMÓ—àúY…úTªK‘¥C;ýÕi½õ¥2R ðŒçÚi_—õsÉ÷E7€IðUÖúmP0Ž‘n*v"ä÷‰N]KE×)mròÅוÑ6ˆà©µµ|šÚZLo°m+0™Œè¡ dEô=Ü)à™¾ýá#{cg¾€©ï -K1ÙVØoöÒïã÷ÀW/„}ÁôẺ&y‡N5 äÚ°Ï= ç‰í9ÓÐZW·Z—ÞšØ31_?&ìVÈOÒhþîý~î && ÑÕåi÷wXÍë_fíð±!㮪Û¬O§ë²i¯>›l£ÐÅ@u³¨§·!зÝ«ù ¢bÙ$‡q¤”Rœüà!Ë*½2+Kç—dRà ë{Á€½`Ý:°µ ¾ÎÄΞûabe¬µÐ«ìðQñ4õÎÆt5¬›‰Ùafùlì'b?¿?öw¿€·^Å®XâŽr¤pÄ£DæÈc—/Á>ý0ö»_Äžt$vÀpL6hY]¼W÷=ké!š®ÏŸ†ÉÖz'XE–âÆ€; ûÀ0cë¡uq¹¾Ó`,2 +nhÁ#¤”RJ—Tt´ûÛÓØJRJi½Éç”—¸kòÎÖ:@]¾Ø»‹nÕ³ Þ Þ|zÔ&xÑb4e2ìypiú}ßÃWÁV в0z~Ý\ÈvÇ|j¬˜…=ïXæÓ;ÁÖ`Ìxlÿ‘Ϟ SßéS°üv¬Åì< ÚEÜ~’—o1؇¦cþp#f›ÅZ;î'm칟|žë-³HÈ ¢ÝùoÝ]ÃÖˆ+¥”RÚ äqÉÊ  9°äœæ—Ý÷TtÒfAYl4–z÷Kµ½6pv´+£{ ‹«Q;f ±ùR[:ÍÛV‰Mì[/Bë¡¶…Ó¥|pŸ°æó‡b'ÿ Ó³'äWG¿å×ÁÚ™PÓ ³ûp0µØ…ïÂä7D4®[‹aHpdžzÌácäpŒæ$+k¯Å݇aߎ9ÿTøÌÉÅ¿+—¬ióçÀoÏ’ˆ½- K>„ÔEè5Zù›óͼ…SJ)¥EúfžáÝ»Ã]3Hı”RÚäxâÛÞ÷?å6鹨J¸G÷}üîrÜBPŸk9fP?ì_7["<Ä µlbúÀ×.ç¡Ú!‘hÙ¯O®ÖÍuÓ0µYÌÐ~˜]‡b>1ó‰1˜í†`ôÁÔXX;Z—–?J1Ô ÂΛ‹Ùv78÷û˜î=Š»|}5À߯>݆©^Å«8Xˆ^O – ™¢€‰)¥”Ò#KV¯C‘“¨@\âîtßÓ72¥Í†|PžR1¢Wë ±Yü÷ãØukÄHsñ¹ÜQ#%ŽOë:á®ãa6³ âøÊ?+$á:Áì{ 溟bÿ:êÇDáíKÂ"Q´Z—ºy°f¬™Íó¡uyr îøó݆cç,Ä Ú~yfЈÈåË3+yÿMì…§b(e–uEÎN¾£j³‚'7õ°§”Ò/% š¡‹ÕõˆåHgÏiN)¥ BÙ(“u Izå|3¦ØwŸÀ¬Y Ýå8Ä‚èYyÔ8Ìû`ß{ÓPáÚâ|ZK0½nÁv¦¡€]áØ)=P"_>3åì¿Ç2VOïx +Ù~š:¨Šý×tÌ~{Ã5¿ÇŒÞª2 ·¬…îz)'ÒÕ74@^þe@†,ùMo‹šRJÿùTá8HŸ4ìlä=Ýý!‘Ä ç4§”Ò†¤À;(a*!K<.¯˜[Îç nŒDTžòž<=[‹éÞ8^¦}¶_)gš[ƒé;{Ç?áéÇ¢|Ô}ÉVÙ0Äôì?ºó“±N‡úqô.=ƒÈçz+}4Í@Ý0ƒ°MÇ|ýt¸ù/Å€¬ÒM‚¶õÁû±×ÝŽ;Z–U:|"KȇXnuÑ–ÅþüéM=ä)¥ô_Gz Xà}4Ühø*¦VÃÈ~ŸèðŒ”RÚ¬È}½Ë$OšpR”;Úõßÿ’k<ˆ×>Ê5Ÿ‡Ð”‚VóB‰ä{Í÷°‹æ:áòÑ{¦ï¸ìט_üûøTìêÐ}4ý’A·Ò'è ÝF°OÌÆ®œ…yðnøÁÏ¡ÿ`Cvm)„ÚvõyñìñŸÇ8ÖÎN>x¢øD¨kȳK†ØâÈÒ)¥”R‘žžš‰E–"øÂë™Ý?FB•… M)¥Í…Ç=fÜTþGYN9ZWÊù@ÿx¸X¯ì‰yØr<æŒ/`§ÏƒLŸny¦û ìÓÓà÷7 ?YÐZèÑ€9óû˜>5ûÄ ì¼µÝÆ כ馘îò zB¶¿€p·1ˆ¿ ûä<좘ß\yx¦ñ¨­뉬u¯¡{`§}§ öè ­ Ëéë¹,–—±ÜJrFužÛÔÃRJÿU¤oêW‘ƒHö±G³ rÖ¹À«À¥H|øäÌR|BX*ºNi³"îYØ5~ñ¼ûØFÖÄþc&æÍW1;ìZXÃgh‚û䣨CÇ4ZŒ¯’¨~ö陘‡îÇ|ꘒ¼¤È(R— ìÊåðÒ³0ñØ;ï…•õÀZ ¦/ج«}ræÌ2€nЧsÜ‘ðñcaïý1ÃGa­‘¸×…è_ÞæÂZ‰Íd°sfÀ'`'¿„é×[ŒÞJãŸùNQ8Ë?0zHcð¦î”RêÅb_ßœprãFu+Šé”_C,UÔŽÃ?uLƒù?àT  ”rJ›eý\a×ø:â*0ŽâøµŽ,X'Â~êqØaׄð“îï=÷Å|þìsa7@nUiékgaöŽýÌgà…0;ï%À¬ù({>Â4ôÆÚˆÝÿPÌw~ï½3¦ÃäW± faÖ®–S¨zö†á[Âøaø0¿ †éVïáŽ6%€|ê)Øw_ Í‹“NýU Î!"²ë°üƒ€€fBê7õ0§”R—R¦Ì÷IºA؉~ ÷ôíT0ž…èÿ@‹;Þ•ÒfKÂ)ïØBÄ›[1|Åi@ÕX"¢ ›oÅYxx&fÐP0¸åçžÄîwfÿQ°ffr 2ݰù˜UKà>Ç}çó"JöEÚîj½`#¾±ÍµB.1i ÔÔb²5¥ÏB1'ä/"ëÉpÖ×±ÿ~3j0¬]PlR8ñ¢`m¦bØ•<+0ÔHªà¥M=Ô)UKÔØìâb¯gÛJ¶—åÚç8SMÿ#àp÷÷_°OXjlläÁŒÔÓZÓÛû5 a-½!Xá{Æð¨µÜcLáXÆB ÝÍ柿Ùèʳ°SÚ I@y WØy<é¾?àBQŽÀ>7sÿ1Çœäô®¦èõ¶ŒÍaz1ö‡—aö kç%q™PÓ€]&gáοÃÎ{\ –ÐåÀ .Y&¦“¶Æ»,ùbêxhOÝL#Ï=÷|ùcØ` ¦oÍK*‰¬ýïÀ_Á[¿Ú¹Á©J•^̄瓎ßH_n:{4e”Uý·ŽU{}?1«ŽVL0×fxÕvmÍÝ"TË`È»±Šf{‰Q×(VÌ1öÕŽCJŽ"N9Gt$}ž€½(ÕÑuØæÌÐ ð§¿aú@ƒÒp”3?„ÃÇaëúbÌN™²@mOl®¼>óÐ}˜ÃÆUŸ+.zΉžãX_x"ıg­ÇyÛ•ËáîÿÞúmØe&»š——;C+.¶¾ø † µ²4t¡ó \æÞxÔ¢"Ρ\^) %,”EÆBðåvÏP®¢®PúzÔ#À´ËÛË»J¿à vÚ¶-Èqeð,5¬Æ‚yv {~øû¼Íö†íœY3ï¬ì-³Ã-í3%Šs´ëוmôh<°%2V¯ãôââ}í*PN8×;åð«¤,p„»kÝâm¸ å¸ñ’P®Ógö‰71Oý Žý\ @šÀY.Úû«Çà Ã`ßq°jjrMZVc²v‰=âX¸üðÅÓ0ƒ‡b­}2Þ‰T*¢&ºV<{2¦û¶~`ó9ìk/Â¥—`x³çH9ùiݺdî¾›Èñºah#ÏÀß:?0eDX ®a•Ïi—¨{È` 0XKJ%äúOG|,ðMà>à½ßÔÔÔ%GÆÆªÆ]uó?ï¹0 +.l±ßŠêÙØØèŸ)ü"p!p›øè„HÏ(+ÞÞÉrlxÐg,ìd°W=Øí¡•“ÖmÏ&º…KŸ¤û^Ï5¾6x03Åþ'€qŒtœ¾>h&“Ù.]e6ó²ÆU5÷ÊP È lá›3(t– -Œ¡XŒÑšy°].ývß0CGÞPQ°µ˜…ß\‹=íl̾[`W|˜Œ ­k hÆì1{áOà¾á’áÀC1=œ]Þþ6¡ˆ#ö)ÎAÇŒÑL`smØ÷Þ†?Ü„½ê&7³çpìïÔ§2€l¢£à¦a8Ct2ëã¼Ñ¥cuð à[ˆ%i5/¥j/!."[¹ûÍÀï€ »oØÎèR;*‚­’³ïT>¡vÊÔ(P'ç#P€|ccã0 ðvÕ§r®ï6DA0òÈa©¯#'Œ=I¹íaå¶sù}ÐFŽ9ñY¿MfbÇuí˜O:§ |ؘ^¦Ýp‰íÁ¼xdsãÃCŒ%ÄÔ!‰ÝÚf82߈_•xÙ™ͧƒóCûa<È/ n_}5Π˕ב±HH«}= ñ箎A‚#­9Uö[׎IÀÚ8¨wUß·—×úŽÕÆ\£ (îˆ,C†Œµä1œnàW@Kà†ªõê‡Â+óટaÎý®è‘‹r7‘ž¶e\ñ#ì¯Àì3VL-_+ ô kòØwbŽÚ¾ôMØçÌ€A®Õ-ãÀV?¾´NÃŒ 45ØeKà×à?a¯» zwÃlÕ_ÎnNvy¢8cB,5,7ðq,¯¸hâovj<â“ÀçjžF&ø ÈÙT‰º¦Øä©G qŽÞþ„8Ší|qÛ?aNø*‹ÂiØ1 ¼ßƒØß¡—&¨–¥œ¼…Ï!Bdp¿ïç¡ácˆ=W$úÕ§\™ZÖpàkÀ8Ö Û®›ãÉC«—¾\=ÊÕE©;ð>Ðø»×áÔ÷zWzõm¯Mó¢«×È«6öFŽ.¼1ÜÒß*y|L 1ò*Œ«?~E±JtÅÊ­ÿå¸~ šššB/ö÷áÀˆ[–J~~èÚ´¯kŸ¶«\]3Þ}m›ß~Ž”ë›róXÕåÆ]ß³øœÖ~8q?û2²‰ŽK3::~Ý ¡ŒÊŒÁYÀÕÈœ¿™#åÔ`IuдŸFæñ³Dï$¯!ñw¼š6úõÖïí­_Iy'IŠ:ºFAñ¯´>ésEó#ÿÙ¶’–ý¸) ø°Ì¥®kæÁn#Ἃ`ÿ1{ìS7Úç–ëºcϽ³v-öŠ_Â^caÅ4ÊÒêyé»À¾þ2¸ ·;Œ-ò:y¶ÞC¸…ºúkh•¤»¶t "®š,šÈHñÉú)d±xÍå ­üÅÝÃÕáóˆˆôQ"-»æ5Q‘< B¸ÒÀ?‰ÈŽºÂÕo‹ˆÐîB ÍcpÂúãêØ üÝ«÷ÁÈ‹õÄxæd_F@Ïç|‡‡!Ò‰Iîï\ßoáÆ#‹H!–!ÜÀãÈá¥~e#ƒª§†¼˜æ~ߎèeW½ê9ÈÆªÑõíá®?ãådMØ<`6"¹ XàæL?÷üÛ'ù‘Nùx7ŽËû“¼˜€¨Qz/¹qZK;ØÕåSëæÀˆèõ.Äw¸HÒS†SÞ§?qÊJû£‘5J9åKnygdóM7G^Gl–ÅêÚÌA¢õŠl€ŸtiA¤G»¹² *ͧùŒC‚—ü蜎H?nA˜š¹È{Hì¹] v¥6Ûg_qóíeä}~‡èßÏÍ…à×+bíÛÂÅD—î4WÇ«‘µÄ455Ù˜bŒ›'¹ùw¿ëÏ7(Ä]]ÿ r¿ßƒlë\Û¿ˆˆÞ/vuÏ#©Vä½ÍÏ ’œ“7[½rvEph€ûíÏZoW¾¾§û»|WŸus1"|¿Ì\>y¿»#ëÇÀšXÚñÀŽ®z¹¶Œrý}/²¾ÔŸsã9 9§{™{~[`wW·…±1®uóo!"E0€-Âp;16ƆXð×YjÐTlôeƒ±¯/À\t懗BM]ô# ˜[›±·Ýˆ=íÛ˜m‡C7«gÓ.ej¡®d»c׬„ÉKªßƒw³ÅèÞ g1·,—c«£8 À×,Üj2ù%ä3$EæÝj³,O1pÝYDOC8Ü·ÝDØÍÆf]Ø..G@ç7vþ./.: !‹ædq®G&Îõˆ.['kY`ŸGïŸ /CƒËgd1û²`ws埉ˆk‘—òdÑ9¸Yè÷ûÕ®Üg1r›Œ"ùȆMDtæ×xí¬C8ÏyÈ‚¢m|Å•}›ëÏfD¤Vçî}ÅËãpĽí(oëîW¯VW§[‘MÆ\`®@YðËÙY\Îry\ïÚ¡à^‡ýÌÑ3®]Û"bFõȂõ²W×:àv¼×¹üzŸAdMžéÊ> ”±î~=œhO<[†N€²ŽåŸ\}FéZŒØJÜŒˆuÎöFÌ#€)^ß/qùLF¤P¸ë9nþžìÚ» ÙÔdÝ|ý7Ïrã0² Ú „½…¾ŽÍ/øo¹9¿¥ô¤5ì¬Aâx_îúñfš.´7² 9ÙxéX|ÃÕõcÈ»· òNnçú,¾©Ë#›_¸q[€àO`õç›®1 \ÿláÒëFd.dÊ-f‘wr`)²Ù_êÆûnW‡‰ÈÆ(@Þço¹>^‹èÔ¹vÿÍkc#²±ÿ‚{Wö÷æòrdóò¶7oêÝØ›Ë“Ý\~ÛËû\÷Ž\‹l>rÈZô;ä|½CëÜx¾ŒlðV¹_îÆÏï¿Ý]Ú‹p° _rJŠ Ádå#žMÈ$wêQžSÛ«`výÙ5Ø?ß+ˆí¹áþ.IJ®©#8õ[Oÿ Z–bÿ5zŒšÞ•–ȵšù°b&\‰Ùº7f Ì.£0»o‰ÙmfW÷ÙÍý½óHÌ1c{CÛrX>MDãmëÚ?UÊií·Ýr –[!Cž|¦¿Ô¯+Ù#Ýøë®ÊíÝì·vÆ0ÆEìí®º«o_´… nã‘]hÎMêþ‡q²è|èå —ãX7±wC^¾“Üo /ñ‘îÅØY<Î'r¼Ù•öBl¾ï¾+‡²¸Üƒ¼ŒÃ€<Ì}â"θˆQEuq‰À„úÔÕ¿/²ˆ¾‰Á¶^^ÚgZßG˜‚ì„·C¢ Üò È.½'Q0Nd!D ›i¹‡¹ë|üÞD6[5‹í´œ‡‘ Ǯ÷§ñD:k¥ï é0daú²h}Óý®yÿÀ«…©?²xsó¦ŸW_µš¾×ýÖßýþ „«ü‚Σõ4óuÅJ:fG¹¶ @æÏw‘wæÚX‹y{&²1é‡ÌÅYxφ ö;"@ó3—NÛ©¢Ù?"˜ÁÈFl*ÒC]UîàÒÜæþöÕƒòî(žîò¼Õý~9L׺ûý`âú{°7z½ Ù° F8aå‚’Dù'!ïàtdsñ²!Õ>‘÷àräý‚¼C[!ïý< ¶@æ¡A6HCIËJ—× D:sÂQ÷E@ð¿…¼3Ã]ïçêøgWV[¬Þ¿G6‰ݘŸë®ßðúWÞ1®þ]ÿçê{¿{&>—l4{!›•—Ú·ÉÞä½ø#Âõéž{ygOFÖ>_ê|Œ»ê†Ä655•]–yå…DDz˩Xgð%.w’T4¤+f`v=ñìãé•‹€Yý˜­Åð1Ì?§`®»ûútìêZh Ô´–¹6hYkŠ™°t ,› ËÝg™û{å,X»HÒæså¿ô£ÿ –– !ë°CÈ®‡òºÏ̼O—¬:ÑŽGDkº»Ø]uÐM™çº µÂÏ¿©©©ðñŸG^€7U”²‰<yIzYuC^Ø#àiÜäz…h’7!‹Ð PD&¾ïjò"Þè&ë4DìW‹€õùÈ ²ŒPvLèº$Hp_Ń] "Ný­»¿m…<× ÜE‹ëç鮾ª³½y9u+X‡é{z¿L€ˆ,è Èâ9Áµù8d±ø—K†ÆúñxdøÐõÙd÷Û:7VS‰|’uãñdÁœïÒÞ‚Ï>^ºmIÍSnLòÒ*HÍG8‚nî·¼r5­ö›.Þ‡'ôϤØß+‘Åk°Wï®&mßïžnÄžp× Þo=‘±XëÙØØHcc£qû#ïÇÅîŠ×Ÿ”“UŸóÇ»±¨n”A8Ï!@_è‹mÿ ‘ì^Y:jÿs¤—^ûãv/}¹ ,ˆ„":7 ‘Ô.@¸¿WÎø×6í· !߬÷·–_çê«sVïïˆl”îGÞ ß3ài×§Ÿ"æÎ‡¨ü2V ƒ^Þêm¢Ü©?—u~ûƒ õWw!ÍG}f§ÄÒé}¹Ù”úïë.ˆÔèÿùDN¹@!²´æÈcÈs–k ©q@U ̹Ö̓mFî0öÙ' ³Mmi‚ÂP¸æ}ÀÜ9s÷형 °ï.€äÏT«âªçx;úQî8Ä’'$‹åm,ûay C†À%µù€.#ï…Œ‹#¿‚p›/";äˆèK9Fõ^è&\ßxúñÊ鈇æ-f¾Dv˜W?Kô‚ûæþª;Š[ëW:MºÖ›u~Úneîû‹JGíÝU'^»¯ygÚyÖ'­—Ф–!‹ß‘ˆx¢Eî/±gâùÔ"œ3Ýç d!ßÙ¹«ÄCUw!;í!î¾.˜$ÔÏzÇÛP›ð[+Å--cRBÚ•ÈFl¥‹d—^ûÉëoòõ£ú·Þ›ç®½½ô†hì}•Žu}"ê½ ÑËÖÅò÷©ÅËÇïç[\_íþÞÙÜÏ+¶Y‹DïàL/¦[ì>ƒ¼zê»Òì×-&-óËÒ:Þ‚0/!:w ¬qiÛñ냈aÝ,D·óúЯ»¯nÒ{ê–¥鮺‘W#ƒÌ·9È|ÓõA)¾^èw¬t.Oõ~×r—!ïÙâžI¥s9×Î}m-²ÿyGu3÷iw}0^ç² œ™B´|…„d0´ñm,·b©q"]°H”ÝÚŠi[ÛŽ!Üÿì_›0#œq,Ô¥ ‚ˆkîÙ@pÂ)˜ç§b¾söí¹P?R ¼6,g¬Ü±¯?¶ï"d/r¼ƒ!CÆqÈyÈTpµ^OÒIzŒ›$“Ýu1"ÞyÁMšOù ö’½è®ûêÆÊð9¨V÷‰Or%]¸ã–qþ‚§ŽpA듇©p¿`ÛÞ¯–TG¨;¬)µ O*3‹€Û¯1Üo ŸNò{z32.ªoþ "žK4ÖÕH’êNõkõ ¿× ÒÙÂSÒøuT²!m$ׇÜuµw¯Øp5rãÚ·!Öãã.KÁÊù´&µÿ)„£ú’û[¥ Eµ*õëj¥]›ð[ã¢1óí@Ê‘¶ù#ˆÚâmø–"@5áŒwDì@æë\dÓ9ø%"’áæ“ÜÈâdËÜ× DCBz\[)_Õ¬ºqÒµÎ/?‹ˆÓ«™ËñMG9ÒßovùëØŸ€€y"è`”¥ÌT¯Ûò@-† §r§Ç1‡E³ZZ0Íó1Û&üÔ‘„wþ“k… („ËŒ“F“Мc0—^™x/öíiØš©[?¹:qµÅ’#$㾟 |ÃZ²Î<'}‘ù E:&»!Æ ×# î§Ü€¼ËN 7:ºhéàêì‡ÕÐyÚ+ÛIˆÛÇ÷œ/æR‘ÙäØDÛH9û^îª;\ÝRv%ù/¢P×%íË׫ÒcéÃŽDâ¹ üýüô—Dè ôôÇ!»ï­‰D”¾¦¿ð©ˆºZÒ2ÕÉOçA†ˆCØ«»‹ÿÜú’/¾ (æÞË‘¶UA)ëÝ;Ä]UÌYiÓðEDMr,"ÖÔż£mÓ6Üèúoò¿Lû>çI¤ï ? ÐÛ"bß·ÚV(£L/µÅ RšO#¢úO"Üó.ÍQ^~Ê…NA¬Õ÷C6hç'”«W<â¤iÔBG7Ñ|l^C,¬;Jš·Ï¬hÞq}ùNùT;f:/"ªŠciÇVÄD×$ý‘D™i…â­$KžS°\ë8fëŒÀ”c–Ô-Ͱj6fû±Ø“¿HxÑù°`~¤gŽƒs\×l‚£Ž%xæI̤9ØLo0™ÎsÂåEÕú=-pǯ;qõ5Xgòf 5¯Ì46$é„U½Ð#ÞXéZ‡ˆ)w"2LRKÖÐ¥}á¶öF,f! v"/Zj‚˜÷D/ŸŠ¨ö@ŒfžCÀFóÅf>•»o«¼ç߯†›ë®*Ê×Åø<×¶5±gýÑ^™ñ{:6+h¯?uŒ@à]Å©•H¤\‰#òë•GüÏóMMM6Á8Ï_è?Šá­D|—ñêÓLäʃ«K¼M¶B]4Ÿ¿#âÒo bùV"NBƒü¾Êñ+7?âi ù¼3¼Š?›$©Ñg¶ôÒä#›Fd¿Ë#©>ªöYê®mÈø'±ëíµD‡¹qÙ‘]b•ù>€à©®þXœë®¿«¦n Æ¡Ç!Ò}Ï}iÚk÷¬Œ@?4}‰Á»È|ó¹x5Vì•å×).jáÊÿ‰p“{¸¾×ß¾…ûÿu ÿý÷ý1dÍø"&o%Z3t.'å]ŽªY£ô}½‘DœH<òÛ­s º]s4õ­Û,ß&äLÇaŽkÆã8!—‡eÓ1ÛŽÄ^}=öÈC±¯¼T8+¹ÄÌQá÷0ÄìæÅçaÊBè>@\«×ßÐËzuÍ;n?CH–‹±ììlÄoÏFR€ÌŒªzl}Hun_@—Ýý6Š£PNøxí6ï%Ó q²PŸ‹¼0?qâÄucW¢èwˆ8í;ˆ|ñù|÷«§rÝñ]¯rxñ¹•d¥\­‰]3 iý¿ýß'!‹Èg=Ø—\ÛND¸Š¸¬†dƒ'Ÿ›$¡?Í#.Ÿë\9jt§cs²˜_àÒ–ˆ¨Ê(Õc•#¡_ƒXáþ1ÐRc-õ£~‘¸\ŽˆaÕPÉ7¼‰“ö‘Öw5â"ÕQœÌϧ\¿ÿ ñ癤2ÉоÃwú¸»±±ñîÆÆÆ{Üߣ¼üµïüºƒlXîsm¾Y[ˆ¸8ã¥Oêƒ'ÝõW×ø%„Uñ£<ñyì“uùÏAt³g»{Eµ27ôÒ ù7‘ áóˆñç#¶Ï! ÿ#^’ŒÅ€hÛ' ~³ÈD}–u=jAÖœq.íIÈ{w+ÂaŽèMˆ< šr ²ß Ú$*Wàúi²!ü òŽýYŸ$b"ü¶ùãèÛø†w+Æc²ÆŸG´f‰Ì¹gbÏÄóöǺÜ;ëß×1¾Ëõãy®ŸQüž%”H™øÜ¦BTË X>IÈ\"?fß—Ù’·°dfüì¼…„{ìEøËk`þÜ"‘u©ë”óž{c~qvòhº>blßÍ)Oäæ•Áò4–=£Û0X'®¶™™™lhÒñÐ]þ-ûµùü"*U÷Ǫƒ¼ =‰,"ßG"CŽè-w! "/õÝÙí.ýsÈîî5¯áÄ'Q 4Ó÷ŸÖX]滲|Îu.¢¯R=™¶mb”³4–ÇÄRVã¡*} K}ÕõÙjdyÈRé„SŠѬBvõ‹¼´+\YzOûø:äûœ»~•b·¦D–œz­Ä…®?«u¬Ó…~.Ñâ®Ö¤q]×÷· nV%0k@ó½ôúÌ$dçë#›y1 q/º ™ŸE䞢闸ñ[»Ÿs}_ÎCÓÍquÛ ‘ìÙÓ}ïîÒÍD€²ÅËc)²¨6"\ý­È"ø.â§‹ø¢yßBÇø/W» ׺±þ(Q7¥Eˆ½‡º'•Û|)ûœ«{P&­Þ[ìúBûQ}Òsõøñ·ÿb`uâÓ‹¹^} åÅŒ=wB¸ä»Ú ßÿäÚúQdÓs1²–<ˆl ÷@Þ…?qÙ/#›Æ­9ú3"ï‰iWì«=T ô*"b~q­» Äñ#Ü}µÌ dûï®Òû«+Ä•ï ×/W"›ˆq®ï¾ã¥Õ±CdhéoTçPüþ€l„'!ë ÞWUÚB"8µh/±êÑE~ů.dÉý±\èaTü¦»bëšhèÞêú`?˜ £ú\v q¦Wï‚XÙ(`sgc?¶vö,L¯nÐÖ\}Å£Œ‹›?B7K¶4èzfnÕå¬ÅbW«&¿=òêÇ)®€I,Ä;/–Þ">ªå±ß’ò¦ŠûIy”»×™ûY$HÃJ¢(©.]U?ˆDr ‰€2ëúöf„ƒ,®…èUJí{\!­ª2Úî¤Ñµ=îÒO?g/‰•ÙÞ¼IJ;1”™Gq\åjú-±ÕöEgEÇï ríŸïý^í|1në‡,Î-eòÐ>.§£ÖÈl‡ œßI@…ÉU*ãÃ^î^d“2=R¨±(Ó—%#”!•Lø1ÃÕZy.åçC„‹žO$.®ö]ÔgP·½~*W†Ÿv ²Þͧss¹š2ýuáND²0 /$j§AY)?”Hp”# ,h]@Øÿ-I@aûŽÀ6ç`Æ<ÌÇÀü𧘽öÁꑊe€9üÕuØožÙj8,ŸÓ^5} ÖºX·ƒ3n—i¹“€6w–ÖÙBf~{ElªtÌZ5G°•95ðºKOVåšËÞÛÎD­tˆzRÛºø¨Ç¢—Î[ät¾%Šæt^ÿw¶eÚ«Gâ]‹p#IãœX×õ(7>gJÊÜTó£ºV5Û™W%àó÷‘ŽÅ‹u]mm¨±èÌzC)8—ë³’{•êTe cБ¹¶©æ²w†¹F+¼Q)&® e€üüén°„ä±Ô#ú¦óÉW Š`DÈWkè=»²æ/Â\úcÌ7¿…iè%~Ë ºf§w6A€}éE½öÆl3MOªV\䢢_ìúp–‰Ö’Á`b“Ël@nÏ壗¤¦B~‰;Ó2ùVkò¿9ÑÆ®s¼¼Ý®árĈd{<}rGÏñ-3–ãFbò6 "Ö¹~9x<»´Ÿ«™×›¸®µöŸ‡ˆÑ?‹Äø2‘>4Ñð¯ƒ}Ñáö•á”;®Ê:TUÏM°mè5#@lw†!·}ü|ʬ e€üà’¦žÞ¶'ðE,§!;„R7 K@}/è3ûÎÆ|çlÌO/ÃÔu+œÃ\Ê3g`GÁnÀØfȵ%°vD@Ä-/Fô7±”—é‹qC*Óë‰Lü”Rª@w\O¤ãŸü(œüë·ëöª^ˆNs8b…ûY$²RÙE>¥K±Ã5®Gl:Z WPFœœÒyëBoÄÆfò¾žŒd)».Tkí™H™rÍGA•3Í«És–›ø¨«L#–Z †5+CÖ® ÍÛX{õµÆ|ñ+Ûmo âkˆ¬³à€½-ϼ`Ò` ÛT§ߊw.b‘8q#XJ t›¶âóc3¾¦-¥”ª'¨ÍˆJwÄø¨H¿Û… ïZD‡\‡ÄZ^‡'–MøÍ†tmù9éj b”òÿùaÇ vo"ïoÅua½@Y)ãŽ#ÎËiIbèe\@Ê€6ZxŠ€§ˆaoÄgp,€îX k×fϲl·½p¸~XN0&“±¶[w'Š6Z–ûƒ¹È"õ*âãö"Æüˆ;p¼„„ÏTÎ8ã”Öƒ¼—*lll|Ãû©œáÏú–“kll|}C•“ÒúSLí0‘œ@t«)ýg“7¶ùÆÆÆ×ÜwU¥V|_»”•àò}ÀÌ8—¢Œ3¢Ê²ˆf$àAW9á<Žúž[[нûÞˆE¡%Ÿ ¾²Ù¼­©i£O¿YÀ,jºMgíÊéÈ„w’Ѭb6Â;ˆÓ„rÏâ•ì9e–’RJëM Æ# ÑEÆ"¥œ”ÖŸŒu!NÇê„*¼¯íJIÖK§Üåû¸/jê¸ *|pAtlµa²²?°a¸ ‚±äókY±Ü°r…¥¶®™¾ýšm÷îë˜:uª7® 4Fœ4žMàDÓÅSAÌò =)¥”RJ)¥ÔyÚ  §¼F'VM°º'é_YB–ºÄÎñ„tù]MªÎÛ œÂ@feûuJ)¥”RJ)¥”€|ƒ|r@þ7¿–§Ë–ÖÚL˜Ëeìòe;{VÆ.˜ØææÀæsAþšŸKúO~¢ð|¾a=+’RJ)¥”RJ›ý?r£ò1«¤Ü‹%tEXtdate:create2012-10-18T20:57:32+02:00TÒ%tEXtdate:modify2012-10-18T20:57:32+02:00uZìntEXtSoftwarewww.inkscape.org›î<IEND®B`‚astropy-0.3/docs/changelog.rst0000644000175000017500000000013212243255342014604 0ustar oleole.. _changelog: ************** Full Changelog ************** .. include:: ../CHANGES.rst astropy-0.3/docs/utils/0000755000175000017500000000000012243263747013277 5ustar oleoleastropy-0.3/docs/utils/index.rst0000644000175000017500000000453612243255342015140 0ustar oleole.. _utils: ************************************************ Astropy Core Package Utilities (`astropy.utils`) ************************************************ Introduction ============ The `astropy.utils` package contains general-purpose utility functions and classes. Examples include data structures, tools for downloading and caching from URLs, and version intercompatibility functions. This functionality is not astronomy-specific, but is intended primarily for use by Astropy developers. It is all safe for users to use, but the functions and classes are typically more complicated or specific to a particular need of Astropy. Because of the mostly standalone and grab-bag nature of these utilities, they are generally best understood through their docstrings, and hence this documentation does not have detailed sections like the other packages. .. note:: The `astropy.utils.compat` subpackage is not included in this documentation. It contains utility modules for compatibility with older/newer versions of python, as well as including some bugfixes for the stdlib that are important for Astropy. It is recommended that developers at least glance over the source code for this subpackage, but it cannot be reliably included here because of the large amount of version-specific code it contains. Reference/API ============= .. module:: astropy.utils .. automodapi:: astropy.utils.misc :no-inheritance-diagram: .. automodapi:: astropy.utils.exceptions :no-inheritance-diagram: .. automodapi:: astropy.utils.collections :no-inheritance-diagram: .. automodapi:: astropy.utils.console :no-inheritance-diagram: .. automodapi:: astropy.utils.timer :no-inheritance-diagram: File Downloads -------------- .. automodapi:: astropy.utils.data :no-inheritance-diagram: XML --- The ``astropy.utils.xml.*`` modules provide various `XML `_ processing tools. .. automodapi:: astropy.utils.xml.check :no-inheritance-diagram: :headings: ^" .. automodapi:: astropy.utils.xml.iterparser :no-inheritance-diagram: :headings: ^" .. automodapi:: astropy.utils.xml.unescaper :no-inheritance-diagram: :headings: ^" .. automodapi:: astropy.utils.xml.validate :no-inheritance-diagram: :headings: ^" .. automodapi:: astropy.utils.xml.writer :no-inheritance-diagram: :headings: ^" astropy-0.3/docs/modeling/0000755000175000017500000000000012243263747013735 5ustar oleoleastropy-0.3/docs/modeling/fitting.rst0000644000175000017500000001021012243255342016115 0ustar oleole********************** Fitting Models to Data ********************** This module provides wrappers, called Fitters, around some Numpy and Scipy fitting functions. All Fitters can be called as functions. They take an instance of `~astropy.modeling.core.ParametricModel` as input and modify `~astropy.modeling.core.ParametricModel.parameters` attribute. The idea is to make this extensible and allow users to easily add other fitters. Linear fitting is done using Numpy's `~numpy.linalg.lstsq` function. There are currently two non-linear fitters which use `~scipy.optimize.leastsq` and `~scipy.optimize.fmin_slsqp`. The rules for passing input to fitters are: * Non-linear fitters work only with single data sets. * The linear fitter can fit a single input to multiple data sets creating multiple parameter sets. For example fitting a 2D model with input x, y arrays of shape (n, m) to a z array of shape (p, n, m), will set model.parameters.n_inputs to p, even if it was 1 when the model was created. * Attempting to fit a model with multiple parameter sets to a single data set results in an error. Fitting examples ---------------- - Fitting a polynomial model to multiple data sets simultaneously:: >>> from astropy.modeling import models, fitting >>> import numpy as np >>> p1 = models.Polynomial1D(3) >>> p1.c0 = 1 >>> p1.c1 = 2 >>> p1.parameters array([ 1., 2., 0., 0.]) >>> x = np.arange(10) >>> y = p1(x) >>> yy = np.array([y, y]).T >>> p2 = models.Polynomial1D(3, param_dim=2) >>> pfit = fitting.LinearLSQFitter() >>> new_model = pfit(p2, x, yy) >>> print(new_model.param_sets) [[ 1.00000000e+00 1.00000000e+00] [ 2.00000000e+00 2.00000000e+00] [ 3.88335494e-16 3.88335494e-16] [ -2.99749607e-17 -2.99749607e-17]] Fitters support constrained fitting. - All fitters support fixed (frozen) parameters through the ``fixed`` argument to models or setting the `~astropy.modeling.parameters.Parameter.fixed` attribute directly on a parameter. For linear fitters, freezing a polynomial coefficient means that a polynomial without that term will be fitted to the data. For example, fixing ``c0`` in a polynomial model will fit a polynomial with the zero-th order term missing. However, the fixed value of the coefficient is used when evaluating the model:: >>> x = np.arange(1, 10, .1) >>> p1 = models.Polynomial1D(2, param_dim=2) >>> p1.parameters = [1, 1, 2, 2, 3, 3] >>> p1.param_sets array([[ 1., 1.], [ 2., 2.], [ 3., 3.]]) >>> y = p1(x) >>> p1.c0.fixed = True >>> pfit = fitting.LinearLSQFitter() >>> new_model = pfit(p1, x, y) ... >>> new_model.param_sets # doctest: +SKIP array([[ 1., 1. ], [ 2.38641216, 2.38641216], [ 2.96827886, 2.96827886]]) - A parameter can be `~astropy.modeling.parameters.Parameter.tied` (linked to another parameter). This can be done in two ways:: >>> def tiedfunc(g1): ... mean = 3 * g1.stddev ... return mean >>> g1 = models.Gaussian1D(amplitude=10., mean=3, stddev=.5, ... tied={'mean': tiedfunc}) or:: >>> g1 = models.Gaussian1D(amplitude=10., mean=3, stddev=.5) >>> g1.mean.tied = tiedfunc >>> gfit = fitting.NonLinearLSQFitter() Bounded fitting is supported through the ``bounds`` arguments to models or by setting `~astropy.modeling.parameters.Parameter.min` and `~astropy.modeling.parameters.Parameter.max` attributes on a parameter. Bounds for the `~astropy.modeling.fitting.NonLinearLSQFitter` are always exactly satisfied--if the value of the parameter is outside the fitting interval, it will be reset to the value at the bounds. The `~astropy.modeling.fitting.SLSQPFitter` handles bounds internally. - Different fitters support different types of constraints:: >>> fitting.LinearLSQFitter.supported_constraints ['fixed'] >>> fitting.NonLinearLSQFitter.supported_constraints ['fixed', 'tied', 'bounds'] >>> fitting.SLSQPFitter.supported_constraints ['bounds', 'eqcons', 'ineqcons', 'fixed', 'tied'] astropy-0.3/docs/modeling/design.rst0000644000175000017500000000251112243255342015727 0ustar oleole.. _modeling-design: ******************* Models Design Goals ******************* The `~astropy.modeling` and `~astropy.modeling.fitting` modules described here are designed to work as peers. The goal is to be able to add models without explicit reference to fitting algorithms and likewise, add different fitting algorithms without changing the existing models. Furthermore, the models are designed to be combined in many ways. It is possible, for example, to combine models `serially ` so that the output values of one model are used as input values to another. It is also possible to form a new model by combining models in `parallel ` (each model is evaluated separately with the original input and the deltas are summed). Since models may have multiple input values, machinery is provided that allows assigning outputs from one model into the appropriate input of another in a flexible way, `~astropy.modeling.core.LabeledInput`. Finally, it is permitted to combine any number of models using all of these mechanisms simultaneously. A composite model can be used to make further composite models. In the future this will support a model language which will allow using models in algebraic operations like .. math:: model = (model_1 + model_2) * model_3 astropy-0.3/docs/modeling/parameters.rst0000644000175000017500000000727212243255342016632 0ustar oleole********** Parameters ********** Parameters are used in three different contexts within this package: communicating with fitters, model evaluation and getting values to/from users. Models maintain a list of parameter names, `~astropy.modeling.core.Model.param_names`. Single parameters are instances of `~astropy.modeling.parameters.Parameter` which provide a proxy for the actual parameter values. Simple mathematical operations can be performed with them, but they also contain additional attributes specific to model parameters, such as any constraints on their values. The preferred way for users to interact with models is through individual parameters. The goal of this package is, when possible, to allow simultaneous model evaluation and fitting with multiple parameter sets. Because of this, all models have a `~astropy.modeling.core.Model.param_sets` attribute, an array of shape ``(len(param_names), param_dim)``, where `~astropy.modeling.core.Model.param_dim` is the number of parameter sets. Typically the array is of type float but can become an object array in some cases. `~astropy.modeling.core.Model.param_sets` is used for model evaluation. In addition, fittable models maintain an attribute, `~astropy.modeling.core.ParametricModel.parameters`, which is a flattened 1D array of parameter values. It serves as the primary storage of the raw values of fittable models' parameters, and is used directly by fitters as an efficient means of reading and updating a model's parameters. Parameter examples ------------------ - Polynomial models are created by default with all coefficients set to 0:: >>> from astropy.modeling import * >>> p1 = models.Polynomial1D(degree=4) >>> p1.param_names ['c0', 'c1', 'c2', 'c3', 'c4'] >>> p1.parameters array([ 0., 0., 0., 0., 0.]) - Coefficients can be set using the `~astropy.modeling.core.ParametricModel.parameters` attribute:: >>> p1.parameters = [0, 1, 2, 3, 4] >>> p1.parameters array([ 0., 1., 2., 3., 4.]) - It is possible to set the coefficients passing the parameters in a dictionary:: >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3, param_dim=2) >>> coeff = dict((name, [idx, idx + 10]) ... for idx, name in enumerate(ch2.param_names)) >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3, **coeff) INFO: Inferred 2 dimensions when creating a Chebyshev2D model. Resetting param_dim to 2 [astropy.modeling.polynomial] >>> ch2.param_sets array([[ 0., 10.], [ 1., 11.], [ 2., 12.], [ 3., 13.], [ 4., 14.], [ 5., 15.], [ 6., 16.], [ 7., 17.], [ 8., 18.], [ 9., 19.], [ 10., 20.], [ 11., 21.]]) - or directly, using keyword arguments:: >>> ch2 = models.Chebyshev2D(x_degree=2, y_degree=3, ... c0_0=[0, 10], c0_1=[3, 13], ... c0_2=[6, 16], c0_3=[9, 19], ... c1_0=[1, 11], c1_1=[4, 14], ... c1_2=[7, 17], c1_3=[10, 20,], ... c2_0=[2, 12], c2_1=[5, 15], ... c2_2=[8, 18], c2_3=[11, 21]) INFO: Inferred 2 dimensions when creating a Chebyshev2D model. Resetting param_dim to 2 [astropy.modeling.polynomial] - It is possible to change a single parameter:: >>> ch2.c0_0 Parameter('c0_0', value=array([ 0., 10.])) >>> ch2.c0_0[0] = -34.2 >>> ch2.c0_0 Parameter('c0_0', value=array([-34.2, 10. ])) - The number of parameter sets is stored in an attribute `~astropy.modeling.core.Model.param_dim`:: >>> ch2.param_dim 2 astropy-0.3/docs/modeling/models.rst0000644000175000017500000001550612243255342015751 0ustar oleole****************************** Creating and Evaluating Models ****************************** The base class of all models is `~astropy.modeling.core.Model`, however fittable models should subclass `~astropy.modeling.core.ParametricModel`. Parametric models can be linear or nonlinear in a regression analysis sense. Model instances are callabale, that is, o evaluate a model it is called like a function. When possible the transformation is done using multiple :attr:`param_sets `. The number of parameter sets is stored in an attribute `~astropy.modeling.core.Model.param_dim`. Parametric models also store a flat array of all parameter values. When fitting, this array is directly modified by a subclass of `~astropy.modeling.fitting.Fitter`, in turn updating all of the model's parameter values simultaneously. When fitting nonlinear models, the values of the parameters are used as initial guesses by the fitting class. Models have an `~astropy.modeling.core.Model.n_inputs` attribute, which shows how many coordinates the model expects as an input. All models expect coordinates as separate arguments. For example a 2D model expects x and y to be passed separately, e.g. as two arrays or two lists. When a model has multiple parameter sets and x, y are 2D arrays, the model is evaluated with each of the parameter sets and the same x, y as input. The shape of the output array is ``(param_dim, x_shape, y_shape)`` where param_dim is the number of parameter sets and ``x_shape, y_shape`` is the shape of the input array. In all other cases the shape of the output array is the same as the shape of the input arrays. Models also have an attribute `~astropy.modeling.core.Model.n_outputs`, which shows the number of output coordinates. The `~astropy.modeling.core.Model.n_inputs` and `~astropy.modeling.core.Model.n_outputs` attributes are used to chain transforms by adding models in :class:`series ` or in :class:`parallel `. Because composite models can be nested within other composite models, creating theoretically infinitely complex models, a mechanism to map input data to models is needed. In this case the input may be wrapped in a `~astropy.modeling.core.LabeledInput` object-- a dict-like object whose items are ``{label: data}`` pairs. Model examples -------------- The examples here assume this import statement was executed:: >>> from astropy.modeling import * >>> import numpy as np - Create a 1D Gaussian with 2 parameter sets:: >>> x = np.arange(1, 10, .1) >>> models.Gaussian1D.param_names ['amplitude', 'mean', 'stddev'] >>> g1 = models.Gaussian1D(amplitude=[10, 9], mean=[2, 3], ... stddev=[0.15, .1]) >>> g1.param_sets array([[ 10. , 9. ], [ 2. , 3. ], [ 0.15, 0.1 ]]) Evaluate the model on one data set:: >>> y = g1(x) >>> print(y.shape) (90, 2) or two data sets (any other number would be an error):: >>> y = g1(np.array([x, x]).T) >>> print(y.shape) (90, 2) .. plot:: import matplotlib.pyplot as plt import numpy as np from astropy.modeling import models, fitting x = np.arange(1, 10, .1) g1 = models.Gaussian1D(amplitude=[10, 9], mean=[2,3], stddev=[.15,.1]) y = g1(x) plt.plot(x, y) plt.title('Evaluate a Gaussian1D model with 2 parameter sets and 1 set of ' 'input data') plt.show() .. plot:: import matplotlib.pyplot as plt import numpy as np from astropy.modeling import models, fitting x = np.arange(1, 10, .1) g1 = models.Gaussian1D(amplitude=[10, 9], mean=[2,3], stddev=[.15,.1]) y = g1(np.array([x, x]).T) plt.plot(x, y) plt.title('Evaluating a Gaussian1D model with 2 parameter sets and 2 sets ' 'of input data') plt.show() - Evaluating polynomial models with multiple parameter sets with one input data set creates multiple output data sets:: >>> len(p1.parameters) # doctest: +SKIP 10 >>> p1.c1 = [0, 1, 2, 3, 4] # doctest: +SKIP >>> p1.param_sets # doctest: +SKIP array([[ 0., 0., 0., 0., 0.], [ 0., 1., 2., 3., 4.]]) >>> y = p1(x) # doctest: +SKIP .. plot:: import matplotlib.pyplot as plt import numpy as np from astropy.modeling import models, fitting x = np.arange(1, 10, .1) p1 = models.Polynomial1D(1, param_dim=5) p1.c1 = [0, 1, 2, 3, 4] y = p1(x) plt.plot(x, y) plt.title("Polynomial1D model with 5 parameter sets") plt.show() - When passed a 2D array, the same polynomial will map parameter sets to array columns:: >>> x = np.ones((10,5)) >>> y = p1(x) # doctest: +SKIP >>> print(y) # doctest: +SKIP array([[ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.], [ 0., 1., 2., 3., 4.]]) >>> print(y.shape) # doctest: +SKIP (10,5) - Create and evaluate a parallel composite model:: >>> x = np.arange(1,10,.1) >>> p1 = models.Polynomial1D(1) >>> g1 = models.Gaussian1D(amplitude=10., stddev=2.1, mean=4.2) >>> sum_of_models = SummedCompositeModel([g1, p1]) >>> y = sum_of_models(x) This is equivalent to applying the two models in parallel:: >>> y = x + g1(x) + p1(x) In more complex cases the input and output may be mapped to transformations:: >>> x, y = np.mgrid[:5, :5] >>> off = models.Shift(-3.2) >>> poly2 = models.Polynomial2D(2) >>> serial_composite_model = SerialCompositeModel( ... [off, poly2], inmap=[['x'], ['x', 'y']], outmap=[['x'], ['z']]) The above composite transform will apply an inplace shift to x, followed by a 2D polynomial and will save the result in an array, labeled 'z'. To evaluate this model use a `~astropy.modeling.core.LabeledInput` object:: >>> labeled_data = LabeledInput([x, y], ['x', 'y']) >>> result = serial_composite_model(labeled_data) The output is also a `~astropy.modeling.core.LabeledInput` object and the result is stored in label 'z':: >>> print(result) # doctest: +SKIP {'x': array([[-3.2, -3.2, -3.2, -3.2, -3.2], [-2.2, -2.2, -2.2, -2.2, -2.2], [-1.2, -1.2, -1.2, -1.2, -1.2], [-0.2, -0.2, -0.2, -0.2, -0.2], [ 0.8, 0.8, 0.8, 0.8, 0.8]]), 'y': array([[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]), 'z': array([[ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.]])} astropy-0.3/docs/modeling/algorithms.rst0000644000175000017500000000417612243255342016640 0ustar oleole********** Algorithms ********** Univariate polynomial evaluation ================================ * The evaluation of 1D polynomials uses Horner's algorithm. * The evaluation of 1D Chebyshev and Legendre polynomials uses Clenshaw's algorithm. Multivariate polynomial evaluation ================================== * Multivariate Polynomials are evaluated following the algorithm in [1]_ . The algorithm uses the following notation: - **multiindex** is a tuple of non-negative integers for which the length is defined in the following way: .. math:: \alpha = (\alpha1, \alpha2, \alpha3), |\alpha| = \alpha1+\alpha2+\alpha3 - **inverse lexical order** is the ordering of monomials in such a way that :math:`{x^a < x^b}` if and only if there exists :math:`{1 \le i \le n}` such that :math:`{a_n = b_n, \dots, a_{i+1} = b_{i+1}, a_i < b_i}`. In this ordering :math:`y^2 > x^2*y` and :math:`x*y > y` - **Multivariate Horner scheme** uses d+1 variables :math:`r_0, ...,r_d` to store intermediate results, where *d* denotes the number of variables. Algorithm: 1. Set *di* to the max number of variables (2 for a 2D polynomial). 2. Set :math:`r_0` to :math:`c_{\alpha(0)}`, where c is a list of coeeficients for each multiindex in inverse lexical order. 3. For each monomial, n, in the polynomial: - determine :math:`k = max \{1 \leq j \leq di: \alpha(n)_j \neq \alpha(n-1)_j\}` - Set :math:`r_k := l_k(x)* (r_0 + r_1 + \dots + r_k)` - Set :math:`r_0 = c_{\alpha(n)}, r_1 = \dots r_{k-1} = 0.` 4. return :math:`r_0 + \dots + r_{di}` * The evaluation of multivariate Chebyshev and Legendre polynomials uses a variation of the above Horner's scheme, in which every Legendre or Chebyshev function is considered a separate variable. In this case the length of the :math:`\alpha` indices tuple is equal to the number of functions in x plus the number of functions in y. In addition the Chebyshev and Legendre functions are cached for efficiency. .. [1] J. M. Pena, Thomas Sauer, "On the Multivariate Horner Scheme", SIAM Journal on Numerical Analysis, Vol 37, No. 4 astropy-0.3/docs/modeling/index.rst0000644000175000017500000001413512243255342015572 0ustar oleole.. _astropy-modeling: *************************************** Models And Fitting (`astropy.modeling`) *************************************** Introduction ============ `~astropy.modeling` provides a framework for representing models and performing model evaluation and fitting. It supports 1D and 2D models and fitting with parameter constraints. It is :ref:`designed ` to be easily extensible and flexible. Models do not reference fitting algorithms explicitly (though exceptions are sometimes necessary) and new fitting algorithms may be added without changing the existing models. In addition models can be combined in different ways using a machinery that allows assigning outputs from one model into the appropriate input of another in a flexible way, `~astropy.modeling.core.LabeledInput`. The goal is to eventually provide a rich toolset of models and fitters such that most users will not need to define new model classes, nor special purpose fitting routines (but not making that hard to do if it is necessary). .. warning:: `~astropy.modeling` is currently a work-in-progress, and thus it is likely there will be significant API changes in later versions of Astropy. If you have specific ideas for how it might be improved, feel free to let us know on the `astropy-dev mailing list`_ or at http://feedback.astropy.org Getting started =============== The examples here use the predefined models and assume the following modules have been imported:: >>> import numpy as np >>> from astropy.modeling import models, fitting Using Models ------------ The `astropy.modeling` package defines a number of models that live inside `astropy.modeling.models` and behave like parametrized functions:: >>> from astropy.modeling import models >>> g = models.Gaussian1D(amplitude=1.2, mean=0.9, stddev=0.5) >>> print(g) Model: Gaussian1DModel n_inputs: 1 Degree: N/A Parameter sets: 1 Parameters: amplitude: Parameter('amplitude', value=1.2) mean: Parameter('mean', value=0.9000...) stddev: Parameter('stddev', value=0.5) Model parameters can be accessed as attributes: >>> g.amplitude Parameter('amplitude', value=1.2) >>> g.mean Parameter('mean', value=0.9000...) >>> g.stddev Parameter('stddev', value=0.5) and can also be set using the attributes:: >>> g.amplitude = 0.8 >>> g.amplitude Parameter('amplitude', value=0.8000...) Models can be evaluated by calling them as functions:: >>> g(0.1) 0.22242984036255528 >>> g(np.linspace(0.5, 1.5, 7)) array([ 0.58091923, 0.71746405, 0.7929204 , 0.78415894, 0.69394278, 0.54952605, 0.3894018 ]) Models can therefore already be useful to evaluate common functions, independent of the fitting part of the package. Simple 1D model fitting ----------------------- In this section, we look at a simple example of fitting a Gaussian to a simulated dataset. We use the :class:`~astropy.modeling.functional_models.Gaussian1D` and :class:`~astropy.modeling.functional_models.Trapezoid1D` models and the :class:`~astropy.modeling.fitting.NonLinearLSQFitter` fitter to fit the data: .. plot:: :include-source: import numpy as np from astropy.modeling import models, fitting # Generate fake data np.random.seed(0) x = np.linspace(-5., 5., 200) y = 3 * np.exp(-0.5 * (x - 1.3)**2 / 0.8**2) y += np.random.normal(0., 0.2, x.shape) # Fit the data using a box model t_init = models.Trapezoid1D(amplitude=1., x_0=0., width=1., slope=0.5) f1 = fitting.NonLinearLSQFitter() t = f1(t_init, x, y) # Fit the data using a Gaussian g_init = models.Gaussian1D(amplitude=1., mean=0, stddev=1.) f2 = fitting.NonLinearLSQFitter() g = f2(g_init, x, y) # Plot the data with the best-fit model plt.figure(figsize=(8,5)) plt.plot(x, y, 'ko') plt.plot(x, t(x), 'b-', lw=2, label='Trapezoid') plt.plot(x, g(x), 'r-', lw=2, label='Gaussian') plt.xlabel('Position') plt.ylabel('Flux') plt.legend(loc=2) As shown above, once instantiated, the fitter class can be used as a function that takes the initial model (``t_init`` or ``g_init``) and the data values (``x`` and ``y``), and returns a fitted model (``t`` or ``g``). Simple 2D model fitting ----------------------- Similarly to the 1-d example, we can create a simulated 2-d data dataset, and fit a polynomial model to it. This could be used for example to fit the background in an image. .. plot:: :include-source: import numpy as np from astropy.modeling import models, fitting # Generate fake data np.random.seed(0) x, y = np.mgrid[:128, :128] z = 2. * x ** 2 - 0.5 * x ** 2 + 1.5 * x * y - 1. z += np.random.normal(0., 0.1, z.shape) * 50000. # Fit the data using astropy.modeling p_init = models.Polynomial2D(degree=2) f = fitting.NonLinearLSQFitter() p = f(p_init, x, y, z) # Plot the data with the best-fit model plt.figure(figsize=(8,2.5)) plt.subplot(1,3,1) plt.imshow(z, interpolation='nearest', vmin=-1e4, vmax=5e4) plt.title("Data") plt.subplot(1,3,2) plt.imshow(p(x, y), interpolation='nearest', vmin=-1e4, vmax=5e4) plt.title("Model") plt.subplot(1,3,3) plt.imshow(z - p(x, y), interpolation='nearest', vmin=-1e4, vmax=5e4) plt.title("Residual") A list of models is provided in the `Reference/API`_ section. The fitting framework includes many useful features that are not demonstrated here, such as weighting of datapoints, fixing or linking parameters, and placing lower or upper limits on parameters. For more information on these, take a look at the :doc:`fitting` documentation. Using `modeling` ================ .. toctree:: :maxdepth: 1 parameters models fitting new algorithms design Reference/API ============= .. automodapi:: astropy.modeling .. automodapi:: astropy.modeling.fitting .. automodapi:: astropy.modeling.functional_models .. automodapi:: astropy.modeling.powerlaws .. automodapi:: astropy.modeling.polynomial .. automodapi:: astropy.modeling.projections .. automodapi:: astropy.modeling.rotations astropy-0.3/docs/modeling/new.rst0000644000175000017500000002256412243255342015261 0ustar oleole************************** Defining New Model Classes ************************** This document describes how to add a model to the package or to create a user-defined model. In short, one needs to define all model parameters and write an eval function which evaluates the model. If the model is fittable, a function to compute the derivatives is required if a linear fitting algorithm is to be used and optional if a non-linear fitter is to be used. Custom 1D models ---------------- For 1D models, the `~astropy.modeling.functional_models.custom_model_1d` decorator is provided to make it very easy to define new models. The following example demonstrates how to set up a model consisting of two Gaussians: .. plot:: :include-source: import numpy as np from astropy.modeling.models import custom_model_1d from astropy.modeling.fitting import NonLinearLSQFitter # Define model @custom_model_1d def sum_of_gaussians(x, amplitude1=1., mean1=-1., sigma1=1., amplitude2=1., mean2=1., sigma2=1.): return (amplitude1 * np.exp(-0.5 * ((x - mean1) / sigma1)**2) + amplitude2 * np.exp(-0.5 * ((x - mean2) / sigma2)**2)) # Generate fake data np.random.seed(0) x = np.linspace(-5., 5., 200) m_ref = sum_of_gaussians(amplitude1=2., mean1=-0.5, sigma1=0.4, amplitude2=0.5, mean2=2., sigma2=1.0) y = m_ref(x) + np.random.normal(0., 0.1, x.shape) # Fit model to data m_init = sum_of_gaussians() fit = NonLinearLSQFitter() m = fit(m_init, x, y) # Plot the data and the best fit plt.plot(x, y, 'o', color='k') plt.plot(x, m(x), color='r', lw=2) A step by step definition of a 1D Gaussian model ------------------------------------------------ The example described in `Custom 1D models`_ can be used for most 1D cases, but the following section described how to construct model classes in general. The details are explained below with a 1D Gaussian model as an example. There are two base classes for models. If the model is fittable, it should inherit from `~astropy.modeling.core.ParametricModel`; if not it should subclass `~astropy.modeling.core.Model`. If the model takes parameters they should be specified as class attributes in the model's class definition using the `~astropy.modeling.parameters.Parameter` descriptor. The first argument for defining the parameter must be a unique ( to that model) name of the parameter, and it must be identical to the class attribute being assigned that parameter. Subsequent arguments are optional, and may include a default value for that parameter as well default constraints and custom getters/setters for the parameter value. .. note:: If the method which evaluates the model cannot work with multiple parameter sets, `~astropy.modeling.core.Model.param_dim` should not be given as an argument in the ``__init__`` method. The default for `~astropy.modeling.core.Model.param_dim` is set in the base class to 1. :: from astropy.modeling import * class Gaussian1DModel(ParametricModel): amplitude = Parameter('amplitude') mean = Parameter('mean') stddev = Parameter('stddev') At a minimum, the ``__init__`` method takes all parameters and the number of parameter sets, `~astropy.modeling.core.Model.param_dim`:: def __init__(self, amplitude, mean, stddev, param_dim=1, **constraints): # Note that this __init__ does nothing different from the base class's # __init__. The main point of defining it is so that the function # signature is more informative. super(Gaussian1DModel, self).__init__( amplitude=amplitude, mean=mean, stddev=stddev, param_dim=param_dim, **constraints) .. note:: If a parameter is defined with a default value you may make the argument for that parameter in the ``__init__`` optional. Otherwise it is recommended to make it a required argument. In the above example none of the parameters have default values. Parametric models can be linear or nonlinear in a regression sense. The default value of the `~astropy.modeling.core.Model.linear` attribute is ``True``. Nonlinear models should define the ``linear`` class attribute as ``False``. The `~astropy.modeling.core.Model.n_inputs` attribute stores the number of input variables the model expects. The `~astropy.modeling.core.Model.n_outputs` attribute stores the number of output variables returned after evaluating the model. These two attributes are used with composite models. Next, provide a `staticmethod`, called ``eval`` to evaluate the model and a `staticmethod`, called ``deriv``, to compute its derivatives. The evaluation method takes all input coordinates as separate arguments and a parameter set. For this example:: @staticmethod def eval(x, amplitude, mean, stddev): return amplitude * np.exp((-(1 / (2. * stddev**2)) * (x - mean)**2)) The ``deriv`` method takes as input all coordinates as separate arguments. There is an option to compute numerical derivatives for nonlinear models in which case the ``deriv`` method should be ``None``:: @staticmethod def deriv(x, ampltidue, mean, stddev): d_amplitude = np.exp((-(1 / (stddev**2)) * (x - mean)**2)) d_mean = (2 * amplitude * np.exp((-(1 / (stddev**2)) * (x - mean)**2)) * (x - mean) / (stddev**2)) d_stddev = (2 * amplitude * np.exp((-(1 / (stddev**2)) * (x - mean)**2)) * ((x - mean)**2) / (stddev**3)) return [d_amplitude, d_mean, d_stddev] .. note:: It's not strictly required that these be staticmethods if the ``eval`` or ``deriv`` functions somehow depend on an attribute of the model class or instance. But in most cases they simple functions for evaluating the model with the given inputs and parameters. Finally, the ``__call__`` method takes input coordinates as separate arguments. It reformats them (if necessary) using the `~astropy.modeling.core.format_input` wrapper/decorator and calls the eval method to perform the model evaluation using ``model.param_sets`` as parameters. The reason there is a separate eval method is to allow fitters to call the eval method with different parameters which is necessary for fitting with constraints.:: @format_input def __call__(self, x): return self.eval(x, *self.param_sets) A full example of a LineModel ----------------------------- :: from astropy.modeling import models, Parameter, format_input import numpy as np class LineModel(models.PolynomialModel): slope = Parameter('slope') intercept = Parameter('intercept') linear = True def __init__(self, slope, intercept, param_dim=1, **constraints): super(LineModel, self).__init__(slope=slope, intercept=intercept, param_dim=param_dim, **constraints) self.domain = [-1, 1] self.window = [-1, 1] self._order = 2 @staticmethod def eval(x, slope, intercept): return slope * x + intercept @staticmethod def deriv(x, slope, intercept): d_slope = x d_intercept = np.ones_like(x) return [d_slope, d_intercept] @format_input def __call__(self, x): return self.eval(x, *self.param_sets) *************************** Defining New Fitter Classes *************************** This section describes how to add a new nonlinear fitting algorithm to this package or write a user-defined fitter. In short, one needs to define an error function and a ``__call__`` method and define the types of constraints which work with this fitter (if any). The details are described below using scipy's SLSQP algorithm as an example. The base class for all fitters is `~astropy.modeling.fitting.Fitter`:: class SLSQPFitter(Fitter): supported_constraints = ['bounds', 'eqcons', 'ineqcons', 'fixed', 'tied'] def __init__(self): super(SLSQPFitter,self).__init__() All fitters take a model (their ``__call__`` method modifies the model's parameters) as their first argument. Next, the error function takes a list of parameters returned by an iteration of the fitting algorithm and input coordinates, evaluates the model with them and returns some type of a measure for the fit. In the example the sum of the squared residuals is used as a measure of fitting.:: def errorfunc(self, fps, *args): model = args[0] meas = args[-1] model.fitparams(fps) res = self.model(*args[1:-1]) - meas return np.sum(res**2) The ``__call__`` method performs the fitting. As a minimum it takes all coordinates as separate arguments. Additional arguments are passed as necessary.:: def __call__(self, model, x, y , maxiter=MAXITER, epsilon=EPS): if model.linear: raise ModelLinearityException( 'Model is linear in parameters; ' 'non-linear fitting methods should not be used.') model_copy = model.copy() init_values, _ = model_copy._model_to_fit_params() self.fitparams = optimize.fmin_slsqp(self.errorfunc, p0=init_values, args=(y, x), bounds=self.bounds, eqcons=self.eqcons, ineqcons=self.ineqcons) return model_copy astropy-0.3/docs/_templates/0000755000175000017500000000000012243263747014274 5ustar oleoleastropy-0.3/docs/_templates/autosummary/0000755000175000017500000000000012243263747016662 5ustar oleoleastropy-0.3/docs/_templates/autosummary/base.rst0000644000175000017500000000005212243255342020313 0ustar oleole{% extends "autosummary_core/base.rst" %} astropy-0.3/docs/_templates/autosummary/module.rst0000644000175000017500000000005412243255342020670 0ustar oleole{% extends "autosummary_core/module.rst" %} astropy-0.3/docs/_templates/autosummary/class.rst0000644000175000017500000000005312243255342020507 0ustar oleole{% extends "autosummary_core/class.rst" %} astropy-0.3/docs/stability.rst0000644000175000017500000002006312243255342014666 0ustar oleole****************************** Current status of sub-packages ****************************** Astropy has benefited from the addition of widely tested legacy code, as well as new development, resulting in variations in stability across sub-packages. This document summarizes the current status of the Astropy sub-packages, so that users understand where they might expect changes in future, and which sub-packages they can safely use for production code. Note that until version 1.0, even sub-packages considered *Mature* could undergo some user interface changes as we work to integrate the packages better. Thus, we cannot guarantee complete backward-compatibility between versions at this stage. .. |planned| image:: _static/planned.png .. |dev| image:: _static/dev.png .. |stable| image:: _static/stable.png .. |mature| image:: _static/mature.png The classification is as follows: .. raw:: html
Planned
Actively developed, be prepared for possible significant changes
Reasonably stable, no major changes likely
Mature
The current planned and existing sub-packages are: .. raw:: html
Sub-Package   Comments
astropy.constants dev Constants have been changed to Quantity objects in v0.2.
astropy.convolution dev New top-level package in v0.3 (was previously part of astropy.nddata). Includes a new framework for kernels in v0.3.
astropy.coordinates dev New in v0.2, significant API changes in v0.3
astropy.cosmology stable Incremental improvements since v0.1, but mostly stable API.
astropy.io.ascii mature Originally developed as asciitable, and has maintained a stable API.
astropy.io.fits mature Originally developed as pyfits, and retains an API consistent with the standalone version.
astropy.io.misc mature The functionality that is currently present is stable, but this sub-package will likely see major additions in future.
astropy.io.votable mature Originally developed as vo.table, and has a stable API.
astropy.modeling dev New in v0.3
astropy.nddata dev In development, and does not yet contain much functionality apart from a base class for N-dimensional datasets.
astropy.photometry planned  
astropy.stats dev Still in development, and does not yet contain much functionality.
astropy.table stable Incremental improvements since v0.1, but mostly stable API.
astropy.time stable Incremental improvements since v0.1, but mostly stable API.
astropy.units stable New in v0.2. Adapted from pnbody and integrated into Astropy.
astropy.utils dev This sub-package contains mostly utilities destined for use in other parts of Astropy, and is not yet stable.
astropy.vo dev Virtual Observatory service access and validation. Currently, only Simple Cone Search is supported.
astropy.wcs stable Originally developed as pywcs, and has a stable API for now. However, there are plans to generalize the WCS interface to accommodate non-FITS WCS transformations, and this may lead to small changes in the user interface.
astropy-0.3/docs/time/0000755000175000017500000000000012243263747013075 5ustar oleoleastropy-0.3/docs/time/time_scale_conversion.odg0000644000175000017500000002451212243255342020136 0ustar oleolePK/ŒAŸ.Ä++mimetypeapplication/vnd.oasis.opendocument.graphicsPK/ŒA content.xmlí\ëŽÛ¸þß§0´-°»…î’oÈÌ ›E‹“¢ØÌiÿ‰²ÙH¢–¢Çö¾Dÿ,°oÕ‡è“ôºX²¬Ë$žÌÄP-žsÈsãwxòêf…“ÌRBã+ÅÔ e‚cú$^])?ßýE+7×xEƒ€xxéSoᘫ9|O@:N—õJÙ°xIQJÒeŒ"œ.¹·¤ Ž ©e•{)ÇÊZR¾‹Kæª4Ç;>TXðÖdÑýð‘%sUÚgh;TXð‚S«â*¼KC5 àõ(Aœi± IüñJYsž,u}»Ýj[[£l¥›‹ÅB—ÔRa¯äK6,”\¾§ã‹ÁRÝÔL½à0GCõ¼U•âMtÙ`× ŽQMN̉9¬£ªL-¿Vƒ³ëaÕâfoØà<“ÌõT±ýá©bûUÙñuK|çú[ Ê?ooyÅ¢¡c Þš«S?ˆ”/'‘pDÚ"`é¹dNý֮߿½}ç­q„̤ŸY%qÊQ|ðL‘pp€·%iQL§‚àmL&’¡Õã®ÎpB/ /0ŠUúhÍ£°Âµ`]1ß?É êØ:À€‰ú@ðö¥Vºsq”˜êûD$Sµt ˜†.xÊIJpX BÉš» ï̈ð EÒ«Q &ËŠt§\²RÃÁ­ÒKKÎPœŠÌÍQ4W B‘j2DªZê—õr= ¹NýÀb~ Áƒr]”ÿlº§zÙ€6œŠÎ=Uâwzý*Ãqùw’ý&])~b*yC€ _÷ДUD5A+¬èí¢+Ö]1”¬‰W4'ˆ‰E‰|P3!1›|Ä|¥è7Qp"fœàtXÃ1ú«[â Œ54Ã5½H™ÝwÙGÌ [Àò‡=op@vŸ¦Óy„ƒÂ®ñ§¼I¬@@]¤®)#¿Rb…dáù÷&å$Ø3>u½[D ¶8çPWŒnÕ5&«5LÖ…)P nñÅ:Nå4Š™®Ð«Ò~O9 y‚†‚5;¦°l”’$µH×ÈjæBDõJH»âk=|¯”wû–1Œx,ãÃk.íNûDô÷RO•CiááXÖÀaYñ…âþˆèÚÏÝO›½ E] )¬d¿ Ï[,.?ZÎÓD+ƒ ®+%¦1Ø^ `ádCþ«¸¿à=ñ¯?ÂG­XÉÙ¦ ¤y.d4ðiDâRÀÈý,ÚŠœyœÝ—?FkÄí%Ä É8”Q)[ªq±…±G^>n£4~Œ¤ÕÙ*ÒŽü £šNÂËq‹fŒ(n#ŠíGˆw9y¸}âд¯M×m>'ïiè×Ê…¾mäRcÉ0\ã@׸xC7ŒˆÉPÑ*£©+ÃÒv¹õ1‹k, á̸€ì°¯œ Y¯k:Ùã·q>£[¸ø´‰þ䡸³ç®JÂÜÞ4üâj6@lšókFPXW¦R«Mˆº˜nIšö†)—Ê=Ð5jÁÓ?vÁ™k0ÔÛy'¥¿;•)¹¨Sò¶(ô©nÀø£"ü“Ðz<ZŸ…‡-Ò=x(/$B’æ­yõÖTª !~ÀaøûMb>Ɉ¢P²ÇŒ¤Šè+å¿ÿ§ŒB¥“C,å;X°Á²¬(¬Ü¤b­‹¿äÌWæåº¹ ÇÍκŒy„©Ö'™šÉ¤ ò SP†ÅBp*Vˆ’"Öô!º™ri;ÍÖˆ_Ÿ‡ì³yÈÔ¬‹ôsFÍ/ÒCîÙ7Á|r+¿“Êǫ̈[øm¾Ï¿Ómù{.LáˆMþ^$ þe#ïè«ù”!”E°±³BLŠvóXàÆäû”ÄßÞðãÛ„èæÜøî»îN¬ãN@ÛÉ÷¶9µõÙÔžv ÛÇÂâ(þÏ75é–sŽå8Mˆ¹Çbò|_íœ f· $g'-Gw‹ÍOØ+µhQ³WÐläN晪 d·æ°”ýVš’ìU` •5ÝŠì×îÍrƒù„Õ UƒDq-ÓBG»ŒžÍ^ñ§q£ T!4W<$ñI4µ>Mw¦ÀEÓqKœ” s£lØY¢0ÎæëÀQ`iiˆPî… ]é³Áÿ›þGøá„ÿg‚ÿç†Õ¹æXg‡Õ»×au„ÕVGX½”UõL³f‹ê:~%‹js¦Íí³£ÿ›FôÑDÿý/ýÍ©6uªÔ¡ôkÁS3Y¥¸ši¹g¨+ÀXÆ 0V€‹©¦6s­jp`­lÖ*°Ô·Çhú"K(¹8ûàÇq 0€±Œ๠À³Ãª©Óó¬ß°:Âê«#¬^ʺz¡-Ìîs•:=X!Ì OjjðÛÖ1îWÛvGúïoã|î[Êõ«á~ï[-§«„^qÍ“í“,Íí9(«m8^zÇ%ã²$Ÿta—¨M™ÌépÊPÔ†uÍ“¤—Ô™ú> x½‚7OÜN58îó=GЩõ.ÍdçÞ£aà+שëUãmÖBrTuš©Ÿ؉‰ÆÔSÕ4O ù¥Ï’4âI:î˦<šªøò…Ú–ÂÜÑÿWG³t_sÎ@!È1 …دìvéNàD3 Ì:$‰<„5/TkY|výÁç]osȼœÄ¢àCýpMNˆ()Úz{lÎa8 yít¸x6%ÔoXÎ]+bÒt‚STÑúà˜µATl—2#±Ûð–ˆ#½æ•Àä’ÀµÁT1öP%™(‘º>3Êh™!·f+«"–•>!oä¥+H^*O0t(pØ[qŒ  e¦l(*{@Íõr–Àã)÷äª!¥ .1¤H° u¡ÑOQŠè‹OЍÀ­ àx`++ à›Õ²+»¬­öà°§7eP"%¯À’”F%¿¼#ÐÎ[¼qþf9*ÌbÇÃï­qÁð¥Ë_‡£$2†êqƒ81áÓl%Èg%š•R¯QT¬+´†%\è…˜U…ä Ëûë¾-!:PÑ(úN÷‹#v®®ïÔ´[!q~¨pCß©mq(Í£íµ ísÖPj[ÂooûTSbˆˆw(iß²êßr [вôÚÐR3²oEKúó­»óÈNP6®hG¨IB¢"AÕmÒe‡‚÷ˆ¸¢ö §„ÒÖ‚v¥Õt>ã4ÕAP¢DuB¿Ú!Œ.ÔaŤT>Å©T”'ëÌ¢\3”èËIÖ¢ÕE`éÝvì·½ÄƤË@ýƒÃÕ %¢›¼÷\Ãf£pO¢†Ù[U”bé¢Z‡bꚆä©{ïÒýïßZ?²²s%(UîçÁkp(_+FÝSÒ¨Ém³‹§:>Žs‚©Ñ™jdt…óVîXÔ3uPš’“£h2­+â‰ÐôlÁ5ëQ"4;#B—¡‹³!Mf¡ggChú(ñy~>|iž¾<B³Gš§çgDèqæé08D?V¢¶Èu¯åµLG‡ °7ô)ke°iê.¡^lš„îªiDºkmR/ëQF†|OõªFŽèa‡aÄtn– «¤Ú°í°,’VDfœUëÌ«¿ä)XÑ3ïЄóN6ÂËz²aÖšÝy®6jðhº.£•¥z@q3êÓ{S£Û<¯öx,¡×ô õ,ôÉÆªgvrMòëªøSƒ…MÔ]S»FXöaØŸ™˜‰Ï›*& r®Q!îwˆ2`bK6r€E»ÎË ²]D‹sL N{|‡Ýô¹NCS»ø²æ9wÌqØê#Žå†HÈ»f¨Û;Îif¨ˆ·ßÚzÝþ×N|&áÅ©CŸv~dôüø8ÈD×ÑiРi2Â}ÂY§œ"ˆvé{™ô|åÈÕìM7s7£õSó œÛÄèWi¹bÉö!5=~Aª‹â3È’'[õ±àxpfüí¬ºH™¯’(YCµRÚ’t{º™ærôýyÂm±{Ùk®Ð#á Òª´ß©#Ïf'9²2)|›¿dLž>±&DÇjÂñ°&Œ"SeÇGtúqD÷s}ד`÷5Kç Ò4Žçóïë Æ¹Ùe¿)œ„maKè9ßÓ:Ãî¡OO*&F‰ºô>|f¹úÍY4gŽÇè´Àh0zTõp u[õ¦·^1šœÝ=¥•ïºYÏ”ƒHòøkÍ1ÿñjÉS›Äh¿I„&°W®ÓF‚Ð9Q‘AÖ® "ësìAD}îï½VT/=©wÎb¯!4`®±GÑZ±ÎQüu¸=\ò–~ÿ_¼üPK®`0&µ0PK/ŒAȳIòòmeta.xml Tom Aldcroft2012-07-27T12:52:062012-08-20T13:33:31Tom AldcroftPT14M36S4OpenOffice.org/3.3$Unix OpenOffice.org_project/330m20$Build-9567PK/ŒAThumbnails/thumbnail.pngí•ÿSű›}±‹Û®¥+—ô•¶ŠtÓû‚+4ãTd„ºB~IKSR EDÏåe©Xa¨L…HE‰cf6¿¡•Z&ZŠ¢ 8ÓLT$D eþ Û»ýôÞ}îÝûíÝ»…BúmqØá¶ Îù ×´°l\·æb¼¹NÀúP„ÏiLJ©^õŠ¥ÀºÆ=v~ªPíj¼:N@8i`‚xº™íŸØéŸùKt^Ö:8cšÛc†T¦¦V!2½ñ<~tÞl?‰?ññ‹áˆ¯Àß?Ýç[,ØXðu8kO: ‘ãöáp;ë­þÚ Óÿ³-í Õ¾p?uñÉòª`ùco‚UÙ©¬Âv¯x[ômðtÆz¶Ú.‚"ANcb.m¦O–»AæÈSq¿ùÐ ["AÖ™Û–Wý³ŽÍ•1Qo z•XºæóÈ‹—lsÎ['òp…˜Á¥÷mñg¶zdÇÈë‘Û\ÈÅŠOצw{—qM­5¡—m=AÊÞfôªVÃȈ(í?!é ù«}­¶(À+¦Uë.'•âHÈÛî ¿¢M­ Ãøs1n¥|vtQ;0nQ?©W\_QkeCÞú¹€ú¾<Øs•vü”‘Φ Ã4.š~® jºdbjÔÕ©±ú”÷:nk¶ªi@cÖ0ñÒš£òÂâ’5ñF-2h=àÅãïwSýÎÌ·m†ìÒòä4LK‰<,¡¬áìãÁã½Òòr)ÕÖÏOmy^ôA<¬uú>ó8`é·8^?p£5QÄÖÇǽN¼¥+ éÛ!a™sü£ƈåzl™²û<\oE0AÓƒ Š>Jß¼„7µþi,L@£OSÔºêä\xò± 7r4ŒòáæKߪGÎØÌ©œçTÀÔ ²]6PlôŠAËKK\wÍžÈ&œý˜?Ô,3µÅî{*›:æ F¢;rÞ nruÕéêF ¡<îÌÒÔ$^Á]<(™cT'‘üDEJÝhjvå{VmÛ;A÷ë.ó'qu²ß;\³—ˆ`«ŸQÜc`^HËæ’òãŸ5Mïêž;îu'b¨¥rKýÝl³K%|Ãt7ÄeºŸÉ‹½ÀüŪ¨–Ð>"sÕŒ¥F +Èí¯œcÞ€®¯%t(8pa;±>´Ä’7ÃËì˜ ¹ÿþÈ™½3öƒ æãD^}‘‹ i5ÈìJð™Ïˆª¤—ñfˆ/±éR)×!”ú°¹×»’‚M£Ô¥aB‘¾,=š¥ˆ¸TÊÑGãå ÁÙ³g$)æî›ù/zN5½>ä6Y±/tßÄ>¾µ¨$}— Ëò~ë;Os7&5mûyy7yRkš!øQKµA± {øNE’ThÈ•x¯¡¸K.ªwj´õqxrGNyílðIƒÜr½Š0‰»Ÿ(&ÏÛ?Ù{Ì"Œ€U¿cý¢´O¾•‰LUÉ­’¼Ë½é&®t–Œ&3òÉlà’ÔÐ ;× sb0šoÝ ]¢|îäH„²°‡SU`ÄìÉ#ñGÈçþÅÔÿ‡ÿ=h['ÖmZ7&Ùtríi_¤ÏÃ3~ûPK«ÛÌžPK/ŒA'Configurations2/accelerator/current.xmlPKPK/ŒAConfigurations2/progressbar/PK/ŒAConfigurations2/floater/PK/ŒAConfigurations2/popupmenu/PK/ŒAConfigurations2/toolpanel/PK/ŒAConfigurations2/menubar/PK/ŒAConfigurations2/toolbar/PK/ŒAConfigurations2/images/Bitmaps/PK/ŒAConfigurations2/statusbar/PK/ŒA settings.xmlÝZßsâ6~ï_‘ñô¡} ’\¸æH¸ëõMØ‹Q#KI`dL†›82êtš‡dbKß·Ú]í/¸þü’“à3Úrj§Uç¨Ç|Lƒ–3ô+WÎçö/×l>Ç4}æÅ!PY ¥Z"NÔv*šë×-'æ´ÉÀ¢IQ¢)½&‹€n¶5·W7²õ“W‚ésËYH5]w¹\ž.ÏNÜZ£Ñp“·›¥¡ L.F¸½g›ÖctŽƒ¢(ëÕÛûcoBë ëƒ%‚׫Õswýÿfµ1)Ê¥×V<FJæùIWˆâ°(Œ^»wêµT‡eoìÈîs´<¸£Vuõç$5î–KÕöÆ6nÓ¾N•¹þSÁBíS'éc}¦–£›/–oÞædíûyÏ7,´Â:ЄEÎæ¥\Eê%¦ÒiW.ëõkwçCØC˜ËLð³z­4øwìËEz­qU?/ 8XdJuqÖ( _ QTÁÔ‡Wðw©`™mªdòN¾*"0,þŽ”BråN[{…¡žÿàØˆT;ð3Æ ê´%¡ |Ÿ3º«á7ð9"Â} ÆE¦YŽ/û}„¸G<ÀTØ#Ñ¿‡˜B.ÅÔô8û<Ùçê¡u–SWÈÎaF$wˆúD‡,Ñê=ï-E–h놣`¬nÉ7¹ÜbŠ$ŒY%jª²£é2£ÞEµjzš}.&Jí1D+•õvñ‘€Oç]%_9m·ðÏUËL–‘ŠýW¤2ïü÷Eq߇z`©Âÿ̆X¶/bygŠ p‹ùFÇê/* ï&ÊãêêÞ›1ÑÀ×àGˆÄî™oAÑÅA'­„Æ+ööž'ð*o}œ›ãËœ"!è- à‰­› ÇìƒbËlVšZ-ÚÀc©Lø®g&!ÝÐ}6ÐLî™ø¸ÚyXœY—¯êÿŸíÈ…ÕväÜРº>î1Ää vV;_òRà}Uçëü“¡Æ7ÈùB—‚Ö¥p"ôŸqIÆ-rÜeI]—ÃrŽÿÂ9~Ø9Ç@$µ´¦¹¥ºÌíËä…n¡dÿ‹±ð‘fEdÎx¸=rÈ{N1²ŧUë1O’öGÆV("«©~ƒ$:~QÑÅRt¢}aú4̪üú[¬ø=%pEš¿O›™±ª†#UGò õV'Šò¨%eR¸ŸÌ3#½AbaÌérÂÅD*Ú±Ì.%jõËÂJÌßõŸaßúf¾òü¡*fãŒf"ÕPSÛÇš?u:6¬MÇho|—¢hT»`ªG[Æ·Ô?¸¿lœ{?I!+0cÌ4‡¤g~¯¦Ùò pÚÊæ£˜z2¶Õq D2›é2öLÀÎtx› ‹¼gíé6ÇÁ9wi• íÌ8ô>–†eFA‚»$Šj+cô„C£?Øo' LÀ®ž&ØŠü:‚ª@jNLiòŸùŒ’ÝÄtŒSÝ1‡)Ý›=¥eÔ¥ùQu<3à*ÿ‡(³A4Tp-ÆqÚ ®‰'}ÁrWíe&C ,ðÊœúÓu•‡hµ?"ÚxaËŠ*t‰õ1KQfÜêâDŠ1ïVŠ»Ñ |[˜ÿH{„ wuì!všáúp/o<|•ŸT 'Fä@®Êò¹ §»÷… 7ï+8íPKÚåG›Ä#PK/ŒAMETA-INF/manifest.xmlµ•Ánà †ï}Šˆ{ÂÖÓ5´I{‚î\â¤H`˜ª}û%ÕÚf[kn€Ì÷ÿŒW¯kŠ=†¨5â¹z’r­¦¾Ÿ›òE¼®+ ¤;Œ\ŸŰâeÚˆ¨vu¬ ,ÆšUí2­øòó¯äŸN¼þPK† Ë÷PÄPK/ŒAŸ.Ä++mimetypePK/ŒA4j‰&$ ¨T Qcontent.xmlPK/ŒA®`0&µ0 ® styles.xmlPK/ŒAȳIòò meta.xmlPK/ŒA«ÛÌž$Thumbnails/thumbnail.pngPK/ŒA'Configurations2/accelerator/current.xmlPK/ŒA_Configurations2/progressbar/PK/ŒA™Configurations2/floater/PK/ŒAÏConfigurations2/popupmenu/PK/ŒAConfigurations2/toolpanel/PK/ŒA?Configurations2/menubar/PK/ŒAuConfigurations2/toolbar/PK/ŒA«Configurations2/images/Bitmaps/PK/ŒAèConfigurations2/statusbar/PK/ŒAÚåG›Ä# settings.xmlPK/ŒA† Ë÷PÄk#META-INF/manifest.xmlPK6þ$astropy-0.3/docs/time/references.txt0000644000175000017500000000031212243255342015743 0ustar oleole.. |Time| replace:: :class:`~astropy.time.core.Time` .. |TimeDelta| replace:: :class:`~astropy.time.core.TimeDelta` .. _SOFA: http://www.iausofa.org/index.html .. _ERFA: https://github.com/liberfa/erfa astropy-0.3/docs/time/index.rst0000644000175000017500000006337112243255342014740 0ustar oleole.. include:: references.txt .. _astropy-time: **************************************************** Time and Dates (`astropy.time`) **************************************************** Introduction ============ The `astropy.time` package provides functionality for manipulating times and dates. Specific emphasis is placed on supporting time scales (e.g. UTC, TAI, UT1) and time representations (e.g. JD, MJD, ISO 8601) that are used in astronomy. It uses Cython to wrap the C language `ERFA`_ time and calendar routines. All time scale conversions are done by Cython vectorized versions of the `ERFA`_ routines and are fast and memory efficient. All time manipulations and arithmetic operations are done internally using two 64-bit floats to represent time. Floating point algorithms from [#]_ are used so that the |Time| object maintains sub-nanosecond precision over times spanning the age of the universe. .. [#] `Shewchuk, 1997, Discrete & Computational Geometry 18(3):305-363 `_ Getting Started =============== The basic way to use `astropy.time` is to create a |Time| object by supplying one or more input time values as well as the `time format`_ and `time scale`_ of those values. The input time(s) can either be a single scalar like `"2010-01-01 00:00:00"` or a list or a `numpy` array of values as shown below. In general any output values have the same shape (scalar or array) as the input. >>> from astropy.time import Time >>> times = ['1999-01-01 00:00:00.123456789', '2010-01-01 00:00:00'] >>> t = Time(times, format='iso', scale='utc') >>> t
%s: ' % ( online_docs_root, warning['doc_url'], warning['warning'])) msg = warning['message'] if not isinstance(warning['message'], six.text_type): msg = msg.decode('utf-8') w.write(xml_escape(msg)) w.write('\n') if warning['nline'] >= 1 and warning['nline'] < len(xml_lines): write_source_line(w, xml_lines[warning['nline'] - 1], warning['nchar']) def write_votlint_warning(w, line, xml_lines): match = re.search("(WARNING|ERROR|INFO) \(l.(?P[0-9]+), c.(?P[0-9]+)\): (?P.*)", line) if match: w.write('Line %d: %s\n' % (int(match.group('line')), xml_escape(match.group('rest')))) write_source_line( w, xml_lines[int(match.group('line')) - 1], int(match.group('column')) - 1) else: w.data(line) w.data('\n') def write_result(result): if 'network_error' in result and result['network_error'] is not None: return xml = result.get_xml_content() xml_lines = xml.splitlines() path = os.path.join(result.get_dirpath(), 'index.html') with io.open(path, 'w', encoding='utf-8') as fd: w = XMLWriter(fd) with make_html_header(w): with w.tag('p'): with w.tag('a', href='vo.xml'): w.data(result.url.decode('ascii')) w.element('hr') with w.tag('pre'): w._flush() for line in result['warnings']: write_warning(w, line, xml_lines) if result['xmllint'] is False: w.element('hr') w.element('p', 'xmllint results:') content = result['xmllint_content'] if not isinstance(content, six.text_type): content = content.decode('ascii') content = content.replace(result.get_dirpath() + '/', '') with w.tag('pre'): w.data(content) if 'votlint' in result: if result['votlint'] is False: w.element('hr') w.element('p', 'votlint results:') content = result['votlint_content'] if not isinstance(content, six.text_type): content = content.decode('ascii') with w.tag('pre'): w._flush() for line in content.splitlines(): write_votlint_warning(w, line, xml_lines) def write_result_row(w, result): with w.tag('tr'): with w.tag('td'): if ('network_error' in result and result['network_error'] is not None): w.data(result.url.decode('ascii')) else: w.element('a', result.url.decode('ascii'), href='%s/index.html' % result.get_htmlpath()) if 'network_error' in result and result['network_error'] is not None: w.element('td', six.text_type(result['network_error']), attrib={'class': 'red'}) w.element('td', '-') w.element('td', '-') w.element('td', '-') w.element('td', '-') else: w.element('td', '-', attrib={'class': 'green'}) if result['nexceptions']: cls = 'red' msg = 'Fatal' elif result['nwarnings']: cls = 'yellow' msg = six.text_type(result['nwarnings']) else: cls = 'green' msg = '-' w.element('td', msg, attrib={'class': cls}) msg = result['version'] if result['xmllint'] is None: cls = '' elif result['xmllint'] is False: cls = 'red' else: cls = 'green' w.element('td', msg, attrib={'class': cls}) if result['expected'] == 'good': cls = 'green' msg = '-' elif result['expected'] == 'broken': cls = 'red' msg = 'net' elif result['expected'] == 'incorrect': cls = 'yellow' msg = 'invalid' w.element('td', msg, attrib={'class': cls}) if 'votlint' in result: if result['votlint']: cls = 'green' msg = 'Passed' else: cls = 'red' msg = 'Failed' else: cls = '' msg = '?' w.element('td', msg, attrib={'class': cls}) def write_table(basename, name, results, root="results", chunk_size=500): def write_page_links(j): if npages <= 1: return with w.tag('center'): if j > 0: w.element('a', '<< ', href='%s_%02d.html' % (basename, j-1)) for i in xrange(npages): if i == j: w.data(six.text_type(i+1)) else: w.element( 'a', six.text_type(i+1), href='%s_%02d.html' % (basename, i)) w.data(' ') if j < npages - 1: w.element('a', '>>', href='%s_%02d.html' % (basename, j+1)) npages = int(ceil(float(len(results)) / chunk_size)) for i, j in enumerate(xrange(0, max(len(results), 1), chunk_size)): subresults = results[j:j+chunk_size] path = os.path.join(root, '%s_%02d.html' % (basename, i)) with io.open(path, 'w', encoding='utf-8') as fd: w = XMLWriter(fd) with make_html_header(w): write_page_links(i) w.element('h2', name) with w.tag('table'): with w.tag('tr'): w.element('th', 'URL') w.element('th', 'Network') w.element('th', 'Warnings') w.element('th', 'Schema') w.element('th', 'Expected') w.element('th', 'votlint') for result in subresults: write_result_row(w, result) write_page_links(i) def add_subset(w, basename, name, subresults, inside=['p'], total=None): with w.tag('tr'): subresults = list(subresults) if total is None: total = len(subresults) percentage = (float(len(subresults)) / total) with w.tag('td'): for element in inside: w.start(element) w.element('a', name, href='%s_00.html' % basename) for element in reversed(inside): w.end(element) numbers = '%d (%.2f%%)' % (len(subresults), percentage * 100.0) with w.tag('td'): w.data(numbers) def write_index(subsets, results, root='results'): path = os.path.join(root, 'index.html') with io.open(path, 'w', encoding='utf-8') as fd: w = XMLWriter(fd) with make_html_header(w): w.element('h1', 'VO Validation results') with w.tag('table'): for subset in subsets: add_subset(w, *subset, total=len(results)) def write_index_table(root, basename, name, subresults, inside=None, total=None, chunk_size=500): if total is None: total = len(subresults) percentage = (float(len(subresults)) / total) numbers = '%d (%.2f%%)' % (len(subresults), percentage * 100.0) write_table(basename, name + ' ' + numbers, subresults, root, chunk_size) astropy-0.3/astropy/io/votable/validator/result.py0000644000175000017500000002603412243255342020625 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains a class to handle a validation result for a single VOTable file. """ from __future__ import absolute_import, division, print_function, unicode_literals from ....extern import six from ....extern.six.moves import http_client, urllib from ....extern.six.moves import cPickle as pickle # STDLIB from xml.parsers.expat import ExpatError import hashlib import os import shutil import socket import subprocess import warnings # VO from .. import table from .. import exceptions from .. import xmlutil class Result: def __init__(self, url, root='results', timeout=10): self.url = url m = hashlib.md5() m.update(url) self._hash = m.hexdigest() self._root = root self._path = os.path.join( self._hash[0:2], self._hash[2:4], self._hash[4:]) if not os.path.exists(self.get_dirpath()): os.makedirs(self.get_dirpath()) self.timeout = timeout self.load_attributes() def __enter__(self): return self def __exit__(self, *args): self.save_attributes() def get_dirpath(self): return os.path.join(self._root, self._path) def get_htmlpath(self): return self._path def get_attribute_path(self): return os.path.join(self.get_dirpath(), "values.dat") def get_vo_xml_path(self): return os.path.join(self.get_dirpath(), "vo.xml") # ATTRIBUTES def load_attributes(self): path = self.get_attribute_path() if os.path.exists(path): try: with open(path, 'rb') as fd: self._attributes = pickle.load(fd) except: shutil.rmtree(self.get_dirpath()) os.makedirs(self.get_dirpath()) self._attributes = {} else: self._attributes = {} def save_attributes(self): path = self.get_attribute_path() with open(path, 'wb') as fd: pickle.dump(self._attributes, fd) def __getitem__(self, key): return self._attributes[key] def __setitem__(self, key, val): self._attributes[key] = val def __contains__(self, key): return key in self._attributes # VO XML def download_xml_content(self): path = self.get_vo_xml_path() if 'network_error' not in self._attributes: self['network_error'] = None if os.path.exists(path): return def fail(reason): reason = str(reason) with open(path, 'wb') as fd: fd.write('FAILED: {0}\n'.format(reason).encode('utf-8')) self['network_error'] = reason r = None try: if six.PY3: r = urllib.request.urlopen( self.url.decode('ascii'), timeout=self.timeout) else: r = urllib.request.urlopen(self.url, timeout=self.timeout) except urllib.error.URLError as e: if hasattr(e, 'reason'): reason = e.reason else: reason = e.code fail(reason) return except http_client.HTTPException as e: fail("HTTPException: %s" % str(e)) return except (socket.timeout, socket.error) as e: fail("Timeout") return if r is None: fail("Invalid URL") return try: content = r.read() except socket.timeout as e: fail("Timeout") return else: r.close() with open(path, 'wb') as fd: fd.write(content) def get_xml_content(self): path = self.get_vo_xml_path() if not os.path.exists(path): self.download_xml_content() with open(path, 'rb') as fd: content = fd.read() return content def validate_vo(self): path = self.get_vo_xml_path() if not os.path.exists(path): self.download_xml_content() self['version'] = '' if 'network_error' in self and self['network_error'] is not None: self['nwarnings'] = 0 self['nexceptions'] = 0 self['warnings'] = [] self['xmllint'] = None self['warning_types'] = set() return nexceptions = 0 nwarnings = 0 t = None lines = [] with open(path, 'rb') as input: with warnings.catch_warnings(record=True) as warning_lines: try: t = table.parse(input, pedantic=False, filename=path) except (ValueError, TypeError, ExpatError) as e: lines.append(str(e)) nexceptions += 1 lines = [str(x.message) for x in warning_lines] + lines if t is not None: self['version'] = version = t.version else: self['version'] = version = "1.0" if 'xmllint' not in self: # Now check the VO schema based on the version in # the file. success, stdout, stderr = xmlutil.validate_schema(path, version) self['xmllint'] = (success == 0) self['xmllint_content'] = stderr warning_types = set() for line in lines: w = exceptions.parse_vowarning(line) if w['is_warning']: nwarnings += 1 if w['is_exception']: nexceptions += 1 warning_types.add(w['warning']) self['nwarnings'] = nwarnings self['nexceptions'] = nexceptions self['warnings'] = lines self['warning_types'] = warning_types def has_warning(self, warning_code): return warning_code in self['warning_types'] def match_expectations(self): if 'network_error' not in self: self['network_error'] = None if self['expected'] == 'good': return (not self['network_error'] and self['nwarnings'] == 0 and self['nexceptions'] == 0) elif self['expected'] == 'incorrect': return (not self['network_error'] and (self['nwarnings'] > 0 or self['nexceptions'] > 0)) elif self['expected'] == 'broken': return self['network_error'] is not None def validate_with_votlint(self, path_to_stilts_jar): filename = self.get_vo_xml_path() p = subprocess.Popen( "java -jar %s votlint validate=false %s" % (path_to_stilts_jar, filename), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() if len(stdout) or p.returncode: self['votlint'] = False else: self['votlint'] = True self['votlint_content'] = stdout def get_result_subsets(results, root, s=None): all_results = [] correct = [] not_expected = [] fail_schema = [] schema_mismatch = [] fail_votlint = [] votlint_mismatch = [] network_failures = [] version_10 = [] version_11 = [] version_12 = [] version_unknown = [] has_warnings = [] warning_set = {} has_exceptions = [] exception_set = {} for url in results: if s: six.next(s) if isinstance(url, Result): x = url else: x = Result(url, root=root) all_results.append(x) if (x['nwarnings'] == 0 and x['nexceptions'] == 0 and x['xmllint'] is True): correct.append(x) if not x.match_expectations(): not_expected.append(x) if x['xmllint'] is False: fail_schema.append(x) if (x['xmllint'] is False and x['nwarnings'] == 0 and x['nexceptions'] == 0): schema_mismatch.append(x) if 'votlint' in x and x['votlint'] is False: fail_votlint.append(x) if 'network_error' not in x: x['network_error'] = None if (x['nwarnings'] == 0 and x['nexceptions'] == 0 and x['network_error'] is None): votlint_mismatch.append(x) if 'network_error' in x and x['network_error'] is not None: network_failures.append(x) version = x['version'] if version == '1.0': version_10.append(x) elif version == '1.1': version_11.append(x) elif version == '1.2': version_12.append(x) else: version_unknown.append(x) if x['nwarnings'] > 0: has_warnings.append(x) for warning in x['warning_types']: if (warning is not None and len(warning) == 3 and warning.startswith('W')): warning_set.setdefault(warning, []) warning_set[warning].append(x) if x['nexceptions'] > 0: has_exceptions.append(x) for exc in x['warning_types']: if exc is not None and len(exc) == 3 and exc.startswith('E'): exception_set.setdefault(exc, []) exception_set[exc].append(x) warning_set = list(warning_set.items()) warning_set.sort() exception_set = list(exception_set.items()) exception_set.sort() tables = [ ('all', 'All tests', all_results), ('correct', 'Correct', correct), ('unexpected', 'Unexpected', not_expected), ('schema', 'Invalid against schema', fail_schema), ('schema_mismatch', 'Invalid against schema/Passed vo.table', schema_mismatch, ['ul']), ('fail_votlint', 'Failed votlint', fail_votlint), ('votlint_mismatch', 'Failed votlint/Passed vo.table', votlint_mismatch, ['ul']), ('network_failures', 'Network failures', network_failures), ('version1.0', 'Version 1.0', version_10), ('version1.1', 'Version 1.1', version_11), ('version1.2', 'Version 1.2', version_12), ('version_unknown', 'Version unknown', version_unknown), ('warnings', 'Warnings', has_warnings)] for warning_code, warnings in warning_set: if s: six.next(s) warning_class = getattr(exceptions, warning_code, None) if warning_class: warning_descr = warning_class.get_short_name() tables.append( (warning_code, '%s: %s' % (warning_code, warning_descr), warnings, ['ul', 'li'])) tables.append( ('exceptions', 'Exceptions', has_exceptions)) for exception_code, exc in exception_set: if s: six.next(s) exception_class = getattr(exceptions, exception_code, None) if exception_class: exception_descr = exception_class.get_short_name() tables.append( (exception_code, '%s: %s' % (exception_code, exception_descr), exc, ['ul', 'li'])) return tables astropy-0.3/astropy/io/votable/data/0000755000175000017500000000000012243263747015664 5ustar oleoleastropy-0.3/astropy/io/votable/data/VOTable.v1.2.xsd0000644000175000017500000005202112243255342020355 0ustar oleole VOTable1.2 is meant to serialize tabular documents in the context of Virtual Observatory applications. This schema corresponds to the VOTable document available from http://www.ivoa.net/Documents/latest/VOT.html Accept UCD1+ Accept also old UCD1 (but not / + %) including SIAP convention (with :) content-role was previsouly restricted as: ]]>; is now a name token. Deprecated in Version 1.2 Deprecated in Version 1.1 Added in Version 1.2: INFO for diagnostics The 'encoding' attribute is added here to avoid problems of code generators which do not properly interpret the TR/TD structures. 'encoding' was chosen because it appears in appendix A.5 The ID attribute is added here to the TR tag to avoid problems of code generators which do not properly interpret the TR/TD structures Added in Version 1.2: INFO for diagnostics Added in Version 1.2: INFO for diagnostics in several places astropy-0.3/astropy/io/votable/data/VOTable.dtd0000644000175000017500000001120712243255342017646 0ustar oleole astropy-0.3/astropy/io/votable/data/VOTable.v1.1.xsd0000644000175000017500000004065512243255342020366 0ustar oleole Deprecated in Version 1.1 astropy-0.3/astropy/io/votable/data/ucd1p-words.txt0000644000175000017500000007502412243255342020575 0ustar oleoleQ|arith |Arithmetic quantities S|arith.diff |Difference between two quantities described by the same UCD P|arith.factor |Numerical factor P|arith.grad |Gradient P|arith.rate |Rate (per time unit) S|arith.ratio |Ratio between two quantities described by the same UCD Q|arith.zp |Zero point S|em |Electromagnetic spectrum S|em.IR |Infrared part of the spectrum S|em.IR.15-30um |Infrared between 15 and 30 micron S|em.IR.3-4um |Infrared between 3 and 4 micron S|em.IR.30-60um |Infrared between 30 and 60 micron S|em.IR.4-8um |Infrared between 4 and 8 micron S|em.IR.60-100um |Infrared between 60 and 100 micron S|em.IR.8-15um |Infrared between 8 and 15 micron S|em.IR.FIR |Far-Infrared, 30-100 microns S|em.IR.H |Infrared between 1.5 and 2 micron S|em.IR.J |Infrared between 1.0 and 1.5 micron S|em.IR.K |Infrared between 2 and 3 micron S|em.IR.MIR |Medium-Infrared, 5-30 microns S|em.IR.NIR |Near-Infrared, 1-5 microns S|em.UV |Ultraviolet part of the spectrum S|em.UV.10-50nm |Ultraviolet between 10 and 50 nm S|em.UV.100-200nm |Ultraviolet between 100 and 200 nm S|em.UV.200-300nm |Ultraviolet between 200 and 300 nm S|em.UV.50-100nm |Ultraviolet between 50 and 100 nm S|em.UV.FUV |Far-Ultraviolet S|em.X-ray |X-ray part of the spectrum S|em.X-ray.hard |Hard X-ray (12 - 120 keV) S|em.X-ray.medium |Medium X-ray (2 - 12 keV) S|em.X-ray.soft |Soft X-ray (0.12 - 2 keV) Q|em.bin |Channel / instrumental spectral bin coordinate (bin number) Q|em.energy |Energy value in the em frame Q|em.freq |Frequency value in the em frame S|em.gamma |Gamma rays part of the spectrum S|em.gamma.hard |Hard gamma ray (>500 keV) S|em.gamma.soft |Soft gamma ray (120 - 500 keV) S|em.line |Designation of major atomic lines S|em.line.HI |21cm hydrogen line S|em.line.Brgamma |Bracket gamma line S|em.line.Halpha |H-alpha line S|em.line.Hbeta |H-beta line S|em.line.Hgamma |H-gamma line S|em.line.Hdelta |H-delta line S|em.line.Lyalpha |H-Lyalpha line S|em.line.OIII |[OIII] line whose rest wl is 500.7 nm S|em.line.CO |CO radio line, e.g. 12CO(1-0) rest wl 115GHz S|em.mm |Millimetric part of the spectrum S|em.mm.100-200GHz |Millimetric between 100 and 200 GHz S|em.mm.1500-3000GHz |Millimetric between 1500 and 3000 GHz S|em.mm.200-400GHz |Millimetric between 200 and 400 GHz S|em.mm.30-50GHz |Millimetric between 30 and 50 GHz S|em.mm.400-750GHz |Millimetric between 400 and 750 GHz S|em.mm.50-100GHz |Millimetric between 50 and 100 GHz S|em.mm.750-1500GHz |Millimetric between 750 and 1500 GHz S|em.opt |Optical part of the spectrum S|em.opt.B |Optical band between 400 and 500 nm S|em.opt.I |Optical band between 750 and 1000 nm S|em.opt.R |Optical band between 600 and 750 nm S|em.opt.U |Optical band between 300 and 400 nm S|em.opt.V |Optical band between 500 and 600 nm S|em.radio |Radio part of the spectrum S|em.radio.100-200MHz |Radio between 100 and 200 MHz S|em.radio.12-30GHz |Radio between 12 and 30 GHz S|em.radio.1500-3000MHz |Radio between 1500 and 3000 MHz S|em.radio.20-100MHz |Radio between 20 and 100 MHz S|em.radio.200-400MHz |Radio between 200 and 400 MHz S|em.radio.3-6GHz |Radio between 3 and 6 GHz S|em.radio.400-750MHz |Radio between 400 and 750 MHz S|em.radio.6-12GHz |Radio between 6 and 12 GHz S|em.radio.750-1500MHz |Radio between 750 and 1500 MHz Q|em.wavenumber |Wavenumber value in the em frame Q|em.wl |Wavelength value in the em frame Q|em.wl.central |Central wavelength Q|em.wl.effective |Effective wavelength Q|instr |Instrument E|instr.background |Instrumental background Q|instr.bandpass |Bandpass (e.g.: band name) of instrument Q|instr.bandwidth |Bandwidth of the instrument Q|instr.baseline |Baseline for interferometry S|instr.beam |Beam Q|instr.calib |Calibration parameter S|instr.det |Detector Q|instr.det.noise |Instrument noise Q|instr.det.psf |Point Spread Function Q|instr.det.qe |Quantum efficiency Q|instr.dispersion |Dispersion of a spectrograph S|instr.filter |Filter S|instr.fov |Field of view S|instr.obsty |Observatory, satellite, mission Q|instr.obsty.seeing |Seeing Q|instr.offset |Offset angle respect to main direction of observation Q|instr.order |Spectral order in a spectrograph Q|instr.param |Various instrumental parameters S|instr.pixel |Pixel (default size: angular) S|instr.plate |Photographic plate Q|instr.plate.emulsion |Plate emulsion Q|instr.precision |Instrument precision Q|instr.saturation |Instrument saturation threshold Q|instr.scale |Instrument scale (for CCD, plate, image) Q|instr.sensitivity |Instrument sensitivity, detection threshold Q|instr.setup |Instrument configuration or setup Q|instr.skyLevel |Sky level Q|instr.skyTemp |Sky temperature Q|instr.tel |Telescope Q|instr.tel.focalLength |Telescope focal length P|meta |Metadata P|meta.abstract |Abstract (of paper, proposal,etc.) P|meta.bib |Bibliographic reference P|meta.bib.author |Author name P|meta.bib.bibcode |Bibcode P|meta.bib.fig |Figure in a paper P|meta.bib.journal |Journal name P|meta.bib.page |Page number P|meta.bib.volume |Volume number P|meta.code |Code or flag P|meta.code.class |Classification code P|meta.code.error |limit uncertainty error flag P|meta.code.member |Membership code P|meta.code.mime |MIME type P|meta.code.multip |Multiplicity or binarity flag P|meta.code.qual |Quality, precision, reliability flag or code P|meta.code.status |Status code (e.g.: status of a proposal/observation) P|meta.cryptic |Unknown or impossible to understand quantity P|meta.curation |Identity of man/organization responsible for the data Q|meta.dataset |Dataset Q|meta.email |Curation/contact e-mail S|meta.file |File S|meta.fits |FITS standard P|meta.id |Identifier, name or designation P|meta.id.assoc |Identifier of associated counterpart P|meta.id.CoI |Name of Co-Investigator P|meta.id.cross |Cross identification P|meta.id.parent |Identification of parent source P|meta.id.part |Part of identifier, suffix or sub-component P|meta.id.PI |Name of Principal Investigator S|meta.main |Main value of something S|meta.modelled |Quantity was produced by a model P|meta.note |Note or remark (longer than a code or flag) P|meta.number |Number (of things; e.g. nb of object in an image) P|meta.record |Record number P|meta.ref |Reference, or origin Q|meta.ref.ivorn |IVORN, Int. VO Resource Name (ivo://) Q|meta.ref.uri |URI, universal resource identifier P|meta.ref.url |URL, web address S|meta.software |Software used in generating data S|meta.table |Table or catalogue P|meta.title |Title or explanation Q|meta.ucd |UCD P|meta.unit |Unit P|meta.version |Version S|obs |Observation Q|obs.airMass |Airmass S|obs.atmos |Atmosphere, atmospheric phenomena affecting an observation Q|obs.atmos.extinction |Atmospheric extinction Q|obs.atmos.refractAngle |Atmospheric refraction angle S|obs.calib |Calibration observation S|obs.calib.flat |Related to flat-field calibration observation (dome, sky, ..) S|obs.exposure |Exposure S|obs.field |Region covered by the observation S|obs.image |Image Q|obs.observer |Observer, discoverer Q|obs.param |Various observation or reduction parameter S|obs.proposal |Observation proposal Q|obs.proposal.cycle |Proposal cycle S|obs.sequence |Sequence of observations, exposures or events E|phot |Photometry E|phot.antennaTemp |Antenna temperature Q|phot.calib |Photometric calibration C|phot.color |Color index or magnitude difference Q|phot.color.excess |color excess Q|phot.color.reddFree |Dereddened color E|phot.count |Flux expressed in counts E|phot.fluence |fluence E|phot.flux |Photon flux Q|phot.flux.bol |Bolometric flux E|phot.flux.density |Flux density (per wl/freq/energy interval) E|phot.flux.density.sb |Flux density surface brightness E|phot.flux.sb |Flux surface brightness E|phot.limbDark |Limb-darkening coefficients E|phot.mag |Photometric magnitude E|phot.mag.bc |Bolometric correction Q|phot.mag.bol |Bolometric magnitude Q|phot.mag.distMod |Distance modulus E|phot.mag.reddFree |Dereddened magnitude E|phot.mag.sb |Surface brightness in magnitude units Q|phys |Physical quantities Q|phys.SFR |Star formation rate E|phys.absorption |Extinction or absorption along the line of sight Q|phys.absorption.coeff |Absorption coefficient (e.g. in a spectral line) Q|phys.absorption.gal |Galactic extinction Q|phys.absorption.opticalDepth |Optical depth Q|phys.abund |Abundance Q|phys.abund.Fe |Fe/H abundance Q|phys.abund.X |Hydrogen abundance Q|phys.abund.Y |Helium abundance Q|phys.abund.Z |Metallicity abundance Q|phys.acceleration |Acceleration Q|phys.albedo |Albedo or reflectance Q|phys.angArea |Angular area Q|phys.angMomentum |Angular momentum E|phys.angSize |Angular size width diameter dimension extension major minor axis extraction radius E|phys.angSize.smajAxis |angular size extent or extension of semi-major axis E|phys.angSize.sminAxis |angular size extent or extension of semi-minor axis Q|phys.area |Area (in linear units) S|phys.atmol |Atomic and molecular physics (shared properties) Q|phys.atmol.branchingRatio |Branching ratio Q|phys.atmol.collisional |Related to collisions Q|phys.atmol.collStrength |Collisional strength Q|phys.atmol.configuration |Configuration Q|phys.atmol.crossSection |Atomic / molecular cross-section Q|phys.atmol.element |Element Q|phys.atmol.excitation |Atomic molecular excitation parameter Q|phys.atmol.final |Quantity refers to atomic/molecular final/ground state, level, ecc. Q|phys.atmol.initial |Quantity refers to atomic/molecular initial state, level, ecc. Q|phys.atmol.ionStage |Ion, ionization stage S|phys.atmol.ionization |Related to ionization Q|phys.atmol.lande |Lande factor S|phys.atmol.level |Atomic level Q|phys.atmol.lifetime |Lifetime of a level Q|phys.atmol.lineShift |Line shifting coefficient Q|phys.atmol.number |Atomic number Z Q|phys.atmol.oscStrength |Oscillator strength Q|phys.atmol.parity |Parity Q|phys.atmol.qn |Quantum number Q|phys.atmol.radiationType |Type of radiation characterizing atomic lines (electric dipole/quadrupole, magnetic dipole) Q|phys.atmol.symmetry |Type of nuclear spin symmetry Q|phys.atmol.sWeight |Statistical weight Q|phys.atmol.sWeight.nuclear |Statistical weight for nuclear spin states Q|phys.atmol.term |Atomic term S|phys.atmol.transition |Transition between states Q|phys.atmol.transProb |Transition probability, Einstein A coefficient Q|phys.atmol.wOscStrength |Weighted oscillator strength Q|phys.atmol.weight |Atomic weight Q|phys.columnDensity |Column density S|phys.composition |Quantities related to composition of objects Q|phys.composition.massLightRatio |Mass to light ratio Q|phys.composition.yield |Mass yield S|phys.cosmology |Related to cosmology Q|phys.damping |Generic damping quantities Q|phys.density |Density (of mass, electron, ...) Q|phys.dielectric |Complex dielectric function Q|phys.dispMeasure |Dispersion measure V|phys.electField |Electric field S|phys.electron |Electron Q|phys.electron.degen |Electron degeneracy parameter Q|phys.emissMeasure |Emission measure Q|phys.emissivity |Emissivity Q|phys.energy |Energy Q|phys.energy.density |Energy-density Q|phys.entropy |Entropy Q|phys.eos |Equation of state Q|phys.excitParam |Excitation parameter U Q|phys.gauntFactor |Gaunt factor/correction Q|phys.gravity |Gravity Q|phys.ionizParam |Ionization parameter Q|phys.ionizParam.coll |Collisional ionization Q|phys.ionizParam.rad |Radiative ionization E|phys.luminosity |Luminosity Q|phys.luminosity.fun |Luminosity function E|phys.magAbs |Absolute magnitude Q|phys.magAbs.bol |Bolometric absolute magnitude V|phys.magField |Magnetic field Q|phys.mass |Mass Q|phys.mass.loss |Mass loss Q|phys.mol |Molecular data Q|phys.mol.dipole |Molecular dipole Q|phys.mol.dipole.electric |Molecular electric dipole moment Q|phys.mol.dipole.magnetic |Molecular magnetic dipole moment Q|phys.mol.dissociation |Molecular dissociation Q|phys.mol.formationHeat |Formation heat for molecules Q|phys.mol.quadrupole |Molecular quadrupole Q|phys.mol.quadrupole.electric |Molecular electric quadrupole moment S|phys.mol.rotation |Molecular rotation S|phys.mol.vibration |Molecular vibration S|phys.particle.neutrino |Related to neutrino E|phys.polarization |Polarization degree (or percentage) Q|phys.polarization.circular |Circular polarization Q|phys.polarization.linear |Linear polarization Q|phys.polarization.rotMeasure |Rotation measure polarization Q|phys.polarization.stokes |Stokes polarization Q|phys.pressure |Pressure Q|phys.recombination.coeff |Recombination coefficient Q|phys.refractIndex |Refraction index Q|phys.size |Linear size, length (not angular) Q|phys.size.axisRatio |Axis ratio (a/b) or (b/a) Q|phys.size.diameter |Diameter Q|phys.size.radius |Radius Q|phys.size.smajAxis |Linear semi major axis Q|phys.size.sminAxis |Linear semi minor axis Q|phys.temperature |Temperature Q|phys.temperature.effective |Effective temperature Q|phys.temperature.electron |Electron temperature Q|phys.transmission |Transmission (of filter, instrument, ...) V|phys.veloc |Space velocity Q|phys.veloc.ang |Angular velocity Q|phys.veloc.dispersion |Velocity dispersion Q|phys.veloc.escape |Escape velocity Q|phys.veloc.expansion |Expansion velocity Q|phys.veloc.microTurb |Microturbulence velocity Q|phys.veloc.orbital |Orbital velocity Q|phys.veloc.pulsat |Pulsational velocity Q|phys.veloc.rotat |Rotational velocity Q|phys.veloc.transverse |Transverse / tangential velocity Q|phys.virial |Related to virial quantities (mass, radius, ..) Q|pos |Position and coordinates Q|pos.angDistance |Angular distance, elongation Q|pos.angResolution |Angular resolution Q|pos.az |Position in alt-azimutal frame Q|pos.az.alt |Alt-azimutal altitude Q|pos.az.azi |Alt-azimutal azimut Q|pos.az.zd |Alt-azimutal zenith distance S|pos.barycenter |Barycenter S|pos.bodyrc |Body related coordinates Q|pos.bodyrc.alt |Body related coordinate (altitude on the body) Q|pos.bodyrc.lat |Body related coordinate (latitude on the body) Q|pos.bodyrc.long |Body related coordinate (longitude on the body) S|pos.cartesian |Cartesian (rectangular) coordinates Q|pos.cartesian.x |Cartesian coordinate along the x-axis Q|pos.cartesian.y |Cartesian coordinate along the y-axis Q|pos.cartesian.z |Cartesian coordinate along the z-axis S|pos.cmb |Cosmic Microwave Background reference frame Q|pos.dirCos |Direction cosine V|pos.distance |Linear distance S|pos.earth |Coordinates related to Earth Q|pos.earth.altitude |Altitude, height on Earth above sea level Q|pos.earth.lat |Latitude on Earth Q|pos.earth.lon |Longitude on Earth S|pos.ecliptic |Ecliptic coordinates Q|pos.ecliptic.lat |Ecliptic latitude Q|pos.ecliptic.lon |Ecliptic longitude S|pos.eop |Earth orientation parameters Q|pos.eop.nutation |Earth nutation Q|pos.ephem |Ephemeris S|pos.eq |Equatorial coordinates Q|pos.eq.dec |Declination in equatorial coordinates Q|pos.eq.ha |Hour-angle Q|pos.eq.ra |Right ascension in equatorial coordinates Q|pos.eq.spd |South polar distance in equatorial coordinates S|pos.errorEllipse |Positional error ellipse Q|pos.frame |Reference frame used for positions S|pos.galactic |Galactic coordinates Q|pos.galactic.lat |Latitude in galactic coordinates Q|pos.galactic.lon |Longitude in galactic coordinates S|pos.galactocentric |Galactocentric coordinate system S|pos.geocentric |Geocentric coordinate system Q|pos.healpix |Hierarchical Equal Area IsoLatitude Pixelization S|pos.heliocentric |Heliocentric position coordinate (solar system bodies) Q|pos.HTM |Hierarchical Triangular Mesh S|pos.lambert |Lambert projection S|pos.lg |Local Group reference frame S|pos.lsr |Local Standard of Rest reference frame Q|pos.lunar |Lunar coordinates Q|pos.lunar.occult |Occultation by lunar limb Q|pos.parallax |Parallax Q|pos.parallax.dyn |Dynamical parallax Q|pos.parallax.phot |Photometric parallaxes Q|pos.parallax.spect |Spectroscopic parallax Q|pos.parallax.trig |Trigonometric parallax Q|pos.phaseAng |Phase angle, e.g. elongation of earth from sun as seen from a third cel. object V|pos.pm |Proper motion Q|pos.posAng |Position angle of a given vector V|pos.precess |Precession (in equatorial coordinates) S|pos.supergalactic |Supergalactic coordinates Q|pos.supergalactic.lat |Latitude in supergalactic coordinates Q|pos.supergalactic.lon |Longitude in supergalactic coordinates P|pos.wcs |WCS keywords P|pos.wcs.cdmatrix |WCS CDMATRIX P|pos.wcs.crpix |WCS CRPIX P|pos.wcs.crval |WCS CRVAL P|pos.wcs.ctype |WCS CTYPE P|pos.wcs.naxes |WCS NAXES P|pos.wcs.naxis |WCS NAXIS P|pos.wcs.scale |WCS scale or scale of an image Q|spect |Spectroscopy Q|spect.binSize |Spectral bin size S|spect.continuum |Continuum spectrum Q|spect.dopplerParam |Doppler parameter b E|spect.dopplerVeloc |Radial velocity, derived from the shift of some spectral feature E|spect.dopplerVeloc.opt |Radial velocity derived from a wavelength shift using the optical convention E|spect.dopplerVeloc.radio |Radial velocity derived from a frequency shift using the radio convention E|spect.index |Spectral index S|spect.line |Spectral line E|spect.line.asymmetry |Line asymmetry E|spect.line.broad |Spectral line broadening Q|spect.line.broad.Stark |Stark line broadening coefficient E|spect.line.broad.Zeeman |Zeeman broadening E|spect.line.eqWidth |Line equivalent width E|spect.line.intensity |Line intensity E|spect.line.profile |Line profile Q|spect.line.strength |Spectral line strength S E|spect.line.width |Spectral line fwhm Q|spect.resolution |Spectral (or velocity) resolution S|src |Observed source viewed on the sky S|src.calib |Calibration source S|src.calib.guideStar |Guide star Q|src.class |Source classification (star, galaxy, cluster...) Q|src.class.color |Color classification Q|src.class.distance |Distance class e.g. Abell Q|src.class.luminosity |Luminosity class Q|src.class.richness |Richness class e.g. Abell Q|src.class.starGalaxy |Star/galaxy discriminator, stellarity index Q|src.class.struct |Structure classification e.g. Bautz-Morgan Q|src.density |Density of sources Q|src.ellipticity |Source ellipticity Q|src.impactParam |Impact parameter Q|src.morph |Morphology structure Q|src.morph.param |Morphological parameter Q|src.morph.scLength |Scale length for a galactic component (disc or bulge) Q|src.morph.type |Hubble morphological type (galaxies) S|src.net |Qualifier indicating that a quantity (e.g. flux) is background subtracted rather than total Q|src.orbital |Orbital parameters Q|src.orbital.eccentricity |Orbit eccentricity Q|src.orbital.inclination |Orbit inclination Q|src.orbital.meanAnomaly |Orbit mean anomaly Q|src.orbital.meanMotion |Mean motion Q|src.orbital.node |Ascending node Q|src.orbital.periastron |Periastron Q|src.redshift |Redshift Q|src.redshift.phot |Photometric redshift Q|src.sample |Sample Q|src.spType |Spectral type MK Q|src.var |Variability of source E|src.var.amplitude |Amplitude of variation Q|src.var.index |Variability index Q|src.var.pulse |Pulse Q|stat |Statistical parameters Q|stat.Fourier |Fourier coefficient Q|stat.Fourier.amplitude |Amplitude Fourier coefficient P|stat.correlation |Correlation between two parameters P|stat.covariance |Covariance between two parameters P|stat.error |Statistical error P|stat.error.sys |Systematic error Q|stat.filling |Filling factor (volume, time, ..) Q|stat.fit |Fit P|stat.fit.chi2 |Chi2 P|stat.fit.dof |Degrees of freedom P|stat.fit.goodness |Goodness or significance of fit S|stat.fit.omc |Observed minus computed Q|stat.fit.param |Parameter of fit P|stat.fit.residual |Residual fit P|stat.likelihood |Likelihood S|stat.max |Maximum or upper limit S|stat.mean |Mean, average value S|stat.median |Median value S|stat.min |Minimum or lowest limit Q|stat.param |Parameter Q|stat.probability |Probability P|stat.snr |Signal to noise ratio P|stat.stdev |Standard deviation S|stat.uncalib |Qualifier of a generic incalibrated quantity Q|stat.value |Miscellaneous value P|stat.variance |Variance P|stat.weight |Statistical weight Q|time |Time, generic quantity in units of time or date Q|time.age |Age Q|time.creation |Creation time/date (of dataset, file, catalogue,...) Q|time.crossing |Crossing time Q|time.duration |Interval of time describing the duration of a generic event or phenomenon Q|time.end |End time/date of a generic event Q|time.epoch |Instant of time related to a generic event (epoch, date, Julian date, time stamp/tag,...) Q|time.equinox |Equinox Q|time.interval |Time interval, time-bin, time elapsed between two events, not the duration of an event Q|time.lifetime |Lifetime Q|time.period |Period, interval of time between the recurrence of phases in a periodic phenomenon Q|time.phase |Phase, position within a period Q|time.processing |A time/date associated with the processing of data Q|time.publiYear |Publication year Q|time.relax |Relaxation time Q|time.release |The time/date data is available to the public Q|time.resolution |Time resolution Q|time.scale |Timescale Q|time.start |Start time/date of generic event astropy-0.3/astropy/io/votable/data/VOTable.v1.3.xsd0000644000175000017500000005250512243255342020365 0ustar oleole VOTable is meant to serialize tabular documents in the context of Virtual Observatory applications. This schema corresponds to the VOTable document available from http://www.ivoa.net/Documents/latest/VOT.html Accept UCD1+ Accept also old UCD1 (but not / + %) including SIAP convention (with :) content-role was previsouly restricted as: ]]>; is now a token. Deprecated in Version 1.2 Deprecated in Version 1.1 Added in Version 1.2: INFO for diagnostics The 'encoding' attribute is added here to avoid problems of code generators which do not properly interpret the TR/TD structures. 'encoding' was chosen because it appears in appendix A.5 The ID attribute is added here to the TR tag to avoid problems of code generators which do not properly interpret the TR/TD structures Added in Version 1.2: INFO for diagnostics Added in Version 1.2: INFO for diagnostics in several places astropy-0.3/astropy/io/votable/converters.py0000644000175000017500000012231412243255342017512 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module handles the conversion of various VOTABLE datatypes to/from TABLEDATA_ and BINARY_ formats. """ from __future__ import absolute_import, division, print_function, unicode_literals from ...extern import six from ...extern.six.moves import xrange # STDLIB import re import sys from struct import unpack as _struct_unpack from struct import pack as _struct_pack # THIRD-PARTY import numpy as np from numpy import ma # ASTROPY from ...utils.xml.writer import xml_escape_cdata # LOCAL from .exceptions import (vo_raise, vo_warn, warn_or_raise, W01, W30, W31, W39, W46, W47, W49, W51, E01, E02, E03, E04, E05, E06) __all__ = ['get_converter', 'Converter', 'table_column_to_votable_datatype'] pedantic_array_splitter = re.compile(r" +") array_splitter = re.compile(r"\s+|(?:\s*,\s*)") """ A regex to handle splitting values on either whitespace or commas. SPEC: Usage of commas is not actually allowed by the spec, but many files in the wild use them. """ _zero_int = b'\0\0\0\0' _empty_bytes = b'' _zero_byte = b'\0' if six.PY3: struct_unpack = _struct_unpack struct_pack = _struct_pack else: def struct_unpack(format, s): return _struct_unpack(format.encode('ascii'), s) def struct_pack(format, *args): return _struct_pack(format.encode('ascii'), *args) if sys.byteorder == 'little': def _ensure_bigendian(x): if x.dtype.byteorder != '>': return x.byteswap() return x else: def _ensure_bigendian(x): if x.dtype.byteorder == '<': return x.byteswap() return x def _make_masked_array(data, mask): """ Masked arrays of zero length that also have a mask of zero length cause problems in Numpy (at least in 1.6.2). This function creates a masked array from data and a mask, unless it is zero length. """ # np.ma doesn't like setting mask to [] if len(data): return ma.array( np.array(data), mask=np.array(mask, dtype='bool')) else: return ma.array(np.array(data)) def bitarray_to_bool(data, length): """ Converts a bit array (a string of bits in a bytes object) to a boolean Numpy array. Parameters ---------- data : bytes The bit array. The most significant byte is read first. length : int The number of bits to read. The least significant bits in the data bytes beyond length will be ignored. Returns ------- array : numpy bool array """ results = [] for byte in data: if not six.PY3: byte = ord(byte) for bit_no in range(7, -1, -1): bit = byte & (1 << bit_no) bit = (bit != 0) results.append(bit) if len(results) == length: break if len(results) == length: break return np.array(results, dtype='b1') def bool_to_bitarray(value): """ Converts a numpy boolean array to a bit array (a string of bits in a bytes object). Parameters ---------- value : numpy bool array Returns ------- bit_array : bytes The first value in the input array will be the most significant bit in the result. The length will be `floor((N + 7) / 8)` where `N` is the length of `value`. """ value = value.flat bit_no = 7 byte = 0 bytes = [] for v in value: if v: byte |= 1 << bit_no if bit_no == 0: bytes.append(byte) bit_no = 7 byte = 0 else: bit_no -= 1 if bit_no != 7: bytes.append(byte) return struct_pack("%sB" % len(bytes), *bytes) class Converter(object): """ The base class for all converters. Each subclass handles converting a specific VOTABLE data type to/from the TABLEDATA_ and BINARY_ on-disk representations. Parameters ---------- field : `~astropy.io.votable.table.Field` object describing the datatype config : dict The parser configuration dictionary pos : tuple The position in the XML file where the FIELD object was found. Used for error messages. """ def __init__(self, field, config={}, pos=None): pass @staticmethod def _parse_length(read): return struct_unpack(">I", read(4))[0] @staticmethod def _write_length(length): return struct_pack(">I", int(length)) def parse(self, value, config={}, pos=None): """ Convert the string *value* from the TABLEDATA_ format into an object with the correct native in-memory datatype and mask flag. Parameters ---------- value : str value in TABLEDATA format Returns ------- native : tuple (value, mask) The value as a Numpy array or scalar, and *mask* is True if the value is missing. """ raise NotImplementedError( "This datatype must implement a 'parse' method.") def parse_scalar(self, value, config={}, pos=None): """ Parse a single scalar of the underlying type of the converter. For non-array converters, this is equivalent to parse. For array converters, this is used to parse a single element of the array. Parameters ---------- value : str value in TABLEDATA format Returns ------- native : tuple (value, mask) The value as a Numpy array or scalar, and *mask* is True if the value is missing. """ return self.parse(value, config, pos) def output(self, value, mask): """ Convert the object *value* (in the native in-memory datatype) to a unicode string suitable for serializing in the TABLEDATA_ format. Parameters ---------- value : native type corresponding to this converter The value mask : bool If `True`, will return the string representation of a masked value. Returns ------- tabledata_repr : unicode """ raise NotImplementedError( "This datatype must implement a 'output' method.") def binparse(self, read): """ Reads some number of bytes from the BINARY_ format representation by calling the function *read*, and returns the native in-memory object representation for the datatype handled by *self*. Parameters ---------- read : function A function that given a number of bytes, returns a byte string. Returns ------- native : tuple (value, mask) The value as a Numpy array or scalar, and *mask* is True if the value is missing. """ raise NotImplementedError( "This datatype must implement a 'binparse' method.") def binoutput(self, value, mask): """ Convert the object *value* in the native in-memory datatype to a string of bytes suitable for serialization in the BINARY_ format. Parameters ---------- value : native type corresponding to this converter The value mask : bool If `True`, will return the string representation of a masked value. Returns ------- bytes : byte string The binary representation of the value, suitable for serialization in the BINARY_ format. """ raise NotImplementedError( "This datatype must implement a 'binoutput' method.") class Char(Converter): """ Handles the char datatype. (7-bit unsigned characters) Missing values are not handled for string or unicode types. """ default = _empty_bytes def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) if field.arraysize is None: vo_warn(W47, (), config, pos) field.arraysize = '1' if field.arraysize == '*': self.format = 'O' self.binparse = self._binparse_var self.binoutput = self._binoutput_var self.arraysize = '*' else: if field.arraysize.endswith('*'): field.arraysize = field.arraysize[:-1] try: self.arraysize = int(field.arraysize) except ValueError: vo_raise(E01, (field.arraysize, 'char', field.ID), config) self.format = 'S%d' % self.arraysize self.binparse = self._binparse_fixed self.binoutput = self._binoutput_fixed self._struct_format = ">%ds" % self.arraysize if config.get('pedantic'): self.parse = self._ascii_parse else: self.parse = self._str_parse def _ascii_parse(self, value, config={}, pos=None): if self.arraysize != '*' and len(value) > self.arraysize: vo_warn(W46, ('char', self.arraysize), config, pos) return value.encode('ascii'), False def _str_parse(self, value, config={}, pos=None): if self.arraysize != '*' and len(value) > self.arraysize: vo_warn(W46, ('char', self.arraysize), config, pos) return value.encode('utf-8'), False def output(self, value, mask): if mask: return '' if not isinstance(value, str): value = value.decode('ascii') return xml_escape_cdata(value) def _binparse_var(self, read): length = self._parse_length(read) return read(length), False def _binparse_fixed(self, read): s = struct_unpack(self._struct_format, read(self.arraysize))[0] end = s.find(_zero_byte) if end != -1: return s[:end], False return s, False def _binoutput_var(self, value, mask): if mask or value is None or value == '': return _zero_int return self._write_length(len(value)) + value def _binoutput_fixed(self, value, mask): if mask: value = _empty_bytes return struct_pack(self._struct_format, value) class UnicodeChar(Converter): """ Handles the unicodeChar data type. UTF-16-BE. Missing values are not handled for string or unicode types. """ default = '' def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) if field.arraysize is None: vo_warn(W47, (), config, pos) field.arraysize = '1' if field.arraysize == '*': self.format = 'O' self.binparse = self._binparse_var self.binoutput = self._binoutput_var self.arraysize = '*' else: try: self.arraysize = int(field.arraysize) except ValueError: vo_raise(E01, (field.arraysize, 'unicode', field.ID), config) self.format = 'U%d' % self.arraysize self.binparse = self._binparse_fixed self.binoutput = self._binoutput_fixed self._struct_format = ">%ds" % (self.arraysize * 2) def parse(self, value, config={}, pos=None): if self.arraysize != '*' and len(value) > self.arraysize: vo_warn(W46, ('unicodeChar', self.arraysize), config, pos) return value, False def output(self, value, mask): if mask: return '' return xml_escape_cdata(six.text_type(value)) def _binparse_var(self, read): length = self._parse_length(read) return read(length * 2).decode('utf_16_be'), False def _binparse_fixed(self, read): s = struct_unpack(self._struct_format, read(self.arraysize * 2))[0] s = s.decode('utf_16_be') end = s.find('\0') if end != -1: return s[:end], False return s, False def _binoutput_var(self, value, mask): if mask or value is None or value == '': return _zero_int encoded = value.encode('utf_16_be') return self._write_length(len(encoded) / 2) + encoded def _binoutput_fixed(self, value, mask): if mask: value = '' return struct_pack(self._struct_format, value.encode('utf_16_be')) class Array(Converter): """ Handles both fixed and variable-lengths arrays. """ def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) if config.get('pedantic'): self._splitter = self._splitter_pedantic else: self._splitter = self._splitter_lax def parse_scalar(self, value, config={}, pos=0): return self._base.parse_scalar(value, config, pos) @staticmethod def _splitter_pedantic(value, config={}, pos=None): return pedantic_array_splitter.split(value) @staticmethod def _splitter_lax(value, config={}, pos=None): if ',' in value: vo_warn(W01, (), config, pos) return array_splitter.split(value) class VarArray(Array): """ Handles variable lengths arrays (i.e. where *arraysize* is '*'). """ format = 'O' def __init__(self, field, base, arraysize, config={}, pos=None): Array.__init__(self, field, config) self._base = base self.default = np.array([], dtype=self._base.format) def output(self, value, mask): output = self._base.output result = [output(x, m) for x, m in np.broadcast(value, value.mask)] return ' '.join(result) def binparse(self, read): length = self._parse_length(read) result = [] result_mask = [] binparse = self._base.binparse for i in xrange(length): val, mask = binparse(read) result.append(val) result_mask.append(mask) return _make_masked_array(result, result_mask), False def binoutput(self, value, mask): if value is None or len(value) == 0: return _zero_int length = len(value) result = [self._write_length(length)] binoutput = self._base.binoutput for x, m in zip(value, value.mask): result.append(binoutput(x, m)) return _empty_bytes.join(result) class ArrayVarArray(VarArray): """ Handles an array of variable-length arrays, i.e. where *arraysize* ends in '*'. """ def parse(self, value, config={}, pos=None): if value.strip() == '': return ma.array([]), False parts = self._splitter(value, config, pos) items = self._base._items parse_parts = self._base.parse_parts if len(parts) % items != 0: vo_raise(E02, (items, len(parts)), config, pos) result = [] result_mask = [] for i in xrange(0, len(parts), items): value, mask = parse_parts(parts[i:i+items], config, pos) result.append(value) result_mask.append(mask) return _make_masked_array(result, result_mask), False class ScalarVarArray(VarArray): """ Handles a variable-length array of numeric scalars. """ def parse(self, value, config={}, pos=None): if value.strip() == '': return ma.array([]), False parts = self._splitter(value, config, pos) parse = self._base.parse result = [] result_mask = [] for x in parts: value, mask = parse(x, config, pos) result.append(value) result_mask.append(mask) return _make_masked_array(result, result_mask), False class NumericArray(Array): """ Handles a fixed-length array of numeric scalars. """ vararray_type = ArrayVarArray def __init__(self, field, base, arraysize, config={}, pos=None): Array.__init__(self, field, config, pos) self._base = base self._arraysize = arraysize self.format = "%s%s" % (tuple(arraysize), base.format) self._items = 1 for dim in arraysize: self._items *= dim self._memsize = np.dtype(self.format).itemsize self._bigendian_format = '>' + self.format self.default = np.empty(arraysize, dtype=self._base.format) self.default[...] = self._base.default def parse(self, value, config={}, pos=None): if config['version_1_3_or_later'] and value == '': return np.zeros(self._arraysize, dtype=self._base.format), True parts = self._splitter(value, config, pos) if len(parts) != self._items: warn_or_raise(E02, E02, (self._items, len(parts)), config, pos) if config.get('pedantic'): return self.parse_parts(parts, config, pos) else: if len(parts) == self._items: pass elif len(parts) > self._items: parts = parts[:self._items] else: parts = (parts + ([self._base.default] * (self._items - len(parts)))) return self.parse_parts(parts, config, pos) def parse_parts(self, parts, config={}, pos=None): base_parse = self._base.parse result = [] result_mask = [] for x in parts: value, mask = base_parse(x, config, pos) result.append(value) result_mask.append(mask) result = np.array(result, dtype=self._base.format).reshape( self._arraysize) result_mask = np.array(result_mask, dtype='bool').reshape( self._arraysize) return result, result_mask def output(self, value, mask): base_output = self._base.output value = np.asarray(value) mask = np.asarray(mask) return ' '.join(base_output(x, m) for x, m in zip(value.flat, mask.flat)) def binparse(self, read): result = np.fromstring(read(self._memsize), dtype=self._bigendian_format)[0] result_mask = self._base.is_null(result) return result, result_mask def binoutput(self, value, mask): filtered = self._base.filter_array(value, mask) filtered = _ensure_bigendian(filtered) return filtered.tostring() class Numeric(Converter): """ The base class for all numeric data types. """ array_type = NumericArray vararray_type = ScalarVarArray null = None def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) self._memsize = np.dtype(self.format).itemsize self._bigendian_format = '>' + self.format if field.values.null is not None: self.null = np.asarray(field.values.null, dtype=self.format) self.default = self.null self.is_null = self._is_null else: self.is_null = np.isnan def binparse(self, read): result = np.fromstring(read(self._memsize), dtype=self._bigendian_format) return result[0], self.is_null(result[0]) def _is_null(self, value): return value == self.null class FloatingPoint(Numeric): """ The base class for floating-point datatypes. """ default = np.nan def __init__(self, field, config={}, pos=None): Numeric.__init__(self, field, config, pos) precision = field.precision width = field.width format_parts = ['%'] if width is not None: format_parts.append(six.text_type(width)) if precision is None: format_parts.append('s') elif precision.startswith("E"): format_parts.append('.%dg' % int(precision[1:])) elif precision.startswith("F"): format_parts.append('.%df' % int(precision[1:])) else: format_parts.append('.%df' % int(precision)) self._output_format = ''.join(format_parts) self.nan = np.array(np.nan, self.format) if self.null is None: self._null_output = 'NaN' self._null_binoutput = self.binoutput(self.nan, False) self.filter_array = self._filter_nan else: self._null_output = self.output(np.asarray(self.null), False) self._null_binoutput = self.binoutput(np.asarray(self.null), False) self.filter_array = self._filter_null if config.get('pedantic'): self.parse = self._parse_pedantic else: self.parse = self._parse_permissive def _parse_pedantic(self, value, config={}, pos=None): if value.strip() == '': return self.null, True f = float(value) return f, self.is_null(f) def _parse_permissive(self, value, config={}, pos=None): try: f = float(value) return f, self.is_null(f) except ValueError: # IRSA VOTables use the word 'null' to specify empty values, # but this is not defined in the VOTable spec. if value.strip() != '': vo_warn(W30, value, config, pos) return self.null, True @property def output_format(self): return self._output_format def output(self, value, mask): if mask: return self._null_output if np.isfinite(value): result = self._output_format % value if (self._output_format[-1] == 's' and result.endswith('.0')): result = result[:-2] return result elif np.isnan(value): return 'NaN' elif np.isposinf(value): return '+InF' elif np.isneginf(value): return '-InF' # Should never raise vo_raise("Invalid floating point value '%s'" % value) def binoutput(self, value, mask): if mask: return self._null_binoutput value = _ensure_bigendian(value) return value.tostring() def _filter_nan(self, value, mask): return np.where(mask, np.nan, value) def _filter_null(self, value, mask): return np.where(mask, self.null, value) class Double(FloatingPoint): """ Handles the double datatype. Double-precision IEEE floating-point. """ format = 'f8' class Float(FloatingPoint): """ Handles the float datatype. Single-precision IEEE floating-point. """ format = 'f4' class Integer(Numeric): """ The base class for all the integral datatypes. """ default = 0 def __init__(self, field, config={}, pos=None): Numeric.__init__(self, field, config, pos) def parse(self, value, config={}, pos=None): mask = False if isinstance(value, six.string_types): value = value.lower() if value == '': if config['version_1_3_or_later']: mask = True else: warn_or_raise(W49, W49, (), config, pos) if self.null is not None: value = self.null else: value = self.default elif value == 'nan': mask = True if self.null is None: warn_or_raise(W31, W31, (), config, pos) value = self.default else: value = self.null elif value.startswith('0x'): value = int(value[2:], 16) else: value = int(value, 10) else: value = int(value) if self.null is not None and value == self.null: mask = True if value < self.val_range[0]: warn_or_raise(W51, W51, (value, self.bit_size), config, pos) value = self.val_range[0] elif value > self.val_range[1]: warn_or_raise(W51, W51, (value, self.bit_size), config, pos) value = self.val_range[1] return value, mask def output(self, value, mask): if mask: if self.null is None: warn_or_raise(W31, W31) return 'NaN' return six.text_type(self.null) return six.text_type(value) def binoutput(self, value, mask): if mask: if self.null is None: vo_raise(W31) else: value = self.null value = _ensure_bigendian(value) return value.tostring() def filter_array(self, value, mask): if np.any(mask): if self.null is not None: return np.where(mask, self.null, value) else: vo_raise(W31) return value class UnsignedByte(Integer): """ Handles the unsignedByte datatype. Unsigned 8-bit integer. """ format = 'u1' val_range = (0, 255) bit_size = '8-bit unsigned' class Short(Integer): """ Handles the short datatype. Signed 16-bit integer. """ format = 'i2' val_range = (-32768, 32767) bit_size = '16-bit' class Int(Integer): """ Handles the int datatype. Signed 32-bit integer. """ format = 'i4' val_range = (-2147483648, 2147483647) bit_size = '32-bit' class Long(Integer): """ Handles the long datatype. Signed 64-bit integer. """ format = 'i8' val_range = (-9223372036854775808, 9223372036854775807) bit_size = '64-bit' class ComplexArrayVarArray(VarArray): """ Handles an array of variable-length arrays of complex numbers. """ def __init__(self, field, base, arraysize, config={}, pos=None): VarArray.__init__(self, field, base, arraysize, config, pos) def parse(self, value, config={}, pos=None): if value.strip() == '': return ma.array([]), True parts = self._splitter(value, config, pos) items = self._base._items parse_parts = self._base.parse_parts if len(parts) % items != 0: vo_raise(E02, (items, len(parts)), config, pos) result = [] result_mask = [] for i in xrange(0, len(parts), items): value, mask = parse_parts(parts[i:i + items], config, pos) result.append(value) result_mask.append(mask) return _make_masked_array(result, result_mask), False class ComplexVarArray(VarArray): """ Handles a variable-length array of complex numbers. """ def __init__(self, field, base, arraysize, config={}, pos=None): VarArray.__init__(self, field, base, arraysize, config, pos) def parse(self, value, config={}, pos=None): if value.strip() == '': return ma.array([]), True parts = self._splitter(value, config, pos) parse_parts = self._base.parse_parts result = [] result_mask = [] for i in xrange(0, len(parts), 2): value = [float(x) for x in parts[i:i + 2]] value, mask = parse_parts(value, config, pos) result.append(value) result_mask.append(mask) return _make_masked_array( np.array(result, dtype=self._base.format), result_mask), False class ComplexArray(NumericArray): """ Handles a fixed-size array of complex numbers. """ vararray_type = ComplexArrayVarArray def __init__(self, field, base, arraysize, config={}, pos=None): NumericArray.__init__(self, field, base, arraysize, config, pos) self._items *= 2 def parse(self, value, config={}, pos=None): parts = self._splitter(value, config, pos) if parts == ['']: parts = [] return self.parse_parts(parts, config, pos) def parse_parts(self, parts, config={}, pos=None): if len(parts) != self._items: vo_raise(E02, (self._items, len(parts)), config, pos) base_parse = self._base.parse_parts result = [] result_mask = [] for i in xrange(0, self._items, 2): value = [float(x) for x in parts[i:i + 2]] value, mask = base_parse(value, config, pos) result.append(value) result_mask.append(mask) result = np.array( result, dtype=self._base.format).reshape(self._arraysize) result_mask = np.array( result_mask, dtype='bool').reshape(self._arraysize) return result, result_mask class Complex(FloatingPoint, Array): """ The base class for complex numbers. """ array_type = ComplexArray vararray_type = ComplexVarArray default = np.nan def __init__(self, field, config={}, pos=None): FloatingPoint.__init__(self, field, config, pos) Array.__init__(self, field, config, pos) def parse(self, value, config={}, pos=None): if value.strip() == '': return np.nan, True splitter = self._splitter parts = [float(x) for x in splitter(value, config, pos)] if len(parts) != 2: vo_raise(E03, (value,), config, pos) return self.parse_parts(parts, config, pos) _parse_permissive = parse _parse_pedantic = parse def parse_parts(self, parts, config={}, pos=None): value = complex(*parts) return value, self.is_null(value) def output(self, value, mask): if mask: if self.null is None: return 'NaN' else: value = self.null real = self._output_format % value.real imag = self._output_format % value.imag if self._output_format[-1] == 's': if real.endswith('.0'): real = real[:-2] if imag.endswith('.0'): imag = imag[:-2] return real + ' ' + imag class FloatComplex(Complex): """ Handle floatComplex datatype. Pair of single-precision IEEE floating-point numbers. """ format = 'c8' class DoubleComplex(Complex): """ Handle doubleComplex datatype. Pair of double-precision IEEE floating-point numbers. """ format = 'c16' class BitArray(NumericArray): """ Handles an array of bits. """ vararray_type = ArrayVarArray def __init__(self, field, base, arraysize, config={}, pos=None): NumericArray.__init__(self, field, base, arraysize, config, pos) self._bytes = ((self._items - 1) // 8) + 1 @staticmethod def _splitter_pedantic(value, config={}, pos=None): return list(re.sub('\s', '', value)) @staticmethod def _splitter_lax(value, config={}, pos=None): if ',' in value: vo_warn(W01, (), config, pos) return list(re.sub('\s|,', '', value)) def output(self, value, mask): value = np.asarray(value) mapping = {False: '0', True: '1'} return ''.join(mapping[x] for x in value.flat) def binparse(self, read): data = read(self._bytes) result = bitarray_to_bool(data, self._items) result = result.reshape(self._arraysize) result_mask = np.zeros(self._arraysize, dtype='b1') return result, result_mask def binoutput(self, value, mask): if np.any(mask): vo_warn(W39) return bool_to_bitarray(value) class Bit(Converter): """ Handles the bit datatype. """ format = 'b1' array_type = BitArray vararray_type = ScalarVarArray default = False binary_one = b'\x08' binary_zero = b'\0' def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) def parse(self, value, config={}, pos=None): mapping = {'1': True, '0': False} if value is False or value.strip() == '': if not config['version_1_3_or_later']: warn_or_raise(W49, W49, (), config, pos) return False, True else: try: return mapping[value], False except KeyError: vo_raise(E04, (value,), config, pos) def output(self, value, mask): if mask: vo_warn(W39) if value: return '1' else: return '0' def binparse(self, read): data = read(1) return (ord(data) & 0x8) != 0, False def binoutput(self, value, mask): if mask: vo_warn(W39) if value: return self.binary_one return self.binary_zero class BooleanArray(NumericArray): """ Handles an array of boolean values. """ vararray_type = ArrayVarArray def __init__(self, field, base, arraysize, config={}, pos=None): NumericArray.__init__(self, field, base, arraysize, config, pos) def binparse(self, read): data = read(self._items) binparse = self._base.binparse_value result = [] result_mask = [] for char in data: if not six.PY3: char = ord(char) value, mask = binparse(char) result.append(value) result_mask.append(mask) result = np.array(result, dtype='b1').reshape( self._arraysize) result_mask = np.array(result_mask, dtype='b1').reshape( self._arraysize) return result, result_mask def binoutput(self, value, mask): binoutput = self._base.binoutput value = np.asarray(value) mask = np.asarray(mask) result = [binoutput(x, m) for x, m in np.broadcast(value.flat, mask.flat)] return _empty_bytes.join(result) class Boolean(Converter): """ Handles the boolean datatype. """ format = 'b1' array_type = BooleanArray vararray_type = ScalarVarArray default = False binary_question_mark = b'?' binary_true = b'T' binary_false = b'F' def __init__(self, field, config={}, pos=None): Converter.__init__(self, field, config, pos) def parse(self, value, config={}, pos=None): if value == '': return False, True if value is False: return False, True mapping = {'TRUE' : (True, False), 'FALSE' : (False, False), '1' : (True, False), '0' : (False, False), 'T' : (True, False), 'F' : (False, False), '\0' : (False, True), ' ' : (False, True), '?' : (False, True), '' : (False, True)} try: return mapping[value.upper()] except KeyError: vo_raise(E05, (value,), config, pos) def output(self, value, mask): if mask: return '?' if value: return 'T' return 'F' def binparse(self, read): value = ord(read(1)) return self.binparse_value(value) _binparse_mapping = { ord('T') : (True, False), ord('t') : (True, False), ord('1') : (True, False), ord('F') : (False, False), ord('f') : (False, False), ord('0') : (False, False), ord('\0') : (False, True), ord(' ') : (False, True), ord('?') : (False, True)} def binparse_value(self, value): try: return self._binparse_mapping[value] except KeyError: vo_raise(E05, (value,)) def binoutput(self, value, mask): if mask: return self.binary_question_mark if value: return self.binary_true return self.binary_false converter_mapping = { 'double' : Double, 'float' : Float, 'bit' : Bit, 'boolean' : Boolean, 'unsignedByte' : UnsignedByte, 'short' : Short, 'int' : Int, 'long' : Long, 'floatComplex' : FloatComplex, 'doubleComplex' : DoubleComplex, 'char' : Char, 'unicodeChar' : UnicodeChar } def get_converter(field, config={}, pos=None): """ Get an appropriate converter instance for a given field. Parameters ---------- field : astropy.io.votable.tree.Field config : dict, optional Parser configuration dictionary pos : tuple Position in the input XML file. Used for error messages. Returns ------- converter : astropy.io.votable.converters.Converter """ if field.datatype not in converter_mapping: vo_raise(E06, (field.datatype, field.ID), config) cls = converter_mapping[field.datatype] converter = cls(field, config, pos) arraysize = field.arraysize # With numeric datatypes, special things need to happen for # arrays. if (field.datatype not in ('char', 'unicodeChar') and arraysize is not None): if arraysize[-1] == '*': arraysize = arraysize[:-1] last_x = arraysize.rfind('x') if last_x == -1: arraysize = '' else: arraysize = arraysize[:last_x] fixed = False else: fixed = True if arraysize != '': arraysize = [int(x) for x in arraysize.split("x")] arraysize.reverse() else: arraysize = [] if arraysize != []: converter = converter.array_type( field, converter, arraysize, config) if not fixed: converter = converter.vararray_type( field, converter, arraysize, config) return converter numpy_dtype_to_field_mapping = { np.float64().dtype.num : 'double', np.float32().dtype.num : 'float', np.bool_().dtype.num : 'bit', np.uint8().dtype.num : 'unsignedByte', np.int16().dtype.num : 'short', np.int32().dtype.num : 'int', np.int64().dtype.num : 'long', np.complex64().dtype.num : 'floatComplex', np.complex128().dtype.num : 'doubleComplex', np.unicode_().dtype.num : 'unicodeChar' } numpy_dtype_to_field_mapping[np.bytes_().dtype.num] = 'char' def _all_bytes(column): for x in column: if not isinstance(x, bytes): return False return True def _all_unicode(column): for x in column: if not isinstance(x, six.text_type): return False return True def _all_matching_dtype(column): first_dtype = False first_shape = () for x in column: if not isinstance(x, np.ndarray) or len(x) == 0: continue if first_dtype is False: first_dtype = x.dtype first_shape = x.shape[1:] elif first_dtype != x.dtype: return False, () elif first_shape != x.shape[1:]: first_shape = () return first_dtype, first_shape def numpy_to_votable_dtype(dtype, shape): """ Converts a numpy dtype and shape to a dictionary of attributes for a VOTable FIELD element and correspond to that type. Parameters ---------- dtype : Numpy dtype instance shape : tuple Returns ------- attributes : dict A dict containing 'datatype' and 'arraysize' keys that can be set on a VOTable FIELD element. """ if dtype.num not in numpy_dtype_to_field_mapping: raise TypeError( "{0!r} can not be represented in VOTable".format(dtype)) if dtype.char == 'S': return {'datatype': 'char', 'arraysize': str(dtype.itemsize)} elif dtype.char == 'U': return {'datatype': 'unicodeChar', 'arraysize': str(dtype.itemsize // 4)} else: result = { 'datatype': numpy_dtype_to_field_mapping[dtype.num]} if len(shape): result['arraysize'] = 'x'.join(str(x) for x in shape) return result def table_column_to_votable_datatype(column): """ Given a `astropy.table.Column` instance, returns the attributes necessary to create a VOTable FIELD element that corresponds to the type of the column. This necessarily must perform some heuristics to determine the type of variable length arrays fields, since they are not directly supported by Numpy. If the column has dtype of "object", it performs the following tests: - If all elements are byte or unicode strings, it creates a variable-length byte or unicode field, respectively. - If all elements are numpy arrays of the same dtype and with a consistent shape in all but the first dimension, it creates a variable length array of fixed sized arrays. If the dtypes match, but the shapes do not, a variable length array is created. If the dtype of the input is not understood, it sets the data type to the most inclusive: a variable length unicodeChar array. Parameters ---------- column : `astropy.table.Column` instance Returns ------- attributes : dict A dict containing 'datatype' and 'arraysize' keys that can be set on a VOTable FIELD element. """ if column.dtype.char == 'O': if isinstance(column[0], bytes): if _all_bytes(column[1:]): return {'datatype': 'char', 'arraysize': '*'} elif isinstance(column[0], six.text_type): if _all_unicode(column[1:]): return {'datatype': 'unicodeChar', 'arraysize': '*'} elif isinstance(column[0], np.ndarray): dtype, shape = _all_matching_dtype(column) if dtype is not False: result = numpy_to_votable_dtype(dtype, shape) if 'arraysize' not in result: result['arraysize'] = '*' else: result['arraysize'] += '*' return result # All bets are off, do the most generic thing return {'datatype': 'unicodeChar', 'arraysize': '*'} return numpy_to_votable_dtype(column.dtype, column.shape[1:]) astropy-0.3/astropy/io/votable/voexceptions.py0000644000175000017500000000053712243255342020050 0ustar oleolefrom ...utils.exceptions import AstropyDeprecationWarning # Licensed under a 3-clause BSD style license - see LICENSE.rst if not _ASTROPY_SETUP_: import warnings warnings.warn( "astropy.io.votable.voexceptions is deprecated. " "Use astropy.io.votable.exceptions", AstropyDeprecationWarning) from .exceptions import * astropy-0.3/astropy/io/votable/tree.py0000644000175000017500000034674112243255342016273 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst # TODO: Test FITS parsing from __future__ import absolute_import, division, print_function, unicode_literals from ...extern import six from ...extern.six.moves import xrange, urllib # STDLIB import base64 import codecs import io import re import sys # THIRD-PARTY import numpy as np from numpy import ma # LOCAL from .. import fits from ... import __version__ as astropy_version from ...utils.collections import HomogeneousList from ...utils.xml.writer import XMLWriter from . import converters from .exceptions import (warn_or_raise, vo_warn, vo_raise, vo_reraise, warn_unknown_attrs, W06, W07, W08, W09, W10, W11, W12, W13, W15, W17, W18, W19, W20, W21, W22, W26, W27, W28, W29, W32, W33, W35, W36, W37, W38, W40, W41, W42, W43, W44, W45, W50, W52, W53, E06, E08, E09, E10, E11, E12, E13, E14, E15, E16, E17, E18, E19, E20, E21) from . import ucd as ucd_mod from . import util from . import xmlutil try: from . import tablewriter _has_c_tabledata_writer = True except ImportError: _has_c_tabledata_writer = False __all__ = [ 'Link', 'Info', 'Values', 'Field', 'Param', 'CooSys', 'FieldRef', 'ParamRef', 'Group', 'Table', 'Resource', 'VOTableFile' ] # The default number of rows to read in each chunk before converting # to an array. DEFAULT_CHUNK_SIZE = 256 RESIZE_AMOUNT = 1.5 ###################################################################### # FACTORY FUNCTIONS def _resize(masked, new_size): """ Masked arrays can not be resized inplace, and `np.resize` and `ma.resize` are both incompatible with structured arrays. Therefore, we do all this. """ new_array = ma.zeros((new_size,), dtype=masked.dtype) length = min(len(masked), new_size) new_array.data[:length] = masked.data[:length] if length != 0: new_array.mask[:length] = masked.mask[:length] return new_array def _lookup_by_attr_factory(attr, unique, iterator, element_name, doc): """ Creates a function useful for looking up an element by a given attribute. Parameters ---------- attr : str The attribute name unique : bool Should be `True` if the attribute is unique and therefore this should return only one value. Otherwise, returns a list of values. iterator : generator A generator that iterates over some arbitrary set of elements element_name : str The XML element name of the elements being iterated over (used for error messages only). doc : str A docstring to apply to the generated function. Returns ------- factory : function A function that looks up an element by the given attribute. """ def lookup_by_attr(self, ref, before=None): """ Given a string *ref*, finds the first element in the iterator where the given attribute == *ref*. If *before* is provided, will stop searching at the object *before*. This is important, since "forward references" are not allowed in the VOTABLE format. """ for element in getattr(self, iterator)(): if element is before: if getattr(element, attr, None) == ref: vo_raise( "%s references itself" % element_name, element._config, element._pos, KeyError) break if getattr(element, attr, None) == ref: yield element def lookup_by_attr_unique(self, ref, before=None): for element in lookup_by_attr(self, ref, before=before): return element raise KeyError( "No %s with %s '%s' found before the referencing %s" % (element_name, attr, ref, element_name)) if unique: lookup_by_attr_unique.__doc__ = doc return lookup_by_attr_unique else: lookup_by_attr.__doc__ = doc return lookup_by_attr def _lookup_by_id_or_name_factory(iterator, element_name, doc): """ Like `_lookup_by_attr_factory`, but looks in both the "ID" and "name" attributes. """ def lookup_by_id_or_name(self, ref, before=None): """ Given an key *ref*, finds the first element in the iterator with the attribute ID == *ref* or name == *ref*. If *before* is provided, will stop searching at the object *before*. This is important, since "forward references" are not allowed in the VOTABLE format. """ for element in getattr(self, iterator)(): if element is before: if ref in (element.ID, element.name): vo_raise( "%s references itself" % element_name, element._config, element._pos, KeyError) break if ref in (element.ID, element.name): return element raise KeyError( "No %s with ID or name '%s' found before the referencing %s" % (element_name, ref, element_name)) lookup_by_id_or_name.__doc__ = doc return lookup_by_id_or_name def _get_default_unit_format(config): """ Get the default unit format as specified in the VOTable spec. """ # In the future, this should take into account the VOTable # version. return 'cds' def _get_unit_format(config): """ Get the unit format based on the configuration. """ if config.get('unit_format') is None: format = _get_default_unit_format(config) else: format = config['unit_format'] return format ###################################################################### # ATTRIBUTE CHECKERS def check_astroyear(year, field, config={}, pos=None): """ Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *year* is not a valid astronomical year as defined by the VOTABLE standard. Parameters ---------- year : str An astronomical year string field : str The name of the field this year was found in (used for error message) config, pos : optional Information about the source of the value """ if (year is not None and re.match(r"^[JB]?[0-9]+([.][0-9]*)?$", year) is None): warn_or_raise(W07, W07, (field, year), config, pos) return False return True def check_string(string, attr_name, config={}, pos=None): """ Raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *string* is not a string or Unicode string. Parameters ---------- string : str An astronomical year string field : str The name of the field this year was found in (used for error message) config, pos : optional Information about the source of the value """ if string is not None and not isinstance(string, six.string_types): warn_or_raise(W08, W08, attr_name, config, pos) return False return True def resolve_id(ID, id, config={}, pos=None): if ID is None and id is not None: warn_or_raise(W09, W09, (), config, pos) return id return ID def check_ucd(ucd, config={}, pos=None): """ Warns or raises a `~astropy.io.votable.exceptions.VOTableSpecError` if *ucd* is not a valid `unified content descriptor`_ string as defined by the VOTABLE standard. Parameters ---------- ucd : str A UCD string. config, pos : optional Information about the source of the value """ if config.get('version_1_1_or_later'): try: ucd_mod.parse_ucd( ucd, check_controlled_vocabulary=config.get( 'version_1_2_or_later', False), has_colon=config.get('version_1_2_or_later', False)) except ValueError as e: # This weird construction is for Python 3 compatibility if config.get('pedantic'): vo_raise(W06, (ucd, six.text_type(e)), config, pos) else: vo_warn(W06, (ucd, six.text_type(e)), config, pos) return False return True ###################################################################### # PROPERTY MIXINS class _IDProperty(object): @property def ID(self): """ The XML ID_ of the element. May be ``None`` or a string conforming to XML ID_ syntax. """ return self._ID @ID.setter def ID(self, ID): xmlutil.check_id(ID, 'ID', self._config, self._pos) self._ID = ID @ID.deleter def ID(self): self._ID = None class _NameProperty(object): @property def name(self): """An optional name for the element.""" return self._name @name.setter def name(self, name): xmlutil.check_token(name, 'name', self._config, self._pos) self._name = name @name.deleter def name(self): self._name = None class _XtypeProperty(object): @property def xtype(self): """Extended data type information.""" return self._xtype @xtype.setter def xtype(self, xtype): if xtype is not None and not self._config.get('version_1_2_or_later'): warn_or_raise( W28, W28, ('xtype', self._element_name, '1.2'), self._config, self._pos) check_string(xtype, 'xtype', self._config, self._pos) self._xtype = xtype @xtype.deleter def xtype(self): self._xtype = None class _UtypeProperty(object): _utype_in_v1_2 = False @property def utype(self): """The usage-specific or `unique type`_ of the element.""" return self._utype @utype.setter def utype(self, utype): if (self._utype_in_v1_2 and utype is not None and not self._config.get('version_1_2_or_later')): warn_or_raise( W28, W28, ('utype', self._element_name, '1.2'), self._config, self._pos) check_string(utype, 'utype', self._config, self._pos) self._utype = utype @utype.deleter def utype(self): self._utype = None class _UcdProperty(object): _ucd_in_v1_2 = False @property def ucd(self): """The `unified content descriptor`_ for the element.""" return self._ucd @ucd.setter def ucd(self, ucd): if ucd is not None and ucd.strip() == '': ucd = None if ucd is not None: if (self._ucd_in_v1_2 and not self._config.get('version_1_2_or_later')): warn_or_raise( W28, W28, ('ucd', self._element_name, '1.2'), self._config, self._pos) check_ucd(ucd, self._config, self._pos) self._ucd = ucd @ucd.deleter def ucd(self): self._ucd = None class _DescriptionProperty(object): @property def description(self): """ An optional string describing the element. Corresponds to the DESCRIPTION_ element. """ return self._description @description.setter def description(self, description): self._description = description @description.deleter def description(self): self._description = None ###################################################################### # ELEMENT CLASSES class Element(object): """ A base class for all classes that represent XML elements in the VOTABLE file. """ def _add_unknown_tag(self, iterator, tag, data, config, pos): warn_or_raise(W10, W10, tag, config, pos) def _ignore_add(self, iterator, tag, data, config, pos): warn_unknown_attrs(tag, six.iterkeys(data), config, pos) def _add_definitions(self, iterator, tag, data, config, pos): if config.get('version_1_1_or_later'): warn_or_raise(W22, W22, (), config, pos) warn_unknown_attrs(tag, six.iterkeys(data), config, pos) class SimpleElement(Element): """ A base class for simple elements, such as FIELD, PARAM and INFO that don't require any special parsing or outputting machinery. """ def __init__(self): Element.__init__(self) def parse(self, iterator, config): for start, tag, data, pos in iterator: if start and tag != self._element_name: self._add_unknown_tag(iterator, tag, data, config, pos) elif tag == self._element_name: break return self def to_xml(self, w, **kwargs): w.element(self._element_name, attrib=w.object_attrs(self, self._attr_list)) class SimpleElementWithContent(SimpleElement): """ A base class for simple elements, such as FIELD, PARAM and INFO that don't require any special parsing or outputting machinery. """ def __init__(self): SimpleElement.__init__(self) self._content = None def parse(self, iterator, config): for start, tag, data, pos in iterator: if start and tag != self._element_name: self._add_unknown_tag(iterator, tag, data, config, pos) elif tag == self._element_name: if data: self.content = data break return self def to_xml(self, w, **kwargs): w.element(self._element_name, self._content, attrib=w.object_attrs(self, self._attr_list)) @property def content(self): """The content of the element.""" return self._content @content.setter def content(self, content): check_string(content, 'content', self._config, self._pos) self._content = content @content.deleter def content(self): self._content = None class Link(SimpleElement, _IDProperty): """ LINK_ elements: used to reference external documents and servers through a URI. The keyword arguments correspond to setting members of the same name, documented below. """ _attr_list = ['ID', 'content_role', 'content_type', 'title', 'value', 'href', 'action'] _element_name = 'LINK' def __init__(self, ID=None, title=None, value=None, href=None, action=None, id=None, config={}, pos=None, **kwargs): self._config = config self._pos = pos SimpleElement.__init__(self) content_role = kwargs.get('content-role') or kwargs.get('content_role') content_type = kwargs.get('content-type') or kwargs.get('content_type') if 'gref' in kwargs: warn_or_raise(W11, W11, (), config, pos) self.ID = resolve_id(ID, id, config, pos) self.content_role = content_role self.content_type = content_type self.title = title self.value = value self.href = href self.action = action warn_unknown_attrs( 'LINK', six.iterkeys(kwargs), config, pos, ['content-role', 'content_role', 'content-type', 'content_type', 'gref']) @property def content_role(self): """ Defines the MIME role of the referenced object. Must be one of: None, 'query', 'hints', 'doc', 'location' or 'type' """ return self._content_role @content_role.setter def content_role(self, content_role): if ((content_role == 'type' and not self._config['version_1_3_or_later']) or content_role not in (None, 'query', 'hints', 'doc', 'location')): vo_warn(W45, (content_role,), self._config, self._pos) self._content_role = content_role @content_role.deleter def content_role(self): self._content_role = None @property def content_type(self): """Defines the MIME content type of the referenced object.""" return self._content_type @content_type.setter def content_type(self, content_type): xmlutil.check_mime_content_type(content_type, self._config, self._pos) self._content_type = content_type @content_type.deleter def content_type(self): self._content_type = None @property def href(self): """ A URI to an arbitrary protocol. The vo package only supports http and anonymous ftp. """ return self._href @href.setter def href(self, href): xmlutil.check_anyuri(href, self._config, self._pos) self._href = href @href.deleter def href(self): self._href = None def to_table_column(self, column): meta = {} for key in self._attr_list: val = getattr(self, key, None) if val is not None: meta[key] = val column.meta.setdefault('links', []) column.meta['links'].append(meta) @classmethod def from_table_column(cls, d): return cls(**d) class Info(SimpleElementWithContent, _IDProperty, _XtypeProperty, _UtypeProperty): """ INFO_ elements: arbitrary key-value pairs for extensions to the standard. The keyword arguments correspond to setting members of the same name, documented below. """ _element_name = 'INFO' _attr_list_11 = ['ID', 'name', 'value'] _attr_list_12 = _attr_list_11 + ['xtype', 'ref', 'unit', 'ucd', 'utype'] _utype_in_v1_2 = True def __init__(self, ID=None, name=None, value=None, id=None, xtype=None, ref=None, unit=None, ucd=None, utype=None, config={}, pos=None, **extra): self._config = config self._pos = pos SimpleElementWithContent.__init__(self) self.ID = (resolve_id(ID, id, config, pos) or xmlutil.fix_id(name, config, pos)) self.name = name self.value = value self.xtype = xtype self.ref = ref self.unit = unit self.ucd = ucd self.utype = utype if config.get('version_1_2_or_later'): self._attr_list = self._attr_list_12 else: self._attr_list = self._attr_list_11 if xtype is not None: warn_unknown_attrs('INFO', ['xtype'], config, pos) if ref is not None: warn_unknown_attrs('INFO', ['ref'], config, pos) if unit is not None: warn_unknown_attrs('INFO', ['unit'], config, pos) if ucd is not None: warn_unknown_attrs('INFO', ['ucd'], config, pos) if utype is not None: warn_unknown_attrs('INFO', ['utype'], config, pos) warn_unknown_attrs('INFO', six.iterkeys(extra), config, pos) @property def name(self): """[*required*] The key of the key-value pair.""" return self._name @name.setter def name(self, name): if name is None: warn_or_raise(W35, W35, ('name'), self._config, self._pos) xmlutil.check_token(name, 'name', self._config, self._pos) self._name = name @property def value(self): """ [*required*] The value of the key-value pair. (Always stored as a string or unicode string). """ return self._value @value.setter def value(self, value): if value is None: warn_or_raise(W35, W35, ('value'), self._config, self._pos) check_string(value, 'value', self._config, self._pos) self._value = value @property def content(self): """The content inside the INFO element.""" return self._content @content.setter def content(self, content): check_string(content, 'content', self._config, self._pos) self._content = content @content.deleter def content(self): self._content = None @property def ref(self): """ Refer to another INFO_ element by ID_, defined previously in the document. """ return self._ref @ref.setter def ref(self, ref): if ref is not None and not self._config.get('version_1_2_or_later'): warn_or_raise(W28, W28, ('ref', 'INFO', '1.2'), self._config, self._pos) xmlutil.check_id(ref, 'ref', self._config, self._pos) # TODO: actually apply the reference # if ref is not None: # try: # other = self._votable.get_values_by_id(ref, before=self) # except KeyError: # vo_raise( # "VALUES ref='%s', which has not already been defined." % # self.ref, self._config, self._pos, KeyError) # self.null = other.null # self.type = other.type # self.min = other.min # self.min_inclusive = other.min_inclusive # self.max = other.max # self.max_inclusive = other.max_inclusive # self._options[:] = other.options self._ref = ref @ref.deleter def ref(self): self._ref = None @property def unit(self): """A string specifying the units_ for the INFO_.""" return self._unit @unit.setter def unit(self, unit): if unit is None: self._unit = None return from ... import units as u if not self._config.get('version_1_2_or_later'): warn_or_raise(W28, W28, ('unit', 'INFO', '1.2'), self._config, self._pos) # First, parse the unit in the default way, so that we can # still emit a warning if the unit is not to spec. default_format = _get_default_unit_format(self._config) unit_obj = u.Unit( unit, format=default_format, parse_strict='silent') if isinstance(unit_obj, u.UnrecognizedUnit): warn_or_raise(W50, W50, (unit,), self._config, self._pos) format = _get_unit_format(self._config) if format != default_format: unit_obj = u.Unit( unit, format=format, parse_strict='silent') self._unit = unit_obj @unit.deleter def unit(self): self._unit = None def to_xml(self, w, **kwargs): attrib = w.object_attrs(self, self._attr_list) if 'unit' in attrib: attrib['unit'] = self.unit.to_string('cds') w.element(self._element_name, self._content, attrib=attrib) class Values(Element, _IDProperty): """ VALUES_ element: used within FIELD_ and PARAM_ elements to define the domain of values. The keyword arguments correspond to setting members of the same name, documented below. """ def __init__(self, votable, field, ID=None, null=None, ref=None, type="legal", id=None, config={}, pos=None, **extras): self._config = config self._pos = pos Element.__init__(self) self._votable = votable self._field = field self.ID = resolve_id(ID, id, config, pos) self.null = null self._ref = ref self.type = type self.min = None self.max = None self.min_inclusive = True self.max_inclusive = True self._options = [] warn_unknown_attrs('VALUES', six.iterkeys(extras), config, pos) @property def null(self): """ For integral datatypes, *null* is used to define the value used for missing values. """ return self._null @null.setter def null(self, null): if null is not None and isinstance(null, six.string_types): try: null_val = self._field.converter.parse_scalar( null, self._config, self._pos)[0] except: warn_or_raise(W36, W36, null, self._config, self._pos) null_val = self._field.converter.parse_scalar( '0', self._config, self._pos)[0] else: null_val = null self._null = null_val @null.deleter def null(self): self._null = None @property def type(self): """ [*required*] Defines the applicability of the domain defined by this VALUES_ element. Must be one of the following strings: - 'legal': The domain of this column applies in general to this datatype. (default) - 'actual': The domain of this column applies only to the data enclosed in the parent table. """ return self._type @type.setter def type(self, type): if type not in ('legal', 'actual'): vo_raise(E08, type, self._config, self._pos) self._type = type @property def ref(self): """ Refer to another VALUES_ element by ID_, defined previously in the document, for MIN/MAX/OPTION information. """ return self._ref @ref.setter def ref(self, ref): xmlutil.check_id(ref, 'ref', self._config, self._pos) if ref is not None: try: other = self._votable.get_values_by_id(ref, before=self) except KeyError: warn_or_raise(W43, W43, ('VALUES', self.ref), self._config, self._pos) ref = None else: self.null = other.null self.type = other.type self.min = other.min self.min_inclusive = other.min_inclusive self.max = other.max self.max_inclusive = other.max_inclusive self._options[:] = other.options self._ref = ref @ref.deleter def ref(self): self._ref = None @property def min(self): """ The minimum value of the domain. See :attr:`min_inclusive`. """ return self._min @min.setter def min(self, min): if hasattr(self._field, 'converter') and min is not None: self._min = self._field.converter.parse(min)[0] else: self._min = min @min.deleter def min(self): self._min = None @property def min_inclusive(self): """When `True`, the domain includes the minimum value.""" return self._min_inclusive @min_inclusive.setter def min_inclusive(self, inclusive): if inclusive == 'yes': self._min_inclusive = True elif inclusive == 'no': self._min_inclusive = False else: self._min_inclusive = bool(inclusive) @min_inclusive.deleter def min_inclusive(self): self._min_inclusive = True @property def max(self): """ The maximum value of the domain. See :attr:`max_inclusive`. """ return self._max @max.setter def max(self, max): if hasattr(self._field, 'converter') and max is not None: self._max = self._field.converter.parse(max)[0] else: self._max = max @max.deleter def max(self): self._max = None @property def max_inclusive(self): """When `True`, the domain includes the maximum value.""" return self._max_inclusive @max_inclusive.setter def max_inclusive(self, inclusive): if inclusive == 'yes': self._max_inclusive = True elif inclusive == 'no': self._max_inclusive = False else: self._max_inclusive = bool(inclusive) @max_inclusive.deleter def max_inclusive(self): self._max_inclusive = True @property def options(self): """ A list of string key-value tuples defining other OPTION elements for the domain. All options are ignored -- they are stored for round-tripping purposes only. """ return self._options def parse(self, iterator, config): if self.ref is not None: for start, tag, data, pos in iterator: if start: warn_or_raise(W44, W44, tag, config, pos) else: if tag != 'VALUES': warn_or_raise(W44, W44, tag, config, pos) break else: for start, tag, data, pos in iterator: if start: if tag == 'MIN': if 'value' not in data: vo_raise(E09, 'MIN', config, pos) self.min = data['value'] self.min_inclusive = data.get('inclusive', 'yes') warn_unknown_attrs( 'MIN', six.iterkeys(data), config, pos, ['value', 'inclusive']) elif tag == 'MAX': if 'value' not in data: vo_raise(E09, 'MAX', config, pos) self.max = data['value'] self.max_inclusive = data.get('inclusive', 'yes') warn_unknown_attrs( 'MAX', six.iterkeys(data), config, pos, ['value', 'inclusive']) elif tag == 'OPTION': if 'value' not in data: vo_raise(E09, 'OPTION', config, pos) xmlutil.check_token( data.get('name'), 'name', config, pos) self.options.append( (data.get('name'), data.get('value'))) warn_unknown_attrs( 'OPTION', six.iterkeys(data), config, pos, ['data', 'name']) elif tag == 'VALUES': break return self def is_defaults(self): # If there's nothing meaningful or non-default to write, # don't write anything. return (self.ref is None and self.null is None and self.ID is None and self.max is None and self.min is None and self.options == []) def to_xml(self, w, **kwargs): def yes_no(value): if value: return 'yes' return 'no' if self.is_defaults(): return if self.ref is not None: w.element('VALUES', attrib=w.object_attrs(self, ['ref'])) else: with w.tag('VALUES', attrib=w.object_attrs( self, ['ID', 'null', 'ref'])): if self.min is not None: w.element( 'MIN', value=self._field.converter.output(self.min, False), inclusive=yes_no(self.min_inclusive)) if self.max is not None: w.element( 'MAX', value=self._field.converter.output(self.max, False), inclusive=yes_no(self.max_inclusive)) for name, value in self.options: w.element( 'OPTION', name=name, value=value) def to_table_column(self, column): # Have the ref filled in here meta = {} for key in ['ID', 'null']: val = getattr(self, key, None) if val is not None: meta[key] = val if self.min is not None: meta['min'] = { 'value': self.min, 'inclusive': self.min_inclusive} if self.max is not None: meta['max'] = { 'value': self.max, 'inclusive': self.max_inclusive} if len(self.options): meta['options'] = dict(self.options) column.meta['values'] = meta def from_table_column(self, column): if not 'values' in column.meta: return meta = column.meta['values'] for key in ['ID', 'null']: val = meta.get(key, None) if val is not None: setattr(self, key, val) if 'min' in meta: self.min = meta['min']['value'] self.min_inclusive = meta['min']['inclusive'] if 'max' in meta: self.max = meta['max']['value'] self.max_inclusive = meta['max']['inclusive'] if 'options' in meta: self._options = list(meta['options'].items()) class Field(SimpleElement, _IDProperty, _NameProperty, _XtypeProperty, _UtypeProperty, _UcdProperty): """ FIELD_ element: describes the datatype of a particular column of data. The keyword arguments correspond to setting members of the same name, documented below. If *ID* is provided, it is used for the column name in the resulting recarray of the table. If no *ID* is provided, *name* is used instead. If neither is provided, an exception will be raised. """ _attr_list_11 = ['ID', 'name', 'datatype', 'arraysize', 'ucd', 'unit', 'width', 'precision', 'utype', 'ref'] _attr_list_12 = _attr_list_11 + ['xtype'] _element_name = 'FIELD' def __init__(self, votable, ID=None, name=None, datatype=None, arraysize=None, ucd=None, unit=None, width=None, precision=None, utype=None, ref=None, type=None, id=None, xtype=None, config={}, pos=None, **extra): self._config = config self._pos = pos SimpleElement.__init__(self) if config.get('version_1_2_or_later'): self._attr_list = self._attr_list_12 else: self._attr_list = self._attr_list_11 if xtype is not None: warn_unknown_attrs(self._element_name, ['xtype'], config, pos) # TODO: REMOVE ME ---------------------------------------- # This is a terrible hack to support Simple Image Access # Protocol results from archive.noao.edu. It creates a field # for the coordinate projection type of type "double", which # actually contains character data. We have to hack the field # to store character data, or we can't read it in. A warning # will be raised when this happens. if (not config.get('pedantic') and name == 'cprojection' and ID == 'cprojection' and ucd == 'VOX:WCS_CoordProjection' and datatype == 'double'): datatype = 'char' arraysize = '3' vo_warn(W40, (), config, pos) # ---------------------------------------- self.description = None self._votable = votable self.ID = (resolve_id(ID, id, config, pos) or xmlutil.fix_id(name, config, pos)) self.name = name if name is None: if (self._element_name == 'PARAM' and not config.get('version_1_1_or_later')): pass else: warn_or_raise(W15, W15, self._element_name, config, pos) self.name = self.ID if self._ID is None and name is None: vo_raise(W12, self._element_name, config, pos) datatype_mapping = { 'string' : 'char', 'unicodeString' : 'unicodeChar', 'int16' : 'short', 'int32' : 'int', 'int64' : 'long', 'float32' : 'float', 'float64' : 'double'} if datatype in datatype_mapping: warn_or_raise(W13, W13, (datatype, datatype_mapping[datatype]), config, pos) datatype = datatype_mapping[datatype] self.ref = ref self.datatype = datatype self.arraysize = arraysize self.ucd = ucd self.unit = unit self.width = width self.precision = precision self.utype = utype self.type = type self._links = HomogeneousList(Link) self.title = self.name self.values = Values(self._votable, self) self.xtype = xtype self._setup(config, pos) warn_unknown_attrs(self._element_name, six.iterkeys(extra), config, pos) @classmethod def uniqify_names(cls, fields): """ Make sure that all names and titles in a list of fields are unique, by appending numbers if necessary. """ unique = {} for field in fields: i = 2 new_id = field.ID while new_id in unique: new_id = field.ID + "_%d" % i i += 1 if new_id != field.ID: vo_warn(W32, (field.ID, new_id), field._config, field._pos) field.ID = new_id unique[new_id] = field.ID for field in fields: i = 2 if field.name is None: new_name = field.ID implicit = True else: new_name = field.name implicit = False if new_name != field.ID: while new_name in unique: new_name = field.name + " %d" % i i += 1 if (not implicit and new_name != field.name): vo_warn(W33, (field.name, new_name), field._config, field._pos) field._unique_name = new_name unique[new_name] = field.name def _setup(self, config, pos): if self.values._ref is not None: self.values.ref = self.values._ref self.converter = converters.get_converter(self, config, pos) @property def datatype(self): """ [*required*] The datatype of the column. Valid values (as defined by the spec) are: 'boolean', 'bit', 'unsignedByte', 'short', 'int', 'long', 'char', 'unicodeChar', 'float', 'double', 'floatComplex', or 'doubleComplex' Many VOTABLE files in the wild use 'string' instead of 'char', so that is also a valid option, though 'string' will always be converted to 'char' when writing the file back out. """ return self._datatype @datatype.setter def datatype(self, datatype): if datatype is None: if self._config.get('version_1_1_or_later'): warn_or_raise(E10, E10, self._element_name, self._config, self._pos) datatype = 'char' if datatype not in converters.converter_mapping: vo_raise(E06, (datatype, self.ID), self._config, self._pos) self._datatype = datatype @property def precision(self): """ Along with :attr:`width`, defines the `numerical accuracy`_ associated with the data. These values are used to limit the precision when writing floating point values back to the XML file. Otherwise, it is purely informational -- the Numpy recarray containing the data itself does not use this information. """ return self._precision @precision.setter def precision(self, precision): if precision is not None and not re.match(r"^[FE]?[0-9]+$", precision): vo_raise(E11, precision, self._config, self._pos) self._precision = precision @precision.deleter def precision(self): self._precision = None @property def width(self): """ Along with :attr:`precision`, defines the `numerical accuracy`_ associated with the data. These values are used to limit the precision when writing floating point values back to the XML file. Otherwise, it is purely informational -- the Numpy recarray containing the data itself does not use this information. """ return self._width @width.setter def width(self, width): if width is not None: width = int(width) if width <= 0: vo_raise(E12, width, self._config, self._pos) self._width = width @width.deleter def width(self): self._width = None # ref on FIELD and PARAM behave differently than elsewhere -- here # they're just informational, such as to refer to a coordinate # system. @property def ref(self): """ On FIELD_ elements, ref is used only for informational purposes, for example to refer to a COOSYS_ element. """ return self._ref @ref.setter def ref(self, ref): xmlutil.check_id(ref, 'ref', self._config, self._pos) self._ref = ref @ref.deleter def ref(self): self._ref = None @property def unit(self): """A string specifying the units_ for the FIELD_.""" return self._unit @unit.setter def unit(self, unit): if unit is None: self._unit = None return from ... import units as u # First, parse the unit in the default way, so that we can # still emit a warning if the unit is not to spec. default_format = _get_default_unit_format(self._config) unit_obj = u.Unit( unit, format=default_format, parse_strict='silent') if isinstance(unit_obj, u.UnrecognizedUnit): warn_or_raise(W50, W50, (unit,), self._config, self._pos) format = _get_unit_format(self._config) if format != default_format: unit_obj = u.Unit( unit, format=format, parse_strict='silent') self._unit = unit_obj @unit.deleter def unit(self): self._unit = None @property def arraysize(self): """ Specifies the size of the multidimensional array if this FIELD_ contains more than a single value. See `multidimensional arrays`_. """ return self._arraysize @arraysize.setter def arraysize(self, arraysize): if (arraysize is not None and not re.match(r"^([0-9]+x)*[0-9]*[*]?(s\W)?$", arraysize)): vo_raise(E13, arraysize, self._config, self._pos) self._arraysize = arraysize @arraysize.deleter def arraysize(self): self._arraysize = None @property def type(self): """ The type attribute on FIELD_ elements is reserved for future extensions. """ return self._type @type.setter def type(self, type): self._type = type @type.deleter def type(self): self._type = None @property def values(self): """ A :class:`Values` instance (or ``None``) defining the domain of the column. """ return self._values @values.setter def values(self, values): assert values is None or isinstance(values, Values) self._values = values @values.deleter def values(self): self._values = None @property def links(self): """ A list of :class:`Link` instances used to reference more details about the meaning of the FIELD_. This is purely informational and is not used by the `astropy.io.votable` package. """ return self._links def parse(self, iterator, config): for start, tag, data, pos in iterator: if start: if tag == 'VALUES': self.values.__init__( self._votable, self, config=config, pos=pos, **data) self.values.parse(iterator, config) elif tag == 'LINK': link = Link(config=config, pos=pos, **data) self.links.append(link) link.parse(iterator, config) elif tag == 'DESCRIPTION': warn_unknown_attrs( 'DESCRIPTION', six.iterkeys(data), config, pos) elif tag != self._element_name: self._add_unknown_tag(iterator, tag, data, config, pos) else: if tag == 'DESCRIPTION': if self.description is not None: warn_or_raise( W17, W17, self._element_name, config, pos) self.description = data or None elif tag == self._element_name: break if self.description is not None: self.title = " ".join(x.strip() for x in self.description.splitlines()) else: self.title = self.name self._setup(config, pos) return self def to_xml(self, w, **kwargs): attrib = w.object_attrs(self, self._attr_list) if 'unit' in attrib: attrib['unit'] = self.unit.to_string('cds') with w.tag(self._element_name, attrib=attrib): if self.description is not None: w.element('DESCRIPTION', self.description, wrap=True) if not self.values.is_defaults(): self.values.to_xml(w, **kwargs) for link in self.links: link.to_xml(w, **kwargs) def to_table_column(self, column): """ Sets the attributes of a given `astropy.table.Column` instance to match the information in this `Field`. """ for key in ['ucd', 'width', 'precision', 'utype', 'xtype']: val = getattr(self, key, None) if val is not None: column.meta[key] = val if not self.values.is_defaults(): self.values.to_table_column(column) for link in self.links: link.to_table_column(column) if self.description is not None: column.description = self.description if self.unit is not None: # TODO: Use units framework when it's available column.unit = self.unit if isinstance(self.converter, converters.FloatingPoint): column.format = self.converter.output_format @classmethod def from_table_column(cls, votable, column): """ Restores a `Field` instance from a given `astropy.table.Column` instance. """ kwargs = {} for key in ['ucd', 'width', 'precision', 'utype', 'xtype']: val = column.meta.get(key, None) if val is not None: kwargs[key] = val # TODO: Use the unit framework when available if column.unit is not None: kwargs['unit'] = column.unit kwargs['name'] = column.name result = converters.table_column_to_votable_datatype(column) kwargs.update(result) field = cls(votable, **kwargs) if column.description is not None: field.description = column.description field.values.from_table_column(column) if 'links' in column.meta: for link in column.meta['links']: field.links.append(Link.from_table_column(link)) # TODO: Parse format into precision and width return field class Param(Field): """ PARAM_ element: constant-valued columns in the data. :class:`Param` objects are a subclass of :class:`Field`, and have all of its methods and members. Additionally, it defines :attr:`value`. """ _attr_list_11 = Field._attr_list_11 + ['value'] _attr_list_12 = Field._attr_list_12 + ['value'] _element_name = 'PARAM' def __init__(self, votable, ID=None, name=None, value=None, datatype=None, arraysize=None, ucd=None, unit=None, width=None, precision=None, utype=None, type=None, id=None, config={}, pos=None, **extra): self._value = value Field.__init__(self, votable, ID=ID, name=name, datatype=datatype, arraysize=arraysize, ucd=ucd, unit=unit, precision=precision, utype=utype, type=type, id=id, config=config, pos=pos, **extra) @property def value(self): """ [*required*] The constant value of the parameter. Its type is determined by the :attr:`~Field.datatype` member. """ return self._value @value.setter def value(self, value): if value is None: value = "" if ((six.PY3 and isinstance(value, six.text_type)) or (not six.PY3 and isinstance(value, six.string_types))): self._value = self.converter.parse( value, self._config, self._pos)[0] else: self._value = value def _setup(self, config, pos): Field._setup(self, config, pos) self.value = self._value def to_xml(self, w, **kwargs): tmp_value = self._value self._value = self.converter.output(tmp_value, False) # We must always have a value if self._value is None: self._value = "" Field.to_xml(self, w, **kwargs) self._value = tmp_value class CooSys(SimpleElement): """ COOSYS_ element: defines a coordinate system. The keyword arguments correspond to setting members of the same name, documented below. """ _attr_list = ['ID', 'equinox', 'epoch', 'system'] _element_name = 'COOSYS' def __init__(self, ID=None, equinox=None, epoch=None, system=None, id=None, config={}, pos=None, **extra): self._config = config self._pos = pos if config.get('version_1_2_or_later'): warn_or_raise(W27, W27, (), config, pos) SimpleElement.__init__(self) self.ID = resolve_id(ID, id, config, pos) self.equinox = equinox self.epoch = epoch self.system = system warn_unknown_attrs('COOSYS', six.iterkeys(extra), config, pos) @property def ID(self): """ [*required*] The XML ID of the COOSYS_ element, used for cross-referencing. May be ``None`` or a string conforming to XML ID_ syntax. """ return self._ID @ID.setter def ID(self, ID): if self._config.get('version_1_1_or_later'): if ID is None: vo_raise(E15, (), self._config, self._pos) xmlutil.check_id(ID, 'ID', self._config, self._pos) self._ID = ID @property def system(self): """ Specifies the type of coordinate system. Valid choices are: 'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic', 'supergalactic', 'xy', 'barycentric', or 'geo_app' """ return self._system @system.setter def system(self, system): if system not in ('eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic', 'supergalactic', 'xy', 'barycentric', 'geo_app'): warn_or_raise(E16, E16, system, self._config, self._pos) self._system = system @system.deleter def system(self): self._system = None @property def equinox(self): """ A parameter required to fix the equatorial or ecliptic systems (as e.g. "J2000" as the default "eq_FK5" or "B1950" as the default "eq_FK4"). """ return self._equinox @equinox.setter def equinox(self, equinox): check_astroyear(equinox, 'equinox', self._config, self._pos) self._equinox = equinox @equinox.deleter def equinox(self): self._equinox = None @property def epoch(self): """ Specifies the epoch of the positions. It must be a string specifying an astronomical year. """ return self._epoch @epoch.setter def epoch(self, epoch): check_astroyear(epoch, 'epoch', self._config, self._pos) self._epoch = epoch @epoch.deleter def epoch(self): self._epoch = None class FieldRef(SimpleElement, _UtypeProperty, _UcdProperty): """ FIELDref_ element: used inside of GROUP_ elements to refer to remote FIELD_ elements. """ _attr_list_11 = ['ref'] _attr_list_12 = _attr_list_11 + ['ucd', 'utype'] _element_name = "FIELDref" _utype_in_v1_2 = True _ucd_in_v1_2 = True def __init__(self, table, ref, ucd=None, utype=None, config={}, pos=None, **extra): """ *table* is the :class:`Table` object that this :class:`FieldRef` is a member of. *ref* is the ID to reference a :class:`Field` object defined elsewhere. """ self._config = config self._pos = pos SimpleElement.__init__(self) self._table = table self.ref = ref self.ucd = ucd self.utype = utype if config.get('version_1_2_or_later'): self._attr_list = self._attr_list_12 else: self._attr_list = self._attr_list_11 if ucd is not None: warn_unknown_attrs(self._element_name, ['ucd'], config, pos) if utype is not None: warn_unknown_attrs(self._element_name, ['utype'], config, pos) @property def ref(self): """The ID_ of the FIELD_ that this FIELDref_ references.""" return self._ref @ref.setter def ref(self, ref): xmlutil.check_id(ref, 'ref', self._config, self._pos) self._ref = ref @ref.deleter def ref(self): self._ref = None def get_ref(self): """ Lookup the :class:`Field` instance that this :class:`FieldRef` references. """ for field in self._table._votable.iter_fields_and_params(): if isinstance(field, Field) and field.ID == self.ref: return field vo_raise( "No field named '%s'" % self.ref, self._config, self._pos, KeyError) class ParamRef(SimpleElement, _UtypeProperty, _UcdProperty): """ PARAMref_ element: used inside of GROUP_ elements to refer to remote PARAM_ elements. The keyword arguments correspond to setting members of the same name, documented below. It contains the following publicly-accessible members: *ref*: An XML ID refering to a element. """ _attr_list_11 = ['ref'] _attr_list_12 = _attr_list_11 + ['ucd', 'utype'] _element_name = "PARAMref" _utype_in_v1_2 = True _ucd_in_v1_2 = True def __init__(self, table, ref, ucd=None, utype=None, config={}, pos=None): self._config = config self._pos = pos Element.__init__(self) self._table = table self.ref = ref self.ucd = ucd self.utype = utype if config.get('version_1_2_or_later'): self._attr_list = self._attr_list_12 else: self._attr_list = self._attr_list_11 if ucd is not None: warn_unknown_attrs(self._element_name, ['ucd'], config, pos) if utype is not None: warn_unknown_attrs(self._element_name, ['utype'], config, pos) @property def ref(self): """The ID_ of the PARAM_ that this PARAMref_ references.""" return self._ref @ref.setter def ref(self, ref): xmlutil.check_id(ref, 'ref', self._config, self._pos) self._ref = ref @ref.deleter def ref(self): self._ref = None def get_ref(self): """ Lookup the :class:`Param` instance that this :class:`PARAMref` references. """ for param in self._table._votable.iter_fields_and_params(): if isinstance(param, Param) and param.ID == self.ref: return param vo_raise( "No params named '%s'" % self.ref, self._config, self._pos, KeyError) class Group(Element, _IDProperty, _NameProperty, _UtypeProperty, _UcdProperty, _DescriptionProperty): """ GROUP_ element: groups FIELD_ and PARAM_ elements. This information is currently ignored by the vo package---that is the columns in the recarray are always flat---but the grouping information is stored so that it can be written out again to the XML file. The keyword arguments correspond to setting members of the same name, documented below. """ def __init__(self, table, ID=None, name=None, ref=None, ucd=None, utype=None, id=None, config={}, pos=None, **extra): self._config = config self._pos = pos Element.__init__(self) self._table = table self.ID = (resolve_id(ID, id, config, pos) or xmlutil.fix_id(name, config, pos)) self.name = name self.ref = ref self.ucd = ucd self.utype = utype self.description = None self._entries = HomogeneousList( (FieldRef, ParamRef, Group, Param)) warn_unknown_attrs('GROUP', six.iterkeys(extra), config, pos) @property def ref(self): """ Currently ignored, as it's not clear from the spec how this is meant to work. """ return self._ref @ref.setter def ref(self, ref): xmlutil.check_id(ref, 'ref', self._config, self._pos) self._ref = ref @ref.deleter def ref(self): self._ref = None @property def entries(self): """ [read-only] A list of members of the GROUP_. This list may only contain objects of type :class:`Param`, :class:`Group`, :class:`ParamRef` and :class:`FieldRef`. """ return self._entries def _add_fieldref(self, iterator, tag, data, config, pos): fieldref = FieldRef(self._table, config=config, pos=pos, **data) self.entries.append(fieldref) def _add_paramref(self, iterator, tag, data, config, pos): paramref = ParamRef(self._table, config=config, pos=pos, **data) self.entries.append(paramref) def _add_param(self, iterator, tag, data, config, pos): if isinstance(self._table, VOTableFile): votable = self._table else: votable = self._table._votable param = Param(votable, config=config, pos=pos, **data) self.entries.append(param) param.parse(iterator, config) def _add_group(self, iterator, tag, data, config, pos): group = Group(self._table, config=config, pos=pos, **data) self.entries.append(group) group.parse(iterator, config) def parse(self, iterator, config): tag_mapping = { 'FIELDref' : self._add_fieldref, 'PARAMref' : self._add_paramref, 'PARAM' : self._add_param, 'GROUP' : self._add_group, 'DESCRIPTION' : self._ignore_add} for start, tag, data, pos in iterator: if start: tag_mapping.get(tag, self._add_unknown_tag)( iterator, tag, data, config, pos) else: if tag == 'DESCRIPTION': if self.description is not None: warn_or_raise(W17, W17, 'GROUP', config, pos) self.description = data or None elif tag == 'GROUP': break return self def to_xml(self, w, **kwargs): with w.tag( 'GROUP', attrib=w.object_attrs( self, ['ID', 'name', 'ref', 'ucd', 'utype'])): if self.description is not None: w.element("DESCRIPTION", self.description, wrap=True) for entry in self.entries: entry.to_xml(w, **kwargs) def iter_fields_and_params(self): """ Recursively iterate over all :class:`Param` elements in this :class:`Group`. """ for entry in self.entries: if isinstance(entry, Param): yield entry elif isinstance(entry, Group): for field in entry.iter_fields_and_params(): yield field def iter_groups(self): """ Recursively iterate over all sub-:class:`Group` instances in this :class:`Group`. """ for entry in self.entries: if isinstance(entry, Group): yield entry for group in entry.iter_groups(): yield group class Table(Element, _IDProperty, _NameProperty, _UcdProperty, _DescriptionProperty): """ TABLE_ element: optionally contains data. It contains the following publicly-accessible and mutable attribute: *array*: A Numpy masked array of the data itself, where each row is a row of votable data, and columns are named and typed based on the elements of the table. The mask is parallel to the data array, except for variable-length fields. For those fields, the numpy array's column type is "object" (``"O"``), and another masked array is stored there. If the Table contains no data, (for example, its enclosing :class:`Resource` has :attr:`~Resource.type` == 'meta') *array* will have zero-length. The keyword arguments correspond to setting members of the same name, documented below. """ def __init__(self, votable, ID=None, name=None, ref=None, ucd=None, utype=None, nrows=None, id=None, config={}, pos=None, **extra): self._config = config self._pos = pos self._empty = False Element.__init__(self) self._votable = votable self.ID = (resolve_id(ID, id, config, pos) or xmlutil.fix_id(name, config, pos)) self.name = name xmlutil.check_id(ref, 'ref', config, pos) self._ref = ref self.ucd = ucd self.utype = utype if nrows is not None: nrows = int(nrows) assert nrows >= 0 self._nrows = nrows self.description = None self.format = 'tabledata' self._fields = HomogeneousList(Field) self._params = HomogeneousList(Param) self._groups = HomogeneousList(Group) self._links = HomogeneousList(Link) self._infos = HomogeneousList(Info) self.array = ma.array([]) warn_unknown_attrs('TABLE', six.iterkeys(extra), config, pos) @property def ref(self): return self._ref @ref.setter def ref(self, ref): """ Refer to another TABLE, previously defined, by the *ref* ID_ for all metadata (FIELD_, PARAM_ etc.) information. """ # When the ref changes, we want to verify that it will work # by actually going and looking for the referenced table. # If found, set a bunch of properties in this table based # on the other one. xmlutil.check_id(ref, 'ref', self._config, self._pos) if ref is not None: try: table = self._votable.get_table_by_id(ref, before=self) except KeyError: warn_or_raise( W43, W43, ('TABLE', self.ref), self._config, self._pos) ref = None else: self._fields = table.fields self._params = table.params self._groups = table.groups self._links = table.links else: del self._fields[:] del self._params[:] del self._groups[:] del self._links[:] self._ref = ref @ref.deleter def ref(self): self._ref = None @property def format(self): """ [*required*] The serialization format of the table. Must be one of: 'tabledata' (TABLEDATA_), 'binary' (BINARY_), 'binary2' (BINARY2_) 'fits' (FITS_). Note that the 'fits' format, since it requires an external file, can not be written out. Any file read in with 'fits' format will be read out, by default, in 'tabledata' format. """ return self._format @format.setter def format(self, format): format = format.lower() if format == 'fits': vo_raise("fits format can not be written out, only read.", self._config, self._pos, NotImplementedError) if format == 'binary2': if not self._config['version_1_3_or_later']: vo_raise( "binary2 only supported in votable 1.3 or later", self._config, self._pos) elif format not in ('tabledata', 'binary'): vo_raise("Invalid format '%s'" % format, self._config, self._pos) self._format = format @property def nrows(self): """ [*immutable*] The number of rows in the table, as specified in the XML file. """ return self._nrows @property def fields(self): """ A list of :class:`Field` objects describing the types of each of the data columns. """ return self._fields @property def params(self): """ A list of parameters (constant-valued columns) for the table. Must contain only :class:`Param` objects. """ return self._params @property def groups(self): """ A list of :class:`Group` objects describing how the columns and parameters are grouped. Currently this information is only kept around for round-tripping and informational purposes. """ return self._groups @property def links(self): """ A list of :class:`Link` objects (pointers to other documents or servers through a URI) for the table. """ return self._links @property def infos(self): """ A list of :class:`Info` objects for the table. Allows for post-operational diagnostics. """ return self._infos def is_empty(self): """ Returns True if this table doesn't contain any real data because it was skipped over by the parser (through use of the `table_number` kwarg). """ return self._empty def create_arrays(self, nrows=0, config={}): """ Create a new array to hold the data based on the current set of fields, and store them in the *array* and member variable. Any data in the existing array will be lost. *nrows*, if provided, is the number of rows to allocate. """ if nrows is None: nrows = 0 fields = self.fields if len(fields) == 0: array = np.recarray((nrows,), dtype='O') mask = np.zeros((nrows,), dtype='b') else: # for field in fields: field._setup(config) Field.uniqify_names(fields) dtype = [] for x in fields: if six.PY3: if x._unique_name == x.ID: id = x.ID else: id = (x._unique_name, x.ID) else: if x._unique_name == x.ID: id = x.ID.encode('utf-8') else: id = (x._unique_name.encode('utf-8'), x.ID.encode('utf-8')) dtype.append((id, x.converter.format)) array = np.recarray((nrows,), dtype=np.dtype(dtype)) descr_mask = [] for d in array.dtype.descr: new_type = (d[1][1] == 'O' and 'O') or 'bool' if len(d) == 2: descr_mask.append((d[0], new_type)) elif len(d) == 3: descr_mask.append((d[0], new_type, d[2])) mask = np.zeros((nrows,), dtype=descr_mask) self.array = ma.array(array, mask=mask) def _resize_strategy(self, size): """ Return a new (larger) size based on size, used for reallocating an array when it fills up. This is in its own function so the resizing strategy can be easily replaced. """ # Once we go beyond 0, make a big step -- after that use a # factor of 1.5 to help keep memory usage compact if size == 0: return 512 return int(np.ceil(size * RESIZE_AMOUNT)) def _add_field(self, iterator, tag, data, config, pos): field = Field(self._votable, config=config, pos=pos, **data) self.fields.append(field) field.parse(iterator, config) def _add_param(self, iterator, tag, data, config, pos): param = Param(self._votable, config=config, pos=pos, **data) self.params.append(param) param.parse(iterator, config) def _add_group(self, iterator, tag, data, config, pos): group = Group(self, config=config, pos=pos, **data) self.groups.append(group) group.parse(iterator, config) def _add_link(self, iterator, tag, data, config, pos): link = Link(config=config, pos=pos, **data) self.links.append(link) link.parse(iterator, config) def _add_info(self, iterator, tag, data, config, pos): if not config.get('version_1_2_or_later'): warn_or_raise(W26, W26, ('INFO', 'TABLE', '1.2'), config, pos) info = Info(config=config, pos=pos, **data) self.infos.append(info) info.parse(iterator, config) def parse(self, iterator, config): columns = config.get('columns') # If we've requested to read in only a specific table, skip # all others table_number = config.get('table_number') current_table_number = config.get('_current_table_number') skip_table = False if current_table_number is not None: config['_current_table_number'] += 1 if (table_number is not None and table_number != current_table_number): skip_table = True self._empty = True table_id = config.get('table_id') if table_id is not None: if table_id != self.ID: skip_table = True self._empty = True if self.ref is not None: # This table doesn't have its own datatype descriptors, it # just references those from another table. # This is to call the property setter to go and get the # referenced information self.ref = self.ref for start, tag, data, pos in iterator: if start: if tag == 'DATA': warn_unknown_attrs( 'DATA', six.iterkeys(data), config, pos) break else: if tag == 'TABLE': return self elif tag == 'DESCRIPTION': if self.description is not None: warn_or_raise(W17, W17, 'RESOURCE', config, pos) self.description = data or None else: tag_mapping = { 'FIELD' : self._add_field, 'PARAM' : self._add_param, 'GROUP' : self._add_group, 'LINK' : self._add_link, 'INFO' : self._add_info, 'DESCRIPTION' : self._ignore_add} for start, tag, data, pos in iterator: if start: if tag == 'DATA': warn_unknown_attrs( 'DATA', six.iterkeys(data), config, pos) break tag_mapping.get(tag, self._add_unknown_tag)( iterator, tag, data, config, pos) else: if tag == 'DESCRIPTION': if self.description is not None: warn_or_raise(W17, W17, 'RESOURCE', config, pos) self.description = data or None elif tag == 'TABLE': # For error checking purposes Field.uniqify_names(self.fields) return self self.create_arrays(nrows=self._nrows, config=config) fields = self.fields names = [x.ID for x in fields] # Deal with a subset of the columns, if requested. if not columns: colnumbers = list(range(len(fields))) else: if isinstance(columns, six.string_types): columns = [columns] columns = np.asarray(columns) if issubclass(columns.dtype.type, np.integer): if np.any(columns < 0) or np.any(columns > len(fields)): raise ValueError( "Some specified column numbers out of range") colnumbers = columns elif issubclass(columns.dtype.type, np.character): try: colnumbers = [names.index(x) for x in columns] except ValueError: raise ValueError( "Columns '%s' not found in fields list" % columns) else: raise TypeError("Invalid columns list") if not skip_table: for start, tag, data, pos in iterator: if start: if tag == 'TABLEDATA': warn_unknown_attrs( 'TABLEDATA', six.iterkeys(data), config, pos) self.array = self._parse_tabledata( iterator, colnumbers, fields, config) break elif tag == 'BINARY': warn_unknown_attrs( 'BINARY', six.iterkeys(data), config, pos) self.array = self._parse_binary( 1, iterator, colnumbers, fields, config, pos) break elif tag == 'BINARY2': if not config['version_1_3_or_later']: warn_or_raise( W52, W52, config['version'], config, pos) self.array = self._parse_binary( 2, iterator, colnumbers, fields, config, pos) break elif tag == 'FITS': warn_unknown_attrs( 'FITS', six.iterkeys(data), config, pos, ['extnum']) try: extnum = int(data.get('extnum', 0)) if extnum < 0: raise ValueError() except ValueError: vo_raise(E17, (), config, pos) self.array = self._parse_fits( iterator, extnum, config) break else: warn_or_raise(W37, W37, tag, config, pos) break for start, tag, data, pos in iterator: if not start and tag == 'DATA': break for start, tag, data, pos in iterator: if start and tag == 'INFO': if not config.get('version_1_2_or_later'): warn_or_raise( W26, W26, ('INFO', 'TABLE', '1.2'), config, pos) info = Info(config=config, pos=pos, **data) self.infos.append(info) info.parse(iterator, config) elif not start and tag == 'TABLE': break return self def _parse_tabledata(self, iterator, colnumbers, fields, config): # Since we don't know the number of rows up front, we'll # reallocate the record array to make room as we go. This # prevents the need to scan through the XML twice. The # allocation is by factors of 1.5. invalid = config.get('invalid', 'exception') # Need to have only one reference so that we can resize the # array array = self.array del self.array parsers = [field.converter.parse for field in fields] binparsers = [field.converter.binparse for field in fields] numrows = 0 alloc_rows = len(array) colnumbers_bits = [i in colnumbers for i in range(len(fields))] row_default = [x.converter.default for x in fields] mask_default = [True] * len(fields) array_chunk = [] mask_chunk = [] chunk_size = config.get('chunk_size', DEFAULT_CHUNK_SIZE) for start, tag, data, pos in iterator: if tag == 'TR': # Now parse one row row = row_default[:] row_mask = mask_default[:] i = 0 for start, tag, data, pos in iterator: if start: binary = (data.get('encoding', None) == 'base64') warn_unknown_attrs( tag, six.iterkeys(data), config, pos, ['encoding']) else: if tag == 'TD': if i >= len(fields): vo_raise(E20, len(fields), config, pos) if colnumbers_bits[i]: try: if binary: rawdata = base64.b64decode( data.encode('ascii')) buf = io.BytesIO(rawdata) buf.seek(0) try: value, mask_value = binparsers[i]( buf.read) except Exception as e: vo_reraise( e, config, pos, "(in row %d, col '%s')" % (len(array_chunk), fields[i].ID)) else: try: value, mask_value = parsers[i]( data, config, pos) except Exception as e: vo_reraise( e, config, pos, "(in row %d, col '%s')" % (len(array_chunk), fields[i].ID)) except Exception as e: if invalid == 'exception': vo_reraise(e, config, pos) else: row[i] = value row_mask[i] = mask_value elif tag == 'TR': break else: self._add_unknown_tag( iterator, tag, data, config, pos) i += 1 if i < len(fields): vo_raise(E21, (i, len(fields)), config, pos) array_chunk.append(tuple(row)) mask_chunk.append(tuple(row_mask)) if len(array_chunk) == chunk_size: while numrows + chunk_size > alloc_rows: alloc_rows = self._resize_strategy(alloc_rows) if alloc_rows != len(array): array = _resize(array, alloc_rows) array[numrows:numrows + chunk_size] = array_chunk array.mask[numrows:numrows + chunk_size] = mask_chunk numrows += chunk_size array_chunk = [] mask_chunk = [] elif not start and tag == 'TABLEDATA': break # Now, resize the array to the exact number of rows we need and # put the last chunk values in there. alloc_rows = numrows + len(array_chunk) array = _resize(array, alloc_rows) array[numrows:] = array_chunk if alloc_rows != 0: array.mask[numrows:] = mask_chunk numrows += len(array_chunk) if (self.nrows is not None and self.nrows >= 0 and self.nrows != numrows): warn_or_raise(W18, W18, (self.nrows, numrows), config, pos) self._nrows = numrows return array def _get_binary_data_stream(self, iterator, config): have_local_stream = False for start, tag, data, pos in iterator: if tag == 'STREAM': if start: warn_unknown_attrs( 'STREAM', six.iterkeys(data), config, pos, ['type', 'href', 'actuate', 'encoding', 'expires', 'rights']) if 'href' not in data: have_local_stream = True if data.get('encoding', None) != 'base64': warn_or_raise( W38, W38, data.get('encoding', None), config, pos) else: href = data['href'] xmlutil.check_anyuri(href, config, pos) encoding = data.get('encoding', None) else: buffer = data break if have_local_stream: buffer = base64.b64decode(buffer.encode('ascii')) string_io = io.BytesIO(buffer) string_io.seek(0) read = string_io.read else: if not (href.startswith('http') or href.startswith('ftp') or href.startswith('file')): vo_raise( "The vo package only supports remote data through http, " + "ftp or file", self._config, self._pos, NotImplementedError) fd = urllib.request.urlopen(href) if encoding is not None: if encoding == 'gzip': from ...utils.compat import gzip fd = gzip.GzipFile(href, 'rb', fileobj=fd) elif encoding == 'base64': fd = codecs.EncodedFile(fd, 'base64') else: vo_raise( "Unknown encoding type '%s'" % encoding, self._config, self._pos, NotImplementedError) read = fd.read def careful_read(length): result = read(length) if len(result) != length: raise EOFError return result return careful_read def _parse_binary(self, mode, iterator, colnumbers, fields, config, pos): fields = self.fields careful_read = self._get_binary_data_stream(iterator, config) # Need to have only one reference so that we can resize the # array array = self.array del self.array binparsers = [field.converter.binparse for field in fields] numrows = 0 alloc_rows = len(array) while True: # Resize result arrays if necessary if numrows >= alloc_rows: alloc_rows = self._resize_strategy(alloc_rows) array = _resize(array, alloc_rows) row_data = [] row_mask_data = [] try: if mode == 2: mask_bits = careful_read(int((len(fields) + 7) / 8)) row_mask_data = list(converters.bitarray_to_bool( mask_bits, len(fields))) for i, binparse in enumerate(binparsers): try: value, value_mask = binparse(careful_read) except EOFError: raise except Exception as e: vo_reraise(e, config, pos, "(in row %d, col '%s')" % (numrows, fields[i].ID)) row_data.append(value) if mode == 1: row_mask_data.append(value_mask) else: row_mask_data[i] = row_mask_data[i] or value_mask except EOFError: break row = [x.converter.default for x in fields] row_mask = [False] * len(fields) for i in colnumbers: row[i] = row_data[i] row_mask[i] = row_mask_data[i] array[numrows] = tuple(row) array.mask[numrows] = tuple(row_mask) numrows += 1 array = _resize(array, numrows) return array def _parse_fits(self, iterator, extnum, config): for start, tag, data, pos in iterator: if tag == 'STREAM': if start: warn_unknown_attrs( 'STREAM', six.iterkeys(data), config, pos, ['type', 'href', 'actuate', 'encoding', 'expires', 'rights']) href = data['href'] encoding = data.get('encoding', None) else: break if not (href.startswith('http') or href.startswith('ftp') or href.startswith('file')): vo_raise( "The vo package only supports remote data through http, " "ftp or file", self._config, self._pos, NotImplementedError) fd = urllib.request.urlopen(href) if encoding is not None: if encoding == 'gzip': from ...utils.compat import gzip fd = gzip.GzipFile(href, 'r', fileobj=fd) elif encoding == 'base64': fd = codecs.EncodedFile(fd, 'base64') else: vo_raise( "Unknown encoding type '%s'" % encoding, self._config, self._pos, NotImplementedError) hdulist = fits.open(fd) array = hdulist[int(extnum)].data if array.dtype != self.array.dtype: warn_or_raise(W19, W19, (), self._config, self._pos) return array def to_xml(self, w, **kwargs): with w.tag( 'TABLE', attrib=w.object_attrs( self, ('ID', 'name', 'ref', 'ucd', 'utype', 'nrows'))): if self.description is not None: w.element("DESCRIPTION", self.description, wrap=True) for element_set in (self.fields, self.params): for element in element_set: element._setup({}, None) if self.ref is None: for element_set in (self.fields, self.params, self.groups, self.links): for element in element_set: element.to_xml(w, **kwargs) elif kwargs['version_1_2_or_later']: index = list(self._votable.iter_tables()).index(self) group = Group(self, ID="_g{0}".format(index)) group.to_xml(w, **kwargs) if len(self.array): with w.tag('DATA'): if self.format == 'fits': self.format = 'tabledata' if self.format == 'tabledata': self._write_tabledata(w, **kwargs) elif self.format == 'binary': self._write_binary(1, w, **kwargs) elif self.format == 'binary2': self._write_binary(2, w, **kwargs) if kwargs['version_1_2_or_later']: for element in self._infos: element.to_xml(w, **kwargs) def _write_tabledata(self, w, **kwargs): fields = self.fields array = self.array write_null_values = kwargs.get('write_null_values', False) with w.tag('TABLEDATA'): w._flush() if (_has_c_tabledata_writer and not kwargs.get('_debug_python_based_parser')): fields = [field.converter.output for field in fields] indent = len(w._tags) - 1 tablewriter.write_tabledata( w.write, array.data, array.mask, fields, write_null_values, indent, 1 << 8) else: write = w.write indent_spaces = w.get_indentation_spaces() tr_start = indent_spaces + "\n" tr_end = indent_spaces + "\n" td = indent_spaces + " %s\n" td_empty = indent_spaces + " \n" fields = [(i, field.converter.output) for i, field in enumerate(fields)] for row in xrange(len(array)): write(tr_start) array_row = array.data[row] mask_row = array.mask[row] for i, output in fields: data = array_row[i] masked = mask_row[i] if (not np.all(masked) or write_null_values): try: val = output(data, masked) except Exception as e: vo_reraise(e, additional="(in row %d, col '%s')" % (row, self.fields[i].ID)) if len(val): write(td % val) else: write(td_empty) else: write(td_empty) write(tr_end) def _write_binary(self, mode, w, **kwargs): fields = self.fields array = self.array if mode == 1: tag_name = 'BINARY' else: tag_name = 'BINARY2' with w.tag(tag_name): with w.tag('STREAM', encoding='base64'): fields_basic = [(i, field.converter.binoutput) for (i, field) in enumerate(fields)] data = io.BytesIO() for row in xrange(len(array)): array_row = array.data[row] array_mask = array.mask[row] if mode == 2: flattened = np.array([np.all(x) for x in array_mask]) data.write(converters.bool_to_bitarray(flattened)) for i, converter in fields_basic: try: chunk = converter(array_row[i], array_mask[i]) assert type(chunk) == type(b'') except Exception as e: vo_reraise(e, additional="(in row %d, col '%s')" % (row, fields[i].ID)) data.write(chunk) w._flush() w.write(base64.b64encode(data.getvalue()).decode('ascii')) def to_table(self, use_names_over_ids=False): """ Convert this VO Table to an `astropy.table.Table` instance. Parameters ---------- use_names_over_ids : bool, optional When `True` use the `name` attributes of columns as the names of columns in the `astropy.table.Table` instance. Since names are not guaranteed to be unique, this may cause some columns to be renamed by appending numbers to the end. Otherwise (default), use the ID attributes as the column names. .. warning:: Variable-length array fields may not be restored identically when round-tripping through the `astropy.table.Table` instance. """ from ...table import Table meta = {} for key in ['ID', 'name', 'ref', 'ucd', 'utype', 'description']: val = getattr(self, key, None) if val is not None: meta[key] = val if use_names_over_ids: names = [field.name for field in self.fields] unique_names = [] for i, name in enumerate(names): new_name = name i = 2 while new_name in unique_names: new_name = '{0}{1}'.format(name, i) i += 1 if sys.version_info[0] < 3: new_name = new_name.encode( sys.getdefaultencoding(), 'replace') unique_names.append(new_name) array = self.array.copy() array.dtype.names = unique_names names = unique_names else: array = self.array names = [field.ID for field in self.fields] table = Table(self.array, meta=meta) for name, field in zip(names, self.fields): column = table[name] field.to_table_column(column) return table @classmethod def from_table(cls, votable, table): """ Create a `Table` instance from a given `astropy.table.Table` instance. """ kwargs = {} for key in ['ID', 'name', 'ref', 'ucd', 'utype']: val = table.meta.get(key) if val is not None: kwargs[key] = val new_table = cls(votable, **kwargs) if 'description' in table.meta: new_table.description = table.meta['description'] for colname in table.colnames: column = table[colname] new_table.fields.append(Field.from_table_column(votable, column)) if table.mask is None: new_table.array = ma.array(np.asarray(table)) else: new_table.array = ma.array(np.asarray(table), mask=table.mask) return new_table def iter_fields_and_params(self): """ Recursively iterate over all FIELD and PARAM elements in the TABLE. """ for param in self.params: yield param for field in self.fields: yield field for group in self.groups: for field in group.iter_fields_and_params(): yield field get_field_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_fields_and_params', 'FIELD or PARAM', """ Looks up a FIELD or PARAM element by the given ID. """) get_field_by_id_or_name = _lookup_by_id_or_name_factory( 'iter_fields_and_params', 'FIELD or PARAM', """ Looks up a FIELD or PARAM element by the given ID or name. """) get_fields_by_utype = _lookup_by_attr_factory( 'utype', False, 'iter_fields_and_params', 'FIELD or PARAM', """ Looks up a FIELD or PARAM element by the given utype and returns an iterator emitting all matches. """) def iter_groups(self): """ Recursively iterate over all GROUP elements in the TABLE. """ for group in self.groups: yield group for g in group.iter_groups(): yield g get_group_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_groups', 'GROUP', """ Looks up a GROUP element by the given ID. Used by the group's "ref" attribute """) get_groups_by_utype = _lookup_by_attr_factory( 'utype', False, 'iter_groups', 'GROUP', """ Looks up a GROUP element by the given utype and returns an iterator emitting all matches. """) class Resource(Element, _IDProperty, _NameProperty, _UtypeProperty, _DescriptionProperty): """ RESOURCE_ element: Groups TABLE_ and RESOURCE_ elements. The keyword arguments correspond to setting members of the same name, documented below. """ def __init__(self, name=None, ID=None, utype=None, type='results', id=None, config={}, pos=None, **kwargs): self._config = config self._pos = pos Element.__init__(self) self.name = name self.ID = resolve_id(ID, id, config, pos) self.utype = utype self.type = type self._extra_attributes = kwargs self.description = None self._coordinate_systems = HomogeneousList(CooSys) self._params = HomogeneousList(Param) self._infos = HomogeneousList(Info) self._links = HomogeneousList(Link) self._tables = HomogeneousList(Table) self._resources = HomogeneousList(Resource) warn_unknown_attrs('RESOURCE', six.iterkeys(kwargs), config, pos) @property def type(self): """ [*required*] The type of the resource. Must be either: - 'results': This resource contains actual result values (default) - 'meta': This resource contains only datatype descriptions (FIELD_ elements), but no actual data. """ return self._type @type.setter def type(self, type): if type not in ('results', 'meta'): vo_raise(E18, type, self._config, self._pos) self._type = type @property def extra_attributes(self): """ A dictionary of string keys to string values containing any extra attributes of the RESOURCE_ element that are not defined in the specification. (The specification explicitly allows for extra attributes here, but nowhere else.) """ return self._extra_attributes @property def coordinate_systems(self): """ A list of coordinate system definitions (COOSYS_ elements) for the RESOURCE_. Must contain only `CooSys` objects. """ return self._coordinate_systems @property def infos(self): """ A list of informational parameters (key-value pairs) for the resource. Must only contain `Info` objects. """ return self._infos @property def params(self): """ A list of parameters (constant-valued columns) for the resource. Must contain only `Param` objects. """ return self._params @property def links(self): """ A list of links (pointers to other documents or servers through a URI) for the resource. Must contain only `Link` objects. """ return self._links @property def tables(self): """ A list of tables in the resource. Must contain only `Table` objects. """ return self._tables @property def resources(self): """ A list of nested resources inside this resource. Must contain only `Resource` objects. """ return self._resources def _add_table(self, iterator, tag, data, config, pos): table = Table(self._votable, config=config, pos=pos, **data) self.tables.append(table) table.parse(iterator, config) def _add_info(self, iterator, tag, data, config, pos): info = Info(config=config, pos=pos, **data) self.infos.append(info) info.parse(iterator, config) def _add_param(self, iterator, tag, data, config, pos): param = Param(self._votable, config=config, pos=pos, **data) self.params.append(param) param.parse(iterator, config) def _add_coosys(self, iterator, tag, data, config, pos): coosys = CooSys(config=config, pos=pos, **data) self.coordinate_systems.append(coosys) coosys.parse(iterator, config) def _add_resource(self, iterator, tag, data, config, pos): resource = Resource(config=config, pos=pos, **data) self.resources.append(resource) resource.parse(self._votable, iterator, config) def _add_link(self, iterator, tag, data, config, pos): link = Link(config=config, pos=pos, **data) self.links.append(link) link.parse(iterator, config) def parse(self, votable, iterator, config): self._votable = votable tag_mapping = { 'TABLE' : self._add_table, 'INFO' : self._add_info, 'PARAM' : self._add_param, 'COOSYS' : self._add_coosys, 'RESOURCE' : self._add_resource, 'LINK' : self._add_link, 'DESCRIPTION' : self._ignore_add } for start, tag, data, pos in iterator: if start: tag_mapping.get(tag, self._add_unknown_tag)( iterator, tag, data, config, pos) elif tag == 'DESCRIPTION': if self.description is not None: warn_or_raise(W17, W17, 'RESOURCE', config, pos) self.description = data or None elif tag == 'RESOURCE': break del self._votable return self def to_xml(self, w, **kwargs): attrs = w.object_attrs(self, ('ID', 'type', 'utype')) attrs.update(self.extra_attributes) with w.tag('RESOURCE', attrib=attrs): if self.description is not None: w.element("DESCRIPTION", self.description, wrap=True) for element_set in (self.coordinate_systems, self.params, self.infos, self.links, self.tables, self.resources): for element in element_set: element.to_xml(w, **kwargs) def iter_tables(self): """ Recursively iterates over all tables in the resource and nested resources. """ for table in self.tables: yield table for resource in self.resources: for table in resource.iter_tables(): yield table def iter_fields_and_params(self): """ Recursively iterates over all FIELD_ and PARAM_ elements in the resource, its tables and nested resources. """ for param in self.params: yield param for table in self.tables: for param in table.iter_fields_and_params(): yield param for resource in self.resources: for param in resource.iter_fields_and_params(): yield param def iter_coosys(self): """ Recursively iterates over all the COOSYS_ elements in the resource and nested resources. """ for coosys in self.coordinate_systems: yield coosys for resource in self.resources: for coosys in resource.iter_coosys(): yield coosys class VOTableFile(Element, _IDProperty, _DescriptionProperty): """ VOTABLE_ element: represents an entire file. The keyword arguments correspond to setting members of the same name, documented below. *version* is settable at construction time only, since conformance tests for building the rest of the structure depend on it. """ def __init__(self, ID=None, id=None, config={}, pos=None, version="1.2"): self._config = config self._pos = pos Element.__init__(self) self.ID = resolve_id(ID, id, config, pos) self.description = None self._coordinate_systems = HomogeneousList(CooSys) self._params = HomogeneousList(Param) self._infos = HomogeneousList(Info) self._resources = HomogeneousList(Resource) self._groups = HomogeneousList(Group) version = str(version) assert version in ("1.0", "1.1", "1.2") self._version = version @property def version(self): """ The version of the VOTable specification that the file uses. """ return self._version @version.setter def version(self, version): version = str(version) if version not in ('1.1', '1.2', '1.3'): raise ValueError( "astropy.io.votable only supports VOTable versions " "1.1, 1.2 and 1.3") self._version = version @property def coordinate_systems(self): """ A list of coordinate system descriptions for the file. Must contain only `CooSys` objects. """ return self._coordinate_systems @property def params(self): """ A list of parameters (constant-valued columns) that apply to the entire file. Must contain only `Param` objects. """ return self._params @property def infos(self): """ A list of informational parameters (key-value pairs) for the entire file. Must only contain `Info` objects. """ return self._infos @property def resources(self): """ A list of resources, in the order they appear in the file. Must only contain `Resource` objects. """ return self._resources @property def groups(self): """ A list of groups, in the order they appear in the file. Only supported as a child of the VOTABLE element in VOTable 1.2 or later. """ return self._groups def _add_param(self, iterator, tag, data, config, pos): param = Param(self, config=config, pos=pos, **data) self.params.append(param) param.parse(iterator, config) def _add_resource(self, iterator, tag, data, config, pos): resource = Resource(config=config, pos=pos, **data) self.resources.append(resource) resource.parse(self, iterator, config) def _add_coosys(self, iterator, tag, data, config, pos): coosys = CooSys(config=config, pos=pos, **data) self.coordinate_systems.append(coosys) coosys.parse(iterator, config) def _add_info(self, iterator, tag, data, config, pos): info = Info(config=config, pos=pos, **data) self.infos.append(info) info.parse(iterator, config) def _add_group(self, iterator, tag, data, config, pos): if not config.get('version_1_2_or_later'): warn_or_raise(W26, W26, ('GROUP', 'VOTABLE', '1.2'), config, pos) group = Group(self, config=config, pos=pos, **data) self.groups.append(group) group.parse(iterator, config) def parse(self, iterator, config): config['_current_table_number'] = 0 for start, tag, data, pos in iterator: if start: if tag == 'xml': pass elif tag == 'VOTABLE': if 'version' not in data: warn_or_raise(W20, W20, self.version, config, pos) config['version'] = self.version else: config['version'] = self._version = data['version'] if config['version'].lower().startswith('v'): warn_or_raise( W29, W29, config['version'], config, pos) self._version = config['version'] = \ config['version'][1:] if config['version'] not in ('1.1', '1.2', '1.3'): vo_warn(W21, config['version'], config, pos) if 'xmlns' in data: correct_ns = ('http://www.ivoa.net/xml/VOTable/v%s' % config['version']) if data['xmlns'] != correct_ns: vo_warn( W41, (correct_ns, data['xmlns']), config, pos) else: vo_warn(W42, (), config, pos) break else: vo_raise(E19, (), config, pos) config['version_1_1_or_later'] = \ util.version_compare(config['version'], '1.1') >= 0 config['version_1_2_or_later'] = \ util.version_compare(config['version'], '1.2') >= 0 config['version_1_3_or_later'] = \ util.version_compare(config['version'], '1.3') >= 0 tag_mapping = { 'PARAM' : self._add_param, 'RESOURCE' : self._add_resource, 'COOSYS' : self._add_coosys, 'INFO' : self._add_info, 'DEFINITIONS' : self._add_definitions, 'DESCRIPTION' : self._ignore_add, 'GROUP' : self._add_group} for start, tag, data, pos in iterator: if start: tag_mapping.get(tag, self._add_unknown_tag)( iterator, tag, data, config, pos) elif tag == 'DESCRIPTION': if self.description is not None: warn_or_raise(W17, W17, 'VOTABLE', config, pos) self.description = data or None if not len(self.resources) and config['version_1_2_or_later']: warn_or_raise(W53, W53, (), config, pos) return self def to_xml(self, fd, write_null_values=False, compressed=False, _debug_python_based_parser=False, _astropy_version=None): """ Write to an XML file. Parameters ---------- fd : str path or writable file-like object Where to write the file. write_null_values : bool, optional When `True`, write the 'null' value (specified in the null attribute of the VALUES element for each FIELD) for empty values. When False (default), simply write no value. compressed : bool, optional When `True`, write to a gzip-compressed file. (Default: `False`) """ kwargs = { 'write_null_values': write_null_values, 'version': self.version, 'version_1_1_or_later': util.version_compare(self.version, '1.1') >= 0, 'version_1_2_or_later': util.version_compare(self.version, '1.2') >= 0, 'version_1_3_or_later': util.version_compare(self.version, '1.3') >= 0, '_debug_python_based_parser': _debug_python_based_parser, '_group_number': 1} with util.convert_to_writable_filelike( fd, compressed=compressed) as fd: w = XMLWriter(fd) version = self.version if _astropy_version is None: lib_version = astropy_version else: lib_version = _astropy_version xml_header = """ \n""" w.write(xml_header.lstrip() % locals()) with w.tag('VOTABLE', {'version': version, 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", 'xsi:noNamespaceSchemaLocation': "http://www.ivoa.net/xml/VOTable/v%s" % version, 'xmlns': "http://www.ivoa.net/xml/VOTable/v%s" % version}): if self.description is not None: w.element("DESCRIPTION", self.description, wrap=True) element_sets = [self.coordinate_systems, self.params, self.infos, self.resources] if kwargs['version_1_2_or_later']: element_sets[0] = self.groups for element_set in element_sets: for element in element_set: element.to_xml(w, **kwargs) def iter_tables(self): """ Iterates over all tables in the VOTable file in a "flat" way, ignoring the nesting of resources etc. """ for resource in self.resources: for table in resource.iter_tables(): yield table def get_first_table(self): """ Often, you know there is only one table in the file, and that's all you need. This method returns that first table. """ for table in self.iter_tables(): if not table.is_empty(): return table raise IndexError("No table found in VOTABLE file.") get_table_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_tables', 'TABLE', """ Looks up a TABLE_ element by the given ID. Used by the table "ref" attribute. """) get_tables_by_utype = _lookup_by_attr_factory( 'utype', False, 'iter_tables', 'TABLE', """ Looks up a TABLE_ element by the given utype, and returns an iterator emitting all matches. """) def get_table_by_index(self, idx): """ Get a table by its ordinal position in the file. """ for i, table in enumerate(self.iter_tables()): if i == idx: return table raise IndexError("No table at index %d found in VOTABLE file." % idx) def iter_fields_and_params(self): """ Recursively iterate over all FIELD_ and PARAM_ elements in the VOTABLE_ file. """ for resource in self.resources: for field in resource.iter_fields_and_params(): yield field get_field_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_fields_and_params', 'FIELD', """ Looks up a FIELD_ element by the given ID_. Used by the field's "ref" attribute. """) get_fields_by_utype = _lookup_by_attr_factory( 'utype', False, 'iter_fields_and_params', 'FIELD', """ Looks up a FIELD_ element by the given utype and returns an iterator emitting all matches. """) get_field_by_id_or_name = _lookup_by_id_or_name_factory( 'iter_fields_and_params', 'FIELD', """ Looks up a FIELD_ element by the given ID_ or name. """) def iter_values(self): """ Recursively iterate over all VALUES_ elements in the VOTABLE_ file. """ for field in self.iter_fields_and_params(): yield field.values get_values_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_values', 'VALUES', """ Looks up a VALUES_ element by the given ID. Used by the values "ref" attribute. """) def iter_groups(self): """ Recursively iterate over all GROUP_ elements in the VOTABLE_ file. """ for table in self.iter_tables(): for group in table.iter_groups(): yield group get_group_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_groups', 'GROUP', """ Looks up a GROUP_ element by the given ID. Used by the group's "ref" attribute """) get_groups_by_utype = _lookup_by_attr_factory( 'utype', False, 'iter_groups', 'GROUP', """ Looks up a GROUP_ element by the given utype and returns an iterator emitting all matches. """) def iter_coosys(self): """ Recursively iterate over all COOSYS_ elements in the VOTABLE_ file. """ for coosys in self.coordinate_systems: yield coosys for resource in self.resources: for coosys in resource.iter_coosys(): yield coosys get_coosys_by_id = _lookup_by_attr_factory( 'ID', True, 'iter_coosys', 'COOSYS', """Looks up a COOSYS_ element by the given ID.""") def set_all_tables_format(self, format): """ Set the output storage format of all tables in the file. """ for table in self.iter_tables(): table.format = format @classmethod def from_table(cls, table, table_id=None): """ Create a `VOTableFile` instance from a given `astropy.table.Table` instance. Parameters ---------- table_id : str, optional Set the given ID attribute on the returned Table instance. """ votable_file = cls() resource = Resource() votable = Table.from_table(votable_file, table) if table_id is not None: votable.ID = table_id resource.tables.append(votable) votable_file.resources.append(resource) return votable_file astropy-0.3/astropy/io/votable/util.py0000644000175000017500000001441312243255342016275 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Various utilities and cookbook-like things. """ from __future__ import absolute_import, division, print_function, unicode_literals from ...extern import six # STDLIB import codecs import contextlib import io import re from distutils import version __all__ = [ 'convert_to_writable_filelike', 'stc_reference_frames', 'coerce_range_list_param', ] @contextlib.contextmanager def convert_to_writable_filelike(fd, compressed=False): """ Returns a writable file-like object suitable for streaming output. Parameters ---------- fd : file path string or writable file-like object May be: - a file path, in which case it is opened, and the file object is returned. - an object with a :meth:`write` method, in which case that object. compressed : bool, optional If `True`, create a gzip-compressed file. (Default is `False`). Returns ------- fd : writable file-like object """ if isinstance(fd, six.string_types): if fd.endswith('.gz') or compressed: from ...utils.compat import gzip with gzip.GzipFile(fd, 'wb') as real_fd: encoded_fd = io.TextIOWrapper(real_fd, encoding='utf8') yield encoded_fd encoded_fd.flush() real_fd.flush() return else: with io.open(fd, 'wt', encoding='utf8') as real_fd: yield real_fd return elif hasattr(fd, 'write'): assert six.callable(fd.write) if compressed: from ...utils.compat import gzip fd = gzip.GzipFile(fileobj=fd) # If we can't write Unicode strings, use a codecs.StreamWriter # object needs_wrapper = False try: fd.write('') except TypeError: needs_wrapper = True if not hasattr(fd, 'encoding') or fd.encoding is None: needs_wrapper = True if needs_wrapper: yield codecs.getwriter('utf-8')(fd) fd.flush() else: yield fd fd.flush() return else: raise TypeError("Can not be coerced to writable file-like object") # stc_reference_frames = set([ 'FK4', 'FK5', 'ECLIPTIC', 'ICRS', 'GALACTIC', 'GALACTIC_I', 'GALACTIC_II', 'SUPER_GALACTIC', 'AZ_EL', 'BODY', 'GEO_C', 'GEO_D', 'MAG', 'GSE', 'GSM', 'SM', 'HGC', 'HGS', 'HEEQ', 'HRTN', 'HPC', 'HPR', 'HCC', 'HGI', 'MERCURY_C', 'VENUS_C', 'LUNA_C', 'MARS_C', 'JUPITER_C_III', 'SATURN_C_III', 'URANUS_C_III', 'NEPTUNE_C_III', 'PLUTO_C', 'MERCURY_G', 'VENUS_G', 'LUNA_G', 'MARS_G', 'JUPITER_G_III', 'SATURN_G_III', 'URANUS_G_III', 'NEPTUNE_G_III', 'PLUTO_G', 'UNKNOWNFrame']) def coerce_range_list_param(p, frames=None, numeric=True): """ Coerces and/or verifies the object *p* into a valid range-list-format parameter. As defined in `Section 8.7.2 of Simple Spectral Access Protocol `_. Parameters ---------- p : str or sequence May be a string as passed verbatim to the service expecting a range-list, or a sequence. If a sequence, each item must be either: - a numeric value - a named value, such as, for example, 'J' for named spectrum (if the *numeric* kwarg is False) - a 2-tuple indicating a range - the last item my be a string indicating the frame of reference frames : sequence of str, optional A sequence of acceptable frame of reference keywords. If not provided, the default set in `set_reference_frames` will be used. numeric : bool, optional TODO Returns ------- parts : tuple The result is a tuple: - a string suitable for passing to a service as a range-list argument - an integer counting the number of elements """ def str_or_none(x): if x is None: return '' if numeric: x = float(x) return str(x) def numeric_or_range(x): if isinstance(x, tuple) and len(x) == 2: return '%s/%s' % (str_or_none(x[0]), str_or_none(x[1])) else: return str_or_none(x) def is_frame_of_reference(x): return isinstance(x, six.string_types) if p is None: return None, 0 elif isinstance(p, (tuple, list)): has_frame_of_reference = len(p) > 1 and is_frame_of_reference(p[-1]) if has_frame_of_reference: points = p[:-1] else: points = p[:] out = ','.join([numeric_or_range(x) for x in points]) length = len(points) if has_frame_of_reference: if frames is not None and p[-1] not in frames: raise ValueError( "'%s' is not a valid frame of reference" % p[-1]) out += ';' + p[-1] length += 1 return out, length elif isinstance(p, six.string_types): number = r'([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)?' if not numeric: number = r'(' + number + ')|([A-Z_]+)' match = re.match( '^' + number + r'([,/]' + number + r')+(;(?P[ bv) - (av < bv) astropy-0.3/astropy/io/votable/src/0000755000175000017500000000000012243263747015542 5ustar oleoleastropy-0.3/astropy/io/votable/src/tablewriter.c0000644000175000017500000002555512243255342020236 0ustar oleole/****************************************************************************** * C extension code for vo.table. * * Everything in this file has an alternate Python implementation and * is included for performance reasons only. * * This contains a write_tabledata function to quickly write out a Numpy array * in TABLEDATA format. * ******************************************************************************/ #include /****************************************************************************** * Convenience macros and functions ******************************************************************************/ #undef CLAMP #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) static Py_ssize_t next_power_of_2(Py_ssize_t n) { /* Calculate the next-highest power of two */ n--; n |= n >> 1; n |= n >> 2; n |= n >> 4; n |= n >> 8; n |= n >> 16; n++; return n; } /****************************************************************************** * Python version compatibility macros ******************************************************************************/ #if PY_MAJOR_VERSION >= 3 # define IS_PY3K #endif #ifndef Py_TYPE # define Py_TYPE(o) ((o)->ob_type) #endif /****************************************************************************** * Write TABLEDATA ******************************************************************************/ #define CHAR Py_UNICODE /* * Reallocate the write buffer to the requested size */ static int _buffer_realloc( CHAR** buffer, Py_ssize_t* buffer_size, CHAR** x, Py_ssize_t req_size) { Py_ssize_t n = req_size; CHAR * new_mem = NULL; if (req_size < *buffer_size) { return 0; } /* Calculate the next-highest power of two */ n = next_power_of_2(n); if (n < req_size) { PyErr_SetString(PyExc_MemoryError, "Out of memory for XML text."); return -1; } new_mem = realloc((void *)*buffer, n * sizeof(CHAR)); if (new_mem == NULL) { PyErr_SetString(PyExc_MemoryError, "Out of memory for XML text."); return -1; } *x = (CHAR *)new_mem + (*x - *buffer); *buffer = new_mem; *buffer_size = n; return 0; } /* * Write *indent* spaces to the buffer */ static int _write_indent(CHAR** buffer, Py_ssize_t* buffer_size, CHAR** x, Py_ssize_t indent) { if (_buffer_realloc(buffer, buffer_size, x, (*x - *buffer + indent))) { return 1; } for (; indent; --indent) { *(*x)++ = ' '; } return 0; } /* * Write a string into a buffer. */ static int _write_string(CHAR** buffer, Py_ssize_t* buffer_size, CHAR** x, const CHAR* src, const Py_ssize_t len) { if (_buffer_realloc(buffer, buffer_size, x, (*x - *buffer + len))) { return 1; } while (*src != (CHAR)0) { *(*x)++ = *src++; } return 0; } /* * Write an 8-bit ascii-encoded C string to a Unicode string. */ static int _write_cstring(CHAR** buffer, Py_ssize_t* buffer_size, CHAR** x, const char* src, const Py_ssize_t len) { if (_buffer_realloc(buffer, buffer_size, x, (*x - *buffer + len))) { return 1; } while (*src != (char)0) { *(*x)++ = *src++; } return 0; } /* * Write a TABLEDATA element tree to the given write method. * * The Python arguments are: * * *write_method* (callable): A Python callable that takes a unicode * string and writes it to a file or buffer. * * *array* (numpy structured array): A Numpy record array containing * the data * * *mask* (numpy array): A Numpy array which is True everywhere a * value is missing. Must have the same shape as *array*. * * *converters* (list of callables): A sequence of methods which * convert from the native data types in the columns of *array* to * a unicode string in VOTABLE XML format. Must have the same * length as the number of columns in *array*. * * *write_null_values* (boolean): When True, write null values in * their entirety in the table. When False, just write empty * elements when the data is null or missing. * * *indent* (integer): The number of spaces to indent the table. * * *buf_size* (integer): The size of the write buffer. * * Returns None. */ static PyObject* write_tabledata(PyObject* self, PyObject *args, PyObject *kwds) { /* Inputs */ PyObject* write_method = NULL; PyObject* array = NULL; PyObject* mask = NULL; PyObject* converters = NULL; int write_null_values = 0; Py_ssize_t indent = 0; Py_ssize_t buf_size = (Py_ssize_t)1 << 8; /* Output buffer */ CHAR* buf = NULL; CHAR* x; Py_ssize_t nrows = 0; Py_ssize_t ncols = 0; Py_ssize_t i, j; int write_full; int all; PyObject* numpy_module = NULL; PyObject* numpy_all_method = NULL; PyObject* array_row = NULL; PyObject* mask_row = NULL; PyObject* array_val = NULL; PyObject* mask_val = NULL; PyObject* converter = NULL; PyObject* all_masked_obj = NULL; PyObject* str_val = NULL; PyObject* tmp = NULL; CHAR* str_tmp = NULL; Py_ssize_t str_len = 0; PyObject* result = 0; if (!PyArg_ParseTuple(args, "OOOOinn:write_tabledata", &write_method, &array, &mask, &converters, &write_null_values, &indent, &buf_size)) { goto exit; } if (!PyCallable_Check(write_method)) goto exit; if (!PySequence_Check(array)) goto exit; if (!PySequence_Check(mask)) goto exit; if (!PyList_Check(converters)) goto exit; indent = CLAMP(indent, (Py_ssize_t)0, (Py_ssize_t)80); buf_size = CLAMP(buf_size, (Py_ssize_t)1 << 8, (Py_ssize_t)1 << 24); if ((numpy_module = PyImport_ImportModule("numpy")) == NULL) goto exit; if ((numpy_all_method = PyObject_GetAttrString(numpy_module, "all")) == NULL) goto exit; if ((nrows = PySequence_Size(array)) == -1) goto exit; if ((ncols = PyList_Size(converters)) == -1) goto exit; if ((buf = malloc((size_t)buf_size * sizeof(CHAR))) == NULL) goto exit; for (i = 0; i < nrows; ++i) { if ((array_row = PySequence_GetItem(array, i)) == NULL) goto exit; if ((mask_row = PySequence_GetItem(mask, i)) == NULL) goto exit; x = buf; if (_write_indent(&buf, &buf_size, &x, indent)) goto exit; if (_write_cstring(&buf, &buf_size, &x, " \n", 6)) goto exit; for (j = 0; j < ncols; ++j) { if ((converter = PyList_GET_ITEM(converters, j)) == NULL) goto exit; if ((array_val = PySequence_GetItem(array_row, j)) == NULL) goto exit; if ((mask_val = PySequence_GetItem(mask_row, j)) == NULL) goto exit; if (write_null_values) { write_full = 1; } else { if (mask_val == Py_False) { write_full = 1; } else if (mask_val == Py_True) { write_full = 0; } else { if ((all_masked_obj = PyObject_CallFunctionObjArgs(numpy_all_method, mask_val, NULL)) == NULL) goto exit; if ((all = PyObject_IsTrue(all_masked_obj)) == -1) { Py_DECREF(all_masked_obj); goto exit; } Py_DECREF(all_masked_obj); write_full = !all; } } if (write_full) { if (_write_indent(&buf, &buf_size, &x, indent)) goto exit; if ((str_val = PyObject_CallFunctionObjArgs(converter, array_val, mask_val, NULL)) == NULL) goto exit; if ((str_tmp = PyUnicode_AsUnicode(str_val)) == NULL) { Py_DECREF(str_val); goto exit; } str_len = PyUnicode_GetSize(str_val); if (str_len) { if (_write_cstring(&buf, &buf_size, &x, " ", 6) || _write_string(&buf, &buf_size, &x, str_tmp, str_len) || _write_cstring(&buf, &buf_size, &x, "\n", 6)) { Py_DECREF(str_val); goto exit; } } else { if (_write_cstring(&buf, &buf_size, &x, " \n", 8)) { Py_DECREF(str_val); goto exit; } } Py_DECREF(str_val); } else { if (_write_indent(&buf, &buf_size, &x, indent)) goto exit; if (_write_cstring(&buf, &buf_size, &x, " \n", 8)) goto exit; } Py_DECREF(array_val); array_val = NULL; Py_DECREF(mask_val); mask_val = NULL; } Py_DECREF(array_row); array_row = NULL; Py_DECREF(mask_row); mask_row = NULL; if (_write_indent(&buf, &buf_size, &x, indent)) goto exit; if (_write_cstring(&buf, &buf_size, &x, " \n", 7)) goto exit; /* NULL-terminate the string */ *x = (CHAR)0; if ((tmp = PyObject_CallFunction(write_method, "u#", buf, x - buf)) == NULL) goto exit; Py_DECREF(tmp); } Py_INCREF(Py_None); result = Py_None; exit: Py_XDECREF(numpy_module); Py_XDECREF(numpy_all_method); Py_XDECREF(array_row); Py_XDECREF(mask_row); Py_XDECREF(array_val); Py_XDECREF(mask_val); free(buf); return result; } /****************************************************************************** * Module setup ******************************************************************************/ static PyMethodDef module_methods[] = { {"write_tabledata", (PyCFunction)write_tabledata, METH_VARARGS, "Fast C method to write tabledata"}, {NULL} /* Sentinel */ }; struct module_state { void* none; }; #ifdef IS_PY3K static int module_traverse(PyObject* m, visitproc visit, void* arg) { return 0; } static int module_clear(PyObject* m) { return 0; } static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "tablewriter", "Fast way to write VOTABLE TABLEDATA", sizeof(struct module_state), module_methods, NULL, module_traverse, module_clear, NULL }; # define INITERROR return NULL PyMODINIT_FUNC PyInit_tablewriter(void) #else /* Not PY3K */ # define INITERROR return # ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ # define PyMODINIT_FUNC void # endif PyMODINIT_FUNC inittablewriter(void) #endif { PyObject* m; #ifdef IS_PY3K m = PyModule_Create(&moduledef); #else m = Py_InitModule3("tablewriter", module_methods, "Fast way to write VOTABLE TABLEDATA"); #endif if (m == NULL) INITERROR; #ifdef IS_PY3K return m; #endif } astropy-0.3/astropy/vo/0000755000175000017500000000000012243263747013334 5ustar oleoleastropy-0.3/astropy/vo/client/0000755000175000017500000000000012243263747014612 5ustar oleoleastropy-0.3/astropy/vo/client/tests/0000755000175000017500000000000012243263747015754 5ustar oleoleastropy-0.3/astropy/vo/client/tests/__init__.py0000644000175000017500000000000012243255342020043 0ustar oleoleastropy-0.3/astropy/vo/client/tests/data/0000755000175000017500000000000012243263747016665 5ustar oleoleastropy-0.3/astropy/vo/client/tests/data/conesearch_error3.xml0000644000175000017500000000052312243255342023005 0ustar oleole MAST Simple Cone Search Service astropy-0.3/astropy/vo/client/tests/data/conesearch_error4.xml0000644000175000017500000000046612243255342023014 0ustar oleole MAST Simple Cone Search Service astropy-0.3/astropy/vo/client/tests/data/conesearch_error2.xml0000644000175000017500000000045412243255342023007 0ustar oleole MAST Simple Cone Search Service astropy-0.3/astropy/vo/client/tests/data/conesearch_error1.xml0000644000175000017500000000037312243255342023006 0ustar oleole MAST Simple Cone Search Service astropy-0.3/astropy/vo/client/tests/test_vo.py0000644000175000017500000001742212243255342020007 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for `astropy.vo.client` Examples -------- Running inside Python:: >>> import astropy >>> astropy.test('vo.client', remote_data=True) Running from top level via command line:: $ python setup.py test -P vo.client --remote-data Running from ``astropy/vo/client/tests`` directory:: $ setenv ASTROPY_USE_SYSTEM_PYTEST 1 $ py.test test_vo.py --remote-data """ # STDLIB import os # THIRD-PARTY import numpy as np # LOCAL from .. import conesearch, vos_catalog from .... import units as u from ....coordinates import Angle, ICRS from ....tests.helper import pytest, remote_data from ....utils.data import get_pkg_data_filename from ....utils.data import REMOTE_TIMEOUT __doctest_skip__ = ['*'] # Global variables for TestConeSearch SCS_RA = 0 SCS_DEC = 0 SCS_SR = 0.1 SCS_CENTER = ICRS(SCS_RA, SCS_DEC, unit=(u.degree, u.degree)) SCS_RADIUS = Angle(SCS_SR, unit=u.degree) @remote_data def test_basic_db(): """Read dummy ``basic.json`` database to test underlying database functionality. """ basic_db = vos_catalog.get_remote_catalog_db('basic') assert sorted(basic_db.keys()) == ['__version__', 'catalogs', 'content'] assert basic_db['content'] == ['A', 'B', 'C'] assert basic_db.list_catalogs() == ['foo'] assert basic_db.list_catalogs(pattern='whatever') == [] foo_cat1 = basic_db.get_catalog('foo') for k, v in basic_db.get_catalogs(): assert k == 'foo' assert v._tree == foo_cat1._tree == {'title': 'bar', 'url': 'bar.foo'} foo_cat2 = basic_db.get_catalog_by_url('bar.foo') for k, v in basic_db.get_catalogs_by_url('bar.foo'): assert k == 'foo' assert v._tree == foo_cat2._tree == {'title': 'bar', 'url': 'bar.foo'} try: x = basic_db.get_catalog('not_there') except vos_catalog.VOSError: pass assert vos_catalog.list_catalogs('basic') == ['foo'] @remote_data class TestConeSearch(object): """Test Cone Search on a pre-defined access URL. .. note:: This test will fail if the URL becomes inaccessible, which is beyond AstroPy's control. When this happens, change the test to use a different URL. At the time this was written, ``pedantic=True`` will not yield any successful search. """ def setup_class(self): # If this link is broken, use the next in database that works self.url = 'http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2&' self.catname = 'USNO-A2' # Avoid downloading the full database conesearch.CONESEARCH_DBNAME.set('conesearch_simple') self.verbose = False self.pedantic = False def test_cat_listing(self): assert (conesearch.list_catalogs() == ['BROKEN', 'USNO ACT', 'USNO NOMAD', 'USNO-A2', 'USNO-B1']) assert (conesearch.list_catalogs(pattern='usno*a') == ['USNO ACT', 'USNO NOMAD', 'USNO-A2']) @pytest.mark.parametrize(('center', 'radius'), [((SCS_RA, SCS_DEC), SCS_SR), (SCS_CENTER, SCS_RADIUS)]) def test_one_search(self, center, radius): """This does not necessarily uses ``self.url`` because of unordered dict in JSON tree. """ tab_1 = conesearch.conesearch( center, radius, pedantic=self.pedantic, verbose=self.verbose) assert tab_1.array.size > 0 def test_searches(self): tab_2 = conesearch.conesearch( SCS_CENTER, SCS_RADIUS, catalog_db=self.url, pedantic=self.pedantic, verbose=self.verbose) tab_3 = conesearch.conesearch( SCS_CENTER, SCS_RADIUS, catalog_db=[self.catname, self.url], pedantic=self.pedantic, verbose=self.verbose) tab_4 = conesearch.conesearch( SCS_CENTER, SCS_RADIUS, catalog_db=vos_catalog.get_remote_catalog_db( conesearch.CONESEARCH_DBNAME()), pedantic=self.pedantic, verbose=self.verbose) assert tab_2.url == tab_3.url np.testing.assert_array_equal(tab_2.array, tab_3.array) # If this fails, it is because of dict hashing, no big deal. if tab_2.url == tab_4.url: np.testing.assert_array_equal(tab_2.array, tab_4.array) else: pytest.xfail('conesearch_simple.json used a different URL') @pytest.mark.parametrize(('center', 'radius'), [((SCS_RA, SCS_DEC), SCS_SR), (SCS_CENTER, SCS_RADIUS)]) def test_search_all(self, center, radius): all_results = conesearch.search_all( center, radius, catalog_db=['BROKEN', self.url], pedantic=self.pedantic, verbose=self.verbose) assert len(all_results) == 1 tab_1 = all_results[self.url] assert tab_1.array.size > 0 def test_async(self): async_search = conesearch.AsyncConeSearch( SCS_CENTER, SCS_RADIUS, pedantic=self.pedantic) tab = async_search.get(timeout=REMOTE_TIMEOUT()) assert async_search.done() assert tab.array.size > 0 def test_async_all(self): async_search_all = conesearch.AsyncSearchAll( SCS_CENTER, SCS_RADIUS, pedantic=self.pedantic) all_results = async_search_all.get(timeout=(REMOTE_TIMEOUT() * 2)) assert async_search_all.done() for tab in all_results.values(): assert tab.array.size > 0 @pytest.mark.parametrize(('center', 'radius'), [((SCS_RA, SCS_DEC), SCS_SR), (SCS_CENTER, SCS_RADIUS)]) def test_prediction(self, center, radius): """Prediction tests are not very accurate but will have to do.""" t_1, tab_1 = conesearch.conesearch_timer( center, radius, catalog_db=self.url, pedantic=self.pedantic, verbose=self.verbose) n_1 = tab_1.array.size t_2, n_2 = conesearch.predict_search( self.url, (SCS_RA, SCS_DEC), SCS_SR, pedantic=self.pedantic, verbose=self.verbose) assert n_2 > 0 and n_2 <= n_1 * 1.5 assert t_2 > 0 and t_2 <= t_1 * 1.5 def teardown_class(self): conesearch.CONESEARCH_DBNAME.set( conesearch.CONESEARCH_DBNAME.defaultvalue) class TestErrorResponse(object): """Test Cone Search error response handling. This is defined in Section 2.3 of Simple Cone Search Version 1.03, IVOA Recommendation, 22 February 2008. Also see https://github.com/astropy/astropy/issues/1001 """ def setup_class(self): self.datadir = 'data' self.pedantic = False self.conesearch_errmsg = { 'conesearch_error1.xml': 'Error in input RA value: as3f', 'conesearch_error2.xml': 'Error in input RA value: as3f', 'conesearch_error3.xml': 'Invalid data type: text/html', 'conesearch_error4.xml': 'Invalid data type: text/html'} def conesearch_compare(self, xmlfile, msg): """Bypassing Cone Search query and just imitating the reply, then check if appropriate error message is caught. """ # conesearch_error4.xml is a wont-fix for now if xmlfile == 'conesearch_error4.xml': pytest.xfail('Currently not supported, ' 'see astropy.io.votable.exceptions.W22') url = get_pkg_data_filename(os.path.join(self.datadir, xmlfile)) try: r = vos_catalog._vo_service_request(url, self.pedantic, {}) except vos_catalog.VOSError as e: assert msg in str(e) @pytest.mark.parametrize(('id'), [1, 2, 3, 4]) def test_conesearch_response(self, id): xml = 'conesearch_error{0}.xml'.format(id) msg = self.conesearch_errmsg[xml] self.conesearch_compare(xml, msg) astropy-0.3/astropy/vo/client/__init__.py0000644000175000017500000000000012243255342016701 0ustar oleoleastropy-0.3/astropy/vo/client/conesearch.py0000644000175000017500000003746412243255342017304 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Support VO Simple Cone Search capabilities.""" from __future__ import print_function, division import warnings # THIRD-PARTY import numpy as np # LOCAL from . import vos_catalog from .async import AsyncBase from ... import units as u from ...config.configuration import ConfigurationItem from ...coordinates import Angle, ICRS, SphericalCoordinatesBase from ...logger import log from ...utils.data import REMOTE_TIMEOUT from ...utils.timer import timefunc, RunTimePredictor from ...utils.exceptions import AstropyUserWarning __all__ = ['AsyncConeSearch', 'conesearch', 'AsyncSearchAll', 'search_all', 'list_catalogs', 'predict_search', 'conesearch_timer'] # Skip these doctests for now; # TODO: Add the ability to add py.test markers (such as remote_data) to # doctests __doctest_skip__ = ['AsyncConeSearch', 'AsyncSearchAll'] CONESEARCH_DBNAME = ConfigurationItem('conesearch_dbname', 'conesearch_good', 'Conesearch database name.') class ConeSearchError(Exception): # pragma: no cover pass class AsyncConeSearch(AsyncBase): """Perform a Cone Search asynchronously and returns the result of the first successful query. .. note:: See `~astropy.vo.client.async.AsyncBase` for more details. Parameters ---------- args, kwargs : see :func:`conesearch` Examples -------- >>> from astropy import coordinates as coord >>> from astropy import units as u >>> c = coord.ICRS(6.0223, -72.0814, unit=(u.degree, u.degree)) >>> async_search = conesearch.AsyncConeSearch( ... c, 0.5 * u.degree, ... catalog_db='The PMM USNO-A1.0 Catalogue (Monet 1997) 1') Check search status: >>> async_search.running() True >>> async_search.done() False Get search results after a 30-second wait (not to be confused with ``astropy.utils.data.REMOTE_TIMEOUT`` that governs individual Cone Search queries). If search is still not done after 30 seconds, ``TimeoutError`` is raised. Otherwise, Cone Search result is returned and can be manipulated as in :ref:`Simple Cone Search Examples `. If no ``timeout`` keyword given, it waits until completion: >>> async_result = async_search.get(timeout=30) >>> cone_arr = async_result.array.data >>> cone_arr.size 36184 """ def __init__(self, *args, **kwargs): AsyncBase.__init__(self, conesearch, *args, **kwargs) def conesearch(center, radius, verb=1, **kwargs): """Perform Cone Search and returns the result of the first successful query. Parameters ---------- center : tuple of float or :ref:`astropy-coordinates` Right-ascension and declination for the position of the center of the cone to search: - If tuple of float is given, it is assumed to be ``(RA, DEC)`` in the ICRS coordinate system, given in decimal degrees. - If astropy coordinates object is given, it will be converted internally to `~astropy.coordinates.builtin_systems.ICRS`. radius : float or `~astropy.coordinates.angles.Angle` object Radius of the cone to search: - If float is given, it is assumed to be in decimal degrees. - If astropy angle object or angular quantity is given, it is internally converted to degrees. verb : {1, 2, 3} Verbosity indicating how many columns are to be returned in the resulting table. Support for this parameter by a Cone Search service implementation is optional. If the service supports the parameter: 1. Return the bare minimum number of columns that the provider considers useful in describing the returned objects. 2. Return a medium number of columns between the minimum and maximum (inclusive) that are considered by the provider to most typically useful to the user. 3. Return all of the columns that are available for describing the objects. If not supported, the service should ignore the parameter and always return the same columns for every request. catalog_db May be one of the following, in order from easiest to use to most control: - `None`: A database of ``astropy.vo.client.conesearch.CONESEARCH_DBNAME`` catalogs is downloaded from ``astropy.vo.client.vos_catalog.BASEURL``. The first catalog in the database to successfully return a result is used. - *catalog name*: A name in the database of ``astropy.vo.client.conesearch.CONESEARCH_DBNAME`` catalogs at ``astropy.vo.client.vos_catalog.BASEURL`` is used. For a list of acceptable names, use :func:`list_catalogs`. - *url*: The prefix of a URL to a IVOA Service for ``astropy.vo.client.conesearch.CONESEARCH_DBNAME``. Must end in either '?' or '&'. - `VOSCatalog` object: A specific catalog manually downloaded and selected from the database (see :ref:`vo-sec-client-vos`). - Any of the above 3 options combined in a list, in which case they are tried in order. pedantic : bool or `None` When `True`, raise an error when the file violates the spec, otherwise issue a warning. Warnings may be controlled using :py:mod:`warnings` module. When not provided, uses the configuration setting ``astropy.io.votable.table.PEDANTIC``, which defaults to `False`. verbose : bool Verbose output. cache : bool Use caching for VO Service database. Access to actual VO websites referenced by the database still needs internet connection. Returns ------- obj : `astropy.io.votable.tree.Table` object First table from first successful VO service request. Raises ------ ConeSearchError When invalid inputs are passed into Cone Search. VOSError If VO service request fails. """ # Validate RA and DEC ra, dec = _validate_coord(center) # Validate search radius sr = _validate_sr(radius) # Validate verbosity verb = _local_conversion(int, verb) if verb not in (1, 2, 3): # pragma: no cover raise ConeSearchError('Verbosity must be 1, 2, or 3') args = {'RA': ra, 'DEC': dec, 'SR': sr, 'VERB': verb} return vos_catalog.call_vo_service(CONESEARCH_DBNAME(), kwargs=args, **kwargs) class AsyncSearchAll(AsyncBase): """Perform a Cone Search asynchronously, storing all results instead of just the result from first successfull query. .. note:: See `~astropy.vo.client.async.AsyncBase` for more details. Parameters ---------- args, kwargs : see :func:`search_all` Examples -------- >>> from astropy import coordinates as coord >>> from astropy import units as u >>> c = coord.ICRS(6.0223, -72.0814, unit=(u.degree, u.degree)) >>> async_searchall = conesearch.AsyncSearchAll(c, 0.5 * u.degree) Check search status: >>> async_search.running() True >>> async_search.done() False Get a dictionary of all search results after a 30-second wait (not to be confused with ``astropy.utils.data.REMOTE_TIMEOUT`` that governs individual Cone Search queries). If search is still not done after 30 seconds, ``TimeoutError`` is raised. Otherwise, a dictionary is returned and can be manipulated as in :ref:`Simple Cone Search Examples `. If no ``timeout`` keyword given, it waits until completion: >>> async_allresults = async_search.get(timeout=30) >>> all_catalogs = async_allresults.keys() >>> first_cone_arr = async_allresults[all_catalogs[0]].array.data >>> first_cone_arr.size 36184 """ def __init__(self, *args, **kwargs): AsyncBase.__init__(self, search_all, *args, **kwargs) def search_all(*args, **kwargs): """Perform Cone Search and returns the results of all successful queries. .. warning:: Could potentially take up significant run time and computing resources. Parameters ---------- args, kwargs Arguments and keywords accepted by :func:`conesearch`. Returns ------- all_results : dict of `astropy.io.votable.tree.Table` objects A dictionary of tables from successful VO service requests, with keys being the access URLs. If none is successful, an empty dictionary is returned. Raises ------ ConeSearchError When invalid inputs are passed into Cone Search. """ all_results = {} catalog_db = kwargs.get('catalog_db', None) if 'catalog_db' in kwargs: kwargs.pop('catalog_db') cache = kwargs.get('cache', True) verbose = kwargs.get('verbose', True) catalogs = vos_catalog._get_catalogs(CONESEARCH_DBNAME(), catalog_db, cache=cache, verbose=verbose) for name, catalog in catalogs: try: result = conesearch(catalog_db=catalog, *args, **kwargs) except vos_catalog.VOSError: pass else: all_results[result.url] = result return all_results def list_catalogs(**kwargs): """Return the available Cone Search catalogs as a list of strings. These can be used for the ``catalog_db`` argument to :func:`conesearch`. Parameters ---------- cache : bool Use caching for VO Service database. Access to actual VO websites referenced by the database still needs internet connection. verbose : bool Show download progress bars. pattern : str or `None` If given string is anywhere in a catalog name, it is considered a matching catalog. It accepts patterns as in :py:mod:`fnmatch` and is case-insensitive. By default, all catalogs are returned. sort : bool Sort output in alphabetical order. If not sorted, the order depends on dictionary hashing. Default is `True`. Returns ------- arr : list of str List of catalog names. """ return vos_catalog.list_catalogs(CONESEARCH_DBNAME(), **kwargs) def predict_search(url, *args, **kwargs): """Predict the run time needed and the number of objects for a Cone Search for the given access URL, position, and radius. Run time prediction uses `astropy.utils.timer.RunTimePredictor`. Baseline searches are done with starting and ending radii at 0.05 and 0.5 of the given radius, respectively. Extrapolation on good data uses least-square straight line fitting, assuming linear increase of search time and number of objects with radius, which might not be accurate for some cases. If there are less than 3 data points in the fit, it fails. Warnings (controlled by :py:mod:`warnings`) are given when: #. Fitted slope is negative. #. Any of the estimated results is negative. #. Estimated run time exceeds ``astropy.utils.data.REMOTE_TIMEOUT``. .. note:: If ``verbose=True``, extra log info will be provided. But unlike :func:`conesearch_timer`, timer info is suppressed. If ``plot=True``, plot will be displayed. Plotting uses :mod:`matplotlib`. The predicted results are just *rough* estimates. Prediction is done using :func:`conesearch`. Prediction for `AsyncConeSearch` is not supported. Parameters ---------- url : str Cone Search access URL to use. args, kwargs : see :func:`conesearch` Extra keyword ``plot`` is allowed and only used by this function and not :func:`conesearch`. Returns ------- t_est : float Estimated time in seconds needed for the search. n_est : int Estimated number of objects the search will yield. Raises ------ AssertionError If prediction fails. ConeSearchError If input parameters are invalid. VOSError If VO service request fails. """ if len(args) != 2: # pragma: no cover raise ConeSearchError('conesearch must have exactly 2 arguments') plot = kwargs.get('plot', False) if 'plot' in kwargs: # pragma: no cover del kwargs['plot'] center, radius = args sr = _validate_sr(radius) if sr <= 0: raise ConeSearchError('Search radius must be > 0 degrees') kwargs['catalog_db'] = url cs_pred = RunTimePredictor(conesearch, center, **kwargs) # Search properties for timer extrapolation num_datapoints = 10 # Number of desired data points for extrapolation sr_min = 0.05 * sr # Min radius to start the timer sr_max = 0.5 * sr # Max radius to stop the timer sr_step = (1.0 / num_datapoints) * (sr_max - sr_min) # Radius step # Slowly increase radius to get data points for extrapolation sr_arr = np.arange(sr_min, sr_max + sr_step, sr_step) cs_pred.time_func(sr_arr) # Predict run time t_coeffs = cs_pred.do_fit() t_est = cs_pred.predict_time(sr) if t_est < 0 or t_coeffs[0] < 0: # pragma: no cover warnings.warn('Estimated runtime ({0} s) is non-physical with slope of ' '{1}'.format(t_est, t_coeffs[0]), AstropyUserWarning) elif t_est > REMOTE_TIMEOUT(): # pragma: no cover warnings.warn('Estimated runtime is longer than timeout of ' '{0} s'.format(REMOTE_TIMEOUT()), AstropyUserWarning) # Predict number of objects sr_arr = sorted(cs_pred.results) # Orig with floating point error n_arr = [cs_pred.results[key].array.size for key in sr_arr] n_coeffs = np.polyfit(sr_arr, n_arr, 1) n_fitfunc = np.poly1d(n_coeffs) n_est = int(round(n_fitfunc(sr))) if n_est < 0 or n_coeffs[0] < 0: # pragma: no cover warnings.warn('Estimated #objects ({0}) is non-physical with slope of ' '{1}'.format(n_est, n_coeffs[0]), AstropyUserWarning) if plot: # pragma: no cover import matplotlib.pyplot as plt xlabeltext = 'radius (deg)' sr_fit = np.append(sr_arr, sr) n_fit = n_fitfunc(sr_fit) cs_pred.plot(xlabeltext=xlabeltext) fig, ax = plt.subplots() ax.plot(sr_arr, n_arr, 'kx-', label='Actual') ax.plot(sr_fit, n_fit, 'b--', label='Fit') ax.scatter([sr], [n_est], marker='o', c='r', label='Predicted') ax.set_xlabel(xlabeltext) ax.set_ylabel('#objects') ax.legend(loc='best', numpoints=1) plt.draw() return t_est, n_est @timefunc(1) def conesearch_timer(*args, **kwargs): """Time a single Cone Search using `astropy.utils.timer.timefunc` with a single try and a verbose timer. Parameters ---------- args, kwargs : see :func:`conesearch` Returns ------- t : float Run time in seconds. obj : `astropy.io.votable.tree.Table` object First table from first successful VO service request. """ return conesearch(*args, **kwargs) def _local_conversion(func, x): """Try ``func(x)`` and replace ``ValueError`` with ``ConeSearchError``.""" try: y = func(x) except ValueError as e: # pragma: no cover raise ConeSearchError(str(e)) else: return y def _validate_coord(center): if isinstance(center, SphericalCoordinatesBase): icrscoord = center.transform_to(ICRS) else: icrscoord = ICRS(*center, unit=(u.degree, u.degree)) return icrscoord.ra.degree, icrscoord.dec.degree def _validate_sr(radius): """Validate search radius.""" # Validate search radius if isinstance(radius, Angle): sr_angle = radius else: sr_angle = Angle(radius, unit=u.degree) return sr_angle.degree astropy-0.3/astropy/vo/client/async.py0000644000175000017500000000446412243255342016301 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Asynchronous VO service requests.""" from __future__ import print_function, division # LOCAL from ...utils.compat.futures import ThreadPoolExecutor __all__ = ['AsyncBase'] class AsyncBase(object): """Base class for asynchronous VO service requests using :py:class:`concurrent.futures.ThreadPoolExecutor`. Service request will be forced to run in silent mode by setting ``verbose=False``. Warnings are controled by :py:mod:`warnings` module. .. note:: Methods of the attributes can be accessed directly, with priority given to ``executor``. Parameters ---------- func : function The function to run. args, kwargs Arguments and keywords accepted by the service request function to be called asynchronously. Attributes ---------- executor : :py:class:`concurrent.futures.ThreadPoolExecutor` Executor running the function on single thread. future : :py:class:`concurrent.futures.Future` Asynchronous execution created by ``executor``. """ def __init__(self, func, *args, **kwargs): kwargs['verbose'] = False self.executor = ThreadPoolExecutor(1) self.future = self.executor.submit(func, *args, **kwargs) def __getattr__(self, what): """Expose ``executor`` and ``future`` methods.""" try: return getattr(self.executor, what) except AttributeError: return getattr(self.future, what) def get(self, timeout=None): """Get result, if available, then shut down thread. Parameters ---------- timeout : int or float Wait the given amount of time in seconds before obtaining result. If not given, wait indefinitely until function is done. Returns ------- result Result returned by the function. Raises ------ Exception Errors raised by :py:class:`concurrent.futures.Future`. """ try: result = self.future.result(timeout=timeout) except Exception as e: # pragma: no cover result = None raise e finally: self.executor.shutdown(wait=False) return result astropy-0.3/astropy/vo/client/setup_package.py0000755000175000017500000000023212243255342017767 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return { 'astropy.vo.client.tests': ['data/*.xml']} astropy-0.3/astropy/vo/client/vos_catalog.py0000644000175000017500000003352612243255342017466 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Common utilities for accessing VO simple services.""" from __future__ import print_function, division # STDLIB import fnmatch import json import re import urllib # LOCAL from ...config.configuration import ConfigurationItem from ...io.votable import table, tree from ...io.votable.exceptions import vo_raise, vo_warn, E19, W24, W25 from ...utils.console import color_print from ...utils.data import get_readable_fileobj __all__ = ['VOSCatalog', 'VOSDatabase', 'get_remote_catalog_db', 'call_vo_service', 'list_catalogs'] __dbversion__ = 1 VO_PEDANTIC = table.PEDANTIC() BASEURL = ConfigurationItem('vos_baseurl', 'http://stsdas.stsci.edu/astrolib/vo_databases/', 'URL where VO Service database file is stored.') class VOSError(Exception): # pragma: no cover pass class VOSCatalog(object): """A class to represent VO Service Catalog. Parameters ---------- tree : JSON tree """ def __init__(self, tree): self._tree = tree def __getattr__(self, what): """Expose dictionary attributes.""" return getattr(self._tree, what) def __getitem__(self, what): """Expose dictionary key look-up.""" return self._tree[what] def __str__(self): # pragma: no cover """Show the most important and unique things about a catalog.""" keys = ('title', 'url') out_str = '\n'.join(['{0}: {1}'.format(key, self._tree[key]) for key in keys if key in self._tree]) return out_str def dumps(self): # pragma: no cover """Dump the contents into a string. Returns ------- s : str Contents as JSON string dump. """ return json.dumps(self._tree, sort_keys=True, indent=4) class VOSDatabase(VOSCatalog): """A class to represent a collection of `VOSCatalog`. Parameters ---------- tree : JSON tree Raises ------ VOSError If given ``tree`` does not have 'catalogs' key. """ def __init__(self, tree): self._tree = tree if tree['__version__'] > __dbversion__: # pragma: no cover vo_warn(W24) if not 'catalogs' in tree: # pragma: no cover raise VOSError("Invalid VO service catalog database") self._catalogs = tree['catalogs'] def __str__(self): # pragma: no cover """Show the most important and unique things about a database.""" return '\n'.join(sorted(self._catalogs.keys())) def get_catalogs(self): """Iterator to get all catalogs.""" for key, val in self._catalogs.items(): yield key, VOSCatalog(val) def get_catalogs_by_url(self, url): """Like :func:`get_catalogs` but using access URL look-up.""" for key, cat in self.get_catalogs(): if cat['url'] == url: yield key, cat def get_catalog(self, name): """Get one catalog of given name. Parameters ---------- name : str Primary key identifying the catalog. Returns ------- obj : `VOSCatalog` object Raises ------ VOSError If catalog is not found. """ if not name in self._catalogs: raise VOSError("No catalog '{0}' found.".format(name)) return VOSCatalog(self._catalogs[name]) def get_catalog_by_url(self, url): """Like :func:`get_catalog` but using access URL look-up. On multiple matches, only first match is returned. """ out_cat = None for key, cat in self.get_catalogs_by_url(url): out_cat = cat break if out_cat is None: # pragma: no cover raise VOSError("No catalog with URL '{0}' found.".format(url)) return out_cat def list_catalogs(self, pattern=None, sort=True): """List catalog names. Parameters ---------- pattern : str or `None` If given string is anywhere in a catalog name, it is considered a matching catalog. It accepts patterns as in :py:mod:`fnmatch` and is case-insensitive. By default, all catalogs are returned. sort : bool Sort output in alphabetical order. If not sorted, the order depends on dictionary hashing. Default is `True`. Returns ------- out_arr : list of str List of catalog names. """ all_catalogs = self._catalogs.keys() if pattern is None or len(all_catalogs) == 0: out_arr = all_catalogs else: pattern = re.compile(fnmatch.translate('*' + pattern + '*'), re.IGNORECASE) out_arr = [s for s in all_catalogs if pattern.match(s)] if sort: out_arr.sort() return out_arr def get_remote_catalog_db(dbname, cache=True, verbose=True): """Get a database of VO services (which is a JSON file) from a remote location. Parameters ---------- dbname : str Prefix of JSON file to download from ``astropy.vo.client.vos_catalog.BASEURL``. cache : bool Use caching for VO Service database. Access to actual VO websites referenced by the database still needs internet connection. verbose : bool Show download progress bars. Returns ------- obj : `VOSDatabase` object A database of VO services. """ with get_readable_fileobj(BASEURL() + dbname + '.json', encoding='utf8', cache=cache, show_progress=verbose) as fd: tree = json.load(fd) return VOSDatabase(tree) def _get_catalogs(service_type, catalog_db, **kwargs): """Expand ``catalog_db`` to a list of catalogs. Parameters ---------- service_type, catalog_db See :func:`call_vo_service`. kwargs : dict Keywords accepted by :func:`get_remote_catalog_db`. Returns ------- catalogs : list of tuple List of catalogs in the form of ``(key, VOSCatalog)``. """ if catalog_db is None: catalog_db = get_remote_catalog_db(service_type, **kwargs) catalogs = catalog_db.get_catalogs() elif isinstance(catalog_db, VOSDatabase): catalogs = catalog_db.get_catalogs() elif isinstance(catalog_db, (VOSCatalog, basestring)): catalogs = [(None, catalog_db)] elif isinstance(catalog_db, list): for x in catalog_db: assert (isinstance(x, (VOSCatalog, basestring)) and not isinstance(x, VOSDatabase)) catalogs = [(None, x) for x in catalog_db] else: # pragma: no cover raise VOSError('catalog_db must be a catalog database, ' 'a list of catalogs, or a catalog') return catalogs def _vo_service_request(url, pedantic, kwargs, verbose=False): if len(kwargs) and not (url.endswith('?') or url.endswith('&')): raise VOSError("url should already end with '?' or '&'") query = [] for key, value in kwargs.iteritems(): query.append('{}={}'.format( urllib.quote(key), urllib.quote_plus(str(value)))) parsed_url = url + '&'.join(query) with get_readable_fileobj(parsed_url, encoding='binary', show_progress=verbose) as req: tab = table.parse(req, filename=parsed_url, pedantic=pedantic) return vo_tab_parse(tab, url, kwargs) def vo_tab_parse(tab, url, kwargs): """In case of errors from the server, a complete and correct 'stub' VOTable file may still be returned. This is to detect that case. Parameters ---------- tab : `astropy.io.votable.tree.VOTableFile` object url : str URL used to obtain ``tab``. kwargs : dict Keywords used to obtain ``tab``, if any. Returns ------- out_tab : `astropy.io.votable.tree.Table` object Raises ------ IndexError Table iterator fails. VOSError Server returns error message or invalid table. """ for param in tab.iter_fields_and_params(): if param.ID is not None and param.ID.lower() == 'error': if isinstance(param, tree.Param): e = param.value else: # pragma: no cover e = '' raise VOSError("Catalog server '{0}' returned error '{1}'".format( url, e)) for info in tab.infos: if info.name is not None and info.name.lower() == 'error': raise VOSError("Catalog server '{0}' returned error '{1}'".format( url, info.value)) if tab.resources == []: # pragma: no cover vo_raise(E19) for info in tab.resources[0].infos: if ((info.name == 'QUERY_STATUS' and info.value != 'OK') or (info.name is not None and info.name.lower() == 'error')): if info.content is not None: # pragma: no cover long_descr = ':\n{0}'.format(info.content) else: long_descr = '' raise VOSError("Catalog server '{0}' returned status " "'{1}'{2}".format(url, info.value, long_descr)) out_tab = tab.get_first_table() kw_sr = [k for k in kwargs if 'sr' == k.lower()] if len(kw_sr) == 0: sr = 0 else: sr = kwargs.get(kw_sr[0]) if sr != 0 and out_tab.array.size <= 0: raise VOSError("Catalog server '{0}' returned {1} result".format( url, out_tab.array.size)) out_tab.url = url # Track the URL return out_tab def call_vo_service(service_type, catalog_db=None, pedantic=None, verbose=True, cache=True, kwargs={}): """Makes a generic VO service call. Parameters ---------- service_type : str Name of the type of service, e.g., 'conesearch_good'. Used in error messages and to select a catalog database if ``catalog_db`` is not provided. catalog_db May be one of the following, in order from easiest to use to most control: - `None`: A database of ``service_type`` catalogs is downloaded from ``astropy.vo.client.vos_catalog.BASEURL``. The first catalog in the database to successfully return a result is used. - *catalog name*: A name in the database of ``service_type`` catalogs at ``astropy.vo.client.vos_catalog.BASEURL`` is used. For a list of acceptable names, use :func:`list_catalogs`. - *url*: The prefix of a URL to a IVOA Service for ``service_type``. Must end in either '?' or '&'. - `VOSCatalog` object: A specific catalog manually downloaded and selected from the database (see :ref:`vo-sec-client-vos`). - Any of the above 3 options combined in a list, in which case they are tried in order. pedantic : bool or `None` When `True`, raise an error when the file violates the spec, otherwise issue a warning. Warnings may be controlled using :py:mod:`warnings` module. When not provided, uses the configuration setting ``astropy.io.votable.table.PEDANTIC``, which defaults to `False`. verbose : bool Verbose output. cache : bool Use caching for VO Service database. Access to actual VO websites referenced by the database still needs internet connection. kwargs : dictionary Keyword arguments to pass to the catalog service. No checking is done that the arguments are accepted by the service, etc. Returns ------- obj : `astropy.io.votable.tree.Table` object First table from first successful VO service request. Raises ------ VOSError If VO service request fails. """ catalogs = _get_catalogs(service_type, catalog_db, cache=cache, verbose=verbose) if pedantic is None: # pragma: no cover pedantic = VO_PEDANTIC for name, catalog in catalogs: if isinstance(catalog, basestring): if catalog.startswith("http"): url = catalog else: remote_db = get_remote_catalog_db(service_type, cache=cache, verbose=verbose) catalog = remote_db.get_catalog(catalog) url = catalog['url'] else: url = catalog['url'] if verbose: # pragma: no cover color_print('Trying {0}'.format(url), 'green') try: return _vo_service_request(url, pedantic, kwargs, verbose=verbose) except Exception as e: vo_warn(W25, (url, str(e))) raise VOSError('None of the available catalogs returned valid results.') def list_catalogs(service_type, cache=True, verbose=True, **kwargs): """List the catalogs available for the given service type. Parameters ---------- service_type : str Name of the type of service, e.g., 'conesearch_good'. cache : bool Use caching for VO Service database. Access to actual VO websites referenced by the database still needs internet connection. verbose : bool Show download progress bars. pattern : str or `None` If given string is anywhere in a catalog name, it is considered a matching catalog. It accepts patterns as in :py:mod:`fnmatch` and is case-insensitive. By default, all catalogs are returned. sort : bool Sort output in alphabetical order. If not sorted, the order depends on dictionary hashing. Default is `True`. Returns ------- arr : list of str List of catalog names. """ return get_remote_catalog_db(service_type, cache=cache, verbose=verbose).list_catalogs(**kwargs) astropy-0.3/astropy/vo/__init__.py0000644000175000017500000000000012243255342015423 0ustar oleoleastropy-0.3/astropy/vo/validator/0000755000175000017500000000000012243263747015321 5ustar oleoleastropy-0.3/astropy/vo/validator/tests/0000755000175000017500000000000012243263747016463 5ustar oleoleastropy-0.3/astropy/vo/validator/tests/__init__.py0000644000175000017500000000000012243255342020552 0ustar oleoleastropy-0.3/astropy/vo/validator/tests/test_validate.py0000644000175000017500000001200012243255342021646 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for `astropy.vo.validator` .. note:: This test will fail if external URL query status changes. This is beyond the control of AstroPy. When this happens, rerun or update the test. Examples -------- Running inside Python:: >>> import astropy >>> astropy.test('vo.validator', remote_data=True) Running from top level via command line:: $ python setup.py test -P vo.validator --remote-data Running from ``astropy/vo/validator/tests`` directory:: $ setenv ASTROPY_USE_SYSTEM_PYTEST 1 $ py.test test_validate.py --remote-data """ # STDLIB import json import os import shutil import sys import tempfile # LOCAL from .. import inspect, validate from ...client.vos_catalog import BASEURL from ....tests.helper import pytest, remote_data from ....utils.data import _find_pkg_data_path, get_pkg_data_filename from ....utils.data import REMOTE_TIMEOUT __doctest_skip__ = ['*'] @remote_data class TestConeSearchValidation(object): """Validation on a small subset of Cone Search sites.""" def setup_class(self): self.datadir = 'data' self.out_dir = tempfile.mkdtemp() self.filenames = {'good': 'conesearch_good.json', 'warn': 'conesearch_warn.json', 'excp': 'conesearch_exception.json', 'nerr': 'conesearch_error.json'} validate.CS_MSTR_LIST.set(get_pkg_data_filename(os.path.join( self.datadir, 'vao_conesearch_sites_121107_subset.xml'))) REMOTE_TIMEOUT.set(30) @pytest.mark.parametrize(('parallel'), [True, False]) def test_validation(self, parallel): if os.path.exists(self.out_dir): shutil.rmtree(self.out_dir) # For some reason, Python 3.3 does not work # using multiprocessing.Pool and callback function. # See http://bugs.python.org/issue16307 try: validate.check_conesearch_sites( destdir=self.out_dir, parallel=parallel, url_list=None) except AssertionError as e: if parallel and sys.version_info >= (3, 3): pytest.xfail('See http://bugs.python.org/issue16307') else: raise for val in self.filenames.values(): _compare_catnames(get_pkg_data_filename( os.path.join(self.datadir, val)), os.path.join(self.out_dir, val)) def test_url_list(self): local_outdir = os.path.join(self.out_dir, 'subtmp1') local_list = [ 'http://www.google.com/foo&', 'http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&'] # Same multiprocessing problem in Python 3.3 as above validate.check_conesearch_sites(destdir=local_outdir, parallel=False, url_list=local_list) _compare_catnames(get_pkg_data_filename( os.path.join(self.datadir, 'conesearch_good_subset.json')), os.path.join(local_outdir, 'conesearch_good.json')) def teardown_class(self): validate.CS_MSTR_LIST.set(validate.CS_MSTR_LIST.defaultvalue) REMOTE_TIMEOUT.set(REMOTE_TIMEOUT.defaultvalue) shutil.rmtree(self.out_dir) class TestConeSearchResults(object): """Inspection of `TestConeSearchValidation` results.""" def setup_class(self): self.datadir = 'data' self.out_dir = tempfile.mkdtemp() BASEURL.set(_find_pkg_data_path(self.datadir) + os.sep) self.r = inspect.ConeSearchResults() def test_catkeys(self): assert (self.r.catkeys['good'] == ['HST Guide Star Catalog 2.3 1', 'The USNO-A2.0 Catalogue (Monet+ 1998) 1']) assert self.r.catkeys['warn'] == [] assert self.r.catkeys['exception'] == [] assert self.r.catkeys['error'] == [] def gen_cmp(self, func, oname, *args, **kwargs): dat_file = get_pkg_data_filename(os.path.join(self.datadir, oname)) out_file = os.path.join(self.out_dir, oname) with open(out_file, 'w') as fout: func(fout=fout, *args, **kwargs) with open(dat_file) as f1: with open(out_file) as f2: assert f1.read() == f2.read() def test_tally(self): self.gen_cmp(self.r.tally, 'tally.out') def test_listcats(self): self.gen_cmp(self.r.list_cats, 'listcats1.out', 'good') self.gen_cmp(self.r.list_cats, 'listcats2.out', 'good', ignore_noncrit=True) def test_printcat(self): self.gen_cmp(self.r.print_cat, 'printcat.out', 'The USNO-A2.0 Catalogue (Monet+ 1998) 1') def teardown_class(self): BASEURL.set(BASEURL.defaultvalue) shutil.rmtree(self.out_dir) def _load_catnames(fname): with open(fname, 'r') as fd: js = json.load(fd) cats = sorted(js['catalogs']) return cats def _compare_catnames(fname1, fname2): cat1 = _load_catnames(fname1) cat2 = _load_catnames(fname2) assert cat1 == cat2 astropy-0.3/astropy/vo/validator/tests/data/0000755000175000017500000000000012243263747017374 5ustar oleoleastropy-0.3/astropy/vo/validator/tests/data/vao_conesearch_sites_121107_subset.xml0000644000175000017500000001422012243255342026473 0ustar oleole
Catalog GSC23 HST Guide Star Catalog 2.3 The Guide Star Catalog II (GSC-II) is an all-sky optical catalog based on 1" resolution scans of the photographic Sky Survey plates, at two epochs and three bandpasses, from the Palomar and UK Schmidt telescopes. This all-sky catalog will ultimately contains positions, proper motions, classifications, and magnitudes in multiple bandpasses for almost a billion objects down to approximately Jpg=21, Fpg=20. The GSC-II is currently used for HST Bright Object Protection and HST pointing. Looking ahead, the GSC-II will form the basis of the Guide Star Catalog for JWST. This was constructed in collaboration with ground-based observatories for use with the GEMINI, VLT and GALILEO telescopes Space Telescope Science #Optical# ivo://archive.stsci.edu/gsc/gsc2.3#1 2012-03-08T20:39:06 #Surveys# #Catalog# #Research# 2.3.2 ivo://archive.stsci.edu/gsc/gsc2.3 ConeSearch ivo://ivoa.net/std/ConeSearch 2 ParamHTTP std? http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&amp; 1 1000 http://gsss.stsci.edu/Catalogs/GSC/GSC2/GSC2.htm
Catalog I/252 The USNO-A2.0 Catalogue (Monet+ 1998) USNO-A2.0 is a catalog of 526,280,881 stars, and is based on a re-reduction of the Precision Measuring Machine (PMM) scans that were the basis for the USNO-A1.0 catalog. The major difference between A2.0 and A1.0 is that A1.0 used the Guide Star Catalog (Lasker et al. 1986, see Cat. &lt;I/220&gt;) as its reference frame whereas A2.0 uses the ICRF as realized by the USNO ACT catalog (Urban et al. 1997, see Cat. II/246&gt;). A2.0 presents right ascension and declination (J2000, epoch of the mean of the blue and red plate) and the blue and red magnitude for each star. Usage of the ACT catalog as well as usage of new astrometric and photometric reduction algorithms should provide improved astrometry (mostly in the reduction of systematic errors) and improved photometry (because the brightest stars on each plate had B and V magnitudes measured by the Tycho experiment on the Hipparcos satellite). The basic format of the catalog and its compilation is the same as for A1.0, and most users should be able to migrate to this newer version with minimal effort. This particular record describes access specifically to the "out" table within this catalog through the VO-standard ConeSearch service interface. It can be used automatically by compliant tools and applications. Consult the referenceURL for more information about this table. CDS #Optical# ivo://CDS.VizieR/I/252#out 2011-09-14T20:20:21 #Positional_Data# #Catalog# #Research# 27-Oct-1998 ivo://CDS.VizieR/I/252 ConeSearch ivo://ivoa.net/std/ConeSearch ParamHTTP std? http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&amp; 180 9999 ivo://CDS http://cdsarc.u-strasbg.fr/cgi-bin/Cat?I/252
astropy-0.3/astropy/vo/validator/tests/data/tally.out0000644000175000017500000000014612243255342021243 0ustar oleolegood: 2 catalog(s) warn: 0 catalog(s) exception: 0 catalog(s) error: 0 catalog(s) total: 2 catalog(s) astropy-0.3/astropy/vo/validator/tests/data/conesearch_good.json0000644000175000017500000001414712243255342023410 0ustar oleole{ "__version__": 1, "catalogs": { "HST Guide Star Catalog 2.3 1": { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "2", "contentLevel": "#Research#", "description": "The Guide Star Catalog II (GSC-II) is an all-sky optical catalog based on 1\" resolution scans of the photographic Sky Survey plates, at two epochs and three bandpasses, from the Palomar and UK Schmidt telescopes. This all-sky catalog will ultimately contains positions, proper motions, classifications, and magnitudes in multiple bandpasses for almost a billion objects down to approximately Jpg=21, Fpg=20. The GSC-II is currently used for HST Bright Object Protection and HST pointing. Looking ahead, the GSC-II will form the basis of the Guide Star Catalog for JWST. This was constructed in collaboration with ground-based observatories for use with the GEMINI, VLT and GALILEO telescopes", "duplicatesIgnored": 0, "identifier": "ivo://archive.stsci.edu/gsc/gsc2.3#1", "interfaceClass": "ParamHTTP", "interfaceRole": "std?", "interfaceVersion": "", "maxRadius": 1.0, "maxRecords": 1000, "publisher": "Space Telescope Science", "publisherID": "", "referenceURL": "http://gsss.stsci.edu/Catalogs/GSC/GSC2/GSC2.htm", "regionOfRegard": NaN, "resourceID": "ivo://archive.stsci.edu/gsc/gsc2.3", "shortName": "GSC23", "subject": "#Surveys#", "tags": "Catalog", "title": "HST Guide Star Catalog 2.3", "type": "#Catalog#", "updated": "2012-03-08T20:39:06", "url": "http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&", "validate_expected": "good", "validate_network_error": null, "validate_nexceptions": 0, "validate_nwarnings": 2, "validate_out_db_name": "good", "validate_version": "1.2", "validate_warning_types": [ "W48", "W50" ], "validate_warnings": [ "./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml:136:0: W50: Invalid unit string 'pixel'", "./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml:155:0: W48: Unknown attribute 'nrows' on TABLEDATA" ], "validate_xmllint": false, "validate_xmllint_content": "./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml:155: element TABLEDATA: Schemas validity error : Element '{http://www.ivoa.net/xml/VOTable/v1.2}TABLEDATA', attribute 'nrows': The attribute 'nrows' is not allowed.\n./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml fails to validate\n", "version": "2.3.2", "waveband": "#Optical#" }, "The USNO-A2.0 Catalogue (Monet+ 1998) 1": { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#Research#", "description": "USNO-A2.0 is a catalog of 526,280,881 stars, and is based on a re-reduction of the Precision Measuring Machine (PMM) scans that were the basis for the USNO-A1.0 catalog. The major difference between A2.0 and A1.0 is that A1.0 used the Guide Star Catalog (Lasker et al. 1986, see Cat. <I/220>) as its reference frame whereas A2.0 uses the ICRF as realized by the USNO ACT catalog (Urban et al. 1997, see Cat. II/246>). A2.0 presents right ascension and declination (J2000, epoch of the mean of the blue and red plate) and the blue and red magnitude for each star. Usage of the ACT catalog as well as usage of new astrometric and photometric reduction algorithms should provide improved astrometry (mostly in the reduction of systematic errors) and improved photometry (because the brightest stars on each plate had B and V magnitudes measured by the Tycho experiment on the Hipparcos satellite). The basic format of the catalog and its compilation is the same as for A1.0, and most users should be able to migrate to this newer version with minimal effort.\n\nThis particular record describes access specifically to the \"out\" table within this catalog through the VO-standard ConeSearch service interface. It can be used automatically by compliant tools and applications. Consult the referenceURL for more information about this table.", "duplicatesIgnored": 0, "identifier": "ivo://CDS.VizieR/I/252#out", "interfaceClass": "ParamHTTP", "interfaceRole": "std?", "interfaceVersion": "", "maxRadius": 180.0, "maxRecords": 9999, "publisher": "CDS", "publisherID": "ivo://CDS", "referenceURL": "http://cdsarc.u-strasbg.fr/cgi-bin/Cat?I/252", "regionOfRegard": NaN, "resourceID": "ivo://CDS.VizieR/I/252", "shortName": "I/252", "subject": "#Positional_Data#", "tags": "Catalog", "title": "The USNO-A2.0 Catalogue (Monet+ 1998)", "type": "#Catalog#", "updated": "2011-09-14T20:20:21", "url": "http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&", "validate_expected": "good", "validate_network_error": null, "validate_nexceptions": 0, "validate_nwarnings": 1, "validate_out_db_name": "good", "validate_version": "1.1", "validate_warning_types": [ "W22" ], "validate_warnings": [ "./results/f7/bb/d44fbd316338550aed4e1c1a8fc6/vo.xml:13:0: W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring" ], "validate_xmllint": true, "validate_xmllint_content": "./results/f7/bb/d44fbd316338550aed4e1c1a8fc6/vo.xml validates\n", "version": "27-Oct-1998", "waveband": "#Optical#" } } }astropy-0.3/astropy/vo/validator/tests/data/conesearch_exception.json0000644000175000017500000000005512243255342024447 0ustar oleole{ "__version__": 1, "catalogs": {} }astropy-0.3/astropy/vo/validator/tests/data/listcats1.out0000644000175000017500000000102512243255342022022 0ustar oleoleHST Guide Star Catalog 2.3 1 http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& W48,W50 ./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml:136:0: W50: Invalid unit string 'pixel' ./results/0b/1a/daefc22180f34be9334262a5d8c5/vo.xml:155:0: W48: Unknown attribute 'nrows' on TABLEDATA The USNO-A2.0 Catalogue (Monet+ 1998) 1 http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out& W22 ./results/f7/bb/d44fbd316338550aed4e1c1a8fc6/vo.xml:13:0: W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring astropy-0.3/astropy/vo/validator/tests/data/conesearch_good_subset.json0000644000175000017500000000651212243255342024772 0ustar oleole{ "__version__": 1, "catalogs": { "The USNO-A2.0 Catalogue (Monet+ 1998) 1": { "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#Research#", "description": "USNO-A2.0 is a catalog of 526,280,881 stars, and is based on a re-reduction of the Precision Measuring Machine (PMM) scans that were the basis for the USNO-A1.0 catalog. The major difference between A2.0 and A1.0 is that A1.0 used the Guide Star Catalog (Lasker et al. 1986, see Cat. <I/220>) as its reference frame whereas A2.0 uses the ICRF as realized by the USNO ACT catalog (Urban et al. 1997, see Cat. II/246>). A2.0 presents right ascension and declination (J2000, epoch of the mean of the blue and red plate) and the blue and red magnitude for each star. Usage of the ACT catalog as well as usage of new astrometric and photometric reduction algorithms should provide improved astrometry (mostly in the reduction of systematic errors) and improved photometry (because the brightest stars on each plate had B and V magnitudes measured by the Tycho experiment on the Hipparcos satellite). The basic format of the catalog and its compilation is the same as for A1.0, and most users should be able to migrate to this newer version with minimal effort.\n\nThis particular record describes access specifically to the \"out\" table within this catalog through the VO-standard ConeSearch service interface. It can be used automatically by compliant tools and applications. Consult the referenceURL for more information about this table.", "duplicatesIgnored": 0, "identifier": "ivo://CDS.VizieR/I/252#out", "interfaceClass": "ParamHTTP", "interfaceRole": "std?", "interfaceVersion": "", "maxRadius": 180.0, "maxRecords": 9999, "publisher": "CDS", "publisherID": "ivo://CDS", "referenceURL": "http://cdsarc.u-strasbg.fr/cgi-bin/Cat?I/252", "regionOfRegard": NaN, "resourceID": "ivo://CDS.VizieR/I/252", "shortName": "I/252", "subject": "#Positional_Data#", "tags": "Catalog", "title": "The USNO-A2.0 Catalogue (Monet+ 1998)", "type": "#Catalog#", "updated": "2011-09-14T20:20:21", "url": "http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&", "validate_expected": "good", "validate_network_error": null, "validate_nexceptions": 0, "validate_nwarnings": 1, "validate_out_db_name": "good", "validate_version": "1.1", "validate_warning_types": [ "W22" ], "validate_warnings": [ "/eng/ssb/web/astrolib/vo_databases/daily_20121203/results/57/4f/1898273d7498efddc5a3544da882/vo.xml:13:0: W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring" ], "validate_xmllint": true, "validate_xmllint_content": "/eng/ssb/web/astrolib/vo_databases/daily_20121203/results/57/4f/1898273d7498efddc5a3544da882/vo.xml validates\n", "version": "27-Oct-1998", "waveband": "#Optical#" } } }astropy-0.3/astropy/vo/validator/tests/data/conesearch_error.json0000644000175000017500000000005512243255342023602 0ustar oleole{ "__version__": 1, "catalogs": {} }astropy-0.3/astropy/vo/validator/tests/data/printcat.out0000644000175000017500000000551412243255342021746 0ustar oleole{ "capabilityClass": "ConeSearch", "capabilityStandardID": "ivo://ivoa.net/std/ConeSearch", "capabilityValidationLevel": "", "contentLevel": "#Research#", "description": "USNO-A2.0 is a catalog of 526,280,881 stars, and is based on a re-reduction of the Precision Measuring Machine (PMM) scans that were the basis for the USNO-A1.0 catalog. The major difference between A2.0 and A1.0 is that A1.0 used the Guide Star Catalog (Lasker et al. 1986, see Cat. <I/220>) as its reference frame whereas A2.0 uses the ICRF as realized by the USNO ACT catalog (Urban et al. 1997, see Cat. II/246>). A2.0 presents right ascension and declination (J2000, epoch of the mean of the blue and red plate) and the blue and red magnitude for each star. Usage of the ACT catalog as well as usage of new astrometric and photometric reduction algorithms should provide improved astrometry (mostly in the reduction of systematic errors) and improved photometry (because the brightest stars on each plate had B and V magnitudes measured by the Tycho experiment on the Hipparcos satellite). The basic format of the catalog and its compilation is the same as for A1.0, and most users should be able to migrate to this newer version with minimal effort.\n\nThis particular record describes access specifically to the \"out\" table within this catalog through the VO-standard ConeSearch service interface. It can be used automatically by compliant tools and applications. Consult the referenceURL for more information about this table.", "duplicatesIgnored": 0, "identifier": "ivo://CDS.VizieR/I/252#out", "interfaceClass": "ParamHTTP", "interfaceRole": "std?", "interfaceVersion": "", "maxRadius": 180.0, "maxRecords": 9999, "publisher": "CDS", "publisherID": "ivo://CDS", "referenceURL": "http://cdsarc.u-strasbg.fr/cgi-bin/Cat?I/252", "regionOfRegard": NaN, "resourceID": "ivo://CDS.VizieR/I/252", "shortName": "I/252", "subject": "#Positional_Data#", "tags": "Catalog", "title": "The USNO-A2.0 Catalogue (Monet+ 1998)", "type": "#Catalog#", "updated": "2011-09-14T20:20:21", "url": "http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out&", "validate_expected": "good", "validate_network_error": null, "validate_nexceptions": 0, "validate_nwarnings": 1, "validate_out_db_name": "good", "validate_version": "1.1", "validate_warning_types": [ "W22" ], "validate_warnings": [ "./results/f7/bb/d44fbd316338550aed4e1c1a8fc6/vo.xml:13:0: W22: The DEFINITIONS element is deprecated in VOTable 1.1. Ignoring" ], "validate_xmllint": true, "validate_xmllint_content": "./results/f7/bb/d44fbd316338550aed4e1c1a8fc6/vo.xml validates\n", "version": "27-Oct-1998", "waveband": "#Optical#" } Found in good astropy-0.3/astropy/vo/validator/tests/data/conesearch_warn.json0000644000175000017500000000005512243255342023420 0ustar oleole{ "__version__": 1, "catalogs": {} }astropy-0.3/astropy/vo/validator/tests/data/listcats2.out0000644000175000017500000000030712243255342022025 0ustar oleoleHST Guide Star Catalog 2.3 1 http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& The USNO-A2.0 Catalogue (Monet+ 1998) 1 http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out& astropy-0.3/astropy/vo/validator/__init__.py0000644000175000017500000000000012243255342017410 0ustar oleoleastropy-0.3/astropy/vo/validator/validate.py0000644000175000017500000003002012243255342017447 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Validate VO Services.""" from __future__ import print_function, division # STDLIB import json import multiprocessing import os import time import warnings from collections import defaultdict from copy import deepcopy # THIRD PARTY import numpy as np # LOCAL from ..client import vos_catalog from ...config.configuration import ConfigurationItem from ...io import votable from ...io.votable.exceptions import E19 from ...io.votable.validator import html, result from ...logger import log from ...utils.data import get_readable_fileobj, get_pkg_data_contents from ...utils.data import REMOTE_TIMEOUT from ...utils.misc import JsonCustomEncoder from ...utils.xml.unescaper import unescape_all from ...utils.exceptions import AstropyUserWarning # Temporary solution until STScI VAO registry formally provides # tags from .tstquery import parse_cs __all__ = ['check_conesearch_sites'] CS_MSTR_LIST = ConfigurationItem( 'cs_mstr_list', 'http://vao.stsci.edu/directory/NVORegInt.asmx/VOTCapabilityPredOpt?' 'predicate=1%3D1&capability=conesearch&VOTStyleOption=2', 'Cone Search services master list for validation.') CS_URLS = ConfigurationItem( 'cs_urls', get_pkg_data_contents( os.path.join('data', 'conesearch_urls.txt')).split(), 'Only check these Cone Search URLs.', 'list') NONCRIT_WARNINGS = ConfigurationItem( 'noncrit_warnings', ['W03', 'W06', 'W07', 'W09', 'W10', 'W15', 'W17', 'W20', 'W21', 'W22', 'W27', 'W28', 'W29', 'W41', 'W42', 'W48', 'W50'], 'VO Table warning codes that are considered non-critical', 'list') _OUT_ROOT = None # Set by `check_conesearch_sites` def check_conesearch_sites(destdir=os.curdir, verbose=True, parallel=True, url_list=CS_URLS()): """Validate Cone Search Services. .. note:: URLs are unescaped prior to validation. Only check queries with ```` parameters. Does not perform meta-data and erroneous queries. Parameters ---------- destdir : str Directory to store output files. Will be created if does not exist. Existing files with these names will be deleted or replaced: * conesearch_good.json * conesearch_warn.json * conesearch_exception.json * conesearch_error.json verbose : bool Print extra info to log. parallel : bool Enable multiprocessing. url_list : list of string Only check these access URLs against ``astropy.vo.validator.validate.CS_MSTR_LIST`` and ignore the others, which will not appear in output files. By default, check those in ``astropy.vo.validator.validate.CS_URLS``. If `None`, check everything. Raises ------ AssertionError Parameter failed assertion test. IOError Invalid destination directory. timeout URL request timed out. """ global _OUT_ROOT # Start timer t_beg = time.time() if (not isinstance(destdir, basestring) or len(destdir) == 0 or os.path.exists(destdir) and not os.path.isdir(destdir)): raise IOError('Invalid destination directory') # pragma: no cover if not os.path.exists(destdir): os.mkdir(destdir) # Output dir created by votable.validator _OUT_ROOT = os.path.join(destdir, 'results') if not os.path.exists(_OUT_ROOT): os.mkdir(_OUT_ROOT) # Output files db_file = {} db_file['good'] = os.path.join(destdir, 'conesearch_good.json') db_file['warn'] = os.path.join(destdir, 'conesearch_warn.json') db_file['excp'] = os.path.join(destdir, 'conesearch_exception.json') db_file['nerr'] = os.path.join(destdir, 'conesearch_error.json') # JSON dictionaries for output files js_template = {'__version__': 1, 'catalogs': {}} js_mstr = deepcopy(js_template) js_tree = {} for key in db_file: js_tree[key] = deepcopy(js_template) # Delete existing files, if any, to be on the safe side. # Else can cause confusion if program exited prior to # new files being written but old files are still there. if os.path.exists(db_file[key]): # pragma: no cover os.remove(db_file[key]) if verbose: log.info('Existing file {0} deleted'.format(db_file[key])) # Get all Cone Search sites with get_readable_fileobj(CS_MSTR_LIST(), encoding='binary', show_progress=verbose) as fd: tab_all = votable.parse_single_table(fd, pedantic=False) arr_cone = tab_all.array.data[np.where( tab_all.array['capabilityClass'] == b'ConeSearch')] assert arr_cone.size > 0, \ 'astropy.vo.validator.validate.CS_MSTR_LIST yields no valid result' fixed_urls = [unescape_all(cur_url) for cur_url in arr_cone['accessURL']] uniq_urls = set(fixed_urls) if url_list is None: url_list = uniq_urls else: tmp_list = [cur_url.encode('utf-8') if isinstance(cur_url, str) else cur_url for cur_url in set(url_list)] url_list = [unescape_all(cur_url) for cur_url in tmp_list] if verbose: log.info('Only {0}/{1} site(s) are validated'.format( len(url_list), len(uniq_urls))) uniq_rows = len(url_list) # Re-structure dictionary for JSON file col_names = tab_all.array.dtype.names title_counter = defaultdict(int) key_lookup_by_url = {} for cur_url in url_list: num_match = fixed_urls.count(cur_url) if num_match == 0: warnings.warn('{0} not found in cs_mstr_list! Skipping...'.format(cur_url), AstropyUserWarning) continue i = fixed_urls.index(cur_url) n_ignored = num_match - 1 row_d = {'duplicatesIgnored': n_ignored} if verbose and n_ignored > 0: # pragma: no cover log.info('{0} has {1} ignored duplicate entries in ' 'cs_mstr_list'.format(cur_url, n_ignored)) cur_title = arr_cone[i]['title'] title_counter[cur_title] += 1 if isinstance(cur_title, bytes): # pragma: py3 cat_key = '{0} {1}'.format(cur_title.decode('ascii'), title_counter[cur_title]) else: # pragma: py2 cat_key = '{0} {1}'.format(cur_title, title_counter[cur_title]) for col in col_names: if col == 'accessURL': row_d['url'] = fixed_urls[i] else: row_d[col] = arr_cone[i][col] # Use testQuery to return non-empty VO table testquery_pars = parse_cs(arr_cone[i]['resourceID']) cs_pars_arr = ['='.join([key, testquery_pars[key]]).encode('utf-8') for key in testquery_pars] # Max verbosity cs_pars_arr += [b'VERB=3'] js_mstr['catalogs'][cat_key] = row_d key_lookup_by_url[cur_url + b'&'.join(cs_pars_arr)] = cat_key # Validate URLs all_urls = key_lookup_by_url.keys() if parallel: mp_list = [] pool = multiprocessing.Pool() mp_proc = pool.map_async(_do_validation, all_urls, callback=mp_list.append) mp_proc.wait() assert len(mp_list) > 0, \ 'Multiprocessing pool callback returned empty list' mp_list = mp_list[0] else: mp_list = [_do_validation(cur_url) for cur_url in all_urls] # Categorize validation results for r in mp_list: db_key = r['out_db_name'] cat_key = key_lookup_by_url[r.url] js_tree[db_key]['catalogs'][cat_key] = js_mstr['catalogs'][cat_key] _copy_r_to_db(r, js_tree[db_key]['catalogs'][cat_key]) # Write to HTML html_subsets = result.get_result_subsets(mp_list, _OUT_ROOT) html.write_index(html_subsets, all_urls, _OUT_ROOT) if parallel: html_subindex_args = [(html_subset, uniq_rows) for html_subset in html_subsets] mp_proc = pool.map_async(_html_subindex, html_subindex_args) mp_proc.wait() else: for html_subset in html_subsets: _html_subindex((html_subset, uniq_rows)) # Write to JSON n = {} n_tot = 0 for key in db_file: n[key] = len(js_tree[key]['catalogs']) n_tot += n[key] if verbose: log.info('{0}: {1} catalog(s)'.format(key, n[key])) with open(db_file[key], 'w') as f_json: f_json.write(json.dumps(js_tree[key], cls=JsonCustomEncoder, sort_keys=True, indent=4)) # End timer t_end = time.time() if verbose: log.info('total: {0} catalog(s)'.format(n_tot)) log.info('Validation of {0} site(s) took {1:.3f} s'.format( uniq_rows, t_end - t_beg)) if n['good'] == 0: # pragma: no cover warnings.warn('No good sites available for Cone Search.', AstropyUserWarning) def _do_validation(url): """Validation for multiprocessing support.""" votable.table.reset_vo_warnings() r = result.Result(url, root=_OUT_ROOT, timeout=REMOTE_TIMEOUT()) r.validate_vo() _categorize_result(r) # This was already checked above. # Calling this again to get VOTableFile object to catch # well-formed error responses in downloaded XML. # # 'incorrect' is also added in case user wants to use # 'conesearch_warn.json' anyway. # # If using cached data, it will not detect network error # like the first run, but will raise exception. # # When SR is not 0, VOSError is raised for empty table. # if r['expected'] in ('good', 'incorrect') and r['nexceptions'] == 0: nexceptions = 0 nwarnings = 0 lines = [] with warnings.catch_warnings(record=True) as warning_lines: try: tab = vos_catalog.vo_tab_parse(votable.table.parse( r.get_vo_xml_path(), pedantic=False), r.url, {}) except (E19, IndexError, vos_catalog.VOSError) as e: # pragma: no cover lines.append(str(e)) nexceptions += 1 lines = [str(x.message) for x in warning_lines] + lines warning_types = set() for line in lines: # pragma: no cover w = votable.exceptions.parse_vowarning(line) if w['is_warning']: nwarnings += 1 if w['is_exception']: nexceptions += 1 warning_types.add(w['warning']) r['nwarnings'] += nwarnings r['nexceptions'] += nexceptions r['warnings'] += lines r['warning_types'] = r['warning_types'].union(warning_types) _categorize_result(r) html.write_result(r) return r def _categorize_result(r): """Set success codes. Parameters ---------- r : `astropy.io.votable.validator.result.Result` object """ if 'network_error' in r and r['network_error'] is not None: # pragma: no cover r['out_db_name'] = 'nerr' r['expected'] = 'broken' elif ((r['nexceptions'] == 0 and r['nwarnings'] == 0) or r['warning_types'].issubset(NONCRIT_WARNINGS())): r['out_db_name'] = 'good' r['expected'] = 'good' elif r['nexceptions'] > 0: # pragma: no cover r['out_db_name'] = 'excp' r['expected'] = 'incorrect' elif r['nwarnings'] > 0: # pragma: no cover r['out_db_name'] = 'warn' r['expected'] = 'incorrect' else: # pragma: no cover raise vos_catalog.VOSError( 'Unhandled validation result attributes: ' '{0}'.format(r._attributes)) def _html_subindex(args): """HTML writer for multiprocessing support.""" subset, total = args html.write_index_table(_OUT_ROOT, *subset, total=total) def _copy_r_to_db(r, db): """Copy validation result attributes to given JSON database entry. Parameters ---------- r : `astropy.io.votable.validate.result.Result` object db : dict """ for key in r._attributes: new_key = 'validate_' + key db[new_key] = r._attributes[key] astropy-0.3/astropy/vo/validator/tstquery.py0000644000175000017500000000462312243255342017570 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Temporary solution until ``astropy.vo.validator.validate.CS_MSTR_LIST`` includes ```` fields. In case USVO service is unstable, it does the following: #. Try USVO production server. #. If fails, try USVO test server (has latest bug fix, but does not contain all registered services). #. If fails, use RA=0 DEC=0 SR=1. """ from __future__ import print_function, division # STDLIB from xml.dom import minidom # LOCAL from ...logger import log from ...utils import OrderedDict # For 2.6 compatibility from ...utils.data import get_readable_fileobj def parse_cs(id): """Return ```` pars as dict for given Resource ID.""" if isinstance(id, bytes): # pragma: py3 id = id.decode('ascii') # Production server. url = 'http://vao.stsci.edu/directory/getRecord.aspx?' \ 'id={0}&format=xml'.format(id) # Test server (in case production server fails). backup_url = 'http://vaotest.stsci.edu/directory/getRecord.aspx?' \ 'id={0}&format=xml'.format(id) tqp = ['ra', 'dec', 'sr'] d = OrderedDict() urls_failed = False urls_errmsg = '' try: with get_readable_fileobj(url, encoding='binary', show_progress=False) as fd: dom = minidom.parse(fd) except Exception as e: # pragma: no cover try: log.warn('{0} raised {1}, trying {2}'.format( url, str(e), backup_url)) with get_readable_fileobj(backup_url, encoding='binary', show_progress=False) as fd: dom = minidom.parse(fd) except Exception as e: urls_failed = True urls_errmsg = '{0} raised {1}, using default'.format( backup_url, str(e)) if not urls_failed: tq = dom.getElementsByTagName('testQuery') if tq: for key in tqp: d[key.upper()] = tq[0].getElementsByTagName( key)[0].firstChild.nodeValue.strip() else: # pragma: no cover urls_failed = True urls_errmsg = 'No testQuery found for {0}, using default'.format(id) # If no testQuery found, use RA=0 DEC=0 SR=1 if urls_failed: # pragma: no cover d = OrderedDict({'RA': '0', 'DEC': '0', 'SR': '1'}) log.warn(urls_errmsg) return d astropy-0.3/astropy/vo/validator/setup_package.py0000755000175000017500000000042112243255342020476 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return { 'astropy.vo.validator': ['data/*.txt'], 'astropy.vo.validator.tests': ['data/*.json', 'data/*.xml', 'data/*.out']} astropy-0.3/astropy/vo/validator/data/0000755000175000017500000000000012243263747016232 5ustar oleoleastropy-0.3/astropy/vo/validator/data/conesearch_urls.txt0000644000175000017500000000433612243255342022150 0ustar oleolehttp://archive.noao.edu/nvo/usno.php?cat=a& http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23& http://irsa.ipac.caltech.edu/cgi-bin/Oasis/CatSearch/nph-catsearch?CAT=fp_psc& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/220/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/243/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/252/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/254/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/255/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=I/284/out& http://vizier.u-strasbg.fr/viz-bin/votable/-A?-source=II/246/out& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=field& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=photoobjall& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=phototag& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=specobjall& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=specphotoall& http://vo.astronet.ru/sai_cas/conesearch?cat=sdssdr7&tab=sppparams& http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&tab=psc& http://vo.astronet.ru/sai_cas/conesearch?cat=twomass&tab=xsc& http://vo.astronet.ru/sai_cas/conesearch?cat=usnoa2&tab=main& http://vo.astronet.ru/sai_cas/conesearch?cat=usnob1&tab=main& http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&DSATAB=Galaxy& http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&DSATAB=PhotoObj& http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&DSATAB=PhotoObjAll& http://wfaudata.roe.ac.uk/sdssdr7-dsa/DirectCone?DSACAT=SDSS_DR7&DSATAB=Star& http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&DSATAB=PhotoObjAll& http://wfaudata.roe.ac.uk/sdssdr8-dsa/DirectCone?DSACAT=SDSS_DR8&DSATAB=SpecObjAll& http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&DSATAB=twomass_psc& http://wfaudata.roe.ac.uk/twomass-dsa/DirectCone?DSACAT=TWOMASS&DSATAB=twomass_xsc& http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-A2& http://www.nofs.navy.mil/cgi-bin/vo_cone.cgi?CAT=USNO-B1& astropy-0.3/astropy/vo/validator/inspect.py0000644000175000017500000001162612243255342017336 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Inspect results from `astropy.vo.validator.validate`.""" from __future__ import print_function, division # STDLIB import sys # LOCAL from ..client.vos_catalog import get_remote_catalog_db __all__ = ['ConeSearchResults'] class ConeSearchResults(object): """A class to store Cone Search validation results. Attributes ---------- dbtypes : list Cone Search database identifiers. dbs : dict Stores `astropy.vo.client.vos_catalog.VOSDatabase` for each ``dbtypes``. catkeys : dict Stores sorted catalog keys for each ``dbtypes``. Parameters ---------- cache : bool Read from cache, if available. Default is `False` to ensure the latest data are read. verbose : bool Show download progress bars. """ def __init__(self, cache=False, verbose=True): self.dbtypes = ['good', 'warn', 'exception', 'error'] self.dbs = {} self.catkeys = {} for typ in self.dbtypes: self.dbs[typ] = get_remote_catalog_db( 'conesearch_' + typ, cache=cache, verbose=verbose) self.catkeys[typ] = self.dbs[typ].list_catalogs() def tally(self, fout=None): """ Tally databases. Parameters ---------- fout : output stream Default is sys.stdout. """ if fout is None: fout = sys.stdout str_list = [] n_tot = 0 for typ in self.dbtypes: n_cur = len(self.catkeys[typ]) n_tot += n_cur str_list.append('{0}: {1} catalog(s)'.format(typ, n_cur)) if len(str_list) > 0: str_list.append('total: {0} catalog(s)\n'.format(n_tot)) fout.write('\n'.join(str_list)) def list_cats(self, typ, fout=None, ignore_noncrit=False): """ List catalogs in given database. Listing contains: #. Catalog key #. Cone search access URL #. Warning codes #. Warning descriptions Parameters ---------- typ : str Any value in ``self.dbtypes``. fout : output stream Default is screen output. ignore_noncrit : bool Exclude warnings in ``astropy.vo.validator.validate.NONCRIT_WARNINGS``. This is useful to see why a catalog failed validation. """ if fout is None: fout = sys.stdout assert typ in self.dbtypes str_list = [] for cat in self.catkeys[typ]: cat_db = self.dbs[typ].get_catalog(cat) if ignore_noncrit: out_wt = _exclude_noncrit(cat_db['validate_warning_types']) out_ws = _exclude_noncrit(cat_db['validate_warnings']) else: out_wt = cat_db['validate_warning_types'] out_ws = cat_db['validate_warnings'] # Warning types contains None if some other Exception was thrown. # There should be only 1 occurence for each warning type. # But will put in a loop anyway, just in case. while None in out_wt: # pragma: no cover out_wt[out_wt.index(None)] = 'None' str_list += [cat, cat_db['url']] if len(out_wt) > 0: str_list.append(','.join(out_wt)) if len(out_ws) > 0: str_list.append('\n'.join(out_ws)) str_list[-1] += '\n' if len(str_list) > 0: fout.write('\n'.join(str_list)) def print_cat(self, key, fout=None): """ Display a single catalog of given key. If not found, nothing is written out. Parameters ----------- key : str Catalog key. fout : output stream Default is screen output. """ if fout is None: fout = sys.stdout str_list = [] for typ in self.dbtypes: if key in self.catkeys[typ]: str_list += [self.dbs[typ].get_catalog(key).dumps(), '\nFound in {0}'.format(typ)] # Only has one match, so quits when it is found break if len(str_list) > 0: fout.write('\n'.join(str_list) + '\n') def _exclude_noncrit(in_list): """ Exclude any items in input list containing ``astropy.vo.validator.validate.NONCRIT_WARNINGS``. Parameters ---------- in_list : list List of strings to process. Returns ------- out_list : list List with only qualified strings. """ from .validate import NONCRIT_WARNINGS out_list = [] for s in in_list: n = 0 if s is not None: for w in NONCRIT_WARNINGS(): n += s.count(w) if n == 0: # pragma: no cover out_list.append(s) return out_list astropy-0.3/astropy/stats/0000755000175000017500000000000012243263747014046 5ustar oleoleastropy-0.3/astropy/stats/tests/0000755000175000017500000000000012243263747015210 5ustar oleoleastropy-0.3/astropy/stats/tests/__init__.py0000644000175000017500000000000012243255342017277 0ustar oleoleastropy-0.3/astropy/stats/tests/test_funcs.py0000644000175000017500000001717312243255342017740 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from numpy.random import randn from numpy.testing import assert_equal from numpy.testing.utils import assert_allclose from ...tests.helper import pytest from .. import funcs from ...utils.misc import NumpyRNGContext try: from scipy import stats # used in testing except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True def test_sigma_clip(): #need to seed the numpy RNG to make sure we don't get some amazingly flukey #random number that breaks one of the tests with NumpyRNGContext(12345): # Amazing, I've got the same combination on my luggage! randvar = randn(10000) filtered_data = funcs.sigma_clip(randvar, 1, 2) assert sum(filtered_data.mask) > 0 assert sum(~filtered_data.mask) < randvar.size #this is actually a silly thing to do, because it uses the standard #deviation as the variance, but it tests to make sure these arguments #are actually doing something filtered_data2 = funcs.sigma_clip(randvar, 1, 2, varfunc=np.std) assert not np.all(filtered_data.mask == filtered_data2.mask) filtered_data3 = funcs.sigma_clip(randvar, 1, 2, cenfunc=np.mean) assert not np.all(filtered_data.mask == filtered_data3.mask) # make sure the iters=None method works at all. filtered_data = funcs.sigma_clip(randvar, 3, None) # test copying assert filtered_data.data[0] == randvar[0] filtered_data.data[0] += 1. assert filtered_data.data[0] != randvar[0] filtered_data = funcs.sigma_clip(randvar, 3, None, copy=False) assert filtered_data.data[0] == randvar[0] filtered_data.data[0] += 1. assert filtered_data.data[0] == randvar[0] # test axis data = np.arange(5)+np.random.normal(0., 0.05, (5, 5))+np.diag(np.ones(5)) filtered_data = funcs.sigma_clip(data, axis=0, sig=2.3) assert filtered_data.count() == 20 filtered_data = funcs.sigma_clip(data, axis=1, sig=2.3) assert filtered_data.count() == 25 def test_median_absolute_deviation(): #need to seed the numpy RNG to make sure we don't get some amazingly flukey #random number that breaks one of the tests with NumpyRNGContext(12345): #test that it runs randvar = randn(10000) mad = funcs.median_absolute_deviation(randvar) #test whether an array is returned if an axis is used randvar = randvar.reshape((10, 1000)) mad = funcs.median_absolute_deviation(randvar, axis=1) assert len(mad) == 10 assert mad.size < randvar.size def test_biweight_location(): #need to seed the numpy RNG to make sure we don't get some amazingly flukey #random number that breaks one of the tests with NumpyRNGContext(12345): #test that it runs randvar = randn(10000) cbl = funcs.biweight_location(randvar) assert abs(cbl-0) < 1e-2 def test_biweight_location_small(): cbl = funcs.biweight_location([1, 3, 5, 500, 2]) assert abs(cbl-2.745) < 1e-3 def test_biweight_midvariance(): #need to seed the numpy RNG to make sure we don't get some amazingly flukey #random number that breaks one of the tests with NumpyRNGContext(12345): #test that it runs randvar = randn(10000) scl = funcs.biweight_midvariance(randvar) assert abs(scl-1) < 1e-2 def test_biweight_midvariance_small(): scl = funcs.biweight_midvariance([1, 3, 5, 500, 2]) assert abs(scl-1.529) < 1e-3 @pytest.mark.skipif('not HAS_SCIPY') def test_compare_to_scipy_sigmaclip(): #need to seed the numpy RNG to make sure we don't get some amazingly flukey #random number that breaks one of the tests with NumpyRNGContext(12345): randvar = randn(10000) astropyres = funcs.sigma_clip(randvar, 3, None, np.mean) scipyres = stats.sigmaclip(randvar, 3, 3)[0] assert astropyres.count() == len(scipyres) assert_equal(astropyres[~astropyres.mask].data, scipyres) @pytest.mark.skipif('not HAS_SCIPY') def test_binom_conf_interval(): # Test Wilson and Jeffreys interval for corner cases: # Corner cases: k = 0, k = n, conf = 0., conf = 1. n = 5 k = [0, 4, 5] for conf in [0., 0.5, 1.]: res = funcs.binom_conf_interval(k, n, conf=conf, interval='wilson') assert ((res >= 0.) & (res <= 1.)).all() res = funcs.binom_conf_interval(k, n, conf=conf, interval='jeffreys') assert ((res >= 0.) & (res <= 1.)).all() # Test Jeffreys interval accuracy against table in Brown et al. (2001). # (See `binom_conf_interval` docstring for reference.) k = [0, 1, 2, 3, 4] n = 7 conf = 0.95 result = funcs.binom_conf_interval(k, n, conf=conf, interval='jeffreys') table = np.array([[0.000, 0.016, 0.065, 0.139, 0.234], [0.292, 0.501, 0.648, 0.766, 0.861]]) assert_allclose(result, table, atol=1.e-3, rtol=0.) # Test Wald interval result = funcs.binom_conf_interval(0, 5, interval='wald') assert_allclose(result, 0.) # conf interval is [0, 0] when k = 0 result = funcs.binom_conf_interval(5, 5, interval='wald') assert_allclose(result, 1.) # conf interval is [1, 1] when k = n result = funcs.binom_conf_interval(500, 1000, conf=0.68269, interval='wald') assert_allclose(result[0], 0.5 - 0.5 / np.sqrt(1000.)) assert_allclose(result[1], 0.5 + 0.5 / np.sqrt(1000.)) @pytest.mark.skipif('not HAS_SCIPY') def test_binned_binom_proportion(): # Check that it works. nbins = 20 x = np.linspace(0., 10., 100) # Guarantee an `x` in every bin. success = np.ones(len(x), dtype=np.bool) bin_ctr, bin_hw, p, perr = funcs.binned_binom_proportion(x, success, bins=nbins) # Check shape of outputs assert bin_ctr.shape == (nbins,) assert bin_hw.shape == (nbins,) assert p.shape == (nbins,) assert perr.shape == (2, nbins) # Check that p is 1 in all bins, since success = True for all `x`. assert (p == 1.).all() # Check that p is 0 in all bins if success = False for all `x`. success[:] = False bin_ctr, bin_hw, p, perr = funcs.binned_binom_proportion(x, success, bins=nbins) assert (p == 0.).all() def test_signal_to_noise_oir_ccd(): result = funcs.signal_to_noise_oir_ccd(1, 25, 0, 0, 0, 1) assert 5.0 == result #check to make sure gain works result = funcs.signal_to_noise_oir_ccd(1, 5, 0, 0, 0, 1, 5) assert 5.0 == result #now add in sky, dark current, and read noise #make sure the snr goes down result = funcs.signal_to_noise_oir_ccd(1, 25, 1, 0, 0, 1) assert result < 5.0 result = funcs.signal_to_noise_oir_ccd(1, 25, 0, 1, 0, 1) assert result < 5.0 result = funcs.signal_to_noise_oir_ccd(1, 25, 0, 0, 1, 1) assert result < 5.0 #make sure snr increases with time result = funcs.signal_to_noise_oir_ccd(2, 25, 0, 0, 0, 1) assert result > 5.0 def test_bootstrap(): bootarr = np.array([1,2,3,4,5,6,7,8,9,0]) #test general bootstrapping answer = np.array([[7,4,8,5,7,0,3,7,8,5],[4,8,8,3,6,5,2,8,6,2]]) with NumpyRNGContext(42): assert_equal(answer,funcs.bootstrap(bootarr,2)) #test with a bootfunction with NumpyRNGContext(42): bootresult = np.mean(funcs.bootstrap(bootarr,10000,bootfunc=np.mean)) assert_allclose(np.mean(bootarr),bootresult,atol=0.01) astropy-0.3/astropy/stats/__init__.py0000644000175000017500000000102312243255342016143 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains statistical tools provided for or used by Astropy. While the `scipy.stats` package contains a wide range of statistical tools, it is a general-purpose package, and is missing some that are particularly useful to astronomy or are used in an atypical way in astronomy. This package is intended to provide such functionality, but *not* to replace `scipy.stats` if its implementation satisfies astronomers' needs. """ from .funcs import * astropy-0.3/astropy/stats/setup_package.py0000644000175000017500000000004612243255342017223 0ustar oleoledef requires_2to3(): return False astropy-0.3/astropy/stats/funcs.py0000644000175000017500000007330112243255342015532 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains simple statistical algorithms that are straightforwardly implemented as a single python function (or family of functions). This module should generally not be used directly. Everything in `__all__` is imported into `astropy.stats`, and hence that package should be used for access. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ..extern.six.moves import xrange __all__ = ['sigma_clip', 'binom_conf_interval', 'binned_binom_proportion', 'median_absolute_deviation', 'biweight_location', 'biweight_midvariance', 'signal_to_noise_oir_ccd','bootstrap'] __doctest_skip__ = ['binned_binom_proportion'] __doctest_requires__ = {'binom_conf_interval': ['scipy.special']} def sigma_clip(data, sig=3, iters=1, cenfunc=np.median, varfunc=np.var, axis=None, copy=True): """ Perform sigma-clipping on the provided data. This performs the sigma clipping algorithm - i.e. the data will be iterated over, each time rejecting points that are more than a specified number of standard deviations discrepant. .. note:: `scipy.stats.sigmaclip` provides a subset of the functionality in this function. Parameters ---------- data : array-like The data to be sigma-clipped (any shape). sig : float The number of standard deviations (*not* variances) to use as the clipping limit. iters : int or None The number of iterations to perform clipping for, or None to clip until convergence is achieved (i.e. continue until the last iteration clips nothing). cenfunc : callable The technique to compute the center for the clipping. Must be a callable that takes in a masked array and outputs the central value. Defaults to the median (numpy.median). varfunc : callable The technique to compute the standard deviation about the center. Must be a callable that takes in a masked array and outputs a width estimator. Defaults to the standard deviation (numpy.var). axis : int or None If not None, clip along the given axis. For this case, axis=int will be passed on to cenfunc and varfunc, which are expected to return an array with the axis dimension removed (like the numpy functions). If None, clip over all values. Defaults to None. copy : bool If True, the data array will be copied. If False, the masked array data will contain the same array as `data`. Defaults to True. Returns ------- filtered_data : `numpy.masked.MaskedArray` A masked array with the same shape as `data` input, where the points rejected by the algorithm have been masked. Notes ----- 1. The routine works by calculating deviation = data - cenfunc(data [,axis=int]) and then setting a mask for points outside the range data.mask = deviation**2 > sig**2 * varfunc(deviation) It will iterate a given number of times, or until no further points are rejected. 2. Most numpy functions deal well with masked arrays, but if one would like to have an array with just the good (or bad) values, one can use:: good_only = filtered_data.data[~filtered_data.mask] bad_only = filtered_data.data[filtered_data.mask] However, for multidimensional data, this flattens the array, which may not be what one wants (especially is filtering was done along an axis). Examples -------- This will generate random variates from a Gaussian distribution and return a masked array in which all points that are more than 2 *sample* standard deviation from the median are masked:: >>> from astropy.stats import sigma_clip >>> from numpy.random import randn >>> randvar = randn(10000) >>> filtered_data = sigma_clip(randvar, 2, 1) This will clipping on a similar distribution, but for 3 sigma relative to the sample *mean*, will clip until converged, and does not copy the data:: >>> from astropy.stats import sigma_clip >>> from numpy.random import randn >>> from numpy import mean >>> randvar = randn(10000) >>> filtered_data = sigma_clip(randvar, 3, None, mean, copy=False) This will clip along one axis on a similar distribution with bad points inserted:: >>> from astropy.stats import sigma_clip >>> from numpy.random import normal >>> from numpy import arange, diag, ones >>> data = arange(5)+normal(0.,0.05,(5,5))+diag(ones(5)) >>> filtered_data = sigma_clip(data, axis=0, sig=2.3) Note that along the other axis, no points would be masked, as the variance is higher. """ if axis is not None: cenfunc_in = cenfunc varfunc_in = varfunc cenfunc = lambda d: np.expand_dims(cenfunc_in(d, axis=axis), axis=axis) varfunc = lambda d: np.expand_dims(varfunc_in(d, axis=axis), axis=axis) filtered_data = np.ma.array(data, copy=copy) if iters is None: i = -1 lastrej = filtered_data.count() + 1 while(filtered_data.count() != lastrej): i += 1 lastrej = filtered_data.count() do = filtered_data - cenfunc(filtered_data) filtered_data.mask |= do * do > varfunc(filtered_data) * sig ** 2 iters = i + 1 #TODO: ?print iters to the log if iters was None? else: for i in range(iters): do = filtered_data - cenfunc(filtered_data) filtered_data.mask |= do * do > varfunc(filtered_data) * sig ** 2 return filtered_data #TODO Note scipy dependency def binom_conf_interval(k, n, conf=0.68269, interval='wilson'): r"""Binomial proportion confidence interval given k successes, n trials. Parameters ---------- k : int or numpy.ndarray Number of successes (0 <= `k` <= `n`). n : int or numpy.ndarray Number of trials (`n` > 0). conf : float in [0, 1], optional Desired probability content of interval. Default is 0.68269. interval : {'wilson', 'jeffreys', 'wald'}, optional Formula used for confidence interval. See notes for details. The 'wilson' and 'jeffreys' intervals generally give similar results. 'wilson' should be somewhat faster, while 'jeffreys' is marginally superior. The 'wald' interval is generally not recommended. It is provided for comparison purposes. Default is 'wilson'. Returns ------- conf_interval : numpy.ndarray `conf_interval[0]` and `conf_interval[1]` correspond to the lower and upper limits, respectively, for each element in `k`, `n`. Notes ----- In situations where a probability of success is not known, it can be estimated from a number of trials (N) and number of observed successes (k). For example, this is done in Monte Carlo experiments designed to estimate a detection efficiency. It is simple to take the sample proportion of successes (k/N) as a reasonable best estimate of the true probability :math:`\epsilon`. However, deriving an accurate confidence interval on :math:`\epsilon` is non-trivial. There are several formulas for this interval (see [1]_). Three intervals are implemented here: **1. The Wilson Interval.** This interval, attributed to Wilson [2]_, is given by .. math:: CI_{\rm Wilson} = \frac{k + \kappa^2/2}{N + \kappa^2} \pm \frac{\kappa n^{1/2}}{n + \kappa^2} ((\hat{\epsilon}(1 - \hat{\epsilon}) + \kappa^2/(4n))^{1/2} where :math:`\hat{\epsilon} = k / N` and :math:`\kappa` is the number of standard deviations corresponding to the desired confidence interval for a *normal* distribution (for example, 1.0 for a confidence interval of 68.269%). For a confidence interval of 100(1 - :math:`\alpha`)%, .. math:: \kappa = \Phi^{-1}(1-\alpha/2) = \sqrt{2}{\rm erf}^{-1}(1-\alpha). **2. The Jeffreys Interval.** This interval is derived by applying Bayes' theorem to the binomial distribution with the noninformative Jeffreys prior [3]_, [4]_. The noninformative Jeffreys prior is the Beta distribution, Beta(1/2, 1/2), which has the density function .. math:: f(\epsilon) = \pi^{-1} \epsilon^{-1/2}(1-\epsilon)^{-1/2}. The posterior density function is also a Beta distribution: Beta(k + 1/2, N - k + 1/2). The interval is then chosen so that it is *equal-tailed*: Each tail (outside the interval) contains :math:`\alpha`/2 of the posterior probability, and the interval itself contains 1 - :math:`\alpha`. This interval must be calculated numerically. Additionally, when k = 0 the lower limit is set to 0 and when k = N the upper limit is set to 1, so that in these cases, there is only one tail containing :math:`\alpha`/2 and the interval itself contains 1 - :math:`\alpha`/2 rather than the nominal 1 - :math:`\alpha`. **3. The Wald Interval.** This interval is given by .. math:: CI_{\rm Wald} = \hat{\epsilon} \pm \kappa \sqrt{\frac{\hat{\epsilon}(1-\hat{\epsilon})}{N}} The Wald interval gives acceptable results in some limiting cases. Particularly, when N is very large, and the true proportion :math:`\epsilon` is not "too close" to 0 or 1. However, as the later is not verifiable when trying to estimate :math:`\epsilon`, this is not very helpful. Its use is not recommended, but it is provided here for comparison purposes due to its prevalence in everyday practical statistics. References ---------- .. [1] Brown, Lawrence D.; Cai, T. Tony; DasGupta, Anirban (2001). "Interval Estimation for a Binomial Proportion". Statistical Science 16 (2): 101-133. doi:10.1214/ss/1009213286 .. [2] Wilson, E. B. (1927). "Probable inference, the law of succession, and statistical inference". Journal of the American Statistical Association 22: 209-212. .. [3] Jeffreys, Harold (1946). "An Invariant Form for the Prior Probability in Estimation Problems". Proc. R. Soc. Lond.. A 24 186 (1007): 453-461. doi:10.1098/rspa.1946.0056 .. [4] Jeffreys, Harold (1998). Theory of Probability. Oxford University Press, 3rd edition. ISBN 978-0198503682 Examples -------- Integer inputs return an array with shape (2,): >>> binom_conf_interval(4, 5, interval='wilson') array([ 0.57921724, 0.92078259]) Arrays of arbitrary dimension are supported. The Wilson and Jeffreys intervals give similar results, even for small k, N: >>> binom_conf_interval([0, 1, 2, 5], 5, interval='wilson') array([[ 0. , 0.07921741, 0.21597328, 0.83333304], [ 0.16666696, 0.42078276, 0.61736012, 1. ]]) >>> binom_conf_interval([0, 1, 2, 5], 5, interval='jeffreys') array([[ 0. , 0.0842525 , 0.21789949, 0.82788246], [ 0.17211754, 0.42218001, 0.61753691, 1. ]]) In contrast, the Wald interval gives poor results for small k, N. For k = 0 or k = N, the interval always has zero length. >>> binom_conf_interval([0, 1, 2, 5], 5, interval='wald') array([[ 0. , 0.02111437, 0.18091075, 1. ], [ 0. , 0.37888563, 0.61908925, 1. ]]) For confidence intervals approaching 1, the Wald interval for 0 < k < N can give intervals that extend outside [0, 1]: >>> binom_conf_interval([0, 1, 2, 5], 5, interval='wald', conf=0.99) array([[ 0. , -0.26077835, -0.16433593, 1. ], [ 0. , 0.66077835, 0.96433593, 1. ]]) """ if conf < 0. or conf > 1.: raise ValueError('conf must be between 0. and 1.') alpha = 1. - conf k = np.asarray(k).astype(np.int) n = np.asarray(n).astype(np.int) if (n <= 0).any(): raise ValueError('n must be positive') if (k < 0).any() or (k > n).any(): raise ValueError('k must be in {0, 1, .., n}') if interval == 'wilson' or interval == 'wald': from scipy.special import erfinv kappa = np.sqrt(2.) * min(erfinv(conf), 1.e10) # Avoid overflows. k = k.astype(np.float) n = n.astype(np.float) p = k / n if interval == 'wilson': midpoint = (k + kappa ** 2 / 2.) / (n + kappa ** 2) halflength = (kappa * np.sqrt(n)) / (n + kappa ** 2) * \ np.sqrt(p * (1 - p) + kappa ** 2 / (4 * n)) conf_interval = np.array([midpoint - halflength, midpoint + halflength]) # Correct intervals out of range due to floating point errors. conf_interval[conf_interval < 0.] = 0. conf_interval[conf_interval > 1.] = 1. return conf_interval else: midpoint = p halflength = kappa * np.sqrt(p * (1. - p) / n) return np.array([midpoint - halflength, midpoint + halflength]) elif interval == 'jeffreys': from scipy.special import betaincinv lowerbound = betaincinv(k + 0.5, n - k + 0.5, alpha / 2.) upperbound = betaincinv(k + 0.5, n - k + 0.5, 1. - alpha / 2.) # Set lower or upper bound to k/n when k/n = 0 or 1. lowerbound[k == 0] = 0. upperbound[k == n] = 1. return np.array([lowerbound, upperbound]) else: raise ValueError('Unrecognized interval: {0:s}'.format(interval)) #TODO Note scipy dependency (needed in binom_conf_interval) def binned_binom_proportion(x, success, bins=10, range=None, conf=0.68269, interval='wilson'): """Binomial proportion and confidence interval in bins of a continuous variable `x`. Given a set of datapoint pairs where the `x` values are continuously distributed and the `success` values are binomial ("success / failure" or "true / false"), place the pairs into bins according to `x` value and calculate the binomial proportion (fraction of successes) and confidence interval in each bin. Parameters ---------- x : list_like Values. success : list_like (bool) Success (True) or failure (False) corresponding to each value in `x`. Must be same length as `x`. bins : int or sequence of scalars, optional If bins is an int, it defines the number of equal-width bins in the given range (10, by default). If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths (in this case, 'range' is ignored). range : (float, float), optional The lower and upper range of the bins. If `None` (default), the range is set to (x.min(), x.max()). Values outside the range are ignored. conf : float in [0, 1], optional Desired probability content in the confidence interval (p - perr[0], p + perr[1]) in each bin. Default is 0.68269. interval : {'wilson', 'jeffreys', 'wald'}, optional Formula used to calculate confidence interval on the binomial proportion in each bin. See `binom_conf_interval` for definition of the intervals. The 'wilson' and 'jeffreys' intervals generally give similar results. 'wilson' should be somewhat faster, while 'jeffreys' is marginally superior. The 'wald' interval is generally not recommended. It is provided for comparison purposes. Default is 'wilson'. Returns ------- bin_ctr : numpy.ndarray Central value of bins. Bins without any entries are not returned. bin_halfwidth : numpy.ndarray Half-width of each bin such that `bin_ctr - bin_halfwidth` and `bin_ctr + bins_halfwidth` give the left and right side of each bin, respectively. p : numpy.ndarray Efficiency in each bin. perr : numpy.ndarray 2-d array of shape (2, len(p)) representing the upper and lower uncertainty on p in each bin. See Also -------- binom_conf_interval : Function used to estimate confidence interval in each bin. Examples -------- Suppose we wish to estimate the efficiency of a survey in detecting astronomical sources as a function of magnitude (i.e., the probability of detecting a source given its magnitude). In a realistic case, we might prepare a large number of sources with randomly selected magnitudes, inject them into simulated images, and then record which were detected at the end of the reduction pipeline. As a toy example, we generate 100 data points with randomly selected magnitudes between 20 and 30 and "observe" them with a known detection function (here, the error function, with 50% detection probability at magnitude 25): >>> from scipy.special import erf >>> from scipy.stats.distributions import binom >>> def true_efficiency(x): ... return 0.5 - 0.5 * erf((x - 25.) / 2.) >>> mag = 20. + 10. * np.random.rand(100) >>> detected = binom.rvs(1, true_efficiency(mag)) >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20) >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o', ... label='estimate') .. plot:: import numpy as np from scipy.special import erf from scipy.stats.distributions import binom import matplotlib.pyplot as plt from astropy.stats import binned_binom_proportion def true_efficiency(x): return 0.5 - 0.5 * erf((x - 25.) / 2.) np.random.seed(400) mag = 20. + 10. * np.random.rand(100) np.random.seed(600) detected = binom.rvs(1, true_efficiency(mag)) bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20) plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o', label='estimate') X = np.linspace(20., 30., 1000) plt.plot(X, true_efficiency(X), ls='-', color='r', label='true efficiency') plt.ylim(0., 1.) plt.title('Detection efficiency vs magnitude') plt.xlabel('Magnitude') plt.ylabel('Detection efficiency') plt.legend() plt.show() The above example uses the Wilson confidence interval to calculate the uncertainty `perr` in each bin (see the definition of various confidence intervals in `binom_conf_interval`). A commonly used alternative is the Wald interval. However, the Wald interval can give nonsensical uncertainties when the efficiency is near 0 or 1, and is therefore **not** recommended. As an illustration, the following example shows the same data as above but uses the Wald interval rather than the Wilson interval to calculate `perr`: >>> bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20, ... interval='wald') >>> plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o', ... label='estimate') .. plot:: import numpy as np from scipy.special import erf from scipy.stats.distributions import binom import matplotlib.pyplot as plt from astropy.stats import binned_binom_proportion def true_efficiency(x): return 0.5 - 0.5 * erf((x - 25.) / 2.) np.random.seed(400) mag = 20. + 10. * np.random.rand(100) np.random.seed(600) detected = binom.rvs(1, true_efficiency(mag)) bins, binshw, p, perr = binned_binom_proportion(mag, detected, bins=20, interval='wald') plt.errorbar(bins, p, xerr=binshw, yerr=perr, ls='none', marker='o', label='estimate') X = np.linspace(20., 30., 1000) plt.plot(X, true_efficiency(X), ls='-', color='r', label='true efficiency') plt.ylim(0., 1.) plt.title('The Wald interval can give nonsensical uncertainties') plt.xlabel('Magnitude') plt.ylabel('Detection efficiency') plt.legend() plt.show() """ x = np.ravel(x) success = np.ravel(success).astype(np.bool) if x.shape != success.shape: raise ValueError('sizes of x and success must match') # Put values into a histogram (`n`). Put "successful" values # into a second histogram (`k`) with identical binning. n, bin_edges = np.histogram(x, bins=bins, range=range) k, bin_edges = np.histogram(x[success], bins=bin_edges) bin_ctr = (bin_edges[:-1] + bin_edges[1:]) / 2. bin_halfwidth = bin_ctr - bin_edges[:-1] # Remove bins with zero entries. valid = n > 0 bin_ctr = bin_ctr[valid] bin_halfwidth = bin_halfwidth[valid] n = n[valid] k = k[valid] p = k / n bounds = binom_conf_interval(k, n, conf=conf, interval=interval) perr = np.abs(bounds - p) return bin_ctr, bin_halfwidth, p, perr def median_absolute_deviation(a, axis=None): """Compute the median absolute deviation Returns the median absolute deviation of the array elements. The MAD is defined as :math `median( \|a - median (a)\| )`. Parameters ---------- a : array_like Input array or object that can be converted to an array. axis : int, optional Axis along which the medians are computed. The default (axis=None) is to compute the median along a flattened version of the array. Returns ------- median_absolute_deviation : ndarray A new array holding the result. If the input contains integers, or floats of smaller precision than 64, then the output data-type is float64. Otherwise, the output data-type is the same as that of the input. Examples -------- This will generate random variates from a Gaussian distribution and return the median absolute deviation for that distribution:: >>> from astropy.stats import median_absolute_deviation >>> from numpy.random import randn >>> randvar = randn(10000) >>> mad = median_absolute_deviation(randvar) See Also -------- median """ a = np.array(a, copy=False) a_median = np.median(a, axis=axis) #re-broadcast the output median array to subtract it if axis is not None: shape = list(a_median.shape) shape.append(1) a_median = a_median.reshape(shape) #calculated the median average deviation return np.median(np.abs(a - a_median), axis=axis) def biweight_location(a, c=6.0, M=None): """ Compute the biweight location for an array Returns the biweight location for the array elements. The biweight is a robust statistic for determining the central location of a distribution. The biweight location is given by the follow equation .. math:: C_{bl}= M+\\frac{\Sigma_{\|u_i\|<1} (x_i-M)(1-u_i^2)^2} {\Sigma_{\|u_i\|<1} (1-u_i^2)^2} where M is the sample mean or if run iterative the initial guess, and u_i is given by .. math:: u_{i} = \\frac{(x_i-M)}{cMAD} where MAD is the median absolute deviation. For more details, see Beers, Flynn, and Gebhardt, 1990, AJ, 100, 32B Parameters ---------- a : array_like Input array or object that can be converted to an array. c : float Tuning constant for the biweight estimator. Default value is 6.0. M : float, optional Initial gues for the biweight location. Returns ------- biweight_location: float Returns the biweight location for the array elements. Examples -------- This will generate random variates from a Gaussian distribution and return the median absolute deviation for that distribution:: >>> from astropy.stats.funcs import biweight_location >>> from numpy.random import randn >>> randvar = randn(10000) >>> cbl = biweight_location(randvar) See Also -------- median absolute deviation, biweight_midvariance """ a = np.array(a, copy=False) if M is None: M = np.median(a) #set up the difference d = a - M #set up the weighting u = d / c / median_absolute_deviation(a) #now remove the outlier points mask = np.abs(u) < 1 u = (1 - u**2)**2 return M+(d[mask]*u[mask]).sum()/u[mask].sum() def biweight_midvariance(a, c=9.0, M=None): """ Compute the biweight midvariance for an array Returns the biweight midvariance for the array elements. The biweight midvariance is a robust statistic for determining the midvariance (ie. the standard deviation) of a distribution. The biweight location is given by the follow equation .. math:: C_{bl}= n^{1/2} \\frac{[\Sigma_{|u_i|<1} (x_i-M)**2(1-u_i^2)^4]^{0.5}} {|\Sigma_{|u_i|<1} (1-u_i^2)(1-5u_i^2)|} where u_i is given by:: .. math:: u_{i} = \\frac{(x_i-M)}{cMAD} where MAD is the median absolute deviation. For the midvariance parameter, c is typically uses a value of 9.0. For more details, see Beers, Flynn, and Gebhardt, 1990, AJ, 100, 32B Parameters ---------- a : array_like Input array or object that can be converted to an array. c : float Tuning constant for the biweight estimator. Default value is 9.0. M : float, optional Initial gues for the biweight location. Returns ------- biweight_midvariance: float Returns the biweight midvariance for the array elements. Examples -------- This will generate random variates from a Gaussian distribution and return the median absolute deviation for that distribution:: >>> from astropy.stats.funcs import biweight_midvariance >>> from numpy.random import randn >>> randvar = randn(10000) >>> scl = biweight_midvariance(randvar) See Also -------- median absolute deviation, biweight_location """ a = np.array(a, copy=False) if M is None: M = np.median(a) #set up the difference d = a - M #set up the weighting u = d / c / median_absolute_deviation(a) #now remove the outlier points mask = np.abs(u) < 1 u = u**2 n = mask.sum() return n**0.5 * (d[mask] * d[mask] * (1 - u[mask])**4).sum()**0.5\ / np.abs(((1 - u[mask]) * (1 - 5 * u[mask])).sum()) def signal_to_noise_oir_ccd(t, source_eps, sky_eps, dark_eps, rd, npix, gain=1.0): """ Computes the signal to noise ratio for source being observed in the optical/IR using a CCD. Parameters ---------- t : float or numpy.ndarray CCD integration time in seconds source_eps : float Number of electrons (photons) or DN per second in the aperture from the source. Note that this should already have been scaled by the filter transmission and the quantum efficiency of the CCD. If the input is in DN, then be sure to set the gain to the proper value for the CCD. If the input is in electrons per second, then keep the gain as its default of 1.0. sky_eps : float Number of electrons (photons) or DN per second per pixel from the sky background. Should already be scaled by filter transmission and QE. This must be in the same units as source_eps for the calculation to make sense. dark_eps : float Number of thermal electrons per second per pixel. If this is given in DN or ADU, then multipy by the gain to get the value in electrons. rd : float Read noise of the CCD in electrons. If this is given in DN or ADU, then multipy by the gain to get the value in electrons. npix : float Size of the aperture in pixels gain : float Gain of the CCD. In units of electrons per DN. Returns ---------- SNR : float or numpy.ndarray Signal to noise ratio calculated from the inputs """ signal = t*source_eps*gain noise = np.sqrt(t*(source_eps*gain + npix*(sky_eps*gain + dark_eps)) + npix*rd**2 ) return signal / noise def bootstrap(data, bootnum=100, samples=None, bootfunc=None): """Performs bootstrap resampling on numpy arrays. Bootstrap resampling is used to understand confidence intervals of sample estimates. This function returns versions of the dataset resampled with replacement ("case bootstrapping"). These can all be run through a function or statistic to produce a distribution of values which can then be used to find the confidence intervals. Parameters ---------- data : numpy.ndarray N-D array. The boostrap resampling will be performed on the first index, so the first index should access the relevant information to be bootstrapped. bootnum : int Number of bootstrap resamples samples : int Number of samples in each resample. The default None sets samples to the number of datapoints bootfunc : function Function to reduce the resampled data. Each bootstrap resample will be put through this function and the results returned. If None, the bootstrapped data will be returned Returns ------- boot : numpy.ndarray Bootstrapped data. Each row is a bootstrap resample of the data. """ if samples is None: samples = data.shape[0] #make sure the input is sane assert samples > 0, "samples cannot be less than one" assert bootnum > 0, "bootnum cannot be less than one" if bootfunc is None: resultdims = (bootnum,) + (samples,) + data.shape[1:] boot = np.empty(resultdims) else: resultdims = (bootnum,) boot = np.empty(resultdims) for i in xrange(bootnum): bootarr = np.random.randint(low=0,high=data.shape[0],size=samples) if bootfunc is None: boot[i] = data[bootarr] else: boot[i] = bootfunc(data[bootarr]) return boot astropy-0.3/astropy/__init__.py0000644000175000017500000001703512243255342015017 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astropy is a package intended to contain core functionality and some common tools needed for performing astronomy and astrophysics research with Python. It also provides an index for other astronomy packages and tools for managing them. """ # this indicates whether or not we are in astropy's setup.py try: _ASTROPY_SETUP_ except NameError: from sys import version_info if version_info[0] >= 3: import builtins else: import __builtin__ as builtins builtins._ASTROPY_SETUP_ = False del version_info del builtins try: from .version import version as __version__ except ImportError: # TODO: Issue a warning using the logging framework __version__ = '' try: from .version import githash as __githash__ except ImportError: # TODO: Issue a warning using the logging framework __githash__ = '' __minimum_numpy_version__ = '1.5.0' # The location of the online documentation for astropy # This location will normally point to the current released version of astropy if 'dev' in __version__: online_docs_root = 'http://docs.astropy.org/en/latest/' else: online_docs_root = 'http://docs.astropy.org/en/{0}/'.format(__version__) def _check_numpy(): """ Check that Numpy is installed and it is of the minimum version we require. """ # Note: We could have used distutils.version for this comparison, # but it seems like overkill to import distutils at runtime. requirement_met = False try: import numpy except ImportError: pass else: major, minor, rest = numpy.__version__.split(".", 2) rmajor, rminor, rest = __minimum_numpy_version__.split(".", 2) requirement_met = ((int(major), int(minor)) >= (int(rmajor), int(rminor))) if not requirement_met: msg = ("numpy version {0} or later must be installed to use " "astropy".format( __minimum_numpy_version__)) raise ImportError(msg) return numpy if not _ASTROPY_SETUP_: _check_numpy() from .config import ConfigurationItem UNICODE_OUTPUT = ConfigurationItem( 'unicode_output', False, 'Use Unicode characters when outputting values, and writing widgets ' 'to the console.') # set up the test command def _get_test_runner(): from .tests.helper import TestRunner return TestRunner(__path__[0]) def test(package=None, test_path=None, args=None, plugins=None, verbose=False, pastebin=None, remote_data=False, pep8=False, pdb=False, coverage=False, open_files=False, parallel=0): """ Run Astropy tests using py.test. A proper set of arguments is constructed and passed to `pytest.main`. Parameters ---------- package : str, optional The name of a specific package to test, e.g. 'io.fits' or 'utils'. If nothing is specified all default Astropy tests are run. test_path : str, optional Specify location to test by path. May be a single file or directory. Must be specified absolutely or relative to the calling directory. args : str, optional Additional arguments to be passed to `pytest.main` in the `args` keyword argument. plugins : list, optional Plugins to be passed to `pytest.main` in the `plugins` keyword argument. verbose : bool, optional Convenience option to turn on verbose output from py.test. Passing True is the same as specifying `-v` in `args`. pastebin : {'failed','all',None}, optional Convenience option for turning on py.test pastebin output. Set to 'failed' to upload info for failed tests, or 'all' to upload info for all tests. remote_data : bool, optional Controls whether to run tests marked with @remote_data. These tests use online data and are not run by default. Set to True to run these tests. pep8 : bool, optional Turn on PEP8 checking via the pytest-pep8 plugin and disable normal tests. Same as specifying `--pep8 -k pep8` in `args`. pdb : bool, optional Turn on PDB post-mortem analysis for failing tests. Same as specifying `--pdb` in `args`. coverage : bool, optional Generate a test coverage report. The result will be placed in the directory htmlcov. open_files : bool, optional Fail when any tests leave files open. Off by default, because this adds extra run time to the test suite. Works only on platforms with a working `lsof` command. parallel : int, optional When provided, run the tests in parallel on the specified number of CPUs. If parallel is negative, it will use the all the cores on the machine. Requires the `pytest-xdist` plugin is installed. See Also -------- pytest.main : py.test function wrapped by `run_tests`. """ test_runner = _get_test_runner() return test_runner.run_tests( package=package, test_path=test_path, args=args, plugins=plugins, verbose=verbose, pastebin=pastebin, remote_data=remote_data, pep8=pep8, pdb=pdb, coverage=coverage, open_files=open_files, parallel=parallel) # if we are *not* in setup mode, import the logger and possibly populate the # configuration file with the defaults def _initialize_astropy(): from . import config import os import sys from warnings import warn def _rollback_import(message): log.error(message) # Now disable exception logging to avoid an annoying error in the # exception logger before we raise the import error: _teardown_log() # Roll back any astropy sub-modules that have been imported thus # far for key in list(sys.modules): if key.startswith('astropy.'): del sys.modules[key] raise ImportError('astropy') if sys.version_info[0] >= 3 and os.path.exists('setup.py'): _rollback_import( "You appear to be trying to import astropy from within a source " "checkout. This is currently not possible using Python 3 due to " "the reliance of 2to3 to convert some of Astropy's subpackages " "for Python 3 compatibility.") try: from .utils import _compiler except ImportError: if os.path.exists('setup.py'): _rollback_import( 'You appear to be trying to import astropy from within a ' 'source checkout; please run `./setup.py develop` or ' '`./setup.py build_ext --inplace` first so that extension ' 'modules can be compiled and made importable.') else: # Outright broken installation; don't be nice. raise # add these here so we only need to cleanup the namespace at the end config_dir = None config_dir = os.path.dirname(__file__) try: config.configuration.update_default_config(__package__, config_dir) except config.configuration.ConfigurationDefaultMissingError as e: wmsg = (e.args[0] + " Cannot install default profile. If you are " "importing from source, this is expected.") warn(config.configuration.ConfigurationDefaultMissingWarning(wmsg)) import logging # Use the root logger as a dummy log before initilizing Astropy's logger log = logging.getLogger() if not _ASTROPY_SETUP_: from .logger import _init_log, _teardown_log log = _init_log() _initialize_astropy() from .utils.misc import find_api_page astropy-0.3/astropy/cython_version.py0000644000175000017500000000007012243255477016331 0ustar oleole# Generated file; do not modify cython_version = '0.18' astropy-0.3/astropy/units/0000755000175000017500000000000012243263747014052 5ustar oleoleastropy-0.3/astropy/units/core.py0000644000175000017500000021566612243255342015364 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Core units classes and functions """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ..extern import six import copy import inspect import numbers import sys import textwrap import warnings import numpy as np from numpy import ma from ..utils.compat.fractions import Fraction from ..utils.exceptions import AstropyWarning from ..utils.misc import isiterable from .utils import is_effectively_unity from . import format as unit_format # TODO: Support functional units, e.g. log(x), ln(x) __all__ = [ 'UnitsError', 'UnitsException', 'UnitsWarning', 'UnitBase', 'NamedUnit', 'IrreducibleUnit', 'Unit', 'def_unit', 'CompositeUnit', 'PrefixUnit', 'UnrecognizedUnit', 'get_current_unit_registry', 'set_enabled_units', 'add_enabled_units', 'set_enabled_equivalencies', 'add_enabled_equivalencies', 'dimensionless_unscaled'] def _flatten_units_collection(items): """ Given a list of sequences, modules or dictionaries of units, or single units, return a flat set of all the units found. """ if not isinstance(items, list): items = [items] result = set() for item in items: if isinstance(item, UnitBase): result.add(item) else: if isinstance(item, dict): units = item.values() elif inspect.ismodule(item): units = vars(item).values() elif isiterable(item): units = item else: continue for unit in units: if isinstance(unit, UnitBase): result.add(unit) return result def _normalize_equivalencies(equivalencies): """ Normalizes equivalencies, ensuring each is a 4-tuple of the form:: (from_unit, to_unit, forward_func, backward_func) Parameters ---------- equivalencies : list of equivalency pairs Raises ------ ValueError if an equivalency cannot be interpreted """ if equivalencies is None: return [] normalized = [] for i, equiv in enumerate(equivalencies): if len(equiv) == 2: funit, tunit = equiv a = b = lambda x: x elif len(equiv) == 3: funit, tunit, a = equiv b = a elif len(equiv) == 4: funit, tunit, a, b = equiv else: raise ValueError( "Invalid equivalence entry {0}: {1!r}".format(i, equiv)) if not (isinstance(funit, UnitBase) and (isinstance(tunit, UnitBase) or tunit is None) and six.callable(a) and six.callable(b)): raise ValueError( "Invalid equivalence entry {0}: {1!r}".format(i, equiv)) normalized.append((funit, tunit, a, b)) return normalized class _UnitRegistry(object): """ Manages a registry of the enabled units. """ def __init__(self, init=[], equivalencies=[]): if isinstance(init, _UnitRegistry): equivalencies = init.equivalencies init = init.all_units self._reset_units() self._reset_equivalencies() self.add_enabled_units(init) self.add_enabled_equivalencies(equivalencies) def _reset_units(self): self._all_units = set() self._non_prefix_units = set() self._registry = {} self._by_physical_type = {} def _reset_equivalencies(self): self._equivalencies = set() @property def registry(self): return self._registry @property def all_units(self): return self._all_units @property def non_prefix_units(self): return self._non_prefix_units def set_enabled_units(self, units): """ Sets the units enabled in the unit registry. These units are searched when using `UnitBase.find_equivalent_units`, for example. Parameters ---------- units : list of sequences, dicts, or modules containing units, or units This is a list of things in which units may be found (sequences, dicts or modules), or units themselves. The entire set will be "enabled" for searching through by methods like `UnitBase.find_equivalent_units` and `UnitBase.compose`. """ self._reset_units() return self.add_enabled_units(units) def add_enabled_units(self, units): """ Adds to the set of units enabled in the unit registry. These units are searched when using `UnitBase.find_equivalent_units`, for example. Parameters ---------- units : list of sequences, dicts, or modules containing units, or units This is a list of things in which units may be found (sequences, dicts or modules), or units themselves. The entire set will be added to the "enabled" set for searching through by methods like `UnitBase.find_equivalent_units` and `UnitBase.compose`. """ units = _flatten_units_collection(units) for unit in units: # Loop through all of the names first, to ensure all of them # are new, then add them all as a single "transaction" below. for st in unit._names: if (st in self._registry and unit != self._registry[st]): raise ValueError( "Object with name {0!r} already exists in namespace. " "Filter the set of units to avoid name classes before " "enabling them.".format(st)) for st in unit._names: self._registry[st] = unit self._all_units.add(unit) if not isinstance(unit, PrefixUnit): self._non_prefix_units.add(unit) hash = unit._get_physical_type_id() self._by_physical_type.setdefault(hash, set()).add(unit) def get_units_with_physical_type(self, unit): """ Get all units in the registry with the same physical type as the given unit. Parameters ---------- unit : UnitBase instance """ return self._by_physical_type.get( unit._get_physical_type_id(), set()) @property def equivalencies(self): return list(self._equivalencies) def set_enabled_equivalencies(self, equivalencies): """ Sets the equivalencies enabled in the unit registry. These equivalencies are used if no explicit equivalencies are given, both in unit conversion and in finding equivalent units. This is meant in particular for allowing angles to be dimensionless. Use with care. Parameters ---------- equivalencies : list of equivalent pairs E.g., as returned by `astropy.units.angles_dimensionless`. """ self._reset_equivalencies() return self.add_enabled_equivalencies(equivalencies) def add_enabled_equivalencies(self, equivalencies): """ Adds to the set of equivalencies enabled in the unit registry. These equivalencies are used if no explicit equivalencies are given, both in unit conversion and in finding equivalent units. This is meant in particular for allowing angles to be dimensionless. Use with care. Parameters ---------- equivalencies : list of equivalent pairs E.g., as returned by `astropy.units.angles_dimensionless`. """ # pre-normalize list to help catch mistakes equivalencies = _normalize_equivalencies(equivalencies) self._equivalencies |= set(equivalencies) class _UnitContext(object): def __init__(self, init=[], equivalencies=[]): _unit_registries.append( _UnitRegistry( init=init, equivalencies=equivalencies)) def __enter__(self): pass def __exit__(self, type, value, tb): _unit_registries.pop() _unit_registries = [_UnitRegistry()] def get_current_unit_registry(): return _unit_registries[-1] def set_enabled_units(units): """ Sets the units enabled in the unit registry. These units are searched when using `UnitBase.find_equivalent_units`, for example. This may be used either permanently, or as a context manager using the ``with`` statement (see example below). Parameters ---------- units : list of sequences, dicts, or modules containing units, or units This is a list of things in which units may be found (sequences, dicts or modules), or units themselves. The entire set will be "enabled" for searching through by methods like `UnitBase.find_equivalent_units` and `UnitBase.compose`. Examples -------- >>> from astropy import units as u >>> with u.set_enabled_units([u.pc]): ... u.m.find_equivalent_units() ... Primary name | Unit definition | Aliases [ pc | 3.08568e+16 m | parsec , ] >>> u.m.find_equivalent_units() Primary name | Unit definition | Aliases [ AU | 1.49598e+11 m | au , Angstrom | 1e-10 m | AA, angstrom , cm | 0.01 m | centimeter , lyr | 9.46073e+15 m | lightyear , m | irreducible | meter , micron | 1e-06 m | , pc | 3.08568e+16 m | parsec , solRad | 6.95508e+08 m | R_sun, Rsun , ] """ # get a context with a new registry, using equivalencies of the current one context = _UnitContext( equivalencies=get_current_unit_registry().equivalencies) # in this new current registry, enable the units requested get_current_unit_registry().set_enabled_units(units) return context def add_enabled_units(units): """ Adds to the set of units enabled in the unit registry. These units are searched when using `UnitBase.find_equivalent_units`, for example. This may be used either permanently, or as a context manager using the ``with`` statement (see example below). Parameters ---------- units : list of sequences, dicts, or modules containing units, or units This is a list of things in which units may be found (sequences, dicts or modules), or units themselves. The entire set will be added to the "enabled" set for searching through by methods like `UnitBase.find_equivalent_units` and `UnitBase.compose`. Examples -------- >>> from astropy import units as u >>> from astropy.units import imperial >>> with u.add_enabled_units(imperial): ... u.m.find_equivalent_units() ... Primary name | Unit definition | Aliases [ AU | 1.49598e+11 m | au , Angstrom | 1e-10 m | AA, angstrom , cm | 0.01 m | centimeter , ft | 0.3048 m | foot , inch | 0.0254 m | , lyr | 9.46073e+15 m | lightyear , m | irreducible | meter , mi | 1609.34 m | mile , micron | 1e-06 m | , nmi | 1852 m | nauticalmile, NM , pc | 3.08568e+16 m | parsec , solRad | 6.95508e+08 m | R_sun, Rsun , yd | 0.9144 m | yard , ] """ # get a context with a new registry, which is a copy of the current one context = _UnitContext(get_current_unit_registry()) # in this new current registry, enable the further units requested get_current_unit_registry().add_enabled_units(units) return context def set_enabled_equivalencies(equivalencies): """ Sets the equivalencies enabled in the unit registry. These equivalencies are used if no explicit equivalencies are given, both in unit conversion and in finding equivalent units. This is meant in particular for allowing angles to be dimensionless. Use with care. Parameters ---------- equivalencies : list of equivalent pairs E.g., as returned by `astropy.units.angles_dimensionless`. Examples -------- Exponentiation normally requires dimensionless quantities. To avoid problems with complex phases:: >>> from astropy import units as u >>> with u.set_enabled_equivalencies(u.dimensionless_angles()): ... phase = 0.5 * u.cycle ... np.exp(1j*phase) # doctest: +ELLIPSIS """ # get a context with a new registry, using all units of the current one context = _UnitContext(get_current_unit_registry().all_units) # in this new current registry, enable the equivalencies requested get_current_unit_registry().set_enabled_equivalencies(equivalencies) return context def add_enabled_equivalencies(equivalencies): """ Adds to the equivalencies enabled in the unit registry. These equivalencies are used if no explicit equivalencies are given, both in unit conversion and in finding equivalent units. This is meant in particular for allowing angles to be dimensionless. Since no equivalencies are enabled by default, generally it is recommended to use `set_enabled_equivalencies`. Parameters ---------- equivalencies : list of equivalent pairs E.g., as returned by `astropy.units.angles_dimensionless`. """ # get a context with a new registry, which is a copy of the current one context = _UnitContext(get_current_unit_registry()) # in this new current registry, enable the further equivalencies requested get_current_unit_registry().add_enabled_equivalencies(equivalencies) return context class UnitsError(Exception): """ The base class for unit-specific exceptions. """ pass # deprecated alias. Remove in astropy 0.4 UnitsException = UnitsError class UnitsWarning(AstropyWarning): """ The base class for unit-specific exceptions. """ pass class UnitBase(object): """ Abstract base class for units. Most of the arithmetic operations on units are defined in this base class. Should not be instantiated by users directly. """ # Make sure that __rmul__ of units gets called over the __mul__ of Numpy # arrays to avoid element-wise multiplication. __array_priority__ = 1000 def __deepcopy__(self, memo): # This may look odd, but the units conversion will be very # broken after deep-copying if we don't guarantee that a given # physical unit corresponds to only one instance return self def _repr_latex_(self): """ Generate latex representation of unit name. This is used by the IPython notebook to print a unit with a nice layout. Returns ------- Latex string """ return unit_format.Latex().to_string(self) def __bytes__(self): """Return string representation for unit""" return unit_format.Generic().to_string(self).encode('ascii') if sys.version_info[0] < 3: __str__ = __bytes__ def __unicode__(self): """Return string representation for unit""" return unit_format.Generic().to_string(self) if sys.version_info[0] >= 3: __str__ = __unicode__ def __repr__(self): return 'Unit("' + unit_format.Generic().to_string(self) + '")' def _get_physical_type_id(self): """ Returns an identifier that uniquely identifies the physical type of this unit. It is comprised of the bases and powers of this unit, without the scale. Since it is hashable, it is useful as a dictionary key. """ unit = self.decompose() r = zip([x.name for x in unit.bases], unit.powers) # bases and powers are already sorted in a unique way # r.sort() r = tuple(r) return r @property def names(self): """ Returns all of the names associated with this unit. """ raise AttributeError( "Can not get names from unnamed units. " "Perhaps you meant to_string()?") return self._names @property def name(self): """ Returns the canonical (short) name associated with this unit. """ raise AttributeError( "Can not get names from unnamed units. " "Perhaps you meant to_string()?") @property def aliases(self): """ Returns the alias (long) names for this unit. """ raise AttributeError( "Can not get aliases from unnamed units. " "Perhaps you meant to_string()?") @property def scale(self): """ Return the scale of the unit. """ return 1.0 @property def bases(self): """ Return the bases of the unit. """ return [self] @property def powers(self): """ Return the powers of the unit. """ return [1.0] def _dimensionless_constant(self): if self.is_unity(): return 1.0 raise UnitsError( "'{0}' is not dimensionless".format(self.to_string())) def to_string(self, format='generic'): """ Output the unit in the given format as a string. Parameters ---------- format : `astropy.format.Base` instance or str The name of a format or a formatter object. If not provided, defaults to the generic format. """ f = unit_format.get_format(format) return f.to_string(self) def __format__(self, format_spec): """Try to format units using a formatter.""" try: return self.to_string(format=format_spec) except ValueError: return format(six.text_type(self), format_spec) @staticmethod def _normalize_equivalencies(equivalencies): """ Normalizes equivalencies, ensuring each is a 4-tuple of the form:: (from_unit, to_unit, forward_func, backward_func) Parameters ---------- equivalencies : list of equivalency pairs, or `None` Returns ------- A normalized list, including possible global defaults set by, e.g., `set_enabled_equivalencies`, except when `equivalencies`=`None`, in which case the returned list is always empty. Raises ------ ValueError if an equivalency cannot be interpreted """ normalized = _normalize_equivalencies(equivalencies) if equivalencies is not None: normalized += get_current_unit_registry().equivalencies return normalized def _validate_power(self, p): if isinstance(p, tuple) and len(p) == 2: p = Fraction(p[0], p[1]) if isinstance(p, numbers.Rational): # If the fractional power can be represented *exactly* as # a floating point number, we convert it to a float, to # make the math much faster, otherwise, we use a # `fractions.Fraction` object to avoid losing precision. denom = p.denominator # This is bit-twiddling hack to see if the integer is a # power of two if (denom & (denom - 1)) == 0: p = float(p) else: p = float(p) return p def __pow__(self, p): return CompositeUnit(1, [self], [p]) def __div__(self, m): if isinstance(m, (bytes, six.text_type)): m = Unit(m) if isinstance(m, UnitBase): if m.is_unity(): return self return CompositeUnit(1, [self, m], [1, -1]) # Cannot handle this as Unit, re-try as Quantity from .quantity import Quantity return Quantity(1, self) / m def __rdiv__(self, m): if isinstance(m, (bytes, six.text_type)): return Unit(m) / self # Cannot handle this as Unit, re-try as Quantity from .quantity import Quantity return m / Quantity(1, self) def __truediv__(self, m): return self.__div__(m) def __rtruediv__(self, m): return self.__rdiv__(m) def __mul__(self, m): if isinstance(m, (bytes, six.text_type)): m = Unit(m) if isinstance(m, UnitBase): if m.is_unity(): return self elif self.is_unity(): return m return CompositeUnit(1, [self, m], [1, 1]) # Cannot handle this as Unit, re-try as Quantity from .quantity import Quantity return Quantity(1, self) * m def __rmul__(self, m): if isinstance(m, (bytes, six.text_type)): return Unit(m) * self # Cannot handle this as Unit, re-try as Quantity from .quantity import Quantity return m * Quantity(1, self) if sys.version_info[0] >= 3: # pragma: no cover def __hash__(self): # Since this class defines __eq__, it will become unhashable # on Python 3.x, so we need to define our own hash. return id(self) def __eq__(self, other): if self is other: return True try: other = Unit(other, parse_strict='silent') except (ValueError, UnitsError): return False try: return np.allclose(self.to(other, 1), 1.0) except UnitsError: return False def __ne__(self, other): return not (self == other) def __lt__(self, other): other = Unit(other) return self.to(other, 1) < 1. def __gt__(self, other): other = Unit(other) return self.to(other, 1) > 1. def __le__(self, other): other = Unit(other) return self.to(other, 1) <= 1. def __ge__(self, other): other = Unit(other) return self.to(other, 1) >= 1. def __neg__(self): return self * -1. def is_equivalent(self, other, equivalencies=[]): """ Returns `True` if this unit is equivalent to `other`. Parameters ---------- other : unit object or string or tuple The unit to convert to. If a tuple of units is specified, this method returns true if the unit matches any of those in the tuple; for this case, equivalencies are ignored. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the units are not directly convertible. See :ref:`unit_equivalencies`. This list is in addition to possible global defaults set by, e.g., `set_enabled_equivalencies`. Use `None` to turn off all equivalencies. Returns ------- bool """ if isinstance(other, tuple): return any(self.is_equivalent(u, equivalencies=None) for u in other) else: other = Unit(other, parse_strict='silent') equivalencies = self._normalize_equivalencies(equivalencies) return self._is_equivalent(other, equivalencies) def _is_equivalent(self, other, equivalencies=[]): """Returns True if this unit is equivalent to `other`. See `is_equivalent`, except that a proper Unit object should be given (i.e., no string) and that the equivalency list should be normalized using `_normalize_equivalencies`. """ if isinstance(other, UnrecognizedUnit): return False if (self._get_physical_type_id() == other._get_physical_type_id()): return True elif len(equivalencies): unit = self.decompose() other = other.decompose() for a, b, forward, backward in equivalencies: if b is None: # after canceling, is what's left convertable # to dimensionless (according to the equivalency)? try: (unit/other).decompose([a]) return True except: pass else: if(unit._is_equivalent(a) and other._is_equivalent(b) or unit._is_equivalent(b) and other._is_equivalent(a)): return True return False def _apply_equivalences(self, unit, other, equivalencies): """ Internal function (used from `get_converter`) to apply equivalence pairs. """ def make_converter(scale1, func, scale2): def convert(v): return func(_condition_arg(v) * scale1) * scale2 return convert orig_unit = unit orig_other = other unit = self.decompose() other = other.decompose() for funit, tunit, a, b in equivalencies: if tunit is None: try: ratio_in_funit = (unit/other).decompose([funit]) return make_converter(ratio_in_funit.scale, a, 1.) except: pass else: if unit._is_equivalent(funit) and other._is_equivalent(tunit): scale1 = (unit / funit)._dimensionless_constant() scale2 = (tunit / other)._dimensionless_constant() return make_converter(scale1, a, scale2) elif (other._is_equivalent(funit) and unit._is_equivalent(tunit)): scale1 = (unit / tunit)._dimensionless_constant() scale2 = (funit / other)._dimensionless_constant() return make_converter(scale1, b, scale2) def get_err_str(unit): unit_str = unit.to_string('unscaled') physical_type = unit.physical_type if physical_type != 'unknown': unit_str = "'{0}' ({1})".format( unit_str, physical_type) else: unit_str = "'{0}'".format(unit_str) return unit_str unit_str = get_err_str(orig_unit) other_str = get_err_str(orig_other) raise UnitsError( "{0} and {1} are not convertible".format( unit_str, other_str)) def get_converter(self, other, equivalencies=[]): """ Return the conversion function to convert values from `self` to the specified unit. Parameters ---------- other : unit object or string The unit to convert to. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the units are not directly convertible. See :ref:`unit_equivalencies`. This list is in addition to possible global defaults set by, e.g., `set_enabled_equivalencies`. Use `None` to turn off all equivalencies. Returns ------- func : callable A callable that normally expects a single argument that is a scalar value or an array of values (or anything that may be converted to an array). Raises ------ UnitsError If units are inconsistent """ if self is other: return lambda val: copy.copy(val) other = Unit(other) equivalencies = self._normalize_equivalencies(equivalencies) try: scale = (self / other)._dimensionless_constant() except UnitsError: return self._apply_equivalences( self, other, equivalencies) return lambda val: scale * _condition_arg(val) def to(self, other, value=1.0, equivalencies=[]): """ Return the converted values in the specified unit. Parameters ---------- other : unit object or string The unit to convert to. value : scalar int or float, or sequence convertable to array, optional Value(s) in the current unit to be converted to the specified unit. If not provided, defaults to 1.0 equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the units are not directly convertible. See :ref:`unit_equivalencies`. This list is in addition to possible global defaults set by, e.g., `set_enabled_equivalencies`. Use `None` to turn off all equivalencies. Returns ------- values : scalar or array Converted value(s). Input value sequences are returned as numpy arrays. Raises ------ UnitsError If units are inconsistent """ if self is other: # Return a copy of value -- this works with scalars and # arrays return copy.copy(value) other = Unit(other) return self.get_converter(other, equivalencies=equivalencies)(value) def in_units(self, other, value=1.0, equivalencies=[]): """ Alias for `to` for backward compatibility with pynbody. """ return self.to( other, value=value, equivalencies=equivalencies) def decompose(self, bases=set()): """ Return a unit object composed of only irreducible units. Parameters ---------- bases : sequence of UnitBase, optional The bases to decompose into. When not provided, decomposes down to any irreducible units. When provided, the decomposed result will only contain the given units. This will raises a `UnitsError` if it's not possible to do so. Returns ------- unit : CompositeUnit object New object containing only irreducible unit objects. """ raise NotImplementedError() def _compose(self, equivalencies=[], namespace=[], max_depth=2, depth=0, cached_results=None): def make_key(unit): parts = ([str(unit._scale)] + [x.name for x in unit._bases] + [str(x) for x in unit._powers]) return tuple(parts) def is_final_result(unit): # Returns True if this result contains only the expected # units for base in unit.bases: if base not in namespace: return False return True unit = self.decompose() key = make_key(unit) cached = cached_results.get(key) if cached is not None: if isinstance(cached, Exception): raise cached return cached # Prevent too many levels of recursion # And special case for dimensionless unit if depth >= max_depth: cached_results[key] = [unit] return [unit] # Make a list including all of the equivalent units units = [unit] for funit, tunit, a, b in equivalencies: if tunit is not None: if self._is_equivalent(funit): units.append(tunit.decompose()) elif self._is_equivalent(tunit): units.append(funit.decompose()) # Store partial results partial_results = [] # Store final results that reduce to a single unit or pair of # units if len(unit._bases) == 0: final_results = [set([unit]), set()] else: final_results = [set(), set()] for tunit in namespace: tunit_decomposed = tunit.decompose() for u in units: # If the unit is a base unit, look for an exact match # to one of the bases of the target unit. If found, # factor by the same power as the target unit's base. # This allows us to factor out fractional powers # without needing to do an exhaustive search. if len(tunit_decomposed.bases) == 1: for base, power in zip(u._bases, u._powers): if tunit_decomposed._is_equivalent(base): tunit = tunit ** power tunit_decomposed = tunit_decomposed ** power break composed = (u / tunit_decomposed).decompose() factored = composed * tunit len_bases = len(composed._bases) if is_final_result(factored) and len_bases <= 1: final_results[len_bases].add(factored) else: partial_results.append( (len_bases, composed, tunit)) # Do we have any minimal results? for final_result in final_results: if len(final_result): cached_results[key] = final_result return final_result partial_results.sort(key=lambda x: x[0]) # ...we have to recurse and try to further compose results = [] for len_bases, composed, tunit in partial_results: try: composed_list = composed._compose( equivalencies=equivalencies, namespace=namespace, max_depth=max_depth, depth=depth + 1, cached_results=cached_results) except UnitsError: composed_list = [] for subcomposed in composed_list: results.append( (len(subcomposed.bases), subcomposed, tunit)) if len(results): results.sort(key=lambda x: x[0]) min_length = results[0][0] subresults = set() for len_bases, composed, tunit in results: if len_bases > min_length: break else: factored = composed * tunit if is_final_result(factored): subresults.add(factored) if len(subresults): cached_results[key] = subresults return subresults for base in self.bases: if base not in namespace: result = UnitsError( "Cannot represent unit {0} in terms of the given " "units".format(self)) cached_results[key] = result raise result cached_results[key] = [self] return [self] def compose(self, equivalencies=[], units=None, max_depth=2, include_prefix_units=False): """ Return the simplest possible composite unit(s) that represent the given unit. Since there may be multiple equally simple compositions of the unit, a list of units is always returned. Parameters ---------- equivalencies : list of equivalence pairs, optional A list of equivalence pairs to also list. See :ref:`unit_equivalencies`. This list is in addition to possible global defaults set by, e.g., `set_enabled_equivalencies`. Use `None` to turn off all equivalencies. units : set of units to compose to, optional If not provided, any known units may be used to compose into. Otherwise, ``units`` is a dict, module or sequence containing the units to compose into. max_depth : int, optional The maximum recursion depth to use when composing into composite units. include_prefix_units : bool, optional When `True`, include prefixed units in the result. Default is `False`. Returns ------- units : list of `CompositeUnit` A list of candidate compositions. These will all be equally simple, but it may not be possible to automatically determine which of the candidates are better. """ # Pre-normalize the equivalencies list equivalencies = self._normalize_equivalencies(equivalencies) def filter_units(units): filtered_namespace = set() for tunit in units: if (isinstance(tunit, UnitBase) and (include_prefix_units or not isinstance(tunit, PrefixUnit))): filtered_namespace.add(tunit) return filtered_namespace if units is None: units = filter_units(self._get_units_with_same_physical_type( equivalencies=equivalencies)) if len(units) == 0: units = get_current_unit_registry().non_prefix_units elif isinstance(units, dict): units = set(filter_units(six.itervalues(units))) elif inspect.ismodule(units): units = filter_units(six.itervalues(vars(units))) else: units = filter_units(_flatten_units_collection(units)) if not len(units): raise UnitsError("No units to compose into.") def sort_results(results): if not len(results): return [] # Sort the results so the simplest ones appear first. # Simplest is defined as "the minimum sum of absolute # powers" (i.e. the fewest bases), and preference should # be given to results where the sum of powers is positive # and the scale is exactly equal to 1.0 results = list(results) results.sort(key=lambda x: np.abs(x.scale)) results.sort(key=lambda x: np.sum(np.abs(x.powers))) results.sort(key=lambda x: np.sum(x.powers) < 0.0) results.sort(key=lambda x: not np.allclose(x.scale, 1.0)) last_result = results[0] filtered = [last_result] for result in results[1:]: if str(result) != str(last_result): filtered.append(result) last_result = result return filtered return sort_results(self._compose( equivalencies=equivalencies, namespace=units, max_depth=max_depth, depth=0, cached_results={})) def to_system(self, system): """ Converts this unit into ones belonging to the given system. Since more than one result may be possible, a list is always returned. Parameters ---------- system : module The module that defines the unit system. Commonly used ones include `astropy.units.si` and `astropy.units.cgs`. To use your own module it must contain unit objects and a sequence member named `bases` containing the base units of the system. Returns ------- units : list of `CompositeUnit` The list is ranked so that units containing only the base units of that system will appear first. """ bases = set(system.bases) def score(compose): # In case that compose._bases has no elements we return # 'np.inf' as 'score value'. It does not really matter which # number we would return. This case occurs for instance for # dimensionless quantities: compose_bases = compose.bases if len(compose_bases) == 0: return np.inf else: sum = 0 for base in compose_bases: if base in bases: sum += 1 return sum / float(len(compose_bases)) x = self.decompose(bases=bases) composed = x.compose(units=system) composed = sorted(composed, key=score, reverse=True) return composed @property def si(self): """ Returns a copy of the current `Unit` instance in SI units. """ from . import si return self.to_system(si)[0] @property def cgs(self): """ Returns a copy of the current `Unit` instance with CGS units. """ from . import cgs return self.to_system(cgs)[0] @property def physical_type(self): """ Return the physical type on the unit. Examples -------- >>> from astropy import units as u >>> print(u.m.physical_type) length """ from . import physical return physical.get_physical_type(self) def _get_units_with_same_physical_type(self, equivalencies=[]): """ Return a list of registered units with the same physical type as this unit. This function is used by Quantity to add its built-in conversions to equivalent units. This is a private method, since end users should be encouraged to use the more powerful `compose` and `find_equivalent_units` methods (which use this under the hood). Parameters ---------- equivalencies : list of equivalence pairs, optional A list of equivalence pairs to also pull options from. See :ref:`unit_equivalencies`. It must already be normalized using `_normalize_equivalencies`. """ unit_registry = get_current_unit_registry() units = set(unit_registry.get_units_with_physical_type(self)) for funit, tunit, a, b in equivalencies: if tunit is not None: if funit not in units: units.update( unit_registry.get_units_with_physical_type(funit)) if tunit not in units: units.update( unit_registry.get_units_with_physical_type(tunit)) return units class EquivalentUnitsList(list): """ A class to handle pretty-printing the result of `find_equivalent_units`. """ def __repr__(self): if len(self) == 0: return "[]" else: lines = [] for u in self: irred = u.decompose().to_string() if irred == u.name: irred = "irreducible" lines.append((u.name, irred, ', '.join(u.aliases))) lines.sort() lines.insert(0, ('Primary name', 'Unit definition', 'Aliases')) widths = [0, 0, 0] for line in lines: for i, col in enumerate(line): widths[i] = max(widths[i], len(col)) f = " {{0:<{0}s}} | {{1:<{1}s}} | {{2:<{2}s}}".format(*widths) lines = [f.format(*line) for line in lines] lines = (lines[0:1] + ['['] + ['{0} ,'.format(x) for x in lines[1:]] + [']']) return '\n'.join(lines) def find_equivalent_units(self, equivalencies=[], units=None, include_prefix_units=False): """ Return a list of all the units that are the same type as the specified unit. Parameters ---------- u : Unit instance or string The `Unit` to find similar units to. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to also list. See :ref:`unit_equivalencies`. Any list given, including an empty one, supercedes global defaults that may be in effect (as set by `set_enabled_equivalencies`) units : set of units to search in, optional If not provided, all defined units will be searched for equivalencies. Otherwise, may be a dict, module or sequence containing the units to search for equivalencies. include_prefix_units : bool, optional When `True`, include prefixed units in the result. Default is `False`. Returns ------- units : list of `UnitBase` A list of unit objects that match `u`. A subclass of `list` (`EquivalentUnitsList`) is returned that pretty-prints the list of units when output. """ results = self.compose( equivalencies=equivalencies, units=units, max_depth=1, include_prefix_units=include_prefix_units) results = [ x.bases[0] for x in results if len(x.bases) == 1] return self.EquivalentUnitsList(results) def is_unity(self): """ Returns `True` if the unit is unscaled and dimensionless. """ return False class NamedUnit(UnitBase): """ The base class of units that have a name. Parameters ---------- st : str, list of str, 2-tuple The name of the unit. If a list of strings, the first element is the canonical (short) name, and the rest of the elements are aliases. If a tuple of lists, the first element is a list of short names, and the second element is a list of long names; all but the first short name are considered "aliases". Each name *should* be a valid Python identifier to make it easy to access, but this is not required. namespace : dict, optional When provided, inject the unit, and all of its aliases, in the given namespace dictionary. If a unit by the same name is already in the namespace, a ValueError is raised. doc : str, optional A docstring describing the unit. format : dict, optional A mapping to format-specific representations of this unit. For example, for the ``Ohm`` unit, it might be nice to have it displayed as ``\\Omega`` by the ``latex`` formatter. In that case, `format` argument should be set to:: {'latex': r'\\Omega'} Raises ------ ValueError If any of the given unit names are already in the registry. ValueError If any of the given unit names are not valid Python tokens. """ def __init__(self, st, register=None, doc=None, format=None, namespace=None): if register is not None: warnings.warn( "The registry kwarg was removed in astropy 0.3. " "Use the namespace kwarg to inject the unit into " "a namespace and add_enabled_units() to enable it " "in the global unit registry.", DeprecationWarning) UnitBase.__init__(self) if isinstance(st, (bytes, six.text_type)): self._names = [st] self._short_names = [st] self._long_names = [] elif isinstance(st, tuple): if not len(st) == 2: raise ValueError("st must be string, list or 2-tuple") self._names = st[0] + st[1] if not len(self._names): raise ValueError("must provide at least one name") self._short_names = st[0][:] self._long_names = st[1][:] else: if len(st) == 0: raise ValueError( "st list must have at least one entry") self._names = st[:] self._short_names = [st[0]] self._long_names = st[1:] if format is None: format = {} self._format = format if doc is None: doc = self._generate_doc() doc = textwrap.dedent(doc) doc = textwrap.fill(doc) self.__doc__ = doc self._inject(namespace) def _generate_doc(self): """ Generate a docstring for the unit if the user didn't supply one. This is only used from the constructor and may be overridden in subclasses. """ names = self.names if len(self.names) > 1: return "{1} ({0})".format(*names[:2]) else: return names[0] def get_format_name(self, format): """ Get a name for this unit that is specific to a particular format. Uses the dictionary passed into the `format` kwarg in the constructor. Parameters ---------- format : str The name of the format Returns ------- name : str The name of the unit for the given format. """ return self._format.get(format, self.name) @property def names(self): """ Returns all of the names associated with this unit. """ return self._names @property def name(self): """ Returns the canonical (short) name associated with this unit. """ return self._names[0] @property def aliases(self): """ Returns the alias (long) names for this unit. """ return self._names[1:] @property def short_names(self): """ Returns all of the short names associated with this unit. """ return self._short_names @property def long_names(self): """ Returns all of the long names associated with this unit. """ return self._long_names def register(self, add_to_namespace=False): raise NotImplementedError( "The register method has been removed in astropy 0.3. " "Use add_enabled_units/set_enabled_units instead.") def deregister(self, remove_from_namespace=False): raise NotImplementedError( "The deregister method has been removed in astropy 0.3. " "Use add_enabled_units/set_enabled_units instead.") def _inject(self, namespace=None): """ Injects the unit, and all of its aliases, in the given namespace dictionary. """ if namespace is None: return # Loop through all of the names first, to ensure all of them # are new, then add them all as a single "transaction" below. for name in self._names: if name in namespace and self != namespace[name]: raise ValueError( "Object with name {0!r} already exists in " "given namespace ({1!r}).".format( name, namespace[name])) for name in self._names: namespace[name] = self def _recreate_irreducible_unit(names, registered): """ This is used to reconstruct units when passed around by multiprocessing. """ registry = get_current_unit_registry().registry if names[0] in registry: return registry[names[0]] else: unit = IrreducibleUnit(names) if registered: get_current_unit_registry().add_enabled_units([unit]) class IrreducibleUnit(NamedUnit): """ Irreducible units are the units that all other units are defined in terms of. Examples are meters, seconds, kilograms, amperes, etc. There is only once instance of such a unit per type. """ def __reduce__(self): # When IrreducibleUnit objects are passed to other processes # over multiprocessing, they need to be recreated to be the # ones already in the subprocesses' namespace, not new # objects, or they will be considered "unconvertible". # Therefore, we have a custom pickler/unpickler that # understands how to recreate the Unit on the other side. registry = get_current_unit_registry().registry return (_recreate_irreducible_unit, (list(self.names), self.name in registry), self.__dict__) def decompose(self, bases=set()): if len(bases) and not self in bases: for base in bases: # to avoid roundrip, ensure no default equivalencies get used if self.is_equivalent(base, equivalencies=[]): return CompositeUnit(self.to(base), [base], [1]) raise UnitsError( "Unit {0} can not be decomposed into the requested " "bases".format(self)) return CompositeUnit(1, [self], [1]) decompose.__doc__ = UnitBase.decompose.__doc__ class UnrecognizedUnit(IrreducibleUnit): """ A unit that did not parse correctly. This allows for roundtripping it as a string, but no unit operations actually work on it. Parameters ---------- st : str The name of the unit. """ def __init__(self, st): IrreducibleUnit.__init__(self, st) def __repr__(self): return "UnrecognizedUnit({0})".format(str(self)) def __bytes__(self): return self.name.encode('ascii', 'replace') if sys.version_info[0] < 3: __str__ = __bytes__ def __unicode__(self): return self.name if sys.version_info[0] >= 3: __str__ = __unicode__ def to_string(self, format='generic'): return self.name def _unrecognized_operator(self, *args, **kwargs): raise ValueError( "The unit {0!r} is unrecognized, so all arithmetic operations " "with it are invalid.".format(self.name)) __pow__ = __div__ = __rdiv__ = __truediv__ = __rtruediv__ = __mul__ = \ __rmul__ = __lt__ = __gt__ = __le__ = __ge__ = __neg__ = \ _unrecognized_operator def __eq__(self, other): other = Unit(other, parse_strict='silent') return isinstance(other, UnrecognizedUnit) and self.name == other.name def __ne__(self, other): return not (self == other) def is_equivalent(self, other, equivalencies=None): self._normalize_equivalencies(equivalencies) return self == other def get_converter(self, other, equivalencies=None): self._normalize_equivalencies(equivalencies) raise ValueError( "The unit {0!r} is unrecognized. It can not be converted " "to other units.".format(self.name)) def get_format_name(self, format): return self.name def is_unity(self): return False class _UnitMetaClass(type): """ This metaclass exists because the Unit constructor should sometimes return instances that already exist. This "overrides" the constructor before the new instance is actually created, so we can return an existing one. """ def __call__(self, s, represents=None, format=None, namespace=None, doc=None, parse_strict='raise'): from .quantity import Quantity if isinstance(represents, Quantity): if represents.value == 1: represents = represents.unit elif isinstance(represents.unit, CompositeUnit): represents = CompositeUnit(represents.value, bases=represents.unit.bases, powers=represents.unit.powers) else: represents = CompositeUnit(represents.value, bases=[represents.unit], powers=[1]) if isinstance(s, Quantity): if s.value == 1: s = s.unit elif isinstance(s.unit, CompositeUnit): s = CompositeUnit(s.value * s.unit.scale, bases=s.unit.bases, powers=s.unit.powers) else: s = CompositeUnit(s.value, bases=[s.unit], powers=[1]) if isinstance(represents, UnitBase): # This has the effect of calling the real __new__ and # __init__ on the Unit class. return super(_UnitMetaClass, self).__call__( s, represents, format=format, namespace=namespace, doc=doc) elif isinstance(s, UnitBase): return s elif isinstance(s, (bytes, six.text_type)): if len(s.strip()) == 0: # Return the NULL unit return CompositeUnit(1.0, [], []) if format is None: format = 'generic' f = unit_format.get_format(format) if sys.version_info[0] >= 3 and isinstance(s, bytes): s = s.decode('ascii') try: return f.parse(s) except Exception as e: if parse_strict == 'silent': pass else: msg = ("'{0}' did not parse as unit format '{1}': {2}" .format(s, format, str(e))) if parse_strict == 'raise': raise ValueError(msg) elif parse_strict == 'warn': warnings.warn(msg, UnitsWarning) else: raise ValueError("'parse_strict' must be 'warn', " "'raise' or 'silent'") return UnrecognizedUnit(s) elif isinstance(s, (int, float, np.floating, np.integer)): return CompositeUnit(s, [], []) elif s is None: raise TypeError("None is not a valid Unit") else: raise TypeError("{0} can not be converted to a Unit".format(s)) @six.add_metaclass(_UnitMetaClass) class Unit(NamedUnit): """ The main unit class. There are a number of different ways to construct a Unit, but always returns a `UnitBase` instance. If the arguments refer to an already-existing unit, that existing unit instance is returned, rather than a new one. - From a string:: Unit(s, format=None, parse_strict='silent') Construct from a string representing a (possibly compound) unit. The optional `format` keyword argument specifies the format the string is in, by default ``"generic"``. For a description of the available formats, see `astropy.units.format`. The optional `parse_strict` keyword controls what happens when an unrecognized unit string is passed in. It may be one of the following: - ``'raise'``: (default) raise a ValueError exception. - ``'warn'``: emit a Warning, and return an `UnrecognizedUnit` instance. - ``'silent'``: return an `UnrecognizedUnit` instance. - From a number:: Unit(number) Creates a dimensionless unit. - From a `UnitBase` instance:: Unit(unit) Returns the given unit unchanged. - From `None`:: Unit() Returns the null unit. - The last form, which creates a new `Unit` is described in detail below. Parameters ---------- st : str or list of str The name of the unit. If a list, the first element is the canonical (short) name, and the rest of the elements are aliases. represents : UnitBase instance The unit that this named unit represents. doc : str, optional A docstring describing the unit. format : dict, optional A mapping to format-specific representations of this unit. For example, for the ``Ohm`` unit, it might be nice to have it displayed as ``\\Omega`` by the ``latex`` formatter. In that case, `format` argument should be set to:: {'latex': r'\\Omega'} namespace : dictionary, optional When provided, inject the unit (and all of its aliases) into the given namespace. Raises ------ ValueError If any of the given unit names are already in the registry. ValueError If any of the given unit names are not valid Python tokens. """ def __init__(self, st, represents=None, register=None, doc=None, format=None, namespace=None): if register is not None: warnings.warn( "The registry kwarg was removed in astropy 0.3. " "Use the namespace kwarg to inject the unit into " "a namespace and add_enabled_units() to enable it " "in the global unit registry.", DeprecationWarning) represents = Unit(represents) self._represents = represents NamedUnit.__init__(self, st, namespace=namespace, doc=doc, format=format) def decompose(self, bases=set()): return self._represents.decompose(bases=bases) decompose.__doc__ = UnitBase.decompose.__doc__ def is_unity(self): return self._represents.is_unity() is_unity.__doc__ = UnitBase.is_unity.__doc__ class PrefixUnit(Unit): """ A unit that is simply a SI-prefixed version of another unit. For example, `mm` is a `PrefixUnit` of ``.001 * m``. The constructor is the same as for `Unit`. """ pass class CompositeUnit(UnitBase): """ Create a composite unit using expressions of previously defined units. Direct use of this class is not recommended. Instead use the factory function `Unit(...)` and arithmetic operators to compose units. Parameters ---------- scale : number A scaling factor for the unit. bases : sequence of `UnitBase` A sequence of units this unit is composed of. powers : sequence of numbers A sequence of powers (in parallel with `bases`) for each of the base units. """ def __init__(self, scale, bases, powers, decompose=False, decompose_bases=set()): if scale == 1. or is_effectively_unity(scale): scale = 1 self._scale = scale for base in bases: if not isinstance(base, UnitBase): raise TypeError("bases must be sequence of UnitBase instances") self._bases = bases powers = [self._validate_power(p) for p in powers] self._powers = powers self._decomposed_cache = None self._expand_and_gather(decompose=decompose, bases=decompose_bases) def __repr__(self): if len(self._bases): return super(CompositeUnit, self).__repr__() else: if self._scale != 1.0: return 'Unit(dimensionless with a scale of {0})'.format( self._scale) else: return 'Unit(dimensionless)' def __hash__(self): parts = ([str(self._scale)] + [x.name for x in self._bases] + [str(x) for x in self._powers]) return hash(tuple(parts)) @property def scale(self): """ Return the scale of the composite unit. """ return self._scale @property def bases(self): """ Return the bases of the composite unit. """ return self._bases @property def powers(self): """ Return the powers of the composite unit. """ return self._powers def _expand_and_gather(self, decompose=False, bases=set()): def add_unit(unit, power, scale): if unit not in bases: for base in bases: if unit._is_equivalent(base): scale *= unit.to(base) ** power unit = base break if unit in new_parts: new_parts[unit] += power else: new_parts[unit] = power return scale new_parts = {} scale = self.scale for b, p in zip(self.bases, self.powers): if decompose and b not in bases: b = b.decompose(bases=bases) if isinstance(b, CompositeUnit): scale *= b._scale ** p for b_sub, p_sub in zip(b._bases, b._powers): scale = add_unit(b_sub, p_sub * p, scale) else: scale = add_unit(b, p, scale) new_parts = [x for x in six.iteritems(new_parts) if x[1] != 0] new_parts.sort(key=lambda x: (-x[1], getattr(x[0], 'name', ''))) self._bases = [x[0] for x in new_parts] self._powers = [x[1] for x in new_parts] if is_effectively_unity(scale): scale = 1 self._scale = scale def __copy__(self): """ For compatibility with python copy module. """ return CompositeUnit(self._scale, self._bases[:], self._powers[:]) def decompose(self, bases=set()): if len(bases) == 0 and self._decomposed_cache is not None: return self._decomposed_cache for base in self.bases: if (not isinstance(base, IrreducibleUnit) or (len(bases) and base not in bases)): break else: if len(bases) == 0: self._decomposed_cache = self return self x = CompositeUnit(self.scale, self.bases, self.powers, decompose=True, decompose_bases=bases) if len(bases) == 0: self._decomposed_cache = x return x decompose.__doc__ = UnitBase.decompose.__doc__ def _dimensionless_constant(self): """ If this unit is dimensionless, return its scalar quantity. Direct use of this method is not recommended. It is generally better to use the `to` or `get_converter` methods instead. """ x = self.decompose() c = x.scale if len(x.bases): raise UnitsError( "'{0}' is not dimensionless".format(self.to_string())) return c def is_unity(self): unit = self.decompose() return len(unit.bases) == 0 and unit.scale == 1 si_prefixes = [ (['Y'], ['yotta'], 1e24), (['Z'], ['zetta'], 1e21), (['E'], ['exa'], 1e18), (['P'], ['peta'], 1e15), (['T'], ['tera'], 1e12), (['G'], ['giga'], 1e9), (['M'], ['mega'], 1e6), (['k'], ['kilo'], 1e3), (['h'], ['hecto'], 1e2), (['da'], ['deka', 'deca'], 1e1), (['d'], ['deci'], 1e-1), (['c'], ['centi'], 1e-2), (['m'], ['milli'], 1e-3), (['u'], ['micro'], 1e-6), (['n'], ['nano'], 1e-9), (['p'], ['pico'], 1e-12), (['f'], ['femto'], 1e-15), (['a'], ['atto'], 1e-18), (['z'], ['zepto'], 1e-21), (['y'], ['yocto'], 1e-24) ] def _add_prefixes(u, excludes=[], namespace=None, prefixes=False): """ Set up all of the standard metric prefixes for a unit. This function should not be used directly, but instead use the `prefixes` kwarg on `def_unit`. Parameters ---------- excludes : list of str, optional Any prefixes to exclude from creation to avoid namespace collisions. namespace : dict, optional When provided, inject the unit (and all of its aliases) into the given namespace dictionary. prefixes : list, optional When provided, it is a list of prefix definitions of the form: (short_names, long_tables, factor) """ if prefixes is True: prefixes = si_prefixes elif prefixes is False: prefixes = [] for short, full, factor in prefixes: names = [] format = {} for prefix in short: if prefix in excludes: continue for alias in u.short_names: names.append(prefix + alias) # This is a hack to use Greek mu as a prefix # for some formatters. if prefix == 'u': format['latex'] = r'\mu ' + u.get_format_name('latex') format['unicode'] = 'μ' + u.get_format_name('unicode') for key, val in six.iteritems(u._format): format.setdefault(key, prefix + val) for prefix in full: if prefix in excludes: continue for alias in u.long_names: names.append(prefix + alias) if len(names): PrefixUnit(names, CompositeUnit(factor, [u], [1]), namespace=namespace, format=format) def def_unit(s, represents=None, register=None, doc=None, format=None, prefixes=False, exclude_prefixes=[], namespace=None): """ Factory function for defining new units. Parameters ---------- names : str or list of str The name of the unit. If a list, the first element is the canonical (short) name, and the rest of the elements are aliases. represents : UnitBase instance, optional The unit that this named unit represents. If not provided, a new `IrreducibleUnit` is created. doc : str, optional A docstring describing the unit. format : dict, optional A mapping to format-specific representations of this unit. For example, for the ``Ohm`` unit, it might be nice to have it displayed as ``\\Omega`` by the ``latex`` formatter. In that case, `format` argument should be set to:: {'latex': r'\\Omega'} prefixes : bool or list, optional When `True`, generate all of the SI prefixed versions of the unit as well. For example, for a given unit `m`, will generate `mm`, `cm`, `km`, etc. When a list, it is a list of prefix definitions of the form: (short_names, long_tables, factor) Default is `False`. This function always returns the base unit object, even if multiple scaled versions of the unit were created. exclude_prefixes : list of str, optional If any of the SI prefixes need to be excluded, they may be listed here. For example, `Pa` can be interpreted either as "petaannum" or "Pascal". Therefore, when defining the prefixes for `a`, `exclude_prefixes` should be set to ``["P"]``. namespace : dict, optional When provided, inject the unit (and all of its aliases and prefixes), into the given namespace dictionary. Returns ------- unit : `UnitBase` object The newly-defined unit, or a matching unit that was already defined. """ if register is not None: warnings.warn( "The registry kwarg was removed in astropy 0.3. " "Use the namespace kwarg to inject the unit into " "a namespace and add_enabled_units() to enable it " "in the global unit registry.", DeprecationWarning) if represents is not None: result = Unit(s, represents, namespace=namespace, doc=doc, format=format) else: result = IrreducibleUnit( s, namespace=namespace, doc=doc, format=format) if prefixes: _add_prefixes(result, excludes=exclude_prefixes, namespace=namespace, prefixes=prefixes) return result def _condition_arg(value): """ Validate value is acceptable for conversion purposes. Will convert into an array if not a scalar, and can be converted into an array Parameters ---------- value : int or float value, or sequence of such values Returns ------- Scalar value or numpy array Raises ------ ValueError If value is not as expected """ if isinstance(value, (float, six.integer_types, complex)): return value else: try: avalue = np.array(value) if not avalue.dtype.kind in ['i', 'f', 'c']: raise ValueError( "Must be convertable to int, float or complex array") if ma.isMaskedArray(value): return value return avalue except ValueError: raise ValueError( "Value not scalar compatible or convertable into a int, " "float, or complex array") dimensionless_unscaled = CompositeUnit(1, [], []) astropy-0.3/astropy/units/tests/0000755000175000017500000000000012243263747015214 5ustar oleoleastropy-0.3/astropy/units/tests/test_quantity_array_methods.py0000644000175000017500000003176412243255342023427 0ustar oleole# The purpose of these tests are to ensure that calling quantities using # array methods returns quantities with the right units, or raises exceptions. import numpy as np from numpy.testing.utils import assert_allclose from ... import units as u from ...tests.helper import pytest NUMPY_LT_1P7 = [int(x) for x in np.__version__.split('.')[:2]] < [1, 7] class TestQuantityArrayCopy(object): """ Test whether arrays are properly copied/used in place """ def test_copy_on_creation(self): v = np.arange(1000.) q_nocopy = u.Quantity(v, "km/s", copy=False) q_copy = u.Quantity(v, "km/s", copy=True) v[0] = -1. assert q_nocopy[0].value == v[0] assert q_copy[0].value != v[0] def test_to_copies(self): q = u.Quantity(np.arange(1.,100.), "km/s") q2 = q.to(u.m/u.s) assert np.all(q.value != q2.value) q3 = q.to(u.km/u.s) assert np.all(q.value == q3.value) q[0] = -1.*u.km/u.s assert q[0].value != q3[0].value def test_si_copies(self): q = u.Quantity(np.arange(100.), "m/s") q2 = q.si assert np.all(q.value == q2.value) q[0] = -1.*u.m/u.s assert q[0].value != q2[0].value def test_getitem_is_view(self): """Check that [keys] work, and that, like ndarray, it returns a view, so that changing one changes the other. Also test that one can add axes (closes #1422) """ q = u.Quantity(np.arange(100.), "m/s") q_sel = q[10:20] q_sel[0] = -1.*u.m/u.s assert q_sel[0] == q[10] # also check that getitem can do new axes q2 = q[:, np.newaxis] q2[10,0] = -9*u.m/u.s assert np.all(q2.flatten() == q) class TestQuantityStatsFuncs(object): """ Test statistical functions """ def test_mean(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m assert np.mean(q1) == 3.6 * u.m def test_mean_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m qi = 1.5 * u.s np.mean(q1, out=qi) assert qi == 3.6 * u.m def test_std(self): q1 = np.array([1., 2.]) * u.m assert np.std(q1) == 0.5 * u.m def test_std_inplace(self): # can't use decorator since test causes a segfault in Numpy < 1.7, and # py.test will run the test anyway to see if it works pytest.xfail() q1 = np.array([1., 2.]) * u.m qi = 1.5 * u.s np.std(q1, out=qi) assert qi == 0.5 * u.m def test_var(self): q1 = np.array([1., 2.]) * u.m assert np.var(q1) == 0.25 * u.m ** 2 def test_var_inplace(self): # can't use decorator since test causes a segfault in Numpy < 1.7, and # py.test will run the test anyway to see if it works if NUMPY_LT_1P7: pytest.xfail() q1 = np.array([1., 2.]) * u.m qi = 1.5 * u.s np.var(q1, out=qi) assert qi == 0.25 * u.m ** 2 def test_median(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m assert np.median(q1) == 4. * u.m def test_median_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m qi = 1.5 * u.s np.median(q1, out=qi) assert qi == 4 * u.m def test_min(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m assert np.min(q1) == 1. * u.m def test_min_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m qi = 1.5 * u.s np.min(q1, out=qi) assert qi == 1. * u.m def test_argmin(self): q1 = np.array([6., 2., 4., 5., 6.]) * u.m assert np.argmin(q1) == 1 def test_max(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m assert np.max(q1) == 6. * u.m def test_max_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m qi = 1.5 * u.s np.max(q1, out=qi) assert qi == 6. * u.m def test_argmax(self): q1 = np.array([5., 2., 4., 5., 6.]) * u.m assert np.argmax(q1) == 4 def test_clip(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.km / u.m c1 = q1.clip(1500, 5.5 * u.Mm / u.km) assert np.all(c1 == np.array([1.5, 2., 4., 5., 5.5]) * u.km / u.m) def test_clip_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.km / u.m c1 = q1.clip(1500, 5.5 * u.Mm / u.km, out=q1) assert np.all(q1 == np.array([1.5, 2., 4., 5., 5.5]) * u.km / u.m) c1[0] = 10 * u.Mm/u.mm assert np.all(c1.value == q1.value) def test_conj(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.km / u.m assert np.all(q1.conj() == q1) def test_ptp(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m assert np.ptp(q1) == 5. * u.m @pytest.mark.xfail def test_ptp_inplace(self): q1 = np.array([1., 2., 4., 5., 6.]) * u.m qi = 1.5 * u.s np.ptp(q1, out=qi) assert qi == 5. * u.m def test_round(self): q1 = np.array([1.2, 2.2, 3.2]) * u.kg assert np.all(np.round(q1) == np.array([1, 2, 3]) * u.kg) def test_sum(self): q1 = np.array([1., 2., 6.]) * u.m assert np.all(q1.sum() == 9. * u.m) assert np.all(np.sum(q1) == 9. * u.m) q2 = np.array([[4., 5., 9.], [1., 1., 1.]]) * u.s assert np.all(q2.sum(0) == np.array([5., 6., 10.]) * u.s) assert np.all(np.sum(q2, 0) == np.array([5., 6., 10.]) * u.s) def test_sum_inplace(self): q1 = np.array([1., 2., 6.]) * u.m qi = 1.5 * u.s np.sum(q1, out=qi) assert qi == 9. * u.m def test_cumsum(self): q1 = np.array([1, 2, 6]) * u.m assert np.all(q1.cumsum() == np.array([1, 3, 9]) * u.m) assert np.all(np.cumsum(q1) == np.array([1, 3, 9]) * u.m) q2 = np.array([4, 5, 9]) * u.s assert np.all(q2.cumsum() == np.array([4, 9, 18]) * u.s) assert np.all(np.cumsum(q2) == np.array([4, 9, 18]) * u.s) def test_cumsum_inplace(self): q1 = np.array([1, 2, 6]) * u.m qi = np.ones(3) * u.s np.cumsum(q1, out=qi) assert np.all(qi == np.array([1, 3, 9]) * u.m) q2 = q1 q1.cumsum(out=q1) assert np.all(q2 == qi) def test_nansum(self): q1 = np.array([1., 2., np.nan]) * u.m assert np.all(q1.nansum() == 3. * u.m) assert np.all(np.nansum(q1) == 3. * u.m) q2 = np.array([[np.nan, 5., 9.], [1., np.nan, 1.]]) * u.s assert np.all(q2.nansum(0) == np.array([1., 5., 10.]) * u.s) assert np.all(np.nansum(q2, 0) == np.array([1., 5., 10.]) * u.s) def test_prod(self): q1 = np.array([1, 2, 6]) * u.m with pytest.raises(ValueError) as exc: q1.prod() assert 'cannot use prod' in exc.value.args[0] with pytest.raises(ValueError) as exc: np.prod(q1) assert 'cannot use prod' in exc.value.args[0] q2 = np.array([3., 4., 5.]) * u.Unit(1) assert q2.prod() == 60. * u.Unit(1) assert np.prod(q2) == 60. * u.Unit(1) def test_cumprod(self): q1 = np.array([1, 2, 6]) * u.m with pytest.raises(ValueError) as exc: q1.cumprod() assert 'cannot use cumprod' in exc.value.args[0] with pytest.raises(ValueError) as exc: np.cumprod(q1) assert 'cannot use cumprod' in exc.value.args[0] q2 = np.array([3, 4, 5]) * u.Unit(1) assert np.all(q2.cumprod() == np.array([3, 12, 60]) * u.Unit(1)) assert np.all(np.cumprod(q2) == np.array([3, 12, 60]) * u.Unit(1)) def test_diff(self): q1 = np.array([1., 2., 4., 10.]) * u.m assert np.all(q1.diff() == np.array([1., 2., 6.]) * u.m) assert np.all(np.diff(q1) == np.array([1., 2., 6.]) * u.m) def test_ediff1d(self): q1 = np.array([1., 2., 4., 10.]) * u.m assert np.all(q1.ediff1d() == np.array([1., 2., 6.]) * u.m) assert np.all(np.ediff1d(q1) == np.array([1., 2., 6.]) * u.m) @pytest.mark.xfail def test_dot_func(self): q1 = np.array([1., 2., 4., 10.]) * u.m q2 = np.array([3., 4., 5., 6.]) * u.s q3 = np.dot(q1, q2) assert q3.value == np.dot(q1.value, q2.value) assert q3.unit == u.m * u.s def test_dot_meth(self): q1 = np.array([1., 2., 4., 10.]) * u.m q2 = np.array([3., 4., 5., 6.]) * u.s q3 = q1.dot(q2) assert q3.value == np.dot(q1.value, q2.value) assert q3.unit == u.m * u.s @pytest.mark.xfail def test_trace_func(self): q = np.array([[1.,2.],[3.,4.]]) * u.m assert np.trace(q) == 5. * u.m def test_trace_meth(self): q1 = np.array([[1.,2.],[3.,4.]]) * u.m assert q1.trace() == 5. * u.m cont = u.Quantity(4., u.s) q2 = np.array([[3.,4.],[5.,6.]]) * u.m q2.trace(out=cont) assert cont == 9. * u.m def test_clip_func(self): q = np.arange(10) * u.m assert np.all(np.clip(q, 3 * u.m, 6 * u.m) == np.array([3., 3.,3.,3.,4.,5.,6.,6.,6.,6.]) * u.m) def test_clip_meth(self): expected = np.array([3.,3.,3.,3.,4.,5.,6.,6.,6.,6.]) * u.m q1 = np.arange(10) * u.m q3 = q1.clip(3 * u.m, 6 * u.m) assert np.all(q1.clip(3 * u.m, 6 * u.m) == expected) cont = np.zeros(10) * u.s q1.clip(3 * u.m, 6 * u.m, out=cont) assert np.all(cont == expected) class TestArrayConversion(object): """ Test array conversion methods """ def test_item(self): q1 = np.array([1, 2, 3]) * u.m / u.km assert q1.item(1) == 2 * q1.unit q1.itemset(1, 1) assert q1.item(1) == 1000 * u.m / u.km q1.itemset(1, 100 * u.cm / u.km) assert q1.item(1) == 1 * u.m / u.km with pytest.raises(TypeError): q1.itemset(1, 1.5 * u.m / u.km) with pytest.raises(ValueError): q1.itemset() q1[1] = 1 assert q1[1] == 1000 * u.m / u.km q1[1] = 100 * u.cm / u.km assert q1[1] == 1 * u.m / u.km with pytest.raises(TypeError): q1[1] = 1.5 * u.m / u.km q1 = np.array([1, 2, 3]) * u.m / u.km assert all(q1.take((0, 2)) == np.array([1, 3]) * u.m / u.km) q1.put((1, 2), (3, 4)) assert np.all(q1.take((1, 2)) == np.array([3000, 4000]) * q1.unit) q1.put(0, 500 * u.cm / u.km) assert q1.item(0) == 5 * u.m / u.km def test_slice(self): q2 = np.array([[1, 2, 3], [4, 5, 6]]) * u.km / u.m q1 = q2.copy() q2[0, 0] = 10000 assert q2.unit == q1.unit assert q2[0, 0].value == 10 q2[0] = 9 * u.Mm / u.km assert all(q2.flatten()[:3].value == np.array([9, 9, 9])) q2[0, :-1] = 8000 assert all(q2.flatten()[:3].value == np.array([8, 8, 9])) with pytest.raises(u.UnitsError): q2[1, 1] = 10 * u.s with pytest.raises(TypeError): q2[0, 1] = 1.5 * u.km / u.m def test_fill(self): q1 = np.array([1, 2, 3]) * u.m / u.km q1.fill(2) assert np.all(q1 == 2000 * u.m / u.km) def test_repeat_compress_diagonal(self): q1 = np.array([1, 2, 3]) * u.m / u.km q2 = q1.repeat(2) assert q2.unit == q1.unit assert all(q2.value == q1.value.repeat(2)) q2.sort() assert q2.unit == q1.unit q2 = q1.compress(np.array([True, True, False, False])) assert q2.unit == q1.unit assert all(q2.value == q1.value.compress(np.array([True, True, False, False]))) q1 = np.array([[1, 2], [3, 4]]) * u.m / u.km q2 = q1.diagonal() assert q2.unit == q1.unit assert all(q2.value == q1.value.diagonal()) def test_byte_type_view_field_changes(self): q1 = np.array([1, 2, 3], dtype=np.int64) * u.m / u.km q2 = q1.byteswap() assert q2.unit == q1.unit assert all(q2.value == q1.value.byteswap()) q2 = q1.astype(np.float64) assert all(q2 == q1) assert q2.dtype == np.float64 q2 = q1.view(np.ndarray) assert not hasattr(q2, 'unit') q2a = q1.getfield(np.int32, offset=0) q2b = q1.byteswap().getfield(np.int32, offset=4) assert q2a.unit == q1.unit assert all(q2b.byteswap() == q2a) def test_sort(self): q1 = np.array([1., 5., 2., 4.]) * u.km / u.m i = q1.argsort() assert not hasattr(i, 'unit') q1.sort() i = q1.searchsorted([1500, 2500]) assert not hasattr(i, 'unit') assert all(i == q1.to( u.dimensionless_unscaled).value.searchsorted([1500, 2500])) def test_not_implemented(self): q1 = np.array([1, 2, 3]) * u.m / u.km with pytest.raises(NotImplementedError): q1.choose([0, 0, 1]) with pytest.raises(NotImplementedError): q1.list() with pytest.raises(NotImplementedError): q1.tostring() with pytest.raises(NotImplementedError): q1.tofile(0) with pytest.raises(NotImplementedError): q1.dump('a.a') with pytest.raises(NotImplementedError): q1.dumps() astropy-0.3/astropy/units/tests/test_quantity_non_ufuncs.py0000644000175000017500000000120212243255342022723 0ustar oleoleimport numpy as np from numpy.testing.utils import assert_allclose from ... import units as u from ...tests.helper import pytest class TestQuantityLinAlgFuncs(object): """ Test linear algebra functions """ @pytest.mark.xfail def test_outer(self): q1 = np.array([1, 2, 3]) * u.m q2 = np.array([1, 2]) / u.s o = np.outer(q1, q2) assert np.all(o == np.array([[1, 2], [2, 4], [3, 6]]) * u.m / u.s) @pytest.mark.xfail def test_inner(self): q1 = np.array([1, 2, 3]) * u.m q2 = np.array([4, 5, 6]) / u.s o = np.inner(q1, q2) assert o == 32 * u.m / u.s astropy-0.3/astropy/units/tests/test_format.py0000644000175000017500000002067212243255342020114 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Regression tests for the units.format package """ from __future__ import (absolute_import, unicode_literals, division, print_function) from numpy.testing.utils import assert_allclose from ...tests.helper import raises, pytest from ... import units as u from .. import core from .. import format as u_format from ..utils import is_effectively_unity from ... import wcs def test_unit_grammar(): def _test_unit_grammar(s, unit): print(s) unit2 = u_format.Generic().parse(s) assert unit2 == unit data = [ (["m s", "m*s", "m.s"], u.m * u.s), (["m/s", "m*s**-1", "m /s", "m / s", "m/ s"], u.m / u.s), (["m**2", "m2", "m**(2)", "m**+2", "m+2", "m^(+2)"], u.m ** 2), (["m**-3", "m-3", "m^(-3)", "/m3"], u.m ** -3), (["m**(1.5)", "m(3/2)", "m**(3/2)", "m^(3/2)"], u.m ** 1.5), (["2.54 cm"], u.Unit(u.cm * 2.54)), (["10+8m"], u.Unit(u.m * 1e8)), # This is the VOUnits documentation, but doesn't seem to follow the # unity grammar (["3.45 10**(-4)Jy"], 3.45 * 1e-4 * u.Jy) (["sqrt(m)"], u.m ** 0.5) ] for strings, unit in data: for s in strings: yield _test_unit_grammar, s, unit def test_cds_grammar(): def _test_cds_grammar(s, unit): print(s) unit2 = u_format.CDS().parse(s) assert unit2 == unit data = [ (["0.1nm"], u.AA), (["mW/m2"], u.Unit(u.erg / u.cm ** 2 / u.s)), (["mW/(m2)"], u.Unit(u.erg / u.cm ** 2 / u.s)), (["km/s", "km.s-1"], u.km / u.s), (["10pix/nm"], u.Unit(10 * u.pix / u.nm)), (["1.5x10+11m"], u.Unit(1.5e11 * u.m)), (["1.5×10+11m"], u.Unit(1.5e11 * u.m)), (["m2"], u.m ** 2), (["10+21m"], u.Unit(u.m * 1e21)), (["2.54cm"], u.Unit(u.cm * 2.54)), (["20%"], 0.20 * u.dimensionless_unscaled), (["10+9"], 1.e9 * u.dimensionless_unscaled), (["2x10-9"], 2.e-9 * u.dimensionless_unscaled), (["---"], u.dimensionless_unscaled), (["ma"], u.ma), (["mAU"], u.mAU), (["uarcmin"], u.uarcmin), (["uarcsec"], u.uarcsec), (["kbarn"], u.kbarn), (["Gbit"], u.Gbit), (["Gibit"], 2 ** 30 * u.bit), (["kbyte"], u.kbyte), (["mRy"], 0.001 * u.Ry), (["mmag"], u.mmag), (["Mpc"], u.Mpc), (["Gyr"], u.Gyr), (["°"], u.degree)] for strings, unit in data: for s in strings: yield _test_cds_grammar, s, unit def test_cds_grammar_fail(): @raises(ValueError) def _test_cds_grammar_fail(s): print(s) u_format.CDS().parse(s) data = ['0.1 nm', 'solMass(3/2)', 'km / s', 'km s-1', 'pix0.1nm', 'pix/(0.1nm)', 'km*s', 'km**2', '5x8+3m', '0.1---', '---m', 'm---'] for s in data: yield _test_cds_grammar_fail, s def test_roundtrip(): def _test_roundtrip(unit): a = core.Unit(unit.to_string('generic'), format='generic') b = core.Unit(unit.decompose().to_string('generic'), format='generic') assert_allclose(a.decompose().scale, unit.decompose().scale, rtol=1e-2) assert_allclose(b.decompose().scale, unit.decompose().scale, rtol=1e-2) for key, val in u.__dict__.items(): if isinstance(val, core.Unit) and not isinstance(val, core.PrefixUnit): yield _test_roundtrip, val def test_roundtrip_vo_unit(): def _test_roundtrip_vo_unit(unit): a = core.Unit(unit.to_string('vounit'), format='vounit') b = core.Unit(unit.decompose().to_string('vounit'), format='vounit') assert_allclose(a.decompose().scale, unit.decompose().scale, rtol=1e-2) assert_allclose(b.decompose().scale, unit.decompose().scale, rtol=1e-2) x = u_format.VOUnit() for key, val in x._units.items(): if isinstance(val, core.Unit) and not isinstance(val, core.PrefixUnit): yield _test_roundtrip_vo_unit, val def test_roundtrip_fits(): def _test_roundtrip_fits(unit): s = unit.to_string('fits') a = core.Unit(s, format='fits') assert_allclose(a.decompose().scale, unit.decompose().scale, rtol=1e-2) for key, val in u_format.Fits()._units.items(): if isinstance(val, core.Unit) and not isinstance(val, core.PrefixUnit): yield _test_roundtrip_fits, val def test_roundtrip_cds(): def _test_roundtrip_cds(unit): a = core.Unit(unit.to_string('cds'), format='cds') b = core.Unit(unit.decompose().to_string('cds'), format='cds') assert_allclose(a.decompose().scale, unit.decompose().scale, rtol=1e-2) assert_allclose(b.decompose().scale, unit.decompose().scale, rtol=1e-2) x = u_format.CDS() for key, val in x._units.items(): if isinstance(val, core.Unit) and not isinstance(val, core.PrefixUnit): yield _test_roundtrip_cds, val def test_fits_units_available(): u_format.Fits() def test_vo_units_available(): u_format.VOUnit() def test_cds_units_available(): u_format.CDS() def test_latex(): fluxunit = u.erg / (u.cm ** 2 * u.s) assert fluxunit.to_string('latex') == r'$\mathrm{\frac{erg}{s\,cm^{2}}}$' def test_new_style_latex(): fluxunit = u.erg / (u.cm ** 2 * u.s) assert "{0:latex}".format(fluxunit) == r'$\mathrm{\frac{erg}{s\,cm^{2}}}$' def test_format_styles(): fluxunit = u.erg / (u.cm ** 2 * u.s) def _test_format_styles(format_spec, s): assert format(fluxunit, format_spec) == s format_s_pairs = [ ('generic','erg / (cm2 s)'), ('s', 'erg / (cm2 s)'), ('console', ' erg \n ------\n s cm^2'), ('latex', '$\\mathrm{\\frac{erg}{s\\,cm^{2}}}$'), ('>20s',' erg / (cm2 s)'), ] for format_, s in format_s_pairs: yield _test_format_styles, format_, s def test_wcs_parse(): """ Tests that the output of to_string('fits') is also parsed by wcslib. Even if we deprecated access to wcslib's unit parser, we may want to keep it around and hidden for this test. """ def _test_wcs_parse(unit): try: fits_string = unit.decompose().to_string('fits') except ValueError: return wcs.UnitConverter(fits_string, fits_string) for key, val in u.__dict__.items(): if isinstance(val, core.Unit) and not isinstance(val, core.PrefixUnit): yield _test_wcs_parse, val def test_flatten_to_known(): myunit = u.def_unit("FOOBAR_One", u.erg / u.Hz) assert myunit.to_string('fits') == 'erg Hz-1' myunit2 = myunit * u.bit ** 3 assert myunit2.to_string('fits') == 'bit3 erg Hz-1' @raises(ValueError) def test_flatten_impossible(): myunit = u.def_unit("FOOBAR_Two") with u.add_enabled_units(myunit): myunit.to_string('fits') def test_console_out(): """ Issue #436. """ u.Jy.decompose().to_string('console') def test_flexible_float(): assert u.min._represents.to_string('latex') == r'$\mathrm{60\,s}$' def test_fraction_repr(): area = u.cm ** 2.0 assert '.' not in area.to_string('latex') fractional = u.cm ** 2.5 assert '5/2' in fractional.to_string('latex') assert fractional.to_string('unicode') == 'cmâµâ¸Â²' def test_scale_effectively_unity(): """Scale just off unity at machine precision level is OK. Ensures #748 does not recur """ a = (3. * u.N).cgs assert is_effectively_unity(a.unit.scale) assert len(a.__repr__().split()) == 3 def test_percent(): """Test that the % unit is properly recognized. Since % is a special symbol, this goes slightly beyond the roundtripping tested above.""" assert u.Unit('%') == u.percent == u.Unit(0.01) assert u.Unit('%', format='cds') == u.Unit(0.01) assert u.Unit(0.01).to_string('cds') == '%' with pytest.raises(ValueError): u.Unit('%', format='fits') with pytest.raises(ValueError): u.Unit('%', format='vounit') def test_scaled_dimensionless(): """Test that scaled dimensionless units are properly recognized in generic and CDS, but not in fits and vounit.""" assert u.Unit('0.1') == u.Unit(0.1) == 0.1 * u.dimensionless_unscaled assert u.Unit('1.e-4') == u.Unit(1.e-4) assert u.Unit('10-4', format='cds') == u.Unit(1.e-4) assert u.Unit('10+8').to_string('cds') == '10+8' with pytest.raises(ValueError): u.Unit(0.1).to_string('fits') with pytest.raises(ValueError): u.Unit(0.1).to_string('vounit') astropy-0.3/astropy/units/tests/__init__.py0000644000175000017500000000000012243255342017303 0ustar oleoleastropy-0.3/astropy/units/tests/test_equivalencies.py0000644000175000017500000004174412243255342021464 0ustar oleole# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Separate tests specifically for equivalencies """ from __future__ import (absolute_import, unicode_literals, division, print_function) import numpy as np from numpy.testing.utils import assert_allclose from ...tests.helper import pytest from ...extern.six.moves import zip from ... import units as u def test_dimensionless_angles(): # test that the angles_dimensionless option allows one to change # by any order in radian in the unit (#1161) rad1 = u.dimensionless_angles() assert u.radian.to(1, equivalencies=rad1) == 1. assert u.deg.to(1, equivalencies=rad1) == u.deg.to(u.rad) assert u.steradian.to(1, equivalencies=rad1) == 1. assert u.dimensionless_unscaled.to(u.steradian, equivalencies=rad1) == 1. # now quantities assert (1.*u.radian).to(1, equivalencies=rad1).value == 1. assert (1.*u.deg).to(1, equivalencies=rad1).value == u.deg.to(u.rad) assert (1.*u.steradian).to(1, equivalencies=rad1).value == 1. # more complicated example I = 1.e45 * u.g * u.cm**2 Omega = u.cycle / (1.*u.s) Erot = 0.5 * I * Omega**2 assert Erot.to(u.erg, equivalencies=rad1) == (Erot/u.radian**2) # test build-in equivalency in subclass class MyRad1(u.Quantity): _equivalencies = rad1 phase = MyRad1(1., u.cycle) assert phase.to(1).value == u.cycle.to(u.radian) functions = [u.doppler_optical, u.doppler_radio, u.doppler_relativistic] @pytest.mark.parametrize(('function'), functions) def test_doppler_frequency_0(function): rest = 105.01 * u.GHz velo0 = rest.to(u.km/u.s, equivalencies=function(rest)) assert velo0.value == 0 @pytest.mark.parametrize(('function'), functions) def test_doppler_wavelength_0(function): rest = 105.01 * u.GHz q1 = 0.00285489437196 * u.m velo0 = q1.to(u.km/u.s, equivalencies=function(rest)) np.testing.assert_almost_equal(velo0.value, 0, decimal=6) @pytest.mark.parametrize(('function'), functions) def test_doppler_energy_0(function): rest = 105.01 * u.GHz q1 = 0.000434286445543 * u.eV velo0 = q1.to(u.km/u.s, equivalencies=function(rest)) np.testing.assert_almost_equal(velo0.value, 0, decimal=6) @pytest.mark.parametrize(('function'), functions) def test_doppler_frequency_circle(function): rest = 105.01 * u.GHz shifted = 105.03 * u.GHz velo = shifted.to(u.km/u.s, equivalencies=function(rest)) freq = velo.to(u.GHz, equivalencies=function(rest)) np.testing.assert_almost_equal(freq.value, shifted.value, decimal=7) @pytest.mark.parametrize(('function'), functions) def test_doppler_wavelength_circle(function): rest = 105.01 * u.nm shifted = 105.03 * u.nm velo = shifted.to(u.km / u.s, equivalencies=function(rest)) wav = velo.to(u.nm, equivalencies=function(rest)) np.testing.assert_almost_equal(wav.value, shifted.value, decimal=7) @pytest.mark.parametrize(('function'), functions) def test_doppler_energy_circle(function): rest = 1.0501 * u.eV shifted = 1.0503 * u.eV velo = shifted.to(u.km / u.s, equivalencies=function(rest)) en = velo.to(u.eV, equivalencies=function(rest)) np.testing.assert_almost_equal(en.value, shifted.value, decimal=7) values_ghz = (999.899940784289,999.8999307714406,999.8999357778647) @pytest.mark.parametrize(('function', 'value'), list(zip(functions, values_ghz))) def test_30kms(function, value): rest = 1000 * u.GHz velo = 30 * u.km/u.s shifted = velo.to(u.GHz, equivalencies=function(rest)) np.testing.assert_almost_equal(shifted.value, value, decimal=7) def test_massenergy(): # The relative tolerance of these tests is set by the uncertainties # in the charge of the electron, which is known to about # 3e-9 (relative tolerance). Therefore, we limit the # precision of the tests to 1e-7 to be safe. The masses are # (loosely) known to ~ 5e-8 rel tolerance, so we couldn't test to # 1e-7 if we used the values from astropy.constants; that is, # they might change by more than 1e-7 in some future update, so instead # they are hardwired here. # Electron, proton, neutron, muon, 1g mass_eV = u.Quantity([510.998928e3, 938.272046e6, 939.565378e6, 105.6583715e6, 5.60958884539e32], u.eV) mass_g = u.Quantity([9.10938291e-28, 1.672621777e-24, 1.674927351e-24, 1.88353147e-25, 1], u.g) # Test both ways assert np.allclose(mass_eV.to(u.g, equivalencies=u.mass_energy()).value, mass_g.value, rtol=1e-7) assert np.allclose(mass_g.to(u.eV, equivalencies=u.mass_energy()).value, mass_eV.value, rtol=1e-7) # Basic tests of 'derived' equivalencies # Surface density sdens_eV = u.Quantity(5.60958884539e32, u.eV / u.m**2) sdens_g = u.Quantity(1e-4, u.g / u.cm**2) assert np.allclose(sdens_eV.to(u.g / u.cm**2, equivalencies=u.mass_energy()).value, sdens_g.value, rtol=1e-7) assert np.allclose(sdens_g.to(u.eV / u.m**2, equivalencies=u.mass_energy()).value, sdens_eV.value, rtol=1e-7) # Density dens_eV = u.Quantity(5.60958884539e32, u.eV / u.m**3) dens_g = u.Quantity(1e-6, u.g / u.cm**3) assert np.allclose(dens_eV.to(u.g / u.cm**3, equivalencies=u.mass_energy()).value, dens_g.value, rtol=1e-7) assert np.allclose(dens_g.to(u.eV / u.m**3, equivalencies=u.mass_energy()).value, dens_eV.value, rtol=1e-7) # Power pow_eV = u.Quantity(5.60958884539e32, u.eV / u.s) pow_g = u.Quantity(1, u.g / u.s) assert np.allclose(pow_eV.to(u.g / u.s, equivalencies=u.mass_energy()).value, pow_g.value, rtol=1e-7) assert np.allclose(pow_g.to(u.eV / u.s, equivalencies=u.mass_energy()).value, pow_eV.value, rtol=1e-7) def test_is_equivalent(): assert u.m.is_equivalent(u.pc) assert u.cycle.is_equivalent(u.mas) assert not u.cycle.is_equivalent(u.dimensionless_unscaled) assert u.cycle.is_equivalent(u.dimensionless_unscaled, u.dimensionless_angles()) assert not (u.Hz.is_equivalent(u.J)) assert u.Hz.is_equivalent(u.J, u.spectral()) assert u.J.is_equivalent(u.Hz, u.spectral()) assert u.pc.is_equivalent(u.arcsecond, u.parallax()) assert u.arcminute.is_equivalent(u.au, u.parallax()) # Pass a tuple for multiple possibilities assert u.cm.is_equivalent((u.m, u.s, u.kg)) assert u.ms.is_equivalent((u.m, u.s, u.kg)) assert u.g.is_equivalent((u.m, u.s, u.kg)) assert not u.L.is_equivalent((u.m, u.s, u.kg)) assert not (u.km / u.s).is_equivalent((u.m, u.s, u.kg)) def test_parallax(): a = u.arcsecond.to(u.pc, 10, u.parallax()) assert_allclose(a, 0.10) b = u.pc.to(u.arcsecond, a, u.parallax()) assert_allclose(b, 10) a = u.arcminute.to(u.au, 1, u.parallax()) assert_allclose(a, 3437.7467916) b = u.au.to(u.arcminute, a, u.parallax()) assert_allclose(b, 1) def test_parallax2(): a = u.arcsecond.to(u.pc, [0.1, 2.5], u.parallax()) assert_allclose(a, [10, 0.4]) def test_spectral(): a = u.AA.to(u.Hz, 1, u.spectral()) assert_allclose(a, 2.9979245799999995e+18) b = u.Hz.to(u.AA, a, u.spectral()) assert_allclose(b, 1) a = u.AA.to(u.MHz, 1, u.spectral()) assert_allclose(a, 2.9979245799999995e+12) b = u.MHz.to(u.AA, a, u.spectral()) assert_allclose(b, 1) a = u.m.to(u.Hz, 1, u.spectral()) assert_allclose(a, 2.9979245799999995e+8) b = u.Hz.to(u.m, a, u.spectral()) assert_allclose(b, 1) def test_spectral2(): a = u.nm.to(u.J, 500, u.spectral()) assert_allclose(a, 3.972891366538605e-19) b = u.J.to(u.nm, a, u.spectral()) assert_allclose(b, 500) a = u.AA.to(u.Hz, 1, u.spectral()) b = u.Hz.to(u.J, a, u.spectral()) c = u.AA.to(u.J, 1, u.spectral()) assert_allclose(b, c) c = u.J.to(u.Hz, b, u.spectral()) assert_allclose(a, c) def test_spectral3(): a = u.nm.to(u.Hz, [1000, 2000], u.spectral()) assert_allclose(a, [2.99792458e+14, 1.49896229e+14]) @pytest.mark.parametrize( ('in_val', 'in_unit'), [([0.1, 5000.0, 10000.0], u.AA), ([2.99792458e+19, 5.99584916e+14, 2.99792458e+14], u.Hz), ([1.98644568e-14, 3.97289137e-19, 1.98644568e-19], u.J)]) def test_spectral4(in_val, in_unit): """Wave number conversion w.r.t. wavelength, freq, and energy.""" # Forward a = in_unit.to(u.micron ** -1, in_val, u.spectral()) assert_allclose(a, [1e+5, 2.0, 1.0]) # Backward b = (u.micron ** -1).to(in_unit, [1e+5, 2.0, 1.0], u.spectral()) assert_allclose(b, in_val) def test_spectraldensity(): a = u.AA.to(u.Jy, 1, u.spectral_density(u.eV, 2.2)) assert_allclose(a, 1059416252057.8357, rtol=1e-4) b = u.Jy.to(u.AA, a, u.spectral_density(u.eV, 2.2)) assert_allclose(b, 1) c = u.AA.to(u.Jy, 1, u.spectral_density(2.2 * u.eV)) assert_allclose(c, 1059416252057.8357, rtol=1e-4) d = u.Jy.to(u.AA, c, u.spectral_density(2.2 * u.eV)) assert_allclose(d, 1) def test_spectraldensity2(): flambda = u.erg / u.angstrom / u.cm ** 2 / u.s fnu = u.erg / u.Hz / u.cm ** 2 / u.s a = flambda.to(fnu, 1, u.spectral_density(u.Quantity(3500, u.AA))) assert_allclose(a, 4.086160166177361e-12) def test_spectraldensity3(): # Define F_nu in Jy f_nu = u.Jy # Define F_lambda in ergs / cm^2 / s / micron f_lambda = u.erg / u.cm ** 2 / u.s / u.micron # 1 GHz one_ghz = u.Quantity(1, u.GHz) # Convert to ergs / cm^2 / s / Hz assert_allclose(f_nu.to(u.erg / u.cm ** 2 / u.s / u.Hz, 1.), 1.e-23, 10) # Convert to ergs / cm^2 / s at 10 Ghz assert_allclose(f_nu.to(u.erg / u.cm ** 2 / u.s, 1., equivalencies=u.spectral_density(one_ghz * 10)), 1.e-13, 10) # Convert to F_lambda at 1 Ghz assert_allclose(f_nu.to(f_lambda, 1., equivalencies=u.spectral_density(one_ghz)), 3.335640951981521e-20, 10) # Convert to Jy at 1 Ghz assert_allclose(f_lambda.to(u.Jy, 1., equivalencies=u.spectral_density(one_ghz)), 1. / 3.335640951981521e-20, 10) # Convert to ergs / cm^2 / s at 10 microns assert_allclose(f_lambda.to(u.erg / u.cm ** 2 / u.s, 1., equivalencies=u.spectral_density(u.Quantity(10, u.micron))), 10., 10) def test_spectraldensity4(): """PHOTLAM and PHOTNU conversions.""" flam = u.erg / (u.cm ** 2 * u.s * u.AA) fnu = u.erg / (u.cm ** 2 * u.s * u.Hz) photlam = u.photon / (u.cm ** 2 * u.s * u.AA) photnu = u.photon / (u.cm ** 2 * u.s * u.Hz) wave = u.Quantity([4956.8, 4959.55, 4962.3], u.AA) flux_photlam = [9.7654e-3, 1.003896e-2, 9.78473e-3] flux_photnu = [8.00335589e-14, 8.23668949e-14, 8.03700310e-14] flux_flam = [3.9135e-14, 4.0209e-14, 3.9169e-14] flux_fnu = [3.20735792e-25, 3.29903646e-25, 3.21727226e-25] flux_jy = [3.20735792e-2, 3.29903646e-2, 3.21727226e-2] # PHOTLAM <--> FLAM assert_allclose(photlam.to( flam, flux_photlam, u.spectral_density(wave)), flux_flam, rtol=1e-6) assert_allclose(flam.to( photlam, flux_flam, u.spectral_density(wave)), flux_photlam, rtol=1e-6) # PHOTLAM <--> FNU assert_allclose(photlam.to( fnu, flux_photlam, u.spectral_density(wave)), flux_fnu, rtol=1e-6) assert_allclose(fnu.to( photlam, flux_fnu, u.spectral_density(wave)), flux_photlam, rtol=1e-6) # PHOTLAM <--> Jy assert_allclose(photlam.to( u.Jy, flux_photlam, u.spectral_density(wave)), flux_jy, rtol=1e-6) assert_allclose(u.Jy.to( photlam, flux_jy, u.spectral_density(wave)), flux_photlam, rtol=1e-6) # PHOTLAM <--> PHOTNU assert_allclose(photlam.to( photnu, flux_photlam, u.spectral_density(wave)), flux_photnu, rtol=1e-6) assert_allclose(photnu.to( photlam, flux_photnu, u.spectral_density(wave)), flux_photlam, rtol=1e-6) # PHOTNU <--> FNU assert_allclose(photnu.to( fnu, flux_photnu, u.spectral_density(wave)), flux_fnu, rtol=1e-6) assert_allclose(fnu.to( photnu, flux_fnu, u.spectral_density(wave)), flux_photnu, rtol=1e-6) # PHOTNU <--> FLAM assert_allclose(photnu.to( flam, flux_photnu, u.spectral_density(wave)), flux_flam, rtol=1e-6) assert_allclose(flam.to( photnu, flux_flam, u.spectral_density(wave)), flux_photnu, rtol=1e-6) def test_equivalent_units(): units = u.g.find_equivalent_units() units_set = set(units) match = set( [u.M_e, u.M_p, u.g, u.kg, u.solMass, u.t, u.u]) assert units_set == match r = repr(units) assert r.count('\n') == len(units) + 2 def test_equivalent_units2(): units = set(u.Hz.find_equivalent_units(u.spectral())) match = set( [u.AU, u.Angstrom, u.Hz, u.J, u.Ry, u.cm, u.eV, u.erg, u.lyr, u.m, u.micron, u.pc, u.solRad, u.Bq, u.Ci, u.k]) assert units == match from .. import imperial with u.add_enabled_units(imperial): units = set(u.Hz.find_equivalent_units(u.spectral())) match = set( [u.AU, u.Angstrom, imperial.BTU, u.Hz, u.J, u.Ry, imperial.cal, u.cm, u.eV, u.erg, imperial.ft, imperial.inch, imperial.kcal, u.lyr, u.m, imperial.mi, u.micron, u.pc, u.solRad, imperial.yd, u.Bq, u.Ci, imperial.nmi, u.k]) assert units == match units = set(u.Hz.find_equivalent_units(u.spectral())) match = set( [u.AU, u.Angstrom, u.Hz, u.J, u.Ry, u.cm, u.eV, u.erg, u.lyr, u.m, u.micron, u.pc, u.solRad, u.Bq, u.Ci, u.k]) assert units == match def test_trivial_equivalency(): assert u.m.to(u.kg, equivalencies=[(u.m, u.kg)]) == 1.0 def test_invalid_equivalency(): with pytest.raises(ValueError): u.m.to(u.kg, equivalencies=[(u.m,)]) with pytest.raises(ValueError): u.m.to(u.kg, equivalencies=[(u.m, 5.0)]) def test_irrelevant_equivalency(): with pytest.raises(u.UnitsException): u.m.to(u.kg, equivalencies=[(u.m, u.l)]) def test_brightness_temperature(): omega_B = np.pi * (50 * u.arcsec) ** 2 nu = u.GHz * 5 tb = 7.05258885885 * u.K np.testing.assert_almost_equal( tb.value, (1 * u.Jy).to( u.K, equivalencies=u.brightness_temperature(omega_B, nu)).value) np.testing.assert_almost_equal( 1.0, tb.to( u.Jy, equivalencies=u.brightness_temperature(omega_B, nu)).value) def test_equivalency_context(): with u.set_enabled_equivalencies(u.dimensionless_angles()): phase = u.Quantity(1., u.cycle) assert_allclose(np.exp(1j*phase), 1.) Omega = u.cycle / (1.*u.minute) assert_allclose(np.exp(1j*Omega*60.*u.second), 1.) # ensure we can turn off equivalencies even within the scope with pytest.raises(u.UnitsError): phase.to(1, equivalencies=None) with u.set_enabled_equivalencies(u.spectral()): u.GHz.to(u.cm) eq_on = u.GHz.find_equivalent_units() with pytest.raises(u.UnitsError): u.GHz.to(u.cm, equivalencies=None) # without equivalencies, we should find a smaller (sub)set eq_off = u.GHz.find_equivalent_units() assert all(eq in set(eq_on) for eq in eq_off) assert set(eq_off) < set(eq_on) def test_equivalency_context_manager(): base_registry = u.get_current_unit_registry() def just_to_from_units(equivalencies): return [(equiv[0], equiv[1]) for equiv in equivalencies] tf_dimensionless_angles = just_to_from_units(u.dimensionless_angles()) tf_spectral = just_to_from_units(u.spectral()) assert base_registry.equivalencies == [] with u.set_enabled_equivalencies(u.dimensionless_angles()): new_registry = u.get_current_unit_registry() assert (set(just_to_from_units(new_registry.equivalencies)) == set(tf_dimensionless_angles)) assert set(new_registry.all_units) == set(base_registry.all_units) with u.set_enabled_equivalencies(u.spectral()): newer_registry = u.get_current_unit_registry() assert (set(just_to_from_units(newer_registry.equivalencies)) == set(tf_spectral)) assert (set(newer_registry.all_units) == set(base_registry.all_units)) assert (set(just_to_from_units(new_registry.equivalencies)) == set(tf_dimensionless_angles)) assert set(new_registry.all_units) == set(base_registry.all_units) with u.add_enabled_equivalencies(u.spectral()): newer_registry = u.get_current_unit_registry() assert (set(just_to_from_units(newer_registry.equivalencies)) == set(tf_dimensionless_angles) | set(tf_spectral)) assert (set(newer_registry.all_units) == set(base_registry.all_units)) assert base_registry is u.get_current_unit_registry() astropy-0.3/astropy/units/tests/test_units.py0000644000175000017500000003017112243255342017761 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Regression tests for the units package """ from __future__ import (absolute_import, unicode_literals, division, print_function) import numpy as np from numpy.testing.utils import assert_allclose from ...extern.six.moves import cPickle as pickle from ...tests.helper import pytest, raises, catch_warnings from ...utils.compat.fractions import Fraction from ... import units as u def test_getting_started(): """ Corresponds to "Getting Started" section in the docs. """ from .. import imperial with imperial.enable(): speed_unit = u.cm / u.s x = speed_unit.to(imperial.mile / u.hour, 1) assert_allclose(x, 0.02236936292054402) speed_converter = speed_unit.get_converter("mile hour^-1") x = speed_converter([1., 1000., 5000.]) assert_allclose(x, [2.23693629e-02, 2.23693629e+01, 1.11846815e+02]) def test_invalid_power(): x = u.m ** (1, 3) assert isinstance(x.powers[0], Fraction) x = u.m ** (1, 2) assert isinstance(x.powers[0], float) def test_invalid_compare(): assert not (u.m == u.s) def test_convert(): assert u.h.get_converter(u.s)(1) == 3600 def test_convert_fail(): with pytest.raises(u.UnitsError): u.cm.to(u.s, 1) with pytest.raises(u.UnitsError): (u.cm / u.s).to(u.m, 1) def test_composite(): assert (u.cm / u.s * u.h).get_converter(u.m)(1) == 36 assert u.cm * u.cm == u.cm ** 2 assert u.cm * u.cm * u.cm == u.cm ** 3 assert u.Hz.to(1000 * u.Hz, 1) == 0.001 def test_str(): assert str(u.cm) == "cm" def test_repr(): assert repr(u.cm) == 'Unit("cm")' def test_units_conversion(): assert_allclose(u.kpc.to(u.Mpc), 0.001) assert_allclose(u.Mpc.to(u.kpc), 1000) assert_allclose(u.yr.to(u.Myr), 1.e-6) assert_allclose(u.AU.to(u.pc), 4.84813681e-6) assert_allclose(u.cycle.to(u.rad), 6.283185307179586) def test_units_manipulation(): # Just do some manipulation and check it's happy (u.kpc * u.yr) ** (1, 3) / u.Myr (u.AA * u.erg) ** 9 def test_decompose(): assert u.Ry == u.Ry.decompose() def test_dimensionless_to_si(): """ Issue #1150: Test for conversion of dimensionless quantities to the SI system """ testunit = ((1.0 * u.kpc) / (1.0 * u.Mpc)) assert testunit.unit.physical_type == 'dimensionless' assert_allclose(testunit.si, 0.001) def test_dimensionless_to_cgs(): """ Issue #1150: Test for conversion of dimensionless quantities to the CGS system """ testunit = ((1.0 * u.m) / (1.0 * u.km)) assert testunit.unit.physical_type == 'dimensionless' assert_allclose(testunit.cgs, 0.001) def test_unknown_unit(): with catch_warnings(u.UnitsWarning) as warning_lines: u.Unit("FOO", parse_strict='warn') assert 'FOO' in str(warning_lines[0].message) def test_unknown_unit2(): with catch_warnings(u.UnitsWarning) as warning_lines: assert u.Unit("m/s/kg", parse_strict='warn').to_string() == 'm/s/kg' assert 'm/s/kg' in str(warning_lines[0].message) def test_unknown_unit3(): unit = u.Unit("FOO", parse_strict='silent') assert isinstance(unit, u.UnrecognizedUnit) assert unit.name == "FOO" unit2 = u.Unit("FOO", parse_strict='silent') assert unit == unit2 assert unit.is_equivalent(unit2) unit3 = u.Unit("BAR", parse_strict='silent') assert unit != unit3 assert not unit.is_equivalent(unit3) with pytest.raises(ValueError): unit.get_converter(unit3) x = unit.to_string('latex') y = unit2.to_string('cgs') with pytest.raises(ValueError): unit4 = u.Unit("BAR", parse_strict='strict') with pytest.raises(TypeError): unit5 = u.Unit(None) @raises(TypeError) def test_invalid_scale(): x = ['a', 'b', 'c'] * u.m def test_cds_power(): unit = u.Unit("10+22/cm2", format="cds", parse_strict='silent') assert unit.scale == 1e22 def test_register(): foo = u.def_unit("foo", u.m ** 3, namespace=locals()) assert 'foo' in locals() with u.add_enabled_units(foo): assert 'foo' in u.get_current_unit_registry().registry assert 'foo' not in u.get_current_unit_registry().registry def test_in_units(): speed_unit = u.cm / u.s x = speed_unit.in_units(u.pc / u.hour, 1) def test_null_unit(): assert (u.m / u.m) == u.Unit(1) def test_unrecognized_equivalency(): assert u.m.is_equivalent('foo') is False assert u.m.is_equivalent('pc') is True @raises(TypeError) def test_unit_noarg(): u.Unit() def test_convertible_exception(): try: u.AA.to(u.h * u.s ** 2) except u.UnitsError as e: assert "length" in str(e) def test_convertible_exception2(): try: u.m.to(u.s) except u.UnitsError as e: assert "length" in str(e) @raises(TypeError) def test_invalid_type(): class A(object): pass u.Unit(A()) def test_steradian(): """ Issue #599 """ assert u.sr.is_equivalent(u.rad * u.rad) results = u.sr.compose(units=u.cgs.bases) assert results[0].bases[0] is u.rad results = u.sr.compose(units=u.cgs.__dict__) assert results[0].bases[0] is u.sr def test_decompose_bases(): """ From issue #576 """ from .. import cgs from ...constants import e d = e.esu.unit.decompose(bases=cgs.bases) assert d._bases == [u.cm, u.g, u.s] assert d._powers == [Fraction(3, 2), Fraction(1, 2), -1] assert d._scale == 1.0 def test_complex_compose(): complex = u.cd * u.sr * u.Wb composed = complex.compose() assert set(composed[0]._bases) == set([u.lm, u.Wb]) def test_equiv_compose(): composed = u.m.compose(equivalencies=u.spectral()) assert u.Hz in composed def test_empty_compose(): with pytest.raises(u.UnitsException): composed = u.m.compose(units=[]) def test_compose_roundtrip(): def _test_compose_roundtrip(unit): composed_list = unit.decompose().compose() found = False for composed in composed_list: if len(composed.bases): if composed.bases[0] is unit: found = True break elif len(unit.bases) == 0: found = True break assert found from ... import units as u for val in u.__dict__.values(): if (isinstance(val, u.UnitBase) and not isinstance(val, u.PrefixUnit)): yield _test_compose_roundtrip, val def test_compose_cgs_to_si(): def _test_compose_cgs_to_si(unit): si = unit.to_system(u.si) assert [x.is_equivalent(unit) for x in si] assert si[0] == unit.si for val in u.cgs.__dict__.values(): if (isinstance(val, u.UnitBase) and not isinstance(val, u.PrefixUnit)): yield _test_compose_cgs_to_si, val def test_compose_si_to_cgs(): def _test_compose_si_to_cgs(unit): # Can't convert things with Ampere to CGS without more context try: cgs = unit.to_system(u.cgs) except u.UnitsError: if u.A in unit.decompose().bases: pass else: raise else: assert [x.is_equivalent(unit) for x in cgs] assert cgs[0] == unit.cgs for val in u.si.__dict__.values(): if (isinstance(val, u.UnitBase) and not isinstance(val, u.PrefixUnit)): yield _test_compose_si_to_cgs, val def test_to_cgs(): assert u.Pa.to_system(u.cgs)[0]._bases[0] is u.Ba assert u.Pa.to_system(u.cgs)[0]._scale == 10.0 def test_decompose_to_cgs(): from .. import cgs assert u.m.decompose(bases=cgs.bases)._bases[0] is cgs.cm def test_compose_issue_579(): unit = u.kg * u.s ** 2 / u.m result = unit.compose(units=[u.N, u.s, u.m]) assert len(result) == 1 assert result[0]._bases == [u.s, u.N, u.m] assert result[0]._powers == [4, 1, -2] def test_self_compose(): unit = u.kg * u.s assert len(unit.compose(units=[u.g, u.s])) == 1 @raises(u.UnitsError) def test_compose_failed(): unit = u.kg result = unit.compose(units=[u.N]) def test_compose_fractional_powers(): x = (u.kg / u.s ** 3 * u.au ** 2.5 / u.yr ** 0.5 / u.sr ** 2) factored = x.compose() for unit in factored: assert x.decompose() == unit.decompose() factored = x.compose(units=u.cgs) for unit in factored: assert x.decompose() == unit.decompose() factored = x.compose(units=u.si) for unit in factored: assert x.decompose() == unit.decompose() def test_compose_best_unit_first(): results = u.l.compose() assert len(results[0].bases) == 1 assert results[0].bases[0] is u.l results = (u.s ** -1).compose() assert results[0].bases[0] in (u.Hz, u.Bq) results = (u.Ry.decompose()).compose() assert results[0].bases[0] is u.Ry def test_compose_no_duplicates(): new = u.kg / u.s ** 3 * u.au ** 2.5 / u.yr ** 0.5 / u.sr ** 2 composed = new.compose(units=u.cgs.bases) assert len(composed) == 1 def test_long_int(): """ Issue #672 """ sigma = 10 ** 21 * u.M_p / u.cm ** 2 sigma.to(u.M_sun / u.pc ** 2) def test_endian_independence(): """ Regression test for #744 A logic issue in the units code meant that big endian arrays could not be converted because the dtype is '>f4', not 'float32', and the code was looking for the strings 'float' or 'int'. """ for endian in ['<', '>']: for ntype in ['i', 'f']: for byte in ['4', '8']: x = np.array([1,2,3], dtype=(endian + ntype + byte)) u.m.to(u.cm, x) def test_radian_base(): """ Issue #863 """ assert (1 * u.degree).si.unit == u.rad def test_no_as(): # We don't define 'as', since it is a keyword, but we # do want to define the long form (`attosecond`). assert not hasattr(u, 'as') assert hasattr(u, 'attosecond') def test_pickling(): p = pickle.dumps(u.m) other = pickle.loads(p) assert other is u.m new_unit = u.IrreducibleUnit(['foo'], format={'baz': 'bar'}) u.add_enabled_units([new_unit]) p = pickle.dumps(new_unit) new_unit_copy = pickle.loads(p) assert new_unit_copy.names == ['foo'] assert new_unit_copy.get_format_name('baz') == 'bar' @raises(ValueError) def test_duplicate_define(): u.def_unit('m', namespace=u.__dict__) def test_all_units(): from ...units.core import get_current_unit_registry registry = get_current_unit_registry() assert len(registry.all_units) > len(registry.non_prefix_units) def test_repr_latex(): assert u.m._repr_latex_() == u.m.to_string('latex') def test_operations_with_strings(): assert u.m / '5s' == (u.m / (5.0 * u.s)) assert u.m * '5s' == (5.0 * u.m * u.s) def test_comparison(): assert u.m > u.cm assert u.m >= u.cm assert u.cm < u.m assert u.cm <= u.m with pytest.raises(u.UnitsException): u.m > u.kg def test_compose_into_arbitrary_units(): # Issue #1438 from ...constants import G G.decompose([u.kg, u.km, u.Unit("15 s")]) def test_unit_multiplication_with_string(): """Check that multiplication with strings produces the correct unit.""" u1 = u.cm us = 'kg' assert us * u1 == u.Unit(us) * u1 assert u1 * us == u1 * u.Unit(us) def test_unit_division_by_string(): """Check that multiplication with strings produces the correct unit.""" u1 = u.cm us = 'kg' assert us / u1 == u.Unit(us) / u1 assert u1 / us == u1 / u.Unit(us) def test_sorted_bases(): """See #1616.""" assert (u.m * u.Jy).bases == (u.Jy * u.m).bases def test_megabit(): """See #1543""" assert u.Mbit is u.Mb assert u.megabit is u.Mb assert u.Mbyte is u.MB assert u.megabyte is u.MB def test_composite_unit_get_format_name(): """See #1576""" unit1 = u.Unit('nrad/s') unit2 = u.Unit('Hz(1/2)') assert (str(u.CompositeUnit(1, [unit1, unit2], [1, -1])) == 'nrad / (Hz(1/2) s)') def test_unicode_policy(): from ...tests.helper import assert_follows_unicode_guidelines assert_follows_unicode_guidelines( u.degree, roundtrip=u.__dict__) astropy-0.3/astropy/units/tests/test_physical.py0000644000175000017500000000244312243255342020434 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Regression tests for the physical_type support in the units package """ from __future__ import (absolute_import, unicode_literals, division, print_function) from ... import units as u from ...units import physical from ...constants import hbar from ...tests.helper import raises def test_simple(): assert u.m.physical_type == 'length' def test_power(): assert (u.cm ** 3).physical_type == 'volume' def test_speed(): assert (u.km / u.h).physical_type == 'speed' def test_unknown(): assert (u.m * u.s).physical_type == 'unknown' def test_dimensionless(): assert (u.m / u.m).physical_type == 'dimensionless' def test_angular_momentum(): assert hbar.unit.physical_type == 'angular momentum' def test_flam(): flam = u.erg / (u.cm**2 * u.s * u.AA) assert flam.physical_type == 'spectral flux density wav' def test_photlam(): photlam = u.photon / (u.cm ** 2 * u.s * u.AA) assert photlam.physical_type == 'photon flux density wav' def test_photnu(): photnu = u.photon / (u.cm ** 2 * u.s * u.Hz) assert photnu.physical_type == 'photon flux density' @raises(ValueError) def test_redundant_physical_type(): physical.def_physical_type(u.m, 'utter craziness') astropy-0.3/astropy/units/tests/test_quantity.py0000644000175000017500000006040312243255342020476 0ustar oleole# coding: utf-8 # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test the Quantity class and related. """ from __future__ import (absolute_import, unicode_literals, division, print_function) import copy import numpy as np from numpy.testing import (assert_allclose, assert_array_equal, assert_array_almost_equal) from ...tests.helper import raises, pytest from ...utils import isiterable from ... import units as u from ...extern.six.moves import xrange from ...extern.six.moves import cPickle as pickle from ...extern import six """ The Quantity class will represent a number + unit + uncertainty """ class TestQuantityCreation(object): def test_1(self): # create objects through operations with Unit objects: quantity = 11.42 * u.meter # returns a Quantity object assert isinstance(quantity, u.Quantity) quantity = u.meter * 11.42 # returns a Quantity object assert isinstance(quantity, u.Quantity) quantity = 11.42 / u.meter assert isinstance(quantity, u.Quantity) quantity = u.meter / 11.42 assert isinstance(quantity, u.Quantity) quantity = 11.42 * u.meter / u.second assert isinstance(quantity, u.Quantity) with pytest.raises(TypeError): quantity = 182.234 + u.meter with pytest.raises(TypeError): quantity = 182.234 - u.meter with pytest.raises(TypeError): quantity = 182.234 % u.meter def test_2(self): # create objects using the Quantity constructor: q1 = u.Quantity(11.412, unit=u.meter) q2 = u.Quantity(21.52, "cm") q3 = u.Quantity(11.412) # By default quantities that don't specify a unit are unscaled # dimensionless assert q3.unit == u.Unit(1) with pytest.raises(TypeError): q4 = u.Quantity(object(), unit=u.m) def test_3(self): # with pytest.raises(u.UnitsError): with pytest.raises(ValueError): # Until @mdboom fixes the errors in units q1 = u.Quantity(11.412, unit="testingggg") def test_unit_property(self): # test getting and setting 'unit' attribute q1 = u.Quantity(11.4, unit=u.meter) with pytest.raises(AttributeError): q1.unit = u.cm def test_preserve_dtype(self): # If unit is not sepcified, preserve dtype (at least to the extent # that Numpy does when copying, i.e. int32 -> int64, not float64) q1 = u.Quantity(12, unit=u.m / u.s, dtype=int) q2 = u.Quantity(q1) assert q1.value == q2.value assert q1.unit == q2.unit assert q1.dtype == q2.dtype class TestQuantityOperations(object): q1 = u.Quantity(11.42, u.meter) q2 = u.Quantity(8.0, u.centimeter) def test_addition(self): # Take units from left object, q1 new_quantity = self.q1 + self.q2 assert new_quantity.value == 11.5 assert new_quantity.unit == u.meter # Take units from left object, q2 new_quantity = self.q2 + self.q1 assert new_quantity.value == 1150.0 assert new_quantity.unit == u.centimeter new_q = u.Quantity(1500.1, u.m) + u.Quantity(13.5, u.km) assert new_q.unit == u.m assert new_q.value == 15000.1 def test_subtraction(self): # Take units from left object, q1 new_quantity = self.q1 - self.q2 assert new_quantity.value == 11.34 assert new_quantity.unit == u.meter # Take units from left object, q2 new_quantity = self.q2 - self.q1 assert new_quantity.value == -1134.0 assert new_quantity.unit == u.centimeter def test_multiplication(self): # Take units from left object, q1 new_quantity = self.q1 * self.q2 assert new_quantity.value == 91.36 assert new_quantity.unit == (u.meter * u.centimeter) # Take units from left object, q2 new_quantity = self.q2 * self.q1 assert new_quantity.value == 91.36 assert new_quantity.unit == (u.centimeter * u.meter) # Multiply with a number new_quantity = 15. * self.q1 assert new_quantity.value == 171.3 assert new_quantity.unit == u.meter # Multiply with a number new_quantity = self.q1 * 15. assert new_quantity.value == 171.3 assert new_quantity.unit == u.meter def test_division(self): # Take units from left object, q1 new_quantity = self.q1 / self.q2 assert_array_almost_equal(new_quantity.value, 1.4275, decimal=5) assert new_quantity.unit == (u.meter / u.centimeter) # Take units from left object, q2 new_quantity = self.q2 / self.q1 assert_array_almost_equal(new_quantity.value, 0.70052539404553416, decimal=16) assert new_quantity.unit == (u.centimeter / u.meter) q1 = u.Quantity(11.4, unit=u.meter) q2 = u.Quantity(10.0, unit=u.second) new_quantity = q1 / q2 assert_array_almost_equal(new_quantity.value, 1.14, decimal=10) assert new_quantity.unit == (u.meter / u.second) # divide with a number new_quantity = self.q1 / 10. assert new_quantity.value == 1.142 assert new_quantity.unit == u.meter # divide with a number new_quantity = 11.42 / self.q1 assert new_quantity.value == 1. assert new_quantity.unit == u.Unit("1/m") def test_commutativity(self): """Regression test for issue #587.""" new_q = u.Quantity(11.42, 'm*s') assert self.q1 * u.s == u.s * self.q1 == new_q assert self.q1 / u.s == u.Quantity(11.42, 'm/s') assert u.s / self.q1 == u.Quantity(1 / 11.42, 's/m') def test_power(self): # raise quantity to a power new_quantity = self.q1 ** 2 assert_array_almost_equal(new_quantity.value, 130.4164, decimal=5) assert new_quantity.unit == u.Unit("m^2") new_quantity = self.q1 ** 3 assert_array_almost_equal(new_quantity.value, 1489.355288, decimal=7) assert new_quantity.unit == u.Unit("m^3") def test_unary(self): # Test the minus unary operator new_quantity = -self.q1 assert new_quantity.value == -self.q1.value assert new_quantity.unit == self.q1.unit new_quantity = -(-self.q1) assert new_quantity.value == self.q1.value assert new_quantity.unit == self.q1.unit # Test the plus unary operator new_quantity = +self.q1 assert new_quantity.value == self.q1.value assert new_quantity.unit == self.q1.unit def test_abs(self): q = 1. * u.m / u.s new_quantity = abs(q) assert new_quantity.value == q.value assert new_quantity.unit == q.unit q = -1. * u.m / u.s new_quantity = abs(q) assert new_quantity.value == -q.value assert new_quantity.unit == q.unit def test_incompatible_units(self): """ When trying to add or subtract units that aren't compatible, throw an error """ q1 = u.Quantity(11.412, unit=u.meter) q2 = u.Quantity(21.52, unit=u.second) with pytest.raises(u.UnitsError): new_q = q1 + q2 def test_dimensionless_operations(self): # test conversion to dimensionless dq = 3. * u.m / u.km dq1 = dq + 1. * u.mm / u.km assert dq1.value == 3.001 assert dq1.unit == dq.unit dq2 = dq + 1. assert dq2.value == 1.003 assert dq2.unit == u.dimensionless_unscaled # this test will check that operations with dimensionless Quantities # don't work with pytest.raises(u.UnitsError): self.q1 + u.Quantity(0.1, unit=u.Unit("")) with pytest.raises(u.UnitsError): self.q1 - u.Quantity(0.1, unit=u.Unit("")) # and test that scaling of integers works q = np.array([1, 2, 3]) * u.m / u.km q2 = q + np.array([4, 5, 6]) assert q2.unit == u.dimensionless_unscaled assert_allclose(q2.value, np.array([4.001, 5.002, 6.003])) # but not if doing it inplace with pytest.raises(TypeError): q += np.array([1, 2, 3]) # except if it is actually possible q = np.array([1, 2, 3]) * u.km / u.m q += np.array([4, 5, 6]) assert q.unit == u.dimensionless_unscaled assert np.all(q.value == np.array([1004, 2005, 3006])) def test_complicated_operation(self): """ Perform a more complicated test """ from .. import imperial # Multiple units distance = u.Quantity(15., u.meter) time = u.Quantity(11., u.second) velocity = (distance / time).to(imperial.mile / u.hour) assert_array_almost_equal( velocity.value, 3.05037, decimal=5) G = u.Quantity(6.673E-11, u.m ** 3 / u.kg / u.s ** 2) new_q = ((1. / (4. * np.pi * G)).to(u.pc ** -3 / u.s ** -2 * u.kg)) # Area side1 = u.Quantity(11., u.centimeter) side2 = u.Quantity(7., u.centimeter) area = side1 * side2 assert_array_almost_equal(area.value, 77., decimal=15) assert area.unit == u.cm * u.cm def test_comparison(self): # equality/ non-equality is straightforward for quantity objects assert (1 / (u.cm * u.cm)) == 1 * u.cm ** -2 assert 1 * u.m == 100 * u.cm assert 1 * u.m != 1 * u.cm # here one is a unit, which is an invalid comparison assert 1. * u.cm * u.cm * u.cm != u.cm ** 3 # mismatched types should never work assert not 1. * u.cm == 1. assert 1. * u.cm != 1. def test_numeric_converters(self): # float, int, long, and __index__ should only work for single # quantities, of appropriate type, and only if they are dimensionless. # (Check on __index__ is also a regression test for #1557) # quantities with units should never convert, or be usable as an index q1 = u.Quantity(1, u.m) converter_err_msg = ("Only dimensionless scalar quantities " "can be converted to Python scalars") index_err_msg = ("Only integer dimensionless scalar quantities " "can be converted to a Python index") with pytest.raises(TypeError) as exc: float(q1) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: int(q1) assert exc.value.args[0] == converter_err_msg if six.PY2: with pytest.raises(TypeError) as exc: long(q1) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: q1 * ['a', 'b', 'c'] assert exc.value.args[0] == index_err_msg # dimensionless but scaled is also not OK q2 = u.Quantity(1.23, u.m / u.km) with pytest.raises(TypeError) as exc: float(q2) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: int(q2) assert exc.value.args[0] == converter_err_msg if six.PY2: with pytest.raises(TypeError) as exc: long(q2) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: q2 * ['a', 'b', 'c'] assert exc.value.args[0] == index_err_msg # dimensionless unscaled is OK, though for index needs to be int q3 = u.Quantity(1.23, u.dimensionless_unscaled) assert float(q3) == 1.23 assert int(q3) == 1 if six.PY2: assert long(q3) == 1 with pytest.raises(TypeError) as exc: q1 * ['a', 'b', 'c'] assert exc.value.args[0] == index_err_msg # integer dimensionless unscaled is good for all q4 = u.Quantity(2, u.dimensionless_unscaled) assert float(q4) == 2. assert int(q4) == 2 if six.PY2: assert long(q4) == 2 assert q4 * ['a', 'b', 'c'] == ['a', 'b', 'c', 'a', 'b', 'c'] # but arrays are not OK q5 = u.Quantity([1, 2], u.m) with pytest.raises(TypeError) as exc: float(q5) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: int(q5) assert exc.value.args[0] == converter_err_msg if six.PY2: with pytest.raises(TypeError) as exc: long(q5) assert exc.value.args[0] == converter_err_msg with pytest.raises(TypeError) as exc: q5 * ['a', 'b', 'c'] assert exc.value.args[0] == index_err_msg def test_array_converters(self): # Scalar quantity q = u.Quantity(1.23, u.m) assert np.all(np.array(q) == np.array([1.23])) # Array quantity q = u.Quantity([1., 2., 3.], u.m) assert np.all(np.array(q) == np.array([1., 2., 3.])) def test_quantity_conversion(): q1 = u.Quantity(0.1, unit=u.meter) new_quantity = q1.to(u.kilometer) assert new_quantity.value == 0.0001 with pytest.raises(u.UnitsError): q1.to(u.zettastokes) def test_quantity_conversion_with_equiv(): q1 = u.Quantity(0.1, unit=u.meter) q2 = q1.to(u.Hz, equivalencies=u.spectral()) assert_allclose(q2.value, 2997924580.0) q1 = u.Quantity(0.4, unit=u.arcsecond) q2 = q1.to(u.au, equivalencies=u.parallax()) q3 = q2.to(u.arcminute, equivalencies=u.parallax()) assert_allclose(q2.value, 515662.015) assert q2.unit == u.au assert_allclose(q3.value, 0.0066666667) assert q3.unit == u.arcminute def test_quantity_conversion_equivalency_passed_on(): class MySpectral(u.Quantity): _equivalencies = u.spectral() def __quantity_instance__(self, *args, **kwargs): return MySpectral(*args, **kwargs) q1 = MySpectral([1000,2000], unit=u.Hz) q2 = q1.to(u.nm) assert q2.unit == u.nm q3 = q2.to(u.Hz) assert q3.unit == u.Hz assert_allclose(q3.value, q1.value) q4 = MySpectral([1000, 2000], unit=u.nm) q5 = q4.to(u.Hz).to(u.nm) assert q5.unit == u.nm assert_allclose(q4.value, q5.value) def test_si(): q1 = 10. * u.m * u.s ** 2 / (200. * u.ms) ** 2 # 250 meters assert q1.si.value == 250 assert q1.si.unit == u.m q = 10. * u.m # 10 meters assert q.si.value == 10 assert q.si.unit == u.m q = 10. / u.m # 10 1 / meters assert q.si.value == 10 assert q.si.unit == (1 / u.m) def test_cgs(): q1 = 10. * u.cm * u.s ** 2 / (200. * u.ms) ** 2 # 250 centimeters assert q1.cgs.value == 250 assert q1.cgs.unit == u.cm q = 10. * u.m # 10 centimeters assert q.cgs.value == 1000 assert q.cgs.unit == u.cm q = 10. / u.cm # 10 1 / centimeters assert q.cgs.value == 10 assert q.cgs.unit == (1 / u.cm) q = 10. * u.Pa # 10 pascals assert q.cgs.value == 100 assert q.cgs.unit == u.barye class TestQuantityComparison(object): def test_quantity_equality(self): assert u.Quantity(1000, unit='m') == u.Quantity(1, unit='km') assert not (u.Quantity(1, unit='m') == u.Quantity(1, unit='km')) with pytest.raises(u.UnitsError): u.Quantity(1, unit='m') == u.Quantity(1, unit='s') def test_quantity_comparison(self): assert u.Quantity(1100, unit=u.meter) > u.Quantity(1, unit=u.kilometer) assert u.Quantity(900, unit=u.meter) < u.Quantity(1, unit=u.kilometer) with pytest.raises(u.UnitsError): assert u.Quantity(1100, unit=u.meter) > u.Quantity(1, unit=u.second) with pytest.raises(u.UnitsError): assert u.Quantity(1100, unit=u.meter) < u.Quantity(1, unit=u.second) assert u.Quantity(1100, unit=u.meter) >= u.Quantity(1, unit=u.kilometer) assert u.Quantity(1000, unit=u.meter) >= u.Quantity(1, unit=u.kilometer) assert u.Quantity(900, unit=u.meter) <= u.Quantity(1, unit=u.kilometer) assert u.Quantity(1000, unit=u.meter) <= u.Quantity(1, unit=u.kilometer) with pytest.raises(u.UnitsError): assert u.Quantity( 1100, unit=u.meter) >= u.Quantity(1, unit=u.second) with pytest.raises(u.UnitsError): assert u.Quantity(1100, unit=u.meter) <= u.Quantity(1, unit=u.second) assert u.Quantity(1200, unit=u.meter) != u.Quantity(1, unit=u.kilometer) with pytest.raises(u.UnitsError): assert u.Quantity(1100, unit=u.meter) != u.Quantity(1, unit=u.second) class TestQuantityDisplay(object): scalarintq = u.Quantity(1, unit='m') scalarfloatq = u.Quantity(1.3, unit='m') arrq = u.Quantity([1, 2.3, 8.9], unit='m') def test_scalar_quantity_str(self): assert str(self.scalarintq) == "1 m" assert str(self.scalarfloatq) == "1.3 m" def test_scalar_quantity_repr(self): assert repr(self.scalarintq) == "" assert repr(self.scalarfloatq) == "" def test_array_quantity_str(self): assert str(self.arrq) == "[ 1. 2.3 8.9] m" def test_array_quantity_repr(self): assert repr(self.arrq) == "" def test_scalar_quantity_format(self): assert format(self.scalarintq, '02d') == "01 m" assert format(self.scalarfloatq, '.1f') == "1.3 m" assert format(self.scalarfloatq, '.0f') == "1 m" def test_decompose(): q1 = 5 * u.N assert q1.decompose() == (5 * u.kg * u.m * u.s ** -2) def test_decompose_regression(): """ Regression test for bug #1163 If decompose was called multiple times on a Quantity with an array and a scale != 1, the result changed every time. This is because the value was being referenced not copied, then modified, which changed the original value. """ q = np.array([1, 2, 3]) * u.m / (2. * u.km) assert np.all(q.decompose().value == np.array([0.0005, 0.001, 0.0015])) assert np.all(q == np.array([1, 2, 3]) * u.m / (2. * u.km)) assert np.all(q.decompose().value == np.array([0.0005, 0.001, 0.0015])) def test_arrays(): """ Test using quantites with array values """ qsec = u.Quantity(np.arange(10), u.second) assert isinstance(qsec.value, np.ndarray) assert not qsec.isscalar # len and indexing should work for arrays assert len(qsec) == len(qsec.value) qsecsub25 = qsec[2:5] assert qsecsub25.unit == qsec.unit assert isinstance(qsecsub25, u.Quantity) assert len(qsecsub25) == 3 # make sure isscalar, len, and indexing behave correcly for non-arrays. qsecnotarray = u.Quantity(10., u.second) assert qsecnotarray.isscalar with pytest.raises(TypeError): len(qsecnotarray) with pytest.raises(TypeError): qsecnotarray[0] qseclen0array = u.Quantity(np.array(10), u.second) # 0d numpy array should act basically like a scalar assert qseclen0array.isscalar with pytest.raises(TypeError): len(qseclen0array) with pytest.raises(TypeError): qseclen0array[0] assert isinstance(qseclen0array.value, int) # can also create from lists, will auto-convert to arrays qsec = u.Quantity(list(xrange(10)), u.second) assert isinstance(qsec.value, np.ndarray) # quantity math should work with arrays assert_array_equal((qsec * 2).value, (np.arange(10) * 2)) assert_array_equal((qsec / 2).value, (np.arange(10) / 2)) # quantity addition/subtraction should *not* work with arrays b/c unit # ambiguous with pytest.raises(u.UnitsError): assert_array_equal((qsec + 2).value, (np.arange(10) + 2)) with pytest.raises(u.UnitsError): assert_array_equal((qsec - 2).value, (np.arange(10) + 2)) # should create by unit multiplication, too qsec2 = np.arange(10) * u.second qsec3 = u.second * np.arange(10) assert np.all(qsec == qsec2) assert np.all(qsec2 == qsec3) # make sure numerical-converters fail when arrays are present with pytest.raises(TypeError): float(qsec) with pytest.raises(TypeError): int(qsec) if six.PY2: with pytest.raises(TypeError): long(qsec) def test_array_indexing_slicing(): q = np.array([1., 2., 3.]) * u.m assert q[0] == 1. * u.m assert np.all(q[0:2] == u.Quantity([1., 2.], u.m)) def test_array_setslice(): q = np.array([1., 2., 3. ]) * u.m q[1:2] = np.array([400.]) * u.cm assert np.all(q == np.array([1., 4., 3.]) * u.m) def test_inverse_quantity(): """ Regression test from issue #679 """ q = u.Quantity(4., u.meter / u.second) qot = q / 2 toq = 2 / q npqot = q / np.array(2) assert npqot.value == 2.0 assert npqot.unit == (u.meter / u.second) assert qot.value == 2.0 assert qot.unit == (u.meter / u.second) assert toq.value == 0.5 assert toq.unit == (u.second / u.meter) def test_quantity_mutability(): q = u.Quantity(9.8, u.meter / u.second / u.second) with pytest.raises(AttributeError): q.value = 3 with pytest.raises(AttributeError): q.unit = u.kg def test_quantity_initialized_with_quantity(): q1 = u.Quantity(60, u.second) q2 = u.Quantity(q1, u.minute) assert q2.value == 1 q3 = u.Quantity([q1, q2], u.second) assert q3[0].value == 60 assert q3[1].value == 60 q4 = u.Quantity([q2, q1]) assert q4.unit == q2.unit assert q4[0].value == 1 assert q4[1].value == 1 def test_quantity_string_unit(): q1 = 1. * u.m / 's' assert q1.value == 1 assert q1.unit == (u.m / u.s) q2 = q1 * "m" assert q2.unit == ((u.m * u.m) / u.s) @raises(ValueError) def test_quantity_invalid_unit_string(): "foo" * u.m def test_implicit_conversion(): q = u.Quantity(1.0, u.meter) # Manually turn this on to simulate what might happen in a subclass q._include_easy_conversion_members = True assert_allclose(q.centimeter, 100) assert_allclose(q.cm, 100) assert_allclose(q.parsec, 3.240779289469756e-17) def test_implicit_conversion_autocomplete(): q = u.Quantity(1.0, u.meter) # Manually turn this on to simulate what might happen in a subclass q._include_easy_conversion_members = True q.foo = 42 attrs = dir(q) assert 'centimeter' in attrs assert 'cm' in attrs assert 'parsec' in attrs assert 'foo' in attrs assert 'to' in attrs assert 'value' in attrs # Something from the base class, object assert '__setattr__' in attrs with pytest.raises(AttributeError): q.l def test_quantity_iterability(): """Regressiont est for issue #878. Scalar quantities should not be iterable and should raise a type error on iteration. """ q1 = [15.0, 17.0] * u.m assert isiterable(q1) q2 = six.next(iter(q1)) assert q2 == 15.0 * u.m assert not isiterable(q2) pytest.raises(TypeError, iter, q2) def test_copy(): q1 = u.Quantity(np.array([1., 2., 3.]), unit=u.m) q2 = q1.copy() assert np.all(q1.value == q2.value) assert q1.unit == q2.unit assert q1.dtype == q2.dtype assert q1.value is not q2.value def test_deepcopy(): q1 = u.Quantity(np.array([1., 2., 3.]), unit=u.m) q2 = copy.deepcopy(q1) assert isinstance(q2, u.Quantity) assert np.all(q1.value == q2.value) assert q1.unit == q2.unit assert q1.dtype == q2.dtype assert q1.value is not q2.value def test_equality_numpy_scalar(): """ A regression test to ensure that numpy scalars are correctly compared (which originally failed due to the lack of ``__array_priority__``). """ assert 10 != 10. * u.m assert np.int64(10) != 10 * u.m assert 10 * u.m != np.int64(10) def test_quantity_pickelability(): """ Testing pickleability of quantity """ q1 = np.arange(10) * u.m q2 = pickle.loads(pickle.dumps(q1)) assert np.all(q1.value == q2.value) assert q1.unit.is_equivalent(q2.unit) assert q1.unit == q2.unit def test_quantity_from_string(): with pytest.raises(TypeError): q = u.Quantity(u.m * "5") # the reverse should also fail once #1408 is in with pytest.raises(TypeError): q = u.Quantity('5', u.m) with pytest.raises(TypeError): q = u.Quantity(['5'], u.m) with pytest.raises(TypeError): q = u.Quantity(np.array(['5']), u.m) def test_unsupported(): q1 = np.arange(10) * u.m with pytest.raises(TypeError): q2 = np.bitwise_and(q1, q1) def test_unit_identity(): q = 1.0 * u.hour assert q.unit is u.hour astropy-0.3/astropy/units/tests/test_quantity_ufuncs.py0000644000175000017500000005477612243255342022101 0ustar oleole# The purpose of these tests are to ensure that calling ufuncs with quantities # returns quantities with the right units, or raises exceptions. import numpy as np from numpy.testing.utils import assert_allclose from ... import units as u from ...tests.helper import pytest, raises NUMPY_LT_1P6 = [int(x) for x in np.__version__.split('.')[:2]] < [1, 6] class TestUfuncCoverage(object): """Test that we cover all ufunc's""" def test_coverage(self): all_np_ufuncs = set([ufunc for ufunc in np.core.umath.__dict__.values() if type(ufunc) == np.ufunc]) from .. import quantity_helper as qh all_q_ufuncs = (qh.UNSUPPORTED_UFUNCS | set(qh.UFUNC_HELPERS.keys())) assert all_np_ufuncs - all_q_ufuncs == set([]) assert all_q_ufuncs - all_np_ufuncs == set([]) class TestQuantityTrigonometricFuncs(object): """ Test trigonometric functions """ def test_sin_scalar(self): q = np.sin(30. * u.degree) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, 0.5) def test_sin_array(self): q = np.sin(np.array([0., np.pi / 4., np.pi / 2.]) * u.radian) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, np.array([0., 1. / np.sqrt(2.), 1.]), atol=1.e-15) def test_arcsin_scalar(self): q1 = 30. * u.degree q2 = np.arcsin(np.sin(q1)).to(q1.unit) assert_allclose(q1.value, q2.value) def test_arcsin_array(self): q1 = np.array([0., np.pi / 4., np.pi / 2.]) * u.radian q2 = np.arcsin(np.sin(q1)).to(q1.unit) assert_allclose(q1.value, q2.value) def test_sin_invalid_units(self): with pytest.raises(TypeError) as exc: np.sin(3. * u.m) assert exc.value.args[0] == ("Can only apply 'sin' function " "to quantities with angle units") def test_arcsin_invalid_units(self): with pytest.raises(TypeError) as exc: np.arcsin(3. * u.m) assert exc.value.args[0] == ("Can only apply 'arcsin' function to " "dimensionless quantities") def test_cos_scalar(self): q = np.cos(np.pi / 3. * u.radian) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, 0.5) def test_cos_array(self): q = np.cos(np.array([0., np.pi / 4., np.pi / 2.]) * u.radian) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, np.array([1., 1. / np.sqrt(2.), 0.]), atol=1.e-15) def test_arccos_scalar(self): q1 = np.pi / 3. * u.radian q2 = np.arccos(np.cos(q1)).to(q1.unit) assert_allclose(q1.value, q2.value) def test_arccos_array(self): q1 = np.array([0., np.pi / 4., np.pi / 2.]) * u.radian q2 = np.arccos(np.cos(q1)).to(q1.unit) assert_allclose(q1.value, q2.value) def test_cos_invalid_units(self): with pytest.raises(TypeError) as exc: np.cos(3. * u.s) assert exc.value.args[0] == ("Can only apply 'cos' function " "to quantities with angle units") def test_arccos_invalid_units(self): with pytest.raises(TypeError) as exc: np.arccos(3. * u.s) assert exc.value.args[0] == ("Can only apply 'arccos' function to " "dimensionless quantities") def test_tan_scalar(self): q = np.tan(np.pi / 3. * u.radian) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, np.sqrt(3.)) def test_tan_array(self): q = np.tan(np.array([0., 45., 135., 180.]) * u.degree) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, np.array([0., 1., -1., 0.]), atol=1.e-15) def test_arctan_scalar(self): q = np.pi / 3. * u.radian assert np.arctan(np.tan(q)) def test_arctan_array(self): q = np.array([10., 30., 70., 80.]) * u.degree assert_allclose(np.arctan(np.tan(q)).to(q.unit).value, q.value) def test_tan_invalid_units(self): with pytest.raises(TypeError) as exc: np.tan(np.array([1, 2, 3]) * u.N) assert exc.value.args[0] == ("Can only apply 'tan' function " "to quantities with angle units") def test_arctan_invalid_units(self): with pytest.raises(TypeError) as exc: np.arctan(np.array([1, 2, 3]) * u.N) assert exc.value.args[0] == ("Can only apply 'arctan' function to " "dimensionless quantities") def test_arctan2_valid(self): q1 = np.array([10., 30., 70., 80.]) * u.m q2 = 2.0 * u.km assert np.arctan2(q1, q2).unit == u.radian assert_allclose(np.arctan2(q1, q2).value, np.arctan2(q1.value, q2.to(q1.unit).value)) q3 = q1 / q2 q4 = 1. at2 = np.arctan2(q3, q4) assert_allclose(at2, np.arctan2(q3.to(1).value, q4)) def test_arctan2_invalid(self): with pytest.raises(u.UnitsError) as exc: np.arctan2(np.array([1, 2, 3]) * u.N, 1. * u.s) assert "compatible dimensions" in exc.value.args[0] with pytest.raises(u.UnitsError) as exc: np.arctan2(np.array([1, 2, 3]) * u.N, 1.) assert "dimensionless quantities when other arg" in exc.value.args[0] def test_radians(self): q1 = np.deg2rad(180. * u.degree) assert_allclose(q1.value, np.pi) assert q1.unit == u.radian q2 = np.radians(180. * u.degree) assert_allclose(q2.value, np.pi) assert q2.unit == u.radian # the following doesn't make much sense in terms of the name of the # routine, but we check it gives the correct result. q3 = np.deg2rad(3. * u.radian) assert_allclose(q3.value, 3.) assert q3.unit == u.radian q4 = np.radians(3. * u.radian) assert_allclose(q4.value, 3.) assert q4.unit == u.radian with pytest.raises(TypeError): np.deg2rad(3. * u.m) with pytest.raises(TypeError): np.radians(3. * u.m) def test_degrees(self): # the following doesn't make much sense in terms of the name of the # routine, but we check it gives the correct result. q1 = np.rad2deg(60. * u.degree) assert_allclose(q1.value, 60.) assert q1.unit == u.degree q2 = np.degrees(60. * u.degree) assert_allclose(q2.value, 60.) assert q2.unit == u.degree q3 = np.rad2deg(np.pi * u.radian) assert_allclose(q3.value, 180.) assert q3.unit == u.degree q4 = np.degrees(np.pi * u.radian) assert_allclose(q4.value, 180.) assert q4.unit == u.degree with pytest.raises(TypeError): np.rad2deg(3. * u.m) with pytest.raises(TypeError): np.degrees(3. * u.m) class TestQuantityMathFuncs(object): """ Test other mathematical functions """ def test_multiply_scalar(self): assert np.multiply(4. * u.m, 2. / u.s) == 8. * u.m / u.s assert np.multiply(4. * u.m, 2.) == 8. * u.m assert np.multiply(4., 2. / u.s) == 8. / u.s def test_multiply_array(self): assert np.all(np.multiply(np.arange(3.) * u.m, 2. / u.s) == np.arange(0, 6., 2.) * u.m / u.s) @pytest.mark.parametrize('function', (np.divide, np.true_divide, np.floor_divide)) def test_divide_scalar(self, function): assert function(4. * u.m, 2. * u.s) == function(4., 2.) * u.m / u.s assert function(4. * u.m, 2.) == function(4., 2.) * u.m assert function(4., 2. * u.s) == function(4., 2.) / u.s @pytest.mark.parametrize('function', (np.divide, np.true_divide, np.floor_divide)) def test_divide_array(self, function): assert np.all(function(np.arange(3.) * u.m, 2. * u.s) == function(np.arange(3.), 2.) * u.m / u.s) def test_divmod(self): inch = u.Unit(0.0254 * u.m) quotient, remainder = divmod( np.array([1., 2., 3.]) * u.m, np.array([3., 4., 5.]) * inch) assert_allclose(quotient.value, [13., 19., 23.]) assert quotient.unit == u.dimensionless_unscaled assert_allclose(remainder.value, [0.0094, 0.0696, 0.079]) assert remainder.unit == u.m quotient, remainder = divmod( np.array([1., 2., 3.]) * u.m, u.km) assert_allclose(quotient.value, [1., 2., 3.]) assert quotient.unit == u.m / u.km assert remainder.value == 0. assert remainder.unit == u.dimensionless_unscaled def test_sqrt_scalar(self): assert np.sqrt(4. * u.m) == 2. * u.m ** 0.5 def test_sqrt_array(self): assert np.all(np.sqrt(np.array([1., 4., 9.]) * u.m) == np.array([1., 2., 3.]) * u.m ** 0.5) def test_square_scalar(self): assert np.square(4. * u.m) == 16. * u.m ** 2 def test_square_array(self): assert np.all(np.square(np.array([1., 2., 3.]) * u.m) == np.array([1., 4., 9.]) * u.m ** 2) def test_reciprocal_scalar(self): assert np.reciprocal(4. * u.m) == 0.25 / u.m def test_reciprocal_array(self): assert np.all(np.reciprocal(np.array([1., 2., 4.]) * u.m) == np.array([1., 0.5, 0.25]) / u.m) def test_power_scalar(self): assert np.power(4. * u.m, 2.) == 16. * u.m ** 2 assert np.power(4., 200. * u.cm / u.m) == \ u.Quantity(16., u.dimensionless_unscaled) # regression check on #1696 assert np.power(4. * u.m, 0.) == 1. * u.dimensionless_unscaled def test_power_array(self): assert np.all(np.power(np.array([1., 2., 3.]) * u.m, 3.) == np.array([1., 8., 27.]) * u.m ** 3) # regression check on #1696 assert np.all(np.power(np.arange(4.) * u.m, 0.) == 1. * u.dimensionless_unscaled) @raises(ValueError) def test_power_array_array(self): np.power(4. * u.m, [2., 4.]) @raises(ValueError) def test_power_array_array2(self): np.power([2., 4.] * u.m, [2., 4.]) def test_power_invalid(self): with pytest.raises(TypeError) as exc: np.power(3., 4. * u.m) assert "raise something to a dimensionless" in exc.value.args[0] def test_copysign_scalar(self): assert np.copysign(3 * u.m, 1.) == 3. * u.m assert np.copysign(3 * u.m, 1. * u.s) == 3. * u.m assert np.copysign(3 * u.m, -1.) == -3. * u.m assert np.copysign(3 * u.m, -1. * u.s) == -3. * u.m def test_copysign_array(self): assert np.all(np.copysign(np.array([1., 2., 3.]) * u.s, -1.) == -np.array([1., 2., 3.]) * u.s) assert np.all(np.copysign(np.array([1., 2., 3.]) * u.s, -1. * u.m) == -np.array([1., 2., 3.]) * u.s) assert np.all(np.copysign(np.array([1., 2., 3.]) * u.s, np.array([-2.,2.,-4.]) * u.m) == np.array([-1., 2., -3.]) * u.s) q = np.copysign(np.array([1., 2., 3.]), -3 * u.m) assert np.all(q == np.array([-1., -2., -3.])) assert not isinstance(q, u.Quantity) def test_ldexp_scalar(self): assert np.ldexp(4. * u.m, 2) == 16. * u.m def test_ldexp_array(self): assert np.all(np.ldexp(np.array([1., 2., 3.]) * u.m, [3, 2, 1]) == np.array([8., 8., 6.]) * u.m) def test_ldexp_invalid(self): with pytest.raises(TypeError) as exc: np.ldexp(3. * u.m, 4.) # built-in TypeError, so can't check content of exception with pytest.raises(TypeError) as exc: np.ldexp(3., 4 * u.m) assert "Cannot use ldexp" in exc.value.args[0] @pytest.mark.parametrize('function', (np.exp, np.expm1, np.exp2, np.log, np.log2, np.log10, np.log1p)) def test_exp_scalar(self, function): q = function(3. * u.m / (6. * u.m)) assert q.unit == u.dimensionless_unscaled assert q.value == function(0.5) @pytest.mark.parametrize('function', (np.exp, np.expm1, np.exp2, np.log, np.log2, np.log10, np.log1p)) def test_exp_array(self, function): q = function(np.array([2., 3., 6.]) * u.m / (6. * u.m)) assert q.unit == u.dimensionless_unscaled assert np.all(q.value == function(np.array([1. / 3., 1. / 2., 1.]))) # should also work on quantities that can be made dimensionless q2 = function(np.array([2., 3., 6.]) * u.m / (6. * u.cm)) assert q2.unit == u.dimensionless_unscaled assert_allclose(q2.value, function(np.array([100. / 3., 100. / 2., 100.]))) @pytest.mark.parametrize('function', (np.exp, np.expm1, np.exp2, np.log, np.log2, np.log10, np.log1p)) def test_exp_invalid_units(self, function): # Can't use exp() with non-dimensionless quantities with pytest.raises(TypeError) as exc: function(3. * u.m / u.s) assert exc.value.args[0] == ("Can only apply '{0}' function to " "dimensionless quantities" .format(function.__name__)) def test_modf_scalar(self): q = np.modf(9. * u.m / (600. * u.cm)) assert q == (0.5 * u.dimensionless_unscaled, 1. * u.dimensionless_unscaled) def test_modf_array(self): v = np.arange(10.) * u.m / (500. * u.cm) q = np.modf(v) n = np.modf(v.to(1).value) assert q[0].unit == u.dimensionless_unscaled assert q[1].unit == u.dimensionless_unscaled assert all(q[0].value == n[0]) assert all(q[1].value == n[1]) def test_frexp_scalar(self): q = np.frexp(3. * u.m / (6. * u.m)) assert q == (np.array(0.5), np.array(0.0)) def test_frexp_array(self): q = np.frexp(np.array([2., 3., 6.]) * u.m / (6. * u.m)) assert all((_q0, _q1) == np.frexp(_d) for _q0, _q1, _d in zip(q[0], q[1], [1. / 3., 1. / 2., 1.])) def test_frexp_invalid_units(self): # Can't use prod() with non-dimensionless quantities with pytest.raises(TypeError) as exc: np.frexp(3. * u.m / u.s) assert exc.value.args[0] == ("Can only apply 'frexp' function to " "unscaled dimensionless quantities") # also does not work on quantities that can be made dimensionless with pytest.raises(TypeError) as exc: np.frexp(np.array([2., 3., 6.]) * u.m / (6. * u.cm)) assert exc.value.args[0] == ("Can only apply 'frexp' function to " "unscaled dimensionless quantities") @pytest.mark.parametrize('function', (np.logaddexp, np.logaddexp2)) def test_dimensionless_twoarg_array(self, function): q = function(np.array([2., 3., 6.]) * u.m / (6. * u.cm), 1.) assert q.unit == u.dimensionless_unscaled assert_allclose(q.value, function(np.array([100. / 3., 100. / 2., 100.]), 1.)) @pytest.mark.parametrize('function', (np.logaddexp, np.logaddexp2)) def test_dimensionless_twoarg_invalid_units(self, function): with pytest.raises(TypeError) as exc: function(1. * u.km / u.s, 3. * u.m / u.s) assert exc.value.args[0] == ("Can only apply '{0}' function to " "dimensionless quantities" .format(function.__name__)) class TestInvariantUfuncs(object): @pytest.mark.parametrize(('ufunc'), [np.absolute, np.fabs, np.conj, np.conjugate, np.negative, np.spacing, np.rint, np.floor, np.ceil]) def test_invariant_scalar(self, ufunc): q_i = 4.7 * u.m q_o = ufunc(q_i) assert isinstance(q_o, u.Quantity) assert q_o.unit == q_i.unit assert q_o.value == ufunc(q_i.value) @pytest.mark.parametrize(('ufunc'), [np.absolute, np.conjugate, np.negative, np.rint, np.floor, np.ceil]) def test_invariant_array(self, ufunc): q_i = np.array([-3.3, 2.1, 10.2]) * u.kg / u.s q_o = ufunc(q_i) assert isinstance(q_o, u.Quantity) assert q_o.unit == q_i.unit assert np.all(q_o.value == ufunc(q_i.value)) @pytest.mark.parametrize(('ufunc'), [np.add, np.subtract, np.hypot, np.maximum, np.minimum, np.nextafter, np.remainder, np.mod, np.fmod]) def test_invariant_twoarg_scalar(self, ufunc): q_i1 = 4.7 * u.m q_i2 = 9.4 * u.km q_o = ufunc(q_i1, q_i2) assert isinstance(q_o, u.Quantity) assert q_o.unit == q_i1.unit assert_allclose(q_o.value, ufunc(q_i1.value, q_i2.to(q_i1.unit).value)) @pytest.mark.parametrize(('ufunc'), [np.add, np.subtract, np.hypot, np.maximum, np.minimum, np.nextafter, np.remainder, np.mod, np.fmod]) def test_invariant_twoarg_array(self, ufunc): q_i1 = np.array([-3.3, 2.1, 10.2]) * u.kg / u.s q_i2 = np.array([10., -5., 1.e6]) * u.g / u.us q_o = ufunc(q_i1, q_i2) assert isinstance(q_o, u.Quantity) assert q_o.unit == q_i1.unit assert_allclose(q_o.value, ufunc(q_i1.value, q_i2.to(q_i1.unit).value)) @pytest.mark.parametrize(('ufunc'), [np.add, np.subtract, np.hypot, np.maximum, np.minimum, np.nextafter, np.remainder, np.mod, np.fmod]) def test_invariant_twoarg_invalid_units(self, ufunc): q_i1 = 4.7 * u.m q_i2 = 9.4 * u.s with pytest.raises(u.UnitsError) as exc: ufunc(q_i1, q_i2) assert "compatible dimensions" in exc.value.args[0] class TestComparisonUfuncs(object): @pytest.mark.parametrize(('ufunc'), [np.greater, np.greater_equal, np.less, np.less_equal, np.not_equal, np.equal]) def test_comparison_valid_units(self, ufunc): q_i1 = np.array([-3.3, 2.1, 10.2]) * u.kg / u.s q_i2 = np.array([10., -5., 1.e6]) * u.g / u.Ms q_o = ufunc(q_i1, q_i2) assert not isinstance(q_o, u.Quantity) assert q_o.dtype == np.bool assert np.all(q_o == ufunc(q_i1.value, q_i2.to(q_i1.unit).value)) q_o2 = ufunc(q_i1 / q_i2, 2.) assert not isinstance(q_o2, u.Quantity) assert q_o2.dtype == np.bool assert np.all(q_o2 == ufunc((q_i1 / q_i2).to(1).value, 2.)) # comparison with 0., inf, nan is OK even for dimensional quantities for arbitrary_unit_value in (0., np.inf, np.nan): ufunc(q_i1, arbitrary_unit_value) ufunc(q_i1, arbitrary_unit_value*np.ones(len(q_i1))) # and just for completeness ufunc(q_i1, np.array([0., np.inf, np.nan])) @pytest.mark.parametrize(('ufunc'), [np.greater, np.greater_equal, np.less, np.less_equal, np.not_equal, np.equal]) def test_comparison_invalid_units(self, ufunc): q_i1 = 4.7 * u.m q_i2 = 9.4 * u.s with pytest.raises(u.UnitsError) as exc: ufunc(q_i1, q_i2) assert "compatible dimensions" in exc.value.args[0] class TestInplaceUfuncs(object): @pytest.mark.skipif("NUMPY_LT_1P6") @pytest.mark.parametrize(('value'), [1., np.arange(10.)]) def test_one_argument_ufunc_inplace(self, value): # without scaling s = value * u.rad check = s np.sin(s, out=s) assert check is s assert check.unit == u.dimensionless_unscaled # with scaling s2 = (value * u.rad).to(u.deg) check2 = s2 np.sin(s2, out=s2) assert check2 is s2 assert check2.unit == u.dimensionless_unscaled assert_allclose(s.value, s2.value) @pytest.mark.parametrize(('value'), [1., np.arange(10.)]) def test_one_argument_two_output_ufunc_inplace(self, value): v = 100. * value * u.cm / u.m v_copy = v.copy() tmp = v.copy() check = v np.modf(v, tmp, v) # cannot use out1,out2 keywords with numpy 1.7 assert check is v assert check.unit == u.dimensionless_unscaled v2 = v_copy.to(1) check2 = v2 np.modf(v2, tmp, v2) assert check2 is v2 assert check2.unit == u.dimensionless_unscaled # can also replace in last position if no scaling is needed v3 = v_copy.to(1) check3 = v3 np.modf(v3, v3, tmp) assert check3 is v3 assert check3.unit == u.dimensionless_unscaled # but cannot replace input with first output if scaling is needed with pytest.raises(TypeError): np.modf(v_copy, v_copy, tmp) @pytest.mark.parametrize(('value'), [1., np.arange(10.)]) def test_two_argument_ufunc_inplace_1(self, value): s = value * u.cycle check = s s /= 2. assert check is s assert np.all(check.value == value / 2.) s /= u.s assert check is s assert check.unit == u.cycle / u.s s *= 2. * u.s assert check is s assert np.all(check == value * u.cycle) @pytest.mark.skipif("NUMPY_LT_1P6") @pytest.mark.parametrize(('value'), [1., np.arange(10.)]) def test_two_argument_ufunc_inplace_2(self, value): s = value * u.cycle check = s np.arctan2(s, s, out=s) assert check is s assert check.unit == u.radian with pytest.raises(u.UnitsError): s += 1. * u.m assert check is s assert check.unit == u.radian np.arctan2(1. * u.deg, s, out=s) assert check is s assert check.unit == u.radian np.add(1. * u.deg, s, out=s) assert check is s assert check.unit == u.deg np.multiply(2. / u.s, s, out=s) assert check is s assert check.unit == u.deg / u.s @pytest.mark.skipif("NUMPY_LT_1P6") def test_two_argument_ufunc_inplace_3(self): s = np.array([1., 2., 3.]) * u.dimensionless_unscaled np.arctan2(np.array([1., 2., 3.]), np.array([1., 2., 3.]) * 2., out=s) assert_allclose(s.value, np.arctan2(1., 2.)) assert s.unit == u.radian astropy-0.3/astropy/units/physical.py0000644000175000017500000000732612243255342016240 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Defines physical unit names. This module is not intended for use by user code directly. Instead, the physical unit name of a `Unit` can be obtained using its `ptype` property. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from . import core from . import si from . import astrophys from . import cgs __all__ = ['def_physical_type', 'get_physical_type'] _physical_unit_mapping = {} def def_physical_type(unit, name): """ Adds a new physical unit mapping. Parameters ---------- unit : `~astropy.units.UnitBase` instance The unit to map from. name : str The physical name of the unit. """ r = unit._get_physical_type_id() if r in _physical_unit_mapping: raise ValueError( "{0!r} ({1!r}) already defined as {2!r}".format( r, name, _physical_unit_mapping[r])) _physical_unit_mapping[r] = name def get_physical_type(unit): """ Given a unit, returns the name of the physical quantity it represents. If it represents an unknown physical quantity, ``"unknown"`` is returned. Parameters ---------- unit : `~astropy.units.UnitBase` instance The unit to lookup Returns ------- physical : str The name of the physical quantity, or unknown if not known. """ r = unit._get_physical_type_id() return _physical_unit_mapping.get(r, 'unknown') for unit, name in [ (core.Unit(1), 'dimensionless'), (si.m, 'length'), (si.m ** 2, 'area'), (si.m ** 3, 'volume'), (si.s, 'time'), (si.rad, 'angle'), (si.sr, 'solid angle'), (si.m / si.s, 'speed'), (si.m / si.s ** 2, 'acceleration'), (si.Hz, 'frequency'), (si.g, 'mass'), (si.mol, 'amount of substance'), (si.K, 'temperature'), (si.N, 'force'), (si.J, 'energy'), (si.Pa, 'pressure'), (si.W, 'power'), (si.kg / si.m ** 3, 'mass density'), (si.m ** 3 / si.kg, 'specific volume'), (si.mol / si.m ** 3, 'molar volume'), (si.kg * si.m / si.s, 'momentum/impulse'), (si.kg * si.m ** 2 / si.s, 'angular momentum'), (si.rad / si.s, 'angular speed'), (si.rad / si.s ** 2, 'angular acceleration'), (si.g / (si.m * si.s), 'dynamic viscosity'), (si.m ** 2 / si.s, 'kinematic viscosity'), (si.m ** -1, 'wavenumber'), (si.A, 'electrical current'), (si.C, 'electrical charge'), (si.V, 'electrical potential'), (si.Ohm, 'electrical resistance'), (si.S, 'electrical conductance'), (si.F, 'electrical capacitance'), (si.C * si.m, 'electrical dipole moment'), (si.A / si.m ** 2, 'electrical current density'), (si.V / si.m, 'electrical field strength'), (si.C / si.m ** 2, 'electrical flux density'), (si.C / si.m ** 3, 'electrical charge density'), (si.F / si.m, 'permittivity'), (si.Wb, 'magnetic flux'), (si.T, 'magnetic flux density'), (si.A / si.m, 'magnetic field strength'), (si.H / si.m, 'electromagnetic field strength'), (si.H, 'inductance'), (si.cd, 'luminous intensity'), (si.lm, 'luminous flux'), (si.lx, 'luminous emittence/illuminance'), (si.W / si.sr, 'radiant intensity'), (si.cd / si.m ** 2, 'luminance'), (astrophys.Jy, 'spectral flux density'), (cgs.erg / si.angstrom / si.cm ** 2 / si.s, 'spectral flux density wav'), (astrophys.photon / si.Hz / si.cm ** 2 / si.s, 'photon flux density'), (astrophys.photon / si.AA / si.cm ** 2 / si.s, 'photon flux density wav'), (astrophys.R, 'photon flux'), (astrophys.bit, 'data quantity'), (astrophys.bit / si.s, 'bandwidth') ]: def_physical_type(unit, name) astropy-0.3/astropy/units/__init__.py0000644000175000017500000000147412243255342016161 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units. This code is adapted from the `pynbody `_ units module written by Andrew Pontzen, who has granted the Astropy project permission to use the code under a BSD license. """ from __future__ import absolute_import, division, print_function, unicode_literals from .core import * from .quantity import * from . import si from . import cgs from . import astrophys from .si import * from .astrophys import * from .cgs import * from .physical import * from .equivalencies import * del bases # Enable the set of default units. This notably does *not* include # Imperial units. set_enabled_units([si, cgs, astrophys]) astropy-0.3/astropy/units/astrophys.py0000644000175000017500000001172112243255342016452 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines the astrophysics-specific units. They are also available in the `astropy.units` namespace. The `mag` unit is provided for compatibility with the FITS unit string standard. However, it is not very useful as-is since it is "orphaned" and can not be converted to any other unit. A future astropy magnitudes library is planned to address this shortcoming. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from . import si from ..constants import si as _si from .core import UnitBase, def_unit import numpy as _numpy _ns = globals() ########################################################################### # LENGTH def_unit((['AU', 'au'], []), _si.au.value * si.m, namespace=_ns, prefixes=True, doc="astronomical unit: approximately the mean Earth--Sun " "distance.") def_unit(['pc', 'parsec'], _si.pc.value * si.m, namespace=_ns, prefixes=True, doc="parsec: approximately 3.26 light-years.") def_unit(['solRad', 'R_sun', 'Rsun'], _si.R_sun.value * si.m, namespace=_ns, doc="Solar radius", format={'latex': r'R_{\odot}', 'unicode': 'R⊙'}) def_unit(['lyr', 'lightyear'], _si.c.value * si.yr.to(si.s) * si.m, namespace=_ns, doc="Light year") ########################################################################### # AREAS def_unit(['barn'], 10 ** -28 * si.m ** 2, namespace=_ns, prefixes=True, doc="barn: unit of area used in HEP") ########################################################################### # ANGULAR MEASUREMENTS def_unit(['cycle', 'cy'], 2.0 * _numpy.pi * si.rad, namespace=_ns, prefixes=False, doc="cycle: angular measurement, a full turn or rotation") ########################################################################### # MASS def_unit(['solMass', 'M_sun', 'Msun'], _si.M_sun.value * si.kg, namespace=_ns, prefixes=True, doc="Solar mass", format={'latex': r'M_{\odot}', 'unicode': 'M⊙'}) def_unit(['M_p'], _si.m_p.value * si.kg, namespace=_ns, doc="Proton mass", format={'latex': r'M_{p}', 'unicode': 'Mₚ'}) def_unit(['M_e'], _si.m_e.value * si.kg, namespace=_ns, doc="Electron mass", format={'latex': r'M_{e}', 'unicode': 'Mâ‚‘'}) # Unified atomic mass unit def_unit(['u', 'Da', 'Dalton'], 1.6605387e-27 * si.kg, namespace=_ns, doc="Unified atomic mass unit") ########################################################################## # ENERGY def_unit(['Ry', 'rydberg'], 13.605692 * si.eV, namespace=_ns, doc="Rydberg: Energy of a photon whose wavenumber is the Rydberg " "constant", format={'latex': r'R_{\infty}', 'unicode': 'R∞'}) ########################################################################### # ILLUMINATION def_unit(['solLum', 'L_sun', 'Lsun'], _si.L_sun.value * si.W, namespace=_ns, prefixes=True, doc="Solar luminance", format={'latex': r'L_{\odot}', 'unicode': 'L⊙'}) ########################################################################### # SPECTRAL DENSITY def_unit(['ph', 'photon'], namespace=_ns) def_unit(['Jy', 'Jansky', 'jansky'], 1e-26 * si.W / si.m ** 2 / si.Hz, namespace=_ns, prefixes=True, doc="Jansky: spectral flux density") def_unit(['R', 'Rayleigh', 'rayleigh'], (1e10 / (4 * _numpy.pi)) * ph * si.m ** -2 * si.s ** -1 * si.sr ** -1, namespace=_ns, prefixes=True, doc="Rayleigh: photon flux") def_unit(['mag'], namespace=_ns, prefixes=True, doc="Astronomical magnitude.") ########################################################################### # MISCELLANEOUS # Some of these are very FITS-specific and perhaps considered a mistake. # Maybe they should be moved into the FITS format class? # TODO: This is defined by the FITS standard as "relative to the sun". # Is that mass, volume, what? def_unit(['Sun'], namespace=_ns) ########################################################################### # EVENTS def_unit(['ct', 'count'], namespace=_ns) def_unit(['pix', 'pixel'], namespace=_ns) ########################################################################### # MISCELLANEOUS def_unit(['chan'], namespace=_ns) def_unit(['bin'], namespace=_ns) def_unit(['vox', 'voxel'], namespace=_ns) def_unit((['bit', 'b'], ['bit']), namespace=_ns, prefixes=True) def_unit((['byte', 'B'], ['byte']), namespace=_ns, prefixes=True) def_unit(['adu'], namespace=_ns) def_unit(['beam'], namespace=_ns) ########################################################################### # CLEANUP del UnitBase del def_unit del si ########################################################################### # DOCSTRING # This generates a docstring for this module that describes all of the # standard units defined here. from .utils import generate_unit_summary as _generate_unit_summary __doc__ += _generate_unit_summary(globals()) astropy-0.3/astropy/units/cds.py0000644000175000017500000001552612243255342015176 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines units used in the CDS format. Contains the units defined in `Centre de Données astronomiques de Strasbourg `_ `Standards for Astronomical Catalogues 2.0 `_ format, and the `complete set of supported units `_. This format is used by VOTable up to version 1.2. To include them in `~astropy.units.UnitBase.compose` and the results of `~astropy.units.UnitBase.find_equivalent_units`, do:: >>> from astropy.units import cds >>> cds.enable() # doctest: +SKIP """ from __future__ import (absolute_import, division, print_function, unicode_literals) _ns = globals() def _initialize_module(): # Local imports to avoid polluting top-level namespace import numpy as np from . import core from .. import units as u from ..constants import si as _si # The CDS format also supports power-of-2 prefixes as defined here: # http://physics.nist.gov/cuu/Units/binary.html prefixes = core.si_prefixes + [ (['Ki'], ['kibi'], 2. ** 10), (['Mi'], ['mebi'], 2. ** 20), (['Gi'], ['gibi'], 2. ** 30), (['Ti'], ['tebi'], 2. ** 40), (['Pi'], ['pebi'], 2. ** 50), (['Ei'], ['exbi'], 2. ** 60) ] # CDS only uses the short prefixes prefixes = [(short, short, factor) for (short, long, factor) in prefixes] # The following units are defined in alphabetical order, directly from # here: http://vizier.u-strasbg.fr/cgi-bin/Unit mapping = [ (['A'], u.A, "Ampere"), (['a'], u.a, "year", ['P']), (['a0'], _si.a0, "Bohr radius"), (['al'], u.lyr, "Light year", ['c', 'd']), (['lyr'], u.lyr, "Light year"), (['alpha'], _si.alpha, "Fine structure constant"), ((['AA', 'Ã…'], ['Angstrom', 'Angstroem']), u.AA, "Angstrom"), (['arcm', 'arcmin'], u.arcminute, "minute of arc"), (['arcs', 'arcsec'], u.arcsecond, "second of arc"), (['atm'], _si.atm, "atmosphere"), (['AU', 'au'], u.au, "astronomical unit"), (['bar'], u.bar, "bar"), (['barn'], u.barn, "barn"), (['bit'], u.bit, "bit"), (['byte'], u.byte, "byte"), (['C'], u.C, "Coulomb"), (['c'], _si.c, "speed of light", ['p']), (['cal'], 4.1854 * u.J, "calorie"), (['cd'], u.cd, "candela"), (['ct'], u.ct, "count"), (['D'], u.D, "Debye (dipole)"), (['d'], u.d, "Julian day", ['c']), ((['deg', '°'], ['degree']), u.degree, "degree"), (['dyn'], u.dyn, "dyne"), (['e'], _si.e, "electron charge", ['m']), (['eps0'], _si.eps0, "electric constant"), (['erg'], u.erg, "erg"), (['eV'], u.eV, "electron volt"), (['F'], u.F, "Farad"), (['G'], _si.G, "Gravitation constant"), (['g'], u.g, "gram"), (['gauss'], u.G, "Gauss"), (['geoMass', 'Mgeo'], _si.M_earth, "Earth mass"), (['H'], u.H, "Henry"), (['h'], u.h, "hour", ['p']), (['hr'], u.h, "hour"), (['\\h'], _si.h, "Planck constant"), (['Hz'], u.Hz, "Hertz"), (['inch'], 0.0254 * u.m, "inch"), (['J'], u.J, "Joule"), (['JD'], u.d, "Julian day", ['M']), (['jovMass', 'Mjup'], _si.M_jup, "Jupiter mass"), (['Jy'], u.Jy, "Jansky"), (['K'], u.K, "Kelvin"), (['k'], _si.k_B, "Boltzmann"), (['l'], u.l, "litre", ['a']), (['lm'], u.lm, "lumen"), (['Lsun', 'solLum'], u.solLum, "solar luminosity"), (['lx'], u.lx, "lux"), (['m'], u.m, "meter"), (['mag'], u.mag, "magnitude"), (['me'], _si.m_e, "electron mass"), (['min'], u.minute, "minute"), (['MJD'], u.d, "Julian day"), (['mmHg'], 133.322387415 * u.Pa, "millimeter of mercury"), (['mol'], u.mol, "mole"), (['mp'], _si.m_p, "proton mass"), (['Msun', 'solMass'], u.solMass, "solar mass"), ((['mu0', 'µ0'], []), _si.mu0, "magnetic constant"), (['muB'], _si.muB, "Bohr magneton"), (['N'], u.N, "Newton"), (['Ohm'], u.Ohm, "Ohm"), (['Pa'], u.Pa, "Pascal"), (['pc'], u.pc, "parsec"), (['ph'], u.ph, "photon"), (['pi'], u.Unit(np.pi), "Ï€"), (['pix'], u.pix, "pixel"), (['ppm'], u.Unit(1e-6), "parts per million"), (['R'], _si.R, "gas constant"), (['rad'], u.radian, "radian"), (['Rgeo'], _si.R_earth, "Earth equatorial radius"), (['Rjup'], _si.R_jup, "Jupiter equatorial radius"), (['Rsun', 'solRad'], u.solRad, "solar radius"), (['Ry'], u.Ry, "Rydberg"), (['S'], u.S, "Siemens"), (['s', 'sec'], u.s, "second"), (['sr'], u.sr, "steradian"), (['Sun'], u.Sun, "solar unit"), (['T'], u.T, "Tesla"), (['t'], 1e3 * u.kg, "metric tonne", ['c']), (['u'], _si.u, "atomic mass", ['da', 'a']), (['V'], u.V, "Volt"), (['W'], u.W, "Watt"), (['Wb'], u.Wb, "Weber"), (['yr'], u.a, "year"), ] for entry in mapping: if len(entry) == 3: names, unit, doc = entry excludes = [] else: names, unit, doc, excludes = entry core.def_unit(names, unit, prefixes=prefixes, namespace=_ns, doc=doc, exclude_prefixes=excludes) core.def_unit(['µas'], u.microarcsecond, doc="microsecond of arc", namespace=_ns) core.def_unit(['mas'], u.milliarcsecond, doc="millisecond of arc", namespace=_ns) core.def_unit(['---'], u.dimensionless_unscaled, doc="dimensionless and unscaled", namespace=_ns) core.def_unit(['%'], u.percent, doc="percent", namespace=_ns) # The Vizier "standard" defines this in units of "kg s-3", but # that may not make a whole lot of sense, so here we just define # it as its own new disconnected unit. core.def_unit(['Crab'], prefixes=prefixes, namespace=_ns, doc="Crab (X-ray) flux") _initialize_module() ########################################################################### # DOCSTRING # This generates a docstring for this module that describes all of the # standard units defined here. from .utils import generate_unit_summary as _generate_unit_summary __doc__ += _generate_unit_summary(globals()) def enable(): """ Enable CDS units so they appear in results of `Unit.find_equivalent_units` and `Unit.compose`. This may be used with the ``with`` statement to enable CDS units only temporarily. """ # Local import to avoid cyclical import from .core import add_enabled_units # Local import to avoid polluting namespace import inspect return add_enabled_units(inspect.getmodule(enable)) astropy-0.3/astropy/units/si.py0000644000175000017500000002021012243255342015022 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines the SI units. They are also available in the `astropy.units` namespace. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ..constants import si as _si from .core import UnitBase, Unit, def_unit import numpy as _numpy _ns = globals() ########################################################################### # DIMENSIONLESS def_unit(['percent', 'pct'], Unit(0.01), namespace=_ns, prefixes=False, doc="percent: one hundredth of unity, factor 0.01", format={'generic': '%', 'console': '%', 'cds': '%', 'latex': r'\%', 'unicode': '%'}) ########################################################################### # LENGTH def_unit(['m', 'meter'], namespace=_ns, prefixes=True, doc="meter: base unit of length in SI") def_unit(['micron'], um, namespace=_ns, doc="micron: alias for micrometer (um)", format={'latex': r'\mu m', 'unicode': 'μm'}) def_unit(['Angstrom', 'AA', 'angstrom'], 0.1 * nm, namespace=_ns, doc="Ã¥ngström: 10 ** -10 m", format={'latex': r'\AA', 'unicode': 'Ã…', 'vounit': 'angstrom'}) ########################################################################### # VOLUMES def_unit((['l', 'L'], ['liter']), 1000 * cm ** 3.0, namespace=_ns, prefixes=True, format={'latex': r'\mathcal{l}', 'unicode': 'â„“'}, doc="liter: metric unit of volume") ########################################################################### # ANGULAR MEASUREMENTS def_unit(['rad', 'radian'], namespace=_ns, prefixes=True, doc="radian: angular measurement of the ratio between the length " "on an arc and its radius") def_unit(['deg', 'degree'], _numpy.pi / 180.0 * rad, namespace=_ns, doc="degree: angular measurement 1/360 of full rotation", format={'latex': r'{}^{\circ}', 'unicode': '°'}) def_unit(['hourangle'], 15.0 * deg, namespace=_ns, prefixes=False, doc="hour angle: angular measurement with 24 in a full circle", format={'latex': r'{}^{h}', 'unicode': 'ʰ'}) def_unit(['arcmin', 'arcminute'], 1.0 / 60.0 * deg, namespace=_ns, prefixes=True, doc="arc minute: angular measurement", format={'latex': r'{}^{\prime}', 'unicode': '′'}) def_unit(['arcsec', 'arcsecond'], 1.0 / 3600.0 * deg, namespace=_ns, prefixes=True, doc="arc second: angular measurement") # These special formats should only be used for the non-prefix versions arcsec._format = {'latex': r'{}^{\prime\prime}', 'unicode': '″'} def_unit(['mas'], 0.001 * arcsec, namespace=_ns, doc="arc second: angular measurement") def_unit(['uas'], 0.000001 * arcsec, namespace=_ns, doc="arc second: angular measurement", format={'latex': r'\mu as', 'unicode': 'μas'}) def_unit(['sr', 'steradian'], rad ** 2, namespace=_ns, prefixes=True, doc="steradian: unit of solid angle in SI") ########################################################################### # TIME def_unit(['s', 'second'], namespace=_ns, prefixes=True, exclude_prefixes=['a'], doc="second: base unit of time in SI.") def_unit(['min', 'minute'], 60 * s, namespace=_ns) def_unit(['h', 'hour', 'hr'], 3600 * s, namespace=_ns) def_unit(['d', 'day'], 24 * h, namespace=_ns) def_unit(['sday'], 86164.09053 * s, namespace=_ns, doc="Sidereal day (sday) is the time of one rotation of the Earth.") def_unit(['wk', 'week'], 7 * day, namespace=_ns) def_unit(['fortnight'], 2 * wk, namespace=_ns) def_unit(['a', 'annum'], 365.25 * d, namespace=_ns, prefixes=True, exclude_prefixes=['P']) def_unit(['yr', 'year'], 365.25 * d, namespace=_ns, prefixes=True) ########################################################################### # FREQUENCY def_unit(['Hz', 'Hertz', 'hertz'], 1 / s, namespace=_ns, prefixes=True, doc="Frequency") ########################################################################### # MASS def_unit(['kg', 'kilogram'], namespace=_ns, doc="kilogram: base unit of mass in SI.") def_unit(['g', 'gram'], 1.0e-3 * kg, namespace=_ns, prefixes=True, exclude_prefixes=['k', 'kilo']) def_unit(['t', 'tonne'], 1000 * kg, namespace=_ns, doc="Metric tonne") ########################################################################### # AMOUNT OF SUBSTANCE def_unit(['mol', 'mole'], namespace=_ns, prefixes=True, doc="mole: amount of a chemical substance in SI.") ########################################################################### # TEMPERATURE def_unit( ['K', 'Kelvin'], namespace=_ns, prefixes=True, doc="Kelvin: temperature with a null point at absolute zero.") ########################################################################### # FORCE def_unit(['N', 'Newton', 'newton'], kg * m * s ** -2, namespace=_ns, prefixes=True, doc="Newton: force") ########################################################################## # ENERGY def_unit(['J', 'Joule', 'joule'], N * m, namespace=_ns, prefixes=True, doc="Joule: energy") def_unit(['eV', 'electronvolt'], _si.e.value * J, namespace=_ns, prefixes=True, doc="Electron Volt") def_unit(['Pa', 'Pascal', 'pascal'], J * m ** -3, namespace=_ns, prefixes=True, doc="Pascal: pressure") def_unit(['bar'], 100 * Pa, namespace=_ns, doc="bar: pressure") ########################################################################### # POWER def_unit(['W', 'Watt', 'watt'], J / s, namespace=_ns, prefixes=True, doc="Watt: power") ########################################################################### # ELECTRICAL def_unit(['A', 'ampere', 'amp'], namespace=_ns, prefixes=True, doc="ampere: base unit of electric current in SI") def_unit(['C', 'coulomb'], A * s, namespace=_ns, prefixes=True, doc="coulomb: electric charge") def_unit(['V', 'Volt', 'volt'], J * C ** -1, namespace=_ns, prefixes=True, doc="Volt: electric potential or electromotive force") def_unit(['Ohm', 'ohm'], V * A ** -1, namespace=_ns, prefixes=True, doc="Ohm: electrical resistance", format={'latex': r'\Omega', 'unicode': 'Ω'}) def_unit(['S', 'Siemens', 'siemens'], A * V ** -1, namespace=_ns, prefixes=True, doc="Siemens: electrical conductance") def_unit(['F', 'Farad', 'farad'], C * V ** -1, namespace=_ns, prefixes=True, doc="Farad: electrical capacitance") ########################################################################### # MAGNETIC def_unit(['Wb', 'Weber', 'weber'], V * s, namespace=_ns, prefixes=True, doc="Weber: magnetic flux") def_unit(['T', 'Tesla', 'tesla'], Wb * m ** -2, namespace=_ns, prefixes=True, doc="Tesla: magnetic flux density") def_unit(['H', 'Henry', 'henry'], Wb * A ** -1, namespace=_ns, prefixes=True, doc="Henry: inductance") ########################################################################### # ILLUMINATION def_unit(['cd', 'candela'], namespace=_ns, prefixes=True, doc="candela: base unit of luminous intensity in SI") def_unit(['lm', 'lumen'], cd * sr, namespace=_ns, prefixes=True, doc="lumen: luminous flux") def_unit(['lx', 'lux'], lm * m ** -2, namespace=_ns, prefixes=True, doc="lux: luminous emittence") ########################################################################### # RADIOACTIVITY def_unit(['Bq', 'becquerel'], Hz, namespace=_ns, prefixes=False, doc="becquerel: unit of radioactivity") def_unit(['Ci', 'curie'], Bq / 3.7e10, namespace=_ns, prefixes=False, doc="curie: unit of radioactivity") ########################################################################### # BASES bases = set([m, s, kg, A, cd, rad, K, mol]) ########################################################################### # CLEANUP del UnitBase del Unit del def_unit ########################################################################### # DOCSTRING # This generates a docstring for this module that describes all of the # standard units defined here. from .utils import generate_unit_summary as _generate_unit_summary __doc__ += _generate_unit_summary(globals()) astropy-0.3/astropy/units/format/0000755000175000017500000000000012243263747015342 5ustar oleoleastropy-0.3/astropy/units/format/__init__.py0000644000175000017500000000274012243255342017446 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A collection of different unit formats. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from inspect import isclass from .base import Base from .generic import Generic, Unscaled from .cds import CDS from .console import Console from .fits import Fits from .latex import Latex from .unicode_format import Unicode from .vounit import VOUnit __all__ = [ 'Generic', 'CDS', 'Console', 'Fits', 'Latex', 'Unicode', 'Unscaled', 'VOUnit', 'get_format'] FORMATS = ['Generic', 'CDS', 'Console', 'Fits', 'Latex', 'Unicode', 'Unscaled', 'VOUnit'] def get_format(format=None): """ Get a formatter by name. Parameters ---------- format : str or `astropy.units.format.Base` instance or subclass The name of the format, or the format instance or subclass itself. Returns ------- format : `astropy.units.format.Base` instance The requested formatter. """ if isinstance(format, type) and issubclass(format, Base): return format() elif isinstance(format, Base): return format if format is None: format = 'generic' format = format.lower() for key in FORMATS: val = globals()[key] if isclass(val) and (issubclass(val, Base) and key.lower() == format.lower()): return val() raise ValueError("Unknown format {0!r}".format(format)) astropy-0.3/astropy/units/format/unicode_format.py0000644000175000017500000000335712243255342020712 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Unicode" unit format. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from . import console from . import utils class Unicode(console.Console): """ Output-only format to display pretty formatting at the console using Unicode characters. For example:: >>> import astropy.units as u >>> print(u.Ry.decompose().to_string('unicode')) m² kg 2.1...×10â»Â¹â¸ ───── s² """ def __init__(self): pass _times = "×" _line = "─" def _get_unit_name(self, unit): return unit.get_format_name('unicode') def _format_exponential_notation(self, val): m, ex = utils.split_mantissa_exponent(val) parts = [] if m: parts.append(m.replace('-', '−')) if ex: parts.append("10{0}".format( self._format_superscript(ex))) return self._times.join(parts) @staticmethod def _format_superscript(number): mapping = { '0': 'â°', '1': '¹', '2': '²', '3': '³', '4': 'â´', '5': 'âµ', '6': 'â¶', '7': 'â·', '8': 'â¸', '9': 'â¹', '-': 'â»', '−': 'â»', # This is actually a "raised omission bracket", but it's # the closest thing I could find to a superscript solidus. '/': 'â¸', } output = [] for c in number: output.append(mapping[c]) return ''.join(output) astropy-0.3/astropy/units/format/vounit.py0000644000175000017500000001041012243255342017224 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "VOUnit" unit format. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern.six.moves import zip import keyword import warnings from ...utils.exceptions import AstropyDeprecationWarning from . import generic from . import utils class VOUnit(generic.Generic): """ The proposed IVOA standard for units used by the VO. This is an implementation of `proposed IVOA standard for units `_. """ def __init__(self): if '_parser' not in VOUnit.__dict__: VOUnit._parser, VOUnit._lexer = self._make_parser() if not '_units' in VOUnit.__dict__: unit_names = VOUnit._generate_unit_names() VOUnit._units, VOUnit._deprecated_units = unit_names @staticmethod def _generate_unit_names(): from ... import units as u names = {} deprecated_names = set() bases = [ 'm', 's', 'A', 'K', 'mol', 'cd', 'g', 'rad', 'sr', 'Hz', 'N', 'Pa', 'J', 'W', 'C', 'V', 'S', 'F', 'Wb', 'T', 'H', 'lm', 'lx', 'Ohm'] prefixes = [ 'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd', '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] for base in bases: for prefix in prefixes: key = prefix + base if keyword.iskeyword(key): continue names[key] = getattr(u, key) simple_units = [ 'min', 'h', 'd', 'a', 'yr', 'deg', 'arcsec', 'arcmin', 'deg', 'mas', 'AU', 'pc', 'u', 'eV', 'Jy'] deprecated_units = [ 'angstrom', 'Angstrom', 'barn', 'erg', 'G', 'mag', 'solMass', 'solLum', 'solRad', 'lyr', 'ct', 'count', 'photon', 'ph', 'R', 'pix', 'pixel', 'D', 'Sun', 'chan', 'bin', 'voxel', 'bit', 'byte', 'adu', 'beam'] for unit in simple_units + deprecated_units: names[unit] = getattr(u, unit) for unit in deprecated_units: deprecated_names.add(unit) return names, deprecated_names @classmethod def _parse_unit(cls, unit): if unit not in cls._units: raise ValueError( "Unit {0!r} not supported by the VOUnit " "standard.".format(unit)) if unit in cls._deprecated_units: warnings.warn( "The use of unit {0!r} is discouraged by the " "VOUnit standard.".format(unit), AstropyDeprecationWarning) return cls._units[unit] def _get_unit_name(self, unit): name = unit.get_format_name('vounit') if name not in self._units: raise ValueError( "Unit {0!r} is not part of the VOUnit standard".format(name)) if name in self._deprecated_units: warnings.warn( "The use of unit {0!r} is discouraged by the " "VOUnit standard.".format(name), AstropyDeprecationWarning) return name def to_string(self, unit): from .. import core # Remove units that aren't known to the format unit = utils.decompose_to_known_units(unit, self._get_unit_name) if isinstance(unit, core.CompositeUnit): if unit.physical_type == 'dimensionless' and unit.scale != 1: raise ValueError("The VOUnit format is not able to " "represent scale for dimensionless units. " "Multiply your data by {0:e}." .format(unit.scale)) s = '' if unit.scale != 1: m, ex = utils.split_mantissa_exponent(unit.scale) if m: s += m + ' ' if ex: s += ' 10' if not ex.startswith('-'): s += '+' s += ex pairs = list(zip(unit.bases, unit.powers)) pairs.sort(key=lambda x: x[1], reverse=True) s += self._format_unit_list(pairs) elif isinstance(unit, core.NamedUnit): s = self._get_unit_name(unit) return s astropy-0.3/astropy/units/format/generic.py0000644000175000017500000003000012243255342017311 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles a "generic" string format for units """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os import re from . import utils from .base import Base class Generic(Base): """ A "generic" format. The syntax of the format is based directly on the FITS standard, but instead of only supporting the units that FITS knows about, it supports any unit available in the `astropy.units` namespace. """ _show_scale = True def __init__(self): # Build this on the class, so it only gets generated once. if '_parser' not in Generic.__dict__: Generic._parser, Generic._lexer = self._make_parser() @classmethod def _make_parser(cls): """ The grammar here is based on the description in the `FITS standard `_, Section 4.3, which is not terribly precise. The exact grammar is here is based on the YACC grammar in the `unity library `_. This same grammar is used by the `"fits"` and `"vounit"` formats, the only difference being the set of available unit strings. """ from ...extern.ply import lex, yacc tokens = ( 'DOUBLE_STAR', 'STAR', 'PERIOD', 'SOLIDUS', 'CARET', 'OPEN_PAREN', 'CLOSE_PAREN', 'SQRT', 'UNIT', 'SIGN', 'UINT', 'UFLOAT' ) t_STAR = r'\*' t_PERIOD = r'\.' t_SOLIDUS = r'/' t_DOUBLE_STAR = r'\*\*' t_CARET = r'\^' t_OPEN_PAREN = r'\(' t_CLOSE_PAREN = r'\)' # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!! # Regular expression rules for simple tokens def t_UFLOAT(t): r'((\d+\.?\d*)|(\.\d+))([eE][+-]?\d+)?' if not re.search(r'[eE\.]', t.value): t.type = 'UINT' t.value = int(t.value) elif t.value.endswith('.'): t.type = 'UINT' t.value = int(t.value[:-1]) else: t.value = float(t.value) return t def t_UINT(t): r'\d+' t.value = int(t.value) return t def t_SIGN(t): r'[+-](?=\d)' t.value = float(t.value + '1') return t # This needs to be a function so we can force it to happen # before t_UNIT def t_SQRT(t): r'sqrt' return t def t_UNIT(t): r'%|[a-zA-Z][a-zA-Z_]*' t.value = cls._get_unit(t) return t t_ignore = ' ' # Error handling rule def t_error(t): raise ValueError( "Invalid character at col {0}".format(t.lexpos)) try: from . import generic_lextab lexer = lex.lex(optimize=True, lextab=generic_lextab) except ImportError: lexer = lex.lex(optimize=True, lextab='generic_lextab', outputdir=os.path.dirname(__file__)) def p_main(p): ''' main : product_of_units | factor product_of_units | division_product_of_units | factor division_product_of_units | inverse_unit | factor inverse_unit | factor ''' from ..core import Unit if len(p) == 2: p[0] = Unit(p[1]) else: p[0] = Unit(p[1] * p[2]) def p_division_product_of_units(p): ''' division_product_of_units : product_of_units division unit_expression ''' from ..core import Unit p[0] = Unit(p[1] / p[3]) def p_inverse_unit(p): ''' inverse_unit : division unit_expression ''' p[0] = p[2] ** -1 def p_factor(p): ''' factor : factor_float | factor_int ''' p[0] = p[1] def p_factor_float(p): ''' factor_float : signed_float | signed_float UINT signed_int | signed_float UINT power numeric_power ''' if len(p) == 4: p[0] = p[1] * p[2] ** float(p[3]) elif len(p) == 5: p[0] = p[1] * p[2] ** float(p[4]) elif len(p) == 2: p[0] = p[1] def p_factor_int(p): ''' factor_int : UINT | UINT signed_int | UINT power numeric_power | UINT UINT signed_int | UINT UINT power numeric_power ''' if len(p) == 2: p[0] = p[1] elif len(p) == 3: p[0] = p[1] ** float(p[2]) elif len(p) == 4: if isinstance(p[2], int): p[0] = p[1] * p[2] ** float(p[3]) else: p[0] = p[1] ** float(p[3]) elif len(p) == 5: p[0] = p[1] * p[2] ** p[4] def p_product_of_units(p): ''' product_of_units : unit_expression product product_of_units | unit_expression product_of_units | unit_expression ''' if len(p) == 2: p[0] = p[1] elif len(p) == 3: p[0] = p[1] * p[2] else: p[0] = p[1] * p[3] def p_unit_expression(p): ''' unit_expression : function | unit_with_power | OPEN_PAREN product_of_units CLOSE_PAREN ''' if len(p) == 2: p[0] = p[1] else: p[0] = p[2] def p_unit_with_power(p): ''' unit_with_power : UNIT power numeric_power | UNIT numeric_power | UNIT ''' if len(p) == 2: p[0] = p[1] elif len(p) == 3: p[0] = p[1] ** p[2] else: p[0] = p[1] ** p[3] def p_numeric_power(p): ''' numeric_power : sign UINT | OPEN_PAREN paren_expr CLOSE_PAREN ''' if len(p) == 3: p[0] = p[1] * p[2] elif len(p) == 4: p[0] = p[2] def p_paren_expr(p): ''' paren_expr : sign UINT | signed_float | frac ''' if len(p) == 3: p[0] = p[1] * p[2] else: p[0] = p[1] def p_frac(p): ''' frac : sign UINT division sign UINT ''' p[0] = (p[1] * p[2]) / (p[4] * p[5]) def p_sign(p): ''' sign : SIGN | ''' if len(p) == 2: p[0] = p[1] else: p[0] = 1.0 def p_product(p): ''' product : STAR | PERIOD ''' pass def p_division(p): ''' division : SOLIDUS ''' pass def p_power(p): ''' power : DOUBLE_STAR | CARET ''' pass def p_signed_int(p): ''' signed_int : SIGN UINT ''' p[0] = p[1] * p[2] def p_signed_float(p): ''' signed_float : sign UINT | sign UFLOAT ''' p[0] = p[1] * p[2] def p_function_name(p): ''' function_name : SQRT ''' p[0] = p[1] def p_function(p): ''' function : function_name OPEN_PAREN unit_expression CLOSE_PAREN ''' if p[1] == 'sqrt': p[0] = p[3] ** 0.5 else: raise ValueError( '{0!r} is not a recognized function'.format(p[1])) def p_error(p): raise ValueError() try: from . import generic_parsetab parser = yacc.yacc(debug=False, tabmodule=generic_parsetab, write_tables=False) except ImportError: parser = yacc.yacc(debug=False, tabmodule='generic_parsetab', outputdir=os.path.dirname(__file__)) return parser, lexer @classmethod def _get_unit(cls, t): try: return cls._parse_unit(t.value) except ValueError: raise ValueError( "At col {0}, {1!r} is not a valid unit".format( t.lexpos, t.value)) @classmethod def _parse_unit(cls, s): from ..core import get_current_unit_registry registry = get_current_unit_registry().registry if s == '%': return registry['percent'] elif s in registry: return registry[s] raise ValueError( '{0} is not a valid unit'.format(s)) def parse(self, s, debug=False): # This is a short circuit for the case where the string # is just a single unit name try: return self._parse_unit(s) except ValueError as e: try: return self._parser.parse(s, lexer=self._lexer, debug=debug) except ValueError as e: if str(e): raise ValueError("{0} in string {1!r}".format( str(e), s)) else: raise ValueError( "Syntax error parsing unit string {0!r}".format(s)) def _get_unit_name(self, unit): return unit.get_format_name('generic') def _format_unit_list(self, units): out = [] units.sort(key=lambda x: self._get_unit_name(x[0]).lower()) for base, power in units: if power == 1: out.append(self._get_unit_name(base)) else: power = utils.format_power(power) if '/' in power: out.append('{0}({1})'.format( self._get_unit_name(base), power)) else: out.append('{0}{1}'.format( self._get_unit_name(base), power)) return ' '.join(out) def to_string(self, unit): from .. import core if isinstance(unit, core.CompositeUnit): parts = [] if self._show_scale and unit.scale != 1: parts.append('{0:g}'.format(unit.scale)) if len(unit.bases): positives, negatives = utils.get_grouped_by_powers( unit.bases, unit.powers) if len(positives): parts.append(self._format_unit_list(positives)) elif len(parts) == 0: parts.append('1') if len(negatives): parts.append('/') unit_list = self._format_unit_list(negatives) if len(negatives) == 1: parts.append('{0}'.format(unit_list)) else: parts.append('({0})'.format(unit_list)) return ' '.join(parts) elif isinstance(unit, core.NamedUnit): return self._get_unit_name(unit) class Unscaled(Generic): """ A format that doesn't display the scale part of the unit, other than that, it is identical to the `Generic` format. This is used in some error messages where the scale is irrelevant. """ _show_scale = False astropy-0.3/astropy/units/format/cds.py0000644000175000017500000002265512243255342016467 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICNSE.rst """ Handles a "generic" string format for units """ from __future__ import (absolute_import, division, print_function, unicode_literals) import keyword import os import re from ...extern.six.moves import zip from .base import Base from . import utils from ..utils import is_effectively_unity # TODO: Support logarithmic units using bracketed syntax class CDS(Base): """ Support the `Centre de Données astronomiques de Strasbourg `_ `Standards for Astronomical Catalogues 2.0 `_ format, and the `complete set of supported units `_. This format is used by VOTable up to version 1.2. """ def __init__(self): # Build this on the class, so it only gets generated once. if not '_units' in CDS.__dict__: CDS._units = self._generate_unit_names() if '_parser' not in CDS.__dict__: CDS._parser, CDS._lexer = self._make_parser() @staticmethod def _generate_unit_names(): from .. import cds from ... import units as u names = {} for key, val in cds.__dict__.items(): if isinstance(val, u.UnitBase): names[key] = val return names @classmethod def _make_parser(cls): """ The grammar here is based on the description in the `Standards for Astronomical Catalogues 2.0 `_, which is not terribly precise. The exact grammar is here is based on the YACC grammar in the `unity library `_. """ from ...extern.ply import lex, yacc tokens = ( 'PRODUCT', 'DIVISION', 'OPEN_PAREN', 'CLOSE_PAREN', 'X', 'SIGN', 'UINT', 'UFLOAT', 'UNIT' ) t_PRODUCT = r'\.' t_DIVISION = r'/' t_OPEN_PAREN = r'\(' t_CLOSE_PAREN = r'\)' # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!! # Regular expression rules for simple tokens def t_UFLOAT(t): r'((\d+\.?\d+)|(\.\d+))([eE][+-]?\d+)?' if not re.search(r'[eE\.]', t.value): t.type = 'UINT' t.value = int(t.value) else: t.value = float(t.value) return t def t_UINT(t): r'\d+' t.value = int(t.value) return t def t_SIGN(t): r'[+-](?=\d)' t.value = float(t.value + '1') return t def t_X(t): # multiplication for factor in front of unit r'[x×]' return t def t_UNIT(t): r'\%|[a-zA-Z][a-zA-Z_]*' t.value = cls._get_unit(t) return t t_ignore = '' # Error handling rule def t_error(t): raise ValueError( "Invalid character at col {0}".format(t.lexpos)) try: from . import cds_lextab lexer = lex.lex(optimize=True, lextab=cds_lextab) except ImportError: lexer = lex.lex(optimize=True, lextab='cds_lextab', outputdir=os.path.dirname(__file__)) def p_main(p): ''' main : factor combined_units | combined_units | factor ''' from ..core import Unit if len(p) == 3: p[0] = Unit(p[1] * p[2]) else: p[0] = Unit(p[1]) def p_combined_units(p): ''' combined_units : product_of_units | division_of_units ''' p[0] = p[1] def p_product_of_units(p): ''' product_of_units : unit_expression PRODUCT combined_units | unit_expression ''' if len(p) == 4: p[0] = p[1] * p[3] else: p[0] = p[1] def p_division_of_units(p): ''' division_of_units : DIVISION unit_expression | unit_expression DIVISION combined_units ''' if len(p) == 3: p[0] = p[2] ** -1 else: p[0] = p[1] / p[3] def p_unit_expression(p): ''' unit_expression : unit_with_power | OPEN_PAREN combined_units CLOSE_PAREN ''' if len(p) == 2: p[0] = p[1] else: p[0] = p[2] def p_factor(p): ''' factor : signed_float X UINT signed_int | UINT X UINT signed_int | UINT signed_int | UINT | signed_float ''' if len(p) == 5: if p[3] != 10: raise ValueError( "Only base ten exponents are allowed in CDS") p[0] = p[1] * 10.0 ** p[4] elif len(p) == 3: if p[1] != 10: raise ValueError( "Only base ten exponents are allowed in CDS") p[0] = 10.0 ** p[2] elif len(p) == 2: p[0] = p[1] def p_unit_with_power(p): ''' unit_with_power : UNIT numeric_power | UNIT ''' if len(p) == 2: p[0] = p[1] else: p[0] = p[1] ** p[2] def p_numeric_power(p): ''' numeric_power : sign UINT ''' p[0] = p[1] * p[2] def p_sign(p): ''' sign : SIGN | ''' if len(p) == 2: p[0] = p[1] else: p[0] = 1.0 def p_signed_int(p): ''' signed_int : SIGN UINT ''' p[0] = p[1] * p[2] def p_signed_float(p): ''' signed_float : sign UINT | sign UFLOAT ''' p[0] = p[1] * p[2] def p_error(p): raise ValueError() try: from . import cds_parsetab parser = yacc.yacc(debug=False, tabmodule=cds_parsetab, write_tables=False) except ImportError: parser = yacc.yacc(debug=False, tabmodule='cds_parsetab', outputdir=os.path.dirname(__file__)) return parser, lexer @classmethod def _get_unit(cls, t): try: return cls._parse_unit(t.value) except ValueError: raise ValueError( "At col {0}, {1!r} is not a valid unit".format( t.lexpos, t.value)) @classmethod def _parse_unit(cls, unit): if unit not in cls._units: raise ValueError( "Unit {0!r} not supported by the CDS SAC " "standard.".format(unit)) return cls._units[unit] def parse(self, s, debug=False): if ' ' in s: raise ValueError('CDS unit must not contain whitespace') # This is a short circuit for the case where the string # is just a single unit name try: return self._parse_unit(s) except ValueError: try: return self._parser.parse(s, lexer=self._lexer, debug=debug) except ValueError as e: if str(e): raise ValueError("{0} in unit {1!r}".format( str(e), s)) else: raise ValueError( "Syntax error parsing unit {0!r}".format(s)) def _get_unit_name(self, unit): return unit.get_format_name('cds') def _format_unit_list(self, units): out = [] for base, power in units: if power == 1: out.append(self._get_unit_name(base)) else: out.append('{0}{1}'.format( self._get_unit_name(base), int(power))) return '.'.join(out) def to_string(self, unit): from .. import core # Remove units that aren't known to the format unit = utils.decompose_to_known_units(unit, self._get_unit_name) if isinstance(unit, core.CompositeUnit): if(unit.physical_type == 'dimensionless' and is_effectively_unity(unit.scale*100.)): return '%' if unit.scale == 1: s = '' else: m, e = utils.split_mantissa_exponent(unit.scale) parts = [] if m not in ('', '1'): parts.append(m) if e: if not e.startswith('-'): e = "+" + e parts.append('10{0}'.format(e)) s = 'x'.join(parts) pairs = list(zip(unit.bases, unit.powers)) if len(pairs) > 0: pairs.sort(key=lambda x: x[1], reverse=True) s += self._format_unit_list(pairs) elif isinstance(unit, core.NamedUnit): s = self._get_unit_name(unit) return s astropy-0.3/astropy/units/format/fits.py0000644000175000017500000000774412243255342016665 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "FITS" unit format. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern.six.moves import zip import keyword import warnings from ...utils.exceptions import AstropyDeprecationWarning from . import generic from . import utils class Fits(generic.Generic): """ The FITS standard unit format. This supports the format defined in the Units section of the `FITS Standard `_. """ name = 'fits' def __init__(self): # Build this on the class, so it only gets generated once. if '_parser' not in Fits.__dict__: Fits._parser, Fits._lexer = self._make_parser() if not '_units' in Fits.__dict__: Fits._units, Fits._deprecated_units = self._generate_unit_names() @staticmethod def _generate_unit_names(): from ... import units as u names = {} deprecated_names = set() bases = [ 'm', 'g', 's', 'rad', 'sr', 'K', 'A', 'mol', 'cd', 'Hz', 'J', 'W', 'V', 'N', 'Pa', 'C', 'Ohm', 'S', 'F', 'Wb', 'T', 'H', 'lm', 'lx', 'a', 'yr', 'eV', 'pc', 'Jy', 'mag', 'R', 'bit', 'byte' ] deprecated_bases = ['G', 'barn'] prefixes = [ 'y', 'z', 'a', 'f', 'p', 'n', 'u', 'm', 'c', 'd', '', 'da', 'h', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] for base in bases + deprecated_bases: for prefix in prefixes: key = prefix + base if keyword.iskeyword(key): continue names[key] = getattr(u, key) for base in deprecated_bases: for prefix in prefixes: deprecated_names.add(prefix + base) simple_units = [ 'deg', 'arcmin', 'arcsec', 'mas', 'min', 'h', 'd', 'Ry', 'solMass', 'u', 'solLum', 'solRad', 'AU', 'lyr', 'count', 'photon', 'ph', 'pixel', 'pix', 'D', 'Sun', 'chan', 'bin', 'voxel', 'adu', 'beam' ] deprecated_units = ['erg', 'Angstrom'] for unit in simple_units + deprecated_units: names[unit] = getattr(u, unit) for unit in deprecated_units: deprecated_names.add(unit) return names, deprecated_names @classmethod def _parse_unit(cls, unit): if unit not in cls._units: raise ValueError( "Unit {0!r} not supported by the FITS standard.".format(unit)) if unit in cls._deprecated_units: warnings.warn( "The unit {0!r} has been deprecated in the FITS " "standard.".format(unit), AstropyDeprecationWarning) return cls._units[unit] def _get_unit_name(self, unit): name = unit.get_format_name('fits') if name not in self._units: raise ValueError( "Unit {0!r} is not part of the FITS standard".format(name)) if name in self._deprecated_units: warnings.warn( "The unit {0!r} has been deprecated in the FITS " "standard.".format(name), AstropyDeprecationWarning) return name def to_string(self, unit): from .. import core # Remove units that aren't known to the format unit = utils.decompose_to_known_units(unit, self._get_unit_name) if isinstance(unit, core.CompositeUnit): if unit.scale != 1: raise ValueError( "The FITS unit format is not able to represent scale. " "Multiply your data by {0:e}.".format(unit.scale)) pairs = list(zip(unit.bases, unit.powers)) pairs.sort(key=lambda x: x[1], reverse=True) s = self._format_unit_list(pairs) elif isinstance(unit, core.NamedUnit): s = self._get_unit_name(unit) return s astropy-0.3/astropy/units/format/base.py0000644000175000017500000000136012243255342016616 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) class Base(object): """ The abstract base class of all unit formats. """ def parse(self, s): """ Convert a string to a unit object. Must be overridden by the subclass. """ raise NotImplementedError( "Can not parse {0}".format(self.__class__.__name__)) def to_string(self, u): """ Convert a unit object to a string. Must be overridden by the subclass. """ raise NotImplementedError( "Can not output in {0} format".format(self.__class__.__name__)) astropy-0.3/astropy/units/format/generic_lextab.py0000644000175000017500000000214012243255342020654 0ustar oleolefrom __future__ import absolute_import, division, print_function, unicode_literals # generic_lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' _lextokens = {'CARET': 1, 'SOLIDUS': 1, 'STAR': 1, 'DOUBLE_STAR': 1, 'PERIOD': 1, 'SQRT': 1, 'SIGN': 1, 'OPEN_PAREN': 1, 'UINT': 1, 'UNIT': 1, 'CLOSE_PAREN': 1, 'UFLOAT': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive'} _lexstatere = {'INITIAL': [('(?P((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)|(?P\\d+)|(?P[+-](?=\\d))|(?Psqrt)|(?P%|[a-zA-Z][a-zA-Z_]*)|(?P\\*\\*)|(?P\\))|(?P\\^)|(?P\\.)|(?P\\*)|(?P\\()|(?P/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_SQRT', 'SQRT'), ('t_UNIT', 'UNIT'), (None, 'DOUBLE_STAR'), (None, 'CLOSE_PAREN'), (None, 'CARET'), (None, 'PERIOD'), (None, 'STAR'), (None, 'OPEN_PAREN'), (None, 'SOLIDUS')])]} _lexstateignore = {'INITIAL': ' '} _lexstateerrorf = {'INITIAL': 't_error'} astropy-0.3/astropy/units/format/cds_parsetab.py0000644000175000017500000001066112243255342020342 0ustar oleolefrom __future__ import absolute_import, division, print_function, unicode_literals # astropy/units/format/cds_parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b'o\xc2\x11\xf7/(Q\xfc?\xf7\xd2\xbf\xf9Q\xfez' _lr_action_items = {'DIVISION':([0,4,6,9,10,11,12,13,17,18,20,23,26,27,29,31,32,35,36,],[1,-10,-16,1,-15,-18,1,26,-24,-23,-14,-17,1,1,-11,-22,-19,-12,-13,]),'PRODUCT':([4,11,13,23,29,32,],[-10,-18,27,-17,-11,-19,]),'SIGN':([0,10,11,28,30,],[5,22,5,22,22,]),'OPEN_PAREN':([0,1,6,9,10,12,17,18,20,26,27,31,35,36,],[9,9,-16,9,-15,9,-24,-23,-14,9,9,-22,-12,-13,]),'UINT':([0,5,7,11,16,21,22,24,],[10,-20,18,-21,28,30,31,32,]),'CLOSE_PAREN':([2,4,8,11,13,15,19,23,29,32,33,34,],[-5,-10,-4,-18,-7,-8,29,-17,-11,-19,-9,-6,]),'X':([6,10,17,18,],[16,21,-24,-23,]),'$end':([2,3,4,6,8,10,11,12,13,14,15,17,18,20,23,25,29,31,32,33,34,35,36,],[-5,0,-10,-16,-4,-15,-18,-3,-7,-2,-8,-24,-23,-14,-17,-1,-11,-22,-19,-9,-6,-12,-13,]),'UNIT':([0,1,6,9,10,12,17,18,20,26,27,31,35,36,],[11,11,-16,11,-15,11,-24,-23,-14,11,11,-22,-12,-13,]),'UFLOAT':([0,5,7,],[-21,-20,17,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = { } _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'division_of_units':([0,9,12,26,27,],[2,2,2,2,2,]),'main':([0,],[3,]),'unit_with_power':([0,1,9,12,26,27,],[4,4,4,4,4,4,]),'signed_float':([0,],[6,]),'sign':([0,11,],[7,24,]),'product_of_units':([0,9,12,26,27,],[8,8,8,8,8,]),'signed_int':([10,28,30,],[20,35,36,]),'factor':([0,],[12,]),'unit_expression':([0,1,9,12,26,27,],[13,15,13,13,13,13,]),'numeric_power':([11,],[23,]),'combined_units':([0,9,12,26,27,],[14,19,25,33,34,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_goto: _lr_goto[_x] = { } _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> main","S'",1,None,None,None), ('main -> factor combined_units','main',2,'p_main','astropy/units/format/cds.py',168), ('main -> combined_units','main',1,'p_main','astropy/units/format/cds.py',169), ('main -> factor','main',1,'p_main','astropy/units/format/cds.py',170), ('combined_units -> product_of_units','combined_units',1,'p_combined_units','astropy/units/format/cds.py',180), ('combined_units -> division_of_units','combined_units',1,'p_combined_units','astropy/units/format/cds.py',181), ('product_of_units -> unit_expression PRODUCT combined_units','product_of_units',3,'p_product_of_units','astropy/units/format/cds.py',187), ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','astropy/units/format/cds.py',188), ('division_of_units -> DIVISION unit_expression','division_of_units',2,'p_division_of_units','astropy/units/format/cds.py',197), ('division_of_units -> unit_expression DIVISION combined_units','division_of_units',3,'p_division_of_units','astropy/units/format/cds.py',198), ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','astropy/units/format/cds.py',207), ('unit_expression -> OPEN_PAREN combined_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','astropy/units/format/cds.py',208), ('factor -> signed_float X UINT signed_int','factor',4,'p_factor','astropy/units/format/cds.py',217), ('factor -> UINT X UINT signed_int','factor',4,'p_factor','astropy/units/format/cds.py',218), ('factor -> UINT signed_int','factor',2,'p_factor','astropy/units/format/cds.py',219), ('factor -> UINT','factor',1,'p_factor','astropy/units/format/cds.py',220), ('factor -> signed_float','factor',1,'p_factor','astropy/units/format/cds.py',221), ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','astropy/units/format/cds.py',238), ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','astropy/units/format/cds.py',239), ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','astropy/units/format/cds.py',248), ('sign -> SIGN','sign',1,'p_sign','astropy/units/format/cds.py',254), ('sign -> ','sign',0,'p_sign','astropy/units/format/cds.py',255), ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','astropy/units/format/cds.py',264), ('signed_float -> sign UINT','signed_float',2,'p_signed_float','astropy/units/format/cds.py',270), ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','astropy/units/format/cds.py',271), ] astropy-0.3/astropy/units/format/console.py0000644000175000017500000000544112243255342017352 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "Console" unit format. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from . import base from . import utils class Console(base.Base): """ Output-only format for to display pretty formatting at the console. For example:: >>> import astropy.units as u >>> print(u.Ry.decompose().to_string('console')) m^2 kg 2.1...*10^-18 ------ s^2 """ def __init__(self): pass _times = "*" _line = "-" def _get_unit_name(self, unit): return unit.get_format_name('console') def _format_superscript(self, number): return '^{0}'.format(number) def _format_unit_list(self, units): out = [] for base, power in units: if power == 1: out.append(self._get_unit_name(base)) else: out.append('{0}{1}'.format( self._get_unit_name(base), self._format_superscript( utils.format_power(power)))) return ' '.join(out) def _format_exponential_notation(self, val): m, ex = utils.split_mantissa_exponent(val) parts = [] if m: parts.append(m) if ex: parts.append("10{0}".format( self._format_superscript(ex))) return self._times.join(parts) def to_string(self, unit): from .. import core if isinstance(unit, core.CompositeUnit): if unit.scale == 1: s = '' else: s = self._format_exponential_notation(unit.scale) if len(unit.bases): positives, negatives = utils.get_grouped_by_powers( unit.bases, unit.powers) if len(negatives): if len(positives): positives = self._format_unit_list(positives) else: positives = '1' negatives = self._format_unit_list(negatives) l = len(s) r = max(len(positives), len(negatives)) f = "{{0:^{0}s}} {{1:^{1}s}}".format(l, r) lines = [ f.format('', positives), f.format(s, self._line * r), f.format('', negatives) ] s = '\n'.join(lines) else: positives = self._format_unit_list(positives) s += positives elif isinstance(unit, core.NamedUnit): s = self._get_unit_name(unit) return s astropy-0.3/astropy/units/format/latex.py0000644000175000017500000000531412243255342017024 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Handles the "LaTeX" unit format. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from . import base from . import utils class Latex(base.Base): """ Output LaTeX to display the unit based on IAU style guidelines. Attempts to follow the `IAU Style Manual `_. """ def __init__(self): pass def _latex_escape(self, name): # This doesn't escape arbitrary LaTeX strings, but it should # be good enough for unit names which are required to be alpha # + "_" anyway. return name.replace('_', r'\_') def _get_unit_name(self, unit): name = unit.get_format_name('latex') if name == unit.name: return self._latex_escape(name) return name def _format_unit_list(self, units): out = [] for base, power in units: if power == 1: out.append(self._get_unit_name(base)) else: out.append('{0}^{{{1}}}'.format( self._get_unit_name(base), utils.format_power(power))) return r'\,'.join(out) def _format_exponential_notation(self, val): m, ex = utils.split_mantissa_exponent(val) parts = [] if m: parts.append(m) if ex: parts.append("10^{{{0}}}".format(ex)) return r" \times ".join(parts) def to_string(self, unit): from .. import core latex_name = None if hasattr(unit, '_format'): latex_name = unit._format.get('latex') if latex_name is not None: s = latex_name elif isinstance(unit, core.CompositeUnit): if unit.scale == 1: s = '' else: s = self._format_exponential_notation(unit.scale) + r'\,' if len(unit.bases): positives, negatives = utils.get_grouped_by_powers( unit.bases, unit.powers) if len(negatives): if len(positives): positives = self._format_unit_list(positives) else: positives = '1' negatives = self._format_unit_list(negatives) s += r'\frac{{{0}}}{{{1}}}'.format(positives, negatives) else: positives = self._format_unit_list(positives) s += positives elif isinstance(unit, core.NamedUnit): s = self._latex_escape(unit.name) return r'$\mathrm{{{0}}}$'.format(s) astropy-0.3/astropy/units/format/utils.py0000644000175000017500000000665212243255342017055 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities shared by the different formats. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern import six from ...utils.compat.fractions import Fraction def get_grouped_by_powers(bases, powers): """ Groups the powers and bases in the given `~astropy.units.core.CompositeUnit` into positive powers and negative powers for easy display on either side of a solidus. Parameters ---------- bases : list of `astropy.units.UnitBase` instances powers : list of ints Returns ------- positives, negatives : tuple of lists Each element in each list is tuple of the form (*base*, *power*). The negatives have the sign of their power reversed (i.e. the powers are all positive). """ positive = [] negative = [] for base, power in zip(bases, powers): if power < 0: negative.append((base, -power)) elif power > 0: positive.append((base, power)) else: raise ValueError("Unit with 0 power") return positive, negative def split_mantissa_exponent(v): """ Given a number, split it into its mantissa and base 10 exponent parts, each as strings. If the exponent is too small, it may be returned as the empty string. The precise rules are based on Python's "general purpose" (`g`) formatting. Parameters ---------- v : float Returns ------- mantissa, exponent : tuple of strings """ x = "{0:.8g}".format(v).split('e') if x[0] != '1.' + '0' * (len(x[0]) - 2): m = x[0] else: m = '' if len(x) == 2: ex = x[1].lstrip("0+") if len(ex) > 0 and ex[0] == '-': ex = '-' + ex[1:].lstrip('0') else: ex = '' return m, ex def decompose_to_known_units(unit, func): """ Partially decomposes a unit so it is only composed of units that are "known" to a given format. Parameters ---------- unit : `astropy.units.UnitBase` instance func : callable This function will be called to determine if a given unit is "known". If the unit is not known, this function should raise a `ValueError`. Returns ------- unit : `astropy.units.UnitBase` instance A flattened unit. """ from .. import core if isinstance(unit, core.CompositeUnit): new_unit = core.Unit(unit.scale) for base, power in zip(unit.bases, unit.powers): new_unit = new_unit * decompose_to_known_units(base, func) ** power return new_unit elif isinstance(unit, core.NamedUnit): try: func(unit) except ValueError: if isinstance(unit, core.Unit): return decompose_to_known_units(unit._represents, func) raise return unit def format_power(power): """ Converts a value for a power (which may be floating point or a `fractions.Fraction` object), into a string either looking like an integer or a fraction. """ if not isinstance(power, Fraction): if power % 1.0 != 0.0: frac = Fraction.from_float(power) power = frac.limit_denominator(10) if power.denominator == 1: power = int(power.numerator) else: power = int(power) return six.text_type(power) astropy-0.3/astropy/units/format/generic_parsetab.py0000644000175000017500000002012712243255342021203 0ustar oleolefrom __future__ import absolute_import, division, print_function, unicode_literals # astropy/units/format/generic_parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b'\xac\x0e4\xcc\xf8@\xe9u\x05I\xac\x9dB\xb3\xb6\x0c' _lr_action_items = {'CARET':([17,18,34,40,],[35,35,35,35,]),'SOLIDUS':([0,3,4,7,8,12,14,15,17,18,19,21,22,25,31,39,44,46,47,50,51,52,54,55,56,61,62,63,64,65,],[1,-23,1,1,-21,-22,-11,-9,-14,-27,-10,-43,-42,1,-20,-15,-26,-24,-19,-12,-16,-41,-17,-25,-28,-45,-13,-18,1,-29,]),'STAR':([3,8,12,18,44,46,55,56,61,65,],[-23,29,-22,-27,-26,-24,-25,-28,-45,-29,]),'DOUBLE_STAR':([17,18,34,40,],[37,37,37,37,]),'PERIOD':([3,8,12,18,44,46,55,56,61,65,],[-23,30,-22,-27,-26,-24,-25,-28,-45,-29,]),'SQRT':([0,1,3,6,7,8,12,13,14,15,17,18,19,21,22,23,28,29,30,32,39,44,46,50,51,52,54,55,56,61,62,63,65,],[20,-38,-23,20,20,20,-22,20,-11,-9,-14,-27,-10,-43,-42,20,20,-36,-37,20,-15,-26,-24,-12,-16,-41,-17,-25,-28,-45,-13,-18,-29,]),'SIGN':([0,1,17,18,34,35,36,37,40,41,43,49,53,66,],[16,-38,38,16,38,-40,16,-39,38,16,16,16,16,16,]),'OPEN_PAREN':([0,1,3,6,7,8,11,12,13,14,15,17,18,19,20,21,22,23,28,29,30,32,35,36,37,39,41,44,46,49,50,51,52,53,54,55,56,61,62,63,65,],[6,-38,-23,6,6,6,32,-22,6,-11,-9,-14,43,-10,-44,-43,-42,6,6,-36,-37,6,-40,43,-39,-15,43,-26,-24,43,-12,-16,-41,43,-17,-25,-28,-45,-13,-18,-29,]),'UINT':([0,1,2,14,16,17,18,21,22,35,36,37,38,41,42,43,49,53,59,66,67,],[17,-38,22,34,-34,40,-35,-43,-42,-40,-35,-39,52,-35,56,-35,-35,-35,64,-35,68,]),'CLOSE_PAREN':([3,8,12,18,21,24,31,44,46,47,48,55,56,57,58,60,61,64,65,68,],[-23,-21,-22,-27,-43,46,-20,-26,-24,-19,61,-25,-28,-32,-31,65,-45,-30,-29,-33,]),'$end':([3,4,5,8,9,10,12,18,25,26,27,31,33,44,45,46,47,55,56,61,65,],[-23,-1,-3,-21,0,-5,-22,-27,-2,-4,-6,-20,-8,-26,-7,-24,-19,-25,-28,-45,-29,]),'UNIT':([0,1,3,6,7,8,12,13,14,15,17,18,19,21,22,23,28,29,30,32,39,44,46,50,51,52,54,55,56,61,62,63,65,],[18,-38,-23,18,18,18,-22,18,-11,-9,-14,-27,-10,-43,-42,18,18,-36,-37,18,-15,-26,-24,-12,-16,-41,-17,-25,-28,-45,-13,-18,-29,]),'UFLOAT':([0,2,16,43,59,],[-35,21,-34,-35,21,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = { } _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'function':([0,6,7,8,13,23,28,32,],[12,12,12,12,12,12,12,12,]),'division':([0,4,7,25,64,],[13,23,13,23,66,]),'product':([8,],[28,]),'frac':([43,],[57,]),'factor_int':([0,],[19,]),'power':([17,18,34,40,],[36,41,49,53,]),'unit_with_power':([0,6,7,8,13,23,28,32,],[3,3,3,3,3,3,3,3,]),'signed_float':([0,43,],[14,58,]),'product_of_units':([0,6,7,8,28,],[4,24,25,31,47,]),'factor_float':([0,],[15,]),'sign':([0,18,36,41,43,49,53,66,],[2,42,42,42,59,42,42,67,]),'signed_int':([17,34,40,],[39,50,54,]),'division_product_of_units':([0,7,],[5,26,]),'factor':([0,],[7,]),'unit_expression':([0,6,7,8,13,23,28,32,],[8,8,8,8,33,45,8,48,]),'numeric_power':([18,36,41,49,53,],[44,51,55,62,63,]),'main':([0,],[9,]),'paren_expr':([43,],[60,]),'inverse_unit':([0,7,],[10,27,]),'function_name':([0,6,7,8,13,23,28,32,],[11,11,11,11,11,11,11,11,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_goto: _lr_goto[_x] = { } _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> main","S'",1,None,None,None), ('main -> product_of_units','main',1,'p_main','astropy/units/format/generic.py',125), ('main -> factor product_of_units','main',2,'p_main','astropy/units/format/generic.py',126), ('main -> division_product_of_units','main',1,'p_main','astropy/units/format/generic.py',127), ('main -> factor division_product_of_units','main',2,'p_main','astropy/units/format/generic.py',128), ('main -> inverse_unit','main',1,'p_main','astropy/units/format/generic.py',129), ('main -> factor inverse_unit','main',2,'p_main','astropy/units/format/generic.py',130), ('division_product_of_units -> product_of_units division unit_expression','division_product_of_units',3,'p_division_product_of_units','astropy/units/format/generic.py',140), ('inverse_unit -> division unit_expression','inverse_unit',2,'p_inverse_unit','astropy/units/format/generic.py',147), ('factor -> factor_float','factor',1,'p_factor','astropy/units/format/generic.py',153), ('factor -> factor_int','factor',1,'p_factor','astropy/units/format/generic.py',154), ('factor_float -> signed_float','factor_float',1,'p_factor_float','astropy/units/format/generic.py',160), ('factor_float -> signed_float UINT signed_int','factor_float',3,'p_factor_float','astropy/units/format/generic.py',161), ('factor_float -> signed_float UINT power numeric_power','factor_float',4,'p_factor_float','astropy/units/format/generic.py',162), ('factor_int -> UINT','factor_int',1,'p_factor_int','astropy/units/format/generic.py',173), ('factor_int -> UINT signed_int','factor_int',2,'p_factor_int','astropy/units/format/generic.py',174), ('factor_int -> UINT power numeric_power','factor_int',3,'p_factor_int','astropy/units/format/generic.py',175), ('factor_int -> UINT UINT signed_int','factor_int',3,'p_factor_int','astropy/units/format/generic.py',176), ('factor_int -> UINT UINT power numeric_power','factor_int',4,'p_factor_int','astropy/units/format/generic.py',177), ('product_of_units -> unit_expression product product_of_units','product_of_units',3,'p_product_of_units','astropy/units/format/generic.py',193), ('product_of_units -> unit_expression product_of_units','product_of_units',2,'p_product_of_units','astropy/units/format/generic.py',194), ('product_of_units -> unit_expression','product_of_units',1,'p_product_of_units','astropy/units/format/generic.py',195), ('unit_expression -> function','unit_expression',1,'p_unit_expression','astropy/units/format/generic.py',206), ('unit_expression -> unit_with_power','unit_expression',1,'p_unit_expression','astropy/units/format/generic.py',207), ('unit_expression -> OPEN_PAREN product_of_units CLOSE_PAREN','unit_expression',3,'p_unit_expression','astropy/units/format/generic.py',208), ('unit_with_power -> UNIT power numeric_power','unit_with_power',3,'p_unit_with_power','astropy/units/format/generic.py',217), ('unit_with_power -> UNIT numeric_power','unit_with_power',2,'p_unit_with_power','astropy/units/format/generic.py',218), ('unit_with_power -> UNIT','unit_with_power',1,'p_unit_with_power','astropy/units/format/generic.py',219), ('numeric_power -> sign UINT','numeric_power',2,'p_numeric_power','astropy/units/format/generic.py',230), ('numeric_power -> OPEN_PAREN paren_expr CLOSE_PAREN','numeric_power',3,'p_numeric_power','astropy/units/format/generic.py',231), ('paren_expr -> sign UINT','paren_expr',2,'p_paren_expr','astropy/units/format/generic.py',240), ('paren_expr -> signed_float','paren_expr',1,'p_paren_expr','astropy/units/format/generic.py',241), ('paren_expr -> frac','paren_expr',1,'p_paren_expr','astropy/units/format/generic.py',242), ('frac -> sign UINT division sign UINT','frac',5,'p_frac','astropy/units/format/generic.py',251), ('sign -> SIGN','sign',1,'p_sign','astropy/units/format/generic.py',257), ('sign -> ','sign',0,'p_sign','astropy/units/format/generic.py',258), ('product -> STAR','product',1,'p_product','astropy/units/format/generic.py',267), ('product -> PERIOD','product',1,'p_product','astropy/units/format/generic.py',268), ('division -> SOLIDUS','division',1,'p_division','astropy/units/format/generic.py',274), ('power -> DOUBLE_STAR','power',1,'p_power','astropy/units/format/generic.py',280), ('power -> CARET','power',1,'p_power','astropy/units/format/generic.py',281), ('signed_int -> SIGN UINT','signed_int',2,'p_signed_int','astropy/units/format/generic.py',287), ('signed_float -> sign UINT','signed_float',2,'p_signed_float','astropy/units/format/generic.py',293), ('signed_float -> sign UFLOAT','signed_float',2,'p_signed_float','astropy/units/format/generic.py',294), ('function_name -> SQRT','function_name',1,'p_function_name','astropy/units/format/generic.py',300), ('function -> function_name OPEN_PAREN unit_expression CLOSE_PAREN','function',4,'p_function','astropy/units/format/generic.py',306), ] astropy-0.3/astropy/units/format/cds_lextab.py0000644000175000017500000000167612243255342020026 0ustar oleole# cds_lextab.py. This file automatically created by PLY (version 3.4). Don't edit! from __future__ import absolute_import, division, print_function, unicode_literals _tabversion = '3.4' _lextokens = {'DIVISION': 1, 'PRODUCT': 1, 'SIGN': 1, 'OPEN_PAREN': 1, 'UINT': 1, 'UNIT': 1, 'X': 1, 'CLOSE_PAREN': 1, 'UFLOAT': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive'} _lexstatere = {'INITIAL': [('(?P((\\d+\\.?\\d+)|(\\.\\d+))([eE][+-]?\\d+)?)|(?P\\d+)|(?P[+-](?=\\d))|(?P[x\xd7])|(?P\\%|[a-zA-Z][a-zA-Z_]*)|(?P\\))|(?P\\()|(?P\\.)|(?P/)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_X', 'X'), ('t_UNIT', 'UNIT'), (None, 'CLOSE_PAREN'), (None, 'OPEN_PAREN'), (None, 'PRODUCT'), (None, 'DIVISION')])]} _lexstateignore = {'INITIAL': ''} _lexstateerrorf = {'INITIAL': 't_error'} astropy-0.3/astropy/units/quantity_helper.py0000644000175000017500000002477612243255342017651 0ustar oleole# The idea for this module (but no code) was borrowed from the # quantities (http://pythonhosted.org/quantities/) package. import numpy as np from .core import UnitsError, dimensionless_unscaled def _d(unit): if unit is None: return dimensionless_unscaled else: return unit UFUNC_HELPERS = {} # In this file, we implement the logic that determines for a given ufunc and # input how the input should be scaled and what unit the output will have. # list of ufuncs: # http://docs.scipy.org/doc/numpy/reference/ufuncs.html#available-ufuncs UNSUPPORTED_UFUNCS = set([np.bitwise_and, np.bitwise_or, np.bitwise_xor, np.invert, np.left_shift, np.right_shift, np.logical_and, np.logical_or, np.logical_xor, np.logical_not]) # SINGLE ARGUMENT UFUNCS # The functions below take a single argument, which is the quantity upon which # the ufunc is being used. The output of the function should be two values: the # scale by which the input needs to be multiplied before being passed to the # ufunc, and the unit the output will be in. # ufuncs that return a boolean and do not care about the unit helper_onearg_test = lambda f, unit: ([1.], None) UFUNC_HELPERS[np.isfinite] = helper_onearg_test UFUNC_HELPERS[np.isinf] = helper_onearg_test UFUNC_HELPERS[np.isnan] = helper_onearg_test UFUNC_HELPERS[np.sign] = helper_onearg_test UFUNC_HELPERS[np.signbit] = helper_onearg_test # ufuncs that return a value with the same unit as the input helper_invariant = lambda f, unit: ([1.], unit) UFUNC_HELPERS[np.absolute] = helper_invariant UFUNC_HELPERS[np.fabs] = helper_invariant UFUNC_HELPERS[np.conj] = helper_invariant UFUNC_HELPERS[np.conjugate] = helper_invariant UFUNC_HELPERS[np.negative] = helper_invariant UFUNC_HELPERS[np.spacing] = helper_invariant UFUNC_HELPERS[np.rint] = helper_invariant UFUNC_HELPERS[np.floor] = helper_invariant UFUNC_HELPERS[np.ceil] = helper_invariant UFUNC_HELPERS[np.trunc] = helper_invariant # ufuncs handled as special cases UFUNC_HELPERS[np.sqrt] = lambda f, unit: ([1.], unit ** 0.5) UFUNC_HELPERS[np.square] = lambda f, unit: ([1.], unit ** 2) UFUNC_HELPERS[np.reciprocal] = lambda f, unit: ([1.], unit ** -1) # ones_like was not private in numpy <= 1.6 if isinstance(getattr(np.core.umath, 'ones_like', None), np.ufunc): UFUNC_HELPERS[np.core.umath.ones_like] = (lambda f, unit: ([1.], dimensionless_unscaled)) if isinstance(getattr(np.core.umath, '_ones_like', None), np.ufunc): UFUNC_HELPERS[np.core.umath._ones_like] = (lambda f, unit: ([1.], dimensionless_unscaled)) # ufuncs that require dimensionless input and and give dimensionless output def helper_dimensionless_to_dimensionless(f, unit): try: scale = unit.to(dimensionless_unscaled) except UnitsError: raise TypeError("Can only apply '{0}' function to " "dimensionless quantities" .format(f.__name__)) return [scale], dimensionless_unscaled UFUNC_HELPERS[np.exp] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.expm1] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.exp2] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.log] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.log10] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.log2] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.log1p] = helper_dimensionless_to_dimensionless UFUNC_HELPERS[np.modf] = helper_dimensionless_to_dimensionless # ufuncs that require dimensionless input and give output in radians def helper_dimensionless_to_radian(f, unit): from .si import radian try: scale = unit.to(dimensionless_unscaled) except UnitsError: raise TypeError("Can only apply '{0}' function to " "dimensionless quantities" .format(f.__name__)) return [scale], radian UFUNC_HELPERS[np.arccos] = helper_dimensionless_to_radian UFUNC_HELPERS[np.arcsin] = helper_dimensionless_to_radian UFUNC_HELPERS[np.arctan] = helper_dimensionless_to_radian UFUNC_HELPERS[np.arccosh] = helper_dimensionless_to_radian UFUNC_HELPERS[np.arcsinh] = helper_dimensionless_to_radian UFUNC_HELPERS[np.arctanh] = helper_dimensionless_to_radian # ufuncs that require input in degrees and give output in radians def helper_degree_to_radian(f, unit): from .si import degree, radian try: scale = unit.to(degree) except UnitsError: raise TypeError("Can only apply '{0}' function to " "quantities with angle units" .format(f.__name__)) return [scale], radian UFUNC_HELPERS[np.radians] = helper_degree_to_radian UFUNC_HELPERS[np.deg2rad] = helper_degree_to_radian # ufuncs that require input in radians and give output in degrees def helper_radian_to_degree(f, unit): from .si import degree, radian try: scale = unit.to(radian) except UnitsError: raise TypeError("Can only apply '{0}' function to " "quantities with angle units" .format(f.__name__)) return [scale], degree UFUNC_HELPERS[np.degrees] = helper_radian_to_degree UFUNC_HELPERS[np.rad2deg] = helper_radian_to_degree # ufuncs that require input in radians and give dimensionless output def helper_radian_to_dimensionless(f, unit): from .si import radian try: scale = unit.to(radian) except UnitsError: raise TypeError("Can only apply '{0}' function to " "quantities with angle units" .format(f.__name__)) return [scale], dimensionless_unscaled UFUNC_HELPERS[np.cos] = helper_radian_to_dimensionless UFUNC_HELPERS[np.sin] = helper_radian_to_dimensionless UFUNC_HELPERS[np.tan] = helper_radian_to_dimensionless UFUNC_HELPERS[np.cosh] = helper_radian_to_dimensionless UFUNC_HELPERS[np.sinh] = helper_radian_to_dimensionless UFUNC_HELPERS[np.tanh] = helper_radian_to_dimensionless # ufuncs that require dimensionless_unscaled input and return non-quantities def helper_dimensionless_to_none(f, unit): if not unit.is_unity(): raise TypeError("Can only apply '{0}' function to " "unscaled dimensionless quantities" .format(f.__name__)) return [1.], None UFUNC_HELPERS[np.frexp] = helper_dimensionless_to_none # TWO ARGUMENT UFUNCS UFUNC_HELPERS[np.multiply] = lambda f, unit1, unit2: ( [1., 1.], _d(unit1) * _d(unit2)) helper_division = lambda f, unit1, unit2: ([1., 1.], _d(unit1) / _d(unit2)) UFUNC_HELPERS[np.divide] = helper_division UFUNC_HELPERS[np.true_divide] = helper_division UFUNC_HELPERS[np.floor_divide] = helper_division def helper_power(f, unit1, unit2): if unit2 is not None: try: scale2 = unit2.to(dimensionless_unscaled) except UnitsError: raise TypeError("Can only raise something to a " "dimensionless quantity") else: scale2 = 1. # TODO: find a better way to do this, currently # need to raise power of unit1 in main code return [1., scale2], unit1 UFUNC_HELPERS[np.power] = helper_power def helper_ldexp(f, unit1, unit2): if unit2 is not None: raise TypeError("Cannot use ldexp with a quantity " "as second argument.") else: return [1., 1.], unit1 UFUNC_HELPERS[np.ldexp] = helper_ldexp def helper_copysign(f, unit1, unit2): # if first arg is not a quantity, just return plain array if unit1 is None: return [1., 1.], None else: return [1., 1.], unit1 UFUNC_HELPERS[np.copysign] = helper_copysign def helper_two_arg_dimensionless(f, unit1, unit2): try: scale1 = unit1.to(dimensionless_unscaled) if unit1 is not None else 1. scale2 = unit2.to(dimensionless_unscaled) if unit2 is not None else 1. except UnitsError: raise TypeError("Can only apply '{0}' function to " "dimensionless quantities" .format(f.__name__)) return [scale1, scale2], dimensionless_unscaled UFUNC_HELPERS[np.logaddexp] = helper_two_arg_dimensionless UFUNC_HELPERS[np.logaddexp2] = helper_two_arg_dimensionless def find_scales(f, *units): scales = [1., 1.] # no units for any input -- e.g., np.arctan2(a1, a2, out=q) if all(unit is None for unit in units): return scales, None fixed, changeable = (1, 0) if units[1] is None else (0, 1) if units[fixed] is None: try: scales[changeable] = units[changeable].to(dimensionless_unscaled) except UnitsError: # special case: would be OK if unitless number is zero, inf, nan scales[fixed] = 0. return scales, dimensionless_unscaled else: try: scales[changeable] = units[changeable].to(units[fixed]) except UnitsError: raise UnitsError( "Can only apply '{0}' function to quantities " "with compatible dimensions" .format(f.__name__)) return scales, units[fixed] def helper_twoarg_invariant(f, unit1, unit2): return find_scales(f, unit1, unit2) UFUNC_HELPERS[np.add] = helper_twoarg_invariant UFUNC_HELPERS[np.subtract] = helper_twoarg_invariant UFUNC_HELPERS[np.hypot] = helper_twoarg_invariant UFUNC_HELPERS[np.maximum] = helper_twoarg_invariant UFUNC_HELPERS[np.minimum] = helper_twoarg_invariant UFUNC_HELPERS[np.fmin] = helper_twoarg_invariant UFUNC_HELPERS[np.fmax] = helper_twoarg_invariant UFUNC_HELPERS[np.nextafter] = helper_twoarg_invariant UFUNC_HELPERS[np.remainder] = helper_twoarg_invariant UFUNC_HELPERS[np.mod] = helper_twoarg_invariant UFUNC_HELPERS[np.fmod] = helper_twoarg_invariant def helper_twoarg_comparison(f, unit1, unit2): scales, _ = find_scales(f, unit1, unit2) return scales, None UFUNC_HELPERS[np.greater] = helper_twoarg_comparison UFUNC_HELPERS[np.greater_equal] = helper_twoarg_comparison UFUNC_HELPERS[np.less] = helper_twoarg_comparison UFUNC_HELPERS[np.less_equal] = helper_twoarg_comparison UFUNC_HELPERS[np.not_equal] = helper_twoarg_comparison UFUNC_HELPERS[np.equal] = helper_twoarg_comparison def helper_twoarg_invtrig(f, unit1, unit2): from .si import radian scales, _ = find_scales(f, unit1, unit2) return scales, radian UFUNC_HELPERS[np.arctan2] = helper_twoarg_invtrig # another private function in numpy; use getattr in case it disappears if isinstance(getattr(np.core.umath, '_arg', None), np.ufunc): UFUNC_HELPERS[np.core.umath._arg] = helper_twoarg_invtrig astropy-0.3/astropy/units/setup_package.py0000644000175000017500000000004612243255342017227 0ustar oleoledef requires_2to3(): return False astropy-0.3/astropy/units/cgs.py0000644000175000017500000000723412243255342015176 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines the CGS units. They are also available in the top-level `astropy.units` namespace. """ from __future__ import absolute_import, division, print_function, unicode_literals from ..utils.compat.fractions import Fraction from . import si from .core import UnitBase, def_unit _ns = globals() def_unit(['cm', 'centimeter'], si.cm, namespace=_ns, prefixes=False) g = si.g s = si.s C = si.C rad = si.rad sr = si.sr cd = si.cd K = si.K mol = si.mol ########################################################################## # ACCELERATION def_unit(['Gal', 'gal'], cm / s ** 2, namespace=_ns, prefixes=True, doc="Gal: CGS unit of acceleration") ########################################################################## # ENERGY # Use CGS definition of erg def_unit(['erg'], g * cm ** 2 / s ** 2, namespace=_ns, prefixes=True, doc="erg: CGS unit of energy") ########################################################################## # FORCE def_unit(['dyn', 'dyne'], g * cm / s ** 2, namespace=_ns, prefixes=True, doc="dyne: CGS unit of force") ########################################################################## # PRESSURE def_unit(['Ba', 'Barye', 'barye'], g / (cm * s ** 2), namespace=_ns, prefixes=True, doc="Barye: CGS unit of pressure") ########################################################################## # DYNAMIC VISCOSITY def_unit(['P', 'poise'], g / (cm * s), namespace=_ns, prefixes=True, doc="poise: CGS unit of dynamic viscosity") ########################################################################## # KINEMATIC VISCOSITY def_unit(['St', 'stokes'], cm ** 2 / s, namespace=_ns, prefixes=True, doc="stokes: CGS unit of kinematic viscosity") ########################################################################## # WAVENUMBER def_unit(['k', 'Kayser', 'kayser'], cm ** -1, namespace=_ns, prefixes=True, doc="kayser: CGS unit of wavenumber") ########################################################################### # ELECTRICAL def_unit(['D', 'Debye', 'debye'], Fraction(1, 3) * 1e-29 * C * si.m, namespace=_ns, doc="Debye: CGS unit of electric dipole moment") def_unit(['Fr', 'Franklin', 'statcoulomb', 'statC', 'esu'], g ** Fraction(1, 2) * cm ** Fraction(3, 2) * s ** -1, namespace=_ns, doc='Franklin: CGS (ESU) unit of charge') def_unit(['statA', 'statampere'], Fr * s ** -1, namespace=_ns, doc='statampere: CGS (ESU) unit of current') def_unit(['Bi', 'Biot', 'abA', 'abampere', 'emu'], g ** Fraction(1, 2) * cm ** Fraction(1, 2) * s ** -1, namespace=_ns, doc='Biot: CGS (EMU) unit of current') def_unit(['abC', 'abcoulomb'], Bi * s, namespace=_ns, doc='abcoulomb: CGS (EMU) of charge') ########################################################################### # MAGNETIC def_unit(['G', 'Gauss', 'gauss'], 1e-4 * si.T, namespace=_ns, prefixes=True, doc="Gauss: CGS unit for magnetic field") ########################################################################### # BASES bases = set([cm, g, s, C, rad, cd, K, mol]) ########################################################################### # CLEANUP del UnitBase del def_unit del si del Fraction ########################################################################### # DOCSTRING # This generates a docstring for this module that describes all of the # standard units defined here. from .utils import generate_unit_summary as _generate_unit_summary __doc__ += _generate_unit_summary(globals()) astropy-0.3/astropy/units/quantity.py0000644000175000017500000012166112243255342016301 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module defines the `Quantity` object, which represents a number with some associated units. `Quantity` objects support operations like ordinary numbers, but will deal with unit conversions internally. """ from __future__ import (absolute_import, unicode_literals, division, print_function) # Standard library import numbers import numpy as np # AstroPy from ..extern import six from .core import Unit, dimensionless_unscaled, UnitBase, UnitsError from ..utils import lazyproperty from ..utils.compat.misc import override__dir__ __all__ = ["Quantity"] def _can_cast(arg, dtype): """ This is needed for compatibility with Numpy < 1.6, in which ``can_cast`` can only take a dtype or type as its first argument. """ return np.can_cast(getattr(arg, 'dtype', type(arg)), dtype) _UNIT_NOT_INITIALISED = "(Unit not initialised)" def _validate_value(value, dtype, copy): """ Make sure that the input is a Python or Numpy numeric type. Parameters ---------- value : number An object that will be checked whether it is a numeric type or not. dtype : Numpy dtype or None The dtype of the resulting value. If None, the dtype of the input value is used or automatically computed. copy : bool, optional If True (default), then the value is copied. Otherwise, a copy will only be made if `__array__` returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy `dtype`. Returns ------- newval The new value either as an array or a scalar """ from ..utils.misc import isiterable if (isinstance(value, (numbers.Number, np.number, np.ndarray)) or isiterable(value)): value_obj = np.array(value, dtype=dtype, copy=copy) # It would seem reasonable to exclude object arrays here also, # but then long integers do not work. if value_obj.dtype.kind not in 'SU': return value_obj raise TypeError("The value must be a valid Python or Numpy numeric " "type.") def _can_have_arbitrary_unit(value): """Test whether the items in value can have arbitrary units Numbers whose value does not change upon a unit change, i.e., zero, infinity, or not-a-number Parameters ---------- value : number or array Returns ------- `True` if each member is either zero or not finite, `False` otherwise """ return np.all(np.logical_or(np.equal(value, 0.), ~np.isfinite(value))) class Quantity(np.ndarray): """ A `Quantity` represents a number with some associated unit. Parameters ---------- value : number, `Quantity` object, or sequence of `Quantity` objects. The numerical value of this quantity in the units given by unit. If a `Quantity` or sequence of them, creates a new `Quantity` object, converting to `unit` units as needed. unit : `~astropy.units.UnitBase` instance, str An object that represents the unit associated with the input value. Must be an `~astropy.units.UnitBase` object or a string parseable by the `units` package. dtype : ~numpy.dtype, optional The dtype of the resulting Numpy array or scalar that will hold the value. If not provided, is is determined automatically from the input value. copy : bool, optional If `True` (default), then the value is copied. Otherwise, a copy will only be made if `__array__` returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy `dtype`. (The `False` option is intended mostly for internal use, to speed up initialization where it is known a copy has been made already. Use with care.) Raises ------ TypeError If the value provided is not a Python numeric type. TypeError If the unit provided is not either a `Unit` object or a parseable string unit. """ # Need to set a class-level default for _equivalencies, or # Constants can not initialize properly _equivalencies = [] __array_priority__ = 10000 def __new__(cls, value, unit=None, dtype=None, copy=True): from ..utils.misc import isiterable if isinstance(value, Quantity): if unit is None or unit is value.unit: _value = _validate_value(value.value, dtype, copy) else: _value = _validate_value(value.to(unit).value, dtype, copy) elif isiterable(value) and all(isinstance(v, Quantity) for v in value): if unit is None: unit = value[0].unit _value = _validate_value([q.to(unit).value for q in value], dtype, copy) else: _value = _validate_value(value, dtype, copy) dtype = _value.dtype self = super(Quantity, cls).__new__(cls, _value.shape, dtype=dtype, buffer=_value.data) if unit is None: if isinstance(value, Quantity): self._unit = value.unit else: self._unit = dimensionless_unscaled else: self._unit = Unit(unit) return self def __array_finalize__(self, obj): if isinstance(obj, Quantity): self._unit = obj._unit def __array_prepare__(self, obj, context=None): # This method gets called by Numpy whenever a ufunc is called on the # array. The object passed in ``obj`` is an empty version of the # output array which we can e.g. change to an array sub-class, add # attributes to, etc. After this is called, then the ufunc is called # and the values in this empty array are set. # If no context is set, just return the input if context is None: return obj # Find out which ufunc is being used function = context[0] from .quantity_helper import UNSUPPORTED_UFUNCS, UFUNC_HELPERS # Check whether we even support this ufunc if function in UNSUPPORTED_UFUNCS: raise TypeError("Cannot use function '{0}' with quantities" .format(function.__name__)) # Now find out what arguments were passed to the ufunc, usually, this # will include at least the present object, and another, which could # be a Quantity, or a Numpy array, etc. when using two-argument ufuncs. args = context[1][:function.nin] units = [getattr(arg, 'unit', None) for arg in args] # If the ufunc is supported, then we call a helper function (defined # in quantity_helper.py) which returns the scale by which the inputs # should be multiplied before being passed to the ufunc, as well as # the unit the output from the ufunc will have. if function in UFUNC_HELPERS: scales, result_unit = UFUNC_HELPERS[function](function, *units) else: raise TypeError("Unknown ufunc {0}. Please raise issue on " "https://github.com/astropy/astropy" .format(function.__name__)) if any(scale == 0. for scale in scales): # for two-argument ufuncs with a quantity and a non-quantity, # the quantity normally needs to be dimensionless, *except* # if the non-quantity can have arbitrary unit, i.e., when it # is all zero, infinity or NaN. In that case, the non-quantity # can just have the unit of the quantity # (this allows, e.g., `q > 0.` independent of unit) maybe_arbitrary_arg = args[scales.index(0.)] if _can_have_arbitrary_unit(maybe_arbitrary_arg): scales = [1., 1.] else: raise UnitsError("Can only apply '{0}' function to " "dimensionless quantities when other " "argument is not a quantity (unless the " "latter is all zero/infinity/nan)" .format(function.__name__)) # In the case of np.power, the unit itself needs to be modified by an # amount that depends on one of the input values, so we need to treat # this as a special case. # TODO: find a better way to deal with this case if function is np.power and result_unit is not None: if not np.isscalar(args[1]): raise ValueError( "Quantities may only be raised to a scalar power") if units[1] is None: result_unit = result_unit ** args[1] else: result_unit = result_unit ** args[1].to(dimensionless_unscaled) # We now prepare the output object if self is obj: # happens if the output object is self, which happens # for in-place operations such as q1 += q2 # In some cases, the result of a ufunc should be a plain Numpy # array, which we can't do if we are doing an in-place operation. if result_unit is None: raise TypeError("Cannot store non-quantity output from {0} " "function in Quantity object" .format(function.__name__)) # If the Quantity has an integer dtype, in-place operations are # dangerous because in some cases the quantity will be e.g. # decomposed, which involves being scaled by a float, but since # the array is an integer the output then gets converted to an int # and truncated. if(any(not _can_cast(arg, obj.dtype) for arg in args) or np.any(np.array(scales, dtype=obj.dtype) != np.array(scales))): raise TypeError("Arguments cannot be cast safely to inplace " "output with dtype={0}".format(self.dtype)) result = self # no need for a view since we are returning the object itself # in principle, if self is also an argument, it could be rescaled # here, since it won't be needed anymore. But maybe not change # inputs before the calculation even if they will get destroyed else: # normal case: set up output as a Quantity result = self.__quantity_view__(obj, result_unit) # We now need to treat the case where the inputs have to be scaled - # the issue is that we can't actually scale the inputs since that # would be changing the objects passed to the ufunc, which would not # be expected by the user. if any(scale != 1. for scale in scales): # If self is both output and input (which happens for in-place # operations), input will get overwritten with junk. To avoid # that, hide it in a new object if self is obj and any(self is arg for arg in args): # but with two outputs it would become unhidden too soon # [ie., np.modf(q1, q1, other)]. Bail. if context[2] < function.nout - 1: raise TypeError("Cannot apply multi-output {0} function " "to quantities with in-place replacement " "of an input by any but the last output." .format(function.__name__)) result = self.copy() result._result = self # ensure we remember the scales we need result._scales = scales # unit output will get (setting _unit could prematurely change input) result._result_unit = result_unit return result def __array_wrap__(self, obj, context=None): if context is not None: if hasattr(obj, '_result_unit'): result_unit = obj._result_unit del obj._result_unit else: result_unit = None # We now need to re-calculate quantities for which the input # needed to be scaled. if hasattr(obj, '_scales'): scales = obj._scales del obj._scales # For in-place operations, input will get overwritten with # junk. To avoid that, we hid it in a new object in # __array_prepare__ and retrieve it here. if hasattr(obj, '_result'): obj = obj._result # take array view to which output can be written without # getting back here obj_array = obj.view(np.ndarray) # Find out which ufunc was called and with which inputs function = context[0] args = context[1][:function.nin] # Set the inputs, rescaling as necessary inputs = [] for arg, scale in zip(args, scales): if scale != 1.: inputs.append(arg.value * scale) else: # for scale==1, input is not necessarily a Quantity inputs.append(getattr(arg, 'value', arg)) # For output arrays that require scaling, we can reuse the # output array to perform the scaling in place, as long as the # array is not integral. Here, we set the obj_array to `None` # when it can not be used to store the scaled result. if(result_unit is not None and any(not _can_cast(scaled_arg, obj_array.dtype) for scaled_arg in inputs)): obj_array = None # Re-compute the output using the ufunc if function.nin == 1: if function.nout == 1: out = function(inputs[0], obj_array) else: # 2-output function (np.modf, np.frexp); 1 input if context[2] == 0: out, _ = function(inputs[0], obj_array, None) else: _, out = function(inputs[0], None, obj_array) else: out = function(inputs[0], inputs[1], obj_array) if obj_array is None: if not isinstance(out, np.ndarray): # array scalar; cannot view return self.__quantity_instance__(out, result_unit) else: obj = self.__quantity_view__(out, result_unit) if result_unit is None: # return a plain array obj = obj.view(np.ndarray) else: obj._unit = result_unit return obj def __deepcopy__(self, memo): # If we don't define this, ``copy.deepcopy(quantity)`` will # return a bare Numpy array. return self.copy() def __quantity_view__(self, obj, unit): """ Overridden by subclasses to change what kind of view is created based on the output unit of an operation. Parameters ---------- obj : ndarray The array to create a view of unit : UnitBase The unit of the resulting object. It doesn't not need to be assigned to the view, but it can be used to select a Quantity subclass. Returns ------- view : Quantity subclass """ return obj.view(Quantity) def __quantity_instance__(self, val, unit, **kwargs): """ Overridden by subclasses to impact what kind of instance is created based on the output unit of an operation. The parameters are the same as those to `Quantity.__new__`. """ return Quantity(val, unit, **kwargs) def __reduce__(self): # patch to pickle Quantity objects (ndarray subclasses), # see http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html object_state = list(np.ndarray.__reduce__(self)) subclass_state = (self._unit,) object_state[2] = (object_state[2], subclass_state) return tuple(object_state) def __setstate__(self, state): # patch to unpickle Quantity objects (ndarray subclasses), # see http://www.mail-archive.com/numpy-discussion@scipy.org/msg02446.html nd_state, own_state = state np.ndarray.__setstate__(self, nd_state) unit, = own_state self._unit = unit def to(self, unit, equivalencies=[]): """ Returns a new `Quantity` object with the specified units. Parameters ---------- unit : `~astropy.units.UnitBase` instance, str An object that represents the unit to convert to. Must be an `~astropy.units.UnitBase` object or a string parseable by the `units` package. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the units are not directly convertible. See :ref:`unit_equivalencies`. If not provided or `[]`, class default equivalencies will be used (none for `~astropy.units.Quantity`, but may be set for subclasses) If `None`, no equivalencies will be applied at all, not even any set globally or within a context. """ if equivalencies == []: equivalencies = self._equivalencies new_val = self.unit.to(unit, self.value, equivalencies=equivalencies) return self.__quantity_instance__(new_val, unit, copy=False) @property def value(self): """ The numerical value of this quantity. """ value = self.view(np.ndarray) if self.shape: return value else: return value.item() @property def unit(self): """ A `~astropy.units.UnitBase` object representing the unit of this quantity. """ return self._unit # this ensures that if we do a view, __repr__ and __str__ do not balk _unit = None @property def equivalencies(self): """ A list of equivalencies that will be applied by default during unit conversions. """ return self._equivalencies @property def si(self): """ Returns a copy of the current `Quantity` instance with SI units. The value of the resulting object will be scaled. """ si_unit = self.unit.si return self.__quantity_instance__( self.value * si_unit.scale, si_unit / si_unit.scale, copy=False) @property def cgs(self): """ Returns a copy of the current `Quantity` instance with CGS units. The value of the resulting object will be scaled. """ cgs_unit = self.unit.cgs return self.__quantity_instance__( self.value * cgs_unit.scale, cgs_unit / cgs_unit.scale, copy=False) @lazyproperty def isscalar(self): """ True if the `value` of this quantity is a scalar, or False if it is an array-like object. .. note:: This is subtly different from `numpy.isscalar` in that `numpy.isscalar` returns False for a zero-dimensional array (e.g. ``np.array(1)``), while this is True in that case. """ from ..utils.misc import isiterable return not isiterable(self.value) def copy(self): """ Return a copy of this `Quantity` instance """ return self.__class__(self) # This flag controls whether convenience conversion members, such # as `q.m` equivalent to `q.to(u.m).value` are available. This is # not turned on on Quantity itself, but is on some subclasses of # Quantity, such as `astropy.coordinates.Angle`. _include_easy_conversion_members = False @override__dir__ def __dir__(self): """ Quantities are able to directly convert to other units that have the same physical type. This function is implemented in order to make autocompletion still work correctly in IPython. """ if not self._include_easy_conversion_members: return [] extra_members = set() equivalencies = Unit._normalize_equivalencies(self.equivalencies) for equivalent in self.unit._get_units_with_same_physical_type( equivalencies): extra_members.update(equivalent.names) return extra_members def __getattr__(self, attr): """ Quantities are able to directly convert to other units that have the same physical type. """ if not self._include_easy_conversion_members: raise AttributeError( "'{0}' object has no '{1}' member".format( self.__class__.__name__, attr)) def get_virtual_unit_attribute(): try: to_unit = Unit(attr) except ValueError: return None try: return self.unit.to( to_unit, self.value, equivalencies=self.equivalencies) except UnitsError: return None value = get_virtual_unit_attribute() if value is None: raise AttributeError( "{0} instance has no attribute '{1}'".format( self.__class__.__name__, attr)) else: return value # Arithmetic operations def __mul__(self, other): """ Multiplication between `Quantity` objects and other objects.""" if isinstance(other, (UnitBase, six.string_types)): return self.__quantity_instance__(self.value, other * self.unit) return np.multiply(self, other) def __imul__(self, other): """In-place multiplication between `Quantity` objects and others.""" if isinstance(other, (UnitBase, six.string_types)): self._unit = other * self.unit return self return np.multiply(self, other, self) def __rmul__(self, other): """ Right Multiplication between `Quantity` objects and other objects. """ return self.__mul__(other) def __div__(self, other): """ Division between `Quantity` objects and other objects.""" if isinstance(other, (UnitBase, six.string_types)): return self.__quantity_instance__(self.value, self.unit / other) return np.true_divide(self, other) def __idiv__(self, other): """Inplace division between `Quantity` objects and other objects.""" if isinstance(other, (UnitBase, six.string_types)): self._unit = self.unit / other return self return np.true_divide(self, other, self) def __rdiv__(self, other): """ Right Division between `Quantity` objects and other objects.""" if isinstance(other, (UnitBase, six.string_types)): return self.__quantity_instance__(1. / self.value, other / self.unit, copy=False) return np.divide(other, self) def __truediv__(self, other): """ Division between `Quantity` objects. """ return self.__div__(other) def __itruediv__(self, other): """ Division between `Quantity` objects. """ return self.__idiv__(other) def __rtruediv__(self, other): """ Division between `Quantity` objects. """ return self.__rdiv__(other) def __divmod__(self, other): if isinstance(other, (six.string_types, UnitBase)): return (self / other, self.__quantity_instance__( 0, dimensionless_unscaled)) other_value = self._to_own_unit(other) result_tuple = super(Quantity, self.__class__).__divmod__( self.view(np.ndarray), other_value) return (self.__quantity_instance__( result_tuple[0], dimensionless_unscaled, copy=False), self.__quantity_instance__( result_tuple[1], self.unit, copy=False)) def __pos__(self): """ Plus the quantity. This is implemented in case users use +q where q is a quantity. (Required for scalar case.) """ return self.__quantity_instance__(self.value, unit=self.unit) # Comparison operations def __eq__(self, other): try: return np.equal(self, other) except Exception as exc: if isinstance(other, Quantity): raise exc return False def __ne__(self, other): try: return np.not_equal(self, other) except Exception as exc: if isinstance(other, Quantity): raise exc return True # other overrides of special functions def __hash__(self): return hash(self.value) ^ hash(self.unit) def __iter__(self): if self.isscalar: raise TypeError( "'{cls}' object with a scalar value is not iterable" .format(cls=self.__class__.__name__)) # Otherwise return a generator def quantity_iter(): for val in self.value: yield self.__quantity_instance__(val, unit=self.unit) return quantity_iter() def __getitem__(self, key): if self.isscalar: raise TypeError( "'{cls}' object with a scalar value does not support " "indexing".format(cls=self.__class__.__name__)) else: out = self.value[key] if not isinstance(out, np.ndarray): # array scalar; cannot view return self.__quantity_instance__(out, self.unit) out = self.__quantity_view__(out, self.unit) out._unit = self.unit return out def __setitem__(self, i, value): self.view(np.ndarray).__setitem__(i, self._to_own_unit(value)) def __setslice__(self, i, j, value): self.view(np.ndarray).__setslice__(i, j, self._to_own_unit(value)) # __contains__ is OK def __nonzero__(self): """Quantities should always be treated as non-False; there is too much potential for ambiguity otherwise. """ return True if six.PY3: __bool__ = __nonzero__ def __len__(self): if self.isscalar: raise TypeError("'{cls}' object with a scalar value has no " "len()".format(cls=self.__class__.__name__)) else: return len(self.value) # Numerical types def __float__(self): if not self.isscalar or not self.unit.is_unity(): raise TypeError('Only dimensionless scalar quantities can be ' 'converted to Python scalars') else: return float(self.value) def __int__(self): if not self.isscalar or not self.unit.is_unity(): raise TypeError('Only dimensionless scalar quantities can be ' 'converted to Python scalars') else: return int(self.value) def __index__(self): if self.isscalar and self.unit.is_unity(): try: return self.value.__index__() except: pass raise TypeError('Only integer dimensionless scalar quantities ' 'can be converted to a Python index') if six.PY2: def __long__(self): if not self.isscalar or not self.unit.is_unity(): raise TypeError('Only dimensionless scalar quantities can be ' 'converted to Python scalars') else: return long(self.value) # Display # TODO: we may want to add a hook for dimensionless quantities? def __str__(self): return "{0} {1:s}".format(self.value, self.unit.to_string() if self.unit is not None else _UNIT_NOT_INITIALISED) def __repr__(self): prefixstr = '<' + self.__class__.__name__ + ' ' arrstr = np.array2string(self.view(np.ndarray), separator=',', prefix=prefixstr) if self.unit is None: unitstr = _UNIT_NOT_INITIALISED else: unitstr = self.unit.to_string() return prefixstr + arrstr + ' ' + unitstr + '>' def _repr_latex_(self): """ Generate latex representation of unit name. This is used by the IPython notebook to show it all latexified. Returns ------- lstr LaTeX string """ # Format value latex_value = "{0:g}".format(self.value) if "e" in latex_value: latex_value = latex_value.replace('e', '\\times 10^{') + '}' # Format unit # [1:-1] strips the '$' on either side needed for math mode latex_unit = (self.unit._repr_latex_()[1:-1] # note this is unicode if self.unit is not None else _UNIT_NOT_INITIALISED) return '${0} \; {1}$'.format(latex_value, latex_unit) def __format__(self, format_spec): """ Format quantities using the new-style python formatting codes as specifiers for the number. If the format specifier correctly applies itself to the value, then it is used to format only the value. If it cannot be applied to the value, then it is applied to the whole string. """ try: value = format(self.value, format_spec) full_format_spec = "s" except ValueError: value = self.value full_format_spec = format_spec return format("{0} {1:s}".format(value, self.unit.to_string() if self.unit is not None else _UNIT_NOT_INITIALISED), full_format_spec) def decompose(self, bases=[]): """ Generates a new `Quantity` with the units decomposed. Decomposed units have only irreducible units in them (see `astropy.units.UnitBase.decompose`). Parameters ---------- bases : sequence of UnitBase, optional The bases to decompose into. When not provided, decomposes down to any irreducible units. When provided, the decomposed result will only contain the given units. This will raises a `UnitsError` if it's not possible to do so. Returns ------- newq : `~astropy.units.quantity.Quantity` A new object equal to this quantity with units decomposed. """ return self._decompose(False, bases=bases) def _decompose(self, allowscaledunits=False, bases=[]): """ Generates a new `Quantity` with the units decomposed. Decomposed units have only irreducible units in them (see `astropy.units.UnitBase.decompose`). Parameters ---------- allowscaledunits : bool If True, the resulting `Quantity` may have a scale factor associated with it. If False, any scaling in the unit will be subsumed into the value of the resulting `Quantity` bases : sequence of UnitBase, optional The bases to decompose into. When not provided, decomposes down to any irreducible units. When provided, the decomposed result will only contain the given units. This will raises a `UnitsError` if it's not possible to do so. Returns ------- newq : `~astropy.units.quantity.Quantity` A new object equal to this quantity with units decomposed. """ new_unit = self.unit.decompose(bases=bases) if not allowscaledunits and hasattr(new_unit, 'scale'): # Be careful here because self.value might be an array, so if the # following is changed, always be sure that the original value is # not being modified. new_value = self.value * new_unit.scale new_unit = new_unit / Unit(new_unit.scale) return self.__quantity_instance__(new_value, new_unit, copy=False) else: return self.__quantity_instance__(self.value, new_unit, copy=True) # These functions need to be overridden to take into account the units # Array conversion # http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#array-conversion def item(self, *args): return self.__quantity_instance__( self.view(np.ndarray).item(*args), self.unit) def list(self): raise NotImplementedError("cannot make a list of Quantities. Get " "list of values with q.value.list()") def _to_own_unit(self, value, check_precision=True): try: value = value.to(self.unit).value except AttributeError: try: value = dimensionless_unscaled.to(self.unit, value) except UnitsError as exc: if not _can_have_arbitrary_unit(value): raise exc if(check_precision and np.any(np.array(value, self.dtype) != np.array(value))): raise TypeError("cannot convert value type to array type without " "precision loss") return value def itemset(self, *args): if len(args) == 0: raise ValueError("itemset must have at least one argument") self.view(np.ndarray).itemset(*(args[:-1] + (self._to_own_unit(args[1]),))) def tostring(self, order='C'): raise NotImplementedError("cannot write Quantities to string. Write " "array with q.value.tostring(...).") def tofile(self, fid, sep="", format="%s"): raise NotImplementedError("cannot write Quantities to file. Write " "array with q.value.tofile(...)") def dump(self, file): raise NotImplementedError("cannot dump Quantities to file. Write " "array with q.value.dump()") def dumps(self): raise NotImplementedError("cannot dump Quantities to string. Write " "array with q.value.dumps()") # astype, byteswap OK as is # copy done above # view, getfield, setflags OK as is def fill(self, value): self.view(np.ndarray).fill(self._to_own_unit(value)) # Shape manipulation: resize cannot be done (does not own data), but # shape, transpose, swapaxes, flatten, ravel, squeeze all OK. # Item selection and manipulation # take, repeat, sort, compress, diagonal OK def put(self, indices, values, mode='raise'): self.view(np.ndarray).put(indices, self._to_own_unit(values), mode) def choose(self, choices, out=None, mode='raise'): raise NotImplementedError("cannot choose based on quantity. Choose " "using array with q.value.choose(...)") # ensure we do not return indices as quantities def argsort(self, axis=-1, kind='quicksort', order=None): return self.view(np.ndarray).argsort(axis=axis, kind=kind, order=order) def searchsorted(self, v, *args, **kwargs): return np.searchsorted(np.array(self), self._to_own_unit(v, check_precision=False), *args, **kwargs) # avoid numpy 1.6 problem # Calculation # ensure we do not return indices as quantities # conj OK def argmax(self, axis=None, out=None): return self.view(np.ndarray).argmax(axis=axis, out=out) def argmin(self, axis=None, out=None): return self.view(np.ndarray).argmin(axis=axis, out=out) def _prepare_out(self, out=None, unit=None): if out is None: return if not isinstance(out, Quantity): raise TypeError("out= should be a Quantity instance") if unit is None: out._unit = self.unit else: out._unit = unit def clip(self, a_min, a_max, out=None): self._prepare_out(out=out) value = np.clip(self.value, self._to_own_unit(a_min), self._to_own_unit(a_max), out=out) return self.__quantity_instance__(value, self.unit, copy=False) def trace(self, offset=0, axis1=0, axis2=1, dtype=None, out=None): self._prepare_out(out=out) value = np.trace(self.value, offset=offset, axis1=axis1, axis2=axis2, dtype=None, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def var(self, axis=None, dtype=None, out=None, ddof=0): result_unit = self.unit ** 2 self._prepare_out(out=out, unit=result_unit) value = np.var(self.value, axis=axis, dtype=dtype, out=out, ddof=ddof), return self.__quantity_instance__(value, result_unit, copy=False) def std(self, axis=None, dtype=None, out=None, ddof=0): self._prepare_out(out=out) value = np.std(self.value, axis=axis, dtype=dtype, out=out, ddof=ddof) return self.__quantity_instance__(value, self.unit, copy=False) def mean(self, axis=None, dtype=None, out=None): self._prepare_out(out=out) value = np.mean(self.value, axis=axis, dtype=dtype, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def ptp(self, axis=None, out=None): self._prepare_out(out=out) value = np.ptp(self.value, axis=axis, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def max(self, axis=None, out=None, keepdims=False): self._prepare_out(out=out) try: value = np.max(self.value, axis=axis, out=out, keepdims=keepdims) except: # numpy < 1.7 value = np.max(self.value, axis=axis, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def min(self, axis=None, out=None, keepdims=False): self._prepare_out(out=out) try: value = np.min(self.value, axis=axis, out=out, keepdims=keepdims) except: # numpy < 1.7 value = np.min(self.value, axis=axis, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def dot(self, b, out=None): result_unit = self.unit * getattr(b, 'unit', 1.) self._prepare_out(out=out, unit=result_unit) try: value = np.dot(self, b, out=out) except TypeError: # numpy < 1.7 value = np.dot(self, b) return self.__quantity_instance__(value, result_unit, copy=False) def diff(self, n=1, axis=-1): value = np.diff(self.value, n=n, axis=axis) return self.__quantity_instance__(value, self.unit, copy=False) def ediff1d(self, to_end=None, to_begin=None): value = np.ediff1d(self.value, to_end=to_end, to_begin=to_begin) return self.__quantity_instance__(value, self.unit, copy=False) def nansum(self, axis=None): value = np.nansum(self.value, axis=axis) return self.__quantity_instance__(value, self.unit) def sum(self, axis=None, dtype=None, out=None, keepdims=False): self._prepare_out(out=out) try: value = np.sum(self.value, axis=axis, dtype=dtype, out=out, keepdims=keepdims) except: # numpy < 1.7 value = np.sum(self.value, axis=axis, dtype=dtype, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def cumsum(self, axis=None, dtype=None, out=None): self._prepare_out(out=out) value = np.cumsum(self.value, axis=axis, dtype=dtype, out=out) return self.__quantity_instance__(value, self.unit, copy=False) def prod(self, axis=None, dtype=None, out=None, keepdims=False): if self.unit.is_unity(): self._prepare_out(out=out) try: value = np.prod(self.value, axis=axis, dtype=dtype, out=out, keepdims=keepdims) except: # numpy < 1.7 value = np.prod(self.value, axis=axis, dtype=dtype, out=out) return self.__quantity_instance__(value, self.unit, copy=False) else: raise ValueError("cannot use prod on scaled or " "non-dimensionless Quantity arrays") def cumprod(self, axis=None, dtype=None, out=None): if self.unit.is_unity(): self._prepare_out(out=out) value = np.cumprod(self.value, axis=axis, dtype=dtype, out=out) return self.__quantity_instance__(value, self.unit, copy=False) else: raise ValueError("cannot use cumprod on scaled or " "non-dimensionless Quantity arrays") def all(self, axis=None, out=None): raise NotImplementedError("cannot evaluate truth value of quantities. " "Evaluate array with q.value.all(...)") def any(self, axis=None, out=None): raise NotImplementedError("cannot evaluate truth value of quantities. " "Evaluate array with q.value.any(...)") astropy-0.3/astropy/units/equivalencies.py0000644000175000017500000003411412243255342017254 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ A set of standard astronomical equivalencies. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ..constants import si as _si from . import si from . import cgs from . import astrophys __all__ = ['parallax', 'spectral', 'spectral_density', 'doppler_radio', 'doppler_optical', 'doppler_relativistic', 'mass_energy', 'brightness_temperature', 'dimensionless_angles'] def dimensionless_angles(): """Allow angles to be equivalent to dimensionless (with 1 rad = 1 m/m = 1). It is special compared to other equivalency pairs in that it allows this independent of the power to which the angle is raised, and indepedent of whether it is part of a more complicated unit. """ return [(si.radian, None)] def parallax(): """ Returns a list of equivalence pairs that handle the conversion between parallax angle and distance. """ return [ (si.arcsecond, astrophys.parsec, lambda x: 1. / x) ] def spectral(): """ Returns a list of equivalence pairs that handle spectral wavelength, wave number, frequency, and energy equivalences. Allows conversions between wavelength units, wave number units, frequency units, and energy units as they relate to light. """ hc = _si.h.value * _si.c.value inv_m = si.m ** -1 return [ (si.m, si.Hz, lambda x: _si.c.value / x), (si.m, si.J, lambda x: hc / x), (si.m, inv_m, lambda x: 1.0 / x), (si.Hz, si.J, lambda x: _si.h.value * x, lambda x: x / _si.h.value), (si.Hz, inv_m, lambda x: x / _si.c.value, lambda x: _si.c.value * x), (si.J, inv_m, lambda x: x / hc, lambda x: hc * x) ] def spectral_density(wav, factor=None): """ Returns a list of equivalence pairs that handle spectral density with regard to wavelength and frequency. Parameters ---------- wav : Quantity Quantity associated with values being converted (e.g., wavelength or frequency). Notes ----- The ``factor`` argument is left for backward-compatibility with the syntax ``spectral_density(unit, factor)`` but users are encouraged to use ``spectral_density(factor * unit)`` instead. """ from .core import UnitBase if isinstance(wav, UnitBase): if factor is None: raise ValueError( 'If ``wav`` is specified as a unit, ``factor`` should be set') wav = factor * wav # Convert to Quantity c_Aps = _si.c.to(si.AA / si.s).value # Angstrom/s h_cgs = _si.h.cgs.value # erg * s hc = c_Aps * h_cgs fla = cgs.erg / si.angstrom / si.cm ** 2 / si.s fnu = cgs.erg / si.Hz / si.cm ** 2 / si.s nufnu = cgs.erg / si.cm ** 2 / si.s lafla = nufnu photlam = astrophys.photon / (si.cm ** 2 * si.s * si.AA) photnu = astrophys.photon / (si.cm ** 2 * si.s * si.Hz) def converter(x): return x * (wav.to(si.AA, spectral()).value ** 2 / c_Aps) def iconverter(x): return x / (wav.to(si.AA, spectral()).value ** 2 / c_Aps) def converter_fnu_nufnu(x): return x * wav.to(si.Hz, spectral()).value def iconverter_fnu_nufnu(x): return x / wav.to(si.Hz, spectral()).value def converter_fla_lafla(x): return x * wav.to(si.AA, spectral()).value def iconverter_fla_lafla(x): return x / wav.to(si.AA, spectral()).value def converter_photlam_fla(x): return hc * x / wav.to(si.AA, spectral()).value def iconverter_photlam_fla(x): return x * wav.to(si.AA, spectral()).value / hc def converter_photlam_fnu(x): return h_cgs * x * wav.to(si.AA, spectral()).value def iconverter_photlam_fnu(x): return x / (wav.to(si.AA, spectral()).value * h_cgs) def converter_photlam_photnu(x): return x * wav.to(si.AA, spectral()).value ** 2 / c_Aps def iconverter_photlam_photnu(x): return c_Aps * x / wav.to(si.AA, spectral()).value ** 2 converter_photnu_fnu = converter_photlam_fla iconverter_photnu_fnu = iconverter_photlam_fla def converter_photnu_fla(x): return x * hc * c_Aps / wav.to(si.AA, spectral()).value ** 3 def iconverter_photnu_fla(x): return x * wav.to(si.AA, spectral()).value ** 3 / (hc * c_Aps) return [ (si.AA, fnu, converter, iconverter), (fla, fnu, converter, iconverter), (si.AA, si.Hz, converter, iconverter), (fla, si.Hz, converter, iconverter), (fnu, nufnu, converter_fnu_nufnu, iconverter_fnu_nufnu), (fla, lafla, converter_fla_lafla, iconverter_fla_lafla), (photlam, fla, converter_photlam_fla, iconverter_photlam_fla), (photlam, fnu, converter_photlam_fnu, iconverter_photlam_fnu), (photlam, photnu, converter_photlam_photnu, iconverter_photlam_photnu), (photnu, fnu, converter_photnu_fnu, iconverter_photnu_fnu), (photnu, fla, converter_photnu_fla, iconverter_photnu_fla) ] def doppler_radio(rest): r""" Return the equivalency pairs for the radio convention for velocity. The radio convention for the relation between velocity and frequency is: :math:`V = c \frac{f_0 - f}{f_0} ; f(V) = f_0 ( 1 - V/c )` Parameters ---------- rest : Quantity Any quantity supported by the standard spectral equivalencies (wavelength, energy, frequency, wave number). References ---------- `NRAO site defining the conventions `_ Examples -------- >>> import astropy.units as u >>> CO_restfreq = 115.27120*u.GHz # rest frequency of 12 CO 1-0 in GHz >>> radio_CO_equiv = u.doppler_radio(CO_restfreq) >>> measured_freq = 115.2832*u.GHz >>> radio_velocity = measured_freq.to(u.km/u.s, equivalencies=radio_CO_equiv) >>> radio_velocity """ ckms = _si.c.to('km/s').value def to_vel_freq(x): restfreq = rest.to(si.Hz, equivalencies=spectral()).value return (restfreq-x) / (restfreq) * ckms def from_vel_freq(x): restfreq = rest.to(si.Hz, equivalencies=spectral()).value voverc = x/ckms return restfreq * (1-voverc) def to_vel_wav(x): restwav = rest.to(si.AA, spectral()).value return (x-restwav) / (x) * ckms def from_vel_wav(x): restwav = rest.to(si.AA, spectral()).value return restwav * ckms / (ckms-x) def to_vel_en(x): resten = rest.to(si.eV, equivalencies=spectral()).value return (resten-x) / (resten) * ckms def from_vel_en(x): resten = rest.to(si.eV, equivalencies=spectral()).value voverc = x/ckms return resten * (1-voverc) return [(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq), (si.AA, si.km/si.s, to_vel_wav, from_vel_wav), (si.eV, si.km/si.s, to_vel_en, from_vel_en), ] def doppler_optical(rest): r""" Return the equivalency pairs for the optical convention for velocity. The optical convention for the relation between velocity and frequency is: :math:`V = c \frac{f_0 - f}{f } ; f(V) = f_0 ( 1 + V/c )^{-1}` Parameters ---------- rest : Quantity Any quantity supported by the standard spectral equivalencies (wavelength, energy, frequency, wave number). References ---------- `NRAO site defining the conventions `_ Examples -------- >>> import astropy.units as u >>> CO_restfreq = 115.27120*u.GHz # rest frequency of 12 CO 1-0 in GHz >>> optical_CO_equiv = u.doppler_optical(CO_restfreq) >>> measured_freq = 115.2832*u.GHz >>> optical_velocity = measured_freq.to(u.km/u.s, equivalencies=optical_CO_equiv) >>> optical_velocity """ ckms = _si.c.to('km/s').value def to_vel_freq(x): restfreq = rest.to(si.Hz, equivalencies=spectral()).value return ckms * (restfreq-x) / x def from_vel_freq(x): restfreq = rest.to(si.Hz, equivalencies=spectral()).value voverc = x/ckms return restfreq / (1+voverc) def to_vel_wav(x): restwav = rest.to(si.AA, spectral()).value return ckms * (x/restwav-1) def from_vel_wav(x): restwav = rest.to(si.AA, spectral()).value voverc = x/ckms return restwav * (1+voverc) def to_vel_en(x): resten = rest.to(si.eV, equivalencies=spectral()).value return ckms * (resten-x) / x def from_vel_en(x): resten = rest.to(si.eV, equivalencies=spectral()).value voverc = x/ckms return resten / (1+voverc) return [(si.Hz, si.km/si.s, to_vel_freq, from_vel_freq), (si.AA, si.km/si.s, to_vel_wav, from_vel_wav), (si.eV, si.km/si.s, to_vel_en, from_vel_en), ] def doppler_relativistic(rest): r""" Return the equivalency pairs for the relativistic convention for velocity. The full relativistic convention for the relation between velocity and frequency is: :math:`V = c \frac{f_0^2 - f^2}{f_0^2 + f^2} ; f(V) = f_0 \frac{\left(1 - (V/c)^2\right)^{1/2}}{(1+V/c)}` Parameters ---------- rest : Quantity Any quantity supported by the standard spectral equivalencies (wavelength, energy, frequency, wave number). References ---------- `NRAO site defining the conventions `_ Examples -------- >>> import astropy.units as u >>> CO_restfreq = 115.27120*u.GHz # rest frequency of 12 CO 1-0 in GHz >>> relativistic_CO_equiv = u.doppler_relativistic(CO_restfreq) >>> measured_freq = 115.2832*u.GHz >>> relativistic_velocity = measured_freq.to(u.km/u.s, equivalencies=relativistic_CO_equiv) >>> relativistic_velocity >> measured_velocity = 1250 * u.km/u.s >>> relativistic_frequency = measured_velocity.to(u.GHz, equivalencies=relativistic_CO_equiv) >>> relativistic_frequency >> relativistic_wavelength = measured_velocity.to(u.mm, equivalencies=relativistic_CO_equiv) >>> relativistic_wavelength `__). :math:`T_B \equiv S_\\nu / \left(2 k \\nu^2 / c^2 \\right)` However, the beam area is essential for this computation: the brighntess temperature is inversely proportional to the beam area Parameters ---------- beam_area : Beam Area equivalent Beam area in angular units, i.e. steradian equivalent disp : `Quantity` with spectral units The observed `spectral` equivalent `Unit` (e.g., frequency or wavelength) Examples -------- Arecibo C-band beam gain ~ 7 K/Jy:: >>> import numpy as np >>> from astropy import units as u >>> beam_area = np.pi*(50*u.arcsec)**2 >>> freq = 5*u.GHz >>> u.Jy.to(u.K, equivalencies=u.brightness_temperature(beam_area,freq)) 7.052588858... >>> (1*u.Jy).to(u.K, equivalencies=u.brightness_temperature(beam_area,freq)) >> beam_area = np.pi*(15*u.arcsec)**2 >>> freq = 5*u.GHz >>> u.Jy.to(u.K, equivalencies=u.brightness_temperature(beam_area,freq)) 78.36209843... """ beam = beam_area.to(si.sr).value nu = disp.to(si.GHz, spectral()) def convert_Jy_to_K(x_jybm): factor = (2 * _si.k_B * si.K * nu**2 / _si.c**2).to(astrophys.Jy).value return (x_jybm / beam / factor) def convert_K_to_Jy(x_K): factor = (astrophys.Jy / (2 * _si.k_B * nu**2 / _si.c**2)).to(si.K).value return (x_K * beam / factor) return [(astrophys.Jy, si.K, convert_Jy_to_K, convert_K_to_Jy)] astropy-0.3/astropy/units/utils.py0000644000175000017500000000542112243255342015556 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Miscellaneous utilities for `astropy.units`. None of the functions in the module are meant for use outside of the package. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import io import re from numpy import finfo from ..extern import six _float_finfo = finfo(float) _JUST_BELOW_UNITY = 1.-_float_finfo.epsneg _JUST_ABOVE_UNITY = 1.+_float_finfo.eps def _get_first_sentence(s): """ Get the first sentence from a string and remove any carriage returns. """ x = re.match(".*?\S\.\s", s) if x is not None: s = x.group(0) return s.replace('\n', ' ') def generate_unit_summary(namespace): """ Generates a summary of units from a given namespace. This is used to generate the docstring for the modules that define the actual units. Parameters ---------- namespace : dict A namespace containing units. Returns ------- docstring : str A docstring containing a summary table of the units. """ from . import core # Get all of the units, and keep track of which ones have SI # prefixes units = [] has_prefixes = set() for key, val in list(six.iteritems(namespace)): # Skip non-unit items if not isinstance(val, core.UnitBase): continue # Skip aliases if key != val.name: continue if isinstance(val, core.PrefixUnit): decomposed = val.decompose() if len(decomposed.bases): has_prefixes.add(val.decompose().bases[0].name) else: has_prefixes.add('dimensionless') else: units.append(val) # Sort alphabetically, case insensitive units.sort(key=lambda x: x.name.lower()) docstring = io.StringIO() docstring.write(""" .. list-table:: Available Units :header-rows: 1 :widths: 10 20 20 20 1 * - Unit - Description - Represents - Aliases - SI Prefixes """) for unit in units: if unit.name in has_prefixes: unit_has_prefixes = 'Y' else: unit_has_prefixes = 'N' doc = _get_first_sentence(unit.__doc__).strip() represents = '' if isinstance(unit, core.Unit): represents = ":math:`{0}`".format( unit._represents.to_string('latex')[1:-1]) aliases = ', '.join('``{0}``'.format(x) for x in unit.aliases) docstring.write(""" * - ``{0}`` - {1} - {2} - {3} - {4} """.format(unit, doc, represents, aliases, unit_has_prefixes)) return docstring.getvalue() def is_effectively_unity(value): return _JUST_BELOW_UNITY <= value <= _JUST_ABOVE_UNITY astropy-0.3/astropy/units/imperial.py0000644000175000017500000001001212243255342016210 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This package defines colloquially used Imperial units. By default, they are not enabled. To enable them, do:: >>> from astropy.units import imperial >>> imperial.enable() # doctest: +SKIP """ from __future__ import (absolute_import, division, print_function, unicode_literals) from .core import UnitBase, def_unit from . import si _ns = globals() ########################################################################### # LENGTH def_unit(['inch'], 2.54 * si.cm, namespace=_ns, doc="International inch") def_unit(['ft', 'foot'], 12 * inch, namespace=_ns, doc="International foot") def_unit(['yd', 'yard'], 3 * ft, namespace=_ns, doc="International yard") def_unit(['mi', 'mile'], 5280 * ft, namespace=_ns, doc="International mile") def_unit(['nmi', 'nauticalmile', 'NM'], 1852 * si.m, namespace=_ns, doc="Nautical mile") ########################################################################### # AREAS def_unit(['ac', 'acre'], 43560 * ft ** 2, namespace=_ns, doc="International acre") ########################################################################### # VOLUMES def_unit(['gallon'], si.liter / 0.264172052, namespace=_ns, doc="U.S. liquid gallon") def_unit(['quart'], gallon / 4, namespace=_ns, doc="U.S. liquid quart") def_unit(['pint'], quart / 2, namespace=_ns, doc="U.S. liquid pint") def_unit(['cup'], pint / 2, namespace=_ns, doc="U.S. customary cup") def_unit(['foz', 'fluid_oz', 'fluid_ounce'], cup / 8, namespace=_ns, doc="U.S. fluid ounce") def_unit(['tbsp', 'tablespoon'], foz / 2, namespace=_ns, doc="U.S. customary tablespoon") def_unit(['tsp', 'teaspoon'], tbsp / 3, namespace=_ns, doc="U.S. customary teaspoon") ########################################################################### # MASS # Imperial measurements # well, force actually, but who uses it that way? def_unit(['oz', 'ounce'], 28.349523125 * si.g, namespace=_ns, doc="International avoirdupois ounce") def_unit(['lb', 'pound'], 16 * oz, namespace=_ns, doc="International avoirdupois pound") def_unit(['ton'], 2000 * lb, namespace=_ns, doc="International avoirdupois ton") ########################################################################### # SPEED def_unit(['kn', 'kt', 'knot', 'NMPH'], nmi / si.h, namespace=_ns, doc="nautical unit of speed: 1 nmi per hour") ########################################################################## # ENERGY def_unit(['BTU', 'btu'], 1.05505585 * si.kJ, namespace=_ns, doc="British thermal unit") def_unit(['cal', 'calorie'], 4.184 * si.J, namespace=_ns, doc="Thermochemical calorie: pre-SI metric unit of energy") def_unit(['kcal', 'Cal', 'Calorie', 'kilocal', 'kilocalorie'], 1000 * cal, namespace=_ns, doc="Calorie: colloquial definition of Calorie") ########################################################################### # POWER # Imperial units def_unit(['hp', 'horsepower'], si.W / 0.00134102209, namespace=_ns, doc="Electrical horsepower") ########################################################################### # CLEANUP del UnitBase del def_unit ########################################################################### # DOCSTRING # This generates a docstring for this module that describes all of the # standard units defined here. from .utils import generate_unit_summary as _generate_unit_summary __doc__ += _generate_unit_summary(globals()) def enable(): """ Enable Imperial units so they appear in results of `Unit.find_equivalent_units` and `Unit.compose`. This may be used with the ``with`` statement to enable Imperial units only temporarily. """ # Local import to avoid cyclical import from .core import add_enabled_units # Local import to avoid polluting namespace import inspect return add_enabled_units(inspect.getmodule(enable)) astropy-0.3/astropy/extern/0000755000175000017500000000000012243263747014215 5ustar oleoleastropy-0.3/astropy/extern/configobj_py3/0000755000175000017500000000000012243263747016750 5ustar oleoleastropy-0.3/astropy/extern/configobj_py3/__init__.py0000644000175000017500000000702212243255342021052 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is a copy of the main portions of the `configobj `_ package. This is used internally in the Astropy configuration system. The license for configobj is available in the ``licenses/CONFIGOBJ_LICENSE.rst`` file in the Astropy source distribution. This is a version of configobj that has been modified by Zubin Mithra to be compatible with python 3.x. This version is not official, but has been "blessed" by configobj's original author. This version of the code was obtained from https://bitbucket.org/zubin71/configobj-py3 For a python 2.x version, see the ``astropy/extern/configobj`` directory. """ #this holds the contents of the setup.py file used by configobj _configobj_setup_dot_py=""" # setup.py # Install script for ConfigObj # Copyright (C) 2005-2010 Michael Foord, Mark Andrews, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # mark AT la-la DOT com # nico AT tekNico DOT net # This software is licensed under the terms of the BSD license. # http://www.voidspace.org.uk/python/license.shtml import sys from distutils.core import setup from configobj import __version__ as VERSION NAME = 'configobj' MODULES = 'configobj', 'validate' DESCRIPTION = 'Config file reading, writing and validation.' URL = 'http://www.voidspace.org.uk/python/configobj.html' DOWNLOAD_URL = "http://www.voidspace.org.uk/downloads/configobj-%s.zip" % VERSION LONG_DESCRIPTION = ""#"**ConfigObj** is a simple but powerful config file reader and writer: an *ini file round tripper*. Its main feature is that it is very easy to use, with a straightforward programmer's interface and a simple syntax for config files. It has lots of other features though : * Nested sections (subsections), to any level * List values * Multiple line values * Full Unicode support * String interpolation (substitution) * Integrated with a powerful validation system - including automatic type checking/conversion - and allowing default values - repeated sections * All comments in the file are preserved * The order of keys/sections is preserved * Powerful ``unrepr`` mode for storing/retrieving Python data-types | Release 4.7.2 fixes several bugs in 4.7.1 | Release 4.7.1 fixes a bug with the deprecated options keyword in | 4.7.0. | Release 4.7.0 improves performance adds features for validation and | fixes some bugs.""#" CLASSIFIERS = [ 'Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Programming Language :: Python :: 2.3', 'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', ] AUTHOR = 'Michael Foord & Nicola Larosa' AUTHOR_EMAIL = 'fuzzyman@voidspace.org.uk' KEYWORDS = "config, ini, dictionary, application, admin, sysadmin, configuration, validation".split(', ') setup(name=NAME, version=VERSION, description=DESCRIPTION, long_description=LONG_DESCRIPTION, download_url=DOWNLOAD_URL, author=AUTHOR, author_email=AUTHOR_EMAIL, url=URL, py_modules=MODULES, classifiers=CLASSIFIERS, keywords=KEYWORDS ) """.replace('""#"','"""') #the replacement is necessary because """ would otherwise terminate the string astropy-0.3/astropy/extern/configobj_py3/validate.py0000644000175000017500000013161712243255342021114 0ustar oleole# validate.py # A Validator object # Copyright (C) 2005-2010 Michael Foord, Mark Andrews, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # mark AT la-la DOT com # nico AT tekNico DOT net # This software is licensed under the terms of the BSD license. # http://www.voidspace.org.uk/python/license.shtml # Basically you're free to copy, modify, distribute and relicense it, # So long as you keep a copy of the license with it. # Scripts maintained at http://www.voidspace.org.uk/python/index.shtml # For information about bugfixes, updates and support, please join the # ConfigObj mailing list: # http://lists.sourceforge.net/lists/listinfo/configobj-develop # Comments, suggestions and bug reports welcome. """ The Validator object is used to check that supplied values conform to a specification. The value can be supplied as a string - e.g. from a config file. In this case the check will also *convert* the value to the required type. This allows you to add validation as a transparent layer to access data stored as strings. The validation checks that the data is correct *and* converts it to the expected type. Some standard checks are provided for basic data types. Additional checks are easy to write. They can be provided when the ``Validator`` is instantiated or added afterwards. The standard functions work with the following basic data types : * integers * floats * booleans * strings * ip_addr plus lists of these datatypes Adding additional checks is done through coding simple functions. The full set of standard checks are : * 'integer': matches integer values (including negative) Takes optional 'min' and 'max' arguments : :: integer() integer(3, 9) # any value from 3 to 9 integer(min=0) # any positive value integer(max=9) * 'float': matches float values Has the same parameters as the integer check. * 'boolean': matches boolean values - ``True`` or ``False`` Acceptable string values for True are : true, on, yes, 1 Acceptable string values for False are : false, off, no, 0 Any other value raises an error. * 'ip_addr': matches an Internet Protocol address, v.4, represented by a dotted-quad string, i.e. '1.2.3.4'. * 'string': matches any string. Takes optional keyword args 'min' and 'max' to specify min and max lengths of the string. * 'list': matches any list. Takes optional keyword args 'min', and 'max' to specify min and max sizes of the list. (Always returns a list.) * 'tuple': matches any tuple. Takes optional keyword args 'min', and 'max' to specify min and max sizes of the tuple. (Always returns a tuple.) * 'int_list': Matches a list of integers. Takes the same arguments as list. * 'float_list': Matches a list of floats. Takes the same arguments as list. * 'bool_list': Matches a list of boolean values. Takes the same arguments as list. * 'ip_addr_list': Matches a list of IP addresses. Takes the same arguments as list. * 'string_list': Matches a list of strings. Takes the same arguments as list. * 'mixed_list': Matches a list with different types in specific positions. List size must match the number of arguments. Each position can be one of : 'integer', 'float', 'ip_addr', 'string', 'boolean' So to specify a list with two strings followed by two integers, you write the check as : :: mixed_list('string', 'string', 'integer', 'integer') * 'pass': This check matches everything ! It never fails and the value is unchanged. It is also the default if no check is specified. * 'option': This check matches any from a list of options. You specify this check with : :: option('option 1', 'option 2', 'option 3') You can supply a default value (returned if no value is supplied) using the default keyword argument. You specify a list argument for default using a list constructor syntax in the check : :: checkname(arg1, arg2, default=list('val 1', 'val 2', 'val 3')) A badly formatted set of arguments will raise a ``VdtParamError``. """ __version__ = '1.0.1' __all__ = ( '__version__', 'dottedQuadToNum', 'numToDottedQuad', 'ValidateError', 'VdtUnknownCheckError', 'VdtParamError', 'VdtTypeError', 'VdtValueError', 'VdtValueTooSmallError', 'VdtValueTooBigError', 'VdtValueTooShortError', 'VdtValueTooLongError', 'VdtMissingValue', 'Validator', 'is_integer', 'is_float', 'is_boolean', 'is_list', 'is_tuple', 'is_ip_addr', 'is_string', 'is_int_list', 'is_bool_list', 'is_float_list', 'is_string_list', 'is_ip_addr_list', 'is_mixed_list', 'is_option', '__docformat__', ) import re _list_arg = re.compile(r''' (?: ([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*list\( ( (?: \s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted ) \s*,\s* )* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted )? # last one ) \) ) ''', re.VERBOSE | re.DOTALL) # two groups _list_members = re.compile(r''' ( (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?) # unquoted ) (?: (?:\s*,\s*)|(?:\s*$) # comma ) ''', re.VERBOSE | re.DOTALL) # one group _paramstring = r''' (?: ( (?: [a-zA-Z_][a-zA-Z0-9_]*\s*=\s*list\( (?: \s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted ) \s*,\s* )* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted )? # last one \) )| (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?)| # unquoted (?: # keyword argument [a-zA-Z_][a-zA-Z0-9_]*\s*=\s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?) # unquoted ) ) ) ) (?: (?:\s*,\s*)|(?:\s*$) # comma ) ) ''' _matchstring = '^%s*' % _paramstring def dottedQuadToNum(ip): """ Convert decimal dotted quad string to long integer >>> int(dottedQuadToNum('1 ')) 1 >>> int(dottedQuadToNum(' 1.2')) 16777218 >>> int(dottedQuadToNum(' 1.2.3 ')) 16908291 >>> int(dottedQuadToNum('1.2.3.4')) 16909060 >>> dottedQuadToNum('255.255.255.255') 4294967295L >>> dottedQuadToNum('255.255.255.256') Traceback (most recent call last): ValueError: Not a good dotted-quad IP: 255.255.255.256 """ # import here to avoid it when ip_addr values are not used import socket, struct try: return struct.unpack('!L', socket.inet_aton(ip.strip()))[0] except socket.error: # bug in inet_aton, corrected in Python 2.4 if ip.strip() == '255.255.255.255': return 0xFFFFFFFF else: raise ValueError('Not a good dotted-quad IP: %s' % ip) return def numToDottedQuad(num): """ Convert long int to dotted quad string >>> numToDottedQuad(-1L) Traceback (most recent call last): ValueError: Not a good numeric IP: -1 >>> numToDottedQuad(1L) '0.0.0.1' >>> numToDottedQuad(16777218L) '1.0.0.2' >>> numToDottedQuad(16908291L) '1.2.0.3' >>> numToDottedQuad(16909060L) '1.2.3.4' >>> numToDottedQuad(4294967295L) '255.255.255.255' >>> numToDottedQuad(4294967296L) Traceback (most recent call last): ValueError: Not a good numeric IP: 4294967296 """ # import here to avoid it when ip_addr values are not used import socket, struct # no need to intercept here, 4294967295L is fine if num > 4294967295 or num < 0: raise ValueError('Not a good numeric IP: %s' % num) try: return socket.inet_ntoa( struct.pack('!L', int(num))) except (socket.error, struct.error, OverflowError): raise ValueError('Not a good numeric IP: %s' % num) class ValidateError(Exception): """ This error indicates that the check failed. It can be the base class for more specific errors. Any check function that fails ought to raise this error. (or a subclass) >>> raise ValidateError Traceback (most recent call last): ValidateError """ class VdtMissingValue(ValidateError): """No value was supplied to a check that needed one.""" class VdtUnknownCheckError(ValidateError): """An unknown check function was requested""" def __init__(self, value): """ >>> raise VdtUnknownCheckError('yoda') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. """ ValidateError.__init__(self, 'the check "%s" is unknown.' % (value,)) class VdtParamError(SyntaxError): """An incorrect parameter was passed""" def __init__(self, name, value): """ >>> raise VdtParamError('yoda', 'jedi') Traceback (most recent call last): VdtParamError: passed an incorrect value "jedi" for parameter "yoda". """ SyntaxError.__init__(self, 'passed an incorrect value "%s" for parameter "%s".' % (value, name)) class VdtTypeError(ValidateError): """The value supplied was of the wrong type""" def __init__(self, value): """ >>> raise VdtTypeError('jedi') Traceback (most recent call last): VdtTypeError: the value "jedi" is of the wrong type. """ ValidateError.__init__(self, 'the value "%s" is of the wrong type.' % (value,)) class VdtValueError(ValidateError): """The value supplied was of the correct type, but was not an allowed value.""" def __init__(self, value): """ >>> raise VdtValueError('jedi') Traceback (most recent call last): VdtValueError: the value "jedi" is unacceptable. """ ValidateError.__init__(self, 'the value "%s" is unacceptable.' % (value,)) class VdtValueTooSmallError(VdtValueError): """The value supplied was of the correct type, but was too small.""" def __init__(self, value): """ >>> raise VdtValueTooSmallError('0') Traceback (most recent call last): VdtValueTooSmallError: the value "0" is too small. """ ValidateError.__init__(self, 'the value "%s" is too small.' % (value,)) class VdtValueTooBigError(VdtValueError): """The value supplied was of the correct type, but was too big.""" def __init__(self, value): """ >>> raise VdtValueTooBigError('1') Traceback (most recent call last): VdtValueTooBigError: the value "1" is too big. """ ValidateError.__init__(self, 'the value "%s" is too big.' % (value,)) class VdtValueTooShortError(VdtValueError): """The value supplied was of the correct type, but was too short.""" def __init__(self, value): """ >>> raise VdtValueTooShortError('jed') Traceback (most recent call last): VdtValueTooShortError: the value "jed" is too short. """ ValidateError.__init__( self, 'the value "%s" is too short.' % (value,)) class VdtValueTooLongError(VdtValueError): """The value supplied was of the correct type, but was too long.""" def __init__(self, value): """ >>> raise VdtValueTooLongError('jedie') Traceback (most recent call last): VdtValueTooLongError: the value "jedie" is too long. """ ValidateError.__init__(self, 'the value "%s" is too long.' % (value,)) class Validator(object): """ Validator is an object that allows you to register a set of 'checks'. These checks take input and test that it conforms to the check. This can also involve converting the value from a string into the correct datatype. The ``check`` method takes an input string which configures which check is to be used and applies that check to a supplied value. An example input string would be: 'int_range(param1, param2)' You would then provide something like: >>> def int_range_check(value, min, max): ... # turn min and max from strings to integers ... min = int(min) ... max = int(max) ... # check that value is of the correct type. ... # possible valid inputs are integers or strings ... # that represent integers ... if not isinstance(value, (int, long, str)): ... raise VdtTypeError(value) ... elif isinstance(value, str): ... # if we are given a string ... # attempt to convert to an integer ... try: ... value = int(value) ... except ValueError: ... raise VdtValueError(value) ... # check the value is between our constraints ... if not min <= value: ... raise VdtValueTooSmallError(value) ... if not value <= max: ... raise VdtValueTooBigError(value) ... return value >>> fdict = {'int_range': int_range_check} >>> vtr1 = Validator(fdict) >>> vtr1.check('int_range(20, 40)', '30') 30 >>> vtr1.check('int_range(20, 40)', '60') Traceback (most recent call last): VdtValueTooBigError: the value "60" is too big. New functions can be added with : :: >>> vtr2 = Validator() >>> vtr2.functions['int_range'] = int_range_check Or by passing in a dictionary of functions when Validator is instantiated. Your functions *can* use keyword arguments, but the first argument should always be 'value'. If the function doesn't take additional arguments, the parentheses are optional in the check. It can be written with either of : :: keyword = function_name keyword = function_name() The first program to utilise Validator() was Michael Foord's ConfigObj, an alternative to ConfigParser which supports lists and can validate a config file using a config schema. For more details on using Validator with ConfigObj see: http://www.voidspace.org.uk/python/configobj.html """ # this regex does the initial parsing of the checks _func_re = re.compile(r'(.+?)\((.*)\)', re.DOTALL) # this regex takes apart keyword arguments _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.*)$', re.DOTALL) # this regex finds keyword=list(....) type values _list_arg = _list_arg # this regex takes individual values out of lists - in one pass _list_members = _list_members # These regexes check a set of arguments for validity # and then pull the members out _paramfinder = re.compile(_paramstring, re.VERBOSE | re.DOTALL) _matchfinder = re.compile(_matchstring, re.VERBOSE | re.DOTALL) def __init__(self, functions=None): """ >>> vtri = Validator() """ self.functions = { '': self._pass, 'integer': is_integer, 'float': is_float, 'boolean': is_boolean, 'ip_addr': is_ip_addr, 'string': is_string, 'list': is_list, 'tuple': is_tuple, 'int_list': is_int_list, 'float_list': is_float_list, 'bool_list': is_bool_list, 'ip_addr_list': is_ip_addr_list, 'string_list': is_string_list, 'mixed_list': is_mixed_list, 'pass': self._pass, 'option': is_option, 'force_list': force_list, } if functions is not None: self.functions.update(functions) # tekNico: for use by ConfigObj self.baseErrorClass = ValidateError self._cache = {} def check(self, check, value, missing=False): """ Usage: check(check, value) Arguments: check: string representing check to apply (including arguments) value: object to be checked Returns value, converted to correct type if necessary If the check fails, raises a ``ValidateError`` subclass. >>> vtor.check('yoda', '') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. >>> vtor.check('yoda()', '') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. >>> vtor.check('string(default="")', '', missing=True) '' """ fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check) if missing: if default is None: # no information needed here - to be handled by caller raise VdtMissingValue() value = self._handle_none(default) if value is None: return None return self._check_value(value, fun_name, fun_args, fun_kwargs) def _handle_none(self, value): if value == 'None': return None elif value in ("'None'", '"None"'): # Special case a quoted None value = self._unquote(value) return value def _parse_with_caching(self, check): if check in self._cache: fun_name, fun_args, fun_kwargs, default = self._cache[check] # We call list and dict below to work with *copies* of the data # rather than the original (which are mutable of course) fun_args = list(fun_args) fun_kwargs = dict(fun_kwargs) else: fun_name, fun_args, fun_kwargs, default = self._parse_check(check) fun_kwargs = dict([(str(key), value) for (key, value) in list(fun_kwargs.items())]) self._cache[check] = fun_name, list(fun_args), dict(fun_kwargs), default return fun_name, fun_args, fun_kwargs, default def _check_value(self, value, fun_name, fun_args, fun_kwargs): try: fun = self.functions[fun_name] except KeyError: raise VdtUnknownCheckError(fun_name) else: return fun(value, *fun_args, **fun_kwargs) def _parse_check(self, check): fun_match = self._func_re.match(check) if fun_match: fun_name = fun_match.group(1) arg_string = fun_match.group(2) arg_match = self._matchfinder.match(arg_string) if arg_match is None: # Bad syntax raise VdtParamError('Bad syntax in check "%s".' % check) fun_args = [] fun_kwargs = {} # pull out args of group 2 for arg in self._paramfinder.findall(arg_string): # args may need whitespace removing (before removing quotes) arg = arg.strip() listmatch = self._list_arg.match(arg) if listmatch: key, val = self._list_handle(listmatch) fun_kwargs[key] = val continue keymatch = self._key_arg.match(arg) if keymatch: val = keymatch.group(2) if not val in ("'None'", '"None"'): # Special case a quoted None val = self._unquote(val) fun_kwargs[keymatch.group(1)] = val continue fun_args.append(self._unquote(arg)) else: # allows for function names without (args) return check, (), {}, None # Default must be deleted if the value is specified too, # otherwise the check function will get a spurious "default" keyword arg default = fun_kwargs.pop('default', None) return fun_name, fun_args, fun_kwargs, default def _unquote(self, val): """Unquote a value if necessary.""" if (len(val) >= 2) and (val[0] in ("'", '"')) and (val[0] == val[-1]): val = val[1:-1] return val def _list_handle(self, listmatch): """Take apart a ``keyword=list('val, 'val')`` type string.""" out = [] name = listmatch.group(1) args = listmatch.group(2) for arg in self._list_members.findall(args): out.append(self._unquote(arg)) return name, out def _pass(self, value): """ Dummy check that always passes >>> vtor.check('', 0) 0 >>> vtor.check('', '0') '0' """ return value def get_default_value(self, check): """ Given a check, return the default value for the check (converted to the right type). If the check doesn't specify a default value then a ``KeyError`` will be raised. """ fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check) if default is None: raise KeyError('Check "%s" has no default value.' % check) value = self._handle_none(default) if value is None: return value return self._check_value(value, fun_name, fun_args, fun_kwargs) def _is_num_param(names, values, to_float=False): """ Return numbers from inputs or raise VdtParamError. Lets ``None`` pass through. Pass in keyword argument ``to_float=True`` to use float for the conversion rather than int. >>> _is_num_param(('', ''), (0, 1.0)) [0, 1] >>> _is_num_param(('', ''), (0, 1.0), to_float=True) [0.0, 1.0] >>> _is_num_param(('a'), ('a')) Traceback (most recent call last): VdtParamError: passed an incorrect value "a" for parameter "a". """ fun = to_float and float or int out_params = [] for (name, val) in zip(names, values): if val is None: out_params.append(val) elif isinstance(val, (int, int, float, str)): try: out_params.append(fun(val)) except ValueError as e: raise VdtParamError(name, val) else: raise VdtParamError(name, val) return out_params # built in checks # you can override these by setting the appropriate name # in Validator.functions # note: if the params are specified wrongly in your input string, # you will also raise errors. def is_integer(value, min=None, max=None): """ A check that tests that a given value is an integer (int, or long) and optionally, between bounds. A negative value is accepted, while a float will fail. If the value is a string, then the conversion is done - if possible. Otherwise a VdtError is raised. >>> vtor.check('integer', '-1') -1 >>> vtor.check('integer', '0') 0 >>> vtor.check('integer', 9) 9 >>> vtor.check('integer', 'a') Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. >>> vtor.check('integer', '2.2') Traceback (most recent call last): VdtTypeError: the value "2.2" is of the wrong type. >>> vtor.check('integer(10)', '20') 20 >>> vtor.check('integer(max=20)', '15') 15 >>> vtor.check('integer(10)', '9') Traceback (most recent call last): VdtValueTooSmallError: the value "9" is too small. >>> vtor.check('integer(10)', 9) Traceback (most recent call last): VdtValueTooSmallError: the value "9" is too small. >>> vtor.check('integer(max=20)', '35') Traceback (most recent call last): VdtValueTooBigError: the value "35" is too big. >>> vtor.check('integer(max=20)', 35) Traceback (most recent call last): VdtValueTooBigError: the value "35" is too big. >>> vtor.check('integer(0, 9)', False) 0 """ (min_val, max_val) = _is_num_param(('min', 'max'), (min, max)) if not isinstance(value, (int, int, str)): raise VdtTypeError(value) if isinstance(value, str): # if it's a string - does it represent an integer ? try: value = int(value) except ValueError: raise VdtTypeError(value) if (min_val is not None) and (value < min_val): raise VdtValueTooSmallError(value) if (max_val is not None) and (value > max_val): raise VdtValueTooBigError(value) return value def is_float(value, min=None, max=None): """ A check that tests that a given value is a float (an integer will be accepted), and optionally - that it is between bounds. If the value is a string, then the conversion is done - if possible. Otherwise a VdtError is raised. This can accept negative values. >>> vtor.check('float', '2') 2.0 From now on we multiply the value to avoid comparing decimals >>> vtor.check('float', '-6.8') * 10 -68.0 >>> vtor.check('float', '12.2') * 10 122.0 >>> vtor.check('float', 8.4) * 10 84.0 >>> vtor.check('float', 'a') Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. >>> vtor.check('float(10.1)', '10.2') * 10 102.0 >>> vtor.check('float(max=20.2)', '15.1') * 10 151.0 >>> vtor.check('float(10.0)', '9.0') Traceback (most recent call last): VdtValueTooSmallError: the value "9.0" is too small. >>> vtor.check('float(max=20.0)', '35.0') Traceback (most recent call last): VdtValueTooBigError: the value "35.0" is too big. """ (min_val, max_val) = _is_num_param( ('min', 'max'), (min, max), to_float=True) if not isinstance(value, (int, int, float, str)): raise VdtTypeError(value) if not isinstance(value, float): # if it's a string - does it represent a float ? try: value = float(value) except ValueError: raise VdtTypeError(value) if (min_val is not None) and (value < min_val): raise VdtValueTooSmallError(value) if (max_val is not None) and (value > max_val): raise VdtValueTooBigError(value) return value bool_dict = { True: True, 'on': True, '1': True, 'true': True, 'yes': True, False: False, 'off': False, '0': False, 'false': False, 'no': False, } def is_boolean(value): """ Check if the value represents a boolean. >>> vtor.check('boolean', 0) 0 >>> vtor.check('boolean', False) 0 >>> vtor.check('boolean', '0') 0 >>> vtor.check('boolean', 'off') 0 >>> vtor.check('boolean', 'false') 0 >>> vtor.check('boolean', 'no') 0 >>> vtor.check('boolean', 'nO') 0 >>> vtor.check('boolean', 'NO') 0 >>> vtor.check('boolean', 1) 1 >>> vtor.check('boolean', True) 1 >>> vtor.check('boolean', '1') 1 >>> vtor.check('boolean', 'on') 1 >>> vtor.check('boolean', 'true') 1 >>> vtor.check('boolean', 'yes') 1 >>> vtor.check('boolean', 'Yes') 1 >>> vtor.check('boolean', 'YES') 1 >>> vtor.check('boolean', '') Traceback (most recent call last): VdtTypeError: the value "" is of the wrong type. >>> vtor.check('boolean', 'up') Traceback (most recent call last): VdtTypeError: the value "up" is of the wrong type. """ if isinstance(value, str): try: return bool_dict[value.lower()] except KeyError: raise VdtTypeError(value) # we do an equality test rather than an identity test # this ensures Python 2.2 compatibilty # and allows 0 and 1 to represent True and False if value == False: return False elif value == True: return True else: raise VdtTypeError(value) def is_ip_addr(value): """ Check that the supplied value is an Internet Protocol address, v.4, represented by a dotted-quad string, i.e. '1.2.3.4'. >>> vtor.check('ip_addr', '1 ') '1' >>> vtor.check('ip_addr', ' 1.2') '1.2' >>> vtor.check('ip_addr', ' 1.2.3 ') '1.2.3' >>> vtor.check('ip_addr', '1.2.3.4') '1.2.3.4' >>> vtor.check('ip_addr', '0.0.0.0') '0.0.0.0' >>> vtor.check('ip_addr', '255.255.255.255') '255.255.255.255' >>> vtor.check('ip_addr', '255.255.255.256') Traceback (most recent call last): VdtValueError: the value "255.255.255.256" is unacceptable. >>> vtor.check('ip_addr', '1.2.3.4.5') Traceback (most recent call last): VdtValueError: the value "1.2.3.4.5" is unacceptable. >>> vtor.check('ip_addr', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. """ if not isinstance(value, str): raise VdtTypeError(value) value = value.strip() try: dottedQuadToNum(value) except ValueError: raise VdtValueError(value) return value def is_list(value, min=None, max=None): """ Check that the value is a list of values. You can optionally specify the minimum and maximum number of members. It does no check on list members. >>> vtor.check('list', ()) [] >>> vtor.check('list', []) [] >>> vtor.check('list', (1, 2)) [1, 2] >>> vtor.check('list', [1, 2]) [1, 2] >>> vtor.check('list(3)', (1, 2)) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2)" is too short. >>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6)) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2, 3, 4, 5, 6)" is too long. >>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4)) [1, 2, 3, 4] >>> vtor.check('list', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('list', '12') Traceback (most recent call last): VdtTypeError: the value "12" is of the wrong type. """ (min_len, max_len) = _is_num_param(('min', 'max'), (min, max)) if isinstance(value, str): raise VdtTypeError(value) try: num_members = len(value) except TypeError: raise VdtTypeError(value) if min_len is not None and num_members < min_len: raise VdtValueTooShortError(value) if max_len is not None and num_members > max_len: raise VdtValueTooLongError(value) return list(value) def is_tuple(value, min=None, max=None): """ Check that the value is a tuple of values. You can optionally specify the minimum and maximum number of members. It does no check on members. >>> vtor.check('tuple', ()) () >>> vtor.check('tuple', []) () >>> vtor.check('tuple', (1, 2)) (1, 2) >>> vtor.check('tuple', [1, 2]) (1, 2) >>> vtor.check('tuple(3)', (1, 2)) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2)" is too short. >>> vtor.check('tuple(max=5)', (1, 2, 3, 4, 5, 6)) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2, 3, 4, 5, 6)" is too long. >>> vtor.check('tuple(min=3, max=5)', (1, 2, 3, 4)) (1, 2, 3, 4) >>> vtor.check('tuple', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('tuple', '12') Traceback (most recent call last): VdtTypeError: the value "12" is of the wrong type. """ return tuple(is_list(value, min, max)) def is_string(value, min=None, max=None): """ Check that the supplied value is a string. You can optionally specify the minimum and maximum number of members. >>> vtor.check('string', '0') '0' >>> vtor.check('string', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('string(2)', '12') '12' >>> vtor.check('string(2)', '1') Traceback (most recent call last): VdtValueTooShortError: the value "1" is too short. >>> vtor.check('string(min=2, max=3)', '123') '123' >>> vtor.check('string(min=2, max=3)', '1234') Traceback (most recent call last): VdtValueTooLongError: the value "1234" is too long. """ if not isinstance(value, str): raise VdtTypeError(value) (min_len, max_len) = _is_num_param(('min', 'max'), (min, max)) try: num_members = len(value) except TypeError: raise VdtTypeError(value) if min_len is not None and num_members < min_len: raise VdtValueTooShortError(value) if max_len is not None and num_members > max_len: raise VdtValueTooLongError(value) return value def is_int_list(value, min=None, max=None): """ Check that the value is a list of integers. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an integer. >>> vtor.check('int_list', ()) [] >>> vtor.check('int_list', []) [] >>> vtor.check('int_list', (1, 2)) [1, 2] >>> vtor.check('int_list', [1, 2]) [1, 2] >>> vtor.check('int_list', [1, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_integer(mem) for mem in is_list(value, min, max)] def is_bool_list(value, min=None, max=None): """ Check that the value is a list of booleans. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a boolean. >>> vtor.check('bool_list', ()) [] >>> vtor.check('bool_list', []) [] >>> check_res = vtor.check('bool_list', (True, False)) >>> check_res == [True, False] 1 >>> check_res = vtor.check('bool_list', [True, False]) >>> check_res == [True, False] 1 >>> vtor.check('bool_list', [True, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_boolean(mem) for mem in is_list(value, min, max)] def is_float_list(value, min=None, max=None): """ Check that the value is a list of floats. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a float. >>> vtor.check('float_list', ()) [] >>> vtor.check('float_list', []) [] >>> vtor.check('float_list', (1, 2.0)) [1.0, 2.0] >>> vtor.check('float_list', [1, 2.0]) [1.0, 2.0] >>> vtor.check('float_list', [1, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_float(mem) for mem in is_list(value, min, max)] def is_string_list(value, min=None, max=None): """ Check that the value is a list of strings. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a string. >>> vtor.check('string_list', ()) [] >>> vtor.check('string_list', []) [] >>> vtor.check('string_list', ('a', 'b')) ['a', 'b'] >>> vtor.check('string_list', ['a', 1]) Traceback (most recent call last): VdtTypeError: the value "1" is of the wrong type. >>> vtor.check('string_list', 'hello') Traceback (most recent call last): VdtTypeError: the value "hello" is of the wrong type. """ if isinstance(value, str): raise VdtTypeError(value) return [is_string(mem) for mem in is_list(value, min, max)] def is_ip_addr_list(value, min=None, max=None): """ Check that the value is a list of IP addresses. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an IP address. >>> vtor.check('ip_addr_list', ()) [] >>> vtor.check('ip_addr_list', []) [] >>> vtor.check('ip_addr_list', ('1.2.3.4', '5.6.7.8')) ['1.2.3.4', '5.6.7.8'] >>> vtor.check('ip_addr_list', ['a']) Traceback (most recent call last): VdtValueError: the value "a" is unacceptable. """ return [is_ip_addr(mem) for mem in is_list(value, min, max)] def force_list(value, min=None, max=None): """ Check that a value is a list, coercing strings into a list with one member. Useful where users forget the trailing comma that turns a single value into a list. You can optionally specify the minimum and maximum number of members. A minumum of greater than one will fail if the user only supplies a string. >>> vtor.check('force_list', ()) [] >>> vtor.check('force_list', []) [] >>> vtor.check('force_list', 'hello') ['hello'] """ if not isinstance(value, (list, tuple)): value = [value] return is_list(value, min, max) fun_dict = { 'integer': is_integer, 'float': is_float, 'ip_addr': is_ip_addr, 'string': is_string, 'boolean': is_boolean, } def is_mixed_list(value, *args): """ Check that the value is a list. Allow specifying the type of each member. Work on lists of specific lengths. You specify each member as a positional argument specifying type Each type should be one of the following strings : 'integer', 'float', 'ip_addr', 'string', 'boolean' So you can specify a list of two strings, followed by two integers as : mixed_list('string', 'string', 'integer', 'integer') The length of the list must match the number of positional arguments you supply. >>> mix_str = "mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')" >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True)) >>> check_res == [1, 2.0, '1.2.3.4', 'a', True] 1 >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True')) >>> check_res == [1, 2.0, '1.2.3.4', 'a', True] 1 >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True)) Traceback (most recent call last): VdtTypeError: the value "b" is of the wrong type. >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a')) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2.0, '1.2.3.4', 'a')" is too short. >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b')) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2.0, '1.2.3.4', 'a', 1, 'b')" is too long. >>> vtor.check(mix_str, 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. This test requires an elaborate setup, because of a change in error string output from the interpreter between Python 2.2 and 2.3 . >>> res_seq = ( ... 'passed an incorrect value "', ... 'yoda', ... '" for parameter "mixed_list".', ... ) >>> res_str = "'".join(res_seq) >>> try: ... vtor.check('mixed_list("yoda")', ('a')) ... except VdtParamError, err: ... str(err) == res_str 1 """ try: length = len(value) except TypeError: raise VdtTypeError(value) if length < len(args): raise VdtValueTooShortError(value) elif length > len(args): raise VdtValueTooLongError(value) try: return [fun_dict[arg](val) for arg, val in zip(args, value)] except KeyError as e: raise VdtParamError('mixed_list', e) def is_option(value, *options): """ This check matches the value to any of a set of options. >>> vtor.check('option("yoda", "jedi")', 'yoda') 'yoda' >>> vtor.check('option("yoda", "jedi")', 'jed') Traceback (most recent call last): VdtValueError: the value "jed" is unacceptable. >>> vtor.check('option("yoda", "jedi")', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. """ if not isinstance(value, str): raise VdtTypeError(value) if not value in options: raise VdtValueError(value) return value def _test(value, *args, **keywargs): """ A function that exists for test purposes. >>> checks = [ ... '3, 6, min=1, max=3, test=list(a, b, c)', ... '3', ... '3, 6', ... '3,', ... 'min=1, test="a b c"', ... 'min=5, test="a, b, c"', ... 'min=1, max=3, test="a, b, c"', ... 'min=-100, test=-99', ... 'min=1, max=3', ... '3, 6, test="36"', ... '3, 6, test="a, b, c"', ... '3, max=3, test=list("a", "b", "c")', ... '''3, max=3, test=list("'a'", 'b', "x=(c)")''', ... "test='x=fish(3)'", ... ] >>> v = Validator({'test': _test}) >>> for entry in checks: ... print v.check(('test(%s)' % entry), 3) (3, ('3', '6'), {'test': ['a', 'b', 'c'], 'max': '3', 'min': '1'}) (3, ('3',), {}) (3, ('3', '6'), {}) (3, ('3',), {}) (3, (), {'test': 'a b c', 'min': '1'}) (3, (), {'test': 'a, b, c', 'min': '5'}) (3, (), {'test': 'a, b, c', 'max': '3', 'min': '1'}) (3, (), {'test': '-99', 'min': '-100'}) (3, (), {'max': '3', 'min': '1'}) (3, ('3', '6'), {'test': '36'}) (3, ('3', '6'), {'test': 'a, b, c'}) (3, ('3',), {'test': ['a', 'b', 'c'], 'max': '3'}) (3, ('3',), {'test': ["'a'", 'b', 'x=(c)'], 'max': '3'}) (3, (), {'test': 'x=fish(3)'}) >>> v = Validator() >>> v.check('integer(default=6)', '3') 3 >>> v.check('integer(default=6)', None, True) 6 >>> v.get_default_value('integer(default=6)') 6 >>> v.get_default_value('float(default=6)') 6.0 >>> v.get_default_value('pass(default=None)') >>> v.get_default_value("string(default='None')") 'None' >>> v.get_default_value('pass') Traceback (most recent call last): KeyError: 'Check "pass" has no default value.' >>> v.get_default_value('pass(default=list(1, 2, 3, 4))') ['1', '2', '3', '4'] >>> v = Validator() >>> v.check("pass(default=None)", None, True) >>> v.check("pass(default='None')", None, True) 'None' >>> v.check('pass(default="None")', None, True) 'None' >>> v.check('pass(default=list(1, 2, 3, 4))', None, True) ['1', '2', '3', '4'] Bug test for unicode arguments >>> v = Validator() >>> v.check(u'string(min=4)', u'test') u'test' >>> v = Validator() >>> v.get_default_value(u'string(min=4, default="1234")') u'1234' >>> v.check(u'string(min=4, default="1234")', u'test') u'test' >>> v = Validator() >>> default = v.get_default_value('string(default=None)') >>> default == None 1 """ return (value, args, keywargs) def _test2(): """ >>> >>> v = Validator() >>> v.get_default_value('string(default="#ff00dd")') '#ff00dd' >>> v.get_default_value('integer(default=3) # comment') 3 """ def _test3(): r""" >>> vtor.check('string(default="")', '', missing=True) '' >>> vtor.check('string(default="\n")', '', missing=True) '\n' >>> print vtor.check('string(default="\n")', '', missing=True), >>> vtor.check('string()', '\n') '\n' >>> vtor.check('string(default="\n\n\n")', '', missing=True) '\n\n\n' >>> vtor.check('string()', 'random \n text goes here\n\n') 'random \n text goes here\n\n' >>> vtor.check('string(default=" \nrandom text\ngoes \n here\n\n ")', ... '', missing=True) ' \nrandom text\ngoes \n here\n\n ' >>> vtor.check("string(default='\n\n\n')", '', missing=True) '\n\n\n' >>> vtor.check("option('\n','a','b',default='\n')", '', missing=True) '\n' >>> vtor.check("string_list()", ['foo', '\n', 'bar']) ['foo', '\n', 'bar'] >>> vtor.check("string_list(default=list('\n'))", '', missing=True) ['\n'] """ if __name__ == '__main__': # run the code tests in doctest format import sys import doctest m = sys.modules.get('__main__') globs = m.__dict__.copy() globs.update({ 'vtor': Validator(), }) doctest.testmod(m, globs=globs)astropy-0.3/astropy/extern/configobj_py3/configobj.py0000644000175000017500000025221712243255342021263 0ustar oleole# configobj.py # A config file reader/writer that supports nested sections in config files. # Copyright (C) 2005-2010 Michael Foord, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # nico AT tekNico DOT net # ConfigObj 4 # http://www.voidspace.org.uk/python/configobj.html # Released subject to the BSD License # Please see http://www.voidspace.org.uk/python/license.shtml # Scripts maintained at http://www.voidspace.org.uk/python/index.shtml # For information about bugfixes, updates and support, please join the # ConfigObj mailing list: # http://lists.sourceforge.net/lists/listinfo/configobj-develop # Comments, suggestions and bug reports welcome. import pdb import os import re import sys from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE from ast import parse # A dictionary mapping BOM to # the encoding to decode with, and what to set the # encoding attribute to. BOMS = { BOM_UTF8: ('utf_8', None), BOM_UTF16_BE: ('utf16_be', 'utf_16'), BOM_UTF16_LE: ('utf16_le', 'utf_16'), BOM_UTF16: ('utf_16', 'utf_16'), } # All legal variants of the BOM codecs. # TODO: the list of aliases is not meant to be exhaustive, is there a # better way ? BOM_LIST = { 'utf_16': 'utf_16', 'u16': 'utf_16', 'utf16': 'utf_16', 'utf-16': 'utf_16', 'utf16_be': 'utf16_be', 'utf_16_be': 'utf16_be', 'utf-16be': 'utf16_be', 'utf16_le': 'utf16_le', 'utf_16_le': 'utf16_le', 'utf-16le': 'utf16_le', 'utf_8': 'utf_8', 'u8': 'utf_8', 'utf': 'utf_8', 'utf8': 'utf_8', 'utf-8': 'utf_8', } # Map of encodings to the BOM to write. BOM_SET = { 'utf_8': BOM_UTF8, 'utf_16': BOM_UTF16, 'utf16_be': BOM_UTF16_BE, 'utf16_le': BOM_UTF16_LE, None: BOM_UTF8 } def match_utf8(encoding): return BOM_LIST.get(encoding.lower()) == 'utf_8' # Quote strings used for writing values squot = "'%s'" dquot = '"%s"' noquot = "%s" wspace_plus = ' \r\n\v\t\'"' tsquot = '"""%s"""' tdquot = "'''%s'''" # Sentinel for use in getattr calls to replace hasattr MISSING = object() __version__ = '4.7.2' try: any except NameError: def any(iterable): for entry in iterable: if entry: return True return False __all__ = ( '__version__', 'DEFAULT_INDENT_TYPE', 'DEFAULT_INTERPOLATION', 'ConfigObjError', 'NestingError', 'ParseError', 'DuplicateError', 'ConfigspecError', 'ConfigObj', 'SimpleVal', 'InterpolationError', 'InterpolationLoopError', 'MissingInterpolationOption', 'RepeatSectionError', 'ReloadError', 'UnreprError', 'UnknownType', 'flatten_errors', 'get_extra_values' ) DEFAULT_INTERPOLATION = 'configparser' DEFAULT_INDENT_TYPE = ' ' MAX_INTERPOL_DEPTH = 10 OPTION_DEFAULTS = { 'interpolation': True, 'raise_errors': False, 'list_values': True, 'create_empty': False, 'file_error': False, 'configspec': None, 'stringify': True, # option may be set to one of ('', ' ', '\t') 'indent_type': None, 'encoding': None, 'default_encoding': None, 'unrepr': False, 'write_empty_values': False, } def getObj(s): p = parse("a=" + s) obj = p.body[0].value return obj class UnknownType(Exception): pass class Builder(object): def build(self, o): m = getattr(self, 'build_' + o.__class__.__name__, None) if m is None: raise UnknownType(o.__class__.__name__) return m(o) def build_List(self, o): return map(self.build, o.elts) def build_Num(self, o): return o.n def build_Str(str, o): return o.s def build_Dict(self, o): d = {} items = zip(o.keys, o.values) for key, value in items: key = self.build(key) value = self.build(value) d[key] = value return d def build_Tuple(self, o): return tuple(self.build_List(o)) def build_Name(self, o): value = o.id if value == 'None': return None if value == 'True': return True if value == 'False': return False # An undefined Name raise UnknownType('Undefined Name') _builder = Builder() def unrepr(s): if not s: return s return _builder.build(getObj(s)) class ConfigObjError(SyntaxError): """ This is the base class for all errors that ConfigObj raises. It is a subclass of SyntaxError. """ def __init__(self, message='', line_number=None, line=''): self.line = line self.line_number = line_number SyntaxError.__init__(self, message) class NestingError(ConfigObjError): """ This error indicates a level of nesting that doesn't match. """ class ParseError(ConfigObjError): """ This error indicates that a line is badly written. It is neither a valid ``key = value`` line, nor a valid section marker line. """ class ReloadError(IOError): """ A 'reload' operation failed. This exception is a subclass of ``IOError``. """ def __init__(self): IOError.__init__(self, 'reload failed, filename is not set.') class DuplicateError(ConfigObjError): """ The keyword or section specified already exists. """ class ConfigspecError(ConfigObjError): """ An error occured whilst parsing a configspec. """ class InterpolationError(ConfigObjError): """Base class for the two interpolation errors.""" class InterpolationLoopError(InterpolationError): """Maximum interpolation depth exceeded in string interpolation.""" def __init__(self, option): InterpolationError.__init__( self, 'interpolation loop detected in value "%s".' % option) class RepeatSectionError(ConfigObjError): """ This error indicates additional sections in a section with a ``__many__`` (repeated) section. """ class MissingInterpolationOption(InterpolationError): """A value specified for interpolation was missing.""" def __init__(self, option): msg = 'missing option "%s" in interpolation.' % option InterpolationError.__init__(self, msg) class UnreprError(ConfigObjError): """An error parsing in unrepr mode.""" class InterpolationEngine(object): """ A helper class to help perform string interpolation. This class is an abstract base class; its descendants perform the actual work. """ # compiled regexp to use in self.interpolate() _KEYCRE = re.compile(r"%\(([^)]*)\)s") _cookie = '%' def __init__(self, section): # the Section instance that "owns" this engine self.section = section def interpolate(self, key, value): # short-cut if not self._cookie in value: return value def recursive_interpolate(key, value, section, backtrail): """The function that does the actual work. ``value``: the string we're trying to interpolate. ``section``: the section in which that string was found ``backtrail``: a dict to keep track of where we've been, to detect and prevent infinite recursion loops This is similar to a depth-first-search algorithm. """ # Have we been here already? if (key, section.name) in backtrail: # Yes - infinite loop detected raise InterpolationLoopError(key) # Place a marker on our backtrail so we won't come back here again backtrail[(key, section.name)] = 1 # Now start the actual work match = self._KEYCRE.search(value) while match: # The actual parsing of the match is implementation-dependent, # so delegate to our helper function k, v, s = self._parse_match(match) if k is None: # That's the signal that no further interpolation is needed replacement = v else: # Further interpolation may be needed to obtain final value replacement = recursive_interpolate(k, v, s, backtrail) # Replace the matched string with its final value start, end = match.span() value = ''.join((value[:start], replacement, value[end:])) new_search_start = start + len(replacement) # Pick up the next interpolation key, if any, for next time # through the while loop match = self._KEYCRE.search(value, new_search_start) # Now safe to come back here again; remove marker from backtrail del backtrail[(key, section.name)] return value # Back in interpolate(), all we have to do is kick off the recursive # function with appropriate starting values value = recursive_interpolate(key, value, self.section, {}) return value def _fetch(self, key): """Helper function to fetch values from owning section. Returns a 2-tuple: the value, and the section where it was found. """ # switch off interpolation before we try and fetch anything ! save_interp = self.section.main.interpolation self.section.main.interpolation = False # Start at section that "owns" this InterpolationEngine current_section = self.section while True: # try the current section first val = current_section.get(key) if val is not None and not isinstance(val, Section): break # try "DEFAULT" next val = current_section.get('DEFAULT', {}).get(key) if val is not None and not isinstance(val, Section): break # move up to parent and try again # top-level's parent is itself if current_section.parent is current_section: # reached top level, time to give up break current_section = current_section.parent # restore interpolation to previous value before returning self.section.main.interpolation = save_interp if val is None: raise MissingInterpolationOption(key) return val, current_section def _parse_match(self, match): """Implementation-dependent helper function. Will be passed a match object corresponding to the interpolation key we just found (e.g., "%(foo)s" or "$foo"). Should look up that key in the appropriate config file section (using the ``_fetch()`` helper function) and return a 3-tuple: (key, value, section) ``key`` is the name of the key we're looking for ``value`` is the value found for that key ``section`` is a reference to the section where it was found ``key`` and ``section`` should be None if no further interpolation should be performed on the resulting value (e.g., if we interpolated "$$" and returned "$"). """ raise NotImplementedError() class ConfigParserInterpolation(InterpolationEngine): """Behaves like ConfigParser.""" _cookie = '%' _KEYCRE = re.compile(r"%\(([^)]*)\)s") def _parse_match(self, match): key = match.group(1) value, section = self._fetch(key) return key, value, section class TemplateInterpolation(InterpolationEngine): """Behaves like string.Template.""" _cookie = '$' _delimiter = '$' _KEYCRE = re.compile(r""" \$(?: (?P\$) | # Two $ signs (?P[_a-z][_a-z0-9]*) | # $name format {(?P[^}]*)} # ${name} format ) """, re.IGNORECASE | re.VERBOSE) def _parse_match(self, match): # Valid name (in or out of braces): fetch value from section key = match.group('named') or match.group('braced') if key is not None: value, section = self._fetch(key) return key, value, section # Escaped delimiter (e.g., $$): return single delimiter if match.group('escaped') is not None: # Return None for key and section to indicate it's time to stop return None, self._delimiter, None # Anything else: ignore completely, just return it unchanged return None, match.group(), None interpolation_engines = { 'configparser': ConfigParserInterpolation, 'template': TemplateInterpolation, } def __newobj__(cls, *args): # Hack for pickle return cls.__new__(cls, *args) class Section(dict): """ A dictionary-like object that represents a section in a config file. It does string interpolation if the 'interpolation' attribute of the 'main' object is set to True. Interpolation is tried first from this object, then from the 'DEFAULT' section of this object, next from the parent and its 'DEFAULT' section, and so on until the main object is reached. A Section will behave like an ordered dictionary - following the order of the ``scalars`` and ``sections`` attributes. You can use this to change the order of members. Iteration follows the order: scalars, then sections. """ def __setstate__(self, state): dict.update(self, state[0]) self.__dict__.update(state[1]) def __reduce__(self): state = (dict(self), self.__dict__) return (__newobj__, (self.__class__,), state) def __init__(self, parent, depth, main, indict=None, name=None): """ * parent is the section above * depth is the depth level of this section * main is the main ConfigObj * indict is a dictionary to initialise the section with """ if indict is None: indict = {} dict.__init__(self) # used for nesting level *and* interpolation self.parent = parent # used for the interpolation attribute self.main = main # level of nesting depth of this Section self.depth = depth # purely for information self.name = name # self._initialise() # we do this explicitly so that __setitem__ is used properly # (rather than just passing to ``dict.__init__``) for entry, value in list(indict.items()): self[entry] = value def _initialise(self): # the sequence of scalar values in this Section self.scalars = [] # the sequence of sections in this Section self.sections = [] # for comments :-) self.comments = {} self.inline_comments = {} # the configspec self.configspec = None # for defaults self.defaults = [] self.default_values = {} self.extra_values = [] self._created = False def _interpolate(self, key, value): try: # do we already have an interpolation engine? engine = self._interpolation_engine except AttributeError: # not yet: first time running _interpolate(), so pick the engine name = self.main.interpolation if name == True: # note that "if name:" would be incorrect here # backwards-compatibility: interpolation=True means use default name = DEFAULT_INTERPOLATION name = name.lower() # so that "Template", "template", etc. all work class_ = interpolation_engines.get(name, None) if class_ is None: # invalid value for self.main.interpolation self.main.interpolation = False return value else: # save reference to engine so we don't have to do this again engine = self._interpolation_engine = class_(self) # let the engine do the actual work return engine.interpolate(key, value) def __getitem__(self, key): """Fetch the item and do string interpolation.""" val = dict.__getitem__(self, key) if self.main.interpolation: if isinstance(val, str): return self._interpolate(key, val) if isinstance(val, list): def _check(entry): if isinstance(entry, str): return self._interpolate(key, entry) return entry new = [_check(entry) for entry in val] if new != val: return new return val def __setitem__(self, key, value, unrepr=False): """ Correctly set a value. Making dictionary values Section instances. (We have to special case 'Section' instances - which are also dicts) Keys must be strings. Values need only be strings (or lists of strings) if ``main.stringify`` is set. ``unrepr`` must be set when setting a value to a dictionary, without creating a new sub-section. """ if not isinstance(key, str): raise ValueError('The key "%s" is not a string.' % key) # add the comment if key not in self.comments: self.comments[key] = [] self.inline_comments[key] = '' # remove the entry from defaults if key in self.defaults: self.defaults.remove(key) # if isinstance(value, Section): if key not in self: self.sections.append(key) dict.__setitem__(self, key, value) elif isinstance(value, dict) and not unrepr: # First create the new depth level, # then create the section if key not in self: self.sections.append(key) new_depth = self.depth + 1 dict.__setitem__( self, key, Section( self, new_depth, self.main, indict=value, name=key)) else: if key not in self: self.scalars.append(key) if not self.main.stringify: if isinstance(value, str): pass elif isinstance(value, (list, tuple)): for entry in value: if not isinstance(entry, str): raise TypeError('Value is not a string "%s".' % entry) else: raise TypeError('Value is not a string "%s".' % value) dict.__setitem__(self, key, value) def __delitem__(self, key): """Remove items from the sequence when deleting.""" dict. __delitem__(self, key) if key in self.scalars: self.scalars.remove(key) else: self.sections.remove(key) del self.comments[key] del self.inline_comments[key] def get(self, key, default=None): """A version of ``get`` that doesn't bypass string interpolation.""" try: return self[key] except KeyError: return default def update(self, indict): """ A version of update that uses our ``__setitem__``. """ for entry in indict: self[entry] = indict[entry] def pop(self, key, default=MISSING): """ 'D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised' """ try: val = self[key] except KeyError: if default is MISSING: raise val = default else: del self[key] return val def popitem(self): """Pops the first (key,val)""" sequence = (self.scalars + self.sections) if not sequence: raise KeyError(": 'popitem(): dictionary is empty'") key = sequence[0] val = self[key] del self[key] return key, val def clear(self): """ A version of clear that also affects scalars/sections Also clears comments and configspec. Leaves other attributes alone : depth/main/parent are not affected """ dict.clear(self) self.scalars = [] self.sections = [] self.comments = {} self.inline_comments = {} self.configspec = None self.defaults = [] self.extra_values = [] def setdefault(self, key, default=None): """A version of setdefault that sets sequence if appropriate.""" try: return self[key] except KeyError: self[key] = default return self[key] def items(self): """D.items() -> list of D's (key, value) pairs, as 2-tuples""" return list(zip((self.scalars + self.sections), list(self.values()))) def keys(self): """D.keys() -> list of D's keys""" return (self.scalars + self.sections) def values(self): """D.values() -> list of D's values""" return [self[key] for key in (self.scalars + self.sections)] def iteritems(self): """D.iteritems() -> an iterator over the (key, value) items of D""" return iter(list(self.items())) def iterkeys(self): """D.iterkeys() -> an iterator over the keys of D""" return iter((self.scalars + self.sections)) __iter__ = iterkeys def itervalues(self): """D.itervalues() -> an iterator over the values of D""" return iter(list(self.values())) def __repr__(self): """x.__repr__() <==> repr(x)""" def _getval(key): try: return self[key] except MissingInterpolationOption: return dict.__getitem__(self, key) return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) for key in (self.scalars + self.sections)]) __str__ = __repr__ __str__.__doc__ = "x.__str__() <==> str(x)" # Extra methods - not in a normal dictionary def dict(self): """ Return a deepcopy of self as a dictionary. All members that are ``Section`` instances are recursively turned to ordinary dictionaries - by calling their ``dict`` method. >>> n = a.dict() >>> n == a 1 >>> n is a 0 """ newdict = {} for entry in self: this_entry = self[entry] if isinstance(this_entry, Section): this_entry = this_entry.dict() elif isinstance(this_entry, list): # create a copy rather than a reference this_entry = list(this_entry) elif isinstance(this_entry, tuple): # create a copy rather than a reference this_entry = tuple(this_entry) newdict[entry] = this_entry return newdict def merge(self, indict): """ A recursive update - useful for merging config files. >>> a = '''[section1] ... option1 = True ... [[subsection]] ... more_options = False ... # end of file'''.splitlines() >>> b = '''# File is user.ini ... [section1] ... option1 = False ... # end of file'''.splitlines() >>> c1 = ConfigObj(b) >>> c2 = ConfigObj(a) >>> c2.merge(c1) >>> c2 ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}}) """ for key, val in list(indict.items()): if (key in self and isinstance(self[key], dict) and isinstance(val, dict)): self[key].merge(val) else: self[key] = val def rename(self, oldkey, newkey): """ Change a keyname to another, without changing position in sequence. Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode) Also renames comments. """ if oldkey in self.scalars: the_list = self.scalars elif oldkey in self.sections: the_list = self.sections else: raise KeyError('Key "%s" not found.' % oldkey) pos = the_list.index(oldkey) # val = self[oldkey] dict.__delitem__(self, oldkey) dict.__setitem__(self, newkey, val) the_list.remove(oldkey) the_list.insert(pos, newkey) comm = self.comments[oldkey] inline_comment = self.inline_comments[oldkey] del self.comments[oldkey] del self.inline_comments[oldkey] self.comments[newkey] = comm self.inline_comments[newkey] = inline_comment def walk(self, function, raise_errors=True, call_on_sections=False, **keywargs): """ Walk every member and call a function on the keyword and value. Return a dictionary of the return values If the function raises an exception, raise the errror unless ``raise_errors=False``, in which case set the return value to ``False``. Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in. Note: if ``call_on_sections`` is ``True`` then - on encountering a subsection, *first* the function is called for the *whole* subsection, and then recurses into it's members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded. See the encode and decode methods for examples, including functions. .. admonition:: caution You can use ``walk`` to transform the names of members of a section but you mustn't add or delete members. >>> config = '''[XXXXsection] ... XXXXkey = XXXXvalue'''.splitlines() >>> cfg = ConfigObj(config) >>> cfg ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) >>> def transform(section, key): ... val = section[key] ... newkey = key.replace('XXXX', 'CLIENT1') ... section.rename(key, newkey) ... if isinstance(val, (tuple, list, dict)): ... pass ... else: ... val = val.replace('XXXX', 'CLIENT1') ... section[newkey] = val >>> cfg.walk(transform, call_on_sections=True) {'CLIENT1section': {'CLIENT1key': None}} >>> cfg ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}}) """ out = {} # scalars first for i in range(len(self.scalars)): entry = self.scalars[i] try: val = function(self, entry, **keywargs) # bound again in case name has changed entry = self.scalars[i] out[entry] = val except Exception: if raise_errors: raise else: entry = self.scalars[i] out[entry] = False # then sections for i in range(len(self.sections)): entry = self.sections[i] if call_on_sections: try: function(self, entry, **keywargs) except Exception: if raise_errors: raise else: entry = self.sections[i] out[entry] = False # bound again in case name has changed entry = self.sections[i] # previous result is discarded out[entry] = self[entry].walk( function, raise_errors=raise_errors, call_on_sections=call_on_sections, **keywargs) return out def as_bool(self, key): """ Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ``True``. If the string is one of ``False``, ``Off``, ``No``, or ``0`` it returns ``False``. ``as_bool`` is not case sensitive. Any other input will raise a ``ValueError``. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_bool('a') Traceback (most recent call last): ValueError: Value "fish" is neither True nor False >>> a['b'] = 'True' >>> a.as_bool('b') 1 >>> a['b'] = 'off' >>> a.as_bool('b') 0 """ val = self[key] if val == True: return True elif val == False: return False else: try: if not isinstance(val, str): # TODO: Why do we raise a KeyError here? raise KeyError() else: return self.main._bools[val.lower()] except KeyError: raise ValueError('Value "%s" is neither True nor False' % val) def as_int(self, key): """ A convenience method which coerces the specified value to an integer. If the value is an invalid literal for ``int``, a ``ValueError`` will be raised. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_int('a') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: 'fish' >>> a['b'] = '1' >>> a.as_int('b') 1 >>> a['b'] = '3.2' >>> a.as_int('b') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: '3.2' """ return int(self[key]) def as_float(self, key): """ A convenience method which coerces the specified value to a float. If the value is an invalid literal for ``float``, a ``ValueError`` will be raised. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') 3.2000000000000002 """ return float(self[key]) def as_list(self, key): """ A convenience method which fetches the specified value, guaranteeing that it is a list. >>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1] """ result = self[key] if isinstance(result, (tuple, list)): return list(result) return [result] def restore_default(self, key): """ Restore (and return) default value for the specified key. This method will only work for a ConfigObj that was created with a configspec and has been validated. If there is no default value for this key, ``KeyError`` is raised. """ default = self.default_values[key] dict.__setitem__(self, key, default) if key not in self.defaults: self.defaults.append(key) return default def restore_defaults(self): """ Recursively restore default values to all members that have them. This method will only work for a ConfigObj that was created with a configspec and has been validated. It doesn't delete or modify entries without default values. """ for key in self.default_values: self.restore_default(key) for section in self.sections: self[section].restore_defaults() class ConfigObj(Section): """An object to read, create, and write config files.""" _keyword = re.compile(r'''^ # line start (\s*) # indentation ( # keyword (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'"=].*?) # no quotes ) \s*=\s* # divider (.*) # value (including list values and comments) $ # line end ''', re.VERBOSE) _sectionmarker = re.compile(r'''^ (\s*) # 1: indentation ((?:\[\s*)+) # 2: section marker open ( # 3: section name open (?:"\s*\S.*?\s*")| # at least one non-space with double quotes (?:'\s*\S.*?\s*')| # at least one non-space with single quotes (?:[^'"\s].*?) # at least one non-space unquoted ) # section name close ((?:\s*\])+) # 4: section marker close \s*(\#.*)? # 5: optional comment $''', re.VERBOSE) # this regexp pulls list values out as a single string # or single values and comments # FIXME: this regex adds a '' to the end of comma terminated lists # workaround in ``_handle_value`` _valueexp = re.compile(r'''^ (?: (?: ( (?: (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\#][^,\#]*?) # unquoted ) \s*,\s* # comma )* # match all list items ending in a comma (if any) ) ( (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\#\s][^,]*?)| # unquoted (?:(? 1: msg = "Parsing failed with several errors.\nFirst error %s" % info error = ConfigObjError(msg) else: error = self._errors[0] # set the errors attribute; it's a list of tuples: # (error_type, message, line_number) error.errors = self._errors # set the config attribute error.config = self raise error # delete private attributes del self._errors if configspec is None: self.configspec = None else: self._handle_configspec(configspec) def _initialise(self, options=None): if options is None: options = OPTION_DEFAULTS # initialise a few variables self.filename = None self._errors = [] self.raise_errors = options['raise_errors'] self.interpolation = options['interpolation'] self.list_values = options['list_values'] self.create_empty = options['create_empty'] self.file_error = options['file_error'] self.stringify = options['stringify'] self.indent_type = options['indent_type'] self.encoding = options['encoding'] self.default_encoding = options['default_encoding'] self.BOM = False self.newlines = None self.write_empty_values = options['write_empty_values'] self.unrepr = options['unrepr'] self.initial_comment = [] self.final_comment = [] self.configspec = None if self._inspec: self.list_values = False # Clear section attributes as well Section._initialise(self) def __repr__(self): def _getval(key): try: return self[key] except MissingInterpolationOption: return dict.__getitem__(self, key) return ('ConfigObj({%s})' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) for key in (self.scalars + self.sections)])) def _handle_bom(self, infile): """ Handle any BOM, and decode if necessary. If an encoding is specified, that *must* be used - but the BOM should still be removed (and the BOM attribute set). (If the encoding is wrongly specified, then a BOM for an alternative encoding won't be discovered or removed.) If an encoding is not specified, UTF8 or UTF16 BOM will be detected and removed. The BOM attribute will be set. UTF16 will be decoded to unicode. NOTE: This method must not be called with an empty ``infile``. Specifying the *wrong* encoding is likely to cause a ``UnicodeDecodeError``. ``infile`` must always be returned as a list of lines, but may be passed in as a single string. """ if ((self.encoding is not None) and (self.encoding.lower() not in BOM_LIST)): # No need to check for a BOM # the encoding specified doesn't have one # just decode return self._decode(infile, self.encoding) if isinstance(infile, (list, tuple)): line = infile[0] else: line = infile if self.encoding is not None: # encoding explicitly supplied # And it could have an associated BOM # TODO: if encoding is just UTF16 - we ought to check for both # TODO: big endian and little endian versions. enc = BOM_LIST[self.encoding.lower()] if enc == 'utf_16': # For UTF16 we try big endian and little endian for BOM, (encoding, final_encoding) in list(BOMS.items()): if not final_encoding: # skip UTF8 continue if isinstance(infile, bytes) and infile.startswith(BOM): ### BOM discovered ##self.BOM = True # Don't need to remove BOM return self._decode(infile, encoding) # If we get this far, will *probably* raise a DecodeError # As it doesn't appear to start with a BOM return self._decode(infile, self.encoding) # Must be UTF8 BOM = BOM_SET[enc] if isinstance(line, bytes) and not line.startswith(BOM): return self._decode(infile, self.encoding) newline = line[len(BOM):] # BOM removed if isinstance(infile, (list, tuple)): infile[0] = newline else: infile = newline self.BOM = True return self._decode(infile, self.encoding) # No encoding specified - so we need to check for UTF8/UTF16 for BOM, (encoding, final_encoding) in list(BOMS.items()): if isinstance(line, bytes) and not line.startswith(BOM): continue else: # BOM discovered # self.encoding = final_encoding if not final_encoding: self.BOM = True # UTF8 # remove BOM newline = line[len(BOM):] if isinstance(infile, (list, tuple)): infile[0] = newline else: infile = newline # UTF8 - don't decode if isinstance(infile, str): return infile.splitlines(True) else: return infile infile = self._decode(infile, encoding) if isinstance(infile, str): # infile read from a file will be a single string return infile.splitlines(True) return self._decode(infile, encoding) # UTF16 - have to decode # No BOM discovered and no encoding specified, just return if isinstance(infile, str): # infile read from a file will be a single string return infile.splitlines(True) if isinstance(infile, bytes): return self._decode(infile, self.encoding) return infile def _decode(self, infile, encoding): """ Decode infile to unicode. Using the specified encoding. if is a string, it also needs converting to a list. """ encoding = encoding or 'utf-8' # If `infile` is a Unicode string, return as such if isinstance(infile, str): return infile # If `infile` is bytes type; decode and split if isinstance(infile, bytes): return infile.decode(encoding).splitlines(True) # If `infile` is a mix of bytes and unicode strings for i, line in enumerate(infile): if isinstance(line, bytes): infile[i] = line.decode(encoding) return infile def _decode_element(self, line): """Decode element to unicode if necessary.""" if not self.encoding: return line if isinstance(line, bytes) and self.default_encoding: return line.decode(self.default_encoding) return line def _str(self, value): """ Used by ``stringify`` within validate, to turn non-string values into strings. """ # Bytes type string should NOT be stringified at any cost. if isinstance(value, bytes): return value if not isinstance(value, str): return str(value) else: return value def _parse(self, infile): """Actually parse the config file.""" temp_list_values = self.list_values if self.unrepr: self.list_values = False comment_list = [] done_start = False this_section = self maxline = len(infile) - 1 cur_index = -1 reset_comment = False while cur_index < maxline: if reset_comment: comment_list = [] cur_index += 1 line = infile[cur_index] sline = line.strip() # do we have anything on the line ? if not sline or sline.startswith('#'): reset_comment = False comment_list.append(line) continue if not done_start: # preserve initial comment self.initial_comment = comment_list comment_list = [] done_start = True reset_comment = True # first we check if it's a section marker mat = self._sectionmarker.match(line) if mat is not None: # is a section line (indent, sect_open, sect_name, sect_close, comment) = mat.groups() if indent and (self.indent_type is None): self.indent_type = indent cur_depth = sect_open.count('[') if cur_depth != sect_close.count(']'): self._handle_error("Cannot compute the section depth at line %s.", NestingError, infile, cur_index) continue if cur_depth < this_section.depth: # the new section is dropping back to a previous level try: parent = self._match_depth(this_section, cur_depth).parent except SyntaxError: self._handle_error("Cannot compute nesting level at line %s.", NestingError, infile, cur_index) continue elif cur_depth == this_section.depth: # the new section is a sibling of the current section parent = this_section.parent elif cur_depth == this_section.depth + 1: # the new section is a child the current section parent = this_section else: self._handle_error("Section too nested at line %s.", NestingError, infile, cur_index) sect_name = self._unquote(sect_name) if sect_name in parent: self._handle_error('Duplicate section name at line %s.', DuplicateError, infile, cur_index) continue # create the new section this_section = Section( parent, cur_depth, self, name=sect_name) parent[sect_name] = this_section parent.inline_comments[sect_name] = comment parent.comments[sect_name] = comment_list continue # # it's not a section marker, # so it should be a valid ``key = value`` line mat = self._keyword.match(line) if mat is None: # it neither matched as a keyword # or a section marker self._handle_error( 'Invalid line at line "%s".', ParseError, infile, cur_index) else: # is a keyword value # value will include any inline comment (indent, key, value) = mat.groups() if indent and (self.indent_type is None): self.indent_type = indent # check for a multiline value if value[:3] in ['"""', "'''"]: try: value, comment, cur_index = self._multiline( value, infile, cur_index, maxline) except SyntaxError: self._handle_error( 'Parse error in value at line %s.', ParseError, infile, cur_index) continue else: if self.unrepr: comment = '' try: value = unrepr(value) except Exception as e: if type(e) == UnknownType: msg = 'Unknown name or type in value at line %s.' else: msg = 'Parse error in value at line %s.' self._handle_error(msg, UnreprError, infile, cur_index) continue else: if self.unrepr: comment = '' try: value = unrepr(value) except Exception as e: if isinstance(e, UnknownType): msg = 'Unknown name or type in value at line %s.' else: msg = 'Parse error in value at line %s.' self._handle_error(msg, UnreprError, infile, cur_index) continue else: # extract comment and lists try: (value, comment) = self._handle_value(value) except SyntaxError: self._handle_error( 'Parse error in value at line %s.', ParseError, infile, cur_index) continue # key = self._unquote(key) if key in this_section: self._handle_error( 'Duplicate keyword name at line %s.', DuplicateError, infile, cur_index) continue # add the key. # we set unrepr because if we have got this far we will never # be creating a new section this_section.__setitem__(key, value, unrepr=True) this_section.inline_comments[key] = comment this_section.comments[key] = comment_list continue # if self.indent_type is None: # no indentation used, set the type accordingly self.indent_type = '' # preserve the final comment if not self and not self.initial_comment: self.initial_comment = comment_list elif not reset_comment: self.final_comment = comment_list self.list_values = temp_list_values def _match_depth(self, sect, depth): """ Given a section and a depth level, walk back through the sections parents to see if the depth level matches a previous section. Return a reference to the right section, or raise a SyntaxError. """ while depth < sect.depth: if sect is sect.parent: # we've reached the top level already raise SyntaxError() sect = sect.parent if sect.depth == depth: return sect # shouldn't get here raise SyntaxError() def _handle_error(self, text, ErrorClass, infile, cur_index): """ Handle an error according to the error settings. Either raise the error or store it. The error will have occured at ``cur_index`` """ line = infile[cur_index] cur_index += 1 message = text % cur_index error = ErrorClass(message, cur_index, line) if self.raise_errors: # raise the error - parsing stops here raise error # store the error # reraise when parsing has finished self._errors.append(error) def _unquote(self, value): """Return an unquoted version of a value""" if not value: # should only happen during parsing of lists raise SyntaxError if (value[0] == value[-1]) and (value[0] in ('"', "'")): value = value[1:-1] return value def _quote(self, value, multiline=True): """ Return a safely quoted version of a value. Raise a ConfigObjError if the value cannot be safely quoted. If multiline is ``True`` (default) then use triple quotes if necessary. * Don't quote values that don't need it. * Recursively quote members of a list and return a comma joined list. * Multiline is ``False`` for lists. * Obey list syntax for empty and single member lists. If ``list_values=False`` then the value is only quoted if it contains a ``\\n`` (is multiline) or '#'. If ``write_empty_values`` is set, and the value is an empty string, it won't be quoted. """ if multiline and self.write_empty_values and value == '': # Only if multiline is set, so that it is used for values not # keys, and not values that are part of a list return '' if multiline and isinstance(value, (list, tuple)): if not value: return ',' elif len(value) == 1: return self._quote(value[0], multiline=False) + ',' return ', '.join([self._quote(val, multiline=False) for val in value]) if not isinstance(value, str): if self.stringify and not isinstance(value, bytes): value = str(value) else: raise TypeError('Value "%s" is not a string.' % value) if not value: return '""' no_lists_no_quotes = not self.list_values and '\n' not in value and '#' not in value need_triple = multiline and ((("'" in value) and ('"' in value)) or ('\n' in value )) hash_triple_quote = multiline and not need_triple and ("'" in value) and ('"' in value) and ('#' in value) check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote if check_for_single: if not self.list_values: # we don't quote if ``list_values=False`` quot = noquot # for normal values either single or double quotes will do elif '\n' in value: # will only happen if multiline is off - e.g. '\n' in key raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) elif ((value[0] not in wspace_plus) and (value[-1] not in wspace_plus) and (',' not in value)): quot = noquot else: quot = self._get_single_quote(value) else: # if value has '\n' or "'" *and* '"', it will need triple quotes quot = self._get_triple_quote(value) if quot == noquot and '#' in value and self.list_values: quot = self._get_single_quote(value) return quot % value def _get_single_quote(self, value): if ("'" in value) and ('"' in value): raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) elif '"' in value: quot = squot else: quot = dquot return quot def _get_triple_quote(self, value): if (value.find('"""') != -1) and (value.find("'''") != -1): raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) if value.find('"""') == -1: quot = tdquot else: quot = tsquot return quot def _handle_value(self, value): """ Given a value string, unquote, remove comment, handle lists. (including empty and single member lists) """ if self._inspec: # Parsing a configspec so don't handle comments return (value, '') # do we look for lists in values ? if not self.list_values: mat = self._nolistvalue.match(value) if mat is None: raise SyntaxError() # NOTE: we don't unquote here return mat.groups() # mat = self._valueexp.match(value) if mat is None: # the value is badly constructed, probably badly quoted, # or an invalid list raise SyntaxError() (list_values, single, empty_list, comment) = mat.groups() if (list_values == '') and (single is None): # change this if you want to accept empty values raise SyntaxError() # NOTE: note there is no error handling from here if the regex # is wrong: then incorrect values will slip through if empty_list is not None: # the single comma - meaning an empty list return ([], comment) if single is not None: # handle empty values if list_values and not single: # FIXME: the '' is a workaround because our regex now matches # '' at the end of a list if it has a trailing comma single = None else: single = single or '""' single = self._unquote(single) if list_values == '': # not a list value return (single, comment) the_list = self._listvalueexp.findall(list_values) the_list = [self._unquote(val) for val in the_list] if single is not None: the_list += [single] return (the_list, comment) def _multiline(self, value, infile, cur_index, maxline): """Extract the value, where we are in a multiline situation.""" quot = value[:3] newvalue = value[3:] single_line = self._triple_quote[quot][0] multi_line = self._triple_quote[quot][1] mat = single_line.match(value) if mat is not None: retval = list(mat.groups()) retval.append(cur_index) return retval elif newvalue.find(quot) != -1: # somehow the triple quote is missing raise SyntaxError() # while cur_index < maxline: cur_index += 1 newvalue += '\n' line = infile[cur_index] if line.find(quot) == -1: newvalue += line else: # end of multiline, process it break else: # we've got to the end of the config, oops... raise SyntaxError() mat = multi_line.match(line) if mat is None: # a badly formed line raise SyntaxError() (value, comment) = mat.groups() return (newvalue + value, comment, cur_index) def _handle_configspec(self, configspec): """Parse the configspec.""" # FIXME: Should we check that the configspec was created with the # correct settings ? (i.e. ``list_values=False``) if not isinstance(configspec, ConfigObj): try: configspec = ConfigObj(configspec, raise_errors=True, file_error=True, _inspec=True) except ConfigObjError as e: # FIXME: Should these errors have a reference # to the already parsed ConfigObj ? raise ConfigspecError('Parsing configspec failed: %s' % e) except IOError as e: raise IOError('Reading configspec failed: %s' % e) self.configspec = configspec def _set_configspec(self, section, copy): """ Called by validate. Handles setting the configspec on subsections including sections to be validated by __many__ """ configspec = section.configspec many = configspec.get('__many__') if isinstance(many, dict): for entry in section.sections: if entry not in configspec: section[entry].configspec = many for entry in configspec.sections: if entry == '__many__': continue if entry not in section: section[entry] = {} section[entry]._created = True if copy: # copy comments section.comments[entry] = configspec.comments.get(entry, []) section.inline_comments[entry] = configspec.inline_comments.get(entry, '') # Could be a scalar when we expect a section if isinstance(section[entry], Section): section[entry].configspec = configspec[entry] def _write_line(self, indent_string, entry, this_entry, comment): """Write an individual line, for the write method""" # NOTE: the calls to self._quote here handles non-StringType values. if not self.unrepr: val = self._decode_element(self._quote(this_entry)) else: val = repr(this_entry) return '%s%s%s%s%s' % (indent_string, self._decode_element(self._quote(entry, multiline=False)), ' = ', val, self._decode_element(comment)) def _write_marker(self, indent_string, depth, entry, comment): """Write a section marker line""" return '%s%s%s%s%s' % (indent_string, '[' * depth, self._quote(self._decode_element(entry), multiline=False), ']' * depth, self._decode_element(comment)) def _handle_comment(self, comment): """Deal with a comment.""" if not comment: return '' start = self.indent_type if not comment.startswith('#'): start += ' # ' return (start + comment) # Public methods def write(self, outfile=None, section=None): """ Write the current ConfigObj as a file tekNico: FIXME: use StringIO instead of real files >>> filename = a.filename >>> a.filename = 'test.ini' >>> a.write() >>> a.filename = filename >>> a == ConfigObj('test.ini', raise_errors=True) 1 >>> import os >>> os.remove('test.ini') """ if self.indent_type is None: # this can be true if initialised from a dictionary self.indent_type = DEFAULT_INDENT_TYPE out = [] cs = '#' csp = '# ' if section is None: int_val = self.interpolation self.interpolation = False section = self for line in self.initial_comment: line = self._decode_element(line) stripped_line = line.strip() if stripped_line and not stripped_line.startswith(cs): line = csp + line out.append(line) indent_string = self.indent_type * section.depth for entry in (section.scalars + section.sections): if entry in section.defaults: # don't write out default values continue for comment_line in section.comments[entry]: comment_line = self._decode_element(comment_line.lstrip()) if comment_line and not comment_line.startswith(cs): comment_line = csp + comment_line out.append(indent_string + comment_line) this_entry = section[entry] comment = self._handle_comment(section.inline_comments[entry]) if isinstance(this_entry, dict): # a section out.append(self._write_marker( indent_string, this_entry.depth, entry, comment)) out.extend(self.write(section=this_entry)) else: out.append(self._write_line( indent_string, entry, this_entry, comment)) if section is self: for line in self.final_comment: line = self._decode_element(line) stripped_line = line.strip() if stripped_line and not stripped_line.startswith(cs): line = csp + line out.append(line) self.interpolation = int_val if section is not self: return out if (self.filename is None) and (outfile is None): # output a list of lines # might need to encode # NOTE: This will *screw* UTF16, each line will start with the BOM if self.encoding: out = [l.encode(self.encoding) for l in out] if (self.BOM and ((self.encoding is None) or (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))): # Add the UTF8 BOM if not out: out.append('') out[0] = BOM_UTF8 + out[0] return out # Turn the list to a string, joined with correct newlines newline = self.newlines or os.linesep if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w' and sys.platform == 'win32' and newline == '\r\n'): # Windows specific hack to avoid writing '\r\r\n' newline = '\n' output = newline.join(out) if self.encoding: output = output.encode(self.encoding) if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)): # Add the UTF8 BOM output = BOM_UTF8 + output if not output.endswith(newline): output += newline if outfile is not None: outfile.write(output) else: h = open(self.filename, 'wb') output = output.encode() # encoding the data to bytes h.write(output) h.close() def validate(self, validator, preserve_errors=False, copy=False, section=None): """ Test the ConfigObj against a configspec. It uses the ``validator`` object from *validate.py*. To run ``validate`` on the current ConfigObj, call: :: test = config.validate(validator) (Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the ``configspec`` attribute of a section though). It returns ``True`` if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the value ``True``. (It also returns ``False`` if all members fail). In addition, it converts the values from strings to their native types if their checks pass (and ``stringify`` is set). If ``preserve_errors`` is ``True`` (``False`` is default) then instead of a marking a fail with a ``False``, it will preserve the actual exception object. This can contain info about the reason for failure. For example the ``VdtValueTooSmallError`` indicates that the value supplied was too small. If a value (or section) is missing it will still be marked as ``False``. You must have the validate module to use ``preserve_errors=True``. You can then use the ``flatten_errors`` function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages. """ if section is None: if self.configspec is None: raise ValueError('No configspec supplied.') if preserve_errors: # We do this once to remove a top level dependency on the validate module # Which makes importing configobj faster from validate import VdtMissingValue self._vdtMissingValue = VdtMissingValue section = self if copy: section.initial_comment = section.configspec.initial_comment section.final_comment = section.configspec.final_comment section.encoding = section.configspec.encoding section.BOM = section.configspec.BOM section.newlines = section.configspec.newlines section.indent_type = section.configspec.indent_type # # section.default_values.clear() #?? configspec = section.configspec self._set_configspec(section, copy) def validate_entry(entry, spec, val, missing, ret_true, ret_false): section.default_values.pop(entry, None) try: section.default_values[entry] = validator.get_default_value(configspec[entry]) except (KeyError, AttributeError, validator.baseErrorClass): # No default, bad default or validator has no 'get_default_value' # (e.g. SimpleVal) pass try: check = validator.check(spec, val, missing=missing ) except validator.baseErrorClass as e: if not preserve_errors or isinstance(e, self._vdtMissingValue): out[entry] = False else: # preserve the error out[entry] = e ret_false = False ret_true = False else: ret_false = False out[entry] = True if self.stringify or missing: # if we are doing type conversion # or the value is a supplied default if not self.stringify: if isinstance(check, (list, tuple)): # preserve lists check = [self._str(item) for item in check] elif missing and check is None: # convert the None from a default to a '' check = '' else: check = self._str(check) if (check != val) or missing: section[entry] = check if not copy and missing and entry not in section.defaults: section.defaults.append(entry) return ret_true, ret_false # out = {} ret_true = True ret_false = True unvalidated = [k for k in section.scalars if k not in configspec] incorrect_sections = [k for k in configspec.sections if k in section.scalars] incorrect_scalars = [k for k in configspec.scalars if k in section.sections] for entry in configspec.scalars: if entry in ('__many__', '___many___'): # reserved names continue if (not entry in section.scalars) or (entry in section.defaults): # missing entries # or entries from defaults missing = True val = None if copy and entry not in section.scalars: # copy comments section.comments[entry] = ( configspec.comments.get(entry, [])) section.inline_comments[entry] = ( configspec.inline_comments.get(entry, '')) # else: missing = False val = section[entry] ret_true, ret_false = validate_entry(entry, configspec[entry], val, missing, ret_true, ret_false) many = None if '__many__' in configspec.scalars: many = configspec['__many__'] elif '___many___' in configspec.scalars: many = configspec['___many___'] if many is not None: for entry in unvalidated: val = section[entry] ret_true, ret_false = validate_entry(entry, many, val, False, ret_true, ret_false) unvalidated = [] for entry in incorrect_scalars: ret_true = False if not preserve_errors: out[entry] = False else: ret_false = False msg = 'Value %r was provided as a section' % entry out[entry] = validator.baseErrorClass(msg) for entry in incorrect_sections: ret_true = False if not preserve_errors: out[entry] = False else: ret_false = False msg = 'Section %r was provided as a single value' % entry out[entry] = validator.baseErrorClass(msg) # Missing sections will have been created as empty ones when the # configspec was read. for entry in section.sections: # FIXME: this means DEFAULT is not copied in copy mode if section is self and entry == 'DEFAULT': continue if section[entry].configspec is None: unvalidated.append(entry) continue if copy: section.comments[entry] = configspec.comments.get(entry, []) section.inline_comments[entry] = configspec.inline_comments.get(entry, '') check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry]) out[entry] = check if check == False: ret_true = False elif check == True: ret_false = False else: ret_true = False section.extra_values = unvalidated if preserve_errors and not section._created: # If the section wasn't created (i.e. it wasn't missing) # then we can't return False, we need to preserve errors ret_false = False # if ret_false and preserve_errors and out: # If we are preserving errors, but all # the failures are from missing sections / values # then we can return False. Otherwise there is a # real failure that we need to preserve. ret_false = not any(out.values()) if ret_true: return True elif ret_false: return False return out def reset(self): """Clear ConfigObj instance and restore to 'freshly created' state.""" self.clear() self._initialise() # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload) # requires an empty dictionary self.configspec = None # Just to be sure ;-) self._original_configspec = None def reload(self): """ Reload a ConfigObj from file. This method raises a ``ReloadError`` if the ConfigObj doesn't have a filename attribute pointing to a file. """ if not isinstance(self.filename, str): raise ReloadError() filename = self.filename current_options = {} for entry in OPTION_DEFAULTS: if entry == 'configspec': continue current_options[entry] = getattr(self, entry) configspec = self._original_configspec current_options['configspec'] = configspec self.clear() self._initialise(current_options) self._load(filename, configspec) class SimpleVal(object): """ A simple validator. Can be used to check that all members expected are present. To use it, provide a configspec with all your members in (the value given will be ignored). Pass an instance of ``SimpleVal`` to the ``validate`` method of your ``ConfigObj``. ``validate`` will return ``True`` if all members are present, or a dictionary with True/False meaning present/missing. (Whole missing sections will be replaced with ``False``) """ def __init__(self): self.baseErrorClass = ConfigObjError def check(self, check, member, missing=False): """A dummy check method, always returns the value unchanged.""" if missing: raise self.baseErrorClass() return member def flatten_errors(cfg, res, levels=None, results=None): """ An example function that will turn a nested dictionary of results (as returned by ``ConfigObj.validate``) into a flat list. ``cfg`` is the ConfigObj instance being checked, ``res`` is the results dictionary returned by ``validate``. (This is a recursive function, so you shouldn't use the ``levels`` or ``results`` arguments - they are used by the function.) Returns a list of keys that failed. Each member of the list is a tuple:: ([list of sections...], key, result) If ``validate`` was called with ``preserve_errors=False`` (the default) then ``result`` will always be ``False``. *list of sections* is a flattened list of sections that the key was found in. If the section was missing (or a section was expected and a scalar provided - or vice-versa) then key will be ``None``. If the value (or section) was missing then ``result`` will be ``False``. If ``validate`` was called with ``preserve_errors=True`` and a value was present, but failed the check, then ``result`` will be the exception object returned. You can use this as a string that describes the failure. For example *The value "3" is of the wrong type*. """ if levels is None: # first time called levels = [] results = [] if res == True: return results if res == False or isinstance(res, Exception): results.append((levels[:], None, res)) if levels: levels.pop() return results for (key, val) in list(res.items()): if val == True: continue if isinstance(cfg.get(key), dict): # Go down one level levels.append(key) flatten_errors(cfg[key], val, levels, results) continue results.append((levels[:], key, val)) # # Go up one level if levels: levels.pop() # return results def get_extra_values(conf, _prepend=()): """ Find all the values and sections not in the configspec from a validated ConfigObj. ``get_extra_values`` returns a list of tuples where each tuple represents either an extra section, or an extra value. The tuples contain two values, a tuple representing the section the value is in and the name of the extra values. For extra values in the top level section the first member will be an empty tuple. For values in the 'foo' section the first member will be ``('foo',)``. For members in the 'bar' subsection of the 'foo' section the first member will be ``('foo', 'bar')``. NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't been validated it will return an empty list. """ out = [] out.extend([(_prepend, name) for name in conf.extra_values]) for name in conf.sections: if name not in conf.extra_values: out.extend(get_extra_values(conf[name], _prepend + (name,))) return out """*A programming language is a medium of expression.* - Paul Graham"""astropy-0.3/astropy/extern/__init__.py0000644000175000017500000000056012243255342016317 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This packages contains python packages that are bundled with Astropy but are external to Astropy, and hence are developed in a separate source tree. Note that this package is distinct from the /cextern directory of the source code distribution, as that directory only contains C extension code. """ astropy-0.3/astropy/extern/setup_package.py0000644000175000017500000000014712243255342017374 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def requires_2to3(): return False astropy-0.3/astropy/extern/ply/0000755000175000017500000000000012243263747015021 5ustar oleoleastropy-0.3/astropy/extern/ply/__init__.py0000644000175000017500000000012212243255342017115 0ustar oleole# PLY package # Author: David Beazley (dave@dabeaz.com) __all__ = ['lex','yacc'] astropy-0.3/astropy/extern/ply/lex.py0000644000175000017500000011730012243255342016155 0ustar oleole# ----------------------------------------------------------------------------- # ply: lex.py # # Copyright (C) 2001-2011, # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of the David Beazley or Dabeaz LLC may be used to # endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ----------------------------------------------------------------------------- __version__ = "3.4" __tabversion__ = "3.2" # Version of table file used import re, sys, types, copy, os, inspect # This tuple contains known string types try: # Python 2.6 StringTypes = (types.StringType, types.UnicodeType) except AttributeError: # Python 3.0 StringTypes = (str, bytes) # Extract the code attribute of a function. Different implementations # are for Python 2/3 compatibility. if sys.version_info[0] < 3: def func_code(f): return f.func_code else: def func_code(f): return f.__code__ # This regular expression is used to match valid token names _is_identifier = re.compile(r'^[a-zA-Z0-9_]+$') # Exception thrown when invalid token encountered and no default error # handler is defined. class LexError(Exception): def __init__(self,message,s): self.args = (message,) self.text = s # Token class. This class is used to represent the tokens produced. class LexToken(object): def __str__(self): return "LexToken(%s,%r,%d,%d)" % (self.type,self.value,self.lineno,self.lexpos) def __repr__(self): return str(self) # This object is a stand-in for a logging object created by the # logging module. class PlyLogger(object): def __init__(self,f): self.f = f def critical(self,msg,*args,**kwargs): self.f.write((msg % args) + "\n") def warning(self,msg,*args,**kwargs): self.f.write("WARNING: "+ (msg % args) + "\n") def error(self,msg,*args,**kwargs): self.f.write("ERROR: " + (msg % args) + "\n") info = critical debug = critical # Null logger is used when no output is generated. Does nothing. class NullLogger(object): def __getattribute__(self,name): return self def __call__(self,*args,**kwargs): return self # ----------------------------------------------------------------------------- # === Lexing Engine === # # The following Lexer class implements the lexer runtime. There are only # a few public methods and attributes: # # input() - Store a new string in the lexer # token() - Get the next token # clone() - Clone the lexer # # lineno - Current line number # lexpos - Current position in the input string # ----------------------------------------------------------------------------- class Lexer: def __init__(self): self.lexre = None # Master regular expression. This is a list of # tuples (re,findex) where re is a compiled # regular expression and findex is a list # mapping regex group numbers to rules self.lexretext = None # Current regular expression strings self.lexstatere = {} # Dictionary mapping lexer states to master regexs self.lexstateretext = {} # Dictionary mapping lexer states to regex strings self.lexstaterenames = {} # Dictionary mapping lexer states to symbol names self.lexstate = "INITIAL" # Current lexer state self.lexstatestack = [] # Stack of lexer states self.lexstateinfo = None # State information self.lexstateignore = {} # Dictionary of ignored characters for each state self.lexstateerrorf = {} # Dictionary of error functions for each state self.lexreflags = 0 # Optional re compile flags self.lexdata = None # Actual input data (as a string) self.lexpos = 0 # Current position in input text self.lexlen = 0 # Length of the input text self.lexerrorf = None # Error rule (if any) self.lextokens = None # List of valid tokens self.lexignore = "" # Ignored characters self.lexliterals = "" # Literal characters that can be passed through self.lexmodule = None # Module self.lineno = 1 # Current line number self.lexoptimize = 0 # Optimized mode def clone(self,object=None): c = copy.copy(self) # If the object parameter has been supplied, it means we are attaching the # lexer to a new object. In this case, we have to rebind all methods in # the lexstatere and lexstateerrorf tables. if object: newtab = { } for key, ritem in self.lexstatere.items(): newre = [] for cre, findex in ritem: newfindex = [] for f in findex: if not f or not f[0]: newfindex.append(f) continue newfindex.append((getattr(object,f[0].__name__),f[1])) newre.append((cre,newfindex)) newtab[key] = newre c.lexstatere = newtab c.lexstateerrorf = { } for key, ef in self.lexstateerrorf.items(): c.lexstateerrorf[key] = getattr(object,ef.__name__) c.lexmodule = object return c # ------------------------------------------------------------ # writetab() - Write lexer information to a table file # ------------------------------------------------------------ def writetab(self,tabfile,outputdir=""): if isinstance(tabfile,types.ModuleType): return basetabfilename = tabfile.split(".")[-1] filename = os.path.join(outputdir,basetabfilename)+".py" tf = open(filename,"w") tf.write("# %s.py. This file automatically created by PLY (version %s). Don't edit!\n" % (tabfile,__version__)) tf.write("_tabversion = %s\n" % repr(__version__)) tf.write("_lextokens = %s\n" % repr(self.lextokens)) tf.write("_lexreflags = %s\n" % repr(self.lexreflags)) tf.write("_lexliterals = %s\n" % repr(self.lexliterals)) tf.write("_lexstateinfo = %s\n" % repr(self.lexstateinfo)) tabre = { } # Collect all functions in the initial state initial = self.lexstatere["INITIAL"] initialfuncs = [] for part in initial: for f in part[1]: if f and f[0]: initialfuncs.append(f) for key, lre in self.lexstatere.items(): titem = [] for i in range(len(lre)): titem.append((self.lexstateretext[key][i],_funcs_to_names(lre[i][1],self.lexstaterenames[key][i]))) tabre[key] = titem tf.write("_lexstatere = %s\n" % repr(tabre)) tf.write("_lexstateignore = %s\n" % repr(self.lexstateignore)) taberr = { } for key, ef in self.lexstateerrorf.items(): if ef: taberr[key] = ef.__name__ else: taberr[key] = None tf.write("_lexstateerrorf = %s\n" % repr(taberr)) tf.close() # ------------------------------------------------------------ # readtab() - Read lexer information from a tab file # ------------------------------------------------------------ def readtab(self,tabfile,fdict): if isinstance(tabfile,types.ModuleType): lextab = tabfile else: if sys.version_info[0] < 3: exec("import %s as lextab" % tabfile) else: env = { } exec("import %s as lextab" % tabfile, env,env) lextab = env['lextab'] if getattr(lextab,"_tabversion","0.0") != __version__: raise ImportError("Inconsistent PLY version") self.lextokens = lextab._lextokens self.lexreflags = lextab._lexreflags self.lexliterals = lextab._lexliterals self.lexstateinfo = lextab._lexstateinfo self.lexstateignore = lextab._lexstateignore self.lexstatere = { } self.lexstateretext = { } for key,lre in lextab._lexstatere.items(): titem = [] txtitem = [] for i in range(len(lre)): titem.append((re.compile(lre[i][0],lextab._lexreflags | re.VERBOSE),_names_to_funcs(lre[i][1],fdict))) txtitem.append(lre[i][0]) self.lexstatere[key] = titem self.lexstateretext[key] = txtitem self.lexstateerrorf = { } for key,ef in lextab._lexstateerrorf.items(): self.lexstateerrorf[key] = fdict[ef] self.begin('INITIAL') # ------------------------------------------------------------ # input() - Push a new string into the lexer # ------------------------------------------------------------ def input(self,s): # Pull off the first character to see if s looks like a string c = s[:1] if not isinstance(c,StringTypes): raise ValueError("Expected a string") self.lexdata = s self.lexpos = 0 self.lexlen = len(s) # ------------------------------------------------------------ # begin() - Changes the lexing state # ------------------------------------------------------------ def begin(self,state): if not state in self.lexstatere: raise ValueError("Undefined state") self.lexre = self.lexstatere[state] self.lexretext = self.lexstateretext[state] self.lexignore = self.lexstateignore.get(state,"") self.lexerrorf = self.lexstateerrorf.get(state,None) self.lexstate = state # ------------------------------------------------------------ # push_state() - Changes the lexing state and saves old on stack # ------------------------------------------------------------ def push_state(self,state): self.lexstatestack.append(self.lexstate) self.begin(state) # ------------------------------------------------------------ # pop_state() - Restores the previous state # ------------------------------------------------------------ def pop_state(self): self.begin(self.lexstatestack.pop()) # ------------------------------------------------------------ # current_state() - Returns the current lexing state # ------------------------------------------------------------ def current_state(self): return self.lexstate # ------------------------------------------------------------ # skip() - Skip ahead n characters # ------------------------------------------------------------ def skip(self,n): self.lexpos += n # ------------------------------------------------------------ # opttoken() - Return the next token from the Lexer # # Note: This function has been carefully implemented to be as fast # as possible. Don't make changes unless you really know what # you are doing # ------------------------------------------------------------ def token(self): # Make local copies of frequently referenced attributes lexpos = self.lexpos lexlen = self.lexlen lexignore = self.lexignore lexdata = self.lexdata while lexpos < lexlen: # This code provides some short-circuit code for whitespace, tabs, and other ignored characters if lexdata[lexpos] in lexignore: lexpos += 1 continue # Look for a regular expression match for lexre,lexindexfunc in self.lexre: m = lexre.match(lexdata,lexpos) if not m: continue # Create a token for return tok = LexToken() tok.value = m.group() tok.lineno = self.lineno tok.lexpos = lexpos i = m.lastindex func,tok.type = lexindexfunc[i] if not func: # If no token type was set, it's an ignored token if tok.type: self.lexpos = m.end() return tok else: lexpos = m.end() break lexpos = m.end() # If token is processed by a function, call it tok.lexer = self # Set additional attributes useful in token rules self.lexmatch = m self.lexpos = lexpos newtok = func(tok) # Every function must return a token, if nothing, we just move to next token if not newtok: lexpos = self.lexpos # This is here in case user has updated lexpos. lexignore = self.lexignore # This is here in case there was a state change break # Verify type of the token. If not in the token map, raise an error if not self.lexoptimize: if not newtok.type in self.lextokens: raise LexError("%s:%d: Rule '%s' returned an unknown token type '%s'" % ( func_code(func).co_filename, func_code(func).co_firstlineno, func.__name__, newtok.type),lexdata[lexpos:]) return newtok else: # No match, see if in literals if lexdata[lexpos] in self.lexliterals: tok = LexToken() tok.value = lexdata[lexpos] tok.lineno = self.lineno tok.type = tok.value tok.lexpos = lexpos self.lexpos = lexpos + 1 return tok # No match. Call t_error() if defined. if self.lexerrorf: tok = LexToken() tok.value = self.lexdata[lexpos:] tok.lineno = self.lineno tok.type = "error" tok.lexer = self tok.lexpos = lexpos self.lexpos = lexpos newtok = self.lexerrorf(tok) if lexpos == self.lexpos: # Error method didn't change text position at all. This is an error. raise LexError("Scanning error. Illegal character '%s'" % (lexdata[lexpos]), lexdata[lexpos:]) lexpos = self.lexpos if not newtok: continue return newtok self.lexpos = lexpos raise LexError("Illegal character '%s' at index %d" % (lexdata[lexpos],lexpos), lexdata[lexpos:]) self.lexpos = lexpos + 1 if self.lexdata is None: raise RuntimeError("No input string given with input()") return None # Iterator interface def __iter__(self): return self def next(self): t = self.token() if t is None: raise StopIteration return t __next__ = next # ----------------------------------------------------------------------------- # ==== Lex Builder === # # The functions and classes below are used to collect lexing information # and build a Lexer object from it. # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # get_caller_module_dict() # # This function returns a dictionary containing all of the symbols defined within # a caller further down the call stack. This is used to get the environment # associated with the yacc() call if none was provided. # ----------------------------------------------------------------------------- def get_caller_module_dict(levels): try: raise RuntimeError except RuntimeError: e,b,t = sys.exc_info() f = t.tb_frame while levels > 0: f = f.f_back levels -= 1 ldict = f.f_globals.copy() if f.f_globals != f.f_locals: ldict.update(f.f_locals) return ldict # ----------------------------------------------------------------------------- # _funcs_to_names() # # Given a list of regular expression functions, this converts it to a list # suitable for output to a table file # ----------------------------------------------------------------------------- def _funcs_to_names(funclist,namelist): result = [] for f,name in zip(funclist,namelist): if f and f[0]: result.append((name, f[1])) else: result.append(f) return result # ----------------------------------------------------------------------------- # _names_to_funcs() # # Given a list of regular expression function names, this converts it back to # functions. # ----------------------------------------------------------------------------- def _names_to_funcs(namelist,fdict): result = [] for n in namelist: if n and n[0]: result.append((fdict[n[0]],n[1])) else: result.append(n) return result # ----------------------------------------------------------------------------- # _form_master_re() # # This function takes a list of all of the regex components and attempts to # form the master regular expression. Given limitations in the Python re # module, it may be necessary to break the master regex into separate expressions. # ----------------------------------------------------------------------------- def _form_master_re(relist,reflags,ldict,toknames): if not relist: return [] regex = "|".join(relist) try: lexre = re.compile(regex,re.VERBOSE | reflags) # Build the index to function map for the matching engine lexindexfunc = [ None ] * (max(lexre.groupindex.values())+1) lexindexnames = lexindexfunc[:] for f,i in lexre.groupindex.items(): handle = ldict.get(f,None) if type(handle) in (types.FunctionType, types.MethodType): lexindexfunc[i] = (handle,toknames[f]) lexindexnames[i] = f elif handle is not None: lexindexnames[i] = f if f.find("ignore_") > 0: lexindexfunc[i] = (None,None) else: lexindexfunc[i] = (None, toknames[f]) return [(lexre,lexindexfunc)],[regex],[lexindexnames] except Exception: m = int(len(relist)/2) if m == 0: m = 1 llist, lre, lnames = _form_master_re(relist[:m],reflags,ldict,toknames) rlist, rre, rnames = _form_master_re(relist[m:],reflags,ldict,toknames) return llist+rlist, lre+rre, lnames+rnames # ----------------------------------------------------------------------------- # def _statetoken(s,names) # # Given a declaration name s of the form "t_" and a dictionary whose keys are # state names, this function returns a tuple (states,tokenname) where states # is a tuple of state names and tokenname is the name of the token. For example, # calling this with s = "t_foo_bar_SPAM" might return (('foo','bar'),'SPAM') # ----------------------------------------------------------------------------- def _statetoken(s,names): nonstate = 1 parts = s.split("_") for i in range(1,len(parts)): if not parts[i] in names and parts[i] != 'ANY': break if i > 1: states = tuple(parts[1:i]) else: states = ('INITIAL',) if 'ANY' in states: states = tuple(names) tokenname = "_".join(parts[i:]) return (states,tokenname) # ----------------------------------------------------------------------------- # LexerReflect() # # This class represents information needed to build a lexer as extracted from a # user's input file. # ----------------------------------------------------------------------------- class LexerReflect(object): def __init__(self,ldict,log=None,reflags=0): self.ldict = ldict self.error_func = None self.tokens = [] self.reflags = reflags self.stateinfo = { 'INITIAL' : 'inclusive'} self.modules = {} self.error = 0 if log is None: self.log = PlyLogger(sys.stderr) else: self.log = log # Get all of the basic information def get_all(self): self.get_tokens() self.get_literals() self.get_states() self.get_rules() # Validate all of the information def validate_all(self): self.validate_tokens() self.validate_literals() self.validate_rules() return self.error # Get the tokens map def get_tokens(self): tokens = self.ldict.get("tokens",None) if not tokens: self.log.error("No token list is defined") self.error = 1 return if not isinstance(tokens,(list, tuple)): self.log.error("tokens must be a list or tuple") self.error = 1 return if not tokens: self.log.error("tokens is empty") self.error = 1 return self.tokens = tokens # Validate the tokens def validate_tokens(self): terminals = {} for n in self.tokens: if not _is_identifier.match(n): self.log.error("Bad token name '%s'",n) self.error = 1 if n in terminals: self.log.warning("Token '%s' multiply defined", n) terminals[n] = 1 # Get the literals specifier def get_literals(self): self.literals = self.ldict.get("literals","") # Validate literals def validate_literals(self): try: for c in self.literals: if not isinstance(c,StringTypes) or len(c) > 1: self.log.error("Invalid literal %s. Must be a single character", repr(c)) self.error = 1 continue except TypeError: self.log.error("Invalid literals specification. literals must be a sequence of characters") self.error = 1 def get_states(self): self.states = self.ldict.get("states",None) # Build statemap if self.states: if not isinstance(self.states,(tuple,list)): self.log.error("states must be defined as a tuple or list") self.error = 1 else: for s in self.states: if not isinstance(s,tuple) or len(s) != 2: self.log.error("Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')",repr(s)) self.error = 1 continue name, statetype = s if not isinstance(name,StringTypes): self.log.error("State name %s must be a string", repr(name)) self.error = 1 continue if not (statetype == 'inclusive' or statetype == 'exclusive'): self.log.error("State type for state %s must be 'inclusive' or 'exclusive'",name) self.error = 1 continue if name in self.stateinfo: self.log.error("State '%s' already defined",name) self.error = 1 continue self.stateinfo[name] = statetype # Get all of the symbols with a t_ prefix and sort them into various # categories (functions, strings, error functions, and ignore characters) def get_rules(self): tsymbols = [f for f in self.ldict if f[:2] == 't_' ] # Now build up a list of functions and a list of strings self.toknames = { } # Mapping of symbols to token names self.funcsym = { } # Symbols defined as functions self.strsym = { } # Symbols defined as strings self.ignore = { } # Ignore strings by state self.errorf = { } # Error functions by state for s in self.stateinfo: self.funcsym[s] = [] self.strsym[s] = [] if len(tsymbols) == 0: self.log.error("No rules of the form t_rulename are defined") self.error = 1 return for f in tsymbols: t = self.ldict[f] states, tokname = _statetoken(f,self.stateinfo) self.toknames[f] = tokname if hasattr(t,"__call__"): if tokname == 'error': for s in states: self.errorf[s] = t elif tokname == 'ignore': line = func_code(t).co_firstlineno file = func_code(t).co_filename self.log.error("%s:%d: Rule '%s' must be defined as a string",file,line,t.__name__) self.error = 1 else: for s in states: self.funcsym[s].append((f,t)) elif isinstance(t, StringTypes): if tokname == 'ignore': for s in states: self.ignore[s] = t if "\\" in t: self.log.warning("%s contains a literal backslash '\\'",f) elif tokname == 'error': self.log.error("Rule '%s' must be defined as a function", f) self.error = 1 else: for s in states: self.strsym[s].append((f,t)) else: self.log.error("%s not defined as a function or string", f) self.error = 1 # Sort the functions by line number for f in self.funcsym.values(): if sys.version_info[0] < 3: f.sort(lambda x,y: cmp(func_code(x[1]).co_firstlineno,func_code(y[1]).co_firstlineno)) else: # Python 3.0 f.sort(key=lambda x: func_code(x[1]).co_firstlineno) # Sort the strings by regular expression length for s in self.strsym.values(): if sys.version_info[0] < 3: s.sort(lambda x,y: (len(x[1]) < len(y[1])) - (len(x[1]) > len(y[1]))) else: # Python 3.0 s.sort(key=lambda x: len(x[1]),reverse=True) # Validate all of the t_rules collected def validate_rules(self): for state in self.stateinfo: # Validate all rules defined by functions for fname, f in self.funcsym[state]: line = func_code(f).co_firstlineno file = func_code(f).co_filename module = inspect.getmodule(f) self.modules[module] = 1 tokname = self.toknames[fname] if isinstance(f, types.MethodType): reqargs = 2 else: reqargs = 1 nargs = func_code(f).co_argcount if nargs > reqargs: self.log.error("%s:%d: Rule '%s' has too many arguments",file,line,f.__name__) self.error = 1 continue if nargs < reqargs: self.log.error("%s:%d: Rule '%s' requires an argument", file,line,f.__name__) self.error = 1 continue if not f.__doc__: self.log.error("%s:%d: No regular expression defined for rule '%s'",file,line,f.__name__) self.error = 1 continue try: c = re.compile("(?P<%s>%s)" % (fname,f.__doc__), re.VERBOSE | self.reflags) if c.match(""): self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file,line,f.__name__) self.error = 1 except re.error: _etype, e, _etrace = sys.exc_info() self.log.error("%s:%d: Invalid regular expression for rule '%s'. %s", file,line,f.__name__,e) if '#' in f.__doc__: self.log.error("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'",file,line, f.__name__) self.error = 1 # Validate all rules defined by strings for name,r in self.strsym[state]: tokname = self.toknames[name] if tokname == 'error': self.log.error("Rule '%s' must be defined as a function", name) self.error = 1 continue if not tokname in self.tokens and tokname.find("ignore_") < 0: self.log.error("Rule '%s' defined for an unspecified token %s",name,tokname) self.error = 1 continue try: c = re.compile("(?P<%s>%s)" % (name,r),re.VERBOSE | self.reflags) if (c.match("")): self.log.error("Regular expression for rule '%s' matches empty string",name) self.error = 1 except re.error: _etype, e, _etrace = sys.exc_info() self.log.error("Invalid regular expression for rule '%s'. %s",name,e) if '#' in r: self.log.error("Make sure '#' in rule '%s' is escaped with '\\#'",name) self.error = 1 if not self.funcsym[state] and not self.strsym[state]: self.log.error("No rules defined for state '%s'",state) self.error = 1 # Validate the error function efunc = self.errorf.get(state,None) if efunc: f = efunc line = func_code(f).co_firstlineno file = func_code(f).co_filename module = inspect.getmodule(f) self.modules[module] = 1 if isinstance(f, types.MethodType): reqargs = 2 else: reqargs = 1 nargs = func_code(f).co_argcount if nargs > reqargs: self.log.error("%s:%d: Rule '%s' has too many arguments",file,line,f.__name__) self.error = 1 if nargs < reqargs: self.log.error("%s:%d: Rule '%s' requires an argument", file,line,f.__name__) self.error = 1 for module in self.modules: self.validate_module(module) # ----------------------------------------------------------------------------- # validate_module() # # This checks to see if there are duplicated t_rulename() functions or strings # in the parser input file. This is done using a simple regular expression # match on each line in the source code of the given module. # ----------------------------------------------------------------------------- def validate_module(self, module): lines, linen = inspect.getsourcelines(module) fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(') sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=') counthash = { } linen += 1 for l in lines: m = fre.match(l) if not m: m = sre.match(l) if m: name = m.group(1) prev = counthash.get(name) if not prev: counthash[name] = linen else: filename = inspect.getsourcefile(module) self.log.error("%s:%d: Rule %s redefined. Previously defined on line %d",filename,linen,name,prev) self.error = 1 linen += 1 # ----------------------------------------------------------------------------- # lex(module) # # Build all of the regular expression rules from definitions in the supplied module # ----------------------------------------------------------------------------- def lex(module=None,object=None,debug=0,optimize=0,lextab="lextab",reflags=0,nowarn=0,outputdir="", debuglog=None, errorlog=None): global lexer ldict = None stateinfo = { 'INITIAL' : 'inclusive'} lexobj = Lexer() lexobj.lexoptimize = optimize global token,input if errorlog is None: errorlog = PlyLogger(sys.stderr) if debug: if debuglog is None: debuglog = PlyLogger(sys.stderr) # Get the module dictionary used for the lexer if object: module = object if module: _items = [(k,getattr(module,k)) for k in dir(module)] ldict = dict(_items) else: ldict = get_caller_module_dict(2) # Collect parser information from the dictionary linfo = LexerReflect(ldict,log=errorlog,reflags=reflags) linfo.get_all() if not optimize: if linfo.validate_all(): raise SyntaxError("Can't build lexer") if optimize and lextab: try: lexobj.readtab(lextab,ldict) token = lexobj.token input = lexobj.input lexer = lexobj return lexobj except ImportError: pass # Dump some basic debugging information if debug: debuglog.info("lex: tokens = %r", linfo.tokens) debuglog.info("lex: literals = %r", linfo.literals) debuglog.info("lex: states = %r", linfo.stateinfo) # Build a dictionary of valid token names lexobj.lextokens = { } for n in linfo.tokens: lexobj.lextokens[n] = 1 # Get literals specification if isinstance(linfo.literals,(list,tuple)): lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals) else: lexobj.lexliterals = linfo.literals # Get the stateinfo dictionary stateinfo = linfo.stateinfo regexs = { } # Build the master regular expressions for state in stateinfo: regex_list = [] # Add rules defined by functions first for fname, f in linfo.funcsym[state]: line = func_code(f).co_firstlineno file = func_code(f).co_filename regex_list.append("(?P<%s>%s)" % (fname,f.__doc__)) if debug: debuglog.info("lex: Adding rule %s -> '%s' (state '%s')",fname,f.__doc__, state) # Now add all of the simple rules for name,r in linfo.strsym[state]: regex_list.append("(?P<%s>%s)" % (name,r)) if debug: debuglog.info("lex: Adding rule %s -> '%s' (state '%s')",name,r, state) regexs[state] = regex_list # Build the master regular expressions if debug: debuglog.info("lex: ==== MASTER REGEXS FOLLOW ====") for state in regexs: lexre, re_text, re_names = _form_master_re(regexs[state],reflags,ldict,linfo.toknames) lexobj.lexstatere[state] = lexre lexobj.lexstateretext[state] = re_text lexobj.lexstaterenames[state] = re_names if debug: for i in range(len(re_text)): debuglog.info("lex: state '%s' : regex[%d] = '%s'",state, i, re_text[i]) # For inclusive states, we need to add the regular expressions from the INITIAL state for state,stype in stateinfo.items(): if state != "INITIAL" and stype == 'inclusive': lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL']) lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL']) lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL']) lexobj.lexstateinfo = stateinfo lexobj.lexre = lexobj.lexstatere["INITIAL"] lexobj.lexretext = lexobj.lexstateretext["INITIAL"] lexobj.lexreflags = reflags # Set up ignore variables lexobj.lexstateignore = linfo.ignore lexobj.lexignore = lexobj.lexstateignore.get("INITIAL","") # Set up error functions lexobj.lexstateerrorf = linfo.errorf lexobj.lexerrorf = linfo.errorf.get("INITIAL",None) if not lexobj.lexerrorf: errorlog.warning("No t_error rule is defined") # Check state information for ignore and error rules for s,stype in stateinfo.items(): if stype == 'exclusive': if not s in linfo.errorf: errorlog.warning("No error rule is defined for exclusive state '%s'", s) if not s in linfo.ignore and lexobj.lexignore: errorlog.warning("No ignore rule is defined for exclusive state '%s'", s) elif stype == 'inclusive': if not s in linfo.errorf: linfo.errorf[s] = linfo.errorf.get("INITIAL",None) if not s in linfo.ignore: linfo.ignore[s] = linfo.ignore.get("INITIAL","") # Create global versions of the token() and input() functions token = lexobj.token input = lexobj.input lexer = lexobj # If in optimize mode, we write the lextab if lextab and optimize: lexobj.writetab(lextab,outputdir) return lexobj # ----------------------------------------------------------------------------- # runmain() # # This runs the lexer as a main program # ----------------------------------------------------------------------------- def runmain(lexer=None,data=None): if not data: try: filename = sys.argv[1] f = open(filename) data = f.read() f.close() except IndexError: sys.stdout.write("Reading from standard input (type EOF to end):\n") data = sys.stdin.read() if lexer: _input = lexer.input else: _input = input _input(data) if lexer: _token = lexer.token else: _token = token while 1: tok = _token() if not tok: break sys.stdout.write("(%s,%r,%d,%d)\n" % (tok.type, tok.value, tok.lineno,tok.lexpos)) # ----------------------------------------------------------------------------- # @TOKEN(regex) # # This decorator function can be used to set the regex expression on a function # when its docstring might need to be set in an alternative way # ----------------------------------------------------------------------------- def TOKEN(r): def set_doc(f): if hasattr(r,"__call__"): f.__doc__ = r.__doc__ else: f.__doc__ = r return f return set_doc # Alternative spelling of the TOKEN decorator Token = TOKEN astropy-0.3/astropy/extern/ply/yacc.py0000644000175000017500000037207312243255342016316 0ustar oleole# ----------------------------------------------------------------------------- # ply: yacc.py # # Copyright (C) 2001-2011, # David M. Beazley (Dabeaz LLC) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of the David Beazley or Dabeaz LLC may be used to # endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ----------------------------------------------------------------------------- # # This implements an LR parser that is constructed from grammar rules defined # as Python functions. The grammer is specified by supplying the BNF inside # Python documentation strings. The inspiration for this technique was borrowed # from John Aycock's Spark parsing system. PLY might be viewed as cross between # Spark and the GNU bison utility. # # The current implementation is only somewhat object-oriented. The # LR parser itself is defined in terms of an object (which allows multiple # parsers to co-exist). However, most of the variables used during table # construction are defined in terms of global variables. Users shouldn't # notice unless they are trying to define multiple parsers at the same # time using threads (in which case they should have their head examined). # # This implementation supports both SLR and LALR(1) parsing. LALR(1) # support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu), # using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles, # Techniques, and Tools" (The Dragon Book). LALR(1) has since been replaced # by the more efficient DeRemer and Pennello algorithm. # # :::::::: WARNING ::::::: # # Construction of LR parsing tables is fairly complicated and expensive. # To make this module run fast, a *LOT* of work has been put into # optimization---often at the expensive of readability and what might # consider to be good Python "coding style." Modify the code at your # own risk! # ---------------------------------------------------------------------------- __version__ = "3.4" __tabversion__ = "3.2" # Table version #----------------------------------------------------------------------------- # === User configurable parameters === # # Change these to modify the default behavior of yacc (if you wish) #----------------------------------------------------------------------------- yaccdebug = 1 # Debugging mode. If set, yacc generates a # a 'parser.out' file in the current directory debug_file = 'parser.out' # Default name of the debugging file tab_module = 'parsetab' # Default name of the table module default_lr = 'LALR' # Default LR table generation method error_count = 3 # Number of symbols that must be shifted to leave recovery mode yaccdevel = 0 # Set to True if developing yacc. This turns off optimized # implementations of certain functions. resultlimit = 40 # Size limit of results when running in debug mode. pickle_protocol = 0 # Protocol to use when writing pickle files import re, types, sys, os.path, inspect # Compatibility function for python 2.6/3.0 if sys.version_info[0] < 3: def func_code(f): return f.func_code else: def func_code(f): return f.__code__ # Compatibility try: MAXINT = sys.maxint except AttributeError: MAXINT = sys.maxsize # Python 2.x/3.0 compatibility. def load_ply_lex(): if sys.version_info[0] < 3: import lex else: import ply.lex as lex return lex # This object is a stand-in for a logging object created by the # logging module. PLY will use this by default to create things # such as the parser.out file. If a user wants more detailed # information, they can create their own logging object and pass # it into PLY. class PlyLogger(object): def __init__(self,f): self.f = f def debug(self,msg,*args,**kwargs): self.f.write((msg % args) + "\n") info = debug def warning(self,msg,*args,**kwargs): self.f.write("WARNING: "+ (msg % args) + "\n") def error(self,msg,*args,**kwargs): self.f.write("ERROR: " + (msg % args) + "\n") critical = debug # Null logger is used when no output is generated. Does nothing. class NullLogger(object): def __getattribute__(self,name): return self def __call__(self,*args,**kwargs): return self # Exception raised for yacc-related errors class YaccError(Exception): pass # Format the result message that the parser produces when running in debug mode. def format_result(r): repr_str = repr(r) if '\n' in repr_str: repr_str = repr(repr_str) if len(repr_str) > resultlimit: repr_str = repr_str[:resultlimit]+" ..." result = "<%s @ 0x%x> (%s)" % (type(r).__name__,id(r),repr_str) return result # Format stack entries when the parser is running in debug mode def format_stack_entry(r): repr_str = repr(r) if '\n' in repr_str: repr_str = repr(repr_str) if len(repr_str) < 16: return repr_str else: return "<%s @ 0x%x>" % (type(r).__name__,id(r)) #----------------------------------------------------------------------------- # === LR Parsing Engine === # # The following classes are used for the LR parser itself. These are not # used during table construction and are independent of the actual LR # table generation algorithm #----------------------------------------------------------------------------- # This class is used to hold non-terminal grammar symbols during parsing. # It normally has the following attributes set: # .type = Grammar symbol type # .value = Symbol value # .lineno = Starting line number # .endlineno = Ending line number (optional, set automatically) # .lexpos = Starting lex position # .endlexpos = Ending lex position (optional, set automatically) class YaccSymbol: def __str__(self): return self.type def __repr__(self): return str(self) # This class is a wrapper around the objects actually passed to each # grammar rule. Index lookup and assignment actually assign the # .value attribute of the underlying YaccSymbol object. # The lineno() method returns the line number of a given # item (or 0 if not defined). The linespan() method returns # a tuple of (startline,endline) representing the range of lines # for a symbol. The lexspan() method returns a tuple (lexpos,endlexpos) # representing the range of positional information for a symbol. class YaccProduction: def __init__(self,s,stack=None): self.slice = s self.stack = stack self.lexer = None self.parser= None def __getitem__(self,n): if n >= 0: return self.slice[n].value else: return self.stack[n].value def __setitem__(self,n,v): self.slice[n].value = v def __getslice__(self,i,j): return [s.value for s in self.slice[i:j]] def __len__(self): return len(self.slice) def lineno(self,n): return getattr(self.slice[n],"lineno",0) def set_lineno(self,n,lineno): self.slice[n].lineno = lineno def linespan(self,n): startline = getattr(self.slice[n],"lineno",0) endline = getattr(self.slice[n],"endlineno",startline) return startline,endline def lexpos(self,n): return getattr(self.slice[n],"lexpos",0) def lexspan(self,n): startpos = getattr(self.slice[n],"lexpos",0) endpos = getattr(self.slice[n],"endlexpos",startpos) return startpos,endpos def error(self): raise SyntaxError # ----------------------------------------------------------------------------- # == LRParser == # # The LR Parsing engine. # ----------------------------------------------------------------------------- class LRParser: def __init__(self,lrtab,errorf): self.productions = lrtab.lr_productions self.action = lrtab.lr_action self.goto = lrtab.lr_goto self.errorfunc = errorf def errok(self): self.errorok = 1 def restart(self): del self.statestack[:] del self.symstack[:] sym = YaccSymbol() sym.type = '$end' self.symstack.append(sym) self.statestack.append(0) def parse(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None): if debug or yaccdevel: if isinstance(debug,int): debug = PlyLogger(sys.stderr) return self.parsedebug(input,lexer,debug,tracking,tokenfunc) elif tracking: return self.parseopt(input,lexer,debug,tracking,tokenfunc) else: return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc) # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # parsedebug(). # # This is the debugging enabled version of parse(). All changes made to the # parsing engine should be made here. For the non-debugging version, # copy this code to a method parseopt() and delete all of the sections # enclosed in: # # #--! DEBUG # statements # #--! DEBUG # # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! def parsedebug(self,input=None,lexer=None,debug=None,tracking=0,tokenfunc=None): lookahead = None # Current lookahead symbol lookaheadstack = [ ] # Stack of lookahead symbols actions = self.action # Local reference to action table (to avoid lookup on self.) goto = self.goto # Local reference to goto table (to avoid lookup on self.) prod = self.productions # Local reference to production list (to avoid lookup on self.) pslice = YaccProduction(None) # Production object passed to grammar rules errorcount = 0 # Used during error recovery # --! DEBUG debug.info("PLY: PARSE DEBUG START") # --! DEBUG # If no lexer was given, we will try to use the lex module if not lexer: lex = load_ply_lex() lexer = lex.lexer # Set up the lexer and parser objects on pslice pslice.lexer = lexer pslice.parser = self # If input was supplied, pass to lexer if input is not None: lexer.input(input) if tokenfunc is None: # Tokenize function get_token = lexer.token else: get_token = tokenfunc # Set up the state and symbol stacks statestack = [ ] # Stack of parsing states self.statestack = statestack symstack = [ ] # Stack of grammar symbols self.symstack = symstack pslice.stack = symstack # Put in the production errtoken = None # Err token # The start state is assumed to be (0,$end) statestack.append(0) sym = YaccSymbol() sym.type = "$end" symstack.append(sym) state = 0 while 1: # Get the next symbol on the input. If a lookahead symbol # is already set, we just use that. Otherwise, we'll pull # the next token off of the lookaheadstack or from the lexer # --! DEBUG debug.debug('') debug.debug('State : %s', state) # --! DEBUG if not lookahead: if not lookaheadstack: lookahead = get_token() # Get the next token else: lookahead = lookaheadstack.pop() if not lookahead: lookahead = YaccSymbol() lookahead.type = "$end" # --! DEBUG debug.debug('Stack : %s', ("%s . %s" % (" ".join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) # --! DEBUG # Check the action table ltype = lookahead.type t = actions[state].get(ltype) if t is not None: if t > 0: # shift a symbol on the stack statestack.append(t) state = t # --! DEBUG debug.debug("Action : Shift and goto state %s", t) # --! DEBUG symstack.append(lookahead) lookahead = None # Decrease error count on successful shift if errorcount: errorcount -=1 continue if t < 0: # reduce a symbol on the stack, emit a production p = prod[-t] pname = p.name plen = p.len # Get production function sym = YaccSymbol() sym.type = pname # Production name sym.value = None # --! DEBUG if plen: debug.info("Action : Reduce rule [%s] with %s and goto state %d", p.str, "["+",".join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+"]",-t) else: debug.info("Action : Reduce rule [%s] with %s and goto state %d", p.str, [],-t) # --! DEBUG if plen: targ = symstack[-plen-1:] targ[0] = sym # --! TRACKING if tracking: t1 = targ[1] sym.lineno = t1.lineno sym.lexpos = t1.lexpos t1 = targ[-1] sym.endlineno = getattr(t1,"endlineno",t1.lineno) sym.endlexpos = getattr(t1,"endlexpos",t1.lexpos) # --! TRACKING # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # below as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object del symstack[-plen:] del statestack[-plen:] p.callable(pslice) # --! DEBUG debug.info("Result : %s", format_result(pslice[0])) # --! DEBUG symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else: # --! TRACKING if tracking: sym.lineno = lexer.lineno sym.lexpos = lexer.lexpos # --! TRACKING targ = [ sym ] # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # above as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object p.callable(pslice) # --! DEBUG debug.info("Result : %s", format_result(pslice[0])) # --! DEBUG symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if t == 0: n = symstack[-1] result = getattr(n,"value",None) # --! DEBUG debug.info("Done : Returning %s", format_result(result)) debug.info("PLY: PARSE DEBUG END") # --! DEBUG return result if t == None: # --! DEBUG debug.error('Error : %s', ("%s . %s" % (" ".join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip()) # --! DEBUG # We have some kind of parsing error here. To handle # this, we are going to push the current token onto # the tokenstack and replace it with an 'error' token. # If there are any synchronization rules, they may # catch it. # # In addition to pushing the error token, we call call # the user defined p_error() function if this is the # first syntax error. This function is only called if # errorcount == 0. if errorcount == 0 or self.errorok: errorcount = error_count self.errorok = 0 errtoken = lookahead if errtoken.type == "$end": errtoken = None # End of file! if self.errorfunc: global errok,token,restart errok = self.errok # Set some special functions available in error recovery token = get_token restart = self.restart if errtoken and not hasattr(errtoken,'lexer'): errtoken.lexer = lexer tok = self.errorfunc(errtoken) del errok, token, restart # Delete special functions if self.errorok: # User must have done some kind of panic # mode recovery on their own. The # returned token is the next lookahead lookahead = tok errtoken = None continue else: if errtoken: if hasattr(errtoken,"lineno"): lineno = lookahead.lineno else: lineno = 0 if lineno: sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type)) else: sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type) else: sys.stderr.write("yacc: Parse error in input. EOF\n") return else: errorcount = error_count # case 1: the statestack only has 1 entry on it. If we're in this state, the # entire parse has been rolled back and we're completely hosed. The token is # discarded and we just keep going. if len(statestack) <= 1 and lookahead.type != "$end": lookahead = None errtoken = None state = 0 # Nuke the pushback stack del lookaheadstack[:] continue # case 2: the statestack has a couple of entries on it, but we're # at the end of the file. nuke the top entry and generate an error token # Start nuking entries on the stack if lookahead.type == "$end": # Whoa. We're really hosed here. Bail out return if lookahead.type != 'error': sym = symstack[-1] if sym.type == 'error': # Hmmm. Error is on top of stack, we'll just nuke input # symbol and continue lookahead = None continue t = YaccSymbol() t.type = 'error' if hasattr(lookahead,"lineno"): t.lineno = lookahead.lineno t.value = lookahead lookaheadstack.append(lookahead) lookahead = t else: symstack.pop() statestack.pop() state = statestack[-1] # Potential bug fix continue # Call an error function here raise RuntimeError("yacc: internal parser error!!!\n") # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # parseopt(). # # Optimized version of parse() method. DO NOT EDIT THIS CODE DIRECTLY. # Edit the debug version above, then copy any modifications to the method # below while removing #--! DEBUG sections. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! def parseopt(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None): lookahead = None # Current lookahead symbol lookaheadstack = [ ] # Stack of lookahead symbols actions = self.action # Local reference to action table (to avoid lookup on self.) goto = self.goto # Local reference to goto table (to avoid lookup on self.) prod = self.productions # Local reference to production list (to avoid lookup on self.) pslice = YaccProduction(None) # Production object passed to grammar rules errorcount = 0 # Used during error recovery # If no lexer was given, we will try to use the lex module if not lexer: lex = load_ply_lex() lexer = lex.lexer # Set up the lexer and parser objects on pslice pslice.lexer = lexer pslice.parser = self # If input was supplied, pass to lexer if input is not None: lexer.input(input) if tokenfunc is None: # Tokenize function get_token = lexer.token else: get_token = tokenfunc # Set up the state and symbol stacks statestack = [ ] # Stack of parsing states self.statestack = statestack symstack = [ ] # Stack of grammar symbols self.symstack = symstack pslice.stack = symstack # Put in the production errtoken = None # Err token # The start state is assumed to be (0,$end) statestack.append(0) sym = YaccSymbol() sym.type = '$end' symstack.append(sym) state = 0 while 1: # Get the next symbol on the input. If a lookahead symbol # is already set, we just use that. Otherwise, we'll pull # the next token off of the lookaheadstack or from the lexer if not lookahead: if not lookaheadstack: lookahead = get_token() # Get the next token else: lookahead = lookaheadstack.pop() if not lookahead: lookahead = YaccSymbol() lookahead.type = '$end' # Check the action table ltype = lookahead.type t = actions[state].get(ltype) if t is not None: if t > 0: # shift a symbol on the stack statestack.append(t) state = t symstack.append(lookahead) lookahead = None # Decrease error count on successful shift if errorcount: errorcount -=1 continue if t < 0: # reduce a symbol on the stack, emit a production p = prod[-t] pname = p.name plen = p.len # Get production function sym = YaccSymbol() sym.type = pname # Production name sym.value = None if plen: targ = symstack[-plen-1:] targ[0] = sym # --! TRACKING if tracking: t1 = targ[1] sym.lineno = t1.lineno sym.lexpos = t1.lexpos t1 = targ[-1] sym.endlineno = getattr(t1,"endlineno",t1.lineno) sym.endlexpos = getattr(t1,"endlexpos",t1.lexpos) # --! TRACKING # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # below as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object del symstack[-plen:] del statestack[-plen:] p.callable(pslice) symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else: # --! TRACKING if tracking: sym.lineno = lexer.lineno sym.lexpos = lexer.lexpos # --! TRACKING targ = [ sym ] # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # above as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object p.callable(pslice) symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if t == 0: n = symstack[-1] return getattr(n,"value",None) if t == None: # We have some kind of parsing error here. To handle # this, we are going to push the current token onto # the tokenstack and replace it with an 'error' token. # If there are any synchronization rules, they may # catch it. # # In addition to pushing the error token, we call call # the user defined p_error() function if this is the # first syntax error. This function is only called if # errorcount == 0. if errorcount == 0 or self.errorok: errorcount = error_count self.errorok = 0 errtoken = lookahead if errtoken.type == '$end': errtoken = None # End of file! if self.errorfunc: global errok,token,restart errok = self.errok # Set some special functions available in error recovery token = get_token restart = self.restart if errtoken and not hasattr(errtoken,'lexer'): errtoken.lexer = lexer tok = self.errorfunc(errtoken) del errok, token, restart # Delete special functions if self.errorok: # User must have done some kind of panic # mode recovery on their own. The # returned token is the next lookahead lookahead = tok errtoken = None continue else: if errtoken: if hasattr(errtoken,"lineno"): lineno = lookahead.lineno else: lineno = 0 if lineno: sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type)) else: sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type) else: sys.stderr.write("yacc: Parse error in input. EOF\n") return else: errorcount = error_count # case 1: the statestack only has 1 entry on it. If we're in this state, the # entire parse has been rolled back and we're completely hosed. The token is # discarded and we just keep going. if len(statestack) <= 1 and lookahead.type != '$end': lookahead = None errtoken = None state = 0 # Nuke the pushback stack del lookaheadstack[:] continue # case 2: the statestack has a couple of entries on it, but we're # at the end of the file. nuke the top entry and generate an error token # Start nuking entries on the stack if lookahead.type == '$end': # Whoa. We're really hosed here. Bail out return if lookahead.type != 'error': sym = symstack[-1] if sym.type == 'error': # Hmmm. Error is on top of stack, we'll just nuke input # symbol and continue lookahead = None continue t = YaccSymbol() t.type = 'error' if hasattr(lookahead,"lineno"): t.lineno = lookahead.lineno t.value = lookahead lookaheadstack.append(lookahead) lookahead = t else: symstack.pop() statestack.pop() state = statestack[-1] # Potential bug fix continue # Call an error function here raise RuntimeError("yacc: internal parser error!!!\n") # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # parseopt_notrack(). # # Optimized version of parseopt() with line number tracking removed. # DO NOT EDIT THIS CODE DIRECTLY. Copy the optimized version and remove # code in the #--! TRACKING sections # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! def parseopt_notrack(self,input=None,lexer=None,debug=0,tracking=0,tokenfunc=None): lookahead = None # Current lookahead symbol lookaheadstack = [ ] # Stack of lookahead symbols actions = self.action # Local reference to action table (to avoid lookup on self.) goto = self.goto # Local reference to goto table (to avoid lookup on self.) prod = self.productions # Local reference to production list (to avoid lookup on self.) pslice = YaccProduction(None) # Production object passed to grammar rules errorcount = 0 # Used during error recovery # If no lexer was given, we will try to use the lex module if not lexer: lex = load_ply_lex() lexer = lex.lexer # Set up the lexer and parser objects on pslice pslice.lexer = lexer pslice.parser = self # If input was supplied, pass to lexer if input is not None: lexer.input(input) if tokenfunc is None: # Tokenize function get_token = lexer.token else: get_token = tokenfunc # Set up the state and symbol stacks statestack = [ ] # Stack of parsing states self.statestack = statestack symstack = [ ] # Stack of grammar symbols self.symstack = symstack pslice.stack = symstack # Put in the production errtoken = None # Err token # The start state is assumed to be (0,$end) statestack.append(0) sym = YaccSymbol() sym.type = '$end' symstack.append(sym) state = 0 while 1: # Get the next symbol on the input. If a lookahead symbol # is already set, we just use that. Otherwise, we'll pull # the next token off of the lookaheadstack or from the lexer if not lookahead: if not lookaheadstack: lookahead = get_token() # Get the next token else: lookahead = lookaheadstack.pop() if not lookahead: lookahead = YaccSymbol() lookahead.type = '$end' # Check the action table ltype = lookahead.type t = actions[state].get(ltype) if t is not None: if t > 0: # shift a symbol on the stack statestack.append(t) state = t symstack.append(lookahead) lookahead = None # Decrease error count on successful shift if errorcount: errorcount -=1 continue if t < 0: # reduce a symbol on the stack, emit a production p = prod[-t] pname = p.name plen = p.len # Get production function sym = YaccSymbol() sym.type = pname # Production name sym.value = None if plen: targ = symstack[-plen-1:] targ[0] = sym # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # below as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object del symstack[-plen:] del statestack[-plen:] p.callable(pslice) symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else: targ = [ sym ] # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # The code enclosed in this section is duplicated # above as a performance optimization. Make sure # changes get made in both locations. pslice.slice = targ try: # Call the grammar rule with our special slice object p.callable(pslice) symstack.append(sym) state = goto[statestack[-1]][pname] statestack.append(state) except SyntaxError: # If an error was set. Enter error recovery state lookaheadstack.append(lookahead) symstack.pop() statestack.pop() state = statestack[-1] sym.type = 'error' lookahead = sym errorcount = error_count self.errorok = 0 continue # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if t == 0: n = symstack[-1] return getattr(n,"value",None) if t == None: # We have some kind of parsing error here. To handle # this, we are going to push the current token onto # the tokenstack and replace it with an 'error' token. # If there are any synchronization rules, they may # catch it. # # In addition to pushing the error token, we call call # the user defined p_error() function if this is the # first syntax error. This function is only called if # errorcount == 0. if errorcount == 0 or self.errorok: errorcount = error_count self.errorok = 0 errtoken = lookahead if errtoken.type == '$end': errtoken = None # End of file! if self.errorfunc: global errok,token,restart errok = self.errok # Set some special functions available in error recovery token = get_token restart = self.restart if errtoken and not hasattr(errtoken,'lexer'): errtoken.lexer = lexer tok = self.errorfunc(errtoken) del errok, token, restart # Delete special functions if self.errorok: # User must have done some kind of panic # mode recovery on their own. The # returned token is the next lookahead lookahead = tok errtoken = None continue else: if errtoken: if hasattr(errtoken,"lineno"): lineno = lookahead.lineno else: lineno = 0 if lineno: sys.stderr.write("yacc: Syntax error at line %d, token=%s\n" % (lineno, errtoken.type)) else: sys.stderr.write("yacc: Syntax error, token=%s" % errtoken.type) else: sys.stderr.write("yacc: Parse error in input. EOF\n") return else: errorcount = error_count # case 1: the statestack only has 1 entry on it. If we're in this state, the # entire parse has been rolled back and we're completely hosed. The token is # discarded and we just keep going. if len(statestack) <= 1 and lookahead.type != '$end': lookahead = None errtoken = None state = 0 # Nuke the pushback stack del lookaheadstack[:] continue # case 2: the statestack has a couple of entries on it, but we're # at the end of the file. nuke the top entry and generate an error token # Start nuking entries on the stack if lookahead.type == '$end': # Whoa. We're really hosed here. Bail out return if lookahead.type != 'error': sym = symstack[-1] if sym.type == 'error': # Hmmm. Error is on top of stack, we'll just nuke input # symbol and continue lookahead = None continue t = YaccSymbol() t.type = 'error' if hasattr(lookahead,"lineno"): t.lineno = lookahead.lineno t.value = lookahead lookaheadstack.append(lookahead) lookahead = t else: symstack.pop() statestack.pop() state = statestack[-1] # Potential bug fix continue # Call an error function here raise RuntimeError("yacc: internal parser error!!!\n") # ----------------------------------------------------------------------------- # === Grammar Representation === # # The following functions, classes, and variables are used to represent and # manipulate the rules that make up a grammar. # ----------------------------------------------------------------------------- import re # regex matching identifiers _is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$') # ----------------------------------------------------------------------------- # class Production: # # This class stores the raw information about a single production or grammar rule. # A grammar rule refers to a specification such as this: # # expr : expr PLUS term # # Here are the basic attributes defined on all productions # # name - Name of the production. For example 'expr' # prod - A list of symbols on the right side ['expr','PLUS','term'] # prec - Production precedence level # number - Production number. # func - Function that executes on reduce # file - File where production function is defined # lineno - Line number where production function is defined # # The following attributes are defined or optional. # # len - Length of the production (number of symbols on right hand side) # usyms - Set of unique symbols found in the production # ----------------------------------------------------------------------------- class Production(object): reduced = 0 def __init__(self,number,name,prod,precedence=('right',0),func=None,file='',line=0): self.name = name self.prod = tuple(prod) self.number = number self.func = func self.callable = None self.file = file self.line = line self.prec = precedence # Internal settings used during table construction self.len = len(self.prod) # Length of the production # Create a list of unique production symbols used in the production self.usyms = [ ] for s in self.prod: if s not in self.usyms: self.usyms.append(s) # List of all LR items for the production self.lr_items = [] self.lr_next = None # Create a string representation if self.prod: self.str = "%s -> %s" % (self.name," ".join(self.prod)) else: self.str = "%s -> " % self.name def __str__(self): return self.str def __repr__(self): return "Production("+str(self)+")" def __len__(self): return len(self.prod) def __nonzero__(self): return True def __getitem__(self,index): return self.prod[index] # Return the nth lr_item from the production (or None if at the end) def lr_item(self,n): if n > len(self.prod): return None p = LRItem(self,n) # Precompute the list of productions immediately following. Hack. Remove later try: p.lr_after = Prodnames[p.prod[n+1]] except (IndexError,KeyError): p.lr_after = [] try: p.lr_before = p.prod[n-1] except IndexError: p.lr_before = None return p # Bind the production function name to a callable def bind(self,pdict): if self.func: self.callable = pdict[self.func] # This class serves as a minimal standin for Production objects when # reading table data from files. It only contains information # actually used by the LR parsing engine, plus some additional # debugging information. class MiniProduction(object): def __init__(self,str,name,len,func,file,line): self.name = name self.len = len self.func = func self.callable = None self.file = file self.line = line self.str = str def __str__(self): return self.str def __repr__(self): return "MiniProduction(%s)" % self.str # Bind the production function name to a callable def bind(self,pdict): if self.func: self.callable = pdict[self.func] # ----------------------------------------------------------------------------- # class LRItem # # This class represents a specific stage of parsing a production rule. For # example: # # expr : expr . PLUS term # # In the above, the "." represents the current location of the parse. Here # basic attributes: # # name - Name of the production. For example 'expr' # prod - A list of symbols on the right side ['expr','.', 'PLUS','term'] # number - Production number. # # lr_next Next LR item. Example, if we are ' expr -> expr . PLUS term' # then lr_next refers to 'expr -> expr PLUS . term' # lr_index - LR item index (location of the ".") in the prod list. # lookaheads - LALR lookahead symbols for this item # len - Length of the production (number of symbols on right hand side) # lr_after - List of all productions that immediately follow # lr_before - Grammar symbol immediately before # ----------------------------------------------------------------------------- class LRItem(object): def __init__(self,p,n): self.name = p.name self.prod = list(p.prod) self.number = p.number self.lr_index = n self.lookaheads = { } self.prod.insert(n,".") self.prod = tuple(self.prod) self.len = len(self.prod) self.usyms = p.usyms def __str__(self): if self.prod: s = "%s -> %s" % (self.name," ".join(self.prod)) else: s = "%s -> " % self.name return s def __repr__(self): return "LRItem("+str(self)+")" # ----------------------------------------------------------------------------- # rightmost_terminal() # # Return the rightmost terminal from a list of symbols. Used in add_production() # ----------------------------------------------------------------------------- def rightmost_terminal(symbols, terminals): i = len(symbols) - 1 while i >= 0: if symbols[i] in terminals: return symbols[i] i -= 1 return None # ----------------------------------------------------------------------------- # === GRAMMAR CLASS === # # The following class represents the contents of the specified grammar along # with various computed properties such as first sets, follow sets, LR items, etc. # This data is used for critical parts of the table generation process later. # ----------------------------------------------------------------------------- class GrammarError(YaccError): pass class Grammar(object): def __init__(self,terminals): self.Productions = [None] # A list of all of the productions. The first # entry is always reserved for the purpose of # building an augmented grammar self.Prodnames = { } # A dictionary mapping the names of nonterminals to a list of all # productions of that nonterminal. self.Prodmap = { } # A dictionary that is only used to detect duplicate # productions. self.Terminals = { } # A dictionary mapping the names of terminal symbols to a # list of the rules where they are used. for term in terminals: self.Terminals[term] = [] self.Terminals['error'] = [] self.Nonterminals = { } # A dictionary mapping names of nonterminals to a list # of rule numbers where they are used. self.First = { } # A dictionary of precomputed FIRST(x) symbols self.Follow = { } # A dictionary of precomputed FOLLOW(x) symbols self.Precedence = { } # Precedence rules for each terminal. Contains tuples of the # form ('right',level) or ('nonassoc', level) or ('left',level) self.UsedPrecedence = { } # Precedence rules that were actually used by the grammer. # This is only used to provide error checking and to generate # a warning about unused precedence rules. self.Start = None # Starting symbol for the grammar def __len__(self): return len(self.Productions) def __getitem__(self,index): return self.Productions[index] # ----------------------------------------------------------------------------- # set_precedence() # # Sets the precedence for a given terminal. assoc is the associativity such as # 'left','right', or 'nonassoc'. level is a numeric level. # # ----------------------------------------------------------------------------- def set_precedence(self,term,assoc,level): assert self.Productions == [None],"Must call set_precedence() before add_production()" if term in self.Precedence: raise GrammarError("Precedence already specified for terminal '%s'" % term) if assoc not in ['left','right','nonassoc']: raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'") self.Precedence[term] = (assoc,level) # ----------------------------------------------------------------------------- # add_production() # # Given an action function, this function assembles a production rule and # computes its precedence level. # # The production rule is supplied as a list of symbols. For example, # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and # symbols ['expr','PLUS','term']. # # Precedence is determined by the precedence of the right-most non-terminal # or the precedence of a terminal specified by %prec. # # A variety of error checks are performed to make sure production symbols # are valid and that %prec is used correctly. # ----------------------------------------------------------------------------- def add_production(self,prodname,syms,func=None,file='',line=0): if prodname in self.Terminals: raise GrammarError("%s:%d: Illegal rule name '%s'. Already defined as a token" % (file,line,prodname)) if prodname == 'error': raise GrammarError("%s:%d: Illegal rule name '%s'. error is a reserved word" % (file,line,prodname)) if not _is_identifier.match(prodname): raise GrammarError("%s:%d: Illegal rule name '%s'" % (file,line,prodname)) # Look for literal tokens for n,s in enumerate(syms): if s[0] in "'\"": try: c = eval(s) if (len(c) > 1): raise GrammarError("%s:%d: Literal token %s in rule '%s' may only be a single character" % (file,line,s, prodname)) if not c in self.Terminals: self.Terminals[c] = [] syms[n] = c continue except SyntaxError: pass if not _is_identifier.match(s) and s != '%prec': raise GrammarError("%s:%d: Illegal name '%s' in rule '%s'" % (file,line,s, prodname)) # Determine the precedence level if '%prec' in syms: if syms[-1] == '%prec': raise GrammarError("%s:%d: Syntax error. Nothing follows %%prec" % (file,line)) if syms[-2] != '%prec': raise GrammarError("%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule" % (file,line)) precname = syms[-1] prodprec = self.Precedence.get(precname,None) if not prodprec: raise GrammarError("%s:%d: Nothing known about the precedence of '%s'" % (file,line,precname)) else: self.UsedPrecedence[precname] = 1 del syms[-2:] # Drop %prec from the rule else: # If no %prec, precedence is determined by the rightmost terminal symbol precname = rightmost_terminal(syms,self.Terminals) prodprec = self.Precedence.get(precname,('right',0)) # See if the rule is already in the rulemap map = "%s -> %s" % (prodname,syms) if map in self.Prodmap: m = self.Prodmap[map] raise GrammarError("%s:%d: Duplicate rule %s. " % (file,line, m) + "Previous definition at %s:%d" % (m.file, m.line)) # From this point on, everything is valid. Create a new Production instance pnumber = len(self.Productions) if not prodname in self.Nonterminals: self.Nonterminals[prodname] = [ ] # Add the production number to Terminals and Nonterminals for t in syms: if t in self.Terminals: self.Terminals[t].append(pnumber) else: if not t in self.Nonterminals: self.Nonterminals[t] = [ ] self.Nonterminals[t].append(pnumber) # Create a production and add it to the list of productions p = Production(pnumber,prodname,syms,prodprec,func,file,line) self.Productions.append(p) self.Prodmap[map] = p # Add to the global productions list try: self.Prodnames[prodname].append(p) except KeyError: self.Prodnames[prodname] = [ p ] return 0 # ----------------------------------------------------------------------------- # set_start() # # Sets the starting symbol and creates the augmented grammar. Production # rule 0 is S' -> start where start is the start symbol. # ----------------------------------------------------------------------------- def set_start(self,start=None): if not start: start = self.Productions[1].name if start not in self.Nonterminals: raise GrammarError("start symbol %s undefined" % start) self.Productions[0] = Production(0,"S'",[start]) self.Nonterminals[start].append(0) self.Start = start # ----------------------------------------------------------------------------- # find_unreachable() # # Find all of the nonterminal symbols that can't be reached from the starting # symbol. Returns a list of nonterminals that can't be reached. # ----------------------------------------------------------------------------- def find_unreachable(self): # Mark all symbols that are reachable from a symbol s def mark_reachable_from(s): if reachable[s]: # We've already reached symbol s. return reachable[s] = 1 for p in self.Prodnames.get(s,[]): for r in p.prod: mark_reachable_from(r) reachable = { } for s in list(self.Terminals) + list(self.Nonterminals): reachable[s] = 0 mark_reachable_from( self.Productions[0].prod[0] ) return [s for s in list(self.Nonterminals) if not reachable[s]] # ----------------------------------------------------------------------------- # infinite_cycles() # # This function looks at the various parsing rules and tries to detect # infinite recursion cycles (grammar rules where there is no possible way # to derive a string of only terminals). # ----------------------------------------------------------------------------- def infinite_cycles(self): terminates = {} # Terminals: for t in self.Terminals: terminates[t] = 1 terminates['$end'] = 1 # Nonterminals: # Initialize to false: for n in self.Nonterminals: terminates[n] = 0 # Then propagate termination until no change: while 1: some_change = 0 for (n,pl) in self.Prodnames.items(): # Nonterminal n terminates iff any of its productions terminates. for p in pl: # Production p terminates iff all of its rhs symbols terminate. for s in p.prod: if not terminates[s]: # The symbol s does not terminate, # so production p does not terminate. p_terminates = 0 break else: # didn't break from the loop, # so every symbol s terminates # so production p terminates. p_terminates = 1 if p_terminates: # symbol n terminates! if not terminates[n]: terminates[n] = 1 some_change = 1 # Don't need to consider any more productions for this n. break if not some_change: break infinite = [] for (s,term) in terminates.items(): if not term: if not s in self.Prodnames and not s in self.Terminals and s != 'error': # s is used-but-not-defined, and we've already warned of that, # so it would be overkill to say that it's also non-terminating. pass else: infinite.append(s) return infinite # ----------------------------------------------------------------------------- # undefined_symbols() # # Find all symbols that were used the grammar, but not defined as tokens or # grammar rules. Returns a list of tuples (sym, prod) where sym in the symbol # and prod is the production where the symbol was used. # ----------------------------------------------------------------------------- def undefined_symbols(self): result = [] for p in self.Productions: if not p: continue for s in p.prod: if not s in self.Prodnames and not s in self.Terminals and s != 'error': result.append((s,p)) return result # ----------------------------------------------------------------------------- # unused_terminals() # # Find all terminals that were defined, but not used by the grammar. Returns # a list of all symbols. # ----------------------------------------------------------------------------- def unused_terminals(self): unused_tok = [] for s,v in self.Terminals.items(): if s != 'error' and not v: unused_tok.append(s) return unused_tok # ------------------------------------------------------------------------------ # unused_rules() # # Find all grammar rules that were defined, but not used (maybe not reachable) # Returns a list of productions. # ------------------------------------------------------------------------------ def unused_rules(self): unused_prod = [] for s,v in self.Nonterminals.items(): if not v: p = self.Prodnames[s][0] unused_prod.append(p) return unused_prod # ----------------------------------------------------------------------------- # unused_precedence() # # Returns a list of tuples (term,precedence) corresponding to precedence # rules that were never used by the grammar. term is the name of the terminal # on which precedence was applied and precedence is a string such as 'left' or # 'right' corresponding to the type of precedence. # ----------------------------------------------------------------------------- def unused_precedence(self): unused = [] for termname in self.Precedence: if not (termname in self.Terminals or termname in self.UsedPrecedence): unused.append((termname,self.Precedence[termname][0])) return unused # ------------------------------------------------------------------------- # _first() # # Compute the value of FIRST1(beta) where beta is a tuple of symbols. # # During execution of compute_first1, the result may be incomplete. # Afterward (e.g., when called from compute_follow()), it will be complete. # ------------------------------------------------------------------------- def _first(self,beta): # We are computing First(x1,x2,x3,...,xn) result = [ ] for x in beta: x_produces_empty = 0 # Add all the non- symbols of First[x] to the result. for f in self.First[x]: if f == '': x_produces_empty = 1 else: if f not in result: result.append(f) if x_produces_empty: # We have to consider the next x in beta, # i.e. stay in the loop. pass else: # We don't have to consider any further symbols in beta. break else: # There was no 'break' from the loop, # so x_produces_empty was true for all x in beta, # so beta produces empty as well. result.append('') return result # ------------------------------------------------------------------------- # compute_first() # # Compute the value of FIRST1(X) for all symbols # ------------------------------------------------------------------------- def compute_first(self): if self.First: return self.First # Terminals: for t in self.Terminals: self.First[t] = [t] self.First['$end'] = ['$end'] # Nonterminals: # Initialize to the empty set: for n in self.Nonterminals: self.First[n] = [] # Then propagate symbols until no change: while 1: some_change = 0 for n in self.Nonterminals: for p in self.Prodnames[n]: for f in self._first(p.prod): if f not in self.First[n]: self.First[n].append( f ) some_change = 1 if not some_change: break return self.First # --------------------------------------------------------------------- # compute_follow() # # Computes all of the follow sets for every non-terminal symbol. The # follow set is the set of all symbols that might follow a given # non-terminal. See the Dragon book, 2nd Ed. p. 189. # --------------------------------------------------------------------- def compute_follow(self,start=None): # If already computed, return the result if self.Follow: return self.Follow # If first sets not computed yet, do that first. if not self.First: self.compute_first() # Add '$end' to the follow list of the start symbol for k in self.Nonterminals: self.Follow[k] = [ ] if not start: start = self.Productions[1].name self.Follow[start] = [ '$end' ] while 1: didadd = 0 for p in self.Productions[1:]: # Here is the production set for i in range(len(p.prod)): B = p.prod[i] if B in self.Nonterminals: # Okay. We got a non-terminal in a production fst = self._first(p.prod[i+1:]) hasempty = 0 for f in fst: if f != '' and f not in self.Follow[B]: self.Follow[B].append(f) didadd = 1 if f == '': hasempty = 1 if hasempty or i == (len(p.prod)-1): # Add elements of follow(a) to follow(b) for f in self.Follow[p.name]: if f not in self.Follow[B]: self.Follow[B].append(f) didadd = 1 if not didadd: break return self.Follow # ----------------------------------------------------------------------------- # build_lritems() # # This function walks the list of productions and builds a complete set of the # LR items. The LR items are stored in two ways: First, they are uniquely # numbered and placed in the list _lritems. Second, a linked list of LR items # is built for each production. For example: # # E -> E PLUS E # # Creates the list # # [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ] # ----------------------------------------------------------------------------- def build_lritems(self): for p in self.Productions: lastlri = p i = 0 lr_items = [] while 1: if i > len(p): lri = None else: lri = LRItem(p,i) # Precompute the list of productions immediately following try: lri.lr_after = self.Prodnames[lri.prod[i+1]] except (IndexError,KeyError): lri.lr_after = [] try: lri.lr_before = lri.prod[i-1] except IndexError: lri.lr_before = None lastlri.lr_next = lri if not lri: break lr_items.append(lri) lastlri = lri i += 1 p.lr_items = lr_items # ----------------------------------------------------------------------------- # == Class LRTable == # # This basic class represents a basic table of LR parsing information. # Methods for generating the tables are not defined here. They are defined # in the derived class LRGeneratedTable. # ----------------------------------------------------------------------------- class VersionError(YaccError): pass class LRTable(object): def __init__(self): self.lr_action = None self.lr_goto = None self.lr_productions = None self.lr_method = None def read_table(self,module): if isinstance(module,types.ModuleType): parsetab = module else: if sys.version_info[0] < 3: exec("import %s as parsetab" % module) else: env = { } exec("import %s as parsetab" % module, env, env) parsetab = env['parsetab'] if parsetab._tabversion != __tabversion__: raise VersionError("yacc table file version is out of date") self.lr_action = parsetab._lr_action self.lr_goto = parsetab._lr_goto self.lr_productions = [] for p in parsetab._lr_productions: self.lr_productions.append(MiniProduction(*p)) self.lr_method = parsetab._lr_method return parsetab._lr_signature def read_pickle(self,filename): try: import cPickle as pickle except ImportError: import pickle in_f = open(filename,"rb") tabversion = pickle.load(in_f) if tabversion != __tabversion__: raise VersionError("yacc table file version is out of date") self.lr_method = pickle.load(in_f) signature = pickle.load(in_f) self.lr_action = pickle.load(in_f) self.lr_goto = pickle.load(in_f) productions = pickle.load(in_f) self.lr_productions = [] for p in productions: self.lr_productions.append(MiniProduction(*p)) in_f.close() return signature # Bind all production function names to callable objects in pdict def bind_callables(self,pdict): for p in self.lr_productions: p.bind(pdict) # ----------------------------------------------------------------------------- # === LR Generator === # # The following classes and functions are used to generate LR parsing tables on # a grammar. # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # digraph() # traverse() # # The following two functions are used to compute set valued functions # of the form: # # F(x) = F'(x) U U{F(y) | x R y} # # This is used to compute the values of Read() sets as well as FOLLOW sets # in LALR(1) generation. # # Inputs: X - An input set # R - A relation # FP - Set-valued function # ------------------------------------------------------------------------------ def digraph(X,R,FP): N = { } for x in X: N[x] = 0 stack = [] F = { } for x in X: if N[x] == 0: traverse(x,N,stack,F,X,R,FP) return F def traverse(x,N,stack,F,X,R,FP): stack.append(x) d = len(stack) N[x] = d F[x] = FP(x) # F(X) <- F'(x) rel = R(x) # Get y's related to x for y in rel: if N[y] == 0: traverse(y,N,stack,F,X,R,FP) N[x] = min(N[x],N[y]) for a in F.get(y,[]): if a not in F[x]: F[x].append(a) if N[x] == d: N[stack[-1]] = MAXINT F[stack[-1]] = F[x] element = stack.pop() while element != x: N[stack[-1]] = MAXINT F[stack[-1]] = F[x] element = stack.pop() class LALRError(YaccError): pass # ----------------------------------------------------------------------------- # == LRGeneratedTable == # # This class implements the LR table generation algorithm. There are no # public methods except for write() # ----------------------------------------------------------------------------- class LRGeneratedTable(LRTable): def __init__(self,grammar,method='LALR',log=None): if method not in ['SLR','LALR']: raise LALRError("Unsupported method %s" % method) self.grammar = grammar self.lr_method = method # Set up the logger if not log: log = NullLogger() self.log = log # Internal attributes self.lr_action = {} # Action table self.lr_goto = {} # Goto table self.lr_productions = grammar.Productions # Copy of grammar Production array self.lr_goto_cache = {} # Cache of computed gotos self.lr0_cidhash = {} # Cache of closures self._add_count = 0 # Internal counter used to detect cycles # Diagonistic information filled in by the table generator self.sr_conflict = 0 self.rr_conflict = 0 self.conflicts = [] # List of conflicts self.sr_conflicts = [] self.rr_conflicts = [] # Build the tables self.grammar.build_lritems() self.grammar.compute_first() self.grammar.compute_follow() self.lr_parse_table() # Compute the LR(0) closure operation on I, where I is a set of LR(0) items. def lr0_closure(self,I): self._add_count += 1 # Add everything in I to J J = I[:] didadd = 1 while didadd: didadd = 0 for j in J: for x in j.lr_after: if getattr(x,"lr0_added",0) == self._add_count: continue # Add B --> .G to J J.append(x.lr_next) x.lr0_added = self._add_count didadd = 1 return J # Compute the LR(0) goto function goto(I,X) where I is a set # of LR(0) items and X is a grammar symbol. This function is written # in a way that guarantees uniqueness of the generated goto sets # (i.e. the same goto set will never be returned as two different Python # objects). With uniqueness, we can later do fast set comparisons using # id(obj) instead of element-wise comparison. def lr0_goto(self,I,x): # First we look for a previously cached entry g = self.lr_goto_cache.get((id(I),x),None) if g: return g # Now we generate the goto set in a way that guarantees uniqueness # of the result s = self.lr_goto_cache.get(x,None) if not s: s = { } self.lr_goto_cache[x] = s gs = [ ] for p in I: n = p.lr_next if n and n.lr_before == x: s1 = s.get(id(n),None) if not s1: s1 = { } s[id(n)] = s1 gs.append(n) s = s1 g = s.get('$end',None) if not g: if gs: g = self.lr0_closure(gs) s['$end'] = g else: s['$end'] = gs self.lr_goto_cache[(id(I),x)] = g return g # Compute the LR(0) sets of item function def lr0_items(self): C = [ self.lr0_closure([self.grammar.Productions[0].lr_next]) ] i = 0 for I in C: self.lr0_cidhash[id(I)] = i i += 1 # Loop over the items in C and each grammar symbols i = 0 while i < len(C): I = C[i] i += 1 # Collect all of the symbols that could possibly be in the goto(I,X) sets asyms = { } for ii in I: for s in ii.usyms: asyms[s] = None for x in asyms: g = self.lr0_goto(I,x) if not g: continue if id(g) in self.lr0_cidhash: continue self.lr0_cidhash[id(g)] = len(C) C.append(g) return C # ----------------------------------------------------------------------------- # ==== LALR(1) Parsing ==== # # LALR(1) parsing is almost exactly the same as SLR except that instead of # relying upon Follow() sets when performing reductions, a more selective # lookahead set that incorporates the state of the LR(0) machine is utilized. # Thus, we mainly just have to focus on calculating the lookahead sets. # # The method used here is due to DeRemer and Pennelo (1982). # # DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1) # Lookahead Sets", ACM Transactions on Programming Languages and Systems, # Vol. 4, No. 4, Oct. 1982, pp. 615-649 # # Further details can also be found in: # # J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing", # McGraw-Hill Book Company, (1985). # # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # compute_nullable_nonterminals() # # Creates a dictionary containing all of the non-terminals that might produce # an empty production. # ----------------------------------------------------------------------------- def compute_nullable_nonterminals(self): nullable = {} num_nullable = 0 while 1: for p in self.grammar.Productions[1:]: if p.len == 0: nullable[p.name] = 1 continue for t in p.prod: if not t in nullable: break else: nullable[p.name] = 1 if len(nullable) == num_nullable: break num_nullable = len(nullable) return nullable # ----------------------------------------------------------------------------- # find_nonterminal_trans(C) # # Given a set of LR(0) items, this functions finds all of the non-terminal # transitions. These are transitions in which a dot appears immediately before # a non-terminal. Returns a list of tuples of the form (state,N) where state # is the state number and N is the nonterminal symbol. # # The input C is the set of LR(0) items. # ----------------------------------------------------------------------------- def find_nonterminal_transitions(self,C): trans = [] for state in range(len(C)): for p in C[state]: if p.lr_index < p.len - 1: t = (state,p.prod[p.lr_index+1]) if t[1] in self.grammar.Nonterminals: if t not in trans: trans.append(t) state = state + 1 return trans # ----------------------------------------------------------------------------- # dr_relation() # # Computes the DR(p,A) relationships for non-terminal transitions. The input # is a tuple (state,N) where state is a number and N is a nonterminal symbol. # # Returns a list of terminals. # ----------------------------------------------------------------------------- def dr_relation(self,C,trans,nullable): dr_set = { } state,N = trans terms = [] g = self.lr0_goto(C[state],N) for p in g: if p.lr_index < p.len - 1: a = p.prod[p.lr_index+1] if a in self.grammar.Terminals: if a not in terms: terms.append(a) # This extra bit is to handle the start state if state == 0 and N == self.grammar.Productions[0].prod[0]: terms.append('$end') return terms # ----------------------------------------------------------------------------- # reads_relation() # # Computes the READS() relation (p,A) READS (t,C). # ----------------------------------------------------------------------------- def reads_relation(self,C, trans, empty): # Look for empty transitions rel = [] state, N = trans g = self.lr0_goto(C[state],N) j = self.lr0_cidhash.get(id(g),-1) for p in g: if p.lr_index < p.len - 1: a = p.prod[p.lr_index + 1] if a in empty: rel.append((j,a)) return rel # ----------------------------------------------------------------------------- # compute_lookback_includes() # # Determines the lookback and includes relations # # LOOKBACK: # # This relation is determined by running the LR(0) state machine forward. # For example, starting with a production "N : . A B C", we run it forward # to obtain "N : A B C ." We then build a relationship between this final # state and the starting state. These relationships are stored in a dictionary # lookdict. # # INCLUDES: # # Computes the INCLUDE() relation (p,A) INCLUDES (p',B). # # This relation is used to determine non-terminal transitions that occur # inside of other non-terminal transition states. (p,A) INCLUDES (p', B) # if the following holds: # # B -> LAT, where T -> epsilon and p' -L-> p # # L is essentially a prefix (which may be empty), T is a suffix that must be # able to derive an empty string. State p' must lead to state p with the string L. # # ----------------------------------------------------------------------------- def compute_lookback_includes(self,C,trans,nullable): lookdict = {} # Dictionary of lookback relations includedict = {} # Dictionary of include relations # Make a dictionary of non-terminal transitions dtrans = {} for t in trans: dtrans[t] = 1 # Loop over all transitions and compute lookbacks and includes for state,N in trans: lookb = [] includes = [] for p in C[state]: if p.name != N: continue # Okay, we have a name match. We now follow the production all the way # through the state machine until we get the . on the right hand side lr_index = p.lr_index j = state while lr_index < p.len - 1: lr_index = lr_index + 1 t = p.prod[lr_index] # Check to see if this symbol and state are a non-terminal transition if (j,t) in dtrans: # Yes. Okay, there is some chance that this is an includes relation # the only way to know for certain is whether the rest of the # production derives empty li = lr_index + 1 while li < p.len: if p.prod[li] in self.grammar.Terminals: break # No forget it if not p.prod[li] in nullable: break li = li + 1 else: # Appears to be a relation between (j,t) and (state,N) includes.append((j,t)) g = self.lr0_goto(C[j],t) # Go to next set j = self.lr0_cidhash.get(id(g),-1) # Go to next state # When we get here, j is the final state, now we have to locate the production for r in C[j]: if r.name != p.name: continue if r.len != p.len: continue i = 0 # This look is comparing a production ". A B C" with "A B C ." while i < r.lr_index: if r.prod[i] != p.prod[i+1]: break i = i + 1 else: lookb.append((j,r)) for i in includes: if not i in includedict: includedict[i] = [] includedict[i].append((state,N)) lookdict[(state,N)] = lookb return lookdict,includedict # ----------------------------------------------------------------------------- # compute_read_sets() # # Given a set of LR(0) items, this function computes the read sets. # # Inputs: C = Set of LR(0) items # ntrans = Set of nonterminal transitions # nullable = Set of empty transitions # # Returns a set containing the read sets # ----------------------------------------------------------------------------- def compute_read_sets(self,C, ntrans, nullable): FP = lambda x: self.dr_relation(C,x,nullable) R = lambda x: self.reads_relation(C,x,nullable) F = digraph(ntrans,R,FP) return F # ----------------------------------------------------------------------------- # compute_follow_sets() # # Given a set of LR(0) items, a set of non-terminal transitions, a readset, # and an include set, this function computes the follow sets # # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)} # # Inputs: # ntrans = Set of nonterminal transitions # readsets = Readset (previously computed) # inclsets = Include sets (previously computed) # # Returns a set containing the follow sets # ----------------------------------------------------------------------------- def compute_follow_sets(self,ntrans,readsets,inclsets): FP = lambda x: readsets[x] R = lambda x: inclsets.get(x,[]) F = digraph(ntrans,R,FP) return F # ----------------------------------------------------------------------------- # add_lookaheads() # # Attaches the lookahead symbols to grammar rules. # # Inputs: lookbacks - Set of lookback relations # followset - Computed follow set # # This function directly attaches the lookaheads to productions contained # in the lookbacks set # ----------------------------------------------------------------------------- def add_lookaheads(self,lookbacks,followset): for trans,lb in lookbacks.items(): # Loop over productions in lookback for state,p in lb: if not state in p.lookaheads: p.lookaheads[state] = [] f = followset.get(trans,[]) for a in f: if a not in p.lookaheads[state]: p.lookaheads[state].append(a) # ----------------------------------------------------------------------------- # add_lalr_lookaheads() # # This function does all of the work of adding lookahead information for use # with LALR parsing # ----------------------------------------------------------------------------- def add_lalr_lookaheads(self,C): # Determine all of the nullable nonterminals nullable = self.compute_nullable_nonterminals() # Find all non-terminal transitions trans = self.find_nonterminal_transitions(C) # Compute read sets readsets = self.compute_read_sets(C,trans,nullable) # Compute lookback/includes relations lookd, included = self.compute_lookback_includes(C,trans,nullable) # Compute LALR FOLLOW sets followsets = self.compute_follow_sets(trans,readsets,included) # Add all of the lookaheads self.add_lookaheads(lookd,followsets) # ----------------------------------------------------------------------------- # lr_parse_table() # # This function constructs the parse tables for SLR or LALR # ----------------------------------------------------------------------------- def lr_parse_table(self): Productions = self.grammar.Productions Precedence = self.grammar.Precedence goto = self.lr_goto # Goto array action = self.lr_action # Action array log = self.log # Logger for output actionp = { } # Action production array (temporary) log.info("Parsing method: %s", self.lr_method) # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items # This determines the number of states C = self.lr0_items() if self.lr_method == 'LALR': self.add_lalr_lookaheads(C) # Build the parser table, state by state st = 0 for I in C: # Loop over each production in I actlist = [ ] # List of actions st_action = { } st_actionp = { } st_goto = { } log.info("") log.info("state %d", st) log.info("") for p in I: log.info(" (%d) %s", p.number, str(p)) log.info("") for p in I: if p.len == p.lr_index + 1: if p.name == "S'": # Start symbol. Accept! st_action["$end"] = 0 st_actionp["$end"] = p else: # We are at the end of a production. Reduce! if self.lr_method == 'LALR': laheads = p.lookaheads[st] else: laheads = self.grammar.Follow[p.name] for a in laheads: actlist.append((a,p,"reduce using rule %d (%s)" % (p.number,p))) r = st_action.get(a,None) if r is not None: # Whoa. Have a shift/reduce or reduce/reduce conflict if r > 0: # Need to decide on shift or reduce here # By default we favor shifting. Need to add # some precedence rules here. sprec,slevel = Productions[st_actionp[a].number].prec rprec,rlevel = Precedence.get(a,('right',0)) if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')): # We really need to reduce here. st_action[a] = -p.number st_actionp[a] = p if not slevel and not rlevel: log.info(" ! shift/reduce conflict for %s resolved as reduce",a) self.sr_conflicts.append((st,a,'reduce')) Productions[p.number].reduced += 1 elif (slevel == rlevel) and (rprec == 'nonassoc'): st_action[a] = None else: # Hmmm. Guess we'll keep the shift if not rlevel: log.info(" ! shift/reduce conflict for %s resolved as shift",a) self.sr_conflicts.append((st,a,'shift')) elif r < 0: # Reduce/reduce conflict. In this case, we favor the rule # that was defined first in the grammar file oldp = Productions[-r] pp = Productions[p.number] if oldp.line > pp.line: st_action[a] = -p.number st_actionp[a] = p chosenp,rejectp = pp,oldp Productions[p.number].reduced += 1 Productions[oldp.number].reduced -= 1 else: chosenp,rejectp = oldp,pp self.rr_conflicts.append((st,chosenp,rejectp)) log.info(" ! reduce/reduce conflict for %s resolved using rule %d (%s)", a,st_actionp[a].number, st_actionp[a]) else: raise LALRError("Unknown conflict in state %d" % st) else: st_action[a] = -p.number st_actionp[a] = p Productions[p.number].reduced += 1 else: i = p.lr_index a = p.prod[i+1] # Get symbol right after the "." if a in self.grammar.Terminals: g = self.lr0_goto(I,a) j = self.lr0_cidhash.get(id(g),-1) if j >= 0: # We are in a shift state actlist.append((a,p,"shift and go to state %d" % j)) r = st_action.get(a,None) if r is not None: # Whoa have a shift/reduce or shift/shift conflict if r > 0: if r != j: raise LALRError("Shift/shift conflict in state %d" % st) elif r < 0: # Do a precedence check. # - if precedence of reduce rule is higher, we reduce. # - if precedence of reduce is same and left assoc, we reduce. # - otherwise we shift rprec,rlevel = Productions[st_actionp[a].number].prec sprec,slevel = Precedence.get(a,('right',0)) if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')): # We decide to shift here... highest precedence to shift Productions[st_actionp[a].number].reduced -= 1 st_action[a] = j st_actionp[a] = p if not rlevel: log.info(" ! shift/reduce conflict for %s resolved as shift",a) self.sr_conflicts.append((st,a,'shift')) elif (slevel == rlevel) and (rprec == 'nonassoc'): st_action[a] = None else: # Hmmm. Guess we'll keep the reduce if not slevel and not rlevel: log.info(" ! shift/reduce conflict for %s resolved as reduce",a) self.sr_conflicts.append((st,a,'reduce')) else: raise LALRError("Unknown conflict in state %d" % st) else: st_action[a] = j st_actionp[a] = p # Print the actions associated with each terminal _actprint = { } for a,p,m in actlist: if a in st_action: if p is st_actionp[a]: log.info(" %-15s %s",a,m) _actprint[(a,m)] = 1 log.info("") # Print the actions that were not used. (debugging) not_used = 0 for a,p,m in actlist: if a in st_action: if p is not st_actionp[a]: if not (a,m) in _actprint: log.debug(" ! %-15s [ %s ]",a,m) not_used = 1 _actprint[(a,m)] = 1 if not_used: log.debug("") # Construct the goto table for this state nkeys = { } for ii in I: for s in ii.usyms: if s in self.grammar.Nonterminals: nkeys[s] = None for n in nkeys: g = self.lr0_goto(I,n) j = self.lr0_cidhash.get(id(g),-1) if j >= 0: st_goto[n] = j log.info(" %-30s shift and go to state %d",n,j) action[st] = st_action actionp[st] = st_actionp goto[st] = st_goto st += 1 # ----------------------------------------------------------------------------- # write() # # This function writes the LR parsing tables to a file # ----------------------------------------------------------------------------- def write_table(self,modulename,outputdir='',signature=""): basemodulename = modulename.split(".")[-1] filename = os.path.join(outputdir,basemodulename) + ".py" try: f = open(filename,"w") f.write(""" # %s # This file is automatically generated. Do not edit. _tabversion = %r _lr_method = %r _lr_signature = %r """ % (filename, __tabversion__, self.lr_method, signature)) # Change smaller to 0 to go back to original tables smaller = 1 # Factor out names to try and make smaller if smaller: items = { } for s,nd in self.lr_action.items(): for name,v in nd.items(): i = items.get(name) if not i: i = ([],[]) items[name] = i i[0].append(s) i[1].append(v) f.write("\n_lr_action_items = {") for k,v in items.items(): f.write("%r:([" % k) for i in v[0]: f.write("%r," % i) f.write("],[") for i in v[1]: f.write("%r," % i) f.write("]),") f.write("}\n") f.write(""" _lr_action = { } for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = { } _lr_action[_x][_k] = _y del _lr_action_items """) else: f.write("\n_lr_action = { "); for k,v in self.lr_action.items(): f.write("(%r,%r):%r," % (k[0],k[1],v)) f.write("}\n"); if smaller: # Factor out names to try and make smaller items = { } for s,nd in self.lr_goto.items(): for name,v in nd.items(): i = items.get(name) if not i: i = ([],[]) items[name] = i i[0].append(s) i[1].append(v) f.write("\n_lr_goto_items = {") for k,v in items.items(): f.write("%r:([" % k) for i in v[0]: f.write("%r," % i) f.write("],[") for i in v[1]: f.write("%r," % i) f.write("]),") f.write("}\n") f.write(""" _lr_goto = { } for _k, _v in _lr_goto_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_goto: _lr_goto[_x] = { } _lr_goto[_x][_k] = _y del _lr_goto_items """) else: f.write("\n_lr_goto = { "); for k,v in self.lr_goto.items(): f.write("(%r,%r):%r," % (k[0],k[1],v)) f.write("}\n"); # Write production table f.write("_lr_productions = [\n") for p in self.lr_productions: if p.func: f.write(" (%r,%r,%d,%r,%r,%d),\n" % (p.str,p.name, p.len, p.func,p.file,p.line)) else: f.write(" (%r,%r,%d,None,None,None),\n" % (str(p),p.name, p.len)) f.write("]\n") f.close() except IOError: e = sys.exc_info()[1] sys.stderr.write("Unable to create '%s'\n" % filename) sys.stderr.write(str(e)+"\n") return # ----------------------------------------------------------------------------- # pickle_table() # # This function pickles the LR parsing tables to a supplied file object # ----------------------------------------------------------------------------- def pickle_table(self,filename,signature=""): try: import cPickle as pickle except ImportError: import pickle outf = open(filename,"wb") pickle.dump(__tabversion__,outf,pickle_protocol) pickle.dump(self.lr_method,outf,pickle_protocol) pickle.dump(signature,outf,pickle_protocol) pickle.dump(self.lr_action,outf,pickle_protocol) pickle.dump(self.lr_goto,outf,pickle_protocol) outp = [] for p in self.lr_productions: if p.func: outp.append((p.str,p.name, p.len, p.func,p.file,p.line)) else: outp.append((str(p),p.name,p.len,None,None,None)) pickle.dump(outp,outf,pickle_protocol) outf.close() # ----------------------------------------------------------------------------- # === INTROSPECTION === # # The following functions and classes are used to implement the PLY # introspection features followed by the yacc() function itself. # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- # get_caller_module_dict() # # This function returns a dictionary containing all of the symbols defined within # a caller further down the call stack. This is used to get the environment # associated with the yacc() call if none was provided. # ----------------------------------------------------------------------------- def get_caller_module_dict(levels): try: raise RuntimeError except RuntimeError: e,b,t = sys.exc_info() f = t.tb_frame while levels > 0: f = f.f_back levels -= 1 ldict = f.f_globals.copy() if f.f_globals != f.f_locals: ldict.update(f.f_locals) return ldict # ----------------------------------------------------------------------------- # parse_grammar() # # This takes a raw grammar rule string and parses it into production data # ----------------------------------------------------------------------------- def parse_grammar(doc,file,line): grammar = [] # Split the doc string into lines pstrings = doc.splitlines() lastp = None dline = line for ps in pstrings: dline += 1 p = ps.split() if not p: continue try: if p[0] == '|': # This is a continuation of a previous rule if not lastp: raise SyntaxError("%s:%d: Misplaced '|'" % (file,dline)) prodname = lastp syms = p[1:] else: prodname = p[0] lastp = prodname syms = p[2:] assign = p[1] if assign != ':' and assign != '::=': raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file,dline)) grammar.append((file,dline,prodname,syms)) except SyntaxError: raise except Exception: raise SyntaxError("%s:%d: Syntax error in rule '%s'" % (file,dline,ps.strip())) return grammar # ----------------------------------------------------------------------------- # ParserReflect() # # This class represents information extracted for building a parser including # start symbol, error function, tokens, precedence list, action functions, # etc. # ----------------------------------------------------------------------------- class ParserReflect(object): def __init__(self,pdict,log=None): self.pdict = pdict self.start = None self.error_func = None self.tokens = None self.modules = {} self.grammar = [] self.error = 0 if log is None: self.log = PlyLogger(sys.stderr) else: self.log = log # Get all of the basic information def get_all(self): self.get_start() self.get_error_func() self.get_tokens() self.get_precedence() self.get_pfunctions() # Validate all of the information def validate_all(self): self.validate_start() self.validate_error_func() self.validate_tokens() self.validate_precedence() self.validate_pfunctions() self.validate_modules() return self.error # Compute a signature over the grammar def signature(self): try: from hashlib import md5 except ImportError: from md5 import md5 try: sig = md5() if self.start: sig.update(self.start.encode('latin-1')) if self.prec: sig.update("".join(["".join(p) for p in self.prec]).encode('latin-1')) if self.tokens: sig.update(" ".join(self.tokens).encode('latin-1')) for f in self.pfuncs: if f[3]: sig.update(f[3].encode('latin-1')) except (TypeError,ValueError): pass return sig.digest() # ----------------------------------------------------------------------------- # validate_modules() # # This method checks to see if there are duplicated p_rulename() functions # in the parser module file. Without this function, it is really easy for # users to make mistakes by cutting and pasting code fragments (and it's a real # bugger to try and figure out why the resulting parser doesn't work). Therefore, # we just do a little regular expression pattern matching of def statements # to try and detect duplicates. # ----------------------------------------------------------------------------- def validate_modules(self): # Match def p_funcname( fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(') for module in self.modules.keys(): lines, linen = inspect.getsourcelines(module) counthash = { } for linen,l in enumerate(lines): linen += 1 m = fre.match(l) if m: name = m.group(1) prev = counthash.get(name) if not prev: counthash[name] = linen else: filename = inspect.getsourcefile(module) self.log.warning("%s:%d: Function %s redefined. Previously defined on line %d", filename,linen,name,prev) # Get the start symbol def get_start(self): self.start = self.pdict.get('start') # Validate the start symbol def validate_start(self): if self.start is not None: if not isinstance(self.start,str): self.log.error("'start' must be a string") # Look for error handler def get_error_func(self): self.error_func = self.pdict.get('p_error') # Validate the error function def validate_error_func(self): if self.error_func: if isinstance(self.error_func,types.FunctionType): ismethod = 0 elif isinstance(self.error_func, types.MethodType): ismethod = 1 else: self.log.error("'p_error' defined, but is not a function or method") self.error = 1 return eline = func_code(self.error_func).co_firstlineno efile = func_code(self.error_func).co_filename module = inspect.getmodule(self.error_func) self.modules[module] = 1 if (func_code(self.error_func).co_argcount != 1+ismethod): self.log.error("%s:%d: p_error() requires 1 argument",efile,eline) self.error = 1 # Get the tokens map def get_tokens(self): tokens = self.pdict.get("tokens",None) if not tokens: self.log.error("No token list is defined") self.error = 1 return if not isinstance(tokens,(list, tuple)): self.log.error("tokens must be a list or tuple") self.error = 1 return if not tokens: self.log.error("tokens is empty") self.error = 1 return self.tokens = tokens # Validate the tokens def validate_tokens(self): # Validate the tokens. if 'error' in self.tokens: self.log.error("Illegal token name 'error'. Is a reserved word") self.error = 1 return terminals = {} for n in self.tokens: if n in terminals: self.log.warning("Token '%s' multiply defined", n) terminals[n] = 1 # Get the precedence map (if any) def get_precedence(self): self.prec = self.pdict.get("precedence",None) # Validate and parse the precedence map def validate_precedence(self): preclist = [] if self.prec: if not isinstance(self.prec,(list,tuple)): self.log.error("precedence must be a list or tuple") self.error = 1 return for level,p in enumerate(self.prec): if not isinstance(p,(list,tuple)): self.log.error("Bad precedence table") self.error = 1 return if len(p) < 2: self.log.error("Malformed precedence entry %s. Must be (assoc, term, ..., term)",p) self.error = 1 return assoc = p[0] if not isinstance(assoc,str): self.log.error("precedence associativity must be a string") self.error = 1 return for term in p[1:]: if not isinstance(term,str): self.log.error("precedence items must be strings") self.error = 1 return preclist.append((term,assoc,level+1)) self.preclist = preclist # Get all p_functions from the grammar def get_pfunctions(self): p_functions = [] for name, item in self.pdict.items(): if name[:2] != 'p_': continue if name == 'p_error': continue if isinstance(item,(types.FunctionType,types.MethodType)): line = func_code(item).co_firstlineno module = inspect.getmodule(item) p_functions.append((line,module,name,item.__doc__)) # Sort all of the actions by line number p_functions.sort() self.pfuncs = p_functions # Validate all of the p_functions def validate_pfunctions(self): grammar = [] # Check for non-empty symbols if len(self.pfuncs) == 0: self.log.error("no rules of the form p_rulename are defined") self.error = 1 return for line, module, name, doc in self.pfuncs: file = inspect.getsourcefile(module) func = self.pdict[name] if isinstance(func, types.MethodType): reqargs = 2 else: reqargs = 1 if func_code(func).co_argcount > reqargs: self.log.error("%s:%d: Rule '%s' has too many arguments",file,line,func.__name__) self.error = 1 elif func_code(func).co_argcount < reqargs: self.log.error("%s:%d: Rule '%s' requires an argument",file,line,func.__name__) self.error = 1 elif not func.__doc__: self.log.warning("%s:%d: No documentation string specified in function '%s' (ignored)",file,line,func.__name__) else: try: parsed_g = parse_grammar(doc,file,line) for g in parsed_g: grammar.append((name, g)) except SyntaxError: e = sys.exc_info()[1] self.log.error(str(e)) self.error = 1 # Looks like a valid grammar rule # Mark the file in which defined. self.modules[module] = 1 # Secondary validation step that looks for p_ definitions that are not functions # or functions that look like they might be grammar rules. for n,v in self.pdict.items(): if n[0:2] == 'p_' and isinstance(v, (types.FunctionType, types.MethodType)): continue if n[0:2] == 't_': continue if n[0:2] == 'p_' and n != 'p_error': self.log.warning("'%s' not defined as a function", n) if ((isinstance(v,types.FunctionType) and func_code(v).co_argcount == 1) or (isinstance(v,types.MethodType) and func_code(v).co_argcount == 2)): try: doc = v.__doc__.split(" ") if doc[1] == ':': self.log.warning("%s:%d: Possible grammar rule '%s' defined without p_ prefix", func_code(v).co_filename, func_code(v).co_firstlineno,n) except Exception: pass self.grammar = grammar # ----------------------------------------------------------------------------- # yacc(module) # # Build a parser # ----------------------------------------------------------------------------- def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None, check_recursion=1, optimize=0, write_tables=1, debugfile=debug_file,outputdir='', debuglog=None, errorlog = None, picklefile=None): global parse # Reference to the parsing method of the last built parser # If pickling is enabled, table files are not created if picklefile: write_tables = 0 if errorlog is None: errorlog = PlyLogger(sys.stderr) # Get the module dictionary used for the parser if module: _items = [(k,getattr(module,k)) for k in dir(module)] pdict = dict(_items) else: pdict = get_caller_module_dict(2) # Collect parser information from the dictionary pinfo = ParserReflect(pdict,log=errorlog) pinfo.get_all() if pinfo.error: raise YaccError("Unable to build parser") # Check signature against table files (if any) signature = pinfo.signature() # Read the tables try: lr = LRTable() if picklefile: read_signature = lr.read_pickle(picklefile) else: read_signature = lr.read_table(tabmodule) if optimize or (read_signature == signature): try: lr.bind_callables(pinfo.pdict) parser = LRParser(lr,pinfo.error_func) parse = parser.parse return parser except Exception: e = sys.exc_info()[1] errorlog.warning("There was a problem loading the table file: %s", repr(e)) except VersionError: e = sys.exc_info() errorlog.warning(str(e)) except Exception: pass if debuglog is None: if debug: debuglog = PlyLogger(open(debugfile,"w")) else: debuglog = NullLogger() debuglog.info("Created by PLY version %s (http://www.dabeaz.com/ply)", __version__) errors = 0 # Validate the parser information if pinfo.validate_all(): raise YaccError("Unable to build parser") if not pinfo.error_func: errorlog.warning("no p_error() function is defined") # Create a grammar object grammar = Grammar(pinfo.tokens) # Set precedence level for terminals for term, assoc, level in pinfo.preclist: try: grammar.set_precedence(term,assoc,level) except GrammarError: e = sys.exc_info()[1] errorlog.warning("%s",str(e)) # Add productions to the grammar for funcname, gram in pinfo.grammar: file, line, prodname, syms = gram try: grammar.add_production(prodname,syms,funcname,file,line) except GrammarError: e = sys.exc_info()[1] errorlog.error("%s",str(e)) errors = 1 # Set the grammar start symbols try: if start is None: grammar.set_start(pinfo.start) else: grammar.set_start(start) except GrammarError: e = sys.exc_info()[1] errorlog.error(str(e)) errors = 1 if errors: raise YaccError("Unable to build parser") # Verify the grammar structure undefined_symbols = grammar.undefined_symbols() for sym, prod in undefined_symbols: errorlog.error("%s:%d: Symbol '%s' used, but not defined as a token or a rule",prod.file,prod.line,sym) errors = 1 unused_terminals = grammar.unused_terminals() if unused_terminals: debuglog.info("") debuglog.info("Unused terminals:") debuglog.info("") for term in unused_terminals: errorlog.warning("Token '%s' defined, but not used", term) debuglog.info(" %s", term) # Print out all productions to the debug log if debug: debuglog.info("") debuglog.info("Grammar") debuglog.info("") for n,p in enumerate(grammar.Productions): debuglog.info("Rule %-5d %s", n, p) # Find unused non-terminals unused_rules = grammar.unused_rules() for prod in unused_rules: errorlog.warning("%s:%d: Rule '%s' defined, but not used", prod.file, prod.line, prod.name) if len(unused_terminals) == 1: errorlog.warning("There is 1 unused token") if len(unused_terminals) > 1: errorlog.warning("There are %d unused tokens", len(unused_terminals)) if len(unused_rules) == 1: errorlog.warning("There is 1 unused rule") if len(unused_rules) > 1: errorlog.warning("There are %d unused rules", len(unused_rules)) if debug: debuglog.info("") debuglog.info("Terminals, with rules where they appear") debuglog.info("") terms = list(grammar.Terminals) terms.sort() for term in terms: debuglog.info("%-20s : %s", term, " ".join([str(s) for s in grammar.Terminals[term]])) debuglog.info("") debuglog.info("Nonterminals, with rules where they appear") debuglog.info("") nonterms = list(grammar.Nonterminals) nonterms.sort() for nonterm in nonterms: debuglog.info("%-20s : %s", nonterm, " ".join([str(s) for s in grammar.Nonterminals[nonterm]])) debuglog.info("") if check_recursion: unreachable = grammar.find_unreachable() for u in unreachable: errorlog.warning("Symbol '%s' is unreachable",u) infinite = grammar.infinite_cycles() for inf in infinite: errorlog.error("Infinite recursion detected for symbol '%s'", inf) errors = 1 unused_prec = grammar.unused_precedence() for term, assoc in unused_prec: errorlog.error("Precedence rule '%s' defined for unknown symbol '%s'", assoc, term) errors = 1 if errors: raise YaccError("Unable to build parser") # Run the LRGeneratedTable on the grammar if debug: errorlog.debug("Generating %s tables", method) lr = LRGeneratedTable(grammar,method,debuglog) if debug: num_sr = len(lr.sr_conflicts) # Report shift/reduce and reduce/reduce conflicts if num_sr == 1: errorlog.warning("1 shift/reduce conflict") elif num_sr > 1: errorlog.warning("%d shift/reduce conflicts", num_sr) num_rr = len(lr.rr_conflicts) if num_rr == 1: errorlog.warning("1 reduce/reduce conflict") elif num_rr > 1: errorlog.warning("%d reduce/reduce conflicts", num_rr) # Write out conflicts to the output file if debug and (lr.sr_conflicts or lr.rr_conflicts): debuglog.warning("") debuglog.warning("Conflicts:") debuglog.warning("") for state, tok, resolution in lr.sr_conflicts: debuglog.warning("shift/reduce conflict for %s in state %d resolved as %s", tok, state, resolution) already_reported = {} for state, rule, rejected in lr.rr_conflicts: if (state,id(rule),id(rejected)) in already_reported: continue debuglog.warning("reduce/reduce conflict in state %d resolved using rule (%s)", state, rule) debuglog.warning("rejected rule (%s) in state %d", rejected,state) errorlog.warning("reduce/reduce conflict in state %d resolved using rule (%s)", state, rule) errorlog.warning("rejected rule (%s) in state %d", rejected, state) already_reported[state,id(rule),id(rejected)] = 1 warned_never = [] for state, rule, rejected in lr.rr_conflicts: if not rejected.reduced and (rejected not in warned_never): debuglog.warning("Rule (%s) is never reduced", rejected) errorlog.warning("Rule (%s) is never reduced", rejected) warned_never.append(rejected) # Write the table file if requested if write_tables: lr.write_table(tabmodule,outputdir,signature) # Write a pickled version of the tables if picklefile: lr.pickle_table(picklefile,signature) # Build the parser lr.bind_callables(pinfo.pdict) parser = LRParser(lr,pinfo.error_func) parse = parser.parse return parser astropy-0.3/astropy/extern/ply/cpp.py0000644000175000017500000010042012243255342016142 0ustar oleole# ----------------------------------------------------------------------------- # cpp.py # # Author: David Beazley (http://www.dabeaz.com) # Copyright (C) 2007 # All rights reserved # # This module implements an ANSI-C style lexical preprocessor for PLY. # ----------------------------------------------------------------------------- from __future__ import generators # ----------------------------------------------------------------------------- # Default preprocessor lexer definitions. These tokens are enough to get # a basic preprocessor working. Other modules may import these if they want # ----------------------------------------------------------------------------- tokens = ( 'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT', 'CPP_POUND','CPP_DPOUND' ) literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\"" # Whitespace def t_CPP_WS(t): r'\s+' t.lexer.lineno += t.value.count("\n") return t t_CPP_POUND = r'\#' t_CPP_DPOUND = r'\#\#' # Identifier t_CPP_ID = r'[A-Za-z_][\w_]*' # Integer literal def CPP_INTEGER(t): r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU]|[lL]|[uU][lL]|[lL][uU])?)' return t t_CPP_INTEGER = CPP_INTEGER # Floating literal t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' # String literal def t_CPP_STRING(t): r'\"([^\\\n]|(\\(.|\n)))*?\"' t.lexer.lineno += t.value.count("\n") return t # Character constant 'c' or L'c' def t_CPP_CHAR(t): r'(L)?\'([^\\\n]|(\\(.|\n)))*?\'' t.lexer.lineno += t.value.count("\n") return t # Comment def t_CPP_COMMENT(t): r'(/\*(.|\n)*?\*/)|(//.*?\n)' t.lexer.lineno += t.value.count("\n") return t def t_error(t): t.type = t.value[0] t.value = t.value[0] t.lexer.skip(1) return t import re import copy import time import os.path # ----------------------------------------------------------------------------- # trigraph() # # Given an input string, this function replaces all trigraph sequences. # The following mapping is used: # # ??= # # ??/ \ # ??' ^ # ??( [ # ??) ] # ??! | # ??< { # ??> } # ??- ~ # ----------------------------------------------------------------------------- _trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''') _trigraph_rep = { '=':'#', '/':'\\', "'":'^', '(':'[', ')':']', '!':'|', '<':'{', '>':'}', '-':'~' } def trigraph(input): return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input) # ------------------------------------------------------------------ # Macro object # # This object holds information about preprocessor macros # # .name - Macro name (string) # .value - Macro value (a list of tokens) # .arglist - List of argument names # .variadic - Boolean indicating whether or not variadic macro # .vararg - Name of the variadic parameter # # When a macro is created, the macro replacement token sequence is # pre-scanned and used to create patch lists that are later used # during macro expansion # ------------------------------------------------------------------ class Macro(object): def __init__(self,name,value,arglist=None,variadic=False): self.name = name self.value = value self.arglist = arglist self.variadic = variadic if variadic: self.vararg = arglist[-1] self.source = None # ------------------------------------------------------------------ # Preprocessor object # # Object representing a preprocessor. Contains macro definitions, # include directories, and other information # ------------------------------------------------------------------ class Preprocessor(object): def __init__(self,lexer=None): if lexer is None: lexer = lex.lexer self.lexer = lexer self.macros = { } self.path = [] self.temp_path = [] # Probe the lexer for selected tokens self.lexprobe() tm = time.localtime() self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm)) self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm)) self.parser = None # ----------------------------------------------------------------------------- # tokenize() # # Utility function. Given a string of text, tokenize into a list of tokens # ----------------------------------------------------------------------------- def tokenize(self,text): tokens = [] self.lexer.input(text) while True: tok = self.lexer.token() if not tok: break tokens.append(tok) return tokens # --------------------------------------------------------------------- # error() # # Report a preprocessor error/warning of some kind # ---------------------------------------------------------------------- def error(self,file,line,msg): print("%s:%d %s" % (file,line,msg)) # ---------------------------------------------------------------------- # lexprobe() # # This method probes the preprocessor lexer object to discover # the token types of symbols that are important to the preprocessor. # If this works right, the preprocessor will simply "work" # with any suitable lexer regardless of how tokens have been named. # ---------------------------------------------------------------------- def lexprobe(self): # Determine the token type for identifiers self.lexer.input("identifier") tok = self.lexer.token() if not tok or tok.value != "identifier": print("Couldn't determine identifier type") else: self.t_ID = tok.type # Determine the token type for integers self.lexer.input("12345") tok = self.lexer.token() if not tok or int(tok.value) != 12345: print("Couldn't determine integer type") else: self.t_INTEGER = tok.type self.t_INTEGER_TYPE = type(tok.value) # Determine the token type for strings enclosed in double quotes self.lexer.input("\"filename\"") tok = self.lexer.token() if not tok or tok.value != "\"filename\"": print("Couldn't determine string type") else: self.t_STRING = tok.type # Determine the token type for whitespace--if any self.lexer.input(" ") tok = self.lexer.token() if not tok or tok.value != " ": self.t_SPACE = None else: self.t_SPACE = tok.type # Determine the token type for newlines self.lexer.input("\n") tok = self.lexer.token() if not tok or tok.value != "\n": self.t_NEWLINE = None print("Couldn't determine token for newlines") else: self.t_NEWLINE = tok.type self.t_WS = (self.t_SPACE, self.t_NEWLINE) # Check for other characters used by the preprocessor chars = [ '<','>','#','##','\\','(',')',',','.'] for c in chars: self.lexer.input(c) tok = self.lexer.token() if not tok or tok.value != c: print("Unable to lex '%s' required for preprocessor" % c) # ---------------------------------------------------------------------- # add_path() # # Adds a search path to the preprocessor. # ---------------------------------------------------------------------- def add_path(self,path): self.path.append(path) # ---------------------------------------------------------------------- # group_lines() # # Given an input string, this function splits it into lines. Trailing whitespace # is removed. Any line ending with \ is grouped with the next line. This # function forms the lowest level of the preprocessor---grouping into text into # a line-by-line format. # ---------------------------------------------------------------------- def group_lines(self,input): lex = self.lexer.clone() lines = [x.rstrip() for x in input.splitlines()] for i in xrange(len(lines)): j = i+1 while lines[i].endswith('\\') and (j < len(lines)): lines[i] = lines[i][:-1]+lines[j] lines[j] = "" j += 1 input = "\n".join(lines) lex.input(input) lex.lineno = 1 current_line = [] while True: tok = lex.token() if not tok: break current_line.append(tok) if tok.type in self.t_WS and '\n' in tok.value: yield current_line current_line = [] if current_line: yield current_line # ---------------------------------------------------------------------- # tokenstrip() # # Remove leading/trailing whitespace tokens from a token list # ---------------------------------------------------------------------- def tokenstrip(self,tokens): i = 0 while i < len(tokens) and tokens[i].type in self.t_WS: i += 1 del tokens[:i] i = len(tokens)-1 while i >= 0 and tokens[i].type in self.t_WS: i -= 1 del tokens[i+1:] return tokens # ---------------------------------------------------------------------- # collect_args() # # Collects comma separated arguments from a list of tokens. The arguments # must be enclosed in parenthesis. Returns a tuple (tokencount,args,positions) # where tokencount is the number of tokens consumed, args is a list of arguments, # and positions is a list of integers containing the starting index of each # argument. Each argument is represented by a list of tokens. # # When collecting arguments, leading and trailing whitespace is removed # from each argument. # # This function properly handles nested parenthesis and commas---these do not # define new arguments. # ---------------------------------------------------------------------- def collect_args(self,tokenlist): args = [] positions = [] current_arg = [] nesting = 1 tokenlen = len(tokenlist) # Search for the opening '('. i = 0 while (i < tokenlen) and (tokenlist[i].type in self.t_WS): i += 1 if (i < tokenlen) and (tokenlist[i].value == '('): positions.append(i+1) else: self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments") return 0, [], [] i += 1 while i < tokenlen: t = tokenlist[i] if t.value == '(': current_arg.append(t) nesting += 1 elif t.value == ')': nesting -= 1 if nesting == 0: if current_arg: args.append(self.tokenstrip(current_arg)) positions.append(i) return i+1,args,positions current_arg.append(t) elif t.value == ',' and nesting == 1: args.append(self.tokenstrip(current_arg)) positions.append(i+1) current_arg = [] else: current_arg.append(t) i += 1 # Missing end argument self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments") return 0, [],[] # ---------------------------------------------------------------------- # macro_prescan() # # Examine the macro value (token sequence) and identify patch points # This is used to speed up macro expansion later on---we'll know # right away where to apply patches to the value to form the expansion # ---------------------------------------------------------------------- def macro_prescan(self,macro): macro.patch = [] # Standard macro arguments macro.str_patch = [] # String conversion expansion macro.var_comma_patch = [] # Variadic macro comma patch i = 0 while i < len(macro.value): if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist: argnum = macro.arglist.index(macro.value[i].value) # Conversion of argument to a string if i > 0 and macro.value[i-1].value == '#': macro.value[i] = copy.copy(macro.value[i]) macro.value[i].type = self.t_STRING del macro.value[i-1] macro.str_patch.append((argnum,i-1)) continue # Concatenation elif (i > 0 and macro.value[i-1].value == '##'): macro.patch.append(('c',argnum,i-1)) del macro.value[i-1] continue elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'): macro.patch.append(('c',argnum,i)) i += 1 continue # Standard expansion else: macro.patch.append(('e',argnum,i)) elif macro.value[i].value == '##': if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \ ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \ (macro.value[i+1].value == macro.vararg): macro.var_comma_patch.append(i-1) i += 1 macro.patch.sort(key=lambda x: x[2],reverse=True) # ---------------------------------------------------------------------- # macro_expand_args() # # Given a Macro and list of arguments (each a token list), this method # returns an expanded version of a macro. The return value is a token sequence # representing the replacement macro tokens # ---------------------------------------------------------------------- def macro_expand_args(self,macro,args): # Make a copy of the macro token sequence rep = [copy.copy(_x) for _x in macro.value] # Make string expansion patches. These do not alter the length of the replacement sequence str_expansion = {} for argnum, i in macro.str_patch: if argnum not in str_expansion: str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\") rep[i] = copy.copy(rep[i]) rep[i].value = str_expansion[argnum] # Make the variadic macro comma patch. If the variadic macro argument is empty, we get rid comma_patch = False if macro.variadic and not args[-1]: for i in macro.var_comma_patch: rep[i] = None comma_patch = True # Make all other patches. The order of these matters. It is assumed that the patch list # has been sorted in reverse order of patch location since replacements will cause the # size of the replacement sequence to expand from the patch point. expanded = { } for ptype, argnum, i in macro.patch: # Concatenation. Argument is left unexpanded if ptype == 'c': rep[i:i+1] = args[argnum] # Normal expansion. Argument is macro expanded first elif ptype == 'e': if argnum not in expanded: expanded[argnum] = self.expand_macros(args[argnum]) rep[i:i+1] = expanded[argnum] # Get rid of removed comma if necessary if comma_patch: rep = [_i for _i in rep if _i] return rep # ---------------------------------------------------------------------- # expand_macros() # # Given a list of tokens, this function performs macro expansion. # The expanded argument is a dictionary that contains macros already # expanded. This is used to prevent infinite recursion. # ---------------------------------------------------------------------- def expand_macros(self,tokens,expanded=None): if expanded is None: expanded = {} i = 0 while i < len(tokens): t = tokens[i] if t.type == self.t_ID: if t.value in self.macros and t.value not in expanded: # Yes, we found a macro match expanded[t.value] = True m = self.macros[t.value] if not m.arglist: # A simple macro ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded) for e in ex: e.lineno = t.lineno tokens[i:i+1] = ex i += len(ex) else: # A macro with arguments j = i + 1 while j < len(tokens) and tokens[j].type in self.t_WS: j += 1 if tokens[j].value == '(': tokcount,args,positions = self.collect_args(tokens[j:]) if not m.variadic and len(args) != len(m.arglist): self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist))) i = j + tokcount elif m.variadic and len(args) < len(m.arglist)-1: if len(m.arglist) > 2: self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1)) else: self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1)) i = j + tokcount else: if m.variadic: if len(args) == len(m.arglist)-1: args.append([]) else: args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1] del args[len(m.arglist):] # Get macro replacement text rep = self.macro_expand_args(m,args) rep = self.expand_macros(rep,expanded) for r in rep: r.lineno = t.lineno tokens[i:j+tokcount] = rep i += len(rep) del expanded[t.value] continue elif t.value == '__LINE__': t.type = self.t_INTEGER t.value = self.t_INTEGER_TYPE(t.lineno) i += 1 return tokens # ---------------------------------------------------------------------- # evalexpr() # # Evaluate an expression token sequence for the purposes of evaluating # integral expressions. # ---------------------------------------------------------------------- def evalexpr(self,tokens): # tokens = tokenize(line) # Search for defined macros i = 0 while i < len(tokens): if tokens[i].type == self.t_ID and tokens[i].value == 'defined': j = i + 1 needparen = False result = "0L" while j < len(tokens): if tokens[j].type in self.t_WS: j += 1 continue elif tokens[j].type == self.t_ID: if tokens[j].value in self.macros: result = "1L" else: result = "0L" if not needparen: break elif tokens[j].value == '(': needparen = True elif tokens[j].value == ')': break else: self.error(self.source,tokens[i].lineno,"Malformed defined()") j += 1 tokens[i].type = self.t_INTEGER tokens[i].value = self.t_INTEGER_TYPE(result) del tokens[i+1:j+1] i += 1 tokens = self.expand_macros(tokens) for i,t in enumerate(tokens): if t.type == self.t_ID: tokens[i] = copy.copy(t) tokens[i].type = self.t_INTEGER tokens[i].value = self.t_INTEGER_TYPE("0L") elif t.type == self.t_INTEGER: tokens[i] = copy.copy(t) # Strip off any trailing suffixes tokens[i].value = str(tokens[i].value) while tokens[i].value[-1] not in "0123456789abcdefABCDEF": tokens[i].value = tokens[i].value[:-1] expr = "".join([str(x.value) for x in tokens]) expr = expr.replace("&&"," and ") expr = expr.replace("||"," or ") expr = expr.replace("!"," not ") try: result = eval(expr) except StandardError: self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression") result = 0 return result # ---------------------------------------------------------------------- # parsegen() # # Parse an input string/ # ---------------------------------------------------------------------- def parsegen(self,input,source=None): # Replace trigraph sequences t = trigraph(input) lines = self.group_lines(t) if not source: source = "" self.define("__FILE__ \"%s\"" % source) self.source = source chunk = [] enable = True iftrigger = False ifstack = [] for x in lines: for i,tok in enumerate(x): if tok.type not in self.t_WS: break if tok.value == '#': # Preprocessor directive for tok in x: if tok in self.t_WS and '\n' in tok.value: chunk.append(tok) dirtokens = self.tokenstrip(x[i+1:]) if dirtokens: name = dirtokens[0].value args = self.tokenstrip(dirtokens[1:]) else: name = "" args = [] if name == 'define': if enable: for tok in self.expand_macros(chunk): yield tok chunk = [] self.define(args) elif name == 'include': if enable: for tok in self.expand_macros(chunk): yield tok chunk = [] oldfile = self.macros['__FILE__'] for tok in self.include(args): yield tok self.macros['__FILE__'] = oldfile self.source = source elif name == 'undef': if enable: for tok in self.expand_macros(chunk): yield tok chunk = [] self.undef(args) elif name == 'ifdef': ifstack.append((enable,iftrigger)) if enable: if not args[0].value in self.macros: enable = False iftrigger = False else: iftrigger = True elif name == 'ifndef': ifstack.append((enable,iftrigger)) if enable: if args[0].value in self.macros: enable = False iftrigger = False else: iftrigger = True elif name == 'if': ifstack.append((enable,iftrigger)) if enable: result = self.evalexpr(args) if not result: enable = False iftrigger = False else: iftrigger = True elif name == 'elif': if ifstack: if ifstack[-1][0]: # We only pay attention if outer "if" allows this if enable: # If already true, we flip enable False enable = False elif not iftrigger: # If False, but not triggered yet, we'll check expression result = self.evalexpr(args) if result: enable = True iftrigger = True else: self.error(self.source,dirtokens[0].lineno,"Misplaced #elif") elif name == 'else': if ifstack: if ifstack[-1][0]: if enable: enable = False elif not iftrigger: enable = True iftrigger = True else: self.error(self.source,dirtokens[0].lineno,"Misplaced #else") elif name == 'endif': if ifstack: enable,iftrigger = ifstack.pop() else: self.error(self.source,dirtokens[0].lineno,"Misplaced #endif") else: # Unknown preprocessor directive pass else: # Normal text if enable: chunk.extend(x) for tok in self.expand_macros(chunk): yield tok chunk = [] # ---------------------------------------------------------------------- # include() # # Implementation of file-inclusion # ---------------------------------------------------------------------- def include(self,tokens): # Try to extract the filename and then process an include file if not tokens: return if tokens: if tokens[0].value != '<' and tokens[0].type != self.t_STRING: tokens = self.expand_macros(tokens) if tokens[0].value == '<': # Include <...> i = 1 while i < len(tokens): if tokens[i].value == '>': break i += 1 else: print("Malformed #include <...>") return filename = "".join([x.value for x in tokens[1:i]]) path = self.path + [""] + self.temp_path elif tokens[0].type == self.t_STRING: filename = tokens[0].value[1:-1] path = self.temp_path + [""] + self.path else: print("Malformed #include statement") return for p in path: iname = os.path.join(p,filename) try: data = open(iname,"r").read() dname = os.path.dirname(iname) if dname: self.temp_path.insert(0,dname) for tok in self.parsegen(data,filename): yield tok if dname: del self.temp_path[0] break except IOError: pass else: print("Couldn't find '%s'" % filename) # ---------------------------------------------------------------------- # define() # # Define a new macro # ---------------------------------------------------------------------- def define(self,tokens): if isinstance(tokens,(str,unicode)): tokens = self.tokenize(tokens) linetok = tokens try: name = linetok[0] if len(linetok) > 1: mtype = linetok[1] else: mtype = None if not mtype: m = Macro(name.value,[]) self.macros[name.value] = m elif mtype.type in self.t_WS: # A normal macro m = Macro(name.value,self.tokenstrip(linetok[2:])) self.macros[name.value] = m elif mtype.value == '(': # A macro with arguments tokcount, args, positions = self.collect_args(linetok[1:]) variadic = False for a in args: if variadic: print("No more arguments may follow a variadic argument") break astr = "".join([str(_i.value) for _i in a]) if astr == "...": variadic = True a[0].type = self.t_ID a[0].value = '__VA_ARGS__' variadic = True del a[1:] continue elif astr[-3:] == "..." and a[0].type == self.t_ID: variadic = True del a[1:] # If, for some reason, "." is part of the identifier, strip off the name for the purposes # of macro expansion if a[0].value[-3:] == '...': a[0].value = a[0].value[:-3] continue if len(a) > 1 or a[0].type != self.t_ID: print("Invalid macro argument") break else: mvalue = self.tokenstrip(linetok[1+tokcount:]) i = 0 while i < len(mvalue): if i+1 < len(mvalue): if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##': del mvalue[i] continue elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS: del mvalue[i+1] i += 1 m = Macro(name.value,mvalue,[x[0].value for x in args],variadic) self.macro_prescan(m) self.macros[name.value] = m else: print("Bad macro definition") except LookupError: print("Bad macro definition") # ---------------------------------------------------------------------- # undef() # # Undefine a macro # ---------------------------------------------------------------------- def undef(self,tokens): id = tokens[0].value try: del self.macros[id] except LookupError: pass # ---------------------------------------------------------------------- # parse() # # Parse input text. # ---------------------------------------------------------------------- def parse(self,input,source=None,ignore={}): self.ignore = ignore self.parser = self.parsegen(input,source) # ---------------------------------------------------------------------- # token() # # Method to return individual tokens # ---------------------------------------------------------------------- def token(self): try: while True: tok = next(self.parser) if tok.type not in self.ignore: return tok except StopIteration: self.parser = None return None if __name__ == '__main__': import ply.lex as lex lexer = lex.lex() # Run a preprocessor import sys f = open(sys.argv[1]) input = f.read() p = Preprocessor(lexer) p.parse(input,sys.argv[1]) while True: tok = p.token() if not tok: break print(p.source, tok) astropy-0.3/astropy/extern/ply/ctokens.py0000644000175000017500000000614212243255342017034 0ustar oleole# ---------------------------------------------------------------------- # ctokens.py # # Token specifications for symbols in ANSI C and C++. This file is # meant to be used as a library in other tokenizers. # ---------------------------------------------------------------------- # Reserved words tokens = [ # Literals (identifier, integer constant, float constant, string constant, char const) 'ID', 'TYPEID', 'ICONST', 'FCONST', 'SCONST', 'CCONST', # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', 'LOR', 'LAND', 'LNOT', 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', # Increment/decrement (++,--) 'PLUSPLUS', 'MINUSMINUS', # Structure dereference (->) 'ARROW', # Ternary operator (?) 'TERNARY', # Delimeters ( ) [ ] { } , . ; : 'LPAREN', 'RPAREN', 'LBRACKET', 'RBRACKET', 'LBRACE', 'RBRACE', 'COMMA', 'PERIOD', 'SEMI', 'COLON', # Ellipsis (...) 'ELLIPSIS', ] # Operators t_PLUS = r'\+' t_MINUS = r'-' t_TIMES = r'\*' t_DIVIDE = r'/' t_MODULO = r'%' t_OR = r'\|' t_AND = r'&' t_NOT = r'~' t_XOR = r'\^' t_LSHIFT = r'<<' t_RSHIFT = r'>>' t_LOR = r'\|\|' t_LAND = r'&&' t_LNOT = r'!' t_LT = r'<' t_GT = r'>' t_LE = r'<=' t_GE = r'>=' t_EQ = r'==' t_NE = r'!=' # Assignment operators t_EQUALS = r'=' t_TIMESEQUAL = r'\*=' t_DIVEQUAL = r'/=' t_MODEQUAL = r'%=' t_PLUSEQUAL = r'\+=' t_MINUSEQUAL = r'-=' t_LSHIFTEQUAL = r'<<=' t_RSHIFTEQUAL = r'>>=' t_ANDEQUAL = r'&=' t_OREQUAL = r'\|=' t_XOREQUAL = r'^=' # Increment/decrement t_INCREMENT = r'\+\+' t_DECREMENT = r'--' # -> t_ARROW = r'->' # ? t_TERNARY = r'\?' # Delimeters t_LPAREN = r'\(' t_RPAREN = r'\)' t_LBRACKET = r'\[' t_RBRACKET = r'\]' t_LBRACE = r'\{' t_RBRACE = r'\}' t_COMMA = r',' t_PERIOD = r'\.' t_SEMI = r';' t_COLON = r':' t_ELLIPSIS = r'\.\.\.' # Identifiers t_ID = r'[A-Za-z_][A-Za-z0-9_]*' # Integer literal t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' # Floating literal t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' # String literal t_STRING = r'\"([^\\\n]|(\\.))*?\"' # Character constant 'c' or L'c' t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' # Comment (C-Style) def t_COMMENT(t): r'/\*(.|\n)*?\*/' t.lexer.lineno += t.value.count('\n') return t # Comment (C++-Style) def t_CPPCOMMENT(t): r'//.*\n' t.lexer.lineno += 1 return t astropy-0.3/astropy/extern/configobj_py2/0000755000175000017500000000000012243263747016747 5ustar oleoleastropy-0.3/astropy/extern/configobj_py2/__init__.py0000644000175000017500000000651012243255342021052 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This is a copy of the main portions of the `configobj `_ package. This is used internally in the Astropy configuration system. The license for configobj is available in the ``licenses/CONFIGOBJ_LICENSE.rst`` file in the Astropy source distribution. This is the original 4.7.2 version of configobj, which is only compatible with python 2.x - the 3.x version is in ``astropy/extern/configobj-py3``. """ #this holds the contents of the setup.py file used by configobj _configobj_setup_dot_py=""" # setup.py # Install script for ConfigObj # Copyright (C) 2005-2010 Michael Foord, Mark Andrews, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # mark AT la-la DOT com # nico AT tekNico DOT net # This software is licensed under the terms of the BSD license. # http://www.voidspace.org.uk/python/license.shtml import sys from distutils.core import setup from configobj import __version__ as VERSION NAME = 'configobj' MODULES = 'configobj', 'validate' DESCRIPTION = 'Config file reading, writing and validation.' URL = 'http://www.voidspace.org.uk/python/configobj.html' DOWNLOAD_URL = "http://www.voidspace.org.uk/downloads/configobj-%s.zip" % VERSION LONG_DESCRIPTION = ""#"**ConfigObj** is a simple but powerful config file reader and writer: an *ini file round tripper*. Its main feature is that it is very easy to use, with a straightforward programmer's interface and a simple syntax for config files. It has lots of other features though : * Nested sections (subsections), to any level * List values * Multiple line values * Full Unicode support * String interpolation (substitution) * Integrated with a powerful validation system - including automatic type checking/conversion - and allowing default values - repeated sections * All comments in the file are preserved * The order of keys/sections is preserved * Powerful ``unrepr`` mode for storing/retrieving Python data-types | Release 4.7.2 fixes several bugs in 4.7.1 | Release 4.7.1 fixes a bug with the deprecated options keyword in | 4.7.0. | Release 4.7.0 improves performance adds features for validation and | fixes some bugs.""#" CLASSIFIERS = [ 'Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', 'Programming Language :: Python :: 2.3', 'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', ] AUTHOR = 'Michael Foord & Nicola Larosa' AUTHOR_EMAIL = 'fuzzyman@voidspace.org.uk' KEYWORDS = "config, ini, dictionary, application, admin, sysadmin, configuration, validation".split(', ') setup(name=NAME, version=VERSION, description=DESCRIPTION, long_description=LONG_DESCRIPTION, download_url=DOWNLOAD_URL, author=AUTHOR, author_email=AUTHOR_EMAIL, url=URL, py_modules=MODULES, classifiers=CLASSIFIERS, keywords=KEYWORDS ) """.replace('""#"','"""') #the replacement is necessary because """ would otherwise terminate the string astropy-0.3/astropy/extern/configobj_py2/validate.py0000644000175000017500000013236412243255342021113 0ustar oleole# validate.py # A Validator object # Copyright (C) 2005-2010 Michael Foord, Mark Andrews, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # mark AT la-la DOT com # nico AT tekNico DOT net # This software is licensed under the terms of the BSD license. # http://www.voidspace.org.uk/python/license.shtml # Basically you're free to copy, modify, distribute and relicense it, # So long as you keep a copy of the license with it. # Scripts maintained at http://www.voidspace.org.uk/python/index.shtml # For information about bugfixes, updates and support, please join the # ConfigObj mailing list: # http://lists.sourceforge.net/lists/listinfo/configobj-develop # Comments, suggestions and bug reports welcome. """ The Validator object is used to check that supplied values conform to a specification. The value can be supplied as a string - e.g. from a config file. In this case the check will also *convert* the value to the required type. This allows you to add validation as a transparent layer to access data stored as strings. The validation checks that the data is correct *and* converts it to the expected type. Some standard checks are provided for basic data types. Additional checks are easy to write. They can be provided when the ``Validator`` is instantiated or added afterwards. The standard functions work with the following basic data types : * integers * floats * booleans * strings * ip_addr plus lists of these datatypes Adding additional checks is done through coding simple functions. The full set of standard checks are : * 'integer': matches integer values (including negative) Takes optional 'min' and 'max' arguments : :: integer() integer(3, 9) # any value from 3 to 9 integer(min=0) # any positive value integer(max=9) * 'float': matches float values Has the same parameters as the integer check. * 'boolean': matches boolean values - ``True`` or ``False`` Acceptable string values for True are : true, on, yes, 1 Acceptable string values for False are : false, off, no, 0 Any other value raises an error. * 'ip_addr': matches an Internet Protocol address, v.4, represented by a dotted-quad string, i.e. '1.2.3.4'. * 'string': matches any string. Takes optional keyword args 'min' and 'max' to specify min and max lengths of the string. * 'list': matches any list. Takes optional keyword args 'min', and 'max' to specify min and max sizes of the list. (Always returns a list.) * 'tuple': matches any tuple. Takes optional keyword args 'min', and 'max' to specify min and max sizes of the tuple. (Always returns a tuple.) * 'int_list': Matches a list of integers. Takes the same arguments as list. * 'float_list': Matches a list of floats. Takes the same arguments as list. * 'bool_list': Matches a list of boolean values. Takes the same arguments as list. * 'ip_addr_list': Matches a list of IP addresses. Takes the same arguments as list. * 'string_list': Matches a list of strings. Takes the same arguments as list. * 'mixed_list': Matches a list with different types in specific positions. List size must match the number of arguments. Each position can be one of : 'integer', 'float', 'ip_addr', 'string', 'boolean' So to specify a list with two strings followed by two integers, you write the check as : :: mixed_list('string', 'string', 'integer', 'integer') * 'pass': This check matches everything ! It never fails and the value is unchanged. It is also the default if no check is specified. * 'option': This check matches any from a list of options. You specify this check with : :: option('option 1', 'option 2', 'option 3') You can supply a default value (returned if no value is supplied) using the default keyword argument. You specify a list argument for default using a list constructor syntax in the check : :: checkname(arg1, arg2, default=list('val 1', 'val 2', 'val 3')) A badly formatted set of arguments will raise a ``VdtParamError``. """ __version__ = '1.0.1' __all__ = ( '__version__', 'dottedQuadToNum', 'numToDottedQuad', 'ValidateError', 'VdtUnknownCheckError', 'VdtParamError', 'VdtTypeError', 'VdtValueError', 'VdtValueTooSmallError', 'VdtValueTooBigError', 'VdtValueTooShortError', 'VdtValueTooLongError', 'VdtMissingValue', 'Validator', 'is_integer', 'is_float', 'is_boolean', 'is_list', 'is_tuple', 'is_ip_addr', 'is_string', 'is_int_list', 'is_bool_list', 'is_float_list', 'is_string_list', 'is_ip_addr_list', 'is_mixed_list', 'is_option', '__docformat__', ) import re _list_arg = re.compile(r''' (?: ([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*list\( ( (?: \s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted ) \s*,\s* )* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted )? # last one ) \) ) ''', re.VERBOSE | re.DOTALL) # two groups _list_members = re.compile(r''' ( (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?) # unquoted ) (?: (?:\s*,\s*)|(?:\s*$) # comma ) ''', re.VERBOSE | re.DOTALL) # one group _paramstring = r''' (?: ( (?: [a-zA-Z_][a-zA-Z0-9_]*\s*=\s*list\( (?: \s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted ) \s*,\s* )* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s\)][^,\)]*?) # unquoted )? # last one \) )| (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?)| # unquoted (?: # keyword argument [a-zA-Z_][a-zA-Z0-9_]*\s*=\s* (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\s=][^,=]*?) # unquoted ) ) ) ) (?: (?:\s*,\s*)|(?:\s*$) # comma ) ) ''' _matchstring = '^%s*' % _paramstring # Python pre 2.2.1 doesn't have bool try: bool except NameError: def bool(val): """Simple boolean equivalent function. """ if val: return 1 else: return 0 def dottedQuadToNum(ip): """ Convert decimal dotted quad string to long integer >>> int(dottedQuadToNum('1 ')) 1 >>> int(dottedQuadToNum(' 1.2')) 16777218 >>> int(dottedQuadToNum(' 1.2.3 ')) 16908291 >>> int(dottedQuadToNum('1.2.3.4')) 16909060 >>> dottedQuadToNum('255.255.255.255') 4294967295L >>> dottedQuadToNum('255.255.255.256') Traceback (most recent call last): ValueError: Not a good dotted-quad IP: 255.255.255.256 """ # import here to avoid it when ip_addr values are not used import socket, struct try: return struct.unpack('!L', socket.inet_aton(ip.strip()))[0] except socket.error: # bug in inet_aton, corrected in Python 2.4 if ip.strip() == '255.255.255.255': return 0xFFFFFFFFL else: raise ValueError('Not a good dotted-quad IP: %s' % ip) return def numToDottedQuad(num): """ Convert long int to dotted quad string >>> numToDottedQuad(-1L) Traceback (most recent call last): ValueError: Not a good numeric IP: -1 >>> numToDottedQuad(1L) '0.0.0.1' >>> numToDottedQuad(16777218L) '1.0.0.2' >>> numToDottedQuad(16908291L) '1.2.0.3' >>> numToDottedQuad(16909060L) '1.2.3.4' >>> numToDottedQuad(4294967295L) '255.255.255.255' >>> numToDottedQuad(4294967296L) Traceback (most recent call last): ValueError: Not a good numeric IP: 4294967296 """ # import here to avoid it when ip_addr values are not used import socket, struct # no need to intercept here, 4294967295L is fine if num > 4294967295L or num < 0: raise ValueError('Not a good numeric IP: %s' % num) try: return socket.inet_ntoa( struct.pack('!L', long(num))) except (socket.error, struct.error, OverflowError): raise ValueError('Not a good numeric IP: %s' % num) class ValidateError(Exception): """ This error indicates that the check failed. It can be the base class for more specific errors. Any check function that fails ought to raise this error. (or a subclass) >>> raise ValidateError Traceback (most recent call last): ValidateError """ class VdtMissingValue(ValidateError): """No value was supplied to a check that needed one.""" class VdtUnknownCheckError(ValidateError): """An unknown check function was requested""" def __init__(self, value): """ >>> raise VdtUnknownCheckError('yoda') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. """ ValidateError.__init__(self, 'the check "%s" is unknown.' % (value,)) class VdtParamError(SyntaxError): """An incorrect parameter was passed""" def __init__(self, name, value): """ >>> raise VdtParamError('yoda', 'jedi') Traceback (most recent call last): VdtParamError: passed an incorrect value "jedi" for parameter "yoda". """ SyntaxError.__init__(self, 'passed an incorrect value "%s" for parameter "%s".' % (value, name)) class VdtTypeError(ValidateError): """The value supplied was of the wrong type""" def __init__(self, value): """ >>> raise VdtTypeError('jedi') Traceback (most recent call last): VdtTypeError: the value "jedi" is of the wrong type. """ ValidateError.__init__(self, 'the value "%s" is of the wrong type.' % (value,)) class VdtValueError(ValidateError): """The value supplied was of the correct type, but was not an allowed value.""" def __init__(self, value): """ >>> raise VdtValueError('jedi') Traceback (most recent call last): VdtValueError: the value "jedi" is unacceptable. """ ValidateError.__init__(self, 'the value "%s" is unacceptable.' % (value,)) class VdtValueTooSmallError(VdtValueError): """The value supplied was of the correct type, but was too small.""" def __init__(self, value): """ >>> raise VdtValueTooSmallError('0') Traceback (most recent call last): VdtValueTooSmallError: the value "0" is too small. """ ValidateError.__init__(self, 'the value "%s" is too small.' % (value,)) class VdtValueTooBigError(VdtValueError): """The value supplied was of the correct type, but was too big.""" def __init__(self, value): """ >>> raise VdtValueTooBigError('1') Traceback (most recent call last): VdtValueTooBigError: the value "1" is too big. """ ValidateError.__init__(self, 'the value "%s" is too big.' % (value,)) class VdtValueTooShortError(VdtValueError): """The value supplied was of the correct type, but was too short.""" def __init__(self, value): """ >>> raise VdtValueTooShortError('jed') Traceback (most recent call last): VdtValueTooShortError: the value "jed" is too short. """ ValidateError.__init__( self, 'the value "%s" is too short.' % (value,)) class VdtValueTooLongError(VdtValueError): """The value supplied was of the correct type, but was too long.""" def __init__(self, value): """ >>> raise VdtValueTooLongError('jedie') Traceback (most recent call last): VdtValueTooLongError: the value "jedie" is too long. """ ValidateError.__init__(self, 'the value "%s" is too long.' % (value,)) class Validator(object): """ Validator is an object that allows you to register a set of 'checks'. These checks take input and test that it conforms to the check. This can also involve converting the value from a string into the correct datatype. The ``check`` method takes an input string which configures which check is to be used and applies that check to a supplied value. An example input string would be: 'int_range(param1, param2)' You would then provide something like: >>> def int_range_check(value, min, max): ... # turn min and max from strings to integers ... min = int(min) ... max = int(max) ... # check that value is of the correct type. ... # possible valid inputs are integers or strings ... # that represent integers ... if not isinstance(value, (int, long, basestring)): ... raise VdtTypeError(value) ... elif isinstance(value, basestring): ... # if we are given a string ... # attempt to convert to an integer ... try: ... value = int(value) ... except ValueError: ... raise VdtValueError(value) ... # check the value is between our constraints ... if not min <= value: ... raise VdtValueTooSmallError(value) ... if not value <= max: ... raise VdtValueTooBigError(value) ... return value >>> fdict = {'int_range': int_range_check} >>> vtr1 = Validator(fdict) >>> vtr1.check('int_range(20, 40)', '30') 30 >>> vtr1.check('int_range(20, 40)', '60') Traceback (most recent call last): VdtValueTooBigError: the value "60" is too big. New functions can be added with : :: >>> vtr2 = Validator() >>> vtr2.functions['int_range'] = int_range_check Or by passing in a dictionary of functions when Validator is instantiated. Your functions *can* use keyword arguments, but the first argument should always be 'value'. If the function doesn't take additional arguments, the parentheses are optional in the check. It can be written with either of : :: keyword = function_name keyword = function_name() The first program to utilise Validator() was Michael Foord's ConfigObj, an alternative to ConfigParser which supports lists and can validate a config file using a config schema. For more details on using Validator with ConfigObj see: http://www.voidspace.org.uk/python/configobj.html """ # this regex does the initial parsing of the checks _func_re = re.compile(r'(.+?)\((.*)\)', re.DOTALL) # this regex takes apart keyword arguments _key_arg = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.*)$', re.DOTALL) # this regex finds keyword=list(....) type values _list_arg = _list_arg # this regex takes individual values out of lists - in one pass _list_members = _list_members # These regexes check a set of arguments for validity # and then pull the members out _paramfinder = re.compile(_paramstring, re.VERBOSE | re.DOTALL) _matchfinder = re.compile(_matchstring, re.VERBOSE | re.DOTALL) def __init__(self, functions=None): """ >>> vtri = Validator() """ self.functions = { '': self._pass, 'integer': is_integer, 'float': is_float, 'boolean': is_boolean, 'ip_addr': is_ip_addr, 'string': is_string, 'list': is_list, 'tuple': is_tuple, 'int_list': is_int_list, 'float_list': is_float_list, 'bool_list': is_bool_list, 'ip_addr_list': is_ip_addr_list, 'string_list': is_string_list, 'mixed_list': is_mixed_list, 'pass': self._pass, 'option': is_option, 'force_list': force_list, } if functions is not None: self.functions.update(functions) # tekNico: for use by ConfigObj self.baseErrorClass = ValidateError self._cache = {} def check(self, check, value, missing=False): """ Usage: check(check, value) Arguments: check: string representing check to apply (including arguments) value: object to be checked Returns value, converted to correct type if necessary If the check fails, raises a ``ValidateError`` subclass. >>> vtor.check('yoda', '') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. >>> vtor.check('yoda()', '') Traceback (most recent call last): VdtUnknownCheckError: the check "yoda" is unknown. >>> vtor.check('string(default="")', '', missing=True) '' """ fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check) if missing: if default is None: # no information needed here - to be handled by caller raise VdtMissingValue() value = self._handle_none(default) if value is None: return None return self._check_value(value, fun_name, fun_args, fun_kwargs) def _handle_none(self, value): if value == 'None': return None elif value in ("'None'", '"None"'): # Special case a quoted None value = self._unquote(value) return value def _parse_with_caching(self, check): if check in self._cache: fun_name, fun_args, fun_kwargs, default = self._cache[check] # We call list and dict below to work with *copies* of the data # rather than the original (which are mutable of course) fun_args = list(fun_args) fun_kwargs = dict(fun_kwargs) else: fun_name, fun_args, fun_kwargs, default = self._parse_check(check) fun_kwargs = dict([(str(key), value) for (key, value) in fun_kwargs.items()]) self._cache[check] = fun_name, list(fun_args), dict(fun_kwargs), default return fun_name, fun_args, fun_kwargs, default def _check_value(self, value, fun_name, fun_args, fun_kwargs): try: fun = self.functions[fun_name] except KeyError: raise VdtUnknownCheckError(fun_name) else: return fun(value, *fun_args, **fun_kwargs) def _parse_check(self, check): fun_match = self._func_re.match(check) if fun_match: fun_name = fun_match.group(1) arg_string = fun_match.group(2) arg_match = self._matchfinder.match(arg_string) if arg_match is None: # Bad syntax raise VdtParamError('Bad syntax in check "%s".' % check) fun_args = [] fun_kwargs = {} # pull out args of group 2 for arg in self._paramfinder.findall(arg_string): # args may need whitespace removing (before removing quotes) arg = arg.strip() listmatch = self._list_arg.match(arg) if listmatch: key, val = self._list_handle(listmatch) fun_kwargs[key] = val continue keymatch = self._key_arg.match(arg) if keymatch: val = keymatch.group(2) if not val in ("'None'", '"None"'): # Special case a quoted None val = self._unquote(val) fun_kwargs[keymatch.group(1)] = val continue fun_args.append(self._unquote(arg)) else: # allows for function names without (args) return check, (), {}, None # Default must be deleted if the value is specified too, # otherwise the check function will get a spurious "default" keyword arg default = fun_kwargs.pop('default', None) return fun_name, fun_args, fun_kwargs, default def _unquote(self, val): """Unquote a value if necessary.""" if (len(val) >= 2) and (val[0] in ("'", '"')) and (val[0] == val[-1]): val = val[1:-1] return val def _list_handle(self, listmatch): """Take apart a ``keyword=list('val, 'val')`` type string.""" out = [] name = listmatch.group(1) args = listmatch.group(2) for arg in self._list_members.findall(args): out.append(self._unquote(arg)) return name, out def _pass(self, value): """ Dummy check that always passes >>> vtor.check('', 0) 0 >>> vtor.check('', '0') '0' """ return value def get_default_value(self, check): """ Given a check, return the default value for the check (converted to the right type). If the check doesn't specify a default value then a ``KeyError`` will be raised. """ fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check) if default is None: raise KeyError('Check "%s" has no default value.' % check) value = self._handle_none(default) if value is None: return value return self._check_value(value, fun_name, fun_args, fun_kwargs) def _is_num_param(names, values, to_float=False): """ Return numbers from inputs or raise VdtParamError. Lets ``None`` pass through. Pass in keyword argument ``to_float=True`` to use float for the conversion rather than int. >>> _is_num_param(('', ''), (0, 1.0)) [0, 1] >>> _is_num_param(('', ''), (0, 1.0), to_float=True) [0.0, 1.0] >>> _is_num_param(('a'), ('a')) Traceback (most recent call last): VdtParamError: passed an incorrect value "a" for parameter "a". """ fun = to_float and float or int out_params = [] for (name, val) in zip(names, values): if val is None: out_params.append(val) elif isinstance(val, (int, long, float, basestring)): try: out_params.append(fun(val)) except ValueError, e: raise VdtParamError(name, val) else: raise VdtParamError(name, val) return out_params # built in checks # you can override these by setting the appropriate name # in Validator.functions # note: if the params are specified wrongly in your input string, # you will also raise errors. def is_integer(value, min=None, max=None): """ A check that tests that a given value is an integer (int, or long) and optionally, between bounds. A negative value is accepted, while a float will fail. If the value is a string, then the conversion is done - if possible. Otherwise a VdtError is raised. >>> vtor.check('integer', '-1') -1 >>> vtor.check('integer', '0') 0 >>> vtor.check('integer', 9) 9 >>> vtor.check('integer', 'a') Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. >>> vtor.check('integer', '2.2') Traceback (most recent call last): VdtTypeError: the value "2.2" is of the wrong type. >>> vtor.check('integer(10)', '20') 20 >>> vtor.check('integer(max=20)', '15') 15 >>> vtor.check('integer(10)', '9') Traceback (most recent call last): VdtValueTooSmallError: the value "9" is too small. >>> vtor.check('integer(10)', 9) Traceback (most recent call last): VdtValueTooSmallError: the value "9" is too small. >>> vtor.check('integer(max=20)', '35') Traceback (most recent call last): VdtValueTooBigError: the value "35" is too big. >>> vtor.check('integer(max=20)', 35) Traceback (most recent call last): VdtValueTooBigError: the value "35" is too big. >>> vtor.check('integer(0, 9)', False) 0 """ (min_val, max_val) = _is_num_param(('min', 'max'), (min, max)) if not isinstance(value, (int, long, basestring)): raise VdtTypeError(value) if isinstance(value, basestring): # if it's a string - does it represent an integer ? try: value = int(value) except ValueError: raise VdtTypeError(value) if (min_val is not None) and (value < min_val): raise VdtValueTooSmallError(value) if (max_val is not None) and (value > max_val): raise VdtValueTooBigError(value) return value def is_float(value, min=None, max=None): """ A check that tests that a given value is a float (an integer will be accepted), and optionally - that it is between bounds. If the value is a string, then the conversion is done - if possible. Otherwise a VdtError is raised. This can accept negative values. >>> vtor.check('float', '2') 2.0 From now on we multiply the value to avoid comparing decimals >>> vtor.check('float', '-6.8') * 10 -68.0 >>> vtor.check('float', '12.2') * 10 122.0 >>> vtor.check('float', 8.4) * 10 84.0 >>> vtor.check('float', 'a') Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. >>> vtor.check('float(10.1)', '10.2') * 10 102.0 >>> vtor.check('float(max=20.2)', '15.1') * 10 151.0 >>> vtor.check('float(10.0)', '9.0') Traceback (most recent call last): VdtValueTooSmallError: the value "9.0" is too small. >>> vtor.check('float(max=20.0)', '35.0') Traceback (most recent call last): VdtValueTooBigError: the value "35.0" is too big. """ (min_val, max_val) = _is_num_param( ('min', 'max'), (min, max), to_float=True) if not isinstance(value, (int, long, float, basestring)): raise VdtTypeError(value) if not isinstance(value, float): # if it's a string - does it represent a float ? try: value = float(value) except ValueError: raise VdtTypeError(value) if (min_val is not None) and (value < min_val): raise VdtValueTooSmallError(value) if (max_val is not None) and (value > max_val): raise VdtValueTooBigError(value) return value bool_dict = { True: True, 'on': True, '1': True, 'true': True, 'yes': True, False: False, 'off': False, '0': False, 'false': False, 'no': False, } def is_boolean(value): """ Check if the value represents a boolean. >>> vtor.check('boolean', 0) 0 >>> vtor.check('boolean', False) 0 >>> vtor.check('boolean', '0') 0 >>> vtor.check('boolean', 'off') 0 >>> vtor.check('boolean', 'false') 0 >>> vtor.check('boolean', 'no') 0 >>> vtor.check('boolean', 'nO') 0 >>> vtor.check('boolean', 'NO') 0 >>> vtor.check('boolean', 1) 1 >>> vtor.check('boolean', True) 1 >>> vtor.check('boolean', '1') 1 >>> vtor.check('boolean', 'on') 1 >>> vtor.check('boolean', 'true') 1 >>> vtor.check('boolean', 'yes') 1 >>> vtor.check('boolean', 'Yes') 1 >>> vtor.check('boolean', 'YES') 1 >>> vtor.check('boolean', '') Traceback (most recent call last): VdtTypeError: the value "" is of the wrong type. >>> vtor.check('boolean', 'up') Traceback (most recent call last): VdtTypeError: the value "up" is of the wrong type. """ if isinstance(value, basestring): try: return bool_dict[value.lower()] except KeyError: raise VdtTypeError(value) # we do an equality test rather than an identity test # this ensures Python 2.2 compatibilty # and allows 0 and 1 to represent True and False if value == False: return False elif value == True: return True else: raise VdtTypeError(value) def is_ip_addr(value): """ Check that the supplied value is an Internet Protocol address, v.4, represented by a dotted-quad string, i.e. '1.2.3.4'. >>> vtor.check('ip_addr', '1 ') '1' >>> vtor.check('ip_addr', ' 1.2') '1.2' >>> vtor.check('ip_addr', ' 1.2.3 ') '1.2.3' >>> vtor.check('ip_addr', '1.2.3.4') '1.2.3.4' >>> vtor.check('ip_addr', '0.0.0.0') '0.0.0.0' >>> vtor.check('ip_addr', '255.255.255.255') '255.255.255.255' >>> vtor.check('ip_addr', '255.255.255.256') Traceback (most recent call last): VdtValueError: the value "255.255.255.256" is unacceptable. >>> vtor.check('ip_addr', '1.2.3.4.5') Traceback (most recent call last): VdtValueError: the value "1.2.3.4.5" is unacceptable. >>> vtor.check('ip_addr', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. """ if not isinstance(value, basestring): raise VdtTypeError(value) value = value.strip() try: dottedQuadToNum(value) except ValueError: raise VdtValueError(value) return value def is_list(value, min=None, max=None): """ Check that the value is a list of values. You can optionally specify the minimum and maximum number of members. It does no check on list members. >>> vtor.check('list', ()) [] >>> vtor.check('list', []) [] >>> vtor.check('list', (1, 2)) [1, 2] >>> vtor.check('list', [1, 2]) [1, 2] >>> vtor.check('list(3)', (1, 2)) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2)" is too short. >>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6)) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2, 3, 4, 5, 6)" is too long. >>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4)) [1, 2, 3, 4] >>> vtor.check('list', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('list', '12') Traceback (most recent call last): VdtTypeError: the value "12" is of the wrong type. """ (min_len, max_len) = _is_num_param(('min', 'max'), (min, max)) if isinstance(value, basestring): raise VdtTypeError(value) try: num_members = len(value) except TypeError: raise VdtTypeError(value) if min_len is not None and num_members < min_len: raise VdtValueTooShortError(value) if max_len is not None and num_members > max_len: raise VdtValueTooLongError(value) return list(value) def is_tuple(value, min=None, max=None): """ Check that the value is a tuple of values. You can optionally specify the minimum and maximum number of members. It does no check on members. >>> vtor.check('tuple', ()) () >>> vtor.check('tuple', []) () >>> vtor.check('tuple', (1, 2)) (1, 2) >>> vtor.check('tuple', [1, 2]) (1, 2) >>> vtor.check('tuple(3)', (1, 2)) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2)" is too short. >>> vtor.check('tuple(max=5)', (1, 2, 3, 4, 5, 6)) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2, 3, 4, 5, 6)" is too long. >>> vtor.check('tuple(min=3, max=5)', (1, 2, 3, 4)) (1, 2, 3, 4) >>> vtor.check('tuple', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('tuple', '12') Traceback (most recent call last): VdtTypeError: the value "12" is of the wrong type. """ return tuple(is_list(value, min, max)) def is_string(value, min=None, max=None): """ Check that the supplied value is a string. You can optionally specify the minimum and maximum number of members. >>> vtor.check('string', '0') '0' >>> vtor.check('string', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. >>> vtor.check('string(2)', '12') '12' >>> vtor.check('string(2)', '1') Traceback (most recent call last): VdtValueTooShortError: the value "1" is too short. >>> vtor.check('string(min=2, max=3)', '123') '123' >>> vtor.check('string(min=2, max=3)', '1234') Traceback (most recent call last): VdtValueTooLongError: the value "1234" is too long. """ if not isinstance(value, basestring): raise VdtTypeError(value) (min_len, max_len) = _is_num_param(('min', 'max'), (min, max)) try: num_members = len(value) except TypeError: raise VdtTypeError(value) if min_len is not None and num_members < min_len: raise VdtValueTooShortError(value) if max_len is not None and num_members > max_len: raise VdtValueTooLongError(value) return value def is_int_list(value, min=None, max=None): """ Check that the value is a list of integers. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an integer. >>> vtor.check('int_list', ()) [] >>> vtor.check('int_list', []) [] >>> vtor.check('int_list', (1, 2)) [1, 2] >>> vtor.check('int_list', [1, 2]) [1, 2] >>> vtor.check('int_list', [1, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_integer(mem) for mem in is_list(value, min, max)] def is_bool_list(value, min=None, max=None): """ Check that the value is a list of booleans. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a boolean. >>> vtor.check('bool_list', ()) [] >>> vtor.check('bool_list', []) [] >>> check_res = vtor.check('bool_list', (True, False)) >>> check_res == [True, False] 1 >>> check_res = vtor.check('bool_list', [True, False]) >>> check_res == [True, False] 1 >>> vtor.check('bool_list', [True, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_boolean(mem) for mem in is_list(value, min, max)] def is_float_list(value, min=None, max=None): """ Check that the value is a list of floats. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a float. >>> vtor.check('float_list', ()) [] >>> vtor.check('float_list', []) [] >>> vtor.check('float_list', (1, 2.0)) [1.0, 2.0] >>> vtor.check('float_list', [1, 2.0]) [1.0, 2.0] >>> vtor.check('float_list', [1, 'a']) Traceback (most recent call last): VdtTypeError: the value "a" is of the wrong type. """ return [is_float(mem) for mem in is_list(value, min, max)] def is_string_list(value, min=None, max=None): """ Check that the value is a list of strings. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is a string. >>> vtor.check('string_list', ()) [] >>> vtor.check('string_list', []) [] >>> vtor.check('string_list', ('a', 'b')) ['a', 'b'] >>> vtor.check('string_list', ['a', 1]) Traceback (most recent call last): VdtTypeError: the value "1" is of the wrong type. >>> vtor.check('string_list', 'hello') Traceback (most recent call last): VdtTypeError: the value "hello" is of the wrong type. """ if isinstance(value, basestring): raise VdtTypeError(value) return [is_string(mem) for mem in is_list(value, min, max)] def is_ip_addr_list(value, min=None, max=None): """ Check that the value is a list of IP addresses. You can optionally specify the minimum and maximum number of members. Each list member is checked that it is an IP address. >>> vtor.check('ip_addr_list', ()) [] >>> vtor.check('ip_addr_list', []) [] >>> vtor.check('ip_addr_list', ('1.2.3.4', '5.6.7.8')) ['1.2.3.4', '5.6.7.8'] >>> vtor.check('ip_addr_list', ['a']) Traceback (most recent call last): VdtValueError: the value "a" is unacceptable. """ return [is_ip_addr(mem) for mem in is_list(value, min, max)] def force_list(value, min=None, max=None): """ Check that a value is a list, coercing strings into a list with one member. Useful where users forget the trailing comma that turns a single value into a list. You can optionally specify the minimum and maximum number of members. A minumum of greater than one will fail if the user only supplies a string. >>> vtor.check('force_list', ()) [] >>> vtor.check('force_list', []) [] >>> vtor.check('force_list', 'hello') ['hello'] """ if not isinstance(value, (list, tuple)): value = [value] return is_list(value, min, max) fun_dict = { 'integer': is_integer, 'float': is_float, 'ip_addr': is_ip_addr, 'string': is_string, 'boolean': is_boolean, } def is_mixed_list(value, *args): """ Check that the value is a list. Allow specifying the type of each member. Work on lists of specific lengths. You specify each member as a positional argument specifying type Each type should be one of the following strings : 'integer', 'float', 'ip_addr', 'string', 'boolean' So you can specify a list of two strings, followed by two integers as : mixed_list('string', 'string', 'integer', 'integer') The length of the list must match the number of positional arguments you supply. >>> mix_str = "mixed_list('integer', 'float', 'ip_addr', 'string', 'boolean')" >>> check_res = vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', True)) >>> check_res == [1, 2.0, '1.2.3.4', 'a', True] 1 >>> check_res = vtor.check(mix_str, ('1', '2.0', '1.2.3.4', 'a', 'True')) >>> check_res == [1, 2.0, '1.2.3.4', 'a', True] 1 >>> vtor.check(mix_str, ('b', 2.0, '1.2.3.4', 'a', True)) Traceback (most recent call last): VdtTypeError: the value "b" is of the wrong type. >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a')) Traceback (most recent call last): VdtValueTooShortError: the value "(1, 2.0, '1.2.3.4', 'a')" is too short. >>> vtor.check(mix_str, (1, 2.0, '1.2.3.4', 'a', 1, 'b')) Traceback (most recent call last): VdtValueTooLongError: the value "(1, 2.0, '1.2.3.4', 'a', 1, 'b')" is too long. >>> vtor.check(mix_str, 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. This test requires an elaborate setup, because of a change in error string output from the interpreter between Python 2.2 and 2.3 . >>> res_seq = ( ... 'passed an incorrect value "', ... 'yoda', ... '" for parameter "mixed_list".', ... ) >>> res_str = "'".join(res_seq) >>> try: ... vtor.check('mixed_list("yoda")', ('a')) ... except VdtParamError, err: ... str(err) == res_str 1 """ try: length = len(value) except TypeError: raise VdtTypeError(value) if length < len(args): raise VdtValueTooShortError(value) elif length > len(args): raise VdtValueTooLongError(value) try: return [fun_dict[arg](val) for arg, val in zip(args, value)] except KeyError, e: raise VdtParamError('mixed_list', e) def is_option(value, *options): """ This check matches the value to any of a set of options. >>> vtor.check('option("yoda", "jedi")', 'yoda') 'yoda' >>> vtor.check('option("yoda", "jedi")', 'jed') Traceback (most recent call last): VdtValueError: the value "jed" is unacceptable. >>> vtor.check('option("yoda", "jedi")', 0) Traceback (most recent call last): VdtTypeError: the value "0" is of the wrong type. """ if not isinstance(value, basestring): raise VdtTypeError(value) if not value in options: raise VdtValueError(value) return value def _test(value, *args, **keywargs): """ A function that exists for test purposes. >>> checks = [ ... '3, 6, min=1, max=3, test=list(a, b, c)', ... '3', ... '3, 6', ... '3,', ... 'min=1, test="a b c"', ... 'min=5, test="a, b, c"', ... 'min=1, max=3, test="a, b, c"', ... 'min=-100, test=-99', ... 'min=1, max=3', ... '3, 6, test="36"', ... '3, 6, test="a, b, c"', ... '3, max=3, test=list("a", "b", "c")', ... '''3, max=3, test=list("'a'", 'b', "x=(c)")''', ... "test='x=fish(3)'", ... ] >>> v = Validator({'test': _test}) >>> for entry in checks: ... print v.check(('test(%s)' % entry), 3) (3, ('3', '6'), {'test': ['a', 'b', 'c'], 'max': '3', 'min': '1'}) (3, ('3',), {}) (3, ('3', '6'), {}) (3, ('3',), {}) (3, (), {'test': 'a b c', 'min': '1'}) (3, (), {'test': 'a, b, c', 'min': '5'}) (3, (), {'test': 'a, b, c', 'max': '3', 'min': '1'}) (3, (), {'test': '-99', 'min': '-100'}) (3, (), {'max': '3', 'min': '1'}) (3, ('3', '6'), {'test': '36'}) (3, ('3', '6'), {'test': 'a, b, c'}) (3, ('3',), {'test': ['a', 'b', 'c'], 'max': '3'}) (3, ('3',), {'test': ["'a'", 'b', 'x=(c)'], 'max': '3'}) (3, (), {'test': 'x=fish(3)'}) >>> v = Validator() >>> v.check('integer(default=6)', '3') 3 >>> v.check('integer(default=6)', None, True) 6 >>> v.get_default_value('integer(default=6)') 6 >>> v.get_default_value('float(default=6)') 6.0 >>> v.get_default_value('pass(default=None)') >>> v.get_default_value("string(default='None')") 'None' >>> v.get_default_value('pass') Traceback (most recent call last): KeyError: 'Check "pass" has no default value.' >>> v.get_default_value('pass(default=list(1, 2, 3, 4))') ['1', '2', '3', '4'] >>> v = Validator() >>> v.check("pass(default=None)", None, True) >>> v.check("pass(default='None')", None, True) 'None' >>> v.check('pass(default="None")', None, True) 'None' >>> v.check('pass(default=list(1, 2, 3, 4))', None, True) ['1', '2', '3', '4'] Bug test for unicode arguments >>> v = Validator() >>> v.check(u'string(min=4)', u'test') u'test' >>> v = Validator() >>> v.get_default_value(u'string(min=4, default="1234")') u'1234' >>> v.check(u'string(min=4, default="1234")', u'test') u'test' >>> v = Validator() >>> default = v.get_default_value('string(default=None)') >>> default == None 1 """ return (value, args, keywargs) def _test2(): """ >>> >>> v = Validator() >>> v.get_default_value('string(default="#ff00dd")') '#ff00dd' >>> v.get_default_value('integer(default=3) # comment') 3 """ def _test3(): r""" >>> vtor.check('string(default="")', '', missing=True) '' >>> vtor.check('string(default="\n")', '', missing=True) '\n' >>> print vtor.check('string(default="\n")', '', missing=True), >>> vtor.check('string()', '\n') '\n' >>> vtor.check('string(default="\n\n\n")', '', missing=True) '\n\n\n' >>> vtor.check('string()', 'random \n text goes here\n\n') 'random \n text goes here\n\n' >>> vtor.check('string(default=" \nrandom text\ngoes \n here\n\n ")', ... '', missing=True) ' \nrandom text\ngoes \n here\n\n ' >>> vtor.check("string(default='\n\n\n')", '', missing=True) '\n\n\n' >>> vtor.check("option('\n','a','b',default='\n')", '', missing=True) '\n' >>> vtor.check("string_list()", ['foo', '\n', 'bar']) ['foo', '\n', 'bar'] >>> vtor.check("string_list(default=list('\n'))", '', missing=True) ['\n'] """ if __name__ == '__main__': # run the code tests in doctest format import sys import doctest m = sys.modules.get('__main__') globs = m.__dict__.copy() globs.update({ 'vtor': Validator(), }) doctest.testmod(m, globs=globs) astropy-0.3/astropy/extern/configobj_py2/configobj.py0000644000175000017500000025414312243255342021262 0ustar oleole# configobj.py # A config file reader/writer that supports nested sections in config files. # Copyright (C) 2005-2010 Michael Foord, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # nico AT tekNico DOT net # ConfigObj 4 # http://www.voidspace.org.uk/python/configobj.html # Released subject to the BSD License # Please see http://www.voidspace.org.uk/python/license.shtml # Scripts maintained at http://www.voidspace.org.uk/python/index.shtml # For information about bugfixes, updates and support, please join the # ConfigObj mailing list: # http://lists.sourceforge.net/lists/listinfo/configobj-develop # Comments, suggestions and bug reports welcome. from __future__ import generators import os import re import sys from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE # imported lazily to avoid startup performance hit if it isn't used compiler = None # A dictionary mapping BOM to # the encoding to decode with, and what to set the # encoding attribute to. BOMS = { BOM_UTF8: ('utf_8', None), BOM_UTF16_BE: ('utf16_be', 'utf_16'), BOM_UTF16_LE: ('utf16_le', 'utf_16'), BOM_UTF16: ('utf_16', 'utf_16'), } # All legal variants of the BOM codecs. # TODO: the list of aliases is not meant to be exhaustive, is there a # better way ? BOM_LIST = { 'utf_16': 'utf_16', 'u16': 'utf_16', 'utf16': 'utf_16', 'utf-16': 'utf_16', 'utf16_be': 'utf16_be', 'utf_16_be': 'utf16_be', 'utf-16be': 'utf16_be', 'utf16_le': 'utf16_le', 'utf_16_le': 'utf16_le', 'utf-16le': 'utf16_le', 'utf_8': 'utf_8', 'u8': 'utf_8', 'utf': 'utf_8', 'utf8': 'utf_8', 'utf-8': 'utf_8', } # Map of encodings to the BOM to write. BOM_SET = { 'utf_8': BOM_UTF8, 'utf_16': BOM_UTF16, 'utf16_be': BOM_UTF16_BE, 'utf16_le': BOM_UTF16_LE, None: BOM_UTF8 } def match_utf8(encoding): return BOM_LIST.get(encoding.lower()) == 'utf_8' # Quote strings used for writing values squot = "'%s'" dquot = '"%s"' noquot = "%s" wspace_plus = ' \r\n\v\t\'"' tsquot = '"""%s"""' tdquot = "'''%s'''" # Sentinel for use in getattr calls to replace hasattr MISSING = object() __version__ = '4.7.2' try: any except NameError: def any(iterable): for entry in iterable: if entry: return True return False __all__ = ( '__version__', 'DEFAULT_INDENT_TYPE', 'DEFAULT_INTERPOLATION', 'ConfigObjError', 'NestingError', 'ParseError', 'DuplicateError', 'ConfigspecError', 'ConfigObj', 'SimpleVal', 'InterpolationError', 'InterpolationLoopError', 'MissingInterpolationOption', 'RepeatSectionError', 'ReloadError', 'UnreprError', 'UnknownType', 'flatten_errors', 'get_extra_values' ) DEFAULT_INTERPOLATION = 'configparser' DEFAULT_INDENT_TYPE = ' ' MAX_INTERPOL_DEPTH = 10 OPTION_DEFAULTS = { 'interpolation': True, 'raise_errors': False, 'list_values': True, 'create_empty': False, 'file_error': False, 'configspec': None, 'stringify': True, # option may be set to one of ('', ' ', '\t') 'indent_type': None, 'encoding': None, 'default_encoding': None, 'unrepr': False, 'write_empty_values': False, } def getObj(s): global compiler if compiler is None: import compiler s = "a=" + s p = compiler.parse(s) return p.getChildren()[1].getChildren()[0].getChildren()[1] class UnknownType(Exception): pass class Builder(object): def build(self, o): m = getattr(self, 'build_' + o.__class__.__name__, None) if m is None: raise UnknownType(o.__class__.__name__) return m(o) def build_List(self, o): return map(self.build, o.getChildren()) def build_Const(self, o): return o.value def build_Dict(self, o): d = {} i = iter(map(self.build, o.getChildren())) for el in i: d[el] = i.next() return d def build_Tuple(self, o): return tuple(self.build_List(o)) def build_Name(self, o): if o.name == 'None': return None if o.name == 'True': return True if o.name == 'False': return False # An undefined Name raise UnknownType('Undefined Name') def build_Add(self, o): real, imag = map(self.build_Const, o.getChildren()) try: real = float(real) except TypeError: raise UnknownType('Add') if not isinstance(imag, complex) or imag.real != 0.0: raise UnknownType('Add') return real+imag def build_Getattr(self, o): parent = self.build(o.expr) return getattr(parent, o.attrname) def build_UnarySub(self, o): return -self.build_Const(o.getChildren()[0]) def build_UnaryAdd(self, o): return self.build_Const(o.getChildren()[0]) _builder = Builder() def unrepr(s): if not s: return s return _builder.build(getObj(s)) class ConfigObjError(SyntaxError): """ This is the base class for all errors that ConfigObj raises. It is a subclass of SyntaxError. """ def __init__(self, message='', line_number=None, line=''): self.line = line self.line_number = line_number SyntaxError.__init__(self, message) class NestingError(ConfigObjError): """ This error indicates a level of nesting that doesn't match. """ class ParseError(ConfigObjError): """ This error indicates that a line is badly written. It is neither a valid ``key = value`` line, nor a valid section marker line. """ class ReloadError(IOError): """ A 'reload' operation failed. This exception is a subclass of ``IOError``. """ def __init__(self): IOError.__init__(self, 'reload failed, filename is not set.') class DuplicateError(ConfigObjError): """ The keyword or section specified already exists. """ class ConfigspecError(ConfigObjError): """ An error occured whilst parsing a configspec. """ class InterpolationError(ConfigObjError): """Base class for the two interpolation errors.""" class InterpolationLoopError(InterpolationError): """Maximum interpolation depth exceeded in string interpolation.""" def __init__(self, option): InterpolationError.__init__( self, 'interpolation loop detected in value "%s".' % option) class RepeatSectionError(ConfigObjError): """ This error indicates additional sections in a section with a ``__many__`` (repeated) section. """ class MissingInterpolationOption(InterpolationError): """A value specified for interpolation was missing.""" def __init__(self, option): msg = 'missing option "%s" in interpolation.' % option InterpolationError.__init__(self, msg) class UnreprError(ConfigObjError): """An error parsing in unrepr mode.""" class InterpolationEngine(object): """ A helper class to help perform string interpolation. This class is an abstract base class; its descendants perform the actual work. """ # compiled regexp to use in self.interpolate() _KEYCRE = re.compile(r"%\(([^)]*)\)s") _cookie = '%' def __init__(self, section): # the Section instance that "owns" this engine self.section = section def interpolate(self, key, value): # short-cut if not self._cookie in value: return value def recursive_interpolate(key, value, section, backtrail): """The function that does the actual work. ``value``: the string we're trying to interpolate. ``section``: the section in which that string was found ``backtrail``: a dict to keep track of where we've been, to detect and prevent infinite recursion loops This is similar to a depth-first-search algorithm. """ # Have we been here already? if (key, section.name) in backtrail: # Yes - infinite loop detected raise InterpolationLoopError(key) # Place a marker on our backtrail so we won't come back here again backtrail[(key, section.name)] = 1 # Now start the actual work match = self._KEYCRE.search(value) while match: # The actual parsing of the match is implementation-dependent, # so delegate to our helper function k, v, s = self._parse_match(match) if k is None: # That's the signal that no further interpolation is needed replacement = v else: # Further interpolation may be needed to obtain final value replacement = recursive_interpolate(k, v, s, backtrail) # Replace the matched string with its final value start, end = match.span() value = ''.join((value[:start], replacement, value[end:])) new_search_start = start + len(replacement) # Pick up the next interpolation key, if any, for next time # through the while loop match = self._KEYCRE.search(value, new_search_start) # Now safe to come back here again; remove marker from backtrail del backtrail[(key, section.name)] return value # Back in interpolate(), all we have to do is kick off the recursive # function with appropriate starting values value = recursive_interpolate(key, value, self.section, {}) return value def _fetch(self, key): """Helper function to fetch values from owning section. Returns a 2-tuple: the value, and the section where it was found. """ # switch off interpolation before we try and fetch anything ! save_interp = self.section.main.interpolation self.section.main.interpolation = False # Start at section that "owns" this InterpolationEngine current_section = self.section while True: # try the current section first val = current_section.get(key) if val is not None and not isinstance(val, Section): break # try "DEFAULT" next val = current_section.get('DEFAULT', {}).get(key) if val is not None and not isinstance(val, Section): break # move up to parent and try again # top-level's parent is itself if current_section.parent is current_section: # reached top level, time to give up break current_section = current_section.parent # restore interpolation to previous value before returning self.section.main.interpolation = save_interp if val is None: raise MissingInterpolationOption(key) return val, current_section def _parse_match(self, match): """Implementation-dependent helper function. Will be passed a match object corresponding to the interpolation key we just found (e.g., "%(foo)s" or "$foo"). Should look up that key in the appropriate config file section (using the ``_fetch()`` helper function) and return a 3-tuple: (key, value, section) ``key`` is the name of the key we're looking for ``value`` is the value found for that key ``section`` is a reference to the section where it was found ``key`` and ``section`` should be None if no further interpolation should be performed on the resulting value (e.g., if we interpolated "$$" and returned "$"). """ raise NotImplementedError() class ConfigParserInterpolation(InterpolationEngine): """Behaves like ConfigParser.""" _cookie = '%' _KEYCRE = re.compile(r"%\(([^)]*)\)s") def _parse_match(self, match): key = match.group(1) value, section = self._fetch(key) return key, value, section class TemplateInterpolation(InterpolationEngine): """Behaves like string.Template.""" _cookie = '$' _delimiter = '$' _KEYCRE = re.compile(r""" \$(?: (?P\$) | # Two $ signs (?P[_a-z][_a-z0-9]*) | # $name format {(?P[^}]*)} # ${name} format ) """, re.IGNORECASE | re.VERBOSE) def _parse_match(self, match): # Valid name (in or out of braces): fetch value from section key = match.group('named') or match.group('braced') if key is not None: value, section = self._fetch(key) return key, value, section # Escaped delimiter (e.g., $$): return single delimiter if match.group('escaped') is not None: # Return None for key and section to indicate it's time to stop return None, self._delimiter, None # Anything else: ignore completely, just return it unchanged return None, match.group(), None interpolation_engines = { 'configparser': ConfigParserInterpolation, 'template': TemplateInterpolation, } def __newobj__(cls, *args): # Hack for pickle return cls.__new__(cls, *args) class Section(dict): """ A dictionary-like object that represents a section in a config file. It does string interpolation if the 'interpolation' attribute of the 'main' object is set to True. Interpolation is tried first from this object, then from the 'DEFAULT' section of this object, next from the parent and its 'DEFAULT' section, and so on until the main object is reached. A Section will behave like an ordered dictionary - following the order of the ``scalars`` and ``sections`` attributes. You can use this to change the order of members. Iteration follows the order: scalars, then sections. """ def __setstate__(self, state): dict.update(self, state[0]) self.__dict__.update(state[1]) def __reduce__(self): state = (dict(self), self.__dict__) return (__newobj__, (self.__class__,), state) def __init__(self, parent, depth, main, indict=None, name=None): """ * parent is the section above * depth is the depth level of this section * main is the main ConfigObj * indict is a dictionary to initialise the section with """ if indict is None: indict = {} dict.__init__(self) # used for nesting level *and* interpolation self.parent = parent # used for the interpolation attribute self.main = main # level of nesting depth of this Section self.depth = depth # purely for information self.name = name # self._initialise() # we do this explicitly so that __setitem__ is used properly # (rather than just passing to ``dict.__init__``) for entry, value in indict.iteritems(): self[entry] = value def _initialise(self): # the sequence of scalar values in this Section self.scalars = [] # the sequence of sections in this Section self.sections = [] # for comments :-) self.comments = {} self.inline_comments = {} # the configspec self.configspec = None # for defaults self.defaults = [] self.default_values = {} self.extra_values = [] self._created = False def _interpolate(self, key, value): try: # do we already have an interpolation engine? engine = self._interpolation_engine except AttributeError: # not yet: first time running _interpolate(), so pick the engine name = self.main.interpolation if name == True: # note that "if name:" would be incorrect here # backwards-compatibility: interpolation=True means use default name = DEFAULT_INTERPOLATION name = name.lower() # so that "Template", "template", etc. all work class_ = interpolation_engines.get(name, None) if class_ is None: # invalid value for self.main.interpolation self.main.interpolation = False return value else: # save reference to engine so we don't have to do this again engine = self._interpolation_engine = class_(self) # let the engine do the actual work return engine.interpolate(key, value) def __getitem__(self, key): """Fetch the item and do string interpolation.""" val = dict.__getitem__(self, key) if self.main.interpolation: if isinstance(val, basestring): return self._interpolate(key, val) if isinstance(val, list): def _check(entry): if isinstance(entry, basestring): return self._interpolate(key, entry) return entry new = [_check(entry) for entry in val] if new != val: return new return val def __setitem__(self, key, value, unrepr=False): """ Correctly set a value. Making dictionary values Section instances. (We have to special case 'Section' instances - which are also dicts) Keys must be strings. Values need only be strings (or lists of strings) if ``main.stringify`` is set. ``unrepr`` must be set when setting a value to a dictionary, without creating a new sub-section. """ if not isinstance(key, basestring): raise ValueError('The key "%s" is not a string.' % key) # add the comment if key not in self.comments: self.comments[key] = [] self.inline_comments[key] = '' # remove the entry from defaults if key in self.defaults: self.defaults.remove(key) # if isinstance(value, Section): if key not in self: self.sections.append(key) dict.__setitem__(self, key, value) elif isinstance(value, dict) and not unrepr: # First create the new depth level, # then create the section if key not in self: self.sections.append(key) new_depth = self.depth + 1 dict.__setitem__( self, key, Section( self, new_depth, self.main, indict=value, name=key)) else: if key not in self: self.scalars.append(key) if not self.main.stringify: if isinstance(value, basestring): pass elif isinstance(value, (list, tuple)): for entry in value: if not isinstance(entry, basestring): raise TypeError('Value is not a string "%s".' % entry) else: raise TypeError('Value is not a string "%s".' % value) dict.__setitem__(self, key, value) def __delitem__(self, key): """Remove items from the sequence when deleting.""" dict. __delitem__(self, key) if key in self.scalars: self.scalars.remove(key) else: self.sections.remove(key) del self.comments[key] del self.inline_comments[key] def get(self, key, default=None): """A version of ``get`` that doesn't bypass string interpolation.""" try: return self[key] except KeyError: return default def update(self, indict): """ A version of update that uses our ``__setitem__``. """ for entry in indict: self[entry] = indict[entry] def pop(self, key, default=MISSING): """ 'D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised' """ try: val = self[key] except KeyError: if default is MISSING: raise val = default else: del self[key] return val def popitem(self): """Pops the first (key,val)""" sequence = (self.scalars + self.sections) if not sequence: raise KeyError(": 'popitem(): dictionary is empty'") key = sequence[0] val = self[key] del self[key] return key, val def clear(self): """ A version of clear that also affects scalars/sections Also clears comments and configspec. Leaves other attributes alone : depth/main/parent are not affected """ dict.clear(self) self.scalars = [] self.sections = [] self.comments = {} self.inline_comments = {} self.configspec = None self.defaults = [] self.extra_values = [] def setdefault(self, key, default=None): """A version of setdefault that sets sequence if appropriate.""" try: return self[key] except KeyError: self[key] = default return self[key] def items(self): """D.items() -> list of D's (key, value) pairs, as 2-tuples""" return zip((self.scalars + self.sections), self.values()) def keys(self): """D.keys() -> list of D's keys""" return (self.scalars + self.sections) def values(self): """D.values() -> list of D's values""" return [self[key] for key in (self.scalars + self.sections)] def iteritems(self): """D.iteritems() -> an iterator over the (key, value) items of D""" return iter(self.items()) def iterkeys(self): """D.iterkeys() -> an iterator over the keys of D""" return iter((self.scalars + self.sections)) __iter__ = iterkeys def itervalues(self): """D.itervalues() -> an iterator over the values of D""" return iter(self.values()) def __repr__(self): """x.__repr__() <==> repr(x)""" def _getval(key): try: return self[key] except MissingInterpolationOption: return dict.__getitem__(self, key) return '{%s}' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) for key in (self.scalars + self.sections)]) __str__ = __repr__ __str__.__doc__ = "x.__str__() <==> str(x)" # Extra methods - not in a normal dictionary def dict(self): """ Return a deepcopy of self as a dictionary. All members that are ``Section`` instances are recursively turned to ordinary dictionaries - by calling their ``dict`` method. >>> n = a.dict() >>> n == a 1 >>> n is a 0 """ newdict = {} for entry in self: this_entry = self[entry] if isinstance(this_entry, Section): this_entry = this_entry.dict() elif isinstance(this_entry, list): # create a copy rather than a reference this_entry = list(this_entry) elif isinstance(this_entry, tuple): # create a copy rather than a reference this_entry = tuple(this_entry) newdict[entry] = this_entry return newdict def merge(self, indict): """ A recursive update - useful for merging config files. >>> a = '''[section1] ... option1 = True ... [[subsection]] ... more_options = False ... # end of file'''.splitlines() >>> b = '''# File is user.ini ... [section1] ... option1 = False ... # end of file'''.splitlines() >>> c1 = ConfigObj(b) >>> c2 = ConfigObj(a) >>> c2.merge(c1) >>> c2 ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}}) """ for key, val in indict.items(): if (key in self and isinstance(self[key], dict) and isinstance(val, dict)): self[key].merge(val) else: self[key] = val def rename(self, oldkey, newkey): """ Change a keyname to another, without changing position in sequence. Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode) Also renames comments. """ if oldkey in self.scalars: the_list = self.scalars elif oldkey in self.sections: the_list = self.sections else: raise KeyError('Key "%s" not found.' % oldkey) pos = the_list.index(oldkey) # val = self[oldkey] dict.__delitem__(self, oldkey) dict.__setitem__(self, newkey, val) the_list.remove(oldkey) the_list.insert(pos, newkey) comm = self.comments[oldkey] inline_comment = self.inline_comments[oldkey] del self.comments[oldkey] del self.inline_comments[oldkey] self.comments[newkey] = comm self.inline_comments[newkey] = inline_comment def walk(self, function, raise_errors=True, call_on_sections=False, **keywargs): """ Walk every member and call a function on the keyword and value. Return a dictionary of the return values If the function raises an exception, raise the errror unless ``raise_errors=False``, in which case set the return value to ``False``. Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in. Note: if ``call_on_sections`` is ``True`` then - on encountering a subsection, *first* the function is called for the *whole* subsection, and then recurses into it's members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded. See the encode and decode methods for examples, including functions. .. admonition:: caution You can use ``walk`` to transform the names of members of a section but you mustn't add or delete members. >>> config = '''[XXXXsection] ... XXXXkey = XXXXvalue'''.splitlines() >>> cfg = ConfigObj(config) >>> cfg ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}}) >>> def transform(section, key): ... val = section[key] ... newkey = key.replace('XXXX', 'CLIENT1') ... section.rename(key, newkey) ... if isinstance(val, (tuple, list, dict)): ... pass ... else: ... val = val.replace('XXXX', 'CLIENT1') ... section[newkey] = val >>> cfg.walk(transform, call_on_sections=True) {'CLIENT1section': {'CLIENT1key': None}} >>> cfg ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}}) """ out = {} # scalars first for i in range(len(self.scalars)): entry = self.scalars[i] try: val = function(self, entry, **keywargs) # bound again in case name has changed entry = self.scalars[i] out[entry] = val except Exception: if raise_errors: raise else: entry = self.scalars[i] out[entry] = False # then sections for i in range(len(self.sections)): entry = self.sections[i] if call_on_sections: try: function(self, entry, **keywargs) except Exception: if raise_errors: raise else: entry = self.sections[i] out[entry] = False # bound again in case name has changed entry = self.sections[i] # previous result is discarded out[entry] = self[entry].walk( function, raise_errors=raise_errors, call_on_sections=call_on_sections, **keywargs) return out def as_bool(self, key): """ Accepts a key as input. The corresponding value must be a string or the objects (``True`` or 1) or (``False`` or 0). We allow 0 and 1 to retain compatibility with Python 2.2. If the string is one of ``True``, ``On``, ``Yes``, or ``1`` it returns ``True``. If the string is one of ``False``, ``Off``, ``No``, or ``0`` it returns ``False``. ``as_bool`` is not case sensitive. Any other input will raise a ``ValueError``. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_bool('a') Traceback (most recent call last): ValueError: Value "fish" is neither True nor False >>> a['b'] = 'True' >>> a.as_bool('b') 1 >>> a['b'] = 'off' >>> a.as_bool('b') 0 """ val = self[key] if val == True: return True elif val == False: return False else: try: if not isinstance(val, basestring): # TODO: Why do we raise a KeyError here? raise KeyError() else: return self.main._bools[val.lower()] except KeyError: raise ValueError('Value "%s" is neither True nor False' % val) def as_int(self, key): """ A convenience method which coerces the specified value to an integer. If the value is an invalid literal for ``int``, a ``ValueError`` will be raised. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_int('a') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: 'fish' >>> a['b'] = '1' >>> a.as_int('b') 1 >>> a['b'] = '3.2' >>> a.as_int('b') Traceback (most recent call last): ValueError: invalid literal for int() with base 10: '3.2' """ return int(self[key]) def as_float(self, key): """ A convenience method which coerces the specified value to a float. If the value is an invalid literal for ``float``, a ``ValueError`` will be raised. >>> a = ConfigObj() >>> a['a'] = 'fish' >>> a.as_float('a') Traceback (most recent call last): ValueError: invalid literal for float(): fish >>> a['b'] = '1' >>> a.as_float('b') 1.0 >>> a['b'] = '3.2' >>> a.as_float('b') 3.2000000000000002 """ return float(self[key]) def as_list(self, key): """ A convenience method which fetches the specified value, guaranteeing that it is a list. >>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1] """ result = self[key] if isinstance(result, (tuple, list)): return list(result) return [result] def restore_default(self, key): """ Restore (and return) default value for the specified key. This method will only work for a ConfigObj that was created with a configspec and has been validated. If there is no default value for this key, ``KeyError`` is raised. """ default = self.default_values[key] dict.__setitem__(self, key, default) if key not in self.defaults: self.defaults.append(key) return default def restore_defaults(self): """ Recursively restore default values to all members that have them. This method will only work for a ConfigObj that was created with a configspec and has been validated. It doesn't delete or modify entries without default values. """ for key in self.default_values: self.restore_default(key) for section in self.sections: self[section].restore_defaults() class ConfigObj(Section): """An object to read, create, and write config files.""" _keyword = re.compile(r'''^ # line start (\s*) # indentation ( # keyword (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'"=].*?) # no quotes ) \s*=\s* # divider (.*) # value (including list values and comments) $ # line end ''', re.VERBOSE) _sectionmarker = re.compile(r'''^ (\s*) # 1: indentation ((?:\[\s*)+) # 2: section marker open ( # 3: section name open (?:"\s*\S.*?\s*")| # at least one non-space with double quotes (?:'\s*\S.*?\s*')| # at least one non-space with single quotes (?:[^'"\s].*?) # at least one non-space unquoted ) # section name close ((?:\s*\])+) # 4: section marker close \s*(\#.*)? # 5: optional comment $''', re.VERBOSE) # this regexp pulls list values out as a single string # or single values and comments # FIXME: this regex adds a '' to the end of comma terminated lists # workaround in ``_handle_value`` _valueexp = re.compile(r'''^ (?: (?: ( (?: (?: (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\#][^,\#]*?) # unquoted ) \s*,\s* # comma )* # match all list items ending in a comma (if any) ) ( (?:".*?")| # double quotes (?:'.*?')| # single quotes (?:[^'",\#\s][^,]*?)| # unquoted (?:(? 1: msg = "Parsing failed with several errors.\nFirst error %s" % info error = ConfigObjError(msg) else: error = self._errors[0] # set the errors attribute; it's a list of tuples: # (error_type, message, line_number) error.errors = self._errors # set the config attribute error.config = self raise error # delete private attributes del self._errors if configspec is None: self.configspec = None else: self._handle_configspec(configspec) def _initialise(self, options=None): if options is None: options = OPTION_DEFAULTS # initialise a few variables self.filename = None self._errors = [] self.raise_errors = options['raise_errors'] self.interpolation = options['interpolation'] self.list_values = options['list_values'] self.create_empty = options['create_empty'] self.file_error = options['file_error'] self.stringify = options['stringify'] self.indent_type = options['indent_type'] self.encoding = options['encoding'] self.default_encoding = options['default_encoding'] self.BOM = False self.newlines = None self.write_empty_values = options['write_empty_values'] self.unrepr = options['unrepr'] self.initial_comment = [] self.final_comment = [] self.configspec = None if self._inspec: self.list_values = False # Clear section attributes as well Section._initialise(self) def __repr__(self): def _getval(key): try: return self[key] except MissingInterpolationOption: return dict.__getitem__(self, key) return ('ConfigObj({%s})' % ', '.join([('%s: %s' % (repr(key), repr(_getval(key)))) for key in (self.scalars + self.sections)])) def _handle_bom(self, infile): """ Handle any BOM, and decode if necessary. If an encoding is specified, that *must* be used - but the BOM should still be removed (and the BOM attribute set). (If the encoding is wrongly specified, then a BOM for an alternative encoding won't be discovered or removed.) If an encoding is not specified, UTF8 or UTF16 BOM will be detected and removed. The BOM attribute will be set. UTF16 will be decoded to unicode. NOTE: This method must not be called with an empty ``infile``. Specifying the *wrong* encoding is likely to cause a ``UnicodeDecodeError``. ``infile`` must always be returned as a list of lines, but may be passed in as a single string. """ if ((self.encoding is not None) and (self.encoding.lower() not in BOM_LIST)): # No need to check for a BOM # the encoding specified doesn't have one # just decode return self._decode(infile, self.encoding) if isinstance(infile, (list, tuple)): line = infile[0] else: line = infile if self.encoding is not None: # encoding explicitly supplied # And it could have an associated BOM # TODO: if encoding is just UTF16 - we ought to check for both # TODO: big endian and little endian versions. enc = BOM_LIST[self.encoding.lower()] if enc == 'utf_16': # For UTF16 we try big endian and little endian for BOM, (encoding, final_encoding) in BOMS.items(): if not final_encoding: # skip UTF8 continue if infile.startswith(BOM): ### BOM discovered ##self.BOM = True # Don't need to remove BOM return self._decode(infile, encoding) # If we get this far, will *probably* raise a DecodeError # As it doesn't appear to start with a BOM return self._decode(infile, self.encoding) # Must be UTF8 BOM = BOM_SET[enc] if not line.startswith(BOM): return self._decode(infile, self.encoding) newline = line[len(BOM):] # BOM removed if isinstance(infile, (list, tuple)): infile[0] = newline else: infile = newline self.BOM = True return self._decode(infile, self.encoding) # No encoding specified - so we need to check for UTF8/UTF16 for BOM, (encoding, final_encoding) in BOMS.items(): if not line.startswith(BOM): continue else: # BOM discovered self.encoding = final_encoding if not final_encoding: self.BOM = True # UTF8 # remove BOM newline = line[len(BOM):] if isinstance(infile, (list, tuple)): infile[0] = newline else: infile = newline # UTF8 - don't decode if isinstance(infile, basestring): return infile.splitlines(True) else: return infile # UTF16 - have to decode return self._decode(infile, encoding) # No BOM discovered and no encoding specified, just return if isinstance(infile, basestring): # infile read from a file will be a single string return infile.splitlines(True) return infile def _a_to_u(self, aString): """Decode ASCII strings to unicode if a self.encoding is specified.""" if self.encoding: return aString.decode('ascii') else: return aString def _decode(self, infile, encoding): """ Decode infile to unicode. Using the specified encoding. if is a string, it also needs converting to a list. """ if isinstance(infile, basestring): # can't be unicode # NOTE: Could raise a ``UnicodeDecodeError`` return infile.decode(encoding).splitlines(True) for i, line in enumerate(infile): if not isinstance(line, unicode): # NOTE: The isinstance test here handles mixed lists of unicode/string # NOTE: But the decode will break on any non-string values # NOTE: Or could raise a ``UnicodeDecodeError`` infile[i] = line.decode(encoding) return infile def _decode_element(self, line): """Decode element to unicode if necessary.""" if not self.encoding: return line if isinstance(line, str) and self.default_encoding: return line.decode(self.default_encoding) return line def _str(self, value): """ Used by ``stringify`` within validate, to turn non-string values into strings. """ if not isinstance(value, basestring): return str(value) else: return value def _parse(self, infile): """Actually parse the config file.""" temp_list_values = self.list_values if self.unrepr: self.list_values = False comment_list = [] done_start = False this_section = self maxline = len(infile) - 1 cur_index = -1 reset_comment = False while cur_index < maxline: if reset_comment: comment_list = [] cur_index += 1 line = infile[cur_index] sline = line.strip() # do we have anything on the line ? if not sline or sline.startswith('#'): reset_comment = False comment_list.append(line) continue if not done_start: # preserve initial comment self.initial_comment = comment_list comment_list = [] done_start = True reset_comment = True # first we check if it's a section marker mat = self._sectionmarker.match(line) if mat is not None: # is a section line (indent, sect_open, sect_name, sect_close, comment) = mat.groups() if indent and (self.indent_type is None): self.indent_type = indent cur_depth = sect_open.count('[') if cur_depth != sect_close.count(']'): self._handle_error("Cannot compute the section depth at line %s.", NestingError, infile, cur_index) continue if cur_depth < this_section.depth: # the new section is dropping back to a previous level try: parent = self._match_depth(this_section, cur_depth).parent except SyntaxError: self._handle_error("Cannot compute nesting level at line %s.", NestingError, infile, cur_index) continue elif cur_depth == this_section.depth: # the new section is a sibling of the current section parent = this_section.parent elif cur_depth == this_section.depth + 1: # the new section is a child the current section parent = this_section else: self._handle_error("Section too nested at line %s.", NestingError, infile, cur_index) sect_name = self._unquote(sect_name) if sect_name in parent: self._handle_error('Duplicate section name at line %s.', DuplicateError, infile, cur_index) continue # create the new section this_section = Section( parent, cur_depth, self, name=sect_name) parent[sect_name] = this_section parent.inline_comments[sect_name] = comment parent.comments[sect_name] = comment_list continue # # it's not a section marker, # so it should be a valid ``key = value`` line mat = self._keyword.match(line) if mat is None: # it neither matched as a keyword # or a section marker self._handle_error( 'Invalid line at line "%s".', ParseError, infile, cur_index) else: # is a keyword value # value will include any inline comment (indent, key, value) = mat.groups() if indent and (self.indent_type is None): self.indent_type = indent # check for a multiline value if value[:3] in ['"""', "'''"]: try: value, comment, cur_index = self._multiline( value, infile, cur_index, maxline) except SyntaxError: self._handle_error( 'Parse error in value at line %s.', ParseError, infile, cur_index) continue else: if self.unrepr: comment = '' try: value = unrepr(value) except Exception, e: if type(e) == UnknownType: msg = 'Unknown name or type in value at line %s.' else: msg = 'Parse error in value at line %s.' self._handle_error(msg, UnreprError, infile, cur_index) continue else: if self.unrepr: comment = '' try: value = unrepr(value) except Exception, e: if isinstance(e, UnknownType): msg = 'Unknown name or type in value at line %s.' else: msg = 'Parse error in value at line %s.' self._handle_error(msg, UnreprError, infile, cur_index) continue else: # extract comment and lists try: (value, comment) = self._handle_value(value) except SyntaxError: self._handle_error( 'Parse error in value at line %s.', ParseError, infile, cur_index) continue # key = self._unquote(key) if key in this_section: self._handle_error( 'Duplicate keyword name at line %s.', DuplicateError, infile, cur_index) continue # add the key. # we set unrepr because if we have got this far we will never # be creating a new section this_section.__setitem__(key, value, unrepr=True) this_section.inline_comments[key] = comment this_section.comments[key] = comment_list continue # if self.indent_type is None: # no indentation used, set the type accordingly self.indent_type = '' # preserve the final comment if not self and not self.initial_comment: self.initial_comment = comment_list elif not reset_comment: self.final_comment = comment_list self.list_values = temp_list_values def _match_depth(self, sect, depth): """ Given a section and a depth level, walk back through the sections parents to see if the depth level matches a previous section. Return a reference to the right section, or raise a SyntaxError. """ while depth < sect.depth: if sect is sect.parent: # we've reached the top level already raise SyntaxError() sect = sect.parent if sect.depth == depth: return sect # shouldn't get here raise SyntaxError() def _handle_error(self, text, ErrorClass, infile, cur_index): """ Handle an error according to the error settings. Either raise the error or store it. The error will have occured at ``cur_index`` """ line = infile[cur_index] cur_index += 1 message = text % cur_index error = ErrorClass(message, cur_index, line) if self.raise_errors: # raise the error - parsing stops here raise error # store the error # reraise when parsing has finished self._errors.append(error) def _unquote(self, value): """Return an unquoted version of a value""" if not value: # should only happen during parsing of lists raise SyntaxError if (value[0] == value[-1]) and (value[0] in ('"', "'")): value = value[1:-1] return value def _quote(self, value, multiline=True): """ Return a safely quoted version of a value. Raise a ConfigObjError if the value cannot be safely quoted. If multiline is ``True`` (default) then use triple quotes if necessary. * Don't quote values that don't need it. * Recursively quote members of a list and return a comma joined list. * Multiline is ``False`` for lists. * Obey list syntax for empty and single member lists. If ``list_values=False`` then the value is only quoted if it contains a ``\\n`` (is multiline) or '#'. If ``write_empty_values`` is set, and the value is an empty string, it won't be quoted. """ if multiline and self.write_empty_values and value == '': # Only if multiline is set, so that it is used for values not # keys, and not values that are part of a list return '' if multiline and isinstance(value, (list, tuple)): if not value: return ',' elif len(value) == 1: return self._quote(value[0], multiline=False) + ',' return ', '.join([self._quote(val, multiline=False) for val in value]) if not isinstance(value, basestring): if self.stringify: value = str(value) else: raise TypeError('Value "%s" is not a string.' % value) if not value: return '""' no_lists_no_quotes = not self.list_values and '\n' not in value and '#' not in value need_triple = multiline and ((("'" in value) and ('"' in value)) or ('\n' in value )) hash_triple_quote = multiline and not need_triple and ("'" in value) and ('"' in value) and ('#' in value) check_for_single = (no_lists_no_quotes or not need_triple) and not hash_triple_quote if check_for_single: if not self.list_values: # we don't quote if ``list_values=False`` quot = noquot # for normal values either single or double quotes will do elif '\n' in value: # will only happen if multiline is off - e.g. '\n' in key raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) elif ((value[0] not in wspace_plus) and (value[-1] not in wspace_plus) and (',' not in value)): quot = noquot else: quot = self._get_single_quote(value) else: # if value has '\n' or "'" *and* '"', it will need triple quotes quot = self._get_triple_quote(value) if quot == noquot and '#' in value and self.list_values: quot = self._get_single_quote(value) return quot % value def _get_single_quote(self, value): if ("'" in value) and ('"' in value): raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) elif '"' in value: quot = squot else: quot = dquot return quot def _get_triple_quote(self, value): if (value.find('"""') != -1) and (value.find("'''") != -1): raise ConfigObjError('Value "%s" cannot be safely quoted.' % value) if value.find('"""') == -1: quot = tdquot else: quot = tsquot return quot def _handle_value(self, value): """ Given a value string, unquote, remove comment, handle lists. (including empty and single member lists) """ if self._inspec: # Parsing a configspec so don't handle comments return (value, '') # do we look for lists in values ? if not self.list_values: mat = self._nolistvalue.match(value) if mat is None: raise SyntaxError() # NOTE: we don't unquote here return mat.groups() # mat = self._valueexp.match(value) if mat is None: # the value is badly constructed, probably badly quoted, # or an invalid list raise SyntaxError() (list_values, single, empty_list, comment) = mat.groups() if (list_values == '') and (single is None): # change this if you want to accept empty values raise SyntaxError() # NOTE: note there is no error handling from here if the regex # is wrong: then incorrect values will slip through if empty_list is not None: # the single comma - meaning an empty list return ([], comment) if single is not None: # handle empty values if list_values and not single: # FIXME: the '' is a workaround because our regex now matches # '' at the end of a list if it has a trailing comma single = None else: single = single or '""' single = self._unquote(single) if list_values == '': # not a list value return (single, comment) the_list = self._listvalueexp.findall(list_values) the_list = [self._unquote(val) for val in the_list] if single is not None: the_list += [single] return (the_list, comment) def _multiline(self, value, infile, cur_index, maxline): """Extract the value, where we are in a multiline situation.""" quot = value[:3] newvalue = value[3:] single_line = self._triple_quote[quot][0] multi_line = self._triple_quote[quot][1] mat = single_line.match(value) if mat is not None: retval = list(mat.groups()) retval.append(cur_index) return retval elif newvalue.find(quot) != -1: # somehow the triple quote is missing raise SyntaxError() # while cur_index < maxline: cur_index += 1 newvalue += '\n' line = infile[cur_index] if line.find(quot) == -1: newvalue += line else: # end of multiline, process it break else: # we've got to the end of the config, oops... raise SyntaxError() mat = multi_line.match(line) if mat is None: # a badly formed line raise SyntaxError() (value, comment) = mat.groups() return (newvalue + value, comment, cur_index) def _handle_configspec(self, configspec): """Parse the configspec.""" # FIXME: Should we check that the configspec was created with the # correct settings ? (i.e. ``list_values=False``) if not isinstance(configspec, ConfigObj): try: configspec = ConfigObj(configspec, raise_errors=True, file_error=True, _inspec=True) except ConfigObjError, e: # FIXME: Should these errors have a reference # to the already parsed ConfigObj ? raise ConfigspecError('Parsing configspec failed: %s' % e) except IOError, e: raise IOError('Reading configspec failed: %s' % e) self.configspec = configspec def _set_configspec(self, section, copy): """ Called by validate. Handles setting the configspec on subsections including sections to be validated by __many__ """ configspec = section.configspec many = configspec.get('__many__') if isinstance(many, dict): for entry in section.sections: if entry not in configspec: section[entry].configspec = many for entry in configspec.sections: if entry == '__many__': continue if entry not in section: section[entry] = {} section[entry]._created = True if copy: # copy comments section.comments[entry] = configspec.comments.get(entry, []) section.inline_comments[entry] = configspec.inline_comments.get(entry, '') # Could be a scalar when we expect a section if isinstance(section[entry], Section): section[entry].configspec = configspec[entry] def _write_line(self, indent_string, entry, this_entry, comment): """Write an individual line, for the write method""" # NOTE: the calls to self._quote here handles non-StringType values. if not self.unrepr: val = self._decode_element(self._quote(this_entry)) else: val = repr(this_entry) return '%s%s%s%s%s' % (indent_string, self._decode_element(self._quote(entry, multiline=False)), self._a_to_u(' = '), val, self._decode_element(comment)) def _write_marker(self, indent_string, depth, entry, comment): """Write a section marker line""" return '%s%s%s%s%s' % (indent_string, self._a_to_u('[' * depth), self._quote(self._decode_element(entry), multiline=False), self._a_to_u(']' * depth), self._decode_element(comment)) def _handle_comment(self, comment): """Deal with a comment.""" if not comment: return '' start = self.indent_type if not comment.startswith('#'): start += self._a_to_u(' # ') return (start + comment) # Public methods def write(self, outfile=None, section=None): """ Write the current ConfigObj as a file tekNico: FIXME: use StringIO instead of real files >>> filename = a.filename >>> a.filename = 'test.ini' >>> a.write() >>> a.filename = filename >>> a == ConfigObj('test.ini', raise_errors=True) 1 >>> import os >>> os.remove('test.ini') """ if self.indent_type is None: # this can be true if initialised from a dictionary self.indent_type = DEFAULT_INDENT_TYPE out = [] cs = self._a_to_u('#') csp = self._a_to_u('# ') if section is None: int_val = self.interpolation self.interpolation = False section = self for line in self.initial_comment: line = self._decode_element(line) stripped_line = line.strip() if stripped_line and not stripped_line.startswith(cs): line = csp + line out.append(line) indent_string = self.indent_type * section.depth for entry in (section.scalars + section.sections): if entry in section.defaults: # don't write out default values continue for comment_line in section.comments[entry]: comment_line = self._decode_element(comment_line.lstrip()) if comment_line and not comment_line.startswith(cs): comment_line = csp + comment_line out.append(indent_string + comment_line) this_entry = section[entry] comment = self._handle_comment(section.inline_comments[entry]) if isinstance(this_entry, dict): # a section out.append(self._write_marker( indent_string, this_entry.depth, entry, comment)) out.extend(self.write(section=this_entry)) else: out.append(self._write_line( indent_string, entry, this_entry, comment)) if section is self: for line in self.final_comment: line = self._decode_element(line) stripped_line = line.strip() if stripped_line and not stripped_line.startswith(cs): line = csp + line out.append(line) self.interpolation = int_val if section is not self: return out if (self.filename is None) and (outfile is None): # output a list of lines # might need to encode # NOTE: This will *screw* UTF16, each line will start with the BOM if self.encoding: out = [l.encode(self.encoding) for l in out] if (self.BOM and ((self.encoding is None) or (BOM_LIST.get(self.encoding.lower()) == 'utf_8'))): # Add the UTF8 BOM if not out: out.append('') out[0] = BOM_UTF8 + out[0] return out # Turn the list to a string, joined with correct newlines newline = self.newlines or os.linesep if (getattr(outfile, 'mode', None) is not None and outfile.mode == 'w' and sys.platform == 'win32' and newline == '\r\n'): # Windows specific hack to avoid writing '\r\r\n' newline = '\n' output = self._a_to_u(newline).join(out) if self.encoding: output = output.encode(self.encoding) if self.BOM and ((self.encoding is None) or match_utf8(self.encoding)): # Add the UTF8 BOM output = BOM_UTF8 + output if not output.endswith(newline): output += newline if outfile is not None: outfile.write(output) else: h = open(self.filename, 'wb') h.write(output) h.close() def validate(self, validator, preserve_errors=False, copy=False, section=None): """ Test the ConfigObj against a configspec. It uses the ``validator`` object from *validate.py*. To run ``validate`` on the current ConfigObj, call: :: test = config.validate(validator) (Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the ``configspec`` attribute of a section though). It returns ``True`` if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the value ``True``. (It also returns ``False`` if all members fail). In addition, it converts the values from strings to their native types if their checks pass (and ``stringify`` is set). If ``preserve_errors`` is ``True`` (``False`` is default) then instead of a marking a fail with a ``False``, it will preserve the actual exception object. This can contain info about the reason for failure. For example the ``VdtValueTooSmallError`` indicates that the value supplied was too small. If a value (or section) is missing it will still be marked as ``False``. You must have the validate module to use ``preserve_errors=True``. You can then use the ``flatten_errors`` function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages. """ if section is None: if self.configspec is None: raise ValueError('No configspec supplied.') if preserve_errors: # We do this once to remove a top level dependency on the validate module # Which makes importing configobj faster from validate import VdtMissingValue self._vdtMissingValue = VdtMissingValue section = self if copy: section.initial_comment = section.configspec.initial_comment section.final_comment = section.configspec.final_comment section.encoding = section.configspec.encoding section.BOM = section.configspec.BOM section.newlines = section.configspec.newlines section.indent_type = section.configspec.indent_type # # section.default_values.clear() #?? configspec = section.configspec self._set_configspec(section, copy) def validate_entry(entry, spec, val, missing, ret_true, ret_false): section.default_values.pop(entry, None) try: section.default_values[entry] = validator.get_default_value(configspec[entry]) except (KeyError, AttributeError, validator.baseErrorClass): # No default, bad default or validator has no 'get_default_value' # (e.g. SimpleVal) pass try: check = validator.check(spec, val, missing=missing ) except validator.baseErrorClass, e: if not preserve_errors or isinstance(e, self._vdtMissingValue): out[entry] = False else: # preserve the error out[entry] = e ret_false = False ret_true = False else: ret_false = False out[entry] = True if self.stringify or missing: # if we are doing type conversion # or the value is a supplied default if not self.stringify: if isinstance(check, (list, tuple)): # preserve lists check = [self._str(item) for item in check] elif missing and check is None: # convert the None from a default to a '' check = '' else: check = self._str(check) if (check != val) or missing: section[entry] = check if not copy and missing and entry not in section.defaults: section.defaults.append(entry) return ret_true, ret_false # out = {} ret_true = True ret_false = True unvalidated = [k for k in section.scalars if k not in configspec] incorrect_sections = [k for k in configspec.sections if k in section.scalars] incorrect_scalars = [k for k in configspec.scalars if k in section.sections] for entry in configspec.scalars: if entry in ('__many__', '___many___'): # reserved names continue if (not entry in section.scalars) or (entry in section.defaults): # missing entries # or entries from defaults missing = True val = None if copy and entry not in section.scalars: # copy comments section.comments[entry] = ( configspec.comments.get(entry, [])) section.inline_comments[entry] = ( configspec.inline_comments.get(entry, '')) # else: missing = False val = section[entry] ret_true, ret_false = validate_entry(entry, configspec[entry], val, missing, ret_true, ret_false) many = None if '__many__' in configspec.scalars: many = configspec['__many__'] elif '___many___' in configspec.scalars: many = configspec['___many___'] if many is not None: for entry in unvalidated: val = section[entry] ret_true, ret_false = validate_entry(entry, many, val, False, ret_true, ret_false) unvalidated = [] for entry in incorrect_scalars: ret_true = False if not preserve_errors: out[entry] = False else: ret_false = False msg = 'Value %r was provided as a section' % entry out[entry] = validator.baseErrorClass(msg) for entry in incorrect_sections: ret_true = False if not preserve_errors: out[entry] = False else: ret_false = False msg = 'Section %r was provided as a single value' % entry out[entry] = validator.baseErrorClass(msg) # Missing sections will have been created as empty ones when the # configspec was read. for entry in section.sections: # FIXME: this means DEFAULT is not copied in copy mode if section is self and entry == 'DEFAULT': continue if section[entry].configspec is None: unvalidated.append(entry) continue if copy: section.comments[entry] = configspec.comments.get(entry, []) section.inline_comments[entry] = configspec.inline_comments.get(entry, '') check = self.validate(validator, preserve_errors=preserve_errors, copy=copy, section=section[entry]) out[entry] = check if check == False: ret_true = False elif check == True: ret_false = False else: ret_true = False section.extra_values = unvalidated if preserve_errors and not section._created: # If the section wasn't created (i.e. it wasn't missing) # then we can't return False, we need to preserve errors ret_false = False # if ret_false and preserve_errors and out: # If we are preserving errors, but all # the failures are from missing sections / values # then we can return False. Otherwise there is a # real failure that we need to preserve. ret_false = not any(out.values()) if ret_true: return True elif ret_false: return False return out def reset(self): """Clear ConfigObj instance and restore to 'freshly created' state.""" self.clear() self._initialise() # FIXME: Should be done by '_initialise', but ConfigObj constructor (and reload) # requires an empty dictionary self.configspec = None # Just to be sure ;-) self._original_configspec = None def reload(self): """ Reload a ConfigObj from file. This method raises a ``ReloadError`` if the ConfigObj doesn't have a filename attribute pointing to a file. """ if not isinstance(self.filename, basestring): raise ReloadError() filename = self.filename current_options = {} for entry in OPTION_DEFAULTS: if entry == 'configspec': continue current_options[entry] = getattr(self, entry) configspec = self._original_configspec current_options['configspec'] = configspec self.clear() self._initialise(current_options) self._load(filename, configspec) class SimpleVal(object): """ A simple validator. Can be used to check that all members expected are present. To use it, provide a configspec with all your members in (the value given will be ignored). Pass an instance of ``SimpleVal`` to the ``validate`` method of your ``ConfigObj``. ``validate`` will return ``True`` if all members are present, or a dictionary with True/False meaning present/missing. (Whole missing sections will be replaced with ``False``) """ def __init__(self): self.baseErrorClass = ConfigObjError def check(self, check, member, missing=False): """A dummy check method, always returns the value unchanged.""" if missing: raise self.baseErrorClass() return member def flatten_errors(cfg, res, levels=None, results=None): """ An example function that will turn a nested dictionary of results (as returned by ``ConfigObj.validate``) into a flat list. ``cfg`` is the ConfigObj instance being checked, ``res`` is the results dictionary returned by ``validate``. (This is a recursive function, so you shouldn't use the ``levels`` or ``results`` arguments - they are used by the function.) Returns a list of keys that failed. Each member of the list is a tuple:: ([list of sections...], key, result) If ``validate`` was called with ``preserve_errors=False`` (the default) then ``result`` will always be ``False``. *list of sections* is a flattened list of sections that the key was found in. If the section was missing (or a section was expected and a scalar provided - or vice-versa) then key will be ``None``. If the value (or section) was missing then ``result`` will be ``False``. If ``validate`` was called with ``preserve_errors=True`` and a value was present, but failed the check, then ``result`` will be the exception object returned. You can use this as a string that describes the failure. For example *The value "3" is of the wrong type*. """ if levels is None: # first time called levels = [] results = [] if res == True: return results if res == False or isinstance(res, Exception): results.append((levels[:], None, res)) if levels: levels.pop() return results for (key, val) in res.items(): if val == True: continue if isinstance(cfg.get(key), dict): # Go down one level levels.append(key) flatten_errors(cfg[key], val, levels, results) continue results.append((levels[:], key, val)) # # Go up one level if levels: levels.pop() # return results def get_extra_values(conf, _prepend=()): """ Find all the values and sections not in the configspec from a validated ConfigObj. ``get_extra_values`` returns a list of tuples where each tuple represents either an extra section, or an extra value. The tuples contain two values, a tuple representing the section the value is in and the name of the extra values. For extra values in the top level section the first member will be an empty tuple. For values in the 'foo' section the first member will be ``('foo',)``. For members in the 'bar' subsection of the 'foo' section the first member will be ``('foo', 'bar')``. NOTE: If you call ``get_extra_values`` on a ConfigObj instance that hasn't been validated it will return an empty list. """ out = [] out.extend([(_prepend, name) for name in conf.extra_values]) for name in conf.sections: if name not in conf.extra_values: out.extend(get_extra_values(conf[name], _prepend + (name,))) return out """*A programming language is a medium of expression.* - Paul Graham""" astropy-0.3/astropy/extern/pytest.py0000644000175000017500000072524312243255342016124 0ustar oleole#! /usr/bin/env python sources = """ eNrUvWl3I1d2IFjtWTyNbrft6Z79zJwoZKcRkMBIZkp2ldmCZJWUaadLS55cXPKwaGQQCJJRBCKQ EUCSdLnOmb8wv2B+zfyd/jif565vixcAqJLsGdmVJIH37tvuu+/u9//4g9+9+0n65k/Wd9lsWV9m s1lZlZvZ7N2/evO3w+Ewgc8uy+oy+fzF8yQdrZt6sZ0XTTtK8mqRjOZ11W5X9Df8WhXzTbFI3pd5 cl3c3dTNoh0nAGQwePcHb/4QR2g3i3f/xev/61/95Cflal03m6S9aweD+TJv2+TVZpHW578BGOOT QQL/4fCr/Lpok029PloW74tlsr7bXNVVsoJpLOGL/H1eLvPzZZHk8EeV5JtNU55vN8WEIOB/PBAu YXNVrBLofFE27SbJ5/OibTMdaUC/LIqLRHcgbYvlhUwF/8M/YXsW5Ry+TKY49Uzm4Xa+LDY4C+k/ Sap8VThQNs2d/QP/WwEoGJJmCZ2ouWlQ3M6L9SZ5Tt8+bZq68Ts3edkWyee6amqRDmGnYaNP4Ei2 y0VS1RvZhORhO0weJv4QTbHZNrCjgwH0gbngMYwH7/7LN3+EBzavF0WG/7z7r17/n1fm2NZ3A3uA k6Rus3W+uRpcNPUqKat2DYeoY37x7ezvPn/5+cu/fjWR33/59O9/9e3LL18NBufbcglHM2uKdQND 44/BAP9dlufwN0xAWmQz2DcGmI6wwWiSjKThaKwY9AXMs4tCN02+XhdNkjf1FnD2BWMQrinhti2d f/T4J7DDN9jUOUH5hOdH+wNHLh+m2tzHGvgUl8ff9aMCtb0olwWekO0Ag8z001h7wOZlWRVVHXax Xxwlj7s9u6N4Iwju+cgVQ7/Xd2vFPMS13N3bk+RhAzin+zIZj927Urwz+1zD7WzcXWa0tNs35Sb4 hwuiKvaBwDlhAwPCdkekDa85ooz0zKmBrCRZ12XFdKRO2nrbzAtaqOIO/rdmpMBe2bKe58tU5++e oUWO8oJmt87mV8X8Oh37u/sg+e6774AC3p0XiCvJVd4sAI+X5XWBtCy5KcpmgQS6nAf9yooatBsg 0jm2get0iqgwz2GkbLte5Bv+/SxZ1EX7mdcfVxGbd7ixa95I2iNYd1PDLdvcpfj3JPmmrgr9d8jb eAGTKlsXO4YONlxsl0ve1t0nInfuFZ+AnM1F3dCKEYgeDk6bB+WDcuGZ34liKaFTksUAbBsAOkmI 5NMXcOWqhTNV3KcOPcVOA+0tM3I2yX7qbZV3Dv5/Q3dt8NhucqBT9Kr17+nvvZ8O3FGrg9fV8i66 mQ/MrbUNBVQOWJ7D1sJ5eGehqOTNwtlVsxR8VpvLVq76+7yZPsuXbdG3rM12Dad/UwLe4TqgK7Ap 1Ybevja2vIG39XAxRzDGKIG9bYtN8rrZAhA4MR0BezMswTBoXTIjUi08UMIJmSm0yc1VAStuihb+ 6tnHK4DC530FCDnf8onAHhABwo1wnyPnvpqPoQ08/7BiIvB4jfUTl/rArH2aY7p9aPpdLPPLNvkz 5yG/Xw/z3AdnLo1hCrSRpycK6Uzf82cNfNF50H/lv+e5vugX2Dq5qpcL3KOLGRHglvjUi9nlsj6H vwgGUMebq3J+BS8cnkJbAhObzIF7BDpbvM+XWyCOi6yfJ5zwUCFrGDAFxIxQw+xiFuEJzJOtbSJP NT/wOnmnrbscp6Es2YFJH8SYEWrhUApgWgtEz5BYAJKY1WUOLYOLgRQr4Aeit3k4HEef9QAkslH+ NGSPuLf5yiWj5sMDqejQQiG6yTgDv+Qe3UQskKMmriX54ANA0zYgNoorKAYtipG+us7O6n9IS1Bk aoDarDeAb/kyyReLUn6lUzIUpB1E9rQl0ICt2+VGSY6MDzDiT5tFBw89YN/Xd+m4007YgpRWGh4Y 7QjvhY+UE9Pf3b/bYj47YAOh2ffZvP+0a/N+vK1wxBFe4O79SJwNQVFFuVSXnHXerVGbX8BupFVd HTXFfNu05XsYA7D6CC/DGK5Bg+SNJCZ8E0byOkfXbe9jWWcImeYhM7CzK1sQr7ZF3wQFivtOfo8X eVm2jLn4MrcJCbrYbbmFVeFKcnjuzCN56HNcVvPldlF0nmB9dsOn6tAnGKYNUwN8OT2z2IGTbC4R VS390l2AwQP2vSPeWbgZvmDVIk2h68RHyVP46Gw89jqKJPbL4i4igzELDq8lcw7MDsJjVs8Be3ih 2xZR5kV7N687jzDNRx/c100+L87z+fXTCmbfFaXzBCHBDhf4PW4EcFrax2pR8F0tqwt83JAeD3bI 1gSoo2TRL5h5oV+Dp65h2VVfGuYUtG22OZ/xE+2wVG8ur7LkSfYxYceT7M+TRXkBF6JNQCIseJ+K iviPAm+Y03MFNLek62cfoTaDpYGksIW++Xm93bDAVS+3SJYmCQjMDgTg4lATA/wFyheIoz28gLuC Pn6gKZY0l6nX98jZGHlZrfzvngCSgK5yS9Bh+ImPAsnD9uTh4lOU4EPwLOY5U/jw8fgAfuI+wse2 afCltm+2e0ONTNVZt+EoOlzHvwSfoWKvvSd8wi6/EdNDuJxSsO33Ers3dUcyJrWFL1sx8dk/B4+l NI+qmYSBFMxEWsJeAMteNMv8jnh0BDn0nskSrx8Q5hjevLTf8pLycolg7F7j1VZ+KQeIICMvi0WC tKhZ+ZwSPgd0b29QNsXp0/ct8RnwF/YQKSBkhQ15i/LAFi83/ORnZn7jDF/vdepT91uHjs28HRD9 gN3+iVCSGS59iq/gOHwnSdsLVBp1P8B7305wHuPIQxSq7uze8g4WqDmujoTfIC1eAuCCp8nfkGly G8UdbeChnKFPcS3FA1TV/y2LdsyrO/pMkdaOHifwkuZIJRyVhGq089t0B02cJMf+FXCmMUnydkP6 sSkecJx8GfSzlyoLxPibAt5eZk7wiSZUNKDxZuJpAUEGNhMtGJtNUzgc7APSX0APfv8BOwmTE9zL jftEeUqsTAU01mW5xK7Jq8tiBuN8LyJaqj5pp+xHD76j+wDYMGDFsrH3JcAzWwEQcSu6UBlCLxF0 YGHLXjB03c00dFh8CVLox2TKkc83qKqSYSOYOu5X4csgk2Q2ATqP9pToAbjPzkS2dZfyr/8/GXAq Pzumo1d31Sa/jfCNPDuXhfjQ4TQK4ORPvs8W08aeQssze/Lxd/iUtvkE5nHG97CrJTW30hNWrsrF oqh2MBYkHpQXHhMh2iE0E6KgAIyQeZABXjGbBcgMrNx7UfYjOF8eWdWAD6zaJLKJcihc9Kgk0UGR 7qNKwvWwM6Nh5zBdg1h71xa3EXNM0Cc6NglqLlPYbiI8YWfmF5X7rOEljM2wQFzLIhhH3UefffaZ FVbFBBXeb8/a0JmGcr+R93UZPrBWdDqv82bxHE+r2Xa2Ze/GyZhDmH1HvB4myTO0NTxsgFdGCv+w /XWV0L/IOF9UAZvMNuEJwXQQGz88kAkU1anZJtlGc28YvseBSfOQBVNWMJD/UpTWHcHPfGFMpiAr 5et2u0T9F7JdNQpTyVV5eYUmKrTVW1U0Wdr5Jrk8cFk45nf8+VRkPl8G6ZMeN+fB7cdvy3xZ/mPB L+Jl+R6lfGEhghX4TzUQCyANaLdPN+eTZATiV1XcbkYB40R2qhRISoShurlCHECZeyeJxP/uygKk QTpUFrQRYrQlgpviv5nMKEDKdpOFqmlYgMOjdel4rBN0sXg4327kY7zhU8Yfxl35w+Gi5BO4MqiG MR36BD6LAMqhsnkeUVHtQ8TsmYY+4T2/QyR/Txr+vLoD9F2dlxVx7tiVZSB5zkjx7/J78Bz49Ij8 QPhhQJsuvfobYsyOzosjwwZb1IGJgVBRNCuAuPBnRrPOl8v6psUdVIcTGUTXFt0B4EMyf2I16fZA Ytmwri9vUTJJm2JVv2eWE6a8rejtKVpqdF5uWrazLYp86YEjKxhalIhdVeWx8pSPzPLGcd0pTOZW dV4+KonF49YhTZ3vRUztZdtSElyVpUxgMNtrSgc67pjU8L/UQTm3N948vcoKiXxFlpt6NIYW3XuG XbRpRg1d4OOe8QXLnKFvjR5nKjjY09WVZLz+cUkF4Tl/jsdRtSIzPkq/b60SLWp8CTyWSnhADTUA 5s0ZgtWg7RZeltTA5xdtnLmdsZtLUB0plHjsDciaabss4e/jcbgIGYVdrOgxAojwYWfypK00tBh4 oUIV6xfVdJmvzhd5cntCZ3qbGV5xfB+ChNdlDu9oDkiPa2sTunjhjQd2Bq98crGt5kSA6PYhy2r1 pKpxnrhDPQeY/jWQoSdEs0RZ6PKypJ3EW4vTcbSJOSzOxy/R9jgHRbweQ4BN6ZBT2MYcbUpEv3id RMd8MM9pG9hqigoS3lYPFpxCYZnzMWpX3hfjXWYJi61yjsopjX3BfN7k7RWh8g6eH1BmQwoLnkCo buPDWRa53S7ZKitcE302/bI4N39u2FWec8eZZ3MemAG0R7j8zfnp0eMzV/lF5p4ayPqiuN2xVEIE bKO0nMjGI++w8MCbwsL0plQ35SW+mnDSKISvkW9sSvibuUVeie3LpoTGwTR3R1iAnya//Z33ZJQT ayQoKvQRRYNasCjxVlp4DhlkoEYeqigW+PrWyU3dXIu5P+jKXk4kVierYpPDSi5hM1b40IlFcVHM axi7bsgLSlQl6zIAxKh9WVQ0z9Z3DyTcucrfk/x49YhsVknxbgu85ubOB4QeWzhxpAEAZxNRZrD6 t6NJLxdp5xt0gZF9lLfFH400QcDbo/cYKVRhlfbY8s2QiLnP/uFjTMqPttjI5Wf6fHrWUSYuuy/N hb+CzvfLeo7eBV3fAxc5yA0PW8IZLeM8Mox+kalh8iIT+/OMdr1fU4LmDVk+LVImMXs8hV/u3+3J VGcae3SD++yjlLHxuYdqTeUxrdlA10f80moN8kQ66l0RcgW98x5F1zr6DN1mcSutz+xTJX/Pq4s6 7jzbkqsz0MkZqh+BtOu9MHKfPeWrYrmmI67y9+VlbtjggKwqAZmRvL4BwQZVA6NeUW+7NoIGa5JD KeNB8s0vMjYhq7+qqPKb8j3c6J8myavtOS0ZfbYEBZ3uJH+6e3FEfpbaY5XfMQVgqyEZG8xAmfsG wFzjClL8YhpsZXjhQtMCbbHDSAGM08dnk+RzmFSDMyU1SwQ3HZW8OKSbvqNVezkKVZ475hBHfGeA 1gDfDQ/Xon9kJG21yGulo5xWk4x67hhzhR6m+Os/SUaBARl2WCYHE/O/QzZUFDJEyCfOm679uj1c RRX+DVwqfuSoDfkrw3VYm45lczwxe68l1sPG5CE8Q+fLopqyOTZJvamB0CsaUTuFseeQM0dnTL1O zR35Fe5y2PBZI1KbsinI5yCJrxwpwJEoTotW9abM0vrAkGv2HY7V+uUf64QdSMl/c75BumhhiEAd iODuKLi75N+R66BGoE/bOoJC0CTQlRLTzywDwj4vgGtCn9s4V0sGAj73drOw55CxKD8zU5uZo+gg o2NZUJqY/aYuK5I22863+CNrQp0nEiE5kI4Kn3o4dy+4W5Eb6Ax1apDM7XHWYWxRT2VRr2kcAsYI CFuxX3PvI0xlBbSa8DkmUQQD6QXH4ZyLh+EagBwkVoS3Ty6KXnW9N+bG+DZXdVLxL17myyyOA5mr nlI2ij+M8nhmltD4JfyOWuav4IXHTUldYKhTlqmOux4+AsSTqRyHNFjYDfMNTA/QYny3LKbDZV1d Dn1GIj9vSccnDTfnLAVN+aqjJIzOULvoCj4WY/LSCi6oav58Y6evGLNTPaHf1QMB3YEDgc/vhws6 SXBB/0Tn+E9V/U+oNnzvcCbcKpDdeH0nKPAWqrROUhauOgabhNw8tqrUt+I9cNwt4S3v7JSHtvun cr8sDuGUl1UNIldcCi0FEvKAIwY2ihp6EGt8Dg8/MS/SN9Q17fqT7SNhaf9DTSSt/2u+kju665in x2dWh9XtMB4L3fSv89jZ+4sVEq5nrEgtFk/5bU8dfLe/KtLTv3Gcl58O1usvDubrL914kBVQanzw C50GEp69Nrg4hSHFgS9xdehDH3VBM+/Ep27jrooQbilKPe78tlWJr/T/Z+Yo85F5ashAeNodiUaI DmsIjF+QOAOpT8cz0emxjPPXrBaom9ZajR6wziI0aHHIz7K+ma3y5rpA683wU+6BsJ1Pn/aHF+yh yAYjmeoeSoTZVmqJzNQZJ2jEtCUgiHy8SrGmZtzAM1OGRyWA/Oo3kMmjdwD/FnytLiGkUfIebdR5 VWqbEr8AVwK8KC/RHRPPkZty0AxZAQNflm7opRqUIy6CxPXwcEePxz+8bTnqKOxPCC9Tn0/wrsG7 E+ibhHOxjsOb9jHcR96FcXLEkoaxtI8DzoqusedK1XHxVTcPvvG+55U5/3Hc7yhuWLVuTHx8i0Jw ZRx3PXGmbLzijfN7Vxbr+s8Hrv0zxxE+XK56Dept6MRbtb6XueNpzpId/MIaR9KkWmWS43nObGnE Hwe+d33NGaBw8LochT8OXPscFgLJ4ec4Fj9tLiM5885aXRaRjM9IRz09Yt7UKG0myV7Z80KJOFFf IpmLZLvWYyZZKIvKXs4+7nFXs85GQbASeniMO74fvBhofuwO4HzzSXJ80tfrw2ni0BBfTY6nSvpr l8yMO3JbqUZFBhkJAWiKi/LWGCecF+hDdFBJhj4F6LgF6JZ1pUZrzcVXc1v0Dz1MOgOJ34w0+VBd v8qzTiuDqOwW4ymQ5qqPil9/ofZTyxDqUxHsuB0LRFQcSz38ZspmyFgTgTnlHxNCwnwpPrcdqkIw /Wvha1xCsB9biOE9iKGyrm8I//eB/Ok8fJfiEN0Uno7EZW9qJx6huNUxZFo9Ym7WrpflJh39uho5 SEsckrvfLl/zoUzu9PGJHzdDeECurDT2Sf/xOwN8mPi44FjZZPci9gl3fsFOxU+LCLjj/z4RqTJC wx35s7uALhm/Lu7oU+R+aRPE4iFC3gX+BmJO8lM42b8advtmLea7GHeeBlJGAiBs090BfiymMswp Nj6LXXVWaYIAOZuJU2E7m43id987oaHbAQb6RP/6dNhVAMcpDePta3Lrto4unK8ElfjnBTusAN0/ v+s47lgIpENNx8YGPxFDHsAlNY6kCMnwEYMd64GyKNvLbUl8NlGZ90WDrkUVMZSoq8ji8ioIbJK5 JHhSA12eNxoeO1J66TyGl+Nnx+q54iiwdgjKD3Y5BJPr3oTD7CYJZqvps135h/rw6PExYivliBEP QjPJnrXsOlyji8dhDPhf/5qU1wS+D6rJfdH/tSgo1mQAlR+yYzjpIl9NVXpEAnfTlMAe97I3X/Hl Fx2rTxiMhDezHgjC5Pl8jSeKRJ4sVmuWpNxBYk0OC5vzQFvlO+SHDHXgz/Ojszjd831gufaOV7yN ypg4PirHGMfxG3LC7B/SE/6PKHSjfxwbubGD9bNyLBDKdEjP2pAikUCEDi4Efal7bhRr0idAmnUj LLsXy+C8TD0clNNTovhUbAgO1Qh/ypoog91hrR22gl9t+ncXt9N5SnsmuyraNr8kh2dyZ0aKwOfh 56/pJ/AWgl4Ftv4xv2EsakD2hv4Oi26A0R+zf1FsnFUUBa9huSzgnRMq3KMjd5ELNeUyt2CjiAYI oHuerdfXOV5hKmT8wPIfammJutBxTQyyTBzQE3excuIxNvnk9+B2P+6ytp25uV7l/C9zsI5MbY7N uhH7zJSmZFJl0AH6kKqbW2mcnRdI7Jc0Vhc5REXy7aueqGmV7iNeqfhCV2t8m+WtZvDjWOg14Wu1 HsTA9rwlvlTghVxY+7G5LMYVOqRvxjwRbJ+F4WjwQ3c1390sEpxlhAPPgPdyC1Lgqoj5HXQg2tED 3zY7C3oFnZae1ljtLR5xB1xuchErvSlzNA7Txa7nmTWLB2FQ4ieQ8kzkKRq75AqpVIcikPXKVXxH uQXlE+iYg/ArDoAQ9suA65Bo2cxpsL0xlw+7McOf/vSncHXVEwyd1ik1Y9oi1RUB5M+Sdd1SGo3x sAPtHJio6xgxsO4MsoSJHdlYUcxDGrJTrvUjdgGwkYvAka1VqjWO2kkVawOz0GCvYcwbeWJh2uAY 8vvPl9j1ZJ/dprXezNZu4nNuIN+BoIHnQ85AKAh+knwUUUtnmJdgUaSj7ebi6Oejrk7zICtNkMxi c8P0tKwzXdiviEtO1XMtyFe0qTfSLt046c4Q7CpfpzpuzRIDvFydeQ6H4stg46AP94Z52FoHgHyT PDy+tVkJjMc4eVGqBzGCDWaVWvWu98hYPa/NN1mjGwPreg/Tt1s9u7Q1+BVZDkksRwW7njxsyKUn qmZm3Ouiq4uN45PeDBt9SH0S5pTwr533d7epXjbrW+DbjwoxnhHGmbnli4V846RGnZBekXRsbbGe Do+GHZOVQDOK7G431wjh4Kl4O93sXG0fYquixR/JJH/RWQVv7w18sYaB15OkyyrDtyQMC0DvdC1Z jZwsy4AFskDDWdJvONRXJEqVY7tgX1jnr0EQ3G+fFfP7LnvhwSexrhHVOBbV3XXzeofT7GjFA4GN ZLu4WhsHi2sqzJHhWmWfu4oJPbrhMMx/wKugGOHwfb/rwy2bSUL28ySKJ36bOLqIC4f3WT892Jyz kuMkfoBD9iUZ7kKUUyMRyNAK86wfb8S92ZIyp/thhKxn4ir8y9eH4h5sMKmEUn2SLLDxuDPR2BSZ hTrgSjoSnVoA+S/1O4lIdT2L5CV2jsaxuLt/dhsau7/9IwKNp4Pmezuxjg8Bq0vw56Fb7qjQQxE6 HLvv1oS2BLs5MdluITvmejsOn6KBqv92M7U8r5cLcaYAMFP4n9/jQR8x4Ne9s2T3VPpWLl/veoz2 LfvwJR++XHcJMcPHA5d6mjsxSYasUu0Zt0tEvSH2UU0HVU7uB78HwfYx88q1YUQ//4+U2MNfV13y sTeLR7DYw9vL5D365Gm7DqOkrt+o1YUFJEe1cKr46ElXFvir0pdW8ye/HUohHiQm9TkK3zJIvd2s Jf1tkWPOVt8d8IEkt8srp+Uq33DMFubpSIpFia5bCWV2o5TYpveqvVQ5TSdrkA0X0F5Srmc6aT+2 FW12R4+DTP4EDf49PSldQUuQElOptSeiTTW77OWGmGBv/wUS28RhZ7vzjbzXC3kIwXHJiI+V6i5y 2KzJqSSYtDxo9JDd84Xpklk2Hlzk5Hc3jJpTJROlWW4XCCkhcU5wkIGZrMfcp3rEdoyW7EKc+HEe +MGT5FPcQUy0dFMuQh1o4GRCvfoj0NyT4AH6DX6yD7CWe9hqD5uGhf8hbBO8ArDMyDC7hwonGgDY PZM9G+E+EPAfPHxquhZ3Q0nGN78yFu401zgReSMlMs91uSK30u1GvyLy5YeXJGacTS35qket+dD6 MlFOLOl4sjtJvWnnqWKcJbkBnkG0y8iP9jSxio4CxEAJQs1i2XB72lICKPkg+EoXKzt2ctAapPF9 Ji9dds9aj80aSuUT1SF9P4zg+KGDkIIOWNKYH4oUB+2/s5WnIQ6cZetaw4ZiR7F7qzzIejIKcqBR JlIVpT7/DUWdzY0LlbtNxFw5AdeO2676ddjNiOntoBvqAGuTxmtP6RJo78RF0uRG5WqGg43YBXRn U2xHox3U+OCWuoKwLYdzzSm2tVp4CU64o1/rZdR1HvSbwzgAC8YZG3jiTiGVe7Kypbc89Z1h9b9b nrlztpmCtIcsNsHIO6KTud078+CUbyPHPhi8+6/f/MlsfYex9tlvtsBW3K6W7/7w9d//bz/5CWMX EUv8WrKnox45+ds30PLou6+/EnZxQjiHuRop+8ffbBctxgTA9iCSLyjL2yVnCAX+oEG9fTYY/CLH lI7kaUeZpxiJ6TK/rIEX+iq/WRZ32YASI3cqJ9Wt/tYUTjUl/RWtbPBGPVC68CT7jib0EfzE+waT OS8pAYG5EqjtvmrSv/jz8UBuwDf5ykV+boDh5VeN343sC5+PdnXkZD8gEtieqHBLH/d1wm/JCW9j wjP+Fk8IKTWcUobN23VuvPgxRSat+FcF5VDAt1JdG9vtOSb+loQXZQUsV7kw0yIH2hYTjdXNgrP2 ARg83sfZsZO2hHuVklB0bQnuIkuSvyko+wtQ7Hw5p8RmA0mnvbgDPq9EvL4jI0SRY9w71eOB4SmS ZAMAXuM84QLxdLAFjQdQ5tAUHX9Oki/gt+TkZJo8uP3L5J/g38/p3y/h39MHt0+Oj+D3nz17dsZ/ Pz0+xk+ePXv25dkg6vVFzR4fc7vHx9Dy2dlgtiwu8+WMR50m6fHt8V9OEvj3c/oX5HtpIfsGTegA oOGTY2zys6cix8InP6dPcFL2M5wXfooTs5/SNPBjngd8YQaC4541iD6nimzARR8BDz1GQVrwdllj tgv5AzPJRR3E8KJi0wklmxvjaXqrGcS51/om+YRLtuW3Moez+Oxg8NuxTXvlbuYZMLRen0G5DEA0 hntIzb06/YeH7RmQ24c7ZX3TfDRmrYI3EuzFolh6s3E/kLU7n8gE6Sk+Lyv6u2jn+bpAL35HGgMS uUxXyOL49B4lYLhO5qvssqm3azcQiwThT6aECNHwQ7OkB7cPj598h1vgpMnoygCxbh+73ayhDgkI PEGpfwAZ0Am05C4n2sZZshoF+bWY5YsF15NIKf+uCqi0SuQF6UN0l+F1D1X2lDelRD8y2yOz4EZH R/oSYb4N+euI/8yJn5kO203dFH507QJmNR1CM9QLDCeU0AaDO4bytzDC007ucUy6MR3OmwKTMZrB JERUXkCqhoX5qTgpInrR7Jk+++y7KzCf7FiEmTQ8FPvnDBCRd9f4ACD49E5wZSW4fHYxrN0Z+keo PrpkUoPf5AhlCymNCn6c8coy+Vzi92DM95SgHWaANBy+XdaX+Jy3S8z0gZlr2yS9XWAqTOWSFXTI ifFAsFfUt6xgri47I/NALIVZfVVfwtuUCqxJMEtn88chgPVye1lWq7zKL7EUXnEJcyt0dALvbxBw qr1b5DCgZvYzRlKbG4SXbBeCBMYZbff8tpWZIc+MpgbfXi6LGc6PzpmUKKoA4pMHSnyLOs9lju6q 2foOlQlDhygLgsDkUBE3SsejM9sdPSmm5lcL5xFAGWXiP6HFAbGVcidyLl7IaEzLVl/ibZoI1ro+ FvwNEk6uiImZzwFVgLEE7tv7CEvLpNJ+HOpXO2Aq4FLJy00/EMe5PggmJId/CTw5YOcDpypRR1KK cvWDvS5Brl54/sAm3sM2IxeGllrZ/cIrhaNg2Ls1TfumLT3pDjpwywyvX7mQGJThycnQWaNDJPSg T1zHMVUF8uqDpJWmL8o7IBCnxxO39TiyWapiIPY1MyuLw50OMzEL2KECswA1Cx5lXgbGefptUQ6Y 6kXlvQE0XmxZGhmRM7QNincOgSycIJitAdGLxYwJaN9ptAWa/DBaQPdfHRy6HhHkUT0CeJRNqmlC uU3cGwhD5pRjffiFzALepEWsCK3RQVDPiF4vv3TIFR0D0to7oC2ro9GHXWBWkcwnBwDSYMPVC8Pd NGkdiwW12ICHpHD9WFD+cIYXqX+j7U37cBrWduk5NIHSGQivIpL2nrEeiH3DIE6GIhnakgIXGMfH ICKpK9INb/L2Fofs+M87G905Bb4zQk1SMbMAm4OAjiS2k8TzNWfa2lZAIMlbcXk3jFWbUMLk7V6X l0T4sHgeXjfKDE8jyqeBtRA/1dVEti42JSd0LfKtEMzf+7TnNfC6882Peeruavydi+3EIRULzI7L 7FGDYvY9GFjeEtqovsUrIv2zLN4M9gMuXmB2Fu+hdbh62pmdJMWbtzT/XrP2r0hbYNq673Ngew7q +9KX3oPRzuND62iYhSq9SXyisCuJulqqrSEdZ8SJutnBxt31jtuaaet5arziRZ0kw4gi1INv/zj9 y5Oz70uLPYt0OOd9u4ghPCC/seIVIQ739dD9tpOPJPUZ7Cf19yKdIgc1W+JHZ8Auc5MdaCkbwW90 R5eu2IZ579DnELWCwxPMYksJm/jCPNoUebOob6o4T+LzxzrnHewLcxRhw2Jp58NvTOTa7B8rWNRP zaJ2zohJTAxe3LTr9tU3ZdeC5Oi/14rcsRTZ+zBDKPNerJBKTX2Yce+9jh1YOPfwwf9+ux2+nH07 oZVs3LemuCX/v/Cxcem+0Qzkm5xNqI7aTfvvkKkGXQIVF7D8NjxLHHRiKbkpxkPfDnueAkdS46X3 kC5uojCH4+6WtVI9Gom4ZkDhjzoetlskV9RwhhId+qzCjwz/SXsBX5RV2V75kPFQSspOtG0nyWxG 1SnZ/OZjrBj1DoozsRoH6YX613mbIUKnrk4CpK6b0YQqZaLhY9qJSYkUHLHajIOh2c2TfavXsW3z W+GHs0WxJDwMOx7Fz8GqI7Yr1Yt4IprLwg9CRY94EY8++Qz1abLL0+Hj7HhoFzWkRQ0/+9TZJb+/ xXqaXtqlLPRdRIcQR2C+nlPnqk46Eg7QE2nBa/NbIK2Qr4VsBEoJnM9U9yyisBg+zD66QLYiPBrb dpypnl+iT4/H3Q2aL+s2dkFUGT9rtysQIk1mW/mYaVzhEq7wK977GXqvDo9Qv6jJ3xekHMXRlTXy cBYm+e6/efPH6I7jROu8+9evP/3Dn/ykY+SF2zdRLd5gIB4TmjWCeMOB5Kjgu2fjj5o7BpGOsMGI aphQQ5u7+xUMjq51qZvmwnGtaCXjNZoiSQSiNBhcCaFcccEYLSpOZWWwdJK0dW4X5aDmOsutn1TG KU3YcvzTIllsG036jVTJz/cd1MK+7Sl1Re4EaCEo/LVl4iUvnYPYwiDJ7O2E61AdMIZ7Lj5gt5XU M4cPCPgHgd9iJ2z5QfK6uZPK1FW5XOZctZtzWl0XXDyYTsOp7V46mZbDSEAcOjUj/+DF4eYYjmDy YffnKcePJR+2MSBg15HmxEZk3VbXFTDAo/H+0G4dRuT2IhrFvWd190t054xoJhozRI4+OX3Yopw0 HCt6l5VcjzNMyS0OS3CEx7cPbz8dIbGIjsbCoo4L+GODFk0qcYpevN0pd2rymHHyqbgt57d4ayNB T6Rav0Xlduq2PPpo/OjRk6608Rvb3m9+VI7jyQnRyxnex1GWZSN8Jzk79PjoN4FEaqNUqTC0E96I SbBolOmTj4+7LmE5EaQjIlWoOoaetPdak1aLhrBJU8q6EZBnksZTo0qNHxmXIG6LxgSTtslNyQmH TD5iKXRCnkC5JAcJSrDiHR7pUkZSNwTdQzZwsdkFYY4OJ1jiFWhQI+V2HWoJ1Be3OZEkSFpDiK4/ lUSTxJpc9oTWiRTwkb4W2oNqkKhfDHm3g+SZPMn+Asud+MT3ASzxfVncOIvRqmBcf1OeJfOsjO3H hA+87VM9teBbfDx6vqNiC/Dl4784do1vrdHLsR793eDNv1VfrlVeVu/+zeuvfs1+XHOUreFBXFJK TpsxWqqfrZsaawyekCeWwyqL3A/sRL1mH8KuHxYPCKw0/6IfizOc9daa8GMOf1sHKPL1ssq9Vp1z v95SlfevpbRd3iby69flbVmpv9Rzaux4TBG4N4CeX5ZAVQQW/k7dOmAG1N7uWHNtxoffMUzYbwG7 USHqcxuVC+uqmHHNWlFADQZGTTrfbhZl08m8oQBnM+SIQPDIoBXZI8fov4UCypys57auD3BpEtQx ePrd89ezb39JNkP6/fXTV69fPfv8+VdPv0Qk4Q+ff/P66cuXb168pg+fOB9+8/lX8M23L+Hjj/jj N68+/+un+tnHgwHR08YRZxyvnOE/nOZH//j50f8+O/v1zQf/cXiQU4g4g8C3gGDpEDU9mFuhgGW3 yDvCT9jKGp77NSaubNjRO39fS20jk7vB4dRZg4ZPueMnkY6yD/D5/OLvXuGPGdzmeYu//RZ+ufrd SF6HB8GEePtpYBmBvMWGZjaIy+UFlfxc13A5MAH7UgKHWr1JxPR6AHiOeGqYVcyZ5+nwgw8e0Y59 kG1uN24fk9DTtmADPvz9Adl58W9+Ix6Md/vcCGHF3oi8HOlDpTNFm86H1XquLDPXl0UcWBAlydU0 9F6hAkPOwjjhcvjisWuOAdJVGLA7CzaQlwXrA6Opg8o/khCGaUTEFESboOqJyKSPgGZi05HjBATC VnfYwBGHz6vEWHWescBx1ne8a+r5BaZ25jnDeEZQxKmzIJn17zQ9y/O+DY6PCocqN48ibwhAsiJi dJM3eN4tPM1zLHdpx9+NMkLWhlTzVglzv6uTtMF0SIwp8sGRfLJzLbwIyjQo3Vgyhu2uqxFyDXDv N1QAfhWctzeJ9R2SgcNGo2J2NdedBoZlw0WPpM5gi2+E+LWugX7nl0Xb5+c1PDpinfXQjss6ua7v WTAH0XWTJ5TIe46FKyWV1BEVQy0WYx3/AReLmQPPcckSYklUEre8ujiCjToCMma8odZ3yRfwG9sX MKMruVgLJC6xtl1fNvlCHtibYrnsP+Tqgp+ykd4M+1Gvl5rZA2oUO/RlnS9ovkLVRlhkZil1JWoh uiUKxWWzH3MXxfn2klfvDKd2uFYy+UCbS6WDJkflbhw/z2EDi9XaLF4/CJfet2Rv5dg5wd51kwMu 2qePH3s8VPK231a0ZPd1rdTjO5V3VW+NuJ5g5cIp/jOBs+d72UzNbxMqsz19RorDV7whU/npOXUR LAE9lZ8HOQ4Ct0AnyR8a/0FAOOtxvynvbMiM67dnXoeO2580EGJMLA5NBvl8VfUaH7xFXTrlCl5d w1MH1MnjoBIpc6iMvSLHVHdFV+V+m1m1MTQUHoxXUvEXhfH18sT0jswuq1rUzjYGZg4H4uNY36u6 vs7iSnQ+1tY91hjYJ35hbtg0s4OdvkaFQIf7Bm0FkZRw4jng6T1O0dMHSPPpcWBlxeS8mwW8SZpI grjPE1P0HYBNOp4ifedg2dd71hawZc40cs1PEjTet/fXAp+NPziAZteadrJs7V6Dw67vVDJ9rylX 9QaYV6f8jElc6N2we81VpYhuCb5Y2rtX5Gr29LaMlcjqYgNKryhzniTzfHt5tUlereGZrGEKFtBP vaDyqK5Hl0Bcc9tvMuxbqCNYsXyJCvDlnWub4q50+fCRml/Bv36iMnvrPoVrd3LgdRbTVd9k9YJP ItoyXcW0u7D+iT3uo1GuC/Qef+qiQpXsrL0CvqC+qVLvUelOxn9RVgvKzIon7z8q0j9K7Km5PE1u 19COiCoQrdQcvgSbGp44yX5IPFL5jznnwvb2WOUntnIhABPHYKMrI+dpGbs4cY50Ea0LXoBun0HX +O7A9vdM93xdNGh10PapDyUynIBxrpD/FDtc/0m3LPW28HL5V8Ut1ThPSy9bhSZzdiuAq8zPLPgT p/V1UZAqyH1f0FlEmGK4llyRCEH4lYMfKDSC4RdjTTallOqmmiA4nWVxsel/u4ONpfLmp+WHbtJN 0U1hksnIK+kVrDVpNydcmTyo9eyM4Tp+y3ay+cDZXHu34e+sH69mivQpNpyWxC8qnKn+EuSNETpH aanRKhwxjphW5rUl97Wwp0cVGFlcLwoSjQymugEeymQS77+5cnRmNEvuiJ+0NnIF01iqgEHfoR7G CLkzI8BRPah1FJL3JxyWuP3DOaNFDy6EHQ0Go1wWqUh4QxMEYls7PgYOYE0xfOorCt1AOgvizNtC kiLhexecWjj/Bk7/RVPf3vUGY1y0kS22rrdaa+oiUmoq4PLdNEBi1zKjkIO5hY1ICaLSVb1wbGAO TMJazQDoxM5c0EWfUUQdXPcZNmvTDz64vglsiYQn9DYZhwQHIbS/tEidpUbzS9vpZmuyIUrHSWKG DolgZJ6M5iwIYcX4otncpc7G4LcX6O0fZE96AN+sQUYk0/oRBVkLJ165BcRlYN1N1co7e6j4omPj YMYW/g2wksAt39TNok1dLXl/HA8qvZ15gjzOUQsVF2Vv3NIhKPS2LLRT7Wd4PlP+PbuWUTMpgtJO xnjN0sDpSb9FF5a7NVyxxV3FH8H1JfCT5Lc0NC75hCjL78YBUiJhM/OHgXeZn4MN9SbBnUOa35cv wVJI2GH6LqXubt6s7tw0L457JfumYnLoOCAXxXLHcheoZ+lZlnvgQMl7E3pRulsCgJVUUi96ZrYs qt6Opg5upx99EO+EjLU3Ww93u4UKSc/CDZCGGjUIIR8qSbiwOupaHOXbpimkXInt0NrK51TDHC71 cgG4OyEwXCfdRLdS2GNGprK+e0O2bMZ+0RsxcdL6XsLyhVUxToCz2Vblu23BYURoYC250nQ7hzut Vky5YzgR/wqJ0wGRDRes02luFk1XKQy7kRsul7sD4052k94FPpCdTwbec6EC7hvigFTVDDGLFaXv aTvFqyWhrCpx9DcLXD7xoJOthoRJfkG5Jq0d5yZvdTe0iHUqBTr80u/+Q2noL42MCUzoGxMU6k5B Kd8jJW3BeKiZppMN8kxqP8oM6pBtpySqIgzqkBOycl1y3edNk5txkd/G5wSvh75VkSSkM2nP71nB L+omdUeyjRHT9au/0qfG3IQSX8LwfuNllf1rQYQsSf2LDfGpur3DKVIuC0rhIjhGL2qkgrWLCsiO YTuC4j/yrAbnyu46aWdWD2RaQ94vXy4UK883gozmywKTYDxXE7s4QRCk87ukRROMpSNiS8cvv64X W/LuDDiDIX8hLOQXRMe6jehzafNc83t3m+lX0lLLs0Za6lfasozODT/WUVkU6YwIHw+D2pbzLfD/ K86NE+UL55Re1X1xwzTQqDWGRj+dxhmdgAPEqiHA8uXrEq1h6fBJdox2rS0XkyYK95BkUMthTZJu Lv+h5blm6zuVHdAHjSSvLMvGhJ+cQIBXGQPjPDP0SnTjOJV7XLb3S+3OGdCDbO7WMWpXZIm/2yPs ocRK70nCzC+/o0AICrJY0RJ67jkHH8cuep6cnBy1BZBH4mfFJ2ZRoIqSEsG04WuM5KuBG+1XrOyX zHELePz78GduP8DBW6+GDiwlKhjcDoKqLd01u9OS10gG+TDBqGz1kLaPMp958c7wC+T9042mcLSr 1GJCJGkc3RU/Sbh8GKALhuMQIOcjN9lnhJXQDibpqMcm6Lf8t8ccVkXv6jSxgJS4MWDc7ld5e9V7 IfDLNDWznLiTcllNijQKYXAOJZMwU8KQdrearYpVjfSfZEPJyQmoxqOrcsst+H2rX1P26+J2hmig nw0CN/MORbTdJwErApihnXqLfbqOoE1BYkkqnU6PzyYK4PSx8/uTs2hgs7/U8V7xyWm76x5r7WvS a/7wbrp2W50Ijx5X3bZ34wXKeMfgbXTpGB7V1Rc0bmpZ1FHNr/KyihFQU4SzpXRexBMFvDta9sl+ jgP760E7Bfl+In/Z1DXBCMUfj9DSRIL6cPzkI3jz2c0VcgqsxexDPQKlcUu+jtEBS9rLQH3APTHh TNMW3Wo09LW/f8S5XXucsb+PL42TbGE2MmCPJZktUba8upN9ZuHOYpjDIVvWeNdWkcZX1L2SG1jP Oyyu5AHPtusFKoZpg6KceWdjfAD+DnG2kDgNPb1lmm6Uj+E8zzwNv6tI63n7DlW/udVOyNwGhFWv 0EVZdS4D58cJjAjnHDsB/AVZBzzhUYEuMiu/kA+xKCRRxiPnlF1A0N/nvZPsWvAIrh3tD6dDBHKB 0oB6+Ihogo/OOHNXEZVjsxk1Jftc5u3FRVnxm+YXEmfk1CALr/zufNs0tuBwcGX1S83I5LAV8lUI zgcpv4U3Vm8mf+s8lutmWxX7K7kFTyyxwEJzgQcPy0Jz2axAYXKxMrl4dE8vyluMdxaD5f5qbRer 7Bl3+QoEye06XrZNrhoDIEVcxkE+QSCQptXxbWmYwZr2I2BIaUlck2WHlZt5uGBTO74HVA5Wi4rq TKXCFzrXAnUgAkhBqIgJTqpwF4r4iQP5+sxbFRcKjRVRja95cx6WCY2Y5bWoSqSOaE/UrvbwNy04 IFl2qjUjOAvx3jICpnT1NLIe++1+QFzhzSnu5uI2zD7EddVyGn1k6vD5SAStotIGZagsKppKoF5N vb28SqwF2I1O21xtW9Lmkusd0j7K2po72lCjr3ggerkN65NMQIbvU9kmlI6B2t5c1XAsK1ZnCDUU UJbzGGjY5MyBOU1S8amfyF55W8GqdOP/EkqalfgNdzwsuSRVjsahXMV1iYF2FDNsreHt6uXDEIKy Ymaz6YVuxcNQebJuHRZ6UQKdQPxhYOPBN/XGUS/x4oc53CS495thGM3nZ7npEljJ7sshO7gPnfwy Ph/YSyPpOrgn0mFi5k5dQSKPUcEdQ9du5+ouNo4HHYbvQPACCK0YB8LZjmM0Ie8cpKhcAKkb5yas kFz81cnA3CF/g7x5eiLhaGYUu6NJssxX54v8hNBGjZ4C0LOgHPhQduQx1TiHyjCnMHBgzWU57JDK qeR/EC+QOt+ytX7aa01FvYXT1+kcqRThDlL5o4ghnAYLIm3GMV+5rAeWKekqBPbZK0tizW/jvZbz extyjK3At/XLlgFVvL29ZRaUqAR5bhAWojJzffeZlwLQ2OYztHd5+gPMYcCSYa9E1hRLCwD+2NRq le05QGgTOSyeB3w3iHyMP0wSyRpLEmCBo0dDN/0Ahgc72y/8bWZ23DWZ6SZHHFWjPgv7NHTCoSBC usxilMkbZu59X7p3SnlMPQ2ntHL0RsCwvBmUMebRsHMwAlx+272DRovACVoVoTFey9nWfuOoEn/j 38b2JzKSyZPIjVGtH/IfOUIr54mEobyXsCgW5PHVkihtHAhjUjFfpRHX2F+abG+rEj09Qeyi+AeU nGIQWz8o0/GGsj5V8giSd54Uy+0RS/US84XVp7+r0NZYrxDWbjW09rqPIlr7OMV7dR1BGbXEwTF2 pHuHySKSFm1+3v4aqY2etMAhZobu/rOZWypkOHNAU6fhJPnt7w6IRTeXj3qd6mLgQT+LRaWrP8QO QPsulzNEN9C6O4uuL1Ow6amihOmFmlDkTswHT85iSQxnDpDOwbvOD/qd8V74GhUiHT6WGDQJmr8w 9lnUTyAtJygFnLn5gnOyupdVoxm6JEAus+On1/GUD/iktryssPphXiWl7WZDVTxWaDZjbh+NCslI 65yMsEQZGuXvPur1jei4oTlzz8JKbH41e/8l3i2GyTMdPCRT1qpEPBb6EkdbEyWwngxkSHmNUcXJ lVoCLybHE72bGtg6SXYKu3IaG+RdrLsh/ZmhFpezxHbi9VzDlkTcmohW12kxEpQbZpITB/cO19Kb EcwmdYpXsdzpRwpNfCdSr88Pkp9OziBMRG4yBGs+xFEsmaJ3jB+GQTo2UMlFIescqlGlHe5KOxpT mjfOp1Nt0JOwzEMfjIGU6HnyV3i4MOGow2iajejixhLX1c31RpgQ33x7PCgmlhvDBLGfbfcpVhdW Hl48KsSR1VFx+s4cyoF3wRmvV0PLnXNwkSdwi7fl9ISBvywqYjncmkvqvxqcLn7UzxWwQkBNyuG4 XNRWB/OxIh5KgPQVw9GxfepSry7dE1LnzJWdzdtpMFonuGXH8CaxWoxuWu/AlavC7d9tZ+3eTaUi hlGtopQ3dA+gW7OXyGM6DMYdav4j32/X9mCCyjm1YpkzgVpcUE6RbgZ4D3U7tqCgSRNNIq+Yoj+d 74l/bi7J2tApr6jwBMMwNhYaUd2OCPlyJ2Hqv+EfOxujn3q+kJaBjmZND4qfESONvKdlBKOEZPOP aePWD+85liP3WPRRMSdz0lG1wTaQ7sQSmXhb4gW55vYwrWoWYR82tOUVpYl52IyJfCrErr7Kf8s6 QZP40KIshGMnphouw6N8yuPQ0UMvR1TQgN3KWDuwOxQO28USb5rE9GTZcuGd9L8QLIdJyAJ9onNM ySk86iwT0IMendwFe21u2sh7AJ92yACe1MmJFAxY5WtMaTxhCDEmXWkC2zHodZTQ/yFRhL4u/USh XxTybKcuse+p03ZXFsuFU6bNkZNERuj2e4AFt9D/GPjrcsHywDXmbqEnmt6pto73EkGC48+Xd2Rx M3YC1NsbRXxPFl69QkpAGIc7AcDjntS8e261iRxoivx6cGhvJ/Fc+MxEamfsIpYifrJUhWUZj8e+ Zg1YYBAu59cp7OD0cXCmXHCSri9BmCRDLbqGSPuw0TvfNQsoM0QjvAcOapNelMspq42T25PkVsZF 5QwMfFC+bjjjqWrQicmfJOcXUn+zRaobcDi7kRhHTgPeaxcmdymS7I+zi7KaQf/oJOmS12HaMxsW xdrIrHRGHfygzlHetHS5PI/77Cjy1Fktc/jdyPaU4gCd9ce6Td1oLJdpi6xJ3fi6nFfkjZ2ZXZp6 auvAkUDR4/tsiQ3I88OMf6Al8+KCh2LjvuiBiNvZfBfbKsImHLt/Z30J/GB8iO2+yfLRewQ7o2gx nSlsynu4M5TrJpL/c0XBdKQDDUjYaVj0CIs4YepBJNWeKsytUHMrpYOwcZiXU/LXAEu0ueJUNPlm xDaGXOLLGA7qdYO+SAvIHZ67LsvrItEMPpxLEE2x6MEGIwd94XbNKY0dlZUXJRN3yuebLWUQJNAl 0veburkWZ6tQcboFvMEZt9v1upbwAvT3qekVxUI7eRggEoCQtXKOoI6Zi/OnMcXiGL+4HOP5Eu/n KBYTPGZOU4WqtWAnjJkkNNz05cvbO424nwW6mS76jUp2un76Yac7LeD0yRnaPnARL37517Mvn798 +sXrb1/+fRdaiMhwm3CpKSx7fHbAhLU/tD8LLxp85gqpygvE2AbH/dJoFvjBSTZbtFewpoUojObw pdTdxW2JGds9HSnzrqhX9tiOuL8MX48Y8ysam4A8BJyMiIYyllsTLGLNUunOL/zGZqcOe+QYUZgF FziwdedtoACVh9KhwuNDfIVia7f5Zoa0wfQW0FVMHOnqEJ8hF0pv1z5RDjt/mHQ3myvoeVTDaLrg a4tvAUszMdr8Lifjii+227Db5V4qDS7SaGMdzHR6oWJeuylFcFLD8Z4JJqwqwtDlTxOYLXQHXpjn fm8xn8aeJscxpbGaUYKJn5487vqScOiKaxg++BgEiY3VhURnYfKjAnonsM4xi3t5kVRkcE34aN30 6/Q9PnEpGMrpeoSBpkgFeh2/y4paFx5OXyr4jSbecZTo9yw0Mh0VCUkbEFNJbsoqcAOS5ffNylqw gk2OKp664+5RgVzlrThRLzqml440sk9HgnU1TYQMRaMP+uUyu2euPsXByNPbs4lFhGhN59gaiIHs Cv7oB5rPmR34smXDPCdbpNDmYToeskcAWQiNQ2EfOrhjUlKdAp8A3Z4xbsBj+sJuCA4R3xCzSKey ZLw04Q+xdeRud091pI3W0KFdA0Wl+vhIdgSXOmrLobQafL9b2V0AQjWuZpzdpXsTWBT2osN75fN/ odt4wUH3h+okfTWBPQeGMO6/fTGN233QYiCGqYuWy5iltuQle3EtC7hd6F6dU1hOsZlrJmH0hMmr woRTDgJfPkrvPiIGbJa3rggG32AtmPPfZPot5xGSOTiZ4cKZDeInq23I0aGsNmMq3emmDNEWg8G7 f/vm32HpDmsBfvdHr//zDSUZH9Dfor/yUo1nA/xakn1XGJuDKdhNHm36RH3y/cIf6HmRb9CQixFU mDvMSUBOAHU2FtxqVVf8HfbVz1/Nnr/66ptfTugXkDX4l5dP/1rSgItsoc21YjDsSAus7ER4ePyT sqyWLRfgKXFrrgeDsr0pq4+eSAZEOJkNGp2I3tEXQ8ppotFwNZV7kFhbem2IVI6qDVYnQT44qDqU fJqkH02OHW/EVb6Go5+RFyk6+5BVLxJISQ1QMe40Gg/sjXfgUPr5tfEeganGajnvye0TTZtSt3gU fIcnaJqmiEcnN03EFYR33+3ZLQMrAkuYmcgbj8pA2z/7PLzqm0ocOnxuTw42znJGHLLxgeUTd+i6 oOyNE5JcYSJiuqvkpc4SUbGYcYKhmwXe3vXNtlyI9Rp+64Z3IRDkIXvWxIlx+4MIOZUuPcz1hePs 9+Ms/7JZH7h8aMl5fS/N8i/3Lp/9DTRLTBcj5d5HMDIDfFzRG+UAMorhOCQgHIdCQgIRQmo3tlAW UlIE0VXkCs3aPRDf1hd1W96+QO0eE8AMf/9F3rrZpeZXGss8oSIeE0aACVkHjgMUoTzTBV+L9qqk gFJbLYRqgCBfx+mSPezwvwOSQrF0NpnzOT5+IMqdF5hNwOvKX6HDsPAIc1QzISvbmU/AeFB9AIxd iUdQbEtJNYaTKxcp/rDbfanf0ozha/o59r2G5ic7bBNsp8F97Npp8PyxOFdUpgoaxXmV+C2BF4tO lL0Tb+HZJmrh3ZRDehJqup0dH9p8EcNeh4SQSxPFz8KbtTqvl+UczdjX0diI3tnoQBP1NmuCaNDV NX69qTVpwHIRPDs4pTXeAYkCu8IyLtiHkkpWXEGFMcudWO+MZDb4VstYzmZ5E4Nle3OjHSH9V73c bgrPNEgXi0Ozgv3icjn2gvG+puu6rNgt21/FuEOodbxOtH98fTJrXhQnDws3v186IO9x436D5EZA BEpyWhOfiuUN22T0aET+ysub/I5CsAgEQQ2d4Nt628zNWCYxhQwnIQvYMRRElpip3fpQx5txrWFq CuvYSvisr+gkbXzeAHGwzshr1nWmoywD/m38QQXMTGpmO0kCSXP/IfAAHewX8cKlWZKY1WcouhlB mLwjM29PjujyNDG8BeARwzx9cuZy+/iZGduniN7o+p53R5dnxR9e8/abxx3HZ7DBBOjDweDZq18w njF05q/xXTFvXUKhC95zp+/hV4hv9B4yGMepWoqO1U1JjAv7M1+gZy1cMhUDcBy+boy51hrkqsxz 7m9K+vmxCeJlTbv1ddmSYoLZJMcSE5JV9vjG+hNawHBMFhMKkSAv/5WAQqqrFYRGrYlbbEkIZ329 GzNJuNe0yh/o315OQABInEhA73stUl60A/Ykh/uY7WlXyEMveMvQG9ge2xRwTd1MIXztnn717bcv 7g992QO+Z9HeNkbY0F5WlIfJHL7RpAON8KC9fGg/GBZddwByAfhdY6//AfxrjIfdZAFnHJH3wlA5 vBHPTYI1yboteTv4Xr5gbxkmPE5KB/pc8vW5NUWompYkLzBGecszPgeGfaO2WmxceT3QpEz5qkzR DizXkV8XlQVhA568uZn3bp430A9mpi82W8T8/jm8JQwEdWSc2tqsmQiUUDEyfreobrkLPSTYhyuH Ri1KeE6vDIukJVVxk1LiMnzbcvwTiOm6h4EW94m4Gdt9tnqFOqBImAPuZhEULHfeDfUEiQkwfWMx HWg8JUAcrps5iBLGUu6x3eBD1wlVC6GbIft97Kw3yYLy3yGzIvKxSS+y5tgfdDMP8GS426FrSMad 6qhYrTd3kkCNwu/Nk+eI3l1tn7tA4v7G98us1cOg78xY1j4W83PgEPxEPub2e9UODOZxhnWRmjBT E8F60vlOKdxjiu98cv8kZKmXhcxPcbvZB8CsOfnEXairTbsHjE+jMPByO15sIRRHViM5GjZ3RG1G 8DEW4CSco5wOlPEHDeE58OgIbdRLC+IJ6LzQoOBiaQ3L8EbZJY1jIbn0VfTR8gxcvZoqx5OLU1c0 7Lhitu0wGbVzJXUZCsYTpd01OcL0qn5fmMCk+fTxRHO2S8FxVgSHR4e9xB0J+V379KQUT2v/pmSJ rKoAoTPz9sYdR1UqE6kJJ4mAaCT3cSuluKtN4l0IoEUvXrBIaN1iyae9q9iIKVRYZARWel7oqmtW QXAsPDLgyBfDKS/qm6hFMooCfjjfFTAh6ccf/1yOAMPt6/kGX9Xjnx0fDw7TvGjiuKvtplxmzQp3 3hfe4k65/nF7f40PcWPqVZ+syCZxqPi+a6f8Xdq1PTuUOXh4vaoczBQLXI95TCb0rnClzNXiz4fA AFxtq2uqa/znTz5+8vOfx6nZVXG7KC8Lzr2CIFhlYjKrdNXZHRkjKnSIdIsQ0UoFtBBdxO7rTsem PFqWZDnKH/eYvW07atZ9/tm1E9hlGhDeC+0RhIrBp06ySPIUNC27iRRTXySbJHGhNM7GfEkuA1j5 O7mC/2G6FD5WjJbBQdG/XQd3K3ldqNxQr4sqHTXnox25IJkwPe5u2/kW4VyQ3jA16DLu81KA5n0u K4axyQw+RUQ+aiDp9wDYnqC5C9/vkRLiAq/NyI4lI/o0ghTVhypyMf1xRnfKeO5KCMrcX9SY3htJ tmT4c+pYcoBg8j7nslnEznIEzckgWF5+8gidZh9hm0eb+lH+iK5OcbsJGt7e7mBLF42bEU87BP95 HUo/3Wnff07fToqTXX2UTG2b4uB+2plzL0YfOWN+RzkKmcgbYeCsdrLj8nh9E/BC579xZAyXTsaY FzXGm12e6N5NzI5MvHVOYPJGZwr04PwOrS8BEzNkWArK9A0BDb3ljPSrEUqk4cKwgdtfGiHfMgJQ 0T5xAqPRMmI2kswKFDcDEHa9butzWPr1jZvPwp+Tv1cHJLXg3by+OaU13DORBSUyPMinGofRcHT4 nWPuW9ShR5zw/bnB98mHSXhjccZm1eSRei6t3BNNR4ICelg6B+yuX50Fw3vfYflR7/Z3lxich3Y1 mGxPIWjZFlh2tauW96+QEcu9QYcPUwXfYnL0Nf4w596GqORcNy9tvdweJt/4a5gaoyBdCnEeN6iy GWGjkWifQkNY4Krpxe3KgsRB2y56EMQ9S+YqyTIFg2msxmQ0Thzhn5wwycahHpnRUI+uf7XEMJBP Ch3tqIt9bthwJwCWNDAWhBx3LxDfrsIgT446sYPxq6MnanzXjx6fRTkBnY65E/ErJXOKE4j+adAo MAftlzUYmkFXt89LtMTpHD3ud1DzaLHcdfv3aBQnCb3T2wfy9KQ8s2/KaXly1jdzs5ceZe0fVZGl l/DGEQfp7V6g0Gj8PTai/82h+jKxhydarMFL3U34K4wepzaIVCdzhBhWuxIVQ98HWhBFJS+XyYiK mlNFcpczQEYbLj4molbD7/QxyvRUJwVmg8+Gk+Abm1R3lnBykSDNrdCvh/YzE68d66fjxdIIRXK9 0SgCO8iusJvZgSnyJlEemxFMKHzuYJdkpNOzWHQ/u4lSevBFKtOKO1yQO9+OKGw7VWjT10LmIrOK turGLTvrcBycvegRZzUySizmB/7FLSzXacdSvUu0fyDlgLaV8ZJge3yBDgdWs5J1qXQw7OhRhKbZ Rho4BM3w6Q6m6OCC/PYh4deH3obfi83uYQY6qpDYC09yqER91ItiOsIa91zJtkchxxe3op5Yqqlc FqH3xopSubpWJYZoVW8i80mCRlflhvSvKBY7lGwMK2K3MAG4UopXQtMPdMNZF1WgxEpCi91F3m4c EheW78EEuIefGjXvkYO0LAojRqzQIfXe52anAdH2y5hCitSVUem8R34zGaWNXbWrdoOuGAwB4CgI osNfDeFshr3ykLU/AKdNTc+Sf3DcG7vjKVhEx0PhUlsGbCwIWd+t4SydxsikOTp592jfeEtnEn89 v8obTYIz/OCzU/T4NVpzJQpajEDXhUn+l5o+Ff3sIwZhclW2am/yH6/QNXtdt215zrpiDMSEF9Ve SfiMkiL69BTYY9MLx9tx6xCAGoYpQVfdbOLmUI3Y2uFcRivu09h60WPOu0r3SK9gJzDPN3nCbNm6 12XsNVmBd1AZecG0Uk0aekeeR73f/kSoceyl1cOWa+Jd9/FOfdwptT3rQ9+QBaBUa2I1fvYNhQFS nQRnWr/vkTTREDuRnyIxcT1b1eV7A8QCqPAn71U0MYEJreMmgd874iThSoMpR/Cv3ewqak13OHfi 18owbqtF0SzvqHgMmaLY/6C3Bh97oyAEx1kSA/N3FbWBfRIlqPDd2MHWtQRk2jcgDeEaG0yxCPWx o1c+9rJjW2bF0U+EWmf95i3JV9K5XtKxPzWM51Aorc2bmsWlIzHjY4ufTrmPj24wdVKDS7JEXW03 wyAsPnKxoftKE3Z1+3blKLZnztN1f/KMte/YfJDvdOPpVrqh6bfiyem7ETi89W2wpdI13nYvu9Tn pv143Be/CEBdh+Bb49ic9sRtRkNhjRx8uwvXYmd/O6FJjHeD68NKs4a92xFHIw+VzFQcAzglbfBw LCQDRFKNycO5iPd0J5fKb75JXsZ0prTYrtbqN4EBd+dl1fHXXpfza0vv4JmseW6ax9edWGDdutlp 3dppW+ZRM5ygzO2Cpnd/09Pq2jJXH0Q0ESKJ/JnuKpJay13hNcISSCjfkOTqu8/reum2feAL/b3H QzPiI1mPu9KJnfpNU24UYbA0jYpoN7tFNOrGtWzMcWUxMUzWbnPolOxr15XKfnhZjGwppHLvXibN lOE4rJXtOUajpriq8SEGFOtoJjV7qP9wj19Ad1iMzewb9f7zpJPFg2HHL2p1D/2qdHUHxEpFMkNO PndprAdFNa9Rm5b22p9XXmRy54ZeZIyB/jQPvXgzPnhMp9wtIOkU5LKoEindIFUJet12u10cIn/c qQFCDdyJjXd47xwf4gLOMfdEY6JJh6wX9tPvnr96HVNLUVZreAkXJdJTLs39CJNN8/XkiDEJftlc 4ZP6SJA6i0BD/egSaxaW6svLuZoAYAyB96zZu2AxxtOet9zzQ7S/QobIwTdnA8yRUFp6W1hkSlJY uOBykvtqRnYIG2e4hLt664SVh74AZH6hVDyj0IOgMnw1VcZD1ytNheU6lvXrhXfS/0CrC/CAbB/H PdDXPUgZMe86lDXex6VM+xiotb7Uo7G5wLHpOSKTxkdMCCeAvIS5E93qkhUFYpBowjmiOnFbAgQv OsKJO/rbMftjiShO3pNex3vLVDiAdZ49EKyd2y8TsL/6amIKG0Sn4FftWMbCTzobuuzf0Xvs2DK6 ZW59YCuvTlh2jamjsBRaV2ZlNzRVPgkHgm8+wRmpwG8gpcR28V0f27uJiDtqeXDsg4Ohs5XEI+DH jp7Zhh5suHQV2nWoohc6YNiRTXqCBRUqwDehj78xI8eKB+3mwrfYtaNRxg/3I+b9gKZHjxVyrF6w vD/Pv/m7z7/6IUajP3PCjbEd19EnR6J/nJBqx2O3tgVm1TaxXHTjU3Z7MdaOpskESO7Yh2++ffrN 6xgIP3lkf+TwTj2ZrkJKo/9VkN5DNylvZ/ObxQ5dkPRLpCP6As6vZAtb9w4goyAl/jZO7Bn3W2D6 jc3VUMFlybcVxiog+ZrNkD/QOn54Y3AbAFz8MjjbzCe8A4s5sQzuwk6mERoYWG7QtS0btddqLNui 9QzRsd0NK/aLFXvhXgZVVE/rDRyjiPkh6jtMLoWJpO+ruMt9xd2MS/31haKMuPrIw2Y8Sh76RmUH RLuJQHD1mxQ8Y8sgMv2WWb/YM+tgtPXd+vrSrXRxfUl1YSIvhiNov7jbXGGspyQvVEeAZV1TnBnZ g332h8FmJM3KH0Z7jN3My4OnMQgcLoWcbNfAly1aQZ52gzFktiRmZSLzsvVdx1xycwVckvW5wdeE 1nDE3sn5+bLwufKX9p0nX4RE9on8o8g7Fx8+LjfbZ37RLgGNkmTxVOKu0nDEZtOm4goQy2pddrYt Ktd6stQe/VuPCs+GyZid0ep6Rst7cg/fATsr4rZHzimNxvGMmt39C8o0H7QQfSUZyGHOjMFCkb2V bd9p+YlXkdaR3eKYxLmAvN9fXEZznnbssi2mndXkx6fHZ0F64zUQhU0ylCEk+YI2x/IhvrJHvnBc OlqPGcBQCutfsDPZyhovAZVUaf10K+RPgDd+pQXI/aT8aLzDR7J08vmT9kNCu+r2SP2ZCEQgOAep VqRiyv6sKt1AMF6iH/hv9VOv79aqnqKFPGyS1bYlCiB1xWARVF6D4Iy/XwaWuBVhBz9DkRKaQ8VX CR3SSzTMga+ECd83Z2+eA1VeCvbG5Ee3MFLOVdcIGioI+MnglM9ZxMDj0raJ/yYIkWcdZzd1NVcs hrNstnNWTMyxNDg2l1zb9PZ4fV5faW1njkWGs1xvN49wWJjsdk0HBHeE27Q7EcnRxUTxJ+BhAzuQ XlzgxuTS8p5JxZ99j0l3804GcRrKD41578eR90V1Kv0Zso3uWLBgV36CgNoJ/Fi+ff3PCRbS1v1+ l9BC8tbJIZ2Gfc6iNV+N3zJGtwBzPR2NNCXLAVP08tp2XJ57fE65qjanwj16fEahVfoO9mUVNRU8 xrHIKvEcHmZSQybwquh/5DAHvGHc2nm9JoMTJbDPrwskxeJZUvyQZ+8rjHetiLG0L/rFQRDp4sPi mDMXJ6TZWTRlt/vODx3GZNhrH8YBqA4NZ5+lW28rCgDNu5GKsH0OvNSZsiLQka1RiazHkWUZ3H8g APNrkrIJerg+cmOY4m+ZplGJUFP84vTo45MzHCsdwZrmo0mCP+tYTIYHl/qehO7oZIuVbzM8Wg7x +I+YthNFskPB/iXWcMCJjHqmbYE7flfQxzuguFnHP9Sf7j3U3qU/ORscEHLZtg7OmoB2AbPHrBBR Z3gwu8mcDdvSRtlRtwhlJHeP3IOJrlIc4QZxHN+hyd6ZUWffxdsbd0TXg3I658kcmKx6lZiZL2oU w9piu6hFbOuJORVjNAZxttnXNB/k4eIkQ7qZyxTN+eCyzeECGXMOTw3kmAGL22LOLoweQ2aqG/cl CeoxMxbL/ScQ13lHMMBqlO9anKdjIXqPFqI1miBm9XrT9mkpFvV2k5A2jNz6EciWssJhEjmqUML+ ZmIVmwRBtAWZmgrJ6SCxoJhYjqQMhtaV25GxU9sxcDJGrsB63NdO5VQtGWbm0l4Vy2Wcz+OsvNtz A5djrV+w7/GL5y+euqFO73sCC947/LnZu9MR7xMHuvkfA6Wgj70BcA74GRmATg3enLEjengyTigD joJPPYLFsQAOZcHbVmgBKPzkI9rgJi83gYE3YjVn4J1cS3T+UbO3mc1ewzdJUBsk5cddhUh8KrC+ yOtgFx6dDnx3yHQ8pl6tufPVArExY0LbFJT4eeNKWYdF8MZOatJ1aKbvvetJEVvzZcvOtRPmG4pG pDaKltih0Mu9zExcJNRR5olZhm+Jr0RwnCtffP76b/zgIxL8SXrj2bhyRVBl1ohgeknhfosztKlY wXU8SX+Yo0dR3twFReIr0crRCiaiuWtllYVPoNHkdAK0oiQiAQd5nqMvNULQZFmo3ySDPGfwi60f CzJhnlgq2QTt53eX0LhXVlR2hmN5Ioq0dadOddTzdq952Jh/dzrNcBTNLm3izsQkWi1WHltYXFG9 L5u6Oh2hDnp0ptGd/6k/knA0YpamEmhInDEo2P1wR0wgl3Zlx+LegMXed1jeczhVCjijHD9mCa/+ /tXrp1+//Pbb16OzngjmPZxMbyT1gQGPsr2nTZHB05OOHr6iub6EuT4cTZyZx0pnRf8LyzS2Z/fw Ydp13HD37XGfjDqx6fmCyg6PRmcHR31Jrw/9U8GRnn732gwmN8qPNvaUbD0oRBaKxQJ5E2jEg/Ws u3Mnb8dW5HYKRuEDTBDvj4WH3OmgvRDVk72nLlKDtI+6Pt9Lq76TzuyUeD7/4ounrw68J66XhdxT fOQwYAJlTSzDh/pp/nTsB75f1Sv0rcEH0Vls5wBugxv/N99+/dRB0J33O3qaAcAhAvzy5fO/ezo8 4xgibyi+NPcTjsJdcePKlm0qDtTOHgT75Xwje/ZAn6gH9HbnS0m7atSpmGgLL0uYTpYvlg9Dcu/O 4Os1EqbgBAIbIsMZATNfIDsN77k19XkrT0UUgGacTQsLB29brpuovnaui3Hc59q5wSofCkTk+fB3 smgzGHcZwSa6X/n+yvgps2H4Hbqv7WK6XjhMl5cvG8SNor0iW/kBW4Om0JvC7EONpUQxwC3OhLDg ogv3uGyeco/PjHyJO0Essj3jcQwT4/YHs9+yV5RGY4pcssDXrJTyfbDx8qm751g0mlPywxhy5+E5 bIqL8nYKciMZpY5G/oFMkuuiWE8/2sWVA55cz9C0zyLM4589+fnx8fiEFBSbmzpZ5Hdt7FhBmHq3 dX1l2ANd6wZc0imhUSP3MrT6Or78tlxtV8BQor0c5VnpjQa0tt2umEHmgHkj33IRR156x7yCC6ac r40zOU6U505vSS4QOLcUJgEfHmFH/zlXVp3TpfXHHX5/fPIy+VJlSzzjWGViinPABrSXWpthu+HE /sTqpOxOy8W+2KrIezT2JkzcfKWJWaOqZwB0XrnZbQTOPZJCa1xvtUnPq1OMs1UYZ73poK1zfB9f 1rZ2yx6YhGa4UsUk2RlBNlKGYNoFE/7tdOcJmQ/QGwOghEYnznDWdfxkrEkwO0hvgXA5ew1djNn+ GUZw9FHbCjTcW9DVTAp+Ebymgo4By/iADSCESUB64wQ3erRbRmVdGHuV80ZiQDgmtaNRP3w8/qF8 zeN+5eYVkGCYCKCS6c6qyCvywgQCQ8HIW35/8kuQeGM7bRBhKvt5cg+tosUi7ntYaUV2J3Fxc4sO 8fiGX3MwpyzGOy52JA2oVJJvPBzn3aK6XO4aHaLvLw+/ESMBHrZ4stBMAmlndbemqiycNhpLEHTE d62VpkAnyciJvouZUbSlF6VHeIWjHZRtyICQ4KSezkhyAcdnvG8z7RW7pA/YigVX+zodJ2252ZLa Z8LhO+rKZTa7vaq3y0UMtTlpKnagDZVcwDelkHVGdAEDJLzZVh7NciCV7TWS/rYoxK0S7qXHQsH/ WtQX5A0g/jPKSH0TN0GEs1JcE78tWmNaZnCBbgp5lSOAjFMzKbobiufHurKAmhe1qLcZ4jjriUVX LEIVKJ3Yrqfl8KfI4IPk9z2gHMGeN8jzyKCadwD7EiOxmjSCUmPvZsOhGj9WZU4GAQNz8i/xpLC9 AD77ZKpMUXJE0+kRpDH/c2ILS0eJxEFKgQ2mDV9eaNSAhIj3tsZE4uZQD+sjqgGP10W9yHmbbp4c bR5j+u9+mthHw+lA2+ty7TGa7GKA0IrFYeqC/Vo1GonvHt80ZPTgYWvNveOYyapORsuL0f2PQPyL 6YJw3uU9qsBdQSb7n0nHvke0A6ZOrgTknOTtyyT5FSc9or/Qb2C3WmUQMDlU6srp1NkFLKYjDhmu 4uLNq6cvR2cuiQNI29tJgqUYlr+H7mTHeN98jnoZHCuWQnuvzsSBPBIGeGT3o23miRh8t6QVsQ8h 1wpp5qcn8I9mxTsakaUNfsK/CnpHjEObbSsKpEd4neCGb19FJu0R0xhEYQFSmNYkicJNBfAkCZMl R4ofjiPDhzL9VpnJjsQdyujh91IOyqZqMJPmYf2c5LYZms6auUTAU3sHkskZEQAzKZVhVpyDGxD+ KsdQFSAMl8gbkJVQKs82cz7hMKmzt+kXgglUbeuQ+Ph92Z8Jm37PBNBxT2uaqjB4B6R75vphTvRg pxnN1QQIc74qxyvcsWCJn1snBRW1OT0+Q5vXcn2VAx8jGWjgQ8qVOBuN+2sfeIlw2OfOpGkbzoaY S3Icq37BtUGlch4OjU/+ePDu3735D1R4Vwy36hz07o/fpKhLuAJqe7Qs3qMfxfb8SFnXK+ABlshR osbg3Z+8+WOEUda2+5+++V+xe1mhCyk8lCioXBXLtenz3775k5nUoMYSzahrfffvX/8/f0YFiBP8 yLedss6VeyTr5fayrLCGr1hHyR1hBYJatr4j/kTs2doyY2XM4EFy9EP9B7BMQSOa4Q8KfMCex1S2 Ol8saItSXozEUdk6aKhJJIFOVgs8Rb7guB1UnlKqQICBW49yIcFK3pc5+hNhespNzXTHhW4YVR6Z /WfGFIPkzc147KV2PoJ16K+D9AWbHH0qal2OSV7liyK5XNbnpLDO3+flEq9PIoI2yQB3GQ7wSE7c jEP6P2ADCEPKNpHFi/SA3hu5JMfFStdJvWbkQQU5sboLW9nNXcd8hfhczKiNv9GSAjNcXmmqWZGr 9UV5KarrCQ0k4pZTLdUm3YiNmV2UTWsLHVNNlOgE4bLTHHnMcHLwMEAL9F5ZjDV1vGwKb4hNLC9b xjukc846OwOYw01SGrdxN4JRBGHSd0eci9LseYVGiFI+lT2i2g6thLrSSWIuN5qCRhCU9jlmgfqk KS5O3gpyf8I/qdz6p295EH6+BBXqal6oi8Y5TLEiL3nSfxIqgWAlw59gpkte1UnyusZL4m+WrGRC oA1VPVnfneCkYUrUN7NbBBwkiAhK2HjJ2Yug1advLZspo+I2kTaFt4fvZWwcaEiDGAD9g0FTHIla fitHgpFaS9K3Y6QGBfiRbowdv1SHgAMTC3PyVk4tHOUL+gHbrygPiLvGlHMYYiJ1CY6cBUg3kNxl o+ih7AFrm8EAQpzoLQOxSRQQTrHayIFluyaAO7hvdNo6pFU66EBzNfDAyKzwm0PRLoriJGgqZhc+ VSCnmpy2O2/IoQgxPq/uuGolsBnSkEkzLvLtW5nZ27cDViEI50rVMrUiHk9wgY7W3IkXpT1hUrcb TFGBYqwcOEHDUTxqoT3NoLspJb62QoSckpxyB+mt5uAjJYTYPiBFc3aKem0D5rUqKd9/juIkxSU/ 9Br6AmPikvglo5jrbUWTw0GWdb2O0lniD/aQWXw6Z0LaZzgSfkpZhoEKFHmzvJsp4Q3JoZ13Sy8w 1/ojSImB1LOnuqTeDWVbVow4sWvweVFU8sAN3CAgpCPCAyk99iYk1ZioO066732ES7R3jqrBKxwd Z8k6ZQDbhSmHhueVimHycEySzuiTx84WqW4RdOP3hBWLgNoeNjijRpHhh2URnekQtv5oTKIdKLKX GgfI18fMCA5pU8PfQY4L6e/fIdNrL6NiWs6Y/yjRSVAnNUn0+tDH/Yhuty0X9JRFFIsJeRiKNyTM vCmOiBswvCOBBlQ/IrEo6942M0NGkX7sO2A2dK203k+XfZLaYALCFMYMbpBb1w/znGHYc7Uhn5MS VsaYr7n0Lmp3SpnlpAxPDN3QW5dvD5IA8RKpPG0yDFPiwde0WhiD9Rl4h02MKSGtJQnRRR2IETNj kNIynqzm76UjTU7Vk8g73hqz/NXzymKoaoc7dH5k1umZmsllYQb+BuNeYS6kEo8lifkc3naUtypo SHAwGTg56hPF9oWDt295SHiwMUpUo65FaF3Wl5e4D/zg+TsQWQlZ5FP5o3afKPMZ+0q0Bk6M88dr JN8XixT/ciDdFMlvkF83DZS9xnZZ0nPnQHjBSFr+EZ2XEu2dM1sUbeFMq40/G2Y6bWI7oB+3JNbq wiVdnaKDzDW2jUpP374132Z6w8dv3/rljb/gL14SOA9TI8P9MzxJkqmCX3+VvbQE+o/7SK3vdLW4 dFYq7LlxecLRSg6K7Lh0AS1Um7eDFEU+v7Iu9LQJEvTsAihitIFhmlt8XnChDsnbdpNjGieWViQT pwOdby2TYTLFLGpSy3H9d7ryTusOwY1t3D6y5vfBe2BxWcMiQOSIEDkOMsMej5yLSUVKJWbd5FDl WndbNNnLsWQ7Jk60Ye+0ESk1hSr+HlAeko2dOAsPkTN/cANq36iXRVU0cGYz5vdXxSbHvs6w2iJJ VwCjBFZ/jEgL2wgSGCmBYJiW3RX9Kf0ImkeaDDzPygX/eNc3eA/4acHfJvSwuf6cuEuORDkhhyqf 6wb56pJAjLM+cWCmXKmOUtxuAgxwBC1KjyYdW0Df9SM8hkcbENUW9Y3P4hr+kAmGeR5QjTxfbklg m+frDaegKjTZHfNNLovEpNo8yK42CeGdWNBSSgw9Up2Z2lkhS6eMpAumIqEJISGXMIf3EK7Y4mhT H50XR7gjzhCp0sOSa0xGzCMlbxTWEFsBBwXMX4VSEVNKk17SaijweagjcByNlH9mut+qbzoRUnJe 18sir05MxeqqhnvRkP8Kc6uerK8+MU7gU4cUhmiy72aHmJci2paLiUn77CBWC4wtCMe06eRLinWL t6xAzBNkRZfFLi7Hw8Q0Qrcsd/s23EIieNTl7dt+yLZVB7CJAGXekqb59i223QVQT67/tnmiUHTa b99+b9xVxLV4EUE72x4TJyrELgKLToxe5Sj+Kt9W3OZoi5Clox0J3ZbkijNfW1SkEiUDIJD3Jnat 2prfct009oEyDAI9VIQKR/oW9Oh/rPrquhC2k48DQcR4IkdDq0pMxNOiyV7D78xqqnJ2oL5BlvQ5 3aX3c0STRE0n/eC/gAk9ry7qt7330q7hHjezTy5QNZI8qTEKz334BeR4AUPnrVI6WYPgTgpjN+Sa FvZjGAZlsqRU+GdirWU0JnFdfYZQHVXtkPJ2bO1nXfogLX0FyYSUeehJtXVlrpurWukiuiKKCCdS +Q+9t44MTHxqaUxtUluD/S5+vJ3mYSipIXqW5421xdVreFaKC7SHoJdSx2ZY3K6XeZWbTK7cv2zx 5QNe+iIvl5wzhRYCrRs5VaGvbgY+qltTK7PuQHa9RQ3BQD9AAoHOoJQssZVICvnLyEqSvfqclBeo aG4pqDev7AcE6IOy+gAfRc68qL2LFjgo0vbaFLZIBhEEp8FtUGmL+mvsQpDosV+wva9dlpebq+Xd hBV5VBAKd4uzWocgNMN1u12t8ubOIa4/Fs6V1cVyW4BMwtkmhQ1MPT8EIZkzzoSYL8c/GiryDGZX RQ7SkMFCogHoaBR5OOS4eOMWZQtYc8fGIwaCC6xFe8Kzt8vsKFJleBKZiCZ0CbitVQSPwBHKBZd1 A6cLfF6zWWKQWUPs9fuiOcd0lJTw/IKUuu6ofQPue2J0ETPBkFQ/YEie+QbtsGg2RXzL8eFmzQh6 OetWCBRncj8Kui3qORHTH/fFkFHEowAVUXTbUvnZPUR1OF9opTbRCTBPIeCc0+oZ4J9BxUV+odZJ iQ1fYmVdFOdbR5v64+m6yOo2UyeJYiFeJZOk48CjaYBd56bkskamRjtHtLOyIFprCtIqvkj4QM/x Csc1omYTqFPbBXotDrsMHT12050AtX1i2ndhGkGagQLnTSIYM7eTpEMyYETg00sSCpdUewjv4JPs 47GOfHNVsKNQXlkxPbkBIkZexAvNpQxfr2t6QcjP6JzV8DoL8lVgJDHCt2dGIW5ehqTau9HBhNvM bYGKytln02FZXhfJEJ3AM5NGf+g8WO/+w5s/JUc81EIaN7r/7g1tybZiKwFpISXaOF+X7En337/5 Y2XS5ca9+x9e/9//nh3pgMTP6/dCZJE5kyat1KvZql3IGoOZzEtcLAPG3PsD923LRA8orZ6xj8HL 4t2WWj8DcUc+Q2GBu+LqMJFpNqfUp9zztZDWl4S8+O8zmMNXIpof4oh02dTbtQYyNOi9QZ+kQ1E8 SqEc+tDx1BkeHclWHMk2DG30K3smTIfAWgHdwhDR4URdFLhQkW2LXo3TYbi1yPOgL2IXNvqYTofS Vr/eO0d0luuboDO3ITb+INvcYq5MVGK+z5vpEHBqGE7YTJZwys0pg6hrILIuSyDG10BTG9/Loiae MVOTnJn+HjhZWDKqZ47ZHL0sdZjmgb10xNPH38eo2+yX3OTriLVhYLL4pWZQTg4I66XkgPBSjcZc XZSnqhIUih3lhrN4UnZ11H//euDFSUj+iop2d2pdkMiJKPX3r5sZXeb9GibV3cfBgLMS0I0BsUEa p+59EpCcQZ0JitY7gW9V/TUhVtrNSkAJ89wmGMnp/Ok3ZBFhmljJgCLmamWatEycW42X0icgA685 f6lzEBRxQ59iob5i3D+3zBlpc2P2RfYD1Rqpo+Lo3xK2h/DuThLWdkhs/AK7h4kLuIiuM4yW0TVw XYjhAgg8biv94n9Jw6F7Pf50qgmwtiRMgu/Awx+pBeFVIgBhFaVLW9bIf9apoXCdJqGNfOAVSeNe GHjj5IpOpWUG24H6p2c80iE5vrTnmwpffTTQmtdxHHjBS1NZBkxTJ0PXKQiByVGvjJvodcrki0FH u9hp6a2cQwGWkhiV9Ub6d6dsKH6JSAvCeW8mKfl+2k391ROrqu1d6B/qOu0Hfoz5CmgVJlG1W4X5 H7GcN8w7yJEa3PfwJU51uROZy0Shj4NyuZzZLESi7FuKAfhCcu74nV4+ffHty9ezN18+f/as29P9 tnMiSn38bCY62bGW7SzadN6ExUu172knB5M9vh1pnyV83jmRCX1wrFuUHCWPj+FheJB89913n0UT LikRNEs5LU+481lPLCU20gRfw4fHHy2Shy0lWi8/fMwD9xQoLTFz1OMDcc3mEHv63edfv/jqafLV t198/vr5t98kb7755Tff/uqbCef5vqpvSMLCMAJiJ6jmRr5R1IyEebKuB4PPPv3009HObVH8butt My84wxWf5viA7Rl99tlnsDvw/yPaIBp39x6ZqWVZ1knGGyd+cdo37tlXPAS5IxmHxcwW5cUFiHgI S9bbTzgDInWJqc7c+zGWLGDDX1fDQ2LgS3w3ZrIwvkbEohsijOx76hFaoKHzGT0d/Ss8Hb755ul3 L55+8frpl8nT7754+gJR54RRdU/+rHWTerPiUcdn/aNp7iLMCHGez68ztPHkjuCZfnDICoTtCjmq GK+0I4ugpqTsYw+8p1gfYe+lJs3SRd1TL4fe94uWmUHmT4anghZnQgs4lTu+TT43ZFhJb17CHiG1 d9ijHnZjL5PwIGlhq9qLu+StLxW+dTNouZG2vCKQGNHJGgD/9ndBLXTxYBcUDWTLFCt3nZ5NoJsb 3UffzxoeGnt5cwlSGeNxoL/CpnYYAeIAaLeCHK6cwVTOgLMTg2AxYwPU+yKUD0npTmh4scwv26mC f/rVV89fvHr+ahJwLoDGKBFAw3K+wdRasphpsCgUJGTX+IZMuilZZ3U1I1UP5eObqJYVH0IfM1Q4 iqKCerbdFxU0+zjvlJ9ZXv3Pu0nIxRtLC3Sx0GRc8TPWG+if3lHsuJU+UJmQKewx/v819qqalePp cA73xRxn+VvMJ2J1pXLExkOO3XFXBZa5KduVG067IK4vfA3pczcjmko+piGqY1/Sp6lBz8nOGzP2 5Eh2DqhkChkFpatLmjjKKcO7XyBxr5+/rd3iUzQnebHbE83wUKzWmzujCuoMyPXkXOmUwEiVcxbO aTMmCctw7/7HN39qbPCkM1/Wl+/+p9e//CNW8MFfwHWi8qY4IhUYBVIGBmhStSMG4rsoRo2cc/kO OBs5RS75ir/fS/nWtR4N4aEyC1Alt8Sw9Oi/RkdHpgdqY/TPI/47VILZioGO4uvK0Y7RcxnowYxH vW4iSgy0h7JtMFbWUW9FQ2Hs6qaBlsp8MzApxci/H4Pn2ZKoPeFs2iW6h1dU8im9XZSazYDyfms7 zdmumZPU9jei3hR27UaRQxdJ1kTx+gYOdMAS7I9RSCGm+3xLzKgNIlIC7C7uJf3+VX1phhX447Bb PKY47QAdHxZs5E4CcM1f+czFFdLWdLbN5abko0ym3ikajKUDOvPcvb5tZVYYrkwcNkm97/pvASEt Ud4mfzI00tMHMg0tU3RKH2LOAFu8gN8wxDT9jj8xXzYbr2QGuwssSKziLo9PHBmzKm4MRGzmQtPk BbbJVIbv0EQeuCtncA0hlctOIlJhZMq7RRcfpJvqutveb/soGN4MTaZIN7+Cboan55HEDpitAfZy lJ6OYoP5ZYq8CfgZzO226/4OHHZ/NOKkSZfM4Ritr15AdvHqV2uGFzRQHBpFvKOBt5pdQzT0N06G WDSUGd6nF2YClGwDfbqwNmtzp+pfuNcss7DRf04WwGVdoeuXm3DFqUVAVcBm6ZBEeNJxuH0VIjBQ lCHanfI4qmnW0XboESKjy9jYPDqSrXgNSwaRfl6bStP89u1dsq7EIWrac8TOqh5Bc9gPLU7W1VA5 MNUZz7/QtIjwrPacklsTr8eDz134+MSvWUHTQNstlSFCw+pQImXoG/Y9jknTLtUOBAO01WZ73FGm Mh2HeC8K2pj21KnoRLalBYkno9tRmO2Qt0ASI8mM7cZY0uNC+a4fymjk99mxB04vJz2r24vl199j xvItMrDr+wE6fXI27lANcw0UjffhkR8d1o9DFflE9O7U7h1xTn74bBhJB7lrnaS3mTd5e3WIWk0c +Pxt7Z3Mq52TAfJ38nAhurMkmJavmvi+2++7khj7UECmzA44dMq4nYzMtx1a1SVt3BDkAeHPO7St n64JsOH8ZnHCO+Jr/se7CRwTt9FPR5xFSxcJYtb//OZfo4MCbcG7/+X1H/wbEq8GEskFH1e1rbxK r7DEdD3/Fi2/NXvSoqMmdhMhqr1rQZTFzAHYX19vLorzlDO6oZuLm3TsgJLZgBEZvokNIkUCe5D6 dcDhN9FJ7Zd4Oz0PlJQ7/UDiPaDbMJHijKt8zVWgCBDlsNlfE+gBaYdtj73i/HhvDXF8T4anD9sz uWDp/Rf2vdfUrWM0GMxugM9AZAFgqE2iJk9OGIGkRB7D/Cj24eOfmU8pcbJ8atv+4s2rv58AH8dq ivkiWTTleyAO6J8LgL5++uXzN19juthVm2wrysxU5lr58ok7kddfPn/J4J8cxz/+i59FP/9z8ymV v5hQykotF3lOfMdng995l+VrjCnweV3SfeT/WAIjum7q9yVKy8Zq4V1QivjUCp7Ji29fPf9O7qOp GZBjhPAF+T2vC/YyHlGTUaKZr5Lkc4zm2M4xvSqbflrHGeBcZhtcauvghT85NeWUf3JhChrlCXcm 5aGDsEIxPReF4D20WeOGYdVUrsnlZzsMRA82KRtajlORUSyrtDQcF86H2tBsU+jsEluG4fpSYKmL SCUEvzKJA1DenareVaLEtYK4m3eKJtPDsm3CHES2YzQkkk9WL5hPSmbc4ZvquqpvqqfY4OEC6QJ+ HqaVpo60QWhXT5mMpwJ/kvAHkx4a8NuRJdMgEWs201EPxRgJJRqdUMJL4JXY7xO263fjLhvQ2Rte Ls03tqHmO6feuVOngs8GlcZc7rDFonrXN07uMS86N7eB5cTgEyrmlTyj1ikSvSrXIIzNqWihV35g NjP2vCu43FSE0pPP+1ADR07DOYaYQXsUwQ0/C20nd2jPm+1g1oQzRIF4ei5Vd9XY2M167urvpJdQ nXFPLdOg8G93hyLKEwQI34jl06N7vblnu+XgZX5ujt3xjnz3yTdwAyyZCzbUfNlT7BST9eH4gCEy IEWXwzfoFJ0jwUcyLcfS5av7aRb+eggD35sDuR+2+3Kf0i/9FSx2l0jjHfx/2Xu77jaSJFGs/XJ9 DH/t8bHvwz2+e2uKy0WVBEKkpOnu4QraUaulbnnUkixROz1mc3FBoEhiBaAgFCCS09P7T/xr/OIH /wo/+NHHxy/2442vzIzMygJAqXtm77H7zIiFqszIzMjIyMjI+KhbNfF7TCYDEuDugjQiSO1OauNg gPlGMvEWEv7XahV6b+L9FqTi//7tf2suH/oAG/2VJjDq9//26P/9Lz/7DEVdDi95CvL8nnw1zk0m KqBkVHG1KcsZEhZaVrfYXVJ9ftjb7/66+7mJ94lmxve6d+/c695LsnKC10wUFoZCgoJ40qLMiLOR hIY6B/GcnVw66J/Zf/T6m8cv0YLl6AnsLR+6gFfOu1igVXSFSSnR65Gi64zKgi1+sE+JTf+EW0Or pQdgC1aruTGTxn7e7f4ahIkJPEs4PVS1zs4L47w0WLaQtqcYvjAHmE8Nl8Ro8KoBc8mi3KHFDt0m t2GHvha1wUE8k0fiByshADmyO1JEhm0dXXCAuso0Qmi4RFsdDF8xw7shtJK/pBbRdb+U+P5lJT4x LRc80ovNig70CYVgwm7AskhS6CfS5J1U/IbpxYOjR189hMMRzD0G0Cs5Gabcztg6ScoBBMv50sU9 7JumM4nSx6mJywWG+UGJA4bZa99qbzoS5F07/J6PjVbrJbrNdcyORPNihtlJbDnro35emgwIlDhq VFo/RNVdiQrBwfnYN1icr1Rg0CpxvWrZKH8V506fTLpJhik+9QKqJB+kLCL2lrN7LsZxdMECXYJg ctKTlKDoJI1k8ebVkydfv33V6vF/RCYmuoRushouxnP2+AkWeyu7UyyHd/Bt373tju7wothTULrV BZx66I7ZhhIBZn6+GEyxf6OCrw3F+341N62a2Bvkljgfz7utPwDJon8HYBHeQknFfKpyWhBdQ2Fa fzZ8loBblhLxAZngTvLqD0ffvnyhOUX/5e9a5Nwt+ShqA9kj6WivGFTXezILewLc8IaWmmvnoW85 FekjeG7MQiB9EMpLcPziYA7kVNKaDhboW8h8NN7Z1rMXb44ePX9+52s44X3zzbMX35gJdf+1juyw BRvCvPAyWJLnaNqn5jHeGXldozODnYYWj7U6bO2R2xylNhkbXU0TRvGWacCnq2U5N6OmaH5CCwop ANl0Vq0y66OvmRu3yu4p3iqR1G4+b+0EXBArd4SH+iU5EIB4TusGacuQu2uOYDwi7V7AXpdlwD9d 8N22xyRgp6XEwOSHK4GBKIEueREng8vBNWIac2zB8ROFar0XWX82og/YfoBy8W77bDUhT6mEORM7 CrcSxckEc8UV4Qmm63Gf6Kd3AK0tVjMTj/4G1P83kn8PCMkdJIvhRZn8DVrAEgein/tM4WbLpjsa G1xP8hUfiCCKY4c1jRGtK8xogaOr7GqiqJyIFXZqA84Gw+WuawrsHXgjND1sJeItJlwdY+FeAney IlrSJgjPXjxpm+SCnB95jgGIcHEgn+HQuWwrEuGbuW9cAecC81hW7B2FVQ3F4rPRfzwdoBUN0NVj M208tDZ+kDVhKY6qtJvuAlXoP87PGlwG6tCAPS/tjIKIC8VC5IxeTWdB7T9XYhR6Y++hmHXVkBC6 wux8M2mArqqTHV8RTF8k3wLmjTM1RYoweeQ4z6iBue6S2IO4ry6L7MbimYpjruZbLi8z5zajbM1/ H7yNNYN2q1pcsdl5K3RLHmVIAmYIddMjlzYbc/vEEu5xA3faQT43voEmAXk+N/KK9CgjF8VT0sxT Ehz8iaMHth8Y+btdXq60r44d9nTmPhs20QoLLe6+5DMhlUtbL1Nz9t3xVhGfCETsoagJS9LmEctz wnf388OE7m3v4Ic7bO9krEDwMC4nBzqQHx/ePUkeJNndTvK5Xgp0Zh8vs4NI6gtZoFqkcey0pU54 z6hgcMizoPcOTHoJb8PoRVZ7pnTYDacE14Du12CF4ZH8ki1H9evguYQrtQ6Sv8r7v377b82xkK+6 2MiJ7pGAEJbv/93R//avPvuszu1CN1JXG5OdGPR+xVfwj8xHPuYLQ/TfZtGyzfYQtwI2Fa3ejVbS Kx9fbJHDh9jqtDqXO0Wsdbx/0pTx0Fge9AFhxdU2KiBJjbSu3fTB8emifAebqrlVQitxjI+/u381 eoiqzeiZSfrqrkLgkDeyI1jHR8+UH8FTjI+HSalJW3JGv8KUj3HMkccHJodhQCDMTPhdTFklpTfm vVyf+N40Kd4m0GE0I6DoZNmZdfGxJMt76Lr0V89mo+JqQ9Yu22rNE2y9hqrea1S/c89HBTuyZHne JVafbUiySTdIayYh2jfJx4WnMJI5y+FwtUhGHD1PMQNREZAoGs9SOCz71rtuTOcNFO7SByCCPkxr mXu5V2uJXrUuOAGpvyMiHnlfRCYvjmdvKQ1JREQac0dVZVb7MI2peO1tYANwMRzPTEudnDbJcLtK HibZvU6yL8yrxrHMXQJ2VDhJlYopmcVGHxMKQgH8E04RBy+wuVhY/XYvVXtGA+sGYBaSYeHuBQZK 8DsQH11PdmLU9BLHmE8GS0StTjCc/hN00DpLN/RnVlxu3R81OvXWJyHq8/vk7V+vb+r9r47+9zts NYBm79wkZpYnAwJU5wqe2TaUwwSwoYjlM5XNxWESGD16c9RtUVgKOaBIsqdEYx0P52RRTBngG88a A/Qn3rQTG4zhhty0WWtUrd+zzVyvmUwj770p4AS4XM4P79yBE23V/ScS67rl4vzOuKpWxcH933wh l6ZX8wUtmfSrspy8nKNp+VfjGT+8nQ0W1/z4fDA9HQ3w6dnZkyt69fV4qAMZyFnl+bhaosSFJb5h JUe5kBp/QIt9fHjMwb7oEW3XalDQcwy/vlhN8c+bJf2yN7D0bnXKB0IqB/wu3hf8erQCoUsM4/vV crrkERuV8dfFGfUEN2d55uhgNMoC5TVqvcKYlvVWHq3OzackfYUiMz48LanLv8d8bYw2+jkmK530 NcofdVBHi2u+eKdeL66fcs40aR2ogSARlbinp0BYdVBProohzQGdo/EJJoG69AqGSdOMad54Nji3 psEQ0kSfjebxfob8X+hmbYABSTjhy5nkP8OVx0Sk0HujyjQfuRMyx1V/QKFu5gsKblM32iE7YitM 2R5wqzVACH97QK77gYC/Rb/UHR9H5RmQV4sxEdyyU1EoWB72MqvIYJ9H599vDTnYLoKUPpIr0LIX lCWQBRJHa5DpVey7XprWTJwHeJfReBdLZXRcvp6GJ8nOItLEgj12lERBd6/SOmzGAAiRwMm6uFou iXeq8ZLu2sj36ZmBDWc9gho5dkqVLv1F76ZcnzUFs4eePyOHSPAHra1dZeJQKpeJkb/Wa0KNrTbf WZq5DcO4T6INEUl54yXHRyr2KBwkjLVu4ZjSOZ1z5Kh9kvNfYXaQZDRmUQvBd5Pkzer8HHYh1Bkd xuDhKRWvO2rBE3VmafkIPUKi2Nvj3z3yhMqNlw+G0SjPzooZRoTui+E3zoyOAYLODgsRWP0DB7/e 7gxkc8kZ+oq2a31I7FwVTnWrCJcShlrnZ/slKzSBCxFSHiugdV4fhjLGFB2Sb/u1+5BESlBgxNG8 /cNMeVNwCIP9E1Q+pUny4IEx3GfzAW2GofuNQNiETrlXk18am78aKKazdCw1V961oZFt/NVSSxpt Xyw5NHTQ9qzwqT38c3zw+eGJnh982WqhxhcFg762zcM1/tV4+XKRAFX+SbY0efl9SW//0X/7CLgc vP1b9fb5m4vx2RLfPnigXr+2rx8+VK8fjQjAbfUK5Ap8tadefYd3qvDulnr39fgDvrqjXj2dlOXC vNcfviuplV316sl7fNPrqVcvyiW//ZV++5zH4r15Qq90qW94aN4bKvVQl3pVXtIw9DieVfhqXHmv oCv8FrmG/jKj1zO/1/yW9bQpmhuuUG6sTa0AxXK7XnOzD0hA8OmfvfdvzUz4b82UwVtsyzhfh/yf WxwV/8D83u2QthBuhuIbiFftk2IwRVaGdz3uIkgdSSUcX8POydwl2DAN/6K/rqrxYOM9SAz9fGFg B+2PJmhpwvvAJVpKzNpLTngzsBYVftD3rlasrZNY/I31iWXwXC7QUFsrHdwX0Ivf7pprlUE2LKVD RRfPbtmwjOpQrDTToK6zYk9YW/M/1RZZOHMnotEpvDi/XM535VgnrPkIFJ//Yyx0sg36QOrG6Nlp vqXiU7AHVfo/M/oWLg5yx1dORQJysB2srzVOhwOmSwz+KJbfJLjm2mTcjJ2J3Yh+mI27lyJRpHVB 2FaRwukDdbD21C0PUwalGqSl1UfCdpLtoiEECC9DLCABUkIwMr0MCInfD7+G9CExILun5SiYQ9WE SPE+8BcD6+QWWCVHCNTQks9BfDtjPv7LlbBRBJJLhwq1YNSR6e6C/fngc8VhzJFBi6d+lpOwwImu Rx3t9lWjai2XR4mZ2tjADtbT8o6k+ypR6FjhwNCoA6gv2o5HzBiJit6LjEn5u41GkTsDqx3DU2ZU Lp423CAiZBdrOEow26L5sC6l07mWDYuzJTmQTuddfPY+9D3o9ManCaYF/OD7bGIkdUyr0C/pHviP 43lGLZTzinvQ5djpKI+FsRmontcwvYk1LE3kQbSWfnU9PS0n7C5vZb7jcu4O3idr+Dl7rDqn1RAP toFtIuTFxxSYfNuV0aedEwWAPk0MdEO9InsS6pTrwkbOH66Rj9k7O0nQsZ6ihe2xUBtLT83sp20w jbhdZyAdWYjSl/iFzSlqr1pxg2CKo/zMhFH+lNu/eiubluLaFdPS/IiOmHSRKLkPmi/d2Fm3VkGR nu6F12Red+uM3J74i26h/HG2Z22sQBbOhtmKSs3bYFJJUaPUW1ymi/wJhaiXi+ihNggryBwNOAld C0g7vG8H41qzfTLHEjCN4qSNftdI0DYgBroN0Qg3kZC4yzA2cAwp7kTyD/1uONinWZrc5g2Ijve6 n2iZk+bpR8yZaPhl0ujcpgMIcARjJD1zojump26cfQtCQw7NL2MzYIAF8+CP3PSCWG29gbVCiaqr +XlBqvA8X+cBsx0DxoeeP8RtpZktmOYNFh/e2Zi1N56VoVixpfRAVbu+DEG7g1+fXzUD4JQtylgn JgJw0TglhbRvpIC8QQy4mQxQG1He+vjtv7b3f4xs/Avv97W9Xk/gX4ReHztXOJWYixg85pn0IOAb n8o4DSUmldT2Wv3mXYN+/6jnFGunySEB/0lDEa+M2qZDKQln1NuICULQPLkPRRcIvM9rNWVX0P2z Eu8sAwYfiJaz6thUQ29E11YImQdj9jFTJ1/Xda90dJYlWwXllzEYkd8fixWTRjgIovfL4kca7avD cNXbFcCmR7H58rEagIG6pu3Qy7UJ03EI3ibnmcwRxlEn/wl06MHYCuNYOP05yDC9JTi+KZ68ihvQ w1bUn4Kc0N91DWreXY6qnwk1H4+bLZCDA+Jv5KAPg+iYiAsh3CZpDNZIZvbhOqv2G/AbDpvjkW/Y eskF2bRHnsi/4EZ769as+hl3Qyc+A9J+mP24iyjAp5+0qD7fQmvdKBBDaQrvE7m723Y/Ri23WEgR wcV1kXosC2OTb7WEdHJx7402Ma3Preq7VabJw6dOrIrp/DHKRQHAbt+BtGINjwQ5aNBSD6ekjrZY oDtcXvHJ9nk5GOXN3fWVuQQ7QFwg7PK7qHSB7QabaG39doVRxGATgFgXgnVJ2nLDcEydP5MQTGcu Dwk/46KtYcst3C6vXUJdfMHeQP0W3u18EpjtJnInoZwR5moAP1IySDRMpExbTLzNtwTGlCuYiw5F 1BgPl/1+m8IvR9a9Em1+JmrBbvdNn39JogkbCu8V/O/qfiGi0vTK1ljCfMsLzG02ll962xDGSDdy hitWlRdlTlLWKSASWzDCt7Bql8M0N6xEsTMRnlODnbc2K5RV8/kWLifMLeLWuD+7fjyGc9XfCOLH 5zOHePihhkQ7gI96ftWAe6i9YdfodrtEY84EqQH7Ih2T+QVKE3W1m90SszWMjl1Eerpvxm2ksc6w nPTLs7OqWPr13PtcB+ntcyHprCBUKsJRB31WTPwlvzeb+tHcn1hPIlYEtm8na1lk1I6gRskR+4E6 Y9TU8Qvrg3RTrffp239Tt4m3ORt3jv7X/4bdAIyDPblSQOWCDR5HsCONKamkH5HdT//MaZ9VMMH5 dSvmUEcpFzw7/Wk5g8P5HJPOGet89Wobs/9PifxOZkgcnbU5rDs3G4nhzpkF+TNaR6Rxih1elONh UfWydFFQjEeOLs8WFvhMh7m0KfaWTZfoatuY8d+9/PpJQ6scMT7F5BXLRTlxE6Vsr5ZliVEg29SB NoaTwznGO7JYcShoet3WLidVxDOEA6lQGBG2uEWbAol9p2Arw1dtB4YN0VjbsA+5qCt5Iq9jLVLq Y5v+AROiCpW0ai03NYvmZ41UMCsbCGFDyk0mklk5MO4FPDFfP3n1+snjR5hzqHi/GsOaxQAs0FXf znddfygYAacagM6ZX9G+tUJi4k7euC+hW+sbxL81/KNfNvW5m2UOPL/WLN6E/p76RmDsZsahZ/GP /4FiRbn8BfSzuyhLShqSpbYD22VEkGZqmS/V+rY2u7VCdn7JJSzymaZH22BJc7L4DeCphGO2i31N eEHlKBX6csYcunWjlvussUXbSb4qlxfJ/8AO66h/ePzKOK9/3t1nSyG08EQHKA7AMh28K2pukzuK EnhUJp81lJ+YOEA1z8lGt7o2emK1Ec91S76a1/w9ijdJznrojhgxdYijxEzFr+wMuZr9CYhW4sJY ZVPPnnNKhGr3r6yWZKI/nBSDGS5m1ipOu6vZSKlQYKhyBlRO1sZFEta6LyVHAzAq1twNXM2pNKFe nbLWk52Ulg8O4Gszld9CAe2jAnOA+xMnh4ZO4/Flv0NwuNTlYDHrD07L1bI/HVcYAKVvKUSh0yCM vxGnh374rCfz+EZTta6MAf80liHukaWWOYw4XgNhRpx8JYzd1NhebpMFRJpu6pWZAJPGu26d4uNz UUzLD0XGyIxkMUYUSiod66u4bMoTzl7OetNEGxmBJDHAdzAwHUWmlTSlooHkaDiYPgQ3VxBvKJsi d2aPEsFIdQlDY6PQCXivXY8uTdLij0cZxdmHOesLKIsRD2MmHwBFjNJpTiigKNqGj2ekIEDzGbwR llv53G/InfgoLcpYB/nnrlMkA2NQFBiw4RB7VNFQcjnvmQZ7qtWe3Ph7d4R4jkHRHydE9aUWgsWU i4Ww/JqM3k34qvngvED2RrM5GiwHyWo2wcmVSJfAXa9NZrYk2/vwIY+Zm+GdoUkGYtrGuDh5njxM vty/9SVtJ2rYJveQgfwguRs3StPQ8Aa5/XXsfAJSz2yIsb865DqVQj9TXMBVUbRPYqaA7Nfzz0GX o2PTvY4LCQ2M1Ec7hq4TyqE4U6cgOGHIOPRHsOHmdhMeE7LZBjhs8CFBC3ChETSUuUULueCJo2Rh s6JcVQ2A2rvtyixsjknZTZ5Uw8GcdvRpgpC68RCghD/4tyvu3hk64iTp7m6aR5BNB1ZjAFc30evp tRddsMtisBiVlzO9ZmNwaIPTAIQNnIHkWV0EbPLnZj58utCdiIgNVnJ+zsHBrUTn5KUJRRIk3zwT fUoCdwmFdbwIAc2RBgzwsPT63X8TLCrP49u8rR/WnUXlQOZCAYsEG/jAqVsyCfbjy6vrB0HbqIkB iiHw0DfdKS5k4ZhAvuFBMl2rhkrN6h2fz+DANUrXRZsJOpEaJQpnI54OriVlBsZ9wJFiJrqWJwlU y1GxWHCqiCz9/aPXL569+OYwQctFD/jtVnMGgNOC3Ywjp3ZBAaqxVkh3zWNPOY4cbA8jDC2Ho5DT wdj5iK2rn2FjGMyVQuAZjrf38u9zSgfcatxCjZ1u/Uvr/d+8/StDrHMUToCNvN89+qsWpx+sVqfT 8dJ6HJt8jFVdFUAeEIkBASUWH8ZDCfptlVkd0m3JkXi1kN0VM4fi3JroEASkOyuWjIur6WQxR2Mr Knc7Se/wmzv8GXNU64/4Gz79zNkNtVKh72kVzJDbSskUqLZEwdAmBUPbaMFMxcYMhkYLdtxmhRAq LoBU2ydhksMKg75xmT9hoEuKuIKhSS0m6xPTeMLv96fQlTEHAjRqBuMVLSE3i+mcguKyHZ8q35V1 kIXnfpFWbDeQ7WCUjcPaac8Ukdxkpq3uUYGNDzAAxaTI2pe321rB7A4Mfs4+mFR+kbXNrPKkFgtV v5yMiD9ge4tuf3nJ7ELrgKAjRZ+ZSDw6voaTRYPTN41SeBNFePLsf11PCBHS/nanKNxxw+SRXqva OTraKxD93mX7OpQCLXovAaZfA3NrRs7vXpl1eRh1Qbd/Lcqr6/GIM1nQjyzHwDyvsHCWMhdMO6p7 2tqFAQKr4YtJuSyC313kEx0DPV+zZailQy1getJDutqk/ESuiZ+PHhEpMv3mFvu4zerdExssQHBx 2BQAEYMfqohSVjZh7jkZ23ikb4AlFItXCC4iKKg6MHlj1HM21BNBVb0mRHPdnNd+5VGvQUG/Wk2n A8pQ5+PEjS780m1gLL8SIQHkitCzsmWnJgRmGjGMliSaBarQlpW+Ow66wOmnqgK2jB6F/+HYDuG2 SJRKaAHGm/pZ/sJx0NVBmOsv2ize+GUpIxe3UnFzdRjXRnYVzQlRjLeQvLPxgoOy1tojNHAoT8HP NjfVJlTb3E+yZrMV0C+MCD0uquO9gxP6jSt/Ug5jV9l+qpum9nDVuEAaF8CQCE+LInACXF5yCI9x CRsLj/f3iNZFxie5cRkJIYeDWZYGP9nyMnDTw/YvuwaAO+sG1pIsROKJP9gcHKtT8xXldaHtxY3Z nGwwmpR2q2Rv76GQEQaq83hb3nr/t2//O8yhBiMzKKDqi/fto//lNl+Jtr4FgQSkWKOj5swIRoON EbOlZkX6DIo/KjnVWkFWNXUvOr++906i3Xi66v0TjCt3j688nfLXiSlXy05yek1c53I8u3e3jx4x Q8zmU9lsKkEEM5JMqHB62BgglkHYtxHYNgXHuvsFOpq1TK6k0RiOFJT4IgvFLcBZWXXOhrPlpMNZ 6lkpi8JeL6H3QMnD5SQ76Ejp7tGzl4+/+f2zF2/+p076w/7+fnrrS1EaFqgX61yOR5Rrj+F1V7M5 LMoMpHD4L5WI6XmCUXQ1c5fKCdVu2b3IcXL6kMUOrl5VaDgcc2u7cKnOUTJ0kNxJnj56/vyrR49/ p2aG24ITVhaGJX788vnb7168Aan6y31hlf7Ot5N8//33dGS75DQ1iddjOn3CMfa0PF9VlFK1XSXV YDY+u4aT0Ol4qRk9d+RBcn/f51ymg1/uaywLdn2kMuOuYbrV4n6uqGHSwPcL0kKN2EvlFDjqJU3U ADrep8BMGa8NKCdJbznWArAa5AXE+uDDZFVdeHGv0LKM4nfVgiKxsO6Ep1YQc6e70JFKAQ40bbOc KyNV6tESY+PpoAMVHv/oW62+t3Z/ZdeuZS/dMQrB11k9FJDVtx63f7g6OD3eraZt4JrDckRMC/8C L4F2TvIkoh0gKPXXDGt/2s6Fhh69ePMMVfgMskBtS2WOtqxodqkVHFyOmtQKR1vjNGuGCdUOZAQ+ zZ1ylNBaliBGMyE/O75yMcvxPQC7QvQenKzT1ghkP00VVF9SyNFe8mOGWDlMnr58/eSb1y/fvvi6 //tvnx096US0q5yxJqoNye4ddHIPyusnX3eiOtpFJDErg7gbgPjm9ZMnL2IdAdmlmDUAuRcD8qda x3aS6wITKTVAuR9A+er52whKAMppmDPKwfh1BEa9I5jie7WYT5qgfL4BiiBpJxleD5pw8kUAo3GG Ly/0GdsH8pttgdBqigJRHnRLkvoNIXIiQGQ0YQOebI7EHPjqIJw/9XS1Zy+OnsACP/qDLfjm6Ov+ y7dHr94e9b999OLr50+g5b2DA+/7k9evX77Wn+96xrvCYh039bshYW16yTfF8s1y9C39zEK469Zp MwSv556ChFhYxXUew/ZXTopnGHaQYeXdSyugV60QYZmr/7fJ/tX+mVIrvLHgjoDzOa8Ghit+DW5D p/iRKDsjn8TLsXt3v/j8y8A62ilVKN7bIZUJgiDpgHAM48TPv361XAt1+xHYwceEjBpUu9Hi7huU o3eZaO4kgOOo7GMGodU8o4T1h560Jhog/NJJ2rxHtPP6rpH8oIdK6W8CaenoyevvoCZsAe3Ranra rtfAnXyjCYqAFoc1ADZbtq2RVHAS8xLC9tU2ghqR7HQC8mrv3j7e5ox6sCMwo+4BYxdu2wP2HNem Ix/tAdsVZtgD7kkcrQcMkNlSD9hYvO5X1O59aPc1tHsf2v2G2r0P7f6B271/r7EutHsf2n3F7d6H dh9ju/eh3d9Tu/eb2kV21DtAu1+824bGTkFueNf7NWZnw2B1vS+EdlgcHOHpGm90E3MetZ59jeHi nCBoD8Fi9VbMQHaBNzpE5lqB0EWbJDgNIcRs13pGgjRH8qvls5fZNgHcXT1glV1hmeUqCJumzhN4 sEE64uXiKNeH7K+clO/HuHTwidZkGtpJSbeIkklhzaUtHs1DGKlWXuNuZR5BDDNOLrKOzSc4uqSr 5dnel2kApi/Ne4pUNrpeTSZrTxNeaRgq8xaU7aPsJmgXlvESmDNl2HFkJscRITN79PDpyAr0XsOH MZ79s0juTlAPTcM5HKjpvYxW9x1V+7XjSeCab2JJv7us25bgJ7k3lWy+wtuavDT+AdVIEtpuxbmL pV+HbGKVxdxyoal3l8fk7huJrlMNjUGd3weukEej0tmZZDzwUQFnUkWQQ3WoRNQr5sOLwQLKjZeW s1gClN8BLpGhWBKNchVNwT5Jq4M7HtrPSw6ttiwlRJtkscMz+wCjz5Etvk0drmrTDa3k7JuNxi5d HsodCCJPHvSSersoNuBQm4MmUf7by8FsmdxNbid3byFAWEcTjJZDQg1Wb4DO9cfdootPrr6gOb/1 Ymsg5r8aAF0n2dPQ9pK7DUCoVtZcLU/u3EkyvymfUF8knwgAUUjkQB+TW8mLVui4U4vbhnWENGnr m+RrLXvNvK1BWMNMBViFsWgYsY66cWSN9bQL5ZiTYibVeLmSSCNsxgR0uCjLKccKmbFFk4UO9Iwk TlZyHR/aHOS28XA1wVy6Zzh0WAfVmBfFYCkZfy0gyiSW9pPUM2SGRbgQY41qPnDpe1ipiaiUDuDl tSSLxPG3Aqs4Xm+39eCtMskn8sM6Lm9bZDoFlL9lke6bg3ETK3KMTG5lOcAmqsPrrApeH8ZywiiF FtXMSAnN20fUoprvLuArlq9x8WAvxl0y3FYICn2WfFTkBsBbl+v8FvKUBgL/bhkLtq+OMRZCNGLf 29kY1WBPZvTvuqsc+JfloQI3Paq1x/tPmndHBX8YVMPxOGI0V+9V2B9Vwh6rzNQTUcgm1mu3a1NP db2b/lAQohSayFX0HY+qxoHVbYOLQjWpqPEw6kHaIB3VZYXhYIaV0HRJbLz2aFngAgYZ2d7GpNE+ 6lXRNDpanfEB6gvtUDq0C1uH43Uos2hQCBiNz87uIgTrc2jA7SlwCl2uwsNkP+J/KNf7wLZuubL2 LPp71LTKsV7Oo/7xVJk+/wvhFFpJU0vptT0bubFy6BOVRIGjVf8URxgojPaf7tfKi1bPVYvZHr+7 7M7LedbG0zOsY32ZEYXXpN1bB3tRfATo10++rsvkE91jWMY3B4sK2/VwSUtyc8Ck+V0PmbUuHwn6 Txtx05Qmz0AMSWb/i/qs3UzZeIM97z/C3S6gZou+wxtjTSk4Dfe0eg9PiRdROlF/pwXsR6NmNVOT biTYXxQsKKR+xYU6dNbwubTXjo8H8uzo0R8zT15pclAmW/6aMkZ1JKM2XXd4LrBYLQ48J1cLL/y4 lL8ToZ6ptlu14uYKZCohd4fyFVPc0XfRHpqbxSG5KEmW89/LDfiQ22htuumo3XKoaw6PXT16/Dsa dI/X7D7dcqFLB2lhasXfPkl08QM8ZqA6x1ywzpYD2FBJwdsNaxOf0bXvNtQmFlmrDlwp8Rq/31Ad 9oNaZbpe0pW/CEvYvcaU+NIHP67IThzOYWdj0wDaOqzFJCASbZZnIwFCqK1X9bF6EK0awa2CEeL2 7noYCsMKSIjh++uBLCJoCPH8xX5YIsTzl9FGQmwzUX/78vURWnbSCukO+9UFesuTKQ6xvccvX77+ OpPPb8iwBlNuKUfYM0w3WGEWz+Os/T3slQSzIY5B1v6DLXGimnnz3aPnzwFbj4+2b+t5cbbc2NxR Od9Y5jXqCzaW+qpcLstptPePX7548/L5k/6bx0gz/a/ePn365DVMy9OX249mdPlm/EcUjwjjjb0Y XT5eLapy8aqsSIu3sYKST9sdyxm7v19Xp1owc8TB2olZ06XvBlfj6WrKlbxhnDCZ9bXg7cgNjZAo quliVkzu3e3qUvV6GCTUGKMd24F8jSM5iZReFBWWwG3TlGXGbbcq7zTwDvpSz1zSr5eRhRMXIJrH 1lBhHbD4gHkQwVSerIUTQcVXL18+d3Mjtd4MkYl9tTo7KxZ4yIEK7k60ec4aam+CvnZ4m8P+cPFX L5H7vc6al2B+srEjTfhRhBI5+ik5i3G1hg04AWpNP6z0KWM7vV4UZxkCz2uXF/hWaRqixpYfdfSV scSHrLPfrE4rtHxeJhiHjYQwtiscLS9AfkZt7SUqb+jOgVgWSKqDeaVA4HFd1KUoBP+AQY5XFZmA JcV0vrxmjSfIa6NxBYLodTeGhS5zzu4fOt7P75O95KDVep+9/a/RxHdSnnfROREaep8f/Z//2Wef xV24vpZLZsDj77l4Vn/VLPuLkTGigONX1eKY1NSQ9BqrcPC4i7oyd4YTwg+qXXJ668clbUpCuDsy FvS2iY4GevugY/ukcqf2YVob4ZryYuM7mI8RqRmZRYghsyABXg3fTYoPxQRv9o31tD4G7bAdJwom 07JaTq5hAb16BgKTGD+jZfjd7v07Mm1Vd37drhLjZSpLagcplQQolCuVm4IxOlHqKNclMgfI6xkw w5yXKrg/1IICB+pGFEUrSTrXPeuTd67KC989G+NFpG2SDE32DgKzH6p9WE9oo6GGx9phub6dHrYT zQBDfY6rHBwA0mXC323zwcRtGAQ7NYtMbuK2xqSeADPuUyPUN/jQ6t4yJMl4v1slGcz4kKIUkEcn hzXODFFaOnVxSLKQYN0jrhFLu+Yhd77OtaoHcVqnS2B+Hb9KNdPpDD+AbOfFkMIYnZG5hW3dj96n ErdC0cXgkk7ytjTTygLWl2MgPkJr+iCKDLKoLQdFY2GsIaeh9yFJ6GIDShy/WvUQhN7Sqs+3g8N9 AwqRV3FYtpQatHGIMolY2yq2ci1A0or2TPl67OqcrOmkrZY+YCugh2lsegUo26D1aR0D4Fxbo888 pnA2m4jhC613YJnFIvPuBaBEFzZRSVIPfHLIIahq78s0YtQj/TKPx4d7Bye+rZEP52+Q3HCz3AKY jQbRtrXQ5xdZed7owk9YpEDIUzgV9/vpFr5Zqm0kNRAtPxzvn3yM19UOyB6nxWhE4USsF3ulE4Oa FnD/LDD0VbLz5b3fHPz6YF232mY47fAGrD7lQVXGSUuC0l7wiqdQQBQDPDNFHUtjpWJEmKkLKAyW eY7daimOA4Y/GQ/Hy0xeowvNsjgvF9c9AdepEXgPfX6lPHVRHRslvqf5Ggb4XBTnY6h93Qs7Y/gG hvORuxHftg0oxRQ2QIBqKEgylQOG/f7W2xbKgVfTyXkxe3/7aPDv2L9L6O2MbNJmFEcFrWjIbGsx HkzGf8TfUI0t5ZbwUJnDfNU6vZbQBRWliDURDFhFjH5g2TBPLkpoc5G8WxTvUPSQnxgqrVgAElZX SbHqJnf393/TGD0TTUJbrZhL7MMe+sTuK5F0lVURwc19ZlV8duUrio0N4BXFmZZCyJiiEdWvuqpM VjetQkB5yy3uxn6Z3sidsvykXFj0ZFMPY5hbsrr4roB9CF9leEryRHExKrTSeBBdXwzVjg8PKCBc u9+OJl71+EOQ9VM06ljddmjTlbUtKNoi2P8HcnbSEWUH57jf26vgvrxQ2yUaY0kpJUOwvacywJMy Nx4b9U6uIH/8qXaJgAeD8fDdNe+EgcRgqh63YaVgiTZGZsIHBZ68SWHO2LRPwrvTQCUzVSfvOFD6 zoFtRd2kYrGqRnXwztpdD86zCTACmX2JWIlAvNubhlNcQywE6a8wo9V8hMHnTEiEphPhLUqnEQNZ reZ4BT8452NYbgPyZn6QBWpW5oWeaRwuGINq2S3JNcc3s+Tg3FDMlj1xXJBzH3oxOjCtGtfgQUnV uzr9mW8w+ob4oVwWSnbwbCL2mQZA3nW5uWuzucrSNGej2Ik3yPjB12z+PEdCUF0juNXOxw92F7hQ hFMnu6OHNgcv9I4tSNEG1C3eXowFte07EGuEtjoJkDEnZG+rZdw+TFwwlLYme/iCVGA+6GUGnySU 7E/2JvJb2IOQvuH/muvfcIIQStO8dBK6BiAdjHhL3mCmdjC0LlYfJRQ1kzfNmUGUjAJfZhZ7xiVC YQW6KyO19Onwoo+WCsfGk+IYtrGD3Pn7OXGhPegMTk8XncFwUc6up53BaIRRgDuAgEmx7AzgfNs5 7ZyOys7p+LxDDgkdJ7C1T0Hgevd+VS6LDuag7gAkYKfLctYZDijcQWdYoNDYGWJULpwQ+GeiIcBP irkD76foutAZjTojEAtGZ7POaLyA/3/ojODnslNMOySJ6tp8ZQAdPStn+M9i2qHDGb66OOhc3O1c 3Otc3O9c/Lpz8XkHgwV0ENEaxLgzpiqd8fS8M57NV8sORhV9dzrqTAan0JNJcY60MBl3aPTIRlHU UyCmg3lnOli8XxVFB8aw6mCYoA4HzYHRzkpAy6zkzs9K7qCuPyur4WI8X3ZkwUCdcs6hijocNaIz 74Do2nnfqTpSVFUHIsRa1RROeR0gnxl6kI/fFfinhJ5Wy+sJ/Fidwv/nHTIB19WXNHPLUQdVRjTh y7OyXHZAJl4SxtiCdrnoLJedVWc16VxN5x4RDGBB4j88CYTMi0UHNU2j4qqDSZ6nnWoAlT4MFlwv 71YgS8OBr9POyfP0RFiaXH9hj7femsJjF1J5J7lm2/wu3sx7KmDz3xWsjit3IOtT1Oh2zPRCb7cI ObdS2GJw6XcTBNZ/WlVLdA8vr9iWdjiYmRvNZGAlOj4SG2tbCpfGR14OOjmChQtnFdQCSvzBcrUE 2jTx7iKoAMjQlVDBym9ZgIQH0/HofhSOBBgaqqrHcMT7wEVQ+czhimQcHP5rneWHZb77HVR8ux+K p1IgjpjxpTHy8D8NB8OLwpfKXGYJyjD2409wbkVCGMFhldVM5ZkZTjnzq3GXKIbAyDhPubZMl1GN Yp5DZfWinryRvZ/sENm9xvzACLL4S9T6yK8lNXyQccPIeH4EcJwavALAaMpwcoLBYYF2xavnDi7F ivNb2dlxEicWdRJBs9aL2remNg7vxwDmJFR4/a64jqgPcAKA7YiYTwIptDxdlKG8XG/v3Ft0BoiV XzokO0RjkWo4jV4aN9XfRpDR7/NyqYvEDk1QVtVsRaBlNLWtlnNqkRN9coYRP9FMhu+ayGAB7TpR jFiMPwxkUexQWL4P5XhEs38BM0/G+wgKBTqSA1VPeZnyC8GuzzV2lOksfomZ/rLZWmZkLCymHYSQ K8ZA+5CFNXlG2VW8TxJQB+RQfO95VsmajzKCY6lwEtxULGCWiymCgK+RMw0vPSyjOocipriIWUHT 7xu+X9u32hqDGsI9DFUJLzn2dI4SYAZ308gq84B4VsEhLrCDPi7gjVHDyoJb4vnLnlppsJHzQ00D oPik8bfkVYJSAFm+S1N5s502hlu7DdJzOwGh4FYANg+O/REwrgu3e5qzNzUILT3ASEoPoTlM7sQd 7LgDJpuJENryiLGlzJVxssNidUFENBANFqZMaVdrgKPdbb5uBHfMAAyC1yFmL46YOtNDSHLGFri3 Y2iJGqD3OdItnB/KWcO0R2fijkyEaTv0doyz5hqYhw4lDpTFjlrRaiyxhb1jNZ6FKupFPkCGRWcs WjdB4jtToFvBTq/mcNLsSmqq1DIUGvZAZ33bGduoqPbC2cCKa7dAc9DFfG+qg104CFi3UcxIReI4 LYMttRJBP13+yqpZC3n3hGIP9EM1JEVYUxxKg4k53rqrmXZNXas0I/W7nfoNOTXdwf0sAofTOOAW T/m+RL7eTLC2XrCLciq0PKZebie7VS/drdK2UsoQGIVzO1ExYmZpnoDZaaH9FmSrMUddIGkNAFCU cy031pN7YTOoWGDu0KXf9evMLS6YpEvHJ2svtwG6rLTjq9vtQ0DHbTje8TmPzke2Q+a0dxJtBbcW Ksq4RA4Br/4OthumYNuSsdOTTLWOm1nUBkSMOaXgmJdxBCf09j0FqetDsViMR8BpqY8iwxaVxq1W RLoDgte67J+/VNOSetbp0sxpMHZEhHY5JDNhRKuXEqVfatWNIk8XpF8h9QIrBFAzcrFgVQkpVkiN 0I6K6W3Wy5Bqoa11B+LFzii6QXcGCWq9EtF6JaeJUV8kp6MyOR2fw8kgQZ0VR/QanaEFVkIFIj1s jxMYXEKdTN6djhJSHCXvE4wWN50nrKBJSEGDrrJ0IYQutTFYrLTBOUONeGKUMslymawSVKCY4QPZ 5iefxHPp1odFu0/guVw26skfRGbVBE/KfkVuRukfjMJr+GZr0sR6EBHXCOVc8SYrrAEQ17KqIImc 0GAKV3N14SwSPVGMm/+AHSFfOsSHv0W96t+18w7+eGDfTuy7h/bdOb0LIf2t/Q5EKJXSdmpfzsuq Vi3QqKBfdXHWXxRXFOm1a5JAAqA/mX1fjaf7rrgG7quFrL4o2MxRfopKi4abGAZyTEW6HKl932PF fY5BbhRerEMLdjk4uohbFceIGH8oZoHWzd/eBIy7Y80M4GgnHUq6sEbl0s4M0nWq1bJTLJQBIuD7 ztv/ysTiX6xms2Lxfu/of+5xJH5gQeOhTQWE7FySe2Bs12UJHxLiyKgllxgAFFU1MNxk09MxEqoE F4VnG0DV2OWN7GfjafQ6TC1ibygyP+TUj0r9PhhP2pZ2DilCfUcppt+N5/oz/lafuQPlgosdJvq3 KlZcjZcaCv7mzz+1WjutHemvZNSjXCPVz50cgH2/7A/K5NhL2UBi0pyPcLTiPDSVzkkWZszEK+De GG+ZvCQBLtfAC53NUvIBYEqEF0mFxk+UrWG5mt8hLNgmk+xFb5/jQoBQ0E1hoX9MYG4Hr7cpQrct amy3XN3a7rBVvO6RkfpYnJMI1vRShe/mfLueil/FupYKNddsY99B+ajbpqex8wL1wh2U5tY0Dc9V Ix+4GtbInf2AK/Ymg+npaJBcHSZXFlG5Krgo0IxFpVUg6AaB2jqxFpTcUIE//2ketW1srL1bhQBA PLY/VOR6c+jFv8eHtoTwaYX6ADeo6aTQ1xhkm3+45EiHhzB/h9gf+Dev91cCWO/f7d49q5LdvS8l yos3Wzg7FrmUaryL6dw60nSQnk6C/ZMNbJD4yGQ84jxoJs3eG/zBKfbybVMoRSB1Ta6mPizMzF5j v4A+om9Boy092rYtHWRnEi/v0VBZHqMposwuQimiMBLw1VIli6onajP1JuU54yiYSU7Rxs+ud/zW /OqIvRmtDYbX0I2e7Y/ea+hSmwYTrw19k1DGFo6yMoY1vijerwqiV7PguWLaly8uf6kqbcMW41hM SSU+02ucHPmUmU7PxdiW/HmZl5kGiQBS6rItDZ/p2ggeT1pWaTPHXAdVMdJshYoaJtTQAr6WBrwW NlQz5MhVOypZeTgzxsWAExnjYcbU5V2XrUFPi2Im2RSlPIVVQgtsNNBhyUYQbfLYnJfJ4HJwXZ+K EOluPv0QxPTVNqH04Da3GqFiu2SHBCy2cucABhMWMp3GYOG4a6DkY5ZvTt0WX5druUhxBRJFWNlv iQbfp4xaUHdVZfzGGePzb+KWZB9iqdVRh398lAqcLeIwFjfM2MbKRS+c1dAOxORJ3LssF6OYkiYt UEuELT+hf9DDPPXNr6VtFBPnYeMGinykDY4Sd/zu2atXT75el9vXVMXi9P8Wi5fPPKGbERtfSrzZ OJ6ExgkjY+Imofypppl6XDVeXamhs+85xqzWtCRuDVk15hpWPeoxaGyyh/9YVof5bfzkfHWeL3D4 T08IxuZ8wkg+fbIHR3H2Q9FnZR/KvdhSJ/EoLGzGFrYg6B407K+B4rXuLWiZjZv1xphHwpcuFCQe 1BAkVMUJZRAYKXRQXSHdp9F0yxpqF5Vwyt8KaLL7xPTsprXFCvx0dNr9anT6P67GSyPPbEVSLqOj 6L/TYMrx7g1r8BQL8Rn9jyPCjoXhTcdj6AN5RrKce8gQNBVKP7hbPfzHij6msjM8eU1ZQO9YZPFG MVBOQ7MPImK4w/wOWxSiJYWtSG67fNvdNSklxKXTbhGxQLnQDvdUXwgdWse68kz14JBcPuGV45q8 FeuaeptNp8W0lIN+GtyOX1D0LDsRKpDugJY9nuazfM2VcmM0G5uTFweXRYPZ/K64Pi2hm89wKS1W 82VDuNJI3YZGHbqNU5Y3NTo/ER7/JteRe104KM/dyDdavtooL9x0zVMO9j8kf8sixCuUjPR1RT5X 5uvd7gSY5Bg22bAVvjt53dbW0Dsvhd0FdOChq8fLlmHnNv9KNQHZCrtFJ6FZQ+pQaYJtfGwVMkhp bXElMzL2Qbaqs1khD7h0t+rS/+hweNzWrhftE0wt7x0Swj7gNSZCOd6tThLKRmQSZLqonX5MnuP2 eNQ+6eBDdV2ZuOP45gNKE/Ca8xHiDVY7EtPWsJivBlXxmnc0a+XW2s6msMHMXVGiyhgl1isrvfOZ 7FjmEtf8jrmbcP022XOFqQdXS45lWaMGgkokkcdgmvYArutpCN2m8FKDwWGsIf8oq7G9NAA/OmqW hZQ+WM0opw1dUxq4D1OZAT4sIYdZYOLn5XWmdS0AZVjyVUfKJeXEx6LrNtUk2RxXE8Fym3pGBpV+ /tZUcLGh0ITvYp1vgqhJ+MaHVCPoxRc7RQSiH0tRAlU2FRIu7M5i9CTmA3LZPXkaSMybd8U1yulV kx05iQWm0EkebLBamNFaLf3eDdtizs5TbAHZTdsnxzWNxkMxSolOfFuqrzzTNaGF6NLBK/2gYTqv NMpzdA8QSIWNLRtq8s8srk3yTKZk34tBLfqb6iJlIV2IL2KyMG6H8DSFU+bgfO2OtwET4zNHZLQE hn4G2Eh3+ICMG7lk9DNTE7H9QV9UJRGy2ptTFrNstbGhvm6pP7+2dLAxvkrNIqGnk96LBnx5Sp98 FRZM8mu3MK3CLKInq/9n1lbHYL6TOG5OgkJDRbO6e07XbFNw2P64TVHZfH9F11CkCpazpvgEZYNJ VWKkWY7Bz8inmCVGCYSzXQERsFxyUVwTk827BnbThhvqEP1BbcYB9IVzEfYyIGk79H3cyikiti/E c96p8R8phzwJ4WMxoU7GgSGp1VnzQ0uDGVCE8QLEEjTaUC7E0IUSXZuJijmEPpqWj4fsS+uF0D7E 66DVYGLHjueIAaMfKSTZgz/JFCNyoV0HRrEtyNTTRJjxTyc0GhgXHkiK7nkXV+QgcdbQ49lFsSAb eao/UADZ8be7hW7ZwwGdJvceihUA7hJQZrC4Ni4P5D08mbitBChGQyCT5kWFZrTlcDzArknwccaB O+f5PVNbk3n0eka1LcEMJpeD68qe02SD6Vgu1nH8NWjHcTx58lox582BTaBOOU8roy2qodOyIysE anDSvzatLfRHwRWFf80Sa6OyVGipcPfDIOmFM6cPkroJur2BNmDpDdmQjAJWSuR4ndf28mI8vEhm RTHCGJHBnFUXkmQlOKXKQqQAPWTMPZTrI29u6HZ6CVDLdzggGEdCXjNktA4j8oEqScU8ttZL57zo W1tHB3rgmCIc4eyxTGYcHh/WjyaKP3QSfXBTVKOYLs8fibpN3Ldhc5WZdAqE5gsiwxXrbK+R/Jqm L3RlaUKxEkVRBO0LDzKKUflZLnwtqFUX2e/dvlKKBCoS3k9jUuDHSJS1EBtrlG6ue8genFqx+gg5 TQ01lEJ0D2DsuI2kbApFwtxfQpQjNbyRqW3PPUFN9zqPhT43B1ALC+8TSheSPpKzRrX6mFs1S0aB aZRtbQl1HSdgXgf0aJduXaiw0I32k3XIbVbotMX3yF6xdZVmn63GC4OxPhTsz0zMKqe5tkZjfudq HGGNrBSRhUTh5EtDDawgFGw27Hk3YyNW0ygPsEHWPOMaN4qtGXv9PG1ElAY2z3oSPnTzJAq35lc3 2S+8ecMtY1LMeLC93Wr9vlHbOzjtiUVb3rCF1JaDNtxaG4FvzTZgAu9tocWy6hgPBufm40TqxrXU mUnUHEorNJ4bJWxRIacIEorJfGlAdnh0lLACMDlG2lVbrfE3DYdJ8bliOxlpmkH8pzQGP/6kHEJG I/vNZsyT3x3shLqXNSMCBjEYorhqS5qA2mx5KLW63obD74xVVAeKjyv2AoYu+LAuBirLdCX36mFi Hc+gpKmpAR9F8ORpPI75NDfAbyBEO88VvAwjuY9SCnHUI+ZvMDa643Y4ROumPJkMluSJ2tXICX3k XF49i9S2selUjtc7Utz2faYmtHEudTQkqdmBuc+N9YMtqdf5vJzTNa69gw8IyXShp3oQuGRxP+wU 4OHF9IqZkaEbnQjFxyCTWp2+PEKtjRe7YQfqu8NKMEVbNoykNaOQZB6kMN3WzLtqWTO8ps5LHhl/ pBYXETW1HUvU5kDNhjV90LdHzCU8euk3ISCkr8qe46Ik5ydCTRIKHq5FRO425zRXtwJ6VQZ0xRPk mogF1qnRpj9aWHbYTeszq4cbDdSzZg5xCYeL1blwOriRwbH1iURZiRmwsClRMSpGfcfGUfCQYsJt +EcXhzO8GCD5xcQGN4hleQlPVVYDHSVbU1pkqFqdbWfG3C3K3tKrgzo+tPs5FcojmRnrXueNM27H YkyPmpYb7a6sD+Vga8mA8h9yjkPpXUKoNRsU7rF7gWu6Yf9WpwftfhiXq2py7YPvav4em1+zWNWM fuxcStYKtPIg71/MI4dZn0LtHXASvp8e0caFklLIIPyV3WgVjM5JsDcJ0vHcF7MMVjlnQWCklrNb ULWrK+axLtTJJqCaw5PoRThuP8aar5xskccGe8P2bdF7OHvvEK+pxyGRJOGJbnuzvME0gE1SgvNP TQ9gDEzcecyZOHlWqFKALVBt6Z6Dp456XsW12oiwvhzh8DRnjxy4KxqbSre9ir6AFslWdkfaMmEb GyjbswZDqLx+ltwBTvQJ/0F91H8lL/nEYWmCTTXR4QAlEKJeYFxGhw0irZH4w4pZeJ2FzCksRMDH wKdUhBDeUiun4dTKYhNDh02BTjm7nRjrKk4g56Zq460DnH3E0wJmBPBfhGFobFe7kTPVdmHMGTBZ v9DT9tYrtXRyKpSkH6XcD+Pm0PjQhjqvx2/o1IPccXfsIY61WFk4azZWOWYgvwB2NK4uUG+d3HuH WUTPYNHh9jLBmEESuEhYZCUVMerGYsTHJLIXlqbU1R5d9lMUUfKIXdyZjYfiEtLv8z0FdbptQLdN t5+SJqup1+QEzfsDX39ETjfmWhaVXCCDGPrZ0O6Tq/Eyq1lPRZpF2XE6LUZ404EWBOeLwZQ8mqoE ln9CRIJRX6o77JczLqp8Aw3bfNGwOKvSE5obaLPW0SiBS+A67DbzALlHEiNq7HTmtAs4SHxFaxLn DgZH6aUGeCNYbzK5hA/Lxfj8vMAsPwrRFgcX41EQ2o6jdj4xLbda2KK7PIei+I37h3rYjPCTagUE vOV5R6shYmXIQ2zIHD60i/q0mwDjXxaHwKbaFZyVV2igRqBOyZoZ6WUlOR0M3eB9FimLx2dyt0UJ Gwqgk0VhbrXgjYT7MuYknJAaqJxYnE1KXXHq3em4IqdIwqvYQFXGfnRUoDxQzIZAK11MemI6xMbt 2ADXI/c4CYoF1B1wyC0Qb5gCYpXw79suoIsMl+AZoCXEMxDlsUwyvP6KCV8W49wMVwu8kZxc762f pe9klpipHg4W56aVQ4oCjg4CVBxXgL2Xo8zJlFLY3tmFaRL8/9g02IQytkiyOhRxWRvdGJ3CrASb DkXyN29h/zz0co0Wo1e7S2bAnfg2bzqeiVGe9oRR4R+4GpCcRHrGiBekmgHivBifY0Cxft/Y9fVR ATWz98xs5oCrIMEAk5Q5K2m7JtvJnkp1QixVm7mIzCj3u7LIhBpFqrCkfgNsGqdkiwPM59suPqCR G8fHGiJEEF9BgLiiY0FVN50EFkiYASYogHJtMvmMPgamat7g0mG5moxUBmy2BrXdkhuDKYcQA1Ga J6A6lgLWA8jhs8lvEoG0xCpTovSYu4opZllsqxlsB9KrzkdrGwoTgPAX3DZsEWOE1o06FtoKpI9w tWyzpqdK2SKvFODkgQBqQrHQ7O6CCFbT6S6pot+vxqhfHldiipvFzWMspUgX9LLJPQEbEf2++/av jNe2Yafv7xy932W/7Wo1p9kmdTZ8vkPeAdZUnaVoMXPo1ly2Ga4Kbf5JrssbPZIXqxl1r+3Z2Hgu ybDUVuiXPIIO9FJTIXXuyRKBV/tIkFMyXuOTj1FSIHvmk/p1gvueBK4TvwlviGxBRfeJ9GQuitmw CjoPkgkZl4gPqGBSWdenvN1mdtfM2dVcbRW0fTjnAZBeAKSqkDhdhthyU8DCATEZCfADBwJ8YFOE CzqFc6w9kXMVCCFTTm1hnAa6IJwM0JeIewcdRpPmrtnPUZv0Q0rZQH/AGBCpP77Kqmyw+yBqI1rL mSSZgkpWMOjSDaSqfrFczg/v3BEKLhfnd1BbXy3vGGLuYkzcVLlq3gT5NKcOlR0RQ+VoBTQhWz7R AA/CDMROiOrswFw6sCGT3aLrU8Zblp4gBeZluFMBHUrPaKGKAGed+k28BSZubE4Buy5Xku6CCJvc GWFXYekkMp4uCWEfPQPbBGEgc1xCfY/+tbdv34tUIW35IsRHnIOu1EGIOsYvZJI92frKCHCB2GaN BR1LDCQ5hta9gexkhsk189ZVTVb63ghLjJfvgPpk/ZodPHKeEg22H/+Fo73wNRD+CW7SXTixpnvp i3IykhvFBjtvz5CaUuFY2Hr75h6fluWk8W4aP3JlbtUc9Gfl7I8FRl6lwz6DUEmTBxXgxsR5j/iT LEMPBVKJOgCYZGRVhNVrKkk95r7UyVs380LyPZBi3kfGi2e9yjJIhiZ1jg9OOskbkhRJ2Mub0nkf p0ma3Ep0xW55dgaUntxO7ufwT/qPaeckVtuocFPVziGaOuIUiJiabhP7kHsinoF2zXT5NKM0jOVs cp3dsj09vHviQ1fMIkupO8RtV6zsA2kL2MOCfZB/mKWNttIp/rNbrS2yWzV/3NVUL71FEwOMDMqx hvDUmTcba5sTFMfo9/NBSp6pkEQpWnS7rNqHBo9lBeQNdOPeUMKZNm+K8NatWH7lYiYhgzNXtVRA RwSsLYaRsWrBat2+SeGlo6tuEULPh4L/GEA19eDIi3oVW7BG+8i8I2jIXkIrbMYjgHJ1zAlVbXJG 9N34vRi9MPf2umYtRLXmxQtjvogW8pc8E5e+xKHI2WFQqXpAM+k6ubSN+iSXhDTRSRj6KI/CiS/n EI24D6RGq9ccYc13vkfFrEg3pwVfUbDBiNKRU0iodWA8hoDiD15YoVhghCnZ/98cvX724psk3dp9 IiVrVs4RhZtQMZiRitBpvLppvhn1tMshhvOmeRaPzEZQPhXW8jLemLRuEk18TduyUv3w587yMGRs RlLgQH9+BKkGUUNWEmfLIRLzqvrAUSwczKJGdfjJcATK3cck0Q5tUcQWFIsfrjMStXLFfBG7a7XR GbbArylrieowQe925eCrCUdKYwdbrdZvhfRJjwssm3JFbhc1pOZkxtKkAHxqMlBGo0UhE6Eza8+X VAVGm0+MLi2iKd81QlSDxsSWCyZTtBzsFIWFWHhvaJ1VBnI2pEtPegNCJaIjEg5lfk0bEUVD4WeF qAgEVUaHdKi34qO67oFl1BWKTtXgguFqGrUvIxjVZGyLMc2vkOCDe8NwIvjElB6/eHn0+u2LE6JF D04wMRvcO/t9zixDZnPmyKK8PT+JDncwCOJySec24vWov8DArKRUMNaaJQgQq5k5pFerId70tAIb CqGdesG21/ScDiRqSF05V/s5PU0wrya3wh3UiZhdCqTAWYVHbExZWSYYLE8mIynI5bhKrtAlIDib QAsS24N9+pGfMevA2wN236sPJ69BWWNar+7t1VxlYSyS1nYBQRx5qTN+Hqd9HcoDp8V+a+TYpkDs CNeK+E7wTfzNO3xY89NV6xq6TdqdzGkiaykYtyGhTTPs9Zv1SfrKNDK1cUcPf343920TexKUYNu1 gEc3YYM1NmeP/DnN2yb+F5nvuHC1DZasa/RW3sJbLKvNcnUwMWvIopk1tzYA1UY5O8ZU+/S6FtyS L/7xctzqH28WrmtNTKJYlK61kbKunAvkFf1DcKIRt2LRviwY51P5Pf3z6tGbN2mAB1KUBrgw7OEO X1B/TIzS5giiskKW5LkErzF4rzpA7ujkCwYT9k5efpqR6cwQHmiOQoryAGsu9vOgaCSS5bfPXhwd kvFAe2/RlotVOmDBNsu+mGkdiLkPYHSEllCVOjntxM8kwrzZnw46UvnRVRE9Elo1ii+K/AVFcLFe BSsVQ9L2BYW1iWLX6Cr3ycrC+j4Ki/F+E1g4i2dPY8A4H3ETrA6HMi5GsBemTx89e47BaJoaqN5E GxDbiBuO/MlHdZbusNsmPJ7rLIZ2wyJewNf+8rKrwr1S3jGW7xQZpb6ZKoXTJ+tyD5qCyDFexig3 sLnNNh3HldJJWD1p1u5lLLAwtOAHaamVcIsOn1y6+IBFqXC0Me41LysvIK3vWIidtu4j1OlkN5uj fjDXo95E9Nzk1TZjsdzYDuhqzYiubjwkuQHreXte86DT781iQDc2HHkeSTJDQlQ99IYHKLEncLmx 8RC4YaULAm2gn7UI9IL8IALDYKoageG3nx+BuA3a6FZMPD4GtBYx1B16Bzpnm86FWISn6m3PZYkE QffRJUqMhQqrFT/Gxk9a/n1MoHfeUeYK9h1ZbSYPH+KVS7UcAY/qJGhADTD3puPKmGQkvvYFf0mK cxOKx9jzMBamaBSdYvcUj2roNWb0FAkuM4A9HaxJ1y4mVGeoCxsR764y4eDGldKhjZTRHzBGBmqj Q1kK/XB6/L0e2Ut8adC4n9zkgOXfA6xQ6U7iud2MtAMbfPGc16iCuMH7WzaVpM9ksTCq5zu1SZ4y 7AYXzTt4QWXbF7RMNCvfsJ9tkrxcnCxPQmrL+zYNz5B3Dak7TroCsgfpyFUMhStfsKoLQOmuk+hI SupYJfaemLVPSzEC1AHFLQDyzBDaCASsILfJGRtq9OJ0paUoLhloMPzg7H0VlMTbr9N6lrnZCo70 xrHZRgFgVoU7X6Q1j3tzyC9OmpWKDScci/Omo5Tlgfhw/JvDkw3cH6PvJse7Iwz6d7g7OozEbrcx 3NeMBdD/fv/tXxtbLF5ceNwFdJMTxRwm5P3B0f/z9WefWRMrZVpFSbNQd8PpMITPLIy5HllTdWDN LlFZhrzjvJhx0XqTq+V4Yira+1Z7VuwkX/Gd0iNTgThoq4UbzvJiUa7OLyinir59gh4WV9qSfbUo 1sYBqCWVuRrKvakkLqPn5WnzPbh1RJdIAKb1fxgX9cTG+JISJXGeWbG7fXaWPGb3YuvIUZ4RAPRr hpP94+wqZ8+RAkvB2ffq2sSUGgAmRNtFOY757VU3SY7gp4RGskDJrJmqS1a7x0jdYvPGt8KnK8y9 fMt05RZWe0xZgJFHuWPoAi0vk9NiUl5iYzaFKuwrK5sh+FJsWD/gwLkX5E5X70/mj/4xoL40aGBs o45FhheBdCXItBe9YjXIBvc01jPElPGp4FbJony1LNF0eUi2ToBlDP6E8BDcyyXlB54XJg8HWZMb Le5ANQaQoBQSMkWPco3gehAa1DhEhwWHFpkvM31EDh+AgDmvnESqYniMjIoAUB7aft91RLCAsBTO OX2WmMPWp7Lfx7JoqowOuIy40GBZCsGGB+UYq9Dnr67NrReRqjQEkFXj48oCm5ZGKX42HvrznVxe lJXqCoYLJ4SHsywrZgYH/RWaJFvfp4on2HRksICv5EKBbvjWXIqzgvLQFDGR4f9TujMnC8MOLDq6 lGAjdbrDSibocUf5YGyzDIj6jy3Y7veSrNvtduiatZPAI+sI0YxE7MVHZVGhQdzZeIbOltcSoUda QAPfOETKc4MAO2aeZgl94OF04NngCBOiXC/J5wGFbI3Lx0g+wLooIgKgeTxCJxJ2q9BJlM2qmgDN IGP+UEyuGcNR8sI8ehhkbUFGaUBegxlZswO9zk3+ZFn2htRpS1nSqjsLJruDECQRHw5CkSCPEY0E yY9VZi2M6oBBIXRUNjLBI2suBBTI9hrTXiSTGb7NFmW5pK4RpjvJLbz9DYKDmw0B475wxOxa7Vp4 Fl7AVCH8ZCtRAfsrEJylsEXNutjWvjObrWyxcQwQtkxN3gCKacEsD98vXl2ia/zKvYrdmCkJrJZR FZut8XEORZhcjIFDw4q/JjQxB8atQ0NZFLS+0FdobqrzNLVRj2z2yXWWBGa+pJN6FA7/a6wUpbrK Hq8gkNeGA9Hhk4lLPelrpkUQ644rh+nDMOwjitKmIIxjuij9Galr+6WSTwgqWgJ+ryXXZTOM48dU 8LGfMBP7KnUfd80aO2ltaWxiLwTwc4jSY53ZLiA8i0G9NF2nxM2iAFnZvc3q6y73tXrB2KIX3Oq+ zg3YBLeoj9CVQcajaqiz+kU5HroUxh6lhDQSXm1J3TVGpHq4vo4Vz21Snw7eB1EoUgLDKjeT1Q6e FU5RJ0ouSniZh/xa6sbAYlK3rP33bcGc7UgH+PX2gabau1W2u8jbNja8N1znzestz1yUGwF1DCdm CZKjCn4gjQH8gZquILJgX1kG35SPdgiXIQWkcT0uJiNdseXeQmnrOf7MnNpQUsxIWrbHjUd8IINt oCg4voM4jp3B1s1XJCIfW8NxdQIzUQKVhXJfTlomtNMimuZT8uGaata6r15hB10MJ3vkDIh4Mn64 zliWul01b2hiVAYyQPeJrZT5kxmW72LQWTE6bz/A7j1sx7Y2ZtWbCg85NYMcdlUvHsObb+hkhXZA pLNDHoyva7fqJq/EgrJvsyKzZsPqnXxvatHtHCZXEgMlXxtyLjwXa7KovYKp466TlYcOxaaS665m N6QCinGG54AbEMF3JO1l7DqDL94sp8vsWM/oSb6JJKCr6yeZW9l+gmVer4ph/88ysRbp6PbfX2OC KCu2rn7JwjnOLcd5AWPJPLYjANU+hph/Yf05hHlgcMEmTlCVqwWFeWjv0h0hla2y3OgprLU0cnJr 477RTYIRD22TQYZaXtxe/jNPRZT/Qevc+y2H/h/3UNfvEN5YSVhSU43HWffaQ0MscLDzcfCTav9L RtCavZDzeb+wo8q5c1wslOrYWN4sqRDUOrbNXlYmIOaUImJtsZil6FYjEXbsSyYRs2FivLFBkgLE qNz4Lu+u9WMo51Vj0Cnf2DsibO9wQJThivV3KLxhYC2KnWL27Sqm5adzp0dAepeLa/kjxuw0khA1 9La+J92N4qZhblO6II1mAHKo1tr1EL8+r/daM2s27eMOQdGB+5PijBLeqlcLDLGPzVvQN06rFa7J GySVCPrWoxFLPN+PgkLD6TFujDATif+1hknUGUUTs9gkoKlVRR0yC/jRbLTN4oVi2y5cQwJBAPOa NxFJZFEprE7bEXGribJ1D+zNbUC7kbVgKUjNemvjClaF800hBiNLrp21k9tJm7atNjvX6e7j9XA7 t/GNXi62mamXi/9/on6RSQK0rJsjCgCXvKW0G+qyp9drvSuK+YCCcRGeSftfGUUwPM0H6ChGl8Q/ ys0MiL5AaxhQB9OQLTVTId+cji33DENmLLFc9s9BqVyK/eTMEdj1g6iJevpogbfNMaqqUxarEJyp RIS+9HB67jHfgngim/tGCopMlmvUpjVvx5F3s//WE+bNNibXx4/bVvBBb05//k1F8pIJWZvF6ygq l9Xw1TiyHLaj/0ejkdB/FsoMt2t7bK4WxJvVaVPFvbUVv1tNmireWlvx6/GHpop31rdYNo5xd23F V+VlsWjoanNf43yA5+gvwgiow1FGgF/yWtlGRkDDjENiDNRL34SpqBW7ccFG2Q52vt2RATezka3h 0QgAoIxEwftL8iUSmmmePl1o5pH9y+JvaqU4VRYm0UFvvq1OwFLW13aYWCHrVB3qQkihSgyMEELe /lTlxc12xbAXPX2W/QurQcSUKsIMyF7LT44bYwPNsvGHAeer0IvxbNY+ZFg8/J8i8+cVz9qerD2w gnY9sIIfK2HA+ujfcYiaiCwrwWuQ3HyNnzWFpU81//m4x5aDZlM9aTg+fgf+Kh008lcYpNGSK6zs jlBHh7eFiGK/Br45lmonNIC41G/62xijQebjds92AmT3Tjum6qidTAbNbLshvoBtrL1b9XarDikh pY8d04N8q8YZQgCgge+r6PiLfp2i7Ov4CrGf83itG04r1muvnUwHOTKpCoe38BDWPG1RrFEd1fXY BBp0jRrwNdqAsFEDxkYfizK0BVqPstHWOPsopFGl0Qa0xfWH2W6V17WHzGe15hBDg0aO0v6s0Di6 0Cc2iYbOh/ppw1754fhw7+CkFUHDur1xk/YQ5GmfIf3SF6miZiKcqbsQJh/UQWjdPckOMdX9wg6m fp26QdhtY+yoH3eR3PHpJ+I6GNezk0Qu9FgI+kbsm7aQgaTon+cWILoBU2nmprzrQnfWX49tJJKt Dud/liv42lzKSLO6+t4bvPapkOwe1mQuoVD+zoTYyCMdNkCmnLOU1hamieOO1ycga5sLlgBXHbwT 4GQPKd/ftSOCqNxrhrNoatbmcs1VHg6jb4Zgp9OIxfUgWDeb7Z93usO+elGKSM+pvv+FOAApel4X e9b3w2ZQpvDe1gKDdD/m0oEcMra6d6CS25iAkHdOlFngl9wrF2UWO5zygD0TeLEPKiA9cR97oIat TDt83kDAN1u/GJi403J/3OfW2gsH1UB+uPmsz/wi7gbzZz9U27kfn8+2nHsouc3cf/pGsfFmITaL 3W4X/2AkoYC7xgyT9ig0MxPX0liqD2iMU+NPIO6KHgLc0ZXVpWQVU9dqK9bD0c3X2DJBEyd++XXW S1tYLgGEmOFShPlqK6a/8MYpBPn1uBoOFlvdgkrRf7kkWaNDk0kGp32LAWK5bUZHFqlQdt0dIX2v YQBe5rViGCrHjJ/tZiX8islybNoORkvNdmsWai5Am3sZvfnEUws6j3D0oXD9+uf6oBrbuoqbNaZl Ja/RDA5B6FhJ8VdJ7EKHP2UjXBivQP/w7sKtZZVgW4cPNFeaddUGv2bXQvSCoN/ZQV4rYPy6n1IB RWtCqGTmm1U2Z0NLeU7XwnX6trJcNqp1I3p0WjePH0TVb+vXulvnUs5z0KT3NTfLY3UorFFVPBd5 fdtV6r3wEGod7Q0FWPdUE+wiMdTQQK1I8zsf/x9IYI9ePUvuJE9mgN9kDsfqZQUvPx4gZzYxE2nl XrnZqS4wxQYhUWL8HpqcGhhvPyQBISyB0Ube384VTUjIgvQckM4g0o48RLJlSB9MtOXreVExSR/B Y364Pdl7pCgOXooLfQqNGZefkMxuRNqKINm/2UaWVruriTVNKMRQ0471qVmq5+BOs5BIO+S0S0HA xpwWalGQwIKcvh7iK7XZwYhMTC4t4m0VJTcejTkLC8XwSpI3q/NzPBuWM+CPEXjoBo5HTeE4ynr/ tDjDyAAiLOFHtO+GzXxvj3/3YCmNZ3k0I4oMmJ0QJJzqtDrPJHiaY68ei6NvdXcbE2HPUZUNn/cM ycAAZbIWSqUgPhT4b3lKwRGWp7rAOhLdMcmC7EpEAGYz5m2a/MpNxDxLEMdGE+ZUZHDyXp527Wks 72KIZZMM6Ip8vML1DuUjS57TjMedla7CFDYsduHapDNHltpWZGoKpJLZHsd7ltgkAMbP/3Jl5+4T 5QHEguzAOjaHxOBSVSQdTvuHmUqJTeWO909QqZgmyYMHxlbSbOp5g7CAYFjdqcJQYTYS1poeOjiB sBBqXlEzg0lMVKSItn+qOzSLpO0dja/4cHq1PD74XAJFGB8peCkiF0p7f2bhY/2eEdsufkG+HcoG rdaYfHdpNlDL0Ua3uTGmczIJGMVp2AWIOMvqrhG/VtGcI5/vuc8X2VXE/2yGTtjtlgvbm6XQTHIL oWG3fp3m+htx3Syvv8zOxEL+nPM67wdlzhjcua07BoTd1yXG+L0GG2/t4CVV3vc/Kd5w9/a92/eB vCblYIkAmAhh5lLiPn69KzMuV0plxIbGgDTKcl61pRqXgE2sk2Ds/4NOcjf+hTuvm5oOrrJjhAjj PqEx3Pf70r4oJpOyfYzfiQouvFbb56t3fHt5QViAb+/vvv1XHKvk/b2j//s/+eyzneTVH46+ffmi /+j1N49ffvfq+ZOjJ/2Xv2uhyxwXPKSQvzQ7JkHLYGLTOJLP3SvKfdelSv0+hTHFy+k2kmT7ZB2x sk4Xd3PK1lMNgfPTNnp6nbQlpd7eVAI+tls2kq9khuQEohilI0lxe01doHgT/uGsBBRdkjxA0kpL CS6SXMttB2+uK9iEKIGkjfM9Zjl4h/Zvk1nJZMlr+fFfOO6UAY91O8lbzGJHHLCTYMJkoLIRx7IE LjKcjpDxelBMdZW+rNUKamaSuW5ezlcUyFg6cCuxGYEwxAgm3pKR5MlluXhXtVrv77/9L1x/F8X7 Xx/9+zuUqkwmPHlFbXwH/P0cAzqdDqrxMMHoMmObEp6jM8CmjsmJaN51GJ2yMj9NQB0XbqclqwUY rxqgSvKG6UeSh0g+B3gZd799gnHCaLFOJgNJAFsCL54acQ3dAzAOR1km5WSE0YCm5QdKIbeany8G cPgDUmpzjDqv1dxqWo4G50coojSl/glD6fSXg/O7GH/DRViw3+iwtQhtE/hiDBNx4oa3H4vRP4s6 nNquvVmdSsHMJAx0zJ193CRnohSDPlZ0nR861yu7DfiIIlmHMkbVrGHRiZZMEqpjfYMpV8SV+eZd b9ZtDgwcQJSXrZlRkSYmectgnlWYaoB6rO4dDdIoSuAtjclWTVI69lpOUd+RHO9WJ3TMzbhWx7Te SdJDaRxxpdo8aXkKJckGyPdJMx5QPZJaPbAVNJ5gyht30LZdUCDzWhAJguJmV3Llbje7mgbFv5Ay KuKKrRsRGLxRrYCKVAv1ixluIWt74uPG4Bxm2Rwj7JNoC2vjcsytfSdFoiuW0g1GCf8I16pdj/zg VRfMlgsPqfZt47rhcv6JgoY9oFXBTv34wzC2wzRfF5iirs7iFvig11qHRBRiTX9r7Ax4RmOIMAwV wCMOMYZfJCaL/8EMD/4oqBy4XKDeCijSAuxGqLgbEoBMy/Q6nJjYlDjQtZnshhO5Nbv1I79kto2O wsBtxYEZ4d6W6UdGi2D+oizf4b5YhYlYuHGEfVfyMde3lz7G9sDb5CDCjysgMoJvH8ifLsZ03Vn7 YPLQW8LJco6XyrCmNLA0jzbUH41RFiT1Q63B6mK1HKG/e/0bYgFefwt/XheTwXVm0YJb9zHsSfNp L3D5honuL4pzaLBYEN2hTkGwan4qfCrJ3PeiTC0UU6s2uLAAZXTiR3UPIYUMlRJCmLQkwyXIbbgX ePpIzan1bKsg4UQYKCzvHTTmVyBVtUsviFgz4XxMR9pG7m4Tt8rGI/mUR+zyxpUZTjHK9FDy2I3V P+DWJboTJv8EY3wORteJA4MbXw/3Po5vu8GQl4duWq6hR4fXdFSLKbC4OZBF044HJG9eWcfGZk3i yjv8nqtsGI3UEkmKgTXVhhtO27mP0lCrL3QS2zRlPRupIhxafTfxq8H/0aRhv44UI2Gi7YYl6dUs StRCzrNABSMjEG4VtW+1nMzkguIXROi9Wf1m0Xac5fjaeCMCGYU7qi8nkdDqqXq4Ys9Mft1KYFRM mkjGYWowGln+Zm4j4YRc4+emjI0VjoWUmdmsWi0KH5KCcXkxnhQBpODqWqUVdI3B0TAM1IHOAPn2 m4VG5XBSDBa1yt5WZMsoHwLFUBo4ZIQl+iSSr1tUjn41dcD02utfbxR8CxDJ3WRotId1GwN1+QsF pp92LBkZ7lzE7s/GV71UUlSkITFgjW7fVdWV+I+fYc2c9+OhTRTdS0G9V1JOMAytDYwxLvPogAuw QWqsB2vYS7Mu2NqlA4Y0QLeITvtPOkMLcZ3A5TLSBvMeQ0TzMKJq4PCiZZMjStOS3+ps0gSDBSmj csHrfJ23V3RaeE9KiadB1ISNekBpn/mbkyKL2Qc748j9FgEekO57Lk9pF8qPFyV3QEpH9i1aLRuW GJQxFw+ddm0D0WvexNvEzoZUS7YZQPFucZoRpa/+cPTkzVH/1fO33zx78SaNxftgHVLfEALAiTVL efeWQFMVAId55kvnjZmHSQE3f3cOOz1fMlVGDYdnRgbVZ1gdtMthA9RxOXtRLp/aIMWKRp5R7WYy 4UycsHZgIxoklzA72jqVPN0pjmOt+azNlHRwEFqdiyyImQlCDxtZIV4g7wiLikiVx18c1uIZSgtR HpuolDm1j/WWUBMzngXZNaMGg1aMgNZRE5pFne9iU7Nlq9EzjQ2OD63iOytERf3/RW7yNrmAKVpC RYGPL5M4Lqh/bOYoMcuDDvxD4WH+CIyXg7KSyu3g8KS+i2EFShuzN08bvCtd89RHgJVhC9EO2hK2 hz7PhRceQc3KwzROklDy+F6djm6229sxKAlVCaWzuL9sVObfO1gjPdc7hiNf47tVZ05YIYJRvB7A NWcOrPKT7wojgpAdpl9SBuy/7Pb7aCjZ78dYp+0Blw3gxboqBbmjaEOpDtVLSutgjkjwEU5IJrEn SyFwPMr8AyYW3RRQlBPNZhNaZqz5ivAmaZ5L13MdmP2l3uB2G0nw0Yw/2Gnr+jopw0rBNSKtgbVp y23eqtiGlvsZAI0IKqflYDGiO+zFKmp6uvXGBWORdrbdRrRE5ONVAOHmkt/QXrZwIk7zlbkiMKP4 ERFWkuVGcwjXjcgndSplGy8rDUcTVTZDVGo4e0tgsnhYsVrMLjJHVJRtMs83Hvotx6BVWSOLRoaA K9ytAXOsUyGrtValalQAVOs0AC7Er/wOQn1nth2MXMMqdHuq2SS5q5OQdyilUM83uVywFyP+iZgC sdeCERm1x8wMcQvHBwxKq9inkRXq/kGREHBYFwjY5J1uN8Rmw84a6sIqeTy7Zh0qVmwEqhRJTUCb smtOmnsjM2IzW0TmJSqxYZrRJYLEPq/VSxAJmJjYk/pdm9r98CLD4/xmdrDfvAQ4MXr9GPsdRn3G MAqZRB3muAN2KTkIZhEd88NJXo9vwI30+E+HEzSwjS8buakksWISq3cD/kH7GndTpDD3PmqvREHw glPq+vRdKYBgoGwYq6KyCLvvM2cJNwSAwYynOoa/Xjax6PazsxXT3zF2dHkX806IPBno0HfqfBnX vRyzPZxsHnOA0WDoah42jpB16upTrXYEd67IibmIsmRo42QnQitwyqRsNZTy2sYoFxsbY9lT3TEx sxMTNDtyfyVlzGLwCTS86KBlYDLVyCqUn8GyZWhQhh9i/iYxPaVqHM2o3K/NcdQ5fy7ZOo7Esw5G s8uZddjykdJ7qQ7kncS+MsOoEXj6wM4DbOUGT73dxUPc1rnVjh60VgfL0m5WA0uzgVRIL80Wa2ax rgS2SDZyKb+QKamF7oaC/CXDXCB1WwDObrDFoU3QZzaCRVFFd7pwRjdka66iqszG+loglQ55SkbB haZyNQUWderGlcKkSBiD8czo5Cw6t5AHGKoXeMLRhX0d2zPjUow7nDPbp9CmKsF4QwbteDdCwpaV SXuOHau69IilkMTP3b4p3dpi07eCmJG+bTYQw6e4TbJp8QsIsQb3MHJDYmQu/El3o4yRttzbcJOV XUlxqGIueBlkpQTY8lIV89CBxqRSBKpYhBwb8IfqI2B5WK5my5Nt0HXFSX1ET2/zxaHZM/QEDbu4 S8dt22ibcmEGluy8g9j7+M3mC3hDv/bKo356UnVxJwgWiLMAADZvf9SMGHSp8ON8ipMyjZs3zKf8 yFYjpJdHYEF2YwMfF7RtK3bDaq9xTCmDDJ3CI7gm0sjjsodNwzO80r5w3QSglDyTQ0/Vb0aFhpkj VQpC3Gotoh6udc424m23VgtEDWKibPcZ1hULAzUYF0Mx/MAd0l40c9e1LKGe88i2og+pXPliWC9n cOVdEwYyHhzCJevdrLikOUob7ukJ2iZ7COtihOnPEOKuUFVC5/uoKQQjXBNI7mK5OVytXZULXLcR RMZuIaksoMU+B1kf3RXAtuJWdMn57fHrrRPcpA/cwBMjPdn4+F6iHN8I7VbtmOYk0KBHwDG6nsIj iLjvXeuNMCS9PeLZ06Ay1aTv+vBY/RzdcafGmkbkZv0zJaKCfEgmbF+jOhFKgK4Uc1Qx1b3dS5yC fYprvXY6jp8dQgJbq/ch2XSojsJ1ubRBFhW7IVid4+oi7eiUC+ne3sMUTcjVKM8we/EkZs9aH/qe HroSU1vvP3/7r9H6nHb4vnVyBObw/oujf7/PBvhPx5T7TfktohfySgKXmCMQardZ/6xCmIjjZiLb f/LozVG3dYQ5AtlFLpFonYlru5yMuvNrzg69whGyJb8y5TePg2rZUjb8fFlqBuMcNo3jwg0S3qJv CB5poeQSq3mq5X8afBhI6B0sY+z2ydbwQZLd7SS/7iR3c+PyhAkTL5bL+eGdO6er86r7T+yWUi7O 79A968H933zBoQXQiRPJJ0u/KsvJyznmUv5qPOMHChbMj88H09PRAJ+enT25oldfgziVhhqb9Dms WMwigSVs7Amp8QdMa4UPkmaCHgHddSivgRfi1xerKf55s6RfVuyjd6tTdpKhckCy8b7g1yPUoIpo 08dYBjzipyJCf12cUU9wf5Hn10SvNMpiUnCDHOmj3sqj1bn5lKSvcBPFh6cldfn3eFhltNFPmE2C jxtlHdTR4pqV6NTrxfVTXm/SekGalvSZ0bnI01OgwTqoJ8AMaA4ovwo+YTAA6iIMk6YZg6rzbLBG 0WAIaaJPwSKIKS8zI9pQwmfWJZ2py20mIoXeG1Wm+XBWyf1xBeuSlswiC3I3CxchB1KXktL0oO/S R2lACH97QK77LafE3bJfSrjHAhyCwUUS2bJTUSgckiNIeZ2FFy7As4iZSOpMVpRYb16U6ZAX2uyo EdFJMapeWjPZGg7Qp3t9juxarBMX5uSjQxZI4BMdpYBb/QDIAvYC378ugNFZB1UQpJvCCEiVLv11 Otkmf1RxNb1hNAH5+/8pR/9ZKb7+5LxpnJXLszM4uEHf+sov/maey75jcujH7KmEHXFF281rPupm omKe6pHN25Svx9sUO1pDL7xUDJGINn5rn3b6kNUOXPR6nZNV2uQH79zg1zvBpz/M0m2c4P1R7p/c 0B8+bfCHT2/kD9/ilAXloj8dzFEXaUPvfzVevlwkQNp/Sjv65fclvf1H/+0jYJXw9m/V2+dvLsZn mLAjffBAvX5tXz98qF5jGgR4dzv1ExzAq73US11AVW+lflYCeHVHvXo6KcuFea8/YCICeLerXj15 j296PfXqRbnkt7/Sb5/zWLw3T+iVLvUND817Q6Ue6lKvyksahh7HswpfjSvvFWZHobdIvPrLjF7P /F7zW1Zhpq2fWq0VCp+1qRWgWG7Xa86kWEn/2Xv/1syE/9ZMGbzFtkyUsXAT4RZHxT/wpuG2WVsI d1TOW4lOyOeTYjBFfni2msD2CtDOmS0zK8EFnqzbfmvB5ekUKHyQ/molPQjX42GfNzJR/fgSxQ5q ndhlhzaTyyIZlZiM/mLwAW/BULkyRptXjI+AhyfuouY768Qef3dWeVn9EO42PB0fzHFzGRtDi83B EY16xaGinjhVbeBWJNoU77Axz5HfFgXmjOndhBV5J7tA+0OmBeskvmgcwGMsdLIN+kB0xyN/um0+ iab0pJ+OPmVZ3vHty+uWEAzH3wGydDhgupyNQGRlmx+SfrXtux27uBmI/AiYKHopEkVal6ZtFSmc PlCHdC8a6kO+udc2gLS0+kjYTjxeNDhK8jKkWGq8z4dgvmu2I9SR+jDO42k5iulYZKXzUcAHTuEm ox4BEQJ1V56ag4QRhlGHIFGGjUsBpaHs1gMHpxuSuZLMQGr18UjnO69TtRbuo8RMbWxgB+tpeYe5 H3BroIQVDgyvZYD6ou341wpGEMOP0ftUM8iGTPYxbhHMpEnWaQxjp3MtMXIyHnxL6Xe8D76Wid74 883z7KftYetqoBoQqfrl3NhXUwvlvOIedIfUKZS1wvzlVM9rmN7EGpYmfM5RzvvV9fS0RFxree64 nLuT+ckaXu1nxKzjwTawfe6UcEyfmCczc13YyNVD+v+YfbETzffT//R8P2pmP23zuFmONll066wg YilYtzH7vVnA5Horm5bd2tXhAmsscPrVSZeugoaSilfr8fFdTPlPHxSd6W54bW53NeCvMG1bsj0f Y3WysDH0bCs1IwOhiNQ2StnFZbrIjDhFZr5lHkxiG3RbIO2Ic+NhE9cI90FmTwJmq/yXcepldBLg Ho9wEw0Zc0TCBo4hRX2K/EO/mw7qmbFLjGe7TPP0I+ZM9P0yaXQAy7UtCqcA7CX2aHZMT904rxaE 9uv5iOFlbAYMsGAe/JGbXhBfrTewVrpQddMgqnXayddfsW3FbSk+tj/EbcWSLTjkDRYf3uCYtTee laEMsaWoQFWDPH+0Ffj1+VUzgCC9X3y/56JxSgpp32z5ecOef7MNvzaiSG6Srff62kb/MULuL7y5 xxP5/SXp9bG7iMc7+cBezZ9c7ePPVIZVus7UTGJy9Zt3Dfr9o55TrJ0mhwT8Jw1lJWkxwk0HPlFa eWy6HksqaJ48BqMLhNzjwpqyK+j+7ToTXGDwgRw5I2PFvk29ZtsKIfNgbLY0qZOv67pXOjrLiA2b 1U0wIr8/FitS3Ryk/zz4kUb76lRb9XYFsOlRbL58rAZgoK5pu5Nvh+k4BG+T864GCOOoXf8EOvRg bIVxLJz+HGSY3hIc3xRPXsUN6GETm09BTszkuwE1mB3uZ0LNx+NmC+TggPjbeEZ2gWgMwPJkCLfx wkjlk6uzar8Bv+GwOR75hq2X4raY9sho6hfcaG/dmlU/427oxOc0yN2kRfX5FurnRoEYSuMOO4/c wm27H/ddPjsiuLhSUY9lIXbnTt1HJxf33qgF0/rcqr5bzZk8fOrEOs3sR2kJ4wltWVqxZkjKK3St qTcW6A6XV3yyfV4OQncI3V1fK0uwA8QFwi6/i0oX2G6widbWb1cYRQw2AYh1IViXkq6Pl6Wp82cS gunM5SHhZ1y0NWy5hdvltUuoiy/Ym2VrTpKfC8x2E7mTPMbY2TqTICruyaJxMLMJBJvV/cawq5Ys sG1T/nWSH3+KrXsl2vxM1BJm4fvFiOZT0v1txd233St+6Z1AeB1nARRGV1WLZZDOz6czehNlRVg1 yPJHliE+BM9KhJgvjJ7+Jj2xf/2hthxqQGw+WrRnCT3PgsKSEFC/Oj749eHe3Ub1gxirCLur4aBm tqNw8vNnA/w0nXuMDlR3I8Rgct11JCueH3NrFbAdftVAD1B7w+bEufu05VIDpk1wHZN4r67dsztv toafotHTrOzpvnX5XXOdYTnpl2dnVbH067n3qpvFZZ8L+ckDpSKQPvDUynit+L3Z1I/m/sR6ErE6 sH07WcuJo3YH8RjXmxIJaur4hdVOuqnW+y/f/hvj3o98ejSYlLNiWUzR9L54/5uj/+M//eyznV8l d1bV4s7peHanmH0Q9/BWy8RE65Ehz2/fvHz7+vGTN79tcBc4HVTF5/fNrz9Oxqc2H8B07pIbDpds yr1FxGRpPzQSct2SJxURfzwb+VGMMOmr+NIMlheRGCamAPnMAlWS5W0adz942EP/gy/y8Jb9ElNE LAq2UwK8jjhDxgNG5N3uF0l2eTEeXiRzaIxdOaShPIBExrCcbWKxms3IN628TDD3QlItR4DUhCFd DAAOxqcuySZ1eTFYdjdGQNTDNZHaBIeNQnq08u2k3TWT1b45KC8Nlo0/AxwrPneemZekZ1OlD4Hl 2bItL7YfJWQzHiq8/DH505rFbJiAjOXYwA2iDFX9+bvzms3EWhftRtA+NhsaclFILbOyAqOmcslQ FKQkEptuCSGBkdMB4wNgEJmr6dBjX+YhHBtvjMW1O7JfmbdqyuoVccaKBVUN6YpHWTMW43q4bjm1 jJsLW3KE/LUYEs+1NVgiXxuAJAAlptKih2yKXBrOoI3cHUSErppikjYC8Ekgj/qSBfl0UpNPJ7XG 5VF+da+T7Hs2UoCtFMerUTcph/lh4v1EcTLM+TcfD99NiuCMoxgxSKPkCw9y43A8TjFdDcc5Tk5x C4pUZIgU2rHKcM/ojgqkazSvzHhHoTejgiBkZkvIo6kyuZfDVwQUkwsFHd40eFxXrMXxRv8x3eUM crq/KgcRJabwtkJTzmZxncKJk0hfBWAylQUWxQfFhfjbJy+OXv/htxK5RUZGXztWI5W33h++/c8p Ew5T2fu/O/q//rXJAESnFdrz5tcwqkOQPebjkc33hB9GxYdiUs5RdZmsluMJUOQSHQ2FwcAmVCVQ CdYxuhfiTclk8MfrPUQVgqhWp1K0aiE4EgeAYpLk6KKgPENQcw9XLqaagnFJhiey2z0bQy0k/b2H 7Hww5VC5Fdr6LsT9IxkO0GkDOlvCIX/hciK1FFSyPbDkjOhttbJhnnxbTjCz1O8WxbtiQuMlIMBa 7+7v39+7u39wTxJd2TxCmEjvoHu/e/B5u2WcI60zJGMCE0jBBo2bMxq8FLgpdG9ZfUNF+zzRFKaZ 0zKV5lVtU5XiNwjo7qPJeFCJRJuaEikFZez2zY821wOCMdUE05nzYkCNRO/HthRoH5oWfqIDNXQI 1kvV+1HcLQdDzK1BJoWTScIi5WKUoGBiphcLtkFYAVDA1ODhEH90ogDmZTW+SqCXs7Jd4YoVumAg 3HsCQ4+H/KLD9N8GwXY0XrQTKtDHFYNc75DfcnttmS4EMr8+VNPX7qC4NRj+B/bedUuOJDkTG+mP dPKclbRHKx390TmxBWEjA8jKBjDkkixO9SwGjZ7Bchpo4cLhsrqYnZUZVRVEVkYiIxNV1Zz5r796 Az2ZXkGvILebu/ktMguNHg73cHbZyAq/u5ubm5ubfQaPHXM8S438fNYsms2twDOT3Hz4ZPwIxa1p cW6EZkdXI5DUQPiawlJ4w8cwXe/regWxqQz7PjdUigsu7TBTKjHCWYGdw58j9xkuMwsjH2eTKYqY n8ytY5QNxHwCfdemXR0uYPt667U2+4Gq44ApUNM/WaYHmq12BuId/w9nmbMeSaK7pJWmPyh7pPKP OfFIMqly75vFolTHpFcOEuH3EeZSpb5u1+/rObi1lnGpc0yEF5QjlY9K/0Goh+ndHzRvj1JqpExH 8ll14Omqod1Xejnd56A5UwUFigtafLFsnvF3NxCb+cglq7a/hasDiphlqoxKDjoBHG+vZTb5Umvc fVxez8pwrYCNYsrRm4/L3z171l5dGTL7Ftryy27XaqW9siYFCmeK4iGWbJbMk38L/w0LmeqebmG4 +b5iuj9F9wQcjXGADK/4As7zQ77bgbrm6bcvaDohYcd0SsOQNblrSIhP5mcx8YjzeOXeYJIuFpfj PKrUM+xwkS6FXcQcep+BYqPsK0E5VBEvCnGZKuLnUEXfSsTgMteay6GKgZdjR1qjMjcZOo9flBGY ykyLKocqZwhpdinPh12ZKBfkUGW3y6h0UDbKoUpPfE1p6bVsPT6Ogly6gnVt3UEm5nwq0xWEuTI1 lOGkJWsISluT357SXjZdPPZVLdMVJDKGmx0oCeEUKVLenMKIdkV7LpgaLIrwX/swT86a2u31cnuF GqIykd8lqhJrCLbb1fMy1YJN1GwWQ5QG+0cKcKLKPl3exkxEskOizusf1EFe/3zuLGWkuuEThBGe fzD3RJ+WJK9LVCV+Za5alomUQQk/UZVSGB3NJizlJ2p6M7J4fZOZUE7UjAH0U5NMdk70NwPqeZPr axN1AQtFWiYKuERNdaCWLjNrQYm6AbjH0vW1jBtQiV6nWnBUzuwDTtT5mw7v8+lRS6JfoKcBTtT5 DddurkDXkpollxgUEei8MlXEJgaF9OERFQrPDe/ECAuk2D2sz7mSEKLFw0QtUUDE3LNMAZuou5Rd iWgZ9Bp4OdX8O+baLFfbzWG73Zh/MCqxBDspm3a32CRibZtipPPt6jwQm2z+8Wy62gCyhWTSAobp 54tXKRFIleNMmt/ARITlwmKSSUtPXz2jxLKnnMuk5bvNPC4allSZkkW//qrcXdRk8iZofQVIPL/D sKmlX3jDiRRT9SjI650qXTNBZpfofVCLyuvLZRPJOLlu5ijIZ2pI5NUn0RRu36t1mVo7STyyuUIi 7q5ATwHSwVU9XRY3V4svLjdXi8LdB4ikTcIeNI3tmqymdIqsoeaAOL0imK5Xa3oRZvfyQ7oWJqbX vdkhXWV/KZqOMp3dpWt+1RkSS21MLsTpwcV00Qb34nuF+YSIAhAkawg6ivl2ZqSdEteihFgGIC6Z v2cAqDaDV7ePzVRsm5U5Y34hTBOpVYC7PMRmKhP5xxy06chm0vdy7mSyIDRmM/iSkgymTBbSGTy5 pN4gFFyZacymB+dVb6GLRCG8WafIxg4rvHq//erVu7dlvgBn8Is8f/26vwhk0EVuOySbfBHK4Ejt D9Xgwy/e/U/yIG5V4cfv/rd7oWr3yfjPxo/KwYcv3/1bh+AnBX75DqClMqqCwlcV4OP5h//07t9B NaFe68PTt//Xf/uznzmUPf7VAlL4bRch5eHLz3Wz/PmTAx35FbKXqNEtzY8S8e9Lw1AT+MzySIJP ozsR6umtBHo7XDXzOD5goN8bHmym3XvIXnzxdfHFty++Ku7PAeBgBd7wqTeb3ga+ff3q2fM3byZv n7/+5sXLp2+fFxpoETFlCUXhmMczNlMzR6eM9bJe/PzJ+NWqXn5LfczHoY2aYQjbUbFqAifJTDN8 Em5qaYv6NSoOH+9V/tmi7erfYBkuWgWYbMk5aomQcHaLx3/OmE9BRiBUXBFeq+LstmjmCurf1Tz4 8Kt3/7Psjqt2aXgp6iE+PHv7X/53fCsq1Fd5GbpqZ+/ht8B0T0GHPi4KbSfC9DySveJwJaEt6jdD SUM1YJM/UU0N1/WHbW2Ro03N8GpEr6OG73//vcr7/fcFVwEj/tggXs1lzc/0IIbWa4vEClER2nlz fluQMYrpoX0tamqMSe1CKh4dDdSztm1wLJjEpoqRDlI7QhMeMzUUvyNZdl4vwrK7C5kGAdF5yM9g XqPZZrDEXZuBeI7eiPzI1rm2omJ7NHbb4Us/NwAOrJfpnLPLebPmdMzw1BA3rmIzYxe4a6D3s7rY Luftsi6m5/DkukGSQTqSiwg+ewrd4iMPwcPWZn8AhX3/PXf8++8JaX0Kyk6obF6TxAmP/efF1Np8 AMX4kO1YUDqE1/m5GCKbCf4CZgtbJxdR6ceyLchGbiwUTwiBOAWAgas2h+DC4dDG0/kcsWubHyAi FE0ZzIOHHkffBwxUOK/XzceaY5jAxA4lcBdM8tEgbeqv8lAANPTlHh+IM4RKD0OegJUJo+Fcbc0S wLPtWdcuAIlPPc4WpGkYYY2IoJ3l4V5vLFKeDt9E02kj4mBOWhvEjqTknmChZuvA86uL9EIlRgoK CIKGkzh5UN0lwpqatLAbzpF1I5rvS8PSUEZJYpsz9wbYuuHBDEGAsWrG9F3e4lO8IeQNQ9z1mllq OvANennwbI7KtLqmcLFmPOY8isKK2PBUQdi6CDeJzY6hyG4rYlo+cIeE/FXxZfE4jZzBMQSxI3GI FH+ZLzRL950JEtWdPDqNknfUsGcErE9bdjrLEH+eWMlUmqFdVKheJdGtKCijyQQcwpBPhxuHqoXw U2TMqXiQEzW4bXj8RgHBVDkDf9n2XLD7v4CTCAxNv2CeX8yMzHNR94UfisOrU12pYBB8OqaSZtdg C+zbHfoRBTRd8+l1TBMQHGKuQzBqmCA3yWSP0i5tbVf1VbtufoAJAb4PRgFkOm0r+dVtwSZ5ghrm UYZ2XaE2BOe0vmnMujvB5GuT2VwXP9bLBkwOitt2i5YxZEhzi3aka1yZzhxv1EEjMqFVqYs7xMeV fb8xZxZaQMzbDfxWPHpEtq7QOQyXB5zF1nNWy5Bdx9HprSie30wBis9NoyfEWZnqoEUrObNwhqUs EJm7uEEcyYrPZOwv8jlYhA2e2lSCJUE6Xc85qe3MZzYVdLMWHPa8gv4hzyc2kh3Dq8N283w8vJEy Nth0sa6n81sQnTqwnhryQqP06W1mMu0FPVOHaLiwCkgN1VhT22AndwgifW+lL114tMSnupBs5zn6 ZY9vsH+RtUrsHZIJUoz2ICzF+Yma6Kwm8rFUl65HrKaQqgOAQIGqjUJjUxetSBALQJRUuZk0e5Yi rV8kR0uT6xuCEjWRNRmVzqxCascPD7Ls22u6Un28V0w/tg0b15lBEWh8u+6KRfO+xsABzYyuPl9g HvrtmeLa8EeYQeYhEIVkLvjYF5Nba88az4fHtZVNYzCNVHOly+Vpy/FwuUXFPHwf5o0iuN64338P RYF9gFmf45IjuDt7bNrWE7LrTYZdGybwsWm33eI24twvYC+6tiGIAxs/zpGGFLduOsvH3eJt7sK2 Ldf2g50C985zba+vQt7QT2C8reGGqDSJmOB0sWivTfMmi5kC51m9rg95Du7E3DTvYrTGn4y1CWF5 Oy7L03zG5Je9O2fbn83dnZsFYZK94UXTyCudm7KAb+0S7vfjBPs5Avfy4kC0TS6lJwaihoRYiOFn Pq+JxT1lVUyW2HbnGjon6c6jZ0841eNWbZmfMQ9V4zDpNpw9NuGxwHT/dzM+n93BuEa8tFarASeD GXJbA3oocy49ONmLfIs1ddyViqSp/ennR8wj04ObT48OQHul44sFqq/Ah0zogZWEaCD/cbpu4Jnd o4nvv8eKvv9+jPPx/fdcoZJjka+b25BhfIaDg6PydI78dLZdr6HiZCNECfZeClb8VDOLvNxsMZ0D Aol4p1Ga7YNr1ltYkaAcqL8XAJzbwZCM7FWm9KVJWYz+fWjLPlQlTnxXK/KV4Y3pcvVIAeHS3ZX4 1fzGe2DjLlzdONraVsUa9VM6wf9qphMoPTmEmNO6SWdlssyCmUShJ3wZor8hehhccviYALtYQskp wm2q2D41V0666ceauxIGAufd5jKwKxn8PDlSS8Xf1IYEksGhqAGT7jY7TFIEeBR/3a7xdcGUM3Jp a/gsW7U74chq8hhP4NK6gshdF9w+8LnK2gyzniIpeUhEWlQXJF25tDbBXlD9KBYyx3RHPsCBhw76 2B2akj6OZ1qIdN4wmaDVDbUjMIvw3QqaTrlSYGAwDAfN78mdJwBiMSMqzd6bvABTh9LdBmaxNgUM N2nMDucrSX1+Dmqe7XJRd86xC5QN5pQw9+t1HT0VWSU8NoRIU3rWEd80eEGxrqUiL0Snir7dJsVA fYkIqw9UcslI9tEDTeZOYzZDDJ3nZIT8sIBp9A4rOaSkKlQda9zsSey7utNR1VEnREjHmDyiwiCe OUe34+ua0cUvQUzuzPacU2i6fSY16KAVZ5KHfDS1anvtw8Icu7Iu/ip7JBTEObKcIR3+2u5Xm7fK cg/URX746t2/lWfXi3pJ1/YPz9/+44AeXcWvHLai2UqL+vBc4oIfmp25IVAzNl+AU0A8+mB/RbYF aFdgveU37Qp9g4ZK9keQfmb3hlRNbd1mPpZ5dIMFY1DCcnaMdcgFdXyeM5MJ8n7h6WHMZIIH5Qyg eYzwtj5+nIaKAiQBH8wB6iI0NQB1Wt2CSjvyw4XoAlQ3TFau8itWf9BZ/9u2fb9daTmUXqbfY3zs ocyVOdLbdkOcXZ1icHnuCJzmcox/DKsTfJjg3PKx8mP8lOOSRnMiDZwaqejkZrzarmsYK4pWsCg3 uBxQyanrmlnCCb8E60WUujBea7TQA7k3PunWMxfdHHSYnC+YPMMJSGvqIZFAadtrr7+w12wCcI+h Mv8ANxtzzkwv/DDGq9tzCuPmShKESvnArHK4r8kxXtaG78B2haiu+J6MPTaFTpFwIY/unYptABlp jsXD184y/yvIFdPNlHYB7BJ2EZ5vr1ade6B/UiWyogOxdR+GtFHxV6mM7FlM3tXsWQw5vLzwDzsf D0t0wC69MUH6IBgQL0KHsydAG9xpRxQ6hiFmVBFtKe94uzLV18MUNXqdyE6lhCsjRjchFihOzNJN f8LjUdh8tAGuVouIOwlUQTU2HAd1IxXtvTKGR0GaYxMpfOQ0nz1Sxq/mv2MOszosLUhKOSrcCqUy ks+2yYZj9CbJZBx4JjHT+bxFb4YhgoaI9upi3W4RSx8/ghSKX8DD/Wx7Qc6ArCnChLGr5+Dw0B40 gBg0ozCInRGwIYQn6zjxqjtStlrd5vhAlwOfW3MNPT6AmVSBOcHK5vhgZuZqUxduYu25RBUU001x 0Xys5Z2MGKeE1OOxs5srgh0MaUwyfOkI0gIkwBSgHDFUvbSh2ewn9ch/TQTStGPfmFnJ4/N6BUy9 AD9ssK6biLOtdbv1BJN0zNoQMwYqtQCmFnUmeGK/RiQkHAvDyvB46WFou4QnRsGY+fND+vXz8c8f Pjzou07Yen/39PXLFy9/fVSkG8BIFH4j/zGjqTwwHIL89edbjDdTyphKGGoNYZJnt+PiXVfvrguC izmBx47vi/+ovKcLS4JG7AysiixRhNzEa660ctFf8+H/5rYzOx/cf4ZMp+JjPUbiq6pyFC2i++I6 oAnT5z42JZF5jNbswzA9QQVEdnpfMV0zfpitMtainrWLcLqY6TwafPj63X8vy/bh12//v7/9b352 rwAXWQhb+GYDEaOL/zwuflVvLsGF/Bcdfhqf0d//6eIKIm6aJfpyPACsBPblPYTeI4uCM0X8zilI NWNHgNYL7J822PQhPEHhbWLWUwOCKrA93iGbgXZmeEZiJRY3JaN9ABiQPwV5lwuxSXlXXDYXl4tb F7ruI7j1m3PEsLcO/pUC3XZFvoLEcDsCdpg3HRllGbrttmeHnAhDBKEN3j74mQSkd3jz5tpregGn Wsx1vMN3mwuomMCLzN3cmwIYDxJJx7ZsiDUHSAoFHGpinkgdIOxl/D1+yiNHx/D1UDN0pBPg/aXp AVZrOzGlNyzuAmK08XHIB445TiYyqUPtQ08VlO58KNG7wwgP64vuuHxofoId7LH5GpwZ5XQpHYCB ndUwMVf1fK+GDw/R3NueXsCKjfjUbjfcnp2QrxtGOiqvyyrsAgwa5VACF0Fdk5kbfvI3XYI12NRL 7hMjPHPX8B/onAQ1hZ9jdBzA7V3e70qzRU2FCOo8lsmqgtwzsAgGUxugIt4nfNWj1XeUtdqeLZqZ IGfYPeEvenF4iEYOwMn4vWLVApLWOdqLxBttXDz11UNCrtOz1mwQMxvXHb/16dWo2LQW6H3b0aPf ql1tF1oxAKWYSlEVTeJHxyFuduxetMxcxnXxpKv2m+XH9j11AS1i1vwoCwtGxK0AtdQMIHAGcCQy ZaIuyiNXNw4nmLTDPL+1OJ6KqefZbbgSbGmMcSr1MNaE+4YYJ53T0dNEATrKjDW6zykHN4D2b0r9 SWxS7VxmHmtAyNleXG4SXYK5rq+Aqp0xwLTzKxBmaMcvmwiG/rQ4n5J2FtVeNZjRQi8Qf609x/3U 8Y4msXC+H4E5rBxTi20RBmPqbkCJeIuKKnzp9ogCd7wlGygeECoUVqtJdkK8jKjZIDMKvJjyNMkK vLVtC+nq8FVdvSB/pDPqG+If4a2NDTFKlLMnG3MOl6CbLkkSnIBadlOaafIGwsJ5z1DGxW/aa/AF H2FvL3CCHYbqbGvau2p+mIolVLj6NIYRHF/MRTAXzcjV9FbZc9HaskWCnfhkP+3U/saw1a/xaMVH rdfT66/cwRMngvul/9VZWXDVX7EFlZcN1s79IQPxDdvMYGAQfsfPpRCF41EzTU8NUfM8b7hc6y3Q /dgfJHAf0otiP90AesaOM5oafrGpjTTuWIFTwLTYQ/VowiNBbwxDCHCeYQTpEVS+5ywa0up0GF/Y j9uNmxOxXnM0Su8x0JhZcjDGJwAuWQFQ5yhpDxmRmblmXq/JJkUF5AWTOyNGmm05fLro0F6EBaTk XOXncg32l4vbgWqJz0mz6MzYUZcBVAPdB08tNhK09GBZddMNuk3DDydcHeGIxX0fV4gUFkOFPRk/ Ls1XwzYIzpA8H32aEoQn72wJP1obFUkQvih/e3MRlk6uumTqmVOVJSJRSQs9QkviIfLXq5fPJ69e T7559fq5/fTt2xevXj79rfz97dPXb56/tm09/+bpi5dfuQ9v3n377evnb97I33///PUrVeXpwHoc zdrVLaz1BH44NyT81FrQ2jXCBE7WGnwNvyhgW9hA1+vpCr/LHwz5dlFvMHo7Z5U/IedgYN9ounoz 4CcXmCH15nKP9Z7oR/iL4sn4z3woMgDc3+iLEskJ5kiZ1Sb3z0VhD33BnNyRNzV2Ahp23XDYDZne uAz04q+HgMghnzgK58ZG1QxBxQKmC3B9RwgT9ify0DYJSBsetm3+KkgfQ33DAH4TK0wFWBhz2jAF sIkY4AOKvcwgCfDmx13ifPLqhI+B5QRzAmAnHOJhGk4monkOBkK2wAiOj+Wv4+NyMJANAEm/LAea oOHTg3Kgdg18eVgOaJPAH0/H43E5sNsEPuGXybuXr58/e/Xrly/+/vlXk6evf/1m8vTtW0yfbJdg kn+xbH6oUYjoSsApPO77n0l/tyGCFItqQswRuL5d5dljwMUT+U27mIcQ0IZtPj3rwOpvowUwgk8U V74J4gJNJixdgLAmn0T0p8VyJpJ0AglfP3Kk8QzqRxR1BEGkJwT100xlZVtxNwA8XaxtuJGcGzzv zsC4HrvMaHu2BDOrCQZWQjdduBy3WESch1lmt+EWrE2t9f9SnhE03vDtHyReCdIEvyl9LFCPXsQ4 kUdz0d7ojRKQFehaFceT4hpEi4kBHiBmmB8uLfnqDdVSkKk9Ki4hNtm6lMA58nQf7eGS4jNhRjsT Ziea/+8CPXHdXqh11ZtgQgU4mJgW9V2WBR6mEVfVr6inmpNTYTAEijshVbXCk4wNDlFtTcYLUT60 Q4vtU7pcfmXywD3KVA0cK9rQ5svXTrqE0z+Rh7e5JxtEe9xJaXhZYWd5U6mvdCNELpE6UZQVyqA5 f2XkOxezHWW3hgFEYVa0qCaynxHyxuguCsXYB5gUS8Re8MqGV2esJRBVsxJfaotqJPtYz23au0h8 bkBRvjFlzR0ZWjl+ksh0Nb2ZwHRMRDty/OTPEtkQCEWMFZWLgNivGzqxFwXMq09R/JC2fUo74WH+ Y1CdDCfKnq989uq37755+aY8Tbq/DcUCZVT8LVAn/q7y1f/lo0H8+fC4eDIILEdgfkEpZ/4JUsIp xk77n4IS0XyD+234LSgjHaaJDb3QyLSNu2JyPQoyyLt9+J1u2NihRb28wBYehbWDscGkIzwKa+/y hv5mcxkkikynwpK6urApc7feEOMwfdrMLlHrbA6nsUDTr8vvuodl2NSiXV5MMDp0vtgS/h8UZQHz uP9/nIuHWVCM7Lndp3qr71cXBYjDKtIOiMEiPjzO0FdyaR8CjoVrxzCefds53NkOO88mS39p6GUE mLNzusmDKg6VlPh298gIjqneHtreshQn1GQ5uwfnEUTxOHfKHYByBMPayxpBwUNLahdNxZ4Qx654 nI2qI927ngGbgdsxOfhXnAWPcZKCvEEwdiTs8XBd7I3nil9IaHLh9ZS3SWDMpzubNRqLBy9rHDgq gyxjY2u5vPB5gqZBfgwvw91BZKcIlVYEw2HHHcCgkw/i6J+QHefCNEyWSipnbxun1WebDd4lyouF VkJsdtoN2plaT01iBWC+WF+tNrdJ5yAZV8IrgaXKMmxuOp+zvouIK9Hesl0eJtv0qJIHb++GGHIm kSE9O9EhEk6XnyEq7/ZGef9Bd787+m6JorNfDNCERl6v9rGZVXVH04fkqybsEJhFM11AxCh4Zxh5 kztdzq1yMWW+R8RojovScpWRW1XTe5NyqmV0UJwrPxlHtlnGy/0kcpZLyVAV3HlGcfI3JNgisCwO br9TyelOIF6cdIf7L4tylJRyhvrk7RMIkiN2tYdiiJtDmhrFLEeGk+4jWih5AsYGrx96ZLtWw8Xq ClYpOAook885oD0YAmjqxGPU/PTDQpFWL7FDdULOMcAjsrHgEJMi/gT+OQ26gjcf7gv+HrlHGTTd 6tD96Ly5SUSwomtT0NfoWg2HXH/Vew9EqsFjwhuHfZLiuHnYkN9b+jbGwyTqc3jGNnAFNNc1eMll h5ZB4P83cWmWKLifLC67DD47dnXC+e9XNeSun0aHabc9ozSnzgDt5ESEgInN0A2j8SfaFo4StG9r qaLzjmwt6Qo7vWmutlfI8Qq6EmTG6C4MpswQrZL55MYDW3UoOLF5Em3xuMqHSVkzRU2J6wv0JpN6 l2CwXi+r3JGN08TPVaBX3pvip8wQT+jHaYbsO4/u9ZGCmjVLNpyeYB3eJmIC2HG8cCroXA7V+99e h8tgD3GXxb74NqjZfuD7FElUXiXx/W9syH2Ilz48xxerKlUaXxhBB7SCvGUFUbPMv6GeDWUFd+I7 wdj6ncExyorASEtXii2+B2QSCcpkFLARe3ypL1sAnCWna46xhAV93ucJKZrP7nUq+CyWvqW1N5xm 7tvDEus8KkoPQUIfKNbFbmSDDGYPnrgpSuZTx4iWoDgdgkbm2OlowqaXrTUAQvA9ZwBE2rjpx2mz oJcj2/o/AoKYp+mpF7p3L1u2nUMwltTWk56W97F/FZpo7dNd11ffWinq7Gy6mKENFLXV09NwudqL O3aMYYsBiEv1jwJUuQ76Dks2m/ccgB1QY4oS9+Bq/qlPDclmSbud2c7IyShsMHJiS949gk6HlUTx NhuA8dkaGYNWIQDV4FHCTT8pXHQTfz3VWSRERfmHbo4f6v7JTq7SBClvFyedO6tPUHnsNXOKl8vT aHj4bI0ul1ghOSihL38J1lhtAaw4iBl9s7HaS63LPNx9yoNDl5ErmCWZccJf2DKgsrmaAzmPVwLO A9kKYIAHfV+hf3us1RBvq8m6vqhv4GxYl98Nxw9++V318PffncCPU/PjzcNykCCv7NKkF4MpKiy1 cxGlNXELAw0nSLRTQFt1nR+5LqXb3Vnedi4BUkfKQEtHtj8IEWwb3lnO9gPL2QZTC8kIq/issGZX IrjYdwnXWoq6iak4JDT4I71D+rqj/4fFYqakk/Op3jGZ17LoykC6BIMEReKHARzxbtaUqIxGnK8s lDW6oz4pw1b+sHjMWxAKhTuwT5jGiRXGKfptRwuQXFU7a8jP/SfOgxSRnuGwdk/yw2M1CQ8zdfPE 9a/Zp83JJ1Bad/LoFE1f6OeJmp2j9JRaV9mlhMP2NyV2oiWwpst2vRmx/TihRimniVDqSh3mMZNH EaT4xXHxaPwXf1482ElpVmlpJtBkH+ZqfBiiiKpeWFa2Yy4Jso2ZDJ6d4F1rS4ccp9pBAmZkcl1n viWsUWrK0AGKejbzJ3U6aqq/07u5ELJPrH0H0YCcYBrbgsocHMIacyK110RwdxDMgnVXy55BIKCT z52iag4G+02evzTZzV/THu568GP3OHN6yCQiuOonozR/ZWFD5dgCKuMpO8pcaWHASqPmsu3YXedd hpjFIS/hi2WZsNC53+ElHx4aqATf4xK3X0/A9hUrVt7SgeFRWUguseZXM2MLkgYmCoFP2WzNjJhK Oxc8+FPaQ7HXsylEQJvOuUPLmSxtcXV7WEmgBh8cs9iPAFbxZki+uROvF4brJw0mnJVE4kWoNQNd bvfB3wAooWPuDvHbVCeq/E2uO8HCR6aiU5AIU8WPstKMuzPuXy5aKNCVZe+G6o2PmgB0dHAq7JWd aEJQHYpr3i8mcSaaiVOQM8ripMwW6efGiQpNfT3VSWZagaI8LT/hDPgsYx5+3jEP9x9zVWZJrIEh rcExYihk/hh87efV0c7qG6z896XmbxyMGV8jlLsaKAZC1Z+cWoFhZTNSdG9jPQ6drjjU4GxXCG9Q Oys4UitdTSGkMbFahI8Jn8OvwH/q94aNQbgChH+lh4u4vkFaTSOPM+nHJDtGEYd9cyIfTBYmFKH4 GgpK8/syJxlQVgBmb1K6nrA6lA33r5JEyWCq2AOYFnV9UaSUuNiy0xzuVGGtiMX7uiIwCpU3BK4H wBSqjNSF6hnQqBHzQii1hhQ57RbMYhLih109y1b7+SkrpPGmgZzGqqZPDh/Tt9Myv1d4mJj/8ZEp kRqKvLtwx9gaO/cAE9EVXfAya0ZeuuvO3F+miAlH3p40SSuZiLP1dPa+3nR7nInewtpDOlhvQPpP rxm0+0p8VwUoczN9DxgGDCDJ/KJJrMg99JTDyxd4MQdKOX93Luk111y2jgY9S8Oexl7/9+k79Lm7 U6fBvcD1HP+8w51A7FGP9c4YG2bloXCEr9lunfI7jWuudsxSQRM19GZqpFtJ7tMrWNsGoBbb985r WXYvgmewzAFz43bzICOn8OhtITR/po3DqKp77GoZ1cn97hQGhY9YP/nOvMe8tkALLIscsKwh3hSA NbBAPohOaPEHIlbt3IECvE7bgZPmCE/nE3dWn+p+4IVmygbewg/RxA+PS7RVVZ6LYMuhtez4QIyd gx+ib6NFhQ9OgXPqDX+2gNiQ5jYQnLlX280W3YSN+L7YdoAsEdw92hXqv9blyXcnQyXDof8/J5xW KoH7DMpgeDRdl+D0UNBOrw3Rr8vvHpds0ZIvVIirBLazbymzVx7YzQKNYekKiu8u/N1wePIPvz99 UH1Xlf0Nwj/8zuvNMl8j0bnbZAmvl/gtukb2WvnIu1qJLkIm+Sh6DOH+ZN/dfuzDSaAS6c0r/ijE 8ZrFgkZHhkWuA1Y9QA/k8ESeuV3n7HTuOfcmGzYLmRINSazyCEdiMT2rF565gGcp3yxzBh6me0/6 jTwyBviV31p61tPm+dwJKeL39jBjc108CcuDZRyaJ/cbHMXPjveKy9YwxsXqr/nmBdwX/Fcswguw ZgB0WTqbyEH6qIjNLDbbVWQZpw05vd6nHi3tuMgolFQ1plY9AFQg26PJ9F0NBQ07veGsAMH6ug1Z L4rVoHjwGkYdsl6iTxoeb4I7DvbwQVcUMtyEUw4Jm57DxT3Ui/ZMxRI4h7eCCTiun2zNegbhb47E PRfhBpqagTfUaepZ4tqrrteV08BKgnyWwTAaL5ZwMLoKR0jwpINszx1kQcZmMDYrmjCXphmsb1aG 6sgmKaUcwhKiIGWkVzCVYBWrrXCkWEs1yApCesqHeo5p7VxroNCrIuMJhpvR+R4fne64bnttegtJ jfJblFqDds1chfmJyPwK/8lh+y9ZtdAuAzMVx3l4nccmbwd5yRzrqGeaID1JFWgnQ0HpDq12l6XT hhEsDOFc14vF4LOaYXr9S3DxtAWmFUIEiTc0GPGOaGV6Ro/nuXPYs/zMms7uqYVg0K2RJXD+MLHO AUldxPBxMhQcFx70cDCl8Bp8xnsxXy9HqRvxfrdhWmN+R0nOXLWrx/vdhvVNeJS9B+cAxu9y//3R d1+HsTVx3vF3MM8KWNE+t+dgkuU1yDpmR3sjJli9KezgJF/SwJzT8o/uFmHCL+DzPE6bXbb4oJSt jDLAgHEjQOgD+kQ21vRbzTRXeJruUflP97s/wKyWI54iVX8ftKetIZihlG/b0IgIC1Nl80Mi5I+K mkR1jgrMXmUdpRhCYze9c35bbwX2ArYrISOlvib4pvjZ70MV8IQq9LCbKYb1DHJMJ2mx6RaRNoZq W3NYTV2WhQkWSK5G0ercpU4NKNJTbwH/Nx6PT6MGnuzqtIMnyc+Erf6utVtok1zdCHfSWwWhpfT0 Darom9WQiolkcKPjIsMOn7j3Jt1+ldvhwvu4ripo36sjh1Zj94QWejPiA0auhi6jFsM0YcWiUZHV aWjgb8ThoVpidkHfOZZD78MRBFjQue/elgus4mpBwB1COSmrpBzgunfs/Rmjo9jh4DtTyZy6rHYx fzzuYGlHzmgXjgE+AVibCA3bOk9Po6uFnw7I1q7ytJAJZIO3AAaG52Ul5a+pTtFJVkLOEE1kxABt uWLu7Jz4CWHs674oxwDFtzPaV9IROroG+J0YJgjhtqkhTqzkSbQUuwp690OnSByRLkzPlr6HxtAI 5ONSiNLTKjiDRbUIY2P4z1A3pU9Bq/yLemS1fz9dz6D1YdAkOvHyQh2z/uIODlywKB1EsLfaj2Mx 2fIBdjSpZ8hWrmhOazAQZJoefLuh95eDq4HPAkqjoAEpVu+6JkReuMIq5ysIgeea+RcBWHM3igqd paxFLKoXtGqDlPmwhWgH4csOvJ64FYngBIc9y3THhVGLArCpZiathulfwqrsy3vUE4iebDfNveiP n0T6iBMql1e8HiPAr4fY9C9hivdkKuyDqJmK/5AkN+5SnmuzWksno8r09TpvKyWB6d+E5driRG4L I0/GP93b/aqwlnhyn1lG7aR1ADgXZPvFBY4KNwFdlXHJzKEEmu+kbyGLzafWOimXf+Dg1kh9hhGA hPIcdJqlxeimxv2y5lN0cRDg4pwehEsV5RcOUi5VokrUKfdPJg40mhrZFU+cXkHBRJWgKLp7fVBq EAtbekZCpkEBsZ4LtLmCa1wSXDm5FyKwN4db3HLoc7cG1s3K9zCoFJAjK6QILVDYhENUZ1BlZkhm j24vrgh4B5TQtOgRbjEjvjOeM0BJzqYITN9sduK22YIjaTTEpZAMAruYJ0q/nDDVY6lYd8FMQwzu KOgxfotJFYR1WDRcSfrdlTsvtFDAztT9oddQ1cEOT1TmqWnkkZzzHeuh7hAGvdaO45HGJ5mL1L2T MM09hs1bJA7A1AtroexfpoicaQNT4u0kZlzmA6Oj5wBQbW/pMSEEPnU9fRFR7GV7rbua6CgetN8S 3C5DVPMu4l4JbjUci1uOQmD2YoBfbioB1M66o61R691D8eHqes4hHKCEe/SwZILTC/7VYOwCQT+l gzaCCVmmuyFg+IbifX173a61ZSvbHsm0Omh1eiJadASKj6aaDonVwdTbQAE8E3/DLdjTRBnYHhbB SYgRDCSErhf1gE0JJaOPJo/b2YYFMcvdzprpxgVYbiRow1i3jWyb4ww4gUgBzMJcXBoyIfmGoiXw kg71i8UhBVSxdW2vzgCz/DwM/GCnGAPNSH8Hge8ABISdj4tf3VrUelxYu9QYE+qstlnJWIEpIhHp WfKzwaapuniFOLksKzbL2WI7TyiID4uXxdDFgalctNqXajBDinPNIXymuHpVoq7yl6Wr4Id63QKp 6oF1qUIPEoWQvj+hAw9VXXqr3KWqlxYHH99tm/NzI+cCTPBZvbmu66WONsDRuCHUzmM6M6ebADaT Q4vYhbYbO710Iwoy4o5Z+R+3MuI+S4QaPPr7q/R2BO52IWPKT6FCJLc8y7VWEHDRn9kYKQFoAKwP Q0uxiojmDx/0li2TYbAzaQLv1BMQwGxvvOo2HBzlLUcj4YtTIjSLEIJjJsz9VTwWVOS0I5UHiekc ookAcwK9I4VZKs8X7RR/AKDmor7BICNTf8MzxrnEQsC5mc7gIO3Cx20nOxYvzgs/JiD8TzqAMa46 4iPe8vLrGXJZiVeLjEqujR5jAh7fXgPDeHFuNa5+ixRLepqeRgxRfQabwk6inC7TlVnH1boJoxTD 6kCMDCVsCsFylB00AZXlnhqpTXgtcPmAlaIFTcj1rQkdEMR6a20wmDavAMRkurie3nYY9cqR9yai 7vA4bfAWDeEuTL+msPvOtws/mJKeqEFK7vI3Al7wmHIV8jIrtc4ErDyI9EJl5aKjTzjaQyiJiPUP dQ3CGrkDhthSDP1DrTvqwwpKOEfLgL1sVVgXaPkToJl90SCRAdpNfCZeGNOqPV83ucR0tE2POLP1 0tbKJQvRUXiFRAaMeJYpLMHbAggGlM0D+ek4mDU/Mwo8x4W9eNoEUWXgv34SHQnHNHFhdWIwwb/8 ZOS0BIAfVMlsyL6p+Ml2gx7bafMzKBSq8DInT8vec/sOcHmKPiNxYCwv9ScyiDhJNB98w9kLP1Io qag0zlf4eeNCx7jy/AQVfIbBh9940OrzaQR9z9D9AjhPt2sKDxyHFz7Vm5VCbDjorg6AhBVgPR0h I58AQ5qlAJ9GiHohWsF6TnfHybAc20Yq5O4c4aqs3J1z8gYCdvFd7qmoBv+VpXwmlgK2bRkzLlo5 5/Y8JHKnx78NitH8GIknqDkCviwe/TXUeNtui7Jf6VBeTj/WFjgY4ndCjdbNvOi2oOfuuKFdlUE4 t8J2ixgYxxsjed8JH6VnVEJZ1fOyk+CLf5+1CslMjEzD/TUFJF2tjFjAgeXu27qUOmoLhmaawAkO FuKGMFUP8rR83EfaGC86Jm2iavzvaBBTNP43rIioOQqnZmkZBbjUo/wx/zsaJIlYfowioeMY0WxT hpXH1jDoc7OpROgOe4BKFSFTegbT9UfnTIlF2ofv/CTyiCJgNRl/HCp+9DkoeF9q/GMTnBPEQqKD C4xoNsOJ/2OQn0xnjoz2p7MMIbkB/tR0RCQD7f00FOOtG07Hn8LCxeP9POumBvjHWbhERz/3yj1F W+t/FT7/tIRPsoDPSp8AJ7FLYJTbMzxwoBYRhTVRrljtI7U02i1/koILekUS5dQG8P2XIYNqQv9X IfSfSwiViDgYOHUM/xlmA9YpYeFE+7d5sTJEbt1P6MCiEff7VylXb5H/usXcf+n0rsXmT6P5Z+12 +cen9s9G1THZqgH9sxDsn+j1a1lfG6rbIvzDPjT3yAew7ScqW7kiLDDo/GnpygY37iGwniw9NOT6 /lOTUC+1JOnrJ6QRKjc2MtsyCrXBafVNs1GmvpO/pbjzP91Cc2D7vPz/eejgoANTKHBJWk+vyk6a FUMXEFBh6AcxrXgz8CdNLt5DkgzwWIb62anJtaAb1BcByZG0LHTFmfTCCnTkRs6CT2DOy7KK845t NC6uLk3hYlXoynkBaLSuY3tGJm5dcg/IKUtC+bddvZ23yYwZq1B6y8L1C5yVCMqD9RFBJ8apBpk2 w1ocrQbkeXI6IjJ0fYj5zo/c3ZnYxLQUE5y8T9j0d5B5E7F8JzZuTSKkr+6ZpTv6M8iJrn6cfjVd +Zi+DMHC/nbOx03DGmTW9o8j1JAja/qGmRzfjxSwYVtSZR7hP3hAD9oeXpSRRQgsXAw/gTV3aA0e RJczPIbKk38lFCqrNLuhfCeU59RH64tow8YuV2A2aDsJTiW45Q7FDkybV5JnfuTPgQ/d8CJNfUhG s+JhAL4o5a9SmABTP2BhiusohpJwSQwoUq4ZXvWpYSOED1n6Cq5UsxFLKEMdAZO1PdT7Z2gXu38n ad/aro48VfmrbxYR+J/GLgvJ4f9EApYY8FMRgPlUFlLKzoXTHx95IEdA/Wq6yZrhHG8WZi8rQxKx 4keTmF6vn37hXnW68jvi0Jv8lYh8eYNVDxdUtXAa+vNK1PYUkJUqN1K+0MlGfGq/6i44Ltny/RKC C3AP768LJnZwQiDYQtNWlVBF+g4rRBemWh+pnkzZ2bVsXV+xwWq7Enx43iJ25vX8ksnB8rbYLtf1 rL1YNj+AcTaXZdgvsqk0C9Y6m91Nu9K4YRhYmwc4m4Lj1ayZg4XoFLfovLXmcFe+xRCRgk+UckeA fyY4dwwG43KpfeEDWrgsgagHEAGuzNjQIwu4w8m7l6+fP3v165cv/v75VxOAuZk8ffv2tR/6ld3F QxrOlK0sSo/rT5V2vAC/j51uF183ixoyuhDlbAf49RR8Cm7JJ1/8lc4bZQhrSjGTeSEuBWDnKTWi tt5kamYI7AkOImxyCCrgyKGBvDJ8vwsvyGPF3o15twVlWtnOa7KitdA982ZGY0CvEcREXqBbEJlc AkwnWNI+Zcve0LwSsfrYCpfNJiEkmqkRi5reQaBjMmZ1/TjbngNWi5h4QpMl+IJ2aD9nUs/NKCGH 13DQmM87djXc56UF03Jcrg2z4Y4lTRYnOHvHmDtIkfEcSwXZQ4YRjbTkgyMDc93pwtmyHhweoC1u V3S33bjbzP+pWY7a7eYP3knAME5GrjksIxdRMyCHbQadzkLpTLiNZhkjl5fXd63F9HIPFB/LrL0h I8/Ceb6/Bjbtmo09I6LHo5BRA4tu0WPEx78XG1+kdGQt0fEqK3qUAp5C+hKcKtfDkV+0H2apryLv LgYOVrEzn7jwZlv3xI8EsghUC7ySrCfhsbFZUq389uhDFYdu+/c7wf8dAtsayu2FoFAceleV9dkN PHeB9o2M+a116yyA1wEwXn95Ztcv5YDocZR7gx7dwqbF/g/dE6w/GDNRa+XZFUYCmy6azS16wFkH K7K9hR6LiMgeOOBaTv4PUAVWxrvUespN92NKiVuSNnRNXSu6yDp2JFcgFMOYsCaTy2l3OZkYiiBv XdeD+oNtH3dOLFPjsY7LDXwH/6KcupplvasaoC3MgWEEowrYyaOz1byvb+NKzEfHmybgOTqZqIc/ kvefib+IO8r3VnUoDI6kngOujeZ+YSYhkWzdT5N6PXkHO19Aty8N+Sy8eZL3umAQkaKgGkS28haS 81gPION3rNADg09+AT1Y1KK4PyPDe29MZIPvfQpvPkbuX9cXDWyU0Kh+4hJI2eIhaUJSLSAEkTk+ pZoTBpMN8yPfD22qWu0sU6LEXn5asQlb0cemlnvXAEbBtgJnVbZ3+XN4bLMVKPOmPWogRQEU1pYV exd0o49enfeoA5+eoLB6+9ujGDkY6JeqPQqx2hjKeZr/PYrS1anDGQ6Uej7sK0ornocYO3DJ7ihk w4A71tKcK03gP0JII5TJB7a3URjatY6/pmHTg4BClOTpNVRGf58FEQc8MHZKS9UtoQsmNnSBl9mD iidImUz/bXLYLwsxD27VNQl6y+KABnWAcTW6YtEgUuyyvjDn7kdxcg6VUZw6oVTBteLwA+AEaUTF 4br8h8Pv5g//j9/DPw++G8NvH5VYutESTIePUOwiZOKdHsN+YO+kdVUR9QM9HskHldxjuxY0cHDd Bxc/w3vZfbWeN5vQ2wgO+WhgQaDuAbWWlKwo6TWxX4IX0DA6PaXgZLVbhY5v5uK3rNZhMFzvbk3n OmWzSiXH/bX+IKjtn/5QRTWcYBOgUKRG1JlvS4P6uK972p4hp1x0HTzxKjlF5bRfUdU338nZt2Kt c82eQUgU8ADfuRaZlTHzaLdUXtT0t954u5pDrDFR5UZA3F3tdjFuHqR4q8G39y+Y6tXCV4mhrnFd f2zarcOD8hRhzuF8WV97uOJ+MECP3+Uhk7pNToBGsc1HVhIt/YkqrvzLLtxs8mQiFvbRj+7hMfk7 qig+IdhTOgywj10XinIe7drVBVIltTBFYttBp5z6dD7Xa+tJYf1l5W3I6rCYDNGYMkWNgqaC66ML Uq/H4zFdd455w5kPVbpAgDId/Nlfkb2tWcpftgqIiK7PwO3RYLWhuE3oVQ3msIA5IN/NouqKNhbX 3B0K06UPHTKyECquRS0B8ABd/B8W1CPhPQKEXxOSF8bSgGkH0ntMdLfGgGUQ4o1RorCGmG5x4KYA u1T37K7Y4hep3M7M5hpe0849hCc7uOB9jNqwZwVsRVdInGZDovLCGsABfd1A/KLruoRjmkl66Rzf o4mNtTmJfkjxfXpBdCSbG6JcyGxAbFv9DHdIWv9wU4OWTjxzZaFS889u1PIoimt1Gq6lsEefRcQL 6Wqhhk/t+KXMCbHKSKOYvn/2MrVsY9GdNf2KOdWoRqPEa2bw1sXCrRgE8LNmK7HT+GkzfNjkDTUR aIyhzl3tsnyXRyvu68H97gD0a14dQQctnGD01pq8eCCelY8agb7uPPXS7YG2SZ+AFj0Ux0h0Yrdv OWoYAsP90TMxtuads3J/HXYPX+9s+UH6aEOeP4sjKIUnD11Jdp4/FKnZ3AbkVeXXPcX6Lkry9o5/ RWpVCu/ndTR3i8pLbrav33DR51Ly16mC+97a7tRzPf/ZCGHrumsXH+luJHfgLjKmqWfvJ5KaioaF oV5a60bjhR70pC0ZQBjURwIqWFgZInY/OOG8vtHbBtHQbkNsrwaRYzzJ71MCZfRczU+8r6d2/6dM Cc4X0ws8nOOOxldPuXD+6M7bB5TMlXqM//piWAJnmznGHhfZNMDoHgWFHhBPOBMlULDTArRvT8b2 bpYQOXkH4ftESUViJoU7yNLkxMdZt9+9/SSRt1jLAvC2zWaho1XCnxwqPTJe8wLSJzhXtMwUFh3r RJhmv/KeB7/ZdAlre1WvLxz4wiHGeOOuoz/bFCDi7q/L/R7+4CVK9SgIlRV07kTlhE2kuBdNJcxO PYVbrDX4aszN1g+/us9E2pWKZjMOG8ThXd1ll+YWL9GdiILTzciJrUEd1loNbslUF+42cQi0nSm7 RCTZYElZjty5rDumlqS0+MRN7losdaxqGGUC/tpHDc7c/06TeGjhctH7S7gssLqO74tNRrN2UxxF FAiCaI8nO6LuuqmjLDBrfZMaHn56VXeHi71XvHz19vkR0luPeFFAGN3iAhHQaVWCO6teA5iSJUNy w9M9YmkB9CfbkFB0EXpzn561H+udeyUrhQSByrab+mYiAo8ltazMNMi6JNEEy593IwPsxU9IDGqU 4dojmKnuE4GhCz7emnvp983vV8Shgl7ZHqGWaOpbK/eJ2Zn7uFOSZQyBMSw2eDI5xLsQJNG7+Uqu rNpBDp4DnRVhHfmVRaHRenqH7iBlIuhgg0N7k6vp+n1KbYGWUW4w5wDJt6inABaLeiHPZAUB/CL8 sMDmmRC7KmHSOST3tDG0nQUgLpB+drUSBIESTc9uhUO+xbS4FYP64lm4bAMBNhTEEDOaGhspC/gi 8n0IyTNU0+y6B+qwxhzFFmAUW2v9GfUwwrlT72RQbtKXIS2ER9N8j6/2SsLHF6Z5CypFiieLEwlI ps5/P7SrV3K31yio/0Qm1IrEHhFPNpY3KUaYO+rBICjR6V/3FrWNhq+gCW9CDiR74UCFm9d37hAf 0SI4mFeZTuwVDIFkMyOpsjuJ7SEJrYoSuh4PDrl6+LegcCE+cRE4LLJfd/Fl8Th9U4oaerxvQz1k nBmgd6UGE0/Yps1yyqFnDw/P2/bwbLoui8Mvi9L8McE/kN8c3tDXm3KQ1GeSFwXBG/IzRqTVTLmI wHTFA0gF0Og2fibTdKKktvzPWz8ma+uvSIFg+iXHC4q3FC1ZldraUL5n5yL3hJmy55VjQvyYfpc7 WQ+Fq/GM+VFwWB6CScWkzN3H6RlyHh8Un3giJGO54ukQKXvZDM1WmXwatmpZTZPWViQKqZp6SWbd qi3kR9qNglmxNUhgHqrPKTGD5hAbobFJEH6YP6NyVVxaSm7G6uEm5EKVNPfK+4uIqtAzUozaq+4S +y06cGxvULm4xXHjU95RTLYZkk2OSs97oJMM1DxqDc6bJYnosn0oeoisgMP4b30DPcwRmmp8BsVc VKxH0xizCL9X9klgHz3ljrrscRG+zvrZwjDafdpjAiTSbRwN+vQB3uOdM7HqK2LvQkFDmlTCfVMr tyKvuElU06d2sovzApozl9UXrYamCPg1VoOot/Z0Ucbf3jTvF2MvIrtRkQiBmP0fXTTDcWrD8oT7 lcyQzMH9cFR9U830sddke2QF+ljctfFs96jHR/6VOmwk0vdxO9r+z7UzSNijBAIW6417ztee7Ynn UtB9tvyItJIqVsGyvUZo/PA+NpLRNBs/bIvWTYtSAhxnkf1sUtLJnnHEwzebcaB6t4eltQX33u0i q+q8Tbjr+YgVYWRErPVf9CV5XUQljeFQV02H8aziG+6ZYV9woERKWlsLCT1OqHCGcEEWxyCER5Wq /4kzLSyuhUevaFqqlGLhI7xXNEwMQNtwsh3mgbdOoa17ouRQr4PWAqdNLUhV6Nw9AuB3VHyz9jU0 vdV6u8iCFU0xi6sW7LVcbCGryI/XNGHb7hFzxhjetR+r7fY07VUFk1nyxreqpHy9o8Xpd+GBKvX1 FrzTs7Jzlu8jqITesme5cy/HP+4ZsK9/aW7W18XwHVEYX8YIwG93P/bn43fFQ0k3FTmsuMfLO4ZP mOgnerel7kIdzsZSmsjcJxIPKY5lCzqlUOge94qE5U4wpj8Nogz79NkI0fdgjrz0RkXqTGajy1fO Y29FToHpmHboeJ+MatfrFI2oI4lwaowbpUKUgoOrIYOPJ4+U5AoW+iCdols1/RSB1ZWcbjft4UVt hoX6C5SSLEFVfmw3676FNeoPpmPXAgcgvQPLUVW+XjULHg7E7D5vIRRSGG7Hiy2tZ8KcYkDgpjQ7 spj22i4XYGoFBpuMdoDxg2pVlwVZYis6U6cXJJhBlHBRAZoMXdBVuGCvX9r3zFT0zGld8UrNytjI ZlPXAVMODr+TPSuDvJ2KR+bL5PN509NWZNzI1OUFO6Z3uEW6huh+amp4k3bZb1mHkrgFH+Ibr8Ri egqyaHF4+cUhflFXjTuFNwLCy+EwIfn3oLr5InOchag3l7oDNY6pFyCuBqn7qybHY48Wd/h2HoNa MlFliqJynQtJogcX2zdUKFFnkGpf1hax0PUt1gdhS1vVNlcreL4yIvLSe6+C/8nHMfyIH80NtQAx H3AbByo6bhsiVTTg0WHmZwZsb+zZ8avqvoXXUPTLz+U48Iz40UyfTphj5bsn9HHw8oAs9w9y1UGs z3o6N79GxVfcP1PydzTwKoDr8q4o/gD7ryi9N5SE4sQjpB3exTFF7eFvHJNXjwWMdcwDk0KCOUFm reDTDKXh6Zl8WcEUI0213Xg13VyOz8waY0jjiXeOhm7GWCgGaduyGgz/9ZP4zDtm9rELEtFLDo+p 45BTBNmTp8hxmhcEHtfCio/tzh14PiqRHYtvMhVi1jkzBa6RbFyM8JoyQSirKnlBTBSPj9G4cLc9 Y8dXD0Qg8MsmKBwNhNjMTX3N5naYtPyU9xBfLxm43rLVOSldpL7IJBhnGvEZeP2dCAOqphq86Kbr W1VqSBHH65uV2Q/NxhK/YWpGoF2vAV3pYtGeqYmJdRpgkHKIlij5t1Mu5BAJTYke75Iou65ZPxJa 1wqmroRVscdFBxlYVW7pYXnp3qz424MnD1MR3Ny95lj8r3dDtOLRZcitI+Ahw0K0+GfBWTXtyQh5 TX/0AD8mB2gPlOwY3ZGze5hyKOmOZydjb8DaiN5J+NEmRyZvpKbhKxTkbJYiMKWsz9PWx1QgMK0N n/nURDO0GAT4jFVGez7xkWTXdXs8qqd9VuXvaj+vxm8NE9rcWuCd/fxsf0S4RoSmDAIi4hmXiNwo skOYlKbYMjjJEhEeA2Wxny585LPHZbyDA7SAA32hgIHYSe+THaBhXO78yjvSWFcGddhl5WkSRCQi JJu4Y3TAK0N8DQAP2Wr8gzX0ZXEokCSRSORhfX4ZtkgdYUihgW9xp33lS43GaTiWg2uqvBtDiVpv ZUQJ5qMe0eWs/ERtPhlqqweqDmBItmesrfHkiOBGGJX3yJ1ep1LvW54gkjM2J1ty3VwfOFeuYi1y eXiQILJajsfL5SuCOMyzhRjt3jerlZZx7iWUF8jCxQDyACs8OvgRYLgaWts9dqeAtZHnevJl0sNW joUqNhh2ZbKm3Om+4fLhWIdO7B/p3oy4BUNaSX9ghfabAfoek71UP+RtJ5rahLOomhrP34xL7uc3 qrBjEtphr6oUiHfOgc/Rbd48O+vn5A99p075Lgr3fT3ewBykTxWe269qUXrL58bimQP3wwqfZCwf eqAeUlaayYk5zRvQ/1E6lX2Ev8PZ7Y7vZ1pNb9VEosS/6wmuD3GCqlVG2y7YnAOqjczzcNuB5sEC IyQQb/ugbj8e5RCHFZiv5eCBTU4gJ5C5WSlWOVB7FdMpBDYPRq26u//Y7xFKg7rVIu7orblUXxVe +HQBdEgeIox04FQ4AZC11O+QaxCVlV48WK6JrgIYQU/yJ5t1yccK6zESnsDUgondHcig1IdLSBmL S58MH9MHvK120uW0C/GLVTVV1iI7DfiSby64d1m/4Aj/JdFW0zUMUzz0C40K0NhlXXTT7TpBgeIQ ieFVpCmJL2+bnqkKMZT8JQ/oaueS74NxkV/BzNIlBqCi4AaoGAlAcV/Il6s+m2ApGDFkHl3ezNYH +e58VP69WB0PPzH0HPh2wkILRFKG5L4DineVUCUs9i2c0iUGsxEZF2uDQ38UZp6F0ZnMk2Z53g6r k8enOXZuNsrQ/Ko8K/Isv07BqvvgCGgRj1C8nlMPkAECF5t7gCELQBePbqxpLXX27upjwYtp0hSv Ud0EKpvga2iAre67R8JLZq/VBJ84ASCzjwN2C9h2ZtO2s9l2jXefCJJFHjljp2vtDeoQq/fzJA3N u1RdgYFD5OLZjDi3O0jqpRkcvPQP8/VUGQtrHls4XH2l183FmPleTXYL6qZPjpq7l2kgctyRz7gC A3d6mhYwZOeBwJxNDM1WeCVberCJzewSTUuny6J8VTqmR36aXD1Q/5LAOEb6FDBlnkZlhMJGoMeY klZe5wB3ozLtpjfhcfgkFo8AtvcmMM9XW2TS0F0b/vG3TkA+Ls0nnrCuKrIiZvMBM5zzDRkJUCjg 5WHKCc2L1kCo8SFsfN9AxeLITGWVvmZ44wh7n5Ygdjb2tIyskhVsl2jMgE06RVnkhSmEMgcOSARJ mC6oS0PMLUtmeyiamVo22xUqvvT5KldItXjVIO9zR1UkRV6nVMBpgXeip7H3ZLqDWZI+aU6doxk2 vqvNV+WdCYQ/eqwCrjikPGng7c0s1gVBpZpVA+UMa158zqBJSHXJXZiS3fD1Ou3yY71G4H91kDKl KF9YoA2CMZi+rzvl7K/UK/VSnRCGHw8rP9HsOxHzoozeKyi04esnRu5N0QoGvUGHwh6B3izSdXhm Ahw3IxLRu2wXoo2nEMSazt3nWbCYgqlZzSpLOuYF1nNxGzrWmq5rVNBp122vyExtunGQBvCHQOCl rjL32JSKPJ2NzLLAOOEQENVs6QOW/Q8SXNCbExmAd/1JSfjpRc7OvTBG+9LiRITofNfoCuZIz14N E3Xl+pW/s1m9RbRudlEjzUX8ECr+gUhL6tMw6GO+nl6vH1SPqGojcoRtpFG5zOxcG1po5kQMsxoF UHttJloJ6hjW44sx22OmL6l5esnfxz2lqH8F0RWNiryDtHXbNMyKmZgnqKPdpQdU6bMr4DOAv27a c4cS+rFP8OiLhYkLBg6zNZJxxTkClm5oz2PRQc9ZmD51VLunCeemCIdVjDDgBhKeV6GLEnXyVttk OtMWPnQwcJA7AZI0cHhz+wPGPbL5O/OtOLwtDn9gjE4L8OqAYrxdBWBL9u3JvYB4nxPDp4EFgiQa 4l3CRQ/M+4LFst5Z12BGukW5JqQEemUK/aw8BVO/4GGuAeupszN3tOctZ3pzW0semxEDT6cHocV2 a37j5HfAAze0TrDSoWuZ/3hWdoI14d07EYMX6Dc1FR6t9aKQikgiEbf9hbWMKxZZI4c6N/0QKWZ5 sagP59Pu0l50QBhBOWTZZipSZyfPD2mRriC8XFxlV4RRmdTkUZ8202Yhvz33vjSg1k544cTNgyfu uHiEQ4xwJ/Igw9lNY12H3dkZctX88QMNhTwrhF3IitTghALlH3oU1FccAqoHnM0raq7XcFl9qQ3p 010wrI2B53qcvfqUvpEruFdvv7LXvlF6ZXa5fPucxZuEcF6yZfOXnRgQ4GLZgjNRxE/S8BV3E0p0 Z/fc6qYI+LDUN+ZvBgR3HO66Lj/WmWq6LSL+n29BtCUQzbnao39NWmL4sGjbVZqRL8L99zg/i92m RboKOHeWGDgQmZ6S00/cuqSQ3nfznhlx/31u8u1NxQh17fYs4K9GRERew1eLXB0h6QzuTpM/lh5/ NC36B6yREj7/AWvdXJ2zUUr/YnvjKHq0g3jzc0swUfuRKYW0reeiJego1lWoWSCp5uj0U4/9qJlq sGt/mS7bigc9uyuSvY6glkxPP9MWS2wvZ6BmY/axJgWD08CRrmxKaFHMxQG1u+HVTVXi0RQGATKd nvtyctfh/UePLYO1mByjunFT4QSOaVonE9/RkmJu60Ez2ikx4tS32lioPt8wJiZKa/O/5ltVBzEv fWjDe4gMwBc4ZdyilE53MtG669VSOxEE8oS+Wuqe+bdLf8E5KAxEh1neepNivplKuuYs0EXSNgON XqPgZvzN10n6oG/D9+136m6w6+2m7Ox253aGniFa2FCMH7eAaBbt+Xmsb1TqSCBeRBv+No7s4TTX sve0JexyjrjEuG/UVuzbGszGzIb4oVn5w3HDzjzoplgRT2DAiW1VMZPyMh73MMDcjtwxy5q2UIFo 7sj/CB7btOUCNhVqEzymFdZX7mRUaj5PjjCcvfrAEVbsHJ8O+q/MgR4b9pu/c8xIXllVx3QBJGho a3E7KkwD5jZnRg4myJ6pAUabRkJBANLkRY9u/kFQN7Vs5gI3yF0mROcTGEpNbyZRNqzJpAyTFfSZ /OWrO3QyAGlPdL9/cZwrGSnDZL5DbgW+gvVcHKqX4GOdeDaC77nxAgBTrIeI9Gr2fZDeqZbpWU4p NKjEl55wdBrpNPW8/PvjbI8TzhhuNiYQ5FEGtutESMmmpJjR+otgVkELqbW63EiiqkhtUcy3a1kn fVKy9WFq5tJD+1LPVY84amciWU0OlnzTLLf1XSXfHU0NUnpCnjp6sA8nBdPBsR9tzjEWkrkghafQ Rgl27XkiRBVdNK7hP8hDEnYeCfJjtc8ebIQmQCxVcmdRjpbjs4hVnGzwEL3Pp+c8V32OhcQkjcc5 mCraOxTudH++/UZ7VfmpgwLt4tQK+0gQyPzl7Bjou8kn7Od7yT1q6czedO3LZkgm3SC9IP4CS98C IxSvbbjRS7tKUGI0EK/lTdsW5/W1byDrEH85BNd4kOYPfd4/XHPWzcchnENXLe6NvHpi7z6DpWoa 4sZ/AOCtp1+S02wn99TX98Lnz4p6WdT4smVV3C+C573sFLFvyeV0jho05j6pufo0MzAbAyM/d5+C 6h88unzKi21G2yXR4zzaMZtgjoE2AeEBdgKuwR3OGOuqeKflvsMU9Zd3JIwewcFra1rtYRVtSBfn gTVtSHK7yDUwzcf5qHaBEjsbdTYmyZ6BsW0qs0EN15Swv4ysRz2TUQqzoUYtFqII3dBolQlo3H2r zwBhNmvKFQnKkHtdX2wX07V+lMIbF19Zr4qz6ey9IAUlrqieYZqKNpk3Zo3pNhhS/GxZxRCc1sQ2 N2FKt9kQws4m1AOnd1HSK1qu0bia+H5SayumEzSvTBXK1hZb757kle+yruiMw4EEsCtjIDZwizMn 3gZSu+EOe3+uyq4Ra5EmUv1k01obc/ywo75gHGrxqj3Hva/Vct/bnO5BLIGky543SzhXepeHZ3m2 aLt6WCWEUDRFf/Eq4/2+tzH6bqP0iHeJ2tEJad7mFEblT45jU9l1d5wqWH3rrcZJ2t8tUKz7yL0J DV4QNoZfL6zx4jnGv2k6FcQrZx+KkU6UutDpUr2U6PijRilKPAW28/Kne50OzolE4KyY4CAHgRYi XqKNJJpaU4NaJKUeZHymoCvkLgKmzBGtYBE4M+lxsp57z5JlFcNUSJwZv5S5FyL06c7SL59LDJmo AhcPJ1fDHwZpjyNd0X1nlTjsKhQtWZJYet4fTmLQk6Rs8Ch/xm1px6Ncbq8xiEd7rqEk6UE33B6g KcSkMTmwP/a8SjI6cG/DdLt3DMKM1B0Iw4tbCmdTL70wV/iGcXaLClZEpyYVq+8B4B4InNYxSa2m LVqxQNZo4BhZT5cX9RA1pOwfMSoejYrDx8HJwakT0vmKnwS6NAwyFsyCer7vpt5LqvX6cZqwA/O4 Qj8/CEQhu6X7grzDVMohhYplCfQC3XSSmyIic6gnxIvgXuERrDxhOY5JtrWRIEvdifyenK4ikFs9 MhQ4C2CCV6vNrVUmsWH+VT1dyqtZMvi5i2PO1SdBpUKQKrL8l7jrXtghEjSTHdin+f1C9eS7FWsy m07uuGLQKEASarUC+0/f2eMuwR4ChNp0gAdXd/IVIz61R+kVMAtPVwU2WnMRle4w/wtPjq4SFi53 me2z+hyM6CDh4PhATf6O6S6PS/+ydJQPARWZuLpSJIYPTW2j4nH1eWN47LW0Owy5ghXuGZYflXi6 RvnMsKKLS9TqyKsv7zdz2+q1PuRXUBXx0NsLEruPqjR3zXpt6t1MfX2DtiT2H829lPS1EenFwvlI L5DFjhJ0hF5FV2fNxbbddiG5es0lwnOJ2eYd4nboh94+YnOqdmo9OBUoqpreuClfskC3J8PkvAB8 wA8KdJqBN0EUY+0emd8qizgiTxaKRiS9d/UFiDlTsZi9aNu5dv/rWr0t5ZHX351oAZeY9phR6Ayj wPS8S7GUtG36PeVZBqcDGWlrN7NRcbbdQBYIxs2RtaY2HreqiMTGfbnhPSOEmZ52ymlc6jykmg6x qXBN94zbnTzD1Sn4SQG7e09oRqFDS2nSld1BLiiLXpacazjRgHK0gHXTFnXddnYZPgLfI+ZkIZ+K 4eYSGZ+p+6q5uNxQr70oidBRBxIWIYEQvkf6QA0QbISLkdyVi7Wu5fEIiOrOoQ/hKVfvSjjE5MXQ nGWD/Q3HM6EPqWDSbjxtM+6OZK9A1p1TxL6088nOw7nXVdSCd/az8KDpyBI8GfzrThJAOLljXN8O Fnfo9TWjsfscEoQ6ZfYQItLuJXj/YTVheKqEkqQ9TGdmGyNy/RLwqJeotRcNb5MGJYDNbo/8uEaO 14tAf4jETjGdVGWeDGS2tmnUP5buSOt5H4n9SW0XmaEuYNJb38nRk9NEmb69c/JEQwX9NOQMJ3qi 9/+MtBzPy74UnTTj/69/82KACbiTUwj6elPAWbsL/82Kotul02bqk+xIZNC8y6UGxGsXC6+SQADM KT5i7VIGGA8FBLjMGPn3Ci8jZ/WivR6JzR5wE3TMxU0CQA0+fo2AZpA3Il9QaxQxGYA65VC/FCtO rRQNDJdFszpEj3P0UevIcEhkLeavEYdDGK8sclioYy+Hhw+eHj6oSg/RCYf8Q71uCwxoXSeYMu4D HsmxU0nvbuyX/a2h69yu5nQg9N1Nnjw9PE22ia/Uezap1ea7B5ltEgyCnAraugWud7b/+vk3T1+8 /Or5612tnxw+fZUfrn1hIkskQ09nt5/eqW+fvn6zu0cwH+lOEUCBjmcDKoOLet31cJpUA/c7oCqw Fjh8wPd0QKN5QJmrSNtE5v6x4/YI0Ft8JIU7omiGvfP+ViGWH5QxdOq+ZblommmG3MaaOai6dqFI cjJGz+LnRURA3w8r0mfEDG+RfUf02DEa4ZvWbs0SgRLQyH1EY+wFgpix4EXrAwe5pSHSZPHshMqO 3OY57cPcOiELwC4wtsBbOVjnQpOJS5pCC4bXnPkWkFUsjIE5IeplEiU6UlmTrOkNJMta9yNG+B9h cxyraJ3dPrYTQbEU7ocPW4gFdqAVSqU5fEL8q8pAylPE52QB70CumdiPywdlAX7cSi0xco54aKS1 bCWI2SG8gwc4naMQ9oS1Icg6mEQJYmVzOV36EjwyyuE+C6wPM8gQDD+LBVvlwTE9wMr049Ue67uD MJQpwqcuViDDFPYmktlTnN+HELFqRc1UUKkYTzcwBVLhyLbKcoRRzxh30XEOduouc2N5lnqotn5i 5ugU8BIbt3YZkV9IaRkZQkZzkt2W9KD5MWCMHi90bLqnr8DPsb8CBgGP1GvFj5LdTkkZn97nO6yH HxlJSSwUUweEJeokk6ihUM9wJ95An6fbNgeWPboLv8xftXC1jDzoby7OQh8TB3v2XFfcCSZrAu6O ykIMQ+veThAun2MJ8bLDX94fVXhiTmZmIcAkZ2hrrjKI0PfXwgWlTHknKxJ4LbFtJBDNcO5oURNw ZlA0DxFrNb+2hdyDl3Tvrcn4nCyJOP5gHQLRBoiqtkSMTmsaFkhYb+bLCRoZTyYlWi97qYGXMk0z WLfFNnGfbqyjRmno3EVwBT1f1+4a+dAWH6my1U84fsAVWNIbwv2Ot2SMJ7Cb0DiIi6KBT9yskT5E cwJ/v9KxcxQTttTtwuw6i+7ZZYvAnEMQjFf1DG0Xq4QwLhmVIELRwLBmFtL9vEeJV1CWLN0T7NV0 NYSlGQWFdy0PZYPFKYbmN8RURcyx+2ylttmuPoFqd8UygiCXhxwEY2/Afbt4HDPDBeNQq7V/LJFd kT08V5ZRrxHWDleO6MUsE/5jEI4QP995gPrJ1YtJ+MccsYe8b6PbZLqyqW/IqnbsRcLRJoHaHdyh qMHOMfeR9aGZNHNXET+chHNSCL+sv3aZcDSkxZ50tXb1ZsxkjNxT9YSKwTF5RZJRfuKCVlz0Swcg zZkKwNVS+utNYBCBMjf/lC1YPoFLRqcX5A5UvJietR/rTyVuVqCE9J2L/9oT+7V8ixgvulbmKH6Y V1BkbbwAsWUQWKw3Xqy5GC/a5YX5A3zwwCh1Pg5Ck6VCtv5YzuQWh7t9d3YStJSO05KKOjrEmMo2 /mk/d9e83UbO3oOzuyAiUEjxpRE6t4QAs+YsRTeVdCgpcmBB2avbzDW2HIMhYxsc/mqoxsztVtSo mjwqYVnxH7dTtJKZPukdlOnWJ24mr/4/wb20a9pkZuKZSxQaSTS07NJyeqRcyi95YtmNbB5Rxfh6 3QAYP9Wf21789flNs3tL2YECgBUPzxxjm213/MgOdN8hpqbZzpUal1sYvvRA09iomnn2+9ETrrpw cHDAHo7ckSK69H0L/QCVlx/CrlnO2rUhIYo8j75DnGIoj/rnqRChd93YVfvivLhtty6ULsPJkskT ckG07OL3GJDQmWHCs4jayZReN6gMQfgwcECM3GjGeshhiGnH/5KzS0c0zO6TEV7luyOaVnhD/m6J AvvQcms3zdXgw2/e/ZvV7RiCgQMGcnPx4cXbF//uZz8zfSjOTCeXRoKazouugSdfbbhqChx2m9sF ORqaeRs+q4rX7RLQR86ny2U3u7xq5ptR8Zt2Adv5b9b1+3oBc/PNi7cF+CAsu3o+gLFOZFtOJmZb HDwaPzEi0ccnBwOTYqRI/HpSvlg2z7CHcLdBhoGXDHhlePbqm2+ev3z77DdPX7+BGu79tSlLIe1c xuFzmWmmLtz1HAWdyQ+ifo8w9teypWuLI0RbfLyzULB6Jh3j46nYIJhARUwS/fAT6UJm/qtYFNx1 udn4mD4wi34fA3gdFPeHtuWRbuvh45GtvZIpekNi4e/WYN+wHhLyQH6OiEw4ZOqR32lKIygG88NP ZEUC/OPGBP1qz3UU1rT8QRWOVfYxqQCUIz7UB0oyqux9feuiHZMem+/rx2Ya+5uRWrgNrEoK87+u bj/OE82YqcDw7ys7aaaG/hZZNu9ObLOnJ6aQdjbEmBTx8nNJER6D+sKh6Ngrav79/u09+VDMu1NJ 8NwOT+4h9wIzHlPxoJnbpl7MA5qAmesS11tXu0nKVUMEfoIzOBASt7xjJ3XTlplPN9PwLNR7GdR4 8LMSJdCygbhG+tyEKjJSnzhS2xr3iE+9ad/XyyA01hDjtJwHmpysf+955M8b69yTzcBQtKs1wHtr fRuH8Wy36ygEDSYJLVKSt6LCNS2h0BKS0gtMgrA/kXwlNJ8VsVh1DofsUNoowfKZC16aQ43ir4F2 oEzG6aXxnHhdO425tbUjuuoR+XSfl/6sHOU9osMBzLdgqAb6XKns/rq873ZZlXkOVswFf5z6i5R/ v7TjWmYq+qTOY5XYc1rtvbt9IksQPrFQU7SD06c3yVtKGlAHpHd0By6BqlKJaNTnHeqYsffArUld wAxc1KRU5aJ5J17kb0jIj4Wk61WAE7GsrxOhIxSRehpm4VQ7nTcFmjWzaaGeKtUVzjeITEN7u5Pd SJAbSt6B9thNkxcHCpcpmpO1w+PorpNAIkYi7Pc9AU2b9s/CHRaEZ4G6dId5UKamH8VeyfYsMSUI unUsQ4co5+k8E6IA/Mn0Cr9PDp8k0InBAkHK9Mdz+KQxZNuDjqXb4S6XcFe634Fp3NCWYLreQQ44 2qPDx6fFwwLPy1EcGDftc4yb2TEZu6X1O9PZYrp8jwmez0nTgT1OvdxYhhAwEGQ15j500HPicx74 Z7yWMOMBnUFi1g9p5LO6e9F2b0jKBEcBiOB2UoZVGXHFdSJ6vJ8Bs9Q3vHgN9RjI3WVWmebi8eju wGKZ/hycHmT9uzDfY1jWUexy4E2BDGIctngvZYAjcwp9bDqODHy0WwjUwpE33JR3D4/14OgAJjDP MOlkdM+/wXTxU7FLvwN0ULa/plPJ/u7R2D58AekVJAyzk3Fb5OKsynJxJxOrl2Td8S7yiMEjhPRN 1zs6w5uG1Qt4gije5IZewaoKN5kplj04FFGbbDa4jX9rDs/0Pe7PCWMNbIhzD/tkuSo0Sfib+jax 8FyjGN71XLQDFYIcrxqeKy140zaQ5oekVgjaDzQlqsXd1/Tk7Vj1hu7IVleTuSjv1wPxQLWzArBU R4lA7dGcDAZ4Ac8dLDPZxgsm75MjRnSSNQ+Z9eDDf373P4KCcdbOzaZAUv7wN2/f/dXPfoYPhpPJ +daUrCcTeZO4qJcgFoO5Cn/pbu1PMyjY4yO6GDY/1JKwuh1gfWRsxh+/aefbRQ1GLoPZ6tZ04WpF qnf+NRhY2uUSkymbpFHnQPzhlG9vn309efXyt/9l8vTNW3BagX8nX//26a8HAoeFGRX12hwWfnpC 8hS5wYr6DefEV0yA9tWIgFdX2w3CKVFicdkuEMh5WtBEFjCppqtT9DcfaZh9ABW4NeQA+KP04NZs xgOtXZbpQIAUfHx8lFOKPMAolebfB++v0UfgKFZkdkwaAaTbHKabSiEDK6VL5sBCPYKjSrJX93PT xygvIidMkR7w33QkdEhJoEGbr4mOxkbakHHEy1P11wO/x758Zg/7qMYhu+qD+WO1o+KTGxFiDr5b HpC9442M+nSPxszWO9s2C0MB40mvuXk0HJYsvkvdC0xL1K30+Uw45rbGo764TjYXCGRyavZj7xEC UC7VVpi4r6S1HHrohupob/H8Cbkez+sqscKg6NtRo9QwtB+rSAC36H0qj9qM9Qe7FdGkdo/DV+/L YyoVdF+sHzdmys+2m5S85RMUVoJuJVVWYgbFKB58ttVU576emnXYX13udwOV8c1yU+0YN6nP8ytv ajU5DMXVKxEPhiTmPE6ND8WDF4DmTALCwWy6RPwIhPWaMp8QQCao9aDKdhBHjCXNkKkXSG30s115 q7+ol9lHn4WokWOiUS3Y115ow5CZqmdZX/NZciwnURUnWg6vppfC+pjaThPgi1TMdYf2dTAGOOVc ETnT+KwjL3cz7YvQFxxUJIt6iiehuhmbqq7ajxr/2ntHtYOHg25kJ65KBV8ofoEZOfp2NOgMm+IA ScdFGNAB6mJI/lSdJjnL+qDooa4xv1h6pSiSx16LFa7Uyogca8B+YaohbKnjEozOIWQ7/mKeCGAl D4o/Sy/p1Egnq1uxg40X17cKoWZKnJ8SGyqLa5RyAekTsWhEgAmXltGv7JTQ325iKNK8TcY/q/02 gD2GiyEN2VybUBy2Gl0rQWPW056tQ93iPx8W8i91L+DN+Y3EZwmtzWdfBnDaoI5R1eTyCgUvmo/1 kr8esi9/cjXuyFBOeGIf7jet+YkBdreZmkPETY+oBigWl7neHOPBk54n5t+2DvZWt2A+YeQdmhBs gryBhyRIz+nq8Kjagw/hCHXHGVMy7HeVejnWezo5C1TZJ0zFUJ0UBCPAk9GtpjQTEBOmuQqDWNmp A5eVdunPoNjgqHlr01PE0vvwEUS/YW3FLxzDrlL3dn0wcxFwfDVUj7OgjmJzAxv5qxDNGdzSlH5f HxI65BGWd1Nv5TwW1M7Pu3oTqna8jRkfelIH7TuqYuwN98U5f7YvBhtw4rzYAoLWVHYoQY9xRqBH X7cormTgBnfojtBxUbzZnnX1hy3BKsMOpTVEfIepL7a21/U61dx1Y5gIYtasAKb5Y70+M+lXxbQL O3GLWBA+VgPe6loGrSPROEkk94q/+7u/K66mt2e1dTwVncAag/Os21W9NnfgS3OkLGpXoaqCqJa8 TevNbLxa/fKT+Bgdtx4BUIKQQbUPZ+/wPQB9tYiE7N0DL79JIoIUfFymrgp6F1QyKi7r7drcMRtw 57oNsIi1XgBojVVr6cmOLhmidEFzsPBGEelBLIO4NaRyQx42eCIvpldn82lxcyQKmeHNyJz+3RxM vOqbelb22SpE1VF3xt3W3CUGni0GDzcoL8srl5axXcGqt92wXJWfqHsyMCr0EK7To+Lg5sD8BwYY 3BH8IelCKUXpWTtdz1+A8ma9XW0SbDEsY03YjvK3sp06biC5vW3SvlsekBtS8pJiJ8faKVt1+AiA 3o3YiVQQu5ycL6YXx05TOOaa1hNIiLPPzRk0aZbmOtpswNzVXI6W5+uE6l1tLa5yTko2YtBjMe7V b5f+zgBjIBDzCwChO29mEArSliBuOjdbfTG9jfghU9YXKACJY4t1JDObGEwvode956ZtDHRkt2ji MF60pvhQUqoxEhj+ffwodo23s5N/nXVZjkE9iy4L+PfwccWoPNRh/zlvObJvG7aG8TnphmftRDo4 8lIT9jagyYKHzV/cnx9CYZO7OCjuizOvp9hMmPaQD8NkEmb1L2+JOU3bcrNhI3bqIbwiH92ff4mv yGbASRONtB4qVde60NXZ+UlVbPlSctdBbYaP5FnVDFZFqcmZ+7h9SVtyhHsvYkdvkHMlmD5G5uqP AgH+mocWEoqZILuskjTNEfAMPW8uHdJj6MCYUFIc1Tds+hppek0KHc7xQkhd8rp/UBw8sNlhIv+h rAa9BYbINACT07IRI5CcTUEpjyMCWA2w1a2AbO3GDEIyXuPkqalFdSz7dXKTVaKQ9PTYDTKRyW5F +zuRCZyMKAv8SkjemK1fzQYEU/wH9xyS1R7O2lgzindECNAaKMBTt0OxtDPUJhblQHFgefDlcfHz o0QwKpAiV7c/Lzt5WhpbDTCsyrAiDAZCu5nCDtguUsEcET2jWNWrnz96Ajq7FuwLJ5NiPB5jsLcW 8OFIjO6pZEOHDdPMoRGb4VCACpY1icjnEGasCRDmLBmayXJvXsODyeoW6uPqJquu3s7bCTV/EGv1 V6B8nI9lIihfd3YLE3EiNHqagl9UpWHyuSSih0D+q7inYzVHIdPlmmBxZ1Mz/WP8r9eD4eORemzv Rpkt5OhqcG9wr1htzxbNrHj67QsCOZyZK6KElu5MjoESSiYR/0vIJUja3bGvGMhJJYEUop765GHS 3Y+ZlwOkntln11oGcdIN0NyVuVrD9ZrufhhPd1HgfAncHiBzdUbU1kehmZd1U3+EOIOeXojeEzEK Ta3b9JoEBLR1PduuOQ7HbF2j45fK3/lPjSBT4FNqYOqntPoy2ZBvbBiFZ/8Em5TdaERNQ85hsKPg XDAFfhnKnvseZZ2/MERAd5NvOndHpJaoEjxRLRUMM407WdT+qgYB8Q5Yt3PeEaOG12JFP6+1KrcA YQ8lx6E2b63suhKFsUA7YKWCJgJ62DirnYevjT89PDjAECfe8nqiBFLBMexhlOqemf9gbwdKWEgg bUTiyDkYYg4DluTzZqi2SIQJjDgZzJwUiCSXDOyH3GBwvMpovWMXgPMlknAgYS+hQz5/tMesCvQM hyJWtIfR12TkqoAoNZ21F0gaamWDckEg7UF8RtsB4XJ5Tkq2WUxCjZGSE0iVqPewqMzgcU5TMDUh wyBWDP6rcJ0JuW8wwqOYwCiV2b7tYrDiqYniCdIv4mZr6wDJ7tJMeY/SiOa8kGn1UKjf9gwrff22 G4hnQyPMSqZL9Lp2OJEhhvmmtpzJa46Mmbfx/BncrLs1mPJE2yqarBdOvxeQla3k4LuDX20vLm5F OBfnYADPa8DJYru6WONr3UhYC0DkUoPfMQuJiYnqp+dmPTvCZznZzgTNk9XgeOo3fctvQgXqUWSl D4uTMFzQVqYUuXIzPesCC4MutJCKhNME4rpI66DjxneQQ9R252If5YVtW9OjYKzH5lP8eNywnptb MqJ8YBgDUwoRCtFDwQo2XGbviSPTNcwQXELpfRQ0SqkSJUOgrtEEPdOLmLwlK5QaL+XWssPcwSs0 mWDE7MkgrhyGajiy+f/Djuy1J5X5XbvfE+u31PwAmxG7C3EGwZNpKO3EWhesrvjSEkGXsELA9QeP b8BZh8fA1RZeW6ZeRLZEfbKyVa/tdHdCZQ6Lx6d5ClfWppbI6U0eLJqPiOCyds2JZk/4Gn5qBvYV 799UsFTvhk1mvZGxuIrMxstTZ4J5mrbwTiYcQyx9QZykXdCeJwrZZwRxlRs243qsPmdjb6ZG0J00 px6/HYYM11k6jt/CjxChy57q94qnc5LN+eHGRhjvatPB5+MLVF56gRtBP4FnHhtN2C6yNRJ10Seg U48by3d7Sk3sU9oEH8mkGpALluZIQqO3I2diedaA6ak8KNBfkzXEGxnJX4v6fMND5OOeQOThuvyI +32zsZKAFb6IuTwO7aonGCQOTevow+Fjp1WQLgIt4o0F3hXrTow3Nuqmak6qWoW7110fqpZiPR2Y M+myXxLjD2Yn2YxnCkJYnvI+asuf6BKnouUxe5p2qd+0PhX6W1OnNFdp+r1Ho+rN7GazpMtButQg fxnwFjhZ+uFj3Wr0JGWfh48GSZlYHJmkbtWMG4BLM4Qufw1lXJHXjORIWAnJ07OUtZQ4UkNNGBcd w8O7e5qGb1VqhdiKyT6f48oPa7xy0/XbOiSSrVPgsYaAE8UBbXLDzg70k3nSqk09iDMncBMEk5O2 sl44UUPahNwHxCtGxcE5CAId/z2e0J/mO/XdfBdYQs5vvz+qLB0gTvX2TIzvDzZ1t4H3NzAVh3/P 2vkt/EsPxWto7aBdg3B1gD1YTheYxa0jtKggEaltboJdAD2EP8iedcvwrRshL5sGJ85qG+R5s1lX sfXv5bQjjEasRCYjWZHEq7YVRWtu6dfMwkLz/IW7kvSYTfAlJjA4gQ9IGYFIzl9jmZwDmMtrq9Ku ZJS9wAqfjP6iCh83qJqH9DqS5zTSEesjMOSiZj6pdft0OyoeP3ryZxWcS/AD6ezpm7eDPZ2Zdtig tIt5fjKrvPNRsE/DVvrOZ71peR5YXXJPq6Bn7XoNZzaojEzxI85xCHN3KC81KBji64eLiQB5YFs5 S6GumLe4LVgzLvGGtI89lCIUchuGjNx5nckcvOY43uammUaNdyl1K68GnmmmLx8AoWnLDjbOXCQ8 I4fixifMVAe3Obh3UCW/46XtINJbRfkExuGg2mUSGl8D3TVRbI1oNUcpPn0XuvOsxn6cxdiPsRaz 4EnuXKdDlyLb+SOSGFoY0NDXS5NmGXGdFu1FMwMKQrDtbYehxVml8WT8Z3iAYrwbLvh4TCGjUW+6 YaMl/oMadzIuqGLalRx+8r7AWPruiNqwQ4tvBAgygRdTGrklr0dSQeHRLxksB8+taACGMU3cbQfj LsJT93YBaOPmjIR4lrNLnEI0xp5N1xGgQNltV2Cqyxd/Mt+Fp7ngkzgU2c/7WNhD2EfTF4e3dRBp Uw5oKg7Egt+2eIDVed/jJvnK5+FO20fkaBaPBEPpVD1NfNg2s/eGfZn/oNEZMLDavldbgzx2SvUt bu+FtGAu0kPaBvz4bUiQD+QDsGcEfRroZLoq6vGYhOHhI0DaMBv75ubGXL1LL6NVWJbfLQUeWMpX gVmc/d8/UBBL/8ExYTzgD8S2Fqnbh+o5e1S8Mkf3uaHDXSDUdqVUN5+oLViTQiTegLK78Hzw9xaA YbmzoXr4OHbBdqZe+CNlRs+EaDOPtR1fn6OMd0wT8euXfiMIc7BN7gQxM7aFR2K6P0ejF2EVAMkz +PDbdwNwt5yumtX7iw/fvP1//hcEcxvQhyOcyXW7oFm7IYRF9CClZYbg6aLJNR/eTy/q8WDQ1YYA NpvV0RdfrG5XzZgyjNv1Bf79BVU+GAxnFTgpAt7be8R7GxVPHj36q8IDfUPMN2aGrefk2evBGcDE lY/HT0p2VzWsxTQ/NP9HEjiNCzbKCIXv43kzA6M+d25BkcbM7g9yxPBYiWG7uSGEoIagtOy5Yc7I q3bOT4P82I3+itwDIvq5Q9k5V7cFKozY6fAohdjp7soAL0NK2whQUR29ME3P8BllyOaG8xNXAbyI n0txuQSoduy8lYogsQKXAnVQkbH63FOpPN9HddoEr0r52lMjDC9RH3+G2k7CyVjRkwriN9umqMCp tGSqmLczOHv4MHDkgUdFYmEoP69L0B1K88aGn2hVxtvVHDB93MUqMdYDU8RQ5GSi72auNkySivhq TvT2dNXQjkjTOoA0UjjFY5tO9M9vU8o2gzOcFqBUaFkcpF3Xnv3j0HyiRzsor5zqqTjY700o82Ti 8jo4kFGhpsrOA4bn4fqi1wi2ihGxFYwTjrWpDPIoiDPDFQiUxJilAqfDg4xe9VSXrDN9GBU3niaT vopTtptox4E80DgzNAFN2NcbEwvd0f3S0a4FKJ9cTVeTSf5gkUzvaxytraHye99ZyIcwroHrrEXa wndoqgceGtG0fnM7lGkY2Sp9IATtQ07USDQDr44etXKkaCDVFOqeRJkIoZk40WKE3jgicA3BNN5g SLLJBDAA1+bonc1qsP8sT8OqcG4TEHZI7dxbzOD+LBjYIdT4RNjxDg4FUWRNljEhHaZeJ1gbY6Z0 w/o3PREKJy8BY0Vkrqfd5ItxGkfeJOkpS/fLV1TplQSOlRiEKN0QWWl8vysZltQfRfxSYqSJkN1Z 5VqagBJgXorVcWFg2VT1XnNGWff1H++IJmQC2Xn+KOE7z9yS3ezJS/1RYhKYzUk+sjaBX2DOaJZQ WX6rFeLaBWxpXKaf31wnFCE/lM+DHOBYzLw/x3r7a75opl246tyvdNG7LbUw1rEVB/IDugtp5Mkj ZC8WxTBxyGr2CRbRsWfFwoetUNIF9TAn7nlqXwFnPz4wi46Be7iDtqgPLRQ1wYJnrv4SxegyqJwK BaBFyfOy/IXd+gWawJP9e0BNBwWbuS9isDW/hlRxb67tcZlEETJy/2L6QwO2juaeaw5rxrSymD4W 0Ns/zmGA2+X7ZXu9HHvOa8zdpdU0e3dSxXR9UW9Cu1uSDsITrV9OsDXpLMiBElVVCZcvEA0fUC3V sMfvKaLsoE3G590L/Alu19Tv0H4UK06f7KkHf7B6vR0VXlZWKqP+GQxloL9dTra6iHhBMm6VRwMB klTKrYphRPuE78EulkS17AEkPK8XfSuxczXk2ZTjgTtL4EO5yDcbgkuDuK7t9mxRH0KboIW9RPaQ 2vAaGxGhK2CAKGi5van3K92RQt6IMXEBjWOxkNhf+OrDmiG+u5CjKd5H5xQCVeoDAgMDHXfhM58x Oo9nWG/vaHjHwV9KkoQP4A0qRQnsQzrruSVCzuy7YMBzuzYCLQ0hsUUUvgNCX3hbSB/Qe9xVki/q AtvWsAW5nWf/DoHfKrZy1ue/WTDv/HcbQl8TSG448b3gzcdhgANnZtl89bt9k953/hOuEupDxNp4 Em7UTfMmt4Phos9H5U2VuAgb8Y1Gw7dRNSfefdSDcs9JDNIrEe4yw0oNBZ5LxyAjSKbMYe36B8c1 0KWcuXYJb6qwtzxLSFE5/L4E85XF9XDvlDuq8I7wArQN6+2SFcbhZZnj1Iuo3qBCzpLuIY8iQd7V 4MPLd//d6nYMjy4fXr37fzXsHTQtl1886MDhw55vFvwOiloVDwYCoW9jyA7uzO7ccbWPwoIiRZfc GdRycZ4BBRy/AqgVcKCB57XbYtVi6BXQDwOHLSFrVyqt6QCPCdEFjFe3gw/fvvtfQUNtOAAcwBCZ 5309B0PwD//n2//0b372s4GISl9jytcQDNVk/tjMMa7x9fQWWPh6CweM2I/TWURVFVzzQBxWLvBc L5pN54VohddQiLmEeTgejPkTTCqnYD+3WLBpsjnSLmxUOYwSgyFsthIsBt1TavTDN/fm1bxZE+gA eteb0tMl6bwVVmFS/c0/r6br7tKpotws+BiBz//uxds3b5++ffdm8vzvnj3HEM1muX6eU8CYqUIg yI61LWQ3zX8sAShqUX+sF55DMLAHDAWd8gOmkMPBZYRqTRfgtFi7YroGGuzt0v/MueEfP8FWRD/8 RFmC48L98rw0xlfv55A0DOK0vH7+9m+f/taVG9fLbruuhyWpBssg+5u3X7169zaRnagqkf3569fp 7IbyNHD1qpmT3h/o2bc5MElHJHnBOyMF/La07rVHlZj/+qInFZ5dNot5vuwE04eOKCovQCqkMRN0 ObQUhkaQ5oy89sxGQCpzO5YCXBMMiculKjHSKQpyL15BxPiNFdQ9ERKyvQd3MMOVXBQ1YUvgLwlW HhJgEUKmqxuUKnBcuB9ucccYpqO81mtpy4zPF9vuUkfnmweVjdHjq/VX0OYy95bHgfV+N55vV0+G ksWDSHZhn6h+/uFIK9FZrEiXyPcIcpkePenpkckyKp5UgWL9XHpB24d6cXB9pt7qHaeynglpVJFz RVAJN4luDMkeWe4Ucq32XxjN8IHlLeA9ovhJlSl8LsHYiC+bGbladfyKUKV8sI5SAjTapjknHQvF 8QJd4mONJK0XtczFwYUezFOGiYAZ3hzjoFLng6OMVJAYptowSozqTipJJilMM8tFnx4nvj3xvk1Q YnEdVuzmetpsQJYwO41YDnyo18cthChsNoa/aWP4Zj6CjQLaazyizVxQ/qHwRLAMDcwHbe6IGk0j v3vx9ZsXv3759LfPvxrqvFVqkUUyIO79u7fPX39jCvvlAHj7yV/uoVWOqnPz49foG/eQDuL5jbmW A3l9PQXwAQ6650/OqJhdzUeBaVDyfyUbixjqMEKt/AUR6PoUG94A3LYnYYoez91C/Yfi0c1fnIf3 NVWFBU7E4keD/CbXjKhcn5V7cwkJXUF/jUETMNwzthIXye8PuH8x/wDNg/CPiR9cIgm6Q6U93V/y sAr6mzwjwjwEpI/AmYFIxJLya1TMDN1CjHgFRoW8o8phJUEJVVgeV3EYzPfcE9YYkKZKRJmUHFSX F7wW7mSpeGjRmFiS5rHsCgF2h7EexREYLcW7P4JoWJb+8YefaJebn6O9RC1bBA2rM37w4fW7/wFD Orbj2XQF4Oof3rz9v0c/+1nfpcPdSWDOzn1wdNTmN61cHd+gi9OLV1ngc8wvuaJSg4zV9s9HcvWg 5Xpb32xevBpKOW2HAQcDnowMlAabKAkBrh4sKZjLFuJczlMOYbz5OQNn9zW+5aRemkTTHQAoe/f2 68O/LIEhruvVYjoL1XPS8XHUVXUbp0GCE7Gdnty0/wou4j2zTrPGuT592u4wZXTWWAd6sFkzd+fi 7FZeSCAIB0SjDCPi7JiegbmszS4NjbAu9Z8eHRVwT2oAPO0x/YYrlhFH6Q+4QP3BXpi/ekZk78y9 +APeJdovcF6ngoPQHaIsiTcFd1EgY68ci6D3iHMjTWxos8g1ur1GsD6MI4gjSOJsdvDaIHWo28kI Tzk4uAgd0j+4aljw6fqW7jRoEj9G7IZlK90wi+dz0FU9a84BhnFq9/X4Lf8YVharEZoMPUiXBWL/ AFZFT2haO4pjOyDN5F2/3KvN/8/duzU3kl3pYsdPjqBPOBx+cYSfUkmXkdkNooql8fgEjtBSTXe1 VDHq6o7uamvmsGkQBJJkigASjQSK5OhoXv0z/LP8d7zXbe+1L5kASxqdY0dIXWDmzn3fa6/rt+wn v5iE4Wc3LB/bfuKAv4bODh6uPw+vcq58khkhBUcE1JtP6CTH8xm4DMdsKo3C1sS/wtyGZsFuWCg3 bRXe0H0Bndc9lS+5WS7MG6UfJh2c2usXUudlEE32kKgPXUj1hUgPDrkkgV4B7qVCDy1y0/32hxQm RpgqKIevF8HRQcKLrqvDLPZRyBf1AvMqoz6Ax5DtHoxQ9+u8jBkEu7/MZvHRs3mpgh3Eq4Tc36L6 uN4vl6TTNw+/nX7/FaTwKDuEXE848OSVm0VkDght4rS6g5QfTOdye0O8HEJI8u57w6J9bSjUOwju 7keilJ7r6bAi/jDr2KX/hv3XHVEbc9FwjrOADu7XWBsu63xZzdbZfjNkzpOiRrzTiQg6DFxTJkmS NyG8tTvnwS5u+iBEOzAmV968t1V1X7zqdZtIT/Ezp5drSWJCS2eU/AyXa7O9TV/5sAhYAlMWbDHq psGJb7b1LQg7oQItjQ8LJHvTTbvLXmqUWDGq0G7lMroIzUtiG3z5KSmfcXkh/AwU4m6MlYQjgkry 5qaCaQCQUKB28JMDF+3FokyPEZwz3t1qm6LqcgBmC5f+tLnJbpyyd8Vhj/b9QnhX5E/MtrGdGojz vrvk6Z0RJf7FHA/G8OVVNFyB/ZJCvwc8ooHmCBnlucLs9B46QC3gAGQkx1gW8H+Z7eprdUPq0SL+ cAufQDYNyBJDLcILnkYCn1bfy6c72AKWI6FZrRY9SFNI6m9ileaK4jfxH3Mb3YBZqzoGA8T1tw9L V0CNBDFB8wVCP1ISDoTLOxHHhi3Spuq2KavRjFjOKPJrCEINWBu72KY0YvQGHYZ7f4HXInZaUMjs Z26HDzM8KzeLicu6FIBGsX2ir77yeePkXr6FgtXi64CbK+PpZ25ff3BIsges4mq2UtWGagMqAG4n 9CsQs2UUE1tDQGkF/N1CV8VCFQI4pWUqwnEy/6WW+GaK5yBM9YRVxnl5PF+MBPeArUFYtYclpieC iSy+9wdKmcBdcoEgYl0yqrKq0JbwW9Ek/CRyDOgytSecsUZ2ZdniTnuDxb54XwDvWcyXLVpFAUVK zAFRfjOPwhdbxJQCBRBof2yka4jFKUZlUMs4XFu8VtG+/BLD+/gP34VgjyfYmrUr0eP6WQDm4uFE MqwtTtmHzAheBpZRMYWzQsjvBzcK9vFEe57Ih2hwy7bvRt9ilAZ0qQintf+elnnFcLsRTNquSCXR dStwYudiQtqPlbnGmkUBj9SOoqqSyYfA5c+Z9F6yzhRmStAXacIWyjOAEX5GIfh2yO1h7YPykAgF IDyzJShmn6hDeayfJVAvj6qb/sDNh/PAsith2COvbfgo1jycJKY3x+tD951rswIW/01M0yJaJ6BS XCKhJfc+9m2N0lk+Hfj7F5OoeX6VbJ6GICUSzXsfxzvIbh4nN+9bdMXqTk8132/R2t6uZ5v2znSQ t4XZi6tqZXhlw34J7xtsDNOcUsNDd+lJUR63lKn+Y+8lfeRuwWTu668K/qW40w8Q3E4lGQkWTfFE BZD+4pOvvzrHyf/6q9cBvCz4PK/XwKHNsvc//v73rH2CT15lBQYlbKuPOtwWxsi43Xy06nVJmiqA p2JnzFfD8+HrULpQ6a0BkJniX2vOKcKgpHIi/VD+xG1vJoqVcWa++NeqfqwWzNErJKdpqLWjP0Wd F7EJDXLIiPUHHiVtZFKBA1gcq8OBy0hfgPhxaDBZT60LNbd+MTAPleOpsgi5IqAmVX7Wbie6IqA8 dUVwhuJC+FgVk5mKS8qbwaWPeDU9AusUq6KhWi0uhLTHWtZgCX22hxdRfiRxUpMKrohrItI47lA7 xtkfVKwnkJkBnrCUTsVV0gQsQPfE0AK7iTl3E8P/DvvyZrppOzRF0UbnfSSLDV4CoaL0U6bW7LzY 5s68E264vnnr74mGQ0LHlWOWQliKfsN8z/p3rx2dPLd2r/+Ga4cHXGYM3Dg+ee18VTPQrdiuG7BB QKNSdl3z3Gqwu79GR7rE17Duh79Gv7rE1zAHkfYcQhBWVQebaN7wxQOcMrLZVkMGF3+WuPk7CbxV hw7REtST3qkIWYOSnVWbjetOxG+43Zzapx2T7OvW1bnq4gHDYxhwKx2r4TejNmMXr6ebgeIHm0ls uIBowNaLq4GlSFltgqvccWHewpx4eLnM4nUzlJaRpECy5ibzJRC7uMGeCqL/dARIMSCTaGrXk0wW RIxGU5dwaQ/BK1TBJBUhG1uoCg9EwxTTTshWc9UUbhlnbo9DMpxqKR2KQq1puO9dAyZNkuIrkPs7 LPc0it3WyLAAwfCqPHKMNv5xW8X6+WXMsX86v+5k1v/MOyav12coizzlHgePrDNJnQ5UCLI/YD2w EgGrPsre7RAFSytUwYjcxq3+Z/wis2Ec5Ka1aCrU8jkdQQOwXPv1AhLyAQEFbV32lWP7swJy+GlR hrMVzHblJ/H5jqXXHH8PQ78Uhyo7xLgEc8/WETcuYebClajXJwm+htDuNI8Ihyg8sNQZ9oApU25A uocdrFQHC0XDCNlO5Jh05w5wTVRLuodWRD9JMPbmv58mF/XwHDIvYYJA7d/NRaLPopnzPa25SPRZ JNDYVc/UPQO/E0bd/4p4Abulovs/dSHHU8pH5wB3kNQPJSymdvtEbEJPbzypdrmIuPiIiUiqi7p6 07PQE33yn8Mh/K04zX9TXoQ2gWgUDx9H/xwCXhY2GHqaW/az4/p1/H/39klpDO1O6msYGdK+hlF0 CBqOFIt0f0fn3t7y1jpuZnp/Tdc9KMgWFWjFydxKO8wwAxSnDmCMkoLabQ9OinRdZWQthXQPQ9o0 m6Zta0g3B+pxNMeI4ozTlGQ3s21Ghgky+ZvbuKrM9U88iKt6DgHzt/stJZXdmee3dySsXlfzGVzc wALsd80KrdcQAgjReS0o7kxF19VuRyl559tZeweXOp0VgJZEeESMFayWT/FNj4wiUcfPAsMMw0V+ y1p0KImWE+RlcO4I4ZX19sBV8fhzwX1yGR8k5luetfqhYTd2nKcMn9neseU5TH0aafhNmzUg5prJ +UFWlXKxEYEwNy5Y68WQnZcqJ7C5ip86kqu6fK1o0rKuLGF2AOdQqvyh2GZND056DOMUBkEQDpNs sN4NtEOprm/w/sffDxLG4qDUS/P3S3gwOPn5w4//I3gqY0SMBTX9+ccP/8+/t97Kvo/yyT8QL/9G ChPOhsfm87/tyC90coLx0ejBsJWbEMLhgGzshi5vNeT1wvzbDKa+rTCx2gZZUvq8biEx64bTHkzN C7P3p9WjESbWiH1QqN+Ou8eDRYVb8rWwhWhXvYd3Sz601eq6WgBGgc3LAv02TPNsA9TgrnmoPlZb xkYWbNbdnTnEzomjHWc/rf80NP/5M16pP63/FQ+4JADfPTRYK4zQnMQF5y2DetcIAav7CP7wpnJr bcRkcLJlvIIWkK16nK025r7KitHHujVM+5d4Qw0z+stuuKIsuV+Awg9ReuLKCrUgQYRnqg2MGCRZ aGOmEhNwgDWWE/9UkO8CvqONTxl3gUAYUeYmSE+3nT1M5dTrhQPvkcGgFDAnm4X5lBfBLQwC5yKg Lu0cM+M03/9KMPeSVce2dPHq8tIOb0nIpPLqfHzpMbdLjQs9+NOAcKW9h39OPfzXCJ7HSz/S51hI HTk7vwQEgMFPZuTZ5yDAenglnGGV4XABUOUexvhK/T1H5HZ5FKUJiocaoGDDaONEOVwz9C+hbQUa A1OfZYMjlLlYHC34QXFsxU5WtS4YYaWMS3Ff4uzB8laqeVUmkF8sZlL2OczywPT7M2wQvy7PziFk rIX5h1w55+PLMs4AEm6GcVfajrBgYsiABpQeZOIVDeECS8Ac4CRIR3s2WFeX/nXQP0VmbtzURHMi tboSE1kSwaqw+XMFMMciPnqXRZG8Z7o9i0LuJPn5KPlRGGx/rJls1d6y+w58Zc5Y0szVk+0u7d7W F8aq2s1/dXG9hYREFnbkMnuBKXlevHpcfAFBH2mcN+qry8E9zOqFHUEfTbpR0bNfYyrOMDHnEYF+ FtD5hioCtHN6llItculevJdeeB2vScaH1pD7xc1IcN4dxr5zuuvA4enKZpNsNZmrtx+szu+1Tbsx ssn1zGWdym7nthxqGkdv33/79v2HnkVI9u2UAPkBL8owuE3WzOd766MkvNi2ohxZQ+INRDLy61EZ 5RGHo0JRJ/+VEU6+yEcnycXu3fSqdZdSdsii0vRmVi8Ti9dx7+ijNEdRC/aYzbiagc8oMIpmkF/k qdA2G8beUTlDZBTSEgDeJf1SwS01E7/UiGIRJgxKP7lw1sw2udkADQgUgH/CJSLgyI9mckCAJLjm p1/mKgaOUryLHDC1JwFqY9bfVgkOWEHDJ13etq+H2d8jX4SUwrB1O5hSL8vGH03HbIaNrn6AY/eB fqjRqKf+lsG+nvz8f/z4308ZnIdg1H/+w4c//M//DYC0Z98R8DqK0IZnRUb8Cbju3X5DXmn7NTrQ QAGbO5XUMlEgJ2f3TAZ7IqQPjneqgIJklCrTcFhoe2+h2c3vr6p5g8kYh/gnYBkEHzTr++qJojwE 3sY9OvFnHFMHc6kPeAxmy+/N3WKBc7jWk/l+l8B1KaRRizQ5MqUQJtxsfaA1EKkIUQqQHJ3sSScg 7eG+9ERIeWqTpNQrdGiE/6Ry0opTsnkNrZt/GA/8gMd5F140VlSvsKbnIEarzy1j83X9iCYV3i2w TtW2k5Exe26DTgbmTgX0/P2u2beV2E8wL+d89xhFNZIGEr6FKwP+9V9RfYRla34EOD/UCED90C// tTRq3stP7S08R8w7B3I0VzK3dT6iPLfmRMGUFIlSSc1N8nbMaVpvaFqJNeB05Eb4K8Bj7hpFHIx0 2KN9T7l0Stsj3q1cjxWqSVGZ2lmkJuAsyfhRgTM9yeVtLgsngNp69ZSRsRCP5tLMIZ9guBrxeM+k 9uxmNjcvnlyXadpRi+G+4/Q6mDKnYH01/A9+IhYP9AiutbaENijkhNh115K0QDoAwlS94VgRvwi2 h9nsTatMcG+M+LaeC8wQaiR36D8omdBnd2DnNDUa+km5hQCnbJxZ9DNGPoN+4/JWxIBAVdAJRf5G 5pmsfcE/HMDfCk8XDMOj0FgZKQEpu5AdFqHaz1rK5XrCLPKekmPVNivSjDsin4nrv42TcYkruMiJ 3mxWuVWv/4iKSF7KsWmLjuuYVcBwgknlAu0iJ2bbBKXwbAu6J8wgGKdHdRvRBiOVQz4w4HJMswy/ zATDXZ3rftDWHYNijFyXZktMhAfr5jYR9wwHRGstqp+Yg7cboO3cTajDMlXxe9wXUUV7imHa6d7y 2RoDfSFLc1g/Ke939UdUi8Okotc+tICW7Tgd0WxNOHI78pbFY5sVUK/MJjSyFtVhPa93CR8LPg0o tlTVgo6FdET3kocjarCa4iIwcQ1uhFIwx4F06whuS7An1EeN/UW7XOgDkKxQbZ26j4qevRTdRiV3 L6Fr7m0jfbdx5nC8Wqb/toQV2zjrIq9YS/H2n757+/27b4zg9Ob3paa4u9l9xUGxQB4dlTDEY7x5 GkM14yumVNzGFYCsMSMCN2CboLnQP1jMWXZ1hR28ukLywhQTHtOorq5EsceJ2zDhFeIyumrNzv2h oqNoEwZhjyBXULV+CZS73b3EhuSTu91q6cAlEenq/5sbUzFIKAf+VfdpWDluWyAK0B+zGwjEny4g UHDwTubtvXlqrv84tai7ytWLOdzQdMRZMJEDM68JbrAQ5yxaVPYEC/zcF9XBKD/M5mo6RB3ARCM5 J5160brQWazGVAchMvNmuSQbGt50BbMdyMaPMA2Wagjzw4A2fluUQy/Ni50BTFuiE9aYbkhwMI1u Olss6CIqMKOXqP9ut81+Q6yseQiTg0+KnHK9L5nZw4cjV8fgTE5+C1565i9aN/NXuMdmuBsmeWvo QzXdmdU2e21humQe3TUPUg0+xC3Q4Q5/Vy039IkWwPlrSO+ILOv1U7ZZ7m/BiLvZVGbTmcuDx8BD NIMwQkKRK9bHtA1i1CSHEaiOXFy6XlDzcoVzCcc4Ew438o3INuJ6m/WBxU+3T1sEpbuwAzqkGTtS IBbt9DMjZMN0fzZliXtQhh28XTbXZ+3uaUmByeBgbRiNNVrqPImc8cOtYN7bSWYju+apyD9gGuKo N3SMq7h1EjuOa9wynt3N757ZvMcxUZyd1xl9cOYrtKIjVnFB7gMu1S/9PaJTMdL7WYmT6qlUENLO V/5hpcO3q3Cd28L0cNYlrRONBGlUSo2sAMKMJkR0HSPAU1+sdYuprzlK3IZqVJpSLRSfsbwgcZL8 p4RLenPKXhiVP6E8m7T+6NaCVsQi5w6ok5Hrlk0DKHogJDB+15ZjwWj1F9yaVp0aMt/VILaAewFy xqoQ2FcrDJYTDoX9itpq146yt2QQHuvKfqM7NjCfnZsTe3E+fH1ZZg+oGl0CMwJuKg+EI2v5eb7N DQnRndPdJ2FFAmPPJxTnNjPXEwAeuOevR6qGzEt4aPkXZl5UdxO8C6UfdXWJCZzrL5+9bB0C5/kw U3+9Hmaj0cgsIbKaJGTMSACAFVL9UdKOg4eSBkb9I9cc26nqVyZj0zuWZTxBJcI/eNfyXyPht1ez 9ewW2RbmiL6hB/azk5PfaBkcspZCDnnVmk1hKSiCqM1pHdCqhTIfgaLePdfcwZ/sNA24Z4OxzI1b kYEnK5gS3t+qHHVhkI25M+oVszPmY9Um4cKbZ/TDXFtfAtE3D/Bf8/c7lvvNI/mpKhU+0rz92m7/ wW+JMjZb89j+Vl/Bfbq0zAiM1/zJC0tA3X820+/4STfptIuN0POzIR87JQc5nQnvdOHp6LxR5hVM JY7pYjmL9sYQCOuTIeHeWPWIavEp/uYJFa0Yyz+dIgEiXSDg2sMryGLm7h1gSL1iIwp297K0okbO qeJcPZZbFZwv92Zat7gBCMQeeb0w/kTVWnymP/UtwAmjJy+L3xd5GjUS46vLzQQqC0ANV23ziqK8 JddBItqNq70w/7nkwH77d88oP5MPw2sM9z3ycAUBc5FowVMGkHPAWu/uzPKQ6Lq5licb093rWVvZ TBTg+A4fQJqKzVMe5fugqkdCbgAyo95R4lBIJxan6NvMdg5cnXcdcPjAXA00+5lyiSf4t7vRzXoF 1g1oo0xbWF2C9l4roeIusP67prknwUOP6haYsebecM6PT4WfJo1PEX44ssdG1gCg01ecTtR8NtHL MeFVCU5cx6fBInKz3yQK9NQHuzI8yPweDEyUnMMhq1B4T8eJlt0BhZLCqIOTOOkwEvgYLqcqWsp2 aoTAK4O92VSYLsMDwXeNnALAvakSXLtrQoNa1Y8Aw0+WBDieqDD+EtS8i2pbf8T0856fvmsUv4LZ MBsRoK0TYVt4XQAohv0I/CTmeyNQrmh0+ZeJhOrcX3xV0HzzbrAViTLD6xGc+rBDyAbZQBecJ7HV cBTgT7ZtsDcKI4AaEJj7OIcEgt4Io99sgxVSA7C3XO8gOgGXMVrLSK2FN31rK1QVbivyfva6dcBI KD4sZtDb2QPC/OAXI3BXWM5uAQv7l6/NprE1+hrCtERiyrPxUlkdMKsZ4ICZ4zYXECzanbwdzUW9 IrAwxFawTbZpZ2M2KX4HyqQvIbnWYwCnbNMDB/qmnGgB77f5sk0U0TvS2jfiYsL35KXXnW/gRBW6 Z0q/BcmdAiDcm4TOqw8f3OXW1ZzAkXZZFSQmEE82eMT0A7vX1ahuDjvenbk3bMYl701pwG5QBXbT OkVYrkL0WB1Hq8urYjvvwVXwANJO6h5KE19cBFcFD4Kcl5Q4Ce9ntkbvGvMXbSob2Tdf7hd8+STR de054yT2huPcQmam+mMloQ6Aozer0RJIFfmRLfO7mYvuAUqAD9QS4d8jwD3ZehAzkgk2DNFFneia PusDXF4jhJrs8ATzAB2v13vf1sX5FVGpGiXpSjVAhzFRPTtQovq0Wi/YSQZYq3h7Sqvmn4vx2S8v kw50av3GXalYvRXt9kijbLnsCdqdSDZmrXo+pFfxOmK09Iizi2KhGG7TofGNLsCkeZEHh0JcaLpP hldi5KOsmdqb7Q6Y8zjLISScms/md2b//vokgHPjmlIB8nQLE4TjFJ3jtu2OehCys6dmN7VVJnCP 9bLePfnMcsvxHDpvGCDXOY+xS+uIE25I+tjfYfM8FXourdAPs8/OLyNH9XXDoHnJkaXSknJ519U+ Cawl/tW2pNfNA87zGxDDiRA0V44PmTqV4gNar3cx0KHX/tClaJa770thUgp3D0pmt5F9KckC8Qbx 2bVk8D8KQ5QWWrJL+tJQrGpOIPADHVHudpysu/N+RYAzFdHk87l/WT9FH/9X7yXNcHxI3//DCPn+ j029yLaG4W1WchtyMu+quhc/IZeBlCyvqp4CTruEgC6fYJNszbadiyVsZvbAd0+o6YMLE/wiwGL0 69LLSIq3kncZC0/OCUyH2Z/+XPrXFojawKqBYyALR7Cht45eOTfuMBUiNCk0l+sZuVSfjlmp1r6+ IgFwYT6CLmCV42QCVOTFuUw6d71aaton1Tp90yQvWOmqzdztIfH5eBPkbivirJMUUt1h6bTbsbyz N3F6C7ToBSicce8uzD/xTb0EXUuEW7EcgYGwuK+eJsvZ6noxy2BIY/zvSF1P5cX49WUK7kKOiJ0N nZEzEK+ZKFLENaorhPZL6i6mgynvOPVVt2bBB9AUujhxfZrYjk38q9gX/vQg4Kk/ECsABYZzZrm8 q9mcCdOPuCwKQqUuRqibUJig0uEnVAX+ap4TvREp1+1NtZ2yHaHgHgKkbzvk3ilnxJW03qGRV4id VlkI1/Fq5GR2y6PY+cDWysj0BUmU+afrl6pkqOl3LxwW1D9RI5qEAzMrBvuAFWb6WtC7xLcZKkdb M41wWKhWD8cO6WGXdwN+KFQPYVIVq4km9lavNj0pII4Jv0z1frRB/TaXHdq5nFgDp/3qa9+FNFb5 SIG8jPIii3ESNTQBlUXltq3dV6n4Oa0T3BM6iJoqze2BZsK+hpDM7q9ZsMhftBcv2kuIJKImpZ5R vYipaaKTE67L62z/tmI4WWhlIj+oYaAKsmcPVWEo5kOzXbSTP6kuj+HO+LOLN4OusrEL3OY7HbKd oRb/mUKcN1iZ8M/XfHrMd23ojS0fUgZV/OkX8OpjSc7+HRfVbXFp/YgUYYfpD3eThJidQhowB/EO nXqzOYvLmLMdzJnsnoKIQPSI6+AXXMOq2t5W4ktSWQUAlhlZG/0dQoQgYlbQp6T6h0gFdmPC347c s+c450eXuS+au0qT97i4F5AVR4rGBwieyqz3nUxXhyvNW1P09iRCfI0YBUrOUHY++4zgmqybCgNB BREqx2mMiHYBlFX9L9UCqd8A9FkDyX9BwSDYe6b6h5jxvhtuhB405ItZM6R5LOzvN0YAEassFhlJ W5pRCLsWSwXOEvCAQfuItCWYAw1oPE1LfKt1b0pKea/4IrMlqe2C0gobqRxNOn44Gm/SH57Wu1kq gPB5aUopXAI7wfuAoiYkWykouKuNkTbAtQrd0La7vIx6o0dBOc2+qVs0oKV6yBoH8+2Umc9AI9DV q9iPk4OK0OdrxU2Of1rnXSXNAq1sjnvA7EDqJToOh4SQriPLXrTJF+TPzjyFc+9trT869fAB3CDJ 6ZZ33jPb+d279x/GGeVFNL02HPJsfgcdf5mB+oVwheDYvjRHmRyCE7Xs1/XP+yoTKyye+6dmv1U9 ZW1Q/HH2IqtGkd3abYjTzdYIt2q6ldddjoTaP9HM0RGBl+NsHrb1Am4gOoFA3sPjDDU5WDEIrosp hnk4tcz8I5j4XEGSnXPz4MeNZ9iwMETq66SAd2z9tlB/A2l29NRcsWOtyDO7dn4PE0macHxDsxco /+Bm2rHH+QyghGqOxzCrN8Tgms22uZ4hvJA4epAHZRjRewpIQw8VuoqR6p2h1LnzZF+INNZO3QD7 xfwu9JDLi1eXyTRVtoTSqB4Ti6s+9JIUBMiXrDPZVbPtV83Dmt11QmxKUHASyE+8JL11Lkyd3I2e Sv8Lr/Xob7HYZqjpNcbEEYYvAFcxUkqAv9L6Wcut67gJpoM458XClinsL8e6k338aI6InGUDHqiD UyFtPQgAbkgpvm3U3tebgkMRX7SjFy3xvSI8ZA/NeoCBvM5xPnSS13BqnjZ82FcIqH5YpIwo7EVa AnW2W5LQ8qLMfVny8ijCPGf/hiTdHKgygwTZpI87T5Lfgjuq9ilgDFNo7mCoS5fPrkZChY+sJzQT 8WZONBKTFZqNNFU5NCOpNuwzbzbs0/JZFah56KghPpfq9IezYwUZ2W6Js9ojhyhDmjNYJxCgr//4 txI8rKtnt+ixrh6sJJnqRK/HgZa8cFhORYFhSc61An8qckd+TDcsmaPgDj6dFFX2tQ4ZsD45Lrar /6RD9WbwANnAAAjUDITCaQfvg3l4MP/S9mO1oNUcJJNu0cwERTsTbqnN0Wmuj7eRXqMUpmXfEnWm 7/K3aTrqndMiddwoRGFY68bEk74YBP6dTEukqONZgtJxZ1NtyAIe20pc3tUzbbbcC/9WYFcTaTxx GwRfH7gW/NIJtsNn8LB5b0TP5et6CZ9H8ixV22z3a/Atm1fXhgW0Se1RKO9N1YBalgCh34/WAbgk rDnUbC0qpTT40qauizgysuEo8zw6KZpv6AVhMnUY7+2QAHWWdQz2me8Qo4va36P5fqcdXVU7E/U7 SpSra1PVxYyl1+y6o92kIfDoJg41Y+YFfGmwNUJJKVManlFHFWxp17sJwb0gYsLcXNPNk7+dhhkr d5bN+jYPUltyU9V2G2k5gxCMhE0ekoBxBejFBjrXeOPpy2vnNE/kF5e+S71LTS7UaJQyvgAHD8aK //Uddeyn4ewQ9rLOGKscQDgzGMuJRt5HQz893LeGRcC0sJA+ENPC5mlF6XN6Hh/o3bUMh+985zob TFSaher0fsAr2rmToqoTrf0ulBceX+9R5/WEUF/qc4BuuK+I6L4UAgqZCzbNZr+cbSUwRPtJ1Gvy irh+YmYE+ZCcwkBzMFgQZDJAWJC0tEa4VYqWKjuYNuwCxryPzErATRtwaqcYMuXN1sgBNnEklNQx rVvHZEzPf/l3QQ6BgAHpueADR4nYkwK4pXqYoV9Mtd6v0NJpyXJRBofO2djQ5qQNlRh8bx4Vj2Xq nNrYfEy72IEvmAH2EuMhv9hmHDBjvl/b72nPvNiCxc+JMNijsjxJenJ0+U6ICfHixQIMiFl9hFrA fjN40Q7wq5QvZb8HSYz9bMYqVuYFh+Xx1lufsS4Vq3TDjoLqD3uf2LwjOG2BpdaaEdsJhZmKOROX q89vQy99R17bwAkFV6zAtKhsxEoyxVhOnyBCM9nxGe1OnHvx6nLoQVqCHprycSa2M7n5Cfqs3wV4 0Q9RyjV47hXe8ZD+hFUJxkFwoDh4TdQ7birhz5BnHIgixxPZkamvdwG2lfn6FxPWrVmI0WRQA3mu CYSUi/ILAbFA9IL3YBZpJR8tjppiVTrkL9ObczDSWhHfxiDmU44/x7HYc0t+pjtBRqkWfqRDB0Ia En6ORCMkrfAyOMIYq+3PEAVrrgHkYtHnqG7JLEegKQSgw6FFQSXW2NxUf2zvzUqwtTmDJDp7hJFi eyiWTAbunVKeHgjG2HPMhmnvoUHImOsaTT6YCwi76+NWogOPnYhDTjwkoCT9d3QAPEq19gHuxzj7 kpv9wDWoPna5XLTv9/TAbcNUFaOpt2XLYA5R6sEcE95m/WMbQzpBvnIXV5kIlhQif1P3BEaqWixl tmP036QnTvVB1dUbmpSeiJOT6RoyW9XtjukSK4ckC/Zy+YPZyK8P5kcPQBMcTqlz4JKffoH0dLK5 foEIIAG3ojEBo08AkQNTv04yN7KOMlPLrOyiLKxUBtvpq8rU8BoxdwyXhN2B/YS4JLAZWvRzvM1U 1D+AnBL+a1CVeP7QoBSXbAWnxBTPobhbJG/GlRdga2d5tN8sLC8nD72SNLVeOXrklZLeeuXkoVfS myKvuPfG/8YuPMbS6c3gl1Or7S9tstRUM6f+00R5WftoP4S39Vwlt5zO76r5PZz8ZseRQtXCuWP5 HBAHVusd7cKtvRU6lAh8sQcmCDDaiBkE+1vpR0dhA2lH+C4oUdWxgBjxLfmP1VPifpRkOt48gruD PURHcL9xlI4nuurlwFK/kdg0lwBl0eEllJ9xdM5qtikMBwjqHNRdkCzt7TY9iYZMYMCwi6ADfBzt ZvcRQsp2AEs+tJ58jItqtvjkVRB8AKtkPoHV/pd6U4T1JKPzkvsLdpZX1s+5yD0tJQ7f/B3yIuwh orciYSzNlg+zJwLAlpQ9AXrjqSZvUwKGKkrGWkQkq5alF0CLwrpf+jCvvGm4mxiSLxs/7wiG5F3J A1LnPU2apaD8nWj60A6lSqvVxvQRG7cAKIFUpfePCFfa7dQjlUIQHenU200y1g0tY0J7CzsQbCYU 1tP0omfnPJbp21j6FV8RIDdYXXfXhB2ag5phOQ/Vo137u8lJommfhDOdULYpOWtfosMDcPtOfAE0 q4rBXMErAQA3rff50DdN+VwoY9KB+RxiapD3n5lTQMC1yOzLzsbWcz9KzvmB+SCGMW3TlaSMX+Ze m7UqwQ5skKsrhfnTXl1J/NPZ69Ev/X5oo5imuvp76/ApXvnpWe1mGJ2E57nxswc/eukTPWY3/UAR qhSSaAdAjBef8xQPqcAj0u5zdniP5MZorA4SEVXEPc7OSHR8Z+fwS8/x2R+NBGs8YxzkC5/gkM3h C1LYEpdrl0MDZ4Xu4hbXC+IKCfxSYLxNtbQurjnEOw2WBzbhmwXmn/KwdDmIWgWL+4BhBJcLRYB0 OLv6jeuTNRnf1h9BKcy9NnLzd3ZIBN0MmIBkBa7cBcHZIEjNi8pkKLq5m7UVQec+NXt7ekkZC7L8 uoUY8BTvbu7Ia5AdTdkdIZrxjMGtgLDVDXhJsY+6ISXkBYU1AxbayHlkEDqwiI1GhEeQo7MWdMeo BSR9lVk/Q/vgB4IpM4CYYKZ1hRjw2qIWBib3JeraeGoJbY2qbxM9oqkfU5otRmV0K2JTT7SQWsy8 28HCRAg/sCCknWclehfgW0srgYqU0FGMpweBPd0d7PoCyMm2i20N+Glepe9TtbWGA9oqUDN1BLLV vkWAC1fr+zOcutY3lFAmKKT3+PqsWhLWrdQKHSM8O9Sv7yALBJrZzc5KdSpcBtlYFjeaGpOems2y hQqbNcK2geZn7WbLiP1eG9fkagdT11rtAN2XuybonK1F44OHOgl7U9Y7RKMW/wvcm+4EkT1DncLY Uk6HkQCEKSMkHR3I/gjnRx3b1PkxFGrsNgAdGCCGOFnRHAEdcGvdBmZjGA/ZmLYVRvxrsG9T6wh2 1LrB+rEIYRov6KPUpDuNPqe9RPyhJ4fBbjsTjoux1kG6stu+3hEtEHRnxGDnLjrcc1/v98EWNEfF qiqQUbfw9pZVh+8tokpQ0bsdQalTqp2PYKwFOOf1k+yTM7s3iAFaSIoIVElqbT1ONpJbs+aLJ9Dl z7mTfCMwHhyAsyDSviQWpeQC6to58UyBi9qsx95w954KxhG8atdKFoKHLTCqC8xIqupwuJwKT/8B rjD4AGeaNw+CQ242yyc/1Ij1tDvHOAIfdKJ0gb7qxyLHr7lHU7c/owDnWiiVb6pTwJw9iB5Uauin YymT6koOYvJK8vcIq4gWi0PBbZrAwYeo5QRcBhmERS9N9EAm6aIGQe5P3Cfb+Fh6+eeTdGsUy2ab DdEgErMtggs9UCAMajkSn530GLkci9Vn6VLhdxePki7LCXmW46HkkvkwL6EpW9ILOoWEdvIB5bSL 2nJ7q4DtQC3xlrKvL8NROaagpz4no5lqP/M7c+lNlKVICT8mzg2Tt/trC6Dus5+kfcWf7QgyjT1q /HS9FnKHRh7wEgkIsVVA0FBctrxms0Hv9gqP/6+7IBK7Nf6s7aMuxBJGR9x9yiSMliFM+UtY/KTw O+7oeaIPKSTdDFn1i50kgqMlbUcOVNepZXx1ANE+WF3zuwSTIq90kghFwxq8EPu2u9mQPzTPTYWD g+PzWxvanpTx+i+CuSYxqV5ArP82CW2sKXVC2grDlLVYZl5d+Nr58jIOzaxF4XccDVd6ERgn6wrh aHvHK0VDbT8nLiLaGhh6vxhZ5Wev2hOo85HXgCLpYFAsakQRcdrS7u5YPCbXvbJDKpYiTuydLSgu 1FersaqhXkwUxSKeQT0J5NvCOVgNMepN8RglSr8zlH8RGTsSfD3cWMdF94inmiPeg534fYNJWVQ6 GGHkZZQlJS/HCFFVM3NTQfWbbQ2kbO1kZaCkMNWGVQKuBlPB7Nnria3alHnpn43MzPQThTaMAZQ+ 6DPoCdd42J8c/rfLS+JGGiSQstyw1XQ6Zo63E6K9QBjS9okzBEDeG5Q7I5bThkl2tFIvxo5FFtyS W6R2NcyKoVWcJmqz35obQoRMM0wf0wZ1gpDqC0Kh1tlVvbhC8UxkgIwdeuqFzbdkJYWwU7jNQDvg OHSV2Ogapa2m5dw9nO8qzNzi00CX7Wp3Z+SAW/JLgOQtSi68ugr1k1pHqaiStehKehWgcY4Hcqps WCjfnVl92RFPok3sSWW3drZ63nWr/EsLuekgXhdqwU2AuAKQ1Up2i3h6HQnDrJh7q0VP5DmJbn1D lnAeke2iTOF5QiHfpURH8ygmNna0UX2+4EytgX6+XrjbLLo1+yyQ5kPkSbLI6AH1AGnCpvps2J6R l+0gKQtIiupbDBVBj+6729mLKnAzYP4X+cjj72bYGlOczRDC0bTq6vIrSlr6YrkBxbTiZtnMdgj1 Bs7T22F23TRLcrABF8kywShwp6yT387Nw4Xt12X5ObyQIZfHREImKgYhSe8rbfyxNlf+rvQy61BZ Wq5U/g6VYzWVcxREMEkZoKvVzwsxLEx1A5hmhPdJ/MJ+k85AwBquqQupwh2736YSjFovPAsoDlhj fs4k9mNQ7yHdNb1JJIJCfZT7AM0rNRq9dq32XLRV5+NxaPm+oO6OrsEVsloyvvl2Bxm1L7PPsQ1M kl4G1VkIS2meYRjaajPM8pcCaLl7oJmom5GkZf3DtqZAARQ6qu11g/k7HfQenqwi51dSE+NNpb3U KPmhzVPknWRRXsKNsYosNOMQpkrMNtrNDZ7JuRnyBESgjPp7dX+FEkiy7STGiyvpzEjwmae7WGIG LNPVJV/hhSs5IoMlLbHqr8yTHM4CLgf1GXjGmgH2MfJBI70RwGqI8WYz3T62IbsA7pm4Z7ghIe6c PYlgW7D2M7saAlAIF8mKgVm4T1as0a2gaC8teB48fhO/EBtdkpwzWrBOIS3ELIVfunvA/O4JcGfz xpwyIKnmpNk0KqJiRSr5ogWlAI+tjKsIpyYwLYJHBB/MX02yV6TZpHkxhAEdNKb5YYQiqeOL7FWa JyJRNH/RZmdn3Gc7/bIgx/BWVA9/ehLOoCo1zG63VbUOsG0+4QxR4rn4FJjn0ymqSjwViXkc87FL ytUOL0WV99O6byvkhNLyOX4p2r6++fE+fNECyAO0xkYRu6Vh3s3Qh4mDaAanUgb6c2T1SDw5zEz5 GcRxsOvoOlTADZjOw7rv0nBsgJ922IeYAoG8x7KjBFwvSBEAr73cNYXXL9uR8LXmGMxWHL8AtIPi Zi24uZ+fm8E7iHw+spSVh31FaHLoUfGWPb9tiNow+0ySdLF+2/ma8N2BhqYZuZFfmxm6f6lyFhuh jlv7TVQ3UT/I7o4c+SzjcC720IMKMFvVg3mrM4Kyj8uG4GBbTNXZAdxk5D4OEKDvjXhLNhlO8fZ6 9L+hUfm6+QiJJo2AD3msKf2xEpbAzjiTBFZoxuHLezx2ssAXX3xBmj+ey/9UbZuv6o81XPooaKjF HI1G8M/5y1f0/beIJkSZcFmzMHMBQmjQooiEmRGMz66rM9aLcFBs0IuuDgwtdohp2J29X3mTBn37 guprEr0CRfF1vduChsJ2UNKJkQYk7A46/RSP5Vh26vnLRz0TR/b9Zpgd6PTR9TxOjhn+G9gE2wVg w7Ti5VS3Lm8skyLyNeQ4icXxa5HfFK90hvSuEYmWYjq1Aat39QIQrJTzniEd0fmCzr7BMyqNBohs FlgLIMDMgPzCqizzyxkAXrX7a/KesjEgQl00w3hqE6q145cvzYa53s/vK0qqdre5/7vXnGXtZd22 ++rl+f/+9/yA5stRPS03zaR/o/2uXgq1/gdq3u88nNiY4Jz4NqA2cq/9HluXFB9RBSoLjG8YazEi qt3pMz7HnAOTzHPRjkHQqRh8qgZNMViA+IaI+vB3cR5e+vh4dDPFW6klZbhXxjpoBpZJARxjykzN sYme1B9+1d3O1kEE/A/oYIRDKhGWvl6GTKC6FOHITHn80iD5PgKkczMvE5FLi3qxHnzIVpUhRLY0 MHXS16xtAKQAQ14pwOnXQTWiAaAwYzPxzZOhpOgAo4kRu4lHeyDpbd6HG+izNhxPwnume2bRLxHv XhBh1f371+8gYrcCL2toEonYF4aXmNBOeHS2W+qAAI1fehq3IGYfqoP0s4bf01ihG9AtDF60xYvt i7YE25iOmcPwP8JZGpB5o6QQwmF2z1lftZbzq3dfZe+//ZB9/+bdD29dVhz/CB8K/YmPeOCmGVPV SZbmZOwnDk4SpTbVNOAbb7ntsCH3lQ1pXFcPpnBy6dIgNlyH1+SjGu1nu41qtvdC4XXdbUBoSup6 excjNTQbpFmYbkS52lq5WArvG7LXpZcCeFvD3dIlNGvrucVpc+4qZrOaQtPFfrV60kFiPtRPGPXP Y3tnvh5mvd7ByAi79uALmC5y1DJsw5I85sTBksPj2f4EDB3Wkso47PtRA2g3KsKsJiCxmzXsM8c+ k3GQFFSB82uM/cyFOVCaJs1Fg0wkxgT1WJFTswczYREmpIN+17g/x0Ceey4A1LLNjhr5L7fhfQt6 DhqOddfHUY27cIi49EmkBbcK8CKQ62C9wBrkoF+Acf7Tn8t0SgYvhMJGUOqwFu4zrEhX3gfuirVw W2t0ZxaIo5qV9wea/Uta+wQMfs4zasPZEnlHg50QhuZ2QvfbsF8LvHC0H1g4WgDV/pSPrRmfzCY4 tPKAP3+HG7/aOAeQlRLOFKG5yxxbNqH6UM/qeQzi2LlAydAY6KCPxZRLb3Jz9Sewi8N4+VY7MpQg qVKdHys7r3kCcixt14x1UBFWlOpfIkmZm1Rvkk86XZm4D/YY2wimgJcP4oP4JlAo+ykrsk3baQH9 yR0q78iU4mLTdN1+1GgfmOyBeOjO6HcymvYEC+EOCgOF4pR9AwuUJtn7epPyEd6ERrSMcpF1ACUy QobNEOAOAOcHMAcWzIYXeekFGM48VhFkSNC6n50n8Tcov1x9eXRiQZVTMJ7GqUuAHM1kQfFT4PtC 7pMo1BEGBE+vWaaz16PXDH8rK0mz3CbjrTTFiKjB4ZSJKegMa5RyEFR7zBeSCiJjdUxvwI6PoJhK puMSbbv5m6j92gnieMoumPVNuP7mWKLhinVm6wyjMv2IoUgYpDIBWUkGdD4HCwR0ir0Z4FT2NwvP aHPAld3wvLeAYoZddl4+6GRn9akvIMAvswrrk15nT4e+q/qkbAdpzpPWRSMUKvCIYA2NmPSzZaJR 53xEhHlhCQDoH/Ar+kt7oSVDe1v3Af3Z+4VAYskn/HfvN8jLygfwR1dp/9AN6G4R8B1TRe9HWH30 VQfK/XM3pJ+A163UuupcKUEgYhBHOwP6c3Mr3sUSOH8JL4sEY8jIVCeoI3sN1BWuOGb6SSYBY5Z6 fZEzfj3wvUVODgagYLGw9l5hlEZzG+Ud1fF5BqDXhhwG34kWMf5UaoQvbalhFnxvXdKj71XNUIUt aIYgfH3OhjX8zqbXRYBrkhQXzVxLiVB2QQEYFX5ThKAr6D7r7r+Mc0BbAuAlBOZ4pVQyY3bHs9+h N5gaHYkd8OCyE1gRFXCxbzHZqvxdXIAVGHXK1oujBhp3hk0sxGjUAUQug+a9Rr7/ZWf6Yh625C6m /2oLrmcU9ObbRZH7HNhBBccbe+cTEJb1yKREjHirNrGj5kjsKD7HgMGvhujN51Vro2q5SBgvZW2E kHjE3JaE32jE0KuryLGTJOKW+DGoU/oDsbQ6hEpiBJZPCVDmQKXiLv5QYad4KlSByx8ppFn3Fsgl jxX7NEipB2zsv/1s5H3k+Iyxm/RGXGlRuS1Tbn5eV8jGRdHEoWwZor6Zyn/A8BUydA0pYvcm84gB UiVL1jB7BxLEgLGycTCJIBgvC6A/avs4FPBF0HAQ1u6jLimqUzegp1m9PiI8/kBUPH6DfokJiSiQ 6qPe9cbq+6oSfwyH9Ck8YTivKEiqbwWy2/ntRW2aewHxcy8uu6SNdROTZSAjihFXDvyYJbwgZ30A oLPZM2QLE0XsAnYAphRLWOGGSagvx60NMXHr5KMGlF2OdMmFx4gP6+qTgLX2XOkSKUsoBdYWIorR 6uSwaQwtZYWiOOlKQyVD4+IJD6szpHE9M41iMC7cQ/fr5gGvIcNkA9y+mfGXQeTxSdpRLdqJgtof OBSeHAiRVBea3WllB9CNdg/kTy99r0ElVwXTW69W+x0OlVKwgOsrwMNAKG4131azlmENqkcvMuTR W1184q/rqzI7y84PLCxcesUZ1fdF5nsitmUydIyv3t8bOXO/Ie7Bm66yi4LoqfHHIwyLmkZyje46 n6R2T51Qzh/IFzDgk/CVbbiGZl5j7Dfb/d0d48vR3tlUlIVhTrhPPs9YHtb3QOe8YCPuWH2j2Qdi E+Cuc/Hb2NRxfbSK/6B/zE2XKkd3ErqGuKuCg7JJhiJohShaB0+tzVHjd89PkDtN3YcCKB7kzKVM rebjpMTqEuh24o515NKAwcm7YHyNBJcfPbxTCBjaEZLIfoM+HJS0CVxGxNdDiow+mP98abi6r4+A SE2vKqa5tYzhkbKos5trW0+9gtoLTz1RHtjS6ZSImOaDFJdelqhP2S9dA492i87GfOAcosDaRSIw 31371ALri8ixGlmCh8OIA9Jjl8HkuL5TB7r2qYigqQ7Ku5eci1XH1ElItOJEgP3o7hK+lRq7eiNh GuklJsQcLCGm/aNmQIJCdPinS4fBMaA2S5fXrCnpXjkcebuXyGWNfQhnNzsEKHHHw9AURvoBWs8Z aTsENGinbu88zaONrfRPPfjv7Ns9cim4G1zukfZutoDQMHB1VL7rrNacg+QRsdbJbGUcgztJ84F9 M8hfBvYsFFt+oeUWkUa1rjppVzntgE6lnACU6VGgSpLp5Bg6pt0BCo3tJ+JCZY5pCKLJyCtryVJp EUoaQyVg9nlfuypSTLYPT9C1c70kAt7Uh1my6PFErQW3P+F/1SIiSgkdbcGWxT9CAC8KVxUIFAwn BV5wGdJVF0DqfL8++LvTMOc3+6WEAFM8rPhOoq1xJkSHaY7D/lpD0GOqsQgih76E0Njx5mmMnMT4 ykWMbe9HHoDJVSqrIDC8vK1mNnQbnaNdLe/ffPO2GI1G5dVVOhI2uldjQnhBnbUAJsCTBiM/5ooN AzF5IZWBB0pU+I6Xur0N1ll8x2O+2jmoEtiaEaZBhAqIr0ubG0o8CU7dgaxSVxRpic0LipDok5RQ FAWaAFGvk7oo12/zYaw7KENcVgfj3RU1TIgeOszYU5wkgpL1ay2JiPImKbMqJGjIubuYOlsZZ6dy WaLEuQipt1MnmRtmOzPbLoXR55n+v6dblJSRcEkJvWVXfTwUV1fY6tVV9r/amq6upAvmMUXhwkPs CGgXDbW/upJumAcWL45i8/W96VXlGDeObOfrVqDG2v11C1fqmjKJgCJUVST9fKAc8RWdbL6IaWCm m3+AHW7ts79E8oQAdirWB1cYYQuurrxlgOAIw1OKh7+oREFuXsIVNct8pFugZZGKl+I3qtu6BSZi ppKMcjS+GpMCeHBXAZIhnxLKJI5dK6ZrVf2RAiDMmn+sm31rukqQa3ZCAswxeAn0dN2cWZwFF5oC E0oVdn1PDtHWz5+A6gAt0XC7V1dS09XVEGYW6DX9pL17deVn39jiouK9aOYdNNBzah/RMsy6wO9l fVPNn+ZLi4PW0TXZjmPgCQksoQbXUlCMS13mNdRSKLhVYXHSdJ/94jVrM5Ig4gHtGdw/SY01R8Cq YoQoT1zfQzW731Y3v1YJRUwJ6GE3i5JiORw9KP2qrG086kb3tUa4WljoQvpzJEr4Qc9ZzT5KjnWl m4x5Tf8+QrW7lw6+yAGmxGxEhsYg28kMIB7YyJQnVXK5JYPkb6A+8I0ynUBMhfRYGafKg7NBZtt4 ukOrvF1BtwQJkG9Q8ogQ0+nYZkVXR1vSjk6Latm57D7sJzVZeAhqz5JCfEaZJT3rBslRid7d2aWY hgvvKwIXRAFqC3JFhbwnlFwkKDPTPEVe3yA6jbswIM81TCioSSuEz7EC2nW12zHfTHuNLOkByyLw geZuBTYfda27jEx19XqzV+CoLEaGMJzOGUfwaxGEB28kI/wtBKGWwvZma+yGbZ4Raf3MmKjf7ovm M4Oy01djuCe209m37LpZPB3JLHvSfMQxHUdePD+IODJEh9ZbUhnYNywLFjQYM7WdnCFESjONyLvT D4KvV0TAegxHErev4uD7JrPdL3ee+5E+K6k6YhuhZlepwtSCBW/wKC9TgpA/mk2zKQJLU+I4q44e 9itSgdnMr/E0nFImA60hGbGfW/F8PxulmOEEf87Ir2zCQBPIHG3t7GBRNqKGDvYDmkSGll3Tjddk d1YCGcGD6OgTllYbjPlfG7K9wWu1VK8QcEf5M6mRDBxV7V4CMbyjtGsd7WwGkq5TVfizPVRCbfks n7t4BOQkwGqeIR4vM9GEaF56eLE3DlULNE4aGYuwaRmmkpFvBfRWJ68EdN0dQnpRWcFlsJJ059KK fV8trC89pKdaAWD6Ux5lwEiSz0Lo5zDY78+bdfHStL35hcu2MVXAneO0845F77zwark8SbmDzrK7 +tZcYWdLc/sshRez9xnetRjTDlBZ24xKBVAsFm80zQj923Gnp7CMdH2i2cbFWkJM/s1+GX2xRGB1 a1PGrO9PLklz+RcywLAnD7LACg7tABM87KoCztLyIyyU5K3/aU2YH708s28I54cAlEFhljg55aex 0xGlyLH6XBZPb74tZNfNUuJ35si1ObLdhDTXH+VDj36rN6rV6LyfWlR1TUjgwCfEhMQNx92f+Eby 5D19KlbhiCeGYEWCHl+ZUwhJA4AUgg43qEBUGtVCa95JLw+8qbw/idLx0VXKHxH5NZu12Qpoe5w+ 6DQrQEiemS+eWvC8N3tMKoCPVtX8brau5232Mpsvq9l6v0nwOweV7hrwBW02nxKuZHXBZTdnJApU 07o5AH0diG9kUWMaqhtrMhW70I5ZtQBK7kW1aX/dIaA9u0+fEsOVqf567Mh+vdCe8ikBMCaKgfZY SGiAzOdDPMWsaSA0UCMx7k+3y7929ufPA5//lIdCAKmm4bJuAmBfjhQSOB2gDbMdgx0VnymUHXkm vfCrwfmxWH0YUzCmqX3RdtDojQxzKBOjYgwwyj7ODwyt+Iy+73XWYz+caPvhUT4LilnxahHnyu5K NJRgogJyZPE/f/wUTxMe4GO/PoZ79hjQuxtzamGr4/WTQnU9NC3emNhYcJwzSJdPxEk3POh+Df50 a5+mU/Ocvhov9tILKMH89F1xBvmvfA9sPNAvtl/YFOBEYdlbO8EMhXAF5KQdXXfALinAGpeyJirp /ArJb4P8qIgHpaEW1eh2ZJ79IK4M64oNFzPllCXOkOhSTVxx5vat+IbQuJyHlsLGZzQxjlMIGPAQ J99D1S9dMIJlatmVlDmvdfWgz6hsEV2jLZJ94b/QNZWBH702Earfam3maMaBc7IVOxXzM5XNw5YV knYaMIfXgGi6KJ21MuGbbtlLrguNkslkY07yDsVtfO1iM8OU0lo5L46/mNdUJeV1LwOfANMbkNXb W3cwiMjD4QiPxu46cdGZ6xqR5ibymum8a0eckfU4Qp++S7+4YSl3cFcAkCgBYmWP4+yR0fKiEau7 gAYkY9PUCN50h1xzJ/FfTBrCwjY62shZZEv2OqsYq6vaDVpgKNuexFiK5d1llPBHe+q0WsC/4XAa 9kTIUmwC3tpdTEAyTTUuyzCbqpsc7kY0OuC7ju94aYscncleMOdBSIpZ4Xfk8/OyTKUeEBRCh0lM ItU4KYfi1l1Xoy2jD8aZCaRLDqmwTEVWYy1LrkWDYg7MFh90WB2ut9Xs/iSxZxJA4dZbIDxlqczm Cn3XOwLsde1PegwzG6M8+JxlAne2G/fBcFM6+TF8i4TYis2K4R52dLhMzjnXnJ7bCBU2Firo6OYu 8wgB2jaGQ8cNp8nkMP708wnI7Wr+hEKMGfvTgSfZMmV3PXAfDwSs5uzMAqFe7DDEZ3d3OcAFAbVK htD2hpKp9FASHBndP98DZfUPz1BoJ14PQ+9C6LnJsCbBPYY/etJhmhMsW8ciWqpmkaBJEFFs2sIO OfLPvwIIIVeFKaL+Cm+qZWVVzPQzLGA7iGV8AM6e+9KOfdfseFJ49LsHHfhtYUsTlhbeKt4CDBVM qT6KNAtWtONJSUOk0ktL1/yKvGrUxHXDtnrIqynY1lSfY8hfW42EeVtT/1Lb+dUaIJn3N+Q3jLPp YSGxU60PH1wTHgimt1gTm8EYiOhAucA37AvkINnRMIgtspn0K8o0oqJlbjAqqq0cDdOZSWwCEDA6 Iq+NhU+0kdRPJccdRVMJj/Irs68YTYEHQM4ctOmMUAw+KPs5jrazn+Ayoj0b4bxzgtszp0IiL/4d hHJQbCViV3E/EHjS+qGDHIADBSMUep3CVYPormeU49H6SnbUYd5QCg8xt6IXlgXLgupaJXQAlTN7 AoJDG5BUnEmWXONUCg9uuupq+a5ZLlpvI5AZ2e4ZlQD5K4kw2lbL6iP4dVKUK+DH1/P9crbVVuo3 lAOvni1tokZbaU31ALzN6hrxWet7Mj4zKugZfHsmZhXwK+VP+S3kVDFPz9ATcqF6u2zixDpmSc25 3m9c/kVPlj7T9WfiDD8TB/2XuOsdVi9aGvhD30NWDKk0hB+s3xonC4TXOmwxvWS4k5rVBjBSeZJo PBTeKA5Ptr/gsabz2MJLmXcpRLq6epRVo+hDZyZVYEFqg6GHGzIL3B+OQ/Z6j1kgaNg/bugaxrk5 U7k+W/Lw9QYNMcfunC2Gbv9jXeieu8SLgcddb8ONHEQmAwtmRAHTDHAxDFDCCzOdEllMuMBOEg87 ysIVnywPLzrDo/3sEqEy2mU96Mh9LdrCVA7sRMBtBCrUVtV6s9zfmtkm56Io3BcIQbU1VAGKdpSh hkD7m2qD+OupIRhTPp42wWGRi0OuywBh6ilydfLystTprfV4R9R10U2LTUFsLrC89C5XhhXXKR17 zOHMpvOeZ1EAd0b5HwguANOUqyxieJ27ZWTnPFfeakjLI51fUl28ON7HzrPZ6vxKQLm1oyJ1MV83 DvErMu9CevJeRSUKcRIYen4M3pX+4H1Homf25vYy3rOWwX7eF4WhqlGbVpN15y1O9Xo7L4pOJvop VUrtepZ13Z0TFtSjvsH8pIZb1CV8xD808x+KUPci31FkeN2T4YTLFbrRTzTjeEJ1GXq78SELKLVK zuT3+8guBKMrjzjpF+wnmQIr8L2IHBzs6SkZzJDjBZgrSXrnXNNR4qyBXa7nmbmtIJsdcjB830ji 4spWKM7sDxWHxWA4DOWNR1TWatk8RJ9j85ZOCdoW0sKpM7wKAAc+980q9MzZvdQ1kCJIcTYh78DG rilRygeq3JBAEF40CfzLYbZgOJi1BllqnWEF5gtNFJunFGafHcxmtKi3aGErOTuEZxAmbUBSqQJm /g2Gt73M05oV20iQOWmjkiWF0CVaVKKJi/MOReuGudV4rSXOUsU+mTVCQTHcNXZP8W7xkm7h7Fvu IHnngjmIShS+2Oy2WHJj0Vi7dq43DjEXauZB3cZmVoKIJhvJAlmWlXxB5IWDNyGpnx/KFDInvrlY cgbJTmvd6elgcBKJgHALqC3KyZaSSQzpXXpX1ZzUj79P77zqcWcknK3dexf1uP78PO2qDb2T8sgf yB8c3pSPuzY4BTsG+X9SUypWAzuBpZdo3VBJlGO8VfAjPbVzFXiZvULlRMAfe01iQigfWL16mjib RRpD4/ESsmyN4mS0srNUEyl2Ue5Tz3eVbzhS0uLt6KEdklQaSnRKMmozy/TcBpF5MboHz17rSX2G cx+hC7u5bOSagYQamFdS18GuDr5W6Olh9jS0CbLtGQvmzlvSzQZNKHzFUZyOGeaWHYBAh1tTnulF U7WZIM9qh0po6WxRm6X4WG09BJHZLQjvcDKr2fxOD1x9X8in6AYEinT4YWeU1BQU3QhfvkTfWfDn fzQr35rnSm7QeD92EUOgHz3/wsdo92uPhsW4Lgh3UG1vK4IGxPzw466E47bIoYzjqU6lD3OqpJgE IGG4M+RhJ9NRlL1iJ1jslihInjkp4eEOTFjyijOIp/oSTIarrPOD1OSl4ju750V59FOW99edWfwO 0sMETlBXosE06E9ifg9B/nQj8HRLc2kfqYPjjnaGdjgrOzjsflnlJGRYJDMygpIIHyB6Wg1E5a+1 lOhJBexsb7ZwJ7zSSdq6ljZH6i0BcFO1JPVKaZwgstUG4ZwcWJAum5631gRWcMSK22ErL/gikRKR KxxaHEDUfTxDYqTgrtDVvTyJmVPR1UKGyfrmieymtOb427tEW3AdhShfDzeC3Dm9WPL2YnxJZFyK TYnLwJDxdkhKLshJjymzwm4xbPLUxre5Dg2RcwrQDllulAA8ULAKF7oG9foS+4lMs+64hpw9hSBc 761VyvYkF2rPwakAwaNCKPWjEXy0H7QO3a7dpUt8moRJY8+fVg1DKsK1D3Pix5kZNsxPu6wt6IhD 2Z7zNgtsa+EghXvl72T6Rz4AO2m9fkpTa9uUJFqYdFZDJZ5B9Y+Y50jGVerDM+icH8uBPZBUJWHf y7ASnYcZw371eYEQBOGrs8IH/CLb7hDWb80hF4giU4ZrqLOuyioW0luVUmW2Kjn3RUyzOlFPEDzc OZAXha4u8KMJ8AZBHY3hZSmcQXFE6SeKRHFRiN1Whos0ImOxLLtYp7UOZAvEeCeuTpvtlPDmkXO0 SWIEr4sjk8YnkeDYl4DFaulZ2uNWetQmHV+M9FeRAkMKBVwvALXa6qxY7FkOetVKifKozrBPyiOF dKEC5lpSH/tt05BF62tLyU5N7hOYdknWWMRVdp7+04QNjQFvQhNUxtapwvyLWBSYKyBM4YZMTZXl otvh6nMyT/q+SozcM1GSKcP+eDMqzlRUupOB4VkIlWz2xFH3y2cyxLaP5szM9kvR9FNlASKOVm5L ggfg+6MuXAbmB+66yhlINQ+F/7LJq0IgJC3N3tbzTPLlkQA+nfIuMqtH4TC4toDevwev3odto/xr 4j1hbbvHbaa0HUWlgjm0Nt1R0M6Q7ynW5EwcndeHYY1YUcN/Mbd4VAWY6WK+e5zwt/L3cV9bGio/ yg4GP41La+4d3oZ8Z1xcJimBYlzvZu1UkiKnts0bp8BBqQv3zbrJ5Bsyo5Ny5MZsl12iDlSg1Oh5 Ylaarf4M8atWMYahc1VUjzX5s+q+oNcDKOUQ9kT0vGY/JiqggGVt4McqGEt9gRwba9vb0UmXuvLi hq5UJbvYOfWmMpj39M6XWrmmEvoZeDerVR/R9BW1F02epoIjvmXG/QrNpK8kqAs6lcC9+mKpr+Ar 18zUAIKuVREdIhEoDgKP9kgz3gOD0InU/EzYBZbrPdtQvHRcCpXzTKI6XVxbOxBtCwiKhxABbWL0 z1BmJBX16sh36uwpyZqKBtXAk17QXIScGPt0JrlZRaDsQmsatXTgEH5AKWLBVavmY3UMACZ6PTo+ TnWA0EpCx+WkTLYcUYO6LwnByMUJdQhFGJQCYadi68a8Euq3BrXrjr9z5TnJvBDgCeV9F695nfgd TyyB/0QpeqMKdTZPdFTO8vFP65/W4PvZQhww4VCBy8LaiEslFKC30pX4jttQUKMFKyAkuKWdimk8 FzaShZLNDu2NyjMEGIz8ZBwiV9WtaNearTfAUE/Wsxgxh9feTijt3NQGapg+1qA2oBODkp5A3Kho JCUcbp1uk/L6Rsl8UcXgQf9BhnDIdvO4m07zBM48fpFkd9N1wdNcKzGBbMLDwtffW63QMack+F4d jB92zebdDhYjyVpECoP0Hfm8tUILqr9WVikAAW0r4gFmFLw2wJIDb04SAHUyH6lkzpgH/N9q0/ki kpLAOMsh2J+urnAQV1ejLuSCd0ZmqGYLw8ybfcBofWT7Ar3AunK+rS/tOLrqgq+XFZvCTE8g6IZg RtFpGVe7QmAR88co2mzdJ8Bh8ATu34aj1wGOIFfMauw05aGJTH298XK+t9HQ2sSdjph8s4j9D/l+ y8t36zo6cnP05eGgPphC/AO5Jr+I5ixdQZ0Rzw9xoAzjXnD3MUGAHpZJ4hXBtHhBkfQJbJgE3XNA w60oq9uTpPuchYOHbXQO9cWjeoZH3STlXIeVyBKaSuSnX8D2xHUqWlyBznAZUJ4Bzh1U0sfwEM8S hkmSrTGoJk4dr9J4SFMEVRUWLMoIpWZdAbhKvUP8SLxM5s0KLjhIZaVt7UmEhRSfxtgKqqnNtjYX Zi7g4exG283tA2YfZz9UkFifBnoFkyuoIrRSTPi1++tDnMcUNXTVgyjpvG3pt0VfX3DhSxdXG0Hl cpEySqIr268PEA3XT2oW5dAwi7mLRHJHR4t1bYG6Lomhou0/1xA/J67zhhjvA+DG0yzsnvWnwCyj D8323jqE5NCN3FQLaqg2qGfWckpScHsCe1RcMbkzrmZP11VSluM4Wb4QmxsB0wq2zVH2mqj1w/Zo b8Yxl4RNMTdyfHi3KRS//IVarG4jtt+W+muEOj9zIYb9L/8qVh+7PZ/J5R+fAF4RcaVU70knrahF eDf56HoROKAPDHgstENhsR0gqAuTIQraFPygyxt+URTOhFAfTmIEKR2P6uFHKbZh6DaDWVmqcTot WdRK3ZOcIdXdlQotgOy86ABBBxKSKY02T4M2+zjbOl/uUzXfEvJdt8i3BbHe22q2VNgNXngSXWSy XrokCj4PW7gaF0b28ebYq0//OVKfiKSomIxIUPIYEDcKAv13w3AsyasTe/RVJ37hRpWs+3PS8Wkn fR7iht25wE3/4lIHbaYHeBIEBAT4OIUI+Obv7ewBfrpRlBevLmUDg/oljBugLmEC7akUGXSeysSX U/vZdCp5YEvMjkXjMryjahpmRP4sZVpVkehQkbJNBn/h5nd8pj679ISJ7m9MuRNzoSxvGyMT3a0I b6ohz0QEOYf0UcncHezaYg5fzZqdbh+M+nbdgEMQUhnn9en0GJap/mKS/TIaMtbCnvvgtripAS7n ju3alFJAQ7WYgb4k9ErDrF03DLd74l3C4E2CHDtsarSeE5outuWcMltgcLCWE7kyzQ2fG1YFC+Yu WhPDa2c2DhIkQaqL0HpB7c9V2O5xOF1br+rlbDul4tYQiv0JH7bLem6qQ0sQ43Pae13eyUmmU4rw EDBDnNlA7SiphC0pjkaSgMJJF2TxnB8ALqPPpoXdkqRwMLu6mUCHHo9GF5aTGhaXAcLZUbN0oEfr vo7oJRBBhJKtdPONqmn/E9nVBZo0ddWgKvRGAdg6Kuk97CucbiBq+CNM3GlLoFU9HGWpXVx3r9OO UZ0chr8RP9cDvPB6Pb7sZlNsB+Pj7nXu/Jmd050Ze725HKpGux3b/c6IUliRGerV5zR1CQ2XfyAT fVcFOmmetMtt6jo/9xcgZFyOOpROQ2Sx2ogeAfUfsusOXgdD5Y1/vW1mC4tuhVTVKY+Yw7Ek+lfZ L9Hyre9iTzSYt0lXtQOMNPeX6Zy+EyaGlMVEC4niI5K3R/IyYwWLILIQJJvkdMH56twcQKZMBb53 1qOhP+hB5lBsfRQ57tz5GL0KkONMd/My5crKWrVk3+OgzbYDBlj3L5ZK2PXMb3GYqaxyyVgo+MxO 2jPdQOzAPVe15MS9xolDZvm/snmz2TC0nU7NWuxP0CkgW/M26wnpYCzb+PMjzGjaVr5MC8lLfRel Gzq8K8wff8ONcRrtjF+KFJbeEafP3hKnn7YnTo+YNm2bFJQ1FmFOD0/fae/8nR43gWLGkAIndHc8 guKMsoxYrzieD5DtlOCTdJqrb2J3M/iujCVI7gC8dddW5KcWXU5eEdF1oyVph3FEEEWL/i7wDt3s F+oqwcxxckt5Z4+r90aXc/44pXzhvO1uxM4l4rqZbRfvAHpmu98oZtGldOCyFn3S815vVpUFsaHw AEIbohBigRgs0G3nxtC/+6xeIYq4aF9VZTaemHR+CNzBKsfIHnaS8t84+fmffvzvjEg8XTa3I/P/ n//5w3/7P/27fwczB9LbPDPPbtGjiKuZLUHhDWqVBQuBW3O5zavtS2vpag1tBNSbE1CTmL4vyeqL zk1vvns3zgrSPULaE0wrAuAl0A4o359+rXyXzUOzEX+Pr9LcH8RtT0z/ofs/fPjq2x8/DDty2Vzv b48pCCp8c+NPfDsyfIXoEPldtVw2AGL20GyXi9wvwh8nSqWHhL3n3xYjfgJJBzt41aOHEYwD1pN3 0eZpCClpxYD4DWX7K2hHdmOXSUpDxv0NLDXy1gzNJoENzVIMpaCMC5gadb3rAn8VoDjAn2x3W4fI 5vlHkdNjVx0XL9rLDH0+8jFX53XYB6Ntd90KSzLTUWMoqjGcCY7A1MLz+R0fB39CozR8ZtHtyYFD wbqC1pDuVjIwivEAj4ZzdsMUnQM5bQMLya+0DWg1ai01aHeLZr8bKr2bYei3hEcHsHO7+Sj7EQ40 hu5CPCQkNnrKvnv67unsfHQeYOzwljHLKb8ohNMw9M0DA1nN9+2uWTEI8AnfkDjjry2d8GFYOvcb /4I402rL6Q/BdOP7zouC1H03QOC2EGZS7VTSfMkDAdQNY+/7tnZ94/cu7WfiF7E+0FPvebpV+41f 9nj8ZCYVsiuzFy2o0TP/MNgxeofBOj2Lr7DvuWbGPpgOMBbHvEhlLPWlucB/0m5+McBO8fxwa2ra P8/IS9dbGJ1zgRkuri+W3PmFHhqaXWRcnwUEDc4qe4HISbSWuw3ktN4CWJV17Cja0oMX8KzK3rKB ytl9FUx8gODTbSdzxjAh3X5VFpidCdI/0vNvsAsd5L2LnHedVQCuBW+uPlIZ1aG1VZQNXFUyJPew gx0ZQWKHbYhMFRfbbxZYNVbqddxbAUdnusAl7AzYsHKXKdeSjpPAFspo4jc1GH1N8VUDuc339Q4h UW2VhsQ+zJb3CPdpY/6B7/OrA3yY2fx+SFDIrLNxy+2U3XFfZylCBHuLxmdIfnHDKakEZ54pBhOp MpnNDfXGGC41W5sNCBKnncdh9mqYnZ0f4xXXu10ubBLlcX15mTK7pr2Tk3Jm/8Y0uwIhiWHAg6Gl z/Je7Z+2c/8M7ewHO4lyStmlIYcseKgWMcwAb8NFkfDANdX6vnQ2wsU1b3iXQ1edue8BNo2u0Oje K/1cCIkL1dKYnkvVVjuNbstUhI7axtDFMnWPfHjaSIoBEJJfbIU42pSzEH8KnyOjZ6ssPapqV0BR VouRZjb99d7MTr0e2fivxHoqJ1qZHillpgcvjUFnslI3jLTXIJi/LdIUrZH0JUO39mV1BiIiDtI2 W4Yp7S3B/rrWgzhAMO1puyQEIHxI4np4HArnhw37G8gPF8ncZDgOVN+hxIhmBZm9Blho4K5PI5aM iDcd4VwC14+tfY7ou9idmHMyHfbuuILN+vqsdp7SZI2jA5/a+vn+UjdXZ3266Il3h/pZFtIVuMIn J6cnp9mX3JXW/GU9QZdVLHSAuGn3BBr+KZcz7KYCt1MpULB9DqFqU7PKX/b/jdv4joBxGXXOGf0a bd36+MDnoFQblJG3HIKv33SybXGK+w6mDaZAk1dXf7DL2FW/TIkV7iOw/y/37V0yvTNVi+8Ly4F9 B5Bj/SuDnl4wDxTAjv1qSdKDr/uddQUmmjR/5Gyb0AosquXsqVpMKUU6F8uu94Ag7FIlhi6YVCmI 7kFCCTtc9pWFWZQ/w8W0jYBbrvwOwxL8/qUmFyYIN66WU+zDgBdd6fyYPAqY28FsgM7DD857GEIj oZrCH9QQ6/jbbcxEYnFQTUKDeXlgPj5pc0NrwQId3tMwYtI8BReBv5ndFmaqDoQ/IPTmUTehh0be fv/98xoxV8fxtwlnDXoC3ePhFtDjA8tmi1m1atZOIZI4leZqA6+ZJ/bBCGAZ5WVSXaA+xfn//be/ nb57//W3gcO4KyU///o70rBFZgZHNGz+p/CaR74TZ9VMKPC2U3iDUHJvv3n7/W+zN79/+/2H7Mvv 333IzGpmf3jz/ft373+bvf/2w7sv32Ywruyrt//w429tQiPqKFUzyXIYPURP4YNYmy+qAFrFIRUb Wu2+NwB+W5bHmJzRZ/Pn//Tj/8CmAQYxrLY/X3z4v/5P1JAj7NgM8cuvn+TiLo2ct0FFK6KicH4Z SWGBWYL5twA60j5S2llqSZ6Yvg+zppU/wWFtbv/aVvKL3dzkT0QVIhPCGqVBMSLwn/RuaqEjwfJE BThv1TB7+0/vPky//Ucq6RhkKYfM29SvZw7eKfz+d01z/z2Q9BNr9Zlu9tfLej4lN8ulO9bfrilT OzBA5LeH1VKkDEYpgtMVUJBZZuR/TBG5X5uj3UKL1s4jbgLK8r9ES//Fq0tE75zml9wbhmWYLRYN WmgKBPIQrvB22+w35MfREveFT4p887Ssr5mI4qORq2FwdrZuznZNs2zPmvUZmEp938AZGlAmOeZZ mO62e8hCuoD4mNxQYviuWcNXuRVBE3c5ZDqZFLnFysPvwBLz3ZsPv9NO27cNKStML2/vMKxxhVl7 JN6o9CbC4YN6yKCnlLaAUA8cAK6fzGGU4frtZveVU0aQzpiAFGR/TG/2S0xxSCZE2fE2esQ72clv +NC+N3skOK9hcbjSW4KmnV2j3VoS2Qk4reQByZt5rqSoREXhI4vumv8vMK+YKhDS2gD+rDerFvWD ayj8AArer9/huzfbW/vaco7yptMsE0dkdCQq0yowgBXeVpBr1aox4JGqRJcwldBZ5g/g3Wi6US5b ujRFU0/pT7MDuTj8FwhUCNucDCX06qPQF1dhpODVpR3LDSA+X5rd2jlzxOEhbHEbizcDJFIDcRGi YgGXNV3Uc1Of6Bq5qo5CEFU0gEeRpKNwTg4r9hdOX84VBz6AEAC0uODuX8YGATcz2Ytt8dlnL7al S6c4pUlZ2A2oF75zJj2k4EiA8N4CTdV/h4EGkCbR8+2hOmR520APHe41t5dpryVCn61EaksNswKU qqKBKkP8JC4G/bJ/+M5H8hh2ii0SINSz1CwleV8Fw/NVObgCNPuwXgkwxqk6o15cmAZKQtjEuwbB Oz6a1bcjL7vzkzHSmrs30/48wn2pTsrBEsSH+wpWlS7SgjoSqKzUGFQ9RSpxsp0ouxIUM8aHP/6g I3GEfBEcRUR7nzjORe+RzWqSqHIYcO5gHZaI5GkeBSkGWzXAYrATEW+MDkQGCYILxlm3CmPbjnXc kfnZ/3a/PjRLqldijNGYHd6CW9hOWPbxSQDtRM9twgzt52dm3OxV++P+wfJEhNEAXH0i8zG3FB57 9D4gl7BW9jQG0UVpJFrBj3kFBmSfXN/gyY2a9/Mx9/Y9cN3ZYxZzU+e1mTP4wzx7gLxKRhxDiCkz u8BYPW002DF7C0EyWgCeMrsFHGlMc3twszFtonZVfYAGzpcS7Uh6lpbccUAeAVtWy7XqZgzn+XBX KcdY7KqNn4EkRaB70PKibIMXZOxtXxQ4Z2UPjqy/pegKEB+23nA3d5EV3NxWrnPPmAGC2ovUC3GC 5jcErOibCpEQOXYhuFDUZcKo37ENRqKQGKecc/amsOxSSLXmNWZkiehBLzYmEvn5su1NsHkYUyJO 8AzzgY3orJDQIqV3TiK4DSOicV89+QuxjN15ESxBhj2PL7+aAFKYeUrPnufwCqXjpfddkWaQ3YBW 2xwkMOKqGZxObeL5u3phqJXpNMDhum73isnaQfeVO1HUjKQBlVbte2iN9qcjO6DWAt+MGwgxKM7L 0c004E4pYpAri7fjkMPXJ1IEedNXicSx68XQroRLHevW5KIeX6aZB7U4k0nCQUTpuszsFPn7N9+8 /ebNhy9/l1vEU2/Bguorcx0WOIqhmqMhN8uccdlNdKTZL3/39st/fPu9tIzplrHa0ohzZ1/kfd1I H5poYN/2t9HbRK/LNO2mzyHAcZF9HuRi6j7rfufiec9B05LsVXrArM0iQKTc5e9G3wdDJ2ivIYFg Rx565LnwNRtoLu1ndPjgUY7jvo1a9lGPzg2qsBRws192OTB4YA82O3c4GXOSuQBOe+xmQyU9o8Td nD7jIs84xzMoWB9Lp9JyXVJhBv4y/LRm9y5K81xGt1p6qpcKrJ7uPt+Yw0IMBRhgdMtQ1jRBXCFC L60NgV4B+5BWh/zevP0S3nboUuD9N6DDRBa1owIukK4B/gLoWP/r3WrDL2CHrTYfglJe0Kwte3Ky rR6nzX43b5Cn3SrOqPhp8XmZFT89fF4aWYDluf36e4yU71HpGFnUVOiSAvOvxZ5QomJlDyl6AggW qQI0YfwzyhUsBeRnAGdDVpuJntFC6iqjsmB88ctKtUFZGQj4QvLPAFGZ57NNiUmSqNdCNXujjY+6 YeMNEV206KsIZeKTLs3hNNrVBNXTAg5LZ4Jz+S59Dyx8WJRINqfIPNQD9FeElV2YopcYz74rvIDJ BEFaiP7GbeO/XIPovf5SMlOKAo+zRlk3zlAL9LTzaosAXiQEIy8DPH3CyTEbxfDOjO1EEdirDRxV kl4Vx9RW5k2iY1T+zkg8SyNnVGtIQ7GrDJnJ+SSrllk+lSoUdkIgqQaOcOevXh3j98Zdn0hvR6t7 IDTYKqEI1mUSaMRQeZTTRm/f/tO7Hz4ciU7tMwGUJlt6QD8C06JNBRYp4gzzCQpwXpO4wPwOBlJC IPvyAaRMfHCEylfQj/DP8hkOzm6HZwQRwpAgNLChr4LB2lM0ZaNy5OkhBpZZx4GzGQCRLzedHiPg M9csF6YjaW8Reiez5mVgWJrNyXGjLZmiUSNwDdlZlxCRu+B0xv4CKqUfafxQsIAec12i84vppCmQ ABZcq0gwUwIxLMh+MkiBqIsL8xpVCzdrD6da/Gioz2UHg45sl+twQi43W8KIVoEFw4drVwuBEV4D IgODJEg8QN0HmXWj70EV2P21TdSY8JCi750FZFBiZ9VWhrAQ1H7CsKydxUNvp0KjwC6jaesoNOx0 fY+ELarNH4LF9IFySkrGjRqcH7OJpSu0sNF+Tjq2HHMyYHaXi0C9aJ19hhCvMmRtIUN5jf0EMCJZ 01u79z0UZ/Mi6IHCghWv0Omu2QGGJ7qOEG+dALnfFPEn4o8P4AEd9fnUmvPmyZwevoTsaJXu0qbf G/JwfMVXmNrTkQ28jRN4IEj/gnXGaUARYbSuHgoznon5f3n0ZAZYu9h0WY7ILBv5tUKgFXSAAHar NUL35Pvdzdl/yOHGIQcnH8XMfca/xOhbpopv2FGIy4IwfJ1H2OEwfZ3pE2huN/FB2p24bZzaxZ/R NraYdOmgCncA4q3v1w/ptTmwgtY/XaGtbzC/uR0MCbhnwp/4NQrw+7HVbp5u2AMZP0tX+uxumj1e m37umse4QsoqbgbSVaXdwLZpriKMGXqCZphzfLeuids1F/3FgIjt4NIfBo9VBRQ9YykHgB3Wu5i7 x91fVL/5vrsBZniYdrBJ1zyYJBzXwB8i7bRGnhKKOpx0cU2OSAFDgDgTZR+bKSpcVdpNzr1cSJEy Q88F0yvHZntVbJ46K3EbRn3qyAVJEUZ2YZGKPEDCzURtsV+VqfAHlcqUty0g0XuZeXG1PJks+Fr8 dCLHhfHYei3AjHnpHOOEzd7rRxytzoY8ujabfVstyX/GleSjgb4drF3hD5HfK/iPCf8bIhxLI5tq C9YzSQBXXABez221xruHHZI10FN3sxYE1msXaGuNnvP7dsL+bGUCuNAjITBWtR645cZBF2RboLLC +U75oCmH1+zQhHvV/f94ztc64Z/pWJjzz82kvDQ9HIUpgS1AZWhMom8oeckywdfQh6J5lYmy3eKP yvIQ5OV2j1903T6nmIyaxDZTVGOKz5boKuqnL1TaWKo2uKwIdxb1KqTtQXMt5u7dulz10BoYldGJ mRO54IfUBRdWburBaixUa8CAynM3CzSGSfwpgivi2yKeNHqu0NAoUwco2SDlIo3Sm0Nz17HzYnDf efe53MHBLC1FBtBVGO7vYnOZvCtcT4rPlj09PO8IH2akA2zSRxe2rDDKIj7M9LNGkh4CS5GpQahC zXbXOgnQCtNtkQdZL5fNLb3KkwYA/gzNAL8c2ppPiYN8CbvvpaQESIiVUPji/DKa3oAWfNbD4NRr s5vn5rDiMP2JGZydMX1r1sunwWVyHTvaYIw2bzZ1S/6i2iHNdRO6vM3Y04qrXBuyVtSWIlsBsqNz B/uSRjWOXC4iP95HYSVSAYlm6YWrYgoT6FT407KrHeggzzBr4AkjKmUO7sZNZMUAz0rAUaa0kOIz z7XxbBSRcKv82tXOcPPP/5bx8TH/1bcfn5PYxOIdhTlZw5LYpMNIi6KYhn4achGa/uC5f7fZx7Fj GH6r9W/mUKDCuVptUlGqvpo4tvYi1eKJz11VE7ZSKj7b/B/5l4FrTq05+UW4kAFP72bZK//9aGqm EFJl87TRadLa6iQq0v26eTC3Iidew5sSszIvGkFxrSFR4/LmjABrg86cSmjkDOP49y3UDAQ6w3zv 9Q6DODNzh8upW8ANazisJWJ5zdZPOmmAmYyMcCAfwLNmPtuYXQJO+mQobnfQtWvEh68/QpYNSHr/ OAMAJT/1DIkdU9VuwjFQBSjDBPpui1nOlCJPp7iMvhgtGq+9kJPt/I772t7td5Qt5+QIa0A8wIjg 8lKlDhX0L32uOpn34jOfqvNQzKDVFB/R8eVsdb2YjRP1eIt1cDSW5cNhWDYI2EWESs+tQTtPqDw1 19hGbEQP6K84tgFSnfhGSJud8A1QOiSLRriHeHZsxvMUI6X++Kf1i/YnuunH5OaQcvaTph0fyFi+ 4Ty1/kT5UaDmmlJzQh0wz7p0P1yQ2ZALquDSb1NV4i8QrSPspQkkFgciA5qBKLb2/gFsw/363XGY i4w7LPrRP5+klC+Kf0SQJH3XSncSCnf1mSgzIPruNMoFICfooBwMTLudDWVaVWG5ovgQlYcv70o8 mCmh/fTwxp9eP+EsiYMxLlKkvQmEPyo1mq6qVSPSb8IziD4Y9fsG2XOLhT1XpkpYPiNw8D1F+FsW dytAr6rWHylayfyot2YHBCEd5vHF4Lt//vC7b99DkNfg0sU2tdWGtPAetMeFv75gg2rRp+dhYWgP eDd+JMwTVekwGwxKDa9//3AxMAWxNfNvlJLGPMuH3hunPEV93/6aueDRdzgpMh1HJ7HAWZv4kzfx 5tATvYXmcztdalGUiaSMMi311sBPUjwZv1I86nnKTJLTONR52rzuKmcGqMuxtx4IzoZbyNXGyuf7 rflykg8DtZ5Ok3COpxWiRke0OUGPeg7ehw+4gOYdhP+DJeU/qGZvXqe+e33wu8jjAXiwCUYKjuA/ gWEHD4wlI95GkR1wc25X/+Z1vH3my6atpjcLQ3JRx7yc7UDBhU7+D/X6l6/zKOAERQRoa/Qw8x2y 4SZfhhlUz0fYRpgV6nX0uGeut58419tnzTW5a5kOG17enHVyOEe/qDD7IPpqmSH0FfwLZ4PO22K/ 2kypZjrHNva/pyQecRfAH10K1ouuEG85dJQb6m12ZjaePuCqejrn7FZ3s+lNn6s8zvCDpAusWDb5 rEJBQuaY3CitOXvx/AimpUX1Fi2YqQxcUAn70oIUQwR31xhGyUaKNDd2V1BG082w9Mnh5um6ForW zg3HsCNWKuSJIaiVaRstA6jA4VvMluK+BL0KwnemqCoSValJT7pfWdCZOD7P44iYeTZVsIuYHyUd XN3kLfYACLpG+mrW3I75k6FHGONg3my3INPxZQsxM0E9D5VOHZkrEIERpUODmP8hVV8GBmdaoAqj c+q1kXgIA4n7YqTNanQ7AtRc9tc1FaayJne0GUUiD/tyUEgb7T1EOfOQzEqBWzaKv3HAOkrybn2C DbW7a/wdBTgXFYLOgEd2CHKBbwJeU+8ysPJRoSIysieOGTUpWB4ury4/J0JWdm7PcCp5/fy9qroU eLlIqN2nbU4Yd+4AHf5jbAx9sS3/o3h7Ax4zGiWtJqXsW2esPI8Gnli86dzaWBAd2BON8UnX+ph5 5hKdE9yxZfOzee4aDDvl/Ak+S+j2PaYGZZTper+6hrjGKdhjJeDS1nWWDwNgumrDkLHbpgEvwYn2 QAsVblpFNnnRDsx6bIZZRPlOOzRvp+JxDNrn9Y2ZAvBvEkvsYxmUjJVup/7inlogEu+J6qxrZjIa DKOOKh3qYxBAIK/8OLZHimG79A5ySjvr+rAZWLXqxavLQ7cE3Uo5k6Zcll15I2xmD+uptzMI5G/I GOdTuN2BLTx/NXr1VzugPq2MCSOQs48QXpkxG55tqDtn2GGy3uWl74dcrUKPKXIjyPlbjca0/tjc g2DcgXrtX6R2/nQYnWGbKct55m1ijiIpqIWh7ZnMa5pi4qiAE4+m3f8zXDkn+h5aL54DOuU490Qf my2tgcyRoSCvR3/XgcoG2DiDzdPmaQqxALWhcACpPqB0dIO//zs8fEyYRDAwdATAUSOdKSucuXVT 59nf/112XVP+Pgb1qRZ+RzyBY2Jm30gu5t7PkzU/UnCODBySGGDdkNwTuJbaEEzkXKiSX/+iuy2t 1s9vtlV13S7y8i9r1VajseoZ7SwhpsJqj3yJ1kwr+oJyW3oTcVUT/pekHCNIlsHXI94toHTwtk+k MYXSFlnISE6Gl16AhNHHzEtipf1uRF9Y/8EOHv2rqoNHF//zd+8/vP3+/Zvfw5SegXR2RhXT3QdG cAR857OGek88jeloyKdR3YzamWFYIUoQBjO0UByxd3AvXn8A6KLxDTxPX3UZOIwOgXjpKeXAFJBR OjLCTJMYz/tYvgrYzt7IwM7K5KugsgMR3YnEWAosRa7INgUEjVcD1OcD+R4aLcXXye13GuTYEPww MZcnXOC9oUw6LfjOOIxKTzHrx/m1Hkf8gc8rBN31fB/NXNA3YgSGMpAlbZIrXuyTOggpDap1aCv3 0Ll36C2FVTzcNS3Y/XZw3CT4eobZWSEYrfVWJhFybqrRA5YJpp6He6UztIflWOg43kGmmhH+Adoo mMTcPgbGrlqkYyDEjUI8KJALhD0nfhZn2bLaDVpOF2S2YtNWx6dc+tS8xWBDkJFJUIjpEUDAmscS EAJjhb+PDE8SaB7ZOBmGnssfGOi3GYEVoF4wgEI+HqfsljbY33wQ+RgsU8jSHriBH62rTp478S+2 Y1PCO5XZbAeJL36RTE5shxFgUXMErZfeMd0rMpytaI1n5upaV3rTez3rtKPpybY9ypZlR8yuIjPA O+y3lU9nBs86xoMEnYGzdujMleRrv8GQ5moR96tacDvgAdmXiUCPY5DuoqscSH9X9Cmd2CDszbCL m/Ahde9oGuMtWZ7qYdbtnDWO4xO6aQul7XLnNodzKmmukIFFGtUB1oCVJg+ZhXeHxnlKEhocenG4 Bpq/RDQaPk9+b/N0Qh+H0tSQP9EGRDOFXQss+xPOZxRy7+0MfQmSzZtfWa9h6Mfkle0J/KS+TF4F mbqlz/Db9htTWss2SrQfWtxlb07YJUmqjQraDetK8qOoqLTvStITdVwIASqVQ8RjeAhBYXxJR8J+ rcCmUlV0IlMRy9ndXIS2ZbloARc4MhEKse2IREvM+YfqcffuWw15RXM1FQCZ2MLwOmBeeHIxppMK kL8uVQApOchNdflUWqMDp2AK9qnLKG16tZ1RMD/eGKNk2o6DUBofZ9ZVQkbuFChlempGIuRoCBm/ RFtV9/otDcm0ZCqWK92Lg4uBHAjJAtBuCL+Wp5knWK8uf9ApGGUhTAAfrjXj8Ky1a7qErCYijy3G hvs+UCb37gRf70avUwBSvEMmoTOIjLy/Pv+jrqrph/iVjHwkCCsSQRkVTa3XYbo1HGGz6hqrbciq svzV67S1vY5tcZoeJ61xwF5BHYZqPWLeDOooqDYRx6EfiIiEhcU4E6ge/Kb8KwNpYQdDEC1D2zf7 HYKVId5Eeqq75hh3613zAK6R5+hu/DpWcQZmSleUjZVKhR8aXo9dQ3u23RoZuq9SlD/uaHn8AFRF wDyu6Sj0n749s25w8nDEeJeiK5ZXhPCyqOPx6qkeMylOwGUFG0++6UDNhGXKq8fZnBn48SdtNssx yQ6XVns3OjXOnxzTMH0A01Tv3AfS1jN72wWZxUKav1g9oIHYJy59zCCSO8HbR8khg6B7zJDd7hXe 1BZ+NoQWpLwFw8x+bWnRC7QCVOwEg/pDXGfTk59/+vHfOxT37f3Plx/+71NCp7+t1tW2nmeram4k x7pd4VmBQpgCxhAdc0RBfEJ8ejAPulyxpMeyCN0+jhOKZxvAv/Zxl/40gMoH4+wb889voXUAbwdH xb8Icx3HMVt6qOuqEjudg7N7hbfuga1bnHXOqqMQ1gcDxCedfZxtJ/nbf/ru+7c//PDu2/dKd4WI 63mDEPV7tvRwsk1C1nd6wHZ/zRmpqsfNluPIMt9FIMvfrNVr8AmYyfwDrt1+RlniVJGwAorzAq0k wUsC+2ibPuNtk81uYR/tSFtBBcOKyK+9AhgdU8ea48gA0f0t+Z2Ps7P7bIDLxiDCopQMq0K/9oFV tkHnsJzdUrjjuH5W1qGLZViRMNJes5SyBR9QQ4lZXSxqUp6ahbIJyWBqZEJ2jW0fwUlszzq6QOto TjbPnrlhaLIG+FRSNE15zAPQ2Q3jOYaoATMb5l/XIm0fRHThJTQrfQvM/6IG7xRAfUV3ldUoF7T+ /t2fn63yQ7sfc2mbbaW2f56r7f/Nm+//EY7Aoc1vtU6066Fab8NHc1DZ3bTKkEic28xr8NfrQWqU yUGeUT5wwNtPpVMI+g2EPOMvsoK5HzFXUzKOanu22TYY5dEAC+/3hImR6QqgBeSucfnptPR2cc3b AZBnkM1As+SlWaAYxCkGJnnhWZShDizWNOgRNzA+MiZh96Bk1O0KPPf+AJ4y2yLNXzvzuDeyMoUX uiXoLsweIRpYM8pz/3LbPbBvTv4bdSGNXrSIdkg1XTdL9hUKP4XKi62X3ly/KQ+FVITyyquTxJQb WfWJUmXy7R/kwBB14nTVLOqbJwoB4Cgub7X46MOmt77wsnD87oQgYYA0pErJWTxR7I+u1Z0PriGU QE9YdjU93q939dJjbV1iYvj04uwcVC8TSPvryb3qW48Z8oenaxqfSdAm8SmU04sZdkNlKooIdM8C H/wg4MTvpz9ofiHh10NdsgwDIKVhi/fLMds9blPkMCJTELNl/iR40oogZsVrEzC0WAKW2o3CftQJ f3VwLAdNKnZtoipkd7hWxn2R/q4YHYOJe1D6YUek3LMN23zowAt+Q2kHbbqf7ygKHRgf9OwC5CTM SygMKsBEY2FKLANJJPGpTg7kuK4xtjS+et8sKs4E2V5RoN91hXVXC7oZWnIBdVwT5KwBo4ppBSuV qqDX79Y3zZXhO/BL/QKcApC1veLY1hOtaOvJZa7jkp5gROQOGSKCm+IKh8kmVE0ma/DVPvjRMJPe Y7bF9Gs7hsQu5L7BrQfZL0M3bdd1/hUkDYd+utRjpkDabC9vHPKerS7OXH307nEpmaH0b3F/ODUp w7SbDyA2U7Hr5h1Y1sw/Zn+0skMMCwZk8eD6htZhl0vFQr/3zZHpRiJwyZ+bBL450C/6Mp2EXc21 R9z5GV0WdAEmyRTdTy5J1wdJa01ST4Pxrd7BNDzZbjcTXtsdUAmpCvJ0IYq3tDPM/vTnoaYW0hWb q7YsdW+PuB3iPntpu7WEZUrYriJqAMUucmLvPwApsaMWCgK7xbZer+fL/UK8QmjpG4ikbFm00gRN hCRVDAI3SSgAslTVIOSYjStk50v45wpTWHjk6GtmOq+odi0DDW0zzdoTYPrEF9OZE9J7PGU0MCW+ UCVWQLEiy64JOGD/wHQyEy6NFsCgg39mxkI+0Wx7gohEspOMGaM/x+jUv9+i/IpsxgwzfT6JTIuT 25FxTMfCyn4DYjG/Awa9N38QTQ9zuu/4aUBN9TiQnNrIwo7hmDIgubcsd1oxFkRXHmKzjQem6YUe BtYilejhRB3r61NwpqUjstw2xxztDN4XNq4i1TcV60pY/cf1TNMNtY+IdPi3RaHrKUMpLJ3sLt4e kVAG14VG39CCzjSIjfVYIKsOc4lGv54BnSE/rw72gpz8wNvHjLNpcWvQ+cyurkRtCI1fXWXgHrSs dqBREhSezKpxxi7q3g3TPfqNrmvULpuHnUZ8xnvLRpyjSB7aFsBTCJ8g20U57wdS0SDFV+HQ8BOm qVdXXhNXUmYUJlplDwbv+g2OKueumiRyV5E1xnd9CoDdEii+afhYupsxn0FQBW9Vbz1Df0T+MDmI yLlM5XcReL9AP5AQD4/09fL8vLzaQepP8qiiRuAZOEqZcF3d1muWGA/oEgAYzRZHrC8qWmBRDdDC jl+GUDyW4Rbws6wlJyy5G3I2zc0yl0eLGR2VuKH0DrhdZXfA32QLeZhQExGoiAXvAqVr9gd0rtuY sVakP6gZsIRyYnceI6ePfjLTRhzCtroZX5m9YDigj5ShFhGI4XLBG8/eLb8yO8QIkdsG/UC+YFbC G5PyfgX2pLnZAauEfVpkkEQekVQ0lSEln/PtR8IC2UYiP8caCJTfnFfL61QtuATnE0KMNbWYG9E8 MGP9F9Mhvy7mZyD/BtKZNUKs0BzDZNg1amNGRo/oN9iZk+eRxCMEB4KG4iAlAucMXV4ZoYHlJU4V 6b3kcBzJcxb6avy/7L3ZdhvZlShYb70Weqhe3U/3PkWCpQpAAkJT2mmjEpklS0ybq5SSlgZnuika DgJBEiaAgBAASbjs+oB+7N/oH+k/6d/oPZ4pToCgMuuOncsWERFn2GfaZ89bMn8NpX0s4qZR/Oxk kwLPhLNbKoRptx6m3d9O92ywdptx0kLjJa9ujnaKZ4yCkpLlUy43IAW+Iw2KpkQb6BoXfJ7IJnh1 maCriG9XY4PzAEIJ86ZNF30iV5mdkPqY+o2VPH4i93pIJtwnskQh/hKLUI5ehoGkaL/qFYQVKew6 T0tKXP3HEO3XSqOfT4XFo8KpuxSPV2HShzR+OzIt4e2BFTJbvLFsncae9Yh139G+zqzTPsoeZ+w2 ddJYb3f2Js+a2Dc227+RCFhxmJqbuShnHOhdjTZ57j180BSFX1eNm2gMWF3rSu+W3YbEAQgGCfVc hNPYQndHOsAdA2UYP2ctuCaRCXFQu02iEwTED9vj1Arx4eW1JgMOW3U97On3DjdJk0OlE4yf7gY3 ivOQYqA4VAgunCVAvhddv0Qx0wsbSIEmcaZe89l+t1Yk7P7BwAhHcqWq/MsodolBLeBvRHZhEHfC eXmL+XK9ZewARCfmUJieKYEUuwHdVlXWY5rEiwx7WW29htekz2xoO7g+A1IZXpF8Ec53x50U2Ryu pfCt2Ux0DfGGpAWGv7LUemHWGZC9jqBrsTqZeEEpoxcrXoC52VMaLk8lejQfeEnJUL3rz5sWxaLe 1IQBv/lEBKvnnrPgVLk7E6jz+oTiCLbTYjaxI1BKuciBUF4Vs3wtQSFytYnpU1I4byhnkjRWAbfc hAzPRzl+lx1ndfzY65/++OF/Jyd/CZA0nk/QZf7T6P0//A9kvNNq0T/CqpcVBUPRRxtZybHQIfWF /aJcPoVe6iVvjt4csghEukKvTCsm1Q24Ya9HMUVkw2L05MeZSqEGudMCoYUeJEhOKfwiniFeSjrI iJWi+gXJTvCccfwNDjQgtvyceu2iED6V0zsBx6ORioFoT4vVKrXYJLHmGbYydtYXsI16SLrKVJZD kTjsFHEUN+sRa7qUII4mwspDnRfWFvAWRSNJ8jwlQwot2ukaxdOGjPqp29zxuy1uCKmlH95/1/9V 6otKFbJhEoueBZvgopjNSH/uhzkA+ND/OZ+NFsU12aFFCmk8Ladl2BU2sJb/nk+oBtZBHkz3Kkwq zgeex27L8U12PbBR+PJ18nSAITTRAfspBlWB2UqCmezx5yc4M82yD5njkU4yzk/T7B8kf2ZbKuSF OevMFdL9d5GHNPTHE5iZt2iSxKvY8uMvySA53pHOW6R22I+jraYp13YospHTDjzv0Q6HYHdWblnO Zs6S0WfnDqLTe8jnvVx8R8ezw6V6if6lbai7wkuJiD7aQomEjdi0Zfhvs8+y6WxboWg72qUF+FAR Rua7cIROCDIL/CP46HTEi2weg7CHFFsB/q1lUOTkibXMi5x00b2oqvWOiz+YsUFyb4LpP8VdvOOM pGcA6hkY4EI8IAnxah2g0s0CiXqjsUoxoIp/5/CapC0fbQ/DNWyZQxl8gMlnPEqm2ZEO0oZaHOQS 6wgEcjA7/snsJe+3y8LdOCRY+fSnD/8j3qBi0/Upf/+n//B3f2cj7LQswJonkswT+Kf29QpgcM4/ haWxWSU/bQpfpQNouv456X+jlVCwxgKOEp5ZhW9UVFrBSpTeqhdPWD3qvOMJpbkpYtwVojrvbngK Lp25ZXdl53IaN6rqWtuELczSdNqGwAaKykxSN5lvgDJGgZsBox2JnS5Q6fjt5PJkMVapFzMxEDyp XIhUik8xqT28Jn7sU/2Ta9k0o2ien7q1LqJkZ8DJ+ZXQJDxWYWoTLcwdssa18Ei+SR5FxDhJfxjJ ++ymjgDQY3mLa8Oc7hXc1y78u3W5PKJlMLlb7dzAnJ2vL0YX6GNy2xQ5g7YnFpW3Q4qe3XxO4WuH NsLpLLScuBFDM/pW06LcfI6VhAVthhItzPe8AzS4Zj8LNDyGzeD5jisuzBa8imLUUJY0/NEApCDN 0ZjiE+G/B7A7WcO7IRJ+iZJxh3d2POKoYTM+vJ41whaU11hbfFQ9T1doWDr0TOnYAhDlUzj6uowK VbBQq1F+RW6k3DS6eG0bZIUyXc7IOzdApEIFDFq1h5PG3frZ1T7FnkD9daeYFYgyMSKv/OKY7/zg bpWT3XaMMkPxGfQnH/6tQUMZEsyOdZdG6zU2PstwQ3Sk3C5zSynpNS/7JCwor/2yO3eJOm7r1OE0 dkbOvKJ3WC3fy8w9OWi7D5zjX4pFRfFh/RcNJ4m5bkwCoKSHX6t1QOSKmki0THJ6Cqosvx0ofpNX haFroYz33ABDWMeWt+0a84PDmykOzntuaJdvXa9kx7QdyFreYyIFS3biOuEa8m2BXDDFvlyT3wqp Ty5JF7Msq2qKqpp1aZojG3IKhov8+xJuGCxA8qfnb5i1e5L9gkLu0KqW19CPfLGOzMyLVplLQRmN nDemgIA1g6jSVgsT0RWoi+78S7E9LfPV5GgBx2S1wdCX74hbwCZ6yffFvFxthWD1mu86q2A0U0Pz c8c1okU6fmZb2btedtm2KoeAuGpF2PHkGxjC016i+Bjp8qTTZjdQ4hAxwuw/0fvREP8VKk12taDN Sg2EKsx1jz6Z1zAlZpmmFLYIPS+gayrJWiU2sUQObGX5IUkBSuCb+MZ8exCvWEXSDzqaIap3isqV ukEs12++MmzaXgkCVue/m++BxsoKt4sD6xotgrvu5c2tVuta1l5mrU//7HCS04rG7cWTVGrNi+TI 0+NWpCm/tR6Cx/1heWfhqEG0zMC/Ld/ZfTpHcq6j2vB6H64Ka0154oC/wDpOJmmvRSyI0vo7tdlW VXU72iat2B3bwzqx9vCYUMKEMyh3PitPVYk/K8ex3UtF4rsSj5IImWjkaMzQCUxiuPqQymZnI3wE gtC/OaFjW4KMo6tAsDWjr/4WpWpRuKRB6trSsUhGkEwSB95e7YpHblKenS0lQO8twcWXtSji45Is 6uZLmxINbljsmfBUD1P9rAHLwd0yXQe+RYTPOuNS1oeXBpbQHm3NRqSCBLgEgPI1+I6QGKMqK4+L oDb74J4bt7yeHT1Lunso0CH/bLwj7n706Qjf+eALvN2ffrKnczra//kPdlMIyF0nvXsXWXFze/iT mqxDLPEXdpu2zIEtnud8YFkNhAasTy/ltkZxIBG3ofINj2eapC7qSeEt6W64o1AcsjSqTTbkwdJu +hFkKNOPC79JeN3YJFdxm8TS7tmnDZ7iX6cRV6NIteg72btY+bvHE0T6FlUtWpRzfJZaxg6uFXBl NYHWdHGVz6aTmgZZExYlgYJ/PaKYrLH4FM1J2sjKUGpGwl1hpFSJdx7GynK/0fj8zw44vtzAqVd4 8bgZVxJ9IneLvc70Yd8dSvRlwwa9NaKHXJXQZ/xSottxn9sSWxhy8YYLky+/xp7kCvTbCa5VvUEb GzENhADgJD3xJlzneicR/8jVn6wK2redMVaG/dpL1qfOIt061xKLSpkJaiF1aqHgN9AQQRnn/hRO Atb3Nnh2wiKqY6dWS/dkwxTt0SjBhpQ1nL6gOqrXu6wQhxa2TAV07ruOXI5aHMX37DZcbcao28D0 C1uhHdA0mPhHu81lVtnxK/SBCDy5ahfUaMTtjkaBSblcRkf0NXITwXfaJnwy4Il2TWeXTEYFsVCe x1AdY58sKDGLeV9a7rY+nX74e402sirGgEcXn8bv/8//iQOOmHBrCX5A9W4y4QSHnlWt2hSo1aRj xGD1N72krDyfDawNKBR1GNRvR+K829Uy6pQfpHeNlWzMmlgTv1T/QXb14wATlSgR7qNjBVw9qN4+ B5ae0d6f/jQwMqMck0hyD34oYK2SmYY4OB7Vpp/GD1HnB0tKcvgiuVivl4OHDydAomYcDyQrV+cP Z9PTVb7aPtQ62cV6PmPHJWt/qn4UCpjAMi0CX6wmtPKk95XLrPAyuFAylzqbcJ4xRGcGHnnlRnky 39i6W5KTpaKnTv1slitYBVhfbiW0oo70gtyHAcQhHCPpGL2muddrTvMa7pGO6rIjrWCVTB89nfc1 5XXdKzTOhJLAov0diWpSNEr23vyNGwreiiFknFIMowliBVz9P/0Ja9XIyz/9iZmT1fT8HNcwT15I Z7AXZEL87SKzL4YyQ42k720MJ5QyLAt+GhU3y9l0TIJGpYu9ljBesFsutbyK934HgWysc30qLISg 1oIL5y3gBVB9NjB1GOpzm4Xz5j03lJdirdo1wgnOonugFWW97wrL7fDUoy5L3kCv2v6Eivjp0GaH 3Wr9dCbTiRpvTTaA4utbGg0o6BR1vbOLyZxtbH3CAhOp0WigAoe7ys9R6SW4nuPmsYkf2l0tylrw Nbbh5YroM8+/AvMSaY6Yfv7pF9BecFnlZz1+5aIUx6pFWf8on3TEIf67PR7qPrjA6ZENYk9q8Qml fGfvqfSUiF4HeuqC1asbru+/bN3bI7yzhc9sMto9mqh2sGGEkUBxTOsZdrQOxkHytUQNe5L98nOB rAEUGE8FLdhbX069860BL/i13fJujgfNGgNspixiwGlCGYcKlzi/E+2rJ+jBUUCdWVtLXwlEhFMv uUZS3GjgOmZPxcJrVJtTOjSd68zO3HhWdRtV9XaL4uCm3TszZJI/2YsPeg+dD5mzsuCKRsbQUeyw uNq6p/egiaY78CisEihkrZ4J6RopNhrJTy2LbmFSeo+w0Ah1PRC0Ule1iOs+kgm3U2SPtj5NPvyv yqNsAJPhj0/F+/w/MpMymVZjtM7ach4GSeZUoj3kpC+0dtLWim14vZ1xyP0wKCK+64Vcy3Jyikpf cvdc5YtKcg+K7ylbaSt0EvRPqmtx9VMVl/VpNVJgHEUgAHJUEW+bJ7o9cRBaNHsP/zzPq+Jb3fv6 RdhDYfc4DbB+S41xqCldE2nIDkeLkfK0nGzJrZJsbOEWmaKnaQ2GKIHC0mdztIjHr9XsthxkWFPB BrarTtnBrmAnQqovt5pLGrXRlG3dBP9QHxc74dOmlXA6+QBfFXLxa+RIDUPTsPXW8QrLhqAoH9Lu ohSOtxIUgVMuwVZwd51Nb6DTYp4vzjlaprwIeP7arbEu0Rtylq+EGy43K86lBIAmk9JNdpUoBI2t WasgzFYSHt7xzLg8oQYzkoOAkFk6MvM6Qg9k0geGCdP9rScB6x3MsqbYoX678PbDkuY0DZ3kpgJy s0UJj8hRbWkmlrAX/PACPjR2ZGru6At9YFyWU+s49/FmCe/dXcPXQDdTSMMc6fGA9hKjcWT3DwXX p0CHZxSRYmqCTOuyBFq1WZmzq6BgZ+/YvqSPzsQZglGzXvCZ0D3/PX3uejukYePQTYimB+ysVZNs O0I2BhF709lCAwseV+YfXg03oKuqRSQkQ82Hl1X1WvqGlV34Adb+JqQffZTekfo9lnTyzNRSn7p+ tlQ4XZeTMuZk60Yf4TRvqyKvysWwstUzrNzt6mM34q+kU6TBhHzcVXd/ra0DGyEGag2/VHCSOY1J dNZT+IgQpTHH1umZqbvb3i12z7XX16gJnWTr1TSfmW3bbvKgxXvQ3ICohNKuvxjCB3NJZQJw3CCw YYqdUXrzbO6HWg1Z7O98HefISn3JrHI3RmbXNWxnDE2brOsEAM6+9VgLg775u95vp5dEqgUxVNzS KaLvdEf2Rb8CvdvRMO+a/drEA3FLcy6cOIcagTga+sXC6BS1fe0IKdMeiayxHW1YBZEovJwJrq5c JK83RCRPceN4tM5+QwpKu6Ny8mPkK0KxMiqtHCRNcnT1GOGKt6xUWeXXql9wM99uFterfAmM3xr2 JhxXl7nD/d7BgOhyoBM60IZsOS1mmPndEofX9pCY7EfmJRIg9in1AGrW0tgWNcWGMY0k189YI7uZ +qiwIfpSpa5y/RqOMmN1wMjMVOd+DAzf1tYkoE7ar16/PxwkRwvH7NLalb5FuVoFa5GLeUOjr30b WKzlLN/i3bCA0lfFbDv4uPASvEROKUe/F539rEuh1XBkQyYFIzH32V3IqW7XoFfnFpoMtg3rUG98 cDu8h2/fvn47AGr+coEkXsPk7ZislTevmCCU2Hxnf+6eituZo+aRSt3oDA5ic7Jzy4dXhsaMqYyb Zicd2WN2fNJVAZ7Zoq6LOot4fbTSgC3EI9tilnDbS5PfcRa4n6FRt9V3er14TRIhtssQyb2cpHQr vjBYpGlhalD6ut9gSimjbrHHPOgAhu32HmNg2rOipHI0kKaR3OzaY3cayodFIYN5xyr5hhXwB8Bd bExdUeeTZyCW9tc12nDjzVaty+VdbkIhJneTaKjBxDD9QY7d0RJqFwbxS5f1PRzQjNnues46SwEy TqSP7i3D2lzfyCWfn07y5GZALkxZYHPDUibL5qd+NkzTdPSKzVxozO9Wywsyr3HdXQGP5kpE8Y6k qOWYnagmdcU6QUjPkPIObNAxfqWiMR9gCh9hsaRXMpY0KHq5o4kuNcQr/9lpW1sHceooNkPLVbku x+VMJmA0mkPPU/Yo+OyJSuPcFpn7OZyZD37Itx2bVsQiQhJ5pr5PoyA0VV0lxJ/JS+Mdngmf7q8Z hmA0x21E5gpk5TcisEe8cTyBhjWYG1PqCXuKRuTxq14M8LwGUs99POWHel7cfIkE/u/zutuD69eg PeyO5iQMhEv1NhgE3R47SXrFcdweQsqUhHMKfzoG3u6+cHa0CWc6deq6+xPHwXYIF8iujbbdaxyT uzLO70ZydIfG7rMg6wbHo7arGUXTRrwduYgE1TvgGZtjFZ3QvjRint8MQzAwiTWz7+GawL4aAkFo cM0konOwDnd/KZdFhlm8VmcYj08UKCQ3OTJ92OI+IpoyOpRKR28FBuvyZpvohBiuZ8sLYQlwKhX7 uNv6dPbh7ymuT76+oEAp5eLT+fv/9yHH9HG0R0FEH8ywxWKf5zhlJkrpaFJg06MS7S9wEAtypkhZ r5lyoplL/DuZrvAPGUy3mswXEKxajlVMkT6kT7YetFaLVEEa1lfl2kxPwSS6q8SbFZ9RbVKuozUd VSrNJ/pYoIwpI6FDhR6BnTRLPRPmtQ1sVQ/eDS/DujXTcZzdLOXobM2gkHvH0HeM5jX5jPHruKKg N85CrX92QcHR3a0hd0qwikOhFrN1uV9jXNSvrmkJ92pAC/tNwN5nwHa1oZIu2t2ZqeK3NJLUajrL l9eRdAtu1o3rhnwbi6siYlXPViZ0kmqJYqKYWAq7AtWYwmFPik9DXg+eUszrFHZ72nChK/yNyQ8b b9WdYB8/HZw0BGbcbwjRWNQyNuq1kfwIPTeiTbcXFFNvzOg1ya/gviI3qzMKR+uEorV7aQ9qHcPP ijAE87nn1+SHhPB24S0GiaN848k3yeNGAqtDiYKgCudn6XaTP8oyNc9SNCTEXuTcaQl0vsRN/iM/ Ud8/rVsrjNNIT69eH756TwmIzYv3L47eum9+8+HdH7oxyyb6kpwVMBA241msp4Bhtsm4XGGKgV6k zimqatZVcjldTCjVS4HMOxpzANsCtyb0//3hi6MP30fqiiopJ36fRHfThRhX1X1yaqlZInd0c5JT qXl5PdgVBhewD7LMQUz4O28EsiNgq0FCCXCteZaDnwccZSr7aQB6wUuY8HmF8QLeUriAWpQBZmi5 3Bs4mRjxwAb/URux6iLHOO2GyiSBqthKACtJ3vpE52goSGMXpkQXzJP+dGmoyfTKkFAUIbrhIuNs 4OjDTYW6xkNlU1AT0Lw0hhHLt08vG2iAwPbN3PjLXFys8ML0fKq86LGwMKdbjGTaSbVqakLmW/JB ghyutx19x3pQ/dfQBwBzOR6Nuh552ASsfPoMWKWmBVWbciCVVz6g8jIC5xI4kl0zi99pnCZkLdoY Esj7QOw2b8F237qwu+/9AbhfIqOIhI1C4OF1saDkRQ7cScdPRIQ07l5jgdbsENh72UAOjz7A8CK+ KxCEvcK2O45VnDUGjZ/f0Nn0E/rQOzxYjrUPmSNiPBCME8XxaGnsxkMziwZQc4e+KK7Nth+mMEd0 duOG+kwK5xozdw43/DBdpbUR5RM2KVQ3JHLVZgdxYkOxhK5L/VjEPHO+RsecpwGCNQ6l6QY5vg9p lCqhEghqHDvjFzRGR8JFszChKYvro2tMcNDVf05+4bd5VZ/t5+RvfPy9+XXT249Xw8e3TrB6U3Ha eBP1lecWoyJR2HO6eXr4pSXBUU2E1lUxL9Fi0VQtmHagEMGUoSRcIrz7xgH1iuFocauaKG4wA+nq Q9qNzZAUlnwm6FS9yz/PX4N6o7uEPAwJT+qeop3IwqAhVQz7dKyfUtcJU4JhxjeL5XR8OdN5tZPS 9UMrB2M7TW/fX4Z2ZDpeXKRED869ZghxLzm7+x7EvaDKGzj+xTr0dobvlOeEsQ0mC6FitU0iry37 HI2daOngo1e/f/ayw7XqpG17nC+IQ8DuqefpgqJWV5tTizs51xz0tTMaBy8FXYcyxLqiTqH68cXh 7wdEHYsj/HhVVlV/UlxNgZxGuVO9bYp4HrbsBhzEKe7eHg/duSJyCRWc+IpyvidkLaIEBpbvqHDA 1R66WZcQ1Qf90meMAY1TTeHYjOSNEkbzrUield4Qf4AbCQO/mluo55K5Gn6aWmVRUc9JN0JIKmhQ Zl0FgoNWND7A8LHhYfLERBGplXrkczocgaGjMZIpmBZBVefhYY9xH9oJvKh7ycN28CCp7Q/eYzhu LHcgv/0x/aHckDk5h+HfJiSlxuxAyrbD8qFAE6Nz9WRt6vnNjCABZbC01jxPPYGyi90zhMkSrn0b B96bvgjmDxkjSgfxryqNTQbJ479FqQ1lKngrZlYWRekb4vIyAH9drBZh9Fkmm5wNpVTMQ/RJJ5pT 0z5StP5ZedpPpa3U2WC8ueQDzG++ysfryDa7rwSDNIpc2pYsOr1i3wbFKLuqpOPRtr0Kx1Xx6SSo YEoyb+1HZj3+gmuEFWyOr08W8iNz2Hh4HDC+klPdl/j15YrzQZFj0QZjzqMQ3Kx5RRHcaZtpQ8bf m1JMJun9FIsBXkIJgMmQ6Cj8qVrm2ca6gGFQ+EW6VgCj8GlhF7DSZhEFOM5xbGtvN+ykgL979T1V XXV0k3UC+wJX8gu/A71BDDtz/jGO8SfZFa4sF6iYz15NbnrYVLpIs12Hz1E/S/legvi9Z0QC3dti FN9bDQT9adrflSsQILsradrNULFeyVsJ0aYz4tHuthDuDft43H98ggbDYn2/DG5kW+2BLWPNIMUd LGhuuGfRJ17P7oDwnYzGt+8WNgQ4gjVaE1IGxevp4umTNk6Wyn1LctsgvleMp1nsHEqdobWyYgH/ AlojixbpvevqHULkHauks77D645bPqaYzbbC4MQP1iLF3P7d0q3PalkDuTuJKk+R++OScpQmRbXe 9xzl7ilCSkRpaQ++Dqw6UBuEeSjKtqEIu+zpwzFLLsjXp06REdfrwEnLSJVwE8vBw/qt8Gale/oU nb4AgcyRPdehYPX4QY7ltOSNyJ02Lixsh/FmFdIdp44JO+taOzTBsRhLWJaIWQGb43VAfUo3spiU 19WOXRVpF3t94kLAKPM0D+0z4f2EXR0mHDUlXkymgpqsz8NCeqHPGakUOnqsu8mDIAh4XP6PbTyq ByKmo4ZzewJ3/aLmbMHQR8IiqdZbSgR8KbEAOmYAUq16Y4eLC39GzDW7MrcpYR1ajClCp8q0imm7 azWIDPaq3aa0dmlPVyjpqGg1Tnbo7eZhhlVZrvvs+KwSD4xCTnm6kEbQIz8t/D28nG0qy3Mwdxg/ mCpsG/oIZlZPWQfoCUi6QJdFIXGG2oovGzEty69MpYS17c+tmIL1LXe6KvLLVnQTSp1aToO940vb gNDWiY4wSlzqH4gwuSxTO6KFMPmyqKpP/NANt2KvIiYIVwVzZm5L8aWSufaUzCQR7CVbJIP/oq4u vM26Ars+1t3bb5BEaJYiYX+xxb5pxQo6jH0+mTQqTZzpWxTXLgnG85ZShVSyoQutqKTtXiJdeqNP D1ydjJtmdL7cB0QMWy6GAZ0+cJGPesmDx91s99XmxIEXYmPFJCsvhzx+TqRJalLptl7ijA0dY1V5 bdcde3EGPVs3jrlpEO4Akq/9EXwm2ibgoS0LvYXxCih9teMB7GlSCozl1/QcyMJi6CgMe8np2VDk vLhaUXxKjngVoU4EvGI3IU/ZYBzoHNGJEawgX9pBftpwb3DsNERrt6coxw0JVqeaSPJMBEnBACHw 4h0hYghCCx3LZwMAkVksJt1W8Hq8J6gSK0pSPgNKL3ABfEMogHFCOAnu1zHxtjEwfQh4XQiIheP7 wmpb6hM+caHJNfLdGq4KrgTKQOBfCVAVeXyHe6ySzulWwejRStpo7ZSYWgwKw7k5PcPVITEcZ9PO MctFTjfKZH0hof2KfIWkNzCZqGngfmNpwTBEl1TKkhf8bqARBjwaERGH1zG9gZ2GdzWhOgxCgsoG K8idwcrP4rjfaH5+jycEGFpYajoYeibwHPAJ6GbnxSIme2Z31BsHI2Bxmn4lSSppwrOfwzeDJk9l /OhlKI5dJxXnf6Cm9yBXTQXX2xCQuaG6duJsFbny7bsqzgpJ742JmFBIhsFJ9c7JK0ZxjdpCxX3D oYeweGfLYjTGjNqxSE3B7alKPUg8YqOhI72B525DC9RfvQXhVMZeM/AciVmva0stucmnWQU3bmxY XEFwwga+lVl9oZ1qGEkvDHnF0a7814JlhjKb/kfvQA9hooNwRss1nUBOj8OCGo7gielCjA8LuvGb 1dRzVLOerbuEyrlmY1oKdIOcRe2Od4YRux9bLkY3zKWdHGjTRkfgAXWOlyym5KBG6xor4JqrefwM zUFH7g7j5l6MO8tu96RGTtfmuK6ZZqUUwoFwDqLmU0tjO0WTSzW6u7znl614dR2+DLkblS5kconr 6PQdDLHeZ9iftvGfZdCCYMxJHeyw6w50BUoH0uU/NCJkl/il8xzf2rai2447KSrZPpsC90XbnSQR gCD7AXOoZjCuyfEOjCDFEc2yQOqAqyoKPkh+/PHHpLpafBsT86jccFrlp1WnPi31AaII/0GiI+Cf 3mCt5hl1zKKjMebKGimDO2q1Pl18+A8a3inXYIVwfCng9qfp+/9rRK4Ab/lFYookz969x/tJoxgu UMdKilgNXle5oXKR15KfUGhR6gPmcFqXQNWZF/Ol/pznK+BNZ9YDQX8BEtUIVuvVZrx24lnpT/RI qVphtuHaQNWpYrMGrE25j7YZBcwY56Sz4XlYo73Odky5lEcYhgk/jkZZy6EooKFe0j4v1qN1fq4e nG/+8P7w3fvR+2e/RfQ/X2byvYMisHafP7fd5A4OiYLBudrL7XI7ck1s2n7UW7xxqBDTASwuDsXh f86v8na9Gqed1YruvtYS46VT5Ioi6IQmP/Vxtu9V/XsV/CPDQ0NlbLCHLVCGMfz7+EQdnWf43KM+ W603f3g+OvzxPTaTwaBgmjqj0aQ43ZxjngtA/e0xyfXbMBFU+P2zo5dUGss6cOADNdVqvT384e3R +8PRq8MfXh69OnwXGcXxgDUPnSe95Cu+Y2K2TU97yZNu69m750dHo6N3oxeH3z378PL96PDV89cv jl79NtYwpxVWzGjCgfJ5Al7id2V5WbMMfXP45umjJxI4O7mAIiJml3NZyTlkg9BbA2G6cZRCUQwH +2TfRdQN/80LyDKSWiYzJT2FTZ8tAJ/wFc+xmoBVO5ue424HgDpt3kUjMmptd5vAkl9eiL2JZLpy 7PYZ90ey1XjNRW3vBTMG468qm3uSIbBqJ857VnEWaRrTSGYeP/kF2e2303bAJoaRNbKag8H3mKDo y9ADaUBXbGIFW7mXOMkBUE4llwwVR4WavfjqHhx82V244YZoQ6MqyKhMgjtvaVyq1KJSW2ryY4ga cp1NONEN8uCC8dxF1JHI9R2zx2+MFd+0fgLn2WR3eKWzSS1ND41iySL/8fGTk7BJ/MZjePOH0fPX 3785enn4Imq66N8BnPFnhBfOiG6KdgPVdLaQOarV6Jwt7uLzSg2dLY4H7s4w1wGM4wszjnevP7x9 fhhzYXhRol4fg4IArsnXbKs0dSxTd61CxBAQYVLqhnQpS5Tx8UZH2S4ZxeBm78Lc43WI+N6xgVvA RauufltuhjIheHNzkBxVDGkuIfsBx3xb5wLg/CKvOV2TJP8spLAOkh8KDgnJWkmKtjnOgQvfzBIS dp8WLIJheoEoAeqWs/7li6A5iVgOUI2341mRxbL5RtFx89Fizb+hyRnnNrptmOkzhB887HB88DCY 2mmYGVV/Izjb3cZIjRF1x+5t23ScG609IxfGLlZ995A61yhFIbutKfLTKKeecCRsHm7jOINpOEje kwUJhb8yuTWSGdzaVTKbXhbu3kQ5it7iQPxmnIfSEZgekMRnXlZI/56jx7Nvk8Kpygdk5srCIUkw po26MsADpRN6fANoHUvWcu0M938+A9AI/fhlnNb0ViNRK9kA4PwhiNsxtWGSZ1+jcFNhppyZnGux PHOagytVBdlKd8v4DOmtpksIOv5GMhwmrUzyq3I6aXknbny5TXC1sd2J2txdo3nZlI2VyGyqnM3K a5JSL67y1TRfrAe4gC5YOW0V6IpEw7PrfIv4BeMkzYo1+1xOJzzm10tJKY0mTpggVGbAXYJ1OZ9C 0Tev3x39mFbynLBVK7ZaEDq5gGFusyCp6JDxFxCVlDOOXo7QTN9kaWOXf+RHkKEPUK7FAsYPpe0w MG1PXkKN73HJQw/zS5QTmW6jN/nrdw23eFEL7wDMQMZcYSyaA97C9DU7PPzx6N37ODI5SA6nJDrF RXbG6Aiq8xnKRLaick86obTc3Zik1KRoOMhtTNewbqdw/VzCvjjdkrZh0ccJR61DlhwtkubGZsRr Jxzj57pIZzOjeCB0LquK26m1l3+pudnpEB7L3Ij7onlC38WTprl6vfCch2hvAxpewLQgWmSTMzNz PUJjs21DY3o3wthWghf+Ml1y3q5oFd3bTc6gwao/e/788F1D5BAXx5O/BRkaGsgFlSe1g9D9LMAa bzIvUBnvPE1+YHpWWRKQaU9PhD9F7tWJfTQOD7A5Yj2nVffqeVWup5omiBMMn7nrgFPS96eklxyl 8+S8dA1iKcgym5EjnZE7KFBuKLW7BtxeLteYQy3LMj/j5Qg7w21s0Q76zo49JAMlo+xEsJCK+hvp Du2Rzw6HpcImenbCa/YaTX3zDLxZlaf56QwP97st3Bc3hL4SuTbWno3YHgxJBJuScyXGdhqZu5Wm KwScZg0WvOzuS91wxH1ZNE9m5XqL+7PoMv6cQ4uyllLnMZ2S72FT58vdMNrcirLVGtEWA0qF+/co uZ5WF/BnXG5mk+TPm4qTAhG/Qh1JItUJ0eE98poekSgBcDswXm4ibkRFKLUQl4fZljCzpOB+mj15 0BNeAdq/pv5OC7p3sXnx1Haw3AGieg+GzI0RHcR90ilEwBfFtU6QP+DahQqlMjMcnH90wq8lTNGz vpojYayjUMMF3NU4uizSMu8JattdV1uA405TgZqtJhBlklc2s3lpuRpHSgw1RYNa7t54orY43mzM 7dZyjdhGy3x8mZ83bL3aBN8ikrhbwrqoa/gt0oeI5CEqdVDrLCt1+JffjuAOP3z+/vXbP0jmP0Mq KNLAFRHxgUW4mkTjfTG+WFDQpC0RwhNi8ZXP5b+qXhZcAXwS8AxSv/O8y4enJyEJOP9cG4lw9F6n I7RAww8+eIBy4MTIlpE2mGHOkt+V1wXJecl4LEXOaL2eFRLGMEEnLRoQEvtHyQWcXydzO1w4yppT CAz4Kcx4gCPggzI58yzpvCu0FTV6Q15Doq2rjC4/La+KjFdnTj0N0WGt40xrRu87gj29PWZzSxPS bl+ftr0cEEevg30ERM0eBLCH3lmtoncirRRysLBU94ATpIpDki4yDPDCY09h5YXgRPMUiUeHU2UY RmH7PG+iAzHzQ0ZujhV5pTBjCNpPExPenxSLKVrauAT3aUFMm9MQQVusHfq2dpCCOZV8r6oyIU64 4wzKlGAFUIY4odP+etbu8RI6RUWLlE028yUhsLNlQ06xIJW3F/Lh7StUMnxcfVy0s2JBMVPam/VZ /1ew2vwp8qE1LsvLKV73ZC6QaU7wNhSDOToeDE8+VveP+x+vs5MHUP43r78ffXj/3a8oefFNcfbx 5vQU/n+WtjRXaYzcsWqD98DkrEvX75hX+P7Z4r7riMyHAXh41jsYd3tvEWwi9AU7w7ZXwdY+XFxN V+UCz1Swx0O6CFBko9LEDaFNhdQnR42XaFaZYde7/ElmnRcT/uq0wtlCJOqz1hA7KuThyW/plCrD tuY05yod8E8AlKmmEz4iDNsKs5dkybt8Yu7h0wIw6RTNmstCor9goIOJT5no2hM/mWMunZwMenui 2VmSyQ8uH4WJW2JGPDIi3bK6p+UxlNNF/zHgt2frZFbk7Em1NVSPkDSJSYgn88e7scq6yXsXMnJS XamnMOMaHRNdG0yaweWADqUWcsXCNDGeyEk806XbUzTzJbUXogUfmCz5gClB15sFbGaeUcfr44BU yTD8zZKc25PFZn5arFAAdLFh2Y5eZsy8wJYFquAK1/MMF9d3+yNHz4Yl1Q1ALhaL0tl0lZlHjzSU lDSTLPkOVd6IXclTHiNPYKB3zBRUJAdPfvnrLPkDME9IhyslykvuNAY4TsTYq+n5hcNowDZ6TMY/ JKUj24W2F5YcCjyJFOhxzQeuHkkDN0lZx5lI8Q4pPn1vHQofoFgsE3dPauD40QD7OMEN7RtENFfB CljryUk3YthtNN+M2dpwOU5I0NXu7tQFkXOurFdlcxxvKnY0dEgfQYgRRsr0FQs0drdA9zK/3Fyn nVfj6bTdGH7zAxBoUO4Fld4RaewgeVmguQTd37hbASdrTMjs5xGvE73uz0ZLxUW6d0W3XQnWQuIA 1/tJ9pXoGNlylux3i08bABEO59Pscc8IyNA8Bk4pekJjSOsqub+Y3iQS6ELUTbAZQqV95GKSidZo IG9f9ZJXaFjxqn6ZrVcF1rDYi+t615nD9bt30stCdGGY0Q8QEe0pRRfRRfBZ81wJU+p4EGfGw7XS m17E9x2EP0J8khREbxYsg/SAtdxvI9fW3meQRyjgZDn9TKRJzm0wlVglSIoDeX8uo6+pGVAtY2Q3 zKofyckjvSL6AcH+pXTURKkAzp/dOm8yvr1nTqKWCM20S95iBS0hCYXEoiNIIcQAr+9D+ftZkJpa TW1cjIoeqG0vO8gP7LOXnMN1s8Y7ZTzbVOgryTHcsHXkIjjyF50ldbWmK46VBk57KwnLVJUsNBGN 0kJMhumQByLYOPco09CNmAEB1Gj1TnZqxuuwl7AHpyowppXRcLzAWQuIS/f2XZiYBap4G7OJM7mk k+KH/dSpPURSiRxuVJVZOSkUHbF8Cf99IMY/ZOhMkduX00nHD9i+Y+jSWHDFQEMSdkQLyCwpJS6i TtW+2RbQfIcP0lYocavcAmjFcZ7jg7j7S3zu32osEG/v4Vbj4P6okXZcsWBt/ATYO5nT1W3MaXia AiQaCq9q3LLPKJuLJV/nyEgsmZH4VU3g0sxJNF1kBxz3TrLKs0IOfiJRD1hmgnY7yidnHgWEVjAI TxeNIn6FdfDpePDliVpJOAxnSNqILzpynJuFw3NSE18OTjAeGTbDPOjtoyD8rQwqBS46W3Z3hBHA TUuWjdlz2BUYJ6BmyPAecHdaMRMBew4TpLuS+iZILNq8jTXmExBeUPNyYvf/W6uKToyTPywJBZmR MF8GiwYmcRi4HvOTUYvQ2ajKzzAZgmTvm5aZvmgw6czQllPtOk1+IcAiCw7DA+zJqP5azjXLtDjG D6eCII2Lkz1TvQAdhwNK59UeUUlUqhIOowzfVn6qvkwdzkZFnQkUGNG0XHYcYADHTqtRufK7bHfI HJK+sCkkGULyP/QsQeHclsjQtNuWHsmEGgdHOX9WAM2Sgv5g3oaqR4wO/snHFyM7Ysk/TG42WEKd NolvovMErXS7YTu7hLIYhFx02yvH8F+xQTzbilTyqPNa4HXfDoXy4U1nmTvmuKR2DHco7KZhvTyO 7nh6YqcleEAmy3c8kLYaJcJ61qiYu8I4b7DlgRlebQEFIfL+V/qOdOurcj3AoMAo9Gv3zOsjDoCb tP/Ne/3h3eYUXvb9l88mE3j5AF62/tZqnU4X5bLWz2+m69crKPVXpyK8+xFNGNt/9F8+W2B7/+i8 fPnuYnqG4Hz9tfP2rb795hvnrUDjvBGgnTffk6ta+77z6sX0Ct48dN58NyvLlbx2339fYgf37gGG Bg6xGudLiY6jQQ7pAK5VRoBVDj9BjeHQaQTmnV5+4b58SUP0XhziG7fMb2nA3gss841b5k15jaNz h3dUwZupt8QVrz1vKG/t8e3CB5ZecoghWuWWmvKi9Rwny4S7w+ZzH5ezUXl2VhWO/fE74HnIn1Lr UAY7nCwm8cebVUVZ0gwWZ4Q2vbmtcTkibS7QRlxCJhQjo80KbNroK5dGVy364bVku9i3NVuDuCd9 8Fx2KMEw6dBhVvFWGtGbETZQ0SCDm5cGT2Wio2+ZMo0T5F8vk6LVYDQONyQv9aQQT77uwEvSZMN+ +q6G32GgaQrEELuT70P5+57YmJQokbhGeHtjIu1BTT/J7r/IP5XZLkcxYDgXDAJylGpEpraVOUs+ 18Bvi42KaGqQoczP0JgmX3iyuHLMJ5rZh9HobLOm1B7apAUGCEXMOoBxInAS6bHj3NPyF5PG83UO N/s/L7cjfd/uRjOv2Lbajc40bW6K8hflq3bXCfJDkpCRGUZ4ywFj7oVCMcfhkbdnMfy/Ulf19UHi t9YRBc0JsyQRHrxZruriQBvQy6uSSSoYQuHrVSzgEXSpCaaocFbFbL3a4sDx4vWr9yORANGphupN YrH3dn+gOcAEPalQchARSeySk8UCBOIkPxiS4TwA0E36QdiahrWLBJufqfA1Otmsb/4OyFmxNoNZ Iq/q5JvkUYwHSbiMDBsYjrbd8zFhqdkw3LSPRJvNd3Hfwfgfu35BdELl9DDcnWPa+SeK1IZ13DZ8 FLW3IlsjrEuIlk/miWtiQdv4GMAYwP/FuAIBcNlATh1uHGJaLqonSKGdMBwMfavfDESSTsRSpVtz mmSByxn5Oro3A72JXgoxR+mCb4iqyRob44sA1CdxS3+mxc3tVCw2czRAlYa7O8Pgu4wkX1REhdHE 3RITH44ZZQZHjzKe6WxneRhExlowDibCETKo1x0G5M0Gdm67GkGHGttZunnM797fMmCzg/borpIY c3yz8y4BQLtxy8ZOfTcoSI341vpnMO0lgj7APSu2hq9E64ZeC054xsbGaqclHPk6iYOJXXabdq47 X7wfnRgpaGt9OotFtf9tgWpc3PdayKM6DpIPFPvCDbbJAh+T8yKZTjDjBvTJQRPIOJzieFx4aF9s MulG5ylQweFCY9ZnCsOIgpYVq9BkTr+bkfomRErAofmWzc0Ji3S+MLnTlkEMiN+iHPg+vr+PE4Eu Mu4EqIex23uYu9bScgqWnG3sl5D1K5Rj8ObkexoTAXa7JwJQbQSROi9RQtX1AuhT3uTGgT2n2DWe 1AYlyaQeNnu3Mdr/RTFbArHb1qpt6cL2LyVc58D79dj9BEUuhY3nDl+eXuewK2SuzeBdis2fBEP6 wdGXGiaUUEdaQrFQW3KYxGs7k41gdrA1vh46NBDMOuymMnAGLyRp3A6OpHDG2EOKqjvifSx83xu6 lIiO3xK/t47BzoDbYC/ZsYccadUIg8jO47tJPXVW7PB893Pr9mMaq47NzxPKS7hc1QJk3iO5m+0f BWpV283ZUV2oLE9MAKIOuHEA2Oc2PMvjSz3GO6q6IfrKZQwEFsWNgqn0g+dJdz7JY9xp17Ukt7vH Ymt5bqqXxdZQjcAhdOC5S8QM/MATqbH2sFzH4YxkTGhtKrvyBfzE6pWcEq1JXAXGi+t6laXWb6aL 1yxipcnoqXgI7W+cPrrRm4IL3H3Hocuz5J28M07GPj8PJ58Xi2I1HY/coGQBaQoH/3fGRMhQEL6B qAgxSfsEwHjIQuQHDoXApI8hEBy4zaaQO3DhpeUwke+rXn1jWWyQ6UUDBbth4LURU7CacY8eRr64 SV5m8+q8ri9hc1R1Dso1fEUmFBc+cpC/6TqqRzmW1k+abmSfnJfor4vJCAiaKfoxdpoojEjFcM8x T8chNCTMajeCTSIt2d0Z+RjDaa5JqR8ORDW7p5vFmPLhONSIE0B7OTKOeT0X7RvahnasrtXai9EK jB6sD/SoMOsq2RsMWEUTZciMzR7o4lw7I1E4ytgBJYjQFPGAB+Be5NXRWUeb7VH/eFt7qeTdMbZl shCRuJonM0EF2iau9fpFNOkUcwxaq3MT56aO9rUVBw3ODapXiqqu/0LD2eq861op12kBI4gkJW0D NVDcjKUSETTaEEwNAHJSp2fcKycSPOObYfI0EiR9JH1QOEVMwhw2V+cld9ULa+NimnjBVM/birMi X9F6lSvM12cP7OkWucG1RFOca9jBrHaxmiqDIIOGc/R33BDNvGst259p0pcojGkMw8S5kkzJnrPm CL6/0pE8KfXjQc27c/bd9Ma34fREl9V6bl3bbWsh5eEoMbCGwfaZipz0ORSr1+PjaRfhZfLK5rUN SGpgwfkWEssv5GVYPM3zfcZuojkpTWZmKV353UGzhhmDXE4Xl5U0MkYVKLHCVupbjiv3ZHGYL2EC 2tQpiqfpgDUesoXbiig4FdsQ4zmdYBOsXeogJXKMNRwF56QUbbzPo8WH1Q5TxK45sjjRZHBnCQZ+ vUIEfMzQ9aSLEw+R6l49Oju8WXawGaEYlDSgfowM2gwmypk3EhsBf8lbQgDlTcHaei+AdjW6ylc7 GHQiOykQtk8K0ZlCGhZXK3rA4DDVWEvTGjCXfNgaEDEbCrB1jkOq8QCycsm1Xrtkq96hSAAOayfF HFi4Wkdumch1S+Jr3GgoPJcumUT3xeh7URtvxDaMAo+ijTsQrz30P1qt++PparwhhIvaqaKYuF56 Ii698kWlPjg1Lck0EnwDRzxdLIjeiohmd5D7QCMgUdFz2giohGaqzFapo9zdcyYbUww2PPrqyi/l 3nRR9kT2d41DYVI8UIXMBKQdBIpL24ROvSiocTAcgAVz5TS7A7Pdsgyoz+pg+92aW/A0+Vq2a33h cenId6eKy/VHTebaUrGB1MSv9Q1w2wZrJEJ5g926tzyORI66v7vqxfCYt27ZoV4ZWi2HlI3RnXwA 273EwWU0O5s5mzcFNPSO3eR118wve5tYEOWuS2BWuwR0FfkWIBOdaPxJY7xzTL8Az6IXLurxRw6H KEhsRGdUH+pnVZug77u4anefaaWe20s3znMr3PeSjgtFr34HkgBFrkC0G3KlW9v5aYmQG4OiY/rV MPZZcbYWKYz+DIbNtfGjAzU6xkg18ztaj742MmGde1VC/+uSMbmBoCfDcFu/bcZ5Upzx6LCdRlYN M+/ZHvpzbai7HmFEZ6bRr/wMmGy4TeDfyAxg+Qy/OTTE6pwKBtIEbAolzPW3nEq2/h7N21FDqkVi SR3wtciZM2xlsM+NBAV9jKWw2YwtlV/AjElL+KslgsXrcjUx0MjzfhBJYSYR6rDxDLlIWCqYivA9 dkPW4HbKo1x5qLIB354Q4cfZr8+orktsEF61W+Bo32/umUc7iM9CY8eakPiWbiP9SoPte1VHT6nZ 7b0EMwizmatpzZlkhCukIuyh0X3Vc1axd5u+WebX1Ngp3JTuvTLeMd1LvmluiQ2aF9j5+Lj413vY Jf76G02MNt9L7K8Qc1mcY9uriVANeyFS1LUXib1uiY4FsvH6xt6o3eZMHL5Imtp20zpuOKTWpogg NOonOIZxZGyHoNZIWJX1aVHm6ictzZJoXG9NMl6WcB9jyYaVsoN2oG2+Lmr3hPDvclXAUy2e9k4m gS4uar3hHsYmw2uYCSkrpAqYXma5yD/RmIdTM2Qj7hABGIBBo59aZuPKWytq7IqdHZ1uHVk1siPN zSi3cms7U1xM36bdAs1Tm5GpPP1iw3DMdln5WCsU2G/nwRuxkMeXOvknIbOK1APqmEZCkCHY03WI fm9k5ehXfeXcBmpcIYJgjBekpYCR2s49ci5OyOkY3YvwHUWunkc4Qz4uTHtFSC9nKPW6tS4izKMc q1Ug3LKbHEaB/KOO+GQvOabLEju77Xh6cmJO8iqAJH6uImsWmLgstxk5gvneCmfkjokywStgtnyR IHE/ct95jFbo6NHu3WrthCN9v1mihQ6sqc8p3aGyPdif3YS4oXxmbeOFEkX6mLbNPd3JN2EoZL5d AgHlswWpiu3gdioaqAVb1g2pvK/Cs4nVFRHGpz9/+F9gu3BwmupqcT3+dPn+2/+bQvW34LkP23+O yAODzk0woNGM9rXJRJ4n7zanomtJfihXl9PF+fNyuaXUtOSK+O5q8cNzaQZfJhqXA8Npco4kKOfG +MccqxS1Hr3f8HQQ/wKnKF85gfg1Vv/mVFw+2Y9LR6OeWxyCsdU66H/+f62D5HnOua1QPFCtKd0S mcyjbyaiSsrZNKH3fcrYBHU6564KB0ZdYdotkx9PzSem3qTCjjhoca4HdDlO5us+2i39NPjFAYAi 6/AewxgfIkoWsxGKTW+ebEoXeYEVJK47N/YWhnq4MC5ZkeQcmxVRKVe8kIAT64QFFEFZxypIdQOV SFp25b82zcBH89sNW1+tV/Wo9Wp/g2uD0dP/Ca4Ovjs6CkPPdNsLeuq6w31u5w8zLqHFOL7moEew vzFZBdqyjUs4EcXE3SW8JwjDLCis1HRldk6VUd5uoIkxoEhOQ0MHVBNQiepR3BkKzehE3zGbTzRI mDEz8OOVxobJk0eUJg+FfJW4P3DwhWuyzDin+ARAZMIjedlje5TzUDvZM0EAjZrpFZtTEtV4e5de btbNWygSsR+3y45A/V4OcrOF4tHogx2WsRtyyyOu8GxsjZaRBlAT/tPGHnJR3GGR8LX0Kb6l42Xr p8Lc+8vVFDBJG12REB6K2wJVbrHNr185PLShPdyd2CGOZbKCSTBCFKzoF1IAuYQcDQOlY3PkLLwr ryqvgwX5jPVw4yqYdYkb2mN/X9dW6IHFDXCiGvxIZKC880idNJ8XE4xJlxyuV4tt49K4/psKXc+u fOv2sv3HIc7T1y2DiRinG2RGftgHmFUILtKlXJjoMvbs5cvXPxy+GD3/3bO3mOikPUr6Dz9+HP5D 9m8P7rWTg3wysYbUZDW+KPASRjMGSnG4piDmreas6jx/fj8P4Oug7Xc++t3rd5jHJSiZpP880Hhm GPboaiFUSAf+Do9PZGE9l2GZFU4f48UvgD0ZBjO5koQBTFxk4/kEo6B02jhX/U9Jvy/9OSF5rjBk ytS1f8RG0kwETfCZEnPAiy4minGKFSs9PFc1vv1KRsmOpyMhzZGU0zHCT8kcRW/VZVkyN3nz/wXA Q/Pv5KsP65tIOOk/oJTs48d/SD2nQiykjuAYPAEJzNFpToZoq6rDsatyDI9eyLuht3iOP/iYju3a G47KDDGX1WyxmXeCM4p07HThO2+P2fPH6fKWOm5QvlogQRobDQ1GxYOyqALouovlZZcEWZ82aLxW oQ6LA8GxRTocCrjDVnDkgHQ930wnZXKdfatk1LpE9DZluke2RHuADscaZQvXDsuRRxaGnnCSLl2U qOWC+pLTAn7ptnqYevleDjiGtQ3HDIOhM2ui1GHwcepoXHJ2gMoLcRFdXe6/fkK7yccwzXO0vkAe NBG6gpCtVPJ7lGvRsey0FXiEXQL4EHbrEgYb/bT/lMgDXgVZlN8As9NhxiHTZ+vUnOBjQLXT/Ert kKC32TUxzxqcv4epQ0md48ab7cqm7uYbZnqZA/Sttx2p7Wqye0kbCxE9iCwH8HDE3LW7txLKXu51 8UJE3r+ozDA708V4tpnwl6s+22B1b0sf6vZ8kVcXjTQ6fvSyRjtAY5Zrpg3u37+8DsAes1Fnjt4Y nIdDeVKdCJqE5FmSAtwpahA28zBl+3QxmY5zCpNIXkRK9/rWun7yB1UPaYMVQ8C2fOWG++WzNRi0 gkv8Yr1ewsHHI4XCwId4Sz/ECg8p3gyiWb/CXxsYvL86DrIcl/5WQUfQ5F+TWorCPWpyv4DqijvX Ni24o3T3UXn6Zww6xJFFRyNUifC2sSLErltYyOPLawy806FltmydXzLfEOrUovioZfF3txVMZs9M Ts8bLIrTjYkKnsXTLToxdPxJaGsrpprXBjTh589I9VOKuO7yukbLpm59KYT4NoWmonXiGFW93zSE Fp9wxq2X17sEU8tTnj1gNyS4aseHyZ+mUA67rtdGyGk2a1Y1WFzj4MBvl4hHOirCV1H78I0Ugv4J urw+trOLjjowEi5lPUx8wGTtALhawoegJCB33USYEdRdUb/bIEAY7EeTZRmdhLSfCsUTS/xj5rHi pdmxMs2tBVUF4UJ5/y6SHSxp+uBngGhRSmCTHRFecxOAZEmSAipMOSE73yEegCT9wqs1x9sQtR/U jOLIjIQq3CynNeeU7wGeZhprxha0gH4LY0LrbebMR7jbckP5J7jMNsDkjKP9GndE0D87ev5c5PxT UfNOxLwKHUp4uYbelS80af04eHblsBBKvPbCs+ykKqyxVcqmUxE47HpK48nUXQ84gEWyyCHQlOku 1DHN3JbNsd3ZNDfWf3yyT353bZJ0ulKvLoRAvZkUzFYUjxfRXdR6MJZ82KxN5Lqyz2l6h+Q0u5o6 HmAwK/M0HZxExSo6q95l0ZTUzc5u411SXy+8SG5tsHbP7B44X52oEJab00lxSDnV+M6M+m+jxadD /RafjHS8xLD4cep7DVypSb/JaoUrm6ZD7JcpIHKM8sZY9kxf44xQNEvqKhYVoGPF7UOGiB40WXj4 oesxEYuicTBOdDssYBqx1ekQCj1fd7W2fAgS4sRVdYzihPJMKHHeFSE25VCcI8vtD1LvBYSC2mGM z/m38K6q0jB1VRZFe2K7ErNGC3LbiIkSosQ1qRKP4UlwmEGIrpkbFj7p1vCpxwkBpwukCpZ0jZTk ovfJ4him69ZUHD6lqwvGTTqieGA1rVS27hzupwJYrFGhJVN+PkVlhfKqmTeZZLFiANdOoieIivoA kcNuhHklhRaFCpBOOdGt37VC6XZODXbrQSyppJPIePqXWNyJxPGQxyI6ARSgNpgUUos28sucxSPD RmyvHAp1d7ekp2HeV+h4CqnqAHJrp9RNS5OlXGBMegp1kMyL9UU5cdEYSyLVXmg+qR/8QFiJZST5 zoHIDaezyTy/ge3ojuwg2FVQYjrfzK2aiwUOOC5qoUo6LqqiIypfrFDigOG60hVXYfqBH4+H9J+q RCBjcqAqSPHOE+RAaBsEADt0pLBMxlIItJMWhvPAuwmu3BmA/c66ZB3brnlwtM59MxcIuiPa8IbL cqKa+OhATM4iOMOIkQRyW54Sv6BHDLmkAaV8nc8u0SMRqRKjdewjcHpZTU366wMbLOlxMINGNH/g Y1NvXmls3nbpduuVltgnSls493SkQG4SU2PmPsreG7QjqoCOxDLuJYHkP6PX3QjIVql20KSQPPBp CdNHm3Ni4MUyKdaYDwc9G4trXe3EW202eDLptaK7iwWZFNS4WFUqxdRn56Ry3JWaUjYaZzVEGTSP gjcucRcIEZ7GEngutxmFf892Z+P2zt11ubqsXL0rnRnv475wW4Cleqe7G0pKgNkIZiwoW4xw9LL+ uKNAZPzzTTq2lv708XgQcl7TnwrjTwEqvhfo+sfkB6N8uRrRrcjKWT2VU6NEX4U8U4xPqovE7Gmk fuTAaSctayGwsj0h69MSsg2ITwllTrpqRL0umHDe7/2hf2/evzd5f+93g3vfD+69a/uqNaw2v6RK tj1jhPIGaBX09KTgJRRoxGol8gTfAqpgFSzSxGcFJquumISCu/IIFubd1UJtutQIG+7KWf6X6Wzr BWH1bXmYBL0stmy15qCRKYlnvcLHnRu5Swht3ZBMUqqeBBERHMzs8hZwPWKMQdMkBnoZ1MhH6TxW 2KXbuXjU4MMjRGn3KjHqNeKMtKp3JhbYTaQrn/ob8qwulJAIFeMxxaw0k758Pnr28uXweZK6ewWY 9xantQMKplqjpm+zuCTaSNJMVOXsqrBcJBIFQI6qZgRffdqU7POKWYaq1tHLl4e/ffbSaP3T+8lf k4/Jw2SQfJ18k3ybfFwnHxfJx5tHp/jPOPm4SlWAk8BJg0GVFXIeuOJeYzwo7xUQYvPyquhwjW7r 6N0PR69evP7hnaS1c20GZGpaQFqdj0jPO5pMq0s/Hdoq/SOwWv2/nHwcfPzY/fb4j4OTB6jBhiJH XVdfTdc/qZdkLWaz4jxHiskD8FikGNVSSQeXloKxGogdxTU3pWNLB2ktDn8wBs1stLxNBZrSQmoC XYnMR4mwZqiZG3SlKw47zJrSaunr1PE1x3QW4WxG9ioSX8BUk1HcBpDOm42od4+qI6ApamjxAyZZ EdS9vhity9FZZea/l+STSb4e4i0pw68t0e4loPq0lekrEl5f+Fieqqb3qn++VxFM1bJnymqyEm0o Uut3h89eaD0PVVdLHhacqhFantZ2FY9T4K4NnO5dbhAPYcHWJmivAQ3OpqcZvd2x01j+M2zYTtyX I3ZVYPiHNfH4+BFtPB7625TayM5X5WbZeRzsS9NS+vBeJXPql480frvhNQ1XwD5G02q/ze7AC4hT I7kMVG47sVw0OwqKxC22ieyg7Ubid/XNFO3N20pS09tORMkNHj70G+86lgnPNrB5WB/qXPuCB+Ds kUAJNZtujHWyS7AW2jtu+E1ViLITE8WjUltzhWOjdER7nA4Ejvr0qnAPrbXnlUbQMEV+htc9t03H gn8GEa1MlxhU3Tz4hRwwODCFPjlSk/yyAM6tpAQQNWJ248bCVEjtvm2z3VM7dYVyAO3EUgoM+84q KwoM7yhK0A4RO6rJD1Uwnfb7CsywDcQnbQWq0vN9DxiaXe0ohLYdrhM0pBJaZ953tboo+1ikT6XT eEvOcuxuatF3iqY16ilVB80VRt/Z18r7azkpZv8N71VJlmXfWHtv3ehdtIu8GZ3OeC94lMTH6n7n 4+RBl/6+e9BNOtl9vGDtcfScGnZYCy3rJkFAo50VHDedcjE99CV3JdljXrMzBRzw5bRwZNJHlDBG pXJJNZ1PZ/kq0XxdmwUxAWTjBZSVIf78co40lMZglLjY83g2xUiInhk5my4xqebrANAsY4x+Ntdj 7GzIRkiEMwJLbdYEhCYdUNfbR45zKLcIaGgWCa/CH60EC8nEcSz2huwMLu8ro8eCnaUtotC9UtMG G0fUqnClPa42+1/MDHI/kzcBVVzedGLCSJFmAGK7agalwPrFBct6+LWmzbDmBMbsDA7M6SRPbgak Xbqx3XYDSzQxIsNPhs+9ird0w2IDOJyEW4aPuqyr8NpTaZhvzLZDqebKE5zJGaIdA+dcwgqAuc3H tBYft8FEb3pmGuG+0xGU0upxblN8bByxe92UfsSyWxIo488DMSvs6BsRNntWTfVImqatnps+aoR6 VF6VeEAzrNH6PFPDH55TWgBvbT5TU2Dkk5hrW1bW5JEyiHU6vpxpekAOHUmrq6HdmvQdZqk5lTcn 0jIqnqtFZK0dUbx6bamxp5HC//C8T1kRfKVh84JLe3pMpWNdZG+DUzS0xhuP3PY691Yc4sCznkwO kp5d170vUVUgOwfbqYqUFaKMBtJKIxMyKdrsleMaH7jLg/WygHpzu8fvMGS7p3qkFQ0vG1HA0h/K KGtCYSOj6xBlbggOnqpwgN2Go4JQUP+swHZgDOALFdx4sI5TvGqZ2odCJyHg7BCvBwh3VtdLzkI6 Y9uiZknwg2XMDL2lVKDXqrdXXMNx9Kc5m96I7yIHIiySU0DNmKgbU3lTdgBCntd4bZGs0nGnlwwm jtQLw5IkbSboHM/smkQ5KmLG6M5DkoN9f/ju3bPfHr6rG65clLMJkygFZ4HMolI8sgkwZY7hO9oB ps/rDbLXXMQFJMSfxOg1JUPGfNQAWdyypA4Ilr2DaQqmWg4aadVl7lFNVuD4JUI3qDRiRHUcWCWh pnKFcu8CZfgZ2lCs6iZZXIoTiKfIEpyVm8Uk7YYMtU/1BHoBRil1qyy38fbhk0fw368H7Z/cNvo6 eHCT4p61IAp5QwbPoI4Gf75j3evHv4ChPBnsW6EtyTnY6H0yXcEFWK62OhPd26fi8Mejd7GpoHI1 I9GNawNxPSVxZcRLD29J/oxcBpt/fHj70r8RGQEpEk+5PFBNx9DWiYNDieouXUdQ4SyA7glxPclB pDxnmEa6BGDgCKpC3Xtg1ENTidNm9MZy1Omur7Kv6cV7RQymwt2IO2y3N1ZjypbAuY1sutLH2dOY 6TOCiS50JGlq75CWTc+a293R7L0JkhihM2IcO7nXatpfpRL1no3IYoWIQGnYJeMy5Vve2SCbJWbn le2BmyIl+dpOGRVuFK7nstdbvlTNnjV+H0mH1rX/TYJNd/0dBNQB7SAcHAFwUgtz1CQIwaomdFVN EtJunIYNWphjZWcaKH66Cd1DtkaUsq8YptdpMHSOta4WSUQx8wmhZOHbCmfhehw5r5Zk5u68jrw8 LmxacatdH1IVBm+xXZ4IIJS+3m0oFdi6OSS9QHBfsp6QHMKxd3NYkwX67UH5GgWLgU6sgZhvLmLk b5QsgpAO2tgDuxq4SHABt5d6Vozm6vR5fulbK9RYc1LWUwfujLODVGTuuSg7+edMQfaRHlMLfL61 ks7pNhGvBuAr/cBrtFPgIMAI0JpeLenzmh8UmYPw8tIhTEMfqoXxGUD8CdhwDGDgGTxFNy67N2hV owaZS10hoinv+5QvrpHMb110pF8E+RWTIWtj6lhsmeWTSS0eLjNuvocHoTJyJ0I7mF7yKB7HbNmw JcyeW0Y23M7NtJQz2W6773ywDchWPH6ptj/xcyq0xT/GD6zsGrLIpYGHlrI7rWTdBatt8vptYpmt lAqn3d3mt5QoazKJ8fDotV5i3rPZmYpZ67QJ9QQlUwdbiDpXL5vx8HGP9+zwcQ3BYUk5KUgSuJsZ aLgiQxfEccqZb2Hv+5vzfFGi4SVyrIBkMSAIPc6u823FduEdZcPKM59GWUDZ2RbvNHLnL+b5Yj0d N1gzi8AIIOmRBAE5Ok6jTeDjleSk523HVQbBIQouW2YlyWZ6giEfZMI7+WI7h0F+C9j5z5tKu/Sx pye7pIVUjXp3V4CPs1keIetooQJ1IRZ0lBFUJO3GdgL3Cyf6PlVySVQgHWRLrHOMnxKeISQtCMOh 0J1KBGnC4tEFqJ7GN7PW/D12lOeeut7mXNhkA1FIuIS1FnUASvaBiPaEzNJdIIP1u4ydw4oy9eFX zCU7nm1wm3U1pduqqOCQQk8eubWxJtuGIMIW0m7NPUg2aS1Ix0ECaJqCcmDUELbAZM6o0FTxt4jk Nwv0+lhwZbKigNmhcYgixZV+bhZN498seAbUbnVG6T64oVsHzc3Ghw0VPA9JqDBIuz/HLBzqtw70 cfzlwOPVZkW+2CzjUlNGh4stja5i9qxxlTnwFSeBQErgbHqD1AkJoWfbL774ollwxNwZT3k3EIKE tFnlWLNjrL5NpWwmMQfV8BFj+Ufk54Tqwlnl0WgOKQvEMGWOpR38jhpTmbSRDdcN8A/UtxBW6LQs LwG9TfqnMI3kZ0hvLtbz2QH6748v+k/7FTTY/zJ7mj122nD/e/Lk0WP+8fjXT/TlnzfzhJNl+FPc 8j1seYS36aNwaeSagOUgBlYmr5u0d2vB2uXC9EPcVpVsC9fvuX7tHzzOnmhQmmpgoURpXb/PF2Xf vA1tYJ3Cqc+vj0O6ZOyViYXhG3Of3qWYtoJNOymLitAOcpaIytARpbKmF/LXyTksaCoy/we1QcRG 7IkueOMGYgt+SfU3u4boFHSarR0xuBOwCC960r+CK+FmPkvILIDBSzQyJ1kcRPeE9NVj2sMMx7/X Y4iPVEOfJdyMwP2fHmLaSmW5FiiGyQ/P31nU080QMbJkGTEsq212Rod02/rx+5d3ak69BkwbLg9/ duZIVSKiNuObh0VDvp0NDs5zVERa7wWUi3WEqQxdwsVygVyYsLMGgjUmsBPpG56iutDOFS61+6vE SK+6u+9XHJURN+0ShZLhyM4gKuSQhhOEboBiYwEsAKxmLC9VR6eL4gPPMR8f50LvxgNkOMAT4ASP Z0eDEUz9SaMy2CZOJlELaL1LLzx+EZCXFAoUlCoERYI8n4QVJfZwx3QjA/AT59ROGYZMtpD1bP9h XKA52emIzY6YOpqKdf9w2BfzfUJhwEQsYTYpr9g9ci9Duo4NgwxeF4fb28092sXNEm5rIFw04ydG KabJqMUavtKctphQbs7mjlUnFmpZt3IH8zDhLtaaNPSY4zFU4s06winjLRXaOWX3n9P7dWEdtxK2 fMrEdvrF6/fPXr7sOmwPVhAUMa/Oh2kqPHGN/6EeSUqg0eXI3869R6VUFSEDp8n5htI1obaS+FpD F05QLntaYNKRBBNvfvvFt60A20vv/TmGi24r99Kfledsslqdx4z3ejUuokYxYPsPoIOk/ypt7Y3+ a5cpqu7I1IUMA0jdW9Pd/UuxjVxnRL/6RH/9lDAoduHlsEDZqPgEN9XcWtv6/raV5wDc01j7MbkR sjGe9y2id3ayKBcxd0XqJzRXQqkQJuPp7Jg/FP9NWJSUUgeBXEjlYpHcGw7OlOGlOjSUBaBLFbO0 y65R7u9U9E6sdGJ/z+nz2lQ1z5CTqsDCfW7gjp1+im2BrrzIJcL05dMZnqFFcY0Iw4cT9mIznPCx WBc/DVRo42cC1fh+C4fWdPXOAV0Sj3sWeIPjhjRv2DMqax0RZ4C0BNs5k4DaoXOMY5U2C4Q9x3km sdaG4jHQF2gskIVGWI7IDBGp0H8bF26iRcrIoExyWUeYzDzsEUY80l3Ql174GChDfHo+LhrKHN+o 9MF6eNG348eDk5PYEDzXNYabb3hXjnVl8y/HFxcLWJMUtI5cnCthZXbjNFjMCXpCtRxxZk1cHVsi Jp08QSD17q1RdLYbaqY77+j/NkLc/f8R7u4QSIn0Rv7ucQ14A80mbg7aFjs2X3P1W7SoptwOjWkY saVRz/hfaeyWPdbAKq6cwf8MU0sWV8YNhw2gHzfM6iJBN168KzfjNepzmb6+olCuV1PUtDgOQFFz VO2D1UyGBs2UXOnWLRnOyj3M9ISN8nAfVk2bnMH3kN3sZ5ymoszMGlW9EdUyLbxv7mEUcs12abvt x3rcU0MwKgeKtgBAyjmDsNF8YlXO2j937771lmWk3v3+VfI4e0p+I7JGJVr5TtCgDwU1wMkT07ue IB/T4XgdwDwh7xu0J9vw0Reo9SlhZk+hHPkf95LTDWUPgH2/QafkUjubardBW0g6ERBZltXspbiG ITPQPCmNGcbZjac2iY71YZ4Y9aRROKT7m8m5c859dGP2/OJXbzyCOlo2GO9zMttbwSbJTzEys6Tm wcwpAHF5XdFZxiVgvyCcIDIPA/a3ZsOwZ3Bv17MGzzghti9CzHb3Ldhumt5BO3mw845so7z1i6H6 shioegFMtaS+Pq8sPhKtGiML76wCUkJ+MMxAc4gRYVWu1jtFm1XxaVMsxhRCCTFJ5cSSlEY5I4eG 4Z+iLTQm70BRH+v9Vfpnc38wWCjGIdZkEfqFjS/K6bhovsQc/w4YC/GooXfuFC0VxRvtu1ffI9MP ZwJedwPpymZBljtqrwOkDcJEl8lLXII3TsgULzwILDxidsfTOTQzwZomyiFuShQeOooFZpw8uSRy EfbindZcNXQhufNuXRSw/61bFxLScCg+XtIhm2WYRIAH/sDrmFUQbQiNTlizGoC9RVwqFeO9VjfF oT1h9imwo0pbse3eKm28/rEsyhYRRxu6ii0XsW7UaM60b8PJBaZ7twV/jXvQuLWwfDQGkS/aaQhF FIk3ErOJI2cXN2ZINNSPBguok7+U9VBx1v4xhEwwLe1+R5CbToAwe6HddfcuwYX+k9BKUTIp7X4x bCROmuD1Gr/bffwZPdUJnj2DMbFxyrnVc1F21rU1MR/B0UYjLwD3FPiSmoFgVM3zsjw/lFw0Elkn CNLWMj1pEjR6kHD6Iny3ajLj1DtdGd2YwKb1vQRNYV22WsaoLDKMQMCFDURghqGWHN1UwgihdbDI Wia+eEvMyBxzsC5dMJS6DAjDii64lUwD0BLTpeteoJMxTLyJIatrxMZtMmQXw3r+7tXGiRgmzpQ0 1Cwc43pWG2rHQy0pkeu4yWEScyeBr+WS0rW2dwqATDFUOlYDoXNMp2Z/eflfcHmkni4WjaN/RaNw umSPKmjgyvewcu53Cgp0CmQh0iSG1LerBveg9NXg8Wbbwmt30RPWoKdMAztaLfFaedpxAHrQYJwS /y9l66lzsSNQTXxiQhbcqTWd+Z47nT0z2N7dGmvwjWPlkjviO4xiDyCTSPYLIjlwqnG9TLrD7A1d 6uhgGEWcvGJDt8LRm8PGsrCqe5a9KGYzDgdivjskkL9Phgw4yv7mQHCi6LETFmblj/FQXpeUpdI0 tCWzakFsQJKXSDu7PplAt04n5bx3eANzRrcisgaU/RHWo7PT17DA61IayMiJ8R3bTHD3NXsT28dt sZEWohZQ3HyLXp7p33OTygxw7hruTr6PyGyYLoHnGAgzo3CYr4B+i4RF0EayBXx/v11SWGzz8vDl 4fdAkoxevX5xGI1o7iia9WboaO3urQLs/14C5O6byiYguX0exY3DjNFxmWpWMx5uEMMLaFrqTqqS /7SXkkk1aq1h+s5m0zFqAtPNQi5pfFA7pbR+jFNW6VExVAaNbMPYCJm40k8yfBqZhMGxpqYLFGNg c1gD41LOpxXpmvFZ7NlTjrBwyb9E7T6pu9x2W03RiTTihZokEf9iH+jyWsUCjmRBkI+9Eo1y24ga 6Ec9agbhGP7Riqc2oJK6eiEj44aNYL3zsWtPm89mjhsVySqYagvUQhObnvUu/Wu8fAkEx8ljLq+P 8eVJHStgs8qVn9dA7zY4Jh9jFRTSPPbc3ifZZbENfaFggIEeI8N3dQeWmcanRgEGix6rMaplgdgV qSOSPAVmuWaXiSfAx+ZI1J4W6+sCrlAToUodLg8ktuUFMCtXmBMVWWqSonFCOdL2chtTrq56ZOyJ RKSLdK1xswt2JDxlRR18r0rMsQModVVi1P5Bx1rkGOu9IPLQA7S/+Wu/S7/ePaC/2YNv4e+/Pun9 TQMR6WZxDP3gtOY9Mur7rONS090oLjL2zGi7jZ0AzZPGc4NEDRwDiBQYhcMusyAcPnsInX8/onkW rAFC4GqoBzG7LyyswuP6Fq3lA6Tlk9ydQgPhwnNmB7JCqLmPkOIdr3H8fDz41QlrtI9/FSS/OBD+ bVzONnPftH78qDd+3Bs/6Y2f9sZf9sa/6N38sjf+Cul67MFvBjM/3U9V0x7a9CONyOBT1XaPUrd1 2GeFQudUa32JvwPhNAaHfIRtp9/+eBQRH58tZKAy8byPHjcJF6AtFNh/25CLw+BkuzNYt3YGrEZ+ Wg0fd+PCALO9MrmmlFgJ4xt5ChmB5sc7QGMliY2ybKd0oCG0o2gODkVSSaeJumwyMmi90+8y6qN/ vzWQ2z2Epvm0+XtWocRd929fpBSA9EuC+V0a2d6ShqVcmyz0xUTsN1fFuJheoVAUtrsc2vGjAJK5 g5IyBwGLZRwfiv0sSBHurwjS+w2zS+cFm4zmLvo5z0FAo922NRqxn/IPeMZ9wV1ozT3YJRn0UDib qlZrxdZQExCGTsnPApzcNo5/SdpNvmkUJzLpQC6MpDtHX2i4ryclmZFmWYauLRf5skJF5nW+wK8N DVVrvt/nJMVbF64mlRwbZSRwj/QwQfJqen6xbmgLhW3TNYnNWK63Lpf9GdAjM+s2g/aC4kl5PR0X DS11StRaQXdar5foG+BJV3OYn8TwCeSK021oyfqZEkRATpEiWfKBVoE/z93W8iC5LAo09duG3gBx A+0wMLtYauvl3N1LBlwjPHp8TBvMru96OA9EGCpFRRzait+M30fwRqw+cqZ4j2AWyQlqj9m23PMq 5px6sqLKTuN2rtuqO4hDeb5dCMO9R54xgn5KDw/SZLCrcdqn+7b8It3ZljCr+7b2fHdryi/v29y/ 7W7OZXj3bfKL3U1ajnrfBt/ublD57Vubo7jij5qpZo/8Un3AzkajB/En3uM47seNh8iB0RNt7IJT HfgoslmJTCD67nEYVOO3x34GNUieECQv+XD8gh7+ZTdYLAjZBc9u8uIOl388Ziq2bHHaLVsnlI/E MUlUWhLDC4HsJHLHWwJisCftw53bh9u5vbr7G9FshpNGQTuaZIw5ym7HfjERgF2PO/0hR+bn58r5 0kuxpTTpQNcaYs8YdK3ZKJIiP6y7HNsnTyrDvke5dd73yFobp8aeF5alukBndyI3BkRGOFXp1rE0 gDU57JHiiogOKnO2mfF3hHZ65oYZvCg49NJ1TgbJRJ6Qe5BhdIAgc70LkQgp3SYmRT4zdiukaKVU Fgg8TAcxKJTfYp30+TO5cyGd5TRiPW3x/OQrl3wSb+UcCUIYh0NGuQolS1GVCxYUiXLXkZ5UpQKY nEEfJEyZIvz//tITVZEkd9eRTMpxg4oEd+PeCpLbzRJqRB864LiObRs0oydvaIAJdUKH4kX5m+37 /BzTcxpWxY9MLhWb3GcDNMKFMSkr9vFMs26SFX+oyaGjg6qRYkaCqUa4qFBaixFF5KU0EPRGsYgD tyUCt5j5dSK9XY/7XBbYrUf+LNNu1i2mDQZdY5m0fnm4VYeoJzCmHJFLqpF4FpusOG97d/lOlMMg YiYA13CH+8F6i/ynWfbjji8u/dlP8vMZUp+950K1Mv8Oy9YgEvp8UK166d8D2r1I7WYRlmSVjB+j CL6InyTW5SUS3Nf5ADdhPPE09po+quvPDCWWflv/aGiv2EeKiTgME0JHVqSt3EQ7ZhdZVXswACJn Vxy2Lv0ryE45+cDfju64YB3XKSkt7cTJSTNlWmy/VaxParrj+4jvLbeL2OVFZRs6wqBqpq1Bo1iZ kj9RfGhTGKbFsRgY7LTNluE8AFjJgICu47iCL7phamDcMmRshRbu406w9oKfIAogb90dXbQiIhnn CKA5s1GX45mNi2s6EaX7dPLxjgKc2i0McKhSF3W/9U6ENh14xgD1Yt7l7ej86yVVXsIFrbVBrGvE VorO/AJ/I98iO409Z0rDKV9TdkXVNFts3fOG361V2sn8kp/3bYQPFaqja7eu6Mw7PNqemfDu50si /qtj0l3ZHGMB/BM6u8Dmm8wKymJbCTmqcU/QGHJeksT8rAwcnnVpqlvRvttyfdFsQ5G5cyhpWy52 faw8enm1m2COoGy3Pm0bY7djcEh38FNVPKEL6OU+s8cx5GrWY8WiIy10P0OI9XMKWEKnqkGTaZA4 W7nRs9CIbBCGPfvw9uVAHZIxQ2YFrP5ltijWGIPtITpTkWPyegXY8OFkWq2dd35Lb3HnTQl1f/hw 9GKQnE0eTb46PXvSn5yd/rL/6OnjR/1fTZ4+7p9+VYzPil//Ms8nuVdfFGnJk8e/cOO54Q2X/MsU BmtvB+fzO7hkJptZMRBRifPpJdq3PZcr5BmdWxjs8rKpCICAvT961FTgBWw5KPHo0dM+jObJV/Bz 8OXTweMvkwePoFrS+R4lPfD+NVxmWMy1P37D8RWmRcWNfqAdPNH2HsMUJY+/HHz51eDLX3ntwftX 5ZW0t8vOSW1B1Evw57cGsXldfcuHdJCi4UNYFgrBv0Y5aULLJHjYg4OmrdLfqIJ4ovkgrjwCrCHo IUWnnxynmH9ozxgyLG3xdGyvGvwz2oGwPBTU9JLGqiLCr9vdcf5qhBlpNXxKTzSJuLjmkhSRgikj leWVvGU+rO4Zahn6/aS738w4TZAMLZ6u2AtQC92QuCbMbUy2rm5uYbKP9WRTKRqmCqFGYRtQjBQB iKM/TEbe2IK6J40tC2fR1DiWHJlb329Yqp40NU0UfFPDc8mGzVm7r8d435Oxrt8HtXESidEj1Z22 7iePH9F/n5EAbDTCoCmcKY7KmTdubnEHSj+7uLUorqA9wBmUfQ/F3HAdjIGB+PD+uTUiRqlyjrKF z0CiHOVM7VJSNAfsy/8T+P9A/t9NOscP+if0K7sPeMZLVF63Xqmr1aUCW7oFkc6aMp9zN39BR5ua 6vwAlWjYghB/piQFise4ST0vN7YT0Qsm7+5Z1JN4FnV0zlhM8hXtn/O5n0ldk4PG4ulcj5Fi2Z3R j2+c3WVWxY1v1tl2bsRykaRkxDlod2tby482JM7D/W/c6Dk20pDZbDYsjw3HU78ZcUvcSK567MTe quzwT604WaqmC736yNWn88jxueA4fLJFfROMuNnU7TYdEtKqT9aNUeMOQb5207kku2PnjYu4QxCI HalRveOC4UyCZAzDeEaPTryAysDnhlJ8aS2Yqui1bno2zsPyopbJz5SE3T5HY6KL/KrgZEoavQr2 0hdO6G5c0WOeBCQcvHhLqj4yrXrHhaq2+GRYnRBHITk+sfnq6U0NtdJbQ94nUDWboGaLGlLFkf+d 1nuFgm0AS0tazVHLuvtLVrPjiALrJDjyCIWwDuq50sgyGI+WQauBcjAeM03SQF8JNFuS62Lgt2Ma 2emwg1V9bx16s9tVx6v4irYfSpL5so5zlL7zAtd2nIqaxX0kBY70Nq/OG7oy5W37zXI7vt2r87sB 1SxejrQbkVI2DYpokQbbQbrIH33Vf/Lr93CRP/rF4PHj7Be//tUvn371f0QryIV194Fx4hmWrTBV ki9XI48m2XtAFGlg15YQ96QAG9Y8QOI7nPpr3N6hIK221Zd7bPVGgBWJIrfPnmrUXLe7b+rM9OuX 6nKHVhhAT4gJxr2KRFrw95u6B6diip57onp2zdCX69Psw/8MPMJoNC8wO/tZ+Wn+4StBdMtta7nF +CEhG0EVUII8GnWdLDCfFh/+t9FyizKIDLOkogx2ev6pfP///Me/+zukHDSsEPbTS7BIAnukys/x 9liv8jF79GOtzUqiQhHpYAEyv0jSIU8lilwXSLqxH2aLELiCMkbrVyl5lbOfkdDRVGCUTyR/J9Nf SkbT3a37eoX4laOOppPidHPOYAq/TB8y207a78tYMT4zUUnDNpnhjjA1StsnynAihu3JFCigfCtA wRV9auYLL3kZgBsxq+127oyi3b9ow23c72PD7TgAsOuq9bDNJSLQoEGNt0Ka6cWuDcHSBEPaXzpD 5/1vel3ONuewXvTM6ZvwRNcoVdySsGDDNi5Zu/aZAS3y1Wzbn5X5REKLcONJZ47hBfo5x2Hr+pPl rRRuvEKWk+Kq0ou+vgm7bZhNGgdHX2iAlJo1yXJyTn5entGk0kZdbjmCAcDaawKW9t7eQOFkU409 QWRLcUrxhhZFeiSpCXfrkScEb1T6lmGwYpxi71yN5xR2e0QHqAMoBlcE8McM0AYfMZ5jWH3vY4Zh QzbGAXt6JuUynoaMuhyExLbkkM+AhiZ81A7gc6RDlNwdfdKZ2MT8c06eeepqRPXI73eYWDuuM81h ZYwtuZf+vQqjp8gfwLML+PlxMb6eDPEv5f3FHx8XmI8mSCFEiz8aSZPob0sI1nluZ5KQFjiqDnGW aKKkBUg5EdhwlOSMDv13uj0zpnI1PadIgLXh0t7MiB2pijWNcdWRwTqyIuhU4qDJNOAfSpxu59rb J+sywWGrbM2nhKnrVuufZQbm+eoSANmivMXdRpuFoh3K5we/LKV/kVekfOP3mNrcrJvL/tQWNRvP ysrz8I8MDRU/tw+sFQhog458pmnXdEs299gJmsPVXBu7fyhkMwy8rHPhtS07Ta7uHYN/L/Z/0ADd RnoT4f7mmwhtn/GWjc1CJ7qnnV3HOFqC0sE+5WcpTFZ3MlgvTZ6pFEQSc6TsTWWio6RKD5I2DKDm wMvqBrZd9+YZEWVtY03Kkd2jzrzCJYrla6Ox1dzNHQGCNkPYDHe/vuYFnpbZ+2I1x2jfP/BGEinY tc2BSXtS6BgYh/zi3UwJ7dXHae9KxXKKYYloz5qqOKGd2NMBPFbFspO0h0iZCNon7Ar7HzFI1fbr tY95D53Aqk77Eu5FzVUXwG0H+Q0E22dQ+q/r8ob+QtNwfY7PuKdBO4SsFfqiB4NGVjzwSse5AlIV mAKXdonUIyEH+am7WxgrxhP30pdh0mYhp5Ppb0lJfdpA6HfuVV0K0MOO+FijG8rA2klyr//kS5P4 bImJYBBox3BWxs/OwPCEZs/X08n6Qj37zQwl/9SwjrCMwXJhhMwCiERV/SaIzeE8E5gDg0f6fXl/ a/2z6Q0Gja03oB88SaoPeNslqWTv1JdfDyIWZNvpIXn4F5Nw94+0GK5qRmX1wOj2EXZGNhEhb920 D/xeBpE1g0V7/IsqkVWz7e25arsPHCqqQ5iA3qZyHaHiRkKSU/wLjQbJhLSJRY80dgpkxgljpV1o e+ALe0WU6yJ9mWF+N88XwGHAPPPjCHXaJmRmA+ZnEaZmzaGjvi7LWQUb4hyqUzZKGdSg7cvAsPme Dm/HpTEji3K17+FSSGLI/ZmKkzp/CIOAinEUHV2gBZN8rXFEsXs0tEFb+xGvNb2SeURp3DgSzN6M FQOTPtAOPIqKynkEBJqerBDF53Dv7VydOJVNzkLea4dbalqMDUYkGFjKGH4BN9un4d9KJ/ikb9dR rsPLO1IMUmMQmUyR10oJ6aU2B3sMllNhx7aavApyQQmiie9/3A1P+J2imVrQFHfnBgglIIrrOzZm KoNUBPeoxfZxjSO1it38O7cr3UmPqoGH3lbd2NZtHSTDz/kP6l3lsylJImV6qu1ind+Q2OKiLC+r z27aPU+CoCyO6cja6arIDLO1EC80JV10FoTHTTBZxRauLr3C+36KiTR4S+C7bKRfXEoEX4nFVcft RMvq0WGKYlo61OLN+uh1xwof36CVcydMkhNNjqyNKZ+QhHwps5du5DS/AtHaPOKcIgDbeJms1pKZ s93yduHXqFPj76i8wt3vRgCUsCJk4IpEFMf98cMSnxcLOPJjnKROJCpQzcAmCEFEkxs13NFrguGD Q8coJJ9hFbgqmhJ38+S3WWGmWVuxzqAd5qExmIBnjoKENh/TyHQwbK1AxgavRpK0jqIBq4xUhtKt 2d6lnrSGbCqcZupDdD5q+qGgCb8LHD0AQ3Md0ND6WeA1oOK7bo0rhFK3Asfb3F3feDlnrUwo6nsr jkarRCtS3x34WkufFjYwXm/yGZ49VPaRfR2jRmau4L2Z+93tGGqZpszkPZHmdgc37+nZ1TE39BXb be5/p6siv6wFAKLo1FCzOfoPaeRRdqSbvTZ4LzV2rS1RZUfIM/xC5FnscmL1/hv68nu+MmABRNN/ rxp8XAiZxnjH4C/ohyxBOpQ3mtW38VZMAmLHZkLuJBwF5sMxNdgyghXaTbhJbsiF6MnaPsVOQVc9 pwQs6JoCaIWzzWIM6zwatcW4xL01ytM/164u52rCtHbCJGNwc1tajxB/j3XbDjMjcvvHUuXEWUNo tqdNedSB1GGw7T7BEfmTBCsoy2fpJiiU6aboORlGSF8k8gzc/xgb/L6+RpDkHfXC4MDEfVp++Huk UZ1Uk58+vf/Lr0nD1ZqXaPYqJxvdnt3EuiSoFh9bjDo/0Tzi6jfXktzcFKk1zRKSwnGTwEBM55xn AbP2aioVypZBJM70/KJYtTCxxRzDt3BsZJLkA7Zhl2B2hM5Xs6lN8SFZwFxNWrWt2HQK+RtH9Ubi PmCo9Y0aamAIMv3I86JFOLp//BsFKEcvZfgRK5eRocRmDchHavxmM51NxmW1fkY5J57j917yDA7B +XM2qnhx+JsPv2UFhx7Rd1cLMct+Q4EKtbMMPuCb3+TmVmb/dYbQzXWwxtA75dkZSjNsuovOsqyq KWbHYBeBrrPSsiPF9npaiAEUB9SbVaviirPaDKNjAmLqBnW9UG/4+MmvuloN/RVNRTtsr/ijR4/g ms9vxOxv+MtH2SMvVuWiuB6NOmP0nw9d/MndMxKYEpUltGkzp3q3IdsDNzquWeWzwQotbOjUgf3q N/wdcz3m08bqdAucWUyicU7zyfgixzD+nmOk28KKbZ3Sh2loAMtNh7H6d4XeFLA9iN0sTbfq9jGg pGm/HldeVf+SzvbeqosafhfanbG9g8q9RBqIRXqlVMMWXjyaU8z/eyVWSBi6OZpEUxR1mOwBkZGg r17CvF9SblYJkrNo9y1hyzn8e5AtxExDVDTqWcYibCygtjDtmAdNxpz2V6kd7EnygEldv/p+nfnz RJ9/vllyJ2ZGgGMNzvkN7Z/UskynGrybIaYMtAX5r3HCQ4pagV6WUN7Wnqn8w58A47gdtorBrIsJ 7qSu6z1xNr2hAP6a5rAwobgwPg3lECLz5WvKzoOy1IAvJOmnkKEzD6UQKg/tF4noxdkkO2C659UX xzF6ddN6SQ4KPKSdsGgsU3atjq7sXkuapBg4BBbLXUYOxG5xlRMIH8V480ntJBBmacwWbrL6plDd lM/QUhg+1QPjeztaxsYZf+2o9XVsuDXXBYmE7mf5+AlJ72+PuIFZttwsIN+hoODwBk5wpTk5mhJu mU7C6vkM04JvAVS3mT1SbVFmlCD7nCl36+aiKPOfsbV6NuAtpqags40DoKC/mPngv9w9t9Tw/+6O WzqJhPw50JmTrA1hRQcXxW3lPEQYSVJArRAtNcKAbWSOF03lIxe8nR484c2DRz7Mi2XDgLh0W2Y6 pJgx1B/TXW4i63+3FEuw1vjSuAa3VygEWH1o97q3mcBTPRF3SIb0YkJ8Fn7pdbs7Eq2IqzkGosT9 nK8FfjReT4r5cs1mT/aq+HzSwJ6uVPuKJ7e4xXAzun08qU4jybULFkqz8nkQWTPOKGzu/lGDzDtk QMVdY738mU898+JZ0Tu8p4PMp7Tp8sVWje+wmJFDxdPDzUyOKgZePD/4VbH0yABy8+0mXydfxnao RcpHr37/7KUm/EPeWnEZiVra7rrZVoHo/rJ5DXenUN29/pgCV/PKDdO029CYuCJxlmLE5Cp7YZ+G hPwpTlHqosqNiZXazy9tvsDdiywJmf8xvtq8qLKQKKJtuVFS4L4h8/lacmXKiVlwjmuOnaGWovFV 5zIjNnNnMCnUArWOviM4HAyFttyS7SuMueQEGM7q8UjclLd2YmOlHBI+pQ7IwHOe9hxwwqx4wdXg NGYsnWsXnS1kjyFmJpPlQVFSsQZ0Xp0PU3g/5Rh4tZGGeJ5ywNJoMb8WNaIhOEimb2xzoeEswPQq U9O+Kdd2j3Bot/mij58rbaOtDBxsC7Kpnm/WJPeuZRb0qWhGgDiY/pzQn/0HEGEHoN/tpVZHfN0A GTKEnuIptphczF1IJ6c7HtbIgrX5y6Rhb4b4lMSkJpHa/9fe2225kSRpYnOjC6Wk3T26WN1GI8WD CBIAmayu7h6cAnvZLNYMNd1VdarIbc3JSoGRQGRmNJEAiACSmV1Tvfp7Db2AXkRPoXeRf2bm/x4B JKuqe+Yc1c42E4D/u7m5mbnZZ4dsXNayczyUH7Nvwg9/zK7htcbs2nCoxM5Z5e9e985hb3+y7ePI hfgUthb29pcennQevRly5tF55B8OO5BcVvFEFlg2DhvNKZOq/UwpmyiF2wzCD3b/6IBj68o7f+Wt 3lx7x1OfzMTu3XefzCZUt5Ac9SFbBQI3az9k6yVQUFJZMstVjUZKFXVILlaJlDgYCJC9b4Ww2gUb JupmYKXNwO3acY01OQWTV5f0F7rTyvjbTTJ5gu4TUHst5aX5QXF2P/oITF7CSMjGB7sXfj6AGGQf 2PIEcAi+aemiHcQXIA/W2eglUOsPkk64KFvZSzZUDUUmoWVnBT3L1fnUHpelD97Gx7EYZa8usrvV jmO4kTI4FloA00Apivw4O5NkUuPJEp+bmwQ5vmzcmvX4b8C55XLpkIY4gMuVuFgOeuK7FlEottyP CE5rkAey2jQVLVccDXqrceNji4n/IpyQlJPZuo2QgeTv9KyutAqSe+mx7Bc9TzG4hfTOVZLuGHp4 2G/1/1vtOlgd6PXuaF5//uqb/JYUemdfvuVvUzL/rcMqRNjWg1PnbrFdufVMvumJKR1oQJSuxgkY 3yolORGGN1ISLX7qTBzIVUdyHnWH8DjkdYnMPBNOEylvbil5rUVx7clBFrusz8q42xacUb+sjJhI Wa9V0VLzNijWZqpu5XWe1bL1PnN27wJ+9ouWVRYZI+aORApa3SOb/0Ws9TnGMQYYSCcv21SNa+HW LzV9qdQPvYZsBsTT8fDkjPKBbGqktChruiWVskp5o/z+6X0ksrC1d43yfd8fnTOGNS6yQ/T76a3G H7BciPEMTsZnZ5Ftz1g0PdQAiZVHNUfYIFtyItmitZ4BuQursZttKceKPKoP1XxuauQvcaMtPWav OCR79/qijue0hsrTpnrPIaSq+GgqyeGn+menxvlSt6apOeH5Sf6v4pOtm0+nzFPc8XzZml/aOFe3 s2MRny1RRGNvX1o1ql0FvJkVj2ZI47aXqDxX42d6YHZXFn0hxSr8lQ/JeN5GkwvyZR/e9JOpz3/O HOUMCw//0OWWI1bKrZNdtTOHeOtWDLiLlmh6p/vey6dAHfr7ce/n7onfUcjRC86LP/vM+oLAQsEJ pfWv6M7//hP0+2ZJPnZKGIRJ9+frzc8XJR6vJAlxEPN9en7+4sXLb7t7DquQpT9Rdh8rT/C7AJ6B IvQaHaMXoPe41t4mThho/bXI9V/AFsWnJ+carUDEqMRe9QSHO+qPM3mGOBl9CiYw3yFdpvoB3Klp t0K589OP5LltnTlz0b4mYZrQwK9PF/vJ3p4OsyS4LxbWLQlKwmpDPDhv8RaRR6vBgS8YVjNgxn7w M4r3eNY+rI8bjDMcc8vJJScHR6mV4htFqW0T+U4oVspebBKUA+cq7R3GKCSwLtmnOfUduSX6Wiy0 EF2L49BaFU3H4Uq1RVp+cFdekNOuCEtffPkHONsipLtetAopsuTtIoq8nLjV6BHlJHbMHejz6haO UjxYWcUTfBjvAoeL0RfVyaWA7gRAu2h7zmsjFJtDnvFFzfPf8Q28jNWmSZgmDpY7Jz0UwjwbzUXo qmyadVDP+DsurRSMs9AmowiARHAqxwQYyfT0myOjISJXGzhvpuSLK/SLz4pnweiplPrzlVLrw4AE L6mujgHUAFXGQEamEWvfHh2ZnsBnJJfMhjABjLdXLnYbMsmtJI85Es3iPHEL0ImkPiVAb6v7jy+f f66qcGwXpoFanHLa2HASYyZnWIRWIMhkdsUwGxrInD1g29+vi+wY/BapeRpyDd3IGlTkiuFsil6J SeatCraAaLqH4ZPDtvndq10R1qizHi011a9HLsE5PU90UfG34zajM4pf1O0B/6teJzM2xejteizO 1aZDQ1mFG6aHjZF6eptoEsMbmoLT5e31gtxZJlnrw7ki6mw4VAXxdm6fzw/k9rlMYeCOa5D5j+dW 09oDDMdaSFWFiYZymYd7QhuNa+Pjr2kcpxCgCs26uFudSGwars0DY9NfdoNU8cC0DGMVan1qDKBc kTIhqKpHR8dPTp5+8stPf/Xr3/z9AX/96tdHCPt4+vTTX0n8zvqdbvjkV58yjPIvs5Nfjz/91MDf jdZ3R5z0q1mvdM6wf9ipFR9Qbs+T0SejJwh0VJcvPLOhapWL+nJJOUzJANnI0/S8+sUvfkFDOPnk 5Gn2p9XVcnnnLMjJr57+OvtDeZc9+RRQz588JTju6byarTalutUbGouP9e0hfXN6sP6T3/YzDT2G L67rOZBFa3JzUfdYzU9K4Kofrir4ulAxg0BcN9IaI5YPKB6eTgBFli8kkfkC6DYIF/BxO+1e9f+X 7GH+268/U4T/jBBXH+ETg389Q3Z29cWT33IZwPxSoeK3mW8R79PvcDl49t2HR9mj7+bfP/0he3T6 3Xx8ptsEF302elj8j/2iFb+w9kSmY5NYrERcP8K/OAqeDh4f90ZDn49GIzum4ynt1YnaK/rvT7tr /dOT7H/aLdTmZiefjp/+Rm2+4vlXjy0CKEQfLd6Y1UsCglLG+AnXYOhOAluNXrvYeovSpyyZxE80 VAi5uUh8edwfp6yMpQUN5vIw0MUFBYOa7PYdzNorS8Oyq0e/qeNCpj2K9BP0Txre1/2jfRjONNcA uzkFyUzlIihmF2Sai+BD/0wkPd0+f0nazJOjDnxmfJjC0jO9rhsEm0/vqnIjjYQYzX9lfOaj4+lH /KcYzDGdcwgXSjMgve4jm7II0S3rFKNFl8tycffnihM6Y3WIkdGhLAEdfSl4s2BePTml6jI/krcz 0qgZxpewmeH4TQBy+A1dOvmi+9I7k1x5fV5frnbidKTlMB0+JOjI3M0U4psgLV/SHmoIly29V8lv qmmxUghEtVLJrmKEZqoiZ2CQ9R+c941pb17e7S8/V+WfcnkSWCeZV0RxOpo3RXXvNmMlLey2LCp6 VkzFLnrjHllFVCt7vDAtTVPb4RjRAob2z36CKfTP8sqO3qUE2YjtoLb1sVdhYMunOwGcternk/Gn Z9GosFMYgRWZpkYcylFowLsywFIPvP4G2ZMB/T9P6zT1n3Hj/jpRt0Ml4h79qL5aILl1ezboU4N4 toL2MrjnuDXCqBVidcSvV3n/zesvhr8JY5QY48804OP98o/9orUJ4+gtrVCi7BR+/2p9h4M/9Ubr d6bLDDn3Y2ufbr9euwlwLq+MvXg6u8d9BPeS95s3/86ifRLoaPP6f/gvDDqqYzOYf7HFbECoUuTE o2EtNVyQvAwonidBexH2KMVHrnyQUc2yDITDsQnsXHLs5wpBzzbiuwOjlKOK/8AAEEDEkC5I4dqt NTC8eGOIgi/RwK6NylHoq9t6S6LwICsvYI5S9wxetihEFdLpUKZNsm+22S1HfHrHiI2ngHhjEvDW 03H1teU1FkoWIAlxFGGjvSp229XQAeuZ7xCec5Sy/KoVU8L9n/kdzrspLIDkelPhlY2/yNnjRAZS CMerbc5agV8hdI12rL2JiynjLKVkChKGIBXJtAxxXA3zvFYX0B1DJ61LcStCw2E6IXxnOMsbOIW1 x5CT4YpMR4KFtSMnMvrO+COCYrEWWDTWPo/EgjK1eDSiLfSAxcXD2gqCHLZ+CfogDMtsPT/Pdqol 6m5WrumZtHlXE6y/RmDrbdk9QfHZd9XdmsRttREfSrJQqd09r1mHkc1akj2AzCw4GUrbbGabem0Q 3Xp/QpdQ+JnzwgAwX80whl5h7vYjeamuAEslU9MPhmLDgWVQrwUH0coHrf0qtqIRXQRvhbzVBN0q +skgL+p2IunQdOBkIThGYDC/iJJIs6ADQKv+oUb2dnYYKZW4VTVXvieaBw8ErHwiVY9BiFTgAwmZ Y2H+eMHnwitWSF5tSmS3rKp5Nf+tifjXQDQB9YwDeCPdI/MuKUW4cz5yv1vY7l1wYtt5mYDRxFEg 4u2GR1r15w28Bixyo2MmF4bg+s8UUSun8JYj7ymnEYqWCRvKFSNeAFZcca/Cj+lNlo8N9HGMDb30 6cBIRi9hpzV0ovNMcHtF5HWoZoYkYM3VorqVM2LdwEIyShG3j7Xm7DNhqgdYacHznU8Kmqd7cEcp OkiyX7antTc/8T4x4NBEwilEQEscEu9T0Sq5GZylyan+88wV5HZrtBW3zwbFYmSasw2Zv4owqlxW yX+BUDuwapRAdVNv1F1H7npf//Prl9++nlJEbIjgpe4EoX5GNvV/hFjGUbbaM1EVUdK7/gEeErvt RSiyJf0suCdGkJrv1pCduDXd2ET/kXS4MBfaAcl4WWNPQeQa7FbnyU7Tj4FRlaBCF+vOwVwt52qM NUG5TBksUiNS+g+IPbUKJKOPCcpSnUzC2AmwIbSurkhjdsWeHpD7QmxSPj7XJQBvKsqjugC69p12 VsbbAnX2uGwIoeMOyBjyGliNesWPmQVpln+lSaAvzGFBV5o/BatAAVTTyjX8mTPxJmVLsRKJwE6T biQxQNtBJtFIXycs2irRP4VuMZqWy9Xy7npFcuFXRKP/QDj/vdmu2SoZXXSG3kAyAUz8E8uNcKIf 394v4a+mexs1rT4EpViWm/DAg98ETtbPLWh+SiQIYmtfvdzK9/asmO4BJy+GLlfO9EyYtnT0AmEw IkOjRWreuXRhx2FyKVgPR4KrJzmQgOx7oqmkHt3h8IxwC3EqVVTNATrcTUa7N7LWhzF+HfNTs0Q1 SknG17cFnREo5WVFyPfmGyJQzqmgU1bZmjRW2wcZBbl50CIidFcwBs0rutyDVkwzr+k9ABelqsHp JwQuCC8dSlF7+9YkA3j7VmPimbjfxnUabOrLZUnyuqo6Xt+NccrHbwXR1jRjyn/mK9Cjr4OCz95m ABeiQ39O+dA+LOWpw330AngS8DB59PIUIqZBtTBv30ovsgZv36Z9HLBcpgn3hEWUyHuo/Qhoq9u8 Hqmo+VGn93CPfESILWe+NnY0Pdh6oBqk0VZLxbU2pcCC6HEXiYHbYTP57HGkd5sbKRlMqTh5/ehk wDOJXut4tubI2SwSEpShPlFQBuSCOCyYhRN1tBLmE/dsoZWxPk+SB2ymKJVJBL56Gz5JwkXdM4OO x0S1pIKQdaeRF3qQDVG7QBbnhSJ4c1HxMXbX661GKEcE16Z0stGCtuVFSWmReM2DajtabS4fS9HH uu7oanu9OGbAraH+8tlbDxAVCFBrY+/Af8/JouKtEyrWdtIUvWHB+gT1S8w6kgbBoGvwgb+pSzV/ H432y+d/eKlW4QMSrqsf5aNSiXbNDk7piMe1/sR3JFgxCNnbt+DUqrBZZ4Lb05kfTSWHv+S94RAb Z/KIoDv1YTQaFW2nNrhPncwlAbU5NxKJ+0ySQXCQZyADeiOMK4tqawxlSvZwv/aHYRDrzQsbUIPp Gz9gwm0i96umAS0sFr5kvFLDzkl1vHWc2Alwx4WcsN0HjtN750neKvpLK+K7M/zDHbOxr50efE5n vaTl4yPxcrL7dZZmv52MV6OrR7wLTBSKB5Vyr1Hd9MjzcXfUWc2Y7TqDDWhpkIefo8UEMipu2bXO ULNnhOSrxv3gdDGQaNqVtLTFiIDbisngvQHnD5dE+C5w0nnZXClO8Y6toLK1WsaAJ6rS88lEhePr oZWlFyX/4tXvX06/+mb6+atvIE5BJ+4/7O/zkSlGhqomLUSm0Vh0t8HJnSqW410rbO6IZEpObCpb YxIN4+j7wWo21IHTrpKjnK1q3lk1Onb4gCE4knJ3Oy3F16PGDXWaH2TOOoZMakrQvHzak/zqMI7j mpoiftG67KNoCNS5eWWTG16pA55IbdNViC6kk0AlpGp75y+tshVf+LEwjcI35abG3WbLcdoGSmsh 5XQZIyAoYbDcXsG69fbtAHePmpK6o9SKvH2La5R/8eRzGv3YBIIKkcDoFo5Zx41CaFVX5PudEr3h 6+cJ21x/deHNodHjU5ug6iA2HLdxyUru1gbOWKla7mm139gBdhkNBeoXbplnLTeoWK45T8gyE9+w nl4n4PVglfCvXqEottvLPgJrfyJpSdGiR2rLOIeQaY39ubCZ1rcJ+vcbWDTnZKpdmirGno1NEL8S 1lgE1EQDd9VLyozGUTMBgkyXpk8h6hG/cVJqqv+NJAPKmkUQWYZbeCiZ6ut2vEZTP+m43hPye6BR mLPcrzUwgzvUDR4zCLfCLD1/TUab6/q6njWSIQe6NzIzn1dX5U1NGIMX2kps5F0WGswOThWNTK9L XL7fm9H06+W2P8ZjrDUt9dlKrb4G6Lv5+gcT4UhyLj81NqtrqIPIfbdWZ3A1dy3KbNdj89/rf/76 5fSPz7/50qDCt+35Q1E0ksoL57BT87umfEHrTX0DY5Q63ey7DHhC8Fvn+kzIsGgX6J74N3TNhl4D tSRp7oHM3PYjBGndqIRiV17UpCYxsxQHBMCRKUEaPe3jUz8ZotZ/IGefANv9NFYBMAJoBM93lLsb f7SDfPT1YyS8c9TSQte5ZOLKerrHnk2f3i6T9LU/NuyJvQfa8btQZ6jfHtvxxQ42jj/yYNuLKR40 e7dQvHwx+SRpn/6n6q4lBtAzT8cB1nfO4oPFOovf2bTXbAK9nz0lGcuZ34oIzoAfgcuGEJ0VO1/B 1+pDyXhMM3p7BS8IhXXnQUoNMvUepV1tMJ9J1p9drepZ1Z41uYtMP56aiA7o8nNhpqwaWbDrqLyR PdiMukXcfvYFWA2oEX4J2vdUZ2Ygu/IHhA0A0m4BVKZ97Rk6ZgfWau8Acq1+qMuA8Xdp/Tm3eXfI 0oGk3U3elp70uQS0B7lh8AwysiZsJcABumhLffINdMQ5DuGo+CEhrQ65pwKOYeqPXL5k+mr6Z0qE TQVFtuXL/rdMev9miSfcSC2EjLTAcKr+jS+dYzZ9k3sJEhZgMfAMMnzmfDEVPq+uQ1fv9N8COTle msu204tbV/3TzsSPrV0sk8htFlgxTJ7BC50RLn7Aca53nRBQRqov3I+5EkTWqEjSmDLZNTlvfehu YISLcdL1zsokLWskcklQWJ3M06fjs9GmWi+U9Jb3h3gvDpO1pJc+Kamk+7PiFDrU/huJK/rVcl7d tlzS1qPC11XapQ34uxDGFDtbiLGazpsghTsaAduGuvBmHaHwUbiQjopOxqOgHXVMKIsTAd44hnCg K57fpZ4MtXSqCYwstCTS9T3fZ5cIYvJgMVQHAukyvi2GXIMgLZOtfr8w6kjPp/hfN7uHGE3Un0kJ zDh4HiKHGdJ2ZGmafyDVlIbM2uVjlCktlRsxGW7OVgoNyP44rKW26ZKr4K+ofGIQaCBNTKx1OLjR ARcwD7eB6sOByAg63vC7NWOu21AYkibBMc5dFbFsjGiERWYJ3IgLeMpXyuMyfJ4DJ6/JRBXbhhEm rH4AcOvTtlDcAw5qz9gIWE81l+84cE4wFTRiqtKGFxX88rcfVtArkAQF+TvoRUNdpCYIMGRm7uCV HPw0KSRjBVFEMSyKuBxyuCW+OTkD0oD6pvgJmJSZv8ud9q+CtxJaWlsB3u92kOW3xGcAUjKHFRqL U+glOeoC4CxaTrtlfZqZYPUOuCS8lRw/lbV0FvPpz7KYznPkfdaSA2zJdDUc4vmMQTnAovVi/qhl NNeFt4p7s4hsKC8VLgO9Dnk/ZpN2jyIzE2oD290tQzjvlN8xrA78eLC5o0OFDLcHWyTswPwSte/U pyssqElXVmJMOgemQPGRzFi0joyN1X7LlF95f8v6tmhv3Fitw5HzzZLogiufDpX0Rcq4+pm8y8vF h/KOmVhWLVe7S8aXxeWf98z297IiNZSJbnY8fHqWWt6iHwf84kdje3Q8JVo9KNOuPOJEkXK/kiBI 7zFQ76x5M5y4LaasuSlrm3mMCV+uUq4QXRZFVGCwfc4HteLr8jLwM4Lhmzk1YfLrrF8EVuTyHGiC hFAJg0PNLjX22b4iY8SmarTqdFWRZDdyht0fDtW9BmRLBrnCpyF/DCPQG23sI48dek50i6t7fXE3 oEcS2yYkNitqscODGoxam+X84UMaEZ4tgYs2I9GzXpZ6ZvKSNdJtJV85zDugodnEFoQWWT37qbFk 6Uc7WnO1aIrCGNTC4Zr32uufb1yEoZkalq3leuMl5hT5mNsS46PEG7jIZvRo2sb9rTOfSDJKxXMk mVHdCCRV1/XrurBT8Rng96lLfTYVKVabm2rei9WSteMMmji9I99jUT/VpDiAc23yc45wrcA1QqxC xkqtt5p/bncNX7u/O16OAZMJjE8t3YyS7qo62zx98oUIvFbgFDMx6FyZSqSd0iQnn29W62+J9Wx+ r1jNP6qiX+giDt1xtWm1ri1UjGnKmZv2HXXnyA6l3k2IL4KtA1TId0tJ6XTaQ5Ex5St3oG+o3hku PhRN1ocSnfpdq0nhTeU+EDpeOfadXt6/TURW4gWcUNYy0p8JbgbvZUCYE1uxfpL0nmvJ2wGBJ55T Q/hO7/RbBPmVb8ZtWWvjH20tOqTqX3ts0yeUX0BDWpzm/d0SgTeXy/rP1dzPG9sv2u029PgAUHAl 57qQ0DcB8pnW+Hnurk+Fk3fsJnLJIGhqObVdBB2dYZ/czdOo3MV8/V0Ejoj8ZMroIXQLku/m7XZT Zld366tqKQr4kNKklmvF0x4+RAPqBvSaKDeV8b7Vtgz2rXPb4qbo3gcxsRujtTpel2sjA9MvoEUl J+w2JAqQF998LrQo6+bORrePGc/g8UBaH7wONxXPDoqwcUcEi19q3fBaLNusYwqInJo2pSCRYGoM SVwv2T/RsRnALQJUpFXupxyH7/kGEEMV7sMNTW3Qoj6ms+ARf6XoYbtJELC336MD2/VCbLhlWgf6 EwfpF3yQlJxNC2ZfifTxSHEirh4g5Br6n/Fl3p9qJjuPR6khwn0FoEm6A2yqJhBW0B2PQWMzqu4i yDYpyyYNmnbufI0nGP4FZ8T5/kS+LyJzuaU0kHp/eDUQh+5+Rp+H5fmMRNPSf+Pg2Y+61sNM6KDl xreEWecrACJcsS9DvB/BcVMj/f4Hn0Bs/WTiKa99NyqDJC06md73vmNi0iXR2yq7H/z5lK0jiunG jD7KWe8IiSIBOmmZ1d70i8Nscn2HwzjngGwgSAIIW804O33QnPUPQuN6oB+0ipTt7fbWiN96zuMI L1AX0mZunFtJZ2a3JGGWNlrZxDbhv2sk7j3IqKai9OJscJh32+ClIn2bKXZqmjiDORQ/6hG0iNXJ us7AnYcDOF04I0KUyHnFAJNgydgkAdzD77ATkP0KtiqHkxwb1e5Dlb2rqjUDU5GxeKWddiV0hTFh HN+ZPSSeHf80RO6c9FDQT4YmnYrtxK4OPRK0bH3xUR0exszQA0tKTpOx7LO/LaPRvBC4ipzvYgci gOQQhuuhCbI8ORNACwmd06BLlBnchVzYrj6UUP81HIZJPa4Tc9OXguIwiu93X6dZLdl9XSRvNKru C8BzJqPw4OL4FIWuveTztoBuD/xB/gxK6HFTU6qZVCt2GBIdzx+s9tCQfyYAJ9JevrTMHPQInGZK PgJHCICO0Yu/Ol8sa67eYc136+xysTpX/JNX3xf3sbB62I0kfDdRLk5kh8hY0/NKtV1Nw4QvzJcl 6mSU2R1koMvr8o5sWCkolAiD9gPE2V2jmMkN0L0z7ROO+JLyoso+qMaU4DivGDMixOzg8B1GZJK3 ByeQExLpbMtz2lQL8gbdrtrHQo2hFnn2NncN0hkT7Kma5R+r7E+wzGM72Itlhavea+V8tdoqiQEn eI7YlXRuOklyGGb48dzucZSHQ0syfT/+C0xvA/81kqyIaIpIZjgRl1P8fFqfpXjXiXtZ4wmgzWRz Quhj622rn4wZR/YsqzvcZHAQeAFsjp/T+tHJmaL980ZMV7GHTnq4UNonbe81UVdo4FS/tz06GUuX J21vJN7pXe+JlyNUejmW2qM0rWfHkpg28qsfB/B21VPsF1r1ducNQag4UDAzAwrXPDl1YMOTH3vO 9QqoJx8qnhu71rLPOzHlllVDkBNQUgyD1I0l4mfcJcPOh1ZHp0QK0jDuSqbpGj/jQsJpZYpdN8Mp Lo8zbW1Rp123IXdVNLVjdQ62fYEAJhfzOZA3VY2HAGZBsI1nkqHqHVjSNmCDS2rE8B412Usf19s9 4NRmsokJ3fpx0+HPydTFkW/GTFSk1Iri04EeSsAHkQxZsU6UNgkL8qAJ2TBYW70iOcJE6gBJtiKg 2ZKdKr3QEZswuPnOl5KTiZtt2Y3k2dUADFrIsJld6BD3HByxXlKdcCv72ZFbRuGKnzQNFnzs6XIa TOY7Smw1eA/ajZKY0pc2YaKfgYhpLJTdVKs6VEuIC9UYc1J6zW3tSOqlmn6Xft0D+icJtZ0f+P3K tyPJbZb73k6QGeulLnRQ8hmaBq2CNjLQBz8F0z28nCK64xOlj6MOzNErFpCDhT4xRDEOY4sSNFj4 ddrZiOelFIrbp+4Xh7o8vruUg+QNa30nP+TRdahrtLKgKechm0pez6kSGnlDc78LVcbkDTtKixrt s0NcESkYwbB5P4JRS3qosHScNUqmqMsb6APvEI+TUa+cCIN0p3S1dMRkyNgpCQUGxyxSRsKp8GgK Ez26doFS6Ox6ZYwm16t501qcBicsTv2dZGKrZisrG5WwR9BNYGYrSJSYqpZAONGKZEqU0b/5Xbrd UVet1Kb+cTK3eUdpXi0Is0kYzakUPTvqPC/kAKlNANfzryT5S2QEuFot5gaV0Nr8G8e3dNShtyfS dHqgxyP2Vs3djOh7HJTohe4zO+bsweZZL3uQe+0OFFtznoo0iPV0tZmStmVtH/VlPGk2clAQjABB sf2Fle5BAIFGZM4RaITPtQdNyEfNczx3x16/kXIdLLpbL5+rxapmlNKdIGKcaNJLE1PdFUVqYFng QVCV89SjOID/LKVYKp7Ce9VZ7LZHbXkz904Hv1X3HmhH1+xUSOyMTMHyP0rVPqPgx2k5UN0F0QoO JFMIFmQLFt46BzsYJezl19cA6M6HHYzxxcyrrQdL50CPQQbq8dJHcbbGyDJxLHLa6OXzEF00aILA uJJDwC9xiC4/yaVsY+vtU3Gqjy1ei6pcEqBC5CCVhu2T3LNMd+m5+zXhnqxrT2GpOi+VUMG9m+9d MEB/DQm1bZ4I+gzqeocxSouJfqVgekmdAqlKuW5XJg4XHeINvbQ75/d9r3mEwkZ9/pDYb413KPiL FgBXBiD4hvfKZqWhEeMRuGmAAcfRNWHjo9Cj5zDc+Q4xkVwyC9RBDY2M+iESg2I4/AOSzTpYHXvW nJkJhtBnNqRXVrjSD7EPkUNFgdbb0ZWpQ13xJ+nqB0fAnq8CZMFYoDYROM44usjcM6tEdGF7Ewzi IBRFDWi33Dek+wzHN4xF43E780bUwRBEJmqulLq9+rDME2iNHtpn4paN7O7OzCCFpvBuB1mqpZEL 4uy7lwXgI452Ew04XgZnbB+uYIOTG1oz3DAf29LCTusiBBNchOXc5VK0VV/cTSsNuaAzOt7OkHlM uwuGWrF5BdPOfHhautgtFnSzBcLu9m6BO6VHoRFd6UV0QTh73lQ9V8GD5Kd+kmHh1iQ/Z4gz5HxF GbqOgkfOD2RkbyaXAWpL3/7WHzB5BuIDDWVC/5sSF5yUsC4l05PXslywF5OMeiL/3jN7oMx0Iv9G EXnruxGSCypVflQu7/JNlMWJnogkISZeBGQYGt8ajm8JVc0CvTIMat579eXrl998+fz3L7/55qtv nmUPGjjPPUgnxXRqXyx2DTRPprT/RLI1wwlaX8HN6hqSOXmxzRYG1YfE9eSzGKyrlEyZURYIA4Kg pHfnIt8Bt9NLo3woMLG2vBGWdep4hwCpgi7daABmvlka7SAclA7RhUTFcSbsG4rIAOzXTQIjS5Fo wGSElpmq8bkJxrUxjmdlhaFQlAxsPaxKhjobnXe45ZbIZu2XZUDp3P/SRZZOyVB66JEBUvr3k4hr /E/j2lyMI6QncRYIIijpm5aIEl/kNTA3qIIvjlLBGhTvZWM1NF9MB83iALtRHiPNmXSN1Ml0ghyj 8vovgd7xMOEo2VS9vNQQ9uKU24TGu8XCvBMbO76xN0fWqhHrvc7psej/bhbKxB4DtErD6bcyRbxp aOuOO7SzqL9H0WATRlqZbpTfktuILmN6PJJXetNu4zlqRwwqGITzzO/gpHc1PxIoZS3B2V2kogZ5 K9UvdLcLweFWfwhPOhVZFD8D0Wm7utV/quEp8UAV7YWZrKYW/g199oWxwcuEPU5Tj/z4FX329zR2 XS8lbAU18Lp/LU/173c1xEXBrNSF/PNehWCOlu3SI/I41mhp3XwprNYBOsGxp2fpsfv0h7o9KduD Ozk5EAcbDgO3DDc/jLd5N8dhVWi7tqvVoplS7kTK9tIc2F+1vMk7FMUWYieU8KkjkQ+i1ZpI0gOL YKs33N03b4VCyKukgsdUojeCaZtDsD36ibxa+Vd/V7kh/kXLPuHT4PUdl9IQmVPpQ13ULTXQGVX6 LLtJAevqZMDUnpN2JR1UjLyn87E+BI3UGz5oBuLMYr/p40ptf96VtdJigc2pLT/gzK4uvHVswfng EoPEmhSHoase84+SkVpbi62rjiJgiXMTuYtNro4RU23wttJw8TWj5pHn9Hml/ZVWS0b9ovd2vAKL UDBK6dBBYCXzq0EWL2fP9MRTcAYPe2t2vaLcwtL1C3f4kRFvtakvBZIxwT1aWAGnTbEWXDIijzt0 eq3t6ubcY+tmsEgyZwqX0YETCUYypQIRwqTXRgjWKVlJrLASaTCxWwzF9clDjQaSI+iF2Yd5HsqN 7poGCJVO1gL3eTdIFWriLvkiAyJBjEtJII6i6lKQNjmtwQXWeWtRyg2uLsQ4WgCEu4qi44GxARg6 8jOjwDVylkWP55W6STlpoX0QNbhHWner1VGhCfmKzW1wTfmvjEL0DijXraSSsQ3olaZlURSnRCVE jEpWWxiC55xfq16iiOcj4sOApnN8J55JxLl3mY031cX4rWqFnYs+U3+RI+Gzt6PslQ+9bSNZSZhX ZxiAZOSE7OT22l5tKFq5BBzfapNA0PQEkeyzNix6gs70TIlZrn0kJV2lGJrVuXL8UPBcTEx/7u9T 9wu3Nrmf2te5vS/aqZrIg00R2AYWNqYJ3yvC1xFa9zMavgdd7yF+hhzBhwk9bG6xd89uSaFuKWqS jEXs/lEU7WP23Ef4IrzPoGCYlimqTcbZbnFN4sWVskcx7l3V4dbEdfv91Hadetl/t5KO22K2Bju0 jtxMW0SDosVDYJH2ktpUC+01kEgGxSDI8cwWms/M19pJfcFyifH9TNLo4sjzBDWzJnTa5JFqHVRL SwbfNtnaKUcesXtBuc4X5fX5vMxux4pzAtRjDacWZsyORa2gHTrrsHJ6ALxMDi1H1FMBHZ12qjd+ r/NSdBLIdUhtAJ4eE1r+Ya5V3SeYh+9NSzWkndk8soQZYTqlN/hpihYXcXZ7GTv5Qss0ktYV5+aT cu252ezQue2J/stEcfQe94LqSr1fFx0tyJQNxfMI0t7O5oRIuchKsUjTQXr7BxnpW6mgfvohdZnQ D6ZZ/9pIemQRpXjE4UoHHh5Cl4AQ+zPwgXLQwOFD3ZZeZ5Rl/7zacfABnG9ZVLjzvepI2kIoyiJ7 +3Y4/Orr10AA12FE5NigW+3BlNZzc42kvfm9tOraTDiyK+IvYJsEcJky6PlVD3DpS2X5c2cw12n9 9C3pbhSt9l4u8tNsWaKqreM6q4BSP0AChZxHETBOQiXaZ0S+OHl2CI5aDL1lps2dfohKeiN/5q1x T457bu1S+4c13pvVBrlQD9ohbwntPHiLGTAeGa1KBwpGAq5G6EMw7llU4ogAX5CdTsnWD8+Lq3pe ITe9/9CcErscJcUOJLxPhDuh+B6378BJtUWyPcwv1Jk7nZkHG62jIADBlSvJDU+CJHjT6svlalNN XnISRRPPmvLE07KJ4wvrOuFxS1FxcVTRHvnGoKtkOO1Sqk0tOt3DrZ/pwYC4UBYIP5akJ9lHk4q4 bi8IVDo76oxqwZfh9a6+8x+1MHSpKj724iUdWm9NzJOdLqnCzuwT8I1qAPiZ71ynbNJRXu9nm7uq EpbNa+DdyHwcvVrWOtNt0ebo2mflsi9jlppNNevIE+Nsvqlyqhs6czOcfv/DEVMGu8Cszv/E/i+S xzYyqCYynqjisbeuD+JNZanh8DGK3ZLNmzq65+Z9c6y2ksLjve1Ui1sq3vxFH+eEBsnEPdyvCPkQ n5vRH+h15zVQn7UzbPJNOnSDZQEt1YOSR+HSM401IPcNzpl05C6sftON+LkuYu8lG9vQlagh0WlQ 5+Buj+G3cf4nAFHweoewC+aJ6qApcHobccHyRvZ+++a/1X6lyMb9fvf6/dHf/R1JEjtGa86aXU3Z 2DbI/s2JiVCUb50jj44hfOtvFIUCXVx/VNvrJbrXB0AnFeejImZS1Tf9e12+q5RsD9/r6fRaKes1 OXJNFYNVp2JAt6RQ/bfqfnjNjo9GKrAUxY8SGLZ+jhhkfV3Fe6FQK6+/92Vy1dVInDzo0dj9Ang4 zpnUDURoGRyAhizg23q727KNUTdKAfmlf9mHSic6fSree2rryVtjOhWdtwsA3d6huGi8sTMpFLya I6DgF1GfZubc9VP9WXG4/ySNI62sfhlN7SW9jOXYN5vJu26m6xXyvOBFC7tDYpdTJuZ3+HHEsVbm zeMfqiXyLK7CTAaXFVytnBpd7/uqMPBZMAokosdoU/AYRIAaCQOVRnTe+1IhdYU5o0f5YPCv5Le2 wK+oPwk06+4WBb25tERx+s3TUnkNhxRMhlZxGyGk+IxbNzBDZHnT2EBcIkXEQZ+dczrGGwtjDF0j OQNSXvCrD+dhqsoNnAslgQMN58Nq885xdqQ+GmAfEAgeiqhF31YwJCvNpVzUf642uT5GpkVaQCbH glmOCJmJAvem6c7V1x2EG7Bv6Wy9I/cu0TTuHZ52Wqf75TjRl1ejpTsd1uIOzqvncXpw+ClwtRS5 TIXVy0dznA9h7foauQd7TxuJTefELa2/JfmvGM4+KH6uS+cnGJXPckzVTnbpb7btzj+RvHV7KfxY IM9Ij8qAr1/NgUYyq3By5yuaIP0DfEjyJqUeHmt6klZWkIABZG6kBClN954gaGhh3L8izGS/EAwN 9vSyMD2B8ZHr6G5GWM0XSi0xtWXq/jIZSU/mLWmY9wjddXNR31I+5ok5mFxzkPVEOpISGgCkZzZW unCIhObFs9HtUlCT9TvFoOGCKb14B/2V8G3ExS8pxYAqeN0w7JwWTyoDd8vqvSIeZLXeXpUuBFFT LxRNAD4PujIsO4CUs8Zl6jyPDJZ0K72/efMftBzKaCLl4v2H189esSyqv8qYQwgmI73B7ugGCHwK jl4LIl2ZXa5WgEfYbQQDR6OxSGp7pPpDwnfbMIeBHUG49XU088kVaeXPVeNxNYs164GF6nym8vBm cp/34vnB9cv9wCnQe5d0dBdCD4w7PHXhgG8YBlhp6+fMdxg8aNKbrZQcFkewcEZfKd6zaSGfcMrI SU+d2k0FewCXqbd3o554oiS6f8/dv9/V1fbQzqlwqut5dZ+uN25uMN0xpYAziYt5QYFz3/T8DJgD kGepiEGNlX+2bfFg4IoubE20outrpExgfcAFcj6/Iyj9JssvilKdCRzrYOa9/GVBzucIVCjA0tco lt8WF1Ij/58LzsAwat/rBS+26yTfsgLTrTpkZhlsBWcVGE42OWsuSxDU2rKoJjevGzAVmq92aO0Y 7JAX/9BNat8f8vGLBupYVTmIcrgpOgazPe87TdKlEpNnenzbcyluBkjoeHFmOklsNTmV3ymcYUPZ RJYr/C8s7PSJwij6Z1ELPDWz6HCZWFI4dZXlaPMxNfgY7TzmRh4vV52bYEI/mHTwcSifO2dvCShN Le54ORMdECFxo3gkY1/nESa7Y4JxGWdLaI3vYC/cKhtOgh+Ik4jsAPAqoEEpgQKdQc7k9QOP31Tq sqopv+hlCRlAKnGGE84+2ED8+OJz1mFGWb5bLhDfOyvX6tpCI5iFusDg3HYhUVDNdg6kPWP9kjgL 9R1Pg+pWWThu/T1SXCxXvSNjclib69y4rzfwXocw5n3NnQw4UFpRV9fb8rL64I6zXo1Ue6hnWjnf AQtXzXFycmg0TLWcrZCjesJtjPTn6CHGvoDdKwtiGC+lfaJEYzNzGs0WUMkCVwUdMuaPDc4FtqL+ NogvkoUy5Y5E6FwTIjG0arm7v5Gvch2CxuWLo9bwDxNnq1sjjYpb01/1jeTnk8y8Ot8R8KT/NZ02 /soFGYATLCdYzbelAFWHcUiMEN3LBLEbrhRI6cpFwzccHhyHHrEDX+/U6fuMgL69xLYyTieiWon8 OjJkk4tdeSxRxgMz4MK8rnCviCLxeIP5mhDD+fCoT9qXyF8fLnxkQ+PYQcl9adNSMzGLad77/OXX 37x88fz1y8/HcrG4z9H6XtMv3cEtQpg+PjNQ934IMBsMQj8GqAUibsVxMZ4Ly6CXjjyh8hP9l/Z/ SeMjSWG1aCKA9FrA/e0CP0LhXhoCzm3wlsWYwxq87Tn7yJJTetvotyMDjGy+8kOJ8BW7nSQKGAeL cqODVuxoUp4m7khR68jDYNa/+sZr+npKzvlKDdw1cr6tiYg/j1jAs70uKPEhqHjES0LrKoVlj1Kl m7g0r3+q8Bc9H16aipPlDLcPVMVg12zVi148+5FicfCOHUi5QfD9iPJSIL6QUTtCbtmaZUFzUTpB KZxQ8+wXhP3Rj0Zj0A/bSQnCrwNZ90odaxvQYFt5NsmexKU5WOnQ0pDYWFMlO3pYJ6wyXe6uxQ5D 0dlPjoImFW2l4FHpBZlxEXnmu42gJLYgWioyIOfe5Osf/dImzzhofx90d8y1jWih9/uPfPugucA/ XGABzVp6HmkMJOZxhtRNEDjclw0eI0jV1sOzX1rnDfWVjUmk7GeOPQwcQi1uX1hZf5z1b0mG53OI z03/BzLxoaw0EAVvCjMK52EHwVcoz37KGPte5B8OVONbjmWpfjFJLGDCayxcYP7Dt+v7lKxJaHSu yFXcQKPIPHfzKVwluGeOtRvqRzfKgc0ytEcQTYqjlkJYo3BNBXtAqYUX9a0OCaQPA1bkKSFVAuRI o0n4C4e3WKo9PngJksvPjXTNmEt4B5TGO+6qRCWc6ewfyPCpXTFZKyXlmmiMfQvyI5eBjrm/Y5bz b+mB4uFDPrFRuKCZdFw0JAInuAR/JhslTzeG4/XD5TnVib80CRKk74PWHSjDyp3cRw7CTrn33Qay dWt3PO2m0s5o6q9Btq23cou2r+r+eXKjurlk7+I7I31LOVVn0pvIWUttZtywKmcbdfZQqRTtzVA5 WyIKFvZhHwx+BqEt+DLk/fAY7L0nqlAAxaD3K7odTqIhxlhALo5J6kjuV/8c5e7r37/5h1dfOvE4 yPNDXqcCihOw8My8vFY3sJbAg/eKVO9szkYQ/92G8r3ErioSVbVTgs9mu1uWBCEu1o0mW+02yE+w 3m0Ju7u1+mW5OV/45dkDFVpZsAed+0N6abjy80oVI1lLlpz8rkIyI6ELmquYsvK+raekg9Mzk9eI q0fdaG+IxeqSLkTtMrqaV/V8QKbWICHEsTBnHV9ZGeBd0lBhgCUoeC8Y6zg7ARw6ofQj66C82LN3 IVx7PLR2w5R5GJrSx+Me0mpENBcKs4G+IIxMsnnyfGjdtUDz0MyybZv8q5t5Xa8XxIcEYnjrmfRl Kz0INNexOfIUzbvj6W+iF1L0gZd6wAGbkVPpRn62aYWTjRugoNbFalJIm0jdNHuIkGqB9kx8wjpi 3+h3uimXLX4gouXpt0R0Hbp+4G2wPKdYW0pJmXiy9flbRDhW2/lM6TOdaBsbXAd90KNYOjt3u3PH VVMjves8zUNSEgfXblgxruS/umMB1X22Wy9Sjj38q1FS8PGwLMmYS2g28PHfpMnv+4qEq2V/jM3+ IW2xoYUJDAUtjW2g8expKrJQtLR1V+FtOdVcO+tomCRkHwvFQ/ApzUc6KKmTalJMhzfKCjph9eOA TLrKd9BZq+yVALDpnk9KYiQcTtzyWDNUHF2qK/hDqRT0ebGP8PetQNhZQto5WAsxj0Bk9UihUFxY jD2r5Rv2kH4mejbJTtouB0B6cmdKlhmNRpmSUs9Xi3mYptUfWffl0G6Fa+fgPZJJeyEXR8NH4UFL WgM7mtbW3c7GSVwJwhOkL0n85/O3W+u/CL+fsy7b1aMJZSARiSi8FMw+BvdNFz+nxRWW3n/ZT8gR ct3KIHJPH/N+EVsLbFSpULwOuvosvMLk1rMbhj3FolIeMLs55BZGP7LI6NzVvFUtVbTpKahE9js1 /KQY1rPb0AXpF5TGaej5qukj1k3j7aXsrUw/nmmZZ5/oBjb/7HH2YC5FwJn4L2/hUxQe1NeUrRqQ Pw+lrvSa+V1EGWmZrkQeoOvBYRVdcQG++sHMsZ3pTQng4Y7jPgIGmKJth1UlfbGDjsQN1tU+5KtI p3aLQrNzwjrUJ/qfvEgyZ2tLH3cJhs7SwAZARoIeu9dw16Kx9JJLfYM3arKl90bhqyUs1RoIB4VO x5+4Z0b04fWi3CLPmtKCs+Ew+/pue6X6FJUYTegCA91ZkcKUUyUHCCZa303dPsP7ed94owaCQeuB gzpPUXj4oFH/x+ja0nhbS5+c+ZMnCldTNnhFbAWQ2AMXRKhDin+WPcnonTLikeZ52suL6IVrehWw fIpWq/Pa4EWNk/PGmCkntLjaVrfVbLeFI1Jx1Knvu+f7AD2NiTdP+CBMnJqDTFu1J56NO+iuJcmI tjJdLJDnb0mMoSk+hnn4g3Yf0Jzm2MSjozhSDgna/DSvWbF3t97WHh+CQYEmtNmKgChaqjth2qiC LO+IHJgmI8vAYRDs7QZJCgG3JRqTtvHP6a/HZ+2oF62Rqj2N5yl8ASyKD++ik4ur+6Vurlo5bFq2 0I7Xy8Vdyr5OFh9z8+obgsMaAvHKM9hYGUJes4oOhZc48S8wTTubDPVgresVyaQjMIjoZ66DehMr ymi70h4vuR5A0Qa6cpLanic/5v45puDVARnKJFy2UrINvOMrj0tFkGkpsy9dXKTWPNCG1bx+dGKa L3yQxNRWpgyPx/BfY9c/+CKxpF5yuH1tcmIZl303myuc4OD4Nis5J+KiAioWWtFRR6qld2WWu/Eb 59WshEmVneHkIuCMjZcrcuum5IrZpp6bvOHl8k7pkx8rOO8rPjxJpUfaLcP3by8kGfkhCZZLLVcn b6BAFc/y2R+P1S104hk/474NohN/dHAlnkAmPkkOiwtQDTowcIKY59KChPruU+uZ2h6AI80tZAQ3 Whxiczh0fWhN/BXqLiiraOBYxuO8GI/BSmBLPmBW3EDRKTNu4QrrXTr1cs5JOx0YhD1z5KCUqT01 eprA65ldlQBfPz0ZnyGuAU5UGeHFYHhhjlM2q4d4LZqsebCTuL/TMal4+L04S6+/n8TSm38KL56c AReYb9yZ7Wuc6IyblItQ1UrYucgBcTHiI6MWOi8Szl3HIiWl8+WZXcrtaLKhOmbZQyXSZb2jvQQv Uio3BIJfFPEVLPehd/1Wt7VY3QeZF0jsHDXve5Er25973dcIRimQDrD++RPFPQbZ00H2y5Q4J6ED U1Z6U4/luoS+dbvKXAUAs4GDlCfc6rt2KpXz0N00yOjgzww5ulNSiUif76q781W5mdMz62a3jpKf UbAoKkQlp9fV9eooOT3nXa5IlyB5I5FZQvcytQPyciZE6m56WPuyGRSdGSJiA2YAbtrSa7+450q7 yXJaCgVjsdkaDtoVVpmlElj8ZrYpm6vRtTpvSnto1ekhSXoamFqD3j9JX690Xz2Cb2suDxEMWvJX OHPaL1amL8Z4dsmG7Fr7jxSid3Ewq7ZPmqcnVWSp9PP56rqs/Qdev0rGaKMElkBPrDr79RWSiGW9 x73hErnhEbTMOfoSzmGQD/lPext/9x1u4se9Ar5Mfp+B0582ziuem3021AaR9MyKuPf0g7Ci+ZS7 V30hS9MN2ihlHk0SgpWx2Y21aYBLx/kUae07jH5jY1yQbTrAZnqqieCsFwHCUbvwXPOR4YSvQ0Nx KAfPtklWwU8+upuQNaQJjN+nzRNZSnXigh0z1Bqwa5HrsVfIbwOoOxyW1qm0YqvKqx6cCfxzdy/8 rq6ErGEXxen400CqPzAfq14M2cpjCRniWwigBOyy7wgfTjkvhKFJI+4lUBRvE0o1C/unZ0Xn+/kt rpb1/ByK8LLfBfd52wVj6AsZbW6Bh/kgYUJox8wpbYOirsb7hEGU0hYZ/F3EYzbC02HD5rA+HYM1 TgS8uMmF9U4aE0dqM6RQGy21GfqsKfyL569+/+abl9/2iqMWi0trF92z1LCqLREa3kO8d7w31bpD j4sMlbGzQOrateKF6THkkIf0S+s2DcWNmIhWO2yfkYGp6Yh6RDj/WWmH3wB/HtIh38MOwrFc5VTG kVAMP2ZTku4XCDBpMwMa+aeDLng6mfs8yQFm7e4oFNNC0U3wU+qN97debgU9ZnVxj+a1A9SBPRhX yY5ODqbpA+g5/DV1P+81xPLVNtN2JnK6Fu7TApfnW5OHvYGuH1G7NHc6hLUFC/pdail1pxNTfjw8 OetwQZdiiZPN+mL0sEoX93SukctTT53ZsOVh1L75KyWK4hD5WjCucvKub5XZTOJKslsu0hPTo7/m qrVAAkD7eXz1o6DEs6FEvH74Vt/46m8nG1TJzCmQPKTnuDHubAzJx3f91XyOEi+Uy6y6Xm/vUFbD cPpwIOZR1IKPWhmHasUwhdL/Terd3sxFz7L3YK4VF9ibVKVigOEURehzb190qIHolfgBGXUejJ6S f/tqOZdWyQUgJJzC0oLj84bX6/44813egEAp4oO/y3g4Fabs/xC8iQb+edS8YrbJzuKbN/YVTDbQ 9f4beXGmriLxyA8dyOLm1OEfnoz3uW6n4w5ia1F8c7u+2l3rmnjSfJeOI1TkFPlu4oB0iNu94Tum ynfBw366B8y0ul1vIrjOzi6uBUz6Ola1x3tvGxIf1OHhDHMOyzq/0xjVaaHRc1k6dVf7TB29nn02 LXwnO/HK2gAA6Gql8x3lN27YJ459HKF4g0ULPD1aoX3VOR7R/7HbBCZy40L85sAnfcmoLBalIM5f D5XyRoZtnu6lmFHaFm34hUoxyxf0OM7OwQk03TvXKeA2ITXd1dVint11nG0ucXt09P72zb83ieM5 4uL93ev/O2NcpXW1GQqsFoI6H3N4uoNxcV0BDKNurptB9vat+l6t9tu3ZF2ijxdz9UmjVNmcUaNs DzjoTwedtBcRaSjTduCILKCLgzDjAlUxLAwjVvUGDpLLxZxiQO8aQXFxMFsY/MSsqLuGaGYMGEQI fRdzA4RS/Itq6V+Wqw7EliYc9pRyq/YGnGN1An1DI9PIRHvhmAglBngsIC6zHhPuN8LvpKxGR/tz LLpp5/xci+k3Fso46SWhooQxU8oqa0MWDYbastEE62Jgy2IGqGIkcc17AUjahL81QQ0uhkpvrnSC ItWO2pKeRmu5pniJFzyMP0geWkFRY9bhLEIbuge3A3cKbkcKyJ4fMzSNjfDxS3Gcz0qRFSVfRJaq csu+i5nOqm1uQS2L5V22Nx7OiNqaGip1X5AORWrpmLwiYZv0Ww8rnvBidXmJIzJfVWz7ZXw5B94Q zJMAg5hbVDYrMcHNzaqptDEtt06acY/79qQIvTE4+IyBqOHgT5saZyMa0Us7IDdN+qEL0DFUkWGO eUsXwEuqL7HvJisCjh/WCFnLJL24YS153TS76u8/KY78nVVcWMhIttWjgjZz7L4XUBmiX5cAg3Bp THT/za6BGOIPgLfU0bcMkoA44huoHOdXm93aA02hLeFLA6xyhycktjPw385dnFJa/1yv89OeKgo5 RxXvnQUVfcU0suYYjVfLW3lPOMQc9yhLFmHHhUHA+HIlpS30BemRamlDmdWcNJaQsK37ilTbzhKy N2EZY9sekH2bB+qzvVagDrnLmCsmkTqm/NtTC38VYlZMvUbgC+h+dowZYB1bpVkyXJU/iQtHZ5ci o9cV2IbSDL5ABUtCy+rDRQR/hadhDWPVe/P6i+FvHPPZhUaWChcNTQUjhMfI8rJetSyzRsa43b76 Kg+SQOtTI+HOIWBndLm1JdhSHXy7ncsWfvF5rq7aFtA20L6khPVWt6BjnfzFayIIUHGGh5v0oPEd PjqzstHo7C8Hji5hqJWMWC88ztXyNNaeAC8S/EQXE7HBz/nNoKgB5E2Y8jtC/5q5HCQSYZJlO+aS fD8LWwtSSvW49amROTnfTeqBtzO9S1qGO1yOYyw8mKOq0eUo+xNpkOllsZKds9shh4nEopDJWB++ 0trRAw4X5+yQ65mlLj8aybmsp6jneIGm5FNjjBfSIac1TTn0IfEs764aIx33+cYLbfIMQU4/wVGr DzWnX7AnaTmb7ZSAUG4ruS4BkIh4dFRKpiHzJZHoAPg/uxwvvEYSbjNmi8IpxCdzVi75SQXdKRVl sanK+Z1zUCnzAp3SiDbFGG7KDvzAKwvHHHstBFvmX2kOUZgSARHhmLm6hr0t7cgnWdAew0amB5Tq 5ZQ/nrH45r35BdsWkrIRWrrYpND8jgKFQinE33lQUVJ8mFdQgG9KBAKK41VefBRpBDtiyoVDvs+O +Ive7r9iDhWtnYhhbQ5y6ZGRLlRdd7SdO+f39MlZ9igzf3cBebq1TpxaJ2fJiAj+NbUDnbxFA7Xb ztrkT00n8b4LGsodvgg4pC7jwK/bcqpd/XsvkY/e1G3dQo/vS3Ey00nNNMt3glbIL7TPFjRwVTKe tT2JtudCt6ShF6Xf9dQdlWYClA8tCUf0z6MpBwk6Jzd1FoMbMtWlG/iVnkRiU6JCkeJpDpRfbjTV OT32H7Bpail8Og/dO1MpK3hiQY6iMI9F5z1uUy7oy9x+E97okcDWcdseaNSRKR+rP2a7TVPfVLr/ AYEAbdTthbFkadbkhqpw6gAcmGu8+i2Qaf1DRfnWncajZhJWCTDijzVKMG2Io3DCIEHHLGk9CLmS +i0dXcuW0hYMGU53lJTl4t1iwU8SzNy7q5k2HdyzJ69UfK4/djjGCvmxk/84H+77CAJpsrj/VJ38 ZEkOEGUpcy6qqU+k3VLOYWehk+z9PbeXnh5H69VnpQtXsPBrdwgYrlwRVHLliz1n0bpFCf5Nxq5M e/1wImXmKK3rpCUSOvv0Ej/lq/tiTp8IK4HVCoTK8W+SFk7d6zq7SIOLHw4iPe+NSy+DtKlm/H5n 08X1er1qWRLUmRX0V4LsR8j51nj62FpKqXeyhLhY83MNlVbelDVlgclu6tK85Y2gCsm6F2/f6usJ FMbNsOe5rAbq5drgi+L0hDnSo9bPLz1agx47CNHMRoamx74V1xSgTwzMl1juwgUe1kYtTnaTh8ak onWpL+b3XmmCv51XzWxTrylK7ISW+em/rsWGYWPfat9jnQODgWNmcXDSnaS8TPJa2kPwWZOtmhG9 sN1j4774vAhMz1KyHSOai1GdCB7a5lpwSllLo2uIs1gYLa24yq6tZqTMvUE++gm66BJTggtBd61N RklBNjTudUivDvEF4211z/eHYWn3o5Nrh2Nik3pq4V0R/v2f3/xHRSxK5p5XoynrRvVquVrM33// +v95+Xd/l8rMNDAJSCmQZra6XquzvDF5d/ECPVCKFrkloOXLaslFTVemJ13pd5wa4Ln+XpxFpkAI KbfT6na9KJccbnGEW2p7tVntLq+qW35q0JkFpmp41a2m9S/YqbaVyBFzGmG13s4G4j3F6X/p7+25 uMOon8kVJoyYQ1MSpat7/8919SHnbI2WKeJLTgJNhSRn/KuL7AXn1Gp251xb8UqUHeCyU+c7vy0y pGwC8yzxbH17pzNBlhtk6+a3SGSJ529vR1n2+gqmxe2uXGSmUUK5pOoilbwAexNXDxY08BxaZg/1 UB6i2gu1fuzFyt5KaGaDB93svFI6CTpT6snNqp6TVXvX6MAYSmO/WChurSbOo0DdxHhyf/Yv1NKv 9DLwauNmkOklWrqVxTRHhqUGvgp4rpTXnLItmV4Re1/utitFZST93dFphv31li+EryghG9wESn6m XtTvKpOSoXQ6Uy2pUqDYaq4NuNQJDoPQoLuG9bZxlkX2S28fkYO56zhiTbfHi9FQA9OpqjGd2oHI KqAtZ83ZX4wOXJPYyukUZVUzdBMaDASd8YNy8kkhpTeocryqasy/MymqBiyXaZc2p/O6MY1dr+AS xQm9Zv5+qzsamARmKHB3ogUPd1lOzFJJazt1qZtG6oY3WA+k3KhfKQ8Krk2yRDPGq8lX6xJThR34 Qsmf1W15vQZW8gvGf1I1Ff2SskIp7jgDvOmWG6LxowczfCUWj0YjuOOtFgMA4DHYJiVXZdcLuGYg n5Pix3PAPFBLpgf4NKVbrBGhjQYHep+WGf3A0xmov/UaARznbnsFSoU7rLuWL0A+inVh2eDwVM+B WgzJ7JyTJ8u26lO1IIRnZMJa3PEKJ8lLie5oYL5RBZcgr1IdPJygkq8MWS2XUw3crC/+Zg/QwuoG OaDJU8MhQZ7jtxXQNNTOyK5p9aBaSmtqdux6YsU7+oMampWzK+fR3F1pVxoBeqS6NIBTQEOjlR5k D9kjC4jY81BIgtpD0xtFtcMnBznAVCH8yVSiAuaT6xNvZBy7NPk+e5ZJb20qm9U4VS2cHR30wNjS FNOCPh6+S7wjsrjrK0ZMczHjgxfG67DZiI9zxG52VSsOrU78HS0Tc2BcHW4r5Be1eqd+3K11dd6m PvJU6nsyHK4HriX7JYN0Z2HXP+2c4Fa36+a2oC6h2ZVtYsA+/nopw2QVIoWN6sautL9DEjKhC8Ik uln5OxI/LEklnxA6AxcExlLVeUEFSaSwo9ZRFOrLFyN9xs7C9xdupDU4lH8Ol/T0zNU1fMIzK+ge TTuoSQZf4RygRPbbPD53hR83EswtGSnq+CTbCbdDFtsyYDxODQe8mt1k7Vl3KCWkkSgTNtft0B3c 6fpOHXA8l/oFTEEnyVakhIvpE5MVYtGuzxEWglNH1jbwa6mbanZ7t67y/m/7snJmIAPFr72DRx7u baeu/6DJH2yKPuEORtMFey6vK2yPezx1UuKAOmaLxvWAww8UwKL+UTVtQbBg37FB/WbllGXYLrdU pBzNnYpH9ltV+kjrGQT0sFazpUTEJC0bdeM5a2PqGqgqUk5YpCizi0qnXBX5eKQNH46qFeUSqZup aFoa3HXjB1rLmrMfp02BclMuWiocK7lksRhSDk6sk3b1QWCG4FRi2E37hYaSaqBKBhi9NJVyfzPD 8iPK5cgYVf3PMLxn/dTVxqx6X+HZipRQ0XSdUbxQ35iM4Dk6LsCD8XVepDkorc+IFmy2iqwBnuab 8M0Iyqe8N0Qnzn00GvN0QIMIeK3oxS5ZRF+preOhE4qL05zrlLJb3pMKEO5SQQ+4BxH8gaS9nDOy 4Itvt9fb/NTd0RD5MyYJNdTuTeZeDt9g2dfbajb9q2ysWfSlYpmu+aSFSyYMLXm4yYVhOV+qyeQe 35EWnYsMS49yHvfgBGlpIpBM4mr5H1BiL86NnBfaUHG5WJ3TF31yAobRxUWybDO18cqrvpFnN3fO F/dX/MR7kWSAqnce/YFT/7c91e4rwpurBNaarYY+a7/2liGPGTR7jZg/i38TC9RxGTY7JHT80syq 4MFxsSQYpzlSYVNdfJtoST8HrK5hDznkMEvRg2Yi/NgXTfR43Fwf4LypSZIFRNvcBlTuqfEJXa1j uTt4FuDLJ+UEdJzpoC2dAZYwCZVOaGWOpg16wScg95o7FGeQZxIuDX0bX0pPk2vTsrcIpqb/S8eR 8lLbGoNofX1e7/Wmz2xvihuC4LCni+piiw6drzZwRUH3pun93tC+6BGdyUOzZBO9emOb0Iy55Y9r haYz4bXR0kzC/bqDScSMoo1Z7JPQnFNFA9IH+PlyfsjhVcUOPbiaBBLQBTQAfQpJJEuKYTFtJ+St Nsp2R6DDgELaLY7aKcjZ9aO9J9gpnDjB/ulNHLl+3s8eZX26tvocgu0OH1i1/aKvt+qrzSE79dXm /9+on2WTgPzQsUdHxzBwvFmWmzv3tWcyOXpXVetyAdc6Wmcy/zfaEqz+WiOcfENY7N/L04wSfRWt qf/GiGXeukwFf/QHptwrBOVvUS7/S1CqkGI/WA9YdokgaqKRPt8AqT1FVTFlsQ3BS10f0pc7nYn9 sziAeBKX+14KSmyW7dSAK/bTi3e//7oJ834Xkx3jx10r+MO9nP76l8oR23mFrPXhtRRVyGn4XZ04 DofR//P5XOg/D2WGR9EdWzgH4tvdeVvFYWfFP+wWbRUfdlb8vL5pq/i4u8dV6xwfdFb8evWh2rQM tX2saT7Ae/Q3YQQ04CQjwC9FVLaVEdA00y3xCsSl78NUnBO798Am2Q4G3x/IhNvZyMHt0QxUgzIT p72/JV8ioZn26ccLzTyzf138zTkp1pT1olwsvtgtZwdpwFLWt3asVvvNOs6LkLNU4mGEFor+jzVe 3O9WDEcxcXXZv7EZRHypEsyAHLa8ckk20C4b35SUjuB79zBeAJ6L2uLp/5DYP6943vdk7dII2r5f aAxQVLJB+p8Y2qpIQslJZtpylEzTU9JPEWpVGvvTtkavOGE7/vqW/iktW/mrmqQ2kzur8mAOGx2j wW2CXDn45lSqndEE0lK/Hm8ywtLZj0cTMwgluw/6KVNHpJmU7Wy7JXuo6az/oJk8aAZkhJQxDvQI ioM65xaCBlr4vpNZaDONKcp8nT4h5uciXeue24p6/c7NtC0nNtVZw4dQwtq3LblqVMcZemoD9XLN W9ZrvmfB5i0rNv/YJYMzUPeSzQ9es49aNKo037Nsafth/qApYush81nXcohwj4Qq7e8KzWOkxsTp xNTgQ/u0Zq/8hw876ixD1924z3qo5GmfIf3cL6liZqI1c95CmHxgg3Bt9yQ7pEz3GzOZ+D11j7Cr eM13y+8fgNzx1w/EdTZK1hxkiQc9FoL+QRycDpCBpOhf5xUgeQFTaeamfOuq4XQ/j+0lkoOU87/K G3y0lzLTPDbfe5N3s4zV7EVpfOa8rBcAlRB5ZMAeyBD/CAYM24SkGE7kqNmAvK8fWIK1GuBNYF7P ttNpj9/v+glBVN41w13UNaO97HjKwzSmegpmO7VYHCfkut9u/7TbHY4V/sRenKD7+9+IA5Ch55tq WJtTyg4diGJcLKwLBtl+9KMDhWkc9O5AJQ/xASFEtiSzwC+FVy7JLI6zpr5eL+qLu6wvUf6kc2Qf rhRdy98TeEr33T3IuUG7Jm4OzD7VUqupa/eJxn0lPaxvrzwsfghDGhZXjYZfnZ58Oh4+PXNmxjkK KeiC2VjZZGaWnzlVHa8Vn+sxvtBexx7dJmSIcFhHnU8pTgfFIUlEiBMmw37++uYCQ9X15fJAqlYl D6HqH38F7n0zSe2iInL8ozYxvDdSPldDNX5NXFvthF/SHK91qIRgZ3gLYJVyNgSTv09sr3eTQxNA Q4eblurizC/f5Zh1gFOWaiHlk5W4VlwHrb+xSCAE+XndzMrNQe+7UvRfL0lGdChzpG0/YIIod8js yNlWle16/aTfoxVQXxZRsRF6kvkbOG3kgJOEHbnuO5gtdTuKnO9MFLDzZfJNl7Hz6yVnzQrPr2+x CKqxG2+EAspZTRtIBKTigdhnjvtzpQMefbMEzXl2Vc3e5Y2sdgAeTt/FRhv+mqMmKcMJPucnRVRg fTeimNAvqIBDa0Ko5MGMzvsgRkEZkGvKMa6xMOq7AXPZpD2R6NHaEz1+kDQsdp91e86lnBd7St9H EaSnjrobUVVin5PXrmO4LGLUXQ/ptWejbjk3wjjT1NBCraD544//T8mWz79+lT3OXi7V+mbrFfJP qS8/vkGiRiOpGole3qyaq9VuMadFlEj0sQQd4l6ISEAIS9rog/f3C4cmjlnq6l0CHJuaQMoF+uMo Nu7KGDRM6t26apikgX1fjA8ne48UJXbN4UI/hsZ0NFNIZvcibYcgOXab0pJBjnBuV/lmREuoiGpm WZ+zS5Ebct7LQyIdCDxzBXyz7EOJQC0SWMDp48y2PeqRPfsQ5VrNa8AqEm9D5Po2m9eMdYnmR1n2 7e7yElov8uyk2kN4O5Ro4ThOYMJ5dSG5V/SPcF1Xl/lwuFxdl5f1rOilzrFBQ10K1DLisprL3Afe 8alLfouDiOQHh6AMovYrUIBulClaiFSys6h+t+eU/GN77hboos5jjTVnDiEna9F3JG3/uZPZ1dDC qTbvWbvfdqN6HhkVsxhRQmghlVuKXAuPuiqfOO2c7iIdgnU7QEdFCI9iUlLkPdOLbE0FAlkOGfdW J+a41fiUsgC3Zu9+pCiAVZDL101ZqFa1YbnJKqacQv27Zd9PtNMQbtAEqZ4/+0w7gOr7vGiRE9CM ZA1BE8J7qtstm4LHtp1ATgjNyTA3qWqe2uwrdGN9Pvqevn/Leunt9vTkV+Mzd23xpUhbEPT+ynJH 93WRuil+RpYdigVHRzVFJNNuwHTTRzBgvZxO+2PBu5dQaAt7cZHHAR+f2uSZiV8/Mb9eeWlSdEzd EoHlrIexbNhTfWQP0RbG9KnwPfmNuG1exF/mF+Lzj3qKeT4Jylxwc5embq1W65duiRq/R23jHVJ9 SZWf+D85jOHpo08e/VLR1mJVbtEAU6Dath6xHr/erZ6XLeVASV4ANbu/Wq2bvgbmoRLq8hpkM9Ua cpanf+HBu11dl7f5KVpU8z6jOfzSH0v/qlosVv1T/E4kcOX12r/cveP32CtaBfXb+39589/oXDXr +fn7H17/X/8d56kh3kf4aIj4P99x1giKEvz6899xoP/XBP2cfU4/V5vRARloft68M2oKsRegn8sF wrFJ36IuZVXFSUuTRkSXnC7gY2Iot2sjazCXNUB0OeexpEwvzmxxMps1PH5knnJmvu8D/ppuw/5Y CqsVztWlp7//wWvIZjrnvyznE9xwtWLE4nM9PxcqtDNvytfz81fLm9U7gqLvq6o1feoLHa7UtUoD srD/qowdp2UstZcQJFUWuAa6uaOOQhr2yuvDAKQvqnKpqEDeOC9q+3RlFtLEvGZfN9VuvgL5ctoX NdJqQ5hjbOMqFxl6t1BfSvpwnSQMOmgU/2pGF0bR8UnCGlK3dmLmSCna26zWa8KMWd5lr76yuGh2 JO33VzG6mHoitgyaXxLxN6XkoCRnMnovvRwVacUhNPl4HMjzgHbUSPiLPJ1sxwHeOiRpyX0RjhMI 6ilA5kEMuOxhHdJl/cGkp3gteTn/CP14k4flON1l9C2lcnsGQGV/r/NXXw0t2J0IkquLi8JZIof6 1SF0D7+xMhELUEfSQHeOjywunOpxJFtP2PApaFRzmjwY0/hbk19yovs7IGVVCqJ3DzivJx3ZabjH zBJtGJfagcsZ4dOm27Z6VjvEaNsac13mNIZpjkPMUpNUaapvDAdgjEFKByLKJSJvK9RBQvHcFh8Z fU+qRfCt1JOaPwMOGuRWPBamIFyhLJPWV3OWPSlaiE6BzLB7zUevvnz98psvn/+eEu4+07ajOBu1 U/NisWuuXLM7NMPpetVsr5Fy6npqtENfUaXNWGGPqBjpp7yH0XK5K1VoERi4yh/A64fQx8H29VH/ htZTCa/qQpCvaHobqXlezUquUwPWqLqmi4ORzZrVdWXy2KjGkbBhrsh7tQPQpc42JT4esBssqm21 uMtwfQFStWzgqHNkmBAphvu4rR7lRgbeK5CJ9yjmUB5nMutqcCK9PMQ6A7FXh1YWM1MHQKodul/h XukusU9KTyceYx6/XQBY3tPODvSePs/mqxkxpzdLpYQSypixdei7TW3dxW5Bm+CMaSRNvBFi2C3n yPqGuVa2BQah6rC+aAu5MPGO4cTH3GvCaHun8sqbNBDpKlP5A4VlwQAZNgXu1XSpuM5VPZ9XyylL CmrIs3daVkQWC6VNPBlwClH6KRtmog1zzrOaNDD67bQ+U1epEjU4IJuyMvSmdk9UR0rrVLTiWle5 o6HScdzdrWWoHmVoNjs/9yRLJ5oBl6Jcjk7zYmiZ0iD1w4/STYrIN3L2bkCzljZGyVpRuFm7yyna 2r/aSWgdGQzPWDVD9z1/8pBH1yOjZyjthh9E1Rjf/+XNv9Mq2/Z6Pa837//L69v/mrW2ZrcmVYvo fLO6YXS0rU7JlanSdP3VjLVLvhU6l6hOIRrrb+QhpPu8Xi3fVXdr4AxpQ6/zlb4UkQVMdfaPioQW HZnMPA3GQsDStyYRkv+jVgyEP9JHJkhejZ5zJ1ZL5DzE9KU/Nt0NsA6Tk0BOz+fq4lNcXp3Xwhqc wpW7o6xLpAj78p9iH5eEbSfmwZJB9dT46gU+I9G1WuFXlFpx1+wgongtnFeI0cC26LupzzPqx+le GbfYzxFJ200YjZIIfLes3++qoc6POoQiMmMzn5mN77i6JCfry125KRXpGdQ/am7kLpb1FlCndbFS qli5rj+UG3UvPTsZneDWoEnQ+OPh95LIb9hFQKDSfhUj3rzc3TL1/53dvX7n7CwqMu7Dcnd9DshC Nv7aPdZNa+3I6y3y05RGgjycqq6uM7p+p4aT6367kNNY8h6BcEbEQUckLes+pmhHkd5FfTsx00h4 7VfriWLYAKnCWuhxDICS8W4KyHMkbvNzetgTk/d4uZA2LFr9tV1Ud1USyqxUIKTaxOHwVdZOlOOp 7uY+0MbhHvp516IWZUP194kgYduet0G5/qFIIT4YEmC7WxvGgy6lVOLVTagveiWYlA6JPmgbcDtF 9ZlvD/sJ/8Cp09zWpW0YQ9B4nqgk5LQUwGIhqm3ysnNcM9RlWSuZP4U8LS1yicBs1mLtoiE7946W dSFPelePrpa0G1W3W9iNTtWMleiHV7QRD0KyJFwj8yi7QOsUMf0pM7Urbh4gdAN6OUIKS4E5D6rq m7RvryNUG9mPUQtG375gPHZaEe44BtQ36PWttxVjWTqA97iC6HYAh69K9Y0nCmT2qmBGxBDTc1xq hHDrdCBuYT5H4F23XIFgh80jmgC8ErD1W4+M3zLOoDNoH31f/L00tD6/oGkf76V5v4H8CAj53Xne O/3uj2e4jyCeWkZ967SiqcLb2JHcLqk7xX/ue/+/vvnvAWBOsyCs1N22Xrz/317/V2xKP3ptwWYp N22p9AcGOtxeAVR62JQXQMMG5iw8VenNU6I3jo6eLxbZC/zWZFfljRgdFZdebRBDMGeYR/qzEoPW vFJCveK9DOh5pIGucbtzoiB9plgW4Cd0Umm2dUlP5AS2S+MRNHJMg/3E6+vKvO/jb0UReC6uLXTQ 78qmntGIfZTzhPindBCMVEmjk5OnvwnZgv2V1RX54Bdab3ZLoCbyo3Du1Bk6dR7/JkTXhYM5I/w6 0PhKHU9D46P0iH8P0onySqcwRb3LDg0wcqqtDfcBvzay4aovou5pkmrnFLVyWqc8NR1qH0/DaMNN ILaIuvHZTUdeApu/y87gIBBgILdyJ21eua7IoYnZGaIm6Y7B0bTcxF4O2R80SL+BtvMU7MXOdqP3 K9LQ8S2r9O5+R7uYELCoEEzWmaZjenPjahnX86WsJYnUckxInTf75Yu1ttyzSXjCQkzW6gbno5zN VhtWIVc8qX4jY4hymFJEbc4z5yJ8IFrDjwU6WNbQJnalsyaIBmdxN6OGDLP+D8s5ZXxwpjj02UMU fUs1nmVPYurEuJwJYGDU8emYKp2lpb1jlPvD66ypt7vS4tNXzM2za0IyULrUZRhy61GXy7pjoUD4 K2hztmq2z2ezqmmY01qma+WC7DmXfa2Y82MuPJytduwFlbpurIqHoUsCOXW/lzYYSLye5lq9VVrn fDdDqSM/NnB3PSypy6oZri6G5ZCbeEi3xnC7GtIRG6o2hs45wX+UoYDcsiw2v+K8yA8AWH8eFqdV ICqtvFSs9upyrgLcs83VakHqLaHpzap5NbfzBb6/vxbZxaK6rc+V7q406Wv251KaNdD3HWmKJD29 tTIaQM2XNE1fdjnmC9PIWKLoU9Y+NT1+HZJVUQUbh3McwBz5dXqiL2PngKi1hGjPNdxMMst5srzw sD/SOlfzF0Ix5KuZq8ZwYJXMgv4sXEK69L77X+ymalF5V6OLj4lmwgX934Q8TSYf3QYelvXfdgn5 QTx1t0utR1FD6YvcjkSPTR0BRVBbWpudPabP8brbcThJKmRKJSbVENPnLyzdgpZAe6sVnst9gtor UNHnplLi3lx9fjJ6EmFK2kFqZEnToG2qiMQyaZPFMvlwqFjk37mxVAEneLpElIxwu1YqxDxP4Vf6 Qm4cOKEv/GSegUBCOuR8tZ8ing6tpHNGzLlCqLq/bG3DcejmXseHlomYFnoM6fuQI+S34MKY6C0I 81d1cY6tkS/kIL3/39/8R20+Nm68I9KS/o/X/2+PtKQ3W7BaED3jSGlnX+Mo4fsWHRlhUHJNLSTR SDMqz2daQ/kWGt5yVh2JFPiKvnYEQU+kDFuKWnHkyagl/KcLSg4BxRyTcWx+air5txkFwW5Hx3QT Eoj9jCFWndBdSSOENdSqJZmVbeoe2GfMMh4dZ0EcJ1wcWSU0S72p+MUTNxNSAc22/NrJL45wsVbN LFblHHec5NkgmH94EaDLq9XqHbIIXRBsKkVXKjEBhm+xEqj65CxmHCiVnn3kzVA/rZPBI4E97XqZ Gl5KrJQLs/nbDSdCmS8pFcjiDvpvVilVfo45qBVib1oSJZpZuYZX+ZWStG+wCDx+yfQGCaKyj4LN OPtu+f1A/c8PtBTfLf8iRg7OB7T9sKJWsehKaJyL9Qntqg63DCprABLAex3BgHbF7LRb8MjiOJIr Z5PloxslI26nLyhTnmIJ9MmYUPOikHFRMhxIL7VthTR/fOd6AHMyQaS8XKulNPkYaKUQDXQ5onpi 4WlURXovndcXF00o8Nwv8Ja/nmRPnEdI2FtiIUeXdJ2g8RiX98K43N6AC3uakFSfZMMgb4WPGblQ dLAw49GLVsM9U1I1IJawcmnylEY4PisiZXhGGVO/78XaA3fzSL+TWvuvqfVDa61hWMt5wqASh8AP x5ZmvkJ9hpT3dsvzcoF3b8VjYLGFLzj7wLv4A0UoYfKmPZIXT3ejq6UnurvriKrD7ITdWL9b9sdt ACfw+HIrjqm7Mz84jrfl0cmnY4iucP866saEdMfx6GR85ksYPH6s/a/ZFFh+mGq//DzIftDvF5F/ /rFwG8uBOHkRjHPMwBVrYcbylyPX6f/U9HT65OzMnOMFZSI1P6nxesFhC88F//s+uVT7X/6Q+vIv obMdNa+dLRddL148EFpp7J+audqQhfhI6whRLjTW0R94F8ccnzifZ8ut85XrrNQyVfVtONvoKOqW Mb4EvhNFuy+B4Ng/BA4KxZkg+rHTgVmsaplHSBLuLPVanSR/1c08SWUHMQg/2SMGtM36D3Pr1jE8 IREU668W59QjZs7lE67ZD+GaCfNOFUxMeb1a5+lJJn7iKZyyl4laA1oEPdAOAmsb0l/63Uuk1sbx eAnXRLdqS0wC9xUbHWPSmCih5mt+e6dHEHn+VyS6JtfwT6yo6vw8cT5o6RRR8o5E6ZVuAK1DQhGP kVIbidBk3qZWeAyuLrYCIGkFpG9Eg0V+xVKJpoH8wcHRcGJjRNfVpnlMfyllRV/mH+r59koN5DdP wJc/Vf+DVVqt4Tb0FCxNfTe7AowerGRiRBlkJxn5vEsyUtX+kQb9JLHPeNziCYQATXj8UJbqP1cT mPSp58dPdZQVZtZSd8NGO12ZKg4xTNOfNNLsrq9LUtv6GhyfwFBMOV5L25cY/Wu19lbEL6/P52V2 O85yP6osh/AvEXkDoxQU3Zig4DhxgJqlAakOP32Kj7K9t9aQCvLS0VbB2okxu66SSgncIuRq9edq qf4sZFGUUHu+ahyXHNjzJSRDfusXbSmkIiVMMaTVmm79yaSfAE3E9GmfCnFXoS82gfUoLShMIaRO TQuywQM9gyKWv+yGe32aLw/sVw7qtHo/9do7cATboPPtR/V7j0mDJrw+6Yv7d2raae+VepQd5/Qu P/muq2br5b5t17HOYc7oQ+Kd98XatoVannoj7+c6Lspo5Kx5j+ESC8/ApcVgUvo55W3lWOhRKKv0 1Y10Xp5D413q5/YrerynOKc7kxxvVPQH2vGbvGrlgVJ0iCQchRen7HxxKmw1EL61b2r34fOeIu2V RW8ozqLhpqIktKoxeMx9qCodFoqKb5ZKKW6y4VAzJW0UIUMGJext3tVrvCfMOeRmbjz0JJKuhMcl 4oLYU4K0eFxoiDWAWgw/LDuE63pZX5cLX/ENdvnMXVEZmOsiqzRMXKB/2jWETjKDJwUhSqu5MgI2 tu7P1WaFO/fScTwkfZSF/+VllV8jaFeuu4Jde/mIFLEQjDKn9Vn2iwn3of7el0MBJzF7lv3yadAY aUJPEi9iWiwi0QKeD9in9oN62v9W7Q2FQqkr2S663qx+1wXad3auXtLmDDjo/oaMGVerD7ji67MU UjkvxvgsCT4uyzP2TNRmmcG47EIH2EH+9pg6qRgm2ZGhuyXD+uzQ9EEtexPuzwF7Eu7Lo/aNMb6t /b0Y0x+3PeEWjYeJAv4+mSLhHERVAI6AHykf7pjWMLU3vxrqoj4fLfEH7R/r86SA5sXHJJ0wWPVu Q4UX6Z7gn4cKER4nTbKij2Ebh7CMiGyeb+WhXZENlg8GI1R/sFGb3blweT3Q/Q1Mb4E7gD0F3oF8 ljyP4dj86/L3IDLrm4XnXnrzH4g9l1Oi4qsx6wq+f2+swpzaMZwNCh3M4Y3zs48Y5zdE6z/VQHld zYjMQGMaBOd45F7hOkiDUFVGaza+CwW1buxxFgwm0YRQXpLotx9J7zRsh48olXVjXnjpR4+HkG57 sdWUZWonN8mYFl6alW90CnHqSw173PcT2HHQ7TLVckvrwcZR+GfhDZBGfu8R8nz3DTFo+95jPIin teoK+/dXtXItaQyFBjl0puGHvNxqTKL+s6Mo9Zi/E0bz7qxglySSwbhFzfTekR2aj8u7M4vQgna0 4h4JdhE3/Oq65tyC3iUqxze6C1tPEVmn4MjqcBV87uj5hUwHXY37Z20F0yeS+vKuKnNuZMnfdS3c LxILR3dB+3A/Vz9zxGE0YtOR30SqmYAev3831mP6gZJ7YWT97peALNGGnswPev1xqjR3sbr6MLNU Z8H9dNHug9p2G7mH1AOWZTf29Pb57pztJG8HV/i7XTjT3BifGz03mahN7GPmeQBHar3OfsKZGuIL pyocITHXdn7lmBIQMzsg1TPNqbRPImEg0eMkanAHV0qj0RhH4lXIljAlT+vv6etHOOxUb6xZ3QZO 9VOxAlJDj6ieeyidi9qtEAxXUBCrD1LrFMZQ8vGj/ZAn/DHk8uAc8Ny1nfWXT4v4fcY/n6lnBq1T hK8N6L5e+oDYUeVh9lHVHkXVZPruC4F+FnjqP5WETxBBTRvvLuQjvx+9/z93o/8PMelL1A== """ import sys import base64 import zlib import imp class DictImporter(object): def __init__(self, sources): self.sources = sources def find_module(self, fullname, path=None): if fullname == "argparse" and sys.version_info >= (2,7): # we were generated with = (3, 0): exec("def do_exec(co, loc): exec(co, loc)\n") import pickle sources = sources.encode("ascii") # ensure bytes sources = pickle.loads(zlib.decompress(base64.decodebytes(sources))) else: import cPickle as pickle exec("def do_exec(co, loc): exec co in loc\n") sources = pickle.loads(zlib.decompress(base64.decodestring(sources))) importer = DictImporter(sources) sys.meta_path.insert(0, importer) entry = "import py; raise SystemExit(py.test.cmdline.main())" do_exec(entry, locals()) astropy-0.3/astropy/extern/six.py0000644000175000017500000005015412243255342015367 0ustar oleole"""Utilities for writing code that runs on Python 2 and 3""" # Copyright (c) 2010-2013 Benjamin Peterson # # 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 THE # AUTHORS OR COPYRIGHT HOLDERS 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. import operator import sys import types __author__ = "Benjamin Peterson " __version__ = "1.4.1" # Useful for very coarse version differentiation. PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 if PY3: string_types = str, integer_types = int, class_types = type, text_type = str binary_type = bytes MAXSIZE = sys.maxsize else: string_types = basestring, integer_types = (int, long) class_types = (type, types.ClassType) text_type = unicode binary_type = str if sys.platform.startswith("java"): # Jython always uses 32 bits. MAXSIZE = int((1 << 31) - 1) else: # It's possible to have sizeof(long) != sizeof(Py_ssize_t). class X(object): def __len__(self): return 1 << 31 try: len(X()) except OverflowError: # 32-bit MAXSIZE = int((1 << 31) - 1) else: # 64-bit MAXSIZE = int((1 << 63) - 1) del X def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name] class _LazyDescr(object): def __init__(self, name): self.name = name def __get__(self, obj, tp): result = self._resolve() setattr(obj, self.name, result) # This is a bit ugly, but it avoids running this again. delattr(tp, self.name) return result class MovedModule(_LazyDescr): def __init__(self, name, old, new=None): super(MovedModule, self).__init__(name) if PY3: if new is None: new = name self.mod = new else: self.mod = old def _resolve(self): return _import_module(self.mod) class MovedAttribute(_LazyDescr): def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): super(MovedAttribute, self).__init__(name) if PY3: if new_mod is None: new_mod = name self.mod = new_mod if new_attr is None: if old_attr is None: new_attr = name else: new_attr = old_attr self.attr = new_attr else: self.mod = old_mod if old_attr is None: old_attr = name self.attr = old_attr def _resolve(self): module = _import_module(self.mod) return getattr(module, self.attr) class _MovedItems(types.ModuleType): """Lazy loading of moved objects""" _moved_attributes = [ MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("reload_module", "__builtin__", "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("StringIO", "StringIO", "io"), MovedAttribute("UserString", "UserString", "collections"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), MovedModule("builtins", "__builtin__"), MovedModule("configparser", "ConfigParser"), MovedModule("copyreg", "copy_reg"), MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), MovedModule("http_cookies", "Cookie", "http.cookies"), MovedModule("html_entities", "htmlentitydefs", "html.entities"), MovedModule("html_parser", "HTMLParser", "html.parser"), MovedModule("http_client", "httplib", "http.client"), MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), MovedModule("cPickle", "cPickle", "pickle"), MovedModule("queue", "Queue"), MovedModule("reprlib", "repr"), MovedModule("socketserver", "SocketServer"), MovedModule("tkinter", "Tkinter"), MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), MovedModule("tkinter_tix", "Tix", "tkinter.tix"), MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), MovedModule("tkinter_colorchooser", "tkColorChooser", "tkinter.colorchooser"), MovedModule("tkinter_commondialog", "tkCommonDialog", "tkinter.commondialog"), MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), MovedModule("tkinter_font", "tkFont", "tkinter.font"), MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", "tkinter.simpledialog"), MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), MovedModule("winreg", "_winreg"), ] for attr in _moved_attributes: setattr(_MovedItems, attr.name, attr) del attr moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves") class Module_six_moves_urllib_parse(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_parse""" _urllib_parse_moved_attributes = [ MovedAttribute("ParseResult", "urlparse", "urllib.parse"), MovedAttribute("parse_qs", "urlparse", "urllib.parse"), MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), MovedAttribute("urldefrag", "urlparse", "urllib.parse"), MovedAttribute("urljoin", "urlparse", "urllib.parse"), MovedAttribute("urlparse", "urlparse", "urllib.parse"), MovedAttribute("urlsplit", "urlparse", "urllib.parse"), MovedAttribute("urlunparse", "urlparse", "urllib.parse"), MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), MovedAttribute("quote", "urllib", "urllib.parse"), MovedAttribute("quote_plus", "urllib", "urllib.parse"), MovedAttribute("unquote", "urllib", "urllib.parse"), MovedAttribute("unquote_plus", "urllib", "urllib.parse"), MovedAttribute("urlencode", "urllib", "urllib.parse"), ] for attr in _urllib_parse_moved_attributes: setattr(Module_six_moves_urllib_parse, attr.name, attr) del attr sys.modules[__name__ + ".moves.urllib_parse"] = Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse") sys.modules[__name__ + ".moves.urllib.parse"] = Module_six_moves_urllib_parse(__name__ + ".moves.urllib.parse") class Module_six_moves_urllib_error(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_error""" _urllib_error_moved_attributes = [ MovedAttribute("URLError", "urllib2", "urllib.error"), MovedAttribute("HTTPError", "urllib2", "urllib.error"), MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), ] for attr in _urllib_error_moved_attributes: setattr(Module_six_moves_urllib_error, attr.name, attr) del attr sys.modules[__name__ + ".moves.urllib_error"] = Module_six_moves_urllib_error(__name__ + ".moves.urllib_error") sys.modules[__name__ + ".moves.urllib.error"] = Module_six_moves_urllib_error(__name__ + ".moves.urllib.error") class Module_six_moves_urllib_request(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_request""" _urllib_request_moved_attributes = [ MovedAttribute("urlopen", "urllib2", "urllib.request"), MovedAttribute("install_opener", "urllib2", "urllib.request"), MovedAttribute("build_opener", "urllib2", "urllib.request"), MovedAttribute("pathname2url", "urllib", "urllib.request"), MovedAttribute("url2pathname", "urllib", "urllib.request"), MovedAttribute("getproxies", "urllib", "urllib.request"), MovedAttribute("Request", "urllib2", "urllib.request"), MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), MovedAttribute("BaseHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), MovedAttribute("FileHandler", "urllib2", "urllib.request"), MovedAttribute("FTPHandler", "urllib2", "urllib.request"), MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), MovedAttribute("urlretrieve", "urllib", "urllib.request"), MovedAttribute("urlcleanup", "urllib", "urllib.request"), MovedAttribute("URLopener", "urllib", "urllib.request"), MovedAttribute("FancyURLopener", "urllib", "urllib.request"), ] for attr in _urllib_request_moved_attributes: setattr(Module_six_moves_urllib_request, attr.name, attr) del attr sys.modules[__name__ + ".moves.urllib_request"] = Module_six_moves_urllib_request(__name__ + ".moves.urllib_request") sys.modules[__name__ + ".moves.urllib.request"] = Module_six_moves_urllib_request(__name__ + ".moves.urllib.request") class Module_six_moves_urllib_response(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_response""" _urllib_response_moved_attributes = [ MovedAttribute("addbase", "urllib", "urllib.response"), MovedAttribute("addclosehook", "urllib", "urllib.response"), MovedAttribute("addinfo", "urllib", "urllib.response"), MovedAttribute("addinfourl", "urllib", "urllib.response"), ] for attr in _urllib_response_moved_attributes: setattr(Module_six_moves_urllib_response, attr.name, attr) del attr sys.modules[__name__ + ".moves.urllib_response"] = Module_six_moves_urllib_response(__name__ + ".moves.urllib_response") sys.modules[__name__ + ".moves.urllib.response"] = Module_six_moves_urllib_response(__name__ + ".moves.urllib.response") class Module_six_moves_urllib_robotparser(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_robotparser""" _urllib_robotparser_moved_attributes = [ MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), ] for attr in _urllib_robotparser_moved_attributes: setattr(Module_six_moves_urllib_robotparser, attr.name, attr) del attr sys.modules[__name__ + ".moves.urllib_robotparser"] = Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib_robotparser") sys.modules[__name__ + ".moves.urllib.robotparser"] = Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser") class Module_six_moves_urllib(types.ModuleType): """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" parse = sys.modules[__name__ + ".moves.urllib_parse"] error = sys.modules[__name__ + ".moves.urllib_error"] request = sys.modules[__name__ + ".moves.urllib_request"] response = sys.modules[__name__ + ".moves.urllib_response"] robotparser = sys.modules[__name__ + ".moves.urllib_robotparser"] sys.modules[__name__ + ".moves.urllib"] = Module_six_moves_urllib(__name__ + ".moves.urllib") def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move) def remove_move(name): """Remove item from six.moves.""" try: delattr(_MovedItems, name) except AttributeError: try: del moves.__dict__[name] except KeyError: raise AttributeError("no such move, %r" % (name,)) if PY3: _meth_func = "__func__" _meth_self = "__self__" _func_closure = "__closure__" _func_code = "__code__" _func_defaults = "__defaults__" _func_globals = "__globals__" _iterkeys = "keys" _itervalues = "values" _iteritems = "items" _iterlists = "lists" else: _meth_func = "im_func" _meth_self = "im_self" _func_closure = "func_closure" _func_code = "func_code" _func_defaults = "func_defaults" _func_globals = "func_globals" _iterkeys = "iterkeys" _itervalues = "itervalues" _iteritems = "iteritems" _iterlists = "iterlists" try: advance_iterator = next except NameError: def advance_iterator(it): return it.next() next = advance_iterator try: callable = callable except NameError: def callable(obj): return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) if PY3: def get_unbound_function(unbound): return unbound create_bound_method = types.MethodType Iterator = object else: def get_unbound_function(unbound): return unbound.im_func def create_bound_method(func, obj): return types.MethodType(func, obj, obj.__class__) class Iterator(object): def next(self): return type(self).__next__(self) callable = callable _add_doc(get_unbound_function, """Get the function out of a possibly unbound function""") get_method_function = operator.attrgetter(_meth_func) get_method_self = operator.attrgetter(_meth_self) get_function_closure = operator.attrgetter(_func_closure) get_function_code = operator.attrgetter(_func_code) get_function_defaults = operator.attrgetter(_func_defaults) get_function_globals = operator.attrgetter(_func_globals) def iterkeys(d, **kw): """Return an iterator over the keys of a dictionary.""" return iter(getattr(d, _iterkeys)(**kw)) def itervalues(d, **kw): """Return an iterator over the values of a dictionary.""" return iter(getattr(d, _itervalues)(**kw)) def iteritems(d, **kw): """Return an iterator over the (key, value) pairs of a dictionary.""" return iter(getattr(d, _iteritems)(**kw)) def iterlists(d, **kw): """Return an iterator over the (key, [values]) pairs of a dictionary.""" return iter(getattr(d, _iterlists)(**kw)) if PY3: def b(s): return s.encode("latin-1") def u(s): return s unichr = chr if sys.version_info[1] <= 1: def int2byte(i): return bytes((i,)) else: # This is about 2x faster than the implementation above on 3.2+ int2byte = operator.methodcaller("to_bytes", 1, "big") byte2int = operator.itemgetter(0) indexbytes = operator.getitem iterbytes = iter import io StringIO = io.StringIO BytesIO = io.BytesIO else: def b(s): return s def u(s): return unicode(s, "unicode_escape") unichr = unichr int2byte = chr def byte2int(bs): return ord(bs[0]) def indexbytes(buf, i): return ord(buf[i]) def iterbytes(buf): return (ord(byte) for byte in buf) import StringIO StringIO = BytesIO = StringIO.StringIO _add_doc(b, """Byte literal""") _add_doc(u, """Text literal""") if PY3: import builtins exec_ = getattr(builtins, "exec") def reraise(tp, value, tb=None): if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value print_ = getattr(builtins, "print") del builtins else: def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" if _globs_ is None: frame = sys._getframe(1) _globs_ = frame.f_globals if _locs_ is None: _locs_ = frame.f_locals del frame elif _locs_ is None: _locs_ = _globs_ exec("""exec _code_ in _globs_, _locs_""") exec_("""def reraise(tp, value, tb=None): raise tp, value, tb """) def print_(*args, **kwargs): """The new-style print function.""" fp = kwargs.pop("file", sys.stdout) if fp is None: return def write(data): if not isinstance(data, basestring): data = str(data) fp.write(data) want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: if isinstance(sep, unicode): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: if isinstance(end, unicode): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") if kwargs: raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: if isinstance(arg, unicode): want_unicode = True break if want_unicode: newline = unicode("\n") space = unicode(" ") else: newline = "\n" space = " " if sep is None: sep = space if end is None: end = newline for i, arg in enumerate(args): if i: write(sep) write(arg) write(end) _add_doc(reraise, """Reraise an exception.""") def with_metaclass(meta, *bases): """Create a base class with a metaclass.""" return meta("NewBase", bases, {}) def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" def wrapper(cls): orig_vars = cls.__dict__.copy() orig_vars.pop('__dict__', None) orig_vars.pop('__weakref__', None) for slots_var in orig_vars.get('__slots__', ()): orig_vars.pop(slots_var) return metaclass(cls.__name__, cls.__bases__, orig_vars) return wrapper astropy-0.3/astropy/extern/configobj.py0000644000175000017500000000105412243255342016517 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module just pulls in the appropriate `configobj` package, depending on the currently installed version of python. Also, this should actually never actually show up as a docstring, because it should get overwritten by the appropriate configobj docstring. """ from sys import version_info if version_info[0] > 2: from .configobj_py3 import configobj, validate, __doc__ else: from .configobj_py2 import configobj, validate, __doc__ del version_info #cleans up the namespace astropy-0.3/astropy/config/0000755000175000017500000000000012243263747014155 5ustar oleoleastropy-0.3/astropy/config/tests/0000755000175000017500000000000012243263747015317 5ustar oleoleastropy-0.3/astropy/config/tests/__init__.py0000644000175000017500000000015512243255342017421 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) astropy-0.3/astropy/config/tests/test_configs.py0000644000175000017500000001711612243255342020356 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import io import os import shutil import sys try: # used by test_get_config_items from ..configuration import ConfigurationItem TESTCONF1 = ConfigurationItem('test1', 1, 'descr') TESTCONF2 = ConfigurationItem('test2', 2, 'descr') except: # if this fails on import, don't worry - the tests will catch it. pass def test_paths(): from ..paths import get_config_dir, get_cache_dir assert 'astropy' in get_config_dir() assert 'astropy' in get_cache_dir() def test_config_file(): from ..configuration import get_config, reload_config, save_config apycfg = get_config('astropy') assert apycfg.filename.endswith('astropy.cfg') cfgsec = get_config('astropy.config') assert cfgsec.depth == 1 assert cfgsec.name == 'config' assert cfgsec.parent.filename.endswith('astropy.cfg') reload_config('astropy') # saving shouldn't change the file, because reload should have made sure it # is based on the current file. But don't do it if there's no file if os.path.exists(apycfg.filename): save_config('astropy') def test_configitem(): from ..configuration import ConfigurationItem, get_config ci = ConfigurationItem('tstnm', 34, 'this is a Description') assert ci.module == 'astropy.config.tests.test_configs' assert ci() == 34 assert ci.description == 'this is a Description' sec = get_config(ci.module) assert sec['tstnm'] == 34 assert sec.comments['tstnm'][0] == '' assert sec.comments['tstnm'][1] == 'this is a Description' ci.description = 'updated Descr' ci.set(32) assert ci() == 32 assert sec.comments['tstnm'][1] == 'updated Descr' # It's useful to go back to the default to allow other test functions to # call this one and still be in the default configuration. ci.description = 'this is a Description' ci.set(34) assert ci() == 34 assert sec.comments['tstnm'][1] == 'this is a Description' def test_configitem_save(tmpdir): from ..configuration import ConfigurationItem, get_config ci = ConfigurationItem('tstnm2', 42, 'this is another Description') apycfg = get_config(ci.module) # now try saving while apycfg.parent is not apycfg: apycfg = apycfg.parent f = tmpdir.join('astropy.cfg') with open(f.strpath, 'w') as fd: apycfg.write(fd) with io.open(f.strpath, 'rU') as fd: lns = [x.strip() for x in fd.readlines()] assert 'tstnm2 = 42' in lns assert '# this is another Description' in lns oldfn = apycfg.filename try: # We had used LocalPath's `copy` method here, but it copies # the file in TEXT mode, destroying newlines on Windows. We # need to do a binary copy. shutil.copy(tmpdir.join('astropy.cfg').strpath, tmpdir.join('astropy.cfg2').strpath) # tmpdir.join('astropy.cfg').copy(tmpdir.join('astropy.cfg2')) apycfg.filename = tmpdir.join('astropy.cfg2').realpath().strpath ci.set(30) ci.save() with io.open(apycfg.filename, 'rU') as f: lns = [x.strip() for x in f.readlines()] assert '[config.tests.test_configs]' in lns assert 'tstnm2 = 30' in lns ci.save(31) with io.open(apycfg.filename, 'rU') as f: lns = [x.strip() for x in f.readlines()] assert '[config.tests.test_configs]' in lns assert 'tstnm2 = 31' in lns # also try to save one that doesn't yet exist apycfg.filename = tmpdir.join('astropy.cfg3').realpath().strpath ci.save() with io.open(apycfg.filename, 'rU') as f: lns = [x.strip() for x in f.readlines()] assert '[config.tests.test_configs]' in lns assert 'tstnm2 = 30' in lns finally: apycfg.filename = oldfn def test_configitem_types(): from ..configuration import ConfigurationItem from ...tests.helper import pytest ci1 = ConfigurationItem('tstnm1', 34) assert isinstance(ci1(), int) ci2 = ConfigurationItem('tstnm2', 34.3) assert isinstance(ci2(), float) ci3 = ConfigurationItem('tstnm3', True) assert isinstance(ci3(), bool) ci4 = ConfigurationItem('tstnm4', 'astring') assert isinstance(ci4(), str) with pytest.raises(TypeError): ci1.set(34.3) ci2.set(12) # this would should succeed as up-casting with pytest.raises(TypeError): ci3.set('fasd') with pytest.raises(TypeError): ci4.set(546.245) def test_configitem_options(tmpdir): from ..configuration import ConfigurationItem, get_config from ...tests.helper import pytest cio = ConfigurationItem('tstnmo', ['op1', 'op2', 'op3']) sec = get_config(cio.module) assert isinstance(cio(), str) assert cio() == 'op1' assert sec['tstnmo'] == 'op1' cio.set('op2') with pytest.raises(TypeError): cio.set('op5') assert sec['tstnmo'] == 'op2' # now try saving apycfg = sec while apycfg.parent is not apycfg: apycfg = apycfg.parent f = tmpdir.join('astropy.cfg') with open(f.strpath, 'w') as fd: apycfg.write(fd) with io.open(f.strpath, 'rU') as fd: lns = [x.strip() for x in f.readlines()] assert '# Options: op1, op2, op3' in lns assert 'tstnmo = op2' in lns def test_config_noastropy_fallback(monkeypatch, recwarn): """ Tests to make sure configuration items fall back to their defaults when there's a problem accessing the astropy directory """ from ...tests.helper import pytest from .. import paths, configuration # make sure the config directory is not searched monkeypatch.setenv('XDG_CONFIG_HOME', 'foo') monkeypatch.delenv('XDG_CONFIG_HOME') # make sure the _find_or_create_astropy_dir function fails as though the # astropy dir could not be accessed def osraiser(dirnm, linkto): raise OSError monkeypatch.setattr(paths, '_find_or_create_astropy_dir', osraiser) # also have to make sure the stored configuration objects are cleared monkeypatch.setattr(configuration, '_cfgobjs', {}) with pytest.raises(OSError): # make sure the config dir search fails paths.get_config_dir() # now run the basic tests, and make sure the warning about no astropy # is present test_configitem() assert len(recwarn.list) > 0 w = recwarn.pop() assert w.category == configuration.ConfigurationMissingWarning assert 'Configuration defaults will be used' in str(w.message) assert 'and configuration cannot be saved due to' in str(w.message) def test_get_config_items(): """ Checks if the get_config_items function is working correctly, using `ConfigurationItem` objects from this module. """ from ..configuration import get_config_items itemslocal = get_config_items(sys.modules['astropy.config.tests.test_configs']) itemslocalnone = get_config_items(None) itemsname = get_config_items('astropy.config.tests.test_configs') assert itemslocal == itemsname assert itemslocal == itemslocalnone assert 'TESTCONF1' in itemslocal.keys() assert 'TESTCONF2' in itemslocal.keys() def test_configitem_setters(): from ..configuration import ConfigurationItem ci = ConfigurationItem('tstnm12', 42, 'this is another Description') assert ci() == 42 with ci.set_temp(45): assert ci() == 45 assert ci() == 42 ci.set(43) assert ci() == 43 with ci.set_temp(46): assert ci() == 46 assert ci() == 43 astropy-0.3/astropy/config/paths.py0000644000175000017500000001430512243255342015641 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions to determine where configuration and data/cache files used by Astropy should be placed. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os import sys __all__ = ['get_config_dir', 'get_cache_dir'] def _find_home(): """ Locates and return the home directory (or best approximation) on this system. Raises ------ OSError If the home directory cannot be located - usually means you are running Astropy on some obscure platform that doesn't have standard home directories. """ # this is used below to make fix up encoding issues that sometimes crop up # in py2.x but not in py3.x if sys.version_info[0] < 3: # pragma: py3 decodepath = lambda pth: pth.decode(sys.getfilesystemencoding()) else: # pragma: py2 decodepath = lambda pth: pth # First find the home directory - this is inspired by the scheme ipython # uses to identify "home" if os.name == 'posix': # Linux, Unix, AIX, OS X if 'HOME' in os.environ: homedir = decodepath(os.environ['HOME']) else: raise OSError('Could not find unix home directory to search for ' 'astropy config dir') elif os.name == 'nt': # This is for all modern Windows (NT or after) # Try for a network home first if 'HOMESHARE' in os.environ: homedir = decodepath(os.environ['HOMESHARE']) # See if there's a local home elif 'HOMEDRIVE' in os.environ and 'HOMEPATH' in os.environ: homedir = os.path.join(os.environ['HOMEDRIVE'], os.environ['HOMEPATH']) homedir = decodepath(homedir) # Maybe a user profile? elif 'USERPROFILE' in os.environ: homedir = decodepath(os.path.join(os.environ['USERPROFILE'])) else: try: from ..extern.six.moves import winreg as wreg shell_folders = r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders' key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, shell_folders) homedir = wreg.QueryValueEx(key, 'Personal')[0] homedir = decodepath(homedir) key.Close() except: # As a final possible resort, see if HOME is present if 'HOME' in os.environ: homedir = decodepath(os.environ['HOME']) else: raise OSError('Could not find windows home directory to ' 'search for astropy config dir') else: # for other platforms, try HOME, although it probably isn't there if 'HOME' in os.environ: homedir = decodepath(os.environ['HOME']) else: raise OSError('Could not find a home directory to search for ' 'astropy config dir - are you on an unspported ' 'platform?') return homedir def get_config_dir(create=True): """ Determines the Astropy configuration directory name and creates the directory if it doesn't exist. This directory is typically ``$HOME/.astropy/config``, but if the XDG_CONFIG_HOME environment variable is set and the ``$XDG_CONFIG_HOME/astropy`` directory exists, it will be that directory. If neither exists, the former will be created and symlinked to the latter. Returns ------- configdir : str The absolute path to the configuration directory. """ # symlink will be set to this if the directory is created linkto = None # first look for XDG_CONFIG_HOME xch = os.environ.get('XDG_CONFIG_HOME') if xch is not None and os.path.exists(xch): xchpth = os.path.join(xch, 'astropy') if not os.path.islink(xchpth): if os.path.exists(xchpth): return os.path.abspath(xchpth) else: linkto = xchpth return os.path.abspath(_find_or_create_astropy_dir('config', linkto)) def get_cache_dir(): """ Determines the Astropy cache directory name and creates the directory if it doesn't exist. This directory is typically ``$HOME/.astropy/cache``, but if the XDG_CACHE_HOME environment variable is set and the ``$XDG_CACHE_HOME/astropy`` directory exists, it will be that directory. If neither exists, the former will be created and symlinked to the latter. Returns ------- cachedir : str The absolute path to the cache directory. """ # symlink will be set to this if the directory is created linkto = None # first look for XDG_CACHE_HOME xch = os.environ.get('XDG_CACHE_HOME') if xch is not None and os.path.exists(xch): xchpth = os.path.join(xch, 'astropy') if not os.path.islink(xchpth): if os.path.exists(xchpth): return os.path.abspath(xchpth) else: linkto = xchpth return os.path.abspath(_find_or_create_astropy_dir('cache', linkto)) def _find_or_create_astropy_dir(dirnm, linkto): innerdir = os.path.join(_find_home(), '.astropy') maindir = os.path.join(_find_home(), '.astropy', dirnm) if not os.path.exists(maindir): # first create .astropy dir if needed if not os.path.exists(innerdir): try: os.mkdir(innerdir) except OSError: if not os.path.isdir(innerdir): raise elif not os.path.isdir(innerdir): msg = 'Intended Astropy directory {0} is actually a file.' raise IOError(msg.format(innerdir)) try: os.mkdir(maindir) except OSError: if not os.path.isdir(maindir): raise if (not sys.platform.startswith('win') and linkto is not None and not os.path.exists(linkto)): os.symlink(maindir, linkto) elif not os.path.isdir(maindir): msg = 'Intended Astropy {0} directory {1} is actually a file.' raise IOError(msg.format(dirnm, maindir)) return os.path.abspath(maindir) astropy-0.3/astropy/config/__init__.py0000644000175000017500000000063612243255342016263 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains configuration and setup utilities for the `astropy` project. This includes all functionality related to the affiliated package index. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from .paths import * from .configuration import * from .affiliated import * astropy-0.3/astropy/config/setup_package.py0000644000175000017500000000015012243255342017326 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def requires_2to3(): return False astropy-0.3/astropy/config/affiliated.py0000644000175000017500000000046512243255342016614 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains functions and classes for finding information about affiliated packages and installing them. """ from __future__ import (absolute_import, division, print_function, unicode_literals) __all__ = [] astropy-0.3/astropy/config/configuration.py0000644000175000017500000006054412243255342017377 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains classes and functions to standardize access to configuration files for Astropy and affiliated packages. .. note:: The configuration system makes use of the 'configobj' package, which stores configuration in a text format like that used in the standard library `ConfigParser`. More information and documentation for configobj can be found at http://www.voidspace.org.uk/python/configobj.html. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ..extern import six import inspect import pkgutil import re import sys import textwrap import types from contextlib import contextmanager from os import path from warnings import warn from ..extern import six from ..extern.configobj import configobj, validate from ..utils.exceptions import AstropyWarning __all__ = ['ConfigurationItem', 'InvalidConfigurationItemWarning', 'ConfigurationMissingWarning', 'get_config', 'save_config', 'reload_config'] class InvalidConfigurationItemWarning(AstropyWarning): """ A Warning that is issued when the configuration value specified in the astropy configuration file does not match the type expected for that configuration value. """ class ConfigurationMissingWarning(AstropyWarning): """ A Warning that is issued when the configuration directory cannot be accessed (usually due to a permissions problem). If this warning appears, configuration items will be set to their defaults rather than read from the configuration file, and no configuration will persist across sessions. """ # these are not in __all__ because it's not intended that a user ever see them class ConfigurationDefaultMissingError(ValueError): """ An exception that is raised when the configuration defaults (which should be generated at build-time) are missing. """ # this is used in astropy/__init__.py class ConfigurationDefaultMissingWarning(AstropyWarning): """ A warning that is issued when the configuration defaults (which should be generated at build-time) are missing. """ class ConfigurationItem(object): """ A setting and associated value stored in the astropy configuration files. These objects are typically defined at the top of astropy subpackages or affiliated packages, and store values or option settings that can be modified by the user to Parameters ---------- name : str The (case-sensitive) name of this parameter, as shown in the configuration file. defaultvalue The default value for this item. If this is a list of strings, this item will be interpreted as an 'options' value - this item must be one of those values, and the first in the list will be taken as the default value. description : str or None A description of this item (will be shown as a comment in the configuration file) cfgtype : str or None A type specifier like those used as the *values* of a particular key in a `configspec` file of `configobj`. If None, the type will be inferred from the default value. module : str or None The full module name that this item is associated with. The first element (e.g. 'astropy' if this is 'astropy.config.configuration') will be used to determine the name of the configuration file, while the remaining items determine the section. If None, the package will be inferred from the package within whiich this object's initializer is called. Raises ------ RuntimeError If `module` is None, but the module this item is created from cannot be determined. Examples -------- The following example will create an item 'cfgoption = 42' in the '[configuration]' section of astropy.cfg (located in the directory that `astropy.config.paths.get_config_dir` returns), or if the option is already set, it will take the value from the configuration file:: from astropy.config import ConfigurationItem CFG_OPTION = ConfigurationItem('cfgoption',42,module='astropy.configuration') If called as ``CFG_OPTION()``, this will return the value ``42``, or some other integer if the ``astropy.cfg`` file specifies a different value. If this were a file ``astropy/configuration/__init__.py``, the `module` option would not be necessary, as it would automatically detect the correct module. """ # this is used to make validation faster so a Validator object doesn't # have to be created every time _validator = validate.Validator() def __init__(self, name, defaultvalue='', description=None, cfgtype=None, module=None): from ..utils import find_current_module from ..utils import isiterable if module is None: module = find_current_module(2) if module is None: msg1 = 'Cannot automatically determine get_config module, ' msg2 = 'because it is not called from inside a valid module' raise RuntimeError(msg1 + msg2) else: module = module.__name__ self.name = name self.module = module self.description = description # now determine cfgtype if it is not given if cfgtype is None: if (isiterable(defaultvalue) and not isinstance(defaultvalue, six.string_types)): # it is an options list dvstr = [str(v) for v in defaultvalue] cfgtype = 'option(' + ', '.join(dvstr) + ')' defaultvalue = dvstr[0] elif isinstance(defaultvalue, bool): cfgtype = 'boolean' elif isinstance(defaultvalue, int): cfgtype = 'integer' elif isinstance(defaultvalue, float): cfgtype = 'float' else: cfgtype = 'string' defaultvalue = str(defaultvalue) self.cfgtype = cfgtype self._validate_val(defaultvalue) self.defaultvalue = defaultvalue # note that the actual value is stored in the ConfigObj file for this # package # this checks the current value to make sure it's valid for the type # as well as updating the ConfigObj with the default value, if it's not # actually in the ConfigObj try: self() except TypeError as e: # make sure it's a TypeError from __call__ if 'Configuration value not valid:' in e.args[0]: warn(InvalidConfigurationItemWarning(*e.args)) else: raise def set(self, value): """ Sets the current value of this `ConfigurationItem`. This also updates the comments that give the description and type information. .. note:: This does *not* save the value of this `ConfigurationItem` to the configuration file. To do that, use `ConfigurationItem.save` or `save_config`. Parameters ---------- value The value this item should be set to. Raises ------ TypeError If the provided `value` is not valid for this `ConfigurationItem`. """ try: value = self._validate_val(value) except validate.ValidateError as e: msg = 'Provided value for configuration item {0} not valid: {1}' raise TypeError(msg.format(self.name, e.args[0])) sec = get_config(self.module) sec[self.name] = value sec.comments[self.name] = self._generate_comments() @contextmanager def set_temp(self, value): """ Sets this item to a specified value only inside a while loop. Use as:: ITEM = ConfigurationItem('ITEM', 'default', 'description') with ITEM.set_temp('newval'): ... do something that wants ITEM's value to be 'newval' ... # ITEM is now 'default' after the with block Parameters ---------- value The value to set this item to inside the with block. """ initval = self() self.set(value) yield self.set(initval) def save(self, value=None): """ Writes a value for this `ConfigurationItem` to the relevant configuration file. This also writes updated versions of the comments that give the description and type information. .. note:: This only saves the value of this *particular* `ConfigurationItem`. To save all configuration settings for this package at once, see `save_config`. Parameters ---------- value Save this value to the configuration file. If None, the current value of this `ConfigurationItem` will be saved. Raises ------ TypeError If the provided `value` is not valid for this `ConfigurationItem`. """ try: value = self() if value is None else self._validate_val(value) except validate.ValidateError as e: msg = 'Provided value for configuration item {0} not valid: {1}' raise TypeError(msg.format(self.name, e.args[0])) # Now find the ConfigObj that this is based on baseobj = get_config(self.module) secname = baseobj.name cobj = baseobj # a ConfigObj's parent is itself, so we look for the parent with that while cobj.parent is not cobj: cobj = cobj.parent # use the current on disk version, which will be modified with the # given value and type/description newobj = configobj.ConfigObj(cobj.filename, interpolation=False) if secname is not None: if secname not in newobj: newobj[secname] = {} newsec = newobj[secname] newsec[self.name] = value newsec.comments[self.name] = self._generate_comments() newobj.write() def reload(self): """ Reloads the value of this `ConfigurationItem` from the relevant configuration file. Returns ------- val The new value loaded from the configuration file. """ baseobj = get_config(self.module) secname = baseobj.name cobj = baseobj # a ConfigObj's parent is itself, so we look for the parent with that while cobj.parent is not cobj: cobj = cobj.parent newobj = configobj.ConfigObj(cobj.filename, interpolation=False) if secname is not None: newobj = newobj[secname] baseobj[self.name] = newobj[self.name] def __repr__(self): out = '<{0}: name={1!r} value={2!r} at 0x{3:x}>'.format( self.__class__.__name__, self.name, self(), id(self)) return out def __str__(self): out = '\n'.join(('{0}: {1}', ' cfgtype={2!r}', ' defaultvalue={3!r}', ' description={4!r}', ' module={5}', ' value={6!r}')) out = out.format(self.__class__.__name__, self.name, self.cfgtype, self.defaultvalue, self.description, self.module, self()) return out def __call__(self): """ Returns the value of this `ConfigurationItem` Returns ------- val This item's value, with a type determined by the `cfgtype` attribute. Raises ------ TypeError If the configuration value as stored is not this item's type. """ # get the value from the relevant `configobj.ConfigObj` object sec = get_config(self.module) if self.name not in sec: self.set(self.defaultvalue) val = sec[self.name] try: return self._validate_val(val) except validate.ValidateError as e: raise TypeError('Configuration value not valid:' + e.args[0]) def _validate_val(self, val): """ Validates the provided value based on cfgtype and returns the type-cast value throws the underlying configobj exception if it fails """ # note that this will normally use the *class* attribute `_validator`, # but if some arcane reason is needed for making a special one for an # instance or sub-class, it will be used return self._validator.check(self.cfgtype, val) def _generate_comments(self): comments = [] comments.append('') # adds a blank line before every entry if self.description is not None: for line in textwrap.wrap(self.description, width=76): comments.append(line) if self.cfgtype.startswith('option'): comments.append("Options: " + self.cfgtype[7:-1]) return comments # this dictionary stores the master copy of the ConfigObj's for each # root package _cfgobjs = {} def get_config(packageormod=None, reload=False): """ Gets the configuration object or section associated with a particular package or module. Parameters ----------- packageormod : str or None The package for which to retrieve the configuration object. If a string, it must be a valid package name, or if None, the package from which this function is called will be used. Returns ------- cfgobj : `configobj.ConfigObj` or `configobj.Section` If the requested package is a base package, this will be the `configobj.ConfigObj` for that package, or if it is a subpackage or module, it will return the relevant `configobj.Section` object. Raises ------ RuntimeError If `package` is None, but the package this item is created from cannot be determined. """ from .paths import get_config_dir from ..utils import find_current_module if packageormod is None: packageormod = find_current_module(2) if packageormod is None: msg1 = 'Cannot automatically determine get_config module, ' msg2 = 'because it is not called from inside a valid module' raise RuntimeError(msg1 + msg2) else: packageormod = packageormod.__name__ packageormodspl = packageormod.split('.') rootname = packageormodspl[0] secname = '.'.join(packageormodspl[1:]) cobj = _cfgobjs.get(rootname, None) if cobj is None: if _ASTROPY_SETUP_: # There's no reason to use anything but the default config cobj = configobj.ConfigObj(interpolation=False) else: try: cfgfn = path.join(get_config_dir(), rootname + '.cfg') cobj = configobj.ConfigObj(cfgfn, interpolation=False) except (IOError, OSError) as e: msg = ('Configuration defaults will be used, and ' 'configuration cannot be saved due to ') errstr = '' if len(e.args) < 1 else (':' + str(e.args[0])) msg += e.__class__.__name__ + errstr warn(ConfigurationMissingWarning(msg)) # This caches the object, so if the file becomes accessible, this # function won't see it unless the module is reloaded cobj = configobj.ConfigObj(interpolation=False) _cfgobjs[rootname] = cobj if secname: # not the root package if secname not in cobj: cobj[secname] = {} return cobj[secname] else: return cobj def save_config(packageormod=None, filename=None): """ Saves all configuration settings to the configuration file for the root package of the requested package/module. This overwrites any configuration items that have been changed in `ConfigurationItem` objects that are based on the configuration file determined by the *root* package of `packageormod` (e.g. 'astropy.cfg' for the 'astropy.config.configuration' module). .. note:: To save only a single item, use the `ConfigurationItem.save` method - this will save all options in the current session that may have been changed. Parameters ---------- packageormod : str or None The package or module name - see `get_config` for details. filename : str, optional Save the config to a given filename instead of to the default location. """ sec = get_config(packageormod) # look for the section that is its own parent - that's the base object while sec.parent is not sec: sec = sec.parent if filename is not None: with open(filename, 'w') as f: sec.write(outfile=f) else: sec.write() def reload_config(packageormod=None): """ Reloads configuration settings from a configuration file for the root package of the requested package/module. This overwrites any changes that may have been made in `ConfigurationItem` objects. This applies for any items that are based on this file, which is determined by the *root* package of `packageormod` (e.g. 'astropy.cfg' for the 'astropy.config.configuration' module). Parameters ---------- packageormod : str or None The package or module name - see `get_config` for details. """ sec = get_config(packageormod) # look for the section that is its own parent - that's the base object while sec.parent is not sec: sec = sec.parent sec.reload() def get_config_items(packageormod=None): """ Returns the `ConfigurationItem` objects associated with a particular module. Parameters ---------- packageormod : str or None The package or module name or None to get the current module's items. Returns ------- configitems : dict A dictionary where the keys are the name of the items as the are named in the module, and the values are the associated `ConfigurationItem` objects. """ from ..utils import find_current_module if packageormod is None: packageormod = find_current_module(2) if packageormod is None: msg1 = 'Cannot automatically determine get_config module, ' msg2 = 'because it is not called from inside a valid module' raise RuntimeError(msg1 + msg2) elif isinstance(packageormod, six.string_types): __import__(packageormod) packageormod = sys.modules[packageormod] elif inspect.ismodule(packageormod): pass else: raise TypeError('packageormod in get_config_items is invalid') configitems = {} for n, obj in six.iteritems(packageormod.__dict__): # if it's not a new-style object, it's certainly not a ConfigurationItem if hasattr(obj, '__class__'): fqn = obj.__class__.__module__ + '.' + obj.__class__.__name__ if fqn == 'astropy.config.configuration.ConfigurationItem': configitems[n] = obj return configitems def _fix_section_blank_lines(sec, recurse=True, gotoroot=True): """ Adds a blank line to the comments of any sections in the requested sections, recursing into subsections if `recurse` is True. If `gotoroot` is True, this first goes to the root of the requested section, just like `save_config` and `reload_config` - this does nothing if `sec` is a configobj already. """ if not hasattr(sec, 'sections'): sec = get_config(sec) # look for the section that is its own parent - that's the base object if gotoroot: while sec.parent is not sec: sec = sec.parent for isec, snm in enumerate(sec.sections): comm = sec.comments[snm] if len(comm) == 0 or comm[-1] != '': if sec.parent is sec and isec == 0: pass # don't do it for first section else: comm.append('') if recurse: _fix_section_blank_lines(sec[snm], True, False) _unsafe_import_regex = [r'astropy\.sphinx\.ext.*', r'astropy\.utils\.compat\._gzip_32', r'astropy\.utils\.compat\._fractions_27', r'.*.setup_package', r'astropy\.version_helpers', r'astropy\.setup_helpers' ] _unsafe_import_regex = [('(' + pat + ')') for pat in _unsafe_import_regex] _unsafe_import_regex = re.compile('|'.join(_unsafe_import_regex)) def generate_all_config_items(pkgornm=None, reset_to_default=False, filename=None): """ Given a root package name or package, this function walks through all the subpackages and modules, which should populate any ConfigurationItem objects defined at the module level. If `reset_to_default` is True, it also sets all of the items to their default values, regardless of what the file's value currently is. It then saves the `ConfigObj`. Parameters ---------- pkgname : str, module, or None The package for which to generate configuration items. If None, the package of the function that calls this one will be used. reset_to_default : bool If True, the configuration items will all be set to their defaults. filename : str, optional Save the generated config items to the given filename instead of to the default config file path. Returns ------- cfgfn : str The filename of the generated configuration item. """ from ..utils import find_current_module if pkgornm is None: pkgornm = find_current_module(1).__name__.split('.')[0] if isinstance(pkgornm, six.string_types): package = pkgutil.get_loader(pkgornm).load_module(pkgornm) elif (isinstance(pkgornm, types.ModuleType) and '__init__' in pkgornm.__file__): package = pkgornm else: msg = 'generate_all_config_items was not given a package/package name' raise TypeError(msg) if hasattr(package, '__path__'): pkgpath = package.__path__ elif hasattr(package, '__file__'): pkgpath = path.split(package.__file__)[0] else: raise AttributeError('package to generate config items for does not ' 'have __file__ or __path__') prefix = package.__name__ + '.' for imper, nm, ispkg in pkgutil.walk_packages(pkgpath, prefix): if nm == 'astropy.config.tests.test_configs': continue if not _unsafe_import_regex.match(nm): imper.find_module(nm) if reset_to_default: for cfgitem in six.itervalues(get_config_items(nm)): cfgitem.set(cfgitem.defaultvalue) _fix_section_blank_lines(package.__name__, True, True) save_config(package.__name__, filename=filename) if filename is None: return get_config(package.__name__).filename else: return filename # this is not in __all__ because it's not intended that a user uses it def update_default_config(pkg, default_cfg_dir_or_fn): """ Checks if the configuration file for the specified package exists, and if not, copy over the default configuration. Parameters ---------- pkg : str The package to be updated. default_cfg_dir_or_fn : str The filename or directory name where the default configuration file is. If a directory name, `pkg`.cfg will be used in that directory. Returns ------- updated : bool If the profile needed to be updated, True, otherwise False. Raises ------ ConfigurationDefaultMissingError If the default configuration could not be found. """ cfgfn = get_config(pkg).filename if path.exists(cfgfn): with open(cfgfn) as f: doupdate = f.read() == '' else: doupdate = True if doupdate: if path.isdir(default_cfg_dir_or_fn): default_cfgfn = path.join(default_cfg_dir_or_fn, pkg + '.cfg') else: default_cfgfn = default_cfg_dir_or_fn if not path.isfile(default_cfgfn): raise ConfigurationDefaultMissingError( 'Requested default configuration file {0} is ' 'not a file.'.format(default_cfgfn)) with open(cfgfn, 'w') as fw: with open(default_cfgfn) as fr: fw.write(fr.read()) return True else: return False astropy-0.3/astropy/setup_helpers.py0000644000175000017500000016543612243255342016153 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains a number of utilities for use during setup/build/packaging that are useful to astropy as a whole. """ from __future__ import absolute_import, print_function import collections import errno import imp import inspect import os import re import shlex import shutil import subprocess import sys import textwrap import warnings from distutils import log, ccompiler, sysconfig from distutils.cmd import DistutilsOptionError from distutils.dist import Distribution from distutils.errors import DistutilsError, DistutilsFileError from distutils.core import Extension from distutils.core import Command from distutils.command.sdist import sdist as DistutilsSdist from setuptools.command.build_ext import build_ext as SetuptoolsBuildExt from setuptools.command.build_py import build_py as SetuptoolsBuildPy from setuptools.command.register import register as SetuptoolsRegister from setuptools import find_packages from .tests.helper import astropy_test from .utils import silence from .utils.compat.misc import invalidate_caches from .utils.misc import walk_skip_hidden from .utils.exceptions import AstropyDeprecationWarning try: import Cython HAVE_CYTHON = True except ImportError: HAVE_CYTHON = False try: import sphinx from sphinx.setup_command import BuildDoc as SphinxBuildDoc HAVE_SPHINX = True except ImportError: HAVE_SPHINX = False except SyntaxError: # occurs if markupsafe is recent version, which doesn't support Python 3.2 HAVE_SPHINX = False PY3 = sys.version_info[0] >= 3 # This adds a new keyword to the setup() function Distribution.skip_2to3 = [] _adjusted_compiler = False def adjust_compiler(package): """ This function detects broken compilers and switches to another. If the environment variable CC is explicitly set, or a compiler is specified on the commandline, no override is performed -- the purpose here is to only override a default compiler. The specific compilers with problems are: * The default compiler in XCode-4.2, llvm-gcc-4.2, segfaults when compiling wcslib. The set of broken compilers can be updated by changing the compiler_mapping variable. It is a list of 2-tuples where the first in the pair is a regular expression matching the version of the broken compiler, and the second is the compiler to change to. """ compiler_mapping = [ (b'i686-apple-darwin[0-9]*-llvm-gcc-4.2', 'clang') ] global _adjusted_compiler if _adjusted_compiler: return # Whatever the result of this function is, it only needs to be run once _adjusted_compiler = True if 'CC' in os.environ: # Check that CC is not set to llvm-gcc-4.2 c_compiler = os.environ['CC'] try: version = get_compiler_version(c_compiler) except OSError: msg = textwrap.dedent( """ The C compiler set by the CC environment variable: {compiler:s} cannot be found or executed. """.format(compiler=c_compiler)) log.warn(msg) sys.exit(1) for broken, fixed in compiler_mapping: if re.match(broken, version): msg = textwrap.dedent( """Compiler specified by CC environment variable ({compiler:s}:{version:s}) will fail to compile {pkg:s}. Please set CC={fixed:s} and try again. You can do this, for example, by running: CC={fixed:s} python setup.py where is the command you ran. """.format(compiler=c_compiler, version=version, pkg=package, fixed=fixed)) log.warn(msg) sys.exit(1) # If C compiler is set via CC, and isn't broken, we are good to go. We # should definitely not try accessing the compiler specified by # ``sysconfig.get_config_var('CC')`` lower down, because this may fail # if the compiler used to compile Python is missing (and maybe this is # why the user is setting CC). For example, the official Python 2.7.3 # MacOS X binary was compled with gcc-4.2, which is no longer available # in XCode 4. return if get_distutils_build_option('compiler'): return compiler_type = ccompiler.get_default_compiler() if compiler_type == 'unix': # We have to get the compiler this way, as this is the one that is # used if os.environ['CC'] is not set. It is actually read in from # the Python Makefile. Note that this is not necessarily the same # compiler as returned by ccompiler.new_compiler() c_compiler = sysconfig.get_config_var('CC') try: version = get_compiler_version(c_compiler) except OSError: msg = textwrap.dedent( """ The C compiler used to compile Python {compiler:s}, and which is normally used to compile C extensions, is not available. You can explicitly specify which compiler to use by setting the CC environment variable, for example: CC=gcc python setup.py or if you are using MacOS X, you can try: CC=clang python setup.py """.format(compiler=c_compiler)) log.warn(msg) sys.exit(1) for broken, fixed in compiler_mapping: if re.match(broken, version): os.environ['CC'] = fixed break def get_compiler_version(compiler): process = subprocess.Popen( shlex.split(compiler) + ['--version'], stdout=subprocess.PIPE) output = process.communicate()[0].strip() try: version = output.split()[0] except IndexError: return 'unknown' return version def get_dummy_distribution(): """Returns a distutils Distribution object used to instrument the setup environment before calling the actual setup() function. """ global _registered_commands if _registered_commands is None: raise RuntimeError('astropy.setup_helpers.register_commands() must be ' 'called before using ' 'astropy.setup_helpers.get_dummy_distribution()') # Pre-parse the Distutils command-line options and config files to if # the option is set. dist = Distribution({'script_name': os.path.basename(sys.argv[0]), 'script_args': sys.argv[1:]}) dist.cmdclass.update(_registered_commands) with silence(): try: dist.parse_config_files() dist.parse_command_line() except (DistutilsError, AttributeError, SystemExit): # Let distutils handle DistutilsErrors itself AttributeErrors can # get raise for ./setup.py --help SystemExit can be raised if a # display option was used, for example pass return dist def get_distutils_option(option, commands): """ Returns the value of the given distutils option. Parameters ---------- option : str The name of the option commands : list of str The list of commands on which this option is available Returns ------- val : str or None the value of the given distutils option. If the option is not set, returns None. """ dist = get_dummy_distribution() for cmd in commands: cmd_opts = dist.command_options.get(cmd) if cmd_opts is not None and option in cmd_opts: return cmd_opts[option][1] else: return None def get_distutils_build_option(option): """ Returns the value of the given distutils build option. Parameters ---------- option : str The name of the option Returns ------- val : str or None The value of the given distutils build option. If the option is not set, returns None. """ return get_distutils_option(option, ['build', 'build_ext', 'build_clib']) def get_distutils_install_option(option): """ Returns the value of the given distutils install option. Parameters ---------- option : str The name of the option Returns ------- val : str or None The value of the given distutils build option. If the option is not set, returns None. """ return get_distutils_option(option, ['install']) def get_distutils_build_or_install_option(option): """ Returns the value of the given distutils build or install option. Parameters ---------- option : str The name of the option Returns ------- val : str or None The value of the given distutils build or install option. If the option is not set, returns None. """ return get_distutils_option(option, ['build', 'build_ext', 'build_clib', 'install']) def get_compiler_option(): """ Determines the compiler that will be used to build extension modules. Returns ------- compiler : str The compiler option specificied for the build, build_ext, or build_clib command; or the default compiler for the platform if none was specified. """ compiler = get_distutils_build_option('compiler') if compiler is None: return ccompiler.get_default_compiler() return compiler def get_debug_option(): """ Determines if the build is in debug mode. Returns ------- debug : bool True if the current build was started with the debug option, False otherwise. """ try: from .version import debug as current_debug except ImportError: current_debug = None # Only modify the debug flag if one of the build commands was explicitly # run (i.e. not as a sub-command of something else) dist = get_dummy_distribution() if any(cmd in dist.commands for cmd in ['build', 'build_ext']): debug = bool(get_distutils_build_option('debug')) else: debug = bool(current_debug) if current_debug is not None and current_debug != debug: build_ext_cmd = dist.get_command_class('build_ext') build_ext_cmd.force_rebuild = True return debug _registered_commands = None def register_commands(package, version, release): global _registered_commands if _registered_commands is not None: return _registered_commands _registered_commands = { 'test': generate_test_command(package), # Use distutils' sdist because it respects package_data. # setuptools/distributes sdist requires duplication of information in # MANIFEST.in 'sdist': DistutilsSdist, # The exact form of the build_ext command depends on whether or not # we're building a release version 'build_ext': generate_build_ext_command(package, release), # We have a custom build_py to generate the default configuration file 'build_py': AstropyBuildPy, 'register': AstropyRegister } try: import bdist_mpkg except ImportError: pass else: # Use a custom command to build a dmg (on MacOS X) _registered_commands['bdist_dmg'] = bdist_dmg if HAVE_SPHINX: _registered_commands['build_sphinx'] = AstropyBuildSphinx else: _registered_commands['build_sphinx'] = FakeBuildSphinx # Need to override the __name__ here so that the commandline options are # presented as being related to the "build" command, for example; normally # this wouldn't be necessary since commands also have a command_name # attribute, but there is a bug in distutils' help display code that it # uses __name__ instead of command_name. Yay distutils! for name, cls in _registered_commands.items(): cls.__name__ = name # Add a few custom options; more of these can be added by specific packages # later for option in [ ('use-system-libraries', "Use system libraries whenever possible", True)]: add_command_option('build', *option) add_command_option('install', *option) return _registered_commands def generate_test_command(package_name): return type(package_name + '_test_command', (astropy_test,), {'package_name': package_name}) def generate_build_ext_command(packagename, release): """ Creates a custom 'build_ext' command that allows for manipulating some of the C extension options at build time. We use a function to build the class since the base class for build_ext may be different depending on certain build-time parameters (for example, we may use Cython's build_ext instead of the default version in distutils). Uses the default distutils.command.build_ext by default. """ uses_cython = should_build_with_cython(packagename, release) if uses_cython: from Cython.Distutils import build_ext as basecls else: basecls = SetuptoolsBuildExt attrs = dict(basecls.__dict__) orig_run = getattr(basecls, 'run', None) orig_finalize = getattr(basecls, 'finalize_options', None) def finalize_options(self): if orig_finalize is not None: orig_finalize(self) # Generate if self.uses_cython: try: from Cython import __version__ as cython_version except ImportError: # This shouldn't happen if we made it this far cython_version = None if (cython_version is not None and cython_version != self.uses_cython): self.force_rebuild = True # Update the used cython version self.uses_cython = cython_version # Regardless of the value of the '--force' option, force a rebuild if # the debug flag changed from the last build if self.force_rebuild: self.force = True def run(self): # For extensions that require 'numpy' in their include dirs, replace # 'numpy' with the actual paths np_include = get_numpy_include_path() for extension in self.extensions: if 'numpy' in extension.include_dirs: idx = extension.include_dirs.index('numpy') extension.include_dirs.insert(idx, np_include) extension.include_dirs.remove('numpy') # Replace .pyx with C-equivalents, unless c files are missing for jdx, src in enumerate(extension.sources): if src.endswith('.pyx'): pyxfn = src cfn = src[:-4] + '.c' elif src.endswith('.c'): pyxfn = src[:-2] + '.pyx' cfn = src if os.path.isfile(pyxfn): if self.uses_cython: extension.sources[jdx] = pyxfn else: if os.path.isfile(cfn): extension.sources[jdx] = cfn else: msg = ( 'Could not find C file {0} for Cython file ' '{1} when building extension {2}. ' 'Cython must be installed to build from a ' 'git checkout'.format(cfn, pyxfn, extension.name)) raise IOError(errno.ENOENT, msg, cfn) if orig_run is not None: # This should always be the case for a correctly implemented # distutils command. orig_run(self) # Update cython_version.py if building with Cython try: from .version import cython_version except ImportError: cython_version = 'unknown' if self.uses_cython and self.uses_cython != cython_version: package_dir = os.path.relpath(packagename) cython_py = os.path.join(package_dir, 'cython_version.py') with open(cython_py, 'w') as f: f.write('# Generated file; do not modify\n') f.write('cython_version = {0!r}\n'.format(self.uses_cython)) if os.path.isdir(self.build_lib): # The build/lib directory may not exist if the build_py command # was not previously run, which may sometimes be the case self.copy_file(cython_py, os.path.join(self.build_lib, cython_py), preserve_mode=False) invalidate_caches() if not self.distribution.is_pure() and os.path.isdir(self.build_lib): # Finally, generate the default astropy.cfg; this can only be done # after extension modules are built as some extension modules # include config items. We only do this if it's not pure python, # though, because if it is, we already did it in build_py default_cfg = generate_default_config( os.path.abspath(self.build_lib), self.distribution.packages[0]) if default_cfg: default_cfg = os.path.relpath(default_cfg) self.copy_file(default_cfg, os.path.join(self.build_lib, default_cfg), preserve_mode=False) attrs['run'] = run attrs['finalize_options'] = finalize_options attrs['force_rebuild'] = False attrs['uses_cython'] = uses_cython return type('build_ext', (basecls, object), attrs) class AstropyBuildPy(SetuptoolsBuildPy): def finalize_options(self): # Update build_lib settings from the build command to always put # build files in platform-specific subdirectories of build/, even # for projects with only pure-Python source (this is desirable # specifically for support of multiple Python version). build_cmd = self.get_finalized_command('build') plat_specifier = '.{0}-{1}'.format(build_cmd.plat_name, sys.version[0:3]) # Do this unconditionally build_purelib = os.path.join(build_cmd.build_base, 'lib' + plat_specifier) build_cmd.build_purelib = build_purelib build_cmd.build_lib = build_purelib # Ugly hack: We also need to 'fix' the build_lib option on the # install command--it would be better just to override that command # entirely, but we can get around that extra effort by doing it here install_cmd = self.get_finalized_command('install') install_cmd.build_lib = build_purelib install_lib_cmd = self.get_finalized_command('install_lib') install_lib_cmd.build_dir = build_purelib self.build_lib = build_purelib SetuptoolsBuildPy.finalize_options(self) def run_2to3(self, files, doctests=False): # Filter the files to exclude things that shouldn't be 2to3'd skip_2to3 = self.distribution.skip_2to3 filtered_files = [] for file in files: for package in skip_2to3: if file[len(self.build_lib) + 1:].startswith(package): break else: filtered_files.append(file) SetuptoolsBuildPy.run_2to3(self, filtered_files, doctests) def run(self): # first run the normal build_py SetuptoolsBuildPy.run(self) if self.distribution.is_pure(): # Generate the default astropy.cfg - we only do this here if it's # pure python. Otherwise, it'll happen at the end of build_exp default_cfg = generate_default_config( os.path.abspath(self.build_lib), self.distribution.packages[0]) if default_cfg: default_cfg = os.path.relpath(default_cfg) self.copy_file(default_cfg, os.path.join(self.build_lib, default_cfg), preserve_mode=False) def generate_default_config(build_lib, package): config_path = os.path.relpath(package) filename = os.path.join(config_path, package + '.cfg') if os.path.exists(filename): log.info('regenerating default {0}.cfg file'.format(package)) else: log.info('generating default {0}.cfg file'.format(package)) if PY3: builtins = 'builtins' else: builtins = '__builtin__' # astropy may have been built with a numpy that setuptools # downloaded and installed into the current directory for us. # Therefore, we need to extend the sys.path of the subprocess # that's generating the config file, with the sys.path of this # process. subproccode = ( 'import sys; sys.path.extend({paths!r});' 'import {builtins};{builtins}._ASTROPY_SETUP_ = True;' 'from astropy.config.configuration import generate_all_config_items;' 'generate_all_config_items({pkgnm!r}, True, filename={filenm!r})') subproccode = subproccode.format(builtins=builtins, pkgnm=package, filenm=os.path.abspath(filename), paths=sys.path) # Note that cwd=build_lib--we're importing astropy from the build/ dir # but using the astropy/ source dir as the config directory proc = subprocess.Popen([sys.executable, '-c', subproccode], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=build_lib) stdout, stderr = proc.communicate() if proc.returncode == 0 and os.path.exists(filename): return filename else: msg = ('Generation of default configuration item failed! Stdout ' 'and stderr are shown below.\n' 'Stdout:\n{stdout}\nStderr:\n{stderr}') if isinstance(msg, bytes): msg = msg.decode('UTF-8') log.error(msg.format(stdout=stdout.decode('UTF-8'), stderr=stderr.decode('UTF-8'))) def add_command_option(command, name, doc, is_bool=False): """ Add a custom option to a setup command. Issues a warning if the option already exists on that command. Parameters ---------- command : str The name of the command as given on the command line name : str The name of the build option doc : str A short description of the option, for the `--help` message is_bool : bool, optional When `True`, the option is a boolean option and doesn't require an associated value. """ dist = get_dummy_distribution() cmdcls = dist.get_command_class(command) attr = name.replace('-', '_') if hasattr(cmdcls, attr): raise RuntimeError( '{0!r} already has a {1!r} class attribute, barring {2!r} from ' 'being usable as a custom option name.'.format(cmdcls, attr, name)) for idx, cmd in enumerate(cmdcls.user_options): if cmd[0] == name: log.warning('Overriding existing {0!r} option ' '{1!r}'.format(command, name)) del cmdcls.user_options[idx] if name in cmdcls.boolean_options: cmdcls.boolean_options.remove(name) break cmdcls.user_options.append((name, None, doc)) if is_bool: cmdcls.boolean_options.append(name) # Distutils' command parsing requires that a command object have an # attribute with the same name as the option (with '-' replaced with '_') # in order for that option to be recognized as valid setattr(cmdcls, attr, None) class AstropyRegister(SetuptoolsRegister): """Extends the built in 'register' command to support a ``--hidden`` option to make the registered version hidden on PyPI by default. The result of this is that when a version is registered as "hidden" it can still be downloaded from PyPI, but it does not show up in the list of actively supported versions under http://pypi.python.org/pypi/astropy, and is not set as the most recent version. Although this can always be set through the web interface it may be more convenient to be able to specify via the 'register' command. Hidden may also be considered a safer default when running the 'register' command, though this command uses distutils' normal behavior if the ``--hidden`` option is omitted. """ user_options = SetuptoolsRegister.user_options + [ ('hidden', None, 'mark this release as hidden on PyPI by default') ] boolean_options = SetuptoolsRegister.boolean_options + ['hidden'] def initialize_options(self): SetuptoolsRegister.initialize_options(self) self.hidden = False def build_post_data(self, action): data = SetuptoolsRegister.build_post_data(self, action) if action == 'submit' and self.hidden: data['_pypi_hidden'] = '1' return data def _set_config(self): # The original register command is buggy--if you use .pypirc with a # server-login section *at all* the repository you specify with the -r # option will be overwritten with either the repository in .pypirc or # with the default, # If you do not have a .pypirc using the -r option will just crash. # Way to go distutils # If we don't set self.repository back to a default value _set_config # can crash if there was a user-supplied value for this option; don't # worry, we'll get the real value back afterwards self.repository = 'pypi' SetuptoolsRegister._set_config(self) options = self.distribution.get_option_dict('register') if 'repository' in options: source, value = options['repository'] # Really anything that came from setup.cfg or the command line # should override whatever was in .pypirc self.repository = value if HAVE_SPHINX: class AstropyBuildSphinx(SphinxBuildDoc): """ A version of the ``build_sphinx`` command that uses the version of Astropy that is built by the setup ``build`` command, rather than whatever is installed on the system - to build docs against the installed version, run ``make html`` in the ``astropy/docs`` directory. This also automatically creates the docs/_static directories - this is needed because github won't create the _static dir because it has no tracked files. """ description = 'Build Sphinx documentation for Astropy environment' user_options = SphinxBuildDoc.user_options[:] user_options.append(('warnings-returncode', 'w', 'Parses the sphinx output and sets the return ' 'code to 1 if there are any warnings. Note that ' 'this will cause the sphinx log to only update ' 'when it completes, rather than continuously as ' 'is normally the case.')) user_options.append(('clean-docs', 'l', 'Completely clean previous builds, including ' 'automodapi-generated files before building new ' 'ones')) user_options.append(('no-intersphinx', 'n', 'Skip intersphinx, even if conf.py says to use ' 'it')) user_options.append(('open-docs-in-browser', 'o', 'Open the docs in a browser (using the ' 'webbrowser module) if the build finishes ' 'successfully.')) boolean_options = SphinxBuildDoc.boolean_options[:] boolean_options.append('warnings-returncode') boolean_options.append('clean-docs') boolean_options.append('no-intersphinx') boolean_options.append('open-docs-in-browser') _self_iden_rex = re.compile(r"self\.([^\d\W][\w]+)", re.UNICODE) def initialize_options(self): SphinxBuildDoc.initialize_options(self) self.clean_docs = False self.no_intersphinx = False self.open_docs_in_browser = False self.warnings_returncode = False def finalize_options(self): #Clear out previous sphinx builds, if requested if self.clean_docs: dirstorm = ['docs/api'] if self.build_dir is None: dirstorm.append('docs/_build') else: dirstorm.append(self.build_dir) for d in dirstorm: if os.path.isdir(d): log.info('Cleaning directory ' + d) shutil.rmtree(d) else: log.info('Not cleaning directory ' + d + ' because ' 'not present or not a directory') SphinxBuildDoc.finalize_options(self) def run(self): import webbrowser if PY3: from urllib.request import pathname2url else: from urllib import pathname2url # This is used at the very end of `run` to decide if sys.exit should # be called. If it's None, it won't be. retcode = None # If possible, create the _static dir if self.build_dir is not None: # the _static dir should be in the same place as the _build dir # for Astropy basedir, subdir = os.path.split(self.build_dir) if subdir == '': # the path has a trailing /... basedir, subdir = os.path.split(basedir) staticdir = os.path.join(basedir, '_static') if os.path.isfile(staticdir): raise DistutilsOptionError( 'Attempted to build_sphinx in a location where' + staticdir + 'is a file. Must be a directory.') self.mkpath(staticdir) #Now make sure Astropy is built and determine where it was built build_cmd = self.reinitialize_command('build') build_cmd.inplace = 0 self.run_command('build') build_cmd = self.get_finalized_command('build') build_cmd_path = os.path.abspath(build_cmd.build_lib) #Now generate the source for and spawn a new process that runs the #command. This is needed to get the correct imports for the built #version runlines, runlineno = inspect.getsourcelines(SphinxBuildDoc.run) subproccode = textwrap.dedent(""" from sphinx.setup_command import * os.chdir({srcdir!r}) sys.path.insert(0, {build_cmd_path!r}) """).format(build_cmd_path=build_cmd_path, srcdir=self.source_dir) #runlines[1:] removes 'def run(self)' on the first line subproccode += textwrap.dedent(''.join(runlines[1:])) # All "self.foo" in the subprocess code needs to be replaced by the # values taken from the current self in *this* process subproccode = AstropyBuildSphinx._self_iden_rex.split(subproccode) for i in range(1, len(subproccode), 2): iden = subproccode[i] val = getattr(self, iden) if iden.endswith('_dir'): #Directories should be absolute, because the `chdir` call #in the new process moves to a different directory subproccode[i] = repr(os.path.abspath(val)) else: subproccode[i] = repr(val) subproccode = ''.join(subproccode) if self.no_intersphinx: #the confoverrides variable in sphinx.setup_command.BuildDoc can #be used to override the conf.py ... but this could well break #if future versions of sphinx change the internals of BuildDoc, #so remain vigilant! subproccode = subproccode.replace('confoverrides = {}', 'confoverrides = {\'intersphinx_mapping\':{}}') log.debug('Starting subprocess of {0} with python code:\n{1}\n' '[CODE END])'.format(sys.executable, subproccode)) # To return the number of warnings, we need to capture stdout. This # prevents a continuous updating at the terminal, but there's no # apparent way around this. if self.warnings_returncode: proc = subprocess.Popen([sys.executable], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdo, stde = proc.communicate(subproccode) print(stdo) stdolines = stdo.split('\n') if stdolines[-2] == 'build succeeded.': retcode = 0 else: retcode = 1 if retcode != 0: if os.environ.get('TRAVIS', None) == 'true': #this means we are in the travis build, so customize #the message appropriately. msg = ('The build_sphinx travis build FAILED ' 'because sphinx issued documentation ' 'warnings (scroll up to see the warnings).') else: # standard failure message msg = ('build_sphinx returning a non-zero exit ' 'code because sphinx issued documentation ' 'warnings.') log.warn(msg) else: proc = subprocess.Popen([sys.executable], stdin=subprocess.PIPE) proc.communicate(subproccode.encode('utf-8')) if proc.returncode == 0: if self.open_docs_in_browser: if self.builder == 'html': absdir = os.path.abspath(self.builder_target_dir) index_path = os.path.join(absdir, 'index.html') fileurl = 'file://' + pathname2url(index_path) webbrowser.open(fileurl) else: log.warn('open-docs-in-browser option was given, but ' 'the builder is not html! Ignogring.') else: log.warn('Sphinx Documentation subprocess failed with return ' 'code ' + str(proc.returncode)) if retcode is not None: # this is potentially dangerous in that there might be something # after the call to `setup` in `setup.py`, and exiting here will # prevent that from running. But there's no other apparent way # to signal what the return code should be. sys.exit(retcode) def get_distutils_display_options(): """ Returns a set of all the distutils display options in their long and short forms. These are the setup.py arguments such as --name or --version which print the project's metadata and then exit. Returns ------- opts : set The long and short form display option arguments, including the - or -- """ short_display_opts = set('-' + o[1] for o in Distribution.display_options if o[1]) long_display_opts = set('--' + o[0] for o in Distribution.display_options) # Include -h and --help which are not explicitly listed in # Distribution.display_options (as they are handled by optparse) short_display_opts.add('-h') long_display_opts.add('--help') # This isn't the greatest approach to hardcode these commands. # However, there doesn't seem to be a good way to determine # whether build *will be* run as part of the command at this # phase. display_commands = set([ 'clean', 'register', 'setopt', 'saveopts', 'egg_info', 'alias']) return short_display_opts.union(long_display_opts.union(display_commands)) def is_distutils_display_option(): """ Returns True if sys.argv contains any of the distutils display options such as --version or --name. """ display_options = get_distutils_display_options() return bool(set(sys.argv[1:]).intersection(display_options)) def update_package_files(srcdir, extensions, package_data, packagenames, package_dirs): """ This function is deprecated and maintained for backward compatibility with affiliated packages. Affiliated packages should update their setup.py to use `get_package_info` instead. """ warnings.warn( "astropy.setup_helpers.update_package_files is deprecated. Update " "your setup.py to use astropy.setup_helpers.get_package_info instead.", AstropyDeprecationWarning) info = get_package_info(srcdir) extensions.extend(info['ext_modules']) package_data.update(info['package_data']) packagenames = list(set(packagenames + info['packages'])) package_dirs.update(info['package_dir']) def get_package_info(srcdir): """ Collates all of the information for building all subpackages subpackages and returns a dictionary of keyword arguments that can be passed directly to `distutils.setup`. The purpose of this function is to allow subpackages to update the arguments to the package's ``setup()`` function in its setup.py script, rather than having to specify all extensions/package data directly in the ``setup.py``. See Astropy's own ``setup.py`` for example usage and the Astropy development docs for more details. This function obtains that information by iterating through all packages in ``srcdir`` and locating a ``setup_package.py`` module. This module can contain the following functions: ``get_extensions()``, ``get_package_data()``, ``get_build_options()``, ``get_external_libraries()``, and ``requires_2to3()``. Each of those functions take no arguments. - ``get_extensions`` returns a list of `distutils.extension.Extension` objects. - ``get_package_data()`` returns a dict formatted as required by the ``package_data`` argument to ``setup()``. - ``get_build_options()`` returns a list of tuples describing the extra build options to add. - ``get_external_libraries()`` returns a list of libraries that can optionally be built using external dependencies. - ``requires_2to3()`` should return `True` when the source code requires `2to3` processing to run on Python 3.x. If ``requires_2to3()`` is missing, it is assumed to return `True`. """ ext_modules = [] packages = [] package_data = {} package_dir = {} skip_2to3 = [] # Use the find_packages tool to locate all packages and modules packages = filter_packages(find_packages()) # For each of the setup_package.py modules, extract any # information that is needed to install them. The build options # are extracted first, so that their values will be available in # subsequent calls to `get_extensions`, etc. for setuppkg in iter_setup_packages(srcdir): if hasattr(setuppkg, 'get_build_options'): options = setuppkg.get_build_options() for option in options: add_command_option('build', *option) if hasattr(setuppkg, 'get_external_libraries'): libraries = setuppkg.get_external_libraries() for library in libraries: add_external_library(library) if hasattr(setuppkg, 'requires_2to3'): requires_2to3 = setuppkg.requires_2to3() else: requires_2to3 = True if not requires_2to3: skip_2to3.append( os.path.dirname(setuppkg.__file__)) for setuppkg in iter_setup_packages(srcdir): # get_extensions must include any Cython extensions by their .pyx # filename. if hasattr(setuppkg, 'get_extensions'): ext_modules.extend(setuppkg.get_extensions()) if hasattr(setuppkg, 'get_package_data'): package_data.update(setuppkg.get_package_data()) # Locate any .pyx files not already specified, and add their extensions in. # The default include dirs include numpy to facilitate numerical work. ext_modules.extend(get_cython_extensions(srcdir, ext_modules, ['numpy'])) # Now remove extensions that have the special name 'skip_cython', as they # exist Only to indicate that the cython extensions shouldn't be built for i, ext in reversed(list(enumerate(ext_modules))): if ext.name == 'skip_cython': del ext_modules[i] # On Microsoft compilers, we need to pass the '/MANIFEST' # commandline argument. This was the default on MSVC 9.0, but is # now required on MSVC 10.0, but it doesn't seeem to hurt to add # it unconditionally. if get_compiler_option() == 'msvc': for ext in ext_modules: ext.extra_link_args.append('/MANIFEST') return { 'ext_modules': ext_modules, 'packages': packages, 'package_dir': package_dir, 'package_data': package_data, 'skip_2to3': skip_2to3 } def iter_setup_packages(srcdir): """ A generator that finds and imports all of the ``setup_package.py`` modules in the source packages. Returns ------- modgen : generator A generator that yields (modname, mod), where `mod` is the module and `modname` is the module name for the ``setup_package.py`` modules. """ for root, dirs, files in walk_skip_hidden(srcdir): if 'setup_package.py' in files: filename = os.path.join(root, 'setup_package.py') module = import_file(filename) yield module def iter_pyx_files(srcdir): """ A generator that yields Cython source files (ending in '.pyx') in the source packages. Returns ------- pyxgen : generator A generator that yields (extmod, fullfn) where `extmod` is the full name of the module that the .pyx file would live in based on the source directory structure, and `fullfn` is the path to the .pyx file. """ for dirpath, dirnames, filenames in walk_skip_hidden(srcdir): modbase = dirpath.replace(os.sep, '.') for fn in filenames: if fn.endswith('.pyx'): fullfn = os.path.join(dirpath, fn) # Package must match file name extmod = modbase + '.' + fn[:-4] yield (extmod, fullfn) def should_build_with_cython(package, release=None): """Returns the previously used Cython version (or 'unknown' if not previously built) if Cython should be used to build extension modules from pyx files. If the ``release`` parameter is not specified an attempt is made to determine the release flag from `astropy.version`. """ try: version_module = __import__(package + '.cython_version', fromlist=['release', 'cython_version']) except ImportError: version_module = None if release is None and version_module is not None: try: release = version_module.release except AttributeError: pass try: cython_version = version_module.cython_version except AttributeError: cython_version = 'unknown' # Only build with Cython if, of course, Cython is installed, we're in a # development version (i.e. not release) or the Cython-generated source # files haven't been created yet (cython_version == 'unknown'). The latter # case can happen even when release is True if checking out a release tag # from the repository if HAVE_CYTHON and (not release or cython_version == 'unknown'): return cython_version else: return False def get_cython_extensions(srcdir, prevextensions=tuple(), extincludedirs=None): """ Looks for Cython files and generates Extensions if needed. Parameters ---------- srcdir : str Path to the root of the source directory to search. prevextensions : list of `~distutils.core.Extension` objects The extensions that are already defined. Any .pyx files already here will be ignored. extincludedirs : list of str or None Directories to include as the `include_dirs` argument to the generated `~distutils.core.Extension` objects. Returns ------- exts : list of `~distutils.core.Extension` objects The new extensions that are needed to compile all .pyx files (does not include any already in `prevextensions`). """ # Vanilla setuptools and old versions of distribute include Cython files # as .c files in the sources, not .pyx, so we cannot simply look for # existing .pyx sources in the previous sources, but we should also check # for .c files with the same remaining filename. So we look for .pyx and # .c files, and we strip the extension. prevsourcepaths = [] for ext in prevextensions: for s in ext.sources: if s.endswith(('.pyx', '.c')): prevsourcepaths.append(os.path.realpath(os.path.splitext(s)[0])) ext_modules = [] for extmod, pyxfn in iter_pyx_files(srcdir): if os.path.realpath(os.path.splitext(pyxfn)[0]) not in prevsourcepaths: ext_modules.append(Extension(extmod, [pyxfn], include_dirs=extincludedirs)) return ext_modules def write_if_different(filename, data): """ Write `data` to `filename`, if the content of the file is different. Parameters ---------- filename : str The file name to be written to. data : bytes The data to be written to `filename`. """ assert isinstance(data, bytes) if os.path.exists(filename): with open(filename, 'rb') as fd: original_data = fd.read() else: original_data = None if original_data != data: with open(filename, 'wb') as fd: fd.write(data) def get_numpy_include_path(): """ Gets the path to the numpy headers. """ # We need to go through this nonsense in case setuptools # downloaded and installed Numpy for us as part of the build or # install, since Numpy may still think it's in "setup mode", when # in fact we're ready to use it to build astropy now. if sys.version_info[0] >= 3: import builtins if hasattr(builtins, '__NUMPY_SETUP__'): del builtins.__NUMPY_SETUP__ import imp import numpy imp.reload(numpy) else: import __builtin__ if hasattr(__builtin__, '__NUMPY_SETUP__'): del __builtin__.__NUMPY_SETUP__ import numpy reload(numpy) try: numpy_include = numpy.get_include() except AttributeError: numpy_include = numpy.get_numpy_include() return numpy_include def import_file(filename): """ Imports a module from a single file as if it doesn't belong to a particular package. """ # Specifying a traditional dot-separated fully qualified name here # results in a number of "Parent module 'astropy' not found while # handling absolute import" warnings. Using the same name, the # namespaces of the modules get merged together. So, this # generates an underscore-separated name which is more likely to # be unique, and it doesn't really matter because the name isn't # used directly here anyway. with open(filename, 'U') as fd: name = '_'.join( os.path.relpath(os.path.splitext(filename)[0]).split(os.sep)[1:]) return imp.load_module(name, fd, filename, ('.py', 'U', 1)) class DistutilsExtensionArgs(collections.defaultdict): """ A special dictionary whose default values are the empty list. This is useful for building up a set of arguments for `distutils.Extension` without worrying whether the entry is already present. """ def __init__(self, *args, **kwargs): def default_factory(): return [] super(DistutilsExtensionArgs, self).__init__( default_factory, *args, **kwargs) def update(self, other): for key, val in other.items(): self[key].extend(val) def pkg_config(packages, default_libraries): """ Uses pkg-config to update a set of distutils Extension arguments to include the flags necessary to link against the given packages. If the pkg-config lookup fails, default_libraries is applied to libraries. Parameters ---------- packages : list of str A list of pkg-config packages to look up. default_libraries : list of str A list of library names to use if the pkg-config lookup fails. Returns ------- config : dict A dictionary containing keyword arguments to `distutils.Extension`. These entries include: - ``include_dirs``: A list of include directories - ``library_dirs``: A list of library directories - ``libraries``: A list of libraries - ``define_macros``: A list of macro defines - ``undef_macros``: A list of macros to undefine - ``extra_compile_args``: A list of extra arguments to pass to the compiler """ flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries', '-D': 'define_macros', '-U': 'undef_macros'} command = "pkg-config --libs --cflags {0}".format(' '.join(packages)), result = DistutilsExtensionArgs() try: pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) output = pipe.communicate()[0].strip() except subprocess.CalledProcessError as e: lines = [ "pkg-config failed. This may cause the build to fail below.", " command: {0}".format(e.cmd), " returncode: {0}".format(e.returncode), " output: {0}".format(e.output) ] log.warn('\n'.join(lines)) result['libraries'].extend(default_libraries) else: if pipe.returncode != 0: lines = [ "pkg-config could not lookup up package(s) {0}.".format( ", ".join(packages)), "This may cause the build to fail below." ] log.warn('\n'.join(lines)) result['libraries'].extend(default_libraries) else: for token in output.split(): # It's not clear what encoding the output of # pkg-config will come to us in. It will probably be # some combination of pure ASCII (for the compiler # flags) and the filesystem encoding (for any argument # that includes directories or filenames), but this is # just conjecture, as the pkg-config documentation # doesn't seem to address it. arg = token[:2].decode('ascii') value = token[2:].decode(sys.getfilesystemencoding()) if arg in flag_map: if arg == '-D': value = tuple(value.split('=', 1)) result[flag_map[arg]].append(value) else: result['extra_compile_args'].append(value) return result def add_external_library(library): """ Add a build option for selecting the internal or system copy of a library. Parameters ---------- library : str The name of the library. If the library is `foo`, the build option will be called `--use-system-foo`. """ for command in ['build', 'build_ext', 'install']: add_command_option(command, str('use-system-' + library), 'Use the system {0} library'.format(library), is_bool=True) def use_system_library(library): """ Returns `True` if the build configuration indicates that the given library should use the system copy of the library rather than the internal one. For the given library `foo`, this will be `True` if `--use-system-foo` or `--use-system-libraries` was provided at the commandline or in `setup.cfg`. Parameters ---------- library : str The name of the library Returns ------- use_system : bool `True` if the build should use the system copy of the library. """ return ( get_distutils_build_or_install_option('use_system_{0}'.format(library)) or get_distutils_build_or_install_option('use_system_libraries')) def filter_packages(packagenames): """ Removes some packages from the package list that shouldn't be installed on the current version of Python. """ if PY3: exclude = '_py2' else: exclude = '_py3' return [x for x in packagenames if not x.endswith(exclude)] class bdist_dmg(Command): """ The bdist_dmg command is used to produce the disk image containing the installer, and with a custom background and icon placement. """ user_options = [ ('background=', 'b', "background image to use (should be 500x500px)"), ('dist-dir=', 'd', "directory to put final built distributions in") ] description = "Create a Mac OS X disk image with the package installer" def initialize_options(self): self.dist_dir = None self.background = None self.finalized = False def finalize_options(self): self.set_undefined_options('bdist', ('dist_dir', 'dist_dir')) self.finalized = True def run(self): pkg_dir = os.path.join(self.dist_dir, 'pkg') # Remove directory if it already exists if os.path.exists(pkg_dir): shutil.rmtree(pkg_dir) # First create the package installer with bdist_mpkg mpkg = self.reinitialize_command('bdist_mpkg', reinit_subcommands=1) mpkg.dist_dir = pkg_dir mpkg.ensure_finalized() mpkg.run() # Find the name of the pkg file. Since we removed the dist directory # at the start of the script, our pkg should be the only file there. files = os.listdir(pkg_dir) if len(files) != 1: raise DistutilsFileError( "Expected a single file in the {pkg_dir} " "directory".format(pkg_dir=pkg_dir)) pkg_file = os.path.basename(files[0]) pkg_name = os.path.splitext(pkg_file)[0] # Build the docs docs = self.reinitialize_command('build_sphinx', reinit_subcommands=1) docs.ensure_finalized() docs.run() # Copy over the docs to the dist directory shutil.copytree(os.path.join(docs.build_dir, 'html'), os.path.join(pkg_dir, 'Documentation')) # Copy over the background to the disk image if self.background is not None: background_dir = os.path.join(pkg_dir, '.background') os.mkdir(background_dir) shutil.copy2(self.background, os.path.join(background_dir, 'background.png')) # Start creating the volume dmg_path = os.path.join(self.dist_dir, pkg_name + '.dmg') dmg_path_tmp = os.path.join(self.dist_dir, pkg_name + '_tmp.dmg') volume_name = pkg_name # Remove existing dmg files if os.path.exists(dmg_path): os.remove(dmg_path) if os.path.exists(dmg_path_tmp): os.remove(dmg_path_tmp) # Check if a volume is already mounted volume_path = os.path.join('/', 'Volumes', volume_name) if os.path.exists(volume_path): raise DistutilsFileError( "A volume named {volume_name} is already mounted - please " "eject this and try again".format(volume_name=volume_name)) shell_script = """ # Create DMG file hdiutil create -volname {volume_name} -srcdir {pkg_dir} -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size 24m {dmg_path_tmp} # Mount disk image, and keep reference to device device=$(hdiutil attach -readwrite -noverify -noautoopen {dmg_path_tmp} | egrep '^/dev/' | sed 1q | awk '{{print $1}}') echo ' tell application "Finder" tell disk "{volume_name}" open set current view of container window to icon view set toolbar visible of container window to false set statusbar visible of container window to false set the bounds of container window to {{100, 100, 600, 600}} set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 128 set the background picture of theViewOptions to file ".background:background.png" set position of item "{pkg_file}" of container window to {{125, 320}} set position of item "Documentation" of container window to {{375, 320}} close open update without registering applications delay 5 end tell end tell ' | osascript # Eject disk image hdiutil detach ${{device}} # Convert to final read-only disk image hdiutil convert {dmg_path_tmp} -format UDZO -imagekey zlib-level=9 -o {dmg_path} """.format(volume_name=volume_name, pkg_dir=pkg_dir, pkg_file=pkg_file, dmg_path_tmp=dmg_path_tmp, dmg_path=dmg_path) # Make the disk image with the above shell script os.system(shell_script) # Remove temporary disk image os.remove(dmg_path_tmp) class FakeBuildSphinx(Command): """ A dummy build_sphinx command that is called if Sphinx is not installed and displays a relevant error message """ #user options inherited from sphinx.setup_command.BuildDoc user_options = [ ('fresh-env', 'E', '' ), ('all-files', 'a', ''), ('source-dir=', 's', ''), ('build-dir=', None, ''), ('config-dir=', 'c', ''), ('builder=', 'b', ''), ('project=', None, ''), ('version=', None, ''), ('release=', None, ''), ('today=', None, ''), ('link-index', 'i', ''), ] #user options appended in astropy.setup_helpers.AstropyBuildSphinx user_options.append(('warnings-returncode', 'w','')) user_options.append(('clean-docs', 'l', '')) user_options.append(('no-intersphinx', 'n', '')) user_options.append(('open-docs-in-browser', 'o','')) def initialize_options(self): try: raise RuntimeError("Sphinx must be installed for build_sphinx") except: log.error('error : Sphinx must be installed for build_sphinx') sys.exit(1) astropy-0.3/astropy/coordinates/0000755000175000017500000000000012243263747015222 5ustar oleoleastropy-0.3/astropy/coordinates/tests/0000755000175000017500000000000012243263747016364 5ustar oleoleastropy-0.3/astropy/coordinates/tests/accuracy/0000755000175000017500000000000012243263747020156 5ustar oleoleastropy-0.3/astropy/coordinates/tests/accuracy/__init__.py0000644000175000017500000000015512243255342022260 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) astropy-0.3/astropy/coordinates/tests/accuracy/generate_ref_ast.py0000644000175000017500000002312312243255342024016 0ustar oleole""" This series of functions are used to generate the reference CSV files used by the accuracy tests. Running this as a comand-line script will generate them all. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os import numpy as np from astropy.table import Table, Column def ref_fk4_no_e_fk4(fnout='fk4_no_e_fk4.csv'): """ Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK4 conversion, with arbitrary equinoxes and epoch of observation. """ import starlink.Ast as Ast np.random.seed(12345) N = 200 # Sample uniformly on the unit sphere. These will be either the FK4 # coordinates for the transformation to FK5, or the FK5 coordinates for the # transformation to FK4. ra = np.random.uniform(0., 360., N) dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N))) # Generate random observation epoch and equinoxes obstime = ["B{0:7.2f}".format(x) for x in np.random.uniform(1950., 2000., N)] ra_fk4ne, dec_fk4ne = [], [] ra_fk4, dec_fk4 = [], [] for i in range(N): # Set up frames for AST frame_fk4ne = Ast.SkyFrame('System=FK4-NO-E,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i])) frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox=B1950'.format(epoch=obstime[i])) # FK4 to FK4 (no E-terms) frameset = frame_fk4.convert(frame_fk4ne) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_fk4ne.append(coords[0, 0]) dec_fk4ne.append(coords[1, 0]) # FK4 (no E-terms) to FK4 frameset = frame_fk4ne.convert(frame_fk4) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_fk4.append(coords[0, 0]) dec_fk4.append(coords[1, 0]) # Write out table to a CSV file t = Table() t.add_column(Column(name='obstime', data=obstime)) t.add_column(Column(name='ra_in', data=ra)) t.add_column(Column(name='dec_in', data=dec)) t.add_column(Column(name='ra_fk4ne', data=ra_fk4ne)) t.add_column(Column(name='dec_fk4ne', data=dec_fk4ne)) t.add_column(Column(name='ra_fk4', data=ra_fk4)) t.add_column(Column(name='dec_fk4', data=dec_fk4)) f = open(fnout, 'wb') f.write("# This file was generated with the {0} script, and the reference " "values were computed using AST\n".format(os.path.basename(__file__))) t.write(f, format='ascii', delimiter=',') def ref_fk4_no_e_fk5(fnout='fk4_no_e_fk5.csv'): """ Accuracy tests for the FK4 (with no E-terms of aberration) to/from FK5 conversion, with arbitrary equinoxes and epoch of observation. """ import starlink.Ast as Ast np.random.seed(12345) N = 200 # Sample uniformly on the unit sphere. These will be either the FK4 # coordinates for the transformation to FK5, or the FK5 coordinates for the # transformation to FK4. ra = np.random.uniform(0., 360., N) dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N))) # Generate random observation epoch and equinoxes obstime = ["B{0:7.2f}".format(x) for x in np.random.uniform(1950., 2000., N)] equinox_fk4 = ["B{0:7.2f}".format(x) for x in np.random.uniform(1925., 1975., N)] equinox_fk5 = ["J{0:7.2f}".format(x) for x in np.random.uniform(1975., 2025., N)] ra_fk4, dec_fk4 = [], [] ra_fk5, dec_fk5 = [], [] for i in range(N): # Set up frames for AST frame_fk4 = Ast.SkyFrame('System=FK4-NO-E,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=equinox_fk4[i])) frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=equinox_fk5[i])) # FK4 to FK5 frameset = frame_fk4.convert(frame_fk5) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_fk5.append(coords[0, 0]) dec_fk5.append(coords[1, 0]) # FK5 to FK4 frameset = frame_fk5.convert(frame_fk4) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_fk4.append(coords[0, 0]) dec_fk4.append(coords[1, 0]) # Write out table to a CSV file t = Table() t.add_column(Column(name='equinox_fk4', data=equinox_fk4)) t.add_column(Column(name='equinox_fk5', data=equinox_fk5)) t.add_column(Column(name='obstime', data=obstime)) t.add_column(Column(name='ra_in', data=ra)) t.add_column(Column(name='dec_in', data=dec)) t.add_column(Column(name='ra_fk5', data=ra_fk5)) t.add_column(Column(name='dec_fk5', data=dec_fk5)) t.add_column(Column(name='ra_fk4', data=ra_fk4)) t.add_column(Column(name='dec_fk4', data=dec_fk4)) f = open(fnout, 'wb') f.write("# This file was generated with the {0} script, and the reference " "values were computed using AST\n".format(os.path.basename(__file__))) t.write(f, format='ascii', delimiter=',') def ref_galactic_fk4(fnout='galactic_fk4.csv'): """ Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5 conversion, with arbitrary equinoxes and epoch of observation. """ import starlink.Ast as Ast np.random.seed(12345) N = 200 # Sample uniformly on the unit sphere. These will be either the ICRS # coordinates for the transformation to FK5, or the FK5 coordinates for the # transformation to ICRS. lon = np.random.uniform(0., 360., N) lat = np.degrees(np.arcsin(np.random.uniform(-1., 1., N))) # Generate random observation epoch and equinoxes obstime = ["B{0:7.2f}".format(x) for x in np.random.uniform(1950., 2000., N)] equinox_fk4 = ["J{0:7.2f}".format(x) for x in np.random.uniform(1975., 2025., N)] lon_gal, lat_gal = [], [] ra_fk4, dec_fk4 = [], [] for i in range(N): # Set up frames for AST frame_gal = Ast.SkyFrame('System=Galactic,Epoch={epoch}'.format(epoch=obstime[i])) frame_fk4 = Ast.SkyFrame('System=FK4,Epoch={epoch},Equinox={equinox_fk4}'.format(epoch=obstime[i], equinox_fk4=equinox_fk4[i])) # ICRS to FK5 frameset = frame_gal.convert(frame_fk4) coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]])) ra_fk4.append(coords[0, 0]) dec_fk4.append(coords[1, 0]) # FK5 to ICRS frameset = frame_fk4.convert(frame_gal) coords = np.degrees(frameset.tran([[np.radians(lon[i])], [np.radians(lat[i])]])) lon_gal.append(coords[0, 0]) lat_gal.append(coords[1, 0]) # Write out table to a CSV file t = Table() t.add_column(Column(name='equinox_fk4', data=equinox_fk4)) t.add_column(Column(name='obstime', data=obstime)) t.add_column(Column(name='lon_in', data=lon)) t.add_column(Column(name='lat_in', data=lat)) t.add_column(Column(name='ra_fk4', data=ra_fk4)) t.add_column(Column(name='dec_fk4', data=dec_fk4)) t.add_column(Column(name='lon_gal', data=lon_gal)) t.add_column(Column(name='lat_gal', data=lat_gal)) f = open(fnout, 'wb') f.write("# This file was generated with the {0} script, and the reference " "values were computed using AST\n".format(os.path.basename(__file__))) t.write(f, format='ascii', delimiter=',') def ref_icrs_fk5(fnout='icrs_fk5.csv'): """ Accuracy tests for the ICRS (with no E-terms of aberration) to/from FK5 conversion, with arbitrary equinoxes and epoch of observation. """ import starlink.Ast as Ast np.random.seed(12345) N = 200 # Sample uniformly on the unit sphere. These will be either the ICRS # coordinates for the transformation to FK5, or the FK5 coordinates for the # transformation to ICRS. ra = np.random.uniform(0., 360., N) dec = np.degrees(np.arcsin(np.random.uniform(-1., 1., N))) # Generate random observation epoch and equinoxes obstime = ["B{0:7.2f}".format(x) for x in np.random.uniform(1950., 2000., N)] equinox_fk5 = ["J{0:7.2f}".format(x) for x in np.random.uniform(1975., 2025., N)] ra_icrs, dec_icrs = [], [] ra_fk5, dec_fk5 = [], [] for i in range(N): # Set up frames for AST frame_icrs = Ast.SkyFrame('System=ICRS,Epoch={epoch}'.format(epoch=obstime[i])) frame_fk5 = Ast.SkyFrame('System=FK5,Epoch={epoch},Equinox={equinox_fk5}'.format(epoch=obstime[i], equinox_fk5=equinox_fk5[i])) # ICRS to FK5 frameset = frame_icrs.convert(frame_fk5) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_fk5.append(coords[0, 0]) dec_fk5.append(coords[1, 0]) # FK5 to ICRS frameset = frame_fk5.convert(frame_icrs) coords = np.degrees(frameset.tran([[np.radians(ra[i])], [np.radians(dec[i])]])) ra_icrs.append(coords[0, 0]) dec_icrs.append(coords[1, 0]) # Write out table to a CSV file t = Table() t.add_column(Column(name='equinox_fk5', data=equinox_fk5)) t.add_column(Column(name='obstime', data=obstime)) t.add_column(Column(name='ra_in', data=ra)) t.add_column(Column(name='dec_in', data=dec)) t.add_column(Column(name='ra_fk5', data=ra_fk5)) t.add_column(Column(name='dec_fk5', data=dec_fk5)) t.add_column(Column(name='ra_icrs', data=ra_icrs)) t.add_column(Column(name='dec_icrs', data=dec_icrs)) f = open(fnout, 'wb') f.write("# This file was generated with the {0} script, and the reference " "values were computed using AST\n".format(os.path.basename(__file__))) t.write(f, format='ascii', delimiter=',') if __name__ == '__main__': ref_fk4_no_e_fk4() ref_fk4_no_e_fk5() ref_galactic_fk4() ref_icrs_fk5() astropy-0.3/astropy/coordinates/tests/accuracy/icrs_fk5.csv0000644000175000017500000005047112243255342022377 0ustar oleole# This file was generated with the ref_icrs_fk5.py script, and the reference values were computed using AST equinox_fk5,obstime,ra_in,dec_in,ra_fk5,dec_fk5,ra_icrs,dec_icrs J1998.36,B1995.95,334.661793414,43.9385116594,334.644564717,43.9302620645,334.679023415,43.9467624314 J2021.64,B1954.56,113.895199649,-14.1109832563,114.144749047,-14.1600275394,113.645603942,-14.0624187531 J2020.49,B1953.55,66.2107722038,-7.76265420193,66.4590983513,-7.71687128381,65.9625042534,-7.80888947142 J1981.50,B1970.69,73.6417002791,41.7006137481,73.3167722987,41.6713224382,73.9668646614,41.7293444168 J2001.47,B1960.78,204.381010469,-14.9357743223,204.400749583,-14.9432299686,204.361272512,-14.9283175102 J2005.96,B1975.98,214.396093073,-66.7648451487,214.51622501,-66.7922023737,214.276152292,-66.7374486425 J2006.23,B1977.93,347.225227105,6.27744217753,347.304207997,6.31127500827,347.146246763,6.24361991082 J2007.34,B1973.69,235.143754874,-5.59566003897,235.241093646,-5.61898190462,235.046433786,-5.57228120384 J1991.60,B1960.79,269.606389512,26.7823112195,269.522379939,26.7826702924,269.690399178,26.7820207078 J1980.71,B1961.97,235.285153507,-14.0695156888,235.015999226,-14.0081475332,235.554479961,-14.1304690349 J2003.56,B1960.84,269.177331338,42.9472695107,269.20449399,42.9469939989,269.150168743,42.9475544195 J1990.10,B1982.78,346.070424986,-3.51848810713,345.942775401,-3.57196685618,346.198054805,-3.46497978924 J1984.68,B1992.32,3.01978725896,7.19732176646,2.82298721926,7.11213924582,3.21663102538,7.28248887117 J2003.24,B1996.52,38.3199756112,18.8080489808,38.3653094841,18.8221903901,38.2746486329,18.7938987191 J2005.52,B1990.02,107.533336957,-4.33088623215,107.601845445,-4.34016819794,107.464824543,-4.32163930179 J1977.27,B1984.04,236.30802591,14.3162535375,236.043743614,14.3866995821,236.572362968,14.2462932004 J2024.27,B1960.36,291.532518915,-33.7960784017,291.927410812,-33.7460496092,291.137240582,-33.8452405537 J1980.19,B1987.08,313.983328941,27.7572327639,313.771329108,27.6807919311,314.195342452,27.8339672537 J1995.29,B1984.85,347.273135054,-13.6880685538,347.211387919,-13.7136412695,347.334872743,-13.662489607 J2008.28,B1969.09,260.526724891,-37.6134342267,260.667857852,-37.6209601213,260.385615908,-37.6057963361 J1984.85,B1992.51,231.291118043,-27.2371455509,231.063254934,-27.1842630084,231.519165836,-27.2897662439 J1987.09,B1976.41,258.283303492,-30.1025933842,258.077147166,-30.0878669846,258.489514237,-30.1170665366 J2006.16,B1994.65,168.335642599,-44.084769302,168.407881134,-44.1183592869,168.263437199,-44.0511880472 J2014.94,B1991.03,117.210483914,32.8708634152,117.449614999,32.8326715727,116.971180598,32.9087464534 J2002.23,B1961.43,158.272058119,-29.286471988,158.29805553,-29.2980114305,158.246062428,-29.2749346296 J1984.88,B1991.03,262.688069789,-48.1516431413,262.401200048,-48.1407150038,262.975034556,-48.1621531697 J2014.21,B1956.93,357.845250924,19.2890677934,358.026315201,19.3681291925,357.664269464,19.2100157767 J2015.72,B1974.12,243.674536239,-10.0431678136,243.889881509,-10.0818251308,243.459271586,-10.0042157281 J2010.54,B1957.44,284.696106425,19.6051067047,284.810926274,19.6200552,284.581280582,19.5902719604 J2022.20,B1972.41,61.5291328053,18.6403709997,61.8503393647,18.6989763949,61.2081620218,18.581156754 J2017.75,B1983.30,9.66573928438,-22.9075078717,9.88608757274,-22.8101292831,9.44526590432,-23.0049503113 J2023.18,B1989.45,288.133287813,-36.6947385674,288.521507272,-36.654154333,287.744731719,-36.7344915409 J1998.23,B1983.10,325.340113758,-33.7758802174,325.313691637,-33.783980295,325.366532233,-33.7677775537 J1999.25,B1985.58,8.88343575454,-49.4693354042,8.87458135076,-49.4734614153,8.89228952149,-49.4652094919 J2004.32,B1994.40,177.029034641,-67.7755279684,177.081382811,-67.7995455131,176.976736518,-67.7515115552 J2022.10,B1957.08,189.451860246,-68.7071945134,189.787950236,-68.8284977585,189.117915692,-68.5857730927 J1993.61,B1957.38,214.691763751,-32.6160600699,214.596970957,-32.5867949166,214.786602083,-32.6452917256 J2004.91,B1966.30,18.7047162369,-32.9080620608,18.7619437329,-32.8821737407,18.6474776276,-32.9339591431 J2005.68,B1951.59,322.232230099,14.4669345738,322.300004441,14.4919497078,322.164454374,14.4419423495 J2003.00,B1984.39,262.175824918,51.7319974933,262.193291036,51.7297325887,262.15835963,51.7342674421 J1980.93,B1988.24,294.6060041,34.0181871087,294.426858562,33.9741356521,294.78513452,34.0625403768 J1995.15,B1967.50,180.08019102,26.2892216009,180.018069261,26.3162194666,180.142298341,26.2622237714 J1986.07,B1980.80,291.668187169,-22.2789167174,291.460165406,-22.3074160406,291.876124294,-22.2501557708 J2014.41,B1997.92,34.548669268,-15.8924906144,34.7203476357,-15.826491503,34.3769912557,-15.9586260582 J2013.20,B1964.55,78.8220157436,-37.4332268082,78.9359542832,-37.4190574603,78.7080839461,-37.4475395217 J1983.72,B1984.33,93.1388621771,60.5731416456,92.7698274429,60.5778081354,93.5078078659,60.5678923219 J2011.19,B1952.11,168.518071423,7.09229333513,168.662964922,7.03122231792,168.373145295,7.15333299716 J2021.23,B1953.13,165.374352937,39.3890686842,165.670569356,39.2746286306,165.077550855,39.5033543186 J1998.80,B1990.72,255.423520875,-17.5881075751,255.406106679,-17.5864187707,255.440935444,-17.5897944148 J2020.65,B1971.83,64.0990821181,36.8289797648,64.4412908098,36.8788812849,63.757239339,36.77846091 J1996.87,B1969.60,191.321958369,-52.3532066605,191.277444974,-52.3361209946,191.366491705,-52.3702896721 J1978.29,B1966.53,60.3872023631,25.1025882655,60.0600049106,25.0425615489,60.7146932542,25.1620146503 J1993.19,B1972.88,276.773010626,56.6051138031,276.742873164,56.6006572956,276.803141964,56.6095901107 J1984.47,B1991.77,334.141397682,37.3852087993,333.971320286,37.3074623211,334.311570487,37.4630672642 J1982.42,B1973.34,219.417716878,-20.2290328911,219.169713749,-20.1532857902,219.66593381,-20.3045108915 J1985.55,B1971.06,54.0660580808,-29.3264933861,53.9175360432,-29.3737907652,54.2145819747,-29.2793648485 J2018.98,B1978.54,176.26561333,-0.572718169429,176.5087243,-0.678171194716,176.022494179,-0.467294315659 J2015.89,B1986.95,135.84418338,-9.94938261687,136.036951663,-10.0129567306,135.651382202,-9.88601582693 J2006.58,B1952.75,305.496508312,-8.63421746611,305.585332083,-8.61291748186,305.407668201,-8.65547120765 J2022.76,B1981.21,327.995002307,-58.3471659896,328.394703325,-58.2394830075,327.593625588,-58.4543795694 J1980.95,B1981.05,138.185539617,11.9337947187,137.926465957,12.0126777715,138.444435852,11.854592026 J2005.11,B1950.06,113.578525223,29.6301583121,113.658818144,29.6187548389,113.498216367,29.6415252375 J1991.57,B1980.14,204.621895006,36.5235009134,204.528365616,36.5661830045,204.715395365,36.4808507277 J2016.08,B1952.01,67.6144926088,-13.7094836718,67.8003322803,-13.675528411,67.4286781478,-13.7437074086 J2007.99,B1979.29,45.3029557779,36.4639084123,45.4287375369,36.4951563695,45.1772514486,36.4325910517 J1996.13,B1972.42,247.534489816,-3.23349952461,247.483791774,-3.22525417405,247.585191141,-3.24172726082 J2010.80,B1967.69,287.858418461,26.2825631559,287.968526608,26.3010624761,287.748304904,26.2641738179 J1985.76,B1996.68,206.473163472,-38.4312130715,206.262844929,-38.3601778797,206.683760191,-38.5021184668 J1975.84,B1963.36,350.362793376,-7.51631961926,350.050245875,-7.64886538089,350.675192428,-7.38365103931 J1989.04,B1964.06,228.259575769,40.311002157,228.157788783,40.3516658201,228.36135704,40.2704193663 J2005.09,B1975.25,319.831820932,40.7337792676,319.881302594,40.7554460493,319.782343346,40.712128268 J1998.03,B1982.34,178.349313153,-38.3854710615,178.324338212,-38.3745092745,178.374291779,-38.3964329888 J2010.53,B1998.53,126.58195076,-73.6980337652,126.555725353,-73.7329650434,126.607757619,-73.6630811157 J1983.23,B1951.79,257.122932676,24.0154376566,256.948650568,24.0363842696,257.297226196,23.9947678892 J2022.01,B1971.16,181.414481921,-17.7858263698,181.697561318,-17.9083119018,181.131603746,-17.6633258663 J2022.77,B1979.42,81.2295383474,-9.26450146427,81.5008624611,-9.24547745382,80.9582426792,-9.28411870238 J2024.04,B1986.59,88.1907984871,32.4238226453,88.5837995469,32.4275810011,87.7978296174,32.4191468321 J1977.94,B1958.78,285.408252018,67.7826509035,285.415288738,67.7500149744,285.400733562,67.815271794 J2012.02,B1975.53,178.262069224,51.7327600597,178.418521574,51.6658699581,178.105379001,51.7996446322 J2005.03,B1975.01,329.433722424,-46.8960749035,329.513358137,-46.8719488299,329.354038052,-46.9201811836 J1979.45,B1994.64,340.333860195,36.5560891832,340.099269221,36.4484316911,340.568666175,36.6639044187 J2024.47,B1969.13,191.963602676,21.3572019706,192.265985395,21.2240120738,191.661020584,21.4905409785 J2002.44,B1983.14,90.8973340407,3.44588414281,90.9294194634,3.44566140242,90.8652485585,3.44609927685 J2008.72,B1952.34,259.510340943,47.0512387915,259.570777662,47.0424288828,259.449910071,47.060099055 J2011.24,B1987.56,132.277954966,30.4307232942,132.449103167,30.388553739,132.106687114,30.4727545196 J2003.42,B1968.44,179.513439448,-54.44865752,179.557050535,-54.4676997913,179.469848483,-54.4296153679 J2001.37,B1997.40,81.5670170865,-19.9451944488,81.5818413055,-19.9440843678,81.5521929287,-19.9463064817 J1982.54,B1967.36,127.283632829,-10.0946390302,127.073706282,-10.0359014336,127.493515779,-10.1536599704 J1987.01,B1984.19,234.306643184,-86.4404274379,233.208246223,-86.397666282,235.429405927,-86.482050156 J1995.13,B1991.23,112.65584231,11.2521500479,112.588477624,11.262573342,112.723199816,11.2416973345 J1978.39,B1974.31,276.744760981,21.4151577082,276.514780435,21.4012711846,276.974729777,21.4295237953 J2012.92,B1999.21,281.461357214,-15.511897988,281.646447197,-15.4974841762,281.27623546,-15.5260840726 J1992.13,B1980.19,306.867413859,-11.9467360888,306.759165107,-11.9729853099,306.975635305,-11.9204206469 J2024.49,B1987.98,341.966066455,-2.82477813631,342.281869892,-2.69502407373,341.650132043,-2.95429956154 J2019.43,B1984.23,38.6362483924,9.3322810896,38.8963811972,9.41661462037,38.3762808891,9.24764100258 J2021.93,B1996.62,327.861128148,-46.529254733,328.210157236,-46.4256790337,327.511186361,-46.632434339 J2011.96,B1997.49,120.979858288,87.22617179,122.295667673,87.1912385961,119.633038513,87.2597786682 J1976.35,B1999.51,297.496953653,0.839666332936,297.195644583,0.779185153185,297.798143461,0.9007616283 J1994.12,B1956.31,323.316228643,-0.794522598791,323.240624027,-0.820755621072,323.391823819,-0.768263773348 J1975.53,B1998.83,15.3775095611,-38.7740290611,15.0928652608,-38.9054807438,15.6617662484,-38.6427567079 J1978.26,B1961.46,70.486199672,-24.0682131367,70.2586642967,-24.1088709419,70.7137598878,-24.0280083925 J2009.07,B1959.30,106.020475905,36.6574903487,106.172780811,36.6434848171,105.868125064,36.6713668422 J2024.33,B1975.46,225.719957006,-24.2326924255,226.075567685,-24.326948892,225.364802775,-24.1378344642 J2008.31,B1976.52,31.0403178442,23.2187819108,31.1570536178,23.258394038,30.9236362505,23.1791211798 J1995.76,B1964.13,51.4602071324,-27.0058546166,51.4152973853,-27.0205700299,51.5051169729,-26.991153671 J1977.06,B1965.51,185.697546923,55.594260797,185.421779304,55.721374348,185.972510783,55.4672081659 J2019.71,B1965.49,248.162878677,-23.7609450888,248.460344259,-23.8014906584,247.865592952,-23.7198708623 J2010.34,B1963.32,308.385291884,51.2349043028,308.461574811,51.2706847328,308.308996421,51.1991839517 J1998.94,B1979.67,233.050205996,63.3093356498,233.046004532,63.3128868847,233.05440839,63.3057847603 J1985.78,B1960.86,209.382723191,-41.4659129842,209.166390198,-41.3968581581,209.599369778,-41.5348210618 J1979.09,B1970.12,256.001743835,-16.3448051664,255.700801743,-16.3163460002,256.302789611,-16.3726709454 J2008.66,B1964.43,90.8700685367,21.3678694408,90.9998841203,21.3670776114,90.7402515844,21.3685520416 J2024.74,B1958.69,324.057486054,57.4352750563,324.24791254,57.5469196438,323.867096755,57.3238991167 J2004.68,B1961.29,159.225729446,-45.2472278228,159.276379685,-45.27159791,159.175093005,-45.2228659014 J2017.01,B1999.43,7.38749687642,-53.1540997613,7.58899121668,-53.0602158752,7.18561693871,-53.2480265357 J1982.65,B1971.70,345.477965039,-10.1831007688,345.251295994,-10.2765575516,345.704526845,-10.0895481742 J2018.81,B1991.41,234.801152081,71.8511934075,234.781598949,71.7908263583,234.821698672,71.9115305128 J2002.24,B1978.63,184.754250038,-66.4894904918,184.785352293,-66.5019187594,184.723164704,-66.4770616601 J2024.18,B1982.60,245.64829793,-38.7682176459,246.056856393,-38.8232771335,245.240252475,-38.7122842298 J2011.79,B1986.49,176.234540627,12.5643501076,176.386539261,12.4988499005,176.082498099,12.6298388968 J1979.65,B1969.56,333.536461653,-55.645568776,333.201327008,-55.7468423589,333.870449248,-55.544000369 J1989.61,B1969.64,185.716717981,-21.5568171888,185.58137022,-21.4992561733,185.852126151,-21.6143646005 J1988.65,B1992.98,25.9775574253,12.7249831044,25.8259425625,12.6681381133,26.129235078,12.7817548524 J1978.56,B1990.50,204.302987352,-36.6989586206,203.992013028,-36.590035009,204.614547277,-36.8076153687 J2009.00,B1991.83,221.487546141,22.5689795999,221.589063682,22.531481696,221.386026462,22.6065363227 J1986.24,B1959.40,338.956666009,-30.7135370512,338.763951811,-30.7849831444,339.149190984,-30.6419984779 J2002.57,B1967.98,149.5308077,21.1458572723,149.566540611,21.1335179376,149.495070016,21.1581920836 J2013.49,B1974.10,95.1983908472,-1.61163007915,95.3691226237,-1.61855225484,95.0276507441,-1.6049307767 J1985.59,B1998.30,35.0615395317,-28.6207880841,34.9020739253,-28.6865248849,35.2209739544,-28.5551795263 J1989.64,B1978.17,174.903919876,-25.7547140538,174.773704705,-25.6972724215,175.03419171,-25.8121673429 J1992.82,B1991.38,167.27863063,54.1842744725,167.174390005,54.2232575861,167.382755502,54.1452753419 J2022.82,B1953.81,10.7133541168,-26.6356033619,10.9937676648,-26.5108341533,10.4326984418,-26.7604882278 J2008.01,B1977.66,249.939886269,43.0233288254,250.003422167,43.0080617632,249.876355463,43.0386423389 J2022.53,B1977.40,258.100960451,-37.3838036503,258.483519166,-37.4092478087,257.718621316,-37.3575402646 J1979.84,B1995.27,262.732112385,-19.8057986634,262.43378889,-19.7913038792,263.030493701,-19.8197136836 J1988.23,B1968.47,149.166366188,63.2857703333,148.948549069,63.3419675102,149.383595682,63.2294456404 J1988.61,B1995.06,5.4355841259,0.695799807062,5.28960631728,0.632663567066,5.5815705005,0.758920757926 J2016.75,B1957.03,327.231056694,-11.1377396332,327.455533267,-11.0592260753,327.006447871,-11.2160554034 J2015.64,B1954.96,284.17633852,-71.0631656787,284.622383668,-71.0415076498,283.729510587,-71.08416592 J1989.69,B1998.66,59.4717008987,14.0960045791,59.3272356842,14.0667790018,59.6162113325,14.1251054777 J2007.49,B1997.10,112.602946077,-17.7763932222,112.686574032,-17.7924540137,112.519313748,-17.7603886122 J1996.05,B1979.55,219.940310095,-26.5130440909,219.882677955,-26.4961740042,219.997955886,-26.5298999803 J1978.73,B1952.60,131.216503219,-60.6790709392,131.102499987,-60.6011373948,131.330276761,-60.7571815411 J2011.94,B1952.51,56.1738921125,-19.3427782341,56.3074873507,-19.3058404816,56.0403066499,-19.3798447522 J2004.27,B1966.23,63.8293728328,-59.8347944156,63.8473703919,-59.8243161934,63.8113850715,-59.8452793392 J1992.23,B1968.79,312.440281577,-82.909075449,312.082844158,-82.9381618829,312.795193361,-82.879790561 J1987.90,B1988.21,104.43408064,-66.6447299251,104.430099425,-66.6279457743,104.437942894,-66.6615185415 J1989.59,B1992.96,210.664663673,-17.5831928536,210.521977043,-17.533300504,210.807417956,-17.6330115873 J2013.49,B1977.29,163.438155327,-54.6954182678,163.580861698,-54.7674320028,163.295621486,-54.6234578045 J1996.22,B1966.19,148.024127582,2.32865180198,147.975248991,2.34649291874,148.073002076,2.31080117706 J1989.43,B1970.29,317.748400264,-34.6457182874,317.585582699,-34.6892153211,317.911087895,-34.6021088555 J1988.21,B1955.48,249.374885326,79.5246095403,249.556636954,79.5476344368,249.19427904,79.5013904045 J1988.85,B1956.86,100.53840787,-27.7507223648,100.427671298,-27.7394319384,100.64914055,-27.7621307317 J2017.12,B1987.27,23.1984832267,21.1208388177,23.4324436323,21.2083599648,22.9647269089,21.0331644062 J1983.48,B1993.82,71.5045009532,3.00896662959,71.2883142486,2.97961964121,71.7207379936,3.03798447641 J1987.60,B1962.95,335.405788093,-6.90098238794,335.243429575,-6.9637085665,335.56809315,-6.83817480211 J2004.59,B1984.28,307.588884401,18.8511389183,307.640784808,18.8667407469,307.536982665,18.8355554286 J2023.77,B1967.96,343.704504442,-46.9224252956,344.048269178,-46.7952999698,343.359747105,-47.0493275593 J1975.21,B1950.30,18.8112053675,35.1485289159,18.4626544919,35.0177535414,19.1604681331,35.2790332993 J1987.00,B1988.06,208.609805013,-46.3894275721,208.40705329,-46.3258250272,208.812873725,-46.4529073994 J2011.33,B1970.70,172.978655994,15.4172636989,173.125918709,15.3546485543,172.831339838,15.4798590369 J1987.54,B1966.69,7.8152324312,-34.9365736294,7.662140954,-35.0053080694,7.96821251179,-34.8678643727 J2020.91,B1963.90,134.503366944,-72.4111269318,134.508752259,-72.4927321248,134.496713839,-72.3295304626 J2000.41,B1979.63,149.073048424,14.7065160273,149.078614359,14.7045538676,149.067482395,14.7084780734 J2000.13,B1966.26,217.406604209,16.5186514295,217.408141458,16.5180765377,217.40506696,16.5192263332 J2010.62,B1996.84,241.829541848,16.5114334946,241.950169443,16.4835846733,241.708924453,16.5393920451 J2006.99,B1954.80,301.991652158,46.8228690265,302.04602973,46.8435076393,301.937270072,46.8022617404 J1989.22,B1994.16,280.629434995,-19.0017596678,280.47101531,-19.0127425519,280.787831403,-18.9906136966 J1975.49,B1978.40,144.252375855,-10.2581330338,143.952794662,-10.1475953709,144.551902691,-10.3690875087 J2004.74,B1953.10,286.0305233,12.7464714044,286.085513107,12.7537759609,285.975531683,12.739191194 J2017.05,B1993.75,321.524751743,61.8464645226,321.632828791,61.9208329855,321.416592726,61.7722074849 J1999.33,B1961.24,94.4962887092,-44.0946278203,94.4913067992,-44.0943400421,94.5012706073,-44.0949159215 J2014.04,B1989.97,356.110922656,-39.1892569317,356.295020794,-39.1112673044,355.926608129,-39.2672295394 J1995.63,B1990.09,307.190555646,-43.7191034979,307.116027145,-43.7337921796,307.265056341,-43.7043896052 J1993.99,B1951.45,263.331776174,25.1917278571,263.270410907,25.195633174,263.393142235,25.187858127 J2019.92,B1981.35,128.003624894,58.8666544649,128.402920612,58.7980654005,127.60315064,58.9346336939 J2019.84,B1980.23,317.984216655,-8.89508525523,318.249905253,-8.81284951457,317.718360008,-8.97697809843 J2011.02,B1953.91,312.465272698,5.18400310772,312.602344189,5.22548362633,312.328177207,5.1426308705 J1989.24,B1988.65,344.0759205,-20.8070551085,343.931796087,-20.8646386849,344.219970948,-20.7494301859 J1991.99,B1957.17,0.0386123471053,-42.7336081023,359.935984167,-42.778197083,0.141166805258,-42.6890191696 J1989.26,B1973.18,5.95477509083,23.9728714179,5.81446857607,23.9133953285,6.09515408275,24.0323323244 J2013.98,B1954.86,113.065220613,27.4191705733,113.281430058,27.3885381062,112.848903077,27.4495327526 J1975.23,B1978.49,358.313822853,67.0446512684,358.006936646,66.906817269,358.62239279,67.1825070772 J1979.23,B1970.19,53.5839203362,-15.011852649,53.3428201185,-15.0806959511,53.8250625845,-14.9434009383 J1997.07,B1979.33,60.2557627351,25.6833225299,60.211425166,25.6752201005,60.3001057813,25.6914140019 J1987.55,B1987.44,273.08593329,76.4393919681,273.213340941,76.4355890802,272.958409407,76.443040877 J2020.29,B1994.48,25.0306798156,-51.1202356021,25.2312583612,-51.0179789716,24.8298733815,-51.2226596567 J2019.04,B1968.97,253.970437895,31.094899255,254.152950904,31.0657978691,253.787939628,31.1243251572 J2010.83,B1964.62,168.89950144,-43.2270950714,169.027402777,-43.286276106,168.771701635,-43.167939929 J1986.93,B1975.46,3.66775780511,39.2622225734,3.49661533708,39.1896011422,3.8390874932,39.3348301065 J2021.26,B1976.64,278.936590632,6.21231840756,279.196246371,6.23097561081,278.676905991,6.19419108431 J2023.48,B1955.27,285.91236301,9.40548699672,286.192352454,9.44163731007,285.632321786,9.36995103333 J2003.91,B1952.30,53.8450026285,60.7259893436,53.9264872004,60.7388195386,53.763567111,60.7131341506 J1988.45,B1981.10,8.53330744443,-7.54498028811,8.38660351469,-7.60858303157,8.6800005788,-7.48140196135 J1990.05,B1991.12,274.342957522,-1.24603088049,274.214291508,-1.25015780077,274.471619291,-1.24177991998 J2006.27,B1952.75,80.5212647616,19.4060625392,80.6137303362,19.4117801816,80.4288063349,19.4002893257 J2013.99,B1989.90,94.3827831954,15.0883386826,94.5829613625,15.0822437507,94.1825907513,15.0941622997 J1996.06,B1962.21,164.473020999,-47.6965440186,164.429008903,-47.6754169753,164.51704615,-47.7176755752 J2007.85,B1990.18,89.9736906625,-16.9964263489,90.0609144086,-16.9964467144,89.8864669212,-16.9964725118 J1996.18,B1964.91,204.582082173,15.6789515837,204.535627332,15.698292886,204.628535832,15.6596174499 astropy-0.3/astropy/coordinates/tests/accuracy/test_icrs_fk5.py0000644000175000017500000000315612243255342023271 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import numpy as np from .... import units as u from ... import ICRS, FK5 from ....time import Time from ....table import Table from ...angle_utilities import angular_separation TOLERANCE = 0.03 # arcseconds ROOT = os.path.dirname(os.path.abspath(__file__)) def test_icrs_no_e_fk5(): t = Table.read(os.path.join(ROOT, 'icrs_fk5.csv'), format='ascii') for i in range(len(t)): # Extract row r = t[i] # FK4 to FK5 c1 = ICRS(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc')) c2 = c1.transform_to(FK5).precess_to(Time(r['equinox_fk5'], scale='utc')) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk5']), np.radians(r['dec_fk5'])) assert np.degrees(diff) * 3600. < TOLERANCE # FK5 to FK4 c1 = FK5(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc'), equinox=Time(r['equinox_fk5'], scale='utc')) c2 = c1.transform_to(ICRS) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_icrs']), np.radians(r['dec_icrs'])) assert np.degrees(diff) * 3600. < TOLERANCE astropy-0.3/astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py0000644000175000017500000000324212243255342024011 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy as np from .... import units as u from ... import FK4NoETerms, FK5 from ....time import Time from ....table import Table from ...angle_utilities import angular_separation TOLERANCE = 0.03 # arcseconds ROOT = os.path.dirname(os.path.abspath(__file__)) def test_fk4_no_e_fk5(): t = Table.read(os.path.join(ROOT, 'fk4_no_e_fk5.csv'), format='ascii') for i in range(len(t)): # Extract row r = t[i] # FK4 to FK5 c1 = FK4NoETerms(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc'), equinox=Time(r['equinox_fk4'], scale='utc')) c2 = c1.transform_to(FK5).precess_to(Time(r['equinox_fk5'], scale='utc')) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk5']), np.radians(r['dec_fk5'])) assert np.degrees(diff) * 3600. < TOLERANCE # FK5 to FK4 c1 = FK5(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc'), equinox=Time(r['equinox_fk5'], scale='utc')) c2 = c1.transform_to(FK4NoETerms).precess_to(Time(r['equinox_fk4'], scale='utc')) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk4']), np.radians(r['dec_fk4'])) assert np.degrees(diff) * 3600. < TOLERANCE astropy-0.3/astropy/coordinates/tests/accuracy/fk4_no_e_fk5.csv0000644000175000017500000005410412243255342023120 0ustar oleole# This file was generated with the ref_fk4_no_e_fk5.py script, and the reference values were computed using AST equinox_fk4,equinox_fk5,obstime,ra_in,dec_in,ra_fk5,dec_fk5,ra_fk4,dec_fk4 B1948.36,J1992.59,B1995.95,334.661793414,43.9385116594,335.127505587,44.1614743713,334.19703321,43.7164045503 B1971.64,J2006.23,B1954.56,113.895199649,-14.1109832563,114.294239451,-14.189617335,113.496041526,-14.0335757922 B1970.49,J2015.57,B1953.55,66.2107722038,-7.76265420193,66.7573654302,-7.66250556575,65.6644607308,-7.86499337709 B1931.50,J1999.69,B1970.69,73.6417002791,41.7006137481,74.8414427945,41.8037189279,72.4451689528,41.5898910005 B1951.47,J1977.66,B1960.78,204.381010469,-14.9357743223,204.732916483,-15.0684119497,204.02947143,-14.8027671534 B1955.96,J1999.16,B1975.98,214.396093073,-66.7648451487,215.271219746,-66.9622610907,213.531009752,-66.5653657951 B1956.23,J2000.23,B1977.93,347.225227105,6.27744217753,347.783144277,6.51660389395,346.667337259,6.03880786927 B1957.34,J1996.85,B1973.69,235.143754874,-5.59566003897,235.668034446,-5.72055011897,234.619987804,-5.46911905342 B1941.60,J1993.80,B1960.79,269.606389512,26.7823112195,270.128504362,26.7816404236,269.084278188,26.7856304113 B1930.71,J2013.89,B1961.97,235.285153507,-14.0695156888,236.447792421,-14.3293747521,234.125715822,-13.8019427393 B1953.56,J1980.00,B1960.84,269.177331338,42.9472695107,269.379190001,42.9454157845,268.975475883,42.9496418506 B1940.10,J1975.82,B1982.78,346.070424986,-3.51848810713,346.530942755,-3.32528640922,345.609649936,-3.71130492658 B1934.68,J2014.12,B1992.32,3.01978725896,7.19732176646,4.04111300197,7.63872974164,1.9996375316,6.75549866988 B1953.24,J2017.66,B1996.52,38.3199756112,18.8080489808,39.2225541698,19.0876452406,37.4201227465,18.5249551135 B1955.52,J1986.19,B1990.02,107.533336957,-4.33088623215,107.914038138,-4.38286340945,107.152514675,-4.27999097547 B1927.27,J2006.35,B1984.04,236.30802591,14.3162535375,237.227969566,14.0749779959,235.388744829,14.5634084162 B1974.27,J1978.23,B1960.36,291.532518915,-33.7960784017,291.597238932,-33.7879646382,291.467788569,-33.8041689728 B1930.19,J1986.95,B1987.08,313.983328941,27.7572327639,314.590894151,27.9778790422,313.375876285,27.5389973059 B1945.29,J1997.99,B1984.85,347.273135054,-13.6880685538,347.963547495,-13.4015008868,346.58154003,-13.9738567052 B1958.28,J2008.13,B1969.09,260.526724891,-37.6134342267,261.376886242,-37.6570793786,259.677433211,-37.5657291394 B1934.85,J1985.89,B1992.51,231.291118043,-27.2371455509,232.060225806,-27.4133463836,230.524106155,-27.0579724511 B1937.09,J1998.50,B1976.41,258.283303492,-30.1025933842,259.264766067,-30.1691519653,257.303071837,-30.0303039078 B1956.16,J2023.91,B1994.65,168.335642599,-44.084769302,169.131984863,-44.4546574256,167.543307692,-43.7159381708 B1964.94,J2000.65,B1991.03,117.210483914,32.8708634152,117.781943773,32.7790791562,116.63804006,32.9608828232 B1952.23,J1998.51,B1961.43,158.272058119,-29.286471988,158.811965795,-29.5262894831,157.73289082,-29.0475527364 B1934.88,J2008.31,B1991.03,262.688069789,-48.1516431413,264.082620089,-48.1987316304,261.295758898,-48.0946938009 B1964.21,J2001.06,B1956.93,357.845250924,19.2890677934,358.315118415,19.4941375001,357.375940593,19.084061288 B1965.72,J1987.86,B1974.12,243.674536239,-10.0431678136,243.97803572,-10.097540261,243.371196745,-9.98821027624 B1960.54,J2016.21,B1957.44,284.696106425,19.6051067047,285.302622767,19.6853290904,284.089422958,19.5280584762 B1972.20,J1981.44,B1972.41,61.5291328053,18.6403709997,61.6630317661,18.6648463372,61.3952747433,18.6157899771 B1967.75,J1983.60,B1983.30,9.66573928438,-22.9075078717,9.8627174508,-22.8205464878,9.46866122286,-22.9945202022 B1973.18,J1983.75,B1989.45,288.133287813,-36.6947385674,288.310596498,-36.676339325,287.955909092,-36.712964737 B1948.23,J1994.10,B1983.10,325.340113758,-33.7758802174,326.023797476,-33.5649649991,324.65398011,-33.9850593768 B1949.25,J1980.08,B1985.58,8.88343575454,-49.4693354042,9.24701151693,-49.2998476535,8.51878534341,-49.6389915796 B1954.32,J1994.49,B1994.40,177.029034641,-67.7755279684,177.517646511,-67.9988963388,176.544747657,-67.552257953 B1972.10,J2015.50,B1957.08,189.451860246,-68.7071945134,190.114123213,-68.9453284555,188.797874924,-68.4686046268 B1943.61,J1992.69,B1957.38,214.691763751,-32.6160600699,215.421492998,-32.8397553215,213.964722034,-32.3903875087 B1954.91,J2018.83,B1966.30,18.7047162369,-32.9080620608,19.4489945613,-32.5717365496,17.9585532678,-33.2458719202 B1955.68,J2022.94,B1951.59,322.232230099,14.4669345738,323.034821026,14.7645630389,321.42944541,14.1725191869 B1953.00,J2016.94,B1984.39,262.175824918,51.7319974933,262.548281917,51.6846881399,261.803746337,51.7815981232 B1930.93,J1980.75,B1988.24,294.6060041,34.0181871087,295.074015891,34.1347005761,294.137889278,33.9037336792 B1945.15,J2003.12,B1967.50,180.08019102,26.2892216009,180.821706382,25.9664807149,179.336612509,26.6119683301 B1936.07,J1980.42,B1980.80,291.668187169,-22.2789167174,292.329992922,-22.1864262743,291.005523355,-22.3687549985 B1964.41,J2018.79,B1997.92,34.548669268,-15.8924906144,35.1967101241,-15.6441308582,33.9006331013,-16.1427921034 B1963.20,J1992.50,B1964.55,78.8220157436,-37.4332268082,79.075079173,-37.4019554736,78.5689855058,-37.465204993 B1933.72,J2019.89,B1984.33,93.1388621771,60.5731416456,95.0905202877,60.5387165097,91.184708092,60.591240446 B1961.19,J1981.21,B1952.11,168.518071423,7.09229333513,168.777442158,6.98298378221,168.258596163,7.20150240716 B1971.23,J2006.89,B1953.13,165.374352937,39.3890686842,165.87176885,39.196720756,164.875283704,39.5809806285 B1948.80,J2018.63,B1990.72,255.423520875,-17.5881075751,256.438156117,-17.6826060848,254.410141307,-17.4869506738 B1970.65,J1975.05,B1971.83,64.0990821181,36.8289797648,64.172215273,36.8396700703,64.0259656206,36.8182613277 B1946.87,J1990.24,B1969.60,191.321958369,-52.3532066605,191.941068845,-52.5897148324,190.706679307,-52.1161877868 B1928.29,J1976.44,B1966.53,60.3872023631,25.1025882655,61.1139601332,25.2335783606,59.6618880776,24.9686447968 B1943.19,J2002.49,B1972.88,276.773010626,56.6051138031,277.035261703,56.6448029825,276.510294672,56.5669265636 B1934.47,J1983.76,B1991.77,334.141397682,37.3852087993,334.681936673,37.63269657,333.601820309,37.1388490904 B1932.42,J2004.50,B1973.34,219.417716878,-20.2290328911,220.436864842,-20.53677356,218.402163145,-19.9167676954 B1935.55,J1975.26,B1971.06,54.0660580808,-29.3264933861,54.4742787759,-29.1973856015,53.6578513784,-29.4568765774 B1968.98,J1989.10,B1978.54,176.26561333,-0.572718169429,176.523526883,-0.684515911301,176.007690571,-0.460953265257 B1965.89,J2012.99,B1986.95,135.84418338,-9.94938261687,136.4156383,-10.1384151142,135.27243952,-9.76217234374 B1956.58,J2018.60,B1952.75,305.496508312,-8.63421746611,306.333192119,-8.43166153129,304.658373119,-8.83266452583 B1972.76,J2000.27,B1981.21,327.995002307,-58.3471659896,328.478135531,-58.216943679,327.509419894,-58.4767020929 B1930.95,J1999.19,B1981.05,138.185539617,11.9337947187,139.11218066,11.6486009656,137.256622001,12.2148869077 B1955.11,J1977.39,B1950.06,113.578525223,29.6301583121,113.928637253,29.5801804457,113.228110262,29.6794410184 B1941.57,J2012.54,B1980.14,204.621895006,36.5235009134,205.408269314,36.1654570594,203.833462777,36.8838069508 B1966.08,J2016.57,B1952.01,67.6144926088,-13.7094836718,68.1982560465,-13.6037505529,67.030977723,-13.8178646409 B1957.99,J2018.30,B1979.29,45.3029557779,36.4639084123,46.2543764288,36.6980750272,44.3559469687,36.2257877401 B1946.13,J2016.34,B1972.42,247.534489816,-3.23349952461,248.455025871,-3.37995755876,246.615033795,-3.08124145001 B1960.80,J1999.98,B1967.69,287.858418461,26.2825631559,288.257968726,26.350185895,287.458797059,26.2163884515 B1935.76,J1975.44,B1996.68,206.473163472,-38.4312130715,207.060791642,-38.6284341117,205.887695173,-38.2329839969 B1925.84,J1992.06,B1963.36,350.362793376,-7.51631961926,351.218703416,-7.15237789524,349.505768066,-7.87933870474 B1939.04,J2012.01,B1964.06,228.259575769,40.311002157,228.937164323,40.0423286476,227.581733934,40.5832613094 B1955.09,J2020.54,B1975.25,319.831820932,40.7337792676,320.468436705,41.0135236496,319.195878847,40.4566449257 B1948.03,J1989.70,B1982.34,178.349313153,-38.3854710615,178.878815281,-38.6173901794,177.821462042,-38.1536135802 B1960.53,J1984.34,B1998.53,126.58195076,-73.6980337652,126.522212859,-73.7769656974,126.639550025,-73.6189928568 B1933.23,J2019.21,B1951.79,257.122932676,24.0154376566,258.016684748,23.9123993004,256.229480593,24.1257542269 B1972.01,J1994.20,B1971.16,181.414481921,-17.7858263698,181.700080407,-17.9093349916,181.129088126,-17.6623025404 B1972.77,J2005.85,B1979.42,81.2295383474,-9.26450146427,81.6239207678,-9.2370487074,80.8352159785,-9.29320699924 B1974.04,J2004.85,B1986.59,88.1907984871,32.4238226453,88.6946934578,32.4284817102,87.6869564835,32.4176559135 B1927.94,J1991.17,B1958.78,285.408252018,67.7826509035,285.385328422,67.8761253941,285.427216468,67.6890523656 B1962.02,J2007.00,B1975.53,178.262069224,51.7327600597,178.846486725,51.48241739,177.67431932,51.983025032 B1955.03,J1997.43,B1975.01,329.433722424,-46.8960749035,330.103614247,-46.692118107,328.760372892,-47.0986245326 B1929.45,J2009.92,B1994.64,340.333860195,36.5560891832,341.254677798,36.9791399195,339.41634063,36.1354568961 B1974.47,J1983.10,B1969.13,191.963602676,21.3572019706,192.070505327,21.3101918576,191.856675141,21.4042306751 B1952.44,J1984.77,B1983.14,90.8973340407,3.44588414281,91.3225022889,3.4423974082,90.4721556483,3.44803542582 B1958.72,J1999.14,B1952.34,259.510340943,47.0512387915,259.790647567,47.0108077311,259.230159931,47.0927522883 B1961.24,J2000.00,B1987.56,132.277954966,30.4307232942,132.867785214,30.2847386621,131.686701777,30.5750623541 B1953.42,J2013.40,B1968.44,179.513439448,-54.44865752,180.28117417,-54.7825927917,178.751891964,-54.1147599287 B1951.37,J1984.64,B1997.40,81.5670170865,-19.9451944488,81.9269374609,-19.9186092791,81.2071330825,-19.9729303814 B1932.54,J2024.61,B1967.36,127.283632829,-10.0946390302,128.389991343,-10.4090695278,126.176062442,-9.78808786127 B1937.01,J1991.26,B1984.19,234.306643184,-86.4404274379,239.159196268,-86.6062091923,229.877779523,-86.2547679857 B1945.13,J2017.30,B1991.23,112.65584231,11.2521500479,113.653522343,11.0941650144,111.656584771,11.4036739314 B1928.39,J2015.91,B1974.31,276.744760981,21.4151577082,277.676112471,21.4763175641,275.813216777,21.3618641896 B1962.92,J2020.33,B1999.21,281.461357214,-15.511897988,282.28369792,-15.4461443386,280.638389569,-15.573154518 B1942.13,J2011.97,B1980.19,306.867413859,-11.9467360888,307.826980276,-11.7108610078,305.905696925,-12.1773958306 B1974.49,J1990.83,B1987.98,341.966066455,-2.82477813631,342.177020368,-2.73822865168,341.755054209,-2.91122392552 B1969.43,J1976.38,B1984.23,38.6362483924,9.3322810896,38.7295143004,9.36248136387,38.5430036498,9.30204150263 B1971.93,J2003.15,B1996.62,327.861128148,-46.529254733,328.357950708,-46.3816911362,327.362455314,-46.6760151537 B1961.96,J2022.83,B1997.49,120.979858288,87.22617179,127.356289341,87.0356348542,113.806804821,87.3823224486 B1926.35,J1982.80,B1999.51,297.496953653,0.839666332936,298.215707802,0.986504246823,296.777520197,0.696326958488 B1944.12,J2012.89,B1956.31,323.316228643,-0.794522598791,324.199877999,-0.485711290555,322.43128765,-1.09980368764 B1925.53,J1977.07,B1998.83,15.3775095611,-38.7740290611,15.975820035,-38.4977806231,14.777479512,-39.0510731102 B1928.26,J1984.73,B1961.46,70.486199672,-24.0682131367,71.0773386429,-23.9647188389,69.8952283629,-24.1747645717 B1959.07,J2001.01,B1959.30,106.020475905,36.6574903487,106.724489447,36.5916635763,105.315480342,36.7205573317 B1974.33,J1998.24,B1975.46,225.719957006,-24.2326924255,226.069642,-24.3253436846,225.370713094,-24.1394598386 B1958.31,J2014.48,B1976.52,31.0403178442,23.2187819108,31.8305300515,23.4855979353,30.252581142,22.9497454125 B1945.76,J1981.40,B1964.13,51.4602071324,-27.0058546166,51.8377992184,-26.8827293131,51.0826217069,-27.1300027947 B1927.06,J2019.62,B1965.51,185.697546923,55.594260797,186.80220854,55.0820030044,184.579796584,56.1075102073 B1969.71,J1983.82,B1965.49,248.162878677,-23.7609450888,248.376028149,-23.7900358626,247.949821476,-23.7315830399 B1960.34,J1996.74,B1963.32,308.385291884,51.2349043028,308.653885549,51.3611262862,308.116543047,51.1094272568 B1948.94,J1982.47,B1979.67,233.050205996,63.3093356498,233.183624905,63.1972984089,232.917717277,63.4217190672 B1935.78,J2009.44,B1960.86,209.382723191,-41.4659129842,210.508471779,-41.8212717612,208.265390379,-41.1066153061 B1929.09,J2015.70,B1970.12,256.001743835,-16.3448051664,257.249402003,-16.4563411788,254.755864037,-16.2230882626 B1958.66,J1984.63,B1964.43,90.8700685367,21.3678694408,91.2595104175,21.3651813051,90.4806144234,21.369574816 B1974.74,J2003.91,B1958.69,324.057486054,57.4352750563,324.282176393,57.5669676284,323.83284781,57.3039563174 B1954.68,J2011.04,B1961.29,159.225729446,-45.2472278228,159.836674886,-45.541209348,158.616784774,-44.9544310498 B1967.01,J1998.76,B1999.43,7.38749687642,-53.1540997613,7.76348958513,-52.978901243,7.01015979396,-53.3294476754 B1932.65,J1988.10,B1971.70,345.477965039,-10.1831007688,346.201723123,-9.88376000525,344.753111544,-10.4814629211 B1968.81,J2011.71,B1991.41,234.801152081,71.8511934075,234.75819291,71.7134587916,234.849277912,71.9887729277 B1952.24,J1992.46,B1978.63,184.754250038,-66.4894904918,185.31507512,-66.7125454196,184.198875868,-66.2662547282 B1974.18,J2008.57,B1982.60,245.64829793,-38.7682176459,246.229734859,-38.8462753796,245.067899116,-38.6883914108 B1961.79,J1977.75,B1986.49,176.234540627,12.5643501076,176.440478946,12.4756870596,176.028521797,12.6529921788 B1929.65,J2019.85,B1969.56,333.536461653,-55.645568776,335.008274077,-55.1931712959,332.042112951,-56.0921730529 B1939.61,J2001.08,B1969.64,185.716717981,-21.5568171888,186.518819162,-21.8971031217,184.916731889,-21.2160545858 B1938.65,J1988.76,B1992.98,25.9775574253,12.7249831044,26.6478047282,12.9750431145,25.30853404,12.4734949987 B1928.56,J2017.18,B1990.50,204.302987352,-36.6989586206,205.594712571,-37.1462777072,203.0212666,-36.2470793085 B1959.00,J1997.12,B1991.83,221.487546141,22.5689795999,221.917649745,22.4105410037,221.057403953,22.7284735519 B1936.24,J2008.46,B1959.40,338.956666009,-30.7135370512,339.96511112,-30.3370017697,337.943007518,-31.0875245016 B1952.57,J2024.63,B1967.98,149.5308077,21.1458572723,150.530972008,20.7983136142,148.526893227,21.4898432119 B1963.49,J2017.63,B1974.10,95.1983908472,-1.61163007915,95.8836923542,-1.64073778617,94.5129553374,-1.58611303786 B1935.59,J2021.68,B1998.30,35.0615395317,-28.6207880841,36.013756926,-28.230800891,34.108208406,-29.0153533631 B1939.64,J2018.11,B1978.17,174.903919876,-25.7547140538,175.892230462,-26.1901662894,173.918861307,-25.3199298979 B1942.82,J1978.35,B1991.38,167.27863063,54.1842744725,167.792865117,53.9911451576,166.761561647,54.3770117742 B1972.82,J1989.59,B1953.81,10.7133541168,-26.6356033619,10.9196530538,-26.5438625332,10.5069242085,-26.7274067313 B1958.01,J1984.82,B1977.66,249.939886269,43.0233288254,250.152708941,42.9723921243,249.727120549,43.0747862488 B1972.53,J1995.55,B1977.40,258.100960451,-37.3838036503,258.492060536,-37.4098004846,257.710089764,-37.356950996 B1929.84,J1995.96,B1995.27,262.732112385,-19.8057986634,263.710992923,-19.8492450608,261.753853467,-19.7561160195 B1938.23,J2022.91,B1968.47,149.166366188,63.2857703333,150.716387336,62.8777259431,147.585925919,63.6872128631 B1938.61,J2021.20,B1995.06,5.4355841259,0.695799807062,6.49453219621,1.15308515723,4.37708671511,0.237709638907 B1966.75,J2024.18,B1957.03,327.231056694,-11.1377396332,328.000338248,-10.8677167475,326.460220195,-11.4054365616 B1965.64,J1994.07,B1954.96,284.17633852,-71.0631656787,284.986812185,-71.023307137,283.363277683,-71.1008495735 B1939.69,J2023.20,B1998.66,59.4717008987,14.0960045791,60.6437035945,14.328043327,58.3026637155,13.8557849823 B1957.49,J2004.52,B1997.10,112.602946077,-17.7763932222,113.128066437,-17.8781256601,112.077653347,-17.6768763275 B1946.05,J2000.05,B1979.55,219.940310095,-26.5130440909,220.729784133,-26.7422090278,219.153387495,-26.2812240409 B1928.73,J1989.10,B1952.60,131.216503219,-60.6790709392,131.538762739,-60.9012667241,130.892392069,-60.458301418 B1961.94,J1983.12,B1952.51,56.1738921125,-19.3427782341,56.4110363048,-19.277323069,55.9367786527,-19.4086389221 B1954.27,J1997.44,B1966.23,63.8293728328,-59.8347944156,64.0119166618,-59.729130492,63.6478301692,-59.9411437379 B1942.23,J1992.36,B1968.79,312.440281577,-82.909075449,314.686445788,-82.716709549,310.089004633,-83.0931764134 B1937.90,J2001.19,B1988.21,104.43408064,-66.6447299251,104.453108425,-66.7326176146,104.411797906,-66.5569652662 B1939.59,J2002.19,B1992.96,210.664663673,-17.5831928536,211.524274634,-17.8816169868,209.807499075,-17.2821058793 B1963.49,J1975.54,B1977.29,163.438155327,-54.6954182678,163.565812054,-54.7597430346,163.310636547,-54.6311360803 B1946.22,J1989.83,B1966.19,148.024127582,2.32865180198,148.587881848,2.12205454824,147.4598279,2.53398329697 B1939.43,J1983.41,B1970.29,317.748400264,-34.6457182874,318.424549161,-34.4635023474,317.070001399,-34.8259880426 B1938.21,J2022.93,B1955.48,249.374885326,79.5246095403,248.102397286,79.3535339601,250.706479605,79.6856520522 B1938.85,J1986.82,B1956.86,100.53840787,-27.7507223648,101.014813183,-27.8006647295,100.061930435,-27.7029635357 B1967.12,J2016.63,B1987.27,23.1984832267,21.1208388177,23.8758085173,21.373531354,22.5228650317,20.8668643466 B1933.48,J2010.39,B1993.82,71.5045009532,3.00896662959,72.5117326573,3.14121771682,70.4983597655,2.86958134305 B1937.60,J2003.03,B1962.95,335.405788093,-6.90098238794,336.26168125,-6.56861752396,334.548406282,-7.23108048852 B1954.59,J2010.06,B1984.28,307.588884401,18.8511389183,308.216046805,19.0408491208,306.961527852,18.6641076356 B1973.77,J1985.60,B1967.96,343.704504442,-46.9224252956,343.875951545,-46.8591633148,343.532811099,-46.9856319247 B1925.21,J2009.55,B1950.30,18.8112053675,35.1485289159,20.0024206727,35.5914321179,17.6282310843,34.702488267 B1937.00,J2006.08,B1988.06,208.609805013,-46.3894275721,209.692670963,-46.7252945952,207.535889978,-46.0500943647 B1961.33,J2010.87,B1970.70,172.978655994,15.4172636989,173.622309813,15.1433334088,172.333980129,15.6908149586 B1937.54,J1982.63,B1966.69,7.8152324312,-34.9365736294,8.36836736742,-34.688026104,7.26063844242,-35.1854511343 B1970.91,J1979.71,B1963.90,134.503366944,-72.4111269318,134.50595835,-72.4454843369,134.500551115,-72.3767711725 B1950.41,J2022.56,B1979.63,149.073048424,14.7065160273,150.050293767,14.3602043524,148.092931537,15.0493015642 B1950.13,J1995.20,B1966.26,217.406604209,16.5186514295,217.938935407,16.3200334608,216.874300735,16.7186856279 B1960.62,J2007.17,B1996.84,241.829541848,16.5114334946,242.358489224,16.3901534117,241.300790354,16.6348221277 B1956.99,J2023.02,B1954.80,301.991652158,46.8228690265,302.505263266,47.0190374374,301.477638783,46.6294966913 B1939.22,J2016.87,B1994.16,280.629434995,-19.0017596678,281.769997009,-18.9177962123,279.487664877,-19.0772612574 B1925.49,J1981.53,B1978.40,144.252375855,-10.2581330338,144.937158573,-10.5124362227,143.567309058,-10.006008783 B1954.74,J2000.05,B1953.10,286.0305233,12.7464714044,286.556205108,12.8172544241,285.504676194,12.6779134146 B1967.05,J1984.09,B1993.75,321.524751743,61.8464645226,321.632971919,61.9207781138,321.416450206,61.7722624353 B1949.33,J1977.52,B1961.24,94.4962887092,-44.0946278203,94.7059415448,-44.1072194614,94.2866143528,-44.0826087841 B1964.04,J2019.75,B1989.97,356.110922656,-39.1892569317,356.840327262,-38.8797072373,355.378110002,-39.4985381971 B1945.63,J1988.30,B1990.09,307.190555646,-43.7191034979,307.916952389,-43.5743180165,306.461507156,-43.8614854707 B1943.99,J1977.69,B1951.45,263.331776174,25.1917278571,263.675941152,25.1704984165,262.987636197,25.2140768109 B1969.92,J1999.97,B1981.35,128.003624894,58.8666544649,128.605737687,58.7629529731,127.398829454,58.9689675244 B1969.84,J2014.01,B1980.23,317.984216655,-8.89508525523,318.575678141,-8.71153679083,317.391922121,-9.07693345337 B1961.02,J2002.85,B1953.91,312.465272698,5.18400310772,312.985580994,5.34203296971,311.944618588,5.02753402011 B1939.24,J1981.75,B1988.65,344.0759205,-20.8070551085,344.644700272,-20.5791609914,343.505986239,-21.0343039973 B1941.99,J1994.43,B1957.17,0.0386123471053,-42.7336081023,0.708747131881,-42.4416361362,359.365316955,-43.025582347 B1939.26,J1987.88,B1973.18,5.95477509083,23.9728714179,6.5909526232,24.2419429246,5.32008332697,23.7034884386 B1963.98,J2001.37,B1954.86,113.065220613,27.4191705733,113.643404238,27.3366368146,112.486263629,27.4997700815 B1925.23,J2020.13,B1978.49,358.313822853,67.0446512684,359.505559565,67.5728883986,357.14681594,66.5167328688 B1929.23,J2017.66,B1970.19,53.5839203362,-15.011852649,54.610957277,-14.7231509285,52.5576449921,-15.3076533827 B1947.07,J2016.84,B1979.33,60.2557627351,25.6833225299,61.3134611254,25.8729083597,59.2011689172,25.4875201301 B1937.55,J1985.79,B1987.44,273.08593329,76.4393919681,272.591344908,76.4526927726,273.578774594,76.4237802487 B1970.29,J1981.68,B1994.48,25.0306798156,-51.1202356021,25.1435488988,-51.0628198065,24.9177386023,-51.177704254 B1969.04,J1981.01,B1968.97,253.970437895,31.094899255,254.085382476,31.0765584395,253.855499113,31.1133685873 B1960.83,J2018.73,B1964.62,168.89950144,-43.2270950714,169.584603614,-43.5437889415,168.217301809,-42.9111416391 B1936.93,J1979.00,B1975.46,3.66775780511,39.2622225734,4.22000281563,39.4958903381,3.11745305971,39.0284106254 B1971.26,J1994.47,B1976.64,278.936590632,6.21231840756,279.220262021,6.23271017522,278.652884808,6.19255870349 B1973.48,J1984.09,B1955.27,285.91236301,9.40548699672,286.039106102,9.42175539099,285.785609343,9.38934433416 B1953.91,J1995.56,B1952.30,53.8450026285,60.7259893436,54.7155379279,60.8613834632,52.9800334576,60.5877592411 B1938.45,J2016.67,B1981.10,8.53330744443,-7.54498028811,9.52668790991,-7.1149113183,7.53943191911,-7.97616983921 B1940.05,J2023.92,B1991.12,274.342957522,-1.24603088049,275.427502795,-1.20626637794,273.258110296,-1.27698166464 B1956.27,J1975.21,B1952.75,80.5212647616,19.4060625392,80.8007537943,19.4231777982,80.2418410241,19.3884398656 B1963.99,J2002.99,B1989.90,94.3827831954,15.0883386826,94.9409404907,15.0706908672,93.8245150675,15.1038774277 B1946.06,J2012.59,B1962.21,164.473020999,-47.6965440186,165.218388831,-48.0540734375,163.731379108,-47.3403011601 B1957.85,J1994.50,B1990.18,89.9736906625,-16.9964263489,90.3810379284,-16.9970588536,89.5663435591,-16.9972444015 B1946.18,J1990.43,B1964.91,204.582082173,15.6789515837,205.12023156,15.4553934359,204.04377436,15.9034725087 astropy-0.3/astropy/coordinates/tests/accuracy/fk4_no_e_fk4.csv0000644000175000017500000004503112243255342023116 0ustar oleole# This file was generated with the ref_fk4_no_e_fk4.py script, and the reference values were computed using AST obstime,ra_in,dec_in,ra_fk4ne,dec_fk4ne,ra_fk4,dec_fk4 B1995.95,334.661793414,43.9385116594,334.661871722,43.9384643913,334.661715106,43.9385589276 B1954.56,113.895199649,-14.1109832563,113.895104206,-14.1109806856,113.895295093,-14.110985827 B1953.55,66.2107722038,-7.76265420193,66.2106936357,-7.76263900837,66.2108507719,-7.76266939548 B1970.69,73.6417002791,41.7006137481,73.6415874825,41.7005905459,73.6418130758,41.7006369502 B1960.78,204.381010469,-14.9357743223,204.381033022,-14.935790469,204.380987917,-14.9357581756 B1975.98,214.396093073,-66.7648451487,214.39618819,-66.7649221332,214.395997956,-66.7647681643 B1977.93,347.225227105,6.27744217753,347.225265767,6.27744057158,347.225188443,6.27744378347 B1973.69,235.143754874,-5.59566003897,235.143821166,-5.59565879904,235.143688582,-5.59566127889 B1960.79,269.606389512,26.7823112195,269.6064937,26.7823268289,269.606285325,26.78229561 B1961.97,235.285153507,-14.0695156888,235.285221697,-14.0695245442,235.285085317,-14.0695068334 B1960.84,269.177331338,42.9472695107,269.177458208,42.9472886864,269.177204468,42.947250335 B1982.78,346.070424986,-3.51848810713,346.070465234,-3.51847491299,346.070384739,-3.51850130129 B1992.32,3.01978725896,7.19732176646,3.0198007213,7.19731786183,3.0197737966,7.1973256711 B1996.52,38.3199756112,18.8080489808,38.3199297604,18.8080292742,38.320021462,18.8080686874 B1990.02,107.533336957,-4.33088623215,107.533242366,-4.3308791254,107.533431548,-4.33089333889 B1984.04,236.30802591,14.3162535375,236.308095417,14.316277761,236.307956402,14.316229314 B1960.36,291.532518915,-33.7960784017,291.532631247,-33.7960622584,291.532406582,-33.7960945449 B1987.08,313.983328941,27.7572327639,313.983419024,27.757215788,313.983238857,27.7572497397 B1984.85,347.273135054,-13.6880685538,347.273174533,-13.6880403026,347.273095575,-13.688096805 B1969.09,260.526724891,-37.6134342267,260.526837065,-37.6134483095,260.526612717,-37.6134201437 B1992.51,231.291118043,-27.2371455509,231.291186922,-27.2371716878,231.291049163,-27.237119414 B1976.41,258.283303492,-30.1025933842,258.283404615,-30.1026049901,258.28320237,-30.1025817782 B1994.65,168.335642599,-44.084769302,168.33559145,-44.0848244927,168.335693748,-44.0847141113 B1991.03,117.210483914,32.8708634152,117.210375337,32.8708843641,117.210592491,32.8708424662 B1961.43,158.272058119,-29.286471988,158.271999107,-29.2865040826,158.27211713,-29.2864398934 B1991.03,262.688069789,-48.1516431413,262.688204769,-48.1516601921,262.687934809,-48.1516260902 B1956.93,357.845250924,19.2890677934,357.845273996,19.2890447616,357.845227852,19.2890908252 B1974.12,243.674536239,-10.0431678136,243.67461278,-10.0431700653,243.674459697,-10.0431655619 B1957.44,284.696106425,19.6051067047,284.696206986,19.6051121836,284.696005864,19.6051012256 B1972.41,61.5291328053,18.6403709997,61.5290555992,18.640359185,61.5292100114,18.6403828144 B1983.30,9.66573928438,-22.9075078717,9.66574187976,-22.9074636315,9.66573668899,-22.9075521118 B1989.45,288.133287813,-36.6947385674,288.1334053,-36.6947252717,288.133170326,-36.694751863 B1983.10,325.340113758,-33.7758802174,325.340195579,-33.7758368156,325.340031937,-33.7759236192 B1985.58,8.88343575454,-49.4693354042,8.88344142656,-49.4692581619,8.88343008249,-49.4694126467 B1994.40,177.029034641,-67.7755279684,177.028973591,-67.7756101942,177.02909569,-67.7754457425 B1957.08,189.451860246,-68.7071945134,189.451852687,-68.707280034,189.451867805,-68.7071089929 B1957.38,214.691763751,-32.6160600699,214.691808834,-32.6161002775,214.691718668,-32.6160198625 B1966.30,18.7047162369,-32.9080620608,18.7047012927,-32.9080042868,18.7047311812,-32.9081198349 B1951.59,322.232230099,14.4669345738,322.232303942,14.4669266585,322.232156257,14.466942489 B1984.39,262.175824918,51.7319974933,262.175969881,51.7320265851,262.175679954,51.7319684013 B1988.24,294.6060041,34.0181871087,294.606115453,34.0181812889,294.605892748,34.0181929283 B1967.50,180.08019102,26.2892216009,180.080170768,26.2892699746,180.080211273,26.2891732273 B1980.80,291.668187169,-22.2789167174,291.668288006,-22.2789027838,291.668086332,-22.2789306509 B1997.92,34.548669268,-15.8924906144,34.5486300111,-15.8924591395,34.548708525,-15.8925220893 B1964.55,78.8220157436,-37.4332268082,78.8219051397,-37.4331986299,78.8221263475,-37.4332549865 B1984.33,93.1388621771,60.5731416456,93.1386708523,60.5731340793,93.139053502,60.5731492117 B1952.11,168.518071423,7.09229333513,168.51803468,7.09231202586,168.518108166,7.09227464443 B1953.13,165.374352937,39.3890686842,165.374299611,39.3891290726,165.374406263,39.3890082959 B1990.72,255.423520875,-17.5881075751,255.423610608,-17.5881124458,255.423431143,-17.5881027044 B1971.83,64.0990821181,36.8289797648,64.098987426,36.8289518646,64.0991768103,36.829007665 B1969.60,191.321958369,-52.3532066605,191.321958947,-52.3532769701,191.321957792,-52.3531363511 B1966.53,60.3872023631,25.1025882655,60.3871229238,25.1025691776,60.3872818026,25.1026073533 B1972.88,276.773010626,56.6051138031,276.773182582,56.6051241599,276.772838671,56.6051034461 B1991.77,334.141397682,37.3852087993,334.141469519,37.3851690556,334.141325844,37.3852485429 B1973.34,219.417716878,-20.2290328911,219.417764848,-20.2290543437,219.417668907,-20.2290114386 B1971.06,54.0660580808,-29.3264933861,54.0659838918,-29.3264524474,54.06613227,-29.3265343247 B1978.54,176.26561333,-0.572718169429,176.265589013,-0.572711155523,176.265637647,-0.572725183324 B1986.95,135.84418338,-9.94938261687,135.844104187,-9.94938414897,135.844262573,-9.94938108476 B1952.75,305.496508312,-8.63421746611,305.496595751,-8.63420374088,305.496420873,-8.63423119132 B1981.21,327.995002307,-58.3471659896,327.995125925,-58.3471028456,327.994878689,-58.3472291335 B1981.05,138.185539617,11.9337947187,138.185462216,11.9338143115,138.185617017,11.9337751259 B1950.06,113.578525223,29.6301583121,113.578418602,29.6301753387,113.578631843,29.6301412853 B1980.14,204.621895006,36.5235009134,204.621922605,36.5235622135,204.621867408,36.5234396134 B1952.01,67.6144926088,-13.7094836718,67.6144111325,-13.7094635522,67.6145740851,-13.7095037914 B1979.29,45.3029557779,36.4639084123,45.30288945,36.4638681314,45.3030221059,36.4639486932 B1972.42,247.534489816,-3.23349952461,247.534569024,-3.23349456661,247.534410608,-3.2335044826 B1967.69,287.858418461,26.2825631559,287.858523588,26.2825653277,287.858313334,26.2825609839 B1996.68,206.473163472,-38.4312130715,206.473195575,-38.4312637479,206.473131368,-38.4311623951 B1963.36,350.362793376,-7.51631961926,350.36282729,-7.51630014511,350.362759462,-7.51633909343 B1964.06,228.259575769,40.311002157,228.259650941,40.3110571481,228.259500598,40.3109471658 B1975.25,319.831820932,40.7337792676,319.831918659,40.7337465323,319.831723205,40.7338120029 B1982.34,178.349313153,-38.3854710615,178.349286408,-38.3855223276,178.349339897,-38.3854197955 B1998.53,126.58195076,-73.6980337652,126.581645487,-73.6980707198,126.582256033,-73.6979968102 B1951.79,257.122932676,24.0154376566,257.123027615,24.0154606049,257.122837737,24.0154147083 B1971.16,181.414481921,-17.7858263698,181.414465135,-17.7858473968,181.414498707,-17.7858053429 B1979.42,81.2295383474,-9.26450146427,81.2294479067,-9.26448844016,81.2296287882,-9.26451448837 B1986.59,88.1907984871,32.4238226453,88.1906888861,32.4238179627,88.1909080881,32.4238273279 B1958.78,285.408252018,67.7826509035,285.408502334,67.7826473151,285.408001701,67.7826544915 B1975.53,178.262069224,51.7327600597,178.262035148,51.7328376286,178.2621033,51.7326824908 B1975.01,329.433722424,-46.8960749035,329.433814783,-46.8960177216,329.433630065,-46.8961320854 B1994.64,340.333860195,36.5560891832,340.333920655,36.5560469817,340.333799735,36.5561313847 B1969.13,191.963602676,21.3572019706,191.963604196,21.3572439205,191.963601156,21.3571600208 B1983.14,90.8973340407,3.44588414281,90.897240458,3.44589104844,90.8974276234,3.44587723717 B1952.34,259.510340943,47.0512387915,259.51047047,47.0512697696,259.510211416,47.0512078131 B1987.56,132.277954966,30.4307232942,132.277860775,30.4307550149,132.278049157,30.4306915735 B1968.44,179.513439448,-54.44865752,179.513406635,-54.4487285563,179.513472261,-54.4485864837 B1997.40,81.5670170865,-19.9451944488,81.5669219294,-19.9451761627,81.5671122436,-19.9452127349 B1967.36,127.283632829,-10.0946390302,127.283546305,-10.0946385601,127.283719352,-10.0946395003 B1984.19,234.306643184,-86.4404274379,234.307689689,-86.4404960056,234.305596721,-86.440358869 B1991.23,112.65584231,11.2521500479,112.655747491,11.2521615342,112.655937129,11.2521385617 B1974.31,276.744760981,21.4151577082,276.744862642,21.4151677292,276.74465932,21.4151476871 B1999.21,281.461357214,-15.511897988,281.461455717,-15.5118901893,281.46125871,-15.5119057865 B1980.19,306.867413859,-11.9467360888,306.867501237,-11.9467197906,306.86732648,-11.946752387 B1987.98,341.966066455,-2.82477813631,341.966112735,-2.82476612903,341.966020175,-2.82479014361 B1984.23,38.6362483924,9.3322810896,38.6362039361,9.33227526676,38.6362928487,9.33228691243 B1996.62,327.861128148,-46.529254733,327.861222674,-46.5291991016,327.86103362,-46.5293103644 B1997.49,120.979858288,87.22617179,120.978013685,87.226204397,120.981702849,87.2261391801 B1999.51,297.496953653,0.839666332936,297.497044724,0.83967387104,297.496862583,0.839658794827 B1956.31,323.316228643,-0.794522598791,323.316298957,-0.794513783928,323.316158329,-0.794531413663 B1998.83,15.3775095611,-38.7740290611,15.3775004994,-38.7739636006,15.3775186228,-38.7740945216 B1961.46,70.486199672,-24.0682131367,70.4861102148,-24.0681861769,70.4862891293,-24.0682400965 B1959.30,106.020475905,36.6574903487,106.020358021,36.6575015631,106.020593788,36.6574791342 B1975.46,225.719957006,-24.2326924255,225.720016128,-24.2327172566,225.719897883,-24.2326675945 B1976.52,31.0403178442,23.2187819108,31.040282636,23.2187540208,31.0403530525,23.2188098008 B1964.13,51.4602071324,-27.0058546166,51.4601381551,-27.0058147039,51.4602761098,-27.0058945294 B1965.51,185.697546923,55.594260797,185.697531081,55.5943432416,185.697562765,55.5941783525 B1965.49,248.162878677,-23.7609450888,248.162965707,-23.7609586287,248.162791647,-23.7609315488 B1963.32,308.385291884,51.2349043028,308.385426622,51.2348753519,308.385157147,51.2349332534 B1979.67,233.050205996,63.3093356498,233.050347232,63.3094022915,233.05006476,63.3092690079 B1960.86,209.382723191,-41.4659129842,209.382762908,-41.4659667228,209.382683474,-41.4658592457 B1970.12,256.001743835,-16.3448051664,256.001833404,-16.3448088895,256.001654267,-16.3448014432 B1964.43,90.8700685367,21.3678694408,90.8699682366,21.3678706796,90.8701688369,21.3678682019 B1958.69,324.057486054,57.4352750563,324.057615131,57.4352248218,324.057356976,57.4353252907 B1961.29,159.225729446,-45.2472278228,159.225658238,-45.2472794744,159.225800655,-45.2471761712 B1999.43,7.38749687642,-53.1540997613,7.38750715011,-53.1540192078,7.38748660267,-53.1541803148 B1971.70,345.477965039,-10.1831007688,345.478006755,-10.1830778328,345.477923323,-10.1831237048 B1991.41,234.801152081,71.8511934075,234.80136258,71.8512610944,234.800941584,71.8511257203 B1978.63,184.754250038,-66.4894904918,184.754223702,-66.4895738307,184.754276373,-66.4894071529 B1982.60,245.64829793,-38.7682176459,245.648397087,-38.7682459424,245.648198773,-38.7681893494 B1986.49,176.234540627,12.5643501076,176.234515663,12.564377805,176.23456559,12.5643224102 B1969.56,333.536461653,-55.645568776,333.536564215,-55.6455021935,333.53635909,-55.6456353585 B1969.64,185.716717981,-21.5568171888,185.71670839,-21.5568445326,185.716727571,-21.556789845 B1992.98,25.9775574253,12.7249831044,25.9775324561,12.7249706335,25.9775823945,12.7249955753 B1990.50,204.302987352,-36.6989586206,204.303014372,-36.6990074874,204.302960331,-36.6989097538 B1991.83,221.487546141,22.5689795999,221.487598122,22.569018351,221.487494159,22.5689408487 B1959.40,338.956666009,-30.7135370512,338.956724763,-30.7134891887,338.956607255,-30.7135849138 B1967.98,149.5308077,21.1458572723,149.530740161,21.1458902834,149.530875238,21.1458242612 B1974.10,95.1983908472,-1.61163007915,95.1982963974,-1.61162187599,95.198485297,-1.6116382823 B1998.30,35.0615395317,-28.6207880841,35.0614956333,-28.620739571,35.0615834301,-28.6208365972 B1978.17,174.903919876,-25.7547140538,174.903890465,-25.754746515,174.903949287,-25.7546815927 B1991.38,167.27863063,54.1842744725,167.278565096,54.1843495205,167.278696164,54.1841994246 B1953.81,10.7133541168,-26.6356033619,10.7133548501,-26.6355537205,10.7133533835,-26.6356530033 B1977.66,249.939886269,43.0233288254,249.939997359,43.0233681421,249.939775179,43.0232895085 B1977.40,258.100960451,-37.3838036503,258.101070404,-37.3838198729,258.1008505,-37.3837874275 B1995.27,262.732112385,-19.8057986634,262.732208125,-19.8058013404,262.732016645,-19.8057959863 B1968.47,149.166366188,63.2857703333,149.166225063,63.2858369635,149.166507312,63.2857037031 B1995.06,5.4355841259,0.695799807062,5.43559350993,0.695806590879,5.43557474185,0.695793023234 B1957.03,327.231056694,-11.1377396332,327.231123747,-11.137718635,327.230989642,-11.1377606314 B1954.96,284.17633852,-71.0631656787,284.17663058,-71.0631583005,284.176046459,-71.0631730565 B1998.66,59.4717008987,14.0960045791,59.4716277587,14.0959969126,59.4717740389,14.0960122456 B1997.10,112.602946077,-17.7763932222,112.6028484,-17.7763914439,112.603043755,-17.7763950006 B1979.55,219.940310095,-26.5130440909,219.940361247,-26.5130741126,219.940258944,-26.5130140693 B1952.60,131.216503219,-60.6790709392,131.216335542,-60.6791085681,131.216670895,-60.6790333101 B1952.51,56.1738921125,-19.3427782341,56.1738209005,-19.3427485454,56.1739633247,-19.3428079229 B1966.23,63.8293728328,-59.8347944156,63.8292225342,-59.8347407237,63.829523132,-59.8348481073 B1968.79,312.440281577,-82.909075449,312.440938353,-82.9090254915,312.439624792,-82.9091254056 B1988.21,104.43408064,-66.6447299251,104.433841614,-66.6447318349,104.434319666,-66.644728015 B1992.96,210.664663673,-17.5831928536,210.664697001,-17.5832123123,210.664630345,-17.5831733949 B1977.29,163.438155327,-54.6954182678,163.438079056,-54.6954822858,163.438231598,-54.6953542498 B1966.19,148.024127582,2.32865180198,148.024062692,2.32866254348,148.024192472,2.32864106049 B1970.29,317.748400264,-34.6457182874,317.748492841,-34.6456795601,317.748307686,-34.6457570147 B1955.48,249.374885326,79.5246095403,249.375329338,79.5246600743,249.374441319,79.5245590057 B1956.86,100.53840787,-27.7507223648,100.538300623,-27.7507149055,100.538515118,-27.750729824 B1987.27,23.1984832267,21.1208388177,23.1984619158,21.1208127728,23.1985045377,21.1208648626 B1993.82,71.5045009532,3.00896662959,71.504418313,3.00897208869,71.5045835934,3.00896117048 B1962.95,335.405788093,-6.90098238794,335.40584389,-6.90096525284,335.405732296,-6.90099952305 B1984.28,307.588884401,18.8511389183,307.588974176,18.8511327496,307.588794626,18.851145087 B1967.96,343.704504442,-46.9224252956,343.704568407,-46.9223583286,343.704440477,-46.9224922627 B1950.30,18.8112053675,35.1485289159,18.8111898096,35.1484812505,18.8112209256,35.1485765813 B1988.06,208.609805013,-46.3894275721,208.609846395,-46.3894876445,208.609763631,-46.3893674997 B1970.70,172.978655994,15.4172636989,172.978625355,15.4172953255,172.978686632,15.4172320724 B1966.69,7.8152324312,-34.9365736294,7.81523908357,-34.936512861,7.81522577882,-34.9366343978 B1963.90,134.503366944,-72.4111269318,134.503104699,-72.4111743348,134.503629189,-72.4110795286 B1979.63,149.073048424,14.7065160273,149.072982715,14.7065415958,149.073114132,14.7064904588 B1966.26,217.406604209,16.5186514295,217.406648071,16.518683228,217.406560347,16.518619631 B1996.84,241.829541848,16.5114334946,241.82961848,16.5114581776,241.829465216,16.5114088117 B1954.80,301.991652158,46.8228690265,301.991781762,46.8228497806,301.991522554,46.8228882722 B1994.16,280.629434995,-19.0017596678,280.629535379,-19.0017524272,280.629334611,-19.0017669083 B1978.40,144.252375855,-10.2581330338,144.252305474,-10.258136788,144.252446236,-10.2581292796 B1953.10,286.0305233,12.7464714044,286.030620257,12.7464773437,286.030426344,12.7464654651 B1993.75,321.524751743,61.8464645226,321.524904902,61.8464140081,321.524598583,61.846515037 B1961.24,94.4962887092,-44.0946278203,94.4961574273,-44.0946145181,94.4964199912,-44.0946411224 B1989.97,356.110922656,-39.1892569317,356.110954348,-39.1891928509,356.110890964,-39.1893210125 B1990.09,307.190555646,-43.7191034979,307.190673602,-43.7190689248,307.190437689,-43.719138071 B1951.45,263.331776174,25.1917278571,263.331876059,25.1917473693,263.331676289,25.1917083448 B1981.35,128.003624894,58.8666544649,128.003461169,58.8666953172,128.003788619,58.8666136124 B1980.23,317.984216655,-8.89508525523,317.984293507,-8.89506861216,317.984139802,-8.8951018983 B1953.91,312.465272698,5.18400310772,312.465354085,5.18400654399,312.465191311,5.18399967144 B1988.65,344.0759205,-20.8070551085,344.07596665,-20.8070176615,344.07587435,-20.8070925556 B1957.17,0.0386123471053,-42.7336081023,0.0386371599928,-42.7335390653,0.0385875341353,-42.7336771394 B1973.18,5.95477509083,23.9728714179,5.95478442291,23.9728402559,5.95476575873,23.97290258 B1954.86,113.065220613,27.4191705733,113.065116003,27.4191866686,113.065325223,27.4191544779 B1978.49,358.313822853,67.0446512684,358.313876751,67.0445691316,358.313768955,67.0447334052 B1970.19,53.5839203362,-15.011852649,53.5838539771,-15.0118268548,53.5839866953,-15.0118784432 B1979.33,60.2557627351,25.6833225299,60.2556830704,25.6833027692,60.2558423998,25.6833422906 B1987.44,273.08593329,76.4393919681,273.086334137,76.439406706,273.085532444,76.4393772296 B1994.48,25.0306798156,-51.1202356021,25.0306434336,-51.1201589045,25.0307161977,-51.1203122997 B1968.97,253.970437895,31.094899255,253.970536535,31.0949284071,253.970339254,31.0948701027 B1964.62,168.89950144,-43.2270950714,168.899452201,-43.2271494771,168.89955068,-43.2270406658 B1975.46,3.66775780511,39.2622225734,3.66777368182,39.26216915,3.66774192836,39.2622759968 B1976.64,278.936590632,6.21231840756,278.936686041,6.21232668172,278.936495223,6.21231013337 B1955.27,285.91236301,9.40548699672,285.912458882,9.40549352262,285.912267137,9.40548047079 B1952.30,53.8450026285,60.7259893436,53.8448709018,60.7259324097,53.8451343557,60.7260462774 B1981.10,8.53330744443,-7.54498028811,8.5333117472,-7.54495997493,8.53330314165,-7.54500060131 B1991.12,274.342957522,-1.24603088049,274.3430518,-1.24602319414,274.342863244,-1.24603856684 B1952.75,80.5212647616,19.4060625392,80.5211705543,19.4060589302,80.521358969,19.4060661482 B1989.90,94.3827831954,15.0883386826,94.382685566,15.0883434466,94.3828808249,15.0883339185 B1962.21,164.473020999,-47.6965440186,164.472957775,-47.69660143,164.473084223,-47.6964866073 B1990.18,89.9736906625,-16.9964263489,89.973593279,-16.9964134056,89.9737880461,-16.9964392923 B1964.91,204.582082173,15.6789515837,204.582105142,15.678984165,204.582059203,15.6789190023 astropy-0.3/astropy/coordinates/tests/accuracy/test_galactic_fk4.py0000644000175000017500000000320212243255342024067 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import numpy as np from .... import units as u from ... import Galactic, FK4 from ....time import Time from ....table import Table from ...angle_utilities import angular_separation TOLERANCE = 0.5 # arcseconds ROOT = os.path.dirname(os.path.abspath(__file__)) def test_galactic_fk4(): t = Table.read(os.path.join(ROOT, 'galactic_fk4.csv'), format='ascii') for i in range(len(t)): # Extract row r = t[i] # FK4 to FK5 c1 = Galactic(r['lon_in'], r['lat_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc')) c2 = c1.transform_to(FK4).precess_to(Time(r['equinox_fk4'], scale='utc')) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk4']), np.radians(r['dec_fk4'])) assert np.degrees(diff) * 3600. < TOLERANCE # FK5 to FK4 c1 = FK4(r['lon_in'], r['lat_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc'), equinox=Time(r['equinox_fk4'], scale='utc')) c2 = c1.transform_to(Galactic) # Find difference diff = angular_separation(c2.l.radian, c2.b.radian, np.radians(r['lon_gal']), np.radians(r['lat_gal'])) assert np.degrees(diff) * 3600. < TOLERANCE astropy-0.3/astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.py0000644000175000017500000000330712243255342024012 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import os import numpy as np from .... import units as u from ... import FK4NoETerms, FK4 from ....time import Time from ....table import Table from ...angle_utilities import angular_separation # It looks as though SLALIB, which AST relies on, assumes a simplified version # of the e-terms corretion, so we have to up the tolerance a bit to get things # to agree. TOLERANCE = 1.e-5 # arcseconds ROOT = os.path.dirname(os.path.abspath(__file__)) def test_fk4_no_e_fk5(): t = Table.read(os.path.join(ROOT, 'fk4_no_e_fk4.csv'), format='ascii') for i in range(len(t)): # Extract row r = t[i] # FK4 to FK5 c1 = FK4(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc')) c2 = c1.transform_to(FK4NoETerms) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk4ne']), np.radians(r['dec_fk4ne'])) assert np.degrees(diff) * 3600. < TOLERANCE # FK5 to FK4 c1 = FK4NoETerms(r['ra_in'], r['dec_in'], unit=(u.degree, u.degree), obstime=Time(r['obstime'], scale='utc')) c2 = c1.transform_to(FK4) # Find difference diff = angular_separation(c2.ra.radian, c2.dec.radian, np.radians(r['ra_fk4']), np.radians(r['dec_fk4'])) assert np.degrees(diff) * 3600. < TOLERANCE astropy-0.3/astropy/coordinates/tests/accuracy/galactic_fk4.csv0000644000175000017500000005050212243255342023200 0ustar oleole# This file was generated with the ref_galactic_fk4.py script, and the reference values were computed using AST equinox_fk4,obstime,lon_in,lat_in,ra_fk4,dec_fk4,lon_gal,lat_gal J1998.36,B1995.95,334.661793414,43.9385116594,215.729885213,-13.2119623291,95.9916336135,-10.7923599366 J2021.64,B1954.56,113.895199649,-14.1109832563,0.0191713429163,47.9584946764,230.354307383,2.91031092906 J2020.49,B1953.55,66.2107722038,-7.76265420193,307.0396671,25.0473933964,202.190459847,-36.2511029663 J1981.50,B1970.69,73.6417002791,41.7006137481,249.552478408,47.490161693,163.738209835,-0.997514227815 J2001.47,B1960.78,204.381010469,-14.9357743223,85.7262507794,0.592842446128,319.182343564,46.4865699629 J2005.96,B1975.98,214.396093073,-66.7648451487,38.7974895634,-25.3131215325,311.259111645,-5.26093959516 J2006.23,B1977.93,347.225227105,6.27744217753,251.681067557,-35.6975782982,82.4439145069,-48.3754431897 J2007.34,B1973.69,235.143754874,-5.59566003897,108.194271484,-22.3032173532,0.622684927771,37.7376079889 J1991.60,B1960.79,269.606389512,26.7823112195,159.265817549,-27.2400623832,52.4594618492,22.7351205489 J1980.71,B1961.97,235.285153507,-14.0695156888,99.5923664647,-26.0329761781,353.421599279,31.5338685058 J2003.56,B1960.84,269.177331338,42.9472695107,168.194363902,-13.373076419,69.4875812789,27.7142399301 J1990.10,B1982.78,346.070424986,-3.51848810713,260.556249219,-42.5373980474,71.1723254841,-55.2318229113 J1984.68,B1992.32,3.01978725896,7.19732176646,261.223075691,-22.5183053503,106.371052811,-54.3443814356 J2003.24,B1996.52,38.3199756112,18.8080489808,268.244155911,13.0679884186,153.915977612,-37.8861321281 J2005.52,B1990.02,107.533336957,-4.33088623215,345.276777715,55.2303472065,218.881057613,2.11460956182 J1977.27,B1984.04,236.30802591,14.3162535375,126.558516177,-13.1859909524,24.4040838917,47.3681313134 J2024.27,B1960.36,291.532518915,-33.7960784017,65.6262288958,-78.0827780664,4.70715132794,-21.1240080657 J1980.19,B1987.08,313.983328941,27.7572327639,204.395115343,-33.9974383642,72.5499341116,-11.3261456428 J1995.29,B1984.85,347.273135054,-13.6880685538,273.878542915,-46.5817989568,57.2967846205,-62.636282227 J2008.28,B1969.09,260.526724891,-37.6134342267,75.5423582477,-53.0108213216,349.993949344,-0.500521761262 J1984.85,B1992.51,231.291118043,-27.2371455509,84.3750724965,-27.2619452007,340.394703326,24.1136027935 J1987.09,B1976.41,258.283303492,-30.1025933842,87.5349107922,-50.9413101937,355.216758932,5.09769033822 J2006.16,B1994.65,168.335642599,-44.084769302,44.0040901708,7.58736494962,284.861051883,15.3412175718 J2014.94,B1991.03,117.210483914,32.8708634152,231.950026475,82.367116716,187.3264088,25.4619880653 J2002.23,B1961.43,158.272058119,-29.286471988,46.4761761399,24.2223508812,269.917276667,24.5785034911 J1984.88,B1991.03,262.688069789,-48.1516431413,57.7755536872,-52.5013674166,342.226051771,-7.92146528355 J2014.21,B1956.93,357.845250924,19.2890677934,248.037990583,-19.4340699812,103.672360905,-41.3775036599 J2015.72,B1974.12,243.674536239,-10.0431678136,108.027253494,-31.863249456,2.91619105856,28.4959537625 J2010.54,B1957.44,284.696106425,19.6051067047,170.340404941,-40.0951306839,51.2254926849,7.33605738412 J2022.20,B1972.41,61.5291328053,18.6403709997,277.730191309,33.3416109651,174.063892959,-24.5412790814 J2017.75,B1983.30,9.66573928438,-22.9075078717,295.17981175,-30.0450764744,85.3259571782,-84.8466105492 J2023.18,B1989.45,288.133287813,-36.6947385674,61.7090085882,-74.1820684991,0.817296879039,-19.4797887996 J1998.23,B1983.10,325.340113758,-33.7758802174,307.31206399,-69.6283338955,11.6623486171,-48.8815187305 J1999.25,B1985.58,8.88343575454,-49.4693354042,325.965770063,-35.6133692502,309.666273629,-67.4551398942 J2004.32,B1994.40,177.029034641,-67.7755279684,31.2372626731,-12.9650951893,296.955672515,-5.62000346764 J2022.10,B1957.08,189.451860246,-68.7071945134,33.5293665419,-17.1203080138,301.559917262,-5.75405801934 J1993.61,B1957.38,214.691763751,-32.6160600699,73.7224767298,-15.6028544376,323.538376206,26.6926709764 J2004.91,B1966.30,18.7047162369,-32.9080620608,308.505564328,-25.5373410674,263.547066418,-82.3338996972 J2005.68,B1951.59,322.232230099,14.4669345738,219.553504168,-44.4049264885,66.7343979667,-25.6090866517 J2003.00,B1984.39,262.175824918,51.7319974933,169.003247618,-3.42937646572,78.8860186239,33.5626186817 J1980.93,B1988.24,294.6060041,34.0181871087,184.771961476,-28.2403711462,68.3561968833,5.91397226579 J1995.15,B1967.50,180.08019102,26.2892216009,115.670140935,39.4176352042,214.406973761,78.6105433559 J1986.07,B1980.80,291.668187169,-22.2789167174,125.910652709,-78.6378819053,16.4272341834,-17.5632578893 J2014.41,B1997.92,34.548669268,-15.8924906144,297.966081457,-5.74276095396,188.103833481,-67.1344687124 J2013.20,B1964.55,78.8220157436,-37.4332268082,338.41386544,13.3803692475,241.413633182,-34.4957267196 J1983.72,B1984.33,93.1388621771,60.5731416456,215.515242863,51.025917079,153.788670192,19.0304556569 J2011.19,B1952.11,168.518071423,7.09229333513,86.7960140054,42.4095753728,249.125769518,59.3639239957 J2021.23,B1953.13,165.374352937,39.3890686842,133.539016217,52.7585931969,177.607817121,63.8456065457 J1998.80,B1990.72,255.423520875,-17.5881075751,104.861453622,-45.3027201728,3.92822669713,14.6469670383 J2020.65,B1971.83,64.0990821181,36.8289797648,256.321772318,39.914355366,162.091739264,-10.1708006469 J1996.87,B1969.60,191.321958369,-52.3532066605,47.9455555868,-9.26762335019,302.005131299,10.4906094438 J1978.29,B1966.53,60.3872023631,25.1025882655,269.550425169,34.4047511633,168.612591713,-20.2821406332 J1993.19,B1972.88,276.773010626,56.6051138031,178.703826596,-3.3434530167,85.5633134045,25.6194736799 J1984.47,B1991.77,334.141397682,37.3852087993,218.479404766,-19.0772794069,91.968516951,-15.9701580762 J1982.42,B1973.34,219.417716878,-20.2290328911,87.1109593231,-14.6004706289,334.420144542,35.926923956 J1985.55,B1971.06,54.0660580808,-29.3264933861,318.139103598,3.17485146412,226.277308044,-53.6788644695 J2018.98,B1978.54,176.26561333,-0.572718169429,83.8491889252,31.8061689325,269.795526718,58.0046040213 J2015.89,B1986.95,135.84418338,-9.94938261687,33.531734841,50.9381624137,238.492810285,23.3637333893 J2006.58,B1952.75,305.496508312,-8.63421746611,200.932667574,-71.3815196871,35.373262982,-23.9548001451 J2022.76,B1981.21,327.995002307,-58.3471659896,350.834964718,-54.0901563813,335.114901978,-45.751212695 J1980.95,B1981.05,138.185539617,11.9337947187,58.631520613,69.0711593141,218.447399995,36.9072609382 J2005.11,B1950.06,113.578525223,29.6301583121,263.636462216,81.3987773508,189.681688921,21.6122927944 J1991.57,B1980.14,204.621895006,36.5235009134,133.680798913,22.0411777739,78.808513096,76.2737160193 J2016.08,B1952.01,67.6144926088,-13.7094836718,313.132620076,22.6386092017,209.654020089,-37.5533649541 J2007.99,B1979.29,45.3029557779,36.4639084123,253.115407251,25.0961411128,150.086524604,-19.5316401959 J1996.13,B1972.42,247.534489816,-3.23349952461,117.046928774,-32.0174103517,11.9107776158,29.166414441 J2010.80,B1967.69,287.858418461,26.2825631559,176.528272624,-34.7137695077,58.5625336575,7.68664923227 J1985.76,B1996.68,206.473163472,-38.4312130715,65.3730874222,-11.8626802001,314.662473159,23.1067145187 J1975.84,B1963.36,350.362793376,-7.51631961926,267.890694432,-41.0314521815,72.0362114405,-61.1485139616 J1989.04,B1964.06,228.259575769,40.311002157,144.950655363,6.68810736787,66.3208521242,57.9479583999 J2005.09,B1975.25,319.831820932,40.7337792676,206.517019036,-20.3728721852,85.376518971,-6.19125657467 J1998.03,B1982.34,178.349313153,-38.3854710615,53.3367731423,6.47139870346,290.627978018,23.0870158337 J2010.53,B1998.53,126.58195076,-73.6980337652,14.0339286057,-10.7989965101,287.063023216,-19.6793830621 J1983.23,B1951.79,257.122932676,24.0154376566,147.559357599,-22.3222385045,45.3959106575,32.4293515474 J2022.01,B1971.16,181.414481921,-17.7858263698,71.6065443096,17.7205783522,287.370198984,43.7863289812 J2022.77,B1979.42,81.2295383474,-9.26450146427,319.219354065,35.7151156735,211.413414641,-23.6522137945 J2024.04,B1986.59,88.1907984871,32.4238226453,264.445366137,59.5075300274,177.63221018,2.82201785023 J1977.94,B1958.78,285.408252018,67.7826509035,186.006666089,5.9317624038,98.5359798987,24.0369224888 J2012.02,B1975.53,178.262069224,51.7327600597,149.616027267,42.1293667525,143.189803372,62.9449441105 J2005.03,B1975.01,329.433722424,-46.8960749035,333.526505486,-61.2774858546,350.879342803,-50.7102611905 J1979.45,B1994.64,340.333860195,36.5560891832,223.292370195,-17.1540759917,95.9213163317,-19.343112709 J2024.47,B1969.13,191.963602676,21.3572019706,114.434412024,27.503830072,291.719299139,84.2576478027 J2002.44,B1983.14,90.8973340407,3.44588414281,314.995461083,51.3170142615,204.308033362,-9.04466471803 J2008.72,B1952.34,259.510340943,47.0512387915,164.869262172,-6.16993929742,73.122316095,35.0776892287 J2011.24,B1987.56,132.277954966,30.4307232942,127.48825526,81.1338000052,193.90517209,37.3016929434 J2003.42,B1968.44,179.513439448,-54.44865752,42.0526470828,-4.9188999851,295.12094312,7.62776271377 J2001.37,B1997.40,81.5670170865,-19.9451944488,328.061837334,28.1928252216,222.515151909,-27.3578081826 J1982.54,B1967.36,127.283632829,-10.0946390302,19.6477131913,52.4470778861,233.960957731,16.5452929993 J1987.01,B1984.19,234.306643184,-86.4404274379,16.4715901103,-28.4445608636,305.546826719,-24.5135301459 J1995.13,B1991.23,112.65584231,11.2521500479,339.527728916,71.3900724033,207.206370175,13.7939581949 J1978.39,B1974.31,276.744760981,21.4151577082,162.407802968,-35.1255983687,49.8499233813,14.5681779743 J2012.92,B1999.21,281.461357214,-15.511897988,128.74174115,-66.9721136327,18.3606180783,-5.64535469428 J1992.13,B1980.19,306.867413859,-11.9467360888,207.123394118,-74.3365109128,32.8334594598,-26.7428218865 J2024.49,B1987.98,341.966066455,-2.82477813631,257.079269135,-45.5062849208,66.5166383458,-51.5988768204 J2019.43,B1984.23,38.6362483924,9.3322810896,277.298399175,9.29190831823,160.679381282,-46.0098367014 J2021.93,B1996.62,327.861128148,-46.529254733,334.498175895,-62.285753657,351.779204131,-49.5514803605 J2011.96,B1997.49,120.979858288,87.22617179,193.112689708,29.8355211732,125.900479598,27.8877168914 J1976.35,B1999.51,297.496953653,0.839666332936,181.085417356,-61.4154773919,40.6846762696,-12.8402998175 J1994.12,B1956.31,323.316228643,-0.794522598791,232.744583525,-57.172811607,53.4475657454,-35.7640525677 J1975.53,B1998.83,15.3775095611,-38.7740290611,313.687711979,-29.7532661336,292.123823728,-78.249288242 J1978.26,B1961.46,70.486199672,-24.0682131367,323.035235152,17.9223915313,223.250351558,-38.1828370964 J2009.07,B1959.30,106.020475905,36.6574903487,244.972778375,72.7878865437,180.327652321,18.0468441903 J2024.33,B1975.46,225.719957006,-24.2326924255,86.0366112823,-21.5082578389,337.38182103,29.8986234954 J2008.31,B1976.52,31.0403178442,23.2187819108,261.302299942,8.78047554861,143.772447485,-36.7511639142 J1995.76,B1964.13,51.4602071324,-27.0058546166,315.065766587,2.55796617517,221.775446591,-55.7242078312 J1977.06,B1965.51,185.697546923,55.594260797,153.338541661,37.440299398,131.049487592,61.2247044105 J2019.71,B1965.49,248.162878677,-23.7609450888,94.0591617121,-40.8224910786,354.392971779,16.4900856964 J2010.34,B1963.32,308.385291884,51.2349043028,196.476156832,-11.5444983515,88.2071202318,6.64482242886 J1998.94,B1979.67,233.050205996,63.3093356498,166.867510536,15.6637804493,98.5156204798,45.4612418027 J1985.78,B1960.86,209.382723191,-41.4659129842,63.4734186744,-15.1442383851,316.163237599,19.6100595169 J1979.09,B1970.12,256.001743835,-16.3448051664,106.649451565,-45.3254094121,5.44744564064,14.6683716892 J2008.66,B1964.43,90.8700685367,21.3678694408,287.008253726,60.3030901692,188.510594416,-0.450177420343 J2024.74,B1958.69,324.057486054,57.4352750563,204.387834151,-3.71156697525,98.8294418875,3.92980570683 J2004.68,B1961.29,159.225729446,-45.2472278228,37.9943842023,10.4609560801,279.445767043,11.4162684154 J2017.01,B1999.43,7.38749687642,-53.1540997613,330.796893447,-36.432735539,310.561617023,-63.5428435122 J1982.65,B1971.70,345.477965039,-10.1831007688,267.939382589,-46.5465175303,61.3892410717,-59.2635781091 J2018.81,B1991.41,234.801152081,71.8511934075,175.271116162,19.166721209,107.275353666,39.7113209648 J2002.24,B1978.63,184.754250038,-66.4894904918,34.1841541814,-14.4958117979,299.686716649,-3.81069739954 J2024.18,B1982.60,245.64829793,-38.7682176459,73.9547095701,-41.3059410321,341.54798842,7.97381666623 J2011.79,B1986.49,176.234540627,12.5643501076,97.7788131928,38.1835469935,252.339039389,68.6211958128 J1979.65,B1969.56,333.536461653,-55.645568776,343.316605394,-54.0790917446,336.652926202,-50.1180340532 J1989.61,B1969.64,185.716717981,-21.5568171888,70.5091730065,12.162471916,294.316919615,40.7880063819 J1988.65,B1992.98,25.9775574253,12.7249831044,268.242055984,-0.265815951959,142.501478254,-48.0628732689 J1978.56,B1990.50,204.302987352,-36.6989586206,66.0962720642,-9.57087489783,313.310472546,25.1146611916 J2009.00,B1991.83,221.487546141,22.5689795999,126.853873425,2.99323159891,29.3329007943,63.7844492045 J1986.24,B1959.40,338.956666009,-30.7135370512,297.785788922,-58.4349148844,18.009575125,-60.3855752943 J2002.57,B1967.98,149.5308077,21.1458572723,94.8524518306,65.0524091023,211.851072125,50.1739306174 J2013.49,B1974.10,95.1983908472,-1.61163007915,325.627893674,50.8317830992,210.781640873,-7.70049786191 J1985.59,B1998.30,35.0615395317,-28.6207880841,309.362547589,-10.9681750175,222.2815235,-70.2039555167 J1989.64,B1978.17,174.903919876,-25.7547140538,60.6700456981,17.1698957102,283.434726362,34.3456435324 J1992.82,B1991.38,167.27863063,54.1842744725,155.134423626,47.955156172,150.615261991,57.1592810224 J2022.82,B1953.81,10.7133541168,-26.6356033619,299.700062775,-30.2854018223,42.0331929301,-87.8059255496 J2008.01,B1977.66,249.939886269,43.0233288254,157.107675338,-4.65986958657,67.7233796,41.7069452763 J2022.53,B1977.40,258.100960451,-37.3838036503,76.1621887374,-51.0815347034,348.967532389,1.36680578377 J1979.84,B1995.27,262.732112385,-19.8057986634,105.205356822,-52.5372854117,6.11993733263,7.43500801549 J1988.23,B1968.47,149.166366188,63.2857703333,174.688450428,50.0778473898,148.575911001,44.2672282651 J1988.61,B1995.06,5.4355841259,0.695799807062,268.674810006,-23.9106016257,107.664837783,-61.2469672937 J2016.75,B1957.03,327.231056694,-11.1377396332,252.951382603,-62.1498935414,44.0578705009,-44.1656816269 J2015.64,B1954.96,284.17633852,-71.0631656787,21.4861837786,-44.7317770239,324.040057511,-25.8326289675 J1989.69,B1998.66,59.4717008987,14.0960045791,281.495047329,29.7732755945,176.567960403,-28.6862393249 J2007.49,B1997.10,112.602946077,-17.7763932222,359.226063676,44.0329923131,233.074018942,0.179492159778 J1996.05,B1979.55,219.940310095,-26.5130440909,81.4465458752,-17.5043303516,331.149281423,30.3269968045 J1978.73,B1952.60,131.216503219,-60.6790709392,16.634154156,1.81850032112,276.99056645,-10.9885663722 J2011.94,B1952.51,56.1738921125,-19.3427782341,311.186999671,10.4337104739,211.304689863,-49.7748029903 J2004.27,B1966.23,63.8293728328,-59.8347944156,346.99277437,-9.45023426908,270.969703277,-42.5256665899 J1992.23,B1968.79,312.440281577,-82.909075449,11.3540896839,-34.157150499,310.093208312,-30.498791986 J1987.90,B1988.21,104.43408064,-66.6447299251,5.45340291535,-4.88740816946,277.212698727,-24.1397093769 J1989.59,B1992.96,210.664663673,-17.5831928536,86.0165552167,-5.98416607071,326.19870132,41.9722447163 J2013.49,B1977.29,163.438155327,-54.6954182678,35.0847453795,1.14728902679,286.284423558,4.38048943444 J1996.22,B1966.19,148.024127582,2.32865180198,61.1653789554,55.4628176364,235.147968548,40.5062869945 J1989.43,B1970.29,317.748400264,-34.6457182874,316.831643302,-75.2962612516,9.65732035894,-42.8175894028 J1988.21,B1955.48,249.374885326,79.5246095403,183.718980722,20.6913682813,112.565520636,32.5641832214 J1988.85,B1956.86,100.53840787,-27.7507223648,349.546329312,30.9972476643,237.218549213,-14.0500966148 J2017.12,B1987.27,23.1984832267,21.1208388177,259.952338902,1.35554765265,135.43691251,-40.8550069313 J1983.48,B1993.82,71.5045009532,3.00896662959,299.603452073,35.2702997539,194.634394328,-25.8112525209 J1987.60,B1962.95,335.405788093,-6.90098238794,255.324007551,-53.1294372006,55.8410528163,-49.2268304977 J2004.59,B1984.28,307.588884401,18.8511389183,199.036872823,-43.8235513129,61.4614776755,-11.7984990917 J2023.77,B1967.96,343.704504442,-46.9224252956,326.142463635,-52.3943400975,344.29956144,-59.491008965 J1975.21,B1950.30,18.8112053675,35.1485289159,245.286476487,4.93182941858,128.71934377,-27.3093230426 J1987.00,B1988.06,208.609805013,-46.3894275721,58.5433364885,-16.5301679525,314.238428253,15.0130783715 J2011.33,B1970.70,172.978655994,15.4172636989,99.5237786852,42.2246688539,240.910040544,68.0540051284 J1987.54,B1966.69,7.8152324312,-34.9365736294,307.969684049,-34.8499910529,330.146180835,-81.2012202729 J2020.91,B1963.90,134.503366944,-72.4111269318,16.6485961895,-9.74558853146,287.251430013,-17.0236932061 J2000.41,B1979.63,149.073048424,14.7065160273,81.1217800627,62.690435672,220.791567295,47.4907829088 J2000.13,B1966.26,217.406604209,16.5186514295,119.582956349,3.61620654175,12.9778311665,64.930795113 J2010.62,B1996.84,241.829541848,16.5114334946,131.926345089,-16.4641006337,30.2129120083,43.7266326194 J2006.99,B1954.80,301.991652158,46.8228690265,192.281654734,-16.0819438067,82.1831278354,7.65942031664 J1989.22,B1994.16,280.629434995,-19.0017596678,119.763163085,-67.9434807772,15.0327362766,-6.7748272396 J1975.49,B1978.40,144.252375855,-10.2581330338,44.2663724488,47.1780541535,244.906125318,30.0146889384 J2004.74,B1953.10,286.0305233,12.7464714044,168.403291875,-46.9082451034,45.684929198,3.05860565516 J2017.05,B1993.75,321.524751743,61.8464645226,201.729972147,0.142282640146,100.9998867,8.01195048206 J1999.33,B1961.24,94.4962887092,-44.0946278203,352.197455758,14.1646347321,251.750996447,-24.2178084719 J2014.04,B1989.97,356.110922656,-39.1892569317,312.562642311,-44.4976591581,347.918750957,-71.4003276728 J1995.63,B1990.09,307.190555646,-43.7191034979,2.19409366458,-73.0808365619,356.907677491,-35.5140842361 J1993.99,B1951.45,263.331776174,25.1917278571,153.169840501,-25.2115873395,48.721484719,27.5451183286 J2019.92,B1981.35,128.003624894,58.8666544649,188.132407462,57.9560573023,158.151363881,35.6484565698 J2019.84,B1980.23,317.984216655,-8.89508525523,234.105102561,-66.9359336144,41.2540921899,-35.0019322625 J2011.02,B1953.91,312.465272698,5.18400310772,210.387316474,-56.4513187131,52.2045687218,-23.2783213403 J1989.24,B1988.65,344.0759205,-20.8070551085,282.194864755,-52.0563161521,40.4226717361,-63.1239129244 J1991.99,B1957.17,0.0386123471053,-42.7336081023,317.113101073,-41.6722671173,333.272026627,-71.3154908857 J1989.26,B1973.18,5.95477509083,23.9728714179,248.645776385,-10.559858406,115.039830262,-38.4244563396 J2013.98,B1954.86,113.065220613,27.4191705733,278.378621564,81.2392172048,191.670829361,20.3160887911 J1975.23,B1978.49,358.313822853,67.0446512684,211.780718733,12.9835628445,117.438946252,4.91999007663 J1979.23,B1970.19,53.5839203362,-15.011852649,305.729478083,10.5974755105,203.68085793,-50.0750506428 J1997.07,B1979.33,60.2557627351,25.6833225299,269.003573186,34.456942967,167.932574018,-20.1669832622 J1987.55,B1987.44,273.08593329,76.4393919681,185.756212072,15.2737854446,107.678579719,28.6298222935 J2020.29,B1994.48,25.0306798156,-51.1202356021,329.572709072,-25.482154153,285.52934787,-64.2572780699 J2019.04,B1968.97,253.970437895,31.094899255,151.036217235,-15.4523165082,52.7995114065,37.292668285 J2010.83,B1964.62,168.89950144,-43.2270950714,44.9384665428,8.00028298712,284.864643848,16.2980080563 J1986.93,B1975.46,3.66775780511,39.2622225734,235.238676188,-2.72528403932,115.361704733,-23.0060112816 J2021.26,B1976.64,278.936590632,6.21231840756,154.692659833,-49.4790598243,36.5657932055,6.53011956709 J2023.48,B1955.27,285.91236301,9.40548699672,166.481412833,-50.0386245303,42.5308356905,1.81955485147 J2003.91,B1952.30,53.8450026285,60.7259893436,226.147190382,33.5643817186,141.659779689,3.93637165962 J1988.45,B1981.10,8.53330744443,-7.54498028811,278.255981158,-25.1174817952,110.761077739,-69.9571108312 J1990.05,B1991.12,274.342957522,-1.24603088049,141.305593094,-52.2551761295,27.9749402015,6.88675256757 J2006.27,B1952.75,80.5212647616,19.4060625392,284.864123639,50.4777772377,185.129288864,-9.72047187101 J2013.99,B1989.90,94.3827831954,15.0883386826,301.493234394,60.9106556021,195.582917069,-0.623869405575 J1996.06,B1962.21,164.473020999,-47.6965440186,39.4946578672,6.36223553605,283.94830707,10.9316648861 J2007.85,B1990.18,89.9736906625,-16.9964263489,333.217747094,35.5496625256,222.809109826,-18.9265144618 J1996.18,B1964.91,204.582082173,15.6789515837,113.317697869,14.3475448707,348.941256944,74.1578851882 astropy-0.3/astropy/coordinates/tests/__init__.py0000644000175000017500000000015512243255342020466 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) astropy-0.3/astropy/coordinates/tests/test_arrays.py0000644000175000017500000002141712243255342021273 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern import six from ...tests.helper import pytest import numpy as np from numpy import testing as npt from ... import units as u def test_angle_arrays(): """ Test arrays values with Angle objects. """ from .. import Angle # Tests incomplete a1 = Angle([0, 45, 90, 180, 270, 360, 720.], unit=u.degree) npt.assert_almost_equal([0., 45., 90., 180., 270., 360., 720.], a1.value) a2 = Angle(np.array([-90, -45, 0, 45, 90, 180, 270, 360]), unit=u.degree) npt.assert_almost_equal([-90, -45, 0, 45, 90, 180, 270, 360], a2.value) a3 = Angle(["12 degrees", "3 hours", "5 deg", "4rad"]) npt.assert_almost_equal([12., 45., 5., 229.18311805], a3.value) assert a3.unit == u.degree a4 = Angle(["12 degrees", "3 hours", "5 deg", "4rad"], u.radian) npt.assert_almost_equal(a4.degree, a3.value) assert a4.unit == u.radian a5 = Angle([0, 45, 90, 180, 270, 360], unit=u.degree) a6 = a5.sum() npt.assert_almost_equal(a6.value, 945.0) assert a6.unit is u.degree with pytest.raises(TypeError): # Arrays of Angle objects are not supported -- that's really # tricky to do correctly, if at all, due to the possibility of # nesting. a7 = Angle([a1, a2, a3], unit=u.degree) a8 = Angle(["04:02:02", "03:02:01", "06:02:01"], unit=u.degree) npt.assert_almost_equal(a8.value, [4.03388889, 3.03361111, 6.03361111]) a9 = Angle(np.array(["04:02:02", "03:02:01", "06:02:01"]), unit=u.degree) npt.assert_almost_equal(a9.value, a8.value) with pytest.raises(u.UnitsError): a10 = Angle(["04:02:02", "03:02:01", "06:02:01"]) def test_dms(): from .. import Angle from ..angle_utilities import dms_to_degrees a1 = Angle([0, 45.5, -45.5], unit=u.degree) d, m, s = a1.dms npt.assert_almost_equal(d, [0, 45, -45]) npt.assert_almost_equal(m, [0, 30, -30]) npt.assert_almost_equal(s, [0, 0, -0]) dms = a1.dms degrees = dms_to_degrees(*dms) npt.assert_almost_equal(a1.degree, degrees) a2 = Angle(dms, unit=u.degree) npt.assert_almost_equal(a2.radian, a1.radian) def test_hms(): from .. import Angle from ..angle_utilities import hms_to_hours a1 = Angle([0, 11.5, -11.5], unit=u.hour) h, m, s = a1.hms npt.assert_almost_equal(h, [0, 11, -11]) npt.assert_almost_equal(m, [0, 30, -30]) npt.assert_almost_equal(s, [0, 0, -0]) hms = a1.hms hours = hms_to_hours(*hms) npt.assert_almost_equal(a1.hour, hours) a2 = Angle(hms, unit=u.hour) npt.assert_almost_equal(a2.radian, a1.radian) def test_array_coordinates_creation(): """ Test creating coordinates from arrays. """ from .. import ICRS c = ICRS(np.array([1, 2]), np.array([3, 4]), unit=(u.deg, u.deg)) assert not c.isscalar with pytest.raises(ValueError): c = ICRS(np.array([1, 2]), np.array([3, 4, 5]), unit=(u.deg, u.deg)) with pytest.raises(ValueError): c = ICRS(np.array([1, 2]), np.array([[3, 4], [5, 6]]), unit=(u.deg, u.deg)) #make sure cartesian initialization also works c = ICRS(x=np.array([1, 2]), y=np.array([3, 4]), z=np.array([5, 6]), unit=u.kpc) #also ensure strings can be arrays c = ICRS(np.array(['1d0m0s', '2h02m00.3s']), np.array(['3d', '4d']), unit=(u.deg, u.deg)) #but invalid strings cannot with pytest.raises(ValueError): c = ICRS(np.array(['10m0s', '2h02m00.3s']), np.array(['3d', '4d']), unit=(u.deg, u.deg)) with pytest.raises(ValueError): c = ICRS(np.array(['1d0m0s', '2h02m00.3s']), np.array(['3x', '4d']), unit=(u.deg, u.deg)) def test_array_coordinates_distances(): """ Test creating coordinates from arrays and distances. """ from .. import ICRS #correct way ICRS(np.array([1, 2]), np.array([3, 4]), unit=(u.deg, u.deg), distance= [.1, .2] * u.kpc) with pytest.raises(ValueError): #scalar distance and array coordinates ICRS(np.array([1, 2]), np.array([[3, 4], [5, 6]]), unit=(u.deg, u.deg), distance= 2. * u.kpc) with pytest.raises(ValueError): #scalar coordinates and array distance ICRS(1., 2., unit=(u.deg, u.deg), distance= [.1, .2, 3.] * u.kpc) with pytest.raises(ValueError): #more distance values than coordinates ICRS(np.array([1, 2]), np.array([[3, 4], [5, 6]]), unit=(u.deg, u.deg), distance= [.1, .2, 3.] * u.kpc) @pytest.mark.parametrize(('arrshape', 'distance'), [((2, ), None), ((4, 2, 5), None), ((4, 2, 5), 2 * u.kpc)]) def test_array_coordinates_transformations(arrshape, distance): """ Test transformation on coordinates with array content (first length-2 1D, then a 3D array) """ from .. import ICRS, Galactic #M31 coordinates from test_transformations raarr = np.ones(arrshape) * 10.6847929 decarr = np.ones(arrshape) * 41.2690650 if distance is not None: distance = np.ones(arrshape) * distance c = ICRS(raarr, decarr, unit=(u.deg, u.deg), distance=distance) g = c.transform_to(Galactic) assert g.l.shape == arrshape npt.assert_array_almost_equal(g.l.degree, 121.17447049007306) npt.assert_array_almost_equal(g.b.degree, -21.57291080408368) if distance is not None: assert g.distance.unit == c.distance.unit #now make sure round-tripping works through FK5 - this exercises both static and dynamic transform matricies c2 = c.fk5.icrs npt.assert_array_almost_equal(c.ra, c2.ra) npt.assert_array_almost_equal(c.dec, c2.dec) assert c2.ra.shape == arrshape if distance is not None: assert c2.distance.unit == c.distance.unit #also make sure it's possible to get to FK4, which uses a direct transform function. fk4 = c.fk4 npt.assert_array_almost_equal(fk4.ra.degree, 10.0004, decimal=4) npt.assert_array_almost_equal(fk4.dec.degree, 40.9953, decimal=4) assert fk4.ra.shape == arrshape if distance is not None: assert fk4.distance.unit == c.distance.unit #now check the reverse transforms run cfk4 = fk4.icrs assert cfk4.ra.shape == arrshape def test_array_coordinates_string(): """ tests for string representations of aarray coordinates """ from .. import ICRS c = ICRS(np.array([1, 2]), np.array([3, 4]), unit=(u.deg, u.deg)) str(c) six.text_type(c) repr(c) assert repr(c) == '' #also check with distance c = ICRS(np.array([1, 2]), np.array([3, 4]), unit=(u.deg, u.deg), distance= u.kpc * [0.5, 1.5]) str(c) six.text_type(c) repr(c) print(repr(c)) assert repr(c) == '' def test_array_precession(): """ Ensures that FK5 coordinates as arrays precess their equinoxes """ from ...time import Time from .. import FK5 j2000 = Time('J2000', scale='utc') j1975 = Time('J1975', scale='utc') fk5 = FK5([1, 1.1], [0.5, 0.6], unit=(u.radian, u.radian)) assert fk5.equinox.jyear == j2000.jyear fk5_2 = fk5.precess_to(j1975) assert fk5_2.equinox.jyear == j1975.jyear npt.assert_array_less(0.05, np.abs(fk5.ra.degree - fk5_2.ra.degree)) npt.assert_array_less(0.05, np.abs(fk5.dec.degree - fk5_2.dec.degree)) def test_array_separation(): from .. import ICRS c1 = ICRS([0 , 0], [0, 0], unit=(u.degree, u.degree)) c2 = ICRS([1, 2], [0, 0], unit=(u.degree, u.degree)) npt.assert_array_almost_equal(c1.separation(c2).degree, [1, 2]) c3 = ICRS([0 , 3.], [0., 0], unit=(u.degree, u.degree), distance=[1 ,1.] * u.kpc) c4 = ICRS([1, 1.], [0., 0], unit=(u.degree, u.degree), distance=[1 ,1.] * u.kpc) #the 3-1 separation should be twice the 0-1 separation, but not *exactly* the same sep = c3.separation_3d(c4) sepdiff = sep[1] - (2 * sep[0]) assert abs(sepdiff.value) < 1e-5 assert sepdiff != 0 def test_array_indexing(): from .. import FK5Coordinates from ...time import Time ra = np.linspace(0, 360, 10) dec = np.linspace(-90, 90, 10) j1975 = Time(1975, format='jyear', scale='utc') c1 = FK5Coordinates(ra, dec, unit=(u.degree, u.degree), equinox=j1975) c2 = c1[4] assert c2.ra.degree == 160 assert c2.dec.degree == -10 c3 = c1[2:5] npt.assert_array_equal(c3.ra.degree, [80, 120, 160]) npt.assert_array_equal(c3.dec.degree, [-50, -30, -10]) c4 = c1[np.array([2, 5, 8])] npt.assert_array_equal(c4.ra.degree, [80, 200, 320]) npt.assert_array_equal(c4.dec.degree, [-50, 10, 70]) #now make sure the equinox is preserved assert c2.equinox == c1.equinox assert c3.equinox == c1.equinox assert c4.equinox == c1.equinox astropy-0.3/astropy/coordinates/tests/test_distance.py0000644000175000017500000001231312243255342021557 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) """ This includes tests for distances/cartesian points that are *not* in the API tests. Right now that's just regression tests. """ import numpy as np from numpy import testing as npt from ...tests.helper import pytest from ... import units as u def test_distance_change(): from .. import Longitude, Latitude, ICRS, Distance ra = Longitude("4:08:15.162342", unit=u.hour) dec = Latitude("-41:08:15.162342", unit=u.degree) c = ICRS(ra, dec) c.distance = Distance(1, unit=u.kpc) oldx = c.x.value assert (oldx - 0.35284083171901953) < 1e-10 #now x should increase when the distance increases c.distance = Distance(2, unit=u.kpc) assert c.x.value == oldx * 2 def test_distance_is_quantity(): """ test that distance behaves like a proper quantity """ from .. import Distance Distance(2 * u.kpc) d = Distance([2, 3.1], u.kpc) assert d.shape == (2,) a = d.view(np.ndarray) q = d.view(u.Quantity) a[0] = 1.2 q.value[1] = 5.4 assert d[0].value == 1.2 assert d[1].value == 5.4 q = u.Quantity(d, copy=True) q.value[1] = 0 assert q.value[1] == 0 assert d.value[1] != 0 def test_distmod(): from .. import Distance d = Distance(10, u.pc) assert d.distmod.value == 0 d = Distance(distmod=20) assert d.distmod.value == 20 assert d.kpc == 100 d = Distance(distmod=-1., unit=u.au) npt.assert_allclose(d.value, 1301442.9440836983) with pytest.raises(ValueError): d = Distance(value=d, distmod=20) with pytest.raises(ValueError): d = Distance(z=.23, distmod=20) def test_distance_in_coordinates(): """ test that distances can be created from quantities and that CartesianPoints can be built from them sucessfully """ from .. import Longitude, Latitude, ICRS, CartesianPoints ra = Longitude("4:08:15.162342", unit=u.hour) dec = Latitude("-41:08:15.162342", unit=u.degree) c = ICRS(ra, dec) c.distance = 2 * u.kpc # auto-converts #make sure cartesian stuff now works # do the internal method first, because the properties will fail with # unhelpful errors because __getattr_ is overridden by coordinates c._make_cart() # c.x, c.y, c.z and such are in test_api #make sure repr still works repr(c) assert isinstance(c.cartesian, CartesianPoints) def test_creating_cartesian_single(): """ test building cartesian points with the single-argument constructor """ from .. import CartesianPoints CartesianPoints(np.ones((3, 10)), unit=u.kpc) #allow dimensionless, too CartesianPoints(np.ones((3, 10)), unit=u.dimensionless_unscaled) with pytest.raises(u.UnitsError): CartesianPoints(np.ones((3, 10))) with pytest.raises(ValueError): CartesianPoints(np.ones((2, 10)), unit=u.kpc) #quantity version c = CartesianPoints(np.ones((3, 10)) * u.kpc) assert c.unit == u.kpc c = CartesianPoints(np.ones((3, 10)) * u.kpc, unit=u.Mpc) assert c.unit == u.Mpc def test_creating_cartesian_triple(): """ test building cartesian points with the `x`,`y`,`z` constructor """ from .. import CartesianPoints #make sure scalars are scalars c = CartesianPoints(1, 2, 3, unit=u.kpc) CartesianPoints(np.ones(10), np.ones(10), np.ones(10), unit=u.kpc) with pytest.raises(ValueError): #shapes must match CartesianPoints(np.ones(8), np.ones(12), np.ones(9), unit=u.kpc) #if one is a quantity, use that unit c = CartesianPoints(np.ones(10), np.ones(10), np.ones(10) * u.kpc) assert c.unit == u.kpc #convert when needed c = CartesianPoints(np.ones(10), np.ones(10), np.ones(10) * u.kpc, unit=u.Mpc) assert c.unit == u.Mpc assert c[2][0].value < .1 # conversion of kpc to Mpc should give much smaller, but do this for round-off with pytest.raises(u.UnitsError): CartesianPoints(np.ones(10) * u.Mpc, np.ones(10), np.ones(10) * u.kpc) def test_cartesian_operations(): """ more tests of CartesianPoints beyond those in test_api """ from .. import Longitude, Latitude from .. import CartesianPoints c = CartesianPoints(np.ones(10), np.ones(10), np.ones(10), unit=u.kpc) c2 = c + c assert c2.y[2].value == 2 assert c2.unit == c.unit c3 = c - c assert c3[1, 2].value == 0 r, lat, lon = c.to_spherical() assert r.unit == c.unit assert isinstance(lat, Latitude) assert isinstance(lon, Longitude) c4 = c * 3 assert c4.unit == c.unit #always preserve the CartesianPoint's units c5 = 3 * u.pc + c assert c5.unit == c.unit def test_cartesian_view(): """ test that the cartesian subclass properly deals with new views """ from .. import CartesianPoints c = CartesianPoints(np.ones(10), np.ones(10), np.ones(10), unit=u.kpc) c2 = CartesianPoints(c, copy=False) asarr = c.view(np.ndarray) assert np.all(asarr == 1) asarr.ravel()[0] = 2 assert not np.all(asarr == 1) assert not c.x[0] == 2 astropy-0.3/astropy/coordinates/tests/test_formatting.py0000644000175000017500000001175312243255342022146 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern import six from ...tests.helper import pytest from ..angles import Angle from ... import units as u def test_to_string_precision(): # There are already some tests in test_api.py, but this is a regression # test for the bug in issue #1319 which caused incorrect formatting of the # seconds for precision=0 angle = Angle(-1.23456789, unit=u.degree) assert angle.to_string(precision=3) == '-1d14m04.444s' assert angle.to_string(precision=1) == '-1d14m04.4s' assert angle.to_string(precision=0) == '-1d14m04s' angle2 = Angle(-1.23456789, unit=u.hourangle) assert angle2.to_string(precision=3, unit=u.hour) == '-1h14m04.444s' assert angle2.to_string(precision=1, unit=u.hour) == '-1h14m04.4s' assert angle2.to_string(precision=0, unit=u.hour) == '-1h14m04s' def test_to_string_decimal(): # There are already some tests in test_api.py, but this is a regression # test for the bug in issue #1323 which caused decimal formatting to not # work angle1 = Angle(2., unit=u.degree) assert angle1.to_string(decimal=True, precision=3) == '2.000' assert angle1.to_string(decimal=True, precision=1) == '2.0' assert angle1.to_string(decimal=True, precision=0) == '2' angle2 = Angle(3., unit=u.hourangle) assert angle2.to_string(decimal=True, precision=3) == '3.000' assert angle2.to_string(decimal=True, precision=1) == '3.0' assert angle2.to_string(decimal=True, precision=0) == '3' angle3 = Angle(4., unit=u.radian) assert angle3.to_string(decimal=True, precision=3) == '4.000' assert angle3.to_string(decimal=True, precision=1) == '4.0' assert angle3.to_string(decimal=True, precision=0) == '4' def test_to_string_formats(): a = Angle(1.113355, unit=u.deg) assert a.to_string(format='latex') == r'$1^\circ06{}^\prime48.078{}^{\prime\prime}$' assert a.to_string(format='unicode') == '1\xb006\u203248.078\u2033' a = Angle(1.113355, unit=u.hour) assert a.to_string(format='latex') == r'$1^\mathrm{h}06^\mathrm{m}48.078^\mathrm{s}$' assert a.to_string(format='unicode') == '1\u02b006\u1d5048.078\u02e2' a = Angle(1.113355, unit=u.radian) assert a.to_string(format='latex') == r'$1.11336\mathrm{rad}$' assert a.to_string(format='unicode') == '1.11336rad' def test_to_string_fields(): a = Angle(1.113355, unit=u.deg) assert a.to_string(fields=1) == r'1d' assert a.to_string(fields=2) == r'1d07m' assert a.to_string(fields=3) == r'1d06m48.078s' def test_sexagesimal_rounding_up(): a = Angle(359.9999999999, unit=u.deg) assert a.to_string(precision=None) == '360d00m00s' assert a.to_string(precision=4) == '360d00m00.0000s' assert a.to_string(precision=5) == '360d00m00.00000s' assert a.to_string(precision=6) == '360d00m00.000000s' assert a.to_string(precision=7) == '359d59m59.9999996s' a = Angle(3.999999, unit=u.deg) assert a.to_string(fields=2, precision=None) == '4d00m' assert a.to_string(fields=2, precision=1) == '4d00m' assert a.to_string(fields=2, precision=5) == '4d00m' assert a.to_string(fields=1, precision=1) == '4d' assert a.to_string(fields=1, precision=5) == '4d' def test_to_string_scalar(): a = Angle(1.113355, unit=u.deg) assert isinstance(a.to_string(), six.text_type) import numpy as np from .. import ICRS, FK4, FK4NoETerms, FK5, Galactic, AltAz @pytest.mark.parametrize('frame', [ICRS, FK4, FK4NoETerms, FK5]) def test_coordinate_to_string_vector_hms(frame): C = frame(np.arange(2)*12.05*u.deg, np.arange(2)*13.5*u.deg) assert C.to_string(precision=0) == ['-0h00m00s 0d00m00s', '0h48m12s 13d30m00s'] assert C.to_string(precision=1) == ['-0h00m00.0s 0d00m00.0s', '0h48m12.0s 13d30m00.0s'] @pytest.mark.parametrize('frame', [Galactic, AltAz]) def test_coordinate_to_string_vector_dms(frame): C = frame(np.arange(2)*12.05*u.deg, np.arange(2)*13.5*u.deg) assert C.to_string(precision=0) == ['-0d00m00s 0d00m00s', '12d03m00s 13d30m00s'] assert C.to_string(precision=1) == ['-0d00m00.0s 0d00m00.0s', '12d03m00.0s 13d30m00.0s'] @pytest.mark.parametrize('frame', [ICRS, FK4, FK4NoETerms, FK5]) def test_coordinate_to_string_scalar_hms(frame): C = frame(12.05*u.deg, 13.5*u.deg) assert C.to_string(precision=0) == '0h48m12s 13d30m00s' assert C.to_string(precision=1) == '0h48m12.0s 13d30m00.0s' @pytest.mark.parametrize('frame', [Galactic, AltAz]) def test_coordinate_to_string_scalar_dms(frame): C = frame(12.05*u.deg, 13.5*u.deg) assert C.to_string(precision=0) == '12d03m00s 13d30m00s' assert C.to_string(precision=1) == '12d03m00.0s 13d30m00.0s' def test_to_string_radian_with_precision(): """ Regression test for a bug that caused ``to_string`` to crash for angles in radians when specifying the precision. """ # Check that specifying the precision works a = Angle(3., unit=u.rad) assert a.to_string(precision=3, sep='fromunit') == '3.000rad' astropy-0.3/astropy/coordinates/tests/test_name_resolve.py0000644000175000017500000001133612243255342022450 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains tests for the name resolve convenience module. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import time import numpy as np from ..name_resolve import (get_icrs_coordinates, NameResolveError, SESAME_DATABASE, _parse_response) from ..builtin_systems import ICRS from ...extern.six.moves import urllib from ...tests.helper import remote_data, pytest from ... import units as u _cached_ngc3642 = dict() _cached_ngc3642["simbad"] = """# ngc 3642 #Q22523669 #=S=Simbad (via url): 1 %@ 503952 %I.0 NGC 3642 %C.0 LIN %C.N0 15.15.01.00 %J 170.5750583 +59.0742417 = 11:22:18.01 +59:04:27.2 %V z 1593 0.005327 [0.000060] D 2002LEDA.........0P %D 1.673 1.657 75 (32767) (I) C 2006AJ....131.1163S %T 5 =32800000 D 2011A&A...532A..74B %#B 140 #====Done (2013-Feb-12,16:37:11z)====""" _cached_ngc3642["vizier"] = """# ngc 3642 #Q22523677 #=V=VizieR (local): 1 %J 170.56 +59.08 = 11:22.2 +59:05 %I.0 {NGC} 3642 #====Done (2013-Feb-12,16:37:42z)====""" _cached_ngc3642["all"] = """# ngc3642 #Q22523722 #=S=Simbad (via url): 1 %@ 503952 %I.0 NGC 3642 %C.0 LIN %C.N0 15.15.01.00 %J 170.5750583 +59.0742417 = 11:22:18.01 +59:04:27.2 %V z 1593 0.005327 [0.000060] D 2002LEDA.........0P %D 1.673 1.657 75 (32767) (I) C 2006AJ....131.1163S %T 5 =32800000 D 2011A&A...532A..74B %#B 140 #=V=VizieR (local): 1 %J 170.56 +59.08 = 11:22.2 +59:05 %I.0 {NGC} 3642 #!N=NED : *** Could not access the server *** #====Done (2013-Feb-12,16:39:48z)====""" _cached_castor = dict() _cached_castor["all"] = """# castor #Q22524249 #=S=Simbad (via url): 1 %@ 983633 %I.0 NAME CASTOR %C.0 ** %C.N0 12.13.00.00 %J 113.649471640 +31.888282216 = 07:34:35.87 +31:53:17.8 %J.E [34.72 25.95 0] A 2007A&A...474..653V %P -191.45 -145.19 [3.95 2.95 0] A 2007A&A...474..653V %X 64.12 [3.75] A 2007A&A...474..653V %S A1V+A2Vm =0.0000D200.0030.0110000000100000 C 2001AJ....122.3466M %#B 179 #!V=VizieR (local): No table found for: castor #!N=NED: ****object name not recognized by NED name interpreter #!N=NED: ***Not recognized by NED: castor #====Done (2013-Feb-12,16:52:02z)====""" _cached_castor["simbad"] = """# castor #Q22524495 #=S=Simbad (via url): 1 %@ 983633 %I.0 NAME CASTOR %C.0 ** %C.N0 12.13.00.00 %J 113.649471640 +31.888282216 = 07:34:35.87 +31:53:17.8 %J.E [34.72 25.95 0] A 2007A&A...474..653V %P -191.45 -145.19 [3.95 2.95 0] A 2007A&A...474..653V %X 64.12 [3.75] A 2007A&A...474..653V %S A1V+A2Vm =0.0000D200.0030.0110000000100000 C 2001AJ....122.3466M %#B 179 #====Done (2013-Feb-12,17:00:39z)====""" @remote_data def test_names(): # First check that sesame is up if urllib.request.urlopen("http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame").getcode() != 200: pytest.skip("SESAME appears to be down, skipping test_name_resolve.py:test_names()...") with pytest.raises(NameResolveError): get_icrs_coordinates("m87h34hhh") try: icrs = get_icrs_coordinates("ngc 3642") except NameResolveError: ra,dec = _parse_response(_cached_ngc3642["all"]) icrs = ICRS(ra, dec, unit=(u.degree, u.degree)) icrs_true = ICRS("11h 22m 18.014s", "59d 04m 27.27s") np.testing.assert_almost_equal(icrs.ra.degree, icrs_true.ra.degree, 3) np.testing.assert_almost_equal(icrs.dec.degree, icrs_true.dec.degree, 3) try: icrs = get_icrs_coordinates("castor") except NameResolveError: ra,dec = _parse_response(_cached_castor["all"]) icrs = ICRS(ra, dec, unit=(u.degree, u.degree)) icrs_true = ICRS("07h 34m 35.87s", "+31d 53m 17.8s") np.testing.assert_almost_equal(icrs.ra.degree, icrs_true.ra.degree, 3) np.testing.assert_almost_equal(icrs.dec.degree, icrs_true.dec.degree, 3) @remote_data def test_database_specify(): # First check that sesame is up if urllib.request.urlopen("http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame").getcode() != 200: pytest.skip("SESAME appears to be down, skipping test_database_specify.py:test_names()...") name = "ngc 3642" for db in ["simbad", "vizier", "all"]: SESAME_DATABASE.set(db) try: icrs = ICRS.from_name(name) except NameResolveError: ra,dec = _cached_ngc3642[db] icrs = ICRS(ra, dec, unit=(u.degree, u.degree)) time.sleep(1) name = "castor" # Don't search ned or vizier since castor isn't in either for db in ["simbad", "all"]: SESAME_DATABASE.set(db) try: icrs = ICRS.from_name(name) except NameResolveError: ra,dec = _cached_castor[db] icrs = ICRS(ra, dec, unit=(u.degree, u.degree)) time.sleep(1) astropy-0.3/astropy/coordinates/tests/test_angular_separation.py0000644000175000017500000000330412243255342023643 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np # lon1, lat1, lon2, lat2 in degrees coords = [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1), (0, 0, 10, 0), (0, 0, 90, 0), (0, 0, 180, 0), (0, 45, 0, -45), (0, 60, 0, -30), (-135, -15, 45, 15), (100, -89, -80, 89), (0, 0, 0, 0), (0, 0, 1. / 60., 1. / 60.)] correct_seps = [1, 1, 1, 1, 10, 90, 180, 90, 90, 180, 180, 0, 0.023570225877234643] correctness_margin = 2e-10 def test_fk5_seps(): """ This tests if `separation` works for FK5Coordinate objects. This is a regression test for github issue #891 """ from astropy.coordinates import FK5 a = FK5(1., 1., unit=('deg', 'deg')) b = FK5(2., 2., unit=('deg', 'deg')) a.separation(b) def test_angsep(): """ Tests that the angular separation object also behaves correctly. """ from ...units import Quantity from ..angles import Angle from ..angle_utilities import angular_separation # check it both works with floats in radians, Quantities, or Angles for conv in (np.deg2rad, lambda x: Quantity(x, "deg"), lambda x: Angle(x, "deg")): for (lon1, lat1, lon2, lat2), corrsep in zip(coords, correct_seps): angsep = angular_separation(conv(lon1), conv(lat1), conv(lon2), conv(lat2)) assert np.fabs(angsep - conv(corrsep)) < conv(correctness_margin) astropy-0.3/astropy/coordinates/tests/test_matching.py0000644000175000017500000000756412243255342021573 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from numpy import testing as npt from ...tests.helper import pytest from ... import units as u """ These are the tests for coordinate matching. Note that this requires scipy. """ try: import scipy HAS_SCIPY = True except ImportError: HAS_SCIPY = False @pytest.mark.skipif(str('not HAS_SCIPY')) def test_matching_function(): from .. import ICRS from ..matching import match_coordinates_3d #this only uses match_coordinates_3d because that's the actual implementation cmatch = ICRS([4, 2.1], [0, 0], unit=(u.degree, u.degree)) ccatalog = ICRS([1, 2, 3, 4], [0, 0, 0, 0], unit=(u.degree, u.degree)) idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog) npt.assert_array_equal(idx, [3, 1]) npt.assert_array_almost_equal(d2d.degree, [0, 0.1]) assert d3d.value[0] == 0 idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog, nthneighbor=2) assert np.all(idx == 2) npt.assert_array_almost_equal(d2d.degree, [1, 0.9]) npt.assert_array_less(d3d.value, 0.02) @pytest.mark.skipif(str('not HAS_SCIPY')) def test_matching_function_3d_and_sky(): from .. import ICRS from ..matching import match_coordinates_3d, match_coordinates_sky cmatch = ICRS([4, 2.1], [0, 0], unit=(u.degree, u.degree), distance=[1, 5] * u.kpc) ccatalog = ICRS([1, 2, 3, 4], [0, 0, 0, 0], unit=(u.degree, u.degree), distance=[1, 1, 1, 5] * u.kpc) idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog) npt.assert_array_equal(idx, [2, 3]) npt.assert_array_almost_equal(d2d.degree, [1, 1.9]) npt.assert_array_less(d3d.value, [0.02, .2]) assert d3d.value[1] > 0.02 idx, d2d, d3d = match_coordinates_sky(cmatch, ccatalog) npt.assert_array_equal(idx, [2, 1]) npt.assert_array_almost_equal(d2d.degree, [1, 0.1]) npt.assert_array_less(d3d.value, [0.02, .2]) assert d3d.value[1] < 0.02 @pytest.mark.skipif(str('not HAS_SCIPY')) def test_kdtree_storage(): from .. import ICRS from ..matching import match_coordinates_3d cmatch = ICRS([4, 2.1], [0, 0], unit=(u.degree, u.degree)) ccatalog = ICRS([1, 2, 3, 4], [0, 0, 0, 0], unit=(u.degree, u.degree)) idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog, storekdtree=False) assert not hasattr(ccatalog, '_kdtree') idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog, storekdtree=True) assert hasattr(ccatalog, '_kdtree') assert not hasattr(ccatalog, 'tilsitcheese') idx, d2d, d3d = match_coordinates_3d(cmatch, ccatalog, storekdtree='tilsitcheese') assert hasattr(ccatalog, 'tilsitcheese') assert not hasattr(cmatch, 'tilsitcheese') @pytest.mark.skipif(str('not HAS_SCIPY')) def test_matching_method(): from .. import ICRS from ...utils import NumpyRNGContext from ..matching import match_coordinates_3d, match_coordinates_sky with NumpyRNGContext(987654321): cmatch = ICRS(np.random.rand(20) * 360., np.random.rand(20) * 180. - 90., unit=(u.degree, u.degree)) ccatalog = ICRS(np.random.rand(100) * 360., np.random.rand(100) * 180. - 90., unit=(u.degree, u.degree)) idx1, d2d1, d3d1 = cmatch.match_to_catalog_3d(ccatalog) idx2, d2d2, d3d2 = match_coordinates_3d(cmatch, ccatalog) npt.assert_array_equal(idx1, idx2) npt.assert_array_equal(d2d1, d2d2) npt.assert_array_equal(d3d1, d3d2) #should be the same as above because there's no distance, but just make sure this method works idx1, d2d1, d3d1 = cmatch.match_to_catalog_sky(ccatalog) idx2, d2d2, d3d2 = match_coordinates_sky(cmatch, ccatalog) npt.assert_array_equal(idx1, idx2) npt.assert_array_equal(d2d1, d2d2) npt.assert_array_equal(d3d1, d3d2) assert len(idx1) == len(d2d1) == len(d3d1) == 20 astropy-0.3/astropy/coordinates/tests/test_angles.py0000644000175000017500000002060612243255342021242 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) """Test initalization of angles not already covered by the API tests""" import numpy as np from numpy.testing.utils import assert_allclose from ..angles import Longitude, Latitude, Angle from ...tests.helper import pytest from ... import units as u def test_negative_zero_dms(): # Test for DMS parser a = Angle('-00:00:10', u.deg) assert_allclose(a.degree, -10. / 3600.) # Unicode minus a = Angle('\u221200:00:10', u.deg) assert_allclose(a.degree, -10. / 3600.) def test_negative_zero_dm(): # Test for DM parser a = Angle('-00:10', u.deg) assert_allclose(a.degree, -10. / 60.) def test_negative_zero_hms(): # Test for HMS parser a = Angle('-00:00:10', u.hour) assert_allclose(a.hour, -10. / 3600.) def test_negative_zero_hm(): # Test for HM parser a = Angle('-00:10', u.hour) assert_allclose(a.hour, -10. / 60.) def test_negative_sixty_hm(): # Test for HM parser a = Angle('-00:60', u.hour) assert_allclose(a.hour, -1.) def test_plus_sixty_hm(): # Test for HM parser a = Angle('00:60', u.hour) assert_allclose(a.hour, 1.) def test_negative_fifty_nine_sixty_dms(): # Test for DMS parser a = Angle('-00:59:60', u.deg) assert_allclose(a.degree, -1.) def test_plus_fifty_nine_sixty_dms(): # Test for DMS parser a = Angle('+00:59:60', u.deg) assert_allclose(a.degree, 1.) def test_negative_sixty_dms(): # Test for DMS parser a = Angle('-00:00:60', u.deg) assert_allclose(a.degree, -1. / 60.) def test_plus_sixty_dms(): # Test for DMS parser a = Angle('+00:00:60', u.deg) assert_allclose(a.degree, 1. / 60.) def test_angle_to_is_angle(): a = Angle('00:00:60', u.deg) assert isinstance(a, Angle) assert isinstance(a.to(u.rad), Angle) def test_angle_to_quantity(): a = Angle('00:00:60', u.deg) q = u.Quantity(a) assert isinstance(q, u.Quantity) assert q.unit is u.deg def test_quantity_to_angle(): a = Angle(1.0*u.deg) assert isinstance(a, Angle) with pytest.raises(u.UnitsError): Angle(1.0*u.meter) a = Angle(1.0*u.hour) assert isinstance(a, Angle) assert a.unit is u.hourangle with pytest.raises(u.UnitsError): Angle(1.0*u.min) def test_angle_string(): a = Angle('00:00:60', u.deg) assert str(a) == '0d01m00s' a = Angle('-00:00:10', u.hour) assert str(a) == '-0h00m10s' a = Angle(3.2, u.radian) assert str(a) == '3.2rad' a = Angle(4.2, u.microarcsecond) assert str(a) == '4.2uarcsec' a = Angle('1.0uarcsec') assert a.value == 1.0 assert a.unit == u.microarcsecond a = Angle("3d") assert_allclose(a.value, 3.0) assert a.unit == u.degree a = Angle('10"') assert_allclose(a.value, 10.0) assert a.unit == u.arcsecond a = Angle("10'") assert_allclose(a.value, 10.0) assert a.unit == u.arcminute def test_angle_repr(): assert 'Angle' in repr(Angle(0, u.deg)) assert 'Longitude' in repr(Longitude(0, u.deg)) assert 'Latitude' in repr(Latitude(0, u.deg)) a = Angle(0, u.deg) repr(a) def test_large_angle_representation(): """Test that angles above 360 degrees can be output as strings, in repr, str, and to_string. (regression test for #1413)""" a = Angle(350, u.deg) + Angle(350, u.deg) a.to_string() a.to_string(u.hourangle) repr(a) repr(a.to(u.hourangle)) str(a) str(a.to(u.hourangle)) def test_wrap_at_inplace(): a = Angle([-20, 150, 350, 360] * u.deg) out = a.wrap_at('180d', inplace=True) assert out is None assert np.all(a.degree == np.array([-20., 150., -10., 0.])) def test_latitude(): with pytest.raises(ValueError): lat = Latitude(['91d', '89d']) with pytest.raises(ValueError): lat = Latitude('-91d') lat = Latitude(['90d', '89d']) with pytest.raises(ValueError): lat[0] = 90.001 * u.deg with pytest.raises(ValueError): lat[0] = -90.001 * u.deg lat = Latitude(['90d', '89d']) assert lat[0] == 90 * u.deg assert lat[1] == 89 * u.deg assert np.all(lat == Angle(['90d', '89d'])) # conserve type on unit change (closes #1423) angle = lat.to('radian') assert type(angle) is Latitude # but not on calculations angle = lat - 190 * u.deg assert type(angle) is Angle assert angle[0] == -100 * u.deg lat = Latitude('80d') angle = lat / 2. assert type(angle) is Angle assert angle == 40 * u.deg angle = lat * 2. assert type(angle) is Angle assert angle == 160 * u.deg angle = -lat assert type(angle) is Angle assert angle == -80 * u.deg def test_longitude(): # Default wrapping at 360d with an array input lon = Longitude(['370d', '88d']) assert np.all(lon == Longitude(['10d', '88d'])) assert np.all(lon == Angle(['10d', '88d'])) # conserve type on unit change and keep wrap_angle (closes #1423) angle = lon.to('hourangle') assert type(angle) is Longitude assert angle.wrap_angle == lon.wrap_angle angle = lon[0] assert type(angle) is Longitude assert angle.wrap_angle == lon.wrap_angle angle = lon[1:] assert type(angle) is Longitude assert angle.wrap_angle == lon.wrap_angle # but not on calculations angle = lon / 2. assert np.all(angle == Angle(['5d', '44d'])) assert type(angle) is Angle assert not hasattr(angle, 'wrap_angle') angle = lon * 2. + 400 * u.deg assert np.all(angle == Angle(['420d', '576d'])) assert type(angle) is Angle # Test setting a mutable value and having it wrap lon[1] = -10 * u.deg assert np.all(lon == Angle(['10d', '350d'])) # Test wrapping and try hitting some edge cases lon = Longitude(np.array([0, 0.5, 1.0, 1.5, 2.0]) * np.pi, unit=u.radian) assert np.all(lon.degree == np.array([0., 90, 180, 270, 0])) lon = Longitude(np.array([0, 0.5, 1.0, 1.5, 2.0]) * np.pi, unit=u.radian, wrap_angle='180d') assert np.all(lon.degree == np.array([0., 90, -180, -90, 0])) # Wrap on setting wrap_angle property (also test auto-conversion of wrap_angle to an Angle) lon = Longitude(np.array([0, 0.5, 1.0, 1.5, 2.0]) * np.pi, unit=u.radian) lon.wrap_angle = '180d' assert np.all(lon.degree == np.array([0., 90, -180, -90, 0])) lon = Longitude('460d') assert lon == Angle('100d') lon.wrap_angle = '90d' assert lon == Angle('-260d') def test_wrap_at(): a = Angle([-20, 150, 350, 360] * u.deg) assert np.all(a.wrap_at(360 * u.deg).degree == np.array([340., 150., 350., 0.])) assert np.all(a.wrap_at(Angle(360, unit=u.deg)).degree == np.array([340., 150., 350., 0.])) assert np.all(a.wrap_at('360d').degree == np.array([340., 150., 350., 0.])) assert np.all(a.wrap_at('180d').degree == np.array([-20., 150., -10., 0.])) assert np.all(a.wrap_at(np.pi * u.rad).degree == np.array([-20., 150., -10., 0.])) # Test wrapping a scalar Angle a = Angle('190d') assert a.wrap_at('180d') == Angle('-170d') a = Angle(np.arange(-1000.0, 1000.0, 0.125), unit=u.deg) for wrap_angle in (270, 0.2, 0.0, 360.0, 500, -2000.125): aw = a.wrap_at(wrap_angle * u.deg) assert np.all(aw.degree >= wrap_angle - 360.0) assert np.all(aw.degree < wrap_angle) aw = a.to(u.rad).wrap_at(wrap_angle * u.deg) assert np.all(aw.degree >= wrap_angle - 360.0) assert np.all(aw.degree < wrap_angle) def test_is_within_bounds(): a = Angle([-20, 150, 350] * u.deg) assert a.is_within_bounds('0d', '360d') is False assert a.is_within_bounds(None, '360d') is True assert a.is_within_bounds(-30 * u.deg, None) is True a = Angle('-20d') assert a.is_within_bounds('0d', '360d') is False assert a.is_within_bounds(None, '360d') is True assert a.is_within_bounds(-30 * u.deg, None) is True def test_angle_mismatched_unit(): a = Angle('+6h7m8s', unit=u.degree) assert_allclose(a.value, 91.78333333333332) def test_regression_formatting_negative(): # Regression test for a bug that caused: # # >>> Angle(-1., unit='deg').to_string() # '-1d00m-0s' assert Angle(-0., unit='deg').to_string() == '-0d00m00s' assert Angle(-1., unit='deg').to_string() == '-1d00m00s' assert Angle(-0., unit='hour').to_string() == '-0h00m00s' assert Angle(-1., unit='hour').to_string() == '-1h00m00s' astropy-0.3/astropy/coordinates/tests/test_api.py0000644000175000017500000006134012243255342020542 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from numpy import testing as npt from ...tests.helper import pytest raises = pytest.raises from ...extern import six from ... import units as u from ..errors import ConvertError, IllegalSecondError, IllegalMinuteError, IllegalHourError try: import scipy # pylint: disable=W0611 except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True # notes from the original api document: ''' The emphasis of this package is that common tasks should be performed in as simple and intuitive manner as possible. Complex or unusual tasks are still possible, but should not interfere with the simplicity of common tasks. One design principle is that objects should silently accept parameters of any data type that can unambiguously be determined. Where data types are accepted, they should be specified as constants, not as strings. If an unknown unit is specified as a string, the code certainly cannot handle it. A note on units: Units (as with everything else in Python) are objects. Any instance of a "unit" keyword will only accept "Unit" objects, not bare strings. All commonly used units will be predefined in astropy.units (which is still under development). The exact syntax might change, but the ideas will not. Units may be specified as part of a string in an initializer (subscribing to the "accept and parse values that are unambiguous to a human reader" philosophy), but will not be accepted as a bare string anywhere else. On arrays: The interface outlined here only accepts scalar angles (and hence coordinates) - we will likely later expand it to allow arrays to be stored in these objects, but only after the scalar interfaces is complete and working. ''' def test_create_angles(): """ Tests creating and accessing Angle objects """ from .. import Angle ''' The "angle" is a fundamental object. The internal representation is stored in radians, but this is transparent to the user. Units *must* be specified rather than a default value be assumed. This is as much for self-documenting code as anything else. Angle objects simply represent a single angular coordinate. More specific angular coordinates (e.g. Longitude, Latitude) are subclasses of Angle.''' a1 = Angle(54.12412, unit=u.degree) a2 = Angle("54.12412", unit=u.degree) a3 = Angle("54:07:26.832", unit=u.degree) a4 = Angle("54.12412 deg") a5 = Angle("54.12412 degrees") a6 = Angle("54.12412°") # because we like Unicode a7 = Angle((54, 7, 26.832), unit=u.degree) a8 = Angle("54°07'26.832\"") # (deg,min,sec) *tuples* are acceptable, but lists/arrays are *not* # because of the need to eventually support arrays of coordinates a9 = Angle([54, 7, 26.832], unit=u.degree) npt.assert_allclose(a9.value, [54, 7, 26.832]) assert a9.unit is u.degree a10 = Angle(3.60827466667, unit=u.hour) a11 = Angle("3:36:29.7888000120", unit=u.hour) a12 = Angle((3, 36, 29.7888000120), unit=u.hour) # *must* be a tuple Angle(0.944644098745, unit=u.radian) with raises(u.UnitsError): Angle(54.12412) #raises an exception because this is ambiguous with raises(ValueError): a13 = Angle(12.34, unit="not a unit") a14 = Angle("12h43m32") # no trailing 's', but unambiguous a15 = Angle("5h4m3s") # single digits, no decimal a16 = Angle("1 d") a17 = Angle("1 degree") assert a16.degree == 1 assert a17.degree == 1 #ensure the above angles that should match do assert a1 == a2 == a3 == a4 == a5 == a6 == a7 npt.assert_allclose(a1.radian, a2.radian) npt.assert_allclose(a2.degree, a3.degree) npt.assert_allclose(a3.radian, a4.radian) npt.assert_allclose(a4.radian, a5.radian) npt.assert_allclose(a5.radian, a6.radian) npt.assert_allclose(a6.radian, a7.radian) #assert a10 == a11 == a12 # check for illegal ranges / values with raises(IllegalSecondError): a = Angle("12 32 99", unit=u.degree) with raises(IllegalMinuteError): a = Angle("12 99 23", unit=u.degree) with raises(IllegalSecondError): a = Angle("12 32 99", unit=u.hour) with raises(IllegalMinuteError): a = Angle("12 99 23", unit=u.hour) with raises(IllegalHourError): a = Angle("99 25 51.0", unit=u.hour) with raises(ValueError): a = Angle("12 25 51.0xxx", unit=u.hour) with raises(ValueError): a = Angle("12h34321m32.2s") assert a1 is not None def test_angle_ops(): """ Tests operations on Angle objects """ from .. import Angle # Angles can be added and subtracted. Multiplication and division by a # scalar is also permitted. A negative operator is also valid. All of # these operate in a single dimension. Attempting to multiply or divide two # Angle objects will raise an exception. a1 = Angle(3.60827466667, unit=u.hour) a2 = Angle("54:07:26.832", unit=u.degree) a1 + a2 # creates new Angle object a1 - a2 -a1 # division and multiplication have no unambiguous meaning here with raises(TypeError): a1 / a2 with raises(TypeError): a1 * a2 npt.assert_allclose((a1 * 2).hour, 2 * 3.6082746666700003) assert abs((a1 / 3.123456).hour - 3.60827466667 / 3.123456) < 1e-10 # commutativity assert (2 * a1).hour == (a1 * 2).hour a3 = Angle(a1) # makes a *copy* of the object, but identical content as a1 npt.assert_allclose(a1.radian, a3.radian) assert a1 is not a3 a4 = abs(-a1) assert a4.radian == a1.radian a5 = Angle(5.0, unit=u.hour) assert a5 > a1 assert a5 >= a1 assert a1 < a5 assert a1 <= a5 def test_angle_convert(): """ Test unit conversion of Angle objects """ from .. import Angle angle = Angle("54.12412", unit=u.degree) npt.assert_allclose(angle.hour, 3.60827466667) npt.assert_allclose(angle.radian, 0.944644098745) npt.assert_allclose(angle.degree, 54.12412) assert len(angle.hms) == 3 assert isinstance(angle.hms, tuple) assert angle.hms[0] == 3 assert angle.hms[1] == 36 npt.assert_allclose(angle.hms[2], 29.78879999999947) assert len(angle.dms) == 3 assert isinstance(angle.dms, tuple) assert angle.dms[0] == 54 assert angle.dms[1] == 7 npt.assert_allclose(angle.dms[2], 26.831999999992036) assert isinstance(angle.dms[0], float) assert isinstance(angle.hms[0], float) def test_angle_formatting(): """ Tests string formatting for Angle objects """ from .. import Angle ''' The string method of Angle has this signature: def string(self, unit=DEGREE, decimal=False, sep=" ", precision=5, pad=False): The "decimal" parameter defaults to False since if you need to print the Angle as a decimal, there's no need to use the "format" method (see above). ''' angle = Angle("54.12412", unit=u.degree) #__str__ is the default `format` assert str(angle) == angle.to_string() res = 'Angle as HMS: 3h36m29.7888s' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour)) == res res = 'Angle as HMS: 3:36:29.7888' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, sep=":")) == res res = 'Angle as HMS: 3:36:29.79' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, sep=":", precision=2)) == res # Note that you can provide one, two, or three separators passed as a # tuple or list res = 'Angle as HMS: 3h36m29.7888s' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, sep=("h", "m", "s"), precision=4)) == res res = 'Angle as HMS: 3-36|29.7888' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, sep=["-", "|"], precision=4)) == res res = 'Angle as HMS: 3-36-29.7888' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, sep="-", precision=4)) == res res = 'Angle as HMS: 03h36m29.7888s' assert "Angle as HMS: {0}".format(angle.to_string(unit=u.hour, precision=4, pad=True)) == res # Same as above, in degrees angle = Angle("3 36 29.78880", unit=u.degree) res = 'Angle as DMS: 3d36m29.7888s' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree)) == res res = 'Angle as DMS: 3:36:29.7888' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, sep=":")) == res res = 'Angle as DMS: 3:36:29.79' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, sep=":", precision=2)) == res # Note that you can provide one, two, or three separators passed as a # tuple or list res = 'Angle as DMS: 3d36m29.7888s' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, sep=("d", "m", "s"), precision=4)) == res res = 'Angle as DMS: 3-36|29.7888' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, sep=["-", "|"], precision=4)) == res res = 'Angle as DMS: 3-36-29.7888' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, sep="-", precision=4)) == res res = 'Angle as DMS: 03d36m29.7888s' assert "Angle as DMS: {0}".format(angle.to_string(unit=u.degree, precision=4, pad=True)) == res res = 'Angle as rad: 0.0629763rad' assert "Angle as rad: {0}".format(angle.to_string(unit=u.radian)) == res res = 'Angle as rad decimal: 0.0629763' assert "Angle as rad decimal: {0}".format(angle.to_string(unit=u.radian, decimal=True)) == res # check negative angles angle = Angle(-1.23456789, unit=u.degree) angle2 = Angle(-1.23456789, unit=u.hour) assert angle.to_string() == '-1d14m04.4444s' assert angle.to_string(pad=True) == '-01d14m04.4444s' assert angle.to_string(unit=u.hour) == '-0h04m56.2963s' assert angle2.to_string(unit=u.hour, pad=True) == '-01h14m04.4444s' assert angle.to_string(unit=u.radian, decimal=True) == '-0.0215473' def test_angle_format_roundtripping(): """ Ensures that the string represtation of an angle can be used to create a new valid Angle. """ from .. import Angle, Longitude, Latitude a1 = Angle(0, unit=u.radian) a2 = Angle(10, unit=u.degree) a3 = Angle(0.543, unit=u.degree) a4 = Angle('1d2m3.4s') assert Angle(str(a1)).degree == a1.degree assert Angle(str(a2)).degree == a2.degree assert Angle(str(a3)).degree == a3.degree assert Angle(str(a4)).degree == a4.degree #also check Longitude/Latitude ra = Longitude('1h2m3.4s') dec = Latitude('1d2m3.4s') npt.assert_allclose(Angle(str(ra)).degree, ra.degree) npt.assert_allclose(Angle(str(dec)).degree, dec.degree) def test_radec(): """ Tests creation/operations of Longitude and Latitude objects """ from .. import Longitude, Latitude, Angle from ...time import Time ''' Longitude and Latitude are objects that are subclassed from Angle. As with Angle, Longitude and Latitude can parse any unambiguous format (tuples, formatted strings, etc.). The intention is not to create an Angle subclass for every possible coordinate object (e.g. galactic l, galactic b). However, equatorial Longitude/Latitude are so prevalent in astronomy that it's worth creating ones for these units. They will be noted as "special" in the docs and use of the just the Angle class is to be used for other coordinate systems. ''' with raises(u.UnitsError): ra = Longitude("4:08:15.162342") # error - hours or degrees? with raises(u.UnitsError): ra = Longitude("-4:08:15.162342") # the "smart" initializer allows >24 to automatically do degrees, but the #Angle-based one does not #TODO: adjust in 0.3 for whatever behavior is decided on #ra = Longitude("26:34:15.345634") # unambiguous b/c hours don't go past 24 #npt.assert_allclose(ra.degree, 26.570929342) with raises(u.UnitsError): ra = Longitude("26:34:15.345634") #ra = Longitude(68) with raises(u.UnitsError): ra = Longitude(68) with raises(u.UnitsError): ra = Longitude(12) with raises(ValueError): ra = Longitude("garbage containing a d and no units") ra = Longitude("12h43m23s") npt.assert_allclose(ra.hour, 12.7230555556) ra = Longitude((56, 14, 52.52), unit=u.degree) # can accept tuples #TODO: again, fix based on >24 behavior #ra = Longitude((56,14,52.52)) with raises(u.UnitsError): ra = Longitude((56, 14, 52.52)) with raises(u.UnitsError): ra = Longitude((12, 14, 52)) # ambiguous w/o units ra = Longitude((12, 14, 52), unit=u.hour) ra = Longitude([56, 64, 52.2], unit=u.degree) # ...but not arrays (yet) # Units can be specified ra = Longitude("4:08:15.162342", unit=u.hour) #TODO: this was the "smart" initializer behavior - adjust in 0.3 appropriately ## Where Longitude values are commonly found in hours or degrees, declination is ## nearly always specified in degrees, so this is the default. #dec = Latitude("-41:08:15.162342") with raises(u.UnitsError): dec = Latitude("-41:08:15.162342") dec = Latitude("-41:08:15.162342", unit=u.degree) # same as above def test_create_coordinate(): """ Tests creation and basic attributes of coordinates """ ''' A coordinate marks a position on the sky. This is an object that contains two Angle objects. There are a wide array of coordinate systems that should be implemented, and it will be easy to subclass to create custom user-made coordinates with conversions to standard coordinates. ''' from .. import Angle, Longitude, Latitude, ICRS, Galactic from .. import AltAz ra = Longitude("4:08:15.162342", unit=u.hour) dec = Latitude("-41:08:15.162342", unit=u.degree) # ra and dec are Longitude and Latitude objects, or Angle objects c = ICRS(ra, dec) c = ICRS(Angle(4.137545095, u.hour), Angle(-41.137545095, u.degree)) c = ICRS("54.12412 deg", "-41:08:15.162342 deg") assert isinstance(c.dec, Latitude) # dec is a Latitude object #make sure ICRS has a working repr repr(c) npt.assert_allclose(dec.degree, -41.137545095) # We should be really robust in what we accept. with raises(u.UnitsError): c = ICRS("12 34 56 -56 23 21") # ambiguous with raises(TypeError): c = ICRS() # not allowed c = ICRS(ra="12 43 12", dec=dec, unit=(u.hour, u.hour)) with raises(TypeError): c = ICRS(ra="12 43 12", unit=(u.hour,)) with raises(TypeError): c = ICRS(ra="12h43m32", b="12:32:43") with raises(TypeError): c = ICRS(ra="12h43m32") with raises(TypeError): c = ICRS(dec="12 32 54") # It would be convenient to accept both (e.g. ra, dec) coordinates as a # single string in the initializer. This can lead to ambiguities # particularly when both are different units. The solution is to accept a # sequence for the "unit" keyword that one would expect to sent to Angle. # This must be a 2-sequence with the two elements' units. ICRS('4 23 43.43 +23 45 12.324', unit=(u.hour, u.degree)) # If one of them is None, try to guess for unambiguous cases ICRS('12h43m32 +23:45:12.324', unit=(None, u.degree)) # unit=None is the same as unit=(None, None) ICRS('12h43m32 +23d45m12.324s', unit=None) # Other types of coordinate systems have their own classes l = Angle(123.4, unit=u.degree) b = Angle(76.5, unit=u.degree) c = Galactic(l, b) # accepts Angle objects and Longitude/Latitude d = Galactic(ra, dec) #make sure Galactic has a working repr repr(c) assert isinstance(c.l, Angle) # *not* Longitude or Latitude assert isinstance(c.b, Angle) # *not* Longitude or Latitude #some coordinates require an equinox - this is given as an astropy.time.Time from ...time import Time alt = Angle(20.5, unit=u.degree) az = Angle(45, unit=u.degree) timeobj = Time('J2000', scale='utc') AltAz(alt, az, equinox=timeobj) #some also have an option for an observation time ICRS(12, 13, unit=(u.hour, u.degree), obstime=timeobj) #passing in a non-time object give a TypeError with raises(TypeError): ICRS(12, 13, unit=(u.hour, u.degree), obstime=2000.) #should also be able to initialize coordinates from other coord objects ICRS(ICRS(ra, dec)) newi = ICRS(c) # including from other types like Galactic # and it will auto-convert assert isinstance(newi, ICRS) assert newi.ra != c.l assert newi.dec != c.b def test_convert_api(): """ Tests the basic coordinate conversion functionality. """ from .. import Angle, Longitude, Latitude, ICRS, Galactic, AltAz from ..transformations import coordinate_alias, transform_function, master_transform_graph ''' Coordinate conversion occurs on-demand internally ''' ra = Longitude("4:08:15.162342", unit=u.hour) dec = Latitude("-41:08:15.162342", unit=u.degree) c = ICRS(ra=ra, dec=dec) npt.assert_allclose(c.galactic.l.degree, 245.28098, 5) assert isinstance(c.galactic.b, Angle) npt.assert_allclose(c.galactic.b.degree, -47.554501, 5) # can also explicitly specify a coordinate class to convert to gal = c.transform_to(Galactic) # can still convert back to equatorial using the shorthand assert gal.icrs.ra.to_string(unit=u.hour, sep=":", precision=2) == '4:08:15.16' with raises(ConvertError): # there's no way to convert to alt/az without a specified location c.transform_to(AltAz) # users can specify their own coordinates and conversions @coordinate_alias('my_coord') class CustomCoordinates(ICRS): pass @transform_function(ICRS, CustomCoordinates) def icrs_to_custom(icrs_coo): return CustomCoordinates(icrs_coo.ra.degree, icrs_coo.dec.degree + 2.5, unit=(u.degree, u.degree)) try: # allows both ways of converting mycoord1 = c.my_coord mycoord2 = c.transform_to(CustomCoordinates) assert isinstance(mycoord1, CustomCoordinates) assert isinstance(mycoord2, CustomCoordinates) finally: #be sure to remove the registered transform master_transform_graph._graph[ICRS][CustomCoordinates].unregister() def test_proj_separations(): """ Test angular separation functionality """ from .. import ICRS, Galactic, coordinate_alias, Angle ''' Angular separations between two points on a sphere are supported via the `separation` method. ''' c1 = ICRS(ra=0, dec=0, unit=(u.degree, u.degree)) c2 = ICRS(ra=0, dec=1, unit=(u.degree, u.degree)) sep = c2.separation(c1) #returns an Angle object assert isinstance(sep, Angle) assert sep.degree == 1 npt.assert_allclose(sep.arcminute, 60.) # these operations have ambiguous interpretations for points on a sphere with raises(TypeError): c1 + c2 with raises(TypeError): c1 - c2 ngp = Galactic(l=0, b=90, unit=(u.degree, u.degree)) ncp = ICRS(ra=0, dec=90, unit=(u.degree, u.degree)) # if there is a defined conversion between the relevant coordinate systems, # it will be automatically performed to get the right angular separation npt.assert_allclose(ncp.separation(ngp.icrs).degree, ncp.separation(ngp).degree) # distance from the north galactic pole to celestial pole npt.assert_allclose(ncp.separation(ngp.icrs).degree, 62.8716627659) @coordinate_alias('my_coord2') class CustomCoordinate(ICRS): pass # does not specify a coordinate transform c4 = CustomCoordinate(0, 0, unit=(u.degree, u.degree)) with raises(ConvertError): # raises an error if no conversion from the custom to equatorial # coordinates is available c4.separation(c1) def test_distances(): """ Tests functionality for Coordinate class distances and cartesian transformations. """ from .. import Distance, ICRS, Galactic, CartesianPoints from ...cosmology import WMAP5, WMAP7 ''' Distances can also be specified, and allow for a full 3D definition of a coordinate. ''' #try all the different ways to initialize a Distance distance = Distance(12, u.parsec) d2 = Distance(40, unit=u.au) d3 = Distance(value=5, unit=u.kpc) # need to provide a unit with raises(u.UnitsError): Distance(12) # standard units are pre-defined npt.assert_allclose(distance.lyr, 39.138765325702551) npt.assert_allclose(distance.km, 370281309776063.0) # Coordinate objects can be assigned a distance object, giving them a full # 3D position c = Galactic(l=158.558650, b=-43.350066, unit=(u.degree, u.degree)) c.distance = Distance(12, u.parsec) #can also set distances using tuple-format c.distance = (12, u.parsec) c.distance.parsec = 12 #or initialize distances via redshifts - this is actually tested in the #function below that checks for scipy. This is kept here as an example #c.distance = Distance(z=0.2) # uses current cosmology #with whatever your preferred cosmology may be #c.distance = Distance(z=0.2, cosmology=WMAP5) # Coordinate objects can be initialized with a distance using special # syntax #TODO: use this commented line once quantity is in #c1 = Galactic(l=158.558650, b=-43.350066, unit=u.degree, distance=12 * u.kpc) c1 = Galactic(l=158.558650, b=-43.350066, unit=(u.degree, u.degree), distance=Distance(12, u.kpc)) # Coordinate objects can be instantiated with cartesian coordinates # Internally they will immediately be converted to two angles + a distance c2 = Galactic(x=2, y=4, z=8, unit=u.parsec) sep12 = c1.separation_3d(c2) # returns a *3d* distance between the c1 and c2 coordinates # not that this does *not* assert isinstance(sep12, Distance) npt.assert_allclose(sep12.pc, 12005.784163916317, 10) ''' All spherical coordinate systems with distances can be converted to cartesian coordinates. ''' (x, y, z) = (c2.x, c2.y, c2.z) #this only computes the CartesianPoints *once*, and then caches it #note that the x/y/z are Quantity objects assert isinstance(x, u.Quantity) npt.assert_allclose(x.value, 2) npt.assert_allclose(y.value, 4) npt.assert_allclose(z.value, 8) cpt = c2.cartesian assert isinstance(cpt, CartesianPoints) npt.assert_allclose(cpt.x.value, 2) npt.assert_allclose(cpt.y.value, 4) npt.assert_allclose(cpt.z.value, 8) # with no distance, the unit sphere is assumed when converting to cartesian c3 = Galactic(l=158.558650, b=-43.350066, unit=(u.degree, u.degree), distance=None) unitcart = c3.cartesian npt.assert_allclose(((unitcart.x**2 + unitcart.y**2 + unitcart.z**2)**0.5).value, 1.0) # CartesianPoints objects can be added and subtracted, which are # vector/elementwise they can also be given as arguments to a coordinate # system csum = ICRS(c1.cartesian + c2.cartesian) npt.assert_allclose(csum.x.value, -8.12016610185) npt.assert_allclose(csum.y.value, 3.19380597435) npt.assert_allclose(csum.z.value, -8.2294483707) npt.assert_allclose(csum.ra.degree, 158.529401774) npt.assert_allclose(csum.dec.degree, -43.3235825777) npt.assert_allclose(csum.distance.kpc, 11.9942200501) @pytest.mark.skipif(str('not HAS_SCIPY')) def test_distances_scipy(): """ The distance-related tests that require scipy due to the cosmology module needing scipy integration routines """ from .. import Distance from ...cosmology import WMAP5 #try different ways to initialize a Distance d4 = Distance(z=0.23) # uses default cosmology - as of writing, WMAP7 npt.assert_allclose(d4.z, 0.23, rtol=1e-8) d5 = Distance(z=0.23, cosmology=WMAP5) npt.assert_allclose(d5.compute_z(WMAP5), 0.23, rtol=1e-8) d6 = Distance(z=0.23, cosmology=WMAP5, unit=u.km) npt.assert_allclose(d6.value, 3.5417046898762366e+22) def test_unicode(): """ This test could only possibly fail when `sys.getdefaultencoding()` is not `utf-8` -- but given a recent fix, is expected to pass on all platforms. """ from .. import ICRS u = six.text_type("12h46m11.086s -00d30m11.99s") c = ICRS(u) astropy-0.3/astropy/coordinates/tests/test_transformations.py0000644000175000017500000002254712243255342023230 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from math import fabs import numpy as np from numpy import testing as npt from ... import units as u from ..distances import Distance from .. import transformations as t from ..builtin_systems import ICRS, FK5, FK4, FK4NoETerms from ..builtin_systems import Galactic from ...tests.helper import pytest #Coordinates just for these tests. class TestCoo1(ICRS): pass class TestCoo2(ICRS): pass def test_transform_classes(): """ Tests the class-based/OO syntax for creating transforms """ t.FunctionTransform(TestCoo1, TestCoo2, lambda c: TestCoo2(c.ra.radian, c.dec.radian, unit=(u.radian, u.radian))) c1 = TestCoo1(1, 0.5, unit=(u.radian, u.radian)) c1._make_cart() c2 = c1.transform_to(TestCoo2) npt.assert_allclose(c2.ra.radian, 1) npt.assert_allclose(c2.dec.radian, 0.5) def matfunc(coo): return [[1, 0, 0], [0, coo.ra.degree, 0], [0, 0, 1]] t.DynamicMatrixTransform(TestCoo1, TestCoo2, matfunc) c3 = TestCoo1(1, 2, unit=(u.degree, u.degree)) c3._make_cart() c4 = c3.transform_to(TestCoo2) npt.assert_allclose(c4.ra.degree, 1) npt.assert_allclose(c4.ra.degree, 1) def test_transform_decos(): """ Tests the decorator syntax for creating transforms """ c1 = TestCoo1(1, 2, unit=(u.degree, u.degree)) @t.transform_function(TestCoo1, TestCoo2) def trans(coo1): return TestCoo2(coo1.ra.radian, coo1.dec.radian * 2, unit=(u.radian, u.radian)) c1._make_cart() c2 = c1.transform_to(TestCoo2) npt.assert_allclose(c2.ra.degree, 1) npt.assert_allclose(c2.dec.degree, 4) c3 = TestCoo1(x=1, y=1, z=2, unit=u.pc) @t.static_transform_matrix(TestCoo1, TestCoo2) def matrix(): return [[2, 0, 0], [0, 1, 0], [0, 0, 1]] c3._make_cart() c4 = c3.transform_to(TestCoo2) npt.assert_allclose(c4.x.value, 2) npt.assert_allclose(c4.y.value, 1) npt.assert_allclose(c4.z.value, 2) def test_coo_alias(): """ Tests the shortname/attribute-style accessing of transforms """ t.coordinate_alias('coo2', TestCoo2) t.FunctionTransform(TestCoo1, TestCoo2, lambda c: TestCoo2(c.ra, c.dec)) c1 = TestCoo1(1, 2, unit=(u.degree, u.degree)) assert c1.coo2.ra.degree == c1.ra.degree assert c1.coo2.dec.degree == c1.dec.degree def test_shortest_path(): class FakeTransform(object): def __init__(self, pri): self.priority = pri g = t.TransformGraph() #cheating by adding graph elements directly that are not classes - the #graphing algorithm still works fine with integers - it just isn't a valid #TransformGraph #the graph looks is a down-going diamond graph with the lower-right slightly #heavier and a cycle from the bottom to the top #also, a pair of nodes isolated from 1 g._graph[1][2] = FakeTransform(1) g._graph[1][3] = FakeTransform(1) g._graph[2][4] = FakeTransform(1) g._graph[3][4] = FakeTransform(2) g._graph[4][1] = FakeTransform(5) g._graph[5][6] = FakeTransform(1) path, d = g.find_shortest_path(1, 2) assert path == [1, 2] assert d == 1 path, d = g.find_shortest_path(1, 3) assert path == [1, 3] assert d == 1 path, d = g.find_shortest_path(1, 4) print('Cached paths:', g._shortestpaths) assert path == [1, 2, 4] assert d == 2 #unreachable path, d = g.find_shortest_path(1, 5) assert path is None assert d == float('inf') path, d = g.find_shortest_path(5, 6) assert path == [5, 6] assert d == 1 def test_sphere_cart(): """ Tests the spherical <-> cartesian transform functions """ from numpy.testing.utils import assert_allclose from ...utils import NumpyRNGContext from ..distances import spherical_to_cartesian, cartesian_to_spherical x, y, z = spherical_to_cartesian(1, 0, 0) npt.assert_allclose(x, 1) npt.assert_allclose(y, 0) npt.assert_allclose(z, 0) x, y, z = spherical_to_cartesian(0, 1, 1) npt.assert_allclose(x, 0) npt.assert_allclose(y, 0) npt.assert_allclose(z, 0) x, y, z = spherical_to_cartesian(5, 0, np.arcsin(4. / 5.)) npt.assert_allclose(x, 3) npt.assert_allclose(y, 4) npt.assert_allclose(z, 0) r, lat, lon = cartesian_to_spherical(0, 1, 0) npt.assert_allclose(r, 1) npt.assert_allclose(lat, 0) npt.assert_allclose(lon, np.pi / 2) #test round-tripping with NumpyRNGContext(13579): x, y, z = np.random.randn(3, 5) r, lat, lon = cartesian_to_spherical(x, y, z) x2, y2, z2 = spherical_to_cartesian(r, lat, lon) assert_allclose(x, x2) assert_allclose(y, y2) assert_allclose(z, z2) m31_sys = [(ICRS, 'icrs'), (FK5, 'fk5'), (FK4, 'fk4'), (Galactic, 'galactic')] m31_coo = [(10.6847929, 41.2690650), (10.6847929, 41.2690650), (10.0004738, 40.9952444), (121.1744050, -21.5729360)] m31_dist = Distance(770, u.kpc) convert_precision = 1 / 3600. # 1 arcsec roundtrip_precision = 1e-4 dist_precision = 1e-9 m31_params =[] for i in range(len(m31_sys)): for j in range(len(m31_sys)): if i < j: m31_params.append((m31_sys[i], m31_sys[j], m31_coo[i], m31_coo[j])) @pytest.mark.parametrize(('fromsys', 'tosys', 'fromcoo', 'tocoo'), m31_params) def test_m31_coord_transforms(fromsys, tosys, fromcoo, tocoo): """ This tests a variety of coordinate conversions for the Chandra point-source catalog location of M31 from NED. """ from ...time import Time coo1 = fromsys[0](fromcoo[0], fromcoo[1], unit=(u.degree, u.degree), distance=m31_dist) coo2 = coo1.transform_to(tosys[0]) if tosys[0] is FK4: coo2_prec = coo2.precess_to(Time('B1950', scale='utc')) assert fabs(coo2_prec.lonangle.degree - tocoo[0]) < convert_precision # <1 arcsec assert fabs(coo2_prec.latangle.degree - tocoo[1]) < convert_precision else: assert fabs(coo2.lonangle.degree - tocoo[0]) < convert_precision # <1 arcsec assert fabs(coo2.latangle.degree - tocoo[1]) < convert_precision assert fabs(coo2.distance.kpc - m31_dist.kpc) < dist_precision if fromsys[1] is not None: coo1_2 = getattr(coo2, fromsys[1]) # implicit `transform_to` call. #check round-tripping assert fabs(coo1_2.lonangle.degree - fromcoo[0]) < roundtrip_precision assert fabs(coo1_2.latangle.degree - fromcoo[1]) < roundtrip_precision assert fabs(coo1_2.distance.kpc - m31_dist.kpc) < dist_precision if tosys[1] is not None: coo2_2 = getattr(coo1_2, tosys[1]) assert fabs(coo2_2.lonangle.degree - coo2.lonangle.degree) < roundtrip_precision assert fabs(coo2_2.latangle.degree - coo2.latangle.degree) < roundtrip_precision assert fabs(coo2_2.distance.kpc - m31_dist.kpc) < dist_precision def test_precession(): """ Ensures that FK4 and FK5 coordinates precess their equinoxes """ from ...time import Time j2000 = Time('J2000', scale='utc') b1950 = Time('B1950', scale='utc') j1975 = Time('J1975', scale='utc') b1975 = Time('B1975', scale='utc') fk4 = FK4(1, 0.5, unit=(u.radian, u.radian)) assert fk4.equinox.byear == b1950.byear fk4_2 = fk4.precess_to(b1975) assert fk4_2.equinox.byear == b1975.byear fk5 = FK5(1, 0.5, unit=(u.radian, u.radian)) assert fk5.equinox.jyear == j2000.jyear fk5_2 = fk5.precess_to(j1975) assert fk5_2.equinox.jyear == j1975.jyear def test_alias_transform(): """ Tests the use of aliases to do trasnforms and also transforming from a system to itself. Also checks that `dir` correctly includes valid transforms """ c = ICRS(12.34, 56.78, unit=(u.hour, u.degree)) assert isinstance(c.galactic, Galactic) assert isinstance(c.icrs, ICRS) d = dir(c) assert 'galactic' in d assert 'fk4' in d assert 'fk5' in d def test_transform_path_pri(): """ This checks that the transformation path prioritization works by making sure the ICRS -> Gal transformation always goes through FK5 and not FK4. """ t.master_transform_graph.invalidate_cache() tpath, td = t.master_transform_graph.find_shortest_path(ICRS, Galactic) assert tpath == [ICRS, FK5, Galactic] assert td == 2 #but direct from FK4 to Galactic should still be possible tpath, td = t.master_transform_graph.find_shortest_path(FK4, Galactic) assert tpath == [FK4, FK4NoETerms, Galactic] assert td == 2 def test_obstime(): """ Checks to make sure observation time survives transforms, and that it's accounted for at least in FK4 <-> ICRS transformations """ from ...time import Time b1950 = Time('B1950', scale='utc') j1975 = Time('J1975', scale='utc') fk4_50 = FK4(1, 2, unit=(u.degree, u.degree), obstime=b1950) fk4_75 = FK4(1, 2, unit=(u.degree, u.degree), obstime=j1975) icrs_50 = fk4_50.transform_to(ICRS) icrs_75 = fk4_75.transform_to(ICRS) assert icrs_50.obstime == fk4_50.obstime assert icrs_75.obstime == fk4_75.obstime # now check that the resulting coordinates are *different* - they should be, # because the obstime is different assert (icrs_50.ra.degree != icrs_75.ra.degree and icrs_50.dec.degree != icrs_75.dec.degree) astropy-0.3/astropy/coordinates/errors.py0000644000175000017500000000771612243255342017113 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst ''' This module defines custom errors and exceptions used in astropy.coordinates. ''' from __future__ import (absolute_import, division, print_function, unicode_literals) from ..utils.exceptions import AstropyWarning __all__ = ['RangeError', 'BoundsError', 'IllegalHourError', 'IllegalMinuteError', 'IllegalSecondError', 'ConvertError', 'IllegalHourWarning', 'IllegalMinuteWarning', 'IllegalSecondWarning'] class RangeError(ValueError): """ Raised when some part of an angle is out of its valid range. """ class BoundsError(RangeError): """ Raised when an angle is outside of its user-specified bounds. """ class IllegalHourError(RangeError): """ Raised when an hour value is not in the range [0,24). Usage:: if not 0 <= hr < 24: raise IllegalHourError(hour) Parameters ---------- hour : int, float """ def __init__(self, hour): self.hour = hour def __str__(self): return "An invalid value for 'hours' was found ('{0}'); must be in the range [0,24).".format(self.hour) class IllegalHourWarning(AstropyWarning): """ Raised when an hour value is 24. Parameters ---------- hour : int, float """ def __init__(self, hour, alternativeactionstr=None): self.hour = hour self.alternativeactionstr = alternativeactionstr def __str__(self): message = "'hour' was found to be '{0}', which is not in range (-24, 24).".format(self.hour) if self.alternativeactionstr is not None: message += ' ' + self.alternativeactionstr return message class IllegalMinuteError(RangeError): """ Raised when an minute value is not in the range [0,60]. Usage: if not 0 <= min < 60: raise IllegalMinuteError(minute) Parameters ---------- minute : int, float """ def __init__(self, minute): self.minute = minute def __str__(self): return "An invalid value for 'minute' was found ('{0}'); should be in the range [0,60).".format(self.minute) class IllegalMinuteWarning(AstropyWarning): """ Raised when a minute value is 60. Parameters ---------- minute : int, float """ def __init__(self, minute, alternativeactionstr=None): self.minute = minute self.alternativeactionstr = alternativeactionstr def __str__(self): message = "'minute' was found to be '{0}', which is not in range [0,60).".format(self.minute) if self.alternativeactionstr is not None: message += ' ' + self.alternativeactionstr return message class IllegalSecondError(RangeError): """ Raised when an second value (time) is not in the range [0,60]. Usage: if not 0 <= sec < 60: raise IllegalSecondError(second) Parameters ---------- second : int, float """ def __init__(self, second): self.second = second def __str__(self): return "An invalid value for 'second' was found ('{0}'); should be in the range [0,60).".format(self.second) class IllegalSecondWarning(AstropyWarning): """ Raised when a second value is 60. Parameters ---------- second : int, float """ def __init__(self, second, alternativeactionstr=None): self.second = second self.alternativeactionstr = alternativeactionstr def __str__(self): message = "'second' was found to be '{0}', which is not in range [0,60).".format(self.second) if self.alternativeactionstr is not None: message += ' ' + self.alternativeactionstr return message # TODO: consider if this should be used to `units`? class UnitsError(ValueError): """ Raised if units are missing or invalid. """ class ConvertError(Exception): """ Raised if a coordinate system cannot be converted to another """ astropy-0.3/astropy/coordinates/earth_orientation.py0000644000175000017500000003325512243255342021312 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains standard functions for earth orientation, such as precession and nutation. This module is (currently) not intended to be part of the public API, but is instead primarily for internal use in `coordinates` """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ..time import Time from .. import units as u jd1950 = Time('B1950', scale='tai').jd jd2000 = Time('J2000', scale='utc').jd _asecperrad = u.radian.to(u.arcsec) def eccentricity(jd): """ Computes the eccentricity of the Earth's orbit at the requested Julian Date. Parameters ---------- jd : scalar or array-like julian date at which to compute the eccentricity returns ------- eccentricity : scalar or array The eccentricity in degrees (or array of eccentricities) References ---------- * Explanatory Supplement to the Astronomical Almanac: P. Kenneth Seidelmann (ed), University Science Books (1992). """ T = (jd - jd1950) / 36525.0 p = (-0.000000126, - 0.00004193, 0.01673011) return np.polyval(p, T) def mean_lon_of_perigee(jd): """ Computes the mean longitude of perigee of the Earth's orbit at the requested Julian Date. Parameters ---------- jd : scalar or array-like julian date at which to compute the mean longitude of perigee returns ------- mean_lon_of_perigee : scalar or array Mean longitude of perigee in degrees (or array of mean longitudes) References ---------- * Explanatory Supplement to the Astronomical Almanac: P. Kenneth Seidelmann (ed), University Science Books (1992). """ T = (jd - jd1950) / 36525.0 p = (0.012, 1.65, 6190.67, 1015489.951) return np.polyval(p, T) / 3600. def obliquity(jd, algorithm=2006): """ Computes the obliquity of the Earth at the requested Julian Date. Parameters ---------- jd : scalar or array-like julian date at which to compute the obliquity algorithm : int Year of algorithm based on IAU adoption. Can be 2006, 2000 or 1980. The 2006 algorithm is mentioned in Circular 179, but the canonical reference for the IAU adoption is apparently Hilton et al. 06 is composed of the 1980 algorithm with a precession-rate correction due to the 2000 precession models, and a description of the 1980 algorithm can be found in the Explanatory Supplement to the Astronomical Almanac. returns ------- obliquity : scalar or array Mean obliquity in degrees (or array of obliquities) References ---------- * Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351. 2000 * USNO Circular 179 * Explanatory Supplement to the Astronomical Almanac: P. Kenneth Seidelmann (ed), University Science Books (1992). """ T = (jd - jd2000) / 36525.0 if algorithm == 2006: p = (-0.0000000434, -0.000000576, 0.00200340, -0.0001831, -46.836769, 84381.406) corr = 0 elif algorithm == 2000: p = (0.001813, -0.00059, -46.8150, 84381.448) corr = -0.02524 * T elif algorithm == 1980: p = (0.001813, -0.00059, -46.8150, 84381.448) corr = 0 else: raise ValueError('invalid algorithm year for computing obliquity') return (np.polyval(p, T) + corr) / 3600. # TODO: replace this with SOFA equivalent def precession_matrix_Capitaine(fromepoch, toepoch): """ Computes the precession matrix from one julian epoch to another. The exact method is based on Capitaine et al. 2003, which should match the IAU 2006 standard. Parameters ---------- fromepoch : `~astropy.time.Time` The epoch to precess from. toepoch : `~astropy.time.Time` The epoch to precess to. Returns ------- pmatrix : 3x3 array Precession matrix to get from `fromepoch` to `toepoch` References ---------- USNO Circular 179 """ mat_fromto2000 = _precess_from_J2000_Capitaine(fromepoch.jyear).T mat_2000toto = _precess_from_J2000_Capitaine(toepoch.jyear) return np.dot(mat_2000toto, mat_fromto2000) def _precess_from_J2000_Capitaine(epoch): """ Computes the precession matrix from J2000 to the given Julian Epoch. Expression from from Capitaine et al. 2003 as expressed in the USNO Circular 179. This should match the IAU 2006 standard from SOFA. Parameters ---------- epoch : scalar The epoch as a julian year number (e.g. J2000 is 2000.0) """ from .angles import rotation_matrix T = (epoch - 2000.0) / 100.0 # from USNO circular pzeta = (-0.0000003173, -0.000005971, 0.01801828, 0.2988499, 2306.083227, 2.650545) pz = (-0.0000002904, -0.000028596, 0.01826837, 1.0927348, 2306.077181, -2.650545) ptheta = (-0.0000001274, -0.000007089, -0.04182264, -0.4294934, 2004.191903, 0) zeta = np.polyval(pzeta, T) / 3600.0 z = np.polyval(pz, T) / 3600.0 theta = np.polyval(ptheta, T) / 3600.0 return rotation_matrix(-z, 'z') *\ rotation_matrix(theta, 'y') *\ rotation_matrix(-zeta, 'z') def _precession_matrix_besselian(epoch1, epoch2): """ computes the precession matrix from one Besselian epoch to another using Newcomb's method. `epoch1` and `epoch2` are in besselian year numbers """ from .angles import rotation_matrix # tropical years t1 = (epoch1 - 1850.0) / 1000.0 t2 = (epoch2 - 1850.0) / 1000.0 dt = t2 - t1 zeta1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1 zeta2 = 30.240 - 0.27 * t1 zeta3 = 17.995 pzeta = (zeta3, zeta2, zeta1, 0) zeta = np.polyval(pzeta, dt) / 3600 z1 = 23035.545 + t1 * 139.720 + 0.060 * t1 * t1 z2 = 109.480 + 0.39 * t1 z3 = 18.325 pz = (z3, z2, z1, 0) z = np.polyval(pz, dt) / 3600 theta1 = 20051.12 - 85.29 * t1 - 0.37 * t1 * t1 theta2 = -42.65 - 0.37 * t1 theta3 = -41.8 ptheta = (theta3, theta2, theta1, 0) theta = np.polyval(ptheta, dt) / 3600 return rotation_matrix(-z, 'z') *\ rotation_matrix(theta, 'y') *\ rotation_matrix(-zeta, 'z') def _load_nutation_data(datastr, seriestype): """ Loads nutation series from data stored in string form. Seriestype can be 'lunisolar' or 'planetary' """ if seriestype == 'lunisolar': dtypes = [('nl', int), ('nlp', int), ('nF', int), ('nD', int), ('nOm', int), ('ps', float), ('pst', float), ('pc', float), ('ec', float), ('ect', float), ('es', float)] elif seriestype == 'planetary': dtypes = [('nl', int), ('nF', int), ('nD', int), ('nOm', int), ('nme', int), ('nve', int), ('nea', int), ('nma', int), ('nju', int), ('nsa', int), ('nur', int), ('nne', int), ('npa', int), ('sp', int), ('cp', int), ('se', int), ('ce', int)] else: raise ValueError('requested invalid nutation series type') lines = [l for l in datastr.split('\n') if not l.startswith('#') if not l.strip() == ''] lists = [[] for _ in dtypes] for l in lines: for i, e in enumerate(l.split(' ')): lists[i].append(dtypes[i][1](e)) return np.rec.fromarrays(lists, names=[e[0] for e in dtypes]) _nut_data_00b = """ #l lprime F D Omega longitude_sin longitude_sin*t longitude_cos obliquity_cos obliquity_cos*t,obliquity_sin 0 0 0 0 1 -172064161.0 -174666.0 33386.0 92052331.0 9086.0 15377.0 0 0 2 -2 2 -13170906.0 -1675.0 -13696.0 5730336.0 -3015.0 -4587.0 0 0 2 0 2 -2276413.0 -234.0 2796.0 978459.0 -485.0 1374.0 0 0 0 0 2 2074554.0 207.0 -698.0 -897492.0 470.0 -291.0 0 1 0 0 0 1475877.0 -3633.0 11817.0 73871.0 -184.0 -1924.0 0 1 2 -2 2 -516821.0 1226.0 -524.0 224386.0 -677.0 -174.0 1 0 0 0 0 711159.0 73.0 -872.0 -6750.0 0.0 358.0 0 0 2 0 1 -387298.0 -367.0 380.0 200728.0 18.0 318.0 1 0 2 0 2 -301461.0 -36.0 816.0 129025.0 -63.0 367.0 0 -1 2 -2 2 215829.0 -494.0 111.0 -95929.0 299.0 132.0 0 0 2 -2 1 128227.0 137.0 181.0 -68982.0 -9.0 39.0 -1 0 2 0 2 123457.0 11.0 19.0 -53311.0 32.0 -4.0 -1 0 0 2 0 156994.0 10.0 -168.0 -1235.0 0.0 82.0 1 0 0 0 1 63110.0 63.0 27.0 -33228.0 0.0 -9.0 -1 0 0 0 1 -57976.0 -63.0 -189.0 31429.0 0.0 -75.0 -1 0 2 2 2 -59641.0 -11.0 149.0 25543.0 -11.0 66.0 1 0 2 0 1 -51613.0 -42.0 129.0 26366.0 0.0 78.0 -2 0 2 0 1 45893.0 50.0 31.0 -24236.0 -10.0 20.0 0 0 0 2 0 63384.0 11.0 -150.0 -1220.0 0.0 29.0 0 0 2 2 2 -38571.0 -1.0 158.0 16452.0 -11.0 68.0 0 -2 2 -2 2 32481.0 0.0 0.0 -13870.0 0.0 0.0 -2 0 0 2 0 -47722.0 0.0 -18.0 477.0 0.0 -25.0 2 0 2 0 2 -31046.0 -1.0 131.0 13238.0 -11.0 59.0 1 0 2 -2 2 28593.0 0.0 -1.0 -12338.0 10.0 -3.0 -1 0 2 0 1 20441.0 21.0 10.0 -10758.0 0.0 -3.0 2 0 0 0 0 29243.0 0.0 -74.0 -609.0 0.0 13.0 0 0 2 0 0 25887.0 0.0 -66.0 -550.0 0.0 11.0 0 1 0 0 1 -14053.0 -25.0 79.0 8551.0 -2.0 -45.0 -1 0 0 2 1 15164.0 10.0 11.0 -8001.0 0.0 -1.0 0 2 2 -2 2 -15794.0 72.0 -16.0 6850.0 -42.0 -5.0 0 0 -2 2 0 21783.0 0.0 13.0 -167.0 0.0 13.0 1 0 0 -2 1 -12873.0 -10.0 -37.0 6953.0 0.0 -14.0 0 -1 0 0 1 -12654.0 11.0 63.0 6415.0 0.0 26.0 -1 0 2 2 1 -10204.0 0.0 25.0 5222.0 0.0 15.0 0 2 0 0 0 16707.0 -85.0 -10.0 168.0 -1.0 10.0 1 0 2 2 2 -7691.0 0.0 44.0 3268.0 0.0 19.0 -2 0 2 0 0 -11024.0 0.0 -14.0 104.0 0.0 2.0 0 1 2 0 2 7566.0 -21.0 -11.0 -3250.0 0.0 -5.0 0 0 2 2 1 -6637.0 -11.0 25.0 3353.0 0.0 14.0 0 -1 2 0 2 -7141.0 21.0 8.0 3070.0 0.0 4.0 0 0 0 2 1 -6302.0 -11.0 2.0 3272.0 0.0 4.0 1 0 2 -2 1 5800.0 10.0 2.0 -3045.0 0.0 -1.0 2 0 2 -2 2 6443.0 0.0 -7.0 -2768.0 0.0 -4.0 -2 0 0 2 1 -5774.0 -11.0 -15.0 3041.0 0.0 -5.0 2 0 2 0 1 -5350.0 0.0 21.0 2695.0 0.0 12.0 0 -1 2 -2 1 -4752.0 -11.0 -3.0 2719.0 0.0 -3.0 0 0 0 -2 1 -4940.0 -11.0 -21.0 2720.0 0.0 -9.0 -1 -1 0 2 0 7350.0 0.0 -8.0 -51.0 0.0 4.0 2 0 0 -2 1 4065.0 0.0 6.0 -2206.0 0.0 1.0 1 0 0 2 0 6579.0 0.0 -24.0 -199.0 0.0 2.0 0 1 2 -2 1 3579.0 0.0 5.0 -1900.0 0.0 1.0 1 -1 0 0 0 4725.0 0.0 -6.0 -41.0 0.0 3.0 -2 0 2 0 2 -3075.0 0.0 -2.0 1313.0 0.0 -1.0 3 0 2 0 2 -2904.0 0.0 15.0 1233.0 0.0 7.0 0 -1 0 2 0 4348.0 0.0 -10.0 -81.0 0.0 2.0 1 -1 2 0 2 -2878.0 0.0 8.0 1232.0 0.0 4.0 0 0 0 1 0 -4230.0 0.0 5.0 -20.0 0.0 -2.0 -1 -1 2 2 2 -2819.0 0.0 7.0 1207.0 0.0 3.0 -1 0 2 0 0 -4056.0 0.0 5.0 40.0 0.0 -2.0 0 -1 2 2 2 -2647.0 0.0 11.0 1129.0 0.0 5.0 -2 0 0 0 1 -2294.0 0.0 -10.0 1266.0 0.0 -4.0 1 1 2 0 2 2481.0 0.0 -7.0 -1062.0 0.0 -3.0 2 0 0 0 1 2179.0 0.0 -2.0 -1129.0 0.0 -2.0 -1 1 0 1 0 3276.0 0.0 1.0 -9.0 0.0 0.0 1 1 0 0 0 -3389.0 0.0 5.0 35.0 0.0 -2.0 1 0 2 0 0 3339.0 0.0 -13.0 -107.0 0.0 1.0 -1 0 2 -2 1 -1987.0 0.0 -6.0 1073.0 0.0 -2.0 1 0 0 0 2 -1981.0 0.0 0.0 854.0 0.0 0.0 -1 0 0 1 0 4026.0 0.0 -353.0 -553.0 0.0 -139.0 0 0 2 1 2 1660.0 0.0 -5.0 -710.0 0.0 -2.0 -1 0 2 4 2 -1521.0 0.0 9.0 647.0 0.0 4.0 -1 1 0 1 1 1314.0 0.0 0.0 -700.0 0.0 0.0 0 -2 2 -2 1 -1283.0 0.0 0.0 672.0 0.0 0.0 1 0 2 2 1 -1331.0 0.0 8.0 663.0 0.0 4.0 -2 0 2 2 2 1383.0 0.0 -2.0 -594.0 0.0 -2.0 -1 0 0 0 2 1405.0 0.0 4.0 -610.0 0.0 2.0 1 1 2 -2 2 1290.0 0.0 0.0 -556.0 0.0 0.0 """[1:-1] _nut_data_00b = _load_nutation_data(_nut_data_00b, 'lunisolar') # TODO: replace w/SOFA equivalent def nutation_components2000B(jd): """ Computes nutation components following the IAU 2000B specification Parameters ---------- jd : scalar epoch at which to compute the nutation components as a JD Returns ------- eps : float epsilon in radians dpsi : float dpsi in radians deps : float depsilon in raidans """ epsa = np.radians(obliquity(jd, 2000)) t = (jd - jd2000) / 36525 # Fundamental (Delaunay) arguments from Simon et al. (1994) via SOFA # Mean anomaly of moon el = ((485868.249036 + 1717915923.2178 * t) % 1296000) / _asecperrad # Mean anomaly of sun elp = ((1287104.79305 + 129596581.0481 * t) % 1296000) / _asecperrad # Mean argument of the latitude of Moon F = ((335779.526232 + 1739527262.8478 * t) % 1296000) / _asecperrad # Mean elongation of the Moon from Sun D = ((1072260.70369 + 1602961601.2090 * t) % 1296000) / _asecperrad # Mean longitude of the ascending node of Moon Om = ((450160.398036 + -6962890.5431 * t) % 1296000) / _asecperrad # compute nutation series using array loaded from data directory dat = _nut_data_00b arg = dat.nl * el + dat.nlp * elp + dat.nF * F + dat.nD * D + dat.nOm * Om sarg = np.sin(arg) carg = np.cos(arg) p1u_asecperrad = _asecperrad * 1e7 # 0.1 microasrcsecperrad dpsils = np.sum((dat.ps + dat.pst * t) * sarg + dat.pc * carg) / p1u_asecperrad depsls = np.sum((dat.ec + dat.ect * t) * carg + dat.es * sarg) / p1u_asecperrad # fixed offset in place of planetary tersm m_asecperrad = _asecperrad * 1e3 # milliarcsec per rad dpsipl = -0.135 / m_asecperrad depspl = 0.388 / m_asecperrad return epsa, dpsils + dpsipl, depsls + depspl # all in radians def nutation_matrix(epoch): """ Nutation matrix generated from nutation components. Matrix converts from mean coordinate to true coordinate as r_true = M * r_mean """ from .angles import rotation_matrix # TODO: implement higher precision 2006/2000A model if requested/needed epsa, dpsi, deps = nutation_components2000B(epoch.jd) # all in radians rot1 = rotation_matrix(-(epsa + deps), 'x', False) rot2 = rotation_matrix(-dpsi, 'z', False) rot3 = rotation_matrix(epsa, 'x', False) return rot1 * rot2 * rot3 astropy-0.3/astropy/coordinates/__init__.py0000644000175000017500000000131512243255342017323 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for celestial coordinates of astronomical objects. It also contains a framework for conversions between coordinate systems. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from .errors import * from .angles import * from .coordsystems import * from .distances import * from .transformations import * from .builtin_systems import * from .name_resolve import * from .matching import * from .old_builtin_systems_names import * # TODO: remove this in next version, along with module file __doc__ += builtin_systems._transform_graph_docs astropy-0.3/astropy/coordinates/builtin_systems.py0000644000175000017500000006222412243255342021027 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the implementations of specific coordinate systems and the conversions between them. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import inspect import textwrap import numpy as np from ..extern import six from .angles import Angle from .coordsystems import SphericalCoordinatesBase from ..time import Time from . import transformations from .. import units as u __all__ = ['ICRS', 'FK5', 'FK4', 'FK4NoETerms', 'Galactic', 'AltAz'] # The UTC time scale is not properly defined prior to 1960, so Time('B1950', # scale='utc') will emit a warning. Instead, we use Time('B1950', scale='tai') # which is equivalent, but does not emit a warning. _EQUINOX_J2000 = Time('J2000', scale='utc') _EQUINOX_B1950 = Time('B1950', scale='tai') #<--------------Coordinate definitions; transformations are below--------------> @transformations.coordinate_alias('icrs') class ICRS(SphericalCoordinatesBase): """ A coordinate in the ICRS. If you're looking for "J2000" coordinates, and aren't sure if you want to use this or `FK5`, you probably want to use ICRS. It's more well-defined as a catalog coordinate and is an inertial system. Parameters ---------- {params} obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to ICRS and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='ra', latnm='dec')) def __init__(self, *args, **kwargs): super(ICRS, self).__init__() self._obstime = kwargs.pop('obstime', None) if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(ICRS, self)._initialize_latlon('ra', 'dec', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'RA' _repr_lat_name = 'Dec' # Default format for to_string _default_string_style = 'hmsdms' @property def ra(self): return self._lonangle @property def dec(self): return self._latangle @property def equinox(self): return _EQUINOX_J2000 @property def obstime(self): if self._obstime is None: return self.equinox else: return self._obstime @transformations.coordinate_alias('fk5') class FK5(SphericalCoordinatesBase): """ A coordinate in the FK5 system. Parameters ---------- {params} equinox : `~astropy.time.Time`, optional The equinox for these coordinates. Defaults to J2000. obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to `FK5` and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='ra', latnm='dec')) def __init__(self, *args, **kwargs): super(FK5, self).__init__() self._equinox = kwargs.pop('equinox', _EQUINOX_J2000) self._obstime = kwargs.pop('obstime', None) if not isinstance(self._equinox, Time): raise TypeError('specified equinox is not a Time object') if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if not self._equinox.isscalar: raise ValueError('specified equinox is not a scalar') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(FK5, self)._initialize_latlon('ra', 'dec', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'RA' _repr_lat_name = 'Dec' # Default format for to_string _default_string_style = 'hmsdms' @property def ra(self): return self._lonangle @property def dec(self): return self._latangle @property def equinox(self): return self._equinox @property def obstime(self): if self._obstime is None: return self.equinox else: return self._obstime def precess_to(self, newequinox): """ Precesses the coordinates from their current `equinox` to a new equinox and returns the resulting coordinate. Parameters ---------- newequinox : `~astropy.time.Time` The equinox to precess these coordinates to. Returns ------- newcoord : FK5 The new coordinate """ from .earth_orientation import precession_matrix_Capitaine pmat = precession_matrix_Capitaine(self._equinox, newequinox) v = [self.x.value, self.y.value, self.z.value] x, y, z = np.dot(pmat.A, v) if self.distance is not None: return self.__class__(x=x, y=y, z=z, unit=self.distance.unit, equinox=newequinox) else: return self.__class__(x=x, y=y, z=z, equinox=newequinox) @transformations.coordinate_alias('fk4') class FK4(SphericalCoordinatesBase): """ A coordinate in the FK4 system. Parameters ---------- {params} equinox : `~astropy.time.Time`, optional The equinox for these coordinates. Defaults to B1950. obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to `FK4` and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='ra', latnm='dec')) def __init__(self, *args, **kwargs): super(FK4, self).__init__() self._equinox = kwargs.pop('equinox', _EQUINOX_B1950) self._obstime = kwargs.pop('obstime', None) if not isinstance(self._equinox, Time): raise TypeError('specified equinox is not a Time object') if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if not self._equinox.isscalar: raise ValueError('specified equinox is not a scalar') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(FK4, self)._initialize_latlon('ra', 'dec', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'RA' _repr_lat_name = 'Dec' # Default format for to_string _default_string_style = 'hmsdms' @property def ra(self): return self._lonangle @property def dec(self): return self._latangle @property def equinox(self): return self._equinox @property def obstime(self): if self._obstime is None: return self.equinox else: return self._obstime def precess_to(self, newequinox): """ Precesses the coordinates from their current `equinox` to a new equinox. Parameters ---------- newequinox : `~astropy.time.Time` The equinox to precess these coordinates to. Returns ------- newcoord : FK4 The new coordinate """ from .earth_orientation import _precession_matrix_besselian pmat = _precession_matrix_besselian(self._equinox.byear, newequinox.byear) v = [self.x.value, self.y.value, self.z.value] x, y, z = np.dot(pmat.A, v) if self.distance is not None: return self.__class__(x=x, y=y, z=z, unit=self.distance.unit, equinox=newequinox) else: return self.__class__(x=x, y=y, z=z, equinox=newequinox) @transformations.coordinate_alias('fk4_no_e') class FK4NoETerms(SphericalCoordinatesBase): """ A coordinate in the FK4 system. Parameters ---------- {params} equinox : `~astropy.time.Time`, optional The equinox for these coordinates. Defaults to B1950. obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to `FK4NoETerms` and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='ra', latnm='dec')) def __init__(self, *args, **kwargs): super(FK4NoETerms, self).__init__() self._equinox = kwargs.pop('equinox', _EQUINOX_B1950) self._obstime = kwargs.pop('obstime', None) if not isinstance(self._equinox, Time): raise TypeError('specified equinox is not a Time object') if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if not self._equinox.isscalar: raise ValueError('specified equinox is not a scalar') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(FK4NoETerms, self)._initialize_latlon('ra', 'dec', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'RA' _repr_lat_name = 'Dec' # Default format for to_string _default_string_style = 'hmsdms' @property def ra(self): return self._lonangle @property def dec(self): return self._latangle @property def equinox(self): return self._equinox @property def obstime(self): if self._obstime is None: return self.equinox else: return self._obstime def precess_to(self, newequinox): """ Precesses the coordinates from their current `equinox` to a new equinox. Parameters ---------- newequinox : `~astropy.time.Time` The equinox to precess these coordinates to. Returns ------- newcoord : FK4NoETerms The new coordinate """ from .earth_orientation import _precession_matrix_besselian pmat = _precession_matrix_besselian(self._equinox.byear, newequinox.byear) v = [self.x.value, self.y.value, self.z.value] x, y, z = np.dot(pmat.A, v) if self.distance is not None: return self.__class__(x=x, y=y, z=z, unit=self.distance.unit, equinox=newequinox) else: return self.__class__(x=x, y=y, z=z, equinox=newequinox) @transformations.coordinate_alias('galactic') class Galactic(SphericalCoordinatesBase): """ A coordinate in Galactic Coordinates. .. note:: Transformations from Galactic Coordinates to other systems are not well-defined because of ambiguities in the definition of Galactic Coordinates. See `Lie et al. 2011 ` for more details on this. Here, we use the `Reid & Brunthaler 2004 ` definition for converting to/from FK5, and assume the IAU definition applies for converting to FK4 *without* e-terms. Parameters ---------- {params} obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to `Galactic` and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='l', latnm='b')) # North galactic pole and zeropoint of l in FK4/FK5 coordinates. Needed for # transformations to/from FK4/5 # These are from Reid & Brunthaler 2004 _ngp_J2000 = FK5(192.859508, 27.128336, unit=(u.degree, u.degree)) _lon0_J2000 = Angle(122.932, unit=u.degree) # These are from the IAU's definition of galactic coordinates _ngp_B1950 = FK4(192.25, 27.4, unit=(u.degree, u.degree)) _lon0_B1950 = Angle(123, unit=u.degree) def __init__(self, *args, **kwargs): super(Galactic, self).__init__() self._obstime = kwargs.pop('obstime', None) if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(Galactic, self)._initialize_latlon('l', 'b', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'l' _repr_lat_name = 'b' # Default format for to_string _default_string_style = 'dms' @property def l(self): return self._lonangle @property def b(self): return self._latangle @transformations.coordinate_alias('altaz') class AltAz(SphericalCoordinatesBase): """ A coordinate in the altitude/azimuth or "horizontal" system. Parameters ---------- {params} equinox : `~astropy.time.Time`, optional The equinox for these coordinates. Defaults to J2000. obstime : `~astropy.time.Time` or None The time of observation for this coordinate. If None, it will be taken to be the same as the `equinox`. Alternatively, a single argument that is any kind of spherical coordinate can be provided, and will be converted to `AltAz` and used as this coordinate. """ __doc__ = __doc__.format(params=SphericalCoordinatesBase._init_docstring_param_templ.format(lonnm='az', latnm='el')) def __init__(self, *args, **kwargs): super(AltAz, self).__init__() self._equinox = kwargs.pop('equinox', _EQUINOX_J2000) self._obstime = kwargs.pop('obstime', None) if not isinstance(self._equinox, Time): raise TypeError('specified equinox is not a Time object') if self._obstime is not None and not isinstance(self._obstime, Time): raise TypeError('specified obstime is not None or a Time object') if not self._equinox.isscalar: raise ValueError('specified equinox is not a scalar') if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], SphericalCoordinatesBase): newcoord = args[0].transform_to(self.__class__) self._latangle = newcoord._latangle self._lonangle = newcoord._lonangle self._distance = newcoord._distance else: super(AltAz, self)._initialize_latlon('az', 'alt', args, kwargs) #strings used for making __repr__ work _repr_lon_name = 'az' _repr_lat_name = 'alt' # Default format for to_string _default_string_style = 'dms' @property def az(self): return self._lonangle @property def alt(self): return self._latangle @property def equinox(self): return self._equinox @property def obstime(self): if self._obstime is None: return self.equinox else: return self._obstime #<--------------------------------transformations------------------------------> # ICRS to/from FK5 @transformations.static_transform_matrix(ICRS, FK5) def icrs_to_fk5(): """ B-matrix from USNO circular 179 """ from .angles import rotation_matrix eta0 = -19.9 / 3600000. xi0 = 9.1 / 3600000. da0 = -22.9 / 3600000. m1 = rotation_matrix(-eta0, 'x') m2 = rotation_matrix(xi0, 'y') m3 = rotation_matrix(da0, 'z') return m1 * m2 * m3 # can't be static because the equinox is needed @transformations.dynamic_transform_matrix(FK5, ICRS) def fk5_to_icrs(fk5c): from .earth_orientation import _precess_from_J2000_Capitaine pmat = _precess_from_J2000_Capitaine(fk5c.equinox.jyear).T # transpose gets equinox -> J2000 fk5toicrsmat = icrs_to_fk5().T return fk5toicrsmat * pmat # FK4-NO-E to/from FK4 # In the present framework, we include two coordinate classes for FK4 # coordinates - one including the E-terms of aberration (FK4), and # one not including them (FK4NoETerms). In the following functions, # we describe the transformation between these two. def fk4_e_terms(equinox): """ Return the e-terms of aberation vector Parameters ---------- equinox : Time object The equinox for which to compute the e-terms """ from . import earth_orientation as earth # Constant of aberration at J2000 k = 0.0056932 # Eccentricity of the Earth's orbit e = earth.eccentricity(equinox.jd) e = np.radians(e) # Mean longitude of perigee of the solar orbit g = earth.mean_lon_of_perigee(equinox.jd) g = np.radians(g) # Obliquity of the ecliptic o = earth.obliquity(equinox.jd, algorithm=1980) o = np.radians(o) return e * k * np.sin(g), \ -e * k * np.cos(g) * np.cos(o), \ -e * k * np.cos(g) * np.sin(o) @transformations.transform_function(FK4, FK4NoETerms, priority=1) def fk4_to_fk4_no_e(fk4c): # Extract cartesian vector c = fk4c.cartesian r = np.asarray(c.reshape((3, c.size // 3))) # Find distance (for re-normalization) d_orig = np.sqrt(np.sum(r ** 2)) # Apply E-terms of aberration eterms_a = np.asarray(fk4_e_terms(fk4c.equinox)) r = r - eterms_a.reshape(3, 1) + np.dot(eterms_a, r) * r # Find new distance (for re-normalization) d_new = np.sqrt(np.sum(r ** 2)) # Renormalize r = r * d_orig / d_new subshape = c.shape[1:] x = r[0].reshape(subshape) y = r[1].reshape(subshape) z = r[2].reshape(subshape) newunit = None if fk4c.distance is None else fk4c.distance.unit return FK4NoETerms(x=x, y=y, z=z, unit=newunit, equinox=fk4c.equinox) @transformations.transform_function(FK4NoETerms, FK4, priority=1) def fk4_no_e_to_fk4(fk4c): # Extract cartesian vector c = fk4c.cartesian r = np.asarray(c.reshape((3, c.size // 3))) # Find distance (for re-normalization) d_orig = np.sqrt(np.sum(r ** 2)) # Apply E-terms of aberration eterms_a = np.asarray(fk4_e_terms(fk4c.equinox)) r0 = r.copy() for _ in range(10): r = (eterms_a.reshape(3, 1) + r0) / (1. + np.dot(eterms_a, r)) # Find new distance (for re-normalization) d_new = np.sqrt(np.sum(r ** 2)) # Renormalize r = r * d_orig / d_new subshape = c.shape[1:] x = r[0].reshape(subshape) y = r[1].reshape(subshape) z = r[2].reshape(subshape) newunit = None if fk4c.distance is None else fk4c.distance.unit return FK4(x=x, y=y, z=z, unit=newunit, equinox=fk4c.equinox) # FK5 to/from FK4 # These transformations are very slightly prioritized >1 (lower priority number means # better path) to prefer the FK5 path over FK4 when possible #can't be static because the equinox is needed # B1950->J2000 matrix from Murray 1989 A&A 218,325 eqn 28 B1950_TO_J2000_M = \ np.mat([[0.9999256794956877, -0.0111814832204662, -0.0048590038153592], [0.0111814832391717, 0.9999374848933135, -0.0000271625947142], [0.0048590037723143, -0.0000271702937440, 0.9999881946023742]]) FK4_CORR = \ np.mat([[-0.0026455262, -1.1539918689, +2.1111346190], [+1.1540628161, -0.0129042997, +0.0236021478], [-2.1112979048, -0.0056024448, +0.0102587734]]) * 1.e-6 # This transformation can't be static because the observation date is needed. @transformations.dynamic_transform_matrix(FK4NoETerms, FK5, priority=1) def fk4_no_e_to_fk5(fk4c, skip_precession=False): # Add in correction terms for FK4 rotating system - Murray 89 eqn 29 # Note this is *julian century*, not besselian T = (fk4c.obstime.jyear - 1950.) / 100. B = B1950_TO_J2000_M + FK4_CORR * T # If equinox is not B1950, need to precess first if skip_precession or fk4c.equinox == _EQUINOX_B1950: return B else: from .earth_orientation import _precession_matrix_besselian return B * _precession_matrix_besselian(fk4c.equinox.byear, 1950) # This transformation can't be static because the observation date is needed. @transformations.dynamic_transform_matrix(FK5, FK4NoETerms, priority=1) def fk5_to_fk4_no_e(fk5c): # Get transposed matrix from FK4 -> FK5 assuming equinox B1950 -> J2000 B = fk4_no_e_to_fk5(fk5c, skip_precession=True).T # If equinox is not B1950, need to precess first if fk5c.equinox == _EQUINOX_J2000: return B else: from .earth_orientation import precession_matrix_Capitaine return B * precession_matrix_Capitaine(fk5c.equinox, _EQUINOX_J2000) # Galactic to/from FK4/FK5 # can't be static because the equinox is needed @transformations.dynamic_transform_matrix(FK5, Galactic) def _fk5_to_gal(fk5coords): from .angles import rotation_matrix from .earth_orientation import _precess_from_J2000_Capitaine # needed mainly to support inverse from galactic jequinox = 2000 if fk5coords.equinox is None else fk5coords.equinox.jyear mat1 = rotation_matrix(180 - Galactic._lon0_J2000.degree, 'z') mat2 = rotation_matrix(90 - Galactic._ngp_J2000.dec.degree, 'y') mat3 = rotation_matrix(Galactic._ngp_J2000.ra.degree, 'z') # transpose gets equinox -> J2000 matprec = _precess_from_J2000_Capitaine(jequinox).T return mat1 * mat2 * mat3 * matprec @transformations.dynamic_transform_matrix(Galactic, FK5) def _gal_to_fk5(galcoords): return _fk5_to_gal(galcoords).T @transformations.dynamic_transform_matrix(FK4NoETerms, Galactic, priority=1) def _fk4_to_gal(fk4coords): from .angles import rotation_matrix from .earth_orientation import _precession_matrix_besselian # needed mainly to support inverse from galactic bequinox = 1950 if fk4coords.equinox is None else fk4coords.equinox.byear mat1 = rotation_matrix(180 - Galactic._lon0_B1950.degree, 'z') mat2 = rotation_matrix(90 - Galactic._ngp_B1950.dec.degree, 'y') mat3 = rotation_matrix(Galactic._ngp_B1950.ra.degree, 'z') matprec = _precession_matrix_besselian(bequinox, 1950) return mat1 * mat2 * mat3 * matprec @transformations.dynamic_transform_matrix(Galactic, FK4NoETerms, priority=1) def _gal_to_fk4(galcoords): return _fk4_to_gal(galcoords).T def _make_transform_graph_docs(): """ Generates a string for use with the coordinate package's docstring to show the available transforms and coordinate systems """ from .transformations import master_transform_graph isclass = inspect.isclass coosys = [item for item in list(six.itervalues(globals())) if isclass(item) and issubclass(item, SphericalCoordinatesBase)] coosys.remove(SphericalCoordinatesBase) graphstr = master_transform_graph.to_dot_graph(addnodes=coosys) docstr = """ The diagram below shows all of the coordinate systems built into the `~astropy.coordinates` package, their aliases (usable for converting other coordinates to them using attribute-style access) and the pre-defined transformations between them. The user is free to override any of these transformations by defining new trasnformation between these systems, but the pre-defined transformations should be sufficient for typical usage. The graph also indicates the priority for each transformation as a number next to the arrow. These priorities are used to decide the preferred order when two trasnformation paths have the same number of steps. These priorities are defined such that path with a *smaller* total priority are favored over one with larger. .. graphviz:: """ return textwrap.dedent(docstr) + ' ' + graphstr.replace('\n', '\n ') _transform_graph_docs = _make_transform_graph_docs() astropy-0.3/astropy/coordinates/angle_lextab.py0000644000175000017500000000575312243255342020223 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) # angle_lextab.py. This file automatically created by PLY (version 3.4). Don't edit! _tabversion = '3.4' _lextokens = {'DEGREE': 1, 'HOUR': 1, 'SIMPLE_UNIT': 1, 'SIGN': 1, 'SECOND': 1, 'COLON': 1, 'UINT': 1, 'MINUTE': 1, 'UFLOAT': 1} _lexreflags = 0 _lexliterals = '' _lexstateinfo = {'INITIAL': 'inclusive'} _lexstatere = {'INITIAL': [('(?P((\\d+\\.\\d*)|(\\.\\d+))([eE][+-\u2212]?\\d+)?)|(?P\\d+)|(?P[+\u2212-])|(?P(?:hectoradian)|(?:petaradian)|(?:hrad)|(?:zeptoradian)|(?:arcsec)|(?:aarcmin)|(?:deciarcminute)|(?:Parcsec)|(?:kiloarcsecond)|(?:exaarcsecond)|(?:deciradian)|(?:yoctoarcminute)|(?:prad)|(?:Parcmin)|(?:yottaradian)|(?:marcmin)|(?:aarcsec)|(?:milliarcsecond)|(?:milliradian)|(?:parcsec)|(?:arad)|(?:uarcmin)|(?:parcmin)|(?:decaarcminute)|(?:dekaarcsecond)|(?:nrad)|(?:Tarcsec)|(?:attoarcsecond)|(?:Trad)|(?:krad)|(?:Zarcmin)|(?:Earcmin)|(?:exaarcminute)|(?:farcmin)|(?:Prad)|(?:dekaarcminute)|(?:Earcsec)|(?:Yarcsec)|(?:Garcmin)|(?:daarcmin)|(?:kiloradian)|(?:nanoarcminute)|(?:kiloarcminute)|(?:megaradian)|(?:yarcmin)|(?:Zarcsec)|(?:teraarcsecond)|(?:femtoarcsecond)|(?:Marcsec)|(?:arcminute)|(?:zettaarcsecond)|(?:yoctoarcsecond)|(?:arcsecond)|(?:decaarcsecond)|(?:zeptoarcminute)|(?:attoradian)|(?:Grad)|(?:Garcsec)|(?:microarcminute)|(?:marcsec)|(?:picoarcminute)|(?:teraradian)|(?:narcsec)|(?:centiradian)|(?:zettaradian)|(?:darad)|(?:microradian)|(?:gigaarcsecond)|(?:decaradian)|(?:exaradian)|(?:centiarcminute)|(?:cy)|(?:femtoradian)|(?:mrad)|(?:femtoarcminute)|(?:yottaarcsecond)|(?:centiarcsecond)|(?:gigaradian)|(?:zettaarcminute)|(?:gigaarcminute)|(?:yoctoradian)|(?:crad)|(?:picoradian)|(?:zrad)|(?:dekaradian)|(?:narcmin)|(?:farcsec)|(?:Erad)|(?:radian)|(?:urad)|(?:nanoarcsecond)|(?:microarcsecond)|(?:hectoarcsecond)|(?:petaarcsecond)|(?:deciarcsecond)|(?:nanoradian)|(?:Mrad)|(?:carcmin)|(?:yottaarcminute)|(?:rad)|(?:uas)|(?:harcmin)|(?:megaarcsecond)|(?:yrad)|(?:Zrad)|(?:carcsec)|(?:Marcmin)|(?:Yarcmin)|(?:zeptoarcsecond)|(?:zarcmin)|(?:darcmin)|(?:karcmin)|(?:attoarcminute)|(?:daarcsec)|(?:Tarcmin)|(?:yarcsec)|(?:mas)|(?:frad)|(?:petaarcminute)|(?:teraarcminute)|(?:harcsec)|(?:uarcsec)|(?:drad)|(?:arcmin)|(?:milliarcminute)|(?:darcsec)|(?:hectoarcminute)|(?:zarcsec)|(?:cycle)|(?:karcsec)|(?:megaarcminute)|(?:picoarcsecond)|(?:Yrad))|(?Pm(in(ute(s)?)?)?|\u2032|\\\'|\u1d50)|(?Ps(ec(ond(s)?)?)?|\u2033|\\"|\u02e2)|(?Pd(eg(ree(s)?)?)?|\xb0)|(?Phour(s)?|h(r)?|\u02b0)|(?P:)', [None, ('t_UFLOAT', 'UFLOAT'), None, None, None, None, ('t_UINT', 'UINT'), ('t_SIGN', 'SIGN'), ('t_SIMPLE_UNIT', 'SIMPLE_UNIT'), (None, 'MINUTE'), None, None, None, (None, 'SECOND'), None, None, None, (None, 'DEGREE'), None, None, None, (None, 'HOUR'), None, None, (None, 'COLON')])]} _lexstateignore = {'INITIAL': ' '} _lexstateerrorf = {'INITIAL': 't_error'} astropy-0.3/astropy/coordinates/angle_parsetab.py0000644000175000017500000001214112243255342020532 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) # astropy/coordinates/angle_parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.2' _lr_method = 'LALR' _lr_signature = b"'\xecW6\xc1\x00\x86\x9f\x84\x0er\xa4\xfb\x91\xa6;" _lr_action_items = {'HOUR':([2,8,10,17,18,21,25,26,27,28,34,],[-15,12,-14,20,-16,-12,-13,-9,-8,-10,-11,]),'DEGREE':([2,8,10,17,18,21,25,26,27,28,34,],[-15,13,-14,19,-16,-12,-13,-9,-8,-10,-11,]),'SIGN':([0,],[5,]),'SECOND':([2,8,10,17,18,21,25,26,27,28,32,33,34,],[-15,14,-14,-17,-16,-12,-13,-9,-8,-10,35,36,-11,]),'COLON':([17,28,],[22,31,]),'UINT':([0,5,11,17,19,20,21,22,29,30,31,],[-7,-6,17,21,23,24,26,28,26,26,26,]),'SIMPLE_UNIT':([2,8,10,17,18,21,25,26,27,28,34,],[-15,15,-14,-17,-16,-12,-13,-9,-8,-10,-11,]),'UFLOAT':([0,5,11,21,29,30,31,],[-7,-6,18,27,27,27,27,]),'MINUTE':([2,8,10,17,18,21,23,24,25,26,27,28,34,],[-15,16,-14,-17,-16,-12,29,30,-13,-9,-8,-10,-11,]),'$end':([1,2,3,4,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,23,24,25,26,27,28,29,30,32,33,34,35,36,],[-4,-15,0,-5,-3,-1,-30,-2,-14,-23,-29,-32,-31,-33,-17,-16,-24,-18,-12,-25,-19,-13,-9,-8,-10,-26,-20,-27,-21,-11,-28,-22,]),} _lr_action = { } for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = { } _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'arcminute':([0,],[1,]),'angle':([0,],[3,]),'simple':([0,],[4,]),'arcsecond':([0,],[6,]),'hms':([0,],[7,]),'generic':([0,],[8,]),'dms':([0,],[9,]),'colon':([0,],[10,]),'spaced':([0,],[2,]),'sign':([0,],[11,]),'ufloat':([21,29,30,31,],[25,32,33,34,]),} _lr_goto = { } for _k, _v in _lr_goto_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_goto: _lr_goto[_x] = { } _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> angle","S'",1,None,None,None), ('angle -> hms','angle',1,'p_angle','astropy/coordinates/angle_utilities.py',115), ('angle -> dms','angle',1,'p_angle','astropy/coordinates/angle_utilities.py',116), ('angle -> arcsecond','angle',1,'p_angle','astropy/coordinates/angle_utilities.py',117), ('angle -> arcminute','angle',1,'p_angle','astropy/coordinates/angle_utilities.py',118), ('angle -> simple','angle',1,'p_angle','astropy/coordinates/angle_utilities.py',119), ('sign -> SIGN','sign',1,'p_sign','astropy/coordinates/angle_utilities.py',125), ('sign -> ','sign',0,'p_sign','astropy/coordinates/angle_utilities.py',126), ('ufloat -> UFLOAT','ufloat',1,'p_ufloat','astropy/coordinates/angle_utilities.py',135), ('ufloat -> UINT','ufloat',1,'p_ufloat','astropy/coordinates/angle_utilities.py',136), ('colon -> sign UINT COLON UINT','colon',4,'p_colon','astropy/coordinates/angle_utilities.py',142), ('colon -> sign UINT COLON UINT COLON ufloat','colon',6,'p_colon','astropy/coordinates/angle_utilities.py',143), ('spaced -> sign UINT UINT','spaced',3,'p_spaced','astropy/coordinates/angle_utilities.py',152), ('spaced -> sign UINT UINT ufloat','spaced',4,'p_spaced','astropy/coordinates/angle_utilities.py',153), ('generic -> colon','generic',1,'p_generic','astropy/coordinates/angle_utilities.py',162), ('generic -> spaced','generic',1,'p_generic','astropy/coordinates/angle_utilities.py',163), ('generic -> sign UFLOAT','generic',2,'p_generic','astropy/coordinates/angle_utilities.py',164), ('generic -> sign UINT','generic',2,'p_generic','astropy/coordinates/angle_utilities.py',165), ('hms -> sign UINT HOUR','hms',3,'p_hms','astropy/coordinates/angle_utilities.py',174), ('hms -> sign UINT HOUR UINT','hms',4,'p_hms','astropy/coordinates/angle_utilities.py',175), ('hms -> sign UINT HOUR UINT MINUTE','hms',5,'p_hms','astropy/coordinates/angle_utilities.py',176), ('hms -> sign UINT HOUR UINT MINUTE ufloat','hms',6,'p_hms','astropy/coordinates/angle_utilities.py',177), ('hms -> sign UINT HOUR UINT MINUTE ufloat SECOND','hms',7,'p_hms','astropy/coordinates/angle_utilities.py',178), ('hms -> generic HOUR','hms',2,'p_hms','astropy/coordinates/angle_utilities.py',179), ('dms -> sign UINT DEGREE','dms',3,'p_dms','astropy/coordinates/angle_utilities.py',192), ('dms -> sign UINT DEGREE UINT','dms',4,'p_dms','astropy/coordinates/angle_utilities.py',193), ('dms -> sign UINT DEGREE UINT MINUTE','dms',5,'p_dms','astropy/coordinates/angle_utilities.py',194), ('dms -> sign UINT DEGREE UINT MINUTE ufloat','dms',6,'p_dms','astropy/coordinates/angle_utilities.py',195), ('dms -> sign UINT DEGREE UINT MINUTE ufloat SECOND','dms',7,'p_dms','astropy/coordinates/angle_utilities.py',196), ('dms -> generic DEGREE','dms',2,'p_dms','astropy/coordinates/angle_utilities.py',197), ('simple -> generic','simple',1,'p_simple','astropy/coordinates/angle_utilities.py',210), ('simple -> generic SIMPLE_UNIT','simple',2,'p_simple','astropy/coordinates/angle_utilities.py',211), ('arcsecond -> generic SECOND','arcsecond',2,'p_arcsecond','astropy/coordinates/angle_utilities.py',220), ('arcminute -> generic MINUTE','arcminute',2,'p_arcminute','astropy/coordinates/angle_utilities.py',226), ] astropy-0.3/astropy/coordinates/distances.py0000644000175000017500000003705012243255342017546 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the classes and utility functions for distance and cartesian coordinates. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import math import numpy as np from .. import units as u __all__ = ['Distance', 'CartesianPoints', 'cartesian_to_spherical', 'spherical_to_cartesian'] __doctest_requires__ = {'*': ['scipy.integrate']} class Distance(u.Quantity): """ A one-dimensional distance. This can be initialized in one of four ways: * A distance `value` (array or float) and a `unit` * A `~astropy.units.quantity.Quantity` object * A redshift and (optionally) a cosmology. * Providing a distance modulus Parameters ---------- value : scalar or `~astropy.units.quantity.Quantity` The value of this distance unit : `~astropy.units.core.UnitBase` The units for this distance, *if* `value` is not a `Quantity`. Must have dimensions of distance. z : float A redshift for this distance. It will be converted to a distance by computing the luminosity distance for this redshift given the cosmology specified by `cosmology`. Must be given as a keyword argument. cosmology : `~astropy.cosmology.Cosmology` or None A cosmology that will be used to compute the distance from `z`. If None, the current cosmology will be used (see `astropy.cosmology` for details). distmod : float or `~astropy.units.Quantity` The distance modulus for this distance. dtype : ~numpy.dtype, optional See `~astropy.units.Quantity`. Must be given as a keyword argument. copy : bool, optional See `~astropy.units.Quantity`. Must be given as a keyword argument. Raises ------ astropy.units.core.UnitsError If the `unit` is not a distance. ValueError If `z` is provided with a `unit` or `cosmology` is provided when `z` is *not* given, or `value` is given as well as `z` Examples -------- >>> from astropy import units as u >>> from astropy import cosmology >>> from astropy.cosmology import WMAP5, WMAP7 >>> cosmology.set_current(WMAP7) >>> d1 = Distance(10, u.Mpc) >>> d2 = Distance(40, unit=u.au) >>> d3 = Distance(value=5, unit=u.kpc) >>> d4 = Distance(z=0.23) >>> d5 = Distance(z=0.23, cosmology=WMAP5) >>> d6 = Distance(distmod=24.47) """ _include_easy_conversion_members = True def __new__(cls, value=None, unit=None, z=None, cosmology=None, distmod=None, dtype=None, copy=True): from ..cosmology import get_current if isinstance(value, u.Quantity): # This includes Distances as well if z is not None or distmod is not None: raise ValueError('`value` was given along with `z` or `distmod`' ' in Quantity constructor.') if unit is not None: value = value.to(unit).value else: unit = value.unit value = value.value elif value is None: if z is not None: if distmod is not None: raise ValueError('both `z` and `distmod` given in Distance ' 'constructor') if cosmology is None: cosmology = get_current() ld = cosmology.luminosity_distance(z) if unit is not None: ld = ld.to(unit) value = ld.value unit = ld.unit elif distmod is not None: value = cls._distmod_to_pc(distmod) if unit is None: # choose unit based on most reasonable of Mpc, kpc, or pc if value > 1e6: value = value / 1e6 unit = u.megaparsec elif value > 1e3: value = value / 1e3 unit = u.kiloparsec else: unit = u.parsec else: value = u.Quantity(value, u.parsec).to(unit).value else: raise ValueError('none of `value`, `z`, or `distmod` were given' ' to Distance constructor') value = ld.value unit = ld.unit elif z is not None: # and value is not None based on above raise ValueError('Both `z` and a `value` were provided in Distance ' 'constructor') elif cosmology is not None: raise ValueError('A `cosmology` was given but `z` was not provided ' 'in Distance constructor') elif unit is None: raise u.UnitsError('No unit was provided for Distance') #"else" the baseline `value` + `unit` case unit = _convert_to_and_validate_length_unit(unit) try: value = np.asarray(value) except ValueError as e: raise TypeError(str(e)) if value.dtype.kind not in 'iuf': raise TypeError("Unsupported dtype '{0}'".format(value.dtype)) return super(Distance, cls).__new__(cls, value, unit, dtype=dtype, copy=copy) def __quantity_view__(self, obj, unit): unit = _convert_to_and_validate_length_unit(unit) return super(Distance, self).__quantity_view__(obj, unit) def __quantity_instance__(self, val, unit, **kwargs): unit = _convert_to_and_validate_length_unit(unit) return super(Distance, self).__quantity_instance__(val, unit, **kwargs) @property def z(self): """Short for ``self.compute_z()``""" return self.compute_z() def compute_z(self, cosmology=None): """ The redshift for this distance assuming its physical distance is a luminosity distance. Parameters ---------- cosmology : `~astropy.cosmology.cosmology` or None The cosmology to assume for this calculation, or None to use the current cosmology. Returns ------- z : float The redshift of this distance given the provided `cosmology`. """ from ..cosmology import luminosity_distance from scipy import optimize # FIXME: array: need to make this calculation more vector-friendly f = lambda z, d, cos: (luminosity_distance(z, cos).value - d) ** 2 return optimize.brent(f, (self.Mpc, cosmology)) @property def distmod(self): """ The distance modulus of this distance as a Quantity """ val = 5. * np.log10(self.to(u.pc).value) - 5. return u.Quantity(val, u.mag) @staticmethod def _distmod_to_pc(dm): return 10 ** ((dm + 5) / 5.) class CartesianPoints(u.Quantity): """ A cartesian representation of a point in three-dimensional space. Parameters ---------- x : `~astropy.units.Quantity` or array-like The first cartesian coordinate or a single array or `~astropy.units.Quantity` where the first dimension is length-3. y : `~astropy.units.Quantity` or array-like, optional The second cartesian coordinate. z : `~astropy.units.Quantity` or array-like, optional The third cartesian coordinate. unit : `~astropy.units.UnitBase` object or None The physical unit of the coordinate values. If `x`, `y`, or `z` are quantities, they will be converted to this unit. dtype : ~numpy.dtype, optional See `~astropy.units.Quantity`. Must be given as a keyword argument. copy : bool, optional See `~astropy.units.Quantity`. Must be given as a keyword argument. Raises ------ astropy.units.UnitsError If the units on `x`, `y`, and `z` do not match or an invalid unit is given ValueError If `y` and `z` don't match `x`'s shape or `x` is not length-3 TypeError If incompatible array types are passed into `x`, `y`, or `z` """ #this ensures that __array_wrap__ gets called for ufuncs even when #where a quantity is first, like ``3*u.m + c`` __array_priority__ = 10001 def __new__(cls, x, y=None, z=None, unit=None, dtype=None, copy=True): if y is None and z is None: if len(x) != 3: raise ValueError('input to CartesianPoints is not length 3') qarr = x if unit is None and hasattr(qarr, 'unit'): unit = qarr.unit # for when a Quantity is given elif y is not None and z is not None: if unit is None: #they must all match units or this fails for coo in (x, y, z): if hasattr(coo, 'unit'): if unit is not None and coo.unit != unit: raise u.UnitsError('Units for `x`, `y`, and `z` do ' 'not match in CartesianPoints') unit = coo.unit #if `unit` is still None at this point, it means none were #Quantties, which is fine, because it means the user wanted #the unit to be None else: #convert any that are like a Quantity to the given unit if hasattr(x, 'to'): x = x.to(unit) if hasattr(y, 'to'): y = y.to(unit) if hasattr(z, 'to'): z = z.to(unit) qarr = [np.asarray(coo) for coo in (x, y, z)] if not (qarr[0].shape == qarr[1].shape == qarr[2].shape): raise ValueError("shapes for x,y, and z don't match in " "CartesianPoints") #let the unit be whatever it is else: raise TypeError('Must give all of x,y, and z or just array in ' 'CartesianPoints') try: unit = _convert_to_and_validate_length_unit(unit, True) except TypeError as e: raise u.UnitsError(str(e)) try: qarr = np.asarray(qarr) except ValueError as e: raise TypeError(str(e)) if qarr.dtype.kind not in 'iuf': raise TypeError("Unsupported dtype '{0}'".format(qarr.dtype)) return super(CartesianPoints, cls).__new__(cls, qarr, unit, dtype=dtype, copy=copy) def __quantity_view__(self, obj, unit): unit = _convert_to_and_validate_length_unit(unit, True) return super(CartesianPoints, self).__quantity_view__(obj, unit) def __quantity_instance__(self, val, unit, **kwargs): unit = _convert_to_and_validate_length_unit(unit, True) return super(CartesianPoints, self).__quantity_instance__(val, unit, **kwargs) def __array_wrap__(self, obj, context=None): #always convert to CartesianPoints because all operations that would #screw up the units are killed by _convert_to_and_validate_length_unit obj = super(CartesianPoints, self).__array_wrap__(obj, context=context) #always prefer self's unit obj = obj.to(self.unit) return CartesianPoints(obj.value, unit=obj.unit, copy=False) @property def x(self): """ The second cartesian coordinate as a `~astropy.units.Quantity`. """ return self[0] @property def y(self): """ The second cartesian coordinate as a `~astropy.units.Quantity`. """ return self[1] @property def z(self): """ The third cartesian coordinate as a `~astropy.units.Quantity`. """ return self[2] def to_spherical(self): """ Converts to the spherical representation of this point. Returns ------- r : astropy.units.Quantity The radial coordinate (in the same units as this `CartesianPoint`). lat : astropy.units.Quantity The spherical coordinates latitude. lon : astropy.units.Quantity The spherical coordinates longitude. """ from .angles import Latitude, Longitude rarr, latarr, lonarr = cartesian_to_spherical(self.x, self.y, self.z) r = Distance(rarr, unit=self.unit) lat = Latitude(latarr, unit=u.radian) lon = Longitude(lonarr, unit=u.radian) return r, lat, lon def _convert_to_and_validate_length_unit(unit, allow_dimensionless=False): """ raises `astropy.units.UnitsError` if not a length unit """ unit = u.Unit(unit) if not unit.is_equivalent(u.kpc): if not (allow_dimensionless and unit == u.dimensionless_unscaled): raise u.UnitsError('Unit "{0}" is not a length type'.format(unit)) return unit #<------------transformation-related utility functions-----------------> def cartesian_to_spherical(x, y, z): """ Converts 3D rectangular cartesian coordinates to spherical polar coordinates. Note that the resulting angles are latitude/longitude or elevation/azimuthal form. I.e., the origin is along the equator rather than at the north pole. .. note:: This is a low-level function used internally in `astropy.coordinates`. It is provided for users if they really want to use it, but it is recommended that you use the `astropy.coordinates` coordinate systems. Parameters ---------- x : scalar or array-like The first cartesian coordinate. y : scalar or array-like The second cartesian coordinate. z : scalar or array-like The third cartesian coordinate. Returns ------- r : float or array The radial coordinate (in the same units as the inputs). lat : float or array The latitude in radians lon : float or array The longitude in radians """ xsq = x ** 2 ysq = y ** 2 zsq = z ** 2 r = (xsq + ysq + zsq) ** 0.5 s = (xsq + ysq) ** 0.5 if np.isscalar(x) and np.isscalar(y) and np.isscalar(z): lon = math.atan2(y, x) lat = math.atan2(z, s) else: lon = np.arctan2(y, x) lat = np.arctan2(z, s) return r, lat, lon def spherical_to_cartesian(r, lat, lon): """ Converts spherical polar coordinates to rectangular cartesian coordinates. Note that the input angles should be in latitude/longitude or elevation/azimuthal form. I.e., the origin is along the equator rather than at the north pole. .. note:: This is a low-level function used internally in `astropy.coordinates`. It is provided for users if they really want to use it, but it is recommended that you use the `astropy.coordinates` coordinate systems. Parameters ---------- r : scalar or array-like The radial coordinate (in the same units as the inputs). lat : scalar or array-like The latitude in radians lon : scalar or array-like The longitude in radians Returns ------- x : float or array The first cartesian coordinate. y : float or array The second cartesian coordinate. z : float or array The third cartesian coordinate. """ if np.isscalar(r) and np.isscalar(lat) and np.isscalar(lon): x = r * math.cos(lat) * math.cos(lon) y = r * math.cos(lat) * math.sin(lon) z = r * math.sin(lat) else: x = r * np.cos(lat) * np.cos(lon) y = r * np.cos(lat) * np.sin(lon) z = r * np.sin(lat) return x, y, z astropy-0.3/astropy/coordinates/coordsystems.py0000644000175000017500000007013312243255342020326 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the base classes and frameworks for coordinate objects. """ import copy from abc import ABCMeta, abstractproperty, abstractmethod from ..extern import six from .. import units as u from .angles import Longitude, Latitude, Angle from .distances import Distance, CartesianPoints, cartesian_to_spherical, spherical_to_cartesian from ..utils.compat.misc import override__dir__ from . import angle_utilities import numpy as np __all__ = ['SphericalCoordinatesBase'] @six.add_metaclass(ABCMeta) class SphericalCoordinatesBase(object): """ Abstract superclass for all coordinate classes representing points in three dimensions. Notes ----- Subclasses must implement `__init__`, and define the `latangle` and `lonangle` properties. They may also override the `equinox` property, or leave it unaltered to indicate the coordinates are equinoxless. `_initialize_latlon` is provided to implement typical initialization features, and should be called from a subclass' `__init__`. See the classes in `astropy.coordinates.builtin_systems` for examples of this. """ @abstractmethod def __init__(self, *args, **kwargs): """ Subclasses must override this, but they should also call this to set up internal state. """ self._distance = None self._cartpoint = None def __eq__(self, other): try: return (self.latangle == other.latangle and self.lonangle == other.lonangle and self.distance == other.distance and self.equinox == other.equinox) except AttributeError: return False _init_docstring_param_templ = """coordstr : str A single string with the coordinates. Cannot be used with `{latnm}` and `{lonnm}` nor `x`/`y`/`z`. {lonnm} : `~astropy.coordinates.angle.Angle`, float, int, str This must be given with `{latnm}`. {latnm} : `~astropy.coordinates.angle.Angle`, float, int, str This must be given with `{lonnm}`. distance : `~astropy.coordinates.coordsystems.Distance`, optional This may be given with `{latnm}` and `{lonnm}` or `coordstr` and not `x`, `y`, or `z`. If not given, `None` (unit sphere) will be assumed. x : number The first cartesian coordinate. Must be given with `y` and `z` and not with `{lonnm}` or `{latnm}` nor `coordstr`. y : number The second cartesian coordinate. Must be given with `x` and `z` and not with `{lonnm}` or `{latnm}` nor `coordstr`. z : number The third cartesian coordinate. Must be given with `x` and `y` and not with `{lonnm}` or `{latnm}` nor `coordstr`. cartpoint : `~astropy.coordinates.distance.CartesianPoints` A cartesian point with the coordinates. Cannot be used with any other arguments. unit The `unit` parameter's interpretation depends on what other parameters are given: * If `{lonnm}` and `{latnm}` or `coordstr` are given: `unit` must be a length-2 sequence specifying the units of `{lonnm}` and `{latnm}`, respectively. They can be either `~astropy.units.UnitBase` objects or strings that will be converted using `~astropy.units.Unit`. They can also be None to attempt to automatically interpret the units (see `~astropy.coordinates.angles.Angle` for details.) If `unit` is just `None`, this will be interpreted the same as ``(None, None)``. * If `x`, `y`, and `z` are given: `unit` must be a single unit with dimensions of length""" def _initialize_latlon(self, lonname, latname, initargs, initkwargs): """ Subclasses should use this to initialize standard lat/lon-style coordinates. This recognizes both the lat/lon style and the cartesian form. Parameters ---------- lonname : str The name of the longitude-like coordinate attribute latname : str The name of the latitude-like coordinate attribute initargs : list The ``*args`` from the initializer initkwargs : dict The ``**kwargs`` from the initializer """ initkwargs = dict(initkwargs) # copy nargs = len(initargs) sclsnm = self.__class__.__name__ if nargs == 1: if isinstance(initargs[0], CartesianPoints): initkwargs['cartpoint'] = initargs[0] else: initkwargs['coordstr'] = initargs[0] if nargs > 1: if lonname in initkwargs: raise TypeError("{0} got multiple values for keyword argument " "'{1}'".format(sclsnm, lonname)) initkwargs[lonname] = initargs[0] if nargs >= 2: if latname in initkwargs: raise TypeError("{0} got multiple values for keyword argument " "'{1}'".format(sclsnm, latname)) initkwargs[latname] = initargs[1] if nargs > 2: raise TypeError('{0} takes up to 2 positional arguments ' '({1} given)'.format(sclsnm, len(initargs))) unit = initkwargs.pop('unit', None) coordstr = initkwargs.pop('coordstr', None) lonval = initkwargs.pop(lonname, None) latval = initkwargs.pop(latname, None) distval = initkwargs.pop('distance', None) cartpoint = initkwargs.pop('cartpoint', None) x = initkwargs.pop('x', None) y = initkwargs.pop('y', None) z = initkwargs.pop('z', None) if len(initkwargs) > 0: raise TypeError('{0} got unexpected keyword argument' ' {1}'.format(sclsnm, initkwargs.keys())) angleinit = ((lonval is not None and latval is not None) or coordstr is not None) cartinit = ((x is not None and y is not None and z is not None) or cartpoint is not None) if angleinit and not cartinit: # lat/lon-style initialization for v in [x, y, z, cartpoint]: if v is not None: raise ValueError('Cannot give both angular and cartesian ' 'coordinates while initializing ' + sclsnm) try: # this raises a TypeError if `unit` is not None or iterable units = [None, None] if unit is None else list(unit) except TypeError: raise ValueError('Must give a sequence of 2 units or None ' 'while initializing {0}. Instead got a ' 'non-sequence {1}'.format(sclsnm, unit)) if len(units) == 2: try: if units[0] is not None: units[0] = u.Unit(units[0]) if units[1] is not None: units[1] = u.Unit(units[1]) except ValueError: raise ValueError('Could not convert units to unit objects ' 'while initializing ' + sclsnm) else: raise ValueError('Must give a sequence of 2 units or None ' 'while initializing {0}. Instead got a sequence ' 'of {1}.'.format(sclsnm, len(units))) if coordstr is not None: # need to try to parse the coordinate from a single argument # populates latval and lonval variables, which then get made # into coordinates below if isinstance(coordstr, six.string_types): if "," in coordstr: lonval, latval = coordstr.split(",") else: coosplit = coordstr.split() if len(coosplit) == 6: lonval = " ".join(coosplit[0:3]) latval = " ".join(coosplit[3:]) elif len(coosplit) == 2: lonval, latval = coosplit else: msg = ("Could not parse {lonname}/{latname} values " "from the string provided: '{coordstr}'.") raise ValueError(msg.format(lonname=lonname, latname=latname, coordstr=coordstr)) else: raise ValueError("A {0} cannot be created with a single value of type " "'{1}', must be a string.".format(sclsnm, type(coordstr).__name__)) # now actually create the angle objects lonang = Longitude(lonval, unit=units[0]) latang = Latitude(latval, unit=units[1]) dist = None if distval is None else Distance(distval) # copy elif cartinit and not angleinit: # cartesian-style initialization for v in [coordstr, lonval, latval, distval]: if v is not None: raise ValueError('Cannot give both angular and cartesian ' 'coordinates while initializing ' + sclsnm) if cartpoint is not None: for v in [x, y, z, unit]: if v is not None: raise ValueError('Cannot give both a CartesianPoints ' 'and x/y/z/unit parameters while ' 'initializing ' + sclsnm) x = cartpoint.x y = cartpoint.y z = cartpoint.z unit = cartpoint.unit r, latval, lonval = cartesian_to_spherical(x, y, z) lonang = Longitude(lonval, unit=u.radian) latang = Latitude(latval, unit=u.radian) dist = None if unit is None else Distance(r, unit) else: raise TypeError('Must initialize {coordnm} with ' '{latname}/{lonname}/(distance) or x/y/z ' ''.format(coordnm=sclsnm, latname=latname, lonname=lonname)) # now actually set the values self._lonangle = lonang self._latangle = latang self._distance = dist #sanity-check that they are all consistent shapes if self.lonangle.shape != self.latangle.shape: raise ValueError('lonangle and latangle do not have matching shapes') if self._distance is not None and self._distance.shape != self.lonangle.shape: raise ValueError('distance and angles do not have matching shapes') def __repr__(self): if self.distance is not None: if self.isscalar: diststr = ', Distance={0:.2g} {1!s}'.format(self.distance.value, self.distance.unit) else: diststr = ', Distance={0} {1!s}'.format(self.distance.value, self.distance.unit) else: diststr = '' if self.isscalar: msg = "<{clsnm} {lonnm}={lonval:.5f} deg, {latnm}={latval:.5f} deg{diststr}>" else: msg = "<{clsnm} {lonnm}={lonval} deg, {latnm}={latval} deg{diststr}>" return msg.format(clsnm=self.__class__.__name__, lonval=self.lonangle.degree, latval=self.latangle.degree, lonnm=self._repr_lon_name, latnm=self._repr_lat_name, diststr=diststr) def __getitem__(self, key): from copy import deepcopy oldlat = self._latangle oldlon = self._lonangle olddist = self._distance newlat = oldlat[key] newlon = oldlon[key] if olddist is not None: newdist = olddist[key] else: newdist = None try: #don't want to copy the old values, because we've already #copied them above as new* self._latangle = None self._lonangle = None self._distance = None newcoo = deepcopy(self) newcoo._latangle = newlat newcoo._lonangle = newlon newcoo._distance = newdist return newcoo finally: self._latangle = oldlat self._lonangle = oldlon self._distance = olddist @property def latangle(self): """ The latitudinal/elevation angle for these coordinates as an `~astropy.coordinates.angles.Angle` object. Subclasses will often provide properties returning the same object, but with a name more appropriate for the particular subclass. """ return self._latangle @property def lonangle(self): """ The longitudinal/azimuthal angle for these coordinates as an `~astropy.coordinates.angles.Angle` object. Subclasses will often provide properties returning the same object, but with a name more appropriate for the particular subclass. """ return self._lonangle @property def equinox(self): """ The equinox of this system, or None to indicate no equinox specified. """ return None @property def distance(self): """ The radial distance for this coordinate object as an `~astropy.coordinates.coordsystems.Distance` object. If set as a tuple, the tuple will be passed into the `~astropy.coordinates.coordsystems.Distance` constructor. Alternatively, this may be `None`, indicating an unknown/not given distance. Where necessary, this object will be interpreted as angles on the unit sphere. """ return self._distance @distance.setter def distance(self, val): if val is None: self._distance = None elif isinstance(val, tuple): self._distance = Distance(*val) elif isinstance(val, Distance): self._distance = val elif isinstance(val, u.Quantity): self._distance = Distance(val) else: raise TypeError( 'Spherical coordinate distance must be a Distance object, a ' 'tuple that can be used to instantiate a Distance object, or ' 'None.') # must clear the old cached cartesian point, or it won't get updated # for the new distance self._cartpoint = None @property def x(self): self._make_cart() return self._cartpoint.x @property def y(self): self._make_cart() return self._cartpoint.y @property def z(self): self._make_cart() return self._cartpoint.z @property def cartesian(self): self._make_cart() return self._cartpoint def _make_cart(self, override=False): if override or self._cartpoint is None: if self._distance is None: r = 1 runit = u.dimensionless_unscaled else: r = self._distance.value runit = self._distance.unit x, y, z = spherical_to_cartesian(r, self.latangle.radian, self.lonangle.radian) self._cartpoint = CartesianPoints(x, y, z, runit) def separation(self, other): """ Computes on-sky separation between this coordinate and another. Parameters ---------- other : `~astropy.coordinates.coordsystems.SphericalCoordinatesBase` The coordinate to get the separation to. Returns ------- sep : `~astropy.coordinates.angles.Angle` The on-sky separation between this and the `other` coordinate. Notes ----- The separation is calculated using the Vincenty formula, which is stable at all locations, including poles and antipodes [1]_. .. [1] http://en.wikipedia.org/wiki/Great-circle_distance """ other_in_self_system = other.transform_to(self.__class__) lon1 = self.lonangle lat1 = self.latangle lon2 = other_in_self_system.lonangle lat2 = other_in_self_system.latangle # Get the separation as a Quantity, convert to Angle in degrees sep = angle_utilities.angular_separation(lon1, lat1, lon2, lat2) return Angle(sep, unit=u.degree) def separation_3d(self, other): """ Computes three dimensional separation between this coordinate and another. Parameters ---------- other : `~astropy.coordinates.coordsystems.SphericalCoordinatesBase` The coordinate system to get the distance to. Returns ------- sep : `~astropy.coordinates.coordsystems.Distance` The real-space distance between these two coordinates. Raises ------ ValueError If this or the other coordinate do not have distances. """ if self._distance is None: raise ValueError('This object does not have a distance; cannot ' 'compute 3d separation.') # do this first just in case the conversion somehow creates a distance other_in_self_system = other.transform_to(self.__class__) if other_in_self_system._distance is None: raise ValueError('The other object does not have a distance; ' 'cannot compute 3d separation.') dx = self.x - other_in_self_system.x dy = self.y - other_in_self_system.y dz = self.z - other_in_self_system.z distval = (dx.value ** 2 + dy.value ** 2 + dz.value ** 2) ** 0.5 return Distance(distval, dx.unit) def match_to_catalog_3d(self, catalogcoord, nthneighbor=1): """ Finds the nearest 3-dimensional matches of this coordinate to a set of catalog coordinates. This finds the 3-dimensional closest neighbor, which is only different from the on-sky distance if `distance` is set in this object or the `catalogcoord` object. Parameters ---------- catalogcoord : `~astropy.coordinates.SphericalCoordinatesBase` The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e., ``catalogcoord.isscalar == False``) nthneighbor : int, optional Which closest neighbor to search for. Typically ``1`` is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is ``2``, for matching a coordinate catalog against *itself* (``1`` is inappropriate because each point will find itself as the closest match). Returns ------- idx : integer array Indecies into `catalogcoord` to get the matched points for each `matchcoord`. Shape matches this coordinate. sep2d : `~astropy.units.quantity.Angle` The on-sky separation between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. dist3d : `~astropy.units.quantity.Quantity` The 3D distance between the closest match for each `matchcoord` and the `matchcoord`. Shape matches this coordinate. Notes ----- This method requires `scipy` to be installed or it will fail. See Also -------- astropy.coordinates.matching.match_coordinates_3d """ from .matching import match_coordinates_3d return match_coordinates_3d(self, catalogcoord, nthneighbor=nthneighbor, storekdtree=True) def match_to_catalog_sky(self, catalogcoord, nthneighbor=1): """ Finds the nearest on-sky matches of this coordinate in a set of catalog coordinates. Parameters ---------- catalogcoord : `~astropy.coordinates.SphericalCoordinatesBase` The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e., ``catalogcoord.isscalar == False``) nthneighbor : int, optional Which closest neighbor to search for. Typically ``1`` is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is ``2``, for matching a coordinate catalog against *itself* (``1`` is inappropriate because each point will find itself as the closest match). Returns ------- idx : integer array Indecies into `catalogcoord` to get the matched points for each `matchcoord`. Shape matches this coordinate. sep2d : `~astropy.units.quantity.Angle` The on-sky separation between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. dist3d : `~astropy.units.quantity.Quantity` The 3D distance between the closest match for each `matchcoord` and the `matchcoord`. Shape matches this coordinate. Notes ----- This method requires `scipy` to be installed or it will fail. See Also -------- astropy.coordinates.matching.match_coordinates_sky """ from .matching import match_coordinates_sky return match_coordinates_sky(self, catalogcoord, nthneighbor=nthneighbor, storekdtree=True) #<------------transformation-related stuff here--------------------> def transform_to(self, tosys): """ Transform this coordinate to a new system. Parameters ---------- tosys : class The system to transform this coordinate into. Returns ------- transcoord A new object with this coordinate represented in the `tosys` system. Raises ------ ValueError If there is no possible transformation route. """ from .transformations import master_transform_graph from .errors import ConvertError if tosys is self.__class__: return copy.deepcopy(self) trans = master_transform_graph.get_transform(self.__class__, tosys) if trans is None: raise ConvertError('Cannot transform from {0} to ' '{1}'.format(self.__class__, tosys)) return trans(self) def is_transformable_to(self, tosys): """ Determines if this coordinate can be transformed to a particular system. Parameters ---------- tosys : class The system to transform this coordinate into. Returns ------- transformable : bool or str True if this can be trasnformed to `tosys`, False if not. The string 'same' if `tosys` is the same system as this object (i.e. no transformation is needed). """ from .transformations import master_transform_graph if self.__class__ is tosys: return 'same' else: trans = master_transform_graph.get_transform(self.__class__, tosys) return trans is not None def __getattr__(self, name): """ Overrides getattr to return coordinates that this can be transformed to, based on the alias name in the master transform graph. """ from .transformations import master_transform_graph nmsys = master_transform_graph.lookup_name(name) if self.__class__ is nmsys: return self if nmsys is not None and self.is_transformable_to(nmsys): return self.transform_to(nmsys) else: msg = "'{0}' object has no attribute '{1}', nor a transform." raise AttributeError(msg.format(self.__class__.__name__, name)) @override__dir__ def __dir__(self): """ Overriding the builtin `dir` behavior allows us to add the transforms available by aliases. This also allows ipython tab-completion to know about the transforms. """ from .transformations import master_transform_graph dir_items = set() # determine the aliases that this can be transformed to. for alias in master_transform_graph.get_aliases(): tosys = master_transform_graph.lookup_name(alias) if self.is_transformable_to(tosys): dir_items.add(alias) return dir_items @property def isscalar(self): """ True if this coordinate contains scalar angles/distances, or False if they are array-like """ #assumes input-validation occurs and thus lat/lon/dist consistent return self.lonangle.isscalar # Name resolve @classmethod def from_name(cls, name): """ Given a name, query the CDS name resolver to attempt to retrieve coordinate information for that object. The search database, sesame url, and query timeout can be set through configuration items in `astropy.coordinates.name_resolve` -- see docstring for `astropy.coordinates.name_resolve.get_icrs_coordinates` for more information. Parameters ---------- name : str The name of the object to get coordinates for, e.g. m42. Returns ------- coord : SphericalCoordinatesBase Instance of a Coordinates class, specified by the class this is called on, e.g. if `Galactic.from_name('m42')`, will get an instance of `Galactic` representing the position of M42. """ from .name_resolve import get_icrs_coordinates icrs = get_icrs_coordinates(name) if cls == icrs.__class__: return icrs else: return icrs.transform_to(cls) _default_string_style = 'dms' def to_string(self, style=None, **kwargs): """ A string representation of the coordinates. See :meth:`astropy.coordinates.Angle.to_string` for details and keyword arguments (the two angles forming the coordinates are are both :class:`astropy.coordinates.Angle` instances). Keyword arguments are passed to :meth:`astropy.coordinates.Angle.to_string`. Parameters ---------- style : {'hmsdms', 'dms', 'decimal', None} The formatting specification to use. These encode the three most common ways to represent coordinates. If `None` is passed, the defaults for the current coordinate class is used. kwargs Keyword arguments are passed to :meth:`astropy.coordinates.Angle.to_string`. """ if style is None: style = self._default_string_style styles = { 'hmsdms': {'lonargs': {'unit':u.hour}, 'latargs': {'unit':u.degree}}, 'dms': {'lonargs': {'unit':u.degree}, 'latargs': {'unit':u.degree}}, 'decimal':{'lonargs': {'unit':u.degree,'decimal':True}, 'latargs': {'unit':u.degree,'decimal':True}} } lonargs = kwargs.copy() latargs = kwargs.copy() if style in styles: lonargs.update(styles[style]['lonargs']) latargs.update(styles[style]['latargs']) else: raise ValueError('Invalid style. Valid options are: '+",".join(styles)) if np.isscalar(self.lonangle.value): coord_string = (self.lonangle.to_string(**lonargs) + " " + self.latangle.to_string(**latargs)) else: coord_string = [] for lonangle, latangle in zip(self.lonangle, self.latangle): coord_string += [(lonangle.to_string(**lonargs) + " " + latangle.to_string(**latargs))] if hasattr(coord_string,'decode'): return coord_string.decode() return coord_string astropy-0.3/astropy/coordinates/setup_package.py0000644000175000017500000000027712243255342020405 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): return {'astropy.coordinates.tests.accuracy': ['*.csv']} def requires_2to3(): return False astropy-0.3/astropy/coordinates/angles.py0000644000175000017500000006454212243255342017050 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the fundamental classes used for representing coordinates in astropy. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import math import numpy as np from ..extern import six from . import angle_utilities as util from .. import units as u from ..utils import deprecated __all__ = ['Angle', 'Latitude', 'Longitude'] TWOPI = math.pi * 2.0 # no need to calculate this all the time class Angle(u.Quantity): """ One or more angular value(s) with units equivalent to radians or degrees. An angle can be specified either as an array, scalar, tuple (see below), string, `~astropy.units.Quantity` or another `~astropy.coordinates.Angle`. The input parser is flexible and supports a variety of formats:: Angle('10.2345d') Angle(['10.2345d', '-20d']) Angle('1:2:30.43 degrees') Angle('1 2 0 hours') Angle(np.arange(1, 8), unit=u.deg) Angle(u'1°2′3″') Angle('1d2m3.4s') Angle('-1h2m3s') Angle((-1, 2, 3), unit=u.deg) # (d, m, s) Angle(10.2345 * u.deg) Angle(Angle(10.2345 * u.deg)) Parameters ---------- angle : array, scalar, Quantity, Angle The angle value. If a tuple, will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending on `unit`. If a string, it will be interpreted following the rules described above. If `angle` is a sequence or array of strings, the resulting values will be in the given `unit`, or if None is provided, the unit will be taken from the first given value. unit : `~astropy.units.UnitBase`, str, optional The unit of the value specified for the angle. This may be any string that `~astropy.units.Unit` understands, but it is better to give an actual unit object. Must be an angular unit. dtype : ~numpy.dtype, optional See `~astropy.units.Quantity`. copy : bool, optional See `~astropy.units.Quantity`. Raises ------ `~astropy.units.core.UnitsError` If a unit is not provided or it is not an angular unit. """ _include_easy_conversion_members = True def __new__(cls, angle, unit=None, dtype=None, copy=True): unit = cls._convert_unit_to_angle_unit(unit) if (unit is not None and not unit.is_equivalent(u.radian)): raise u.UnitsError( "Given unit {0} is not convertible to an angle".format( unit)) if isinstance(angle, u.Quantity): # This includes Angle subclasses as well if unit is not None: angle = angle.to(unit).value else: unit = angle.unit unit = cls._convert_unit_to_angle_unit(unit) if not unit.is_equivalent(u.radian): raise u.UnitsError( "Given quantity {0} is not convertible to an angle".format( angle)) angle = angle.value angle = cls._tuple_to_float(angle, unit) try: angle = np.asarray(angle) except ValueError as e: raise TypeError(str(e)) if angle.dtype.type in (np.string_, np.unicode_): # We need to modify this value from within # convert_string_to_angle, and the only way to do that # across Python 2.6 - 3.3 is to use this "store it in a # list" trick. determined_unit = [unit] def convert_string_to_angle(x): ang, new_unit = util.parse_angle(six.text_type(x), unit) if determined_unit[0] is None: determined_unit[0] = new_unit if new_unit is not None: return new_unit.to( determined_unit[0], cls._tuple_to_float(ang, new_unit)) else: return cls._tuple_to_float(ang, determined_unit[0]) convert_string_to_angle_ufunc = np.vectorize( convert_string_to_angle, otypes=[np.float_]) angle = convert_string_to_angle_ufunc(angle) unit = determined_unit[0] elif angle.dtype.kind not in 'iuf': raise TypeError("Unsupported dtype '{0}'".format(angle.dtype)) if unit is None: raise u.UnitsError("No unit was specified") self = super(Angle, cls).__new__( cls, angle, unit, dtype=dtype, copy=copy) return self @staticmethod def _tuple_to_float(angle, unit): """ Converts an angle represented as a 3-tuple into a floating point number in the given unit. """ if isinstance(angle, tuple): # TODO: Numpy array of tuples? if unit is u.hourangle: util.check_hms_ranges(*angle) angle = util.hms_to_hours(*angle) elif unit is u.degree: angle = util.dms_to_degrees(*angle) else: raise u.UnitsError( "Can not parse '{0}' as unit '{1}'".format( angle, unit)) return angle @staticmethod def _convert_unit_to_angle_unit(unit): if unit is not None: unit = u.Unit(unit) if unit is u.hour: unit = u.hourangle return unit def __quantity_view__(self, obj, unit): unit = self._convert_unit_to_angle_unit(unit) if unit is not None and unit.is_equivalent(u.radian): result = obj.view(Angle) return result return super(Angle, self).__quantity_view__( obj, unit) def __quantity_instance__(self, val, unit, **kwargs): unit = self._convert_unit_to_angle_unit(unit) if unit is not None and unit.is_equivalent(u.radian): return self.__class__(val, unit, **kwargs) return super(Angle, self).__quantity_instance__(val, unit, **kwargs) def __array_wrap__(self, obj, context=None): obj = super(Angle, self).__array_wrap__(obj, context=context) if isinstance(obj, Angle): return Angle(obj.value, obj.unit) return obj def __add__(self, other): return super(Angle, self).__add__(other) def __sub__(self, other): return super(Angle, self).__sub__(other) def __mul__(self, other): if isinstance(other, type(self)): raise TypeError( "multiplication is not supported between two {0} " "objects".format( type(self).__name__)) return super(Angle, self).__mul__(other) def __div__(self, other): if isinstance(other, type(self)): raise TypeError( "division is not supported between two {0} objects".format( type(self).__name__)) return super(Angle, self).__div__(other) __truediv__ = __div__ @property def hour(self): """ The angle's value in hours (read-only property). """ return self.hourangle @property def hms(self): """ The angle's value in hours, as a ``(h, m, s)`` tuple (read-only property). """ return util.hours_to_hms(self.hourangle) @property def dms(self): """ The angle's value in degrees, as a ``(d, m, s)`` tuple (read-only property). """ return util.degrees_to_dms(self.degree) def to_string(self, unit=None, decimal=False, sep='fromunit', precision=None, alwayssign=False, pad=False, fields=3, format=None): """ A string representation of the angle. Parameters ---------- units : `~astropy.units.UnitBase`, optional Specifies the units. Must be an angular unit. If not provided, the unit used to initialize the angle will be used. decimal : bool, optional If True, a decimal respresentation will be used, otherwise the returned string will be in sexagesimal form. sep : str, optional The separator between numbers in a sexagesimal representation. E.g., if it is ':', the result is "12:41:11.1241". Also accepts 2 or 3 separators. E.g., ``sep='hms'`` would give the result "12h41m11.1241s", or sep='-:' would yield "11-21:17.124". Alternatively, the special string 'fromunit' means 'dms' if the unit is degrees, or 'hms' if the unit is hours. precision : int, optional The level of decimal precision. If `decimal` is True, this is the raw precision, otherwise it gives the precision of the last place of the sexagesimal representation (seconds). If `None`, or not provided, the number of decimal places is determined by the value, and will be between 0-8 decimal places as required. alwayssign : bool, optional If `True`, include the sign no matter what. If `False`, only include the sign if it is negative. pad : bool, optional If `True`, include leading zeros when needed to ensure a fixed number of characters for sexagesimal representation. fields : int, optional Specifies the number of fields to display when outputting sexagesimal notation. For example: - fields == 1: `'5d'` - fields == 2: `'5d45m'` - fields == 3: `'5d45m32.5s'` By default, all fields are displayed. format : str, optional The format of the result. If not provided, an unadorned string is returned. Supported values are: - 'latex': Return a LaTeX-formatted string - 'unicode': Return a string containing non-ASCII unicode characters, such as the degree symbol Returns ------- strrepr : str A string representation of the angle. """ if unit is None: unit = self.unit unit = self._convert_unit_to_angle_unit(unit) separators = { None: { u.degree: 'dms', u.hourangle: 'hms'}, 'latex': { u.degree: [r'^\circ', r'{}^\prime', r'{}^{\prime\prime}'], u.hourangle: [r'^\mathrm{h}', r'^\mathrm{m}', r'^\mathrm{s}']}, 'unicode': { u.degree: '°′″', u.hourangle: 'ʰáµË¢'} } if sep == 'fromunit': if format not in separators: raise ValueError("Unknown format '{0}'".format(format)) seps = separators[format] if unit in seps: sep = seps[unit] # Create an iterator so we can format each element of what # might be an array. if unit is u.degree: if decimal: values = self.degree if precision is not None: func = ("{0:0." + str(precision) + "f}").format else: func = '{0:g}'.format else: if sep == 'fromunit': sep = 'dms' values = self.degree func = lambda x: util.degrees_to_string( x, precision=precision, sep=sep, pad=pad, fields=fields) elif unit is u.hourangle: if decimal: values = self.hour if precision is not None: func = ("{0:0." + str(precision) + "f}").format else: func = '{0:g}'.format else: if sep == 'fromunit': sep = 'hms' values = self.hour func = lambda x: util.hours_to_string( x, precision=precision, sep=sep, pad=pad, fields=fields) elif unit.is_equivalent(u.radian): if decimal: values = self.to(unit).value if precision is not None: func = ("{0:1." + str(precision) + "f}").format else: func = "{0:g}".format elif sep == 'fromunit': values = self.to(unit).value unit_string = unit.to_string(format=format) if format == 'latex': unit_string = unit_string[1:-1] if precision is not None: def plain_unit_format(val): return ("{0:0." + str(precision) + "f}{1}").format( val, unit_string) func = plain_unit_format else: def plain_unit_format(val): return "{0:g}{1}".format(val, unit_string) func = plain_unit_format else: raise ValueError( "'{0}' can not be represented in sexagesimal " "notation".format( unit.name)) else: raise u.UnitsError( "The unit value provided is not an angular unit.") def do_format(val): s = func(float(val)) if alwayssign and not s.startswith('-'): s = '+' + s if format == 'latex': s = '${0}$'.format(s) return s format_ufunc = np.vectorize(do_format, otypes=[np.object]) result = format_ufunc(values) if result.ndim == 0: result = result[()] return result def wrap_at(self, wrap_angle, inplace=False): """ Wrap the Angle object at the given ``wrap_angle``. This method forces all the angle values to be within a contiguous 360 degree range so that ``wrap_angle - 360d <= angle < wrap_angle``. By default a new Angle object is returned, but if the ``inplace`` argument is ``True`` then the Angle object is wrapped in place and nothing is returned. For instance:: >>> from astropy.coordinates import Angle >>> import astropy.units as u >>> a = Angle([-20.0, 150.0, 350.0] * u.deg) >>> a.wrap_at(360 * u.deg).degree # Wrap into range 0 to 360 degrees array([ 340., 150., 350.]) >>> a.wrap_at('180d', inplace=True) # Wrap into range -180 to 180 degrees >>> a.degree array([ -20., 150., -10.]) Parameters ---------- wrap_angle : str, Angle, angular Quantity Specifies a single value for the wrap angle. This can be any object that can initialize an Angle object, e.g. '180d', 180 * u.deg, or Angle(180, unit=u.deg). inplace : bool If ``True`` then wrap the object in place instead of returning a new Angle Returns ------- out : Angle or None If ``inplace is False`` (default), return new Angle object with angles wrapped accordingly. Otherwise wrap in place and return None. """ wrap_angle = Angle(wrap_angle) # Convert to an Angle wrapped = np.mod(self - wrap_angle, 360.0 * u.deg) - (360.0 * u.deg - wrap_angle) if inplace: self[()] = wrapped else: return wrapped def is_within_bounds(self, lower=None, upper=None): """ Check if all angle(s) satisfy ``lower <= angle < upper`` If ``lower`` is not specified (or ``None``) then no lower bounds check is performed. Likewise ``upper`` can be left unspecified. For example:: >>> from astropy.coordinates import Angle >>> import astropy.units as u >>> a = Angle([-20, 150, 350] * u.deg) >>> a.is_within_bounds('0d', '360d') False >>> a.is_within_bounds(None, '360d') True >>> a.is_within_bounds(-30 * u.deg, None) True Parameters ---------- lower : str, Angle, angular Quantity, None Specifies lower bound for checking. This can be any object that can initialize an Angle object, e.g. '180d', 180 * u.deg, or Angle(180, unit=u.deg). upper : str, Angle, angular Quantity, None Specifies upper bound for checking. This can be any object that can initialize an Angle object, e.g. '180d', 180 * u.deg, or Angle(180, unit=u.deg). Returns ------- is_within_bounds : bool True if all angles satisfy ``lower <= angle < upper`` """ ok = True if lower is not None: ok &= np.all(Angle(lower) <= self) if ok and upper is not None: ok &= np.all(self < Angle(upper)) return bool(ok) @deprecated("0.3", name="format", alternative="to_string") def format(self, unit=u.degree, decimal=False, sep='fromunit', precision=5, alwayssign=False, pad=False): return self.to_string( unit=unit, decimal=decimal, sep=sep, precision=precision, alwayssign=alwayssign, pad=pad) def __str__(self): return str(self.to_string()) def _repr_latex_(self): return str(self.to_string(format='latex')) class Latitude(Angle): """ Latitude-like angle(s) which must be in the range -90 to +90 deg. A Latitude object is distinguished from a pure `Angle` by virtue of being constrained so that:: -90.0 * u.deg <= angle(s) <= +90.0 * u.deg Any attempt to set a value outside that range will result in a `ValueError`. The input angle(s) can be specified either as an array, list, scalar, tuple (see below), string, :class:`~astropy.units.quantity.Quantity` or another `Angle`. The input parser is flexible and supports all of the input formats supported by `Angle`. Parameters ---------- angle : array, list, scalar, Quantity, Angle The angle value(s). If a tuple, will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending on `unit`. If a string, it will be interpreted following the rules described for `Angle`. If `angle` is a sequence or array of strings, the resulting values will be in the given `unit`, or if None is provided, the unit will be taken from the first given value. unit : :class:`~astropy.units.core.UnitBase`, str, optional The unit of the value specified for the angle. This may be any string that `~astropy.units.Unit` understands, but it is better to give an actual unit object. Must be an angular unit. Raises ------ `~astropy.units.core.UnitsError` If a unit is not provided or it is not an angular unit. """ def __new__(cls, angle, unit=None, **kwargs): self = super(Latitude, cls).__new__(cls, angle, unit=unit, **kwargs) self._validate_angles() return self def _validate_angles(self): if np.any(self < -90.0 * u.deg) or np.any(self > 90.0 * u.deg): raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, ' 'got {0}'.format(self.degree)) def __setitem__(self, item, value): super(Latitude, self).__setitem__(item, value) self._validate_angles() class Longitude(Angle): """ Longitude-like angle(s) which are wrapped within a contiguous 360 degree range. A ``Longitude`` object is distinguished from a pure `~astropy.coordinates.Angle` by virtue of a ``wrap_angle`` property. The ``wrap_angle`` specifies that all angle values represented by the object will be in the range:: wrap_angle - 360 * u.deg <= angle(s) < wrap_angle The default ``wrap_angle`` is 360 deg. Setting ``wrap_angle=180 * u.deg`` would instead result in values between -180 and +180 deg. Setting the ``wrap_angle`` attribute of an existing ``Longitude`` object will result in re-wrapping the angle values in-place. The input angle(s) can be specified either as an array, list, scalar, tuple, string, :class:`~astropy.units.quantity.Quantity` or another `Angle`. The input parser is flexible and supports all of the input formats supported by `Angle`. Parameters ---------- angle : array, list, scalar, Quantity, `Angle` The angle value(s). If a tuple, will be interpreted as ``(h, m s)`` or ``(d, m, s)`` depending on `unit`. If a string, it will be interpreted following the rules described for `Angle`. If `angle` is a sequence or array of strings, the resulting values will be in the given `unit`, or if None is provided, the unit will be taken from the first given value. unit : :class:`~astropy.units.core.UnitBase`, str, optional The unit of the value specified for the angle. This may be any string that `~astropy.units.Unit` understands, but it is better to give an actual unit object. Must be an angular unit. wrap_angle : `Angle` or equivalent Angle at which to wrap back to ``wrap_angle - 360 deg``. Raises ------ `~astropy.units.core.UnitsError` If a unit is not provided or it is not an angular unit. """ def __new__(cls, angle, unit=None, wrap_angle=360 * u.deg, **kwargs): self = super(Longitude, cls).__new__(cls, angle, unit=unit, **kwargs) self.wrap_angle = wrap_angle return self def __setitem__(self, item, value): super(Longitude, self).__setitem__(item, value) self._wrap_internal() def _wrap_internal(self): """ Wrap the internal values in the Longitude object. Using the `Angle` wrap_at() method causes recursion. """ d360 = 360.0 * u.deg wrapped = np.mod(self - self.wrap_angle, d360) - (d360 - self.wrap_angle) super(Longitude, self).__setitem__((), wrapped) @property def wrap_angle(self): return self._wrap_angle @wrap_angle.setter def wrap_angle(self, value): self._wrap_angle = Angle(value) self._wrap_internal() def __quantity_view__(self, obj, unit): unit = self._convert_unit_to_angle_unit(unit) if unit is not None and unit.is_equivalent(u.radian): # by default, wrap_angle and equivalencies remain the same # TODO: generalize to some _things_to_copy once #1422, #1373 merged return obj.view(Longitude) return super(Angle, self).__quantity_view__(obj, unit) def __quantity_instance__(self, val, unit, **kwargs): unit = self._convert_unit_to_angle_unit(unit) if unit is not None and unit.is_equivalent(u.radian): # by default, wrap_angle remains the same if 'wrap_angle' not in kwargs: kwargs['wrap_angle'] = getattr(self, 'wrap_angle') return Longitude(val, unit, **kwargs) return super(Angle, self).__quantity_instance__(val, unit, **kwargs) def __getitem__(self, key): out = super(Longitude, self).__getitem__(key) out._wrap_angle = self._wrap_angle return out # deprecated; TODO: move to quantity later (once #1422, #1373 merged) def __getslice__(self, i, j): return self.__getitem__(slice(i, j)) #<----------------------------------Rotations---------------------------------> def rotation_matrix(angle, axis='z', unit=None): """ Generate a 3x3 cartesian rotation matrix in for rotation about a particular axis. Parameters ---------- angle : convertible to Angle The amount of rotation this matrix should represent. axis : str or 3-sequence Either 'x','y', 'z', or a (x,y,z) specifying an axis to rotate about. If 'x','y', or 'z', the rotation sense is counterclockwise looking down the + axis (e.g. positive rotations obey left-hand-rule). unit : UnitBase, optional If `angle` does not have associated units, they are in this unit. If neither are provided, it is assumed to be degrees. Returns ------- rmat: `numpy.matrix` A unitary rotation matrix. """ # TODO: This doesn't handle arrays of angles if unit is None: unit = u.degree angle = Angle(angle, unit=unit) if axis == 'z': s = np.sin(angle) c = np.cos(angle) return np.matrix(((c, s, 0), (-s, c, 0), (0, 0, 1))) elif axis == 'y': s = np.sin(angle) c = np.cos(angle) return np.matrix(((c, 0, -s), (0, 1, 0), (s, 0, c))) elif axis == 'x': s = np.sin(angle) c = np.cos(angle) return np.matrix(((1, 0, 0), (0, c, s), (0, -s, c))) else: x, y, z = axis w = np.cos(angle / 2) # normalize if w == 1: x = y = z = 0 else: l = np.sqrt((x * x + y * y + z * z) / (1 - w * w)) x /= l y /= l z /= l wsq = w * w xsq = x * x ysq = y * y zsq = z * z return np.matrix(((wsq + xsq - ysq - zsq, 2 * x * y - 2 * w * z, 2 * x * z + 2 * w * y), (2 * x * y + 2 * w * z, wsq - xsq + ysq - zsq, 2 * y * z - 2 * w * x), (2 * x * z - 2 * w * y, 2 * y * z + 2 * w * x, wsq - xsq - ysq + zsq))) def angle_axis(matrix, unit=None): """ Computes the angle of rotation and the rotation axis for a given rotation matrix. Parameters ---------- matrix : array-like A 3 x 3 unitary rotation matrix. unit : UnitBase The output unit. If `None`, the output unit is degrees. Returns ------- angle : Angle The angle of rotation for this matrix. axis : array (length 3) The axis of rotation for this matrix. """ # TODO: This doesn't handle arrays of angles m = np.asmatrix(matrix) if m.shape != (3, 3): raise ValueError('matrix is not 3x3') angle = np.acos((m[0, 0] + m[1, 1] + m[2, 2] - 1) / 2) denom = np.sqrt(2 * ((m[2, 1] - m[1, 2]) + (m[0, 2] - m[2, 0]) + (m[1, 0] - m[0, 1]))) axis = np.array((m[2, 1] - m[1, 2], m[0, 2] - m[2, 0], m[1, 0] - m[0, 1])) / denom axis /= np.sqrt(np.sum(axis ** 2)) angle = Angle(angle, u.radian) if unit is None: unit = u.degree return angle.to(unit), axis astropy-0.3/astropy/coordinates/old_builtin_systems_names.py0000644000175000017500000001060012243255342023037 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains a set of compatibility classes to allow use of the pre-v0.3 coordinate names. It will be removed in a future version. """ #TODO: remove this module in a future version from .builtin_systems import * from .transformations import master_transform_graph __all__ = ['ICRSCoordinates', 'FK5Coordinates', 'FK4Coordinates', 'FK4NoETermCoordinates', 'GalacticCoordinates', 'HorizontalCoordinates' ] class ICRSCoordinates(ICRS): """ Using the `ICRSCoordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `ICRS` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return ICRS(*args, **kwargs) class FK5Coordinates(FK5): """ Using the `FK5Coordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `FK5` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return FK5(*args, **kwargs) class FK4Coordinates(FK4): """ Using the `FK4Coordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `FK4` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return FK4(*args, **kwargs) class FK4NoETermCoordinates(FK4NoETerms): """ Using the `FK4NoETermCoordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `FK4NoETerms` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return FK4NoETerms(*args, **kwargs) class GalacticCoordinates(Galactic): """ Using the `GalacticCoordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `Galactic` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return Galactic(*args, **kwargs) class HorizontalCoordinates(AltAz): """ Using the `HorizontalCoordinates` name for this class is deprecated in v0.3, and will be removed in the next version. Use `AltAz` instead. """ def __new__(cls, *args, **kwargs): from warnings import warn from ..utils.exceptions import AstropyBackwardsIncompatibleChangeWarning wmsg = cls.__doc__.replace('\n ', ' ').strip() warn(AstropyBackwardsIncompatibleChangeWarning(wmsg)) return AltAz(*args, **kwargs) def _add_transforms(clses, graph): """ Adds fake transformations that allow transforming to the old names, although they actually yield the new class types """ from copy import deepcopy for cls in clses: newcls = cls.mro()[1] gdct = graph._graph toadd = [] for a in gdct: for b in gdct[a]: if b == newcls: toadd.append((a, cls, gdct[a][b])) for a, b, t in toadd: #adds a new transform that goes *to* the old name class graph.add_transform(a, b, t) #also add a transformation that just gives itself back to go from #self to old-style name graph.add_transform(newcls, cls, lambda c:deepcopy(c)) #Now go through and add transforms so that the old names give you transforms to new things _add_transforms([globals()[nm] for nm in __all__], master_transform_graph) astropy-0.3/astropy/coordinates/angle_utilities.py0000644000175000017500000004355412243255342020760 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains utility functions that are for internal use in astropy.coordinates.angles. Mainly they are conversions from one format of data to another. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import os from warnings import warn import numpy as np from .errors import (IllegalHourWarning, IllegalHourError, IllegalMinuteWarning, IllegalMinuteError, IllegalSecondWarning, IllegalSecondError) from ..utils import format_exception from .. import units as u class _AngleParser(object): """ Parses the various angle formats including: * 01:02:30.43 degrees * 1 2 0 hours * 1°2′3″ * 1d2m3s * -1h2m3s This class should not be used directly. Use `parse_angle` instead. """ def __init__(self): if '_parser' not in _AngleParser.__dict__: _AngleParser._parser, _AngleParser._lexer = self._make_parser() @classmethod def _get_simple_unit_names(cls): simple_units = set( u.radian.find_equivalent_units(include_prefix_units=True)) simple_units.remove(u.deg) simple_units.remove(u.hourangle) simple_unit_names = set() for unit in simple_units: simple_unit_names.update(unit.names) return list(simple_unit_names) @classmethod def _make_parser(cls): from ..extern.ply import lex, yacc # List of token names. tokens = ( 'SIGN', 'UINT', 'UFLOAT', 'COLON', 'DEGREE', 'HOUR', 'MINUTE', 'SECOND', 'SIMPLE_UNIT' ) # NOTE THE ORDERING OF THESE RULES IS IMPORTANT!! # Regular expression rules for simple tokens def t_UFLOAT(t): r'((\d+\.\d*)|(\.\d+))([eE][+-−]?\d+)?' # The above includes Unicode "MINUS SIGN" \u2212. It is # important to include the hyphen last, or the regex will # treat this as a range. t.value = float(t.value.replace('−', '-')) return t def t_UINT(t): r'\d+' t.value = int(t.value) return t def t_SIGN(t): r'[+−-]' # The above include Unicode "MINUS SIGN" \u2212. It is # important to include the hyphen last, or the regex will # treat this as a range. if t.value == '+': t.value = 1.0 else: t.value = -1.0 return t def t_SIMPLE_UNIT(t): t.value = u.Unit(t.value) return t t_SIMPLE_UNIT.__doc__ = '|'.join( '(?:{0})'.format(x) for x in cls._get_simple_unit_names()) t_COLON = ':' t_DEGREE = r'd(eg(ree(s)?)?)?|°' t_HOUR = r'hour(s)?|h(r)?|ʰ' t_MINUTE = r'm(in(ute(s)?)?)?|′|\'|áµ' t_SECOND = r's(ec(ond(s)?)?)?|″|\"|Ë¢' # A string containing ignored characters (spaces) t_ignore = ' ' # Error handling rule def t_error(t): raise ValueError( "Invalid character at col {0}".format(t.lexpos)) # Build the lexer try: from . import angle_lextab lexer = lex.lex(optimize=True, lextab=angle_lextab) except ImportError: lexer = lex.lex(optimize=True, lextab='angle_lextab', outputdir=os.path.dirname(__file__)) def p_angle(p): ''' angle : hms | dms | arcsecond | arcminute | simple ''' p[0] = p[1] def p_sign(p): ''' sign : SIGN | ''' if len(p) == 2: p[0] = p[1] else: p[0] = 1.0 def p_ufloat(p): ''' ufloat : UFLOAT | UINT ''' p[0] = float(p[1]) def p_colon(p): ''' colon : sign UINT COLON UINT | sign UINT COLON UINT COLON ufloat ''' if len(p) == 5: p[0] = (p[1] * p[2], p[4], 0.0) elif len(p) == 7: p[0] = (p[1] * p[2], p[4], p[6]) def p_spaced(p): ''' spaced : sign UINT UINT | sign UINT UINT ufloat ''' if len(p) == 4: p[0] = (p[1] * p[2], p[3], 0.0) elif len(p) == 5: p[0] = (p[1] * p[2], p[3], p[4]) def p_generic(p): ''' generic : colon | spaced | sign UFLOAT | sign UINT ''' if len(p) == 2: p[0] = p[1] else: p[0] = p[1] * p[2] def p_hms(p): ''' hms : sign UINT HOUR | sign UINT HOUR UINT | sign UINT HOUR UINT MINUTE | sign UINT HOUR UINT MINUTE ufloat | sign UINT HOUR UINT MINUTE ufloat SECOND | generic HOUR ''' if len(p) == 3: p[0] = (p[1], u.hourangle) elif len(p) == 4: p[0] = (p[1] * p[2], u.hourangle) elif len(p) in (5, 6): p[0] = ((p[1] * p[2], p[4], 0.0), u.hourangle) elif len(p) in (7, 8): p[0] = ((p[1] * p[2], p[4], p[6]), u.hourangle) def p_dms(p): ''' dms : sign UINT DEGREE | sign UINT DEGREE UINT | sign UINT DEGREE UINT MINUTE | sign UINT DEGREE UINT MINUTE ufloat | sign UINT DEGREE UINT MINUTE ufloat SECOND | generic DEGREE ''' if len(p) == 3: p[0] = (p[1], u.degree) elif len(p) == 4: p[0] = (p[1] * p[2], u.degree) elif len(p) in (5, 6): p[0] = ((p[1] * p[2], p[4], 0.0), u.degree) elif len(p) in (7, 8): p[0] = ((p[1] * p[2], p[4], p[6]), u.degree) def p_simple(p): ''' simple : generic | generic SIMPLE_UNIT ''' if len(p) == 2: p[0] = (p[1], None) else: p[0] = (p[1], p[2]) def p_arcsecond(p): ''' arcsecond : generic SECOND ''' p[0] = (p[1], u.arcsecond) def p_arcminute(p): ''' arcminute : generic MINUTE ''' p[0] = (p[1], u.arcminute) def p_error(p): raise ValueError try: from . import angle_parsetab parser = yacc.yacc(debug=False, tabmodule=angle_parsetab, write_tables=False) except ImportError: parser = yacc.yacc(debug=False, tabmodule='angle_parsetab', outputdir=os.path.dirname(__file__)) return parser, lexer def parse(self, angle, unit, debug=False): try: found_angle, found_unit = self._parser.parse( angle, lexer=self._lexer, debug=debug) except ValueError as e: if str(e): raise ValueError("{0} in angle {1!r}".format( str(e), angle)) else: raise ValueError( "Syntax error parsing angle {0!r}".format(angle)) if unit is None and found_unit is None: raise u.UnitsError("No unit specified") return found_angle, found_unit def _check_hour_range(hrs): """ Checks that the given value is in the range (-24, 24). """ if np.any(np.abs(hrs) == 24.): warn(IllegalHourWarning(hrs, 'Treating as 24 hr')) elif np.any(hrs < -24.) or np.any(hrs > 24.): raise IllegalHourError(hrs) def _check_minute_range(m): """ Checks that the given value is in the range [0,60]. If the value is equal to 60, then a warning is raised. """ if np.any(m == 60.): warn(IllegalMinuteWarning(m, 'Treating as 0 min, +1 hr/deg')) elif np.any(m < -60.) or np.any(m > 60.): # "Error: minutes not in range [-60,60) ({0}).".format(min)) raise IllegalMinuteError(m) def _check_second_range(sec): """ Checks that the given value is in the range [0,60]. If the value is equal to 60, then a warning is raised. """ if np.any(sec == 60.): warn(IllegalSecondWarning(sec, 'Treating as 0 sec, +1 min')) elif np.any(sec < -60.) or np.any(sec > 60.): # "Error: seconds not in range [-60,60) ({0}).".format(sec)) raise IllegalSecondError(sec) def check_hms_ranges(h, m, s): """ Checks that the given hour, minute and second are all within reasonable range. """ _check_hour_range(h) _check_minute_range(m) _check_second_range(s) return None def parse_angle(angle, unit=None, debug=False): """ Parses an input string value into an angle value. Parameters ---------- angle : str A string representing the angle. May be in one of the following forms: * 01:02:30.43 degrees * 1 2 0 hours * 1°2′3″ * 1d2m3s * -1h2m3s unit : `~astropy.units.UnitBase` instance, optional The unit used to interpret the string. If `unit` is not provided, the unit must be explicitly represented in the string, either at the end or as number separators. debug : bool, optional If `True`, print debugging information from the parser. Returns ------- value, unit : tuple `value` is the value as a floating point number or three-part tuple, and `unit` is a `Unit` instance which is either the unit passed in or the one explicitly mentioned in the input string. """ return _AngleParser().parse(angle, unit, debug=debug) def degrees_to_dms(d): """ Convert a floating-point degree value into a ``(degree, arcminute, arcsecond)`` tuple. """ sign = np.copysign(1.0, d) (df, d) = np.modf(np.abs(d)) # (degree fraction, degree) (mf, m) = np.modf(df * 60.) # (minute fraction, minute) s = mf * 60. return np.floor(sign * d), sign * np.floor(m), sign * s def dms_to_degrees(d, m, s): """ Convert degrees, arcminute, arcsecond to a float degrees value. """ _check_minute_range(m) _check_second_range(s) # determine sign sign = np.copysign(1.0, d) # TODO: This will fail if d or m have values after the decimal # place try: d = np.floor(np.abs(np.asarray(d))) m = np.floor(np.abs(np.asarray(m))) s = np.abs(s) except ValueError: raise ValueError(format_exception( "{func}: dms values ({1[0]},{2[1]},{3[2]}) could not be " "converted to numbers.", d, m, s)) return sign * (d + m / 60. + s / 3600.) def hms_to_hours(h, m, s): """ Convert hour, minute, second to a float hour value. """ check_hms_ranges(h, m, s) # determine sign sign = np.copysign(1.0, h) # TODO: This will fail if d or m have values after the decimal # place try: h = np.floor(np.abs(h)) m = np.floor(np.abs(m)) s = np.abs(s) except ValueError: raise ValueError(format_exception( "{func}: HMS values ({1[0]},{2[1]},{3[2]}) could not be " "converted to numbers.", h, m, s)) return sign * (h + m / 60. + s / 3600.) def hms_to_degrees(h, m, s): """ Convert hour, minute, second to a float degrees value. """ return hms_to_hours(h, m, s) * 15. def hms_to_radians(h, m, s): """ Convert hour, minute, second to a float radians value. """ return u.degree.to(u.radian, hms_to_degrees(h, m, s)) def hms_to_dms(h, m, s): """ Convert degrees, arcminutes, arcseconds to an ``(hour, minute, second)`` tuple. """ return degrees_to_dms(hms_to_degrees(h, m, s)) def hours_to_decimal(h): """ Convert any parseable hour value into a float value. """ from . import angles return angles.Angle(h, unit=u.hourangle).hour def hours_to_radians(h): """ Convert an angle in Hours to Radians. """ return u.hourangle.to(u.radian, h) def hours_to_hms(h): """ Convert an floating-point hour value into an ``(hour, minute, second)`` tuple. """ sign = np.copysign(1.0, h) (hf, h) = np.modf(np.abs(h)) # (degree fraction, degree) (mf, m) = np.modf(hf * 60.0) # (minute fraction, minute) s = mf * 60.0 return (np.floor(sign * h), sign * np.floor(m), sign * s) def radians_to_degrees(r): """ Convert an angle in Radians to Degrees. """ return u.radian.to(u.degree, r) def radians_to_hours(r): """ Convert an angle in Radians to Hours. """ return u.radian.to(u.hourangle, r) def radians_to_hms(r): """ Convert an angle in Radians to an ``(hour, minute, second)`` tuple. """ hours = radians_to_hours(r) return hours_to_hms(hours) def radians_to_dms(r): """ Convert an angle in Radians to an ``(degree, arcminute, arcsecond)`` tuple. """ degrees = u.radian.to(u.degree, r) return degrees_to_dms(degrees) def sexagesimal_to_string(values, precision=None, pad=False, sep=(':',), fields=3): """ Given an already separated tuple of sexagesimal values, returns a string. See `hours_to_string` and `degrees_to_string` for a higher-level interface to this functionality. """ # If the coordinates are negative, we need to take the absolute value of # the (arc)minutes and (arc)seconds. We need to use np.abs because abs(-0) # is -0. values = (values[0], np.abs(values[1]), np.abs(values[2])) if pad: if values[0] < 0: pad = 3 else: pad = 2 else: pad = 0 if not isinstance(sep, tuple): sep = tuple(sep) if len(sep) == 1: sep = sep + (sep[0], '') elif len(sep) == 2: sep = sep + ('',) elif len(sep) != 3: raise ValueError( "Invalid separator specification for converting angle to string.") if fields < 1 or fields > 3: raise ValueError( "fields must be 1, 2, or 3") # Simplify the expression based on the requested precision. For # example, if the seconds will round up to 60, we should convert # it to 0 and carry upwards. If the field is hidden (by the # fields kwarg) we round up around the middle, 30.0. if precision is None: rounding_thresh = 60.0 - (10.0 ** -5) else: rounding_thresh = 60.0 - (10.0 ** -precision) values = list(values) if fields == 3 and values[2] >= rounding_thresh: values[2] = 0.0 values[1] += 1.0 elif fields < 3 and values[2] >= 30.0: values[1] += 1.0 if fields >= 2 and int(values[1]) >= 60.0: values[1] = 0.0 values[0] += 1.0 elif fields < 2 and int(values[1]) >= 30.0: values[0] += 1.0 literal = [] last_value = '' literal.append('{0:0{pad}.0f}{sep[0]}') if fields >= 2: literal.append('{1:02d}{sep[1]}') if fields == 3: if precision is None: last_value = '{0:g}'.format(abs(values[2])) else: last_value = '{0:.{precision}f}'.format( abs(values[2]), precision=precision) if len(last_value) == 1 or last_value[1] == '.': last_value = '0' + last_value literal.append('{last_value}{sep[2]}') literal = ''.join(literal) return literal.format(values[0], int(abs(values[1])), abs(values[2]), sep=sep, pad=pad, last_value=last_value) def hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'), fields=3): """ Takes a decimal hour value and returns a string formatted as hms with separator specified by the 'sep' parameter. `h` must be a scalar. """ h, m, s = hours_to_hms(h) return sexagesimal_to_string((h, m, s), precision=precision, pad=pad, sep=sep, fields=fields) def degrees_to_string(d, precision=5, pad=False, sep=':', fields=3): """ Takes a decimal hour value and returns a string formatted as dms with separator specified by the 'sep' parameter. `d` must be a scalar. """ d, m, s = degrees_to_dms(d) return sexagesimal_to_string((d, m, s), precision=precision, pad=pad, sep=sep, fields=fields) def angular_separation(lon1, lat1, lon2, lat2): """ Angular separation between two points on a sphere Parameters ---------- lon1, lat1, lon2, lat2 : Angle, Quantity or float Longitude and latitude of the two points. Quantities should be in angular units; floats in radians Returns ------- angular separation : Quantity or float Type depends on input; Quantity in angular units, or float in radians Notes ----- The angular separation is calculated using the Vincenty formula [1]_, which is slighly more complex and computationally expensive than some alternatives, but is stable at at all distances, including the poles and antipodes. .. [1] http://en.wikipedia.org/wiki/Great-circle_distance """ sdlon = np.sin(lon2 - lon1) cdlon = np.cos(lon2 - lon1) slat1 = np.sin(lat1) slat2 = np.sin(lat2) clat1 = np.cos(lat1) clat2 = np.cos(lat2) num1 = clat2 * sdlon num2 = clat1 * slat2 - slat1 * clat2 * cdlon denominator = slat1 * slat2 + clat1 * clat2 * cdlon return np.arctan2(np.sqrt(num1 ** 2 + num2 ** 2), denominator) astropy-0.3/astropy/coordinates/transformations.py0000644000175000017500000007251012243255342021022 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the framework for transforming points from one coordinate system to another (e.g. equatorial to galactic). The implementation is actually in individual coordinates in the `builtin_systems` module, while this module provides the framework and related utilities. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from ..extern import six import heapq import inspect import subprocess from abc import ABCMeta, abstractmethod from collections import defaultdict import numpy as np __all__ = ['StaticMatrixTransform', 'FunctionTransform', 'DynamicMatrixTransform', 'CompositeStaticMatrixTransform', 'static_transform_matrix', 'transform_function', 'dynamic_transform_matrix', 'coordinate_alias' ] class TransformGraph(object): """ A graph representing the paths between coordinate systems. """ def __init__(self): self._graph = defaultdict(dict) self._clsaliases = {} self.invalidate_cache() # generates cache entries def add_transform(self, fromsys, tosys, transform): """ Add a new coordinate transformation to the graph. Parameters ---------- fromsys : class The coordinate system *class* to start from tosys : class The coordinate system *class* to transform to transform : callable The transformation object. Should have call parameters compatible with `CoordinateTransform`. Raises ------ TypeError If `fromsys` or `tosys` are not classes or `transform` is not callable. """ if not inspect.isclass(fromsys): raise TypeError('fromsys must be a class') if not inspect.isclass(tosys): raise TypeError('tosys must be a class') if not six.callable(transform): raise TypeError('transform must be callable') self._graph[fromsys][tosys] = transform self.invalidate_cache() def remove_transform(self, fromsys, tosys, transform): """ Removes a coordinate transform from the graph. Parameters ---------- fromsys : class or None The coordinate system *class* to start from. If None, `transform` will be searched for and removed (`tosys` must also be None). tosys : class or None The coordinate system *class* to transform into. If None, `transform` will be searched for and removed (`fromsys` must also be None). transform : callable or None The transformation object to be removed or None. If None and `tosys` and `fromsys` are supplied, there will be no check to ensure the correct object is removed. """ if fromsys is None or tosys is None: if not (tosys is None and fromsys is None): raise ValueError('fromsys and tosys must both be None if either are') if transform is None: raise ValueError('cannot give all Nones to remove_transform') # search for the requested transform by brute force and remove it for a in self._graph: agraph = self._graph[a] for b in agraph: if b is transform: del agraph[b] break else: raise ValueError('Could not find transform {0} in the ' 'graph'.format(transform)) else: if transform is None: self._graph[fromsys].pop(tosys, None) else: curr = self._graph[fromsys].get(tosys, None) if curr is transform: self._graph[fromsys].pop(tosys) else: raise ValueError('Current transform from {0} to {1} is not ' '{2}'.format(fromsys, tosys, transform)) self.invalidate_cache() def find_shortest_path(self, fromsys, tosys): """ Computes the shortest distance along the transform graph from one system to another. Parameters ---------- fromsys : class The starting coordinate system. tosys : class The starting coordinate system. Returns ------- path : list of classes or None The path from `fromsys` to `tosys` as an in-order sequence of classes. This list includes *both* `fromsys` and `tosys`. Is None if there is no possible path. distance : number The total distance/priority from `fromsys` to `tosys`. If priorities are not set this is the number of trasnforms needed. Is `inf` if there is no possible path. """ inf = float('inf') # special-case the 0-path and 1-path if tosys is fromsys: return [tosys], 0 elif tosys in self._graph[fromsys]: t = self._graph[fromsys][tosys] return [fromsys, tosys], float(t.priority if hasattr(t, 'priority') else 1) if fromsys in self._shortestpaths: # already have a cached result fpaths = self._shortestpaths[fromsys] if tosys in fpaths: return fpaths[tosys] else: return None, inf # use Dijkstra's algorithm to find shortest path in all other cases nodes = [] # first make the list of nodes for a in self._graph: if a not in nodes: nodes.append(a) for b in self._graph[a]: if b not in nodes: nodes.append(b) if fromsys not in nodes or tosys not in nodes: # fromsys or tosys are isolated or not registered, so there's # certainly no way to get from one to the other return None, inf edgeweights = {} # construct another graph that is a dict of dicts of priorities # (used as edge weights in Dijkstra's algorithm) for a in self._graph: edgeweights[a] = aew = {} agraph = self._graph[a] for b in agraph: aew[b] = float(agraph[b].priority if hasattr(agraph[b], 'priority') else 1) # entries in q are [distance, count, nodeobj, pathlist] # count is needed because in py 3.x, tie-breaking fails on the nodes. # this way, insertion order is preserved if the weights are the same q = [[inf, i, n, []] for i, n in enumerate(nodes) if n is not fromsys] q.insert(0, [0, -1, fromsys, []]) # this dict will store the distance to node from `fromsys` and the path result = {} # definitely starts as a valid heap because of the insert line; from the # node to itself is always the shortest distance while len(q) > 0: d, orderi, n, path = heapq.heappop(q) if d == inf: # everything left is unreachable from fromsys, just copy them to # the results and jump out of the loop result[n] = (None, d) for d, orderi, n, path in q: result[n] = (None, d) break else: result[n] = (path, d) path.append(n) if n not in edgeweights: # this is a system that can be transformed to, but not from. continue for n2 in edgeweights[n]: if n2 not in result: # already visited # find where n2 is in the heap for i in range(len(q)): if q[i][2] == n2: break else: raise ValueError('n2 not in heap - this should be impossible!') newd = d + edgeweights[n][n2] if newd < q[i][0]: q[i][0] = newd q[i][3] = list(path) heapq.heapify(q) # cache for later use self._shortestpaths[fromsys] = result return result[tosys] def invalidate_cache(self): """ Invalidates the cache that stores optimizations for traversing the transform cache. This is called automatically when transforms are added or removed, but will need to be called manually if weights on transforms are modified inplace. """ self._shortestpaths = {} # TODO: cache composites so they don't need to be generated every time? def get_transform(self, fromsys, tosys): """ Determines or generates a transformation between two coordinate systems. Parameters ---------- fromsys : class The coordinate system *class* to start from tosys : class The coordinate system *class* to transform into. Returns ------- trans : `CoordinateTransform` or None If there is a path from `fromsys` to `tosys`, this is a transform object for that path. If None, no path could be found. """ if tosys in self._graph[fromsys]: return self._graph[fromsys][tosys] else: path, distance = self.find_shortest_path(fromsys, tosys) if path is None: return None transforms = [] currsys = fromsys for p in path[1:]: # first element is fromsys so we skip it transforms.append(self._graph[currsys][p]) currsys = p # TODO: collapse "runs" of statics? if all([isinstance(p, StaticMatrixTransform) for p in path]): return CompositeStaticMatrixTransform(fromsys, tosys, transforms, register=False) else: return CompositeTransform(fromsys, tosys, transforms, register=False) def add_coord_name(self, name, coordcls): """ Adds an alias for a coordinate, primarily for allowing attribute-style access of coordinate transformations (e.g., ``coordasgal = coord.galactic``). Parameters ---------- name : str The alias for the coordinate class. Should be a valid python identifier. coordcls : class The class object to be referenced by this name. Raises ------ ValueError If `coordcls` already has a name assigned. """ if coordcls in list(six.itervalues(self._clsaliases)): idx = list(six.itervalues(self._clsaliases)).index(coordcls) oldnm = list(six.iterkeys(self._clsaliases))[idx] msg = 'Coordinate class {0} already has a name: {1}' raise ValueError(msg.format(coordcls, oldnm)) self._clsaliases[name] = coordcls def lookup_name(self, name): """ Tries to locate the coordinate class with the provided alias. Parameters ---------- name : str The alias to look up. Returns ------- coordcls The coordinate class corresponding to the `name` or None if no such class exists. """ return self._clsaliases.get(name, None) def get_aliases(self): """ Returns all available transform aliases. They will all be valid arguments to `lookup_name`. Returns ------- nms : list The aliases for coordinate systems. """ return list(six.iterkeys(self._clsaliases)) def to_dot_graph(self, priorities=True, addnodes=[], savefn=None, savelayout='plain', saveformat=None): """ Converts this transform graph to the graphviz_ DOT format, and optionally saves it (requires graphviz_ be installed and on your path). Parameters ---------- priorities : bool If True, show the priority values for each transform. Otherwise, the will not be included in the graph. addnodes : sequence of str Additional coordinate systems to add (this can include systems already in the transform graph, but they will only appear once). savefn : None or str The file name to save this graph to or None to not save to a file. savelayout : str The graphviz program to use to layout the graph (see graphviz_ for details) or 'plain' to just save the DOT graph content. Ignored if `savefn` is None. saveformat : str The graphviz output format. (e.g. the ``-Txxx`` option for the command line program - see graphviz docs for details). Ignored if `savefn` is None. Returns ------- dotgraph : str A string with the DOT format graph. .. _graphviz: http://www.graphviz.org/ """ nodes = [] # find the node names for a in self._graph: if a not in nodes: nodes.append(a) for b in self._graph[a]: if b not in nodes: nodes.append(b) for node in addnodes: if node not in nodes: nodes.append(node) nodenames = [] invclsaliases = dict([(v, k) for k, v in six.iteritems(self._clsaliases)]) for n in nodes: if n in invclsaliases: nodenames.append('{0} [shape=oval label="{0}\\n`{1}`"]'.format(n.__name__, invclsaliases[n])) else: nodenames.append(n.__name__ + '[ shape=oval ]') edgenames = [] # Now the edges for a in self._graph: agraph = self._graph[a] for b in agraph: pri = agraph[b].priority if hasattr(agraph[b], 'priority') else 1 edgenames.append((a.__name__, b.__name__, pri)) # generate simple dot format graph lines = ['digraph AstropyCoordinateTransformGraph {'] lines.append('; '.join(nodenames) + ';') for enm1, enm2, weights in edgenames: labelstr = '[ label = "{0}" ]'.format(weights) if priorities else '' lines.append('{0} -> {1}{2};'.format(enm1, enm2, labelstr)) lines.append('') lines.append('overlap=false') lines.append('}') dotgraph = '\n'.join(lines) if savefn is not None: if savelayout == 'plain': with open(savefn, 'w') as f: f.write(dotgraph) else: args = [savelayout] if saveformat is not None: args.append('-T' + saveformat) proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate(dotgraph) if proc.returncode != 0: raise IOError('problem running graphviz: \n' + stderr) with open(savefn, 'w') as f: f.write(stdout) return dotgraph def to_networkx_graph(self): """ Converts this transform graph into a networkx graph. .. note:: You must have the `networkx `_ package installed for this to work. Returns ------- nxgraph : `networkx.Graph` This `TransformGraph` as a `networkx.Graph`. """ import networkx as nx nxgraph = nx.Graph() # first make the nodes for a in self._graph: if a not in nxgraph: nxgraph.add_node(a) for b in self._graph[a]: if b not in nxgraph: nxgraph.add_node(b) # Now the edges for a in self._graph: agraph = self._graph[a] for b in agraph: pri = agraph[b].priority if hasattr(agraph[b], 'priority') else 1 nxgraph.add_edge(a, b, weight=pri) return nxgraph # The primary transform graph for astropy coordinates master_transform_graph = TransformGraph() @six.add_metaclass(ABCMeta) class CoordinateTransform(object): """ An object that transforms a coordinate from one system to another. Subclasses must implement `__call__` with the provided signature. They should also call this superclass's `__init__` in their `__init__`. """ def __init__(self, fromsys, tosys, register=True): self.fromsys = fromsys self.tosys = tosys if register: # this will do the type-checking self.register() else: if not inspect.isclass(fromsys) or not inspect.isclass(tosys): raise TypeError('fromsys and tosys must be classes') def register(self): """ Add this transformation to the master transformation graph, replacing anything already connecting these two coordinates. """ master_transform_graph.add_transform(self.fromsys, self.tosys, self) def unregister(self): """ Remove this transformation to the master transformation graph. Raises ------ ValueError If this is not currently in the transform graph. """ master_transform_graph.remove_transform(self.fromsys, self.tosys, self) @abstractmethod def __call__(self, fromcoord): """ Accepts the provided coordinate object and yields a new coordinate object with the transform applied. """ # TODO: array: specify in the docs how arrays should be dealt with class FunctionTransform(CoordinateTransform): """ A coordinate transformation defined by a function that simply accepts a coordinate object and returns the transformed coordinate object. Parameters ---------- fromsys : class The coordinate system *class* to start from. tosys : class The coordinate system *class* to transform into. func : callable The transformation function. copyobstime : bool If True (default) the value of the `_obstime` attribute will be copied to the newly-produced coordinate. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. register : bool Determines if this transformation will be registered in the astropy master transform graph. Raises ------ TypeError If `func` is not callable. ValueError If `func` cannot accept one argument. """ def __init__(self, fromsys, tosys, func, copyobstime=True, priority=1, register=True): from inspect import getargspec if not six.callable(func): raise TypeError('func must be callable') try: argspec = getargspec(func) if (len(argspec[0]) - len(argspec[3]) != 1) and not argspec[1]: raise ValueError('provided function does not accept a single argument') except TypeError: pass # hopefully this person knows what they're doing... self.func = func self.priority = priority self.copyobstime = copyobstime super(FunctionTransform, self).__init__(fromsys, tosys) def __call__(self, fromcoord): res = self.func(fromcoord) if not isinstance(res, self.tosys): raise TypeError('the transformation function yielded {0} but ' 'should have been of type {1}'.format(res, self.tosys)) if self.copyobstime: # copy over the obstime if hasattr(fromcoord, '_obstime') and hasattr(res, '_obstime'): res._obstime = fromcoord._obstime return res class StaticMatrixTransform(CoordinateTransform): """ A coordinate transformation defined as a 3 x 3 cartesian transformation matrix. Parameters ---------- fromsys : class The coordinate system *class* to start from. tosys : class The coordinate system *class* to transform into. matrix : array-like A 3 x 3 matrix for transforming 3-vectors. In most cases will be unitary (although this is not strictly required). priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. Raises ------ ValueError If the matrix is not 3 x 3 """ def __init__(self, fromsys, tosys, matrix, priority=1, register=True): self.matrix = np.array(matrix) if self.matrix.shape != (3, 3): raise ValueError('Provided matrix is not 3 x 3') self.priority = priority super(StaticMatrixTransform, self).__init__(fromsys, tosys) def __call__(self, fromcoord): c = fromcoord.cartesian v = c.reshape((3, c.size // 3)) v2 = np.dot(np.asarray(self.matrix), v) subshape = c.shape[1:] x = v2[0].reshape(subshape) y = v2[1].reshape(subshape) z = v2[2].reshape(subshape) newunit = None if fromcoord.distance is None else fromcoord.distance.unit result = self.tosys(x=x, y=y, z=z, unit=newunit) # copy over the observation time if hasattr(fromcoord, '_obstime') and hasattr(result, '_obstime'): result._obstime = fromcoord._obstime return result class CompositeStaticMatrixTransform(StaticMatrixTransform): """ A `MatrixTransform` constructed by combining a sequence of matricies together. See `MatrixTransform` for syntax details. Parameters ---------- fromsys : class The coordinate system *class* to start from. tosys : class The coordinate system *class* to transform into. matrices : sequence of array-like A sequence of 3 x 3 cartesian transformation matricies. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. """ def __init__(self, fromsys, tosys, matricies, priority=1, register=True): self.matricies = [np.array(m) for m in matricies] for m in matricies: if m.shape != (3, 3): raise ValueError('One of the provided matrices is not 3 x 3') matrix = np.array(self.matricies[0]) if len(self.matricies) > 1: for m in self.matricies[1:]: matrix = np.dot(np.asarray(self.matrix), m) super(CompositeStaticMatrixTransform, self).__init__(self, fromsys, tosys, matrix, priority) class DynamicMatrixTransform(CoordinateTransform): """ A coordinate transformation specified as a function that yields a 3 x 3 cartesian transformation matrix. Parameters ---------- fromsys : class The coordinate system *class* to start from. tosys : class The coordinate system *class* to transform into. matrix_func : callable A callable that accepts a coordinate object and yields the 3 x 3 matrix that converts it to the new coordinate system. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. Raises ------ TypeError If `matrix_func` is not callable """ def __init__(self, fromsys, tosys, matrix_func, priority=1, register=True): if not six.callable(matrix_func): raise TypeError('matrix_func is not callable') self.matrix_func = matrix_func self.priority = priority super(DynamicMatrixTransform, self).__init__(fromsys, tosys, register) def __call__(self, fromcoord): c = fromcoord.cartesian v = c.reshape((3, c.size // 3)) v2 = np.dot(np.asarray(self.matrix_func(fromcoord)), v) subshape = c.shape[1:] x = v2[0].reshape(subshape) y = v2[1].reshape(subshape) z = v2[2].reshape(subshape) newunit = None if fromcoord.distance is None else fromcoord.distance.unit result = self.tosys(x=x, y=y, z=z, unit=newunit) # copy over the observation time if hasattr(fromcoord, '_obstime') and hasattr(result, '_obstime'): result._obstime = fromcoord._obstime return result class CompositeTransform(CoordinateTransform): """ A `MatrixTransform` constructed by combining a sequence of matricies together. See `MatrixTransform` for syntax details. Parameters ---------- fromsys : class The coordinate system *class* to start from. tosys : class The coordinate system *class* to transform into. transforms : sequence of `CoordinateTransform`s A sequence of transformations to apply in sequence. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. """ def __init__(self, fromsys, tosys, transforms, priority=1, register=True): self.transforms = transforms super(CompositeTransform, self).__init__(fromsys, tosys, register) def __call__(self, fromcoord): coord = fromcoord for t in self.transforms: coord = t(coord) return coord #<------------function decorators for actual practical use---------------------> def transform_function(fromsys, tosys, copyobstime=True, priority=1): """ A function decorator for defining transformations between coordinate systems. .. note:: If decorating a static method of a class, ``@staticmethod`` should be added *above* this decorator. Parameters ---------- fromsys : class The coordinate system this function starts from. tosys : class The coordinate system this function results in. copyobstime : bool If True (default) the value of the `_obstime` attribute will be copied to the newly-produced coordinate. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. """ def deco(func): # this doesn't do anything directly with the trasnform because #``register=True`` stores it in the transform graph automatically FunctionTransform(fromsys, tosys, func, copyobstime=copyobstime, priority=priority, register=True) return func return deco def static_transform_matrix(fromsys, tosys, priority=1): """ A function decorator for defining transformations between coordinate systems using a matrix. The decorated function should accept *no* arguments and yield a 3 x 3 matrix. .. note:: If decorating a static method of a class, ``@staticmethod`` should be added *above* this decorator. Parameters ---------- fromsys : class The coordinate system this function starts from. tosys : class The coordinate system this function results in. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. """ def deco(matfunc): StaticMatrixTransform(fromsys, tosys, matfunc(), priority, register=True) return matfunc return deco def dynamic_transform_matrix(fromsys, tosys, priority=1): """ A function decorator for defining transformations between coordinate systems using a function that yields a matrix. The decorated function should accept a single argument, the coordinate object to be transformed, and should return a 3 x 3 matrix. .. note:: If decorating a static method of a class, ``@staticmethod`` should be added *above* this decorator. Parameters ---------- fromsys : class The coordinate system this function starts from. tosys : class The coordinate system this function results in. priority : number The priority if this transform when finding the shortest coordinate tranform path - large numbers are lower priorities. """ def deco(matfunc): DynamicMatrixTransform(fromsys, tosys, matfunc, priority, register=True) return matfunc return deco def coordinate_alias(name, coordcls=None): """ Gives a short name to this coordinate system, allowing other coordinate objects to convert to this one using attribute-style access. Parameters ---------- name : str The short alias to use for this coordinate class. Should be a valid python identifier. coordcls : class or None Either the coordinate class to register or None to use this as a decorator. Examples -------- For use with a class already defined, do:: coordinate_alias('fancycoords', MyFancyCoordinateClass) To use as a decorator, do:: @coordiante_alias('fancycoords') class MyFancyCoordinateClass(SphericalCoordinatesBase): ... """ if coordcls is None: def deco(cls): master_transform_graph.add_coord_name(name, cls) return cls return deco else: master_transform_graph.add_coord_name(name, coordcls) astropy-0.3/astropy/coordinates/matching.py0000644000175000017500000001535312243255342017365 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains functions for matching coordinate catalogs. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from ..extern import six __all__ = ['match_coordinates_3d', 'match_coordinates_sky'] def match_coordinates_3d(matchcoord, catalogcoord, nthneighbor=1, storekdtree=True): """ Finds the nearest 3-dimensional matches of a coordinate or coordinates in a set of catalog coordinates. This finds the 3-dimensional closest neighbor, which is only different from the on-sky distance if `distance` is set in either `matchcoord` or `catalogcoord`. Parameters ---------- matchcoord : `~astropy.coordinates.SphericalCoordinatesBase` The coordinate(s) to match to the catalog. catalogcoord : `~astropy.coordinates.SphericalCoordinatesBase` The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e., ``catalogcoord.isscalar == False``) nthneighbor : int, optional Which closest neighbor to search for. Typically ``1`` is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is ``2``, for matching a coordinate catalog against *itself* (``1`` is inappropriate because each point will find itself as the closest match). storekdtree : bool or str, optional If True or a string, will store the KD-Tree used for the computation in the `catalogcoord`. This dramatically speeds up subsequent calls with the same catalog. If a str, it specifies the attribute name for `catalogcoord` that should store the KD-tree. Returns ------- idx : integer array Indecies into `catalogcoord` to get the matched points for each `matchcoord`. Shape matches `matchcoord`. sep2d : `~astropy.units.quantity.Angle` The on-sky separation between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. dist3d : `~astropy.units.quantity.Quantity` The 3D distance between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. Notes ----- This function requires `scipy` to be installed or it will fail. """ from warnings import warn #without scipy this will immediately fail from scipy import spatial try: KDTree = spatial.cKDTree except: warn('C-base KD tree not found, falling back on (much slower) ' 'python implementation') KDTree = spatial.KDTree if storekdtree is True: storekdtree = '_kdtree' # figure out where any cached KDTree might be if isinstance(storekdtree, six.string_types): kdt = getattr(catalogcoord, storekdtree, None) if kdt is not None and not isinstance(kdt, KDTree): raise ValueError('Invalid `storekdtree` string:' + storekdtree) elif isinstance(storekdtree, KDTree): kdt = storekdtree storekdtree = None elif not storekdtree: kdt = None else: raise ValueError('Invalid `storekdtree` argument:' + str(storekdtree)) if kdt is None: #need to build the cartesian KD-tree for the catalog cart = catalogcoord.cartesian flatxyz = cart.reshape((3, np.prod(cart.shape) // 3)) kdt = KDTree(flatxyz.value.T) #make sure coordinate systems match matchcoord = matchcoord.transform_to(catalogcoord.__class__) #make sure units match catunit = catalogcoord.cartesian.unit cart = matchcoord.cartesian.to(catunit) flatxyz = cart.reshape((3, np.prod(cart.shape) // 3)) dist, idx = kdt.query(flatxyz.T, nthneighbor) if nthneighbor > 1: # query gives 1D arrays if k=1, 2D arrays otherwise dist = dist[:, -1] idx = idx[:, -1] if storekdtree: #cache the kdtree setattr(catalogcoord, storekdtree, kdt) sep2d = catalogcoord[idx].separation(matchcoord) return idx.reshape(cart.shape[1:]), sep2d, dist.reshape(cart.shape[1:]) * catunit def match_coordinates_sky(matchcoord, catalogcoord, nthneighbor=1, storekdtree=True): """ Finds the nearest on-sky matches of a coordinate or coordinates in a set of catalog coordinates. This finds the on-sky closest neighbor, which is only different from the 3-dimensional match if `distance` is set in either `matchcoord` or `catalogcoord`. Parameters ---------- matchcoord : `~astropy.coordinates.SphericalCoordinatesBase` The coordinate(s) to match to the catalog. catalogcoord : `~astropy.coordinates.SphericalCoordinatesBase` The base catalog in which to search for matches. Typically this will be a coordinate object that is an array (i.e., ``catalogcoord.isscalar == False``) nthneighbor : int, optional Which closest neighbor to search for. Typically ``1`` is desired here, as that is correct for matching one set of coordinates to another. The next likely use case is ``2``, for matching a coordinate catalog against *itself* (``1`` is inappropriate because each point will find itself as the closest match). storekdtree : bool or str, optional If True or a string, will store the KD-Tree used for the computation in the `catalogcoord`. This dramatically speeds up subsequent calls with the same catalog. If a str, it specifies the attribute name for `catalogcoord` that should store the KD-tree. Returns ------- idx : integer array Indecies into `catalogcoord` to get the matched points for each `matchcoord`. Shape matches `matchcoord`. sep2d : `~astropy.units.quantity.Angle` The on-sky separation between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. dist3d : `~astropy.units.quantity.Quantity` The 3D distance between the closest match for each `matchcoord` and the `matchcoord`. Shape matches `matchcoord`. Notes ----- This function requires `scipy` to be installed or it will fail. """ dcoo = matchcoord._distance cpcoo = matchcoord._cartpoint dcat = catalogcoord._distance cpcat = catalogcoord._cartpoint try: matchcoord._distance = matchcoord._cartpoint = None catalogcoord._distance = catalogcoord._cartpoint = None return match_coordinates_3d(matchcoord, catalogcoord, nthneighbor, storekdtree) finally: matchcoord._distance = dcoo matchcoord._cartpoint = cpcoo catalogcoord._distance = dcat catalogcoord._cartpoint = cpcat astropy-0.3/astropy/coordinates/name_resolve.py0000644000175000017500000001310412243255342020242 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains convenience functions for getting a coordinate object for a named object by querying SESAME and getting the first returned result. Note that this is intended to be a convenience, and is very simple. If you need precise coordinates for an object you should find the appropriate reference for that measurement and input the coordinates manually. """ from __future__ import (absolute_import, division, print_function, unicode_literals) # Standard library import os import re import socket # Astropy from ..config import ConfigurationItem from ..extern.six.moves import urllib from .. import units as u from .builtin_systems import ICRS __all__ = ["get_icrs_coordinates"] SESAME_URL = ConfigurationItem("sesame_url", ["http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame/", "http://vizier.cfa.harvard.edu/viz-bin/nph-sesame/"], "The URL to Sesame's web-queryable database.", cfgtype='string_list') SESAME_DATABASE = ConfigurationItem("sesame_database", ['all', 'simbad', 'ned', 'vizier'], "This specifies the default database that " "SESAME will query when using the name " "resolve mechanism in the coordinates " "subpackage. Default is to search all " "databases, but this can be 'all', " "'simbad', 'ned', or 'vizier'.") NAME_RESOLVE_TIMEOUT = ConfigurationItem('name_resolve_timeout', 5, "This is the maximum time to wait " "for a response from a name resolve " "query to SESAME in seconds.") class NameResolveError(Exception): pass def _parse_response(resp_data): """ Given a string response from SESAME, parse out the coordinates by looking for a line starting with a J, meaning ICRS J2000 coordinates. Parameters ---------- resp_data : str The string HTTP response from SESAME. Returns ------- ra : str The string Right Ascension parsed from the HTTP response. dec : str The string Declination parsed from the HTTP response. """ pattr = re.compile(r"%J\s*([0-9\.]+)\s*([\+\-\.0-9]+)") matched = pattr.search(resp_data.decode('utf-8')) if matched == None: return None, None else: ra,dec = matched.groups() return ra,dec def get_icrs_coordinates(name): """ Retrieve an ICRS object by using an online name resolving service to retrieve coordinates for the specified name. By default, this will search all available databases until a match is found. If you would like to specify the database, use the configuration item `name_resolve.SESAME_DATABASE` . You can also specify a list of servers to use for querying Sesame using the configuration item `name_resolve.SESAME_URL`. This will try each one in order until a valid response is returned. By default, this list includes the main Sesame host and a mirror at vizier. A final configuration item, `name_resolve.NAME_RESOLVE_TIMEOUT`, is the number of seconds to wait for a response from the server before giving up. By default this is 5 seconds. Parameters ---------- name : str The name of the object to get coordinates for, e.g. M42. Returns ------- coord : SphericalCoordinatesBase An `ICRS` instance for the object name specified. """ database = SESAME_DATABASE() # The web API just takes the first letter of the database name db = database.upper()[0] # Make sure we don't have duplicates in the url list urls = [] domains = [] for url in SESAME_URL(): domain = urllib.parse.urlparse(url).netloc # Check for duplicates if domain not in domains: domains.append(domain) # Add the query to the end of the url, add to url list fmt_url = os.path.join(url, "{db}?{name}") fmt_url = fmt_url.format(name=urllib.parse.quote(name), db=db) urls.append(fmt_url) for url in urls: try: # Retrieve ascii name resolve data from CDS resp = urllib.request.urlopen(url, timeout=NAME_RESOLVE_TIMEOUT()) break except urllib.error.URLError as e: # This catches a timeout error, see: # http://stackoverflow.com/questions/2712524/handling-urllib2s-timeout-python if isinstance(e.reason, socket.timeout): # If it was a timeout, try with the next URL continue else: raise NameResolveError("Unable to retrieve coordinates for name " "'{0}'".format(name)) # All Sesame URL's timed out... else: raise NameResolveError("All Sesame queries timed out. Unable to " "retrieve coordinates.") resp_data = resp.read() ra,dec = _parse_response(resp_data) if ra == None and dec == None: if db == "A": err = "Unable to find coordinates for name '{0}'".format(name) else: err = "Unable to find coordinates for name '{0}' in database {1}"\ .format(name, database) raise NameResolveError(err) return ICRS(ra, dec, unit=(u.degree, u.degree)) astropy-0.3/astropy/nddata/0000755000175000017500000000000012243263747014143 5ustar oleoleastropy-0.3/astropy/nddata/tests/0000755000175000017500000000000012243263747015305 5ustar oleoleastropy-0.3/astropy/nddata/tests/test_flag_collection.py0000644000175000017500000000266412243255342022042 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from ...tests.helper import pytest from .. import FlagCollection def test_init(): FlagCollection(shape=(1, 2, 3)) def test_init_noshape(): with pytest.raises(Exception) as exc: FlagCollection() assert exc.value.args[0] == 'FlagCollection should be initialized with the shape of the data' def test_init_notiterable(): with pytest.raises(Exception) as exc: FlagCollection(shape=1.) assert exc.value.args[0] == 'FlagCollection shape should be an iterable object' def test_setitem(): f = FlagCollection(shape=(1, 2, 3)) f['a'] = np.ones((1, 2, 3)).astype(float) f['b'] = np.ones((1, 2, 3)).astype(int) f['c'] = np.ones((1, 2, 3)).astype(bool) f['d'] = np.ones((1, 2, 3)).astype(str) @pytest.mark.parametrize(('value'), [1, 1., 'spam', [1, 2, 3], (1., 2., 3.)]) def test_setitem_invalid_type(value): f = FlagCollection(shape=(1, 2, 3)) with pytest.raises(Exception) as exc: f['a'] = value assert exc.value.args[0] == 'flags should be given as a Numpy array' def test_setitem_invalid_shape(): f = FlagCollection(shape=(1, 2, 3)) with pytest.raises(Exception) as exc: f['a'] = np.ones((3, 2, 1)) assert exc.value.args[0] == 'flags array shape (3, 2, 1) does not match data shape (1, 2, 3)' astropy-0.3/astropy/nddata/tests/__init__.py0000644000175000017500000000000012243255342017374 0ustar oleoleastropy-0.3/astropy/nddata/tests/test_nddata.py0000644000175000017500000002325012243255342020143 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import textwrap import numpy as np from numpy.testing import assert_array_equal from ..nddata import NDData from ..nduncertainty import StdDevUncertainty, IncompatibleUncertaintiesException, NDUncertainty from ...tests.helper import pytest, raises from ...utils import NumpyRNGContext class FakeUncertainty(NDUncertainty): def propagate_add(self, data, final_data): pass def propagate_subtract(self, data, final_data): pass def propagate_multiply(self, data, final_data): pass def propagate_divide(self, data, final_data): pass def test_nddata_empty(): with pytest.raises(TypeError): NDData() # empty initializer should fail def test_nddata_simple(): with NumpyRNGContext(123): nd = NDData(np.random.random((10, 10))) assert nd.shape == (10, 10) assert nd.size == 100 assert nd.dtype == np.dtype(float) def test_nddata_str(): arr1d = NDData([1, 2, 3]) assert str(arr1d) == '[1 2 3]' arr2d = NDData([[1, 2], [3, 4]]) assert str(arr2d) == textwrap.dedent(""" [[1 2] [3 4]]"""[1:]) arr3d = NDData([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) assert str(arr3d) == textwrap.dedent(""" [[[1 2] [3 4]] [[5 6] [7 8]]]"""[1:]) def test_nddata_repr(): arr1d = NDData([1, 2, 3]) assert repr(arr1d) == 'NDData([1, 2, 3])' arr2d = NDData([[1, 2], [3, 4]]) assert repr(arr2d) == textwrap.dedent(""" NDData([[1, 2], [3, 4]])"""[1:]) arr3d = NDData([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) assert repr(arr3d) == textwrap.dedent(""" NDData([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])"""[1:]) def test_nddata_mask_valid(): with NumpyRNGContext(456): NDData(np.random.random((10, 10)), mask=np.random.random((10, 10)) > 0.5) @pytest.mark.parametrize(('shape'), [(10,), (5, 5), (3, 10, 10)]) def test_nddata_mask_invalid_shape(shape): with pytest.raises(ValueError) as exc: with NumpyRNGContext(789): NDData(np.random.random((10, 10)), mask=np.random.random(shape) > 0.5) assert exc.value.args[0] == 'dimensions of mask do not match data' def test_nddata_uncertainty_init(): u = StdDevUncertainty(array=np.ones((5, 5))) d = NDData(np.ones((5, 5)), uncertainty=u) def test_nddata_uncertainty_init_invalid_shape_1(): u = StdDevUncertainty(array=np.ones((6, 6))) with pytest.raises(ValueError) as exc: NDData(np.ones((5, 5)), uncertainty=u) assert exc.value.args[0] == 'parent shape does not match array data shape' def test_nddata_uncertainty_init_invalid_shape_2(): u = StdDevUncertainty() NDData(np.ones((5, 5)), uncertainty=u) with pytest.raises(ValueError) as exc: u.array = np.ones((6, 6)) assert exc.value.args[0] == 'array shape does not match parent data shape' @pytest.mark.parametrize(('uncertainty'), [1., 'spam', np.ones((5, 5))]) def test_nddata_uncertainty_invalid_type(uncertainty): with pytest.raises(TypeError) as exc: NDData(np.ones((5, 5)), uncertainty=uncertainty) assert exc.value.args[0] == 'Uncertainty must be an instance of a NDUncertainty object' def test_nddata_copy_ref(): """ Tests to ensure that creating a new NDData object copies by *reference*. """ a = np.ones((10, 10)) nd_ref = NDData(a) a[0, 0] = 0 assert nd_ref.data[0, 0] == 0 def test_nddata_conversion(): nd = NDData([[1, 2, 3], [4, 5, 6]]) assert nd.size == 6 assert nd.dtype == np.dtype(int) def test_nddata_add(): d1 = NDData(np.ones((5, 5))) d2 = NDData(np.ones((5, 5))) d3 = d1.add(d2) assert np.all(d3.data == 2.) def test_nddata_add_mismatch_wcs(): d1 = NDData(np.ones((5, 5)), wcs=1.) d2 = NDData(np.ones((5, 5)), wcs=2.) with pytest.raises(ValueError) as exc: d1.add(d2) assert exc.value.args[0] == "WCS properties do not match" def test_nddata_add_mismatch_units(): d1 = NDData(np.ones((5, 5)), unit='Jy') d2 = NDData(np.ones((5, 5)), unit='erg/s') with pytest.raises(ValueError) as exc: d1.add(d2) assert exc.value.args[0] == "operand units do not match" def test_nddata_add_mismatch_shape(): d1 = NDData(np.ones((5, 5))) d2 = NDData(np.ones((6, 6))) with pytest.raises(ValueError) as exc: d1.add(d2) assert exc.value.args[0] == "operand shapes do not match" def test_nddata_add_uncertainties(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = StdDevUncertainty(array=np.ones((5, 5))) d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)), uncertainty=u2) d3 = d1.add(d2) assert np.all(d3.data == 2.) assert_array_equal(d3.uncertainty.array, np.sqrt(10.)) def test_nddata_add_uncertainties_mismatch(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = FakeUncertainty() d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)), uncertainty=u2) with pytest.raises(IncompatibleUncertaintiesException) as exc: d3 = d1.add(d2) assert exc.value.args[0] == 'Cannot propagate uncertainties of type StdDevUncertainty with uncertainties of type FakeUncertainty for addition' def test_nddata_subtract(): d1 = NDData(np.ones((5, 5))) d2 = NDData(np.ones((5, 5)) * 2.) d3 = d1.subtract(d2) assert np.all(d3.data == -1.) def test_nddata_subtract_mismatch_wcs(): d1 = NDData(np.ones((5, 5)), wcs=1.) d2 = NDData(np.ones((5, 5)) * 2., wcs=2.) with pytest.raises(ValueError) as exc: d1.subtract(d2) assert exc.value.args[0] == "WCS properties do not match" def test_nddata_subtract_mismatch_units(): d1 = NDData(np.ones((5, 5)), unit='Jy') d2 = NDData(np.ones((5, 5)) * 2., unit='erg/s') with pytest.raises(ValueError) as exc: d1.subtract(d2) assert exc.value.args[0] == "operand units do not match" def test_nddata_subtract_mismatch_shape(): d1 = NDData(np.ones((5, 5))) d2 = NDData(np.ones((6, 6)) * 2.) with pytest.raises(ValueError) as exc: d1.subtract(d2) assert exc.value.args[0] == "operand shapes do not match" def test_nddata_subtract_uncertainties(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = StdDevUncertainty(array=np.ones((5, 5))) d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)) * 2., uncertainty=u2) d3 = d1.subtract(d2) assert np.all(d3.data == -1.) assert_array_equal(d3.uncertainty.array, np.sqrt(10.)) def test_nddata_multiply_uncertainties(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = StdDevUncertainty(array=np.ones((5, 5))) d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)) * 2., uncertainty=u2) d3 = d1.multiply(d2) assert np.all(d3.data == 2.) assert_array_equal(d3.uncertainty.array, 2 * np.sqrt(9.25)) def test_nddata_divide_uncertainties(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = StdDevUncertainty(array=np.ones((5, 5))) d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)) * 2., uncertainty=u2) d3 = d1.divide(d2) assert np.all(d3.data == 0.5) assert_array_equal(d3.uncertainty.array, 0.5 * np.sqrt(9.25)) def test_nddata_subtract_uncertainties_mismatch(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) u2 = FakeUncertainty() d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = NDData(np.ones((5, 5)) * 2., uncertainty=u2) with pytest.raises(IncompatibleUncertaintiesException) as exc: d3 = d1.subtract(d2) assert exc.value.args[0] == 'Cannot propagate uncertainties of type StdDevUncertainty with uncertainties of type FakeUncertainty for subtraction' def test_convert_unit_to(): d = NDData(np.ones((5, 5))) d.unit = 'km' d1 = d.convert_unit_to('m') assert np.all(d1 == np.array(1000.0)) @raises(ValueError) def test_invalid_unit(): d = NDData(np.ones((5, 5)), unit="NotAValidUnit") def test_simple_slicing(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) d1 = NDData(np.ones((5, 5)), uncertainty=u1) assert d1.shape == (5, 5) d2 = d1[2:3, 2:3] assert d2.shape == (1, 1) def test_slicing_reference(): u1 = StdDevUncertainty(array=np.ones((5, 5)) * 3) d1 = NDData(np.ones((5, 5)), uncertainty=u1) d2 = d1[2:3, 2:3] # asserting that the new nddata contains references to the original nddata assert d2.data.base is d1.data assert d2.uncertainty.array.base is d1.uncertainty.array def test_initializing_from_nddata(): d1 = NDData(np.ones((5, 5))) d2 = NDData(d1) assert d1.data is d2.data def test_initializing_from_nduncertainty(): u1 = StdDevUncertainty(np.ones((5, 5)) * 3) u2 = StdDevUncertainty(u1, copy=False) assert u1.array is u2.array def test_masked_array_input(): with NumpyRNGContext(12345): a = np.random.randn(100) marr = np.ma.masked_where(a > 0, a) nd = NDData(marr) # check that masks and data match assert_array_equal(nd.mask, marr.mask) assert_array_equal(nd.data, marr.data) # check that they are both by reference marr.mask[10] = ~marr.mask[10] marr.data[11] = 123456789 assert_array_equal(nd.mask, marr.mask) assert_array_equal(nd.data, marr.data) # Check that the meta descriptor is working as expected. The MetaBaseTest class # takes care of defining all the tests, and we simply have to define the class # and any minimal set of args to pass. from ...utils.tests.test_metadata import MetaBaseTest class TestMetaNDData(MetaBaseTest): test_class = NDData args = np.array([[1.]]) astropy-0.3/astropy/nddata/nduncertainty.py0000644000175000017500000002617312243255342017405 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import abc import numpy as np __all__ = ['MissingDataAssociationException', 'IncompatibleUncertaintiesException', 'NDUncertainty', 'StdDevUncertainty'] class IncompatibleUncertaintiesException(Exception): """ This exception should be used to indicate cases in which uncertainties with two different classes can not be propagated. """ pass class MissingDataAssociationException(Exception): """ This exception should be used to indicate that an uncertainty instance has not been associated with a parent `~astropy.nddata.nddata.NDData` object. """ pass class NDUncertainty(object): ''' This is the base class for uncertainty classes used with NDData. It is implemented as an abstract class and should never be directly instantiated. Classes inheriting from NDData should overload the ``propagate_*`` methods, keeping the call signature the same. The propagate methods can assume that a `parent_nddata` attribute is present which links to the parent_nddata dataset, and take an `~astropy.nddata.NDData` instance as the positional argument, *not* an `~astropy.nddata.NDUncertainty` instance, because the `~astropy.nddata.NDData` instance can be used to access both the data and the uncertainties (some propagations require the data values). ''' __metaclass__ = abc.ABCMeta # Indicates whether the class supports the propagation of correlated # uncertainties supports_correlated = False @property def parent_nddata(self): if self._parent_nddata is None: raise MissingDataAssociationException("uncertainty is not associated with an NDData object") else: return self._parent_nddata @parent_nddata.setter def parent_nddata(self, value): self._parent_nddata = value @abc.abstractmethod def propagate_add(self, other_nddata, result_data): ''' Propagate uncertainties for addition. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to add the uncertainties ''' pass @abc.abstractmethod def propagate_subtract(self, other_nddata, result_data): ''' Propagate uncertainties for subtraction. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to add the uncertainties ''' pass @abc.abstractmethod def propagate_multiply(self, other_nddata, result_data): ''' Propagate uncertainties for multiplication. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty ''' pass @abc.abstractmethod def propagate_divide(self, other_nddata, result_data): ''' Propagate uncertainties for division. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty ''' pass class StdDevUncertainty(NDUncertainty): ''' A class for standard deviation uncertaintys ''' support_correlated = False def __init__(self, array=None, copy=True): if array is None: self.array = None elif isinstance(array, StdDevUncertainty): self.array = np.array(array.array, copy=copy, subok=True) else: self.array = np.array(array, copy=copy, subok=True) @property def parent_nddata(self): try: if self._parent_nddata is None: raise MissingDataAssociationException("Uncertainty is not associated with an NDData object") else: return self._parent_nddata except AttributeError: raise MissingDataAssociationException("Uncertainty is not associated with an NDData object") @parent_nddata.setter def parent_nddata(self, value): if self.array is None or value is None: self._parent_nddata = value else: if value.shape != self.array.shape: raise ValueError("parent shape does not match array data shape") self._parent_nddata = value @property def array(self): return self._array @array.setter def array(self, value): if value is not None: try: if value.shape != self.parent_nddata.shape: raise ValueError("array shape does not match parent data shape") except MissingDataAssociationException: pass self._array = value def propagate_add(self, other_nddata, result_data): ''' Propagate uncertainties for addition. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to propagate the uncertainties ''' if not isinstance(other_nddata.uncertainty, StdDevUncertainty): raise IncompatibleUncertaintiesException if self.array is None: raise ValueError("standard deviation values are not set") if other_nddata.uncertainty.array is None: raise ValueError("standard deviation values are not set in other_nddata") result_uncertainty = StdDevUncertainty() result_uncertainty.array = np.sqrt(self.array ** 2 + other_nddata.uncertainty.array ** 2) return result_uncertainty def __getitem__(self, item): ''' Slice the standard deviation array using standard numpy slicing ''' new_array = self.array[item] return self.__class__(new_array, copy=False) def propagate_subtract(self, other_nddata, result_data): ''' Propagate uncertainties for subtraction. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to propagate the uncertainties ''' if not isinstance(other_nddata.uncertainty, StdDevUncertainty): raise IncompatibleUncertaintiesException if self.array is None: raise ValueError("standard deviation values are not set") if other_nddata.uncertainty.array is None: raise ValueError("standard deviation values are not set in other_nddata") result_uncertainty = StdDevUncertainty() result_uncertainty.array = np.sqrt(self.array ** 2 + other_nddata.uncertainty.array ** 2) return result_uncertainty def propagate_multiply(self, other_nddata, result_data): ''' Propagate uncertainties for mutliplication. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to propagate the uncertainties ''' if not isinstance(other_nddata.uncertainty, StdDevUncertainty): raise IncompatibleUncertaintiesException if self.array is None: raise ValueError("standard deviation values are not set") if other_nddata.uncertainty.array is None: raise ValueError("standard deviation values are not set in other_nddata") result_uncertainty = StdDevUncertainty() result_uncertainty.array = (np.sqrt((self.array / self.parent_nddata.data) ** 2 + (other_nddata.uncertainty.array / other_nddata.data) ** 2) * result_data) return result_uncertainty def propagate_divide(self, other_nddata, result_data): ''' Propagate uncertainties for division. Parameters ---------- other_nddata : NDData instance The data for the second other_nddata in a + b result_data : `~numpy.ndarray` instance The data array that is the result of the addition Returns ------- result_uncertainty : NDUncertainty instance The resulting uncertainty Raises ------ IncompatibleUncertaintiesException Raised if the method does not know how to propagate the uncertainties ''' if not isinstance(other_nddata.uncertainty, StdDevUncertainty): raise IncompatibleUncertaintiesException if self.array is None: raise ValueError("standard deviation values are not set") if other_nddata.uncertainty.array is None: raise ValueError("standard deviation values are not set in other_nddata") result_uncertainty = StdDevUncertainty() result_uncertainty.array = (np.sqrt((self.array / self.parent_nddata.data) ** 2 + (other_nddata.uncertainty.array / other_nddata.data) ** 2) * result_data) return result_uncertainty astropy-0.3/astropy/nddata/nddata.py0000644000175000017500000004076612243255342015755 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the base NDData class. from __future__ import absolute_import, division, print_function, unicode_literals import collections from copy import deepcopy import numpy as np from ..units import Unit from .. import log from .flag_collection import FlagCollection from .nduncertainty import IncompatibleUncertaintiesException, NDUncertainty from ..utils.compat.odict import OrderedDict from ..io import registry as io_registry from ..config import ConfigurationItem from ..utils.metadata import MetaData __all__ = ['NDData'] __doctest_skip__ = ['NDData'] WARN_UNSUPPORTED_CORRELATED = ConfigurationItem( 'warn_unsupported_correlated', True, 'Whether to issue a warning if NDData arithmetic is performed with ' 'uncertainties and the uncertainties do not support the propagation ' 'of correlated uncertainties.' ) class NDData(object): """A Superclass for array-based data in Astropy. The key distinction from raw numpy arrays is the presence of additional metadata such as uncertainties, a mask, units, flags, and/or a coordinate system. Parameters ----------- data : `~numpy.ndarray` or `~astropy.nddata.NDData` The actual data contained in this `NDData` object. Not that this will always be copies by *reference* , so you should make copy the `data` before passing it in if that's the desired behavior. uncertainty : `~astropy.nddata.NDUncertainty`, optional Uncertainties on the data. mask : `~numpy.ndarray`, optional Mask for the data, given as a boolean Numpy array with a shape matching that of the data. The values must be ``False`` where the data is *valid* and ``True`` when it is not (like Numpy masked arrays). If `data` is a numpy masked array, providing `mask` here will causes the mask from the masked array to be ignored. flags : `~numpy.ndarray` or `~astropy.nddata.FlagCollection`, optional Flags giving information about each pixel. These can be specified either as a Numpy array of any type with a shape matching that of the data, or as a `~astropy.nddata.FlagCollection` instance which has a shape matching that of the data. wcs : undefined, optional WCS-object containing the world coordinate system for the data. .. warning:: This is not yet defind because the discussion of how best to represent this class's WCS system generically is still under consideration. For now just leave it as None meta : `dict`-like object, optional Metadata for this object. "Metadata" here means all information that is included with this object but not part of any other attribute of this particular object. e.g., creation date, unique identifier, simulation parameters, exposure time, telescope name, etc. unit : `astropy.units.UnitBase` instance or str, optional The units of the data. Raises ------ ValueError If the `uncertainty` or `mask` inputs cannot be broadcast (e.g., match shape) onto `data`. Notes ----- `NDData` objects can be easily converted to a regular Numpy array using `numpy.asarray` For example:: >>> from astropy.nddata import NDData >>> import numpy as np >>> x = NDData([1,2,3]) >>> np.asarray(x) array([1, 2, 3]) If the `NDData` object has a `mask`, `numpy.asarray` will return a Numpy masked array. This is useful, for example, when plotting a 2D image using matplotlib:: >>> from astropy.nddata import NDData >>> from matplotlib import pyplot as plt >>> x = NDData([[1,2,3], [4,5,6]]) >>> plt.imshow(x) """ meta = MetaData() def __init__(self, data, uncertainty=None, mask=None, flags=None, wcs=None, meta=None, unit=None): if isinstance(data, self.__class__): self.data = np.array(data.data, subok=True, copy=False) if uncertainty is not None: self.uncertainty = uncertainty log.info("Overwriting NDData's current uncertainty being" " overwritten with specified uncertainty") if mask is not None: self.mask = mask log.info("Overwriting NDData's current mask with specified mask") if flags is not None: self.flags = flags log.info("Overwriting NDData's current flags with specified flag") if wcs is not None: self.wcs = wcs log.info("Overwriting NDData's current wcs with specified wcs") if meta is not None: self.meta = meta log.info("Overwriting NDData's current meta with specified meta") if unit is not None: raise ValueError('To convert to different unit please use .to') else: if hasattr(data, 'mask'): self.data = np.array(data.data, subok=True, copy=False) if mask is not None: self.mask = mask log.info("NDData was created with a masked array, and a " "mask was explictly provided to NDData. The explicitly " "passed-in mask will be used and the masked array's " "mask will be ignored.") else: self.mask = data.mask else: self.data = np.array(data, subok=True, copy=False) self.mask = mask self.uncertainty = uncertainty self.flags = flags self.wcs = wcs self.meta = meta self.unit = unit def __str__(self): return str(self.data) def __repr__(self): prefix = self.__class__.__name__ + '(' body = np.array2string(self.data, separator=', ', prefix=prefix) return ''.join([prefix, body, ')']) @property def mask(self): return self._mask @mask.setter def mask(self, value): if value is not None: if isinstance(value, np.ndarray): if value.dtype != np.bool_: raise TypeError("mask must be a boolean Numpy array") else: if value.shape != self.shape: raise ValueError("dimensions of mask do not match data") else: self._mask = value else: raise TypeError("mask must be a Numpy array") else: self._mask = value @property def flags(self): return self._flags @flags.setter def flags(self, value): if value is not None: if isinstance(value, np.ndarray): if value.shape != self.shape: raise ValueError("dimensions of flags do not match data") else: self._flags = value elif isinstance(value, FlagCollection): if value.shape != self.shape: raise ValueError("dimensions of FlagCollection does not match data") else: self._flags = value else: raise TypeError("flags should be a Numpy array or a FlagCollection instance") else: self._flags = value @property def uncertainty(self): return self._uncertainty @uncertainty.setter def uncertainty(self, value): if value is not None: if isinstance(value, NDUncertainty): self._uncertainty = value self._uncertainty.parent_nddata = self else: raise TypeError("Uncertainty must be an instance of a NDUncertainty object") else: self._uncertainty = value @property def unit(self): return self._unit @unit.setter def unit(self, value): if value is None: self._unit = None else: self._unit = Unit(value) @property def shape(self): """ shape tuple of this object's data. """ return self.data.shape @property def size(self): """ integer size of this object's data. """ return self.data.size @property def dtype(self): """ `numpy.dtype` of this object's data. """ return self.data.dtype @property def ndim(self): """ integer dimensions of this object's data """ return self.data.ndim def __array__(self): """ This allows code that requests a Numpy array to use an NDData object as a Numpy array. """ if self.mask is not None: return np.ma.masked_array(self.data, self.mask) else: return self.data def __getitem__(self, item): new_data = self.data[item] if self.uncertainty is not None: new_uncertainty = self.uncertainty[item] else: new_uncertainty = None if self.mask is not None: new_mask = self.mask[item] else: new_mask = None if self.flags is not None: if isinstance(self.flags, np.ndarray): new_flags = self.flags[item] elif isinstance(self.flags, FlagCollection): raise NotImplementedError('Slicing complex Flags is currently not implemented') else: new_flags = None if self.wcs is not None: raise NotImplementedError('Slicing for WCS is not currently implemented') else: new_wcs = None return self.__class__(new_data, uncertainty=new_uncertainty, mask=new_mask, flags=new_flags, wcs=new_wcs, meta=self.meta, unit=self.unit) def _arithmetic(self, operand, propagate_uncertainties, name, operation): """ {name} another dataset (`operand`) to this dataset. Parameters ---------- operand : `~astropy.nddata.NDData` The second operand in the operation a {operator} b propagate_uncertainties : bool Whether to propagate uncertainties following the propagation rules defined by the class used for the `uncertainty` attribute. Returns ------- result : `~astropy.nddata.NDData` The resulting dataset Notes ----- This method requires the datasets to have identical WCS properties, equivalent units, and identical shapes. Flags and meta-data get set to None in the resulting dataset. The unit in the result is the same as the unit in `self`. Uncertainties are propagated, although correlated errors are not supported by any of the built-in uncertainty classes. If uncertainties are assumed to be correlated, a warning is issued by default (though this can be disabled via the `WARN_UNSUPPORTED_CORRELATED` configuration item). Values masked in either dataset before the operation are masked in the resulting dataset. """ if self.wcs != operand.wcs: raise ValueError("WCS properties do not match") if not (self.unit is None and operand.unit is None): if (self.unit is None or operand.unit is None or not self.unit.is_equivalent(operand.unit)): raise ValueError("operand units do not match") if self.shape != operand.shape: raise ValueError("operand shapes do not match") if self.unit is not None: operand_data = operand.unit.to(self.unit, operand.data) else: operand_data = operand.data data = operation(self.data, operand_data) result = self.__class__(data) # in case we are dealing with an inherited type if propagate_uncertainties is None: result.uncertainty = None elif self.uncertainty is None and operand.uncertainty is None: result.uncertainty = None elif self.uncertainty is None: result.uncertainty = operand.uncertainty elif operand.uncertainty is None: result.uncertainty = self.uncertainty else: # both self and operand have uncertainties if (WARN_UNSUPPORTED_CORRELATED() and (not self.uncertainty.support_correlated or not operand.uncertainty.support_correlated)): log.info("The uncertainty classes used do not support the " "propagation of correlated errors, so uncertainties" " will be propagated assuming they are uncorrelated") try: method = getattr(self.uncertainty, propagate_uncertainties) result.uncertainty = method(operand, result.data) except IncompatibleUncertaintiesException: raise IncompatibleUncertaintiesException( "Cannot propagate uncertainties of type {0:s} with uncertainties of " "type {1:s} for {2:s}".format( self.uncertainty.__class__.__name__, operand.uncertainty.__class__.__name__, name)) if self.mask is None and operand.mask is None: result.mask = None elif self.mask is None: result.mask = operand.mask elif operand.mask is None: result.mask = self.mask else: # combine masks as for Numpy masked arrays result.mask = self.mask & operand.mask result.flags = None result.wcs = self.wcs result.meta = None result.unit = self.unit return result def add(self, operand, propagate_uncertainties=True): if propagate_uncertainties: propagate_uncertainties = "propagate_add" else: propagate_uncertainties = None return self._arithmetic( operand, propagate_uncertainties, "addition", np.add) add.__doc__ = _arithmetic.__doc__.format(name="Add", operator="+") def subtract(self, operand, propagate_uncertainties=True): if propagate_uncertainties: propagate_uncertainties = "propagate_subtract" else: propagate_uncertainties = None return self._arithmetic( operand, propagate_uncertainties, "subtraction", np.subtract) subtract.__doc__ = _arithmetic.__doc__.format(name="Subtract", operator="-") def multiply(self, operand, propagate_uncertainties=True): if propagate_uncertainties: propagate_uncertainties = "propagate_multiply" else: propagate_uncertainties = None return self._arithmetic( operand, propagate_uncertainties, "multiplication", np.multiply) multiply.__doc__ = _arithmetic.__doc__.format(name="Multiply", operator="*") def divide(self, operand, propagate_uncertainties=True): if propagate_uncertainties: propagate_uncertainties = "propagate_divide" else: propagate_uncertainties = None return self._arithmetic( operand, propagate_uncertainties, "division", np.divide) divide.__doc__ = _arithmetic.__doc__.format(name="Divide", operator="/") def convert_unit_to(self, unit, equivalencies=[]): """ Returns a new `NDData` object whose values have been converted to a new unit. Parameters ---------- unit : `astropy.units.UnitBase` instance or str The unit to convert to. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the units are not directly convertible. See :ref:`unit_equivalencies`. Returns ------- result : `~astropy.nddata.NDData` The resulting dataset Raises ------ UnitsError If units are inconsistent. """ if self.unit is None: raise ValueError("No unit specified on source data") data = self.unit.to(unit, self.data, equivalencies=equivalencies) result = self.__class__(data) # in case we are dealing with an inherited type result.uncertainty = self.uncertainty result.mask = self.mask result.flags = None result.wcs = self.wcs result.meta = self.meta result.unit = unit return result read = classmethod(io_registry.read) write = io_registry.write astropy-0.3/astropy/nddata/__init__.py0000644000175000017500000000073712243255342016253 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The `nddata` subpackage provides the `~astropy.nddata.nddata.NDData` class and related tools to manage n-dimensional array-based data (e.g. CCD images, IFU Data, grid-based simulation data, ...). This is more than just `numpy.ndarray` objects, because it provides metadata that cannot be easily provided by a single array. """ from .nddata import * from .nduncertainty import * from .flag_collection import * astropy-0.3/astropy/nddata/setup_package.py0000644000175000017500000000004612243255342017320 0ustar oleoledef requires_2to3(): return False astropy-0.3/astropy/nddata/flag_collection.py0000644000175000017500000000314512243255342017634 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np from ..utils.compat.odict import OrderedDict from ..utils.misc import isiterable __all__ = ['FlagCollection'] class FlagCollection(OrderedDict): """ The purpose of this class is to provide a dictionary for containing arrays of flags for the `NDData` class. Flags should be stored in Numpy arrays that have the same dimensions as the parent data, so the `FlagCollection` class adds shape checking to an ordered dictionary class. The `FlagCollection` should be initialized like an `OrderedDict`, but with the addition of a ``shape=`` keyword argument used to pass the NDData shape. """ def __init__(self, *args, **kwargs): if 'shape' in kwargs: self.shape = kwargs.pop('shape') if not isiterable(self.shape): raise ValueError("FlagCollection shape should be an iterable object") else: raise Exception("FlagCollection should be initialized with the shape of the data") OrderedDict.__init__(self, *args, **kwargs) def __setitem__(self, item, value, **kwargs): if isinstance(value, np.ndarray): if value.shape == self.shape: OrderedDict.__setitem__(self, item, value, **kwargs) else: raise ValueError("flags array shape {0:s} does not match data shape {1:s}".format(value.shape, self.shape)) else: raise TypeError("flags should be given as a Numpy array") astropy-0.3/astropy/constants/0000755000175000017500000000000012243263747014724 5ustar oleoleastropy-0.3/astropy/constants/tests/0000755000175000017500000000000012243263747016066 5ustar oleoleastropy-0.3/astropy/constants/tests/__init__.py0000644000175000017500000000015512243255342020170 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) astropy-0.3/astropy/constants/tests/test_constant.py0000644000175000017500000000600312243255342021317 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from ...extern import six from .. import Constant from ...units import Quantity as Q from ...tests.helper import pytest def test_c(): from .. import c # c is an exactly defined constant, so it shouldn't be changing assert c.value == 2.99792458e8 # default is S.I. assert c.si.value == 2.99792458e8 assert c.cgs.value == 2.99792458e10 # make sure it has the necessary attributes and they're not blank assert c.uncertainty == 0 # c is a *defined* quantity assert c.name assert c.reference assert c.unit def test_h(): from .. import h # check that the value is fairly close to what it should be (not exactly # checking because this might get updated in the future) assert abs(h.value - 6.626e-34) < 1e-38 assert abs(h.si.value - 6.626e-34) < 1e-38 assert abs(h.cgs.value - 6.626e-27) < 1e-31 # make sure it has the necessary attributes and they're not blank assert h.uncertainty assert h.name assert h.reference assert h.unit def test_e(): """Tests for #572 demonstrating how EM constants should behave.""" from .. import e # A test quantity E = Q(100, 'V/m') # Without specifying a system e should not combine with other quantities pytest.raises(TypeError, lambda: e * E) # Try it again (as regression test on a minor issue mentioned in #745 where # repeated attempts to use e in an expression resulted in UnboundLocalError # instead of TypeError) pytest.raises(TypeError, lambda: e * E) # e.cgs is too ambiguous and should not work at all pytest.raises(TypeError, lambda: e.cgs * E) assert isinstance(e.si, Q) assert isinstance(e.gauss, Q) assert isinstance(e.esu, Q) assert e.si * E == Q(100, 'eV/m') assert e.gauss * E == Q(e.gauss.value * E.value, 'Fr V/m') assert e.esu * E == Q(e.esu.value * E.value, 'Fr V/m') def test_g0(): """Tests for #1263 demonstrating how g0 constant should behave.""" from .. import g0 # g0 is an exactly defined constant, so it shouldn't be changing assert g0.value == 9.80665 # default is S.I. assert g0.si.value == 9.80665 assert g0.cgs.value == 9.80665e2 # make sure it has the necessary attributes and they're not blank assert g0.uncertainty == 0 # g0 is a *defined* quantity assert g0.name assert g0.reference assert g0.unit # Check that its unit have the correct physical type assert g0.unit.physical_type == 'acceleration' def test_unit(): from ... import units as u from ... import constants as const for key, val in six.iteritems(vars(const)): if isinstance(val, Constant): # Getting the unit forces the unit parser to run. Confirm # that none of the constants defined in astropy have # invalid unit. assert not isinstance(val.unit, u.UnrecognizedUnit) astropy-0.3/astropy/constants/__init__.py0000644000175000017500000000312512243255342017026 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains astronomical and physical constants for use in Astropy or other places. A typical use case might be:: >>> from astropy.constants import c, m_e >>> # ... define the mass of something you want the rest energy of as m ... >>> m = m_e >>> E = m * c**2 >>> E.to('MeV') """ from __future__ import (absolute_import, division, print_function, unicode_literals) import itertools # Hack to make circular imports with units work try: from .. import units del units except ImportError: pass from .constant import Constant, EMConstant from . import si from . import cgs # for updating the constants module docstring _lines = [ 'The following constants are available:\n', '========== ============== ================ =========================', ' Name Value Unit Description', '========== ============== ================ =========================', ] for _nm, _c in itertools.chain(sorted(vars(si).items()), sorted(vars(cgs).items())): if isinstance(_c, Constant) and _c.abbrev not in locals(): locals()[_c.abbrev] = _c.__class__(_c.abbrev, _c.name, _c.value, _c._unit, _c.uncertainty, _c.reference) _lines.append('{0:^10} {1:^14.9g} {2:^16} {3}'.format( _c.abbrev, _c.value, _c._unit, _c.name)) _lines.append(_lines[1]) __doc__ += '\n'.join(_lines) del _lines, _nm, _c astropy-0.3/astropy/constants/si.py0000644000175000017500000001231712243255342015705 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in SI units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from .constant import Constant, EMConstant # PHYSICAL CONSTANTS # Planck constant h = Constant('h', "Planck constant", 6.62606957e-34, 'J s', 0.00000029e-34, 'CODATA 2010', system='si') # Reduced Planck constant hbar = Constant('hbar', "Reduced Planck constant", h.value * 0.5 / np.pi, 'J s', h.uncertainty * 0.5 / np.pi, h.reference, system='si') # Boltzmann constant k_B = Constant('k_B', "Boltzmann constant", 1.3806488e-23, 'J / (K)', 0.0000013e-23, 'CODATA 2010', system='si') # Speed of light c = Constant('c', "Speed of light in vacuum", 2.99792458e8, 'm / (s)', 0., 'CODATA 2010', system='si') # Gravitional constant G = Constant('G', "Gravitational constant", 6.67384e-11, 'm3 / (kg s2)', 0.00080e-11, 'CODATA 2010', system='si') # Standard acceleration of gravity g0 = Constant('g0', "Standard acceleration of gravity", 9.80665, 'm / s2', 0.0, 'CODATA 2010', system='si') # Proton mass m_p = Constant('m_p', "Proton mass", 1.672621777e-27, 'kg', 0.000000074e-27, 'CODATA 2010', system='si') # Neutron mass m_n = Constant('m_n', "Neutron mass", 1.674927351e-27, 'kg', 0.000000074e-27, 'CODATA 2010', system='si') # Electron mass m_e = Constant('m_e', "Electron mass", 9.10938291e-31, 'kg', 0.00000040e-31, 'CODATA 2010', system='si') # Atomic mass u = Constant('u', "Atomic mass", 1.660538921e-27, 'kg', 0.000000073e-27, 'CODATA 2010', system='si') # Stefan-Boltzmann constant sigma_sb = Constant('sigma_sb', "Stefan-Boltzmann constant", 5.670373e-8, 'W / (K4 m2)', 0.000021e-8, 'CODATA 2010', system='si') # Electron charge; EM constants require a system to be specified e = EMConstant('e', 'Electron charge', 1.602176565e-19, 'C', 0.000000035e-19, 'CODATA 2010', system='si') # Electric constant eps0 = EMConstant('eps0', 'Electic constant', 8.854187817e-12, 'F/m', 0.0, 'CODATA 2010', system='si') # Avogadro's number N_A = Constant('N_A', "Avogadro's number", 6.02214129e23, '1 / (mol)', 0.00000027e23, 'CODATA 2010', system='si') # Gas constant R = Constant('R', "Gas constant", 8.3144621, 'J / (K mol)', 0.0000075, 'CODATA 2010', system='si') # Rydberg constant Ryd = Constant('Ryd', 'Rydberg constant', 10973731.568539, '1 / (m)', 0.000055, 'CODATA 2010', system='si') # Bohr radius a0 = Constant('a0', "Bohr radius", 0.52917721092e-10, 'm', 0.00000000017e-10, 'CODATA 2010', system='si') # Bohr magneton muB = Constant('muB', "Bohr magneton", 927.400968e-26, 'J/T', 0.00002e-26, 'CODATA 2010', system='si') # Fine structure constant alpha = Constant('alpha', "Fine-structure constant", 7.2973525698e-3, '', 0.0000000024e-3, 'CODATA 2010', system='si') # Atmosphere atm = Constant('atmosphere', "Atmosphere", 101325, 'Pa', 0.0, 'CODATA 2010', system='si') # Magnetic constant mu0 = Constant('mu0', "Magnetic constant", 4.0e-7 * np.pi, 'N/A2', 0.0, 'CODATA 2010', system='si') # DISTANCE # Astronomical Unit au = Constant('au', "Astronomical Unit", 1.49597870700e11, 'm', 0.0, "IAU 2012 Resolution B2", system='si') # Parsec pc = Constant('pc', "Parsec", au.value / np.tan(np.radians(1. / 3600.)), 'm', au.uncertainty / np.tan(np.radians(1. / 3600.)), "Derived from au", system='si') # Kiloparsec kpc = Constant('kpc', "Kiloparsec", 1000. * au.value / np.tan(np.radians(1. / 3600.)), 'm', 1000. * au.uncertainty / np.tan(np.radians(1. / 3600.)), "Derived from au", system='si') # SOLAR QUANTITIES # Solar luminosity L_sun = Constant('L_sun', "Solar luminosity", 3.846e26, 'W', 0.0005e26, "Allen's Astrophysical Quantities 4th Ed.", system='si') # Solar mass M_sun = Constant('M_sun', "Solar mass", 1.9891e30, 'kg', 0.00005e30, "Allen's Astrophysical Quantities 4th Ed.", system='si') # Solar radius R_sun = Constant('R_sun', "Solar radius", 6.95508e8, 'm', 0.00026e8, "Allen's Astrophysical Quantities 4th Ed.", system='si') # OTHER SOLAR SYSTEM QUANTITIES # Jupiter mass M_jup = Constant('M_jup', "Jupiter mass", 1.8987e27, 'kg', 0.00005e27, "Allen's Astrophysical Quantities 4th Ed.", system='si') # Jupiter equatorial radius R_jup = Constant('R_jup', "Jupiter equatorial radius", 7.1492e7, 'm', 0.00005e7, "Allen's Astrophysical Quantities 4th Ed.", system='si') # Earth mass M_earth = Constant('M_earth', "Earth mass", 5.9742e24, 'kg', 0.00005e24, "Allen's Astrophysical Quantities 4th Ed.", system='si') # Earth equatorial radius R_earth = Constant('R_earth', "Earth equatorial radius", 6.378136e6, 'm', 0.0000005e6, "Allen's Astrophysical Quantities 4th Ed.", system='si') astropy-0.3/astropy/constants/setup_package.py0000644000175000017500000000015012243255342020075 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def requires_2to3(): return False astropy-0.3/astropy/constants/cgs.py0000644000175000017500000000177012243255342016047 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants in cgs units. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ from __future__ import (absolute_import, division, print_function, unicode_literals) # Only constants that cannot be converted directly from S.I. are defined here. from .constant import EMConstant from . import si # PHYSICAL CONSTANTS # Electron charge e_esu = EMConstant(si.e.abbrev, si.e.name, si.e.value * si.c.value * 10.0, 'statC', si.e.uncertainty * si.c.value * 10.0, si.e.reference, system='esu') e_emu = EMConstant(si.e.abbrev, si.e.name, si.e.value / 10, 'abC', si.e.uncertainty / 10, si.e.reference, system='emu') e_gauss = EMConstant(si.e.abbrev, si.e.name, si.e.value * si.c.value * 10.0, 'Fr', si.e.uncertainty * si.c.value * 10.0, si.e.reference, system='gauss') astropy-0.3/astropy/constants/constant.py0000644000175000017500000001671012243255342017124 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) from ..extern import six import functools import types import warnings from ..units.core import Unit, UnitsError from ..units.quantity import Quantity from ..utils import lazyproperty from ..utils.exceptions import AstropyUserWarning __all__ = ['Constant', 'EMConstant'] class ConstantMeta(type): """Metaclass for the :class:`Constant`. The primary purpose of this is to wrap the double-underscore methods of :class:`Quantity` which is the superclass of :class:`Constant`. In particular this wraps the operator overloads such as `__add__` to prevent their use with constants such as ``e`` from being used in expressions without specifying a system. The wrapper checks to see if the constant is listed (by name) in ``Constant._has_incompatible_units``, a set of those constants that are defined in different systems of units are physically incompatible. It also performs this check on each `Constant` if it hasn't already been performed (the check is deferred until the `Constant` is actually used in an expression to speed up import times, among other reasons). """ def __new__(mcls, name, bases, d): def wrap(meth): @functools.wraps(meth) def wrapper(self, *args, **kwargs): name_lower = self.name.lower() instances = Constant._registry[name_lower] if not self._checked_units: for inst in six.itervalues(instances): try: self.unit.to(inst.unit) except UnitsError: Constant._has_incompatible_units.add(name_lower) self._checked_units = True if (not self.system and name_lower in Constant._has_incompatible_units): systems = sorted([x for x in instances if x]) raise TypeError( 'Constant {0!r} does not have physically compatible ' 'units across all systems of units and cannot be ' 'combined with other values without specifying a ' 'system (eg. {1}.{2})'.format(self.abbrev, self.abbrev, systems[0])) return meth(self, *args, **kwargs) return wrapper # The wrapper applies to so many of the __ methods that it's easier to # just exclude the ones it doesn't apply to exclude = set(['__new__', '__array_finalize__', '__array_wrap__', '__dir__', '__getattr__', '__init__', '__str__', '__repr__', '__hash__', '__iter__', '__getitem__', '__len__', '__nonzero__']) for attr, value in list(six.iteritems(vars(Quantity))): if (isinstance(value, types.FunctionType) and attr.startswith('__') and attr.endswith('__') and attr not in exclude): d[attr] = wrap(value) return super(ConstantMeta, mcls).__new__(mcls, name, bases, d) @six.add_metaclass(ConstantMeta) class Constant(Quantity): """A physical or astronomical constant. These objects are quantities that are meant to represent physical constants. """ _registry = {} _has_incompatible_units = set() def __new__(cls, abbrev, name, value, unit, uncertainty, reference, system=None): name_lower = name.lower() instances = Constant._registry.setdefault(name_lower, {}) if system in instances: warnings.warn('Constant {0!r} is already has a definition in the ' '{1!r} system'.format(name, system), AstropyUserWarning) inst = super(Constant, cls).__new__(cls, value) for c in six.itervalues(instances): if system is not None and not hasattr(c.__class__, system): setattr(c, system, inst) if c.system is not None and not hasattr(inst.__class__, c.system): setattr(inst, c.system, c) instances[system] = inst return inst def __init__(self, abbrev, name, value, unit, uncertainty, reference, system=None): self._abbrev = abbrev self._name = name self._value = value self._unit = unit self._uncertainty = uncertainty self._reference = reference self._system = system self._checked_units = False def __repr__(self): return (''.format(self.name, self.value, self.uncertainty, str(self.unit), self.reference)) def __str__(self): return (' Name = {0}\n' ' Value = {1}\n' ' Error = {2}\n' ' Units = {3}\n' ' Reference = {4}'.format(self.name, self.value, self.uncertainty, self.unit, self.reference)) @property def abbrev(self): """A typical ASCII text abbreviation of the constant, also generally the same as the Python variable used for this constant. """ return self._abbrev @property def name(self): """The full name of the constant.""" return self._name @lazyproperty def unit(self): """The unit(s) in which this constant is defined.""" return Unit(self._unit) @property def uncertainty(self): """The known uncertainty in this constant's value.""" return self._uncertainty @property def reference(self): """The source used for the value of this constant.""" return self._reference @property def system(self): """The system of units in which this constant is defined (typically `None` so long as the constant's units can be directly converted between systems). """ return self._system @property def si(self): """If the Constant is defined in the SI system return that instance of the constant, else convert to a Quantity in the appropriate SI units. """ instances = Constant._registry[self.name.lower()] return instances.get('si') or super(Constant, self).si @property def cgs(self): """If the Constant is defined in the CGS system return that instance of the constant, else convert to a Quantity in the appropriate CGS units. """ instances = Constant._registry[self.name.lower()] return instances.get('cgs') or super(Constant, self).cgs class EMConstant(Constant): """An electromagnetic constant.""" @property def cgs(self): """Overridden for EMConstant to raise a `TypeError` emphasizing that there are multiple EM extensions to CGS. """ raise TypeError("Cannot convert EM constants to cgs because there " "are different systems for E.M constants within the " "c.g.s system (ESU, Gaussian, etc.). Instead, " "directly use the constant with the appropriate " "suffix (e.g. e.esu, e.gauss, etc.).") astropy-0.3/astropy/cosmology/0000755000175000017500000000000012243263747014723 5ustar oleoleastropy-0.3/astropy/cosmology/core.py0000644000175000017500000022351112243255342016221 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys import warnings from math import sqrt, pi, exp, log, floor from abc import ABCMeta, abstractmethod import numpy as np from .. import constants as const from ..config import ConfigurationItem from ..utils.misc import isiterable from ..utils.exceptions import AstropyUserWarning from .. import units as u from . import parameters # Originally authored by Andrew Becker (becker@astro.washington.edu), # and modified by Neil Crighton (neilcrighton@gmail.com) and Roban # Kramer (robanhk@gmail.com). # Many of these adapted from Hogg 1999, astro-ph/9905116 # and Linder 2003, PRL 90, 91301 __all__ = ["FLRW", "LambdaCDM", "FlatLambdaCDM", "wCDM", "FlatwCDM", "Flatw0waCDM", "w0waCDM", "wpwaCDM", "w0wzCDM", "get_current", "set_current", "WMAP5", "WMAP7", "WMAP9", "Planck13"] __doctest_requires__ = {'*': ['scipy.integrate']} # Constants # Mpc in km Mpc_km = (1 * u.Mpc).to(u.km) arcsec_in_radians = 1 / 3600. * pi / 180 arcmin_in_radians = 1 / 60. * pi / 180 # Radiation parameter over c^2 in cgs a_B_c2 = 4 * const.sigma_sb.cgs.value / const.c.cgs.value ** 3 # Boltzmann constant in eV / K kB_evK = const.k_B.decompose().to(u.eV / u.K) DEFAULT_COSMOLOGY = ConfigurationItem( 'default_cosmology', 'no_default', 'The default cosmology to use. Note this is only read on import, ' 'so changing this value at runtime has no effect.') class CosmologyError(Exception): pass class Cosmology(object): """ Placeholder for when a more general Cosmology class is implemented. """ pass class FLRW(Cosmology): """ A class describing an isotropic and homogeneous (Friedmann-Lemaitre-Robertson-Walker) cosmology. This is an abstract base class -- you can't instantiate examples of this class, but must work with one of its subclasses such as `LambdaCDM` or `wCDM`. Parameters ---------- H0 : float or scalar astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of dark energy in units of the critical density at z=0. Tcmb0 : float or scalar astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Setting this to zero will turn off both photons and neutrinos (even massive ones) Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Notes ----- Class instances are static -- you can't change the values of the parameters. That is, all of the attributes above are read only. """ __metaclass__ = ABCMeta def __init__(self, H0, Om0, Ode0, Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): # all densities are in units of the critical density self._Om0 = float(Om0) if self._Om0 < 0.0: raise ValueError("Matter density can not be negative") self._Ode0 = float(Ode0) self._Neff = float(Neff) if self._Neff < 0.0: raise ValueError("Effective number of neutrinos can " "not be negative") self.name = name # Tcmb may have units if isinstance(Tcmb0, u.Quantity): if not Tcmb0.isscalar: raise ValueError("Tcmb0 is a non-scalar quantity") self._Tcmb0 = Tcmb0.to(u.K) else: self._Tcmb0 = float(Tcmb0) * u.K # Hubble parameter at z=0, km/s/Mpc if isinstance(H0, u.Quantity): if not H0.isscalar: raise ValueError("H0 is a non-scalar quantity") self._H0 = H0.to(u.km / u.s / u.Mpc) else: self._H0 = float(H0) * u.km / u.s / u.Mpc # 100 km/s/Mpc * h = H0 (so h is dimensionless) self._h = self._H0.value / 100. # Hubble distance self._hubble_distance = (const.c / self._H0).to(u.Mpc) # H0 in s^-1 H0_s = self._H0.to(1.0 / u.s) # Hubble time self._hubble_time = (1. / H0_s).to(u.Gyr) # critical density at z=0 (grams per cubic cm) self._critical_density0 = (3. * H0_s ** 2 / (8. * pi * const.G.cgs)).cgs # Load up neutrino masses. self._nneutrinos = floor(self._Neff) # We are going to share Neff between the neutrinos equally. # In detail this is not correct, but it is a standard assumption # because propertly calculating it is a) complicated b) depends # on the details of the massive nuetrinos (e.g., their weak # interactions, which could be unusual if one is considering sterile # neutrinos) self._massivenu = False if self._nneutrinos > 0 and self._Tcmb0.value > 0: self._neff_per_nu = self._Neff / self._nneutrinos if not isinstance(m_nu, u.Quantity): raise ValueError("m_nu must be a Quantity") m_nu = m_nu.to(u.eV, equivalencies=u.mass_energy()) # Now, figure out if we have massive neutrinos to deal with, # and, if so, get the right number of masses # It is worth the effort to keep track of massless ones seperately # (since they are quite easy to deal with, and a common use case # is to set only one neutrino to have mass) if m_nu.isscalar: # Assume all neutrinos have the same mass if m_nu.value == 0: self._nmasslessnu = self._nneutrinos self._nmassivenu = 0 else: self._massivenu = True self._nmasslessnu = 0 self._nmassivenu = self._nneutrinos self._massivenu_mass = (m_nu.value * np.ones(self._nneutrinos)) else: # Make sure we have the right number of masses # -unless- they are massless, in which case we cheat a little if m_nu.value.min() < 0: raise ValueError("Invalid (negative) neutrino mass" " encountered") if m_nu.value.max() == 0: self._nmasslessnu = self._nneutrinos self._nmassivenu = 0 else: self._massivenu = True if len(m_nu) != self._nneutrinos: raise ValueError("Unexpected number of neutrino masses") # Segregate out the massless ones try: # Numpy < 1.6 doesn't have count_nonzero self._nmasslessnu = np.count_nonzero(m_nu.value == 0) except AttributeError: self._nmasslessnu = len(np.nonzero(m_nu.value == 0)[0]) self._nmassivenu = self._nneutrinos - self._nmasslessnu w = np.nonzero(m_nu.value > 0)[0] self._massivenu_mass = m_nu[w] # Compute photon density, Tcmb, neutrino parameters # Tcmb0=0 removes both photons and neutrinos, is handled # as a special case for efficiency if self._Tcmb0.value > 0: # Compute photon density from Tcmb self._Ogamma0 = a_B_c2 * self._Tcmb0.value ** 4 /\ self._critical_density0.value # Compute Neutrino temperature # The constant in front is (4/11)^1/3 -- see any # cosmology book for an explanation -- for example, # Weinberg 'Cosmology' p 154 eq (3.1.21) self._Tnu0 = 0.7137658555036082 * self._Tcmb0 # Compute Neutrino Omega and total relativistic component # for massive neutrinos if self._massivenu: nu_y = self._massivenu_mass / (kB_evK * self._Tnu0) self._nu_y = nu_y.value self._Onu0 = self._Ogamma0 * self.nu_relative_density(0) else: # This case is particularly simple, so do it directly # The 0.2271... is 7/8 (4/11)^(4/3) -- the temperature # bit ^4 (blackbody energy density) times 7/8 for # FD vs. BE statistics. self._Onu0 = 0.22710731766 * self._Neff * self._Ogamma0 else: self._Ogamma0 = 0.0 self._Tnu0 = u.Quantity(0.0, u.K) self._Onu0 = 0.0 # Compute curvature density self._Ok0 = 1.0 - self._Om0 - self._Ode0 - self._Ogamma0 - self._Onu0 def _namelead(self): """ Helper function for constructing __repr__""" if self.name is None: return "{0:s}(".format(self.__class__.__name__) else: return "{0:s}(name=\"{1:s}\", ".format(self.__class__.__name__, self.name) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, "\ "Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0, self._Tcmb0, self._Neff, self.m_nu) # Set up a set of properties for H0, Om0, Ode0, Ok0, etc. for user access. # Note that we don't let these be set (so, obj.Om0 = value fails) @property def H0(self): """ Return the Hubble constant as an astropy.units.Quantity at z=0""" return self._H0 @property def Om0(self): """ Omega matter; matter density/critical density at z=0""" return self._Om0 @property def Ode0(self): """ Omega dark energy; dark energy density/critical density at z=0""" return self._Ode0 @property def Ok0(self): """ Omega curvature; the effective curvature density/critical density at z=0""" return self._Ok0 @property def Tcmb0(self): """ Temperature of the CMB as astropy.units.Quantity at z=0""" return self._Tcmb0 @property def Tnu0(self): """ Temperature of the neutrino background as astropy.units.Quantity at z=0""" return self._Tnu0 @property def Neff(self): """ Number of effective neutrino species""" return self._Neff @property def has_massive_nu(self): """ Does this cosmology have at least one massive neutrino species?""" if self._Tnu0.value == 0: return False return self._massivenu @property def m_nu(self): """ Mass of neutrino species""" if self._Tnu0.value == 0: return None if not self._massivenu: # Only massless return u.Quantity(np.zeros(self._nmasslessnu), u.eV) if self._nmasslessnu == 0: # Only massive return u.Quantity(self._massivenu_mass, u.eV) # A mix -- the most complicated case return u.Quantity(np.append(np.zeros(self._nmasslessnu), self._massivenu_mass.value), u.eV) @property def h(self): """ Dimensionless Hubble constant: h = H_0 / 100 [km/sec/Mpc]""" return self._h @property def hubble_time(self): """ Hubble time as astropy.units.Quantity""" return self._hubble_time @property def hubble_distance(self): """ Hubble distance as astropy.units.Quantity""" return self._hubble_distance @property def critical_density0(self): """ Critical density as astropy.units.Quantity at z=0""" return self._critical_density0 @property def Ogamma0(self): """ Omega gamma; the density/critical density of photons at z=0""" return self._Ogamma0 @property def Onu0(self): """ Omega nu; the density/critical density of neutrinos at z=0""" return self._Onu0 @abstractmethod def w(self, z): """ The dark energy equation of state. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. This must be overridden by subclasses. """ raise NotImplementedError("w(z) is not implemented") def Om(self, z): """ Return the density parameter for non-relativistic matter at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Om : ndarray, or float if input scalar The density of non-relativistic matter relative to the critical density at each redshift. """ if isiterable(z): z = np.asarray(z) return self._Om0 * (1. + z) ** 3 * self.inv_efunc(z) ** 2 def Ok(self, z): """ Return the equivalent density parameter for curvature at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Ok : ndarray, or float if input scalar The equivalent density parameter for curvature at each redshift. """ if self._Ok0 == 0: # Common enough case to be worth checking return np.zeros_like(z) if isiterable(z): z = np.asarray(z) return self._Ok0 * (1. + z) ** 2 * self.inv_efunc(z) ** 2 def Ode(self, z): """ Return the density parameter for dark energy at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Ode : ndarray, or float if input scalar The density of non-relativistic matter relative to the critical density at each redshift. """ if self._Ode0 == 0: return np.zeros_like(z) return self._Ode0 * self.de_density_scale(z) * self.inv_efunc(z) ** 2 def Ogamma(self, z): """ Return the density parameter for photons at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Ogamma : ndarray, or float if input scalar The energy density of photons relative to the critical density at each redshift. """ if self._Ogamma0 == 0: # Common enough case to be worth checking (although it clearly # doesn't represent any real universe) return np.zeros_like(z) if isiterable(z): z = np.asarray(z) return self._Ogamma0 * (1. + z) ** 4 * self.inv_efunc(z) ** 2 def Onu(self, z): """ Return the density parameter for massless neutrinos at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Onu : ndarray, or float if input scalar The energy density of photons relative to the critical density at each redshift. Note that this includes their kinetic energy (if they have mass), so it is not equal to the commonly used :math:`\\sum \\frac{m_{\\nu}}{94 eV}`, which does not include kinetic energy. """ if self._Onu0 == 0: # Common enough case to be worth checking (although it clearly # doesn't represent any real universe) return np.zeros_like(z) if isiterable(z): z = np.asarray(z) return self.Ogamma(z) * self.nu_relative_density(z) def Tcmb(self, z): """ Return the CMB temperature at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Tcmb : astropy.units.Quantity The temperature of the CMB in K. """ if isiterable(z): z = np.asarray(z) return self._Tcmb0 * (1.0 + z) def Tnu(self, z): """ Return the neutrino temperature at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- Tnu : astropy.units.Quantity The temperature of the cosmic neutrino background in K. """ if isiterable(z): z = np.asarray(z) return self._Tnu0 * (1.0 + z) def nu_relative_density(self, z): """ Neutrino density function relative to the energy density in photons. Parameters ---------- z : array like Redshift Returns ------- f : ndarray, or float if z is scalar The neutrino density scaling factor relative to the density in photons at each redshift Notes ----- The density in neutrinos is given by .. math:: \\rho_{\\nu} \\left(a\\right) = 0.2271 \\, N_{eff} \\, f\\left(m_{\\nu} a / T_{\\nu 0} \\right) \\, \\rho_{\\gamma} \\left( a \\right) where .. math:: f \\left(y\\right) = \\frac{120}{7 \\pi^4} \\int_0^{\\infty} \\, dx \\frac{x^2 \\sqrt{x^2 + y^2}} {e^x + 1} assuming that all neutrino species have the same mass. If they have different masses, a similar term is calculated for each one. Note that f has the asymptotic behavior :math:`f(0) = 1`. This method returns :math:`0.2271 f` using an analytical fitting formula given in Komatsu et al. 2011, ApJS 192, 18. """ # See Komatsu et al. 2011, eq 26 and the surrounding discussion # However, this is modified to handle multiple neutrino masses # by computing the above for each mass, then summing prefac = 0.22710731766 # 7/8 (4/11)^4/3 -- see any cosmo book # The massive and massless contribution must be handled seperately # But check for common cases first if not self._massivenu: return prefac * self._Neff * np.ones_like(z) p = 1.83 invp = 1.0 / 1.83 if np.isscalar(z): curr_nu_y = self._nu_y / (1.0 + z) # only includes massive ones rel_mass_per = (1.0 + (0.3173 * curr_nu_y) ** p) ** invp rel_mass = rel_mass_per.sum() + self._nmasslessnu return prefac * self._neff_per_nu * rel_mass else: z = np.asarray(z) retarr = np.empty_like(z) for i, redshift in enumerate(z): curr_nu_y = self._nu_y / (1.0 + redshift) rel_mass_per = (1.0 + (0.3173 * curr_nu_y) ** p) ** invp rel_mass = rel_mass_per.sum() + self._nmasslessnu retarr[i] = prefac * self._neff_per_nu * rel_mass return retarr def _w_integrand(self, ln1pz): """ Internal convenience function for w(z) integral.""" # See Linder 2003, PRL 90, 91301 eq (5) # Assumes scalar input, since this should only be called # inside an integral z = exp(ln1pz) - 1.0 return 1.0 + self.w(z) def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and is given by .. math:: I = \\exp \\left( 3 \int_{a}^1 \\frac{ da^{\\prime} }{ a^{\\prime} } \\left[ 1 + w\\left( a^{\\prime} \\right) \\right] \\right) It will generally helpful for subclasses to overload this method if the integral can be done analytically for the particular dark energy equation of state that they implement. """ # This allows for an arbitrary w(z) following eq (5) of # Linder 2003, PRL 90, 91301. The code here evaluates # the integral numerically. However, most popular # forms of w(z) are designed to make this integral analytic, # so it is probably a good idea for subclasses to overload this # method if an analytic form is available. # # The integral we actually use (the one given in Linder) # is rewritten in terms of z, so looks slightly different than the # one in the documentation string, but it's the same thing. from scipy.integrate import quad if isiterable(z): z = np.asarray(z) ival = np.array([quad(self._w_integrand, 0, log(1 + redshift))[0] for redshift in z]) return np.exp(3 * ival) else: ival = quad(self._w_integrand, 0, log(1 + z))[0] return exp(3 * ival) def efunc(self, z): """ Function used to calculate H(z), the Hubble parameter. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the Hubble constant. Notes ----- The return value, E, is defined such that :math:`H(z) = H_0 E`. It is not necessary to override this method, but if de_density_scale takes a particularly simple form, it may be advantageous to. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0 * self.de_density_scale(z)) def inv_efunc(self, z): """Inverse of efunc. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the inverse Hubble constant. """ # Avoid the function overhead by repeating code if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return 1.0 / np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0 * self.de_density_scale(z)) def _tfunc(self, z): """ Integrand of the lookback time. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The integrand for the lookback time References ---------- Eqn 30 from Hogg 1999. """ if isiterable(z): zp1 = 1.0 + np.asarray(z) else: zp1 = 1. + z return 1.0 / (zp1 * self.efunc(z)) def _xfunc(self, z): """ Integrand of the absorption distance. Parameters ---------- z : array_like Input redshifts. Returns ------- X : ndarray, or float if input scalar The integrand for the absorption distance References ---------- See Hogg 1999 section 11. """ if isiterable(z): zp1 = 1.0 + np.asarray(z) else: zp1 = 1. + z return zp1 ** 2 / self.efunc(z) def H(self, z): """ Hubble parameter (km/s/Mpc) at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- H : astropy.units.Quantity Hubble parameter at each input redshift. """ return self._H0 * self.efunc(z) def scale_factor(self, z): """ Scale factor at redshift `z`. The scale factor is defined as :math:`a = 1 / (1 + z)`. Parameters ---------- z : array_like Input redshifts. Returns ------- a : ndarray, or float if input scalar Scale factor at each input redshift. """ if isiterable(z): z = np.asarray(z) return 1. / (1. + z) def lookback_time(self, z): """ Lookback time in Gyr to redshift `z`. The lookback time is the difference between the age of the Universe now and the age at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- t : astropy.units.Quantity Lookback time in Gyr to each input redshift. """ from scipy.integrate import quad if not isiterable(z): return self._hubble_time * quad(self._tfunc, 0, z)[0] out = np.array([quad(self._tfunc, 0, redshift)[0] for redshift in z]) return self._hubble_time * np.array(out) def age(self, z): """ Age of the universe in Gyr at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- t : astropy.units.Quantity The age of the universe in Gyr at each input redshift. """ from scipy.integrate import quad if not isiterable(z): return self._hubble_time * quad(self._tfunc, z, np.inf)[0] out = [quad(self._tfunc, redshift, np.inf)[0] for redshift in z] return self._hubble_time * np.array(out) def critical_density(self, z): """ Critical density in grams per cubic cm at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- rho : astropy.units.Quantity Critical density in g/cm^3 at each input redshift. """ return self._critical_density0 * (self.efunc(z)) ** 2 def comoving_distance(self, z): """ Comoving line-of-sight distance in Mpc at a given redshift. The comoving distance along the line-of-sight between two objects remains constant with time for objects in the Hubble flow. Parameters ---------- z : array_like Input redshifts. Returns ------- d : ndarray, or float if input scalar Comoving distance in Mpc to each input redshift. """ from scipy.integrate import quad if not isiterable(z): return self._hubble_distance * quad(self.inv_efunc, 0, z)[0] out = [quad(self.inv_efunc, 0, redshift)[0] for redshift in z] return self._hubble_distance * np.array(out) def comoving_transverse_distance(self, z): """ Comoving transverse distance in Mpc at a given redshift. This value is the transverse comoving distance at redshift `z` corresponding to an angular separation of 1 radian. This is the same as the comoving distance if omega_k is zero (as in the current concordance lambda CDM model). Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity Comoving transverse distance in Mpc at each input redshift. Notes ----- This quantity also called the 'proper motion distance' in some texts. """ Ok0 = self._Ok0 dc = self.comoving_distance(z) if Ok0 == 0: return dc sqrtOk0 = sqrt(abs(Ok0)) dh = self._hubble_distance if Ok0 > 0: return dh / sqrtOk0 * np.sinh(sqrtOk0 * dc.value / dh.value) else: return dh / sqrtOk0 * np.sin(sqrtOk0 * dc.value / dh.value) def angular_diameter_distance(self, z): """ Angular diameter distance in Mpc at a given redshift. This gives the proper (sometimes called 'physical') transverse distance corresponding to an angle of 1 radian for an object at redshift `z`. Weinberg, 1972, pp 421-424; Weedman, 1986, pp 65-67; Peebles, 1993, pp 325-327. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity Angular diameter distance in Mpc at each input redshift. """ if isiterable(z): z = np.asarray(z) return self.comoving_transverse_distance(z) / (1. + z) def luminosity_distance(self, z): """ Luminosity distance in Mpc at redshift `z`. This is the distance to use when converting between the bolometric flux from an object at redshift `z` and its bolometric luminosity. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity Luminosity distance in Mpc at each input redshift. References ---------- Weinberg, 1972, pp 420-424; Weedman, 1986, pp 60-62. """ if isiterable(z): z = np.asarray(z) return (1. + z) * self.comoving_transverse_distance(z) def angular_diameter_distance_z1z2(self, z1, z2): """ Angular diameter distance between objects at 2 redshifts. Useful for gravitational lensing. Parameters ---------- z1, z2 : array_like, shape (N,) Input redshifts. z2 must be large than z1. Returns ------- d : astropy.units.Quantity, shape (N,) or single if input scalar The angular diameter distance between each input redshift pair. Raises ------ CosmologyError If omega_k is < 0. Notes ----- This method only works for flat or open curvature (omega_k >= 0). """ # does not work for negative curvature Ok0 = self._Ok0 if Ok0 < 0: raise CosmologyError('Ok0 must be >= 0 to use this method.') outscalar = False if not isiterable(z1) and not isiterable(z2): outscalar = True z1 = np.atleast_1d(z1) z2 = np.atleast_1d(z2) if z1.size != z2.size: raise ValueError('z1 and z2 must be the same size.') if (z1 > z2).any(): raise ValueError('z2 must greater than z1') # z1 < z2 if (z2 < z1).any(): z1, z2 = z2, z1 dm1 = self.comoving_transverse_distance(z1).value dm2 = self.comoving_transverse_distance(z2).value dh_2 = self._hubble_distance.value ** 2 if Ok0 == 0: # Common case worth checking out = (dm2 - dm1) / (1. + z2) else: out = ((dm2 * np.sqrt(1. + Ok0 * dm1 ** 2 / dh_2) - dm1 * np.sqrt(1. + Ok0 * dm2 ** 2 / dh_2)) / (1. + z2)) if outscalar: return u.Quantity(out[0], u.Mpc) return u.Quantity(out, u.Mpc) def absorption_distance(self, z): """ Absorption distance at redshift `z`. This is used to calculate the number of objects with some cross section of absorption and number density intersecting a sightline per unit redshift path. Parameters ---------- z : array_like Input redshifts. Returns ------- d : float or ndarray Absorption distance (dimensionless) at each input redshift. References ---------- Hogg 1999 Section 11. (astro-ph/9905116) Bahcall, John N. and Peebles, P.J.E. 1969, ApJ, 156L, 7B """ from scipy.integrate import quad if not isiterable(z): return quad(self._xfunc, 0, z)[0] out = np.array([quad(self._xfunc, 0, redshift)[0] for redshift in z]) return out def distmod(self, z): """ Distance modulus at redshift `z`. The distance modulus is defined as the (apparent magnitude - absolute magnitude) for an object at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- distmod : astropy.units.Quantity Distance modulus at each input redshift, in magnitudes """ # Remember that the luminosity distance is in Mpc val = 5. * np.log10(self.luminosity_distance(z).value * 1.e5) return u.Quantity(val, u.mag) def comoving_volume(self, z): """ Comoving volume in cubic Mpc at redshift `z`. This is the volume of the universe encompassed by redshifts less than `z`. For the case of omega_k = 0 it is a sphere of radius `comoving_distance(z)` but it is less intuitive if omega_k is not 0. Parameters ---------- z : array_like Input redshifts. Returns ------- V : astropy.units.Quantity Comoving volume in :math:`Mpc^3` at each input redshift. """ Ok0 = self._Ok0 if Ok0 == 0: return 4. / 3. * pi * self.comoving_distance(z) ** 3 dh = self._hubble_distance.value # .value for speed dm = self.comoving_transverse_distance(z).value term1 = 4. * pi * dh ** 3 / (2. * Ok0) * u.Mpc ** 3 term2 = dm / dh * np.sqrt(1 + Ok0 * (dm / dh) ** 2) term3 = sqrt(abs(Ok0)) * dm / dh if Ok0 > 0: return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsinh(term3)) else: return term1 * (term2 - 1. / sqrt(abs(Ok0)) * np.arcsin(term3)) def kpc_comoving_per_arcmin(self, z): """ Separation in transverse comoving kpc corresponding to an arcminute at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity The distance in comoving kpc corresponding to an arcmin at each input redshift. """ return (self.comoving_transverse_distance(z).to(u.kpc) * arcmin_in_radians / u.arcmin) def kpc_proper_per_arcmin(self, z): """ Separation in transverse proper kpc corresponding to an arcminute at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity The distance in proper kpc corresponding to an arcmin at each input redshift. """ return (self.angular_diameter_distance(z).to(u.kpc) * arcmin_in_radians / u.arcmin) def arcsec_per_kpc_comoving(self, z): """ Angular separation in arcsec corresponding to a comoving kpc at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- theta : astropy.units.Quantity The angular separation in arcsec corresponding to a comoving kpc at each input redshift. """ return u.arcsec / (self.comoving_transverse_distance(z).to(u.kpc) * arcsec_in_radians) def arcsec_per_kpc_proper(self, z): """ Angular separation in arcsec corresponding to a proper kpc at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- theta : astropy.units.Quantity The angular separation in arcsec corresponding to a proper kpc at each input redshift. """ return u.arcsec / (self.angular_diameter_distance(z).to(u.kpc) * arcsec_in_radians) class LambdaCDM(FLRW): """FLRW cosmology with a cosmological constant and curvature. This has no additional attributes beyond those of FLRW. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of the cosmological constant in units of the critical density at z=0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import LambdaCDM >>> cosmo = LambdaCDM(H0=70, Om0=0.3, Ode0=0.7) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Ode0, Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name) def w(self, z): """Returns dark energy equation of state at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. Here this is :math:`w(z) = -1`. """ return -1.0 * np.ones_like(z) def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and in this case is given by :math:`I = 1`. """ return np.ones_like(z) def efunc(self, z): """ Function used to calculate H(z), the Hubble parameter. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the Hubble consant. Notes ----- The return value, E, is defined such that :math:`H(z) = H_0 E`. """ if isiterable(z): z = np.asarray(z) # We override this because it takes a particularly simple # form for a cosmological constant Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0) def inv_efunc(self, z): r""" Function used to calculate :math:`\frac{1}{H_z}`. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The inverse redshift scaling of the Hubble constant. Notes ----- The return value, E, is defined such that :math:`H_z = H_0 / E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0 = self._Om0, self._Ode0, self._Ok0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return 1.0 / np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0) class FlatLambdaCDM(LambdaCDM): """FLRW cosmology with a cosmological constant and no curvature. This has no additional attributes beyond those of FLRW. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import FlatLambdaCDM >>> cosmo = FlatLambdaCDM(H0=70, Om0=0.3) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name) # Do some twiddling after the fact to get flatness self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0 self._Ok0 = 0.0 def efunc(self, z): """ Function used to calculate H(z), the Hubble parameter. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the Hubble consant. Notes ----- The return value, E, is defined such that :math:`H(z) = H_0 E`. """ if isiterable(z): z = np.asarray(z) # We override this because it takes a particularly simple # form for a cosmological constant Om0, Ode0 = self._Om0, self._Ode0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + Ode0) def inv_efunc(self, z): r"""Function used to calculate :math:`\frac{1}{H_z}`. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The inverse redshift scaling of the Hubble constant. Notes ----- The return value, E, is defined such that :math:`H_z = H_0 / E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0 = self._Om0, self._Ode0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return 1.0 / np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + Ode0) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, Tcmb0={3:.4g}, "\ "Neff={4:.3g}, m_nu={5:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Tcmb0, self._Neff, self.m_nu) class wCDM(FLRW): """FLRW cosmology with a constant dark energy equation of state and curvature. This has one additional attribute beyond those of FLRW. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of dark energy in units of the critical density at z=0. w0 : float Dark energy equation of state at all redshifts. This is pressure/density for dark energy in units where c=1. A cosmological constant has w0=-1.0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import wCDM >>> cosmo = wCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Ode0, w0=-1., Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name) self._w0 = float(w0) @property def w0(self): """ Dark energy equation of state""" return self._w0 def w(self, z): """Returns dark energy equation of state at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. Here this is :math:`w(z) = w_0`. """ return self._w0 * np.ones_like(z) def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and in this case is given by :math:`I = \\left(1 + z\\right)^{3\\left(1 + w_0\\right)}` """ if isiterable(z): z = np.asarray(z) return (1.0 + z) ** (3 * (1 + self._w0)) def efunc(self, z): """ Function used to calculate H(z), the Hubble parameter. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the Hubble consant. Notes ----- The return value, E, is defined such that :math:`H(z) = H_0 E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0 * zp1 ** (3.0 * (1 + w0))) def inv_efunc(self, z): r""" Function used to calculate :math:`\frac{1}{H_z}`. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The inverse redshift scaling of the Hubble constant. Notes ----- The return value, E, is defined such that :math:`H_z = H_0 / E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return 1.0 / np.sqrt(zp1 ** 2 * ((Or * zp1 + Om0) * zp1 + Ok0) + Ode0 * zp1 ** (3 * (1 + w0))) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, w0={4:.3g}, "\ "Tcmb0={5:.4g}, Neff={6:.3g}, m_nu={7:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0, self._w0, self._Tcmb0, self._Neff, self.m_nu) class FlatwCDM(wCDM): """FLRW cosmology with a constant dark energy equation of state and no spatial curvature. This has one additional attribute beyond those of FLRW. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. w0 : float Dark energy equation of state at all redshifts. This is pressure/density for dark energy in units where c=1. A cosmological constant has w0=-1.0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import FlatwCDM >>> cosmo = FlatwCDM(H0=70, Om0=0.3, w0=-0.9) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, w0=-1., Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name) self._w0 = float(w0) # Do some twiddling after the fact to get flatness self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0 self._Ok0 = 0.0 def efunc(self, z): """ Function used to calculate H(z), the Hubble parameter. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The redshift scaling of the Hubble consant. Notes ----- The return value, E, is defined such that :math:`H(z) = H_0 E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, w0 = self._Om0, self._Ode0, self._w0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + Ode0 * zp1 ** (3.0 * (1 + w0))) def inv_efunc(self, z): r""" Function used to calculate :math:`\frac{1}{H_z}`. Parameters ---------- z : array_like Input redshifts. Returns ------- E : ndarray, or float if input scalar The inverse redshift scaling of the Hubble constant. Notes ----- The return value, E, is defined such that :math:`H_z = H_0 / E`. """ if isiterable(z): z = np.asarray(z) Om0, Ode0, Ok0, w0 = self._Om0, self._Ode0, self._Ok0, self._w0 if self._massivenu: Or = self._Ogamma0 * (1 + self.nu_relative_density(z)) else: Or = self._Ogamma0 + self._Onu0 zp1 = 1.0 + z return 1.0 / np.sqrt(zp1 ** 3 * (Or * zp1 + Om0) + Ode0 * zp1 ** (3 * (1 + w0))) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, w0={3:.3g}, Tcmb0={4:.4g}, "\ "Neff={5:.3g}, m_nu={6:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._w0, self._Tcmb0, self._Neff, self.m_nu) class w0waCDM(FLRW): """FLRW cosmology with a CPL dark energy equation of state and curvature. The equation for the dark energy equation of state uses the CPL form as described in Chevallier & Polarski Int. J. Mod. Phys. D10, 213 (2001) and Linder PRL 90, 91301 (2003): :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of dark energy in units of the critical density at z=0. w0 : float Dark energy equation of state at z=0 (a=1). This is pressure/density for dark energy in units where c=1. wa : float Negative derivative of the dark energy equation of state with respect to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import w0waCDM >>> cosmo = w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=0.2) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Ode0, w0=-1., wa=0., Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name) self._w0 = float(w0) self._wa = float(wa) @property def w0(self): """ Dark energy equation of state at z=0""" return self._w0 @property def wa(self): """ Negative derivative of dark energy equation of state w.r.t. a""" return self._wa def w(self, z): """Returns dark energy equation of state at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. Here this is :math:`w(z) = w_0 + w_a (1 - a) = w_0 + w_a \\frac{z}{1+z}`. """ if isiterable(z): z = np.asarray(z) return self._w0 + self._wa * z / (1.0 + z) def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and in this case is given by .. math:: I = \\left(1 + z\\right)^{3 \\left(1 + w_0 + w_a\\right)} \exp \\left(-3 w_a \\frac{z}{1+z}\\right) """ if isiterable(z): z = np.asarray(z) zp1 = 1.0 + z return zp1 ** (3 * (1 + self._w0 + self._wa)) * \ np.exp(-3 * self._wa * z / zp1) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, "\ "Ode0={3:.3g}, w0={4:.3g}, wa={5:.3g}, Tcmb0={6:.4g}, "\ "Neff={7:.3g}, m_nu={8:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0, self._w0, self._wa, self._Tcmb0, self._Neff, self.m_nu) class Flatw0waCDM(w0waCDM): """FLRW cosmology with a CPL dark energy equation of state and no curvature. The equation for the dark energy equation of state uses the CPL form as described in Chevallier & Polarski Int. J. Mod. Phys. D10, 213 (2001) and Linder PRL 90, 91301 (2003): :math:`w(z) = w_0 + w_a (1-a) = w_0 + w_a z / (1+z)`. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. w0 : float Dark energy equation of state at z=0 (a=1). This is pressure/density for dark energy in units where c=1. wa : float Negative derivative of the dark energy equation of state with respect to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import Flatw0waCDM >>> cosmo = Flatw0waCDM(H0=70, Om0=0.3, w0=-0.9, wa=0.2) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, w0=-1., wa=0., Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, 0.0, Tcmb0, Neff, m_nu, name=name) # Do some twiddling after the fact to get flatness self._Ode0 = 1.0 - self._Om0 - self._Ogamma0 - self._Onu0 self._Ok0 = 0.0 self._w0 = float(w0) self._wa = float(wa) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, "\ "w0={3:.3g}, Tcmb0={4:.4g}, Neff={5:.3g}, m_nu={6:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._w0, self._Tcmb0, self._Neff, self.m_nu) class wpwaCDM(FLRW): """FLRW cosmology with a CPL dark energy equation of state, a pivot redshift, and curvature. The equation for the dark energy equation of state uses the CPL form as described in Chevallier & Polarski Int. J. Mod. Phys. D10, 213 (2001) and Linder PRL 90, 91301 (2003), but modified to have a pivot redshift as in the findings of the Dark Energy Task Force (Albrecht et al. arXiv:0901.0721 (2009)): :math:`w(a) = w_p + w_a (a_p - a) = w_p + w_a( 1/(1+zp) - 1/(1+z) )`. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of dark energy in units of the critical density at z=0. wp : float Dark energy equation of state at the pivot redshift zp. This is pressure/density for dark energy in units where c=1. wa : float Negative derivative of the dark energy equation of state with respect to the scale factor. A cosmological constant has w0=-1.0 and wa=0.0. zp : float Pivot redshift -- the redshift where w(z) = wp Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : astropy.units.Quantity Mass of each neutrino species. If this is a scalar Quantity, then all neutrino species are assumed to have that mass. Otherwise, the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import wpwaCDM >>> cosmo = wpwaCDM(H0=70,Om0=0.3,Ode0=0.7,wp=-0.9,wa=0.2,zp=0.4) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Ode0, wp=-1., wa=0., zp=0, Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name) self._wp = float(wp) self._wa = float(wa) self._zp = float(zp) @property def wp(self): """ Dark energy equation of state at the pivot redshift zp""" return self._wp @property def wa(self): """ Negative derivative of dark energy equation of state w.r.t. a""" return self._wa @property def zp(self): """ The pivot redshift, where w(z) = wp""" return self._zp def w(self, z): """Returns dark energy equation of state at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. Here this is :math:`w(z) = w_p + w_a (a_p - a)` where :math:`a = 1/1+z` and :math:`a_p = 1 / 1 + z_p`. """ if isiterable(z): z = np.asarray(z) apiv = 1.0 / (1.0 + self._zp) return self._wp + self._wa * (apiv - 1.0 / (1. + z)) def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and in this case is given by .. math:: a_p = \\frac{1}{1 + z_p} I = \\left(1 + z\\right)^{3 \\left(1 + w_p + a_p w_a\\right)} \exp \\left(-3 w_a \\frac{z}{1+z}\\right) """ if isiterable(z): z = np.asarray(z) zp1 = 1.0 + z apiv = 1.0 / (1.0 + self._zp) return zp1 ** (3 * (1 + self._wp + apiv * self._wa)) * \ np.exp(-3 * self._wa * z / zp1) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, Ode0={3:.3g}, wp={4:.3g}, "\ "wa={5:.3g}, zp={6:.3g}, Tcmb0={7:.4g}, Neff={8:.3g}, "\ "m_nu={9:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0, self._wp, self._wa, self._zp, self._Tcmb0, self._Neff, self.m_nu) class w0wzCDM(FLRW): """FLRW cosmology with a variable dark energy equation of state and curvature. The equation for the dark energy equation of state uses the simple form: :math:`w(z) = w_0 + w_z z`. This form is not recommended for z > 1. Parameters ---------- H0 : float or astropy.units.Quantity Hubble constant at z = 0. If a float, must be in [km/sec/Mpc] Om0 : float Omega matter: density of non-relativistic matter in units of the critical density at z=0. Ode0 : float Omega dark energy: density of dark energy in units of the critical density at z=0. Ok0 : float Omega curvature: equivalent curvature density in units of the critical density at z=0. w0 : float Dark energy equation of state at z=0. This is pressure/density for dark energy in units where c=1. A cosmological constant has w0=-1.0. wz : float Derivative of the dark energy equation of state with respect to z. Tcmb0 : float or astropy.units.Quantity Temperature of the CMB z=0. If a float, must be in [K]. Default: 2.725. Neff : float Effective number of Neutrino species. Default 3.04. m_nu : float or ndarray or astropy.units.Quantity Mass of each neutrino species, in eV. If this is a float or scalar Quantity, then all neutrino species are assumed to have that mass. If a ndarray or array Quantity, then these are the values of the mass of each species. The actual number of neutrino species (and hence the number of elements of m_nu if it is not scalar) must be the floor of Neff. Usually this means you must provide three neutrino masses unless you are considering something like a sterile neutrino. name : str Optional name for this cosmological object. Examples -------- >>> from astropy.cosmology import w0wzCDM >>> cosmo = w0wzCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wz=0.2) The comoving distance in Mpc at redshift z: >>> z = 0.5 >>> dc = cosmo.comoving_distance(z) """ def __init__(self, H0, Om0, Ode0, w0=-1., wz=0., Tcmb0=2.725, Neff=3.04, m_nu=u.Quantity(0.0, u.eV), name=None): FLRW.__init__(self, H0, Om0, Ode0, Tcmb0, Neff, m_nu, name=name) self._w0 = float(w0) self._wz = float(wz) @property def w0(self): """ Dark energy equation of state at z=0""" return self._w0 @property def wz(self): """ Derivative of the dark energy equation of state w.r.t. z""" return self._wz def w(self, z): """Returns dark energy equation of state at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- w : ndarray, or float if input scalar The dark energy equation of state Notes ------ The dark energy equation of state is defined as :math:`w(z) = P(z)/\\rho(z)`, where :math:`P(z)` is the pressure at redshift z and :math:`\\rho(z)` is the density at redshift z, both in units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`. """ if isiterable(z): z = np.asarray(z) return self._w0 + self._wz * z def de_density_scale(self, z): """ Evaluates the redshift dependence of the dark energy density. Parameters ---------- z : array_like Input redshifts. Returns ------- I : ndarray, or float if input scalar The scaling of the energy density of dark energy with redshift. Notes ----- The scaling factor, I, is defined by :math:`\\rho(z) = \\rho_0 I`, and in this case is given by .. math:: I = \\left(1 + z\\right)^{3 \\left(1 + w_0 - w_z\\right)} \exp \\left(-3 w_z z\\right) """ if isiterable(z): z = np.asarray(z) zp1 = 1.0 + z return zp1 ** (3 * (1 + self._w0 - self._wz)) *\ np.exp(-3 * self._wz * z) def __repr__(self): retstr = "{0:s}H0={1:.3g}, Om0={2:.3g}, "\ "Ode0={3:.3g}, w0={4:.3g}, wz={5:.3g} Tcmb0={6:.4g}, "\ "Neff={7:.3g}, m_nu={8:s})" return retstr.format(self._namelead(), self._H0, self._Om0, self._Ode0, self._w0, self._wz, self._Tcmb0, self._Neff, self.m_nu) # Pre-defined cosmologies. This loops over the parameter sets in the # parameters module and creates a LambdaCDM or FlatLambdaCDM instance # with the same name as the parameter set in the current module's namespace. # Note this assumes all the cosmologies in parameters are LambdaCDM, # which is true at least as of this writing. for key in parameters.available: par = getattr(parameters, key) if par['flat']: cosmo = FlatLambdaCDM(par['H0'], par['Om0'], Tcmb0=par['Tcmb0'], Neff=par['Neff'], m_nu=u.Quantity(par['m_nu'], u.eV), name=key) cosmo.__doc__ = "%s instance of FlatLambdaCDM cosmology\n\n(from %s)" % (key, par['reference']) else: cosmo = LambdaCDM(par['H0'], par['Om0'], par['Ode0'], Tcmb0=par['Tcmb0'], Neff=par['Neff'], m_nu=u.Quantity(par['m_nu'], u.eV), name=key) cosmo.__doc__ = "%s instance of LambdaCDM cosmology\n\n(from %s)" % (key, par['reference']) setattr(sys.modules[__name__], key, cosmo) # don't leave these variables floating around in the namespace del key, par, cosmo ######################################################################### # The variable below contains the current cosmology used by the # convenience functions below and by other astropy functions if no # cosmology is explicitly given. It can be set with set_current() and # should be accessed using get_current(). ######################################################################### def get_cosmology_from_string(arg): """ Return a cosmology instance from a string. """ if arg == 'no_default': cosmo = None else: try: cosmo = getattr(sys.modules[__name__], arg) except AttributeError: s = "Unknown cosmology '%s'. Valid cosmologies:\n%s" % ( arg, parameters.available) raise ValueError(s) return cosmo _current = get_cosmology_from_string(DEFAULT_COSMOLOGY()) def get_current(): """ Get the current cosmology. If no current has been set, the WMAP9 comology is returned and a warning is given. Returns ------- cosmo : `Cosmology` instance See Also -------- set_current : sets the current cosmology """ if _current is None: warnings.warn('No default cosmology has been specified, ' 'using 9-year WMAP.', AstropyUserWarning) return WMAP9 return _current def set_current(cosmo): """ Set the current cosmology. Call this with an empty string ('') to get a list of the strings that map to available pre-defined cosmologies. .. warning:: `set_current` is the only way to change the current cosmology at runtime! The current cosmology can also be read from an option in the astropy configuration file when astropy.cosmology is first imported. However, any subsequent changes to the cosmology configuration option using `ConfigurationItem.set ` at run-time will not update the current cosmology. Parameters ---------- cosmo : str or `Cosmology` instance The cosmology to use. See Also -------- get_current : returns the currently-set cosmology """ global _current if isinstance(cosmo, basestring): _current = get_cosmology_from_string(cosmo) elif isinstance(cosmo, Cosmology): _current = cosmo else: raise ValueError( "Argument must be a string or cosmology instance. Valid strings:" "\n%s" % parameters.available) astropy-0.3/astropy/cosmology/tests/0000755000175000017500000000000012243263747016065 5ustar oleoleastropy-0.3/astropy/cosmology/tests/__init__.py0000644000175000017500000000000012243255342020154 0ustar oleoleastropy-0.3/astropy/cosmology/tests/test_cosmology.py0000644000175000017500000011341412243255342021505 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from StringIO import StringIO import numpy as np from .. import core, funcs from ...tests.helper import pytest from ... import units as u try: import scipy # pylint: disable=W0611 except ImportError: HAS_SCIPY = False else: HAS_SCIPY = True def setup_function(function): # Make sure that tests don't affect default cosmology core.set_current('no_default') def teardown_function(function): # Make sure that tests don't affect default cosmology core.set_current('no_default') def test_basic(): cosmo = core.FlatLambdaCDM(H0=70, Om0=0.27, Tcmb0=2.0, Neff=3.04) assert np.allclose(cosmo.Om0, 0.27) assert np.allclose(cosmo.Ode0, 0.729975, rtol=1e-4) assert np.allclose(cosmo.Ogamma0, 1.463285e-5, rtol=1e-4) assert np.allclose(cosmo.Onu0, 1.01026e-5, rtol=1e-4) assert np.allclose(cosmo.Ok0, 0.0) assert np.allclose(cosmo.Om0 + cosmo.Ode0 + cosmo.Ogamma0 + cosmo.Onu0, 1.0, rtol=1e-6) assert np.allclose(cosmo.Om(1) + cosmo.Ode(1) + cosmo.Ogamma(1) + cosmo.Onu(1), 1.0, rtol=1e-6) assert np.allclose(cosmo.Tcmb0.value, 2.0) assert np.allclose(cosmo.Tnu0.value, 1.4275317, rtol=1e-5) assert np.allclose(cosmo.Neff, 3.04) assert np.allclose(cosmo.h, 0.7) assert np.allclose(cosmo.H0.value, 70.0) # Make sure setting them as quantities gives the same results H0 = u.Quantity(70, u.km / (u.s * u.Mpc)) T = u.Quantity(2.0, u.K) cosmo = core.FlatLambdaCDM(H0=H0, Om0=0.27, Tcmb0=T, Neff=3.04) assert np.allclose(cosmo.Om0, 0.27) assert np.allclose(cosmo.Ode0, 0.729975, rtol=1e-4) assert np.allclose(cosmo.Ogamma0, 1.463285e-5, rtol=1e-4) assert np.allclose(cosmo.Onu0, 1.01026e-5, rtol=1e-4) assert np.allclose(cosmo.Ok0, 0.0) assert np.allclose(cosmo.Om0 + cosmo.Ode0 + cosmo.Ogamma0 + cosmo.Onu0, 1.0, rtol=1e-6) assert np.allclose(cosmo.Om(1) + cosmo.Ode(1) + cosmo.Ogamma(1) + cosmo.Onu(1), 1.0, rtol=1e-6) assert np.allclose(cosmo.Tcmb0.value, 2.0) assert np.allclose(cosmo.Tnu0.value, 1.4275317, rtol=1e-5) assert np.allclose(cosmo.Neff, 3.04) assert np.allclose(cosmo.h, 0.7) assert np.allclose(cosmo.H0.value, 70.0) @pytest.mark.skipif('not HAS_SCIPY') def test_units(): """ Test if the right units are being returned""" cosmo = core.FlatLambdaCDM(H0=70, Om0=0.27, Tcmb0=2.0) assert cosmo.comoving_distance(1.0).unit == u.Mpc assert cosmo.angular_diameter_distance(1.0).unit == u.Mpc assert cosmo.angular_diameter_distance_z1z2(1.0, 2.0).unit == u.Mpc assert cosmo.comoving_distance(1.0).unit == u.Mpc assert cosmo.luminosity_distance(1.0).unit == u.Mpc assert cosmo.lookback_time(1.0).unit == u.Gyr assert cosmo.H0.unit == u.km / u.Mpc / u.s assert cosmo.H(1.0).unit == u.km / u.Mpc / u.s assert cosmo.Tcmb0.unit == u.K assert cosmo.Tcmb(1.0).unit == u.K assert cosmo.Tcmb([0.0, 1.0]).unit == u.K assert cosmo.Tnu0.unit == u.K assert cosmo.Tnu(1.0).unit == u.K assert cosmo.Tnu([0.0, 1.0]).unit == u.K assert cosmo.arcsec_per_kpc_comoving(1.0).unit == u.arcsec / u.kpc assert cosmo.arcsec_per_kpc_proper(1.0).unit == u.arcsec / u.kpc assert cosmo.kpc_comoving_per_arcmin(1.0).unit == u.kpc / u.arcmin assert cosmo.kpc_proper_per_arcmin(1.0).unit == u.kpc / u.arcmin assert cosmo.critical_density(1.0).unit == u.g / u.cm ** 3 assert cosmo.comoving_volume(1.0).unit == u.Mpc ** 3 assert cosmo.age(1.0).unit == u.Gyr assert cosmo.distmod(1.0).unit == u.mag def test_repr(): """ Test string representation of built in classes""" cosmo = core.LambdaCDM(70, 0.3, 0.5) expected = 'LambdaCDM(H0=70 km / (Mpc s), Om0=0.3, Ode0=0.5, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.LambdaCDM(70, 0.3, 0.5, m_nu=u.Quantity(0.01, u.eV)) expected = 'LambdaCDM(H0=70 km / (Mpc s), Om0=0.3, Ode0=0.5, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0.01 0.01 0.01] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.FlatLambdaCDM(50.0, 0.27) expected = 'FlatLambdaCDM(H0=50 km / (Mpc s), Om0=0.27, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.wCDM(60.0, 0.27, 0.6, w0=-0.8, name='test1') expected = 'wCDM(name="test1", H0=60 km / (Mpc s), Om0=0.27, Ode0=0.6, w0=-0.8, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.FlatwCDM(65.0, 0.27, w0=-0.6, name='test2') expected = 'FlatwCDM(name="test2", H0=65 km / (Mpc s), Om0=0.27, w0=-0.6, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.w0waCDM(60.0, 0.25, 0.4, w0=-0.6, wa=0.1, name='test3') expected = 'w0waCDM(name="test3", H0=60 km / (Mpc s), Om0=0.25, Ode0=0.4, w0=-0.6, wa=0.1, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.Flatw0waCDM(55.0, 0.35, w0=-0.9, wa=-0.2, name='test4') expected = 'Flatw0waCDM(name="test4", H0=55 km / (Mpc s), Om0=0.35, w0=-0.9, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.wpwaCDM(50.0, 0.3, 0.3, wp=-0.9, wa=-0.2, zp=0.3, name='test5') expected = 'wpwaCDM(name="test5", H0=50 km / (Mpc s), Om0=0.3, Ode0=0.3, wp=-0.9, wa=-0.2, zp=0.3, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV)' assert "{0:s}".format(cosmo) == expected cosmo = core.w0wzCDM(55.0, 0.4, 0.8, w0=-1.05, wz=-0.2, m_nu=u.Quantity([0.001, 0.01, 0.015], u.eV)) expected = 'w0wzCDM(H0=55 km / (Mpc s), Om0=0.4, Ode0=0.8, w0=-1.05, wz=-0.2 Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0.001 0.01 0.015] eV)' assert "{0:s}".format(cosmo) == expected @pytest.mark.skipif('not HAS_SCIPY') def test_flat_z1(): """ Test a flat cosmology at z=1 against several other on-line calculators. """ cosmo = core.FlatLambdaCDM(H0=70, Om0=0.27, Tcmb0=0.0) z = 1 # Test values were taken from the following web cosmology # calculators on 27th Feb 2012: # Wright: http://www.astro.ucla.edu/~wright/CosmoCalc.html # (http://adsabs.harvard.edu/abs/2006PASP..118.1711W) # Kempner: http://www.kempner.net/cosmic.php # iCosmos: http://www.icosmos.co.uk/index.html # The order of values below is Wright, Kempner, iCosmos' assert np.allclose(cosmo.comoving_distance(z).value, [3364.5, 3364.8, 3364.7988], rtol=1e-4) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1682.3, 1682.4, 1682.3994], rtol=1e-4) assert np.allclose(cosmo.luminosity_distance(z).value, [6729.2, 6729.6, 6729.5976], rtol=1e-4) assert np.allclose(cosmo.lookback_time(z).value, [7.841, 7.84178, 7.843], rtol=1e-3) # This class is to test whether the routines work correctly # if one only overloads w(z) class test_cos_sub(core.FLRW): def __init__(self): core.FLRW.__init__(self, 70.0, 0.27, 0.73, Tcmb0=0.0, name="test_cos") self._w0 = -0.9 def w(self, z): return self._w0 * np.ones_like(z) @pytest.mark.skipif('not HAS_SCIPY') def test_de_subclass(): # This is the comparison object z = [0.2, 0.4, 0.6, 0.9] cosmo = core.wCDM(H0=70, Om0=0.27, Ode0=0.73, w0=-0.9, Tcmb0=0.0) # Values taken from Ned Wrights advanced cosmo calcluator, Aug 17 2012 assert np.allclose(cosmo.luminosity_distance(z).value, [975.5, 2158.2, 3507.3, 5773.1], rtol=1e-3) # Now try the subclass that only gives w(z) cosmo = test_cos_sub() assert np.allclose(cosmo.luminosity_distance(z).value, [975.5, 2158.2, 3507.3, 5773.1], rtol=1e-3) # Test efunc assert np.allclose(cosmo.efunc(1.0), 1.7489240754, rtol=1e-5) assert np.allclose(cosmo.efunc([0.5, 1.0]), [1.31744953, 1.7489240754], rtol=1e-5) assert np.allclose(cosmo.inv_efunc([0.5, 1.0]), [0.75904236, 0.57178011], rtol=1e-5) # Test de_density_scale assert np.allclose(cosmo.de_density_scale(1.0), 1.23114444, rtol=1e-4) assert np.allclose(cosmo.de_density_scale([0.5, 1.0]), [1.12934694, 1.23114444], rtol=1e-4) @pytest.mark.skipif('not HAS_SCIPY') def test_varyde_lumdist_mathematica(): """Tests a few varying dark energy EOS models against a mathematica computation""" # w0wa models z = np.array([0.2, 0.4, 0.9, 1.2]) cosmo = core.w0waCDM(H0=70, Om0=0.2, Ode0=0.8, w0=-1.1, wa=0.2, Tcmb0=0.0) assert np.allclose(cosmo.luminosity_distance(z).value, [1004.0, 2268.62, 6265.76, 9061.84], rtol=1e-4) assert np.allclose(cosmo.de_density_scale(0.0), 1.0, rtol=1e-5) assert np.allclose(cosmo.de_density_scale([0.0, 0.5, 1.5]), [1.0, 0.9246310669529021, 0.9184087000251957]) cosmo = core.w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=0.0, Tcmb0=0.0) assert np.allclose(cosmo.luminosity_distance(z).value, [971.667, 2141.67, 5685.96, 8107.41], rtol=1e-4) cosmo = core.w0waCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wa=-0.5, Tcmb0=0.0) assert np.allclose(cosmo.luminosity_distance(z).value, [974.087, 2157.08, 5783.92, 8274.08], rtol=1e-4) # wpwa models cosmo = core.wpwaCDM(H0=70, Om0=0.2, Ode0=0.8, wp=-1.1, wa=0.2, zp=0.5, Tcmb0=0.0) assert np.allclose(cosmo.luminosity_distance(z).value, [1010.81, 2294.45, 6369.45, 9218.95], rtol=1e-4) cosmo = core.wpwaCDM(H0=70, Om0=0.2, Ode0=0.8, wp=-1.1, wa=0.2, zp=0.9, Tcmb0=0.0) assert np.allclose(cosmo.luminosity_distance(z).value, [1013.68, 2305.3, 6412.37, 9283.33], rtol=1e-4) @pytest.mark.skipif('not HAS_SCIPY') def test_omatter(): # Test Om evolution tcos = core.FlatLambdaCDM(70.0, 0.3) assert np.allclose(tcos.Om0, 0.3) assert np.allclose(tcos.H0.value, 70.0) assert np.allclose(tcos.Om(0), 0.3) z = np.array([0.0, 0.5, 1.0, 2.0]) assert np.allclose(tcos.Om(z), [0.3, 0.59112134, 0.77387435, 0.91974179], rtol=1e-4) @pytest.mark.skipif('not HAS_SCIPY') def test_ocurv(): # Test Ok evolution # Flat, boring case tcos = core.FlatLambdaCDM(70.0, 0.3) assert np.allclose(tcos.Ok0, 0.0) assert np.allclose(tcos.Ok(0), 0.0) z = np.array([0.0, 0.5, 1.0, 2.0]) assert np.allclose(tcos.Ok(z), [0.0, 0.0, 0.0, 0.0], rtol=1e-6) # Not flat tcos = core.LambdaCDM(70.0, 0.3, 0.5, Tcmb0=u.Quantity(0.0, u.K)) assert np.allclose(tcos.Ok0, 0.2) assert np.allclose(tcos.Ok(0), 0.2) assert np.allclose(tcos.Ok(z), [0.2, 0.22929936, 0.21621622, 0.17307692], rtol=1e-4) # Test the sum; note that Ogamma/Onu are 0 assert np.allclose(tcos.Ok(z) + tcos.Om(z) + tcos.Ode(z), [1.0, 1.0, 1.0, 1.0], rtol=1e-5) @pytest.mark.skipif('not HAS_SCIPY') def test_ode(): # Test Ode evolution, turn off neutrinos, cmb tcos = core.FlatLambdaCDM(70.0, 0.3, Tcmb0=0) assert np.allclose(tcos.Ode0, 0.7) assert np.allclose(tcos.Ode(0), 0.7) z = np.array([0.0, 0.5, 1.0, 2.0]) assert np.allclose(tcos.Ode(z), [0.7, 0.408759, 0.2258065, 0.07954545], rtol=1e-5) @pytest.mark.skipif('not HAS_SCIPY') def test_ogamma(): """Tests the effects of changing the temperature of the CMB""" # Tested against Ned Wright's advanced cosmology calculator, # Sep 7 2012. The accuracy of our comparision is limited by # how many digits it outputs, which limits our test to about # 0.2% accuracy. The NWACC does not allow one # to change the number of nuetrino species, fixing that at 3. # Also, inspection of the NWACC code shows it uses inaccurate # constants at the 0.2% level (specifically, a_B), # so we shouldn't expect to match it that well. The integral is # also done rather crudely. Therefore, we should not expect # the NWACC to be accurate to better than about 0.5%, which is # unfortunate, but reflects a problem with it rather than this code. # More accurate tests below using Mathematica z = np.array([1.0, 10.0, 500.0, 1000.0]) cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=0, Neff=3) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.9, 858.2, 26.855, 13.642], rtol=5e-4) cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=2.725, Neff=3) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.8, 857.9, 26.767, 13.582], rtol=5e-4) cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=4.0, Neff=3) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.4, 856.6, 26.489, 13.405], rtol=5e-4) # Next compare with doing the integral numerically in Mathematica, # which allows more precision in the test. It is at least as # good as 0.01%, possibly better cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=0, Neff=3.04) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.91, 858.205, 26.8586, 13.6469], rtol=1e-5) cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=2.725, Neff=3.04) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.76, 857.817, 26.7688, 13.5841], rtol=1e-5) cosmo = core.FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=4.0, Neff=3.04) assert np.allclose(cosmo.angular_diameter_distance(z).value, [1651.21, 856.411, 26.4845, 13.4028], rtol=1e-5) # Just to be really sure, we also do a version where the integral # is analytic, which is a Ode = 0 flat universe. In this case # Integrate(1/E(x),{x,0,z}) = 2 ( sqrt((1+Or z)/(1+z)) - 1 )/(Or - 1) # Recall that c/H0 * Integrate(1/E) is FLRW.comoving_distance. Ogamma0h2 = 4 * 5.670373e-8 / 299792458.0 ** 3 * 2.725 ** 4 / 1.87837e-26 Onu0h2 = Ogamma0h2 * 7.0 / 8.0 * (4.0 / 11.0) ** (4.0 / 3.0) * 3.04 Or0 = (Ogamma0h2 + Onu0h2) / 0.7 ** 2 Om0 = 1.0 - Or0 hubdis = 299792.458 / 70.0 cosmo = core.FlatLambdaCDM(H0=70, Om0=Om0, Tcmb0=2.725, Neff=3.04) targvals = 2.0 * hubdis * \ (np.sqrt((1.0 + Or0 * z) / (1.0 + z)) - 1.0) / (Or0 - 1.0) assert np.allclose(cosmo.comoving_distance(z).value, targvals, rtol=1e-5) # Try Tcmb0 = 4 Or0 *= (4.0 / 2.725) ** 4 Om0 = 1.0 - Or0 cosmo = core.FlatLambdaCDM(H0=70, Om0=Om0, Tcmb0=4.0, Neff=3.04) targvals = 2.0 * hubdis * \ (np.sqrt((1.0 + Or0 * z) / (1.0 + z)) - 1.0) / (Or0 - 1.0) assert np.allclose(cosmo.comoving_distance(z).value, targvals, rtol=1e-5) @pytest.mark.skipif('not HAS_SCIPY') def test_tcmb(): cosmo = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=3.0) assert np.allclose(cosmo.Tcmb0.value, 3.0) assert np.allclose(cosmo.Tcmb(2).value, 9.0) z = [0.0, 1.0, 2.0, 3.0, 9.0] assert np.allclose(cosmo.Tcmb(z).value, [3.0, 6.0, 9.0, 12.0, 30.0], rtol=1e-6) @pytest.mark.skipif('not HAS_SCIPY') def test_tnu(): cosmo = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=3.0) assert np.allclose(cosmo.Tnu0.value, 2.1412975665108247, rtol=1e-6) assert np.allclose(cosmo.Tnu(2).value, 6.423892699532474, rtol=1e-6) z = [0.0, 1.0, 2.0, 3.0] assert np.allclose(cosmo.Tnu(z), [2.14129757, 4.28259513, 6.4238927, 8.56519027], rtol=1e-6) def test_efunc_vs_invefunc(): # Test that efunc and inv_efunc give the same values z0 = 0.5 z = np.array([0.5, 1.0, 2.0, 5.0]) # Below are the 'standard' included cosmologies # We do the non-standard case in test_efunc_vs_invefunc_flrw, # since it requires scipy cosmo = core.LambdaCDM(70, 0.3, 0.5) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.LambdaCDM(70, 0.3, 0.5, m_nu=u.Quantity(0.01, u.eV)) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.FlatLambdaCDM(50.0, 0.27) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.wCDM(60.0, 0.27, 0.6, w0=-0.8) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.FlatwCDM(65.0, 0.27, w0=-0.6) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.w0waCDM(60.0, 0.25, 0.4, w0=-0.6, wa=0.1) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.Flatw0waCDM(55.0, 0.35, w0=-0.9, wa=-0.2) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.wpwaCDM(50.0, 0.3, 0.3, wp=-0.9, wa=-0.2, zp=0.3) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) cosmo = core.w0wzCDM(55.0, 0.4, 0.8, w0=-1.05, wz=-0.2) assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) @pytest.mark.skipif('not HAS_SCIPY') def test_efunc_vs_invefunc_flrw(): z0 = 0.5 z = np.array([0.5, 1.0, 2.0, 5.0]) # FLRW is abstract, so requires test_cos_sub defined earlier # This requires scipy, unlike the built-ins cosmo = test_cos_sub() assert np.allclose(cosmo.efunc(z0), 1.0 / cosmo.inv_efunc(z0)) assert np.allclose(cosmo.efunc(z), 1.0 / cosmo.inv_efunc(z)) @pytest.mark.skipif('not HAS_SCIPY') def test_kpc_methods(): cosmo = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) assert np.allclose(cosmo.arcsec_per_kpc_comoving(3).value, 0.0317179) assert np.allclose(cosmo.arcsec_per_kpc_proper(3).value, 0.1268716668) assert np.allclose(cosmo.kpc_comoving_per_arcmin(3).value, 1891.6753126) assert np.allclose(cosmo.kpc_proper_per_arcmin(3).value, 472.918828) @pytest.mark.skipif('not HAS_SCIPY') def test_convenience(): # these are all for WMAP7 with Tcmb = 0 tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) core.set_current(tcos) # scalars assert np.allclose(funcs.arcsec_per_kpc_comoving(3).value, 0.0317179) assert funcs.arcsec_per_kpc_comoving(3).unit == u.arcsec / u.kpc assert np.allclose(funcs.arcsec_per_kpc_proper(3).value, 0.1268716668) assert funcs.arcsec_per_kpc_proper(3).unit == u.arcsec / u.kpc assert np.allclose(funcs.kpc_comoving_per_arcmin(3).value, 1891.6753126) assert funcs.kpc_comoving_per_arcmin(3).unit == u.kpc / u.arcmin assert np.allclose(funcs.kpc_proper_per_arcmin(3).value, 472.918828) assert funcs.kpc_proper_per_arcmin(3).unit == u.kpc / u.arcmin assert np.allclose(funcs.distmod(3).value, 47.075902) assert funcs.distmod(3).unit == u.mag assert np.allclose(funcs.H(3).value, 299.80813491298068) assert funcs.H(3).unit == u.km / (u.Mpc * u.s) assert np.allclose(funcs.scale_factor(3), 0.25) assert np.allclose(funcs.scale_factor([3, 4]), [0.25, 0.2]) assert np.allclose(funcs.critical_density(3).value, 1.6884621680232328e-28) assert funcs.critical_density(3).unit == u.g / u.cm ** 3 assert np.allclose(funcs.lookback_time(3).value, 11.555469926558361) assert funcs.lookback_time(3).unit == u.Gyr assert np.allclose(funcs.lookback_time([3, 4]).value, [11.555469927, 12.17718555], rtol=1e-5) assert np.allclose(funcs.comoving_distance(3).value, 6503.100697385924) assert funcs.comoving_distance(3).unit == u.Mpc assert np.allclose(funcs.angular_diameter_distance(3).value, 1625.775174346481) assert funcs.angular_diameter_distance(3).unit == u.Mpc assert np.allclose(funcs.luminosity_distance(3).value, 26012.402789543696) assert funcs.luminosity_distance(3).unit == u.Mpc # arrays assert np.allclose(funcs.arcsec_per_kpc_comoving([0.1, 0.5]).value, [0.4946986, 0.10876163]) assert np.allclose(funcs.arcsec_per_kpc_proper([0.1, 0.5]).value, [0.54416846354697479, 0.16314245192751084]) assert np.allclose(funcs.kpc_comoving_per_arcmin([0.1, 0.5]).value, [121.2859701, 551.66511804]) assert np.allclose(funcs.kpc_proper_per_arcmin([0.1, 0.5]).value, [110.25997282, 367.77674536]) assert np.allclose(funcs.distmod([0.1, 0.5]).value, [38.30738567, 42.27020333]) @pytest.mark.skipif('not HAS_SCIPY') def test_comoving_volume(): c_flat = core.LambdaCDM(H0=70, Om0=0.27, Ode0=0.73, Tcmb0=0.0) c_open = core.LambdaCDM(H0=70, Om0=0.27, Ode0=0.0, Tcmb0=0.0) c_closed = core.LambdaCDM(H0=70, Om0=2, Ode0=0.0, Tcmb0=0.0) # test against ned wright's calculator (cubic Gpc) redshifts = np.array([0.5, 1, 2, 3, 5, 9]) wright_flat = np.array([29.123, 159.529, 630.427, 1178.531, 2181.485, 3654.802]) * 1e9 # convert to Mpc**3 wright_open = np.array([20.501, 99.019, 380.278, 747.049, 1558.363, 3123.814]) * 1e9 wright_closed = np.array([12.619, 44.708, 114.904, 173.709, 258.82, 358.992]) * 1e9 # The wright calculator isn't very accurate, so we use a rather # modest precision assert np.allclose(c_flat.comoving_volume(redshifts).value, wright_flat, rtol=1e-2) assert np.allclose(c_open.comoving_volume(redshifts).value, wright_open, rtol=1e-2) assert np.allclose(c_closed.comoving_volume(redshifts).value, wright_closed, rtol=1e-2) @pytest.mark.skipif('not HAS_SCIPY') def test_flat_open_closed_icosmo(): """ Test against the tabulated values generated from icosmo.org with three example cosmologies (flat, open and closed). """ cosmo_flat = """\ # from icosmo (icosmo.org) # Om 0.3 w -1 h 0.7 Ol 0.7 # z comoving_transvers_dist angular_diameter_dist luminosity_dist 0.0000000 0.0000000 0.0000000 0.0000000 0.16250000 669.77536 576.15085 778.61386 0.32500000 1285.5964 970.26143 1703.4152 0.50000000 1888.6254 1259.0836 2832.9381 0.66250000 2395.5489 1440.9317 3982.6000 0.82500000 2855.5732 1564.6976 5211.4210 1.0000000 3303.8288 1651.9144 6607.6577 1.1625000 3681.1867 1702.2829 7960.5663 1.3250000 4025.5229 1731.4077 9359.3408 1.5000000 4363.8558 1745.5423 10909.640 1.6625000 4651.4830 1747.0359 12384.573 1.8250000 4916.5970 1740.3883 13889.387 2.0000000 5179.8621 1726.6207 15539.586 2.1625000 5406.0204 1709.4136 17096.540 2.3250000 5616.5075 1689.1752 18674.888 2.5000000 5827.5418 1665.0120 20396.396 2.6625000 6010.4886 1641.0890 22013.414 2.8250000 6182.1688 1616.2533 23646.796 3.0000000 6355.6855 1588.9214 25422.742 3.1625000 6507.2491 1563.3031 27086.425 3.3250000 6650.4520 1537.6768 28763.205 3.5000000 6796.1499 1510.2555 30582.674 3.6625000 6924.2096 1485.0852 32284.127 3.8250000 7045.8876 1460.2876 33996.408 4.0000000 7170.3664 1434.0733 35851.832 4.1625000 7280.3423 1410.2358 37584.767 4.3250000 7385.3277 1386.9160 39326.870 4.5000000 7493.2222 1362.4040 41212.722 4.6625000 7588.9589 1340.2135 42972.480 """ cosmo_open = """\ # from icosmo (icosmo.org) # Om 0.3 w -1 h 0.7 Ol 0.1 # z comoving_transvers_dist angular_diameter_dist luminosity_dist 0.0000000 0.0000000 0.0000000 0.0000000 0.16250000 643.08185 553.18868 747.58265 0.32500000 1200.9858 906.40441 1591.3062 0.50000000 1731.6262 1154.4175 2597.4393 0.66250000 2174.3252 1307.8648 3614.8157 0.82500000 2578.7616 1413.0201 4706.2399 1.0000000 2979.3460 1489.6730 5958.6920 1.1625000 3324.2002 1537.2024 7188.5829 1.3250000 3646.8432 1568.5347 8478.9104 1.5000000 3972.8407 1589.1363 9932.1017 1.6625000 4258.1131 1599.2913 11337.226 1.8250000 4528.5346 1603.0211 12793.110 2.0000000 4804.9314 1601.6438 14414.794 2.1625000 5049.2007 1596.5852 15968.097 2.3250000 5282.6693 1588.7727 17564.875 2.5000000 5523.0914 1578.0261 19330.820 2.6625000 5736.9813 1566.4113 21011.694 2.8250000 5942.5803 1553.6158 22730.370 3.0000000 6155.4289 1538.8572 24621.716 3.1625000 6345.6997 1524.4924 26413.975 3.3250000 6529.3655 1509.6799 28239.506 3.5000000 6720.2676 1493.3928 30241.204 3.6625000 6891.5474 1478.0799 32131.840 3.8250000 7057.4213 1462.6780 34052.058 4.0000000 7230.3723 1446.0745 36151.862 4.1625000 7385.9998 1430.7021 38130.224 4.3250000 7537.1112 1415.4199 40135.117 4.5000000 7695.0718 1399.1040 42322.895 4.6625000 7837.5510 1384.1150 44380.133 """ cosmo_closed = """\ # from icosmo (icosmo.org) # Om 2 w -1 h 0.7 Ol 0.1 # z comoving_transvers_dist angular_diameter_dist luminosity_dist 0.0000000 0.0000000 0.0000000 0.0000000 0.16250000 601.80160 517.67879 699.59436 0.32500000 1057.9502 798.45297 1401.7840 0.50000000 1438.2161 958.81076 2157.3242 0.66250000 1718.6778 1033.7912 2857.3019 0.82500000 1948.2400 1067.5288 3555.5381 1.0000000 2152.7954 1076.3977 4305.5908 1.1625000 2312.3427 1069.2914 5000.4410 1.3250000 2448.9755 1053.3228 5693.8681 1.5000000 2575.6795 1030.2718 6439.1988 1.6625000 2677.9671 1005.8092 7130.0873 1.8250000 2768.1157 979.86398 7819.9270 2.0000000 2853.9222 951.30739 8561.7665 2.1625000 2924.8116 924.84161 9249.7167 2.3250000 2988.5333 898.80701 9936.8732 2.5000000 3050.3065 871.51614 10676.073 2.6625000 3102.1909 847.01459 11361.774 2.8250000 3149.5043 823.39982 12046.854 3.0000000 3195.9966 798.99915 12783.986 3.1625000 3235.5334 777.30533 13467.908 3.3250000 3271.9832 756.52790 14151.327 3.5000000 3308.1758 735.15017 14886.791 3.6625000 3339.2521 716.19347 15569.263 3.8250000 3368.1489 698.06195 16251.319 4.0000000 3397.0803 679.41605 16985.401 4.1625000 3422.1142 662.87926 17666.664 4.3250000 3445.5542 647.05243 18347.576 4.5000000 3469.1805 630.76008 19080.493 4.6625000 3489.7534 616.29199 19760.729 """ redshifts, dm, da, dl = np.loadtxt(StringIO(cosmo_flat), unpack=1) cosmo = core.LambdaCDM(H0=70, Om0=0.3, Ode0=0.70, Tcmb0=0.0) assert np.allclose(cosmo.comoving_transverse_distance(redshifts).value, dm) assert np.allclose(cosmo.angular_diameter_distance(redshifts).value, da) assert np.allclose(cosmo.luminosity_distance(redshifts).value, dl) redshifts, dm, da, dl = np.loadtxt(StringIO(cosmo_open), unpack=1) cosmo = core.LambdaCDM(H0=70, Om0=0.3, Ode0=0.1, Tcmb0=0.0) assert np.allclose(cosmo.comoving_transverse_distance(redshifts).value, dm) assert np.allclose(cosmo.angular_diameter_distance(redshifts).value, da) assert np.allclose(cosmo.luminosity_distance(redshifts).value, dl) redshifts, dm, da, dl = np.loadtxt(StringIO(cosmo_closed), unpack=1) cosmo = core.LambdaCDM(H0=70, Om0=2, Ode0=0.1, Tcmb0=0.0) assert np.allclose(cosmo.comoving_transverse_distance(redshifts).value, dm) assert np.allclose(cosmo.angular_diameter_distance(redshifts).value, da) assert np.allclose(cosmo.luminosity_distance(redshifts).value, dl) def test_current(): core.set_current('WMAP7') cosmo = core.get_current() assert cosmo == core.WMAP7 core.set_current('WMAP5') assert core.get_current() == core.WMAP5 core.set_current('WMAP9') assert core.get_current() == core.WMAP9 core.set_current('Planck13') assert core.get_current() == core.Planck13 core.set_current(cosmo) assert core.get_current() == cosmo def test_wz(): cosmo = core.LambdaCDM(H0=70, Om0=0.3, Ode0=0.70) assert np.allclose(cosmo.w([0.1, 0.2, 0.5, 1.5, 2.5, 11.5]), [-1., -1, -1, -1, -1, -1]) cosmo = core.wCDM(H0=70, Om0=0.3, Ode0=0.70, w0=-0.5) assert np.allclose(cosmo.w([0.1, 0.2, 0.5, 1.5, 2.5, 11.5]), [-0.5, -0.5, -0.5, -0.5, -0.5, -0.5]) cosmo = core.w0wzCDM(H0=70, Om0=0.3, Ode0=0.70, w0=-1, wz=0.5) assert np.allclose(cosmo.w([0.0, 0.5, 1.0, 1.5, 2.3]), [-1.0, -0.75, -0.5, -0.25, 0.15]) cosmo = core.w0waCDM(H0=70, Om0=0.3, Ode0=0.70, w0=-1, wa=-0.5) assert np.allclose(cosmo.w([0.0, 0.5, 1.0, 1.5, 2.3]), [-1, -1.16666667, -1.25, -1.3, -1.34848485]) cosmo = core.wpwaCDM(H0=70, Om0=0.3, Ode0=0.70, wp=-0.9, wa=0.2, zp=0.5) assert np.allclose(cosmo.w([0.1, 0.2, 0.5, 1.5, 2.5, 11.5]), [-0.94848485, -0.93333333, -0.9, -0.84666667, -0.82380952, -0.78266667]) @pytest.mark.skipif('not HAS_SCIPY') def test_de_densityscale(): cosmo = core.LambdaCDM(H0=70, Om0=0.3, Ode0=0.70) z = np.array([0.1, 0.2, 0.5, 1.5, 2.5]) assert np.allclose(cosmo.de_density_scale(z), [1.0, 1.0, 1.0, 1.0, 1.0]) cosmo = core.wCDM(H0=70, Om0=0.3, Ode0=0.60, w0=-0.5) assert np.allclose(cosmo.de_density_scale(z), [1.15369, 1.31453, 1.83712, 3.95285, 6.5479], rtol=1e-4) cosmo = core.w0wzCDM(H0=70, Om0=0.3, Ode0=0.50, w0=-1, wz=0.5) assert np.allclose(cosmo.de_density_scale(z), [0.746048, 0.5635595, 0.25712378, 0.026664129, 0.0035916468], rtol=1e-4) cosmo = core.w0waCDM(H0=70, Om0=0.3, Ode0=0.70, w0=-1, wa=-0.5) assert np.allclose(cosmo.de_density_scale(z), [0.9934201, 0.9767912, 0.897450, 0.622236, 0.4458753], rtol=1e-4) cosmo = core.wpwaCDM(H0=70, Om0=0.3, Ode0=0.70, wp=-0.9, wa=0.2, zp=0.5) assert np.allclose(cosmo.de_density_scale(z), [1.012246048, 1.0280102, 1.087439, 1.324988, 1.565746], rtol=1e-4) @pytest.mark.skipif('not HAS_SCIPY') def test_age(): # WMAP7 but with Omega_relativisitic = 0 tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) assert np.allclose(tcos.age([1, 5]).value, [5.97113193, 1.20553129]) @pytest.mark.skipif('not HAS_SCIPY') def test_distmod(): # WMAP7 but with Omega_relativisitic = 0 tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) core.set_current(tcos) assert np.allclose(tcos.distmod([1, 5]).value, [44.124857, 48.40167258]) assert np.allclose(funcs.distmod([1, 5], cosmo=tcos).value, [44.124857, 48.40167258]) @pytest.mark.skipif('not HAS_SCIPY') def test_critical_density(): # WMAP7 but with Omega_relativisitic = 0 tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) assert np.allclose(tcos.critical_density([1, 5]).value, [2.70362491e-29, 5.53758986e-28]) @pytest.mark.skipif('not HAS_SCIPY') def test_angular_diameter_distance_z1z2(): tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) assert np.allclose(tcos.angular_diameter_distance_z1z2(1, 2).value, 646.22968662822018) z1 = 0, 0, 1, 0.5, 1 z2 = 2, 1, 2, 2.5, 1.1 results = (1760.0628637762106, 1670.7497657219858, 646.22968662822018, 1159.0970895962193, 115.72768186186921) assert np.allclose(tcos.angular_diameter_distance_z1z2(z1, z2).value, results) @pytest.mark.skipif('not HAS_SCIPY') def test_absorption_distance(): tcos = core.FlatLambdaCDM(70.4, 0.272, Tcmb0=0.0) assert np.allclose(tcos.absorption_distance([1, 3]), [1.72576635, 7.98685853]) assert np.allclose(tcos.absorption_distance(3), 7.98685853) @pytest.mark.skipif('not HAS_SCIPY') def test_massivenu_basic(): # Test no neutrinos case tcos = core.FlatLambdaCDM(70.4, 0.272, Neff=4.05, m_nu=u.Quantity(0, u.eV)) assert np.allclose(tcos.Neff, 4.05) assert not tcos.has_massive_nu mnu = tcos.m_nu assert len(mnu) == 4 assert mnu.unit == u.eV assert np.allclose(mnu.value, [0.0, 0.0, 0.0, 0.0]) assert np.allclose(tcos.nu_relative_density(1.0), 0.22710731766 * 4.05, rtol=1e-6) # Test basic setting, retrieval of values tcos = core.FlatLambdaCDM(70.4, 0.272, m_nu=u.Quantity([0.0, 0.01, 0.02], u.eV)) assert tcos.has_massive_nu mnu = tcos.m_nu assert len(mnu) == 3 assert mnu.unit == u.eV assert np.allclose(mnu.value, [0.0, 0.01, 0.02]) # All massive neutrinos case tcos = core.FlatLambdaCDM(70.4, 0.272, m_nu=u.Quantity(0.1, u.eV), Neff=3.1) assert np.allclose(tcos.Neff, 3.1) assert tcos.has_massive_nu mnu = tcos.m_nu assert len(mnu) == 3 assert mnu.unit == u.eV assert np.allclose(mnu.value, [0.1, 0.1, 0.1]) @pytest.mark.skipif('not HAS_SCIPY') def test_massivenu_density(): # Testing neutrino density calculation # Simple test cosmology, where we compare rho_nu and rho_gamma # against the exact formula (eq 24/25 of Komatsu et al. 2011) # computed using Mathematica. The approximation we use for f(y) # is only good to ~ 0.5% (with some redshift dependence), so that's # what we test to. ztest = np.array([0.0, 1.0, 2.0, 10.0, 1000.0]) nuprefac = 7.0 / 8.0 * (4.0 / 11.0) ** (4.0 / 3.0) # First try 3 massive neutrinos, all 100 eV -- note this is a universe # seriously dominated by neutrinos! tcos = core.FlatLambdaCDM(75.0, 0.25, Tcmb0=3.0, Neff=3, m_nu=u.Quantity(100.0, u.eV)) assert tcos.has_massive_nu assert tcos.Neff == 3 nurel_exp = nuprefac * tcos.Neff * np.array([171969, 85984.5, 57323, 15633.5, 171.801]) assert np.allclose(tcos.nu_relative_density(ztest), nurel_exp, rtol=5e-3) assert np.allclose(tcos.efunc([0.0, 1.0]), [1.0, 7.46144727668], rtol=5e-3) # Next, slightly less massive tcos = core.FlatLambdaCDM(75.0, 0.25, Tcmb0=3.0, Neff=3, m_nu=u.Quantity(0.25, u.eV)) nurel_exp = nuprefac * tcos.Neff * np.array([429.924, 214.964, 143.312, 39.1005, 1.11086]) assert np.allclose(tcos.nu_relative_density(ztest), nurel_exp, rtol=5e-3) # For this one also test Onu directly onu_exp = np.array([0.01890217, 0.05244681, 0.0638236, 0.06999286, 0.1344951]) assert np.allclose(tcos.Onu(ztest), onu_exp, rtol=5e-3) # And fairly light tcos = core.FlatLambdaCDM(80.0, 0.30, Tcmb0=3.0, Neff=3, m_nu=u.Quantity(0.01, u.eV)) nurel_exp = nuprefac * tcos.Neff * np.array([17.2347, 8.67345, 5.84348, 1.90671, 1.00021]) assert np.allclose(tcos.nu_relative_density(ztest), nurel_exp, rtol=5e-3) onu_exp = np.array([0.00066599, 0.00172677, 0.0020732, 0.00268404, 0.0978313]) assert np.allclose(tcos.Onu(ztest), onu_exp, rtol=5e-3) assert np.allclose(tcos.efunc([1.0, 2.0]), [1.76225893, 2.97022048], rtol=1e-4) assert np.allclose(tcos.inv_efunc([1.0, 2.0]), [0.5674535, 0.33667534], rtol=1e-4) # Now a mixture of neutrino masses, with non-integer Neff tcos = core.FlatLambdaCDM(80.0, 0.30, Tcmb0=3.0, Neff=3.04, m_nu=u.Quantity([0.0, 0.01, 0.25], u.eV)) nurel_exp = nuprefac * tcos.Neff * np.array([149.386233, 74.87915, 50.0518, 14.002403, 1.03702333]) assert np.allclose(tcos.nu_relative_density(ztest), nurel_exp, rtol=5e-3) onu_exp = np.array([0.00584959, 0.01493142, 0.01772291, 0.01963451, 0.10227728]) assert np.allclose(tcos.Onu(ztest), onu_exp, rtol=5e-3) def test_default_reset(): # Check that the default is being reset after tests. This test should be # updated if the default cosmology is updated. assert core.get_current() == core.WMAP9 astropy-0.3/astropy/cosmology/__init__.py0000644000175000017500000000057112243255342017027 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ astropy.cosmology contains classes and functions for cosmological distance measures and other cosmology-related calculations. See the `Astropy documentation `_ for more detailed usage examples and references. """ from core import * from funcs import * astropy-0.3/astropy/cosmology/funcs.py0000644000175000017500000001307112243255342016405 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Convenience functions for `astropy.cosmology`. """ from .core import get_current as _get_current def kpc_comoving_per_arcmin(z, cosmo=None): """ Separation in transverse comoving kpc corresponding to an arcminute at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity The distance in comoving kpc corresponding to an arcmin at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.kpc_comoving_per_arcmin(z) def kpc_proper_per_arcmin(z, cosmo=None): """ Separation in transverse proper kpc corresponding to an arcminute at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- d : astropy.units.Quantity The distance in proper kpc corresponding to an arcmin at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.kpc_proper_per_arcmin(z) def arcsec_per_kpc_comoving(z, cosmo=None): """ Angular separation in arcsec corresponding to a comoving kpc at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- theta : astropy.units.Quantity The angular separation in arcsec corresponding to a comoving kpc at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.arcsec_per_kpc_comoving(z) def arcsec_per_kpc_proper(z, cosmo=None): """ Angular separation in arcsec corresponding to a proper kpc at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- theta : astropy.units.Quantity The angular separation in arcsec corresponding to a proper kpc at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.arcsec_per_kpc_proper(z) def distmod(z, cosmo=None): """ Distance modulus at redshift `z`. The distance modulus is defined as the (apparent magnitude - absolute magnitude) for an object at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- distmod : astropy.units.Quantity Distance modulus at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.distmod(z) def H(z, cosmo=None): """ Hubble parameter (km/s/Mpc) at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- H : astropy.units.Quantity Hubble parameter at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.H(z) def scale_factor(z, cosmo=None): """ Scale factor at redshift `z`. The scale factor is defined as `a = 1 / (1 + z)`. Parameters ---------- z : array_like Input redshifts. Returns ------- scalefac : ndarray, or float if input scalar Scale factor at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.scale_factor(z) def critical_density(z, cosmo=None): """ Critical density in grams per cubic cm at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- critdens : astropy.units.Quantity Critical density at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.critical_density(z) def lookback_time(z, cosmo=None): """ Lookback time in Gyr to redshift `z`. The lookback time is the difference between the age of the Universe now and the age at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- t : astropy.units.Quantity Lookback time at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.lookback_time(z) def comoving_distance(z, cosmo=None): """ Comoving distance in Mpc at redshift `z`. The comoving distance along the line-of-sight between two objects remains constant with time for objects in the Hubble flow. Parameters ---------- z : array_like Input redshifts. Returns ------- codist : astropy.units.Quantity Comoving distance at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.comoving_distance(z) def angular_diameter_distance(z, cosmo=None): """ Angular diameter distance in Mpc at a given redshift. This gives the proper (sometimes called 'physical') transverse distance corresponding to an angle of 1 radian for an object at redshift `z`. Parameters ---------- z : array_like Input redshifts. Returns ------- angdist : astropy.units.Quantity Angular diameter distance at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.angular_diameter_distance(z) def luminosity_distance(z, cosmo=None): """ Luminosity distance in Mpc at redshift `z`. This is the distance to use when converting between the bolometric flux from an object at redshift `z` and its bolometric luminosity. Parameters ---------- z : array_like Input redshifts. Returns ------- lumdist : astropy.units.Quantity Angular diameter distance at each input redshift. """ if cosmo is None: cosmo = _get_current() return cosmo.luminosity_distance(z) astropy-0.3/astropy/cosmology/parameters.py0000644000175000017500000000653112243255342017435 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains dictionaries with sets of parameters for a given cosmology. Each cosmology has the following parameters defined: ========== ===================================== Oc0 Omega cold dark matter at z=0 Ob0 Omega baryon at z=0 Om0 Omega matter at z=0 flat Is this assumed flat? If not, Ode0 must be specifiec Ode0 Omega dark energy at z=0 if flat is False H0 Hubble parameter at z=0 in km/s/Mpc n Density perturbation spectral index Tcmb0 Current temperature of the CMB Neff Effective number of neutrino species sigma8 Density perturbation amplitude tau Ionisation optical depth z_reion Redshift of hydrogen reionisation t0 Age of the universe in Gyr reference Reference for the parameters ========== ===================================== The list of cosmologies available are given by the tuple `available`. Current cosmologies available: Planck13 parameters from Planck Collaboration 2013, arXiv:1303.5076 (Paper XVI), Table 5 (Planck + WP + highL + BAO) WMAP 9 year parameters from Hinshaw et al. 2013, ApJS, 208, 19, doi: 10.1088/0067-0049/208/2/19. Table 4 (WMAP9 + eCMB + BAO + H0) WMAP 7 year parameters from Komatsu et al. 2011, ApJS, 192, 18, doi: 10.1088/0067-0049/192/2/18. Table 1 (WMAP + BAO + H0 ML). WMAP 5 year parameters from Komatsu et al. 2009, ApJS, 180, 330, doi: 10.1088/0067-0049/180/2/330. Table 1 (WMAP + BAO + SN ML). """ # Note: if you add a new cosmology, please also update the table # in the 'Built-in Cosmologies' section of astropy/docs/cosmology/index.rst # in addition to the list above. # Ade et al. Planck 2013 paper XVI Table 5 penultimate column (best fit) Planck13 = dict( Oc0=0.25886, Ob0=0.048252, Om0=0.30712, H0=67.77, n=0.9611, sigma8=0.8288, tau=0.0952, z_reion=11.52, t0=13.7965, Tcmb0=2.7255, Neff=3.046, flat=True, m_nu=[0., 0., 0.06], reference=("Planck Collaboration 2013, Paper XVI, arXiv:1303.5076" " Table 5 (Planck + WP + highL + BAO)") ) WMAP9 = dict( Oc0=0.2402, Ob0=0.04628, Om0=0.2865, H0=69.32, n=0.9608, sigma8=0.820, tau=0.081, z_reion=10.1, t0=13.772, Tcmb0=2.725, Neff=3.04, m_nu=0.0, flat=True, reference=("Hinshaw et al. 2013, ApJS, 208, 19, " "doi: 10.1088/0067-0049/208/2/19. " "Table 4 (WMAP9 + eCMB + BAO + H0, last column)") ) WMAP7 = dict( Oc0=0.226, Ob0=0.0455, Om0=0.272, H0=70.4, n=0.967, sigma8=0.810, tau=0.085, z_reion=10.3, t0=13.76, Tcmb0=2.725, Neff=3.04, m_nu=0.0, flat=True, reference=("Komatsu et al. 2011, ApJS, 192, 18, " "doi: 10.1088/0067-0049/192/2/18. " "Table 1 (WMAP + BAO + H0 ML).") ) WMAP5 = dict( Oc0=0.231, Ob0=0.0459, Om0=0.277, H0=70.2, n=0.962, sigma8=0.817, tau=0.088, z_reion=11.3, t0=13.72, Tcmb0=2.725, Neff=3.04, m_nu=0.0, flat=True, reference=("Komatsu et al. 2009, ApJS, 180, 330, " "doi: 10.1088/0067-0049/180/2/330. " "Table 1 (WMAP + BAO + SN ML).") ) available = tuple(k for k in locals() if not k.startswith('_')) astropy-0.3/astropy/sphinx/0000755000175000017500000000000012243263747014221 5ustar oleoleastropy-0.3/astropy/sphinx/themes/0000755000175000017500000000000012243263747015506 5ustar oleoleastropy-0.3/astropy/sphinx/themes/bootstrap-astropy/0000755000175000017500000000000012243263747021222 5ustar oleoleastropy-0.3/astropy/sphinx/themes/bootstrap-astropy/localtoc.html0000644000175000017500000000004212243255342023674 0ustar oleole

Page Contents

{{ toc }} astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/theme.conf0000644000175000017500000000030012243255342023154 0ustar oleole# AstroPy theme based on Twitter Bootstrap CSS [theme] inherit = basic stylesheet = bootstrap-astropy.css pygments_style = sphinx [options] logotext1 = astro logotext2 = py logotext3 = :docs astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/layout.html0000644000175000017500000000635712243255342023430 0ustar oleole{% extends "basic/layout.html" %} {# Collapsible sidebar script from default/layout.html in Sphinx #} {% set script_files = script_files + ['_static/sidebar.js'] %} {# Add the google webfonts needed for the logo #} {% block extrahead %} {% endblock %} {% block header %}
{{ theme_logotext1 }}{{ theme_logotext2 }}{{ theme_logotext3 }}
  • Index
  • Modules
  • {% block sidebarsearch %} {% include "searchbox.html" %} {% endblock %}
{% endblock %} {% block relbar1 %} {% endblock %} {# Silence the bottom relbar. #} {% block relbar2 %}{% endblock %} {%- block footer %}

{%- if edit_on_github %} {{ edit_on_github_page_message }}   {%- endif %} {%- if show_source and has_source and sourcename %} {{ _('Page Source') }} {%- endif %}   Back to Top

{%- if show_copyright %} {%- if hasdoc('copyright') %} {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
{%- else %} {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
{%- endif %} {%- endif %} {%- if show_sphinx %} {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}   {%- endif %} {%- if last_updated %} {% trans last_updated=last_updated|e %}Last built {{ last_updated }}.{% endtrans %}
{%- endif %}

{%- endblock %} astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/static/0000755000175000017500000000000012243263747022511 5ustar oleoleastropy-0.3/astropy/sphinx/themes/bootstrap-astropy/static/astropy_logo_32.png0000644000175000017500000000353412243255342026241 0ustar oleole‰PNG  IHDR szzôsBIT|dˆ pHYsÓÇòŽtEXtSoftwarewww.inkscape.org›î<ÙIDATX…Å—PT×Ç?÷ñc‘P° ˆ „FƒUBìȘ&Ådi”I# ±ÒÄJhC2æÇŒ5ÑÔtw:íÛª5ÑÒSÒÆª©é„Ú¡%¨ZÉF2Vk­JFŒ`ÁŠ(JdÙ÷öÝþqaß., É?½3gæ½sÏïýžûΞº®óÿ\Ñ_ÄÉ•ìÎ#šÅHŠl ø2pèZ€Ý8ØãéÔ¯KL”Wš;†AC°È‹h4¥z>ÕÀ$?ñôé—#¹hJ~‹»œ›´`;&y˜#D²ËÂß b0¨Â¤Åu‹»2RìqKàJr'âã7˜<6.´;`Îã2Ò‹@‹†Ž&°Ìa‹$`›+Æâ1ôWB]Ç, w.rÆM¶|»r€Þh?G6B—m"ù‘GêÕïKàƒ…“œ0º#Ñ&¢: WBÅaˆË°mL6¸pÏ€+àΔƒx¥Áti@D1Çä;«áz§ v³ú7zCýrׇóE9ÎÐäš ‹,“é_Gÿ±hbÞˆy•ˆ;¾Ñ Ðñ!,e÷ÙUÄ—¦AÚlˆO†„©ˆ€-^;V€¬…~ï;MçÅðKxUZùK%:Lü剜"¸ë9äžáT½rÝë†3WCúWaá8úè9ô³`p4XW·;KšxBjó«ËwÙÉ¥„Ö÷á“ýÐÚׇ.WêLDå_e5Êw`ÎDîzFíG;ßz9ì¾?@ÈghI^Ž ÄâUˆ¥›Ô³áƒÆMÈl…+çíãÇÄs%bñZˆK„»Ÿ‚Ão@ûÅ`ó!8¹ò—À¬o‚)Ô!ÔÊpu¹4W›;Uü0ˆ0×i'÷Ý@V— ë\Ð}>üÖßôÁž Èu Àôƒˆï¾ ¦übdëÇ‘‰Yáþ>rµ¡z—c0iØI,\1D‹‰ÜX §)‡Ìùׇˆ×üˆ__…Šm cáB3ì߬|f̃¹ÙI.œ²KŸ;ò“NÖ¤AqÐ!~*Üùr8Þg)ã¬BÄß…¬;!*â'#î©DÔôÁürdÓN;Ql’ à|(€Ùá Xôj®€[Ã`aPy÷ã* ÷ר—¦Ô¥h¹bâO½¶Î 9el¢­ïë 0HÆi¦a29HáReÜÝ 5*Ã@ä)}豄 ¢cU5ö»aÙIr mý0›Jú€nARÂPÊør‡j­&5â“+Þðçõ£AL:éµKðAƒÍ\îÿ´ž eà'_Œ໩âlg'ò›Èm/!7|ü¾p7z‘¯T@ß5å—0 KÕÞ¹Àg†öƒ ú@/fHN|ׯ@b bÁÃÈú8X‹lü,yf} ºÚ ®ú•ˆU; )U1·o»bSµ j€~Ú¦‚aS2!&A”8¼/‡‚û ¿Ž7ªhu¯Ž.@ùó0¿D=¿_oo nIøý/© Ió”è70è¦FÞ§¬&%ÀýÁ¶,Ô*}t â—ƒ{Ë#ÿ$'Ï@ütbÅËʾç?ÈuO„Ú j&Á¡DèºÎK î-T㎉E4| )épá,ò;·Ûí³ôˆµ¿…¨!ÊÎ7ÿ¼Èö3ˆiÙ0ý6X°“Ô¾¹ò8önðôB°ÚSjOEÑšÅNi 0ýÈÚ-ˆg<0c&”T@Ãe]· ùßKˆ» .²ó ;©Þzäæç¡³-Tû³™R[åt:iºÝy±è„·‹,, å4âÑçÝEBÛY8{Z5˜öðîFô÷A¬¦¤ƒÐK]àä?‘úÓð»upíjèLñ©,ñ<«÷…" ^?aReÁ ÀAO/¬YŽØü–±áHKCî}K7ÿÙ¼V='N†´ èhß@$.:4Á}žr½säFp"jÊw^ùÆqo?%Š…føä$¢äâþ2HÍ€÷€°O6àƒžËà75E)iנس\o™FÌ„ë*õj¬þ”î{YU†¬¢üI´¿…ܹ㠦!bò¦¦Qà©Ð[Ç¢&âX¾¶Æ])àWHTÿ]º í…ŸAÖ­Ê`Їu×W ëâXq;¤dÍúgõÚ± "20¼Ö¯Ð·k·að:µobÝ3¹u‹2pÄ!}rô¸nÒ,TjÝäN$9Là¿¡k“{rÀâAMP*a¦Öri.©išÜ[ï—ËÊÎ h“Ш™ì÷¼¨7O$éç0 Ë•Lg§$3ó3Çãÿ¼ G®ÿ.Á½8<ßÇIEND®B`‚astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/static/astropy_linkout_20.png0000644000175000017500000000327512243255342026765 0ustar oleole‰PNG  IHDR[â8A bKGDÿÿÿ ½§“ oFFsvek pHYs × ×B(›x vpAg\@0¢Ð¬IDATXÃå˜iŒ_SÆϘÚ+Új‹fF« BH‘XbOÐέ†ª}‰-Z¤Abû¢$¤Öi…V#¸T•ZCÕ– µIi™ÚU”d¦ª÷ý›;·÷?™)Ó*OrsïyÏsÏûžçžóžs®è!ج’ôLOùÙ`[À–=é`œ3|¼±;»1`{ÛͶﱽÔv]mú«ßØÞX°=˜l¦y’Zjs„á@30ŒlÈ<,éÝ’ÆöÆ @+ð60SÒ϶ûÇG½í‰ñü¡¤mo œ¬‘t—íþÀ%À `¶¤4üÔ pÐX<,’Ô1¦„:`•R~qÂPà` ð.°0kœÐ¨WJéŒs¶@R>)é÷ÎÀ´Ntž$éS`6p6pTØím¢5…—ÿÆHš“s8˜Éã{à@`»¿ ÷J:×v=ð%``/à9`çàœ/iší~À\`ÿbŸ{ƒçœH7KBäÝ€§"Æ“o€f¥´:¡/°hRÊʱ' J™\"ö`ànàÜ*ý[!©ÍöåÀ”ˆÿ `'I­ØÆö¶µ}Ÿí ¶o´Ý9÷#Ûg›Ùþ6ì l²}’í—m¿h[¶›lO·ýeð~ŽòtÛgE;õnÇÛkmϳ=Ëö^ÑÎKQ¿&âš~*¸² Ò NøÑ §ìµNxÊ ×æl30¡L-'ÌwÂ~¥uö ÛOÒ lOŒ˜Ïm)†ÙÞ©`»"×±ÁakÈÙšs\"5äߟ[m,ˆÝfû˜Bý±¹ú 9{ígÃþ[Œþ¼Ø“ªØà„'(Ê8á}'ëðú;aqÑ^{N•:l_q-ãÔHZ"éëx©.„Ü5ÇkŠû×ÀOñ|[ì86—„¤_Y?Ü-éé‚í¸¸ÿB6m‰8×wDqkÚ×… ÚÊ(eY´5$ʯwdz"ðD%¿—iZMh²´1/éѪbÛîmûZÛŸ‘åÒ¸0Çë] ŒV’-Ž_Ù¾9öÕ냲…ª1îK%­)Ôå®AÝðÓBûº08­À9•lî *±íN¶à'’ž M/ÎØÛÛo×;·GcJ=IÏÛ€€þÀeÀ›¶û®§àÕ:T6’܆ò}ÖæÊ³€£œP à„F 7°¸“6J}Kú h,ÌÐa¡S‡ÎŒŠV`¤¤‹%½üXU é[I—»WEÀÿˆÔ°<îM¶‹;¤Á¹çeÝh³1ÏWÊjà% 2úF3;I!±ËF6’Z ¦âÇ¥†ÈcÀrIKªtªÝ›=¢"€¤VIS€rªà·¸°½Y7Å®ï·ÎÈù8/ŠmÀü®4æ„}Õdg‡<¦çÄóhàÁ.4§.p*Úv»ø*žw·}=YJ9ÖÝÙ¼,²=øì”…9ú;À @_`†í¹ÀÊ.þ'IÉöê#{lï |Hv868·Hú¦ðÞÞNRòûï-ÈRãÍ%£öM Þ ûµJÿšQÕÐVCvNé öŒ¶¸&ìk"À“ÉrrÉv$Ä•Ç:ŽŒidi¥8%®WiµU!i­íÑÀcáçÒ\õÀý¹XóÌsÂL²…w7`2°¸o?)8áNàqàÖ.ŠØd{rxS˜yÙ¾ÓÞ¸˜,¡¯î—ôží1À²³ýòàöŽúß‘”æåOtÁ\ V $MSë©A{UÒGeÑFºj&;öö#›IIZg‹dK| ó€=ÉÆJYTM'lE¶»¤”–ÎÔ‹³Äé]ü(¯Hú üMq¨¹h=ÞÛÏ ¯lˆkþ~›<&wmGÿk±pYº™½!üõäÿì%âÿÈ#ÀædëÀX¥·h=…ÿ’ØSß»À3p5™Ø‹óÛĞƟ ½§pÅ%tEXtdate:create2012-10-18T20:57:33+02:00¢p_f%tEXtdate:modify2012-10-18T20:57:33+02:00Ó-çÚtEXtSoftwarewww.inkscape.org›î<IEND®B`‚astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/static/sidebar.js0000644000175000017500000001155312243255342024455 0ustar oleole/* * sidebar.js * ~~~~~~~~~~ * * This script makes the Sphinx sidebar collapsible. * * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton * used to collapse and expand the sidebar. * * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden * and the width of the sidebar and the margin-left of the document * are decreased. When the sidebar is expanded the opposite happens. * This script saves a per-browser/per-session cookie used to * remember the position of the sidebar among the pages. * Once the browser is closed the cookie is deleted and the position * reset to the default (expanded). * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ $(function() { // global elements used by the functions. // the 'sidebarbutton' element is defined as global after its // creation, in the add_sidebar_button function var bodywrapper = $('.bodywrapper'); var sidebar = $('.sphinxsidebar'); var sidebarwrapper = $('.sphinxsidebarwrapper'); // for some reason, the document has no sidebar; do not run into errors if (!sidebar.length) return; // original margin-left of the bodywrapper and width of the sidebar // with the sidebar expanded var bw_margin_expanded = bodywrapper.css('margin-left'); var ssb_width_expanded = sidebar.width(); // margin-left of the bodywrapper and width of the sidebar // with the sidebar collapsed var bw_margin_collapsed = 12; var ssb_width_collapsed = 12; // custom colors var dark_color = '#404040'; var light_color = '#505050'; function sidebar_is_collapsed() { return sidebarwrapper.is(':not(:visible)'); } function toggle_sidebar() { if (sidebar_is_collapsed()) expand_sidebar(); else collapse_sidebar(); } function collapse_sidebar() { sidebarwrapper.hide(); sidebar.css('width', ssb_width_collapsed); bodywrapper.css('margin-left', bw_margin_collapsed); sidebarbutton.css({ 'margin-left': '-1px', 'height': bodywrapper.height(), 'border-radius': '3px' }); sidebarbutton.find('span').text('»'); sidebarbutton.attr('title', _('Expand sidebar')); document.cookie = 'sidebar=collapsed'; } function expand_sidebar() { bodywrapper.css('margin-left', bw_margin_expanded); sidebar.css('width', ssb_width_expanded); sidebarwrapper.show(); sidebarbutton.css({ 'margin-left': ssb_width_expanded - 12, 'height': bodywrapper.height(), 'border-radius': '0px 3px 3px 0px' }); sidebarbutton.find('span').text('«'); sidebarbutton.attr('title', _('Collapse sidebar')); document.cookie = 'sidebar=expanded'; } function add_sidebar_button() { sidebarwrapper.css({ 'float': 'left', 'margin-right': '0', 'width': ssb_width_expanded - 18 }); // create the button sidebar.append('
«
'); var sidebarbutton = $('#sidebarbutton'); // find the height of the viewport to center the '<<' in the page var viewport_height; if (window.innerHeight) viewport_height = window.innerHeight; else viewport_height = $(window).height(); var sidebar_offset = sidebar.offset().top; var sidebar_height = Math.max(bodywrapper.height(), sidebar.height()); sidebarbutton.find('span').css({ 'font-family': '"Lucida Grande",Arial,sans-serif', 'display': 'block', 'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10, 'width': 12, 'position': 'fixed', 'text-align': 'center' }); sidebarbutton.click(toggle_sidebar); sidebarbutton.attr('title', _('Collapse sidebar')); sidebarbutton.css({ 'color': '#FFFFFF', 'background-color': light_color, 'border': '1px solid ' + light_color, 'border-radius': '0px 3px 3px 0px', 'font-size': '1.2em', 'cursor': 'pointer', 'height': sidebar_height, 'padding-top': '1px', 'margin': '-1px', 'margin-left': ssb_width_expanded - 12 }); sidebarbutton.hover( function () { $(this).css('background-color', dark_color); }, function () { $(this).css('background-color', light_color); } ); } function set_position_from_cookie() { if (!document.cookie) return; var items = document.cookie.split(';'); for(var k=0; kþˆ4ýÿØáþü•«þþ$ýÿÏÚþÿÉ×þÿ4ýÿ"ýÿ"ýÿ RþþáêþÿÅÒþú6ýÿ;þ¨.ýBý¨JþÿøúþüRþþTþÿÿÿÿÿ0aþÿIxþÿ¼Îþÿœ¸þÿ Býÿ UþþÿÿÿþW‚þÿ8ýöTþ-Lý RþÿõùþüX‰þþ_þÿöøþÿ´Ëþÿÿÿÿÿûüþÿÿÿÿÿœ»þÿ5ýÿ¿Ðþþ°ÉþüAýÿSþt\þtOýÿÈÛþü®ÉþþCýÿ»Òþÿÿÿÿÿÿÿÿÿ¶Ïþÿ¡ÂþÿÐàþÿBýÿ˜¸þþÏàþüNýÿZþ mþ-XýöNþÿÿÿÿþKþþWýÿWšþÿGþÿ\ýÿÔãþÿ¢ÆþÿIýÿ®Ëþþ¿×þüVýÿdþ¨oýmþ¨dýÿŠ»þúÿÿÿÿ¢Çþþ@ŽþÿN–þÿÔåþÿíõþÿuþÿdýÿð÷þþy°þü_ýÿoþˆuþsþ%uþñmýÿR¢þüÕéþÿûþþþùýþÿ´Øþÿþÿ{þÿ»Úþþëôþþ~ýýqýÿvþC{þþ}þP€þývþþvþú ‚þý€þþtþþoþþ¬Ôþÿÿÿÿþ¼þøtþÿ€þ¶ÿiý}þˆÿ…ÿH‰ÿí‰ÿÿ†ÿþ…ÿý ŒÿûNªÿû—Îþü[²þý‹ÿÿ†ÿá…þ…ÿyýxý€þÿŽþþ”‘þî‘þÿ‘þþ:«þþ þÿ‡ÿúþªþšÿ‡þÿ…ÿ„ÿƒÿ‰ÿ“ÿ˜ÿ—ÿU—ÿ€ÿˆšÿl¤ÿ*zÿ~þ…þ‚þ$@ €€€€@ P$ astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/static/bootstrap-astropy.css0000644000175000017500000002612212243255342026732 0ustar oleole/*! * Bootstrap v1.4.0 * * Copyright 2011 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Heavily modified by Kyle Barbary for the AstroPy Project for use with Sphinx. */ @import url("basic.css"); body { background-color: #ffffff; margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 18px; color: #404040; } /* Hyperlinks ----------------------------------------------------------------*/ a { color: #0069d6; text-decoration: none; line-height: inherit; font-weight: inherit; } a:hover { color: #00438a; text-decoration: underline; } /* Typography ----------------------------------------------------------------*/ h1,h2,h3,h4,h5,h6 { color: #404040; margin: 0.7em 0 0 0; line-height: 1.5em; } h1 { font-size: 24px; margin: 0; } h2 { font-size: 21px; line-height: 1.2em; margin: 1em 0 0.5em 0; border-bottom: 1px solid #404040; } h3 { font-size: 18px; } h4 { font-size: 16px; } h5 { font-size: 14px; } h6 { font-size: 13px; text-transform: uppercase; } p { font-size: 13px; font-weight: normal; line-height: 18px; margin-top: 0px; margin-bottom: 9px; } ul, ol { margin-left: 0; padding: 0 0 0 25px; } ul ul, ul ol, ol ol, ol ul { margin-bottom: 0; } ul { list-style: disc; } ol { list-style: decimal; } li { line-height: 18px; color: #404040; } ul.unstyled { list-style: none; margin-left: 0; } dl { margin-bottom: 18px; } dl dt, dl dd { line-height: 18px; } dl dd { margin-left: 9px; } hr { margin: 20px 0 19px; border: 0; border-bottom: 1px solid #eee; } strong { font-style: inherit; font-weight: bold; } em { font-style: italic; font-weight: inherit; line-height: inherit; } .muted { color: #bfbfbf; } address { display: block; line-height: 18px; margin-bottom: 18px; } code, pre { padding: 0 3px 2px; font-family: Monaco, Andale Mono, Courier New, monospace; font-size: 12px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; } tt { font-family: Monaco, Andale Mono, Courier New, monospace; } code { color: rgba(0, 0, 0, 0.75); padding: 1px 3px; } pre { display: block; padding: 8.5px; margin: 0 0 18px; line-height: 18px; font-size: 12px; border: 1px solid #ddd; border: 1px solid rgba(0, 0, 0, 0.12); -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; white-space: pre; white-space: pre-wrap; word-wrap: break-word; } img { margin: 9px 0; } /* format inline code with a rounded box */ tt { margin: 0 2px; padding: 0 5px; border: 1px solid #ddd; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 3px; font-size: 0.95em; } /* all code has same box background color, even in headers */ h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt, pre, code, tt { background-color: #f8f8f8; } /* override box for links & other sphinx-specifc stuff */ tt.xref, a tt, tt.descname, tt.descclassname { padding: 0 1px 0 1px; border: none; } /* override box for related bar at the top of the page */ .related tt { border: none; padding: 0 1px 0 1px; background-color: transparent; font-weight: bold; } th { background-color: #dddddd; } .viewcode-back { font-family: sans-serif; } div.viewcode-block:target { background-color: #f4debf; border-top: 1px solid #ac9; border-bottom: 1px solid #ac9; } table.docutils { border-spacing: 5px; border-collapse: separate; } /* Topbar --------------------------------------------------------------------*/ div.topbar { height: 40px; position: absolute; top: 0; left: 0; right: 0; z-index: 10000; padding: 0px 10px; background-color: #222; background-color: #222222; background-repeat: repeat-x; background-image: -khtml-gradient(linear, left top, left bottom, from(#333333), to(#222222)); background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #333333), color-stop(100%, #222222)); background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', endColorstr='#222222', GradientType=0); } div.topbar a.brand { font-family: 'Source Sans Pro', sans-serif; font-size: 26px; color: #ffffff; font-weight: 600; text-decoration: none; float: left; display: block; height: 32px; padding: 8px 12px 0px 45px; margin-left: -10px; background: transparent url("astropy_logo_32.png") no-repeat 10px 4px; } #logotext1 { } #logotext2 { font-weight:200; color: #ff5000; } #logotext3 { font-weight:200; } div.topbar .brand:hover, div.topbar ul li a.homelink:hover { background-color: #333; background-color: rgba(255, 255, 255, 0.05); } div.topbar ul { font-size: 110%; list-style: none; margin: 0; padding: 0 0 0 10px; float: right; color: #bfbfbf; text-align: center; text-decoration: none; height: 100%; } div.topbar ul li { float: left; display: inline; height: 30px; margin: 5px; padding: 0px; } div.topbar ul li a { color: #bfbfbf; text-decoration: none; padding: 5px; display: block; height: auto; text-align: center; vertical-align: middle; border-radius: 4px; } div.topbar ul li a:hover { color: #ffffff; text-decoration: none; } div.topbar ul li a.homelink { width: 112px; display: block; height: 20px; padding: 5px 0px; background: transparent url("astropy_linkout_20.png") no-repeat 10px 5px; } div.topbar form { text-align: left; margin: 0 0 0 5px; position: relative; filter: alpha(opacity=100); -khtml-opacity: 1; -moz-opacity: 1; opacity: 1; } div.topbar input { background-color: #444; background-color: rgba(255, 255, 255, 0.3); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: normal; font-weight: 13px; line-height: 1; padding: 4px 9px; color: #ffffff; color: rgba(255, 255, 255, 0.75); border: 1px solid #111; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.25); -webkit-transition: none; -moz-transition: none; -ms-transition: none; -o-transition: none; transition: none; } div.topbar input:-moz-placeholder { color: #e6e6e6; } div.topbar input::-webkit-input-placeholder { color: #e6e6e6; } div.topbar input:hover { background-color: #bfbfbf; background-color: rgba(255, 255, 255, 0.5); color: #ffffff; } div.topbar input:focus, div.topbar input.focused { outline: 0; background-color: #ffffff; color: #404040; text-shadow: 0 1px 0 #ffffff; border: 0; padding: 5px 10px; -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); } /* Relation bar (breadcrumbs, prev, next) ------------------------------------*/ div.related { height: 21px; width: auto; margin: 0 10px; position: absolute; top: 42px; clear: both; left: 0; right: 0; z-index: 10000; font-size: 100%; vertical-align: middle; background-color: #fff; border-bottom: 1px solid #bbb; } div.related ul { padding: 0; margin: 0; } /* Footer --------------------------------------------------------------------*/ footer { display: block; margin: 10px 10px 0px; padding: 10px 0 0 0; border-top: 1px solid #bbb; } .pull-right { float: right; width: 30em; text-align: right; } /* Sphinx sidebar ------------------------------------------------------------*/ div.sphinxsidebar { font-size: inherit; border-radius: 3px; background-color: #eee; border: 1px solid #bbb; } div.sphinxsidebarwrapper { padding: 0px 0px 0px 5px; } div.sphinxsidebar h3 { font-family: 'Trebuchet MS', sans-serif; font-size: 1.4em; font-weight: normal; margin: 5px 0px 0px 5px; padding: 0; line-height: 1.6em; } div.sphinxsidebar h4 { font-family: 'Trebuchet MS', sans-serif; font-size: 1.3em; font-weight: normal; margin: 5px 0 0 0; padding: 0; } div.sphinxsidebar p { } div.sphinxsidebar p.topless { margin: 5px 10px 10px 10px; } div.sphinxsidebar ul { margin: 0px 0px 0px 5px; padding: 0; } div.sphinxsidebar ul ul { margin-left: 15px; list-style-type: disc; } /* If showing the global TOC (toctree), color the current page differently */ div.sphinxsidebar a.current { color: #404040; } div.sphinxsidebar a.current:hover { color: #404040; } /* document, documentwrapper, body, bodywrapper ----------------------------- */ div.document { margin-top: 72px; margin-left: 10px; margin-right: 10px; } div.documentwrapper { float: left; width: 100%; } div.body { background-color: #ffffff; padding: 0 0 0px 20px; } div.bodywrapper { margin: 0 0 0 230px; max-width: 55em; } /* Header links ------------------------------------------------------------- */ a.headerlink { font-size: 0.8em; padding: 0 4px 0 4px; text-decoration: none; } a.headerlink:hover { background-color: #0069d6; color: white; text-docoration: none; } /* Admonitions and warnings ------------------------------------------------- */ /* Shared by admonitions and warnings */ div.admonition, div.warning { padding: 0px; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; } div.admonition p, div.warning p { margin: 0.5em 1em 0.5em 1em; padding: 0; } div.admonition pre, div.warning pre { margin: 0.4em 1em 0.4em 1em; } div.admonition p.admonition-title, div.warning p.admonition-title { margin: 0; padding: 0.1em 0 0.1em 0.5em; color: white; font-weight: bold; font-size: 1.1em; } div.admonition ul, div.admonition ol, div.warning ul, div.warning ol { margin: 0.1em 0.5em 0.5em 3em; padding: 0; } /* Admonitions only */ div.admonition { border: 1px solid #609060; background-color: #e9ffe9; } div.admonition p.admonition-title { background-color: #70A070; } /* Warnings only */ div.warning { border: 1px solid #900000; background-color: #ffe9e9; } div.warning p.admonition-title { background-color: #b04040; } /* Figures ------------------------------------------------------------------ */ .figure.align-center { clear: none; } /* This is a div for containing multiple figures side-by-side, for use with * .. container:: figures */ div.figures { border: 1px solid #CCCCCC; background-color: #F8F8F8; margin: 1em; text-align: center; } div.figures .figure { clear: none; float: none; display: inline-block; border: none; margin-left: 0.5em; margin-right: 0.5em; } .field-list th { white-space: nowrap; } astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/globaltoc.html0000644000175000017500000000011112243255342024037 0ustar oleole

Table of Contents

{{ toctree(maxdepth=-1, titles_only=true) }} astropy-0.3/astropy/sphinx/themes/bootstrap-astropy/searchbox.html0000644000175000017500000000042012243255342024052 0ustar oleole{%- if pagename != "search" %}
{%- endif %} astropy-0.3/astropy/sphinx/ext/0000755000175000017500000000000012243263747015021 5ustar oleoleastropy-0.3/astropy/sphinx/ext/tests/0000755000175000017500000000000012243263747016163 5ustar oleoleastropy-0.3/astropy/sphinx/ext/tests/__init__.py0000644000175000017500000000000012243255342020252 0ustar oleoleastropy-0.3/astropy/sphinx/ext/tests/test_automodapi.py0000644000175000017500000001433112243255342021730 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from ....tests.helper import pytest pytest.importorskip('sphinx') # skips these tests if sphinx not present class FakeConfig(object): """ Mocks up a sphinx configuration setting construct for automodapi tests """ def __init__(self, **kwargs): for k, v in kwargs.iteritems(): setattr(self, k, v) class FakeApp(object): """ Mocks up a `sphinx.application.Application` object for automodapi tests """ def __init__(self, **configs): self.config = FakeConfig(**configs) self.info = [] self.warnings = [] def info(self, msg, loc): self.info.append((msg, loc)) def warn(self, msg, loc): self.warnings.append((msg, loc)) am_replacer_str = """ This comes before .. automodapi:: astropy.sphinx.ext.tests.test_automodapi {options} This comes after """ am_replacer_basic_expected = """ This comes before astropy.sphinx.ext.tests.test_automodapi Module ----------------------------------------------- .. automodule:: astropy.sphinx.ext.tests.test_automodapi Functions ^^^^^^^^^ .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :functions-only: :toctree: api/ {empty} Classes ^^^^^^^ .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :classes-only: :toctree: api/ {empty} Class Inheritance Diagram ^^^^^^^^^^^^^^^^^^^^^^^^^ .. automod-diagram:: astropy.sphinx.ext.tests.test_automodapi :private-bases: This comes after """.format(empty='').replace('/', os.sep) # the .format is necessary for editors that remove empty-line whitespace def test_am_replacer_basic(): """ Tests replacing an ".. automodapi::" with the automodapi no-option template """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') result = automodapi_replace(am_replacer_str.format(options=''), fakeapp) assert result == am_replacer_basic_expected am_replacer_noinh_expected = """ This comes before astropy.sphinx.ext.tests.test_automodapi Module ----------------------------------------------- .. automodule:: astropy.sphinx.ext.tests.test_automodapi Functions ^^^^^^^^^ .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :functions-only: :toctree: api/ {empty} Classes ^^^^^^^ .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :classes-only: :toctree: api/ {empty} This comes after """.format(empty='').replace('/', os.sep) def test_am_replacer_noinh(): """ Tests replacing an ".. automodapi::" with no-inheritance-diagram option """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') ops = ['', ':no-inheritance-diagram:'] ostr = '\n '.join(ops) result = automodapi_replace(am_replacer_str.format(options=ostr), fakeapp) assert result == am_replacer_noinh_expected am_replacer_titleandhdrs_expected = """ This comes before astropy.sphinx.ext.tests.test_automodapi Module &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& .. automodule:: astropy.sphinx.ext.tests.test_automodapi Functions ********* .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :functions-only: :toctree: api/ {empty} Classes ******* .. automodsumm:: astropy.sphinx.ext.tests.test_automodapi :classes-only: :toctree: api/ {empty} Class Inheritance Diagram ************************* .. automod-diagram:: astropy.sphinx.ext.tests.test_automodapi :private-bases: This comes after """.format(empty='').replace('/', os.sep) def test_am_replacer_titleandhdrs(): """ Tests replacing an ".. automodapi::" entry with title-setting and header character options. """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') ops = ['', ':title: A new title', ':headings: &*'] ostr = '\n '.join(ops) result = automodapi_replace(am_replacer_str.format(options=ostr), fakeapp) assert result == am_replacer_titleandhdrs_expected am_replacer_nomain_str = """ This comes before .. automodapi:: astropy.sphinx.ext.automodapi :no-main-docstr: This comes after """ am_replacer_nomain_expected = """ This comes before astropy.sphinx.ext.automodapi Module ------------------------------------ Functions ^^^^^^^^^ .. automodsumm:: astropy.sphinx.ext.automodapi :functions-only: :toctree: api/ {empty} This comes after """.format(empty='').replace('/', os.sep) def test_am_replacer_nomain(): """ Tests replacing an ".. automodapi::" with "no-main-docstring" . """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') result = automodapi_replace(am_replacer_nomain_str, fakeapp) assert result == am_replacer_nomain_expected am_replacer_skip_str = """ This comes before .. automodapi:: astropy.sphinx.ext.automodapi :skip: something1 :skip: something2 This comes after """ am_replacer_skip_expected = """ This comes before astropy.sphinx.ext.automodapi Module ------------------------------------ .. automodule:: astropy.sphinx.ext.automodapi Functions ^^^^^^^^^ .. automodsumm:: astropy.sphinx.ext.automodapi :functions-only: :toctree: api/ :skip: something1,something2 This comes after """.format(empty='').replace('/', os.sep) def test_am_replacer_skip(): """ Tests using the ":skip: option in an ".. automodapi::" . """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') result = automodapi_replace(am_replacer_skip_str, fakeapp) assert result == am_replacer_skip_expected am_replacer_invalidop_str = """ This comes before .. automodapi:: astropy.sphinx.ext.automodapi :invalid-option: This comes after """ def test_am_replacer_invalidop(): """ Tests that a sphinx warning is produced with an invalid option. """ from ..automodapi import automodapi_replace fakeapp = FakeApp(automodapi_toctreedirnm='api') automodapi_replace(am_replacer_invalidop_str, fakeapp) expected_warnings = [('Found additional options invalid-option in ' 'automodapi.', None)] assert fakeapp.warnings == expected_warnings astropy-0.3/astropy/sphinx/ext/tests/test_automodsumm.py0000644000175000017500000000362712243255342022146 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from ....tests.helper import pytest pytest.importorskip('sphinx') # skips these tests if sphinx not present class FakeEnv(object): """ Mocks up a sphinx env setting construct for automodapi tests """ def __init__(self, **kwargs): for k, v in kwargs.iteritems(): setattr(self, k, v) class FakeBuilder(object): """ Mocks up a sphinx builder setting construct for automodapi tests """ def __init__(self, **kwargs): self.env = FakeEnv(**kwargs) class FakeApp(object): """ Mocks up a `sphinx.application.Application` object for automodapi tests """ def __init__(self, srcdir, automodapipresent=True): self.builder = FakeBuilder(srcdir=srcdir) self.info = [] self.warnings = [] self._extensions = [] if automodapipresent: self._extensions.append('astropy.sphinx.ext.automodapi') def info(self, msg, loc): self.info.append((msg, loc)) def warn(self, msg, loc): self.warnings.append((msg, loc)) ams_to_asmry_str = """ Before .. automodsumm:: astropy.sphinx.ext.automodsumm :p: And After """ ams_to_asmry_expected = """.. autosummary:: :p: ~astropy.sphinx.ext.automodsumm.Automoddiagram ~astropy.sphinx.ext.automodsumm.Automodsumm ~astropy.sphinx.ext.automodsumm.automodsumm_to_autosummary_lines ~astropy.sphinx.ext.automodsumm.generate_automodsumm_docs ~astropy.sphinx.ext.automodsumm.process_automodsumm_generation ~astropy.sphinx.ext.automodsumm.setup""" def test_ams_to_asmry(tmpdir): from ..automodsumm import automodsumm_to_autosummary_lines fi = tmpdir.join('automodsumm.rst') fi.write(ams_to_asmry_str) fakeapp = FakeApp(srcdir='') resultlines = automodsumm_to_autosummary_lines(str(fi), fakeapp) assert '\n'.join(resultlines) == ams_to_asmry_expected astropy-0.3/astropy/sphinx/ext/numpydoc.py0000644000175000017500000001310712243255342017223 0ustar oleole""" ======== numpydoc ======== Sphinx extension that handles docstrings in the Numpy standard format. [1] It will: - Convert Parameters etc. sections to field lists. - Convert See Also section to a See also entry. - Renumber references. - Extract the signature from the docstring, if it can't be determined otherwise. .. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard """ import sphinx if sphinx.__version__ < '1.0.1': raise RuntimeError("Sphinx 1.0.1 or newer is required") import os, re, pydoc from docscrape_sphinx import get_doc_object, SphinxDocString from sphinx.util.compat import Directive import inspect def mangle_docstrings(app, what, name, obj, options, lines, reference_offset=[0]): cfg = dict(use_plots=app.config.numpydoc_use_plots, show_class_members=app.config.numpydoc_show_class_members) if what == 'module': # Strip top title title_re = re.compile(ur'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*', re.I|re.S) lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n") else: doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg) lines[:] = unicode(doc).split(u"\n") if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \ obj.__name__: if hasattr(obj, '__module__'): v = dict(full_name=u"%s.%s" % (obj.__module__, obj.__name__)) else: v = dict(full_name=obj.__name__) lines += [u'', u'.. htmlonly::', ''] lines += [u' %s' % x for x in (app.config.numpydoc_edit_link % v).split("\n")] # replace reference numbers so that there are no duplicates references = [] for line in lines: line = line.strip() m = re.match(ur'^.. \[([a-z0-9_.-])\]', line, re.I) if m: references.append(m.group(1)) # start renaming from the longest string, to avoid overwriting parts references.sort(key=lambda x: -len(x)) if references: for i, line in enumerate(lines): for r in references: if re.match(ur'^\d+$', r): new_r = u"R%d" % (reference_offset[0] + int(r)) else: new_r = u"%s%d" % (r, reference_offset[0]) lines[i] = lines[i].replace(u'[%s]_' % r, u'[%s]_' % new_r) lines[i] = lines[i].replace(u'.. [%s]' % r, u'.. [%s]' % new_r) reference_offset[0] += len(references) def mangle_signature(app, what, name, obj, options, sig, retann): # Do not try to inspect classes that don't define `__init__` if (inspect.isclass(obj) and (not hasattr(obj, '__init__') or 'initializes x; see ' in pydoc.getdoc(obj.__init__))): return '', '' if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')): return if not hasattr(obj, '__doc__'): return doc = SphinxDocString(pydoc.getdoc(obj), warn=app.warn) if doc['Signature']: sig = re.sub(u"^[^(]*", u"", doc['Signature']) return sig, u'' def setup(app, get_doc_object_=get_doc_object): global get_doc_object get_doc_object = get_doc_object_ app.connect('autodoc-process-docstring', mangle_docstrings) app.connect('autodoc-process-signature', mangle_signature) app.add_config_value('numpydoc_edit_link', None, False) app.add_config_value('numpydoc_use_plots', None, False) app.add_config_value('numpydoc_show_class_members', True, True) # Extra mangling domains app.add_domain(NumpyPythonDomain) app.add_domain(NumpyCDomain) #------------------------------------------------------------------------------ # Docstring-mangling domains #------------------------------------------------------------------------------ from docutils.statemachine import ViewList from sphinx.domains.c import CDomain from sphinx.domains.python import PythonDomain class ManglingDomainBase(object): directive_mangling_map = {} def __init__(self, *a, **kw): super(ManglingDomainBase, self).__init__(*a, **kw) self.wrap_mangling_directives() def wrap_mangling_directives(self): for name, objtype in self.directive_mangling_map.items(): self.directives[name] = wrap_mangling_directive( self.directives[name], objtype) class NumpyPythonDomain(ManglingDomainBase, PythonDomain): name = 'np' directive_mangling_map = { 'function': 'function', 'class': 'class', 'exception': 'class', 'method': 'function', 'classmethod': 'function', 'staticmethod': 'function', 'attribute': 'attribute', } class NumpyCDomain(ManglingDomainBase, CDomain): name = 'np-c' directive_mangling_map = { 'function': 'function', 'member': 'attribute', 'macro': 'function', 'type': 'class', 'var': 'object', } def wrap_mangling_directive(base_directive, objtype): class directive(base_directive): def run(self): env = self.state.document.settings.env name = None if self.arguments: m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0]) name = m.group(2).strip() if not name: name = self.arguments[0] lines = list(self.content) mangle_docstrings(env.app, objtype, name, None, None, lines) self.content = ViewList(lines, self.content.parent) return base_directive.run(self) return directive astropy-0.3/astropy/sphinx/ext/__init__.py0000644000175000017500000000065012243255342017123 0ustar oleole""" This package contains the sphinx extensions used by Astropy. The `automodsumm` and `automodapi` modules contain extensions used by Astropy to generate API documentation - see the docstrings for details. The `numpydoc` module is dervied from the documentation tools numpy and scipy use to parse docstrings in the numpy/scipy format, and are also used by Astropy. The other modules are dependencies for `numpydoc`. """ astropy-0.3/astropy/sphinx/ext/comment_eater.py0000644000175000017500000001207512243255342020212 0ustar oleolefrom cStringIO import StringIO import compiler import inspect import textwrap import tokenize from compiler_unparse import unparse class Comment(object): """ A comment block. """ is_comment = True def __init__(self, start_lineno, end_lineno, text): # int : The first line number in the block. 1-indexed. self.start_lineno = start_lineno # int : The last line number. Inclusive! self.end_lineno = end_lineno # str : The text block including '#' character but not any leading spaces. self.text = text def add(self, string, start, end, line): """ Add a new comment line. """ self.start_lineno = min(self.start_lineno, start[0]) self.end_lineno = max(self.end_lineno, end[0]) self.text += string def __repr__(self): return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno, self.end_lineno, self.text) class NonComment(object): """ A non-comment block of code. """ is_comment = False def __init__(self, start_lineno, end_lineno): self.start_lineno = start_lineno self.end_lineno = end_lineno def add(self, string, start, end, line): """ Add lines to the block. """ if string.strip(): # Only add if not entirely whitespace. self.start_lineno = min(self.start_lineno, start[0]) self.end_lineno = max(self.end_lineno, end[0]) def __repr__(self): return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno, self.end_lineno) class CommentBlocker(object): """ Pull out contiguous comment blocks. """ def __init__(self): # Start with a dummy. self.current_block = NonComment(0, 0) # All of the blocks seen so far. self.blocks = [] # The index mapping lines of code to their associated comment blocks. self.index = {} def process_file(self, file): """ Process a file object. """ for token in tokenize.generate_tokens(file.next): self.process_token(*token) self.make_index() def process_token(self, kind, string, start, end, line): """ Process a single token. """ if self.current_block.is_comment: if kind == tokenize.COMMENT: self.current_block.add(string, start, end, line) else: self.new_noncomment(start[0], end[0]) else: if kind == tokenize.COMMENT: self.new_comment(string, start, end, line) else: self.current_block.add(string, start, end, line) def new_noncomment(self, start_lineno, end_lineno): """ We are transitioning from a noncomment to a comment. """ block = NonComment(start_lineno, end_lineno) self.blocks.append(block) self.current_block = block def new_comment(self, string, start, end, line): """ Possibly add a new comment. Only adds a new comment if this comment is the only thing on the line. Otherwise, it extends the noncomment block. """ prefix = line[:start[1]] if prefix.strip(): # Oops! Trailing comment, not a comment block. self.current_block.add(string, start, end, line) else: # A comment block. block = Comment(start[0], end[0], string) self.blocks.append(block) self.current_block = block def make_index(self): """ Make the index mapping lines of actual code to their associated prefix comments. """ for prev, block in zip(self.blocks[:-1], self.blocks[1:]): if not block.is_comment: self.index[block.start_lineno] = prev def search_for_comment(self, lineno, default=None): """ Find the comment block just before the given line number. Returns None (or the specified default) if there is no such block. """ if not self.index: self.make_index() block = self.index.get(lineno, None) text = getattr(block, 'text', default) return text def strip_comment_marker(text): """ Strip # markers at the front of a block of comment text. """ lines = [] for line in text.splitlines(): lines.append(line.lstrip('#')) text = textwrap.dedent('\n'.join(lines)) return text def get_class_traits(klass): """ Yield all of the documentation for trait definitions on a class object. """ # FIXME: gracefully handle errors here or in the caller? source = inspect.getsource(klass) cb = CommentBlocker() cb.process_file(StringIO(source)) mod_ast = compiler.parse(source) class_ast = mod_ast.node.nodes[0] for node in class_ast.code.nodes: # FIXME: handle other kinds of assignments? if isinstance(node, compiler.ast.Assign): name = node.nodes[0].name rhs = unparse(node.expr).strip() doc = strip_comment_marker(cb.search_for_comment(node.lineno, default='')) yield name, rhs, doc astropy-0.3/astropy/sphinx/ext/tocdepthfix.py0000644000175000017500000000124512243255342017706 0ustar oleolefrom sphinx import addnodes def fix_toc_entries(app, doctree): # Get the docname; I don't know why this isn't just passed in to the # callback # This seems a bit unreliable as it's undocumented, but it's not "private" # either: docname = app.builder.env.temp_data['docname'] if app.builder.env.metadata[docname].get('tocdepth', 0) != 0: # We need to reprocess any TOC nodes in the doctree and make sure all # the files listed in any TOCs are noted for treenode in doctree.traverse(addnodes.toctree): app.builder.env.note_toctree(docname, treenode) def setup(app): app.connect('doctree-read', fix_toc_entries) astropy-0.3/astropy/sphinx/ext/docscrape.py0000644000175000017500000003625112243255342017335 0ustar oleole"""Extract reference documentation from the NumPy source tree. """ import inspect import textwrap import re import pydoc from StringIO import StringIO class Reader(object): """A line-based string reader. """ def __init__(self, data): """ Parameters ---------- data : str String with lines separated by '\n'. """ if isinstance(data,list): self._str = data else: self._str = data.split('\n') # store string as list of lines self.reset() def __getitem__(self, n): return self._str[n] def reset(self): self._l = 0 # current line nr def read(self): if not self.eof(): out = self[self._l] self._l += 1 return out else: return '' def seek_next_non_empty_line(self): for l in self[self._l:]: if l.strip(): break else: self._l += 1 def eof(self): return self._l >= len(self._str) def read_to_condition(self, condition_func): start = self._l for line in self[start:]: if condition_func(line): return self[start:self._l] self._l += 1 if self.eof(): return self[start:self._l+1] return [] def read_to_next_empty_line(self): self.seek_next_non_empty_line() def is_empty(line): return not line.strip() return self.read_to_condition(is_empty) def read_to_next_unindented_line(self): def is_unindented(line): return (line.strip() and (len(line.lstrip()) == len(line))) return self.read_to_condition(is_unindented) def peek(self,n=0): if self._l + n < len(self._str): return self[self._l + n] else: return '' def is_empty(self): return not ''.join(self._str).strip() class NumpyDocString(object): def __init__(self, docstring, config={}, warn=None): from warnings import warn as stdlib_warn self.warn = stdlib_warn if warn is None else warn docstring = textwrap.dedent(docstring).split('\n') self._doc = Reader(docstring) self._parsed_data = { 'Signature': '', 'Summary': [''], 'Extended Summary': [], 'Parameters': [], 'Returns': [], 'Raises': [], 'Warns': [], 'Other Parameters': [], 'Attributes': [], 'Methods': [], 'See Also': [], 'Notes': [], 'Warnings': [], 'References': '', 'Examples': '', 'index': {} } self._parse() def __getitem__(self,key): return self._parsed_data[key] def __setitem__(self,key,val): if not self._parsed_data.has_key(key): self.warn("Unknown section %s" % key) else: self._parsed_data[key] = val def _is_at_section(self): self._doc.seek_next_non_empty_line() if self._doc.eof(): return False l1 = self._doc.peek().strip() # e.g. Parameters if l1.startswith('.. index::'): return True l2 = self._doc.peek(1).strip() # ---------- or ========== return l2.startswith('-'*len(l1)) or l2.startswith('='*len(l1)) def _strip(self,doc): i = 0 j = 0 for i,line in enumerate(doc): if line.strip(): break for j,line in enumerate(doc[::-1]): if line.strip(): break return doc[i:len(doc)-j] def _read_to_next_section(self): section = self._doc.read_to_next_empty_line() while not self._is_at_section() and not self._doc.eof(): if not self._doc.peek(-1).strip(): # previous line was empty section += [''] section += self._doc.read_to_next_empty_line() return section def _read_sections(self): while not self._doc.eof(): data = self._read_to_next_section() name = data[0].strip() if name.startswith('..'): # index section yield name, data[1:] elif len(data) < 2: yield StopIteration else: yield name, self._strip(data[2:]) def _parse_param_list(self,content): r = Reader(content) params = [] while not r.eof(): header = r.read().strip() if ' : ' in header: arg_name, arg_type = header.split(' : ')[:2] else: arg_name, arg_type = header, '' desc = r.read_to_next_unindented_line() desc = dedent_lines(desc) params.append((arg_name,arg_type,desc)) return params _name_rgx = re.compile(r"^\s*(:(?P\w+):`(?P[a-zA-Z0-9_.-]+)`|" r" (?P[a-zA-Z0-9_.-]+))\s*", re.X) def _parse_see_also(self, content): """ func_name : Descriptive text continued text another_func_name : Descriptive text func_name1, func_name2, :meth:`func_name`, func_name3 """ items = [] def parse_item_name(text): """Match ':role:`name`' or 'name'""" m = self._name_rgx.match(text) if m: g = m.groups() if g[1] is None: return g[3], None else: return g[2], g[1] raise ValueError("%s is not a item name" % text) def push_item(name, rest): if not name: return name, role = parse_item_name(name) items.append((name, list(rest), role)) del rest[:] current_func = None rest = [] for line in content: if not line.strip(): continue m = self._name_rgx.match(line) if m and line[m.end():].strip().startswith(':'): push_item(current_func, rest) current_func, line = line[:m.end()], line[m.end():] rest = [line.split(':', 1)[1].strip()] if not rest[0]: rest = [] elif not line.startswith(' '): push_item(current_func, rest) current_func = None if ',' in line: for func in line.split(','): if func.strip(): push_item(func, []) elif line.strip(): current_func = line elif current_func is not None: rest.append(line.strip()) push_item(current_func, rest) return items def _parse_index(self, section, content): """ .. index: default :refguide: something, else, and more """ def strip_each_in(lst): return [s.strip() for s in lst] out = {} section = section.split('::') if len(section) > 1: out['default'] = strip_each_in(section[1].split(','))[0] for line in content: line = line.split(':') if len(line) > 2: out[line[1]] = strip_each_in(line[2].split(',')) return out def _parse_summary(self): """Grab signature (if given) and summary""" if self._is_at_section(): return summary = self._doc.read_to_next_empty_line() summary_str = " ".join([s.strip() for s in summary]).strip() if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str): self['Signature'] = summary_str if not self._is_at_section(): self['Summary'] = self._doc.read_to_next_empty_line() else: self['Summary'] = summary if not self._is_at_section(): self['Extended Summary'] = self._read_to_next_section() def _parse(self): self._doc.reset() self._parse_summary() for (section,content) in self._read_sections(): if not section.startswith('..'): section = ' '.join([s.capitalize() for s in section.split(' ')]) if section in ('Parameters', 'Returns', 'Raises', 'Warns', 'Other Parameters', 'Attributes', 'Methods'): self[section] = self._parse_param_list(content) elif section.startswith('.. index::'): self['index'] = self._parse_index(section, content) elif section == 'See Also': self['See Also'] = self._parse_see_also(content) else: self[section] = content # string conversion routines def _str_header(self, name, symbol='-'): return [name, len(name)*symbol] def _str_indent(self, doc, indent=4): out = [] for line in doc: out += [' '*indent + line] return out def _str_signature(self): if self['Signature']: return [self['Signature'].replace('*','\*')] + [''] else: return [''] def _str_summary(self): if self['Summary']: return self['Summary'] + [''] else: return [] def _str_extended_summary(self): if self['Extended Summary']: return self['Extended Summary'] + [''] else: return [] def _str_param_list(self, name): out = [] if self[name]: out += self._str_header(name) for param,param_type,desc in self[name]: out += ['%s : %s' % (param, param_type)] out += self._str_indent(desc) out += [''] return out def _str_section(self, name): out = [] if self[name]: out += self._str_header(name) out += self[name] out += [''] return out def _str_see_also(self, func_role): if not self['See Also']: return [] out = [] out += self._str_header("See Also") last_had_desc = True for func, desc, role in self['See Also']: if role: link = ':%s:`%s`' % (role, func) elif func_role: link = ':%s:`%s`' % (func_role, func) else: link = "`%s`_" % func if desc or last_had_desc: out += [''] out += [link] else: out[-1] += ", %s" % link if desc: out += self._str_indent([' '.join(desc)]) last_had_desc = True else: last_had_desc = False out += [''] return out def _str_index(self): idx = self['index'] out = [] out += ['.. index:: %s' % idx.get('default','')] for section, references in idx.iteritems(): if section == 'default': continue out += [' :%s: %s' % (section, ', '.join(references))] return out def __str__(self, func_role=''): out = [] out += self._str_signature() out += self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Returns', 'Other Parameters', 'Raises', 'Warns'): out += self._str_param_list(param_list) out += self._str_section('Warnings') out += self._str_see_also(func_role) for s in ('Notes','References','Examples'): out += self._str_section(s) for param_list in ('Attributes', 'Methods'): out += self._str_param_list(param_list) out += self._str_index() return '\n'.join(out) def indent(str,indent=4): indent_str = ' '*indent if str is None: return indent_str lines = str.split('\n') return '\n'.join(indent_str + l for l in lines) def dedent_lines(lines): """Deindent a list of lines maximally""" return textwrap.dedent("\n".join(lines)).split("\n") def header(text, style='-'): return text + '\n' + style*len(text) + '\n' class FunctionDoc(NumpyDocString): def __init__(self, func, role='func', doc=None, config={}): self._f = func self._role = role # e.g. "func" or "meth" if doc is None: if func is None: raise ValueError("No function or docstring given") doc = inspect.getdoc(func) or '' NumpyDocString.__init__(self, doc) if not self['Signature'] and func is not None: func, func_name = self.get_func() try: # try to read signature argspec = inspect.getargspec(func) argspec = inspect.formatargspec(*argspec) argspec = argspec.replace('*','\*') signature = '%s%s' % (func_name, argspec) except TypeError, e: signature = '%s()' % func_name self['Signature'] = signature def get_func(self): func_name = getattr(self._f, '__name__', self.__class__.__name__) if inspect.isclass(self._f): func = getattr(self._f, '__call__', self._f.__init__) else: func = self._f return func, func_name def __str__(self): out = '' func, func_name = self.get_func() signature = self['Signature'].replace('*', '\*') roles = {'func': 'function', 'meth': 'method'} if self._role: if not roles.has_key(self._role): self.warn("Warning: invalid role %s" % self._role) out += '.. %s:: %s\n \n\n' % (roles.get(self._role,''), func_name) out += super(FunctionDoc, self).__str__(func_role=self._role) return out class ClassDoc(NumpyDocString): extra_public_methods = ['__call__'] def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc, config={}): if not inspect.isclass(cls) and cls is not None: raise ValueError("Expected a class or None, but got %r" % cls) self._cls = cls if modulename and not modulename.endswith('.'): modulename += '.' self._mod = modulename if doc is None: if cls is None: raise ValueError("No class or documentation string given") doc = pydoc.getdoc(cls) NumpyDocString.__init__(self, doc) if config.get('show_class_members', True): if not self['Methods']: self['Methods'] = [(name, '', '') for name in sorted(self.methods)] if not self['Attributes']: self['Attributes'] = [(name, '', '') for name in sorted(self.properties)] @property def methods(self): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) if ((not name.startswith('_') or name in self.extra_public_methods) and callable(func))] @property def properties(self): if self._cls is None: return [] return [name for name,func in inspect.getmembers(self._cls) if not name.startswith('_') and func is None] astropy-0.3/astropy/sphinx/ext/compiler_unparse.py0000644000175000017500000006020012243255342020730 0ustar oleole""" Turn compiler.ast structures back into executable python code. The unparse method takes a compiler.ast tree and transforms it back into valid python code. It is incomplete and currently only works for import statements, function calls, function definitions, assignments, and basic expressions. Inspired by python-2.5-svn/Demo/parser/unparse.py fixme: We may want to move to using _ast trees because the compiler for them is about 6 times faster than compiler.compile. """ import sys import cStringIO from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add def unparse(ast, single_line_functions=False): s = cStringIO.StringIO() UnparseCompilerAst(ast, s, single_line_functions) return s.getvalue().lstrip() op_precedence = { 'compiler.ast.Power':3, 'compiler.ast.Mul':2, 'compiler.ast.Div':2, 'compiler.ast.Add':1, 'compiler.ast.Sub':1 } class UnparseCompilerAst: """ Methods in this class recursively traverse an AST and output source code for the abstract syntax; original formatting is disregarged. """ ######################################################################### # object interface. ######################################################################### def __init__(self, tree, file = sys.stdout, single_line_functions=False): """ Unparser(tree, file=sys.stdout) -> None. Print the source for tree to file. """ self.f = file self._single_func = single_line_functions self._do_indent = True self._indent = 0 self._dispatch(tree) self._write("\n") self.f.flush() ######################################################################### # Unparser private interface. ######################################################################### ### format, output, and dispatch methods ################################ def _fill(self, text = ""): "Indent a piece of text, according to the current indentation level" if self._do_indent: self._write("\n"+" "*self._indent + text) else: self._write(text) def _write(self, text): "Append a piece of text to the current line." self.f.write(text) def _enter(self): "Print ':', and increase the indentation." self._write(": ") self._indent += 1 def _leave(self): "Decrease the indentation level." self._indent -= 1 def _dispatch(self, tree): "_dispatcher function, _dispatching tree type T to method _T." if isinstance(tree, list): for t in tree: self._dispatch(t) return meth = getattr(self, "_"+tree.__class__.__name__) if tree.__class__.__name__ == 'NoneType' and not self._do_indent: return meth(tree) ######################################################################### # compiler.ast unparsing methods. # # There should be one method per concrete grammar type. They are # organized in alphabetical order. ######################################################################### def _Add(self, t): self.__binary_op(t, '+') def _And(self, t): self._write(" (") for i, node in enumerate(t.nodes): self._dispatch(node) if i != len(t.nodes)-1: self._write(") and (") self._write(")") def _AssAttr(self, t): """ Handle assigning an attribute of an object """ self._dispatch(t.expr) self._write('.'+t.attrname) def _Assign(self, t): """ Expression Assignment such as "a = 1". This only handles assignment in expressions. Keyword assignment is handled separately. """ self._fill() for target in t.nodes: self._dispatch(target) self._write(" = ") self._dispatch(t.expr) if not self._do_indent: self._write('; ') def _AssName(self, t): """ Name on left hand side of expression. Treat just like a name on the right side of an expression. """ self._Name(t) def _AssTuple(self, t): """ Tuple on left hand side of an expression. """ # _write each elements, separated by a comma. for element in t.nodes[:-1]: self._dispatch(element) self._write(", ") # Handle the last one without writing comma last_element = t.nodes[-1] self._dispatch(last_element) def _AugAssign(self, t): """ +=,-=,*=,/=,**=, etc. operations """ self._fill() self._dispatch(t.node) self._write(' '+t.op+' ') self._dispatch(t.expr) if not self._do_indent: self._write(';') def _Bitand(self, t): """ Bit and operation. """ for i, node in enumerate(t.nodes): self._write("(") self._dispatch(node) self._write(")") if i != len(t.nodes)-1: self._write(" & ") def _Bitor(self, t): """ Bit or operation """ for i, node in enumerate(t.nodes): self._write("(") self._dispatch(node) self._write(")") if i != len(t.nodes)-1: self._write(" | ") def _CallFunc(self, t): """ Function call. """ self._dispatch(t.node) self._write("(") comma = False for e in t.args: if comma: self._write(", ") else: comma = True self._dispatch(e) if t.star_args: if comma: self._write(", ") else: comma = True self._write("*") self._dispatch(t.star_args) if t.dstar_args: if comma: self._write(", ") else: comma = True self._write("**") self._dispatch(t.dstar_args) self._write(")") def _Compare(self, t): self._dispatch(t.expr) for op, expr in t.ops: self._write(" " + op + " ") self._dispatch(expr) def _Const(self, t): """ A constant value such as an integer value, 3, or a string, "hello". """ self._dispatch(t.value) def _Decorators(self, t): """ Handle function decorators (eg. @has_units) """ for node in t.nodes: self._dispatch(node) def _Dict(self, t): self._write("{") for i, (k, v) in enumerate(t.items): self._dispatch(k) self._write(": ") self._dispatch(v) if i < len(t.items)-1: self._write(", ") self._write("}") def _Discard(self, t): """ Node for when return value is ignored such as in "foo(a)". """ self._fill() self._dispatch(t.expr) def _Div(self, t): self.__binary_op(t, '/') def _Ellipsis(self, t): self._write("...") def _From(self, t): """ Handle "from xyz import foo, bar as baz". """ # fixme: Are From and ImportFrom handled differently? self._fill("from ") self._write(t.modname) self._write(" import ") for i, (name,asname) in enumerate(t.names): if i != 0: self._write(", ") self._write(name) if asname is not None: self._write(" as "+asname) def _Function(self, t): """ Handle function definitions """ if t.decorators is not None: self._fill("@") self._dispatch(t.decorators) self._fill("def "+t.name + "(") defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults) for i, arg in enumerate(zip(t.argnames, defaults)): self._write(arg[0]) if arg[1] is not None: self._write('=') self._dispatch(arg[1]) if i < len(t.argnames)-1: self._write(', ') self._write(")") if self._single_func: self._do_indent = False self._enter() self._dispatch(t.code) self._leave() self._do_indent = True def _Getattr(self, t): """ Handle getting an attribute of an object """ if isinstance(t.expr, (Div, Mul, Sub, Add)): self._write('(') self._dispatch(t.expr) self._write(')') else: self._dispatch(t.expr) self._write('.'+t.attrname) def _If(self, t): self._fill() for i, (compare,code) in enumerate(t.tests): if i == 0: self._write("if ") else: self._write("elif ") self._dispatch(compare) self._enter() self._fill() self._dispatch(code) self._leave() self._write("\n") if t.else_ is not None: self._write("else") self._enter() self._fill() self._dispatch(t.else_) self._leave() self._write("\n") def _IfExp(self, t): self._dispatch(t.then) self._write(" if ") self._dispatch(t.test) if t.else_ is not None: self._write(" else (") self._dispatch(t.else_) self._write(")") def _Import(self, t): """ Handle "import xyz.foo". """ self._fill("import ") for i, (name,asname) in enumerate(t.names): if i != 0: self._write(", ") self._write(name) if asname is not None: self._write(" as "+asname) def _Keyword(self, t): """ Keyword value assignment within function calls and definitions. """ self._write(t.name) self._write("=") self._dispatch(t.expr) def _List(self, t): self._write("[") for i,node in enumerate(t.nodes): self._dispatch(node) if i < len(t.nodes)-1: self._write(", ") self._write("]") def _Module(self, t): if t.doc is not None: self._dispatch(t.doc) self._dispatch(t.node) def _Mul(self, t): self.__binary_op(t, '*') def _Name(self, t): self._write(t.name) def _NoneType(self, t): self._write("None") def _Not(self, t): self._write('not (') self._dispatch(t.expr) self._write(')') def _Or(self, t): self._write(" (") for i, node in enumerate(t.nodes): self._dispatch(node) if i != len(t.nodes)-1: self._write(") or (") self._write(")") def _Pass(self, t): self._write("pass\n") def _Printnl(self, t): self._fill("print ") if t.dest: self._write(">> ") self._dispatch(t.dest) self._write(", ") comma = False for node in t.nodes: if comma: self._write(', ') else: comma = True self._dispatch(node) def _Power(self, t): self.__binary_op(t, '**') def _Return(self, t): self._fill("return ") if t.value: if isinstance(t.value, Tuple): text = ', '.join([ name.name for name in t.value.asList() ]) self._write(text) else: self._dispatch(t.value) if not self._do_indent: self._write('; ') def _Slice(self, t): self._dispatch(t.expr) self._write("[") if t.lower: self._dispatch(t.lower) self._write(":") if t.upper: self._dispatch(t.upper) #if t.step: # self._write(":") # self._dispatch(t.step) self._write("]") def _Sliceobj(self, t): for i, node in enumerate(t.nodes): if i != 0: self._write(":") if not (isinstance(node, Const) and node.value is None): self._dispatch(node) def _Stmt(self, tree): for node in tree.nodes: self._dispatch(node) def _Sub(self, t): self.__binary_op(t, '-') def _Subscript(self, t): self._dispatch(t.expr) self._write("[") for i, value in enumerate(t.subs): if i != 0: self._write(",") self._dispatch(value) self._write("]") def _TryExcept(self, t): self._fill("try") self._enter() self._dispatch(t.body) self._leave() for handler in t.handlers: self._fill('except ') self._dispatch(handler[0]) if handler[1] is not None: self._write(', ') self._dispatch(handler[1]) self._enter() self._dispatch(handler[2]) self._leave() if t.else_: self._fill("else") self._enter() self._dispatch(t.else_) self._leave() def _Tuple(self, t): if not t.nodes: # Empty tuple. self._write("()") else: self._write("(") # _write each elements, separated by a comma. for element in t.nodes[:-1]: self._dispatch(element) self._write(", ") # Handle the last one without writing comma last_element = t.nodes[-1] self._dispatch(last_element) self._write(")") def _UnaryAdd(self, t): self._write("+") self._dispatch(t.expr) def _UnarySub(self, t): self._write("-") self._dispatch(t.expr) def _With(self, t): self._fill('with ') self._dispatch(t.expr) if t.vars: self._write(' as ') self._dispatch(t.vars.name) self._enter() self._dispatch(t.body) self._leave() self._write('\n') def _int(self, t): self._write(repr(t)) def __binary_op(self, t, symbol): # Check if parenthesis are needed on left side and then dispatch has_paren = False left_class = str(t.left.__class__) if (left_class in op_precedence.keys() and op_precedence[left_class] < op_precedence[str(t.__class__)]): has_paren = True if has_paren: self._write('(') self._dispatch(t.left) if has_paren: self._write(')') # Write the appropriate symbol for operator self._write(symbol) # Check if parenthesis are needed on the right side and then dispatch has_paren = False right_class = str(t.right.__class__) if (right_class in op_precedence.keys() and op_precedence[right_class] < op_precedence[str(t.__class__)]): has_paren = True if has_paren: self._write('(') self._dispatch(t.right) if has_paren: self._write(')') def _float(self, t): # if t is 0.1, str(t)->'0.1' while repr(t)->'0.1000000000001' # We prefer str here. self._write(str(t)) def _str(self, t): self._write(repr(t)) def _tuple(self, t): self._write(str(t)) ######################################################################### # These are the methods from the _ast modules unparse. # # As our needs to handle more advanced code increase, we may want to # modify some of the methods below so that they work for compiler.ast. ######################################################################### # # stmt # def _Expr(self, tree): # self._fill() # self._dispatch(tree.value) # # def _Import(self, t): # self._fill("import ") # first = True # for a in t.names: # if first: # first = False # else: # self._write(", ") # self._write(a.name) # if a.asname: # self._write(" as "+a.asname) # ## def _ImportFrom(self, t): ## self._fill("from ") ## self._write(t.module) ## self._write(" import ") ## for i, a in enumerate(t.names): ## if i == 0: ## self._write(", ") ## self._write(a.name) ## if a.asname: ## self._write(" as "+a.asname) ## # XXX(jpe) what is level for? ## # # def _Break(self, t): # self._fill("break") # # def _Continue(self, t): # self._fill("continue") # # def _Delete(self, t): # self._fill("del ") # self._dispatch(t.targets) # # def _Assert(self, t): # self._fill("assert ") # self._dispatch(t.test) # if t.msg: # self._write(", ") # self._dispatch(t.msg) # # def _Exec(self, t): # self._fill("exec ") # self._dispatch(t.body) # if t.globals: # self._write(" in ") # self._dispatch(t.globals) # if t.locals: # self._write(", ") # self._dispatch(t.locals) # # def _Print(self, t): # self._fill("print ") # do_comma = False # if t.dest: # self._write(">>") # self._dispatch(t.dest) # do_comma = True # for e in t.values: # if do_comma:self._write(", ") # else:do_comma=True # self._dispatch(e) # if not t.nl: # self._write(",") # # def _Global(self, t): # self._fill("global") # for i, n in enumerate(t.names): # if i != 0: # self._write(",") # self._write(" " + n) # # def _Yield(self, t): # self._fill("yield") # if t.value: # self._write(" (") # self._dispatch(t.value) # self._write(")") # # def _Raise(self, t): # self._fill('raise ') # if t.type: # self._dispatch(t.type) # if t.inst: # self._write(", ") # self._dispatch(t.inst) # if t.tback: # self._write(", ") # self._dispatch(t.tback) # # # def _TryFinally(self, t): # self._fill("try") # self._enter() # self._dispatch(t.body) # self._leave() # # self._fill("finally") # self._enter() # self._dispatch(t.finalbody) # self._leave() # # def _excepthandler(self, t): # self._fill("except ") # if t.type: # self._dispatch(t.type) # if t.name: # self._write(", ") # self._dispatch(t.name) # self._enter() # self._dispatch(t.body) # self._leave() # # def _ClassDef(self, t): # self._write("\n") # self._fill("class "+t.name) # if t.bases: # self._write("(") # for a in t.bases: # self._dispatch(a) # self._write(", ") # self._write(")") # self._enter() # self._dispatch(t.body) # self._leave() # # def _FunctionDef(self, t): # self._write("\n") # for deco in t.decorators: # self._fill("@") # self._dispatch(deco) # self._fill("def "+t.name + "(") # self._dispatch(t.args) # self._write(")") # self._enter() # self._dispatch(t.body) # self._leave() # # def _For(self, t): # self._fill("for ") # self._dispatch(t.target) # self._write(" in ") # self._dispatch(t.iter) # self._enter() # self._dispatch(t.body) # self._leave() # if t.orelse: # self._fill("else") # self._enter() # self._dispatch(t.orelse) # self._leave # # def _While(self, t): # self._fill("while ") # self._dispatch(t.test) # self._enter() # self._dispatch(t.body) # self._leave() # if t.orelse: # self._fill("else") # self._enter() # self._dispatch(t.orelse) # self._leave # # # expr # def _Str(self, tree): # self._write(repr(tree.s)) ## # def _Repr(self, t): # self._write("`") # self._dispatch(t.value) # self._write("`") # # def _Num(self, t): # self._write(repr(t.n)) # # def _ListComp(self, t): # self._write("[") # self._dispatch(t.elt) # for gen in t.generators: # self._dispatch(gen) # self._write("]") # # def _GeneratorExp(self, t): # self._write("(") # self._dispatch(t.elt) # for gen in t.generators: # self._dispatch(gen) # self._write(")") # # def _comprehension(self, t): # self._write(" for ") # self._dispatch(t.target) # self._write(" in ") # self._dispatch(t.iter) # for if_clause in t.ifs: # self._write(" if ") # self._dispatch(if_clause) # # def _IfExp(self, t): # self._dispatch(t.body) # self._write(" if ") # self._dispatch(t.test) # if t.orelse: # self._write(" else ") # self._dispatch(t.orelse) # # unop = {"Invert":"~", "Not": "not", "UAdd":"+", "USub":"-"} # def _UnaryOp(self, t): # self._write(self.unop[t.op.__class__.__name__]) # self._write("(") # self._dispatch(t.operand) # self._write(")") # # binop = { "Add":"+", "Sub":"-", "Mult":"*", "Div":"/", "Mod":"%", # "LShift":">>", "RShift":"<<", "BitOr":"|", "BitXor":"^", "BitAnd":"&", # "FloorDiv":"//", "Pow": "**"} # def _BinOp(self, t): # self._write("(") # self._dispatch(t.left) # self._write(")" + self.binop[t.op.__class__.__name__] + "(") # self._dispatch(t.right) # self._write(")") # # boolops = {_ast.And: 'and', _ast.Or: 'or'} # def _BoolOp(self, t): # self._write("(") # self._dispatch(t.values[0]) # for v in t.values[1:]: # self._write(" %s " % self.boolops[t.op.__class__]) # self._dispatch(v) # self._write(")") # # def _Attribute(self,t): # self._dispatch(t.value) # self._write(".") # self._write(t.attr) # ## def _Call(self, t): ## self._dispatch(t.func) ## self._write("(") ## comma = False ## for e in t.args: ## if comma: self._write(", ") ## else: comma = True ## self._dispatch(e) ## for e in t.keywords: ## if comma: self._write(", ") ## else: comma = True ## self._dispatch(e) ## if t.starargs: ## if comma: self._write(", ") ## else: comma = True ## self._write("*") ## self._dispatch(t.starargs) ## if t.kwargs: ## if comma: self._write(", ") ## else: comma = True ## self._write("**") ## self._dispatch(t.kwargs) ## self._write(")") # # # slice # def _Index(self, t): # self._dispatch(t.value) # # def _ExtSlice(self, t): # for i, d in enumerate(t.dims): # if i != 0: # self._write(': ') # self._dispatch(d) # # # others # def _arguments(self, t): # first = True # nonDef = len(t.args)-len(t.defaults) # for a in t.args[0:nonDef]: # if first:first = False # else: self._write(", ") # self._dispatch(a) # for a,d in zip(t.args[nonDef:], t.defaults): # if first:first = False # else: self._write(", ") # self._dispatch(a), # self._write("=") # self._dispatch(d) # if t.vararg: # if first:first = False # else: self._write(", ") # self._write("*"+t.vararg) # if t.kwarg: # if first:first = False # else: self._write(", ") # self._write("**"+t.kwarg) # ## def _keyword(self, t): ## self._write(t.arg) ## self._write("=") ## self._dispatch(t.value) # # def _Lambda(self, t): # self._write("lambda ") # self._dispatch(t.args) # self._write(": ") # self._dispatch(t.body) astropy-0.3/astropy/sphinx/ext/edit_on_github.py0000644000175000017500000001326312243255342020353 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This extension makes it easy to edit documentation on github. It adds links associated with each docstring that go to the corresponding view source page on Github. From there, the user can push the "Edit" button, edit the docstring, and submit a pull request. It has the following configuration options (to be set in the project's ``conf.py``): * `edit_on_github_project` The name of the github project, in the form "username/projectname". * `edit_on_github_branch` The name of the branch to edit. If this is a released version, this should be a git tag referring to that version. For a dev version, it often makes sense for it to be "master". It may also be a git hash. * `edit_on_github_source_root` The location within the source tree of the root of the Python package. Defaults to "lib". * `edit_on_github_doc_root` The location within the source tree of the root of the documentation source. Defaults to "doc", but it may make sense to set it to "doc/source" if the project uses a separate source directory. * `edit_on_github_docstring_message` The phrase displayed in the links to edit a docstring. Defaults to "[edit on github]". * `edit_on_github_page_message` The phrase displayed in the links to edit a RST page. Defaults to "[edit this page on github]". * `edit_on_github_help_message` The phrase displayed as a tooltip on the edit links. Defaults to "Push the Edit button on the next page" * `edit_on_github_skip_regex` When the path to the .rst file matches this regular expression, no "edit this page on github" link will be added. Defaults to ``"_.*"``. """ import inspect import os import re import sys from docutils import nodes from sphinx import addnodes def import_object(modname, name): """ Import the object given by *modname* and *name* and return it. If not found, or the import fails, returns None. """ try: __import__(modname) mod = sys.modules[modname] obj = mod for part in name.split('.'): obj = getattr(obj, part) return obj except: return None def get_url_base(app): return 'http://github.com/%s/tree/%s/' % ( app.config.edit_on_github_project, app.config.edit_on_github_branch) def doctree_read(app, doctree): # Get the configuration parameters if app.config.edit_on_github_project == 'REQUIRED': raise ValueError( "The edit_on_github_project configuration variable must be " "provided in the conf.py") source_root = app.config.edit_on_github_source_root url = get_url_base(app) docstring_message = app.config.edit_on_github_docstring_message # Handle the docstring-editing links for objnode in doctree.traverse(addnodes.desc): if objnode.get('domain') != 'py': continue names = set() for signode in objnode: if not isinstance(signode, addnodes.desc_signature): continue modname = signode.get('module') if not modname: continue fullname = signode.get('fullname') if fullname in names: # only one link per name, please continue names.add(fullname) obj = import_object(modname, fullname) anchor = None if obj is not None: try: lines, lineno = inspect.getsourcelines(obj) except: pass else: anchor = '#L%d' % lineno if anchor: path = '%s%s%s.py%s' % ( url, source_root, modname.replace('.', '/'), anchor) onlynode = addnodes.only(expr='html') onlynode += nodes.reference( reftitle=app.config.edit_on_github_help_message, refuri=path) onlynode[0] += nodes.inline( '', '', nodes.raw('', ' ', format='html'), nodes.Text(docstring_message), classes=['edit-on-github', 'viewcode-link']) signode += onlynode def html_page_context(app, pagename, templatename, context, doctree): if (templatename == 'page.html' and not re.match(app.config.edit_on_github_skip_regex, pagename)): doc_root = app.config.edit_on_github_doc_root if doc_root != '' and not doc_root.endswith('/'): doc_root += '/' doc_path = os.path.relpath(doctree.get('source'), app.builder.srcdir) url = get_url_base(app) page_message = app.config.edit_on_github_page_message context['edit_on_github'] = url + doc_root + doc_path context['edit_on_github_page_message'] = ( app.config.edit_on_github_page_message) def setup(app): app.add_config_value('edit_on_github_project', 'REQUIRED', True) app.add_config_value('edit_on_github_branch', 'master', True) app.add_config_value('edit_on_github_source_root', 'lib', True) app.add_config_value('edit_on_github_doc_root', 'doc', True) app.add_config_value('edit_on_github_docstring_message', '[edit on github]', True) app.add_config_value('edit_on_github_page_message', 'Edit This Page on Github', True) app.add_config_value('edit_on_github_help_message', 'Push the Edit button on the next page', True) app.add_config_value('edit_on_github_skip_regex', '_.*', True) app.connect('doctree-read', doctree_read) app.connect('html-page-context', html_page_context) astropy-0.3/astropy/sphinx/ext/automodsumm.py0000644000175000017500000004620312243255342017742 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension adds two directives for summarizing the public members of a module or package. These directives are primarily for use with the `automodapi` extension, but can be used independently. ======================= `automodsumm` directive ======================= This directive will produce an "autosummary"-style table for public attributes of a specified module. See the `sphinx.ext.autosummary` extension for details on this process. The main difference from the `autosummary` directive is that `autosummary` requires manually inputting all attributes that appear in the table, while this captures the entries automatically. This directive requires a single argument that must be a module or package. It also accepts any options supported by the `autosummary` directive- see `sphinx.ext.autosummary` for details. It also accepts two additional options: * ``:classes-only:`` If present, the autosummary table will only contain entries for classes. This cannot be used at the same time with ``:functions-only:`` . * ``:functions-only:`` If present, the autosummary table will only contain entries for functions. This cannot be used at the same time with ``:classes-only:`` . * ``:skip: obj1, [obj2, obj3, ...]`` If present, specifies that the listed objects should be skipped and not have their documentation generated, nor be includded in the summary table. =========================== `automod-diagram` directive =========================== This directive will produce an inheritance diagram like that of the `sphinx.ext.inheritance_diagram` extension. This directive requires a single argument that must be a module or package. It accepts no options. .. note:: Like 'inheritance-diagram', 'automod-diagram' requires `graphviz `_ to generate the inheritance diagram. """ import inspect import os import re from sphinx.ext.autosummary import Autosummary from sphinx.ext.inheritance_diagram import InheritanceDiagram from docutils.parsers.rst.directives import flag from ...utils.misc import find_mod_objs from .astropyautosummary import AstropyAutosummary def _str_list_converter(argument): """ A directive option conversion function that converts the option into a list of strings. Used for 'skip' option. """ if argument is None: return [] else: return [s.strip() for s in argument.split(',')] class Automodsumm(AstropyAutosummary): required_arguments = 1 optional_arguments = 0 final_argument_whitespace = False has_content = False option_spec = dict(Autosummary.option_spec) option_spec['functions-only'] = flag option_spec['classes-only'] = flag option_spec['skip'] = _str_list_converter def run(self): self.warnings = [] nodelist = [] try: localnames, fqns, objs = find_mod_objs(self.arguments[0]) except ImportError: self.warnings = [] self.warn("Couldn't import module " + self.arguments[0]) return self.warnings try: # set self.content to trick the Autosummary internals. # Be sure to respect functions-only and classes-only. funconly = 'functions-only' in self.options clsonly = 'classes-only' in self.options skipmap = {} if 'skip' in self.options: skipnames = set(self.options['skip']) for lnm, fqnm in zip(localnames, fqns): if lnm in skipnames: skipnames.remove(lnm) skipmap[fqnm] = lnm if len(skipnames) > 0: self.warn('Tried to skip objects {objs} in module {mod}, ' 'but they were not present. Ignoring.'.format( objs=skipnames, mod=self.arguments[0])) if funconly and not clsonly: cont = [] for nm, obj in zip(fqns, objs): if nm not in skipmap and inspect.isfunction(obj): cont.append('~' + nm) elif clsonly: cont = [] for nm, obj in zip(fqns, objs): if nm not in skipmap and inspect.isclass(obj): cont.append('~' + nm) else: if clsonly and funconly: self.warning('functions-only and classes-only both ' 'defined. Skipping.') cont = ['~' + nm for nm in fqns if nm not in skipmap] self.content = cont #can't use super because Sphinx/docutils has trouble #return super(Autosummary,self).run() nodelist.extend(Autosummary.run(self)) return self.warnings + nodelist finally: # has_content = False for the Automodsumm self.content = [] #<-------------------automod-diagram stuff------------------------------------> class Automoddiagram(InheritanceDiagram): def run(self): try: nms, objs = find_mod_objs(self.arguments[0], onlylocals=True)[1:] except ImportError: self.warnings = [] self.warn("Couldn't import module " + self.arguments[0]) return self.warnings clsnms = [] for n, o in zip(nms, objs): if inspect.isclass(o): clsnms.append(n) oldargs = self.arguments try: if len(clsnms) > 0: self.arguments = [u' '.join(clsnms)] return InheritanceDiagram.run(self) finally: self.arguments = oldargs #<---------------------automodsumm generation stuff---------------------------> def process_automodsumm_generation(app): env = app.builder.env ext = app.config.source_suffix filestosearch = [x + ext for x in env.found_docs if os.path.isfile(env.doc2path(x))]\ liness = [automodsumm_to_autosummary_lines(sfn, app) for sfn in filestosearch] for sfn, lines in zip(filestosearch, liness): if len(lines) > 0: generate_automodsumm_docs(lines, sfn, builder=app.builder, warn=app.warn, info=app.info, suffix=app.config.source_suffix, base_path=app.srcdir) #_automodsummrex = re.compile(r'^(\s*)\.\. automodsumm::\s*([A-Za-z0-9_.]+)\s*' # r'\n\1(\s*)(\S|$)', re.MULTILINE) _lineendrex = r'(?:\n|$)' _hdrex = r'^\n?(\s*)\.\. automodsumm::\s*(\S+)\s*' + _lineendrex _oprex1 = r'(?:\1(\s+)\S.*' + _lineendrex + ')' _oprex2 = r'(?:\1\4\S.*' + _lineendrex + ')' _automodsummrex = re.compile(_hdrex + '(' + _oprex1 + '?' + _oprex2 + '*)', re.MULTILINE) def automodsumm_to_autosummary_lines(fn, app): """ Generates lines from a file with an "automodsumm" entry suitable for feeding into "autosummary". Searches the provided file for `automodsumm` directives and returns a list of lines specifying the `autosummary` commands for the modules requested. This does *not* return the whole file contents - just an autosummary section in place of any :automodsumm: entries. Note that any options given for `automodsumm` are also included in the generated `autosummary` section. Parameters ---------- fn : str The name of the file to search for `automodsumm` entries. app : sphinx.application.Application The sphinx Application object Return ------ lines : list of str Lines for all `automodsumm` entries with the entries replaced by `autosummary` and the module's members added. """ fullfn = os.path.join(app.builder.env.srcdir, fn) with open(fullfn) as fr: if 'astropy.sphinx.ext.automodapi' in app._extensions: from astropy.sphinx.ext.automodapi import automodapi_replace # Must do the automodapi on the source to get the automodsumm # that might be in there filestr = automodapi_replace(fr.read(), app, True, fn, False) else: filestr = fr.read() spl = _automodsummrex.split(filestr) #0th entry is the stuff before the first automodsumm line indent1s = spl[1::5] mods = spl[2::5] opssecs = spl[3::5] indent2s = spl[4::5] remainders = spl[5::5] # only grab automodsumm sections and convert them to autosummary with the # entries for all the public objects newlines = [] #loop over all automodsumms in this document for i, (i1, i2, modnm, ops, rem) in enumerate(zip(indent1s, indent2s, mods, opssecs, remainders)): allindent = i1 + i2 #filter out functions-only and classes-only options if present oplines = ops.split('\n') toskip = [] funcsonly = clssonly = False for i, ln in reversed(list(enumerate(oplines))): if ':functions-only:' in ln: funcsonly = True del oplines[i] if ':classes-only:' in ln: clssonly = True del oplines[i] if ':skip:' in ln: toskip.extend(_str_list_converter(ln.replace(':skip:', ''))) del oplines[i] if funcsonly and clssonly: msg = ('Defined both functions-only and classes-only options. ' 'Skipping this directive.') lnnum = sum([spl[j].count('\n') for j in range(i * 5 + 1)]) app.warn('[automodsumm]' + msg, (fn, lnnum)) continue newlines.append(i1 + '.. autosummary::') newlines.extend(oplines) for nm, fqn, obj in zip(*find_mod_objs(modnm, onlylocals=True)): if nm in toskip: continue if funcsonly and not inspect.isfunction(obj): continue if clssonly and not inspect.isclass(obj): continue newlines.append(allindent + '~' + fqn) return newlines def generate_automodsumm_docs(lines, srcfn, suffix='.rst', warn=None, info=None, base_path=None, builder=None, template_dir=None): """ This function is adapted from `sphinx.ext.autosummary.generate.generate_autosummmary_docs` to generate source for the automodsumm directives that should be autosummarized. Unlike generate_autosummary_docs, this function is called one file at a time. """ from sphinx.jinja2glue import BuiltinTemplateLoader from sphinx.ext.autosummary import import_by_name, get_documenter from sphinx.ext.autosummary.generate import (find_autosummary_in_lines, _simple_info, _simple_warn) from sphinx.util.osutil import ensuredir from sphinx.util.inspect import safe_getattr from jinja2 import FileSystemLoader, TemplateNotFound from jinja2.sandbox import SandboxedEnvironment if info is None: info = _simple_info if warn is None: warn = _simple_warn #info('[automodsumm] generating automodsumm for: ' + srcfn) # Create our own templating environment - here we use Astropy's # templates rather than the default autosummary templates, in order to # allow docstrings to be shown for methods. template_dirs = [os.path.join(os.path.dirname(__file__), 'templates'), os.path.join(base_path, '_templates')] if builder is not None: # allow the user to override the templates template_loader = BuiltinTemplateLoader() template_loader.init(builder, dirs=template_dirs) else: if template_dir: template_dirs.insert(0, template_dir) template_loader = FileSystemLoader(template_dirs) template_env = SandboxedEnvironment(loader=template_loader) # read #items = find_autosummary_in_files(sources) items = find_autosummary_in_lines(lines, filename=srcfn) if len(items) > 0: msg = '[automodsumm] {1}: found {0} automodsumm entries to generate' info(msg.format(len(items), srcfn)) # gennms = [item[0] for item in items] # if len(gennms) > 20: # gennms = gennms[:10] + ['...'] + gennms[-10:] # info('[automodsumm] generating autosummary for: ' + ', '.join(gennms)) # remove possible duplicates items = dict([(item, True) for item in items]).keys() # keep track of new files new_files = [] # write for name, path, template_name in sorted(items): if path is None: # The corresponding autosummary:: directive did not have # a :toctree: option continue path = os.path.abspath(path) ensuredir(path) try: name, obj, parent = import_by_name(name) except ImportError, e: warn('[automodapi] failed to import %r: %s' % (name, e)) continue fn = os.path.join(path, name + suffix) # skip it if it exists if os.path.isfile(fn): continue new_files.append(fn) f = open(fn, 'w') try: doc = get_documenter(obj, parent) if template_name is not None: template = template_env.get_template(template_name) else: tmplstr = 'autosummary/%s.rst' try: template = template_env.get_template(tmplstr % doc.objtype) except TemplateNotFound: template = template_env.get_template(tmplstr % 'base') def get_members_mod(obj, typ, include_public=[]): """ typ = None -> all """ items = [] for name in dir(obj): try: documenter = get_documenter(safe_getattr(obj, name), obj) except AttributeError: continue if typ is None or documenter.objtype == typ: items.append(name) public = [x for x in items if x in include_public or not x.startswith('_')] return public, items def get_members_class(obj, typ, include_public=[], include_base=False): """ typ = None -> all include_base -> include attrs that are from a base class """ items = [] # using dir gets all of the attributes, including the elements # from the base class, otherwise use __slots__ or __dict__ if include_base: names = dir(obj) else: if hasattr(obj, '__slots__'): names = tuple(getattr(obj, '__slots__')) else: names = getattr(obj, '__dict__').keys() for name in names: try: documenter = get_documenter(safe_getattr(obj, name), obj) except AttributeError: continue if typ is None or documenter.objtype == typ: items.append(name) public = [x for x in items if x in include_public or not x.startswith('_')] return public, items ns = {} if doc.objtype == 'module': ns['members'] = get_members_mod(obj, None) ns['functions'], ns['all_functions'] = \ get_members_mod(obj, 'function') ns['classes'], ns['all_classes'] = \ get_members_mod(obj, 'class') ns['exceptions'], ns['all_exceptions'] = \ get_members_mod(obj, 'exception') elif doc.objtype == 'class': ns['members'] = get_members_class(obj, None) ns['methods'], ns['all_methods'] = \ get_members_class(obj, 'method', ['__init__']) ns['attributes'], ns['all_attributes'] = \ get_members_class(obj, 'attribute') ns['methods'].sort() ns['attributes'].sort() parts = name.split('.') if doc.objtype in ('method', 'attribute'): mod_name = '.'.join(parts[:-2]) cls_name = parts[-2] obj_name = '.'.join(parts[-2:]) ns['class'] = cls_name else: mod_name, obj_name = '.'.join(parts[:-1]), parts[-1] ns['fullname'] = name ns['module'] = mod_name ns['objname'] = obj_name ns['name'] = parts[-1] ns['objtype'] = doc.objtype ns['underline'] = len(name) * '=' # We now check whether a file for reference footnotes exists for # the module being documented. We first check if the # current module is a file or a directory, as this will give a # different path for the reference file. For example, if # documenting astropy.wcs then the reference file is at # ../wcs/references.txt, while if we are documenting # astropy.config.logging_helper (which is at # astropy/config/logging_helper.py) then the reference file is set # to ../config/references.txt if '.' in mod_name: mod_name_dir = mod_name.replace('.', '/').split('/', 1)[1] else: mod_name_dir = mod_name if not os.path.isdir(os.path.join(base_path, mod_name_dir)) \ and os.path.isdir(os.path.join(base_path, mod_name_dir.rsplit('/', 1)[0])): mod_name_dir = mod_name_dir.rsplit('/', 1)[0] # We then have to check whether it exists, and if so, we pass it # to the template. if os.path.exists(os.path.join(base_path, mod_name_dir, 'references.txt')): # An important subtlety here is that the path we pass in has # to be relative to the file being generated, so we have to # figure out the right number of '..'s ndirsback = path.replace(base_path, '').count('/') ref_file_rel_segments = ['..'] * ndirsback ref_file_rel_segments.append(mod_name_dir) ref_file_rel_segments.append('references.txt') ns['referencefile'] = os.path.join(*ref_file_rel_segments) rendered = template.render(**ns) f.write(rendered) finally: f.close() def setup(app): # need our autosummary app.setup_extension('astropy.sphinx.ext.astropyautosummary') # need inheritance-diagram for automod-diagram app.setup_extension('sphinx.ext.inheritance_diagram') app.add_directive('automod-diagram', Automoddiagram) app.add_directive('automodsumm', Automodsumm) app.connect('builder-inited', process_automodsumm_generation) astropy-0.3/astropy/sphinx/ext/automodapi.py0000644000175000017500000002167312243255342017536 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension adds a tools to simplify generating the API documentationfor Astropy packages and affiliated packages. ====================== `automodapi` directive ====================== This directive takes a single argument that must be module or package. It will produce a block of documentation that includes the docstring for the package, an `automodsumm` directive, and an `automod-diagram` if there are any classes in the module. It accepts the following options: * ``:no-inheritance-diagram:`` If present, the inheritance diagram will not be shown even if the module/package has classes. * ``:skip: str`` This option results in the specified object being skipped, that is the object will *not* be included in the generated documentation. This option may appear any number of times to skip multiple objects. * ``:no-main-docstr:`` If present, the docstring for the module/package will not be generated. The function and class tables will still be used, however. * ``:headings: str`` Specifies the characters (in one string) used as the heading levels used for the generated section. This must have at least 2 characters (any after 2 will be ignored). This also *must* match the rest of the documentation on this page for sphinx to be happy. Defaults to "-^", which matches the convention used for Python's documentation, assuming the automodapi call is inside a top-level section (which usually uses '='). This extension also adds a sphinx configuration option `automodapi_toctreedirnm`. It must be a string that specifies the name of the directory the automodsumm generated documentation ends up in. This directory path should be relative to the documentation root (e.g., same place as ``index.rst``). It defaults to 'api' """ # Implementation note: # The 'automodapi' directive is not actually implemented as a docutils # directive. Instead, this extension searches for the 'automodapi' text in # all sphinx documents, and replaces it where necessary from a template built # into this extension. This is necessary because automodsumm (and autosummary) # use the "builder-inited" event, which comes before the directives are # actually built. import inspect import os import re import sys automod_templ_modheader = """ {modname} {pkgormod} {modhds}{pkgormodhds} {automoduleline} """ automod_templ_classes = """ Classes {clshds} .. automodsumm:: {modname} :classes-only: {toctree} {skips} """ automod_templ_funcs = """ Functions {funchds} .. automodsumm:: {modname} :functions-only: {toctree} {skips} """ automod_templ_inh = """ Class Inheritance Diagram {clsinhsechds} .. automod-diagram:: {modname} :private-bases: """ _automodapirex = re.compile(r'^(?:\s*\.\.\s+automodapi::\s*)([A-Za-z0-9_.]+)' r'\s*$((?:\n\s+:[a-zA-Z_\-]+:.*$)*)', flags=re.MULTILINE) #the last group of the above regex is intended to go into finall with the below _automodapiargsrex = re.compile(r':([a-zA-Z_\-]+):(.*)$', flags=re.MULTILINE) def automodapi_replace(sourcestr, app, dotoctree=True, docname=None, warnings=True): """ Replaces `sourcestr`'s entries of ".. automdapi::" with the automodapi template form based on provided options. This is used with the sphinx event 'source-read' to replace `automodapi` entries before sphinx actually processes them, as automodsumm needs the code to be present to generate stub documentation. Parameters ---------- sourcestr : str The string with sphinx source to be checked for automodapi replacement. app : `sphinx.application.Application` The sphinx application. dotoctree : bool If True, a ":toctree:" option will be added in the ".. automodsumm::" sections of the template, pointing to the appropriate "generated" directory based on the Astropy convention (e.g. in ``docs/api``) docname : str The name of the file for this `sourcestr` (if known - if not, it can be None). If not provided and `dotoctree` is True, the generated files may end up in the wrong place. warnings : bool If False, all warnings that would normally be issued are silenced. Returns ------- newstr :str The string with automodapi entries replaced with the correct sphinx markup. """ spl = _automodapirex.split(sourcestr) if len(spl) > 1: # automodsumm is in this document if dotoctree: toctreestr = ':toctree: ' dirnm = app.config.automodapi_toctreedirnm if not dirnm.endswith(os.sep): dirnm += os.sep if docname is not None: toctreestr += '../' * docname.count('/') + dirnm else: toctreestr += dirnm else: toctreestr = '' newstrs = [spl[0]] for grp in range(len(spl) // 3): modnm = spl[grp * 3 + 1] #find where this is in the document for warnings if docname is None: location = None else: location = (docname, spl[0].count('\n')) #initialize default options toskip = [] inhdiag = maindocstr = True hds = '-^' #look for actual options unknownops = [] for opname, args in _automodapiargsrex.findall(spl[grp * 3 + 2]): if opname == 'skip': toskip.append(args.strip()) elif opname == 'no-inheritance-diagram': inhdiag = False elif opname == 'no-main-docstr': maindocstr = False elif opname == 'headings': hds = args else: unknownops.append(opname) # get the two heading chars if len(hds) < 2: msg = 'Not enough headings (got {0}, need 2), using default -^' if warnings: app.warn(msg.format(len(hds)), location) hds = '-^' h1, h2 = hds.lstrip()[:2] #tell sphinx that the remaining args are invalid. if len(unknownops) > 0 and app is not None: opsstrs = ','.join(unknownops) msg = 'Found additional options ' + opsstrs + ' in automodapi.' if warnings: app.warn(msg, location) ispkg, hascls, hasfuncs = _mod_info(modnm, toskip) #add automodule directive only if no-main-docstr isn't present if maindocstr: automodline = '.. automodule:: {modname}'.format(modname=modnm) else: automodline = '' newstrs.append(automod_templ_modheader.format(modname=modnm, modhds=h1 * len(modnm), pkgormod='Package' if ispkg else 'Module', pkgormodhds=h1 * (8 if ispkg else 7), automoduleline=automodline)) if hasfuncs: newstrs.append(automod_templ_funcs.format(modname=modnm, funchds=h2 * 9, toctree=toctreestr, skips=':skip: ' + ','.join(toskip) if toskip else '')) if hascls: newstrs.append(automod_templ_classes.format(modname=modnm, clshds=h2 * 7, toctree=toctreestr, skips=':skip: ' + ','.join(toskip) if toskip else '')) if inhdiag and hascls: # add inheritance diagram if any classes are in the module newstrs.append(automod_templ_inh.format( modname=modnm, clsinhsechds=h2 * 25)) newstrs.append(spl[grp * 3 + 3]) return ''.join(newstrs) else: return sourcestr def _mod_info(modname, toskip=[]): """ Determines if a module is a module or a package and whether or not it has classes or functions. """ from ...utils.misc import find_mod_objs hascls = hasfunc = False for localnm, fqnm, obj in zip(*find_mod_objs(modname, onlylocals=True)): if localnm not in toskip: hascls = hascls or inspect.isclass(obj) hasfunc = hasfunc or inspect.isfunction(obj) if hascls and hasfunc: break #find_mod_objs has already imported modname pkg = sys.modules[modname] ispkg = '__init__.' in os.path.split(pkg.__name__)[1] return ispkg, hascls, hasfunc def process_automodapi(app, docname, source): source[0] = automodapi_replace(source[0], app, True, docname) def setup(app): # need automodsumm for automodapi app.setup_extension('astropy.sphinx.ext.automodsumm') app.connect('source-read', process_automodapi) app.add_config_value('automodapi_toctreedirnm', 'api', True) astropy-0.3/astropy/sphinx/ext/traitsdoc.py0000644000175000017500000001005012243255342017353 0ustar oleole""" ========= traitsdoc ========= Sphinx extension that handles docstrings in the Numpy standard format, [1] and support Traits [2]. This extension can be used as a replacement for ``numpydoc`` when support for Traits is required. .. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard .. [2] http://code.enthought.com/projects/traits/ """ import inspect import os import pydoc import docscrape import docscrape_sphinx from docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc, SphinxDocString import numpydoc import comment_eater class SphinxTraitsDoc(SphinxClassDoc): def __init__(self, cls, modulename='', func_doc=SphinxFunctionDoc): if not inspect.isclass(cls): raise ValueError("Initialise using a class. Got %r" % cls) self._cls = cls if modulename and not modulename.endswith('.'): modulename += '.' self._mod = modulename self._name = cls.__name__ self._func_doc = func_doc docstring = pydoc.getdoc(cls) docstring = docstring.split('\n') # De-indent paragraph try: indent = min(len(s) - len(s.lstrip()) for s in docstring if s.strip()) except ValueError: indent = 0 for n,line in enumerate(docstring): docstring[n] = docstring[n][indent:] self._doc = docscrape.Reader(docstring) self._parsed_data = { 'Signature': '', 'Summary': '', 'Description': [], 'Extended Summary': [], 'Parameters': [], 'Returns': [], 'Raises': [], 'Warns': [], 'Other Parameters': [], 'Traits': [], 'Methods': [], 'See Also': [], 'Notes': [], 'References': '', 'Example': '', 'Examples': '', 'index': {} } self._parse() def _str_summary(self): return self['Summary'] + [''] def _str_extended_summary(self): return self['Description'] + self['Extended Summary'] + [''] def __str__(self, indent=0, func_role="func"): out = [] out += self._str_signature() out += self._str_index() + [''] out += self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Traits', 'Methods', 'Returns','Raises'): out += self._str_param_list(param_list) out += self._str_see_also("obj") out += self._str_section('Notes') out += self._str_references() out += self._str_section('Example') out += self._str_section('Examples') out = self._str_indent(out,indent) return '\n'.join(out) def looks_like_issubclass(obj, classname): """ Return True if the object has a class or superclass with the given class name. Ignores old-style classes. """ t = obj if t.__name__ == classname: return True for klass in t.__mro__: if klass.__name__ == classname: return True return False def get_doc_object(obj, what=None, config=None): if what is None: if inspect.isclass(obj): what = 'class' elif inspect.ismodule(obj): what = 'module' elif callable(obj): what = 'function' else: what = 'object' if what == 'class': doc = SphinxTraitsDoc(obj, '', func_doc=SphinxFunctionDoc, config=config) if looks_like_issubclass(obj, 'HasTraits'): for name, trait, comment in comment_eater.get_class_traits(obj): # Exclude private traits. if not name.startswith('_'): doc['Traits'].append((name, trait, comment.splitlines())) return doc elif what in ('function', 'method'): return SphinxFunctionDoc(obj, '', config=config) else: return SphinxDocString(pydoc.getdoc(obj), config=config) def setup(app): # init numpydoc numpydoc.setup(app, get_doc_object) astropy-0.3/astropy/sphinx/ext/templates/0000755000175000017500000000000012243263747017017 5ustar oleoleastropy-0.3/astropy/sphinx/ext/templates/autosummary_core/0000755000175000017500000000000012243263747022415 5ustar oleoleastropy-0.3/astropy/sphinx/ext/templates/autosummary_core/base.rst0000644000175000017500000000025212243255342024050 0ustar oleole{% if referencefile %} .. include:: {{ referencefile }} {% endif %} {{ objname }} {{ underline }} .. currentmodule:: {{ module }} .. auto{{ objtype }}:: {{ objname }} astropy-0.3/astropy/sphinx/ext/templates/autosummary_core/module.rst0000644000175000017500000000127712243255342024433 0ustar oleole{% if referencefile %} .. include:: {{ referencefile }} {% endif %} {{ objname }} {{ underline }} .. automodule:: {{ fullname }} {% block functions %} {% if functions %} .. rubric:: Functions .. autosummary:: {% for item in functions %} {{ item }} {%- endfor %} {% endif %} {% endblock %} {% block classes %} {% if classes %} .. rubric:: Classes .. autosummary:: {% for item in classes %} {{ item }} {%- endfor %} {% endif %} {% endblock %} {% block exceptions %} {% if exceptions %} .. rubric:: Exceptions .. autosummary:: {% for item in exceptions %} {{ item }} {%- endfor %} {% endif %} {% endblock %} astropy-0.3/astropy/sphinx/ext/templates/autosummary_core/class.rst0000644000175000017500000000221112243255342024240 0ustar oleole{% if referencefile %} .. include:: {{ referencefile }} {% endif %} {{ objname }} {{ underline }} .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} :show-inheritance: {% if '__init__' in methods %} {% set caught_result = methods.remove('__init__') %} {% endif %} {% block attributes_summary %} {% if attributes %} .. rubric:: Attributes Summary .. autosummary:: {% for item in attributes %} ~{{ name }}.{{ item }} {%- endfor %} {% endif %} {% endblock %} {% block methods_summary %} {% if methods %} .. rubric:: Methods Summary .. autosummary:: {% for item in methods %} ~{{ name }}.{{ item }} {%- endfor %} {% endif %} {% endblock %} {% block attributes_documentation %} {% if attributes %} .. rubric:: Attributes Documentation {% for item in attributes %} .. autoattribute:: {{ item }} {%- endfor %} {% endif %} {% endblock %} {% block methods_documentation %} {% if methods %} .. rubric:: Methods Documentation {% for item in methods %} .. automethod:: {{ item }} {%- endfor %} {% endif %} {% endblock %} astropy-0.3/astropy/sphinx/ext/astropyautosummary.py0000644000175000017500000000575612243255342021410 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This sphinx extension builds off of `sphinx.ext.autosummary` to clean up some issues it presents in the Astropy docs. The main issue this fixes is the summary tables getting cut off before the end of the sentence in some cases. """ import re from sphinx.ext.autosummary import Autosummary # used in Automodsumm.get_items _itemsummrex = re.compile(r'^([A-Z].*?\.(?:\s|$))') class AstropyAutosummary(Autosummary): def get_items(self, names): """Try to import the given names, and return a list of ``[(name, signature, summary_string, real_name), ...]``. """ from sphinx.ext.autosummary import (get_import_prefixes_from_env, import_by_name, get_documenter, mangle_signature) env = self.state.document.settings.env prefixes = get_import_prefixes_from_env(env) items = [] max_item_chars = 50 for name in names: display_name = name if name.startswith('~'): name = name[1:] display_name = name.split('.')[-1] try: real_name, obj, parent = import_by_name(name, prefixes=prefixes) except ImportError: self.warn('failed to import %s' % name) items.append((name, '', '', name)) continue # NB. using real_name here is important, since Documenters # handle module prefixes slightly differently documenter = get_documenter(obj, parent)(self, real_name) if not documenter.parse_name(): self.warn('failed to parse name %s' % real_name) items.append((display_name, '', '', real_name)) continue if not documenter.import_object(): self.warn('failed to import object %s' % real_name) items.append((display_name, '', '', real_name)) continue # -- Grab the signature sig = documenter.format_signature() if not sig: sig = '' else: max_chars = max(10, max_item_chars - len(display_name)) sig = mangle_signature(sig, max_chars=max_chars) sig = sig.replace('*', r'\*') # -- Grab the summary doc = list(documenter.process_doc(documenter.get_doc())) while doc and not doc[0].strip(): doc.pop(0) m = _itemsummrex.search(" ".join(doc).strip()) if m: summary = m.group(1).strip() elif doc: summary = doc[0].strip() else: summary = '' items.append((display_name, sig, summary, real_name)) return items def setup(app): # need autosummary, of course app.setup_extension('sphinx.ext.autosummary') # this replaces the default autosummary with the astropy one app.add_directive('autosummary', AstropyAutosummary) astropy-0.3/astropy/sphinx/ext/phantom_import.py0000644000175000017500000001306412243255342020427 0ustar oleole""" ============== phantom_import ============== Sphinx extension to make directives from ``sphinx.ext.autodoc`` and similar extensions to use docstrings loaded from an XML file. This extension loads an XML file in the Pydocweb format [1] and creates a dummy module that contains the specified docstrings. This can be used to get the current docstrings from a Pydocweb instance without needing to rebuild the documented module. .. [1] http://code.google.com/p/pydocweb """ import imp, sys, compiler, types, os, inspect, re def setup(app): app.connect('builder-inited', initialize) app.add_config_value('phantom_import_file', None, True) def initialize(app): fn = app.config.phantom_import_file if (fn and os.path.isfile(fn)): print "[numpydoc] Phantom importing modules from", fn, "..." import_phantom_module(fn) #------------------------------------------------------------------------------ # Creating 'phantom' modules from an XML description #------------------------------------------------------------------------------ def import_phantom_module(xml_file): """ Insert a fake Python module to sys.modules, based on a XML file. The XML file is expected to conform to Pydocweb DTD. The fake module will contain dummy objects, which guarantee the following: - Docstrings are correct. - Class inheritance relationships are correct (if present in XML). - Function argspec is *NOT* correct (even if present in XML). Instead, the function signature is prepended to the function docstring. - Class attributes are *NOT* correct; instead, they are dummy objects. Parameters ---------- xml_file : str Name of an XML file to read """ import lxml.etree as etree object_cache = {} tree = etree.parse(xml_file) root = tree.getroot() # Sort items so that # - Base classes come before classes inherited from them # - Modules come before their contents all_nodes = dict([(n.attrib['id'], n) for n in root]) def _get_bases(node, recurse=False): bases = [x.attrib['ref'] for x in node.findall('base')] if recurse: j = 0 while True: try: b = bases[j] except IndexError: break if b in all_nodes: bases.extend(_get_bases(all_nodes[b])) j += 1 return bases type_index = ['module', 'class', 'callable', 'object'] def base_cmp(a, b): x = cmp(type_index.index(a.tag), type_index.index(b.tag)) if x != 0: return x if a.tag == 'class' and b.tag == 'class': a_bases = _get_bases(a, recurse=True) b_bases = _get_bases(b, recurse=True) x = cmp(len(a_bases), len(b_bases)) if x != 0: return x if a.attrib['id'] in b_bases: return -1 if b.attrib['id'] in a_bases: return 1 return cmp(a.attrib['id'].count('.'), b.attrib['id'].count('.')) nodes = root.getchildren() nodes.sort(base_cmp) # Create phantom items for node in nodes: name = node.attrib['id'] doc = (node.text or '').decode('string-escape') + "\n" if doc == "\n": doc = "" # create parent, if missing parent = name while True: parent = '.'.join(parent.split('.')[:-1]) if not parent: break if parent in object_cache: break obj = imp.new_module(parent) object_cache[parent] = obj sys.modules[parent] = obj # create object if node.tag == 'module': obj = imp.new_module(name) obj.__doc__ = doc sys.modules[name] = obj elif node.tag == 'class': bases = [object_cache[b] for b in _get_bases(node) if b in object_cache] bases.append(object) init = lambda self: None init.__doc__ = doc obj = type(name, tuple(bases), {'__doc__': doc, '__init__': init}) obj.__name__ = name.split('.')[-1] elif node.tag == 'callable': funcname = node.attrib['id'].split('.')[-1] argspec = node.attrib.get('argspec') if argspec: argspec = re.sub('^[^(]*', '', argspec) doc = "%s%s\n\n%s" % (funcname, argspec, doc) obj = lambda: 0 obj.__argspec_is_invalid_ = True obj.func_name = funcname obj.__name__ = name obj.__doc__ = doc if inspect.isclass(object_cache[parent]): obj.__objclass__ = object_cache[parent] else: class Dummy(object): pass obj = Dummy() obj.__name__ = name obj.__doc__ = doc if inspect.isclass(object_cache[parent]): obj.__get__ = lambda: None object_cache[name] = obj if parent: if inspect.ismodule(object_cache[parent]): obj.__module__ = parent setattr(object_cache[parent], name.split('.')[-1], obj) # Populate items for node in root: obj = object_cache.get(node.attrib['id']) if obj is None: continue for ref in node.findall('ref'): if node.tag == 'class': if ref.attrib['ref'].startswith(node.attrib['id'] + '.'): setattr(obj, ref.attrib['name'], object_cache.get(ref.attrib['ref'])) else: setattr(obj, ref.attrib['name'], object_cache.get(ref.attrib['ref'])) astropy-0.3/astropy/sphinx/ext/docscrape_sphinx.py0000644000175000017500000001714512243255342020727 0ustar oleoleimport re, inspect, textwrap, pydoc import sphinx from docscrape import NumpyDocString, FunctionDoc, ClassDoc class SphinxDocString(NumpyDocString): def __init__(self, docstring, config={}, warn=None): self.use_plots = config.get('use_plots', False) NumpyDocString.__init__(self, docstring, config=config, warn=warn) # string conversion routines def _str_header(self, name, symbol='`'): return ['.. rubric:: ' + name, ''] def _str_field_list(self, name): return [':' + name + ':'] def _str_indent(self, doc, indent=4): out = [] for line in doc: out += [' '*indent + line] return out def _str_signature(self): return [''] if self['Signature']: return ['``%s``' % self['Signature']] + [''] else: return [''] def _str_summary(self): return self['Summary'] + [''] def _str_extended_summary(self): return self['Extended Summary'] + [''] def _str_param_list(self, name): out = [] if self[name]: out += self._str_field_list(name) out += [''] for param,param_type,desc in self[name]: out += self._str_indent(['**%s** : %s' % (param.strip(), param_type)]) out += [''] out += self._str_indent(desc,8) out += [''] return out @property def _obj(self): if hasattr(self, '_cls'): return self._cls elif hasattr(self, '_f'): return self._f return None def _str_member_list(self, name): """ Generate a member listing, autosummary:: table where possible, and a table where not. """ out = [] if self[name]: out += ['.. rubric:: %s' % name, ''] prefix = getattr(self, '_name', '') if prefix: prefix = '~%s.' % prefix autosum = [] others = [] for param, param_type, desc in self[name]: param = param.strip() if not self._obj or hasattr(self._obj, param): autosum += [" %s%s" % (prefix, param)] else: others.append((param, param_type, desc)) if autosum: out += ['.. autosummary::', ' :toctree:', ''] out += autosum if others: maxlen_0 = max([len(x[0]) for x in others]) maxlen_1 = max([len(x[1]) for x in others]) hdr = "="*maxlen_0 + " " + "="*maxlen_1 + " " + "="*10 fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1) n_indent = maxlen_0 + maxlen_1 + 4 out += [hdr] for param, param_type, desc in others: out += [fmt % (param.strip(), param_type)] out += self._str_indent(desc, n_indent) out += [hdr] out += [''] return out def _str_section(self, name): out = [] if self[name]: out += self._str_header(name) out += [''] content = textwrap.dedent("\n".join(self[name])).split("\n") out += content out += [''] return out def _str_see_also(self, func_role): out = [] if self['See Also']: see_also = super(SphinxDocString, self)._str_see_also(func_role) out = ['.. seealso::', ''] out += self._str_indent(see_also[2:]) return out def _str_warnings(self): out = [] if self['Warnings']: out = ['.. warning::', ''] out += self._str_indent(self['Warnings']) return out def _str_index(self): idx = self['index'] out = [] if len(idx) == 0: return out out += ['.. index:: %s' % idx.get('default','')] for section, references in idx.iteritems(): if section == 'default': continue elif section == 'refguide': out += [' single: %s' % (', '.join(references))] else: out += [' %s: %s' % (section, ','.join(references))] return out def _str_references(self): out = [] if self['References']: out += self._str_header('References') if isinstance(self['References'], str): self['References'] = [self['References']] out.extend(self['References']) out += [''] # Latex collects all references to a separate bibliography, # so we need to insert links to it if sphinx.__version__ >= "0.6": out += ['.. only:: latex',''] else: out += ['.. latexonly::',''] items = [] for line in self['References']: m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I) if m: items.append(m.group(1)) out += [' ' + ", ".join(["[%s]_" % item for item in items]), ''] return out def _str_examples(self): examples_str = "\n".join(self['Examples']) if (self.use_plots and 'import matplotlib' in examples_str and 'plot::' not in examples_str): out = [] out += self._str_header('Examples') out += ['.. plot::', ''] out += self._str_indent(self['Examples']) out += [''] return out else: return self._str_section('Examples') def __str__(self, indent=0, func_role="obj"): out = [] out += self._str_signature() out += self._str_index() + [''] out += self._str_summary() out += self._str_extended_summary() for param_list in ('Parameters', 'Returns', 'Other Parameters', 'Raises', 'Warns'): out += self._str_param_list(param_list) out += self._str_warnings() out += self._str_see_also(func_role) out += self._str_section('Notes') out += self._str_references() out += self._str_examples() for param_list in ('Attributes', 'Methods'): out += self._str_member_list(param_list) out = self._str_indent(out,indent) return '\n'.join(out) class SphinxFunctionDoc(SphinxDocString, FunctionDoc): def __init__(self, obj, doc=None, config={}): self.use_plots = config.get('use_plots', False) FunctionDoc.__init__(self, obj, doc=doc, config=config) class SphinxClassDoc(SphinxDocString, ClassDoc): def __init__(self, obj, doc=None, func_doc=None, config={}): self.use_plots = config.get('use_plots', False) ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config) class SphinxObjDoc(SphinxDocString): def __init__(self, obj, doc=None, config={}): self._f = obj SphinxDocString.__init__(self, doc, config=config) def get_doc_object(obj, what=None, doc=None, config={}): if what is None: if inspect.isclass(obj): what = 'class' elif inspect.ismodule(obj): what = 'module' elif callable(obj): what = 'function' else: what = 'object' if what == 'class': return SphinxClassDoc(obj, func_doc=SphinxFunctionDoc, doc=doc, config=config) elif what in ('function', 'method'): return SphinxFunctionDoc(obj, doc=doc, config=config) else: if doc is None: doc = pydoc.getdoc(obj) return SphinxObjDoc(obj, doc, config=config) astropy-0.3/astropy/sphinx/__init__.py0000644000175000017500000000041412243255342016321 0ustar oleole""" This package contains utilities and extensions for the Astropy sphinx documentation. In particular, the `astropy.sphinx.conf` should be imported by the sphinx ``conf.py`` file for affiliated packages that wish to make use of the Astropy documentation format. """ astropy-0.3/astropy/sphinx/setup_package.py0000644000175000017500000000044112243255342017375 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst def get_package_data(): # Install the theme files return { 'astropy.sphinx': [ 'ext/templates/*/*', 'themes/bootstrap-astropy/*.*', 'themes/bootstrap-astropy/static/*.*']} astropy-0.3/astropy/sphinx/conf.py0000644000175000017500000002370312243255342015515 0ustar oleole# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # # Astropy shared Sphinx settings. These settings are shared between # astropy itself and affiliated packages. # # Note that not all possible configuration values are present in this file. # # All configuration values have a default; values that are commented out # serve to show the default. import warnings from os import path from distutils.version import LooseVersion import re from ..utils.compat import subprocess # -- General configuration ---------------------------------------------------- # Some of the docs require the autodoc special-members option, in 1.1. # If using graphviz 2.30 or later, Sphinx < 1.2b2 will not work with # it. Unfortunately, there are other problems with Sphinx 1.2b2, so # we need to use "dev" until a release is made post 1.2b2. If # affiliated packages don't want this automatic determination, they # may simply override needs_sphinx in their local conf.py. def get_graphviz_version(): try: output = subprocess.check_output( ['dot', '-V'], stdin=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError: return '0' tokens = output.split() for token in tokens: if re.match(b'[0-9.]*', token): return token.decode('ascii') return '0' graphviz_found = LooseVersion(get_graphviz_version()) graphviz_broken = LooseVersion('0.30') if graphviz_found >= graphviz_broken: needs_sphinx = '1.2b2' else: needs_sphinx = '1.1' # Configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'python': ('http://docs.python.org/', None), 'numpy': ('http://docs.scipy.org/doc/numpy/', None), 'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None), 'matplotlib': ('http://matplotlib.sourceforge.net/', None), 'astropy': ('http://www.astropy.org/', None), 'h5py': ('http://h5py.alfven.org/docs-2.1/', None) } # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # Add any paths that contain templates here, relative to this directory. # templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # The reST default role (used for this markup: `text`) to use for all # documents. Set to the "smart" one. default_role = 'obj' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # This is added to the end of RST files - a good place to put substitutions to # be used globally. rst_epilog = """ .. _Astropy: http://astropy.org """ # -- Project information ------------------------------------------------------ # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. #pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Settings for extensions and extension options ---------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode', 'sphinx.ext.inheritance_diagram', 'astropy.sphinx.ext.numpydoc', 'astropy.sphinx.ext.astropyautosummary', 'astropy.sphinx.ext.automodsumm', 'astropy.sphinx.ext.automodapi', 'astropy.sphinx.ext.tocdepthfix' ] try: import matplotlib.sphinxext.plot_directive extensions += [matplotlib.sphinxext.plot_directive.__name__] # AttributeError is checked here in case matplotlib is installed but # Sphinx isn't. Note that this module is imported by the config file # generator, even if we're not building the docs. except (ImportError, AttributeError): warnings.warn( "matplotlib's plot_directive could not be imported. " + "Inline plots will not be included in the output") # Don't show summaries of the members in each class along with the # class' docstring numpydoc_show_class_members = False autosummary_generate = True automodapi_toctreedirnm = 'api' # -- Options for HTML output ------------------------------------------------- # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [path.abspath(path.join(path.dirname(__file__), 'themes'))] # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'bootstrap-astropy' # Custom sidebar templates, maps document names to template names. html_sidebars = { '**': ['localtoc.html'], 'search': [], 'genindex': [], 'py-modindex': [], } # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. html_favicon = 'astropy_logo.ico' # included in the bootstrap-astropy theme # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%d %b %Y' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # -- Options for LaTeX output ------------------------------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. latex_use_parts = True # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Additional stuff for the LaTeX preamble. latex_preamble = r""" % Use a more modern-looking monospace font \usepackage{inconsolata} % The enumitem package provides unlimited nesting of lists and enums. % Sphinx may use this in the future, in which case this can be removed. % See https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested \usepackage{enumitem} \setlistdepth{15} % In the parameters section, place a newline after the Parameters % header. (This is stolen directly from Numpy's conf.py, since it % affects Numpy-style docstrings). \usepackage{expdlist} \let\latexdescription=\description \def\description{\latexdescription{}{} \breaklabel} % Support the superscript Unicode numbers used by the "unicode" units % formatter \DeclareUnicodeCharacter{2070}{\ensuremath{^0}} \DeclareUnicodeCharacter{00B9}{\ensuremath{^1}} \DeclareUnicodeCharacter{00B2}{\ensuremath{^2}} \DeclareUnicodeCharacter{00B3}{\ensuremath{^3}} \DeclareUnicodeCharacter{2074}{\ensuremath{^4}} \DeclareUnicodeCharacter{2075}{\ensuremath{^5}} \DeclareUnicodeCharacter{2076}{\ensuremath{^6}} \DeclareUnicodeCharacter{2077}{\ensuremath{^7}} \DeclareUnicodeCharacter{2078}{\ensuremath{^8}} \DeclareUnicodeCharacter{2079}{\ensuremath{^9}} \DeclareUnicodeCharacter{207B}{\ensuremath{^-}} \DeclareUnicodeCharacter{00B0}{\ensuremath{^{\circ}}} \DeclareUnicodeCharacter{2032}{\ensuremath{^{\prime}}} \DeclareUnicodeCharacter{2033}{\ensuremath{^{\prime\prime}}} % Make the "warning" and "notes" sections use a sans-serif font to % make them stand out more. \renewenvironment{notice}[2]{ \def\py@noticetype{#1} \csname py@noticestart@#1\endcsname \textsf{\textbf{#2}} }{\csname py@noticeend@\py@noticetype\endcsname} """ # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # -- Options for the linkcheck builder ---------------------------------------- # A timeout value, in seconds, for the linkcheck builder linkcheck_timeout = 60 astropy-0.3/astropy/version_helpers.py0000644000175000017500000001746212243255342016473 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Utilities for generating the version string for Astropy (or an affiliated package) and the version.py module, which contains version info for the package. Within the generated astropy.version module, the `major`, `minor`, and `bugfix` variables hold the respective parts of the version number (bugfix is '0' if absent). The `release` variable is True if this is a release, and False if this is a development version of astropy. For the actual version string, use:: from astropy.version import version or:: from astropy import __version__ """ from __future__ import division import datetime import imp import os import subprocess import sys from distutils import log from warnings import warn def _version_split(version): """ Split a version string into major, minor, and bugfix numbers (with bugfix optional, defaulting to 0). """ for prerel in ('.dev', 'a', 'b', 'rc'): if prerel in version: version = version.split(prerel)[0] versplit = version.split('.') major = int(versplit[0]) minor = int(versplit[1]) bugfix = 0 if len(versplit) < 3 else int(versplit[2]) return major, minor, bugfix def update_git_devstr(version, path=None): """ Updates the git revision string if and only if the path is being imported directly from a git working copy. This ensures that the revision number in the version string is accurate. """ try: # Quick way to determine if we're in git or not - returns '' if not devstr = get_git_devstr(sha=True, show_warning=False, path=path) except OSError: return version if not devstr: # Probably not in git so just pass silently return version if 'dev' in version: # update to the current git revision version_base = version.split('.dev', 1)[0] devstr = get_git_devstr(sha=False, show_warning=False, path=path) return version_base + '.dev' + devstr else: #otherwise it's already the true/release version return version def get_git_devstr(sha=False, show_warning=True, path=None): """ Determines the number of revisions in this repository. Parameters ---------- sha : bool If True, the full SHA1 hash will be returned. Otherwise, the total count of commits in the repository will be used as a "revision number". show_warning : bool If True, issue a warning if git returns an error code, otherwise errors pass silently. path : str or None If a string, specifies the directory to look in to find the git repository. If None, the location of the file this function is in is used to infer the git repository location. If given a filename it uses the directory containing that file. Returns ------- devversion : str Either a string with the revsion number (if `sha` is False), the SHA1 hash of the current commit (if `sha` is True), or an empty string if git version info could not be identified. """ from .utils import find_current_module if path is None: try: mod = find_current_module(1, finddiff=True) path = os.path.abspath(mod.__file__) except (ValueError, AttributeError): path = __file__ if not os.path.isdir(path): path = os.path.abspath(os.path.split(path)[0]) if sha: cmd = 'rev-parse' # Faster for getting just the hash of HEAD else: cmd = 'rev-list' try: p = subprocess.Popen(['git', cmd, 'HEAD'], cwd=path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) stdout, stderr = p.communicate() except OSError as e: if show_warning: warn('Error running git: ' + str(e)) return '' if p.returncode == 128: if show_warning: warn('No git repository present! Using default dev version.') return '' elif p.returncode != 0: if show_warning: warn('Git failed while determining revision count: ' + stderr) return '' if sha: return stdout.decode('utf-8')[:40] else: nrev = stdout.decode('utf-8').count('\n') return str(nrev) # This is used by setup.py to create a new version.py - see that file for # details. Note that the imports have to be absolute, since this is also used # by affiliated packages. _FROZEN_VERSION_PY_TEMPLATE = """ # Autogenerated by {packagename}'s setup.py on {timestamp} from astropy.version_helpers import update_git_devstr, get_git_devstr _last_generated_version = {verstr!r} version = update_git_devstr(_last_generated_version) githash = get_git_devstr(sha=True, show_warning=False) major = {major} minor = {minor} bugfix = {bugfix} release = {rel} debug = {debug} try: from .utils._compiler import compiler except ImportError: compiler = "unknown" try: from .cython_version import cython_version except ImportError: cython_version = "unknown" """[1:] def _get_version_py_str(packagename, version, release, debug): timestamp = str(datetime.datetime.now()) major, minor, bugfix = _version_split(version) if packagename.lower() == 'astropy': packagename = 'Astropy' else: packagename = 'Astropy-affiliated package ' + packagename return _FROZEN_VERSION_PY_TEMPLATE.format(packagename=packagename, timestamp=timestamp, verstr=version, major=major, minor=minor, bugfix=bugfix, rel=release, debug=debug) def generate_version_py(packagename, version, release=None, debug=None): """Regenerate the version.py module if necessary.""" from .setup_helpers import is_distutils_display_option from .utils.compat.misc import invalidate_caches try: version_module = __import__(packagename + '.version', fromlist=['_last_generated_version', 'version', 'release', 'debug']) try: last_generated_version = version_module._last_generated_version except AttributeError: # Older version.py with no _last_generated_version; this will # ensure a new version.py is written last_generated_version = None current_release = version_module.release current_debug = version_module.debug except ImportError: version_module = None last_generated_version = None current_release = None current_debug = None if release is None: # Keep whatever the current value is, if it exists release = bool(current_release) if debug is None: # Likewise, keep whatever the current value is, if it exists debug = bool(current_debug) version_py = os.path.join(packagename, 'version.py') if (last_generated_version != version or current_release != release or current_debug != debug): if '-q' not in sys.argv and '--quiet' not in sys.argv: log.set_threshold(log.INFO) if is_distutils_display_option(): # Always silence unnecessary log messages when display options are # being used log.set_threshold(log.WARN) log.info('Freezing version number to {0}'.format(version_py)) with open(version_py, 'w') as f: # This overwrites the actual version.py f.write(_get_version_py_str(packagename, version, release, debug)) invalidate_caches() if version_module: imp.reload(version_module) astropy-0.3/astropy/logger.py0000644000175000017500000004772112243255342014544 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module defines a logging class based on the built-in logging module""" from __future__ import print_function import os import sys import logging import warnings from contextlib import contextmanager from .config import ConfigurationItem from . import config from .utils.compat import inspect_getmodule from .utils.console import color_print from .utils.misc import find_current_module from .utils.exceptions import AstropyWarning, AstropyUserWarning __all__ = ['log', 'AstropyLogger', 'LoggingError'] # Initialize by calling _init_log() log = None class LoggingError(Exception): """ This exception is for various errors that occur in the astropy logger, typically when activating or deactivating logger-related features. """ class _AstLogIPYExc(Exception): """ An exception that is used only as a placeholder to indicate to the IPython exception-catching mechanism that the astropy exception-capturing is activated. It should not actually be used as an exception anywhere. """ # Read in configuration LOG_LEVEL = ConfigurationItem('log_level', 'INFO', "Threshold for the logging messages. Logging " "messages that are less severe than this level " "will be ignored. The levels are 'DEBUG', " "'INFO', 'WARNING', 'ERROR'") USE_COLOR = ConfigurationItem('use_color', True, "Whether to use color for the level names") LOG_WARNINGS = ConfigurationItem('log_warnings', True, "Whether to log warnings.warn calls") LOG_EXCEPTIONS = ConfigurationItem('log_exceptions', False, "Whether to log exceptions before raising " "them") LOG_TO_FILE = ConfigurationItem('log_to_file', False, "Whether to always log messages to a log " "file") LOG_FILE_PATH = ConfigurationItem('log_file_path', '', "The file to log messages to. When '', " "it defaults to a file 'astropy.log' in " "the astropy config directory.") LOG_FILE_LEVEL = ConfigurationItem('log_file_level', 'INFO', "Threshold for logging messages to " "log_file_path") LOG_FILE_FORMAT = ConfigurationItem('log_file_format', "%(asctime)r, " "%(origin)r, %(levelname)r, %(message)r", "Format for log file entries") def _init_log(): """Initializes the Astropy log--in most circumstances this is called automatically when importing astropy. """ global log orig_logger_cls = logging.getLoggerClass() logging.setLoggerClass(AstropyLogger) try: log = logging.getLogger('astropy') log._set_defaults() finally: logging.setLoggerClass(orig_logger_cls) return log def _teardown_log(): """Shut down exception and warning logging (if enabled) and clear all Astropy loggers from the logging module's cache. This involves poking some logging module interals, so much if it is 'at your own risk' and is allowed to pass silently if any exceptions occur. """ global log if log.exception_logging_enabled(): log.disable_exception_logging() if log.warnings_logging_enabled(): log.disable_warnings_logging() del log # Now for the fun stuff... try: logging._acquireLock() try: loggerDict = logging.Logger.manager.loggerDict for key in loggerDict.keys(): if key == 'astropy' or key.startswith('astropy.'): del loggerDict[key] finally: logging._releaseLock() except: pass Logger = logging.getLoggerClass() class AstropyLogger(Logger): ''' This class is used to set up the Astropy logging. The main functionality added by this class over the built-in logging.Logger class is the ability to keep track of the origin of the messages, the ability to enable logging of warnings.warn calls and exceptions, and the addition of colorized output and context managers to easily capture messages to a file or list. ''' def makeRecord(self, name, level, pathname, lineno, msg, args, exc_info, func=None, extra=None, sinfo=None): if extra is None: extra = {} if 'origin' not in extra: current_module = find_current_module(1, finddiff=[True, 'logging']) if current_module is not None: extra['origin'] = current_module.__name__ else: extra['origin'] = 'unknown' if sys.version_info[0] < 3 or \ (sys.version_info[0] == 3 and sys.version_info[1] < 2): return Logger.makeRecord(self, name, level, pathname, lineno, msg, args, exc_info, func=func, extra=extra) else: return Logger.makeRecord(self, name, level, pathname, lineno, msg, args, exc_info, func=func, extra=extra, sinfo=sinfo) _showwarning_orig = None def _showwarning(self, *args, **kwargs): # Bail out if we are not catching a warning from Astropy if not isinstance(args[0], AstropyWarning): return self._showwarning_orig(*args, **kwargs) warning = args[0] # Deliberately not using isinstance here: We want to display # the class name only when it's not the default class, # AstropyWarning. The name of subclasses of AstropyWarning should # be displayed. if type(warning) not in (AstropyWarning, AstropyUserWarning): message = '{0}: {1}'.format(warning.__class__.__name__, args[0]) else: message = unicode(args[0]) mod_path = args[2] # Now that we have the module's path, we look through # sys.modules to find the module object and thus the # fully-package-specified module name. On Python 2, the # module.__file__ is the compiled file name, not the .py, so # we have to ignore the extension. On Python 3, # module.__file__ is the original source file name, so things # are more direct. mod_name = None if sys.version_info[0] < 3: # pragma: py2 for name, mod in sys.modules.items(): if getattr(mod, '__file__', '') == mod_path: mod_name = mod.__name__ break else: # pragma: py3 mod_path, ext = os.path.splitext(mod_path) for name, mod in sys.modules.items(): path = os.path.splitext(getattr(mod, '__file__', ''))[0] if path == mod_path: mod_name = mod.__name__ break if mod_name is not None: self.warning(message, extra={'origin': mod_name}) else: self.warning(message) def warnings_logging_enabled(self): return self._showwarning_orig is not None def enable_warnings_logging(self): ''' Enable logging of warnings.warn() calls Once called, any subsequent calls to ``warnings.warn()`` are redirected to this logger and emitted with level ``WARN``. Note that this replaces the output from ``warnings.warn``. This can be disabled with ``disable_warnings_logging``. ''' if self.warnings_logging_enabled(): raise LoggingError("Warnings logging has already been enabled") self._showwarning_orig = warnings.showwarning warnings.showwarning = self._showwarning def disable_warnings_logging(self): ''' Disable logging of warnings.warn() calls Once called, any subsequent calls to ``warnings.warn()`` are no longer redirected to this logger. This can be re-enabled with ``enable_warnings_logging``. ''' if not self.warnings_logging_enabled(): raise LoggingError("Warnings logging has not been enabled") if warnings.showwarning != self._showwarning: raise LoggingError("Cannot disable warnings logging: " "warnings.showwarning was not set by this " "logger, or has been overridden") warnings.showwarning = self._showwarning_orig self._showwarning_orig = None _excepthook_orig = None def _excepthook(self, etype, value, traceback): if traceback is None: mod = None else: tb = traceback while tb.tb_next is not None: tb = tb.tb_next mod = inspect_getmodule(tb) # include the the error type in the message. if len(value.args) > 0: message = '{0}: {1}'.format(etype.__name__, str(value)) else: message = unicode(etype.__name__) if mod is not None: self.error(message, extra={'origin': mod.__name__}) else: self.error(message) self._excepthook_orig(etype, value, traceback) def exception_logging_enabled(self): ''' Determine if the exception-logging mechanism is enabled. Returns ------- exclog : bool True if exception logging is on, False if not. ''' try: ip = get_ipython() except NameError: ip = None if ip is None: return self._excepthook_orig is not None else: return _AstLogIPYExc in ip.custom_exceptions def enable_exception_logging(self): ''' Enable logging of exceptions Once called, any uncaught exceptions will be emitted with level ``ERROR`` by this logger, before being raised. This can be disabled with ``disable_exception_logging``. ''' try: ip = get_ipython() except NameError: ip = None if self.exception_logging_enabled(): raise LoggingError("Exception logging has already been enabled") if ip is None: #standard python interpreter self._excepthook_orig = sys.excepthook sys.excepthook = self._excepthook else: #IPython has its own way of dealing with excepthook #We need to locally define the function here, because IPython #actually makes this a member function of their own class def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=None): # First use our excepthook self._excepthook(etype, evalue, tb) # Now also do IPython's traceback ipyshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset) #now register the function with IPython #note that we include _AstLogIPYExc so `disable_exception_logging` #knows that it's disabling the right thing ip.set_custom_exc((BaseException, _AstLogIPYExc), ipy_exc_handler) #and set self._excepthook_orig to a no-op self._excepthook_orig = lambda etype, evalue, tb: None def disable_exception_logging(self): ''' Disable logging of exceptions Once called, any uncaught exceptions will no longer be emitted by this logger. This can be re-enabled with ``enable_exception_logging``. ''' try: ip = get_ipython() except NameError: ip = None if not self.exception_logging_enabled(): raise LoggingError("Exception logging has not been enabled") if ip is None: #standard python interpreter if sys.excepthook != self._excepthook: raise LoggingError("Cannot disable exception logging: " "sys.excepthook was not set by this logger, " "or has been overridden") sys.excepthook = self._excepthook_orig self._excepthook_orig = None else: #IPython has its own way of dealing with exceptions ip.set_custom_exc(tuple(), None) def enable_color(self): ''' Enable colorized output ''' self._use_color = True def disable_color(self): ''' Disable colorized output ''' self._use_color = False def _stream_formatter(self, record): ''' The formatter for standard output ''' if record.levelno < logging.DEBUG or not self._use_color: print(record.levelname, end='') elif(record.levelno < logging.INFO): color_print(record.levelname, 'magenta', end='') elif(record.levelno < logging.WARN): color_print(record.levelname, 'green', end='') elif(record.levelno < logging.ERROR): color_print(record.levelname, 'brown', end='') else: color_print(record.levelname, 'red', end='') record.message = "{0} [{1:s}]".format(record.msg, record.origin) print(": " + record.message) @contextmanager def log_to_file(self, filename, filter_level=None, filter_origin=None): ''' Context manager to temporarily log messages to a file. Parameters ---------- filename : str The file to log messages to. filter_level : str If set, any log messages less important than ``filter_level`` will not be output to the file. Note that this is in addition to the top-level filtering for the logger, so if the logger has level 'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG`` will have no effect, since these messages are already filtered out. filter_origin : str If set, only log messages with an origin starting with ``filter_origin`` will be output to the file. Notes ----- By default, the logger already outputs log messages to a file set in the Astropy configuration file. Using this context manager does not stop log messages from being output to that file, nor does it stop log messages from being printed to standard output. Examples -------- The context manager is used as:: with logger.log_to_file('myfile.log'): # your code here ''' fh = FileHandler(filename) if filter_level is not None: fh.setLevel(filter_level) if filter_origin is not None: fh.addFilter(FilterOrigin(filter_origin)) f = logging.Formatter(LOG_FILE_FORMAT()) fh.setFormatter(f) self.addHandler(fh) yield fh.close() self.removeHandler(fh) @contextmanager def log_to_list(self, filter_level=None, filter_origin=None): ''' Context manager to temporarily log messages to a list. Parameters ---------- filename : str The file to log messages to. filter_level : str If set, any log messages less important than ``filter_level`` will not be output to the file. Note that this is in addition to the top-level filtering for the logger, so if the logger has level 'INFO', then setting ``filter_level`` to ``INFO`` or ``DEBUG`` will have no effect, since these messages are already filtered out. filter_origin : str If set, only log messages with an origin starting with ``filter_origin`` will be output to the file. Notes ----- Using this context manager does not stop log messages from being output to standard output. Examples -------- The context manager is used as:: with logger.log_to_list() as log_list: # your code here ''' lh = ListHandler() if filter_level is not None: lh.setLevel(filter_level) if filter_origin is not None: lh.addFilter(FilterOrigin(filter_origin)) self.addHandler(lh) yield lh.log_list self.removeHandler(lh) def setLevel(self, level): """ Set the logging level of this logger. """ self.level = _checkLevel(level) def _set_defaults(self): ''' Reset logger to its initial state ''' # Reset any previously installed hooks if self.warnings_logging_enabled(): self.disable_warnings_logging() if self.exception_logging_enabled(): self.disable_exception_logging() # Remove all previous handlers for handler in self.handlers[:]: self.removeHandler(handler) # Set levels self.setLevel(LOG_LEVEL()) if USE_COLOR(): self.enable_color() else: self.disable_color() # Set up the stdout handler sh = logging.StreamHandler() sh.emit = self._stream_formatter self.addHandler(sh) # Set up the main log file handler if requested (but this might fail if # configuration directory or log file is not writeable). if LOG_TO_FILE(): log_file_path = LOG_FILE_PATH() # "None" as a string because it comes from config try: _ASTROPY_TEST_ testing_mode = True except NameError: testing_mode = False try: if log_file_path == '' or testing_mode: log_file_path = os.path.join( config.get_config_dir(), "astropy.log") else: log_file_path = os.path.expanduser(log_file_path) fh = FileHandler(log_file_path) except (IOError, OSError) as e: warnings.warn( 'log file {0!r} could not be opened for writing: ' '{1}'.format(log_file_path, unicode(e)), RuntimeWarning) else: formatter = logging.Formatter(LOG_FILE_FORMAT()) fh.setFormatter(formatter) fh.setLevel(LOG_FILE_LEVEL()) self.addHandler(fh) if LOG_WARNINGS(): self.enable_warnings_logging() if LOG_EXCEPTIONS(): self.enable_exception_logging() # The following function is copied from the source code of Python 2.7 and 3.2. # This function is not included in Python 2.6 and 3.1, so we have to include it # here to provide uniform behavior across versions. def _checkLevel(level): ''' ''' if isinstance(level, int): rv = level elif str(level) == level: if level not in logging._levelNames: raise ValueError("Unknown level: %r" % level) rv = logging._levelNames[level] else: raise TypeError("Level not an integer or a valid string: %r" % level) return rv # We now have to be sure that we overload the setLevel in FileHandler, again # for compatibility with Python 2.6 and 3.1. class FileHandler(logging.FileHandler): def setLevel(self, level): """ Set the logging level of this handler. """ self.level = _checkLevel(level) class FilterOrigin(object): '''A filter for the record origin''' def __init__(self, origin): self.origin = origin def filter(self, record): return record.origin.startswith(self.origin) class ListHandler(logging.Handler): '''A handler that can be used to capture the records in a list''' def __init__(self, filter_level=None, filter_origin=None): logging.Handler.__init__(self) self.log_list = [] def emit(self, record): self.log_list.append(record) def setLevel(self, level): """ Set the logging level of this handler. """ self.level = _checkLevel(level) astropy-0.3/astropy/version.py0000644000175000017500000000103412243256466014745 0ustar oleole# Autogenerated by Astropy's setup.py on 2013-11-20 20:09:10.840506 from astropy.version_helpers import update_git_devstr, get_git_devstr _last_generated_version = '0.3' version = update_git_devstr(_last_generated_version) githash = get_git_devstr(sha=True, show_warning=False) major = 0 minor = 3 bugfix = 0 release = True debug = False try: from .utils._compiler import compiler except ImportError: compiler = "unknown" try: from .cython_version import cython_version except ImportError: cython_version = "unknown" astropy-0.3/astropy/convolution/0000755000175000017500000000000012243263747015267 5ustar oleoleastropy-0.3/astropy/convolution/boundary_fill.pyx0000644000175000017500000002262512243255342020661 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np cimport numpy as np DTYPE = np.float ctypedef np.float_t DTYPE_t cdef extern from "numpy/npy_math.h": bint npy_isnan(double x) cimport cython @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve1d_boundary_fill(np.ndarray[DTYPE_t, ndim=1] f, np.ndarray[DTYPE_t, ndim=1] g, float fill_value): if g.shape[0] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int nkx = g.shape[0] cdef int wkx = nkx // 2 cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) cdef unsigned int i, iii cdef int ii cdef int iimin, iimax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): if npy_isnan(f[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): if ii < 0 or ii > nx - 1: val = fill_value else: val = f[ii] if not npy_isnan(val): ker = g[(wkx + ii - i)] top += val * ker bot += ker if bot != 0.: fixed[i] = top / bot else: fixed[i] = f[i] else: fixed[i] = f[i] # Now run the proper convolution for i in range(nx): if not npy_isnan(fixed[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): if ii < 0 or ii > nx - 1: val = fill_value else: val = fixed[ii] ker = g[(wkx + ii - i)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i] = top / bot else: conv[i] = fixed[i] else: conv[i] = fixed[i] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve2d_boundary_fill(np.ndarray[DTYPE_t, ndim=2] f, np.ndarray[DTYPE_t, ndim=2] g, float fill_value): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) cdef unsigned int i, j, iii, jjj cdef int ii, jj cdef int iimin, iimax, jjmin, jjmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): if npy_isnan(f[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: val = fill_value else: val = f[ii, jj] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j)] top += val * ker bot += ker if bot != 0.: fixed[i, j] = top / bot else: fixed[i, j] = f[i, j] else: fixed[i, j] = f[i, j] # Now run the proper convolution for i in range(nx): for j in range(ny): if not npy_isnan(fixed[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: val = fill_value else: val = fixed[ii, jj] ker = g[(wkx + ii - i), (wky + jj - j)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j] = top / bot else: conv[i, j] = fixed[i, j] else: conv[i, j] = fixed[i, j] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve3d_boundary_fill(np.ndarray[DTYPE_t, ndim=3] f, np.ndarray[DTYPE_t, ndim=3] g, float fill_value): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nz = f.shape[2] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int nkz = g.shape[2] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef int wkz = nkz // 2 cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) cdef unsigned int i, j, k, iii, jjj, kkk cdef int ii, jj, kk cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): for k in range(nz): if npy_isnan(f[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: val = fill_value else: val = f[ii, jj, kk] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] top += val * ker bot += ker if bot != 0.: fixed[i, j, k] = top / bot else: fixed[i, j, k] = f[i, j, k] else: fixed[i, j, k] = f[i, j, k] # Now run the proper convolution for i in range(nx): for j in range(ny): for k in range(nz): if not npy_isnan(fixed[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: val = fill_value else: val = fixed[ii, jj, kk] ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j, k] = top / bot else: conv[i, j, k] = fixed[i, j, k] else: conv[i, j, k] = fixed[i, j, k] return conv astropy-0.3/astropy/convolution/core.py0000644000175000017500000002575012243255342016572 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module contains the convolution and filter functionalities of astropy. A few conceptual notes: A filter kernel is mainly characterized by its response function. In the 1D case we speak of "impulse response function", in the 2D case we call it "point spread function". This response function is given for every kernel by an astropy ParametricModel, which is evaluated on a grid to obtain a filter array, which can then be applied to binned data. The model is centered on the array and should have an amplitude such that the array integrates to one per default. Currently only symmetric 2D kernels are supported. """ from __future__ import division import warnings import copy import numpy as np from ..utils.exceptions import AstropyUserWarning from .utils import (discretize_model, add_kernel_arrays_1D, add_kernel_arrays_2D) MAX_NORMALIZATION = 100 class Kernel(object): """ Convolution kernel base class. Parameters ---------- array : ndarray Kernel array. """ _separable = False _is_bool = True _model = None def __init__(self, array): self._array = array self._normalization = 1. / self._array.sum() @property def truncation(self): """ Deviation from the normalization to one. """ return self._truncation @property def is_bool(self): """ Indicates if kernel is bool. If the kernel is bool the multiplication in the convolution could be omitted, to increase the performance. """ return self._is_bool @property def model(self): """ Kernel response model. """ return self._model @property def dimension(self): """ Kernel dimension. """ return self.array.ndim @property def center(self): """ Index of the kernel center. """ return [axes_size // 2 for axes_size in self._array.shape] @property def normalization(self): """ Kernel normalization factor """ return self._normalization def normalize(self, mode='integral'): """ Force normalization of filter kernel. Parameters ---------- mode : str One of the following modes: * 'integral' (default) Kernel normalized such that its integral = 1. * 'peak' Kernel normalized such that its peak = 1. """ # There are kernel that sum to zero and # the user should be warned in this case if np.abs(self._normalization) > MAX_NORMALIZATION: warnings.warn("Normalization factor of kernel is " "exceptionally large > {0}.".format(MAX_NORMALIZATION), AstropyUserWarning) if mode == 'integral': self._array *= self._normalization if mode == 'peak': self._array /= self._array.max() self._normalization = 1. / self._array.sum() @property def shape(self): """ Shape of the kernel array. """ return self._array.shape @property def separable(self): """ Indicates if the filter kernel is separable. A 2D filter is separable, when its filter array can be written as the outer product of two 1D arrays. If a filter kernel is separable, higher dimension convolutions will be performed by applying the 1D filter array consecutively on every dimension. This is significantly faster, than using a filter array with the same dimension. """ return self._separable @property def array(self): """ Filter kernel array. """ return self._array def __add__(self, kernel): """ Add two filter kernels. """ return kernel_arithmetics(self, kernel, 'add') def __sub__(self, kernel): """ Subtract two filter kernels. """ return kernel_arithmetics(self, kernel, 'sub') def __mul__(self, value): """ Multiply kernel with number or convolve two kernels. """ return kernel_arithmetics(self, value, "mul") def __rmul__(self, value): """ Multiply kernel with number or convolve two kernels. """ return kernel_arithmetics(self, value, "mul") def __array__(self): """ Array representation of the kernel. """ return self._array class Kernel1D(Kernel): """ Base class for 1D filter kernels. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. """ def __init__(self, model=None, x_size=None, array=None, **kwargs): # Initialize from model if array is None: if x_size is None: x_size = self._default_size elif x_size != int(x_size): raise TypeError("x_size should be an integer") # Set ranges where to evaluate the model if x_size % 2 == 0: # even kernel x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5) else: # odd kernel x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1) array = discretize_model(self._model, x_range, **kwargs) # Initialize from array elif array is not None: self._model = None else: raise TypeError("Must specify either array or model.") super(Kernel1D, self).__init__(array) class Kernel2D(Kernel): """ Base class for 2D filter kernels. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. y_size : odd int, optional Size in y direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. """ def __init__(self, model=None, x_size=None, y_size=None, array=None, **kwargs): # Initialize from model if array is None: if x_size is None: x_size = self._default_size elif x_size != int(x_size): raise TypeError("x_size should be an integer") if y_size is None: y_size = x_size elif x_size != int(x_size): raise TypeError("y_size should be an integer") # Set ranges where to evaluate the model if x_size % 2 == 0: # even kernel x_range = (-(int(x_size)) // 2 + 0.5, (int(x_size)) // 2 + 0.5) else: # odd kernel x_range = (-(int(x_size) - 1) // 2, (int(x_size) - 1) // 2 + 1) if y_size % 2 == 0: # even kernel y_range = (-(int(y_size)) // 2 + 0.5, (int(y_size)) // 2 + 0.5) else: # odd kernel y_range = (-(int(y_size) - 1) // 2, (int(y_size) - 1) // 2 + 1) array = discretize_model(self._model, x_range, y_range, **kwargs) # Initialize from array elif array is not None: self._model = None else: raise TypeError("Must specify either array or model.") super(Kernel2D, self).__init__(array) def kernel_arithmetics(kernel, value, operation): """ Add, subtract or multiply two kernels. Parameters ---------- kernel : astropy.convolution.kernel Kernel instance values : kernel, float or int Value to operate with operation : str One of the following operations: * 'add' Add two kernels * 'sub' Subtract two kernels * 'mul' Multiply kernel with number or convolve two kernels. """ # 1D kernels if isinstance(kernel, Kernel1D) and isinstance(value, Kernel1D): if operation == "add": new_array = add_kernel_arrays_1D(kernel.array, value.array) if operation == "sub": new_array = add_kernel_arrays_1D(kernel.array, -value.array) if operation == "mul": raise Exception("Kernel operation not supported. Maybe you want to" "use convolve(kernel1, kernel2) instead.") new_kernel = Kernel1D(array=new_array) new_kernel._separable = kernel._separable and value._separable new_kernel._is_bool = kernel._is_bool or value._is_bool # 2D kernels elif isinstance(kernel, Kernel2D) and isinstance(value, Kernel2D): if operation == "add": new_array = add_kernel_arrays_2D(kernel.array, value.array) if operation == "sub": new_array = add_kernel_arrays_2D(kernel.array, -value.array) if operation == "mul": raise Exception("Kernel operation not supported. Maybe you want to" "use convolve(kernel1, kernel2) instead.") new_kernel = Kernel2D(array=new_array) new_kernel._separable = kernel._separable and value._separable new_kernel._is_bool = kernel._is_bool or value._is_bool # kernel and number elif ((isinstance(kernel, Kernel1D) or isinstance(kernel, Kernel2D)) and isinstance(value, (int, float))): if operation == "mul": new_kernel = copy.copy(kernel) new_kernel._array *= value new_kernel._normalization /= value else: raise Exception("Kernel operation not supported.") else: raise Exception("Operations between 1D and 2D kernels are not supported.") return new_kernel astropy-0.3/astropy/convolution/tests/0000755000175000017500000000000012243263747016431 5ustar oleoleastropy-0.3/astropy/convolution/tests/test_kernel_class.py0000644000175000017500000003104612243255342022503 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import numpy as np from numpy.testing import assert_almost_equal from ...tests.helper import pytest from ..convolve import convolve, convolve_fft from ..kernels import ( Gaussian1DKernel, Gaussian2DKernel, Box1DKernel, Box2DKernel, Trapezoid1DKernel, TrapezoidDisk2DKernel, MexicanHat1DKernel, Tophat2DKernel, MexicanHat2DKernel, AiryDisk2DKernel, Ring2DKernel, CustomKernel) from ..utils import KernelSizeError from ...modeling.models import Box2D try: from scipy.ndimage import filters HAS_SCIPY = True except ImportError: HAS_SCIPY = False WIDTHS_ODD = [3, 5, 7, 9] WIDTHS_EVEN = [2, 4, 8, 16] MODES = ['center', 'linear_interp', 'oversample', 'integrate'] KERNEL_TYPES = [Gaussian1DKernel, Gaussian2DKernel, Box1DKernel, Box2DKernel, Trapezoid1DKernel, TrapezoidDisk2DKernel, MexicanHat1DKernel, Tophat2DKernel, AiryDisk2DKernel, Ring2DKernel] # Test data delta_pulse_1D = np.zeros(81) delta_pulse_1D[40] = 1 delta_pulse_2D = np.zeros((81, 81)) delta_pulse_2D[40, 40] = 1 random_data_1D = np.random.rand(61) random_data_2D = np.random.rand(61, 61) class TestKernels(object): """ Test class for the built-in convolution kernels. """ @pytest.mark.skipif('not HAS_SCIPY') @pytest.mark.parametrize(('width'), WIDTHS_ODD) def test_scipy_filter_gaussian(self, width): """ Test GaussianKernel against SciPy ndimage gaussian filter. """ gauss_kernel_1D = Gaussian1DKernel(width) gauss_kernel_1D.normalize() gauss_kernel_2D = Gaussian2DKernel(width) gauss_kernel_2D.normalize() astropy_1D = convolve(delta_pulse_1D, gauss_kernel_1D, boundary='fill') astropy_2D = convolve(delta_pulse_2D, gauss_kernel_2D, boundary='fill') scipy_1D = filters.gaussian_filter(delta_pulse_1D, width) scipy_2D = filters.gaussian_filter(delta_pulse_2D, width) assert_almost_equal(astropy_1D, scipy_1D, decimal=12) assert_almost_equal(astropy_2D, scipy_2D, decimal=12) @pytest.mark.skipif('not HAS_SCIPY') @pytest.mark.parametrize(('width'), WIDTHS_ODD) def test_scipy_filter_gaussian_laplace(self, width): """ Test MexicanHat kernels against SciPy ndimage gaussian laplace filters. """ mexican_kernel_1D = MexicanHat1DKernel(width) mexican_kernel_2D = MexicanHat2DKernel(width) astropy_1D = convolve(delta_pulse_1D, mexican_kernel_1D, boundary='fill') astropy_2D = convolve(delta_pulse_2D, mexican_kernel_2D, boundary='fill') # The Laplace of Gaussian filter is an inverted Mexican Hat # filter. scipy_1D = -filters.gaussian_laplace(delta_pulse_1D, width) scipy_2D = -filters.gaussian_laplace(delta_pulse_2D, width) # There is a slight deviation in the normalization. They differ by a # factor of ~1.0000284132604045. The reason is not known. assert_almost_equal(astropy_1D, scipy_1D, decimal=5) assert_almost_equal(astropy_2D, scipy_2D, decimal=5) @pytest.mark.parametrize(('kernel_type', 'width'), list(itertools.product(KERNEL_TYPES, WIDTHS_ODD))) def test_delta_data(self, kernel_type, width): """ Test smoothing of an image with a single positive pixel """ if kernel_type == AiryDisk2DKernel and not HAS_SCIPY: pytest.skip("Omitting AiryDisk2DKernel, which requires SciPy") if not kernel_type == Ring2DKernel: kernel = kernel_type(width) else: kernel = kernel_type(width, width * 0.2) if kernel.dimension == 1: c1 = convolve_fft(delta_pulse_1D, kernel, boundary='fill') c2 = convolve(delta_pulse_1D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) else: c1 = convolve_fft(delta_pulse_2D, kernel, boundary='fill') c2 = convolve(delta_pulse_2D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) @pytest.mark.parametrize(('kernel_type', 'width'), list(itertools.product(KERNEL_TYPES, WIDTHS_ODD))) def test_random_data(self, kernel_type, width): """ Test smoothing of an image made of random noise """ if kernel_type == AiryDisk2DKernel and not HAS_SCIPY: pytest.skip("Omitting AiryDisk2DKernel, which requires SciPy") if not kernel_type == Ring2DKernel: kernel = kernel_type(width) else: kernel = kernel_type(width, width * 0.2) if kernel.dimension == 1: c1 = convolve_fft(random_data_1D, kernel, boundary='fill') c2 = convolve(random_data_1D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) else: c1 = convolve_fft(random_data_2D, kernel, boundary='fill') c2 = convolve(random_data_2D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) @pytest.mark.parametrize(('width'), WIDTHS_ODD) def test_uniform_smallkernel(self, width): """ Test smoothing of an image with a single positive pixel Instead of using kernel class, uses a simple, small kernel """ kernel = np.ones([width, width]) c2 = convolve_fft(delta_pulse_2D, kernel, boundary='fill') c1 = convolve(delta_pulse_2D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) @pytest.mark.parametrize(('width'), WIDTHS_ODD) def test_smallkernel_vs_Box2DKernel(self, width): """ Test smoothing of an image with a single positive pixel """ kernel1 = np.ones([width, width]) / width ** 2 kernel2 = Box2DKernel(width) c2 = convolve_fft(delta_pulse_2D, kernel2, boundary='fill') c1 = convolve_fft(delta_pulse_2D, kernel1, boundary='fill') assert_almost_equal(c1, c2, decimal=12) def test_convolve_1D_kernels(self): """ Check if convolving two kernels with eachother works correctly. """ gauss_1 = Gaussian1DKernel(3) gauss_2 = Gaussian1DKernel(4) test_gauss_3 = Gaussian1DKernel(5) gauss_3 = convolve(gauss_1, gauss_2) assert np.all(np.abs((gauss_3 - test_gauss_3).array) < 0.01) def test_convolve_2D_kernels(self): """ Check if convolving two kernels with eachother works correctly. """ gauss_1 = Gaussian2DKernel(3) gauss_2 = Gaussian2DKernel(4) test_gauss_3 = Gaussian2DKernel(5) gauss_3 = convolve(gauss_1, gauss_2) assert np.all(np.abs((gauss_3 - test_gauss_3).array) < 0.01) def test_multiply_scalar(self): """ Check if multiplying two kernels with eachother works correctly. """ gauss = 1 * Gaussian1DKernel(3) assert np.all(np.abs(3 * gauss.array - gauss * 3) < 0.000001) def test_custom_1D_kernel(self): """ Check if CustomKernel against Box1DKernel. """ #Define one dimensional array: array = np.ones(5) custom = CustomKernel(array) custom.normalize() box = Box1DKernel(5) c2 = convolve(delta_pulse_1D, custom, boundary='fill') c1 = convolve(delta_pulse_1D, box, boundary='fill') assert_almost_equal(c1, c2, decimal=12) def test_custom_2D_kernel(self): """ Check if CustomKernel against Box1DKernel. """ #Define one dimensional array: array = np.ones((5, 5)) custom = CustomKernel(array) custom.normalize() box = Box2DKernel(5) c2 = convolve(delta_pulse_2D, custom, boundary='fill') c1 = convolve(delta_pulse_2D, box, boundary='fill') assert_almost_equal(c1, c2, decimal=12) def test_custom_1D_kernel_list(self): """ Check if CustomKernel works with lists. """ custom = CustomKernel([1, 1, 1, 1, 1]) assert custom.is_bool == True def test_custom_2D_kernel_list(self): """ Check if CustomKernel works with lists. """ custom = CustomKernel([[1, 1, 1], [1, 1, 1], [1, 1, 1]]) assert custom.is_bool == True def test_custom_kernel_odd_error(self): """ Check if CustomKErnel raises if the array size is odd. """ with pytest.raises(KernelSizeError): custom = CustomKernel([1, 1, 1, 1]) def test_add_1D_kernels(self): """ Check if adding of two 1D kernels works. """ box_1 = Box1DKernel(5) box_2 = Box1DKernel(3) box_3 = Box1DKernel(1) box_sum_1 = box_1 + box_2 + box_3 box_sum_2 = box_2 + box_3 + box_1 box_sum_3 = box_3 + box_1 + box_2 ref = [1/5., 1/5. + 1/3., 1 + 1/3. + 1/5., 1/5. + 1/3., 1/5.] assert_almost_equal(box_sum_1.array, ref, decimal=12) assert_almost_equal(box_sum_2.array, ref, decimal=12) assert_almost_equal(box_sum_3.array, ref, decimal=12) # Assert that the kernels haven't changed assert_almost_equal(box_1.array, [0.2, 0.2, 0.2, 0.2, 0.2], decimal=12) assert_almost_equal(box_2.array, [1/3., 1/3., 1/3.], decimal=12) assert_almost_equal(box_3.array, [1], decimal=12) def test_add_2D_kernels(self): """ Check if adding of two 1D kernels works. """ box_1 = Box2DKernel(3) box_2 = Box2DKernel(1) box_sum_1 = box_1 + box_2 box_sum_2 = box_2 + box_1 ref = [[1 / 9., 1 / 9., 1 / 9.], [1 / 9., 1 + 1 / 9., 1 / 9.], [1 / 9., 1 / 9., 1 / 9.]] ref_1 = [[1 / 9., 1 / 9., 1 / 9.], [1 / 9., 1 / 9., 1 / 9.], [1 / 9., 1 / 9., 1 / 9.]] assert_almost_equal(box_2.array, [[1]], decimal=12) assert_almost_equal(box_1.array, ref_1, decimal=12) assert_almost_equal(box_sum_1.array, ref, decimal=12) assert_almost_equal(box_sum_2.array, ref, decimal=12) def test_Gaussian1DKernel_even_size(self): """ Check if even size for GaussianKernel works. """ gauss = Gaussian1DKernel(3, x_size=10) assert gauss.array.size == 10 def test_Gaussian2DKernel_even_size(self): """ Check if even size for GaussianKernel works. """ gauss = Gaussian2DKernel(3, x_size=10, y_size=10) assert gauss.array.shape == (10, 10) def test_normalize_peak(self): """ Check if normalize works with peak mode. """ custom = CustomKernel([1, 2, 3, 2, 1]) custom.normalize(mode='peak') assert custom.array.max() == 1 def test_check_kernel_attributes(self): """ Check if kernel attributes are correct. """ box = Box2DKernel(5) # Check truncation assert box.truncation == 0 # Check model assert isinstance(box.model, Box2D) # Check center assert box.center == [2, 2] # Check normalization assert_almost_equal(box.normalization, 1., decimal=12) # Check seperability assert box.separable @pytest.mark.parametrize(('kernel_type', 'mode'), list(itertools.product(KERNEL_TYPES, MODES))) def test_dicretize_modes(self, kernel_type, mode): """ Check if the different modes result in kernels that work with convolve. Use only small kernel width, to make the test pass quickly. """ if kernel_type == AiryDisk2DKernel and not HAS_SCIPY: pytest.skip("Omitting AiryDisk2DKernel, which requires SciPy") if not kernel_type == Ring2DKernel: kernel = kernel_type(3) else: kernel = kernel_type(3, 3 * 0.2) if kernel.dimension == 1: c1 = convolve_fft(delta_pulse_1D, kernel, boundary='fill') c2 = convolve(delta_pulse_1D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) else: c1 = convolve_fft(delta_pulse_2D, kernel, boundary='fill') c2 = convolve(delta_pulse_2D, kernel, boundary='fill') assert_almost_equal(c1, c2, decimal=12) @pytest.mark.parametrize(('width'), WIDTHS_EVEN) def test_box_kernels_even_size(self, width): """ Check if BoxKernel work properly with even sizes. """ kernel_1D = Box1DKernel(width) assert kernel_1D.shape[0] % 2 != 0 assert kernel_1D.array.sum() == 1. kernel_2D = Box2DKernel(width) assert np.all([_ % 2 != 0 for _ in kernel_2D.shape]) assert kernel_2D.array.sum() == 1. astropy-0.3/astropy/convolution/tests/test_convolve.py0000644000175000017500000004406412243255342021675 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from ...tests.helper import pytest from ..convolve import convolve from numpy.testing import assert_array_almost_equal_nulp VALID_DTYPES = [] for dtype_array in ['>f4', 'f8', 'f4', 'f8', 'f4', 'f8', 'f4', 'f8', 'x,z,x))*2 ) @pytest.mark.parametrize(option_names, options) def test_uniform_3x3(self, boundary, interpolate_nan, normalize_kernel, ignore_edge_zeros): ''' Test that the different modes are producing the correct results using a 3x3 uniform kernel. ''' x = np.array([[0., 0., 3.], [1., 0., 0.], [0., 2., 0.]], dtype='float64') y = np.array([[1., 1., 1.], [1., 1., 1.], [1., 1., 1.]], dtype='float64') z = convolve_fft(x, y, boundary=boundary, interpolate_nan=interpolate_nan, normalize_kernel=normalize_kernel, ignore_edge_zeros=ignore_edge_zeros) w = np.array([[4., 6., 4.], [6., 9., 6.], [4., 6., 4.]], dtype='float64') answer_dict = { 'sum': np.array([[1., 4., 3.], [3., 6., 5.], [3., 3., 2.]], dtype='float64'), 'sum_wrap': np.array([[6., 6., 6.], [6., 6., 6.], [6., 6., 6.]], dtype='float64'), } answer_dict['average'] = answer_dict['sum'] / w answer_dict['average_wrap'] = answer_dict['sum_wrap'] / 9. answer_dict['average_withzeros'] = answer_dict['sum'] / 9. answer_dict['sum_withzeros'] = answer_dict['sum'] if normalize_kernel: answer_key = 'average' else: answer_key = 'sum' if boundary == 'wrap': answer_key += '_wrap' elif not ignore_edge_zeros: answer_key += '_withzeros' a = answer_dict[answer_key] print boundary, interpolate_nan, normalize_kernel, ignore_edge_zeros, answer_key print "z: ", z print "answer: ", a print "ratio: ", z / a # for reasons unknown, the Windows FFT returns an answer for the [0,0] # component that is EXACTLY 10*np.spacing assert np.all(np.abs(z - a) <= np.spacing(np.where(z > a, z, a)) * 10) @pytest.mark.parametrize(option_names, options) def test_unity_3x3_withnan(self, boundary, interpolate_nan, normalize_kernel, ignore_edge_zeros): ''' Test that a 3x3 unit kernel returns the same array (except when boundary is None). This version includes a NaN value in the original array. ''' x = np.array([[1., 2., 3.], [4., np.nan, 6.], [7., 8., 9.]], dtype='float64') y = np.array([[0., 0., 0.], [0., 1., 0.], [0., 0., 0.]], dtype='float64') z = convolve_fft(x, y, boundary=boundary, interpolate_nan=interpolate_nan, normalize_kernel=normalize_kernel, ignore_edge_zeros=ignore_edge_zeros, ) a = x a[1, 1] = 0 # for whatever reason, numpy's fft has very limited precision, and # the comparison fails unless you cast the float64 to a float16 if hasattr(np, 'float16'): assert_array_almost_equal_nulp(np.asarray(z, dtype=np.float16), np.asarray(a, dtype=np.float16), 10) assert np.all(np.abs(z - a) < 1e-14) @pytest.mark.parametrize(option_names, options) def test_uniform_3x3_withnan(self, boundary, interpolate_nan, normalize_kernel, ignore_edge_zeros): ''' Test that the different modes are producing the correct results using a 3x3 uniform kernel. This version includes a NaN value in the original array. ''' x = np.array([[0., 0., 3.], [1., np.nan, 0.], [0., 2., 0.]], dtype='float64') y = np.array([[1., 1., 1.], [1., 1., 1.], [1., 1., 1.]], dtype='float64') z = convolve_fft(x, y, boundary=boundary, interpolate_nan=interpolate_nan, normalize_kernel=normalize_kernel, ignore_edge_zeros=ignore_edge_zeros, ) w_n = np.array([[3., 5., 3.], [5., 8., 5.], [3., 5., 3.]], dtype='float64') w_z = np.array([[4., 6., 4.], [6., 9., 6.], [4., 6., 4.]], dtype='float64') answer_dict = { 'sum': np.array([[1., 4., 3.], [3., 6., 5.], [3., 3., 2.]], dtype='float64'), 'sum_wrap': np.array([[6., 6., 6.], [6., 6., 6.], [6., 6., 6.]], dtype='float64'), } answer_dict['average'] = answer_dict['sum'] / w_z answer_dict['average_ignan'] = answer_dict['sum'] / w_n answer_dict['average_wrap_ignan'] = answer_dict['sum_wrap'] / 8. answer_dict['average_wrap'] = answer_dict['sum_wrap'] / 9. answer_dict['average_withzeros'] = answer_dict['sum'] / 9. answer_dict['average_withzeros_ignan'] = answer_dict['sum'] / 8. answer_dict['sum_withzeros'] = answer_dict['sum'] answer_dict['sum_ignan'] = answer_dict['sum'] answer_dict['sum_withzeros_ignan'] = answer_dict['sum'] answer_dict['sum_wrap_ignan'] = answer_dict['sum_wrap'] if normalize_kernel: answer_key = 'average' else: answer_key = 'sum' if boundary == 'wrap': answer_key += '_wrap' elif not ignore_edge_zeros: answer_key += '_withzeros' if interpolate_nan: answer_key += '_ignan' a = answer_dict[answer_key] print boundary, interpolate_nan, normalize_kernel, ignore_edge_zeros, answer_key print "z: ", z print "answer: ", a print "ratio: ", z / a # for reasons unknown, the Windows FFT returns an answer for the [0,0] # component that is EXACTLY 10*np.spacing assert np.all(np.abs(z - a) <= np.spacing(np.where(z > a, z, a)) * 10) astropy-0.3/astropy/convolution/tests/test_discretize.py0000644000175000017500000000701212243255342022177 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import numpy as np from numpy.testing import assert_allclose from ...tests.helper import pytest from ..utils import discretize_model from ...modeling.functional_models import ( Gaussian1D, Box1D, MexicanHat1D, Trapezoid1D, Gaussian2D, Box2D, MexicanHat2D) from ...modeling.tests.example_models import models_1D, models_2D from ...modeling.tests.test_models import create_model try: import scipy HAS_SCIPY = True except ImportError: HAS_SCIPY = False modes = ['center', 'linear_interp', 'oversample'] test_models_1D = [Gaussian1D, Box1D, MexicanHat1D] test_models_2D = [Gaussian2D, Box2D, MexicanHat2D] @pytest.mark.parametrize(('model_class', 'mode'), list(itertools.product(test_models_1D, modes))) def test_pixel_sum_1D(model_class, mode): """ Test if the sum of all pixels corresponds nearly to the integral. """ if model_class == Box1D and mode == "center": pytest.skip("Non integrating mode. Skip integral test.") parameters = models_1D[model_class]['parameters'] model = create_model(model_class, parameters) values = discretize_model(model, models_1D[model_class]['x_lim'], mode=mode) assert_allclose(values.sum(), models_1D[model_class]['integral'], atol=0.0001) @pytest.mark.parametrize('mode', modes) def test_gaussian_eval_1D(mode): """ Discretize Gaussian with different modes and check if result is at least similar to Gaussian1D.eval(). """ model = Gaussian1D(1, 0, 20) x = np.arange(-100, 101) values = model(x) disc_values = discretize_model(model, (-100, 101), mode=mode) assert_allclose(values, disc_values, atol=0.001) @pytest.mark.parametrize(('model_class', 'mode'), list(itertools.product(test_models_2D, modes))) def test_pixel_sum_2D(model_class, mode): """ Test if the sum of all pixels corresponds nearly to the integral. """ if model_class == Box2D and mode == "center": pytest.skip("Non integrating mode. Skip integral test.") parameters = models_2D[model_class]['parameters'] model = create_model(model_class, parameters) values = discretize_model(model, models_2D[model_class]['x_lim'], models_2D[model_class]['y_lim'], mode=mode) assert_allclose(values.sum(), models_2D[model_class]['integral'], atol=0.0001) @pytest.mark.parametrize('mode', modes) def test_gaussian_eval_2D(mode): """ Discretize Gaussian with different modes and check if result is at least similar to Gaussian1D.eval() """ model = Gaussian2D(1, 0, 0, 20, 20) x = np.arange(-100, 101) y = np.arange(-100, 101) y, x = np.meshgrid(y, x) values = model(x, y) disc_values = discretize_model(model, (-100, 101), (-100, 101), mode=mode) assert_allclose(values, disc_values, atol=0.001) @pytest.mark.skipif('not HAS_SCIPY') def test_subpixel_gauss_1D(): """ Test subpixel accuracy of the oversample mode with gaussian 1D model. """ gauss_1D = Gaussian1D(1, 0, 0.1) values = discretize_model(gauss_1D, (-1, 2), mode='integrate', factor=100) assert_allclose(values.sum(), np.sqrt(2 * np.pi) * 0.1, atol=0.00001) @pytest.mark.skipif('not HAS_SCIPY') def test_subpixel_gauss_2D(): """ Test subpixel accuracy of the oversample mode with gaussian 2D model. """ gauss_2D = Gaussian2D(1, 0, 0, 0.1, 0.1) values = discretize_model(gauss_2D, (-1, 2), (-1, 2), mode='integrate', factor=100) assert_allclose(values.sum(), 2 * np.pi * 0.01, atol=0.00001) astropy-0.3/astropy/convolution/tests/test_convolve_speeds.py0000644000175000017500000002754712243255342023247 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import print_function import timeit import numpy as np # pylint: disable=W0611 # largest image size to use for "linear" and fft convolutions max_exponents_linear = {1: 15, 2: 7, 3: 5} max_exponents_fft = {1: 15, 2: 10, 3: 7} if __name__ == "__main__": for ndims in [1, 2, 3]: print("\n%i-dimensional arrays ('n' is the size of the image AND the kernel)" % ndims) print(" ".join(["%17s" % n for n in ("n", "convolve", "convolve_fft")])) for ii in range(3, max_exponents_fft[ndims]): # array = np.random.random([2**ii]*ndims) # test ODD sizes too if ii < max_exponents_fft[ndims]: setup = (""" import numpy as np from astropy.convolution.convolve import convolve from astropy.convolution.convolve import convolve_fft array = np.random.random([%i]*%i) kernel = np.random.random([%i]*%i)""") % (2 ** ii - 1, ndims, 2 ** ii - 1, ndims) print("%16i:" % (int(2 ** ii - 1)), end=' ') if ii <= max_exponents_linear[ndims]: for ffttype, extra in zip(("", "_fft"), ("", "fft_pad=False")): statement = "convolve%s(array, kernel, boundary='fill', %s)" % (ffttype, extra) besttime = min(timeit.Timer(stmt=statement, setup=setup).repeat(3, 10)) print("%17f" % (besttime), end=' ') else: print("%17s" % "skipped", end=' ') statement = "convolve_fft(array, kernel, boundary='fill')" besttime = min(timeit.Timer(stmt=statement, setup=setup).repeat(3, 10)) print("%17f" % (besttime), end=' ') print() setup = (""" import numpy as np from astropy.convolution.convolve import convolve from astropy.convolution.convolve import convolve_fft array = np.random.random([%i]*%i) kernel = np.random.random([%i]*%i)""") % (2 ** ii - 1, ndims, 2 ** ii - 1, ndims) print("%16i:" % (int(2 ** ii)), end=' ') if ii <= max_exponents_linear[ndims]: for ffttype in ("", "_fft"): statement = "convolve%s(array, kernel, boundary='fill')" % ffttype besttime = min(timeit.Timer(stmt=statement, setup=setup).repeat(3, 10)) print("%17f" % (besttime), end=' ') else: print("%17s" % "skipped", end=' ') statement = "convolve_fft(array, kernel, boundary='fill')" besttime = min(timeit.Timer(stmt=statement, setup=setup).repeat(3, 10)) print("%17f" % (besttime), end=' ') print() """ Unfortunately, these tests are pretty strongly inconclusive RESULTS on a 2011 Mac Air: 1-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.000408 0.002334 0.005571 0.002677 8: 0.000399 0.002818 0.006505 0.003094 15: 0.000361 0.002491 0.005648 0.002678 16: 0.000371 0.002997 0.005983 0.003036 31: 0.000535 0.002450 0.005988 0.002880 32: 0.000452 0.002618 0.007102 0.004366 63: 0.000509 0.002876 0.008003 0.002981 64: 0.000453 0.002706 0.005520 0.003049 127: 0.000801 0.004080 0.008513 0.003932 128: 0.000749 0.003332 0.006236 0.003159 255: 0.002453 0.003111 0.007518 0.003564 256: 0.002478 0.003341 0.006325 0.004290 511: 0.008394 0.006224 0.010247 0.005991 512: 0.007934 0.003764 0.006840 0.004106 1023: 0.028741 0.007538 0.009591 0.007696 1024: 0.027900 0.004871 0.009628 0.005118 2047: 0.106323 0.021575 0.022041 0.020682 2048: 0.108916 0.008107 0.011049 0.007596 4095: 0.411936 0.021675 0.019761 0.020939 4096: 0.408992 0.018870 0.016663 0.012890 8191: 1.664517 8.278320 0.073001 7.803563 8192: 1.657573 0.037967 0.034227 0.028390 16383: 6.654678 0.251661 0.202271 0.222171 16384: 6.611977 0.073630 0.067616 0.055591 2-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.000552 0.003524 0.006667 0.004318 8: 0.000646 0.004443 0.007354 0.003958 15: 0.002986 0.005093 0.012941 0.005951 16: 0.003549 0.005688 0.008818 0.006300 31: 0.074360 0.033973 0.031800 0.036937 32: 0.077338 0.017708 0.025637 0.011883 63: 0.848471 0.057407 0.052192 0.053213 64: 0.773061 0.029657 0.033409 0.028230 127: 14.656414 1.005329 0.402113 0.955279 128: 15.867796 0.266233 0.268551 0.237930 255: skipped 1.715546 1.566876 1.745338 256: skipped 1.515616 1.268220 1.036881 511: skipped 4.066155 4.303350 3.930661 512: skipped 3.976139 4.337525 3.968935 3-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.009239 0.012957 0.011957 0.015997 8: 0.012405 0.011328 0.011677 0.012283 15: 0.772434 0.075621 0.056711 0.079508 16: 0.964635 0.105846 0.072811 0.104611 31: 62.824051 2.295193 1.189505 2.351136 32: 79.507060 1.169182 0.821779 1.275770 63: skipped 11.250225 10.982726 10.585744 64: skipped 10.013558 11.507645 12.665557 On a 2009 Mac Pro: 1-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.000360 0.002269 0.004986 0.002476 8: 0.000361 0.002468 0.005242 0.002696 15: 0.000364 0.002255 0.005244 0.002471 16: 0.000365 0.002506 0.005286 0.002727 31: 0.000385 0.002380 0.005422 0.002588 32: 0.000385 0.002531 0.005543 0.002737 63: 0.000474 0.002407 0.005392 0.002637 64: 0.000484 0.002602 0.005631 0.002823 127: 0.000752 0.004122 0.007827 0.003966 128: 0.000757 0.002763 0.005844 0.002958 255: 0.004316 0.003258 0.006566 0.003324 256: 0.004354 0.003180 0.006120 0.003245 511: 0.011517 0.007158 0.009898 0.006238 512: 0.011482 0.003873 0.006777 0.003820 1023: 0.034105 0.009211 0.009468 0.008260 1024: 0.034609 0.005504 0.008399 0.005080 2047: 0.113620 0.028097 0.020662 0.021603 2048: 0.112828 0.008403 0.010939 0.007331 4095: 0.403373 0.023211 0.018767 0.020065 4096: 0.403316 0.017550 0.017853 0.013651 8191: 1.519329 8.454573 0.211436 7.212381 8192: 1.519082 0.033148 0.030370 0.025905 16383: 5.887481 0.317428 0.153344 0.237119 16384: 5.888222 0.069379 0.065264 0.052847 2-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.000474 0.003470 0.006131 0.003503 8: 0.000503 0.003565 0.006400 0.003586 15: 0.002011 0.004481 0.007825 0.004496 16: 0.002236 0.004744 0.007078 0.004680 31: 0.027291 0.019433 0.014841 0.018034 32: 0.029283 0.009244 0.010161 0.008964 63: 0.445680 0.038171 0.026753 0.037404 64: 0.460616 0.028128 0.029487 0.029149 127: 7.003774 0.925921 0.282591 0.762671 128: 7.063657 0.110838 0.104402 0.133523 255: skipped 0.804682 0.708849 0.869368 256: skipped 0.797800 0.721042 0.880848 511: skipped 3.643626 3.687562 4.584770 512: skipped 3.715215 4.893539 5.538462 3-dimensional arrays ('n' is the size of the image AND the kernel) n convolve convolve_fftnp convolve_fftw convolve_fftsp 7: 0.004520 0.011519 0.009464 0.012335 8: 0.006422 0.010294 0.010220 0.011711 15: 0.329566 0.060978 0.045495 0.073692 16: 0.405275 0.069999 0.040659 0.086114 31: 24.935228 1.654920 0.710509 1.773879 32: 27.524226 0.724053 0.543507 1.027568 63: skipped 8.982771 12.407683 16.900078 64: skipped 8.956070 11.934627 17.296447 """ astropy-0.3/astropy/convolution/boundary_wrap.c0000644000175000017500000131233612243255473020315 0ustar oleole/* Generated by Cython 0.18 on Wed Nov 20 19:59:43 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__astropy__convolution__boundary_wrap #define __PYX_HAVE_API__astropy__convolution__boundary_wrap #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "boundary_wrap.pyx", "numpy.pxd", "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "astropy/convolution/boundary_wrap.pyx":7 * * DTYPE = np.float * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<< * * cdef extern from "numpy/npy_math.h": */ typedef __pyx_t_5numpy_float_t __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */ #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'astropy.convolution.boundary_wrap' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "astropy.convolution.boundary_wrap" int __pyx_module_is_main_astropy__convolution__boundary_wrap = 0; /* Implementation of 'astropy.convolution.boundary_wrap' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_convolve1d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_2convolve2d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_4convolve3d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Convolution kernel must have odd dimensions"; static char __pyx_k_5[] = "ndarray is not C contiguous"; static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; static char __pyx_k_9[] = "Non-native byte order not supported"; static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_15[] = "Format string allocated too short."; static char __pyx_k_19[] = "convolve1d_boundary_wrap"; static char __pyx_k_20[] = "/internal/1/root/src/astropy/astropy-release/astropy/convolution/boundary_wrap.pyx"; static char __pyx_k_21[] = "astropy.convolution.boundary_wrap"; static char __pyx_k_24[] = "convolve2d_boundary_wrap"; static char __pyx_k_27[] = "convolve3d_boundary_wrap"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__ii[] = "ii"; static char __pyx_k__jj[] = "jj"; static char __pyx_k__kk[] = "kk"; static char __pyx_k__np[] = "np"; static char __pyx_k__nx[] = "nx"; static char __pyx_k__ny[] = "ny"; static char __pyx_k__nz[] = "nz"; static char __pyx_k__bot[] = "bot"; static char __pyx_k__iii[] = "iii"; static char __pyx_k__jjj[] = "jjj"; static char __pyx_k__ker[] = "ker"; static char __pyx_k__kkk[] = "kkk"; static char __pyx_k__nkx[] = "nkx"; static char __pyx_k__nky[] = "nky"; static char __pyx_k__nkz[] = "nkz"; static char __pyx_k__top[] = "top"; static char __pyx_k__val[] = "val"; static char __pyx_k__wkx[] = "wkx"; static char __pyx_k__wky[] = "wky"; static char __pyx_k__wkz[] = "wkz"; static char __pyx_k__conv[] = "conv"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__empty[] = "empty"; static char __pyx_k__fixed[] = "fixed"; static char __pyx_k__float[] = "float"; static char __pyx_k__iimax[] = "iimax"; static char __pyx_k__iimin[] = "iimin"; static char __pyx_k__jjmax[] = "jjmax"; static char __pyx_k__jjmin[] = "jjmin"; static char __pyx_k__kkmax[] = "kkmax"; static char __pyx_k__kkmin[] = "kkmin"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_n_s_19; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_n_s_21; static PyObject *__pyx_n_s_24; static PyObject *__pyx_n_s_27; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__bot; static PyObject *__pyx_n_s__conv; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__empty; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__fixed; static PyObject *__pyx_n_s__float; static PyObject *__pyx_n_s__g; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__ii; static PyObject *__pyx_n_s__iii; static PyObject *__pyx_n_s__iimax; static PyObject *__pyx_n_s__iimin; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__jj; static PyObject *__pyx_n_s__jjj; static PyObject *__pyx_n_s__jjmax; static PyObject *__pyx_n_s__jjmin; static PyObject *__pyx_n_s__k; static PyObject *__pyx_n_s__ker; static PyObject *__pyx_n_s__kk; static PyObject *__pyx_n_s__kkk; static PyObject *__pyx_n_s__kkmax; static PyObject *__pyx_n_s__kkmin; static PyObject *__pyx_n_s__nkx; static PyObject *__pyx_n_s__nky; static PyObject *__pyx_n_s__nkz; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__nx; static PyObject *__pyx_n_s__ny; static PyObject *__pyx_n_s__nz; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__top; static PyObject *__pyx_n_s__val; static PyObject *__pyx_n_s__wkx; static PyObject *__pyx_n_s__wky; static PyObject *__pyx_n_s__wkz; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_codeobj_18; static PyObject *__pyx_k_codeobj_23; static PyObject *__pyx_k_codeobj_26; /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_1convolve1d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_wrap_1convolve1d_boundary_wrap = {__Pyx_NAMESTR("convolve1d_boundary_wrap"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_wrap_1convolve1d_boundary_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_1convolve1d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve1d_boundary_wrap (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_wrap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve1d_boundary_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve1d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_wrap_convolve1d_boundary_wrap(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_wrap.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_wrap(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_convolve1d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_nkx; int __pyx_v_wkx; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_iii; int __pyx_v_ii; int __pyx_v_iimin; int __pyx_v_iimax; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; unsigned int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; unsigned int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve1d_boundary_wrap", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; /* "astropy/convolution/boundary_wrap.pyx":19 * np.ndarray[DTYPE_t, ndim=1] g): * * if g.shape[0] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (__pyx_t_1) { /* "astropy/convolution/boundary_wrap.pyx":20 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_wrap.pyx":22 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_1; } if (unlikely(!__pyx_t_6)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_wrap.pyx":24 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":25 * * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":26 * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_wrap.pyx":27 * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) * cdef unsigned int i, iii */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_wrap.pyx":28 * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, iii * cdef int ii */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "astropy/convolution/boundary_wrap.pyx":38 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * if npy_isnan(f[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_wrap.pyx":39 * # neighboring values * for i in range(nx): * if npy_isnan(f[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_12 = __pyx_v_i; __pyx_t_6 = npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_f.diminfo[0].strides))); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":40 * for i in range(nx): * if npy_isnan(f[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":41 * if npy_isnan(f[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":42 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":43 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * iii = ii % nx */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":44 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * iii = ii % nx * val = f[iii] */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_wrap.pyx":45 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * iii = ii % nx # <<<<<<<<<<<<<< * val = f[iii] * if not npy_isnan(val): */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":46 * for ii in range(iimin, iimax): * iii = ii % nx * val = f[iii] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i)] */ __pyx_t_15 = __pyx_v_iii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f.diminfo[0].strides)); /* "astropy/convolution/boundary_wrap.pyx":47 * iii = ii % nx * val = f[iii] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * top += val * ker */ __pyx_t_6 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":48 * val = f[iii] * if not npy_isnan(val): * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_16 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_wrap.pyx":49 * if not npy_isnan(val): * ker = g[(wkx + ii - i)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":50 * ker = g[(wkx + ii - i)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L9; } __pyx_L9:; } /* "astropy/convolution/boundary_wrap.pyx":52 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i] = top / bot * else: */ __pyx_t_6 = (__pyx_v_bot != 0.); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":53 * * if bot != 0.: * fixed[i] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_fixed.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":55 * fixed[i] = top / bot * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L10:; goto __pyx_L6; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":57 * fixed[i] = f[i] * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_20 = __pyx_v_i; __pyx_t_21 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L6:; } /* "astropy/convolution/boundary_wrap.pyx":60 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_wrap.pyx":61 * # Now run the proper convolution * for i in range(nx): * if not npy_isnan(fixed[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_22 = __pyx_v_i; __pyx_t_6 = (!npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_fixed.diminfo[0].strides)))); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":62 * for i in range(nx): * if not npy_isnan(fixed[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":63 * if not npy_isnan(fixed[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":64 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":65 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * iii = ii % nx */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":66 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * iii = ii % nx * val = fixed[iii] */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_wrap.pyx":67 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * iii = ii % nx # <<<<<<<<<<<<<< * val = fixed[iii] * ker = g[(wkx + ii - i)] */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":68 * for ii in range(iimin, iimax): * iii = ii % nx * val = fixed[iii] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * if not npy_isnan(val): */ __pyx_t_23 = __pyx_v_iii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_fixed.diminfo[0].strides)); /* "astropy/convolution/boundary_wrap.pyx":69 * iii = ii % nx * val = fixed[iii] * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_24 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_wrap.pyx":70 * val = fixed[iii] * ker = g[(wkx + ii - i)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_6 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":71 * ker = g[(wkx + ii - i)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":72 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L16; } __pyx_L16:; } /* "astropy/convolution/boundary_wrap.pyx":73 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i] = top / bot * else: */ __pyx_t_6 = (__pyx_v_bot != 0.0); if (__pyx_t_6) { /* "astropy/convolution/boundary_wrap.pyx":74 * bot += ker * if bot != 0: * conv[i] = top / bot # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_25 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_conv.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L17; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":76 * conv[i] = top / bot * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L17:; goto __pyx_L13; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":78 * conv[i] = fixed[i] * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L13:; } /* "astropy/convolution/boundary_wrap.pyx":80 * conv[i] = fixed[i] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve1d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_3convolve2d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_wrap_3convolve2d_boundary_wrap = {__Pyx_NAMESTR("convolve2d_boundary_wrap"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_wrap_3convolve2d_boundary_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_3convolve2d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve2d_boundary_wrap (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_wrap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve2d_boundary_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve2d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_wrap_2convolve2d_boundary_wrap(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_wrap.pyx":84 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_wrap(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_2convolve2d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_wkx; int __pyx_v_wky; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_iii; unsigned int __pyx_v_jjj; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; int __pyx_t_12; unsigned int __pyx_t_13; unsigned int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve2d_boundary_wrap", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; /* "astropy/convolution/boundary_wrap.pyx":87 * np.ndarray[DTYPE_t, ndim=2] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "astropy/convolution/boundary_wrap.pyx":88 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_wrap.pyx":90 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) { __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_wrap.pyx":92 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":93 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_wrap.pyx":94 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":95 * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_wrap.pyx":96 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_wrap.pyx":97 * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_wrap.pyx":98 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) * cdef unsigned int i, j, iii, jjj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_wrap.pyx":99 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, iii, jjj * cdef int ii, jj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_wrap.pyx":109 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if npy_isnan(f[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_wrap.pyx":110 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_wrap.pyx":111 * for i in range(nx): * for j in range(ny): * if npy_isnan(f[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_14 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; __pyx_t_2 = npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_f.diminfo[1].strides))); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":112 * for j in range(ny): * if npy_isnan(f[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":113 * if npy_isnan(f[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":114 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":115 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":116 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_wrap.pyx":117 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_wrap.pyx":118 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * iii = ii % nx */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_wrap.pyx":119 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * iii = ii % nx * jjj = jj % ny */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_wrap.pyx":120 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * iii = ii % nx # <<<<<<<<<<<<<< * jjj = jj % ny * val = f[iii, jjj] */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":121 * for jj in range(jjmin, jjmax): * iii = ii % nx * jjj = jj % ny # <<<<<<<<<<<<<< * val = f[iii, jjj] * if not npy_isnan(val): */ if (unlikely(__pyx_v_ny == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_jjj = __Pyx_mod_int(__pyx_v_jj, __pyx_v_ny); /* "astropy/convolution/boundary_wrap.pyx":122 * iii = ii % nx * jjj = jj % ny * val = f[iii, jjj] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_20 = __pyx_v_iii; __pyx_t_21 = __pyx_v_jjj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_f.diminfo[1].strides)); /* "astropy/convolution/boundary_wrap.pyx":123 * jjj = jj % ny * val = f[iii, jjj] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":125 * if not npy_isnan(val): * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_22 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_23 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_wrap.pyx":126 * ker = g[(wkx + ii - i), * (wky + jj - j)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":127 * (wky + jj - j)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L13; } __pyx_L13:; } } /* "astropy/convolution/boundary_wrap.pyx":129 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":130 * * if bot != 0.: * fixed[i, j] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_fixed.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L14; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":132 * fixed[i, j] = top / bot * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_j; __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L14:; goto __pyx_L8; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":134 * fixed[i, j] = f[i, j] * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_30 = __pyx_v_i; __pyx_t_31 = __pyx_v_j; __pyx_t_32 = __pyx_v_i; __pyx_t_33 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L8:; } } /* "astropy/convolution/boundary_wrap.pyx":137 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if not npy_isnan(fixed[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_wrap.pyx":138 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_wrap.pyx":139 * for i in range(nx): * for j in range(ny): * if not npy_isnan(fixed[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_j; __pyx_t_2 = (!npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[1].strides)))); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":140 * for j in range(ny): * if not npy_isnan(fixed[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":141 * if not npy_isnan(fixed[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":142 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":143 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":144 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_wrap.pyx":145 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_wrap.pyx":146 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * iii = ii % nx */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_wrap.pyx":147 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * iii = ii % nx * jjj = jj % ny */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_wrap.pyx":148 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * iii = ii % nx # <<<<<<<<<<<<<< * jjj = jj % ny * val = fixed[iii, jjj] */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":149 * for jj in range(jjmin, jjmax): * iii = ii % nx * jjj = jj % ny # <<<<<<<<<<<<<< * val = fixed[iii, jjj] * ker = g[(wkx + ii - i), */ if (unlikely(__pyx_v_ny == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_jjj = __Pyx_mod_int(__pyx_v_jj, __pyx_v_ny); /* "astropy/convolution/boundary_wrap.pyx":150 * iii = ii % nx * jjj = jj % ny * val = fixed[iii, jjj] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_36 = __pyx_v_iii; __pyx_t_37 = __pyx_v_jjj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_fixed.diminfo[1].strides)); /* "astropy/convolution/boundary_wrap.pyx":152 * val = fixed[iii, jjj] * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_38 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_39 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_wrap.pyx":153 * ker = g[(wkx + ii - i), * (wky + jj - j)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":154 * (wky + jj - j)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":155 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L24; } __pyx_L24:; } } /* "astropy/convolution/boundary_wrap.pyx":156 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.0); if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":157 * bot += ker * if bot != 0: * conv[i, j] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_40 = __pyx_v_i; __pyx_t_41 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_conv.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":159 * conv[i, j] = top / bot * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; __pyx_t_44 = __pyx_v_i; __pyx_t_45 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L25:; goto __pyx_L19; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":161 * conv[i, j] = fixed[i, j] * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_46 = __pyx_v_i; __pyx_t_47 = __pyx_v_j; __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L19:; } } /* "astropy/convolution/boundary_wrap.pyx":163 * conv[i, j] = fixed[i, j] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve2d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_5convolve3d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_wrap_5convolve3d_boundary_wrap = {__Pyx_NAMESTR("convolve3d_boundary_wrap"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_wrap_5convolve3d_boundary_wrap, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_wrap_5convolve3d_boundary_wrap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve3d_boundary_wrap (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_wrap", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve3d_boundary_wrap") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_wrap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve3d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_wrap_4convolve3d_boundary_wrap(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_wrap.pyx":167 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_wrap(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_wrap_4convolve3d_boundary_wrap(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nz; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_nkz; int __pyx_v_wkx; int __pyx_v_wky; int __pyx_v_wkz; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_k; unsigned int __pyx_v_iii; unsigned int __pyx_v_jjj; unsigned int __pyx_v_kkk; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_kk; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; int __pyx_v_kkmin; int __pyx_v_kkmax; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; int __pyx_t_12; unsigned int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; int __pyx_t_24; int __pyx_t_25; int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; unsigned int __pyx_t_51; unsigned int __pyx_t_52; unsigned int __pyx_t_53; unsigned int __pyx_t_54; unsigned int __pyx_t_55; unsigned int __pyx_t_56; unsigned int __pyx_t_57; unsigned int __pyx_t_58; unsigned int __pyx_t_59; unsigned int __pyx_t_60; unsigned int __pyx_t_61; unsigned int __pyx_t_62; unsigned int __pyx_t_63; unsigned int __pyx_t_64; unsigned int __pyx_t_65; unsigned int __pyx_t_66; unsigned int __pyx_t_67; unsigned int __pyx_t_68; unsigned int __pyx_t_69; unsigned int __pyx_t_70; unsigned int __pyx_t_71; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve3d_boundary_wrap", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_f.diminfo[2].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_f.diminfo[2].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[2]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_g.diminfo[2].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_g.diminfo[2].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[2]; /* "astropy/convolution/boundary_wrap.pyx":170 * np.ndarray[DTYPE_t, ndim=3] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); if (!__pyx_t_2) { __pyx_t_3 = (__Pyx_mod_long((__pyx_v_g->dimensions[2]), 2) != 1); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) { /* "astropy/convolution/boundary_wrap.pyx":171 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_wrap.pyx":173 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_wrap.pyx":175 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":176 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_wrap.pyx":177 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_nz = (__pyx_v_f->dimensions[2]); /* "astropy/convolution/boundary_wrap.pyx":178 * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_wrap.pyx":179 * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_wrap.pyx":180 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nkz = (__pyx_v_g->dimensions[2]); /* "astropy/convolution/boundary_wrap.pyx":181 * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_wrap.pyx":182 * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_wrap.pyx":183 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wkz = __Pyx_div_long(__pyx_v_nkz, 2); /* "astropy/convolution/boundary_wrap.pyx":184 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) * cdef unsigned int i, j, k, iii, jjj, kkk */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_fixed.diminfo[2].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_fixed.diminfo[2].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[2]; } } __pyx_t_10 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_wrap.pyx":185 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, k, iii, jjj, kkk * cdef int ii, jj, kk */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_conv.diminfo[2].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_conv.diminfo[2].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[2]; } } __pyx_t_11 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "astropy/convolution/boundary_wrap.pyx":195 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_wrap.pyx":196 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if npy_isnan(f[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_wrap.pyx":197 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_wrap.pyx":198 * for j in range(ny): * for k in range(nz): * if npy_isnan(f[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_j; __pyx_t_20 = __pyx_v_k; __pyx_t_4 = npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_f.diminfo[2].strides))); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":199 * for k in range(nz): * if npy_isnan(f[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":200 * if npy_isnan(f[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":201 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":202 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":203 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_wrap.pyx":204 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_wrap.pyx":205 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_wrap.pyx":206 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_wrap.pyx":207 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_wrap.pyx":208 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * iii = ii % nx */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_wrap.pyx":209 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * iii = ii % nx * jjj = jj % ny */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_wrap.pyx":210 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * iii = ii % nx # <<<<<<<<<<<<<< * jjj = jj % ny * kkk = kk % nz */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":211 * for kk in range(kkmin, kkmax): * iii = ii % nx * jjj = jj % ny # <<<<<<<<<<<<<< * kkk = kk % nz * val = f[iii, jjj, kkk] */ if (unlikely(__pyx_v_ny == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_jjj = __Pyx_mod_int(__pyx_v_jj, __pyx_v_ny); /* "astropy/convolution/boundary_wrap.pyx":212 * iii = ii % nx * jjj = jj % ny * kkk = kk % nz # <<<<<<<<<<<<<< * val = f[iii, jjj, kkk] * if not npy_isnan(val): */ if (unlikely(__pyx_v_nz == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_kkk = __Pyx_mod_int(__pyx_v_kk, __pyx_v_nz); /* "astropy/convolution/boundary_wrap.pyx":213 * jjj = jj % ny * kkk = kk % nz * val = f[iii, jjj, kkk] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_27 = __pyx_v_iii; __pyx_t_28 = __pyx_v_jjj; __pyx_t_29 = __pyx_v_kkk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_f.diminfo[2].strides)); /* "astropy/convolution/boundary_wrap.pyx":214 * kkk = kk % nz * val = f[iii, jjj, kkk] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_4 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":217 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_30 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_31 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_32 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_wrap.pyx":218 * (wky + jj - j), * (wkz + kk - k)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":219 * (wkz + kk - k)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L17; } __pyx_L17:; } } } /* "astropy/convolution/boundary_wrap.pyx":221 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j, k] = top / bot * else: */ __pyx_t_4 = (__pyx_v_bot != 0.); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":222 * * if bot != 0.: * fixed[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_33 = __pyx_v_i; __pyx_t_34 = __pyx_v_j; __pyx_t_35 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L18; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":224 * fixed[i, j, k] = top / bot * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ __pyx_t_36 = __pyx_v_i; __pyx_t_37 = __pyx_v_j; __pyx_t_38 = __pyx_v_k; __pyx_t_39 = __pyx_v_i; __pyx_t_40 = __pyx_v_j; __pyx_t_41 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L18:; goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":226 * fixed[i, j, k] = f[i, j, k] * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; __pyx_t_44 = __pyx_v_k; __pyx_t_45 = __pyx_v_i; __pyx_t_46 = __pyx_v_j; __pyx_t_47 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L10:; } } } /* "astropy/convolution/boundary_wrap.pyx":229 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_wrap.pyx":230 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_wrap.pyx":231 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_wrap.pyx":232 * for j in range(ny): * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; __pyx_t_50 = __pyx_v_k; __pyx_t_4 = (!npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_fixed.diminfo[2].strides)))); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":233 * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_wrap.pyx":234 * if not npy_isnan(fixed[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_wrap.pyx":235 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_wrap.pyx":236 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_wrap.pyx":237 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_wrap.pyx":238 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_wrap.pyx":239 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_wrap.pyx":240 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_wrap.pyx":241 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_wrap.pyx":242 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * iii = ii % nx */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_wrap.pyx":243 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * iii = ii % nx * jjj = jj % ny */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_wrap.pyx":244 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * iii = ii % nx # <<<<<<<<<<<<<< * jjj = jj % ny * kkk = kk % nz */ if (unlikely(__pyx_v_nx == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_iii = __Pyx_mod_int(__pyx_v_ii, __pyx_v_nx); /* "astropy/convolution/boundary_wrap.pyx":245 * for kk in range(kkmin, kkmax): * iii = ii % nx * jjj = jj % ny # <<<<<<<<<<<<<< * kkk = kk % nz * val = fixed[iii, jjj, kkk] */ if (unlikely(__pyx_v_ny == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_jjj = __Pyx_mod_int(__pyx_v_jj, __pyx_v_ny); /* "astropy/convolution/boundary_wrap.pyx":246 * iii = ii % nx * jjj = jj % ny * kkk = kk % nz # <<<<<<<<<<<<<< * val = fixed[iii, jjj, kkk] * ker = g[(wkx + ii - i), */ if (unlikely(__pyx_v_nz == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_kkk = __Pyx_mod_int(__pyx_v_kk, __pyx_v_nz); /* "astropy/convolution/boundary_wrap.pyx":247 * jjj = jj % ny * kkk = kk % nz * val = fixed[iii, jjj, kkk] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_51 = __pyx_v_iii; __pyx_t_52 = __pyx_v_jjj; __pyx_t_53 = __pyx_v_kkk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_fixed.diminfo[2].strides)); /* "astropy/convolution/boundary_wrap.pyx":250 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_54 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_55 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_56 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_wrap.pyx":251 * (wky + jj - j), * (wkz + kk - k)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_4 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":252 * (wkz + kk - k)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_wrap.pyx":253 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L32; } __pyx_L32:; } } } /* "astropy/convolution/boundary_wrap.pyx":254 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j, k] = top / bot * else: */ __pyx_t_4 = (__pyx_v_bot != 0.0); if (__pyx_t_4) { /* "astropy/convolution/boundary_wrap.pyx":255 * bot += ker * if bot != 0: * conv[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_57 = __pyx_v_i; __pyx_t_58 = __pyx_v_j; __pyx_t_59 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_conv.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L33; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":257 * conv[i, j, k] = top / bot * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ __pyx_t_60 = __pyx_v_i; __pyx_t_61 = __pyx_v_j; __pyx_t_62 = __pyx_v_k; __pyx_t_63 = __pyx_v_i; __pyx_t_64 = __pyx_v_j; __pyx_t_65 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_62, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L33:; goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_wrap.pyx":259 * conv[i, j, k] = fixed[i, j, k] * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_66 = __pyx_v_i; __pyx_t_67 = __pyx_v_j; __pyx_t_68 = __pyx_v_k; __pyx_t_69 = __pyx_v_i; __pyx_t_70 = __pyx_v_j; __pyx_t_71 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_71, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_wrap_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L25:; } } } /* "astropy/convolution/boundary_wrap.pyx":261 * conv[i, j, k] = fixed[i, j, k] * * return conv # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_wrap.convolve3d_boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L13; } /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L13; } /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L13; } /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L13; } /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L13; } /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L13; } /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L13; } /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L13; } /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L13; } /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L13; } /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L13; } /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L13; } /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L13; } /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L13; } /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L13; } /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L13; } /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_7) { __pyx_t_8 = __pyx_v_little_endian; } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_7) { __pyx_t_9 = (!__pyx_v_little_endian); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("boundary_wrap"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__bot, __pyx_k__bot, sizeof(__pyx_k__bot), 0, 0, 1, 1}, {&__pyx_n_s__conv, __pyx_k__conv, sizeof(__pyx_k__conv), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__ii, __pyx_k__ii, sizeof(__pyx_k__ii), 0, 0, 1, 1}, {&__pyx_n_s__iii, __pyx_k__iii, sizeof(__pyx_k__iii), 0, 0, 1, 1}, {&__pyx_n_s__iimax, __pyx_k__iimax, sizeof(__pyx_k__iimax), 0, 0, 1, 1}, {&__pyx_n_s__iimin, __pyx_k__iimin, sizeof(__pyx_k__iimin), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__jj, __pyx_k__jj, sizeof(__pyx_k__jj), 0, 0, 1, 1}, {&__pyx_n_s__jjj, __pyx_k__jjj, sizeof(__pyx_k__jjj), 0, 0, 1, 1}, {&__pyx_n_s__jjmax, __pyx_k__jjmax, sizeof(__pyx_k__jjmax), 0, 0, 1, 1}, {&__pyx_n_s__jjmin, __pyx_k__jjmin, sizeof(__pyx_k__jjmin), 0, 0, 1, 1}, {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, {&__pyx_n_s__ker, __pyx_k__ker, sizeof(__pyx_k__ker), 0, 0, 1, 1}, {&__pyx_n_s__kk, __pyx_k__kk, sizeof(__pyx_k__kk), 0, 0, 1, 1}, {&__pyx_n_s__kkk, __pyx_k__kkk, sizeof(__pyx_k__kkk), 0, 0, 1, 1}, {&__pyx_n_s__kkmax, __pyx_k__kkmax, sizeof(__pyx_k__kkmax), 0, 0, 1, 1}, {&__pyx_n_s__kkmin, __pyx_k__kkmin, sizeof(__pyx_k__kkmin), 0, 0, 1, 1}, {&__pyx_n_s__nkx, __pyx_k__nkx, sizeof(__pyx_k__nkx), 0, 0, 1, 1}, {&__pyx_n_s__nky, __pyx_k__nky, sizeof(__pyx_k__nky), 0, 0, 1, 1}, {&__pyx_n_s__nkz, __pyx_k__nkz, sizeof(__pyx_k__nkz), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__nx, __pyx_k__nx, sizeof(__pyx_k__nx), 0, 0, 1, 1}, {&__pyx_n_s__ny, __pyx_k__ny, sizeof(__pyx_k__ny), 0, 0, 1, 1}, {&__pyx_n_s__nz, __pyx_k__nz, sizeof(__pyx_k__nz), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__top, __pyx_k__top, sizeof(__pyx_k__top), 0, 0, 1, 1}, {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, {&__pyx_n_s__wkx, __pyx_k__wkx, sizeof(__pyx_k__wkx), 0, 0, 1, 1}, {&__pyx_n_s__wky, __pyx_k__wky, sizeof(__pyx_k__wky), 0, 0, 1, 1}, {&__pyx_n_s__wkz, __pyx_k__wkz, sizeof(__pyx_k__wkz), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "astropy/convolution/boundary_wrap.pyx":20 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "astropy/convolution/boundary_wrap.pyx":88 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "astropy/convolution/boundary_wrap.pyx":171 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "astropy/convolution/boundary_wrap.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_wrap(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_k_tuple_17 = PyTuple_Pack(16, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_19, 16, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_wrap.pyx":84 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_wrap(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_k_tuple_22 = PyTuple_Pack(24, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(2, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_24, 84, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_wrap.pyx":167 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_wrap(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_k_tuple_25 = PyTuple_Pack(32, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nz), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__nkz), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__wkz), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__kkk), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__kk), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__kkmin), ((PyObject *)__pyx_n_s__kkmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 32, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_27, 167, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initboundary_wrap(void); /*proto*/ PyMODINIT_FUNC initboundary_wrap(void) #else PyMODINIT_FUNC PyInit_boundary_wrap(void); /*proto*/ PyMODINIT_FUNC PyInit_boundary_wrap(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_boundary_wrap(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("boundary_wrap"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "astropy.convolution.boundary_wrap")) { if (unlikely(PyDict_SetItemString(modules, "astropy.convolution.boundary_wrap", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_astropy__convolution__boundary_wrap) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "astropy/convolution/boundary_wrap.pyx":3 * # Licensed under a 3-clause BSD style license - see LICENSE.rst * from __future__ import division * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/convolution/boundary_wrap.pyx":6 * cimport numpy as np * * DTYPE = np.float # <<<<<<<<<<<<<< * ctypedef np.float_t DTYPE_t * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_wrap.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_wrap(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_wrap_1convolve1d_boundary_wrap, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_wrap.pyx":84 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_wrap(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_wrap_3convolve2d_boundary_wrap, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_wrap.pyx":167 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_wrap(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_wrap_5convolve3d_boundary_wrap, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_27, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_wrap.pyx":1 * # Licensed under a 3-clause BSD style license - see LICENSE.rst # <<<<<<<<<<<<<< * from __future__ import division * import numpy as np */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init astropy.convolution.boundary_wrap", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init astropy.convolution.boundary_wrap"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) /* First char was not a digit */ PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { if (isspace(*ts)) continue; number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { long r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE int __Pyx_mod_int(int a, int b) { int r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); #endif Py_DECREF(getbuffer_cobj); if (!func) goto fail; return func(obj, view, flags); } else { PyErr_Clear(); } #endif PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; if (!obj) return; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif Py_DECREF(releasebuffer_cobj); if (!func) goto fail; func(obj, view); return; } else { PyErr_Clear(); } #endif goto nofail; #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); nofail: Py_DECREF(obj); view->obj = NULL; } #endif /* PY_MAJOR_VERSION < 3 */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ astropy-0.3/astropy/convolution/__init__.py0000644000175000017500000000036112243255342017370 0ustar oleolefrom .core import * from .kernels import * from .utils import discretize_model try: # Not guaranteed available at setup time from .convolve import convolve, convolve_fft except ImportError: if not _ASTROPY_SETUP_: raise astropy-0.3/astropy/convolution/boundary_extend.pyx0000644000175000017500000002242212243255342021215 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np cimport numpy as np DTYPE = np.float ctypedef np.float_t DTYPE_t cdef inline int int_max(int a, int b): return a if a >= b else b cdef inline int int_min(int a, int b): return a if a <= b else b cdef extern from "numpy/npy_math.h": bint npy_isnan(double x) cimport cython @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve1d_boundary_extend(np.ndarray[DTYPE_t, ndim=1] f, np.ndarray[DTYPE_t, ndim=1] g): if g.shape[0] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int nkx = g.shape[0] cdef int wkx = nkx // 2 cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) cdef unsigned int i, iii cdef int ii cdef int iimin, iimax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): if npy_isnan(f[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): iii = int_min(int_max(ii, 0), nx - 1) val = f[iii] if not npy_isnan(val): ker = g[(wkx + ii - i)] top += val * ker bot += ker if bot != 0.: fixed[i] = top / bot else: fixed[i] = f[i] else: fixed[i] = f[i] # Now run the proper convolution for i in range(nx): if not npy_isnan(fixed[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): iii = int_min(int_max(ii, 0), nx - 1) val = fixed[iii] ker = g[(wkx + ii - i)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i] = top / bot else: conv[i] = fixed[i] else: conv[i] = fixed[i] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve2d_boundary_extend(np.ndarray[DTYPE_t, ndim=2] f, np.ndarray[DTYPE_t, ndim=2] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) cdef unsigned int i, j, iii, jjj cdef int ii, jj cdef int iimin, iimax, jjmin, jjmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): if npy_isnan(f[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): iii = int_min(int_max(ii, 0), nx - 1) jjj = int_min(int_max(jj, 0), ny - 1) val = f[iii, jjj] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j)] top += val * ker bot += ker if bot != 0.: fixed[i, j] = top / bot else: fixed[i, j] = f[i, j] else: fixed[i, j] = f[i, j] # Now run the proper convolution for i in range(nx): for j in range(ny): if not npy_isnan(fixed[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): iii = int_min(int_max(ii, 0), nx - 1) jjj = int_min(int_max(jj, 0), ny - 1) val = fixed[iii, jjj] ker = g[(wkx + ii - i), (wky + jj - j)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j] = top / bot else: conv[i, j] = fixed[i, j] else: conv[i, j] = fixed[i, j] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve3d_boundary_extend(np.ndarray[DTYPE_t, ndim=3] f, np.ndarray[DTYPE_t, ndim=3] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nz = f.shape[2] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int nkz = g.shape[2] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef int wkz = nkz // 2 cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) cdef unsigned int i, j, k, iii, jjj, kkk cdef int ii, jj, kk cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): for k in range(nz): if npy_isnan(f[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): iii = int_min(int_max(ii, 0), nx - 1) jjj = int_min(int_max(jj, 0), ny - 1) kkk = int_min(int_max(kk, 0), nz - 1) val = f[iii, jjj, kkk] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] top += val * ker bot += ker if bot != 0.: fixed[i, j, k] = top / bot else: fixed[i, j, k] = f[i, j, k] else: fixed[i, j, k] = f[i, j, k] # Now run the proper convolution for i in range(nx): for j in range(ny): for k in range(nz): if not npy_isnan(fixed[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): iii = int_min(int_max(ii, 0), nx - 1) jjj = int_min(int_max(jj, 0), ny - 1) kkk = int_min(int_max(kk, 0), nz - 1) val = fixed[iii, jjj, kkk] ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j, k] = top / bot else: conv[i, j, k] = fixed[i, j, k] else: conv[i, j, k] = fixed[i, j, k] return conv astropy-0.3/astropy/convolution/convolve.py0000644000175000017500000005276212243255342017500 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from .core import Kernel, Kernel1D, Kernel2D from ..utils.exceptions import AstropyUserWarning # Disabling all doctests in this module until a better way of handling warnings # in doctests can be determined __doctest_skip__ = ['*'] def convolve(array, kernel, boundary='fill', fill_value=0., normalize_kernel=False): ''' Convolve an array with a kernel. This routine differs from `scipy.ndimage.filters.convolve` because it includes a special treatment for `NaN` values. Rather than including `NaNs` in the convolution calculation, which causes large `NaN` holes in the convolved image, `NaN` values are replaced with interpolated values using the kernel as an interpolation function. Parameters ---------- array : `numpy.ndarray` The array to convolve. This should be a 1, 2, or 3-dimensional array or a list or a set of nested lists representing a 1, 2, or 3-dimensional array. kernel : `numpy.ndarray` or nddata.convolution.Kernel The convolution kernel. The number of dimensions should match those for the array, and the dimensions should be odd in all directions. boundary : str, optional A flag indicating how to handle boundaries: * `None` Set the `result` values to zero where the kernel extends beyond the edge of the array (default). * 'fill' Set values outside the array boundary to `fill_value`. * 'wrap' Periodic boundary that wrap to the other side of `array`. * 'extend' Set values outside the array to the nearest `array` value. fill_value : float, optional The value to use outside the array when using boundary='fill' normalize_kernel : bool, optional Whether to normalize the kernel prior to convolving Returns ------- result : `numpy.ndarray` An array with the same dimensions and as the input array, convolved with kernel. The data type depends on the input array type. If array is a floating point type, then the return array keeps the same data type, otherwise the type is numpy.float. Notes ----- Masked arrays are not supported at this time. The convolution is always done at numpy.float precision. ''' from .boundary_none import (convolve1d_boundary_none, convolve2d_boundary_none, convolve3d_boundary_none) from .boundary_extend import (convolve1d_boundary_extend, convolve2d_boundary_extend, convolve3d_boundary_extend) from .boundary_fill import (convolve1d_boundary_fill, convolve2d_boundary_fill, convolve3d_boundary_fill) from .boundary_wrap import (convolve1d_boundary_wrap, convolve2d_boundary_wrap, convolve3d_boundary_wrap) # The cython routines all need float type inputs (so, a particular # bit size, endianness, etc.). So we have to convert, which also # has the effect of making copies so we don't modify the inputs. # After this, the variables we work with will be array_internal, and # kernel_internal. However -- we do want to keep track of what type # the input array was so we can cast the result to that at the end # if it's a floating point type. Don't bother with this for lists -- # just always push those as np.float. # It is always necessary to make a copy of kernel (since it is modified), # but, if we just so happen to be lucky enough to have the input array # have exactly the desired type, we just alias to array_internal # Check if kernel is kernel instance if isinstance(kernel, Kernel): # Check if array is also kernel instance, if so convolve and # return new kernel instance if isinstance(array, Kernel): if isinstance(array, Kernel1D) and isinstance(kernel, Kernel1D): new_array = convolve1d_boundary_fill(array.array, kernel.array, 0) new_kernel = Kernel1D(array=new_array) elif isinstance(array, Kernel2D) and isinstance(kernel, Kernel2D): new_array = convolve2d_boundary_fill(array.array, kernel.array, 0) new_kernel = Kernel2D(array=new_array) else: raise Exception("Can't convolve 1D and 2D kernel.") new_kernel._separable = kernel._separable and array._separable new_kernel._is_bool = False return new_kernel kernel = kernel.array # Check that the arguments are lists or Numpy arrays if isinstance(array, list): array_internal = np.array(array, dtype=np.float) array_dtype = array_internal.dtype elif isinstance(array, np.ndarray): # Note this won't copy if it doesn't have to -- which is okay # because none of what follows modifies array_internal. However, # only numpy > 1.7 has support for no-copy astype, so we use # a try/except because astropy supports 1.5 and 1.6 array_dtype = array.dtype try: array_internal = array.astype(float, copy=False) except TypeError: array_internal = array.astype(float) else: raise TypeError("array should be a list or a Numpy array") if isinstance(kernel, list): kernel_internal = np.array(kernel, dtype=float) elif isinstance(kernel, np.ndarray): # Note this always makes a copy, since we will be modifying it kernel_internal = kernel.astype(float) else: raise TypeError("kernel should be a list or a Numpy array") # Check that the number of dimensions is compatible if array_internal.ndim != kernel_internal.ndim: raise Exception('array and kernel have differing number of ' 'dimensions.') # Because the Cython routines have to normalize the kernel on the fly, we # explicitly normalize the kernel here, and then scale the image at the # end if normalization was not requested. kernel_sum = kernel_internal.sum() kernel_internal /= kernel_sum if array_internal.ndim == 0: raise Exception("cannot convolve 0-dimensional arrays") elif array_internal.ndim == 1: if boundary == 'extend': result = convolve1d_boundary_extend(array_internal, kernel_internal) elif boundary == 'fill': result = convolve1d_boundary_fill(array_internal, kernel_internal, float(fill_value)) elif boundary == 'wrap': result = convolve1d_boundary_wrap(array_internal, kernel_internal) else: result = convolve1d_boundary_none(array_internal, kernel_internal) elif array_internal.ndim == 2: if boundary == 'extend': result = convolve2d_boundary_extend(array_internal, kernel_internal) elif boundary == 'fill': result = convolve2d_boundary_fill(array_internal, kernel_internal, float(fill_value)) elif boundary == 'wrap': result = convolve2d_boundary_wrap(array_internal, kernel_internal) else: result = convolve2d_boundary_none(array_internal, kernel_internal) elif array_internal.ndim == 3: if boundary == 'extend': result = convolve3d_boundary_extend(array_internal, kernel_internal) elif boundary == 'fill': result = convolve3d_boundary_fill(array_internal, kernel_internal, float(fill_value)) elif boundary == 'wrap': result = convolve3d_boundary_wrap(array_internal, kernel_internal) else: result = convolve3d_boundary_none(array_internal, kernel_internal) else: raise NotImplemented('convolve only supports 1, 2, and 3-dimensional ' 'arrays at this time') # If normalization was not requested, we need to scale the array (since # the kernel was normalized prior to convolution) if not normalize_kernel: result *= kernel_sum # Try to preserve the input type if it's a floating point type if array_dtype.kind == 'f': # Avoid making another copy if possible try: return result.astype(array_dtype, copy=False) except TypeError: return result.astype(array_dtype) else: return result def convolve_fft(array, kernel, boundary='fill', fill_value=0, crop=True, return_fft=False, fft_pad=True, psf_pad=False, interpolate_nan=False, quiet=False, ignore_edge_zeros=False, min_wt=0.0, normalize_kernel=False, fftn=np.fft.fftn, ifftn=np.fft.ifftn, complex_dtype=np.complex): """ Convolve an ndarray with an nd-kernel. Returns a convolved image with shape = array.shape. Assumes kernel is centered. `convolve_fft` differs from `scipy.signal.fftconvolve` in a few ways: * It can treat NaN's as zeros or interpolate over them. * `inf` values are treated as `NaN` * (optionally) It pads to the nearest 2^n size to improve FFT speed. * Its only valid `mode` is 'same' (i.e., the same shape array is returned) * It lets you use your own fft, e.g., `pyFFTW `_ or `pyFFTW3 `_ , which can lead to performance improvements, depending on your system configuration. pyFFTW3 is threaded, and therefore may yield significant performance benefits on multi-core machines at the cost of greater memory requirements. Specify the `fftn` and `ifftn` keywords to override the default, which is `numpy.fft.fft` and `numpy.fft.ifft`. Parameters ---------- array : `numpy.ndarray` Array to be convolved with `kernel` kernel : `numpy.ndarray` Will be normalized if `normalize_kernel` is set. Assumed to be centered (i.e., shifts may result if your kernel is asymmetric) boundary : {'fill', 'wrap'} A flag indicating how to handle boundaries: * 'fill': set values outside the array boundary to fill_value (default) * 'wrap': periodic boundary interpolate_nan : bool The convolution will be re-weighted assuming NAN values are meant to be ignored, not treated as zero. If this is off, all NaN values will be treated as zero. ignore_edge_zeros : bool Ignore the zero-pad-created zeros. This will effectively decrease the kernel area on the edges but will not re-normalize the kernel. This parameter may result in 'edge-brightening' effects if you're using a normalized kernel min_wt : float If ignoring NANs/zeros, force all grid points with a weight less than this value to NAN (the weight of a grid point with *no* ignored neighbors is 1.0). If `min_wt` == 0.0, then all zero-weight points will be set to zero instead of NAN (which they would be otherwise, because 1/0 = nan). See the examples below normalize_kernel : function or boolean If specified, this is the function to divide kernel by to normalize it. e.g., normalize_kernel=np.sum means that kernel will be modified to be: kernel = kernel / np.sum(kernel). If True, defaults to normalize_kernel = np.sum Other Parameters ---------------- fft_pad : bool Default on. Zero-pad image to the nearest 2^n psf_pad : bool Default off. Zero-pad image to be at least the sum of the image sizes (in order to avoid edge-wrapping when smoothing) crop : bool Default on. Return an image of the size of the largest input image. If the images are asymmetric in opposite directions, will return the largest image in both directions. For example, if an input image has shape [100,3] but a kernel with shape [6,6] is used, the output will be [100,6]. return_fft : bool Return the fft(image)*fft(kernel) instead of the convolution (which is ifft(fft(image)*fft(kernel))). Useful for making PSDs. nthreads : int if fftw3 is installed, can specify the number of threads to allow FFTs to use. Probably only helpful for large arrays fftn, ifftn : functions The fft and inverse fft functions. Can be overridden to use your own ffts, e.g. an fftw3 wrapper or scipy's fftn, e.g. `fftn=scipy.fftpack.fftn` complex_dtype : np.complex Which complex dtype to use. `numpy` has a range of options, from 64 to 256. See Also -------- convolve : Convolve is a non-fft version of this code. Returns ------- default : ndarray **array** convolved with `kernel`. If `return_fft` is set, returns fft(**array**) * fft(`kernel`). If crop is not set, returns the image, but with the fft-padded size instead of the input size Examples -------- >>> convolve_fft([1, 0, 3], [1, 1, 1]) array([ 1., 4., 3.]) >>> convolve_fft([1, np.nan, 3], [1, 1, 1]) array([ 1., 4., 3.]) >>> convolve_fft([1, 0, 3], [0, 1, 0]) array([ 1., 0., 3.]) >>> convolve_fft([1, 2, 3], [1]) array([ 1., 2., 3.]) >>> convolve_fft([1, np.nan, 3], [0, 1, 0], interpolate_nan=True) ... array([ 1., 0., 3.]) >>> convolve_fft([1, np.nan, 3], [0, 1, 0], interpolate_nan=True, ... min_wt=1e-8) array([ 1., nan, 3.]) >>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True) array([ 1., 4., 3.]) >>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True, ... normalize_kernel=True, ignore_edge_zeros=True) array([ 1., 2., 3.]) >>> import scipy.fftpack # optional - requires scipy >>> convolve_fft([1, np.nan, 3], [1, 1, 1], interpolate_nan=True, ... normalize_kernel=True, ignore_edge_zeros=True, ... fftn=scipy.fftpack.fft, ifftn=scipy.fftpack.ifft) array([ 1., 2., 3.]) """ # Checking copied from convolve.py - however, since FFTs have real & # complex components, we change the types. Only the real part will be # returned! Note that this always makes a copy. # Check kernel is kernel instance if isinstance(kernel, Kernel): kernel = kernel.array if isinstance(array, Kernel): raise Exception("Can't convolve two kernels. Use convolve() instead.") # mask catching - masks must be turned into NaNs for use later if np.ma.is_masked(array): mask = array.mask array = np.array(array) array[mask] = np.nan if np.ma.is_masked(kernel): mask = kernel.mask kernel = np.array(kernel) kernel[mask] = np.nan # Convert array dtype to complex array = np.asarray(array, dtype=np.complex) kernel = np.asarray(kernel, dtype=np.complex) # Check that the number of dimensions is compatible if array.ndim != kernel.ndim: raise Exception('array and kernel have differing number of dimensions') # NAN and inf catching nanmaskarray = np.isnan(array) + np.isinf(array) array[nanmaskarray] = 0 nanmaskkernel = np.isnan(kernel) + np.isinf(kernel) kernel[nanmaskkernel] = 0 if ((nanmaskarray.sum() > 0 or nanmaskkernel.sum() > 0) and not interpolate_nan and not quiet): warnings.warn("NOT ignoring nan values even though they are present " " (they are treated as 0)", AstropyUserWarning) if normalize_kernel is True: kernel = kernel / kernel.sum() kernel_is_normalized = True elif normalize_kernel: # try this. If a function is not passed, the code will just crash... I # think type checking would be better but PEPs say otherwise... kernel = kernel / normalize_kernel(kernel) kernel_is_normalized = True else: if np.abs(kernel.sum() - 1) < 1e-8: kernel_is_normalized = True else: kernel_is_normalized = False if (interpolate_nan or ignore_edge_zeros): warnings.warn("Kernel is not normalized, therefore " "ignore_edge_zeros and interpolate_nan will be " "ignored.", AstropyUserWarning) if boundary is None: warnings.warn("The convolve_fft version of boundary=None is " "equivalent to the convolve boundary='fill'. There is " "no FFT equivalent to convolve's " "zero-if-kernel-leaves-boundary", AstropyUserWarning) psf_pad = True elif boundary == 'fill': # create a boundary region at least as large as the kernel psf_pad = True elif boundary == 'wrap': psf_pad = False fft_pad = False fill_value = 0 # force zero; it should not be used elif boundary == 'extend': raise NotImplementedError("The 'extend' option is not implemented " "for fft-based convolution") arrayshape = array.shape kernshape = kernel.shape if array.ndim != kernel.ndim: raise ValueError("Image and kernel must have same number of " "dimensions") # find ideal size (power of 2) for fft. # Can add shapes because they are tuples if fft_pad: if psf_pad: # add the dimensions and then take the max (bigger) fsize = 2 ** np.ceil(np.log2( np.max(np.array(arrayshape) + np.array(kernshape)))) else: # add the shape lists (max of a list of length 4) (smaller) # also makes the shapes square fsize = 2 ** np.ceil(np.log2(np.max(arrayshape + kernshape))) newshape = np.array([fsize for ii in range(array.ndim)]) else: if psf_pad: # just add the biggest dimensions newshape = np.array(arrayshape) + np.array(kernshape) else: newshape = np.array([np.max([imsh, kernsh]) for imsh, kernsh in zip(arrayshape, kernshape)]) # separate each dimension by the padding size... this is to determine the # appropriate slice size to get back to the input dimensions arrayslices = [] kernslices = [] for ii, (newdimsize, arraydimsize, kerndimsize) in enumerate(zip(newshape, arrayshape, kernshape)): center = newdimsize - (newdimsize + 1) // 2 arrayslices += [slice(center - arraydimsize // 2, center + (arraydimsize + 1) // 2)] kernslices += [slice(center - kerndimsize // 2, center + (kerndimsize + 1) // 2)] bigarray = np.ones(newshape, dtype=complex_dtype) * fill_value bigkernel = np.zeros(newshape, dtype=complex_dtype) bigarray[arrayslices] = array bigkernel[kernslices] = kernel arrayfft = fftn(bigarray) # need to shift the kernel so that, e.g., [0,0,1,0] -> [1,0,0,0] = unity kernfft = fftn(np.fft.ifftshift(bigkernel)) fftmult = arrayfft * kernfft if (interpolate_nan or ignore_edge_zeros) and kernel_is_normalized: if ignore_edge_zeros: bigimwt = np.zeros(newshape, dtype=complex_dtype) else: bigimwt = np.ones(newshape, dtype=complex_dtype) bigimwt[arrayslices] = 1.0 - nanmaskarray * interpolate_nan wtfft = fftn(bigimwt) # I think this one HAS to be normalized (i.e., the weights can't be # computed with a non-normalized kernel) wtfftmult = wtfft * kernfft / kernel.sum() wtsm = ifftn(wtfftmult) # need to re-zero weights outside of the image (if it is padded, we # still don't weight those regions) bigimwt[arrayslices] = wtsm.real[arrayslices] # curiously, at the floating-point limit, can get slightly negative numbers # they break the min_wt=0 "flag" and must therefore be removed bigimwt[bigimwt < 0] = 0 else: bigimwt = 1 if np.isnan(fftmult).any(): # this check should be unnecessary; call it an insanity check raise ValueError("Encountered NaNs in convolve. This is disallowed.") # restore nans in original image (they were modified inplace earlier) # We don't have to worry about masked arrays - if input was masked, it was # copied array[nanmaskarray] = np.nan kernel[nanmaskkernel] = np.nan if return_fft: return fftmult if interpolate_nan or ignore_edge_zeros: rifft = (ifftn(fftmult)) / bigimwt if not np.isscalar(bigimwt): rifft[bigimwt < min_wt] = np.nan if min_wt == 0.0: rifft[bigimwt == 0.0] = 0.0 else: rifft = (ifftn(fftmult)) if crop: result = rifft[arrayslices].real return result else: return rifft.real astropy-0.3/astropy/convolution/boundary_wrap.pyx0000644000175000017500000002154312243255342020702 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np cimport numpy as np DTYPE = np.float ctypedef np.float_t DTYPE_t cdef extern from "numpy/npy_math.h": bint npy_isnan(double x) cimport cython @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve1d_boundary_wrap(np.ndarray[DTYPE_t, ndim=1] f, np.ndarray[DTYPE_t, ndim=1] g): if g.shape[0] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int nkx = g.shape[0] cdef int wkx = nkx // 2 cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) cdef unsigned int i, iii cdef int ii cdef int iimin, iimax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): if npy_isnan(f[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): iii = ii % nx val = f[iii] if not npy_isnan(val): ker = g[(wkx + ii - i)] top += val * ker bot += ker if bot != 0.: fixed[i] = top / bot else: fixed[i] = f[i] else: fixed[i] = f[i] # Now run the proper convolution for i in range(nx): if not npy_isnan(fixed[i]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 for ii in range(iimin, iimax): iii = ii % nx val = fixed[iii] ker = g[(wkx + ii - i)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i] = top / bot else: conv[i] = fixed[i] else: conv[i] = fixed[i] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve2d_boundary_wrap(np.ndarray[DTYPE_t, ndim=2] f, np.ndarray[DTYPE_t, ndim=2] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) cdef unsigned int i, j, iii, jjj cdef int ii, jj cdef int iimin, iimax, jjmin, jjmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): if npy_isnan(f[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): iii = ii % nx jjj = jj % ny val = f[iii, jjj] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j)] top += val * ker bot += ker if bot != 0.: fixed[i, j] = top / bot else: fixed[i, j] = f[i, j] else: fixed[i, j] = f[i, j] # Now run the proper convolution for i in range(nx): for j in range(ny): if not npy_isnan(fixed[i, j]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): iii = ii % nx jjj = jj % ny val = fixed[iii, jjj] ker = g[(wkx + ii - i), (wky + jj - j)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j] = top / bot else: conv[i, j] = fixed[i, j] else: conv[i, j] = fixed[i, j] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve3d_boundary_wrap(np.ndarray[DTYPE_t, ndim=3] f, np.ndarray[DTYPE_t, ndim=3] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nz = f.shape[2] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int nkz = g.shape[2] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef int wkz = nkz // 2 cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) cdef unsigned int i, j, k, iii, jjj, kkk cdef int ii, jj, kk cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): for k in range(nz): if npy_isnan(f[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): iii = ii % nx jjj = jj % ny kkk = kk % nz val = f[iii, jjj, kkk] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] top += val * ker bot += ker if bot != 0.: fixed[i, j, k] = top / bot else: fixed[i, j, k] = f[i, j, k] else: fixed[i, j, k] = f[i, j, k] # Now run the proper convolution for i in range(nx): for j in range(ny): for k in range(nz): if not npy_isnan(fixed[i, j, k]): top = 0. bot = 0. iimin = i - wkx iimax = i + wkx + 1 jjmin = j - wky jjmax = j + wky + 1 kkmin = k - wkz kkmax = k + wkz + 1 for ii in range(iimin, iimax): for jj in range(jjmin, jjmax): for kk in range(kkmin, kkmax): iii = ii % nx jjj = jj % ny kkk = kk % nz val = fixed[iii, jjj, kkk] ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j, k] = top / bot else: conv[i, j, k] = fixed[i, j, k] else: conv[i, j, k] = fixed[i, j, k] return conv astropy-0.3/astropy/convolution/boundary_none.pyx0000644000175000017500000002023612243255342020666 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np cimport numpy as np DTYPE = np.float ctypedef np.float_t DTYPE_t cdef extern from "numpy/npy_math.h": bint npy_isnan(double x) cimport cython @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f, np.ndarray[DTYPE_t, ndim=1] g): if g.shape[0] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int nkx = g.shape[0] cdef int wkx = nkx // 2 # The following need to be set to zeros rather than empty because the # boundary does not get reset. cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.zeros([nx], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=1] conv = np.zeros([nx], dtype=DTYPE) cdef unsigned int i, ii cdef int iimin, iimax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): if npy_isnan(f[i]) and i >= wkx and i < nx - wkx: top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): val = f[ii] if not npy_isnan(val): ker = g[(wkx + ii - i)] top += val * ker bot += ker if bot != 0.: fixed[i] = top / bot else: fixed[i] = f[i] else: fixed[i] = f[i] # Now run the proper convolution for i in range(wkx, nx - wkx): if not npy_isnan(fixed[i]): top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): val = fixed[ii] ker = g[(wkx + ii - i)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i] = top / bot else: conv[i] = fixed[i] else: conv[i] = fixed[i] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f, np.ndarray[DTYPE_t, ndim=2] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int wkx = nkx // 2 cdef int wky = nky // 2 # The following need to be set to zeros rather than empty because the # boundary does not get reset. cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.zeros([nx, ny], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=2] conv = np.zeros([nx, ny], dtype=DTYPE) cdef unsigned int i, j, ii, jj cdef int iimin, iimax, jjmin, jjmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ and j >= wky and j < ny - wky: top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): for jj in range(j - wky, j + wky + 1): val = f[ii, jj] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j)] top += val * ker bot += ker if bot != 0.: fixed[i, j] = top / bot else: fixed[i, j] = f[i, j] else: fixed[i, j] = f[i, j] # Now run the proper convolution for i in range(wkx, nx - wkx): for j in range(wky, ny - wky): if not npy_isnan(fixed[i, j]): top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): for jj in range(j - wky, j + wky + 1): val = fixed[ii, jj] ker = g[(wkx + ii - i), (wky + jj - j)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j] = top / bot else: conv[i, j] = fixed[i, j] else: conv[i, j] = fixed[i, j] return conv @cython.boundscheck(False) # turn off bounds-checking for entire function def convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f, np.ndarray[DTYPE_t, ndim=3] g): if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: raise ValueError("Convolution kernel must have odd dimensions") assert f.dtype == DTYPE and g.dtype == DTYPE cdef int nx = f.shape[0] cdef int ny = f.shape[1] cdef int nz = f.shape[2] cdef int nkx = g.shape[0] cdef int nky = g.shape[1] cdef int nkz = g.shape[2] cdef int wkx = nkx // 2 cdef int wky = nky // 2 cdef int wkz = nkz // 2 # The following need to be set to zeros rather than empty because the # boundary does not get reset. cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.zeros([nx, ny, nz], dtype=DTYPE) cdef np.ndarray[DTYPE_t, ndim=3] conv = np.zeros([nx, ny, nz], dtype=DTYPE) cdef unsigned int i, j, k, ii, jj, kk cdef int iimin, iimax, jjmin, jjmax, kkmin, kkmax cdef DTYPE_t top, bot, ker, val # Need a first pass to replace NaN values with value convolved from # neighboring values for i in range(nx): for j in range(ny): for k in range(nz): if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): for jj in range(j - wky, j + wky + 1): for kk in range(k - wkz, k + wkz + 1): val = f[ii, jj, kk] if not npy_isnan(val): ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] top += val * ker bot += ker if bot != 0.: fixed[i, j, k] = top / bot else: fixed[i, j, k] = f[i, j, k] else: fixed[i, j, k] = f[i, j, k] # Now run the proper convolution for i in range(wkx, nx - wkx): for j in range(wky, ny - wky): for k in range(wkz, nz - wkz): if not npy_isnan(fixed[i, j, k]): top = 0. bot = 0. for ii in range(i - wkx, i + wkx + 1): for jj in range(j - wky, j + wky + 1): for kk in range(k - wkz, k + wkz + 1): val = fixed[ii, jj, kk] ker = g[(wkx + ii - i), (wky + jj - j), (wkz + kk - k)] if not npy_isnan(val): top += val * ker bot += ker if bot != 0: conv[i, j, k] = top / bot else: conv[i, j, k] = fixed[i, j, k] else: conv[i, j, k] = fixed[i, j, k] return conv astropy-0.3/astropy/convolution/kernels.py0000644000175000017500000007057212243255342017307 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np from .core import Kernel1D, Kernel2D, Kernel from .utils import KernelSizeError from ..modeling import models from ..modeling.core import Parametric1DModel, Parametric2DModel __all__ = sorted(['Gaussian1DKernel', 'Gaussian2DKernel', 'CustomKernel', 'Box1DKernel', 'Box2DKernel', 'Tophat2DKernel', 'Trapezoid1DKernel', 'MexicanHat1DKernel', 'MexicanHat2DKernel', 'AiryDisk2DKernel', 'Model1DKernel', 'Model2DKernel', 'TrapezoidDisk2DKernel', 'Ring2DKernel']) def _round_up_to_odd_integer(value): i = int(np.ceil(value)) if i % 2 == 0: return i + 1 else: return i class Gaussian1DKernel(Kernel1D): """ 1D Gaussian filter kernel. The Gaussian filter is a filter with great smoothing properties. It is isotropic and does not produce artifacts. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. Very slow. factor : number, optional Factor of oversampling. Default factor = 10. If the factor is too large, evaluation can be very slow. See Also -------- Box1DKernel, Trapezoid1DKernel, MexicanHat1DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Gaussian1DKernel gauss_1D_kernel = Gaussian1DKernel(10) plt.plot(gauss_1D_kernel, drawstyle='steps') plt.xlabel('x [pixels]') plt.ylabel('value') plt.show() """ _separable = True _is_bool = False def __init__(self, width, **kwargs): self._model = models.Gaussian1D(1. / (np.sqrt(2 * np.pi) * width), 0, width) self._default_size = _round_up_to_odd_integer(8 * width) super(Gaussian1DKernel, self).__init__(**kwargs) self._truncation = np.abs(1. - 1 / self._normalization) class Gaussian2DKernel(Kernel2D): """ 2D Gaussian filter kernel. The Gaussian filter is a filter with great smoothing properties. It is isotropic and does not produce artifacts. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. y_size : odd int, optional Size in y direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Gaussian2DKernel gaussian_2D_kernel = Gaussian2DKernel(10) plt.imshow(gaussian_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ _separable = True _is_bool = False def __init__(self, width, **kwargs): self._model = models.Gaussian2D(1. / (2 * np.pi * width ** 2), 0, 0, width, width) self._default_size = _round_up_to_odd_integer(8 * width) super(Gaussian2DKernel, self).__init__(**kwargs) self._truncation = np.abs(1. - 1 / self._normalization) class Box1DKernel(Kernel1D): """ 1D Box filter kernel. The Box filter or running mean is a smoothing filter. It is not isotropic and can produce artifacts, when applied repeatedly to the same data. By default the Box kernel uses the `linear_interp` discretization mode, which allows non shifting, even sized kernels. This is achieved by weighting the edge pixels with 1/2. E.g a Box kernel with an effective smoothing of 4 pixel would have the following array: [0.5, 1, 1, 1, 0.5]. Parameters ---------- width : number Width of the filter kernel. mode : str, optional One of the following discretization modes: * 'center' Discretize model by taking the value at the center of the bin. * 'linear_interp' (default) Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Gaussian1DKernel, Trapezoid1DKernel, MexicanHat1DKernel Examples -------- Kernel response function: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Box1DKernel box_1D_kernel = Box1DKernel(9) plt.plot(box_1D_kernel, drawstyle='steps') plt.xlim(-1, 9) plt.xlabel('x [pixels]') plt.ylabel('value') plt.show() """ _separable = True _is_bool = True def __init__(self, width, **kwargs): self._model = models.Box1D(1. / width, 0, width) self._default_size = _round_up_to_odd_integer(width) kwargs['mode'] = 'linear_interp' super(Box1DKernel, self).__init__(**kwargs) self._truncation = 0 self.normalize() class Box2DKernel(Kernel2D): """ 2D Box filter kernel. The Box filter or running mean is a smoothing filter. It is not isotropic and can produce artifact, when applied repeatedly to the same data. By default the Box kernel uses the `linear_interp` discretization mode, which allows non shifting, even sized kernels. This is achieved by weighting the edge pixels with 1/2. Parameters ---------- width : number Width of the filter kernel. mode : str, optional One of the following discretization modes: * 'center' Discretize model by taking the value at the center of the bin. * 'linear_interp' (default) Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Box2DKernel box_2D_kernel = Box2DKernel(9) plt.imshow(box_2D_kernel, interpolation='none', origin='lower', vmin=0.0, vmax=0.015) plt.xlim(-1, 9) plt.ylim(-1, 9) plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ _separable = True _is_bool = True def __init__(self, width, **kwargs): self._model = models.Box2D(1. / width ** 2, 0, 0, width, width) self._default_size = _round_up_to_odd_integer(width) kwargs['mode'] = 'linear_interp' super(Box2DKernel, self).__init__(**kwargs) self._truncation = 0 self.normalize() class Tophat2DKernel(Kernel2D): """ 2D Tophat filter kernel. The Tophat filter is an isotropic smoothing filter. It can produce artifact, when applied repeatedly on the same data. Parameters ---------- radius : int Radius of the filter kernel. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Tophat2DKernel tophat_2D_kernel = Tophat2DKernel(40) plt.imshow(tophat_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ def __init__(self, radius, **kwargs): self._model = models.Disk2D(1. / (np.pi * radius ** 2), 0, 0, radius) self._default_size = _round_up_to_odd_integer(2 * radius) super(Tophat2DKernel, self).__init__(**kwargs) self._truncation = 0 class Ring2DKernel(Kernel2D): """ 2D Ring filter kernel. The Ring filter kernel is the difference between two Tophat kernels of different width. This kernel is useful for, e.g., background estimation. Parameters ---------- radius_in : number Inner radius of the ring kernel. width : number Width of the ring kernel. mode: str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Gaussian2DKernel, MexicanHat2DKernel, Tophat2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Ring2DKernel ring_2D_kernel = Ring2DKernel(9, 8) plt.imshow(ring_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ def __init__(self, radius_in, width, **kwargs): radius_out = radius_in + width self._model = models.Ring2D(1. / (np.pi * (radius_out ** 2 - radius_in ** 2)), 0, 0, radius_in, width) self._default_size = _round_up_to_odd_integer(2 * radius_out) super(Ring2DKernel, self).__init__(**kwargs) self._truncation = 0 class Trapezoid1DKernel(Kernel1D): """ 1D trapezoid kernel. Parameters ---------- width : number Width of the filter kernel. slope : number Slope of the filter kernel's tails mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box1DKernel, Gaussian1DKernel, MexicanHat1DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import Trapezoid1DKernel trapezoid_1D_kernel = Trapezoid1DKernel(17, slope=0.2) plt.plot(trapezoid_1D_kernel, drawstyle='steps') plt.xlabel('x [pixels]') plt.ylabel('amplitude') plt.xlim(-1, 28) plt.show() """ _is_bool = False def __init__(self, width, slope=1., **kwargs): self._model = models.Trapezoid1D(1, 0, width, slope) self._default_size = _round_up_to_odd_integer(width + 2. / slope) super(Trapezoid1DKernel, self).__init__(**kwargs) self._truncation = 0 self.normalize() class TrapezoidDisk2DKernel(Kernel2D): """ 2D trapezoid kernel. Parameters ---------- width : number Width of the filter kernel. slope : number Slope of the filter kernel's tails mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import TrapezoidDisk2DKernel trapezoid_2D_kernel = TrapezoidDisk2DKernel(20, slope=0.2) plt.imshow(trapezoid_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ _is_bool = False def __init__(self, radius, slope=1., **kwargs): self._model = models.TrapezoidDisk2D(1, 0, 0, radius, slope) self._default_size = _round_up_to_odd_integer(2 * radius + 2. / slope) super(TrapezoidDisk2DKernel, self).__init__(**kwargs) self._truncation = 0 self.normalize() class MexicanHat1DKernel(Kernel1D): """ 1D Mexican hat filter kernel. The Mexican Hat, or inverted Gaussian-Laplace filter, is a bandpass filter. It smoothes the data and removes slowly varying or constant structures (e.g. Background). It is useful for peak or multi-scale detection. This kernel is derived from a normalized Gaussian. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box1DKernel, Gaussian1DKernel, Trapezoid1DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import MexicanHat1DKernel mexicanhat_1D_kernel = MexicanHat1DKernel(10) plt.plot(mexicanhat_1D_kernel, drawstyle='steps') plt.xlabel('x [pixels]') plt.ylabel('value') plt.show() """ _is_bool = True def __init__(self, width, **kwargs): amplitude = 1.0 / (np.sqrt(2 * np.pi) * width ** 3) self._model = models.MexicanHat1D(amplitude, 0, width) self._default_size = _round_up_to_odd_integer(8 * width) super(MexicanHat1DKernel, self).__init__(**kwargs) self._truncation = np.abs(self._array.sum() / self._array.size) self._normalization = 0 class MexicanHat2DKernel(Kernel2D): """ 2D Mexican hat filter kernel. The Mexican Hat, or inverted Gaussian-Laplace filter, is a bandpass filter. It smoothes the data and removes slowly varying or constant structures (e.g. Background). It is useful for peak or multi-scale detection. This kernel is derived from a normalized Gaussian. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. y_size : odd int, optional Size in y direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import MexicanHat2DKernel mexicanhat_2D_kernel = MexicanHat2DKernel(10) plt.imshow(mexicanhat_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ _is_bool = False def __init__(self, width, **kwargs): amplitude = 1.0 / (np.pi * width ** 4) self._model = models.MexicanHat2D(amplitude, 0, 0, width) self._default_size = _round_up_to_odd_integer(8 * width) super(MexicanHat2DKernel, self).__init__(**kwargs) self._truncation = np.abs(self._array.sum() / self._array.size) self._normalization = 0 class AiryDisk2DKernel(Kernel2D): """ 2D Airy disk kernel. This kernel models the diffraction pattern of a circular aperture. This kernel is normalized to a peak value of 1. Parameters ---------- width : number Width of the filter kernel. x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. y_size : odd int, optional Size in y direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. See Also -------- Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel, TrapezoidDisk2DKernel, AiryDisk2DKernel Examples -------- Kernel response: .. plot:: :include-source: import matplotlib.pyplot as plt from astropy.convolution import AiryDisk2DKernel airydisk_2D_kernel = AiryDisk2DKernel(10) plt.imshow(airydisk_2D_kernel, interpolation='none', origin='lower') plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ _is_bool = False def __init__(self, width, **kwargs): self._model = models.AiryDisk2D(1, 0, 0, width) self._default_size = _round_up_to_odd_integer(8 * width) super(AiryDisk2DKernel, self).__init__(**kwargs) self.normalize() self._truncation = None class Model1DKernel(Kernel1D): """ Create kernel from astropy.models.Parametric1DModel. The model has to be centered on x = 0. Parameters ---------- model : Parametric1DModel Kernel response function model x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by linearly interpolating between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. Raises ------ TypeError If model is not an instance of astropy.models.Parametric1DModel See also -------- Model2DKernel : Create kernel from astropy.models.Parametric2DModel CustomKernel : Create kernel from list or array Examples -------- Define a Gaussian1D model: >>> from astropy.modeling.models import Gaussian1D >>> from astropy.convolution.kernels import Model1DKernel >>> gauss = Gaussian1D(1, 0, 2) And create a custom one dimensional kernel from it: >>> gauss_kernel = Model1DKernel(gauss, x_size=9) This kernel can now be used like a usual astropy kernel. """ _separable = False _is_bool = False def __init__(self, model, **kwargs): if isinstance(model, Parametric1DModel): self._model = model else: raise TypeError("Must be Parametric1DModel") super(Model1DKernel, self).__init__(**kwargs) class Model2DKernel(Kernel2D): """ Create kernel from astropy.models.Parametric2DModel. The model has to be centered on x = 0 and y= 0. Parameters ---------- model : Parametric2DModel Kernel response function model x_size : odd int, optional Size in x direction of the kernel array. Default = 8 * width. y_size : odd int, optional Size in y direction of the kernel array. Default = 8 * width. mode : str, optional One of the following discretization modes: * 'center' (default) Discretize model by taking the value at the center of the bin. * 'linear_interp' Discretize model by performing a bilinear interpolation between the values at the corners of the bin. * 'oversample' Discretize model by taking the average on an oversampled grid. * 'integrate' Discretize model by integrating the model over the bin. factor : number, optional Factor of oversampling. Default factor = 10. Raises ------ TypeError If model is not an instance of astropy.models.Parametric2DModel See also -------- Model1DKernel : Create kernel from astropy.models.Parametric1DModel CustomKernel : Create kernel from list or array Examples -------- Define a Gaussian2D model: >>> from astropy.modeling.models import Gaussian2D >>> from astropy.convolution.kernels import Model2DKernel >>> gauss = Gaussian2D(1, 0, 0, 2, 2) And create a custom two dimensional kernel from it: >>> gauss_kernel = Model2DKernel(gauss, x_size=9) This kernel can now be used like a usual astropy kernel. """ _is_bool = False _separable = False def __init__(self, model, **kwargs): self._separable = False if isinstance(model, Parametric2DModel): self._model = model else: raise TypeError("Must be Parametric2DModel") class PSFKernel(Kernel2D): """ Initialize filter kernel from astropy PSF instance. """ _separable = False def __init__(self): raise NotImplementedError('Not yet implemented') class CustomKernel(Kernel): """ Create filter kernel from list or array. Parameters ---------- array : list or array Filter kernel array. Size must be odd. Raises ------ TypeError If array is not a list or array. KernelSizeError If array size is even. See also -------- Model2DKernel, Model1DKernel Examples -------- Define one dimensional array: >>> from astropy.convolution.kernels import CustomKernel >>> import numpy as np >>> array = np.array([1, 2, 3, 2, 1]) >>> kernel = CustomKernel(array) >>> kernel.dimension 1 Define two dimensional array: >>> array = np.array([[1, 1, 1], [1, 2, 1], [1, 1, 1]]) >>> kernel = CustomKernel(array) >>> kernel.dimension 2 """ def __init__(self, array): self.array = array super(CustomKernel, self).__init__(self._array) @property def array(self): """ Filter kernel array. """ return self._array @array.setter def array(self, array): """ Filter kernel array setter """ if isinstance(array, np.ndarray): self._array = array elif isinstance(array, list): self._array = np.array(array) else: raise TypeError("Must be list or array.") #Check if array is odd in all axis odd = np.all([axes_size % 2 != 0 for axes_size in self.shape]) if not odd: raise KernelSizeError("Kernel size must be odd in all axes.") # Check if array is bool ones = self._array == 1. zeros = self._array == 0 self._is_bool = np.all(np.logical_or(ones, zeros)) # Set normalization self._normalization = 1. / self._array.sum() astropy-0.3/astropy/convolution/utils.py0000644000175000017500000002254712243255342017003 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import division import numpy as np from ..modeling.core import Parametric1DModel, Parametric2DModel __all__ = ['discretize_model'] class DiscretizationError(Exception): """ Called when discretization of models goes wrong. """ class KernelSizeError(Exception): """ Called when size of kernels is even. """ def add_kernel_arrays_1D(array_1, array_2): """ Add two 1D kernel arrays of different size. The arrays are added with the centers lying upon each other. """ if array_1.size > array_2.size: new_array = array_1.copy() center = array_1.size // 2 slice_ = slice(center - array_2.size // 2, center + array_2.size // 2 + 1) new_array[slice_] += array_2 return new_array elif array_2.size > array_1.size: new_array = array_2.copy() center = array_2.size // 2 slice_ = slice(center - array_1.size // 2, center + array_1.size // 2 + 1) new_array[slice_] += array_1 return new_array return array_2 + array_1 def add_kernel_arrays_2D(array_1, array_2): """ Add two 1D kernel arrays of different size. The arrays are added with the centers lying upon each other. """ if array_1.size > array_2.size: new_array = array_1.copy() center = [axes_size // 2 for axes_size in array_1.shape] slice_x = slice(center[1] - array_2.shape[1] // 2, center[1] + array_2.shape[1] // 2 + 1) slice_y = slice(center[0] - array_2.shape[0] // 2, center[0] + array_2.shape[0] // 2 + 1) new_array[slice_y, slice_x] += array_2 return new_array elif array_2.size > array_1.size: new_array = array_2.copy() center = [axes_size // 2 for axes_size in array_2.shape] slice_x = slice(center[1] - array_1.shape[1] // 2, center[1] + array_1.shape[1] // 2 + 1) slice_y = slice(center[0] - array_1.shape[0] // 2, center[0] + array_1.shape[0] // 2 + 1) new_array[slice_y, slice_x] += array_1 return new_array return array_2 + array_1 def discretize_model(model, x_range, y_range=None, mode='center', factor=10): """ Function to evaluate analytical models on a grid. Parameters ---------- model : :class:`~astropy.modeling.core.ParametricModel` instance Instance of a :class:`~astropy.modeling.core.ParametricModel` to be evaluated. x_range : tuple x range in which the model is evaluated. y_range : tuple, optional y range in which the model is evaluated. Necessary only for 2D models. mode : str, optional One of the following modes: * ``'center'`` (default) Discretize model by taking the value at the center of the bin. * ``'linear_interp'`` Discretize model by linearly interpolating between the values at the corners of the bin. For 2D models interpolation is bilinear. * ``'oversample'`` Discretize model by taking the average on an oversampled grid. * ``'integrate'`` Discretize model by integrating the model over the bin using `scipy.integrate.quad`. Very slow. factor : float or int Factor of oversampling. Default = 10. Notes ----- The ``oversample`` mode allows to conserve the integral on a subpixel scale. Here is the example of a normalized Gaussian1D: .. plot:: :include-source: import matplotlib.pyplot as plt import numpy as np from astropy.modeling.models import Gaussian1D from astropy.convolution.utils import discretize_model gauss_1D = Gaussian1D(1 / (0.5 * np.sqrt(2 * np.pi)), 0, 0.5) y_center = discretize_model(gauss_1D, (-2, 3), mode='center') y_corner = discretize_model(gauss_1D, (-2, 3), mode='linear_interp') y_oversample = discretize_model(gauss_1D, (-2, 3), mode='oversample') plt.plot(y_center, label='center sum = {0:3f}'.format(y_center.sum())) plt.plot(y_corner, label='linear_interp sum = {0:3f}'.format(y_corner.sum())) plt.plot(y_oversample, label='oversample sum = {0:3f}'.format(y_oversample.sum())) plt.xlabel('pixels') plt.ylabel('value') plt.legend() plt.show() """ if isinstance(model, Parametric2DModel) and y_range is None: raise Exception("Please specify y range.") if mode == "center": if isinstance(model, Parametric1DModel): return discretize_center_1D(model, x_range) if isinstance(model, Parametric2DModel): return discretize_center_2D(model, x_range, y_range) elif mode == "linear_interp": if isinstance(model, Parametric1DModel): return discretize_linear_1D(model, x_range) if isinstance(model, Parametric2DModel): return discretize_bilinear_2D(model, x_range, y_range) elif mode == "oversample": if isinstance(model, Parametric1DModel): return discretize_oversample_1D(model, x_range, factor) if isinstance(model, Parametric2DModel): return discretize_oversample_2D(model, x_range, y_range, factor) elif mode == "integrate": if isinstance(model, Parametric1DModel): return discretize_integrate_1D(model, x_range) if isinstance(model, Parametric2DModel): return discretize_integrate_2D(model, x_range, y_range) else: raise DiscretizationError('Invalid mode.') def discretize_center_1D(model, x_range): """ Discretize model by taking the value at the center of the bin. """ x = np.arange(*x_range) return model(x) def discretize_center_2D(model, x_range, y_range): """ Discretize model by taking the value at the center of the pixel. """ x = np.arange(*x_range) y = np.arange(*y_range) x, y = np.meshgrid(x, y) return model(x, y) def discretize_linear_1D(model, x_range): """ Discretize model by performing a linear interpolation. """ # Evaluate model 0.5 pixel outside the boundaries x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5) values_intermediate_grid = model(x) return 0.5 * (values_intermediate_grid[1:] + values_intermediate_grid[:-1]) def discretize_bilinear_2D(model, x_range, y_range): """ Discretize model by performing a bilinear interpolation. """ # Evaluate model 0.5 pixel outside the boundaries x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5) y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5) x, y = np.meshgrid(x, y) values_intermediate_grid = model(x, y) # Mean in y direction values = 0.5 * (values_intermediate_grid[1:, :] + values_intermediate_grid[:-1, :]) # Mean in x direction values = 0.5 * (values[:, 1:] + values[:, :-1]) return values def discretize_oversample_1D(model, x_range, factor=10): """ Discretize model by taking the average on an oversampled grid. """ # Evaluate model on oversampled grid x = np.arange(x_range[0] - 0.5 * (1 - 1 / factor), x_range[1] + 0.5 * (1 + 1 / factor), 1. / factor) values = model(x) # Reshape and compute mean values = np.reshape(values, (x.size / factor, factor)) return values.mean(axis=1)[:-1] def discretize_oversample_2D(model, x_range, y_range, factor=10): """ Discretize model by taking the average on an oversampled grid. """ # Evaluate model on oversampled grid x = np.arange(x_range[0] - 0.5 * (1 - 1 / factor), x_range[1] + 0.5 * (1 + 1 / factor), 1. / factor) y = np.arange(y_range[0] - 0.5 * (1 - 1 / factor), y_range[1] + 0.5 * (1 + 1 / factor), 1. / factor) x_grid, y_grid = np.meshgrid(x, y) values = model(x_grid, y_grid) # Reshape and compute mean shape = (y.size / factor, factor, x.size / factor, factor) values = np.reshape(values, shape) return values.mean(axis=3).mean(axis=1)[:-1, :-1] def discretize_integrate_1D(model, x_range): """ Discretize model by integrating numerically the model over the bin. """ try: from scipy.integrate import quad except ImportError: raise Exception("Mode 'integrate' requires scipy.") # Set up grid x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5) values = np.array([]) # Integrate over all bins for i in range(x.size - 1): values = np.append(values, quad(model, x[i], x[i + 1])[0]) return values def discretize_integrate_2D(model, x_range, y_range): """ Discretize model by integrating the model over the pixel. """ try: from scipy.integrate import dblquad except ImportError: raise Exception("Mode 'integrate' requires scipy.") # Set up grid x = np.arange(x_range[0] - 0.5, x_range[1] + 0.5) y = np.arange(y_range[0] - 0.5, y_range[1] + 0.5) values = np.empty((y.size - 1, x.size - 1)) # Integrate over all pixels for i in range(x.size - 1): for j in range(y.size - 1): values[j, i] = dblquad(model, x[i], x[i + 1], lambda x: y[j], lambda x: y[j + 1])[0] return values astropy-0.3/astropy/convolution/boundary_none.c0000644000175000017500000126242612243255475020311 0ustar oleole/* Generated by Cython 0.18 on Wed Nov 20 19:59:43 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__astropy__convolution__boundary_none #define __PYX_HAVE_API__astropy__convolution__boundary_none #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "boundary_none.pyx", "numpy.pxd", "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "astropy/convolution/boundary_none.pyx":7 * * DTYPE = np.float * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<< * * cdef extern from "numpy/npy_math.h": */ typedef __pyx_t_5numpy_float_t __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'astropy.convolution.boundary_none' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "astropy.convolution.boundary_none" int __pyx_module_is_main_astropy__convolution__boundary_none = 0; /* Implementation of 'astropy.convolution.boundary_none' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_convolve1d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_2convolve2d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_4convolve3d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Convolution kernel must have odd dimensions"; static char __pyx_k_5[] = "ndarray is not C contiguous"; static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; static char __pyx_k_9[] = "Non-native byte order not supported"; static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_15[] = "Format string allocated too short."; static char __pyx_k_19[] = "convolve1d_boundary_none"; static char __pyx_k_20[] = "/internal/1/root/src/astropy/astropy-release/astropy/convolution/boundary_none.pyx"; static char __pyx_k_21[] = "astropy.convolution.boundary_none"; static char __pyx_k_24[] = "convolve2d_boundary_none"; static char __pyx_k_27[] = "convolve3d_boundary_none"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__ii[] = "ii"; static char __pyx_k__jj[] = "jj"; static char __pyx_k__kk[] = "kk"; static char __pyx_k__np[] = "np"; static char __pyx_k__nx[] = "nx"; static char __pyx_k__ny[] = "ny"; static char __pyx_k__nz[] = "nz"; static char __pyx_k__bot[] = "bot"; static char __pyx_k__ker[] = "ker"; static char __pyx_k__nkx[] = "nkx"; static char __pyx_k__nky[] = "nky"; static char __pyx_k__nkz[] = "nkz"; static char __pyx_k__top[] = "top"; static char __pyx_k__val[] = "val"; static char __pyx_k__wkx[] = "wkx"; static char __pyx_k__wky[] = "wky"; static char __pyx_k__wkz[] = "wkz"; static char __pyx_k__conv[] = "conv"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__fixed[] = "fixed"; static char __pyx_k__float[] = "float"; static char __pyx_k__iimax[] = "iimax"; static char __pyx_k__iimin[] = "iimin"; static char __pyx_k__jjmax[] = "jjmax"; static char __pyx_k__jjmin[] = "jjmin"; static char __pyx_k__kkmax[] = "kkmax"; static char __pyx_k__kkmin[] = "kkmin"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_n_s_19; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_n_s_21; static PyObject *__pyx_n_s_24; static PyObject *__pyx_n_s_27; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__bot; static PyObject *__pyx_n_s__conv; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__fixed; static PyObject *__pyx_n_s__float; static PyObject *__pyx_n_s__g; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__ii; static PyObject *__pyx_n_s__iimax; static PyObject *__pyx_n_s__iimin; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__jj; static PyObject *__pyx_n_s__jjmax; static PyObject *__pyx_n_s__jjmin; static PyObject *__pyx_n_s__k; static PyObject *__pyx_n_s__ker; static PyObject *__pyx_n_s__kk; static PyObject *__pyx_n_s__kkmax; static PyObject *__pyx_n_s__kkmin; static PyObject *__pyx_n_s__nkx; static PyObject *__pyx_n_s__nky; static PyObject *__pyx_n_s__nkz; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__nx; static PyObject *__pyx_n_s__ny; static PyObject *__pyx_n_s__nz; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__top; static PyObject *__pyx_n_s__val; static PyObject *__pyx_n_s__wkx; static PyObject *__pyx_n_s__wky; static PyObject *__pyx_n_s__wkz; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_codeobj_18; static PyObject *__pyx_k_codeobj_23; static PyObject *__pyx_k_codeobj_26; /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_1convolve1d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_none_1convolve1d_boundary_none = {__Pyx_NAMESTR("convolve1d_boundary_none"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_none_1convolve1d_boundary_none, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_1convolve1d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve1d_boundary_none (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_none", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve1d_boundary_none") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_none", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve1d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_none_convolve1d_boundary_none(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_none.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_convolve1d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_nkx; int __pyx_v_wkx; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_ii; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; unsigned int __pyx_t_12; int __pyx_t_13; long __pyx_t_14; unsigned int __pyx_t_15; unsigned int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve1d_boundary_none", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; /* "astropy/convolution/boundary_none.pyx":19 * np.ndarray[DTYPE_t, ndim=1] g): * * if g.shape[0] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":20 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_none.pyx":22 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_1; } if (unlikely(!__pyx_t_6)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_none.pyx":24 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":25 * * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":26 * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * * # The following need to be set to zeros rather than empty because the */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_none.pyx":30 * # The following need to be set to zeros rather than empty because the * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.zeros([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.zeros([nx], dtype=DTYPE) * */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_none.pyx":31 * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.zeros([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.zeros([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * * cdef unsigned int i, ii */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "astropy/convolution/boundary_none.pyx":41 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * if npy_isnan(f[i]) and i >= wkx and i < nx - wkx: * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_none.pyx":42 * # neighboring values * for i in range(nx): * if npy_isnan(f[i]) and i >= wkx and i < nx - wkx: # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_12 = __pyx_v_i; __pyx_t_6 = npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_f.diminfo[0].strides))); if (__pyx_t_6) { __pyx_t_1 = (__pyx_v_i >= __pyx_v_wkx); if (__pyx_t_1) { __pyx_t_5 = (__pyx_v_i < (__pyx_v_nx - __pyx_v_wkx)); __pyx_t_13 = __pyx_t_5; } else { __pyx_t_13 = __pyx_t_1; } __pyx_t_1 = __pyx_t_13; } else { __pyx_t_1 = __pyx_t_6; } if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":43 * for i in range(nx): * if npy_isnan(f[i]) and i >= wkx and i < nx - wkx: * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":44 * if npy_isnan(f[i]) and i >= wkx and i < nx - wkx: * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * val = f[ii] */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":45 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * val = f[ii] * if not npy_isnan(val): */ __pyx_t_14 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_15 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_ii = __pyx_t_15; /* "astropy/convolution/boundary_none.pyx":46 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * val = f[ii] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i)] */ __pyx_t_16 = __pyx_v_ii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_f.diminfo[0].strides)); /* "astropy/convolution/boundary_none.pyx":47 * for ii in range(i - wkx, i + wkx + 1): * val = f[ii] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * top += val * ker */ __pyx_t_1 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":48 * val = f[ii] * if not npy_isnan(val): * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_17 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_none.pyx":49 * if not npy_isnan(val): * ker = g[(wkx + ii - i)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":50 * ker = g[(wkx + ii - i)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L9; } __pyx_L9:; } /* "astropy/convolution/boundary_none.pyx":51 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i] = top / bot * else: */ __pyx_t_1 = (__pyx_v_bot != 0.); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":52 * bot += ker * if bot != 0.: * fixed[i] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_fixed.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":54 * fixed[i] = top / bot * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L10:; goto __pyx_L6; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":56 * fixed[i] = f[i] * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_20 = __pyx_v_i; __pyx_t_21 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L6:; } /* "astropy/convolution/boundary_none.pyx":59 * * # Now run the proper convolution * for i in range(wkx, nx - wkx): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i]): * top = 0. */ __pyx_t_10 = (__pyx_v_nx - __pyx_v_wkx); for (__pyx_t_11 = __pyx_v_wkx; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_none.pyx":60 * # Now run the proper convolution * for i in range(wkx, nx - wkx): * if not npy_isnan(fixed[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_22 = __pyx_v_i; __pyx_t_1 = (!npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_fixed.diminfo[0].strides)))); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":61 * for i in range(wkx, nx - wkx): * if not npy_isnan(fixed[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":62 * if not npy_isnan(fixed[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * val = fixed[ii] */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":63 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * val = fixed[ii] * ker = g[(wkx + ii - i)] */ __pyx_t_14 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_23 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_23 < __pyx_t_14; __pyx_t_23+=1) { __pyx_v_ii = __pyx_t_23; /* "astropy/convolution/boundary_none.pyx":64 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * val = fixed[ii] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * if not npy_isnan(val): */ __pyx_t_24 = __pyx_v_ii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_fixed.diminfo[0].strides)); /* "astropy/convolution/boundary_none.pyx":65 * for ii in range(i - wkx, i + wkx + 1): * val = fixed[ii] * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_25 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_none.pyx":66 * val = fixed[ii] * ker = g[(wkx + ii - i)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_1 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":67 * ker = g[(wkx + ii - i)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":68 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L16; } __pyx_L16:; } /* "astropy/convolution/boundary_none.pyx":69 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i] = top / bot * else: */ __pyx_t_1 = (__pyx_v_bot != 0.0); if (__pyx_t_1) { /* "astropy/convolution/boundary_none.pyx":70 * bot += ker * if bot != 0: * conv[i] = top / bot # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_23 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_conv.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L17; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":72 * conv[i] = top / bot * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L17:; goto __pyx_L13; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":74 * conv[i] = fixed[i] * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L13:; } /* "astropy/convolution/boundary_none.pyx":76 * conv[i] = fixed[i] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve1d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_3convolve2d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_none_3convolve2d_boundary_none = {__Pyx_NAMESTR("convolve2d_boundary_none"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_none_3convolve2d_boundary_none, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_3convolve2d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve2d_boundary_none (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_none", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve2d_boundary_none") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_none", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve2d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_none_2convolve2d_boundary_none(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_none.pyx":80 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_2convolve2d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_wkx; int __pyx_v_wky; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_ii; unsigned int __pyx_v_jj; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; int __pyx_t_12; unsigned int __pyx_t_13; unsigned int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; long __pyx_t_19; unsigned int __pyx_t_20; long __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve2d_boundary_none", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; /* "astropy/convolution/boundary_none.pyx":83 * np.ndarray[DTYPE_t, ndim=2] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":84 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_none.pyx":86 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) { __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_none.pyx":88 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":89 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_none.pyx":90 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":91 * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_none.pyx":92 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_none.pyx":93 * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * * # The following need to be set to zeros rather than empty because the */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_none.pyx":97 * # The following need to be set to zeros rather than empty because the * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.zeros([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.zeros([nx, ny], dtype=DTYPE) * */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_none.pyx":98 * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.zeros([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.zeros([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * * cdef unsigned int i, j, ii, jj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_none.pyx":108 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_none.pyx":109 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky: */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_none.pyx":110 * for i in range(nx): * for j in range(ny): * if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ # <<<<<<<<<<<<<< * and j >= wky and j < ny - wky: * top = 0. */ __pyx_t_14 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; __pyx_t_2 = npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_f.diminfo[1].strides))); if (__pyx_t_2) { __pyx_t_3 = (__pyx_v_i >= __pyx_v_wkx); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":111 * for j in range(ny): * if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky: # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_1 = (__pyx_v_i < (__pyx_v_nx - __pyx_v_wkx)); if (__pyx_t_1) { __pyx_t_16 = (__pyx_v_j >= __pyx_v_wky); if (__pyx_t_16) { __pyx_t_17 = (__pyx_v_j < (__pyx_v_ny - __pyx_v_wky)); __pyx_t_18 = __pyx_t_17; } else { __pyx_t_18 = __pyx_t_16; } __pyx_t_16 = __pyx_t_18; } else { __pyx_t_16 = __pyx_t_1; } __pyx_t_1 = __pyx_t_16; } else { __pyx_t_1 = __pyx_t_3; } __pyx_t_3 = __pyx_t_1; } else { __pyx_t_3 = __pyx_t_2; } if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":112 * if npy_isnan(f[i, j]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky: * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":113 * and j >= wky and j < ny - wky: * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":114 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * for jj in range(j - wky, j + wky + 1): * val = f[ii, jj] */ __pyx_t_19 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_20 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { __pyx_v_ii = __pyx_t_20; /* "astropy/convolution/boundary_none.pyx":115 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): # <<<<<<<<<<<<<< * val = f[ii, jj] * if not npy_isnan(val): */ __pyx_t_21 = ((__pyx_v_j + __pyx_v_wky) + 1); for (__pyx_t_22 = (__pyx_v_j - __pyx_v_wky); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_jj = __pyx_t_22; /* "astropy/convolution/boundary_none.pyx":116 * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): * val = f[ii, jj] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_23 = __pyx_v_ii; __pyx_t_24 = __pyx_v_jj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_f.diminfo[1].strides)); /* "astropy/convolution/boundary_none.pyx":117 * for jj in range(j - wky, j + wky + 1): * val = f[ii, jj] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_3 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":119 * if not npy_isnan(val): * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_25 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_26 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_none.pyx":120 * ker = g[(wkx + ii - i), * (wky + jj - j)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":121 * (wky + jj - j)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L13; } __pyx_L13:; } } /* "astropy/convolution/boundary_none.pyx":122 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j] = top / bot * else: */ __pyx_t_3 = (__pyx_v_bot != 0.); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":123 * bot += ker * if bot != 0.: * fixed[i, j] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = __pyx_v_i; __pyx_t_22 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_fixed.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L14; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":125 * fixed[i, j] = top / bot * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ __pyx_t_27 = __pyx_v_i; __pyx_t_28 = __pyx_v_j; __pyx_t_29 = __pyx_v_i; __pyx_t_30 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L14:; goto __pyx_L8; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":127 * fixed[i, j] = f[i, j] * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_31 = __pyx_v_i; __pyx_t_32 = __pyx_v_j; __pyx_t_33 = __pyx_v_i; __pyx_t_34 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L8:; } } /* "astropy/convolution/boundary_none.pyx":130 * * # Now run the proper convolution * for i in range(wkx, nx - wkx): # <<<<<<<<<<<<<< * for j in range(wky, ny - wky): * if not npy_isnan(fixed[i, j]): */ __pyx_t_10 = (__pyx_v_nx - __pyx_v_wkx); for (__pyx_t_11 = __pyx_v_wkx; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_none.pyx":131 * # Now run the proper convolution * for i in range(wkx, nx - wkx): * for j in range(wky, ny - wky): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j]): * top = 0. */ __pyx_t_12 = (__pyx_v_ny - __pyx_v_wky); for (__pyx_t_13 = __pyx_v_wky; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_none.pyx":132 * for i in range(wkx, nx - wkx): * for j in range(wky, ny - wky): * if not npy_isnan(fixed[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_35 = __pyx_v_i; __pyx_t_36 = __pyx_v_j; __pyx_t_3 = (!npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_fixed.diminfo[1].strides)))); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":133 * for j in range(wky, ny - wky): * if not npy_isnan(fixed[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":134 * if not npy_isnan(fixed[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":135 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * for jj in range(j - wky, j + wky + 1): * val = fixed[ii, jj] */ __pyx_t_19 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_37 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_37 < __pyx_t_19; __pyx_t_37+=1) { __pyx_v_ii = __pyx_t_37; /* "astropy/convolution/boundary_none.pyx":136 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): # <<<<<<<<<<<<<< * val = fixed[ii, jj] * ker = g[(wkx + ii - i), */ __pyx_t_21 = ((__pyx_v_j + __pyx_v_wky) + 1); for (__pyx_t_38 = (__pyx_v_j - __pyx_v_wky); __pyx_t_38 < __pyx_t_21; __pyx_t_38+=1) { __pyx_v_jj = __pyx_t_38; /* "astropy/convolution/boundary_none.pyx":137 * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): * val = fixed[ii, jj] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_39 = __pyx_v_ii; __pyx_t_40 = __pyx_v_jj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_fixed.diminfo[1].strides)); /* "astropy/convolution/boundary_none.pyx":139 * val = fixed[ii, jj] * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_41 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_42 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_none.pyx":140 * ker = g[(wkx + ii - i), * (wky + jj - j)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_3 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":141 * (wky + jj - j)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":142 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L24; } __pyx_L24:; } } /* "astropy/convolution/boundary_none.pyx":143 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j] = top / bot * else: */ __pyx_t_3 = (__pyx_v_bot != 0.0); if (__pyx_t_3) { /* "astropy/convolution/boundary_none.pyx":144 * bot += ker * if bot != 0: * conv[i, j] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_37 = __pyx_v_i; __pyx_t_38 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_conv.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":146 * conv[i, j] = top / bot * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ __pyx_t_43 = __pyx_v_i; __pyx_t_44 = __pyx_v_j; __pyx_t_45 = __pyx_v_i; __pyx_t_46 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L25:; goto __pyx_L19; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":148 * conv[i, j] = fixed[i, j] * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_47 = __pyx_v_i; __pyx_t_48 = __pyx_v_j; __pyx_t_49 = __pyx_v_i; __pyx_t_50 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L19:; } } /* "astropy/convolution/boundary_none.pyx":150 * conv[i, j] = fixed[i, j] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve2d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_5convolve3d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_none_5convolve3d_boundary_none = {__Pyx_NAMESTR("convolve3d_boundary_none"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_none_5convolve3d_boundary_none, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_none_5convolve3d_boundary_none(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve3d_boundary_none (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_none", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve3d_boundary_none") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_none", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve3d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_none_4convolve3d_boundary_none(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_none.pyx":154 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_none_4convolve3d_boundary_none(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nz; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_nkz; int __pyx_v_wkx; int __pyx_v_wky; int __pyx_v_wkz; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_k; unsigned int __pyx_v_ii; unsigned int __pyx_v_jj; unsigned int __pyx_v_kk; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; int __pyx_t_12; unsigned int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; int __pyx_t_24; long __pyx_t_25; unsigned int __pyx_t_26; long __pyx_t_27; unsigned int __pyx_t_28; long __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; unsigned int __pyx_t_51; unsigned int __pyx_t_52; unsigned int __pyx_t_53; unsigned int __pyx_t_54; unsigned int __pyx_t_55; unsigned int __pyx_t_56; unsigned int __pyx_t_57; unsigned int __pyx_t_58; unsigned int __pyx_t_59; unsigned int __pyx_t_60; unsigned int __pyx_t_61; unsigned int __pyx_t_62; unsigned int __pyx_t_63; unsigned int __pyx_t_64; unsigned int __pyx_t_65; unsigned int __pyx_t_66; unsigned int __pyx_t_67; unsigned int __pyx_t_68; unsigned int __pyx_t_69; unsigned int __pyx_t_70; unsigned int __pyx_t_71; unsigned int __pyx_t_72; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve3d_boundary_none", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_f.diminfo[2].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_f.diminfo[2].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[2]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_g.diminfo[2].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_g.diminfo[2].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[2]; /* "astropy/convolution/boundary_none.pyx":157 * np.ndarray[DTYPE_t, ndim=3] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); if (!__pyx_t_2) { __pyx_t_3 = (__Pyx_mod_long((__pyx_v_g->dimensions[2]), 2) != 1); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":158 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_none.pyx":160 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_none.pyx":162 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":163 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_none.pyx":164 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_nz = (__pyx_v_f->dimensions[2]); /* "astropy/convolution/boundary_none.pyx":165 * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_none.pyx":166 * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_none.pyx":167 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nkz = (__pyx_v_g->dimensions[2]); /* "astropy/convolution/boundary_none.pyx":168 * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_none.pyx":169 * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef int wkz = nkz // 2 * */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_none.pyx":170 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 # <<<<<<<<<<<<<< * * # The following need to be set to zeros rather than empty because the */ __pyx_v_wkz = __Pyx_div_long(__pyx_v_nkz, 2); /* "astropy/convolution/boundary_none.pyx":174 * # The following need to be set to zeros rather than empty because the * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.zeros([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.zeros([nx, ny, nz], dtype=DTYPE) * */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_fixed.diminfo[2].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_fixed.diminfo[2].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[2]; } } __pyx_t_10 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_none.pyx":175 * # boundary does not get reset. * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.zeros([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.zeros([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * * cdef unsigned int i, j, k, ii, jj, kk */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_conv.diminfo[2].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_conv.diminfo[2].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[2]; } } __pyx_t_11 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "astropy/convolution/boundary_none.pyx":185 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_none.pyx":186 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_none.pyx":187 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_none.pyx":188 * for j in range(ny): * for k in range(nz): * if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ # <<<<<<<<<<<<<< * and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: * top = 0. */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_j; __pyx_t_20 = __pyx_v_k; __pyx_t_4 = npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_f.diminfo[2].strides))); if (__pyx_t_4) { __pyx_t_2 = (__pyx_v_i >= __pyx_v_wkx); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":189 * for k in range(nz): * if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_1 = (__pyx_v_i < (__pyx_v_nx - __pyx_v_wkx)); if (__pyx_t_1) { __pyx_t_3 = (__pyx_v_j >= __pyx_v_wky); if (__pyx_t_3) { __pyx_t_21 = (__pyx_v_j < (__pyx_v_ny - __pyx_v_wky)); if (__pyx_t_21) { __pyx_t_22 = (__pyx_v_k >= __pyx_v_wkz); if (__pyx_t_22) { __pyx_t_23 = (__pyx_v_k <= (__pyx_v_nz - __pyx_v_wkz)); __pyx_t_24 = __pyx_t_23; } else { __pyx_t_24 = __pyx_t_22; } __pyx_t_22 = __pyx_t_24; } else { __pyx_t_22 = __pyx_t_21; } __pyx_t_21 = __pyx_t_22; } else { __pyx_t_21 = __pyx_t_3; } __pyx_t_3 = __pyx_t_21; } else { __pyx_t_3 = __pyx_t_1; } __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_4; } if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":190 * if npy_isnan(f[i, j, k]) and i >= wkx and i < nx - wkx \ * and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":191 * and j >= wky and j < ny - wky and k >= wkz and k <= nz - wkz: * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":192 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): */ __pyx_t_25 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_26 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_ii = __pyx_t_26; /* "astropy/convolution/boundary_none.pyx":193 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): # <<<<<<<<<<<<<< * for kk in range(k - wkz, k + wkz + 1): * val = f[ii, jj, kk] */ __pyx_t_27 = ((__pyx_v_j + __pyx_v_wky) + 1); for (__pyx_t_28 = (__pyx_v_j - __pyx_v_wky); __pyx_t_28 < __pyx_t_27; __pyx_t_28+=1) { __pyx_v_jj = __pyx_t_28; /* "astropy/convolution/boundary_none.pyx":194 * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): # <<<<<<<<<<<<<< * val = f[ii, jj, kk] * if not npy_isnan(val): */ __pyx_t_29 = ((__pyx_v_k + __pyx_v_wkz) + 1); for (__pyx_t_30 = (__pyx_v_k - __pyx_v_wkz); __pyx_t_30 < __pyx_t_29; __pyx_t_30+=1) { __pyx_v_kk = __pyx_t_30; /* "astropy/convolution/boundary_none.pyx":195 * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): * val = f[ii, jj, kk] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_31 = __pyx_v_ii; __pyx_t_32 = __pyx_v_jj; __pyx_t_33 = __pyx_v_kk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_33, __pyx_pybuffernd_f.diminfo[2].strides)); /* "astropy/convolution/boundary_none.pyx":196 * for kk in range(k - wkz, k + wkz + 1): * val = f[ii, jj, kk] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":199 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_34 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_35 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_36 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_36, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_none.pyx":200 * (wky + jj - j), * (wkz + kk - k)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":201 * (wkz + kk - k)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L17; } __pyx_L17:; } } } /* "astropy/convolution/boundary_none.pyx":202 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j, k] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":203 * bot += ker * if bot != 0.: * fixed[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_26 = __pyx_v_i; __pyx_t_28 = __pyx_v_j; __pyx_t_30 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_fixed.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L18; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":205 * fixed[i, j, k] = top / bot * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ __pyx_t_37 = __pyx_v_i; __pyx_t_38 = __pyx_v_j; __pyx_t_39 = __pyx_v_k; __pyx_t_40 = __pyx_v_i; __pyx_t_41 = __pyx_v_j; __pyx_t_42 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_42, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L18:; goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":207 * fixed[i, j, k] = f[i, j, k] * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_43 = __pyx_v_i; __pyx_t_44 = __pyx_v_j; __pyx_t_45 = __pyx_v_k; __pyx_t_46 = __pyx_v_i; __pyx_t_47 = __pyx_v_j; __pyx_t_48 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_45, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L10:; } } } /* "astropy/convolution/boundary_none.pyx":210 * * # Now run the proper convolution * for i in range(wkx, nx - wkx): # <<<<<<<<<<<<<< * for j in range(wky, ny - wky): * for k in range(wkz, nz - wkz): */ __pyx_t_12 = (__pyx_v_nx - __pyx_v_wkx); for (__pyx_t_13 = __pyx_v_wkx; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_none.pyx":211 * # Now run the proper convolution * for i in range(wkx, nx - wkx): * for j in range(wky, ny - wky): # <<<<<<<<<<<<<< * for k in range(wkz, nz - wkz): * if not npy_isnan(fixed[i, j, k]): */ __pyx_t_14 = (__pyx_v_ny - __pyx_v_wky); for (__pyx_t_15 = __pyx_v_wky; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_none.pyx":212 * for i in range(wkx, nx - wkx): * for j in range(wky, ny - wky): * for k in range(wkz, nz - wkz): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j, k]): * top = 0. */ __pyx_t_16 = (__pyx_v_nz - __pyx_v_wkz); for (__pyx_t_17 = __pyx_v_wkz; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_none.pyx":213 * for j in range(wky, ny - wky): * for k in range(wkz, nz - wkz): * if not npy_isnan(fixed[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_49 = __pyx_v_i; __pyx_t_50 = __pyx_v_j; __pyx_t_51 = __pyx_v_k; __pyx_t_2 = (!npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_51, __pyx_pybuffernd_fixed.diminfo[2].strides)))); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":214 * for k in range(wkz, nz - wkz): * if not npy_isnan(fixed[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * for ii in range(i - wkx, i + wkx + 1): */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_none.pyx":215 * if not npy_isnan(fixed[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_none.pyx":216 * top = 0. * bot = 0. * for ii in range(i - wkx, i + wkx + 1): # <<<<<<<<<<<<<< * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): */ __pyx_t_25 = ((__pyx_v_i + __pyx_v_wkx) + 1); for (__pyx_t_52 = (__pyx_v_i - __pyx_v_wkx); __pyx_t_52 < __pyx_t_25; __pyx_t_52+=1) { __pyx_v_ii = __pyx_t_52; /* "astropy/convolution/boundary_none.pyx":217 * bot = 0. * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): # <<<<<<<<<<<<<< * for kk in range(k - wkz, k + wkz + 1): * val = fixed[ii, jj, kk] */ __pyx_t_27 = ((__pyx_v_j + __pyx_v_wky) + 1); for (__pyx_t_53 = (__pyx_v_j - __pyx_v_wky); __pyx_t_53 < __pyx_t_27; __pyx_t_53+=1) { __pyx_v_jj = __pyx_t_53; /* "astropy/convolution/boundary_none.pyx":218 * for ii in range(i - wkx, i + wkx + 1): * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): # <<<<<<<<<<<<<< * val = fixed[ii, jj, kk] * ker = g[(wkx + ii - i), */ __pyx_t_29 = ((__pyx_v_k + __pyx_v_wkz) + 1); for (__pyx_t_54 = (__pyx_v_k - __pyx_v_wkz); __pyx_t_54 < __pyx_t_29; __pyx_t_54+=1) { __pyx_v_kk = __pyx_t_54; /* "astropy/convolution/boundary_none.pyx":219 * for jj in range(j - wky, j + wky + 1): * for kk in range(k - wkz, k + wkz + 1): * val = fixed[ii, jj, kk] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_55 = __pyx_v_ii; __pyx_t_56 = __pyx_v_jj; __pyx_t_57 = __pyx_v_kk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_57, __pyx_pybuffernd_fixed.diminfo[2].strides)); /* "astropy/convolution/boundary_none.pyx":222 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_58 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_59 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_60 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_60, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_none.pyx":223 * (wky + jj - j), * (wkz + kk - k)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":224 * (wkz + kk - k)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_none.pyx":225 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L32; } __pyx_L32:; } } } /* "astropy/convolution/boundary_none.pyx":226 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j, k] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.0); if (__pyx_t_2) { /* "astropy/convolution/boundary_none.pyx":227 * bot += ker * if bot != 0: * conv[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_52 = __pyx_v_i; __pyx_t_53 = __pyx_v_j; __pyx_t_54 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_54, __pyx_pybuffernd_conv.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L33; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":229 * conv[i, j, k] = top / bot * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ __pyx_t_61 = __pyx_v_i; __pyx_t_62 = __pyx_v_j; __pyx_t_63 = __pyx_v_k; __pyx_t_64 = __pyx_v_i; __pyx_t_65 = __pyx_v_j; __pyx_t_66 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_66, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_63, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L33:; goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_none.pyx":231 * conv[i, j, k] = fixed[i, j, k] * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_67 = __pyx_v_i; __pyx_t_68 = __pyx_v_j; __pyx_t_69 = __pyx_v_k; __pyx_t_70 = __pyx_v_i; __pyx_t_71 = __pyx_v_j; __pyx_t_72 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_72, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_none_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_69, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L25:; } } } /* "astropy/convolution/boundary_none.pyx":233 * conv[i, j, k] = fixed[i, j, k] * * return conv # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_none.convolve3d_boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L13; } /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L13; } /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L13; } /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L13; } /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L13; } /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L13; } /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L13; } /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L13; } /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L13; } /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L13; } /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L13; } /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L13; } /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L13; } /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L13; } /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L13; } /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L13; } /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_7) { __pyx_t_8 = __pyx_v_little_endian; } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_7) { __pyx_t_9 = (!__pyx_v_little_endian); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("boundary_none"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__bot, __pyx_k__bot, sizeof(__pyx_k__bot), 0, 0, 1, 1}, {&__pyx_n_s__conv, __pyx_k__conv, sizeof(__pyx_k__conv), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__ii, __pyx_k__ii, sizeof(__pyx_k__ii), 0, 0, 1, 1}, {&__pyx_n_s__iimax, __pyx_k__iimax, sizeof(__pyx_k__iimax), 0, 0, 1, 1}, {&__pyx_n_s__iimin, __pyx_k__iimin, sizeof(__pyx_k__iimin), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__jj, __pyx_k__jj, sizeof(__pyx_k__jj), 0, 0, 1, 1}, {&__pyx_n_s__jjmax, __pyx_k__jjmax, sizeof(__pyx_k__jjmax), 0, 0, 1, 1}, {&__pyx_n_s__jjmin, __pyx_k__jjmin, sizeof(__pyx_k__jjmin), 0, 0, 1, 1}, {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, {&__pyx_n_s__ker, __pyx_k__ker, sizeof(__pyx_k__ker), 0, 0, 1, 1}, {&__pyx_n_s__kk, __pyx_k__kk, sizeof(__pyx_k__kk), 0, 0, 1, 1}, {&__pyx_n_s__kkmax, __pyx_k__kkmax, sizeof(__pyx_k__kkmax), 0, 0, 1, 1}, {&__pyx_n_s__kkmin, __pyx_k__kkmin, sizeof(__pyx_k__kkmin), 0, 0, 1, 1}, {&__pyx_n_s__nkx, __pyx_k__nkx, sizeof(__pyx_k__nkx), 0, 0, 1, 1}, {&__pyx_n_s__nky, __pyx_k__nky, sizeof(__pyx_k__nky), 0, 0, 1, 1}, {&__pyx_n_s__nkz, __pyx_k__nkz, sizeof(__pyx_k__nkz), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__nx, __pyx_k__nx, sizeof(__pyx_k__nx), 0, 0, 1, 1}, {&__pyx_n_s__ny, __pyx_k__ny, sizeof(__pyx_k__ny), 0, 0, 1, 1}, {&__pyx_n_s__nz, __pyx_k__nz, sizeof(__pyx_k__nz), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__top, __pyx_k__top, sizeof(__pyx_k__top), 0, 0, 1, 1}, {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, {&__pyx_n_s__wkx, __pyx_k__wkx, sizeof(__pyx_k__wkx), 0, 0, 1, 1}, {&__pyx_n_s__wky, __pyx_k__wky, sizeof(__pyx_k__wky), 0, 0, 1, 1}, {&__pyx_n_s__wkz, __pyx_k__wkz, sizeof(__pyx_k__wkz), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "astropy/convolution/boundary_none.pyx":20 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "astropy/convolution/boundary_none.pyx":84 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "astropy/convolution/boundary_none.pyx":158 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "astropy/convolution/boundary_none.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_k_tuple_17 = PyTuple_Pack(15, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(2, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_19, 16, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_none.pyx":80 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_k_tuple_22 = PyTuple_Pack(22, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(2, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_24, 80, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_none.pyx":154 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_k_tuple_25 = PyTuple_Pack(29, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nz), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__nkz), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__wkz), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__kk), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__kkmin), ((PyObject *)__pyx_n_s__kkmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 29, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_27, 154, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initboundary_none(void); /*proto*/ PyMODINIT_FUNC initboundary_none(void) #else PyMODINIT_FUNC PyInit_boundary_none(void); /*proto*/ PyMODINIT_FUNC PyInit_boundary_none(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_boundary_none(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("boundary_none"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "astropy.convolution.boundary_none")) { if (unlikely(PyDict_SetItemString(modules, "astropy.convolution.boundary_none", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_astropy__convolution__boundary_none) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "astropy/convolution/boundary_none.pyx":3 * # Licensed under a 3-clause BSD style license - see LICENSE.rst * from __future__ import division * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/convolution/boundary_none.pyx":6 * cimport numpy as np * * DTYPE = np.float # <<<<<<<<<<<<<< * ctypedef np.float_t DTYPE_t * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_none.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_none(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_none_1convolve1d_boundary_none, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_none.pyx":80 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_none(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_none_3convolve2d_boundary_none, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_none.pyx":154 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_none(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_none_5convolve3d_boundary_none, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_27, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_none.pyx":1 * # Licensed under a 3-clause BSD style license - see LICENSE.rst # <<<<<<<<<<<<<< * from __future__ import division * import numpy as np */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init astropy.convolution.boundary_none", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init astropy.convolution.boundary_none"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) /* First char was not a digit */ PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { if (isspace(*ts)) continue; number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { long r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); #endif Py_DECREF(getbuffer_cobj); if (!func) goto fail; return func(obj, view, flags); } else { PyErr_Clear(); } #endif PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; if (!obj) return; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif Py_DECREF(releasebuffer_cobj); if (!func) goto fail; func(obj, view); return; } else { PyErr_Clear(); } #endif goto nofail; #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); nofail: Py_DECREF(obj); view->obj = NULL; } #endif /* PY_MAJOR_VERSION < 3 */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ astropy-0.3/astropy/convolution/boundary_extend.c0000644000175000017500000131566212243255471020636 0ustar oleole/* Generated by Cython 0.18 on Wed Nov 20 19:59:43 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__astropy__convolution__boundary_extend #define __PYX_HAVE_API__astropy__convolution__boundary_extend #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "boundary_extend.pyx", "numpy.pxd", "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "astropy/convolution/boundary_extend.pyx":7 * * DTYPE = np.float * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<< * * cdef inline int int_max(int a, int b): return a if a >= b else b */ typedef __pyx_t_5numpy_float_t __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'astropy.convolution.boundary_extend' */ static CYTHON_INLINE int __pyx_f_7astropy_11convolution_15boundary_extend_int_max(int, int); /*proto*/ static CYTHON_INLINE int __pyx_f_7astropy_11convolution_15boundary_extend_int_min(int, int); /*proto*/ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "astropy.convolution.boundary_extend" int __pyx_module_is_main_astropy__convolution__boundary_extend = 0; /* Implementation of 'astropy.convolution.boundary_extend' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_convolve1d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_2convolve2d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_4convolve3d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Convolution kernel must have odd dimensions"; static char __pyx_k_5[] = "ndarray is not C contiguous"; static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; static char __pyx_k_9[] = "Non-native byte order not supported"; static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_15[] = "Format string allocated too short."; static char __pyx_k_19[] = "convolve1d_boundary_extend"; static char __pyx_k_20[] = "/internal/1/root/src/astropy/astropy-release/astropy/convolution/boundary_extend.pyx"; static char __pyx_k_21[] = "astropy.convolution.boundary_extend"; static char __pyx_k_24[] = "convolve2d_boundary_extend"; static char __pyx_k_27[] = "convolve3d_boundary_extend"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__ii[] = "ii"; static char __pyx_k__jj[] = "jj"; static char __pyx_k__kk[] = "kk"; static char __pyx_k__np[] = "np"; static char __pyx_k__nx[] = "nx"; static char __pyx_k__ny[] = "ny"; static char __pyx_k__nz[] = "nz"; static char __pyx_k__bot[] = "bot"; static char __pyx_k__iii[] = "iii"; static char __pyx_k__jjj[] = "jjj"; static char __pyx_k__ker[] = "ker"; static char __pyx_k__kkk[] = "kkk"; static char __pyx_k__nkx[] = "nkx"; static char __pyx_k__nky[] = "nky"; static char __pyx_k__nkz[] = "nkz"; static char __pyx_k__top[] = "top"; static char __pyx_k__val[] = "val"; static char __pyx_k__wkx[] = "wkx"; static char __pyx_k__wky[] = "wky"; static char __pyx_k__wkz[] = "wkz"; static char __pyx_k__conv[] = "conv"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__empty[] = "empty"; static char __pyx_k__fixed[] = "fixed"; static char __pyx_k__float[] = "float"; static char __pyx_k__iimax[] = "iimax"; static char __pyx_k__iimin[] = "iimin"; static char __pyx_k__jjmax[] = "jjmax"; static char __pyx_k__jjmin[] = "jjmin"; static char __pyx_k__kkmax[] = "kkmax"; static char __pyx_k__kkmin[] = "kkmin"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_n_s_19; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_n_s_21; static PyObject *__pyx_n_s_24; static PyObject *__pyx_n_s_27; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__bot; static PyObject *__pyx_n_s__conv; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__empty; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__fixed; static PyObject *__pyx_n_s__float; static PyObject *__pyx_n_s__g; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__ii; static PyObject *__pyx_n_s__iii; static PyObject *__pyx_n_s__iimax; static PyObject *__pyx_n_s__iimin; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__jj; static PyObject *__pyx_n_s__jjj; static PyObject *__pyx_n_s__jjmax; static PyObject *__pyx_n_s__jjmin; static PyObject *__pyx_n_s__k; static PyObject *__pyx_n_s__ker; static PyObject *__pyx_n_s__kk; static PyObject *__pyx_n_s__kkk; static PyObject *__pyx_n_s__kkmax; static PyObject *__pyx_n_s__kkmin; static PyObject *__pyx_n_s__nkx; static PyObject *__pyx_n_s__nky; static PyObject *__pyx_n_s__nkz; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__nx; static PyObject *__pyx_n_s__ny; static PyObject *__pyx_n_s__nz; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__top; static PyObject *__pyx_n_s__val; static PyObject *__pyx_n_s__wkx; static PyObject *__pyx_n_s__wky; static PyObject *__pyx_n_s__wkz; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_codeobj_18; static PyObject *__pyx_k_codeobj_23; static PyObject *__pyx_k_codeobj_26; /* "astropy/convolution/boundary_extend.pyx":9 * ctypedef np.float_t DTYPE_t * * cdef inline int int_max(int a, int b): return a if a >= b else b # <<<<<<<<<<<<<< * cdef inline int int_min(int a, int b): return a if a <= b else b * */ static CYTHON_INLINE int __pyx_f_7astropy_11convolution_15boundary_extend_int_max(int __pyx_v_a, int __pyx_v_b) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("int_max", 0); if ((__pyx_v_a >= __pyx_v_b)) { __pyx_t_1 = __pyx_v_a; } else { __pyx_t_1 = __pyx_v_b; } __pyx_r = __pyx_t_1; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_extend.pyx":10 * * cdef inline int int_max(int a, int b): return a if a >= b else b * cdef inline int int_min(int a, int b): return a if a <= b else b # <<<<<<<<<<<<<< * * cdef extern from "numpy/npy_math.h": */ static CYTHON_INLINE int __pyx_f_7astropy_11convolution_15boundary_extend_int_min(int __pyx_v_a, int __pyx_v_b) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("int_min", 0); if ((__pyx_v_a <= __pyx_v_b)) { __pyx_t_1 = __pyx_v_a; } else { __pyx_t_1 = __pyx_v_b; } __pyx_r = __pyx_t_1; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_1convolve1d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_15boundary_extend_1convolve1d_boundary_extend = {__Pyx_NAMESTR("convolve1d_boundary_extend"), (PyCFunction)__pyx_pw_7astropy_11convolution_15boundary_extend_1convolve1d_boundary_extend, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_1convolve1d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve1d_boundary_extend (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_extend", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve1d_boundary_extend") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_extend", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve1d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_15boundary_extend_convolve1d_boundary_extend(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_extend.pyx":19 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_extend(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_convolve1d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_nkx; int __pyx_v_wkx; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_iii; int __pyx_v_ii; int __pyx_v_iimin; int __pyx_v_iimax; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; unsigned int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; unsigned int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve1d_boundary_extend", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; /* "astropy/convolution/boundary_extend.pyx":22 * np.ndarray[DTYPE_t, ndim=1] g): * * if g.shape[0] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (__pyx_t_1) { /* "astropy/convolution/boundary_extend.pyx":23 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_extend.pyx":25 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_1; } if (unlikely(!__pyx_t_6)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_extend.pyx":27 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":28 * * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":29 * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_extend.pyx":30 * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) * cdef unsigned int i, iii */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_extend.pyx":31 * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, iii * cdef int ii */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "astropy/convolution/boundary_extend.pyx":41 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * if npy_isnan(f[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_extend.pyx":42 * # neighboring values * for i in range(nx): * if npy_isnan(f[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_12 = __pyx_v_i; __pyx_t_6 = npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_f.diminfo[0].strides))); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":43 * for i in range(nx): * if npy_isnan(f[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":44 * if npy_isnan(f[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":45 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":46 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":47 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * val = f[iii] */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_extend.pyx":48 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * val = f[iii] * if not npy_isnan(val): */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":49 * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) * val = f[iii] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i)] */ __pyx_t_15 = __pyx_v_iii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f.diminfo[0].strides)); /* "astropy/convolution/boundary_extend.pyx":50 * iii = int_min(int_max(ii, 0), nx - 1) * val = f[iii] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * top += val * ker */ __pyx_t_6 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":51 * val = f[iii] * if not npy_isnan(val): * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_16 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_extend.pyx":52 * if not npy_isnan(val): * ker = g[(wkx + ii - i)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":53 * ker = g[(wkx + ii - i)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L9; } __pyx_L9:; } /* "astropy/convolution/boundary_extend.pyx":55 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i] = top / bot * else: */ __pyx_t_6 = (__pyx_v_bot != 0.); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":56 * * if bot != 0.: * fixed[i] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_fixed.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":58 * fixed[i] = top / bot * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L10:; goto __pyx_L6; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":60 * fixed[i] = f[i] * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_20 = __pyx_v_i; __pyx_t_21 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L6:; } /* "astropy/convolution/boundary_extend.pyx":63 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_extend.pyx":64 * # Now run the proper convolution * for i in range(nx): * if not npy_isnan(fixed[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_22 = __pyx_v_i; __pyx_t_6 = (!npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_fixed.diminfo[0].strides)))); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":65 * for i in range(nx): * if not npy_isnan(fixed[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":66 * if not npy_isnan(fixed[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":67 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":68 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":69 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * val = fixed[iii] */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_extend.pyx":70 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * val = fixed[iii] * ker = g[(wkx + ii - i)] */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":71 * for ii in range(iimin, iimax): * iii = int_min(int_max(ii, 0), nx - 1) * val = fixed[iii] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * if not npy_isnan(val): */ __pyx_t_23 = __pyx_v_iii; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_fixed.diminfo[0].strides)); /* "astropy/convolution/boundary_extend.pyx":72 * iii = int_min(int_max(ii, 0), nx - 1) * val = fixed[iii] * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_24 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_extend.pyx":73 * val = fixed[iii] * ker = g[(wkx + ii - i)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_6 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":74 * ker = g[(wkx + ii - i)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":75 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L16; } __pyx_L16:; } /* "astropy/convolution/boundary_extend.pyx":76 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i] = top / bot * else: */ __pyx_t_6 = (__pyx_v_bot != 0.0); if (__pyx_t_6) { /* "astropy/convolution/boundary_extend.pyx":77 * bot += ker * if bot != 0: * conv[i] = top / bot # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_25 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_conv.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L17; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":79 * conv[i] = top / bot * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L17:; goto __pyx_L13; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":81 * conv[i] = fixed[i] * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L13:; } /* "astropy/convolution/boundary_extend.pyx":83 * conv[i] = fixed[i] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve1d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_3convolve2d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_15boundary_extend_3convolve2d_boundary_extend = {__Pyx_NAMESTR("convolve2d_boundary_extend"), (PyCFunction)__pyx_pw_7astropy_11convolution_15boundary_extend_3convolve2d_boundary_extend, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_3convolve2d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve2d_boundary_extend (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_extend", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve2d_boundary_extend") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_extend", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve2d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_15boundary_extend_2convolve2d_boundary_extend(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_extend.pyx":87 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_extend(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_2convolve2d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_wkx; int __pyx_v_wky; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_iii; unsigned int __pyx_v_jjj; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; int __pyx_t_12; unsigned int __pyx_t_13; unsigned int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; unsigned int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve2d_boundary_extend", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; /* "astropy/convolution/boundary_extend.pyx":90 * np.ndarray[DTYPE_t, ndim=2] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "astropy/convolution/boundary_extend.pyx":91 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_extend.pyx":93 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) { __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_extend.pyx":95 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":96 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_extend.pyx":97 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":98 * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_extend.pyx":99 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_extend.pyx":100 * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_extend.pyx":101 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) * cdef unsigned int i, j, iii, jjj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_extend.pyx":102 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, iii, jjj * cdef int ii, jj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_extend.pyx":112 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if npy_isnan(f[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_extend.pyx":113 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_extend.pyx":114 * for i in range(nx): * for j in range(ny): * if npy_isnan(f[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_14 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; __pyx_t_2 = npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_f.diminfo[1].strides))); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":115 * for j in range(ny): * if npy_isnan(f[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":116 * if npy_isnan(f[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":117 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":118 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":119 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_extend.pyx":120 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_extend.pyx":121 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_extend.pyx":122 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_extend.pyx":123 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * jjj = int_min(int_max(jj, 0), ny - 1) * val = f[iii, jjj] */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":124 * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) # <<<<<<<<<<<<<< * val = f[iii, jjj] * if not npy_isnan(val): */ __pyx_v_jjj = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_jj, 0), (__pyx_v_ny - 1)); /* "astropy/convolution/boundary_extend.pyx":125 * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) * val = f[iii, jjj] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_20 = __pyx_v_iii; __pyx_t_21 = __pyx_v_jjj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_f.diminfo[1].strides)); /* "astropy/convolution/boundary_extend.pyx":126 * jjj = int_min(int_max(jj, 0), ny - 1) * val = f[iii, jjj] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":128 * if not npy_isnan(val): * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_22 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_23 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_extend.pyx":129 * ker = g[(wkx + ii - i), * (wky + jj - j)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":130 * (wky + jj - j)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L13; } __pyx_L13:; } } /* "astropy/convolution/boundary_extend.pyx":132 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":133 * * if bot != 0.: * fixed[i, j] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_fixed.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L14; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":135 * fixed[i, j] = top / bot * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_j; __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L14:; goto __pyx_L8; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":137 * fixed[i, j] = f[i, j] * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_30 = __pyx_v_i; __pyx_t_31 = __pyx_v_j; __pyx_t_32 = __pyx_v_i; __pyx_t_33 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L8:; } } /* "astropy/convolution/boundary_extend.pyx":140 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if not npy_isnan(fixed[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_extend.pyx":141 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_extend.pyx":142 * for i in range(nx): * for j in range(ny): * if not npy_isnan(fixed[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_j; __pyx_t_2 = (!npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[1].strides)))); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":143 * for j in range(ny): * if not npy_isnan(fixed[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":144 * if not npy_isnan(fixed[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":145 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":146 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":147 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_extend.pyx":148 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_extend.pyx":149 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_extend.pyx":150 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_extend.pyx":151 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * jjj = int_min(int_max(jj, 0), ny - 1) * val = fixed[iii, jjj] */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":152 * for jj in range(jjmin, jjmax): * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) # <<<<<<<<<<<<<< * val = fixed[iii, jjj] * ker = g[(wkx + ii - i), */ __pyx_v_jjj = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_jj, 0), (__pyx_v_ny - 1)); /* "astropy/convolution/boundary_extend.pyx":153 * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) * val = fixed[iii, jjj] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_36 = __pyx_v_iii; __pyx_t_37 = __pyx_v_jjj; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_fixed.diminfo[1].strides)); /* "astropy/convolution/boundary_extend.pyx":155 * val = fixed[iii, jjj] * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_38 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_39 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_extend.pyx":156 * ker = g[(wkx + ii - i), * (wky + jj - j)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":157 * (wky + jj - j)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":158 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L24; } __pyx_L24:; } } /* "astropy/convolution/boundary_extend.pyx":159 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.0); if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":160 * bot += ker * if bot != 0: * conv[i, j] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_40 = __pyx_v_i; __pyx_t_41 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_conv.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":162 * conv[i, j] = top / bot * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; __pyx_t_44 = __pyx_v_i; __pyx_t_45 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L25:; goto __pyx_L19; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":164 * conv[i, j] = fixed[i, j] * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_46 = __pyx_v_i; __pyx_t_47 = __pyx_v_j; __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L19:; } } /* "astropy/convolution/boundary_extend.pyx":166 * conv[i, j] = fixed[i, j] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve2d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_5convolve3d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_15boundary_extend_5convolve3d_boundary_extend = {__Pyx_NAMESTR("convolve3d_boundary_extend"), (PyCFunction)__pyx_pw_7astropy_11convolution_15boundary_extend_5convolve3d_boundary_extend, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_15boundary_extend_5convolve3d_boundary_extend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve3d_boundary_extend (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_extend", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve3d_boundary_extend") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_extend", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve3d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_15boundary_extend_4convolve3d_boundary_extend(__pyx_self, __pyx_v_f, __pyx_v_g); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_extend.pyx":170 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_extend(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ static PyObject *__pyx_pf_7astropy_11convolution_15boundary_extend_4convolve3d_boundary_extend(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nz; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_nkz; int __pyx_v_wkx; int __pyx_v_wky; int __pyx_v_wkz; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_k; unsigned int __pyx_v_iii; unsigned int __pyx_v_jjj; unsigned int __pyx_v_kkk; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_kk; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; int __pyx_v_kkmin; int __pyx_v_kkmax; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; int __pyx_t_12; unsigned int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; int __pyx_t_24; int __pyx_t_25; int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; unsigned int __pyx_t_51; unsigned int __pyx_t_52; unsigned int __pyx_t_53; unsigned int __pyx_t_54; unsigned int __pyx_t_55; unsigned int __pyx_t_56; unsigned int __pyx_t_57; unsigned int __pyx_t_58; unsigned int __pyx_t_59; unsigned int __pyx_t_60; unsigned int __pyx_t_61; unsigned int __pyx_t_62; unsigned int __pyx_t_63; unsigned int __pyx_t_64; unsigned int __pyx_t_65; unsigned int __pyx_t_66; unsigned int __pyx_t_67; unsigned int __pyx_t_68; unsigned int __pyx_t_69; unsigned int __pyx_t_70; unsigned int __pyx_t_71; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve3d_boundary_extend", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_f.diminfo[2].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_f.diminfo[2].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[2]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_g.diminfo[2].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_g.diminfo[2].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[2]; /* "astropy/convolution/boundary_extend.pyx":173 * np.ndarray[DTYPE_t, ndim=3] g): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); if (!__pyx_t_2) { __pyx_t_3 = (__Pyx_mod_long((__pyx_v_g->dimensions[2]), 2) != 1); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) { /* "astropy/convolution/boundary_extend.pyx":174 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_extend.pyx":176 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_extend.pyx":178 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":179 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_extend.pyx":180 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_nz = (__pyx_v_f->dimensions[2]); /* "astropy/convolution/boundary_extend.pyx":181 * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_extend.pyx":182 * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_extend.pyx":183 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nkz = (__pyx_v_g->dimensions[2]); /* "astropy/convolution/boundary_extend.pyx":184 * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_extend.pyx":185 * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_extend.pyx":186 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wkz = __Pyx_div_long(__pyx_v_nkz, 2); /* "astropy/convolution/boundary_extend.pyx":187 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) * cdef unsigned int i, j, k, iii, jjj, kkk */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_fixed.diminfo[2].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_fixed.diminfo[2].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[2]; } } __pyx_t_10 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_extend.pyx":188 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, k, iii, jjj, kkk * cdef int ii, jj, kk */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_conv.diminfo[2].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_conv.diminfo[2].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[2]; } } __pyx_t_11 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "astropy/convolution/boundary_extend.pyx":198 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_extend.pyx":199 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if npy_isnan(f[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_extend.pyx":200 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_extend.pyx":201 * for j in range(ny): * for k in range(nz): * if npy_isnan(f[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_j; __pyx_t_20 = __pyx_v_k; __pyx_t_4 = npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_f.diminfo[2].strides))); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":202 * for k in range(nz): * if npy_isnan(f[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":203 * if npy_isnan(f[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":204 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":205 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":206 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_extend.pyx":207 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_extend.pyx":208 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_extend.pyx":209 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_extend.pyx":210 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_extend.pyx":211 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_extend.pyx":212 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_extend.pyx":213 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":214 * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) # <<<<<<<<<<<<<< * kkk = int_min(int_max(kk, 0), nz - 1) * val = f[iii, jjj, kkk] */ __pyx_v_jjj = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_jj, 0), (__pyx_v_ny - 1)); /* "astropy/convolution/boundary_extend.pyx":215 * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) # <<<<<<<<<<<<<< * val = f[iii, jjj, kkk] * if not npy_isnan(val): */ __pyx_v_kkk = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_kk, 0), (__pyx_v_nz - 1)); /* "astropy/convolution/boundary_extend.pyx":216 * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) * val = f[iii, jjj, kkk] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_27 = __pyx_v_iii; __pyx_t_28 = __pyx_v_jjj; __pyx_t_29 = __pyx_v_kkk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_f.diminfo[2].strides)); /* "astropy/convolution/boundary_extend.pyx":217 * kkk = int_min(int_max(kk, 0), nz - 1) * val = f[iii, jjj, kkk] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_4 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":220 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_30 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_31 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_32 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_extend.pyx":221 * (wky + jj - j), * (wkz + kk - k)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":222 * (wkz + kk - k)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * * if bot != 0.: */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L17; } __pyx_L17:; } } } /* "astropy/convolution/boundary_extend.pyx":224 * bot += ker * * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j, k] = top / bot * else: */ __pyx_t_4 = (__pyx_v_bot != 0.); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":225 * * if bot != 0.: * fixed[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_33 = __pyx_v_i; __pyx_t_34 = __pyx_v_j; __pyx_t_35 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L18; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":227 * fixed[i, j, k] = top / bot * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ __pyx_t_36 = __pyx_v_i; __pyx_t_37 = __pyx_v_j; __pyx_t_38 = __pyx_v_k; __pyx_t_39 = __pyx_v_i; __pyx_t_40 = __pyx_v_j; __pyx_t_41 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L18:; goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":229 * fixed[i, j, k] = f[i, j, k] * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; __pyx_t_44 = __pyx_v_k; __pyx_t_45 = __pyx_v_i; __pyx_t_46 = __pyx_v_j; __pyx_t_47 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L10:; } } } /* "astropy/convolution/boundary_extend.pyx":232 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_extend.pyx":233 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_extend.pyx":234 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_extend.pyx":235 * for j in range(ny): * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; __pyx_t_50 = __pyx_v_k; __pyx_t_4 = (!npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_fixed.diminfo[2].strides)))); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":236 * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_extend.pyx":237 * if not npy_isnan(fixed[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_extend.pyx":238 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_extend.pyx":239 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_extend.pyx":240 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_extend.pyx":241 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_extend.pyx":242 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_extend.pyx":243 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_extend.pyx":244 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_extend.pyx":245 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_extend.pyx":246 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_extend.pyx":247 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) # <<<<<<<<<<<<<< * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) */ __pyx_v_iii = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_ii, 0), (__pyx_v_nx - 1)); /* "astropy/convolution/boundary_extend.pyx":248 * for kk in range(kkmin, kkmax): * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) # <<<<<<<<<<<<<< * kkk = int_min(int_max(kk, 0), nz - 1) * val = fixed[iii, jjj, kkk] */ __pyx_v_jjj = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_jj, 0), (__pyx_v_ny - 1)); /* "astropy/convolution/boundary_extend.pyx":249 * iii = int_min(int_max(ii, 0), nx - 1) * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) # <<<<<<<<<<<<<< * val = fixed[iii, jjj, kkk] * ker = g[(wkx + ii - i), */ __pyx_v_kkk = __pyx_f_7astropy_11convolution_15boundary_extend_int_min(__pyx_f_7astropy_11convolution_15boundary_extend_int_max(__pyx_v_kk, 0), (__pyx_v_nz - 1)); /* "astropy/convolution/boundary_extend.pyx":250 * jjj = int_min(int_max(jj, 0), ny - 1) * kkk = int_min(int_max(kk, 0), nz - 1) * val = fixed[iii, jjj, kkk] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_51 = __pyx_v_iii; __pyx_t_52 = __pyx_v_jjj; __pyx_t_53 = __pyx_v_kkk; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_fixed.diminfo[2].strides)); /* "astropy/convolution/boundary_extend.pyx":253 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_54 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_55 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_56 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_extend.pyx":254 * (wky + jj - j), * (wkz + kk - k)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_4 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":255 * (wkz + kk - k)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_extend.pyx":256 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L32; } __pyx_L32:; } } } /* "astropy/convolution/boundary_extend.pyx":257 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j, k] = top / bot * else: */ __pyx_t_4 = (__pyx_v_bot != 0.0); if (__pyx_t_4) { /* "astropy/convolution/boundary_extend.pyx":258 * bot += ker * if bot != 0: * conv[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_57 = __pyx_v_i; __pyx_t_58 = __pyx_v_j; __pyx_t_59 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_conv.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L33; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":260 * conv[i, j, k] = top / bot * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ __pyx_t_60 = __pyx_v_i; __pyx_t_61 = __pyx_v_j; __pyx_t_62 = __pyx_v_k; __pyx_t_63 = __pyx_v_i; __pyx_t_64 = __pyx_v_j; __pyx_t_65 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_62, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L33:; goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_extend.pyx":262 * conv[i, j, k] = fixed[i, j, k] * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_66 = __pyx_v_i; __pyx_t_67 = __pyx_v_j; __pyx_t_68 = __pyx_v_k; __pyx_t_69 = __pyx_v_i; __pyx_t_70 = __pyx_v_j; __pyx_t_71 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_71, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_15boundary_extend_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L25:; } } } /* "astropy/convolution/boundary_extend.pyx":264 * conv[i, j, k] = fixed[i, j, k] * * return conv # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_extend.convolve3d_boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L13; } /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L13; } /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L13; } /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L13; } /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L13; } /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L13; } /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L13; } /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L13; } /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L13; } /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L13; } /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L13; } /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L13; } /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L13; } /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L13; } /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L13; } /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L13; } /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_7) { __pyx_t_8 = __pyx_v_little_endian; } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_7) { __pyx_t_9 = (!__pyx_v_little_endian); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("boundary_extend"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__bot, __pyx_k__bot, sizeof(__pyx_k__bot), 0, 0, 1, 1}, {&__pyx_n_s__conv, __pyx_k__conv, sizeof(__pyx_k__conv), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__ii, __pyx_k__ii, sizeof(__pyx_k__ii), 0, 0, 1, 1}, {&__pyx_n_s__iii, __pyx_k__iii, sizeof(__pyx_k__iii), 0, 0, 1, 1}, {&__pyx_n_s__iimax, __pyx_k__iimax, sizeof(__pyx_k__iimax), 0, 0, 1, 1}, {&__pyx_n_s__iimin, __pyx_k__iimin, sizeof(__pyx_k__iimin), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__jj, __pyx_k__jj, sizeof(__pyx_k__jj), 0, 0, 1, 1}, {&__pyx_n_s__jjj, __pyx_k__jjj, sizeof(__pyx_k__jjj), 0, 0, 1, 1}, {&__pyx_n_s__jjmax, __pyx_k__jjmax, sizeof(__pyx_k__jjmax), 0, 0, 1, 1}, {&__pyx_n_s__jjmin, __pyx_k__jjmin, sizeof(__pyx_k__jjmin), 0, 0, 1, 1}, {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, {&__pyx_n_s__ker, __pyx_k__ker, sizeof(__pyx_k__ker), 0, 0, 1, 1}, {&__pyx_n_s__kk, __pyx_k__kk, sizeof(__pyx_k__kk), 0, 0, 1, 1}, {&__pyx_n_s__kkk, __pyx_k__kkk, sizeof(__pyx_k__kkk), 0, 0, 1, 1}, {&__pyx_n_s__kkmax, __pyx_k__kkmax, sizeof(__pyx_k__kkmax), 0, 0, 1, 1}, {&__pyx_n_s__kkmin, __pyx_k__kkmin, sizeof(__pyx_k__kkmin), 0, 0, 1, 1}, {&__pyx_n_s__nkx, __pyx_k__nkx, sizeof(__pyx_k__nkx), 0, 0, 1, 1}, {&__pyx_n_s__nky, __pyx_k__nky, sizeof(__pyx_k__nky), 0, 0, 1, 1}, {&__pyx_n_s__nkz, __pyx_k__nkz, sizeof(__pyx_k__nkz), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__nx, __pyx_k__nx, sizeof(__pyx_k__nx), 0, 0, 1, 1}, {&__pyx_n_s__ny, __pyx_k__ny, sizeof(__pyx_k__ny), 0, 0, 1, 1}, {&__pyx_n_s__nz, __pyx_k__nz, sizeof(__pyx_k__nz), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__top, __pyx_k__top, sizeof(__pyx_k__top), 0, 0, 1, 1}, {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, {&__pyx_n_s__wkx, __pyx_k__wkx, sizeof(__pyx_k__wkx), 0, 0, 1, 1}, {&__pyx_n_s__wky, __pyx_k__wky, sizeof(__pyx_k__wky), 0, 0, 1, 1}, {&__pyx_n_s__wkz, __pyx_k__wkz, sizeof(__pyx_k__wkz), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "astropy/convolution/boundary_extend.pyx":23 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "astropy/convolution/boundary_extend.pyx":91 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "astropy/convolution/boundary_extend.pyx":174 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "astropy/convolution/boundary_extend.pyx":19 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_extend(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_k_tuple_17 = PyTuple_Pack(16, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(2, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_19, 19, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_extend.pyx":87 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_extend(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_k_tuple_22 = PyTuple_Pack(24, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(2, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_24, 87, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_extend.pyx":170 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_extend(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_k_tuple_25 = PyTuple_Pack(32, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nz), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__nkz), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__wkz), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__kkk), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__kk), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__kkmin), ((PyObject *)__pyx_n_s__kkmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 32, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_27, 170, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initboundary_extend(void); /*proto*/ PyMODINIT_FUNC initboundary_extend(void) #else PyMODINIT_FUNC PyInit_boundary_extend(void); /*proto*/ PyMODINIT_FUNC PyInit_boundary_extend(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_boundary_extend(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("boundary_extend"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "astropy.convolution.boundary_extend")) { if (unlikely(PyDict_SetItemString(modules, "astropy.convolution.boundary_extend", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_astropy__convolution__boundary_extend) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "astropy/convolution/boundary_extend.pyx":3 * # Licensed under a 3-clause BSD style license - see LICENSE.rst * from __future__ import division * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/convolution/boundary_extend.pyx":6 * cimport numpy as np * * DTYPE = np.float # <<<<<<<<<<<<<< * ctypedef np.float_t DTYPE_t * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_extend.pyx":19 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_extend(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_15boundary_extend_1convolve1d_boundary_extend, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_extend.pyx":87 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_extend(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_15boundary_extend_3convolve2d_boundary_extend, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_extend.pyx":170 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_extend(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g): * */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_15boundary_extend_5convolve3d_boundary_extend, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_27, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_extend.pyx":1 * # Licensed under a 3-clause BSD style license - see LICENSE.rst # <<<<<<<<<<<<<< * from __future__ import division * import numpy as np */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init astropy.convolution.boundary_extend", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init astropy.convolution.boundary_extend"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) /* First char was not a digit */ PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { if (isspace(*ts)) continue; number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { long r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); #endif Py_DECREF(getbuffer_cobj); if (!func) goto fail; return func(obj, view, flags); } else { PyErr_Clear(); } #endif PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; if (!obj) return; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif Py_DECREF(releasebuffer_cobj); if (!func) goto fail; func(obj, view); return; } else { PyErr_Clear(); } #endif goto nofail; #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); nofail: Py_DECREF(obj); view->obj = NULL; } #endif /* PY_MAJOR_VERSION < 3 */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ astropy-0.3/astropy/convolution/boundary_fill.c0000644000175000017500000132641312243255466020275 0ustar oleole/* Generated by Cython 0.18 on Wed Nov 20 19:59:43 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__astropy__convolution__boundary_fill #define __PYX_HAVE_API__astropy__convolution__boundary_fill #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "numpy/npy_math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "boundary_fill.pyx", "numpy.pxd", "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "astropy/convolution/boundary_fill.pyx":7 * * DTYPE = np.float * ctypedef np.float_t DTYPE_t # <<<<<<<<<<<<<< * * cdef extern from "numpy/npy_math.h": */ typedef __pyx_t_5numpy_float_t __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2) static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'astropy.convolution.boundary_fill' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "astropy.convolution.boundary_fill" int __pyx_module_is_main_astropy__convolution__boundary_fill = 0; /* Implementation of 'astropy.convolution.boundary_fill' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_convolve1d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_2convolve2d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value); /* proto */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_4convolve3d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Convolution kernel must have odd dimensions"; static char __pyx_k_5[] = "ndarray is not C contiguous"; static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; static char __pyx_k_9[] = "Non-native byte order not supported"; static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_15[] = "Format string allocated too short."; static char __pyx_k_19[] = "convolve1d_boundary_fill"; static char __pyx_k_20[] = "/internal/1/root/src/astropy/astropy-release/astropy/convolution/boundary_fill.pyx"; static char __pyx_k_21[] = "astropy.convolution.boundary_fill"; static char __pyx_k_24[] = "convolve2d_boundary_fill"; static char __pyx_k_27[] = "convolve3d_boundary_fill"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__ii[] = "ii"; static char __pyx_k__jj[] = "jj"; static char __pyx_k__kk[] = "kk"; static char __pyx_k__np[] = "np"; static char __pyx_k__nx[] = "nx"; static char __pyx_k__ny[] = "ny"; static char __pyx_k__nz[] = "nz"; static char __pyx_k__bot[] = "bot"; static char __pyx_k__iii[] = "iii"; static char __pyx_k__jjj[] = "jjj"; static char __pyx_k__ker[] = "ker"; static char __pyx_k__kkk[] = "kkk"; static char __pyx_k__nkx[] = "nkx"; static char __pyx_k__nky[] = "nky"; static char __pyx_k__nkz[] = "nkz"; static char __pyx_k__top[] = "top"; static char __pyx_k__val[] = "val"; static char __pyx_k__wkx[] = "wkx"; static char __pyx_k__wky[] = "wky"; static char __pyx_k__wkz[] = "wkz"; static char __pyx_k__conv[] = "conv"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__empty[] = "empty"; static char __pyx_k__fixed[] = "fixed"; static char __pyx_k__float[] = "float"; static char __pyx_k__iimax[] = "iimax"; static char __pyx_k__iimin[] = "iimin"; static char __pyx_k__jjmax[] = "jjmax"; static char __pyx_k__jjmin[] = "jjmin"; static char __pyx_k__kkmax[] = "kkmax"; static char __pyx_k__kkmin[] = "kkmin"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__fill_value[] = "fill_value"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_12; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_n_s_19; static PyObject *__pyx_kp_s_20; static PyObject *__pyx_n_s_21; static PyObject *__pyx_n_s_24; static PyObject *__pyx_n_s_27; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__bot; static PyObject *__pyx_n_s__conv; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__empty; static PyObject *__pyx_n_s__f; static PyObject *__pyx_n_s__fill_value; static PyObject *__pyx_n_s__fixed; static PyObject *__pyx_n_s__float; static PyObject *__pyx_n_s__g; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__ii; static PyObject *__pyx_n_s__iii; static PyObject *__pyx_n_s__iimax; static PyObject *__pyx_n_s__iimin; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__jj; static PyObject *__pyx_n_s__jjj; static PyObject *__pyx_n_s__jjmax; static PyObject *__pyx_n_s__jjmin; static PyObject *__pyx_n_s__k; static PyObject *__pyx_n_s__ker; static PyObject *__pyx_n_s__kk; static PyObject *__pyx_n_s__kkk; static PyObject *__pyx_n_s__kkmax; static PyObject *__pyx_n_s__kkmin; static PyObject *__pyx_n_s__nkx; static PyObject *__pyx_n_s__nky; static PyObject *__pyx_n_s__nkz; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__nx; static PyObject *__pyx_n_s__ny; static PyObject *__pyx_n_s__nz; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__top; static PyObject *__pyx_n_s__val; static PyObject *__pyx_n_s__wkx; static PyObject *__pyx_n_s__wky; static PyObject *__pyx_n_s__wkz; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_3; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_22; static PyObject *__pyx_k_tuple_25; static PyObject *__pyx_k_codeobj_18; static PyObject *__pyx_k_codeobj_23; static PyObject *__pyx_k_codeobj_26; /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_1convolve1d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_fill_1convolve1d_boundary_fill = {__Pyx_NAMESTR("convolve1d_boundary_fill"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_fill_1convolve1d_boundary_fill, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_1convolve1d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; float __pyx_v_fill_value; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve1d_boundary_fill (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,&__pyx_n_s__fill_value,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_fill", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_fill", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve1d_boundary_fill") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); __pyx_v_fill_value = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_fill_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve1d_boundary_fill", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve1d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_fill_convolve1d_boundary_fill(__pyx_self, __pyx_v_f, __pyx_v_g, __pyx_v_fill_value); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_fill.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_fill(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g, * float fill_value): */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_convolve1d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value) { int __pyx_v_nx; int __pyx_v_nkx; int __pyx_v_wkx; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; int __pyx_v_ii; int __pyx_v_iimin; int __pyx_v_iimax; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; unsigned int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; int __pyx_t_15; unsigned int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; unsigned int __pyx_t_21; unsigned int __pyx_t_22; int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve1d_boundary_fill", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; /* "astropy/convolution/boundary_fill.pyx":20 * float fill_value): * * if g.shape[0] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (__pyx_t_1) { /* "astropy/convolution/boundary_fill.pyx":21 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_fill.pyx":23 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_1) { __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __pyx_t_5; } else { __pyx_t_6 = __pyx_t_1; } if (unlikely(!__pyx_t_6)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_fill.pyx":25 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":26 * * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":27 * cdef int nx = f.shape[0] * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_fill.pyx":28 * cdef int nkx = g.shape[0] * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) * cdef unsigned int i, iii */ __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_fill.pyx":29 * cdef int wkx = nkx // 2 * cdef np.ndarray[DTYPE_t, ndim=1] fixed = np.empty([nx], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=1] conv = np.empty([nx], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, iii * cdef int ii */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; /* "astropy/convolution/boundary_fill.pyx":39 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * if npy_isnan(f[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_fill.pyx":40 * # neighboring values * for i in range(nx): * if npy_isnan(f[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_12 = __pyx_v_i; __pyx_t_6 = npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_f.diminfo[0].strides))); if (__pyx_t_6) { /* "astropy/convolution/boundary_fill.pyx":41 * for i in range(nx): * if npy_isnan(f[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":42 * if npy_isnan(f[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":43 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":44 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":45 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1: * val = fill_value */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_fill.pyx":46 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_6 = (__pyx_v_ii < 0); if (!__pyx_t_6) { __pyx_t_1 = (__pyx_v_ii > (__pyx_v_nx - 1)); __pyx_t_5 = __pyx_t_1; } else { __pyx_t_5 = __pyx_t_6; } if (__pyx_t_5) { /* "astropy/convolution/boundary_fill.pyx":47 * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = f[ii] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L9; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":49 * val = fill_value * else: * val = f[ii] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i)] */ __pyx_t_15 = __pyx_v_ii; if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_f.diminfo[0].shape; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L9:; /* "astropy/convolution/boundary_fill.pyx":50 * else: * val = f[ii] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * top += val * ker */ __pyx_t_5 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_5) { /* "astropy/convolution/boundary_fill.pyx":51 * val = f[ii] * if not npy_isnan(val): * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_16 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_fill.pyx":52 * if not npy_isnan(val): * ker = g[(wkx + ii - i)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":53 * ker = g[(wkx + ii - i)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L10; } __pyx_L10:; } /* "astropy/convolution/boundary_fill.pyx":54 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i] = top / bot * else: */ __pyx_t_5 = (__pyx_v_bot != 0.); if (__pyx_t_5) { /* "astropy/convolution/boundary_fill.pyx":55 * bot += ker * if bot != 0.: * fixed[i] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_fixed.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L11; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":57 * fixed[i] = top / bot * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * else: * fixed[i] = f[i] */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L11:; goto __pyx_L6; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":59 * fixed[i] = f[i] * else: * fixed[i] = f[i] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_20 = __pyx_v_i; __pyx_t_21 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_fixed.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_f.diminfo[0].strides)); } __pyx_L6:; } /* "astropy/convolution/boundary_fill.pyx":62 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i]): * top = 0. */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_fill.pyx":63 * # Now run the proper convolution * for i in range(nx): * if not npy_isnan(fixed[i]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_22 = __pyx_v_i; __pyx_t_5 = (!npy_isnan((*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_fixed.diminfo[0].strides)))); if (__pyx_t_5) { /* "astropy/convolution/boundary_fill.pyx":64 * for i in range(nx): * if not npy_isnan(fixed[i]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":65 * if not npy_isnan(fixed[i]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":66 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * for ii in range(iimin, iimax): */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":67 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":68 * iimin = i - wkx * iimax = i + wkx + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1: * val = fill_value */ __pyx_t_13 = __pyx_v_iimax; for (__pyx_t_14 = __pyx_v_iimin; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_ii = __pyx_t_14; /* "astropy/convolution/boundary_fill.pyx":69 * iimax = i + wkx + 1 * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_5 = (__pyx_v_ii < 0); if (!__pyx_t_5) { __pyx_t_6 = (__pyx_v_ii > (__pyx_v_nx - 1)); __pyx_t_1 = __pyx_t_6; } else { __pyx_t_1 = __pyx_t_5; } if (__pyx_t_1) { /* "astropy/convolution/boundary_fill.pyx":70 * for ii in range(iimin, iimax): * if ii < 0 or ii > nx - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = fixed[ii] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L17; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":72 * val = fill_value * else: * val = fixed[ii] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i)] * if not npy_isnan(val): */ __pyx_t_23 = __pyx_v_ii; if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_fixed.diminfo[0].shape; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L17:; /* "astropy/convolution/boundary_fill.pyx":73 * else: * val = fixed[ii] * ker = g[(wkx + ii - i)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_24 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_v_ker = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_g.diminfo[0].strides)); /* "astropy/convolution/boundary_fill.pyx":74 * val = fixed[ii] * ker = g[(wkx + ii - i)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_1 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_1) { /* "astropy/convolution/boundary_fill.pyx":75 * ker = g[(wkx + ii - i)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":76 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L18; } __pyx_L18:; } /* "astropy/convolution/boundary_fill.pyx":77 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i] = top / bot * else: */ __pyx_t_1 = (__pyx_v_bot != 0.0); if (__pyx_t_1) { /* "astropy/convolution/boundary_fill.pyx":78 * bot += ker * if bot != 0: * conv[i] = top / bot # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_25 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_conv.diminfo[0].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L19; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":80 * conv[i] = top / bot * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * else: * conv[i] = fixed[i] */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L19:; goto __pyx_L14; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":82 * conv[i] = fixed[i] * else: * conv[i] = fixed[i] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_conv.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_fixed.diminfo[0].strides)); } __pyx_L14:; } /* "astropy/convolution/boundary_fill.pyx":84 * conv[i] = fixed[i] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve1d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_3convolve2d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_fill_3convolve2d_boundary_fill = {__Pyx_NAMESTR("convolve2d_boundary_fill"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_fill_3convolve2d_boundary_fill, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_3convolve2d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; float __pyx_v_fill_value; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve2d_boundary_fill (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,&__pyx_n_s__fill_value,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_fill", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_fill", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve2d_boundary_fill") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); __pyx_v_fill_value = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_fill_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve2d_boundary_fill", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve2d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_fill_2convolve2d_boundary_fill(__pyx_self, __pyx_v_f, __pyx_v_g, __pyx_v_fill_value); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_fill.pyx":88 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_fill(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g, * float fill_value): */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_2convolve2d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_wkx; int __pyx_v_wky; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; int __pyx_t_10; unsigned int __pyx_t_11; int __pyx_t_12; unsigned int __pyx_t_13; unsigned int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; int __pyx_t_19; int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; unsigned int __pyx_t_24; unsigned int __pyx_t_25; unsigned int __pyx_t_26; unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; unsigned int __pyx_t_30; unsigned int __pyx_t_31; unsigned int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; int __pyx_t_38; int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; unsigned int __pyx_t_51; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve2d_boundary_fill", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; /* "astropy/convolution/boundary_fill.pyx":92 * float fill_value): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "astropy/convolution/boundary_fill.pyx":93 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_fill.pyx":95 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_3) { __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (unlikely(!__pyx_t_2)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_fill.pyx":97 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":98 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_fill.pyx":99 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":100 * cdef int ny = f.shape[1] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_fill.pyx":101 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_fill.pyx":102 * cdef int nky = g.shape[1] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_fill.pyx":103 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) * cdef unsigned int i, j, iii, jjj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_7)); __Pyx_GIVEREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; } } __pyx_t_8 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_fill.pyx":104 * cdef int wky = nky // 2 * cdef np.ndarray[DTYPE_t, ndim=2] fixed = np.empty([nx, ny], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=2] conv = np.empty([nx, ny], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, iii, jjj * cdef int ii, jj */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; } } __pyx_t_9 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "astropy/convolution/boundary_fill.pyx":114 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if npy_isnan(f[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_fill.pyx":115 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_fill.pyx":116 * for i in range(nx): * for j in range(ny): * if npy_isnan(f[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_14 = __pyx_v_i; __pyx_t_15 = __pyx_v_j; __pyx_t_2 = npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_f.diminfo[1].strides))); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":117 * for j in range(ny): * if npy_isnan(f[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":118 * if npy_isnan(f[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":119 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":120 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":121 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_fill.pyx":122 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_fill.pyx":123 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_fill.pyx":124 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: * val = fill_value */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_fill.pyx":125 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_2 = (__pyx_v_ii < 0); if (!__pyx_t_2) { __pyx_t_3 = (__pyx_v_ii > (__pyx_v_nx - 1)); if (!__pyx_t_3) { __pyx_t_1 = (__pyx_v_jj < 0); if (!__pyx_t_1) { __pyx_t_20 = (__pyx_v_jj > (__pyx_v_ny - 1)); __pyx_t_21 = __pyx_t_20; } else { __pyx_t_21 = __pyx_t_1; } __pyx_t_1 = __pyx_t_21; } else { __pyx_t_1 = __pyx_t_3; } __pyx_t_3 = __pyx_t_1; } else { __pyx_t_3 = __pyx_t_2; } if (__pyx_t_3) { /* "astropy/convolution/boundary_fill.pyx":126 * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = f[ii, jj] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L13; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":128 * val = fill_value * else: * val = f[ii, jj] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_22 = __pyx_v_ii; __pyx_t_23 = __pyx_v_jj; if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_f.diminfo[0].shape; if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_f.diminfo[1].shape; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L13:; /* "astropy/convolution/boundary_fill.pyx":129 * else: * val = f[ii, jj] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_3 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_3) { /* "astropy/convolution/boundary_fill.pyx":131 * if not npy_isnan(val): * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_24 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_25 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_fill.pyx":132 * ker = g[(wkx + ii - i), * (wky + jj - j)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":133 * (wky + jj - j)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L14; } __pyx_L14:; } } /* "astropy/convolution/boundary_fill.pyx":134 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j] = top / bot * else: */ __pyx_t_3 = (__pyx_v_bot != 0.); if (__pyx_t_3) { /* "astropy/convolution/boundary_fill.pyx":135 * bot += ker * if bot != 0.: * fixed[i, j] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_fixed.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L15; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":137 * fixed[i, j] = top / bot * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * else: * fixed[i, j] = f[i, j] */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_j; __pyx_t_30 = __pyx_v_i; __pyx_t_31 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L15:; goto __pyx_L8; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":139 * fixed[i, j] = f[i, j] * else: * fixed[i, j] = f[i, j] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_32 = __pyx_v_i; __pyx_t_33 = __pyx_v_j; __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_fixed.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_f.diminfo[1].strides)); } __pyx_L8:; } } /* "astropy/convolution/boundary_fill.pyx":142 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * if not npy_isnan(fixed[i, j]): */ __pyx_t_10 = __pyx_v_nx; for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; /* "astropy/convolution/boundary_fill.pyx":143 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j]): * top = 0. */ __pyx_t_12 = __pyx_v_ny; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; /* "astropy/convolution/boundary_fill.pyx":144 * for i in range(nx): * for j in range(ny): * if not npy_isnan(fixed[i, j]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_36 = __pyx_v_i; __pyx_t_37 = __pyx_v_j; __pyx_t_3 = (!npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_fixed.diminfo[1].strides)))); if (__pyx_t_3) { /* "astropy/convolution/boundary_fill.pyx":145 * for j in range(ny): * if not npy_isnan(fixed[i, j]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":146 * if not npy_isnan(fixed[i, j]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":147 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":148 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":149 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * for ii in range(iimin, iimax): */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_fill.pyx":150 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_fill.pyx":151 * jjmin = j - wky * jjmax = j + wky + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: */ __pyx_t_16 = __pyx_v_iimax; for (__pyx_t_17 = __pyx_v_iimin; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_ii = __pyx_t_17; /* "astropy/convolution/boundary_fill.pyx":152 * jjmax = j + wky + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: * val = fill_value */ __pyx_t_18 = __pyx_v_jjmax; for (__pyx_t_19 = __pyx_v_jjmin; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_jj = __pyx_t_19; /* "astropy/convolution/boundary_fill.pyx":153 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_3 = (__pyx_v_ii < 0); if (!__pyx_t_3) { __pyx_t_2 = (__pyx_v_ii > (__pyx_v_nx - 1)); if (!__pyx_t_2) { __pyx_t_1 = (__pyx_v_jj < 0); if (!__pyx_t_1) { __pyx_t_21 = (__pyx_v_jj > (__pyx_v_ny - 1)); __pyx_t_20 = __pyx_t_21; } else { __pyx_t_20 = __pyx_t_1; } __pyx_t_1 = __pyx_t_20; } else { __pyx_t_1 = __pyx_t_2; } __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":154 * for jj in range(jjmin, jjmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = fixed[ii, jj] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L25; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":156 * val = fill_value * else: * val = fixed[ii, jj] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j)] */ __pyx_t_38 = __pyx_v_ii; __pyx_t_39 = __pyx_v_jj; if (__pyx_t_38 < 0) __pyx_t_38 += __pyx_pybuffernd_fixed.diminfo[0].shape; if (__pyx_t_39 < 0) __pyx_t_39 += __pyx_pybuffernd_fixed.diminfo[1].shape; __pyx_v_val = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L25:; /* "astropy/convolution/boundary_fill.pyx":158 * val = fixed[ii, jj] * ker = g[(wkx + ii - i), * (wky + jj - j)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_40 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_41 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_v_ker = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_g.diminfo[1].strides)); /* "astropy/convolution/boundary_fill.pyx":159 * ker = g[(wkx + ii - i), * (wky + jj - j)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":160 * (wky + jj - j)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":161 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L26; } __pyx_L26:; } } /* "astropy/convolution/boundary_fill.pyx":162 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.0); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":163 * bot += ker * if bot != 0: * conv[i, j] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_conv.diminfo[1].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L27; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":165 * conv[i, j] = top / bot * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * else: * conv[i, j] = fixed[i, j] */ __pyx_t_44 = __pyx_v_i; __pyx_t_45 = __pyx_v_j; __pyx_t_46 = __pyx_v_i; __pyx_t_47 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L27:; goto __pyx_L20; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":167 * conv[i, j] = fixed[i, j] * else: * conv[i, j] = fixed[i, j] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; __pyx_t_50 = __pyx_v_i; __pyx_t_51 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_conv.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_fixed.diminfo[1].strides)); } __pyx_L20:; } } /* "astropy/convolution/boundary_fill.pyx":169 * conv[i, j] = fixed[i, j] * * return conv # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve2d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_5convolve3d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7astropy_11convolution_13boundary_fill_5convolve3d_boundary_fill = {__Pyx_NAMESTR("convolve3d_boundary_fill"), (PyCFunction)__pyx_pw_7astropy_11convolution_13boundary_fill_5convolve3d_boundary_fill, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_7astropy_11convolution_13boundary_fill_5convolve3d_boundary_fill(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_f = 0; PyArrayObject *__pyx_v_g = 0; float __pyx_v_fill_value; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("convolve3d_boundary_fill (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__f,&__pyx_n_s__g,&__pyx_n_s__fill_value,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_fill", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fill_value)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_fill", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convolve3d_boundary_fill") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_f = ((PyArrayObject *)values[0]); __pyx_v_g = ((PyArrayObject *)values[1]); __pyx_v_fill_value = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_fill_value == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("convolve3d_boundary_fill", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve3d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_f), __pyx_ptype_5numpy_ndarray, 1, "f", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_g), __pyx_ptype_5numpy_ndarray, 1, "g", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_11convolution_13boundary_fill_4convolve3d_boundary_fill(__pyx_self, __pyx_v_f, __pyx_v_g, __pyx_v_fill_value); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/convolution/boundary_fill.pyx":173 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_fill(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g, * float fill_value): */ static PyObject *__pyx_pf_7astropy_11convolution_13boundary_fill_4convolve3d_boundary_fill(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_f, PyArrayObject *__pyx_v_g, float __pyx_v_fill_value) { int __pyx_v_nx; int __pyx_v_ny; int __pyx_v_nz; int __pyx_v_nkx; int __pyx_v_nky; int __pyx_v_nkz; int __pyx_v_wkx; int __pyx_v_wky; int __pyx_v_wkz; PyArrayObject *__pyx_v_fixed = 0; PyArrayObject *__pyx_v_conv = 0; unsigned int __pyx_v_i; unsigned int __pyx_v_j; unsigned int __pyx_v_k; int __pyx_v_ii; int __pyx_v_jj; int __pyx_v_kk; int __pyx_v_iimin; int __pyx_v_iimax; int __pyx_v_jjmin; int __pyx_v_jjmax; int __pyx_v_kkmin; int __pyx_v_kkmax; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_top; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_bot; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_ker; __pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t __pyx_v_val; __Pyx_LocalBuf_ND __pyx_pybuffernd_conv; __Pyx_Buffer __pyx_pybuffer_conv; __Pyx_LocalBuf_ND __pyx_pybuffernd_f; __Pyx_Buffer __pyx_pybuffer_f; __Pyx_LocalBuf_ND __pyx_pybuffernd_fixed; __Pyx_Buffer __pyx_pybuffer_fixed; __Pyx_LocalBuf_ND __pyx_pybuffernd_g; __Pyx_Buffer __pyx_pybuffer_g; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; int __pyx_t_12; unsigned int __pyx_t_13; int __pyx_t_14; unsigned int __pyx_t_15; int __pyx_t_16; unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; int __pyx_t_24; int __pyx_t_25; int __pyx_t_26; int __pyx_t_27; int __pyx_t_28; int __pyx_t_29; int __pyx_t_30; int __pyx_t_31; int __pyx_t_32; unsigned int __pyx_t_33; unsigned int __pyx_t_34; unsigned int __pyx_t_35; unsigned int __pyx_t_36; unsigned int __pyx_t_37; unsigned int __pyx_t_38; unsigned int __pyx_t_39; unsigned int __pyx_t_40; unsigned int __pyx_t_41; unsigned int __pyx_t_42; unsigned int __pyx_t_43; unsigned int __pyx_t_44; unsigned int __pyx_t_45; unsigned int __pyx_t_46; unsigned int __pyx_t_47; unsigned int __pyx_t_48; unsigned int __pyx_t_49; unsigned int __pyx_t_50; unsigned int __pyx_t_51; unsigned int __pyx_t_52; unsigned int __pyx_t_53; int __pyx_t_54; int __pyx_t_55; int __pyx_t_56; unsigned int __pyx_t_57; unsigned int __pyx_t_58; unsigned int __pyx_t_59; unsigned int __pyx_t_60; unsigned int __pyx_t_61; unsigned int __pyx_t_62; unsigned int __pyx_t_63; unsigned int __pyx_t_64; unsigned int __pyx_t_65; unsigned int __pyx_t_66; unsigned int __pyx_t_67; unsigned int __pyx_t_68; unsigned int __pyx_t_69; unsigned int __pyx_t_70; unsigned int __pyx_t_71; unsigned int __pyx_t_72; unsigned int __pyx_t_73; unsigned int __pyx_t_74; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convolve3d_boundary_fill", 0); __pyx_pybuffer_fixed.pybuffer.buf = NULL; __pyx_pybuffer_fixed.refcount = 0; __pyx_pybuffernd_fixed.data = NULL; __pyx_pybuffernd_fixed.rcbuffer = &__pyx_pybuffer_fixed; __pyx_pybuffer_conv.pybuffer.buf = NULL; __pyx_pybuffer_conv.refcount = 0; __pyx_pybuffernd_conv.data = NULL; __pyx_pybuffernd_conv.rcbuffer = &__pyx_pybuffer_conv; __pyx_pybuffer_f.pybuffer.buf = NULL; __pyx_pybuffer_f.refcount = 0; __pyx_pybuffernd_f.data = NULL; __pyx_pybuffernd_f.rcbuffer = &__pyx_pybuffer_f; __pyx_pybuffer_g.pybuffer.buf = NULL; __pyx_pybuffer_g.refcount = 0; __pyx_pybuffernd_g.data = NULL; __pyx_pybuffernd_g.rcbuffer = &__pyx_pybuffer_g; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f.rcbuffer->pybuffer, (PyObject*)__pyx_v_f, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_f.diminfo[0].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f.diminfo[0].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_f.diminfo[1].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_f.diminfo[1].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_f.diminfo[2].strides = __pyx_pybuffernd_f.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_f.diminfo[2].shape = __pyx_pybuffernd_f.rcbuffer->pybuffer.shape[2]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_g.rcbuffer->pybuffer, (PyObject*)__pyx_v_g, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_g.diminfo[0].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_g.diminfo[0].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_g.diminfo[1].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_g.diminfo[1].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_g.diminfo[2].strides = __pyx_pybuffernd_g.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_g.diminfo[2].shape = __pyx_pybuffernd_g.rcbuffer->pybuffer.shape[2]; /* "astropy/convolution/boundary_fill.pyx":177 * float fill_value): * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: # <<<<<<<<<<<<<< * raise ValueError("Convolution kernel must have odd dimensions") * */ __pyx_t_1 = (__Pyx_mod_long((__pyx_v_g->dimensions[0]), 2) != 1); if (!__pyx_t_1) { __pyx_t_2 = (__Pyx_mod_long((__pyx_v_g->dimensions[1]), 2) != 1); if (!__pyx_t_2) { __pyx_t_3 = (__Pyx_mod_long((__pyx_v_g->dimensions[2]), 2) != 1); __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_t_2 = __pyx_t_4; } else { __pyx_t_2 = __pyx_t_1; } if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":178 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "astropy/convolution/boundary_fill.pyx":180 * raise ValueError("Convolution kernel must have odd dimensions") * * assert f.dtype == DTYPE and g.dtype == DTYPE # <<<<<<<<<<<<<< * * cdef int nx = f.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_f), __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_g), __pyx_n_s__dtype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (unlikely(!__pyx_t_4)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "astropy/convolution/boundary_fill.pyx":182 * assert f.dtype == DTYPE and g.dtype == DTYPE * * cdef int nx = f.shape[0] # <<<<<<<<<<<<<< * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] */ __pyx_v_nx = (__pyx_v_f->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":183 * * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] # <<<<<<<<<<<<<< * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] */ __pyx_v_ny = (__pyx_v_f->dimensions[1]); /* "astropy/convolution/boundary_fill.pyx":184 * cdef int nx = f.shape[0] * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] # <<<<<<<<<<<<<< * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] */ __pyx_v_nz = (__pyx_v_f->dimensions[2]); /* "astropy/convolution/boundary_fill.pyx":185 * cdef int ny = f.shape[1] * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] # <<<<<<<<<<<<<< * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] */ __pyx_v_nkx = (__pyx_v_g->dimensions[0]); /* "astropy/convolution/boundary_fill.pyx":186 * cdef int nz = f.shape[2] * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] # <<<<<<<<<<<<<< * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 */ __pyx_v_nky = (__pyx_v_g->dimensions[1]); /* "astropy/convolution/boundary_fill.pyx":187 * cdef int nkx = g.shape[0] * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] # <<<<<<<<<<<<<< * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 */ __pyx_v_nkz = (__pyx_v_g->dimensions[2]); /* "astropy/convolution/boundary_fill.pyx":188 * cdef int nky = g.shape[1] * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 # <<<<<<<<<<<<<< * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 */ __pyx_v_wkx = __Pyx_div_long(__pyx_v_nkx, 2); /* "astropy/convolution/boundary_fill.pyx":189 * cdef int nkz = g.shape[2] * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 # <<<<<<<<<<<<<< * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wky = __Pyx_div_long(__pyx_v_nky, 2); /* "astropy/convolution/boundary_fill.pyx":190 * cdef int wkx = nkx // 2 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) */ __pyx_v_wkz = __Pyx_div_long(__pyx_v_nkz, 2); /* "astropy/convolution/boundary_fill.pyx":191 * cdef int wky = nky // 2 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) * cdef unsigned int i, j, k, iii, jjj, kkk */ __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9)); __Pyx_GIVEREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_fixed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_fixed.diminfo[0].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fixed.diminfo[0].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fixed.diminfo[1].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fixed.diminfo[1].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_fixed.diminfo[2].strides = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_fixed.diminfo[2].shape = __pyx_pybuffernd_fixed.rcbuffer->pybuffer.shape[2]; } } __pyx_t_10 = 0; __pyx_v_fixed = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; /* "astropy/convolution/boundary_fill.pyx":192 * cdef int wkz = nkz // 2 * cdef np.ndarray[DTYPE_t, ndim=3] fixed = np.empty([nx, ny, nz], dtype=DTYPE) * cdef np.ndarray[DTYPE_t, ndim=3] conv = np.empty([nx, ny, nz], dtype=DTYPE) # <<<<<<<<<<<<<< * cdef unsigned int i, j, k, iii, jjj, kkk * cdef int ii, jj, kk */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyInt_FromLong(__pyx_v_nx); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyInt_FromLong(__pyx_v_ny); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_6 = PyInt_FromLong(__pyx_v_nz); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_conv.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) { __pyx_v_conv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_conv.diminfo[0].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_conv.diminfo[0].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_conv.diminfo[1].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_conv.diminfo[1].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_conv.diminfo[2].strides = __pyx_pybuffernd_conv.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_conv.diminfo[2].shape = __pyx_pybuffernd_conv.rcbuffer->pybuffer.shape[2]; } } __pyx_t_11 = 0; __pyx_v_conv = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; /* "astropy/convolution/boundary_fill.pyx":202 * # Need a first pass to replace NaN values with value convolved from * # neighboring values * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_fill.pyx":203 * # neighboring values * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if npy_isnan(f[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_fill.pyx":204 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if npy_isnan(f[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_fill.pyx":205 * for j in range(ny): * for k in range(nz): * if npy_isnan(f[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_j; __pyx_t_20 = __pyx_v_k; __pyx_t_4 = npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_f.diminfo[2].strides))); if (__pyx_t_4) { /* "astropy/convolution/boundary_fill.pyx":206 * for k in range(nz): * if npy_isnan(f[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":207 * if npy_isnan(f[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":208 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":209 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":210 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_fill.pyx":211 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_fill.pyx":212 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_fill.pyx":213 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_fill.pyx":214 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_fill.pyx":215 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_fill.pyx":216 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: * val = fill_value */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_fill.pyx":217 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_4 = (__pyx_v_ii < 0); if (!__pyx_t_4) { __pyx_t_2 = (__pyx_v_ii > (__pyx_v_nx - 1)); if (!__pyx_t_2) { __pyx_t_1 = (__pyx_v_jj < 0); if (!__pyx_t_1) { __pyx_t_3 = (__pyx_v_jj > (__pyx_v_ny - 1)); if (!__pyx_t_3) { __pyx_t_27 = (__pyx_v_kk < 0); if (!__pyx_t_27) { __pyx_t_28 = (__pyx_v_kk > (__pyx_v_nz - 1)); __pyx_t_29 = __pyx_t_28; } else { __pyx_t_29 = __pyx_t_27; } __pyx_t_27 = __pyx_t_29; } else { __pyx_t_27 = __pyx_t_3; } __pyx_t_3 = __pyx_t_27; } else { __pyx_t_3 = __pyx_t_1; } __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_4; } if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":218 * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = f[ii, jj, kk] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L17; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":220 * val = fill_value * else: * val = f[ii, jj, kk] # <<<<<<<<<<<<<< * if not npy_isnan(val): * ker = g[(wkx + ii - i), */ __pyx_t_30 = __pyx_v_ii; __pyx_t_31 = __pyx_v_jj; __pyx_t_32 = __pyx_v_kk; if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_pybuffernd_f.diminfo[0].shape; if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_f.diminfo[1].shape; if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_pybuffernd_f.diminfo[2].shape; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_32, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L17:; /* "astropy/convolution/boundary_fill.pyx":221 * else: * val = f[ii, jj, kk] * if not npy_isnan(val): # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_2 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":224 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_33 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_34 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_35 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_fill.pyx":225 * (wky + jj - j), * (wkz + kk - k)] * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0.: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":226 * (wkz + kk - k)] * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0.: * fixed[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L18; } __pyx_L18:; } } } /* "astropy/convolution/boundary_fill.pyx":227 * top += val * ker * bot += ker * if bot != 0.: # <<<<<<<<<<<<<< * fixed[i, j, k] = top / bot * else: */ __pyx_t_2 = (__pyx_v_bot != 0.); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":228 * bot += ker * if bot != 0.: * fixed[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_36 = __pyx_v_i; __pyx_t_37 = __pyx_v_j; __pyx_t_38 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_38, __pyx_pybuffernd_fixed.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L19; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":230 * fixed[i, j, k] = top / bot * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * else: * fixed[i, j, k] = f[i, j, k] */ __pyx_t_39 = __pyx_v_i; __pyx_t_40 = __pyx_v_j; __pyx_t_41 = __pyx_v_k; __pyx_t_42 = __pyx_v_i; __pyx_t_43 = __pyx_v_j; __pyx_t_44 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_44, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_41, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L19:; goto __pyx_L10; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":232 * fixed[i, j, k] = f[i, j, k] * else: * fixed[i, j, k] = f[i, j, k] # <<<<<<<<<<<<<< * * # Now run the proper convolution */ __pyx_t_45 = __pyx_v_i; __pyx_t_46 = __pyx_v_j; __pyx_t_47 = __pyx_v_k; __pyx_t_48 = __pyx_v_i; __pyx_t_49 = __pyx_v_j; __pyx_t_50 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_50, __pyx_pybuffernd_fixed.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_f.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_f.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_f.diminfo[1].strides, __pyx_t_47, __pyx_pybuffernd_f.diminfo[2].strides)); } __pyx_L10:; } } } /* "astropy/convolution/boundary_fill.pyx":235 * * # Now run the proper convolution * for i in range(nx): # <<<<<<<<<<<<<< * for j in range(ny): * for k in range(nz): */ __pyx_t_12 = __pyx_v_nx; for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; /* "astropy/convolution/boundary_fill.pyx":236 * # Now run the proper convolution * for i in range(nx): * for j in range(ny): # <<<<<<<<<<<<<< * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): */ __pyx_t_14 = __pyx_v_ny; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15; /* "astropy/convolution/boundary_fill.pyx":237 * for i in range(nx): * for j in range(ny): * for k in range(nz): # <<<<<<<<<<<<<< * if not npy_isnan(fixed[i, j, k]): * top = 0. */ __pyx_t_16 = __pyx_v_nz; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_k = __pyx_t_17; /* "astropy/convolution/boundary_fill.pyx":238 * for j in range(ny): * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): # <<<<<<<<<<<<<< * top = 0. * bot = 0. */ __pyx_t_51 = __pyx_v_i; __pyx_t_52 = __pyx_v_j; __pyx_t_53 = __pyx_v_k; __pyx_t_2 = (!npy_isnan((*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_53, __pyx_pybuffernd_fixed.diminfo[2].strides)))); if (__pyx_t_2) { /* "astropy/convolution/boundary_fill.pyx":239 * for k in range(nz): * if not npy_isnan(fixed[i, j, k]): * top = 0. # <<<<<<<<<<<<<< * bot = 0. * iimin = i - wkx */ __pyx_v_top = 0.; /* "astropy/convolution/boundary_fill.pyx":240 * if not npy_isnan(fixed[i, j, k]): * top = 0. * bot = 0. # <<<<<<<<<<<<<< * iimin = i - wkx * iimax = i + wkx + 1 */ __pyx_v_bot = 0.; /* "astropy/convolution/boundary_fill.pyx":241 * top = 0. * bot = 0. * iimin = i - wkx # <<<<<<<<<<<<<< * iimax = i + wkx + 1 * jjmin = j - wky */ __pyx_v_iimin = (__pyx_v_i - __pyx_v_wkx); /* "astropy/convolution/boundary_fill.pyx":242 * bot = 0. * iimin = i - wkx * iimax = i + wkx + 1 # <<<<<<<<<<<<<< * jjmin = j - wky * jjmax = j + wky + 1 */ __pyx_v_iimax = ((__pyx_v_i + __pyx_v_wkx) + 1); /* "astropy/convolution/boundary_fill.pyx":243 * iimin = i - wkx * iimax = i + wkx + 1 * jjmin = j - wky # <<<<<<<<<<<<<< * jjmax = j + wky + 1 * kkmin = k - wkz */ __pyx_v_jjmin = (__pyx_v_j - __pyx_v_wky); /* "astropy/convolution/boundary_fill.pyx":244 * iimax = i + wkx + 1 * jjmin = j - wky * jjmax = j + wky + 1 # <<<<<<<<<<<<<< * kkmin = k - wkz * kkmax = k + wkz + 1 */ __pyx_v_jjmax = ((__pyx_v_j + __pyx_v_wky) + 1); /* "astropy/convolution/boundary_fill.pyx":245 * jjmin = j - wky * jjmax = j + wky + 1 * kkmin = k - wkz # <<<<<<<<<<<<<< * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): */ __pyx_v_kkmin = (__pyx_v_k - __pyx_v_wkz); /* "astropy/convolution/boundary_fill.pyx":246 * jjmax = j + wky + 1 * kkmin = k - wkz * kkmax = k + wkz + 1 # <<<<<<<<<<<<<< * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): */ __pyx_v_kkmax = ((__pyx_v_k + __pyx_v_wkz) + 1); /* "astropy/convolution/boundary_fill.pyx":247 * kkmin = k - wkz * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): # <<<<<<<<<<<<<< * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): */ __pyx_t_21 = __pyx_v_iimax; for (__pyx_t_22 = __pyx_v_iimin; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_ii = __pyx_t_22; /* "astropy/convolution/boundary_fill.pyx":248 * kkmax = k + wkz + 1 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): # <<<<<<<<<<<<<< * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: */ __pyx_t_23 = __pyx_v_jjmax; for (__pyx_t_24 = __pyx_v_jjmin; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) { __pyx_v_jj = __pyx_t_24; /* "astropy/convolution/boundary_fill.pyx":249 * for ii in range(iimin, iimax): * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): # <<<<<<<<<<<<<< * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: * val = fill_value */ __pyx_t_25 = __pyx_v_kkmax; for (__pyx_t_26 = __pyx_v_kkmin; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) { __pyx_v_kk = __pyx_t_26; /* "astropy/convolution/boundary_fill.pyx":250 * for jj in range(jjmin, jjmax): * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: # <<<<<<<<<<<<<< * val = fill_value * else: */ __pyx_t_2 = (__pyx_v_ii < 0); if (!__pyx_t_2) { __pyx_t_4 = (__pyx_v_ii > (__pyx_v_nx - 1)); if (!__pyx_t_4) { __pyx_t_1 = (__pyx_v_jj < 0); if (!__pyx_t_1) { __pyx_t_3 = (__pyx_v_jj > (__pyx_v_ny - 1)); if (!__pyx_t_3) { __pyx_t_27 = (__pyx_v_kk < 0); if (!__pyx_t_27) { __pyx_t_29 = (__pyx_v_kk > (__pyx_v_nz - 1)); __pyx_t_28 = __pyx_t_29; } else { __pyx_t_28 = __pyx_t_27; } __pyx_t_27 = __pyx_t_28; } else { __pyx_t_27 = __pyx_t_3; } __pyx_t_3 = __pyx_t_27; } else { __pyx_t_3 = __pyx_t_1; } __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_4; } __pyx_t_4 = __pyx_t_1; } else { __pyx_t_4 = __pyx_t_2; } if (__pyx_t_4) { /* "astropy/convolution/boundary_fill.pyx":251 * for kk in range(kkmin, kkmax): * if ii < 0 or ii > nx - 1 or jj < 0 or jj > ny - 1 or kk < 0 or kk > nz - 1: * val = fill_value # <<<<<<<<<<<<<< * else: * val = fixed[ii, jj, kk] */ __pyx_v_val = __pyx_v_fill_value; goto __pyx_L33; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":253 * val = fill_value * else: * val = fixed[ii, jj, kk] # <<<<<<<<<<<<<< * ker = g[(wkx + ii - i), * (wky + jj - j), */ __pyx_t_54 = __pyx_v_ii; __pyx_t_55 = __pyx_v_jj; __pyx_t_56 = __pyx_v_kk; if (__pyx_t_54 < 0) __pyx_t_54 += __pyx_pybuffernd_fixed.diminfo[0].shape; if (__pyx_t_55 < 0) __pyx_t_55 += __pyx_pybuffernd_fixed.diminfo[1].shape; if (__pyx_t_56 < 0) __pyx_t_56 += __pyx_pybuffernd_fixed.diminfo[2].shape; __pyx_v_val = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_56, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L33:; /* "astropy/convolution/boundary_fill.pyx":256 * ker = g[(wkx + ii - i), * (wky + jj - j), * (wkz + kk - k)] # <<<<<<<<<<<<<< * if not npy_isnan(val): * top += val * ker */ __pyx_t_57 = ((unsigned int)((__pyx_v_wkx + __pyx_v_ii) - __pyx_v_i)); __pyx_t_58 = ((unsigned int)((__pyx_v_wky + __pyx_v_jj) - __pyx_v_j)); __pyx_t_59 = ((unsigned int)((__pyx_v_wkz + __pyx_v_kk) - __pyx_v_k)); __pyx_v_ker = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_g.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_g.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_g.diminfo[1].strides, __pyx_t_59, __pyx_pybuffernd_g.diminfo[2].strides)); /* "astropy/convolution/boundary_fill.pyx":257 * (wky + jj - j), * (wkz + kk - k)] * if not npy_isnan(val): # <<<<<<<<<<<<<< * top += val * ker * bot += ker */ __pyx_t_4 = (!npy_isnan(__pyx_v_val)); if (__pyx_t_4) { /* "astropy/convolution/boundary_fill.pyx":258 * (wkz + kk - k)] * if not npy_isnan(val): * top += val * ker # <<<<<<<<<<<<<< * bot += ker * if bot != 0: */ __pyx_v_top = (__pyx_v_top + (__pyx_v_val * __pyx_v_ker)); /* "astropy/convolution/boundary_fill.pyx":259 * if not npy_isnan(val): * top += val * ker * bot += ker # <<<<<<<<<<<<<< * if bot != 0: * conv[i, j, k] = top / bot */ __pyx_v_bot = (__pyx_v_bot + __pyx_v_ker); goto __pyx_L34; } __pyx_L34:; } } } /* "astropy/convolution/boundary_fill.pyx":260 * top += val * ker * bot += ker * if bot != 0: # <<<<<<<<<<<<<< * conv[i, j, k] = top / bot * else: */ __pyx_t_4 = (__pyx_v_bot != 0.0); if (__pyx_t_4) { /* "astropy/convolution/boundary_fill.pyx":261 * bot += ker * if bot != 0: * conv[i, j, k] = top / bot # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ if (unlikely(__pyx_v_bot == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_60 = __pyx_v_i; __pyx_t_61 = __pyx_v_j; __pyx_t_62 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_62, __pyx_pybuffernd_conv.diminfo[2].strides) = (__pyx_v_top / __pyx_v_bot); goto __pyx_L35; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":263 * conv[i, j, k] = top / bot * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * else: * conv[i, j, k] = fixed[i, j, k] */ __pyx_t_63 = __pyx_v_i; __pyx_t_64 = __pyx_v_j; __pyx_t_65 = __pyx_v_k; __pyx_t_66 = __pyx_v_i; __pyx_t_67 = __pyx_v_j; __pyx_t_68 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_68, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_65, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L35:; goto __pyx_L26; } /*else*/ { /* "astropy/convolution/boundary_fill.pyx":265 * conv[i, j, k] = fixed[i, j, k] * else: * conv[i, j, k] = fixed[i, j, k] # <<<<<<<<<<<<<< * * return conv */ __pyx_t_69 = __pyx_v_i; __pyx_t_70 = __pyx_v_j; __pyx_t_71 = __pyx_v_k; __pyx_t_72 = __pyx_v_i; __pyx_t_73 = __pyx_v_j; __pyx_t_74 = __pyx_v_k; *__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_conv.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_conv.diminfo[0].strides, __pyx_t_73, __pyx_pybuffernd_conv.diminfo[1].strides, __pyx_t_74, __pyx_pybuffernd_conv.diminfo[2].strides) = (*__Pyx_BufPtrStrided3d(__pyx_t_7astropy_11convolution_13boundary_fill_DTYPE_t *, __pyx_pybuffernd_fixed.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_fixed.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_fixed.diminfo[1].strides, __pyx_t_71, __pyx_pybuffernd_fixed.diminfo[2].strides)); } __pyx_L26:; } } } /* "astropy/convolution/boundary_fill.pyx":267 * conv[i, j, k] = fixed[i, j, k] * * return conv # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_conv)); __pyx_r = ((PyObject *)__pyx_v_conv); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.convolution.boundary_fill.convolve3d_boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_conv.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fixed.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_g.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_fixed); __Pyx_XDECREF((PyObject *)__pyx_v_conv); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L13; } /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L13; } /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L13; } /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L13; } /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L13; } /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L13; } /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L13; } /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L13; } /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L13; } /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L13; } /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L13; } /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L13; } /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L13; } /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L13; } /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L13; } /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L13; } /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_7) { __pyx_t_8 = __pyx_v_little_endian; } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_7) { __pyx_t_9 = (!__pyx_v_little_endian); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("boundary_fill"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__bot, __pyx_k__bot, sizeof(__pyx_k__bot), 0, 0, 1, 1}, {&__pyx_n_s__conv, __pyx_k__conv, sizeof(__pyx_k__conv), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, {&__pyx_n_s__f, __pyx_k__f, sizeof(__pyx_k__f), 0, 0, 1, 1}, {&__pyx_n_s__fill_value, __pyx_k__fill_value, sizeof(__pyx_k__fill_value), 0, 0, 1, 1}, {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__ii, __pyx_k__ii, sizeof(__pyx_k__ii), 0, 0, 1, 1}, {&__pyx_n_s__iii, __pyx_k__iii, sizeof(__pyx_k__iii), 0, 0, 1, 1}, {&__pyx_n_s__iimax, __pyx_k__iimax, sizeof(__pyx_k__iimax), 0, 0, 1, 1}, {&__pyx_n_s__iimin, __pyx_k__iimin, sizeof(__pyx_k__iimin), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__jj, __pyx_k__jj, sizeof(__pyx_k__jj), 0, 0, 1, 1}, {&__pyx_n_s__jjj, __pyx_k__jjj, sizeof(__pyx_k__jjj), 0, 0, 1, 1}, {&__pyx_n_s__jjmax, __pyx_k__jjmax, sizeof(__pyx_k__jjmax), 0, 0, 1, 1}, {&__pyx_n_s__jjmin, __pyx_k__jjmin, sizeof(__pyx_k__jjmin), 0, 0, 1, 1}, {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, {&__pyx_n_s__ker, __pyx_k__ker, sizeof(__pyx_k__ker), 0, 0, 1, 1}, {&__pyx_n_s__kk, __pyx_k__kk, sizeof(__pyx_k__kk), 0, 0, 1, 1}, {&__pyx_n_s__kkk, __pyx_k__kkk, sizeof(__pyx_k__kkk), 0, 0, 1, 1}, {&__pyx_n_s__kkmax, __pyx_k__kkmax, sizeof(__pyx_k__kkmax), 0, 0, 1, 1}, {&__pyx_n_s__kkmin, __pyx_k__kkmin, sizeof(__pyx_k__kkmin), 0, 0, 1, 1}, {&__pyx_n_s__nkx, __pyx_k__nkx, sizeof(__pyx_k__nkx), 0, 0, 1, 1}, {&__pyx_n_s__nky, __pyx_k__nky, sizeof(__pyx_k__nky), 0, 0, 1, 1}, {&__pyx_n_s__nkz, __pyx_k__nkz, sizeof(__pyx_k__nkz), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__nx, __pyx_k__nx, sizeof(__pyx_k__nx), 0, 0, 1, 1}, {&__pyx_n_s__ny, __pyx_k__ny, sizeof(__pyx_k__ny), 0, 0, 1, 1}, {&__pyx_n_s__nz, __pyx_k__nz, sizeof(__pyx_k__nz), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__top, __pyx_k__top, sizeof(__pyx_k__top), 0, 0, 1, 1}, {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, {&__pyx_n_s__wkx, __pyx_k__wkx, sizeof(__pyx_k__wkx), 0, 0, 1, 1}, {&__pyx_n_s__wky, __pyx_k__wky, sizeof(__pyx_k__wky), 0, 0, 1, 1}, {&__pyx_n_s__wkz, __pyx_k__wkz, sizeof(__pyx_k__wkz), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "astropy/convolution/boundary_fill.pyx":21 * * if g.shape[0] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "astropy/convolution/boundary_fill.pyx":93 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); /* "astropy/convolution/boundary_fill.pyx":178 * * if g.shape[0] % 2 != 1 or g.shape[1] % 2 != 1 or g.shape[2] % 2 != 1: * raise ValueError("Convolution kernel must have odd dimensions") # <<<<<<<<<<<<<< * * assert f.dtype == DTYPE and g.dtype == DTYPE */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "astropy/convolution/boundary_fill.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_fill(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g, * float fill_value): */ __pyx_k_tuple_17 = PyTuple_Pack(17, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__fill_value), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(3, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_19, 16, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_fill.pyx":88 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_fill(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g, * float fill_value): */ __pyx_k_tuple_22 = PyTuple_Pack(25, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__fill_value), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(3, 0, 25, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_24, 88, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/convolution/boundary_fill.pyx":173 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_fill(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g, * float fill_value): */ __pyx_k_tuple_25 = PyTuple_Pack(33, ((PyObject *)__pyx_n_s__f), ((PyObject *)__pyx_n_s__g), ((PyObject *)__pyx_n_s__fill_value), ((PyObject *)__pyx_n_s__nx), ((PyObject *)__pyx_n_s__ny), ((PyObject *)__pyx_n_s__nz), ((PyObject *)__pyx_n_s__nkx), ((PyObject *)__pyx_n_s__nky), ((PyObject *)__pyx_n_s__nkz), ((PyObject *)__pyx_n_s__wkx), ((PyObject *)__pyx_n_s__wky), ((PyObject *)__pyx_n_s__wkz), ((PyObject *)__pyx_n_s__fixed), ((PyObject *)__pyx_n_s__conv), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__k), ((PyObject *)__pyx_n_s__iii), ((PyObject *)__pyx_n_s__jjj), ((PyObject *)__pyx_n_s__kkk), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__jj), ((PyObject *)__pyx_n_s__kk), ((PyObject *)__pyx_n_s__iimin), ((PyObject *)__pyx_n_s__iimax), ((PyObject *)__pyx_n_s__jjmin), ((PyObject *)__pyx_n_s__jjmax), ((PyObject *)__pyx_n_s__kkmin), ((PyObject *)__pyx_n_s__kkmax), ((PyObject *)__pyx_n_s__top), ((PyObject *)__pyx_n_s__bot), ((PyObject *)__pyx_n_s__ker), ((PyObject *)__pyx_n_s__val)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(3, 0, 33, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s_27, 173, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initboundary_fill(void); /*proto*/ PyMODINIT_FUNC initboundary_fill(void) #else PyMODINIT_FUNC PyInit_boundary_fill(void); /*proto*/ PyMODINIT_FUNC PyInit_boundary_fill(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_boundary_fill(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("boundary_fill"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "astropy.convolution.boundary_fill")) { if (unlikely(PyDict_SetItemString(modules, "astropy.convolution.boundary_fill", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_astropy__convolution__boundary_fill) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "astropy/convolution/boundary_fill.pyx":3 * # Licensed under a 3-clause BSD style license - see LICENSE.rst * from __future__ import division * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/convolution/boundary_fill.pyx":6 * cimport numpy as np * * DTYPE = np.float # <<<<<<<<<<<<<< * ctypedef np.float_t DTYPE_t * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_fill.pyx":16 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve1d_boundary_fill(np.ndarray[DTYPE_t, ndim=1] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] g, * float fill_value): */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_fill_1convolve1d_boundary_fill, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_19, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_fill.pyx":88 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve2d_boundary_fill(np.ndarray[DTYPE_t, ndim=2] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=2] g, * float fill_value): */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_fill_3convolve2d_boundary_fill, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_24, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_fill.pyx":173 * * @cython.boundscheck(False) # turn off bounds-checking for entire function * def convolve3d_boundary_fill(np.ndarray[DTYPE_t, ndim=3] f, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=3] g, * float fill_value): */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_11convolution_13boundary_fill_5convolve3d_boundary_fill, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_27, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/convolution/boundary_fill.pyx":1 * # Licensed under a 3-clause BSD style license - see LICENSE.rst # <<<<<<<<<<<<<< * from __future__ import division * import numpy as np */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init astropy.convolution.boundary_fill", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init astropy.convolution.boundary_fill"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) /* First char was not a digit */ PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { if (isspace(*ts)) continue; number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { long r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); #endif Py_DECREF(getbuffer_cobj); if (!func) goto fail; return func(obj, view, flags); } else { PyErr_Clear(); } #endif PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; if (!obj) return; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif Py_DECREF(releasebuffer_cobj); if (!func) goto fail; func(obj, view); return; } else { PyErr_Clear(); } #endif goto nofail; #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); nofail: Py_DECREF(obj); view->obj = NULL; } #endif /* PY_MAJOR_VERSION < 3 */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ astropy-0.3/astropy/table/0000755000175000017500000000000012243263747013777 5ustar oleoleastropy-0.3/astropy/table/tests/0000755000175000017500000000000012243263747015141 5ustar oleoleastropy-0.3/astropy/table/tests/notebook_repr_html.ipynb0000644000175000017500000017213112243255342022075 0ustar oleole{ "metadata": { "astropy_comment": "This file is for manual testing of the table _html_repr_ functionality in IPython notebook. Load and run this notebook to verify that the cell tables are represented correctly as formatted HTML.", "name": "notebook_repr_html" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "from astropy.table import Table" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "t = Table([[1,2],[3,4]], names=['a','b'])" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "t" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
ab
13
24
" ], "output_type": "pyout", "prompt_number": 3, "text": [ "\n", "array([(1, 3), (2, 4)], \n", " dtype=[('a', '
col0 [2]col1 [2]col2 [2]
1 .. 23 .. 45 .. 6
10 .. 2030 .. 4050 .. 60
" ], "output_type": "pyout", "prompt_number": 5, "text": [ "\n", "array([([1, 2], [3, 4], [5, 6]), ([10, 20], [30, 40], [50, 60])], \n", " dtype=[('col0', '
col0col1col2col3col4col5col6...col93col94col95col96col97col98col99
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
.............................................
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
1.01.01.01.01.01.01.0...1.01.01.01.01.01.01.0
" ], "output_type": "pyout", "prompt_number": 6, "text": [ "\n", "array([ (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0),\n", " (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)], \n", " dtype=[('col0', '" assert str(tg['a'].groups) == "" # Sorted by 'a' and in original order for rest assert tg.pformat() == [' a b c d ', '--- --- --- ---', ' 0 a 0.0 4', ' 1 b 3.0 5', ' 1 a 2.0 6', ' 1 a 1.0 7', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 a 4.0 3'] assert tg.meta['ta'] == 1 assert tg['c'].meta['a'] == 1 assert tg['c'].description == 'column c' # Group by a table column tg2 = t1.group_by(t1['a']) assert tg.pformat() == tg2.pformat() # Group by two columns spec'd by name for keys in (['a', 'b'], ('a', 'b')): tg = t1.group_by(keys) assert np.all(tg.groups.indices == np.array([0, 1, 3, 4, 5, 7, 8])) # Sorted by 'a', 'b' and in original order for rest assert tg.pformat() == [' a b c d ', '--- --- --- ---', ' 0 a 0.0 4', ' 1 a 2.0 6', ' 1 a 1.0 7', ' 1 b 3.0 5', ' 2 a 4.0 3', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 c 7.0 0'] # Group by a Table tg2 = t1.group_by(t1['a', 'b']) assert tg.pformat() == tg2.pformat() # Group by a structured array tg2 = t1.group_by(t1['a', 'b']._data) assert tg.pformat() == tg2.pformat() # Group by a simple ndarray tg = t1.group_by(np.array([0, 1, 0, 1, 2, 1, 0, 0])) assert np.all(tg.groups.indices == np.array([0, 4, 7, 8])) assert tg.pformat() == [' a b c d ', '--- --- --- ---', ' 2 c 7.0 0', ' 2 b 6.0 2', ' 1 a 2.0 6', ' 1 a 1.0 7', ' 2 b 5.0 1', ' 2 a 4.0 3', ' 1 b 3.0 5', ' 0 a 0.0 4'] def test_groups_keys(): tg = T1.group_by('a') keys = tg.groups.keys assert keys.dtype.names == ('a',) assert np.all(keys['a'] == np.array([0, 1, 2])) tg = T1.group_by(['a', 'b']) keys = tg.groups.keys assert keys.dtype.names == ('a', 'b') assert np.all(keys['a'] == np.array([0, 1, 1, 2, 2, 2])) assert np.all(keys['b'] == np.array(['a', 'a', 'b', 'a', 'b', 'c'])) # Grouping by Column ignores column name tg = T1.group_by(T1['b']) keys = tg.groups.keys assert keys.dtype.names is None def test_groups_iterator(): tg = T1.group_by('a') for ii, group in enumerate(tg.groups): assert group.pformat() == tg.groups[ii].pformat() assert group['a'][0] == tg['a'][tg.groups.indices[ii]] def test_grouped_copy(): """ Test that copying a table or column copies the groups properly """ for masked in (False, True): t1 = Table(T1, masked=masked) tg = t1.group_by('a') tgc = tg.copy() assert np.all(tgc.groups.indices == tg.groups.indices) assert np.all(tgc.groups.keys == tg.groups.keys) tac = tg['a'].copy() assert np.all(tac.groups.indices == tg['a'].groups.indices) c1 = t1['a'].copy() gc1 = c1.group_by(t1['a']) gc1c = gc1.copy() assert np.all(gc1c.groups.indices == np.array([0, 1, 4, 8])) def test_grouped_slicing(): """ Test that slicing a table removes previous grouping """ for masked in (False, True): t1 = Table(T1, masked=masked) # Regular slice of a table tg = t1.group_by('a') tg2 = tg[3:5] assert np.all(tg2.groups.indices == np.array([0, len(tg2)])) assert tg2.groups.keys is None def test_group_column_from_table(): """ Group a column that is part of a table """ cg = T1['c'].group_by(np.array(T1['a'])) assert np.all(cg.groups.keys == np.array([0, 1, 2])) assert np.all(cg.groups.indices == np.array([0, 1, 4, 8])) def test_table_groups_mask_index(): """ Use boolean mask as item in __getitem__ for groups """ for masked in (False, True): t1 = Table(T1, masked=masked).group_by('a') t2 = t1.groups[np.array([True, False, True])] assert len(t2.groups) == 2 assert t2.groups[0].pformat() == t1.groups[0].pformat() assert t2.groups[1].pformat() == t1.groups[2].pformat() assert np.all(t2.groups.keys['a'] == np.array([0, 2])) def test_table_groups_array_index(): """ Use numpy array as item in __getitem__ for groups """ for masked in (False, True): t1 = Table(T1, masked=masked).group_by('a') t2 = t1.groups[np.array([0, 2])] assert len(t2.groups) == 2 assert t2.groups[0].pformat() == t1.groups[0].pformat() assert t2.groups[1].pformat() == t1.groups[2].pformat() assert np.all(t2.groups.keys['a'] == np.array([0, 2])) def test_table_groups_slicing(): """ Test that slicing table groups works """ for masked in (False, True): t1 = Table(T1, masked=masked).group_by('a') # slice(0, 2) t2 = t1.groups[0:2] assert len(t2.groups) == 2 assert t2.groups[0].pformat() == t1.groups[0].pformat() assert t2.groups[1].pformat() == t1.groups[1].pformat() assert np.all(t2.groups.keys['a'] == np.array([0, 1])) # slice(1, 2) t2 = t1.groups[1:2] assert len(t2.groups) == 1 assert t2.groups[0].pformat() == t1.groups[1].pformat() assert np.all(t2.groups.keys['a'] == np.array([1])) # slice(0, 3, 2) t2 = t1.groups[0:3:2] assert len(t2.groups) == 2 assert t2.groups[0].pformat() == t1.groups[0].pformat() assert t2.groups[1].pformat() == t1.groups[2].pformat() assert np.all(t2.groups.keys['a'] == np.array([0, 2])) def test_grouped_item_access(): """ Test that column slicing preserves grouping """ for masked in (False, True): t1 = Table(T1, masked=masked) # Regular slice of a table tg = t1.group_by('a') tgs = tg['a', 'c', 'd'] assert np.all(tgs.groups.keys == tg.groups.keys) assert np.all(tgs.groups.indices == tg.groups.indices) tgsa = tgs.groups.aggregate(np.sum) assert tgsa.pformat() == [' a c d ', '--- ---- ---', ' 0 0.0 4', ' 1 6.0 18', ' 2 22.0 6'] tgs = tg['c', 'd'] assert np.all(tgs.groups.keys == tg.groups.keys) assert np.all(tgs.groups.indices == tg.groups.indices) tgsa = tgs.groups.aggregate(np.sum) assert tgsa.pformat() == [' c d ', '---- ---', ' 0.0 4', ' 6.0 18', '22.0 6'] def test_mutable_operations(): """ Operations like adding or deleting a row should removing grouping, but adding or removing or renaming a column should retain grouping. """ for masked in (False, True): t1 = Table(T1, masked=masked) # add row tg = t1.group_by('a') tg.add_row((0, 'a', 3.0, 4)) assert np.all(tg.groups.indices == np.array([0, len(tg)])) assert tg.groups.keys is None # remove row tg = t1.group_by('a') tg.remove_row(4) assert np.all(tg.groups.indices == np.array([0, len(tg)])) assert tg.groups.keys is None # add column tg = t1.group_by('a') indices = tg.groups.indices.copy() tg.add_column(Column(name='e', data=np.arange(len(tg)))) assert np.all(tg.groups.indices == indices) assert np.all(tg['e'].groups.indices == indices) assert np.all(tg['e'].groups.keys == tg.groups.keys) # remove column (not key column) tg = t1.group_by('a') tg.remove_column('b') assert np.all(tg.groups.indices == indices) # Still has original key col names assert tg.groups.keys.dtype.names == ('a',) assert np.all(tg['a'].groups.indices == indices) # remove key column tg = t1.group_by('a') tg.remove_column('a') assert np.all(tg.groups.indices == indices) assert tg.groups.keys.dtype.names == ('a',) assert np.all(tg['b'].groups.indices == indices) # rename key column tg = t1.group_by('a') tg.rename_column('a', 'aa') assert np.all(tg.groups.indices == indices) assert tg.groups.keys.dtype.names == ('a',) assert np.all(tg['aa'].groups.indices == indices) def test_group_by_masked(): t1m = Table(T1, masked=True) t1m['c'].mask[4] = True t1m['d'].mask[5] = True assert t1m.group_by('a').pformat() == [' a b c d ', '--- --- --- ---', ' 0 a -- 4', ' 1 b 3.0 --', ' 1 a 2.0 6', ' 1 a 1.0 7', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 a 4.0 3'] def test_group_by_errors(): """ Appropriate errors get raised. """ # Bad column name as string with pytest.raises(ValueError): T1.group_by('f') # Bad column names in list with pytest.raises(ValueError): T1.group_by(['f', 'g']) # Wrong length array with pytest.raises(ValueError): T1.group_by(np.array([1, 2])) # Wrong type with pytest.raises(TypeError): T1.group_by(None) # Masked key column t1 = Table(T1, masked=True) t1['a'].mask[4] = True with pytest.raises(ValueError): t1.group_by('a') def test_groups_keys_meta(): """ Make sure the keys meta['grouped_by_table_cols'] is working. """ # Group by column in this table tg = T1.group_by('a') assert tg.groups.keys.meta['grouped_by_table_cols'] is True assert tg['c'].groups.keys.meta['grouped_by_table_cols'] is True assert tg.groups[1].groups.keys.meta['grouped_by_table_cols'] is True assert (tg['d'].groups[np.array([False, True, True])] .groups.keys.meta['grouped_by_table_cols'] is True) # Group by external Table tg = T1.group_by(T1['a', 'b']) assert tg.groups.keys.meta['grouped_by_table_cols'] is False assert tg['c'].groups.keys.meta['grouped_by_table_cols'] is False assert tg.groups[1].groups.keys.meta['grouped_by_table_cols'] is False # Group by external numpy array tg = T1.group_by(T1['a', 'b']._data) assert not hasattr(tg.groups.keys, 'meta') assert not hasattr(tg['c'].groups.keys, 'meta') # Group by Column tg = T1.group_by(T1['a']) assert 'grouped_by_table_cols' not in tg.groups.keys.meta assert 'grouped_by_table_cols' not in tg['c'].groups.keys.meta def test_table_aggregate(): """ Aggregate a table """ # Table with only summable cols t1 = T1['a', 'c', 'd'] tg = t1.group_by('a') tga = tg.groups.aggregate(np.sum) assert tga.pformat() == [' a c d ', '--- ---- ---', ' 0 0.0 4', ' 1 6.0 18', ' 2 22.0 6'] # Reverts to default groups assert np.all(tga.groups.indices == np.array([0, 3])) assert tga.groups.keys is None # metadata survives assert tga.meta['ta'] == 1 assert tga['c'].meta['a'] == 1 assert tga['c'].description == 'column c' # Aggregate with np.sum with masked elements. This results # in one group with no elements, hence a nan result and conversion # to float for the 'd' column. t1m = Table(t1, masked=True) t1m['c'].mask[4:6] = True t1m['d'].mask[4:6] = True tg = t1m.group_by('a') with catch_warnings(Warning) as warning_lines: tga = tg.groups.aggregate(np.sum) assert warning_lines[0].category == UserWarning assert "converting a masked element to nan" in str(warning_lines[0].message) assert tga.pformat() == [' a c d ', '--- ---- ----', ' 0 nan nan', ' 1 3.0 13.0', ' 2 22.0 6.0'] # Aggregrate with np.sum with masked elements, but where every # group has at least one remaining (unmasked) element. Then # the int column stays as an int. t1m = Table(t1, masked=True) t1m['c'].mask[5] = True t1m['d'].mask[5] = True tg = t1m.group_by('a') tga = tg.groups.aggregate(np.sum) assert tga.pformat() == [' a c d ', '--- ---- ---', ' 0 0.0 4', ' 1 3.0 13', ' 2 22.0 6'] # Aggregate with a column type that cannot by supplied to the aggregating # function. This raises a warning but still works. tg = T1.group_by('a') with catch_warnings(Warning) as warning_lines: tga = tg.groups.aggregate(np.sum) assert warning_lines[0].category == AstropyUserWarning assert "Cannot aggregate column" in str(warning_lines[0].message) assert tga.pformat() == [' a c d ', '--- ---- ---', ' 0 0.0 4', ' 1 6.0 18', ' 2 22.0 6'] def test_column_aggregate(): """ Aggregate a single table column """ for masked in (False, True): tg = Table(T1, masked=masked).group_by('a') tga = tg['c'].groups.aggregate(np.sum) assert tga.pformat() == [' c ', '----', ' 0.0', ' 6.0', '22.0'] def test_table_filter(): """ Table groups filtering """ def all_positive(table, key_colnames): colnames = [name for name in table.colnames if name not in key_colnames] for colname in colnames: if np.any(table[colname] < 0): return False return True # Negative value in 'a' column should not filter because it is a key col t = Table.read([' a c d', ' -2 7.0 0', ' -2 5.0 1', ' 0 0.0 4', ' 1 3.0 5', ' 1 2.0 -6', ' 1 1.0 7', ' 3 3.0 5', ' 3 -2.0 6', ' 3 1.0 7', ], format='ascii') tg = t.group_by('a') t2 = tg.groups.filter(all_positive) assert t2.groups[0].pformat() == [' a c d ', '--- --- ---', ' -2 7.0 0', ' -2 5.0 1'] assert t2.groups[1].pformat() == [' a c d ', '--- --- ---', ' 0 0.0 4'] def test_column_filter(): """ Table groups filtering """ def all_positive(column): if np.any(column < 0): return False return True # Negative value in 'a' column should not filter because it is a key col t = Table.read([' a c d', ' -2 7.0 0', ' -2 5.0 1', ' 0 0.0 4', ' 1 3.0 5', ' 1 2.0 -6', ' 1 1.0 7', ' 3 3.0 5', ' 3 -2.0 6', ' 3 1.0 7', ], format='ascii') tg = t.group_by('a') c2 = tg['c'].groups.filter(all_positive) assert len(c2.groups) == 3 assert c2.groups[0].pformat() == [' c ', '---', '7.0', '5.0'] assert c2.groups[1].pformat() == [' c ', '---', '0.0'] assert c2.groups[2].pformat() == [' c ', '---', '3.0', '2.0', '1.0'] astropy-0.3/astropy/table/tests/test_np_utils.py0000644000175000017500000000373612243255342020410 0ustar oleoleimport numpy as np from .. import np_utils def test_common_dtype(): """ Test that allowed combinations are those expected. """ dtype = [('int', np.int), ('uint8', np.uint8), ('float32', np.float32), ('float64', np.float64), ('str', 'S2'), ('uni', 'U2'), ('bool', np.bool), ('object', np.object_)] arr = np.empty(1, dtype=dtype) fail = set() succeed = set() for name1, type1 in dtype: for name2, type2 in dtype: try: np_utils.common_dtype([arr[name1], arr[name2]]) succeed.add('{0} {1}'.format(name1, name2)) except np_utils.TableMergeError: fail.add('{0} {1}'.format(name1, name2)) # known bad combinations bad = set(['str int', 'str bool', 'uint8 bool', 'uint8 str', 'object float32', 'bool object', 'uni uint8', 'int str', 'bool str', 'bool float64', 'bool uni', 'str float32', 'uni float64', 'uni object', 'bool uint8', 'object float64', 'float32 bool', 'str uint8', 'uni bool', 'float64 bool', 'float64 object', 'int bool', 'uni int', 'uint8 object', 'int uni', 'uint8 uni', 'float32 uni', 'object uni', 'bool float32', 'uni float32', 'object str', 'int object', 'str float64', 'object int', 'float64 uni', 'bool int', 'object bool', 'object uint8', 'float32 object', 'str object', 'float64 str', 'float32 str']) assert fail == bad good = set(['float64 int', 'int int', 'uint8 float64', 'uint8 int', 'str uni', 'float32 float32', 'float64 float64', 'float64 uint8', 'float64 float32', 'int uint8', 'int float32', 'uni str', 'int float64', 'uint8 float32', 'float32 int', 'float32 uint8', 'bool bool', 'uint8 uint8', 'str str', 'float32 float64', 'object object', 'uni uni']) assert succeed == good astropy-0.3/astropy/table/tests/__init__.py0000644000175000017500000000000012243255342017230 0ustar oleoleastropy-0.3/astropy/table/tests/test_operations.py0000644000175000017500000007113112243255342020730 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from distutils import version import warnings import numpy as np from ...tests.helper import pytest, catch_warnings from ...table import Table from ...utils import OrderedDict, metadata from ...utils.metadata import MergeConflictError from .. import np_utils from ... import table from ... import log def sort_eq(list1, list2): return sorted(list1) == sorted(list2) class TestJoin(): def setup_method(self, method): lines1 = [' a b c ', ' 0 foo L1', ' 1 foo L2', ' 1 bar L3', ' 2 bar L4'] lines2 = [' a b d ', ' 1 foo R1', ' 1 foo R2', ' 2 bar R3', ' 4 bar R4'] self.t1 = Table.read(lines1, format='ascii') self.t2 = Table.read(lines2, format='ascii') self.t3 = Table(self.t2, copy=True) self.t1.meta.update(OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)])) self.t2.meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) self.t3.meta.update(OrderedDict([('b', 3), ('c', [1, 2]), ('d', 2), ('a', 1)])) self.meta_merge = OrderedDict([('b', [1, 2, 3, 4]), ('c', {'a': 1, 'b': 1}), ('d', 1), ('a', 1)]) def test_table_meta_merge(self): out = table.join(self.t1, self.t2, join_type='inner') assert out.meta == self.meta_merge def test_table_meta_merge_conflict(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.join(self.t1, self.t3, join_type='inner') assert len(w) == 3 assert out.meta == self.t3.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.join(self.t1, self.t3, join_type='inner', metadata_conflicts='warn') assert len(w) == 3 assert out.meta == self.t3.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.join(self.t1, self.t3, join_type='inner', metadata_conflicts='silent') assert len(w) == 0 assert out.meta == self.t3.meta with pytest.raises(MergeConflictError): out = table.join(self.t1, self.t3, join_type='inner', metadata_conflicts='error') with pytest.raises(ValueError): out = table.join(self.t1, self.t3, join_type='inner', metadata_conflicts='nonsense') def test_both_unmasked_inner(self): t1 = self.t1 t2 = self.t2 # Basic join with default parameters (inner join on common keys) t12 = table.join(t1, t2) assert t12.masked is False assert sort_eq(t12.pformat(), [' a b c d ', '--- --- --- ---', ' 1 foo L2 R1', ' 1 foo L2 R2', ' 2 bar L4 R3']) # Table meta merged properly assert t12.meta == self.meta_merge def test_both_unmasked_left_right_outer(self): t1 = self.t1 t2 = self.t2 # Left join t12 = table.join(t1, t2, join_type='left') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b c d ', '--- --- --- ---', ' 0 foo L1 --', ' 1 bar L3 --', ' 1 foo L2 R1', ' 1 foo L2 R2', ' 2 bar L4 R3']) # Right join t12 = table.join(t1, t2, join_type='right') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b c d ', '--- --- --- ---', ' 1 foo L2 R1', ' 1 foo L2 R2', ' 2 bar L4 R3', ' 4 bar -- R4']) # Outer join t12 = table.join(t1, t2, join_type='outer') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b c d ', '--- --- --- ---', ' 0 foo L1 --', ' 1 bar L3 --', ' 1 foo L2 R1', ' 1 foo L2 R2', ' 2 bar L4 R3', ' 4 bar -- R4']) # Check that the common keys are 'a', 'b' t12a = table.join(t1, t2, join_type='outer') t12b = table.join(t1, t2, join_type='outer', keys=['a', 'b']) assert np.all(t12a._data == t12b._data) def test_both_unmasked_single_key_inner(self): t1 = self.t1 t2 = self.t2 # Inner join on 'a' column t12 = table.join(t1, t2, keys='a') assert t12.masked is False assert sort_eq(t12.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 1 foo L2 foo R1', ' 1 foo L2 foo R2', ' 1 bar L3 foo R1', ' 1 bar L3 foo R2', ' 2 bar L4 bar R3']) def test_both_unmasked_single_key_left_right_outer(self): t1 = self.t1 t2 = self.t2 # Left join t12 = table.join(t1, t2, join_type='left', keys='a') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 0 foo L1 -- --', ' 1 foo L2 foo R1', ' 1 foo L2 foo R2', ' 1 bar L3 foo R1', ' 1 bar L3 foo R2', ' 2 bar L4 bar R3']) # Right join t12 = table.join(t1, t2, join_type='right', keys='a') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 1 foo L2 foo R1', ' 1 foo L2 foo R2', ' 1 bar L3 foo R1', ' 1 bar L3 foo R2', ' 2 bar L4 bar R3', ' 4 -- -- bar R4']) # Outer join t12 = table.join(t1, t2, join_type='outer', keys='a') assert t12.masked is True assert sort_eq(t12.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 0 foo L1 -- --', ' 1 foo L2 foo R1', ' 1 foo L2 foo R2', ' 1 bar L3 foo R1', ' 1 bar L3 foo R2', ' 2 bar L4 bar R3', ' 4 -- -- bar R4']) def test_masked_unmasked(self): t1 = self.t1 t1m = Table(self.t1, masked=True) t2 = self.t2 # Result should be masked even though not req'd by inner join t1m2 = table.join(t1m, t2, join_type='inner') assert t1m2.masked is True # Result should match non-masked result t12 = table.join(t1, t2) assert np.all(t12._data == np.array(t1m2._data)) # Mask out some values in left table and make sure they propagate t1m['b'].mask[1] = True t1m['c'].mask[2] = True t1m2 = table.join(t1m, t2, join_type='inner', keys='a') assert sort_eq(t1m2.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 1 -- L2 foo R1', ' 1 -- L2 foo R2', ' 1 bar -- foo R1', ' 1 bar -- foo R2', ' 2 bar L4 bar R3']) t21m = table.join(t2, t1m, join_type='inner', keys='a') assert sort_eq(t21m.pformat(), [' a b_1 d b_2 c ', '--- --- --- --- ---', ' 1 foo R2 -- L2', ' 1 foo R2 bar --', ' 1 foo R1 -- L2', ' 1 foo R1 bar --', ' 2 bar R3 bar L4']) def test_masked_masked(self): """Two masked tables""" t1 = self.t1 t1m = Table(self.t1, masked=True) t2 = self.t2 t2m = Table(self.t2, masked=True) # Result should be masked even though not req'd by inner join t1m2m = table.join(t1m, t2m, join_type='inner') assert t1m2m.masked is True # Result should match non-masked result t12 = table.join(t1, t2) assert np.all(t12._data == np.array(t1m2m._data)) # Mask out some values in both tables and make sure they propagate t1m['b'].mask[1] = True t1m['c'].mask[2] = True t2m['d'].mask[2] = True t1m2m = table.join(t1m, t2m, join_type='inner', keys='a') assert sort_eq(t1m2m.pformat(), [' a b_1 c b_2 d ', '--- --- --- --- ---', ' 1 -- L2 foo R1', ' 1 -- L2 foo R2', ' 1 bar -- foo R1', ' 1 bar -- foo R2', ' 2 bar L4 bar --']) def test_col_rename(self): """ Test auto col renaming when there is a conflict. Use non-default values of uniq_col_name and table_names. """ t1 = self.t1 t2 = self.t2 t12 = table.join(t1, t2, uniq_col_name='x_{table_name}_{col_name}_y', table_names=['L', 'R'], keys='a') assert t12.colnames == ['a', 'x_L_b_y', 'c', 'x_R_b_y', 'd'] def test_rename_conflict(self): """ Test that auto-column rename fails because of a conflict with an existing column """ t1 = self.t1 t2 = self.t2 t1['b_1'] = 1 # Add a new column b_1 that will conflict with auto-rename with pytest.raises(np_utils.TableMergeError): table.join(t1, t2, keys='a') def test_missing_keys(self): """Merge on a key column that doesn't exist""" t1 = self.t1 t2 = self.t2 with pytest.raises(np_utils.TableMergeError): table.join(t1, t2, keys=['a', 'not there']) def test_bad_join_type(self): """Bad join_type input""" t1 = self.t1 t2 = self.t2 with pytest.raises(ValueError): table.join(t1, t2, join_type='illegal value') def test_no_common_keys(self): """Merge tables with no common keys""" t1 = self.t1 t2 = self.t2 del t1['a'] del t1['b'] del t2['a'] del t2['b'] with pytest.raises(np_utils.TableMergeError): table.join(t1, t2) def test_masked_key_column(self): """Merge on a key column that has a masked element""" t1 = self.t1 t2 = Table(self.t2, masked=True) table.join(t1, t2) # OK t2['a'].mask[0] = True with pytest.raises(np_utils.TableMergeError): table.join(t1, t2) def test_col_meta_merge(self): t1 = self.t1 t2 = self.t2 t2.rename_column('d', 'c') # force col conflict and renaming meta1 = OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)]) meta2 = OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)]) # Key col 'a', should first value ('cm') t1['a'].unit = 'cm' t2['a'].unit = 'm' # Key col 'b', take first value 't1_b' t1['b'].description = 't1_b' # Key col 'b', take first non-empty value 't1_b' t2['b'].format = '%6s' # Key col 'a', should be merged meta t1['a'].meta = meta1 t2['a'].meta = meta2 # Key col 'b', should be meta2 t2['b'].meta = meta2 # All these should pass through t1['c'].unit = 'cm' t1['c'].format = '%3s' t1['c'].description = 't1_c' t2['c'].unit = 'm' t2['c'].format = '%6s' t2['c'].description = 't2_c' with catch_warnings(metadata.MergeConflictWarning) as warning_lines: t12 = table.join(t1, t2, keys=['a', 'b']) assert t12['a'].unit == 'm' assert t12['b'].description == 't1_b' assert t12['b'].format == '%6s' assert t12['a'].meta == self.meta_merge assert t12['b'].meta == meta2 assert t12['c_1'].unit == 'cm' assert t12['c_1'].format == '%3s' assert t12['c_1'].description == 't1_c' assert t12['c_2'].unit == 'm' assert t12['c_2'].format == '%6s' assert t12['c_2'].description == 't2_c' assert warning_lines[0].category == metadata.MergeConflictWarning assert ("In merged column 'a' the 'unit' attribute does not match (cm != m)" in str(warning_lines[0].message)) class TestVStack(): def setup_method(self, method): self.t1 = Table.read([' a b', ' 0 foo', ' 1 bar'], format='ascii') self.t2 = Table.read([' a b c', ' 2 pez 4', ' 3 sez 5'], format='ascii') self.t3 = Table.read([' a b', ' 4 7', ' 5 8', ' 6 9'], format='ascii') self.t4 = Table(self.t1, copy=True, masked=True) # The following table has meta-data that conflicts with t1 self.t5 = Table(self.t1, copy=True) self.t1.meta.update(OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)])) self.t2.meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) self.t4.meta.update(OrderedDict([('b', [5, 6]), ('c', {'c': 1}), ('e', 1)])) self.t5.meta.update(OrderedDict([('b', 3), ('c', 'k'), ('d', 1)])) self.meta_merge = OrderedDict([('b', [1, 2, 3, 4, 5, 6]), ('c', {'a': 1, 'b': 1, 'c': 1}), ('d', 1), ('a', 1), ('e', 1)]) def test_stack_rows(self): t2 = self.t1.copy() t2.meta.clear() out = table.vstack([self.t1, t2[1]]) assert out.pformat() == [' a b ', '--- ---', ' 0 foo', ' 1 bar', ' 1 bar'] def test_table_meta_merge(self): out = table.vstack([self.t1, self.t2, self.t4], join_type='inner') assert out.meta == self.meta_merge def test_table_meta_merge_conflict(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.vstack([self.t1, self.t5], join_type='inner') assert len(w) == 2 assert out.meta == self.t5.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.vstack([self.t1, self.t5], join_type='inner', metadata_conflicts='warn') assert len(w) == 2 assert out.meta == self.t5.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.vstack([self.t1, self.t5], join_type='inner', metadata_conflicts='silent') assert len(w) == 0 assert out.meta == self.t5.meta with pytest.raises(MergeConflictError): out = table.vstack([self.t1, self.t5], join_type='inner', metadata_conflicts='error') with pytest.raises(ValueError): out = table.vstack([self.t1, self.t5], join_type='inner', metadata_conflicts='nonsense') def test_bad_input_type(self): with pytest.raises(TypeError): table.vstack(1) with pytest.raises(TypeError): table.vstack([self.t2, 1]) with pytest.raises(ValueError): table.vstack([self.t1, self.t2], join_type='invalid join type') def test_stack_basic(self): t1 = self.t1 t2 = self.t2 t4 = self.t4 t12 = table.vstack([t1, t2], join_type='inner') assert t12.masked is False assert t12.pformat() == [' a b ', '--- ---', ' 0 foo', ' 1 bar', ' 2 pez', ' 3 sez'] t12 = table.vstack([t1, t2], join_type='outer') assert t12.pformat() == [' a b c ', '--- --- ---', ' 0 foo --', ' 1 bar --', ' 2 pez 4', ' 3 sez 5'] t124 = table.vstack([t1, t2, t4], join_type='outer') assert t124.pformat() == [' a b c ', '--- --- ---', ' 0 foo --', ' 1 bar --', ' 2 pez 4', ' 3 sez 5', ' 0 foo --', ' 1 bar --'] t124 = table.vstack([t1, t2, t4], join_type='inner') assert t124.pformat() == [' a b ', '--- ---', ' 0 foo', ' 1 bar', ' 2 pez', ' 3 sez', ' 0 foo', ' 1 bar'] def test_stack_incompatible(self): with pytest.raises(np_utils.TableMergeError): table.vstack([self.t1, self.t3], join_type='inner') with pytest.raises(np_utils.TableMergeError): table.vstack([self.t1, self.t2], join_type='exact') def test_vstack_one_masked(self): t1 = self.t1 t4 = self.t4 t4['b'].mask[1] = True assert table.vstack([t1, t4]).pformat() == [' a b ', '--- ---', ' 0 foo', ' 1 bar', ' 0 foo', ' 1 --'] def test_col_meta_merge(self): t1 = self.t1 t2 = self.t2 t4 = self.t4 # Key col 'a', should last value ('km') t1['a'].unit = 'cm' t2['a'].unit = 'm' t4['a'].unit = 'km' # Key col 'a' format should take last when all match t1['a'].format = '%0d' t2['a'].format = '%0d' t4['a'].format = '%0d' # Key col 'b', take first value 't1_b' t1['b'].description = 't1_b' # Key col 'b', take first non-empty value '%6s' t4['b'].format = '%6s' # Key col 'a', should be merged meta t1['a'].meta.update(OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)])) t2['a'].meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) t4['a'].meta.update(OrderedDict([('b', [5, 6]), ('c', {'c': 1}), ('e', 1)])) # Key col 'b', should be meta2 t2['b'].meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) # All these should pass through t2['c'].unit = 'm' t2['c'].format = '%6s' t2['c'].description = 't2_c' with catch_warnings(metadata.MergeConflictWarning) as warning_lines: out = table.vstack([t1, t2, t4], join_type='outer') assert out['a'].unit == 'km' assert out['a'].format == '%0d' assert out['b'].description == 't1_b' assert out['b'].format == '%6s' assert out['a'].meta == self.meta_merge assert out['b'].meta == OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)]) assert out['c'].unit == 'm' assert out['c'].format == '%6s' assert out['c'].description == 't2_c' assert warning_lines[0].category == metadata.MergeConflictWarning assert ("In merged column 'a' the 'unit' attribute does not match (cm != m)" in str(warning_lines[0].message)) assert warning_lines[1].category == metadata.MergeConflictWarning assert ("In merged column 'a' the 'unit' attribute does not match (m != km)" in str(warning_lines[1].message)) class TestHStack(): def setup_method(self, method): self.t1 = Table.read([' a b', ' 0 foo', ' 1 bar'], format='ascii') self.t2 = Table.read([' a b c', ' 2 pez 4', ' 3 sez 5'], format='ascii') self.t3 = Table.read([' d e', ' 4 7', ' 5 8', ' 6 9'], format='ascii') self.t4 = Table(self.t1, copy=True, masked=True) self.t4['a'].name = 'f' self.t4['b'].name = 'g' # The following table has meta-data that conflicts with t1 self.t5 = Table(self.t1, copy=True) self.t1.meta.update(OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)])) self.t2.meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) self.t4.meta.update(OrderedDict([('b', [5, 6]), ('c', {'c': 1}), ('e', 1)])) self.t5.meta.update(OrderedDict([('b', 3), ('c', 'k'), ('d', 1)])) self.meta_merge = OrderedDict([('b', [1, 2, 3, 4, 5, 6]), ('c', {'a': 1, 'b': 1, 'c': 1}), ('d', 1), ('a', 1), ('e', 1)]) def test_stack_rows(self): out = table.hstack([self.t1[0], self.t2[1]]) assert out.pformat() == ['a_1 b_1 a_2 b_2 c ', '--- --- --- --- ---', ' 0 foo 3 sez 5'] def test_table_meta_merge(self): out = table.hstack([self.t1, self.t2, self.t4], join_type='inner') assert out.meta == self.meta_merge def test_table_meta_merge_conflict(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.hstack([self.t1, self.t5], join_type='inner') assert len(w) == 2 assert out.meta == self.t5.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.hstack([self.t1, self.t5], join_type='inner', metadata_conflicts='warn') assert len(w) == 2 assert out.meta == self.t5.meta with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") out = table.hstack([self.t1, self.t5], join_type='inner', metadata_conflicts='silent') assert len(w) == 0 assert out.meta == self.t5.meta with pytest.raises(MergeConflictError): out = table.hstack([self.t1, self.t5], join_type='inner', metadata_conflicts='error') with pytest.raises(ValueError): out = table.hstack([self.t1, self.t5], join_type='inner', metadata_conflicts='nonsense') def test_bad_input_type(self): with pytest.raises(TypeError): table.hstack(1) with pytest.raises(TypeError): table.hstack([self.t2, 1]) with pytest.raises(ValueError): table.hstack([self.t1, self.t2], join_type='invalid join type') def test_stack_basic(self): t1 = self.t1 t2 = self.t2 t3 = self.t3 t4 = self.t4 out = table.hstack([t1, t2], join_type='inner') assert out.masked is False assert out.pformat() == ['a_1 b_1 a_2 b_2 c ', '--- --- --- --- ---', ' 0 foo 2 pez 4', ' 1 bar 3 sez 5'] # stacking as a list gives same result out_list = table.hstack([t1, t2], join_type='inner') assert out.pformat() == out_list.pformat() out = table.hstack([t1, t2], join_type='outer') assert out.pformat() == out_list.pformat() out = table.hstack([t1, t2, t3, t4], join_type='outer') assert out.pformat() == ['a_1 b_1 a_2 b_2 c d e f g ', '--- --- --- --- --- --- --- --- ---', ' 0 foo 2 pez 4 4 7 0 foo', ' 1 bar 3 sez 5 5 8 1 bar', ' -- -- -- -- -- 6 9 -- --'] out = table.hstack([t1, t2, t3, t4], join_type='inner') assert out.pformat() == ['a_1 b_1 a_2 b_2 c d e f g ', '--- --- --- --- --- --- --- --- ---', ' 0 foo 2 pez 4 4 7 0 foo', ' 1 bar 3 sez 5 5 8 1 bar'] def test_stack_incompatible(self): # For join_type exact, which will fail here because n_rows # does not match with pytest.raises(np_utils.TableMergeError): table.hstack([self.t1, self.t3], join_type='exact') def test_hstack_one_masked(self): t1 = self.t1 t2 = Table(t1, copy=True, masked=True) t2.meta.clear() t2['b'].mask[1] = True assert table.hstack([t1, t2]).pformat() == ['a_1 b_1 a_2 b_2', '--- --- --- ---', ' 0 foo 0 foo', ' 1 bar 1 --'] def test_table_col_rename(self): out = table.hstack([self.t1, self.t2], join_type='inner', uniq_col_name='{table_name}_{col_name}', table_names=('left', 'right')) assert out.masked is False assert out.pformat() == ['left_a left_b right_a right_b c ', '------ ------ ------- ------- ---', ' 0 foo 2 pez 4', ' 1 bar 3 sez 5'] def test_col_meta_merge(self): t1 = self.t1 t3 = self.t3 t4 = self.t4 # Just set a bunch of meta and make sure it is the same in output meta1 = OrderedDict([('b', [1, 2]), ('c', {'a': 1}), ('d', 1)]) t1['a'].unit = 'cm' t1['b'].description = 't1_b' t4['f'].format = '%6s' t1['b'].meta.update(meta1) t3['d'].meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) t4['g'].meta.update(OrderedDict([('b', [5, 6]), ('c', {'c': 1}), ('e', 1)])) t3['e'].meta.update(OrderedDict([('b', [3, 4]), ('c', {'b': 1}), ('a', 1)])) t3['d'].unit = 'm' t3['d'].format = '%6s' t3['d'].description = 't3_c' with catch_warnings(metadata.MergeConflictWarning) as warning_lines: out = table.vstack([t1, t3, t4], join_type='outer') for t in [t1, t3, t4]: for name in t.colnames: for attr in ('meta', 'unit', 'format', 'description'): assert getattr(out[name], attr) == getattr(t[name], attr) assert len(warning_lines) == 0 # Make sure we got a copy of meta, not ref t1['b'].meta['b'] = None assert out['b'].meta['b'] == [1, 2] astropy-0.3/astropy/table/tests/test_masked.py0000644000175000017500000003422012243255342020007 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test behavior related to masked tables""" from distutils import version import numpy as np import numpy.ma as ma from ...tests.helper import pytest from ...table import Column, MaskedColumn, Table class SubclassTable(Table): pass @pytest.fixture(params = [True, False]) def tableclass(request): return Table if request.param else SubclassTable class SetupData(object): def setup_method(self, method): self.a = MaskedColumn(name='a', data=[1, 2, 3], fill_value=1) self.b = MaskedColumn(name='b', data=[4, 5, 6], mask=True) self.c = MaskedColumn(name='c', data=[7, 8, 9], mask=False) self.d_mask = np.array([False, True, False]) self.d = MaskedColumn(name='d', data=[7, 8, 7], mask=self.d_mask) self.t = Table([self.a, self.b], masked=True) self.ca = Column(name='ca', data=[1, 2, 3]) class TestPprint(SetupData): def test_pformat(self): assert self.t.pformat() == [' a b ', '--- ---', ' 1 --', ' 2 --', ' 3 --'] class TestFilled(object): """Test the filled method in MaskedColumn and Table""" def setup_method(self, method): mask = [True, False, False] self.meta = {'a': 1, 'b': [2, 3]} a = self.a = MaskedColumn(name='a', data=[1, 2, 3], fill_value=10, mask=mask, meta={'a': 1}) b = self.b = MaskedColumn(name='b', data=[4.0, 5.0, 6.0], fill_value=10.0, mask=mask) c = self.c = MaskedColumn(name='c', data=['7', '8', '9'], fill_value='1', mask=mask) def test_filled_column(self): f = self.a.filled() assert np.all(f == [10, 2, 3]) assert isinstance(f, Column) assert not isinstance(f, MaskedColumn) # Confirm copy, not ref assert f.meta['a'] == 1 f.meta['a'] = 2 f[1] = 100 assert self.a[1] == 2 assert self.a.meta['a'] == 1 # Fill with arg fill_value not column fill_value f = self.a.filled(20) assert np.all(f == [20, 2, 3]) f = self.b.filled() assert np.all(f == [10.0, 5.0, 6.0]) assert isinstance(f, Column) f = self.c.filled() assert np.all(f == ['1', '8', '9']) assert isinstance(f, Column) def test_filled_masked_table(self, tableclass): t = tableclass([self.a, self.b, self.c], meta=self.meta) f = t.filled() assert isinstance(f, Table) assert f.masked is False assert np.all(f['a'] == [10, 2, 3]) assert np.allclose(f['b'], [10.0, 5.0, 6.0]) assert np.all(f['c'] == ['1', '8', '9']) # Confirm copy, not ref assert f.meta['b'] == [2, 3] f.meta['b'][0] = 20 assert t.meta['b'] == [2, 3] f['a'][2] = 100 assert t['a'][2] == 3 def test_filled_unmasked_table(self, tableclass): t = tableclass([(1, 2), ('3', '4')], names=('a', 'b'), meta=self.meta) f = t.filled() assert isinstance(f, Table) assert f.masked is False assert np.all(f['a'] == t['a']) assert np.all(f['b'] == t['b']) # Confirm copy, not ref assert f.meta['b'] == [2, 3] f.meta['b'][0] = 20 assert t.meta['b'] == [2, 3] f['a'][1] = 100 assert t['a'][1] == 2 class TestFillValue(SetupData): """Test setting and getting fill value in MaskedColumn and Table""" def test_init_set_fill_value(self): """Check that setting fill_value in the MaskedColumn init works""" assert self.a.fill_value == 1 c = MaskedColumn(name='c', data=['xxxx', 'yyyy'], fill_value='none') assert c.fill_value == 'none' def test_set_get_fill_value_for_bare_column(self): """Check set and get of fill value works for bare Column""" self.d.fill_value = -999 assert self.d.fill_value == -999 assert np.all(self.d.filled() == [7, -999, 7]) def test_set_get_fill_value_for_str_column(self): c = MaskedColumn(name='c', data=['xxxx', 'yyyy'], mask=[True, False]) # assert np.all(c.filled() == ['N/A', 'yyyy']) c.fill_value = 'ABCDEF' assert c.fill_value == 'ABCD' # string truncated to dtype length assert np.all(c.filled() == ['ABCD', 'yyyy']) assert np.all(c.filled('XY') == ['XY', 'yyyy']) def test_table_column_mask_not_ref(self): """Table column mask is not ref of original column mask""" self.b.fill_value = -999 assert self.t['b'].fill_value != -999 def test_set_get_fill_value_for_table_column(self): """Check set and get of fill value works for Column in a Table""" self.t['b'].fill_value = 1 assert self.t['b'].fill_value == 1 assert np.all(self.t['b'].filled() == [1, 1, 1]) assert self.t._data['b'].fill_value == 1 def test_data_attribute_fill_and_mask(self): """Check that .data attribute preserves fill_value and mask""" self.t['b'].fill_value = 1 self.t['b'].mask = [True, False, True] assert self.t['b'].data.fill_value == 1 assert np.all(self.t['b'].data.mask == [True, False, True]) class TestMaskedColumnInit(SetupData): """Initialization of a masked column""" def test_set_mask_and_not_ref(self): """Check that mask gets set properly and that it is a copy, not ref""" assert np.all(~self.a.mask) assert np.all(self.b.mask) assert np.all(~self.c.mask) assert np.all(self.d.mask == self.d_mask) self.d.mask[0] = True assert not np.all(self.d.mask == self.d_mask) def test_set_mask_from_list(self): """Set mask from a list""" mask_list = [False, True, False] a = MaskedColumn(name='a', data=[1, 2, 3], mask=mask_list) assert np.all(a.mask == mask_list) def test_override_existing_mask(self): """Override existing mask values""" mask_list = [False, True, False] b = MaskedColumn(name='b', data=self.b, mask=mask_list) assert np.all(b.mask == mask_list) def test_incomplete_mask_spec(self): """Incomplete mask specification (mask values cycle through available)""" mask_list = [False, True] b = MaskedColumn(name='b', length=4, mask=mask_list) assert np.all(b.mask == mask_list + mask_list) class TestTableInit(SetupData): """Initializing a table""" def test_mask_true_if_any_input_masked(self): """Masking is True if any input is masked""" t = Table([self.ca, self.a]) assert t.masked is True t = Table([self.ca]) assert t.masked is False t = Table([self.ca, ma.array([1, 2, 3])]) assert t.masked is True def test_mask_property(self): t = self.t # Access table mask (boolean structured array) by column name assert np.all(t.mask['a'] == np.array([False, False, False])) assert np.all(t.mask['b'] == np.array([True, True, True])) # Check that setting mask from table mask has the desired effect on column t.mask['b'] = np.array([False, True, False]) assert np.all(t['b'].mask == np.array([False, True, False])) # Non-masked table returns None for mask attribute t2 = Table([self.ca], masked=False) assert t2.mask is None # Set mask property globally and verify local correctness for mask in (True, False): t.mask = mask for name in ('a', 'b'): assert np.all(t[name].mask == mask) class TestAddColumn(object): def test_add_masked_column_to_masked_table(self): t = Table(masked=True) assert t.masked t.add_column(MaskedColumn(name='a', data=[1, 2, 3], mask=[0, 1, 0])) assert t.masked t.add_column(MaskedColumn(name='b', data=[4, 5, 6], mask=[1, 0, 1])) assert t.masked assert np.all(t['a'] == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 1, 0], bool)) assert np.all(t['b'] == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_masked_column_to_non_masked_table(self): t = Table(masked=False) assert not t.masked t.add_column(Column(name='a', data=[1, 2, 3])) assert not t.masked t.add_column(MaskedColumn(name='b', data=[4, 5, 6], mask=[1, 0, 1])) assert t.masked assert np.all(t['a'] == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 0, 0], bool)) assert np.all(t['b'] == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_non_masked_column_to_masked_table(self): t = Table(masked=True) assert t.masked t.add_column(Column(name='a', data=[1, 2, 3])) assert t.masked t.add_column(MaskedColumn(name='b', data=[4, 5, 6], mask=[1, 0, 1])) assert t.masked assert np.all(t['a'] == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 0, 0], bool)) assert np.all(t['b'] == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) class TestRenameColumn(object): def test_rename_masked_column(self): t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1,2,3], mask=[0,1,0])) t['a'].fill_value = 42 t.rename_column('a', 'b') assert t.masked assert np.all(t['b'] == np.array([1,2,3])) assert np.all(t['b'].mask == np.array([0,1,0], bool)) assert t['b'].fill_value == 42 assert t.colnames == ['b'] class TestRemoveColumn(object): def test_remove_masked_column(self): t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1,2,3], mask=[0,1,0])) t['a'].fill_value = 42 t.add_column(MaskedColumn(name='b', data=[4,5,6], mask=[1,0,1])) t.remove_column('b') assert t.masked assert np.all(t['a'] == np.array([1,2,3])) assert np.all(t['a'].mask == np.array([0,1,0], bool)) assert t['a'].fill_value == 42 assert t.colnames == ['a'] class TestAddRow(object): def test_add_masked_row_to_masked_table_iterable(self): t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) t.add_row([2, 5], mask=[1, 0]) t.add_row([3, 6], mask=[0, 1]) assert t.masked assert np.all(np.array(t['a']) == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 1, 0], bool)) assert np.all(np.array(t['b']) == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_masked_row_to_masked_table_mapping1(self): t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) t.add_row({'b': 5, 'a': 2}, mask={'a': 1, 'b': 0}) t.add_row({'a': 3, 'b': 6}, mask={'b': 1, 'a': 0}) assert t.masked assert np.all(np.array(t['a']) == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 1, 0], bool)) assert np.all(np.array(t['b']) == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_masked_row_to_masked_table_mapping2(self): # When adding values to a masked table, if the mask is specified as a # dict, then values not specified will have mask values set to True t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) t.add_row({'b': 5}, mask={'b': 0}) t.add_row({'a': 3}, mask={'a': 0}) assert t.masked assert t['a'][0] == 1 and t['a'][2] == 3 assert np.all(t['a'].mask == np.array([0, 1, 0], bool)) assert t['b'][1] == 5 assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_masked_row_to_masked_table_mapping3(self): # When adding values to a masked table, if mask is not passed to # add_row, then the mask should be set to False if values are present # and True if not. t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) t.add_row({'b': 5}) t.add_row({'a': 3}) assert t.masked assert t['a'][0] == 1 and t['a'][2] == 3 assert np.all(t['a'].mask == np.array([0, 1, 0], bool)) assert t['b'][1] == 5 assert np.all(t['b'].mask == np.array([1, 0, 1], bool)) def test_add_masked_row_to_masked_table_mapping4(self): # When adding values to a masked table, if the mask is specified as a # dict, then keys in values should match keys in mask t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) with pytest.raises(ValueError) as exc: t.add_row({'b': 5}, mask={'a': True}) assert exc.value.args[0] == 'keys in mask should match keys in vals' def test_add_masked_row_to_masked_table_mismatch(self): t = Table(masked=True) t.add_column(MaskedColumn(name='a', data=[1], mask=[0])) t.add_column(MaskedColumn(name='b', data=[4], mask=[1])) with pytest.raises(TypeError) as exc: t.add_row([2, 5], mask={'a': 1, 'b': 0}) assert exc.value.args[0] == "Mismatch between type of vals and mask" with pytest.raises(TypeError) as exc: t.add_row({'b': 5, 'a': 2}, mask=[1, 0]) assert exc.value.args[0] == "Mismatch between type of vals and mask" def test_add_masked_row_to_non_masked_table_iterable(self): t = Table(masked=False) t.add_column(Column(name='a', data=[1])) t.add_column(Column(name='b', data=[4])) assert not t.masked t.add_row([2, 5]) assert not t.masked t.add_row([3, 6], mask=[0, 1]) assert t.masked assert np.all(np.array(t['a']) == np.array([1, 2, 3])) assert np.all(t['a'].mask == np.array([0, 0, 0], bool)) assert np.all(np.array(t['b']) == np.array([4, 5, 6])) assert np.all(t['b'].mask == np.array([0, 0, 1], bool)) astropy-0.3/astropy/table/tests/test_item_access.py0000644000175000017500000002111712243255342021023 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Verify item access API in: https://github.com/astropy/astropy/wiki/Table-item-access-definition """ from distutils import version import numpy as np from ...tests.helper import pytest from ... import table class MaskedTable(table.Table): def __init__(self, *args, **kwargs): kwargs['masked'] = True table.Table.__init__(self, *args, **kwargs) # Fixture to run all the Column tests for both an unmasked (ndarray) # and masked (MaskedArray) column. @pytest.fixture(params=[False, True]) def table_data(request): class TableData: def __init__(self, request): self.Table = MaskedTable if request.param else table.Table self.Column = table.MaskedColumn if request.param else table.Column self.COLS = [ self.Column(name='a', data=[1, 2, 3], description='da', format='fa', meta={'ma': 1}, unit='ua'), self.Column(name='b', data=[4, 5, 6], description='db', format='fb', meta={'mb': 1}, unit='ub'), self.Column(name='c', data=[7, 8, 9], description='dc', format='fc', meta={'mc': 1}, unit='ub')] self.DATA = self.Table(self.COLS) return TableData(request) @pytest.mark.usefixtures('table_data') class BaseTestItems(): pass @pytest.mark.usefixtures('table_data') class TestTableColumnsItems(BaseTestItems): def test_by_name(self, table_data): """Access TableColumns by name and show that item access returns a Column that refers to underlying table data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns assert self.tc['a'].name == 'a' assert self.tc['a'][1] == 2 assert self.tc['a'].description == 'da' assert self.tc['a'].format == 'fa' assert self.tc['a'].meta == {'ma': 1} assert self.tc['a'].unit == 'ua' assert self.tc['a'].attrs_equal(table_data.COLS[0]) assert isinstance(self.tc['a'], table_data.Column) self.tc['b'][1] = 0 assert self.t['b'][1] == 0 def test_by_position(self, table_data): """Access TableColumns by position and show that item access returns a Column that refers to underlying table data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns assert self.tc[1].name == 'b' assert np.all(self.tc[1].data == table_data.COLS[1].data) assert self.tc[1].description == 'db' assert self.tc[1].format == 'fb' assert self.tc[1].meta == {'mb': 1} assert self.tc[1].unit == 'ub' assert self.tc[1].attrs_equal(table_data.COLS[1]) assert isinstance(self.tc[1], table_data.Column) assert self.tc[2].unit == 'ub' self.tc[1][1] = 0 assert self.t['b'][1] == 0 def test_mult_columns(self, table_data): """Access TableColumns with "fancy indexing" and showed that returned TableColumns object still references original data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns tc2 = self.tc['b', 'c'] assert tc2[1].name == 'c' assert tc2[1][1] == 8 assert tc2[0].name == 'b' assert tc2[0][1] == 5 tc2['c'][1] = 0 assert self.tc['c'][1] == 0 assert self.t['c'][1] == 0 def test_column_slice(self, table_data): """Access TableColumns with slice and showed that returned TableColumns object still references original data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns tc2 = self.tc[1:3] assert tc2[1].name == 'c' assert tc2[1][1] == 8 assert tc2[0].name == 'b' assert tc2[0][1] == 5 tc2['c'][1] = 0 assert self.tc['c'][1] == 0 assert self.t['c'][1] == 0 @pytest.mark.usefixtures('table_data') class TestTableItems(BaseTestItems): def test_column(self, table_data): """Column access returns REFERENCE to data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns a = self.t['a'] assert a[1] == 2 a[1] = 0 assert self.t['a'][1] == 0 def test_row(self, table_data): """Row access returns REFERENCE to data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns row = self.t[1] assert row['a'] == 2 assert row[1] == 5 assert row.columns['a'].attrs_equal(table_data.COLS[0]) assert row.columns['b'].attrs_equal(table_data.COLS[1]) assert row.columns['c'].attrs_equal(table_data.COLS[2]) row[1] = 0 assert row[1] == 0 if table_data.Table is not MaskedTable: # numpy.core.ma.mvoid makes a copy so this test is skipped for masked table assert self.t['b'][1] == 0 def test_table_slice(self, table_data): """Table slice returns REFERENCE to data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns t2 = self.t[1:3] assert np.all(t2['a'] == table_data.DATA['a'][1:3]) assert t2['a'].attrs_equal(table_data.COLS[0]) assert t2['b'].attrs_equal(table_data.COLS[1]) assert t2['c'].attrs_equal(table_data.COLS[2]) t2['a'][0] = 0 assert np.all(self.t['a'] == np.array([1, 0, 3])) assert t2.masked == self.t.masked assert t2._column_class == self.t._column_class assert isinstance(t2, table_data.Table) def test_fancy_index_slice(self, table_data): """Table fancy slice returns COPY of data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns slice = np.array([0, 2]) t2 = self.t[slice] assert np.all(t2['a'] == table_data.DATA['a'][slice]) assert t2['a'].attrs_equal(table_data.COLS[0]) assert t2['b'].attrs_equal(table_data.COLS[1]) assert t2['c'].attrs_equal(table_data.COLS[2]) t2['a'][0] = 0 assert np.all(self.t._data == table_data.DATA) assert np.any(t2['a'] != table_data.DATA['a'][slice]) assert t2.masked == self.t.masked assert t2._column_class == self.t._column_class assert isinstance(t2, table_data.Table) def test_list_index_slice(self, table_data): """Table list index slice returns COPY of data""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns slice = [0, 2] t2 = self.t[slice] assert np.all(t2['a'] == table_data.DATA['a'][slice]) assert t2['a'].attrs_equal(table_data.COLS[0]) assert t2['b'].attrs_equal(table_data.COLS[1]) assert t2['c'].attrs_equal(table_data.COLS[2]) t2['a'][0] = 0 assert np.all(self.t._data == table_data.DATA) assert np.any(t2['a'] != table_data.DATA['a'][slice]) assert t2.masked == self.t.masked assert t2._column_class == self.t._column_class assert isinstance(t2, table_data.Table) def test_select_columns(self, table_data): """Select columns returns COPY of data and all column attributes""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns # try both lists and tuples for columns in (('a', 'c'), ['a', 'c']): t2 = self.t[columns] assert np.all(t2['a'] == table_data.DATA['a']) assert np.all(t2['c'] == table_data.DATA['c']) assert t2['a'].attrs_equal(table_data.COLS[0]) assert t2['c'].attrs_equal(table_data.COLS[2]) t2['a'][0] = 0 assert np.all(self.t._data == table_data.DATA) assert np.any(t2['a'] != table_data.DATA['a']) assert t2.masked == self.t.masked assert t2._column_class == self.t._column_class def test_np_where(self, table_data): """Select rows using output of np.where""" t = table_data.Table(table_data.COLS) # Select last two rows rows = np.where(t['a'] > 1.5) t2 = t[rows] assert np.all(t2['a'] == [2, 3]) assert np.all(t2['b'] == [5, 6]) assert isinstance(t2, table_data.Table) # Select no rows rows = np.where(t['a'] > 100) t2 = t[rows] assert len(t2) == 0 assert isinstance(t2, table_data.Table) def test_select_bad_column(self, table_data): """Select column name that does not exist""" self.t = table_data.Table(table_data.COLS) self.tc = self.t.columns with pytest.raises(ValueError): self.t['a', 1] astropy-0.3/astropy/table/tests/test_row.py0000644000175000017500000001332112243255342017351 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from distutils import version import numpy as np from ...tests.helper import pytest, catch_warnings from ... import table from ...table import Row from ...utils.exceptions import AstropyDeprecationWarning numpy_lt_1p8 = version.LooseVersion(np.__version__) < version.LooseVersion('1.8') class MaskedTable(table.Table): def __init__(self, *args, **kwargs): kwargs['masked'] = True table.Table.__init__(self, *args, **kwargs) def test_masked_row_with_object_col(): """ Numpy < 1.8 has a bug in masked array that prevents access a row if there is a column with object type. """ t = table.Table([[1]], dtypes=['O'], masked=True) if numpy_lt_1p8: with pytest.raises(ValueError): t['col0'].mask = False t[0] with pytest.raises(ValueError): t['col0'].mask = True t[0] else: t['col0'].mask = False assert t[0]['col0'] == 1 t['col0'].mask = True assert t[0]['col0'] is np.ma.masked # Fixture to run all tests for both an unmasked (ndarray) and masked (MaskedArray) column. @pytest.fixture(params=[False, True]) def table_types(request): class TableTypes: def __init__(self, request): self.Table = MaskedTable if request.param else table.Table self.Column = table.MaskedColumn if request.param else table.Column return TableTypes(request) @pytest.mark.usefixtures('table_types') class TestRow(): def _setup(self, table_types): self._table_type = table_types.Table self._column_type = table_types.Column @property def t(self): # py.test wants to run this method once before table_types is run # to set Table and Column. In this case just return None, which would # cause any downstream test to fail if this happened in any other context. if self._column_type is None: return None if not hasattr(self, '_t'): a = self._column_type(name='a', data=[1, 2, 3], dtype='i8') b = self._column_type(name='b', data=[4, 5, 6], dtype='i8') self._t = self._table_type([a, b]) return self._t def test_subclass(self, table_types): """Row is subclass of ndarray and Row""" self._setup(table_types) c = Row(self.t, 2) assert isinstance(c, Row) def test_values(self, table_types): """Row accurately reflects table values and attributes""" self._setup(table_types) table = self.t row = table[1] assert row['a'] == 2 assert row['b'] == 5 assert row[0] == 2 assert row[1] == 5 assert row.meta is table.meta assert row.colnames == table.colnames assert row.columns is table.columns with pytest.raises(IndexError): row[2] if sys.byteorder == 'little': assert str(row.dtype) == "[('a', 'i8'), ('b', '>i8')]" def test_ref(self, table_types): """Row is a reference into original table data""" self._setup(table_types) table = self.t row = table[1] row['a'] = 10 if table_types.Table is not MaskedTable: assert table['a'][1] == 10 def test_left_equal(self, table_types): """Compare a table row to the corresponding structured array row""" self._setup(table_types) np_t = self.t._data.copy() if table_types.Table is MaskedTable: with pytest.raises(ValueError): self.t[0] == np_t[0] else: for row, np_row in zip(self.t, np_t): assert np.all(row == np_row) def test_left_not_equal(self, table_types): """Compare a table row to the corresponding structured array row""" self._setup(table_types) np_t = self.t._data.copy() np_t['a'] = [0, 0, 0] if table_types.Table is MaskedTable: with pytest.raises(ValueError): self.t[0] == np_t[0] else: for row, np_row in zip(self.t, np_t): assert np.all(row != np_row) def test_right_equal(self, table_types): """Test right equal""" self._setup(table_types) np_t = self.t._data.copy() if table_types.Table is MaskedTable: with pytest.raises(ValueError): self.t[0] == np_t[0] else: for row, np_row in zip(self.t, np_t): assert np.all(np_row == row) def test_convert_numpy_array(self, table_types): self._setup(table_types) d = self.t[1] np_data = np.array(d) if table_types.Table is not MaskedTable: assert np.all(np_data == d._data) assert not np_data is d._data assert d.colnames == list(np_data.dtype.names) np_data = np.array(d, copy=False) if table_types.Table is not MaskedTable: assert np.all(np_data == d._data) assert not np_data is d._data assert d.colnames == list(np_data.dtype.names) with pytest.raises(ValueError): np_data = np.array(d, dtype=[('c', 'i8'), ('d', 'i8')]) def test_format_row(self, table_types): """Test formatting row""" self._setup(table_types) table = self.t row = table[0] assert format(row, "").startswith("\n' 'masked_array(data = [1 2 3],\n' ' mask = False,\n' ' fill_value = 999999)\n') else: assert repr(c) == ('\n' 'array([1, 2, 3])') def test_format(self, Column): """Show that the formatted output from str() works""" MAX_LINES_val = table.pprint.MAX_LINES() table.pprint.MAX_LINES.set(7) c1 = Column(np.arange(2000), name='a', dtype=float, format='%6.2f') assert str(c1) == (' a \n-------\n 0.00\n' ' 1.00\n ...\n1998.00\n1999.00') table.pprint.MAX_LINES.set(MAX_LINES_val) def test_convert_numpy_array(self, Column): d = Column([1, 2, 3], name='a', dtype='i8') np_data = np.array(d) assert np.all(np_data == d) np_data = np.array(d, copy=False) assert np.all(np_data == d) np_data = np.array(d, dtype='i4') assert np.all(np_data == d) def test_convert_unit(self, Column): d = Column([1, 2, 3], name='a', dtype="f8", unit="m") d.convert_unit_to("km") assert np.all(d.data == [0.001, 0.002, 0.003]) def test_deprecated_attributes(self, Column, recwarn): d = Column([1, 2, 3], name='a', dtype="f8", unit="m") with catch_warnings(AstropyDeprecationWarning) as warning_lines: d.units assert warning_lines[0].category == AstropyDeprecationWarning with catch_warnings(AstropyDeprecationWarning) as warning_lines: c = Column([1,2,3], name='a', dtypes="f8", unit="m") assert warning_lines[0].category == AstropyDeprecationWarning with catch_warnings(AstropyDeprecationWarning) as warning_lines: c = Column([1,2,3], name='a', dtype="f8", units="m") assert warning_lines[0].category == AstropyDeprecationWarning def test_array_wrap(self): """Test that the __array_wrap__ method converts a reduction ufunc output that has a different shape into an ndarray view. Without this a method call like c.mean() returns a Column array object with length=1.""" # Mean and sum for a 1-d float column c = table.Column(name='a', data=[1., 2., 3.]) assert np.allclose(c.mean(), 2.0) assert isinstance(c.mean(), (np.floating, float)) assert np.allclose(c.sum(), 6.) assert isinstance(c.sum(), (np.floating, float)) # Non-reduction ufunc preserves Column class assert isinstance(np.cos(c), table.Column) # Sum for a 1-d int column c = table.Column(name='a', data=[1, 2, 3]) assert np.allclose(c.sum(), 6) assert isinstance(c.sum(), (np.integer, int)) # Sum for a 2-d int column c = table.Column(name='a', data=[[1, 2, 3], [4, 5, 6]]) assert c.sum() == 21 assert isinstance(c.sum(), (np.integer, int)) assert np.all(c.sum(axis=0) == [5, 7, 9]) assert c.sum(axis=0).shape == (3,) assert isinstance(c.sum(axis=0), np.ndarray) # Sum and mean for a 1-d masked column c = table.MaskedColumn(name='a', data=[1., 2., 3.], mask=[0, 0, 1]) assert np.allclose(c.mean(), 1.5) assert isinstance(c.mean(), (np.floating, float)) assert np.allclose(c.sum(), 3.) assert isinstance(c.sum(), (np.floating, float)) def test_name_none(self, Column): """Can create a column without supplying name, which defaults to None""" c = Column([1, 2]) assert c.name is None assert np.all(c == np.array([1, 2])) def test_quantity_init(self, Column): c = Column(data=np.array([1,2,3]) * u.m) assert np.all(c.data == np.array([1,2,3])) assert np.all(c.unit == u.m) c = Column(data=np.array([1,2,3]) * u.m, unit=u.cm) assert np.all(c.data == np.array([100,200,300])) assert np.all(c.unit == u.cm) class TestAttrEqual(): """Bunch of tests originally from ATpy that test the attrs_equal method.""" def test_5(self, Column): c1 = Column(name='a', dtype=int, unit='mJy') c2 = Column(name='a', dtype=int, unit='mJy') assert c1.attrs_equal(c2) def test_6(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) assert c1.attrs_equal(c2) def test_7(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='b', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_8(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=float, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_9(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='erg.cm-2.s-1.Hz-1', format='%i', description='test column', meta={'c': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_10(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='mJy', format='%g', description='test column', meta={'c': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_11(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='mJy', format='%i', description='another test column', meta={'c': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_12(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'e': 8, 'd': 12}) assert not c1.attrs_equal(c2) def test_13(self, Column): c1 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 9, 'd': 12}) assert not c1.attrs_equal(c2) def test_col_and_masked_col(self): c1 = table.Column(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) c2 = table.MaskedColumn(name='a', dtype=int, unit='mJy', format='%i', description='test column', meta={'c': 8, 'd': 12}) assert c1.attrs_equal(c2) assert c2.attrs_equal(c1) # Check that the meta descriptor is working as expected. The MetaBaseTest class # takes care of defining all the tests, and we simply have to define the class # and any minimal set of args to pass. from ...utils.tests.test_metadata import MetaBaseTest class TestMetaColumn(MetaBaseTest): test_class = table.Column args = () class TestMetaMaskedColumn(MetaBaseTest): test_class = table.MaskedColumn args = () astropy-0.3/astropy/table/tests/test_pprint.py0000644000175000017500000002516012243255342020062 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from distutils import version import numpy as np from ...tests.helper import pytest from ... import table from ...table import pprint BIG_WIDE_ARR = np.arange(2000, dtype=np.float).reshape(100, 20) SMALL_ARR = np.arange(12, dtype=np.int).reshape(4, 3) class MaskedTable(table.Table): def __init__(self, *args, **kwargs): kwargs['masked'] = True table.Table.__init__(self, *args, **kwargs) # Fixture to run all tests for both an unmasked (ndarray) and masked # (MaskedArray) column. @pytest.fixture(params=[False, True]) def table_type(request): # return MaskedTable if request.param else table.Table try: request.param return MaskedTable except AttributeError: return table.Table @pytest.mark.usefixtures('table_type') class TestMultiD(): def test_multidim(self, table_type): """Test printing with multidimensional column""" arr = [np.array([[1, 2], [10, 20]]), np.array([[3, 4], [30, 40]]), np.array([[5, 6], [50, 60]])] t = table_type(arr) lines = t.pformat() print lines assert lines == ['col0 [2] col1 [2] col2 [2]', '-------- -------- --------', ' 1 .. 2 3 .. 4 5 .. 6', '10 .. 20 30 .. 40 50 .. 60'] lines = t.pformat(html=True) assert lines == ['
'.format(id=id(t)), '', '', '', '
col0 [2]col1 [2]col2 [2]
1 .. 23 .. 45 .. 6
10 .. 2030 .. 4050 .. 60
'] assert t._repr_html_() == ('' '' '
col0 [2]col1 [2]col2 [2]'.format(tid=id(t)) + '
1 .. 23 .. 45 .. 6
10 .. 2030 .. 4050 .. 60
') t = table_type([arr]) lines = t.pformat() print lines assert lines == ['col0 [2,2]', '----------', ' 1 .. 20', ' 3 .. 40', ' 5 .. 60'] def test_html_escaping(): t = table.Table([('', 2, 3)]) assert t._repr_html_() == ( ''.format(id=id(t)) + '' '
col0
<script>alert("gotcha");</script>
2
3
') @pytest.mark.usefixtures('table_type') class TestPprint(): def _setup(self, table_type): self.tb = table_type(BIG_WIDE_ARR) self.tb['col0'].format = '%e' self.tb['col1'].format = '%.6f' self.tb['col0'].unit = 'km**2' self.tb['col19'].unit = 'kg s m**-2' self.ts = table_type(SMALL_ARR) def test_format0(self, table_type): """Try getting screen size but fail to defaults because testing doesn't have access to screen (fcntl.ioctl fails). """ self._setup(table_type) arr = np.arange(4000, dtype=np.float).reshape(100, 40) lines = table_type(arr).pformat() assert len(lines) == pprint.MAX_LINES() for line in lines: assert (len(line) > pprint.MAX_WIDTH() - 10 and len(line) <= pprint.MAX_WIDTH()) def test_format1(self, table_type): """Basic test of formatting""" self._setup(table_type) lines = self.tb.pformat(max_lines=8, max_width=40) assert lines == [' col0 col1 ... col19 ', '------------ ----------- ... ------', '0.000000e+00 1.000000 ... 19.0', '2.000000e+01 21.000000 ... 39.0', '4.000000e+01 41.000000 ... 59.0', ' ... ... ... ...', '1.960000e+03 1961.000000 ... 1979.0', '1.980000e+03 1981.000000 ... 1999.0'] def test_format2(self, table_type): """Include the unit header row""" self._setup(table_type) lines = self.tb.pformat(max_lines=8, max_width=40, show_unit=True) print(lines) assert lines == [' col0 col1 ... col19 ', ' km2 ... kg s / m2', '------------ ----------- ... ---------', '0.000000e+00 1.000000 ... 19.0', '2.000000e+01 21.000000 ... 39.0', ' ... ... ... ...', '1.960000e+03 1961.000000 ... 1979.0', '1.980000e+03 1981.000000 ... 1999.0'] def test_format3(self, table_type): """Do not include the name header row""" self._setup(table_type) lines = self.tb.pformat(max_lines=8, max_width=40, show_name=False) assert lines == ['0.000000e+00 1.000000 ... 19.0', '2.000000e+01 21.000000 ... 39.0', '4.000000e+01 41.000000 ... 59.0', '6.000000e+01 61.000000 ... 79.0', ' ... ... ... ...', '1.940000e+03 1941.000000 ... 1959.0', '1.960000e+03 1961.000000 ... 1979.0', '1.980000e+03 1981.000000 ... 1999.0'] def test_noclip(self, table_type): """Basic table print""" self._setup(table_type) lines = self.ts.pformat(max_lines=-1, max_width=-1) assert lines == ['col0 col1 col2', '---- ---- ----', ' 0 1 2', ' 3 4 5', ' 6 7 8', ' 9 10 11'] def test_clip1(self, table_type): """max lines below hard limit of 6 """ self._setup(table_type) lines = self.ts.pformat(max_lines=3, max_width=-1) assert lines == ['col0 col1 col2', '---- ---- ----', ' 0 1 2', ' 3 4 5', ' 6 7 8', ' 9 10 11'] def test_clip2(self, table_type): """max lines below hard limit of 6 and output longer than 6 """ self._setup(table_type) lines = self.ts.pformat(max_lines=3, max_width=-1, show_unit=True) assert lines == ['col0 col1 col2', ' ', '---- ---- ----', ' 0 1 2', ' ... ... ...', ' 9 10 11'] def test_clip3(self, table_type): """Max lines below hard limit of 6 and max width below hard limit of 10 """ self._setup(table_type) lines = self.ts.pformat(max_lines=3, max_width=1, show_unit=True) assert lines == ['col0 ...', ' ...', '---- ...', ' 0 ...', ' ... ...', ' 9 ...'] def test_clip4(self, table_type): """Test a range of max_lines""" self._setup(table_type) for max_lines in range(130): lines = self.tb.pformat(max_lines=max_lines) assert len(lines) == max(6, min(102, max_lines)) @pytest.mark.usefixtures('table_type') class TestFormat(): def test_column_format(self, table_type): t = table_type([[1, 2], [3, 4]], names=('a', 'b')) # default (format=None) assert str(t['a']) == ' a \n---\n 1\n 2' # Old-style that is almost new-style t['a'].format = '{ %4.2f }' assert str(t['a']) == ' a \n--------\n{ 1.00 }\n{ 2.00 }' # New-style that is almost old-style t['a'].format = '%{0:}' assert str(t['a']) == ' a \n---\n %1\n %2' # New-style with extra spaces t['a'].format = ' {0:05d} ' assert str(t['a']) == ' a \n-------\n 00001 \n 00002 ' # New-style has precedence t['a'].format = '%4.2f {0:}' assert str(t['a']) == ' a \n-------\n%4.2f 1\n%4.2f 2' # Invalid format spec t['a'].format = 'fail' with pytest.raises(ValueError): str(t['a']) def test_column_format_with_threshold(self, table_type): MAX_LINES_val = pprint.MAX_LINES() pprint.MAX_LINES.set(6) t = table_type([np.arange(20)], names=['a']) t['a'].format = '%{0:}' assert str(t['a']) == ' a \n---\n %0\n %1\n...\n%19' t['a'].format = '{ %4.2f }' assert str(t['a']) == ' a \n---------\n { 0.00 }\n' \ ' { 1.00 }\n ...\n{ 19.00 }' pprint.MAX_LINES.set(MAX_LINES_val) def test_column_format_func(self, table_type): # run most of functions twice # 1) astropy.table.pprint._format_funcs gets populated # 2) astropy.table.pprint._format_funcs gets used t = table_type([[1., 2.], [3, 4]], names=('a', 'b')) # mathematical function t['a'].format = lambda x: str(x * 3.) assert str(t['a']) == ' a \n---\n3.0\n6.0' assert str(t['a']) == ' a \n---\n3.0\n6.0' def test_column_format_func_wrong_number_args(self, table_type): t = table_type([[1., 2.], [3, 4]], names=('a', 'b')) # function that expects wrong number of arguments def func(a, b): pass t['a'].format = func with pytest.raises(ValueError): str(t['a']) def test_column_format_func_multiD(self, table_type): arr = [np.array([[1, 2], [10, 20]])] t = table_type(arr, names=['a']) # mathematical function t['a'].format = lambda x: str(x * 3.) outstr = ' a [2] \n------------\n 3.0 .. 6.0\n30.0 .. 60.0' assert str(t['a']) == outstr assert str(t['a']) == outstr def test_column_format_func_not_str(self, table_type): t = table_type([[1., 2.], [3, 4]], names=('a', 'b')) # mathematical function t['a'].format = lambda x: x * 3 with pytest.raises(ValueError): str(t['a']) astropy-0.3/astropy/table/tests/test_table.py0000644000175000017500000011613512243255342017640 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import platform import sys from distutils import version import numpy as np from ...extern import six from ...tests.helper import pytest from ... import table from ... import units as u # In Python 3, prior to Numpy 1.6.2, there was a bug (in Numpy) that caused # sorting of structured arrays to silently fail under certain circumstances (for # example if the Table contains string columns) on MacOS X and Windows NUMPY_VERSION = version.LooseVersion(np.__version__) SKIP_STRING_SORT = (platform.system() in ('Darwin', 'Windows') and six.PY3 and NUMPY_VERSION < version.LooseVersion('1.6.2')) class MaskedTable(table.Table): def __init__(self, *args, **kwargs): kwargs['masked'] = True table.Table.__init__(self, *args, **kwargs) # Fixture to run all the Column tests for both an unmasked (ndarray) # and masked (MaskedArray) column. @pytest.fixture(params=[False, True]) def table_types(request): class TableTypes: def __init__(self, request): self.Table = MaskedTable if request.param else table.Table self.Column = table.MaskedColumn if request.param else table.Column return TableTypes(request) class SetupData(object): def _setup(self, table_types): self._table_type = table_types.Table self._column_type = table_types.Column @property def a(self): if self._column_type is not None: if not hasattr(self, '_a'): self._a = self._column_type( name='a', data=[1, 2, 3], format='%d', meta={'aa': [0, 1, 2, 3, 4]}) return self._a @property def b(self): if self._column_type is not None: if not hasattr(self, '_b'): self._b = self._column_type( name='b', data=[4, 5, 6], format='%d', meta={'aa': 1}) return self._b @property def c(self): if self._column_type is not None: if not hasattr(self, '_c'): self._c = self._column_type(name='c', data=[7, 8, 9]) return self._c @property def d(self): if self._column_type is not None: if not hasattr(self, '_d'): self._d = self._column_type(name='d', data=[7, 8, 7]) return self._d @property def obj(self): if self._column_type is not None: if not hasattr(self, '_obj'): self._obj = self._column_type(name='obj', data=[1, 'string', 3], dtype='O') return self._obj @property def t(self): if self._table_type is not None: if not hasattr(self, '_t'): self._t = self._table_type([self.a, self.b]) return self._t @pytest.mark.usefixtures('table_types') class TestSetTableColumn(SetupData): def test_set_row(self, table_types): """Set a row from a tuple of values""" self._setup(table_types) t = table_types.Table([self.a, self.b]) t[1] = (20, 21) assert t['a'][0] == 1 assert t['a'][1] == 20 assert t['a'][2] == 3 assert t['b'][0] == 4 assert t['b'][1] == 21 assert t['b'][2] == 6 def test_set_row_existing(self, table_types): """Set a row from another existing row""" self._setup(table_types) t = table_types.Table([self.a, self.b]) t[0] = t[1] assert t[0][0] == 2 assert t[0][1] == 5 def test_set_row_fail_1(self, table_types): """Set a row from an incorrectly-sized set of values""" self._setup(table_types) t = table_types.Table([self.a, self.b]) with pytest.raises(ValueError): t[1] = (20, 21, 22) with pytest.raises(TypeError): t[1] = 0 def test_set_row_fail_2(self, table_types): """Set a row from an incorrectly-typed tuple of values""" self._setup(table_types) t = table_types.Table([self.a, self.b]) with pytest.raises(ValueError): t[1] = ('abc', 'def') def test_set_new_col_new_table(self, table_types): """Create a new column in empty table using the item access syntax""" self._setup(table_types) t = table_types.Table() t['aa'] = self.a # Test that the new column name is 'aa' and that the values match assert np.all(t['aa'] == self.a) assert t.colnames == ['aa'] def test_set_new_col_new_table_quantity(self, table_types): """Create a new column (from a quantity) in empty table using the item access syntax""" self._setup(table_types) t = table_types.Table() t['aa'] = np.array([1,2,3]) * u.m assert np.all(t['aa'] == np.array([1,2,3])) assert t['aa'].unit == u.m t['bb'] = 3 * u.m assert np.all(t['bb'] == 3) assert t['bb'].unit == u.m def test_set_new_col_existing_table(self, table_types): """Create a new column in an existing table using the item access syntax""" self._setup(table_types) t = table_types.Table([self.a]) # Add a column t['bb'] = self.b assert np.all(t['bb'] == self.b) assert t.colnames == ['a', 'bb'] assert t['bb'].meta == self.b.meta assert t['bb'].format == self.b.format # Add another column t['c'] = t['a'] assert np.all(t['c'] == t['a']) assert t.colnames == ['a', 'bb', 'c'] assert t['c'].meta == t['a'].meta assert t['c'].format == t['a'].format # Add a multi-dimensional column t['d'] = table_types.Column(np.arange(12).reshape(3, 2, 2)) assert t['d'].shape == (3, 2, 2) assert t['d'][0, 0, 1] == 1 # Add column from a list t['e'] = ['hello', 'the', 'world'] assert np.all(t['e'] == np.array(['hello', 'the', 'world'])) # Make sure setting existing column still works t['e'] = ['world', 'hello', 'the'] assert np.all(t['e'] == np.array(['world', 'hello', 'the'])) # Add a column via broadcasting t['f'] = 10 assert np.all(t['f'] == 10) # Add a column from a Quantity t['g'] = np.array([1,2,3]) * u.m assert np.all(t['g'].data == np.array([1,2,3])) assert t['g'].unit == u.m # Add a column from a (scalar) Quantity t['g'] = 3 * u.m assert np.all(t['g'].data == 3) assert t['g'].unit == u.m def test_set_new_unmasked_col_existing_table(self, table_types): """Create a new column in an existing table using the item access syntax""" self._setup(table_types) t = table_types.Table([self.a]) # masked or unmasked b = table.Column(name='b', data=[1, 2, 3]) # unmasked t['b'] = b assert np.all(t['b'] == b) def test_set_new_masked_col_existing_table(self, table_types): """Create a new column in an existing table using the item access syntax""" self._setup(table_types) t = table_types.Table([self.a]) # masked or unmasked b = table.MaskedColumn(name='b', data=[1, 2, 3]) # masked t['b'] = b assert np.all(t['b'] == b) def test_set_new_col_existing_table_fail(self, table_types): """Generate failure when creating a new column using the item access syntax""" self._setup(table_types) t = table_types.Table([self.a]) # Wrong size with pytest.raises(ValueError): t['b'] = [1, 2] @pytest.mark.usefixtures('table_types') class TestEmptyData(): def test_1(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', dtype=int, length=100)) assert len(t['a']) == 100 def test_2(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', dtype=int, shape=(3, ), length=100)) assert len(t['a']) == 100 def test_3(self, table_types): t = table_types.Table() # length is not given t.add_column(table_types.Column(name='a', dtype=int)) assert len(t['a']) == 0 def test_4(self, table_types): t = table_types.Table() # length is not given t.add_column(table_types.Column(name='a', dtype=int, shape=(3, 4))) assert len(t['a']) == 0 def test_5(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a')) # dtype is not specified assert len(t['a']) == 0 @pytest.mark.usefixtures('table_types') class TestNewFromColumns(): def test_simple(self, table_types): cols = [table_types.Column(name='a', data=[1, 2, 3]), table_types.Column(name='b', data=[4, 5, 6], dtype=np.float32)] t = table_types.Table(cols) assert np.all(t['a'].data == np.array([1, 2, 3])) assert np.all(t['b'].data == np.array([4, 5, 6], dtype=np.float32)) assert type(t['b'][1]) == np.float32 def test_from_np_array(self, table_types): cols = [table_types.Column(name='a', data=np.array([1, 2, 3], dtype=np.int64), dtype=np.float64), table_types.Column(name='b', data=np.array([4, 5, 6], dtype=np.float32))] t = table_types.Table(cols) assert np.all(t['a'] == np.array([1, 2, 3], dtype=np.float64)) assert np.all(t['b'] == np.array([4, 5, 6], dtype=np.float32)) assert type(t['a'][1]) == np.float64 assert type(t['b'][1]) == np.float32 def test_size_mismatch(self, table_types): cols = [table_types.Column(name='a', data=[1, 2, 3]), table_types.Column(name='b', data=[4, 5, 6, 7])] with pytest.raises(ValueError): table_types.Table(cols) def test_name_none(self, table_types): """Column with name=None can init a table IFF names are supplied""" c = table_types.Column(data=[1, 2]) table_types.Table([c], names=('c',)) with pytest.raises(TypeError): table_types.Table([c]) @pytest.mark.usefixtures('table_types') class TestReverse(): def test_reverse(self, table_types): t = table_types.Table([[1, 2, 3], ['a', 'b', 'cc']]) t.reverse() assert np.all(t['col0'] == np.array([3, 2, 1])) assert np.all(t['col1'] == np.array(['cc', 'b', 'a'])) t2 = table_types.Table(t, copy=False) assert np.all(t2['col0'] == np.array([3, 2, 1])) assert np.all(t2['col1'] == np.array(['cc', 'b', 'a'])) t2 = table_types.Table(t, copy=True) assert np.all(t2['col0'] == np.array([3, 2, 1])) assert np.all(t2['col1'] == np.array(['cc', 'b', 'a'])) t2.sort('col0') assert np.all(t2['col0'] == np.array([1, 2, 3])) assert np.all(t2['col1'] == np.array(['a', 'b', 'cc'])) def test_reverse_big(self, table_types): x = np.arange(10000) y = x + 1 t = table_types.Table([x, y], names=('x', 'y')) t.reverse() assert np.all(t['x'] == x[::-1]) assert np.all(t['y'] == y[::-1]) @pytest.mark.usefixtures('table_types') class TestColumnAccess(): def test_1(self, table_types): t = table_types.Table() with pytest.raises(KeyError): t['a'] def test_2(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', data=[1, 2, 3])) assert np.all(t['a'] == np.array([1, 2, 3])) with pytest.raises(KeyError): t['b'] # column does not exist @pytest.mark.usefixtures('table_types') class TestAddLength(SetupData): def test_right_length(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) t.add_column(self.b) def test_too_long(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) with pytest.raises(ValueError): t.add_column(table_types.Column(name='b', data=[4, 5, 6, 7])) # data too long def test_too_short(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) with pytest.raises(ValueError): t.add_column(table_types.Column(name='b', data=[4, 5])) # data too short @pytest.mark.usefixtures('table_types') class TestAddPosition(SetupData): def test_1(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a, 0) def test_2(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a, 1) def test_3(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a, -1) def test_5(self, table_types): self._setup(table_types) t = table_types.Table() with pytest.raises(ValueError): t.index_column('b') def test_6(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a) t.add_column(self.b) assert t.columns.keys() == ['a', 'b'] def test_7(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) t.add_column(self.b, t.index_column('a')) assert t.columns.keys() == ['b', 'a'] def test_8(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) t.add_column(self.b, t.index_column('a') + 1) assert t.columns.keys() == ['a', 'b'] def test_9(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a) t.add_column(self.b, t.index_column('a') + 1) t.add_column(self.c, t.index_column('b')) assert t.columns.keys() == ['a', 'c', 'b'] def test_10(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a) ia = t.index_column('a') t.add_column(self.b, ia + 1) t.add_column(self.c, ia) assert t.columns.keys() == ['c', 'a', 'b'] @pytest.mark.usefixtures('table_types') class TestInitFromTable(SetupData): def test_from_table_cols(self, table_types): """Ensure that using cols from an existing table gives a clean copy. """ self._setup(table_types) t = self.t cols = t.columns # Construct Table with cols via Table._new_from_cols t2a = table_types.Table([cols['a'], cols['b'], self.c]) # Construct with add_column t2b = table_types.Table() t2b.add_column(cols['a']) t2b.add_column(cols['b']) t2b.add_column(self.c) t['a'][1] = 20 t['b'][1] = 21 for t2 in [t2a, t2b]: t2['a'][2] = 10 t2['b'][2] = 11 t2['c'][2] = 12 t2.columns['a'].meta['aa'][3] = 10 assert np.all(t['a'] == np.array([1, 20, 3])) assert np.all(t['b'] == np.array([4, 21, 6])) assert np.all(t2['a'] == np.array([1, 2, 10])) assert np.all(t2['b'] == np.array([4, 5, 11])) assert np.all(t2['c'] == np.array([7, 8, 12])) assert t2['a'].name == 'a' assert t2.columns['a'].meta['aa'][3] == 10 assert t.columns['a'].meta['aa'][3] == 3 @pytest.mark.usefixtures('table_types') class TestAddColumns(SetupData): def test_add_columns1(self, table_types): self._setup(table_types) t = table_types.Table() t.add_columns([self.a, self.b, self.c]) assert t.colnames == ['a', 'b', 'c'] def test_add_columns2(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.add_columns([self.c, self.d]) assert t.colnames == ['a', 'b', 'c', 'd'] assert np.all(t['c'] == np.array([7, 8, 9])) def test_add_columns3(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.add_columns([self.c, self.d], indexes=[1, 0]) assert t.colnames == ['d', 'a', 'c', 'b'] def test_add_columns4(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.add_columns([self.c, self.d], indexes=[0, 0]) assert t.colnames == ['c', 'd', 'a', 'b'] def test_add_columns5(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.add_columns([self.c, self.d], indexes=[2, 2]) assert t.colnames == ['a', 'b', 'c', 'd'] def test_add_duplicate_column(self, table_types): self._setup(table_types) t = table_types.Table() t.add_column(self.a) with pytest.raises(ValueError): t.add_column(table_types.Column(name='a', data=[0, 1, 2])) t.add_column(self.b) t.add_column(self.c) assert t.colnames == ['a', 'b', 'c'] def test_add_duplicate_columns(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b, self.c]) with pytest.raises(ValueError): t.add_columns([table_types.Column(name='a', data=[0, 1, 2]), table_types.Column(name='b', data=[0, 1, 2])]) t.add_column(self.d) assert t.colnames == ['a', 'b', 'c', 'd'] @pytest.mark.usefixtures('table_types') class TestAddRow(SetupData): @property def b(self): if self._column_type is not None: if not hasattr(self, '_b'): self._b = self._column_type(name='b', data=[4.0, 5.1, 6.2]) return self._b @property def c(self): if self._column_type is not None: if not hasattr(self, '_c'): self._c = self._column_type(name='c', data=['7', '8', '9']) return self._c @property def t(self): if self._table_type is not None: if not hasattr(self, '_t'): self._t = self._table_type([self.a, self.b, self.c]) return self._t def test_add_none_to_empty_table(self, table_types): self._setup(table_types) t = table_types.Table(names=('a', 'b', 'c'), dtype=('i', 'S4', 'O')) t.add_row() assert t['a'][0] == 0 assert t['b'][0] == b'' assert t['c'][0] == 0 t.add_row() assert t['a'][1] == 0 assert t['b'][1] == b'' assert t['c'][1] == 0 def test_add_stuff_to_empty_table(self, table_types): self._setup(table_types) t = table_types.Table(names=('a', 'b', 'obj'), dtype=('i', 'S8', 'O')) t.add_row([1, 'hello', 'world']) assert t['a'][0] == 1 assert t['b'][0] == b'hello' assert t['obj'][0] == 'world' # Make sure it is not repeating last row but instead # adding zeros (as documented) t.add_row() assert t['a'][1] == 0 assert t['b'][1] == b'' assert t['obj'][1] == 0 def test_add_table_row(self, table_types): self._setup(table_types) t = self.t t2 = table_types.Table([self.a, self.b, self.c]) t.add_row(t2[0]) assert len(t) == 4 assert np.all(t['a'] == np.array([1, 2, 3, 1])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 4.0])) assert np.all(t['c'] == np.array(['7', '8', '9', '7'])) def test_add_table_row_obj(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b, self.obj]) t.add_row([1, 4.0, [10]]) assert len(t) == 4 assert np.all(t['a'] == np.array([1, 2, 3, 1])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 4.0])) assert np.all(t['obj'] == np.array([1, 'string', 3, [10]], dtype='O')) def test_add_with_tuple(self, table_types): self._setup(table_types) t = self.t t.add_row((4, 7.2, '1')) assert len(t) == 4 assert np.all(t['a'] == np.array([1, 2, 3, 4])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 7.2])) assert np.all(t['c'] == np.array(['7', '8', '9', '1'])) def test_add_with_list(self, table_types): self._setup(table_types) t = self.t t.add_row([4, 7.2, '10']) assert len(t) == 4 assert np.all(t['a'] == np.array([1, 2, 3, 4])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 7.2])) assert np.all(t['c'] == np.array(['7', '8', '9', '1'])) def test_add_with_dict(self, table_types): self._setup(table_types) t = self.t t.add_row({'a': 4, 'b': 7.2}) assert len(t) == 4 assert np.all(t['a'] == np.array([1, 2, 3, 4])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 7.2])) if t.masked: assert np.all(t['c'] == np.array(['7', '8', '9', '7'])) else: assert np.all(t['c'] == np.array(['7', '8', '9', ''])) def test_add_with_none(self, table_types): self._setup(table_types) t = self.t t.add_row() assert len(t) == 4 assert np.all(t['a'].data == np.array([1, 2, 3, 0])) assert np.allclose(t['b'], np.array([4.0, 5.1, 6.2, 0.0])) assert np.all(t['c'].data == np.array(['7', '8', '9', ''])) def test_add_missing_column(self, table_types): self._setup(table_types) t = self.t with pytest.raises(ValueError): t.add_row({'bad_column': 1}) def test_wrong_size_tuple(self, table_types): self._setup(table_types) t = self.t with pytest.raises(ValueError): t.add_row((1, 2)) def test_wrong_vals_type(self, table_types): self._setup(table_types) t = self.t with pytest.raises(TypeError): t.add_row(1) def test_add_without_own_fails(self, table_types): """Add row to a table that doesn't own the data""" self._setup(table_types) data = np.array([(1, 2, 3), (3, 4, 5)], dtype='i4') t = table_types.Table(data, copy=False) if not t.masked: with pytest.raises(ValueError): t.add_row([6, 7, 8]) def test_add_row_failures(self, table_types): self._setup(table_types) t = self.t t_copy = table_types.Table(t, copy=True) # Wrong number of columns try: t.add_row([1,2,3,4]) except ValueError: pass assert len(t) == 3 assert np.all(t._data == t_copy._data) # Wrong data type try: t.add_row(['one',2,3]) except ValueError: pass assert len(t) == 3 assert np.all(t._data == t_copy._data) @pytest.mark.usefixtures('table_types') class TestTableColumn(SetupData): def test_column_view(self, table_types): self._setup(table_types) t = self.t a = t.columns['a'] a[2] = 10 assert t._data['a'][2] == 10 @pytest.mark.usefixtures('table_types') class TestArrayColumns(SetupData): def test_1d(self, table_types): self._setup(table_types) b = table_types.Column(name='b', dtype=int, shape=(2, ), length=3) t = table_types.Table([self.a]) t.add_column(b) assert t['b'].shape == (3, 2) assert t['b'][0].shape == (2, ) def test_2d(self, table_types): self._setup(table_types) b = table_types.Column(name='b', dtype=int, shape=(2, 4), length=3) t = table_types.Table([self.a]) t.add_column(b) assert t['b'].shape == (3, 2, 4) assert t['b'][0].shape == (2, 4) def test_3d(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) b = table_types.Column(name='b', dtype=int, shape=(2, 4, 6), length=3) t.add_column(b) assert t['b'].shape == (3, 2, 4, 6) assert t['b'][0].shape == (2, 4, 6) @pytest.mark.usefixtures('table_types') class TestRemove(SetupData): @property def t(self): if self._table_type is not None: if not hasattr(self, '_t'): self._t = self._table_type([self.a]) return self._t @property def t2(self): if self._table_type is not None: if not hasattr(self, '_t2'): self._t2 = self._table_type([self.a, self.b, self.c]) return self._t2 def test_1(self, table_types): self._setup(table_types) self.t.remove_columns('a') assert self.t.columns.keys() == [] assert self.t._data is None def test_2(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.remove_columns('a') assert self.t.columns.keys() == ['b'] assert self.t._data.dtype.names == ('b',) assert np.all(self.t['b'] == np.array([4, 5, 6])) def test_remove_nonexistent_row(self, table_types): self._setup(table_types) with pytest.raises(IndexError): self.t.remove_row(4) def test_remove_row_0(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.add_column(self.c) self.t.remove_row(0) assert self.t.colnames == ['a', 'b', 'c'] assert np.all(self.t['b'] == np.array([5, 6])) def test_remove_row_1(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.add_column(self.c) self.t.remove_row(1) assert self.t.colnames == ['a', 'b', 'c'] assert np.all(self.t['a'] == np.array([1, 3])) def test_remove_row_2(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.add_column(self.c) self.t.remove_row(2) assert self.t.colnames == ['a', 'b', 'c'] assert np.all(self.t['c'] == np.array([7, 8])) def test_remove_row_slice(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.add_column(self.c) self.t.remove_rows(slice(0, 2, 1)) assert self.t.colnames == ['a', 'b', 'c'] assert np.all(self.t['c'] == np.array([9])) def test_remove_row_list(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.add_column(self.c) self.t.remove_rows([0, 2]) assert self.t.colnames == ['a', 'b', 'c'] assert np.all(self.t['c'] == np.array([8])) def test_remove_row_preserves_meta(self, table_types): self._setup(table_types) self.t.add_column(self.b) self.t.remove_rows([0, 2]) assert self.t['a'].meta == {'aa': [0, 1, 2, 3, 4]} assert self.t.dtype == np.dtype([('a', 'int'), ('b', 'int')]) def test_delitem1(self, table_types): self._setup(table_types) del self.t['a'] assert self.t.columns.keys() == [] assert self.t._data is None def test_delitem2(self, table_types): self._setup(table_types) del self.t2['b'] assert self.t2.colnames == ['a', 'c'] def test_delitems(self, table_types): self._setup(table_types) del self.t2['a', 'b'] assert self.t2.colnames == ['c'] def test_delitem_fail(self, table_types): self._setup(table_types) with pytest.raises(KeyError): del self.t['d'] @pytest.mark.usefixtures('table_types') class TestKeep(SetupData): def test_1(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.keep_columns([]) assert t.columns.keys() == [] assert t._data is None def test_2(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.keep_columns('b') assert t.columns.keys() == ['b'] assert t._data.dtype.names == ('b',) assert np.all(t['b'] == np.array([4, 5, 6])) @pytest.mark.usefixtures('table_types') class TestRename(SetupData): def test_1(self, table_types): self._setup(table_types) t = table_types.Table([self.a]) t.rename_column('a', 'b') assert t.columns.keys() == ['b'] assert t._data.dtype.names == ('b',) assert np.all(t['b'] == np.array([1, 2, 3])) def test_2(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t.rename_column('a', 'c') t.rename_column('b', 'a') assert t.columns.keys() == ['c', 'a'] assert t._data.dtype.names == ('c', 'a') if t.masked: assert t._data.mask.dtype.names == ('c', 'a') assert np.all(t['c'] == np.array([1, 2, 3])) assert np.all(t['a'] == np.array([4, 5, 6])) def test_rename_by_attr(self, table_types): self._setup(table_types) t = table_types.Table([self.a, self.b]) t['a'].name = 'c' t['b'].name = 'a' assert t.columns.keys() == ['c', 'a'] assert t._data.dtype.names == ('c', 'a') assert np.all(t['c'] == np.array([1, 2, 3])) assert np.all(t['a'] == np.array([4, 5, 6])) @pytest.mark.usefixtures('table_types') class TestSort(): def test_single(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', data=[2, 1, 3])) t.add_column(table_types.Column(name='b', data=[6, 5, 4])) assert np.all(t['a'] == np.array([2, 1, 3])) assert np.all(t['b'] == np.array([6, 5, 4])) t.sort('a') assert np.all(t['a'] == np.array([1, 2, 3])) assert np.all(t['b'] == np.array([5, 6, 4])) t.sort('b') assert np.all(t['a'] == np.array([3, 1, 2])) assert np.all(t['b'] == np.array([4, 5, 6])) def test_single_big(self, table_types): """Sort a big-ish table with a non-trivial sort order""" x = np.arange(10000) y = np.sin(x) t = table_types.Table([x, y], names=('x', 'y')) t.sort('y') idx = np.argsort(y) assert np.all(t['x'] == x[idx]) assert np.all(t['y'] == y[idx]) def test_multiple(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', data=[2, 1, 3, 2, 3, 1])) t.add_column(table_types.Column(name='b', data=[6, 5, 4, 3, 5, 4])) assert np.all(t['a'] == np.array([2, 1, 3, 2, 3, 1])) assert np.all(t['b'] == np.array([6, 5, 4, 3, 5, 4])) t.sort(['a', 'b']) assert np.all(t['a'] == np.array([1, 1, 2, 2, 3, 3])) assert np.all(t['b'] == np.array([4, 5, 3, 6, 4, 5])) t.sort(['b', 'a']) assert np.all(t['a'] == np.array([2, 1, 3, 1, 3, 2])) assert np.all(t['b'] == np.array([3, 4, 4, 5, 5, 6])) @pytest.mark.skipif('SKIP_STRING_SORT') def test_multiple_with_strings(self, table_types): # Before Numpy 1.6.2, and on Python 3.x, Numpy had a bug that meant # that sorting with multiple column names failed when a string column # was present: t = table_types.Table() t.add_column(table_types.Column(name='firstname', data=["Max", "Jo", "John"])) t.add_column(table_types.Column(name='name', data=["Miller", "Miller", "Jackson"])) t.add_column(table_types.Column(name='tel', data=[12, 15, 19])) t.sort(['name','firstname']) assert np.all([t['firstname'] == np.array(["John", "Jo", "Max"])]) assert np.all([t['name'] == np.array(["Jackson", "Miller", "Miller"])]) assert np.all([t['tel'] == np.array([19, 15, 12])]) def test_argsort(self, table_types): t = table_types.Table() t.add_column(table_types.Column(name='a', data=[2, 1, 3, 2, 3, 1])) t.add_column(table_types.Column(name='b', data=[6, 5, 4, 3, 5, 4])) assert np.all(t.argsort() == t._data.argsort()) assert np.all(t.argsort('a') == t._data.argsort(order=['a'])) assert np.all(t.argsort(['a', 'b']) == t._data.argsort(order=['a', 'b'])) @pytest.mark.usefixtures('table_types') class TestIterator(): def test_iterator(self, table_types): d = np.array([(2, 1), (3, 6), (4, 5)], dtype=[('a', 'i4'), ('b', 'i4')]) t = table_types.Table(d) if t.masked: with pytest.raises(ValueError): t[0] == d[0] else: for row, np_row in zip(t, d): assert np.all(row == np_row) @pytest.mark.usefixtures('table_types') class TestSetMeta(): def test_set_meta(self, table_types): d = table_types.Table(names=('a', 'b')) d.meta['a'] = 1 d.meta['b'] = 1 d.meta['c'] = 1 d.meta['d'] = 1 assert list(d.meta.keys()) == ['a', 'b', 'c', 'd'] @pytest.mark.usefixtures('table_types') class TestConvertNumpyArray(): def test_convert_numpy_array(self, table_types): d = table_types.Table([[1, 2], [3, 4]], names=('a', 'b')) np_data = np.array(d) if table_types.Table is not MaskedTable: assert np.all(np_data == d._data) assert not np_data is d._data assert d.colnames == list(np_data.dtype.names) np_data = np.array(d, copy=False) if table_types.Table is not MaskedTable: assert np.all(np_data == d._data) assert np_data is d._data assert d.colnames == list(np_data.dtype.names) with pytest.raises(ValueError): np_data = np.array(d, dtype=[('c', 'i8'), ('d', 'i8')]) def _assert_copies(t, t2, deep=True): assert t.colnames == t2.colnames np.testing.assert_array_equal(t._data, t2._data) assert t.meta == t2.meta if deep: assert not np.may_share_memory(t._data, t2._data) else: assert np.may_share_memory(t._data, t2._data) def test_copy(): t = table.Table([[1, 2, 3], [2, 3, 4]], names=['x', 'y']) t2 = t.copy() _assert_copies(t, t2) def test_copy_masked(): t = table.Table([[1, 2, 3], [2, 3, 4]], names=['x', 'y'], masked=True, meta={'name': 'test'}) t['x'].mask == [True, False, True] t2 = t.copy() _assert_copies(t, t2) def test_copy_protocol(): t = table.Table([[1, 2, 3], [2, 3, 4]], names=['x', 'y']) t2 = copy.copy(t) t3 = copy.deepcopy(t) _assert_copies(t, t2, deep=False) _assert_copies(t, t3) def test_disallow_inequality_comparisons(): """ Regression test for #828 - disallow comparison operators on whole Table """ t = table.Table() with pytest.raises(TypeError): t > 2 with pytest.raises(TypeError): t < 1.1 with pytest.raises(TypeError): t >= 5.5 with pytest.raises(TypeError): t <= -1.1 def test_equality(): t = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 a 4.0 3', ' 0 a 0.0 4', ' 1 b 3.0 5', ' 1 a 2.0 6', ' 1 a 1.0 7', ], format='ascii') # All rows are equal assert np.all(t==t) # Assert no rows are different assert not np.any(t!=t) # Check equality result for a given row assert np.all((t == t[3]) == np.array([0,0,0,1,0,0,0,0], dtype=bool)) # Check inequality result for a given row assert np.all((t != t[3]) == np.array([1,1,1,0,1,1,1,1], dtype=bool)) t2 = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 3 b 6.0 2', ' 2 a 4.0 3', ' 0 a 1.0 4', ' 1 b 3.0 5', ' 1 c 2.0 6', ' 1 a 1.0 7', ], format='ascii') # In the above cases, Row.__eq__ gets called, but now need to make sure # Table.__eq__ also gets called. assert np.all((t == t2) == np.array([1,1,0,1,0,1,0,1], dtype=bool)) assert np.all((t != t2) == np.array([0,0,1,0,1,0,1,0], dtype=bool)) # Check that comparing to a structured array works assert np.all((t == t2._data) == np.array([1,1,0,1,0,1,0,1], dtype=bool)) assert np.all((t._data == t2) == np.array([1,1,0,1,0,1,0,1], dtype=bool)) def test_equality_masked(): t = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 a 4.0 3', ' 0 a 0.0 4', ' 1 b 3.0 5', ' 1 a 2.0 6', ' 1 a 1.0 7', ], format='ascii') # Make into masked table t = table.Table(t, masked=True) # All rows are equal assert np.all(t==t) # Assert no rows are different assert not np.any(t!=t) # Check equality result for a given row assert np.all((t == t[3]) == np.array([0,0,0,1,0,0,0,0], dtype=bool)) # Check inequality result for a given row assert np.all((t != t[3]) == np.array([1,1,1,0,1,1,1,1], dtype=bool)) t2 = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 3 b 6.0 2', ' 2 a 4.0 3', ' 0 a 1.0 4', ' 1 b 3.0 5', ' 1 c 2.0 6', ' 1 a 1.0 7', ], format='ascii') # In the above cases, Row.__eq__ gets called, but now need to make sure # Table.__eq__ also gets called. assert np.all((t == t2) == np.array([1,1,0,1,0,1,0,1], dtype=bool)) assert np.all((t != t2) == np.array([0,0,1,0,1,0,1,0], dtype=bool)) # Check that masking a value causes the row to differ t.mask['a'][0] = True assert np.all((t == t2) == np.array([0,1,0,1,0,1,0,1], dtype=bool)) assert np.all((t != t2) == np.array([1,0,1,0,1,0,1,0], dtype=bool)) # Check that comparing to a structured array works assert np.all((t == t2._data) == np.array([0,1,0,1,0,1,0,1], dtype=bool)) @pytest.mark.xfail def test_equality_masked_bug(): """ This highlights a Numpy bug. Once it works, it can be moved into the test_equality_masked test. Related Numpy bug report: https://github.com/numpy/numpy/issues/3840 """ t = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 2 b 6.0 2', ' 2 a 4.0 3', ' 0 a 0.0 4', ' 1 b 3.0 5', ' 1 a 2.0 6', ' 1 a 1.0 7', ], format='ascii') t = table.Table(t, masked=True) t2 = table.Table.read([' a b c d', ' 2 c 7.0 0', ' 2 b 5.0 1', ' 3 b 6.0 2', ' 2 a 4.0 3', ' 0 a 1.0 4', ' 1 b 3.0 5', ' 1 c 2.0 6', ' 1 a 1.0 7', ], format='ascii') assert np.all((t._data == t2) == np.array([0,1,0,1,0,1,0,1], dtype=bool)) # Check that the meta descriptor is working as expected. The MetaBaseTest class # takes care of defining all the tests, and we simply have to define the class # and any minimal set of args to pass. from ...utils.tests.test_metadata import MetaBaseTest class TestMetaTable(MetaBaseTest): test_class = table.Table args = () astropy-0.3/astropy/table/table.py0000644000175000017500000025574512243255342015452 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import abc import collections import functools import sys import operator import platform import warnings from copy import deepcopy from distutils import version import numpy as np from numpy import ma from .. import log from ..config import ConfigurationItem from ..extern import six from ..io import registry as io_registry from ..units import Unit, Quantity from ..utils import OrderedDict, isiterable, deprecated from ..utils.console import color_print from ..utils.exceptions import AstropyDeprecationWarning from ..utils.metadata import MetaData from . import operations, groups from .pprint import (_pformat_table, _pformat_col, _pformat_col_iter, _more_tabcol) # In Python 3, prior to Numpy 1.6.2, there was a bug (in Numpy) that caused # sorting of structured arrays to silently fail under certain circumstances (for # example if the Table contains string columns) on MacOS X and Windows NUMPY_VERSION = version.LooseVersion(np.__version__) SKIP_STRING_SORT = (platform.system() in ('Darwin', 'Windows') and six.PY3 and NUMPY_VERSION < version.LooseVersion('1.6.2')) if SKIP_STRING_SORT: __doctest_skip__ = ['Table.sort'] # Python 2 and 3 source compatibility try: unicode except NameError: unicode = basestring = str AUTO_COLNAME = ConfigurationItem( 'auto_colname', 'col{0}', 'The template that determines the name of a column if it cannot be ' 'determined. Uses new-style (format method) string formatting') ERROR_COLUMN_ARGS_MESSAGE = """ The first argument to {class_name} is the string {first_arg}, which was probably intended as the column name. Starting in Astropy 0.3 the argument order for initializing a {class_name} object is {class_name}(data=None, name=None, ...).""" def _check_column_new_args(func): """ Decorator for transition from 0.2 arg order (name, data, ..) to 0.3 order (data, name, ...). Check if user provided a string as the first arg (note that a string cannot be valid as ``data``). Raise an error with a useful message. """ @functools.wraps(func) def wrapper(*args, **kwargs): if len(args) > 1 and isinstance(args[1], basestring): cls = args[0] # Column or MaskedColumn class from __new__(cls, ..) raise ValueError(ERROR_COLUMN_ARGS_MESSAGE.format(class_name=cls.__name__, first_arg=repr(args[1]))) return func(*args, **kwargs) return wrapper def _auto_names(n_cols): return [AUTO_COLNAME().format(i) for i in range(n_cols)] class TableColumns(OrderedDict): """OrderedDict subclass for a set of columns. This class enhances item access to provide convenient access to columns by name or index, including slice access. It also handles renaming of columns. The initialization argument ``cols`` can be any structure that is valid for initializing a Python dict. This includes a dict, list of (key, val) tuple pairs, list of [key, val] lists, etc. Parameters ---------- cols : dict, list, tuple; optional Column objects as data structure that can init dict (see above) """ def __init__(self, cols={}): if isinstance(cols, (list, tuple)): cols = [(col.name, col) for col in cols] super(TableColumns, self).__init__(cols) def __getitem__(self, item): """Get items from a TableColumns object. :: tc = TableColumns(cols=[Column(name='a'), Column(name='b'), Column(name='c')]) tc['a'] # Column('a') tc[1] # Column('b') tc['a', 'b'] # tc[1:3] # """ if isinstance(item, basestring): return OrderedDict.__getitem__(self, item) elif isinstance(item, int): return self.values()[item] elif isinstance(item, tuple): return TableColumns([self[x] for x in item]) elif isinstance(item, slice): return TableColumns([self[x] for x in self.keys()[item]]) else: raise IndexError('Illegal key or index value for TableColumns ' 'object') def __repr__(self): names = ("'{0}'".format(x) for x in self.keys()) return "".format(",".join(names)) def _rename_column(self, name, new_name): if new_name in self: raise KeyError("Column {0} already exists".format(new_name)) mapper = {name: new_name} new_names = [mapper.get(name, name) for name in self] cols = self.values() self.clear() self.update(zip(new_names, cols)) # Define keys and values for Python 2 and 3 source compatibility def keys(self): return list(OrderedDict.keys(self)) def values(self): return list(OrderedDict.values(self)) def _column_compare(op): """ Convenience function to return a function that properly does a comparison between a column object and something else. """ def compare(self, other): # We have to define this to ensure that we always return boolean arrays # (otherwise in some cases, Column objects are returned). if isinstance(other, BaseColumn): other = other.data return op(self.data, other) return compare class BaseColumn(object): __metaclass__ = abc.ABCMeta meta = MetaData() # Define comparison operators __eq__ = _column_compare(operator.eq) __ne__ = _column_compare(operator.ne) __lt__ = _column_compare(operator.lt) __le__ = _column_compare(operator.le) __gt__ = _column_compare(operator.gt) __ge__ = _column_compare(operator.ge) def __array_finalize__(self, obj): # Obj will be none for direct call to Column() creator if obj is None: return # Self was created from template (e.g. obj[slice] or (obj * 2)) # or viewcast e.g. obj.view(Column). In either case we want to # init Column attributes for self from obj if possible. self.parent_table = None for attr in ('name', 'unit', 'format', 'description'): val = getattr(obj, attr, None) setattr(self, attr, val) self.meta = deepcopy(getattr(obj, 'meta', {})) def __array_wrap__(self, out_arr, context=None): """ __array_wrap__ is called at the end of every ufunc. If the output is the same shape as the column then call the standard ndarray __array_wrap__ which will return a Column object. If instead the output shape is different (e.g. for reduction ufuncs like sum() or mean()) then return the output viewed as a standard np.ndarray. The "[()]" selects everything, but also converts a zero rank array to a scalar. For some reason np.sum() returns a zero rank scalar array while np.mean() returns a scalar. So the [()] is needed for this case. """ if self.shape == out_arr.shape: return np.ndarray.__array_wrap__(self, out_arr, context) else: return out_arr.view(np.ndarray)[()] @property def name(self): return self._name @name.setter def name(self, val): if self.parent_table is not None: table = self.parent_table table.columns._rename_column(self.name, val) table._data.dtype.names = table.columns.keys() if table.masked: table._data.mask.dtype.names = table.columns.keys() self._name = val @property def descr(self): """Array-interface compliant full description of the column. This returns a 3-tuple (name, type, shape) that can always be used in a structured array dtype definition. """ return (self.name, self.dtype.str, self.shape[1:]) def __repr__(self): unit = None if self.unit is None else str(self.unit) out = "<{0} name={1} unit={2} format={3} " \ "description={4}>\n{5}".format( self.__class__.__name__, repr(self.name), repr(unit), repr(self.format), repr(self.description), repr(self.data)) return out def iter_str_vals(self): """ Return an iterator that yields the string-formatted values of this column. Returns ------- str_vals : iterator Column values formatted as strings """ # pprint._pformat_col_iter(col, max_lines, show_name, show_unit, outs) # Iterate over formatted values with no max number of lines, no column # name, no unit, and ignoring the returned header info in outs. for str_val in _pformat_col_iter(self, -1, False, False, {}): yield str_val def attrs_equal(self, col): """Compare the column attributes of ``col`` to this object. The comparison attributes are: name, unit, dtype, format, description, and meta. Parameters ---------- col : Column Comparison column Returns ------- equal: boolean True if all attributes are equal """ if not isinstance(col, BaseColumn): raise ValueError('Comparison `col` must be a Column or MaskedColumn object') attrs = ('name', 'unit', 'dtype', 'format', 'description', 'meta') equal = all(getattr(self, x) == getattr(col, x) for x in attrs) return equal def pformat(self, max_lines=None, show_name=True, show_unit=False): """Return a list of formatted string representation of column values. If no value of `max_lines` is supplied then the height of the screen terminal is used to set `max_lines`. If the terminal height cannot be determined then the default will be determined using the `astropy.table.pprint.MAX_LINES` configuration item. If a negative value of `max_lines` is supplied then there is no line limit applied. Parameters ---------- max_lines : int Maximum lines of output (header + data rows) show_name : bool Include column name (default=True) show_unit : bool Include a header row for unit (default=False) Returns ------- lines : list List of lines with header and formatted column values """ lines, n_header = _pformat_col(self, max_lines, show_name, show_unit) return lines def pprint(self, max_lines=None, show_name=True, show_unit=False): """Print a formatted string representation of column values. If no value of `max_lines` is supplied then the height of the screen terminal is used to set `max_lines`. If the terminal height cannot be determined then the default will be determined using the `astropy.table.pprint.MAX_LINES` configuration item. If a negative value of `max_lines` is supplied then there is no line limit applied. Parameters ---------- max_lines : int Maximum number of values in output show_name : bool Include column name (default=True) show_unit : bool Include a header row for unit (default=False) """ lines, n_header = _pformat_col(self, max_lines, show_name, show_unit) for i, line in enumerate(lines): if i < n_header: color_print(line, 'red') else: print line def more(self, max_lines=None, show_name=True, show_unit=False): """Interactively browse column with a paging interface. Supported keys:: f, : forward one page b : back one page r : refresh same page n : next row p : previous row < : go to beginning > : go to end q : quit browsing h : print this help Parameters ---------- max_lines : int Maximum number of lines in table output show_name : bool Include a header row for column names (default=True) show_unit : bool Include a header row for unit (default=False) """ _more_tabcol(self, max_lines=max_lines, show_name=show_name, show_unit=show_unit) @property def unit(self): """ The unit associated with this column. May be a string or a `astropy.units.UnitBase` instance. Setting the `unit` property does not change the values of the data. To perform a unit conversion, use `convert_unit_to`. """ return self._unit @unit.setter def unit(self, unit): if unit is None: self._unit = None else: self._unit = Unit(unit, parse_strict='silent') @unit.deleter def unit(self): self._unit = None @property @deprecated('0.3', alternative=':attr:`Column.unit`') def units(self): return self.unit @units.setter @deprecated('0.3', alternative=':attr:`Column.unit`') def units(self, unit): self.unit = unit @units.deleter @deprecated('0.3', alternative=':attr:`Column.unit`') def units(self): del self.unit def convert_unit_to(self, new_unit, equivalencies=[]): """ Converts the values of the column in-place from the current unit to the given unit. To change the unit associated with this column without actually changing the data values, simply set the `unit` property. Parameters ---------- new_unit : str or `astropy.units.UnitBase` instance The unit to convert to. equivalencies : list of equivalence pairs, optional A list of equivalence pairs to try if the unit are not directly convertible. See :ref:`unit_equivalencies`. Raises ------ astropy.units.UnitsError If units are inconsistent """ if self.unit is None: raise ValueError("No unit set on column") self.data[:] = self.unit.to( new_unit, self.data, equivalencies=equivalencies) self.unit = new_unit def __str__(self): lines, n_header = _pformat_col(self) return '\n'.join(lines) @property def groups(self): if not hasattr(self, '_groups'): self._groups = groups.ColumnGroups(self) return self._groups def group_by(self, keys): """ Group this column by the specified ``keys`` This effectively splits the column into groups which correspond to unique values of the ``keys`` grouping object. The output is a new `Column` or `MaskedColumn` which contains a copy of this column but sorted by row according to ``keys``. The ``keys`` input to `group_by` must be a numpy array with the same length as this column. Parameters ---------- keys : numpy array Key grouping object Returns ------- out : Column New column with groups attribute set accordingly """ return groups.column_group_by(self, keys) def _copy_groups(self, out): """ Copy current groups into a copy of self ``out`` """ if self.parent_table: if hasattr(self.parent_table, '_groups'): out._groups = groups.ColumnGroups(out, indices=self.parent_table._groups._indices) elif hasattr(self, '_groups'): out._groups = groups.ColumnGroups(out, indices=self._groups._indices) class Column(BaseColumn, np.ndarray): """Define a data column for use in a Table object. Parameters ---------- data : list, ndarray or None Column data values name : str Column name and key for reference within Table dtype : numpy.dtype compatible value Data type for column shape : tuple or () Dimensions of a single row element in the column data length : int or 0 Number of row elements in column data description : str or None Full description of column unit : str or None Physical unit format : str or None or function Format string for outputting column values. This can be an "old-style" (``format % value``) or "new-style" (`str.format`) format specification string or a function that accepts a single value and returns a string. meta : dict-like or None Meta-data associated with the column Examples -------- A Column can be created in two different ways: - Provide a ``data`` value but not ``shape`` or ``length`` (which are inferred from the data). Examples:: col = Column(data=[1, 2], name='name') # shape=(2,) col = Column(data=[[1, 2], [3, 4]], name='name') # shape=(2, 2) col = Column(data=[1, 2], name='name', dtype=float) col = Column(data=np.array([1, 2]), name='name') col = Column(data=['hello', 'world'], name='name') The ``dtype`` argument can be any value which is an acceptable fixed-size data-type initializer for the numpy.dtype() method. See ``_. Examples include: - Python non-string type (float, int, bool) - Numpy non-string type (e.g. np.float32, np.int64, np.bool) - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15') If no ``dtype`` value is provide then the type is inferred using ``np.array(data)``. - Provide ``length`` and optionally ``shape``, but not ``data`` Examples:: col = Column(name='name', length=5) col = Column(name='name', dtype=int, length=10, shape=(3,4)) The default ``dtype`` is ``np.float64``. The ``shape`` argument is the array shape of a single cell in the column. .. warning:: In the next major release of `astropy` (0.3), the order of function arguments for creating a |Column| will change. Currently the order is ``Column(name, data, ...)``, but in 0.3 and later it will be ``Column(data, name, ...)``. This improves consistency with |Table| and `numpy`. In order to use the same code for Astropy 0.2 and 0.3, column objects should always be created using named keyword arguments for ``data`` and ``name``, for instance ``c = Column(data=[1, 2], name='col')``. When Astropy 0.3 is released then the the keyword identifiers can be dropped, allowing for ``c = Column([1, 2], 'c')``. """ @_check_column_new_args def __new__(cls, data=None, name=None, dtype=None, shape=(), length=0, description=None, unit=None, format=None, meta=None, dtypes=None, units=None): if dtypes is not None: dtype = dtypes warnings.warn("'dtypes' has been renamed to the singular 'dtype'.", AstropyDeprecationWarning) if units is not None: unit = units warnings.warn("'units' has been renamed to the singular 'unit'.", AstropyDeprecationWarning) if data is None: dtype = (np.dtype(dtype).str, shape) self_data = np.zeros(length, dtype=dtype) elif isinstance(data, Column): self_data = np.asarray(data.data, dtype=dtype) if description is None: description = data.description if unit is None: unit = unit or data.unit if format is None: format = data.format if meta is None: meta = deepcopy(data.meta) if name is None: name = data.name elif isinstance(data, MaskedColumn): raise TypeError("Cannot convert a MaskedColumn to a Column") elif isinstance(data, Quantity): if unit is None: self_data = np.asarray(data, dtype=dtype) unit = data.unit else: self_data = np.asarray(data.to(unit), dtype=dtype) else: self_data = np.asarray(data, dtype=dtype) self = self_data.view(cls) self._name = name self.unit = unit self.format = format self.description = description self.parent_table = None self.meta = meta return self @property def data(self): return self.view(np.ndarray) def copy(self, order='C', data=None, copy_data=True): """Return a copy of the current Column instance. If ``data`` is supplied then a view (reference) of ``data`` is used, and ``copy_data`` is ignored. """ if data is None: data = self.view(np.ndarray) if copy_data: data = data.copy(order) out = Column(name=self.name, data=data, unit=self.unit, format=self.format, description=self.description, meta=deepcopy(self.meta)) self._copy_groups(out) return out class MaskedColumn(BaseColumn, ma.MaskedArray): """Define a masked data column for use in a Table object. Parameters ---------- data : list, ndarray or None Column data values name : str Column name and key for reference within Table mask : list, ndarray or None Boolean mask for which True indicates missing or invalid data fill_value : float, int, str or None Value used when filling masked column elements dtype : numpy.dtype compatible value Data type for column shape : tuple or () Dimensions of a single row element in the column data length : int or 0 Number of row elements in column data description : str or None Full description of column unit : str or None Physical unit format : str or None or function Format string for outputting column values. This can be an "old-style" (``format % value``) or "new-style" (`str.format`) format specification string or a function that accepts a single value and returns a string. meta : dict-like or None Meta-data associated with the column Examples -------- A MaskedColumn is similar to a Column except that it includes ``mask`` and ``fill_value`` attributes. It can be created in two different ways: - Provide a ``data`` value but not ``shape`` or ``length`` (which are inferred from the data). Examples:: col = MaskedColumn(data=[1, 2], name='name') col = MaskedColumn(data=[1, 2], name='name', mask=[True, False]) col = MaskedColumn(data=[1, 2], name='name', dtype=float, fill_value=99) The ``mask`` argument will be cast as a boolean array and specifies which elements are considered to be missing or invalid. The ``dtype`` argument can be any value which is an acceptable fixed-size data-type initializer for the numpy.dtype() method. See ``_. Examples include: - Python non-string type (float, int, bool) - Numpy non-string type (e.g. np.float32, np.int64, np.bool) - Numpy.dtype array-protocol type strings (e.g. 'i4', 'f8', 'S15') If no ``dtype`` value is provide then the type is inferred using ``np.array(data)``. When ``data`` is provided then the ``shape`` and ``length`` arguments are ignored. - Provide ``length`` and optionally ``shape``, but not ``data`` Examples:: col = MaskedColumn(name='name', length=5) col = MaskedColumn(name='name', dtype=int, length=10, shape=(3,4)) The default ``dtype`` is ``np.float64``. The ``shape`` argument is the array shape of a single cell in the column. .. warning:: In the next major release of `astropy` (0.3), the order of function arguments for creating a |MaskedColumn| will change. Currently the order is ``MaskedColumn(name, data, ...)``, but in 0.3 and later it will be ``MaskedColumn(data, name, ...)``. This improves consistency with |Table| and `numpy`. In order to use the same code for Astropy 0.2 and 0.3, column objects should always be created using named keyword arguments for ``data`` and ``name``, for instance ``c = MaskedColumn(data=[1, 2], name='col')``. When Astropy 0.3 is released then the the keyword identifiers can be dropped, allowing for ``c = MaskedColumn([1, 2], 'c')``. """ @_check_column_new_args def __new__(cls, data=None, name=None, mask=None, fill_value=None, dtype=None, shape=(), length=0, description=None, unit=None, format=None, meta=None, units=None, dtypes=None): if dtypes is not None: dtype = dtypes warnings.warn("'dtypes' has been renamed to the singular 'dtype'.", AstropyDeprecationWarning) if units is not None: unit = units warnings.warn("'units' has been renamed to the singular 'unit'.", AstropyDeprecationWarning) if data is None: dtype = (np.dtype(dtype).str, shape) self_data = ma.zeros(length, dtype=dtype) elif isinstance(data, (Column, MaskedColumn)): self_data = ma.asarray(data.data, dtype=dtype) if description is None: description = data.description if unit is None: unit = unit or data.unit if format is None: format = data.format if meta is None: meta = deepcopy(data.meta) if name is None: name = data.name elif isinstance(data, Quantity): if unit is None: self_data = ma.asarray(data, dtype=dtype) unit = data.unit else: self_data = ma.asarray(data.to(unit), dtype=dtype) else: self_data = ma.asarray(data, dtype=dtype) self = self_data.view(MaskedColumn) if mask is None and hasattr(data, 'mask'): mask = data.mask if fill_value is None and hasattr(data, 'fill_value'): fill_value = data.fill_value self.mask = mask self.fill_value = fill_value self._name = name self.unit = unit self.format = format self.description = description self.parent_table = None self.meta = meta return self def __array_finalize__(self, obj): BaseColumn.__array_finalize__(self, obj) ma.MaskedArray.__array_finalize__(self, obj) def _fix_fill_value(self, val): """Fix a fill value (if needed) to work around a bug with setting the fill value of a string array in MaskedArray with Python 3.x. See https://github.com/numpy/numpy/pull/2733. This mimics the check in numpy.ma.core._check_fill_value() (version < 1.7) which incorrectly sets fill_value to a default if self.dtype.char is 'U' (which is the case for Python 3). Here we change the string to a byte string so that in Python 3 the isinstance(val, basestring) part fails. """ if isinstance(val, basestring) and (self.dtype.char not in 'SV'): val = val.encode() return val @property def fill_value(self): return self.get_fill_value() # defer to native ma.MaskedArray method @fill_value.setter def fill_value(self, val): """Set fill value both in the masked column view and in the parent table if it exists. Setting one or the other alone doesn't work.""" val = self._fix_fill_value(val) if self.parent_table: self.parent_table._data[self._name].fill_value = val # Yet another ma bug workaround: If the value of fill_value for a string array is # requested but not yet set then it gets created as 'N/A'. From this point onward # any new fill_values are truncated to 3 characters. Note that this does not # occur if the masked array is a structured array (as in the previous block that # deals with the parent table). # # >>> x = ma.array(['xxxx']) # >>> x.fill_value # fill_value now gets represented as an 'S3' array # 'N/A' # >>> x.fill_value='yyyy' # >>> x.fill_value # 'yyy' # # To handle this we are forced to reset a private variable first: self._fill_value = None self.set_fill_value(val) # defer to native ma.MaskedArray method @property def data(self): out = self.view(ma.MaskedArray) # The following is necessary because of a bug in Numpy, which was # fixed in numpy/numpy#2703. The fix should be included in Numpy 1.8.0. out.fill_value = self.fill_value return out def filled(self, fill_value=None): """Return a copy of self, with masked values filled with a given value. Parameters ---------- fill_value : scalar; optional The value to use for invalid entries (None by default). If None, the `fill_value` attribute of the array is used instead. Returns ------- filled_column : Column A copy of ``self`` with masked entries replaced by `fill_value` (be it the function argument or the attribute of ``self``). """ if fill_value is None: fill_value = self.fill_value fill_value = self._fix_fill_value(fill_value) data = super(MaskedColumn, self).filled(fill_value) out = Column(name=self.name, data=data, unit=self.unit, format=self.format, description=self.description, meta=deepcopy(self.meta)) return out def copy(self, order='C', data=None, copy_data=True): """ Return a copy of the current MaskedColumn instance. If ``data`` is supplied then a view (reference) of ``data`` is used, and ``copy_data`` is ignored. Parameters ---------- data : array; optional Data to use when creating MaskedColumn copy. If not supplied the column data array is used. copy_data : bool; optional Make a copy of input data instead of using a reference (default=True) Returns ------- column : MaskedColumn A copy of ``self`` """ if data is None: data = self.view(ma.MaskedArray) if copy_data: data = data.copy(order) out = MaskedColumn(name=self.name, data=data, unit=self.unit, format=self.format, # Do not include mask=self.mask since `data` has the mask fill_value=self.fill_value, description=self.description, meta=deepcopy(self.meta)) self._copy_groups(out) return out class Row(object): """A class to represent one row of a Table object. A Row object is returned when a Table object is indexed with an integer or when iterating over a table:: >>> table = Table([(1, 2), (3, 4)], names=('a', 'b'), ... dtype=('int32', 'int32')) >>> row = table[1] >>> row >>> row['a'] 2 >>> row[1] 4 """ def __init__(self, table, index): self._table = table self._index = index try: self._data = table._data[index] # MaskedArray __getitem__ has a strange behavior where if a # row mask is all False then it returns a np.void which # has no mask attribute. This makes it impossible to then set # the mask. Here we recast back to mvoid. This was fixed in # Numpy following issue numpy/numpy#483, and the fix should be # included in Numpy 1.8.0. if self._table.masked and isinstance(self._data, np.void): self._data = ma.core.mvoid(self._data, mask=self._table._mask[index]) except ValueError as err: # Another bug (or maybe same?) that is fixed in 1.8 prevents accessing # a row in masked array if it has object-type members. # >>> x = np.ma.empty(1, dtype=[('a', 'O')]) # >>> x['a'] = 1 # >>> x['a'].mask = True # >>> x[0] # ValueError: Setting void-array with object members using buffer. [numpy.ma.core] # # All we do here is re-raise with a more informative message if (str(err).startswith('Setting void-array with object members') and version.LooseVersion(np.__version__) < version.LooseVersion('1.8')): raise ValueError('Cannot access table row with Object type columns, due to ' 'a bug in numpy {0}. Please upgrade to numpy 1.8 or newer.' .format(np.__version__)) else: raise def __getitem__(self, item): return self.data[item] def __setitem__(self, item, val): self.data[item] = val def __eq__(self, other): if self._table.masked: # Sent bug report to numpy-discussion group on 2012-Oct-21, subject: # "Comparing rows in a structured masked array raises exception" # No response, so this is still unresolved. raise ValueError('Unable to compare rows for masked table due to numpy.ma bug') return self.data == other def __ne__(self, other): if self._table.masked: raise ValueError('Unable to compare rows for masked table due to numpy.ma bug') return self.data != other @property def _mask(self): return self._data.mask def __array__(self, dtype=None): """Support converting Row to np.array via np.array(table). Coercion to a different dtype via np.array(table, dtype) is not supported and will raise a ValueError. """ if dtype is not None: raise ValueError('Datatype coercion is not allowed') return np.array(self._data) def __len__(self): return len(self._data.dtype) @property def table(self): return self._table @property def index(self): return self._index @property def data(self): return self._data @property def meta(self): return self.table.meta @property def columns(self): return self.table.columns @property def colnames(self): return self.table.colnames @property def dtype(self): return self.data.dtype @property @deprecated('0.3', alternative=':attr:`Row.dtype`', pending=False) def dtypes(self): return self.dtype def __repr__(self): return "".format( self.index, self.data, self.dtype) collections.Sequence.register(Row) class Table(object): """A class to represent tables of heterogeneous data. `Table` provides a class for heterogeneous tabular data, making use of a `numpy` structured array internally to store the data values. A key enhancement provided by the `Table` class is the ability to easily modify the structure of the table by adding or removing columns, or adding new rows of data. In addition table and column metadata are fully supported. `Table` differs from `NDData` by the assumption that the input data consists of columns of homogeneous data, where each column has a unique identifier and may contain additional metadata such as the data unit, format, and description. Parameters ---------- data : numpy ndarray, dict, list, or Table, optional Data to initialize table. masked : bool, optional Specify whether the table is masked. names : list, optional Specify column names dtype : list, optional Specify column data types meta : dict, optional Metadata associated with the table. copy : bool, optional Copy the input data (default=True). """ meta = MetaData() def __init__(self, data=None, masked=None, names=None, dtype=None, meta=None, copy=True, dtypes=None): if dtypes is not None: dtype = dtypes warnings.warn("'dtypes' has been renamed to the singular 'dtype'.", AstropyDeprecationWarning) # Set up a placeholder empty table self._data = None self._set_masked(masked) self.columns = TableColumns() self.meta = meta # Must copy if dtype are changing if not copy and dtype is not None: raise ValueError('Cannot specify dtype when copy=False') # Infer the type of the input data and set up the initialization # function, number of columns, and potentially the default col names default_names = None if isinstance(data, Row): data = data._table[data._index:data._index + 1] if isinstance(data, (list, tuple)): init_func = self._init_from_list if data and all(isinstance(row, dict) for row in data): n_cols = len(data[0]) else: n_cols = len(data) elif isinstance(data, np.ndarray): if data.dtype.names: init_func = self._init_from_ndarray # _struct n_cols = len(data.dtype.names) default_names = data.dtype.names else: init_func = self._init_from_ndarray # _homog n_cols = data.shape[1] elif isinstance(data, dict): init_func = self._init_from_dict n_cols = len(data.keys()) default_names = data.keys() elif isinstance(data, Table): init_func = self._init_from_table n_cols = len(data.colnames) default_names = data.colnames elif data is None: if names is None: return # Empty table else: init_func = self._init_from_list n_cols = len(names) data = [[]] * n_cols else: raise ValueError('Data type {0} not allowed to init Table' .format(type(data))) # Set up defaults if names and/or dtype are not specified. # A value of None means the actual value will be inferred # within the appropriate initialization routine, either from # existing specification or auto-generated. if names is None: names = default_names or [None] * n_cols if dtype is None: dtype = [None] * n_cols self._check_names_dtype(names, dtype, n_cols) # Finally do the real initialization init_func(data, names, dtype, n_cols, copy) # Whatever happens above, the masked property should be set to a boolean if type(self.masked) != bool: raise TypeError("masked property has not been set to True or False") @property def mask(self): return self._data.mask if self.masked else None @mask.setter def mask(self, val): self._data.mask = val @property def _mask(self): """This is needed due to intricacies in numpy.ma, don't remove it.""" return self._data.mask def filled(self, fill_value=None): """Return a copy of self, with masked values filled. If input ``fill_value`` supplied then that value is used for all masked entries in the table. Otherwise the individual ``fill_value`` defined for each table column is used. Returns ------- filled_table : Table New table with masked values filled """ if self.masked: data = [col.filled(fill_value) for col in self.columns.values()] else: data = self return self.__class__(data, meta=deepcopy(self.meta)) def __array__(self, dtype=None): """Support converting Table to np.array via np.array(table). Coercion to a different dtype via np.array(table, dtype) is not supported and will raise a ValueError. """ if dtype is not None: raise ValueError('Datatype coercion is not allowed') # This limitation is because of the following unexpected result that # should have made a table copy while changing the column names. # # >>> d = astropy.table.Table([[1,2],[3,4]]) # >>> np.array(d, dtype=[('a', 'i8'), ('b', 'i8')]) # array([(0, 0), (0, 0)], # dtype=[('a', '{0}".format(css)] html = "\n".join(['',''] + css + js + linelist + ['']) try: tmp.write(html) except TypeError: tmp.write(html.encode('utf8')) tmp.flush() if browser == 'default': webbrowser.open("file://"+tmp.name) else: webbrowser.get(browser).open("file://"+tmp.name) return tmp def pformat(self, max_lines=None, max_width=None, show_name=True, show_unit=False, html=False, tableid=None): """Return a list of lines for the formatted string representation of the table. If no value of `max_lines` is supplied then the height of the screen terminal is used to set `max_lines`. If the terminal height cannot be determined then the default is taken from the configuration item `astropy.table.pprint.MAX_LINES`. If a negative value of `max_lines` is supplied then there is no line limit applied. The same applies for max_width except the configuration item is `astropy.table.pprint.MAX_WIDTH`. Parameters ---------- max_lines : int or None Maximum number of rows to output max_width : int or None Maximum character width of output show_name : bool Include a header row for column names (default=True) show_unit : bool Include a header row for unit (default=False) html : bool Format the output as an HTML table (default=False) tableid : str or None An ID tag for the table; only used if html is set. Default is "table{id}", where id is the unique integer id of the table object, id(self) Returns ------- lines : list Formatted table as a list of strings """ lines, n_header = _pformat_table(self, max_lines, max_width, show_name, show_unit, html, tableid=tableid) return lines def more(self, max_lines=None, max_width=None, show_name=True, show_unit=False): """Interactively browse table with a paging interface. Supported keys:: f, : forward one page b : back one page r : refresh same page n : next row p : previous row < : go to beginning > : go to end q : quit browsing h : print this help Parameters ---------- max_lines : int Maximum number of lines in table output max_width : int or None Maximum character width of output show_name : bool Include a header row for column names (default=True) show_unit : bool Include a header row for unit (default=False) """ _more_tabcol(self, max_lines, max_width, show_name, show_unit) def _repr_html_(self): # Since the user cannot provide input, need a sensible default tableid = 'table{id}'.format(id=id(self)) lines = self.pformat(html=True, tableid=tableid) return ''.join(lines) def __getitem__(self, item): if isinstance(item, basestring): return self.columns[item] elif isinstance(item, int): return Row(self, item) elif isinstance(item, (tuple, list)) and all(x in self.colnames for x in item): out = self.__class__([self[x] for x in item], meta=deepcopy(self.meta)) out._groups = groups.TableGroups(out, indices=self.groups._indices, keys=self.groups._keys) return out elif (isinstance(item, slice) or isinstance(item, np.ndarray) or isinstance(item, list) or isinstance(item, tuple) and all(isinstance(x, np.ndarray) for x in item)): # here for the many ways to give a slice; a tuple of ndarray # is produced by np.where, as in t[np.where(t['a'] > 2)] # For all, a new table is constructed with slice of all columns return self._new_from_slice(item) else: raise ValueError('Illegal type {0} for table item access' .format(type(item))) def __setitem__(self, item, value): # If the item is a string then it must be the name of a column. # If that column doesn't already exist then create it now. if isinstance(item, basestring) and item not in self.colnames: NewColumn = MaskedColumn if self.masked else Column # Make sure value is an ndarray so we can get the dtype if not isinstance(value, np.ndarray): value = np.asarray(value) # Make new column and assign the value. If the table currently has no rows # (len=0) of the value is already a Column then define new column directly # from value. In the latter case this allows for propagation of Column # metadata. Otherwise define a new column with the right length and shape and # then set it from value. This allows for broadcasting, e.g. t['a'] = 1. if isinstance(value, BaseColumn): new_column = value.copy(copy_data=False) new_column.name = item elif len(self) == 0: new_column = NewColumn(name=item, data=value) else: new_column = NewColumn(name=item, length=len(self), dtype=value.dtype, shape=value.shape[1:]) new_column[:] = value if isinstance(value, Quantity): new_column.unit = value.unit # Now add new column to the table self.add_column(new_column) elif isinstance(value, Row): # Value is another row self._data[item] = value.data else: # Otherwise just delegate to the numpy item setter. self._data[item] = value def __delitem__(self, item): if isinstance(item, basestring): self.remove_column(item) elif isinstance(item, tuple): self.remove_columns(item) def __iter__(self): self._iter_index = 0 return self def __next__(self): """Python 3 iterator""" if self._iter_index < len(self._data): val = self[self._iter_index] self._iter_index += 1 return val else: raise StopIteration if sys.version_info[0] < 3: # pragma: py2 next = __next__ def field(self, item): """Return column[item] for recarray compatibility.""" return self.columns[item] @property def masked(self): return self._masked @masked.setter def masked(self, masked): raise Exception('Masked attribute is read-only (use t = Table(t, masked=True)' ' to convert to a masked table)') def _set_masked(self, masked): """ Set the table masked property. Parameters ---------- masked : bool State of table masking (True or False) """ if hasattr(self, '_masked'): # The only allowed change is from None to False or True, or False to True if self._masked is None and masked in [False, True]: self._masked = masked elif self._masked is False and masked is True: log.info("Upgrading Table to masked Table") self._masked = masked elif self._masked is masked: raise Exception("Masked attribute is already set to {0}".format(masked)) else: raise Exception("Cannot change masked attribute to {0} once it is set to {1}" .format(masked, self._masked)) else: if masked in [True, False, None]: self._masked = masked else: raise ValueError("masked should be one of True, False, None") if self._masked: self._column_class = MaskedColumn else: self._column_class = Column @property def ColumnClass(self): if self._column_class is None: return Column else: return self._column_class @property def dtype(self): return self._data.dtype @property def colnames(self): return list(self.columns.keys()) def keys(self): return list(self.columns.keys()) def __len__(self): if self._data is None: return 0 else: return len(self._data) def create_mask(self): if isinstance(self._data, ma.MaskedArray): raise Exception("data array is already masked") else: self._data = ma.array(self._data) def index_column(self, name): """ Return the positional index of column ``name``. Parameters ---------- name : str column name Returns ------- index : int Positional index of column ``name``. Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Get index of column 'b' of the table:: >>> t.index_column('b') 1 """ try: return self.colnames.index(name) except ValueError: raise ValueError("Column {0} does not exist".format(name)) def add_column(self, col, index=None): """ Add a new Column object ``col`` to the table. If ``index`` is supplied then insert column before ``index`` position in the list of columns, otherwise append column to the end of the list. Parameters ---------- col : Column Column object to add. index : int or None Insert column before this position or at end (default) Examples -------- Create a table with two columns 'a' and 'b':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b')) >>> print t a b --- --- 1 0.1 2 0.2 3 0.3 Create a third column 'c' and append it to the end of the table:: >>> col_c = Column(name='c', data=['x', 'y', 'z']) >>> t.add_column(col_c) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Add column 'd' at position 1. Note that the column is inserted before the given index:: >>> col_d = Column(name='d', data=['a', 'b', 'c']) >>> t.add_column(col_d, 1) >>> print t a d b c --- --- --- --- 1 a 0.1 x 2 b 0.2 y 3 c 0.3 z To add several columns use add_columns. """ if index is None: index = len(self.columns) self.add_columns([col], [index]) def add_columns(self, cols, indexes=None): """ Add a list of new Column objects ``cols`` to the table. If a corresponding list of ``indexes`` is supplied then insert column before each ``index`` position in the *original* list of columns, otherwise append columns to the end of the list. Parameters ---------- cols : list of Columns Column objects to add. indexes : list of ints or None Insert column before this position or at end (default) Examples -------- Create a table with two columns 'a' and 'b':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b')) >>> print t a b --- --- 1 0.1 2 0.2 3 0.3 Create column 'c' and 'd' and append them to the end of the table:: >>> col_c = Column(name='c', data=['x', 'y', 'z']) >>> col_d = Column(name='d', data=['u', 'v', 'w']) >>> t.add_columns([col_c, col_d]) >>> print t a b c d --- --- --- --- 1 0.1 x u 2 0.2 y v 3 0.3 z w Add column 'c' at position 0 and column 'd' at position 1. Note that the columns are inserted before the given position:: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3]], names=('a', 'b')) >>> col_c = Column(name='c', data=['x', 'y', 'z']) >>> col_d = Column(name='d', data=['u', 'v', 'w']) >>> t.add_columns([col_c, col_d], [0, 1]) >>> print t c a d b --- --- --- --- x 1 u 0.1 y 2 v 0.2 z 3 w 0.3 """ if indexes is None: indexes = [len(self.columns)] * len(cols) elif len(indexes) != len(cols): raise ValueError('Number of indexes must match number of cols') if self._data is None: # No existing table data, init from cols newcols = cols else: newcols = list(self.columns.values()) new_indexes = list(range(len(newcols) + 1)) for col, index in zip(cols, indexes): i = new_indexes.index(index) new_indexes.insert(i, None) newcols.insert(i, col) self._init_from_cols(newcols) def remove_row(self, index): """ Remove a row from the table. Parameters ---------- index : int Index of row to remove Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Remove row 1 from the table:: >>> t.remove_row(1) >>> print t a b c --- --- --- 1 0.1 x 3 0.3 z To remove several rows at the same time use remove_rows. """ # check the index against the types that work with np.delete if not isinstance(index, (int, long, np.integer)): raise TypeError("Row index must be an integer") self.remove_rows(index) def remove_rows(self, row_specifier): """ Remove rows from the table. Parameters ---------- row_specifier : slice, int, or array of ints Specification for rows to remove Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Remove rows 0 and 2 from the table:: >>> t.remove_rows([0, 2]) >>> print t a b c --- --- --- 2 0.2 y Note that there are no warnings if the slice operator extends outside the data:: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> t.remove_rows(slice(10, 20, 1)) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z """ try: table = np.delete(self._data, row_specifier, axis=0) except (ValueError, IndexError): # Numpy <= 1.7 raises ValueError while Numpy >= 1.8 raises IndexError raise IndexError('Removing row(s) {0} from table with {1} rows failed' .format(row_specifier, len(self._data))) self._data = table # after updating the row data, the column views will be out of date # and should be updated: self._rebuild_table_column_views() # Revert groups to default (ungrouped) state if hasattr(self, '_groups'): del self._groups def remove_column(self, name): """ Remove a column from the table. This can also be done with:: del table[name] Parameters ---------- name : str Name of column to remove Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Remove column 'b' from the table:: >>> t.remove_column('b') >>> print t a c --- --- 1 x 2 y 3 z To remove several columns at the same time use remove_columns. """ self.remove_columns([name]) def remove_columns(self, names): ''' Remove several columns from the table Parameters ---------- names : list A list containing the names of the columns to remove Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Remove columns 'b' and 'c' from the table:: >>> t.remove_columns(['b', 'c']) >>> print t a --- 1 2 3 Specifying only a single column also works. Remove column 'b' from the table:: >>> t = Table([[1, 2, 3], [0.1, 0.2, 0.3], ['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> t.remove_columns('b') >>> print t a c --- --- 1 x 2 y 3 z This gives the same as using remove_column. ''' for name in names: if name not in self.columns: raise KeyError("Column {0} does not exist".format(name)) for name in names: self.columns.pop(name) newdtype = [(name, self._data.dtype[name]) for name in self._data.dtype.names if name not in names] newdtype = np.dtype(newdtype) if newdtype: if self.masked: table = np.ma.empty(self._data.shape, dtype=newdtype) else: table = np.empty(self._data.shape, dtype=newdtype) for field in newdtype.fields: table[field] = self._data[field] if self.masked: table[field].fill_value = self._data[field].fill_value else: table = None self._data = table def keep_columns(self, names): ''' Keep only the columns specified (remove the others). Parameters ---------- names : list A list containing the names of the columns to keep. All other columns will be removed. Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> print t a b c --- --- --- 1 0.1 x 2 0.2 y 3 0.3 z Specifying only a single column name keeps only this column. Keep only column 'a' of the table:: >>> t.keep_columns('a') >>> print t a --- 1 2 3 Specifying a list of column names is keeps is also possible. Keep columns 'a' and 'c' of the table:: >>> t = Table([[1, 2, 3],[0.1, 0.2, 0.3],['x', 'y', 'z']], ... names=('a', 'b', 'c')) >>> t.keep_columns(['a', 'c']) >>> print t a c --- --- 1 x 2 y 3 z ''' if isinstance(names, basestring): names = [names] for name in names: if name not in self.columns: raise KeyError("Column {0} does not exist".format(name)) remove = list(set(self.keys()) - set(names)) self.remove_columns(remove) def rename_column(self, name, new_name): ''' Rename a column. This can also be done directly with by setting the ``name`` attribute for a column:: table[name].name = new_name Parameters ---------- name : str The current name of the column. new_name : str The new name for the column Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1,2],[3,4],[5,6]], names=('a','b','c')) >>> t.pprint() a b c --- --- --- 1 3 5 2 4 6 Renaming column 'a' to 'aa':: >>> t.rename_column('a' , 'aa') >>> t.pprint() aa b c --- --- --- 1 3 5 2 4 6 ''' if name not in self.keys(): raise KeyError("Column {0} does not exist".format(name)) self.columns[name].name = new_name def add_row(self, vals=None, mask=None): """Add a new row to the end of the table. The ``vals`` argument can be: sequence (e.g. tuple or list) Column values in the same order as table columns. mapping (e.g. dict) Keys corresponding to column names. Missing values will be filled with np.zeros for the column dtype. None All values filled with np.zeros for the column dtype. This method requires that the Table object "owns" the underlying array data. In particular one cannot add a row to a Table that was initialized with copy=False from an existing array. The ``mask`` attribute should give (if desired) the mask for the values. The type of the mask should match that of the values, i.e. if ``vals`` is an iterable, then ``mask`` should also be an iterable with the same length, and if ``vals`` is a mapping, then ``mask`` should be a dictionary. Parameters ---------- vals : tuple, list, dict or None Use the specified values in the new row Examples -------- Create a table with three columns 'a', 'b' and 'c':: >>> t = Table([[1,2],[4,5],[7,8]], names=('a','b','c')) >>> t.pprint() a b c --- --- --- 1 4 7 2 5 8 Adding a new row with entries '3' in 'a', '6' in 'b' and '9' in 'c':: >>> t.add_row([3,6,9]) >>> t.pprint() a b c --- --- --- 1 4 7 2 5 8 3 6 9 """ def _is_mapping(obj): """Minimal checker for mapping (dict-like) interface for obj""" attrs = ('__getitem__', '__len__', '__iter__', 'keys', 'values', 'items') return all(hasattr(obj, attr) for attr in attrs) newlen = len(self._data) + 1 if vals is None: vals = np.zeros(1, dtype=self._data.dtype)[0] if mask is not None and not self.masked: self._set_masked(True) # Create a table with one row to test the operation on test_data = (ma.zeros if self.masked else np.zeros)(1, dtype=self._data.dtype) if _is_mapping(vals): if mask is not None and not _is_mapping(mask): raise TypeError("Mismatch between type of vals and mask") # Now check that the mask is specified for the same keys as the # values, otherwise things get really confusing. if mask is not None and set(vals.keys()) != set(mask.keys()): raise ValueError('keys in mask should match keys in vals') if self.masked: # We set the mask to True regardless of whether a mask value # is specified or not - that is, any cell where a new row # value is not specified should be treated as missing. test_data.mask[-1] = (True,) * len(test_data.dtype) # First we copy the values for name, val in vals.items(): try: test_data[name][-1] = val except IndexError: raise ValueError("No column {0} in table".format(name)) if mask: test_data[name].mask[-1] = mask[name] elif isiterable(vals): if mask is not None and (not isiterable(mask) or _is_mapping(mask)): raise TypeError("Mismatch between type of vals and mask") if len(self.columns) != len(vals): raise ValueError('Mismatch between number of vals and columns') if not isinstance(vals, tuple): vals = tuple(vals) test_data[-1] = vals if mask is not None: if len(self.columns) != len(mask): raise ValueError('Mismatch between number of masks and columns') if not isinstance(mask, tuple): mask = tuple(mask) test_data.mask[-1] = mask else: raise TypeError('Vals must be an iterable or mapping or None') # If no errors have been raised, then the table can be resized if self.masked: if newlen == 1: self._data = ma.empty(1, dtype=self._data.dtype) else: self._data = ma.resize(self._data, (newlen,)) else: self._data.resize((newlen,), refcheck=False) # Assign the new row self._data[-1:] = test_data self._rebuild_table_column_views() # Revert groups to default (ungrouped) state if hasattr(self, '_groups'): del self._groups def argsort(self, keys=None, kind=None): """ Return the indices which would sort the table according to one or more key columns. This simply calls the `numpy.argsort` function on the table with the ``order`` parameter set to `keys`. Parameters ---------- keys : str or list of str The column name(s) to order the table by kind : {'quicksort', 'mergesort', 'heapsort'}, optional Sorting algorithm. Returns ------- index_array : ndarray, int Array of indices that sorts the table by the specified key column(s). """ if isinstance(keys, basestring): keys = [keys] kwargs = {} if keys: kwargs['order'] = keys if kind: kwargs['kind'] = kind return self._data.argsort(**kwargs) def sort(self, keys): ''' Sort the table according to one or more keys. This operates on the existing table and does not return a new table. Parameters ---------- keys : str or list of str The key(s) to order the table by Examples -------- Create a table with 3 columns:: >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'], ... [12,15,18]], names=('firstname','name','tel')) >>> t.pprint() firstname name tel --------- ------- --- Max Miller 12 Jo Miller 15 John Jackson 18 Sorting according to standard sorting rules, first 'name' then 'firstname':: >>> t.sort(['name','firstname']) >>> t.pprint() firstname name tel --------- ------- --- John Jackson 18 Jo Miller 15 Max Miller 12 ''' if type(keys) is not list: keys = [keys] self._data.sort(order=keys) self._rebuild_table_column_views() def reverse(self): ''' Reverse the row order of table rows. The table is reversed in place and there are no function arguments. Examples -------- Create a table with three columns:: >>> t = Table([['Max', 'Jo', 'John'], ['Miller','Miller','Jackson'], ... [12,15,18]], names=('firstname','name','tel')) >>> t.pprint() firstname name tel --------- ------- --- Max Miller 12 Jo Miller 15 John Jackson 18 Reversing order:: >>> t.reverse() >>> t.pprint() firstname name tel --------- ------- --- John Jackson 18 Jo Miller 15 Max Miller 12 ''' self._data[:] = self._data[::-1].copy() self._rebuild_table_column_views() @classmethod def read(cls, *args, **kwargs): """ Read and parse a data table and return as a Table. This function provides the Table interface to the astropy unified I/O layer. This allows easily reading a file in many supported data formats using syntax such as:: >>> from astropy.table import Table >>> dat = Table.read('table.dat', format='ascii') # doctest: +SKIP >>> events = Table.read('events.fits', format='fits') # doctest: +SKIP The arguments and keywords (other than ``format``) provided to this function are passed through to the underlying data reader (e.g. `~astropy.io.ascii.ui.read`). """ return io_registry.read(cls, *args, **kwargs) def write(self, *args, **kwargs): """ Write this Table object out in the specified format. This function provides the Table interface to the astropy unified I/O layer. This allows easily writing a file in many supported data formats using syntax such as:: >>> from astropy.table import Table >>> dat = Table([[1, 2], [3, 4]], names=('a', 'b')) >>> dat.write('table.dat', format='ascii') The arguments and keywords (other than ``format``) provided to this function are passed through to the underlying data reader (e.g. `~astropy.io.ascii.ui.write`). """ io_registry.write(self, *args, **kwargs) def copy(self, copy_data=True): ''' Return a copy of the table Parameters ---------- copy_data : bool If True (the default), copy the underlying data array. Otherwise, use the same data array ''' out = self.__class__(self, copy=copy_data) # If the current table is grouped then do the same in the copy if hasattr(self, '_groups'): out._groups = groups.TableGroups(out, indices=self._groups._indices, keys=self._groups._keys) return out def __deepcopy__(self, memo=None): return self.copy(True) def __copy__(self): return self.copy(False) def __lt__(self, other): if six.PY3: return super(Table, self).__lt__(other) else: raise TypeError("unorderable types: Table() < {0}".format(str(type(other)))) def __gt__(self, other): if six.PY3: return super(Table, self).__gt__(other) else: raise TypeError("unorderable types: Table() > {0}".format(str(type(other)))) def __le__(self, other): if six.PY3: return super(Table, self).__le__(other) else: raise TypeError("unorderable types: Table() <= {0}".format(str(type(other)))) def __ge__(self, other): if six.PY3: return super(Table, self).__ge__(other) else: raise TypeError("unorderable types: Table() >= {0}".format(str(type(other)))) def __eq__(self, other): if isinstance(other, Table): other = other._data if self.masked: if isinstance(other, np.ma.MaskedArray): result = self._data == other else: # If mask is True, then by definition the row doesn't match # because the other array is not masked. false_mask = np.zeros(1, dtype=[(n, bool) for n in self.dtype.names]) result = (self._data.data == other) & (self.mask == false_mask) else: if isinstance(other, np.ma.MaskedArray): # If mask is True, then by definition the row doesn't match # because the other array is not masked. false_mask = np.zeros(1, dtype=[(n, bool) for n in other.dtype.names]) result = (self._data == other.data) & (other.mask == false_mask) else: result = self._data == other return result def __ne__(self, other): return ~self.__eq__(other) @property def groups(self): if not hasattr(self, '_groups'): self._groups = groups.TableGroups(self) return self._groups def group_by(self, keys): """ Group this table by the specified ``keys`` This effectively splits the table into groups which correspond to unique values of the ``keys`` grouping object. The output is a new `GroupedTable` which contains a copy of this table but sorted by row according to ``keys``. The ``keys`` input to `group_by` can be specified in different ways: - String or list of strings corresponding to table column name(s) - Numpy array (homogeneous or structured) with same length as this table - `Table` with same length as this table Parameters ---------- keys : str, list of str, numpy array, or Table Key grouping object Returns ------- out : Table New table with groups set """ return groups.table_group_by(self, keys) astropy-0.3/astropy/table/__init__.py0000644000175000017500000000062212243255342016100 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from .table import Column, Table, TableColumns, Row, MaskedColumn from .np_utils import TableMergeError from .operations import join, hstack, vstack # Import routines that connect readers/writers to astropy.table from ..io.ascii import connect from ..io.fits import connect from ..io.misc import connect from ..io.votable import connect astropy-0.3/astropy/table/groups.py0000644000175000017500000003042212243255342015661 0ustar oleoleimport platform import warnings from itertools import izip, count import numpy as np from ..utils.exceptions import AstropyUserWarning __all__ = ['TableGroups', 'ColumnGroups'] def table_group_by(table, keys): """ Get groups for ``table`` on specified ``keys``. Parameters ---------- table : `Table` Table to group keys : str, list of str, `Table`, or Numpy array Grouping key specifier Returns ------- grouped_table : Table object with groups attr set accordingly """ from .table import Table # Pre-convert string to tuple of strings, or Table to the underlying structured array if isinstance(keys, basestring): keys = (keys,) if isinstance(keys, (list, tuple)): for name in keys: if name not in table.colnames: raise ValueError('Table does not have key column {0!r}'.format(name)) if table.masked and np.any(table[name].mask): raise ValueError('Missing values in key column {0!r} are not allowed'.format(name)) keys = tuple(keys) table_keys = table[keys] grouped_by_table_cols = True # Grouping keys are columns from the table being grouped elif isinstance(keys, (np.ndarray, Table)): table_keys = keys if len(table_keys) != len(table): raise ValueError('Input keys array length {0} does not match table length {1}' .format(len(table_keys), len(table))) grouped_by_table_cols = False # Grouping key(s) are external else: raise TypeError('Keys input must be string, list, tuple or numpy array, but got {0}' .format(type(keys))) try: idx_sort = table_keys.argsort(kind='mergesort') stable_sort = True except TypeError: # Some versions (likely 1.6 and earlier) of numpy don't support # 'mergesort' for all data types. MacOSX (Darwin) doesn't have a stable # sort by default, nor does Windows, while Linux does (or appears to). idx_sort = table_keys.argsort() stable_sort = platform.system() not in ('Darwin', 'Windows') table_keys = table_keys[idx_sort] # Get all keys diffs = np.concatenate(([True], table_keys[1:] != table_keys[:-1], [True])) indices = np.flatnonzero(diffs) # If the sort is not stable (preserves original table order) then sort idx_sort in # place within each group. if not stable_sort: for i0, i1 in izip(indices[:-1], indices[1:]): idx_sort[i0:i1].sort() # Make a new table and set the _groups to the appropriate TableGroups object. # Take the subset of the original keys at the indices values (group boundaries). out = table.__class__(table[idx_sort]) out_keys = table_keys[indices[:-1]] if isinstance(out_keys, Table): out_keys.meta['grouped_by_table_cols'] = grouped_by_table_cols out._groups = TableGroups(out, indices=indices, keys=out_keys) return out def column_group_by(column, keys): """ Get groups for ``column`` on specified ``keys`` Parameters ---------- column : Column object Column to group keys : Table or Numpy array of same length as col Grouping key specifier Returns ------- grouped_column : Column object with groups attr set accordingly """ from .table import Table if isinstance(keys, Table): keys = keys._data if not isinstance(keys, np.ndarray): raise TypeError('Keys input must be numpy array, but got {0}' .format(type(keys))) if len(keys) != len(column): raise ValueError('Input keys array length {0} does not match column length {1}' .format(len(keys), len(column))) idx_sort = keys.argsort() keys = keys[idx_sort] # Get all keys diffs = np.concatenate(([True], keys[1:] != keys[:-1], [True])) indices = np.flatnonzero(diffs) # Make a new column and set the _groups to the appropriate ColumnGroups object. # Take the subset of the original keys at the indices values (group boundaries). out = column.__class__(column[idx_sort]) out._groups = ColumnGroups(out, indices=indices, keys=keys[indices[:-1]]) return out class BaseGroups(object): """ A class to represent groups within a table of heterogeneous data. - ``keys``: key values corresponding to each group - ``indices``: index values in parent table or column corresponding to group boundaries - ``aggregate()``: method to create new table by aggregating within groups """ @property def parent(self): return self.parent_column if isinstance(self, ColumnGroups) else self.parent_table def __iter__(self): self._iter_index = 0 return self def next(self): ii = self._iter_index if ii < len(self.indices) - 1: i0, i1 = self.indices[ii], self.indices[ii + 1] self._iter_index += 1 return self.parent[i0:i1] else: raise StopIteration def __getitem__(self, item): parent = self.parent if isinstance(item, int): i0, i1 = self.indices[item], self.indices[item + 1] out = parent[i0:i1] out.groups._keys = parent.groups.keys[item] else: indices0, indices1 = self.indices[:-1], self.indices[1:] try: i0s, i1s = indices0[item], indices1[item] except: raise TypeError('Index item for groups attribute must be a slice, ' 'numpy mask or int array') mask = np.zeros(len(parent), dtype=np.bool) # Is there a way to vectorize this in numpy? for i0, i1 in izip(i0s, i1s): mask[i0:i1] = True out = parent[mask] out.groups._keys = parent.groups.keys[item] out.groups._indices = np.concatenate([[0], np.cumsum(i1s - i0s)]) return out def __repr__(self): return '<{0} indices={1}>'.format(self.__class__.__name__, self.indices) def __len__(self): return len(self.indices) - 1 class ColumnGroups(BaseGroups): def __init__(self, parent_column, indices=None, keys=None): self.parent_column = parent_column # parent Column self.parent_table = parent_column.parent_table self._indices = indices self._keys = keys @property def indices(self): # If the parent column is in a table then use group indices from table if self.parent_table: return self.parent_table.groups.indices else: if self._indices is None: return np.array([0, len(self.parent_column)]) else: return self._indices @property def keys(self): # If the parent column is in a table then use group indices from table if self.parent_table: return self.parent_table.groups.keys else: return self._keys def aggregate(self, func): i0s, i1s = self.indices[:-1], self.indices[1:] par_col = self.parent_column try: vals = np.array([func(par_col[i0: i1]) for i0, i1 in izip(i0s, i1s)]) except Exception: raise TypeError("Cannot aggregate column '{0}'" .format(par_col.name)) out = par_col.__class__(data=vals, name=par_col.name, description=par_col.description, unit=par_col.unit, format=par_col.format, meta=par_col.meta) return out def filter(self, func): """ Filter groups in the Column based on evaluating function ``func`` on each group sub-table. The function which is passed to this method must accept one argument: - ``column`` : `Column` object It must then return either `True` or `False`. As an example, the following will select all column groups with only positive values:: def all_positive(column): if np.any(column < 0): return False return True Parameters ---------- func : function Filter function Returns ------- out : Column New column with the aggregated rows. """ mask = np.empty(len(self), dtype=np.bool) for i, group_column in enumerate(self): mask[i] = func(group_column) return self[mask] class TableGroups(BaseGroups): def __init__(self, parent_table, indices=None, keys=None): self.parent_table = parent_table # parent Table self._indices = indices self._keys = keys @property def key_colnames(self): """ Return the names of columns in the parent table that were used for grouping. """ # If the table was grouped by key columns *in* the table then treat those columns # differently in aggregation. In this case keys will be a Table with # keys.meta['grouped_by_table_cols'] == True. Keys might not be a Table so we # need to handle this. grouped_by_table_cols = getattr(self.keys, 'meta', {}).get('grouped_by_table_cols', False) return self.keys.colnames if grouped_by_table_cols else () @property def indices(self): if self._indices is None: return np.array([0, len(self.parent_table)]) else: return self._indices def aggregate(self, func): """ Aggregate each group in the Table into a single row by applying the reduction function ``func`` to group values in each column. Parameters ---------- func : function Function that reduces an array of values to a single value Returns ------- out : Table New table with the aggregated rows. """ i0s, i1s = self.indices[:-1], self.indices[1:] out_cols = [] parent_table = self.parent_table grouped_by_table_cols = getattr(self.keys, 'meta', {}).get('grouped_by_table_cols', False) for col in parent_table.columns.values(): # For key columns just pick off first in each group since they are identical if col.name in self.key_colnames: # Should just be new_col = col.take(i0s), but there is a bug in # MaskedColumn finalize: # >>> c = MaskedColumn(data=[1,2], name='a', description='a') # >>> print c[1:2].description # None new_col = col.__class__(data=col.take(i0s), name=col.name, description=col.description, unit=col.unit, format=col.format, meta=col.meta) else: try: new_col = col.groups.aggregate(func) except TypeError as err: warnings.warn(str(err), AstropyUserWarning) continue out_cols.append(new_col) return parent_table.__class__(out_cols, meta=parent_table.meta) def filter(self, func): """ Filter groups in the Table based on evaluating function ``func`` on each group sub-table. The function which is passed to this method must accept two arguments: - ``table`` : `Table` object - ``key_colnames`` : tuple of column names in ``table`` used as keys for grouping It must then return either `True` or `False`. As an example, the following will select all table groups with only positive values in the non-key columns:: def all_positive(table, key_colnames): colnames = [name for name in table.colnames if name not in key_colnames] for colname in colnames: if np.any(table[colname] < 0): return False return True Parameters ---------- func : function Filter function Returns ------- out : Table New table with the aggregated rows. """ mask = np.empty(len(self), dtype=np.bool) key_colnames = self.key_colnames for i, group_table in enumerate(self): mask[i] = func(group_table, key_colnames) return self[mask] @property def keys(self): return self._keys astropy-0.3/astropy/table/_np_utils.pyx0000644000175000017500000000752012243255342016531 0ustar oleole""" Cython utilities for numpy structured arrays. join_inner(): Do the inner-loop cartesian product for np_utils.join() processing. (The "inner" is about the inner loop, not inner join). """ import numpy as np import numpy.ma as ma from numpy.lib.recfunctions import drop_fields cimport cython cimport numpy as np DTYPE = np.int ctypedef np.int_t DTYPE_t @cython.wraparound(False) @cython.boundscheck(False) def join_inner(np.ndarray[DTYPE_t, ndim=1] idxs, np.ndarray[DTYPE_t, ndim=1] idx_sort, int len_left, int jointype): """ Do the inner-loop cartesian product for np_utils.join() processing. (The "inner" is about the inner loop, not inner join). """ cdef int n_out = 0 cdef int max_key_idxs = 0 cdef DTYPE_t ii, key_idxs, n_left, n_right, idx0, idx1, idx, i cdef DTYPE_t i_left, i_right, i_out cdef int masked # First count the final number of rows and max number of indexes # for a single key masked = 0 for ii in range(idxs.shape[0] - 1): idx0 = idxs[ii] idx1 = idxs[ii + 1] # Number of indexes for this key key_idxs = idx1 - idx0 if key_idxs > max_key_idxs: max_key_idxs = key_idxs # Number of rows for this key n_left = 0 n_right = 0 for idx in range(idx0, idx1): i = idx_sort[idx] if i < len_left: n_left += 1 else: n_right += 1 # Fix n_left and n_right for different join types if jointype == 0: pass elif jointype == 1: if n_left == 0: masked = 1 n_left = 1 if n_right == 0: masked = 1 n_right = 1 elif jointype == 2: if n_right == 0: masked = 1 n_right = 1 elif jointype == 3: if n_left == 0: masked = 1 n_left = 1 n_out += n_left * n_right cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE) cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE) cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE) cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE) i_out = 0 for ii in range(idxs.shape[0] - 1): idx0 = idxs[ii] idx1 = idxs[ii + 1] # Number of rows for this key n_left = 0 n_right = 0 for idx in range(idx0, idx1): i = idx_sort[idx] if i < len_left: left_idxs[n_left] = i n_left += 1 else: right_idxs[n_right] = i - len_left n_right += 1 if jointype == 0: pass elif jointype == 1: if n_left == 0: left_idxs[0] = -1 n_left = 1 if n_right == 0: right_idxs[0] = -1 n_right = 1 elif jointype == 2: if n_right == 0: right_idxs[0] = -1 n_right = 1 elif jointype == 3: if n_left == 0: left_idxs[0] = -1 n_left = 1 for i_left in range(n_left): for i_right in range(n_right): idx = left_idxs[i_left] if idx < 0: idx = 0 left_mask[i_out] = 1 left_out[i_out] = idx idx = right_idxs[i_right] if idx < 0: idx = 0 right_mask[i_out] = 1 right_out[i_out] = idx i_out += 1 return masked, n_out, left_out, left_mask, right_out, right_mask astropy-0.3/astropy/table/pprint.py0000644000175000017500000003326012243255342015661 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import sys import inspect from itertools import izip from .. import log from ..utils.console import Getch, color_print from ..config import ConfigurationItem _format_funcs = {None: lambda format_, val: str(val)} MAX_LINES = ConfigurationItem('max_lines', 25, 'Maximum number of lines for ' 'the pretty-printer to use if it cannot determine the terminal size. ' 'Negative numbers mean no limit.') MAX_WIDTH = ConfigurationItem('max_width', 80, 'Maximum number of characters ' 'for the pretty-printer to use per line if it cannot determine the ' 'terminal size. Negative numbers mean no limit.') def _get_pprint_size(max_lines=None, max_width=None): """Get the output size (number of lines and character width) for Column and Table pformat/pprint methods. If no value of `max_lines` is supplied then the height of the screen terminal is used to set `max_lines`. If the terminal height cannot be determined then the default will be determined using the `astropy.table.pprint.MAX_LINES` configuration item. If a negative value of `max_lines` is supplied then there is no line limit applied. The same applies for max_width except the configuration item is `astropy.table.pprint.MAX_WIDTH`. Parameters ---------- max_lines : int or None Maximum lines of output (header + data rows) max_width : int or None Maximum width (characters) output Returns ------- max_lines, max_width : int """ if max_lines is None or max_width is None: try: # Will likely fail on Windows import termios import fcntl import struct s = struct.pack("HHHH", 0, 0, 0, 0) fd_stdout = sys.stdout.fileno() x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s) (lines, width, xpixels, ypixels) = struct.unpack("HHHH", x) if lines > 12: lines -= 6 if width > 10: width -= 1 except: lines, width = MAX_LINES(), MAX_WIDTH() if max_lines is None: max_lines = lines elif max_lines < 0: max_lines = sys.maxint if max_lines < 6: max_lines = 6 if max_width is None: max_width = width elif max_width < 0: max_width = sys.maxint if max_width < 10: max_width = 10 return max_lines, max_width def _auto_format_func(format_, val): """Format ``val`` according to ``format_`` for both old- and new- style format specifications or using a user supplied function. More importantly, determine and cache (in _format_funcs) a function that will do this subsequently. In this way this complicated logic is only done for the first value. Returns the formatted value. """ if inspect.isfunction(format_): format_func = lambda format_, val: format_(val.tolist()) try: out = format_func(format_, val) if not isinstance(out, basestring): raise ValueError('Format function for value {0} returned {1} instead of string type' .format(val, type(val))) except Exception as err: raise ValueError('Format function for value {0} failed: {1}' .format(val, err)) else: try: # Convert val to Python object with tolist(). See # https://github.com/astropy/astropy/issues/148#issuecomment-3930809 out = format_.format(val.tolist()) # Require that the format statement actually did something if out == format_: raise ValueError format_func = lambda format_, val: format_.format(val.tolist()) except: # Not sure what exceptions might be raised try: out = format_ % val if out == format_: raise ValueError format_func = lambda format_, val: format_ % val except: raise ValueError('Unable to parse format string {0}' .format(format_)) _format_funcs[format_] = format_func return out def _pformat_col(col, max_lines=None, show_name=True, show_unit=False): """Return a list of formatted string representation of column values. Parameters ---------- max_lines : int Maximum lines of output (header + data rows) show_name : bool Include column name (default=True) show_unit : bool Include a header row for unit (default=False) Returns ------- lines : list List of lines with formatted column values n_header : int Number of lines in the header """ outs = {} # Some values from _pformat_col_iter iterator that are needed here col_strs = list(_pformat_col_iter(col, max_lines, show_name, show_unit, outs)) col_width = max(len(x) for x in col_strs) # Center line content and generate dashed headerline for i in outs['i_centers']: col_strs[i] = col_strs[i].center(col_width) if outs['i_dashes'] is not None: col_strs[outs['i_dashes']] = '-' * col_width # Now bring all the column string values to the same fixed width for i, col_str in enumerate(col_strs): col_strs[i] = col_str.rjust(col_width) return col_strs, outs['n_header'] def _pformat_col_iter(col, max_lines, show_name, show_unit, outs): """Iterator which yields formatted string representation of column values. Parameters ---------- max_lines : int Maximum lines of output (header + data rows) show_name : bool Include column name (default=True) show_unit : bool Include a header row for unit (default=False) out : dict Must be a dict which is used to pass back additional values defined within the iterator. """ max_lines, _ = _get_pprint_size(max_lines, -1) multidims = col.shape[1:] if multidims: multidim0 = tuple(0 for n in multidims) multidim1 = tuple(n - 1 for n in multidims) col_strs = [] # List of formatted column values i_dashes = None i_centers = [] # Line indexes where content should be centered n_header = 0 if show_name: i_centers.append(n_header) if multidims: col_name = col.name + ' [{0}]'.format( ','.join(str(n) for n in multidims)) else: col_name = col.name n_header += 1 yield col_name if show_unit: i_centers.append(n_header) n_header += 1 yield str(col.unit or '') if show_unit or show_name: i_dashes = n_header n_header += 1 yield '---' max_lines -= n_header n_print2 = max_lines // 2 n_rows = len(col) format_func = _format_funcs.get(col.format, _auto_format_func) if len(col) > max_lines: i0 = n_print2 i1 = n_rows - n_print2 - max_lines % 2 else: i0 = len(col) i1 = 0 # Add formatted values if within bounds allowed by max_lines for i in xrange(n_rows): if i < i0 or i > i1: if multidims: col_str = (format_func(col.format, col[(i,) + multidim0]) + ' .. ' + format_func(col.format, col[(i,) + multidim1])) else: col_str = format_func(col.format, col[i]) yield col_str elif i == i0: yield '...' outs['n_header'] = n_header outs['i_centers'] = i_centers outs['i_dashes'] = i_dashes def _pformat_table(table, max_lines=None, max_width=None, show_name=True, show_unit=False, html=False, tableid=None): """Return a list of lines for the formatted string representation of the table. Parameters ---------- max_lines : int or None Maximum number of rows to output max_width : int or None Maximum character width of output show_name : bool Include a header row for column names (default=True) show_unit : bool Include a header row for unit (default=False) html : bool Format the output as an HTML table (default=False) tableid : str or None An ID tag for the table; only used if html is set. Default is "table{id}", where id is the unique integer id of the table object, id(table) Returns ------- out : str Formatted table as a single string n_header : int Number of lines in the header """ # "Print" all the values into temporary lists by column for subsequent # use and to determine the width max_lines, max_width = _get_pprint_size(max_lines, max_width) cols = [] for col in table.columns.values(): lines, n_header = _pformat_col(col, max_lines, show_name, show_unit) cols.append(lines) if not cols: return [] n_rows = len(cols[0]) outwidth = lambda cols: sum(len(c[0]) for c in cols) + len(cols) - 1 dots_col = ['...'] * n_rows middle = len(cols) // 2 while outwidth(cols) > max_width: if len(cols) == 1: break if len(cols) == 2: cols[1] = dots_col break if cols[middle] is dots_col: cols.pop(middle) middle = len(cols) // 2 cols[middle] = dots_col # Now "print" the (already-stringified) column values into a # row-oriented list. rows = [] if html: from ..utils.xml.writer import xml_escape if tableid is None: tableid = 'table{id}'.format(id=id(table)) rows.append(''.format(tid=tableid)) for i in range(n_rows): # _pformat_col output has a header line '----' which is not needed here if i == n_header - 1: continue td = 'th' if i < n_header else 'td' vals = ('<{0}>{1}'.format(td, xml_escape(col[i].strip()), td) for col in cols) row = ('' + ''.join(vals) + '') if i < n_header: row = ('' + row + '') rows.append(row) rows.append('
') else: for i in range(n_rows): row = ' '.join(col[i] for col in cols) rows.append(row) return rows, n_header def _more_tabcol(tabcol, max_lines=None, max_width=None, show_name=True, show_unit=False): """Interactive "more" of a table or column. Parameters ---------- max_lines : int or None Maximum number of rows to output max_width : int or None Maximum character width of output show_name : bool Include a header row for column names (default=True) show_unit : bool Include a header row for unit (default=False) """ allowed_keys = 'f br<>qhpn' # Count the header lines n_header = 0 if show_name: n_header += 1 if show_unit: n_header += 1 if show_name or show_unit: n_header += 1 # Set up kwargs for pformat call. Only Table gets max_width. kwargs = dict(max_lines=-1, show_name=show_name, show_unit=show_unit) if hasattr(tabcol, 'columns'): # tabcol is a table kwargs['max_width'] = max_width # If max_lines is None (=> query screen size) then increase by 2. # This is because get_pprint_size leaves 6 extra lines so that in # ipython you normally see the last input line. max_lines1, max_width = _get_pprint_size(max_lines, max_width) if max_lines is None: max_lines1 += 2 delta_lines = max_lines1 - n_header # Set up a function to get a single character on any platform inkey = Getch() i0 = 0 # First table/column row to show showlines = True while True: i1 = i0 + delta_lines # Last table/col row to show if showlines: # Don't always show the table (e.g. after help) try: os.system('cls' if os.name == 'nt' else 'clear') except: pass # No worries if clear screen call fails lines = tabcol[i0:i1].pformat(**kwargs) colors = ('red' if i < n_header else 'default' for i in xrange(len(lines))) for color, line in izip(colors, lines): color_print(line, color) showlines = True print print "-- f, , b, r, p, n, <, >, q h (help) --", # Get a valid key while True: try: key = inkey().lower() except: print "\n" log.error('Console does not support getting a character' ' as required by more(). Use pprint() instead.') return if key in allowed_keys: break print key if key.lower() == 'q': break elif key == ' ' or key == 'f': i0 += delta_lines elif key == 'b': i0 = i0 - delta_lines elif key == 'r': pass elif key == '<': i0 = 0 elif key == '>': i0 = len(tabcol) elif key == 'p': i0 -= 1 elif key == 'n': i0 += 1 elif key == 'h': showlines = False print """ Browsing keys: f, : forward one page b : back one page r : refresh same page n : next row p : previous row < : go to beginning > : go to end q : quit browsing h : print this help""", if i0 < 0: i0 = 0 if i0 >= len(tabcol) - delta_lines: i0 = len(tabcol) - delta_lines print "\n" astropy-0.3/astropy/table/operations.py0000644000175000017500000002546212243255342016535 0ustar oleole""" High-level table operations: - join() - hstack() - vstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import warnings import collections import numpy as np from ..utils import OrderedDict, metadata from . import np_utils __all__ = ['join', 'hstack', 'vstack'] def _merge_col_meta(out, tables, col_name_map, idx_left=0, idx_right=1, metadata_conflicts='warn'): """ Merge column meta data for the ``out`` table. This merges column meta, which includes attributes unit, format, and description, as well as the actual `meta` atttribute. It is assumed that the ``out`` table was created by merging ``tables``. The ``col_name_map`` provides the mapping from col name in ``out`` back to the original name (which may be different). """ # Set column meta attrs = ('unit', 'format', 'description') for out_col in out.columns.values(): for idx_table, table in enumerate(tables): left_col = out_col right_name = col_name_map[out_col.name][idx_table] if right_name: right_col = table[right_name] out_col.meta = metadata.merge(left_col.meta, right_col.meta, metadata_conflicts=metadata_conflicts) for attr in attrs: # Pick the metadata item that is not None, or they are both # not None, then if they are equal, there is no conflict, # and if they are different, there is a conflict and we # pick the one on the right (or raise an error). left_attr = getattr(left_col, attr) right_attr = getattr(right_col, attr) if left_attr is None: # This may not seem necessary since merge_attr gets set # to right_attr, but not all objects support != which is # needed for one of the if clauses. merge_attr = right_attr elif right_attr is None: merge_attr = left_attr elif left_attr != right_attr: if metadata_conflicts == 'warn': warnings.warn('In merged column {0!r} the {1!r} attribute does not match ' '({2} != {3}). Using {3} for merged output' .format(out_col.name, attr, left_attr, right_attr), metadata.MergeConflictWarning) elif metadata_conflicts == 'error': raise metadata.MergeConflictError('In merged column {0!r} the {1!r} attribute does not match ' '({2} != {3})'.format(out_col.name, attr, left_attr, right_attr)) elif metadata_conflicts != 'silent': raise ValueError('metadata_conflict argument must be one of "silent", "warn", or "error"') merge_attr = right_attr else: # left_attr == right_attr merge_attr = right_attr setattr(out_col, attr, merge_attr) def _merge_table_meta(out, tables, metadata_conflicts='warn'): out_meta = deepcopy(tables[0].meta) for table in tables[1:]: out_meta = metadata.merge(out_meta, table.meta, metadata_conflicts=metadata_conflicts) out.meta.update(out_meta) def _get_list_of_tables(tables): """ Check that tables is a Table or sequence of Tables. Returns the corresponding list of Tables. """ from .table import Table, Row # Make sure we have a list of things if not isinstance(tables, collections.Sequence): tables = [tables] # Make sure each thing is a Table or Row if any(not isinstance(x, (Table, Row)) for x in tables): raise TypeError('`tables` arg must be a Table or sequence of Tables or Rows') # Convert any Rows to Tables tables = [(x if isinstance(x, Table) else Table(x)) for x in tables] return tables def join(left, right, keys=None, join_type='inner', uniq_col_name='{col_name}_{table_name}', table_names=['1', '2'], metadata_conflicts='warn'): """ Perform a join of the left table with the right table on specified keys. Parameters ---------- left : Table object or a value that will initialize a Table object Left side table in the join right : Table object or a value that will initialize a Table object Right side table in the join keys : str or list of str Name(s) of column(s) used to match rows of left and right tables. Default is to use all columns which are common to both tables. join_type : str Join type ('inner' | 'outer' | 'left' | 'right'), default is 'inner' uniq_col_name : str or None String generate a unique output column name in case of a conflict. The default is '{col_name}_{table_name}'. table_names : list of str or None Two-element list of table names used when generating unique output column names. The default is ['1', '2']. metadata_conflicts : str How to proceed with metadata conflicts. This should be one of: * ``'silent'``: silently pick the last conflicting meta-data value * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default) * ``'error'``: raise an exception. """ from .table import Table # Try converting inputs to Table as needed if not isinstance(left, Table): left = Table(left) if not isinstance(right, Table): right = Table(right) col_name_map = OrderedDict() out_data = np_utils.join(left._data, right._data, keys, join_type, uniq_col_name, table_names, col_name_map) # Create the output (Table or subclass of Table) out = Table(out_data) # Merge the column and table meta data. Table subclasses might override # these methods for custom merge behavior. _merge_col_meta(out, [left, right], col_name_map, metadata_conflicts=metadata_conflicts) _merge_table_meta(out, [left, right], metadata_conflicts=metadata_conflicts) return out def vstack(tables, join_type='outer', metadata_conflicts='warn'): """ Stack tables vertically (along rows) A ``join_type`` of 'exact' means that the tables must all have exactly the same column names (though the order can vary). If ``join_type`` is 'inner' then the intersection of common columns will be output. A value of 'outer' (default) means the output will have the union of all columns, with table values being masked where no common values are available. Parameters ---------- tables : Table or list of Table objects Table(s) to stack along rows (vertically) with the current table join_type : str Join type ('inner' | 'exact' | 'outer'), default is 'exact' metadata_conflicts : str How to proceed with metadata conflicts. This should be one of: * ``'silent'``: silently pick the last conflicting meta-data value * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default) * ``'error'``: raise an exception. Examples -------- To stack two tables along rows do:: >>> from astropy.table import vstack, Table >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b')) >>> t2 = Table({'a': [5, 6], 'b': [7, 8]}, names=('a', 'b')) >>> print t1 a b --- --- 1 3 2 4 >>> print t2 a b --- --- 5 7 6 8 >>> print vstack([t1, t2]) a b --- --- 1 3 2 4 5 7 6 8 """ from .table import Table tables = _get_list_of_tables(tables) # validates input arrays = [table._data for table in tables] col_name_map = OrderedDict() out_data = np_utils.vstack(arrays, join_type, col_name_map) out = Table(out_data) # Merge column and table metadata _merge_col_meta(out, tables, col_name_map, metadata_conflicts=metadata_conflicts) _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts) return out def hstack(tables, join_type='outer', uniq_col_name='{col_name}_{table_name}', table_names=None, metadata_conflicts='warn'): """ Stack tables along columns (horizontally) A ``join_type`` of 'exact' means that the tables must all have exactly the same number of rows. If ``join_type`` is 'inner' then the intersection of rows will be output. A value of 'outer' (default) means the output will have the union of all rows, with table values being masked where no common values are available. Parameters ---------- tables : List of Table objects Tables to stack along columns (horizontally) with the current table join_type : str Join type ('inner' | 'exact' | 'outer'), default is 'outer' uniq_col_name : str or None String generate a unique output column name in case of a conflict. The default is '{col_name}_{table_name}'. table_names : list of str or None Two-element list of table names used when generating unique output column names. The default is ['1', '2', ..]. col_name_map : empty dict or None If passed as a dict then it will be updated in-place with the mapping of output to input column names. metadata_conflicts : str How to proceed with metadata conflicts. This should be one of: * ``'silent'``: silently pick the last conflicting meta-data value * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default) * ``'error'``: raise an exception. Examples -------- To stack two tables horizontally (along columns) do:: >>> from astropy.table import Table, hstack >>> t1 = Table({'a': [1, 2], 'b': [3, 4]}, names=('a', 'b')) >>> t2 = Table({'c': [5, 6], 'd': [7, 8]}, names=('c', 'd')) >>> print t1 a b --- --- 1 3 2 4 >>> print t2 c d --- --- 5 7 6 8 >>> print hstack([t1, t2]) a b c d --- --- --- --- 1 3 5 7 2 4 6 8 """ from .table import Table tables = _get_list_of_tables(tables) # validates input arrays = [table._data for table in tables] col_name_map = OrderedDict() out_data = np_utils.hstack(arrays, join_type, uniq_col_name, table_names, col_name_map) out = Table(out_data) _merge_col_meta(out, tables, col_name_map, metadata_conflicts=metadata_conflicts) _merge_table_meta(out, tables, metadata_conflicts=metadata_conflicts) return out astropy-0.3/astropy/table/setup_package.py0000644000175000017500000000120112243255342017146 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst import os from distutils.extension import Extension ROOT = os.path.relpath(os.path.dirname(__file__)) def get_extensions(): sources = [os.path.join(ROOT, "_np_utils.pyx")] include_dirs = ['numpy'] libraries = [] table_ext = Extension( name="astropy.table._np_utils", sources=sources, include_dirs=include_dirs, libraries=libraries,) return [table_ext] def get_package_data(): paths = [os.path.join('data', '*.js'), os.path.join('data', '*.css'), ] return {'astropy.table': paths} astropy-0.3/astropy/table/_np_utils.c0000644000175000017500000105427412243255400016137 0ustar oleole/* Generated by Cython 0.18 on Wed Nov 20 19:59:43 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__astropy__table___np_utils #define __PYX_HAVE_API__astropy__table___np_utils #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "_np_utils.pyx", "numpy.pxd", "type.pxd", }; #define IS_UNSIGNED(type) (((type) -1) > 0) struct __Pyx_StructField_; #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) typedef struct { const char* name; /* for error messages only */ struct __Pyx_StructField_* fields; size_t size; /* sizeof(type) */ size_t arraysize[8]; /* length of array in each dimension */ int ndim; char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ char is_unsigned; int flags; } __Pyx_TypeInfo; typedef struct __Pyx_StructField_ { __Pyx_TypeInfo* type; const char* name; size_t offset; } __Pyx_StructField; typedef struct { __Pyx_StructField* field; size_t parent_offset; } __Pyx_BufFmt_StackElem; typedef struct { __Pyx_StructField root; __Pyx_BufFmt_StackElem* head; size_t fmt_offset; size_t new_count, enc_count; size_t struct_alignment; int is_complex; char enc_type; char new_packmode; char enc_packmode; char is_valid_array; } __Pyx_BufFmt_Context; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /* "astropy/table/_np_utils.pyx":15 * cimport numpy as np * DTYPE = np.int * ctypedef np.int_t DTYPE_t # <<<<<<<<<<<<<< * * @cython.wraparound(False) */ typedef __pyx_t_5numpy_int_t __pyx_t_7astropy_5table_9_np_utils_DTYPE_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { #if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject* old = PyList_GET_ITEM(o, n); Py_INCREF(v); PyList_SET_ITEM(o, n, v); Py_DECREF(old); return 1; } } else { /* inlined PySequence_SetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { if (unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (unlikely(l < 0)) return -1; i += l; } return m->sq_ass_item(o, i, v); } } #else #if CYTHON_COMPILING_IN_PYPY if (PySequence_Check(o) && !PyDict_Check(o)) { #else if (PySequence_Check(o)) { #endif return PySequence_SetItem(o, i, v); } #endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { #if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (unlikely(l < 0)) return NULL; i += l; } return m->sq_item(o, i); } } #else if (PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; typedef struct { size_t refcount; Py_buffer pybuffer; } __Pyx_Buffer; typedef struct { __Pyx_Buffer *rcbuffer; char *data; __Pyx_Buf_DimInfo diminfo[8]; } __Pyx_LocalBuf_ND; #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); #else #define __Pyx_GetBuffer PyObject_GetBuffer #define __Pyx_ReleaseBuffer PyBuffer_Release #endif static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); static CYTHON_INLINE npy_long __Pyx_PyInt_from_py_npy_long(PyObject *); static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long); #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cython' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'astropy.table._np_utils' */ static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7astropy_5table_9_np_utils_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), 0 }; #define __Pyx_MODULE_NAME "astropy.table._np_utils" int __pyx_module_is_main_astropy__table___np_utils = 0; /* Implementation of 'astropy.table._np_utils' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7astropy_5table_9_np_utils_join_inner(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_idxs, PyArrayObject *__pyx_v_idx_sort, int __pyx_v_len_left, int __pyx_v_jointype); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; static char __pyx_k_5[] = "Non-native byte order not supported"; static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_11[] = "Format string allocated too short."; static char __pyx_k_13[] = "\nCython utilities for numpy structured arrays.\n\njoin_inner(): Do the inner-loop cartesian product for np_utils.join() processing.\n (The \"inner\" is about the inner loop, not inner join).\n"; static char __pyx_k_14[] = "numpy.ma"; static char __pyx_k_15[] = "*"; static char __pyx_k_16[] = "numpy.lib.recfunctions"; static char __pyx_k_19[] = "/internal/1/root/src/astropy/astropy-release/astropy/table/_np_utils.pyx"; static char __pyx_k_20[] = "astropy.table._np_utils"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__ii[] = "ii"; static char __pyx_k__ma[] = "ma"; static char __pyx_k__np[] = "np"; static char __pyx_k__idx[] = "idx"; static char __pyx_k__int[] = "int"; static char __pyx_k__bool[] = "bool"; static char __pyx_k__idx0[] = "idx0"; static char __pyx_k__idx1[] = "idx1"; static char __pyx_k__idxs[] = "idxs"; static char __pyx_k__DTYPE[] = "DTYPE"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__empty[] = "empty"; static char __pyx_k__i_out[] = "i_out"; static char __pyx_k__n_out[] = "n_out"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__i_left[] = "i_left"; static char __pyx_k__masked[] = "masked"; static char __pyx_k__n_left[] = "n_left"; static char __pyx_k__i_right[] = "i_right"; static char __pyx_k__n_right[] = "n_right"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__idx_sort[] = "idx_sort"; static char __pyx_k__jointype[] = "jointype"; static char __pyx_k__key_idxs[] = "key_idxs"; static char __pyx_k__left_out[] = "left_out"; static char __pyx_k__len_left[] = "len_left"; static char __pyx_k__left_idxs[] = "left_idxs"; static char __pyx_k__left_mask[] = "left_mask"; static char __pyx_k__right_out[] = "right_out"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__join_inner[] = "join_inner"; static char __pyx_k__right_idxs[] = "right_idxs"; static char __pyx_k__right_mask[] = "right_mask"; static char __pyx_k__drop_fields[] = "drop_fields"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__max_key_idxs[] = "max_key_idxs"; static PyObject *__pyx_kp_u_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_n_s_14; static PyObject *__pyx_n_s_15; static PyObject *__pyx_n_s_16; static PyObject *__pyx_kp_s_19; static PyObject *__pyx_n_s_20; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__DTYPE; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__bool; static PyObject *__pyx_n_s__drop_fields; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__empty; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__i_left; static PyObject *__pyx_n_s__i_out; static PyObject *__pyx_n_s__i_right; static PyObject *__pyx_n_s__idx; static PyObject *__pyx_n_s__idx0; static PyObject *__pyx_n_s__idx1; static PyObject *__pyx_n_s__idx_sort; static PyObject *__pyx_n_s__idxs; static PyObject *__pyx_n_s__ii; static PyObject *__pyx_n_s__int; static PyObject *__pyx_n_s__join_inner; static PyObject *__pyx_n_s__jointype; static PyObject *__pyx_n_s__key_idxs; static PyObject *__pyx_n_s__left_idxs; static PyObject *__pyx_n_s__left_mask; static PyObject *__pyx_n_s__left_out; static PyObject *__pyx_n_s__len_left; static PyObject *__pyx_n_s__ma; static PyObject *__pyx_n_s__masked; static PyObject *__pyx_n_s__max_key_idxs; static PyObject *__pyx_n_s__n_left; static PyObject *__pyx_n_s__n_out; static PyObject *__pyx_n_s__n_right; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__right_idxs; static PyObject *__pyx_n_s__right_mask; static PyObject *__pyx_n_s__right_out; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_1; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_codeobj_18; /* Python wrapper */ static PyObject *__pyx_pw_7astropy_5table_9_np_utils_1join_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7astropy_5table_9_np_utils_join_inner[] = "\n Do the inner-loop cartesian product for np_utils.join() processing.\n (The \"inner\" is about the inner loop, not inner join).\n "; static PyMethodDef __pyx_mdef_7astropy_5table_9_np_utils_1join_inner = {__Pyx_NAMESTR("join_inner"), (PyCFunction)__pyx_pw_7astropy_5table_9_np_utils_1join_inner, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7astropy_5table_9_np_utils_join_inner)}; static PyObject *__pyx_pw_7astropy_5table_9_np_utils_1join_inner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_idxs = 0; PyArrayObject *__pyx_v_idx_sort = 0; int __pyx_v_len_left; int __pyx_v_jointype; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("join_inner (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__idxs,&__pyx_n_s__idx_sort,&__pyx_n_s__len_left,&__pyx_n_s__jointype,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idxs)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx_sort)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("join_inner", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__len_left)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("join_inner", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__jointype)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("join_inner", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "join_inner") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_idxs = ((PyArrayObject *)values[0]); __pyx_v_idx_sort = ((PyArrayObject *)values[1]); __pyx_v_len_left = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_len_left == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_jointype = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_jointype == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("join_inner", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("astropy.table._np_utils.join_inner", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idxs), __pyx_ptype_5numpy_ndarray, 1, "idxs", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx_sort), __pyx_ptype_5numpy_ndarray, 1, "idx_sort", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7astropy_5table_9_np_utils_join_inner(__pyx_self, __pyx_v_idxs, __pyx_v_idx_sort, __pyx_v_len_left, __pyx_v_jointype); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "astropy/table/_np_utils.pyx":19 * @cython.wraparound(False) * @cython.boundscheck(False) * def join_inner(np.ndarray[DTYPE_t, ndim=1] idxs, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] idx_sort, * int len_left, */ static PyObject *__pyx_pf_7astropy_5table_9_np_utils_join_inner(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_idxs, PyArrayObject *__pyx_v_idx_sort, int __pyx_v_len_left, int __pyx_v_jointype) { int __pyx_v_n_out; int __pyx_v_max_key_idxs; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_ii; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_key_idxs; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_n_left; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_n_right; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_idx0; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_idx1; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_idx; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_i; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_i_left; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_i_right; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_v_i_out; int __pyx_v_masked; PyArrayObject *__pyx_v_left_out = 0; PyArrayObject *__pyx_v_right_out = 0; PyArrayObject *__pyx_v_left_mask = 0; PyArrayObject *__pyx_v_right_mask = 0; PyArrayObject *__pyx_v_left_idxs = 0; PyArrayObject *__pyx_v_right_idxs = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_idx_sort; __Pyx_Buffer __pyx_pybuffer_idx_sort; __Pyx_LocalBuf_ND __pyx_pybuffernd_idxs; __Pyx_Buffer __pyx_pybuffer_idxs; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations long __pyx_t_1; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_2; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_3; long __pyx_t_4; int __pyx_t_5; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_6; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_7; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; long __pyx_t_14; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_15; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_16; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_17; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_18; __pyx_t_7astropy_5table_9_np_utils_DTYPE_t __pyx_t_19; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("join_inner", 0); __pyx_pybuffer_idxs.pybuffer.buf = NULL; __pyx_pybuffer_idxs.refcount = 0; __pyx_pybuffernd_idxs.data = NULL; __pyx_pybuffernd_idxs.rcbuffer = &__pyx_pybuffer_idxs; __pyx_pybuffer_idx_sort.pybuffer.buf = NULL; __pyx_pybuffer_idx_sort.refcount = 0; __pyx_pybuffernd_idx_sort.data = NULL; __pyx_pybuffernd_idx_sort.rcbuffer = &__pyx_pybuffer_idx_sort; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idxs.rcbuffer->pybuffer, (PyObject*)__pyx_v_idxs, &__Pyx_TypeInfo_nn___pyx_t_7astropy_5table_9_np_utils_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_idxs.diminfo[0].strides = __pyx_pybuffernd_idxs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idxs.diminfo[0].shape = __pyx_pybuffernd_idxs.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx_sort.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx_sort, &__Pyx_TypeInfo_nn___pyx_t_7astropy_5table_9_np_utils_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_idx_sort.diminfo[0].strides = __pyx_pybuffernd_idx_sort.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx_sort.diminfo[0].shape = __pyx_pybuffernd_idx_sort.rcbuffer->pybuffer.shape[0]; /* "astropy/table/_np_utils.pyx":27 * (The "inner" is about the inner loop, not inner join). * """ * cdef int n_out = 0 # <<<<<<<<<<<<<< * cdef int max_key_idxs = 0 * cdef DTYPE_t ii, key_idxs, n_left, n_right, idx0, idx1, idx, i */ __pyx_v_n_out = 0; /* "astropy/table/_np_utils.pyx":28 * """ * cdef int n_out = 0 * cdef int max_key_idxs = 0 # <<<<<<<<<<<<<< * cdef DTYPE_t ii, key_idxs, n_left, n_right, idx0, idx1, idx, i * cdef DTYPE_t i_left, i_right, i_out */ __pyx_v_max_key_idxs = 0; /* "astropy/table/_np_utils.pyx":35 * # First count the final number of rows and max number of indexes * # for a single key * masked = 0 # <<<<<<<<<<<<<< * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] */ __pyx_v_masked = 0; /* "astropy/table/_np_utils.pyx":36 * # for a single key * masked = 0 * for ii in range(idxs.shape[0] - 1): # <<<<<<<<<<<<<< * idx0 = idxs[ii] * idx1 = idxs[ii + 1] */ __pyx_t_1 = ((__pyx_v_idxs->dimensions[0]) - 1); for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_ii = __pyx_t_2; /* "astropy/table/_np_utils.pyx":37 * masked = 0 * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] # <<<<<<<<<<<<<< * idx1 = idxs[ii + 1] * */ __pyx_t_3 = __pyx_v_ii; __pyx_v_idx0 = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idxs.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_idxs.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":38 * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] * idx1 = idxs[ii + 1] # <<<<<<<<<<<<<< * * # Number of indexes for this key */ __pyx_t_4 = (__pyx_v_ii + 1); __pyx_v_idx1 = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idxs.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_idxs.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":41 * * # Number of indexes for this key * key_idxs = idx1 - idx0 # <<<<<<<<<<<<<< * if key_idxs > max_key_idxs: * max_key_idxs = key_idxs */ __pyx_v_key_idxs = (__pyx_v_idx1 - __pyx_v_idx0); /* "astropy/table/_np_utils.pyx":42 * # Number of indexes for this key * key_idxs = idx1 - idx0 * if key_idxs > max_key_idxs: # <<<<<<<<<<<<<< * max_key_idxs = key_idxs * */ __pyx_t_5 = (__pyx_v_key_idxs > __pyx_v_max_key_idxs); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":43 * key_idxs = idx1 - idx0 * if key_idxs > max_key_idxs: * max_key_idxs = key_idxs # <<<<<<<<<<<<<< * * # Number of rows for this key */ __pyx_v_max_key_idxs = __pyx_v_key_idxs; goto __pyx_L5; } __pyx_L5:; /* "astropy/table/_np_utils.pyx":46 * * # Number of rows for this key * n_left = 0 # <<<<<<<<<<<<<< * n_right = 0 * for idx in range(idx0, idx1): */ __pyx_v_n_left = 0; /* "astropy/table/_np_utils.pyx":47 * # Number of rows for this key * n_left = 0 * n_right = 0 # <<<<<<<<<<<<<< * for idx in range(idx0, idx1): * i = idx_sort[idx] */ __pyx_v_n_right = 0; /* "astropy/table/_np_utils.pyx":48 * n_left = 0 * n_right = 0 * for idx in range(idx0, idx1): # <<<<<<<<<<<<<< * i = idx_sort[idx] * if i < len_left: */ __pyx_t_6 = __pyx_v_idx1; for (__pyx_t_7 = __pyx_v_idx0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_idx = __pyx_t_7; /* "astropy/table/_np_utils.pyx":49 * n_right = 0 * for idx in range(idx0, idx1): * i = idx_sort[idx] # <<<<<<<<<<<<<< * if i < len_left: * n_left += 1 */ __pyx_t_8 = __pyx_v_idx; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idx_sort.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_idx_sort.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":50 * for idx in range(idx0, idx1): * i = idx_sort[idx] * if i < len_left: # <<<<<<<<<<<<<< * n_left += 1 * else: */ __pyx_t_5 = (__pyx_v_i < __pyx_v_len_left); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":51 * i = idx_sort[idx] * if i < len_left: * n_left += 1 # <<<<<<<<<<<<<< * else: * n_right += 1 */ __pyx_v_n_left = (__pyx_v_n_left + 1); goto __pyx_L8; } /*else*/ { /* "astropy/table/_np_utils.pyx":53 * n_left += 1 * else: * n_right += 1 # <<<<<<<<<<<<<< * * # Fix n_left and n_right for different join types */ __pyx_v_n_right = (__pyx_v_n_right + 1); } __pyx_L8:; } /* "astropy/table/_np_utils.pyx":69 * masked = 1 * n_right = 1 * elif jointype == 3: # <<<<<<<<<<<<<< * if n_left == 0: * masked = 1 */ switch (__pyx_v_jointype) { /* "astropy/table/_np_utils.pyx":56 * * # Fix n_left and n_right for different join types * if jointype == 0: # <<<<<<<<<<<<<< * pass * elif jointype == 1: */ case 0: break; /* "astropy/table/_np_utils.pyx":58 * if jointype == 0: * pass * elif jointype == 1: # <<<<<<<<<<<<<< * if n_left == 0: * masked = 1 */ case 1: /* "astropy/table/_np_utils.pyx":59 * pass * elif jointype == 1: * if n_left == 0: # <<<<<<<<<<<<<< * masked = 1 * n_left = 1 */ __pyx_t_5 = (__pyx_v_n_left == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":60 * elif jointype == 1: * if n_left == 0: * masked = 1 # <<<<<<<<<<<<<< * n_left = 1 * if n_right == 0: */ __pyx_v_masked = 1; /* "astropy/table/_np_utils.pyx":61 * if n_left == 0: * masked = 1 * n_left = 1 # <<<<<<<<<<<<<< * if n_right == 0: * masked = 1 */ __pyx_v_n_left = 1; goto __pyx_L9; } __pyx_L9:; /* "astropy/table/_np_utils.pyx":62 * masked = 1 * n_left = 1 * if n_right == 0: # <<<<<<<<<<<<<< * masked = 1 * n_right = 1 */ __pyx_t_5 = (__pyx_v_n_right == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":63 * n_left = 1 * if n_right == 0: * masked = 1 # <<<<<<<<<<<<<< * n_right = 1 * elif jointype == 2: */ __pyx_v_masked = 1; /* "astropy/table/_np_utils.pyx":64 * if n_right == 0: * masked = 1 * n_right = 1 # <<<<<<<<<<<<<< * elif jointype == 2: * if n_right == 0: */ __pyx_v_n_right = 1; goto __pyx_L10; } __pyx_L10:; break; /* "astropy/table/_np_utils.pyx":65 * masked = 1 * n_right = 1 * elif jointype == 2: # <<<<<<<<<<<<<< * if n_right == 0: * masked = 1 */ case 2: /* "astropy/table/_np_utils.pyx":66 * n_right = 1 * elif jointype == 2: * if n_right == 0: # <<<<<<<<<<<<<< * masked = 1 * n_right = 1 */ __pyx_t_5 = (__pyx_v_n_right == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":67 * elif jointype == 2: * if n_right == 0: * masked = 1 # <<<<<<<<<<<<<< * n_right = 1 * elif jointype == 3: */ __pyx_v_masked = 1; /* "astropy/table/_np_utils.pyx":68 * if n_right == 0: * masked = 1 * n_right = 1 # <<<<<<<<<<<<<< * elif jointype == 3: * if n_left == 0: */ __pyx_v_n_right = 1; goto __pyx_L11; } __pyx_L11:; break; /* "astropy/table/_np_utils.pyx":69 * masked = 1 * n_right = 1 * elif jointype == 3: # <<<<<<<<<<<<<< * if n_left == 0: * masked = 1 */ case 3: /* "astropy/table/_np_utils.pyx":70 * n_right = 1 * elif jointype == 3: * if n_left == 0: # <<<<<<<<<<<<<< * masked = 1 * n_left = 1 */ __pyx_t_5 = (__pyx_v_n_left == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":71 * elif jointype == 3: * if n_left == 0: * masked = 1 # <<<<<<<<<<<<<< * n_left = 1 * */ __pyx_v_masked = 1; /* "astropy/table/_np_utils.pyx":72 * if n_left == 0: * masked = 1 * n_left = 1 # <<<<<<<<<<<<<< * * n_out += n_left * n_right */ __pyx_v_n_left = 1; goto __pyx_L12; } __pyx_L12:; break; } /* "astropy/table/_np_utils.pyx":74 * n_left = 1 * * n_out += n_left * n_right # <<<<<<<<<<<<<< * * cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE) */ __pyx_v_n_out = (__pyx_v_n_out + (__pyx_v_n_left * __pyx_v_n_right)); } /* "astropy/table/_np_utils.pyx":76 * n_out += n_left * n_right * * cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE) * cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) */ __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyInt_FromLong(__pyx_v_n_out); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_left_out = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; /* "astropy/table/_np_utils.pyx":77 * * cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE) * cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) */ __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_9 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyInt_FromLong(__pyx_v_n_out); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_right_out = ((PyArrayObject *)__pyx_t_10); __pyx_t_10 = 0; /* "astropy/table/_np_utils.pyx":78 * cdef np.ndarray left_out = np.empty(n_out, dtype=DTYPE) * cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE) * cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) # <<<<<<<<<<<<<< * cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE) */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_12 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__zeros); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyInt_FromLong(__pyx_v_n_out); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__bool); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_left_mask = ((PyArrayObject *)__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":79 * cdef np.ndarray right_out = np.empty(n_out, dtype=DTYPE) * cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) # <<<<<<<<<<<<<< * cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE) * cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE) */ __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_10 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__zeros); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyInt_FromLong(__pyx_v_n_out); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_9 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__bool); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_right_mask = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; /* "astropy/table/_np_utils.pyx":80 * cdef np.ndarray left_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE) # <<<<<<<<<<<<<< * cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE) * */ __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_13 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyInt_FromLong(__pyx_v_max_key_idxs); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_left_idxs = ((PyArrayObject *)__pyx_t_10); __pyx_t_10 = 0; /* "astropy/table/_np_utils.pyx":81 * cdef np.ndarray right_mask = np.zeros(n_out, dtype=np.bool) * cdef np.ndarray left_idxs = np.empty(max_key_idxs, dtype=DTYPE) * cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE) # <<<<<<<<<<<<<< * * i_out = 0 */ __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyInt_FromLong(__pyx_v_max_key_idxs); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_10)); __pyx_t_13 = __Pyx_GetName(__pyx_m, __pyx_n_s__DTYPE); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_right_idxs = ((PyArrayObject *)__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":83 * cdef np.ndarray right_idxs = np.empty(max_key_idxs, dtype=DTYPE) * * i_out = 0 # <<<<<<<<<<<<<< * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] */ __pyx_v_i_out = 0; /* "astropy/table/_np_utils.pyx":84 * * i_out = 0 * for ii in range(idxs.shape[0] - 1): # <<<<<<<<<<<<<< * idx0 = idxs[ii] * idx1 = idxs[ii + 1] */ __pyx_t_1 = ((__pyx_v_idxs->dimensions[0]) - 1); for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_ii = __pyx_t_2; /* "astropy/table/_np_utils.pyx":85 * i_out = 0 * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] # <<<<<<<<<<<<<< * idx1 = idxs[ii + 1] * */ __pyx_t_6 = __pyx_v_ii; __pyx_v_idx0 = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idxs.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_idxs.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":86 * for ii in range(idxs.shape[0] - 1): * idx0 = idxs[ii] * idx1 = idxs[ii + 1] # <<<<<<<<<<<<<< * * # Number of rows for this key */ __pyx_t_14 = (__pyx_v_ii + 1); __pyx_v_idx1 = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idxs.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_idxs.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":89 * * # Number of rows for this key * n_left = 0 # <<<<<<<<<<<<<< * n_right = 0 * for idx in range(idx0, idx1): */ __pyx_v_n_left = 0; /* "astropy/table/_np_utils.pyx":90 * # Number of rows for this key * n_left = 0 * n_right = 0 # <<<<<<<<<<<<<< * for idx in range(idx0, idx1): * i = idx_sort[idx] */ __pyx_v_n_right = 0; /* "astropy/table/_np_utils.pyx":91 * n_left = 0 * n_right = 0 * for idx in range(idx0, idx1): # <<<<<<<<<<<<<< * i = idx_sort[idx] * if i < len_left: */ __pyx_t_7 = __pyx_v_idx1; for (__pyx_t_15 = __pyx_v_idx0; __pyx_t_15 < __pyx_t_7; __pyx_t_15+=1) { __pyx_v_idx = __pyx_t_15; /* "astropy/table/_np_utils.pyx":92 * n_right = 0 * for idx in range(idx0, idx1): * i = idx_sort[idx] # <<<<<<<<<<<<<< * if i < len_left: * left_idxs[n_left] = i */ __pyx_t_16 = __pyx_v_idx; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t *, __pyx_pybuffernd_idx_sort.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_idx_sort.diminfo[0].strides)); /* "astropy/table/_np_utils.pyx":93 * for idx in range(idx0, idx1): * i = idx_sort[idx] * if i < len_left: # <<<<<<<<<<<<<< * left_idxs[n_left] = i * n_left += 1 */ __pyx_t_5 = (__pyx_v_i < __pyx_v_len_left); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":94 * i = idx_sort[idx] * if i < len_left: * left_idxs[n_left] = i # <<<<<<<<<<<<<< * n_left += 1 * else: */ __pyx_t_13 = __Pyx_PyInt_to_py_npy_long(__pyx_v_i); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); if (__Pyx_SetItemInt(((PyObject *)__pyx_v_left_idxs), __pyx_v_n_left, __pyx_t_13, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":95 * if i < len_left: * left_idxs[n_left] = i * n_left += 1 # <<<<<<<<<<<<<< * else: * right_idxs[n_right] = i - len_left */ __pyx_v_n_left = (__pyx_v_n_left + 1); goto __pyx_L17; } /*else*/ { /* "astropy/table/_np_utils.pyx":97 * n_left += 1 * else: * right_idxs[n_right] = i - len_left # <<<<<<<<<<<<<< * n_right += 1 * */ __pyx_t_13 = __Pyx_PyInt_to_py_npy_long((__pyx_v_i - __pyx_v_len_left)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); if (__Pyx_SetItemInt(((PyObject *)__pyx_v_right_idxs), __pyx_v_n_right, __pyx_t_13, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":98 * else: * right_idxs[n_right] = i - len_left * n_right += 1 # <<<<<<<<<<<<<< * * if jointype == 0: */ __pyx_v_n_right = (__pyx_v_n_right + 1); } __pyx_L17:; } /* "astropy/table/_np_utils.pyx":113 * right_idxs[0] = -1 * n_right = 1 * elif jointype == 3: # <<<<<<<<<<<<<< * if n_left == 0: * left_idxs[0] = -1 */ switch (__pyx_v_jointype) { /* "astropy/table/_np_utils.pyx":100 * n_right += 1 * * if jointype == 0: # <<<<<<<<<<<<<< * pass * elif jointype == 1: */ case 0: break; /* "astropy/table/_np_utils.pyx":102 * if jointype == 0: * pass * elif jointype == 1: # <<<<<<<<<<<<<< * if n_left == 0: * left_idxs[0] = -1 */ case 1: /* "astropy/table/_np_utils.pyx":103 * pass * elif jointype == 1: * if n_left == 0: # <<<<<<<<<<<<<< * left_idxs[0] = -1 * n_left = 1 */ __pyx_t_5 = (__pyx_v_n_left == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":104 * elif jointype == 1: * if n_left == 0: * left_idxs[0] = -1 # <<<<<<<<<<<<<< * n_left = 1 * if n_right == 0: */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_left_idxs), 0, __pyx_int_neg_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/table/_np_utils.pyx":105 * if n_left == 0: * left_idxs[0] = -1 * n_left = 1 # <<<<<<<<<<<<<< * if n_right == 0: * right_idxs[0] = -1 */ __pyx_v_n_left = 1; goto __pyx_L18; } __pyx_L18:; /* "astropy/table/_np_utils.pyx":106 * left_idxs[0] = -1 * n_left = 1 * if n_right == 0: # <<<<<<<<<<<<<< * right_idxs[0] = -1 * n_right = 1 */ __pyx_t_5 = (__pyx_v_n_right == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":107 * n_left = 1 * if n_right == 0: * right_idxs[0] = -1 # <<<<<<<<<<<<<< * n_right = 1 * elif jointype == 2: */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_right_idxs), 0, __pyx_int_neg_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/table/_np_utils.pyx":108 * if n_right == 0: * right_idxs[0] = -1 * n_right = 1 # <<<<<<<<<<<<<< * elif jointype == 2: * if n_right == 0: */ __pyx_v_n_right = 1; goto __pyx_L19; } __pyx_L19:; break; /* "astropy/table/_np_utils.pyx":109 * right_idxs[0] = -1 * n_right = 1 * elif jointype == 2: # <<<<<<<<<<<<<< * if n_right == 0: * right_idxs[0] = -1 */ case 2: /* "astropy/table/_np_utils.pyx":110 * n_right = 1 * elif jointype == 2: * if n_right == 0: # <<<<<<<<<<<<<< * right_idxs[0] = -1 * n_right = 1 */ __pyx_t_5 = (__pyx_v_n_right == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":111 * elif jointype == 2: * if n_right == 0: * right_idxs[0] = -1 # <<<<<<<<<<<<<< * n_right = 1 * elif jointype == 3: */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_right_idxs), 0, __pyx_int_neg_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/table/_np_utils.pyx":112 * if n_right == 0: * right_idxs[0] = -1 * n_right = 1 # <<<<<<<<<<<<<< * elif jointype == 3: * if n_left == 0: */ __pyx_v_n_right = 1; goto __pyx_L20; } __pyx_L20:; break; /* "astropy/table/_np_utils.pyx":113 * right_idxs[0] = -1 * n_right = 1 * elif jointype == 3: # <<<<<<<<<<<<<< * if n_left == 0: * left_idxs[0] = -1 */ case 3: /* "astropy/table/_np_utils.pyx":114 * n_right = 1 * elif jointype == 3: * if n_left == 0: # <<<<<<<<<<<<<< * left_idxs[0] = -1 * n_left = 1 */ __pyx_t_5 = (__pyx_v_n_left == 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":115 * elif jointype == 3: * if n_left == 0: * left_idxs[0] = -1 # <<<<<<<<<<<<<< * n_left = 1 * */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_left_idxs), 0, __pyx_int_neg_1, sizeof(long), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "astropy/table/_np_utils.pyx":116 * if n_left == 0: * left_idxs[0] = -1 * n_left = 1 # <<<<<<<<<<<<<< * * for i_left in range(n_left): */ __pyx_v_n_left = 1; goto __pyx_L21; } __pyx_L21:; break; } /* "astropy/table/_np_utils.pyx":118 * n_left = 1 * * for i_left in range(n_left): # <<<<<<<<<<<<<< * for i_right in range(n_right): * idx = left_idxs[i_left] */ __pyx_t_7 = __pyx_v_n_left; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_7; __pyx_t_15+=1) { __pyx_v_i_left = __pyx_t_15; /* "astropy/table/_np_utils.pyx":119 * * for i_left in range(n_left): * for i_right in range(n_right): # <<<<<<<<<<<<<< * idx = left_idxs[i_left] * if idx < 0: */ __pyx_t_17 = __pyx_v_n_right; for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_i_right = __pyx_t_18; /* "astropy/table/_np_utils.pyx":120 * for i_left in range(n_left): * for i_right in range(n_right): * idx = left_idxs[i_left] # <<<<<<<<<<<<<< * if idx < 0: * idx = 0 */ __pyx_t_13 = __Pyx_GetItemInt(((PyObject *)__pyx_v_left_idxs), __pyx_v_i_left, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_19 = __Pyx_PyInt_from_py_npy_long(__pyx_t_13); if (unlikely((__pyx_t_19 == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_v_idx = __pyx_t_19; /* "astropy/table/_np_utils.pyx":121 * for i_right in range(n_right): * idx = left_idxs[i_left] * if idx < 0: # <<<<<<<<<<<<<< * idx = 0 * left_mask[i_out] = 1 */ __pyx_t_5 = (__pyx_v_idx < 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":122 * idx = left_idxs[i_left] * if idx < 0: * idx = 0 # <<<<<<<<<<<<<< * left_mask[i_out] = 1 * left_out[i_out] = idx */ __pyx_v_idx = 0; /* "astropy/table/_np_utils.pyx":123 * if idx < 0: * idx = 0 * left_mask[i_out] = 1 # <<<<<<<<<<<<<< * left_out[i_out] = idx * */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_left_mask), __pyx_v_i_out, __pyx_int_1, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L26; } __pyx_L26:; /* "astropy/table/_np_utils.pyx":124 * idx = 0 * left_mask[i_out] = 1 * left_out[i_out] = idx # <<<<<<<<<<<<<< * * idx = right_idxs[i_right] */ __pyx_t_13 = __Pyx_PyInt_to_py_npy_long(__pyx_v_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); if (__Pyx_SetItemInt(((PyObject *)__pyx_v_left_out), __pyx_v_i_out, __pyx_t_13, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":126 * left_out[i_out] = idx * * idx = right_idxs[i_right] # <<<<<<<<<<<<<< * if idx < 0: * idx = 0 */ __pyx_t_13 = __Pyx_GetItemInt(((PyObject *)__pyx_v_right_idxs), __pyx_v_i_right, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_19 = __Pyx_PyInt_from_py_npy_long(__pyx_t_13); if (unlikely((__pyx_t_19 == (npy_long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_v_idx = __pyx_t_19; /* "astropy/table/_np_utils.pyx":127 * * idx = right_idxs[i_right] * if idx < 0: # <<<<<<<<<<<<<< * idx = 0 * right_mask[i_out] = 1 */ __pyx_t_5 = (__pyx_v_idx < 0); if (__pyx_t_5) { /* "astropy/table/_np_utils.pyx":128 * idx = right_idxs[i_right] * if idx < 0: * idx = 0 # <<<<<<<<<<<<<< * right_mask[i_out] = 1 * right_out[i_out] = idx */ __pyx_v_idx = 0; /* "astropy/table/_np_utils.pyx":129 * if idx < 0: * idx = 0 * right_mask[i_out] = 1 # <<<<<<<<<<<<<< * right_out[i_out] = idx * */ if (__Pyx_SetItemInt(((PyObject *)__pyx_v_right_mask), __pyx_v_i_out, __pyx_int_1, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L27; } __pyx_L27:; /* "astropy/table/_np_utils.pyx":130 * idx = 0 * right_mask[i_out] = 1 * right_out[i_out] = idx # <<<<<<<<<<<<<< * * i_out += 1 */ __pyx_t_13 = __Pyx_PyInt_to_py_npy_long(__pyx_v_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); if (__Pyx_SetItemInt(((PyObject *)__pyx_v_right_out), __pyx_v_i_out, __pyx_t_13, sizeof(__pyx_t_7astropy_5table_9_np_utils_DTYPE_t), __Pyx_PyInt_to_py_npy_long) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "astropy/table/_np_utils.pyx":132 * right_out[i_out] = idx * * i_out += 1 # <<<<<<<<<<<<<< * * return masked, n_out, left_out, left_mask, right_out, right_mask */ __pyx_v_i_out = (__pyx_v_i_out + 1); } } } /* "astropy/table/_np_utils.pyx":134 * i_out += 1 * * return masked, n_out, left_out, left_mask, right_out, right_mask # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_13 = PyInt_FromLong(__pyx_v_masked); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __pyx_t_10 = PyInt_FromLong(__pyx_v_n_out); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(6); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_v_left_out)); PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_v_left_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_left_out)); __Pyx_INCREF(((PyObject *)__pyx_v_left_mask)); PyTuple_SET_ITEM(__pyx_t_11, 3, ((PyObject *)__pyx_v_left_mask)); __Pyx_GIVEREF(((PyObject *)__pyx_v_left_mask)); __Pyx_INCREF(((PyObject *)__pyx_v_right_out)); PyTuple_SET_ITEM(__pyx_t_11, 4, ((PyObject *)__pyx_v_right_out)); __Pyx_GIVEREF(((PyObject *)__pyx_v_right_out)); __Pyx_INCREF(((PyObject *)__pyx_v_right_mask)); PyTuple_SET_ITEM(__pyx_t_11, 5, ((PyObject *)__pyx_v_right_mask)); __Pyx_GIVEREF(((PyObject *)__pyx_v_right_mask)); __pyx_t_13 = 0; __pyx_t_10 = 0; __pyx_r = ((PyObject *)__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx_sort.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idxs.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("astropy.table._np_utils.join_inner", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx_sort.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idxs.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_left_out); __Pyx_XDECREF((PyObject *)__pyx_v_right_out); __Pyx_XDECREF((PyObject *)__pyx_v_left_mask); __Pyx_XDECREF((PyObject *)__pyx_v_right_mask); __Pyx_XDECREF((PyObject *)__pyx_v_left_idxs); __Pyx_XDECREF((PyObject *)__pyx_v_right_idxs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = (__pyx_v_info == NULL); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = (!__pyx_v_hasfields); if (__pyx_t_2) { __pyx_t_3 = (!__pyx_v_copy_shape); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { __pyx_t_2 = __pyx_v_little_endian; } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; goto __pyx_L13; } /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; goto __pyx_L13; } /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; goto __pyx_L13; } /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; goto __pyx_L13; } /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; goto __pyx_L13; } /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; goto __pyx_L13; } /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; goto __pyx_L13; } /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; goto __pyx_L13; } /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; goto __pyx_L13; } /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; goto __pyx_L13; } /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; goto __pyx_L13; } /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; goto __pyx_L13; } /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; goto __pyx_L13; } /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; goto __pyx_L13; } /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; goto __pyx_L13; } /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; goto __pyx_L13; } /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_new_offset); __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_7) { __pyx_t_8 = __pyx_v_little_endian; } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_7) { __pyx_t_9 = (!__pyx_v_little_endian); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("_np_utils"), __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_n_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 1}, {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1}, {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__DTYPE, __pyx_k__DTYPE, sizeof(__pyx_k__DTYPE), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__bool, __pyx_k__bool, sizeof(__pyx_k__bool), 0, 0, 1, 1}, {&__pyx_n_s__drop_fields, __pyx_k__drop_fields, sizeof(__pyx_k__drop_fields), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__i_left, __pyx_k__i_left, sizeof(__pyx_k__i_left), 0, 0, 1, 1}, {&__pyx_n_s__i_out, __pyx_k__i_out, sizeof(__pyx_k__i_out), 0, 0, 1, 1}, {&__pyx_n_s__i_right, __pyx_k__i_right, sizeof(__pyx_k__i_right), 0, 0, 1, 1}, {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, {&__pyx_n_s__idx0, __pyx_k__idx0, sizeof(__pyx_k__idx0), 0, 0, 1, 1}, {&__pyx_n_s__idx1, __pyx_k__idx1, sizeof(__pyx_k__idx1), 0, 0, 1, 1}, {&__pyx_n_s__idx_sort, __pyx_k__idx_sort, sizeof(__pyx_k__idx_sort), 0, 0, 1, 1}, {&__pyx_n_s__idxs, __pyx_k__idxs, sizeof(__pyx_k__idxs), 0, 0, 1, 1}, {&__pyx_n_s__ii, __pyx_k__ii, sizeof(__pyx_k__ii), 0, 0, 1, 1}, {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, {&__pyx_n_s__join_inner, __pyx_k__join_inner, sizeof(__pyx_k__join_inner), 0, 0, 1, 1}, {&__pyx_n_s__jointype, __pyx_k__jointype, sizeof(__pyx_k__jointype), 0, 0, 1, 1}, {&__pyx_n_s__key_idxs, __pyx_k__key_idxs, sizeof(__pyx_k__key_idxs), 0, 0, 1, 1}, {&__pyx_n_s__left_idxs, __pyx_k__left_idxs, sizeof(__pyx_k__left_idxs), 0, 0, 1, 1}, {&__pyx_n_s__left_mask, __pyx_k__left_mask, sizeof(__pyx_k__left_mask), 0, 0, 1, 1}, {&__pyx_n_s__left_out, __pyx_k__left_out, sizeof(__pyx_k__left_out), 0, 0, 1, 1}, {&__pyx_n_s__len_left, __pyx_k__len_left, sizeof(__pyx_k__len_left), 0, 0, 1, 1}, {&__pyx_n_s__ma, __pyx_k__ma, sizeof(__pyx_k__ma), 0, 0, 1, 1}, {&__pyx_n_s__masked, __pyx_k__masked, sizeof(__pyx_k__masked), 0, 0, 1, 1}, {&__pyx_n_s__max_key_idxs, __pyx_k__max_key_idxs, sizeof(__pyx_k__max_key_idxs), 0, 0, 1, 1}, {&__pyx_n_s__n_left, __pyx_k__n_left, sizeof(__pyx_k__n_left), 0, 0, 1, 1}, {&__pyx_n_s__n_out, __pyx_k__n_out, sizeof(__pyx_k__n_out), 0, 0, 1, 1}, {&__pyx_n_s__n_right, __pyx_k__n_right, sizeof(__pyx_k__n_right), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__right_idxs, __pyx_k__right_idxs, sizeof(__pyx_k__right_idxs), 0, 0, 1, 1}, {&__pyx_n_s__right_mask, __pyx_k__right_mask, sizeof(__pyx_k__right_mask), 0, 0, 1, 1}, {&__pyx_n_s__right_out, __pyx_k__right_out, sizeof(__pyx_k__right_out), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "astropy/table/_np_utils.pyx":19 * @cython.wraparound(False) * @cython.boundscheck(False) * def join_inner(np.ndarray[DTYPE_t, ndim=1] idxs, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] idx_sort, * int len_left, */ __pyx_k_tuple_17 = PyTuple_Pack(24, ((PyObject *)__pyx_n_s__idxs), ((PyObject *)__pyx_n_s__idx_sort), ((PyObject *)__pyx_n_s__len_left), ((PyObject *)__pyx_n_s__jointype), ((PyObject *)__pyx_n_s__n_out), ((PyObject *)__pyx_n_s__max_key_idxs), ((PyObject *)__pyx_n_s__ii), ((PyObject *)__pyx_n_s__key_idxs), ((PyObject *)__pyx_n_s__n_left), ((PyObject *)__pyx_n_s__n_right), ((PyObject *)__pyx_n_s__idx0), ((PyObject *)__pyx_n_s__idx1), ((PyObject *)__pyx_n_s__idx), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__i_left), ((PyObject *)__pyx_n_s__i_right), ((PyObject *)__pyx_n_s__i_out), ((PyObject *)__pyx_n_s__masked), ((PyObject *)__pyx_n_s__left_out), ((PyObject *)__pyx_n_s__right_out), ((PyObject *)__pyx_n_s__left_mask), ((PyObject *)__pyx_n_s__right_mask), ((PyObject *)__pyx_n_s__left_idxs), ((PyObject *)__pyx_n_s__right_idxs)); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_17); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(4, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__join_inner, 19, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_np_utils(void); /*proto*/ PyMODINIT_FUNC init_np_utils(void) #else PyMODINIT_FUNC PyInit__np_utils(void); /*proto*/ PyMODINIT_FUNC PyInit__np_utils(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__np_utils(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_np_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "astropy.table._np_utils")) { if (unlikely(PyDict_SetItemString(modules, "astropy.table._np_utils", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_astropy__table___np_utils) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "astropy/table/_np_utils.pyx":8 * """ * * import numpy as np # <<<<<<<<<<<<<< * import numpy.ma as ma * from numpy.lib.recfunctions import drop_fields */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/table/_np_utils.pyx":9 * * import numpy as np * import numpy.ma as ma # <<<<<<<<<<<<<< * from numpy.lib.recfunctions import drop_fields * */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s_15)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_15)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_15)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_14), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ma, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/table/_np_utils.pyx":10 * import numpy as np * import numpy.ma as ma * from numpy.lib.recfunctions import drop_fields # <<<<<<<<<<<<<< * * cimport cython */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__drop_fields)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__drop_fields)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drop_fields)); __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_16), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__drop_fields); if (__pyx_t_2 == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__drop_fields); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__drop_fields, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "astropy/table/_np_utils.pyx":14 * cimport cython * cimport numpy as np * DTYPE = np.int # <<<<<<<<<<<<<< * ctypedef np.int_t DTYPE_t * */ __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/table/_np_utils.pyx":19 * @cython.wraparound(False) * @cython.boundscheck(False) * def join_inner(np.ndarray[DTYPE_t, ndim=1] idxs, # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t, ndim=1] idx_sort, * int len_left, */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7astropy_5table_9_np_utils_1join_inner, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__join_inner, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "astropy/table/_np_utils.pyx":1 * """ # <<<<<<<<<<<<<< * Cython utilities for numpy structured arrays. * */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { __Pyx_AddTraceback("init astropy.table._np_utils", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init astropy.table._np_utils"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { stack[0].field = &ctx->root; stack[0].parent_offset = 0; ctx->root.type = type; ctx->root.name = "buffer dtype"; ctx->root.offset = 0; ctx->head = stack; ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; ctx->new_packmode = '@'; ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; ctx->is_valid_array = 0; ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = 0; type = type->fields->type; } } static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; if (*t < '0' || *t > '9') { return -1; } else { count = *t++ - '0'; while (*t >= '0' && *t < '9') { count *= 10; count += *t++ - '0'; } } *ts = t; return count; } static int __Pyx_BufFmt_ExpectNumber(const char **ts) { int number = __Pyx_BufFmt_ParseNumber(ts); if (number == -1) /* First char was not a digit */ PyErr_Format(PyExc_ValueError,\ "Does not understand character buffer dtype format string ('%c')", **ts); return number; } static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { case 'c': return "'char'"; case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; case 'i': return "'int'"; case 'I': return "'unsigned int'"; case 'l': return "'long'"; case 'L': return "'unsigned long'"; case 'q': return "'long long'"; case 'Q': return "'unsigned long long'"; case 'f': return (is_complex ? "'complex float'" : "'float'"); case 'd': return (is_complex ? "'complex double'" : "'double'"); case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; case 'f': return (is_complex ? 8 : 4); case 'd': return (is_complex ? 16 : 8); case 'g': { PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); return 0; } case 'O': case 'P': return sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(float) * (is_complex ? 2 : 1); case 'd': return sizeof(double) * (is_complex ? 2 : 1); case 'g': return sizeof(long double) * (is_complex ? 2 : 1); case 'O': case 'P': return sizeof(void*); default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; typedef struct { char c; float x; } __Pyx_st_float; typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } /* These are for computing the padding at the end of the struct to align on the first member of the struct. This will probably the same as above, but we don't have any guarantees. */ typedef struct { short x; char c; } __Pyx_pad_short; typedef struct { int x; char c; } __Pyx_pad_int; typedef struct { long x; char c; } __Pyx_pad_long; typedef struct { float x; char c; } __Pyx_pad_float; typedef struct { double x; char c; } __Pyx_pad_double; typedef struct { long double x; char c; } __Pyx_pad_longdouble; typedef struct { void *x; char c; } __Pyx_pad_void_p; #ifdef HAVE_LONG_LONG typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; #endif static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); #ifdef HAVE_LONG_LONG case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); default: __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { case 'c': return 'H'; case 'b': case 'h': case 'i': case 'l': case 'q': case 's': case 'p': return 'I'; case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); case 'O': return 'O'; case 'P': return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; const char* quote; if (ctx->head == NULL) { expected = "end"; quote = ""; } else { expected = ctx->head->field->type->name; quote = "'"; } PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected %s%s%s but got %s", quote, expected, quote, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); } else { __Pyx_StructField* field = ctx->head->field; __Pyx_StructField* parent = (ctx->head - 1)->field; PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), parent->type->name, field->name); } } static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; if (ctx->head->field->type->arraysize[0]) { int i, ndim = 0; if (ctx->enc_type == 's' || ctx->enc_type == 'p') { ctx->is_valid_array = ctx->head->field->type->ndim == 1; ndim = 1; if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %zu", ctx->head->field->type->arraysize[0], ctx->enc_count); return -1; } } if (!ctx->is_valid_array) { PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", ctx->head->field->type->ndim, ndim); return -1; } for (i = 0; i < ctx->head->field->type->ndim; i++) { arraysize *= ctx->head->field->type->arraysize[i]; } ctx->is_valid_array = 0; ctx->enc_count = 1; } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } if (ctx->enc_packmode == '@') { size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; if (ctx->struct_alignment == 0) ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, ctx->is_complex); } if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } if ((type->typegroup == 'H' || group == 'H') && type->size == size) { } else { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } } offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } ctx->fmt_offset += size; if (arraysize) ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ while (1) { if (field == &ctx->root) { ctx->head = NULL; if (ctx->enc_count != 0) { __Pyx_BufFmt_RaiseExpected(ctx); return -1; } break; /* breaks both loops as ctx->enc_count == 0 */ } ctx->head->field = ++field; if (field->type == NULL) { --ctx->head; field = ctx->head->field; continue; } else if (field->type->typegroup == 'S') { size_t parent_offset = ctx->head->parent_offset + field->offset; if (field->type->fields->type == NULL) continue; /* empty struct */ field = field->type->fields; ++ctx->head; ctx->head->field = field; ctx->head->parent_offset = parent_offset; break; } else { break; } } } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; return 0; } static CYTHON_INLINE PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; int i = 0, number; int ndim = ctx->head->field->type->ndim; ; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, "Cannot handle repeated arrays in format string"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; while (*ts && *ts != ')') { if (isspace(*ts)) continue; number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) return PyErr_Format(PyExc_ValueError, "Expected a dimension of size %zu, got %d", ctx->head->field->type->arraysize[i], number); if (*ts != ',' && *ts != ')') return PyErr_Format(PyExc_ValueError, "Expected a comma in format string, got '%c'", *ts); if (*ts == ',') ts++; i++; } if (i != ndim) return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", ctx->head->field->type->ndim, i); if (!*ts) { PyErr_SetString(PyExc_ValueError, "Unexpected end of format string, expected ')'"); return NULL; } ctx->is_valid_array = 1; ctx->new_count = 1; *tsp = ++ts; return Py_None; } static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { switch(*ts) { case 0: if (ctx->enc_type != 0 && ctx->head == NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; if (ctx->head != NULL) { __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } return ts; case ' ': case 10: case 13: ++ts; break; case '<': if (!__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '>': case '!': if (__Pyx_IsLittleEndian()) { PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ ctx->enc_count = 0; ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); if (!ts_after_sub) return NULL; } ts = ts_after_sub; if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ { size_t alignment = ctx->struct_alignment; ++ts; if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_type = 0; /* Erase processed last struct element */ if (alignment && ctx->fmt_offset % alignment) { ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); } } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->fmt_offset += ctx->new_count; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': got_Z = 1; ++ts; if (*ts != 'f' && *ts != 'd' && *ts != 'g') { __Pyx_BufFmt_RaiseUnexpectedChar('Z'); return NULL; } /* fall through */ case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } ++ts; ctx->new_count = 1; got_Z = 0; break; case ':': ++ts; while(*ts != ':') ++ts; ++ts; break; case '(': if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; break; default: { int number = __Pyx_BufFmt_ExpectNumber(&ts); if (number == -1) return NULL; ctx->new_count = (size_t)number; } } } } static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; buf->strides = __Pyx_zeros; buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } static CYTHON_INLINE int __Pyx_GetBufferAndValidate( Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", nd, buf->ndim); goto fail; } if (!cast) { __Pyx_BufFmt_Context ctx; __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; __Pyx_ReleaseBuffer(info); } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_getbuffer"))) { getbufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); #else func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); #endif Py_DECREF(getbuffer_cobj); if (!func) goto fail; return func(obj, view, flags); } else { PyErr_Clear(); } #endif PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); #if PY_VERSION_HEX < 0x02060000 fail: #endif return -1; } static void __Pyx_ReleaseBuffer(Py_buffer *view) { PyObject *obj = view->obj; CYTHON_UNUSED PyObject *releasebuffer_cobj; if (!obj) return; #if PY_VERSION_HEX >= 0x02060000 if (PyObject_CheckBuffer(obj)) { PyBuffer_Release(view); return; } #endif if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } #if PY_VERSION_HEX < 0x02060000 if (obj->ob_type->tp_dict && (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, "__pyx_releasebuffer"))) { releasebufferproc func; #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); #else func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); #endif Py_DECREF(releasebuffer_cobj); if (!func) goto fail; func(obj, view); return; } else { PyErr_Clear(); } #endif goto nofail; #if PY_VERSION_HEX < 0x02060000 fail: #endif PyErr_WriteUnraisable(obj); nofail: Py_DECREF(obj); view->obj = NULL; } #endif /* PY_MAJOR_VERSION < 3 */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import = 0; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { #if PY_MAJOR_VERSION < 3 PyErr_Format(PyExc_ImportError, "cannot import name %.230s", PyString_AsString(name)); #else PyErr_Format(PyExc_ImportError, "cannot import name %S", name); #endif } static CYTHON_INLINE npy_long __Pyx_PyInt_from_py_npy_long(PyObject* x) { const npy_long neg_one = (npy_long)-1, const_zero = (npy_long)0; const int is_unsigned = const_zero < neg_one; if (sizeof(npy_long) == sizeof(char)) { if (is_unsigned) return (npy_long)__Pyx_PyInt_AsUnsignedChar(x); else return (npy_long)__Pyx_PyInt_AsSignedChar(x); } else if (sizeof(npy_long) == sizeof(short)) { if (is_unsigned) return (npy_long)__Pyx_PyInt_AsUnsignedShort(x); else return (npy_long)__Pyx_PyInt_AsSignedShort(x); } else if (sizeof(npy_long) == sizeof(int)) { if (is_unsigned) return (npy_long)__Pyx_PyInt_AsUnsignedInt(x); else return (npy_long)__Pyx_PyInt_AsSignedInt(x); } else if (sizeof(npy_long) == sizeof(long)) { if (is_unsigned) return (npy_long)__Pyx_PyInt_AsUnsignedLong(x); else return (npy_long)__Pyx_PyInt_AsSignedLong(x); } else if (sizeof(npy_long) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return (npy_long)__Pyx_PyInt_AsUnsignedLongLong(x); else return (npy_long)__Pyx_PyInt_AsSignedLongLong(x); } else { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else npy_long val; PyObject *v = __Pyx_PyNumber_Int(x); #if PY_VERSION_HEX < 0x03000000 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (npy_long)-1; } } static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long val) { const npy_long neg_one = (npy_long)-1, const_zero = (npy_long)0; const int is_unsigned = const_zero < neg_one; if ((sizeof(npy_long) == sizeof(char)) || (sizeof(npy_long) == sizeof(short))) { return PyInt_FromLong((long)val); } else if ((sizeof(npy_long) == sizeof(int)) || (sizeof(npy_long) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); } else if (sizeof(npy_long) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; return _PyLong_FromByteArray(bytes, sizeof(npy_long), little, !is_unsigned); } } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ astropy-0.3/astropy/table/data/0000755000175000017500000000000012270423340014673 5ustar oleoleastropy-0.3/astropy/table/data/jquery-ui.css0000644000175000017500000007645612243255342017366 0ustar oleole/*! jQuery UI - v1.10.3 - 2013-05-03 * http://jqueryui.com * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ /* Layout helpers ----------------------------------*/ .ui-helper-hidden { display: none; } .ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; border-collapse: collapse; } .ui-helper-clearfix:after { clear: both; } .ui-helper-clearfix { min-height: 0; /* support: IE7 */ } .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } .ui-front { z-index: 100; } /* Interaction Cues ----------------------------------*/ .ui-state-disabled { cursor: default !important; } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } /* Misc visuals ----------------------------------*/ /* Overlays */ .ui-widget-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; } .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; min-height: 0; /* support: IE7 */ } .ui-accordion .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-noicons { padding-left: .7em; } .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; } .ui-autocomplete { position: absolute; top: 0; left: 0; cursor: default; } .ui-button { display: inline-block; position: relative; padding: 0; line-height: normal; margin-right: .1em; cursor: pointer; vertical-align: middle; text-align: center; overflow: visible; /* removes extra width in IE */ } .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; } /* to make room for the icon, a width needs to be set here */ .ui-button-icon-only { width: 2.2em; } /* button elements seem to need a little more width */ button.ui-button-icon-only { width: 2.4em; } .ui-button-icons-only { width: 3.4em; } button.ui-button-icons-only { width: 3.7em; } /* button text element */ .ui-button .ui-button-text { display: block; line-height: normal; } .ui-button-text-only .ui-button-text { padding: .4em 1em; } .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } /* no icon support for input elements, provide padding by default */ input.ui-button { padding: .4em 1em; } /* button icon element(s) */ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } /* button sets */ .ui-buttonset { margin-right: 7px; } .ui-buttonset .ui-button { margin-left: 1px; margin-right: 1px; } /* workarounds */ /* reset extra padding in Firefox, see h5bp.com/l */ input.ui-button::-moz-focus-inner, button.ui-button::-moz-focus-inner { border: 0; padding: 0; } .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker .ui-datepicker-header { position: relative; padding: .2em 0; } .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position: absolute; top: 2px; width: 1.8em; height: 1.8em; } .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } .ui-datepicker .ui-datepicker-prev { left: 2px; } .ui-datepicker .ui-datepicker-next { right: 2px; } .ui-datepicker .ui-datepicker-prev-hover { left: 1px; } .ui-datepicker .ui-datepicker-next-hover { right: 1px; } .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker .ui-datepicker-title select { font-size: 1em; margin: 1px 0; } .ui-datepicker select.ui-datepicker-month-year { width: 100%; } .ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year { width: 49%; } .ui-datepicker table { width: 100%; font-size: .9em; border-collapse: collapse; margin: 0 0 .4em; } .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } .ui-datepicker td { border: 0; padding: 1px; } .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding: 0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width: auto; overflow: visible; } .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float: left; } /* with multiple calendars */ .ui-datepicker.ui-datepicker-multi { width: auto; } .ui-datepicker-multi .ui-datepicker-group { float: left; } .ui-datepicker-multi .ui-datepicker-group table { width: 95%; margin: 0 auto .4em; } .ui-datepicker-multi-2 .ui-datepicker-group { width: 50%; } .ui-datepicker-multi-3 .ui-datepicker-group { width: 33.3%; } .ui-datepicker-multi-4 .ui-datepicker-group { width: 25%; } .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width: 0; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear: left; } .ui-datepicker-row-break { clear: both; width: 100%; font-size: 0; } /* RTL support */ .ui-datepicker-rtl { direction: rtl; } .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } .ui-datepicker-rtl .ui-datepicker-buttonpane { clear: right; } .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, .ui-datepicker-rtl .ui-datepicker-group { float: right; } .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width: 0; border-left-width: 1px; } .ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; outline: 0; } .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } .ui-dialog .ui-dialog-title { float: left; margin: .1em 0; white-space: nowrap; width: 90%; overflow: hidden; text-overflow: ellipsis; } .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 21px; margin: -10px 0 0 0; padding: 1px; height: 20px; } .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; } .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin-top: .5em; padding: .3em 1em .5em .4em; } .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } .ui-dialog .ui-resizable-se { width: 12px; height: 12px; right: -5px; bottom: -5px; background-position: 16px 16px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } .ui-menu { list-style: none; padding: 2px; margin: 0; display: block; outline: none; } .ui-menu .ui-menu { margin-top: -3px; position: absolute; } .ui-menu .ui-menu-item { margin: 0; padding: 0; width: 100%; /* support: IE10, see #8844 */ list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); } .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; } .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; min-height: 0; /* support: IE7 */ font-weight: normal; } .ui-menu .ui-menu-item a.ui-state-focus, .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; } .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; } .ui-menu .ui-state-disabled a { cursor: default; } /* icon support */ .ui-menu-icons { position: relative; } .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; } /* left-aligned */ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; } /* right-aligned */ .ui-menu .ui-menu-icon { position: static; float: right; } .ui-progressbar { height: 2em; text-align: left; overflow: hidden; } .ui-progressbar .ui-progressbar-value { margin: -1px; height: 100%; } .ui-progressbar .ui-progressbar-overlay { background: url("images/animated-overlay.gif"); height: 100%; filter: alpha(opacity=25); opacity: 0.25; } .ui-progressbar-indeterminate .ui-progressbar-value { background-image: none; } .ui-resizable { position: relative; } .ui-resizable-handle { position: absolute; font-size: 0.1px; display: block; } .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px; } .ui-selectable-helper { position: absolute; z-index: 100; border: 1px dotted black; } .ui-slider { position: relative; text-align: left; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } /* For IE8 - See #6727 */ .ui-slider.ui-state-disabled .ui-slider-handle, .ui-slider.ui-state-disabled .ui-slider-range { filter: inherit; } .ui-slider-horizontal { height: .8em; } .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider-horizontal .ui-slider-range-min { left: 0; } .ui-slider-horizontal .ui-slider-range-max { right: 0; } .ui-slider-vertical { width: .8em; height: 100px; } .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } .ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-vertical .ui-slider-range-max { top: 0; } .ui-spinner { position: relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; } .ui-spinner-input { border: none; background: none; color: inherit; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; } .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; } /* more specificity required here to overide default borders */ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* vertical centre icon */ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } .ui-spinner-up { top: 0; } .ui-spinner-down { bottom: 0; } /* TR overrides */ .ui-spinner .ui-icon-triangle-1-s { /* need to fix icons sprite */ background-position: -65px -16px; } .ui-tabs { position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ padding: .2em; } .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom-width: 0; padding: 0; white-space: nowrap; } .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; } .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; } .ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } .ui-tooltip { padding: 8px; position: absolute; z-index: 9999; max-width: 300px; -webkit-box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa; } body .ui-tooltip { border-width: 2px; } /* Component containers ----------------------------------*/ .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } .ui-widget-content a { color: #222222; } .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } .ui-widget-header a { color: #222222; } /* Interaction states ----------------------------------*/ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } /* Interaction Cues ----------------------------------*/ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } .ui-state-highlight a, .ui-widget-content .ui-state-highlight a, .ui-widget-header .ui-state-highlight a { color: #363636; } .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error { border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); /* For IE8 - See #6059 */ } /* Icons ----------------------------------*/ /* states and images */ .ui-icon { width: 16px; height: 16px; } .ui-icon, .ui-widget-content .ui-icon { background-image: url(images/ui-icons_222222_256x240.png); } .ui-widget-header .ui-icon { background-image: url(images/ui-icons_222222_256x240.png); } .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } .ui-state-hover .ui-icon, .ui-state-focus .ui-icon { background-image: url(images/ui-icons_454545_256x240.png); } .ui-state-active .ui-icon { background-image: url(images/ui-icons_454545_256x240.png); } .ui-state-highlight .ui-icon { background-image: url(images/ui-icons_2e83ff_256x240.png); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon { background-image: url(images/ui-icons_cd0a0a_256x240.png); } /* positioning */ .ui-icon-blank { background-position: 16px 16px; } .ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-ne { background-position: -16px 0; } .ui-icon-carat-1-e { background-position: -32px 0; } .ui-icon-carat-1-se { background-position: -48px 0; } .ui-icon-carat-1-s { background-position: -64px 0; } .ui-icon-carat-1-sw { background-position: -80px 0; } .ui-icon-carat-1-w { background-position: -96px 0; } .ui-icon-carat-1-nw { background-position: -112px 0; } .ui-icon-carat-2-n-s { background-position: -128px 0; } .ui-icon-carat-2-e-w { background-position: -144px 0; } .ui-icon-triangle-1-n { background-position: 0 -16px; } .ui-icon-triangle-1-ne { background-position: -16px -16px; } .ui-icon-triangle-1-e { background-position: -32px -16px; } .ui-icon-triangle-1-se { background-position: -48px -16px; } .ui-icon-triangle-1-s { background-position: -64px -16px; } .ui-icon-triangle-1-sw { background-position: -80px -16px; } .ui-icon-triangle-1-w { background-position: -96px -16px; } .ui-icon-triangle-1-nw { background-position: -112px -16px; } .ui-icon-triangle-2-n-s { background-position: -128px -16px; } .ui-icon-triangle-2-e-w { background-position: -144px -16px; } .ui-icon-arrow-1-n { background-position: 0 -32px; } .ui-icon-arrow-1-ne { background-position: -16px -32px; } .ui-icon-arrow-1-e { background-position: -32px -32px; } .ui-icon-arrow-1-se { background-position: -48px -32px; } .ui-icon-arrow-1-s { background-position: -64px -32px; } .ui-icon-arrow-1-sw { background-position: -80px -32px; } .ui-icon-arrow-1-w { background-position: -96px -32px; } .ui-icon-arrow-1-nw { background-position: -112px -32px; } .ui-icon-arrow-2-n-s { background-position: -128px -32px; } .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } .ui-icon-arrow-2-e-w { background-position: -160px -32px; } .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } .ui-icon-arrowstop-1-n { background-position: -192px -32px; } .ui-icon-arrowstop-1-e { background-position: -208px -32px; } .ui-icon-arrowstop-1-s { background-position: -224px -32px; } .ui-icon-arrowstop-1-w { background-position: -240px -32px; } .ui-icon-arrowthick-1-n { background-position: 0 -48px; } .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } .ui-icon-arrowthick-1-e { background-position: -32px -48px; } .ui-icon-arrowthick-1-se { background-position: -48px -48px; } .ui-icon-arrowthick-1-s { background-position: -64px -48px; } .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } .ui-icon-arrowthick-1-w { background-position: -96px -48px; } .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } .ui-icon-arrow-4 { background-position: 0 -80px; } .ui-icon-arrow-4-diag { background-position: -16px -80px; } .ui-icon-extlink { background-position: -32px -80px; } .ui-icon-newwin { background-position: -48px -80px; } .ui-icon-refresh { background-position: -64px -80px; } .ui-icon-shuffle { background-position: -80px -80px; } .ui-icon-transfer-e-w { background-position: -96px -80px; } .ui-icon-transferthick-e-w { background-position: -112px -80px; } .ui-icon-folder-collapsed { background-position: 0 -96px; } .ui-icon-folder-open { background-position: -16px -96px; } .ui-icon-document { background-position: -32px -96px; } .ui-icon-document-b { background-position: -48px -96px; } .ui-icon-note { background-position: -64px -96px; } .ui-icon-mail-closed { background-position: -80px -96px; } .ui-icon-mail-open { background-position: -96px -96px; } .ui-icon-suitcase { background-position: -112px -96px; } .ui-icon-comment { background-position: -128px -96px; } .ui-icon-person { background-position: -144px -96px; } .ui-icon-print { background-position: -160px -96px; } .ui-icon-trash { background-position: -176px -96px; } .ui-icon-locked { background-position: -192px -96px; } .ui-icon-unlocked { background-position: -208px -96px; } .ui-icon-bookmark { background-position: -224px -96px; } .ui-icon-tag { background-position: -240px -96px; } .ui-icon-home { background-position: 0 -112px; } .ui-icon-flag { background-position: -16px -112px; } .ui-icon-calendar { background-position: -32px -112px; } .ui-icon-cart { background-position: -48px -112px; } .ui-icon-pencil { background-position: -64px -112px; } .ui-icon-clock { background-position: -80px -112px; } .ui-icon-disk { background-position: -96px -112px; } .ui-icon-calculator { background-position: -112px -112px; } .ui-icon-zoomin { background-position: -128px -112px; } .ui-icon-zoomout { background-position: -144px -112px; } .ui-icon-search { background-position: -160px -112px; } .ui-icon-wrench { background-position: -176px -112px; } .ui-icon-gear { background-position: -192px -112px; } .ui-icon-heart { background-position: -208px -112px; } .ui-icon-star { background-position: -224px -112px; } .ui-icon-link { background-position: -240px -112px; } .ui-icon-cancel { background-position: 0 -128px; } .ui-icon-plus { background-position: -16px -128px; } .ui-icon-plusthick { background-position: -32px -128px; } .ui-icon-minus { background-position: -48px -128px; } .ui-icon-minusthick { background-position: -64px -128px; } .ui-icon-close { background-position: -80px -128px; } .ui-icon-closethick { background-position: -96px -128px; } .ui-icon-key { background-position: -112px -128px; } .ui-icon-lightbulb { background-position: -128px -128px; } .ui-icon-scissors { background-position: -144px -128px; } .ui-icon-clipboard { background-position: -160px -128px; } .ui-icon-copy { background-position: -176px -128px; } .ui-icon-contact { background-position: -192px -128px; } .ui-icon-image { background-position: -208px -128px; } .ui-icon-video { background-position: -224px -128px; } .ui-icon-script { background-position: -240px -128px; } .ui-icon-alert { background-position: 0 -144px; } .ui-icon-info { background-position: -16px -144px; } .ui-icon-notice { background-position: -32px -144px; } .ui-icon-help { background-position: -48px -144px; } .ui-icon-check { background-position: -64px -144px; } .ui-icon-bullet { background-position: -80px -144px; } .ui-icon-radio-on { background-position: -96px -144px; } .ui-icon-radio-off { background-position: -112px -144px; } .ui-icon-pin-w { background-position: -128px -144px; } .ui-icon-pin-s { background-position: -144px -144px; } .ui-icon-play { background-position: 0 -160px; } .ui-icon-pause { background-position: -16px -160px; } .ui-icon-seek-next { background-position: -32px -160px; } .ui-icon-seek-prev { background-position: -48px -160px; } .ui-icon-seek-end { background-position: -64px -160px; } .ui-icon-seek-start { background-position: -80px -160px; } /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ .ui-icon-seek-first { background-position: -80px -160px; } .ui-icon-stop { background-position: -96px -160px; } .ui-icon-eject { background-position: -112px -160px; } .ui-icon-volume-off { background-position: -128px -160px; } .ui-icon-volume-on { background-position: -144px -160px; } .ui-icon-power { background-position: 0 -176px; } .ui-icon-signal-diag { background-position: -16px -176px; } .ui-icon-signal { background-position: -32px -176px; } .ui-icon-battery-0 { background-position: -48px -176px; } .ui-icon-battery-1 { background-position: -64px -176px; } .ui-icon-battery-2 { background-position: -80px -176px; } .ui-icon-battery-3 { background-position: -96px -176px; } .ui-icon-circle-plus { background-position: 0 -192px; } .ui-icon-circle-minus { background-position: -16px -192px; } .ui-icon-circle-close { background-position: -32px -192px; } .ui-icon-circle-triangle-e { background-position: -48px -192px; } .ui-icon-circle-triangle-s { background-position: -64px -192px; } .ui-icon-circle-triangle-w { background-position: -80px -192px; } .ui-icon-circle-triangle-n { background-position: -96px -192px; } .ui-icon-circle-arrow-e { background-position: -112px -192px; } .ui-icon-circle-arrow-s { background-position: -128px -192px; } .ui-icon-circle-arrow-w { background-position: -144px -192px; } .ui-icon-circle-arrow-n { background-position: -160px -192px; } .ui-icon-circle-zoomin { background-position: -176px -192px; } .ui-icon-circle-zoomout { background-position: -192px -192px; } .ui-icon-circle-check { background-position: -208px -192px; } .ui-icon-circlesmall-plus { background-position: 0 -208px; } .ui-icon-circlesmall-minus { background-position: -16px -208px; } .ui-icon-circlesmall-close { background-position: -32px -208px; } .ui-icon-squaresmall-plus { background-position: -48px -208px; } .ui-icon-squaresmall-minus { background-position: -64px -208px; } .ui-icon-squaresmall-close { background-position: -80px -208px; } .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } .ui-icon-grip-solid-vertical { background-position: -32px -224px; } .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } .ui-icon-grip-diagonal-se { background-position: -80px -224px; } /* Misc visuals ----------------------------------*/ /* Corner radius */ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { border-top-left-radius: 4px; } .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { border-top-right-radius: 4px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { border-bottom-left-radius: 4px; } .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { border-bottom-right-radius: 4px; } /* Overlays */ .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3; filter: Alpha(Opacity=30); } .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3; filter: Alpha(Opacity=30); border-radius: 8px; } astropy-0.3/astropy/table/data/demo_page.css0000644000175000017500000000265312243255342017340 0ustar oleole /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * General page setup */ #dt_example { font: 80%/1.45em "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; margin: 0; padding: 0; color: #333; background-color: #fff; } #dt_example #container { width: 800px; margin: 30px auto; padding: 0; } #dt_example #footer { margin: 50px auto 0 auto; padding: 0; } #dt_example #demo { margin: 30px auto 0 auto; } #dt_example .demo_jui { margin: 30px auto 0 auto; } #dt_example .big { font-size: 1.3em; font-weight: bold; line-height: 1.6em; color: #4E6CA3; } #dt_example .spacer { height: 20px; clear: both; } #dt_example .clear { clear: both; } #dt_example pre { padding: 15px; background-color: #F5F5F5; border: 1px solid #CCCCCC; } #dt_example h1 { margin-top: 2em; font-size: 1.3em; font-weight: normal; line-height: 1.6em; color: #4E6CA3; border-bottom: 1px solid #B0BED9; clear: both; } #dt_example h2 { font-size: 1.2em; font-weight: normal; line-height: 1.6em; color: #4E6CA3; clear: both; } #dt_example a { color: #0063DC; text-decoration: none; } #dt_example a:hover { text-decoration: underline; } #dt_example ul { color: #4E6CA3; } .css_right { float: right; } .css_left { float: left; } td.last-updated-cell { border:solid; background-color: yellow !important } tr.last-added-row { border:solid; } tr.last-added-row td { background-color: green !important }astropy-0.3/astropy/table/data/demo_table.css0000644000175000017500000002164712243255342017517 0ustar oleole.dataTables_wrapper { clear: both; position: relative; } .dataTables_processing { background-color: white; border: 1px solid #DDDDDD; color: #999999; font-size: 14px; height: 30px; left: 50%; margin-left: -125px; margin-top: -15px; padding: 14px 0 2px; position: absolute; text-align: center; top: 50%; width: 250px; } .dataTables_length { float: left; width: 40%; } .dataTables_filter { float: right; text-align: right; width: 50%; } .dataTables_info { float: left; width: 60%; } .dataTables_paginate { float: right; text-align: right; } .paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { color: #111111 !important; cursor: pointer; float: left; height: 19px; } .paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover { text-decoration: none !important; } .paginate_disabled_previous:active, .paginate_enabled_previous:active, .paginate_disabled_next:active, .paginate_enabled_next:active { outline: medium none; } .paginate_disabled_previous, .paginate_disabled_next { color: #666666 !important; } .paginate_disabled_previous, .paginate_enabled_previous { padding-left: 23px; } .paginate_disabled_next, .paginate_enabled_next { margin-left: 10px; padding-right: 23px; } .paginate_disabled_previous { background: url("../images/back_disabled.png") no-repeat scroll left top transparent; } .paginate_enabled_previous { background: url("../images/back_enabled.png") no-repeat scroll left top transparent; } .paginate_enabled_previous:hover { background: url("../images/back_enabled_hover.png") no-repeat scroll left top transparent; } .paginate_disabled_next { background: url("../images/forward_disabled.png") no-repeat scroll right top transparent; } .paginate_enabled_next { background: url("../images/forward_enabled.png") no-repeat scroll right top transparent; } .paginate_enabled_next:hover { background: url("../images/forward_enabled_hover.png") no-repeat scroll right top transparent; } table.display { clear: both; margin: 0 auto; width: 100%; } table.display thead th { border-bottom: 1px solid black; cursor: pointer; font-weight: bold; padding: 3px 18px 3px 10px; } table.display tfoot th { border-top: 1px solid black; font-weight: bold; padding: 3px 18px 3px 10px; } table.display tr.heading2 td { border-bottom: 1px solid #AAAAAA; } table.display td { padding: 3px 10px; } table.display td.center { text-align: center; } .sorting_asc { background: url("../images/sort_asc.png") no-repeat scroll right center transparent; } .sorting_desc { background: url("../images/sort_desc.png") no-repeat scroll right center transparent; } .sorting { background: url("../images/sort_both.png") no-repeat scroll right center transparent; } .sorting_asc_disabled { background: url("../images/sort_asc_disabled.png") no-repeat scroll right center transparent; } .sorting_desc_disabled { background: url("../images/sort_desc_disabled.png") no-repeat scroll right center transparent; } th:active { outline: medium none; } table.display tr.odd.gradeA { background-color: #DDFFDD; } table.display tr.even.gradeA { background-color: #EEFFEE; } table.display tr.odd.gradeC { background-color: #DDDDFF; } table.display tr.even.gradeC { background-color: #EEEEFF; } table.display tr.odd.gradeX { background-color: #FFDDDD; } table.display tr.even.gradeX { background-color: #FFEEEE; } table.display tr.odd.gradeU { background-color: #DDDDDD; } table.display tr.even.gradeU { background-color: #EEEEEE; } tr.odd { background-color: #E2E4FF; } tr.even { background-color: white; } .dataTables_scroll { clear: both; } .dataTables_scrollBody { } .top, .bottom { background-color: #F5F5F5; border: 1px solid #CCCCCC; padding: 15px; } .top .dataTables_info { float: none; } .clear { clear: both; } .dataTables_empty { text-align: center; } tfoot input { color: #444444; margin: 0.5em 0; width: 100%; } tfoot input.search_init { color: #999999; } td.group { background-color: #D1CFD0; border-bottom: 2px solid #A19B9E; border-top: 2px solid #A19B9E; } td.details { background-color: #D1CFD0; border: 2px solid #A19B9E; } .example_alt_pagination div.dataTables_info { width: 40%; } .paging_full_numbers { height: 22px; line-height: 22px; width: 400px; } .paging_full_numbers a:active { outline: medium none; } .paging_full_numbers a:hover { text-decoration: none; } .paging_full_numbers a.paginate_button, .paging_full_numbers a.paginate_active { border: 1px solid #AAAAAA; border-radius: 5px 5px 5px 5px; color: #333333 !important; cursor: pointer; margin: 0 3px; padding: 2px 5px; } .paging_full_numbers a.paginate_button { background-color: #DDDDDD; } .paging_full_numbers a.paginate_button:hover { background-color: #CCCCCC; text-decoration: none !important; } .paging_full_numbers a.paginate_active { background-color: #99B3FF; } table.display tr.even.row_selected td { background-color: #B0BED9; } table.display tr.odd.row_selected td { background-color: #9FAFD1; } tr.odd td.sorting_1 { background-color: #D3D6FF; } tr.odd td.sorting_2 { background-color: #DADCFF; } tr.odd td.sorting_3 { background-color: #E0E2FF; } tr.even td.sorting_1 { background-color: #EAEBFF; } tr.even td.sorting_2 { background-color: #F2F3FF; } tr.even td.sorting_3 { background-color: #F9F9FF; } tr.odd.gradeA td.sorting_1 { background-color: #C4FFC4; } tr.odd.gradeA td.sorting_2 { background-color: #D1FFD1; } tr.odd.gradeA td.sorting_3 { background-color: #D1FFD1; } tr.even.gradeA td.sorting_1 { background-color: #D5FFD5; } tr.even.gradeA td.sorting_2 { background-color: #E2FFE2; } tr.even.gradeA td.sorting_3 { background-color: #E2FFE2; } tr.odd.gradeC td.sorting_1 { background-color: #C4C4FF; } tr.odd.gradeC td.sorting_2 { background-color: #D1D1FF; } tr.odd.gradeC td.sorting_3 { background-color: #D1D1FF; } tr.even.gradeC td.sorting_1 { background-color: #D5D5FF; } tr.even.gradeC td.sorting_2 { background-color: #E2E2FF; } tr.even.gradeC td.sorting_3 { background-color: #E2E2FF; } tr.odd.gradeX td.sorting_1 { background-color: #FFC4C4; } tr.odd.gradeX td.sorting_2 { background-color: #FFD1D1; } tr.odd.gradeX td.sorting_3 { background-color: #FFD1D1; } tr.even.gradeX td.sorting_1 { background-color: #FFD5D5; } tr.even.gradeX td.sorting_2 { background-color: #FFE2E2; } tr.even.gradeX td.sorting_3 { background-color: #FFE2E2; } tr.odd.gradeU td.sorting_1 { background-color: #C4C4C4; } tr.odd.gradeU td.sorting_2 { background-color: #D1D1D1; } tr.odd.gradeU td.sorting_3 { background-color: #D1D1D1; } tr.even.gradeU td.sorting_1 { background-color: #D5D5D5; } tr.even.gradeU td.sorting_2 { background-color: #E2E2E2; } tr.even.gradeU td.sorting_3 { background-color: #E2E2E2; } .ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted { background-color: #ECFFB3; } .ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted { background-color: #E6FF99; } .ex_highlight_row #example tr.even:hover { background-color: #ECFFB3; } .ex_highlight_row #example tr.even:hover td.sorting_1 { background-color: #DDFF75; } .ex_highlight_row #example tr.even:hover td.sorting_2 { background-color: #E7FF9E; } .ex_highlight_row #example tr.even:hover td.sorting_3 { background-color: #E2FF89; } .ex_highlight_row #example tr.odd:hover { background-color: #E6FF99; } .ex_highlight_row #example tr.odd:hover td.sorting_1 { background-color: #D6FF5C; } .ex_highlight_row #example tr.odd:hover td.sorting_2 { background-color: #E0FF84; } .ex_highlight_row #example tr.odd:hover td.sorting_3 { background-color: #DBFF70; } table.KeyTable td { border: 3px solid transparent; } table.KeyTable td.focus { border: 3px solid #3366FF; } table.display tr.gradeA { background-color: #EEFFEE; } table.display tr.gradeC { background-color: #DDDDFF; } table.display tr.gradeX { background-color: #FFDDDD; } table.display tr.gradeU { background-color: #DDDDDD; } div.box { background-color: #E5E5FF; border: 1px solid #8080FF; height: 100px; overflow: auto; padding: 10px; } .number_range_filter { width: 20px; } .date_range_filter { width: 5.5em; } .search_init { color: #999999; } astropy-0.3/astropy/table/jsviewer.py0000644000175000017500000000756512243255342016214 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst # TODO: need to download some images used by the jquery-ui css file: # images/ui-icons_888888_256x240.png import os data_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),'data') ipynb_js_script = """ """ commandline_js_script = """ """ class JSViewer(object): def __init__(self, css_files=['jquery-ui.css','demo_page.css','demo_table.css'], display_length=50): self.css_urls = ["file://"+os.path.join(data_path,c) for c in css_files] self.display_length_menu = [[10, 25, 50, 100, 500, 1000, -1], [10, 25, 50, 100, 500, 1000, "All"]] self.display_length = display_length for L in self.display_length_menu: if display_length not in L: L.insert(0,display_length) def _jquery_file(self): # downloaded from http://ajax.googleapis.com/ajax/libs/jquery/1/ return ''.format(data_path=data_path) def _jstable_file(self): # downloaded from http://datatables.net/download/build/ return ''.format(data_path=data_path) def _css_files(self): return [''.format(css=css) for css in self.css_urls] def ipynb(self, tableid): js = self._css_files() js.append(self._jstable_file()) js.append(ipynb_js_script.format(display_length=self.display_length, display_length_menu=self.display_length_menu, tid=tableid, data_path="file://"+data_path)) return js def command_line(self, tableid='table0'): js = self._css_files() js.append(self._jquery_file()) js.append(self._jstable_file()) js.append(commandline_js_script.format(display_length=self.display_length, display_length_menu=self.display_length_menu, tid=tableid)) return js astropy-0.3/astropy/table/np_utils.py0000644000175000017500000005122312243255342016201 0ustar oleole""" High-level operations for numpy structured arrays. join(): Perform a database join of two numpy ndarrays. hstack(): Horizontally stack a list of numpy ndarrays. vstack(): Vertically stack a list of numpy ndarrays. Some code and inspriration taken from numpy.lib.recfunctions.join_by(). Redistribution license restrictions apply. """ from itertools import izip, chain import collections import numpy as np import numpy.ma as ma from . import _np_utils from ..utils import OrderedDict __all__ = ['join', 'hstack', 'vstack', 'TableMergeError'] class TableMergeError(ValueError): pass def _counter(iterable): """ Count instances of each unique value in ``iterable``. Returns a dict with the counts. Would use collections.Counter but this isn't available in 2.6. """ counts = collections.defaultdict(int) for val in iterable: counts[val] += 1 return counts def get_col_name_map(arrays, common_names, uniq_col_name='{col_name}_{table_name}', table_names=None): """ Find the column names mapping when merging the list of structured ndarrays ``arrays``. It is assumed that col names in ``common_names`` are to be merged into a single column while the rest will be uniquely represented in the output. The args ``uniq_col_name`` and ``table_names`` specify how to rename columns in case of conflicts. Returns a dict mapping each output column name to the input(s). This takes the form {outname : (col_name_0, col_name_1, ...), ... }. For key columns all of input names will be present, while for the other non-key columns the value will be (col_name_0, None, ..) or (None, col_name_1, ..) etc. """ col_name_map = collections.defaultdict(lambda: [None] * len(arrays)) col_name_list = [] if table_names is None: table_names = [str(ii + 1) for ii in range(len(arrays))] for idx, array in enumerate(arrays): table_name = table_names[idx] for name in array.dtype.names: out_name = name if name in common_names: # If name is in the list of common_names then insert into # the column name list, but just once. if name not in col_name_list: col_name_list.append(name) else: # If name is not one of the common column outputs, and it collides # with the names in one of the other arrays, then rename others = (x for x in arrays if x is not array) if any(name in other.dtype.names for other in others): out_name = uniq_col_name.format(table_name=table_name, col_name=name) col_name_list.append(out_name) col_name_map[out_name][idx] = name # Check for duplicate output column names col_name_count = _counter(col_name_list) repeated_names = [name for name, count in col_name_count.items() if count > 1] if repeated_names: raise TableMergeError('Merging column names resulted in duplicates: {0:s}. ' 'Change uniq_col_name or table_names args to fix this.' .format(repeated_names)) # Convert col_name_map to a regular dict with tuple (immutable) values col_name_map = OrderedDict((name, col_name_map[name]) for name in col_name_list) return col_name_map def get_descrs(arrays, col_name_map): """ Find the dtypes descrs resulting from merging the list of arrays' dtypes, using the column name mapping ``col_name_map``. Return a list of descrs for the output. """ out_descrs = [] for out_name, in_names in col_name_map.items(): # List of input arrays that contribute to this output column in_cols = [arr[name] for arr, name in izip(arrays, in_names) if name is not None] # Output dtype is the superset of all dtypes in in_arrays dtype = common_dtype(in_cols) # Make sure all input shapes are the same uniq_shapes = set(col.shape[1:] for col in in_cols) if len(uniq_shapes) != 1: raise TableMergeError('Key columns {0!r} have different shape'.format(name)) shape = uniq_shapes.pop() out_descrs.append((out_name, dtype, shape)) return out_descrs def common_dtype(cols): """ Use numpy to find the common dtype for a list of structured ndarray columns. Only allow columns within the following fundamental numpy data types: np.bool_, np.object_, np.number, np.character, np.void """ np_types = (np.bool_, np.object_, np.number, np.character, np.void) uniq_types = set(tuple(issubclass(col.dtype.type, np_type) for np_type in np_types) for col in cols) if len(uniq_types) > 1: raise TableMergeError('Columns have incompatible types {0}' .format([col.dtype.name for col in cols])) arrs = [np.empty(1, dtype=col.dtype) for col in cols] # For string-type arrays need to explicitly fill in non-zero # values or the final arr_common = .. step is unpredictable. for arr in arrs: if arr.dtype.kind in ('S', 'U'): arr[0] = '0' * arr.itemsize arr_common = np.array([arr[0] for arr in arrs]) return arr_common.dtype.str def join(left, right, keys=None, join_type='inner', uniq_col_name='{col_name}_{table_name}', table_names=['1', '2'], col_name_map=None): """ Perform a join of the left and right numpy structured array on specified keys. Parameters ---------- left : structured array Left side table in the join right : structured array Right side table in the join keys : str or list of str Name(s) of column(s) used to match rows of left and right tables. Default is to use all columns which are common to both tables. join_type : str Join type ('inner' | 'outer' | 'left' | 'right'), default is 'inner' uniq_col_name : str or None String generate a unique output column name in case of a conflict. The default is '{col_name}_{table_name}'. table_names : list of str or None Two-element list of table names used when generating unique output column names. The default is ['1', '2']. col_name_map : empty dict or None If passed as a dict then it will be updated in-place with the mapping of output to input column names. """ # Store user-provided col_name_map until the end _col_name_map = col_name_map if join_type not in ('inner', 'outer', 'left', 'right'): raise ValueError("The 'join_type' argument should be in 'inner', " "'outer', 'left' or 'right' (got '{0}' instead)". format(join_type)) # If we have a single key, put it in a tuple if keys is None: keys = tuple(name for name in left.dtype.names if name in right.dtype.names) if len(keys) == 0: raise TableMergeError('No keys in common between left and right tables') elif isinstance(keys, basestring): keys = (keys,) # Check the key columns for arr, arr_label in ((left, 'Left'), (right, 'Right')): for name in keys: if name not in arr.dtype.names: raise TableMergeError('{0} table does not have key column {1!r}' .format(arr_label, name)) if hasattr(arr[name], 'mask') and np.any(arr[name].mask): raise TableMergeError('{0} key column {1!r} has missing values' .format(arr_label, name)) # Make sure we work with ravelled arrays left = left.ravel() right = right.ravel() len_left, len_right = len(left), len(right) left_names, right_names = left.dtype.names, right.dtype.names # Joined array dtype as a list of descr (name, type_str, shape) tuples col_name_map = get_col_name_map([left, right], keys, uniq_col_name, table_names) out_descrs = get_descrs([left, right], col_name_map) # Make an array with just the key columns out_keys_dtype = [descr for descr in out_descrs if descr[0] in keys] out_keys = np.empty(len_left + len_right, dtype=out_keys_dtype) for key in keys: out_keys[key][:len_left] = left[key] out_keys[key][len_left:] = right[key] idx_sort = out_keys.argsort(order=keys) out_keys = out_keys[idx_sort] # Get all keys diffs = np.concatenate(([True], out_keys[1:] != out_keys[:-1], [True])) idxs = np.flatnonzero(diffs) # Main inner loop in Cython to compute the cartesion product # indices for the given join type int_join_type = {'inner': 0, 'outer': 1, 'left': 2, 'right': 3}[join_type] masked, n_out, left_out, left_mask, right_out, right_mask = \ _np_utils.join_inner(idxs, idx_sort, len_left, int_join_type) # If either of the inputs are masked then the output is masked if any(isinstance(array, ma.MaskedArray) for array in (left, right)): masked = True if masked: out = ma.empty(n_out, dtype=out_descrs) else: out = np.empty(n_out, dtype=out_descrs) # If either input array was zero length then stub a new version # with one row. In this case the corresponding left_out or right_out # will contain all zeros with mask set to true. This allows the # take(*_out) method calls to work as expected. if len(left) == 0: left = left.__class__(1, dtype=left.dtype) if len(right) == 0: right = right.__class__(1, dtype=right.dtype) for out_name, left_right_names in col_name_map.items(): left_name, right_name = left_right_names if left_name and right_name: # this is a key which comes from left and right out[out_name] = np.where(right_mask, left[left_name].take(left_out), right[right_name].take(right_out)) continue elif left_name: # out_name came from the left table name, array, array_out, array_mask = left_name, left, left_out, left_mask elif right_name: name, array, array_out, array_mask = right_name, right, right_out, right_mask else: raise TableMergeError('Unexpected column names (maybe one is ""?)') out[out_name] = array[name].take(array_out) if masked: if isinstance(array, ma.MaskedArray): array_mask = array_mask | array[name].mask.take(array_out) out[out_name].mask = array_mask # If col_name_map supplied as a dict input, then update. if isinstance(_col_name_map, collections.Mapping): _col_name_map.update(col_name_map) return out def _check_for_sequence_of_structured_arrays(arrays): err = '`arrays` arg must be a sequence (e.g. list) of structured arrays' if not isinstance(arrays, collections.Sequence): raise TypeError(err) for array in arrays: # Must be structured array if not isinstance(array, np.ndarray) or array.dtype.names is None: raise TypeError(err) if len(arrays) == 0: raise ValueError('`arrays` arg must include at least one array') def vstack(arrays, join_type='inner', col_name_map=None): """ Stack structured arrays vertically (by rows) A ``join_type`` of 'exact' (default) means that the arrays must all have exactly the same column names (though the order can vary). If ``join_type`` is 'inner' then the intersection of common columns will be output. A value of 'outer' means the output will have the union of all columns, with array values being masked where no common values are available. Parameters ---------- arrays : list of structured arrays Structured array(s) to stack by rows (vertically) join_type : str Join type ('inner' | 'exact' | 'outer'), default is 'exact' col_name_map : empty dict or None If passed as a dict then it will be updated in-place with the mapping of output to input column names. Examples -------- To stack two structured arrays by rows do:: >>> from astropy.table import np_utils >>> t1 = np.array([(1, 2), ... (3, 4)], dtype=[('a', 'i4'), ('b', 'i4')]) >>> t2 = np.array([(5, 6), ... (7, 8)], dtype=[('a', 'i4'), ('b', 'i4')]) >>> np_utils.vstack([t1, t2]) array([(1, 2), (3, 4), (5, 6), (7, 8)], dtype=[('a', '>> from astropy.table import np_utils >>> t1 = np.array([(1, 2), ... (3, 4)], dtype=[('a', 'i4'), ('b', 'i4')]) >>> t2 = np.array([(5, 6), ... (7, 8)], dtype=[('c', 'i4'), ('d', 'i4')]) >>> np_utils.hstack([t1, t2]) array([(1, 2, 5, 6), (3, 4, 7, 8)], dtype=[('a', ' 1: raise TableMergeError("Inconsistent number of rows in input arrays " "(use 'inner' or 'outer' join_type to allow " "non-matching rows)") join_type = 'outer' # For an inner join, keep only columns where all input arrays have that column if join_type == 'inner': min_arr_len = min(arr_lens) arrays = [arr[:min_arr_len] for arr in arrays] arr_lens = [min_arr_len for arr in arrays] # If there are any output rows where one or more input arrays are missing # then the output must be masked. If any input arrays are masked then # output is masked. masked = (any(isinstance(arr, ma.MaskedArray) for arr in arrays) or len(set(arr_lens)) > 1) n_rows = max(arr_lens) out_descrs = get_descrs(arrays, col_name_map) if masked: # Adapted from ma.all_masked() code. Here the array is filled with # zeros instead of empty. This avoids the bug reported here: # https://github.com/numpy/numpy/issues/3276 out = ma.masked_array(np.zeros(n_rows, out_descrs), mask=np.ones(n_rows, ma.make_mask_descr(out_descrs))) else: out = np.empty(n_rows, dtype=out_descrs) for out_name, in_names in col_name_map.items(): for name, array, arr_len in izip(in_names, arrays, arr_lens): if name is not None: out[out_name][:arr_len] = array[name] # If col_name_map supplied as a dict input, then update. if isinstance(_col_name_map, collections.Mapping): _col_name_map.update(col_name_map) return out def get_groups(table, keys): """ Get groups for numpy structured array on specified keys. Parameters ---------- table : structured array Table to group keys : str or list of str Name(s) of column(s) used to match rows of table. """ if isinstance(keys, basestring): keys = (keys,) # Check the key columns for name in keys: if name not in table.dtype.names: raise TableMergeError('Table does not have key column {1!r}' .format(name)) if hasattr(table[name], 'mask') and np.any(table[name].mask): raise TableMergeError('{0} key column {1!r} has missing values' .format(name)) # Make sure we work with ravelled arrays table = table.ravel() len_table = len(table) # oined array dtype as a list of descr (name, type_str, shape) tuples col_name_map = get_col_name_map([table], keys) out_descrs = get_descrs([table], col_name_map) # Make an array with just the key columns out_keys_dtype = [descr for descr in out_descrs if descr[0] in keys] out_keys = np.empty(len_table, dtype=out_keys_dtype) for key in keys: out_keys[key] = table[key] idx_sort = out_keys.argsort(order=keys) out_keys = out_keys[idx_sort] # Get all keys diffs = np.concatenate(([True], out_keys[1:] != out_keys[:-1], [True])) idxs = np.flatnonzero(diffs) return idxs, out_keys astropy-0.3/astropy/utils/0000755000175000017500000000000012243263747014050 5ustar oleoleastropy-0.3/astropy/utils/iers/0000755000175000017500000000000012243263747015012 5ustar oleoleastropy-0.3/astropy/utils/iers/tests/0000755000175000017500000000000012243263747016154 5ustar oleoleastropy-0.3/astropy/utils/iers/tests/test_iers.py0000644000175000017500000000572712243255342020532 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import functools import numpy as np from ....tests.helper import pytest from .. import iers from ....table import Table from ....time import Time allclose_sec = functools.partial(np.allclose, rtol=1e-15, atol=1e-9) # 1 nanosec atol try: iers.IERS_A.open() # check if IERS_A is available except IOError: HAS_IERS_A = False else: HAS_IERS_A = True class TestBasic(): """Basic tests that IERS_B returns correct values""" def test_simple(self): iers.IERS.close() assert iers.IERS.iers_table is None iers_tab = iers.IERS.open() assert iers.IERS.iers_table is not None assert isinstance(iers.IERS.iers_table, Table) jd1 = np.array([2456108.5, 2456108.5, 2456108.5, 2456109.5, 2456109.5]) jd2 = np.array([0.49999421, 0.99997685, 0.99998843, 0., 0.5]) ut1_utc = iers_tab.ut1_utc(jd1, jd2) assert allclose_sec(ut1_utc, np.array([-0.5868211, -0.5868184, -0.5868184, 0.4131816, 0.41328895])) # should be future-proof; surely we've moved to another planet by then with pytest.raises(IndexError): ut1_utc2, status2 = iers_tab.ut1_utc(1e11, 0.) # also check it returns the right status ut1_utc2, status2 = iers_tab.ut1_utc(jd1, jd2, return_status=True) assert np.all(status2 == iers.FROM_IERS_B) ut1_utc4, status4 = iers_tab.ut1_utc(1e11, 0., return_status=True) assert status4 == iers.TIME_BEYOND_IERS_RANGE # check it works via Time too t = Time(jd1, jd2, format='jd', scale='utc') ut1_utc3 = iers_tab.ut1_utc(t) assert allclose_sec(ut1_utc3, np.array([-0.5868211, -0.5868184, -0.5868184, 0.4131816, 0.41328895])) @pytest.mark.skipif(str('not HAS_IERS_A')) class TestIERS_A(): def test_simple(self): iers_tab = iers.IERS_A.open() jd1 = np.array([2456108.5, 2456108.5, 2456108.5, 2456109.5, 2456109.5]) jd2 = np.array([0.49999421, 0.99997685, 0.99998843, 0., 0.5]) ut1_utc, status = iers_tab.ut1_utc(jd1, jd2, return_status=True) assert np.all(status == iers.FROM_IERS_B) assert allclose_sec(ut1_utc, np.array([-0.5868211, -0.5868184, -0.5868184, 0.4131816, 0.41328895])) ut1_utc2, status2 = iers_tab.ut1_utc(1e11, 0., return_status=True) assert status2 == iers.TIME_BEYOND_IERS_RANGE tnow = Time.now() ut1_utc3, status3 = iers_tab.ut1_utc(tnow, return_status=True) assert status3 == iers.FROM_IERS_A_PREDICTION assert ut1_utc3 != 0. astropy-0.3/astropy/utils/iers/tests/__init__.py0000644000175000017500000000015512243255342020256 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) astropy-0.3/astropy/utils/iers/__init__.py0000644000175000017500000000020212243255342017105 0ustar oleolefrom __future__ import (absolute_import, division, print_function, unicode_literals) from .iers import * astropy-0.3/astropy/utils/iers/iers.py0000644000175000017500000003147412243255342016327 0ustar oleole# Licensed under a 3-clause BSD style license - see LICENSE.rst """ The astropy.utils.iers package provides access to the tables provided by the International Earth Rotation and Reference Systems Service, in particular allowing interpolation of published UT1-UTC values for given times. These are used in astropy.time to provide UT1 values. By default, IERS B values provided as part of astropy are used, but user-downloaded files can be substituted. Generally, there is no need to invoke the iers classes oneself. E.g., the default IERS B table is loaded as necessary in `Time`:: >>> from astropy.time import Time >>> t = Time(['2012-06-30 12:00:00', '2012-06-30 23:59:59', ... '2012-06-30 23:59:60', '2012-07-01 00:00:00', ... '2012-07-01 12:00:00'], scale='utc') >>> t.ut1